NoahJosephHall

sonic 2 asm

Jan 21st, 2017
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 MB | None | 0 0
  1. ; Sonic the Hedgehog 2 disassembled binary
  2.  
  3. ; Nemesis, 2004: Created original disassembly for SNASM68K
  4. ; Aurochs, 2005: Translated to AS and annotated
  5. ; Xenowhirl, 2007: More annotation, overall cleanup, Z80 disassembly
  6. ; ---------------------------------------------------------------------------
  7. ; NOTES:
  8. ;
  9. ; Set your editor's tab width to 8 characters wide for viewing this file.
  10. ;
  11. ; It is highly suggested that you read the AS User's Manual before diving too
  12. ; far into this disassembly. At least read the section on nameless temporary
  13. ; symbols. Your brain may melt if you don't know how those work.
  14. ;
  15. ; See s2.notes.txt for more comments about this disassembly and other useful info.
  16.  
  17. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  18. ; ASSEMBLY OPTIONS:
  19. ;
  20. padToPowerOfTwo = 1
  21. ; | If 1, pads the end of the ROM to the next power of two bytes (for real hardware)
  22. ;
  23. allOptimizations = 0
  24. ; | If 1, enables all optimizations
  25. ;
  26. skipChecksumCheck = 0|allOptimizations
  27. ; | If 1, disables the unnecessary (and slow) bootup checksum calculation
  28. ;
  29. zeroOffsetOptimization = 0|allOptimizations
  30. ; | If 1, makes a handful of zero-offset instructions smaller
  31. ;
  32. removeJmpTos = 0|allOptimizations
  33. ; | If 1, many unnecessary JmpTos are removed, improving performance
  34. ;
  35. addsubOptimize = 0|allOptimizations
  36. ; | If 1, some add/sub instructions are optimized to addq/subq
  37. ;
  38. relativeLea = 1|allOptimizations
  39. ; | If 1, makes some instructions use pc-relative addressing, instead of absolute long
  40. ;
  41. useFullWaterTables = 0
  42. ; | If 1, zone offset tables for water levels cover all level slots instead of only slots 8-$F
  43. ; | Set to 1 if you've shifted level IDs around or you want water in levels with a level slot below 8
  44. gameRevision = 1
  45. ; | If 0, a REV00 ROM is built
  46. ; | If 1, a REV01 ROM is built, which contains some fixes
  47. ; | If 2, a (probable) REV02 ROM is built, which contains more fixes
  48. ; | (Bit-perfect REV02 requires removeJmpTos & addsubOptimize be set to 1,
  49. ; | and also requires relativeLea to be 0)
  50.  
  51. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  52. ; AS-specific macros and assembler settings
  53. CPU 68000
  54. include "s2.macrosetup.asm"
  55.  
  56. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  57. ; Equates section - Names for variables.
  58. include "s2.constants.asm"
  59.  
  60. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  61. ; simplifying macros and functions
  62. include "s2.macros.asm"
  63.  
  64. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  65. ; start of ROM
  66.  
  67. StartOfRom:
  68. if * <> 0
  69. fatal "StartOfRom was $\{*} but it should be 0"
  70. endif
  71. ;Vectors:
  72. dc.l System_Stack, EntryPoint, ErrorTrap, ErrorTrap; 4
  73. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 8
  74. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 12
  75. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 16
  76. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 20
  77. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 24
  78. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 28
  79. dc.l H_Int, ErrorTrap, V_Int, ErrorTrap; 32
  80. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 36
  81. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 40
  82. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 44
  83. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 48
  84. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 52
  85. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 56
  86. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 60
  87. dc.l ErrorTrap, ErrorTrap, ErrorTrap, ErrorTrap; 64
  88. ; byte_100:
  89. Header:
  90. dc.b "SEGA GENESIS " ; Console name
  91. dc.b "(C)SEGA 1992.SEP" ; Copyright/Date
  92. dc.b "SONIC THE HEDGEHOG 2 " ; Domestic name
  93. dc.b "SONIC THE HEDGEHOG 2 " ; International name
  94. if gameRevision=0
  95. dc.b "GM 00001051-00" ; Version (REV00)
  96. elseif gameRevision=1
  97. dc.b "GM 00001051-01" ; Version (REV01)
  98. else;if gameRevision=2
  99. dc.b "GM 00001051-02" ; Version (REV02)
  100. endif
  101. ; word_18E
  102. Checksum:
  103. dc.w $D951 ; Checksum (patched later if incorrect)
  104. dc.b "J " ; I/O Support
  105. dc.l StartOfRom ; ROM Start
  106. ; dword_1A4
  107. ROMEndLoc:
  108. dc.l EndOfRom-1 ; ROM End
  109. dc.l RAM_Start&$FFFFFF ; RAM Start
  110. dc.l (RAM_End-1)&$FFFFFF ; RAM End
  111. dc.b " " ; Backup RAM ID
  112. dc.l $20202020 ; Backup RAM start address
  113. dc.l $20202020 ; Backup RAM end address
  114. dc.b " " ; Modem support
  115. dc.b " " ; Notes
  116. dc.b "JUE " ; Country
  117. EndOfHeader:
  118.  
  119. ; ===========================================================================
  120. ; Crash/Freeze the 68000. Note that the Z80 continues to run, so the music keeps playing.
  121. ; loc_200:
  122. ErrorTrap:
  123. nop
  124. nop
  125. bra.s ErrorTrap
  126.  
  127. ; ===========================================================================
  128. ; loc_206:
  129. EntryPoint:
  130. tst.l (HW_Port_1_Control-1).l ; test ports A and B control
  131. bne.s PortA_Ok
  132. tst.w (HW_Expansion_Control-1).l ; test port C control
  133. ; loc_214:
  134. PortA_Ok:
  135. bne.s PortC_OK ; skip the VDP and Z80 setup code if port A, B or C is ok...?
  136. lea SetupValues(pc),a5
  137. movem.w (a5)+,d5-d7
  138. movem.l (a5)+,a0-a4
  139. move.b HW_Version-Z80_Bus_Request(a1),d0 ; get hardware version
  140. andi.b #$F,d0
  141. beq.s SkipSecurity ; branch if hardware is older than Genesis III
  142. move.l #'SEGA',Security_Addr-Z80_Bus_Request(a1) ; satisfy the TMSS
  143. ; loc_234:
  144. SkipSecurity:
  145. move.w (a4),d0 ; check if VDP works
  146. moveq #0,d0
  147. movea.l d0,a6
  148. move.l a6,usp ; set usp to $0
  149. moveq #VDPInitValues_End-VDPInitValues-1,d1 ; run the following loop $18 times
  150. ; loc_23E:
  151. VDPInitLoop:
  152. move.b (a5)+,d5 ; add $8000 to value
  153. move.w d5,(a4) ; move value to VDP register
  154. add.w d7,d5 ; next register
  155. dbf d1,VDPInitLoop
  156.  
  157. move.l (a5)+,(a4) ; set VRAM write mode
  158. move.w d0,(a3) ; clear the screen
  159. move.w d7,(a1) ; stop the Z80
  160. move.w d7,(a2) ; reset the Z80
  161. ; loc_250:
  162. WaitForZ80:
  163. btst d0,(a1) ; has the Z80 stopped?
  164. bne.s WaitForZ80 ; if not, branch
  165. moveq #Z80StartupCodeEnd-Z80StartupCodeBegin-1,d2
  166. ; loc_256:
  167. Z80InitLoop:
  168. move.b (a5)+,(a0)+
  169. dbf d2,Z80InitLoop
  170.  
  171. move.w d0,(a2)
  172. move.w d0,(a1) ; start the Z80
  173. move.w d7,(a2) ; reset the Z80
  174. ; loc_262:
  175. ClrRAMLoop:
  176. move.l d0,-(a6)
  177. dbf d6,ClrRAMLoop ; clear the entire RAM
  178. move.l (a5)+,(a4) ; set VDP display mode and increment
  179. move.l (a5)+,(a4) ; set VDP to CRAM write
  180. moveq #bytesToLcnt($80),d3
  181. ; loc_26E:
  182. ClrCRAMLoop:
  183. move.l d0,(a3)
  184. dbf d3,ClrCRAMLoop ; clear the CRAM
  185. move.l (a5)+,(a4)
  186. moveq #bytesToLcnt($50),d4
  187. ; loc_278: ClrVDPStuff:
  188. ClrVSRAMLoop:
  189. move.l d0,(a3)
  190. dbf d4,ClrVSRAMLoop
  191. moveq #PSGInitValues_End-PSGInitValues-1,d5
  192. ; loc_280:
  193. PSGInitLoop:
  194. move.b (a5)+,PSG_input-VDP_data_port(a3) ; reset the PSG
  195. dbf d5,PSGInitLoop
  196. move.w d0,(a2)
  197. movem.l (a6),d0-a6 ; clear all registers
  198. move #$2700,sr ; set the sr
  199. ; loc_292:
  200. PortC_OK: ;;
  201. bra.s GameProgram
  202. ; ===========================================================================
  203. ; byte_294:
  204. SetupValues:
  205. dc.w $8000,bytesToLcnt($10000),$100
  206.  
  207. dc.l Z80_RAM
  208. dc.l Z80_Bus_Request
  209. dc.l Z80_Reset
  210. dc.l VDP_data_port, VDP_control_port
  211.  
  212. VDPInitValues: ; values for VDP registers
  213. dc.b 4 ; Command $8004 - HInt off, Enable HV counter read
  214. dc.b $14 ; Command $8114 - Display off, VInt off, DMA on, PAL off
  215. dc.b $30 ; Command $8230 - Scroll A Address $C000
  216. dc.b $3C ; Command $833C - Window Address $F000
  217. dc.b 7 ; Command $8407 - Scroll B Address $E000
  218. dc.b $6C ; Command $856C - Sprite Table Address $D800
  219. dc.b 0 ; Command $8600 - Null
  220. dc.b 0 ; Command $8700 - Background color Pal 0 Color 0
  221. dc.b 0 ; Command $8800 - Null
  222. dc.b 0 ; Command $8900 - Null
  223. dc.b $FF ; Command $8AFF - Hint timing $FF scanlines
  224. dc.b 0 ; Command $8B00 - Ext Int off, VScroll full, HScroll full
  225. dc.b $81 ; Command $8C81 - 40 cell mode, shadow/highlight off, no interlace
  226. dc.b $37 ; Command $8D37 - HScroll Table Address $DC00
  227. dc.b 0 ; Command $8E00 - Null
  228. dc.b 1 ; Command $8F01 - VDP auto increment 1 byte
  229. dc.b 1 ; Command $9001 - 64x32 cell scroll size
  230. dc.b 0 ; Command $9100 - Window H left side, Base Point 0
  231. dc.b 0 ; Command $9200 - Window V upside, Base Point 0
  232. dc.b $FF ; Command $93FF - DMA Length Counter $FFFF
  233. dc.b $FF ; Command $94FF - See above
  234. dc.b 0 ; Command $9500 - DMA Source Address $0
  235. dc.b 0 ; Command $9600 - See above
  236. dc.b $80 ; Command $9780 - See above + VRAM fill mode
  237. VDPInitValues_End:
  238.  
  239. dc.l vdpComm($0000,VRAM,DMA) ; value for VRAM write mode
  240.  
  241. ; Z80 instructions (not the sound driver; that gets loaded later)
  242. Z80StartupCodeBegin: ; loc_2CA:
  243. if (*)+$26 < $10000
  244. save
  245. CPU Z80 ; start assembling Z80 code
  246. phase 0 ; pretend we're at address 0
  247. xor a ; clear a to 0
  248. ld bc,((Z80_RAM_End-Z80_RAM)-zStartupCodeEndLoc)-1 ; prepare to loop this many times
  249. ld de,zStartupCodeEndLoc+1 ; initial destination address
  250. ld hl,zStartupCodeEndLoc ; initial source address
  251. ld sp,hl ; set the address the stack starts at
  252. ld (hl),a ; set first byte of the stack to 0
  253. ldir ; loop to fill the stack (entire remaining available Z80 RAM) with 0
  254. pop ix ; clear ix
  255. pop iy ; clear iy
  256. ld i,a ; clear i
  257. ld r,a ; clear r
  258. pop de ; clear de
  259. pop hl ; clear hl
  260. pop af ; clear af
  261. ex af,af' ; swap af with af'
  262. exx ; swap bc/de/hl with their shadow registers too
  263. pop bc ; clear bc
  264. pop de ; clear de
  265. pop hl ; clear hl
  266. pop af ; clear af
  267. ld sp,hl ; clear sp
  268. di ; clear iff1 (for interrupt handler)
  269. im 1 ; interrupt handling mode = 1
  270. ld (hl),0E9h ; replace the first instruction with a jump to itself
  271. jp (hl) ; jump to the first instruction (to stay there forever)
  272. zStartupCodeEndLoc:
  273. dephase ; stop pretending
  274. restore
  275. padding off ; unfortunately our flags got reset so we have to set them again...
  276. else ; due to an address range limitation I could work around but don't think is worth doing so:
  277. message "Warning: using pre-assembled Z80 startup code."
  278. dc.w $AF01,$D91F,$1127,$0021,$2600,$F977,$EDB0,$DDE1,$FDE1,$ED47,$ED4F,$D1E1,$F108,$D9C1,$D1E1,$F1F9,$F3ED,$5636,$E9E9
  279. endif
  280. Z80StartupCodeEnd:
  281.  
  282. dc.w $8104 ; value for VDP display mode
  283. dc.w $8F02 ; value for VDP increment
  284. dc.l vdpComm($0000,CRAM,WRITE) ; value for CRAM write mode
  285. dc.l vdpComm($0000,VSRAM,WRITE) ; value for VSRAM write mode
  286.  
  287. PSGInitValues:
  288. dc.b $9F,$BF,$DF,$FF ; values for PSG channel volumes
  289. PSGInitValues_End:
  290. ; ===========================================================================
  291.  
  292. even
  293. ; loc_300:
  294. GameProgram:
  295. tst.w (VDP_control_port).l
  296. ; loc_306:
  297. CheckSumCheck:
  298. if gameRevision>0
  299. move.w (VDP_control_port).l,d1
  300. btst #1,d1
  301. bne.s CheckSumCheck ; wait until DMA is completed
  302. endif
  303. btst #6,(HW_Expansion_Control).l
  304. beq.s ChecksumTest
  305. cmpi.l #'init',(Checksum_fourcc).w ; has checksum routine already run?
  306. beq.w GameInit
  307.  
  308. ; loc_328:
  309. ChecksumTest:
  310. if skipChecksumCheck=0 ; checksum code
  311. movea.l #EndOfHeader,a0 ; start checking bytes after the header ($200)
  312. movea.l #ROMEndLoc,a1 ; stop at end of ROM
  313. move.l (a1),d0
  314. moveq #0,d1
  315. ; loc_338:
  316. ChecksumLoop:
  317. add.w (a0)+,d1
  318. cmp.l a0,d0
  319. bhs.s ChecksumLoop
  320. movea.l #Checksum,a1 ; read the checksum
  321. cmp.w (a1),d1 ; compare correct checksum to the one in ROM
  322. bne.w ChecksumError ; if they don't match, branch
  323. endif
  324. ;checksum_good:
  325. lea (System_Stack).w,a6
  326. moveq #0,d7
  327.  
  328. move.w #bytesToLcnt($200),d6
  329. - move.l d7,(a6)+
  330. dbf d6,-
  331.  
  332. move.b (HW_Version).l,d0
  333. andi.b #$C0,d0
  334. move.b d0,(Graphics_Flags).w
  335. move.l #'init',(Checksum_fourcc).w ; set flag so checksum won't be run again
  336. ; loc_370:
  337. GameInit:
  338. lea (RAM_Start&$FFFFFF).l,a6
  339. moveq #0,d7
  340. move.w #bytesToLcnt(System_Stack&$FFFF),d6
  341. ; loc_37C:
  342. GameClrRAM:
  343. move.l d7,(a6)+
  344. dbf d6,GameClrRAM
  345.  
  346. bsr.w VDPSetupGame
  347. bsr.w JmpTo_SoundDriverLoad
  348. bsr.w JoypadInit
  349. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  350. ; loc_394:
  351. MainGameLoop:
  352. move.b (Game_Mode).w,d0
  353. andi.w #$3C,d0
  354. jsr GameModesArray(pc,d0.w)
  355. bra.s MainGameLoop
  356. ; ===========================================================================
  357. ; loc_3A2:
  358. GameModesArray: ;;
  359. GameMode_SegaScreen: bra.w SegaScreen ; SEGA screen mode
  360. GameMode_TitleScreen: bra.w TitleScreen ; Title screen mode
  361. GameMode_Demo: bra.w Level ; Demo mode
  362. GameMode_Level: bra.w Level ; Zone play mode
  363. GameMode_SpecialStage: bra.w SpecialStage ; Special stage play mode
  364. GameMode_ContinueScreen:bra.w ContinueScreen ; Continue mode
  365. GameMode_2PResults: bra.w TwoPlayerResults ; 2P results mode
  366. GameMode_2PLevelSelect: bra.w LevelSelectMenu2P ; 2P level select mode
  367. GameMode_EndingSequence:bra.w JmpTo_EndingSequence ; End sequence mode
  368. GameMode_OptionsMenu: bra.w OptionsMenu ; Options mode
  369. GameMode_LevelSelect: bra.w LevelSelectMenu ; Level select mode
  370. ; ===========================================================================
  371. if skipChecksumCheck=0 ; checksum error code
  372. ; loc_3CE:
  373. ChecksumError:
  374. move.l d1,-(sp)
  375. bsr.w VDPSetupGame
  376. move.l (sp)+,d1
  377. move.l #vdpComm($0000,CRAM,WRITE),(VDP_control_port).l
  378. moveq #$3F,d7
  379. ; loc_3E2:
  380. Checksum_Red:
  381. move.w #$E,(VDP_data_port).l
  382. dbf d7,Checksum_Red
  383. ; loc_3EE:
  384. ChecksumFailed_Loop:
  385. bra.s ChecksumFailed_Loop
  386. endif
  387. ; ===========================================================================
  388. ; loc_3F0:
  389. LevelSelectMenu2P: ;;
  390. jmp (MenuScreen).l
  391. ; ===========================================================================
  392. ; loc_3F6:
  393. JmpTo_EndingSequence
  394. jmp (EndingSequence).l
  395. ; ===========================================================================
  396. ; loc_3FC:
  397. OptionsMenu: ;;
  398. jmp (MenuScreen).l
  399. ; ===========================================================================
  400. ; loc_402:
  401. LevelSelectMenu: ;;
  402. jmp (MenuScreen).l
  403. ; ===========================================================================
  404.  
  405. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  406. ; vertical and horizontal interrupt handlers
  407. ; VERTICAL INTERRUPT HANDLER:
  408. V_Int:
  409. movem.l d0-a6,-(sp)
  410. tst.b (Vint_routine).w
  411. beq.w Vint_Lag
  412.  
  413. - move.w (VDP_control_port).l,d0
  414. andi.w #8,d0
  415. beq.s -
  416.  
  417. move.l #vdpComm($0000,VSRAM,WRITE),(VDP_control_port).l
  418. move.l (Vscroll_Factor).w,(VDP_data_port).l
  419. btst #6,(Graphics_Flags).w
  420. beq.s +
  421.  
  422. move.w #$700,d0
  423. - dbf d0,- ; wait here in a loop doing nothing for a while...
  424. +
  425. move.b (Vint_routine).w,d0
  426. move.b #VintID_Lag,(Vint_routine).w
  427. move.w #1,(Hint_flag).w
  428. andi.w #$3E,d0
  429. move.w Vint_SwitchTbl(pc,d0.w),d0
  430. jsr Vint_SwitchTbl(pc,d0.w)
  431.  
  432. VintRet:
  433. addq.l #1,(Vint_runcount).w
  434. movem.l (sp)+,d0-a6
  435. rte
  436. ; ===========================================================================
  437. Vint_SwitchTbl: offsetTable
  438. Vint_Lag_ptr offsetTableEntry.w Vint_Lag ; 0
  439. Vint_SEGA_ptr: offsetTableEntry.w Vint_SEGA ; 2
  440. Vint_Title_ptr: offsetTableEntry.w Vint_Title ; 4
  441. Vint_Unused6_ptr: offsetTableEntry.w Vint_Unused6 ; 6
  442. Vint_Level_ptr: offsetTableEntry.w Vint_Level ; 8
  443. Vint_S2SS_ptr: offsetTableEntry.w Vint_S2SS ; $A
  444. Vint_TitleCard_ptr: offsetTableEntry.w Vint_TitleCard ; $C
  445. Vint_UnusedE_ptr: offsetTableEntry.w Vint_UnusedE ; $E
  446. Vint_Pause_ptr: offsetTableEntry.w Vint_Pause ; $10
  447. Vint_Fade_ptr: offsetTableEntry.w Vint_Fade ; $12
  448. Vint_PCM_ptr: offsetTableEntry.w Vint_PCM ; $14
  449. Vint_Menu_ptr: offsetTableEntry.w Vint_Menu ; $16
  450. Vint_Ending_ptr: offsetTableEntry.w Vint_Ending ; $18
  451. Vint_CtrlDMA_ptr: offsetTableEntry.w Vint_CtrlDMA ; $1A
  452. ; ===========================================================================
  453. ;VintSub0
  454. Vint_Lag:
  455. cmpi.b #GameModeID_TitleCard|GameModeID_Demo,(Game_Mode).w ; pre-level Demo Mode?
  456. beq.s loc_4C4
  457. cmpi.b #GameModeID_TitleCard|GameModeID_Level,(Game_Mode).w ; pre-level Zone play mode?
  458. beq.s loc_4C4
  459. cmpi.b #GameModeID_Demo,(Game_Mode).w ; Demo Mode?
  460. beq.s loc_4C4
  461. cmpi.b #GameModeID_Level,(Game_Mode).w ; Zone play mode?
  462. beq.s loc_4C4
  463.  
  464. stopZ80 ; stop the Z80
  465. bsr.w sndDriverInput ; give input to the sound driver
  466. startZ80 ; start the Z80
  467.  
  468. bra.s VintRet
  469. ; ---------------------------------------------------------------------------
  470.  
  471. loc_4C4:
  472. tst.b (Water_flag).w
  473. beq.w Vint0_noWater
  474. move.w (VDP_control_port).l,d0
  475. btst #6,(Graphics_Flags).w
  476. beq.s +
  477.  
  478. move.w #$700,d0
  479. - dbf d0,- ; do nothing for a while...
  480. +
  481. move.w #1,(Hint_flag).w
  482.  
  483. stopZ80
  484.  
  485. tst.b (Water_fullscreen_flag).w
  486. bne.s loc_526
  487.  
  488. dma68kToVDP Normal_palette,$0000,palette_line_size*4,CRAM
  489.  
  490. bra.s loc_54A
  491. ; ---------------------------------------------------------------------------
  492.  
  493. loc_526:
  494. dma68kToVDP Underwater_palette,$0000,palette_line_size*4,CRAM
  495.  
  496. loc_54A:
  497. move.w (Hint_counter_reserve).w,(a5)
  498. move.w #$8200|(VRAM_Plane_A_Name_Table/$400),(VDP_control_port).l ; Set scroll A PNT base to $C000
  499. bsr.w sndDriverInput
  500.  
  501. startZ80
  502.  
  503. bra.w VintRet
  504. ; ---------------------------------------------------------------------------
  505.  
  506. Vint0_noWater:
  507. move.w (VDP_control_port).l,d0
  508. move.l #vdpComm($0000,VSRAM,WRITE),(VDP_control_port).l
  509. move.l (Vscroll_Factor).w,(VDP_data_port).l
  510. btst #6,(Graphics_Flags).w
  511. beq.s +
  512.  
  513. move.w #$700,d0
  514. - dbf d0,- ; do nothing for a while...
  515. +
  516. move.w #1,(Hint_flag).w
  517. move.w (Hint_counter_reserve).w,(VDP_control_port).l
  518. move.w #$8200|(VRAM_Plane_A_Name_Table/$400),(VDP_control_port).l ; Set scroll A PNT base to $C000
  519. move.l (Vscroll_Factor_P2).w,(Vscroll_Factor_P2_HInt).w
  520.  
  521. stopZ80
  522. dma68kToVDP Sprite_Table,VRAM_Sprite_Attribute_Table,VRAM_Sprite_Attribute_Table_Size,VRAM
  523. bsr.w sndDriverInput
  524. startZ80
  525.  
  526. bra.w VintRet
  527. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  528.  
  529. ; This subroutine copies the H scroll table buffer (in main RAM) to the H scroll
  530. ; table (in VRAM).
  531. ;VintSub2
  532. Vint_SEGA:
  533. bsr.w Do_ControllerPal
  534.  
  535. dma68kToVDP Horiz_Scroll_Buf,VRAM_Horiz_Scroll_Table,VRAM_Horiz_Scroll_Table_Size,VRAM
  536. jsrto (SegaScr_VInt).l, JmpTo_SegaScr_VInt
  537. tst.w (Demo_Time_left).w
  538. beq.w + ; rts
  539. subq.w #1,(Demo_Time_left).w
  540. +
  541. rts
  542. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  543. ;VintSub14
  544. Vint_PCM:
  545. move.b (Vint_runcount+3).w,d0
  546. andi.w #$F,d0
  547. bne.s +
  548.  
  549. stopZ80
  550. bsr.w ReadJoypads
  551. startZ80
  552. +
  553. tst.w (Demo_Time_left).w
  554. beq.w + ; rts
  555. subq.w #1,(Demo_Time_left).w
  556. +
  557. rts
  558. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  559. ;VintSub4
  560. Vint_Title:
  561. bsr.w Do_ControllerPal
  562. bsr.w ProcessDPLC
  563. tst.w (Demo_Time_left).w
  564. beq.w + ; rts
  565. subq.w #1,(Demo_Time_left).w
  566. +
  567. rts
  568. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  569. ;VintSub6
  570. Vint_Unused6:
  571. bsr.w Do_ControllerPal
  572. rts
  573. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  574. ;VintSub10
  575. Vint_Pause:
  576. cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; Special Stage?
  577. beq.w Vint_Pause_specialStage
  578. ;VintSub8
  579. Vint_Level:
  580. stopZ80
  581.  
  582. bsr.w ReadJoypads
  583. tst.b (Teleport_timer).w
  584. beq.s loc_6F8
  585. lea (VDP_control_port).l,a5
  586. tst.w (Game_paused).w
  587. bne.w loc_748
  588. subq.b #1,(Teleport_timer).w
  589. bne.s +
  590. move.b #0,(Teleport_flag).w
  591. +
  592. cmpi.b #$10,(Teleport_timer).w
  593. blo.s loc_6F8
  594. lea (VDP_data_port).l,a6
  595. move.l #vdpComm($0000,CRAM,WRITE),(VDP_control_port).l
  596. move.w #$EEE,d0
  597.  
  598. move.w #$1F,d1
  599. - move.w d0,(a6)
  600. dbf d1,-
  601.  
  602. move.l #vdpComm($0042,CRAM,WRITE),(VDP_control_port).l
  603.  
  604. move.w #$1F,d1
  605. - move.w d0,(a6)
  606. dbf d1,-
  607.  
  608. bra.s loc_748
  609. ; ---------------------------------------------------------------------------
  610.  
  611. loc_6F8:
  612. tst.b (Water_fullscreen_flag).w
  613. bne.s loc_724
  614. dma68kToVDP Normal_palette,$0000,palette_line_size*4,CRAM
  615. bra.s loc_748
  616. ; ---------------------------------------------------------------------------
  617.  
  618. loc_724:
  619.  
  620. dma68kToVDP Underwater_palette,$0000,palette_line_size*4,CRAM
  621.  
  622. loc_748:
  623. move.w (Hint_counter_reserve).w,(a5)
  624. move.w #$8200|(VRAM_Plane_A_Name_Table/$400),(VDP_control_port).l ; Set scroll A PNT base to $C000
  625.  
  626. dma68kToVDP Horiz_Scroll_Buf,VRAM_Horiz_Scroll_Table,VRAM_Horiz_Scroll_Table_Size,VRAM
  627. dma68kToVDP Sprite_Table,VRAM_Sprite_Attribute_Table,VRAM_Sprite_Attribute_Table_Size,VRAM
  628.  
  629. bsr.w ProcessDMAQueue
  630. bsr.w sndDriverInput
  631.  
  632. startZ80
  633.  
  634. movem.l (Camera_RAM).w,d0-d7
  635. movem.l d0-d7,(Camera_RAM_copy).w
  636. movem.l (Camera_X_pos_P2).w,d0-d7
  637. movem.l d0-d7,(Camera_P2_copy).w
  638. movem.l (Scroll_flags).w,d0-d3
  639. movem.l d0-d3,(Scroll_flags_copy).w
  640. move.l (Vscroll_Factor_P2).w,(Vscroll_Factor_P2_HInt).w
  641. cmpi.b #$5C,(Hint_counter_reserve+1).w
  642. bhs.s Do_Updates
  643. move.b #1,(Do_Updates_in_H_int).w
  644. rts
  645.  
  646. ; ---------------------------------------------------------------------------
  647. ; Subroutine to run a demo for an amount of time
  648. ; ---------------------------------------------------------------------------
  649.  
  650. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  651.  
  652. ; sub_7E6: Demo_Time:
  653. Do_Updates:
  654. jsrto (LoadTilesAsYouMove).l, JmpTo_LoadTilesAsYouMove
  655. jsr (HudUpdate).l
  656. bsr.w ProcessDPLC2
  657. tst.w (Demo_Time_left).w ; is there time left on the demo?
  658. beq.w + ; if not, branch
  659. subq.w #1,(Demo_Time_left).w ; subtract 1 from time left
  660. +
  661. rts
  662. ; End of function Do_Updates
  663.  
  664. ; ---------------------------------------------------------------------------
  665. ;Vint10_specialStage
  666. Vint_Pause_specialStage:
  667. stopZ80
  668.  
  669. bsr.w ReadJoypads
  670. jsr (sndDriverInput).l
  671. tst.b (SS_Last_Alternate_HorizScroll_Buf).w
  672. beq.s loc_84A
  673.  
  674. dma68kToVDP SS_Horiz_Scroll_Buf_2,VRAM_SS_Horiz_Scroll_Table,VRAM_SS_Horiz_Scroll_Table_Size,VRAM
  675. bra.s loc_86E
  676. ; ---------------------------------------------------------------------------
  677. loc_84A:
  678. dma68kToVDP SS_Horiz_Scroll_Buf_1,VRAM_SS_Horiz_Scroll_Table,VRAM_SS_Horiz_Scroll_Table_Size,VRAM
  679.  
  680. loc_86E:
  681. startZ80
  682. rts
  683. ; ========================================================================>>>
  684. ;VintSubA
  685. Vint_S2SS:
  686. stopZ80
  687.  
  688. bsr.w ReadJoypads
  689. bsr.w SSSet_VScroll
  690.  
  691. dma68kToVDP Normal_palette,$0000,palette_line_size*4,CRAM
  692. dma68kToVDP SS_Sprite_Table,VRAM_SS_Sprite_Attribute_Table,VRAM_SS_Sprite_Attribute_Table_Size,VRAM
  693.  
  694. tst.b (SS_Alternate_HorizScroll_Buf).w
  695. beq.s loc_906
  696.  
  697. dma68kToVDP SS_Horiz_Scroll_Buf_2,VRAM_SS_Horiz_Scroll_Table,VRAM_SS_Horiz_Scroll_Table_Size,VRAM
  698. bra.s loc_92A
  699. ; ---------------------------------------------------------------------------
  700.  
  701. loc_906:
  702. dma68kToVDP SS_Horiz_Scroll_Buf_1,VRAM_SS_Horiz_Scroll_Table,VRAM_SS_Horiz_Scroll_Table_Size,VRAM
  703.  
  704. loc_92A:
  705. tst.b (SSTrack_Orientation).w ; Is the current track frame flipped?
  706. beq.s ++ ; Branch if not
  707. moveq #0,d0
  708. move.b (SSTrack_drawing_index).w,d0 ; Get drawing position
  709. cmpi.b #4,d0 ; Have we finished drawing and streaming track frame?
  710. bge.s ++ ; Branch if yes (nothing to draw)
  711. add.b d0,d0 ; Convert to index
  712. tst.b (SS_Alternate_PNT).w ; [(SSTrack_drawing_index) * 2] = subroutine
  713. beq.s + ; Branch if not using the alternate Plane A name table
  714. addi_.w #8,d0 ; ([(SSTrack_drawing_index) * 2] + 8) = subroutine
  715. +
  716. move.w SS_PNTA_Transfer_Table(pc,d0.w),d0
  717. jsr SS_PNTA_Transfer_Table(pc,d0.w)
  718. +
  719. bsr.w SSRun_Animation_Timers
  720. addi_.b #1,(SSTrack_drawing_index).w ; Run track timer
  721. move.b (SSTrack_drawing_index).w,d0 ; Get new timer value
  722. cmp.b d1,d0 ; Is it less than the player animation timer?
  723. blt.s +++ ; Branch if so
  724. move.b #0,(SSTrack_drawing_index).w ; Start drawing new frame
  725. lea (VDP_control_port).l,a6
  726. tst.b (SS_Alternate_PNT).w ; Are we using the alternate address for plane A?
  727. beq.s + ; Branch if not
  728. move.w #$8200|(VRAM_SS_Plane_A_Name_Table1/$400),(a6) ; Set PNT A base to $C000
  729. bra.s ++
  730. ; ===========================================================================
  731. ;off_97A
  732. SS_PNTA_Transfer_Table: offsetTable
  733. offsetTableEntry.w loc_A50 ; 0
  734. offsetTableEntry.w loc_A76 ; 1
  735. offsetTableEntry.w loc_A9C ; 2
  736. offsetTableEntry.w loc_AC2 ; 3
  737. offsetTableEntry.w loc_9B8 ; 4
  738. offsetTableEntry.w loc_9DE ; 5
  739. offsetTableEntry.w loc_A04 ; 6
  740. offsetTableEntry.w loc_A2A ; 7
  741. ; ===========================================================================
  742. +
  743. move.w #$8200|(VRAM_SS_Plane_A_Name_Table2/$400),(a6) ; Set PNT A base to $8000
  744. +
  745. eori.b #1,(SS_Alternate_PNT).w ; Toggle flag
  746. +
  747. bsr.w ProcessDMAQueue
  748. jsr (sndDriverInput).l
  749.  
  750. startZ80
  751.  
  752. bsr.w ProcessDPLC2
  753. tst.w (Demo_Time_left).w
  754. beq.w + ; rts
  755. subq.w #1,(Demo_Time_left).w
  756. +
  757. rts
  758. ; ---------------------------------------------------------------------------
  759. ; (!)
  760. ; Each of these functions copies one fourth of pattern name table A into VRAM
  761. ; from a buffer in main RAM. $700 bytes are copied each frame, with the target
  762. ; are in VRAM depending on the current drawing position.
  763. loc_9B8:
  764. dma68kToVDP PNT_Buffer,VRAM_SS_Plane_A_Name_Table1 + 0 * (PNT_Buffer_End-PNT_Buffer),PNT_Buffer_End-PNT_Buffer,VRAM
  765. rts
  766. ; ---------------------------------------------------------------------------
  767. loc_9DE:
  768. dma68kToVDP PNT_Buffer,VRAM_SS_Plane_A_Name_Table1 + 1 * (PNT_Buffer_End-PNT_Buffer),PNT_Buffer_End-PNT_Buffer,VRAM
  769. rts
  770. ; ---------------------------------------------------------------------------
  771. loc_A04:
  772. dma68kToVDP PNT_Buffer,VRAM_SS_Plane_A_Name_Table1 + 2 * (PNT_Buffer_End-PNT_Buffer),PNT_Buffer_End-PNT_Buffer,VRAM
  773. rts
  774. ; ---------------------------------------------------------------------------
  775. loc_A2A:
  776. dma68kToVDP PNT_Buffer,VRAM_SS_Plane_A_Name_Table1 + 3 * (PNT_Buffer_End-PNT_Buffer),PNT_Buffer_End-PNT_Buffer,VRAM
  777. rts
  778. ; ---------------------------------------------------------------------------
  779. loc_A50:
  780. dma68kToVDP PNT_Buffer,VRAM_SS_Plane_A_Name_Table2 + 0 * (PNT_Buffer_End-PNT_Buffer),PNT_Buffer_End-PNT_Buffer,VRAM
  781. rts
  782. ; ---------------------------------------------------------------------------
  783. loc_A76:
  784. dma68kToVDP PNT_Buffer,VRAM_SS_Plane_A_Name_Table2 + 1 * (PNT_Buffer_End-PNT_Buffer),PNT_Buffer_End-PNT_Buffer,VRAM
  785. rts
  786. ; ---------------------------------------------------------------------------
  787. loc_A9C:
  788. dma68kToVDP PNT_Buffer,VRAM_SS_Plane_A_Name_Table2 + 2 * (PNT_Buffer_End-PNT_Buffer),PNT_Buffer_End-PNT_Buffer,VRAM
  789. rts
  790. ; ---------------------------------------------------------------------------
  791. loc_AC2:
  792. dma68kToVDP PNT_Buffer,VRAM_SS_Plane_A_Name_Table2 + 3 * (PNT_Buffer_End-PNT_Buffer),PNT_Buffer_End-PNT_Buffer,VRAM
  793. rts
  794. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  795.  
  796. ;sub_AE8
  797. SSSet_VScroll:
  798. move.w (VDP_control_port).l,d0
  799. move.l #vdpComm($0000,VSRAM,WRITE),(VDP_control_port).l
  800. move.l (Vscroll_Factor).w,(VDP_data_port).l
  801. rts
  802. ; End of function SSSet_VScroll
  803.  
  804.  
  805. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  806.  
  807. ;sub_B02
  808. SSRun_Animation_Timers:
  809. move.w (SS_Cur_Speed_Factor).w,d0 ; Get current speed factor
  810. cmp.w (SS_New_Speed_Factor).w,d0 ; Has the speed factor changed?
  811. beq.s + ; Branch if yes
  812. move.l (SS_New_Speed_Factor).w,(SS_Cur_Speed_Factor).w ; Save new speed factor
  813. move.b #0,(SSTrack_duration_timer).w ; Reset timer
  814. +
  815. subi_.b #1,(SSTrack_duration_timer).w ; Run track timer
  816. bgt.s + ; Branch if not expired yet
  817. lea (SSAnim_Base_Duration).l,a0
  818. move.w (SS_Cur_Speed_Factor).w,d0 ; The current speed factor is an index
  819. lsr.w #1,d0
  820. move.b (a0,d0.w),d1
  821. move.b d1,(SS_player_anim_frame_timer).w ; New player animation length (later halved)
  822. move.b d1,(SSTrack_duration_timer).w ; New track timer
  823. subq.b #1,(SS_player_anim_frame_timer).w ; Subtract one
  824. rts
  825. ; ---------------------------------------------------------------------------
  826. +
  827. move.b (SS_player_anim_frame_timer).w,d1 ; Get current player animatino length
  828. addq.b #1,d1 ; Increase it
  829. rts
  830. ; End of function SSRun_Animation_Timers
  831.  
  832. ; ===========================================================================
  833. ;byte_B46
  834. SSAnim_Base_Duration:
  835. dc.b 60
  836. dc.b 30 ; 1
  837. dc.b 15 ; 2
  838. dc.b 10 ; 3
  839. dc.b 8 ; 4
  840. dc.b 6 ; 5
  841. dc.b 5 ; 6
  842. dc.b 0 ; 7
  843. ; ===========================================================================
  844. ;VintSub1A
  845. Vint_CtrlDMA:
  846. stopZ80
  847. jsr (ProcessDMAQueue).l
  848. startZ80
  849. rts
  850. ; ===========================================================================
  851. ;VintSubC
  852. Vint_TitleCard:
  853. stopZ80
  854.  
  855. bsr.w ReadJoypads
  856. tst.b (Water_fullscreen_flag).w
  857. bne.s loc_BB2
  858.  
  859. dma68kToVDP Normal_palette,$0000,palette_line_size*4,CRAM
  860. bra.s loc_BD6
  861. ; ---------------------------------------------------------------------------
  862.  
  863. loc_BB2:
  864. dma68kToVDP Underwater_palette,$0000,palette_line_size*4,CRAM
  865.  
  866. loc_BD6:
  867. move.w (Hint_counter_reserve).w,(a5)
  868.  
  869. dma68kToVDP Horiz_Scroll_Buf,VRAM_Horiz_Scroll_Table,VRAM_Horiz_Scroll_Table_Size,VRAM
  870. dma68kToVDP Sprite_Table,VRAM_Sprite_Attribute_Table,VRAM_Sprite_Attribute_Table_Size,VRAM
  871.  
  872. bsr.w ProcessDMAQueue
  873. jsr (DrawLevelTitleCard).l
  874. jsr (sndDriverInput).l
  875.  
  876. startZ80
  877.  
  878. movem.l (Camera_RAM).w,d0-d7
  879. movem.l d0-d7,(Camera_RAM_copy).w
  880. movem.l (Scroll_flags).w,d0-d1
  881. movem.l d0-d1,(Scroll_flags_copy).w
  882. move.l (Vscroll_Factor_P2).w,(Vscroll_Factor_P2_HInt).w
  883. bsr.w ProcessDPLC
  884. rts
  885. ; ===========================================================================
  886. ;VintSubE
  887. Vint_UnusedE:
  888. bsr.w Do_ControllerPal
  889. addq.b #1,(VIntSubE_RunCount).w
  890. move.b #VintID_UnusedE,(Vint_routine).w
  891. rts
  892. ; ===========================================================================
  893. ;VintSub12
  894. Vint_Fade:
  895. bsr.w Do_ControllerPal
  896. move.w (Hint_counter_reserve).w,(a5)
  897. bra.w ProcessDPLC
  898. ; ===========================================================================
  899. ;VintSub18
  900. Vint_Ending:
  901. stopZ80
  902.  
  903. bsr.w ReadJoypads
  904.  
  905. dma68kToVDP Normal_palette,$0000,palette_line_size*4,CRAM
  906. dma68kToVDP Sprite_Table,VRAM_Sprite_Attribute_Table,VRAM_Sprite_Attribute_Table_Size,VRAM
  907. dma68kToVDP Horiz_Scroll_Buf,VRAM_Horiz_Scroll_Table,VRAM_Horiz_Scroll_Table_Size,VRAM
  908.  
  909. bsr.w ProcessDMAQueue
  910. bsr.w sndDriverInput
  911. movem.l (Camera_RAM).w,d0-d7
  912. movem.l d0-d7,(Camera_RAM_copy).w
  913. movem.l (Scroll_flags).w,d0-d3
  914. movem.l d0-d3,(Scroll_flags_copy).w
  915. jsrto (LoadTilesAsYouMove).l, JmpTo_LoadTilesAsYouMove
  916.  
  917. startZ80
  918.  
  919. move.w (Ending_VInt_Subrout).w,d0
  920. beq.s + ; rts
  921. clr.w (Ending_VInt_Subrout).w
  922. move.w off_D3C-2(pc,d0.w),d0
  923. jsr off_D3C(pc,d0.w)
  924. +
  925. rts
  926. ; ===========================================================================
  927. off_D3C: offsetTable
  928. offsetTableEntry.w (+) ; 1
  929. offsetTableEntry.w (++) ; 2
  930. ; ===========================================================================
  931. +
  932. dmaFillVRAM 0,VRAM_EndSeq_Plane_A_Name_Table,VRAM_EndSeq_Plane_Table_Size ; VRAM Fill $C000 with $2000 zeros
  933. rts
  934. ; ---------------------------------------------------------------------------
  935. +
  936. dmaFillVRAM 0,VRAM_EndSeq_Plane_B_Name_Table2,VRAM_EndSeq_Plane_Table_Size
  937. dmaFillVRAM 0,VRAM_EndSeq_Plane_A_Name_Table,VRAM_EndSeq_Plane_Table_Size
  938.  
  939. lea (VDP_control_port).l,a6
  940. move.w #$8B00,(a6) ; EXT-INT off, V scroll by screen, H scroll by screen
  941. move.w #$8400|(VRAM_EndSeq_Plane_B_Name_Table2/$2000),(a6) ; PNT B base: $4000
  942. move.w #$9011,(a6) ; Scroll table size: 64x64
  943. lea (Chunk_Table).l,a1
  944. move.l #vdpComm(VRAM_EndSeq_Plane_A_Name_Table + planeLocH40($16,$21),VRAM,WRITE),d0 ;$50AC0003
  945. moveq #$16,d1
  946. moveq #$E,d2
  947. jsrto (PlaneMapToVRAM_H40).l, PlaneMapToVRAM_H40
  948. rts
  949. ; ===========================================================================
  950. ;VintSub16
  951. Vint_Menu:
  952. stopZ80
  953.  
  954. bsr.w ReadJoypads
  955.  
  956. dma68kToVDP Normal_palette,$0000,palette_line_size*4,CRAM
  957. dma68kToVDP Sprite_Table,VRAM_Sprite_Attribute_Table,VRAM_Sprite_Attribute_Table_Size,VRAM
  958. dma68kToVDP Horiz_Scroll_Buf,VRAM_Horiz_Scroll_Table,VRAM_Horiz_Scroll_Table_Size,VRAM
  959.  
  960. bsr.w ProcessDMAQueue
  961. bsr.w sndDriverInput
  962.  
  963. startZ80
  964.  
  965. bsr.w ProcessDPLC
  966. tst.w (Demo_Time_left).w
  967. beq.w + ; rts
  968. subq.w #1,(Demo_Time_left).w
  969. +
  970. rts
  971.  
  972. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  973.  
  974. ;sub_E98
  975. Do_ControllerPal:
  976. stopZ80
  977.  
  978. bsr.w ReadJoypads
  979. tst.b (Water_fullscreen_flag).w
  980. bne.s loc_EDA
  981.  
  982. dma68kToVDP Normal_palette,$0000,palette_line_size*4,CRAM
  983. bra.s loc_EFE
  984. ; ---------------------------------------------------------------------------
  985.  
  986. loc_EDA:
  987. dma68kToVDP Underwater_palette,$0000,palette_line_size*4,CRAM
  988.  
  989. loc_EFE:
  990. dma68kToVDP Sprite_Table,VRAM_Sprite_Attribute_Table,VRAM_Sprite_Attribute_Table_Size,VRAM
  991. dma68kToVDP Horiz_Scroll_Buf,VRAM_Horiz_Scroll_Table,VRAM_Horiz_Scroll_Table_Size,VRAM
  992.  
  993. bsr.w sndDriverInput
  994.  
  995. startZ80
  996.  
  997. rts
  998. ; End of function sub_E98
  999. ; ||||||||||||||| E N D O F V - I N T |||||||||||||||||||||||||||||||||||
  1000.  
  1001. ; ===========================================================================
  1002. ; Start of H-INT code
  1003. H_Int:
  1004. tst.w (Hint_flag).w
  1005. beq.w +
  1006. tst.w (Two_player_mode).w
  1007. beq.w PalToCRAM
  1008. move.w #0,(Hint_flag).w
  1009. move.l a5,-(sp)
  1010. move.l d0,-(sp)
  1011.  
  1012. - move.w (VDP_control_port).l,d0 ; loop start: Make sure V_BLANK is over
  1013. andi.w #4,d0
  1014. beq.s - ; loop end
  1015.  
  1016. move.w (VDP_Reg1_val).w,d0
  1017. andi.b #$BF,d0
  1018. move.w d0,(VDP_control_port).l ; Display disable
  1019. move.w #$8200|(VRAM_Plane_A_Name_Table_2P/$400),(VDP_control_port).l ; PNT A base: $A000
  1020. move.l #vdpComm($0000,VSRAM,WRITE),(VDP_control_port).l
  1021. move.l (Vscroll_Factor_P2_HInt).w,(VDP_data_port).l
  1022.  
  1023. stopZ80
  1024. dma68kToVDP Sprite_Table_2,VRAM_Sprite_Attribute_Table,VRAM_Sprite_Attribute_Table_Size,VRAM
  1025. startZ80
  1026.  
  1027. - move.w (VDP_control_port).l,d0
  1028. andi.w #4,d0
  1029. beq.s -
  1030.  
  1031. move.w (VDP_Reg1_val).w,d0
  1032. ori.b #$40,d0
  1033. move.w d0,(VDP_control_port).l ; Display enable
  1034. move.l (sp)+,d0
  1035. movea.l (sp)+,a5
  1036. +
  1037. rte
  1038.  
  1039.  
  1040. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  1041. ; game code
  1042.  
  1043. ; ---------------------------------------------------------------------------
  1044. ; loc_1000:
  1045. PalToCRAM:
  1046. move #$2700,sr
  1047. move.w #0,(Hint_flag).w
  1048. movem.l a0-a1,-(sp)
  1049. lea (VDP_data_port).l,a1
  1050. lea (Underwater_palette).w,a0 ; load palette from RAM
  1051. move.l #vdpComm($0000,CRAM,WRITE),4(a1) ; set VDP to write to CRAM address $00
  1052. rept 32
  1053. move.l (a0)+,(a1) ; move palette to CRAM (all 64 colors at once)
  1054. endm
  1055. move.w #$8ADF,4(a1) ; Write %1101 %1111 to register 10 (interrupt every 224th line)
  1056. movem.l (sp)+,a0-a1
  1057. tst.b (Do_Updates_in_H_int).w
  1058. bne.s loc_1072
  1059. rte
  1060. ; ===========================================================================
  1061.  
  1062. loc_1072:
  1063. clr.b (Do_Updates_in_H_int).w
  1064. movem.l d0-a6,-(sp)
  1065. bsr.w Do_Updates
  1066. movem.l (sp)+,d0-a6
  1067. rte
  1068.  
  1069. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1070. ; Input our music/sound selection to the sound driver.
  1071.  
  1072. sndDriverInput:
  1073. lea (Music_to_play&$00FFFFFF).l,a0
  1074. lea (Z80_RAM+zComRange).l,a1 ; $A01B80
  1075. cmpi.b #$80,zAbsVar.QueueToPlay-zComRange(a1) ; If this (zReadyFlag) isn't $80, the driver is processing a previous sound request.
  1076. bne.s loc_10C4 ; So we'll wait until at least the next frame before putting anything in there.
  1077. _move.b 0(a0),d0
  1078. beq.s loc_10A4
  1079. _clr.b 0(a0)
  1080. bra.s loc_10AE
  1081. ; ---------------------------------------------------------------------------
  1082.  
  1083. loc_10A4:
  1084. move.b 4(a0),d0 ; If there was something in Music_to_play_2, check what that was. Else, just go to the loop.
  1085. beq.s loc_10C4
  1086. clr.b 4(a0)
  1087.  
  1088. loc_10AE: ; Check that the sound is not FE or FF
  1089. move.b d0,d1 ; If it is, we need to put it in $A01B83 as $7F or $80 respectively
  1090. subi.b #MusID_Pause,d1
  1091. bcs.s loc_10C0
  1092. addi.b #$7F,d1
  1093. move.b d1,zAbsVar.StopMusic-zComRange(a1)
  1094. bra.s loc_10C4
  1095. ; ---------------------------------------------------------------------------
  1096.  
  1097. loc_10C0:
  1098. move.b d0,zAbsVar.QueueToPlay-zComRange(a1)
  1099.  
  1100. loc_10C4:
  1101. moveq #4-1,d1
  1102. ; FFE4 (Music_to_play_2) goes to 1B8C (zMusicToPlay),
  1103. - move.b 1(a0,d1.w),d0 ; FFE3 (unk_FFE3) goes to 1B8B, (unknown)
  1104. beq.s + ; FFE2 (SFX_to_play_2) goes to 1B8A (zSFXToPlay2),
  1105. tst.b zAbsVar.SFXToPlay-zComRange(a1,d1.w) ; FFE1 (SFX_to_play) goes to 1B89 (zSFXToPlay).
  1106. bne.s +
  1107. clr.b 1(a0,d1.w)
  1108. move.b d0,zAbsVar.SFXToPlay-zComRange(a1,d1.w)
  1109. +
  1110. dbf d1,-
  1111. rts
  1112. ; End of function sndDriverInput
  1113.  
  1114. if ~~removeJmpTos
  1115. ; sub_10E0:
  1116. JmpTo_LoadTilesAsYouMove
  1117. jmp (LoadTilesAsYouMove).l
  1118. JmpTo_SegaScr_VInt
  1119. jmp (SegaScr_VInt).l
  1120.  
  1121. align 4
  1122. endif
  1123.  
  1124.  
  1125.  
  1126.  
  1127. ; ---------------------------------------------------------------------------
  1128. ; Subroutine to initialize joypads
  1129. ; ---------------------------------------------------------------------------
  1130. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1131.  
  1132. ; sub_10EC:
  1133. JoypadInit:
  1134. stopZ80
  1135. moveq #$40,d0
  1136. move.b d0,(HW_Port_1_Control).l ; init port 1 (joypad 1)
  1137. move.b d0,(HW_Port_2_Control).l ; init port 2 (joypad 2)
  1138. move.b d0,(HW_Expansion_Control).l ; init port 3 (extra)
  1139. startZ80
  1140. rts
  1141. ; End of function JoypadInit
  1142.  
  1143. ; ---------------------------------------------------------------------------
  1144. ; Subroutine to read joypad input, and send it to the RAM
  1145. ; ---------------------------------------------------------------------------
  1146. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1147.  
  1148. ; sub_111C:
  1149. ReadJoypads:
  1150. lea (Ctrl_1).w,a0 ; address where joypad states are written
  1151. lea (HW_Port_1_Data).l,a1 ; first joypad port
  1152. bsr.s Joypad_Read ; do the first joypad
  1153. addq.w #2,a1 ; do the second joypad
  1154. ; End of function ReadJoypads
  1155.  
  1156.  
  1157. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1158.  
  1159. ; sub_112A:
  1160. Joypad_Read:
  1161. move.b #0,(a1)
  1162. nop
  1163. nop
  1164. move.b (a1),d0
  1165. lsl.b #2,d0
  1166. andi.b #$C0,d0
  1167. move.b #$40,(a1)
  1168. nop
  1169. nop
  1170. move.b (a1),d1
  1171. andi.b #$3F,d1
  1172. or.b d1,d0
  1173. not.b d0
  1174. move.b (a0),d1
  1175. eor.b d0,d1
  1176. move.b d0,(a0)+
  1177. and.b d0,d1
  1178. move.b d1,(a0)+
  1179. rts
  1180. ; End of function Joypad_Read
  1181.  
  1182.  
  1183. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1184.  
  1185. ; sub_1158:
  1186. VDPSetupGame:
  1187. lea (VDP_control_port).l,a0
  1188. lea (VDP_data_port).l,a1
  1189. lea (VDPSetupArray).l,a2
  1190. moveq #bytesToWcnt(VDPSetupArray_End-VDPSetupArray),d7
  1191. ; loc_116C:
  1192. VDP_Loop:
  1193. move.w (a2)+,(a0)
  1194. dbf d7,VDP_Loop ; set the VDP registers
  1195.  
  1196. move.w (VDPSetupArray+2).l,d0
  1197. move.w d0,(VDP_Reg1_val).w
  1198. move.w #$8ADF,(Hint_counter_reserve).w ; H-INT every 224th scanline
  1199. moveq #0,d0
  1200.  
  1201. move.l #vdpComm($0000,VSRAM,WRITE),(VDP_control_port).l
  1202. move.w d0,(a1)
  1203. move.w d0,(a1)
  1204.  
  1205. move.l #vdpComm($0000,CRAM,WRITE),(VDP_control_port).l
  1206.  
  1207. move.w #bytesToWcnt(palette_line_size*4),d7
  1208. ; loc_11A0:
  1209. VDP_ClrCRAM:
  1210. move.w d0,(a1)
  1211. dbf d7,VDP_ClrCRAM
  1212.  
  1213. clr.l (Vscroll_Factor).w
  1214. clr.l (unk_F61A).w
  1215. move.l d1,-(sp)
  1216.  
  1217. dmaFillVRAM 0,$0000,$10000 ; fill entire VRAM with 0
  1218.  
  1219. move.l (sp)+,d1
  1220. rts
  1221. ; End of function VDPSetupGame
  1222.  
  1223. ; ===========================================================================
  1224. ; word_11E2:
  1225. VDPSetupArray:
  1226. dc.w $8004 ; H-INT disabled
  1227. dc.w $8134 ; Genesis mode, DMA enabled, VBLANK-INT enabled
  1228. dc.w $8200|(VRAM_Plane_A_Name_Table/$400) ; PNT A base: $C000
  1229. dc.w $8328 ; PNT W base: $A000
  1230. dc.w $8400|(VRAM_Plane_B_Name_Table/$2000) ; PNT B base: $E000
  1231. dc.w $8500|(VRAM_Sprite_Attribute_Table/$200) ; Sprite attribute table base: $F800
  1232. dc.w $8600
  1233. dc.w $8700 ; Background palette/color: 0/0
  1234. dc.w $8800
  1235. dc.w $8900
  1236. dc.w $8A00 ; H-INT every scanline
  1237. dc.w $8B00 ; EXT-INT off, V scroll by screen, H scroll by screen
  1238. dc.w $8C81 ; H res 40 cells, no interlace, S/H disabled
  1239. dc.w $8D00|(VRAM_Horiz_Scroll_Table/$400) ; H scroll table base: $FC00
  1240. dc.w $8E00
  1241. dc.w $8F02 ; VRAM pointer increment: $0002
  1242. dc.w $9001 ; Scroll table size: 64x32
  1243. dc.w $9100 ; Disable window
  1244. dc.w $9200 ; Disable window
  1245. VDPSetupArray_End:
  1246.  
  1247. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1248.  
  1249. ; sub_1208:
  1250. ClearScreen:
  1251. stopZ80
  1252.  
  1253. dmaFillVRAM 0,$0000,$40 ; Fill first $40 bytes of VRAM with 0
  1254. dmaFillVRAM 0,VRAM_Plane_A_Name_Table,VRAM_Plane_Table_Size ; Clear Plane A pattern name table
  1255. dmaFillVRAM 0,VRAM_Plane_B_Name_Table,VRAM_Plane_Table_Size ; Clear Plane B pattern name table
  1256.  
  1257. tst.w (Two_player_mode).w
  1258. beq.s +
  1259.  
  1260. dmaFillVRAM 0,VRAM_Plane_A_Name_Table_2P,VRAM_Plane_Table_Size
  1261. +
  1262. clr.l (Vscroll_Factor).w
  1263. clr.l (unk_F61A).w
  1264.  
  1265. ; Bug: These '+4's shouldn't be here; clearRAM accidentally clears an additional 4 bytes
  1266. clearRAM Sprite_Table,Sprite_Table_End+4
  1267. clearRAM Horiz_Scroll_Buf,Horiz_Scroll_Buf_End+4
  1268.  
  1269. startZ80
  1270. rts
  1271. ; End of function ClearScreen
  1272.  
  1273.  
  1274. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1275.  
  1276. ; JumpTo load the sound driver
  1277. ; sub_130A:
  1278. JmpTo_SoundDriverLoad
  1279. nop
  1280. jmp (SoundDriverLoad).l
  1281. ; End of function JmpTo_SoundDriverLoad
  1282.  
  1283. ; ===========================================================================
  1284. ; unused mostly-leftover subroutine to load the sound driver
  1285. ; SoundDriverLoadS1:
  1286. move.w #$100,(Z80_Bus_Request).l ; stop the Z80
  1287. move.w #$100,(Z80_Reset).l ; reset the Z80
  1288. lea (Z80_RAM).l,a1
  1289. move.b #$F3,(a1)+ ; di
  1290. move.b #$F3,(a1)+ ; di
  1291. move.b #$C3,(a1)+ ; jp
  1292. move.b #0,(a1)+ ; jp address low byte
  1293. move.b #0,(a1)+ ; jp address high byte
  1294. move.w #0,(Z80_Reset).l
  1295. nop
  1296. nop
  1297. nop
  1298. nop
  1299. move.w #$100,(Z80_Reset).l ; reset the Z80
  1300. move.w #0,(Z80_Bus_Request).l ; start the Z80
  1301. rts
  1302.  
  1303. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1304. ; If Music_to_play is clear, move d0 into Music_to_play,
  1305. ; else move d0 into Music_to_play_2.
  1306. ; sub_135E:
  1307. PlayMusic:
  1308. tst.b (Music_to_play).w
  1309. bne.s +
  1310. move.b d0,(Music_to_play).w
  1311. rts
  1312. +
  1313. move.b d0,(Music_to_play_2).w
  1314. rts
  1315. ; End of function PlayMusic
  1316.  
  1317.  
  1318. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1319.  
  1320. ; sub_1370
  1321. PlaySound:
  1322. move.b d0,(SFX_to_play).w
  1323. rts
  1324. ; End of function PlaySound
  1325.  
  1326.  
  1327. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1328. ; play a sound in alternating speakers (as in the ring collection sound)
  1329. ; sub_1376:
  1330. PlaySoundStereo:
  1331. move.b d0,(SFX_to_play_2).w
  1332. rts
  1333. ; End of function PlaySoundStereo
  1334.  
  1335.  
  1336. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1337. ; play a sound if the source is onscreen
  1338. ; sub_137C:
  1339. PlaySoundLocal:
  1340. tst.b render_flags(a0)
  1341. bpl.s + ; rts
  1342. move.b d0,(SFX_to_play).w
  1343. +
  1344. rts
  1345. ; End of function PlaySoundLocal
  1346.  
  1347. ; ---------------------------------------------------------------------------
  1348. ; Subroutine to pause the game
  1349. ; ---------------------------------------------------------------------------
  1350.  
  1351. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1352.  
  1353. ; sub_1388:
  1354. PauseGame:
  1355. nop
  1356. tst.b (Life_count).w ; do you have any lives left?
  1357. beq.w Unpause ; if not, branch
  1358. tst.w (Game_paused).w ; is game already paused?
  1359. bne.s + ; if yes, branch
  1360. move.b (Ctrl_1_Press).w,d0 ; is Start button pressed?
  1361. or.b (Ctrl_2_Press).w,d0 ; (either player)
  1362. andi.b #button_start_mask,d0
  1363. beq.s Pause_DoNothing ; if not, branch
  1364. +
  1365. move.w #1,(Game_paused).w ; freeze time
  1366. move.b #MusID_Pause,(Music_to_play).w ; pause music
  1367. ; loc_13B2:
  1368. Pause_Loop:
  1369. move.b #VintID_Pause,(Vint_routine).w
  1370. bsr.w WaitForVint
  1371. tst.b (Slow_motion_flag).w ; is slow-motion cheat on?
  1372. beq.s Pause_ChkStart ; if not, branch
  1373. btst #button_A,(Ctrl_1_Press).w ; is button A pressed?
  1374. beq.s Pause_ChkBC ; if not, branch
  1375. move.b #GameModeID_TitleScreen,(Game_Mode).w ; => TitleScreen
  1376. nop
  1377. bra.s Pause_Resume
  1378. ; ===========================================================================
  1379. ; loc_13D4:
  1380. Pause_ChkBC:
  1381. btst #button_B,(Ctrl_1_Held).w ; is button B pressed?
  1382. bne.s Pause_SlowMo ; if yes, branch
  1383. btst #button_C,(Ctrl_1_Press).w ; is button C pressed?
  1384. bne.s Pause_SlowMo ; if yes, branch
  1385. ; loc_13E4:
  1386. Pause_ChkStart:
  1387. move.b (Ctrl_1_Press).w,d0 ; is Start button pressed?
  1388. or.b (Ctrl_2_Press).w,d0 ; (either player)
  1389. andi.b #button_start_mask,d0
  1390. beq.s Pause_Loop ; if not, branch
  1391. ; loc_13F2:
  1392. Pause_Resume:
  1393. move.b #MusID_Unpause,(Music_to_play).w
  1394. ; loc_13F8:
  1395. Unpause:
  1396. move.w #0,(Game_paused).w
  1397. ; return_13FE:
  1398. Pause_DoNothing:
  1399. rts
  1400. ; ===========================================================================
  1401. ; loc_1400:
  1402. Pause_SlowMo:
  1403. move.w #1,(Game_paused).w
  1404. move.b #MusID_Unpause,(Music_to_play).w
  1405. rts
  1406. ; End of function PauseGame
  1407.  
  1408. ; ---------------------------------------------------------------------------
  1409. ; Subroutine to transfer a plane map to VRAM
  1410. ; ---------------------------------------------------------------------------
  1411.  
  1412. ; control register:
  1413. ; CD1 CD0 A13 A12 A11 A10 A09 A08 (D31-D24)
  1414. ; A07 A06 A05 A04 A03 A02 A01 A00 (D23-D16)
  1415. ; ? ? ? ? ? ? ? ? (D15-D8)
  1416. ; CD5 CD4 CD3 CD2 ? ? A15 A14 (D7-D0)
  1417. ;
  1418. ; A00-A15 - address
  1419. ; CD0-CD3 - code
  1420. ; CD4 - 1 if VRAM copy DMA mode. 0 otherwise.
  1421. ; CD5 - DMA operation
  1422. ;
  1423. ; Bits CD3-CD0:
  1424. ; 0000 - VRAM read
  1425. ; 0001 - VRAM write
  1426. ; 0011 - CRAM write
  1427. ; 0100 - VSRAM read
  1428. ; 0101 - VSRAM write
  1429. ; 1000 - CRAM read
  1430. ;
  1431. ; d0 = control register
  1432. ; d1 = width
  1433. ; d2 = heigth
  1434. ; a1 = source address
  1435.  
  1436. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1437.  
  1438. ; sub_140E: ShowVDPGraphics: PlaneMapToVRAM:
  1439. PlaneMapToVRAM_H40:
  1440. lea (VDP_data_port).l,a6
  1441. move.l #vdpCommDelta(planeLocH40(0,1)),d4 ; $800000
  1442. - move.l d0,VDP_control_port-VDP_data_port(a6) ; move d0 to VDP_control_port
  1443. move.w d1,d3
  1444. - move.w (a1)+,(a6) ; from source address to destination in VDP
  1445. dbf d3,- ; next tile
  1446. add.l d4,d0 ; increase destination address by $80 (1 line)
  1447. dbf d2,-- ; next line
  1448. rts
  1449. ; End of function PlaneMapToVRAM_H40
  1450.  
  1451. ; ---------------------------------------------------------------------------
  1452. ; Alternate subroutine to transfer a plane map to VRAM
  1453. ; (used for Special Stage background)
  1454. ; ---------------------------------------------------------------------------
  1455.  
  1456. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1457.  
  1458. ; sub_142E: ShowVDPGraphics2: PlaneMapToVRAM2:
  1459. PlaneMapToVRAM_H80_SpecialStage:
  1460. lea (VDP_data_port).l,a6
  1461. move.l #vdpCommDelta(planeLocH80(0,1)),d4 ; $1000000
  1462. - move.l d0,VDP_control_port-VDP_data_port(a6)
  1463. move.w d1,d3
  1464. - move.w (a1)+,(a6)
  1465. dbf d3,-
  1466. add.l d4,d0
  1467. dbf d2,--
  1468. rts
  1469. ; End of function PlaneMapToVRAM_H80_SpecialStage
  1470.  
  1471.  
  1472. ; ---------------------------------------------------------------------------
  1473. ; Subroutine for queueing VDP commands (seems to only queue transfers to VRAM),
  1474. ; to be issued the next time ProcessDMAQueue is called.
  1475. ; Can be called a maximum of 18 times before the buffer needs to be cleared
  1476. ; by issuing the commands (this subroutine DOES check for overflow)
  1477. ; ---------------------------------------------------------------------------
  1478.  
  1479. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1480.  
  1481. ; sub_144E: DMA_68KtoVRAM: QueueCopyToVRAM: QueueVDPCommand: Add_To_DMA_Queue:
  1482. QueueDMATransfer:
  1483. movea.l (VDP_Command_Buffer_Slot).w,a1
  1484. cmpa.w #VDP_Command_Buffer_Slot,a1
  1485. beq.s QueueDMATransfer_Done ; return if there's no more room in the buffer
  1486.  
  1487. ; piece together some VDP commands and store them for later...
  1488. move.w #$9300,d0 ; command to specify DMA transfer length & $00FF
  1489. move.b d3,d0
  1490. move.w d0,(a1)+ ; store command
  1491.  
  1492. move.w #$9400,d0 ; command to specify DMA transfer length & $FF00
  1493. lsr.w #8,d3
  1494. move.b d3,d0
  1495. move.w d0,(a1)+ ; store command
  1496.  
  1497. move.w #$9500,d0 ; command to specify source address & $0001FE
  1498. lsr.l #1,d1
  1499. move.b d1,d0
  1500. move.w d0,(a1)+ ; store command
  1501.  
  1502. move.w #$9600,d0 ; command to specify source address & $01FE00
  1503. lsr.l #8,d1
  1504. move.b d1,d0
  1505. move.w d0,(a1)+ ; store command
  1506.  
  1507. move.w #$9700,d0 ; command to specify source address & $FE0000
  1508. lsr.l #8,d1
  1509. ;andi.b #$7F,d1 ; this instruction safely allows source to be in RAM; S3K added this
  1510. move.b d1,d0
  1511. move.w d0,(a1)+ ; store command
  1512.  
  1513. andi.l #$FFFF,d2 ; command to specify destination address and begin DMA
  1514. lsl.l #2,d2
  1515. lsr.w #2,d2
  1516. swap d2
  1517. ori.l #vdpComm($0000,VRAM,DMA),d2 ; set bits to specify VRAM transfer
  1518. move.l d2,(a1)+ ; store command
  1519.  
  1520. move.l a1,(VDP_Command_Buffer_Slot).w ; set the next free slot address
  1521. cmpa.w #VDP_Command_Buffer_Slot,a1
  1522. beq.s QueueDMATransfer_Done ; return if there's no more room in the buffer
  1523. move.w #0,(a1) ; put a stop token at the end of the used part of the buffer
  1524. ; return_14AA:
  1525. QueueDMATransfer_Done:
  1526. rts
  1527. ; End of function QueueDMATransfer
  1528.  
  1529.  
  1530. ; ---------------------------------------------------------------------------
  1531. ; Subroutine for issuing all VDP commands that were queued
  1532. ; (by earlier calls to QueueDMATransfer)
  1533. ; Resets the queue when it's done
  1534. ; ---------------------------------------------------------------------------
  1535.  
  1536. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1537.  
  1538. ; sub_14AC: CopyToVRAM: IssueVDPCommands: Process_DMA: Process_DMA_Queue:
  1539. ProcessDMAQueue:
  1540. lea (VDP_control_port).l,a5
  1541. lea (VDP_Command_Buffer).w,a1
  1542. ; loc_14B6:
  1543. ProcessDMAQueue_Loop:
  1544. move.w (a1)+,d0
  1545. beq.s ProcessDMAQueue_Done ; branch if we reached a stop token
  1546. ; issue a set of VDP commands...
  1547. move.w d0,(a5) ; transfer length
  1548. move.w (a1)+,(a5) ; transfer length
  1549. move.w (a1)+,(a5) ; source address
  1550. move.w (a1)+,(a5) ; source address
  1551. move.w (a1)+,(a5) ; source address
  1552. move.w (a1)+,(a5) ; destination
  1553. move.w (a1)+,(a5) ; destination
  1554. cmpa.w #VDP_Command_Buffer_Slot,a1
  1555. bne.s ProcessDMAQueue_Loop ; loop if we haven't reached the end of the buffer
  1556. ; loc_14CE:
  1557. ProcessDMAQueue_Done:
  1558. move.w #0,(VDP_Command_Buffer).w
  1559. move.l #VDP_Command_Buffer,(VDP_Command_Buffer_Slot).w
  1560. rts
  1561. ; End of function ProcessDMAQueue
  1562.  
  1563.  
  1564.  
  1565. ; ---------------------------------------------------------------------------
  1566. ; START OF NEMESIS DECOMPRESSOR
  1567.  
  1568. ; For format explanation see http://info.sonicretro.org/Nemesis_compression
  1569. ; ---------------------------------------------------------------------------
  1570.  
  1571. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1572.  
  1573. ; Nemesis decompression to VRAM
  1574. ; sub_14DE: NemDecA:
  1575. NemDec:
  1576. movem.l d0-a1/a3-a5,-(sp)
  1577. lea (NemDec_WriteAndStay).l,a3 ; write all data to the same location
  1578. lea (VDP_data_port).l,a4 ; specifically, to the VDP data port
  1579. bra.s NemDecMain
  1580.  
  1581. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1582.  
  1583. ; Nemesis decompression to RAM
  1584. ; input: a4 = starting address of destination
  1585. ; sub_14F0: NemDecB:
  1586. NemDecToRAM:
  1587. movem.l d0-a1/a3-a5,-(sp)
  1588. lea (NemDec_WriteAndAdvance).l,a3 ; advance to the next location after each write
  1589.  
  1590.  
  1591. ; sub_14FA:
  1592. NemDecMain:
  1593. lea (Decomp_Buffer).w,a1
  1594. move.w (a0)+,d2
  1595. lsl.w #1,d2
  1596. bcc.s +
  1597. adda.w #NemDec_WriteAndStay_XOR-NemDec_WriteAndStay,a3
  1598. + lsl.w #2,d2
  1599. movea.w d2,a5
  1600. moveq #8,d3
  1601. moveq #0,d2
  1602. moveq #0,d4
  1603. bsr.w NemDecPrepare
  1604. move.b (a0)+,d5
  1605. asl.w #8,d5
  1606. move.b (a0)+,d5
  1607. move.w #$10,d6
  1608. bsr.s NemDecRun
  1609. movem.l (sp)+,d0-a1/a3-a5
  1610. rts
  1611. ; End of function NemDec
  1612.  
  1613.  
  1614. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1615.  
  1616. ; part of the Nemesis decompressor
  1617. ; sub_1528:
  1618. NemDecRun:
  1619. move.w d6,d7
  1620. subq.w #8,d7
  1621. move.w d5,d1
  1622. lsr.w d7,d1
  1623. cmpi.b #-4,d1
  1624. bhs.s loc_1574
  1625. andi.w #$FF,d1
  1626. add.w d1,d1
  1627. move.b (a1,d1.w),d0
  1628. ext.w d0
  1629. sub.w d0,d6
  1630. cmpi.w #9,d6
  1631. bhs.s +
  1632. addq.w #8,d6
  1633. asl.w #8,d5
  1634. move.b (a0)+,d5
  1635. + move.b 1(a1,d1.w),d1
  1636. move.w d1,d0
  1637. andi.w #$F,d1
  1638. andi.w #$F0,d0
  1639.  
  1640. loc_155E:
  1641. lsr.w #4,d0
  1642.  
  1643. loc_1560:
  1644. lsl.l #4,d4
  1645. or.b d1,d4
  1646. subq.w #1,d3
  1647. bne.s NemDec_WriteIter_Part2
  1648. jmp (a3) ; dynamic jump! to NemDec_WriteAndStay, NemDec_WriteAndAdvance, NemDec_WriteAndStay_XOR, or NemDec_WriteAndAdvance_XOR
  1649. ; ===========================================================================
  1650. ; loc_156A:
  1651. NemDec_WriteIter:
  1652. moveq #0,d4
  1653. moveq #8,d3
  1654. ; loc_156E:
  1655. NemDec_WriteIter_Part2:
  1656. dbf d0,loc_1560
  1657. bra.s NemDecRun
  1658. ; ===========================================================================
  1659.  
  1660. loc_1574:
  1661. subq.w #6,d6
  1662. cmpi.w #9,d6
  1663. bhs.s +
  1664. addq.w #8,d6
  1665. asl.w #8,d5
  1666. move.b (a0)+,d5
  1667. +
  1668. subq.w #7,d6
  1669. move.w d5,d1
  1670. lsr.w d6,d1
  1671. move.w d1,d0
  1672. andi.w #$F,d1
  1673. andi.w #$70,d0
  1674. cmpi.w #9,d6
  1675. bhs.s loc_155E
  1676. addq.w #8,d6
  1677. asl.w #8,d5
  1678. move.b (a0)+,d5
  1679. bra.s loc_155E
  1680. ; End of function NemDecRun
  1681.  
  1682. ; ===========================================================================
  1683. ; loc_15A0:
  1684. NemDec_WriteAndStay:
  1685. move.l d4,(a4)
  1686. subq.w #1,a5
  1687. move.w a5,d4
  1688. bne.s NemDec_WriteIter
  1689. rts
  1690. ; ---------------------------------------------------------------------------
  1691. ; loc_15AA:
  1692. NemDec_WriteAndStay_XOR:
  1693. eor.l d4,d2
  1694. move.l d2,(a4)
  1695. subq.w #1,a5
  1696. move.w a5,d4
  1697. bne.s NemDec_WriteIter
  1698. rts
  1699. ; ===========================================================================
  1700. ; loc_15B6:
  1701. NemDec_WriteAndAdvance:
  1702. move.l d4,(a4)+
  1703. subq.w #1,a5
  1704. move.w a5,d4
  1705. bne.s NemDec_WriteIter
  1706. rts
  1707.  
  1708. if *-NemDec_WriteAndAdvance > NemDec_WriteAndStay_XOR-NemDec_WriteAndStay
  1709. fatal "the code in NemDec_WriteAndAdvance must not be larger than the code in NemDec_WriteAndStay"
  1710. endif
  1711. org NemDec_WriteAndAdvance+NemDec_WriteAndStay_XOR-NemDec_WriteAndStay
  1712.  
  1713. ; ---------------------------------------------------------------------------
  1714. ; loc_15C0:
  1715. NemDec_WriteAndAdvance_XOR:
  1716. eor.l d4,d2
  1717. move.l d2,(a4)+
  1718. subq.w #1,a5
  1719. move.w a5,d4
  1720. bne.s NemDec_WriteIter
  1721. rts
  1722.  
  1723. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1724. ; Part of the Nemesis decompressor
  1725.  
  1726. ; sub_15CC:
  1727. NemDecPrepare:
  1728. move.b (a0)+,d0
  1729.  
  1730. - cmpi.b #$FF,d0
  1731. bne.s +
  1732. rts
  1733. ; ---------------------------------------------------------------------------
  1734. + move.w d0,d7
  1735.  
  1736. loc_15D8:
  1737. move.b (a0)+,d0
  1738. cmpi.b #$80,d0
  1739. bhs.s -
  1740.  
  1741. move.b d0,d1
  1742. andi.w #$F,d7
  1743. andi.w #$70,d1
  1744. or.w d1,d7
  1745. andi.w #$F,d0
  1746. move.b d0,d1
  1747. lsl.w #8,d1
  1748. or.w d1,d7
  1749. moveq #8,d1
  1750. sub.w d0,d1
  1751. bne.s loc_1606
  1752. move.b (a0)+,d0
  1753. add.w d0,d0
  1754. move.w d7,(a1,d0.w)
  1755. bra.s loc_15D8
  1756. ; ---------------------------------------------------------------------------
  1757. loc_1606:
  1758. move.b (a0)+,d0
  1759. lsl.w d1,d0
  1760. add.w d0,d0
  1761. moveq #1,d5
  1762. lsl.w d1,d5
  1763. subq.w #1,d5
  1764.  
  1765. - move.w d7,(a1,d0.w)
  1766. addq.w #2,d0
  1767. dbf d5,-
  1768.  
  1769. bra.s loc_15D8
  1770. ; End of function NemDecPrepare
  1771.  
  1772. ; ---------------------------------------------------------------------------
  1773. ; END OF NEMESIS DECOMPRESSOR
  1774. ; ---------------------------------------------------------------------------
  1775.  
  1776.  
  1777.  
  1778. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1779. ; ---------------------------------------------------------------------------
  1780. ; Subroutine to load pattern load cues (aka to queue pattern load requests)
  1781. ; ---------------------------------------------------------------------------
  1782.  
  1783. ; ARGUMENTS
  1784. ; d0 = index of PLC list (see ArtLoadCues)
  1785.  
  1786. ; NOTICE: This subroutine does not check for buffer overruns. The programmer
  1787. ; (or hacker) is responsible for making sure that no more than
  1788. ; 16 load requests are copied into the buffer.
  1789. ; _________DO NOT PUT MORE THAN 16 LOAD REQUESTS IN A LIST!__________
  1790. ; (or if you change the size of Plc_Buffer, the limit becomes (Plc_Buffer_Only_End-Plc_Buffer)/6)
  1791.  
  1792. ; sub_161E: PLCLoad:
  1793. LoadPLC:
  1794. movem.l a1-a2,-(sp)
  1795. lea (ArtLoadCues).l,a1
  1796. add.w d0,d0
  1797. move.w (a1,d0.w),d0
  1798. lea (a1,d0.w),a1
  1799. lea (Plc_Buffer).w,a2
  1800.  
  1801. - tst.l (a2)
  1802. beq.s + ; if it's zero, exit this loop
  1803. addq.w #6,a2
  1804. bra.s -
  1805. +
  1806. move.w (a1)+,d0
  1807. bmi.s + ; if it's negative, skip the next loop
  1808.  
  1809. - move.l (a1)+,(a2)+
  1810. move.w (a1)+,(a2)+
  1811. dbf d0,-
  1812. +
  1813. movem.l (sp)+,a1-a2 ; a1=object
  1814. rts
  1815. ; End of function LoadPLC
  1816.  
  1817.  
  1818. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1819. ; Queue pattern load requests, but clear the PLQ first
  1820.  
  1821. ; ARGUMENTS
  1822. ; d0 = index of PLC list (see ArtLoadCues)
  1823.  
  1824. ; NOTICE: This subroutine does not check for buffer overruns. The programmer
  1825. ; (or hacker) is responsible for making sure that no more than
  1826. ; 16 load requests are copied into the buffer.
  1827. ; _________DO NOT PUT MORE THAN 16 LOAD REQUESTS IN A LIST!__________
  1828. ; (or if you change the size of Plc_Buffer, the limit becomes (Plc_Buffer_Only_End-Plc_Buffer)/6)
  1829. ; sub_1650:
  1830. LoadPLC2:
  1831. movem.l a1-a2,-(sp)
  1832. lea (ArtLoadCues).l,a1
  1833. add.w d0,d0
  1834. move.w (a1,d0.w),d0
  1835. lea (a1,d0.w),a1
  1836. bsr.s ClearPLC
  1837. lea (Plc_Buffer).w,a2
  1838. move.w (a1)+,d0
  1839. bmi.s + ; if it's negative, skip the next loop
  1840.  
  1841. - move.l (a1)+,(a2)+
  1842. move.w (a1)+,(a2)+
  1843. dbf d0,-
  1844. +
  1845. movem.l (sp)+,a1-a2
  1846. rts
  1847. ; End of function LoadPLC2
  1848.  
  1849.  
  1850. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1851.  
  1852. ; Clear the pattern load queue ($FFF680 - $FFF700)
  1853.  
  1854. ClearPLC:
  1855. lea (Plc_Buffer).w,a2
  1856.  
  1857. moveq #bytesToLcnt(Plc_Buffer_End-Plc_Buffer),d0
  1858. - clr.l (a2)+
  1859. dbf d0,-
  1860.  
  1861. rts
  1862. ; End of function ClearPLC
  1863.  
  1864. ; ---------------------------------------------------------------------------
  1865. ; Subroutine to use graphics listed in a pattern load cue
  1866. ; ---------------------------------------------------------------------------
  1867.  
  1868. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1869.  
  1870. ; sub_168A:
  1871. RunPLC_RAM:
  1872. tst.l (Plc_Buffer).w
  1873. beq.s ++ ; rts
  1874. tst.w (Plc_Buffer_Reg18).w
  1875. bne.s ++ ; rts
  1876. movea.l (Plc_Buffer).w,a0
  1877. lea_ NemDec_WriteAndStay,a3
  1878. nop
  1879. lea (Decomp_Buffer).w,a1
  1880. move.w (a0)+,d2
  1881. bpl.s +
  1882. adda.w #NemDec_WriteAndStay_XOR-NemDec_WriteAndStay,a3
  1883. +
  1884. andi.w #$7FFF,d2
  1885. move.w d2,(Plc_Buffer_Reg18).w
  1886. bsr.w NemDecPrepare
  1887. move.b (a0)+,d5
  1888. asl.w #8,d5
  1889. move.b (a0)+,d5
  1890. moveq #$10,d6
  1891. moveq #0,d0
  1892. move.l a0,(Plc_Buffer).w
  1893. move.l a3,(Plc_Buffer_Reg0).w
  1894. move.l d0,(Plc_Buffer_Reg4).w
  1895. move.l d0,(Plc_Buffer_Reg8).w
  1896. move.l d0,(Plc_Buffer_RegC).w
  1897. move.l d5,(Plc_Buffer_Reg10).w
  1898. move.l d6,(Plc_Buffer_Reg14).w
  1899. +
  1900. rts
  1901. ; End of function RunPLC_RAM
  1902.  
  1903.  
  1904. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1905. ; Process one PLC from the queue
  1906.  
  1907. ; sub_16E0:
  1908. ProcessDPLC:
  1909. tst.w (Plc_Buffer_Reg18).w
  1910. beq.w + ; rts
  1911. move.w #6,(Plc_Buffer_Reg1A).w
  1912. moveq #0,d0
  1913. move.w (Plc_Buffer+4).w,d0
  1914. addi.w #$C0,(Plc_Buffer+4).w
  1915. bra.s ProcessDPLC_Main
  1916.  
  1917. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1918. ; Process one PLC from the queue
  1919.  
  1920. ; loc_16FC:
  1921. ProcessDPLC2:
  1922. tst.w (Plc_Buffer_Reg18).w
  1923. beq.s + ; rts
  1924. move.w #3,(Plc_Buffer_Reg1A).w
  1925. moveq #0,d0
  1926. move.w (Plc_Buffer+4).w,d0
  1927. addi.w #$60,(Plc_Buffer+4).w
  1928.  
  1929. ; loc_1714:
  1930. ProcessDPLC_Main:
  1931. lea (VDP_control_port).l,a4
  1932. lsl.l #2,d0 ; set up target VRAM address
  1933. lsr.w #2,d0
  1934. ori.w #vdpComm($0000,VRAM,WRITE)>>16,d0
  1935. swap d0
  1936. move.l d0,(a4)
  1937. subq.w #4,a4
  1938. movea.l (Plc_Buffer).w,a0
  1939. movea.l (Plc_Buffer_Reg0).w,a3
  1940. move.l (Plc_Buffer_Reg4).w,d0
  1941. move.l (Plc_Buffer_Reg8).w,d1
  1942. move.l (Plc_Buffer_RegC).w,d2
  1943. move.l (Plc_Buffer_Reg10).w,d5
  1944. move.l (Plc_Buffer_Reg14).w,d6
  1945. lea (Decomp_Buffer).w,a1
  1946.  
  1947. - movea.w #8,a5
  1948. bsr.w NemDec_WriteIter
  1949. subq.w #1,(Plc_Buffer_Reg18).w
  1950. beq.s ProcessDPLC_Pop
  1951. subq.w #1,(Plc_Buffer_Reg1A).w
  1952. bne.s -
  1953.  
  1954. move.l a0,(Plc_Buffer).w
  1955. move.l a3,(Plc_Buffer_Reg0).w
  1956. move.l d0,(Plc_Buffer_Reg4).w
  1957. move.l d1,(Plc_Buffer_Reg8).w
  1958. move.l d2,(Plc_Buffer_RegC).w
  1959. move.l d5,(Plc_Buffer_Reg10).w
  1960. move.l d6,(Plc_Buffer_Reg14).w
  1961. +
  1962. rts
  1963.  
  1964. ; ===========================================================================
  1965. ; pop one request off the buffer so that the next one can be filled
  1966.  
  1967. ; loc_177A:
  1968. ProcessDPLC_Pop:
  1969. lea (Plc_Buffer).w,a0
  1970. moveq #bytesToLcnt(Plc_Buffer_Only_End-Plc_Buffer-6),d0
  1971. - move.l 6(a0),(a0)+
  1972. dbf d0,-
  1973. rts
  1974.  
  1975. ; End of function ProcessDPLC
  1976.  
  1977.  
  1978. ; ---------------------------------------------------------------------------
  1979. ; Subroutine to execute a pattern load cue directly from the ROM
  1980. ; rather than loading them into the queue first
  1981. ; ---------------------------------------------------------------------------
  1982.  
  1983. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  1984.  
  1985. RunPLC_ROM:
  1986. lea (ArtLoadCues).l,a1
  1987. add.w d0,d0
  1988. move.w (a1,d0.w),d0
  1989. lea (a1,d0.w),a1
  1990.  
  1991. move.w (a1)+,d1
  1992. - movea.l (a1)+,a0
  1993. moveq #0,d0
  1994. move.w (a1)+,d0
  1995. lsl.l #2,d0
  1996. lsr.w #2,d0
  1997. ori.w #vdpComm($0000,VRAM,WRITE)>>16,d0
  1998. swap d0
  1999. move.l d0,(VDP_control_port).l
  2000. bsr.w NemDec
  2001. dbf d1,-
  2002.  
  2003. rts
  2004. ; End of function RunPLC_ROM
  2005.  
  2006. ; ---------------------------------------------------------------------------
  2007. ; Enigma Decompression Algorithm
  2008.  
  2009. ; ARGUMENTS:
  2010. ; d0 = starting art tile (added to each 8x8 before writing to destination)
  2011. ; a0 = source address
  2012. ; a1 = destination address
  2013.  
  2014. ; For format explanation see http://info.sonicretro.org/Enigma_compression
  2015. ; ---------------------------------------------------------------------------
  2016.  
  2017. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  2018.  
  2019. ; EniDec_17BC:
  2020. EniDec:
  2021. movem.l d0-d7/a1-a5,-(sp)
  2022. movea.w d0,a3 ; store starting art tile
  2023. move.b (a0)+,d0
  2024. ext.w d0
  2025. movea.w d0,a5 ; store first byte, extended to word
  2026. move.b (a0)+,d4 ; store second byte
  2027. lsl.b #3,d4 ; multiply by 8
  2028. movea.w (a0)+,a2 ; store third and fourth byte
  2029. adda.w a3,a2 ; add starting art tile
  2030. movea.w (a0)+,a4 ; store fifth and sixth byte
  2031. adda.w a3,a4 ; add starting art tile
  2032. move.b (a0)+,d5 ; store seventh byte
  2033. asl.w #8,d5 ; shift up by a byte
  2034. move.b (a0)+,d5 ; store eighth byte in lower register byte
  2035. moveq #16,d6 ; 16 bits = 2 bytes
  2036.  
  2037. EniDec_Loop:
  2038. moveq #7,d0 ; process 7 bits at a time
  2039. move.w d6,d7
  2040. sub.w d0,d7
  2041. move.w d5,d1
  2042. lsr.w d7,d1
  2043. andi.w #$7F,d1 ; keep only lower 7 bits
  2044. move.w d1,d2
  2045. cmpi.w #$40,d1 ; is bit 6 set?
  2046. bhs.s + ; if it is, branch
  2047. moveq #6,d0 ; if not, process 6 bits instead of 7
  2048. lsr.w #1,d2 ; bitfield now becomes TTSSSS instead of TTTSSSS
  2049. +
  2050. bsr.w EniDec_ChkGetNextByte
  2051. andi.w #$F,d2 ; keep only lower nybble
  2052. lsr.w #4,d1 ; store upper nybble (max value = 7)
  2053. add.w d1,d1
  2054. jmp EniDec_JmpTable(pc,d1.w)
  2055. ; End of function EniDec
  2056.  
  2057. ; ===========================================================================
  2058.  
  2059. EniDec_Sub0:
  2060. move.w a2,(a1)+ ; write to destination
  2061. addq.w #1,a2 ; increment
  2062. dbf d2,EniDec_Sub0 ; repeat
  2063. bra.s EniDec_Loop
  2064. ; ===========================================================================
  2065.  
  2066. EniDec_Sub4:
  2067. move.w a4,(a1)+ ; write to destination
  2068. dbf d2,EniDec_Sub4 ; repeat
  2069. bra.s EniDec_Loop
  2070. ; ===========================================================================
  2071.  
  2072. EniDec_Sub8:
  2073. bsr.w EniDec_GetInlineCopyVal
  2074.  
  2075. - move.w d1,(a1)+
  2076. dbf d2,-
  2077.  
  2078. bra.s EniDec_Loop
  2079. ; ===========================================================================
  2080.  
  2081. EniDec_SubA:
  2082. bsr.w EniDec_GetInlineCopyVal
  2083.  
  2084. - move.w d1,(a1)+
  2085. addq.w #1,d1
  2086. dbf d2,-
  2087.  
  2088. bra.s EniDec_Loop
  2089. ; ===========================================================================
  2090.  
  2091. EniDec_SubC:
  2092. bsr.w EniDec_GetInlineCopyVal
  2093.  
  2094. - move.w d1,(a1)+
  2095. subq.w #1,d1
  2096. dbf d2,-
  2097.  
  2098. bra.s EniDec_Loop
  2099. ; ===========================================================================
  2100.  
  2101. EniDec_SubE:
  2102. cmpi.w #$F,d2
  2103. beq.s EniDec_End
  2104.  
  2105. - bsr.w EniDec_GetInlineCopyVal
  2106. move.w d1,(a1)+
  2107. dbf d2,-
  2108.  
  2109. bra.s EniDec_Loop
  2110. ; ===========================================================================
  2111. ; Enigma_JmpTable:
  2112. EniDec_JmpTable:
  2113. bra.s EniDec_Sub0
  2114. bra.s EniDec_Sub0
  2115. bra.s EniDec_Sub4
  2116. bra.s EniDec_Sub4
  2117. bra.s EniDec_Sub8
  2118. bra.s EniDec_SubA
  2119. bra.s EniDec_SubC
  2120. bra.s EniDec_SubE
  2121. ; ===========================================================================
  2122.  
  2123. EniDec_End:
  2124. subq.w #1,a0
  2125. cmpi.w #16,d6 ; were we going to start on a completely new byte?
  2126. bne.s + ; if not, branch
  2127. subq.w #1,a0
  2128. +
  2129. move.w a0,d0
  2130. lsr.w #1,d0 ; are we on an odd byte?
  2131. bcc.s + ; if not, branch
  2132. addq.w #1,a0 ; ensure we're on an even byte
  2133. +
  2134. movem.l (sp)+,d0-d7/a1-a5
  2135. rts
  2136.  
  2137. ; S U B R O U T I N E
  2138.  
  2139.  
  2140. EniDec_GetInlineCopyVal:
  2141. move.w a3,d3 ; store starting art tile
  2142. move.b d4,d1
  2143. add.b d1,d1
  2144. bcc.s + ; if d4 was < $80
  2145. subq.w #1,d6 ; get next bit number
  2146. btst d6,d5 ; is the bit set?
  2147. beq.s + ; if not, branch
  2148. ori.w #high_priority,d3 ; set high priority bit
  2149. +
  2150. add.b d1,d1
  2151. bcc.s + ; if d4 was < $40
  2152. subq.w #1,d6 ; get next bit number
  2153. btst d6,d5
  2154. beq.s +
  2155. addi.w #palette_line_2,d3 ; set second palette line bit
  2156. +
  2157. add.b d1,d1
  2158. bcc.s + ; if d4 was < $20
  2159. subq.w #1,d6 ; get next bit number
  2160. btst d6,d5
  2161. beq.s +
  2162. addi.w #palette_line_1,d3 ; set first palette line bit
  2163. +
  2164. add.b d1,d1
  2165. bcc.s + ; if d4 was < $10
  2166. subq.w #1,d6 ; get next bit number
  2167. btst d6,d5
  2168. beq.s +
  2169. ori.w #flip_y,d3 ; set Y-flip bit
  2170. +
  2171. add.b d1,d1
  2172. bcc.s + ; if d4 was < 8
  2173. subq.w #1,d6
  2174. btst d6,d5
  2175. beq.s +
  2176. ori.w #flip_x,d3 ; set X-flip bit
  2177. +
  2178. move.w d5,d1
  2179. move.w d6,d7 ; get remaining bits
  2180. sub.w a5,d7 ; subtract minimum bit number
  2181. bcc.s + ; if we're beyond that, branch
  2182. move.w d7,d6
  2183. addi.w #16,d6 ; 16 bits = 2 bytes
  2184. neg.w d7 ; calculate bit deficit
  2185. lsl.w d7,d1 ; make space for this many bits
  2186. move.b (a0),d5 ; get next byte
  2187. rol.b d7,d5 ; make the upper X bits the lower X bits
  2188. add.w d7,d7
  2189. and.w EniDec_AndVals-2(pc,d7.w),d5 ; only keep X lower bits
  2190. add.w d5,d1 ; compensate for the bit deficit
  2191. -
  2192. move.w a5,d0
  2193. add.w d0,d0
  2194. and.w EniDec_AndVals-2(pc,d0.w),d1 ; only keep as many bits as required
  2195. add.w d3,d1 ; add starting art tile
  2196. move.b (a0)+,d5 ; get current byte, move onto next byte
  2197. lsl.w #8,d5 ; shift up by a byte
  2198. move.b (a0)+,d5 ; store next byte in lower register byte
  2199. rts
  2200. ; ===========================================================================
  2201. +
  2202. beq.s + ; if the exact number of bits are leftover, branch
  2203. lsr.w d7,d1 ; remove unneeded bits
  2204. move.w a5,d0
  2205. add.w d0,d0
  2206. and.w EniDec_AndVals-2(pc,d0.w),d1 ; only keep as many bits as required
  2207. add.w d3,d1 ; add starting art tile
  2208. move.w a5,d0 ; store number of bits used up by inline copy
  2209. bra.s EniDec_ChkGetNextByte ; move onto next byte
  2210. ; ===========================================================================
  2211. +
  2212. moveq #16,d6 ; 16 bits = 2 bytes
  2213. bra.s -
  2214. ; End of function EniDec_GetInlineCopyVal
  2215.  
  2216. ; ===========================================================================
  2217. ; word_190A:
  2218. EniDec_AndVals:
  2219. dc.w 1, 3, 7, $F
  2220. dc.w $1F, $3F, $7F, $FF
  2221. dc.w $1FF, $3FF, $7FF, $FFF
  2222. dc.w $1FFF,$3FFF,$7FFF,$FFFF
  2223. ; ===========================================================================
  2224.  
  2225. EniDec_ChkGetNextByte:
  2226. sub.w d0,d6
  2227. cmpi.w #9,d6
  2228. bhs.s + ; rts
  2229. addq.w #8,d6 ; 8 bits = 1 byte
  2230. asl.w #8,d5 ; shift up by a byte
  2231. move.b (a0)+,d5 ; store next byte in lower register byte
  2232. +
  2233. rts
  2234.  
  2235. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  2236. ; ---------------------------------------------------------------------------
  2237. ; KOSINSKI DECOMPRESSION PROCEDURE
  2238. ; (sometimes called KOZINSKI decompression)
  2239.  
  2240. ; This is the only procedure in the game that stores variables on the stack.
  2241.  
  2242. ; ARGUMENTS:
  2243. ; a0 = source address
  2244. ; a1 = destination address
  2245.  
  2246. ; For format explanation see http://info.sonicretro.org/Kosinski_compression
  2247. ; ---------------------------------------------------------------------------
  2248. ; KozDec_193A:
  2249. KosDec:
  2250. subq.l #2,sp
  2251. move.b (a0)+,1(sp)
  2252. move.b (a0)+,(sp)
  2253. move.w (sp),d5
  2254. moveq #$F,d4
  2255.  
  2256. -
  2257. lsr.w #1,d5
  2258. move sr,d6
  2259. dbf d4,+
  2260. move.b (a0)+,1(sp)
  2261. move.b (a0)+,(sp)
  2262. move.w (sp),d5
  2263. moveq #$F,d4
  2264. +
  2265. move d6,ccr
  2266. bcc.s +
  2267. move.b (a0)+,(a1)+
  2268. bra.s -
  2269. ; ---------------------------------------------------------------------------
  2270. +
  2271. moveq #0,d3
  2272. lsr.w #1,d5
  2273. move sr,d6
  2274. dbf d4,+
  2275. move.b (a0)+,1(sp)
  2276. move.b (a0)+,(sp)
  2277. move.w (sp),d5
  2278. moveq #$F,d4
  2279. +
  2280. move d6,ccr
  2281. bcs.s +++
  2282. lsr.w #1,d5
  2283. dbf d4,+
  2284. move.b (a0)+,1(sp)
  2285. move.b (a0)+,(sp)
  2286. move.w (sp),d5
  2287. moveq #$F,d4
  2288. +
  2289. roxl.w #1,d3
  2290. lsr.w #1,d5
  2291. dbf d4,+
  2292. move.b (a0)+,1(sp)
  2293. move.b (a0)+,(sp)
  2294. move.w (sp),d5
  2295. moveq #$F,d4
  2296. +
  2297. roxl.w #1,d3
  2298. addq.w #1,d3
  2299. moveq #-1,d2
  2300. move.b (a0)+,d2
  2301. bra.s ++
  2302. ; ---------------------------------------------------------------------------
  2303. +
  2304. move.b (a0)+,d0
  2305. move.b (a0)+,d1
  2306. moveq #-1,d2
  2307. move.b d1,d2
  2308. lsl.w #5,d2
  2309. move.b d0,d2
  2310. andi.w #7,d1
  2311. beq.s ++
  2312. move.b d1,d3
  2313. addq.w #1,d3
  2314. /
  2315. move.b (a1,d2.w),d0
  2316. move.b d0,(a1)+
  2317. dbf d3,-
  2318. bra.s --
  2319. ; ---------------------------------------------------------------------------
  2320. +
  2321. move.b (a0)+,d1
  2322. beq.s +
  2323. cmpi.b #1,d1
  2324. beq.w --
  2325. move.b d1,d3
  2326. bra.s -
  2327. ; ---------------------------------------------------------------------------
  2328. +
  2329. addq.l #2,sp
  2330. rts
  2331. ; End of function KosDec
  2332.  
  2333. ; ===========================================================================
  2334.  
  2335. if gameRevision<2
  2336. nop
  2337. endif
  2338.  
  2339.  
  2340.  
  2341.  
  2342. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  2343.  
  2344. ; sub_19DC:
  2345. PalCycle_Load:
  2346. bsr.w PalCycle_SuperSonic
  2347. moveq #0,d2
  2348. moveq #0,d0
  2349. move.b (Current_Zone).w,d0 ; use level number as index into palette cycles
  2350. add.w d0,d0 ; (multiply by element size = 2 bytes)
  2351. move.w PalCycle(pc,d0.w),d0 ; load animated palettes offset index into d0
  2352. jmp PalCycle(pc,d0.w) ; jump to PalCycle + offset index
  2353. ; ---------------------------------------------------------------------------
  2354. rts
  2355. ; End of function PalCycle_Load
  2356.  
  2357. ; ===========================================================================
  2358. ; off_19F4:
  2359. PalCycle: zoneOrderedOffsetTable 2,1
  2360. zoneOffsetTableEntry.w PalCycle_EHZ ; 0
  2361. zoneOffsetTableEntry.w PalCycle_Null ; 1
  2362. zoneOffsetTableEntry.w PalCycle_WZ ; 2
  2363. zoneOffsetTableEntry.w PalCycle_Null ; 3
  2364. zoneOffsetTableEntry.w PalCycle_MTZ ; 4
  2365. zoneOffsetTableEntry.w PalCycle_MTZ ; 5
  2366. zoneOffsetTableEntry.w PalCycle_WFZ ; 6
  2367. zoneOffsetTableEntry.w PalCycle_HTZ ; 7
  2368. zoneOffsetTableEntry.w PalCycle_HPZ ; 8
  2369. zoneOffsetTableEntry.w PalCycle_Null ; 9
  2370. zoneOffsetTableEntry.w PalCycle_OOZ ; 10
  2371. zoneOffsetTableEntry.w PalCycle_MCZ ; 11
  2372. zoneOffsetTableEntry.w PalCycle_CNZ ; 12
  2373. zoneOffsetTableEntry.w PalCycle_CPZ ; 13
  2374. zoneOffsetTableEntry.w PalCycle_CPZ ; 14
  2375. zoneOffsetTableEntry.w PalCycle_ARZ ; 15
  2376. zoneOffsetTableEntry.w PalCycle_WFZ ; 16
  2377. zoneTableEnd
  2378.  
  2379. ; ===========================================================================
  2380. ; return_1A16:
  2381. PalCycle_Null:
  2382. rts
  2383. ; ===========================================================================
  2384.  
  2385. PalCycle_EHZ:
  2386. lea (CyclingPal_EHZ_ARZ_Water).l,a0
  2387. subq.w #1,(PalCycle_Timer).w
  2388. bpl.s + ; rts
  2389. move.w #7,(PalCycle_Timer).w
  2390. move.w (PalCycle_Frame).w,d0
  2391. addq.w #1,(PalCycle_Frame).w
  2392. andi.w #3,d0
  2393. lsl.w #3,d0
  2394. move.l (a0,d0.w),(Normal_palette_line2+6).w
  2395. move.l 4(a0,d0.w),(Normal_palette_line2+$1C).w
  2396. + rts
  2397. ; ===========================================================================
  2398.  
  2399. ; PalCycle_Level2:
  2400. PalCycle_WZ:
  2401. subq.w #1,(PalCycle_Timer).w
  2402. bpl.s ++ ; rts
  2403. move.w #2,(PalCycle_Timer).w
  2404. lea (CyclingPal_WoodConveyor).l,a0
  2405. move.w (PalCycle_Frame).w,d0
  2406. subq.w #2,(PalCycle_Frame).w
  2407. bcc.s +
  2408. move.w #6,(PalCycle_Frame).w
  2409. + lea (Normal_palette_line4+6).w,a1
  2410. move.l (a0,d0.w),(a1)+
  2411. move.l 4(a0,d0.w),(a1)
  2412. + rts
  2413. ; ===========================================================================
  2414.  
  2415. PalCycle_MTZ:
  2416. subq.w #1,(PalCycle_Timer).w
  2417. bpl.s ++
  2418. move.w #$11,(PalCycle_Timer).w
  2419. lea (CyclingPal_MTZ1).l,a0
  2420. move.w (PalCycle_Frame).w,d0
  2421. addq.w #2,(PalCycle_Frame).w
  2422. cmpi.w #$C,(PalCycle_Frame).w
  2423. blo.s +
  2424. move.w #0,(PalCycle_Frame).w
  2425. + lea (Normal_palette_line3+$A).w,a1
  2426. move.w (a0,d0.w),(a1)
  2427. +
  2428. subq.w #1,(PalCycle_Timer2).w
  2429. bpl.s ++
  2430. move.w #2,(PalCycle_Timer2).w
  2431. lea (CyclingPal_MTZ2).l,a0
  2432. move.w (PalCycle_Frame2).w,d0
  2433. addq.w #2,(PalCycle_Frame2).w
  2434. cmpi.w #6,(PalCycle_Frame2).w
  2435. blo.s +
  2436. move.w #0,(PalCycle_Frame2).w
  2437. + lea (Normal_palette_line3+2).w,a1
  2438. move.l (a0,d0.w),(a1)+
  2439. move.w 4(a0,d0.w),(a1)
  2440. +
  2441. subq.w #1,(PalCycle_Timer3).w
  2442. bpl.s ++ ; rts
  2443. move.w #9,(PalCycle_Timer3).w
  2444. lea (CyclingPal_MTZ3).l,a0
  2445. move.w (PalCycle_Frame3).w,d0
  2446. addq.w #2,(PalCycle_Frame3).w
  2447. cmpi.w #$14,(PalCycle_Frame3).w
  2448. blo.s +
  2449. move.w #0,(PalCycle_Frame3).w
  2450. + lea (Normal_palette_line3+$1E).w,a1
  2451. move.w (a0,d0.w),(a1)
  2452. + rts
  2453. ; ===========================================================================
  2454.  
  2455. PalCycle_HTZ:
  2456. lea (CyclingPal_Lava).l,a0
  2457. subq.w #1,(PalCycle_Timer).w
  2458. bpl.s + ; rts
  2459. move.w #0,(PalCycle_Timer).w
  2460. move.w (PalCycle_Frame).w,d0
  2461. addq.w #1,(PalCycle_Frame).w
  2462. andi.w #$F,d0
  2463. move.b PalCycle_HTZ_LavaDelayData(pc,d0.w),(PalCycle_Timer+1).w
  2464. lsl.w #3,d0
  2465. move.l (a0,d0.w),(Normal_palette_line2+6).w
  2466. move.l 4(a0,d0.w),(Normal_palette_line2+$1C).w
  2467. + rts
  2468. ; ===========================================================================
  2469. ; byte_1B40:
  2470. PalCycle_HTZ_LavaDelayData: ; number of frames between changes of the lava palette
  2471. dc.b $B, $B, $B, $A
  2472. dc.b 8, $A, $B, $B
  2473. dc.b $B, $B, $D, $F
  2474. dc.b $D, $B, $B, $B
  2475. ; ===========================================================================
  2476.  
  2477. PalCycle_HPZ:
  2478. subq.w #1,(PalCycle_Timer).w
  2479. bpl.s ++ ; rts
  2480. move.w #4,(PalCycle_Timer).w
  2481. lea (CyclingPal_HPZWater).l,a0
  2482. move.w (PalCycle_Frame).w,d0
  2483. subq.w #2,(PalCycle_Frame).w
  2484. bcc.s +
  2485. move.w #6,(PalCycle_Frame).w
  2486. + lea (Normal_palette_line4+$12).w,a1
  2487. move.l (a0,d0.w),(a1)+
  2488. move.l 4(a0,d0.w),(a1)
  2489. lea (CyclingPal_HPZUnderwater).l,a0
  2490. lea (Underwater_palette_line4+$12).w,a1
  2491. move.l (a0,d0.w),(a1)+
  2492. move.l 4(a0,d0.w),(a1)
  2493. + rts
  2494. ; ===========================================================================
  2495.  
  2496. PalCycle_OOZ:
  2497. subq.w #1,(PalCycle_Timer).w
  2498. bpl.s + ; rts
  2499. move.w #7,(PalCycle_Timer).w
  2500. lea (CyclingPal_Oil).l,a0
  2501. move.w (PalCycle_Frame).w,d0
  2502. addq.w #2,(PalCycle_Frame).w
  2503. andi.w #6,(PalCycle_Frame).w
  2504. lea (Normal_palette_line3+$14).w,a1
  2505. move.l (a0,d0.w),(a1)+
  2506. move.l 4(a0,d0.w),(a1)
  2507. + rts
  2508. ; ===========================================================================
  2509.  
  2510. PalCycle_MCZ:
  2511. tst.b (Current_Boss_ID).w
  2512. bne.s + ; rts
  2513. subq.w #1,(PalCycle_Timer).w
  2514. bpl.s + ; rts
  2515. move.w #1,(PalCycle_Timer).w
  2516. lea (CyclingPal_Lantern).l,a0
  2517. move.w (PalCycle_Frame).w,d0
  2518. addq.w #2,(PalCycle_Frame).w
  2519. andi.w #6,(PalCycle_Frame).w
  2520. move.w (a0,d0.w),(Normal_palette_line2+$16).w
  2521. + rts
  2522. ; ===========================================================================
  2523.  
  2524. PalCycle_CNZ:
  2525. subq.w #1,(PalCycle_Timer).w
  2526. bpl.w CNZ_SkipToBossPalCycle
  2527. move.w #7,(PalCycle_Timer).w
  2528. lea (CyclingPal_CNZ1).l,a0
  2529. move.w (PalCycle_Frame).w,d0
  2530. addq.w #2,(PalCycle_Frame).w
  2531. cmpi.w #6,(PalCycle_Frame).w
  2532. blo.s +
  2533. move.w #0,(PalCycle_Frame).w
  2534. +
  2535. lea (a0,d0.w),a0
  2536. lea (Normal_palette).w,a1
  2537. _move.w 0(a0),$4A(a1)
  2538. move.w 6(a0),$4C(a1)
  2539. move.w $C(a0),$4E(a1)
  2540. move.w $12(a0),$56(a1)
  2541. move.w $18(a0),$58(a1)
  2542. move.w $1E(a0),$5A(a1)
  2543. lea (CyclingPal_CNZ3).l,a0
  2544. lea (a0,d0.w),a0
  2545. _move.w 0(a0),$64(a1)
  2546. move.w 6(a0),$66(a1)
  2547. move.w $C(a0),$68(a1)
  2548. lea (CyclingPal_CNZ4).l,a0
  2549. move.w (PalCycle_Frame_CNZ).w,d0
  2550. addq.w #2,(PalCycle_Frame_CNZ).w
  2551. cmpi.w #$24,(PalCycle_Frame_CNZ).w
  2552. blo.s +
  2553. move.w #0,(PalCycle_Frame_CNZ).w
  2554. +
  2555. lea (Normal_palette_line4+$12).w,a1
  2556. move.w 4(a0,d0.w),(a1)+
  2557. move.w 2(a0,d0.w),(a1)+
  2558. move.w (a0,d0.w),(a1)+
  2559.  
  2560. CNZ_SkipToBossPalCycle:
  2561. tst.b (Current_Boss_ID).w
  2562. beq.w +++ ; rts
  2563. subq.w #1,(PalCycle_Timer2).w
  2564. bpl.w +++ ; rts
  2565. move.w #3,(PalCycle_Timer2).w
  2566. move.w (PalCycle_Frame2).w,d0
  2567. addq.w #2,(PalCycle_Frame2).w
  2568. cmpi.w #6,(PalCycle_Frame2).w
  2569. blo.s +
  2570. move.w #0,(PalCycle_Frame2).w
  2571. + lea (CyclingPal_CNZ1_B).l,a0
  2572. lea (a0,d0.w),a0
  2573. lea (Normal_palette).w,a1
  2574. _move.w 0(a0),$24(a1)
  2575. move.w 6(a0),$26(a1)
  2576. move.w $C(a0),$28(a1)
  2577. lea (CyclingPal_CNZ2_B).l,a0
  2578. move.w (PalCycle_Frame3).w,d0
  2579. addq.w #2,(PalCycle_Frame3).w
  2580. cmpi.w #$14,(PalCycle_Frame3).w
  2581. blo.s +
  2582. move.w #0,(PalCycle_Frame3).w
  2583. + move.w (a0,d0.w),$3C(a1)
  2584. lea (CyclingPal_CNZ3_B).l,a0
  2585. move.w (PalCycle_Frame2_CNZ).w,d0
  2586. addq.w #2,(PalCycle_Frame2_CNZ).w
  2587. andi.w #$E,(PalCycle_Frame2_CNZ).w
  2588. move.w (a0,d0.w),$3E(a1)
  2589. + rts
  2590. ; ===========================================================================
  2591.  
  2592. PalCycle_CPZ:
  2593. subq.w #1,(PalCycle_Timer).w
  2594. bpl.s +++ ; rts
  2595. move.w #7,(PalCycle_Timer).w
  2596. lea (CyclingPal_CPZ1).l,a0
  2597. move.w (PalCycle_Frame).w,d0
  2598. addq.w #6,(PalCycle_Frame).w
  2599. cmpi.w #$36,(PalCycle_Frame).w
  2600. blo.s +
  2601. move.w #0,(PalCycle_Frame).w
  2602. + lea (Normal_palette_line4+$18).w,a1
  2603. move.l (a0,d0.w),(a1)+
  2604. move.w 4(a0,d0.w),(a1)
  2605. lea (CyclingPal_CPZ2).l,a0
  2606. move.w (PalCycle_Frame2).w,d0
  2607. addq.w #2,(PalCycle_Frame2).w
  2608. cmpi.w #$2A,(PalCycle_Frame2).w
  2609. blo.s +
  2610. move.w #0,(PalCycle_Frame2).w
  2611. + move.w (a0,d0.w),(Normal_palette_line4+$1E).w
  2612. lea (CyclingPal_CPZ3).l,a0
  2613. move.w (PalCycle_Frame3).w,d0
  2614. addq.w #2,(PalCycle_Frame3).w
  2615. andi.w #$1E,(PalCycle_Frame3).w
  2616. move.w (a0,d0.w),(Normal_palette_line3+$1E).w
  2617. + rts
  2618. ; ===========================================================================
  2619.  
  2620. PalCycle_ARZ:
  2621. lea (CyclingPal_EHZ_ARZ_Water).l,a0
  2622. subq.w #1,(PalCycle_Timer).w
  2623. bpl.s + ; rts
  2624. move.w #5,(PalCycle_Timer).w
  2625. move.w (PalCycle_Frame).w,d0
  2626. addq.w #1,(PalCycle_Frame).w
  2627. andi.w #3,d0
  2628. lsl.w #3,d0
  2629. lea (Normal_palette_line3+4).w,a1
  2630. move.l (a0,d0.w),(a1)+
  2631. move.l 4(a0,d0.w),(a1)
  2632. + rts
  2633. ; ===========================================================================
  2634.  
  2635. PalCycle_WFZ:
  2636. subq.w #1,(PalCycle_Timer).w
  2637. bpl.s +++
  2638. move.w #1,(PalCycle_Timer).w
  2639. lea (CyclingPal_WFZFire).l,a0
  2640. tst.b (WFZ_SCZ_Fire_Toggle).w
  2641. beq.s +
  2642. move.w #5,(PalCycle_Timer).w
  2643. lea (CyclingPal_WFZBelt).l,a0
  2644. + move.w (PalCycle_Frame).w,d0
  2645. addq.w #8,(PalCycle_Frame).w
  2646. cmpi.w #$20,(PalCycle_Frame).w
  2647. blo.s +
  2648. move.w #0,(PalCycle_Frame).w
  2649. + lea (Normal_palette_line3+$E).w,a1
  2650. move.l (a0,d0.w),(a1)+
  2651. move.l 4(a0,d0.w),(a1)
  2652. + subq.w #1,(PalCycle_Timer2).w
  2653. bpl.s ++ ; subq.w
  2654. move.w #3,(PalCycle_Timer2).w
  2655. lea (CyclingPal_WFZ1).l,a0
  2656. move.w (PalCycle_Frame2).w,d0
  2657. addq.w #2,(PalCycle_Frame2).w
  2658. cmpi.w #$44,(PalCycle_Frame2).w
  2659. blo.s + ; move.w
  2660. move.w #0,(PalCycle_Frame2).w
  2661. + move.w (a0,d0.w),(Normal_palette_line3+$1C).w
  2662. +
  2663. subq.w #1,(PalCycle_Timer3).w
  2664. bpl.s ++ ; rts
  2665. move.w #5,(PalCycle_Timer3).w
  2666. lea (CyclingPal_WFZ2).l,a0
  2667. move.w (PalCycle_Frame3).w,d0
  2668. addq.w #2,(PalCycle_Frame3).w
  2669. cmpi.w #$18,(PalCycle_Frame3).w
  2670. blo.s +
  2671. move.w #0,(PalCycle_Frame3).w
  2672. + move.w (a0,d0.w),(Normal_palette_line3+$1E).w
  2673. + rts
  2674. ; ===========================================================================
  2675.  
  2676. ; ----------------------------------------------------------------------------
  2677. ; word_1E5A:
  2678. BINCLUDE "art/palettes/Title Water.bin"; S1 Title Screen Water palette (unused)
  2679. ; word_1E7A:
  2680. CyclingPal_EHZ_ARZ_Water:
  2681. BINCLUDE "art/palettes/EHZ ARZ Water.bin"; Emerald Hill/Aquatic Ruin Rotating Water palette
  2682. ; word_1E9A:
  2683. CyclingPal_Lava:
  2684. BINCLUDE "art/palettes/Hill Top Lava.bin"; Hill Top Lava palette
  2685. ; word_1F1A:
  2686. CyclingPal_WoodConveyor:
  2687. BINCLUDE "art/palettes/Wood Conveyor.bin"; Wood Conveyor Belts palette
  2688. ; byte_1F2A:
  2689. CyclingPal_MTZ1:
  2690. BINCLUDE "art/palettes/MTZ Cycle 1.bin"; Metropolis Cycle #1 palette
  2691. ; word_1F36:
  2692. CyclingPal_MTZ2:
  2693. BINCLUDE "art/palettes/MTZ Cycle 2.bin"; Metropolis Cycle #2 palette
  2694. ; word_1F42:
  2695. CyclingPal_MTZ3:
  2696. BINCLUDE "art/palettes/MTZ Cycle 3.bin"; Metropolis Cycle #3 palette
  2697. ; word_1F56:
  2698. CyclingPal_HPZWater:
  2699. BINCLUDE "art/palettes/HPZ Water Cycle.bin"; Hidden Palace Water Cycle
  2700. ; word_1F66:
  2701. CyclingPal_HPZUnderwater:
  2702. BINCLUDE "art/palettes/HPZ Underwater Cycle.bin"; Hidden Palace Underwater Cycle
  2703. ; word_1F76:
  2704. CyclingPal_Oil:
  2705. BINCLUDE "art/palettes/OOZ Oil.bin"; Oil Ocean Oil palette
  2706. ; word_1F86:
  2707. CyclingPal_Lantern:
  2708. BINCLUDE "art/palettes/MCZ Lantern.bin"; Mystic Cave Lanterns
  2709. ; word_1F8E:
  2710. CyclingPal_CNZ1:
  2711. BINCLUDE "art/palettes/CNZ Cycle 1.bin"; Casino Night Cycles 1 & 2
  2712. ; word_1FB2:
  2713. CyclingPal_CNZ3:
  2714. BINCLUDE "art/palettes/CNZ Cycle 3.bin"; Casino Night Cycle 3
  2715. ; word_1FC4:
  2716. CyclingPal_CNZ4:
  2717. BINCLUDE "art/palettes/CNZ Cycle 4.bin"; Casino Night Cycle 4
  2718. ; word_1FEC:
  2719. CyclingPal_CNZ1_B:
  2720. BINCLUDE "art/palettes/CNZ Boss Cycle 1.bin"; Casino Night Boss Cycle 1
  2721. ; word_1FFE:
  2722. CyclingPal_CNZ2_B:
  2723. BINCLUDE "art/palettes/CNZ Boss Cycle 2.bin"; Casino Night Boss Cycle 2
  2724. ; word_2012:
  2725. CyclingPal_CNZ3_B:
  2726. BINCLUDE "art/palettes/CNZ Boss Cycle 3.bin"; Casino Night Boss Cycle 3
  2727. ; word_2022:
  2728. CyclingPal_CPZ1:
  2729. BINCLUDE "art/palettes/CPZ Cycle 1.bin"; Chemical Plant Cycle 1
  2730. ; word_2058:
  2731. CyclingPal_CPZ2:
  2732. BINCLUDE "art/palettes/CPZ Cycle 2.bin"; Chemical Plant Cycle 2
  2733. ; word_2082:
  2734. CyclingPal_CPZ3:
  2735. BINCLUDE "art/palettes/CPZ Cycle 3.bin"; Chemical Plant Cycle 3
  2736. ; word_20A2:
  2737. CyclingPal_WFZFire:
  2738. BINCLUDE "art/palettes/WFZ Fire Cycle.bin"; Wing Fortress Fire Cycle palette
  2739. ; word_20C2:
  2740. CyclingPal_WFZBelt:
  2741. BINCLUDE "art/palettes/WFZ Conveyor Cycle.bin"; Wing Fortress Conveyor Belt Cycle palette
  2742. ; word_20E2: CyclingPal_CPZ4:
  2743. CyclingPal_WFZ1:
  2744. BINCLUDE "art/palettes/WFZ Cycle 1.bin"; Wing Fortress Flashing Light Cycle 1
  2745. ; word_2126:
  2746. CyclingPal_WFZ2:
  2747. BINCLUDE "art/palettes/WFZ Cycle 2.bin"; Wing Fortress Flashing Light Cycle 2
  2748. ; ----------------------------------------------------------------------------
  2749.  
  2750.  
  2751. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  2752.  
  2753. ; sub_213E:
  2754. PalCycle_SuperSonic:
  2755. move.b (Super_Sonic_palette).w,d0
  2756. beq.s ++ ; rts ; return, if Sonic isn't super
  2757. bmi.w PalCycle_SuperSonic_normal ; branch, if fade-in is done
  2758. subq.b #1,d0
  2759. bne.s PalCycle_SuperSonic_revert ; branch for values greater than 1
  2760.  
  2761. ; fade from Sonic's to Super Sonic's palette
  2762. ; run frame timer
  2763. subq.b #1,(Palette_timer).w
  2764. bpl.s ++ ; rts
  2765. move.b #3,(Palette_timer).w
  2766.  
  2767. ; increment palette frame and update Sonic's palette
  2768. lea (CyclingPal_SSTransformation).l,a0
  2769. move.w (Palette_frame).w,d0
  2770. addq.w #8,(Palette_frame).w ; 1 palette entry = 1 word, Sonic uses 4 shades of blue
  2771. cmpi.w #$30,(Palette_frame).w ; has palette cycle reached the 6th frame?
  2772. blo.s + ; if not, branch
  2773. move.b #-1,(Super_Sonic_palette).w ; mark fade-in as done
  2774. move.b #0,(MainCharacter+obj_control).w ; restore Sonic's movement
  2775. +
  2776. lea (Normal_palette+4).w,a1
  2777. move.l (a0,d0.w),(a1)+
  2778. move.l 4(a0,d0.w),(a1)
  2779. ; note: the fade in for Sonic's underwater palette is missing.
  2780. ; branch to the code below (*) to fix this
  2781. / rts
  2782. ; ===========================================================================
  2783. ; loc_2188:
  2784. PalCycle_SuperSonic_revert: ; runs the fade in transition backwards
  2785. ; run frame timer
  2786. subq.b #1,(Palette_timer).w
  2787. bpl.s - ; rts
  2788. move.b #3,(Palette_timer).w
  2789.  
  2790. ; decrement palette frame and update Sonic's palette
  2791. lea (CyclingPal_SSTransformation).l,a0
  2792. move.w (Palette_frame).w,d0
  2793. subq.w #8,(Palette_frame).w ; previous frame
  2794. bcc.s + ; branch, if it isn't the first frame
  2795. move.b #0,(Palette_frame).w
  2796. move.b #0,(Super_Sonic_palette).w ; stop palette cycle
  2797. +
  2798. lea (Normal_palette+4).w,a1
  2799. move.l (a0,d0.w),(a1)+
  2800. move.l 4(a0,d0.w),(a1)
  2801. ; underwater palettes (*)
  2802. lea (CyclingPal_CPZUWTransformation).l,a0
  2803. cmpi.b #chemical_plant_zone,(Current_Zone).w
  2804. beq.s +
  2805. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  2806. bne.s - ; rts
  2807. lea (CyclingPal_ARZUWTransformation).l,a0
  2808. + lea (Underwater_palette+4).w,a1
  2809. move.l (a0,d0.w),(a1)+
  2810. move.l 4(a0,d0.w),(a1)
  2811. rts
  2812. ; ===========================================================================
  2813. ; loc_21E6:
  2814. PalCycle_SuperSonic_normal:
  2815. ; run frame timer
  2816. subq.b #1,(Palette_timer).w
  2817. bpl.s - ; rts
  2818. move.b #7,(Palette_timer).w
  2819.  
  2820. ; increment palette frame and update Sonic's palette
  2821. lea (CyclingPal_SSTransformation).l,a0
  2822. move.w (Palette_frame).w,d0
  2823. addq.w #8,(Palette_frame).w ; next frame
  2824. cmpi.w #$78,(Palette_frame).w ; is it the last frame?
  2825. blo.s + ; if not, branch
  2826. move.w #$30,(Palette_frame).w ; reset frame counter (Super Sonic's normal palette cycle starts at $30. Everything before that is for the palette fade)
  2827. +
  2828. lea (Normal_palette+4).w,a1
  2829. move.l (a0,d0.w),(a1)+
  2830. move.l 4(a0,d0.w),(a1)
  2831. ; underwater palettes
  2832. lea (CyclingPal_CPZUWTransformation).l,a0
  2833. cmpi.b #chemical_plant_zone,(Current_Zone).w
  2834. beq.s +
  2835. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  2836. bne.w - ; rts
  2837. lea (CyclingPal_ARZUWTransformation).l,a0
  2838. + lea (Underwater_palette+4).w,a1
  2839. move.l (a0,d0.w),(a1)+
  2840. move.l 4(a0,d0.w),(a1)
  2841. rts
  2842. ; End of function PalCycle_SuperSonic
  2843.  
  2844. ; ===========================================================================
  2845. ;----------------------------------------------------------------------------
  2846. ;Palette for transformation to Super Sonic
  2847. ;----------------------------------------------------------------------------
  2848. ; Pal_2246:
  2849. CyclingPal_SSTransformation:
  2850. BINCLUDE "art/palettes/Super Sonic transformation.bin"
  2851. ;----------------------------------------------------------------------------
  2852. ;Palette for transformation to Super Sonic while underwater in CPZ
  2853. ;----------------------------------------------------------------------------
  2854. ; Pal_22C6:
  2855. CyclingPal_CPZUWTransformation:
  2856. BINCLUDE "art/palettes/CPZWater SS transformation.bin"
  2857. ;----------------------------------------------------------------------------
  2858. ;Palette for transformation to Super Sonic while underwater in ARZ
  2859. ;----------------------------------------------------------------------------
  2860. ; Pal_2346:
  2861. CyclingPal_ARZUWTransformation:
  2862. BINCLUDE "art/palettes/ARZWater SS transformation.bin"
  2863.  
  2864. ; ---------------------------------------------------------------------------
  2865. ; Subroutine to fade in from black
  2866. ; ---------------------------------------------------------------------------
  2867.  
  2868. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  2869.  
  2870. ; sub_23C6: Pal_FadeTo:
  2871. Pal_FadeFromBlack:
  2872. move.w #$3F,(Palette_fade_range).w
  2873. moveq #0,d0
  2874. lea (Normal_palette).w,a0
  2875. move.b (Palette_fade_start).w,d0
  2876. adda.w d0,a0
  2877. moveq #0,d1
  2878. move.b (Palette_fade_length).w,d0
  2879. ; loc_23DE: Pal_ToBlack:
  2880. .palettewrite:
  2881. move.w d1,(a0)+
  2882. dbf d0,.palettewrite ; fill palette with $000 (black)
  2883.  
  2884. move.w #$15,d4
  2885. .nextframe:
  2886. move.b #VintID_Fade,(Vint_routine).w
  2887. bsr.w WaitForVint
  2888. bsr.s .UpdateAllColours
  2889. bsr.w RunPLC_RAM
  2890. dbf d4,.nextframe
  2891.  
  2892. rts
  2893. ; End of function Pal_FadeFromBlack
  2894.  
  2895. ; ---------------------------------------------------------------------------
  2896. ; Subroutine to update all colours once
  2897. ; ---------------------------------------------------------------------------
  2898. ; sub_23FE: Pal_FadeIn:
  2899. .UpdateAllColours:
  2900. ; Update above-water palette
  2901. moveq #0,d0
  2902. lea (Normal_palette).w,a0
  2903. lea (Target_palette).w,a1
  2904. move.b (Palette_fade_start).w,d0
  2905. adda.w d0,a0
  2906. adda.w d0,a1
  2907.  
  2908. move.b (Palette_fade_length).w,d0
  2909. .nextcolour:
  2910. bsr.s .UpdateColour
  2911. dbf d0,.nextcolour
  2912.  
  2913. tst.b (Water_flag).w
  2914. beq.s .skipunderwater
  2915. ; Update underwater palette
  2916. moveq #0,d0
  2917. lea (Underwater_palette).w,a0
  2918. lea (Underwater_target_palette).w,a1
  2919. move.b (Palette_fade_start).w,d0
  2920. adda.w d0,a0
  2921. adda.w d0,a1
  2922.  
  2923. move.b (Palette_fade_length).w,d0
  2924. .nextcolour2:
  2925. bsr.s .UpdateColour
  2926. dbf d0,.nextcolour2
  2927.  
  2928. .skipunderwater:
  2929. rts
  2930.  
  2931. ; ---------------------------------------------------------------------------
  2932. ; Subroutine to update a single colour once
  2933. ; ---------------------------------------------------------------------------
  2934. ; sub_243E: Pal_AddColor:
  2935. .UpdateColour:
  2936. move.w (a1)+,d2
  2937. move.w (a0),d3
  2938. cmp.w d2,d3
  2939. beq.s .updatenone
  2940. ;.updateblue:
  2941. move.w d3,d1
  2942. addi.w #$200,d1 ; increase blue value
  2943. cmp.w d2,d1 ; has blue reached threshold level?
  2944. bhi.s .updategreen ; if yes, branch
  2945. move.w d1,(a0)+ ; update palette
  2946. rts
  2947.  
  2948. ; loc_2454: Pal_AddGreen:
  2949. .updategreen:
  2950. move.w d3,d1
  2951. addi.w #$20,d1 ; increase green value
  2952. cmp.w d2,d1
  2953. bhi.s .updatered
  2954. move.w d1,(a0)+ ; update palette
  2955. rts
  2956.  
  2957. ; loc_2462: Pal_AddRed:
  2958. .updatered:
  2959. addq.w #2,(a0)+ ; increase red value
  2960. rts
  2961.  
  2962. ; loc_2466: Pal_AddNone:
  2963. .updatenone:
  2964. addq.w #2,a0
  2965. rts
  2966.  
  2967.  
  2968. ; ---------------------------------------------------------------------------
  2969. ; Subroutine to fade out to black
  2970. ; ---------------------------------------------------------------------------
  2971.  
  2972. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  2973.  
  2974. ; sub_246A: Pal_FadeFrom:
  2975. Pal_FadeToBlack:
  2976. move.w #$3F,(Palette_fade_range).w
  2977.  
  2978. move.w #$15,d4
  2979. .nextframe:
  2980. move.b #VintID_Fade,(Vint_routine).w
  2981. bsr.w WaitForVint
  2982. bsr.s .UpdateAllColours
  2983. bsr.w RunPLC_RAM
  2984. dbf d4,.nextframe
  2985.  
  2986. rts
  2987. ; End of function Pal_FadeToBlack
  2988.  
  2989. ; ---------------------------------------------------------------------------
  2990. ; Subroutine to update all colours once
  2991. ; ---------------------------------------------------------------------------
  2992. ; sub_248A: Pal_FadeOut:
  2993. .UpdateAllColours:
  2994. ; Update above-water palette
  2995. moveq #0,d0
  2996. lea (Normal_palette).w,a0
  2997. move.b (Palette_fade_start).w,d0
  2998. adda.w d0,a0
  2999.  
  3000. move.b (Palette_fade_length).w,d0
  3001. .nextcolour:
  3002. bsr.s .UpdateColour
  3003. dbf d0,.nextcolour
  3004.  
  3005. ; Notice how this one lacks a check for
  3006. ; if Water_flag is set, unlike Pal_FadeFromBlack?
  3007.  
  3008. ; Update underwater palette
  3009. moveq #0,d0
  3010. lea (Underwater_palette).w,a0
  3011. move.b (Palette_fade_start).w,d0
  3012. adda.w d0,a0
  3013.  
  3014. move.b (Palette_fade_length).w,d0
  3015. .nextcolour2:
  3016. bsr.s .UpdateColour
  3017. dbf d0,.nextcolour2
  3018.  
  3019. rts
  3020.  
  3021. ; ---------------------------------------------------------------------------
  3022. ; Subroutine to update a single colour once
  3023. ; ---------------------------------------------------------------------------
  3024. ; sub_24B8: Pal_DecColor:
  3025. .UpdateColour:
  3026. move.w (a0),d2
  3027. beq.s .updatenone
  3028. ;.updatered:
  3029. move.w d2,d1
  3030. andi.w #$E,d1
  3031. beq.s .updategreen
  3032. subq.w #2,(a0)+ ; decrease red value
  3033. rts
  3034.  
  3035. ; loc_24C8: Pal_DecGreen:
  3036. .updategreen:
  3037. move.w d2,d1
  3038. andi.w #$E0,d1
  3039. beq.s .updateblue
  3040. subi.w #$20,(a0)+ ; decrease green value
  3041. rts
  3042.  
  3043. ; loc_24D6: Pal_DecBlue:
  3044. .updateblue:
  3045. move.w d2,d1
  3046. andi.w #$E00,d1
  3047. beq.s .updatenone
  3048. subi.w #$200,(a0)+ ; decrease blue value
  3049. rts
  3050.  
  3051. ; loc_24E4: Pal_DecNone:
  3052. .updatenone:
  3053. addq.w #2,a0
  3054. rts
  3055.  
  3056.  
  3057. ; ---------------------------------------------------------------------------
  3058. ; Subroutine to fade in from white
  3059. ; ---------------------------------------------------------------------------
  3060.  
  3061. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3062.  
  3063. ; sub_24E8: Pal_MakeWhite:
  3064. Pal_FadeFromWhite:
  3065. move.w #$3F,(Palette_fade_range).w
  3066. moveq #0,d0
  3067. lea (Normal_palette).w,a0
  3068. move.b (Palette_fade_start).w,d0
  3069. adda.w d0,a0
  3070. move.w #$EEE,d1
  3071.  
  3072. move.b (Palette_fade_length).w,d0
  3073. .palettewrite:
  3074. move.w d1,(a0)+
  3075. dbf d0,.palettewrite
  3076.  
  3077. move.w #$15,d4
  3078. .nextframe:
  3079. move.b #VintID_Fade,(Vint_routine).w
  3080. bsr.w WaitForVint
  3081. bsr.s .UpdateAllColours
  3082. bsr.w RunPLC_RAM
  3083. dbf d4,.nextframe
  3084.  
  3085. rts
  3086. ; End of function Pal_FadeFromWhite
  3087.  
  3088. ; ---------------------------------------------------------------------------
  3089. ; Subroutine to update all colours once
  3090. ; ---------------------------------------------------------------------------
  3091. ; sub_2522: Pal_WhiteToBlack:
  3092. .UpdateAllColours:
  3093. ; Update above-water palette
  3094. moveq #0,d0
  3095. lea (Normal_palette).w,a0
  3096. lea (Target_palette).w,a1
  3097. move.b (Palette_fade_start).w,d0
  3098. adda.w d0,a0
  3099. adda.w d0,a1
  3100.  
  3101. move.b (Palette_fade_length).w,d0
  3102. .nextcolour:
  3103. bsr.s .UpdateColour
  3104. dbf d0,.nextcolour
  3105.  
  3106. tst.b (Water_flag).w
  3107. beq.s .skipunderwater
  3108. ; Update underwater palette
  3109. moveq #0,d0
  3110. lea (Underwater_palette).w,a0
  3111. lea (Underwater_target_palette).w,a1
  3112. move.b (Palette_fade_start).w,d0
  3113. adda.w d0,a0
  3114. adda.w d0,a1
  3115.  
  3116. move.b (Palette_fade_length).w,d0
  3117. .nextcolour2:
  3118. bsr.s .UpdateColour
  3119. dbf d0,.nextcolour2
  3120.  
  3121. .skipunderwater:
  3122. rts
  3123.  
  3124. ; ---------------------------------------------------------------------------
  3125. ; Subroutine to update a single colour once
  3126. ; ---------------------------------------------------------------------------
  3127. ; sub_2562: Pal_DecColor2:
  3128. .UpdateColour:
  3129. move.w (a1)+,d2
  3130. move.w (a0),d3
  3131. cmp.w d2,d3
  3132. beq.s .updatenone
  3133. ;.updateblue:
  3134. move.w d3,d1
  3135. subi.w #$200,d1 ; decrease blue value
  3136. bcs.s .updategreen
  3137. cmp.w d2,d1
  3138. blo.s .updategreen
  3139. move.w d1,(a0)+
  3140. rts
  3141.  
  3142. ; loc_257A: Pal_DecGreen2:
  3143. .updategreen:
  3144. move.w d3,d1
  3145. subi.w #$20,d1 ; decrease green value
  3146. bcs.s .updatered
  3147. cmp.w d2,d1
  3148. blo.s .updatered
  3149. move.w d1,(a0)+
  3150. rts
  3151.  
  3152. ; loc_258A: Pal_DecRed2:
  3153. .updatered:
  3154. subq.w #2,(a0)+ ; decrease red value
  3155. rts
  3156.  
  3157. ; loc_258E: Pal_DecNone2:
  3158. .updatenone:
  3159. addq.w #2,a0
  3160. rts
  3161.  
  3162.  
  3163. ; ---------------------------------------------------------------------------
  3164. ; Subroutine to fade out to white (used when you enter a special stage)
  3165. ; ---------------------------------------------------------------------------
  3166.  
  3167. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3168.  
  3169. ; sub_2592: Pal_MakeFlash:
  3170. Pal_FadeToWhite:
  3171. move.w #$3F,(Palette_fade_range).w
  3172.  
  3173. move.w #$15,d4
  3174. .nextframe:
  3175. move.b #VintID_Fade,(Vint_routine).w
  3176. bsr.w WaitForVint
  3177. bsr.s .UpdateAllColours
  3178. bsr.w RunPLC_RAM
  3179. dbf d4,.nextframe
  3180.  
  3181. rts
  3182. ; End of function Pal_FadeToWhite
  3183.  
  3184. ; ---------------------------------------------------------------------------
  3185. ; Subroutine to update all colours once
  3186. ; ---------------------------------------------------------------------------
  3187. ; sub_25B2: Pal_ToWhite:
  3188. .UpdateAllColours:
  3189. ; Update above-water palette
  3190. moveq #0,d0
  3191. lea (Normal_palette).w,a0
  3192. move.b (Palette_fade_start).w,d0
  3193. adda.w d0,a0
  3194.  
  3195. move.b (Palette_fade_length).w,d0
  3196. .nextcolour:
  3197. bsr.s .UpdateColour
  3198. dbf d0,.nextcolour
  3199.  
  3200. ; Notice how this one lacks a check for
  3201. ; if Water_flag is set, unlike Pal_FadeFromWhite?
  3202.  
  3203. ; Update underwater palette
  3204. moveq #0,d0
  3205. lea (Underwater_palette).w,a0
  3206. move.b (Palette_fade_start).w,d0
  3207. adda.w d0,a0
  3208.  
  3209. move.b (Palette_fade_length).w,d0
  3210. .nextcolour2:
  3211. bsr.s .UpdateColour
  3212. dbf d0,.nextcolour2
  3213.  
  3214. rts
  3215.  
  3216. ; ---------------------------------------------------------------------------
  3217. ; Subroutine to update a single colour once
  3218. ; ---------------------------------------------------------------------------
  3219. ; sub_25E0: Pal_AddColor2:
  3220. .UpdateColour:
  3221. move.w (a0),d2
  3222. cmpi.w #$EEE,d2
  3223. beq.s .updatenone
  3224. ;.updatered:
  3225. move.w d2,d1
  3226. andi.w #$E,d1
  3227. cmpi.w #$E,d1
  3228. beq.s .updategreen
  3229. addq.w #2,(a0)+ ; increase red value
  3230. rts
  3231.  
  3232. ; loc_25F8: Pal_AddGreen2:
  3233. .updategreen:
  3234. move.w d2,d1
  3235. andi.w #$E0,d1
  3236. cmpi.w #$E0,d1
  3237. beq.s .updateblue
  3238. addi.w #$20,(a0)+ ; increase green value
  3239. rts
  3240.  
  3241. ; loc_260A: Pal_AddBlue2:
  3242. .updateblue:
  3243. move.w d2,d1
  3244. andi.w #$E00,d1
  3245. cmpi.w #$E00,d1
  3246. beq.s .updatenone
  3247. addi.w #$200,(a0)+ ; increase blue value
  3248. rts
  3249.  
  3250. ; loc_261C: Pal_AddNone2:
  3251. .updatenone:
  3252. addq.w #2,a0
  3253. rts
  3254. ; End of function Pal_AddColor2
  3255.  
  3256.  
  3257. ; Unused - dead code/data for old SEGA screen:
  3258.  
  3259. ; ===========================================================================
  3260. ; PalCycle_Sega:
  3261. tst.b (PalCycle_Timer+1).w
  3262. bne.s loc_2680
  3263. lea (Normal_palette_line2).w,a1
  3264. lea (Pal_Sega1).l,a0
  3265. moveq #5,d1
  3266. move.w (PalCycle_Frame).w,d0
  3267.  
  3268. loc_2636:
  3269. bpl.s loc_2640
  3270. addq.w #2,a0
  3271. subq.w #1,d1
  3272. addq.w #2,d0
  3273. bra.s loc_2636
  3274. ; ===========================================================================
  3275.  
  3276. loc_2640:
  3277. move.w d0,d2
  3278. andi.w #$1E,d2
  3279. bne.s loc_264A
  3280. addq.w #2,d0
  3281.  
  3282. loc_264A:
  3283. cmpi.w #$60,d0
  3284. bhs.s loc_2654
  3285. move.w (a0)+,(a1,d0.w)
  3286.  
  3287. loc_2654:
  3288. addq.w #2,d0
  3289. dbf d1,loc_2640
  3290. move.w (PalCycle_Frame).w,d0
  3291. addq.w #2,d0
  3292. move.w d0,d2
  3293. andi.w #$1E,d2
  3294. bne.s loc_266A
  3295. addq.w #2,d0
  3296.  
  3297. loc_266A:
  3298. cmpi.w #$64,d0
  3299. blt.s loc_2678
  3300. move.w #$401,(PalCycle_Timer).w
  3301. moveq #-$C,d0
  3302.  
  3303. loc_2678:
  3304. move.w d0,(PalCycle_Frame).w
  3305. moveq #1,d0
  3306. rts
  3307. ; ===========================================================================
  3308.  
  3309. loc_2680:
  3310. subq.b #1,(PalCycle_Timer).w
  3311. bpl.s loc_26D2
  3312. move.b #4,(PalCycle_Timer).w
  3313. move.w (PalCycle_Frame).w,d0
  3314. addi.w #$C,d0
  3315. cmpi.w #$30,d0
  3316. blo.s loc_269E
  3317. moveq #0,d0
  3318. rts
  3319. ; ===========================================================================
  3320.  
  3321. loc_269E:
  3322. move.w d0,(PalCycle_Frame).w
  3323. lea (Pal_Sega2).l,a0
  3324. lea (a0,d0.w),a0
  3325. lea (Normal_palette+4).w,a1
  3326. move.l (a0)+,(a1)+
  3327. move.l (a0)+,(a1)+
  3328. move.w (a0)+,(a1)
  3329. lea (Normal_palette_line2).w,a1
  3330. moveq #0,d0
  3331. moveq #$2C,d1
  3332.  
  3333. loc_26BE:
  3334. move.w d0,d2
  3335. andi.w #$1E,d2
  3336. bne.s loc_26C8
  3337. addq.w #2,d0
  3338.  
  3339. loc_26C8:
  3340. move.w (a0),(a1,d0.w)
  3341. addq.w #2,d0
  3342. dbf d1,loc_26BE
  3343.  
  3344. loc_26D2:
  3345. moveq #1,d0
  3346. rts
  3347.  
  3348. ; ===========================================================================
  3349. ;----------------------------------------------------------------------------
  3350. ; Unused palette for the Sega logo
  3351. ;----------------------------------------------------------------------------
  3352. ; Pal_26D6:
  3353. Pal_Sega1: BINCLUDE "art/palettes/Unused Sega logo.bin"
  3354. ;----------------------------------------------------------------------------
  3355. ; Unused palette for the Sega logo (fading?)
  3356. ;----------------------------------------------------------------------------
  3357. ; Pal_26E2:
  3358. Pal_Sega2: BINCLUDE "art/palettes/Unused Sega logo 2.bin"
  3359.  
  3360. ; end of dead code/data
  3361.  
  3362. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3363.  
  3364. ; sub_2712: PalLoad1:
  3365. PalLoad_ForFade:
  3366. lea (PalPointers).l,a1
  3367. lsl.w #3,d0
  3368. adda.w d0,a1
  3369. movea.l (a1)+,a2
  3370. movea.w (a1)+,a3
  3371. adda.w #Target_palette-Normal_palette,a3
  3372.  
  3373. move.w (a1)+,d7
  3374. - move.l (a2)+,(a3)+
  3375. dbf d7,-
  3376.  
  3377. rts
  3378. ; End of function PalLoad_ForFade
  3379.  
  3380.  
  3381. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3382.  
  3383. ; sub_272E: PalLoad2:
  3384. PalLoad_Now:
  3385. lea (PalPointers).l,a1
  3386. lsl.w #3,d0
  3387. adda.w d0,a1
  3388. movea.l (a1)+,a2
  3389. movea.w (a1)+,a3
  3390.  
  3391. move.w (a1)+,d7
  3392. - move.l (a2)+,(a3)+
  3393. dbf d7,-
  3394.  
  3395. rts
  3396. ; End of function PalLoad_Now
  3397.  
  3398.  
  3399. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3400.  
  3401. ; sub_2746: PalLoad3_Water:
  3402. PalLoad_Water_Now:
  3403. lea (PalPointers).l,a1
  3404. lsl.w #3,d0
  3405. adda.w d0,a1
  3406. movea.l (a1)+,a2
  3407. movea.w (a1)+,a3
  3408. suba.l #Normal_palette-Underwater_palette,a3
  3409.  
  3410. move.w (a1)+,d7
  3411. - move.l (a2)+,(a3)+
  3412. dbf d7,-
  3413.  
  3414. rts
  3415. ; End of function PalLoad_Water_Now
  3416.  
  3417.  
  3418. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3419.  
  3420. ; sub_2764: PalLoad4_Water:
  3421. PalLoad_Water_ForFade:
  3422. lea (PalPointers).l,a1
  3423. lsl.w #3,d0
  3424. adda.w d0,a1
  3425. movea.l (a1)+,a2
  3426. movea.w (a1)+,a3
  3427. suba.l #Normal_palette-Underwater_target_palette,a3
  3428.  
  3429. move.w (a1)+,d7
  3430. - move.l (a2)+,(a3)+
  3431. dbf d7,-
  3432.  
  3433. rts
  3434. ; End of function PalLoad_Water_ForFade
  3435.  
  3436. ; ===========================================================================
  3437. ;----------------------------------------------------------------------------
  3438. ; Palette pointers
  3439. ; (PALETTE DESCRIPTOR ARRAY)
  3440. ; This struct array defines the palette to use for each level.
  3441. ;----------------------------------------------------------------------------
  3442.  
  3443. palptr macro ptr,lineno
  3444. dc.l ptr ; Pointer to palette
  3445. dc.w (Normal_palette+lineno*palette_line_size)&$FFFF ; Location in ram to load palette into
  3446. dc.w bytesToLcnt(ptr_End-ptr) ; Size of palette in (bytes / 4)
  3447. endm
  3448.  
  3449. PalPointers:
  3450. PalPtr_SEGA: palptr Pal_SEGA, 0
  3451. PalPtr_Title: palptr Pal_Title, 1
  3452. PalPtr_MenuB: palptr Pal_MenuB, 0
  3453. PalPtr_BGND: palptr Pal_BGND, 0
  3454. PalPtr_EHZ: palptr Pal_EHZ, 1
  3455. PalPtr_EHZ2: palptr Pal_EHZ, 1
  3456. PalPtr_WZ: palptr Pal_WZ, 1
  3457. PalPtr_EHZ3: palptr Pal_EHZ, 1
  3458. PalPtr_MTZ: palptr Pal_MTZ, 1
  3459. PalPtr_MTZ2: palptr Pal_MTZ, 1
  3460. PalPtr_WFZ: palptr Pal_WFZ, 1
  3461. PalPtr_HTZ: palptr Pal_HTZ, 1
  3462. PalPtr_HPZ: palptr Pal_HPZ, 1
  3463. PalPtr_EHZ4: palptr Pal_EHZ, 1
  3464. PalPtr_OOZ: palptr Pal_OOZ, 1
  3465. PalPtr_MCZ: palptr Pal_MCZ, 1
  3466. PalPtr_CNZ: palptr Pal_CNZ, 1
  3467. PalPtr_CPZ: palptr Pal_CPZ, 1
  3468. PalPtr_DEZ: palptr Pal_DEZ, 1
  3469. PalPtr_ARZ: palptr Pal_ARZ, 1
  3470. PalPtr_SCZ: palptr Pal_SCZ, 1
  3471. PalPtr_HPZ_U: palptr Pal_HPZ_U, 0
  3472. PalPtr_CPZ_U: palptr Pal_CPZ_U, 0
  3473. PalPtr_ARZ_U: palptr Pal_ARZ_U, 0
  3474. PalPtr_SS: palptr Pal_SS, 0
  3475. PalPtr_MCZ_B: palptr Pal_MCZ_B, 1
  3476. PalPtr_CNZ_B: palptr Pal_CNZ_B, 1
  3477. PalPtr_SS1: palptr Pal_SS1, 3
  3478. PalPtr_SS2: palptr Pal_SS2, 3
  3479. PalPtr_SS3: palptr Pal_SS3, 3
  3480. PalPtr_SS4: palptr Pal_SS4, 3
  3481. PalPtr_SS5: palptr Pal_SS5, 3
  3482. PalPtr_SS6: palptr Pal_SS6, 3
  3483. PalPtr_SS7: palptr Pal_SS7, 3
  3484. PalPtr_SS1_2p: palptr Pal_SS1_2p,3
  3485. PalPtr_SS2_2p: palptr Pal_SS2_2p,3
  3486. PalPtr_SS3_2p: palptr Pal_SS3_2p,3
  3487. PalPtr_OOZ_B: palptr Pal_OOZ_B, 1
  3488. PalPtr_Menu: palptr Pal_Menu, 0
  3489. PalPtr_Result: palptr Pal_Result,0
  3490.  
  3491. ; ----------------------------------------------------------------------------
  3492. ; This macro defines Pal_ABC and Pal_ABC_End, so palptr can compute the size of
  3493. ; the palette automatically
  3494. ; path2 is used for the Sonic and Tails palette, which has 2 palette lines
  3495. palette macro {INTLABEL},path,path2
  3496. __LABEL__ label *
  3497. BINCLUDE "art/palettes/path"
  3498. if "path2"<>""
  3499. BINCLUDE "art/palettes/path2"
  3500. endif
  3501. __LABEL___End label *
  3502. endm
  3503.  
  3504. Pal_SEGA: palette Sega screen.bin ; SEGA screen palette (Sonic and initial background)
  3505. Pal_Title: palette Title screen.bin ; Title screen Palette
  3506. Pal_MenuB: palette S2B Level Select.bin ; Leftover S2B level select palette
  3507. Pal_BGND: palette SonicAndTails.bin,SonicAndTails2.bin ; "Sonic and Miles" background palette (also usually the primary palette line)
  3508. Pal_EHZ: palette EHZ.bin ; Emerald Hill Zone palette
  3509. Pal_WZ: palette Wood Zone.bin ; Wood Zone palette
  3510. Pal_MTZ: palette MTZ.bin ; Metropolis Zone palette
  3511. Pal_WFZ: palette WFZ.bin ; Wing Fortress Zone palette
  3512. Pal_HTZ: palette HTZ.bin ; Hill Top Zone palette
  3513. Pal_HPZ: palette HPZ.bin ; Hidden Palace Zone palette
  3514. Pal_HPZ_U: palette HPZ underwater.bin ; Hidden Palace Zone underwater palette
  3515. Pal_OOZ: palette OOZ.bin ; Oil Ocean Zone palette
  3516. Pal_MCZ: palette MCZ.bin ; Mystic Cave Zone palette
  3517. Pal_CNZ: palette CNZ.bin ; Casino Night Zone palette
  3518. Pal_CPZ: palette CPZ.bin ; Chemical Plant Zone palette
  3519. Pal_CPZ_U: palette CPZ underwater.bin ; Chemical Plant Zone underwater palette
  3520. Pal_DEZ: palette DEZ.bin ; Death Egg Zone palette
  3521. Pal_ARZ: palette ARZ.bin ; Aquatic Ruin Zone palette
  3522. Pal_ARZ_U: palette ARZ underwater.bin ; Aquatic Ruin Zone underwater palette
  3523. Pal_SCZ: palette SCZ.bin ; Sky Chase Zone palette
  3524. Pal_MCZ_B: palette MCZ Boss.bin ; Mystic Cave Zone boss palette
  3525. Pal_CNZ_B: palette CNZ Boss.bin ; Casino Night Zone boss palette
  3526. Pal_OOZ_B: palette OOZ Boss.bin ; Oil Ocean Zone boss palette
  3527. Pal_Menu: palette Menu.bin ; Menu palette
  3528. Pal_SS: palette Special Stage Main.bin ; Special Stage palette
  3529. Pal_SS1: palette Special Stage 1.bin ; Special Stage 1 palette
  3530. Pal_SS2: palette Special Stage 2.bin ; Special Stage 2 palette
  3531. Pal_SS3: palette Special Stage 3.bin ; Special Stage 3 palette
  3532. Pal_SS4: palette Special Stage 4.bin ; Special Stage 4 palette
  3533. Pal_SS5: palette Special Stage 5.bin ; Special Stage 5 palette
  3534. Pal_SS6: palette Special Stage 6.bin ; Special Stage 6 palette
  3535. Pal_SS7: palette Special Stage 7.bin ; Special Stage 7 palette
  3536. Pal_SS1_2p:palette Special Stage 1 2p.bin ; Special Stage 1 2p palette
  3537. Pal_SS2_2p:palette Special Stage 2 2p.bin ; Special Stage 2 2p palette
  3538. Pal_SS3_2p:palette Special Stage 3 2p.bin ; Special Stage 3 2p palette
  3539. Pal_Result:palette Special Stage Results Screen.bin ; Special Stage Results Screen palette
  3540. ; ===========================================================================
  3541.  
  3542. if gameRevision<2
  3543. nop
  3544. endif
  3545.  
  3546.  
  3547.  
  3548.  
  3549. ; ---------------------------------------------------------------------------
  3550. ; Subroutine to perform vertical synchronization
  3551. ; ---------------------------------------------------------------------------
  3552.  
  3553. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3554.  
  3555. ; sub_3384: DelayProgram:
  3556. WaitForVint:
  3557. move #$2300,sr
  3558.  
  3559. - tst.b (Vint_routine).w
  3560. bne.s -
  3561. rts
  3562. ; End of function WaitForVint
  3563.  
  3564.  
  3565. ; ---------------------------------------------------------------------------
  3566. ; Subroutine to generate a pseudo-random number in d0
  3567. ; d0 = (RNG & $FFFF0000) | ((RNG*41 & $FFFF) + ((RNG*41 & $FFFF0000) >> 16))
  3568. ; RNG = ((RNG*41 + ((RNG*41 & $FFFF) << 16)) & $FFFF0000) | (RNG*41 & $FFFF)
  3569. ; ---------------------------------------------------------------------------
  3570.  
  3571. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3572.  
  3573. ; sub_3390:
  3574. RandomNumber:
  3575. move.l (RNG_seed).w,d1
  3576. bne.s +
  3577. move.l #$2A6D365A,d1 ; if the RNG is 0, reset it to this crazy number
  3578.  
  3579. ; set the high word of d0 to be the high word of the RNG
  3580. ; and multiply the RNG by 41
  3581. + move.l d1,d0
  3582. asl.l #2,d1
  3583. add.l d0,d1
  3584. asl.l #3,d1
  3585. add.l d0,d1
  3586.  
  3587. ; add the low word of the RNG to the high word of the RNG
  3588. ; and set the low word of d0 to be the result
  3589. move.w d1,d0
  3590. swap d1
  3591. add.w d1,d0
  3592. move.w d0,d1
  3593. swap d1
  3594.  
  3595. move.l d1,(RNG_seed).w
  3596. rts
  3597. ; End of function RandomNumber
  3598.  
  3599.  
  3600. ; ---------------------------------------------------------------------------
  3601. ; Subroutine to calculate sine and cosine of an angle
  3602. ; d0 = input byte = angle (360 degrees == 256)
  3603. ; d0 = output word = 255 * sine(angle)
  3604. ; d1 = output word = 255 * cosine(angle)
  3605. ; ---------------------------------------------------------------------------
  3606.  
  3607. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3608.  
  3609. ; sub_33B6:
  3610. CalcSine:
  3611. andi.w #$FF,d0
  3612. add.w d0,d0
  3613. addi.w #$80,d0
  3614. move.w Sine_Data(pc,d0.w),d1 ; cos
  3615. subi.w #$80,d0
  3616. move.w Sine_Data(pc,d0.w),d0 ; sin
  3617. rts
  3618. ; End of function CalcSine
  3619.  
  3620. ; ===========================================================================
  3621. ; word_33CE:
  3622. Sine_Data: BINCLUDE "misc/sinewave.bin"
  3623.  
  3624.  
  3625. ; ---------------------------------------------------------------------------
  3626. ; Subroutine to calculate arctangent of y/x
  3627. ; d1 = input x
  3628. ; d2 = input y
  3629. ; d0 = output angle (360 degrees == 256)
  3630. ; ---------------------------------------------------------------------------
  3631.  
  3632. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3633.  
  3634. ; sub_364E:
  3635. CalcAngle:
  3636. movem.l d3-d4,-(sp)
  3637. moveq #0,d3
  3638. moveq #0,d4
  3639. move.w d1,d3
  3640. move.w d2,d4
  3641. or.w d3,d4
  3642. beq.s CalcAngle_Zero ; special case return if x and y are both 0
  3643. move.w d2,d4
  3644.  
  3645. absw.w d3 ; calculate absolute value of x
  3646. absw.w d4 ; calculate absolute value of y
  3647. cmp.w d3,d4
  3648. bhs.w +
  3649. lsl.l #8,d4
  3650. divu.w d3,d4
  3651. moveq #0,d0
  3652. move.b Angle_Data(pc,d4.w),d0
  3653. bra.s ++
  3654. +
  3655. lsl.l #8,d3
  3656. divu.w d4,d3
  3657. moveq #$40,d0
  3658. sub.b Angle_Data(pc,d3.w),d0
  3659. +
  3660. tst.w d1
  3661. bpl.w +
  3662. neg.w d0
  3663. addi.w #$80,d0
  3664. +
  3665. tst.w d2
  3666. bpl.w +
  3667. neg.w d0
  3668. addi.w #$100,d0
  3669. +
  3670. movem.l (sp)+,d3-d4
  3671. rts
  3672. ; ===========================================================================
  3673. ; loc_36AA:
  3674. CalcAngle_Zero:
  3675. move.w #$40,d0
  3676. movem.l (sp)+,d3-d4
  3677. rts
  3678. ; End of function CalcAngle
  3679.  
  3680. ; ===========================================================================
  3681. ; byte_36B4:
  3682. Angle_Data: BINCLUDE "misc/angles.bin"
  3683.  
  3684. ; ===========================================================================
  3685.  
  3686. if gameRevision<2
  3687. nop
  3688. endif
  3689.  
  3690.  
  3691.  
  3692.  
  3693. ; loc_37B8:
  3694. SegaScreen:
  3695. move.b #MusID_Stop,d0
  3696. bsr.w PlayMusic ; stop music
  3697. bsr.w ClearPLC
  3698. bsr.w Pal_FadeToBlack
  3699.  
  3700. clearRAM Misc_Variables,Misc_Variables_End
  3701.  
  3702. clearRAM SegaScr_Object_RAM,SegaScr_Object_RAM_End ; fill object RAM with 0
  3703.  
  3704. lea (VDP_control_port).l,a6
  3705. move.w #$8004,(a6) ; H-INT disabled
  3706. move.w #$8200|(VRAM_SegaScr_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  3707. move.w #$8400|(VRAM_SegaScr_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $A000
  3708. move.w #$8700,(a6) ; Background palette/color: 0/0
  3709. move.w #$8B03,(a6) ; EXT-INT disabled, V scroll by screen, H scroll by line
  3710. move.w #$8C81,(a6) ; H res 40 cells, no interlace, S/H disabled
  3711. move.w #$9003,(a6) ; Scroll table size: 128x32 ($2000 bytes)
  3712. clr.b (Water_fullscreen_flag).w
  3713. clr.w (Two_player_mode).w
  3714. move #$2700,sr
  3715. move.w (VDP_Reg1_val).w,d0
  3716. andi.b #$BF,d0
  3717. move.w d0,(VDP_control_port).l
  3718. bsr.w ClearScreen
  3719.  
  3720. dmaFillVRAM 0,VRAM_SegaScr_Plane_A_Name_Table,VRAM_SegaScr_Plane_Table_Size ; clear Plane A pattern name table
  3721.  
  3722. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Sega_Logo),VRAM,WRITE),(VDP_control_port).l
  3723. lea (ArtNem_SEGA).l,a0
  3724. bsr.w NemDec
  3725. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Trails),VRAM,WRITE),(VDP_control_port).l
  3726. lea (ArtNem_IntroTrails).l,a0
  3727. bsr.w NemDec
  3728. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtUnc_Giant_Sonic),VRAM,WRITE),(VDP_control_port).l
  3729. lea (ArtNem_SilverSonic).l,a0 ; ?? seems unused here
  3730. bsr.w NemDec
  3731. lea (Chunk_Table).l,a1
  3732. lea (MapEng_SEGA).l,a0
  3733. move.w #make_art_tile(ArtTile_VRAM_Start,0,0),d0
  3734. bsr.w EniDec
  3735. lea (Chunk_Table).l,a1
  3736. move.l #vdpComm(VRAM_SegaScr_Plane_B_Name_Table,VRAM,WRITE),d0
  3737. moveq #$27,d1 ; 40 cells wide
  3738. moveq #$1B,d2 ; 28 cells tall
  3739. bsr.w PlaneMapToVRAM_H80_Sega
  3740. tst.b (Graphics_Flags).w ; are we on a Japanese Mega Drive?
  3741. bmi.s SegaScreen_Contin ; if not, branch
  3742. ; load an extra sprite to hide the TM (trademark) symbol on the SEGA screen
  3743. lea (SegaHideTM).w,a1
  3744. move.b #ObjID_SegaHideTM,id(a1) ; load objB1 at $FFFFB080
  3745. move.b #$4E,subtype(a1) ; <== ObjB1_SubObjData
  3746. ; loc_38CE:
  3747. SegaScreen_Contin:
  3748. moveq #PalID_SEGA,d0
  3749. bsr.w PalLoad_Now
  3750. move.w #-$A,(PalCycle_Frame).w
  3751. move.w #0,(PalCycle_Timer).w
  3752. move.w #0,(SegaScr_VInt_Subrout).w
  3753. move.w #0,(SegaScr_PalDone_Flag).w
  3754. lea (SegaScreenObject).w,a1
  3755. move.b #ObjID_SonicOnSegaScr,id(a1) ; load objB0 (sega screen?) at $FFFFB040
  3756. move.b #$4C,subtype(a1) ; <== ObjB0_SubObjData
  3757. move.w #4*60,(Demo_Time_left).w ; 4 seconds
  3758. move.w (VDP_Reg1_val).w,d0
  3759. ori.b #$40,d0
  3760. move.w d0,(VDP_control_port).l
  3761. ; loc_390E:
  3762. Sega_WaitPalette:
  3763. move.b #VintID_SEGA,(Vint_routine).w
  3764. bsr.w WaitForVint
  3765. jsrto (RunObjects).l, JmpTo_RunObjects
  3766. jsr (BuildSprites).l
  3767. tst.b (SegaScr_PalDone_Flag).w
  3768. beq.s Sega_WaitPalette
  3769. move.b #SndID_SegaSound,d0
  3770. bsr.w PlaySound ; play "SEGA" sound
  3771. move.b #VintID_SEGA,(Vint_routine).w
  3772. bsr.w WaitForVint
  3773. move.w #3*60,(Demo_Time_left).w ; 3 seconds
  3774. ; loc_3940:
  3775. Sega_WaitEnd:
  3776. move.b #VintID_PCM,(Vint_routine).w
  3777. bsr.w WaitForVint
  3778. tst.w (Demo_Time_left).w
  3779. beq.s Sega_GotoTitle
  3780. move.b (Ctrl_1_Press).w,d0 ; is Start button pressed?
  3781. or.b (Ctrl_2_Press).w,d0 ; (either player)
  3782. andi.b #button_start_mask,d0
  3783. beq.s Sega_WaitEnd ; if not, branch
  3784. ; loc_395E:
  3785. Sega_GotoTitle:
  3786. clr.w (SegaScr_PalDone_Flag).w
  3787. clr.w (SegaScr_VInt_Subrout).w
  3788. move.b #GameModeID_TitleScreen,(Game_Mode).w ; => TitleScreen
  3789. rts
  3790.  
  3791. ; ---------------------------------------------------------------------------
  3792. ; Subroutine that does the exact same thing as PlaneMapToVRAM_H80_SpecialStage
  3793. ; (this one is used at the Sega screen)
  3794. ; ---------------------------------------------------------------------------
  3795.  
  3796. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  3797.  
  3798. ; sub_396E: ShowVDPGraphics3: PlaneMapToVRAM3:
  3799. PlaneMapToVRAM_H80_Sega:
  3800. lea (VDP_data_port).l,a6
  3801. move.l #vdpCommDelta(planeLocH80(0,1)),d4 ; $1000000
  3802. - move.l d0,VDP_control_port-VDP_data_port(a6)
  3803. move.w d1,d3
  3804. - move.w (a1)+,(a6)
  3805. dbf d3,-
  3806. add.l d4,d0
  3807. dbf d2,--
  3808. rts
  3809. ; End of function PlaneMapToVRAM_H80_Sega
  3810.  
  3811. ; ===========================================================================
  3812.  
  3813. if gameRevision<2
  3814. nop
  3815. endif
  3816.  
  3817. if ~~removeJmpTos
  3818. ; sub_3990:
  3819. JmpTo_RunObjects
  3820. jmp (RunObjects).l
  3821.  
  3822. align 4
  3823. endif
  3824.  
  3825.  
  3826.  
  3827.  
  3828. ; ===========================================================================
  3829. ; loc_3998:
  3830. TitleScreen:
  3831. move.b #MusID_Stop,d0
  3832. bsr.w PlayMusic
  3833. bsr.w ClearPLC
  3834. bsr.w Pal_FadeToBlack
  3835. move #$2700,sr
  3836. lea (VDP_control_port).l,a6
  3837. move.w #$8004,(a6) ; H-INT disabled
  3838. move.w #$8200|(VRAM_TtlScr_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  3839. move.w #$8400|(VRAM_TtlScr_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $E000
  3840. move.w #$9001,(a6) ; Scroll table size: 64x32
  3841. move.w #$9200,(a6) ; Disable window
  3842. move.w #$8B03,(a6) ; EXT-INT disabled, V scroll by screen, H scroll by line
  3843. move.w #$8720,(a6) ; Background palette/color: 2/0
  3844. clr.b (Water_fullscreen_flag).w
  3845. move.w #$8C81,(a6) ; H res 40 cells, no interlace, S/H disabled
  3846. bsr.w ClearScreen
  3847.  
  3848. clearRAM Sprite_Table_Input,Sprite_Table_Input_End ; fill $AC00-$AFFF with $0
  3849. clearRAM TtlScr_Object_RAM,TtlScr_Object_RAM_End ; fill object RAM ($B000-$D5FF) with $0
  3850. clearRAM Misc_Variables,Misc_Variables_End ; clear CPU player RAM and following variables
  3851. clearRAM Camera_RAM,Camera_RAM_End ; clear camera RAM and following variables
  3852.  
  3853. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_CreditText),VRAM,WRITE),(VDP_control_port).l
  3854. lea (ArtNem_CreditText).l,a0
  3855. bsr.w NemDec
  3856. lea (off_B2B0).l,a1
  3857. jsr (loc_B272).l
  3858.  
  3859. clearRAM Target_palette,Target_palette_End ; fill palette with 0 (black)
  3860. moveq #PalID_BGND,d0
  3861. bsr.w PalLoad_ForFade
  3862. bsr.w Pal_FadeFromBlack
  3863. move #$2700,sr
  3864. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Title),VRAM,WRITE),(VDP_control_port).l
  3865. lea (ArtNem_Title).l,a0
  3866. bsr.w NemDec
  3867. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_TitleSprites),VRAM,WRITE),(VDP_control_port).l
  3868. lea (ArtNem_TitleSprites).l,a0
  3869. bsr.w NemDec
  3870. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_MenuJunk),VRAM,WRITE),(VDP_control_port).l
  3871. lea (ArtNem_MenuJunk).l,a0
  3872. bsr.w NemDec
  3873. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Player1VS2),VRAM,WRITE),(VDP_control_port).l
  3874. lea (ArtNem_Player1VS2).l,a0
  3875. bsr.w NemDec
  3876. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_FontStuff_TtlScr),VRAM,WRITE),(VDP_control_port).l
  3877. lea (ArtNem_FontStuff).l,a0
  3878. bsr.w NemDec
  3879. move.b #0,(Last_star_pole_hit).w
  3880. move.b #0,(Last_star_pole_hit_2P).w
  3881. move.w #0,(Debug_placement_mode).w
  3882. move.w #0,(Demo_mode_flag).w
  3883. move.w #0,(unk_FFDA).w
  3884. move.w #0,(PalCycle_Timer).w
  3885. move.w #0,(Two_player_mode).w
  3886. move.b #0,(Level_started_flag).w
  3887. bsr.w Pal_FadeToBlack
  3888. move #$2700,sr
  3889. lea (Chunk_Table).l,a1
  3890. lea (MapEng_TitleScreen).l,a0
  3891. move.w #make_art_tile(ArtTile_ArtNem_Title,2,0),d0
  3892. bsr.w EniDec
  3893. lea (Chunk_Table).l,a1
  3894. move.l #vdpComm(VRAM_TtlScr_Plane_B_Name_Table,VRAM,WRITE),d0
  3895. moveq #$27,d1
  3896. moveq #$1B,d2
  3897. jsrto (PlaneMapToVRAM_H40).l, PlaneMapToVRAM_H40
  3898. lea (Chunk_Table).l,a1
  3899. lea (MapEng_TitleBack).l,a0
  3900. move.w #make_art_tile(ArtTile_ArtNem_Title,2,0),d0
  3901. bsr.w EniDec
  3902. lea (Chunk_Table).l,a1
  3903. move.l #vdpComm(VRAM_TtlScr_Plane_B_Name_Table + planeLocH40($28,0),VRAM,WRITE),d0
  3904. moveq #$17,d1
  3905. moveq #$1B,d2
  3906. jsrto (PlaneMapToVRAM_H40).l, PlaneMapToVRAM_H40
  3907. lea (Chunk_Table).l,a1
  3908. lea (MapEng_TitleLogo).l,a0
  3909. move.w #make_art_tile(ArtTile_ArtNem_Title,3,1),d0
  3910. bsr.w EniDec
  3911.  
  3912. lea (Chunk_Table+$858).l,a1
  3913. lea (CopyrightText).l,a2
  3914.  
  3915. moveq #bytesToWcnt(CopyrightText_End-CopyrightText),d6
  3916. - move.w (a2)+,(a1)+ ; load mappings for copyright 1992 sega message
  3917. dbf d6,-
  3918.  
  3919. lea (Chunk_Table).l,a1
  3920. move.l #vdpComm(VRAM_TtlScr_Plane_A_Name_Table,VRAM,WRITE),d0
  3921. moveq #$27,d1
  3922. moveq #$1B,d2
  3923. jsrto (PlaneMapToVRAM_H40).l, PlaneMapToVRAM_H40
  3924.  
  3925. clearRAM Normal_palette,Target_palette_End ; fill two palettes with 0 (black)
  3926.  
  3927. moveq #PalID_Title,d0
  3928. bsr.w PalLoad_ForFade
  3929. move.b #0,(Debug_mode_flag).w
  3930. move.w #0,(Two_player_mode).w
  3931. move.w #$280,(Demo_Time_left).w
  3932. clr.w (Ctrl_1).w
  3933. move.b #ObjID_IntroStars,(IntroSonic+id).w ; load Obj0E (flashing intro star)
  3934. move.b #2,(IntroSonic+subtype).w ; Sonic
  3935. jsr (RunObjects).l
  3936. jsr (BuildSprites).l
  3937. moveq #PLCID_Std1,d0
  3938. bsr.w LoadPLC2
  3939. move.w #0,(Correct_cheat_entries).w
  3940. move.w #0,(Correct_cheat_entries_2).w
  3941. nop
  3942. nop
  3943. nop
  3944. nop
  3945. nop
  3946. nop
  3947. move.w #4,(Sonic_Pos_Record_Index).w
  3948. move.w #0,(Sonic_Pos_Record_Buf).w
  3949.  
  3950. lea (Results_Data_2P).w,a1
  3951.  
  3952. moveq #bytesToWcnt(Results_Data_2P_End-Results_Data_2P),d0
  3953. - move.w #-1,(a1)+
  3954. dbf d0,-
  3955.  
  3956. move.w #-$280,(Camera_X_pos).w
  3957. move.w (VDP_Reg1_val).w,d0
  3958. ori.b #$40,d0
  3959. move.w d0,(VDP_control_port).l
  3960. bsr.w Pal_FadeFromBlack
  3961.  
  3962. ; loc_3C14:
  3963. TitleScreen_Loop:
  3964. move.b #VintID_Title,(Vint_routine).w
  3965. bsr.w WaitForVint
  3966. jsr (RunObjects).l
  3967. jsrto (SwScrl_Title).l, JmpTo_SwScrl_Title
  3968. jsr (BuildSprites).l
  3969.  
  3970. ; write alternating 0s and 4s, 80 times, at every 4th word,
  3971. ; starting at Sprite_Table+6
  3972. lea (Sprite_Table+4).w,a1
  3973. moveq #0,d0
  3974.  
  3975. moveq #79,d6
  3976. - tst.w (a1)
  3977. bne.s +
  3978. bchg #2,d0
  3979. move.w d0,2(a1)
  3980. + addq.w #8,a1
  3981. dbf d6,-
  3982.  
  3983. bsr.w RunPLC_RAM
  3984. bsr.w TailsNameCheat
  3985. tst.w (Demo_Time_left).w
  3986. beq.w TitleScreen_Demo
  3987. tst.b (IntroSonic+objoff_2F).w
  3988. beq.w TitleScreen_Loop
  3989. move.b (Ctrl_1_Press).w,d0
  3990. or.b (Ctrl_2_Press).w,d0
  3991. andi.b #button_start_mask,d0
  3992. beq.w TitleScreen_Loop ; loop until Start is pressed
  3993. move.b #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
  3994. move.b #3,(Life_count).w
  3995. move.b #3,(Life_count_2P).w
  3996. moveq #0,d0
  3997. move.w d0,(Ring_count).w
  3998. move.l d0,(Timer).w
  3999. move.l d0,(Score).w
  4000. move.w d0,(Ring_count_2P).w
  4001. move.l d0,(Timer_2P).w
  4002. move.l d0,(Score_2P).w
  4003. move.b d0,(Continue_count).w
  4004. move.l #5000,(Next_Extra_life_score).w
  4005. move.l #5000,(Next_Extra_life_score_2P).w
  4006. move.b #MusID_FadeOut,d0 ; prepare to stop music (fade out)
  4007. bsr.w PlaySound
  4008. moveq #0,d0
  4009. move.b (Title_screen_option).w,d0
  4010. bne.s TitleScreen_CheckIfChose2P ; branch if not a 1-player game
  4011.  
  4012. moveq #0,d0
  4013. move.w d0,(Two_player_mode_copy).w
  4014. move.w d0,(Two_player_mode).w
  4015. if emerald_hill_zone_act_1=0
  4016. move.w d0,(Current_ZoneAndAct).w ; emerald_hill_zone_act_1
  4017. else
  4018. move.w #emerald_hill_zone_act_1,(Current_ZoneAndAct).w
  4019. endif
  4020. tst.b (Level_select_flag).w ; has level select cheat been entered?
  4021. beq.s + ; if not, branch
  4022. btst #button_A,(Ctrl_1_Held).w ; is A held down?
  4023. beq.s + ; if not, branch
  4024. move.b #GameModeID_LevelSelect,(Game_Mode).w ; => LevelSelectMenu
  4025. rts
  4026. ; ---------------------------------------------------------------------------
  4027. +
  4028. move.w d0,(Current_Special_StageAndAct).w
  4029. move.w d0,(Got_Emerald).w
  4030. move.l d0,(Got_Emeralds_array).w
  4031. move.l d0,(Got_Emeralds_array+4).w
  4032. rts
  4033. ; ===========================================================================
  4034. ; loc_3CF6:
  4035. TitleScreen_CheckIfChose2P:
  4036. subq.b #1,d0
  4037. bne.s TitleScreen_ChoseOptions
  4038.  
  4039. moveq #1,d1
  4040. move.w d1,(Two_player_mode_copy).w
  4041. move.w d1,(Two_player_mode).w
  4042. moveq #0,d0
  4043. move.w d0,(Got_Emerald).w
  4044. move.l d0,(Got_Emeralds_array).w
  4045. move.l d0,(Got_Emeralds_array+4).w
  4046. move.b #GameModeID_2PLevelSelect,(Game_Mode).w ; => LevelSelectMenu2P
  4047. move.b #emerald_hill_zone,(Current_Zone_2P).w
  4048. rts
  4049. ; ---------------------------------------------------------------------------
  4050. ; loc_3D20:
  4051. TitleScreen_ChoseOptions:
  4052. move.b #GameModeID_OptionsMenu,(Game_Mode).w ; => OptionsMenu
  4053. move.b #0,(Options_menu_box).w
  4054. rts
  4055. ; ===========================================================================
  4056. ; loc_3D2E:
  4057. TitleScreen_Demo:
  4058. move.b #MusID_FadeOut,d0
  4059. bsr.w PlaySound
  4060. move.w (Demo_number).w,d0
  4061. andi.w #7,d0
  4062. add.w d0,d0
  4063. move.w DemoLevels(pc,d0.w),d0
  4064. move.w d0,(Current_ZoneAndAct).w
  4065. addq.w #1,(Demo_number).w
  4066. cmpi.w #(DemoLevels_End-DemoLevels)/2,(Demo_number).w
  4067. blo.s +
  4068. move.w #0,(Demo_number).w
  4069. +
  4070. move.w #1,(Demo_mode_flag).w
  4071. move.b #GameModeID_Demo,(Game_Mode).w ; => Level (Demo mode)
  4072. cmpi.w #emerald_hill_zone_act_1,(Current_ZoneAndAct).w
  4073. bne.s +
  4074. move.w #1,(Two_player_mode).w
  4075. +
  4076. move.b #3,(Life_count).w
  4077. move.b #3,(Life_count_2P).w
  4078. moveq #0,d0
  4079. move.w d0,(Ring_count).w
  4080. move.l d0,(Timer).w
  4081. move.l d0,(Score).w
  4082. move.w d0,(Ring_count_2P).w
  4083. move.l d0,(Timer_2P).w
  4084. move.l d0,(Score_2P).w
  4085. move.l #5000,(Next_Extra_life_score).w
  4086. move.l #5000,(Next_Extra_life_score_2P).w
  4087. rts
  4088. ; ===========================================================================
  4089. ; word_3DAC:
  4090. DemoLevels:
  4091. dc.w emerald_hill_zone_act_1 ; EHZ (2P)
  4092. dc.w chemical_plant_zone_act_1 ; CPZ
  4093. dc.w aquatic_ruin_zone_act_1 ; ARZ
  4094. dc.w casino_night_zone_act_1 ; CNZ
  4095. DemoLevels_End:
  4096.  
  4097. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  4098.  
  4099. ; sub_3DB4:
  4100. TailsNameCheat:
  4101. lea (TailsNameCheat_Buttons).l,a0
  4102. move.w (Correct_cheat_entries).w,d0
  4103. adda.w d0,a0
  4104. move.b (Ctrl_1_Press).w,d0
  4105. andi.b #button_up_mask|button_down_mask|button_left_mask|button_right_mask,d0
  4106. beq.s ++ ; rts
  4107. cmp.b (a0),d0
  4108. bne.s +
  4109. addq.w #1,(Correct_cheat_entries).w
  4110. tst.b 1(a0) ; read the next entry
  4111. bne.s ++ ; if it's not zero, return
  4112. bchg #7,(Graphics_Flags).w ; turn on the cheat that changes MILES to "TAILS"
  4113. move.b #SndID_Ring,d0 ; play the ring sound for a successfully entered cheat
  4114. bsr.w PlaySound
  4115. + move.w #0,(Correct_cheat_entries).w
  4116. + rts
  4117. ; End of function TailsNameCheat
  4118.  
  4119. ; ===========================================================================
  4120. ; byte_3DEE:
  4121. TailsNameCheat_Buttons:
  4122. dc.b button_up_mask
  4123. dc.b button_down_mask
  4124. dc.b button_down_mask
  4125. dc.b button_down_mask
  4126. dc.b button_up_mask
  4127. dc.b 0 ; end
  4128. ; ---------------------------------------------------------------------------------
  4129. ; Nemesis compressed art
  4130. ; 10 blocks
  4131. ; Player 1 2 VS Text
  4132. ; ---------------------------------------------------------------------------------
  4133. ; ArtNem_3DF4:
  4134. ArtNem_Player1VS2: BINCLUDE "art/nemesis/1Player2VS.bin"
  4135.  
  4136. charset '0','9',0 ; Add character set for numbers
  4137. charset '*',$A ; Add character for star
  4138. charset '@',$B ; Add character for copyright symbol
  4139. charset ':',$C ; Add character for colon
  4140. charset '.',$D ; Add character for period
  4141. charset 'A','Z',$E ; Add character set for letters
  4142.  
  4143. ; word_3E82:
  4144. CopyrightText:
  4145. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + '@',0,0) ; (C)
  4146. dc.w make_art_tile(ArtTile_VRAM_Start,0,0) ;
  4147. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + '1',0,0) ; 1
  4148. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + '9',0,0) ; 9
  4149. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + '9',0,0) ; 9
  4150. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + '2',0,0) ; 2
  4151. dc.w make_art_tile(ArtTile_VRAM_Start,0,0) ;
  4152. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + 'S',0,0) ; S
  4153. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + 'E',0,0) ; E
  4154. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + 'G',0,0) ; G
  4155. dc.w make_art_tile(ArtTile_ArtNem_FontStuff_TtlScr + 'A',0,0) ; A
  4156. CopyrightText_End:
  4157.  
  4158. charset ; Revert character set
  4159.  
  4160. if ~~removeJmpTos
  4161. ; sub_3E98:
  4162. JmpTo_SwScrl_Title
  4163. jmp (SwScrl_Title).l
  4164.  
  4165. align 4
  4166. endif
  4167.  
  4168.  
  4169.  
  4170.  
  4171. ;----------------------------------------------------------------------------
  4172. ; 1P Music Playlist
  4173. ;----------------------------------------------------------------------------
  4174. ; byte_3EA0:
  4175. MusicList: zoneOrderedTable 1,1
  4176. zoneTableEntry.b MusID_EHZ ; 0 ; EHZ
  4177. zoneTableEntry.b MusID_EHZ ; 1
  4178. zoneTableEntry.b MusID_MTZ ; 2
  4179. zoneTableEntry.b MusID_OOZ ; 3
  4180. zoneTableEntry.b MusID_MTZ ; 4 ; MTZ1,2
  4181. zoneTableEntry.b MusID_MTZ ; 5 ; MTZ3
  4182. zoneTableEntry.b MusID_WFZ ; 6 ; WFZ
  4183. zoneTableEntry.b MusID_HTZ ; 7 ; HTZ
  4184. zoneTableEntry.b MusID_HPZ ; 8
  4185. zoneTableEntry.b MusID_SCZ ; 9
  4186. zoneTableEntry.b MusID_OOZ ; 10 ; OOZ
  4187. zoneTableEntry.b MusID_MCZ ; 11 ; MCZ
  4188. zoneTableEntry.b MusID_CNZ ; 12 ; CNZ
  4189. zoneTableEntry.b MusID_CPZ ; 13 ; CPZ
  4190. zoneTableEntry.b MusID_DEZ ; 14 ; DEZ
  4191. zoneTableEntry.b MusID_ARZ ; 15 ; ARZ
  4192. zoneTableEntry.b MusID_SCZ ; 16 ; SCZ
  4193. zoneTableEnd
  4194. even
  4195. ;----------------------------------------------------------------------------
  4196. ; 2P Music Playlist
  4197. ;----------------------------------------------------------------------------
  4198. ; byte_3EB2:
  4199. MusicList2: zoneOrderedTable 1,1
  4200. zoneTableEntry.b MusID_EHZ_2P ; 0 ; EHZ 2P
  4201. zoneTableEntry.b MusID_EHZ ; 1
  4202. zoneTableEntry.b MusID_MTZ ; 2
  4203. zoneTableEntry.b MusID_OOZ ; 3
  4204. zoneTableEntry.b MusID_MTZ ; 4
  4205. zoneTableEntry.b MusID_MTZ ; 5
  4206. zoneTableEntry.b MusID_WFZ ; 6
  4207. zoneTableEntry.b MusID_HTZ ; 7
  4208. zoneTableEntry.b MusID_HPZ ; 8
  4209. zoneTableEntry.b MusID_SCZ ; 9
  4210. zoneTableEntry.b MusID_OOZ ; 10
  4211. zoneTableEntry.b MusID_MCZ_2P ; 11 ; MCZ 2P
  4212. zoneTableEntry.b MusID_CNZ_2P ; 12 ; CNZ 2P
  4213. zoneTableEntry.b MusID_CPZ ; 13
  4214. zoneTableEntry.b MusID_DEZ ; 14
  4215. zoneTableEntry.b MusID_ARZ ; 15
  4216. zoneTableEntry.b MusID_SCZ ; 16
  4217. zoneTableEnd
  4218. even
  4219. ; ===========================================================================
  4220.  
  4221. ; ---------------------------------------------------------------------------
  4222. ; Level
  4223. ; DEMO AND ZONE LOOP (MLS values $08, $0C; bit 7 set indicates that load routine is running)
  4224. ; ---------------------------------------------------------------------------
  4225. ; loc_3EC4:
  4226. Level:
  4227. bset #GameModeFlag_TitleCard,(Game_Mode).w ; add $80 to screen mode (for pre level sequence)
  4228. tst.w (Demo_mode_flag).w ; test the old flag for the credits demos (now unused)
  4229. bmi.s +
  4230. move.b #MusID_FadeOut,d0
  4231. bsr.w PlaySound ; fade out music
  4232. +
  4233. bsr.w ClearPLC
  4234. bsr.w Pal_FadeToBlack
  4235. tst.w (Demo_mode_flag).w
  4236. bmi.s Level_ClrRam
  4237. move #$2700,sr
  4238. bsr.w ClearScreen
  4239. jsr (LoadTitleCard).l ; load title card patterns
  4240. move #$2300,sr
  4241. moveq #0,d0
  4242. move.w d0,(Timer_frames).w
  4243. move.b (Current_Zone).w,d0
  4244.  
  4245. ; multiply d0 by 12, the size of a level art load block
  4246. add.w d0,d0
  4247. add.w d0,d0
  4248. move.w d0,d1
  4249. add.w d0,d0
  4250. add.w d1,d0
  4251.  
  4252. lea (LevelArtPointers).l,a2
  4253. lea (a2,d0.w),a2
  4254. moveq #0,d0
  4255. move.b (a2),d0 ; PLC1 ID
  4256. beq.s +
  4257. bsr.w LoadPLC
  4258. +
  4259. moveq #PLCID_Std2,d0
  4260. bsr.w LoadPLC
  4261. bsr.w Level_SetPlayerMode
  4262. moveq #PLCID_Miles1up,d0
  4263. tst.w (Two_player_mode).w
  4264. bne.s +
  4265. cmpi.w #2,(Player_mode).w
  4266. bne.s Level_ClrRam
  4267. addq.w #PLCID_MilesLife-PLCID_Miles1up,d0
  4268. +
  4269. tst.b (Graphics_Flags).w
  4270. bpl.s +
  4271. addq.w #PLCID_Tails1up-PLCID_Miles1up,d0
  4272. +
  4273. bsr.w LoadPLC
  4274. ; loc_3F48:
  4275. Level_ClrRam:
  4276. clearRAM Sprite_Table_Input,Sprite_Table_Input_End
  4277. clearRAM Object_RAM,Object_RAM_End ; clear object RAM
  4278. clearRAM MiscLevelVariables,MiscLevelVariables_End
  4279. clearRAM Misc_Variables,Misc_Variables_End
  4280. clearRAM Oscillating_Data,Oscillating_variables_End
  4281. ; Bug: The '+C0' shouldn't be here; CNZ_saucer_data is only $40 bytes large
  4282. clearRAM CNZ_saucer_data,CNZ_saucer_data_End+$C0
  4283.  
  4284. cmpi.w #chemical_plant_zone_act_2,(Current_ZoneAndAct).w ; CPZ 2
  4285. beq.s Level_InitWater
  4286. cmpi.b #aquatic_ruin_zone,(Current_Zone).w ; ARZ
  4287. beq.s Level_InitWater
  4288. cmpi.b #hidden_palace_zone,(Current_Zone).w ; HPZ
  4289. bne.s +
  4290.  
  4291. Level_InitWater:
  4292. move.b #1,(Water_flag).w
  4293. move.w #0,(Two_player_mode).w
  4294. +
  4295. lea (VDP_control_port).l,a6
  4296. move.w #$8B03,(a6) ; EXT-INT disabled, V scroll by screen, H scroll by line
  4297. move.w #$8200|(VRAM_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  4298. move.w #$8400|(VRAM_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $E000
  4299. move.w #$8500|(VRAM_Sprite_Attribute_Table/$200),(a6) ; Sprite attribute table base: $F800
  4300. move.w #$9001,(a6) ; Scroll table size: 64x32
  4301. move.w #$8004,(a6) ; H-INT disabled
  4302. move.w #$8720,(a6) ; Background palette/color: 2/0
  4303. move.w #$8C81,(a6) ; H res 40 cells, no interlace
  4304. tst.b (Debug_options_flag).w
  4305. beq.s ++
  4306. btst #button_C,(Ctrl_1_Held).w
  4307. beq.s +
  4308. move.w #$8C89,(a6) ; H res 40 cells, no interlace, S/H enabled
  4309. +
  4310. btst #button_A,(Ctrl_1_Held).w
  4311. beq.s +
  4312. move.b #1,(Debug_mode_flag).w
  4313. +
  4314. move.w #$8ADF,(Hint_counter_reserve).w ; H-INT every 223rd scanline
  4315. tst.w (Two_player_mode).w
  4316. beq.s +
  4317. move.w #$8A6B,(Hint_counter_reserve).w ; H-INT every 108th scanline
  4318. move.w #$8014,(a6) ; H-INT enabled
  4319. move.w #$8C87,(a6) ; H res 40 cells, double res interlace
  4320. +
  4321. move.w (Hint_counter_reserve).w,(a6)
  4322. clr.w (VDP_Command_Buffer).w
  4323. move.l #VDP_Command_Buffer,(VDP_Command_Buffer_Slot).w
  4324. tst.b (Water_flag).w ; does level have water?
  4325. beq.s Level_LoadPal ; if not, branch
  4326. move.w #$8014,(a6) ; H-INT enabled
  4327. moveq #0,d0
  4328. move.w (Current_ZoneAndAct).w,d0
  4329. if ~~useFullWaterTables
  4330. subi.w #hidden_palace_zone_act_1,d0
  4331. endif
  4332. ror.b #1,d0
  4333. lsr.w #6,d0
  4334. andi.w #$FFFE,d0
  4335. lea (WaterHeight).l,a1 ; load water height array
  4336. move.w (a1,d0.w),d0
  4337. move.w d0,(Water_Level_1).w ; set water heights
  4338. move.w d0,(Water_Level_2).w
  4339. move.w d0,(Water_Level_3).w
  4340. clr.b (Water_routine).w ; clear water routine counter
  4341. clr.b (Water_fullscreen_flag).w ; clear water movement
  4342. move.b #1,(Water_on).w ; enable water
  4343. ; loc_407C:
  4344. Level_LoadPal:
  4345. moveq #PalID_BGND,d0
  4346. bsr.w PalLoad_Now ; load Sonic's palette line
  4347. tst.b (Water_flag).w ; does level have water?
  4348. beq.s Level_GetBgm ; if not, branch
  4349. moveq #PalID_HPZ_U,d0 ; palette number $15
  4350. cmpi.b #hidden_palace_zone,(Current_Zone).w
  4351. beq.s Level_WaterPal ; branch if level is HPZ
  4352. moveq #PalID_CPZ_U,d0 ; palette number $16
  4353. cmpi.b #chemical_plant_zone,(Current_Zone).w
  4354. beq.s Level_WaterPal ; branch if level is CPZ
  4355. moveq #PalID_ARZ_U,d0 ; palette number $17
  4356. ; loc_409E:
  4357. Level_WaterPal:
  4358. bsr.w PalLoad_Water_Now ; load underwater palette (with d0)
  4359. tst.b (Last_star_pole_hit).w ; is it the start of the level?
  4360. beq.s Level_GetBgm ; if yes, branch
  4361. move.b (Saved_Water_move).w,(Water_fullscreen_flag).w
  4362. ; loc_40AE:
  4363. Level_GetBgm:
  4364. tst.w (Demo_mode_flag).w
  4365. bmi.s +
  4366. moveq #0,d0
  4367. move.b (Current_Zone).w,d0
  4368. lea_ MusicList,a1
  4369. tst.w (Two_player_mode).w
  4370. beq.s Level_PlayBgm
  4371. lea_ MusicList2,a1
  4372. ; loc_40C8:
  4373. Level_PlayBgm:
  4374. move.b (a1,d0.w),d0 ; load from music playlist
  4375. move.w d0,(Level_Music).w ; store level music
  4376. bsr.w PlayMusic ; play level music
  4377. move.b #ObjID_TitleCard,(TitleCard+id).w ; load Obj34 (level title card) at $FFFFB080
  4378. ; loc_40DA:
  4379. Level_TtlCard:
  4380. move.b #VintID_TitleCard,(Vint_routine).w
  4381. bsr.w WaitForVint
  4382. jsr (RunObjects).l
  4383. jsr (BuildSprites).l
  4384. bsr.w RunPLC_RAM
  4385. move.w (TitleCard_ZoneName+x_pos).w,d0
  4386. cmp.w (TitleCard_ZoneName+titlecard_x_target).w,d0 ; has title card sequence finished?
  4387. bne.s Level_TtlCard ; if not, branch
  4388. tst.l (Plc_Buffer).w ; are there any items in the pattern load cue?
  4389. bne.s Level_TtlCard ; if yes, branch
  4390. move.b #VintID_TitleCard,(Vint_routine).w
  4391. bsr.w WaitForVint
  4392. jsr (Hud_Base).l
  4393. +
  4394. moveq #PalID_BGND,d0
  4395. bsr.w PalLoad_ForFade ; load Sonic's palette line
  4396. bsr.w LevelSizeLoad
  4397. jsrto (DeformBgLayer).l, JmpTo_DeformBgLayer
  4398. clr.w (Vscroll_Factor_FG).w
  4399. move.w #-$E0,(Vscroll_Factor_P2_FG).w
  4400.  
  4401. clearRAM Horiz_Scroll_Buf,Horiz_Scroll_Buf_End
  4402.  
  4403. bsr.w LoadZoneTiles
  4404. jsrto (loadZoneBlockMaps).l, JmpTo_loadZoneBlockMaps
  4405. jsr (loc_402D4).l
  4406. jsrto (DrawInitialBG).l, JmpTo_DrawInitialBG
  4407. jsr (FloorLog_Unk).l
  4408. bsr.w LoadCollisionIndexes
  4409. bsr.w WaterEffects
  4410. bsr.w InitPlayers
  4411. move.w #0,(Ctrl_1_Logical).w
  4412. move.w #0,(Ctrl_2_Logical).w
  4413. move.w #0,(Ctrl_1).w
  4414. move.w #0,(Ctrl_2).w
  4415. move.b #1,(Control_Locked).w
  4416. move.b #1,(Control_Locked_P2).w
  4417. move.b #0,(Level_started_flag).w
  4418. ; Level_ChkWater:
  4419. tst.b (Water_flag).w ; does level have water?
  4420. beq.s + ; if not, branch
  4421. move.b #ObjID_WaterSurface,(WaterSurface1+id).w ; load Obj04 (water surface) at $FFFFB380
  4422. move.w #$60,(WaterSurface1+x_pos).w ; set horizontal offset
  4423. move.b #ObjID_WaterSurface,(WaterSurface2+id).w ; load Obj04 (water surface) at $FFFFB3C0
  4424. move.w #$120,(WaterSurface2+x_pos).w ; set different horizontal offset
  4425. +
  4426. cmpi.b #chemical_plant_zone,(Current_Zone).w ; check if zone == CPZ
  4427. bne.s + ; branch if not
  4428. move.b #ObjID_CPZPylon,(CPZPylon+id).w ; load Obj7C (CPZ pylon) at $FFFFB340
  4429. +
  4430. cmpi.b #oil_ocean_zone,(Current_Zone).w ; check if zone == OOZ
  4431. bne.s Level_ClrHUD ; branch if not
  4432. move.b #ObjID_Oil,(Oil+id).w ; load Obj07 (OOZ oil) at $FFFFB380
  4433. ; Level_LoadObj: misnomer now
  4434. Level_ClrHUD:
  4435. moveq #0,d0
  4436. tst.b (Last_star_pole_hit).w ; are you starting from a lamppost?
  4437. bne.s Level_FromCheckpoint ; if yes, branch
  4438. move.w d0,(Ring_count).w ; clear rings
  4439. move.l d0,(Timer).w ; clear time
  4440. move.b d0,(Extra_life_flags).w ; clear extra lives counter
  4441. move.w d0,(Ring_count_2P).w ; ditto for player 2
  4442. move.l d0,(Timer_2P).w
  4443. move.b d0,(Extra_life_flags_2P).w
  4444. ; loc_41E4:
  4445. Level_FromCheckpoint:
  4446. move.b d0,(Time_Over_flag).w
  4447. move.b d0,(Time_Over_flag_2P).w
  4448. move.b d0,(SlotMachine_Routine).w
  4449. move.w d0,(SlotMachineInUse).w
  4450. move.w d0,(Debug_placement_mode).w
  4451. move.w d0,(Level_Inactive_flag).w
  4452. move.b d0,(Teleport_timer).w
  4453. move.b d0,(Teleport_flag).w
  4454. move.w d0,(Rings_Collected).w
  4455. move.w d0,(Rings_Collected_2P).w
  4456. move.w d0,(Monitors_Broken).w
  4457. move.w d0,(Monitors_Broken_2P).w
  4458. move.w d0,(Loser_Time_Left).w
  4459. bsr.w OscillateNumInit
  4460. move.b #1,(Update_HUD_score).w
  4461. move.b #1,(Update_HUD_rings).w
  4462. move.b #1,(Update_HUD_timer).w
  4463. move.b #1,(Update_HUD_timer_2P).w
  4464. jsr (ObjectsManager).l
  4465. jsr (RingsManager).l
  4466. jsr (SpecialCNZBumpers).l
  4467. jsr (RunObjects).l
  4468. jsr (BuildSprites).l
  4469. jsrto (AniArt_Load).l, JmpTo_AniArt_Load
  4470. bsr.w SetLevelEndType
  4471. move.w #0,(Demo_button_index).w
  4472. move.w #0,(Demo_button_index_2P).w
  4473. lea (DemoScriptPointers).l,a1
  4474. moveq #0,d0
  4475. move.b (Current_Zone).w,d0 ; load zone value
  4476. lsl.w #2,d0
  4477. movea.l (a1,d0.w),a1
  4478. tst.w (Demo_mode_flag).w
  4479. bpl.s +
  4480. lea (EndingDemoScriptPointers).l,a1
  4481. move.w (Ending_demo_number).w,d0
  4482. subq.w #1,d0
  4483. lsl.w #2,d0
  4484. movea.l (a1,d0.w),a1
  4485. +
  4486. move.b 1(a1),(Demo_press_counter).w
  4487. tst.b (Current_Zone).w ; emerald_hill_zone
  4488. bne.s +
  4489. lea (Demo_EHZ_Tails).l,a1
  4490. move.b 1(a1),(Demo_press_counter_2P).w
  4491. +
  4492. move.w #$668,(Demo_Time_left).w
  4493. tst.w (Demo_mode_flag).w
  4494. bpl.s +
  4495. move.w #$21C,(Demo_Time_left).w
  4496. cmpi.w #4,(Ending_demo_number).w
  4497. bne.s +
  4498. move.w #$1FE,(Demo_Time_left).w
  4499. +
  4500. tst.b (Water_flag).w
  4501. beq.s ++
  4502. moveq #PalID_HPZ_U,d0
  4503. cmpi.b #hidden_palace_zone,(Current_Zone).w
  4504. beq.s +
  4505. moveq #PalID_CPZ_U,d0
  4506. cmpi.b #chemical_plant_zone,(Current_Zone).w
  4507. beq.s +
  4508. moveq #PalID_ARZ_U,d0
  4509. +
  4510. bsr.w PalLoad_Water_ForFade
  4511. +
  4512. move.w #-1,(TitleCard_ZoneName+titlecard_leaveflag).w
  4513. move.b #$E,(TitleCard_Left+routine).w ; make the left part move offscreen
  4514. move.w #$A,(TitleCard_Left+titlecard_location).w
  4515.  
  4516. - move.b #VintID_TitleCard,(Vint_routine).w
  4517. bsr.w WaitForVint
  4518. jsr (RunObjects).l
  4519. jsr (BuildSprites).l
  4520. bsr.w RunPLC_RAM
  4521. tst.b (TitleCard_Background+id).w
  4522. bne.s - ; loop while the title card background is still loaded
  4523.  
  4524. lea (TitleCard).w,a1
  4525. move.b #$16,TitleCard_ZoneName-TitleCard+routine(a1)
  4526. move.w #$2D,TitleCard_ZoneName-TitleCard+anim_frame_duration(a1)
  4527. move.b #$16,TitleCard_Zone-TitleCard+routine(a1)
  4528. move.w #$2D,TitleCard_Zone-TitleCard+anim_frame_duration(a1)
  4529. tst.b TitleCard_ActNumber-TitleCard+id(a1)
  4530. beq.s + ; branch if the act number has been unloaded
  4531. move.b #$16,TitleCard_ActNumber-TitleCard+routine(a1)
  4532. move.w #$2D,TitleCard_ActNumber-TitleCard+anim_frame_duration(a1)
  4533. + move.b #0,(Control_Locked).w
  4534. move.b #0,(Control_Locked_P2).w
  4535. move.b #1,(Level_started_flag).w
  4536.  
  4537. ; Level_StartGame: loc_435A:
  4538. bclr #GameModeFlag_TitleCard,(Game_Mode).w ; clear $80 from the game mode
  4539.  
  4540. ; ---------------------------------------------------------------------------
  4541. ; Main level loop (when all title card and loading sequences are finished)
  4542. ; ---------------------------------------------------------------------------
  4543. ; loc_4360:
  4544. Level_MainLoop:
  4545. bsr.w PauseGame
  4546. move.b #VintID_Level,(Vint_routine).w
  4547. bsr.w WaitForVint
  4548. addq.w #1,(Timer_frames).w ; add 1 to level timer
  4549. bsr.w MoveSonicInDemo
  4550. bsr.w WaterEffects
  4551. jsr (RunObjects).l
  4552. tst.w (Level_Inactive_flag).w
  4553. bne.w Level
  4554. jsrto (DeformBgLayer).l, JmpTo_DeformBgLayer
  4555. bsr.w UpdateWaterSurface
  4556. jsr (RingsManager).l
  4557. cmpi.b #casino_night_zone,(Current_Zone).w ; is it CNZ?
  4558. bne.s + ; if not, branch past jsr
  4559. jsr (SpecialCNZBumpers).l
  4560. +
  4561. jsrto (AniArt_Load).l, JmpTo_AniArt_Load
  4562. bsr.w PalCycle_Load
  4563. bsr.w RunPLC_RAM
  4564. bsr.w OscillateNumDo
  4565. bsr.w ChangeRingFrame
  4566. bsr.w CheckLoadSignpostArt
  4567. jsr (BuildSprites).l
  4568. jsr (ObjectsManager).l
  4569. cmpi.b #GameModeID_Demo,(Game_Mode).w ; check if in demo mode
  4570. beq.s +
  4571. cmpi.b #GameModeID_Level,(Game_Mode).w ; check if in normal play mode
  4572. beq.w Level_MainLoop
  4573. rts
  4574. ; ---------------------------------------------------------------------------
  4575. +
  4576. tst.w (Level_Inactive_flag).w
  4577. bne.s +
  4578. tst.w (Demo_Time_left).w
  4579. beq.s +
  4580. cmpi.b #GameModeID_Demo,(Game_Mode).w
  4581. beq.w Level_MainLoop
  4582. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  4583. rts
  4584. ; ---------------------------------------------------------------------------
  4585. +
  4586. cmpi.b #GameModeID_Demo,(Game_Mode).w
  4587. bne.s +
  4588. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  4589. +
  4590. move.w #1*60,(Demo_Time_left).w ; 1 second
  4591. move.w #$3F,(Palette_fade_range).w
  4592. clr.w (PalChangeSpeed).w
  4593. -
  4594. move.b #VintID_Level,(Vint_routine).w
  4595. bsr.w WaitForVint
  4596. bsr.w MoveSonicInDemo
  4597. jsr (RunObjects).l
  4598. jsr (BuildSprites).l
  4599. jsr (ObjectsManager).l
  4600. subq.w #1,(PalChangeSpeed).w
  4601. bpl.s +
  4602. move.w #2,(PalChangeSpeed).w
  4603. bsr.w Pal_FadeToBlack.UpdateAllColours
  4604. +
  4605. tst.w (Demo_Time_left).w
  4606. bne.s -
  4607. rts
  4608.  
  4609. ; ---------------------------------------------------------------------------
  4610. ; Subroutine to set the player mode, which is forced to Sonic and Tails in
  4611. ; the demo mode and in 2P mode
  4612. ; ---------------------------------------------------------------------------
  4613.  
  4614. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  4615.  
  4616. ; sub_4450:
  4617. Level_SetPlayerMode:
  4618. cmpi.b #GameModeID_TitleCard|GameModeID_Demo,(Game_Mode).w ; pre-level demo mode?
  4619. beq.s + ; if yes, branch
  4620. tst.w (Two_player_mode).w ; 2P mode?
  4621. bne.s + ; if yes, branch
  4622. move.w (Player_option).w,(Player_mode).w ; use the option chosen in the Options screen
  4623. rts
  4624. ; ---------------------------------------------------------------------------
  4625. + move.w #0,(Player_mode).w ; force Sonic and Tails
  4626. rts
  4627. ; End of function Level_SetPlayerMode
  4628.  
  4629.  
  4630. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  4631.  
  4632. ; sub_446E:
  4633. InitPlayers:
  4634. move.w (Player_mode).w,d0
  4635. bne.s InitPlayers_Alone ; branch if this isn't a Sonic and Tails game
  4636.  
  4637. move.b #ObjID_Sonic,(MainCharacter+id).w ; load Obj01 Sonic object at $FFFFB000
  4638. move.b #ObjID_SpindashDust,(Sonic_Dust+id).w ; load Obj08 Sonic's spindash dust/splash object at $FFFFD100
  4639.  
  4640. cmpi.b #wing_fortress_zone,(Current_Zone).w
  4641. beq.s + ; skip loading Tails if this is WFZ
  4642. cmpi.b #death_egg_zone,(Current_Zone).w
  4643. beq.s + ; skip loading Tails if this is DEZ
  4644. cmpi.b #sky_chase_zone,(Current_Zone).w
  4645. beq.s + ; skip loading Tails if this is SCZ
  4646.  
  4647. move.b #ObjID_Tails,(Sidekick+id).w ; load Obj02 Tails object at $FFFFB040
  4648. move.w (MainCharacter+x_pos).w,(Sidekick+x_pos).w
  4649. move.w (MainCharacter+y_pos).w,(Sidekick+y_pos).w
  4650. subi.w #$20,(Sidekick+x_pos).w
  4651. addi_.w #4,(Sidekick+y_pos).w
  4652. move.b #ObjID_SpindashDust,(Tails_Dust+id).w ; load Obj08 Tails' spindash dust/splash object at $FFFFD140
  4653. +
  4654. rts
  4655. ; ===========================================================================
  4656. ; loc_44BE:
  4657. InitPlayers_Alone: ; either Sonic or Tails but not both
  4658. subq.w #1,d0
  4659. bne.s InitPlayers_TailsAlone ; branch if this is a Tails alone game
  4660.  
  4661. move.b #ObjID_Sonic,(MainCharacter+id).w ; load Obj01 Sonic object at $FFFFB000
  4662. move.b #ObjID_SpindashDust,(Sonic_Dust+id).w ; load Obj08 Sonic's spindash dust/splash object at $FFFFD100
  4663. rts
  4664. ; ===========================================================================
  4665. ; loc_44D0:
  4666. InitPlayers_TailsAlone:
  4667. move.b #ObjID_Tails,(MainCharacter+id).w ; load Obj02 Tails object at $FFFFB000
  4668. move.b #ObjID_SpindashDust,(Tails_Dust+id).w ; load Obj08 Tails' spindash dust/splash object at $FFFFD100
  4669. addi_.w #4,(MainCharacter+y_pos).w
  4670. rts
  4671. ; End of function InitPlayers
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677. ; ---------------------------------------------------------------------------
  4678. ; Subroutine to move the water or oil surface sprites to where the screen is at
  4679. ; (the closest match I could find to this subroutine in Sonic 1 is Obj1B_Action)
  4680. ; ---------------------------------------------------------------------------
  4681.  
  4682. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  4683.  
  4684. ; sub_44E4:
  4685. UpdateWaterSurface:
  4686. tst.b (Water_flag).w
  4687. beq.s ++ ; rts
  4688. move.w (Camera_X_pos).w,d1
  4689. btst #0,(Timer_frames+1).w
  4690. beq.s +
  4691. addi.w #$20,d1
  4692. + ; match obj x-position to screen position
  4693. move.w d1,d0
  4694. addi.w #$60,d0
  4695. move.w d0,(WaterSurface1+x_pos).w
  4696. addi.w #$120,d1
  4697. move.w d1,(WaterSurface2+x_pos).w
  4698. +
  4699. rts
  4700. ; End of function UpdateWaterSurface
  4701.  
  4702.  
  4703. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  4704.  
  4705. ; ---------------------------------------------------------------------------
  4706. ; Subroutine to do special water effects
  4707. ; ---------------------------------------------------------------------------
  4708. ; sub_450E: ; LZWaterEffects:
  4709. WaterEffects:
  4710. tst.b (Water_flag).w ; does level have water?
  4711. beq.s NonWaterEffects ; if not, branch
  4712. tst.b (Deform_lock).w
  4713. bne.s MoveWater
  4714. cmpi.b #6,(MainCharacter+routine).w ; is player dead?
  4715. bhs.s MoveWater ; if yes, branch
  4716. bsr.w DynamicWater
  4717. ; loc_4526: ; LZMoveWater:
  4718. MoveWater:
  4719. clr.b (Water_fullscreen_flag).w
  4720. moveq #0,d0
  4721. cmpi.b #aquatic_ruin_zone,(Current_Zone).w ; is level ARZ?
  4722. beq.s + ; if yes, branch
  4723. move.b (Oscillating_Data).w,d0
  4724. lsr.w #1,d0
  4725. +
  4726. add.w (Water_Level_2).w,d0
  4727. move.w d0,(Water_Level_1).w
  4728. ; calculate distance between water surface and top of screen
  4729. move.w (Water_Level_1).w,d0
  4730. sub.w (Camera_Y_pos).w,d0
  4731. bhs.s +
  4732. tst.w d0
  4733. bpl.s +
  4734. move.b #$DF,(Hint_counter_reserve+1).w ; H-INT every 224th scanline
  4735. move.b #1,(Water_fullscreen_flag).w
  4736. +
  4737. cmpi.w #$DF,d0
  4738. blo.s +
  4739. move.w #$DF,d0
  4740. +
  4741. move.b d0,(Hint_counter_reserve+1).w ; H-INT every d0 scanlines
  4742. ; loc_456A:
  4743. NonWaterEffects:
  4744. cmpi.b #oil_ocean_zone,(Current_Zone).w ; is the level OOZ?
  4745. bne.s + ; if not, branch
  4746. bsr.w OilSlides ; call oil slide routine
  4747. +
  4748. cmpi.b #wing_fortress_zone,(Current_Zone).w ; is the level WFZ?
  4749. bne.s + ; if not, branch
  4750. bsr.w WindTunnel ; call wind and block break routine
  4751. +
  4752. rts
  4753. ; End of function WaterEffects
  4754.  
  4755. ; ===========================================================================
  4756. if useFullWaterTables
  4757. WaterHeight: zoneOrderedTable 2,2
  4758. zoneTableEntry.w $600, $600 ; EHZ
  4759. zoneTableEntry.w $600, $600 ; Zone 1
  4760. zoneTableEntry.w $600, $600 ; WZ
  4761. zoneTableEntry.w $600, $600 ; Zone 3
  4762. zoneTableEntry.w $600, $600 ; MTZ
  4763. zoneTableEntry.w $600, $600 ; MTZ
  4764. zoneTableEntry.w $600, $600 ; WFZ
  4765. zoneTableEntry.w $600, $600 ; HTZ
  4766. zoneTableEntry.w $600, $600 ; HPZ
  4767. zoneTableEntry.w $600, $600 ; Zone 9
  4768. zoneTableEntry.w $600, $600 ; OOZ
  4769. zoneTableEntry.w $600, $600 ; MCZ
  4770. zoneTableEntry.w $600, $600 ; CNZ
  4771. zoneTableEntry.w $600, $710 ; CPZ
  4772. zoneTableEntry.w $600, $600 ; DEZ
  4773. zoneTableEntry.w $410, $510 ; ARZ
  4774. zoneTableEntry.w $600, $600 ; SCZ
  4775. zoneTableEnd
  4776. else
  4777. ; word_4584:
  4778. WaterHeight:
  4779. dc.w $600, $600 ; HPZ
  4780. dc.w $600, $600 ; Zone 9
  4781. dc.w $600, $600 ; OOZ
  4782. dc.w $600, $600 ; MCZ
  4783. dc.w $600, $600 ; CNZ
  4784. dc.w $600, $710 ; CPZ
  4785. dc.w $600, $600 ; DEZ
  4786. dc.w $410, $510 ; ARZ
  4787. endif
  4788.  
  4789. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  4790.  
  4791. ; sub_45A4: ; LZDynamicWater:
  4792. DynamicWater:
  4793. moveq #0,d0
  4794. move.w (Current_ZoneAndAct).w,d0
  4795. if ~~useFullWaterTables
  4796. subi.w #hidden_palace_zone_act_1,d0
  4797. endif
  4798. ror.b #1,d0
  4799. lsr.w #6,d0
  4800. andi.w #$FFFE,d0
  4801. move.w Dynamic_water_routine_table(pc,d0.w),d0
  4802. jsr Dynamic_water_routine_table(pc,d0.w)
  4803. moveq #0,d1
  4804. move.b (Water_on).w,d1
  4805. move.w (Water_Level_3).w,d0
  4806. sub.w (Water_Level_2).w,d0
  4807. beq.s ++ ; rts
  4808. bcc.s +
  4809. neg.w d1
  4810. +
  4811. add.w d1,(Water_Level_2).w
  4812. +
  4813. rts
  4814. ; End of function DynamicWater
  4815.  
  4816. ; ===========================================================================
  4817. if useFullWaterTables
  4818. Dynamic_water_routine_table: zoneOrderedOffsetTable 2,2
  4819. zoneOffsetTableEntry.w DynamicWaterNull ; EHZ 1
  4820. zoneOffsetTableEntry.w DynamicWaterNull ; EHZ 2
  4821. zoneOffsetTableEntry.w DynamicWaterNull ; Zone 1
  4822. zoneOffsetTableEntry.w DynamicWaterNull ; Zone 1
  4823. zoneOffsetTableEntry.w DynamicWaterNull ; WZ 1
  4824. zoneOffsetTableEntry.w DynamicWaterNull ; WZ 2
  4825. zoneOffsetTableEntry.w DynamicWaterNull ; Zone 3
  4826. zoneOffsetTableEntry.w DynamicWaterNull ; Zone 3
  4827. zoneOffsetTableEntry.w DynamicWaterNull ; MTZ 1
  4828. zoneOffsetTableEntry.w DynamicWaterNull ; MTZ 2
  4829. zoneOffsetTableEntry.w DynamicWaterNull ; MTZ 3
  4830. zoneOffsetTableEntry.w DynamicWaterNull ; MTZ 4
  4831. zoneOffsetTableEntry.w DynamicWaterNull ; WFZ 1
  4832. zoneOffsetTableEntry.w DynamicWaterNull ; WFZ 2
  4833. zoneOffsetTableEntry.w DynamicWaterNull ; HTZ 1
  4834. zoneOffsetTableEntry.w DynamicWaterNull ; HTZ 2
  4835. zoneOffsetTableEntry.w DynamicWaterNull ; HPZ 1
  4836. zoneOffsetTableEntry.w DynamicWaterNull ; HPZ 2
  4837. zoneOffsetTableEntry.w DynamicWaterNull ; Zone 9
  4838. zoneOffsetTableEntry.w DynamicWaterNull ; Zone 9
  4839. zoneOffsetTableEntry.w DynamicWaterNull ; OOZ 1
  4840. zoneOffsetTableEntry.w DynamicWaterNull ; OOZ 2
  4841. zoneOffsetTableEntry.w DynamicWaterNull ; MCZ 1
  4842. zoneOffsetTableEntry.w DynamicWaterNull ; MCZ 2
  4843. zoneOffsetTableEntry.w DynamicWaterNull ; CNZ 1
  4844. zoneOffsetTableEntry.w DynamicWaterNull ; CNZ 2
  4845. zoneOffsetTableEntry.w DynamicWaterNull ; CPZ 1
  4846. zoneOffsetTableEntry.w DynamicWaterCPZ2 ; CPZ 2
  4847. zoneOffsetTableEntry.w DynamicWaterNull ; DEZ 1
  4848. zoneOffsetTableEntry.w DynamicWaterNull ; DEZ 2
  4849. zoneOffsetTableEntry.w DynamicWaterNull ; ARZ 1
  4850. zoneOffsetTableEntry.w DynamicWaterNull ; ARZ 2
  4851. zoneOffsetTableEntry.w DynamicWaterNull ; SCZ 1
  4852. zoneOffsetTableEntry.w DynamicWaterNull ; SCZ 2
  4853. zoneTableEnd
  4854. else
  4855. ; off_45D8:
  4856. Dynamic_water_routine_table: offsetTable
  4857. offsetTableEntry.w DynamicWaterNull ; HPZ 1
  4858. offsetTableEntry.w DynamicWaterNull ; HPZ 2
  4859. offsetTableEntry.w DynamicWaterNull ; Zone 9
  4860. offsetTableEntry.w DynamicWaterNull ; Zone 9
  4861. offsetTableEntry.w DynamicWaterNull ; OOZ 1
  4862. offsetTableEntry.w DynamicWaterNull ; OOZ 2
  4863. offsetTableEntry.w DynamicWaterNull ; MCZ 1
  4864. offsetTableEntry.w DynamicWaterNull ; MCZ 2
  4865. offsetTableEntry.w DynamicWaterNull ; CNZ 1
  4866. offsetTableEntry.w DynamicWaterNull ; CNZ 2
  4867. offsetTableEntry.w DynamicWaterNull ; CPZ 1
  4868. offsetTableEntry.w DynamicWaterCPZ2 ; CPZ 2
  4869. offsetTableEntry.w DynamicWaterNull ; DEZ 1
  4870. offsetTableEntry.w DynamicWaterNull ; DEZ 2
  4871. offsetTableEntry.w DynamicWaterNull ; ARZ 1
  4872. offsetTableEntry.w DynamicWaterNull ; ARZ 2
  4873. endif
  4874. ; ===========================================================================
  4875. ; return_45F8:
  4876. DynamicWaterNull:
  4877. rts
  4878. ; ===========================================================================
  4879. ; loc_45FA:
  4880. DynamicWaterCPZ2:
  4881. cmpi.w #$1DE0,(Camera_X_pos).w
  4882. blo.s + ; rts
  4883. move.w #$510,(Water_Level_3).w
  4884. + rts
  4885.  
  4886. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  4887. ; Equates:
  4888. windtunnel_min_x_pos = 0
  4889. windtunnel_max_x_pos = 4
  4890. windtunnel_min_y_pos = 2
  4891. windtunnel_max_y_pos = 6
  4892.  
  4893. ; sub_460A:
  4894. WindTunnel:
  4895. tst.w (Debug_placement_mode).w
  4896. bne.w WindTunnel_End ; don't interact with wind tunnels while in debug mode
  4897. lea (WindTunnelsCoordinates).l,a2
  4898. moveq #(WindTunnelsCoordinates_End-WindTunnelsCoordinates)/8-1,d1
  4899. lea (MainCharacter).w,a1 ; a1=character
  4900. - ; check for current wind tunnel if the main character is inside it
  4901. move.w x_pos(a1),d0
  4902. cmp.w windtunnel_min_x_pos(a2),d0
  4903. blo.w WindTunnel_Leave ; branch, if main character is too far left
  4904. cmp.w windtunnel_max_x_pos(a2),d0
  4905. bhs.w WindTunnel_Leave ; branch, if main character is too far right
  4906. move.w y_pos(a1),d2
  4907. cmp.w windtunnel_min_y_pos(a2),d2
  4908. blo.w WindTunnel_Leave ; branch, if main character is too far up
  4909. cmp.w windtunnel_max_y_pos(a2),d2
  4910. bhs.s WindTunnel_Leave ; branch, if main character is too far down
  4911. tst.b (WindTunnel_holding_flag).w
  4912. bne.w WindTunnel_End
  4913. cmpi.b #4,routine(a1) ; is the main character hurt, dying, etc. ?
  4914. bhs.s WindTunnel_LeaveHurt ; if yes, branch
  4915. move.b #1,(WindTunnel_flag).w ; affects character animation and bubble movement
  4916. subi_.w #4,x_pos(a1) ; move main character to the left
  4917. move.w #-$400,x_vel(a1)
  4918. move.w #0,y_vel(a1)
  4919. move.b #AniIDSonAni_Float2,anim(a1)
  4920. bset #1,status(a1) ; set "in-air" bit
  4921. btst #button_up,(Ctrl_1_Held).w ; is Up being pressed?
  4922. beq.s + ; if not, branch
  4923. subq.w #1,y_pos(a1) ; move up
  4924. +
  4925. btst #button_down,(Ctrl_1_Held).w ; is Down being pressed?
  4926. beq.s + ; if not, branch
  4927. addq.w #1,y_pos(a1) ; move down
  4928. +
  4929. rts
  4930. ; ===========================================================================
  4931. ; loc_4690:
  4932. WindTunnel_Leave:
  4933. addq.w #8,a2
  4934. dbf d1,- ; check next tunnel
  4935. ; when all wind tunnels have been checked
  4936. tst.b (WindTunnel_flag).w
  4937. beq.s WindTunnel_End
  4938. move.b #AniIDSonAni_Walk,anim(a1)
  4939. ; loc_46A2:
  4940. WindTunnel_LeaveHurt: ; the main character is hurt or dying, leave the tunnel and don't check the other
  4941. clr.b (WindTunnel_flag).w
  4942. ; return_46A6:
  4943. WindTunnel_End:
  4944. rts
  4945. ; End of function WindTunnel
  4946.  
  4947. ; ===========================================================================
  4948. ; word_46A8:
  4949. WindTunnelsCoordinates:
  4950. dc.w $1510,$400,$1AF0,$580
  4951. dc.w $20F0,$618,$2500,$680
  4952. WindTunnelsCoordinates_End:
  4953.  
  4954. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  4955.  
  4956. ; sub_46B8:
  4957. OilSlides:
  4958. lea (MainCharacter).w,a1 ; a1=character
  4959. move.b (Ctrl_1_Held_Logical).w,d2
  4960. bsr.s +
  4961. lea (Sidekick).w,a1 ; a1=character
  4962. move.b (Ctrl_2_Held_Logical).w,d2
  4963. +
  4964. btst #1,status(a1)
  4965. bne.s +
  4966. move.w y_pos(a1),d0
  4967. add.w d0,d0
  4968. andi.w #$F00,d0
  4969. move.w x_pos(a1),d1
  4970. lsr.w #7,d1
  4971. andi.w #$7F,d1
  4972. add.w d1,d0
  4973. lea (Level_Layout).w,a2
  4974. move.b (a2,d0.w),d0
  4975. lea OilSlides_Chunks_End(pc),a2
  4976.  
  4977. moveq #OilSlides_Chunks_End-OilSlides_Chunks-1,d1
  4978. - cmp.b -(a2),d0
  4979. dbeq d1,-
  4980.  
  4981. beq.s loc_4712
  4982. +
  4983. if status_sec_isSliding = 7
  4984. tst.b status_secondary(a1)
  4985. bpl.s + ; rts
  4986. else
  4987. btst #status_sec_isSliding,status_secondary(a1)
  4988. beq.s + ; rts
  4989. endif
  4990. move.w #5,move_lock(a1)
  4991. andi.b #(~status_sec_isSliding_mask)&$FF,status_secondary(a1)
  4992. + rts
  4993. ; ===========================================================================
  4994.  
  4995. loc_4712:
  4996. lea (OilSlides_Speeds).l,a2
  4997. move.b (a2,d1.w),d0
  4998. beq.s loc_476E
  4999. move.b inertia(a1),d1
  5000. tst.b d0
  5001. bpl.s +
  5002. cmp.b d0,d1
  5003. ble.s ++
  5004. subi.w #$40,inertia(a1)
  5005. bra.s ++
  5006. ; ===========================================================================
  5007. +
  5008. cmp.b d0,d1
  5009. bge.s +
  5010. addi.w #$40,inertia(a1)
  5011. +
  5012. bclr #0,status(a1)
  5013. tst.b d1
  5014. bpl.s +
  5015. bset #0,status(a1)
  5016. +
  5017. move.b #AniIDSonAni_Slide,anim(a1)
  5018. ori.b #status_sec_isSliding_mask,status_secondary(a1)
  5019. move.b (Vint_runcount+3).w,d0
  5020. andi.b #$1F,d0
  5021. bne.s + ; rts
  5022. move.w #SndID_OilSlide,d0
  5023. jsr (PlaySound).l
  5024. +
  5025. rts
  5026. ; ===========================================================================
  5027.  
  5028. loc_476E:
  5029. move.w #4,d1
  5030. move.w inertia(a1),d0
  5031. btst #button_left,d2
  5032. beq.s +
  5033. move.b #AniIDSonAni_Walk,anim(a1)
  5034. bset #0,status(a1)
  5035. sub.w d1,d0
  5036. tst.w d0
  5037. bpl.s +
  5038. sub.w d1,d0
  5039. +
  5040. btst #button_right,d2
  5041. beq.s +
  5042. move.b #AniIDSonAni_Walk,anim(a1)
  5043. bclr #0,status(a1)
  5044. add.w d1,d0
  5045. tst.w d0
  5046. bmi.s +
  5047. add.w d1,d0
  5048. +
  5049. move.w #4,d1
  5050. tst.w d0
  5051. beq.s +++
  5052. bmi.s ++
  5053. sub.w d1,d0
  5054. bhi.s +
  5055. move.w #0,d0
  5056. move.b #AniIDSonAni_Wait,anim(a1)
  5057. + bra.s ++
  5058. ; ===========================================================================
  5059. +
  5060. add.w d1,d0
  5061. bhi.s +
  5062. move.w #0,d0
  5063. move.b #AniIDSonAni_Wait,anim(a1)
  5064. +
  5065. move.w d0,inertia(a1)
  5066. ori.b #status_sec_isSliding_mask,status_secondary(a1)
  5067. rts
  5068. ; End of function OilSlides
  5069.  
  5070. ; ===========================================================================
  5071. OilSlides_Speeds:
  5072. dc.b -8, -8, -8, 8, 8, 0, 0, 0, -8, -8, 0, 8, 8, 8, 0, 8
  5073. dc.b 8, 8, 0, -8, 0, 0, -8, 8, -8, -8, -8, 8, 8, 8, -8, -8 ; 16
  5074.  
  5075. ; These are the IDs of the chunks where Sonic and Tails will slide
  5076. OilSlides_Chunks:
  5077. dc.b $2F,$30,$31,$33,$35,$38,$3A,$3C,$63,$64,$83,$90,$91,$93,$A1,$A3
  5078. dc.b $BD,$C7,$C8,$CE,$D7,$D8,$E6,$EB,$EC,$ED,$F1,$F2,$F3,$F4,$FA,$FD ; 16
  5079. OilSlides_Chunks_End:
  5080. even
  5081.  
  5082.  
  5083.  
  5084.  
  5085. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  5086.  
  5087. ; sub_481E:
  5088. MoveSonicInDemo:
  5089. tst.w (Demo_mode_flag).w ; is demo mode on?
  5090. bne.w MoveDemo_On ; if yes, branch
  5091. rts
  5092. ; ---------------------------------------------------------------------------
  5093. ; demo recording routine
  5094. ; (unused/dead code, but obviously used during development)
  5095. ; ---------------------------------------------------------------------------
  5096. ; MoveDemo_Record: loc_4828:
  5097. ; calculate output location of recorded player 1 demo?
  5098. lea (DemoScriptPointers).l,a1
  5099. moveq #0,d0
  5100. move.b (Current_Zone).w,d0
  5101. lsl.w #2,d0
  5102. movea.l (a1,d0.w),a1
  5103. move.w (Demo_button_index).w,d0
  5104. adda.w d0,a1
  5105.  
  5106. move.b (Ctrl_1_Held).w,d0 ; load input of player 1
  5107. cmp.b (a1),d0 ; is same button held?
  5108. bne.s + ; if not, branch
  5109. addq.b #1,1(a1) ; increment press length counter
  5110. cmpi.b #$FF,1(a1) ; is button held too long?
  5111. beq.s + ; if yes, branch
  5112. bra.s MoveDemo_Record_P2 ; go to player 2
  5113. ; ===========================================================================
  5114. +
  5115. move.b d0,2(a1) ; store last button press
  5116. move.b #0,3(a1) ; reset hold length counter
  5117. addq.w #2,(Demo_button_index).w ; advance to next button press
  5118. andi.w #$3FF,(Demo_button_index).w ; wrap at max button press changes 1024
  5119. ; loc_486A:
  5120. MoveDemo_Record_P2:
  5121. cmpi.b #emerald_hill_zone,(Current_Zone).w
  5122. bne.s ++ ; rts
  5123. lea ($FEC000).l,a1 ; output location of recorded player 2 demo? (unknown)
  5124. move.w (Demo_button_index_2P).w,d0
  5125. adda.w d0,a1
  5126. move.b (Ctrl_2_Held).w,d0 ; load input of player 2
  5127. cmp.b (a1),d0 ; is same button held?
  5128. bne.s + ; if not, branch
  5129. addq.b #1,1(a1) ; increment press length counter
  5130. cmpi.b #$FF,1(a1) ; is button held too long?
  5131. beq.s + ; if yes, branch
  5132. bra.s ++ ; if not, return
  5133. ; ===========================================================================
  5134. +
  5135. move.b d0,2(a1) ; store last button press
  5136. move.b #0,3(a1) ; reset hold length counter
  5137. addq.w #2,(Demo_button_index_2P).w ; advance to next button press
  5138. andi.w #$3FF,(Demo_button_index_2P).w ; wrap at max button press changes 1024
  5139. + rts
  5140. ; end of inactive recording code
  5141. ; ===========================================================================
  5142. ; continue with MoveSonicInDemo:
  5143.  
  5144. ; loc_48AA:
  5145. MoveDemo_On:
  5146. move.b (Ctrl_1_Press).w,d0
  5147. or.b (Ctrl_2_Press).w,d0
  5148. andi.b #button_start_mask,d0
  5149. beq.s +
  5150. tst.w (Demo_mode_flag).w
  5151. bmi.s +
  5152. move.b #GameModeID_TitleScreen,(Game_Mode).w ; => TitleScreen
  5153. +
  5154. lea (DemoScriptPointers).l,a1 ; load pointer to input data
  5155. moveq #0,d0
  5156. move.b (Current_Zone).w,d0
  5157. cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; special stage mode?
  5158. bne.s MoveDemo_On_P1 ; if yes, branch
  5159. moveq #6,d0
  5160. ; loc_48DA:
  5161. MoveDemo_On_P1:
  5162. lsl.w #2,d0
  5163. movea.l (a1,d0.w),a1
  5164.  
  5165. move.w (Demo_button_index).w,d0
  5166. adda.w d0,a1 ; a1 now points to the current button press data
  5167. move.b (a1),d0 ; load button press
  5168. lea (Ctrl_1_Held).w,a0
  5169. move.b d0,d1
  5170. moveq #0,d2 ; this was modified from (a0) to #0 in Rev01 of Sonic 1 to nullify the following line
  5171. eor.b d2,d0 ; does nothing now (used to let you hold a button to prevent Sonic from jumping in demos)
  5172. move.b d1,(a0)+ ; save button press data from demo to Ctrl_1_Held
  5173. and.b d1,d0 ; does nothing now
  5174. move.b d0,(a0)+ ; save the same thing to Ctrl_1_Press
  5175. subq.b #1,(Demo_press_counter).w ; decrement counter until next press
  5176. bcc.s MoveDemo_On_P2 ; if it isn't 0 yet, branch
  5177. move.b 3(a1),(Demo_press_counter).w ; reset counter to length of next press
  5178. addq.w #2,(Demo_button_index).w ; advance to next button press
  5179. ; loc_4908:
  5180. MoveDemo_On_P2:
  5181. if emerald_hill_zone_act_1<$100 ; will it fit within a byte?
  5182. cmpi.b #emerald_hill_zone_act_1,(Current_Zone).w
  5183. else
  5184. cmpi.w #emerald_hill_zone_act_1,(Current_ZoneAndAct).w ; avoid a range overflow error
  5185. endif
  5186. bne.s MoveDemo_On_SkipP2 ; if it's not the EHZ demo, branch to skip player 2
  5187. lea (Demo_EHZ_Tails).l,a1
  5188.  
  5189. ; same as the corresponding remainder of MoveDemo_On_P1, but for player 2
  5190. move.w (Demo_button_index_2P).w,d0
  5191. adda.w d0,a1
  5192. move.b (a1),d0
  5193. lea (Ctrl_2_Held).w,a0
  5194. move.b d0,d1
  5195. moveq #0,d2
  5196. eor.b d2,d0
  5197. move.b d1,(a0)+
  5198. and.b d1,d0
  5199. move.b d0,(a0)+
  5200. subq.b #1,(Demo_press_counter_2P).w
  5201. bcc.s + ; rts
  5202. move.b 3(a1),(Demo_press_counter_2P).w
  5203. addq.w #2,(Demo_button_index_2P).w
  5204. +
  5205. rts
  5206. ; ===========================================================================
  5207. ; loc_4940:
  5208. MoveDemo_On_SkipP2:
  5209. move.w #0,(Ctrl_2).w
  5210. rts
  5211. ; End of function MoveSonicInDemo
  5212.  
  5213. ; ===========================================================================
  5214. ; ---------------------------------------------------------------------------
  5215. ; DEMO SCRIPT POINTERS
  5216.  
  5217. ; Contains an array of pointers to the script controlling the players actions
  5218. ; to use for each level.
  5219. ; ---------------------------------------------------------------------------
  5220. ; off_4948:
  5221. DemoScriptPointers: zoneOrderedTable 4,1
  5222. zoneTableEntry.l Demo_EHZ ; $00
  5223. zoneTableEntry.l Demo_EHZ ; $01
  5224. zoneTableEntry.l Demo_EHZ ; $02
  5225. zoneTableEntry.l Demo_EHZ ; $03
  5226. zoneTableEntry.l Demo_EHZ ; $04
  5227. zoneTableEntry.l Demo_EHZ ; $05
  5228. zoneTableEntry.l Demo_EHZ ; $06
  5229. zoneTableEntry.l Demo_EHZ ; $07
  5230. zoneTableEntry.l Demo_EHZ ; $08
  5231. zoneTableEntry.l Demo_EHZ ; $09
  5232. zoneTableEntry.l Demo_EHZ ; $0A
  5233. zoneTableEntry.l Demo_EHZ ; $0B
  5234. zoneTableEntry.l Demo_CNZ ; $0C
  5235. zoneTableEntry.l Demo_CPZ ; $0D
  5236. zoneTableEntry.l Demo_EHZ ; $0E
  5237. zoneTableEntry.l Demo_ARZ ; $0F
  5238. zoneTableEntry.l Demo_EHZ ; $10
  5239. zoneTableEnd
  5240. ; ---------------------------------------------------------------------------
  5241. ; dword_498C:
  5242. EndingDemoScriptPointers:
  5243. ; these values are invalid addresses, but they were used for the ending
  5244. ; demos, which aren't present in Sonic 2
  5245. dc.l $8B0837
  5246. dc.l $42085C ; 1
  5247. dc.l $6A085F ; 2
  5248. dc.l $2F082C ; 3
  5249. dc.l $210803 ; 4
  5250. dc.l $28300808 ; 5
  5251. dc.l $2E0815 ; 6
  5252. dc.l $F0846 ; 7
  5253. dc.l $1A08FF ; 8
  5254. dc.l $8CA0000 ; 9
  5255. dc.l 0 ; 10
  5256. dc.l 0 ; 11
  5257.  
  5258.  
  5259.  
  5260.  
  5261. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  5262.  
  5263. ; sub_49BC:
  5264. LoadCollisionIndexes:
  5265. moveq #0,d0
  5266. move.b (Current_Zone).w,d0
  5267. lsl.w #2,d0
  5268. move.l #Primary_Collision,(Collision_addr).w
  5269. move.w d0,-(sp)
  5270. movea.l Off_ColP(pc,d0.w),a0
  5271. lea (Primary_Collision).w,a1
  5272. bsr.w KosDec
  5273. move.w (sp)+,d0
  5274. movea.l Off_ColS(pc,d0.w),a0
  5275. lea (Secondary_Collision).w,a1
  5276. bra.w KosDec
  5277. ; End of function LoadCollisionIndexes
  5278.  
  5279. ; ===========================================================================
  5280. ; ---------------------------------------------------------------------------
  5281. ; Pointers to primary collision indexes
  5282.  
  5283. ; Contains an array of pointers to the primary collision index data for each
  5284. ; level. 1 pointer for each level, pointing the primary collision index.
  5285. ; ---------------------------------------------------------------------------
  5286. Off_ColP: zoneOrderedTable 4,1
  5287. zoneTableEntry.l ColP_EHZHTZ
  5288. zoneTableEntry.l ColP_Invalid ; 1
  5289. zoneTableEntry.l ColP_MTZ ; 2
  5290. zoneTableEntry.l ColP_Invalid ; 3
  5291. zoneTableEntry.l ColP_MTZ ; 4
  5292. zoneTableEntry.l ColP_MTZ ; 5
  5293. zoneTableEntry.l ColP_WFZSCZ ; 6
  5294. zoneTableEntry.l ColP_EHZHTZ ; 7
  5295. zoneTableEntry.l ColP_HPZ ; 8
  5296. zoneTableEntry.l ColP_Invalid ; 9
  5297. zoneTableEntry.l ColP_OOZ ; 10
  5298. zoneTableEntry.l ColP_MCZ ; 11
  5299. zoneTableEntry.l ColP_CNZ ; 12
  5300. zoneTableEntry.l ColP_CPZDEZ ; 13
  5301. zoneTableEntry.l ColP_CPZDEZ ; 14
  5302. zoneTableEntry.l ColP_ARZ ; 15
  5303. zoneTableEntry.l ColP_WFZSCZ ; 16
  5304. zoneTableEnd
  5305.  
  5306. ; ---------------------------------------------------------------------------
  5307. ; Pointers to secondary collision indexes
  5308.  
  5309. ; Contains an array of pointers to the secondary collision index data for
  5310. ; each level. 1 pointer for each level, pointing the secondary collision
  5311. ; index.
  5312. ; ---------------------------------------------------------------------------
  5313. Off_ColS: zoneOrderedTable 4,1
  5314. zoneTableEntry.l ColS_EHZHTZ
  5315. zoneTableEntry.l ColP_Invalid ; 1
  5316. zoneTableEntry.l ColP_MTZ ; 2
  5317. zoneTableEntry.l ColP_Invalid ; 3
  5318. zoneTableEntry.l ColP_MTZ ; 4
  5319. zoneTableEntry.l ColP_MTZ ; 5
  5320. zoneTableEntry.l ColS_WFZSCZ ; 6
  5321. zoneTableEntry.l ColS_EHZHTZ ; 7
  5322. zoneTableEntry.l ColS_HPZ ; 8
  5323. zoneTableEntry.l ColP_Invalid ; 9
  5324. zoneTableEntry.l ColP_OOZ ; 10
  5325. zoneTableEntry.l ColP_MCZ ; 11
  5326. zoneTableEntry.l ColS_CNZ ; 12
  5327. zoneTableEntry.l ColS_CPZDEZ ; 13
  5328. zoneTableEntry.l ColS_CPZDEZ ; 14
  5329. zoneTableEntry.l ColS_ARZ ; 15
  5330. zoneTableEntry.l ColS_WFZSCZ ; 16
  5331. zoneTableEnd
  5332.  
  5333.  
  5334. ; ---------------------------------------------------------------------------
  5335. ; Oscillating number subroutine
  5336. ; ---------------------------------------------------------------------------
  5337.  
  5338. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  5339.  
  5340. ; sub_4A70:
  5341. OscillateNumInit:
  5342. lea (Oscillating_Numbers).w,a1
  5343. lea (Osc_Data).l,a2
  5344. moveq #bytesToWcnt(Osc_Data_End-Osc_Data),d1
  5345. ; loc_4A7C:
  5346. Osc_Loop:
  5347. move.w (a2)+,(a1)+
  5348. dbf d1,Osc_Loop
  5349. rts
  5350. ; End of function OscillateNumInit
  5351.  
  5352. ; ===========================================================================
  5353. ; word_4A84:
  5354. Osc_Data:
  5355. dc.w %0000000001111101 ; oscillation direction bitfield
  5356. dc.w $80, 0 ; baseline values
  5357. dc.w $80, 0
  5358. dc.w $80, 0
  5359. dc.w $80, 0
  5360. dc.w $80, 0
  5361. dc.w $80, 0
  5362. dc.w $80, 0
  5363. dc.w $80, 0
  5364. dc.w $80, 0
  5365. dc.w $3848, $EE
  5366. dc.w $2080, $B4
  5367. dc.w $3080,$10E
  5368. dc.w $5080,$1C2
  5369. dc.w $7080,$276
  5370. dc.w $80, 0
  5371. dc.w $4000, $FE
  5372. Osc_Data_End:
  5373.  
  5374. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  5375.  
  5376. ; sub_4AC6:
  5377. OscillateNumDo:
  5378. tst.w (Two_player_mode).w
  5379. bne.s +
  5380. cmpi.b #6,(MainCharacter+routine).w
  5381. bhs.s OscillateNumDo_Return
  5382. +
  5383. lea (Oscillating_Numbers).w,a1
  5384. lea (Osc_Data2).l,a2
  5385. move.w (a1)+,d3
  5386. moveq #bytesToLcnt(Osc_Data2_End-Osc_Data2),d1
  5387.  
  5388. - move.w (a2)+,d2
  5389. move.w (a2)+,d4
  5390. btst d1,d3
  5391. bne.s +
  5392. move.w 2(a1),d0
  5393. add.w d2,d0
  5394. move.w d0,2(a1)
  5395. _add.w d0,0(a1)
  5396. _cmp.b 0(a1),d4
  5397. bhi.s ++
  5398. bset d1,d3
  5399. bra.s ++
  5400. ; ===========================================================================
  5401. +
  5402. move.w 2(a1),d0
  5403. sub.w d2,d0
  5404. move.w d0,2(a1)
  5405. _add.w d0,0(a1)
  5406. _cmp.b 0(a1),d4
  5407. bls.s +
  5408. bclr d1,d3
  5409. +
  5410. addq.w #4,a1
  5411. dbf d1,-
  5412.  
  5413. move.w d3,(Oscillation_Control).w
  5414. ; return_4B22:
  5415. OscillateNumDo_Return:
  5416. rts
  5417. ; End of function OscillateNumDo
  5418.  
  5419. ; ===========================================================================
  5420. ; word_4B24:
  5421. Osc_Data2:
  5422. dc.w 2, $10
  5423. dc.w 2, $18
  5424. dc.w 2, $20
  5425. dc.w 2, $30
  5426. dc.w 4, $20
  5427. dc.w 8, 8
  5428. dc.w 8, $40
  5429. dc.w 4, $40
  5430. dc.w 2, $38
  5431. dc.w 2, $38
  5432. dc.w 2, $20
  5433. dc.w 3, $30
  5434. dc.w 5, $50
  5435. dc.w 7, $70
  5436. dc.w 2, $40
  5437. dc.w 2, $40
  5438. Osc_Data2_End:
  5439.  
  5440.  
  5441.  
  5442. ; ---------------------------------------------------------------------------
  5443. ; Subroutine to change global object animation variables (like rings)
  5444. ; ---------------------------------------------------------------------------
  5445.  
  5446. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  5447.  
  5448. ; sub_4B64:
  5449. ChangeRingFrame:
  5450. subq.b #1,(Logspike_anim_counter).w
  5451. bpl.s +
  5452. move.b #$B,(Logspike_anim_counter).w
  5453. subq.b #1,(Logspike_anim_frame).w ; animate unused log spikes
  5454. andi.b #7,(Logspike_anim_frame).w
  5455. +
  5456. subq.b #1,(Rings_anim_counter).w
  5457. bpl.s +
  5458. move.b #7,(Rings_anim_counter).w
  5459. addq.b #1,(Rings_anim_frame).w ; animate rings in the level (obj25)
  5460. andi.b #3,(Rings_anim_frame).w
  5461. +
  5462. subq.b #1,(Unknown_anim_counter).w
  5463. bpl.s +
  5464. move.b #7,(Unknown_anim_counter).w
  5465. addq.b #1,(Unknown_anim_frame).w ; animate nothing (deleted special stage object is my best guess)
  5466. cmpi.b #6,(Unknown_anim_frame).w
  5467. blo.s +
  5468. move.b #0,(Unknown_anim_frame).w
  5469. +
  5470. tst.b (Ring_spill_anim_counter).w
  5471. beq.s + ; rts
  5472. moveq #0,d0
  5473. move.b (Ring_spill_anim_counter).w,d0
  5474. add.w (Ring_spill_anim_accum).w,d0
  5475. move.w d0,(Ring_spill_anim_accum).w
  5476. rol.w #7,d0
  5477. andi.w #3,d0
  5478. move.b d0,(Ring_spill_anim_frame).w ; animate scattered rings (obj37)
  5479. subq.b #1,(Ring_spill_anim_counter).w
  5480. +
  5481. rts
  5482. ; End of function ChangeRingFrame
  5483.  
  5484.  
  5485.  
  5486.  
  5487. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  5488.  
  5489. nosignpost macro actid
  5490. cmpi.w #actid,(Current_ZoneAndAct).w
  5491. beq.ATTRIBUTE + ; rts
  5492. endm
  5493.  
  5494. ; sub_4BD2:
  5495. SetLevelEndType:
  5496. move.w #0,(Level_Has_Signpost).w ; set level type to non-signpost
  5497. tst.w (Two_player_mode).w ; is it two-player competitive mode?
  5498. bne.s LevelEnd_SetSignpost ; if yes, branch
  5499. nosignpost.w emerald_hill_zone_act_2
  5500. nosignpost.w metropolis_zone_act_3
  5501. nosignpost.w wing_fortress_zone_act_1
  5502. nosignpost.w hill_top_zone_act_2
  5503. nosignpost.w oil_ocean_zone_act_2
  5504. nosignpost.s mystic_cave_zone_act_2
  5505. nosignpost.s casino_night_zone_act_2
  5506. nosignpost.s chemical_plant_zone_act_2
  5507. nosignpost.s death_egg_zone_act_1
  5508. nosignpost.s aquatic_ruin_zone_act_2
  5509. nosignpost.s sky_chase_zone_act_1
  5510.  
  5511. ; loc_4C40:
  5512. LevelEnd_SetSignpost:
  5513. move.w #1,(Level_Has_Signpost).w ; set level type to signpost
  5514. + rts
  5515. ; End of function SetLevelEndType
  5516.  
  5517.  
  5518. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  5519.  
  5520. ; sub_4C48:
  5521. CheckLoadSignpostArt:
  5522. tst.w (Level_Has_Signpost).w
  5523. beq.s + ; rts
  5524. tst.w (Debug_placement_mode).w
  5525. bne.s + ; rts
  5526. move.w (Camera_X_pos).w,d0
  5527. move.w (Camera_Max_X_pos).w,d1
  5528. subi.w #$100,d1
  5529. cmp.w d1,d0
  5530. blt.s SignpostUpdateTailsBounds
  5531. tst.b (Update_HUD_timer).w
  5532. beq.s SignpostUpdateTailsBounds
  5533. cmp.w (Camera_Min_X_pos).w,d1
  5534. beq.s SignpostUpdateTailsBounds
  5535. move.w d1,(Camera_Min_X_pos).w ; prevent camera from scrolling back to the left
  5536. tst.w (Two_player_mode).w
  5537. bne.s + ; rts
  5538. moveq #PLCID_Signpost,d0 ; <== PLC_1F
  5539. bra.w LoadPLC2 ; load signpost art
  5540. ; ---------------------------------------------------------------------------
  5541. ; loc_4C80:
  5542. SignpostUpdateTailsBounds:
  5543. tst.w (Two_player_mode).w
  5544. beq.s + ; rts
  5545. move.w (Camera_X_pos_P2).w,d0
  5546. move.w (Tails_Max_X_pos).w,d1
  5547. subi.w #$100,d1
  5548. cmp.w d1,d0
  5549. blt.s + ; rts
  5550. tst.b (Update_HUD_timer_2P).w
  5551. beq.s + ; rts
  5552. cmp.w (Tails_Min_X_pos).w,d1
  5553. beq.s + ; rts
  5554. move.w d1,(Tails_Min_X_pos).w ; prevent Tails from going past new left boundary
  5555. + rts
  5556. ; End of function CheckLoadSignpostArt
  5557.  
  5558.  
  5559.  
  5560.  
  5561. ; ===========================================================================
  5562. ; macro to simplify editing the demo scripts
  5563. demoinput macro buttons,duration
  5564. btns_mask := 0
  5565. idx := 0
  5566. rept strlen("buttons")
  5567. btn := substr("buttons",idx,1)
  5568. switch btn
  5569. case "U"
  5570. btns_mask := btns_mask|button_up_mask
  5571. case "D"
  5572. btns_mask := btns_mask|button_down_mask
  5573. case "L"
  5574. btns_mask := btns_mask|button_left_mask
  5575. case "R"
  5576. btns_mask := btns_mask|button_right_mask
  5577. case "A"
  5578. btns_mask := btns_mask|button_A_mask
  5579. case "B"
  5580. btns_mask := btns_mask|button_B_mask
  5581. case "C"
  5582. btns_mask := btns_mask|button_C_mask
  5583. case "S"
  5584. btns_mask := btns_mask|button_start_mask
  5585. endcase
  5586. idx := idx+1
  5587. endm
  5588. dc.b btns_mask,duration-1
  5589. endm
  5590. ; ---------------------------------------------------------------------------
  5591. ; EHZ Demo Script (Sonic)
  5592. ; ---------------------------------------------------------------------------
  5593. ; byte_4CA8: Demo_Def:
  5594. Demo_EHZ:
  5595. demoinput , $4C
  5596. demoinput R, $43
  5597. demoinput RC, 9
  5598. demoinput R, $3F
  5599. demoinput RC, 6
  5600. demoinput R, $B0
  5601. demoinput RC, $A
  5602. demoinput R, $46
  5603. demoinput , $1E
  5604. demoinput L, $F
  5605. demoinput , 5
  5606. demoinput L, 5
  5607. demoinput , 9
  5608. demoinput L, $3F
  5609. demoinput , 5
  5610. demoinput R, $67
  5611. demoinput , $62
  5612. demoinput R, $12
  5613. demoinput , $22
  5614. demoinput D, 8
  5615. demoinput DC, 7
  5616. demoinput D, $E
  5617. demoinput , $3C
  5618. demoinput R, $A
  5619. demoinput , $1E
  5620. demoinput D, 7
  5621. demoinput DC, 7
  5622. demoinput D, 2
  5623. demoinput , $F
  5624. demoinput R, $100
  5625. demoinput R, $2F
  5626. demoinput , $23
  5627. demoinput C, 8
  5628. demoinput RC, $10
  5629. demoinput R, 3
  5630. demoinput , $30
  5631. demoinput RC, $24
  5632. demoinput R, $BE
  5633. demoinput , $C
  5634. demoinput L, $14
  5635. demoinput , $17
  5636. demoinput D, 3
  5637. demoinput DC, 7
  5638. demoinput D, 3
  5639. demoinput , $64
  5640. demoinput S, 1
  5641. demoinput A, 1
  5642. demoinput , 1
  5643. ; ---------------------------------------------------------------------------
  5644. ; EHZ Demo Script (Tails)
  5645. ; ---------------------------------------------------------------------------
  5646. ; byte_4D08:
  5647. Demo_EHZ_Tails:
  5648. demoinput , $3C
  5649. demoinput R, $10
  5650. demoinput UR, $44
  5651. demoinput URC, $7
  5652. demoinput UR, $7
  5653. demoinput R, $CA
  5654. demoinput , $12
  5655. demoinput R, $2
  5656. demoinput RC, $9
  5657. demoinput R, $53
  5658. demoinput , $12
  5659. demoinput R, $B
  5660. demoinput RC, $F
  5661. demoinput R, $24
  5662. demoinput , $B
  5663. demoinput C, $5
  5664. demoinput , $E
  5665. demoinput R, $56
  5666. demoinput , $1F
  5667. demoinput R, $5B
  5668. demoinput , $11
  5669. demoinput R, $100
  5670. demoinput R, $C1
  5671. demoinput , $21
  5672. demoinput L, $E
  5673. demoinput , $E
  5674. demoinput C, $5
  5675. demoinput RC, $10
  5676. demoinput C, $6
  5677. demoinput , $D
  5678. demoinput L, $6
  5679. demoinput , $5F
  5680. demoinput R, $74
  5681. demoinput , $19
  5682. demoinput L, $45
  5683. demoinput , $9
  5684. demoinput D, $31
  5685. demoinput , $9
  5686. demoinput R, $E
  5687. demoinput , $24
  5688. demoinput R, $28
  5689. demoinput , $5
  5690. demoinput R, $1
  5691. demoinput , $1
  5692. demoinput , $1
  5693. demoinput , $1
  5694. demoinput , $1
  5695. demoinput , $1
  5696. ; ---------------------------------------------------------------------------
  5697. ; CNZ Demo Script
  5698. ; ---------------------------------------------------------------------------
  5699. Demo_CNZ:
  5700. demoinput , $49
  5701. demoinput R, $11
  5702. demoinput UR, 1
  5703. demoinput R, 2
  5704. demoinput UR, 7
  5705. demoinput R, $61
  5706. demoinput RC, 6
  5707. demoinput C, 2
  5708. demoinput , 9
  5709. demoinput L, 3
  5710. demoinput DL, 4
  5711. demoinput L, 2
  5712. demoinput , $1A
  5713. demoinput R, $12
  5714. demoinput RC, $1A
  5715. demoinput C, 5
  5716. demoinput RC, $24
  5717. demoinput R, $1B
  5718. demoinput , 8
  5719. demoinput L, $11
  5720. demoinput , $F
  5721. demoinput R, $78
  5722. demoinput RC, $17
  5723. demoinput C, 1
  5724. demoinput , $10
  5725. demoinput L, $12
  5726. demoinput , 8
  5727. demoinput R, $53
  5728. demoinput , $70
  5729. demoinput R, $75
  5730. demoinput , $38
  5731. demoinput R, $17
  5732. demoinput , 5
  5733. demoinput L, $27
  5734. demoinput , $D
  5735. demoinput L, $13
  5736. demoinput , $6A
  5737. demoinput C, $11
  5738. demoinput RC, 3
  5739. demoinput DRC, 6
  5740. demoinput DR, $15
  5741. demoinput R, 6
  5742. demoinput , 6
  5743. demoinput L, $D
  5744. demoinput , $49
  5745. demoinput L, $A
  5746. demoinput , $1F
  5747. demoinput R, 7
  5748. demoinput , $30
  5749. demoinput L, 2
  5750. demoinput , $100
  5751. demoinput , $50
  5752. demoinput R, 1
  5753. demoinput RC, $C
  5754. demoinput R, $2B
  5755. demoinput , $5F
  5756. ; ---------------------------------------------------------------------------
  5757. ; CPZ Demo Script
  5758. ; ---------------------------------------------------------------------------
  5759. Demo_CPZ:
  5760. demoinput , $47
  5761. demoinput R, $1C
  5762. demoinput RC, 8
  5763. demoinput R, $A
  5764. demoinput , $1C
  5765. demoinput R, $E
  5766. demoinput RC, $29
  5767. demoinput R, $100
  5768. demoinput R, $E8
  5769. demoinput DR, 5
  5770. demoinput D, 2
  5771. demoinput L, $34
  5772. demoinput DL, $68
  5773. demoinput L, 1
  5774. demoinput , $16
  5775. demoinput C, 1
  5776. demoinput LC, 8
  5777. demoinput L, $F
  5778. demoinput , $18
  5779. demoinput R, 2
  5780. demoinput DR, 2
  5781. demoinput R, $D
  5782. demoinput , $20
  5783. demoinput RC, 7
  5784. demoinput R, $B
  5785. demoinput , $1C
  5786. demoinput L, $E
  5787. demoinput , $1D
  5788. demoinput L, 7
  5789. demoinput , $100
  5790. demoinput , $E0
  5791. demoinput R, $F
  5792. demoinput , $1D
  5793. demoinput L, 3
  5794. demoinput , $26
  5795. demoinput R, 7
  5796. demoinput , 7
  5797. demoinput C, 5
  5798. demoinput , $29
  5799. demoinput L, $12
  5800. demoinput , $18
  5801. demoinput R, $1A
  5802. demoinput , $11
  5803. demoinput L, $2E
  5804. demoinput , $14
  5805. demoinput S, 1
  5806. demoinput A, 1
  5807. demoinput , 1
  5808. ; ---------------------------------------------------------------------------
  5809. ; ARZ Demo Script
  5810. ; ---------------------------------------------------------------------------
  5811. Demo_ARZ:
  5812. demoinput , $43
  5813. demoinput R, $4B
  5814. demoinput RC, 9
  5815. demoinput R, $50
  5816. demoinput RC, $C
  5817. demoinput R, 6
  5818. demoinput , $1B
  5819. demoinput R, $61
  5820. demoinput RC, $15
  5821. demoinput R, $55
  5822. demoinput , $41
  5823. demoinput R, 5
  5824. demoinput UR, 1
  5825. demoinput R, $5C
  5826. demoinput , $47
  5827. demoinput R, $3C
  5828. demoinput RC, 9
  5829. demoinput R, $28
  5830. demoinput , $B
  5831. demoinput R, $93
  5832. demoinput RC, $33
  5833. demoinput R, $23
  5834. demoinput , $23
  5835. demoinput R, $4D
  5836. demoinput , $1F
  5837. demoinput L, 2
  5838. demoinput UL, 3
  5839. demoinput L, 1
  5840. demoinput , $B
  5841. demoinput L, $D
  5842. demoinput , $11
  5843. demoinput R, 6
  5844. demoinput , $62
  5845. demoinput R, 4
  5846. demoinput RC, 6
  5847. demoinput R, $17
  5848. demoinput , $1C
  5849. demoinput R, $57
  5850. demoinput RC, $B
  5851. demoinput R, $17
  5852. demoinput , $16
  5853. demoinput R, $D
  5854. demoinput , $2C
  5855. demoinput C, 2
  5856. demoinput RC, $1B
  5857. demoinput R, $83
  5858. demoinput , $C
  5859. demoinput S, 1
  5860.  
  5861. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  5862.  
  5863.  
  5864.  
  5865. ;sub_4E98:
  5866. LoadZoneTiles:
  5867. moveq #0,d0
  5868. move.b (Current_Zone).w,d0
  5869. add.w d0,d0
  5870. add.w d0,d0
  5871. move.w d0,d1
  5872. add.w d0,d0
  5873. add.w d1,d0
  5874. lea (LevelArtPointers).l,a2
  5875. lea (a2,d0.w),a2
  5876. move.l (a2)+,d0
  5877. andi.l #$FFFFFF,d0 ; 8x8 tile pointer
  5878. movea.l d0,a0
  5879. lea (Chunk_Table).l,a1
  5880. bsr.w KosDec
  5881. move.w a1,d3
  5882. cmpi.b #hill_top_zone,(Current_Zone).w
  5883. bne.s +
  5884. lea (ArtKos_HTZ).l,a0
  5885. lea (Chunk_Table+tiles_to_bytes(ArtTile_ArtKos_NumTiles_HTZ_Main)).l,a1
  5886. bsr.w KosDec ; patch for HTZ
  5887. move.w #tiles_to_bytes(ArtTile_ArtKos_NumTiles_HTZ),d3
  5888. +
  5889. cmpi.b #wing_fortress_zone,(Current_Zone).w
  5890. bne.s +
  5891. lea (ArtKos_WFZ).l,a0
  5892. lea (Chunk_Table+tiles_to_bytes(ArtTile_ArtKos_NumTiles_WFZ_Main)).l,a1
  5893. bsr.w KosDec ; patch for WFZ
  5894. move.w #tiles_to_bytes(ArtTile_ArtKos_NumTiles_WFZ),d3
  5895. +
  5896. cmpi.b #death_egg_zone,(Current_Zone).w
  5897. bne.s +
  5898. move.w #tiles_to_bytes(ArtTile_ArtKos_NumTiles_DEZ),d3
  5899. +
  5900. move.w d3,d7
  5901. andi.w #$FFF,d3
  5902. lsr.w #1,d3
  5903. rol.w #4,d7
  5904. andi.w #$F,d7
  5905.  
  5906. - move.w d7,d2
  5907. lsl.w #7,d2
  5908. lsl.w #5,d2
  5909. move.l #$FFFFFF,d1
  5910. move.w d2,d1
  5911. jsr (QueueDMATransfer).l
  5912. move.w d7,-(sp)
  5913. move.b #VintID_TitleCard,(Vint_routine).w
  5914. bsr.w WaitForVint
  5915. bsr.w RunPLC_RAM
  5916. move.w (sp)+,d7
  5917. move.w #$800,d3
  5918. dbf d7,-
  5919.  
  5920. rts
  5921. ; End of function LoadZoneTiles
  5922.  
  5923. ; ===========================================================================
  5924.  
  5925. if gameRevision<2
  5926. nop
  5927. endif
  5928.  
  5929. if ~~removeJmpTos
  5930. JmpTo_loadZoneBlockMaps
  5931. jmp (loadZoneBlockMaps).l
  5932. JmpTo_DeformBgLayer
  5933. jmp (DeformBgLayer).l
  5934. JmpTo_AniArt_Load
  5935. jmp (AniArt_Load).l
  5936. JmpTo_DrawInitialBG
  5937. jmp (DrawInitialBG).l
  5938.  
  5939. align 4
  5940. endif
  5941.  
  5942.  
  5943.  
  5944.  
  5945. ; ===========================================================================
  5946. ; loc_4F64:
  5947. SpecialStage:
  5948. cmpi.b #7,(Current_Special_Stage).w
  5949. blo.s +
  5950. move.b #0,(Current_Special_Stage).w
  5951. +
  5952. move.w #SndID_SpecStageEntry,d0 ; play that funky special stage entry sound
  5953. bsr.w PlaySound
  5954. move.b #MusID_FadeOut,d0 ; fade out the music
  5955. bsr.w PlayMusic
  5956. bsr.w Pal_FadeToWhite
  5957. tst.w (Two_player_mode).w
  5958. beq.s +
  5959. move.w #0,(Two_player_mode).w
  5960. st.b (SS_2p_Flag).w ; set to -1
  5961. bra.s ++
  5962. ; ===========================================================================
  5963. +
  5964. sf.b (SS_2p_Flag).w ; set to 0
  5965. ; (!)
  5966. +
  5967. move #$2700,sr ; Mask all interrupts
  5968. lea (VDP_control_port).l,a6
  5969. move.w #$8B03,(a6) ; EXT-INT disabled, V scroll by screen, H scroll by line
  5970. move.w #$8004,(a6) ; H-INT disabled
  5971. move.w #$8ADF,(Hint_counter_reserve).w ; H-INT every 224th scanline
  5972. move.w #$8200|(VRAM_SS_Plane_A_Name_Table1/$400),(a6) ; PNT A base: $C000
  5973. move.w #$8400|(VRAM_SS_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $A000
  5974. move.w #$8C08,(a6) ; H res 32 cells, no interlace, S/H enabled
  5975. move.w #$9003,(a6) ; Scroll table size: 128x32
  5976. move.w #$8700,(a6) ; Background palette/color: 0/0
  5977. move.w #$8D00|(VRAM_SS_Horiz_Scroll_Table/$400),(a6) ; H scroll table base: $FC00
  5978. move.w #$8500|(VRAM_SS_Sprite_Attribute_Table/$200),(a6) ; Sprite attribute table base: $F800
  5979. move.w (VDP_Reg1_val).w,d0
  5980. andi.b #$BF,d0
  5981. move.w d0,(VDP_control_port).l
  5982.  
  5983. ; /------------------------------------------------------------------------\
  5984. ; | We're gonna zero-fill a bunch of VRAM regions. This was done by macro, |
  5985. ; | so there's gonna be a lot of wasted cycles. |
  5986. ; \------------------------------------------------------------------------/
  5987.  
  5988. dmaFillVRAM 0,VRAM_SS_Plane_A_Name_Table2,VRAM_SS_Plane_Table_Size ; clear Plane A pattern name table 1
  5989. dmaFillVRAM 0,VRAM_SS_Plane_A_Name_Table1,VRAM_SS_Plane_Table_Size ; clear Plane A pattern name table 2
  5990. dmaFillVRAM 0,VRAM_SS_Plane_B_Name_Table,VRAM_SS_Plane_Table_Size ; clear Plane B pattern name table
  5991. dmaFillVRAM 0,VRAM_SS_Horiz_Scroll_Table,VRAM_SS_Horiz_Scroll_Table_Size ; clear Horizontal scroll table
  5992.  
  5993. clr.l (Vscroll_Factor).w
  5994. clr.l (unk_F61A).w
  5995. clr.b (SpecialStage_Started).w
  5996.  
  5997. ; /------------------------------------------------------------------------\
  5998. ; | Now we clear out some regions in main RAM where we want to store some |
  5999. ; | of our data structures. |
  6000. ; \------------------------------------------------------------------------/
  6001. ; Bug: These '+4's shouldn't be here; clearRAM accidentally clears an additional 4 bytes
  6002. clearRAM SS_Sprite_Table,SS_Sprite_Table_End+4
  6003. clearRAM SS_Horiz_Scroll_Buf_1,SS_Horiz_Scroll_Buf_1_End+4
  6004. clearRAM SS_Misc_Variables,SS_Misc_Variables_End+4
  6005. clearRAM SS_Sprite_Table_Input,SS_Sprite_Table_Input_End
  6006. clearRAM SS_Object_RAM,SS_Object_RAM_End
  6007.  
  6008. move #$2300,sr
  6009. lea (VDP_control_port).l,a6
  6010. move.w #$8F02,(a6) ; VRAM pointer increment: $0002
  6011. bsr.w ssInitTableBuffers
  6012. bsr.w ssLdComprsdData
  6013. move.w #0,(SpecialStage_CurrentSegment).w
  6014. moveq #PLCID_SpecialStage,d0
  6015. bsr.w RunPLC_ROM
  6016. clr.b (Level_started_flag).w
  6017. move.l #0,(Camera_X_pos).w ; probably means something else in this context
  6018. move.l #0,(Camera_Y_pos).w
  6019. move.l #0,(Camera_X_pos_copy).w
  6020. move.l #0,(Camera_Y_pos_copy).w
  6021. cmpi.w #1,(Player_mode).w ; is this a Tails alone game?
  6022. bgt.s + ; if yes, branch
  6023. move.b #ObjID_SonicSS,(MainCharacter+id).w ; load Obj09 (special stage Sonic)
  6024. tst.w (Player_mode).w ; is this a Sonic and Tails game?
  6025. bne.s ++ ; if not, branch
  6026. + move.b #ObjID_TailsSS,(Sidekick+id).w ; load Obj10 (special stage Tails)
  6027. + move.b #ObjID_SSHUD,(SpecialStageHUD+id).w ; load Obj5E (special stage HUD)
  6028. move.b #ObjID_StartBanner,(SpecialStageStartBanner+id).w ; load Obj5F (special stage banner)
  6029. move.b #ObjID_SSNumberOfRings,(SpecialStageNumberOfRings+id).w ; load Obj87 (special stage ring count)
  6030. move.w #$80,(SS_Offset_X).w
  6031. move.w #$36,(SS_Offset_Y).w
  6032. bsr.w SSPlaneB_Background
  6033. bsr.w SSDecompressPlayerArt
  6034. bsr.w SSInitPalAndData
  6035. move.l #$C0000,(SS_New_Speed_Factor).w
  6036. clr.w (Ctrl_1_Logical).w
  6037. clr.w (Ctrl_2_Logical).w
  6038.  
  6039. - move.b #VintID_S2SS,(Vint_routine).w
  6040. bsr.w WaitForVint
  6041. move.b (SSTrack_drawing_index).w,d0
  6042. bne.s -
  6043.  
  6044. bsr.w SSTrack_Draw
  6045.  
  6046. - move.b #VintID_S2SS,(Vint_routine).w
  6047. bsr.w WaitForVint
  6048. bsr.w SSTrack_Draw
  6049. bsr.w SSLoadCurrentPerspective
  6050. bsr.w SSObjectsManager
  6051. move.b (SSTrack_duration_timer).w,d0
  6052. subq.w #1,d0
  6053. bne.s -
  6054.  
  6055. jsr (Obj5A_CreateRingsToGoText).l
  6056. bsr.w SS_ScrollBG
  6057. jsr (RunObjects).l
  6058. jsr (BuildSprites).l
  6059. bsr.w RunPLC_RAM
  6060. move.b #VintID_CtrlDMA,(Vint_routine).w
  6061. bsr.w WaitForVint
  6062. move.w #MusID_SpecStage,d0
  6063. bsr.w PlayMusic
  6064. move.w (VDP_Reg1_val).w,d0
  6065. ori.b #$40,d0
  6066. move.w d0,(VDP_control_port).l
  6067. bsr.w Pal_FadeFromWhite
  6068.  
  6069. - bsr.w PauseGame
  6070. move.w (Ctrl_1).w,(Ctrl_1_Logical).w
  6071. move.w (Ctrl_2).w,(Ctrl_2_Logical).w
  6072. cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; special stage mode?
  6073. bne.w SpecialStage_Unpause ; if not, branch
  6074. move.b #VintID_S2SS,(Vint_routine).w
  6075. bsr.w WaitForVint
  6076. bsr.w SSTrack_Draw
  6077. bsr.w SSSetGeometryOffsets
  6078. bsr.w SSLoadCurrentPerspective
  6079. bsr.w SSObjectsManager
  6080. bsr.w SS_ScrollBG
  6081. jsr (RunObjects).l
  6082. jsr (BuildSprites).l
  6083. bsr.w RunPLC_RAM
  6084. tst.b (SpecialStage_Started).w
  6085. beq.s -
  6086.  
  6087. moveq #PLCID_SpecStageBombs,d0
  6088. bsr.w LoadPLC
  6089.  
  6090. - bsr.w PauseGame
  6091. cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; special stage mode?
  6092. bne.w SpecialStage_Unpause ; if not, branch
  6093. move.b #VintID_S2SS,(Vint_routine).w
  6094. bsr.w WaitForVint
  6095. bsr.w SSTrack_Draw
  6096. bsr.w SSSetGeometryOffsets
  6097. bsr.w SSLoadCurrentPerspective
  6098. bsr.w SSObjectsManager
  6099. bsr.w SS_ScrollBG
  6100. bsr.w PalCycle_SS
  6101. tst.b (SS_Pause_Only_flag).w
  6102. beq.s +
  6103. move.w (Ctrl_1).w,d0
  6104. andi.w #(button_start_mask<<8)|button_start_mask,d0
  6105. move.w d0,(Ctrl_1_Logical).w
  6106. move.w (Ctrl_2).w,d0
  6107. andi.w #(button_start_mask<<8)|button_start_mask,d0
  6108. move.w d0,(Ctrl_2_Logical).w
  6109. bra.s ++
  6110. ; ===========================================================================
  6111. +
  6112. move.w (Ctrl_1).w,(Ctrl_1_Logical).w
  6113. move.w (Ctrl_2).w,(Ctrl_2_Logical).w
  6114. +
  6115. jsr (RunObjects).l
  6116. tst.b (SS_Check_Rings_flag).w
  6117. bne.s +
  6118. jsr (BuildSprites).l
  6119. bsr.w RunPLC_RAM
  6120. bra.s -
  6121. ; ===========================================================================
  6122. +
  6123. andi.b #7,(Emerald_count).w
  6124. tst.b (SS_2p_Flag).w
  6125. beq.s +
  6126. lea (SS2p_RingBuffer).w,a0
  6127. move.w (a0)+,d0
  6128. add.w (a0)+,d0
  6129. add.w (a0)+,d0
  6130. add.w (a0)+,d0
  6131. add.w (a0)+,d0
  6132. add.w (a0)+,d0
  6133. bra.s ++
  6134. ; ===========================================================================
  6135. +
  6136. move.w (Ring_count).w,d0
  6137. add.w (Ring_count_2P).w,d0
  6138. +
  6139. cmp.w (SS_Perfect_rings_left).w,d0
  6140. bne.s +
  6141. st.b (Perfect_rings_flag).w
  6142. +
  6143. bsr.w Pal_FadeToWhite
  6144. tst.w (Two_player_mode_copy).w
  6145. bne.w loc_540C
  6146. move #$2700,sr
  6147. lea (VDP_control_port).l,a6
  6148. move.w #$8200|(VRAM_Menu_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  6149. move.w #$8400|(VRAM_Menu_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $E000
  6150. move.w #$9001,(a6) ; Scroll table size: 64x32
  6151. move.w #$8C81,(a6) ; H res 40 cells, no interlace, S/H disabled
  6152. bsr.w ClearScreen
  6153. jsrto (Hud_Base).l, JmpTo_Hud_Base
  6154. clr.w (VDP_Command_Buffer).w
  6155. move.l #VDP_Command_Buffer,(VDP_Command_Buffer_Slot).w
  6156. move #$2300,sr
  6157. moveq #PalID_Result,d0
  6158. bsr.w PalLoad_Now
  6159. moveq #PLCID_Std1,d0
  6160. bsr.w LoadPLC2
  6161. move.l #vdpComm(tiles_to_bytes(ArtTile_VRAM_Start+2),VRAM,WRITE),d0
  6162. lea SpecialStage_ResultsLetters(pc),a0
  6163. jsrto (LoadTitleCardSS).l, JmpTo_LoadTitleCardSS
  6164. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_SpecialStageResults),VRAM,WRITE),(VDP_control_port).l
  6165. lea (ArtNem_SpecialStageResults).l,a0
  6166. bsr.w NemDec
  6167. move.w (Player_mode).w,d0
  6168. beq.s ++
  6169. subq.w #1,d0
  6170. beq.s +
  6171. clr.w (Ring_count).w
  6172. bra.s ++
  6173. ; ===========================================================================
  6174. +
  6175. clr.w (Ring_count_2P).w
  6176. +
  6177. move.w (Ring_count).w,(Bonus_Countdown_1).w
  6178. move.w (Ring_count_2P).w,(Bonus_Countdown_2).w
  6179. clr.w (Total_Bonus_Countdown).w
  6180. tst.b (Got_Emerald).w
  6181. beq.s +
  6182. move.w #1000,(Total_Bonus_Countdown).w
  6183. +
  6184. move.b #1,(Update_HUD_score).w
  6185. move.b #1,(Update_Bonus_score).w
  6186. move.w #MusID_EndLevel,d0
  6187. jsr (PlaySound).l
  6188.  
  6189. clearRAM SS_Sprite_Table_Input,SS_Sprite_Table_Input_End
  6190. clearRAM SS_Object_RAM,SS_Object_RAM_End
  6191.  
  6192. move.b #ObjID_SSResults,(SpecialStageResults+id).w ; load Obj6F (special stage results) at $FFFFB800
  6193. -
  6194. move.b #VintID_Level,(Vint_routine).w
  6195. bsr.w WaitForVint
  6196. jsr (RunObjects).l
  6197. jsr (BuildSprites).l
  6198. bsr.w RunPLC_RAM
  6199. tst.w (Level_Inactive_flag).w
  6200. beq.s -
  6201. tst.l (Plc_Buffer).w
  6202. bne.s -
  6203. move.w #SndID_SpecStageEntry,d0
  6204. bsr.w PlaySound
  6205. bsr.w Pal_FadeToWhite
  6206. tst.w (Two_player_mode_copy).w
  6207. bne.s loc_540C
  6208. move.b #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
  6209. rts
  6210. ; ===========================================================================
  6211.  
  6212. loc_540C:
  6213. move.w #VsRSID_SS,(Results_Screen_2P).w
  6214. move.b #GameModeID_2PResults,(Game_Mode).w ; => TwoPlayerResults
  6215. rts
  6216. ; ===========================================================================
  6217.  
  6218. ; loc_541A:
  6219. SpecialStage_Unpause:
  6220. move.b #MusID_Unpause,(Music_to_play).w
  6221. move.b #VintID_Level,(Vint_routine).w
  6222. bra.w WaitForVint
  6223.  
  6224.  
  6225.  
  6226.  
  6227. ; ===========================================================================
  6228. ; ---------------------------------------------------------------------------
  6229. ; Animated color of the twinkling stars in the special stage background
  6230. ; ---------------------------------------------------------------------------
  6231. ; loc_542A: Pal_UNK8:
  6232. Pal_SpecialStageStars: dc.w $EEE, $CCC, $AAA, $888, $888, $AAA, $CCC, $EEE
  6233.  
  6234. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  6235.  
  6236.  
  6237. ;sub_543A
  6238. PalCycle_SS:
  6239. move.b (Vint_runcount+3).w,d0
  6240. andi.b #3,d0
  6241. bne.s +
  6242. move.b (SS_Star_color_1).w,d0
  6243. addi_.b #1,(SS_Star_color_1).w
  6244. andi.w #7,d0
  6245. add.w d0,d0
  6246. move.w Pal_SpecialStageStars(pc,d0.w),(Normal_palette+$1C).w
  6247. move.b (SS_Star_color_2).w,d0
  6248. addi_.b #1,(SS_Star_color_2).w
  6249. andi.w #7,d0
  6250. add.w d0,d0
  6251. move.w Pal_SpecialStageStars(pc,d0.w),(Normal_palette+$1E).w
  6252. +
  6253. cmpi.b #6,(Current_Special_Stage).w
  6254. bne.s +
  6255. cmpi.b #3,(Current_Special_Act).w
  6256. beq.w SSCheckpoint_rainbow
  6257. /
  6258. tst.b (SS_Checkpoint_Rainbow_flag).w
  6259. beq.s + ; rts
  6260. move.b (Vint_runcount+3).w,d0
  6261. andi.b #7,d0
  6262. bne.s + ; rts
  6263. move.b (SS_Rainbow_palette).w,d0
  6264. addi_.b #1,(SS_Rainbow_palette).w
  6265. andi.b #3,d0
  6266. add.w d0,d0
  6267. move.w d0,d1
  6268. add.w d0,d0
  6269. add.w d1,d0
  6270. move.w word_54C4(pc,d0.w),(Normal_palette_line4+$16).w
  6271. move.w word_54C6(pc,d0.w),(Normal_palette_line4+$18).w
  6272. move.w word_54C8(pc,d0.w),(Normal_palette_line4+$1A).w
  6273. +
  6274. rts
  6275. ; ===========================================================================
  6276. ; special stage rainbow blinking sprite palettes... (chaos emerald colors?)
  6277. ;word_54BC:
  6278. dc.w $0EE, $0C0, $0EE, $0C0
  6279. word_54C4: dc.w $0EE
  6280. word_54C6: dc.w $0CC
  6281. word_54C8: dc.w $088, $0E0, $0C0, $080, $EE0, $CC0, $880, $E0E, $C0C, $808
  6282. ; ===========================================================================
  6283.  
  6284. ;loc_54DC
  6285. SSCheckpoint_rainbow:
  6286. tst.b (SS_Pause_Only_flag).w
  6287. beq.s -
  6288. moveq #0,d0
  6289. move.b (Vint_runcount+3).w,d0
  6290. andi.b #1,d0
  6291. bne.w -
  6292. move.w (Ring_count).w,d2
  6293. add.w (Ring_count_2P).w,d2
  6294. cmp.w (SS_Ring_Requirement).w,d2
  6295. blt.w -
  6296. lea (Normal_palette+2).w,a0
  6297. movea.l a0,a1
  6298. move.w (a0)+,d0
  6299.  
  6300. moveq #$B,d1
  6301. - move.w (a0)+,(a1)+
  6302. dbf d1,-
  6303.  
  6304. move.w d0,(a1)
  6305. rts
  6306. ; End of function PalCycle_SS
  6307.  
  6308.  
  6309. ;|||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  6310.  
  6311.  
  6312. ;sub_5514
  6313. SSLoadCurrentPerspective:
  6314. cmpi.b #4,(SSTrack_drawing_index).w
  6315. bne.s + ; rts
  6316. movea.l #SSRAM_MiscKoz_SpecialPerspective,a0
  6317. moveq #0,d0
  6318. move.b (SSTrack_mapping_frame).w,d0
  6319. add.w d0,d0
  6320. adda.w (a0,d0.w),a0
  6321. move.l a0,(SS_CurrentPerspective).w
  6322. + rts
  6323. ; End of function SSLoadCurrentPerspective
  6324.  
  6325.  
  6326. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  6327.  
  6328.  
  6329. ;sub_5534
  6330. SSObjectsManager:
  6331. cmpi.b #4,(SSTrack_drawing_index).w
  6332. bne.w return_55DC
  6333. moveq #0,d0
  6334. move.b (SpecialStage_CurrentSegment).w,d0
  6335. cmp.b (SpecialStage_LastSegment2).w,d0
  6336. beq.w return_55DC
  6337. move.b d0,(SpecialStage_LastSegment2).w
  6338. movea.l (SS_CurrentLevelLayout).w,a1
  6339. move.b (a1,d0.w),d3
  6340. andi.w #$7F,d3
  6341. lea (Ani_SSTrack_Len).l,a0
  6342. move.b (a0,d3.w),d3
  6343. add.w d3,d3
  6344. add.w d3,d3
  6345. movea.l (SS_CurrentLevelObjectLocations).w,a0
  6346. -
  6347. bsr.w SSSingleObjLoad
  6348. bne.s return_55DC
  6349. moveq #0,d0
  6350. move.b (a0)+,d0
  6351. bmi.s ++
  6352. move.b d0,d1
  6353. andi.b #$40,d1
  6354. bne.s +
  6355. addq.w #1,(SS_Perfect_rings_left).w
  6356. move.b #ObjID_SSRing,id(a1)
  6357. add.w d0,d0
  6358. add.w d0,d0
  6359. add.w d3,d0
  6360. move.w d0,objoff_30(a1)
  6361. move.b (a0)+,angle(a1)
  6362. bra.s -
  6363. ; ===========================================================================
  6364. +
  6365. andi.w #$3F,d0
  6366. move.b #ObjID_SSBomb,id(a1)
  6367. add.w d0,d0
  6368. add.w d0,d0
  6369. add.w d3,d0
  6370. move.w d0,objoff_30(a1)
  6371. move.b (a0)+,angle(a1)
  6372. bra.s -
  6373. ; ===========================================================================
  6374. +
  6375. move.l a0,(SS_CurrentLevelObjectLocations).w
  6376. addq.b #1,d0
  6377. beq.s return_55DC
  6378. addq.b #1,d0
  6379. beq.s ++
  6380. addq.b #1,d0
  6381. beq.s +
  6382. st.b (SS_NoCheckpoint_flag).w
  6383. sf.b (SS_NoCheckpointMsg_flag).w
  6384. bra.s ++
  6385. ; ===========================================================================
  6386. +
  6387. tst.b (SS_2p_Flag).w
  6388. bne.s +
  6389. move.b #ObjID_SSEmerald,id(a1)
  6390. rts
  6391. ; ===========================================================================
  6392. +
  6393. move.b #ObjID_SSMessage,id(a1)
  6394.  
  6395. return_55DC:
  6396. rts
  6397. ; End of function SSObjectsManager
  6398.  
  6399. ; ===========================================================================
  6400. SSTrackPNTCommands:
  6401. dc.l vdpComm(VRAM_SS_Plane_A_Name_Table2 + 0 * (PNT_Buffer_End-PNT_Buffer),VRAM,WRITE)
  6402. dc.l vdpComm(VRAM_SS_Plane_A_Name_Table2 + 1 * (PNT_Buffer_End-PNT_Buffer),VRAM,WRITE)
  6403. dc.l vdpComm(VRAM_SS_Plane_A_Name_Table2 + 2 * (PNT_Buffer_End-PNT_Buffer),VRAM,WRITE)
  6404. dc.l vdpComm(VRAM_SS_Plane_A_Name_Table2 + 3 * (PNT_Buffer_End-PNT_Buffer),VRAM,WRITE)
  6405. dc.l vdpComm(VRAM_SS_Plane_A_Name_Table1 + 0 * (PNT_Buffer_End-PNT_Buffer),VRAM,WRITE)
  6406. dc.l vdpComm(VRAM_SS_Plane_A_Name_Table1 + 1 * (PNT_Buffer_End-PNT_Buffer),VRAM,WRITE)
  6407. dc.l vdpComm(VRAM_SS_Plane_A_Name_Table1 + 2 * (PNT_Buffer_End-PNT_Buffer),VRAM,WRITE)
  6408. dc.l vdpComm(VRAM_SS_Plane_A_Name_Table1 + 3 * (PNT_Buffer_End-PNT_Buffer),VRAM,WRITE)
  6409. Ani_SSTrack_Len:
  6410. dc.b SSTrackAni_TurnThenRise_End - SSTrackAni_TurnThenRise ; 0
  6411. dc.b SSTrackAni_TurnThenDrop_End - SSTrackAni_TurnThenDrop ; 1
  6412. dc.b SSTrackAni_TurnThenStraight_End - SSTrackAni_TurnThenStraight ; 2
  6413. dc.b SSTrackAni_Straight_End - SSTrackAni_Straight ; 3
  6414. dc.b SSTrackAni_StraightThenTurn_End - SSTrackAni_StraightThenTurn ; 4
  6415. dc.b 0 ; 5
  6416.  
  6417. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  6418.  
  6419. ;sub_5604
  6420. SSTrack_Draw:
  6421. moveq #0,d0
  6422. move.b (SSTrack_drawing_index).w,d0 ; Get drawing position
  6423. cmpi.b #4,d0 ; Is it time to draw a new frame?
  6424. bge.w SSTrackSetOrientation ; Branch if not
  6425. add.w d0,d0 ; Multiply by 4
  6426. add.w d0,d0
  6427. bne.w SSTrack_BeginDraw ; Branch if we don't need to start a new segment
  6428. move.l (SSTrack_last_mappings).w,(SSTrack_last_mappings_copy).w ; Save last mappings
  6429. move.b (SSTrack_mapping_frame).w,(SSTrack_last_mapping_frame).w ; Save last frame
  6430. moveq #0,d1
  6431. moveq #0,d2
  6432. moveq #0,d3
  6433. moveq #0,d4
  6434. move.b (SpecialStage_CurrentSegment).w,d1 ; Get current segment ID
  6435. move.b (SSTrack_anim_frame).w,d2 ; Get current frame
  6436. movea.l (SS_CurrentLevelLayout).w,a1 ; Pointer to level layout
  6437. move.b (a1,d1.w),d3 ; Get segment geometry type
  6438. andi.b #$7F,d3 ; Strip flip flag
  6439. move.b d3,(SSTrack_anim).w ; Set this as new animation
  6440. move.w d3,d1 ; Copy to d1
  6441. add.w d3,d3 ; Turn it into an index
  6442. lea (Ani_SpecialStageTrack).l,a1 ; Animation table
  6443. adda.w (a1,d3.w),a1 ; Add offset so a1 points to animation data
  6444. adda.w d2,a1 ; Offset into current animation frame
  6445. moveq #0,d4
  6446. move.b (a1),d4 ; d4 = animation frame to draw
  6447. move.b d4,(SSTrack_mapping_frame).w ; Save to RAM
  6448. lsl.w #2,d4
  6449. lea (Map_SpecialStageTrack).l,a1 ; Mappings table
  6450. movea.l (a1,d4.w),a0 ; a0 = pointer to mappings for current track frame
  6451. movea.l a0,a1 ; Copy to a1
  6452. moveq #0,d2
  6453. move.b (a0)+,d2 ; Skip the first 2 bytes
  6454. move.b (a0)+,d2 ; Why not 'addq.l #2,a0'?
  6455. move.b (a0)+,d2 ; Get byte
  6456. lsl.w #8,d2 ; Shift it up to be the high byte of a word
  6457. move.b (a0)+,d2 ; Read another byte; why not 'move.w (a0)+,d2'?
  6458. addq.w #4,d2 ; Add 4
  6459. adda.w d2,a1 ; Use as offset from start of file
  6460. movea.l a1,a2 ; Save to a2
  6461. moveq #0,d2
  6462. move.b (a1)+,d2 ; Skip the first 2 bytes
  6463. move.b (a1)+,d2 ; Why not 'addq.l #2,a1'?
  6464. move.b (a1)+,d2 ; Get byte
  6465. lsl.w #8,d2 ; Shift it up to be the high byte of a word
  6466. move.b (a1)+,d2 ; Read another byte; why not 'move.w (a1)+,d2'?
  6467. addq.w #4,d2 ; Add 4
  6468. adda.w d2,a2 ; Use as offset from previous offset
  6469. move.b (a2)+,d2 ; Ignore the first 3 bytes
  6470. move.b (a2)+,d2 ; Why not 'addq.l #3,a2'?
  6471. move.b (a2)+,d2
  6472. move.b (a2)+,d2 ; Get byte (unused)
  6473. move.l a0,(SSTrack_mappings_bitflags).w ; Save pointer to bit flags mappings
  6474. move.l a0,(SSTrack_last_mappings).w ; ... twice
  6475. move.l a1,(SSTrack_mappings_uncompressed).w ; Save pointer to uncompressed mappings
  6476. move.l a2,(SSTrack_mappings_RLE).w ; Save pointer to RLE mappings
  6477. lea_ Ani_SSTrack_Len,a4 ; Pointer to animation lengths
  6478. move.b (a4,d1.w),d2 ; Get length of current animation
  6479. move.b (SSTrack_anim_frame).w,(SSTrack_last_anim_frame).w ; Save old frame
  6480. addi_.b #1,(SSTrack_anim_frame).w ; Increment current frame
  6481. cmp.b (SSTrack_anim_frame).w,d2 ; Compare with animation length
  6482. bne.s SSTrack_BeginDraw ; If not equal, branch
  6483. move.b #0,(SSTrack_anim_frame).w ; Reset to start
  6484. move.b (SpecialStage_CurrentSegment).w,(SpecialStage_LastSegment).w ; Save old segment
  6485. addi_.b #1,(SpecialStage_CurrentSegment).w ; Increment current segment
  6486.  
  6487. ;loc_56D2
  6488. SSTrack_BeginDraw:
  6489. tst.b (SS_Alternate_PNT).w ; Are we using the alternate PNT?
  6490. beq.s + ; Branch if not
  6491. addi.w #$10,d0 ; Change where we will be drawing
  6492. +
  6493. lea_ SSTrackPNTCommands,a3 ; Table of VRAM commands
  6494. movea.l (a3,d0.w),a3 ; Get command to set destination in VRAM for current frame
  6495. move.l a3,(VDP_control_port).l ; Send it to VDP
  6496. lea (VDP_data_port).l,a6
  6497. bsr.w SSTrackSetOrientation ; Set oriantation flags
  6498. movea.l (SSTrack_mappings_bitflags).w,a0 ; Get pointer to bit flags mappings
  6499. movea.l (SSTrack_mappings_uncompressed).w,a1 ; Get pointer to uncompressed mappings
  6500. movea.l (SSTrack_mappings_RLE).w,a2 ; Get pointer to RLE mappings
  6501. lea (SSDrawRegBuffer).w,a3 ; Pointer to register buffer from last draw
  6502. movem.w (a3)+,d2-d7 ; Restore registers from previous call (or set them to zero)
  6503. lea (SSPNT_UncLUT).l,a3 ; Pattern name list for drawing routines
  6504. lea (SSPNT_RLELUT).l,a4 ; RLE-encoded pattern name list for drawing routines
  6505. movea.w #-8,a5 ; Initialize loop counter: draws 7 lines
  6506. moveq #0,d0
  6507. tst.b (SSTrack_Orientation).w ; Is the current segment flipped?
  6508. bne.w SSTrackDrawLineFlipLoop ; Branch if yes
  6509.  
  6510. ;loc_5722
  6511. SSTrackDrawLineLoop:
  6512. adda_.w #1,a5 ; Increment loop counter
  6513. cmpa.w #0,a5 ; Have all 7 lines been drawn?
  6514. beq.w SSTrackDraw_return ; If yes, return
  6515.  
  6516. ;loc_572E
  6517. SSTrackDrawLoop_Inner:
  6518. moveq #0,d1
  6519. subq.w #1,d7 ; Subtract 1 from bit counter
  6520. bpl.s + ; Branch if we still have bits we can use
  6521. move.b (a0)+,d6 ; Get a new byte from bit flags
  6522. moveq #7,d7 ; We now have 8 fresh new bits
  6523. +
  6524. add.b d6,d6 ; Do we have to use RLE compression?
  6525. bcc.s SSTrackDrawRLE ; Branch if yes
  6526. subq.b #1,d5 ; Subtract 1 from bit counter
  6527. bpl.s + ; Branch if we still have bits we can use
  6528. move.b (a1)+,d4 ; Get a new byte from uncompressed mappings pointer
  6529. moveq #7,d5 ; We now have 8 fresh new bits
  6530. +
  6531. add.b d4,d4 ; Do we need a 10-bit index?
  6532. bcc.s + ; Branch if not
  6533. moveq #$A,d0 ; d0 = 10 bits
  6534. sub.b d5,d0 ; d0 = 10 - d5
  6535. subq.b #3,d0 ; d0 = 7 - d5; why not shorten it to 'moveq #7,d0 \n sub.b d5,d0'?
  6536. add.w d0,d0 ; Convert into table index
  6537. move.w SSTrackDrawUnc_Read10LUT(pc,d0.w),d0
  6538. jmp SSTrackDrawUnc_Read10LUT(pc,d0.w)
  6539. ; ===========================================================================
  6540. ;off_5758
  6541. SSTrackDrawUnc_Read10LUT: offsetTable
  6542. offsetTableEntry.w SSTrackDrawUnc_Read10_Got7 ; 0
  6543. offsetTableEntry.w SSTrackDrawUnc_Read10_Got6 ; 1
  6544. offsetTableEntry.w SSTrackDrawUnc_Read10_Got5 ; 2
  6545. offsetTableEntry.w SSTrackDrawUnc_Read10_Got4 ; 3
  6546. offsetTableEntry.w SSTrackDrawUnc_Read10_Got3 ; 4
  6547. offsetTableEntry.w SSTrackDrawUnc_Read10_Got2 ; 5
  6548. offsetTableEntry.w SSTrackDrawUnc_Read10_Got1 ; 6
  6549. offsetTableEntry.w SSTrackDrawUnc_Read10_Got0 ; 7
  6550. ; ===========================================================================
  6551. +
  6552. moveq #6,d0 ; d0 = 6
  6553. sub.b d5,d0 ; d0 = 6 - d5
  6554. addq.b #1,d0 ; d0 = 7 - d5; why not shorten it to 'moveq #7,d0 \n sub.b d5,d0'?
  6555. add.w d0,d0 ; Convert into table index
  6556. move.w SSTrackDrawUnc_Read6LUT(pc,d0.w),d0
  6557. jmp SSTrackDrawUnc_Read6LUT(pc,d0.w)
  6558. ; ===========================================================================
  6559. ;off_5778
  6560. SSTrackDrawUnc_Read6LUT: offsetTable
  6561. offsetTableEntry.w SSTrackDrawUnc_Read6_Got7 ; 0
  6562. offsetTableEntry.w SSTrackDrawUnc_Read6_Got6 ; 1
  6563. offsetTableEntry.w SSTrackDrawUnc_Read6_Got5 ; 2
  6564. offsetTableEntry.w SSTrackDrawUnc_Read6_Got4 ; 3
  6565. offsetTableEntry.w SSTrackDrawUnc_Read6_Got3 ; 4
  6566. offsetTableEntry.w SSTrackDrawUnc_Read6_Got2 ; 5
  6567. offsetTableEntry.w SSTrackDrawUnc_Read6_Got1 ; 6
  6568. offsetTableEntry.w SSTrackDrawUnc_Read6_Got0 ; 7
  6569. ; ===========================================================================
  6570.  
  6571. SSTrackDrawRLE:
  6572. subq.b #1,d3 ; Subtract 1 from bit counter
  6573. bpl.s ++ ; Branch if we still have bits we can use
  6574. move.b (a2)+,d2 ; Get a new byte from RLE mappings pointer
  6575. cmpi.b #-1,d2 ; Is d2 equal to -1?
  6576. bne.s + ; Branch if not
  6577. moveq #0,d3 ; Set bit counter to zero
  6578. bra.w SSTrackDrawLineLoop
  6579. ; ===========================================================================
  6580. +
  6581. moveq #7,d3 ; We now have 8 fresh new bits
  6582. +
  6583. add.b d2,d2 ; Do we need a 7-bit index?
  6584. bcc.s + ; Branch if not
  6585. moveq #7,d0 ; d0 = 7
  6586. sub.b d3,d0 ; d0 = 10 - d3
  6587. add.b d0,d0 ; Convert into table index
  6588. move.w SSTrackDrawRLE_Read7LUT(pc,d0.w),d0
  6589. jmp SSTrackDrawRLE_Read7LUT(pc,d0.w)
  6590. ; ===========================================================================
  6591. ;off_57AE
  6592. SSTrackDrawRLE_Read7LUT: offsetTable
  6593. offsetTableEntry.w SSTrackDrawRLE_Read7_Got7 ; 0
  6594. offsetTableEntry.w SSTrackDrawRLE_Read7_Got6 ; 1
  6595. offsetTableEntry.w SSTrackDrawRLE_Read7_Got5 ; 2
  6596. offsetTableEntry.w SSTrackDrawRLE_Read7_Got4 ; 3
  6597. offsetTableEntry.w SSTrackDrawRLE_Read7_Got3 ; 4
  6598. offsetTableEntry.w SSTrackDrawRLE_Read7_Got2 ; 5
  6599. offsetTableEntry.w SSTrackDrawRLE_Read7_Got1 ; 6
  6600. offsetTableEntry.w SSTrackDrawRLE_Read7_Got0 ; 7
  6601. ; ===========================================================================
  6602. +
  6603. moveq #6,d0 ; d0 = 6
  6604. sub.b d3,d0 ; d0 = 6 - d3
  6605. addq.b #1,d0 ; d0 = 7 - d3; why not shorten it to 'moveq #7,d0 \n sub.b d3,d0'?
  6606. add.b d0,d0 ; Convert into table index
  6607. move.w SSTrackDrawRLE_Read6LUT(pc,d0.w),d0
  6608. jmp SSTrackDrawRLE_Read6LUT(pc,d0.w)
  6609. ; ===========================================================================
  6610. ;off_57CE
  6611. SSTrackDrawRLE_Read6LUT: offsetTable
  6612. offsetTableEntry.w SSTrackDrawRLE_Read6_Got7 ; 0
  6613. offsetTableEntry.w SSTrackDrawRLE_Read6_Got6 ; 1
  6614. offsetTableEntry.w SSTrackDrawRLE_Read6_Got5 ; 2
  6615. offsetTableEntry.w SSTrackDrawRLE_Read6_Got4 ; 3
  6616. offsetTableEntry.w SSTrackDrawRLE_Read6_Got3 ; 4
  6617. offsetTableEntry.w SSTrackDrawRLE_Read6_Got2 ; 5
  6618. offsetTableEntry.w SSTrackDrawRLE_Read6_Got1 ; 6
  6619. offsetTableEntry.w SSTrackDrawRLE_Read6_Got0 ; 7
  6620. ; ===========================================================================
  6621. ;loc_57DE
  6622. SSTrackDrawUnc_Read10_Got0:
  6623. ; Reads 10 bits from uncompressed mappings, 0 bits in bit buffer
  6624. moveq #0,d0
  6625. move.b (a1)+,d0
  6626. lsl.w #2,d0
  6627. move.b (a1)+,d4
  6628. rol.b #2,d4
  6629. move.b d4,d1
  6630. andi.b #3,d1
  6631. or.b d1,d0
  6632. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  6633. add.w d0,d0
  6634. move.w (a3,d0.w),d0
  6635. ori.w #palette_line_3,d0
  6636. move.w d0,(a6)
  6637. moveq #6,d5
  6638. bra.w SSTrackDrawLoop_Inner
  6639. ; ===========================================================================
  6640. ;loc_5806
  6641. SSTrackDrawUnc_Read10_Got1:
  6642. ; Reads 10 bits from uncompressed mappings, 1 bit in bit buffer
  6643. move.b d4,d0
  6644. lsl.w #2,d0
  6645. andi.w #$200,d0
  6646. move.b (a1)+,d1
  6647. lsl.w #1,d1
  6648. or.w d1,d0
  6649. move.b (a1)+,d4
  6650. rol.b #1,d4
  6651. move.b d4,d1
  6652. andi.b #1,d1
  6653. or.b d1,d0
  6654. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  6655. add.w d0,d0
  6656. move.w (a3,d0.w),d0
  6657. ori.w #palette_line_3,d0
  6658. move.w d0,(a6)
  6659. moveq #7,d5
  6660. bra.w SSTrackDrawLoop_Inner
  6661. ; ===========================================================================
  6662. ;loc_5836
  6663. SSTrackDrawUnc_Read10_Got2:
  6664. ; Reads 10 bits from uncompressed mappings, 2 bits in bit buffer
  6665. move.b d4,d0
  6666. lsl.w #2,d0
  6667. andi.w #$300,d0
  6668. move.b (a1)+,d0
  6669. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  6670. add.w d0,d0
  6671. move.w (a3,d0.w),d0
  6672. ori.w #palette_line_3,d0
  6673. move.w d0,(a6)
  6674. moveq #0,d5 ; Bit buffer now empty
  6675. bra.w SSTrackDrawLoop_Inner
  6676. ; ===========================================================================
  6677. ;loc_5856
  6678. SSTrackDrawUnc_Read10_Got3:
  6679. ; Reads 10 bits from uncompressed mappings, 3 bits in bit buffer
  6680. move.b d4,d0
  6681. lsl.w #2,d0
  6682. andi.w #$380,d0
  6683. move.b (a1)+,d4
  6684. ror.b #1,d4
  6685. move.b d4,d1
  6686. andi.b #$7F,d1
  6687. or.b d1,d0
  6688. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  6689. add.w d0,d0
  6690. move.w (a3,d0.w),d0
  6691. ori.w #palette_line_3,d0
  6692. move.w d0,(a6)
  6693. moveq #1,d5 ; Bit buffer now has 1 bit
  6694. bra.w SSTrackDrawLoop_Inner
  6695. ; ===========================================================================
  6696. ;loc_5880
  6697. SSTrackDrawUnc_Read10_Got4:
  6698. ; Reads 10 bits from uncompressed mappings, 4 bits in bit buffer
  6699. move.b d4,d0
  6700. lsl.w #2,d0
  6701. andi.w #$3C0,d0
  6702. move.b (a1)+,d4
  6703. ror.b #2,d4
  6704. move.b d4,d1
  6705. andi.b #$3F,d1
  6706. or.b d1,d0
  6707. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  6708. add.w d0,d0
  6709. move.w (a3,d0.w),d0
  6710. ori.w #palette_line_3,d0
  6711. move.w d0,(a6)
  6712. moveq #2,d5 ; Bit buffer now has 2 bits
  6713. bra.w SSTrackDrawLoop_Inner
  6714. ; ===========================================================================
  6715. ;loc_58AA
  6716. SSTrackDrawUnc_Read10_Got5:
  6717. ; Reads 10 bits from uncompressed mappings, 5 bits in bit buffer
  6718. move.b d4,d0
  6719. lsl.w #2,d0
  6720. andi.w #$3E0,d0
  6721. move.b (a1)+,d4
  6722. ror.b #3,d4
  6723. move.b d4,d1
  6724. andi.b #$1F,d1
  6725. or.b d1,d0
  6726. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  6727. add.w d0,d0
  6728. move.w (a3,d0.w),d0
  6729. ori.w #palette_line_3,d0
  6730. move.w d0,(a6)
  6731. moveq #3,d5 ; Bit buffer now has 3 bits
  6732. bra.w SSTrackDrawLoop_Inner
  6733. ; ===========================================================================
  6734. ;loc_58D4
  6735. SSTrackDrawUnc_Read10_Got6:
  6736. ; Reads 10 bits from uncompressed mappings, 6 bits in bit buffer
  6737. move.b d4,d0
  6738. lsl.w #2,d0
  6739. andi.w #$3F0,d0
  6740. move.b (a1)+,d4
  6741. ror.b #4,d4
  6742. move.b d4,d1
  6743. andi.b #$F,d1
  6744. or.b d1,d0
  6745. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  6746. add.w d0,d0
  6747. move.w (a3,d0.w),d0
  6748. ori.w #palette_line_3,d0
  6749. move.w d0,(a6)
  6750. moveq #4,d5 ; Bit buffer now has 4 bits
  6751. bra.w SSTrackDrawLoop_Inner
  6752. ; ===========================================================================
  6753. ;loc_58FE
  6754. SSTrackDrawUnc_Read10_Got7:
  6755. ; Reads 10 bits from uncompressed mappings, 7 bits in bit buffer
  6756. move.b d4,d0
  6757. lsl.w #2,d0
  6758. andi.w #$3F8,d0
  6759. move.b (a1)+,d4
  6760. rol.b #3,d4
  6761. move.b d4,d1
  6762. andi.b #7,d1
  6763. or.b d1,d0
  6764. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  6765. add.w d0,d0
  6766. move.w (a3,d0.w),d0
  6767. ori.w #palette_line_3,d0
  6768. move.w d0,(a6)
  6769. moveq #5,d5 ; Bit buffer now has 5 bits
  6770. bra.w SSTrackDrawLoop_Inner
  6771. ; ===========================================================================
  6772. ;loc_5928
  6773. SSTrackDrawUnc_Read6_Got0:
  6774. ; Reads 6 bits from uncompressed mappings, 0 bits in bit buffer
  6775. move.b (a1)+,d4
  6776. ror.b #2,d4
  6777. move.b d4,d0
  6778. andi.w #$3F,d0
  6779. add.w d0,d0
  6780. move.w (a3,d0.w),d0
  6781. ori.w #palette_line_3,d0
  6782. move.w d0,(a6)
  6783. moveq #2,d5 ; Bit buffer now has 2 bits
  6784. bra.w SSTrackDrawLoop_Inner
  6785. ; ===========================================================================
  6786. ;loc_5944
  6787. SSTrackDrawUnc_Read6_Got1:
  6788. ; Reads 6 bits from uncompressed mappings, 1 bit in bit buffer
  6789. move.b d4,d0
  6790. lsr.b #2,d0
  6791. andi.w #$20,d0
  6792. move.b (a1)+,d4
  6793. ror.b #3,d4
  6794. move.b d4,d1
  6795. andi.b #$1F,d1
  6796. or.b d1,d0
  6797. add.w d0,d0
  6798. move.w (a3,d0.w),d0
  6799. ori.w #palette_line_3,d0
  6800. move.w d0,(a6)
  6801. moveq #3,d5 ; Bit buffer now has 3 bits
  6802. bra.w SSTrackDrawLoop_Inner
  6803. ; ===========================================================================
  6804. ;loc_596A
  6805. SSTrackDrawUnc_Read6_Got2:
  6806. ; Reads 6 bits from uncompressed mappings, 2 bits in bit buffer
  6807. move.b d4,d0
  6808. lsr.b #2,d0
  6809. andi.w #$30,d0
  6810. move.b (a1)+,d4
  6811. ror.b #4,d4
  6812. move.b d4,d1
  6813. andi.b #$F,d1
  6814. or.b d1,d0
  6815. add.w d0,d0
  6816. move.w (a3,d0.w),d0
  6817. ori.w #palette_line_3,d0
  6818. move.w d0,(a6)
  6819. moveq #4,d5 ; Bit buffer now has 4 bits
  6820. bra.w SSTrackDrawLoop_Inner
  6821. ; ===========================================================================
  6822. ;loc_5990
  6823. SSTrackDrawUnc_Read6_Got3:
  6824. ; Reads 6 bits from uncompressed mappings, 3 bits in bit buffer
  6825. move.b d4,d0
  6826. lsr.b #2,d0
  6827. andi.w #$38,d0
  6828. move.b (a1)+,d4
  6829. rol.b #3,d4
  6830. move.b d4,d1
  6831. andi.b #7,d1
  6832. or.b d1,d0
  6833. add.w d0,d0
  6834. move.w (a3,d0.w),d0
  6835. ori.w #palette_line_3,d0
  6836. move.w d0,(a6)
  6837. moveq #5,d5 ; Bit buffer now has 5 bits
  6838. bra.w SSTrackDrawLoop_Inner
  6839. ; ===========================================================================
  6840. ;loc_59B6
  6841. SSTrackDrawUnc_Read6_Got4:
  6842. ; Reads 6 bits from uncompressed mappings, 4 bits in bit buffer
  6843. move.b d4,d0
  6844. lsr.b #2,d0
  6845. andi.w #$3C,d0
  6846. move.b (a1)+,d4
  6847. rol.b #2,d4
  6848. move.b d4,d1
  6849. andi.b #3,d1
  6850. or.b d1,d0
  6851. add.w d0,d0
  6852. move.w (a3,d0.w),d0
  6853. ori.w #palette_line_3,d0
  6854. move.w d0,(a6)
  6855. moveq #6,d5 ; Bit buffer now has 6 bits
  6856. bra.w SSTrackDrawLoop_Inner
  6857. ; ===========================================================================
  6858. ;loc_59DC
  6859. SSTrackDrawUnc_Read6_Got5:
  6860. ; Reads 6 bits from uncompressed mappings, 5 bits in bit buffer
  6861. move.b d4,d0
  6862. lsr.b #2,d0
  6863. andi.w #$3E,d0
  6864. move.b (a1)+,d4
  6865. rol.b #1,d4
  6866. move.b d4,d1
  6867. andi.b #1,d1
  6868. or.b d1,d0
  6869. add.w d0,d0
  6870. move.w (a3,d0.w),d0
  6871. ori.w #palette_line_3,d0
  6872. move.w d0,(a6)
  6873. moveq #7,d5 ; Bit buffer now has 7 bits
  6874. bra.w SSTrackDrawLoop_Inner
  6875. ; ===========================================================================
  6876. ;loc_5A02
  6877. SSTrackDrawUnc_Read6_Got6:
  6878. ; Reads 6 bits from uncompressed mappings, 6 bits in bit buffer
  6879. lsr.b #2,d4
  6880. andi.w #$3F,d4
  6881. add.w d4,d4
  6882. move.w (a3,d4.w),d4
  6883. ori.w #palette_line_3,d4
  6884. move.w d4,(a6)
  6885. moveq #0,d5 ; Bit buffer now empty
  6886. bra.w SSTrackDrawLoop_Inner
  6887. ; ===========================================================================
  6888. ;loc_5A1A
  6889. SSTrackDrawUnc_Read6_Got7:
  6890. ; Reads 6 bits from uncompressed mappings, 7 bits in bit buffer
  6891. ror.b #2,d4
  6892. move.b d4,d0
  6893. andi.w #$3F,d0
  6894. add.w d0,d0
  6895. move.w (a3,d0.w),d0
  6896. ori.w #palette_line_3,d0
  6897. move.w d0,(a6)
  6898. moveq #1,d5 ; Bit buffer now has 1 bit
  6899. bra.w SSTrackDrawLoop_Inner
  6900. ; ===========================================================================
  6901. ;loc_5A34
  6902. SSTrackDrawRLE_Read7_Got0:
  6903. ; Reads 7 bits from RLE-compressed mappings, 0 bits in bit buffer
  6904. move.b (a2)+,d2
  6905. ror.b #1,d2
  6906. move.b d2,d0
  6907. andi.w #$7F,d0
  6908. moveq #1,d3 ; Bit buffer now has 1 bit
  6909. cmpi.b #$7F,d0
  6910. beq.w SSTrackDrawLineLoop
  6911. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  6912. add.w d0,d0
  6913. add.w d0,d0
  6914. move.w (a4,d0.w),d1
  6915. move.w 2(a4,d0.w),d0
  6916. ori.w #palette_line_3|high_priority,d1
  6917.  
  6918. - move.w d1,(a6)
  6919. dbf d0,-
  6920.  
  6921. bra.w SSTrackDrawLoop_Inner
  6922. ; ===========================================================================
  6923. ;loc_5A66
  6924. SSTrackDrawRLE_Read7_Got1:
  6925. ; Reads 7 bits from RLE-compressed mappings, 1 bit in bit buffer
  6926. move.b d2,d1
  6927. lsr.b #1,d1
  6928. andi.b #$40,d1
  6929. move.b (a2)+,d2
  6930. ror.b #2,d2
  6931. move.b d2,d0
  6932. andi.w #$3F,d0
  6933. or.b d1,d0
  6934. moveq #2,d3 ; Bit buffer now has 2 bits
  6935. cmpi.b #$7F,d0
  6936. beq.w SSTrackDrawLineLoop
  6937. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  6938. add.w d0,d0
  6939. add.w d0,d0
  6940. move.w (a4,d0.w),d1
  6941. move.w 2(a4,d0.w),d0
  6942. ori.w #palette_line_3|high_priority,d1
  6943.  
  6944. - move.w d1,(a6)
  6945. dbf d0,-
  6946.  
  6947. bra.w SSTrackDrawLoop_Inner
  6948. ; ===========================================================================
  6949. ;loc_5AA2
  6950. SSTrackDrawRLE_Read7_Got2:
  6951. ; Reads 7 bits from RLE-compressed mappings, 2 bits in bit buffer
  6952. move.b d2,d1
  6953. lsr.b #1,d1
  6954. andi.b #$60,d1
  6955. move.b (a2)+,d2
  6956. ror.b #3,d2
  6957. move.b d2,d0
  6958. andi.w #$1F,d0
  6959. or.b d1,d0
  6960. moveq #3,d3 ; Bit buffer now has 3 bits
  6961. cmpi.b #$7F,d0
  6962. beq.w SSTrackDrawLineLoop
  6963. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  6964. add.w d0,d0
  6965. add.w d0,d0
  6966. move.w (a4,d0.w),d1
  6967. move.w 2(a4,d0.w),d0
  6968. ori.w #palette_line_3|high_priority,d1
  6969.  
  6970. - move.w d1,(a6)
  6971. dbf d0,-
  6972.  
  6973. bra.w SSTrackDrawLoop_Inner
  6974. ; ===========================================================================
  6975. ;loc_5ADE
  6976. SSTrackDrawRLE_Read7_Got3:
  6977. ; Reads 7 bits from RLE-compressed mappings, 3 bits in bit buffer
  6978. move.b d2,d1
  6979. lsr.b #1,d1
  6980. andi.b #$70,d1
  6981. move.b (a2)+,d2
  6982. ror.b #4,d2
  6983. move.b d2,d0
  6984. andi.w #$F,d0
  6985. or.b d1,d0
  6986. moveq #4,d3 ; Bit buffer now has 4 bits
  6987. cmpi.b #$7F,d0
  6988. beq.w SSTrackDrawLineLoop
  6989. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  6990. add.w d0,d0
  6991. add.w d0,d0
  6992. move.w (a4,d0.w),d1
  6993. move.w 2(a4,d0.w),d0
  6994. ori.w #palette_line_3|high_priority,d1
  6995.  
  6996. - move.w d1,(a6)
  6997. dbf d0,-
  6998.  
  6999. bra.w SSTrackDrawLoop_Inner
  7000. ; ===========================================================================
  7001. ;loc_5B1A
  7002. SSTrackDrawRLE_Read7_Got4:
  7003. ; Reads 7 bits from RLE-compressed mappings, 4 bits in bit buffer
  7004. move.b d2,d1
  7005. lsr.b #1,d1
  7006. andi.b #$78,d1
  7007. move.b (a2)+,d2
  7008. rol.b #3,d2
  7009. move.b d2,d0
  7010. andi.w #7,d0
  7011. or.b d1,d0
  7012. moveq #5,d3 ; Bit buffer now has 5 bits
  7013. cmpi.b #$7F,d0
  7014. beq.w SSTrackDrawLineLoop
  7015. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7016. add.w d0,d0
  7017. add.w d0,d0
  7018. move.w (a4,d0.w),d1
  7019. move.w 2(a4,d0.w),d0
  7020. ori.w #palette_line_3|high_priority,d1
  7021.  
  7022. - move.w d1,(a6)
  7023. dbf d0,-
  7024.  
  7025. bra.w SSTrackDrawLoop_Inner
  7026. ; ===========================================================================
  7027. ;loc_5B56
  7028. SSTrackDrawRLE_Read7_Got5:
  7029. ; Reads 7 bits from RLE-compressed mappings, 5 bits in bit buffer
  7030. move.b d2,d1
  7031. lsr.b #1,d1
  7032. andi.b #$7C,d1
  7033. move.b (a2)+,d2
  7034. rol.b #2,d2
  7035. move.b d2,d0
  7036. andi.w #3,d0
  7037. or.b d1,d0
  7038. moveq #6,d3 ; Bit buffer now has 6 bits
  7039. cmpi.b #$7F,d0
  7040. beq.w SSTrackDrawLineLoop
  7041. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7042. add.w d0,d0
  7043. add.w d0,d0
  7044. move.w (a4,d0.w),d1
  7045. move.w 2(a4,d0.w),d0
  7046. ori.w #palette_line_3|high_priority,d1
  7047.  
  7048. - move.w d1,(a6)
  7049. dbf d0,-
  7050.  
  7051. bra.w SSTrackDrawLoop_Inner
  7052. ; ===========================================================================
  7053. ;loc_5B92
  7054. SSTrackDrawRLE_Read7_Got6:
  7055. ; Reads 7 bits from RLE-compressed mappings, 6 bits in bit buffer
  7056. move.b d2,d1
  7057. lsr.b #1,d1
  7058. andi.b #$7E,d1
  7059. move.b (a2)+,d2
  7060. rol.b #1,d2
  7061. move.b d2,d0
  7062. andi.w #1,d0
  7063. or.b d1,d0
  7064. moveq #7,d3 ; Bit buffer now has 7 bits
  7065. cmpi.b #$7F,d0
  7066. beq.w SSTrackDrawLineLoop
  7067. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7068. add.w d0,d0
  7069. add.w d0,d0
  7070. move.w (a4,d0.w),d1
  7071. move.w 2(a4,d0.w),d0
  7072. ori.w #palette_line_3|high_priority,d1
  7073.  
  7074. - move.w d1,(a6)
  7075. dbf d0,-
  7076.  
  7077. bra.w SSTrackDrawLoop_Inner
  7078. ; ===========================================================================
  7079. ;loc_5BCE
  7080. SSTrackDrawRLE_Read7_Got7:
  7081. ; Reads 7 bits from RLE-compressed mappings, 7 bits in bit buffer
  7082. lsr.b #1,d2
  7083. andi.w #$7F,d2
  7084. moveq #0,d3 ; Bit buffer now empty
  7085. cmpi.b #$7F,d2
  7086. beq.w SSTrackDrawLineLoop
  7087. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d2
  7088. add.w d2,d2
  7089. add.w d2,d2
  7090. move.w (a4,d2.w),d1
  7091. move.w 2(a4,d2.w),d0
  7092. ori.w #palette_line_3|high_priority,d1
  7093.  
  7094. - move.w d1,(a6)
  7095. dbf d0,-
  7096.  
  7097. bra.w SSTrackDrawLoop_Inner
  7098. ; ===========================================================================
  7099. ;loc_5BFC
  7100. SSTrackDrawRLE_Read6_Got0:
  7101. ; Reads 6 bits from RLE-compressed mappings, 0 bits in bit buffer
  7102. move.b (a2)+,d2
  7103. ror.b #2,d2
  7104. move.b d2,d0
  7105. andi.w #$3F,d0
  7106. add.w d0,d0
  7107. add.w d0,d0
  7108. moveq #2,d3 ; Bit buffer now has 2 bits
  7109. move.w (a4,d0.w),d1
  7110. move.w 2(a4,d0.w),d0
  7111. ori.w #palette_line_3|high_priority,d1
  7112.  
  7113. - move.w d1,(a6)
  7114. dbf d0,-
  7115.  
  7116. bra.w SSTrackDrawLoop_Inner
  7117. ; ===========================================================================
  7118. ;loc_5C22
  7119. SSTrackDrawRLE_Read6_Got1:
  7120. ; Reads 6 bits from RLE-compressed mappings, 1 bit in bit buffer
  7121. move.b d2,d0
  7122. lsr.b #2,d0
  7123. andi.w #$20,d0
  7124. move.b (a2)+,d2
  7125. ror.b #3,d2
  7126. move.b d2,d1
  7127. andi.b #$1F,d1
  7128. or.b d1,d0
  7129. moveq #3,d3 ; Bit buffer now has 3 bits
  7130. add.w d0,d0
  7131. add.w d0,d0
  7132. move.w (a4,d0.w),d1
  7133. move.w 2(a4,d0.w),d0
  7134. ori.w #palette_line_3|high_priority,d1
  7135.  
  7136. - move.w d1,(a6)
  7137. dbf d0,-
  7138.  
  7139. bra.w SSTrackDrawLoop_Inner
  7140. ; ===========================================================================
  7141. ;loc_5C52
  7142. SSTrackDrawRLE_Read6_Got2:
  7143. ; Reads 6 bits from RLE-compressed mappings, 2 bits in bit buffer
  7144. move.b d2,d0
  7145. lsr.b #2,d0
  7146. andi.w #$30,d0
  7147. move.b (a2)+,d2
  7148. ror.b #4,d2
  7149. move.b d2,d1
  7150. andi.b #$F,d1
  7151. or.b d1,d0
  7152. add.w d0,d0
  7153. add.w d0,d0
  7154. moveq #4,d3 ; Bit buffer now has 4 bits
  7155. move.w (a4,d0.w),d1
  7156. move.w 2(a4,d0.w),d0
  7157. ori.w #palette_line_3|high_priority,d1
  7158.  
  7159. - move.w d1,(a6)
  7160. dbf d0,-
  7161.  
  7162. bra.w SSTrackDrawLoop_Inner
  7163. ; ===========================================================================
  7164. ;loc_5C82
  7165. SSTrackDrawRLE_Read6_Got3:
  7166. ; Reads 6 bits from RLE-compressed mappings, 3 bits in bit buffer
  7167. move.b d2,d0
  7168. lsr.b #2,d0
  7169. andi.w #$38,d0
  7170. move.b (a2)+,d2
  7171. rol.b #3,d2
  7172. move.b d2,d1
  7173. andi.b #7,d1
  7174. or.b d1,d0
  7175. add.w d0,d0
  7176. add.w d0,d0
  7177. moveq #5,d3 ; Bit buffer now has 5 bits
  7178. move.w (a4,d0.w),d1
  7179. move.w 2(a4,d0.w),d0
  7180. ori.w #palette_line_3|high_priority,d1
  7181.  
  7182. - move.w d1,(a6)
  7183. dbf d0,-
  7184.  
  7185. bra.w SSTrackDrawLoop_Inner
  7186. ; ===========================================================================
  7187. ;loc_5CB2
  7188. SSTrackDrawRLE_Read6_Got4:
  7189. ; Reads 6 bits from RLE-compressed mappings, 4 bits in bit buffer
  7190. move.b d2,d0
  7191. lsr.b #2,d0
  7192. andi.w #$3C,d0
  7193. move.b (a2)+,d2
  7194. rol.b #2,d2
  7195. move.b d2,d1
  7196. andi.b #3,d1
  7197. or.b d1,d0
  7198. add.w d0,d0
  7199. add.w d0,d0
  7200. moveq #6,d3 ; Bit buffer now has 6 bits
  7201. move.w (a4,d0.w),d1
  7202. move.w 2(a4,d0.w),d0
  7203. ori.w #palette_line_3|high_priority,d1
  7204.  
  7205. - move.w d1,(a6)
  7206. dbf d0,-
  7207.  
  7208. bra.w SSTrackDrawLoop_Inner
  7209. ; ===========================================================================
  7210. ;loc_5CE2
  7211. SSTrackDrawRLE_Read6_Got5:
  7212. ; Reads 6 bits from RLE-compressed mappings, 5 bits in bit buffer
  7213. move.b d2,d0
  7214. lsr.b #2,d0
  7215. andi.w #$3E,d0
  7216. move.b (a2)+,d2
  7217. rol.b #1,d2
  7218. move.b d2,d1
  7219. andi.b #1,d1
  7220. or.b d1,d0
  7221. add.w d0,d0
  7222. add.w d0,d0
  7223. moveq #7,d3 ; Bit buffer now has 7 bits
  7224. move.w (a4,d0.w),d1
  7225. move.w 2(a4,d0.w),d0
  7226. ori.w #palette_line_3|high_priority,d1
  7227.  
  7228. - move.w d1,(a6)
  7229. dbf d0,-
  7230.  
  7231. bra.w SSTrackDrawLoop_Inner
  7232. ; ===========================================================================
  7233. ;loc_5D12
  7234. SSTrackDrawRLE_Read6_Got6:
  7235. ; Reads 6 bits from RLE-compressed mappings, 6 bits in bit buffer
  7236. lsr.b #2,d2
  7237. andi.w #$3F,d2
  7238. add.w d2,d2
  7239. add.w d2,d2
  7240. moveq #0,d3 ; Bit buffer now empty
  7241. move.w (a4,d2.w),d1
  7242. move.w 2(a4,d2.w),d0
  7243. ori.w #palette_line_3|high_priority,d1
  7244.  
  7245. - move.w d1,(a6)
  7246. dbf d0,-
  7247.  
  7248. bra.w SSTrackDrawLoop_Inner
  7249. ; ===========================================================================
  7250. ;loc_5D34
  7251. SSTrackDrawRLE_Read6_Got7:
  7252. ; Reads 6 bits from RLE-compressed mappings, 7 bits in bit buffer
  7253. ror.b #2,d2
  7254. move.b d2,d0
  7255. andi.w #$3F,d0
  7256. add.w d0,d0
  7257. add.w d0,d0
  7258. moveq #1,d3 ; Bit buffer now has 1 bit
  7259. move.w (a4,d0.w),d1
  7260. move.w 2(a4,d0.w),d0
  7261. ori.w #palette_line_3|high_priority,d1
  7262.  
  7263. - move.w d1,(a6)
  7264. dbf d0,-
  7265.  
  7266. bra.w SSTrackDrawLoop_Inner
  7267. ; ===========================================================================
  7268.  
  7269. ;loc_5D58
  7270. SSTrackDraw_return:
  7271. cmpi.b #3,(SSTrack_drawing_index).w ; Have we drawed a full frame?
  7272. beq.s + ; Branch if yes
  7273. move.l a0,(SSTrack_mappings_bitflags).w ; Save pointer
  7274. move.l a1,(SSTrack_mappings_uncompressed).w ; Save pointer
  7275. move.l a2,(SSTrack_mappings_RLE).w ; Save pointer
  7276. lea (SSDrawRegBuffer_End).w,a3 ; Pointer to end of registry buffer
  7277. movem.w d2-d7,-(a3) ; Save the bit buffers and bit counters
  7278. rts
  7279. ; ===========================================================================
  7280. +
  7281. lea (SSDrawRegBuffer).w,a2 ; Pointer to registry buffer
  7282. moveq #0,d0
  7283. rept 6
  7284. move.w d0,(a2)+ ; Clear bit buffers and bit counters
  7285. endm
  7286. rts
  7287. ; ===========================================================================
  7288.  
  7289. ;loc_5D8A
  7290. SSTrackDrawLineFlipLoop:
  7291. adda_.w #1,a5 ; Increment loop counter
  7292. cmpa.w #0,a5 ; Have all 8 lines been drawn?
  7293. beq.w SSTrackDraw_return ; If yes, return
  7294. lea (PNT_Buffer).w,a6 ; Destination buffer
  7295. swap d0 ; High word starts at 0
  7296. addi.w #$100,d0 ; Adding $100 means seek to end of current line/start of next line
  7297. andi.w #$F00,d0 ; Keep to confines
  7298. adda.w d0,a6 ; Seek to end of current line
  7299. swap d0 ; Leaves the low word of d0 free for use
  7300.  
  7301. ;loc_5DA8
  7302. SSTrackDrawFlipLoop_Inner:
  7303. moveq #0,d1
  7304. subq.w #1,d7 ; Subtract 1 from bit counter
  7305. bpl.s + ; Branch if we still have bits we can use
  7306. move.b (a0)+,d6 ; Get a new byte from bit flags
  7307. moveq #7,d7 ; We now have 8 fresh new bits
  7308. +
  7309. add.b d6,d6 ; Do we have to use RLE compression?
  7310. bcc.s SSTrackDrawFlipRLE ; Branch if yes
  7311. subq.b #1,d5 ; Subtract 1 from bit counter
  7312. bpl.s + ; Branch if we still have bits we can use
  7313. move.b (a1)+,d4 ; Get a new byte from uncompressed mappings pointer
  7314. moveq #7,d5 ; We now have 8 fresh new bits
  7315. +
  7316. add.b d4,d4 ; Do we need a 10-bit index?
  7317. bcc.s + ; Branch if not
  7318. move.w #$A,d0 ; d0 = 10 bits
  7319. sub.b d5,d0 ; d0 = 10 - d5
  7320. subq.b #3,d0 ; d0 = 7 - d5; why not shorten it to 'moveq #7,d0 \n sub.b d5,d0'?
  7321. add.w d0,d0 ; Convert into table index
  7322. move.w SSTrackDrawFlipUnc_Read10LUT(pc,d0.w),d0
  7323. jmp SSTrackDrawFlipUnc_Read10LUT(pc,d0.w)
  7324. ; ===========================================================================
  7325. ;off_5DD4
  7326. SSTrackDrawFlipUnc_Read10LUT: offsetTable
  7327. offsetTableEntry.w SSTrackDrawFlipUnc_Read10_Got7 ; 0
  7328. offsetTableEntry.w SSTrackDrawFlipUnc_Read10_Got6 ; 1
  7329. offsetTableEntry.w SSTrackDrawFlipUnc_Read10_Got5 ; 2
  7330. offsetTableEntry.w SSTrackDrawFlipUnc_Read10_Got4 ; 3
  7331. offsetTableEntry.w SSTrackDrawFlipUnc_Read10_Got3 ; 4
  7332. offsetTableEntry.w SSTrackDrawFlipUnc_Read10_Got2 ; 5
  7333. offsetTableEntry.w SSTrackDrawFlipUnc_Read10_Got1 ; 6
  7334. offsetTableEntry.w SSTrackDrawFlipUnc_Read10_Got0 ; 7
  7335. ; ===========================================================================
  7336. +
  7337. move.w #6,d0 ; d0 = 6
  7338. sub.b d5,d0 ; d0 = 6 - d5
  7339. addq.b #1,d0 ; d0 = 7 - d5; why not shorten it to 'moveq #7,d0 \n sub.b d5,d0'?
  7340. add.w d0,d0 ; Convert into table index
  7341. move.w SSTrackDrawFlipUnc_Read6LUT(pc,d0.w),d0
  7342. jmp SSTrackDrawFlipUnc_Read6LUT(pc,d0.w)
  7343. ; ===========================================================================
  7344. ;off_5DF6
  7345. SSTrackDrawFlipUnc_Read6LUT: offsetTable
  7346. offsetTableEntry.w SSTrackDrawFlipUnc_Read6_Got7 ; 0
  7347. offsetTableEntry.w SSTrackDrawFlipUnc_Read6_Got6 ; 1
  7348. offsetTableEntry.w SSTrackDrawFlipUnc_Read6_Got5 ; 2
  7349. offsetTableEntry.w SSTrackDrawFlipUnc_Read6_Got4 ; 3
  7350. offsetTableEntry.w SSTrackDrawFlipUnc_Read6_Got3 ; 4
  7351. offsetTableEntry.w SSTrackDrawFlipUnc_Read6_Got2 ; 5
  7352. offsetTableEntry.w SSTrackDrawFlipUnc_Read6_Got1 ; 6
  7353. offsetTableEntry.w SSTrackDrawFlipUnc_Read6_Got0 ; 7
  7354. ; ===========================================================================
  7355. ;loc_5E06
  7356. SSTrackDrawFlipRLE:
  7357. subq.b #1,d3 ; Subtract 1 from bit counter
  7358. bpl.s ++ ; Branch if we still have bits we can use
  7359. move.b (a2)+,d2 ; Get a new byte from RLE mappings pointer
  7360. cmpi.b #-1,d2 ; Is d2 equal to -1?
  7361. bne.s + ; Branch if not
  7362. moveq #0,d3 ; Set bit counter to zero
  7363. bra.w SSTrackDrawLineFlipLoop
  7364. ; ===========================================================================
  7365. +
  7366. moveq #7,d3 ; We now have 8 fresh new bits
  7367. +
  7368. add.b d2,d2 ; Do we need a 7-bit index?
  7369. bcc.s + ; Branch if not
  7370. move.w #7,d0 ; d0 = 7
  7371. sub.b d3,d0 ; d0 = 10 - d3
  7372. add.b d0,d0 ; Convert into table index
  7373. move.w SSTrackDrawFlipRLE_Read7LUT(pc,d0.w),d0
  7374. jmp SSTrackDrawFlipRLE_Read7LUT(pc,d0.w)
  7375. ; ===========================================================================
  7376. ;off_5E2E
  7377. SSTrackDrawFlipRLE_Read7LUT: offsetTable
  7378. offsetTableEntry.w SSTrackDrawFlipRLE_Read7_Got7 ; 0
  7379. offsetTableEntry.w SSTrackDrawFlipRLE_Read7_Got6 ; 1
  7380. offsetTableEntry.w SSTrackDrawFlipRLE_Read7_Got5 ; 2
  7381. offsetTableEntry.w SSTrackDrawFlipRLE_Read7_Got4 ; 3
  7382. offsetTableEntry.w SSTrackDrawFlipRLE_Read7_Got3 ; 4
  7383. offsetTableEntry.w SSTrackDrawFlipRLE_Read7_Got2 ; 5
  7384. offsetTableEntry.w SSTrackDrawFlipRLE_Read7_Got1 ; 6
  7385. offsetTableEntry.w SSTrackDrawFlipRLE_Read7_Got0 ; 7
  7386. ; ===========================================================================
  7387. +
  7388. move.w #6,d0 ; d0 = 6
  7389. sub.b d3,d0 ; d0 = 6 - d3
  7390. addq.b #1,d0 ; d0 = 7 - d3; why not shorten it to 'moveq #7,d0 \n sub.b d3,d0'?
  7391. add.b d0,d0 ; Convert into table index
  7392. move.w SSTrackDrawFlipRLE_Read6LUT(pc,d0.w),d0
  7393. jmp SSTrackDrawFlipRLE_Read6LUT(pc,d0.w)
  7394. ; ===========================================================================
  7395. ;off_5E50
  7396. SSTrackDrawFlipRLE_Read6LUT: offsetTable
  7397. offsetTableEntry.w SSTrackDrawFlipRLE_Read6_Got7 ; 0
  7398. offsetTableEntry.w SSTrackDrawFlipRLE_Read6_Got6 ; 1
  7399. offsetTableEntry.w SSTrackDrawFlipRLE_Read6_Got5 ; 2
  7400. offsetTableEntry.w SSTrackDrawFlipRLE_Read6_Got4 ; 3
  7401. offsetTableEntry.w SSTrackDrawFlipRLE_Read6_Got3 ; 4
  7402. offsetTableEntry.w SSTrackDrawFlipRLE_Read6_Got2 ; 5
  7403. offsetTableEntry.w SSTrackDrawFlipRLE_Read6_Got1 ; 6
  7404. offsetTableEntry.w SSTrackDrawFlipRLE_Read6_Got0 ; 7
  7405. ; ===========================================================================
  7406. ;loc_5E60
  7407. SSTrackDrawFlipUnc_Read10_Got0:
  7408. ; Reads 10 bits from uncompressed mappings, 0 bits in bit buffer
  7409. move.w #0,d0
  7410. move.b (a1)+,d0
  7411. lsl.w #2,d0
  7412. move.b (a1)+,d4
  7413. rol.b #2,d4
  7414. move.b d4,d1
  7415. andi.b #3,d1
  7416. or.b d1,d0
  7417. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  7418. add.w d0,d0
  7419. move.w (a3,d0.w),d0
  7420. eori.w #flip_x|palette_line_3,d0
  7421. move.w d0,-(a6)
  7422. moveq #6,d5 ; Bit buffer now has 6 bits
  7423. bra.w SSTrackDrawFlipLoop_Inner
  7424. ; ===========================================================================
  7425. ;loc_5E8A
  7426. SSTrackDrawFlipUnc_Read10_Got1:
  7427. ; Reads 10 bits from uncompressed mappings, 1 bit in bit buffer
  7428. move.b d4,d0
  7429. lsl.w #2,d0
  7430. andi.w #$200,d0
  7431. move.b (a1)+,d1
  7432. lsl.w #1,d1
  7433. or.w d1,d0
  7434. move.b (a1)+,d4
  7435. rol.b #1,d4
  7436. move.b d4,d1
  7437. andi.b #1,d1
  7438. or.b d1,d0
  7439. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  7440. add.w d0,d0
  7441. move.w (a3,d0.w),d0
  7442. eori.w #flip_x|palette_line_3,d0
  7443. move.w d0,-(a6)
  7444. moveq #7,d5 ; Bit buffer now has 7 bits
  7445. bra.w SSTrackDrawFlipLoop_Inner
  7446. ; ===========================================================================
  7447. ;loc_5EBA
  7448. SSTrackDrawFlipUnc_Read10_Got2:
  7449. ; Reads 10 bits from uncompressed mappings, 2 bits in bit buffer
  7450. move.b d4,d0
  7451. lsl.w #2,d0
  7452. andi.w #$300,d0
  7453. move.b (a1)+,d0
  7454. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  7455. add.w d0,d0
  7456. move.w (a3,d0.w),d0
  7457. eori.w #flip_x|palette_line_3,d0
  7458. move.w d0,-(a6)
  7459. moveq #0,d5 ; Bit buffer now empty
  7460. bra.w SSTrackDrawFlipLoop_Inner
  7461. ; ===========================================================================
  7462. ;loc_5EDA
  7463. SSTrackDrawFlipUnc_Read10_Got3:
  7464. ; Reads 10 bits from uncompressed mappings, 3 bits in bit buffer
  7465. move.b d4,d0
  7466. lsl.w #2,d0
  7467. andi.w #$380,d0
  7468. move.b (a1)+,d4
  7469. ror.b #1,d4
  7470. move.b d4,d1
  7471. andi.b #$7F,d1
  7472. or.b d1,d0
  7473. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  7474. add.w d0,d0
  7475. move.w (a3,d0.w),d0
  7476. eori.w #flip_x|palette_line_3,d0
  7477. move.w d0,-(a6)
  7478. moveq #1,d5 ; Bit buffer now has 1 bit
  7479. bra.w SSTrackDrawFlipLoop_Inner
  7480. ; ===========================================================================
  7481. ;loc_5F04
  7482. SSTrackDrawFlipUnc_Read10_Got4:
  7483. ; Reads 10 bits from uncompressed mappings, 4 bits in bit buffer
  7484. move.b d4,d0
  7485. lsl.w #2,d0
  7486. andi.w #$3C0,d0
  7487. move.b (a1)+,d4
  7488. ror.b #2,d4
  7489. move.b d4,d1
  7490. andi.b #$3F,d1
  7491. or.b d1,d0
  7492. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  7493. add.w d0,d0
  7494. move.w (a3,d0.w),d0
  7495. eori.w #flip_x|palette_line_3,d0
  7496. move.w d0,-(a6)
  7497. moveq #2,d5 ; Bit buffer now has 2 bits
  7498. bra.w SSTrackDrawFlipLoop_Inner
  7499. ; ===========================================================================
  7500. ;loc_5F2E
  7501. SSTrackDrawFlipUnc_Read10_Got5:
  7502. ; Reads 10 bits from uncompressed mappings, 5 bits in bit buffer
  7503. move.b d4,d0
  7504. lsl.w #2,d0
  7505. andi.w #$3E0,d0
  7506. move.b (a1)+,d4
  7507. ror.b #3,d4
  7508. move.b d4,d1
  7509. andi.b #$1F,d1
  7510. or.b d1,d0
  7511. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  7512. add.w d0,d0
  7513. move.w (a3,d0.w),d0
  7514. eori.w #flip_x|palette_line_3,d0
  7515. move.w d0,-(a6)
  7516. moveq #3,d5 ; Bit buffer now has 3 bits
  7517. bra.w SSTrackDrawFlipLoop_Inner
  7518. ; ===========================================================================
  7519. ;loc_5F58
  7520. SSTrackDrawFlipUnc_Read10_Got6:
  7521. ; Reads 10 bits from uncompressed mappings, 6 bits in bit buffer
  7522. move.b d4,d0
  7523. lsl.w #2,d0
  7524. andi.w #$3F0,d0
  7525. move.b (a1)+,d4
  7526. ror.b #4,d4
  7527. move.b d4,d1
  7528. andi.b #$F,d1
  7529. or.b d1,d0
  7530. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  7531. add.w d0,d0
  7532. move.w (a3,d0.w),d0
  7533. eori.w #flip_x|palette_line_3,d0
  7534. move.w d0,-(a6)
  7535. moveq #4,d5 ; Bit buffer now has 4 bits
  7536. bra.w SSTrackDrawFlipLoop_Inner
  7537. ; ===========================================================================
  7538. ;loc_5F82
  7539. SSTrackDrawFlipUnc_Read10_Got7:
  7540. ; Reads 10 bits from uncompressed mappings, 7 bits in bit buffer
  7541. move.b d4,d0
  7542. lsl.w #2,d0
  7543. andi.w #$3F8,d0
  7544. move.b (a1)+,d4
  7545. rol.b #3,d4
  7546. move.b d4,d1
  7547. andi.b #7,d1
  7548. or.b d1,d0
  7549. addi.w #(SSPNT_UncLUT_Part2-SSPNT_UncLUT)/2,d0
  7550. add.w d0,d0
  7551. move.w (a3,d0.w),d0
  7552. eori.w #flip_x|palette_line_3,d0
  7553. move.w d0,-(a6)
  7554. moveq #5,d5 ; Bit buffer now has 5 bits
  7555. bra.w SSTrackDrawFlipLoop_Inner
  7556. ; ===========================================================================
  7557. ;loc_5FAC
  7558. SSTrackDrawFlipUnc_Read6_Got0:
  7559. ; Reads 6 bits from uncompressed mappings, 0 bits in bit buffer
  7560. move.b (a1)+,d4
  7561. ror.b #2,d4
  7562. move.b d4,d0
  7563. andi.w #$3F,d0
  7564. add.w d0,d0
  7565. move.w (a3,d0.w),d0
  7566. eori.w #flip_x|palette_line_3,d0
  7567. move.w d0,-(a6)
  7568. moveq #2,d5 ; Bit buffer now has 2 bits
  7569. bra.w SSTrackDrawFlipLoop_Inner
  7570. ; ===========================================================================
  7571. ;loc_5FC8
  7572. SSTrackDrawFlipUnc_Read6_Got1:
  7573. ; Reads 6 bits from uncompressed mappings, 1 bit in bit buffer
  7574. move.b d4,d0
  7575. lsr.b #2,d0
  7576. andi.w #$20,d0
  7577. move.b (a1)+,d4
  7578. ror.b #3,d4
  7579. move.b d4,d1
  7580. andi.b #$1F,d1
  7581. or.b d1,d0
  7582. add.w d0,d0
  7583. move.w (a3,d0.w),d0
  7584. eori.w #flip_x|palette_line_3,d0
  7585. move.w d0,-(a6)
  7586. moveq #3,d5 ; Bit buffer now has 3 bits
  7587. bra.w SSTrackDrawFlipLoop_Inner
  7588. ; ===========================================================================
  7589. ;loc_5FEE
  7590. SSTrackDrawFlipUnc_Read6_Got2:
  7591. ; Reads 6 bits from uncompressed mappings, 2 bits in bit buffer
  7592. move.b d4,d0
  7593. lsr.b #2,d0
  7594. andi.w #$30,d0
  7595. move.b (a1)+,d4
  7596. ror.b #4,d4
  7597. move.b d4,d1
  7598. andi.b #$F,d1
  7599. or.b d1,d0
  7600. add.w d0,d0
  7601. move.w (a3,d0.w),d0
  7602. eori.w #flip_x|palette_line_3,d0
  7603. move.w d0,-(a6)
  7604. moveq #4,d5 ; Bit buffer now has 4 bits
  7605. bra.w SSTrackDrawFlipLoop_Inner
  7606. ; ===========================================================================
  7607. ;loc_6014
  7608. SSTrackDrawFlipUnc_Read6_Got3:
  7609. ; Reads 6 bits from uncompressed mappings, 3 bits in bit buffer
  7610. move.b d4,d0
  7611. lsr.b #2,d0
  7612. andi.w #$38,d0
  7613. move.b (a1)+,d4
  7614. rol.b #3,d4
  7615. move.b d4,d1
  7616. andi.b #7,d1
  7617. or.b d1,d0
  7618. add.w d0,d0
  7619. move.w (a3,d0.w),d0
  7620. eori.w #flip_x|palette_line_3,d0
  7621. move.w d0,-(a6)
  7622. moveq #5,d5 ; Bit buffer now has 5 bits
  7623. bra.w SSTrackDrawFlipLoop_Inner
  7624. ; ===========================================================================
  7625. ;loc_603A
  7626. SSTrackDrawFlipUnc_Read6_Got4:
  7627. ; Reads 6 bits from uncompressed mappings, 4 bits in bit buffer
  7628. move.b d4,d0
  7629. lsr.b #2,d0
  7630. andi.w #$3C,d0
  7631. move.b (a1)+,d4
  7632. rol.b #2,d4
  7633. move.b d4,d1
  7634. andi.b #3,d1
  7635. or.b d1,d0
  7636. add.w d0,d0
  7637. move.w (a3,d0.w),d0
  7638. eori.w #flip_x|palette_line_3,d0
  7639. move.w d0,-(a6)
  7640. moveq #6,d5 ; Bit buffer now has 6 bits
  7641. bra.w SSTrackDrawFlipLoop_Inner
  7642. ; ===========================================================================
  7643. ;loc_6060
  7644. SSTrackDrawFlipUnc_Read6_Got5:
  7645. ; Reads 6 bits from uncompressed mappings, 5 bits in bit buffer
  7646. move.b d4,d0
  7647. lsr.b #2,d0
  7648. andi.w #$3E,d0
  7649. move.b (a1)+,d4
  7650. rol.b #1,d4
  7651. move.b d4,d1
  7652. andi.b #1,d1
  7653. or.b d1,d0
  7654. add.w d0,d0
  7655. move.w (a3,d0.w),d0
  7656. eori.w #flip_x|palette_line_3,d0
  7657. move.w d0,-(a6)
  7658. moveq #7,d5 ; Bit buffer now has 7 bits
  7659. bra.w SSTrackDrawFlipLoop_Inner
  7660. ; ===========================================================================
  7661. ;loc_6086
  7662. SSTrackDrawFlipUnc_Read6_Got6:
  7663. ; Reads 6 bits from uncompressed mappings, 6 bits in bit buffer
  7664. lsr.b #2,d4
  7665. andi.w #$3F,d4
  7666. add.w d4,d4
  7667. move.w (a3,d4.w),d0
  7668. eori.w #flip_x|palette_line_3,d0
  7669. move.w d0,-(a6)
  7670. moveq #0,d5 ; Bit buffer now empty
  7671. bra.w SSTrackDrawFlipLoop_Inner
  7672. ; ===========================================================================
  7673. ;loc_609E
  7674. SSTrackDrawFlipUnc_Read6_Got7:
  7675. ; Reads 6 bits from uncompressed mappings, 7 bits in bit buffer
  7676. ror.b #2,d4
  7677. move.b d4,d0
  7678. andi.w #$3F,d0
  7679. add.w d0,d0
  7680. move.w (a3,d0.w),d0
  7681. eori.w #flip_x|palette_line_3,d0
  7682. move.w d0,-(a6)
  7683. moveq #1,d5 ; Bit buffer now has 1 bit
  7684. bra.w SSTrackDrawFlipLoop_Inner
  7685. ; ===========================================================================
  7686. ;loc_60B8
  7687. SSTrackDrawFlipRLE_Read7_Got0:
  7688. ; Reads 7 bits from RLE-compressed mappings, 0 bits in bit buffer
  7689. move.b (a2)+,d2
  7690. ror.b #1,d2
  7691. move.b d2,d0
  7692. andi.w #$7F,d0
  7693. moveq #1,d3 ; Bit buffer now has 1 bit
  7694. cmpi.b #$7F,d0
  7695. beq.w SSTrackDrawLineFlipLoop
  7696. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7697. add.w d0,d0
  7698. add.w d0,d0
  7699. move.w (a4,d0.w),d1
  7700. move.w 2(a4,d0.w),d0
  7701. ori.w #palette_line_3|high_priority,d1
  7702.  
  7703. - move.w d1,-(a6)
  7704. dbf d0,-
  7705.  
  7706. bra.w SSTrackDrawFlipLoop_Inner
  7707. ; ===========================================================================
  7708. ;loc_60EA
  7709. SSTrackDrawFlipRLE_Read7_Got1:
  7710. ; Reads 7 bits from RLE-compressed mappings, 1 bit in bit buffer
  7711. move.b d2,d1
  7712. lsr.b #1,d1
  7713. andi.b #$40,d1
  7714. move.b (a2)+,d2
  7715. ror.b #2,d2
  7716. move.b d2,d0
  7717. andi.w #$3F,d0
  7718. or.b d1,d0
  7719. moveq #2,d3 ; Bit buffer now has 2 bits
  7720. cmpi.b #$7F,d0
  7721. beq.w SSTrackDrawLineFlipLoop
  7722. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7723. add.w d0,d0
  7724. add.w d0,d0
  7725. move.w (a4,d0.w),d1
  7726. move.w 2(a4,d0.w),d0
  7727. ori.w #palette_line_3|high_priority,d1
  7728.  
  7729. - move.w d1,-(a6)
  7730. dbf d0,-
  7731.  
  7732. bra.w SSTrackDrawFlipLoop_Inner
  7733. ; ===========================================================================
  7734. ;loc_6126
  7735. SSTrackDrawFlipRLE_Read7_Got2:
  7736. ; Reads 7 bits from RLE-compressed mappings, 2 bits in bit buffer
  7737. move.b d2,d1
  7738. lsr.b #1,d1
  7739. andi.b #$60,d1
  7740. move.b (a2)+,d2
  7741. ror.b #3,d2
  7742. move.b d2,d0
  7743. andi.w #$1F,d0
  7744. or.b d1,d0
  7745. moveq #3,d3 ; Bit buffer now has 3 bits
  7746. cmpi.b #$7F,d0
  7747. beq.w SSTrackDrawLineFlipLoop
  7748. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7749. add.w d0,d0
  7750. add.w d0,d0
  7751. move.w (a4,d0.w),d1
  7752. move.w 2(a4,d0.w),d0
  7753. ori.w #palette_line_3|high_priority,d1
  7754.  
  7755. - move.w d1,-(a6)
  7756. dbf d0,-
  7757.  
  7758. bra.w SSTrackDrawFlipLoop_Inner
  7759. ; ===========================================================================
  7760. ;loc_6162
  7761. SSTrackDrawFlipRLE_Read7_Got3:
  7762. ; Reads 7 bits from RLE-compressed mappings, 3 bits in bit buffer
  7763. move.b d2,d1
  7764. lsr.b #1,d1
  7765. andi.b #$70,d1
  7766. move.b (a2)+,d2
  7767. ror.b #4,d2
  7768. move.b d2,d0
  7769. andi.w #$F,d0
  7770. or.b d1,d0
  7771. moveq #4,d3 ; Bit buffer now has 4 bits
  7772. cmpi.b #$7F,d0
  7773. beq.w SSTrackDrawLineFlipLoop
  7774. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7775. add.w d0,d0
  7776. add.w d0,d0
  7777. move.w (a4,d0.w),d1
  7778. move.w 2(a4,d0.w),d0
  7779. ori.w #palette_line_3|high_priority,d1
  7780.  
  7781. - move.w d1,-(a6)
  7782. dbf d0,-
  7783.  
  7784. bra.w SSTrackDrawFlipLoop_Inner
  7785. ; ===========================================================================
  7786. ;loc_619E
  7787. SSTrackDrawFlipRLE_Read7_Got4:
  7788. ; Reads 7 bits from RLE-compressed mappings, 4 bits in bit buffer
  7789. move.b d2,d1
  7790. lsr.b #1,d1
  7791. andi.b #$78,d1
  7792. move.b (a2)+,d2
  7793. rol.b #3,d2
  7794. move.b d2,d0
  7795. andi.w #7,d0
  7796. or.b d1,d0
  7797. moveq #5,d3 ; Bit buffer now has 5 bits
  7798. cmpi.b #$7F,d0
  7799. beq.w SSTrackDrawLineFlipLoop
  7800. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7801. add.w d0,d0
  7802. add.w d0,d0
  7803. move.w (a4,d0.w),d1
  7804. move.w 2(a4,d0.w),d0
  7805. ori.w #palette_line_3|high_priority,d1
  7806.  
  7807. - move.w d1,-(a6)
  7808. dbf d0,-
  7809.  
  7810. bra.w SSTrackDrawFlipLoop_Inner
  7811. ; ===========================================================================
  7812. ;loc_61DA
  7813. SSTrackDrawFlipRLE_Read7_Got5:
  7814. ; Reads 7 bits from RLE-compressed mappings, 5 bits in bit buffer
  7815. move.b d2,d1
  7816. lsr.b #1,d1
  7817. andi.b #$7C,d1
  7818. move.b (a2)+,d2
  7819. rol.b #2,d2
  7820. move.b d2,d0
  7821. andi.w #3,d0
  7822. or.b d1,d0
  7823. moveq #6,d3 ; Bit buffer now has 6 bits
  7824. cmpi.b #$7F,d0
  7825. beq.w SSTrackDrawLineFlipLoop
  7826. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7827. add.w d0,d0
  7828. add.w d0,d0
  7829. move.w (a4,d0.w),d1
  7830. move.w 2(a4,d0.w),d0
  7831. ori.w #palette_line_3|high_priority,d1
  7832.  
  7833. - move.w d1,-(a6)
  7834. dbf d0,-
  7835.  
  7836. bra.w SSTrackDrawFlipLoop_Inner
  7837. ; ===========================================================================
  7838. ;loc_6216
  7839. SSTrackDrawFlipRLE_Read7_Got6:
  7840. ; Reads 7 bits from RLE-compressed mappings, 6 bits in bit buffer
  7841. move.b d2,d1
  7842. lsr.b #1,d1
  7843. andi.b #$7E,d1
  7844. move.b (a2)+,d2
  7845. rol.b #1,d2
  7846. move.b d2,d0
  7847. andi.w #1,d0
  7848. or.b d1,d0
  7849. moveq #7,d3 ; Bit buffer now has 7 bits
  7850. cmpi.b #$7F,d0
  7851. beq.w SSTrackDrawLineFlipLoop
  7852. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d0
  7853. add.w d0,d0
  7854. add.w d0,d0
  7855. move.w (a4,d0.w),d1
  7856. move.w 2(a4,d0.w),d0
  7857. ori.w #palette_line_3|high_priority,d1
  7858.  
  7859. - move.w d1,-(a6)
  7860. dbf d0,-
  7861.  
  7862. bra.w SSTrackDrawFlipLoop_Inner
  7863. ; ===========================================================================
  7864. ;loc_6252
  7865. SSTrackDrawFlipRLE_Read7_Got7:
  7866. ; Reads 7 bits from RLE-compressed mappings, 7 bits in bit buffer
  7867. lsr.b #1,d2
  7868. andi.w #$7F,d2
  7869. moveq #0,d3 ; Bit buffer now empty
  7870. cmpi.b #$7F,d2
  7871. beq.w SSTrackDrawLineFlipLoop
  7872. addi.w #(SSPNT_RLELUT_Part2-SSPNT_RLELUT)/4,d2
  7873. add.w d2,d2
  7874. add.w d2,d2
  7875. move.w (a4,d2.w),d1
  7876. move.w 2(a4,d2.w),d0
  7877. ori.w #palette_line_3|high_priority,d1
  7878.  
  7879. - move.w d1,-(a6)
  7880. dbf d0,-
  7881.  
  7882. bra.w SSTrackDrawFlipLoop_Inner
  7883. ; ===========================================================================
  7884. ;loc_6280
  7885. SSTrackDrawFlipRLE_Read6_Got0:
  7886. ; Reads 6 bits from RLE-compressed mappings, 0 bits in bit buffer
  7887. move.b (a2)+,d2
  7888. ror.b #2,d2
  7889. move.b d2,d0
  7890. andi.w #$3F,d0
  7891. add.w d0,d0
  7892. add.w d0,d0
  7893. moveq #2,d3 ; Bit buffer now has 2 bits
  7894. move.w (a4,d0.w),d1
  7895. move.w 2(a4,d0.w),d0
  7896. ori.w #palette_line_3|high_priority,d1
  7897.  
  7898. - move.w d1,-(a6)
  7899. dbf d0,-
  7900.  
  7901. bra.w SSTrackDrawFlipLoop_Inner
  7902. ; ===========================================================================
  7903. ;loc_62A6
  7904. SSTrackDrawFlipRLE_Read6_Got1:
  7905. ; Reads 6 bits from RLE-compressed mappings, 1 bit in bit buffer
  7906. move.b d2,d0
  7907. lsr.b #2,d0
  7908. andi.w #$20,d0
  7909. move.b (a2)+,d2
  7910. ror.b #3,d2
  7911. move.b d2,d1
  7912. andi.b #$1F,d1
  7913. or.b d1,d0
  7914. moveq #3,d3 ; Bit buffer now has 3 bits
  7915. add.w d0,d0
  7916. add.w d0,d0
  7917. move.w (a4,d0.w),d1
  7918. move.w 2(a4,d0.w),d0
  7919. ori.w #palette_line_3|high_priority,d1
  7920.  
  7921. - move.w d1,-(a6)
  7922. dbf d0,-
  7923.  
  7924. bra.w SSTrackDrawFlipLoop_Inner
  7925. ; ===========================================================================
  7926. ;loc_62D6
  7927. SSTrackDrawFlipRLE_Read6_Got2:
  7928. ; Reads 6 bits from RLE-compressed mappings, 2 bits in bit buffer
  7929. move.b d2,d0
  7930. lsr.b #2,d0
  7931. andi.w #$30,d0
  7932. move.b (a2)+,d2
  7933. ror.b #4,d2
  7934. move.b d2,d1
  7935. andi.b #$F,d1
  7936. or.b d1,d0
  7937. add.w d0,d0
  7938. add.w d0,d0
  7939. moveq #4,d3 ; Bit buffer now has 4 bits
  7940. move.w (a4,d0.w),d1
  7941. move.w 2(a4,d0.w),d0
  7942. ori.w #palette_line_3|high_priority,d1
  7943.  
  7944. - move.w d1,-(a6)
  7945. dbf d0,-
  7946.  
  7947. bra.w SSTrackDrawFlipLoop_Inner
  7948. ; ===========================================================================
  7949. ;loc_6306
  7950. SSTrackDrawFlipRLE_Read6_Got3:
  7951. ; Reads 6 bits from RLE-compressed mappings, 3 bits in bit buffer
  7952. move.b d2,d0
  7953. lsr.b #2,d0
  7954. andi.w #$38,d0
  7955. move.b (a2)+,d2
  7956. rol.b #3,d2
  7957. move.b d2,d1
  7958. andi.b #7,d1
  7959. or.b d1,d0
  7960. add.w d0,d0
  7961. add.w d0,d0
  7962. moveq #5,d3 ; Bit buffer now has 5 bits
  7963. move.w (a4,d0.w),d1
  7964. move.w 2(a4,d0.w),d0
  7965. ori.w #palette_line_3|high_priority,d1
  7966.  
  7967. - move.w d1,-(a6)
  7968. dbf d0,-
  7969.  
  7970. bra.w SSTrackDrawFlipLoop_Inner
  7971. ; ===========================================================================
  7972. ;loc_6336
  7973. SSTrackDrawFlipRLE_Read6_Got4:
  7974. ; Reads 6 bits from RLE-compressed mappings, 4 bits in bit buffer
  7975. move.b d2,d0
  7976. lsr.b #2,d0
  7977. andi.w #$3C,d0
  7978. move.b (a2)+,d2
  7979. rol.b #2,d2
  7980. move.b d2,d1
  7981. andi.b #3,d1
  7982. or.b d1,d0
  7983. add.w d0,d0
  7984. add.w d0,d0
  7985. moveq #6,d3 ; Bit buffer now has 6 bits
  7986. move.w (a4,d0.w),d1
  7987. move.w 2(a4,d0.w),d0
  7988. ori.w #palette_line_3|high_priority,d1
  7989.  
  7990. - move.w d1,-(a6)
  7991. dbf d0,-
  7992.  
  7993. bra.w SSTrackDrawFlipLoop_Inner
  7994. ; ===========================================================================
  7995. ;loc_6366
  7996. SSTrackDrawFlipRLE_Read6_Got5:
  7997. ; Reads 6 bits from RLE-compressed mappings, 5 bits in bit buffer
  7998. move.b d2,d0
  7999. lsr.b #2,d0
  8000. andi.w #$3E,d0
  8001. move.b (a2)+,d2
  8002. rol.b #1,d2
  8003. move.b d2,d1
  8004. andi.b #1,d1
  8005. or.b d1,d0
  8006. add.w d0,d0
  8007. add.w d0,d0
  8008. moveq #7,d3 ; Bit buffer now has 7 bits
  8009. move.w (a4,d0.w),d1
  8010. move.w 2(a4,d0.w),d0
  8011. ori.w #palette_line_3|high_priority,d1
  8012.  
  8013. - move.w d1,-(a6)
  8014. dbf d0,-
  8015.  
  8016. bra.w SSTrackDrawFlipLoop_Inner
  8017. ; ===========================================================================
  8018. ;loc_6396
  8019. SSTrackDrawFlipRLE_Read6_Got6:
  8020. ; Reads 6 bits from RLE-compressed mappings, 6 bits in bit buffer
  8021. lsr.b #2,d2
  8022. andi.w #$3F,d2
  8023. add.w d2,d2
  8024. add.w d2,d2
  8025. moveq #0,d3 ; Bit buffer now empty
  8026. move.w (a4,d2.w),d1
  8027. move.w 2(a4,d2.w),d0
  8028. ori.w #palette_line_3|high_priority,d1
  8029.  
  8030. - move.w d1,-(a6)
  8031. dbf d0,-
  8032.  
  8033. bra.w SSTrackDrawFlipLoop_Inner
  8034. ; ===========================================================================
  8035. ;loc_63B8
  8036. SSTrackDrawFlipRLE_Read6_Got7:
  8037. ; Reads 6 bits from RLE-compressed mappings, 7 bits in bit buffer
  8038. ror.b #2,d2
  8039. move.b d2,d0
  8040. andi.w #$3F,d0
  8041. add.w d0,d0
  8042. add.w d0,d0
  8043. moveq #1,d3 ; Bit buffer now has 1 bit
  8044. move.w (a4,d0.w),d1
  8045. move.w 2(a4,d0.w),d0
  8046. ori.w #palette_line_3|high_priority,d1
  8047.  
  8048. - move.w d1,-(a6)
  8049. dbf d0,-
  8050.  
  8051. bra.w SSTrackDrawFlipLoop_Inner
  8052.  
  8053. ; ===========================================================================
  8054. ; frames of animation of the special stage track
  8055. ; this chooses how objects curve along the track as well as which track frame to draw
  8056. ; off_63DC:
  8057. Ani_SpecialStageTrack: offsetTable
  8058. offsetTableEntry.w SSTrackAni_TurnThenRise ; 0
  8059. offsetTableEntry.w SSTrackAni_TurnThenDrop ; 1
  8060. offsetTableEntry.w SSTrackAni_TurnThenStraight ; 2
  8061. offsetTableEntry.w SSTrackAni_Straight ; 3
  8062. offsetTableEntry.w SSTrackAni_StraightThenTurn ; 4
  8063. ; byte_63E6:
  8064. SSTrackAni_TurnThenRise:
  8065. dc.b $26,$27,$28,$29,$2A,$2B,$26 ; turning
  8066. dc.b 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, $A, $B, $C, $D, $E, $F,$10 ; rise
  8067. SSTrackAni_TurnThenRise_End:
  8068. ; byte_63FE:
  8069. SSTrackAni_TurnThenDrop:
  8070. dc.b $26,$27,$28,$29,$2A,$2B,$26 ; turning
  8071. dc.b $15,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F,$20,$21,$22,$23,$24,$25 ; drop
  8072. SSTrackAni_TurnThenDrop_End:
  8073. ; byte_6416:
  8074. SSTrackAni_TurnThenStraight:
  8075. dc.b $26,$27,$28,$29,$2A,$2B,$26 ; turning
  8076. dc.b $2C,$2D,$2E,$2F,$30 ; exit turn
  8077. SSTrackAni_TurnThenStraight_End:
  8078. ; byte_6422:
  8079. SSTrackAni_Straight:
  8080. dc.b $11,$12,$13,$14,$11,$12,$13,$14 ; straight
  8081. dc.b $11,$12,$13,$14,$11,$12,$13,$14 ; straight
  8082. SSTrackAni_Straight_End:
  8083. ; byte_6432:
  8084. SSTrackAni_StraightThenTurn:
  8085. dc.b $11,$12,$13,$14 ; straight
  8086. dc.b $31,$32,$33,$34,$35,$36,$37 ; enter turn
  8087. SSTrackAni_StraightThenTurn_End:
  8088.  
  8089. even
  8090.  
  8091. ; ===========================================================================
  8092. ; pointers to the mappings for each frame of the special stage track
  8093. ; indexed into by the numbers used in the above animations
  8094. ;
  8095. ; Format of each mappings file:
  8096. ; File is divided in 3 segments, with the same structure:
  8097. ; Segment structure:
  8098. ; 4-byte unsigned length of segment (not counting the 4 bytes used for length);
  8099. ; the first 2 bytes of each length is ignored, and only the last 2 bytes are
  8100. ; actually used.
  8101. ; Rest of the segment is mappings data, as follows:
  8102. ; 1st segment:
  8103. ; Mappings data is a bitstream indicating whether to draw a single tile at
  8104. ; a time using the uncompressed mappings (see 2nd segment) or a sequence of
  8105. ; tiles using the RLE mappings (see 3rd segment).
  8106. ; 2nd segment:
  8107. ; Mappings data is a bitstream: the first bit in each cycle determines how
  8108. ; many bits from the stream are to be used as an index to the uncompressed
  8109. ; pattern name list SSPNT_UncLUT: if the first bit is set, 10 bits form an
  8110. ; index into SSPNT_UncLUT_Part2, otherwise 6 bits are used as an index into
  8111. ; SSPNT_UncLUT.
  8112. ; These tiles are drawn in palette line 3.
  8113. ; 3nd segment:
  8114. ; Mappings data is a bitstream: the first bit in each cycle determines how
  8115. ; many bits from the stream are to be used as an index to the RLE-compressed
  8116. ; pattern name list SSPNT_RLELUT: if the first bit is set, 7 bits form an
  8117. ; index into SSPNT_RLELUT_Part2, otherwise 6 bits are used as an index into
  8118. ; SSPNT_RLELUT.
  8119. ; These tiles are drawn in palette line 3, with the high priority bit set.
  8120. ; off_643E:
  8121. Map_SpecialStageTrack:
  8122. dc.l MapSpec_Rise1 ; 0
  8123. dc.l MapSpec_Rise2 ; 1
  8124. dc.l MapSpec_Rise3 ; 2
  8125. dc.l MapSpec_Rise4 ; 3
  8126. dc.l MapSpec_Rise5 ; 4
  8127. dc.l MapSpec_Rise6 ; 5
  8128. dc.l MapSpec_Rise7 ; 6
  8129. dc.l MapSpec_Rise8 ; 7
  8130. dc.l MapSpec_Rise9 ; 8
  8131. dc.l MapSpec_Rise10 ; 9
  8132. dc.l MapSpec_Rise11 ; $A
  8133. dc.l MapSpec_Rise12 ; $B
  8134. dc.l MapSpec_Rise13 ; $C
  8135. dc.l MapSpec_Rise14 ; $D ; This may flip the special stage's horizontal orientation
  8136. dc.l MapSpec_Rise15 ; $E
  8137. dc.l MapSpec_Rise16 ; $F
  8138. dc.l MapSpec_Rise17 ; $10
  8139. dc.l MapSpec_Straight1 ; $11
  8140. dc.l MapSpec_Straight2 ; $12 ; This may flip the special stage's horizontal orientation
  8141. dc.l MapSpec_Straight3 ; $13
  8142. dc.l MapSpec_Straight4 ; $14
  8143. dc.l MapSpec_Drop1 ; $15
  8144. dc.l MapSpec_Drop2 ; $16
  8145. dc.l MapSpec_Drop3 ; $17
  8146. dc.l MapSpec_Drop4 ; $18
  8147. dc.l MapSpec_Drop5 ; $19
  8148. dc.l MapSpec_Drop6 ; $1A ; This may flip the special stage's horizontal orientation
  8149. dc.l MapSpec_Drop7 ; $1B
  8150. dc.l MapSpec_Drop8 ; $1C
  8151. dc.l MapSpec_Drop9 ; $1D
  8152. dc.l MapSpec_Drop10 ; $1E
  8153. dc.l MapSpec_Drop11 ; $1F
  8154. dc.l MapSpec_Drop12 ; $20
  8155. dc.l MapSpec_Drop13 ; $21
  8156. dc.l MapSpec_Drop14 ; $22
  8157. dc.l MapSpec_Drop15 ; $23
  8158. dc.l MapSpec_Drop16 ; $24
  8159. dc.l MapSpec_Drop17 ; $25
  8160. dc.l MapSpec_Turning1 ; $26
  8161. dc.l MapSpec_Turning2 ; $27
  8162. dc.l MapSpec_Turning3 ; $28
  8163. dc.l MapSpec_Turning4 ; $29
  8164. dc.l MapSpec_Turning5 ; $2A
  8165. dc.l MapSpec_Turning6 ; $2B
  8166. dc.l MapSpec_Unturn1 ; $2C
  8167. dc.l MapSpec_Unturn2 ; $2D
  8168. dc.l MapSpec_Unturn3 ; $2E
  8169. dc.l MapSpec_Unturn4 ; $2F
  8170. dc.l MapSpec_Unturn5 ; $30
  8171. dc.l MapSpec_Turn1 ; $31
  8172. dc.l MapSpec_Turn2 ; $32
  8173. dc.l MapSpec_Turn3 ; $33
  8174. dc.l MapSpec_Turn4 ; $34
  8175. dc.l MapSpec_Turn5 ; $35
  8176. dc.l MapSpec_Turn6 ; $36
  8177. dc.l MapSpec_Turn7 ; $37
  8178.  
  8179. ; These are pattern names. They get sent to either the pattern name table
  8180. ; buffer or one region of one of the plane A name tables in the special stage.
  8181. ; They are indexed by the second segment of the mappings in Map_SpecialStageTrack, above.
  8182. ;word_651E
  8183. SSPNT_UncLUT:
  8184. dc.w make_block_tile($0001,0,0,0,1), make_block_tile($0007,0,0,0,1), make_block_tile($002C,0,0,0,1), make_block_tile($000B,0,0,0,1) ; $00
  8185. dc.w make_block_tile($0024,0,0,0,1), make_block_tile($0024,1,0,0,1), make_block_tile($0039,0,0,0,1), make_block_tile($002B,1,0,0,1) ; $04
  8186. dc.w make_block_tile($005D,0,0,0,1), make_block_tile($005D,1,0,0,1), make_block_tile($002B,0,0,0,1), make_block_tile($004A,0,0,0,1) ; $08
  8187. dc.w make_block_tile($0049,0,0,0,1), make_block_tile($0037,0,0,0,1), make_block_tile($0049,1,0,0,1), make_block_tile($0045,0,0,0,1) ; $0C
  8188. dc.w make_block_tile($0045,1,0,0,1), make_block_tile($003A,1,0,0,1), make_block_tile($0048,0,0,0,1), make_block_tile($0050,1,0,0,1) ; $10
  8189. dc.w make_block_tile($0036,0,0,0,1), make_block_tile($0037,1,0,0,1), make_block_tile($003A,0,0,0,1), make_block_tile($0050,0,0,0,1) ; $14
  8190. dc.w make_block_tile($0042,1,0,0,1), make_block_tile($0042,0,0,0,1), make_block_tile($0015,1,0,0,1), make_block_tile($001D,0,0,0,1) ; $18
  8191. dc.w make_block_tile($004B,0,0,0,1), make_block_tile($0017,1,0,0,1), make_block_tile($0048,1,0,0,1), make_block_tile($0036,1,0,0,1) ; $1C
  8192. dc.w make_block_tile($0038,0,0,0,1), make_block_tile($004B,1,0,0,1), make_block_tile($0015,0,0,0,1), make_block_tile($0021,0,0,0,1) ; $20
  8193. dc.w make_block_tile($0017,0,0,0,1), make_block_tile($0033,0,0,0,1), make_block_tile($001A,0,0,0,1), make_block_tile($002A,0,0,0,1) ; $24
  8194. dc.w make_block_tile($005E,0,0,0,1), make_block_tile($0028,0,0,0,1), make_block_tile($0030,0,0,0,1), make_block_tile($0021,1,0,0,1) ; $28
  8195. dc.w make_block_tile($0038,1,0,0,1), make_block_tile($001A,1,0,0,1), make_block_tile($0025,0,0,0,1), make_block_tile($005E,1,0,0,1) ; $2C
  8196. dc.w make_block_tile($0025,1,0,0,1), make_block_tile($0033,1,0,0,1), make_block_tile($0003,0,0,0,1), make_block_tile($0014,1,0,0,1) ; $30
  8197. dc.w make_block_tile($0014,0,0,0,1), make_block_tile($0004,0,0,0,1), make_block_tile($004E,0,0,0,1), make_block_tile($0003,1,0,0,1) ; $34
  8198. dc.w make_block_tile($000C,0,0,0,1), make_block_tile($002A,1,0,0,1), make_block_tile($0002,0,0,0,1), make_block_tile($0051,0,0,0,1) ; $38
  8199. dc.w make_block_tile($0040,0,0,0,1), make_block_tile($003D,0,0,0,1), make_block_tile($0019,0,0,0,1), make_block_tile($0052,0,0,0,1) ; $3C
  8200. ;word_659E
  8201. SSPNT_UncLUT_Part2:
  8202. dc.w make_block_tile($0009,0,0,0,1), make_block_tile($005A,0,0,0,1), make_block_tile($0030,1,0,0,1), make_block_tile($004E,1,0,0,1) ; $40
  8203. dc.w make_block_tile($0052,1,0,0,1), make_block_tile($0051,1,0,0,1), make_block_tile($0009,1,0,0,1), make_block_tile($0040,1,0,0,1) ; $44
  8204. dc.w make_block_tile($002F,0,0,0,1), make_block_tile($005A,1,0,0,1), make_block_tile($0018,1,0,0,1), make_block_tile($0034,0,0,0,1) ; $48
  8205. dc.w make_block_tile($0019,1,0,0,1), make_block_tile($002F,1,0,0,1), make_block_tile($003D,1,0,0,1), make_block_tile($003E,0,0,0,1) ; $4C
  8206. dc.w make_block_tile($0018,0,0,0,1), make_block_tile($000C,1,0,0,1), make_block_tile($0012,0,0,0,1), make_block_tile($0004,1,0,0,1) ; $50
  8207. dc.w make_block_tile($0026,0,0,0,1), make_block_tile($0034,1,0,0,1), make_block_tile($0005,1,0,0,1), make_block_tile($003B,0,0,0,1) ; $54
  8208. dc.w make_block_tile($003E,1,0,0,1), make_block_tile($003B,1,0,0,1), make_block_tile($0000,0,0,0,1), make_block_tile($0002,1,0,0,1) ; $58
  8209. dc.w make_block_tile($0005,0,0,0,1), make_block_tile($000D,0,0,0,1), make_block_tile($0055,0,0,0,1), make_block_tile($00AF,0,0,0,1) ; $5C
  8210. dc.w make_block_tile($001C,0,0,0,1), make_block_tile($001B,0,0,0,1), make_block_tile($000D,1,0,0,1), make_block_tile($0016,0,0,0,1) ; $60
  8211. dc.w make_block_tile($0012,1,0,0,1), make_block_tile($001F,0,0,0,1), make_block_tile($0032,1,0,0,1), make_block_tile($0013,0,0,0,1) ; $64
  8212. dc.w make_block_tile($0092,0,0,0,1), make_block_tile($0026,1,0,0,1), make_block_tile($0010,0,0,0,1), make_block_tile($004D,0,0,0,1) ; $68
  8213. dc.w make_block_tile($0047,0,0,0,1), make_block_tile($0092,1,0,0,1), make_block_tile($0000,1,0,0,1), make_block_tile($0062,0,0,0,1) ; $6C
  8214. dc.w make_block_tile($0066,0,0,0,1), make_block_tile($0090,0,0,0,1), make_block_tile($0008,0,0,0,1), make_block_tile($007C,1,0,0,1) ; $70
  8215. dc.w make_block_tile($0067,1,0,0,1), make_block_tile($00F7,1,0,0,1), make_block_tile($000E,0,0,0,1), make_block_tile($0060,0,0,0,1) ; $74
  8216. dc.w make_block_tile($0032,0,0,0,1), make_block_tile($0094,0,0,0,1), make_block_tile($001C,1,0,0,1), make_block_tile($0105,1,0,0,1) ; $78
  8217. dc.w make_block_tile($00B0,1,0,0,1), make_block_tile($0059,0,0,0,1), make_block_tile($000F,0,0,0,1), make_block_tile($0067,0,0,0,1) ; $7C
  8218. dc.w make_block_tile($0068,0,0,0,1), make_block_tile($0094,1,0,0,1), make_block_tile($007C,0,0,0,1), make_block_tile($00B0,0,0,0,1) ; $80
  8219. dc.w make_block_tile($00B1,0,0,0,1), make_block_tile($0006,0,0,0,1), make_block_tile($0041,1,0,0,1), make_block_tile($0087,0,0,0,1) ; $84
  8220. dc.w make_block_tile($0093,0,0,0,1), make_block_tile($00CC,0,0,0,1), make_block_tile($001F,1,0,0,1), make_block_tile($0068,1,0,0,1) ; $88
  8221. dc.w make_block_tile($0041,0,0,0,1), make_block_tile($008F,0,0,0,1), make_block_tile($0090,1,0,0,1), make_block_tile($00C2,0,0,0,1) ; $8C
  8222. dc.w make_block_tile($0013,1,0,0,1), make_block_tile($00C2,1,0,0,1), make_block_tile($005C,0,0,0,1), make_block_tile($0064,0,0,0,1) ; $90
  8223. dc.w make_block_tile($00D8,0,0,0,1), make_block_tile($001B,1,0,0,1), make_block_tile($00CC,1,0,0,1), make_block_tile($0011,1,0,0,1) ; $94
  8224. dc.w make_block_tile($0055,1,0,0,1), make_block_tile($00E2,1,0,0,1), make_block_tile($00F3,1,0,0,1), make_block_tile($0044,0,0,0,1) ; $98
  8225. dc.w make_block_tile($00D8,1,0,0,1), make_block_tile($0085,0,0,0,1), make_block_tile($00A1,0,0,0,1), make_block_tile($00C1,0,0,0,1) ; $9C
  8226. dc.w make_block_tile($0119,0,0,0,1), make_block_tile($0089,1,0,0,1), make_block_tile($000A,1,0,0,1), make_block_tile($0022,1,0,0,1) ; $A0
  8227. dc.w make_block_tile($003F,0,0,0,1), make_block_tile($005B,0,0,0,1), make_block_tile($007F,0,0,0,1), make_block_tile($0086,1,0,0,1) ; $A4
  8228. dc.w make_block_tile($0008,1,0,0,1), make_block_tile($0080,0,0,0,1), make_block_tile($0066,1,0,0,1), make_block_tile($00E0,1,0,0,1) ; $A8
  8229. dc.w make_block_tile($00C1,1,0,0,1), make_block_tile($0020,0,0,0,1), make_block_tile($0022,0,0,0,1), make_block_tile($0054,0,0,0,1) ; $AC
  8230. dc.w make_block_tile($00D2,0,0,0,1), make_block_tile($0059,1,0,0,1), make_block_tile($00B1,1,0,0,1), make_block_tile($0060,1,0,0,1) ; $B0
  8231. dc.w make_block_tile($0119,1,0,0,1), make_block_tile($00A4,1,0,0,1), make_block_tile($008F,1,0,0,1), make_block_tile($000A,0,0,0,1) ; $B4
  8232. dc.w make_block_tile($0061,0,0,0,1), make_block_tile($0075,0,0,0,1), make_block_tile($0095,0,0,0,1), make_block_tile($00B6,0,0,0,1) ; $B8
  8233. dc.w make_block_tile($00E0,0,0,0,1), make_block_tile($0010,1,0,0,1), make_block_tile($0098,1,0,0,1), make_block_tile($005B,1,0,0,1) ; $BC
  8234. dc.w make_block_tile($00D2,1,0,0,1), make_block_tile($0016,1,0,0,1), make_block_tile($0053,0,0,0,1), make_block_tile($0091,0,0,0,1) ; $C0
  8235. dc.w make_block_tile($0096,0,0,0,1), make_block_tile($00A4,0,0,0,1), make_block_tile($00DD,0,0,0,1), make_block_tile($00E6,0,0,0,1) ; $C4
  8236. dc.w make_block_tile($007A,1,0,0,1), make_block_tile($004D,1,0,0,1), make_block_tile($00E6,1,0,0,1), make_block_tile($0011,0,0,0,1) ; $C8
  8237. dc.w make_block_tile($0057,0,0,0,1), make_block_tile($007A,0,0,0,1), make_block_tile($0086,0,0,0,1), make_block_tile($009E,0,0,0,1) ; $CC
  8238. dc.w make_block_tile($00DA,0,0,0,1), make_block_tile($0058,0,0,0,1), make_block_tile($00DC,0,0,0,1), make_block_tile($00E3,0,0,0,1) ; $D0
  8239. dc.w make_block_tile($0063,1,0,0,1), make_block_tile($003C,0,0,0,1), make_block_tile($0056,0,0,0,1), make_block_tile($0069,0,0,0,1) ; $D4
  8240. dc.w make_block_tile($007E,0,0,0,1), make_block_tile($00AE,0,0,0,1), make_block_tile($00B5,0,0,0,1), make_block_tile($00B8,0,0,0,1) ; $D8
  8241. dc.w make_block_tile($00CD,0,0,0,1), make_block_tile($00FB,0,0,0,1), make_block_tile($00FF,0,0,0,1), make_block_tile($005C,1,0,0,1) ; $DC
  8242. dc.w make_block_tile($00CD,1,0,0,1), make_block_tile($0074,1,0,0,1), make_block_tile($00EA,1,0,0,1), make_block_tile($00FF,1,0,0,1) ; $E0
  8243. dc.w make_block_tile($00B5,1,0,0,1), make_block_tile($0043,0,0,0,1), make_block_tile($006C,0,0,0,1), make_block_tile($0074,0,0,0,1) ; $E4
  8244. dc.w make_block_tile($0077,0,0,0,1), make_block_tile($0089,0,0,0,1), make_block_tile($0097,0,0,0,1), make_block_tile($009F,0,0,0,1) ; $E8
  8245. dc.w make_block_tile($00A0,0,0,0,1), make_block_tile($0113,0,0,0,1), make_block_tile($011B,0,0,0,1), make_block_tile($0078,1,0,0,1) ; $EC
  8246. dc.w make_block_tile($000F,1,0,0,1), make_block_tile($00E1,1,0,0,1), make_block_tile($00FB,1,0,0,1), make_block_tile($0128,1,0,0,1) ; $F0
  8247. dc.w make_block_tile($0063,0,0,0,1), make_block_tile($0084,0,0,0,1), make_block_tile($008D,0,0,0,1), make_block_tile($00CB,0,0,0,1) ; $F4
  8248. dc.w make_block_tile($00D7,0,0,0,1), make_block_tile($00E9,0,0,0,1), make_block_tile($0128,0,0,0,1), make_block_tile($0138,0,0,0,1) ; $F8
  8249. dc.w make_block_tile($00AE,1,0,0,1), make_block_tile($00EC,1,0,0,1), make_block_tile($0031,0,0,0,1), make_block_tile($004C,0,0,0,1) ; $FC
  8250. dc.w make_block_tile($00E2,0,0,0,1), make_block_tile($00EA,0,0,0,1), make_block_tile($0064,1,0,0,1), make_block_tile($0029,0,0,0,1) ; $100
  8251. dc.w make_block_tile($002D,0,0,0,1), make_block_tile($006D,0,0,0,1), make_block_tile($0078,0,0,0,1), make_block_tile($0088,0,0,0,1) ; $104
  8252. dc.w make_block_tile($00B4,0,0,0,1), make_block_tile($00BE,0,0,0,1), make_block_tile($00CF,0,0,0,1), make_block_tile($00E1,0,0,0,1) ; $108
  8253. dc.w make_block_tile($00E4,0,0,0,1), make_block_tile($0054,1,0,0,1), make_block_tile($00D6,1,0,0,1), make_block_tile($00D7,1,0,0,1) ; $10C
  8254. dc.w make_block_tile($0061,1,0,0,1), make_block_tile($012B,1,0,0,1), make_block_tile($0047,1,0,0,1), make_block_tile($0035,0,0,0,1) ; $110
  8255. dc.w make_block_tile($006A,0,0,0,1), make_block_tile($0072,0,0,0,1), make_block_tile($0073,0,0,0,1), make_block_tile($0098,0,0,0,1) ; $114
  8256. dc.w make_block_tile($00D5,0,0,0,1), make_block_tile($00D6,0,0,0,1), make_block_tile($0116,0,0,0,1), make_block_tile($011E,0,0,0,1) ; $118
  8257. dc.w make_block_tile($0126,0,0,0,1), make_block_tile($0127,0,0,0,1), make_block_tile($012F,0,0,0,1), make_block_tile($015D,0,0,0,1) ; $11C
  8258. dc.w make_block_tile($0069,1,0,0,1), make_block_tile($0088,1,0,0,1), make_block_tile($0075,1,0,0,1), make_block_tile($0097,1,0,0,1) ; $120
  8259. dc.w make_block_tile($00B4,1,0,0,1), make_block_tile($00D1,1,0,0,1), make_block_tile($00D4,1,0,0,1), make_block_tile($00D5,1,0,0,1) ; $124
  8260. dc.w make_block_tile($00CB,1,0,0,1), make_block_tile($00E4,1,0,0,1), make_block_tile($0091,1,0,0,1), make_block_tile($0062,1,0,0,1) ; $128
  8261. dc.w make_block_tile($0006,1,0,0,1), make_block_tile($00B8,1,0,0,1), make_block_tile($0065,0,0,0,1), make_block_tile($006E,0,0,0,1) ; $12C
  8262. dc.w make_block_tile($0071,0,0,0,1), make_block_tile($007D,0,0,0,1), make_block_tile($00D1,0,0,0,1), make_block_tile($00E7,0,0,0,1) ; $130
  8263. dc.w make_block_tile($00F9,0,0,0,1), make_block_tile($0108,0,0,0,1), make_block_tile($012E,0,0,0,1), make_block_tile($014B,0,0,0,1) ; $134
  8264. dc.w make_block_tile($0081,1,0,0,1), make_block_tile($0085,1,0,0,1), make_block_tile($0077,1,0,0,1), make_block_tile($007E,1,0,0,1) ; $138
  8265. dc.w make_block_tile($0095,1,0,0,1), make_block_tile($00DF,1,0,0,1), make_block_tile($0087,1,0,0,1), make_block_tile($006C,1,0,0,1) ; $13C
  8266. dc.w make_block_tile($00F5,1,0,0,1), make_block_tile($0108,1,0,0,1), make_block_tile($0079,1,0,0,1), make_block_tile($006D,1,0,0,1) ; $140
  8267. dc.w make_block_tile($012A,1,0,0,1), make_block_tile($00AA,1,0,0,1), make_block_tile($001E,0,0,0,1), make_block_tile($0027,0,0,0,1) ; $144
  8268. dc.w make_block_tile($0046,0,0,0,1), make_block_tile($005F,0,0,0,1), make_block_tile($0070,0,0,0,1), make_block_tile($0079,0,0,0,1) ; $148
  8269. dc.w make_block_tile($009A,0,0,0,1), make_block_tile($00AA,0,0,0,1), make_block_tile($00C3,0,0,0,1), make_block_tile($00D3,0,0,0,1) ; $14C
  8270. dc.w make_block_tile($00D4,0,0,0,1), make_block_tile($00DE,0,0,0,1), make_block_tile($00DF,0,0,0,1), make_block_tile($00F8,0,0,0,1) ; $150
  8271. dc.w make_block_tile($0100,0,0,0,1), make_block_tile($0101,0,0,0,1), make_block_tile($012B,0,0,0,1), make_block_tile($0133,0,0,0,1) ; $154
  8272. dc.w make_block_tile($0136,0,0,0,1), make_block_tile($0143,0,0,0,1), make_block_tile($0151,0,0,0,1), make_block_tile($002E,1,0,0,1) ; $158
  8273. dc.w make_block_tile($009E,1,0,0,1), make_block_tile($0099,1,0,0,1), make_block_tile($00D3,1,0,0,1), make_block_tile($00DD,1,0,0,1) ; $15C
  8274. dc.w make_block_tile($00DE,1,0,0,1), make_block_tile($00E9,1,0,0,1), make_block_tile($00EF,1,0,0,1), make_block_tile($00F0,1,0,0,1) ; $160
  8275. dc.w make_block_tile($00F8,1,0,0,1), make_block_tile($0127,1,0,0,1), make_block_tile($00BE,1,0,0,1), make_block_tile($0096,1,0,0,1) ; $164
  8276. dc.w make_block_tile($004F,0,0,0,1), make_block_tile($006F,0,0,0,1), make_block_tile($0081,0,0,0,1), make_block_tile($008B,0,0,0,1) ; $168
  8277. dc.w make_block_tile($008E,0,0,0,1), make_block_tile($009C,0,0,0,1), make_block_tile($00A3,0,0,0,1), make_block_tile($00B3,0,0,0,1) ; $16C
  8278. dc.w make_block_tile($00C0,0,0,0,1), make_block_tile($00CE,0,0,0,1), make_block_tile($00F0,0,0,0,1), make_block_tile($00F1,0,0,0,1) ; $170
  8279. dc.w make_block_tile($00F5,0,0,0,1), make_block_tile($00F7,0,0,0,1), make_block_tile($0102,0,0,0,1), make_block_tile($0104,0,0,0,1) ; $174
  8280. dc.w make_block_tile($0105,0,0,0,1), make_block_tile($0109,0,0,0,1), make_block_tile($010C,0,0,0,1), make_block_tile($0114,0,0,0,1) ; $178
  8281. dc.w make_block_tile($0118,0,0,0,1), make_block_tile($0120,0,0,0,1), make_block_tile($0124,0,0,0,1), make_block_tile($0125,0,0,0,1) ; $17C
  8282. dc.w make_block_tile($012A,0,0,0,1), make_block_tile($0130,0,0,0,1), make_block_tile($0132,0,0,0,1), make_block_tile($0137,0,0,0,1) ; $180
  8283. dc.w make_block_tile($0159,0,0,0,1), make_block_tile($0165,0,0,0,1), make_block_tile($003F,1,0,0,1), make_block_tile($006B,1,0,0,1) ; $184
  8284. dc.w make_block_tile($0080,1,0,0,1), make_block_tile($0053,1,0,0,1), make_block_tile($00C6,1,0,0,1), make_block_tile($00CF,1,0,0,1) ; $188
  8285. dc.w make_block_tile($00D9,1,0,0,1), make_block_tile($00DC,1,0,0,1), make_block_tile($0056,1,0,0,1), make_block_tile($00B6,1,0,0,1) ; $18C
  8286. dc.w make_block_tile($00F9,1,0,0,1), make_block_tile($0102,1,0,0,1), make_block_tile($0104,1,0,0,1), make_block_tile($0115,1,0,0,1) ; $190
  8287. dc.w make_block_tile($006A,1,0,0,1), make_block_tile($0113,1,0,0,1), make_block_tile($0072,1,0,0,1), make_block_tile($0035,1,0,0,1) ; $194
  8288. dc.w make_block_tile($0138,1,0,0,1), make_block_tile($015D,1,0,0,1), make_block_tile($0143,1,0,0,1), make_block_tile($0023,0,0,0,1) ; $198
  8289. dc.w make_block_tile($0076,0,0,0,1), make_block_tile($007B,0,0,0,1), make_block_tile($008A,0,0,0,1), make_block_tile($009D,0,0,0,1) ; $19C
  8290. dc.w make_block_tile($00A6,0,0,0,1), make_block_tile($00A8,0,0,0,1), make_block_tile($00AC,0,0,0,1), make_block_tile($00B2,0,0,0,1) ; $1A0
  8291. dc.w make_block_tile($00B7,0,0,0,1), make_block_tile($00BB,0,0,0,1), make_block_tile($00BC,0,0,0,1), make_block_tile($00BD,0,0,0,1) ; $1A4
  8292. dc.w make_block_tile($00C6,0,0,0,1), make_block_tile($00E5,0,0,0,1), make_block_tile($00E8,0,0,0,1), make_block_tile($00EE,0,0,0,1) ; $1A8
  8293. dc.w make_block_tile($00F4,0,0,0,1), make_block_tile($010A,0,0,0,1), make_block_tile($010D,0,0,0,1), make_block_tile($0111,0,0,0,1) ; $1AC
  8294. dc.w make_block_tile($0115,0,0,0,1), make_block_tile($011A,0,0,0,1), make_block_tile($011F,0,0,0,1), make_block_tile($0122,0,0,0,1) ; $1B0
  8295. dc.w make_block_tile($0123,0,0,0,1), make_block_tile($0139,0,0,0,1), make_block_tile($013A,0,0,0,1), make_block_tile($013C,0,0,0,1) ; $1B4
  8296. dc.w make_block_tile($0142,0,0,0,1), make_block_tile($0144,0,0,0,1), make_block_tile($0147,0,0,0,1), make_block_tile($0148,0,0,0,1) ; $1B8
  8297. dc.w make_block_tile($015E,0,0,0,1), make_block_tile($015F,0,0,0,1), make_block_tile($0163,0,0,0,1), make_block_tile($0168,0,0,0,1) ; $1BC
  8298. dc.w make_block_tile($016A,0,0,0,1), make_block_tile($016C,0,0,0,1), make_block_tile($0170,0,0,0,1), make_block_tile($00E5,1,0,0,1) ; $1C0
  8299. dc.w make_block_tile($00CE,1,0,0,1), make_block_tile($00EE,1,0,0,1), make_block_tile($00F1,1,0,0,1), make_block_tile($0084,1,0,0,1) ; $1C4
  8300. dc.w make_block_tile($00FD,1,0,0,1), make_block_tile($0100,1,0,0,1), make_block_tile($00B9,1,0,0,1), make_block_tile($0117,1,0,0,1) ; $1C8
  8301. dc.w make_block_tile($0071,1,0,0,1), make_block_tile($0109,1,0,0,1), make_block_tile($010D,1,0,0,1), make_block_tile($0065,1,0,0,1) ; $1CC
  8302. dc.w make_block_tile($0125,1,0,0,1), make_block_tile($0122,1,0,0,1), make_block_tile($0031,1,0,0,1), make_block_tile($003C,1,0,0,1) ; $1D0
  8303. dc.w make_block_tile($010F,1,0,0,1), make_block_tile($00C5,1,0,0,1), make_block_tile($0133,1,0,0,1), make_block_tile($0137,1,0,0,1) ; $1D4
  8304. dc.w make_block_tile($011F,1,0,0,1), make_block_tile($002E,0,0,0,1), make_block_tile($006B,0,0,0,1), make_block_tile($0082,0,0,0,1) ; $1D8
  8305. dc.w make_block_tile($0083,0,0,0,1), make_block_tile($008C,0,0,0,1), make_block_tile($0099,0,0,0,1), make_block_tile($009B,0,0,0,1) ; $1DC
  8306. dc.w make_block_tile($00A2,0,0,0,1), make_block_tile($00A5,0,0,0,1), make_block_tile($00A7,0,0,0,1), make_block_tile($00A9,0,0,0,1) ; $1E0
  8307. dc.w make_block_tile($00AB,0,0,0,1), make_block_tile($00AD,0,0,0,1), make_block_tile($00B9,0,0,0,1), make_block_tile($00BA,0,0,0,1) ; $1E4
  8308. dc.w make_block_tile($00BF,0,0,0,1), make_block_tile($00C4,0,0,0,1), make_block_tile($00C5,0,0,0,1), make_block_tile($00C7,0,0,0,1) ; $1E8
  8309. dc.w make_block_tile($00C8,0,0,0,1), make_block_tile($00C9,0,0,0,1), make_block_tile($00CA,0,0,0,1), make_block_tile($00D0,0,0,0,1) ; $1EC
  8310. dc.w make_block_tile($00D9,0,0,0,1), make_block_tile($00DB,0,0,0,1), make_block_tile($00EB,0,0,0,1), make_block_tile($00EC,0,0,0,1) ; $1F0
  8311. dc.w make_block_tile($00ED,0,0,0,1), make_block_tile($00EF,0,0,0,1), make_block_tile($00F2,0,0,0,1), make_block_tile($00F3,0,0,0,1) ; $1F4
  8312. dc.w make_block_tile($00F6,0,0,0,1), make_block_tile($00FA,0,0,0,1), make_block_tile($00FC,0,0,0,1), make_block_tile($00FD,0,0,0,1) ; $1F8
  8313. dc.w make_block_tile($00FE,0,0,0,1), make_block_tile($0103,0,0,0,1), make_block_tile($0106,0,0,0,1), make_block_tile($0107,0,0,0,1) ; $2FC
  8314. dc.w make_block_tile($010B,0,0,0,1), make_block_tile($010E,0,0,0,1), make_block_tile($010F,0,0,0,1), make_block_tile($0110,0,0,0,1) ; $200
  8315. dc.w make_block_tile($0112,0,0,0,1), make_block_tile($0117,0,0,0,1), make_block_tile($011C,0,0,0,1), make_block_tile($011D,0,0,0,1) ; $204
  8316. dc.w make_block_tile($0121,0,0,0,1), make_block_tile($0129,0,0,0,1), make_block_tile($012C,0,0,0,1), make_block_tile($012D,0,0,0,1) ; $208
  8317. dc.w make_block_tile($0131,0,0,0,1), make_block_tile($0134,0,0,0,1), make_block_tile($0135,0,0,0,1), make_block_tile($013B,0,0,0,1) ; $20C
  8318. dc.w make_block_tile($013D,0,0,0,1), make_block_tile($013E,0,0,0,1), make_block_tile($013F,0,0,0,1), make_block_tile($0140,0,0,0,1) ; $210
  8319. dc.w make_block_tile($0141,0,0,0,1), make_block_tile($0145,0,0,0,1), make_block_tile($0146,0,0,0,1), make_block_tile($0149,0,0,0,1) ; $214
  8320. dc.w make_block_tile($014A,0,0,0,1), make_block_tile($014C,0,0,0,1), make_block_tile($014D,0,0,0,1), make_block_tile($014E,0,0,0,1) ; $218
  8321. dc.w make_block_tile($014F,0,0,0,1), make_block_tile($0150,0,0,0,1), make_block_tile($0152,0,0,0,1), make_block_tile($0153,0,0,0,1) ; $21C
  8322. dc.w make_block_tile($0154,0,0,0,1), make_block_tile($0155,0,0,0,1), make_block_tile($0156,0,0,0,1), make_block_tile($0157,0,0,0,1) ; $220
  8323. dc.w make_block_tile($0158,0,0,0,1), make_block_tile($015A,0,0,0,1), make_block_tile($015B,0,0,0,1), make_block_tile($015C,0,0,0,1) ; $224
  8324. dc.w make_block_tile($0160,0,0,0,1), make_block_tile($0161,0,0,0,1), make_block_tile($0162,0,0,0,1), make_block_tile($0164,0,0,0,1) ; $228
  8325. dc.w make_block_tile($0166,0,0,0,1), make_block_tile($0167,0,0,0,1), make_block_tile($0169,0,0,0,1), make_block_tile($016B,0,0,0,1) ; $22C
  8326. dc.w make_block_tile($016D,0,0,0,1), make_block_tile($016E,0,0,0,1), make_block_tile($016F,0,0,0,1), make_block_tile($0171,0,0,0,1) ; $230
  8327. dc.w make_block_tile($0172,0,0,0,1), make_block_tile($0173,0,0,0,1), make_block_tile($006E,1,0,0,1), make_block_tile($007D,1,0,0,1) ; $234
  8328. dc.w make_block_tile($00C3,1,0,0,1), make_block_tile($00DB,1,0,0,1), make_block_tile($00E7,1,0,0,1), make_block_tile($00E8,1,0,0,1) ; $238
  8329. dc.w make_block_tile($00EB,1,0,0,1), make_block_tile($00ED,1,0,0,1), make_block_tile($00F2,1,0,0,1), make_block_tile($00F6,1,0,0,1) ; $23C
  8330. dc.w make_block_tile($00FA,1,0,0,1), make_block_tile($00FC,1,0,0,1), make_block_tile($00FE,1,0,0,1), make_block_tile($002D,1,0,0,1) ; $240
  8331. dc.w make_block_tile($0103,1,0,0,1), make_block_tile($0106,1,0,0,1), make_block_tile($0107,1,0,0,1), make_block_tile($010B,1,0,0,1) ; $244
  8332. dc.w make_block_tile($0073,1,0,0,1), make_block_tile($009A,1,0,0,1), make_block_tile($0129,1,0,0,1), make_block_tile($012C,1,0,0,1) ; $248
  8333. dc.w make_block_tile($012D,1,0,0,1), make_block_tile($0111,1,0,0,1), make_block_tile($013C,1,0,0,1), make_block_tile($0120,1,0,0,1) ; $24C
  8334. dc.w make_block_tile($0146,1,0,0,1), make_block_tile($00A9,1,0,0,1), make_block_tile($009C,1,0,0,1), make_block_tile($0116,1,0,0,1) ; $250
  8335. dc.w make_block_tile($014F,1,0,0,1), make_block_tile($014C,1,0,0,1), make_block_tile($006F,1,0,0,1), make_block_tile($0158,1,0,0,1) ; $254
  8336. dc.w make_block_tile($0156,1,0,0,1), make_block_tile($0159,1,0,0,1), make_block_tile($015A,1,0,0,1), make_block_tile($0161,1,0,0,1) ; $258
  8337. dc.w make_block_tile($007B,1,0,0,1), make_block_tile($0166,1,0,0,1), make_block_tile($011C,1,0,0,1), make_block_tile($0118,1,0,0,1) ; $25C
  8338. dc.w make_block_tile($00A0,1,0,0,1), make_block_tile($00A3,1,0,0,1), make_block_tile($0167,1,0,0,1), make_block_tile($00A1,1,0,0,1) ; $260
  8339.  
  8340. ; These are run-length encoded pattern names. They get sent to either the
  8341. ; pattern name table buffer or one region of one of the plane A name tables
  8342. ; in the special stage.
  8343. ; They are indexed by the third segment of the mappings in Map_SpecialStageTrack, above.
  8344. ; Format: PNT,count
  8345. ;word_69E6
  8346. SSPNT_RLELUT:
  8347. dc.w make_block_tile($0007,0,0,0,0),$0001, make_block_tile($0001,0,0,0,0),$0001 ; $00
  8348. dc.w make_block_tile($004A,0,0,0,0),$0001, make_block_tile($0039,0,0,0,0),$0003 ; $02
  8349. dc.w make_block_tile($0001,0,0,0,0),$0005, make_block_tile($0028,0,0,0,0),$0007 ; $04
  8350. dc.w make_block_tile($002C,0,0,0,0),$0001, make_block_tile($0001,0,0,0,0),$0002 ; $06
  8351. dc.w make_block_tile($0028,0,0,0,0),$0005, make_block_tile($0039,0,0,0,0),$0001 ; $08
  8352. dc.w make_block_tile($0028,0,0,0,0),$0009, make_block_tile($0001,0,0,0,0),$0004 ; $0A
  8353. dc.w make_block_tile($0028,0,0,0,0),$0006, make_block_tile($0028,0,0,0,0),$0003 ; $0C
  8354. dc.w make_block_tile($004A,0,0,0,0),$0002, make_block_tile($0001,0,0,0,0),$0003 ; $0E
  8355. dc.w make_block_tile($0028,0,0,0,0),$0004, make_block_tile($0039,0,0,0,0),$0002 ; $10
  8356. dc.w make_block_tile($0039,0,0,0,0),$0004, make_block_tile($0001,0,0,0,0),$0006 ; $12
  8357. dc.w make_block_tile($0007,0,0,0,0),$0002, make_block_tile($002C,0,0,0,0),$0002 ; $14
  8358. dc.w make_block_tile($0028,0,0,0,0),$0001, make_block_tile($001D,0,0,0,0),$0001 ; $16
  8359. dc.w make_block_tile($0028,0,0,0,0),$0008, make_block_tile($0028,0,0,0,0),$0002 ; $18
  8360. dc.w make_block_tile($0007,0,0,0,0),$0003, make_block_tile($0001,0,0,0,0),$0007 ; $1A
  8361. dc.w make_block_tile($0028,0,0,0,0),$000B, make_block_tile($0039,0,0,0,0),$0005 ; $1C
  8362. dc.w make_block_tile($001D,0,0,0,0),$0003, make_block_tile($001D,0,0,0,0),$0004 ; $1E
  8363. dc.w make_block_tile($001D,0,0,0,0),$0002, make_block_tile($001D,0,0,0,0),$0005 ; $20
  8364. dc.w make_block_tile($0028,0,0,0,0),$000D, make_block_tile($000B,0,0,0,0),$0001 ; $22
  8365. dc.w make_block_tile($0028,0,0,0,0),$000A, make_block_tile($0039,0,0,0,0),$0006 ; $24
  8366. dc.w make_block_tile($0039,0,0,0,0),$0007, make_block_tile($002C,0,0,0,0),$0003 ; $26
  8367. dc.w make_block_tile($001D,0,0,0,0),$0009, make_block_tile($004A,0,0,0,0),$0003 ; $28
  8368. dc.w make_block_tile($001D,0,0,0,0),$0007, make_block_tile($0028,0,0,0,0),$000F ; $2A
  8369. dc.w make_block_tile($001D,0,0,0,0),$000B, make_block_tile($001D,0,0,0,0),$0011 ; $2C
  8370. dc.w make_block_tile($001D,0,0,0,0),$000D, make_block_tile($001D,0,0,0,0),$0008 ; $2E
  8371. dc.w make_block_tile($0028,0,0,0,0),$0011, make_block_tile($001D,0,0,0,0),$0006 ; $30
  8372. dc.w make_block_tile($000B,0,0,0,0),$0002, make_block_tile($001D,0,0,0,0),$0015 ; $32
  8373. dc.w make_block_tile($0028,0,0,0,0),$000C, make_block_tile($001D,0,0,0,0),$000A ; $34
  8374. dc.w make_block_tile($0028,0,0,0,0),$000E, make_block_tile($0001,0,0,0,0),$0008 ; $36
  8375. dc.w make_block_tile($001D,0,0,0,0),$000F, make_block_tile($0028,0,0,0,0),$0010 ; $38
  8376. dc.w make_block_tile($0007,0,0,0,0),$0006, make_block_tile($001D,0,0,0,0),$0013 ; $3A
  8377. dc.w make_block_tile($004A,0,0,0,0),$0004, make_block_tile($001D,0,0,0,0),$0017 ; $3C
  8378. dc.w make_block_tile($0007,0,0,0,0),$0004, make_block_tile($000B,0,0,0,0),$0003 ; $3E
  8379. ;word_6AE6
  8380. SSPNT_RLELUT_Part2:
  8381. dc.w make_block_tile($001D,0,0,0,0),$001B, make_block_tile($004A,0,0,0,0),$0006 ; $40
  8382. dc.w make_block_tile($001D,0,0,0,0),$001D, make_block_tile($004A,0,0,0,0),$0005 ; $42
  8383. dc.w make_block_tile($0001,0,0,0,0),$0009, make_block_tile($0007,0,0,0,0),$0005 ; $44
  8384. dc.w make_block_tile($001D,0,0,0,0),$001E, make_block_tile($001D,0,0,0,0),$0019 ; $46
  8385. dc.w make_block_tile($0001,0,0,0,0),$0011, make_block_tile($001D,0,0,0,0),$000C ; $48
  8386. dc.w make_block_tile($001D,0,0,0,0),$007F, make_block_tile($002C,0,0,0,0),$0004 ; $4A
  8387. dc.w make_block_tile($001D,0,0,0,0),$000E, make_block_tile($001D,0,0,0,0),$001C ; $4C
  8388. dc.w make_block_tile($004A,0,0,0,0),$000A, make_block_tile($001D,0,0,0,0),$001A ; $4E
  8389. dc.w make_block_tile($004A,0,0,0,0),$0007, make_block_tile($001D,0,0,0,0),$0018 ; $50
  8390. dc.w make_block_tile($000B,0,0,0,0),$0004, make_block_tile($001D,0,0,0,0),$0012 ; $52
  8391. dc.w make_block_tile($001D,0,0,0,0),$0010, make_block_tile($0001,0,0,0,0),$000F ; $54
  8392. dc.w make_block_tile($000B,0,0,0,0),$0005, make_block_tile($0001,0,0,0,0),$000D ; $56
  8393. dc.w make_block_tile($0001,0,0,0,0),$0013, make_block_tile($004A,0,0,0,0),$0009 ; $58
  8394. dc.w make_block_tile($004A,0,0,0,0),$000B, make_block_tile($004A,0,0,0,0),$000C ; $5A
  8395. dc.w make_block_tile($002C,0,0,0,0),$0005, make_block_tile($001D,0,0,0,0),$0014 ; $5C
  8396. dc.w make_block_tile($000B,0,0,0,0),$0007, make_block_tile($001D,0,0,0,0),$0016 ; $5E
  8397. dc.w make_block_tile($0001,0,0,0,0),$000C, make_block_tile($0001,0,0,0,0),$000E ; $60
  8398. dc.w make_block_tile($004A,0,0,0,0),$0008, make_block_tile($001D,0,0,0,0),$005F ; $62
  8399. dc.w make_block_tile($0001,0,0,0,0),$000A, make_block_tile($000B,0,0,0,0),$0006 ; $64
  8400. dc.w make_block_tile($000B,0,0,0,0),$0008, make_block_tile($000B,0,0,0,0),$000A ; $66
  8401. dc.w make_block_tile($0039,0,0,0,0),$0008, make_block_tile($000B,0,0,0,0),$0009 ; $68
  8402. dc.w make_block_tile($002C,0,0,0,0),$0006, make_block_tile($0001,0,0,0,0),$0010 ; $6A
  8403. dc.w make_block_tile($000B,0,0,0,0),$000C, make_block_tile($0001,0,0,0,0),$000B ; $6C
  8404. dc.w make_block_tile($0001,0,0,0,0),$0012, make_block_tile($0007,0,0,0,0),$0007 ; $6E
  8405. dc.w make_block_tile($001D,0,0,0,0),$001F, make_block_tile($0028,0,0,0,0),$0012 ; $70
  8406. dc.w make_block_tile($000B,0,0,0,0),$000B, make_block_tile($002C,0,0,0,0),$0007 ; $72
  8407. dc.w make_block_tile($002C,0,0,0,0),$000B, make_block_tile($001D,0,0,0,0),$0023 ; $74
  8408. dc.w make_block_tile($0001,0,0,0,0),$0015, make_block_tile($002C,0,0,0,0),$0008 ; $76
  8409. dc.w make_block_tile($001D,0,0,0,0),$002E, make_block_tile($001D,0,0,0,0),$003F ; $78
  8410. dc.w make_block_tile($0001,0,0,0,0),$0014, make_block_tile($000B,0,0,0,0),$000D ; $7A
  8411. dc.w make_block_tile($002C,0,0,0,0),$0009, make_block_tile($002C,0,0,0,0),$000A ; $7C
  8412. dc.w make_block_tile($001D,0,0,0,0),$0025, make_block_tile($001D,0,0,0,0),$0055 ; $7E
  8413. dc.w make_block_tile($001D,0,0,0,0),$0071, make_block_tile($001D,0,0,0,0),$007C ; $80
  8414. dc.w make_block_tile($004A,0,0,0,0),$000D, make_block_tile($002C,0,0,0,0),$000C ; $82
  8415. dc.w make_block_tile($002C,0,0,0,0),$000F, make_block_tile($002C,0,0,0,0),$0010 ; $84
  8416.  
  8417. ;unknown
  8418. ;byte_6BFE:
  8419. dc.b $FF,$FB,$FF,$FB,$FF,$FA,$FF,$FA; 528
  8420. dc.b $FF,$FA,$FF,$FA ; 544
  8421. ; ===========================================================================
  8422. ; (!)
  8423. ;loc_6C0A
  8424. SSTrackSetOrientation:
  8425. move.b (SS_Alternate_HorizScroll_Buf).w,(SS_Last_Alternate_HorizScroll_Buf).w
  8426. moveq #0,d1
  8427. movea.l (SSTrack_mappings_bitflags).w,a0 ; Get frame mappings pointer
  8428. cmpa.l #MapSpec_Straight2,a0 ; Is the track rising or one of the first straight frame?
  8429. blt.s + ; Branch if yes
  8430. cmpa.l #MapSpec_Straight3,a0 ; Is it straight path frame 3 or higher?
  8431. bge.s + ; Branch if yes
  8432. ; We only get here for straight frame 2
  8433. movea.l (SS_CurrentLevelLayout).w,a5 ; Get current level layout
  8434. move.b (SpecialStage_CurrentSegment).w,d1 ; Get current segment
  8435. move.b (a5,d1.w),d1 ; Get segment geometry
  8436. bpl.s +++ ; Branch if not flipped
  8437. -
  8438. st.b (SSTrack_Orientation).w ; Mark as being flipped
  8439. move.b (SSTrack_drawing_index).w,d0 ; Get drawing position
  8440. cmp.b (SS_player_anim_frame_timer).w,d0 ; Is it lower than the player's frame?
  8441. blt.w return_6C9A ; Return if yes
  8442. st.b (SS_Alternate_HorizScroll_Buf).w ; Use the alternate horizontal scroll buffer
  8443. rts
  8444. ; ===========================================================================
  8445. +
  8446. cmpa.l #MapSpec_Rise14,a0 ; Is the track one of the first 13 rising frames?
  8447. blt.s + ; Branch if yes
  8448. cmpa.l #MapSpec_Rise15,a0 ; Is it rising frame 15 or higher?
  8449. bge.s + ; Branch if yes
  8450. ; We only get here for straight frame 14
  8451. movea.l (SS_CurrentLevelLayout).w,a5 ; Get current level layout
  8452. move.b (SpecialStage_CurrentSegment).w,d1 ; Get current segment
  8453. move.b (a5,d1.w),d1 ; Get segment geometry
  8454. bpl.s ++ ; Branch if not flipped
  8455. bra.s -
  8456. ; ===========================================================================
  8457. +
  8458. cmpa.l #MapSpec_Drop6,a0 ; Is the track before drop frame 6?
  8459. blt.s return_6C9A ; Return is yes
  8460. cmpa.l #MapSpec_Drop7,a0 ; Is it drop frame 7 or higher?
  8461. bge.s return_6C9A ; Return if yes
  8462. ; We only get here for straight frame 6
  8463. movea.l (SS_CurrentLevelLayout).w,a5 ; Get current level layout
  8464. move.b (SpecialStage_CurrentSegment).w,d1 ; Get current segment
  8465. move.b (a5,d1.w),d1 ; Get segment geometry
  8466. bmi.s - ; Branch if flipped
  8467. +
  8468. sf.b (SSTrack_Orientation).w ; Mark as being unflipped
  8469. move.b (SSTrack_drawing_index).w,d0 ; Get drawing position
  8470. cmp.b (SS_player_anim_frame_timer).w,d0 ; Is it lower than the player's frame?
  8471. blt.s return_6C9A ; Return if yes
  8472. sf.b (SS_Alternate_HorizScroll_Buf).w ; Don't use the alternate horizontal scroll buffer
  8473.  
  8474. return_6C9A:
  8475. rts
  8476. ; End of function SSTrack_Draw
  8477.  
  8478.  
  8479. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  8480. ; Initialize the PNT and H scroll table buffers.
  8481.  
  8482. ssInitTableBuffers:
  8483. lea (SS_Horiz_Scroll_Buf_1).w,a1
  8484. lea (SS_Horiz_Scroll_Buf_2).w,a2
  8485. moveq #0,d0 ; Scroll of 0 for PNTA and PNTB on lines 0 and 1 (normal) or lines 6 and 7 (flipped)
  8486. moveq #0,d1 ; Scroll of 0 for PNTB on lines 2 and 3 (normal) or lines 4 and 5 (flipped)
  8487. moveq #0,d2 ; Scroll of 0 for PNTB on lines 4 and 5 (normal) or lines 2 and 3 (flipped)
  8488. moveq #0,d3 ; Scroll of 0 for PNTB on lines 6 and 7 (normal) or lines 0 and 1 (flipped)
  8489. move.w #-$100,d1 ; Scroll of 3 screens for PNTA on lines 2 and 3 (normal) or lines 4 and 5 (flipped)
  8490. move.w #-$200,d2 ; Scroll of 2 screens for PNTA on lines 4 and 5 (normal) or lines 2 and 3 (flipped)
  8491. move.w #-$300,d3 ; Scroll of 1 screen for PNTA on lines 6 and 7 (normal) or lines 0 and 1 (flipped)
  8492. swap d1
  8493. swap d2
  8494. swap d3
  8495. moveq #$1F,d4
  8496.  
  8497. - move.l d0,(a1)+
  8498. move.l d0,(a1)+
  8499. move.l d1,(a1)+
  8500. move.l d1,(a1)+
  8501. move.l d2,(a1)+
  8502. move.l d2,(a1)+
  8503. move.l d3,(a1)+
  8504. move.l d3,(a1)+
  8505. move.l d3,(a2)+
  8506. move.l d3,(a2)+
  8507. move.l d2,(a2)+
  8508. move.l d2,(a2)+
  8509. move.l d1,(a2)+
  8510. move.l d1,(a2)+
  8511. move.l d0,(a2)+
  8512. move.l d0,(a2)+
  8513. dbf d4,-
  8514.  
  8515. rts
  8516. ; End of function ssInitTableBuffers
  8517.  
  8518.  
  8519. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  8520. ; Load compressed special stage data into RAM, or VRAM for the art.
  8521.  
  8522. ssLdComprsdData:
  8523. lea (ArtKos_Special).l,a0
  8524. lea (Chunk_Table).l,a1
  8525. bsr.w KosDec
  8526. move.l #vdpComm(tiles_to_bytes(ArtTile_VRAM_Start),VRAM,WRITE),(VDP_control_port).l
  8527. lea (VDP_data_port).l,a1
  8528. movea.l #Chunk_Table,a0
  8529. move.w (a0)+,d0
  8530. subq.w #1,d0
  8531.  
  8532. - rept 7
  8533. move.l (a0),(a1)
  8534. endm
  8535. move.l (a0)+,(a1)
  8536. dbf d0,-
  8537.  
  8538. lea (MiscKoz_SpecialPerspective).l,a0
  8539. lea (SSRAM_MiscKoz_SpecialPerspective).l,a1
  8540. bsr.w KosDec
  8541. lea (MiscKoz_SpecialLevelLayout).l,a0
  8542. lea (SSRAM_MiscNem_SpecialLevelLayout).w,a4
  8543. bsr.w NemDecToRAM
  8544. lea (MiscKoz_SpecialObjectLocations).l,a0
  8545. lea (SSRAM_MiscKoz_SpecialObjectLocations).w,a1
  8546. bsr.w KosDec
  8547. rts
  8548. ; End of function ssLdComprsdData
  8549.  
  8550.  
  8551. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  8552.  
  8553.  
  8554. ;sub_6D52
  8555. SSPlaneB_Background:
  8556. move #$2700,sr
  8557. movea.l #Chunk_Table,a1
  8558. lea (MapEng_SpecialBackBottom).l,a0
  8559. move.w #make_art_tile(ArtTile_ArtNem_SpecialBack,0,0),d0
  8560. bsr.w EniDec
  8561. movea.l #Chunk_Table+$400,a1
  8562. lea (MapEng_SpecialBack).l,a0
  8563. move.w #make_art_tile(ArtTile_ArtNem_SpecialBack,0,0),d0
  8564. bsr.w EniDec
  8565. lea (Chunk_Table).l,a1
  8566. move.l #vdpComm(VRAM_SS_Plane_B_Name_Table + $0000,VRAM,WRITE),d0
  8567. moveq #$1F,d1
  8568. moveq #$1F,d2
  8569. jsrto (PlaneMapToVRAM_H80_SpecialStage).l, PlaneMapToVRAM_H80_SpecialStage
  8570. lea (Chunk_Table).l,a1
  8571. move.l #vdpComm(VRAM_SS_Plane_B_Name_Table + $0040,VRAM,WRITE),d0
  8572. moveq #$1F,d1
  8573. moveq #$1F,d2
  8574. jsrto (PlaneMapToVRAM_H80_SpecialStage).l, PlaneMapToVRAM_H80_SpecialStage
  8575. lea (Chunk_Table).l,a1
  8576. move.l #vdpComm(VRAM_SS_Plane_B_Name_Table + $0080,VRAM,WRITE),d0
  8577. moveq #$1F,d1
  8578. moveq #$1F,d2
  8579. jsrto (PlaneMapToVRAM_H80_SpecialStage).l, PlaneMapToVRAM_H80_SpecialStage
  8580. lea (Chunk_Table).l,a1
  8581. move.l #vdpComm(VRAM_SS_Plane_B_Name_Table + $00C0,VRAM,WRITE),d0
  8582. moveq #$1F,d1
  8583. moveq #$1F,d2
  8584. jsrto (PlaneMapToVRAM_H80_SpecialStage).l, PlaneMapToVRAM_H80_SpecialStage
  8585. move #$2300,sr
  8586. rts
  8587. ; End of function SSPlaneB_Background
  8588.  
  8589.  
  8590. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  8591.  
  8592.  
  8593. ;sub_6DD4
  8594. SSDecompressPlayerArt:
  8595. lea (ArtNem_SpecialSonicAndTails).l,a0
  8596. lea (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF).l,a4
  8597. bra.w NemDecToRAM
  8598. ; End of function SSDecompressPlayerArt
  8599.  
  8600.  
  8601. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  8602.  
  8603.  
  8604. ;sub_6DE4
  8605. SS_ScrollBG:
  8606. bsr.w SSPlaneB_SetHorizOffset
  8607. bsr.w SSTrack_SetVscroll
  8608. rts
  8609. ; End of function SS_ScrollBG
  8610.  
  8611. ; ===========================================================================
  8612. ; special stage background vertical and horizontal scroll offsets
  8613. off_6DEE: offsetTable
  8614. offsetTableEntry.w byte_6E04 ; 0
  8615. offsetTableEntry.w byte_6E09 ; 1
  8616. offsetTableEntry.w byte_6E0E ; 2
  8617. offsetTableEntry.w byte_6E13 ; 3
  8618. offsetTableEntry.w byte_6E18 ; 4
  8619. offsetTableEntry.w byte_6E1D ; 5
  8620. offsetTableEntry.w byte_6E22 ; 6
  8621. offsetTableEntry.w byte_6E27 ; 7
  8622. offsetTableEntry.w byte_6E2C ; 8
  8623. offsetTableEntry.w byte_6E31 ; 9
  8624. offsetTableEntry.w byte_6E36 ; $A
  8625. byte_6E04: dc.b 2, 2, 2, 2, 2
  8626. byte_6E09: dc.b 4, 4, 5, 4, 5
  8627. byte_6E0E: dc.b $B, $B, $B, $B, $C
  8628. byte_6E13: dc.b 0, 0, 1, 0, 0
  8629. byte_6E18: dc.b 1, 1, 1, 1, 1
  8630. byte_6E1D: dc.b 9, 9, 8, 9, 9
  8631. byte_6E22: dc.b 9, 9, 9, 9, $A
  8632. byte_6E27: dc.b 7, 7, 6, 7, 7
  8633. byte_6E2C: dc.b 0, 1, 1, 1, 0
  8634. byte_6E31: dc.b 4, 3, 3, 3, 4
  8635. byte_6E36: dc.b 0, 0,$FF, 0, 0
  8636. even
  8637.  
  8638. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  8639.  
  8640. ;sub_6E3C
  8641. SSPlaneB_SetHorizOffset:
  8642. moveq #0,d7
  8643. moveq #0,d6
  8644. moveq #0,d0
  8645. move.b (SSTrack_last_anim_frame).w,d2 ; Get last track animation frame
  8646. move.b (SSTrack_anim).w,d0 ; Get current track animation
  8647. add.w d0,d0 ; Convert it to an index
  8648. move.w off_6E54(pc,d0.w),d0
  8649. jmp off_6E54(pc,d0.w)
  8650. ; ===========================================================================
  8651. off_6E54: offsetTable
  8652. offsetTableEntry.w + ; 0 ; Turn, then rise
  8653. offsetTableEntry.w + ; 1 ; Turn, then drop
  8654. offsetTableEntry.w + ; 2 ; Turn, then straight
  8655. offsetTableEntry.w ++ ; 3 ; rts ; Straight
  8656. offsetTableEntry.w ++ ; 4 ; rts ; Straight, then turn
  8657. ; ===========================================================================
  8658. +
  8659. moveq #0,d1
  8660. cmpi.b #1,d2 ; Was the last frame the first in this segment?
  8661. blt.s ++ ; Branch if yes
  8662. moveq #2,d1
  8663. cmpi.b #2,d2 ; Was the last frame frame 1?
  8664. blt.s ++ ; Branch if yes
  8665. moveq #4,d1
  8666. cmpi.b #$A,d2 ; Was the last frame less than $A?
  8667. blt.s ++ ; Branch if yes
  8668. moveq #2,d1
  8669. cmpi.b #$B,d2 ; Was the last frame $A?
  8670. blt.s ++ ; Branch if yes
  8671. moveq #0,d1
  8672. cmpi.b #$C,d2 ; Was the last frame $B?
  8673. blt.s ++ ; Branch if yes
  8674. +
  8675. rts
  8676. ; ===========================================================================
  8677. +
  8678. moveq #0,d0
  8679. moveq #0,d2
  8680. move.b (SSTrack_drawing_index).w,d0 ; Get drawing position
  8681. lea_ off_6DEE,a0 ; a0 = pointer to background scroll data
  8682. adda.w (a0,d1.w),a0 ; a0 = pointer to background scroll data for current animation frame
  8683. move.b (a0,d0.w),d2 ; Get background offset for current frame duration
  8684. tst.b (SS_Last_Alternate_HorizScroll_Buf).w ; Was the alternate horizontal scroll buffer used last time?
  8685. bne.s + ; Branch if yes
  8686. tst.b (SS_Alternate_HorizScroll_Buf).w ; Is the alternate horizontal scroll buffer being used now?
  8687. beq.s +++ ; Branch if not
  8688. bra.s ++
  8689. ; ===========================================================================
  8690. +
  8691. tst.b (SS_Alternate_HorizScroll_Buf).w ; Is the alternate horizontal scroll buffer still being used?
  8692. bne.s ++ ; Branch if yes
  8693. lea (SS_Horiz_Scroll_Buf_1 + 2).w,a1 ; Load horizontal scroll buffer for PNT B
  8694. bra.s +++
  8695. ; ===========================================================================
  8696. +
  8697. lea (SS_Horiz_Scroll_Buf_2 + 2).w,a1 ; Load alternate horizontal scroll buffer for PNT B
  8698. neg.w d2 ; Change the sign of the background offset
  8699. bra.s ++
  8700. ; ===========================================================================
  8701. +
  8702. lea (SS_Horiz_Scroll_Buf_1 + 2).w,a1 ; Load horizontal scroll buffer for PNT B
  8703. tst.b (SS_Alternate_HorizScroll_Buf).w ; Is the alternate horizontal scroll buffer being used now?
  8704. beq.s + ; Branch if not
  8705. lea (SS_Horiz_Scroll_Buf_2 + 2).w,a1 ; Load alternate horizontal scroll buffer for PNT B
  8706. neg.w d2 ; Change the sign of the background offset
  8707. +
  8708. move.w #$FF,d0 ; 256 lines
  8709. - sub.w d2,(a1)+ ; Change current line's offset
  8710. adda_.l #2,a1 ; Skip PNTA entry
  8711. dbf d0,-
  8712.  
  8713. rts
  8714. ; End of function SSPlaneB_SetHorizOffset
  8715.  
  8716. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  8717.  
  8718. ;sub_6EE0
  8719. SSTrack_SetVscroll:
  8720. move.w (Vscroll_Factor_BG).w,(SSTrack_LastVScroll).w ; Save last vertical scroll value
  8721. moveq #0,d7 ; Set flag to decrease vertical scroll
  8722. moveq #0,d0
  8723. moveq #0,d2
  8724. move.b (SSTrack_last_anim_frame).w,d2 ; Get last track animation frame
  8725. move.b (SSTrack_anim).w,d0 ; Get current track animation
  8726. add.w d0,d0 ; Convert it to index
  8727. move.w off_6EFE(pc,d0.w),d0
  8728. jmp off_6EFE(pc,d0.w)
  8729. ; ===========================================================================
  8730. off_6EFE: offsetTable
  8731. offsetTableEntry.w loc_6F0A ; 0 ; Turn, then rise
  8732. offsetTableEntry.w loc_6F2A ; 1 ; Turn, then drop
  8733. offsetTableEntry.w + ; 2 ; rts ; Turn, then straight
  8734. offsetTableEntry.w loc_6F4C ; 3 ; Straight
  8735. offsetTableEntry.w + ; 4 ; rts ; Straight, then turn
  8736. ; ===========================================================================
  8737. +
  8738. rts
  8739. ; ===========================================================================
  8740.  
  8741. loc_6F0A:
  8742. move.b +(pc,d2.w),d1 ; Get current frame's vertical scroll offset
  8743. bpl.s SSTrack_ApplyVscroll ; Branch if positive
  8744. rts
  8745. ; ===========================================================================
  8746. ; Special stage vertical scroll index for 'turn, then rise' animation
  8747. +
  8748. dc.b -1
  8749. dc.b -1 ; 1
  8750. dc.b -1 ; 2
  8751. dc.b -1 ; 3
  8752. dc.b -1 ; 4
  8753. dc.b -1 ; 5
  8754. dc.b -1 ; 6
  8755. dc.b -1 ; 7
  8756. dc.b -1 ; 8
  8757. dc.b -1 ; 9
  8758. dc.b 8 ; 10
  8759. dc.b 8 ; 11
  8760. dc.b 2 ; 12
  8761. dc.b 4 ; 13
  8762. dc.b 4 ; 14
  8763. dc.b 4 ; 15
  8764. dc.b 4 ; 16
  8765. dc.b 4 ; 17
  8766. dc.b 4 ; 18
  8767. dc.b $A ; 19
  8768. dc.b $C ; 20
  8769. dc.b $E ; 21
  8770. dc.b $12 ; 22
  8771. dc.b $10 ; 23
  8772. ; ===========================================================================
  8773.  
  8774. loc_6F2A:
  8775. st d7 ; Set flag to increase vertical scroll
  8776. move.b +(pc,d2.w),d1 ; Get current frame's vertical scroll offset
  8777. bpl.s SSTrack_ApplyVscroll ; Branch if positive
  8778. rts
  8779. ; ===========================================================================
  8780. ; Special stage vertical scroll index for 'turn, then drop' animation
  8781. +
  8782. dc.b -1
  8783. dc.b -1 ; 1
  8784. dc.b -1 ; 2
  8785. dc.b -1 ; 3
  8786. dc.b -1 ; 4
  8787. dc.b -1 ; 5
  8788. dc.b -1 ; 6
  8789. dc.b -1 ; 7
  8790. dc.b -1 ; 8
  8791. dc.b -1 ; 9
  8792. dc.b -1 ; 10
  8793. dc.b $10 ; 11
  8794. dc.b $12 ; 12
  8795. dc.b $E ; 13
  8796. dc.b $C ; 14
  8797. dc.b $A ; 15
  8798. dc.b 4 ; 16
  8799. dc.b 4 ; 17
  8800. dc.b 4 ; 18
  8801. dc.b 4 ; 19
  8802. dc.b 4 ; 20
  8803. dc.b 4 ; 21
  8804. dc.b 2 ; 22
  8805. dc.b 0 ; 23
  8806. ; ===========================================================================
  8807.  
  8808. loc_6F4C:
  8809. tst.b (SS_Pause_Only_flag).w ; Is the game paused?
  8810. bne.s + ; rts ; Return if yes
  8811. move.b ++(pc,d2.w),d1 ; Get current frame's vertical scroll offset
  8812. bpl.s SSTrack_ApplyVscroll ; Branch if positive
  8813. +
  8814. rts
  8815. ; ===========================================================================
  8816. ; Special stage vertical scroll index for 'straight' animation -- bobbing up and down
  8817. +
  8818. rept 4
  8819. dc.b 6
  8820. dc.b 6
  8821. dc.b $14
  8822. dc.b $14
  8823. endm
  8824. ; ===========================================================================
  8825. ;loc_6F6A
  8826. SSTrack_ApplyVscroll:
  8827. moveq #0,d0
  8828. moveq #0,d2
  8829. move.b (SSTrack_drawing_index).w,d0 ; Get drawing position
  8830. lea_ off_6DEE,a0 ; a0 = pointer to background scroll data
  8831. adda.w (a0,d1.w),a0 ; a0 = pointer to background scroll data for current animation frame
  8832. move.b (a0,d0.w),d2 ; Get background offset for current frame duration
  8833. tst.b d7 ; Are we supposed to increase the vertical scroll?
  8834. bpl.s + ; Branch if not
  8835. add.w d2,(Vscroll_Factor_BG).w ; Increase vertical scroll
  8836. rts
  8837. ; ===========================================================================
  8838. +
  8839. sub.w d2,(Vscroll_Factor_BG).w ; Decrease vertical scroll
  8840. rts
  8841. ; End of function SSTrack_SetVscroll
  8842.  
  8843. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  8844.  
  8845.  
  8846. ; sub_6F8E:
  8847. SSSingleObjLoad:
  8848. lea (SS_Dynamic_Object_RAM).w,a1
  8849. move.w #(SS_Dynamic_Object_RAM_End-SS_Dynamic_Object_RAM)/object_size-1,d5
  8850.  
  8851. - tst.b id(a1)
  8852. beq.s + ; rts
  8853. lea next_object(a1),a1 ; a1=object
  8854. dbf d5,-
  8855. +
  8856. rts
  8857. ; End of function sub_6F8E
  8858.  
  8859. ; ===========================================================================
  8860.  
  8861. ;loc_6FA4:
  8862. SSSingleObjLoad2:
  8863. movea.l a0,a1
  8864. move.w #SS_Dynamic_Object_RAM_End,d5
  8865. sub.w a0,d5
  8866. if object_size=$40
  8867. lsr.w #6,d5
  8868. else
  8869. divu.w #object_size,d5
  8870. endif
  8871. subq.w #1,d5
  8872. bcs.s + ; rts
  8873.  
  8874. - tst.b id(a1)
  8875. beq.s + ; rts
  8876. lea next_object(a1),a1
  8877. dbf d5,-
  8878.  
  8879. + rts
  8880.  
  8881.  
  8882. ; ===========================================================================
  8883. ; ----------------------------------------------------------------------------
  8884. ; Object 5E - HUD from Special Stage
  8885. ; ----------------------------------------------------------------------------
  8886. ; Sprite_6FC0:
  8887. Obj5E:
  8888. move.b routine(a0),d0
  8889. bne.w JmpTo_DisplaySprite
  8890. move.l #Obj5E_MapUnc_7070,mappings(a0)
  8891. move.w #make_art_tile(ArtTile_ArtNem_SpecialHUD,0,0),art_tile(a0)
  8892. move.b #4,render_flags(a0)
  8893. move.b #0,priority(a0)
  8894. move.b #1,routine(a0)
  8895. bset #6,render_flags(a0)
  8896. moveq #0,d1
  8897. tst.b (SS_2p_Flag).w
  8898. beq.s +
  8899. addq.w #6,d1
  8900. tst.b (Graphics_Flags).w
  8901. bpl.s ++
  8902. addq.w #1,d1
  8903. bra.s ++
  8904. ; ---------------------------------------------------------------------------
  8905. + move.w (Player_mode).w,d1
  8906. andi.w #3,d1
  8907. tst.b (Graphics_Flags).w
  8908. bpl.s +
  8909. addq.w #3,d1 ; set special stage tails name to "TAILS" instead of MILES
  8910. +
  8911. add.w d1,d1
  8912. moveq #0,d2
  8913. moveq #0,d3
  8914. lea (SSHUDLayout).l,a1
  8915. lea sub2_x_pos(a0),a2
  8916. adda.w (a1,d1.w),a1
  8917. move.b (a1)+,d3
  8918. move.b d3,mainspr_childsprites(a0)
  8919. subq.w #1,d3
  8920. moveq #0,d0
  8921. move.b (a1)+,d0
  8922.  
  8923. - move.w d0,(a2,d2.w)
  8924. move.b (a1)+,sub2_mapframe-sub2_x_pos(a2,d2.w) ; sub2_mapframe
  8925. addq.w #next_subspr,d2
  8926. dbf d3,-
  8927.  
  8928. rts
  8929. ; ===========================================================================
  8930. ; off_7042:
  8931. SSHUDLayout: offsetTable
  8932. offsetTableEntry.w SSHUD_SonicMilesTotal ; 0
  8933. offsetTableEntry.w SSHUD_Sonic ; 1
  8934. offsetTableEntry.w SSHUD_Miles ; 2
  8935. offsetTableEntry.w SSHUD_SonicTailsTotal ; 3
  8936. offsetTableEntry.w SSHUD_Sonic_2 ; 4
  8937. offsetTableEntry.w SSHUD_Tails ; 5
  8938. offsetTableEntry.w SSHUD_SonicMiles ; 6
  8939. offsetTableEntry.w SSHUD_SonicTails ; 7
  8940.  
  8941. ; byte_7052:
  8942. SSHUD_SonicMilesTotal:
  8943. dc.b 3 ; Sprite count
  8944. dc.b $80 ; X-pos
  8945. dc.b 0, 1, 3 ; Sprite 1 frame, Sprite 2 frame, etc
  8946. ; byte_7057:
  8947. SSHUD_Sonic:
  8948. dc.b 1
  8949. dc.b $D4
  8950. dc.b 0
  8951. ; byte_705A:
  8952. SSHUD_Miles:
  8953. dc.b 1
  8954. dc.b $38
  8955. dc.b 1
  8956.  
  8957. ; byte_705D:
  8958. SSHUD_SonicTailsTotal:
  8959. dc.b 3
  8960. dc.b $80
  8961. dc.b 0, 2, 3
  8962. ; byte_7062:
  8963. SSHUD_Sonic_2:
  8964. dc.b 1
  8965. dc.b $D4
  8966. dc.b 0
  8967. ; byte_7065:
  8968. SSHUD_Tails:
  8969. dc.b 1
  8970. dc.b $38
  8971. dc.b 2
  8972.  
  8973. ; 2 player
  8974. ; byte_7068:
  8975. SSHUD_SonicMiles:
  8976. dc.b 2
  8977. dc.b $80
  8978. dc.b 0, 1
  8979. ; byte_706C:
  8980. SSHUD_SonicTails:
  8981. dc.b 2
  8982. dc.b $80
  8983. dc.b 0, 2
  8984. ; -----------------------------------------------------------------------------------
  8985. ; sprite mappings
  8986. ; -----------------------------------------------------------------------------------
  8987. Obj5E_MapUnc_7070: BINCLUDE "mappings/sprite/obj5E.bin"
  8988. ; ===========================================================================
  8989. ; ----------------------------------------------------------------------------
  8990. ; Object 5F - Start banner/"Ending controller" from Special Stage
  8991. ; ----------------------------------------------------------------------------
  8992. ; Sprite_70F0:
  8993. Obj5F:
  8994. moveq #0,d0
  8995. move.b routine(a0),d0
  8996. move.w Obj5F_Index(pc,d0.w),d1
  8997. jmp Obj5F_Index(pc,d1.w)
  8998. ; ===========================================================================
  8999. ; off_70FE:
  9000. Obj5F_Index: offsetTable
  9001. offsetTableEntry.w Obj5F_Init ; 0
  9002. offsetTableEntry.w Obj5F_Main ; 2
  9003. offsetTableEntry.w loc_71B4 ; 4
  9004. offsetTableEntry.w loc_710A ; 6
  9005. offsetTableEntry.w return_723E ; 8
  9006. offsetTableEntry.w loc_7218 ; $A
  9007. ; ===========================================================================
  9008.  
  9009. loc_710A:
  9010. moveq #0,d0
  9011. move.b angle(a0),d0
  9012. bsr.w CalcSine
  9013. muls.w objoff_14(a0),d0
  9014. muls.w objoff_14(a0),d1
  9015. asr.w #8,d0
  9016. asr.w #8,d1
  9017. add.w d1,x_pos(a0)
  9018. add.w d0,y_pos(a0)
  9019. cmpi.w #0,x_pos(a0)
  9020. blt.w JmpTo_DeleteObject
  9021. cmpi.w #$100,x_pos(a0)
  9022. bgt.w JmpTo_DeleteObject
  9023. cmpi.w #0,y_pos(a0)
  9024. blt.w JmpTo_DeleteObject
  9025.  
  9026. if removeJmpTos
  9027. JmpTo_DisplaySprite
  9028. endif
  9029.  
  9030. jmpto (DisplaySprite).l, JmpTo_DisplaySprite
  9031. ; ===========================================================================
  9032.  
  9033. ; loc_714A:
  9034. Obj5F_Init:
  9035. tst.b (SS_2p_Flag).w
  9036. beq.s +
  9037. move.w #8,d0
  9038. jsrto (Obj5A_PrintPhrase).l, JmpTo_Obj5A_PrintPhrase
  9039. + move.w #$80,x_pos(a0)
  9040. move.w #-$40,y_pos(a0)
  9041. move.w #$100,y_vel(a0)
  9042. move.l #Obj5F_MapUnc_7240,mappings(a0)
  9043. move.w #make_art_tile(ArtTile_ArtNem_SpecialStart,0,0),art_tile(a0)
  9044. move.b #4,render_flags(a0)
  9045. move.b #1,priority(a0)
  9046. move.b #2,routine(a0)
  9047.  
  9048. ; loc_718A:
  9049. Obj5F_Main:
  9050. jsrto (ObjectMove).l, JmpTo_ObjectMove
  9051. cmpi.w #$48,y_pos(a0)
  9052. blt.w JmpTo_DisplaySprite
  9053. move.w #0,y_vel(a0)
  9054. move.w #$48,y_pos(a0)
  9055. move.b #4,routine(a0)
  9056. move.b #$F,objoff_2A(a0)
  9057. jmpto (DisplaySprite).l, JmpTo_DisplaySprite
  9058. ; ===========================================================================
  9059.  
  9060. loc_71B4:
  9061. subi_.b #1,objoff_2A(a0)
  9062. if ~~removeJmpTos
  9063. bne.w JmpTo_DisplaySprite
  9064. else
  9065. bne.s JmpTo_DisplaySprite
  9066. endif
  9067. moveq #6,d6
  9068.  
  9069. ; WARNING: the build script needs editing if you rename this label
  9070. word_728C_user: lea (Obj5F_MapUnc_7240+$4C).l,a2 ; word_728C
  9071.  
  9072. moveq #2,d3
  9073. move.w #8,objoff_14(a0)
  9074. move.b #6,routine(a0)
  9075.  
  9076. - bsr.w SSSingleObjLoad
  9077. bne.s +
  9078. moveq #0,d0
  9079.  
  9080. move.w #bytesToLcnt(object_size),d1
  9081.  
  9082. - move.l (a0,d0.w),(a1,d0.w)
  9083. addq.w #4,d0
  9084. dbf d1,-
  9085. if object_size&3
  9086. move.w (a0,d0.w),(a1,d0.w)
  9087. endif
  9088.  
  9089. move.b d3,mapping_frame(a1)
  9090. addq.w #1,d3
  9091. move.w #-$28,d2
  9092. move.w 8(a2),d1
  9093. bsr.w CalcAngle
  9094. move.b d0,angle(a1)
  9095. lea $A(a2),a2
  9096. + dbf d6,--
  9097.  
  9098. move.b #$A,routine(a0)
  9099. move.w #$1E,objoff_2A(a0)
  9100. rts
  9101. ; ===========================================================================
  9102.  
  9103. loc_7218:
  9104. subi_.w #1,objoff_2A(a0)
  9105. bpl.s +++ ; rts
  9106. tst.b (SS_2p_Flag).w
  9107. beq.s +
  9108. move.w #$A,d0
  9109. jsrto (Obj5A_PrintPhrase).l, JmpTo_Obj5A_PrintPhrase
  9110. bra.s ++
  9111. ; ===========================================================================
  9112. + jsrto (Obj5A_CreateRingReqMessage).l, JmpTo_Obj5A_CreateRingReqMessage
  9113.  
  9114. + st.b (SpecialStage_Started).w
  9115. jmpto (DeleteObject).l, JmpTo_DeleteObject
  9116. ; ===========================================================================
  9117.  
  9118. + rts
  9119. ; ===========================================================================
  9120.  
  9121. if removeJmpTos
  9122. JmpTo_DeleteObject
  9123. jmp (DeleteObject).l
  9124. endif
  9125.  
  9126. ; ===========================================================================
  9127.  
  9128. return_723E:
  9129. rts
  9130. ; ===========================================================================
  9131. ; ----------------------------------------------------------------------------
  9132. ; sprite mappings
  9133. ; ----------------------------------------------------------------------------
  9134. ; WARNING: the build script needs editing if you rename this label
  9135. ; or if you change the meaning of frame 2 in these mappings
  9136. Obj5F_MapUnc_7240: BINCLUDE "mappings/sprite/obj5F_a.bin"
  9137. ; -----------------------------------------------------------------------------------
  9138. ; sprite mappings
  9139. ; -----------------------------------------------------------------------------------
  9140. Obj5F_MapUnc_72D2: BINCLUDE "mappings/sprite/obj5F_b.bin"
  9141. ; ===========================================================================
  9142. ; ----------------------------------------------------------------------------
  9143. ; Object 87 - Number of rings in Special Stage
  9144. ; ----------------------------------------------------------------------------
  9145. ; Sprite_7356:
  9146. Obj87:
  9147. moveq #0,d0
  9148. move.b objoff_A(a0),d0
  9149. move.w Obj87_Index(pc,d0.w),d1
  9150. jmp Obj87_Index(pc,d1.w)
  9151. ; ===========================================================================
  9152. ; off_7364:
  9153. Obj87_Index: offsetTable
  9154. offsetTableEntry.w Obj87_Init ; 0
  9155. offsetTableEntry.w loc_7480 ; 2
  9156. offsetTableEntry.w loc_753E ; 4
  9157. offsetTableEntry.w loc_75DE ; 6
  9158. ; ===========================================================================
  9159.  
  9160. ; loc_736C:
  9161. Obj87_Init:
  9162. move.b #2,objoff_A(a0) ; => loc_7480
  9163. move.l #Obj5F_MapUnc_72D2,mappings(a0)
  9164. move.w #make_art_tile(ArtTile_ArtNem_SpecialHUD,2,0),art_tile(a0)
  9165. move.b #4,render_flags(a0)
  9166. bset #6,render_flags(a0)
  9167. move.b #2,mainspr_childsprites(a0)
  9168. move.w #$20,d0
  9169. moveq #0,d1
  9170. lea sub2_x_pos(a0),a1
  9171. move.w #$48,(a1) ; sub2_x_pos
  9172. move.w d0,sub2_y_pos-sub2_x_pos(a1) ; sub2_y_pos
  9173. move.w d1,mainspr_height-sub2_x_pos(a1) ; mainspr_height and sub2_mapframe
  9174. move.w #$E0,sub3_x_pos-sub2_x_pos(a1) ; sub3_x_pos
  9175. move.w d0,sub3_y_pos-sub2_x_pos(a1) ; sub3_y_pos
  9176. move.w d1,mapping_frame-sub2_x_pos(a1) ; mapping_frame and sub3_mapframe
  9177. move.w d0,sub4_y_pos-sub2_x_pos(a1) ; sub4_y_pos
  9178. move.w d0,sub5_y_pos-sub2_x_pos(a1) ; sub5_y_pos
  9179. move.w d0,sub6_y_pos-sub2_x_pos(a1) ; sub6_y_pos
  9180. move.w d0,sub7_y_pos-sub2_x_pos(a1) ; sub7_y_pos
  9181. tst.b (SS_2p_Flag).w
  9182. bne.s +++
  9183. cmpi.w #0,(Player_mode).w
  9184. beq.s +
  9185. subi_.b #1,mainspr_childsprites(a0)
  9186. move.w #$94,(a1) ; sub2_x_pos
  9187. rts
  9188. ; ===========================================================================
  9189. +
  9190. bsr.w SSSingleObjLoad
  9191. bne.s + ; rts
  9192. move.b #ObjID_SSNumberOfRings,id(a1) ; load obj87
  9193. move.b #4,objoff_A(a1) ; => loc_753E
  9194. move.l #Obj5F_MapUnc_72D2,mappings(a1)
  9195. move.w #make_art_tile(ArtTile_ArtNem_SpecialHUD,2,0),art_tile(a1)
  9196. move.b #4,render_flags(a1)
  9197. bset #6,render_flags(a1)
  9198. move.b #1,mainspr_childsprites(a1)
  9199. lea sub2_x_pos(a1),a2
  9200. move.w #$80,(a2) ; sub2_x_pos
  9201. move.w d0,sub2_y_pos-sub2_x_pos(a2) ; sub2_y_pos
  9202. move.w d1,mainspr_height-sub2_x_pos(a2) ; mainspr_height and sub2_mapframe
  9203. move.w d0,sub3_y_pos-sub2_x_pos(a2) ; sub3_y_pos
  9204. move.w d0,sub4_y_pos-sub2_x_pos(a2) ; sub4_y_pos
  9205. / rts
  9206. ; ===========================================================================
  9207. +
  9208. bsr.w SSSingleObjLoad
  9209. bne.s - ; rts
  9210. move.b #ObjID_SSNumberOfRings,id(a1) ; load obj87
  9211. move.b #6,objoff_A(a1) ; => loc_75DE
  9212. move.l #Obj5F_MapUnc_72D2,mappings(a1)
  9213. move.w #make_art_tile(ArtTile_ArtNem_SpecialHUD,2,0),art_tile(a1)
  9214. move.b #4,render_flags(a1)
  9215. bset #6,render_flags(a1)
  9216. move.b #0,mainspr_childsprites(a1)
  9217. lea sub2_x_pos(a1),a2
  9218. move.w #$2C,d0
  9219. move.w #$A,d1
  9220. move.w d0,sub2_y_pos-sub2_x_pos(a2) ; sub2_y_pos
  9221. move.w d1,mainspr_height-sub2_x_pos(a2) ; mainspr_height and sub2_mapframe
  9222. move.w d0,sub3_y_pos-sub2_x_pos(a2) ; sub3_y_pos
  9223. move.w d1,mapping_frame-sub2_x_pos(a2) ; mapping_frame and sub3_mapframe
  9224. move.w d0,sub4_y_pos-sub2_x_pos(a2) ; sub4_y_pos
  9225. move.w d1,sub4_mapframe-1-sub2_x_pos(a2) ; something and sub4_mapframe
  9226. rts
  9227. ; ===========================================================================
  9228.  
  9229. loc_7480:
  9230. moveq #0,d0
  9231. moveq #0,d3
  9232. moveq #0,d5
  9233. lea sub2_x_pos(a0),a1
  9234. movea.l a1,a2
  9235. addq.w #5,a2 ; a2 = sub2_mapframe(a0)
  9236. cmpi.w #2,(Player_mode).w
  9237. beq.s loc_74EA
  9238. move.b (MainCharacter+ss_rings_hundreds).w,d0
  9239. beq.s +
  9240. addq.w #1,d3
  9241. move.b d0,(a2)
  9242. lea next_subspr(a2),a2
  9243. + move.b (MainCharacter+ss_rings_tens).w,d0
  9244. tst.b d3
  9245. bne.s +
  9246. tst.b d0
  9247. beq.s ++
  9248. + addq.w #1,d3
  9249. move.b d0,(a2)
  9250. lea next_subspr(a2),a2
  9251. + addq.w #1,d3
  9252. move.b (MainCharacter+ss_rings_units).w,(a2)
  9253. lea next_subspr(a2),a2
  9254. move.w d3,d4
  9255. subq.w #1,d4
  9256. move.w #$48,d1
  9257. tst.w (Player_mode).w
  9258. beq.s +
  9259. addi.w #$54,d1
  9260. / move.w d1,(a1,d5.w)
  9261. addi_.w #8,d1
  9262. addq.w #next_subspr,d5
  9263. dbf d4,-
  9264. cmpi.w #1,(Player_mode).w
  9265. beq.s loc_7536
  9266.  
  9267. loc_74EA:
  9268. moveq #0,d0
  9269. moveq #0,d4
  9270. move.b (Sidekick+ss_rings_hundreds).w,d0
  9271. beq.s +
  9272. addq.w #1,d4
  9273. move.b d0,(a2)
  9274. lea next_subspr(a2),a2
  9275. + move.b (Sidekick+ss_rings_tens).w,d0
  9276. tst.b d4
  9277. bne.s +
  9278. tst.b d0
  9279. beq.s ++
  9280. +
  9281. addq.w #1,d4
  9282. move.b d0,(a2)
  9283. lea next_subspr(a2),a2
  9284. + move.b (Sidekick+ss_rings_units).w,(a2)
  9285. addq.w #1,d4
  9286. add.w d4,d3
  9287. subq.w #1,d4
  9288. move.w #$E0,d1
  9289. tst.w (Player_mode).w
  9290. beq.s +
  9291. subi.w #$44,d1
  9292. / move.w d1,(a1,d5.w)
  9293. addi_.w #8,d1
  9294. addq.w #6,d5
  9295. dbf d4,-
  9296.  
  9297. loc_7536:
  9298. move.b d3,mainspr_childsprites(a0)
  9299. jmpto (DisplaySprite).l, JmpTo_DisplaySprite
  9300. ; ===========================================================================
  9301.  
  9302. loc_753E:
  9303. moveq #0,d0
  9304. moveq #0,d1
  9305. moveq #0,d2
  9306. moveq #1,d3
  9307. move.b (MainCharacter+ss_rings_units).w,d0
  9308. add.b (Sidekick+ss_rings_units).w,d0
  9309. move.b (MainCharacter+ss_rings_tens).w,d1
  9310. add.b (Sidekick+ss_rings_tens).w,d1
  9311. move.b (MainCharacter+ss_rings_hundreds).w,d2
  9312. add.b (Sidekick+ss_rings_hundreds).w,d2
  9313. cmpi.b #10,d0
  9314. blo.s +
  9315. addq.w #1,d1
  9316. subi.b #10,d0
  9317. +
  9318. tst.b d1
  9319. beq.s ++
  9320. cmpi.b #10,d1
  9321. blo.s +
  9322. addi_.b #1,d2
  9323. subi.b #10,d1
  9324. +
  9325. addq.w #1,d3
  9326. tst.b d2
  9327. beq.s ++
  9328. addq.w #1,d3
  9329. bra.s ++
  9330. ; ===========================================================================
  9331. +
  9332. tst.b d2
  9333. beq.s +
  9334. addq.w #2,d3
  9335. +
  9336. lea sub2_x_pos(a0),a1
  9337. move.b d3,mainspr_childsprites(a0)
  9338. cmpi.b #2,d3
  9339. blt.s +
  9340. beq.s ++
  9341. move.w #$78,(a1) ; sub2_x_pos
  9342. move.b d2,sub2_mapframe-sub2_x_pos(a1) ; sub2_mapframe
  9343. move.w #$80,sub3_x_pos-sub2_x_pos(a1) ; sub3_x_pos
  9344. move.b d1,sub3_mapframe-sub2_x_pos(a1) ; sub3_mapframe
  9345. move.w #$88,sub4_x_pos-sub2_x_pos(a1) ; sub4_x_pos
  9346. move.b d0,sub4_mapframe-sub2_x_pos(a1) ; sub4_mapframe
  9347. jmpto (DisplaySprite).l, JmpTo_DisplaySprite
  9348. ; ===========================================================================
  9349. +
  9350. move.w #$80,(a1) ; sub2_x_pos
  9351. move.b d0,sub2_mapframe-sub2_x_pos(a1) ; sub2_mapframe
  9352. jmpto (DisplaySprite).l, JmpTo_DisplaySprite
  9353. ; ===========================================================================
  9354. +
  9355. move.w #$7C,(a1) ; sub2_x_pos
  9356. move.b d1,sub2_mapframe-sub2_x_pos(a1) ; sub2_mapframe
  9357. move.w #$84,sub3_x_pos-sub2_x_pos(a1) ; sub3_x_pos
  9358. move.b d0,sub3_mapframe-sub2_x_pos(a1) ; sub3_mapframe
  9359. jmpto (DisplaySprite).l, JmpTo_DisplaySprite
  9360. ; ===========================================================================
  9361.  
  9362. loc_75DE:
  9363. move.b (SS_2P_BCD_Score).w,d0
  9364. bne.s +
  9365. rts
  9366. ; ===========================================================================
  9367. +
  9368. lea sub2_x_pos(a0),a1
  9369. moveq #0,d2
  9370. move.b d0,d1
  9371. andi.b #$F0,d0
  9372. beq.s +
  9373. addq.w #1,d2
  9374. move.w #$20,(a1) ; sub2_x_pos
  9375. lea next_subspr(a1),a1
  9376. subi.b #$10,d0
  9377. beq.s +
  9378. addq.w #1,d2
  9379. move.w #$30,(a1) ; sub3_x_pos
  9380. lea next_subspr(a1),a1
  9381. subi.b #$10,d0
  9382. beq.s +
  9383. addq.w #1,d2
  9384. move.w #$40,(a1) ; sub4_x_pos
  9385. bra.s ++
  9386. ; ===========================================================================
  9387. +
  9388. andi.b #$F,d1
  9389. beq.s +
  9390. addq.w #1,d2
  9391. move.w #$B8,(a1) ; sub?_x_pos
  9392. lea next_subspr(a1),a1
  9393. subi_.b #1,d1
  9394. beq.s +
  9395. addq.w #1,d2
  9396. move.w #$C8,(a1) ; sub?_x_pos
  9397. lea next_subspr(a1),a1
  9398. subi_.b #1,d1
  9399. beq.s +
  9400. addq.w #1,d2
  9401. move.w #$D8,(a1) ; sub?_x_pos
  9402. +
  9403. move.b d2,mainspr_childsprites(a0)
  9404. jmpto (DisplaySprite).l, JmpTo_DisplaySprite
  9405.  
  9406. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  9407.  
  9408. ;sub_7650
  9409. SSSetGeometryOffsets:
  9410. move.b (SSTrack_drawing_index).w,d0 ; Get drawing position
  9411. cmp.b (SS_player_anim_frame_timer).w,d0 ; Compare to player frame duration
  9412. beq.s + ; If both are equal, branch
  9413. rts
  9414. ; ===========================================================================
  9415. +
  9416. moveq #0,d0
  9417. move.b (SSTrack_mapping_frame).w,d0 ; Get current track mapping frame
  9418. add.w d0,d0 ; Convert to index
  9419. lea SSCurveOffsets(pc,d0.w),a2 ; Load current curve offsets into a2
  9420. move.b (a2)+,d0 ; Get x offset
  9421. tst.b (SSTrack_Orientation).w ; Is track flipped?
  9422. beq.s + ; Branch if not
  9423. neg.b d0 ; Change sign of offset
  9424. +
  9425. ext.w d0 ; Extend to word
  9426. addi.w #$80,d0 ; Add 128 (why?)
  9427. move.w d0,(SS_Offset_X).w ; Set X geometry offset
  9428. move.b (a2),d0 ; Get y offset
  9429. ext.w d0 ; Extend to word
  9430. addi.w #$36,d0 ; Add $36 (why?)
  9431. move.w d0,(SS_Offset_Y).w ; Set Y geometry offset
  9432. rts
  9433. ; End of function SSSetGeometryOffsets
  9434.  
  9435. ; ===========================================================================
  9436. ; Position offsets to sort-of rotate the plane sonic/tails are in
  9437. ; when the special stage track is curving, so they follow it better.
  9438. ; Each word seems to be (x_offset, y_offset)
  9439. ; See also Ani_SpecialStageTrack.
  9440. SSCurveOffsets: ; word_768A:
  9441. dc.b $13, 0, $13, 0, $13, 0, $13, 0 ; $00
  9442. dc.b 9, -$A, 0,-$1C, 0,-$1C, 0,-$20 ; $04
  9443. dc.b 0,-$24, 0,-$2A, 0,-$10, 0, 6 ; $08
  9444. dc.b 0, $E, 0, $10, 0, $12, 0, $12 ; $0C
  9445. dc.b 9, $12 ; $10; upward curve
  9446. dc.b 0, 0, 0, 0, 0, 0, 0, 0 ; $11; straight
  9447. dc.b $13, 0, $13, 0, $13, 0, $13, 0 ; $15
  9448. dc.b $B, $C, 0, $C, 0, $12, 0, $A ; $19
  9449. dc.b 0, 8, 0, 2, 0, $10, 0,-$20 ; $1D
  9450. dc.b 0,-$1F, 0,-$1E, 0,-$1B, 0,-$18 ; $21
  9451. dc.b 0, -$E ; $25; downward curve
  9452. dc.b $13, 0, $13, 0, $13, 0, $13, 0 ; $26
  9453. dc.b $13, 0, $13, 0 ; $2B; turning
  9454. dc.b $13, 0, $13, 0, $13, 0, $13, 0 ; $2C
  9455. dc.b $B, 0 ; $30; exit turn
  9456. dc.b 0, 0, 0, 0, 0, 0, 0, 0 ; $31
  9457. dc.b 0, 0, 0, 0, 3, 0 ; $35; straight
  9458. ; ===========================================================================
  9459. ; Subroutine to advance to the next act and get an encoded version
  9460. ; of the ring requirements.
  9461. ; Output:
  9462. ; d0, d1: Binary coded decimal version of ring requirements (maximum of 299 rings)
  9463. ; d2: Number of digits in the ring requirements - 1 (minimum 2 digits)
  9464. ;loc_76FA
  9465. SSStartNewAct:
  9466. moveq #0,d1
  9467. moveq #1,d2
  9468. move.w (Current_Special_StageAndAct).w,d0
  9469. move.b d0,d1
  9470. lsr.w #8,d0
  9471. add.w d0,d0
  9472. add.w d0,d0
  9473. add.w d1,d0
  9474. tst.w (Player_mode).w
  9475. bne.s +
  9476. move.b SpecialStage_RingReq_Team(pc,d0.w),d1
  9477. bra.s ++
  9478. ; ===========================================================================
  9479. +
  9480. move.b SpecialStage_RingReq_Alone(pc,d0.w),d1
  9481. +
  9482. move.w d1,(SS_Ring_Requirement).w
  9483. moveq #0,d0
  9484. cmpi.w #100,d1
  9485. blt.s +
  9486. addq.w #1,d2
  9487. ; The following code does a more complete binary coded decimal conversion:
  9488. if 1==0
  9489. - addi.w #$100,d0
  9490. subi.w #100,d1
  9491. cmpi.w #100,d1
  9492. bgt.s -
  9493. else
  9494. ; This code (the original) is limited to 299 rings:
  9495. subi.w #100,d1
  9496. move.w #$100,d0
  9497. cmpi.w #100,d1
  9498. blt.s +
  9499. subi.w #100,d1
  9500. addi.w #$100,d0
  9501. endif
  9502. +
  9503. divu.w #10,d1
  9504. lsl.w #4,d1
  9505. or.b d1,d0
  9506. swap d1
  9507. or.b d1,d0
  9508. move.w d0,d1
  9509. addi_.w #1,(Current_Special_StageAndAct).w
  9510. rts
  9511. ; ===========================================================================
  9512. ; ----------------------------------------------------------------------------
  9513. ; Ring requirement values for Sonic and Tails games
  9514. ;
  9515. ; This array stores the number of rings you need to get to complete each round
  9516. ; of each special stage, while playing with both sonic and tails. 4 bytes per
  9517. ; stage, corresponding to the four possible parts of the level. Last part is unused.
  9518. ; ----------------------------------------------------------------------------
  9519. ; Misc_7756:
  9520. SpecialStage_RingReq_Team:
  9521. dc.b 40, 80,140,120 ; 4
  9522. dc.b 50,100,140,150 ; 8
  9523. dc.b 60,110,160,170 ; 12
  9524. dc.b 40,100,150,160 ; 16
  9525. dc.b 55,110,200,200 ; 20
  9526. dc.b 80,140,220,220 ; 24
  9527. dc.b 100,190,210,210 ; 28
  9528. ; ----------------------------------------------------------------------------
  9529. ; Ring requirement values for Sonic or Tails alone games
  9530. ;
  9531. ; This array stores the number of rings you need to get to complete each round
  9532. ; of each special stage, while playing with either sonic or tails. 4 bytes per
  9533. ; stage, corresponding to the four possible parts of the level. Last part is unused.
  9534. ; ----------------------------------------------------------------------------
  9535. ; Misc_7772:
  9536. SpecialStage_RingReq_Alone:
  9537. dc.b 30, 70,130,110 ; 4
  9538. dc.b 50,100,140,140 ; 8
  9539. dc.b 50,110,160,160 ; 12
  9540. dc.b 40,110,150,150 ; 16
  9541. dc.b 50, 90,160,160 ; 20
  9542. dc.b 80,140,210,210 ; 24
  9543. dc.b 100,150,190,190 ; 28
  9544.  
  9545. ; special stage palette table
  9546. ; word_778E:
  9547. SpecialStage_Palettes:
  9548. dc.w PalID_SS1
  9549. dc.w PalID_SS2
  9550. dc.w PalID_SS3
  9551. dc.w PalID_SS4
  9552. dc.w PalID_SS5
  9553. dc.w PalID_SS6
  9554. dc.w PalID_SS7
  9555. dc.w PalID_SS1_2p
  9556. dc.w PalID_SS2_2p
  9557. dc.w PalID_SS3_2p
  9558.  
  9559. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  9560.  
  9561.  
  9562. ;sub_77A2
  9563. SSInitPalAndData:
  9564. clr.b (Current_Special_Act).w
  9565. move.b #-1,(SpecialStage_LastSegment2).w
  9566. move.w #0,(Ring_count).w
  9567. move.w #0,(Ring_count_2P).w
  9568. move.b #0,(Perfect_rings_flag).w
  9569. move.b #0,(Got_Emerald).w
  9570. move.b #4,(SS_Star_color_2).w
  9571. lea (SS2p_RingBuffer).w,a2
  9572. moveq #0,d0
  9573. move.w d0,(a2)+
  9574. move.w d0,(a2)+
  9575. move.w d0,(a2)+
  9576. move.w d0,(a2)+
  9577. move.w d0,(a2)+
  9578. move.w d0,(a2)+
  9579. moveq #PalID_SS,d0
  9580. bsr.w PalLoad_ForFade
  9581. lea_ SpecialStage_Palettes,a1
  9582. moveq #0,d0
  9583. move.b (Current_Special_Stage).w,d0
  9584. add.w d0,d0
  9585. move.w d0,d1
  9586. tst.b (SS_2p_Flag).w
  9587. beq.s +
  9588. cmpi.b #4,d0
  9589. blo.s +
  9590. addi_.w #6,d0
  9591. +
  9592. move.w (a1,d0.w),d0
  9593. bsr.w PalLoad_ForFade
  9594. lea (SSRAM_MiscKoz_SpecialObjectLocations).w,a0
  9595. adda.w (a0,d1.w),a0
  9596. move.l a0,(SS_CurrentLevelObjectLocations).w
  9597. lea (SSRAM_MiscNem_SpecialLevelLayout).w,a0
  9598. adda.w (a0,d1.w),a0
  9599. move.l a0,(SS_CurrentLevelLayout).w
  9600. rts
  9601. ; End of function SSInitPalAndData
  9602.  
  9603. ; ===========================================================================
  9604.  
  9605. ; temporarily remap characters to title card letter format
  9606. ; Characters are encoded as Aa, Bb, Cc, etc. through a macro
  9607. charset 'A',0 ; can't have an embedded 0 in a string
  9608. charset 'B',"\4\8\xC\4\x10\x14\x18\x1C\x1E\x22\x26\x2A\4\4\x30\x34\x38\x3C\x40\x44\x48\x4C\x52\x56\4"
  9609. charset 'a',"\4\4\4\4\4\4\4\4\2\4\4\4\6\4\4\4\4\4\4\4\4\4\6\4\4"
  9610. charset '.',"\x5A"
  9611.  
  9612. ; letter lookup string
  9613. llookup := "ABCDEFGHIJKLMNOPQRSTUVWXYZ ."
  9614.  
  9615. ; macro for defining title card letters in conjunction with the remapped character set
  9616. titleLetters macro letters
  9617. ; ". ZYXWVUTSRQPONMLKJIHGFEDCBA"
  9618. used := %0110000000000110000000010000 ; set to initial state
  9619. c := 0
  9620. rept strlen(letters)
  9621. t := substr(letters,c,1)
  9622. if ~~(used&1<<strstr(llookup,t)) ; has the letter been used already?
  9623. used := used|1<<strstr(llookup,t) ; if not, mark it as used
  9624. dc.b t ; output letter code
  9625. if t=="."
  9626. dc.b 2 ; output character size
  9627. else
  9628. dc.b lowstring(t) ; output letter size
  9629. endif
  9630. endif
  9631. c := c+1
  9632. endm
  9633. dc.w $FFFF ; output string terminator
  9634. endm
  9635.  
  9636. ;word_7822:
  9637. SpecialStage_ResultsLetters:
  9638. titleLetters "ACDGHILMPRSTUW."
  9639.  
  9640. charset ; revert character set
  9641.  
  9642. ; ===========================================================================
  9643.  
  9644. if gameRevision<2
  9645. nop
  9646. endif
  9647.  
  9648. if ~~removeJmpTos
  9649. JmpTo_DisplaySprite
  9650. jmp (DisplaySprite).l
  9651. JmpTo_LoadTitleCardSS
  9652. jmp (LoadTitleCardSS).l
  9653. JmpTo_DeleteObject
  9654. jmp (DeleteObject).l
  9655. JmpTo_Obj5A_CreateRingReqMessage
  9656. jmp (Obj5A_CreateRingReqMessage).l
  9657. JmpTo_Obj5A_PrintPhrase
  9658. jmp (Obj5A_PrintPhrase).l
  9659. ; sub_7862:
  9660. JmpTo_ObjectMove
  9661. jmp (ObjectMove).l
  9662. JmpTo_Hud_Base
  9663. jmp (Hud_Base).l
  9664.  
  9665. align 4
  9666. endif
  9667.  
  9668.  
  9669.  
  9670.  
  9671. ; ----------------------------------------------------------------------------
  9672. ; Continue Screen
  9673. ; ----------------------------------------------------------------------------
  9674. ; loc_7870:
  9675. ContinueScreen:
  9676. bsr.w Pal_FadeToBlack
  9677. move #$2700,sr
  9678. move.w (VDP_Reg1_val).w,d0
  9679. andi.b #$BF,d0
  9680. move.w d0,(VDP_control_port).l
  9681. lea (VDP_control_port).l,a6
  9682. move.w #$8004,(a6) ; H-INT disabled
  9683. move.w #$8700,(a6) ; Background palette/color: 0/0
  9684. bsr.w ClearScreen
  9685.  
  9686. clearRAM ContScr_Object_RAM,ContScr_Object_RAM_End
  9687.  
  9688. bsr.w ContinueScreen_LoadLetters
  9689. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_ContinueTails),VRAM,WRITE),(VDP_control_port).l
  9690. lea (ArtNem_ContinueTails).l,a0
  9691. bsr.w NemDec
  9692. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_MiniContinue),VRAM,WRITE),(VDP_control_port).l
  9693. lea (ArtNem_MiniSonic).l,a0
  9694. cmpi.w #2,(Player_mode).w
  9695. bne.s +
  9696. lea (ArtNem_MiniTails).l,a0
  9697. +
  9698. bsr.w NemDec
  9699. moveq #$A,d1
  9700. jsr (ContScrCounter).l
  9701. moveq #PalID_SS1,d0
  9702. bsr.w PalLoad_ForFade
  9703. move.w #0,(Target_palette).w
  9704. move.b #MusID_Continue,d0
  9705. bsr.w PlayMusic
  9706. move.w #$293,(Demo_Time_left).w ; 11 seconds minus 1 frame
  9707. clr.b (Level_started_flag).w
  9708. clr.l (Camera_X_pos_copy).w
  9709. move.l #$1000000,(Camera_Y_pos_copy).w
  9710. move.b #ObjID_ContinueChars,(MainCharacter+id).w ; load ObjDB (sonic on continue screen)
  9711. move.b #ObjID_ContinueChars,(Sidekick+id).w ; load ObjDB (tails on continue screen)
  9712. move.b #6,(Sidekick+routine).w ; => ObjDB_Tails_Init
  9713. move.b #ObjID_ContinueText,(ContinueText+id).w ; load ObjDA (continue screen text)
  9714. move.b #ObjID_ContinueIcons,(ContinueIcons+id).w ; load ObjDA (continue icons)
  9715. move.b #4,(ContinueIcons+routine).w ; => loc_7AD0
  9716. jsr (RunObjects).l
  9717. jsr (BuildSprites).l
  9718. move.b #VintID_Menu,(Vint_routine).w
  9719. bsr.w WaitForVint
  9720. move.w (VDP_Reg1_val).w,d0
  9721. ori.b #$40,d0
  9722. move.w d0,(VDP_control_port).l
  9723. bsr.w Pal_FadeFromBlack
  9724. -
  9725. move.b #VintID_Menu,(Vint_routine).w
  9726. bsr.w WaitForVint
  9727. cmpi.b #4,(MainCharacter+routine).w
  9728. bhs.s +
  9729. move #$2700,sr
  9730. move.w (Demo_Time_left).w,d1
  9731. divu.w #60,d1
  9732. andi.l #$F,d1
  9733. jsr (ContScrCounter).l
  9734. move #$2300,sr
  9735. +
  9736. jsr (RunObjects).l
  9737. jsr (BuildSprites).l
  9738. cmpi.w #$180,(Sidekick+x_pos).w
  9739. bhs.s +
  9740. cmpi.b #4,(MainCharacter+routine).w
  9741. bhs.s -
  9742. tst.w (Demo_Time_left).w
  9743. bne.w -
  9744. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  9745. rts
  9746. ; ---------------------------------------------------------------------------
  9747. +
  9748. move.b #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
  9749. move.b #3,(Life_count).w
  9750. move.b #3,(Life_count_2P).w
  9751. moveq #0,d0
  9752. move.w d0,(Ring_count).w
  9753. move.l d0,(Timer).w
  9754. move.l d0,(Score).w
  9755. move.b d0,(Last_star_pole_hit).w
  9756. move.w d0,(Ring_count_2P).w
  9757. move.l d0,(Timer_2P).w
  9758. move.l d0,(Score_2P).w
  9759. move.b d0,(Last_star_pole_hit_2P).w
  9760. move.l #5000,(Next_Extra_life_score).w
  9761. move.l #5000,(Next_Extra_life_score_2P).w
  9762. subq.b #1,(Continue_count).w
  9763. rts
  9764.  
  9765. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  9766.  
  9767. ; sub_7A04:
  9768. ContinueScreen_LoadLetters:
  9769. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_TitleCard),VRAM,WRITE),(VDP_control_port).l
  9770. lea (ArtNem_TitleCard).l,a0
  9771. bsr.w NemDec
  9772. lea (Level_Layout).w,a4
  9773. lea (ArtNem_TitleCard2).l,a0
  9774. bsr.w NemDecToRAM
  9775. lea (ContinueScreen_AdditionalLetters).l,a0
  9776. move.l #vdpComm(tiles_to_bytes(ArtTile_ContinueScreen_Additional),VRAM,WRITE),(VDP_control_port).l
  9777. lea (Level_Layout).w,a1
  9778. lea (VDP_data_port).l,a6
  9779. -
  9780. moveq #0,d0
  9781. move.b (a0)+,d0
  9782. bmi.s + ; rts
  9783. lsl.w #5,d0
  9784. lea (a1,d0.w),a2
  9785. moveq #0,d1
  9786. move.b (a0)+,d1
  9787. lsl.w #3,d1
  9788. subq.w #1,d1
  9789.  
  9790. - move.l (a2)+,(a6)
  9791. dbf d1,-
  9792.  
  9793. bra.s --
  9794. ; ---------------------------------------------------------------------------
  9795. + rts
  9796. ; End of function ContinueScreen_LoadLetters
  9797.  
  9798. ; ===========================================================================
  9799.  
  9800. ; temporarily remap characters to title card letter format
  9801. ; Characters are encoded as Aa, Bb, Cc, etc. through a macro
  9802. charset 'A',0 ; can't have an embedded 0 in a string
  9803. charset 'B',"\4\8\xC\4\x10\x14\x18\x1C\x1E\x22\x26\x2A\4\4\x30\x34\x38\x3C\x40\x44\x48\x4C\x52\x56\4"
  9804. charset 'a',"\4\4\4\4\4\4\4\4\2\4\4\4\6\4\4\4\4\4\4\4\4\4\6\4\4"
  9805. charset '.',"\x5A"
  9806.  
  9807. ; Defines which letters load for the continue screen
  9808. ; Each letter occurs only once, and the letters ENOZ (i.e. ZONE) aren't loaded here
  9809. ; However, this is hidden by the titleLetters macro, and normal titles can be used
  9810. ; (the macro is defined near SpecialStage_ResultsLetters, which uses it before here)
  9811.  
  9812. ; word_7A5E:
  9813. ContinueScreen_AdditionalLetters:
  9814. titleLetters "CONTINUE"
  9815.  
  9816. charset ; revert character set
  9817. ; ===========================================================================
  9818. ; ----------------------------------------------------------------------------
  9819. ; Object DA - Continue text
  9820. ; ----------------------------------------------------------------------------
  9821. ; loc_7A68:
  9822. ObjDA: ; (screen-space obj)
  9823. moveq #0,d0
  9824. move.b routine(a0),d0
  9825. move.w ObjDA_Index(pc,d0.w),d1
  9826. jmp ObjDA_Index(pc,d1.w)
  9827. ; ===========================================================================
  9828. ; Obj_DA_subtbl:
  9829. ObjDA_Index: offsetTable
  9830. offsetTableEntry.w ObjDA_Init ; 0
  9831. offsetTableEntry.w JmpTo2_DisplaySprite ; 2
  9832. offsetTableEntry.w loc_7AD0 ; 4
  9833. offsetTableEntry.w loc_7B46 ; 6
  9834. ; ===========================================================================
  9835. ; loc_7A7E:
  9836. ObjDA_Init:
  9837. addq.b #2,routine(a0)
  9838. move.l #ObjDA_MapUnc_7CB6,mappings(a0)
  9839. move.w #make_art_tile(ArtTile_ArtNem_ContinueText,0,1),art_tile(a0)
  9840. jsrto (Adjust2PArtPointer).l, JmpTo_Adjust2PArtPointer
  9841. move.b #0,render_flags(a0)
  9842. move.b #$3C,width_pixels(a0)
  9843. move.w #$120,x_pixel(a0)
  9844. move.w #$C0,y_pixel(a0)
  9845.  
  9846. JmpTo2_DisplaySprite
  9847. jmp (DisplaySprite).l
  9848. ; ===========================================================================
  9849. ; word_7AB2:
  9850. ObjDA_XPositions:
  9851. dc.w $116, $12A, $102, $13E, $EE, $152, $DA, $166
  9852. dc.w $C6, $17A, $B2, $18E, $9E, $1A2, $8A; 8
  9853. ; ===========================================================================
  9854.  
  9855. loc_7AD0:
  9856. movea.l a0,a1
  9857. lea_ ObjDA_XPositions,a2
  9858. moveq #0,d1
  9859. move.b (Continue_count).w,d1
  9860. subq.b #2,d1
  9861. bcc.s +
  9862. jmp (DeleteObject).l
  9863. ; ===========================================================================
  9864. +
  9865. moveq #1,d3
  9866. cmpi.b #$E,d1
  9867. blo.s +
  9868. moveq #0,d3
  9869. moveq #$E,d1
  9870. +
  9871. move.b d1,d2
  9872. andi.b #1,d2
  9873.  
  9874. - _move.b #ObjID_ContinueIcons,id(a1) ; load objDA
  9875. move.w (a2)+,x_pixel(a1)
  9876. tst.b d2
  9877. beq.s +
  9878. subi.w #$A,x_pixel(a1)
  9879. +
  9880. move.w #$D0,y_pixel(a1)
  9881. move.b #4,mapping_frame(a1)
  9882. move.b #6,routine(a1)
  9883. move.l #ObjDA_MapUnc_7CB6,mappings(a1)
  9884. move.w #make_art_tile(ArtTile_ArtNem_ContinueText_2,0,1),art_tile(a1)
  9885. jsrto (Adjust2PArtPointer2).l, JmpTo_Adjust2PArtPointer2
  9886. move.b #0,render_flags(a1)
  9887. lea next_object(a1),a1 ; load obj addr
  9888. dbf d1,-
  9889.  
  9890. lea -next_object(a1),a1 ; load obj addr
  9891. move.b d3,subtype(a1)
  9892.  
  9893. loc_7B46:
  9894. tst.b subtype(a0)
  9895. beq.s +
  9896. cmpi.b #4,(MainCharacter+routine).w
  9897. blo.s +
  9898. move.b (Vint_runcount+3).w,d0
  9899. andi.b #1,d0
  9900. bne.s +
  9901. tst.w (MainCharacter+x_vel).w
  9902. bne.s JmpTo2_DeleteObject
  9903. rts
  9904. ; ===========================================================================
  9905. +
  9906. move.b (Vint_runcount+3).w,d0
  9907. andi.b #$F,d0
  9908. bne.s JmpTo3_DisplaySprite
  9909. bchg #0,mapping_frame(a0)
  9910.  
  9911. JmpTo3_DisplaySprite
  9912. jmp (DisplaySprite).l
  9913. ; ===========================================================================
  9914.  
  9915. JmpTo2_DeleteObject
  9916. jmp (DeleteObject).l
  9917. ; ===========================================================================
  9918. ; ----------------------------------------------------------------------------
  9919. ; Object DB - Sonic lying down or Tails nagging (on the continue screen)
  9920. ; ----------------------------------------------------------------------------
  9921. ; Sprite_7B82:
  9922. ObjDB:
  9923. ; a0=character
  9924. moveq #0,d0
  9925. move.b routine(a0),d0
  9926. move.w ObjDB_Index(pc,d0.w),d1
  9927. jsr ObjDB_Index(pc,d1.w)
  9928. jmp (DisplaySprite).l
  9929. ; ===========================================================================
  9930. ; off_7B96: ObjDB_States:
  9931. ObjDB_Index: offsetTable
  9932. offsetTableEntry.w ObjDB_Sonic_Init ; 0
  9933. offsetTableEntry.w ObjDB_Sonic_Wait ; 2
  9934. offsetTableEntry.w ObjDB_Sonic_Run ; 4
  9935. offsetTableEntry.w ObjDB_Tails_Init ; 6
  9936. offsetTableEntry.w ObjDB_Tails_Wait ; 8
  9937. offsetTableEntry.w ObjDB_Tails_Run ; $A
  9938. ; ===========================================================================
  9939. ; loc_7BA2:
  9940. ObjDB_Sonic_Init:
  9941. addq.b #2,routine(a0) ; => ObjDB_Sonic_Wait
  9942. move.w #$9C,x_pos(a0)
  9943. move.w #$19C,y_pos(a0)
  9944. move.l #Mapunc_Sonic,mappings(a0)
  9945. move.w #make_art_tile(ArtTile_ArtUnc_Sonic,0,0),art_tile(a0)
  9946. move.b #4,render_flags(a0)
  9947. move.b #2,priority(a0)
  9948. move.b #$20,anim(a0)
  9949.  
  9950. ; loc_7BD2:
  9951. ObjDB_Sonic_Wait:
  9952. tst.b (Ctrl_1_Press).w ; is start pressed?
  9953. bmi.s ObjDB_Sonic_StartRunning ; if yes, branch
  9954. jsr (Sonic_Animate).l
  9955. jmp (LoadSonicDynPLC).l
  9956. ; ---------------------------------------------------------------------------
  9957. ; loc_7BE4:
  9958. ObjDB_Sonic_StartRunning:
  9959. addq.b #2,routine(a0) ; => ObjDB_Sonic_Run
  9960. move.b #$21,anim(a0)
  9961. clr.w inertia(a0)
  9962. move.b #SndID_SpindashRev,d0 ; super peel-out sound
  9963. bsr.w PlaySound
  9964.  
  9965. ; loc_7BFA:
  9966. ObjDB_Sonic_Run:
  9967. cmpi.w #$800,inertia(a0)
  9968. bne.s +
  9969. move.w #$1000,x_vel(a0)
  9970. bra.s ++
  9971. ; ---------------------------------------------------------------------------
  9972. +
  9973. addi.w #$20,inertia(a0)
  9974. +
  9975. jsr (ObjectMove).l
  9976. jsr (Sonic_Animate).l
  9977. jmp (LoadSonicDynPLC).l
  9978. ; ===========================================================================
  9979. ; loc_7C22:
  9980. ObjDB_Tails_Init:
  9981. addq.b #2,routine(a0) ; => ObjDB_Tails_Wait
  9982. move.w #$B8,x_pos(a0)
  9983. move.w #$1A0,y_pos(a0)
  9984. move.l #ObjDA_MapUnc_7CB6,mappings(a0)
  9985. move.w #make_art_tile(ArtTile_ArtNem_ContinueTails,0,0),art_tile(a0)
  9986. move.b #4,render_flags(a0)
  9987. move.b #2,priority(a0)
  9988. move.b #0,anim(a0)
  9989.  
  9990. ; loc_7C52:
  9991. ObjDB_Tails_Wait:
  9992. tst.b (Ctrl_1_Press).w ; is start pressed?
  9993. bmi.s ObjDB_Tails_StartRunning ; if yes, branch
  9994. lea (Ani_objDB).l,a1
  9995. jmp (AnimateSprite).l
  9996. ; ---------------------------------------------------------------------------
  9997. ; loc_7C64:
  9998. ObjDB_Tails_StartRunning:
  9999. addq.b #2,routine(a0) ; => ObjDB_Tails_Run
  10000. move.l #MapUnc_Tails,mappings(a0)
  10001. move.w #make_art_tile(ArtTile_ArtUnc_Tails,0,0),art_tile(a0)
  10002. move.b #0,anim(a0)
  10003. clr.w inertia(a0)
  10004. move.b #SndID_SpindashRev,d0 ; super peel-out sound
  10005. bsr.w PlaySound
  10006.  
  10007. ; loc_7C88:
  10008. ObjDB_Tails_Run:
  10009. cmpi.w #$720,inertia(a0)
  10010. bne.s +
  10011. move.w #$1000,x_vel(a0)
  10012. bra.s ++
  10013. ; ---------------------------------------------------------------------------
  10014. +
  10015. addi.w #$18,inertia(a0)
  10016. +
  10017. jsr (ObjectMove).l
  10018. jsr (Tails_Animate).l
  10019. jmp (LoadTailsDynPLC).l
  10020. ; ===========================================================================
  10021. ; animation script for continue screen Tails nagging
  10022. ; off_7CB0
  10023. Ani_objDB: offsetTable
  10024. offsetTableEntry.w + ; 0
  10025. + dc.b 9, 2, 3,$FF
  10026. even
  10027. ; -------------------------------------------------------------------------------
  10028. ; Sprite mappings for text, countdown, stars, and Tails on the continue screen
  10029. ; Art starts at $A000 in VRAM
  10030. ; -------------------------------------------------------------------------------
  10031. ObjDA_MapUnc_7CB6: BINCLUDE "mappings/sprite/objDA.bin"
  10032.  
  10033. if ~~removeJmpTos
  10034. JmpTo_Adjust2PArtPointer2
  10035. jmp (Adjust2PArtPointer2).l
  10036. JmpTo_Adjust2PArtPointer
  10037. jmp (Adjust2PArtPointer).l
  10038.  
  10039. align 4
  10040. endif
  10041.  
  10042.  
  10043.  
  10044.  
  10045. ; ===========================================================================
  10046. ; loc_7D50:
  10047. TwoPlayerResults:
  10048. bsr.w Pal_FadeToBlack
  10049. move #$2700,sr
  10050. move.w (VDP_Reg1_val).w,d0
  10051. andi.b #$BF,d0
  10052. move.w d0,(VDP_control_port).l
  10053. bsr.w ClearScreen
  10054. lea (VDP_control_port).l,a6
  10055. move.w #$8004,(a6) ; H-INT disabled
  10056. move.w #$8200|(VRAM_Menu_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  10057. move.w #$8400|(VRAM_Menu_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $E000
  10058. move.w #$8200|(VRAM_Menu_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  10059. move.w #$8700,(a6) ; Background palette/color: 0/0
  10060. move.w #$8C81,(a6) ; H res 40 cells, no interlace, S/H disabled
  10061. move.w #$9001,(a6) ; Scroll table size: 64x32
  10062.  
  10063. clearRAM Sprite_Table_Input,Sprite_Table_Input_End
  10064. clearRAM VSRslts_Object_RAM,VSRslts_Object_RAM_End
  10065.  
  10066. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_FontStuff),VRAM,WRITE),(VDP_control_port).l
  10067. lea (ArtNem_FontStuff).l,a0
  10068. bsr.w NemDec
  10069. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_1P2PWins),VRAM,WRITE),(VDP_control_port).l
  10070. lea (ArtNem_1P2PWins).l,a0
  10071. bsr.w NemDec
  10072. lea (Chunk_Table).l,a1
  10073. lea (MapEng_MenuBack).l,a0
  10074. move.w #make_art_tile(ArtTile_VRAM_Start,3,0),d0
  10075. bsr.w EniDec
  10076. lea (Chunk_Table).l,a1
  10077. move.l #vdpComm(VRAM_Plane_B_Name_Table,VRAM,WRITE),d0
  10078. moveq #$27,d1
  10079. moveq #$1B,d2
  10080. jsrto (PlaneMapToVRAM_H40).l, PlaneMapToVRAM_H40
  10081. move.w (Results_Screen_2P).w,d0
  10082. add.w d0,d0
  10083. add.w d0,d0
  10084. add.w d0,d0
  10085. lea TwoPlayerResultsPointers(pc),a2
  10086. movea.l (a2,d0.w),a0
  10087. movea.l 4(a2,d0.w),a2
  10088. lea (Chunk_Table).l,a1
  10089. move.w #make_art_tile(ArtTile_VRAM_Start,0,0),d0
  10090. bsr.w EniDec
  10091. jsr (a2) ; dynamic call! to Setup2PResults_Act, Setup2PResults_Zone, Setup2PResults_Game, Setup2PResults_SpecialAct, or Setup2PResults_SpecialZone, assuming the pointers in TwoPlayerResultsPointers have not been changed
  10092. lea (Chunk_Table).l,a1
  10093. move.l #vdpComm(tiles_to_bytes(ArtTile_TwoPlayerResults),VRAM,WRITE),d0
  10094. moveq #$27,d1
  10095. moveq #$1B,d2
  10096. jsrto (PlaneMapToVRAM_H40).l, PlaneMapToVRAM_H40
  10097. clr.w (VDP_Command_Buffer).w
  10098. move.l #VDP_Command_Buffer,(VDP_Command_Buffer_Slot).w
  10099. clr.b (Level_started_flag).w
  10100. clr.w (Anim_Counters).w
  10101. lea (Anim_SonicMilesBG).l,a2
  10102. jsrto (Dynamic_Normal).l, JmpTo_Dynamic_Normal
  10103. moveq #PLCID_Std1,d0
  10104. bsr.w LoadPLC2
  10105. moveq #PalID_Menu,d0
  10106. bsr.w PalLoad_ForFade
  10107. moveq #0,d0
  10108. move.b #MusID_2PResult,d0
  10109. cmp.w (Level_Music).w,d0
  10110. beq.s +
  10111. move.w d0,(Level_Music).w
  10112. bsr.w PlayMusic
  10113. +
  10114. move.w #$707,(Demo_Time_left).w
  10115. clr.w (Two_player_mode).w
  10116. clr.l (Camera_X_pos).w
  10117. clr.l (Camera_Y_pos).w
  10118. clr.l (Vscroll_Factor).w
  10119. clr.l (Vscroll_Factor_P2).w
  10120. clr.l (Vscroll_Factor_P2_HInt).w
  10121. move.b #ObjID_HUD,(VSResults_HUD+id).w
  10122. move.b #VintID_Menu,(Vint_routine).w
  10123. bsr.w WaitForVint
  10124. move.w (VDP_Reg1_val).w,d0
  10125. ori.b #$40,d0
  10126. move.w d0,(VDP_control_port).l
  10127. bsr.w Pal_FadeFromBlack
  10128.  
  10129. - move.b #VintID_Menu,(Vint_routine).w
  10130. bsr.w WaitForVint
  10131. lea (Anim_SonicMilesBG).l,a2
  10132. jsrto (Dynamic_Normal).l, JmpTo_Dynamic_Normal
  10133. jsr (RunObjects).l
  10134. jsr (BuildSprites).l
  10135. bsr.w RunPLC_RAM
  10136. tst.l (Plc_Buffer).w
  10137. bne.s -
  10138. move.b (Ctrl_1_Press).w,d0
  10139. or.b (Ctrl_2_Press).w,d0
  10140. andi.b #button_start_mask,d0
  10141. beq.s - ; stay on that screen until either player presses start
  10142.  
  10143. move.w (Results_Screen_2P).w,d0 ; were we at the act results screen? (VsRSID_Act)
  10144. bne.w TwoPlayerResultsDone_Zone ; if not, branch
  10145. tst.b (Current_Act).w ; did we just finish act 1?
  10146. bne.s + ; if not, branch
  10147. addq.b #1,(Current_Act).w ; go to the next act
  10148. move.b #1,(Current_Act_2P).w
  10149. move.b #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
  10150. move.b #0,(Last_star_pole_hit).w
  10151. move.b #0,(Last_star_pole_hit_2P).w
  10152. moveq #1,d0
  10153. move.w d0,(Two_player_mode).w
  10154. move.w d0,(Two_player_mode_copy).w
  10155. moveq #0,d0
  10156. move.l d0,(Score).w
  10157. move.l d0,(Score_2P).w
  10158. move.l #5000,(Next_Extra_life_score).w
  10159. move.l #5000,(Next_Extra_life_score_2P).w
  10160. rts
  10161. ; ===========================================================================
  10162. + ; Displays results for the zone
  10163. move.b #2,(Current_Act_2P).w
  10164. bsr.w sub_84A4
  10165. lea (SS_Total_Won).w,a4
  10166. clr.w (a4)
  10167. bsr.s sub_7F9A
  10168. bsr.s sub_7F9A
  10169. move.b (a4),d1
  10170. sub.b 1(a4),d1
  10171. beq.s + ; if there's a tie, branch
  10172. move.w #VsRSID_Zone,(Results_Screen_2P).w
  10173. move.b #GameModeID_2PResults,(Game_Mode).w ; => TwoPlayerResults
  10174. rts
  10175. ; ===========================================================================
  10176. + ; There's a tie, play a special stage
  10177. move.b (Current_Zone_2P).w,d0
  10178. addq.b #1,d0
  10179. move.b d0,(Current_Special_Stage).w
  10180. move.w #VsRSID_SS,(Results_Screen_2P).w
  10181. move.b #1,(SpecialStage_flag_2P).w
  10182. move.b #GameModeID_SpecialStage,(Game_Mode).w ; => SpecialStage
  10183. moveq #1,d0
  10184. move.w d0,(Two_player_mode).w
  10185. move.w d0,(Two_player_mode_copy).w
  10186. move.b #0,(Last_star_pole_hit).w
  10187. move.b #0,(Last_star_pole_hit_2P).w
  10188. rts
  10189.  
  10190. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10191.  
  10192.  
  10193. sub_7F9A:
  10194. moveq #0,d1
  10195. move.b (a5),d1
  10196. sub.b 1(a5),d1
  10197. beq.s ++
  10198. bcs.s +
  10199. addq.b #1,(a4)
  10200. bra.s ++
  10201. ; ===========================================================================
  10202. +
  10203. addq.b #1,1(a4)
  10204. +
  10205. addq.w #2,a5
  10206. rts
  10207. ; End of function sub_7F9A
  10208.  
  10209. ; ===========================================================================
  10210.  
  10211. ; loc_7FB2:
  10212. TwoPlayerResultsDone_Zone:
  10213. subq.w #1,d0 ; were we at the zone results screen? (VsRSID_Zone)
  10214. bne.s TwoPlayerResultsDone_Game ; if not, branch
  10215.  
  10216. ; loc_7FB6:
  10217. TwoPlayerResultsDone_ZoneOrSpecialStages:
  10218. lea (Results_Data_2P).w,a4
  10219. moveq #0,d0
  10220. moveq #0,d1
  10221. rept 3
  10222. move.w (a4)+,d0
  10223. add.l d0,d1
  10224. move.w (a4)+,d0
  10225. add.l d0,d1
  10226. addq.w #2,a4
  10227. endm
  10228. move.w (a4)+,d0
  10229. add.l d0,d1
  10230. move.w (a4)+,d0
  10231. add.l d0,d1
  10232. swap d1
  10233. tst.w d1 ; have all levels been completed?
  10234. bne.s + ; if not, branch
  10235. move.w #VsRSID_Game,(Results_Screen_2P).w
  10236. move.b #GameModeID_2PResults,(Game_Mode).w ; => TwoPlayerResults
  10237. rts
  10238. ; ===========================================================================
  10239. +
  10240. tst.w (Game_Over_2P).w
  10241. beq.s + ; if there's a Game Over, clear the results
  10242. lea (Results_Data_2P).w,a1
  10243.  
  10244. moveq #bytesToWcnt(Results_Data_2P_End-Results_Data_2P),d0
  10245. - move.w #-1,(a1)+
  10246. dbf d0,-
  10247.  
  10248. move.b #3,(Life_count).w
  10249. move.b #3,(Life_count_2P).w
  10250. +
  10251. move.b #GameModeID_2PLevelSelect,(Game_Mode).w ; => LevelSelectMenu2P
  10252. rts
  10253. ; ===========================================================================
  10254. ; loc_8020:
  10255. TwoPlayerResultsDone_Game:
  10256. subq.w #1,d0 ; were we at the game results screen? (VsRSID_Game)
  10257. bne.s TwoPlayerResultsDone_SpecialStage ; if not, branch
  10258. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  10259. rts
  10260. ; ===========================================================================
  10261. ; loc_802C:
  10262. TwoPlayerResultsDone_SpecialStage:
  10263. subq.w #1,d0 ; were we at the special stage results screen? (VsRSID_SS)
  10264. bne.w TwoPlayerResultsDone_SpecialStages ; if not, branch
  10265. cmpi.b #3,(Current_Zone_2P).w ; do we come from the special stage "zone"?
  10266. beq.s + ; if yes, branch
  10267. move.w #VsRSID_Zone,(Results_Screen_2P).w ; show zone results after tiebreaker special stage
  10268. move.b #GameModeID_2PResults,(Game_Mode).w ; => TwoPlayerResults
  10269. rts
  10270. ; ===========================================================================
  10271. +
  10272. tst.b (Current_Act_2P).w
  10273. beq.s +
  10274. cmpi.b #2,(Current_Act_2P).w
  10275. beq.s loc_80AC
  10276. bsr.w sub_84A4
  10277. lea (SS_Total_Won).w,a4
  10278. clr.w (a4)
  10279. bsr.s sub_8094
  10280. bsr.s sub_8094
  10281. move.b (a4),d1
  10282. sub.b 1(a4),d1
  10283. bne.s loc_80AC
  10284. +
  10285. addq.b #1,(Current_Act_2P).w
  10286. addq.b #1,(Current_Special_Stage).w
  10287. move.w #VsRSID_SS,(Results_Screen_2P).w
  10288. move.b #1,(SpecialStage_flag_2P).w
  10289. move.b #GameModeID_SpecialStage,(Game_Mode).w ; => SpecialStage
  10290. move.w #1,(Two_player_mode).w
  10291. move.w #0,(Level_Music).w
  10292. rts
  10293.  
  10294. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10295.  
  10296.  
  10297. sub_8094:
  10298. moveq #0,d1
  10299. move.b (a5),d1
  10300. sub.b 1(a5),d1
  10301. beq.s ++
  10302. bcs.s +
  10303. addq.b #1,(a4)
  10304. bra.s ++
  10305. ; ===========================================================================
  10306. +
  10307. addq.b #1,1(a4)
  10308. +
  10309. addq.w #2,a5
  10310. rts
  10311. ; End of function sub_8094
  10312.  
  10313. ; ===========================================================================
  10314.  
  10315. loc_80AC:
  10316. move.w #VsRSID_SSZone,(Results_Screen_2P).w
  10317. move.b #GameModeID_2PResults,(Game_Mode).w ; => TwoPlayerResults
  10318. rts
  10319. ; ===========================================================================
  10320. ; loc_80BA: BranchTo_loc_7FB6:
  10321. TwoPlayerResultsDone_SpecialStages:
  10322. ; we were at the special stages results screen (VsRSID_SSZone)
  10323. bra.w TwoPlayerResultsDone_ZoneOrSpecialStages
  10324.  
  10325. ; ===========================================================================
  10326. ; ----------------------------------------------------------------------------
  10327. ; Object 21 - Score/Rings/Time display (in 2P results)
  10328. ; ----------------------------------------------------------------------------
  10329. ; Sprite_80BE:
  10330. Obj21: ; (screen-space obj)
  10331. moveq #0,d0
  10332. move.b routine(a0),d0
  10333. move.w Obj21_Index(pc,d0.w),d1
  10334. jmp Obj21_Index(pc,d1.w)
  10335. ; ===========================================================================
  10336. ; JmpTbl_80CC: Obj21_States:
  10337. Obj21_Index: offsetTable
  10338. offsetTableEntry.w Obj21_Init ; 0
  10339. offsetTableEntry.w Obj21_Main ; 2
  10340. ; ---------------------------------------------------------------------------
  10341. ; word_80D0:
  10342. Obj21_PositionTable:
  10343. ; x, y
  10344. dc.w $F0, $148
  10345. dc.w $F0, $130
  10346. dc.w $E0, $148
  10347. dc.w $F0, $148
  10348. dc.w $F0, $148
  10349. ; ===========================================================================
  10350. ; loc_80E4:
  10351. Obj21_Init:
  10352. addq.b #2,routine(a0) ; => Obj21_Main
  10353. move.w (Results_Screen_2P).w,d0
  10354. add.w d0,d0
  10355. add.w d0,d0
  10356. move.l Obj21_PositionTable(pc,d0.w),x_pixel(a0) ; and y_pixel(a0)
  10357. move.l #Obj21_MapUnc_8146,mappings(a0)
  10358. move.w #make_art_tile(ArtTile_ArtNem_1P2PWins,0,0),art_tile(a0)
  10359. jsrto (Adjust2PArtPointer).l, JmpTo2_Adjust2PArtPointer
  10360. move.b #0,render_flags(a0)
  10361. move.b #0,priority(a0)
  10362. moveq #2,d1
  10363. move.b (SS_Total_Won).w,d0 ; d0 = SS_Total_Won_1P
  10364. sub.b (SS_Total_Won+1).w,d0 ; - SS_Total_Won_2P
  10365. beq.s ++
  10366. bcs.s +
  10367. moveq #0,d1
  10368. bra.s ++
  10369. ; ---------------------------------------------------------------------------
  10370. +
  10371. moveq #1,d1
  10372. +
  10373. move.b d1,mapping_frame(a0)
  10374.  
  10375. ; loc_812C:
  10376. Obj21_Main:
  10377. andi.w #tile_mask,art_tile(a0)
  10378. btst #3,(Vint_runcount+3).w
  10379. beq.s JmpTo4_DisplaySprite
  10380. ori.w #palette_line_1,art_tile(a0)
  10381.  
  10382. JmpTo4_DisplaySprite
  10383. jmp (DisplaySprite).l
  10384. ; ===========================================================================
  10385. ; --------------------------------------------------------------------------
  10386. ; sprite mappings
  10387. ; --------------------------------------------------------------------------
  10388. Obj21_MapUnc_8146: BINCLUDE "mappings/sprite/obj21.bin"
  10389. ; ===========================================================================
  10390.  
  10391. ; loc_819A:
  10392. Setup2PResults_Act:
  10393. move.w #$1F2,d2
  10394. moveq #0,d0
  10395. bsr.w sub_8672
  10396. move.w #$216,d2
  10397. moveq #0,d1
  10398. move.b (Current_Act_2P).w,d1
  10399. addq.b #1,d1
  10400. bsr.w sub_86B0
  10401. move.w #$33E,d2
  10402. move.l (Score).w,d1
  10403. bsr.w sub_86F6
  10404. move.w #$352,d2
  10405. move.l (Score_2P).w,d1
  10406. bsr.w sub_86F6
  10407. move.w #$3DA,d2
  10408. moveq #0,d0
  10409. move.w (Timer_minute_word).w,d1
  10410. bsr.w sub_86B0
  10411. move.w #$3E0,d2
  10412. moveq #0,d1
  10413. move.b (Timer_second).w,d1
  10414. bsr.w sub_86B0
  10415. move.w #$3E6,d2
  10416. moveq #0,d1
  10417. move.b (Timer_frame).w,d1
  10418. mulu.w #$1B0,d1
  10419. lsr.l #8,d1
  10420. bsr.w sub_86B0
  10421. move.w #$3EE,d2
  10422. moveq #0,d0
  10423. move.w (Timer_minute_word_2P).w,d1
  10424. bsr.w sub_86B0
  10425. move.w #$3F4,d2
  10426. moveq #0,d1
  10427. move.b (Timer_second_2P).w,d1
  10428. bsr.w sub_86B0
  10429. move.w #$3FA,d2
  10430. moveq #0,d1
  10431. move.b (Timer_centisecond_2P).w,d1
  10432. mulu.w #$1B0,d1
  10433. lsr.l #8,d1
  10434. bsr.w sub_86B0
  10435. move.w #$486,d2
  10436. moveq #0,d0
  10437. move.w (Ring_count).w,d1
  10438. bsr.w sub_86B0
  10439. move.w #$49A,d2
  10440. move.w (Ring_count_2P).w,d1
  10441. bsr.w sub_86B0
  10442. move.w #$526,d2
  10443. moveq #0,d0
  10444. move.w (Rings_Collected).w,d1
  10445. bsr.w sub_86B0
  10446. move.w #$53A,d2
  10447. move.w (Rings_Collected_2P).w,d1
  10448. bsr.w sub_86B0
  10449. move.w #$5C6,d2
  10450. moveq #0,d0
  10451. move.w (Monitors_Broken).w,d1
  10452. bsr.w sub_86B0
  10453. move.w #$5DA,d2
  10454. move.w (Monitors_Broken_2P).w,d1
  10455. bsr.w sub_86B0
  10456. bsr.w sub_8476
  10457. move.w #$364,d2
  10458. move.w #$6000,d0
  10459. move.l (Score).w,d1
  10460. sub.l (Score_2P).w,d1
  10461. bsr.w sub_8652
  10462. move.w #$404,d2
  10463. move.l (Timer_2P).w,d1
  10464. sub.l (Timer).w,d1
  10465. bsr.w sub_8652
  10466. move.w #$4A4,d2
  10467. moveq #0,d1
  10468. move.w (Ring_count).w,d1
  10469. sub.w (Ring_count_2P).w,d1
  10470. bsr.w sub_8652
  10471. move.w #$544,d2
  10472. moveq #0,d1
  10473. move.w (Rings_Collected).w,d1
  10474. sub.w (Rings_Collected_2P).w,d1
  10475. bsr.w sub_8652
  10476. move.w #$5E4,d2
  10477. moveq #0,d1
  10478. move.w (Monitors_Broken).w,d1
  10479. sub.w (Monitors_Broken_2P).w,d1
  10480. bsr.w sub_8652
  10481. move.w #$706,d2
  10482. moveq #0,d0
  10483. moveq #0,d1
  10484. move.b (a4),d1
  10485. bsr.w sub_86B0
  10486. move.w #$70E,d2
  10487. moveq #0,d1
  10488. move.b 1(a4),d1
  10489. bsr.w sub_86B0
  10490. move.w (a4),(SS_Total_Won).w
  10491. rts
  10492. ; ===========================================================================
  10493. ; loc_82FA:
  10494. Setup2PResults_Zone:
  10495. move.w #$242,d2
  10496. moveq #0,d0
  10497. bsr.w sub_8672
  10498. bsr.w sub_84A4
  10499. lea (SS_Total_Won).w,a4
  10500. clr.w (a4)
  10501. move.w #$398,d6
  10502. bsr.w sub_854A
  10503. move.w #$488,d6
  10504. bsr.w sub_854A
  10505. move.w #$618,d6
  10506. bsr.w sub_854A
  10507. rts
  10508. ; ===========================================================================
  10509. ; loc_8328:
  10510. Setup2PResults_Game:
  10511. lea (Results_Data_2P).w,a5
  10512. lea (SS_Total_Won).w,a4
  10513. clr.w (a4)
  10514. move.w #$208,d6
  10515. bsr.w sub_84C4
  10516. move.w #$258,d6
  10517. bsr.w sub_84C4
  10518. move.w #$2A8,d6
  10519. bsr.w sub_84C4
  10520. move.w #$348,d6
  10521. bsr.w sub_84C4
  10522. move.w #$398,d6
  10523. bsr.w sub_84C4
  10524. move.w #$3E8,d6
  10525. bsr.w sub_84C4
  10526. move.w #$488,d6
  10527. bsr.w sub_84C4
  10528. move.w #$4D8,d6
  10529. bsr.w sub_84C4
  10530. move.w #$528,d6
  10531. bsr.w sub_84C4
  10532. move.w #$5C8,d6
  10533. bsr.w sub_84C4
  10534. move.w #$618,d6
  10535. bsr.w sub_84C4
  10536. move.w #$668,d6
  10537. bsr.w sub_84C4
  10538. move.w #$70A,d2
  10539. moveq #0,d0
  10540. moveq #0,d1
  10541. move.b (a4),d1
  10542. bsr.w sub_86B0
  10543. move.w #$710,d2
  10544. moveq #0,d1
  10545. move.b 1(a4),d1
  10546. bsr.w sub_86B0
  10547. rts
  10548. ; ===========================================================================
  10549. ; loc_83B0:
  10550. Setup2PResults_SpecialAct:
  10551. move.w #$266,d2
  10552. moveq #0,d1
  10553. move.b (Current_Act_2P).w,d1
  10554. addq.b #1,d1
  10555. bsr.w sub_86B0
  10556. move.w #$4D6,d2
  10557. moveq #0,d0
  10558. move.w (SS2p_RingBuffer).w,d1 ; P1 SS act 1 rings
  10559. bsr.w sub_86B0
  10560. move.w #$4E6,d2
  10561. move.w (SS2p_RingBuffer+2).w,d1 ; P2 SS act 1 rings
  10562. bsr.w sub_86B0
  10563. move.w #$576,d2
  10564. moveq #0,d0
  10565. move.w (SS2p_RingBuffer+4).w,d1 ; P1 SS act 2 rings
  10566. bsr.w sub_86B0
  10567. move.w #$586,d2
  10568. move.w (SS2p_RingBuffer+6).w,d1 ; P2 SS act 2 rings
  10569. bsr.w sub_86B0
  10570. move.w #$616,d2
  10571. moveq #0,d0
  10572. move.w (SS2p_RingBuffer+8).w,d1 ; P1 SS act 3 rings
  10573. bsr.w sub_86B0
  10574. move.w #$626,d2
  10575. move.w (SS2p_RingBuffer+$A).w,d1 ; P2 SS act 3 rings
  10576. bsr.w sub_86B0
  10577. bsr.w sub_8476
  10578. move.w #$6000,d0
  10579. move.w #$4F0,d2
  10580. moveq #0,d1
  10581. move.w (SS2p_RingBuffer).w,d1 ; P1 SS act 1 rings
  10582. sub.w (SS2p_RingBuffer+2).w,d1 ; P2 SS act 1 rings
  10583. bsr.w sub_8652
  10584. move.w #$590,d2
  10585. moveq #0,d1
  10586. move.w (SS2p_RingBuffer+4).w,d1 ; P1 SS act 2 rings
  10587. sub.w (SS2p_RingBuffer+6).w,d1 ; P2 SS act 2 rings
  10588. bsr.w sub_8652
  10589. move.w #$630,d2
  10590. moveq #0,d1
  10591. move.w (SS2p_RingBuffer+8).w,d1 ; P1 SS act 3 rings
  10592. sub.w (SS2p_RingBuffer+$A).w,d1 ; P2 SS act 3 rings
  10593. bsr.w sub_8652
  10594. move.w (a4),(SS_Total_Won).w
  10595. rts
  10596. ; ===========================================================================
  10597. ; loc_8452:
  10598. Setup2PResults_SpecialZone:
  10599. bsr.w sub_84A4
  10600. lea (SS_Total_Won).w,a4
  10601. clr.w (a4)
  10602. move.w #$4D4,d6
  10603. bsr.w sub_85CE
  10604. move.w #$574,d6
  10605. bsr.w sub_85CE
  10606. move.w #$614,d6
  10607. bsr.w sub_85CE
  10608. rts
  10609.  
  10610. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10611.  
  10612.  
  10613. sub_8476:
  10614. lea (EHZ_Results_2P).w,a4
  10615. move.b (Current_Zone_2P).w,d0
  10616. beq.s +
  10617. lea (MCZ_Results_2P).w,a4
  10618. subq.b #1,d0
  10619. beq.s +
  10620. lea (CNZ_Results_2P).w,a4
  10621. subq.b #1,d0
  10622. beq.s +
  10623. lea (SS_Results_2P).w,a4
  10624. +
  10625. moveq #0,d0
  10626. move.b (Current_Act_2P).w,d0
  10627. add.w d0,d0
  10628. lea (a4,d0.w),a4
  10629. clr.w (a4)
  10630. rts
  10631. ; End of function sub_8476
  10632.  
  10633.  
  10634. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10635.  
  10636.  
  10637. sub_84A4:
  10638. lea (EHZ_Results_2P).w,a5
  10639. move.b (Current_Zone_2P).w,d0
  10640. beq.s + ; rts
  10641. lea (MCZ_Results_2P).w,a5
  10642. subq.b #1,d0
  10643. beq.s + ; rts
  10644. lea (CNZ_Results_2P).w,a5
  10645. subq.b #1,d0
  10646. beq.s + ; rts
  10647. lea (SS_Results_2P).w,a5
  10648. +
  10649. rts
  10650. ; End of function sub_84A4
  10651.  
  10652.  
  10653. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10654.  
  10655.  
  10656. sub_84C4:
  10657. move.w (a5),d0
  10658. bmi.s +
  10659. move.w d6,d2
  10660. moveq #0,d0
  10661. moveq #0,d1
  10662. move.b (a5),d1
  10663. bsr.w sub_86B0
  10664. addq.w #8,d6
  10665. move.w d6,d2
  10666. moveq #0,d1
  10667. move.b 1(a5),d1
  10668. bsr.w sub_86B0
  10669. addi.w #$12,d6
  10670. move.w d6,d2
  10671. move.w #$6000,d0
  10672. moveq #0,d1
  10673. move.b (a5),d1
  10674. sub.b 1(a5),d1
  10675. bsr.w sub_8652
  10676. addq.w #2,a5
  10677. rts
  10678. ; ===========================================================================
  10679. +
  10680. addq.w #4,d6
  10681. not.w d0
  10682. bne.s +
  10683. lea (Text2P_NoGame).l,a1
  10684. move.w d6,d2
  10685. bsr.w loc_8698
  10686. addi.w #$16,d6
  10687. move.w d6,d2
  10688. lea (Text2P_Blank).l,a1
  10689. bsr.w loc_8698
  10690. addq.w #2,a5
  10691. rts
  10692. ; ===========================================================================
  10693. +
  10694. moveq #0,d0
  10695. lea (Text2P_GameOver).l,a1
  10696. move.w d6,d2
  10697. bsr.w loc_8698
  10698. addi.w #$16,d6
  10699. move.w d6,d2
  10700. move.w #$6000,d0
  10701. moveq #0,d1
  10702. move.b (a5),d1
  10703. sub.b 1(a5),d1
  10704. bsr.w sub_8652
  10705. addq.w #2,a5
  10706. rts
  10707. ; End of function sub_84C4
  10708.  
  10709.  
  10710. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10711.  
  10712.  
  10713. sub_854A:
  10714. move.w (a5),d0
  10715. bmi.s loc_8582
  10716. move.w d6,d2
  10717. moveq #0,d0
  10718. moveq #0,d1
  10719. move.b (a5),d1
  10720. bsr.w sub_86B0
  10721. addq.w #8,d6
  10722. move.w d6,d2
  10723. moveq #0,d1
  10724. move.b 1(a5),d1
  10725. bsr.w sub_86B0
  10726. addi.w #$C,d6
  10727. move.w d6,d2
  10728. move.w #$6000,d0
  10729. moveq #0,d1
  10730. move.b (a5),d1
  10731. sub.b 1(a5),d1
  10732. bsr.w sub_8652
  10733. addq.w #2,a5
  10734. rts
  10735. ; ===========================================================================
  10736.  
  10737. loc_8582:
  10738. not.w d0
  10739. bne.s loc_85A6
  10740. lea (Text2P_NoGame).l,a1
  10741. move.w d6,d2
  10742. bsr.w loc_8698
  10743. addi.w #$14,d6
  10744. move.w d6,d2
  10745. lea (Text2P_Blank).l,a1
  10746. bsr.w loc_8698
  10747. addq.w #2,a5
  10748. rts
  10749. ; ===========================================================================
  10750.  
  10751. loc_85A6:
  10752. moveq #0,d0
  10753. lea (Text2P_GameOver).l,a1
  10754. move.w d6,d2
  10755. bsr.w loc_8698
  10756. addi.w #$14,d6
  10757. move.w d6,d2
  10758. move.w #$6000,d0
  10759. moveq #0,d1
  10760. move.b (a5),d1
  10761. sub.b 1(a5),d1
  10762. bsr.w sub_8652
  10763. addq.w #2,a5
  10764. rts
  10765. ; End of function sub_854A
  10766.  
  10767.  
  10768. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10769.  
  10770.  
  10771. sub_85CE:
  10772. move.w (a5),d0
  10773. bmi.s +
  10774. move.w d6,d2
  10775. moveq #0,d0
  10776. moveq #0,d1
  10777. move.b (a5),d1
  10778. bsr.w sub_86B0
  10779. addi.w #$C,d6
  10780. move.w d6,d2
  10781. moveq #0,d1
  10782. move.b 1(a5),d1
  10783. bsr.w sub_86B0
  10784. addi.w #$10,d6
  10785. move.w d6,d2
  10786. move.w #$6000,d0
  10787. moveq #0,d1
  10788. move.b (a5),d1
  10789. sub.b 1(a5),d1
  10790. bsr.w sub_8652
  10791. addq.w #2,a5
  10792. rts
  10793. ; ===========================================================================
  10794. +
  10795. not.w d0
  10796. bne.s loc_862C
  10797. lea (Text2P_NoGame).l,a1
  10798. move.w d6,d2
  10799. addq.w #4,d2
  10800. bsr.w loc_8698
  10801. addi.w #$14,d6
  10802. move.w d6,d2
  10803. lea (Text2P_Blank).l,a1
  10804. bsr.s loc_8698
  10805. addq.w #2,a5
  10806. rts
  10807. ; ===========================================================================
  10808.  
  10809. loc_862C:
  10810. moveq #0,d0
  10811. lea (Text2P_GameOver).l,a1
  10812. move.w d6,d2
  10813. bsr.s loc_8698
  10814. addi.w #$14,d6
  10815. move.w d6,d2
  10816. move.w #$6000,d0
  10817. moveq #0,d1
  10818. move.b (a5),d1
  10819. sub.b 1(a5),d1
  10820. bsr.w sub_8652
  10821. addq.w #2,a5
  10822. rts
  10823. ; End of function sub_85CE
  10824.  
  10825.  
  10826. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10827.  
  10828.  
  10829. sub_8652:
  10830. lea (Text2P_Tied).l,a1
  10831. beq.s ++
  10832. bcs.s +
  10833. lea (Text2P_1P).l,a1
  10834. addq.b #1,(a4)
  10835. bra.s ++
  10836. ; ===========================================================================
  10837. +
  10838. lea (Text2P_2P).l,a1
  10839. addq.b #1,1(a4)
  10840. +
  10841. bra.s loc_8698
  10842. ; End of function sub_8652
  10843.  
  10844.  
  10845. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10846.  
  10847.  
  10848. sub_8672:
  10849. lea (Text2P_EmeraldHill).l,a1
  10850. move.b (Current_Zone_2P).w,d1
  10851. beq.s loc_8698
  10852. lea (Text2P_MysticCave).l,a1
  10853. subq.b #1,d1
  10854. beq.s loc_8698
  10855. lea (Text2P_CasinoNight).l,a1
  10856. subq.b #1,d1
  10857. beq.s loc_8698
  10858. lea (Text2P_SpecialStage).l,a1
  10859.  
  10860. loc_8698:
  10861. lea (Chunk_Table).l,a2
  10862. lea (a2,d2.w),a2
  10863. moveq #0,d1
  10864.  
  10865. move.b (a1)+,d1
  10866. - move.b (a1)+,d0
  10867. move.w d0,(a2)+
  10868. dbf d1,-
  10869.  
  10870. rts
  10871. ; End of function sub_8672
  10872.  
  10873.  
  10874. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10875.  
  10876.  
  10877. sub_86B0:
  10878. lea (Chunk_Table).l,a2
  10879. lea (a2,d2.w),a2
  10880. lea (word_86F0).l,a3
  10881. moveq #0,d2
  10882.  
  10883. moveq #2,d5
  10884. - moveq #0,d3
  10885. move.w (a3)+,d4
  10886.  
  10887. - sub.w d4,d1
  10888. bcs.s +
  10889. addq.w #1,d3
  10890. bra.s -
  10891. ; ---------------------------------------------------------------------------
  10892. +
  10893. add.w d4,d1
  10894. tst.w d5
  10895. beq.s ++
  10896. tst.w d3
  10897. beq.s +
  10898. moveq #1,d2
  10899. +
  10900. tst.w d2
  10901. beq.s ++
  10902. +
  10903. addi.b #$10,d3
  10904. move.b d3,d0
  10905. move.w d0,(a2)
  10906. +
  10907. addq.w #2,a2
  10908. dbf d5,--
  10909.  
  10910. rts
  10911. ; End of function sub_86B0
  10912.  
  10913. ; ===========================================================================
  10914. word_86F0:
  10915. dc.w 100
  10916. dc.w 10 ; 1
  10917. dc.w 1 ; 2
  10918.  
  10919. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  10920.  
  10921.  
  10922. sub_86F6:
  10923. lea (Chunk_Table).l,a2
  10924. lea (a2,d2.w),a2
  10925. lea (dword_8732).l,a3
  10926. moveq #0,d2
  10927.  
  10928. moveq #5,d5
  10929. - moveq #0,d3
  10930. move.l (a3)+,d4
  10931.  
  10932. - sub.l d4,d1
  10933. bcs.s +
  10934. addq.w #1,d3
  10935. bra.s -
  10936. ; ===========================================================================
  10937. +
  10938. add.l d4,d1
  10939. tst.w d3
  10940. beq.s +
  10941. moveq #1,d2
  10942. +
  10943. tst.w d2
  10944. beq.s +
  10945. addi.b #$10,d3
  10946. move.b d3,d0
  10947. move.w d0,(a2)
  10948. +
  10949. addq.w #2,a2
  10950. dbf d5,--
  10951.  
  10952. rts
  10953. ; End of function sub_86F6
  10954.  
  10955. ; ===========================================================================
  10956. dword_8732:
  10957. dc.l 100000
  10958. dc.l 10000
  10959. dc.l 1000
  10960. dc.l 100
  10961. dc.l 10
  10962. dc.l 1
  10963.  
  10964. ; set the character set for menu text
  10965. charset '@',"\27\30\31\32\33\34\35\36\37\38\39\40\41\42\43\44\45\46\47\48\49\50\51\52\53\54\55"
  10966. charset '0',"\16\17\18\19\20\21\22\23\24\25"
  10967. charset '*',$1A
  10968. charset ':',$1C
  10969. charset '.',$1D
  10970. charset ' ',0
  10971.  
  10972. ; Menu text
  10973. menutxt macro text
  10974. dc.b strlen(text)-1
  10975. dc.b text
  10976. endm
  10977. Text2P_EmeraldHill: menutxt "EMERALD HILL" ; byte_874A:
  10978. rev02even
  10979. Text2P_MysticCave: menutxt " MYSTIC CAVE" ; byte_8757:
  10980. rev02even
  10981. Text2P_CasinoNight: menutxt "CASINO NIGHT" ; byte_8764:
  10982. rev02even
  10983. Text2P_SpecialStage: menutxt "SPECIAL STAGE" ; byte_8771:
  10984. rev02even
  10985. Text2P_Special: menutxt " SPECIAL " ; byte_877F:
  10986. rev02even
  10987. Text2P_Zone: menutxt "ZONE " ; byte_878C:
  10988. rev02even
  10989. Text2P_Stage: menutxt "STAGE" ; byte_8792:
  10990. rev02even
  10991. Text2P_GameOver: menutxt "GAME OVER" ; byte_8798:
  10992. rev02even
  10993. Text2P_TimeOver: menutxt "TIME OVER"
  10994. rev02even
  10995. Text2P_NoGame: menutxt "NO GAME" ; byte_87AC:
  10996. rev02even
  10997. Text2P_Tied: menutxt "TIED" ; byte_87B4:
  10998. rev02even
  10999. Text2P_1P: menutxt " 1P" ; byte_87B9:
  11000. rev02even
  11001. Text2P_2P: menutxt " 2P" ; byte_87BD:
  11002. rev02even
  11003. Text2P_Blank: menutxt " " ; byte_87C1:
  11004. rev02even
  11005.  
  11006. charset ; reset character set
  11007.  
  11008. ; ------------------------------------------------------------------------
  11009. ; MENU ANIMATION SCRIPT
  11010. ; ------------------------------------------------------------------------
  11011. ;word_87C6:
  11012. Anim_SonicMilesBG: zoneanimstart
  11013. ; Sonic/Miles animated background
  11014. zoneanimdecl -1, ArtUnc_MenuBack, 1, 6, $A
  11015. dc.b 0,$C7
  11016. dc.b $A, 5
  11017. dc.b $14, 5
  11018. dc.b $1E,$C7
  11019. dc.b $14, 5
  11020. dc.b $A, 5
  11021. even
  11022.  
  11023. zoneanimend
  11024.  
  11025. ; off_87DC:
  11026. TwoPlayerResultsPointers:
  11027. VsResultsScreen_Act: dc.l Map_2PActResults, Setup2PResults_Act
  11028. VsResultsScreen_Zone: dc.l Map_2PZoneResults, Setup2PResults_Zone
  11029. VsResultsScreen_Game: dc.l Map_2PGameResults, Setup2PResults_Game
  11030. VsResultsScreen_SS: dc.l Map_2PSpecialStageActResults, Setup2PResults_SpecialAct
  11031. VsResultsScreen_SSZone: dc.l Map_2PSpecialStageZoneResults, Setup2PResults_SpecialZone
  11032.  
  11033. ; 2P single act results screen (enigma compressed)
  11034. ; byte_8804:
  11035. Map_2PActResults: BINCLUDE "mappings/misc/2P Act Results.bin"
  11036.  
  11037. ; 2P zone results screen (enigma compressed)
  11038. ; byte_88CE:
  11039. Map_2PZoneResults: BINCLUDE "mappings/misc/2P Zone Results.bin"
  11040.  
  11041. ; 2P game results screen (after all 4 zones) (enigma compressed)
  11042. ; byte_8960:
  11043. Map_2PGameResults: BINCLUDE "mappings/misc/2P Game Results.bin"
  11044.  
  11045. ; 2P special stage act results screen (enigma compressed)
  11046. ; byte_8AA4:
  11047. Map_2PSpecialStageActResults: BINCLUDE "mappings/misc/2P Special Stage Act Results.bin"
  11048.  
  11049. ; 2P special stage zone results screen (enigma compressed)
  11050. ; byte_8B30:
  11051. Map_2PSpecialStageZoneResults: BINCLUDE "mappings/misc/2P Special Stage Zone Results.bin"
  11052.  
  11053. even
  11054.  
  11055. if ~~removeJmpTos
  11056. JmpTo2_Adjust2PArtPointer
  11057. jmp (Adjust2PArtPointer).l
  11058. JmpTo_Dynamic_Normal
  11059. jmp (Dynamic_Normal).l
  11060.  
  11061. align 4
  11062. endif
  11063.  
  11064.  
  11065.  
  11066.  
  11067. ; ===========================================================================
  11068. ; loc_8BD4:
  11069. MenuScreen:
  11070. bsr.w Pal_FadeToBlack
  11071. move #$2700,sr
  11072. move.w (VDP_Reg1_val).w,d0
  11073. andi.b #$BF,d0
  11074. move.w d0,(VDP_control_port).l
  11075. bsr.w ClearScreen
  11076. lea (VDP_control_port).l,a6
  11077. move.w #$8004,(a6) ; H-INT disabled
  11078. move.w #$8200|(VRAM_Menu_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  11079. move.w #$8400|(VRAM_Menu_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $E000
  11080. move.w #$8200|(VRAM_Menu_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  11081. move.w #$8700,(a6) ; Background palette/color: 0/0
  11082. move.w #$8C81,(a6) ; H res 40 cells, no interlace, S/H disabled
  11083. move.w #$9001,(a6) ; Scroll table size: 64x32
  11084.  
  11085. clearRAM Sprite_Table_Input,Sprite_Table_Input_End
  11086. clearRAM Menus_Object_RAM,Menus_Object_RAM_End
  11087.  
  11088. ; load background + graphics of font/LevSelPics
  11089. clr.w (VDP_Command_Buffer).w
  11090. move.l #VDP_Command_Buffer,(VDP_Command_Buffer_Slot).w
  11091. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_FontStuff),VRAM,WRITE),(VDP_control_port).l
  11092. lea (ArtNem_FontStuff).l,a0
  11093. bsr.w NemDec
  11094. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_MenuBox),VRAM,WRITE),(VDP_control_port).l
  11095. lea (ArtNem_MenuBox).l,a0
  11096. bsr.w NemDec
  11097. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_LevelSelectPics),VRAM,WRITE),(VDP_control_port).l
  11098. lea (ArtNem_LevelSelectPics).l,a0
  11099. bsr.w NemDec
  11100. lea (Chunk_Table).l,a1
  11101. lea (MapEng_MenuBack).l,a0
  11102. move.w #make_art_tile(ArtTile_VRAM_Start,3,0),d0
  11103. bsr.w EniDec
  11104. lea (Chunk_Table).l,a1
  11105. move.l #vdpComm(VRAM_Plane_B_Name_Table,VRAM,WRITE),d0
  11106. moveq #$27,d1
  11107. moveq #$1B,d2
  11108. jsrto (PlaneMapToVRAM_H40).l, JmpTo_PlaneMapToVRAM_H40 ; fullscreen background
  11109.  
  11110. cmpi.b #GameModeID_OptionsMenu,(Game_Mode).w ; options menu?
  11111. beq.w MenuScreen_Options ; if yes, branch
  11112.  
  11113. cmpi.b #GameModeID_LevelSelect,(Game_Mode).w ; level select menu?
  11114. beq.w MenuScreen_LevelSelect ; if yes, branch
  11115.  
  11116. ;MenuScreen_LevSel2P:
  11117. lea (Chunk_Table).l,a1
  11118. lea (MapEng_LevSel2P).l,a0
  11119. move.w #make_art_tile(ArtTile_ArtNem_MenuBox,0,0),d0
  11120. bsr.w EniDec
  11121. lea (Chunk_Table+$198).l,a1
  11122. lea (MapEng_LevSel2P).l,a0
  11123. move.w #make_art_tile(ArtTile_ArtNem_MenuBox,1,0),d0
  11124. bsr.w EniDec
  11125. lea (Chunk_Table+$330).l,a1
  11126. lea (MapEng_LevSelIcon).l,a0
  11127. move.w #make_art_tile(ArtTile_ArtNem_LevelSelectPics,0,0),d0
  11128. bsr.w EniDec
  11129. lea (Chunk_Table+$498).l,a2
  11130.  
  11131. moveq #$F,d1
  11132. - move.w #$207B,(a2)+
  11133. dbf d1,-
  11134.  
  11135. bsr.w Update2PLevSelSelection
  11136. addq.b #1,(Current_Zone_2P).w
  11137. andi.b #3,(Current_Zone_2P).w
  11138. bsr.w ClearOld2PLevSelSelection
  11139. addq.b #1,(Current_Zone_2P).w
  11140. andi.b #3,(Current_Zone_2P).w
  11141. bsr.w ClearOld2PLevSelSelection
  11142. addq.b #1,(Current_Zone_2P).w
  11143. andi.b #3,(Current_Zone_2P).w
  11144. bsr.w ClearOld2PLevSelSelection
  11145. addq.b #1,(Current_Zone_2P).w
  11146. andi.b #3,(Current_Zone_2P).w
  11147. clr.w (Player_mode).w
  11148. clr.b (Current_Act_2P).w
  11149. clr.w (Results_Screen_2P).w ; VsRSID_Act
  11150. clr.b (Level_started_flag).w
  11151. clr.w (Anim_Counters).w
  11152. clr.w (Game_Over_2P).w
  11153. lea (Anim_SonicMilesBG).l,a2
  11154. jsrto (Dynamic_Normal).l, JmpTo2_Dynamic_Normal
  11155. moveq #PalID_Menu,d0
  11156. bsr.w PalLoad_ForFade
  11157. lea (Normal_palette_line3).w,a1
  11158. lea (Target_palette_line3).w,a2
  11159.  
  11160. moveq #bytesToLcnt($20),d1
  11161. - move.l (a1),(a2)+
  11162. clr.l (a1)+
  11163. dbf d1,-
  11164.  
  11165. move.b #MusID_Options,d0
  11166. jsrto (PlayMusic).l, JmpTo_PlayMusic
  11167. move.w #$707,(Demo_Time_left).w
  11168. clr.w (Two_player_mode).w
  11169. clr.l (Camera_X_pos).w
  11170. clr.l (Camera_Y_pos).w
  11171. move.b #VintID_Menu,(Vint_routine).w
  11172. bsr.w WaitForVint
  11173. move.w (VDP_Reg1_val).w,d0
  11174. ori.b #$40,d0
  11175. move.w d0,(VDP_control_port).l
  11176. bsr.w Pal_FadeFromBlack
  11177.  
  11178. ;loc_8DA8:
  11179. LevelSelect2P_Main:
  11180. move.b #VintID_Menu,(Vint_routine).w
  11181. bsr.w WaitForVint
  11182. move #$2700,sr
  11183. bsr.w ClearOld2PLevSelSelection
  11184. bsr.w LevelSelect2P_Controls
  11185. bsr.w Update2PLevSelSelection
  11186. move #$2300,sr
  11187. lea (Anim_SonicMilesBG).l,a2
  11188. jsrto (Dynamic_Normal).l, JmpTo2_Dynamic_Normal
  11189. move.b (Ctrl_1_Press).w,d0
  11190. or.b (Ctrl_2_Press).w,d0
  11191. andi.b #button_start_mask,d0
  11192. bne.s LevelSelect2P_PressStart
  11193. bra.w LevelSelect2P_Main
  11194. ; ===========================================================================
  11195. ;loc_8DE2:
  11196. LevelSelect2P_PressStart:
  11197. bsr.w Chk2PZoneCompletion
  11198. bmi.s loc_8DF4
  11199. move.w #SndID_Error,d0
  11200. jsrto (PlaySound).l, JmpTo_PlaySound
  11201. bra.w LevelSelect2P_Main
  11202. ; ===========================================================================
  11203.  
  11204. loc_8DF4:
  11205. moveq #0,d0
  11206. move.b (Current_Zone_2P).w,d0
  11207. add.w d0,d0
  11208. move.w LevelSelect2P_LevelOrder(pc,d0.w),d0
  11209. bmi.s loc_8E3A
  11210. move.w d0,(Current_ZoneAndAct).w
  11211. move.w #1,(Two_player_mode).w
  11212. move.b #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
  11213. move.b #0,(Last_star_pole_hit).w
  11214. move.b #0,(Last_star_pole_hit_2P).w
  11215. moveq #0,d0
  11216. move.l d0,(Score).w
  11217. move.l d0,(Score_2P).w
  11218. move.l #5000,(Next_Extra_life_score).w
  11219. move.l #5000,(Next_Extra_life_score_2P).w
  11220. rts
  11221. ; ===========================================================================
  11222.  
  11223. loc_8E3A:
  11224. move.b #4,(Current_Special_Stage).w
  11225. move.b #GameModeID_SpecialStage,(Game_Mode).w ; => SpecialStage
  11226. moveq #1,d0
  11227. move.w d0,(Two_player_mode).w
  11228. move.w d0,(Two_player_mode_copy).w
  11229. rts
  11230. ; ===========================================================================
  11231. ; word_8E52:
  11232. LevelSelect2P_LevelOrder:
  11233. dc.w emerald_hill_zone_act_1
  11234. dc.w mystic_cave_zone_act_1
  11235. dc.w casino_night_zone_act_1
  11236. dc.w $FFFF
  11237.  
  11238. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  11239.  
  11240. ;sub_8E5A:
  11241. LevelSelect2P_Controls:
  11242. move.b (Ctrl_1_Press).w,d0
  11243. or.b (Ctrl_2_Press).w,d0
  11244. move.b d0,d1
  11245. andi.b #button_up_mask|button_down_mask,d0
  11246. beq.s +
  11247. bchg #1,(Current_Zone_2P).w
  11248.  
  11249. +
  11250. andi.b #button_left_mask|button_right_mask,d1
  11251. beq.s + ; rts
  11252. bchg #0,(Current_Zone_2P).w
  11253. +
  11254. rts
  11255. ; End of function LevelSelect2P_Controls
  11256.  
  11257. ; ---------------------------------------------------------------------------
  11258. ; Subroutine to update the 2P level select selection graphically
  11259. ; ---------------------------------------------------------------------------
  11260.  
  11261. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  11262.  
  11263. ; sub_8E7E:
  11264. Update2PLevSelSelection:
  11265. moveq #0,d0
  11266. move.b (Current_Zone_2P).w,d0
  11267. lsl.w #4,d0 ; 16 bytes per entry
  11268. lea (LevSel2PIconData).l,a3
  11269. lea (a3,d0.w),a3
  11270. move.w #$6000,d0 ; highlight text
  11271. lea (Chunk_Table+$48).l,a2
  11272. movea.l (a3)+,a1
  11273. bsr.w MenuScreenTextToRAM
  11274. lea (Chunk_Table+$94).l,a2
  11275. movea.l (a3)+,a1
  11276. bsr.w MenuScreenTextToRAM
  11277. lea (Chunk_Table+$D8).l,a2
  11278. movea.l 4(a3),a1
  11279. bsr.w Chk2PZoneCompletion ; has the zone been completed?
  11280. bmi.s + ; if not, branch
  11281. lea (Chunk_Table+$468).l,a1 ; display large X instead of icon
  11282. +
  11283. moveq #2,d1
  11284. - move.l (a1)+,(a2)+
  11285. move.l (a1)+,(a2)+
  11286. lea $1A(a2),a2
  11287. dbf d1,-
  11288.  
  11289. lea (Chunk_Table).l,a1
  11290. move.l (a3)+,d0
  11291. moveq #$10,d1
  11292. moveq #$B,d2
  11293. jsrto (PlaneMapToVRAM_H40).l, JmpTo_PlaneMapToVRAM_H40
  11294. lea (Pal_LevelIcons).l,a1
  11295. moveq #0,d0
  11296. move.b (a3),d0
  11297. lsl.w #5,d0
  11298. lea (a1,d0.w),a1
  11299. lea (Normal_palette_line3).w,a2
  11300.  
  11301. moveq #bytesToLcnt(palette_line_size),d1
  11302. - move.l (a1)+,(a2)+
  11303. dbf d1,-
  11304.  
  11305. rts
  11306. ; End of function Update2PLevSelSelection
  11307.  
  11308. ; ---------------------------------------------------------------------------
  11309. ; Subroutine to check if a 2P zone has been completed
  11310. ; ---------------------------------------------------------------------------
  11311.  
  11312. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  11313.  
  11314. ; sub_8EFE:
  11315. Chk2PZoneCompletion:
  11316. moveq #0,d0
  11317. move.b (Current_Zone_2P).w,d0
  11318. ; multiply d0 by 6
  11319. move.w d0,d1
  11320. add.w d0,d0
  11321. add.w d1,d0
  11322. add.w d0,d0
  11323. lea (Results_Data_2P).w,a5
  11324. lea (a5,d0.w),a5
  11325. move.w (a5),d0
  11326. add.w 2(a5),d0
  11327. rts
  11328. ; End of function Chk2PZoneCompletion
  11329.  
  11330. ; ---------------------------------------------------------------------------
  11331. ; Subroutine to clear the old 2P level select selection
  11332. ; ---------------------------------------------------------------------------
  11333.  
  11334. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  11335.  
  11336. ; sub_8F1C:
  11337. ClearOld2PLevSelSelection:
  11338. moveq #0,d0
  11339. move.b (Current_Zone_2P).w,d0
  11340. lsl.w #4,d0
  11341. lea (LevSel2PIconData).l,a3
  11342. lea (a3,d0.w),a3
  11343. moveq #0,d0
  11344. lea (Chunk_Table+$1E0).l,a2
  11345. movea.l (a3)+,a1
  11346. bsr.w MenuScreenTextToRAM
  11347. lea (Chunk_Table+$22C).l,a2
  11348. movea.l (a3)+,a1
  11349. bsr.w MenuScreenTextToRAM
  11350. lea (Chunk_Table+$270).l,a2
  11351. lea (Chunk_Table+$498).l,a1
  11352. bsr.w Chk2PZoneCompletion
  11353. bmi.s +
  11354. lea (Chunk_Table+$468).l,a1
  11355. +
  11356. moveq #2,d1
  11357. - move.l (a1)+,(a2)+
  11358. move.l (a1)+,(a2)+
  11359. lea $1A(a2),a2
  11360. dbf d1,-
  11361.  
  11362. lea (Chunk_Table+$198).l,a1
  11363. move.l (a3)+,d0
  11364. moveq #$10,d1
  11365. moveq #$B,d2
  11366. jmpto (PlaneMapToVRAM_H40).l, JmpTo_PlaneMapToVRAM_H40
  11367. ; End of function ClearOld2PLevSelSelection
  11368.  
  11369. ; ===========================================================================
  11370. ; off_8F7E:
  11371. LevSel2PIconData:
  11372.  
  11373. ; macro to declare icon data for a 2P level select icon
  11374. iconData macro txtlabel,txtlabel2,vramAddr,iconPal,iconAddr
  11375. dc.l txtlabel, txtlabel2 ; text locations
  11376. dc.l vdpComm(vramAddr,VRAM,WRITE) ; VRAM location to place data
  11377. dc.l iconPal<<24|iconAddr ; icon palette and plane data location
  11378. endm
  11379.  
  11380. iconData Text2P_EmeraldHill,Text2P_Zone,VRAM_Plane_A_Name_Table+planeLocH40(2,2),0,$FF0330
  11381. iconData Text2P_MysticCave,Text2P_Zone,VRAM_Plane_A_Name_Table+planeLocH40(22,2),5,$FF03A8
  11382. iconData Text2P_CasinoNight,Text2P_Zone,VRAM_Plane_A_Name_Table+planeLocH40(2,15),6,$FF03C0
  11383. iconData Text2P_Special,Text2P_Stage,VRAM_Plane_A_Name_Table+planeLocH40(22,15),$C,$FF0450
  11384.  
  11385. ; ---------------------------------------------------------------------------
  11386. ; Common menu screen subroutine for transferring text to RAM
  11387.  
  11388. ; ARGUMENTS:
  11389. ; d0 = starting art tile
  11390. ; a1 = data source
  11391. ; a2 = destination
  11392. ; ---------------------------------------------------------------------------
  11393.  
  11394. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  11395.  
  11396. ; sub_8FBE:
  11397. MenuScreenTextToRAM:
  11398. moveq #0,d1
  11399. move.b (a1)+,d1
  11400. - move.b (a1)+,d0
  11401. move.w d0,(a2)+
  11402. dbf d1,-
  11403. rts
  11404. ; End of function MenuScreenTextToRAM
  11405.  
  11406. ; ===========================================================================
  11407. ; loc_8FCC:
  11408. MenuScreen_Options:
  11409. lea (Chunk_Table).l,a1
  11410. lea (MapEng_Options).l,a0
  11411. move.w #make_art_tile(ArtTile_ArtNem_MenuBox,0,0),d0
  11412. bsr.w EniDec
  11413. lea (Chunk_Table+$160).l,a1
  11414. lea (MapEng_Options).l,a0
  11415. move.w #make_art_tile(ArtTile_ArtNem_MenuBox,1,0),d0
  11416. bsr.w EniDec
  11417. clr.b (Options_menu_box).w
  11418. bsr.w OptionScreen_DrawSelected
  11419. addq.b #1,(Options_menu_box).w
  11420. bsr.w OptionScreen_DrawUnselected
  11421. addq.b #1,(Options_menu_box).w
  11422. bsr.w OptionScreen_DrawUnselected
  11423. clr.b (Options_menu_box).w
  11424. clr.b (Level_started_flag).w
  11425. clr.w (Anim_Counters).w
  11426. lea (Anim_SonicMilesBG).l,a2
  11427. jsrto (Dynamic_Normal).l, JmpTo2_Dynamic_Normal
  11428. moveq #PalID_Menu,d0
  11429. bsr.w PalLoad_ForFade
  11430. move.b #MusID_Options,d0
  11431. jsrto (PlayMusic).l, JmpTo_PlayMusic
  11432. clr.w (Two_player_mode).w
  11433. clr.l (Camera_X_pos).w
  11434. clr.l (Camera_Y_pos).w
  11435. clr.w (Correct_cheat_entries).w
  11436. clr.w (Correct_cheat_entries_2).w
  11437. move.b #VintID_Menu,(Vint_routine).w
  11438. bsr.w WaitForVint
  11439. move.w (VDP_Reg1_val).w,d0
  11440. ori.b #$40,d0
  11441. move.w d0,(VDP_control_port).l
  11442. bsr.w Pal_FadeFromBlack
  11443. ; loc_9060:
  11444. OptionScreen_Main:
  11445. move.b #VintID_Menu,(Vint_routine).w
  11446. bsr.w WaitForVint
  11447. move #$2700,sr
  11448. bsr.w OptionScreen_DrawUnselected
  11449. bsr.w OptionScreen_Controls
  11450. bsr.w OptionScreen_DrawSelected
  11451. move #$2300,sr
  11452. lea (Anim_SonicMilesBG).l,a2
  11453. jsrto (Dynamic_Normal).l, JmpTo2_Dynamic_Normal
  11454. move.b (Ctrl_1_Press).w,d0
  11455. or.b (Ctrl_2_Press).w,d0
  11456. andi.b #button_start_mask,d0
  11457. bne.s OptionScreen_Select
  11458. bra.w OptionScreen_Main
  11459. ; ===========================================================================
  11460. ; loc_909A:
  11461. OptionScreen_Select:
  11462. move.b (Options_menu_box).w,d0
  11463. bne.s OptionScreen_Select_Not1P
  11464. ; Start a single player game
  11465. moveq #0,d0
  11466. move.w d0,(Two_player_mode).w
  11467. move.w d0,(Two_player_mode_copy).w
  11468. move.w d0,(Current_ZoneAndAct).w ; emerald_hill_zone_act_1
  11469. move.b #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
  11470. rts
  11471. ; ===========================================================================
  11472. ; loc_90B6:
  11473. OptionScreen_Select_Not1P:
  11474. subq.b #1,d0
  11475. bne.s OptionScreen_Select_Other
  11476. ; Start a 2P VS game
  11477. moveq #1,d0
  11478. move.w d0,(Two_player_mode).w
  11479. move.w d0,(Two_player_mode_copy).w
  11480. move.b #GameModeID_2PLevelSelect,(Game_Mode).w ; => LevelSelectMenu2P
  11481. move.b #0,(Current_Zone_2P).w
  11482. move.w #0,(Player_mode).w
  11483. rts
  11484. ; ===========================================================================
  11485. ; loc_90D8:
  11486. OptionScreen_Select_Other:
  11487. ; When pressing START on the sound test option, return to the SEGA screen
  11488. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  11489. rts
  11490.  
  11491. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  11492.  
  11493. ;sub_90E0:
  11494. OptionScreen_Controls:
  11495. moveq #0,d2
  11496. move.b (Options_menu_box).w,d2
  11497. move.b (Ctrl_1_Press).w,d0
  11498. or.b (Ctrl_2_Press).w,d0
  11499. btst #button_up,d0
  11500. beq.s +
  11501. subq.b #1,d2
  11502. bcc.s +
  11503. move.b #2,d2
  11504.  
  11505. +
  11506. btst #button_down,d0
  11507. beq.s +
  11508. addq.b #1,d2
  11509. cmpi.b #3,d2
  11510. blo.s +
  11511. moveq #0,d2
  11512.  
  11513. +
  11514. move.b d2,(Options_menu_box).w
  11515. lsl.w #2,d2
  11516. move.b OptionScreen_Choices(pc,d2.w),d3 ; number of choices for the option
  11517. movea.l OptionScreen_Choices(pc,d2.w),a1 ; location where the choice is stored (in RAM)
  11518. move.w (a1),d2
  11519. btst #button_left,d0
  11520. beq.s +
  11521. subq.b #1,d2
  11522. bcc.s +
  11523. move.b d3,d2
  11524.  
  11525. +
  11526. btst #button_right,d0
  11527. beq.s +
  11528. addq.b #1,d2
  11529. cmp.b d3,d2
  11530. bls.s +
  11531. moveq #0,d2
  11532.  
  11533. +
  11534. btst #button_A,d0
  11535. beq.s +
  11536. addi.b #$10,d2
  11537. cmp.b d3,d2
  11538. bls.s +
  11539. moveq #0,d2
  11540.  
  11541. +
  11542. move.w d2,(a1)
  11543. cmpi.b #2,(Options_menu_box).w
  11544. bne.s + ; rts
  11545. andi.w #button_B_mask|button_C_mask,d0
  11546. beq.s + ; rts
  11547. move.w (Sound_test_sound).w,d0
  11548. addi.w #$80,d0
  11549. jsrto (PlayMusic).l, JmpTo_PlayMusic
  11550. lea (level_select_cheat).l,a0
  11551. lea (continues_cheat).l,a2
  11552. lea (Level_select_flag).w,a1
  11553. moveq #0,d2 ; flag to tell the routine to enable the continues cheat
  11554. bsr.w CheckCheats
  11555.  
  11556. +
  11557. rts
  11558. ; End of function OptionScreen_Controls
  11559.  
  11560. ; ===========================================================================
  11561. ; word_917A:
  11562. OptionScreen_Choices:
  11563. dc.l (3-1)<<24|(Player_option&$FFFFFF)
  11564. dc.l (2-1)<<24|(Two_player_items&$FFFFFF)
  11565. dc.l ($80-1)<<24|(Sound_test_sound&$FFFFFF)
  11566.  
  11567. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  11568.  
  11569.  
  11570. ;sub_9186
  11571. OptionScreen_DrawSelected:
  11572. bsr.w OptionScreen_SelectTextPtr
  11573. moveq #0,d1
  11574. move.b (Options_menu_box).w,d1
  11575. lsl.w #3,d1
  11576. lea (OptScrBoxData).l,a3
  11577. lea (a3,d1.w),a3
  11578. move.w #palette_line_3,d0
  11579. lea (Chunk_Table+$30).l,a2
  11580. movea.l (a3)+,a1
  11581. bsr.w MenuScreenTextToRAM
  11582. lea (Chunk_Table+$B6).l,a2
  11583. moveq #0,d1
  11584. cmpi.b #2,(Options_menu_box).w
  11585. beq.s +
  11586. move.b (Options_menu_box).w,d1
  11587. lsl.w #2,d1
  11588. lea OptionScreen_Choices(pc),a1
  11589. movea.l (a1,d1.w),a1
  11590. move.w (a1),d1
  11591. lsl.w #2,d1
  11592. +
  11593. movea.l (a4,d1.w),a1
  11594. bsr.w MenuScreenTextToRAM
  11595. cmpi.b #2,(Options_menu_box).w
  11596. bne.s +
  11597. lea (Chunk_Table+$C2).l,a2
  11598. bsr.w OptionScreen_HexDumpSoundTest
  11599. +
  11600. lea (Chunk_Table).l,a1
  11601. move.l (a3)+,d0
  11602. moveq #$15,d1
  11603. moveq #7,d2
  11604. jmpto (PlaneMapToVRAM_H40).l, JmpTo_PlaneMapToVRAM_H40
  11605. ; ===========================================================================
  11606.  
  11607. ;loc_91F8
  11608. OptionScreen_DrawUnselected:
  11609. bsr.w OptionScreen_SelectTextPtr
  11610. moveq #0,d1
  11611. move.b (Options_menu_box).w,d1
  11612. lsl.w #3,d1
  11613. lea (OptScrBoxData).l,a3
  11614. lea (a3,d1.w),a3
  11615. moveq #palette_line_0,d0
  11616. lea (Chunk_Table+$190).l,a2
  11617. movea.l (a3)+,a1
  11618. bsr.w MenuScreenTextToRAM
  11619. lea (Chunk_Table+$216).l,a2
  11620. moveq #0,d1
  11621. cmpi.b #2,(Options_menu_box).w
  11622. beq.s +
  11623. move.b (Options_menu_box).w,d1
  11624. lsl.w #2,d1
  11625. lea OptionScreen_Choices(pc),a1
  11626. movea.l (a1,d1.w),a1
  11627. move.w (a1),d1
  11628. lsl.w #2,d1
  11629.  
  11630. +
  11631. movea.l (a4,d1.w),a1
  11632. bsr.w MenuScreenTextToRAM
  11633. cmpi.b #2,(Options_menu_box).w
  11634. bne.s +
  11635. lea (Chunk_Table+$222).l,a2
  11636. bsr.w OptionScreen_HexDumpSoundTest
  11637.  
  11638. +
  11639. lea (Chunk_Table+$160).l,a1
  11640. move.l (a3)+,d0
  11641. moveq #$15,d1
  11642. moveq #7,d2
  11643. jmpto (PlaneMapToVRAM_H40).l, JmpTo_PlaneMapToVRAM_H40
  11644. ; ===========================================================================
  11645.  
  11646. ;loc_9268
  11647. OptionScreen_SelectTextPtr:
  11648. lea (off_92D2).l,a4
  11649. tst.b (Graphics_Flags).w
  11650. bpl.s +
  11651. lea (off_92DE).l,a4
  11652.  
  11653. +
  11654. tst.b (Options_menu_box).w
  11655. beq.s +
  11656. lea (off_92EA).l,a4
  11657.  
  11658. +
  11659. cmpi.b #2,(Options_menu_box).w
  11660. bne.s + ; rts
  11661. lea (off_92F2).l,a4
  11662.  
  11663. +
  11664. rts
  11665. ; ===========================================================================
  11666.  
  11667. ;loc_9296
  11668. OptionScreen_HexDumpSoundTest:
  11669. move.w (Sound_test_sound).w,d1
  11670. move.b d1,d2
  11671. lsr.b #4,d1
  11672. bsr.s +
  11673. move.b d2,d1
  11674.  
  11675. +
  11676. andi.w #$F,d1
  11677. cmpi.b #$A,d1
  11678. blo.s +
  11679. addi.b #4,d1
  11680.  
  11681. +
  11682. addi.b #$10,d1
  11683. move.b d1,d0
  11684. move.w d0,(a2)+
  11685. rts
  11686. ; ===========================================================================
  11687. ; off_92BA:
  11688. OptScrBoxData:
  11689.  
  11690. ; macro to declare the data for an options screen box
  11691. boxData macro txtlabel,vramAddr
  11692. dc.l txtlabel, vdpComm(vramAddr,VRAM,WRITE)
  11693. endm
  11694.  
  11695. boxData TextOptScr_PlayerSelect,VRAM_Plane_A_Name_Table+planeLocH40(9,3)
  11696. boxData TextOptScr_VsModeItems,VRAM_Plane_A_Name_Table+planeLocH40(9,11)
  11697. boxData TextOptScr_SoundTest,VRAM_Plane_A_Name_Table+planeLocH40(9,19)
  11698.  
  11699. off_92D2:
  11700. dc.l TextOptScr_SonicAndMiles
  11701. dc.l TextOptScr_SonicAlone
  11702. dc.l TextOptScr_MilesAlone
  11703. off_92DE:
  11704. dc.l TextOptScr_SonicAndTails
  11705. dc.l TextOptScr_SonicAlone
  11706. dc.l TextOptScr_TailsAlone
  11707. off_92EA:
  11708. dc.l TextOptScr_AllKindsItems
  11709. dc.l TextOptScr_TeleportOnly
  11710. off_92F2:
  11711. dc.l TextOptScr_0
  11712. ; ===========================================================================
  11713. ; loc_92F6:
  11714. MenuScreen_LevelSelect:
  11715. ; Load foreground (sans zone icon)
  11716. lea (Chunk_Table).l,a1
  11717. lea (MapEng_LevSel).l,a0 ; 2 bytes per 8x8 tile, compressed
  11718. move.w #make_art_tile(ArtTile_VRAM_Start,0,0),d0
  11719. bsr.w EniDec
  11720.  
  11721. lea (Chunk_Table).l,a1
  11722. move.l #vdpComm(VRAM_Plane_A_Name_Table,VRAM,WRITE),d0
  11723. moveq #$27,d1
  11724. moveq #$1B,d2 ; 40x28 = whole screen
  11725. jsrto (PlaneMapToVRAM_H40).l, JmpTo_PlaneMapToVRAM_H40 ; display patterns
  11726.  
  11727. ; Draw sound test number
  11728. moveq #palette_line_0,d3
  11729. bsr.w LevelSelect_DrawSoundNumber
  11730.  
  11731. ; Load zone icon
  11732. lea (Chunk_Table+$8C0).l,a1
  11733. lea (MapEng_LevSelIcon).l,a0
  11734. move.w #make_art_tile(ArtTile_ArtNem_LevelSelectPics,0,0),d0
  11735. bsr.w EniDec
  11736.  
  11737. bsr.w LevelSelect_DrawIcon
  11738.  
  11739. clr.w (Player_mode).w
  11740. clr.w (Results_Screen_2P).w ; VsRSID_Act
  11741. clr.b (Level_started_flag).w
  11742. clr.w (Anim_Counters).w
  11743.  
  11744. ; Animate background (loaded back in MenuScreen)
  11745. lea (Anim_SonicMilesBG).l,a2
  11746. jsrto (Dynamic_Normal).l, JmpTo2_Dynamic_Normal ; background
  11747.  
  11748. moveq #PalID_Menu,d0
  11749. bsr.w PalLoad_ForFade
  11750.  
  11751. lea (Normal_palette_line3).w,a1
  11752. lea (Target_palette_line3).w,a2
  11753.  
  11754. moveq #bytesToLcnt(palette_line_size),d1
  11755. - move.l (a1),(a2)+
  11756. clr.l (a1)+
  11757. dbf d1,-
  11758.  
  11759. move.b #MusID_Options,d0
  11760. jsrto (PlayMusic).l, JmpTo_PlayMusic
  11761.  
  11762. move.w #$707,(Demo_Time_left).w
  11763. clr.w (Two_player_mode).w
  11764. clr.l (Camera_X_pos).w
  11765. clr.l (Camera_Y_pos).w
  11766. clr.w (Correct_cheat_entries).w
  11767. clr.w (Correct_cheat_entries_2).w
  11768.  
  11769. move.b #VintID_Menu,(Vint_routine).w
  11770. bsr.w WaitForVint
  11771.  
  11772. move.w (VDP_Reg1_val).w,d0
  11773. ori.b #$40,d0
  11774. move.w d0,(VDP_control_port).l
  11775.  
  11776. bsr.w Pal_FadeFromBlack
  11777.  
  11778. ;loc_93AC:
  11779. LevelSelect_Main: ; routine running during level select
  11780. move.b #VintID_Menu,(Vint_routine).w
  11781. bsr.w WaitForVint
  11782.  
  11783. move #$2700,sr
  11784.  
  11785. moveq #palette_line_0-palette_line_0,d3 ; palette line << 13
  11786. bsr.w LevelSelect_MarkFields ; unmark fields
  11787. bsr.w LevSelControls ; possible change selected fields
  11788. move.w #palette_line_3-palette_line_0,d3 ; palette line << 13
  11789. bsr.w LevelSelect_MarkFields ; mark fields
  11790.  
  11791. bsr.w LevelSelect_DrawIcon
  11792.  
  11793. move #$2300,sr
  11794.  
  11795. lea (Anim_SonicMilesBG).l,a2
  11796. jsrto (Dynamic_Normal).l, JmpTo2_Dynamic_Normal
  11797.  
  11798. move.b (Ctrl_1_Press).w,d0
  11799. or.b (Ctrl_2_Press).w,d0
  11800. andi.b #button_start_mask,d0 ; start pressed?
  11801. bne.s LevelSelect_PressStart ; yes
  11802. bra.w LevelSelect_Main ; no
  11803. ; ===========================================================================
  11804.  
  11805. ;loc_93F0:
  11806. LevelSelect_PressStart:
  11807. move.w (Level_select_zone).w,d0
  11808. add.w d0,d0
  11809. move.w LevelSelect_Order(pc,d0.w),d0
  11810. bmi.w LevelSelect_Return ; sound test
  11811. cmpi.w #$4000,d0
  11812. bne.s LevelSelect_StartZone
  11813.  
  11814. ;LevelSelect_SpecialStage:
  11815. move.b #GameModeID_SpecialStage,(Game_Mode).w ; => SpecialStage
  11816. clr.w (Current_ZoneAndAct).w
  11817. move.b #3,(Life_count).w
  11818. move.b #3,(Life_count_2P).w
  11819. moveq #0,d0
  11820. move.w d0,(Ring_count).w
  11821. move.l d0,(Timer).w
  11822. move.l d0,(Score).w
  11823. move.w d0,(Ring_count_2P).w
  11824. move.l d0,(Timer_2P).w
  11825. move.l d0,(Score_2P).w
  11826. move.l #5000,(Next_Extra_life_score).w
  11827. move.l #5000,(Next_Extra_life_score_2P).w
  11828. move.w (Player_option).w,(Player_mode).w
  11829. rts
  11830. ; ===========================================================================
  11831.  
  11832. ;loc_944C:
  11833. LevelSelect_Return:
  11834. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  11835. rts
  11836. ; ===========================================================================
  11837. ; -----------------------------------------------------------------------------
  11838. ; Level Select Level Order
  11839.  
  11840. ; One entry per item in the level select menu. Just set the value for the item
  11841. ; you want to link to the level/act number of the level you want to load when
  11842. ; the player selects that item.
  11843. ; -----------------------------------------------------------------------------
  11844. ;Misc_9454:
  11845. LevelSelect_Order:
  11846. dc.w emerald_hill_zone_act_1
  11847. dc.w emerald_hill_zone_act_2 ; 1
  11848. dc.w chemical_plant_zone_act_1 ; 2
  11849. dc.w chemical_plant_zone_act_2 ; 3
  11850. dc.w aquatic_ruin_zone_act_1 ; 4
  11851. dc.w aquatic_ruin_zone_act_2 ; 5
  11852. dc.w casino_night_zone_act_1 ; 6
  11853. dc.w casino_night_zone_act_2 ; 7
  11854. dc.w hill_top_zone_act_1 ; 8
  11855. dc.w hill_top_zone_act_2 ; 9
  11856. dc.w mystic_cave_zone_act_1 ; 10
  11857. dc.w mystic_cave_zone_act_2 ; 11
  11858. dc.w oil_ocean_zone_act_1 ; 12
  11859. dc.w oil_ocean_zone_act_2 ; 13
  11860. dc.w metropolis_zone_act_1 ; 14
  11861. dc.w metropolis_zone_act_2 ; 15
  11862. dc.w metropolis_zone_act_3 ; 16
  11863. dc.w sky_chase_zone_act_1 ; 17
  11864. dc.w wing_fortress_zone_act_1 ; 18
  11865. dc.w death_egg_zone_act_1 ; 19
  11866. dc.w $4000 ; 20 - special stage
  11867. dc.w $FFFF ; 21 - sound test
  11868. ; ===========================================================================
  11869.  
  11870. ;loc_9480:
  11871. LevelSelect_StartZone:
  11872. andi.w #$3FFF,d0
  11873. move.w d0,(Current_ZoneAndAct).w
  11874. move.b #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
  11875. move.b #3,(Life_count).w
  11876. move.b #3,(Life_count_2P).w
  11877. moveq #0,d0
  11878. move.w d0,(Ring_count).w
  11879. move.l d0,(Timer).w
  11880. move.l d0,(Score).w
  11881. move.w d0,(Ring_count_2P).w
  11882. move.l d0,(Timer_2P).w
  11883. move.l d0,(Score_2P).w
  11884. move.b d0,(Continue_count).w
  11885. move.l #5000,(Next_Extra_life_score).w
  11886. move.l #5000,(Next_Extra_life_score_2P).w
  11887. move.b #MusID_FadeOut,d0
  11888. jsrto (PlaySound).l, JmpTo_PlaySound
  11889. moveq #0,d0
  11890. move.w d0,(Two_player_mode_copy).w
  11891. move.w d0,(Two_player_mode).w
  11892. rts
  11893.  
  11894. ; ===========================================================================
  11895. ; ---------------------------------------------------------------------------
  11896. ; Change what you're selecting in the level select
  11897. ; ---------------------------------------------------------------------------
  11898. ; loc_94DC:
  11899. LevSelControls:
  11900. move.b (Ctrl_1_Press).w,d1
  11901. andi.b #button_up_mask|button_down_mask,d1
  11902. bne.s + ; up/down pressed
  11903. subq.w #1,(LevSel_HoldTimer).w
  11904. bpl.s LevSelControls_CheckLR
  11905.  
  11906. +
  11907. move.w #$B,(LevSel_HoldTimer).w
  11908. move.b (Ctrl_1_Held).w,d1
  11909. andi.b #button_up_mask|button_down_mask,d1
  11910. beq.s LevSelControls_CheckLR ; up/down not pressed, check for left & right
  11911. move.w (Level_select_zone).w,d0
  11912. btst #button_up,d1
  11913. beq.s +
  11914. subq.w #1,d0 ; decrease by 1
  11915. bcc.s + ; >= 0?
  11916. moveq #$15,d0 ; set to $15
  11917.  
  11918. +
  11919. btst #button_down,d1
  11920. beq.s +
  11921. addq.w #1,d0 ; yes, add 1
  11922. cmpi.w #$16,d0
  11923. blo.s + ; smaller than $16?
  11924. moveq #0,d0 ; if not, set to 0
  11925.  
  11926. +
  11927. move.w d0,(Level_select_zone).w
  11928. rts
  11929. ; ===========================================================================
  11930. ; loc_9522:
  11931. LevSelControls_CheckLR:
  11932. cmpi.w #$15,(Level_select_zone).w ; are we in the sound test?
  11933. bne.s LevSelControls_SwitchSide ; no
  11934. move.w (Sound_test_sound).w,d0
  11935. move.b (Ctrl_1_Press).w,d1
  11936. btst #button_left,d1
  11937. beq.s +
  11938. subq.b #1,d0
  11939. bcc.s +
  11940. moveq #$7F,d0
  11941.  
  11942. +
  11943. btst #button_right,d1
  11944. beq.s +
  11945. addq.b #1,d0
  11946. cmpi.w #$80,d0
  11947. blo.s +
  11948. moveq #0,d0
  11949.  
  11950. +
  11951. btst #button_A,d1
  11952. beq.s +
  11953. addi.b #$10,d0
  11954. andi.b #$7F,d0
  11955.  
  11956. +
  11957. move.w d0,(Sound_test_sound).w
  11958. andi.w #button_B_mask|button_C_mask,d1
  11959. beq.s + ; rts
  11960. move.w (Sound_test_sound).w,d0
  11961. addi.w #$80,d0
  11962. jsrto (PlayMusic).l, JmpTo_PlayMusic
  11963. lea (debug_cheat).l,a0
  11964. lea (super_sonic_cheat).l,a2
  11965. lea (Debug_options_flag).w,a1
  11966. moveq #1,d2 ; flag to tell the routine to enable the Super Sonic cheat
  11967. bsr.w CheckCheats
  11968.  
  11969. +
  11970. rts
  11971. ; ===========================================================================
  11972. ; loc_958A:
  11973. LevSelControls_SwitchSide: ; not in soundtest, not up/down pressed
  11974. move.b (Ctrl_1_Press).w,d1
  11975. andi.b #button_left_mask|button_right_mask,d1
  11976. beq.s + ; no direction key pressed
  11977. move.w (Level_select_zone).w,d0 ; left or right pressed
  11978. move.b LevelSelect_SwitchTable(pc,d0.w),d0 ; set selected zone according to table
  11979. move.w d0,(Level_select_zone).w
  11980. +
  11981. rts
  11982. ; ===========================================================================
  11983. ;byte_95A2:
  11984. LevelSelect_SwitchTable:
  11985. dc.b $E
  11986. dc.b $F ; 1
  11987. dc.b $11 ; 2
  11988. dc.b $11 ; 3
  11989. dc.b $12 ; 4
  11990. dc.b $12 ; 5
  11991. dc.b $13 ; 6
  11992. dc.b $13 ; 7
  11993. dc.b $14 ; 8
  11994. dc.b $14 ; 9
  11995. dc.b $15 ; 10
  11996. dc.b $15 ; 11
  11997. dc.b $C ; 12
  11998. dc.b $D ; 13
  11999. dc.b 0 ; 14
  12000. dc.b 1 ; 15
  12001. dc.b 1 ; 16
  12002. dc.b 2 ; 17
  12003. dc.b 4 ; 18
  12004. dc.b 6 ; 19
  12005. dc.b 8 ; 20
  12006. dc.b $A ; 21
  12007. even
  12008. ; ===========================================================================
  12009.  
  12010. ;loc_95B8:
  12011. LevelSelect_MarkFields:
  12012. lea (Chunk_Table).l,a4
  12013. lea (LevSel_MarkTable).l,a5
  12014. lea (VDP_data_port).l,a6
  12015. moveq #0,d0
  12016. move.w (Level_select_zone).w,d0
  12017. lsl.w #2,d0
  12018. lea (a5,d0.w),a3
  12019. moveq #0,d0
  12020. move.b (a3),d0
  12021. mulu.w #$50,d0
  12022. moveq #0,d1
  12023. move.b 1(a3),d1
  12024. add.w d1,d0
  12025. lea (a4,d0.w),a1
  12026. moveq #0,d1
  12027. move.b (a3),d1
  12028. lsl.w #7,d1
  12029. add.b 1(a3),d1
  12030. addi.w #VRAM_Plane_A_Name_Table,d1
  12031. lsl.l #2,d1
  12032. lsr.w #2,d1
  12033. ori.w #vdpComm($0000,VRAM,WRITE)>>16,d1
  12034. swap d1
  12035. move.l d1,4(a6)
  12036.  
  12037. moveq #$D,d2
  12038. - move.w (a1)+,d0
  12039. add.w d3,d0
  12040. move.w d0,(a6)
  12041. dbf d2,-
  12042.  
  12043. addq.w #2,a3
  12044. moveq #0,d0
  12045. move.b (a3),d0
  12046. beq.s +
  12047. mulu.w #$50,d0
  12048. moveq #0,d1
  12049. move.b 1(a3),d1
  12050. add.w d1,d0
  12051. lea (a4,d0.w),a1
  12052. moveq #0,d1
  12053. move.b (a3),d1
  12054. lsl.w #7,d1
  12055. add.b 1(a3),d1
  12056. addi.w #VRAM_Plane_A_Name_Table,d1
  12057. lsl.l #2,d1
  12058. lsr.w #2,d1
  12059. ori.w #vdpComm($0000,VRAM,WRITE)>>16,d1
  12060. swap d1
  12061. move.l d1,4(a6)
  12062. move.w (a1)+,d0
  12063. add.w d3,d0
  12064. move.w d0,(a6)
  12065.  
  12066. +
  12067. cmpi.w #$15,(Level_select_zone).w
  12068. bne.s + ; rts
  12069. bsr.w LevelSelect_DrawSoundNumber
  12070. +
  12071. rts
  12072. ; ===========================================================================
  12073. ;loc_965A:
  12074. LevelSelect_DrawSoundNumber:
  12075. move.l #vdpComm(VRAM_Plane_A_Name_Table+planeLocH40(34,18),VRAM,WRITE),(VDP_control_port).l
  12076. move.w (Sound_test_sound).w,d0
  12077. move.b d0,d2
  12078. lsr.b #4,d0
  12079. bsr.s +
  12080. move.b d2,d0
  12081.  
  12082. +
  12083. andi.w #$F,d0
  12084. cmpi.b #$A,d0
  12085. blo.s +
  12086. addi.b #4,d0
  12087.  
  12088. +
  12089. addi.b #$10,d0
  12090. add.w d3,d0
  12091. move.w d0,(a6)
  12092. rts
  12093. ; ===========================================================================
  12094.  
  12095. ;loc_9688:
  12096. LevelSelect_DrawIcon:
  12097. move.w (Level_select_zone).w,d0
  12098. lea (LevSel_IconTable).l,a3
  12099. lea (a3,d0.w),a3
  12100. lea (Chunk_Table+$8C0).l,a1
  12101. moveq #0,d0
  12102. move.b (a3),d0
  12103. lsl.w #3,d0
  12104. move.w d0,d1
  12105. add.w d0,d0
  12106. add.w d1,d0
  12107. lea (a1,d0.w),a1
  12108. move.l #vdpComm(VRAM_Plane_A_Name_Table+planeLocH40(27,22),VRAM,WRITE),d0
  12109. moveq #3,d1
  12110. moveq #2,d2
  12111. jsrto (PlaneMapToVRAM_H40).l, JmpTo_PlaneMapToVRAM_H40
  12112. lea (Pal_LevelIcons).l,a1
  12113. moveq #0,d0
  12114. move.b (a3),d0
  12115. lsl.w #5,d0
  12116. lea (a1,d0.w),a1
  12117. lea (Normal_palette_line3).w,a2
  12118.  
  12119. moveq #bytesToLcnt(palette_line_size),d1
  12120. - move.l (a1)+,(a2)+
  12121. dbf d1,-
  12122.  
  12123. rts
  12124. ; ===========================================================================
  12125. ;byte_96D8
  12126. LevSel_IconTable:
  12127. dc.b 0,0 ;0 EHZ
  12128. dc.b 7,7 ;2 CPZ
  12129. dc.b 8,8 ;4 ARZ
  12130. dc.b 6,6 ;6 CNZ
  12131. dc.b 2,2 ;8 HTZ
  12132. dc.b 5,5 ;$A MCZ
  12133. dc.b 4,4 ;$C OOZ
  12134. dc.b 1,1,1 ;$E MTZ
  12135. dc.b 9 ;$11 SCZ
  12136. dc.b $A ;$12 WFZ
  12137. dc.b $B ;$13 DEZ
  12138. dc.b $C ;$14 Special Stage
  12139. dc.b $E ;$15 Sound Test
  12140. even
  12141. ;byte_96EE:
  12142. LevSel_MarkTable: ; 4 bytes per level select entry
  12143. ; line primary, 2*column ($E fields), line secondary, 2*column secondary (1 field)
  12144. dc.b 3, 6, 3,$24 ;0
  12145. dc.b 3, 6, 4,$24
  12146. dc.b 6, 6, 6,$24
  12147. dc.b 6, 6, 7,$24
  12148. dc.b 9, 6, 9,$24 ;4
  12149. dc.b 9, 6, $A,$24
  12150. dc.b $C, 6, $C,$24
  12151. dc.b $C, 6, $D,$24
  12152. dc.b $F, 6, $F,$24 ;8
  12153. dc.b $F, 6,$10,$24
  12154. dc.b $12, 6,$12,$24
  12155. dc.b $12, 6,$13,$24
  12156. dc.b $15, 6,$15,$24 ;$C
  12157. dc.b $15, 6,$16,$24
  12158. ; --- second column ---
  12159. dc.b 3,$2C, 3,$48
  12160. dc.b 3,$2C, 4,$48
  12161. dc.b 3,$2C, 5,$48 ;$10
  12162. dc.b 6,$2C, 0, 0
  12163. dc.b 9,$2C, 0, 0
  12164. dc.b $C,$2C, 0, 0
  12165. dc.b $F,$2C, 0, 0 ;$14
  12166. dc.b $12,$2C,$12,$48
  12167. ; ===========================================================================
  12168. ; loc_9746:
  12169. CheckCheats: ; This is called from 2 places: the options screen and the level select screen
  12170. move.w (Correct_cheat_entries).w,d0 ; Get the number of correct sound IDs entered so far
  12171. adda.w d0,a0 ; Skip to the next entry
  12172. move.w (Sound_test_sound).w,d0 ; Get the current sound test sound
  12173. cmp.b (a0),d0 ; Compare it to the cheat
  12174. bne.s + ; If they're different, branch
  12175. addq.w #1,(Correct_cheat_entries).w ; Add 1 to the number of correct entries
  12176. tst.b 1(a0) ; Is the next entry 0?
  12177. bne.s ++ ; If not, branch
  12178. move.w #$101,(a1) ; Enable the cheat
  12179. move.b #SndID_Ring,d0 ; Play the ring sound
  12180. jsrto (PlaySound).l, JmpTo_PlaySound
  12181. +
  12182. move.w #0,(Correct_cheat_entries).w ; Clear the number of correct entries
  12183. +
  12184. move.w (Correct_cheat_entries_2).w,d0 ; Do the same procedure with the other cheat
  12185. adda.w d0,a2
  12186. move.w (Sound_test_sound).w,d0
  12187. cmp.b (a2),d0
  12188. bne.s ++
  12189. addq.w #1,(Correct_cheat_entries_2).w
  12190. tst.b 1(a2)
  12191. bne.s +++ ; rts
  12192. tst.w d2 ; Test this to determine which cheat to enable
  12193. bne.s + ; If not 0, branch
  12194. move.b #$F,(Continue_count).w ; Give 15 continues
  12195. ; The next line causes the bug where the OOZ music plays until reset.
  12196. ; Remove "&$7F" to fix the bug.
  12197. move.b #SndID_ContinueJingle&$7F,d0 ; Play the continue jingle
  12198. jsrto (PlayMusic).l, JmpTo_PlayMusic
  12199. bra.s ++
  12200. ; ===========================================================================
  12201. +
  12202. move.w #7,(Got_Emerald).w ; Give 7 emeralds to the player
  12203. move.b #MusID_Emerald,d0 ; Play the emerald jingle
  12204. jsrto (PlayMusic).l, JmpTo_PlayMusic
  12205. +
  12206. move.w #0,(Correct_cheat_entries_2).w ; Clear the number of correct entries
  12207. +
  12208. rts
  12209. ; ===========================================================================
  12210. level_select_cheat: dc.b $19, $65, 9, $17, 0 ; 17th September 1965, Yuji Naka's birthdate
  12211. rev02even
  12212. ; byte_97B7
  12213. continues_cheat: dc.b 1, 1, 2, 4, 0 ; 24th November, Sonic 2's release date in the EU and US: "Sonic 2sday"
  12214. rev02even
  12215. debug_cheat: dc.b 1, 9, 9, 2, 1, 1, 2, 4, 0 ; 24th November 1992, Sonic 2's release date in the EU and US: "Sonic 2sday"
  12216. rev02even
  12217. ; byte_97C5
  12218. super_sonic_cheat: dc.b 4, 1, 2, 6, 0 ; Book of Genesis, 41:26
  12219. rev02even
  12220.  
  12221. ; set the character set for menu text
  12222. charset '@',"\27\30\31\32\33\34\35\36\37\38\39\40\41\42\43\44\45\46\47\48\49\50\51\52\53\54\55"
  12223. charset '0',"\16\17\18\19\20\21\22\23\24\25"
  12224. charset '*',$1A
  12225. charset ':',$1C
  12226. charset '.',$1D
  12227. charset ' ',0
  12228.  
  12229. ; options screen menu text
  12230.  
  12231. TextOptScr_PlayerSelect: menutxt "* PLAYER SELECT *" ; byte_97CA:
  12232. TextOptScr_SonicAndMiles: menutxt "SONIC AND MILES" ; byte_97DC:
  12233. TextOptScr_SonicAndTails: menutxt "SONIC AND TAILS" ; byte_97EC:
  12234. TextOptScr_SonicAlone: menutxt "SONIC ALONE " ; byte_97FC:
  12235. TextOptScr_MilesAlone: menutxt "MILES ALONE " ; byte_980C:
  12236. TextOptScr_TailsAlone: menutxt "TAILS ALONE " ; byte_981C:
  12237. TextOptScr_VsModeItems: menutxt "* VS MODE ITEMS *" ; byte_982C:
  12238. TextOptScr_AllKindsItems: menutxt "ALL KINDS ITEMS" ; byte_983E:
  12239. TextOptScr_TeleportOnly: menutxt "TELEPORT ONLY " ; byte_984E:
  12240. TextOptScr_SoundTest: menutxt "* SOUND TEST *" ; byte_985E:
  12241. TextOptScr_0: menutxt " 00 " ; byte_9870:
  12242.  
  12243. charset ; reset character set
  12244.  
  12245. ; level select picture palettes
  12246. ; byte_9880:
  12247. Pal_LevelIcons: BINCLUDE "art/palettes/Level Select Icons.bin"
  12248.  
  12249. ; 2-player level select screen mappings (Enigma compressed)
  12250. ; byte_9A60:
  12251. MapEng_LevSel2P: BINCLUDE "mappings/misc/Level Select 2P.bin"
  12252.  
  12253. ; options screen mappings (Enigma compressed)
  12254. ; byte_9AB2:
  12255. MapEng_Options: BINCLUDE "mappings/misc/Options Screen.bin"
  12256.  
  12257. ; level select screen mappings (Enigma compressed)
  12258. ; byte_9ADE:
  12259. MapEng_LevSel: BINCLUDE "mappings/misc/Level Select.bin"
  12260.  
  12261. ; 1P and 2P level select icon mappings (Enigma compressed)
  12262. ; byte_9C32:
  12263. MapEng_LevSelIcon: BINCLUDE "mappings/misc/Level Select Icons.bin"
  12264.  
  12265. if ~~removeJmpTos
  12266. JmpTo_PlaySound
  12267. jmp (PlaySound).l
  12268. JmpTo_PlayMusic
  12269. jmp (PlayMusic).l
  12270. ; loc_9C70: JmpTo_PlaneMapToVRAM
  12271. JmpTo_PlaneMapToVRAM_H40
  12272. jmp (PlaneMapToVRAM_H40).l
  12273. JmpTo2_Dynamic_Normal
  12274. jmp (Dynamic_Normal).l
  12275.  
  12276. align 4
  12277. endif
  12278.  
  12279.  
  12280.  
  12281.  
  12282. ; ===========================================================================
  12283. ; loc_9C7C:
  12284. EndingSequence:
  12285. clearRAM EndSeq_Object_RAM,EndSeq_Object_RAM_End
  12286. clearRAM Misc_Variables,Misc_Variables_End
  12287. clearRAM Camera_RAM,Camera_RAM_End
  12288.  
  12289. move #$2700,sr
  12290. move.w (VDP_Reg1_val).w,d0
  12291. andi.b #$BF,d0
  12292. move.w d0,(VDP_control_port).l
  12293.  
  12294. stopZ80
  12295. dmaFillVRAM 0,VRAM_Plane_A_Name_Table,VRAM_Plane_Table_Size ; clear Plane A pattern name table
  12296. clr.l (Vscroll_Factor).w
  12297. clr.l (unk_F61A).w
  12298. startZ80
  12299.  
  12300. lea (VDP_control_port).l,a6
  12301. move.w #$8B03,(a6) ; EXT-INT disabled, V scroll by screen, H scroll by line
  12302. move.w #$8200|(VRAM_EndSeq_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  12303. move.w #$8400|(VRAM_EndSeq_Plane_B_Name_Table1/$2000),(a6) ; PNT B base: $E000
  12304. move.w #$8500|(VRAM_Sprite_Attribute_Table/$200),(a6) ; Sprite attribute table base: $F800
  12305. move.w #$9001,(a6) ; Scroll table size: 64x32
  12306. move.w #$8004,(a6) ; H-INT disabled
  12307. move.w #$8720,(a6) ; Background palette/color: 2/0
  12308. move.w #$8ADF,(Hint_counter_reserve).w ; H-INT every 224th scanline
  12309. move.w (Hint_counter_reserve).w,(a6)
  12310. clr.b (Super_Sonic_flag).w
  12311. cmpi.b #7,(Emerald_count).w
  12312. bne.s +
  12313. cmpi.w #2,(Player_mode).w
  12314. beq.s +
  12315. st (Super_Sonic_flag).w
  12316. move.b #-1,(Super_Sonic_palette).w
  12317. move.b #$F,(Palette_timer).w
  12318. move.w #$30,(Palette_frame).w
  12319. +
  12320. moveq #0,d0
  12321. cmpi.w #2,(Player_mode).w
  12322. beq.s +
  12323. tst.b (Super_Sonic_flag).w
  12324. bne.s ++
  12325. bra.w +++
  12326.  
  12327. ; ===========================================================================
  12328. +
  12329. addq.w #2,d0
  12330. +
  12331. addq.w #2,d0
  12332. +
  12333. move.w d0,(Ending_Routine).w
  12334. bsr.w EndingSequence_LoadCharacterArt
  12335. bsr.w EndingSequence_LoadFlickyArt
  12336. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_EndingFinalTornado),VRAM,WRITE),(VDP_control_port).l
  12337. lea (ArtNem_EndingFinalTornado).l,a0
  12338. jsrto (NemDec).l, JmpTo_NemDec
  12339. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_EndingPics),VRAM,WRITE),(VDP_control_port).l
  12340. lea (ArtNem_EndingPics).l,a0
  12341. jsrto (NemDec).l, JmpTo_NemDec
  12342. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_EndingMiniTornado),VRAM,WRITE),(VDP_control_port).l
  12343. lea (ArtNem_EndingMiniTornado).l,a0
  12344. jsrto (NemDec).l, JmpTo_NemDec
  12345. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Tornado),VRAM,WRITE),(VDP_control_port).l
  12346. lea (ArtNem_Tornado).l,a0
  12347. jsrto (NemDec).l, JmpTo_NemDec
  12348. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Clouds),VRAM,WRITE),(VDP_control_port).l
  12349. lea (ArtNem_Clouds).l,a0
  12350. jsrto (NemDec).l, JmpTo_NemDec
  12351. move.w #death_egg_zone_act_1,(Current_ZoneAndAct).w
  12352. move #$2300,sr
  12353. moveq #MusID_Ending,d0
  12354. jsrto (PlayMusic).l, JmpTo2_PlayMusic
  12355. move.l #$EEE0EEE,d1
  12356. lea (Normal_palette).w,a1
  12357.  
  12358. moveq #bytesToLcnt(palette_line_size*4),d0
  12359. - move.l d1,(a1)+
  12360. dbf d0,-
  12361.  
  12362. lea (Pal_AC7E).l,a1
  12363. lea (Target_palette).w,a2
  12364.  
  12365. moveq #bytesToLcnt(palette_line_size*4),d0
  12366. - move.l (a1)+,(a2)+
  12367. dbf d0,-
  12368.  
  12369. clr.b (Screen_Shaking_Flag).w
  12370. moveq #0,d0
  12371. move.w d0,(Debug_placement_mode).w
  12372. move.w d0,(Level_Inactive_flag).w
  12373. move.w d0,(Timer_frames).w
  12374. move.w d0,(Camera_X_pos).w
  12375. move.w d0,(Camera_Y_pos).w
  12376. move.w d0,(Camera_X_pos_copy).w
  12377. move.w d0,(Camera_Y_pos_copy).w
  12378. move.w d0,(Camera_BG_X_pos).w
  12379. move.w #$C8,(Camera_BG_Y_pos).w
  12380. move.l d0,(Vscroll_Factor).w
  12381. move.b d0,(Horiz_block_crossed_flag_BG).w
  12382. move.b d0,(Verti_block_crossed_flag_BG).w
  12383. move.w d0,(Ending_VInt_Subrout).w
  12384. move.w d0,(Credits_Trigger).w
  12385.  
  12386. ; Bug: The '+4' shouldn't be here; clearRAM accidentally clears an additional 4 bytes
  12387. clearRAM Horiz_Scroll_Buf,Horiz_Scroll_Buf_End+4
  12388.  
  12389. move.w #$7FFF,(PalCycle_Timer).w
  12390. lea (CutScene).w,a1
  12391. move.b #ObjID_CutScene,id(a1) ; load objCA (end of game cutscene) at $FFFFB100
  12392. move.b #6,routine(a1)
  12393. move.w #$60,objoff_3C(a1)
  12394. move.w #1,objoff_30(a1)
  12395. cmpi.w #4,(Ending_Routine).w
  12396. bne.s +
  12397. move.w #$10,objoff_2E(a1)
  12398. move.w #$100,objoff_3C(a1)
  12399. +
  12400. move.b #VintID_Ending,(Vint_routine).w
  12401. bsr.w WaitForVint
  12402. move.w (VDP_Reg1_val).w,d0
  12403. ori.b #$40,d0
  12404. move.w d0,(VDP_control_port).l
  12405. -
  12406. move.b #VintID_Ending,(Vint_routine).w
  12407. bsr.w WaitForVint
  12408. addq.w #1,(Timer_frames).w
  12409. jsr (RandomNumber).l
  12410. jsr (RunObjects).l
  12411. jsr (BuildSprites).l
  12412. tst.b (Ending_PalCycle_flag).w
  12413. beq.s +
  12414. jsrto (PalCycle_Load).l, JmpTo_PalCycle_Load
  12415. +
  12416. bsr.w EndgameCredits
  12417. tst.w (Level_Inactive_flag).w
  12418. beq.w -
  12419. rts
  12420.  
  12421. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  12422.  
  12423.  
  12424. ; sub_9EF4
  12425. EndgameCredits:
  12426. tst.b (Credits_Trigger).w
  12427. beq.w +++ ; rts
  12428. bsr.w Pal_FadeToBlack
  12429. lea (VDP_control_port).l,a6
  12430. move.w #$8004,(a6) ; H-INT disabled
  12431. move.w #$8200|(VRAM_EndSeq_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
  12432. move.w #$8400|(VRAM_EndSeq_Plane_B_Name_Table1/$2000),(a6) ; PNT B base: $E000
  12433. move.w #$9001,(a6) ; Scroll table size: 64x32
  12434. move.w #$9200,(a6) ; Disable window
  12435. move.w #$8B03,(a6) ; EXT-INT disabled, V scroll by screen, H scroll by line
  12436. move.w #$8700,(a6) ; Background palette/color: 0/0
  12437. clr.b (Water_fullscreen_flag).w
  12438. move.w #$8C81,(a6) ; H res 40 cells, no interlace, S/H disabled
  12439. jsrto (ClearScreen).l, JmpTo_ClearScreen
  12440.  
  12441. clearRAM Sprite_Table_Input,Sprite_Table_Input_End
  12442. clearRAM EndSeq_Object_RAM,EndSeq_Object_RAM_End
  12443. clearRAM Misc_Variables,Misc_Variables_End
  12444. clearRAM Camera_RAM,Camera_RAM_End
  12445.  
  12446. clr.b (Screen_Shaking_Flag).w
  12447. moveq #0,d0
  12448. move.w d0,(Level_Inactive_flag).w
  12449. move.w d0,(Timer_frames).w
  12450. move.w d0,(Camera_X_pos).w
  12451. move.w d0,(Camera_Y_pos).w
  12452. move.w d0,(Camera_X_pos_copy).w
  12453. move.w d0,(Camera_Y_pos_copy).w
  12454. move.w d0,(Camera_BG_X_pos).w
  12455. move.w d0,(Camera_BG_Y_pos).w
  12456. move.l d0,(Vscroll_Factor).w
  12457. move.b d0,(Horiz_block_crossed_flag_BG).w
  12458. move.b d0,(Verti_block_crossed_flag_BG).w
  12459. move.w d0,(Ending_VInt_Subrout).w
  12460. move.w d0,(Credits_Trigger).w
  12461.  
  12462. ; Bug: The '+4' shouldn't be here; clearRAM accidentally clears an additional 4 bytes
  12463. clearRAM Horiz_Scroll_Buf,Horiz_Scroll_Buf_End+4
  12464.  
  12465. moveq #MusID_Credits,d0
  12466. jsrto (PlaySound).l, JmpTo2_PlaySound
  12467. clr.w (Target_palette).w
  12468. move.w #$EEE,(Target_palette+$C).w
  12469. move.w #$EE,(Target_palette_line2+$C).w
  12470. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_CreditText_CredScr),VRAM,WRITE),(VDP_control_port).l
  12471. lea (ArtNem_CreditText).l,a0
  12472. jsrto (NemDec).l, JmpTo_NemDec
  12473. clr.w (CreditsScreenIndex).w
  12474. -
  12475. jsrto (ClearScreen).l, JmpTo_ClearScreen
  12476. bsr.w ShowCreditsScreen
  12477. bsr.w Pal_FadeFromBlack
  12478.  
  12479. ; Here's how to calculate new duration values for the below instructions.
  12480. ; Each slide of the credits is displayed for $18E frames at 60 FPS, or $144 frames at 50 FPS.
  12481. ; We also need to take into account how many frames the fade-in/fade-out take: which is $16 each.
  12482. ; Also, there are 21 slides to display.
  12483. ; That said, by doing '($18E+$16+$16)*21', we get the total number of frames it takes until
  12484. ; the credits reach the Sonic 2 splash (which is technically not an actual slide in the credits).
  12485. ; Dividing this by 60 will give us how many seconds it takes. The result being 154.7.
  12486. ; Doing the same for 50 FPS, by dividing the result of '($144+$16+$16)*21' by 50, will give us 154.56.
  12487. ; Now that we have the time it should take for the credits to end, we can adjust the calculation to account
  12488. ; for any slides we may have added. For example, if you added a slide, bringing the total to 22,
  12489. ; performing '((154.7*60)/22)-($16+$16)' will give you the new value to put in the 'move.w' instruction below.
  12490. move.w #$18E,d0
  12491. btst #6,(Graphics_Flags).w
  12492. beq.s +
  12493. move.w #$144,d0
  12494.  
  12495. / move.b #VintID_Ending,(Vint_routine).w
  12496. bsr.w WaitForVint
  12497. dbf d0,-
  12498.  
  12499. bsr.w Pal_FadeToBlack
  12500. lea (off_B2CA).l,a1
  12501. addq.w #1,(CreditsScreenIndex).w
  12502. move.w (CreditsScreenIndex).w,d0
  12503. lsl.w #2,d0
  12504. move.l (a1,d0.w),d0
  12505. bpl.s --
  12506. bsr.w Pal_FadeToBlack
  12507. jsrto (ClearScreen).l, JmpTo_ClearScreen
  12508. move.l #vdpComm($0000,VRAM,WRITE),(VDP_control_port).l
  12509. lea (ArtNem_EndingTitle).l,a0
  12510. jsrto (NemDec).l, JmpTo_NemDec
  12511. lea (MapEng_EndGameLogo).l,a0
  12512. lea (Chunk_Table).l,a1
  12513. move.w #0,d0
  12514. jsrto (EniDec).l, JmpTo_EniDec
  12515. lea (Chunk_Table).l,a1
  12516. move.l #vdpComm(VRAM_Plane_A_Name_Table+planeLocH40(12,11),VRAM,WRITE),d0
  12517. moveq #$F,d1
  12518. moveq #5,d2
  12519. jsrto (PlaneMapToVRAM_H40).l, JmpTo2_PlaneMapToVRAM_H40
  12520. clr.w (CreditsScreenIndex).w
  12521. bsr.w EndgameLogoFlash
  12522.  
  12523. move.w #$3B,d0
  12524. - move.b #VintID_Ending,(Vint_routine).w
  12525. bsr.w WaitForVint
  12526. dbf d0,-
  12527.  
  12528. move.w #$257,d6
  12529. - move.b #VintID_Ending,(Vint_routine).w
  12530. bsr.w WaitForVint
  12531. addq.w #1,(CreditsScreenIndex).w
  12532. bsr.w EndgameLogoFlash
  12533. cmpi.w #$5E,(CreditsScreenIndex).w
  12534. blo.s -
  12535. move.b (Ctrl_1_Press).w,d1
  12536. andi.b #button_B_mask|button_C_mask|button_A_mask|button_start_mask,d1
  12537. bne.s +
  12538. dbf d6,-
  12539. +
  12540. st (Level_Inactive_flag).w
  12541. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  12542. /
  12543. rts
  12544. ; End of function sub_9EF4
  12545.  
  12546.  
  12547. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  12548.  
  12549.  
  12550. ;sub_A0C0
  12551. EndgameLogoFlash:
  12552. lea (Normal_palette+2).w,a2
  12553. move.w (CreditsScreenIndex).w,d0
  12554. cmpi.w #$24,d0
  12555. bhs.s -
  12556. btst #0,d0
  12557. bne.s -
  12558. lsr.w #1,d0
  12559. move.b byte_A0EC(pc,d0.w),d0
  12560. mulu.w #$18,d0
  12561. lea pal_A0FE(pc,d0.w),a1
  12562.  
  12563. moveq #5,d0
  12564. - move.l (a1)+,(a2)+
  12565. dbf d0,-
  12566.  
  12567. rts
  12568. ; End of function EndgameLogoFlash
  12569.  
  12570. ; ===========================================================================
  12571. byte_A0EC:
  12572. dc.b 0
  12573. dc.b 1 ; 1
  12574. dc.b 2 ; 2
  12575. dc.b 3 ; 3
  12576. dc.b 4 ; 4
  12577. dc.b 3 ; 5
  12578. dc.b 2 ; 6
  12579. dc.b 1 ; 7
  12580. dc.b 0 ; 8
  12581. dc.b 5 ; 9
  12582. dc.b 6 ; 10
  12583. dc.b 7 ; 11
  12584. dc.b 8 ; 12
  12585. dc.b 7 ; 13
  12586. dc.b 6 ; 14
  12587. dc.b 5 ; 15
  12588. dc.b 0 ; 16
  12589. dc.b 0 ; 17
  12590.  
  12591. ; palette cycle for the end-of-game logo
  12592. pal_A0FE: BINCLUDE "art/palettes/Ending Cycle.bin"
  12593.  
  12594. ; ===========================================================================
  12595. ; ----------------------------------------------------------------------------
  12596. ; Object CA - Cut scene at end of game
  12597. ; ----------------------------------------------------------------------------
  12598. ; Sprite_A1D6:
  12599. ObjCA:
  12600. addq.w #1,objoff_32(a0)
  12601. cmpi.w #4,(Ending_Routine).w
  12602. beq.s +
  12603. cmpi.w #2,(Ending_Routine).w
  12604. bne.s +
  12605. st (Super_Sonic_flag).w
  12606. move.w #$100,(Ring_count).w
  12607. move.b #-1,(Super_Sonic_palette).w
  12608. +
  12609. moveq #0,d0
  12610. move.b routine(a0),d0
  12611. move.w ObjCA_Index(pc,d0.w),d1
  12612. jmp ObjCA_Index(pc,d1.w)
  12613. ; ===========================================================================
  12614. ; off_A208:
  12615. ObjCA_Index: offsetTable
  12616. offsetTableEntry.w ObjCA_Init ; 0
  12617. offsetTableEntry.w loc_A240 ; 2
  12618. offsetTableEntry.w loc_A24E ; 4
  12619. offsetTableEntry.w loc_A240 ; 6
  12620. offsetTableEntry.w loc_A256 ; 8
  12621. offsetTableEntry.w loc_A30A ; $A
  12622. offsetTableEntry.w loc_A34C ; $C
  12623. offsetTableEntry.w loc_A38E ; $E
  12624. ; ===========================================================================
  12625. ; loc_A218:
  12626. ObjCA_Init:
  12627. moveq #4,d0
  12628. move.w #$180,d1
  12629. btst #6,(Graphics_Flags).w
  12630. beq.s sub_A22A
  12631. move.w #$100,d1
  12632.  
  12633. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  12634.  
  12635.  
  12636. sub_A22A:
  12637.  
  12638. lea (EndSeqPaletteChanger).w,a1
  12639. move.b #ObjID_TtlScrPalChanger,id(a1) ; load objC9 (palette change handler) at $FFFFB0C0
  12640. move.b d0,subtype(a1)
  12641. addq.b #2,routine(a0)
  12642. move.w d1,objoff_3C(a0)
  12643. rts
  12644. ; End of function sub_A22A
  12645.  
  12646. ; ===========================================================================
  12647.  
  12648. loc_A240:
  12649. subq.w #1,objoff_3C(a0)
  12650. bmi.s +
  12651. rts
  12652. ; ===========================================================================
  12653. +
  12654. addq.b #2,routine(a0)
  12655. rts
  12656. ; ===========================================================================
  12657.  
  12658. loc_A24E:
  12659. moveq #6,d0
  12660. move.w #$80,d1
  12661. bra.s sub_A22A
  12662. ; ===========================================================================
  12663.  
  12664. loc_A256:
  12665. move.w objoff_2E(a0),d0
  12666. cmpi.w #$10,d0
  12667. bhs.s +
  12668. addq.w #4,objoff_2E(a0)
  12669. clr.b routine(a0)
  12670. move.l a0,-(sp)
  12671. movea.l off_A29C(pc,d0.w),a0
  12672. lea (Chunk_Table).l,a1
  12673. move.w #make_art_tile(ArtTile_ArtNem_EndingPics,0,0),d0
  12674. jsrto (EniDec).l, JmpTo_EniDec
  12675. move #$2700,sr
  12676. lea (Chunk_Table).l,a1
  12677. move.l #vdpComm(VRAM_Plane_A_Name_Table + planeLocH40(14,8),VRAM,WRITE),d0
  12678. moveq #$B,d1
  12679. moveq #8,d2
  12680. jsrto (PlaneMapToVRAM_H40).l, JmpTo2_PlaneMapToVRAM_H40
  12681. move #$2300,sr
  12682. movea.l (sp)+,a0 ; load 0bj address
  12683. rts
  12684. ; ===========================================================================
  12685. off_A29C:
  12686. dc.l MapEng_Ending1
  12687. dc.l MapEng_Ending2
  12688. dc.l MapEng_Ending3
  12689. dc.l MapEng_Ending4
  12690. ; ===========================================================================
  12691. +
  12692. move.w #2,(Ending_VInt_Subrout).w
  12693. st (Control_Locked).w
  12694. st (Ending_PalCycle_flag).w
  12695. lea (MainCharacter).w,a1 ; a1=character
  12696. move.w (Ending_Routine).w,d0
  12697. move.w ObjCA_State5_States(pc,d0.w),d0
  12698. jsr ObjCA_State5_States(pc,d0.w)
  12699. move.w #$80,d1
  12700. bsr.w sub_A22A
  12701. move.w #$40,objoff_3C(a0)
  12702. rts
  12703. ; ===========================================================================
  12704. ObjCA_State5_States: offsetTable
  12705. offsetTableEntry.w loc_A2E0 ; 0
  12706. offsetTableEntry.w loc_A2EE ; 2
  12707. offsetTableEntry.w loc_A2F2 ; 4
  12708. ; ===========================================================================
  12709.  
  12710. loc_A2E0:
  12711. moveq #8,d0
  12712. -
  12713. move.b #ObjID_Sonic,id(a1) ; load Sonic object
  12714. move.b #$81,obj_control(a1)
  12715. rts
  12716. ; ===========================================================================
  12717.  
  12718. loc_A2EE:
  12719. moveq #$C,d0
  12720. bra.s -
  12721. ; ===========================================================================
  12722.  
  12723. loc_A2F2:
  12724. moveq #$E,d0
  12725. move.b #ObjID_Tails,id(a1) ; load Tails object
  12726. move.b #$81,obj_control(a1)
  12727. move.b #ObjID_TailsTails,(Tails_Tails_Cutscene+id).w ; load Obj05 (Tails' tails) at $FFFFB080
  12728. move.w a1,(Tails_Tails_Cutscene+parent).w
  12729. rts
  12730. ; ===========================================================================
  12731.  
  12732. loc_A30A:
  12733. subq.w #1,objoff_3C(a0)
  12734. bpl.s +
  12735. moveq #$A,d0
  12736. move.w #$80,d1
  12737. bsr.w sub_A22A
  12738. move.w #$C0,objoff_3C(a0)
  12739. +
  12740. lea (MainCharacter).w,a1 ; a1=character
  12741. move.b #AniIDSonAni_Float2,anim(a1)
  12742. move.w #$A0,x_pos(a1)
  12743. move.w #$50,y_pos(a1)
  12744. cmpi.w #2,(Ending_Routine).w
  12745. bne.s + ; rts
  12746. move.b #AniIDSonAni_Walk,anim(a1)
  12747. move.w #$1000,inertia(a1)
  12748. +
  12749. rts
  12750. ; ===========================================================================
  12751.  
  12752. loc_A34C:
  12753. subq.w #1,objoff_3C(a0)
  12754. bmi.s +
  12755. moveq #0,d4
  12756. moveq #0,d5
  12757. move.w #0,(Camera_X_pos_diff).w
  12758. move.w #$100,(Camera_Y_pos_diff).w
  12759. bra.w SwScrl_DEZ
  12760. ; ===========================================================================
  12761. +
  12762. addq.b #2,routine(a0)
  12763. move.w #$100,objoff_3C(a0)
  12764. cmpi.w #4,(Ending_Routine).w
  12765. bne.s return_A38C
  12766. move.w #$880,objoff_3C(a0)
  12767. btst #6,(Graphics_Flags).w
  12768. beq.s return_A38C
  12769. move.w #$660,objoff_3C(a0)
  12770.  
  12771. return_A38C:
  12772. rts
  12773. ; ===========================================================================
  12774.  
  12775. loc_A38E:
  12776. btst #6,(Graphics_Flags).w
  12777. beq.s +
  12778. cmpi.w #$E40,objoff_32(a0)
  12779. beq.s loc_A3BE
  12780. bra.w ++
  12781. ; ===========================================================================
  12782. +
  12783. cmpi.w #$1140,objoff_32(a0)
  12784. beq.s loc_A3BE
  12785. +
  12786. subq.w #1,objoff_3C(a0)
  12787. bne.s +
  12788. lea (word_AD62).l,a2
  12789. jsrto (LoadChildObject).l, JmpTo_LoadChildObject
  12790. +
  12791. bra.w loc_AB9C
  12792. ; ===========================================================================
  12793.  
  12794. loc_A3BE:
  12795. addq.b #2,routine(a0)
  12796. st (Credits_Trigger).w
  12797. rts
  12798. ; ===========================================================================
  12799. ; ----------------------------------------------------------------------------
  12800. ; Object CC - Trigger for rescue plane and birds from ending sequence
  12801. ; ----------------------------------------------------------------------------
  12802. ; Sprite_A3C8:
  12803. ObjCC:
  12804. jsrto (ObjB2_Animate_Pilot).l, JmpTo_ObjB2_Animate_Pilot
  12805. moveq #0,d0
  12806. move.b routine(a0),d0
  12807. move.w ObjCC_Index(pc,d0.w),d1
  12808. jmp ObjCC_Index(pc,d1.w)
  12809. ; ===========================================================================
  12810. ; loc_A3DA:
  12811. ObjCC_Index: offsetTable
  12812. offsetTableEntry.w ObjCC_Init ; 0
  12813. offsetTableEntry.w ObjCC_Main ; 2
  12814. ; ===========================================================================
  12815. ; loc_A3DE:
  12816. ObjCC_Init:
  12817. lea (ObjB2_SubObjData).l,a1
  12818. jsrto (LoadSubObject_Part3).l, JmpTo_LoadSubObject_Part3
  12819. cmpi.w #2,(Player_mode).w
  12820. bne.s +
  12821. move.b #4,mapping_frame(a0)
  12822. move.b #1,anim(a0)
  12823. +
  12824. move.w #-$10,x_pos(a0)
  12825. move.w #$C0,y_pos(a0)
  12826. move.w #$100,x_vel(a0)
  12827. move.w #-$80,y_vel(a0)
  12828. move.b #$14,objoff_35(a0)
  12829. move.b #3,priority(a0)
  12830. move.w #4,(Ending_VInt_Subrout).w
  12831. move.l a0,-(sp)
  12832. lea (MapEng_EndingTailsPlane).l,a0
  12833. cmpi.w #4,(Ending_Routine).w
  12834. bne.s +
  12835. lea (MapEng_EndingSonicPlane).l,a0
  12836. +
  12837. lea (Chunk_Table).l,a1
  12838. move.w #make_art_tile(ArtTile_ArtNem_EndingFinalTornado,0,1),d0
  12839. jsrto (EniDec).l, JmpTo_EniDec
  12840. movea.l (sp)+,a0 ; load 0bj address
  12841. move.w #$C00,(Normal_palette_line3).w
  12842. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  12843. ; ===========================================================================
  12844. ; loc_A456:
  12845. ObjCC_Main:
  12846. moveq #0,d0
  12847. move.b routine_secondary(a0),d0
  12848. move.w ObjCC_State2_States(pc,d0.w),d1
  12849. jsr ObjCC_State2_States(pc,d1.w)
  12850. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  12851. ; ===========================================================================
  12852. ObjCC_State2_States: offsetTable
  12853. offsetTableEntry.w loc_A474 ; 0
  12854. offsetTableEntry.w loc_A4B6 ; 2
  12855. offsetTableEntry.w loc_A5A6 ; 4
  12856. offsetTableEntry.w loc_A6C6 ; 6
  12857. offsetTableEntry.w loc_A7DE ; 8
  12858. offsetTableEntry.w loc_A83E ; $A
  12859. ; ===========================================================================
  12860.  
  12861. loc_A474:
  12862. cmpi.w #$A0,x_pos(a0)
  12863. beq.s +
  12864. jsrto (ObjectMove).l, JmpTo2_ObjectMove
  12865. -
  12866. lea (Ani_objB2_a).l,a1
  12867. jmpto (AnimateSprite).l, JmpTo_AnimateSprite
  12868. ; ===========================================================================
  12869. +
  12870. addq.b #2,routine_secondary(a0)
  12871. move.w #$480,objoff_3C(a0)
  12872. btst #6,(Graphics_Flags).w
  12873. beq.s +
  12874. move.w #$3D0,objoff_3C(a0)
  12875. +
  12876. move.w #$40,objoff_32(a0)
  12877. st (CutScene+objoff_34).w
  12878. clr.w x_vel(a0)
  12879. clr.w y_vel(a0)
  12880. bra.s -
  12881. ; ===========================================================================
  12882.  
  12883. loc_A4B6:
  12884. bsr.w sub_ABBA
  12885. bsr.w sub_A524
  12886. subq.w #1,objoff_3C(a0)
  12887. bmi.s +
  12888. bra.s -
  12889. ; ===========================================================================
  12890. +
  12891. addq.b #2,routine_secondary(a0)
  12892. move.w #2,objoff_3C(a0)
  12893. clr.w objoff_32(a0)
  12894. clr.b mapping_frame(a0)
  12895. cmpi.w #2,(Ending_Routine).w
  12896. beq.s +
  12897. move.b #7,mapping_frame(a0)
  12898. cmpi.w #4,(Ending_Routine).w
  12899. bne.s +
  12900. move.b #$18,mapping_frame(a0)
  12901. +
  12902. clr.b anim(a0)
  12903. clr.b anim_frame(a0)
  12904. clr.b anim_frame_duration(a0)
  12905. move.l #ObjCF_MapUnc_ADA2,mappings(a0)
  12906. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  12907. jsr (Adjust2PArtPointer).l
  12908. subi.w #$14,x_pos(a0)
  12909. addi.w #$14,y_pos(a0)
  12910. bra.w sub_A58C
  12911.  
  12912. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  12913.  
  12914.  
  12915. sub_A524:
  12916. lea (MainCharacter).w,a1 ; a1=character
  12917. move.w (Ending_Routine).w,d0
  12918. move.w off_A534(pc,d0.w),d0
  12919. jmp off_A534(pc,d0.w)
  12920. ; End of function sub_A524
  12921.  
  12922. ; ===========================================================================
  12923. off_A534: offsetTable
  12924. offsetTableEntry.w loc_A53A ; 0
  12925. offsetTableEntry.w loc_A55C ; 2
  12926. offsetTableEntry.w loc_A582 ; 4
  12927. ; ===========================================================================
  12928.  
  12929. loc_A53A:
  12930. move.w y_pos(a0),d0
  12931. subi.w #$1C,d0
  12932. -
  12933. move.w d0,y_pos(a1)
  12934. move.w x_pos(a0),x_pos(a1)
  12935. move.l #$1000505,mapping_frame(a1)
  12936. move.w #$100,anim_frame_duration(a1)
  12937. rts
  12938. ; ===========================================================================
  12939.  
  12940. loc_A55C:
  12941. tst.w objoff_32(a0)
  12942. beq.s +
  12943. subq.w #1,objoff_32(a0)
  12944. addi.l #$8000,x_pos(a1)
  12945. addq.w #1,y_pos(a1)
  12946. rts
  12947. ; ===========================================================================
  12948. +
  12949. move.w #$C0,x_pos(a1)
  12950. move.w #$90,y_pos(a1)
  12951. rts
  12952. ; ===========================================================================
  12953.  
  12954. loc_A582:
  12955. move.w y_pos(a0),d0
  12956. subi.w #$18,d0
  12957. bra.s -
  12958.  
  12959. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  12960.  
  12961.  
  12962. sub_A58C:
  12963. tst.b (Super_Sonic_flag).w
  12964. bne.w return_A38C
  12965.  
  12966. loc_A594:
  12967. lea (MainCharacter).w,a1 ; a1=character
  12968. move.w #$200,x_pos(a1)
  12969. move.w #0,y_pos(a1)
  12970. rts
  12971. ; End of function sub_A58C
  12972.  
  12973. ; ===========================================================================
  12974.  
  12975. loc_A5A6:
  12976. bsr.s sub_A58C
  12977. subq.w #1,objoff_3C(a0)
  12978. bpl.s + ; rts
  12979. move.w #2,objoff_3C(a0)
  12980. move.w objoff_32(a0),d0
  12981. cmpi.w #$1C,d0
  12982. bhs.s ++
  12983. addq.w #1,objoff_32(a0)
  12984. move.w (Ending_Routine).w,d1
  12985. move.w off_A5FC(pc,d1.w),d1
  12986. lea off_A5FC(pc,d1.w),a1
  12987. move.b (a1,d0.w),mapping_frame(a0)
  12988. add.w d0,d0
  12989. add.w d0,d0
  12990. move.l word_A656(pc,d0.w),d1
  12991. move.w d1,y_pos(a0)
  12992. swap d1
  12993. move.w d1,x_pos(a0)
  12994. +
  12995. rts
  12996. ; ===========================================================================
  12997. +
  12998. addq.b #2,routine_secondary(a0)
  12999. move.w #$60,objoff_3C(a0)
  13000. clr.b objoff_31(a0)
  13001. clr.w objoff_32(a0)
  13002. rts
  13003. ; ===========================================================================
  13004. off_A5FC: offsetTable
  13005. offsetTableEntry.w byte_A602 ; 0
  13006. offsetTableEntry.w byte_A61E ; 2
  13007. offsetTableEntry.w byte_A63A ; 4
  13008. byte_A602:
  13009. dc.b 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, $A, $A
  13010. dc.b $A, $B, $B, $B, $B, $B, $B, $B, $B, $B, $B, $B; 16
  13011. byte_A61E:
  13012. dc.b 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3
  13013. dc.b 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4; 16
  13014. byte_A63A:
  13015. dc.b $18,$18,$18,$18,$19,$19,$19,$19,$19,$19,$19, 9, 9, 9, $A, $A
  13016. dc.b $A, $B, $B, $B, $B, $B, $B, $B, $B, $B, $B, $B; 16
  13017. word_A656:
  13018. dc.w $A0, $70, $B0, $70, $B6, $71, $BC, $72
  13019. dc.w $C4, $74, $C8, $75, $CA, $76, $CC, $77; 8
  13020. dc.w $CE, $78, $D0, $79, $D2, $7A, $D4, $7B; 16
  13021. dc.w $D6, $7C, $D9, $7E, $DC, $81, $DE, $84; 24
  13022. dc.w $E1, $87, $E4, $8B, $E7, $8F, $EC, $94; 32
  13023. dc.w $F0, $99, $F5, $9D, $F9, $A4, $100, $AC; 40
  13024. dc.w $108, $B8, $112, $C4, $11F, $D3, $12C, $FA; 48
  13025. ; ===========================================================================
  13026.  
  13027. loc_A6C6:
  13028. subq.w #1,objoff_3C(a0)
  13029. bmi.s loc_A720
  13030. tst.b (Super_Sonic_flag).w
  13031. beq.s + ; rts
  13032. subq.b #1,objoff_31(a0)
  13033. bpl.s + ; rts
  13034. addq.b #3,objoff_31(a0)
  13035. move.w objoff_32(a0),d0
  13036. addq.w #4,objoff_32(a0)
  13037. cmpi.w #$78,d0
  13038. bhs.s + ; rts
  13039. cmpi.w #$C,d0
  13040. blo.s ++
  13041. bsr.w loc_A594
  13042. move.l word_A766(pc,d0.w),d1
  13043. move.w d1,y_pos(a0)
  13044. swap d1
  13045. move.w d1,x_pos(a0)
  13046. lsr.w #2,d0
  13047. move.b byte_A748(pc,d0.w),mapping_frame(a0)
  13048. +
  13049. rts
  13050. ; ===========================================================================
  13051. +
  13052. move.l word_A766(pc,d0.w),d0
  13053. lea (MainCharacter).w,a1 ; a1=character
  13054. move.w d0,y_pos(a1)
  13055. swap d0
  13056. move.w d0,x_pos(a1)
  13057. rts
  13058. ; ===========================================================================
  13059.  
  13060. loc_A720:
  13061. addq.b #2,routine_secondary(a0)
  13062. clr.w objoff_3C(a0)
  13063. clr.w objoff_32(a0)
  13064. lea (word_AD6E).l,a2
  13065. jsrto (LoadChildObject).l, JmpTo_LoadChildObject
  13066. tst.b (Super_Sonic_flag).w
  13067. bne.w return_A38C
  13068. lea (word_AD6A).l,a2
  13069. jmpto (LoadChildObject).l, JmpTo_LoadChildObject
  13070. ; ===========================================================================
  13071. byte_A748:
  13072. dc.b $12,$12,$12,$12,$12,$12,$12,$13,$13,$13,$13,$13,$13,$14,$14,$14
  13073. dc.b $14,$15,$15,$15,$16,$16,$16,$16,$16,$16,$16,$16,$16, 0; 16
  13074. word_A766:
  13075. dc.w $C0, $90 ; 1
  13076. dc.w $B0, $91 ; 3
  13077. dc.w $A8, $92 ; 5
  13078. dc.w $9B, $96 ; 7
  13079. dc.w $99, $98 ; 9
  13080. dc.w $98, $99 ; 11
  13081. dc.w $99, $9A ; 13
  13082. dc.w $9B, $9C ; 15
  13083. dc.w $9F, $9E ; 17
  13084. dc.w $A4, $A0 ; 19
  13085. dc.w $AC, $A2 ; 21
  13086. dc.w $B7, $A5 ; 23
  13087. dc.w $C4, $A8 ; 25
  13088. dc.w $D3, $AB ; 27
  13089. dc.w $DE, $AE ; 29
  13090. dc.w $E8, $B0 ; 31
  13091. dc.w $EF, $B2 ; 33
  13092. dc.w $F4, $B5 ; 35
  13093. dc.w $F9, $B8 ; 37
  13094. dc.w $FC, $BB ; 39
  13095. dc.w $FE, $BE ; 41
  13096. dc.w $FF, $C0 ; 43
  13097. dc.w $100, $C2 ; 45
  13098. dc.w $101, $C5 ; 47
  13099. dc.w $102, $C8 ; 49
  13100. dc.w $102, $CC ; 51
  13101. dc.w $101, $D1 ; 53
  13102. dc.w $FD, $D7 ; 55
  13103. dc.w $F9, $DE ; 57
  13104. dc.w $F9,$118 ; 59
  13105. ; ===========================================================================
  13106.  
  13107. loc_A7DE:
  13108. bsr.w loc_A594
  13109. subq.w #1,objoff_3C(a0)
  13110. bpl.s + ; rts
  13111. move.w #2,objoff_3C(a0)
  13112. move.w objoff_32(a0),d0
  13113. cmpi.w #$1C,d0
  13114. bhs.s ++
  13115. addq.w #4,objoff_32(a0)
  13116. lea word_A822(pc,d0.w),a1
  13117. move.w (a1)+,d0
  13118. add.w d0,(Horiz_Scroll_Buf).w
  13119. move.w (a1)+,d0
  13120. add.w d0,(Vscroll_Factor_FG).w
  13121. +
  13122. rts
  13123. ; ===========================================================================
  13124. +
  13125. addq.b #2,routine_secondary(a0)
  13126. bset #3,status(a0)
  13127. clr.b objoff_31(a0)
  13128. clr.w objoff_32(a0)
  13129. rts
  13130. ; ===========================================================================
  13131. word_A822:
  13132. dc.w -$3A
  13133. dc.w $88 ; 1
  13134. dc.w -$C ; 2
  13135. dc.w $22 ; 3
  13136. dc.w -8 ; 4
  13137. dc.w $10 ; 5
  13138. dc.w -4 ; 6
  13139. dc.w 8 ; 7
  13140. dc.w -2 ; 8
  13141. dc.w 4 ; 9
  13142. dc.w -1 ; 10
  13143. dc.w 2 ; 11
  13144. dc.w -1 ; 12
  13145. dc.w 2 ; 13
  13146. ; ===========================================================================
  13147.  
  13148. loc_A83E:
  13149. tst.b (Super_Sonic_flag).w
  13150. beq.w return_A38C
  13151. move.b #$17,mapping_frame(a0)
  13152. subq.b #1,objoff_31(a0)
  13153. bpl.s + ; rts
  13154. addq.b #3,objoff_31(a0)
  13155. move.w objoff_32(a0),d0
  13156. cmpi.w #$20,d0
  13157. bhs.s + ; rts
  13158. addq.w #4,objoff_32(a0)
  13159. move.l word_A874(pc,d0.w),d1
  13160. move.w d1,y_pos(a0)
  13161. swap d1
  13162. move.w d1,x_pos(a0)
  13163. +
  13164. rts
  13165. ; ===========================================================================
  13166. word_A874:
  13167. dc.w $60,$88 ; 1
  13168. dc.w $50,$68 ; 3
  13169. dc.w $44,$46 ; 5
  13170. dc.w $3C,$36 ; 7
  13171. dc.w $36,$2A ; 9
  13172. dc.w $33,$24 ; 11
  13173. dc.w $31,$20 ; 13
  13174. dc.w $30,$1E ; 15
  13175.  
  13176. ; ===========================================================================
  13177. ; ----------------------------------------------------------------------------
  13178. ; Object CE - Sonic and Tails jumping off the plane from ending sequence
  13179. ; ----------------------------------------------------------------------------
  13180. ; Sprite_A894:
  13181. ObjCE:
  13182. moveq #0,d0
  13183. move.b routine(a0),d0
  13184. move.w ObjCE_Index(pc,d0.w),d1
  13185. jmp ObjCE_Index(pc,d1.w)
  13186. ; ===========================================================================
  13187. ; off_A8A2:
  13188. ObjCE_Index: offsetTable
  13189. offsetTableEntry.w ObjCE_Init ; 0
  13190. offsetTableEntry.w loc_A902 ; 2
  13191. offsetTableEntry.w loc_A936 ; 4
  13192. offsetTableEntry.w BranchTo_JmpTo5_DisplaySprite ; 6
  13193. ; ===========================================================================
  13194. ; loc_A8AA:
  13195. ObjCE_Init:
  13196. lea (ObjB3_SubObjData).l,a1
  13197. jsrto (LoadSubObject_Part3).l, JmpTo_LoadSubObject_Part3
  13198. move.l #ObjCF_MapUnc_ADA2,mappings(a0)
  13199. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,1),art_tile(a0)
  13200. move.b #1,priority(a0)
  13201. jsr (Adjust2PArtPointer).l
  13202. move.b #$C,mapping_frame(a0)
  13203. cmpi.w #4,(Ending_Routine).w
  13204. bne.s +
  13205. move.b #$F,mapping_frame(a0)
  13206. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,1,1),art_tile(a0)
  13207. +
  13208. move.w #$E8,d0
  13209. move.w d0,x_pos(a0)
  13210. move.w d0,objoff_30(a0)
  13211. move.w #$118,d0
  13212. move.w d0,y_pos(a0)
  13213. move.w d0,objoff_32(a0)
  13214. rts
  13215. ; ===========================================================================
  13216.  
  13217. loc_A902:
  13218. movea.w objoff_2C(a0),a1 ; a1=object
  13219. btst #3,status(a1)
  13220. bne.s +
  13221.  
  13222. loc_A90E:
  13223. move.w objoff_30(a0),d0
  13224. add.w (Horiz_Scroll_Buf).w,d0
  13225. move.w d0,x_pos(a0)
  13226. move.w objoff_32(a0),d0
  13227. sub.w (Vscroll_Factor_FG).w,d0
  13228. move.w d0,y_pos(a0)
  13229.  
  13230. BranchTo_JmpTo5_DisplaySprite
  13231. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  13232. ; ===========================================================================
  13233. +
  13234. addq.b #2,routine(a0)
  13235. clr.w objoff_3C(a0)
  13236. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  13237. ; ===========================================================================
  13238.  
  13239. loc_A936:
  13240. subq.w #1,objoff_3C(a0)
  13241. bpl.s BranchTo2_JmpTo5_DisplaySprite
  13242. move.w #4,objoff_3C(a0)
  13243. move.w objoff_34(a0),d0
  13244. cmpi.w #4,d0
  13245. bhs.s ++
  13246. addq.w #2,objoff_34(a0)
  13247. lea byte_A980(pc,d0.w),a1
  13248. cmpi.w #2,(Ending_Routine).w
  13249. bne.s +
  13250. lea byte_A984(pc,d0.w),a1
  13251. +
  13252. move.b (a1)+,d0
  13253. ext.w d0
  13254. add.w d0,x_pos(a0)
  13255. move.b (a1)+,d0
  13256. ext.w d0
  13257. add.w d0,y_pos(a0)
  13258. addq.b #1,mapping_frame(a0)
  13259.  
  13260. BranchTo2_JmpTo5_DisplaySprite
  13261. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  13262. ; ===========================================================================
  13263. +
  13264. addq.b #2,routine(a0)
  13265. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  13266. ; ===========================================================================
  13267. byte_A980:
  13268. dc.b -8, 0
  13269. dc.b -$44,-$38 ; 2
  13270. byte_A984:
  13271. dc.b -8, 0
  13272. dc.b -$50,-$40 ; 2
  13273. ; ===========================================================================
  13274. ; ----------------------------------------------------------------------------
  13275. ; Object CF - "Plane's helixes" from ending sequence
  13276. ; ----------------------------------------------------------------------------
  13277. ; Sprite_A988:
  13278. ObjCF:
  13279. moveq #0,d0
  13280. move.b routine(a0),d0
  13281. move.w ObjCF_Index(pc,d0.w),d1
  13282. jmp ObjCF_Index(pc,d1.w)
  13283. ; ===========================================================================
  13284. ; off_A996:
  13285. ObjCF_Index: offsetTable
  13286. offsetTableEntry.w ObjCF_Init ; 0
  13287. offsetTableEntry.w ObjCF_Animate ; 2
  13288. ; ===========================================================================
  13289. ; loc_A99A:
  13290. ObjCF_Init:
  13291. lea (ObjB3_SubObjData).l,a1
  13292. jsrto (LoadSubObject_Part3).l, JmpTo_LoadSubObject_Part3
  13293. move.l #ObjCF_MapUnc_ADA2,mappings(a0)
  13294. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,1),art_tile(a0)
  13295. move.b #3,priority(a0)
  13296. jsr (Adjust2PArtPointer).l
  13297. move.b #5,mapping_frame(a0)
  13298. move.b #2,anim(a0)
  13299. move.w #$10F,d0
  13300. move.w d0,x_pos(a0)
  13301. move.w d0,objoff_30(a0)
  13302. move.w #$15E,d0
  13303. move.w d0,y_pos(a0)
  13304. move.w d0,objoff_32(a0)
  13305. rts
  13306. ; ===========================================================================
  13307. ; loc_A9E4:
  13308. ObjCF_Animate:
  13309. lea (Ani_objCF).l,a1
  13310. jsrto (AnimateSprite).l, JmpTo_AnimateSprite
  13311. bra.w loc_A90E
  13312. ; ===========================================================================
  13313. ; ----------------------------------------------------------------------------
  13314. ; Object CB - Background clouds from ending sequence
  13315. ; ----------------------------------------------------------------------------
  13316. ; Sprite_A9F2:
  13317. ObjCB:
  13318. moveq #0,d0
  13319. move.b routine(a0),d0
  13320. move.w ObjCB_Index(pc,d0.w),d1
  13321. jmp ObjCB_Index(pc,d1.w)
  13322. ; ===========================================================================
  13323. ; off_AA00:
  13324. ObjCB_Index: offsetTable
  13325. offsetTableEntry.w ObjCB_Init ; 0
  13326. offsetTableEntry.w loc_AA76 ; 2
  13327. offsetTableEntry.w loc_AA8A ; 4
  13328. ; ===========================================================================
  13329. ; loc_AA06:
  13330. ObjCB_Init:
  13331. lea (ObjB3_SubObjData).l,a1
  13332. jsrto (LoadSubObject_Part3).l, JmpTo_LoadSubObject_Part3
  13333. move.w art_tile(a0),d0
  13334. andi.w #$1FFF,d0
  13335. ori.w #palette_mask,d0
  13336. move.w d0,art_tile(a0)
  13337. move.b #$30,width_pixels(a0)
  13338. move.l (RNG_seed).w,d0
  13339. ror.l #1,d0
  13340. move.l d0,(RNG_seed).w
  13341. move.w d0,d1
  13342. andi.w #3,d0
  13343. move.b ObjCB_Frames(pc,d0.w),mapping_frame(a0)
  13344. add.w d0,d0
  13345. move.w ObjCB_YSpeeds(pc,d0.w),y_vel(a0)
  13346. tst.b (CutScene+$34).w
  13347. beq.s +
  13348. andi.w #$FF,d1
  13349. move.w d1,y_pos(a0)
  13350. move.w #$150,x_pos(a0)
  13351. rts
  13352. ; ===========================================================================
  13353. +
  13354. andi.w #$1FF,d1
  13355. move.w d1,x_pos(a0)
  13356. move.w #$100,y_pos(a0)
  13357. rts
  13358. ; ===========================================================================
  13359. ; byte_AA6A:
  13360. ObjCB_Frames:
  13361. dc.b 0
  13362. dc.b 1 ; 1
  13363. dc.b 2 ; 2
  13364. dc.b 0 ; 3
  13365. ; word_AA6E:
  13366. ObjCB_YSpeeds:
  13367. dc.w -$300
  13368. dc.w -$200 ; 1
  13369. dc.w -$100 ; 2
  13370. dc.w -$300 ; 3
  13371. ; ===========================================================================
  13372.  
  13373. loc_AA76:
  13374. tst.b (CutScene+objoff_34).w
  13375. beq.s loc_AA8A
  13376. addq.b #2,routine(a0)
  13377. move.w y_vel(a0),x_vel(a0)
  13378. clr.w y_vel(a0)
  13379.  
  13380. loc_AA8A:
  13381. jsrto (ObjectMove).l, JmpTo2_ObjectMove
  13382. tst.b (CutScene+objoff_34).w
  13383. beq.s +
  13384. cmpi.w #-$20,x_pos(a0)
  13385. blt.w JmpTo3_DeleteObject
  13386. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  13387. ; ===========================================================================
  13388. +
  13389. tst.w y_pos(a0)
  13390. bmi.w JmpTo3_DeleteObject
  13391. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  13392. ; ===========================================================================
  13393. ; ----------------------------------------------------------------------------
  13394. ; Object CD - Birds from ending sequence
  13395. ; ----------------------------------------------------------------------------
  13396. endingbird_delay = objoff_3C ; delay before doing the next action
  13397. ; Sprite_AAAE:
  13398. ObjCD:
  13399. moveq #0,d0
  13400. move.b routine(a0),d0
  13401. move.w ObjCD_Index(pc,d0.w),d1
  13402. jmp ObjCD_Index(pc,d1.w)
  13403. ; ===========================================================================
  13404. ; off_AABC:
  13405. ObjCD_Index: offsetTable
  13406. offsetTableEntry.w ObjCD_Init ; 0
  13407. offsetTableEntry.w ObjCD_Main ; 2
  13408. ; ===========================================================================
  13409. ; loc_AAC0:
  13410. ObjCD_Init:
  13411. lea (Obj28_SubObjData).l,a1
  13412. jsrto (LoadSubObject_Part3).l, JmpTo_LoadSubObject_Part3
  13413. move.l (RNG_seed).w,d0
  13414. ror.l #3,d0
  13415. move.l d0,(RNG_seed).w
  13416. move.l d0,d1
  13417. andi.w #$7F,d0
  13418. move.w #-$A0,d2
  13419. add.w d0,d2
  13420. move.w d2,x_pos(a0)
  13421. ror.l #3,d1
  13422. andi.w #$FF,d1
  13423. moveq #8,d2
  13424. add.w d1,d2
  13425. move.w d2,y_pos(a0)
  13426. move.w #$100,x_vel(a0)
  13427. moveq #$20,d0
  13428. cmpi.w #$20,d1
  13429. blo.s +
  13430. neg.w d0
  13431. +
  13432. move.w d0,y_vel(a0)
  13433. move.w #$C0,endingbird_delay(a0)
  13434. rts
  13435. ; ===========================================================================
  13436. ; loc_AB0E:
  13437. ObjCD_Main:
  13438. moveq #0,d0
  13439. move.b routine_secondary(a0),d0
  13440. move.w ObjCD_Main_States(pc,d0.w),d1
  13441. jsr ObjCD_Main_States(pc,d1.w)
  13442. jsrto (ObjectMove).l, JmpTo2_ObjectMove
  13443. lea (Ani_objCD).l,a1
  13444. jsrto (AnimateSprite).l, JmpTo_AnimateSprite
  13445. jmpto (DisplaySprite).l, JmpTo5_DisplaySprite
  13446. ; ===========================================================================
  13447. ObjCD_Main_States: offsetTable
  13448. offsetTableEntry.w loc_AB34 ; 0
  13449. offsetTableEntry.w loc_AB5C ; 2
  13450. offsetTableEntry.w loc_AB8E ; 4
  13451. ; ===========================================================================
  13452.  
  13453. loc_AB34:
  13454. subq.w #1,endingbird_delay(a0)
  13455. bpl.s + ; rts
  13456. addq.b #2,routine_secondary(a0)
  13457. move.w y_vel(a0),objoff_2E(a0)
  13458. clr.w x_vel(a0)
  13459. move.w y_pos(a0),objoff_32(a0)
  13460. move.w #$80,y_vel(a0)
  13461. move.w #$180,endingbird_delay(a0)
  13462. +
  13463. rts
  13464. ; ===========================================================================
  13465.  
  13466. loc_AB5C:
  13467. subq.w #1,endingbird_delay(a0)
  13468. bmi.s ++
  13469. move.w y_pos(a0),d0
  13470. moveq #-4,d1
  13471. cmp.w objoff_32(a0),d0
  13472. bhs.s +
  13473. neg.w d1
  13474. +
  13475. add.w d1,y_vel(a0)
  13476. rts
  13477. ; ===========================================================================
  13478. +
  13479. addq.b #2,routine_secondary(a0)
  13480. move.w #-$100,x_vel(a0)
  13481. move.w objoff_2E(a0),y_vel(a0)
  13482. move.w #$C0,endingbird_delay(a0)
  13483. rts
  13484. ; ===========================================================================
  13485.  
  13486. loc_AB8E:
  13487. subq.w #1,endingbird_delay(a0)
  13488. bmi.s +
  13489. rts
  13490. ; ===========================================================================
  13491. +
  13492. addq.w #4,sp
  13493.  
  13494. if removeJmpTos
  13495. JmpTo3_DeleteObject
  13496. endif
  13497.  
  13498. jmpto (DeleteObject).l, JmpTo3_DeleteObject
  13499. ; ===========================================================================
  13500.  
  13501. loc_AB9C:
  13502. subq.w #1,objoff_30(a0)
  13503. bpl.s + ; rts
  13504. move.l (RNG_seed).w,d0
  13505. andi.w #$1F,d0
  13506. move.w d0,objoff_30(a0)
  13507. lea (word_AD5E).l,a2
  13508. jsrto (LoadChildObject).l, JmpTo_LoadChildObject
  13509. +
  13510. rts
  13511.  
  13512. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  13513.  
  13514.  
  13515. sub_ABBA:
  13516. subq.w #1,objoff_30(a0)
  13517. bpl.s + ; rts
  13518. tst.b objoff_35(a0)
  13519. beq.s + ; rts
  13520. subq.b #1,objoff_35(a0)
  13521. move.l (RNG_seed).w,d0
  13522. andi.w #$F,d0
  13523. move.w d0,objoff_30(a0)
  13524. lea (word_AD66).l,a2
  13525. jsrto (LoadChildObject).l, JmpTo_LoadChildObject
  13526. + rts
  13527. ; End of function sub_ABBA
  13528.  
  13529.  
  13530. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  13531.  
  13532.  
  13533. ; sub_ABE2:
  13534. EndingSequence_LoadCharacterArt:
  13535. move.w (Ending_Routine).w,d0
  13536. move.w EndingSequence_LoadCharacterArt_Characters(pc,d0.w),d0
  13537. jmp EndingSequence_LoadCharacterArt_Characters(pc,d0.w)
  13538. ; End of function EndingSequence_LoadCharacterArt
  13539.  
  13540. ; ===========================================================================
  13541. EndingSequence_LoadCharacterArt_Characters: offsetTable
  13542. offsetTableEntry.w EndingSequence_LoadCharacterArt_Sonic ; 0
  13543. offsetTableEntry.w EndingSequence_LoadCharacterArt_SuperSonic ; 2
  13544. offsetTableEntry.w EndingSequence_LoadCharacterArt_Tails ; 4
  13545. ; ===========================================================================
  13546. ; loc_ABF4:
  13547. EndingSequence_LoadCharacterArt_Sonic:
  13548. move.l #vdpComm(tiles_to_bytes(ArtTile_EndingCharacter),VRAM,WRITE),(VDP_control_port).l
  13549. lea (ArtNem_EndingSonic).l,a0
  13550. jmpto (NemDec).l, JmpTo_NemDec
  13551. ; ===========================================================================
  13552. ; loc_AC08:
  13553. EndingSequence_LoadCharacterArt_SuperSonic:
  13554. move.l #vdpComm(tiles_to_bytes(ArtTile_EndingCharacter),VRAM,WRITE),(VDP_control_port).l
  13555. lea (ArtNem_EndingSuperSonic).l,a0
  13556. jmpto (NemDec).l, JmpTo_NemDec
  13557. ; ===========================================================================
  13558. ; loc_AC1C:
  13559. EndingSequence_LoadCharacterArt_Tails:
  13560. move.l #vdpComm(tiles_to_bytes(ArtTile_EndingCharacter),VRAM,WRITE),(VDP_control_port).l
  13561. lea (ArtNem_EndingTails).l,a0
  13562. jmpto (NemDec).l, JmpTo_NemDec
  13563.  
  13564. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  13565.  
  13566.  
  13567. ; sub_AC30:
  13568. EndingSequence_LoadFlickyArt:
  13569. move.w (Ending_Routine).w,d0
  13570. move.w EndingSequence_LoadFlickyArt_Flickies(pc,d0.w),d0
  13571. jmp EndingSequence_LoadFlickyArt_Flickies(pc,d0.w)
  13572. ; End of function EndingSequence_LoadFlickyArt
  13573.  
  13574. ; ===========================================================================
  13575. EndingSequence_LoadFlickyArt_Flickies: offsetTable
  13576. offsetTableEntry.w EndingSequence_LoadFlickyArt_Bird ; 0
  13577. offsetTableEntry.w EndingSequence_LoadFlickyArt_Eagle ; 2
  13578. offsetTableEntry.w EndingSequence_LoadFlickyArt_Chicken ; 4
  13579. ; ===========================================================================
  13580. ; loc_AC42:
  13581. EndingSequence_LoadFlickyArt_Bird:
  13582. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Animal_2),VRAM,WRITE),(VDP_control_port).l
  13583. lea (ArtNem_Bird).l,a0
  13584. jmpto (NemDec).l, JmpTo_NemDec
  13585. ; ===========================================================================
  13586. ; loc_AC56:
  13587. EndingSequence_LoadFlickyArt_Eagle:
  13588. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Animal_2),VRAM,WRITE),(VDP_control_port).l
  13589. lea (ArtNem_Eagle).l,a0
  13590. jmpto (NemDec).l, JmpTo_NemDec
  13591. ; ===========================================================================
  13592. ; loc_AC6A:
  13593. EndingSequence_LoadFlickyArt_Chicken:
  13594. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_Animal_2),VRAM,WRITE),(VDP_control_port).l
  13595. lea (ArtNem_Chicken).l,a0
  13596. jmpto (NemDec).l, JmpTo_NemDec
  13597. ; ===========================================================================
  13598. Pal_AC7E: BINCLUDE "art/palettes/Ending Sonic.bin"
  13599. Pal_AC9E: BINCLUDE "art/palettes/Ending Sonic Far.bin"
  13600. Pal_ACDE: BINCLUDE "art/palettes/Ending Background.bin"
  13601. Pal_AD1E: BINCLUDE "art/palettes/Ending Photos.bin"
  13602. Pal_AD3E: BINCLUDE "art/palettes/Ending Super Sonic.bin"
  13603.  
  13604. word_AD5E:
  13605. dc.w objoff_3E
  13606. dc.b ObjID_EndingSeqClouds
  13607. dc.b $00
  13608. word_AD62:
  13609. dc.w objoff_3E
  13610. dc.b ObjID_EndingSeqTrigger
  13611. dc.b $00
  13612. word_AD66:
  13613. dc.w objoff_3E
  13614. dc.b ObjID_EndingSeqBird
  13615. dc.b $00
  13616. word_AD6A:
  13617. dc.w objoff_3E
  13618. dc.b ObjID_EndingSeqSonic
  13619. dc.b $00
  13620. word_AD6E:
  13621. dc.w objoff_3E
  13622. dc.b ObjID_TornadoHelixes
  13623. dc.b $00
  13624.  
  13625. ; off_AD72:
  13626. Obj28_SubObjData:
  13627. subObjData Obj28_MapUnc_11E1C,make_art_tile(ArtTile_ArtNem_Animal_2,0,0),4,2,8,0
  13628.  
  13629. ; animation script
  13630. ; byte_AD7C
  13631. Ani_objCD: offsetTable
  13632. offsetTableEntry.w byte_AD7E ; 0
  13633. byte_AD7E: dc.b 5, 0, 1,$FF
  13634.  
  13635. ; animation script
  13636. ; off_AD82
  13637. Ani_objCF: offsetTable
  13638. offsetTableEntry.w byte_AD88 ; 0
  13639. offsetTableEntry.w byte_AD8E ; 1
  13640. offsetTableEntry.w byte_AD9E ; 2
  13641. byte_AD88: dc.b 3, 0, 0, 1,$FA, 0
  13642. byte_AD8E: dc.b 3, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 4,$FA, 0
  13643. byte_AD9E: dc.b 1, 5, 6,$FF
  13644. even
  13645. ; -----------------------------------------------------------------------------
  13646. ; sprite mappings
  13647. ; -----------------------------------------------------------------------------
  13648. ObjCF_MapUnc_ADA2: BINCLUDE "mappings/sprite/objCF.bin"
  13649. ; --------------------------------------------------------------------------------------
  13650. ; Enigma compressed art mappings
  13651. ; "Sonic the Hedgehog 2" mappings ; MapEng_B23A:
  13652. MapEng_EndGameLogo: BINCLUDE "mappings/misc/Sonic 2 end of game logo.bin"
  13653. even
  13654.  
  13655. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  13656.  
  13657.  
  13658. ;sub_B262
  13659. ShowCreditsScreen:
  13660. lea off_B2CA(pc),a1
  13661. move.w (CreditsScreenIndex).w,d0
  13662. lsl.w #2,d0
  13663. move.l (a1,d0.w),d0
  13664. movea.l d0,a1
  13665.  
  13666. loc_B272:
  13667. move #$2700,sr
  13668. lea (VDP_data_port).l,a6
  13669. -
  13670. move.l (a1)+,d0
  13671. bmi.s ++
  13672. movea.l d0,a2
  13673. move.w (a1)+,d0
  13674. bsr.s sub_B29E
  13675. move.l d0,4(a6)
  13676. move.b (a2)+,d0
  13677. lsl.w #8,d0
  13678. -
  13679. move.b (a2)+,d0
  13680. bmi.s +
  13681. move.w d0,(a6)
  13682. bra.s -
  13683. ; ===========================================================================
  13684. + bra.s --
  13685. ; ===========================================================================
  13686. +
  13687. move #$2300,sr
  13688. rts
  13689. ; End of function ShowCreditsScreen
  13690.  
  13691.  
  13692. ; ---------------------------------------------------------------------------
  13693. ; Subroutine to convert a VRAM address into a 32-bit VRAM write command word
  13694. ; Input:
  13695. ; d0 VRAM address (word)
  13696. ; Output:
  13697. ; d0 32-bit VDP command word for a VRAM write to specified address.
  13698. ; ---------------------------------------------------------------------------
  13699.  
  13700. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  13701.  
  13702.  
  13703. sub_B29E:
  13704. andi.l #$FFFF,d0
  13705. lsl.l #2,d0
  13706. lsr.w #2,d0
  13707. ori.w #vdpComm($0000,VRAM,WRITE)>>16,d0
  13708. swap d0
  13709. rts
  13710. ; End of function sub_B29E
  13711.  
  13712. ; ===========================================================================
  13713.  
  13714. ; macro for declaring pointer/position structures for intro/credit text
  13715. vram_pnt := VRAM_Plane_A_Name_Table
  13716. creditsPtrs macro addr,pos
  13717. if "addr"<>""
  13718. dc.l addr
  13719. dc.w vram_pnt + pos
  13720. shift
  13721. shift
  13722. creditsPtrs ALLARGS
  13723. else
  13724. dc.w -1
  13725. endif
  13726. endm
  13727.  
  13728. textLoc function col,line,(($80 * line) + (2 * col))
  13729.  
  13730. ; intro text pointers (one intro screen)
  13731. vram_pnt := VRAM_TtlScr_Plane_A_Name_Table
  13732. off_B2B0: creditsPtrs byte_BD1A,textLoc($0F,$09), byte_BCEE,textLoc($11,$0C), \
  13733. byte_BCF6,textLoc($03,$0F), byte_BCE9,textLoc($12,$12)
  13734.  
  13735. ; credits screen pointer table
  13736. off_B2CA:
  13737. dc.l off_B322, off_B336, off_B34A, off_B358 ; 3
  13738. dc.l off_B366, off_B374, off_B388, off_B3A8 ; 7
  13739. dc.l off_B3C2, off_B3DC, off_B3F0, off_B41C ; 11
  13740. dc.l off_B436, off_B450, off_B45E, off_B490 ; 15
  13741. dc.l off_B4B0, off_B4C4, off_B4F0, off_B51C ; 19
  13742. dc.l off_B548, -1 ; 21
  13743.  
  13744. ; credits text pointers for each screen of credits
  13745. vram_pnt := VRAM_Plane_A_Name_Table
  13746. off_B322: creditsPtrs byte_BC46,textLoc($0E,$0B), byte_BC51,textLoc($18,$0B), byte_BC55,textLoc($02,$0F)
  13747. off_B336: creditsPtrs byte_B55C,textLoc($03,$0B), byte_B56F,textLoc($16,$0B), byte_B581,textLoc($06,$0F)
  13748. off_B34A: creditsPtrs byte_B56F,textLoc($0C,$0B), byte_B59F,textLoc($07,$0F)
  13749. off_B358: creditsPtrs byte_B5BC,textLoc($0C,$0B), byte_B5CD,textLoc($06,$0F)
  13750. off_B366: creditsPtrs byte_B5EB,textLoc($05,$0B), byte_B60C,textLoc($07,$0F)
  13751. off_B374: creditsPtrs byte_B628,textLoc($08,$0A), byte_B642,textLoc($04,$0E), byte_B665,textLoc($0A,$10)
  13752. off_B388: creditsPtrs byte_B67B,textLoc($04,$08), byte_B69C,textLoc($11,$0A), byte_B6A4,textLoc($09,$0C), byte_B6BC,textLoc($04,$10), byte_B6DE,textLoc($08,$12)
  13753. off_B3A8: creditsPtrs byte_B6F8,textLoc($0B,$09), byte_B70B,textLoc($09,$0B), byte_B723,textLoc($0A,$0F), byte_B738,textLoc($03,$11)
  13754. off_B3C2: creditsPtrs byte_B75C,textLoc($04,$09), byte_B642,textLoc($04,$0D), byte_B77E,textLoc($07,$0F), byte_B799,textLoc($07,$11)
  13755. off_B3DC: creditsPtrs byte_B7B5,textLoc($08,$0A), byte_B75C,textLoc($04,$0C), byte_B799,textLoc($07,$10)
  13756. off_B3F0: creditsPtrs byte_B7F2,textLoc($09,$06), byte_B6BC,textLoc($04,$0A), byte_B80B,textLoc($0A,$0C), byte_B821,textLoc($09,$0E), byte_B839,textLoc($07,$10), byte_B855,textLoc($0B,$12), byte_B869,textLoc($0B,$14)
  13757. off_B41C: creditsPtrs byte_B7B5,textLoc($09,$09), byte_B87D,textLoc($0A,$0B), byte_B893,textLoc($0B,$0F), byte_B8A8,textLoc($07,$11)
  13758. off_B436: creditsPtrs byte_B8C5,textLoc($06,$09), byte_B8E2,textLoc($05,$0D), byte_B902,textLoc($03,$0F), byte_B90F,textLoc($04,$11)
  13759. off_B450: creditsPtrs byte_B932,textLoc($04,$0B), byte_B954,textLoc($05,$0F)
  13760. off_B45E: creditsPtrs byte_B974,textLoc($04,$05), byte_B995,textLoc($0F,$09), byte_B9A1,textLoc($0F,$0B), byte_B9AD,textLoc($0F,$0D), byte_B9B8,textLoc($10,$0F), byte_B9C1,textLoc($11,$11), byte_B9C8,textLoc($11,$13), byte_B9D0,textLoc($0F,$15)
  13761. off_B490: creditsPtrs byte_B9DB,textLoc($03,$08), byte_BA00,textLoc($08,$0C), byte_BA1B,textLoc($06,$0E), byte_BA3A,textLoc($09,$10), byte_BA52,textLoc($0A,$12)
  13762. off_B4B0: creditsPtrs byte_BA69,textLoc($09,$0A), byte_BA81,textLoc($05,$0E), byte_B7CE,textLoc($03,$10)
  13763. off_B4C4: creditsPtrs byte_B55C,textLoc($0B,$06), byte_BAA2,textLoc($0A,$08), byte_BAB8,textLoc($03,$0C), byte_BADC,textLoc($07,$0E), byte_BAF7,textLoc($05,$10), byte_BB16,textLoc($07,$12), byte_BB32,textLoc($02,$14)
  13764. off_B4F0: creditsPtrs byte_BB58,textLoc($06,$06), byte_BB75,textLoc($12,$08), byte_BB7B,textLoc($06,$0C), byte_BC9F,textLoc($05,$0E), byte_BBD8,textLoc($08,$10), byte_BBF2,textLoc($08,$12), byte_BC0C,textLoc($09,$14)
  13765. off_B51C: creditsPtrs byte_BB58,textLoc($06,$06), byte_BB75,textLoc($12,$08), byte_BB98,textLoc($03,$0C), byte_BBBC,textLoc($07,$0E), byte_BCBE,textLoc($07,$10), byte_BCD9,textLoc($0D,$12), byte_BC25,textLoc($04,$14)
  13766. off_B548: creditsPtrs byte_BC7B,textLoc($0B,$09), byte_BC8F,textLoc($12,$0D), byte_BC95,textLoc($10,$11)
  13767.  
  13768. ; temporarily remap characters to credit text format
  13769. ; let's encode 2-wide characters like Aa, Bb, Cc, etc. and hide it with a macro
  13770. charset '@',"\x3B\2\4\6\8\xA\xC\xE\x10\x12\x13\x15\x17\x19\x1B\x1D\x1F\x21\x23\x25\x27\x29\x2B\x2D\x2F\x31\x33"
  13771. charset 'a',"\3\5\7\9\xB\xD\xF\x11\x12\x14\x16\x18\x1A\x1C\x1E\x20\x22\x24\x26\x28\x2A\x2C\x2E\x30\x32\x34"
  13772. charset '!',"\x3D\x39\x3F\x36"
  13773. charset '\H',"\x39\x37\x38"
  13774. charset '9',"\x3E\x40\x41"
  13775. charset '1',"\x3C\x35"
  13776. charset '.',"\x3A"
  13777. charset ' ',0
  13778.  
  13779. ; macro for defining credit text in conjunction with the remapped character set
  13780. vram_src := ArtTile_ArtNem_CreditText_CredScr
  13781. creditText macro pal,ss
  13782. if ((vram_src & $FF) <> $0) && ((vram_src & $FF) <> $1)
  13783. fatal "The low byte of vram_src was $\{vram_src & $FF}, but it must be $00 or $01."
  13784. endif
  13785. c := 0
  13786. dc.b (make_art_tile(vram_src,pal,0) & $FF00) >> 8
  13787. rept strlen(ss)
  13788. t := substr(ss,c,1)
  13789. dc.b t
  13790. l := lowstring(t)
  13791. if t="I"
  13792. elseif l<>t
  13793. dc.b l
  13794. elseif t="1"
  13795. dc.b "!"
  13796. elseif t="2"
  13797. dc.b "$"
  13798. elseif t="9"
  13799. dc.b "#"
  13800. endif
  13801. c := c+1
  13802. endm
  13803. dc.b -1
  13804. rev02even
  13805. endm
  13806.  
  13807. ; credits text data (palette index followed by a string)
  13808. vram_src := ArtTile_ArtNem_CreditText_CredScr
  13809. byte_B55C: creditText 1,"EXECUTIVE"
  13810. byte_B56F: creditText 1,"PRODUCER"
  13811. byte_B581: creditText 0,"HAYAO NAKAYAMA"
  13812. byte_B59F: creditText 0,"SHINOBU TOYODA"
  13813. byte_B5BC: creditText 1,"DIRECTOR"
  13814. byte_B5CD: creditText 0,"MASAHARU YOSHII"
  13815. byte_B5EB: creditText 1,"CHIEF PROGRAMMER"
  13816. byte_B60C: creditText 0,"YUJI NAKA (YU2)"
  13817. byte_B628: creditText 1,"GAME PLANNER"
  13818. byte_B642: creditText 0,"HIROKAZU YASUHARA"
  13819. byte_B665: creditText 0,"(CAROL YAS)"
  13820. byte_B67B: creditText 1,"CHARACTER DESIGN"
  13821. byte_B69C: creditText 1,"AND"
  13822. byte_B6A4: creditText 1,"CHIEF ARTIST"
  13823. byte_B6BC: creditText 0,"YASUSHI YAMAGUCHI"
  13824. byte_B6DE: creditText 0,"(JUDY TOTOYA)"
  13825. byte_B6F8: creditText 1,"ASSISTANT"
  13826. byte_B70B: creditText 1,"PROGRAMMERS"
  13827. byte_B723: creditText 0,"BILL WILLIS"
  13828. byte_B738: creditText 0,"MASANOBU YAMAMOTO"
  13829. byte_B75C: creditText 1,"OBJECT PLACEMENT"
  13830. byte_B77E: creditText 0,"TAKAHIRO ANTO"
  13831. byte_B799: creditText 0,"YUTAKA SUGANO"
  13832. byte_B7B5: creditText 1,"SPECIALSTAGE"
  13833. byte_B7CE: creditText 0,"CAROL ANN HANSHAW"
  13834. byte_B7F2: creditText 1,"ZONE ARTISTS"
  13835. byte_B80B: creditText 0,"CRAIG STITT"
  13836. byte_B821: creditText 0,"BRENDA ROSS"
  13837. byte_B839: creditText 0,"JINA ISHIWATARI"
  13838. byte_B855: creditText 0,"TOM PAYNE"
  13839. byte_B869: creditText 0,"PHENIX RIE"
  13840. byte_B87D: creditText 1,"ART AND CG"
  13841. byte_B893: creditText 0,"TIM SKELLY"
  13842. byte_B8A8: creditText 0,"PETER MORAWIEC"
  13843. byte_B8C5: creditText 1,"MUSIC COMPOSER"
  13844. byte_B8E2: creditText 0,"MASATO NAKAMURA"
  13845. byte_B902: creditText 0,"( @1992"
  13846. byte_B90F: creditText 0,"DREAMS COME TRUE)"
  13847. byte_B932: creditText 1,"SOUND PROGRAMMER"
  13848. byte_B954: creditText 0,"TOMOYUKI SHIMADA"
  13849. byte_B974: creditText 1,"SOUND ASSISTANTS"
  13850. byte_B995: creditText 0,"MACKY"
  13851. byte_B9A1: creditText 0,"JIMITA"
  13852. byte_B9AD: creditText 0,"MILPO"
  13853. byte_B9B8: creditText 0,"IPPO"
  13854. byte_B9C1: creditText 0,"S.O"
  13855. byte_B9C8: creditText 0,"OYZ"
  13856. byte_B9D0: creditText 0,"N.GEE"
  13857. byte_B9DB: creditText 1,"PROJECT ASSISTANTS"
  13858. byte_BA00: creditText 0,"SYUICHI KATAGI"
  13859. byte_BA1B: creditText 0,"TAKAHIRO HAMANO"
  13860. byte_BA3A: creditText 0,"YOSHIKI OOKA"
  13861. byte_BA52: creditText 0,"STEVE WOITA"
  13862. byte_BA69: creditText 1,"GAME MANUAL"
  13863. byte_BA81: creditText 0,"YOUICHI TAKAHASHI"
  13864. byte_BAA2: creditText 1,"SUPPORTERS"
  13865. byte_BAB8: creditText 0,"DAIZABUROU SAKURAI"
  13866. byte_BADC: creditText 0,"HISASHI SUZUKI"
  13867. if gameRevision=0
  13868. byte_BAF7: creditText 0,"TOHMAS KALINSKE" ; typo
  13869. else
  13870. byte_BAF7: creditText 0,"THOMAS KALINSKE"
  13871. endif
  13872. byte_BB16: creditText 0,"FUJIO MINEGISHI"
  13873. byte_BB32: creditText 0,"TAKAHARU UTSUNOMIYA"
  13874. byte_BB58: creditText 1,"SPECIAL THANKS"
  13875. byte_BB75: creditText 1,"TO"
  13876. byte_BB7B: creditText 0,"CINDY CLAVERAN"
  13877. byte_BB98: creditText 0,"DEBORAH MCCRACKEN"
  13878. byte_BBBC: creditText 0,"TATSUO YAMADA"
  13879. byte_BBD8: creditText 0,"DAISUKE SAITO"
  13880. byte_BBF2: creditText 0,"KUNITAKE AOKI"
  13881. byte_BC0C: creditText 0,"TSUNEKO AOKI"
  13882. byte_BC25: creditText 0,"MASAAKI KAWAMURA"
  13883. byte_BC46: creditText 0,"SONIC"
  13884. byte_BC51: creditText 1,"2"
  13885. byte_BC55: creditText 0,"CAST OF CHARACTERS"
  13886. byte_BC7B: creditText 0,"PRESENTED"
  13887. byte_BC8F: creditText 0,"BY"
  13888. byte_BC95: creditText 0,"SEGA"
  13889. byte_BC9F: creditText 0,"FRANCE TANTIADO"
  13890. byte_BCBE: creditText 0,"RICK MACARAEG"
  13891. byte_BCD9: creditText 0,"LOCKY P"
  13892.  
  13893. charset ; have to revert character set before changing again
  13894.  
  13895. ; temporarily remap characters to intro text format
  13896. charset '@',"\x3A\1\3\5\7\9\xB\xD\xF\x11\x12\x14\x16\x18\x1A\x1C\x1E\x20\x22\x24\x26\x28\x2A\x2C\x2E\x30\x32"
  13897. charset 'a',"\2\4\6\8\xA\xC\xE\x10\x11\x13\x15\x17\x19\x1B\x1D\x1F\x21\x23\x25\x27\x29\x2B\x2D\x2F\x31\x33"
  13898. charset '!',"\x3C\x38\x3E\x35"
  13899. charset '\H',"\x38\x36\x37"
  13900. charset '9',"\x3D\x3F\x40"
  13901. charset '1',"\x3B\x34"
  13902. charset '.',"\x39"
  13903. charset ' ',0
  13904.  
  13905. ; intro text
  13906. vram_src := ArtTile_ArtNem_CreditText
  13907. byte_BCE9: creditText 0,"IN"
  13908. byte_BCEE: creditText 0,"AND"
  13909. byte_BCF6: creditText 0,"MILES 'TAILS' PROWER"
  13910. byte_BD1A: creditText 0,"SONIC"
  13911.  
  13912. charset ; revert character set
  13913.  
  13914. even
  13915.  
  13916. ; -------------------------------------------------------------------------------
  13917. ; Nemesis compressed art
  13918. ; 64 blocks
  13919. ; Standard font used in credits
  13920. ; -------------------------------------------------------------------------------
  13921. ; ArtNem_BD26:
  13922. ArtNem_CreditText: BINCLUDE "art/nemesis/Credit Text.bin"
  13923. ; ===========================================================================
  13924.  
  13925. if ~~removeJmpTos
  13926. JmpTo5_DisplaySprite
  13927. jmp (DisplaySprite).l
  13928. JmpTo3_DeleteObject
  13929. jmp (DeleteObject).l
  13930. JmpTo2_PlaySound
  13931. jmp (PlaySound).l
  13932. JmpTo_ObjB2_Animate_Pilot
  13933. jmp (ObjB2_Animate_Pilot).l
  13934. JmpTo_AnimateSprite
  13935. jmp (AnimateSprite).l
  13936. JmpTo_NemDec
  13937. jmp (NemDec).l
  13938. JmpTo_EniDec
  13939. jmp (EniDec).l
  13940. JmpTo_ClearScreen
  13941. jmp (ClearScreen).l
  13942. JmpTo2_PlayMusic
  13943. jmp (PlayMusic).l
  13944. JmpTo_LoadChildObject
  13945. jmp (LoadChildObject).l
  13946. ; JmpTo2_PlaneMapToVRAM_H40
  13947. JmpTo2_PlaneMapToVRAM_H40
  13948. jmp (PlaneMapToVRAM_H40).l
  13949. JmpTo2_ObjectMove
  13950. jmp (ObjectMove).l
  13951. JmpTo_PalCycle_Load
  13952. jmp (PalCycle_Load).l
  13953. JmpTo_LoadSubObject_Part3
  13954. jmp (LoadSubObject_Part3).l
  13955.  
  13956. align 4
  13957. endif
  13958.  
  13959.  
  13960.  
  13961.  
  13962. ; ---------------------------------------------------------------------------
  13963. ; Subroutine to load level boundaries and start locations
  13964. ; ---------------------------------------------------------------------------
  13965.  
  13966. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  13967.  
  13968. ; sub_BFBC:
  13969. LevelSizeLoad:
  13970. clr.w (Scroll_flags).w
  13971. clr.w (Scroll_flags_BG).w
  13972. clr.w (Scroll_flags_BG2).w
  13973. clr.w (Scroll_flags_BG3).w
  13974. clr.w (Scroll_flags_P2).w
  13975. clr.w (Scroll_flags_BG_P2).w
  13976. clr.w (Scroll_flags_BG2_P2).w
  13977. clr.w (Scroll_flags_BG3_P2).w
  13978. clr.w (Scroll_flags_copy).w
  13979. clr.w (Scroll_flags_BG_copy).w
  13980. clr.w (Scroll_flags_BG2_copy).w
  13981. clr.w (Scroll_flags_BG3_copy).w
  13982. clr.w (Scroll_flags_copy_P2).w
  13983. clr.w (Scroll_flags_BG_copy_P2).w
  13984. clr.w (Scroll_flags_BG2_copy_P2).w
  13985. clr.w (Scroll_flags_BG3_copy_P2).w
  13986. clr.b (Deform_lock).w
  13987. clr.b (Screen_Shaking_Flag_HTZ).w
  13988. clr.b (Screen_Shaking_Flag).w
  13989. clr.b (Scroll_lock).w
  13990. clr.b (Scroll_lock_P2).w
  13991. moveq #0,d0
  13992. move.b d0,(Dynamic_Resize_Routine).w ; load level boundaries
  13993. if gameRevision=2
  13994. move.w d0,(WFZ_LevEvent_Subrout).w
  13995. move.w d0,(WFZ_BG_Y_Speed).w
  13996. move.w d0,(Camera_BG_X_offset).w
  13997. move.w d0,(Camera_BG_Y_offset).w
  13998. endif
  13999. move.w (Current_ZoneAndAct).w,d0
  14000. ror.b #1,d0
  14001. lsr.w #4,d0
  14002. lea LevelSize(pc,d0.w),a0
  14003. move.l (a0)+,d0
  14004. move.l d0,(Camera_Min_X_pos).w
  14005. move.l d0,(unk_EEC0).w ; unused besides this one write...
  14006. move.l d0,(Tails_Min_X_pos).w
  14007. move.l (a0)+,d0
  14008. move.l d0,(Camera_Min_Y_pos).w
  14009. ; Warning: unk_EEC4 is only a word long, this line also writes to Camera_Max_Y_pos
  14010. ; If you remove this instruction, the camera will scroll up until it kills Sonic
  14011. move.l d0,(unk_EEC4).w ; unused besides this one write...
  14012. move.l d0,(Tails_Min_Y_pos).w
  14013. move.w #$1010,(Horiz_block_crossed_flag).w
  14014. move.w #(224/2)-16,(Camera_Y_pos_bias).w
  14015. move.w #(224/2)-16,(Camera_Y_pos_bias_P2).w
  14016. bra.w +
  14017. ; ===========================================================================
  14018. ; ----------------------------------------------------------------------------
  14019. ; LEVEL SIZE ARRAY
  14020.  
  14021. ; This array defines the screen boundaries for each act in the game.
  14022. ; ----------------------------------------------------------------------------
  14023. ; xstart xend ystart yend ; ZID ; Zone
  14024. LevelSize: zoneOrderedTable 2,8 ; WrdArr_LvlSize
  14025. zoneTableEntry.w $0, $29A0, $0, $320 ; EHZ act 1
  14026. zoneTableEntry.w $0, $2940, $0, $420 ; EHZ act 2
  14027. zoneTableEntry.w $0, $3FFF, $0, $720 ; $01
  14028. zoneTableEntry.w $0, $3FFF, $0, $720
  14029. zoneTableEntry.w $0, $3FFF, $0, $720 ; $02
  14030. zoneTableEntry.w $0, $3FFF, $0, $720
  14031. zoneTableEntry.w $0, $3FFF, $0, $720 ; $03
  14032. zoneTableEntry.w $0, $3FFF, $0, $720
  14033. zoneTableEntry.w $0, $2280, -$100, $800 ; MTZ act 1
  14034. zoneTableEntry.w $0, $1E80, -$100, $800 ; MTZ act 2
  14035. zoneTableEntry.w $0, $2A80, -$100, $800 ; MTZ act 3
  14036. zoneTableEntry.w $0, $3FFF, -$100, $800
  14037. zoneTableEntry.w $0, $3FFF, $0, $720 ; WFZ
  14038. zoneTableEntry.w $0, $3FFF, $0, $720
  14039. zoneTableEntry.w $0, $2800, $0, $720 ; HTZ act 1
  14040. zoneTableEntry.w $0, $3280, $0, $720 ; HTZ act 2
  14041. zoneTableEntry.w $0, $3FFF, $0, $720 ; $08
  14042. zoneTableEntry.w $0, $3FFF, $0, $720
  14043. zoneTableEntry.w $0, $3FFF, $0, $720 ; $09
  14044. zoneTableEntry.w $0, $3FFF, $0, $720
  14045. zoneTableEntry.w $0, $2F80, $0, $680 ; OOZ act 1
  14046. zoneTableEntry.w $0, $2D00, $0, $680 ; OOZ act 2
  14047. zoneTableEntry.w $0, $2380, $3C0, $720 ; MCZ act 1
  14048. zoneTableEntry.w $0, $3FFF, $60, $720 ; MCZ act 2
  14049. zoneTableEntry.w $0, $27A0, $0, $720 ; CNZ act 1
  14050. zoneTableEntry.w $0, $2A80, $0, $720 ; CNZ act 2
  14051. zoneTableEntry.w $0, $2780, $0, $720 ; CPZ act 1
  14052. zoneTableEntry.w $0, $2A80, $0, $720 ; CPZ act 2
  14053. zoneTableEntry.w $0, $1000, $C8, $C8 ; DEZ
  14054. zoneTableEntry.w $0, $1000, $C8, $C8
  14055. zoneTableEntry.w $0, $28C0, $200, $600 ; ARZ act 1
  14056. zoneTableEntry.w $0, $3FFF, $180, $710 ; ARZ act 2
  14057. zoneTableEntry.w $0, $3FFF, $0, $000 ; SCZ
  14058. zoneTableEntry.w $0, $3FFF, $0, $720
  14059. zoneTableEnd
  14060.  
  14061. ; ===========================================================================
  14062. +
  14063. tst.b (Last_star_pole_hit).w ; was a star pole hit yet?
  14064. beq.s + ; if not, branch
  14065. jsr (Obj79_LoadData).l ; load the previously saved data
  14066. move.w (MainCharacter+x_pos).w,d1
  14067. move.w (MainCharacter+y_pos).w,d0
  14068. bra.s ++
  14069. ; ===========================================================================
  14070. + ; Put the character at the start location for the level
  14071. move.w (Current_ZoneAndAct).w,d0
  14072. ror.b #1,d0
  14073. lsr.w #5,d0
  14074. lea StartLocations(pc,d0.w),a1
  14075. moveq #0,d1
  14076. move.w (a1)+,d1
  14077. move.w d1,(MainCharacter+x_pos).w
  14078. moveq #0,d0
  14079. move.w (a1),d0
  14080. move.w d0,(MainCharacter+y_pos).w
  14081. +
  14082. subi.w #$A0,d1
  14083. bcc.s +
  14084. moveq #0,d1
  14085. +
  14086. move.w (Camera_Max_X_pos).w,d2
  14087. cmp.w d2,d1
  14088. blo.s +
  14089. move.w d2,d1
  14090. +
  14091. move.w d1,(Camera_X_pos).w
  14092. move.w d1,(Camera_X_pos_P2).w
  14093. subi.w #$60,d0
  14094. bcc.s +
  14095. moveq #0,d0
  14096. +
  14097. cmp.w (Camera_Max_Y_pos_now).w,d0
  14098. blt.s +
  14099. move.w (Camera_Max_Y_pos_now).w,d0
  14100. +
  14101. move.w d0,(Camera_Y_pos).w
  14102. move.w d0,(Camera_Y_pos_P2).w
  14103. bsr.w InitCameraValues
  14104. rts
  14105. ; End of function LevelSizeLoad
  14106.  
  14107. ; ===========================================================================
  14108. ; --------------------------------------------------------------------------------------
  14109. ; CHARACTER START LOCATION ARRAY
  14110.  
  14111. ; 2 entries per act, corresponding to the X and Y locations that you want the player to
  14112. ; appear at when the level starts.
  14113. ; --------------------------------------------------------------------------------------
  14114. StartLocations: zoneOrderedTable 2,4 ; WrdArr_StartLoc
  14115. zoneTableBinEntry 2, "startpos/EHZ_1.bin" ; $00
  14116. zoneTableBinEntry 2, "startpos/EHZ_2.bin"
  14117. zoneTableEntry.w $60, $28F ; $01
  14118. zoneTableEntry.w $60, $2AF
  14119. zoneTableEntry.w $60, $1AC ; $02
  14120. zoneTableEntry.w $60, $1AC
  14121. zoneTableEntry.w $60, $28F ; $03
  14122. zoneTableEntry.w $60, $2AF
  14123. zoneTableBinEntry 2, "startpos/MTZ_1.bin" ; $04
  14124. zoneTableBinEntry 2, "startpos/MTZ_2.bin"
  14125. zoneTableBinEntry 2, "startpos/MTZ_3.bin" ; $05
  14126. zoneTableEntry.w $60, $2AF
  14127. zoneTableBinEntry 2, "startpos/WFZ.bin" ; $06
  14128. zoneTableEntry.w $1E0, $4CC
  14129. zoneTableBinEntry 2, "startpos/HTZ_1.bin" ; $07
  14130. zoneTableBinEntry 2, "startpos/HTZ_2.bin"
  14131. zoneTableEntry.w $230, $1AC ; $08
  14132. zoneTableEntry.w $230, $1AC
  14133. zoneTableEntry.w $60, $28F ; $09
  14134. zoneTableEntry.w $60, $2AF
  14135. zoneTableBinEntry 2, "startpos/OOZ_1.bin" ; $0A
  14136. zoneTableBinEntry 2, "startpos/OOZ_2.bin"
  14137. zoneTableBinEntry 2, "startpos/MCZ_1.bin" ; $0B
  14138. zoneTableBinEntry 2, "startpos/MCZ_2.bin"
  14139. zoneTableBinEntry 2, "startpos/CNZ_1.bin" ; $0C
  14140. zoneTableBinEntry 2, "startpos/CNZ_2.bin"
  14141. zoneTableBinEntry 2, "startpos/CPZ_1.bin" ; $0D
  14142. zoneTableBinEntry 2, "startpos/CPZ_2.bin"
  14143. zoneTableBinEntry 2, "startpos/DEZ.bin" ; $0E
  14144. zoneTableEntry.w $60, $12D
  14145. zoneTableBinEntry 2, "startpos/ARZ_1.bin" ; $0F
  14146. zoneTableBinEntry 2, "startpos/ARZ_2.bin"
  14147. zoneTableBinEntry 2, "startpos/SCZ.bin" ; $10
  14148. zoneTableEntry.w $140, $70
  14149. zoneTableEnd
  14150.  
  14151. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  14152.  
  14153. ;sub_C258:
  14154. InitCameraValues:
  14155. tst.b (Last_star_pole_hit).w ; was a star pole hit yet?
  14156. bne.s + ; if yes, branch
  14157. move.w d0,(Camera_BG_Y_pos).w
  14158. move.w d0,(Camera_BG2_Y_pos).w
  14159. move.w d1,(Camera_BG_X_pos).w
  14160. move.w d1,(Camera_BG2_X_pos).w
  14161. move.w d1,(Camera_BG3_X_pos).w
  14162. move.w d0,(Camera_BG_Y_pos_P2).w
  14163. move.w d0,(Camera_BG2_Y_pos_P2).w
  14164. move.w d1,(Camera_BG_X_pos_P2).w
  14165. move.w d1,(Camera_BG2_X_pos_P2).w
  14166. move.w d1,(Camera_BG3_X_pos_P2).w
  14167. +
  14168. moveq #0,d2
  14169. move.b (Current_Zone).w,d2
  14170. add.w d2,d2
  14171. move.w InitCam_Index(pc,d2.w),d2
  14172. jmp InitCam_Index(pc,d2.w)
  14173. ; End of function InitCameraValues
  14174.  
  14175. ; ===========================================================================
  14176. ; off_C296:
  14177. InitCam_Index: zoneOrderedOffsetTable 2,1
  14178. zoneOffsetTableEntry.w InitCam_EHZ
  14179. zoneOffsetTableEntry.w InitCam_Null0 ; 1
  14180. zoneOffsetTableEntry.w InitCam_WZ ; 2
  14181. zoneOffsetTableEntry.w InitCam_Null0 ; 3
  14182. zoneOffsetTableEntry.w InitCam_Std ; 4 MTZ
  14183. zoneOffsetTableEntry.w InitCam_Std ; 5 MTZ3
  14184. zoneOffsetTableEntry.w InitCam_Null1 ; 6
  14185. zoneOffsetTableEntry.w InitCam_HTZ ; 7
  14186. zoneOffsetTableEntry.w InitCam_HPZ ; 8
  14187. zoneOffsetTableEntry.w InitCam_Null2 ; 9
  14188. zoneOffsetTableEntry.w InitCam_OOZ ; 10
  14189. zoneOffsetTableEntry.w InitCam_MCZ ; 11
  14190. zoneOffsetTableEntry.w InitCam_CNZ ; 12
  14191. zoneOffsetTableEntry.w InitCam_CPZ ; 13
  14192. zoneOffsetTableEntry.w InitCam_Null3 ; 14
  14193. zoneOffsetTableEntry.w InitCam_ARZ ; 15
  14194. zoneOffsetTableEntry.w InitCam_SCZ ; 16
  14195. zoneTableEnd
  14196. ; ===========================================================================
  14197. ;loc_C2B8:
  14198. InitCam_EHZ:
  14199. clr.l (Camera_BG_X_pos).w
  14200. clr.l (Camera_BG_Y_pos).w
  14201. clr.l (Camera_BG2_Y_pos).w
  14202. clr.l (Camera_BG3_Y_pos).w
  14203. lea (TempArray_LayerDef).w,a2
  14204. clr.l (a2)+
  14205. clr.l (a2)+
  14206. clr.l (a2)+
  14207. clr.l (Camera_BG_X_pos_P2).w
  14208. clr.l (Camera_BG_Y_pos_P2).w
  14209. clr.l (Camera_BG2_Y_pos_P2).w
  14210. clr.l (Camera_BG3_Y_pos_P2).w
  14211. rts
  14212. ; ===========================================================================
  14213. ; wtf:
  14214. InitCam_Null0:
  14215. if gameRevision=0
  14216. rts
  14217. endif
  14218. ; ===========================================================================
  14219. ; Wood_Zone_BG:
  14220. InitCam_WZ:
  14221. if gameRevision=0
  14222. asr.w #2,d0
  14223. addi.w #$400,d0
  14224. move.w d0,(Camera_BG_Y_pos).w
  14225. asr.w #3,d1
  14226. move.w d1,(Camera_BG_X_pos).w
  14227. rts
  14228. endif
  14229. ; ===========================================================================
  14230. ;loc_C2E4:
  14231. InitCam_Std:
  14232. asr.w #2,d0
  14233. move.w d0,(Camera_BG_Y_pos).w
  14234. asr.w #3,d1
  14235. move.w d1,(Camera_BG_X_pos).w
  14236. rts
  14237. ; ===========================================================================
  14238. ;return_C2F2:
  14239. InitCam_Null1:
  14240. rts
  14241. ; ===========================================================================
  14242. ;loc_C2F4:
  14243. InitCam_HTZ:
  14244. clr.l (Camera_BG_X_pos).w
  14245. clr.l (Camera_BG_Y_pos).w
  14246. clr.l (Camera_BG2_Y_pos).w
  14247. clr.l (Camera_BG3_Y_pos).w
  14248. lea (TempArray_LayerDef).w,a2
  14249. clr.l (a2)+
  14250. clr.l (a2)+
  14251. clr.l (a2)+
  14252. clr.l (Camera_BG_X_pos_P2).w
  14253. clr.l (Camera_BG_Y_pos_P2).w
  14254. clr.l (Camera_BG2_Y_pos_P2).w
  14255. clr.l (Camera_BG3_Y_pos_P2).w
  14256. rts
  14257. ; ===========================================================================
  14258. ; Hidden_Palace_Zone_BG:
  14259. InitCam_HPZ:
  14260. if gameRevision=0
  14261. asr.w #1,d0
  14262. move.w d0,(Camera_BG_Y_pos).w
  14263. clr.l (Camera_BG_X_pos).w
  14264. rts
  14265. endif
  14266. ; ===========================================================================
  14267. ; Unknown_Zone_BG:
  14268. InitCam_CCZ:
  14269. if gameRevision=0
  14270. asl.l #4,d0
  14271. move.l d0,d2
  14272. asl.l #1,d0
  14273. add.l d2,d0
  14274. asr.l #8,d0
  14275. addq.w #1,d0
  14276. move.w d0,(Camera_BG_Y_pos).w
  14277. clr.l (Camera_BG_X_pos).w
  14278. rts
  14279. endif
  14280. ; ===========================================================================
  14281. ;return_C320:
  14282. InitCam_Null2:
  14283. rts
  14284. ; ===========================================================================
  14285. ;loc_C322:
  14286. InitCam_OOZ:
  14287. lsr.w #3,d0
  14288. addi.w #$50,d0
  14289. move.w d0,(Camera_BG_Y_pos).w
  14290. clr.l (Camera_BG_X_pos).w
  14291. rts
  14292. ; ===========================================================================
  14293. ;loc_C332:
  14294. InitCam_MCZ:
  14295. clr.l (Camera_BG_X_pos).w
  14296. clr.l (Camera_BG_X_pos_P2).w
  14297. tst.b (Current_Act).w
  14298. bne.s +
  14299. divu.w #3,d0
  14300. subi.w #$140,d0
  14301. move.w d0,(Camera_BG_Y_pos).w
  14302. move.w d0,(Camera_BG_Y_pos_P2).w
  14303. rts
  14304. ; ===========================================================================
  14305. +
  14306. divu.w #6,d0
  14307. subi.w #$10,d0
  14308. move.w d0,(Camera_BG_Y_pos).w
  14309. move.w d0,(Camera_BG_Y_pos_P2).w
  14310. rts
  14311. ; ===========================================================================
  14312. ;loc_C364:
  14313. InitCam_CNZ:
  14314. clr.l (Camera_BG_X_pos).w
  14315. clr.l (Camera_BG_Y_pos).w
  14316. clr.l (Camera_BG_Y_pos_P2).w
  14317. rts
  14318. ; ===========================================================================
  14319. ;loc_C372:
  14320. InitCam_CPZ:
  14321. lsr.w #2,d0
  14322. move.w d0,(Camera_BG_Y_pos).w
  14323. move.w d0,(Camera_BG_Y_pos_P2).w
  14324. lsr.w #1,d1
  14325. move.w d1,(Camera_BG2_X_pos).w
  14326. lsr.w #2,d1
  14327. move.w d1,(Camera_BG_X_pos).w
  14328. rts
  14329. ; ===========================================================================
  14330. ;return_C38A:
  14331. InitCam_Null3:
  14332. rts
  14333. ; ===========================================================================
  14334. ;loc_C38C:
  14335. InitCam_ARZ:
  14336. tst.b (Current_Act).w
  14337. beq.s +
  14338. subi.w #$E0,d0
  14339. lsr.w #1,d0
  14340. move.w d0,(Camera_BG_Y_pos).w
  14341. bra.s loc_C3A6
  14342. ; ===========================================================================
  14343. +
  14344. subi.w #$180,d0
  14345. move.w d0,(Camera_BG_Y_pos).w
  14346.  
  14347. loc_C3A6:
  14348. muls.w #$119,d1
  14349. asr.l #8,d1
  14350. move.w d1,(Camera_BG_X_pos).w
  14351. move.w d1,(Camera_ARZ_BG_X_pos).w
  14352. clr.w (Camera_BG_X_pos+2).w
  14353. clr.w (Camera_ARZ_BG_X_pos+2).w
  14354. clr.l (Camera_BG2_Y_pos).w
  14355. clr.l (Camera_BG3_Y_pos).w
  14356. rts
  14357. ; ===========================================================================
  14358. ;loc_C3C6:
  14359. InitCam_SCZ:
  14360. clr.l (Camera_BG_X_pos).w
  14361. clr.l (Camera_BG_Y_pos).w
  14362. rts
  14363.  
  14364. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  14365. ; sub_C3D0:
  14366. DeformBgLayer:
  14367. tst.b (Deform_lock).w
  14368. beq.s +
  14369. rts
  14370. ; ---------------------------------------------------------------------------
  14371. +
  14372. clr.w (Scroll_flags).w
  14373. clr.w (Scroll_flags_BG).w
  14374. clr.w (Scroll_flags_BG2).w
  14375. clr.w (Scroll_flags_BG3).w
  14376. clr.w (Scroll_flags_P2).w
  14377. clr.w (Scroll_flags_BG_P2).w
  14378. clr.w (Scroll_flags_BG2_P2).w
  14379. clr.w (Scroll_flags_BG3_P2).w
  14380. clr.w (Camera_X_pos_diff).w
  14381. clr.w (Camera_Y_pos_diff).w
  14382. clr.w (Camera_X_pos_diff_P2).w
  14383. clr.w (Camera_Y_pos_diff_P2).w
  14384. cmpi.b #sky_chase_zone,(Current_Zone).w
  14385. bne.w +
  14386. tst.w (Debug_placement_mode).w
  14387. beq.w loc_C4D0 ; skip normal scrolling for SCZ
  14388. +
  14389. tst.b (Scroll_lock).w
  14390. bne.s DeformBgLayerAfterScrollVert
  14391. lea (MainCharacter).w,a0 ; a0=character
  14392. lea (Camera_X_pos).w,a1
  14393. lea (Camera_Min_X_pos).w,a2
  14394. lea (Scroll_flags).w,a3
  14395. lea (Camera_X_pos_diff).w,a4
  14396. lea (Horiz_scroll_delay_val).w,a5
  14397. lea (Sonic_Pos_Record_Buf).w,a6
  14398. cmpi.w #2,(Player_mode).w
  14399. bne.s +
  14400. lea (Horiz_scroll_delay_val_P2).w,a5
  14401. lea (Tails_Pos_Record_Buf).w,a6
  14402. +
  14403. bsr.w ScrollHoriz
  14404. lea (Horiz_block_crossed_flag).w,a2
  14405. bsr.w SetHorizScrollFlags
  14406. lea (Camera_Y_pos).w,a1
  14407. lea (Camera_Min_X_pos).w,a2
  14408. lea (Camera_Y_pos_diff).w,a4
  14409. move.w (Camera_Y_pos_bias).w,d3
  14410. cmpi.w #2,(Player_mode).w
  14411. bne.s +
  14412. move.w (Camera_Y_pos_bias_P2).w,d3
  14413. +
  14414. bsr.w ScrollVerti
  14415. lea (Verti_block_crossed_flag).w,a2
  14416. bsr.w SetVertiScrollFlags
  14417.  
  14418. DeformBgLayerAfterScrollVert:
  14419. tst.w (Two_player_mode).w
  14420. beq.s loc_C4D0
  14421. tst.b (Scroll_lock_P2).w
  14422. bne.s loc_C4D0
  14423. lea (Sidekick).w,a0 ; a0=character
  14424. lea (Camera_X_pos_P2).w,a1
  14425. lea (Tails_Min_X_pos).w,a2
  14426. lea (Scroll_flags_P2).w,a3
  14427. lea (Camera_X_pos_diff_P2).w,a4
  14428. lea (Horiz_scroll_delay_val_P2).w,a5
  14429. lea (Tails_Pos_Record_Buf).w,a6
  14430. bsr.w ScrollHoriz
  14431. lea (Horiz_block_crossed_flag_P2).w,a2
  14432. bsr.w SetHorizScrollFlags
  14433. lea (Camera_Y_pos_P2).w,a1
  14434. lea (Tails_Min_X_pos).w,a2
  14435. lea (Camera_Y_pos_diff_P2).w,a4
  14436. move.w (Camera_Y_pos_bias_P2).w,d3
  14437. bsr.w ScrollVerti
  14438. lea (Verti_block_crossed_flag_P2).w,a2
  14439. bsr.w SetVertiScrollFlags
  14440.  
  14441. loc_C4D0:
  14442. bsr.w RunDynamicLevelEvents
  14443. move.w (Camera_Y_pos).w,(Vscroll_Factor_FG).w
  14444. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  14445. move.l (Camera_X_pos).w,(Camera_X_pos_copy).w
  14446. move.l (Camera_Y_pos).w,(Camera_Y_pos_copy).w
  14447. moveq #0,d0
  14448. move.b (Current_Zone).w,d0
  14449. add.w d0,d0
  14450. move.w SwScrl_Index(pc,d0.w),d0
  14451. jmp SwScrl_Index(pc,d0.w)
  14452. ; End of function DeformBgLayer
  14453.  
  14454. ; ===========================================================================
  14455. ; ---------------------------------------------------------------------------
  14456. ; JUMP TABLE FOR SOFTWARE SCROLL MANAGERS
  14457. ;
  14458. ; "Software scrolling" is my term for what Nemesis (and by extension, the rest
  14459. ; of the world) calls "rasterized layer deformation".* Software scroll managers
  14460. ; are needed to achieve certain special camera effects - namely, locking the
  14461. ; screen for a boss fight and defining the limits of said screen lock, or in
  14462. ; the case of Sky Chase Zone ($10), moving the camera at a fixed rate through
  14463. ; a predefined course.
  14464. ; They are also used for things like controlling the parallax scrolling and
  14465. ; water ripple effects in EHZ, and moving the clouds in HTZ and the stars in DEZ.
  14466. ; ---------------------------------------------------------------------------
  14467. SwScrl_Index: zoneOrderedOffsetTable 2,1 ; JmpTbl_SwScrlMgr
  14468. zoneOffsetTableEntry.w SwScrl_EHZ ; $00
  14469. zoneOffsetTableEntry.w SwScrl_Minimal ; $01
  14470. zoneOffsetTableEntry.w SwScrl_Lev2 ; $02
  14471. zoneOffsetTableEntry.w SwScrl_Minimal ; $03
  14472. zoneOffsetTableEntry.w SwScrl_MTZ ; $04
  14473. zoneOffsetTableEntry.w SwScrl_MTZ ; $05
  14474. zoneOffsetTableEntry.w SwScrl_WFZ ; $06
  14475. zoneOffsetTableEntry.w SwScrl_HTZ ; $07
  14476. zoneOffsetTableEntry.w SwScrl_HPZ ; $08
  14477. zoneOffsetTableEntry.w SwScrl_Minimal ; $09
  14478. zoneOffsetTableEntry.w SwScrl_OOZ ; $0A
  14479. zoneOffsetTableEntry.w SwScrl_MCZ ; $0B
  14480. zoneOffsetTableEntry.w SwScrl_CNZ ; $0C
  14481. zoneOffsetTableEntry.w SwScrl_CPZ ; $0D
  14482. zoneOffsetTableEntry.w SwScrl_DEZ ; $0E
  14483. zoneOffsetTableEntry.w SwScrl_ARZ ; $0F
  14484. zoneOffsetTableEntry.w SwScrl_SCZ ; $10
  14485. zoneTableEnd
  14486. ; ===========================================================================
  14487. ; loc_C51E:
  14488. SwScrl_Title:
  14489. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  14490. addq.w #1,(Camera_X_pos).w
  14491. move.w (Camera_X_pos).w,d2
  14492. neg.w d2
  14493. asr.w #2,d2
  14494. lea (Horiz_Scroll_Buf).w,a1
  14495. moveq #0,d0
  14496.  
  14497. move.w #bytesToLcnt($280),d1
  14498. - move.l d0,(a1)+
  14499. dbf d1,-
  14500.  
  14501. move.w d2,d0
  14502.  
  14503. move.w #bytesToLcnt($80),d1
  14504. - move.l d0,(a1)+
  14505. dbf d1,-
  14506.  
  14507. move.w d0,d3
  14508. move.b (Vint_runcount+3).w,d1
  14509. andi.w #7,d1
  14510. bne.s +
  14511. subq.w #1,(TempArray_LayerDef).w
  14512. +
  14513. move.w (TempArray_LayerDef).w,d1
  14514. andi.w #$1F,d1
  14515. lea SwScrl_RippleData(pc),a2
  14516. lea (a2,d1.w),a2
  14517.  
  14518. move.w #bytesToLcnt($40),d1
  14519. - move.b (a2)+,d0
  14520. ext.w d0
  14521. add.w d3,d0
  14522. move.l d0,(a1)+
  14523. dbf d1,-
  14524.  
  14525. rts
  14526. ; ===========================================================================
  14527. ; loc_C57E:
  14528. SwScrl_EHZ:
  14529. tst.w (Two_player_mode).w
  14530. bne.w SwScrl_EHZ_2P
  14531. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  14532. lea (Horiz_Scroll_Buf).w,a1
  14533. move.w (Camera_X_pos).w,d0
  14534. neg.w d0
  14535. move.w d0,d2
  14536. swap d0
  14537. move.w #0,d0
  14538.  
  14539. move.w #bytesToLcnt($58),d1
  14540. - move.l d0,(a1)+
  14541. dbf d1,-
  14542.  
  14543. move.w d2,d0
  14544. asr.w #6,d0
  14545.  
  14546. move.w #bytesToLcnt($E8),d1
  14547. - move.l d0,(a1)+
  14548. dbf d1,-
  14549.  
  14550. move.w d0,d3
  14551. move.b (Vint_runcount+3).w,d1
  14552. andi.w #7,d1
  14553. bne.s +
  14554. subq.w #1,(TempArray_LayerDef).w
  14555. +
  14556. move.w (TempArray_LayerDef).w,d1
  14557. andi.w #$1F,d1
  14558. lea (SwScrl_RippleData).l,a2
  14559. lea (a2,d1.w),a2
  14560.  
  14561. move.w #bytesToLcnt($54),d1
  14562. - move.b (a2)+,d0
  14563. ext.w d0
  14564. add.w d3,d0
  14565. move.l d0,(a1)+
  14566. dbf d1,-
  14567.  
  14568. move.w #0,d0
  14569.  
  14570. move.w #bytesToLcnt($2C),d1
  14571. - move.l d0,(a1)+
  14572. dbf d1,-
  14573.  
  14574. move.w d2,d0
  14575. asr.w #4,d0
  14576.  
  14577. move.w #bytesToLcnt($40),d1
  14578. - move.l d0,(a1)+
  14579. dbf d1,-
  14580.  
  14581. move.w d2,d0
  14582. asr.w #4,d0
  14583. move.w d0,d1
  14584. asr.w #1,d1
  14585. add.w d1,d0
  14586.  
  14587. move.w #bytesToLcnt($40),d1
  14588. - move.l d0,(a1)+
  14589. dbf d1,-
  14590.  
  14591. move.l d0,d4
  14592. swap d4
  14593. move.w d2,d0
  14594. asr.w #1,d0
  14595. move.w d2,d1
  14596. asr.w #3,d1
  14597. sub.w d1,d0
  14598. ext.l d0
  14599. asl.l #8,d0
  14600. divs.w #$30,d0
  14601. ext.l d0
  14602. asl.l #8,d0
  14603. moveq #0,d3
  14604. move.w d2,d3
  14605. asr.w #3,d3
  14606.  
  14607. move.w #bytesToLcnt($3C),d1 ; $3C bytes
  14608. - move.w d4,(a1)+
  14609. move.w d3,(a1)+
  14610. swap d3
  14611. add.l d0,d3
  14612. swap d3
  14613. dbf d1,-
  14614.  
  14615. move.w #($48)/8-1,d1 ; $48 bytes
  14616. - move.w d4,(a1)+
  14617. move.w d3,(a1)+
  14618. move.w d4,(a1)+
  14619. move.w d3,(a1)+
  14620. swap d3
  14621. add.l d0,d3
  14622. add.l d0,d3
  14623. swap d3
  14624. dbf d1,-
  14625.  
  14626. move.w #($B4)/12-1,d1 ; $B4 bytes
  14627. - move.w d4,(a1)+
  14628. move.w d3,(a1)+
  14629. move.w d4,(a1)+
  14630. move.w d3,(a1)+
  14631. move.w d4,(a1)+
  14632. move.w d3,(a1)+
  14633. swap d3
  14634. add.l d0,d3
  14635. add.l d0,d3
  14636. add.l d0,d3
  14637. swap d3
  14638. dbf d1,-
  14639.  
  14640. ; note there is a bug here. the bottom 8 pixels haven't had their hscroll values set. only the EHZ scrolling code has this bug.
  14641.  
  14642. rts
  14643. ; ===========================================================================
  14644. ; horizontal offsets for the water rippling effect
  14645. ; byte_C682:
  14646. SwScrl_RippleData:
  14647. dc.b 1, 2, 1, 3, 1, 2, 2, 1, 2, 3, 1, 2, 1, 2, 0, 0; 16
  14648. dc.b 2, 0, 3, 2, 2, 3, 2, 2, 1, 3, 0, 0, 1, 0, 1, 3; 32
  14649. dc.b 1, 2, 1, 3, 1, 2, 2, 1, 2, 3, 1, 2, 1, 2, 0, 0; 48
  14650. dc.b 2, 0, 3, 2, 2, 3, 2, 2, 1, 3, 0, 0, 1, 0, 1, 3; 64
  14651. dc.b 1, 2 ; 66
  14652. ; ===========================================================================
  14653. ; loc_C6C4:
  14654. SwScrl_EHZ_2P:
  14655. move.b (Vint_runcount+3).w,d1
  14656. andi.w #7,d1
  14657. bne.s +
  14658. subq.w #1,(TempArray_LayerDef).w
  14659. +
  14660. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  14661. andi.l #$FFFEFFFE,(Vscroll_Factor).w
  14662. lea (Horiz_Scroll_Buf).w,a1
  14663. move.w (Camera_X_pos).w,d0
  14664. move.w #bytesToLcnt($2C),d1
  14665. bsr.s sub_C71A
  14666. moveq #0,d0
  14667. move.w d0,(Vscroll_Factor_P2_BG).w
  14668. subi.w #$E0,(Vscroll_Factor_P2_BG).w
  14669. move.w (Camera_Y_pos_P2).w,(Vscroll_Factor_P2_FG).w
  14670. subi.w #$E0,(Vscroll_Factor_P2_FG).w
  14671. andi.l #$FFFEFFFE,(Vscroll_Factor_P2).w
  14672. lea (Horiz_Scroll_Buf+$1B0).w,a1
  14673. move.w (Camera_X_pos_P2).w,d0
  14674. move.w #bytesToLcnt($3C),d1
  14675.  
  14676. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  14677.  
  14678.  
  14679. sub_C71A:
  14680. neg.w d0
  14681. move.w d0,d2
  14682. swap d0
  14683. move.w #0,d0
  14684.  
  14685. - move.l d0,(a1)+
  14686. dbf d1,-
  14687.  
  14688. move.w d2,d0
  14689. asr.w #6,d0
  14690.  
  14691. move.w #bytesToLcnt($74),d1
  14692. - move.l d0,(a1)+
  14693. dbf d1,-
  14694.  
  14695. move.w d0,d3
  14696. move.w (TempArray_LayerDef).w,d1
  14697. andi.w #$1F,d1
  14698. lea_ SwScrl_RippleData,a2
  14699. lea (a2,d1.w),a2
  14700.  
  14701. move.w #bytesToLcnt($2C),d1
  14702. - move.b (a2)+,d0
  14703. ext.w d0
  14704. add.w d3,d0
  14705. move.l d0,(a1)+
  14706. dbf d1,-
  14707.  
  14708. move.w #0,d0
  14709.  
  14710. move.w #bytesToLcnt($14),d1
  14711. - move.l d0,(a1)+
  14712. dbf d1,-
  14713.  
  14714. move.w d2,d0
  14715. asr.w #4,d0
  14716.  
  14717. move.w #bytesToLcnt($20),d1
  14718. - move.l d0,(a1)+
  14719. dbf d1,-
  14720.  
  14721. move.w d2,d0
  14722. asr.w #4,d0
  14723. move.w d0,d1
  14724. asr.w #1,d1
  14725. add.w d1,d0
  14726.  
  14727. move.w #bytesToLcnt($20),d1
  14728. - move.l d0,(a1)+
  14729. dbf d1,-
  14730.  
  14731. move.w d2,d0
  14732. asr.w #1,d0
  14733. move.w d2,d1
  14734. asr.w #3,d1
  14735. sub.w d1,d0
  14736. ext.l d0
  14737. asl.l #8,d0
  14738. divs.w #$30,d0
  14739. ext.l d0
  14740. asl.l #8,d0
  14741. moveq #0,d3
  14742. move.w d2,d3
  14743. asr.w #3,d3
  14744.  
  14745. move.w #bytesToLcnt($A0),d1
  14746. - move.w d2,(a1)+
  14747. move.w d3,(a1)+
  14748. swap d3
  14749. add.l d0,d3
  14750. swap d3
  14751. dbf d1,-
  14752.  
  14753. rts
  14754. ; End of function sub_C71A
  14755.  
  14756. ; ===========================================================================
  14757. ; unused...
  14758. ; loc_C7BA:
  14759. SwScrl_Lev2:
  14760. if gameRevision<2
  14761. move.w (Camera_X_pos_diff).w,d4
  14762. ext.l d4
  14763. asl.l #5,d4
  14764. move.w (Camera_Y_pos_diff).w,d5
  14765. ext.l d5
  14766. asl.l #6,d5
  14767. bsr.w SetHorizVertiScrollFlagsBG
  14768. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  14769. lea (Horiz_Scroll_Buf).w,a1
  14770. move.w #bytesToLcnt($380),d1
  14771. move.w (Camera_X_pos).w,d0
  14772. neg.w d0
  14773. swap d0
  14774. move.w (Camera_BG_X_pos).w,d0
  14775. neg.w d0
  14776.  
  14777. - move.l d0,(a1)+
  14778. dbf d1,-
  14779. endif
  14780.  
  14781. rts
  14782. ; ===========================================================================
  14783. ; loc_C7F2:
  14784. SwScrl_MTZ:
  14785. move.w (Camera_X_pos_diff).w,d4
  14786. ext.l d4
  14787. asl.l #5,d4
  14788. move.w (Camera_Y_pos_diff).w,d5
  14789. ext.l d5
  14790. asl.l #6,d5
  14791. bsr.w SetHorizVertiScrollFlagsBG
  14792. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  14793. lea (Horiz_Scroll_Buf).w,a1
  14794. move.w #bytesToLcnt($380),d1
  14795. move.w (Camera_X_pos).w,d0
  14796. neg.w d0
  14797. swap d0
  14798. move.w (Camera_BG_X_pos).w,d0
  14799. neg.w d0
  14800.  
  14801. - move.l d0,(a1)+
  14802. dbf d1,-
  14803.  
  14804. rts
  14805. ; ===========================================================================
  14806. ; loc_C82A:
  14807. SwScrl_WFZ:
  14808. move.w (Camera_BG_X_pos_diff).w,d4
  14809. ext.l d4
  14810. asl.l #8,d4
  14811. moveq #2,d6
  14812. bsr.w SetHorizScrollFlagsBG
  14813. move.w (Camera_BG_Y_pos_diff).w,d5
  14814. ext.l d5
  14815. lsl.l #8,d5
  14816. moveq #6,d6
  14817. bsr.w SetVertiScrollFlagsBG
  14818. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  14819. move.l (Camera_BG_X_pos).w,d0
  14820. ; This can be removed if the getaway ship's entry uses d0 instead.
  14821. move.l d0,d1
  14822. lea (TempArray_LayerDef).w,a2
  14823. move.l d0,(a2)+ ; Static parts of BG (generally no clouds in them)
  14824. move.l d1,(a2)+ ; Eggman's getaway ship
  14825. ; Note: this is bugged: this tallies only the cloud speeds. It works fine
  14826. ; if you are standing still, but makes the clouds move faster when going
  14827. ; right and slower when going left. This is exactly the opposite of what
  14828. ; should happen.
  14829. addi.l #$8000,(a2)+ ; Larger clouds
  14830. addi.l #$4000,(a2)+ ; Medium clouds
  14831. addi.l #$2000,(a2)+ ; Small clouds
  14832. lea (SwScrl_WFZ_Transition_Array).l,a3
  14833. cmpi.w #$2700,(Camera_X_pos).w
  14834. bhs.s .got_array
  14835. lea (SwScrl_WFZ_Normal_Array).l,a3
  14836.  
  14837. .got_array:
  14838. lea (TempArray_LayerDef).w,a2
  14839. lea (Horiz_Scroll_Buf).w,a1
  14840. move.w (Camera_BG_Y_pos).w,d1
  14841. andi.w #$7FF,d1
  14842. moveq #0,d0
  14843. moveq #0,d3
  14844.  
  14845. ; Find the first visible scrolling section
  14846. .seg_loop:
  14847. move.b (a3)+,d0 ; Number of lines in this segment
  14848. addq.w #1,a3 ; Skip index
  14849. sub.w d0,d1 ; Does this segment have any visible lines?
  14850. bcc.s .seg_loop ; Branch if not
  14851.  
  14852. neg.w d1 ; d1 = number of lines to draw in this segment
  14853. move.w #bytesToLcnt($380),d2 ; Number of rows in hscroll buffer
  14854. move.w (Camera_X_pos).w,d0
  14855. neg.w d0
  14856. swap d0
  14857. move.b -1(a3),d3 ; Fetch TempArray_LayerDef index
  14858. move.w (a2,d3.w),d0 ; Fetch scroll value for this row...
  14859. neg.w d0 ; ... and flip sign for VDP
  14860.  
  14861. .row_loop:
  14862. move.l d0,(a1)+
  14863. subq.w #1,d1 ; Has the current segment finished?
  14864. bne.s .next_row ; Branch if not
  14865. move.b (a3)+,d1 ; Fetch a new line count
  14866. move.b (a3)+,d3 ; Fetch TempArray_LayerDef index
  14867. move.w (a2,d3.w),d0 ; Fetch scroll value for this row...
  14868. neg.w d0 ; ... and flip sign for VDP
  14869.  
  14870. .next_row:
  14871. dbf d2,.row_loop
  14872.  
  14873. rts
  14874. ; ===========================================================================
  14875. ; WFZ BG scrolling data
  14876. ; Each pair of bytes corresponds to one scrolling segment of the BG, and
  14877. ; the bytes have the following meaning:
  14878. ; number of lines, index into TempArray_LayerDef
  14879. ; byte_C8CA
  14880. SwScrl_WFZ_Transition_Array:
  14881. dc.b $C0, 0,$C0, 0,$80, 0,$20, 8,$30, $C,$30,$10,$20, 8,$30, $C
  14882. dc.b $30,$10,$20, 8,$30, $C,$30,$10,$20, 8,$30, $C,$30,$10,$20, 8; 16
  14883. dc.b $30, $C,$30,$10,$20, 8,$30, $C,$30,$10,$20, 8,$30, $C,$30,$10; 32
  14884. dc.b $80, 4,$80, 4,$20, 8,$30, $C,$30,$10,$20, 8,$30, $C,$30,$10; 48
  14885. dc.b $20, 8,$30, $C,$30,$10,$C0, 0,$C0, 0,$80, 0; 64
  14886. ;byte_C916
  14887. SwScrl_WFZ_Normal_Array:
  14888. dc.b $C0, 0,$C0, 0,$80, 0,$20, 8,$30, $C,$30,$10,$20, 8,$30, $C
  14889. dc.b $30,$10,$20, 8,$30, $C,$30,$10,$20, 8,$30, $C,$30,$10,$20, 8; 16
  14890. dc.b $30, $C,$30,$10,$20, 8,$30, $C,$30,$10,$20, 8,$30, $C,$30,$10; 32
  14891. dc.b $20, 8,$30, $C,$30,$10,$20, 8,$30, $C,$30,$10,$20, 8,$30, $C; 48
  14892. dc.b $30,$10,$20, 8,$30, $C,$30,$10,$C0, 0,$C0, 0,$80, 0; 64
  14893. ; Note: this array is missing $80 lines compared to the transition array.
  14894. ; This causes the lower clouds to read data from the start of SwScrl_HTZ.
  14895. ; These are the missing entries:
  14896. if 1==0
  14897. dc.b $20, 8,$30, $C,$30,$10
  14898. endif
  14899. ; ===========================================================================
  14900. ; loc_C964:
  14901. SwScrl_HTZ:
  14902. tst.w (Two_player_mode).w
  14903. bne.w SwScrl_HTZ_2P ; never used in normal gameplay
  14904. tst.b (Screen_Shaking_Flag_HTZ).w
  14905. bne.w HTZ_Screen_Shake
  14906. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  14907. lea (Horiz_Scroll_Buf).w,a1
  14908. move.w (Camera_X_pos).w,d0
  14909. neg.w d0
  14910. move.w d0,d2
  14911. swap d0
  14912. move.w d2,d0
  14913. asr.w #3,d0
  14914.  
  14915. move.w #bytesToLcnt($200),d1
  14916. - move.l d0,(a1)+
  14917. dbf d1,-
  14918.  
  14919. move.l d0,d4
  14920. move.w (TempArray_LayerDef+$22).w,d0
  14921. addq.w #4,(TempArray_LayerDef+$22).w
  14922. sub.w d0,d2
  14923. move.w d2,d0
  14924. move.w d0,d1
  14925. asr.w #1,d0
  14926. asr.w #4,d1
  14927. sub.w d1,d0
  14928. ext.l d0
  14929. asl.l #8,d0
  14930. divs.w #$70,d0
  14931. ext.l d0
  14932. asl.l #8,d0
  14933. lea (TempArray_LayerDef).w,a2
  14934. moveq #0,d3
  14935. move.w d1,d3
  14936. swap d3
  14937. add.l d0,d3
  14938. swap d3
  14939. move.w d3,(a2)+
  14940. swap d3
  14941. add.l d0,d3
  14942. swap d3
  14943. move.w d3,(a2)+
  14944. swap d3
  14945. add.l d0,d3
  14946. swap d3
  14947. move.w d3,(a2)+
  14948. move.w d3,(a2)+
  14949. swap d3
  14950. add.l d0,d3
  14951. add.l d0,d3
  14952. swap d3
  14953.  
  14954. moveq #3,d1
  14955. - move.w d3,(a2)+
  14956. move.w d3,(a2)+
  14957. move.w d3,(a2)+
  14958. swap d3
  14959. add.l d0,d3
  14960. add.l d0,d3
  14961. add.l d0,d3
  14962. swap d3
  14963. dbf d1,-
  14964.  
  14965. add.l d0,d0
  14966. add.l d0,d0
  14967. move.w d3,d4
  14968. move.l d4,(a1)+
  14969. move.l d4,(a1)+
  14970. move.l d4,(a1)+
  14971. swap d3
  14972. add.l d0,d3
  14973. swap d3
  14974. move.w d3,d4
  14975. move.l d4,(a1)+
  14976. move.l d4,(a1)+
  14977. move.l d4,(a1)+
  14978. move.l d4,(a1)+
  14979. move.l d4,(a1)+
  14980. swap d3
  14981. add.l d0,d3
  14982. swap d3
  14983. move.w d3,d4
  14984.  
  14985. move.w #6,d1
  14986. - move.l d4,(a1)+
  14987. dbf d1,-
  14988.  
  14989. swap d3
  14990. add.l d0,d3
  14991. add.l d0,d3
  14992. swap d3
  14993. move.w d3,d4
  14994.  
  14995. move.w #7,d1
  14996. - move.l d4,(a1)+
  14997. dbf d1,-
  14998.  
  14999. swap d3
  15000. add.l d0,d3
  15001. add.l d0,d3
  15002. swap d3
  15003. move.w d3,d4
  15004.  
  15005. move.w #9,d1
  15006. - move.l d4,(a1)+
  15007. dbf d1,-
  15008.  
  15009. swap d3
  15010. add.l d0,d3
  15011. add.l d0,d3
  15012. add.l d0,d3
  15013. swap d3
  15014. move.w d3,d4
  15015.  
  15016. move.w #$E,d1
  15017. - move.l d4,(a1)+
  15018. dbf d1,-
  15019.  
  15020. swap d3
  15021. add.l d0,d3
  15022. add.l d0,d3
  15023. add.l d0,d3
  15024. swap d3
  15025.  
  15026. move.w #2,d2
  15027. - move.w d3,d4
  15028.  
  15029. move.w #$F,d1
  15030. - move.l d4,(a1)+
  15031. dbf d1,-
  15032.  
  15033. swap d3
  15034. add.l d0,d3
  15035. add.l d0,d3
  15036. add.l d0,d3
  15037. add.l d0,d3
  15038. swap d3
  15039. dbf d2,--
  15040.  
  15041. rts
  15042. ; ===========================================================================
  15043.  
  15044. ;loc_CA92:
  15045. HTZ_Screen_Shake:
  15046. move.w (Camera_BG_X_pos_diff).w,d4
  15047. ext.l d4
  15048. lsl.l #8,d4
  15049. moveq #2,d6
  15050. bsr.w SetHorizScrollFlagsBG
  15051. move.w (Camera_BG_Y_pos_diff).w,d5
  15052. ext.l d5
  15053. lsl.l #8,d5
  15054. moveq #0,d6
  15055. bsr.w SetVertiScrollFlagsBG
  15056. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  15057. move.w (Camera_Y_pos).w,(Vscroll_Factor_FG).w
  15058. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  15059. moveq #0,d2
  15060. tst.b (Screen_Shaking_Flag).w
  15061. beq.s +
  15062.  
  15063. move.w (Timer_frames).w,d0
  15064. andi.w #$3F,d0
  15065. lea_ SwScrl_RippleData,a1
  15066. lea (a1,d0.w),a1
  15067. moveq #0,d0
  15068. move.b (a1)+,d0
  15069. add.w d0,(Vscroll_Factor_FG).w
  15070. add.w d0,(Vscroll_Factor_BG).w
  15071. add.w d0,(Camera_Y_pos_copy).w
  15072. move.b (a1)+,d2
  15073. add.w d2,(Camera_X_pos_copy).w
  15074. +
  15075. lea (Horiz_Scroll_Buf).w,a1
  15076. move.w #bytesToLcnt($380),d1
  15077. move.w (Camera_X_pos).w,d0
  15078. add.w d2,d0
  15079. neg.w d0
  15080. swap d0
  15081. move.w (Camera_BG_X_pos).w,d0
  15082. add.w d2,d0
  15083. neg.w d0
  15084.  
  15085. - move.l d0,(a1)+
  15086. dbf d1,-
  15087.  
  15088. rts
  15089. ; ===========================================================================
  15090. ; loc_CB10:
  15091. SwScrl_HTZ_2P:
  15092. move.w (Camera_X_pos_diff).w,d4
  15093. ext.l d4
  15094. asl.l #6,d4
  15095. move.w (Camera_Y_pos_diff).w,d5
  15096. ext.l d5
  15097. asl.l #2,d5
  15098. moveq #0,d5
  15099. bsr.w SetHorizVertiScrollFlagsBG
  15100. move.b #0,(Scroll_flags_BG).w
  15101. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  15102. andi.l #$FFFEFFFE,(Vscroll_Factor).w
  15103. lea (Horiz_Scroll_Buf).w,a1
  15104. move.w #bytesToLcnt($1C0),d1
  15105. move.w (Camera_X_pos).w,d0
  15106. neg.w d0
  15107. swap d0
  15108. move.w (Camera_BG_X_pos).w,d0
  15109. neg.w d0
  15110.  
  15111. - move.l d0,(a1)+
  15112. dbf d1,-
  15113.  
  15114. move.w (Camera_X_pos_diff_P2).w,d4
  15115. ext.l d4
  15116. asl.l #6,d4
  15117. add.l d4,(Camera_BG_X_pos_P2).w
  15118. moveq #0,d0
  15119. move.w d0,(Vscroll_Factor_P2_BG).w
  15120. subi.w #$E0,(Vscroll_Factor_P2_BG).w
  15121. move.w (Camera_Y_pos_P2).w,(Vscroll_Factor_P2_FG).w
  15122. subi.w #$E0,(Vscroll_Factor_P2_FG).w
  15123. andi.l #$FFFEFFFE,(Vscroll_Factor_P2).w
  15124. lea (Horiz_Scroll_Buf+$1B0).w,a1
  15125. move.w #bytesToLcnt($1D0),d1
  15126. move.w (Camera_X_pos_P2).w,d0
  15127. neg.w d0
  15128. swap d0
  15129. move.w (Camera_BG_X_pos_P2).w,d0
  15130. neg.w d0
  15131.  
  15132. - move.l d0,(a1)+
  15133. dbf d1,-
  15134.  
  15135. rts
  15136. ; ===========================================================================
  15137. ; unused...
  15138. ; loc_CBA0:
  15139. SwScrl_HPZ:
  15140. move.w (Camera_X_pos_diff).w,d4
  15141. ext.l d4
  15142. asl.l #6,d4
  15143. moveq #2,d6
  15144. bsr.w SetHorizScrollFlagsBG
  15145. move.w (Camera_Y_pos_diff).w,d5
  15146. ext.l d5
  15147. asl.l #7,d5
  15148. moveq #6,d6
  15149. bsr.w SetVertiScrollFlagsBG
  15150. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  15151. lea (TempArray_LayerDef).w,a1
  15152. move.w (Camera_X_pos).w,d2
  15153. neg.w d2
  15154. move.w d2,d0
  15155. asr.w #1,d0
  15156.  
  15157. move.w #7,d1
  15158. - move.w d0,(a1)+
  15159. dbf d1,-
  15160.  
  15161. move.w d2,d0
  15162. asr.w #3,d0
  15163. sub.w d2,d0
  15164. ext.l d0
  15165. asl.l #3,d0
  15166. divs.w #8,d0
  15167. ext.l d0
  15168. asl.l #4,d0
  15169. asl.l #8,d0
  15170. moveq #0,d3
  15171. move.w d2,d3
  15172. asr.w #1,d3
  15173. lea (TempArray_LayerDef+$60).w,a2
  15174. swap d3
  15175. add.l d0,d3
  15176. swap d3
  15177. move.w d3,(a1)+
  15178. move.w d3,(a1)+
  15179. move.w d3,(a1)+
  15180. move.w d3,-(a2)
  15181. move.w d3,-(a2)
  15182. move.w d3,-(a2)
  15183. swap d3
  15184. add.l d0,d3
  15185. swap d3
  15186. move.w d3,(a1)+
  15187. move.w d3,(a1)+
  15188. move.w d3,-(a2)
  15189. move.w d3,-(a2)
  15190. swap d3
  15191. add.l d0,d3
  15192. swap d3
  15193. move.w d3,(a1)+
  15194. move.w d3,-(a2)
  15195. swap d3
  15196. add.l d0,d3
  15197. swap d3
  15198. move.w d3,(a1)+
  15199. move.w d3,-(a2)
  15200. move.w (Camera_BG_X_pos).w,d0
  15201. neg.w d0
  15202.  
  15203. move.w #$19,d1
  15204. - move.w d0,(a1)+
  15205. dbf d1,-
  15206.  
  15207. adda.w #$E,a1
  15208. move.w d2,d0
  15209. asr.w #1,d0
  15210.  
  15211. move.w #$17,d1
  15212. - move.w d0,(a1)+
  15213. dbf d1,-
  15214.  
  15215. lea (TempArray_LayerDef).w,a2
  15216. move.w (Camera_BG_Y_pos).w,d0
  15217. move.w d0,d2
  15218. andi.w #$3F0,d0
  15219. lsr.w #3,d0
  15220. lea (a2,d0.w),a2
  15221. bra.w SwScrl_HPZ_Continued
  15222. ; ===========================================================================
  15223. ; loc_CC66:
  15224. SwScrl_OOZ:
  15225. move.w (Camera_X_pos_diff).w,d0
  15226. ext.l d0
  15227. asl.l #5,d0
  15228. add.l d0,(Camera_BG_X_pos).w
  15229. move.w (Camera_Y_pos_diff).w,d0
  15230. ext.l d0
  15231. asl.l #5,d0
  15232. move.l (Camera_BG_Y_pos).w,d3
  15233. add.l d3,d0
  15234. moveq #4,d6
  15235. bsr.w SetVertiScrollFlagsBG2
  15236. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  15237. lea (Horiz_Scroll_Buf+$380).w,a1
  15238. move.w (Camera_X_pos).w,d0
  15239. neg.w d0
  15240. swap d0
  15241. move.w (Camera_BG_X_pos).w,d7
  15242. neg.w d7
  15243. move.w (Camera_BG_Y_pos).w,d1
  15244. subi.w #$50,d1
  15245. bcc.s +
  15246. moveq #0,d1
  15247. +
  15248. subi.w #$B0,d1
  15249. bcs.s +
  15250. moveq #0,d1
  15251. +
  15252. move.w #$DF,d6
  15253. add.w d6,d1
  15254. move.w d7,d0
  15255. bsr.s OOZ_BGScroll_Lines
  15256. bsr.s OOZ_BGScroll_MediumClouds
  15257. bsr.s OOZ_BGScroll_SlowClouds
  15258. bsr.s OOZ_BGScroll_FastClouds
  15259. move.w d7,d0
  15260. asr.w #4,d0
  15261. moveq #6,d1
  15262. bsr.s OOZ_BGScroll_Lines
  15263. move.b (Vint_runcount+3).w,d1
  15264. andi.w #7,d1
  15265. bne.s +
  15266. subq.w #1,(TempArray_LayerDef).w
  15267. +
  15268. move.w (TempArray_LayerDef).w,d1
  15269. andi.w #$1F,d1
  15270. lea SwScrl_RippleData(pc),a2
  15271. lea (a2,d1.w),a2
  15272.  
  15273. moveq #$20,d1
  15274. - move.b (a2)+,d0
  15275. ext.w d0
  15276. move.l d0,-(a1)
  15277. subq.w #1,d6
  15278. bmi.s + ; rts
  15279. dbf d1,-
  15280.  
  15281. bsr.s OOZ_BGScroll_MediumClouds
  15282. bsr.s OOZ_BGScroll_SlowClouds
  15283. bsr.s OOZ_BGScroll_FastClouds
  15284. bsr.s OOZ_BGScroll_SlowClouds
  15285. bsr.s OOZ_BGScroll_MediumClouds
  15286. move.w d7,d0
  15287. moveq #$47,d1
  15288. bsr.s OOZ_BGScroll_Lines
  15289. + rts
  15290.  
  15291. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  15292.  
  15293. ;sub_CD0A
  15294. OOZ_BGScroll_FastClouds:
  15295. move.w d7,d0
  15296. asr.w #2,d0
  15297. bra.s +
  15298. ; End of function OOZ_BGScroll_FastClouds
  15299.  
  15300.  
  15301. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  15302.  
  15303. ;sub_CD10
  15304. OOZ_BGScroll_MediumClouds:
  15305. move.w d7,d0
  15306. asr.w #3,d0
  15307. bra.s +
  15308. ; End of function OOZ_BGScroll_MediumClouds
  15309.  
  15310.  
  15311. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  15312.  
  15313. ;sub_CD16
  15314. OOZ_BGScroll_SlowClouds:
  15315. move.w d7,d0
  15316. asr.w #4,d0
  15317.  
  15318. +
  15319. moveq #7,d1
  15320. ; End of function OOZ_BGScroll_SlowClouds
  15321.  
  15322.  
  15323. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  15324.  
  15325. ; Scrolls min(d6,d1+1) lines by an (constant) amount specified in d0
  15326.  
  15327. ;sub_CD1C
  15328. OOZ_BGScroll_Lines:
  15329. move.l d0,-(a1)
  15330. subq.w #1,d6
  15331. bmi.s +
  15332. dbf d1,OOZ_BGScroll_Lines
  15333.  
  15334. rts
  15335. ; ===========================================================================
  15336. +
  15337. addq.l #4,sp
  15338. rts
  15339. ; End of function OOZ_BGScroll_Lines
  15340.  
  15341. ; ===========================================================================
  15342. ; loc_CD2C:
  15343. SwScrl_MCZ:
  15344. tst.w (Two_player_mode).w
  15345. bne.w SwScrl_MCZ_2P
  15346. move.w (Camera_Y_pos).w,d0
  15347. move.l (Camera_BG_Y_pos).w,d3
  15348. tst.b (Current_Act).w
  15349. bne.s +
  15350. divu.w #3,d0
  15351. subi.w #$140,d0
  15352. bra.s ++
  15353. ; ===========================================================================
  15354. +
  15355. divu.w #6,d0
  15356. subi.w #$10,d0
  15357. +
  15358. swap d0
  15359. moveq #6,d6
  15360. bsr.w SetVertiScrollFlagsBG2
  15361. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  15362. moveq #0,d2
  15363. tst.b (Screen_Shaking_Flag).w
  15364. beq.s +
  15365.  
  15366. move.w (Timer_frames).w,d0
  15367. andi.w #$3F,d0
  15368. lea_ SwScrl_RippleData,a1
  15369. lea (a1,d0.w),a1
  15370. moveq #0,d0
  15371. move.b (a1)+,d0
  15372. add.w d0,(Vscroll_Factor_FG).w
  15373. add.w d0,(Vscroll_Factor_BG).w
  15374. add.w d0,(Camera_Y_pos_copy).w
  15375. move.b (a1)+,d2
  15376. add.w d2,(Camera_X_pos_copy).w
  15377. +
  15378. lea (TempArray_LayerDef).w,a2
  15379. lea $1E(a2),a3
  15380. move.w (Camera_X_pos).w,d0
  15381. ext.l d0
  15382. asl.l #4,d0
  15383. divs.w #$A,d0
  15384. ext.l d0
  15385. asl.l #4,d0
  15386. asl.l #8,d0
  15387. move.l d0,d1
  15388. swap d1
  15389. move.w d1,(a3)+
  15390. move.w d1,$E(a2)
  15391. swap d1
  15392. add.l d0,d1
  15393. swap d1
  15394. move.w d1,(a3)+
  15395. move.w d1,$C(a2)
  15396. swap d1
  15397. add.l d0,d1
  15398. swap d1
  15399. move.w d1,(a3)+
  15400. move.w d1,$A(a2)
  15401. swap d1
  15402. add.l d0,d1
  15403. swap d1
  15404. move.w d1,(a3)+
  15405. move.w d1,8(a2)
  15406. swap d1
  15407. add.l d0,d1
  15408. swap d1
  15409. move.w d1,(a3)+
  15410. move.w d1,6(a2)
  15411. move.w d1,$10(a2)
  15412. move.w d1,$1C(a2)
  15413. swap d1
  15414. add.l d0,d1
  15415. swap d1
  15416. move.w d1,(a3)+
  15417. swap d1
  15418. add.l d0,d1
  15419. swap d1
  15420. move.w d1,(a3)+
  15421. move.w d1,4(a2)
  15422. move.w d1,$12(a2)
  15423. move.w d1,$1A(a2)
  15424. swap d1
  15425. add.l d0,d1
  15426. swap d1
  15427. move.w d1,(a3)+
  15428. move.w d1,2(a2)
  15429. move.w d1,$14(a2)
  15430. move.w d1,$18(a2)
  15431. swap d1
  15432. add.l d0,d1
  15433. swap d1
  15434. move.w d1,(a3)+
  15435. move.w d1,(a2)
  15436. move.w d1,$16(a2)
  15437. lea (SwScrl_MCZ_RowHeights).l,a3
  15438. lea (TempArray_LayerDef).w,a2
  15439. lea (Horiz_Scroll_Buf).w,a1
  15440. move.w (Camera_BG_Y_pos).w,d1
  15441. moveq #0,d0
  15442.  
  15443. - move.b (a3)+,d0
  15444. addq.w #2,a2
  15445. sub.w d0,d1
  15446. bcc.s -
  15447.  
  15448. neg.w d1
  15449. subq.w #2,a2
  15450. move.w #bytesToLcnt($380),d2
  15451. move.w (Camera_X_pos).w,d0
  15452. neg.w d0
  15453. swap d0
  15454. move.w (a2)+,d0
  15455. neg.w d0
  15456.  
  15457. - move.l d0,(a1)+
  15458. subq.w #1,d1
  15459. bne.s +
  15460. move.b (a3)+,d1
  15461. move.w (a2)+,d0
  15462. neg.w d0
  15463. + dbf d2,-
  15464.  
  15465. rts
  15466. ; ===========================================================================
  15467. ; byte_CE6C:
  15468. SwScrl_MCZ_RowHeights:
  15469. dc.b $25
  15470. dc.b $17 ; 1
  15471. dc.b $12 ; 2
  15472. dc.b 7 ; 3
  15473. dc.b 7 ; 4
  15474. dc.b 2 ; 5
  15475. dc.b 2 ; 6
  15476. dc.b $30 ; 7
  15477. dc.b $D ; 8
  15478. dc.b $13 ; 9
  15479. dc.b $20 ; 10
  15480. dc.b $40 ; 11
  15481. dc.b $20 ; 12
  15482. dc.b $13 ; 13
  15483. dc.b $D ; 14
  15484. dc.b $30 ; 15
  15485. dc.b 2 ; 16
  15486. dc.b 2 ; 17
  15487. dc.b 7 ; 18
  15488. dc.b 7 ; 19
  15489. dc.b $20 ; 20
  15490. dc.b $12 ; 21
  15491. dc.b $17 ; 22
  15492. dc.b $25 ; 23
  15493. even
  15494. ; ===========================================================================
  15495. ; loc_CE84:
  15496. SwScrl_MCZ_2P:
  15497. moveq #0,d0
  15498. move.w (Camera_Y_pos).w,d0
  15499. tst.b (Current_Act).w
  15500. bne.s +
  15501. divu.w #3,d0
  15502. subi.w #$140,d0
  15503. bra.s ++
  15504. ; ===========================================================================
  15505. +
  15506. divu.w #6,d0
  15507. subi.w #$10,d0
  15508. +
  15509. move.w d0,(Camera_BG_Y_pos).w
  15510. move.w d0,(Vscroll_Factor_BG).w
  15511. andi.l #$FFFEFFFE,(Vscroll_Factor).w
  15512. lea (TempArray_LayerDef).w,a2
  15513. lea $1E(a2),a3
  15514. move.w (Camera_X_pos).w,d0
  15515. ext.l d0
  15516. asl.l #4,d0
  15517. divs.w #$A,d0
  15518. ext.l d0
  15519. asl.l #4,d0
  15520. asl.l #8,d0
  15521. move.l d0,d1
  15522. swap d1
  15523. move.w d1,(a3)+
  15524. move.w d1,$E(a2)
  15525. swap d1
  15526. add.l d0,d1
  15527. swap d1
  15528. move.w d1,(a3)+
  15529. move.w d1,$C(a2)
  15530. swap d1
  15531. add.l d0,d1
  15532. swap d1
  15533. move.w d1,(a3)+
  15534. move.w d1,$A(a2)
  15535. swap d1
  15536. add.l d0,d1
  15537. swap d1
  15538. move.w d1,(a3)+
  15539. move.w d1,8(a2)
  15540. swap d1
  15541. add.l d0,d1
  15542. swap d1
  15543. move.w d1,(a3)+
  15544. move.w d1,6(a2)
  15545. move.w d1,$10(a2)
  15546. move.w d1,$1C(a2)
  15547. swap d1
  15548. add.l d0,d1
  15549. swap d1
  15550. move.w d1,(a3)+
  15551. swap d1
  15552. add.l d0,d1
  15553. swap d1
  15554. move.w d1,(a3)+
  15555. move.w d1,4(a2)
  15556. move.w d1,$12(a2)
  15557. move.w d1,$1A(a2)
  15558. swap d1
  15559. add.l d0,d1
  15560. swap d1
  15561. move.w d1,(a3)+
  15562. move.w d1,2(a2)
  15563. move.w d1,$14(a2)
  15564. move.w d1,$18(a2)
  15565. swap d1
  15566. add.l d0,d1
  15567. swap d1
  15568. move.w d1,(a3)+
  15569. move.w d1,(a2)
  15570. move.w d1,$16(a2)
  15571. lea (SwScrl_MCZ2P_RowHeights).l,a3
  15572. lea (TempArray_LayerDef).w,a2
  15573. lea (Horiz_Scroll_Buf).w,a1
  15574. move.w (Camera_BG_Y_pos).w,d1
  15575. lsr.w #1,d1
  15576. moveq #0,d0
  15577.  
  15578. - move.b (a3)+,d0
  15579. addq.w #2,a2
  15580. sub.w d0,d1
  15581. bcc.s -
  15582.  
  15583. neg.w d1
  15584. subq.w #2,a2
  15585. move.w #bytesToLcnt($1C0),d2
  15586. move.w (Camera_X_pos).w,d0
  15587. neg.w d0
  15588. swap d0
  15589. move.w (a2)+,d0
  15590. neg.w d0
  15591.  
  15592. - move.l d0,(a1)+
  15593. subq.w #1,d1
  15594. bne.s +
  15595. move.b (a3)+,d1
  15596. move.w (a2)+,d0
  15597. neg.w d0
  15598. + dbf d2,-
  15599.  
  15600. bra.s +
  15601. ; ===========================================================================
  15602. ; byte_CF90:
  15603. SwScrl_MCZ2P_RowHeights:
  15604. dc.b $13
  15605. dc.b $B
  15606. dc.b 9 ; 1
  15607. dc.b 4 ; 2
  15608. dc.b 3 ; 3
  15609. dc.b 1 ; 4
  15610. dc.b 1 ; 5
  15611. dc.b $18 ; 6
  15612. dc.b 6 ; 7
  15613. dc.b $A ; 8
  15614. dc.b $10 ; 9
  15615. dc.b $20 ; 10
  15616. dc.b $10 ; 11
  15617. dc.b $A ; 12
  15618. dc.b 6 ; 13
  15619. dc.b $18 ; 14
  15620. dc.b 1 ; 15
  15621. dc.b 1 ; 16
  15622. dc.b 3 ; 17
  15623. dc.b 4 ; 18
  15624. dc.b $10 ; 19
  15625. dc.b 9 ; 20
  15626. dc.b $B ; 21
  15627. dc.b $13 ; 22
  15628. even
  15629. ; ===========================================================================
  15630. +
  15631. moveq #0,d0
  15632. move.w (Camera_Y_pos_P2).w,d0
  15633. tst.b (Current_Act).w
  15634. bne.s +
  15635. divu.w #3,d0
  15636. subi.w #$140,d0
  15637. bra.s ++
  15638. ; ===========================================================================
  15639. +
  15640. divu.w #6,d0
  15641. subi.w #$10,d0
  15642. +
  15643. move.w d0,(Camera_BG_Y_pos_P2).w
  15644. move.w d0,(Vscroll_Factor_P2_BG).w
  15645. subi.w #$E0,(Vscroll_Factor_P2_BG).w
  15646. move.w (Camera_Y_pos_P2).w,(Vscroll_Factor_P2_FG).w
  15647. subi.w #$E0,(Vscroll_Factor_P2_FG).w
  15648. andi.l #$FFFEFFFE,(Vscroll_Factor_P2).w
  15649. lea (TempArray_LayerDef).w,a2
  15650. lea $1E(a2),a3
  15651. move.w (Camera_X_pos_P2).w,d0
  15652. ext.l d0
  15653. asl.l #4,d0
  15654. divs.w #$A,d0
  15655. ext.l d0
  15656. asl.l #4,d0
  15657. asl.l #8,d0
  15658. move.l d0,d1
  15659. swap d1
  15660. move.w d1,(a3)+
  15661. move.w d1,$E(a2)
  15662. swap d1
  15663. add.l d0,d1
  15664. swap d1
  15665. move.w d1,(a3)+
  15666. move.w d1,$C(a2)
  15667. swap d1
  15668. add.l d0,d1
  15669. swap d1
  15670. move.w d1,(a3)+
  15671. move.w d1,$A(a2)
  15672. swap d1
  15673. add.l d0,d1
  15674. swap d1
  15675. move.w d1,(a3)+
  15676. move.w d1,8(a2)
  15677. swap d1
  15678. add.l d0,d1
  15679. swap d1
  15680. move.w d1,(a3)+
  15681. move.w d1,6(a2)
  15682. move.w d1,$10(a2)
  15683. move.w d1,$1C(a2)
  15684. swap d1
  15685. add.l d0,d1
  15686. swap d1
  15687. move.w d1,(a3)+
  15688. swap d1
  15689. add.l d0,d1
  15690. swap d1
  15691. move.w d1,(a3)+
  15692. move.w d1,4(a2)
  15693. move.w d1,$12(a2)
  15694. move.w d1,$1A(a2)
  15695. swap d1
  15696. add.l d0,d1
  15697. swap d1
  15698. move.w d1,(a3)+
  15699. move.w d1,2(a2)
  15700. move.w d1,$14(a2)
  15701. move.w d1,$18(a2)
  15702. swap d1
  15703. add.l d0,d1
  15704. swap d1
  15705. move.w d1,(a3)+
  15706. move.w d1,(a2)
  15707. move.w d1,$16(a2)
  15708. lea_ SwScrl_MCZ2P_RowHeights+1,a3
  15709. lea (TempArray_LayerDef).w,a2
  15710. lea (Horiz_Scroll_Buf+$1B0).w,a1
  15711. move.w (Camera_BG_Y_pos_P2).w,d1
  15712. lsr.w #1,d1
  15713. moveq #$17,d0
  15714. bra.s +
  15715. ; ===========================================================================
  15716. -
  15717. move.b (a3)+,d0
  15718. +
  15719. addq.w #2,a2
  15720. sub.w d0,d1
  15721. bcc.s -
  15722.  
  15723. neg.w d1
  15724. subq.w #2,a2
  15725. move.w #bytesToLcnt($1D0),d2
  15726. move.w (Camera_X_pos_P2).w,d0
  15727. neg.w d0
  15728. swap d0
  15729. move.w (a2)+,d0
  15730. neg.w d0
  15731.  
  15732. - move.l d0,(a1)+
  15733. subq.w #1,d1
  15734. bne.s +
  15735. move.b (a3)+,d1
  15736. move.w (a2)+,d0
  15737. neg.w d0
  15738. + dbf d2,-
  15739.  
  15740. rts
  15741. ; ===========================================================================
  15742. ; loc_D0C6:
  15743. SwScrl_CNZ:
  15744. tst.w (Two_player_mode).w
  15745. bne.w SwScrl_CNZ_2P
  15746. move.w (Camera_Y_pos).w,d0
  15747. lsr.w #6,d0
  15748. move.w d0,(Camera_BG_Y_pos).w
  15749. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  15750. move.w (Camera_X_pos).w,d2
  15751. bsr.w sub_D160
  15752. lea (SwScrl_CNZ_RowHeights).l,a3
  15753. lea (TempArray_LayerDef).w,a2
  15754. lea (Horiz_Scroll_Buf).w,a1
  15755. move.w (Camera_BG_Y_pos).w,d1
  15756. moveq #0,d0
  15757.  
  15758. - move.b (a3)+,d0
  15759. addq.w #2,a2
  15760. sub.w d0,d1
  15761. bcc.s -
  15762.  
  15763. neg.w d1
  15764. subq.w #2,a2
  15765. move.w #bytesToLcnt($380),d2
  15766. move.w (Camera_X_pos).w,d0
  15767. neg.w d0
  15768. swap d0
  15769. move.w (a2)+,d0
  15770. neg.w d0
  15771.  
  15772. - move.l d0,(a1)+
  15773. subq.w #1,d1
  15774. bne.s +
  15775.  
  15776. - move.w (a2)+,d0
  15777. neg.w d0
  15778. move.b (a3)+,d1
  15779. beq.s ++
  15780. + dbf d2,--
  15781.  
  15782. rts
  15783. ; ===========================================================================
  15784. +
  15785. move.w #bytesToLcnt($40),d1
  15786. move.w d0,d3
  15787. move.b (Vint_runcount+3).w,d0
  15788. lsr.w #3,d0
  15789. neg.w d0
  15790. andi.w #$1F,d0
  15791. lea_ SwScrl_RippleData,a4
  15792. lea (a4,d0.w),a4
  15793.  
  15794. - move.b (a4)+,d0
  15795. ext.w d0
  15796. add.w d3,d0
  15797. move.l d0,(a1)+
  15798. dbf d1,-
  15799.  
  15800. subi.w #$10,d2
  15801. bra.s --
  15802. ; ===========================================================================
  15803. ; byte_D156:
  15804. SwScrl_CNZ_RowHeights:
  15805. dc.b $10
  15806. dc.b $10 ; 1
  15807. dc.b $10 ; 2
  15808. dc.b $10 ; 3
  15809. dc.b $10 ; 4
  15810. dc.b $10 ; 5
  15811. dc.b $10 ; 6
  15812. dc.b $10 ; 7
  15813. dc.b 0 ; 8
  15814. dc.b -$10 ; 9
  15815. even
  15816.  
  15817. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  15818.  
  15819.  
  15820. sub_D160:
  15821. lea (TempArray_LayerDef).w,a1
  15822. move.w d2,d0
  15823. asr.w #3,d0
  15824. sub.w d2,d0
  15825. ext.l d0
  15826. asl.l #5,d0
  15827. asl.l #8,d0
  15828. moveq #0,d3
  15829. move.w d2,d3
  15830.  
  15831. move.w #6,d1
  15832. - move.w d3,(a1)+
  15833. swap d3
  15834. add.l d0,d3
  15835. swap d3
  15836. dbf d1,-
  15837.  
  15838. move.w d2,d0
  15839. asr.w #3,d0
  15840. move.w d0,4(a1)
  15841. asr.w #1,d0
  15842. move.w d0,(a1)+
  15843. move.w d0,(a1)+
  15844. rts
  15845. ; End of function sub_D160
  15846.  
  15847. ; ===========================================================================
  15848. ; loc_D194:
  15849. SwScrl_CNZ_2P:
  15850. move.w (Camera_Y_pos).w,d0
  15851. lsr.w #6,d0
  15852. move.w d0,(Camera_BG_Y_pos).w
  15853. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  15854. andi.l #$FFFEFFFE,(Vscroll_Factor).w
  15855. move.w (Camera_X_pos).w,d2
  15856. bsr.w sub_D160
  15857. lea (Horiz_Scroll_Buf).w,a1
  15858. move.w (Camera_BG_Y_pos).w,d1
  15859. moveq #0,d0
  15860. move.w (Camera_X_pos).w,d0
  15861. move.w #$6F,d2
  15862. lea (SwScrl_CNZ2P_RowHeights+2).l,a3
  15863. bsr.s sub_D216
  15864. move.w (Camera_Y_pos_P2).w,d0
  15865. lsr.w #6,d0
  15866. move.w d0,(Camera_BG_Y_pos_P2).w
  15867. move.w d0,(Vscroll_Factor_P2_BG).w
  15868. subi.w #$E0,(Vscroll_Factor_P2_BG).w
  15869. move.w (Camera_Y_pos_P2).w,(Vscroll_Factor_P2_FG).w
  15870. subi.w #$E0,(Vscroll_Factor_P2_FG).w
  15871. andi.l #$FFFEFFFE,(Vscroll_Factor_P2).w
  15872. move.w (Camera_X_pos_P2).w,d2
  15873. bsr.w sub_D160
  15874. lea (Horiz_Scroll_Buf+$1B0).w,a1
  15875. move.w (Camera_BG_Y_pos_P2).w,d1
  15876. moveq #0,d0
  15877. move.w (Camera_X_pos_P2).w,d0
  15878. move.w #bytesToLcnt($1D0),d2
  15879. lea (SwScrl_CNZ2P_RowHeights+1).l,a3
  15880.  
  15881. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  15882.  
  15883.  
  15884. sub_D216:
  15885. lsr.w #1,d1
  15886. lea (TempArray_LayerDef).w,a2
  15887. moveq #0,d3
  15888.  
  15889. - move.b (a3)+,d3
  15890. addq.w #2,a2
  15891. sub.w d3,d1
  15892. bcc.s -
  15893.  
  15894. neg.w d1
  15895. subq.w #2,a2
  15896. neg.w d0
  15897. swap d0
  15898. move.w (a2)+,d0
  15899. neg.w d0
  15900.  
  15901. - move.l d0,(a1)+
  15902. subq.w #1,d1
  15903. bne.s +
  15904.  
  15905. - move.w (a2)+,d0
  15906. neg.w d0
  15907. move.b (a3)+,d1
  15908. beq.s ++
  15909. +
  15910. dbf d2,--
  15911.  
  15912. rts
  15913. ; ===========================================================================
  15914. +
  15915. move.w #bytesToLcnt($20),d1
  15916. move.w d0,d3
  15917. move.b (Vint_runcount+3).w,d0
  15918. lsr.w #3,d0
  15919. neg.w d0
  15920. andi.w #$1F,d0
  15921. lea_ SwScrl_RippleData,a4
  15922. lea (a4,d0.w),a4
  15923.  
  15924. - move.b (a4)+,d0
  15925. ext.w d0
  15926. add.w d3,d0
  15927. move.l d0,(a1)+
  15928. dbf d1,-
  15929.  
  15930. subq.w #8,d2
  15931. bra.s --
  15932. ; End of function sub_D216
  15933.  
  15934. ; ===========================================================================
  15935. ; byte_D270:
  15936. SwScrl_CNZ2P_RowHeights:
  15937. dc.b 4
  15938. dc.b 4 ; 1
  15939. dc.b 8 ; 2
  15940. dc.b 8 ; 3
  15941. dc.b 8 ; 4
  15942. dc.b 8 ; 5
  15943. dc.b 8 ; 6
  15944. dc.b 8 ; 7
  15945. dc.b 8 ; 8
  15946. dc.b 8 ; 9
  15947. dc.b 0 ; 10
  15948. dc.b $78 ; 11
  15949. even
  15950. ; ===========================================================================
  15951. ; loc_D27C:
  15952. SwScrl_CPZ:
  15953. move.w (Camera_X_pos_diff).w,d4
  15954. ext.l d4
  15955. asl.l #5,d4
  15956. move.w (Camera_Y_pos_diff).w,d5
  15957. ext.l d5
  15958. asl.l #6,d5
  15959. bsr.w SetHorizVertiScrollFlagsBG
  15960. move.w (Camera_X_pos_diff).w,d4
  15961. ext.l d4
  15962. asl.l #7,d4
  15963. moveq #4,d6
  15964. bsr.w SetHorizScrollFlagsBG2
  15965. move.w (Camera_BG_Y_pos).w,d0
  15966. move.w d0,(Camera_BG2_Y_pos).w
  15967. move.w d0,(Vscroll_Factor_BG).w
  15968. move.b (Scroll_flags_BG).w,d0
  15969. or.b (Scroll_flags_BG2).w,d0
  15970. move.b d0,(Scroll_flags_BG3).w
  15971. clr.b (Scroll_flags_BG).w
  15972. clr.b (Scroll_flags_BG2).w
  15973. move.b (Vint_runcount+3).w,d1
  15974. andi.w #7,d1
  15975. bne.s +
  15976. subq.w #1,(TempArray_LayerDef).w
  15977. +
  15978. lea (CPZ_CameraSections+1).l,a0
  15979. move.w (Camera_BG_Y_pos).w,d0
  15980. move.w d0,d2
  15981. andi.w #$3F0,d0
  15982. lsr.w #4,d0
  15983. lea (a0,d0.w),a0
  15984. move.w d0,d4
  15985. lea (Horiz_Scroll_Buf).w,a1
  15986. move.w #$E,d1
  15987. move.w (Camera_X_pos).w,d0
  15988. neg.w d0
  15989. swap d0
  15990. andi.w #$F,d2
  15991. move.w (Camera_BG_X_pos).w,d0
  15992. cmpi.b #$12,d4
  15993. beq.s loc_D34A
  15994. blo.s +
  15995. move.w (Camera_BG2_X_pos).w,d0
  15996. +
  15997. neg.w d0
  15998. add.w d2,d2
  15999. jmp ++(pc,d2.w)
  16000. ; ===========================================================================
  16001.  
  16002. - move.w (Camera_BG_X_pos).w,d0
  16003. cmpi.b #$12,d4
  16004. beq.s +++
  16005. blo.s +
  16006. move.w (Camera_BG2_X_pos).w,d0
  16007. +
  16008. neg.w d0
  16009.  
  16010. + rept 16
  16011. move.l d0,(a1)+
  16012. endm
  16013. addq.b #1,d4
  16014. dbf d1,-
  16015. rts
  16016. ; ===========================================================================
  16017.  
  16018. loc_D34A:
  16019. move.w #bytesToLcnt($40),d0
  16020. sub.w d2,d0
  16021. move.w d0,d2
  16022. bra.s ++
  16023. ; ===========================================================================
  16024. +
  16025. move.w #$F,d2
  16026. +
  16027. move.w (Camera_BG_X_pos).w,d3
  16028. neg.w d3
  16029. move.w (TempArray_LayerDef).w,d0
  16030. andi.w #$1F,d0
  16031. lea_ SwScrl_RippleData,a2
  16032. lea (a2,d0.w),a2
  16033.  
  16034. - move.b (a2)+,d0
  16035. ext.w d0
  16036. add.w d3,d0
  16037. move.l d0,(a1)+
  16038. dbf d2,-
  16039.  
  16040. addq.b #1,d4
  16041. dbf d1,--
  16042. rts
  16043. ; ===========================================================================
  16044. ; loc_D382:
  16045. SwScrl_DEZ:
  16046. move.w (Camera_X_pos_diff).w,d4
  16047. ext.l d4
  16048. asl.l #8,d4
  16049. move.w (Camera_Y_pos_diff).w,d5
  16050. ext.l d5
  16051. asl.l #8,d5
  16052. bsr.w SetHorizVertiScrollFlagsBG
  16053. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  16054. move.w (Camera_X_pos).w,d4
  16055. lea (TempArray_LayerDef).w,a2
  16056. move.w d4,(a2)+
  16057.  
  16058. addq.w #3,(a2)+ ; these random-seeming numbers control how fast each row of stars scrolls by
  16059. addq.w #2,(a2)+
  16060. addq.w #4,(a2)+
  16061. addq.w #1,(a2)+
  16062. addq.w #2,(a2)+
  16063. addq.w #4,(a2)+
  16064. addq.w #3,(a2)+
  16065. addq.w #4,(a2)+
  16066. addq.w #2,(a2)+
  16067. addq.w #6,(a2)+
  16068. addq.w #3,(a2)+
  16069. addq.w #4,(a2)+
  16070. addq.w #1,(a2)+
  16071. addq.w #2,(a2)+
  16072. addq.w #4,(a2)+
  16073. addq.w #3,(a2)+
  16074. addq.w #2,(a2)+
  16075. addq.w #3,(a2)+
  16076. addq.w #4,(a2)+
  16077. addq.w #1,(a2)+
  16078. addq.w #3,(a2)+
  16079. addq.w #4,(a2)+
  16080. addq.w #2,(a2)+
  16081. addq.w #1,(a2)
  16082.  
  16083. move.w (a2)+,d0 ; this is to make one row go at half speed (1 pixel every other frame)
  16084. moveq #0,d1
  16085. move.w d0,d1
  16086. lsr.w #1,d0
  16087. move.w d0,(a2)+
  16088.  
  16089. addq.w #3,(a2)+ ; more star speeds...
  16090. addq.w #2,(a2)+
  16091. addq.w #4,(a2)+
  16092.  
  16093. swap d1
  16094. move.l d1,d0
  16095. lsr.l #3,d1
  16096. sub.l d1,d0
  16097. swap d0
  16098. move.w d0,4(a2)
  16099. swap d0
  16100. sub.l d1,d0
  16101. swap d0
  16102. move.w d0,2(a2)
  16103. swap d0
  16104. sub.l d1,d0
  16105. swap d0
  16106. move.w d0,(a2)+
  16107. addq.w #4,a2
  16108. addq.w #1,(a2)+
  16109. move.w d4,(a2)+
  16110. move.w d4,(a2)+
  16111. move.w d4,(a2)+
  16112. lea (SwScrl_DEZ_RowHeights).l,a3
  16113. lea (TempArray_LayerDef).w,a2
  16114. lea (Horiz_Scroll_Buf).w,a1
  16115. move.w (Camera_BG_Y_pos).w,d1
  16116. moveq #0,d0
  16117.  
  16118. - move.b (a3)+,d0
  16119. addq.w #2,a2
  16120. sub.w d0,d1
  16121. bcc.s -
  16122.  
  16123. neg.w d1
  16124. subq.w #2,a2
  16125. move.w #bytesToLcnt($380),d2
  16126. move.w (Camera_X_pos).w,d0
  16127. neg.w d0
  16128. swap d0
  16129. move.w (a2)+,d0
  16130. neg.w d0
  16131.  
  16132. - move.l d0,(a1)+
  16133. subq.w #1,d1
  16134. bne.s +
  16135. move.b (a3)+,d1
  16136. move.w (a2)+,d0
  16137. neg.w d0
  16138. + dbf d2,-
  16139.  
  16140. moveq #0,d2
  16141. tst.b (Screen_Shaking_Flag).w
  16142. beq.s ++ ; rts
  16143. subq.w #1,(DEZ_Shake_Timer).w
  16144. bpl.s +
  16145. clr.b (Screen_Shaking_Flag).w
  16146. +
  16147. move.w (Timer_frames).w,d0
  16148. andi.w #$3F,d0
  16149. lea_ SwScrl_RippleData,a1
  16150. lea (a1,d0.w),a1
  16151. moveq #0,d0
  16152. move.b (a1)+,d0
  16153. add.w d0,(Vscroll_Factor_FG).w
  16154. add.w d0,(Vscroll_Factor_BG).w
  16155. add.w d0,(Camera_Y_pos_copy).w
  16156. move.b (a1)+,d2
  16157. add.w d2,(Camera_X_pos_copy).w
  16158. +
  16159. rts
  16160. ; ===========================================================================
  16161. ; byte_D48A:
  16162. SwScrl_DEZ_RowHeights:
  16163. dc.b $80
  16164. dc.b 8 ; 1
  16165. dc.b 8 ; 2
  16166. dc.b 8 ; 3
  16167. dc.b 8 ; 4
  16168. dc.b 8 ; 5
  16169. dc.b 8 ; 6
  16170. dc.b 8 ; 7
  16171. dc.b 8 ; 8
  16172. dc.b 8 ; 9
  16173. dc.b 8 ; 10
  16174. dc.b 8 ; 11
  16175. dc.b 8 ; 12
  16176. dc.b 8 ; 13
  16177. dc.b 8 ; 14
  16178. dc.b 8 ; 15
  16179. dc.b 8 ; 16
  16180. dc.b 8 ; 17
  16181. dc.b 8 ; 18
  16182. dc.b 8 ; 19
  16183. dc.b 8 ; 20
  16184. dc.b 8 ; 21
  16185. dc.b 8 ; 22
  16186. dc.b 8 ; 23
  16187. dc.b 8 ; 24
  16188. dc.b 8 ; 25
  16189. dc.b 8 ; 26
  16190. dc.b 8 ; 27
  16191. dc.b 8 ; 28
  16192. dc.b 3 ; 29
  16193. dc.b 5 ; 30
  16194. dc.b 8 ; 31
  16195. dc.b $10 ; 32
  16196. dc.b $80 ; 33
  16197. dc.b $80 ; 34
  16198. dc.b $80 ; 35
  16199. even
  16200. ; ===========================================================================
  16201. ; loc_D4AE:
  16202. SwScrl_ARZ:
  16203. move.w (Camera_X_pos_diff).w,d4
  16204. ext.l d4
  16205. muls.w #$119,d4
  16206. moveq #2,d6
  16207. bsr.w SetHorizScrollFlagsBG_ARZ
  16208. move.w (Camera_Y_pos_diff).w,d5
  16209. ext.l d5
  16210. asl.l #7,d5
  16211. tst.b (Current_Act).w
  16212. bne.s +
  16213. asl.l #1,d5
  16214. +
  16215. moveq #6,d6
  16216. bsr.w SetVertiScrollFlagsBG
  16217.  
  16218. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  16219.  
  16220. moveq #0,d2
  16221. tst.b (Screen_Shaking_Flag).w
  16222. beq.s .screenNotShaking
  16223.  
  16224. move.w (Timer_frames).w,d0
  16225. andi.w #$3F,d0
  16226. lea_ SwScrl_RippleData,a1
  16227. lea (a1,d0.w),a1
  16228. moveq #0,d0
  16229. ; Shake camera Y-pos (note that BG scrolling is not affected by this, causing it to distort)
  16230. move.b (a1)+,d0
  16231. add.w d0,(Vscroll_Factor_FG).w
  16232. add.w d0,(Vscroll_Factor_BG).w
  16233. add.w d0,(Camera_Y_pos_copy).w
  16234. ; Shake camera X-pos
  16235. move.b (a1)+,d2
  16236. add.w d2,(Camera_X_pos_copy).w
  16237.  
  16238. .screenNotShaking:
  16239. lea (TempArray_LayerDef).w,a2 ; Starts at BG scroll row 1
  16240. lea 6(a2),a3 ; Starts at BG scroll row 4
  16241.  
  16242. ; Set up the speed of each row (there are 16 rows in total)
  16243. move.w (Camera_X_pos).w,d0
  16244. ext.l d0
  16245. asl.l #4,d0
  16246. divs.w #$A,d0
  16247. ext.l d0
  16248. asl.l #4,d0
  16249. asl.l #8,d0
  16250. move.l d0,d1
  16251.  
  16252. ; Set row 4's speed
  16253. swap d1
  16254. move.w d1,(a3)+ ; Top row of background moves 10 ($A) times slower than foreground
  16255. swap d1
  16256. add.l d1,d1
  16257. add.l d0,d1
  16258. ; Set rows 5-10's speed
  16259. rept 6
  16260. swap d1
  16261. move.w d1,(a3)+ ; Next row moves 3 times faster than top row, then next row is 4 times faster, then 5, etc.
  16262. swap d1
  16263. add.l d0,d1
  16264. endm
  16265. ; Set row 11's speed
  16266. swap d1
  16267. move.w d1,(a3)+
  16268.  
  16269. ; These instructions reveal that ARZ had slightly different scrolling,
  16270. ; at one point:
  16271. ; Above the background's mountains is a row of leaves, which is actually
  16272. ; composed of three separately-scrolling rows. According to this code,
  16273. ; the first and third rows were meant to scroll at a different speed to the
  16274. ; second. Possibly due to how bad it looks, the speed values are overwritten
  16275. ; a few instructions later, so all three move at the same speed.
  16276. ; This code seems to pre-date the Simon Wai build, which uses the final's
  16277. ; scrolling.
  16278. move.w d1,(a2) ; Set row 1's speed
  16279. move.w d1,4(a2) ; Set row 3's speed
  16280.  
  16281. move.w (Camera_BG_X_pos).w,d0
  16282. move.w d0,2(a2) ; Set row 2's speed
  16283. move.w d0,$16(a2) ; Set row 12's speed
  16284. _move.w d0,0(a2) ; Overwrite row 1's speed (now same as row 2's)
  16285. move.w d0,4(a2) ; Overwrite row 3's speed (now same as row 2's)
  16286. move.w d0,$18(a2) ; Set row 13's speed
  16287. move.w d0,$1A(a2) ; Set row 14's speed
  16288. move.w d0,$1C(a2) ; Set row 15's speed
  16289. move.w d0,$1E(a2) ; Set row 16's speed
  16290.  
  16291. lea (SwScrl_ARZ_RowHeights).l,a3
  16292. lea (TempArray_LayerDef).w,a2
  16293. lea (Horiz_Scroll_Buf).w,a1
  16294. move.w (Camera_BG_Y_pos).w,d1
  16295. moveq #0,d0
  16296.  
  16297. ; Find which row of background is visible at the top of the screen
  16298. .findTopRowLoop:
  16299. move.b (a3)+,d0 ; Get row height
  16300. addq.w #2,a2 ; Next row speed (note: is off by 2. This is fixed below)
  16301. sub.w d0,d1
  16302. bcc.s .findTopRowLoop ; If current row is above the screen, loop and do next row
  16303.  
  16304. neg.w d1 ; d1 now contains how many pixels of the row is currently on-screen
  16305. subq.w #2,a2 ; Get correct row speed
  16306.  
  16307. move.w #bytesToLcnt($380),d2 ; Actual size of Horiz_Scroll_Buf
  16308. move.w (Camera_X_pos).w,d0
  16309. neg.w d0
  16310. swap d0 ; Store FG X-pos in upper 16-bits...
  16311. move.w (a2)+,d0 ; ...and BG X-pos in lower 16 bits, as Horiz_Scroll_Buf expects it
  16312. neg.w d0
  16313.  
  16314. - move.l d0,(a1)+ ; Write 1 FG Horizontal Scroll value, and 1 BG Horizontal Scroll value
  16315. subq.w #1,d1 ; Loop until row at top of screen is done
  16316. bne.s +
  16317. move.b (a3)+,d1 ; Once that row is done, go to next row...
  16318. move.w (a2)+,d0 ; ...and use next speed
  16319. neg.w d0
  16320. + dbf d2,- ; Loop until Horiz_Scroll_Buf is full
  16321.  
  16322. rts
  16323. ; ===========================================================================
  16324. ; byte_D5CE:
  16325. SwScrl_ARZ_RowHeights:
  16326. dc.b $B0
  16327. dc.b $70 ; 1
  16328. dc.b $30 ; 2
  16329. dc.b $60 ; 3
  16330. dc.b $15 ; 4
  16331. dc.b $C ; 5
  16332. dc.b $E ; 6
  16333. dc.b 6 ; 7
  16334. dc.b $C ; 8
  16335. dc.b $1F ; 9
  16336. dc.b $30 ; 10
  16337. dc.b $C0 ; 11
  16338. dc.b $F0 ; 12
  16339. dc.b $F0 ; 13
  16340. dc.b $F0 ; 14
  16341. dc.b $F0 ; 15
  16342. even
  16343. ; ===========================================================================
  16344. ; loc_D5DE:
  16345. SwScrl_SCZ:
  16346. tst.w (Debug_placement_mode).w
  16347. bne.w SwScrl_Minimal
  16348. lea (Camera_X_pos).w,a1
  16349. lea (Scroll_flags).w,a3
  16350. lea (Camera_X_pos_diff).w,a4
  16351. move.w (Tornado_Velocity_X).w,d0
  16352. move.w (a1),d4
  16353. add.w (a1),d0
  16354. move.w d0,d1
  16355. sub.w (a1),d1
  16356. asl.w #8,d1
  16357. move.w d0,(a1)
  16358. move.w d1,(a4)
  16359. lea (Horiz_block_crossed_flag).w,a2
  16360. bsr.w SetHorizScrollFlags
  16361. lea (Camera_Y_pos).w,a1
  16362. lea (Camera_Y_pos_diff).w,a4
  16363. move.w (Tornado_Velocity_Y).w,d0
  16364. move.w (a1),d4
  16365. add.w (a1),d0
  16366. move.w d0,d1
  16367. sub.w (a1),d1
  16368. asl.w #8,d1
  16369. move.w d0,(a1)
  16370. move.w d1,(a4)
  16371. lea (Verti_block_crossed_flag).w,a2
  16372. bsr.w SetVertiScrollFlags
  16373. move.w (Camera_X_pos_diff).w,d4
  16374. beq.s +
  16375. move.w #$100,d4
  16376. +
  16377. ext.l d4
  16378. asl.l #7,d4
  16379. moveq #0,d5
  16380. bsr.w SetHorizVertiScrollFlagsBG
  16381. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  16382. lea (Horiz_Scroll_Buf).w,a1
  16383. move.w #bytesToLcnt($380),d1
  16384. move.w (Camera_X_pos).w,d0
  16385. neg.w d0
  16386. swap d0
  16387. move.w (Camera_BG_X_pos).w,d0
  16388. neg.w d0
  16389.  
  16390. - move.l d0,(a1)+
  16391. dbf d1,-
  16392.  
  16393. rts
  16394. ; ===========================================================================
  16395. ; loc_D666:
  16396. SwScrl_Minimal:
  16397. move.w (Camera_X_pos_diff).w,d4
  16398. ext.l d4
  16399. asl.l #5,d4
  16400. move.w (Camera_Y_pos_diff).w,d5
  16401. ext.l d5
  16402. asl.l #6,d5
  16403. bsr.w SetHorizVertiScrollFlagsBG
  16404. move.w (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
  16405. lea (Horiz_Scroll_Buf).w,a1
  16406. move.w #bytesToLcnt($380),d1
  16407. move.w (Camera_X_pos).w,d0
  16408. neg.w d0
  16409. swap d0
  16410. move.w (Camera_BG_X_pos).w,d0
  16411. neg.w d0
  16412.  
  16413. - move.l d0,(a1)+
  16414. dbf d1,-
  16415.  
  16416. rts
  16417. ; ===========================================================================
  16418. ; unused...
  16419. ; loc_D69E:
  16420. SwScrl_HPZ_Continued:
  16421. lea (Horiz_Scroll_Buf).w,a1
  16422. move.w #$E,d1
  16423. move.w (Camera_X_pos).w,d0
  16424. neg.w d0
  16425. swap d0
  16426. andi.w #$F,d2
  16427. add.w d2,d2
  16428. move.w (a2)+,d0
  16429. jmp +(pc,d2.w)
  16430. ; ===========================================================================
  16431.  
  16432. - move.w (a2)+,d0
  16433.  
  16434. + rept 16
  16435. move.l d0,(a1)+
  16436. endm
  16437. dbf d1,-
  16438.  
  16439. rts
  16440.  
  16441. ; ---------------------------------------------------------------------------
  16442. ; Subroutine to set horizontal scroll flags
  16443. ; ---------------------------------------------------------------------------
  16444.  
  16445. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16446.  
  16447. ;sub_D6E2:
  16448. SetHorizScrollFlags:
  16449. move.w (a1),d0 ; get camera X pos
  16450. andi.w #$10,d0
  16451. move.b (a2),d1
  16452. eor.b d1,d0 ; has the camera crossed a 16-pixel boundary?
  16453. bne.s ++ ; if not, branch
  16454. eori.b #$10,(a2)
  16455. move.w (a1),d0 ; get camera X pos
  16456. sub.w d4,d0 ; subtract previous camera X pos
  16457. bpl.s + ; branch if the camera has moved forward
  16458. bset #2,(a3) ; set moving back in level bit
  16459. rts
  16460. ; ===========================================================================
  16461. +
  16462. bset #3,(a3) ; set moving forward in level bit
  16463. +
  16464. rts
  16465. ; End of function SetHorizScrollFlags
  16466.  
  16467. ; ---------------------------------------------------------------------------
  16468. ; Subroutine to scroll the camera horizontally
  16469. ; ---------------------------------------------------------------------------
  16470.  
  16471. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16472.  
  16473. ;sub_D704:
  16474. ScrollHoriz:
  16475. move.w (a1),d4 ; get camera X pos
  16476. tst.b (Teleport_flag).w
  16477. bne.s .return ; if a teleport is in progress, return
  16478. move.w (a5),d1 ; should scrolling be delayed?
  16479. beq.s .scrollNotDelayed ; if not, branch
  16480. subi.w #$100,d1 ; reduce delay value
  16481. move.w d1,(a5)
  16482. moveq #0,d1
  16483. move.b (a5),d1 ; get delay value
  16484. lsl.b #2,d1 ; multiply by 4, the size of a position buffer entry
  16485. addq.b #4,d1
  16486. move.w 2(a5),d0 ; get current position buffer index
  16487. sub.b d1,d0
  16488. move.w (a6,d0.w),d0 ; get Sonic's position a certain number of frames ago
  16489. andi.w #$3FFF,d0
  16490. bra.s .checkIfShouldScroll ; use that value for scrolling
  16491. ; ===========================================================================
  16492. ; loc_D72E:
  16493. .scrollNotDelayed:
  16494. move.w x_pos(a0),d0
  16495. ; loc_D732:
  16496. .checkIfShouldScroll:
  16497. sub.w (a1),d0
  16498. subi.w #(320/2)-16,d0 ; is the player less than 144 pixels from the screen edge?
  16499. blt.s .scrollLeft ; if he is, scroll left
  16500. subi.w #16,d0 ; is the player more than 159 pixels from the screen edge?
  16501. bge.s .scrollRight ; if he is, scroll right
  16502. clr.w (a4) ; otherwise, don't scroll
  16503. ; return_D742:
  16504. .return:
  16505. rts
  16506. ; ===========================================================================
  16507. ; loc_D744:
  16508. .scrollLeft:
  16509. cmpi.w #-16,d0
  16510. bgt.s .maxNotReached
  16511. move.w #-16,d0 ; limit scrolling to 16 pixels per frame
  16512. ; loc_D74E:
  16513. .maxNotReached:
  16514. add.w (a1),d0 ; get new camera position
  16515. cmp.w (a2),d0 ; is it greater than the minimum position?
  16516. bgt.s .doScroll ; if it is, branch
  16517. move.w (a2),d0 ; prevent camera from going any further back
  16518. bra.s .doScroll
  16519. ; ===========================================================================
  16520. ; loc_D758:
  16521. .scrollRight:
  16522. cmpi.w #16,d0
  16523. blo.s .maxNotReached2
  16524. move.w #16,d0
  16525. ; loc_D762:
  16526. .maxNotReached2:
  16527. add.w (a1),d0 ; get new camera position
  16528. cmp.w Camera_Max_X_pos-Camera_Min_X_pos(a2),d0 ; is it less than the max position?
  16529. blt.s .doScroll ; if it is, branch
  16530. move.w Camera_Max_X_pos-Camera_Min_X_pos(a2),d0 ; prevent camera from going any further forward
  16531. ; loc_D76E:
  16532. .doScroll:
  16533. move.w d0,d1
  16534. sub.w (a1),d1 ; subtract old camera position
  16535. asl.w #8,d1 ; shift up by a byte
  16536. move.w d0,(a1) ; set new camera position
  16537. move.w d1,(a4) ; set difference between old and new positions
  16538. rts
  16539. ; End of function ScrollHoriz
  16540.  
  16541. ; ---------------------------------------------------------------------------
  16542. ; Subroutine to scroll the camera vertically
  16543. ; ---------------------------------------------------------------------------
  16544.  
  16545. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16546.  
  16547. ; The upper 16 bits of Camera_Y_pos is the actual Y-pos, the lower ones seem
  16548. ; unused, yet this code goes to a strange extent to manage them.
  16549. ;sub_D77A:
  16550. ScrollVerti:
  16551. moveq #0,d1
  16552. move.w y_pos(a0),d0
  16553. sub.w (a1),d0 ; subtract camera Y pos
  16554. cmpi.w #-$100,(Camera_Min_Y_pos).w ; does the level wrap vertically?
  16555. bne.s .noWrap ; if not, branch
  16556. andi.w #$7FF,d0
  16557. ; loc_D78E:
  16558. .noWrap:
  16559. btst #2,status(a0) ; is the player rolling?
  16560. beq.s .notRolling ; if not, branch
  16561. subq.w #5,d0 ; subtract difference between standing and rolling heights
  16562. ; loc_D798:
  16563. .notRolling:
  16564. btst #1,status(a0) ; is the player in the air?
  16565. beq.s .checkBoundaryCrossed_onGround ; if not, branch
  16566. ;.checkBoundaryCrossed_inAir:
  16567. ; If Sonic's in the air, he has $20 pixels above and below him to move without disturbing the camera.
  16568. ; The camera movement is also only capped at $10 pixels.
  16569. addi.w #$20,d0
  16570. sub.w d3,d0
  16571. bcs.s .doScroll_fast ; If Sonic is above the boundary, scroll to catch up to him
  16572. subi.w #$40,d0
  16573. bcc.s .doScroll_fast ; If Sonic is below the boundary, scroll to catch up to him
  16574. tst.b (Camera_Max_Y_Pos_Changing).w ; is the max Y pos changing?
  16575. bne.s .scrollUpOrDown_maxYPosChanging ; if it is, branch
  16576. bra.s .doNotScroll
  16577. ; ===========================================================================
  16578. ; loc_D7B6:
  16579. .checkBoundaryCrossed_onGround:
  16580. ; On the ground, the camera follows Sonic very strictly.
  16581. sub.w d3,d0 ; subtract camera bias
  16582. bne.s .decideScrollType ; If Sonic has moved, scroll to catch up to him
  16583. tst.b (Camera_Max_Y_Pos_Changing).w ; is the max Y pos changing?
  16584. bne.s .scrollUpOrDown_maxYPosChanging ; if it is, branch
  16585. ; loc_D7C0:
  16586. .doNotScroll:
  16587. clr.w (a4) ; clear Y position difference (Camera_Y_pos_bias)
  16588. rts
  16589. ; ===========================================================================
  16590. ; loc_D7C4:
  16591. .decideScrollType:
  16592. cmpi.w #(224/2)-16,d3 ; is the camera bias normal?
  16593. bne.s .doScroll_slow ; if not, branch
  16594. mvabs.w inertia(a0),d1 ; get player ground velocity, force it to be positive
  16595. cmpi.w #$800,d1 ; is the player travelling very fast?
  16596. bhs.s .doScroll_fast ; if he is, branch
  16597. ;.doScroll_medium:
  16598. move.w #6<<8,d1 ; If player is going too fast, cap camera movement to 6 pixels per frame
  16599. cmpi.w #6,d0 ; is player going down too fast?
  16600. bgt.s .scrollDown_max ; if so, move camera at capped speed
  16601. cmpi.w #-6,d0 ; is player going up too fast?
  16602. blt.s .scrollUp_max ; if so, move camera at capped speed
  16603. bra.s .scrollUpOrDown ; otherwise, move camera at player's speed
  16604. ; ===========================================================================
  16605. ; loc_D7EA:
  16606. .doScroll_slow:
  16607. move.w #2<<8,d1 ; If player is going too fast, cap camera movement to 2 pixels per frame
  16608. cmpi.w #2,d0 ; is player going down too fast?
  16609. bgt.s .scrollDown_max ; if so, move camera at capped speed
  16610. cmpi.w #-2,d0 ; is player going up too fast?
  16611. blt.s .scrollUp_max ; if so, move camera at capped speed
  16612. bra.s .scrollUpOrDown ; otherwise, move camera at player's speed
  16613. ; ===========================================================================
  16614. ; loc_D7FC:
  16615. .doScroll_fast:
  16616. ; related code appears in ScrollBG
  16617. ; S3K uses 24 instead of 16
  16618. move.w #16<<8,d1 ; If player is going too fast, cap camera movement to $10 pixels per frame
  16619. cmpi.w #16,d0 ; is player going down too fast?
  16620. bgt.s .scrollDown_max ; if so, move camera at capped speed
  16621. cmpi.w #-16,d0 ; is player going up too fast?
  16622. blt.s .scrollUp_max ; if so, move camera at capped speed
  16623. bra.s .scrollUpOrDown ; otherwise, move camera at player's speed
  16624. ; ===========================================================================
  16625. ; loc_D80E:
  16626. .scrollUpOrDown_maxYPosChanging:
  16627. moveq #0,d0 ; Distance for camera to move = 0
  16628. move.b d0,(Camera_Max_Y_Pos_Changing).w ; clear camera max Y pos changing flag
  16629. ; loc_D814:
  16630. .scrollUpOrDown:
  16631. moveq #0,d1
  16632. move.w d0,d1 ; get position difference
  16633. add.w (a1),d1 ; add old camera Y position
  16634. tst.w d0 ; is the camera to scroll down?
  16635. bpl.w .scrollDown ; if it is, branch
  16636. bra.w .scrollUp
  16637. ; ===========================================================================
  16638. ; loc_D824:
  16639. .scrollUp_max:
  16640. neg.w d1 ; make the value negative (since we're going backwards)
  16641. ext.l d1
  16642. asl.l #8,d1 ; move this into the upper word, so it lines up with the actual y_pos value in Camera_Y_pos
  16643. add.l (a1),d1 ; add the two, getting the new Camera_Y_pos value
  16644. swap d1 ; actual Y-coordinate is now the low word
  16645. ; loc_D82E:
  16646. .scrollUp:
  16647. cmp.w Camera_Min_Y_pos-Camera_Min_X_pos(a2),d1 ; is the new position less than the minimum Y pos?
  16648. bgt.s .doScroll ; if not, branch
  16649. cmpi.w #-$100,d1
  16650. bgt.s .minYPosReached
  16651. andi.w #$7FF,d1
  16652. andi.w #$7FF,(a1)
  16653. bra.s .doScroll
  16654. ; ===========================================================================
  16655. ; loc_D844:
  16656. .minYPosReached:
  16657. move.w Camera_Min_Y_pos-Camera_Min_X_pos(a2),d1 ; prevent camera from going any further up
  16658. bra.s .doScroll
  16659. ; ===========================================================================
  16660. ; loc_D84A:
  16661. .scrollDown_max:
  16662. ext.l d1
  16663. asl.l #8,d1 ; move this into the upper word, so it lines up with the actual y_pos value in Camera_Y_pos
  16664. add.l (a1),d1 ; add the two, getting the new Camera_Y_pos value
  16665. swap d1 ; actual Y-coordinate is now the low word
  16666. ; loc_D852:
  16667. .scrollDown:
  16668. cmp.w Camera_Max_Y_pos_now-Camera_Min_X_pos(a2),d1 ; is the new position greater than the maximum Y pos?
  16669. blt.s .doScroll ; if not, branch
  16670. subi.w #$800,d1
  16671. bcs.s .maxYPosReached
  16672. subi.w #$800,(a1)
  16673. bra.s .doScroll
  16674. ; ===========================================================================
  16675. ; loc_D864:
  16676. .maxYPosReached:
  16677. move.w Camera_Max_Y_pos_now-Camera_Min_X_pos(a2),d1 ; prevent camera from going any further down
  16678. ; loc_D868:
  16679. .doScroll:
  16680. move.w (a1),d4 ; get old pos (used by SetVertiScrollFlags)
  16681. swap d1 ; actual Y-coordinate is now the high word, as Camera_Y_pos expects it
  16682. move.l d1,d3
  16683. sub.l (a1),d3
  16684. ror.l #8,d3
  16685. move.w d3,(a4) ; set difference between old and new positions
  16686. move.l d1,(a1) ; set new camera Y pos
  16687. rts
  16688. ; End of function ScrollVerti
  16689.  
  16690. ; ---------------------------------------------------------------------------
  16691. ; Subroutine to set vertical scroll flags
  16692. ; ---------------------------------------------------------------------------
  16693.  
  16694. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16695.  
  16696.  
  16697. SetVertiScrollFlags:
  16698. move.w (a1),d0 ; get camera Y pos
  16699. andi.w #$10,d0
  16700. move.b (a2),d1
  16701. eor.b d1,d0 ; has the camera crossed a 16-pixel boundary?
  16702. bne.s ++ ; if not, branch
  16703. eori.b #$10,(a2)
  16704. move.w (a1),d0 ; get camera Y pos
  16705. sub.w d4,d0 ; subtract old camera Y pos
  16706. bpl.s + ; branch if the camera has scrolled down
  16707. bset #0,(a3) ; set moving up in level bit
  16708. rts
  16709. ; ===========================================================================
  16710. +
  16711. bset #1,(a3) ; set moving down in level bit
  16712. +
  16713. rts
  16714. ; End of function SetVertiScrollFlags
  16715.  
  16716.  
  16717. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16718.  
  16719. ; d4 is horizontal, d5 vertical, derived from $FFFFEEB0 & $FFFFEEB2 respectively
  16720.  
  16721. ;sub_D89A: ;Hztl_Vrtc_Bg_Deformation:
  16722. SetHorizVertiScrollFlagsBG: ; used by lev2, MTZ, HTZ, CPZ, DEZ, SCZ, Minimal
  16723. move.l (Camera_BG_X_pos).w,d2
  16724. move.l d2,d0
  16725. add.l d4,d0 ; add x-shift for this frame
  16726. move.l d0,(Camera_BG_X_pos).w
  16727. move.l d0,d1
  16728. swap d1
  16729. andi.w #$10,d1
  16730. move.b (Horiz_block_crossed_flag_BG).w,d3
  16731. eor.b d3,d1
  16732. bne.s ++
  16733. eori.b #$10,(Horiz_block_crossed_flag_BG).w
  16734. sub.l d2,d0
  16735. bpl.s +
  16736. bset #2,(Scroll_flags_BG).w
  16737. bra.s ++
  16738. ; ===========================================================================
  16739. +
  16740. bset #3,(Scroll_flags_BG).w
  16741. +
  16742. move.l (Camera_BG_Y_pos).w,d3
  16743. move.l d3,d0
  16744. add.l d5,d0 ; add y-shift for this frame
  16745. move.l d0,(Camera_BG_Y_pos).w
  16746. move.l d0,d1
  16747. swap d1
  16748. andi.w #$10,d1
  16749. move.b (Verti_block_crossed_flag_BG).w,d2
  16750. eor.b d2,d1
  16751. bne.s ++ ; rts
  16752. eori.b #$10,(Verti_block_crossed_flag_BG).w
  16753. sub.l d3,d0
  16754. bpl.s +
  16755. bset #0,(Scroll_flags_BG).w
  16756. rts
  16757. ; ===========================================================================
  16758. +
  16759. bset #1,(Scroll_flags_BG).w
  16760. +
  16761. rts
  16762. ; End of function SetHorizVertiScrollFlagsBG
  16763.  
  16764.  
  16765. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16766.  
  16767. ;sub_D904: ;Horizontal_Bg_Deformation:
  16768. SetHorizScrollFlagsBG: ; used by WFZ, HTZ, HPZ
  16769. move.l (Camera_BG_X_pos).w,d2
  16770. move.l d2,d0
  16771. add.l d4,d0 ; add x-shift for this frame
  16772. move.l d0,(Camera_BG_X_pos).w
  16773. move.l d0,d1
  16774. swap d1
  16775. andi.w #$10,d1
  16776. move.b (Horiz_block_crossed_flag_BG).w,d3
  16777. eor.b d3,d1
  16778. bne.s ++ ; rts
  16779. eori.b #$10,(Horiz_block_crossed_flag_BG).w
  16780. sub.l d2,d0
  16781. bpl.s +
  16782. bset d6,(Scroll_flags_BG).w
  16783. bra.s ++ ; rts
  16784. ; ===========================================================================
  16785. +
  16786. addq.b #1,d6
  16787. bset d6,(Scroll_flags_BG).w
  16788. +
  16789. rts
  16790. ; End of function SetHorizScrollFlagsBG
  16791.  
  16792.  
  16793. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16794.  
  16795. ;sub_D938: ;Vertical_Bg_Deformation1:
  16796. SetVertiScrollFlagsBG: ; used by WFZ, HTZ, HPZ, ARZ
  16797. move.l (Camera_BG_Y_pos).w,d3
  16798. move.l d3,d0
  16799. add.l d5,d0 ; add y-shift for this frame
  16800.  
  16801. ;loc_D940: ;Vertical_Bg_Deformation2:
  16802. SetVertiScrollFlagsBG2:
  16803. move.l d0,(Camera_BG_Y_pos).w
  16804. move.l d0,d1
  16805. swap d1
  16806. andi.w #$10,d1
  16807. move.b (Verti_block_crossed_flag_BG).w,d2
  16808. eor.b d2,d1
  16809. bne.s ++ ; rts
  16810. eori.b #$10,(Verti_block_crossed_flag_BG).w
  16811. sub.l d3,d0
  16812. bpl.s +
  16813. bset d6,(Scroll_flags_BG).w ; everytime Verti_block_crossed_flag_BG changes from $10 to $00
  16814. rts
  16815. ; ===========================================================================
  16816. +
  16817. addq.b #1,d6
  16818. bset d6,(Scroll_flags_BG).w ; everytime Verti_block_crossed_flag_BG changes from $00 to $10
  16819. +
  16820. rts
  16821. ; End of function SetVertiScrollFlagsBG
  16822.  
  16823.  
  16824. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16825.  
  16826. ;sub_D96C: ;ARZ_Bg_Deformation:
  16827. SetHorizScrollFlagsBG_ARZ: ; only used by ARZ
  16828. move.l (Camera_ARZ_BG_X_pos).w,d0
  16829. add.l d4,d0
  16830. move.l d0,(Camera_ARZ_BG_X_pos).w
  16831. lea (Camera_BG_X_pos).w,a1
  16832. move.w (a1),d2
  16833. move.w (Camera_ARZ_BG_X_pos).w,d0
  16834. sub.w d2,d0
  16835. bcs.s +
  16836. bhi.s ++
  16837. rts
  16838. ; ===========================================================================
  16839. +
  16840. cmpi.w #-$10,d0
  16841. bgt.s ++
  16842. move.w #-$10,d0
  16843. bra.s ++
  16844. ; ===========================================================================
  16845. +
  16846. cmpi.w #$10,d0
  16847. blo.s +
  16848. move.w #$10,d0
  16849. +
  16850. add.w (a1),d0
  16851. move.w d0,(a1)
  16852. move.w d0,d1
  16853. andi.w #$10,d1
  16854. move.b (Horiz_block_crossed_flag_BG).w,d3
  16855. eor.b d3,d1
  16856. bne.s ++ ; rts
  16857. eori.b #$10,(Horiz_block_crossed_flag_BG).w
  16858. sub.w d2,d0
  16859. bpl.s +
  16860. bset d6,(Scroll_flags_BG).w
  16861. bra.s ++ ; rts
  16862. ; ===========================================================================
  16863. +
  16864. addq.b #1,d6
  16865. bset d6,(Scroll_flags_BG).w
  16866. +
  16867. rts
  16868. ; End of function SetHorizScrollFlagsBG_ARZ
  16869.  
  16870.  
  16871. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16872.  
  16873. ;sub_D9C8: ;CPZ_Bg_Deformation:
  16874. SetHorizScrollFlagsBG2: ; only used by CPZ
  16875. move.l (Camera_BG2_X_pos).w,d2
  16876. move.l d2,d0
  16877. add.l d4,d0
  16878. move.l d0,(Camera_BG2_X_pos).w
  16879. move.l d0,d1
  16880. swap d1
  16881. andi.w #$10,d1
  16882. move.b (Horiz_block_crossed_flag_BG2).w,d3
  16883. eor.b d3,d1
  16884. bne.s ++ ; rts
  16885. eori.b #$10,(Horiz_block_crossed_flag_BG2).w
  16886. sub.l d2,d0
  16887. bpl.s +
  16888. bset d6,(Scroll_flags_BG2).w
  16889. bra.s ++ ; rts
  16890. ; ===========================================================================
  16891. +
  16892. addq.b #1,d6
  16893. bset d6,(Scroll_flags_BG2).w
  16894. +
  16895. rts
  16896. ; End of function SetHorizScrollFlagsBG2
  16897.  
  16898. ; ===========================================================================
  16899. ; some apparently unused code
  16900. ;SetHorizScrollFlagsBG3:
  16901. move.l (Camera_BG3_X_pos).w,d2
  16902. move.l d2,d0
  16903. add.l d4,d0
  16904. move.l d0,(Camera_BG3_X_pos).w
  16905. move.l d0,d1
  16906. swap d1
  16907. andi.w #$10,d1
  16908. move.b (Horiz_block_crossed_flag_BG3).w,d3
  16909. eor.b d3,d1
  16910. bne.s ++ ; rts
  16911. eori.b #$10,(Horiz_block_crossed_flag_BG3).w
  16912. sub.l d2,d0
  16913. bpl.s +
  16914. bset d6,(Scroll_flags_BG3).w
  16915. bra.s ++ ; rts
  16916. ; ===========================================================================
  16917. +
  16918. addq.b #1,d6
  16919. bset d6,(Scroll_flags_BG3).w
  16920. +
  16921. rts
  16922. ; ===========================================================================
  16923. ; Unused - dead code leftover from S1:
  16924. lea (VDP_control_port).l,a5
  16925. lea (VDP_data_port).l,a6
  16926. lea (Scroll_flags_BG).w,a2
  16927. lea (Camera_BG_X_pos).w,a3
  16928. lea (Level_Layout+$80).w,a4
  16929. move.w #vdpComm(VRAM_Plane_B_Name_Table,VRAM,WRITE)>>16,d2
  16930. bsr.w Draw_BG1
  16931. lea (Scroll_flags_BG2).w,a2
  16932. lea (Camera_BG2_X_pos).w,a3
  16933. bra.w Draw_BG2
  16934.  
  16935. ; ===========================================================================
  16936.  
  16937.  
  16938.  
  16939.  
  16940. ; ---------------------------------------------------------------------------
  16941. ; Subroutine to display correct tiles as you move
  16942. ; ---------------------------------------------------------------------------
  16943.  
  16944. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  16945. ; loc_DA5C:
  16946. LoadTilesAsYouMove:
  16947. lea (VDP_control_port).l,a5
  16948. lea (VDP_data_port).l,a6
  16949. lea (Scroll_flags_BG_copy).w,a2
  16950. lea (Camera_BG_copy).w,a3
  16951. lea (Level_Layout+$80).w,a4 ; first background line
  16952. move.w #vdpComm(VRAM_Plane_B_Name_Table,VRAM,WRITE)>>16,d2
  16953. bsr.w Draw_BG1
  16954. lea (Scroll_flags_BG2_copy).w,a2 ; referred to in CPZ deformation routine, but cleared right after
  16955. lea (Camera_BG2_copy).w,a3
  16956. bsr.w Draw_BG2 ; Essentially unused, though
  16957. lea (Scroll_flags_BG3_copy).w,a2
  16958. lea (Camera_BG3_copy).w,a3
  16959. bsr.w Draw_BG3 ; used in CPZ deformation routine
  16960. tst.w (Two_player_mode).w
  16961. beq.s +
  16962. lea (Scroll_flags_copy_P2).w,a2
  16963. lea (Camera_P2_copy).w,a3 ; second player camera
  16964. lea (Level_Layout).w,a4
  16965. move.w #vdpComm(VRAM_Plane_A_Name_Table_2P,VRAM,WRITE)>>16,d2
  16966. bsr.w Draw_FG_P2
  16967.  
  16968. +
  16969. lea (Scroll_flags_copy).w,a2
  16970. lea (Camera_RAM_copy).w,a3
  16971. lea (Level_Layout).w,a4
  16972. move.w #vdpComm(VRAM_Plane_A_Name_Table,VRAM,WRITE)>>16,d2
  16973. tst.b (Screen_redraw_flag).w
  16974.  
  16975. ; comment out this line to disable blast processing
  16976. beq.s Draw_FG
  16977.  
  16978. move.b #0,(Screen_redraw_flag).w
  16979. moveq #-$10,d4
  16980. moveq #$F,d6
  16981. ; loc_DACE:
  16982. Draw_All:
  16983. movem.l d4-d6,-(sp) ; This whole routine basically redraws the whole
  16984. moveq #-$10,d5 ; area instead of merely a line of tiles
  16985. move.w d4,d1
  16986. bsr.w CalcBlockVRAMPos
  16987. move.w d1,d4
  16988. moveq #-$10,d5
  16989. bsr.w DrawBlockRow1 ; draw the current row
  16990. movem.l (sp)+,d4-d6
  16991. addi.w #$10,d4 ; move onto the next row
  16992. dbf d6,Draw_All ; repeat for all rows
  16993. move.b #0,(Scroll_flags_copy).w
  16994. rts
  16995. ; ===========================================================================
  16996. ; loc_DAF6:
  16997. Draw_FG:
  16998. tst.b (a2) ; is any scroll flag set?
  16999. beq.s return_DB5A ; if not, branch
  17000. bclr #0,(a2) ; has the level scrolled up?
  17001. beq.s + ; if not, branch
  17002. moveq #-$10,d4
  17003. moveq #-$10,d5
  17004. bsr.w CalcBlockVRAMPos
  17005. moveq #-$10,d4
  17006. moveq #-$10,d5
  17007. bsr.w DrawBlockRow1 ; redraw upper row
  17008. +
  17009. bclr #1,(a2) ; has the level scrolled down?
  17010. beq.s + ; if not, branch
  17011. move.w #224,d4
  17012. moveq #-$10,d5
  17013. bsr.w CalcBlockVRAMPos
  17014. move.w #224,d4
  17015. moveq #-$10,d5
  17016. bsr.w DrawBlockRow1 ; redraw bottom row
  17017. +
  17018. bclr #2,(a2) ; has the level scrolled to the left?
  17019. beq.s + ; if not, branch
  17020. moveq #-$10,d4
  17021. moveq #-$10,d5
  17022. bsr.w CalcBlockVRAMPos
  17023. moveq #-$10,d4
  17024. moveq #-$10,d5
  17025. bsr.w DrawBlockCol1 ; redraw left-most column
  17026. +
  17027. bclr #3,(a2) ; has the level scrolled to the right?
  17028. beq.s return_DB5A ; if not, return
  17029. moveq #-$10,d4
  17030. move.w #320,d5
  17031. bsr.w CalcBlockVRAMPos
  17032. moveq #-$10,d4
  17033. move.w #320,d5
  17034. bsr.w DrawBlockCol1 ; redraw right-most column
  17035.  
  17036. return_DB5A:
  17037. rts
  17038.  
  17039. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17040.  
  17041. ;sub_DB5C:
  17042. Draw_FG_P2:
  17043. tst.b (a2)
  17044. beq.s return_DBC0
  17045. bclr #0,(a2)
  17046. beq.s +
  17047. moveq #-$10,d4
  17048. moveq #-$10,d5
  17049. bsr.w CalcBlockVRAMPosB
  17050. moveq #-$10,d4
  17051. moveq #-$10,d5
  17052. bsr.w DrawBlockRow1
  17053. +
  17054. bclr #1,(a2)
  17055. beq.s +
  17056. move.w #$E0,d4
  17057. moveq #-$10,d5
  17058. bsr.w CalcBlockVRAMPosB
  17059. move.w #$E0,d4
  17060. moveq #-$10,d5
  17061. bsr.w DrawBlockRow1
  17062. +
  17063. bclr #2,(a2)
  17064. beq.s +
  17065. moveq #-$10,d4
  17066. moveq #-$10,d5
  17067. bsr.w CalcBlockVRAMPosB
  17068. moveq #-$10,d4
  17069. moveq #-$10,d5
  17070. bsr.w DrawBlockCol1
  17071. +
  17072. bclr #3,(a2)
  17073. beq.s return_DBC0
  17074. moveq #-$10,d4
  17075. move.w #320,d5
  17076. bsr.w CalcBlockVRAMPosB
  17077. moveq #-$10,d4
  17078. move.w #320,d5
  17079. bsr.w DrawBlockCol1
  17080.  
  17081. return_DBC0:
  17082. rts
  17083. ; End of function Draw_FG_P2
  17084.  
  17085.  
  17086. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17087.  
  17088. ;sub_DBC2:
  17089. Draw_BG1:
  17090. tst.b (a2)
  17091. beq.w return_DC90
  17092. bclr #0,(a2)
  17093. beq.s +
  17094. moveq #-$10,d4
  17095. moveq #-$10,d5
  17096. bsr.w CalcBlockVRAMPos
  17097. moveq #-$10,d4
  17098. moveq #-$10,d5
  17099. bsr.w DrawBlockRow1
  17100. +
  17101. bclr #1,(a2)
  17102. beq.s +
  17103. move.w #$E0,d4
  17104. moveq #-$10,d5
  17105. bsr.w CalcBlockVRAMPos
  17106. move.w #$E0,d4
  17107. moveq #-$10,d5
  17108. bsr.w DrawBlockRow1
  17109. +
  17110. bclr #2,(a2)
  17111. beq.s +
  17112. moveq #-$10,d4
  17113. moveq #-$10,d5
  17114. bsr.w CalcBlockVRAMPos
  17115. moveq #-$10,d4
  17116. moveq #-$10,d5
  17117. bsr.w DrawBlockCol1
  17118. +
  17119. bclr #3,(a2)
  17120. beq.s +
  17121. moveq #-$10,d4
  17122. move.w #320,d5
  17123. bsr.w CalcBlockVRAMPos
  17124. moveq #-$10,d4
  17125. move.w #320,d5
  17126. bsr.w DrawBlockCol1
  17127. +
  17128. bclr #4,(a2)
  17129. beq.s +
  17130. moveq #-$10,d4
  17131. moveq #0,d5
  17132. bsr.w CalcBlockVRAMPos2
  17133. moveq #-$10,d4
  17134. moveq #0,d5
  17135. moveq #$1F,d6
  17136. bsr.w DrawBlockRow2
  17137. +
  17138. bclr #5,(a2)
  17139. beq.s +
  17140. move.w #$E0,d4
  17141. moveq #0,d5
  17142. bsr.w CalcBlockVRAMPos2
  17143. move.w #$E0,d4
  17144. moveq #0,d5
  17145. moveq #$1F,d6
  17146. bsr.w DrawBlockRow2
  17147. +
  17148. bclr #6,(a2)
  17149. beq.s +
  17150. moveq #-$10,d4
  17151. moveq #-$10,d5
  17152. bsr.w CalcBlockVRAMPos
  17153. moveq #-$10,d4
  17154. moveq #-$10,d5
  17155. moveq #$1F,d6
  17156. bsr.w DrawBlockRow
  17157. +
  17158. bclr #7,(a2)
  17159. beq.s return_DC90
  17160. move.w #$E0,d4
  17161. moveq #-$10,d5
  17162. bsr.w CalcBlockVRAMPos
  17163. move.w #$E0,d4
  17164. moveq #-$10,d5
  17165. moveq #$1F,d6
  17166. bsr.w DrawBlockRow
  17167.  
  17168. return_DC90:
  17169. rts
  17170. ; End of function Draw_BG1
  17171.  
  17172.  
  17173. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17174.  
  17175. ;sub_DC92:
  17176. Draw_BG2:
  17177. tst.b (a2)
  17178. beq.w ++ ; rts
  17179. bclr #0,(a2)
  17180. beq.s +
  17181. move.w #$70,d4
  17182. moveq #-$10,d5
  17183. bsr.w CalcBlockVRAMPos
  17184. move.w #$70,d4
  17185. moveq #-$10,d5
  17186. moveq #2,d6
  17187. bsr.w DrawBlockCol2
  17188. +
  17189. bclr #1,(a2)
  17190. beq.s + ; rts
  17191. move.w #$70,d4
  17192. move.w #320,d5
  17193. bsr.w CalcBlockVRAMPos
  17194. move.w #$70,d4
  17195. move.w #320,d5
  17196. moveq #2,d6
  17197. bsr.w DrawBlockCol2
  17198. +
  17199. rts
  17200. ; End of function Draw_BG2
  17201.  
  17202. ; ===========================================================================
  17203. ; Scrap Brain Zone 1 block positioning array -- S1 left-over
  17204. ; Each entry is an index into BGCameraLookup; used to decide the camera to use
  17205. ; for given block for reloading BG. A entry of 0 means assume X = 0 for section,
  17206. ; but otherwise loads camera Y for selected camera.
  17207. ;byte_DCD6
  17208. SBZ_CameraSections:
  17209. dc.b 0
  17210. dc.b 0 ; 1
  17211. dc.b 0 ; 2
  17212. dc.b 0 ; 3
  17213. dc.b 0 ; 4
  17214. dc.b 6 ; 5
  17215. dc.b 6 ; 6
  17216. dc.b 6 ; 7
  17217. dc.b 6 ; 8
  17218. dc.b 6 ; 9
  17219. dc.b 6 ; 10
  17220. dc.b 6 ; 11
  17221. dc.b 6 ; 12
  17222. dc.b 6 ; 13
  17223. dc.b 6 ; 14
  17224. dc.b 4 ; 15
  17225. dc.b 4 ; 16
  17226. dc.b 4 ; 17
  17227. dc.b 4 ; 18
  17228. dc.b 4 ; 19
  17229. dc.b 4 ; 20
  17230. dc.b 4 ; 21
  17231. dc.b 2 ; 22
  17232. dc.b 2 ; 23
  17233. dc.b 2 ; 24
  17234. dc.b 2 ; 25
  17235. dc.b 2 ; 26
  17236. dc.b 2 ; 27
  17237. dc.b 2 ; 28
  17238. dc.b 2 ; 29
  17239. dc.b 2 ; 30
  17240. dc.b 2 ; 31
  17241. dc.b 2 ; 32
  17242. even
  17243. ; ===========================================================================
  17244. ; Scrap Brain Zone 1 drawing code -- S1 left-over
  17245. ; Compare with CPZ drawing code
  17246. ; begin unused routine
  17247. moveq #-$10,d4
  17248. bclr #0,(a2)
  17249. bne.s +
  17250. bclr #1,(a2)
  17251. beq.s +++
  17252. move.w #$E0,d4
  17253. +
  17254. lea_ SBZ_CameraSections+1,a0
  17255. move.w (Camera_BG_Y_pos).w,d0
  17256. add.w d4,d0
  17257. andi.w #$1F0,d0
  17258. lsr.w #4,d0
  17259. move.b (a0,d0.w),d0
  17260. lea (BGCameraLookup).l,a3
  17261. movea.w (a3,d0.w),a3 ; Camera, either BG, BG2 or BG3 depending on Y
  17262. beq.s +
  17263. moveq #-$10,d5
  17264. movem.l d4-d5,-(sp)
  17265. bsr.w CalcBlockVRAMPos
  17266. movem.l (sp)+,d4-d5
  17267. bsr.w DrawBlockRow1
  17268. bra.s ++
  17269. ; ===========================================================================
  17270. +
  17271. moveq #0,d5
  17272. movem.l d4-d5,-(sp)
  17273. bsr.w CalcBlockVRAMPos2
  17274. movem.l (sp)+,d4-d5
  17275. moveq #$1F,d6
  17276. bsr.w DrawBlockRow2
  17277. +
  17278. tst.b (a2)
  17279. bne.s +
  17280. rts
  17281. ; ===========================================================================
  17282. +
  17283. moveq #-$10,d4
  17284. moveq #-$10,d5
  17285. move.b (a2),d0
  17286. andi.b #-$58,d0
  17287. beq.s +
  17288. lsr.b #1,d0
  17289. move.b d0,(a2)
  17290. move.w #320,d5
  17291. +
  17292. lea_ SBZ_CameraSections,a0
  17293. move.w (Camera_BG_Y_pos).w,d0
  17294. andi.w #$1F0,d0
  17295. lsr.w #4,d0
  17296. lea (a0,d0.w),a0
  17297. bra.w loc_DE86
  17298. ; end unused routine
  17299.  
  17300. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17301.  
  17302. ;sub_DD82:
  17303. Draw_BG3:
  17304. tst.b (a2)
  17305. beq.w ++ ; rts
  17306. cmpi.b #chemical_plant_zone,(Current_Zone).w
  17307. beq.w Draw_BG3_CPZ
  17308. ; S1 left-over: GHZ used this
  17309. bclr #0,(a2)
  17310. beq.s +
  17311. move.w #$40,d4
  17312. moveq #-$10,d5
  17313. bsr.w CalcBlockVRAMPos
  17314. move.w #$40,d4
  17315. moveq #-$10,d5
  17316. moveq #2,d6
  17317. bsr.w DrawBlockCol2
  17318. +
  17319. bclr #1,(a2)
  17320. beq.s + ; rts
  17321. move.w #$40,d4
  17322. move.w #320,d5
  17323. bsr.w CalcBlockVRAMPos
  17324. move.w #$40,d4
  17325. move.w #320,d5
  17326. moveq #2,d6
  17327. bsr.w DrawBlockCol2
  17328. +
  17329. rts
  17330. ; ===========================================================================
  17331. ; Chemical Plant Zone 1 block positioning array
  17332. ; Each entry is an index into BGCameraLookup; used to decide the camera to use
  17333. ; for given block for reloading BG. A entry of 0 means assume X = 0 for section,
  17334. ; but otherwise loads camera Y for selected camera.
  17335. ;byte_DDD0
  17336. CPZ_CameraSections:
  17337. dc.b 2
  17338. dc.b 2 ; 1
  17339. dc.b 2 ; 2
  17340. dc.b 2 ; 3
  17341. dc.b 2 ; 4
  17342. dc.b 2 ; 5
  17343. dc.b 2 ; 6
  17344. dc.b 2 ; 7
  17345. dc.b 2 ; 8
  17346. dc.b 2 ; 9
  17347. dc.b 2 ; 10
  17348. dc.b 2 ; 11
  17349. dc.b 2 ; 12
  17350. dc.b 2 ; 13
  17351. dc.b 2 ; 14
  17352. dc.b 2 ; 15
  17353. dc.b 2 ; 16
  17354. dc.b 2 ; 17
  17355. dc.b 2 ; 18
  17356. dc.b 2 ; 19
  17357. dc.b 4 ; 20
  17358. dc.b 4 ; 21
  17359. dc.b 4 ; 22
  17360. dc.b 4 ; 23
  17361. dc.b 4 ; 24
  17362. dc.b 4 ; 25
  17363. dc.b 4 ; 26
  17364. dc.b 4 ; 27
  17365. dc.b 4 ; 28
  17366. dc.b 4 ; 29
  17367. dc.b 4 ; 30
  17368. dc.b 4 ; 31
  17369. dc.b 4 ; 32
  17370. dc.b 4 ; 33
  17371. dc.b 4 ; 34
  17372. dc.b 4 ; 35
  17373. dc.b 4 ; 36
  17374. dc.b 4 ; 37
  17375. dc.b 4 ; 38
  17376. dc.b 4 ; 39
  17377. dc.b 4 ; 40
  17378. dc.b 4 ; 41
  17379. dc.b 4 ; 42
  17380. dc.b 4 ; 43
  17381. dc.b 4 ; 44
  17382. dc.b 4 ; 45
  17383. dc.b 4 ; 46
  17384. dc.b 4 ; 47
  17385. dc.b 4 ; 48
  17386. dc.b 4 ; 49
  17387. dc.b 4 ; 50
  17388. dc.b 4 ; 51
  17389. dc.b 4 ; 52
  17390. dc.b 4 ; 53
  17391. dc.b 4 ; 54
  17392. dc.b 4 ; 55
  17393. dc.b 4 ; 56
  17394. dc.b 4 ; 57
  17395. dc.b 4 ; 58
  17396. dc.b 4 ; 59
  17397. dc.b 4 ; 60
  17398. dc.b 4 ; 61
  17399. dc.b 4 ; 62
  17400. dc.b 4 ; 63
  17401. dc.b 4 ; 64
  17402. even
  17403. ; ===========================================================================
  17404. ; loc_DE12:
  17405. Draw_BG3_CPZ:
  17406. moveq #-$10,d4 ; bit0 = top row
  17407. bclr #0,(a2)
  17408. bne.s +
  17409. bclr #1,(a2)
  17410. beq.s ++
  17411. move.w #$E0,d4 ; bit1 = bottom row
  17412. +
  17413. lea_ CPZ_CameraSections+1,a0
  17414. move.w (Camera_BG_Y_pos).w,d0
  17415. add.w d4,d0
  17416. andi.w #$3F0,d0
  17417. lsr.w #4,d0
  17418. move.b (a0,d0.w),d0
  17419. movea.w BGCameraLookup(pc,d0.w),a3 ; Camera, either BG, BG2 or BG3 depending on Y
  17420. moveq #-$10,d5
  17421. movem.l d4-d5,-(sp)
  17422. bsr.w CalcBlockVRAMPos
  17423. movem.l (sp)+,d4-d5
  17424. bsr.w DrawBlockRow1
  17425. +
  17426. tst.b (a2)
  17427. bne.s +
  17428. rts
  17429. ; ===========================================================================
  17430. +
  17431. moveq #-$10,d4
  17432. moveq #-$10,d5
  17433. move.b (a2),d0
  17434. andi.b #-$58,d0
  17435. beq.s +
  17436. lsr.b #1,d0
  17437. move.b d0,(a2)
  17438. move.w #320,d5
  17439. +
  17440. lea_ CPZ_CameraSections,a0
  17441. move.w (Camera_BG_Y_pos).w,d0
  17442. andi.w #$7F0,d0
  17443. lsr.w #4,d0
  17444. lea (a0,d0.w),a0
  17445. bra.w loc_DE86
  17446. ; ===========================================================================
  17447. ;word_DE7E
  17448. BGCameraLookup:
  17449. dc.w Camera_BG_copy ; BG Camera
  17450. dc.w Camera_BG_copy ; BG Camera
  17451. dc.w Camera_BG2_copy ; BG2 Camera
  17452. dc.w Camera_BG3_copy ; BG3 Camera
  17453. ; ===========================================================================
  17454.  
  17455. loc_DE86:
  17456. tst.w (Two_player_mode).w
  17457. bne.s ++
  17458. moveq #$F,d6
  17459. move.l #vdpCommDelta($0080),d7
  17460.  
  17461. - moveq #0,d0
  17462. move.b (a0)+,d0
  17463. btst d0,(a2)
  17464. beq.s +
  17465. movea.w BGCameraLookup(pc,d0.w),a3 ; Camera, either BG, BG2 or BG3 depending on Y
  17466. movem.l d4-d5/a0,-(sp)
  17467. movem.l d4-d5,-(sp)
  17468. bsr.w GetBlockPtr
  17469. movem.l (sp)+,d4-d5
  17470. bsr.w CalcBlockVRAMPos
  17471. bsr.w ProcessAndWriteBlock2
  17472. movem.l (sp)+,d4-d5/a0
  17473. +
  17474. addi.w #$10,d4
  17475. dbf d6,-
  17476.  
  17477. clr.b (a2)
  17478. rts
  17479. ; ===========================================================================
  17480. +
  17481. moveq #$F,d6
  17482. move.l #vdpCommDelta($0080),d7
  17483.  
  17484. - moveq #0,d0
  17485. move.b (a0)+,d0
  17486. btst d0,(a2)
  17487. beq.s +
  17488. movea.w BGCameraLookup(pc,d0.w),a3 ; Camera, either BG, BG2 or BG3 depending on Y
  17489. movem.l d4-d5/a0,-(sp)
  17490. movem.l d4-d5,-(sp)
  17491. bsr.w GetBlockPtr
  17492. movem.l (sp)+,d4-d5
  17493. bsr.w CalcBlockVRAMPos
  17494. bsr.w ProcessAndWriteBlock2_2P
  17495. movem.l (sp)+,d4-d5/a0
  17496. +
  17497. addi.w #$10,d4
  17498. dbf d6,-
  17499.  
  17500. clr.b (a2)
  17501. rts
  17502. ; End of function Draw_BG3
  17503.  
  17504.  
  17505. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17506.  
  17507. ; sub_DF04:
  17508. DrawBlockCol1:
  17509. moveq #$F,d6
  17510.  
  17511. DrawBlockCol2:
  17512. add.w (a3),d5 ; add camera X pos
  17513. add.w 4(a3),d4 ; add camera Y pos
  17514. move.l #vdpCommDelta($0080),d7 ; store VDP command for line increment
  17515. move.l d0,d1 ; copy byte-swapped VDP command for later access
  17516. bsr.w GetBlockAddr
  17517. tst.w (Two_player_mode).w
  17518. bne.s ++
  17519.  
  17520. - move.w (a0),d3 ; get ID of the 16x16 block
  17521. andi.w #$3FF,d3
  17522. lsl.w #3,d3 ; multiply by 8, the size in bytes of a 16x16
  17523. lea (Block_Table).w,a1
  17524. adda.w d3,a1 ; a1 = address of the current 16x16 in the block table
  17525. move.l d1,d0
  17526. bsr.w ProcessAndWriteBlock2
  17527. adda.w #$10,a0 ; move onto the 16x16 vertically below this one
  17528. addi.w #$100,d1 ; draw on alternate 8x8 lines
  17529. andi.w #$FFF,d1
  17530. addi.w #$10,d4 ; add 16 to Y offset
  17531. move.w d4,d0
  17532. andi.w #$70,d0 ; have we reached a new 128x128?
  17533. bne.s + ; if not, branch
  17534. bsr.w GetBlockAddr ; otherwise, renew the block address
  17535. + dbf d6,- ; repeat 16 times
  17536.  
  17537. rts
  17538. ; ===========================================================================
  17539.  
  17540. / move.w (a0),d3
  17541. andi.w #$3FF,d3
  17542. lsl.w #3,d3
  17543. lea (Block_Table).w,a1
  17544. adda.w d3,a1
  17545. move.l d1,d0
  17546. bsr.w ProcessAndWriteBlock2_2P
  17547. adda.w #$10,a0
  17548. addi.w #$80,d1
  17549. andi.w #$FFF,d1
  17550. addi.w #$10,d4
  17551. move.w d4,d0
  17552. andi.w #$70,d0
  17553. bne.s +
  17554. bsr.w GetBlockAddr
  17555. + dbf d6,-
  17556.  
  17557. rts
  17558. ; End of function DrawBlockCol1
  17559.  
  17560.  
  17561. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17562.  
  17563. ; sub_DF8A: DrawTiles_Vertical:
  17564. DrawBlockRow:
  17565. add.w (a3),d5
  17566. add.w 4(a3),d4
  17567. bra.s DrawBlockRow3
  17568. ; End of function DrawBlockRow
  17569.  
  17570.  
  17571. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17572.  
  17573. ; sub_DF92: DrawTiles_Vertical1:
  17574. DrawBlockRow1:
  17575. moveq #$15,d6
  17576. add.w (a3),d5 ; add X pos
  17577. ; loc_DF96: DrawTiles_Vertical2:
  17578. DrawBlockRow2:
  17579. add.w 4(a3),d4 ; add Y pos
  17580. ; loc_DF9A: DrawTiles_Vertical3:
  17581. DrawBlockRow3:
  17582. tst.w (Two_player_mode).w
  17583. bne.s DrawBlockRow_2P
  17584. move.l a2,-(sp)
  17585. move.w d6,-(sp)
  17586. lea (Block_cache).w,a2
  17587. move.l d0,d1
  17588. or.w d2,d1
  17589. swap d1 ; make VRAM write command
  17590. move.l d1,-(sp)
  17591. move.l d1,(a5) ; set up a VRAM write at that address
  17592. swap d1
  17593. bsr.w GetBlockAddr
  17594.  
  17595. - move.w (a0),d3 ; get ID of the 16x16 block
  17596. andi.w #$3FF,d3
  17597. lsl.w #3,d3 ; multiply by 8, the size in bytes of a 16x16
  17598. lea (Block_Table).w,a1
  17599. adda.w d3,a1 ; a1 = address of current 16x16 in the block table
  17600. bsr.w ProcessAndWriteBlock
  17601. addq.w #2,a0 ; move onto next 16x16
  17602. addq.b #4,d1 ; increment VRAM write address
  17603. bpl.s +
  17604. andi.b #$7F,d1 ; restrict to a single 8x8 line
  17605. swap d1
  17606. move.l d1,(a5) ; set up a VRAM write at a new address
  17607. swap d1
  17608. +
  17609. addi.w #$10,d5 ; add 16 to X offset
  17610. move.w d5,d0
  17611. andi.w #$70,d0 ; have we reached a new 128x128?
  17612. bne.s + ; if not, branch
  17613. bsr.w GetBlockAddr ; otherwise, renew the block address
  17614. +
  17615. dbf d6,- ; repeat 22 times
  17616.  
  17617. move.l (sp)+,d1
  17618. addi.l #vdpCommDelta($0080),d1 ; move onto next line
  17619. lea (Block_cache).w,a2
  17620. move.l d1,(a5) ; write to this VRAM address
  17621. swap d1
  17622. move.w (sp)+,d6
  17623.  
  17624. - move.l (a2)+,(a6) ; write stored 8x8s
  17625. addq.b #4,d1 ; increment VRAM write address
  17626. bmi.s +
  17627. ori.b #$80,d1 ; force to bottom 8x8 line
  17628. swap d1
  17629. move.l d1,(a5) ; set up a VRAM write at a new address
  17630. swap d1
  17631. +
  17632. dbf d6,- ; repeat 22 times
  17633.  
  17634. movea.l (sp)+,a2
  17635. rts
  17636. ; ===========================================================================
  17637. ; loc_E018:
  17638. DrawBlockRow_2P:
  17639. move.l d0,d1
  17640. or.w d2,d1
  17641. swap d1
  17642. move.l d1,(a5)
  17643. swap d1
  17644. tst.b d1
  17645. bmi.s +++
  17646. bsr.w GetBlockAddr
  17647.  
  17648. - move.w (a0),d3
  17649. andi.w #$3FF,d3
  17650. lsl.w #3,d3
  17651. lea (Block_Table).w,a1
  17652. adda.w d3,a1
  17653. bsr.w ProcessAndWriteBlock_2P
  17654. addq.w #2,a0
  17655. addq.b #4,d1
  17656. bpl.s +
  17657. andi.b #$7F,d1
  17658. swap d1
  17659. move.l d1,(a5)
  17660. swap d1
  17661. +
  17662. addi.w #$10,d5
  17663. move.w d5,d0
  17664. andi.w #$70,d0
  17665. bne.s +
  17666. bsr.w GetBlockAddr
  17667. + dbf d6,-
  17668.  
  17669. rts
  17670. ; ===========================================================================
  17671. +
  17672. bsr.w GetBlockAddr
  17673.  
  17674. - move.w (a0),d3
  17675. andi.w #$3FF,d3
  17676. lsl.w #3,d3
  17677. lea (Block_Table).w,a1
  17678. adda.w d3,a1
  17679. bsr.w ProcessAndWriteBlock_2P
  17680. addq.w #2,a0
  17681. addq.b #4,d1
  17682. bmi.s +
  17683. ori.b #$80,d1
  17684. swap d1
  17685. move.l d1,(a5)
  17686. swap d1
  17687. +
  17688. addi.w #$10,d5
  17689. move.w d5,d0
  17690. andi.w #$70,d0
  17691. bne.s +
  17692. bsr.w GetBlockAddr
  17693. + dbf d6,-
  17694.  
  17695. rts
  17696. ; End of function DrawBlockRow1
  17697.  
  17698.  
  17699. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17700.  
  17701. ; sub_E09E:
  17702. GetBlockAddr:
  17703. movem.l d4-d5,-(sp)
  17704. move.w d4,d3 ; d3 = camera Y pos + offset
  17705. add.w d3,d3
  17706. andi.w #$F00,d3 ; limit to units of $100 ($100 = $80 * 2, $80 = height of a 128x128)
  17707. lsr.w #3,d5 ; divide by 8
  17708. move.w d5,d0
  17709. lsr.w #4,d0 ; divide by 16 (overall division of 128)
  17710. andi.w #$7F,d0
  17711. add.w d3,d0 ; get offset of current 128x128 in the level layout table
  17712. moveq #-1,d3
  17713. clr.w d3 ; d3 = $FFFF0000
  17714. move.b (a4,d0.w),d3 ; get tile ID of the current 128x128 tile
  17715. lsl.w #7,d3 ; multiply by 128, the size in bytes of a 128x128 in RAM
  17716. andi.w #$70,d4 ; round down to nearest 16-pixel boundary
  17717. andi.w #$E,d5 ; force this to be a multiple of 16
  17718. add.w d4,d3 ; add vertical offset of current 16x16
  17719. add.w d5,d3 ; add horizontal offset of current 16x16
  17720. movea.l d3,a0 ; store address, in the metablock table, of the current 16x16
  17721. movem.l (sp)+,d4-d5
  17722. rts
  17723. ; End of function GetBlockAddr
  17724.  
  17725.  
  17726. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17727.  
  17728. ; sub_E0D4:
  17729. ProcessAndWriteBlock:
  17730. btst #3,(a0) ; is this 16x16 to be Y-flipped?
  17731. bne.s ProcessAndWriteBlock_FlipY ; if it is, branch
  17732. btst #2,(a0) ; is this 16x16 to be X-flipped?
  17733. bne.s ProcessAndWriteBlock_FlipX ; if it is, branch
  17734. move.l (a1)+,(a6) ; write top two 8x8s to VRAM
  17735. move.l (a1)+,(a2)+ ; store bottom two 8x8s for later writing
  17736. rts
  17737. ; ===========================================================================
  17738.  
  17739. ProcessAndWriteBlock_FlipX:
  17740. move.l (a1)+,d3
  17741. eori.l #(flip_x<<16)|flip_x,d3 ; toggle X-flip flag of the 8x8s
  17742. swap d3 ; swap the position of the 8x8s
  17743. move.l d3,(a6) ; write top two 8x8s to VRAM
  17744. move.l (a1)+,d3
  17745. eori.l #(flip_x<<16)|flip_x,d3
  17746. swap d3
  17747. move.l d3,(a2)+ ; store bottom two 8x8s for later writing
  17748. rts
  17749. ; ===========================================================================
  17750.  
  17751. ProcessAndWriteBlock_FlipY:
  17752. btst #2,(a0) ; is this 16x16 to be X-flipped as well?
  17753. bne.s ProcessAndWriteBlock_FlipXY ; if it is, branch
  17754. move.l (a1)+,d0
  17755. move.l (a1)+,d3
  17756. eori.l #(flip_y<<16)|flip_y,d3 ; toggle Y-flip flag of the 8x8s
  17757. move.l d3,(a6) ; write bottom two 8x8s to VRAM
  17758. eori.l #(flip_y<<16)|flip_y,d0
  17759. move.l d0,(a2)+ ; store top two 8x8s for later writing
  17760. rts
  17761. ; ===========================================================================
  17762.  
  17763. ProcessAndWriteBlock_FlipXY:
  17764. move.l (a1)+,d0
  17765. move.l (a1)+,d3
  17766. eori.l #((flip_x|flip_y)<<16)|flip_x|flip_y,d3 ; toggle X and Y-flip flags of the 8x8s
  17767. swap d3
  17768. move.l d3,(a6) ; write bottom two 8x8s to VRAM
  17769. eori.l #((flip_x|flip_y)<<16)|flip_x|flip_y,d0
  17770. swap d0
  17771. move.l d0,(a2)+ ; store top two 8x8s for later writing
  17772. rts
  17773. ; End of function ProcessAndWriteBlock
  17774.  
  17775.  
  17776. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17777.  
  17778.  
  17779. ;sub_E136:
  17780. ProcessAndWriteBlock_2P:
  17781. btst #3,(a0)
  17782. bne.s loc_E154
  17783. btst #2,(a0)
  17784. bne.s loc_E146
  17785. move.l (a1)+,(a6)
  17786. rts
  17787. ; ===========================================================================
  17788.  
  17789. loc_E146:
  17790. move.l (a1)+,d3
  17791. eori.l #(flip_x<<16)|flip_x,d3
  17792. swap d3
  17793. move.l d3,(a6)
  17794. rts
  17795. ; ===========================================================================
  17796.  
  17797. loc_E154:
  17798. btst #2,(a0)
  17799. bne.s loc_E166
  17800. move.l (a1)+,d3
  17801. eori.l #(flip_y<<16)|flip_y,d3
  17802. move.l d3,(a6)
  17803. rts
  17804. ; ===========================================================================
  17805.  
  17806. loc_E166:
  17807. move.l (a1)+,d3
  17808. eori.l #((flip_x|flip_y)<<16)|flip_x|flip_y,d3
  17809. swap d3
  17810. move.l d3,(a6)
  17811. rts
  17812. ; End of function ProcessAndWriteBlock_2P
  17813.  
  17814.  
  17815. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17816.  
  17817. ; sub_E174:
  17818. ProcessAndWriteBlock2:
  17819. or.w d2,d0
  17820. swap d0 ; make VRAM write command
  17821. btst #3,(a0) ; is the 16x16 to be Y-flipped?
  17822. bne.s ProcessAndWriteBlock2_FlipY ; if it is, branch
  17823. btst #2,(a0) ; is the 16x16 to be X-flipped?
  17824. bne.s ProcessAndWriteBlock2_FlipX ; if it is, branch
  17825. move.l d0,(a5) ; write to this VRAM address
  17826. move.l (a1)+,(a6) ; write top two 8x8s
  17827. add.l d7,d0 ; move onto next line
  17828. move.l d0,(a5)
  17829. move.l (a1)+,(a6) ; write bottom two 8x8s
  17830. rts
  17831. ; ===========================================================================
  17832.  
  17833. ProcessAndWriteBlock2_FlipX:
  17834. move.l d0,(a5)
  17835. move.l (a1)+,d3
  17836. eori.l #(flip_x<<16)|flip_x,d3 ; toggle X-flip flag of the 8x8s
  17837. swap d3 ; swap the position of the 8x8s
  17838. move.l d3,(a6) ; write top two 8x8s
  17839. add.l d7,d0 ; move onto next line
  17840. move.l d0,(a5)
  17841. move.l (a1)+,d3
  17842. eori.l #(flip_x<<16)|flip_x,d3
  17843. swap d3
  17844. move.l d3,(a6) ; write bottom two 8x8s
  17845. rts
  17846. ; ===========================================================================
  17847.  
  17848. ProcessAndWriteBlock2_FlipY:
  17849. btst #2,(a0) ; is the 16x16 to be X-flipped as well?
  17850. bne.s ProcessAndWriteBlock2_FlipXY ; if it is, branch
  17851. move.l d5,-(sp)
  17852. move.l d0,(a5)
  17853. move.l (a1)+,d5
  17854. move.l (a1)+,d3
  17855. eori.l #(flip_y<<16)|flip_y,d3 ; toggle Y-flip flag of 8x8s
  17856. move.l d3,(a6) ; write bottom two 8x8s
  17857. add.l d7,d0 ; move onto next line
  17858. move.l d0,(a5)
  17859. eori.l #(flip_y<<16)|flip_y,d5
  17860. move.l d5,(a6) ; write top two 8x8s
  17861. move.l (sp)+,d5
  17862. rts
  17863. ; ===========================================================================
  17864.  
  17865. ProcessAndWriteBlock2_FlipXY:
  17866. move.l d5,-(sp)
  17867. move.l d0,(a5)
  17868. move.l (a1)+,d5
  17869. move.l (a1)+,d3
  17870. eori.l #((flip_x|flip_y)<<16)|flip_x|flip_y,d3 ; toggle X and Y-flip flags of 8x8s
  17871. swap d3 ; swap the position of the 8x8s
  17872. move.l d3,(a6) ; write bottom two 8x8s
  17873. add.l d7,d0
  17874. move.l d0,(a5)
  17875. eori.l #((flip_x|flip_y)<<16)|flip_x|flip_y,d5
  17876. swap d5
  17877. move.l d5,(a6) ; write top two 8x8s
  17878. move.l (sp)+,d5
  17879. rts
  17880. ; End of function ProcessAndWriteBlock2
  17881.  
  17882.  
  17883. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17884.  
  17885.  
  17886. ;sub_E1FA:
  17887. ProcessAndWriteBlock2_2P:
  17888. or.w d2,d0
  17889. swap d0
  17890. btst #3,(a0)
  17891. bne.s loc_E220
  17892. btst #2,(a0)
  17893. bne.s loc_E210
  17894. move.l d0,(a5)
  17895. move.l (a1)+,(a6)
  17896. rts
  17897. ; ===========================================================================
  17898.  
  17899. loc_E210:
  17900. move.l d0,(a5)
  17901. move.l (a1)+,d3
  17902. eori.l #(flip_x<<16)|flip_x,d3
  17903. swap d3
  17904. move.l d3,(a6)
  17905. rts
  17906. ; ===========================================================================
  17907.  
  17908. loc_E220:
  17909. btst #2,(a0)
  17910. bne.s loc_E234
  17911. move.l d0,(a5)
  17912. move.l (a1)+,d3
  17913. eori.l #(flip_y<<16)|flip_y,d3
  17914. move.l d3,(a6)
  17915. rts
  17916. ; ===========================================================================
  17917.  
  17918. loc_E234:
  17919. move.l d0,(a5)
  17920. move.l (a1)+,d3
  17921. eori.l #((flip_x|flip_y)<<16)|flip_x|flip_y,d3
  17922. swap d3
  17923. move.l d3,(a6)
  17924. rts
  17925. ; End of function ProcessAndWriteBlock2_2P
  17926.  
  17927.  
  17928. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17929.  
  17930. ;sub_E244
  17931. GetBlockPtr:
  17932. add.w (a3),d5
  17933. add.w 4(a3),d4
  17934. lea (Block_Table).w,a1
  17935. move.w d4,d3 ; d3 = camera Y pos + offset
  17936. add.w d3,d3
  17937. andi.w #$F00,d3 ; limit to units of $100 ($100 = $80 * 2, $80 = height of a 128x128)
  17938. lsr.w #3,d5 ; divide by 8
  17939. move.w d5,d0
  17940. lsr.w #4,d0 ; divide by 16 (overall division of 128)
  17941. andi.w #$7F,d0
  17942. add.w d3,d0 ; get offset of current 128x128 in the level layout table
  17943. moveq #-1,d3
  17944. clr.w d3 ; d3 = $FFFF0000
  17945. move.b (a4,d0.w),d3 ; get tile ID of the current 128x128 tile
  17946. lsl.w #7,d3 ; multiply by 128, the size in bytes of a 128x128 in RAM
  17947. andi.w #$70,d4 ; round down to nearest 16-pixel boundary
  17948. andi.w #$E,d5 ; force this to be a multiple of 16
  17949. add.w d4,d3 ; add vertical offset of current 16x16
  17950. add.w d5,d3 ; add horizontal offset of current 16x16
  17951. movea.l d3,a0 ; store address, in the metablock table, of the current 16x16
  17952. move.w (a0),d3
  17953. andi.w #$3FF,d3
  17954. lsl.w #3,d3
  17955. adda.w d3,a1
  17956. rts
  17957. ; End of function GetBlockPtr
  17958.  
  17959.  
  17960. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  17961.  
  17962. ; sub_E286: Calc_VRAM_Pos:
  17963. CalcBlockVRAMPos:
  17964. add.w (a3),d5 ; add X pos
  17965.  
  17966. CalcBlockVRAMPos2:
  17967. tst.w (Two_player_mode).w
  17968. bne.s CalcBlockVRAMPos_2P
  17969. add.w 4(a3),d4 ; add Y pos
  17970. andi.w #$F0,d4 ; round down to the nearest 16-pixel boundary
  17971. andi.w #$1F0,d5 ; round down to the nearest 16-pixel boundary
  17972. lsl.w #4,d4 ; make it into units of $100 - the height in plane A of a 16x16
  17973. lsr.w #2,d5 ; make it into units of 4 - the width in plane A of a 16x16
  17974. add.w d5,d4 ; combine the two to get final address
  17975. ; access a VDP address in plane name table A ($C000) or B ($E000) if d2 has bit 13 unset or set
  17976. moveq #vdpComm(VRAM_Plane_A_Name_Table,VRAM,WRITE)&$FFFF,d0
  17977. swap d0
  17978. move.w d4,d0 ; make word-swapped VDP command
  17979. rts
  17980. ; ===========================================================================
  17981. ; loc_E2A8:
  17982. CalcBlockVRAMPos_2P:
  17983. add.w 4(a3),d4
  17984.  
  17985. loc_E2AC:
  17986. andi.w #$1F0,d4
  17987. andi.w #$1F0,d5
  17988. lsl.w #3,d4
  17989. lsr.w #2,d5
  17990. add.w d5,d4
  17991. ; access a VDP address in plane name table A ($C000) or B ($E000) if d2 has bit 13 unset or set
  17992. moveq #vdpComm(VRAM_Plane_A_Name_Table,VRAM,WRITE)&$FFFF,d0
  17993. swap d0
  17994. move.w d4,d0
  17995. rts
  17996. ; End of function CalcBlockVRAMPos
  17997.  
  17998.  
  17999. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  18000.  
  18001.  
  18002. ;loc_E2C2:
  18003. CalcBlockVRAMPosB:
  18004. tst.w (Two_player_mode).w
  18005. bne.s +
  18006. add.w 4(a3),d4
  18007. add.w (a3),d5
  18008. andi.w #$F0,d4
  18009. andi.w #$1F0,d5
  18010. lsl.w #4,d4
  18011. lsr.w #2,d5
  18012. add.w d5,d4
  18013. ; access a VDP address in 2p plane name table A ($A000) or B ($8000) if d2 has bit 13 unset or set
  18014. moveq #vdpComm(VRAM_Plane_A_Name_Table_2P,VRAM,WRITE)&$FFFF,d0
  18015. swap d0
  18016. move.w d4,d0
  18017. rts
  18018. ; ===========================================================================
  18019. ; interestingly, this subroutine was in the Sonic 1 ROM, unused
  18020. +
  18021. add.w 4(a3),d4
  18022. add.w (a3),d5
  18023. andi.w #$1F0,d4
  18024. andi.w #$1F0,d5
  18025. lsl.w #3,d4
  18026. lsr.w #2,d5
  18027. add.w d5,d4
  18028. ; access a VDP address in 2p plane name table A ($A000) or B ($8000) if d2 has bit 13 unset or set
  18029. moveq #vdpComm(VRAM_Plane_A_Name_Table_2P,VRAM,WRITE)&$FFFF,d0
  18030. swap d0
  18031. move.w d4,d0
  18032. rts
  18033. ; End of function CalcBlockVRAMPosB
  18034.  
  18035. ; ===========================================================================
  18036. ; Loads the background in its initial state into VRAM (plane B).
  18037. ; Especially important for levels that never re-load the background dynamically
  18038. ;loc_E300:
  18039. DrawInitialBG:
  18040. lea (VDP_control_port).l,a5
  18041. lea (VDP_data_port).l,a6
  18042. lea (Camera_BG_X_pos).w,a3
  18043. lea (Level_Layout+$80).w,a4 ; background
  18044. move.w #vdpComm(VRAM_Plane_B_Name_Table,VRAM,WRITE)>>16,d2
  18045. moveq #0,d4
  18046. cmpi.b #casino_night_zone,(Current_Zone).w
  18047. beq.w ++
  18048. tst.w (Two_player_mode).w
  18049. beq.w +
  18050. cmpi.b #mystic_cave_zone,(Current_Zone).w
  18051. beq.w loc_E396
  18052. +
  18053. moveq #-$10,d4
  18054. +
  18055. moveq #$F,d6
  18056. - movem.l d4-d6,-(sp)
  18057. moveq #0,d5
  18058. move.w d4,d1
  18059. bsr.w CalcBlockVRAMPos
  18060. move.w d1,d4
  18061. moveq #0,d5
  18062. moveq #$1F,d6
  18063. move #$2700,sr
  18064. bsr.w DrawBlockRow
  18065. move #$2300,sr
  18066. movem.l (sp)+,d4-d6
  18067. addi.w #$10,d4
  18068. dbf d6,-
  18069.  
  18070. rts
  18071. ; ===========================================================================
  18072. ; dead code
  18073. moveq #-$10,d4
  18074.  
  18075. moveq #$F,d6
  18076. - movem.l d4-d6,-(sp)
  18077. moveq #0,d5
  18078. move.w d4,d1
  18079. bsr.w CalcBlockVRAMPosB
  18080. move.w d1,d4
  18081. moveq #0,d5
  18082. moveq #$1F,d6
  18083. move #$2700,sr
  18084. bsr.w DrawBlockRow
  18085. move #$2300,sr
  18086. movem.l (sp)+,d4-d6
  18087. addi.w #$10,d4
  18088. dbf d6,-
  18089.  
  18090. rts
  18091. ; ===========================================================================
  18092.  
  18093. loc_E396:
  18094. moveq #0,d4
  18095.  
  18096. moveq #$1F,d6
  18097. - movem.l d4-d6,-(sp)
  18098. moveq #0,d5
  18099. move.w d4,d1
  18100. bsr.w loc_E2AC
  18101. move.w d1,d4
  18102. moveq #0,d5
  18103. moveq #$1F,d6
  18104. move #$2700,sr
  18105. bsr.w DrawBlockRow3
  18106. move #$2300,sr
  18107. movem.l (sp)+,d4-d6
  18108. addi.w #$10,d4
  18109. dbf d6,-
  18110.  
  18111. rts
  18112. ; ===========================================================================
  18113.  
  18114. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  18115. ; loadZoneBlockMaps
  18116.  
  18117. ; Loads block and bigblock mappings for the current Zone.
  18118.  
  18119. loadZoneBlockMaps:
  18120. moveq #0,d0
  18121. move.b (Current_Zone).w,d0
  18122. add.w d0,d0
  18123. add.w d0,d0
  18124. move.w d0,d1
  18125. add.w d0,d0
  18126. add.w d1,d0
  18127. lea (LevelArtPointers).l,a2
  18128. lea (a2,d0.w),a2
  18129. move.l a2,-(sp)
  18130. addq.w #4,a2
  18131. move.l (a2)+,d0
  18132. andi.l #$FFFFFF,d0 ; pointer to block mappings
  18133. movea.l d0,a0
  18134. lea (Block_Table).w,a1
  18135. jsrto (KosDec).l, JmpTo_KosDec ; load block maps
  18136. cmpi.b #hill_top_zone,(Current_Zone).w
  18137. bne.s +
  18138. lea (Block_Table+$980).w,a1
  18139. lea (BM16_HTZ).l,a0
  18140. jsrto (KosDec).l, JmpTo_KosDec ; patch for Hill Top Zone block map
  18141. +
  18142. tst.w (Two_player_mode).w
  18143. beq.s +
  18144. ; In 2P mode, adjust the block table to halve the pattern index on each block
  18145. lea (Block_Table).w,a1
  18146.  
  18147. move.w #bytesToWcnt(Block_Table_End-Block_Table),d2
  18148. - move.w (a1),d0 ; read an entry
  18149. move.w d0,d1
  18150. andi.w #$F800,d0 ; filter for upper five bits
  18151. andi.w #$7FF,d1 ; filter for lower eleven bits (patternIndex)
  18152. lsr.w #1,d1 ; halve the pattern index
  18153. or.w d1,d0 ; put the parts back together
  18154. move.w d0,(a1)+ ; change the entry with the adjusted value
  18155. dbf d2,-
  18156. +
  18157. move.l (a2)+,d0
  18158. andi.l #$FFFFFF,d0 ; pointer to chunk mappings
  18159. movea.l d0,a0
  18160. lea (Chunk_Table).l,a1
  18161. jsrto (KosDec).l, JmpTo_KosDec
  18162. bsr.w loadLevelLayout
  18163. movea.l (sp)+,a2 ; zone specific pointer in LevelArtPointers
  18164. addq.w #4,a2
  18165. moveq #0,d0
  18166. move.b (a2),d0 ; PLC2 ID
  18167. beq.s +
  18168. jsrto (LoadPLC).l, JmpTo_LoadPLC
  18169. +
  18170. addq.w #4,a2
  18171. moveq #0,d0
  18172. move.b (a2),d0 ; palette ID
  18173. jsrto (PalLoad_Now).l, JmpTo_PalLoad_Now
  18174. rts
  18175.  
  18176. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  18177.  
  18178.  
  18179. loadLevelLayout:
  18180. moveq #0,d0
  18181. move.w (Current_ZoneAndAct).w,d0
  18182. ror.b #1,d0
  18183. lsr.w #6,d0
  18184. lea (Off_Level).l,a0
  18185. move.w (a0,d0.w),d0
  18186. lea (a0,d0.l),a0
  18187. lea (Level_Layout).w,a1
  18188. jmpto (KosDec).l, JmpTo_KosDec
  18189. ; End of function loadLevelLayout
  18190.  
  18191. ; ===========================================================================
  18192. lea (Level_Layout).w,a3
  18193. move.w #bytesToLcnt(Level_Layout_End-Level_Layout),d1
  18194. moveq #0,d0
  18195.  
  18196. - move.l d0,(a3)+
  18197. dbf d1,-
  18198.  
  18199. lea (Level_Layout).w,a3
  18200. moveq #0,d1
  18201. bsr.w sub_E4A2
  18202. lea (Level_Layout+$80).w,a3
  18203. moveq #2,d1
  18204.  
  18205. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  18206.  
  18207.  
  18208. sub_E4A2:
  18209. moveq #0,d0
  18210. move.w (Current_ZoneAndAct).w,d0
  18211. ror.b #1,d0
  18212. lsr.w #5,d0
  18213. add.w d1,d0
  18214. lea (Off_Level).l,a1
  18215. move.w (a1,d0.w),d0
  18216. lea (a1,d0.l),a1
  18217. moveq #0,d1
  18218. move.w d1,d2
  18219. move.b (a1)+,d1
  18220. move.b (a1)+,d2
  18221. move.l d1,d5
  18222. addq.l #1,d5
  18223. moveq #0,d3
  18224. move.w #$80,d3
  18225. divu.w d5,d3
  18226. subq.w #1,d3
  18227.  
  18228. - movea.l a3,a0
  18229.  
  18230. move.w d3,d4
  18231. - move.l a1,-(sp)
  18232.  
  18233. move.w d1,d0
  18234. - move.b (a1)+,(a0)+
  18235. dbf d0,-
  18236.  
  18237. movea.l (sp)+,a1
  18238. dbf d4,--
  18239.  
  18240. lea (a1,d5.w),a1
  18241. lea $100(a3),a3
  18242. dbf d2,---
  18243.  
  18244. rts
  18245. ; End of function sub_E4A2
  18246.  
  18247. ; ===========================================================================
  18248. lea ($FE0000).l,a1
  18249. lea ($FE0080).l,a2
  18250. lea (Chunk_Table).l,a3
  18251.  
  18252. move.w #$3F,d1
  18253. - bsr.w sub_E59C
  18254. bsr.w sub_E59C
  18255. dbf d1,-
  18256.  
  18257. lea ($FE0000).l,a1
  18258. lea ($FF0000).l,a2
  18259.  
  18260. move.w #$3F,d1
  18261. - move.w #0,(a2)+
  18262. dbf d1,-
  18263.  
  18264. move.w #$3FBF,d1
  18265. - move.w (a1)+,(a2)+
  18266. dbf d1,-
  18267.  
  18268. rts
  18269. ; ===========================================================================
  18270. lea ($FE0000).l,a1
  18271. lea (Chunk_Table).l,a3
  18272.  
  18273. moveq #$1F,d0
  18274. - move.l (a1)+,(a3)+
  18275. dbf d0,-
  18276.  
  18277. moveq #0,d7
  18278. lea ($FE0000).l,a1
  18279. move.w #$FF,d5
  18280.  
  18281. loc_E55A:
  18282. lea (Chunk_Table).l,a3
  18283. move.w d7,d6
  18284.  
  18285. - movem.l a1-a3,-(sp)
  18286. move.w #$3F,d0
  18287.  
  18288. - cmpm.w (a1)+,(a3)+
  18289. bne.s +
  18290. dbf d0,-
  18291. movem.l (sp)+,a1-a3
  18292. adda.w #$80,a1
  18293. dbf d5,loc_E55A
  18294.  
  18295. bra.s ++
  18296. ; ===========================================================================
  18297. + movem.l (sp)+,a1-a3
  18298. adda.w #$80,a3
  18299. dbf d6,--
  18300.  
  18301. moveq #$1F,d0
  18302. - move.l (a1)+,(a3)+
  18303. dbf d0,-
  18304.  
  18305. addq.l #1,d7
  18306. dbf d5,loc_E55A
  18307. /
  18308. bra.s - ; infinite loop
  18309.  
  18310. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  18311.  
  18312.  
  18313. sub_E59C:
  18314. moveq #7,d0
  18315. - move.l (a3)+,(a1)+
  18316. move.l (a3)+,(a1)+
  18317. move.l (a3)+,(a1)+
  18318. move.l (a3)+,(a1)+
  18319. move.l (a3)+,(a2)+
  18320. move.l (a3)+,(a2)+
  18321. move.l (a3)+,(a2)+
  18322. move.l (a3)+,(a2)+
  18323. dbf d0,-
  18324.  
  18325. adda.w #$80,a1
  18326. adda.w #$80,a2
  18327. rts
  18328. ; End of function sub_E59C
  18329.  
  18330. ; ===========================================================================
  18331.  
  18332. if gameRevision=0
  18333. nop
  18334. endif
  18335.  
  18336. if ~~removeJmpTos
  18337. ; JmpTo_PalLoad2
  18338. JmpTo_PalLoad_Now
  18339. jmp (PalLoad_Now).l
  18340. JmpTo_LoadPLC
  18341. jmp (LoadPLC).l
  18342. JmpTo_KosDec
  18343. jmp (KosDec).l
  18344.  
  18345. align 4
  18346. endif
  18347.  
  18348.  
  18349.  
  18350.  
  18351. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  18352.  
  18353. ; screen resizing, earthquakage, etc
  18354.  
  18355. ; sub_E5D0:
  18356. RunDynamicLevelEvents:
  18357. moveq #0,d0
  18358. move.b (Current_Zone).w,d0
  18359. add.w d0,d0
  18360. move.w DynamicLevelEventIndex(pc,d0.w),d0
  18361. jsr DynamicLevelEventIndex(pc,d0.w)
  18362. moveq #2,d1
  18363. move.w (Camera_Max_Y_pos).w,d0
  18364. sub.w (Camera_Max_Y_pos_now).w,d0
  18365. beq.s ++ ; rts
  18366. bcc.s +++
  18367. neg.w d1
  18368. move.w (Camera_Y_pos).w,d0
  18369. cmp.w (Camera_Max_Y_pos).w,d0
  18370. bls.s +
  18371. move.w d0,(Camera_Max_Y_pos_now).w
  18372. andi.w #$FFFE,(Camera_Max_Y_pos_now).w
  18373. +
  18374. add.w d1,(Camera_Max_Y_pos_now).w
  18375. move.b #1,(Camera_Max_Y_Pos_Changing).w
  18376. +
  18377. rts
  18378. ; ===========================================================================
  18379. +
  18380. move.w (Camera_Y_pos).w,d0
  18381. addi_.w #8,d0
  18382. cmp.w (Camera_Max_Y_pos_now).w,d0
  18383. blo.s +
  18384. btst #1,(MainCharacter+status).w
  18385. beq.s +
  18386. add.w d1,d1
  18387. add.w d1,d1
  18388. +
  18389. add.w d1,(Camera_Max_Y_pos_now).w
  18390. move.b #1,(Camera_Max_Y_Pos_Changing).w
  18391. rts
  18392. ; End of function RunDynamicLevelEvents
  18393.  
  18394. ; ===========================================================================
  18395. ; off_E636:
  18396. DynamicLevelEventIndex: zoneOrderedOffsetTable 2,1
  18397. zoneOffsetTableEntry.w LevEvents_EHZ ; 0 ; EHZ
  18398. zoneOffsetTableEntry.w LevEvents_001 ; 1 ; LEV1
  18399. zoneOffsetTableEntry.w LevEvents_002 ; 2 ; LEV2
  18400. zoneOffsetTableEntry.w LevEvents_003 ; 3 ; LEV3
  18401. zoneOffsetTableEntry.w LevEvents_MTZ ; 4 ; MTZ
  18402. zoneOffsetTableEntry.w LevEvents_MTZ3 ; 5 ; MTZ3
  18403. zoneOffsetTableEntry.w LevEvents_WFZ ; 6 ; WFZ
  18404. zoneOffsetTableEntry.w LevEvents_HTZ ; 7 ; HTZ
  18405. zoneOffsetTableEntry.w LevEvents_HPZ ; 8 ; HPZ
  18406. zoneOffsetTableEntry.w LevEvents_009 ; 9 ; LEV9
  18407. zoneOffsetTableEntry.w LevEvents_OOZ ; $A ; OOZ
  18408. zoneOffsetTableEntry.w LevEvents_MCZ ; $B ; MCZ
  18409. zoneOffsetTableEntry.w LevEvents_CNZ ; $C ; CNZ
  18410. zoneOffsetTableEntry.w LevEvents_CPZ ; $D ; CPZ
  18411. zoneOffsetTableEntry.w LevEvents_DEZ ; $E ; DEZ
  18412. zoneOffsetTableEntry.w LevEvents_ARZ ; $F ; ARZ
  18413. zoneOffsetTableEntry.w LevEvents_SCZ ; $10 ; SCZ
  18414. zoneTableEnd
  18415. ; ===========================================================================
  18416. ; loc_E658:
  18417. LevEvents_EHZ:
  18418. tst.b (Current_Act).w
  18419. bne.s LevEvents_EHZ2
  18420. rts
  18421. ; ---------------------------------------------------------------------------
  18422. LevEvents_EHZ2:
  18423. moveq #0,d0
  18424. move.b (Dynamic_Resize_Routine).w,d0
  18425. move.w LevEvents_EHZ2_Index(pc,d0.w),d0
  18426. jmp LevEvents_EHZ2_Index(pc,d0.w)
  18427. ; ===========================================================================
  18428. ; off_E66E:
  18429. LevEvents_EHZ2_Index: offsetTable
  18430. offsetTableEntry.w LevEvents_EHZ2_Routine1 ; 0
  18431. offsetTableEntry.w LevEvents_EHZ2_Routine2 ; 2
  18432. offsetTableEntry.w LevEvents_EHZ2_Routine3 ; 4
  18433. offsetTableEntry.w LevEvents_EHZ2_Routine4 ; 6
  18434. ; ===========================================================================
  18435. ; loc_E676:
  18436. LevEvents_EHZ2_Routine1:
  18437. tst.w (Two_player_mode).w
  18438. bne.s ++
  18439. cmpi.w #$2780,(Camera_X_pos).w
  18440. blo.s + ; rts
  18441. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  18442. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  18443. move.w #$390,(Camera_Max_Y_pos).w
  18444. move.w #$390,(Tails_Max_Y_pos).w
  18445. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_EHZ2_Routine2
  18446. +
  18447. rts
  18448. ; ---------------------------------------------------------------------------
  18449. +
  18450. move.w #$2920,(Camera_Max_X_pos).w
  18451. move.w #$2920,(Tails_Max_X_pos).w
  18452. rts
  18453. ; ===========================================================================
  18454. ; loc_E6B0:
  18455. LevEvents_EHZ2_Routine2:
  18456. cmpi.w #$28F0,(Camera_X_pos).w
  18457. blo.s + ; rts
  18458. move.w #$28F0,(Camera_Min_X_pos).w
  18459. move.w #$2940,(Camera_Max_X_pos).w
  18460. move.w #$28F0,(Tails_Min_X_pos).w
  18461. move.w #$2940,(Tails_Max_X_pos).w
  18462. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_EHZ2_Routine3
  18463. move.w #MusID_FadeOut,d0
  18464. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  18465. clr.b (ScreenShift).w
  18466. move.b #2,(Current_Boss_ID).w
  18467. moveq #PLCID_EhzBoss,d0
  18468. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  18469. +
  18470. rts
  18471. ; ===========================================================================
  18472. ; loc_E6EE:
  18473. LevEvents_EHZ2_Routine3:
  18474. cmpi.w #$388,(Camera_Y_pos).w
  18475. blo.s +
  18476. move.w #$388,(Camera_Min_Y_pos).w
  18477. move.w #$388,(Tails_Min_Y_pos).w
  18478. +
  18479. addq.b #1,(ScreenShift).w
  18480. cmpi.b #$5A,(ScreenShift).w
  18481. blo.s ++
  18482. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  18483. bne.s +
  18484.  
  18485. move.b #ObjID_EHZBoss,id(a1) ; load obj56 (EHZ boss)
  18486. move.b #$81,subtype(a1)
  18487. move.w #$29D0,x_pos(a1)
  18488. move.w #$426,y_pos(a1)
  18489. +
  18490. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_EHZ2_Routine4
  18491. move.w #MusID_Boss,d0
  18492. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  18493. +
  18494. rts
  18495. ; ===========================================================================
  18496. ; loc_E738:
  18497. LevEvents_EHZ2_Routine4:
  18498. tst.b (Boss_defeated_flag).w
  18499. beq.s +
  18500. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  18501. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  18502. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  18503. +
  18504. rts
  18505.  
  18506. ; ===========================================================================
  18507. ; return_E752:
  18508. LevEvents_001:
  18509. rts
  18510. ; ===========================================================================
  18511. ; return_E754:
  18512. LevEvents_002:
  18513. rts
  18514. ; ===========================================================================
  18515. ; return_E756:
  18516. LevEvents_003:
  18517. rts
  18518. ; ===========================================================================
  18519. ; return_E758:
  18520. LevEvents_MTZ:
  18521. rts
  18522.  
  18523. ; ===========================================================================
  18524. ; loc_E75A:
  18525. LevEvents_MTZ3:
  18526. moveq #0,d0
  18527. move.b (Dynamic_Resize_Routine).w,d0
  18528. move.w LevEvents_MTZ3_Index(pc,d0.w),d0
  18529. jmp LevEvents_MTZ3_Index(pc,d0.w)
  18530. ; ===========================================================================
  18531. ; off_E768:
  18532. LevEvents_MTZ3_Index: offsetTable
  18533. offsetTableEntry.w LevEvents_MTZ3_Routine1 ; 0
  18534. offsetTableEntry.w LevEvents_MTZ3_Routine2 ; 2
  18535. offsetTableEntry.w LevEvents_MTZ3_Routine3 ; 4
  18536. offsetTableEntry.w LevEvents_MTZ3_Routine4 ; 6
  18537. offsetTableEntry.w LevEvents_MTZ3_Routine5 ; 8
  18538. ; ===========================================================================
  18539. ; loc_E772:
  18540. LevEvents_MTZ3_Routine1:
  18541. cmpi.w #$2530,(Camera_X_pos).w
  18542. blo.s +
  18543. move.w #$500,(Camera_Max_Y_pos_now).w
  18544. move.w #$450,(Camera_Max_Y_pos).w
  18545. move.w #$450,(Tails_Max_Y_pos).w
  18546. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine2
  18547. +
  18548. rts
  18549. ; ===========================================================================
  18550. ; loc_E792:
  18551. LevEvents_MTZ3_Routine2:
  18552. cmpi.w #$2980,(Camera_X_pos).w
  18553. blo.s +
  18554. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  18555. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  18556. move.w #$400,(Camera_Max_Y_pos).w
  18557. move.w #$400,(Tails_Max_Y_pos).w
  18558. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine3
  18559. +
  18560. rts
  18561. ; ===========================================================================
  18562. ; loc_E7B8:
  18563. LevEvents_MTZ3_Routine3:
  18564. cmpi.w #$2A80,(Camera_X_pos).w
  18565. blo.s +
  18566. move.w #$2AB0,(Camera_Min_X_pos).w
  18567. move.w #$2AB0,(Camera_Max_X_pos).w
  18568. move.w #$2AB0,(Tails_Min_X_pos).w
  18569. move.w #$2AB0,(Tails_Max_X_pos).w
  18570. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine4
  18571. move.w #MusID_FadeOut,d0
  18572. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  18573. clr.b (ScreenShift).w
  18574. move.b #7,(Current_Boss_ID).w
  18575. moveq #PLCID_MtzBoss,d0
  18576. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  18577. +
  18578. rts
  18579. ; ===========================================================================
  18580. ; loc_E7F6:
  18581. LevEvents_MTZ3_Routine4:
  18582. cmpi.w #$400,(Camera_Y_pos).w
  18583. blo.s +
  18584. move.w #$400,(Camera_Min_Y_pos).w
  18585. move.w #$400,(Tails_Min_Y_pos).w
  18586. +
  18587. addq.b #1,(ScreenShift).w
  18588. cmpi.b #$5A,(ScreenShift).w
  18589. blo.s ++
  18590. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  18591. bne.s +
  18592. move.b #ObjID_MTZBoss,id(a1) ; load obj54 (MTZ boss)
  18593. +
  18594. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine5
  18595. move.w #MusID_Boss,d0
  18596. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  18597. +
  18598. rts
  18599. ; ===========================================================================
  18600. ; loc_E82E:
  18601. LevEvents_MTZ3_Routine5:
  18602. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  18603. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  18604. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  18605. rts
  18606.  
  18607. ; ===========================================================================
  18608. ; loc_E842:
  18609. LevEvents_WFZ:
  18610. moveq #0,d0
  18611. move.b (Dynamic_Resize_Routine).w,d0
  18612. move.w LevEvents_WFZ_Index(pc,d0.w),d0
  18613. jsr LevEvents_WFZ_Index(pc,d0.w)
  18614. move.w (WFZ_LevEvent_Subrout).w,d0
  18615. move.w LevEvents_WFZ_Index2(pc,d0.w),d0
  18616. jmp LevEvents_WFZ_Index2(pc,d0.w)
  18617. ; ===========================================================================
  18618. ; off_E85C:
  18619. LevEvents_WFZ_Index2: offsetTable
  18620. offsetTableEntry.w LevEvents_WFZ_Routine5 ; 0
  18621. offsetTableEntry.w LevEvents_WFZ_Routine6 ; 2
  18622. offsetTableEntry.w LevEvents_WFZ_RoutineNull ; 4
  18623. ; ===========================================================================
  18624. ; off_E862:
  18625. LevEvents_WFZ_Index: offsetTable
  18626. offsetTableEntry.w LevEvents_WFZ_Routine1 ; 0
  18627. offsetTableEntry.w LevEvents_WFZ_Routine2 ; 2
  18628. offsetTableEntry.w LevEvents_WFZ_Routine3 ; 4
  18629. offsetTableEntry.w LevEvents_WFZ_Routine4 ; 6
  18630. ; ===========================================================================
  18631. ; loc_E86A:
  18632. LevEvents_WFZ_Routine1:
  18633. move.l (Camera_X_pos).w,(Camera_BG_X_pos).w
  18634. move.l (Camera_Y_pos).w,(Camera_BG_Y_pos).w
  18635. moveq #0,d0
  18636. move.w d0,(Camera_BG_X_pos_diff).w
  18637. move.w d0,(Camera_BG_Y_pos_diff).w
  18638. move.w d0,(Camera_BG_X_offset).w
  18639. move.w d0,(Camera_BG_Y_offset).w
  18640. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_WFZ_Routine2
  18641. rts
  18642. ; ===========================================================================
  18643. ; loc_E88E:
  18644. LevEvents_WFZ_Routine2:
  18645. cmpi.w #$2BC0,(Camera_X_pos).w
  18646. blo.s +
  18647. cmpi.w #$580,(Camera_Y_pos).w
  18648. blo.s +
  18649. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_WFZ_Routine3
  18650. move.w #0,(WFZ_BG_Y_Speed).w
  18651. +
  18652. move.w (Camera_X_pos_diff).w,(Camera_BG_X_pos_diff).w
  18653. move.w (Camera_Y_pos_diff).w,(Camera_BG_Y_pos_diff).w
  18654. move.w (Camera_X_pos).w,d0
  18655. move.w (Camera_Y_pos).w,d1
  18656. bra.w ScrollBG
  18657. ; ===========================================================================
  18658. ; loc_E8C0:
  18659. LevEvents_WFZ_Routine3:
  18660. cmpi.w #$800,(Camera_BG_X_offset).w
  18661. beq.s +
  18662. addq.w #2,(Camera_BG_X_offset).w
  18663. +
  18664. cmpi.w #$600,(Camera_BG_X_offset).w
  18665. blt.s LevEvents_WFZ_Routine3_Part2
  18666. move.w (WFZ_BG_Y_Speed).w,d0
  18667. moveq #4,d1
  18668. cmpi.w #$840,d0
  18669. bhs.s +
  18670. add.w d1,d0
  18671. move.w d0,(WFZ_BG_Y_Speed).w
  18672. +
  18673. lsr.w #8,d0
  18674. add.w d0,(Camera_BG_Y_offset).w
  18675. ; loc_E8EC:
  18676. LevEvents_WFZ_Routine3_Part2:
  18677. move.w (Camera_X_pos_diff).w,(Camera_BG_X_pos_diff).w
  18678. move.w (Camera_Y_pos_diff).w,(Camera_BG_Y_pos_diff).w
  18679. move.w (Camera_X_pos).w,d0
  18680. move.w (Camera_Y_pos).w,d1
  18681. bra.w ScrollBG
  18682. ; ===========================================================================
  18683. ; loc_E904:
  18684. LevEvents_WFZ_Routine4:
  18685. cmpi.w #-$2C0,(Camera_BG_X_offset).w
  18686. beq.s ++
  18687. subi_.w #2,(Camera_BG_X_offset).w
  18688. cmpi.w #$1B81,(Camera_BG_Y_offset).w
  18689. beq.s ++
  18690. move.w (WFZ_BG_Y_Speed).w,d0
  18691. beq.s +
  18692. moveq #4,d1
  18693. neg.w d1
  18694. add.w d1,d0
  18695. move.w d0,(WFZ_BG_Y_Speed).w
  18696. lsr.w #8,d0
  18697. +
  18698. addq.w #1,d0
  18699. add.w d0,(Camera_BG_Y_offset).w
  18700. +
  18701. move.w (Camera_X_pos_diff).w,(Camera_BG_X_pos_diff).w
  18702. move.w (Camera_Y_pos_diff).w,(Camera_BG_Y_pos_diff).w
  18703. move.w (Camera_X_pos).w,d0
  18704. move.w (Camera_Y_pos).w,d1
  18705. bra.w ScrollBG
  18706. ; ===========================================================================
  18707. ; loc_E94A:
  18708. LevEvents_WFZ_Routine5:
  18709. cmpi.w #$2880,(Camera_X_pos).w
  18710. blo.s + ; rts
  18711. cmpi.w #$400,(Camera_Y_pos).w
  18712. blo.s + ; rts
  18713. addq.w #2,(WFZ_LevEvent_Subrout).w ; => LevEvents_WFZ_Routine6
  18714. moveq #PLCID_WfzBoss,d0
  18715. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  18716. move.w #$2880,(Camera_Min_X_pos).w
  18717. +
  18718. rts
  18719. ; ===========================================================================
  18720. ; loc_E96C:
  18721. LevEvents_WFZ_Routine6:
  18722. cmpi.w #$500,(Camera_Y_pos).w
  18723. blo.s + ; rts
  18724. addq.w #2,(WFZ_LevEvent_Subrout).w ; => LevEvents_WFZ_RoutineNull
  18725. st (Control_Locked).w
  18726. moveq #PLCID_Tornado,d0
  18727. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  18728. +
  18729. rts
  18730. ; ===========================================================================
  18731. ; return_E984:
  18732. LevEvents_WFZ_RoutineNull:
  18733. rts
  18734.  
  18735. ; ===========================================================================
  18736. ; loc_E986:
  18737. LevEvents_HTZ:
  18738. tst.b (Current_Act).w
  18739. bne.w LevEvents_HTZ2
  18740. moveq #0,d0
  18741. move.b (Dynamic_Resize_Routine).w,d0
  18742. move.w LevEvents_HTZ_Index(pc,d0.w),d0
  18743. jmp LevEvents_HTZ_Index(pc,d0.w)
  18744. ; ===========================================================================
  18745. ; off_E99C:
  18746. LevEvents_HTZ_Index: offsetTable
  18747. offsetTableEntry.w LevEvents_HTZ_Routine1 ; 0 left of earthquake
  18748. offsetTableEntry.w LevEvents_HTZ_Routine2 ; 2 earthquake
  18749. offsetTableEntry.w LevEvents_HTZ_Routine3 ; 4 right of earthquake
  18750. ; ===========================================================================
  18751. ; loc_E9A2:
  18752. LevEvents_HTZ_Routine1:
  18753. cmpi.w #$400,(Camera_Y_pos).w
  18754. blo.s LevEvents_HTZ_Routine1_Part2
  18755. cmpi.w #$1800,(Camera_X_pos).w
  18756. blo.s LevEvents_HTZ_Routine1_Part2
  18757. move.b #1,(Screen_Shaking_Flag_HTZ).w
  18758. move.l (Camera_X_pos).w,(Camera_BG_X_pos).w
  18759. move.l (Camera_Y_pos).w,(Camera_BG_Y_pos).w
  18760. moveq #0,d0
  18761. move.w d0,(Camera_BG_X_pos_diff).w
  18762. move.w d0,(Camera_BG_Y_pos_diff).w
  18763. move.w d0,(Camera_BG_X_offset).w
  18764. move.w #320,(Camera_BG_Y_offset).w
  18765. subi.w #$100,(Camera_BG_Y_pos).w
  18766. move.w #0,(HTZ_Terrain_Delay).w
  18767. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ_Routine2
  18768. -
  18769. rts
  18770. ; ===========================================================================
  18771.  
  18772. LevEvents_HTZ_Routine1_Part2:
  18773. tst.b (Screen_Shaking_Flag_HTZ).w
  18774. beq.s - ; rts
  18775. move.w #$200,d0
  18776. moveq #0,d1
  18777. move.w d1,(Camera_BG_X_pos_diff).w
  18778. move.w d1,(Camera_BG_Y_pos_diff).w
  18779. bsr.w ScrollBG
  18780. or.w d0,d1
  18781. bne.s - ; rts
  18782. move.b #0,(Screen_Shaking_Flag_HTZ).w
  18783. rts
  18784. ; ===========================================================================
  18785. ; loc_EA0E:
  18786. LevEvents_HTZ_Routine2:
  18787. cmpi.w #$1978,(Camera_X_pos).w
  18788. blo.w LevEvents_HTZ_Routine2_Continue
  18789. cmpi.w #$1E00,(Camera_X_pos).w
  18790. blo.s .keep_shaking
  18791. move.b #0,(Screen_Shaking_Flag).w
  18792. bra.s LevEvents_HTZ_Routine2_Continue
  18793. ; ---------------------------------------------------------------------------
  18794. .keep_shaking:
  18795. tst.b (HTZ_Terrain_Direction).w
  18796. bne.s .sinking
  18797. cmpi.w #320,(Camera_BG_Y_offset).w
  18798. beq.s .flip_delay
  18799. move.w (Timer_frames).w,d0
  18800. move.w d0,d1
  18801. andi.w #3,d0
  18802. bne.s LevEvents_HTZ_Routine2_Continue
  18803. addq.w #1,(Camera_BG_Y_offset).w
  18804. andi.w #$3F,d1
  18805. bne.s LevEvents_HTZ_Routine2_Continue
  18806. move.w #SndID_Rumbling2,d0 ; rumbling sound
  18807. jsr (PlaySound).l
  18808. bra.s LevEvents_HTZ_Routine2_Continue
  18809. ; ---------------------------------------------------------------------------
  18810. .sinking:
  18811. cmpi.w #224,(Camera_BG_Y_offset).w
  18812. beq.s .flip_delay
  18813. move.w (Timer_frames).w,d0
  18814. move.w d0,d1
  18815. andi.w #3,d0
  18816. bne.s LevEvents_HTZ_Routine2_Continue
  18817. subq.w #1,(Camera_BG_Y_offset).w
  18818. andi.w #$3F,d1
  18819. bne.s LevEvents_HTZ_Routine2_Continue
  18820. move.w #SndID_Rumbling2,d0
  18821. jsr (PlaySound).l
  18822. bra.s LevEvents_HTZ_Routine2_Continue
  18823. ; ---------------------------------------------------------------------------
  18824. .flip_delay:
  18825. move.b #0,(Screen_Shaking_Flag).w
  18826. subq.w #1,(HTZ_Terrain_Delay).w
  18827. bpl.s LevEvents_HTZ_Routine2_Continue
  18828. move.w #$78,(HTZ_Terrain_Delay).w
  18829. eori.b #1,(HTZ_Terrain_Direction).w
  18830. move.b #1,(Screen_Shaking_Flag).w
  18831.  
  18832. ; loc_EAA0:
  18833. LevEvents_HTZ_Routine2_Continue:
  18834. cmpi.w #$1800,(Camera_X_pos).w
  18835. blo.s .exit_left
  18836. cmpi.w #$1F00,(Camera_X_pos).w
  18837. bhs.s .exit_right
  18838. move.w (Camera_X_pos_diff).w,(Camera_BG_X_pos_diff).w
  18839. move.w (Camera_Y_pos_diff).w,(Camera_BG_Y_pos_diff).w
  18840. move.w (Camera_X_pos).w,d0
  18841. move.w (Camera_Y_pos).w,d1
  18842. bra.w ScrollBG
  18843. ; ---------------------------------------------------------------------------
  18844. .exit_left:
  18845. move.l #$4000000,(Camera_BG_X_pos).w
  18846. moveq #0,d0
  18847. move.l d0,(Camera_BG_Y_pos).w
  18848. move.l d0,(Camera_BG_X_offset).w
  18849. move.b d0,(HTZ_Terrain_Direction).w
  18850. subq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ_Routine1
  18851. move.w #MusID_StopSFX,d0
  18852. jsr (PlaySound).l
  18853. rts
  18854. ; ---------------------------------------------------------------------------
  18855. .exit_right:
  18856. move.l #$4000000,(Camera_BG_X_pos).w
  18857. moveq #0,d0
  18858. move.l d0,(Camera_BG_Y_pos).w
  18859. move.l d0,(Camera_BG_X_offset).w
  18860. move.b d0,(HTZ_Terrain_Direction).w
  18861. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ_Routine3
  18862. move.w #MusID_StopSFX,d0
  18863. jsr (PlaySound).l
  18864. rts
  18865.  
  18866. ; ===========================================================================
  18867. ; loc_EB14:
  18868. LevEvents_HTZ_Routine3:
  18869. cmpi.w #$1F00,(Camera_X_pos).w
  18870. bhs.s LevEvents_HTZ_Routine3_Part2
  18871. move.b #1,(Screen_Shaking_Flag_HTZ).w
  18872. move.l (Camera_X_pos).w,(Camera_BG_X_pos).w
  18873. move.l (Camera_Y_pos).w,(Camera_BG_Y_pos).w
  18874. moveq #0,d0
  18875. move.w d0,(Camera_BG_X_pos_diff).w
  18876. move.w d0,(Camera_BG_Y_pos_diff).w
  18877. move.w d0,(Camera_BG_X_offset).w
  18878. move.w #320,(Camera_BG_Y_offset).w
  18879. subi.w #$100,(Camera_BG_Y_pos).w
  18880. move.w #0,(HTZ_Terrain_Delay).w
  18881. subq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ_Routine2
  18882. -
  18883. rts
  18884. ; ---------------------------------------------------------------------------
  18885. ; loc_EB54:
  18886. LevEvents_HTZ_Routine3_Part2:
  18887. tst.b (Screen_Shaking_Flag_HTZ).w
  18888. beq.s - ; rts
  18889. move.w #$200,d0
  18890. moveq #0,d1
  18891. move.w d1,(Camera_BG_X_pos_diff).w
  18892. move.w d1,(Camera_BG_Y_pos_diff).w
  18893. bsr.w ScrollBG
  18894. or.w d0,d1
  18895. bne.s - ; rts
  18896. move.b #0,(Screen_Shaking_Flag_HTZ).w
  18897. rts
  18898.  
  18899. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  18900.  
  18901. ; Computes how much the background layer has been scrolled in X and Y and
  18902. ; stores result to Camera_BG_X_pos_diff and Camera_BG_Y_pos_diff.
  18903. ; Caps maximum scroll speed to 16 pixels per frame in either direction.
  18904. ; This is used to decide how much of the BG needs to be reloaded.
  18905. ;
  18906. ; Used for rising lava/terrain in HTZ, and for WFZ->DEZ transition in WFZ.
  18907. ;
  18908. ; Input:
  18909. ; d0 Target X position of background
  18910. ; d1 Target Y position of background
  18911. ;sub_EB78
  18912. ScrollBG:
  18913. sub.w (Camera_BG_X_pos).w,d0
  18914. sub.w (Camera_BG_X_offset).w,d0
  18915. bpl.s .going_right
  18916. cmpi.w #-16,d0
  18917. bgt.s .skip_x_cap
  18918. move.w #-16,d0
  18919.  
  18920. .skip_x_cap:
  18921. bra.s .move_x
  18922. ; ===========================================================================
  18923. .going_right:
  18924. cmpi.w #16,d0
  18925. blo.s .move_x
  18926. move.w #16,d0
  18927.  
  18928. .move_x:
  18929. move.b d0,(Camera_BG_X_pos_diff).w
  18930. sub.w (Camera_BG_Y_pos).w,d1
  18931. sub.w (Camera_BG_Y_offset).w,d1
  18932. bpl.s .going_down
  18933. cmpi.w #-16,d1
  18934. bgt.s .skip_y_cap
  18935. move.w #-16,d1
  18936.  
  18937. .skip_y_cap:
  18938. bra.s .move_y
  18939. ; ===========================================================================
  18940. .going_down:
  18941. cmpi.w #16,d1
  18942. blo.s .move_y
  18943. move.w #16,d1
  18944.  
  18945. .move_y:
  18946. move.b d1,(Camera_BG_Y_pos_diff).w
  18947. rts
  18948. ; End of function ScrollBG
  18949.  
  18950. ; ===========================================================================
  18951. ; unused/dead code
  18952. ; This code is probably meant for testing the background scrolling code
  18953. ; used by HTZ and WFZ. It would allows the BG position to be shifted up
  18954. ; and down by the second controller.
  18955. btst #button_up,(Ctrl_2_Held).w
  18956. beq.s +
  18957. tst.w (Camera_BG_Y_offset).w
  18958. beq.s +
  18959. subq.w #1,(Camera_BG_Y_offset).w
  18960. +
  18961. btst #button_down,(Ctrl_2_Held).w
  18962. beq.s +
  18963. cmpi.w #$700,(Camera_BG_Y_offset).w
  18964. beq.s +
  18965. addq.w #1,(Camera_BG_Y_offset).w
  18966. +
  18967. rts
  18968. ; ===========================================================================
  18969.  
  18970. ; sub_EBEA:
  18971. LevEvents_HTZ2:
  18972. bsr.w LevEvents_HTZ2_Prepare
  18973. moveq #0,d0
  18974. move.b (Dynamic_Resize_Routine).w,d0
  18975. move.w LevEvents_HTZ2_Index(pc,d0.w),d0
  18976. jmp LevEvents_HTZ2_Index(pc,d0.w)
  18977. ; ===========================================================================
  18978. ; off_EBFC:
  18979. LevEvents_HTZ2_Index: offsetTable
  18980. offsetTableEntry.w LevEvents_HTZ2_Routine1 ; 0 earthquake left
  18981. offsetTableEntry.w LevEvents_HTZ2_Routine2 ; 2 earthquake (top)
  18982. offsetTableEntry.w LevEvents_HTZ2_Routine3 ; 4 earthquake right (top)
  18983. offsetTableEntry.w LevEvents_HTZ2_Routine4 ; 6 earthquake (bottom)
  18984. offsetTableEntry.w LevEvents_HTZ2_Routine5 ; 8 earthquake right (bottom)
  18985. offsetTableEntry.w LevEvents_HTZ2_Routine6 ; $A boss area cutoff
  18986. offsetTableEntry.w LevEvents_HTZ2_Routine7 ; $C boss area camera shift
  18987. offsetTableEntry.w LevEvents_HTZ2_Routine8 ; $E boss begin
  18988. offsetTableEntry.w LevEvents_HTZ2_Routine9 ; $10 boss end / extend camera
  18989. ; ===========================================================================
  18990. ; loc_EC0E:
  18991. LevEvents_HTZ2_Routine1:
  18992. cmpi.w #$14C0,(Camera_X_pos).w
  18993. blo.s LevEvents_HTZ2_Routine1_Part2
  18994. move.b #1,(Screen_Shaking_Flag_HTZ).w
  18995. move.l (Camera_X_pos).w,(Camera_BG_X_pos).w
  18996. move.l (Camera_Y_pos).w,(Camera_BG_Y_pos).w
  18997. moveq #0,d0
  18998. move.w d0,(Camera_BG_X_pos_diff).w
  18999. move.w d0,(Camera_BG_Y_pos_diff).w
  19000. move.w d0,(Camera_BG_X_offset).w
  19001. move.w #$2C0,(Camera_BG_Y_offset).w
  19002. subi.w #$100,(Camera_BG_Y_pos).w
  19003. move.w #0,(HTZ_Terrain_Delay).w
  19004. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine2
  19005. cmpi.w #$380,(Camera_Y_pos).w
  19006. blo.s + ; rts
  19007. move.w #-$680,(Camera_BG_X_offset).w
  19008. addi.w #$480,(Camera_BG_X_pos).w
  19009. move.w #$300,(Camera_BG_Y_offset).w
  19010. addq.b #6,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine5
  19011. /
  19012. rts
  19013. ; ---------------------------------------------------------------------------
  19014.  
  19015. LevEvents_HTZ2_Routine1_Part2:
  19016. tst.b (Screen_Shaking_Flag_HTZ).w
  19017. beq.s - ; rts
  19018. move.w #$200,d0
  19019. moveq #0,d1
  19020. move.w d1,(Camera_BG_X_pos_diff).w
  19021. move.w d1,(Camera_BG_Y_pos_diff).w
  19022. bsr.w ScrollBG
  19023. or.w d0,d1
  19024. bne.s - ; rts
  19025. move.b #0,(Screen_Shaking_Flag_HTZ).w
  19026. rts
  19027.  
  19028. ; ===========================================================================
  19029. ; loc_EC90:
  19030. LevEvents_HTZ2_Routine2:
  19031. cmpi.w #$1678,(Camera_X_pos).w
  19032. blo.w LevEvents_HTZ2_Routine2_Continue
  19033. cmpi.w #$1A00,(Camera_X_pos).w
  19034. blo.s .keep_shaking
  19035. move.b #0,(Screen_Shaking_Flag).w
  19036. bra.s LevEvents_HTZ2_Routine2_Continue
  19037. ; ---------------------------------------------------------------------------
  19038. .keep_shaking:
  19039. tst.b (HTZ_Terrain_Direction).w
  19040. bne.s .sinking
  19041. cmpi.w #$2C0,(Camera_BG_Y_offset).w
  19042. beq.s .flip_delay
  19043. move.w (Timer_frames).w,d0
  19044. move.w d0,d1
  19045. andi.w #3,d0
  19046. bne.s LevEvents_HTZ2_Routine2_Continue
  19047. addq.w #1,(Camera_BG_Y_offset).w
  19048. andi.w #$3F,d1
  19049. bne.s LevEvents_HTZ2_Routine2_Continue
  19050. move.w #SndID_Rumbling2,d0
  19051. jsr (PlaySound).l
  19052. bra.s LevEvents_HTZ2_Routine2_Continue
  19053. ; ---------------------------------------------------------------------------
  19054. .sinking:
  19055. cmpi.w #0,(Camera_BG_Y_offset).w
  19056. beq.s .flip_delay
  19057. move.w (Timer_frames).w,d0
  19058. move.w d0,d1
  19059. andi.w #3,d0
  19060. bne.s LevEvents_HTZ2_Routine2_Continue
  19061. subq.w #1,(Camera_BG_Y_offset).w
  19062. andi.w #$3F,d1
  19063. bne.s LevEvents_HTZ2_Routine2_Continue
  19064. move.w #SndID_Rumbling2,d0
  19065. jsr (PlaySound).l
  19066. bra.s LevEvents_HTZ2_Routine2_Continue
  19067. ; ---------------------------------------------------------------------------
  19068. .flip_delay:
  19069. move.b #0,(Screen_Shaking_Flag).w
  19070. subq.w #1,(HTZ_Terrain_Delay).w
  19071. bpl.s LevEvents_HTZ2_Routine2_Continue
  19072. move.w #$78,(HTZ_Terrain_Delay).w
  19073. eori.b #1,(HTZ_Terrain_Direction).w
  19074. move.b #1,(Screen_Shaking_Flag).w
  19075.  
  19076. ; loc_ED22:
  19077. LevEvents_HTZ2_Routine2_Continue:
  19078. cmpi.w #$14C0,(Camera_X_pos).w
  19079. blo.s .exit_left
  19080. cmpi.w #$1B00,(Camera_X_pos).w
  19081. bhs.s .exit_right
  19082. move.w (Camera_X_pos_diff).w,(Camera_BG_X_pos_diff).w
  19083. move.w (Camera_Y_pos_diff).w,(Camera_BG_Y_pos_diff).w
  19084. move.w (Camera_X_pos).w,d0
  19085. move.w (Camera_Y_pos).w,d1
  19086. bra.w ScrollBG
  19087. ; ---------------------------------------------------------------------------
  19088. .exit_left:
  19089. move.l #$4000000,(Camera_BG_X_pos).w
  19090. moveq #0,d0
  19091. move.l d0,(Camera_BG_Y_pos).w
  19092. move.l d0,(Camera_BG_X_offset).w
  19093. move.b d0,(HTZ_Terrain_Direction).w
  19094. subq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine1
  19095. move.w #MusID_StopSFX,d0
  19096. jsr (PlaySound).l
  19097. rts
  19098. ; ---------------------------------------------------------------------------
  19099. .exit_right:
  19100. move.l #$4000000,(Camera_BG_X_pos).w
  19101. moveq #0,d0
  19102. move.l d0,(Camera_BG_Y_pos).w
  19103. move.l d0,(Camera_BG_X_offset).w
  19104. move.b d0,(HTZ_Terrain_Direction).w
  19105. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine3
  19106. move.w #MusID_StopSFX,d0
  19107. jsr (PlaySound).l
  19108. rts
  19109. ; ===========================================================================
  19110. ; loc_ED96:
  19111. LevEvents_HTZ2_Routine3:
  19112. cmpi.w #$1B00,(Camera_X_pos).w
  19113. bhs.s LevEvents_HTZ2_Routine3_Part2
  19114. move.b #1,(Screen_Shaking_Flag_HTZ).w
  19115. move.l (Camera_X_pos).w,(Camera_BG_X_pos).w
  19116. move.l (Camera_Y_pos).w,(Camera_BG_Y_pos).w
  19117. moveq #0,d0
  19118. move.w d0,(Camera_BG_X_pos_diff).w
  19119. move.w d0,(Camera_BG_Y_pos_diff).w
  19120. move.w d0,(Camera_BG_X_offset).w
  19121. move.w #$2C0,(Camera_BG_Y_offset).w
  19122. subi.w #$100,(Camera_BG_Y_pos).w
  19123. move.w #0,(HTZ_Terrain_Delay).w
  19124. subq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine2
  19125. -
  19126. rts
  19127. ; ===========================================================================
  19128.  
  19129. LevEvents_HTZ2_Routine3_Part2:
  19130. tst.b (Screen_Shaking_Flag_HTZ).w
  19131. beq.s - ; rts
  19132. move.w #$200,d0
  19133. moveq #0,d1
  19134. move.w d1,(Camera_BG_X_pos_diff).w
  19135. move.w d1,(Camera_BG_Y_pos_diff).w
  19136. bsr.w ScrollBG
  19137. or.w d0,d1
  19138. bne.s - ; rts
  19139. move.b #0,(Screen_Shaking_Flag_HTZ).w
  19140. rts
  19141. ; ===========================================================================
  19142. ; loc_EDFA:
  19143. LevEvents_HTZ2_Routine4:
  19144. cmpi.w #$15F0,(Camera_X_pos).w
  19145. blo.w LevEvents_HTZ2_Routine4_Continue
  19146. cmpi.w #$1AC0,(Camera_X_pos).w
  19147. bhs.s LevEvents_HTZ2_Routine4_Continue
  19148. tst.b (HTZ_Terrain_Direction).w
  19149. bne.s .sinking
  19150. cmpi.w #$300,(Camera_BG_Y_offset).w
  19151. beq.s .flip_delay
  19152. move.w (Timer_frames).w,d0
  19153. move.w d0,d1
  19154. andi.w #3,d0
  19155. bne.s LevEvents_HTZ2_Routine4_Continue
  19156. addq.w #1,(Camera_BG_Y_offset).w
  19157. andi.w #$3F,d1
  19158. bne.s LevEvents_HTZ2_Routine4_Continue
  19159. move.w #SndID_Rumbling2,d0
  19160. jsr (PlaySound).l
  19161. bra.s LevEvents_HTZ2_Routine4_Continue
  19162. ; ===========================================================================
  19163. .sinking:
  19164. cmpi.w #0,(Camera_BG_Y_offset).w
  19165. beq.s .flip_delay
  19166. move.w (Timer_frames).w,d0
  19167. move.w d0,d1
  19168. andi.w #3,d0
  19169. bne.s LevEvents_HTZ2_Routine4_Continue
  19170. subq.w #1,(Camera_BG_Y_offset).w
  19171. andi.w #$3F,d1
  19172. bne.s LevEvents_HTZ2_Routine4_Continue
  19173. move.w #SndID_Rumbling2,d0
  19174. jsr (PlaySound).l
  19175. bra.s LevEvents_HTZ2_Routine4_Continue
  19176. ; ===========================================================================
  19177. .flip_delay:
  19178. move.b #0,(Screen_Shaking_Flag).w
  19179. subq.w #1,(HTZ_Terrain_Delay).w
  19180. bpl.s LevEvents_HTZ2_Routine4_Continue
  19181. move.w #$78,(HTZ_Terrain_Delay).w
  19182. eori.b #1,(HTZ_Terrain_Direction).w
  19183. move.b #1,(Screen_Shaking_Flag).w
  19184.  
  19185. LevEvents_HTZ2_Routine4_Continue:
  19186. cmpi.w #$14C0,(Camera_X_pos).w
  19187. blo.s .exit_left
  19188. cmpi.w #$1B00,(Camera_X_pos).w
  19189. bhs.s .exit_right
  19190. move.w (Camera_X_pos_diff).w,(Camera_BG_X_pos_diff).w
  19191. move.w (Camera_Y_pos_diff).w,(Camera_BG_Y_pos_diff).w
  19192. move.w (Camera_X_pos).w,d0
  19193. move.w (Camera_Y_pos).w,d1
  19194. bra.w ScrollBG
  19195. ; ===========================================================================
  19196. .exit_left:
  19197. move.l #$4000000,(Camera_BG_X_pos).w
  19198. moveq #0,d0
  19199. move.l d0,(Camera_BG_Y_pos).w
  19200. move.l d0,(Camera_BG_X_offset).w
  19201. move.b d0,(HTZ_Terrain_Direction).w
  19202. subq.b #6,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine1
  19203. move.w #MusID_StopSFX,d0
  19204. jsr (PlaySound).l
  19205. rts
  19206. ; ===========================================================================
  19207. .exit_right:
  19208. move.l #$4000000,(Camera_BG_X_pos).w
  19209. moveq #0,d0
  19210. move.l d0,(Camera_BG_Y_pos).w
  19211. move.l d0,(Camera_BG_X_offset).w
  19212. move.b d0,(HTZ_Terrain_Direction).w
  19213. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine5
  19214. move.w #MusID_StopSFX,d0
  19215. jsr (PlaySound).l
  19216. rts
  19217. ; ===========================================================================
  19218. ; loc_EEF8:
  19219. LevEvents_HTZ2_Routine5:
  19220. cmpi.w #$1B00,(Camera_X_pos).w
  19221. bhs.s LevEvents_HTZ2_Routine5_Part2
  19222. move.b #1,(Screen_Shaking_Flag_HTZ).w
  19223. move.l (Camera_X_pos).w,(Camera_BG_X_pos).w
  19224. move.l (Camera_Y_pos).w,(Camera_BG_Y_pos).w
  19225. moveq #0,d0
  19226. move.w d0,(Camera_BG_X_pos_diff).w
  19227. move.w d0,(Camera_BG_Y_pos_diff).w
  19228. move.w #-$680,(Camera_BG_X_offset).w
  19229. addi.w #$480,(Camera_BG_X_pos).w
  19230. move.w #$300,(Camera_BG_Y_offset).w
  19231. subi.w #$100,(Camera_BG_Y_pos).w
  19232. move.w #0,(HTZ_Terrain_Delay).w
  19233. subq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine4
  19234. -
  19235. rts
  19236. ; ===========================================================================
  19237.  
  19238. LevEvents_HTZ2_Routine5_Part2:
  19239. tst.b (Screen_Shaking_Flag_HTZ).w
  19240. beq.s - ; rts
  19241. move.w #$200,d0
  19242. moveq #0,d1
  19243. move.w d1,(Camera_BG_X_pos_diff).w
  19244. move.w d1,(Camera_BG_Y_pos_diff).w
  19245. bsr.w ScrollBG
  19246. or.w d0,d1
  19247. bne.s - ; rts
  19248. move.b #0,(Screen_Shaking_Flag_HTZ).w
  19249. rts
  19250. ; ===========================================================================
  19251. rts
  19252.  
  19253. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  19254.  
  19255. ; sub_EF66:
  19256. LevEvents_HTZ2_Prepare:
  19257. cmpi.w #$2B00,(Camera_X_pos).w
  19258. blo.s + ; rts
  19259. cmpi.b #$A,(Dynamic_Resize_Routine).w
  19260. bge.s + ; rts
  19261. move.b #$A,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine6
  19262. move.b #0,(Screen_Shaking_Flag_HTZ).w
  19263. +
  19264. rts
  19265. ; End of function LevEvents_HTZ2_Prepare
  19266.  
  19267. ; ===========================================================================
  19268. ; loc_EF84:
  19269. LevEvents_HTZ2_Routine6:
  19270. cmpi.w #$2C50,(Camera_X_pos).w
  19271. blo.s + ; rts
  19272. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19273. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19274. move.w #$480,(Camera_Max_Y_pos).w
  19275. move.w #$480,(Tails_Max_Y_pos).w
  19276. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine7
  19277. +
  19278. rts
  19279. ; ===========================================================================
  19280. ; loc_EFAA:
  19281. LevEvents_HTZ2_Routine7:
  19282. cmpi.w #$2EDF,(Camera_X_pos).w
  19283. blo.s + ; rts
  19284. move.w #$2EE0,(Camera_Min_X_pos).w
  19285. move.w #$2F5E,(Camera_Max_X_pos).w
  19286. move.w #$2EE0,(Tails_Min_X_pos).w
  19287. move.w #$2F5E,(Tails_Max_X_pos).w
  19288. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine8
  19289. move.w #MusID_FadeOut,d0
  19290. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19291. clr.b (ScreenShift).w
  19292. move.b #3,(Current_Boss_ID).w
  19293. moveq #PLCID_HtzBoss,d0
  19294. jmpto (LoadPLC).l, JmpTo2_LoadPLC
  19295. ; ===========================================================================
  19296. +
  19297. rts
  19298. ; ===========================================================================
  19299. ; loc_EFE8:
  19300. LevEvents_HTZ2_Routine8:
  19301. cmpi.w #$478,(Camera_Y_pos).w
  19302. blo.s +
  19303. move.w #$478,(Camera_Min_Y_pos).w
  19304. move.w #$478,(Tails_Min_Y_pos).w
  19305. +
  19306. addq.b #1,(ScreenShift).w
  19307. cmpi.b #$5A,(ScreenShift).w
  19308. blo.s ++ ; rts
  19309. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  19310. bne.s +
  19311. move.b #ObjID_HTZBoss,id(a1) ; load obj52 (HTZ boss)
  19312. +
  19313. addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_HTZ2_Routine9
  19314. move.w #MusID_Boss,d0
  19315. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19316. +
  19317. rts
  19318. ; ===========================================================================
  19319. ; loc_F020:
  19320. LevEvents_HTZ2_Routine9:
  19321. tst.b (Boss_defeated_flag).w
  19322. beq.s ++ ; rts
  19323. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19324. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  19325. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19326. cmpi.w #$30E0,(Camera_X_pos).w
  19327. blo.s ++ ; rts
  19328. cmpi.w #$428,(Camera_Min_Y_pos).w
  19329. blo.s +
  19330. subq.w #2,(Camera_Min_Y_pos).w
  19331. +
  19332. cmpi.w #$430,(Camera_Max_Y_pos).w
  19333. blo.s +
  19334. subq.w #2,(Camera_Max_Y_pos).w
  19335. +
  19336. rts
  19337.  
  19338. ; ===========================================================================
  19339. ; return_F05A:
  19340. LevEvents_HPZ:
  19341. rts
  19342.  
  19343. ; ===========================================================================
  19344. ; return_F05C:
  19345. LevEvents_009:
  19346. rts
  19347.  
  19348. ; ===========================================================================
  19349. ; loc_F05E:
  19350. LevEvents_OOZ:
  19351. tst.b (Current_Act).w
  19352. bne.s LevEvents_OOZ2
  19353. rts
  19354. ; ---------------------------------------------------------------------------
  19355. ; loc_F066:
  19356. LevEvents_OOZ2:
  19357. moveq #0,d0
  19358. move.b (Dynamic_Resize_Routine).w,d0
  19359. move.w LevEvents_OOZ2_Index(pc,d0.w),d0
  19360. jmp LevEvents_OOZ2_Index(pc,d0.w)
  19361. ; ===========================================================================
  19362. ; off_F074:
  19363. LevEvents_OOZ2_Index: offsetTable
  19364. offsetTableEntry.w LevEvents_OOZ2_Routine1 ; 0
  19365. offsetTableEntry.w LevEvents_OOZ2_Routine2 ; 2
  19366. offsetTableEntry.w LevEvents_OOZ2_Routine3 ; 4
  19367. offsetTableEntry.w LevEvents_OOZ2_Routine4 ; 6
  19368. ; ===========================================================================
  19369. ; loc_F07C:
  19370. LevEvents_OOZ2_Routine1:
  19371. cmpi.w #$2668,(Camera_X_pos).w
  19372. blo.s + ; rts
  19373. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19374. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19375. move.w #$2D8,(Oil+y_pos).w
  19376. move.w #$1E0,(Camera_Max_Y_pos).w
  19377. move.w #$1E0,(Tails_Max_Y_pos).w
  19378. addq.b #2,(Dynamic_Resize_Routine).w
  19379. +
  19380. rts
  19381. ; ===========================================================================
  19382. ; loc_F0A8:
  19383. LevEvents_OOZ2_Routine2:
  19384. cmpi.w #$2880,(Camera_X_pos).w
  19385. blo.s + ; rts
  19386. move.w #$2880,(Camera_Min_X_pos).w
  19387. move.w #$28C0,(Camera_Max_X_pos).w
  19388. move.w #$2880,(Tails_Min_X_pos).w
  19389. move.w #$28C0,(Tails_Max_X_pos).w
  19390. addq.b #2,(Dynamic_Resize_Routine).w
  19391. move.w #MusID_FadeOut,d0
  19392. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19393. clr.b (ScreenShift).w
  19394. move.b #8,(Current_Boss_ID).w
  19395. moveq #PLCID_OozBoss,d0
  19396. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  19397. moveq #PalID_OOZ_B,d0
  19398. jsrto (PalLoad_Now).l, JmpTo2_PalLoad_Now
  19399. +
  19400. rts
  19401. ; ===========================================================================
  19402. ; loc_F0EC:
  19403. LevEvents_OOZ2_Routine3:
  19404. cmpi.w #$1D8,(Camera_Y_pos).w
  19405. blo.s +
  19406. move.w #$1D8,(Camera_Min_Y_pos).w
  19407. move.w #$1D8,(Tails_Min_Y_pos).w
  19408. +
  19409. addq.b #1,(ScreenShift).w
  19410. cmpi.b #$5A,(ScreenShift).w
  19411. blo.s ++ ; rts
  19412. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  19413. bne.s +
  19414. move.b #ObjID_OOZBoss,id(a1) ; load obj55 (OOZ boss)
  19415. +
  19416. addq.b #2,(Dynamic_Resize_Routine).w
  19417. move.w #MusID_Boss,d0
  19418. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19419. +
  19420. rts
  19421. ; ===========================================================================
  19422. ; loc_F124:
  19423. LevEvents_OOZ2_Routine4:
  19424. tst.b (Boss_defeated_flag).w
  19425. beq.s + ; rts
  19426. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19427. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  19428. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19429. +
  19430. rts
  19431. ; ===========================================================================
  19432. ; loc_F13E:
  19433. LevEvents_MCZ:
  19434. tst.b (Current_Act).w
  19435. bne.s LevEvents_MCZ2
  19436. rts
  19437. ; ---------------------------------------------------------------------------
  19438. ; loc_F146:
  19439. LevEvents_MCZ2:
  19440. moveq #0,d0
  19441. move.b (Dynamic_Resize_Routine).w,d0
  19442. move.w LevEvents_MCZ2_Index(pc,d0.w),d0
  19443. jmp LevEvents_MCZ2_Index(pc,d0.w)
  19444. ; ===========================================================================
  19445. ; off_F154:
  19446. LevEvents_MCZ2_Index: offsetTable
  19447. offsetTableEntry.w LevEvents_MCZ2_Routine1 ; 0
  19448. offsetTableEntry.w LevEvents_MCZ2_Routine2 ; 2
  19449. offsetTableEntry.w LevEvents_MCZ2_Routine3 ; 4
  19450. offsetTableEntry.w LevEvents_MCZ2_Routine4 ; 6
  19451. ; ===========================================================================
  19452. ; loc_F15C:
  19453. LevEvents_MCZ2_Routine1:
  19454. tst.w (Two_player_mode).w
  19455. bne.s ++
  19456. cmpi.w #$2080,(Camera_X_pos).w
  19457. blo.s + ; rts
  19458. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19459. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19460. move.w #$5D0,(Camera_Max_Y_pos).w
  19461. move.w #$5D0,(Tails_Max_Y_pos).w
  19462. addq.b #2,(Dynamic_Resize_Routine).w
  19463. +
  19464. rts
  19465. ; ---------------------------------------------------------------------------
  19466. +
  19467. move.w #$2100,(Camera_Max_X_pos).w
  19468. move.w #$2100,(Tails_Max_X_pos).w
  19469. rts
  19470. ; ===========================================================================
  19471. ; loc_F196:
  19472. LevEvents_MCZ2_Routine2:
  19473. cmpi.w #$20F0,(Camera_X_pos).w
  19474. blo.s + ; rts
  19475. move.w #$20F0,(Camera_Max_X_pos).w
  19476. move.w #$20F0,(Camera_Min_X_pos).w
  19477. move.w #$20F0,(Tails_Max_X_pos).w
  19478. move.w #$20F0,(Tails_Min_X_pos).w
  19479. addq.b #2,(Dynamic_Resize_Routine).w
  19480. move.w #MusID_FadeOut,d0
  19481. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19482. clr.b (ScreenShift).w
  19483. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtUnc_FallingRocks),VRAM,WRITE),(VDP_control_port).l
  19484. lea (VDP_data_port).l,a6
  19485. lea (ArtUnc_FallingRocks).l,a2
  19486.  
  19487. moveq #7,d0
  19488. - rept 8
  19489. move.l (a2)+,(a6)
  19490. endm
  19491. dbf d0,-
  19492.  
  19493. move.b #5,(Current_Boss_ID).w
  19494. moveq #PLCID_MczBoss,d0
  19495. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  19496. moveq #PalID_MCZ_B,d0
  19497. jsrto (PalLoad_Now).l, JmpTo2_PalLoad_Now
  19498. +
  19499. rts
  19500. ; ===========================================================================
  19501. ; loc_F206:
  19502. LevEvents_MCZ2_Routine3:
  19503. cmpi.w #$5C8,(Camera_Y_pos).w
  19504. blo.s +
  19505. move.w #$5C8,(Camera_Min_Y_pos).w
  19506. move.w #$5C8,(Tails_Min_Y_pos).w
  19507. +
  19508. addq.b #1,(ScreenShift).w
  19509. cmpi.b #$5A,(ScreenShift).w
  19510. blo.s ++ ; rts
  19511. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  19512. bne.s +
  19513. move.b #ObjID_MCZBoss,id(a1) ; load obj57 (MCZ boss)
  19514. +
  19515. addq.b #2,(Dynamic_Resize_Routine).w
  19516. move.w #MusID_Boss,d0
  19517. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19518. +
  19519. rts
  19520. ; ===========================================================================
  19521. ; loc_F23E:
  19522. LevEvents_MCZ2_Routine4:
  19523. tst.b (Screen_Shaking_Flag).w
  19524. beq.s +
  19525. move.w (Timer_frames).w,d0
  19526. andi.w #$1F,d0
  19527. bne.s +
  19528. move.w #SndID_Rumbling2,d0
  19529. jsrto (PlaySound).l, JmpTo3_PlaySound
  19530. +
  19531. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19532. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  19533. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19534. rts
  19535.  
  19536. ; ===========================================================================
  19537. ; loc_F26A:
  19538. LevEvents_CNZ:
  19539. jsr (SlotMachine).l
  19540. tst.b (Current_Act).w
  19541. bne.s LevEvents_CNZ2
  19542. rts ; no events for act 1
  19543. ; ===========================================================================
  19544. ; loc_F278:
  19545. LevEvents_CNZ2:
  19546. moveq #0,d0
  19547. move.b (Dynamic_Resize_Routine).w,d0
  19548. move.w LevEvents_CNZ2_Index(pc,d0.w),d0
  19549. jmp LevEvents_CNZ2_Index(pc,d0.w)
  19550. ; ===========================================================================
  19551. ; off_F286:
  19552. LevEvents_CNZ2_Index: offsetTable
  19553. offsetTableEntry.w LevEvents_CNZ2_Routine1 ; 0
  19554. offsetTableEntry.w LevEvents_CNZ2_Routine2 ; 2
  19555. offsetTableEntry.w LevEvents_CNZ2_Routine3 ; 4
  19556. offsetTableEntry.w LevEvents_CNZ2_Routine4 ; 6
  19557. ; ===========================================================================
  19558. ; loc_F28E:
  19559. LevEvents_CNZ2_Routine1:
  19560. tst.w (Two_player_mode).w
  19561. bne.s ++
  19562. cmpi.w #$27C0,(Camera_X_pos).w
  19563. blo.s + ; rts
  19564. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19565. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19566. move.w #$62E,(Camera_Max_Y_pos).w
  19567. move.w #$62E,(Tails_Max_Y_pos).w
  19568. move.b #$F9,(Level_Layout+$C54).w
  19569. addq.b #2,(Dynamic_Resize_Routine).w
  19570. +
  19571. rts
  19572. ; ===========================================================================
  19573. +
  19574. move.w #$26A0,(Camera_Max_X_pos).w
  19575. move.w #$26A0,(Tails_Max_X_pos).w
  19576. rts
  19577. ; ===========================================================================
  19578. ; loc_F2CE:
  19579. LevEvents_CNZ2_Routine2:
  19580. cmpi.w #$2890,(Camera_X_pos).w
  19581. blo.s + ; rts
  19582. move.b #$F9,(Level_Layout+$C50).w
  19583. move.w #$2860,(Camera_Min_X_pos).w
  19584. move.w #$28E0,(Camera_Max_X_pos).w
  19585. move.w #$2860,(Tails_Min_X_pos).w
  19586. move.w #$28E0,(Tails_Max_X_pos).w
  19587. addq.b #2,(Dynamic_Resize_Routine).w
  19588. move.w #MusID_FadeOut,d0
  19589. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19590. clr.b (ScreenShift).w
  19591. move.b #6,(Current_Boss_ID).w
  19592. moveq #PLCID_CnzBoss,d0
  19593. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  19594. moveq #PalID_CNZ_B,d0
  19595. jsrto (PalLoad_Now).l, JmpTo2_PalLoad_Now
  19596. +
  19597. rts
  19598. ; ===========================================================================
  19599. ; loc_F318:
  19600. LevEvents_CNZ2_Routine3:
  19601. cmpi.w #$4E0,(Camera_Y_pos).w
  19602. blo.s +
  19603. move.w #$4E0,(Camera_Min_Y_pos).w
  19604. move.w #$4E0,(Tails_Min_Y_pos).w
  19605. +
  19606. addq.b #1,(ScreenShift).w
  19607. cmpi.b #$5A,(ScreenShift).w
  19608. blo.s ++ ; rts
  19609. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  19610. bne.s +
  19611. move.b #ObjID_CNZBoss,id(a1) ; load obj51
  19612. +
  19613. addq.b #2,(Dynamic_Resize_Routine).w
  19614. move.w #MusID_Boss,d0
  19615. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19616. +
  19617. rts
  19618. ; ===========================================================================
  19619. ; loc_F350:
  19620. LevEvents_CNZ2_Routine4:
  19621. cmpi.w #$2A00,(Camera_X_pos).w
  19622. blo.s + ; rts
  19623. move.w #$5D0,(Camera_Max_Y_pos).w
  19624. move.w #$5D0,(Tails_Max_Y_pos).w
  19625. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19626. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  19627. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19628. +
  19629. rts
  19630. ; ===========================================================================
  19631. ; loc_F378:
  19632. LevEvents_CPZ:
  19633. tst.b (Current_Act).w
  19634. bne.s LevEvents_CPZ2
  19635. rts
  19636. ; ===========================================================================
  19637. ; loc_F380:
  19638. LevEvents_CPZ2:
  19639. moveq #0,d0
  19640. move.b (Dynamic_Resize_Routine).w,d0
  19641. move.w LevEvents_CPZ2_Index(pc,d0.w),d0
  19642. jmp LevEvents_CPZ2_Index(pc,d0.w)
  19643. ; ===========================================================================
  19644. ; off_F38E:
  19645. LevEvents_CPZ2_Index: offsetTable
  19646. offsetTableEntry.w LevEvents_CPZ2_Routine1 ; 0
  19647. offsetTableEntry.w LevEvents_CPZ2_Routine2 ; 2
  19648. offsetTableEntry.w LevEvents_CPZ2_Routine3 ; 4
  19649. offsetTableEntry.w LevEvents_CPZ2_Routine4 ; 6
  19650. ; ===========================================================================
  19651. ; loc_F396:
  19652. LevEvents_CPZ2_Routine1:
  19653. cmpi.w #$2680,(Camera_X_pos).w
  19654. blo.s + ; rts
  19655. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19656. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19657. move.w #$450,(Camera_Max_Y_pos).w
  19658. move.w #$450,(Tails_Max_Y_pos).w
  19659. addq.b #2,(Dynamic_Resize_Routine).w
  19660. +
  19661. rts
  19662. ; ===========================================================================
  19663. ; loc_F3BC:
  19664. LevEvents_CPZ2_Routine2:
  19665. cmpi.w #$2A20,(Camera_X_pos).w
  19666. blo.s + ; rts
  19667. move.w #$2A20,(Camera_Min_X_pos).w
  19668. move.w #$2A20,(Camera_Max_X_pos).w
  19669. move.w #$2A20,(Tails_Min_X_pos).w
  19670. move.w #$2A20,(Tails_Max_X_pos).w
  19671. addq.b #2,(Dynamic_Resize_Routine).w
  19672. move.w #MusID_FadeOut,d0
  19673. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19674. clr.b (ScreenShift).w
  19675. move.b #1,(Current_Boss_ID).w
  19676. moveq #PLCID_CpzBoss,d0
  19677. jmpto (LoadPLC).l, JmpTo2_LoadPLC
  19678. ; ===========================================================================
  19679. +
  19680. rts
  19681. ; ===========================================================================
  19682. ; loc_F3FA:
  19683. LevEvents_CPZ2_Routine3:
  19684. cmpi.w #$448,(Camera_Y_pos).w
  19685. blo.s +
  19686. move.w #$448,(Camera_Min_Y_pos).w
  19687. move.w #$448,(Tails_Min_Y_pos).w
  19688. +
  19689. addq.b #1,(ScreenShift).w
  19690. cmpi.b #$5A,(ScreenShift).w
  19691. blo.s ++
  19692. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  19693. bne.s +
  19694. move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  19695. +
  19696. addq.b #2,(Dynamic_Resize_Routine).w
  19697. move.w #MusID_Boss,d0
  19698. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19699. +
  19700. rts
  19701. ; ===========================================================================
  19702. ; loc_F432:
  19703. LevEvents_CPZ2_Routine4:
  19704. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19705. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  19706. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19707. rts
  19708. ; ===========================================================================
  19709. ; loc_F446:
  19710. LevEvents_DEZ:
  19711. moveq #0,d0
  19712. move.b (Dynamic_Resize_Routine).w,d0
  19713. move.w LevEvents_DEZ_Index(pc,d0.w),d0
  19714. jmp LevEvents_DEZ_Index(pc,d0.w)
  19715. ; ===========================================================================
  19716. ; off_F454:
  19717. LevEvents_DEZ_Index: offsetTable
  19718. offsetTableEntry.w LevEvents_DEZ_Routine1 ; 0
  19719. offsetTableEntry.w LevEvents_DEZ_Routine2 ; 2
  19720. offsetTableEntry.w LevEvents_DEZ_Routine3 ; 4
  19721. offsetTableEntry.w LevEvents_DEZ_Routine4 ; 6
  19722. offsetTableEntry.w LevEvents_DEZ_Routine5 ; 8
  19723. ; ===========================================================================
  19724. ; loc_F45E:
  19725. LevEvents_DEZ_Routine1:
  19726. move.w #320,d0
  19727. cmp.w (Camera_X_pos).w,d0
  19728. bhi.s + ; rts
  19729. addq.b #2,(Dynamic_Resize_Routine).w
  19730. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  19731. bne.s + ; rts
  19732. move.b #ObjID_MechaSonic,id(a1) ; load objAF (silver sonic)
  19733. move.b #$48,subtype(a1)
  19734. move.w #$348,x_pos(a1)
  19735. move.w #$A0,y_pos(a1)
  19736. moveq #PLCID_FieryExplosion,d0
  19737. jmpto (LoadPLC).l, JmpTo2_LoadPLC
  19738. ; ===========================================================================
  19739. +
  19740. rts
  19741. ; ===========================================================================
  19742. ; return_F490:
  19743. LevEvents_DEZ_Routine2:
  19744. rts
  19745. ; ===========================================================================
  19746. ; loc_F492:
  19747. LevEvents_DEZ_Routine3:
  19748. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19749. cmpi.w #$300,(Camera_X_pos).w
  19750. blo.s + ; rts
  19751. addq.b #2,(Dynamic_Resize_Routine).w
  19752. moveq #PLCID_DezBoss,d0
  19753. jmpto (LoadPLC).l, JmpTo2_LoadPLC
  19754. ; ===========================================================================
  19755. +
  19756. rts
  19757. ; ===========================================================================
  19758. ; loc_F4AC:
  19759. LevEvents_DEZ_Routine4:
  19760. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19761. move.w #$680,d0
  19762. cmp.w (Camera_X_pos).w,d0
  19763. bhi.s + ; rts
  19764. addq.b #2,(Dynamic_Resize_Routine).w
  19765. move.w d0,(Camera_Min_X_pos).w
  19766. addi.w #$C0,d0
  19767. move.w d0,(Camera_Max_X_pos).w
  19768. +
  19769. rts
  19770. ; ===========================================================================
  19771. ; return_F4CE:
  19772. LevEvents_DEZ_Routine5:
  19773. rts
  19774. ; ===========================================================================
  19775. ; loc_F4D0:
  19776. LevEvents_ARZ:
  19777. tst.b (Current_Act).w
  19778. bne.s LevEvents_ARZ2
  19779. rts
  19780. ; ===========================================================================
  19781. ; loc_F4D8:
  19782. LevEvents_ARZ2:
  19783. moveq #0,d0
  19784. move.b (Dynamic_Resize_Routine).w,d0
  19785. move.w LevEvents_ARZ2_Index(pc,d0.w),d0
  19786. jmp LevEvents_ARZ2_Index(pc,d0.w)
  19787. ; ===========================================================================
  19788. ; off_F4E6:
  19789. LevEvents_ARZ2_Index: offsetTable
  19790. offsetTableEntry.w LevEvents_ARZ2_Routine1 ; 0
  19791. offsetTableEntry.w LevEvents_ARZ2_Routine2 ; 2
  19792. offsetTableEntry.w LevEvents_ARZ2_Routine3 ; 4
  19793. offsetTableEntry.w LevEvents_ARZ2_Routine4 ; 6
  19794. ; ===========================================================================
  19795. ; loc_F4EE:
  19796. LevEvents_ARZ2_Routine1:
  19797. cmpi.w #$2810,(Camera_X_pos).w
  19798. blo.s + ; rts
  19799. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19800. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19801. move.w #$400,(Camera_Max_Y_pos).w
  19802. move.w #$400,(Tails_Max_Y_pos).w
  19803. addq.b #2,(Dynamic_Resize_Routine).w
  19804. move.b #4,(Current_Boss_ID).w
  19805. moveq #PLCID_ArzBoss,d0
  19806. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  19807. +
  19808. rts
  19809. ; ===========================================================================
  19810. ; loc_F520:
  19811. LevEvents_ARZ2_Routine2:
  19812. cmpi.w #$2A40,(Camera_X_pos).w
  19813. blo.s + ; rts
  19814. move.w #$2A40,(Camera_Max_X_pos).w
  19815. move.w #$2A40,(Camera_Min_X_pos).w
  19816. move.w #$2A40,(Tails_Max_X_pos).w
  19817. move.w #$2A40,(Tails_Min_X_pos).w
  19818. addq.b #2,(Dynamic_Resize_Routine).w
  19819. move.w #MusID_FadeOut,d0
  19820. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19821. clr.b (ScreenShift).w
  19822. jsrto (SingleObjLoad).l, JmpTo_SingleObjLoad
  19823. bne.s + ; rts
  19824. move.b #ObjID_ARZBoss,id(a1) ; load obj89
  19825. +
  19826. rts
  19827. ; ===========================================================================
  19828. ; loc_F55C:
  19829. LevEvents_ARZ2_Routine3:
  19830. cmpi.w #$3F8,(Camera_Y_pos).w
  19831. blo.s +
  19832. move.w #$3F8,(Camera_Min_Y_pos).w
  19833. move.w #$3F8,(Tails_Min_Y_pos).w
  19834. +
  19835. addq.b #1,(ScreenShift).w
  19836. cmpi.b #$5A,(ScreenShift).w
  19837. blo.s + ; rts
  19838. addq.b #2,(Dynamic_Resize_Routine).w
  19839. move.w #MusID_Boss,d0
  19840. jsrto (PlayMusic).l, JmpTo3_PlayMusic
  19841. +
  19842. rts
  19843. ; ===========================================================================
  19844. ; loc_F58A:
  19845. LevEvents_ARZ2_Routine4:
  19846. move.w (Camera_X_pos).w,(Camera_Min_X_pos).w
  19847. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  19848. move.w (Camera_X_pos).w,(Tails_Min_X_pos).w
  19849. rts
  19850. ; ===========================================================================
  19851. ; loc_F59E:
  19852. LevEvents_SCZ:
  19853. tst.b (Current_Act).w
  19854. bne.w LevEvents_SCZ2
  19855. moveq #0,d0
  19856. move.b (Dynamic_Resize_Routine).w,d0
  19857. move.w LevEvents_SCZ_Index(pc,d0.w),d0
  19858. jmp LevEvents_SCZ_Index(pc,d0.w)
  19859. ; ===========================================================================
  19860. ; off_F5B4:
  19861. LevEvents_SCZ_Index: offsetTable
  19862. offsetTableEntry.w LevEvents_SCZ_Routine1 ; 0
  19863. offsetTableEntry.w LevEvents_SCZ_Routine2 ; 2
  19864. offsetTableEntry.w LevEvents_SCZ_Routine3 ; 4
  19865. offsetTableEntry.w LevEvents_SCZ_Routine4 ; 6
  19866. offsetTableEntry.w LevEvents_SCZ_RoutineNull ; 8
  19867. ; ===========================================================================
  19868. ; loc_F5BE:
  19869. LevEvents_SCZ_Routine1:
  19870. move.w #1,(Tornado_Velocity_X).w
  19871. move.w #0,(Tornado_Velocity_Y).w
  19872. addq.b #2,(Dynamic_Resize_Routine).w
  19873. rts
  19874. ; ===========================================================================
  19875. ; loc_F5D0:
  19876. LevEvents_SCZ_Routine2:
  19877. cmpi.w #$1180,(Camera_X_pos).w
  19878. blo.s +
  19879. move.w #-1,(Tornado_Velocity_X).w
  19880. move.w #1,(Tornado_Velocity_Y).w
  19881. move.w #$500,(Camera_Max_Y_pos).w
  19882. addq.b #2,(Dynamic_Resize_Routine).w
  19883. +
  19884. rts
  19885. ; ===========================================================================
  19886. ; loc_F5F0:
  19887. LevEvents_SCZ_Routine3:
  19888. cmpi.w #$500,(Camera_Y_pos).w
  19889. blo.s +
  19890. move.w #1,(Tornado_Velocity_X).w
  19891. move.w #0,(Tornado_Velocity_Y).w
  19892. addq.b #2,(Dynamic_Resize_Routine).w
  19893. +
  19894. rts
  19895. ; ===========================================================================
  19896. ; loc_F60A:
  19897. LevEvents_SCZ_Routine4:
  19898. cmpi.w #$1400,(Camera_X_pos).w
  19899. blo.s LevEvents_SCZ_RoutineNull
  19900. move.w #0,(Tornado_Velocity_X).w
  19901. move.w #0,(Tornado_Velocity_Y).w
  19902. addq.b #2,(Dynamic_Resize_Routine).w
  19903.  
  19904. ; return_F622:
  19905. LevEvents_SCZ_RoutineNull:
  19906. rts
  19907. ; ===========================================================================
  19908. ; return_F624:
  19909. LevEvents_SCZ2:
  19910. rts
  19911. ; ===========================================================================
  19912.  
  19913. ; loc_F626:
  19914. PlayLevelMusic:
  19915. move.w (Level_Music).w,d0
  19916. jmpto (PlayMusic).l, JmpTo3_PlayMusic
  19917. ; ===========================================================================
  19918.  
  19919. ; loc_F62E:
  19920. LoadPLC_AnimalExplosion:
  19921. moveq #0,d0
  19922. move.b (Current_Zone).w,d0
  19923. lea (Animal_PLCTable).l,a2
  19924. move.b (a2,d0.w),d0
  19925. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  19926. moveq #PLCID_Explosion,d0
  19927. jsrto (LoadPLC).l, JmpTo2_LoadPLC
  19928. rts
  19929. ; ===========================================================================
  19930.  
  19931. if gameRevision<2
  19932. nop
  19933. endif
  19934.  
  19935. if ~~removeJmpTos
  19936. JmpTo_SingleObjLoad
  19937. jmp (SingleObjLoad).l
  19938. JmpTo3_PlaySound
  19939. jmp (PlaySound).l
  19940. ; JmpTo2_PalLoad2
  19941. JmpTo2_PalLoad_Now
  19942. jmp (PalLoad_Now).l
  19943. JmpTo2_LoadPLC
  19944. jmp (LoadPLC).l
  19945. JmpTo3_PlayMusic
  19946. jmp (PlayMusic).l
  19947.  
  19948. align 4
  19949. endif
  19950.  
  19951.  
  19952.  
  19953.  
  19954. ; ===========================================================================
  19955. ; ----------------------------------------------------------------------------
  19956. ; Object 11 - Bridge in Emerald Hill Zone and Hidden Palace Zone
  19957. ; ----------------------------------------------------------------------------
  19958. ; OST Variables:
  19959. Obj11_child1 = objoff_30 ; pointer to first set of bridge segments
  19960. Obj11_child2 = objoff_34 ; pointer to second set of bridge segments, if applicable
  19961.  
  19962. ; Sprite_F66C:
  19963. Obj11:
  19964. btst #6,render_flags(a0) ; is this a child sprite object?
  19965. bne.w + ; if yes, branch
  19966. moveq #0,d0
  19967. move.b routine(a0),d0
  19968. move.w Obj11_Index(pc,d0.w),d1
  19969. jmp Obj11_Index(pc,d1.w)
  19970. ; ===========================================================================
  19971. + ; child sprite objects only need to be drawn
  19972. move.w #$180,d0
  19973. bra.w DisplaySprite3
  19974. ; ===========================================================================
  19975. ; off_F68C:
  19976. Obj11_Index: offsetTable
  19977. offsetTableEntry.w Obj11_Init ; 0
  19978. offsetTableEntry.w Obj11_EHZ ; 2
  19979. offsetTableEntry.w Obj11_Display ; 4
  19980. offsetTableEntry.w Obj11_HPZ ; 6
  19981. ; ===========================================================================
  19982. ; loc_F694: Obj11_Main:
  19983. Obj11_Init:
  19984. addq.b #2,routine(a0)
  19985. move.l #Obj11_MapUnc_FC70,mappings(a0)
  19986. move.w #make_art_tile(ArtTile_ArtNem_EHZ_Bridge,2,0),art_tile(a0)
  19987. move.b #3,priority(a0)
  19988. cmpi.b #hidden_palace_zone,(Current_Zone).w ; is this an HPZ bridge?
  19989. bne.s + ; if not, branch
  19990. addq.b #4,routine(a0)
  19991. move.l #Obj11_MapUnc_FC28,mappings(a0)
  19992. move.w #make_art_tile(ArtTile_ArtNem_HPZ_Bridge,3,0),art_tile(a0)
  19993. +
  19994. bsr.w Adjust2PArtPointer
  19995. move.b #4,render_flags(a0)
  19996. move.b #$80,width_pixels(a0)
  19997. move.w y_pos(a0),d2
  19998. move.w d2,objoff_3C(a0)
  19999. move.w x_pos(a0),d3
  20000. lea subtype(a0),a2 ; copy bridge subtype to a2
  20001. moveq #0,d1
  20002. move.b (a2),d1 ; d1 = subtype
  20003. move.w d1,d0
  20004. lsr.w #1,d0
  20005. lsl.w #4,d0 ; (d0 div 2) * 16
  20006. sub.w d0,d3 ; x position of left half
  20007. swap d1 ; store subtype in high word for later
  20008. move.w #8,d1
  20009. bsr.s Obj11_MakeBdgSegment
  20010. move.w sub6_x_pos(a1),d0
  20011. subq.w #8,d0
  20012. move.w d0,x_pos(a1) ; center of first subsprite object
  20013. move.l a1,Obj11_child1(a0) ; pointer to first subsprite object
  20014. swap d1 ; retrieve subtype
  20015. subq.w #8,d1
  20016. bls.s + ; branch, if subtype <= 8 (bridge has no more than 8 logs)
  20017. ; else, create a second subsprite object for the rest of the bridge
  20018. move.w d1,d4
  20019. bsr.s Obj11_MakeBdgSegment
  20020. move.l a1,Obj11_child2(a0) ; pointer to second subsprite object
  20021. move.w d4,d0
  20022. add.w d0,d0
  20023. add.w d4,d0 ; d0*3
  20024. move.w sub2_x_pos(a1,d0.w),d0
  20025. subq.w #8,d0
  20026. move.w d0,x_pos(a1) ; center of second subsprite object
  20027. +
  20028. bra.s Obj11_EHZ
  20029.  
  20030. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  20031. ; sub_F728:
  20032. Obj11_MakeBdgSegment:
  20033. jsrto (SingleObjLoad2).l, JmpTo_SingleObjLoad2
  20034. bne.s + ; rts
  20035. _move.b id(a0),id(a1) ; load obj11
  20036. move.w x_pos(a0),x_pos(a1)
  20037. move.w y_pos(a0),y_pos(a1)
  20038. move.l mappings(a0),mappings(a1)
  20039. move.w art_tile(a0),art_tile(a1)
  20040. move.b render_flags(a0),render_flags(a1)
  20041. bset #6,render_flags(a1)
  20042. move.b #$40,mainspr_width(a1)
  20043. move.b d1,mainspr_childsprites(a1)
  20044. subq.b #1,d1
  20045. lea sub2_x_pos(a1),a2 ; starting address for subsprite data
  20046.  
  20047. - move.w d3,(a2)+ ; sub?_x_pos
  20048. move.w d2,(a2)+ ; sub?_y_pos
  20049. move.w #0,(a2)+ ; sub?_mapframe
  20050. addi.w #$10,d3 ; width of a log, x_pos for next log
  20051. dbf d1,- ; repeat for d1 logs
  20052. +
  20053. rts
  20054. ; End of function Obj11_MakeBdgSegment
  20055.  
  20056. ; ===========================================================================
  20057. ; loc_F77A: Obj11_Action:
  20058. Obj11_EHZ:
  20059. move.b status(a0),d0
  20060. andi.b #standing_mask,d0
  20061. bne.s +
  20062. tst.b objoff_3E(a0)
  20063. beq.s loc_F7BC
  20064. subq.b #4,objoff_3E(a0)
  20065. bra.s loc_F7B8
  20066. +
  20067. andi.b #p2_standing,d0
  20068. beq.s ++
  20069. move.b objoff_3F(a0),d0
  20070. sub.b objoff_3B(a0),d0
  20071. beq.s ++
  20072. bcc.s +
  20073. addq.b #1,objoff_3F(a0)
  20074. bra.s ++
  20075. ; ---------------------------------------------------------------------------
  20076. +
  20077. subq.b #1,objoff_3F(a0)
  20078. +
  20079. cmpi.b #$40,objoff_3E(a0)
  20080. beq.s loc_F7B8
  20081. addq.b #4,objoff_3E(a0)
  20082.  
  20083. loc_F7B8:
  20084. bsr.w Obj11_Depress
  20085.  
  20086. loc_F7BC:
  20087. moveq #0,d1
  20088. move.b subtype(a0),d1
  20089. lsl.w #3,d1
  20090. move.w d1,d2
  20091. addq.w #8,d1
  20092. add.w d2,d2
  20093. moveq #8,d3
  20094. move.w x_pos(a0),d4
  20095. bsr.w sub_F872
  20096.  
  20097. ; loc_F7D4:
  20098. Obj11_Unload:
  20099. ; this is essentially MarkObjGone, except we need to delete our subsprite objects as well
  20100. tst.w (Two_player_mode).w ; is it two player mode?
  20101. beq.s + ; if not, branch
  20102. rts
  20103. ; ---------------------------------------------------------------------------
  20104. +
  20105. move.w x_pos(a0),d0
  20106. andi.w #$FF80,d0
  20107. sub.w (Camera_X_pos_coarse).w,d0
  20108. cmpi.w #$280,d0
  20109. bhi.s +
  20110. rts
  20111. ; ---------------------------------------------------------------------------
  20112. + ; delete first subsprite object
  20113. movea.l Obj11_child1(a0),a1 ; a1=object
  20114. bsr.w DeleteObject2
  20115. cmpi.b #8,subtype(a0)
  20116. bls.s + ; if bridge has more than 8 logs, delete second subsprite object
  20117. movea.l Obj11_child2(a0),a1 ; a1=object
  20118. bsr.w DeleteObject2
  20119. +
  20120. bra.w DeleteObject
  20121. ; ===========================================================================
  20122. ; loc_F80C: BranchTo_DisplaySprite:
  20123. Obj11_Display:
  20124. bra.w DisplaySprite
  20125. ; ===========================================================================
  20126. ; loc_F810: Obj11_Action_HPZ:
  20127. Obj11_HPZ:
  20128. move.b status(a0),d0
  20129. andi.b #standing_mask,d0
  20130. bne.s +
  20131. tst.b objoff_3E(a0)
  20132. beq.s loc_F852
  20133. subq.b #4,objoff_3E(a0)
  20134. bra.s loc_F84E
  20135. ; ===========================================================================
  20136. +
  20137. andi.b #p2_standing,d0
  20138. beq.s ++
  20139. move.b objoff_3F(a0),d0
  20140. sub.b objoff_3B(a0),d0
  20141. beq.s ++
  20142. bcc.s +
  20143. addq.b #1,objoff_3F(a0)
  20144. bra.s ++
  20145. ; ===========================================================================
  20146. +
  20147. subq.b #1,objoff_3F(a0)
  20148. +
  20149. cmpi.b #$40,objoff_3E(a0)
  20150. beq.s loc_F84E
  20151. addq.b #4,objoff_3E(a0)
  20152.  
  20153. loc_F84E:
  20154. bsr.w Obj11_Depress
  20155.  
  20156. loc_F852:
  20157. moveq #0,d1
  20158. move.b subtype(a0),d1
  20159. lsl.w #3,d1
  20160. move.w d1,d2
  20161. addq.w #8,d1
  20162. add.w d2,d2
  20163. moveq #8,d3
  20164. move.w x_pos(a0),d4
  20165. bsr.w sub_F872
  20166. bsr.w sub_F912
  20167. bra.w Obj11_Unload
  20168.  
  20169. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  20170.  
  20171.  
  20172. sub_F872:
  20173. lea (Sidekick).w,a1 ; a1=character
  20174. moveq #p2_standing_bit,d6
  20175. moveq #$3B,d5
  20176. movem.l d1-d4,-(sp)
  20177. bsr.s +
  20178. movem.l (sp)+,d1-d4
  20179. lea (MainCharacter).w,a1 ; a1=character
  20180. subq.b #1,d6
  20181. moveq #$3F,d5
  20182. +
  20183. btst d6,status(a0)
  20184. beq.s loc_F8F0
  20185. btst #1,status(a1)
  20186. bne.s +
  20187. moveq #0,d0
  20188. move.w x_pos(a1),d0
  20189. sub.w x_pos(a0),d0
  20190. add.w d1,d0
  20191. bmi.s +
  20192. cmp.w d2,d0
  20193. blo.s ++
  20194. +
  20195. bclr #3,status(a1)
  20196. bclr d6,status(a0)
  20197. moveq #0,d4
  20198. rts
  20199. ; ===========================================================================
  20200. +
  20201. lsr.w #4,d0
  20202. move.b d0,(a0,d5.w)
  20203. movea.l Obj11_child1(a0),a2
  20204. cmpi.w #8,d0
  20205. blo.s +
  20206. movea.l Obj11_child2(a0),a2 ; a2=object
  20207. subi_.w #8,d0
  20208. +
  20209. add.w d0,d0
  20210. move.w d0,d1
  20211. add.w d0,d0
  20212. add.w d1,d0
  20213. move.w sub2_y_pos(a2,d0.w),d0
  20214. subq.w #8,d0
  20215. moveq #0,d1
  20216. move.b y_radius(a1),d1
  20217. sub.w d1,d0
  20218. move.w d0,y_pos(a1)
  20219. moveq #0,d4
  20220. rts
  20221. ; ===========================================================================
  20222.  
  20223. loc_F8F0:
  20224. move.w d1,-(sp)
  20225. jsrto (PlatformObject11_cont).l, JmpTo_PlatformObject11_cont
  20226. move.w (sp)+,d1
  20227. btst d6,status(a0)
  20228. beq.s + ; rts
  20229. moveq #0,d0
  20230. move.w x_pos(a1),d0
  20231. sub.w x_pos(a0),d0
  20232. add.w d1,d0
  20233. lsr.w #4,d0
  20234. move.b d0,(a0,d5.w)
  20235. +
  20236. rts
  20237. ; End of function sub_F872
  20238.  
  20239.  
  20240. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  20241.  
  20242.  
  20243. sub_F912:
  20244. moveq #0,d0
  20245. tst.w (MainCharacter+x_vel).w
  20246. bne.s +
  20247. move.b (Vint_runcount+3).w,d0
  20248. andi.w #$1C,d0
  20249. lsr.w #1,d0
  20250. +
  20251. moveq #0,d2
  20252. move.b byte_F950+1(pc,d0.w),d2
  20253. swap d2
  20254. move.b byte_F950(pc,d0.w),d2
  20255. moveq #0,d0
  20256. tst.w (Sidekick+x_vel).w
  20257. bne.s +
  20258. move.b (Vint_runcount+3).w,d0
  20259. andi.w #$1C,d0
  20260. lsr.w #1,d0
  20261. +
  20262. moveq #0,d6
  20263. move.b byte_F950+1(pc,d0.w),d6
  20264. swap d6
  20265. move.b byte_F950(pc,d0.w),d6
  20266. bra.s +
  20267. ; ===========================================================================
  20268. byte_F950:
  20269. dc.b 1, 2
  20270. dc.b 1, 2 ; 2
  20271. dc.b 1, 2 ; 4
  20272. dc.b 1, 2 ; 6
  20273. dc.b 0, 1 ; 8
  20274. dc.b 0, 0 ; 10
  20275. dc.b 0, 0 ; 12
  20276. dc.b 0, 1 ; 14
  20277. ; ===========================================================================
  20278. +
  20279. moveq #-2,d3
  20280. moveq #-2,d4
  20281. move.b status(a0),d0
  20282. andi.b #p1_standing,d0
  20283. beq.s +
  20284. move.b objoff_3F(a0),d3
  20285. +
  20286. move.b status(a0),d0
  20287. andi.b #p2_standing,d0
  20288. beq.s +
  20289. move.b objoff_3B(a0),d4
  20290. +
  20291. movea.l Obj11_child1(a0),a1
  20292. lea sub9_mapframe+next_subspr(a1),a2
  20293. lea sub2_mapframe(a1),a1
  20294. moveq #0,d1
  20295. move.b subtype(a0),d1
  20296. subq.b #1,d1
  20297. moveq #0,d5
  20298.  
  20299. - moveq #0,d0
  20300. subq.w #1,d3
  20301. cmp.b d3,d5
  20302. bne.s +
  20303. move.w d2,d0
  20304. +
  20305. addq.w #2,d3
  20306. cmp.b d3,d5
  20307. bne.s +
  20308. move.w d2,d0
  20309. +
  20310. subq.w #1,d3
  20311. subq.w #1,d4
  20312. cmp.b d4,d5
  20313. bne.s +
  20314. move.w d6,d0
  20315. +
  20316. addq.w #2,d4
  20317. cmp.b d4,d5
  20318. bne.s +
  20319. move.w d6,d0
  20320. +
  20321. subq.w #1,d4
  20322. cmp.b d3,d5
  20323. bne.s +
  20324. swap d2
  20325. move.w d2,d0
  20326. swap d2
  20327. +
  20328. cmp.b d4,d5
  20329. bne.s +
  20330. swap d6
  20331. move.w d6,d0
  20332. swap d6
  20333. +
  20334. move.b d0,(a1)
  20335. addq.w #1,d5
  20336. addq.w #6,a1
  20337. cmpa.w a2,a1
  20338. bne.s +
  20339. movea.l Obj11_child2(a0),a1 ; a1=object
  20340. lea sub2_mapframe(a1),a1
  20341. + dbf d1,-
  20342.  
  20343. rts
  20344. ; End of function sub_F912
  20345.  
  20346. ; ===========================================================================
  20347.  
  20348. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  20349. ; subroutine to make the bridge push down where Sonic or Tails walks over
  20350. ; loc_F9E8:
  20351. Obj11_Depress:
  20352. move.b objoff_3E(a0),d0
  20353. jsrto (CalcSine).l, JmpTo_CalcSine
  20354. move.w d0,d4
  20355. lea (byte_FB28).l,a4
  20356. moveq #0,d0
  20357. move.b subtype(a0),d0
  20358. lsl.w #4,d0
  20359. moveq #0,d3
  20360. move.b objoff_3F(a0),d3
  20361. move.w d3,d2
  20362. add.w d0,d3
  20363. moveq #0,d5
  20364. lea (Obj11_DepressionOffsets-$80).l,a5
  20365. move.b (a5,d3.w),d5
  20366. andi.w #$F,d3
  20367. lsl.w #4,d3
  20368. lea (a4,d3.w),a3
  20369. movea.l Obj11_child1(a0),a1
  20370. lea sub9_y_pos+next_subspr(a1),a2
  20371. lea sub2_y_pos(a1),a1
  20372.  
  20373. - moveq #0,d0
  20374. move.b (a3)+,d0
  20375. addq.w #1,d0
  20376. mulu.w d5,d0
  20377. mulu.w d4,d0
  20378. swap d0
  20379. add.w objoff_3C(a0),d0
  20380. move.w d0,(a1)
  20381. addq.w #6,a1
  20382. cmpa.w a2,a1
  20383. bne.s +
  20384. movea.l Obj11_child2(a0),a1 ; a1=object
  20385. lea sub2_y_pos(a1),a1
  20386. + dbf d2,-
  20387.  
  20388. moveq #0,d0
  20389. move.b subtype(a0),d0
  20390. moveq #0,d3
  20391. move.b objoff_3F(a0),d3
  20392. addq.b #1,d3
  20393. sub.b d0,d3
  20394. neg.b d3
  20395. bmi.s ++ ; rts
  20396. move.w d3,d2
  20397. lsl.w #4,d3
  20398. lea (a4,d3.w),a3
  20399. adda.w d2,a3
  20400. subq.w #1,d2
  20401. bcs.s ++ ; rts
  20402.  
  20403. - moveq #0,d0
  20404. move.b -(a3),d0
  20405. addq.w #1,d0
  20406. mulu.w d5,d0
  20407. mulu.w d4,d0
  20408. swap d0
  20409. add.w objoff_3C(a0),d0
  20410. move.w d0,(a1)
  20411. addq.w #6,a1
  20412. cmpa.w a2,a1
  20413. bne.s +
  20414. movea.l Obj11_child2(a0),a1 ; a1=object
  20415. lea sub2_y_pos(a1),a1
  20416. + dbf d2,-
  20417. +
  20418. rts
  20419. ; ===========================================================================
  20420. ; seems to be bridge piece vertical position offset data
  20421. Obj11_DepressionOffsets: ; byte_FA98:
  20422. dc.b 2, 4, 6, 8, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0; 16
  20423. dc.b 2, 4, 6, 8, $A, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0; 32
  20424. dc.b 2, 4, 6, 8, $A, $A, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0; 48
  20425. dc.b 2, 4, 6, 8, $A, $C, $A, 8, 6, 4, 2, 0, 0, 0, 0, 0; 64
  20426. dc.b 2, 4, 6, 8, $A, $C, $C, $A, 8, 6, 4, 2, 0, 0, 0, 0; 80
  20427. dc.b 2, 4, 6, 8, $A, $C, $E, $C, $A, 8, 6, 4, 2, 0, 0, 0; 96
  20428. dc.b 2, 4, 6, 8, $A, $C, $E, $E, $C, $A, 8, 6, 4, 2, 0, 0; 112
  20429. dc.b 2, 4, 6, 8, $A, $C, $E,$10, $E, $C, $A, 8, 6, 4, 2, 0; 128
  20430. dc.b 2, 4, 6, 8, $A, $C, $E,$10,$10, $E, $C, $A, 8, 6, 4, 2; 144
  20431.  
  20432. ; something else important for bridge depression to work (phase? bridge size adjustment?)
  20433. byte_FB28:
  20434. dc.b $FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 16
  20435. dc.b $B5,$FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 32
  20436. dc.b $7E,$DB,$FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 48
  20437. dc.b $61,$B5,$EC,$FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 64
  20438. dc.b $4A,$93,$CD,$F3,$FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 80
  20439. dc.b $3E,$7E,$B0,$DB,$F6,$FF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 96
  20440. dc.b $38,$6D,$9D,$C5,$E4,$F8,$FF, 0, 0, 0, 0, 0, 0, 0, 0, 0; 112
  20441. dc.b $31,$61,$8E,$B5,$D4,$EC,$FB,$FF, 0, 0, 0, 0, 0, 0, 0, 0; 128
  20442. dc.b $2B,$56,$7E,$A2,$C1,$DB,$EE,$FB,$FF, 0, 0, 0, 0, 0, 0, 0; 144
  20443. dc.b $25,$4A,$73,$93,$B0,$CD,$E1,$F3,$FC,$FF, 0, 0, 0, 0, 0, 0; 160
  20444. dc.b $1F,$44,$67,$88,$A7,$BD,$D4,$E7,$F4,$FD,$FF, 0, 0, 0, 0, 0; 176
  20445. dc.b $1F,$3E,$5C,$7E,$98,$B0,$C9,$DB,$EA,$F6,$FD,$FF, 0, 0, 0, 0; 192
  20446. dc.b $19,$38,$56,$73,$8E,$A7,$BD,$D1,$E1,$EE,$F8,$FE,$FF, 0, 0, 0; 208
  20447. dc.b $19,$38,$50,$6D,$83,$9D,$B0,$C5,$D8,$E4,$F1,$F8,$FE,$FF, 0, 0; 224
  20448. dc.b $19,$31,$4A,$67,$7E,$93,$A7,$BD,$CD,$DB,$E7,$F3,$F9,$FE,$FF, 0; 240
  20449. dc.b $19,$31,$4A,$61,$78,$8E,$A2,$B5,$C5,$D4,$E1,$EC,$F4,$FB,$FE,$FF; 256
  20450. ; -------------------------------------------------------------------------------
  20451. ; sprite mappings
  20452. ; -------------------------------------------------------------------------------
  20453. Obj11_MapUnc_FC28: BINCLUDE "mappings/sprite/obj11_a.bin"
  20454.  
  20455. ; -------------------------------------------------------------------------------
  20456. ; sprite mappings
  20457. ; -------------------------------------------------------------------------------
  20458. Obj11_MapUnc_FC70: BINCLUDE "mappings/sprite/obj11_b.bin"
  20459.  
  20460. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  20461.  
  20462. if ~~removeJmpTos
  20463. ; sub_FC88:
  20464. JmpTo_SingleObjLoad2
  20465. jmp (SingleObjLoad2).l
  20466. JmpTo_PlatformObject11_cont
  20467. jmp (PlatformObject11_cont).l
  20468. ; sub_FC94:
  20469. JmpTo_CalcSine
  20470. jmp (CalcSine).l
  20471.  
  20472. align 4
  20473. endif
  20474.  
  20475.  
  20476.  
  20477.  
  20478. ; ===========================================================================
  20479. ; ----------------------------------------------------------------------------
  20480. ; Object 15 - Swinging platform from Aquatic Ruin Zone
  20481. ; ----------------------------------------------------------------------------
  20482. ; Sprite_FC9C:
  20483. Obj15:
  20484. btst #6,render_flags(a0)
  20485. bne.w +
  20486. moveq #0,d0
  20487. move.b routine(a0),d0
  20488. move.w Obj15_Index(pc,d0.w),d1
  20489. jmp Obj15_Index(pc,d1.w)
  20490. ; ---------------------------------------------------------------------------
  20491. +
  20492. move.w #$200,d0
  20493. bra.w DisplaySprite3
  20494. ; ===========================================================================
  20495. ; off_FCBC: Obj15_States:
  20496. Obj15_Index: offsetTable
  20497. offsetTableEntry.w Obj15_Init ; 0
  20498. offsetTableEntry.w Obj15_State2 ; 2
  20499. offsetTableEntry.w Obj15_Display ; 4
  20500. offsetTableEntry.w Obj15_State4 ; 6
  20501. offsetTableEntry.w Obj15_State5 ; 8
  20502. offsetTableEntry.w Obj15_State6 ; $A
  20503. offsetTableEntry.w Obj15_State7 ; $C
  20504. ; ===========================================================================
  20505. ; loc_FCCA:
  20506. Obj15_Init:
  20507. addq.b #2,routine(a0)
  20508. move.l #Obj15_MapUnc_101E8,mappings(a0)
  20509. move.w #make_art_tile(ArtTile_ArtNem_OOZSwingPlat,2,0),art_tile(a0)
  20510. move.b #4,render_flags(a0)
  20511. move.b #3,priority(a0)
  20512. move.b #$20,width_pixels(a0)
  20513. move.b #$10,y_radius(a0)
  20514. move.w y_pos(a0),objoff_38(a0)
  20515. move.w x_pos(a0),objoff_3A(a0)
  20516. cmpi.b #mystic_cave_zone,(Current_Zone).w
  20517. bne.s +
  20518. move.l #Obj15_Obj7A_MapUnc_10256,mappings(a0)
  20519. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  20520. move.b #$18,width_pixels(a0)
  20521. move.b #8,y_radius(a0)
  20522. +
  20523. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  20524. bne.s +
  20525. move.l #Obj15_Obj83_MapUnc_1021E,mappings(a0)
  20526. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  20527. move.b #$20,width_pixels(a0)
  20528. move.b #8,y_radius(a0)
  20529. +
  20530. bsr.w Adjust2PArtPointer
  20531. moveq #0,d1
  20532. move.b subtype(a0),d1
  20533. bpl.s +
  20534. addq.b #4,routine(a0)
  20535. +
  20536. move.b d1,d4
  20537. andi.b #$70,d4
  20538. andi.w #$F,d1
  20539. move.w x_pos(a0),d2
  20540. move.w y_pos(a0),d3
  20541. jsrto (SingleObjLoad2).l, JmpTo2_SingleObjLoad2
  20542. bne.w +++
  20543. _move.b id(a0),id(a1) ; load obj15
  20544. move.l mappings(a0),mappings(a1)
  20545. move.w art_tile(a0),art_tile(a1)
  20546. move.b #4,render_flags(a1)
  20547. cmpi.b #$20,d4
  20548. bne.s +
  20549. move.b #4,routine(a1)
  20550. move.b #4,priority(a1)
  20551. move.b #$10,width_pixels(a1)
  20552. move.b #$50,y_radius(a1)
  20553. bset #4,render_flags(a1)
  20554. move.b #3,mapping_frame(a1)
  20555. move.w d2,x_pos(a1)
  20556. addi.w #$40,d3
  20557. move.w d3,y_pos(a1)
  20558. addi.w #$48,d3
  20559. move.w d3,y_pos(a0)
  20560. bra.s ++
  20561. ; ===========================================================================
  20562. +
  20563. bset #6,render_flags(a1)
  20564. move.b #$48,mainspr_width(a1)
  20565. move.b d1,mainspr_childsprites(a1)
  20566. subq.b #1,d1
  20567. lea sub2_x_pos(a1),a2
  20568.  
  20569. - move.w d2,(a2)+ ; sub?_x_pos
  20570. move.w d3,(a2)+ ; sub?_y_pos
  20571. move.w #1,(a2)+ ; sub2_mapframe
  20572. addi.w #$10,d3
  20573. dbf d1,-
  20574.  
  20575. move.b #2,sub2_mapframe(a1)
  20576. move.w sub6_x_pos(a1),x_pos(a1)
  20577. move.w sub6_y_pos(a1),y_pos(a1)
  20578. move.w d2,sub6_x_pos(a1)
  20579. move.w d3,sub6_y_pos(a1)
  20580. move.b #1,mainspr_mapframe(a1)
  20581. addi_.w #8,d3
  20582. move.w d3,y_pos(a0)
  20583. move.b #$50,mainspr_height(a1)
  20584. bset #4,render_flags(a1)
  20585. +
  20586. move.l a1,objoff_30(a0)
  20587. +
  20588. move.w #$8000,angle(a0)
  20589. move.w #0,objoff_3E(a0)
  20590. move.b subtype(a0),d1
  20591. andi.w #$70,d1
  20592. move.b d1,subtype(a0)
  20593. cmpi.b #$40,d1
  20594. bne.s Obj15_State2
  20595. move.l #Obj15_MapUnc_102DE,mappings(a0)
  20596. move.b #$A7,collision_flags(a0)
  20597.  
  20598. ; loc_FE50:
  20599. Obj15_State2:
  20600. move.w x_pos(a0),-(sp)
  20601. bsr.w sub_FE70
  20602. moveq #0,d1
  20603. move.b width_pixels(a0),d1
  20604. moveq #0,d3
  20605. move.b y_radius(a0),d3
  20606. addq.b #1,d3
  20607. move.w (sp)+,d4
  20608. jsrto (PlatformObject2).l, JmpTo_PlatformObject2
  20609. bra.w loc_1000C
  20610.  
  20611. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  20612.  
  20613.  
  20614. sub_FE70:
  20615.  
  20616. moveq #0,d0
  20617. moveq #0,d1
  20618. move.b (Oscillating_Data+$18).w,d0
  20619. move.b subtype(a0),d1
  20620. beq.s loc_FEC2
  20621. cmpi.b #$10,d1
  20622. bne.s ++
  20623. cmpi.b #$3F,d0
  20624. beq.s +
  20625. bhs.s loc_FEC2
  20626. moveq #$40,d0
  20627. bra.s loc_FEC2
  20628. ; ===========================================================================
  20629. /
  20630. move.w #SndID_PlatformKnock,d0
  20631. jsr (PlaySoundLocal).l
  20632. moveq #$40,d0
  20633. bra.s loc_FEC2
  20634. ; ===========================================================================
  20635. +
  20636. cmpi.b #$20,d1
  20637. beq.w +++ ; rts
  20638. cmpi.b #$30,d1
  20639. bne.s +
  20640. cmpi.b #$41,d0
  20641. beq.s -
  20642. blo.s loc_FEC2
  20643. moveq #$40,d0
  20644. bra.s loc_FEC2
  20645. ; ===========================================================================
  20646. +
  20647. cmpi.b #$40,d1
  20648. bne.s loc_FEC2
  20649. bsr.w loc_FF6E
  20650.  
  20651. loc_FEC2:
  20652. move.b objoff_2E(a0),d1
  20653. cmp.b d0,d1
  20654. beq.w ++ ; rts
  20655. move.b d0,objoff_2E(a0)
  20656. move.w #$80,d1
  20657. btst #0,status(a0)
  20658. beq.s +
  20659. neg.w d0
  20660. add.w d1,d0
  20661. +
  20662. jsrto (CalcSine).l, JmpTo2_CalcSine
  20663. move.w objoff_38(a0),d2
  20664. move.w objoff_3A(a0),d3
  20665. moveq #0,d6
  20666. movea.l objoff_30(a0),a1
  20667. move.b mainspr_childsprites(a1),d6
  20668. subq.w #1,d6
  20669. bcs.s + ; rts
  20670. swap d0
  20671. swap d1
  20672. asr.l #4,d0
  20673. asr.l #4,d1
  20674. moveq #0,d4
  20675. moveq #0,d5
  20676. lea sub2_x_pos(a1),a2
  20677.  
  20678. - movem.l d4-d5,-(sp)
  20679. swap d4
  20680. swap d5
  20681. add.w d2,d4
  20682. add.w d3,d5
  20683. move.w d5,(a2)+ ; sub?_x_pos
  20684. move.w d4,(a2)+ ; sub?_y_pos
  20685. movem.l (sp)+,d4-d5
  20686. add.l d0,d4
  20687. add.l d1,d5
  20688. addq.w #next_subspr-4,a2
  20689. dbf d6,-
  20690.  
  20691. movem.l d4-d5,-(sp)
  20692. swap d4
  20693. swap d5
  20694. add.w d2,d4
  20695. add.w d3,d5
  20696. move.w sub6_x_pos(a1),d2
  20697. move.w sub6_y_pos(a1),d3
  20698. move.w d5,sub6_x_pos(a1)
  20699. move.w d4,sub6_y_pos(a1)
  20700. move.w d2,x_pos(a1)
  20701. move.w d3,y_pos(a1)
  20702. movem.l (sp)+,d4-d5
  20703. asr.l #1,d0
  20704. asr.l #1,d1
  20705. add.l d0,d4
  20706. add.l d1,d5
  20707. swap d4
  20708. swap d5
  20709. add.w objoff_38(a0),d4
  20710. add.w objoff_3A(a0),d5
  20711. move.w d4,y_pos(a0)
  20712. move.w d5,x_pos(a0)
  20713. +
  20714. rts
  20715. ; End of function sub_FE70
  20716.  
  20717. ; ===========================================================================
  20718.  
  20719. loc_FF6E:
  20720. tst.w objoff_36(a0)
  20721. beq.s +
  20722. subq.w #1,objoff_36(a0)
  20723. bra.w loc_10006
  20724. ; ===========================================================================
  20725. +
  20726. tst.b objoff_34(a0)
  20727. bne.s +
  20728. move.w (MainCharacter+x_pos).w,d0
  20729. sub.w objoff_3A(a0),d0
  20730. addi.w #$20,d0
  20731. cmpi.w #$40,d0
  20732. bhs.s loc_10006
  20733. tst.w (Debug_placement_mode).w
  20734. bne.w loc_10006
  20735. move.b #1,objoff_34(a0)
  20736. +
  20737. tst.b objoff_3D(a0)
  20738. beq.s +
  20739. move.w objoff_3E(a0),d0
  20740. addi_.w #8,d0
  20741. move.w d0,objoff_3E(a0)
  20742. add.w d0,angle(a0)
  20743. cmpi.w #$200,d0
  20744. bne.s loc_10006
  20745. move.w #0,objoff_3E(a0)
  20746. move.w #$8000,angle(a0)
  20747. move.b #0,objoff_3D(a0)
  20748. move.w #$3C,objoff_36(a0)
  20749. bra.s loc_10006
  20750. ; ===========================================================================
  20751. +
  20752. move.w objoff_3E(a0),d0
  20753. subi_.w #8,d0
  20754. move.w d0,objoff_3E(a0)
  20755. add.w d0,angle(a0)
  20756. cmpi.w #$FE00,d0
  20757. bne.s loc_10006
  20758. move.w #0,objoff_3E(a0)
  20759. move.w #$4000,angle(a0)
  20760. move.b #1,objoff_3D(a0)
  20761. ; loc_10000:
  20762. move.w #$3C,objoff_36(a0)
  20763.  
  20764. loc_10006:
  20765. move.b angle(a0),d0
  20766. rts
  20767. ; ===========================================================================
  20768.  
  20769. loc_1000C:
  20770. tst.w (Two_player_mode).w
  20771. beq.s +
  20772. bra.w DisplaySprite
  20773. ; ===========================================================================
  20774. +
  20775. move.w objoff_3A(a0),d0
  20776. andi.w #$FF80,d0
  20777. sub.w (Camera_X_pos_coarse).w,d0
  20778. cmpi.w #$280,d0
  20779. bhi.w +
  20780. bra.w DisplaySprite
  20781. ; ===========================================================================
  20782. +
  20783. movea.l objoff_30(a0),a1
  20784. bsr.w DeleteObject2
  20785. bra.w DeleteObject
  20786. ; ===========================================================================
  20787.  
  20788. Obj15_Display: ;;
  20789. bra.w DisplaySprite
  20790. ; ===========================================================================
  20791.  
  20792. ; loc_1003E:
  20793. Obj15_State4:
  20794. move.w x_pos(a0),-(sp)
  20795. bsr.w sub_FE70
  20796. moveq #0,d1
  20797. move.b width_pixels(a0),d1
  20798. moveq #0,d3
  20799. move.b y_radius(a0),d3
  20800. addq.b #1,d3
  20801. move.w (sp)+,d4
  20802. jsrto (PlatformObject2).l, JmpTo_PlatformObject2
  20803. move.b status(a0),d0
  20804. andi.b #standing_mask,d0
  20805. beq.w BranchTo_loc_1000C
  20806. tst.b (Oscillating_Data+$18).w
  20807. bne.w BranchTo_loc_1000C
  20808. jsrto (SingleObjLoad2).l, JmpTo2_SingleObjLoad2
  20809. bne.s loc_100E4
  20810. moveq #0,d0
  20811.  
  20812. move.w #bytesToLcnt(object_size),d1
  20813. - move.l (a0,d0.w),(a1,d0.w)
  20814. addq.w #4,d0
  20815. dbf d1,-
  20816. if object_size&3
  20817. move.w (a0,d0.w),(a1,d0.w)
  20818. endif
  20819.  
  20820. move.b #$A,routine(a1)
  20821. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  20822. bne.s +
  20823. addq.b #2,routine(a1)
  20824. +
  20825. move.w #$200,x_vel(a1)
  20826. btst #0,status(a0)
  20827. beq.s +
  20828. neg.w x_vel(a1)
  20829. +
  20830. bset #1,status(a1)
  20831. move.w a0,d0
  20832. subi.w #Object_RAM,d0
  20833. if object_size=$40
  20834. lsr.w #6,d0
  20835. else
  20836. divu.w #object_size,d0
  20837. endif
  20838. andi.w #$7F,d0
  20839. move.w a1,d1
  20840. subi.w #Object_RAM,d1
  20841. if object_size=$40
  20842. lsr.w #6,d1
  20843. else
  20844. divu.w #object_size,d1
  20845. endif
  20846. andi.w #$7F,d1
  20847. lea (MainCharacter).w,a1 ; a1=character
  20848. cmp.b interact(a1),d0
  20849. bne.s +
  20850. move.b d1,interact(a1)
  20851. +
  20852. lea (Sidekick).w,a1 ; a1=character
  20853. cmp.b interact(a1),d0
  20854. bne.s loc_100E4
  20855. move.b d1,interact(a1)
  20856.  
  20857. loc_100E4:
  20858. move.b #3,mapping_frame(a0)
  20859. addq.b #2,routine(a0)
  20860. andi.b #$E7,status(a0)
  20861.  
  20862. BranchTo_loc_1000C
  20863. bra.w loc_1000C
  20864. ; ===========================================================================
  20865. ; loc_100F8:
  20866. Obj15_State5:
  20867. bsr.w sub_FE70
  20868. bra.w loc_1000C
  20869.  
  20870. ; ===========================================================================
  20871. ; loc_10100:
  20872. Obj15_State6:
  20873. move.w x_pos(a0),-(sp)
  20874. btst #1,status(a0)
  20875. beq.s +
  20876. bsr.w ObjectMove
  20877. addi.w #$18,y_vel(a0)
  20878. cmpi.w #$720,y_pos(a0)
  20879. blo.s ++
  20880. move.w #$720,y_pos(a0)
  20881. bclr #1,status(a0)
  20882. move.w #0,x_vel(a0)
  20883. move.w #0,y_vel(a0)
  20884. move.w y_pos(a0),objoff_38(a0)
  20885. bra.s ++
  20886. ; ===========================================================================
  20887. +
  20888. moveq #0,d0
  20889. move.b (Oscillating_Data+$14).w,d0
  20890. lsr.w #1,d0
  20891. add.w objoff_38(a0),d0
  20892. move.w d0,y_pos(a0)
  20893. +
  20894. moveq #0,d1
  20895. move.b width_pixels(a0),d1
  20896. moveq #0,d3
  20897. move.b y_radius(a0),d3
  20898. addq.b #1,d3
  20899. move.w (sp)+,d4
  20900. jsrto (PlatformObject2).l, JmpTo_PlatformObject2
  20901. bra.w MarkObjGone
  20902.  
  20903. ; ===========================================================================
  20904. ; loc_10166:
  20905. Obj15_State7:
  20906. move.w x_pos(a0),-(sp)
  20907. bsr.w ObjectMove
  20908. btst #1,status(a0)
  20909. beq.s +
  20910. addi.w #$18,y_vel(a0)
  20911. move.w (Water_Level_2).w,d0
  20912. cmp.w y_pos(a0),d0
  20913. bhi.s ++
  20914. move.w d0,y_pos(a0)
  20915. move.w d0,objoff_38(a0)
  20916. bclr #1,status(a0)
  20917. move.w #$100,x_vel(a0)
  20918. move.w #0,y_vel(a0)
  20919. bra.s ++
  20920. ; ===========================================================================
  20921. +
  20922. moveq #0,d0
  20923. move.b (Oscillating_Data+$14).w,d0
  20924. lsr.w #1,d0
  20925. add.w objoff_38(a0),d0
  20926. move.w d0,y_pos(a0)
  20927. tst.w x_vel(a0)
  20928. beq.s +
  20929. moveq #0,d3
  20930. move.b width_pixels(a0),d3
  20931. jsrto (ObjCheckRightWallDist).l, JmpTo_ObjCheckRightWallDist
  20932. tst.w d1
  20933. bpl.s +
  20934. add.w d1,x_pos(a0)
  20935. move.w #0,x_vel(a0)
  20936. +
  20937. moveq #0,d1
  20938. move.b width_pixels(a0),d1
  20939. moveq #0,d3
  20940. move.b y_radius(a0),d3
  20941. addq.b #1,d3
  20942. move.w (sp)+,d4
  20943. jsrto (PlatformObject2).l, JmpTo_PlatformObject2
  20944. bra.w MarkObjGone
  20945. ; ===========================================================================
  20946. ; ----------------------------------------------------------------------------
  20947. ; sprite mappings
  20948. ; ----------------------------------------------------------------------------
  20949. Obj15_MapUnc_101E8: BINCLUDE "mappings/sprite/obj15_a.bin"
  20950.  
  20951. ; ----------------------------------------------------------------------------
  20952. ; sprite mappings
  20953. ; ----------------------------------------------------------------------------
  20954. Obj15_Obj83_MapUnc_1021E: BINCLUDE "mappings/sprite/obj83.bin"
  20955.  
  20956. ; ----------------------------------------------------------------------------
  20957. ; sprite mappings
  20958. ; ----------------------------------------------------------------------------
  20959. Obj15_Obj7A_MapUnc_10256: offsetTable
  20960. offsetTableEntry.w word_1025E
  20961. offsetTableEntry.w word_10270
  20962. offsetTableEntry.w word_1027A
  20963. offsetTableEntry.w word_1028C
  20964. word_1025E: dc.w 2
  20965. dc.w $F809, $6060, $6030, $FFE8
  20966. dc.w $F809, $6860, $6830, 0
  20967. word_10270: dc.w 1
  20968. dc.w $F805, $6066, $6033, $FFF8
  20969. word_1027A: dc.w 2
  20970. dc.w $E805, $406A, $4035, $FFF4
  20971. dc.w $F80B, $406E, $4037, $FFF4
  20972. word_1028C: dc.w $A
  20973. dc.w $A805, $406A, $4035, $FFF4
  20974. dc.w $B80B, $406E, $4037, $FFF4
  20975. dc.w $C805, $6066, $6033, $FFF8
  20976. dc.w $D805, $6066, $6033, $FFF8
  20977. dc.w $E805, $6066, $6033, $FFF8
  20978. dc.w $F805, $6066, $6033, $FFF8
  20979. dc.w $805, $6066, $6033, $FFF8
  20980. dc.w $1805, $6066, $6033, $FFF8
  20981. dc.w $2805, $6066, $6033, $FFF8
  20982. dc.w $3805, $6066, $6033, $FFF8
  20983.  
  20984. ; ----------------------------------------------------------------------------
  20985. ; sprite mappings
  20986. ; ----------------------------------------------------------------------------
  20987. Obj15_MapUnc_102DE: offsetTable
  20988. offsetTableEntry.w word_102E4
  20989. offsetTableEntry.w word_10270
  20990. offsetTableEntry.w word_1027A
  20991. word_102E4: dc.w 2
  20992. dc.w $F80D, $6058, $602C, $FFE0
  20993. dc.w $F80D, $6858, $682C, 0
  20994.  
  20995. ; ===========================================================================
  20996.  
  20997. if gameRevision<2
  20998. nop
  20999. endif
  21000.  
  21001. if ~~removeJmpTos
  21002. JmpTo_PlatformObject2
  21003. jmp (PlatformObject2).l
  21004. JmpTo2_SingleObjLoad2
  21005. jmp (SingleObjLoad2).l
  21006. JmpTo2_CalcSine
  21007. jmp (CalcSine).l
  21008. JmpTo_ObjCheckRightWallDist
  21009. jmp (ObjCheckRightWallDist).l
  21010.  
  21011. align 4
  21012. endif
  21013.  
  21014.  
  21015.  
  21016.  
  21017. ; ===========================================================================
  21018. ; ----------------------------------------------------------------------------
  21019. ; Object 17 - GHZ rotating log helix spikes (from Sonic 1, unused)
  21020. ; the programming of this was modified somewhat between Sonic 1 and Sonic 2
  21021. ; ----------------------------------------------------------------------------
  21022. ; Sprite_10310:
  21023. Obj17:
  21024. moveq #0,d0
  21025. move.b routine(a0),d0
  21026. move.w Obj17_Index(pc,d0.w),d1
  21027. jmp Obj17_Index(pc,d1.w)
  21028. ; ===========================================================================
  21029. ; off_1031E:
  21030. Obj17_Index: offsetTable
  21031. offsetTableEntry.w Obj17_Init ; 0
  21032. offsetTableEntry.w Obj17_Main ; 2
  21033. offsetTableEntry.w Obj17_Display ; 4
  21034. ; ===========================================================================
  21035. ; loc_10324: Obj17_Main:
  21036. Obj17_Init:
  21037. addq.b #2,routine(a0)
  21038. move.l #Obj17_MapUnc_10452,mappings(a0)
  21039. move.w #make_art_tile(ArtTile_ArtNem_GHZ_Spiked_Log,2,0),art_tile(a0)
  21040. bsr.w Adjust2PArtPointer
  21041. move.b #4,render_flags(a0)
  21042. move.b #3,priority(a0)
  21043. move.b #8,width_pixels(a0)
  21044. move.w y_pos(a0),d2
  21045. move.w x_pos(a0),d3
  21046. _move.b id(a0),d4
  21047. lea subtype(a0),a2 ; move helix length to a2
  21048. moveq #0,d1
  21049. move.b (a2),d1 ; move a2 to d1
  21050. move.b #0,(a2)+
  21051. move.w d1,d0
  21052. lsr.w #1,d0
  21053. lsl.w #4,d0
  21054. sub.w d0,d3
  21055. subq.b #2,d1
  21056. bcs.s Obj17_Main
  21057. moveq #0,d6
  21058. ; loc_10372:
  21059. Obj17_MakeHelix:
  21060. bsr.w SingleObjLoad2
  21061. bne.s Obj17_Main
  21062. addq.b #1,subtype(a0)
  21063. move.w a1,d5
  21064. subi.w #Object_RAM,d5
  21065. if object_size=$40
  21066. lsr.w #6,d5
  21067. else
  21068. divu.w #object_size,d5
  21069. endif
  21070. andi.w #$7F,d5
  21071. move.b d5,(a2)+
  21072. move.b #4,routine(a1)
  21073. _move.b d4,id(a1) ; load obj17
  21074. move.w d2,y_pos(a1)
  21075. move.w d3,x_pos(a1)
  21076. move.l mappings(a0),mappings(a1)
  21077. move.w #make_art_tile(ArtTile_ArtNem_GHZ_Spiked_Log,2,0),art_tile(a1)
  21078. bsr.w Adjust2PArtPointer2
  21079. move.b #4,render_flags(a1)
  21080. move.b #3,priority(a1)
  21081. move.b #8,width_pixels(a1)
  21082. move.b d6,objoff_3E(a1)
  21083. addq.b #1,d6
  21084. andi.b #7,d6
  21085. addi.w #$10,d3
  21086. cmp.w x_pos(a0),d3
  21087. bne.s +
  21088. move.b d6,objoff_3E(a0)
  21089. addq.b #1,d6
  21090. andi.b #7,d6
  21091. addi.w #$10,d3
  21092. addq.b #1,subtype(a0)
  21093. + dbf d1,Obj17_MakeHelix ; repeat d1 times (helix length)
  21094.  
  21095. ; loc_103E8: Obj17_Action:
  21096. Obj17_Main:
  21097. bsr.w Obj17_RotateSpike
  21098. move.w x_pos(a0),d0
  21099. andi.w #$FF80,d0
  21100. sub.w (Camera_X_pos_coarse).w,d0
  21101. cmpi.w #$280,d0
  21102. bhi.w Obj17_DelAll
  21103. bra.w DisplaySprite
  21104. ; ===========================================================================
  21105. ; loc_10404:
  21106. Obj17_DelAll:
  21107. moveq #0,d2
  21108. lea subtype(a0),a2 ; move helix length to a2
  21109. move.b (a2)+,d2 ; move a2 to d2
  21110. subq.b #2,d2
  21111. bcs.s BranchTo2_DeleteObject
  21112. ; loc_10410:
  21113. Obj17_DelLoop:
  21114. moveq #0,d0
  21115. move.b (a2)+,d0
  21116. if object_size=$40
  21117. lsl.w #6,d0
  21118. else
  21119. mulu.w #object_size,d0
  21120. endif
  21121. addi.l #Object_RAM,d0
  21122. movea.l d0,a1 ; a1=object
  21123. bsr.w DeleteObject2 ; delete object
  21124. dbf d2,Obj17_DelLoop ; repeat d2 times (helix length)
  21125. ; loc_10426:
  21126. BranchTo2_DeleteObject
  21127. bra.w DeleteObject
  21128.  
  21129. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  21130.  
  21131. ; sub_1042A:
  21132. Obj17_RotateSpike:
  21133. move.b (Logspike_anim_frame).w,d0
  21134. move.b #0,collision_flags(a0) ; make object harmless
  21135. add.b objoff_3E(a0),d0
  21136. andi.b #7,d0
  21137. move.b d0,mapping_frame(a0) ; change current frame
  21138. bne.s + ; rts
  21139. move.b #%10000100,collision_flags(a0) ; make object harmful
  21140. +
  21141. rts
  21142. ; End of function Obj17_RotateSpike
  21143.  
  21144. ; ===========================================================================
  21145. ; loc_1044A:
  21146. Obj17_Display:
  21147. bsr.w Obj17_RotateSpike
  21148. bra.w DisplaySprite
  21149. ; ===========================================================================
  21150. ; -----------------------------------------------------------------------------
  21151. ; sprite mappings - helix of spikes on a pole (GHZ) (unused)
  21152. ; -----------------------------------------------------------------------------
  21153. Obj17_MapUnc_10452: BINCLUDE "mappings/sprite/obj17.bin"
  21154. ; ===========================================================================
  21155.  
  21156. if gameRevision<2
  21157. nop
  21158. endif
  21159.  
  21160.  
  21161.  
  21162.  
  21163. ; ----------------------------------------------------------------------------
  21164. ; Object 18 - Stationary floating platform from ARZ, EHZ and HTZ
  21165. ; ----------------------------------------------------------------------------
  21166. ; Sprite_104AC:
  21167. Obj18:
  21168. moveq #0,d0
  21169. move.b routine(a0),d0
  21170. move.w Obj18_Index(pc,d0.w),d1
  21171. jmp Obj18_Index(pc,d1.w)
  21172. ; ===========================================================================
  21173. ; off_104BA:
  21174. Obj18_Index: offsetTable
  21175. offsetTableEntry.w Obj18_Init ; 0
  21176. offsetTableEntry.w loc_1056A ; 2
  21177. offsetTableEntry.w BranchTo3_DeleteObject ; 4
  21178. offsetTableEntry.w loc_105A8 ; 6
  21179. offsetTableEntry.w loc_105D4 ; 8
  21180. ; ===========================================================================
  21181. ;word_104C4:
  21182. Obj18_InitData:
  21183. ; width_pixels
  21184. ; frame
  21185. dc.b $20, 0
  21186. dc.b $20, 1
  21187. dc.b $20, 2
  21188. dc.b $40, 3
  21189. dc.b $30, 4
  21190. ; ===========================================================================
  21191. ; loc_104CE:
  21192. Obj18_Init:
  21193. addq.b #2,routine(a0)
  21194. moveq #0,d0
  21195. move.b subtype(a0),d0
  21196. lsr.w #3,d0
  21197. andi.w #$E,d0
  21198. lea Obj18_InitData(pc,d0.w),a2
  21199. move.b (a2)+,width_pixels(a0)
  21200. move.b (a2)+,mapping_frame(a0)
  21201. move.l #Obj18_MapUnc_107F6,mappings(a0)
  21202. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,2,0),art_tile(a0)
  21203. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  21204. bne.s +
  21205. move.l #Obj18_MapUnc_1084E,mappings(a0)
  21206. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,2,0),art_tile(a0)
  21207. +
  21208. bsr.w Adjust2PArtPointer
  21209. move.b #4,render_flags(a0)
  21210. move.b #4,priority(a0)
  21211. move.w y_pos(a0),objoff_2C(a0)
  21212. move.w y_pos(a0),objoff_34(a0)
  21213. move.w x_pos(a0),objoff_32(a0)
  21214. move.w #$80,angle(a0)
  21215. tst.b subtype(a0)
  21216. bpl.s ++
  21217. addq.b #6,routine(a0)
  21218. andi.b #$F,subtype(a0)
  21219. move.b #$30,y_radius(a0)
  21220. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  21221. bne.s +
  21222. move.b #$28,y_radius(a0)
  21223. +
  21224. bset #4,render_flags(a0)
  21225. bra.w loc_105D4
  21226. ; ===========================================================================
  21227. +
  21228. andi.b #$F,subtype(a0)
  21229.  
  21230. loc_1056A:
  21231. move.b status(a0),d0
  21232. andi.b #standing_mask,d0
  21233. bne.s +
  21234. tst.b objoff_38(a0)
  21235. beq.s ++
  21236. subq.b #4,objoff_38(a0)
  21237. bra.s ++
  21238. ; ===========================================================================
  21239. +
  21240. cmpi.b #$40,objoff_38(a0)
  21241. beq.s +
  21242. addq.b #4,objoff_38(a0)
  21243. +
  21244. move.w x_pos(a0),-(sp)
  21245. bsr.w sub_10638
  21246. bsr.w sub_1061E
  21247. moveq #0,d1
  21248. move.b width_pixels(a0),d1
  21249. moveq #8,d3
  21250. move.w (sp)+,d4
  21251. jsrto (PlatformObject).l, JmpTo_PlatformObject
  21252. bra.s loc_105B0
  21253. ; ===========================================================================
  21254.  
  21255. loc_105A8:
  21256. bsr.w sub_10638
  21257. bsr.w sub_1061E
  21258.  
  21259. loc_105B0:
  21260. tst.w (Two_player_mode).w
  21261. beq.s +
  21262. bra.w DisplaySprite
  21263. ; ===========================================================================
  21264. +
  21265. move.w objoff_32(a0),d0
  21266. andi.w #$FF80,d0
  21267. sub.w (Camera_X_pos_coarse).w,d0
  21268. cmpi.w #$280,d0
  21269. bhi.s BranchTo3_DeleteObject
  21270. bra.w DisplaySprite
  21271. ; ===========================================================================
  21272.  
  21273. BranchTo3_DeleteObject
  21274. bra.w DeleteObject
  21275. ; ===========================================================================
  21276.  
  21277. loc_105D4:
  21278. move.b status(a0),d0
  21279. andi.b #standing_mask,d0
  21280. bne.s +
  21281. tst.b objoff_38(a0)
  21282. beq.s ++
  21283. subq.b #4,objoff_38(a0)
  21284. bra.s ++
  21285. ; ===========================================================================
  21286. +
  21287. cmpi.b #$40,objoff_38(a0)
  21288. beq.s +
  21289. addq.b #4,objoff_38(a0)
  21290. +
  21291. move.w x_pos(a0),-(sp)
  21292. bsr.w sub_10638
  21293. bsr.w sub_1061E
  21294. moveq #0,d1
  21295. move.b width_pixels(a0),d1
  21296. addi.w #$B,d1
  21297. moveq #0,d2
  21298. move.b y_radius(a0),d2
  21299. move.w d2,d3
  21300. addq.w #1,d3
  21301. move.w (sp)+,d4
  21302. jsrto (SolidObject).l, JmpTo_SolidObject
  21303. bra.s loc_105B0
  21304.  
  21305. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  21306.  
  21307.  
  21308. sub_1061E:
  21309. move.b objoff_38(a0),d0
  21310. jsrto (CalcSine).l, JmpTo3_CalcSine
  21311. move.w #$400,d1
  21312. muls.w d1,d0
  21313. swap d0
  21314. add.w objoff_2C(a0),d0
  21315. move.w d0,y_pos(a0)
  21316. rts
  21317. ; End of function sub_1061E
  21318.  
  21319.  
  21320. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  21321.  
  21322.  
  21323. sub_10638:
  21324. moveq #0,d0
  21325. move.b subtype(a0),d0
  21326. andi.w #$F,d0
  21327. add.w d0,d0
  21328. move.w Obj18_Behaviours(pc,d0.w),d1
  21329. jmp Obj18_Behaviours(pc,d1.w)
  21330. ; End of function sub_10638
  21331.  
  21332. ; ===========================================================================
  21333. ; off_1064C:
  21334. Obj18_Behaviours: offsetTable
  21335. offsetTableEntry.w return_10668 ; 0
  21336. offsetTableEntry.w loc_1067A ; 1
  21337. offsetTableEntry.w loc_106C0 ; 2
  21338. offsetTableEntry.w loc_106D8 ; 3
  21339. offsetTableEntry.w loc_10702 ; 4
  21340. offsetTableEntry.w loc_1066A ; 5
  21341. offsetTableEntry.w loc_106B0 ; 6
  21342. offsetTableEntry.w loc_10778 ; 7
  21343. offsetTableEntry.w loc_107A4 ; 8
  21344. offsetTableEntry.w return_10668 ; 9
  21345. offsetTableEntry.w loc_107BC ; $A
  21346. offsetTableEntry.w loc_107D6 ; $B
  21347. offsetTableEntry.w loc_106A2 ; $C
  21348. offsetTableEntry.w loc_10692 ; $D
  21349. ; ===========================================================================
  21350.  
  21351. return_10668:
  21352. rts
  21353. ; ===========================================================================
  21354.  
  21355. loc_1066A:
  21356. move.w objoff_32(a0),d0
  21357. move.b angle(a0),d1
  21358. neg.b d1
  21359. addi.b #$40,d1
  21360. bra.s loc_10686
  21361. ; ===========================================================================
  21362.  
  21363. loc_1067A:
  21364. move.w objoff_32(a0),d0
  21365. move.b angle(a0),d1
  21366. subi.b #$40,d1
  21367.  
  21368. loc_10686:
  21369. ext.w d1
  21370. add.w d1,d0
  21371. move.w d0,x_pos(a0)
  21372. bra.w loc_107EE
  21373. ; ===========================================================================
  21374.  
  21375. loc_10692:
  21376. move.w objoff_34(a0),d0
  21377. move.b (Oscillating_Data+$C).w,d1
  21378. neg.b d1
  21379. addi.b #$30,d1
  21380. bra.s loc_106CC
  21381. ; ===========================================================================
  21382.  
  21383. loc_106A2:
  21384. move.w objoff_34(a0),d0
  21385. move.b (Oscillating_Data+$C).w,d1
  21386. subi.b #$30,d1
  21387. bra.s loc_106CC
  21388. ; ===========================================================================
  21389.  
  21390. loc_106B0:
  21391. move.w objoff_34(a0),d0
  21392. move.b angle(a0),d1
  21393. neg.b d1
  21394. addi.b #$40,d1
  21395. bra.s loc_106CC
  21396. ; ===========================================================================
  21397.  
  21398. loc_106C0:
  21399. move.w objoff_34(a0),d0
  21400. move.b angle(a0),d1
  21401. subi.b #$40,d1
  21402.  
  21403. loc_106CC:
  21404. ext.w d1
  21405. add.w d1,d0
  21406. move.w d0,objoff_2C(a0)
  21407. bra.w loc_107EE
  21408. ; ===========================================================================
  21409.  
  21410. loc_106D8:
  21411. tst.w objoff_3A(a0)
  21412. bne.s loc_106F0
  21413. move.b status(a0),d0
  21414. andi.b #standing_mask,d0
  21415. beq.s + ; rts
  21416. move.w #$1E,objoff_3A(a0)
  21417. /
  21418. rts
  21419. ; ===========================================================================
  21420.  
  21421. loc_106F0:
  21422. subq.w #1,objoff_3A(a0)
  21423. bne.s - ; rts
  21424. move.w #$20,objoff_3A(a0)
  21425. addq.b #1,subtype(a0)
  21426. rts
  21427. ; ===========================================================================
  21428.  
  21429. loc_10702:
  21430. tst.w objoff_3A(a0)
  21431. beq.s loc_10730
  21432. subq.w #1,objoff_3A(a0)
  21433. bne.s loc_10730
  21434. bclr #p1_standing_bit,status(a0)
  21435. beq.s +
  21436. lea (MainCharacter).w,a1 ; a1=character
  21437. bsr.s sub_1075E
  21438. +
  21439. bclr #p2_standing_bit,status(a0)
  21440. beq.s +
  21441. lea (Sidekick).w,a1 ; a1=character
  21442. bsr.s sub_1075E
  21443. +
  21444. move.b #6,routine(a0)
  21445.  
  21446. loc_10730:
  21447. move.l objoff_2C(a0),d3
  21448. move.w y_vel(a0),d0
  21449. ext.l d0
  21450. asl.l #8,d0
  21451. add.l d0,d3
  21452. move.l d3,objoff_2C(a0)
  21453. addi.w #$38,y_vel(a0)
  21454. move.w (Camera_Max_Y_pos_now).w,d0
  21455. addi.w #$120,d0
  21456. cmp.w objoff_2C(a0),d0
  21457. bhs.s + ; rts
  21458. move.b #4,routine(a0)
  21459. +
  21460. rts
  21461.  
  21462. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  21463.  
  21464.  
  21465. sub_1075E:
  21466. bset #1,status(a1)
  21467. bclr #3,status(a1)
  21468. move.b #2,routine(a1)
  21469. move.w y_vel(a0),y_vel(a1)
  21470. rts
  21471. ; End of function sub_1075E
  21472.  
  21473. ; ===========================================================================
  21474.  
  21475. loc_10778:
  21476. tst.w objoff_3A(a0)
  21477. bne.s loc_10798
  21478. lea (ButtonVine_Trigger).w,a2
  21479. moveq #0,d0
  21480. move.b subtype(a0),d0
  21481. lsr.w #4,d0
  21482. tst.b (a2,d0.w)
  21483. beq.s + ; rts
  21484. move.w #$3C,objoff_3A(a0)
  21485. /
  21486. rts
  21487. ; ===========================================================================
  21488.  
  21489. loc_10798:
  21490. subq.w #1,objoff_3A(a0)
  21491. bne.s - ; rts
  21492. addq.b #1,subtype(a0)
  21493. rts
  21494. ; ===========================================================================
  21495.  
  21496. loc_107A4:
  21497. subq.w #2,objoff_2C(a0)
  21498. move.w objoff_34(a0),d0
  21499. subi.w #$200,d0
  21500. cmp.w objoff_2C(a0),d0
  21501. bne.s + ; rts
  21502. clr.b subtype(a0)
  21503. +
  21504. rts
  21505. ; ===========================================================================
  21506.  
  21507. loc_107BC:
  21508. move.w objoff_34(a0),d0
  21509. move.b angle(a0),d1
  21510. subi.b #$40,d1
  21511. ext.w d1
  21512. asr.w #1,d1
  21513. add.w d1,d0
  21514. move.w d0,objoff_2C(a0)
  21515. bra.w loc_107EE
  21516. ; ===========================================================================
  21517.  
  21518. loc_107D6:
  21519. move.w objoff_34(a0),d0
  21520. move.b angle(a0),d1
  21521. neg.b d1
  21522. addi.b #$40,d1
  21523. ext.w d1
  21524. asr.w #1,d1
  21525. add.w d1,d0
  21526. move.w d0,objoff_2C(a0)
  21527.  
  21528. loc_107EE:
  21529. move.b (Oscillating_Data+$18).w,angle(a0)
  21530. rts
  21531. ; ===========================================================================
  21532. ; -------------------------------------------------------------------------------
  21533. ; sprite mappings
  21534. ; -------------------------------------------------------------------------------
  21535. Obj18_MapUnc_107F6: BINCLUDE "mappings/sprite/obj18_a.bin"
  21536. ; -------------------------------------------------------------------------------
  21537. ; sprite mappings
  21538. ; -------------------------------------------------------------------------------
  21539. Obj18_MapUnc_1084E: BINCLUDE "mappings/sprite/obj18_b.bin"
  21540. ; ===========================================================================
  21541.  
  21542. if gameRevision<2
  21543. nop
  21544. endif
  21545.  
  21546. if ~~removeJmpTos
  21547. JmpTo3_CalcSine
  21548. jmp (CalcSine).l
  21549. JmpTo_PlatformObject
  21550. jmp (PlatformObject).l
  21551. JmpTo_SolidObject
  21552. jmp (SolidObject).l
  21553.  
  21554. align 4
  21555. endif
  21556.  
  21557.  
  21558.  
  21559.  
  21560. ; ===========================================================================
  21561. ; ----------------------------------------------------------------------------
  21562. ; Object 1A - Collapsing platform from HPZ (and GHZ)
  21563. ; also supports OOZ, but never made use of
  21564. ;
  21565. ; Unlike Object 1F, this supports sloped platforms and subtype-dependant
  21566. ; mappings. Both are used by GHZ, the latter to allow different shading
  21567. ; on right-facing ledges.
  21568. ; ----------------------------------------------------------------------------
  21569. ; Sprite_108BC:
  21570. Obj1A:
  21571. moveq #0,d0
  21572. move.b routine(a0),d0
  21573. move.w Obj1A_Index(pc,d0.w),d1
  21574. jmp Obj1A_Index(pc,d1.w)
  21575. ; ===========================================================================
  21576. ; off_108CA:
  21577. Obj1A_Index: offsetTable
  21578. offsetTableEntry.w Obj1A_Init ; 0
  21579. offsetTableEntry.w Obj1A_Main ; 2
  21580. offsetTableEntry.w Obj1A_Fragment ; 4
  21581. ; ===========================================================================
  21582.  
  21583. collapsing_platform_delay_pointer = objoff_34
  21584. collapsing_platform_delay_counter = objoff_38
  21585. collapsing_platform_stood_on_flag = objoff_3A
  21586. collapsing_platform_slope_pointer = objoff_3C
  21587.  
  21588. ; loc_108D0:
  21589. Obj1A_Init:
  21590. addq.b #2,routine(a0)
  21591. move.l #Obj1A_MapUnc_10C6C,mappings(a0)
  21592. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,2,0),art_tile(a0)
  21593. bsr.w Adjust2PArtPointer
  21594. ori.b #4,render_flags(a0)
  21595. move.b #4,priority(a0)
  21596. move.b #7,collapsing_platform_delay_counter(a0)
  21597. move.b subtype(a0),mapping_frame(a0)
  21598. move.l #Obj1A_DelayData,collapsing_platform_delay_pointer(a0)
  21599. cmpi.b #hidden_palace_zone,(Current_Zone).w
  21600. bne.s +
  21601. move.l #Obj1A_MapUnc_1101C,mappings(a0)
  21602. move.w #make_art_tile(ArtTile_ArtNem_HPZPlatform,2,0),art_tile(a0)
  21603. bsr.w Adjust2PArtPointer
  21604. move.b #$30,width_pixels(a0)
  21605. move.l #Obj1A_HPZ_SlopeData,collapsing_platform_slope_pointer(a0)
  21606. move.l #Obj1A_HPZ_DelayData,collapsing_platform_delay_pointer(a0)
  21607. bra.s Obj1A_Main
  21608. ; ===========================================================================
  21609. +
  21610. cmpi.b #oil_ocean_zone,(Current_Zone).w
  21611. bne.s +
  21612. move.l #Obj1F_MapUnc_110C6,mappings(a0)
  21613. move.w #make_art_tile(ArtTile_ArtNem_OOZPlatform,3,0),art_tile(a0)
  21614. bsr.w Adjust2PArtPointer
  21615. move.b #$40,width_pixels(a0)
  21616. move.l #Obj1A_OOZ_SlopeData,collapsing_platform_slope_pointer(a0)
  21617. bra.s Obj1A_Main
  21618. ; ===========================================================================
  21619. +
  21620. move.l #Obj1A_GHZ_SlopeData,collapsing_platform_slope_pointer(a0)
  21621. move.b #$34,width_pixels(a0)
  21622. move.b #$38,y_radius(a0)
  21623. bset #4,render_flags(a0)
  21624. ; loc_1097C:
  21625. Obj1A_Main:
  21626. tst.b collapsing_platform_stood_on_flag(a0)
  21627. beq.s +
  21628. tst.b collapsing_platform_delay_counter(a0)
  21629. beq.w Obj1A_CreateFragments ; time up; collapse
  21630. subq.b #1,collapsing_platform_delay_counter(a0)
  21631. +
  21632. move.b status(a0),d0
  21633. andi.b #standing_mask,d0
  21634. beq.s sub_1099E
  21635. move.b #1,collapsing_platform_stood_on_flag(a0)
  21636.  
  21637. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  21638.  
  21639.  
  21640. sub_1099E:
  21641. moveq #0,d1
  21642. move.b width_pixels(a0),d1
  21643. movea.l collapsing_platform_slope_pointer(a0),a2 ; a2=object
  21644. move.w x_pos(a0),d4
  21645. jsrto (SlopedPlatform).l, JmpTo_SlopedPlatform
  21646. bra.w MarkObjGone
  21647. ; End of function sub_1099E
  21648.  
  21649. ; ===========================================================================
  21650. ; loc_109B4:
  21651. Obj1A_Fragment:
  21652. tst.b collapsing_platform_delay_counter(a0)
  21653. beq.s Obj1A_FragmentFall ; time up; collapse
  21654. tst.b collapsing_platform_stood_on_flag(a0)
  21655. bne.s +
  21656. subq.b #1,collapsing_platform_delay_counter(a0)
  21657. bra.w DisplaySprite
  21658. ; ===========================================================================
  21659. +
  21660. bsr.w sub_1099E
  21661. subq.b #1,collapsing_platform_delay_counter(a0)
  21662. bne.s +
  21663. lea (MainCharacter).w,a1 ; a1=character
  21664. bsr.s sub_109DC
  21665. lea (Sidekick).w,a1 ; a1=character
  21666.  
  21667. sub_109DC:
  21668. btst #3,status(a1)
  21669. beq.s +
  21670. bclr #3,status(a1)
  21671. bclr #5,status(a1)
  21672. move.b #AniIDSonAni_Run,next_anim(a1)
  21673. +
  21674. rts
  21675. ; End of function sub_109DC
  21676.  
  21677. ; ===========================================================================
  21678. ; loc_109F8:
  21679. Obj1A_FragmentFall:
  21680. bsr.w ObjectMoveAndFall
  21681. tst.b render_flags(a0)
  21682. bpl.w DeleteObject
  21683. bra.w DisplaySprite
  21684. ; ===========================================================================
  21685. ; ----------------------------------------------------------------------------
  21686. ; Object 1F - Collapsing platform from ARZ, MCZ and OOZ (and MZ, SLZ and SBZ)
  21687. ; ----------------------------------------------------------------------------
  21688. ; Sprite_10A08:
  21689. Obj1F:
  21690. moveq #0,d0
  21691. move.b routine(a0),d0
  21692. move.w Obj1F_Index(pc,d0.w),d1
  21693. jmp Obj1F_Index(pc,d1.w)
  21694. ; ===========================================================================
  21695. ; off_10A16:
  21696. Obj1F_Index: offsetTable
  21697. offsetTableEntry.w Obj1F_Init ; 0
  21698. offsetTableEntry.w Obj1F_Main ; 2
  21699. offsetTableEntry.w Obj1F_Fragment ; 4
  21700. ; ===========================================================================
  21701. ; loc_10A1C:
  21702. Obj1F_Init:
  21703. addq.b #2,routine(a0)
  21704. move.l #Obj1F_MapUnc_10F0C,mappings(a0)
  21705. move.w #make_art_tile(ArtTile_ArtNem_MZ_Platform,2,0),art_tile(a0)
  21706. ori.b #4,render_flags(a0)
  21707. move.b #4,priority(a0)
  21708. move.b #7,collapsing_platform_delay_counter(a0)
  21709. move.b #$44,width_pixels(a0)
  21710. lea (Obj1F_DelayData_EvenSubtype).l,a4
  21711. btst #0,subtype(a0)
  21712. beq.s +
  21713. lea (Obj1F_DelayData_OddSubtype).l,a4
  21714. +
  21715. move.l a4,collapsing_platform_delay_pointer(a0)
  21716. cmpi.b #oil_ocean_zone,(Current_Zone).w
  21717. bne.s +
  21718. move.l #Obj1F_MapUnc_110C6,mappings(a0)
  21719. move.w #make_art_tile(ArtTile_ArtNem_OOZPlatform,3,0),art_tile(a0)
  21720. bsr.w Adjust2PArtPointer
  21721. move.b #$40,width_pixels(a0)
  21722. move.l #Obj1F_OOZ_DelayData,collapsing_platform_delay_pointer(a0)
  21723. +
  21724. cmpi.b #mystic_cave_zone,(Current_Zone).w
  21725. bne.s +
  21726. move.l #Obj1F_MapUnc_11106,mappings(a0)
  21727. move.w #make_art_tile(ArtTile_ArtNem_MCZCollapsePlat,3,0),art_tile(a0)
  21728. bsr.w Adjust2PArtPointer
  21729. move.b #$20,width_pixels(a0)
  21730. move.l #Obj1F_MCZ_DelayData,collapsing_platform_delay_pointer(a0)
  21731. +
  21732. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  21733. bne.s Obj1F_Main
  21734. move.l #Obj1F_MapUnc_1115E,mappings(a0)
  21735. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,2,0),art_tile(a0)
  21736. bsr.w Adjust2PArtPointer
  21737. move.b #$20,width_pixels(a0)
  21738. move.l #Obj1F_ARZ_DelayData,collapsing_platform_delay_pointer(a0)
  21739. ; loc_10AD6:
  21740. Obj1F_Main:
  21741. tst.b collapsing_platform_stood_on_flag(a0)
  21742. beq.s +
  21743. tst.b collapsing_platform_delay_counter(a0)
  21744. beq.w Obj1F_CreateFragments ; time up; collapse
  21745. subq.b #1,collapsing_platform_delay_counter(a0)
  21746. +
  21747. move.b status(a0),d0
  21748. andi.b #standing_mask,d0
  21749. beq.s sub_10AF8
  21750. move.b #1,collapsing_platform_stood_on_flag(a0)
  21751.  
  21752. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  21753.  
  21754.  
  21755. sub_10AF8:
  21756. moveq #0,d1
  21757. move.b width_pixels(a0),d1
  21758. move.w #$10,d3
  21759. move.w x_pos(a0),d4
  21760. jsrto (PlatformObject).l, JmpTo2_PlatformObject
  21761. bra.w MarkObjGone
  21762. ; End of function sub_10AF8
  21763.  
  21764. ; ===========================================================================
  21765. ; loc_10B0E:
  21766. Obj1F_Fragment:
  21767. tst.b collapsing_platform_delay_counter(a0)
  21768. beq.s Obj1F_FragmentFall ; time up; collapse
  21769. tst.b collapsing_platform_stood_on_flag(a0)
  21770. bne.s +
  21771. subq.b #1,collapsing_platform_delay_counter(a0)
  21772. bra.w DisplaySprite
  21773. ; ===========================================================================
  21774. +
  21775. bsr.w sub_10AF8
  21776. subq.b #1,collapsing_platform_delay_counter(a0)
  21777. bne.s + ; rts
  21778. lea (MainCharacter).w,a1 ; a1=character
  21779. bsr.s sub_10B36
  21780. lea (Sidekick).w,a1 ; a1=character
  21781.  
  21782. sub_10B36:
  21783. btst #3,status(a1)
  21784. beq.s + ; rts
  21785. bclr #3,status(a1)
  21786. bclr #5,status(a1)
  21787. move.b #AniIDSonAni_Run,next_anim(a1)
  21788. +
  21789. rts
  21790. ; End of function sub_10B36
  21791.  
  21792. ; ===========================================================================
  21793. ; loc_10B52:
  21794. Obj1F_FragmentFall:
  21795. bsr.w ObjectMoveAndFall
  21796. tst.b render_flags(a0)
  21797. bpl.w DeleteObject
  21798. bra.w DisplaySprite
  21799. ; ===========================================================================
  21800. ; loc_10B62:
  21801. Obj1F_CreateFragments:
  21802. addq.b #1,mapping_frame(a0)
  21803. bra.s +
  21804. ; ===========================================================================
  21805. ; loc_10B68:
  21806. Obj1A_CreateFragments:
  21807. addq.b #2,mapping_frame(a0)
  21808. +
  21809. movea.l collapsing_platform_delay_pointer(a0),a4
  21810. moveq #0,d0
  21811. move.b mapping_frame(a0),d0
  21812. add.w d0,d0
  21813. movea.l mappings(a0),a3
  21814. adda.w (a3,d0.w),a3
  21815. move.w (a3)+,d1
  21816. subq.w #1,d1
  21817. bset #5,render_flags(a0)
  21818. _move.b id(a0),d4
  21819. move.b render_flags(a0),d5
  21820. movea.l a0,a1
  21821. bra.s +
  21822. ; ===========================================================================
  21823. - bsr.w SingleObjLoad
  21824. bne.s +++
  21825. addq.w #8,a3
  21826. +
  21827. move.b #4,routine(a1)
  21828. _move.b d4,id(a1) ; load obj1F
  21829. move.l a3,mappings(a1)
  21830. move.b d5,render_flags(a1)
  21831. move.w x_pos(a0),x_pos(a1)
  21832. move.w y_pos(a0),y_pos(a1)
  21833. move.w art_tile(a0),art_tile(a1)
  21834. move.b priority(a0),priority(a1)
  21835. move.b width_pixels(a0),width_pixels(a1)
  21836. move.b y_radius(a0),y_radius(a1)
  21837. move.b (a4)+,collapsing_platform_delay_counter(a1)
  21838. cmpa.l a0,a1
  21839. bhs.s +
  21840. bsr.w DisplaySprite2
  21841. + dbf d1,-
  21842. +
  21843. bsr.w DisplaySprite
  21844. move.w #SndID_Smash,d0
  21845. jmp (PlaySound).l
  21846. ; ===========================================================================
  21847. ; Delay data for obj1A in all but HPZ:
  21848. ;byte_10BF2:
  21849. Obj1A_DelayData:
  21850. dc.b $1C,$18,$14,$10,$1A,$16,$12, $E, $A, 6,$18,$14,$10, $C, 8, 4
  21851. dc.b $16,$12, $E, $A, 6, 2,$14,$10, $C; 16
  21852. rev02even
  21853. ; Delay data for obj1A in HPZ:
  21854. ;byte_10C0B:
  21855. Obj1A_HPZ_DelayData:
  21856. dc.b $18,$1C,$20,$1E,$1A,$16, 6, $E,$14,$12, $A, 2
  21857. rev02even
  21858. ; Delay data for obj1F even subtypes in all levels without more specific data:
  21859. ;byte_10C17:
  21860. Obj1F_DelayData_EvenSubtype:
  21861. dc.b $1E,$16, $E, 6,$1A,$12, $A, 2
  21862. rev02even
  21863. ; Delay data for obj1F odd subtypes in all levels without more specific data:
  21864. ;byte_10C1F:
  21865. Obj1F_DelayData_OddSubtype:
  21866. dc.b $16,$1E,$1A,$12, 6, $E, $A, 2
  21867. rev02even
  21868. ; Delay data for obj1F in OOZ:
  21869. ;byte_10C27:
  21870. Obj1F_OOZ_DelayData:
  21871. dc.b $1A,$12, $A, 2,$16, $E, 6
  21872. rev02even
  21873. ; Delay data for obj1F in MCZ:
  21874. ;byte_10C2E:
  21875. Obj1F_MCZ_DelayData:
  21876. dc.b $1A,$16,$12, $E, $A, 2
  21877. rev02even
  21878. ; Delay data for obj1F in ARZ:
  21879. ;byte_10C34:
  21880. Obj1F_ARZ_DelayData:
  21881. dc.b $16,$1A,$18,$12, 6, $E, $A, 2
  21882. rev02even
  21883. ; S1 remnant: Height data for GHZ collapsing platform (unused):
  21884. ;byte_10C3C:
  21885. Obj1A_GHZ_SlopeData:
  21886. dc.b $20,$20,$20,$20,$20,$20,$20,$20,$21,$21,$22,$22,$23,$23,$24,$24
  21887. dc.b $25,$25,$26,$26,$27,$27,$28,$28,$29,$29,$2A,$2A,$2B,$2B,$2C,$2C; 16
  21888. dc.b $2D,$2D,$2E,$2E,$2F,$2F,$30,$30,$30,$30,$30,$30,$30,$30,$30,$30; 32
  21889. even
  21890. ; -------------------------------------------------------------------------------
  21891. ; unused sprite mappings (GHZ)
  21892. ; -------------------------------------------------------------------------------
  21893. Obj1A_MapUnc_10C6C: BINCLUDE "mappings/sprite/obj1A_a.bin"
  21894. ; ----------------------------------------------------------------------------
  21895. ; unused sprite mappings (MZ, SLZ, SBZ)
  21896. ; ----------------------------------------------------------------------------
  21897. Obj1F_MapUnc_10F0C: BINCLUDE "mappings/sprite/obj1F_a.bin"
  21898.  
  21899. ; Slope data for platforms.
  21900. ;byte_10FDC:
  21901. Obj1A_OOZ_SlopeData:
  21902. dc.b $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
  21903. ;byte_10FEC:
  21904. Obj1A_HPZ_SlopeData
  21905. dc.b $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
  21906. dc.b $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
  21907. dc.b $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
  21908. ; ----------------------------------------------------------------------------
  21909. ; sprite mappings (HPZ)
  21910. ; ----------------------------------------------------------------------------
  21911. Obj1A_MapUnc_1101C: BINCLUDE "mappings/sprite/obj1A_b.bin"
  21912. ; ----------------------------------------------------------------------------
  21913. ; sprite mappings (OOZ)
  21914. ; ----------------------------------------------------------------------------
  21915. Obj1F_MapUnc_110C6: BINCLUDE "mappings/sprite/obj1F_b.bin"
  21916. ; -------------------------------------------------------------------------------
  21917. ; sprite mappings (MCZ)
  21918. ; -------------------------------------------------------------------------------
  21919. Obj1F_MapUnc_11106: BINCLUDE "mappings/sprite/obj1F_c.bin"
  21920. ; -------------------------------------------------------------------------------
  21921. ; sprite mappings (ARZ)
  21922. ; -------------------------------------------------------------------------------
  21923. Obj1F_MapUnc_1115E: BINCLUDE "mappings/sprite/obj1F_d.bin"
  21924. ; ===========================================================================
  21925.  
  21926. if gameRevision<2
  21927. nop
  21928. endif
  21929.  
  21930. if ~~removeJmpTos
  21931. JmpTo_SlopedPlatform
  21932. jmp (SlopedPlatform).l
  21933. JmpTo2_PlatformObject
  21934. jmp (PlatformObject).l
  21935.  
  21936. align 4
  21937. endif
  21938.  
  21939.  
  21940.  
  21941.  
  21942. ; ===========================================================================
  21943. ; ----------------------------------------------------------------------------
  21944. ; Object 1C - Bridge stake in Emerald Hill Zone and Hill Top Zone, falling oil in Oil Ocean Zone
  21945. ; ----------------------------------------------------------------------------
  21946. ; Sprite_111D4:
  21947. Obj1C:
  21948. moveq #0,d0
  21949. move.b routine(a0),d0
  21950. move.w Obj1C_Index(pc,d0.w),d1
  21951. jmp Obj1C_Index(pc,d1.w)
  21952. ; ===========================================================================
  21953. ; off_111E2:
  21954. Obj1C_Index: offsetTable
  21955. offsetTableEntry.w Obj1C_Init ; 0
  21956. offsetTableEntry.w BranchTo_MarkObjGone ; 2
  21957. ; ===========================================================================
  21958.  
  21959. objsubdecl macro frame, mapaddr,artaddr,width,priority
  21960. dc.l frame<<24|mapaddr
  21961. dc.w artaddr
  21962. dc.b width, priority
  21963. endm
  21964.  
  21965. ; dword_111E6:
  21966. Obj1C_InitData:
  21967. objsubdecl 0, Obj1C_MapUnc_11552, make_art_tile(ArtTile_ArtNem_BoltEnd_Rope,2,0), 4, 6
  21968. objsubdecl 1, Obj1C_MapUnc_11552, make_art_tile(ArtTile_ArtNem_BoltEnd_Rope,2,0), 4, 6
  21969. objsubdecl 1, Obj11_MapUnc_FC70, make_art_tile(ArtTile_ArtNem_EHZ_Bridge,2,0), 4, 1
  21970. objsubdecl 2, Obj1C_MapUnc_11552, make_art_tile(ArtTile_ArtNem_BoltEnd_Rope,1,0), $10, 6
  21971. objsubdecl 3, Obj16_MapUnc_21F14, make_art_tile(ArtTile_ArtNem_HtzZipline,2,0), 8, 4
  21972. objsubdecl 4, Obj16_MapUnc_21F14, make_art_tile(ArtTile_ArtNem_HtzZipline,2,0), 8, 4
  21973. objsubdecl 1, Obj16_MapUnc_21F14, make_art_tile(ArtTile_ArtNem_HtzZipline,2,0), $20, 1
  21974. objsubdecl 0, Obj1C_MapUnc_113D6, make_art_tile(ArtTile_ArtKos_LevelArt,2,0), 8, 1
  21975. objsubdecl 1, Obj1C_MapUnc_113D6, make_art_tile(ArtTile_ArtKos_LevelArt,2,0), 8, 1
  21976. objsubdecl 0, Obj1C_MapUnc_113EE, make_art_tile(ArtTile_ArtUnc_Waterfall3,2,0), 4, 4
  21977. objsubdecl 0, Obj1C_MapUnc_11406, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 4, 4
  21978. objsubdecl 1, Obj1C_MapUnc_11406, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 4, 4
  21979. objsubdecl 2, Obj1C_MapUnc_11406, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 4, 4
  21980. objsubdecl 3, Obj1C_MapUnc_11406, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 4, 4
  21981. objsubdecl 4, Obj1C_MapUnc_11406, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 4, 4
  21982. objsubdecl 5, Obj1C_MapUnc_11406, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 4, 4
  21983. objsubdecl 0, Obj1C_MapUnc_114AE, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), $18, 4
  21984. objsubdecl 1, Obj1C_MapUnc_114AE, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), $18, 4
  21985. objsubdecl 2, Obj1C_MapUnc_114AE, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 8, 4
  21986. objsubdecl 3, Obj1C_MapUnc_114AE, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 8, 4
  21987. objsubdecl 4, Obj1C_MapUnc_114AE, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0), 8, 4
  21988. ; byte_1128E:
  21989. Obj1C_Radii:
  21990. dc.b 0
  21991. dc.b 0 ; 1
  21992. dc.b 0 ; 2
  21993. dc.b 0 ; 3
  21994. dc.b 0 ; 4
  21995. dc.b 0 ; 5
  21996. dc.b 0 ; 6
  21997. dc.b 0 ; 7
  21998. dc.b 0 ; 8
  21999. dc.b 0 ; 9
  22000. dc.b 0 ; 10
  22001. dc.b 0 ; 11
  22002. dc.b 0 ; 12
  22003. dc.b $30 ; 13
  22004. dc.b $40 ; 14
  22005. dc.b $60 ; 15
  22006. dc.b 0 ; 16
  22007. dc.b 0 ; 17
  22008. dc.b $30 ; 18
  22009. dc.b $40 ; 19
  22010. dc.b $50 ; 20
  22011. dc.b 0 ; 21
  22012. ; ===========================================================================
  22013. ; loc_112A4:
  22014. Obj1C_Init:
  22015. addq.b #2,routine(a0)
  22016. moveq #0,d0
  22017. move.b subtype(a0),d0
  22018. move.w d0,d1
  22019. lsl.w #3,d0
  22020. lea Obj1C_InitData(pc),a1
  22021. lea (a1,d0.w),a1
  22022. move.b (a1),mapping_frame(a0)
  22023. move.l (a1)+,mappings(a0)
  22024. move.w (a1)+,art_tile(a0)
  22025. bsr.w Adjust2PArtPointer
  22026. ori.b #4,render_flags(a0)
  22027. move.b (a1)+,width_pixels(a0)
  22028. move.b (a1)+,priority(a0)
  22029. lea Obj1C_Radii(pc),a1
  22030. move.b (a1,d1.w),d1
  22031. beq.s BranchTo_MarkObjGone ; if the radius is zero, branch
  22032. move.b d1,y_radius(a0)
  22033. bset #4,render_flags(a0)
  22034.  
  22035. BranchTo_MarkObjGone
  22036. bra.w MarkObjGone
  22037. ; ===========================================================================
  22038. ; ----------------------------------------------------------------------------
  22039. ; Object 71 - Bridge stake and pulsing orb from Hidden Palace Zone
  22040. ; ----------------------------------------------------------------------------
  22041. ; Sprite_112F0:
  22042. Obj71:
  22043. moveq #0,d0
  22044. move.b routine(a0),d0
  22045. move.w Obj71_Index(pc,d0.w),d1
  22046. jmp Obj71_Index(pc,d1.w)
  22047. ; ===========================================================================
  22048. ; off_112FE:
  22049. Obj71_Index: offsetTable
  22050. offsetTableEntry.w Obj71_Init ; 0
  22051. offsetTableEntry.w Obj71_Main ; 2
  22052. ; ---------------------------------------------------------------------------
  22053. ; dword_11302:
  22054. Obj71_InitData:
  22055. objsubdecl 3, Obj11_MapUnc_FC28, make_art_tile(ArtTile_ArtNem_HPZ_Bridge,3,0), 4, 1 ; Hidden Palace bridge
  22056. objsubdecl 0, Obj71_MapUnc_11396, make_art_tile(ArtTile_ArtNem_HPZOrb,3,1), $10, 1 ; Hidden Palace pulsing orb
  22057. objsubdecl 0, Obj71_MapUnc_11576, make_art_tile(ArtTile_ArtNem_MtzLavaBubble,2,0), $10, 1 ; MTZ lava bubble
  22058. ; ===========================================================================
  22059. ; loc_1131A:
  22060. Obj71_Init:
  22061. addq.b #2,routine(a0)
  22062. move.b subtype(a0),d0
  22063. andi.w #$F,d0
  22064. lsl.w #3,d0
  22065. lea Obj71_InitData(pc),a1
  22066. lea (a1,d0.w),a1
  22067. move.b (a1),mapping_frame(a0)
  22068. move.l (a1)+,mappings(a0)
  22069. move.w (a1)+,art_tile(a0)
  22070. bsr.w Adjust2PArtPointer
  22071. ori.b #4,render_flags(a0)
  22072. move.b (a1)+,width_pixels(a0)
  22073. move.b (a1)+,priority(a0)
  22074. move.b subtype(a0),d0
  22075. andi.w #$F0,d0
  22076. lsr.b #4,d0
  22077. move.b d0,anim(a0)
  22078. ; loc_1135C:
  22079. Obj71_Main:
  22080. lea (Ani_obj71).l,a1
  22081. bsr.w AnimateSprite
  22082. bra.w MarkObjGone
  22083. ; ===========================================================================
  22084. ; off_1136A:
  22085. Ani_obj71: offsetTable
  22086. offsetTableEntry.w byte_11372 ; 0
  22087. offsetTableEntry.w byte_1137A ; 1
  22088. offsetTableEntry.w byte_11389 ; 2
  22089. offsetTableEntry.w byte_11392 ; 3
  22090. byte_11372: dc.b 8, 3, 3, 4, 5, 5, 4,$FF
  22091. rev02even
  22092. byte_1137A: dc.b 5, 0, 0, 0, 1, 2, 3, 3, 2, 1, 2, 3, 3, 1,$FF
  22093. rev02even
  22094. byte_11389: dc.b $B, 0, 1, 2, 3, 4, 5,$FD, 3
  22095. rev02even
  22096. byte_11392: dc.b $7F, 6,$FD, 2
  22097. even
  22098.  
  22099. ; --------------------------------------------------------------------------------
  22100. ; sprite mappings
  22101. ; --------------------------------------------------------------------------------
  22102. Obj71_MapUnc_11396: BINCLUDE "mappings/sprite/obj71_a.bin"
  22103. ; ----------------------------------------------------------------------------------------
  22104. ; Unknown sprite mappings
  22105. ; ----------------------------------------------------------------------------------------
  22106. Obj1C_MapUnc_113D6: BINCLUDE "mappings/sprite/obj1C_a.bin"
  22107. ; --------------------------------------------------------------------------------
  22108. ; Unknown sprite mappings
  22109. ; --------------------------------------------------------------------------------
  22110. Obj1C_MapUnc_113EE: BINCLUDE "mappings/sprite/obj1C_b.bin"
  22111. ; -------------------------------------------------------------------------------
  22112. ; sprite mappings
  22113. ; -------------------------------------------------------------------------------
  22114. Obj1C_MapUnc_11406: BINCLUDE "mappings/sprite/obj1C_c.bin"
  22115. ; --------------------------------------------------------------------------------
  22116. ; sprite mappings
  22117. ; --------------------------------------------------------------------------------
  22118. Obj1C_MapUnc_114AE: BINCLUDE "mappings/sprite/obj1C_d.bin"
  22119. ; --------------------------------------------------------------------------------
  22120. ; sprite mappings
  22121. ; --------------------------------------------------------------------------------
  22122. Obj1C_MapUnc_11552: BINCLUDE "mappings/sprite/obj1C_e.bin"
  22123. ; ----------------------------------------------------------------------------
  22124. ; sprite mappings
  22125. ; ----------------------------------------------------------------------------
  22126. Obj71_MapUnc_11576: BINCLUDE "mappings/sprite/obj71_b.bin"
  22127. ; ===========================================================================
  22128.  
  22129. if gameRevision<2
  22130. nop
  22131. endif
  22132.  
  22133.  
  22134.  
  22135.  
  22136. ; ----------------------------------------------------------------------------
  22137. ; Object 2A - Stomper from MCZ
  22138. ; ----------------------------------------------------------------------------
  22139. ; Sprite_115C4:
  22140. Obj2A:
  22141. moveq #0,d0
  22142. move.b routine(a0),d0
  22143. move.w Obj2A_Index(pc,d0.w),d1
  22144. jmp Obj2A_Index(pc,d1.w)
  22145. ; ===========================================================================
  22146. ; off_115D2:
  22147. Obj2A_Index: offsetTable
  22148. offsetTableEntry.w Obj2A_Init ; 0
  22149. offsetTableEntry.w Obj2A_Main ; 2
  22150. ; ===========================================================================
  22151. ; loc_115D6:
  22152. Obj2A_Init:
  22153. addq.b #2,routine(a0)
  22154. move.l #Obj2A_MapUnc_11666,mappings(a0)
  22155. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,2,0),art_tile(a0)
  22156. bsr.w Adjust2PArtPointer
  22157. ori.b #4,render_flags(a0)
  22158. move.b #$10,width_pixels(a0)
  22159. move.b #4,priority(a0)
  22160. move.w y_pos(a0),objoff_32(a0)
  22161. move.b #$50,y_radius(a0)
  22162. bset #4,render_flags(a0)
  22163. ; loc_11610:
  22164. Obj2A_Main:
  22165. tst.b routine_secondary(a0)
  22166. bne.s +
  22167. addq.w #1,objoff_30(a0)
  22168. cmpi.w #$60,objoff_30(a0)
  22169. bne.s ++
  22170. move.b #2,routine_secondary(a0)
  22171. bra.s ++
  22172. ; ===========================================================================
  22173. +
  22174. subq.w #8,objoff_30(a0)
  22175. bhi.s +
  22176. move.w #0,objoff_30(a0)
  22177. move.b #0,routine_secondary(a0)
  22178. +
  22179. move.w objoff_32(a0),d0
  22180. sub.w objoff_30(a0),d0
  22181. move.w d0,y_pos(a0)
  22182. moveq #0,d1
  22183. move.b width_pixels(a0),d1
  22184. addi.w #$B,d1
  22185. move.w #$40,d2
  22186. move.w d2,d3
  22187. addq.w #1,d3
  22188. move.w x_pos(a0),d4
  22189. jsrto (SolidObject).l, JmpTo2_SolidObject
  22190. bra.w MarkObjGone
  22191. ; ===========================================================================
  22192. ; -------------------------------------------------------------------------------
  22193. ; sprite mappings
  22194. ; -------------------------------------------------------------------------------
  22195. Obj2A_MapUnc_11666: BINCLUDE "mappings/sprite/obj2A.bin"
  22196.  
  22197. ; ===========================================================================
  22198. ; ----------------------------------------------------------------------------
  22199. ; Object 2D - One way barrier from CPZ and DEZ
  22200. ; ----------------------------------------------------------------------------
  22201. ; Sprite_1169A:
  22202. Obj2D:
  22203. moveq #0,d0
  22204. move.b routine(a0),d0
  22205. move.w Obj2D_Index(pc,d0.w),d1
  22206. jmp Obj2D_Index(pc,d1.w)
  22207. ; ===========================================================================
  22208. ; off_116A8:
  22209. Obj2D_Index: offsetTable
  22210. offsetTableEntry.w Obj2D_Init ; 0
  22211. offsetTableEntry.w Obj2D_Main ; 2
  22212. ; ===========================================================================
  22213. ; loc_116AC:
  22214. Obj2D_Init:
  22215. addq.b #2,routine(a0)
  22216. move.l #Obj2D_MapUnc_11822,mappings(a0)
  22217. move.w #make_art_tile(ArtTile_ArtNem_HtzValveBarrier,1,0),art_tile(a0)
  22218. move.b #8,width_pixels(a0)
  22219. cmpi.b #metropolis_zone,(Current_Zone).w
  22220. beq.s +
  22221. cmpi.b #metropolis_zone_2,(Current_Zone).w
  22222. bne.s ++
  22223. +
  22224. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,3,0),art_tile(a0)
  22225. move.b #$C,width_pixels(a0)
  22226. +
  22227. cmpi.b #chemical_plant_zone,(Current_Zone).w
  22228. bne.s +
  22229. move.w #make_art_tile(ArtTile_ArtNem_ConstructionStripes_2,1,0),art_tile(a0)
  22230. move.b #8,width_pixels(a0)
  22231. +
  22232. cmpi.b #death_egg_zone,(Current_Zone).w
  22233. bne.s +
  22234. move.w #make_art_tile(ArtTile_ArtNem_ConstructionStripes_1,1,0),art_tile(a0)
  22235. move.b #8,width_pixels(a0)
  22236. +
  22237. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  22238. bne.s +
  22239. move.w #make_art_tile(ArtTile_ArtNem_ARZBarrierThing,1,0),art_tile(a0)
  22240. move.b #8,width_pixels(a0)
  22241. +
  22242. bsr.w Adjust2PArtPointer
  22243. ori.b #4,render_flags(a0)
  22244. move.b #4,priority(a0)
  22245. move.w y_pos(a0),objoff_32(a0)
  22246. move.b subtype(a0),mapping_frame(a0)
  22247. move.w x_pos(a0),d2
  22248. move.w d2,d3
  22249. subi.w #$200,d2
  22250. addi.w #$18,d3
  22251. btst #0,status(a0)
  22252. beq.s +
  22253. subi.w #-$1E8,d2
  22254. addi.w #$1E8,d3
  22255. +
  22256. move.w d2,objoff_38(a0)
  22257. move.w d3,objoff_3A(a0)
  22258. ; loc_1175E:
  22259. Obj2D_Main:
  22260. btst #0,status(a0)
  22261. bne.s +
  22262. move.w objoff_38(a0),d2
  22263. move.w x_pos(a0),d3
  22264. tst.b routine_secondary(a0) ; check if barrier is moving up
  22265. beq.s ++
  22266. move.w objoff_3A(a0),d3
  22267. bra.s ++
  22268. ; ===========================================================================
  22269. +
  22270. move.w x_pos(a0),d2
  22271. move.w objoff_3A(a0),d3
  22272. tst.b routine_secondary(a0) ; check if barrier is moving up
  22273. beq.s +
  22274. move.w objoff_38(a0),d2
  22275. +
  22276. move.w objoff_32(a0),d4
  22277. move.w d4,d5
  22278. subi.w #$20,d4
  22279. addi.w #$20,d5
  22280. move.b #0,routine_secondary(a0) ; set barrier to move down, check if characters are in area
  22281. lea (MainCharacter).w,a1 ; a1=character
  22282. bsr.s Obj2D_CheckCharacter
  22283. lea (Sidekick).w,a1 ; a1=character
  22284. bsr.s Obj2D_CheckCharacter
  22285. tst.b routine_secondary(a0) ; check if barrier is moving up
  22286. beq.s +
  22287. cmpi.w #$40,objoff_30(a0) ; check if barrier is high enough
  22288. beq.s +++
  22289. addq.w #8,objoff_30(a0) ; move barrier up
  22290. bra.s ++
  22291. ; ===========================================================================
  22292. +
  22293. tst.w objoff_30(a0) ; check if barrier is not in original position
  22294. beq.s ++
  22295. subq.w #8,objoff_30(a0) ; move barrier down
  22296. +
  22297. move.w objoff_32(a0),d0 ; set the barrier y position
  22298. sub.w objoff_30(a0),d0
  22299. move.w d0,y_pos(a0)
  22300. +
  22301. moveq #0,d1 ; perform solid object collision
  22302. move.b width_pixels(a0),d1
  22303. addi.w #$B,d1
  22304. move.w #$20,d2
  22305. move.w d2,d3
  22306. addq.w #1,d3
  22307. move.w x_pos(a0),d4
  22308. jsrto (SolidObject).l, JmpTo2_SolidObject
  22309. bra.w MarkObjGone ; delete object if off screen
  22310.  
  22311. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  22312.  
  22313. ; sub_117F4
  22314. Obj2D_CheckCharacter:
  22315. ; rect ltrb (d2, d4, d3, d5)
  22316.  
  22317. move.w x_pos(a1),d0
  22318. cmp.w d2,d0
  22319. blt.w return_11820
  22320. cmp.w d3,d0
  22321. bhs.w return_11820
  22322. move.w y_pos(a1),d0
  22323. cmp.w d4,d0
  22324. blo.w return_11820
  22325. cmp.w d5,d0
  22326. bhs.w return_11820
  22327. tst.b obj_control(a1)
  22328. bmi.s return_11820
  22329. move.b #2,routine_secondary(a0) ; set barrier to move up
  22330.  
  22331. return_11820:
  22332. rts
  22333. ; End of function Obj2D_CheckCharacter
  22334.  
  22335. ; ===========================================================================
  22336. ; -------------------------------------------------------------------------------
  22337. ; sprite mappings
  22338. ; -------------------------------------------------------------------------------
  22339. Obj2D_MapUnc_11822: BINCLUDE "mappings/sprite/obj2D.bin"
  22340. ; ===========================================================================
  22341.  
  22342. if gameRevision<2
  22343. nop
  22344. endif
  22345.  
  22346. if ~~removeJmpTos
  22347. JmpTo2_SolidObject
  22348. jmp (SolidObject).l
  22349.  
  22350. align 4
  22351. endif
  22352.  
  22353.  
  22354.  
  22355.  
  22356. ; ===========================================================================
  22357. ; ----------------------------------------------------------------------------
  22358. ; Object 28 - Animal and the 100 points from a badnik
  22359. ; ----------------------------------------------------------------------------
  22360. animal_ground_routine_base = objoff_30
  22361. animal_ground_x_vel = objoff_32
  22362. animal_ground_y_vel = objoff_34
  22363. ; Sprite_1188C:
  22364. Obj28:
  22365. moveq #0,d0
  22366. move.b routine(a0),d0
  22367. move.w Obj28_Index(pc,d0.w),d1
  22368. jmp Obj28_Index(pc,d1.w)
  22369. ; ===========================================================================
  22370. ; off_1189A:
  22371. Obj28_Index: offsetTable
  22372. offsetTableEntry.w Obj28_Init ; 0
  22373. offsetTableEntry.w Obj28_Main ; 2
  22374. offsetTableEntry.w Obj28_Walk ; 4
  22375. offsetTableEntry.w Obj28_Fly ; 6
  22376. offsetTableEntry.w Obj28_Walk ; 8
  22377. offsetTableEntry.w Obj28_Walk ; $A
  22378. offsetTableEntry.w Obj28_Walk ; $C
  22379. offsetTableEntry.w Obj28_Fly ; $E
  22380. offsetTableEntry.w Obj28_Walk ; $10
  22381. offsetTableEntry.w Obj28_Fly ; $12
  22382. offsetTableEntry.w Obj28_Walk ; $14
  22383. offsetTableEntry.w Obj28_Walk ; $16
  22384. offsetTableEntry.w Obj28_Walk ; $18
  22385. offsetTableEntry.w Obj28_Walk ; $1A
  22386. offsetTableEntry.w Obj28_Prison ; $1C
  22387. ; These are the S1 ending actions:
  22388. offsetTableEntry.w Obj28_FlickyWait ; $1E
  22389. offsetTableEntry.w Obj28_FlickyWait ; $20
  22390. offsetTableEntry.w Obj28_FlickyJump ; $22
  22391. offsetTableEntry.w Obj28_RabbitWait ; $24
  22392. offsetTableEntry.w Obj28_LandJump ; $26
  22393. offsetTableEntry.w Obj28_SingleBounce ; $28
  22394. offsetTableEntry.w Obj28_LandJump ; $2A
  22395. offsetTableEntry.w Obj28_SingleBounce ; $2C
  22396. offsetTableEntry.w Obj28_LandJump ; $2E
  22397. offsetTableEntry.w Obj28_FlyBounce ; $30
  22398. offsetTableEntry.w Obj28_DoubleBounce ; $32
  22399.  
  22400. ; byte_118CE:
  22401. Obj28_ZoneAnimals: zoneOrderedTable 1,2
  22402.  
  22403. zoneAnimals macro first,second
  22404. zoneTableEntry.b (Obj28_Properties_first - Obj28_Properties) / 8
  22405. zoneTableEntry.b (Obj28_Properties_second - Obj28_Properties) / 8
  22406. endm
  22407. ; This table declares what animals will appear in the zone.
  22408. ; When an enemy is destroyed, a random animal is chosen from the 2 selected animals.
  22409. ; Note: you must also load the corresponding art in the PLCs.
  22410. zoneAnimals.b Squirrel, Bird ; EHZ
  22411. zoneAnimals.b Squirrel, Bird ; Zone 1
  22412. zoneAnimals.b Squirrel, Bird ; WZ
  22413. zoneAnimals.b Squirrel, Bird ; Zone 3
  22414. zoneAnimals.b Beaver, Eagle ; MTZ
  22415. zoneAnimals.b Beaver, Eagle ; MTZ
  22416. zoneAnimals.b Beaver, Eagle ; WFZ
  22417. zoneAnimals.b Beaver, Eagle ; HTZ
  22418. zoneAnimals.b Mouse, Seal ; HPZ
  22419. zoneAnimals.b Mouse, Seal ; Zone 9
  22420. zoneAnimals.b Penguin, Seal ; OOZ
  22421. zoneAnimals.b Mouse, Chicken ; MCZ
  22422. zoneAnimals.b Bear, Bird ; CNZ
  22423. zoneAnimals.b Rabbit, Eagle ; CPZ
  22424. zoneAnimals.b Pig, Chicken ; DEZ
  22425. zoneAnimals.b Penguin, Bird ; ARZ
  22426. zoneAnimals.b Turtle, Chicken ; SCZ
  22427. zoneTableEnd
  22428.  
  22429. ; word_118F0:
  22430. Obj28_Properties:
  22431.  
  22432. obj28decl macro xvel,yvel,mappings,{INTLABEL}
  22433. Obj28_Properties___LABEL__: label *
  22434. dc.w xvel
  22435. dc.w yvel
  22436. dc.l mappings
  22437. endm
  22438. ; This table declares the speed and mappings of each animal.
  22439. Rabbit: obj28decl -$200,-$400,Obj28_MapUnc_11EAC
  22440. Chicken: obj28decl -$200,-$300,Obj28_MapUnc_11E1C
  22441. Penguin: obj28decl -$180,-$300,Obj28_MapUnc_11EAC
  22442. Seal: obj28decl -$140,-$180,Obj28_MapUnc_11E88
  22443. Pig: obj28decl -$1C0,-$300,Obj28_MapUnc_11E64
  22444. Bird: obj28decl -$300,-$400,Obj28_MapUnc_11E1C
  22445. Squirrel: obj28decl -$280,-$380,Obj28_MapUnc_11E40
  22446. Eagle: obj28decl -$280,-$300,Obj28_MapUnc_11E1C
  22447. Mouse: obj28decl -$200,-$380,Obj28_MapUnc_11E40
  22448. Beaver: obj28decl -$2C0,-$300,Obj28_MapUnc_11E40
  22449. Turtle: obj28decl -$140,-$200,Obj28_MapUnc_11E40
  22450. Bear: obj28decl -$200,-$300,Obj28_MapUnc_11E40
  22451.  
  22452. ; The following tables tell the properties of animals based on their subtype.
  22453.  
  22454. ; word_11950:
  22455. Obj28_Speeds:
  22456. dc.w -$440, -$400
  22457. dc.w -$440, -$400 ; 2
  22458. dc.w -$440, -$400 ; 4
  22459. dc.w -$300, -$400 ; 6
  22460. dc.w -$300, -$400 ; 8
  22461. dc.w -$180, -$300 ; 10
  22462. dc.w -$180, -$300 ; 12
  22463. dc.w -$140, -$180 ; 14
  22464. dc.w -$1C0, -$300 ; 16
  22465. dc.w -$200, -$300 ; 18
  22466. dc.w -$280, -$380 ; 20
  22467. ; off_1197C:
  22468. Obj28_Mappings:
  22469. dc.l Obj28_MapUnc_11E1C
  22470. dc.l Obj28_MapUnc_11E1C ; 1
  22471. dc.l Obj28_MapUnc_11E1C ; 2
  22472. dc.l Obj28_MapUnc_11EAC ; 3
  22473. dc.l Obj28_MapUnc_11EAC ; 4
  22474. dc.l Obj28_MapUnc_11EAC ; 5
  22475. dc.l Obj28_MapUnc_11EAC ; 6
  22476. dc.l Obj28_MapUnc_11E88 ; 7
  22477. dc.l Obj28_MapUnc_11E64 ; 8
  22478. dc.l Obj28_MapUnc_11E1C ; 9
  22479. dc.l Obj28_MapUnc_11E40 ; 10
  22480. ; word_119A8:
  22481. Obj28_ArtLocations:
  22482. dc.w ArtTile_ArtNem_S1EndFlicky ; 0 Flicky
  22483. dc.w ArtTile_ArtNem_S1EndFlicky ; 1 Flicky
  22484. dc.w ArtTile_ArtNem_S1EndFlicky ; 2 Flicky
  22485. dc.w ArtTile_ArtNem_S1EndRabbit ; 3 Rabbit
  22486. dc.w ArtTile_ArtNem_S1EndRabbit ; 4 Rabbit
  22487. dc.w ArtTile_ArtNem_S1EndPenguin ; 5 Penguin
  22488. dc.w ArtTile_ArtNem_S1EndPenguin ; 6 Penguin
  22489. dc.w ArtTile_ArtNem_S1EndSeal ; 7 Seal
  22490. dc.w ArtTile_ArtNem_S1EndPig ; 8 Pig
  22491. dc.w ArtTile_ArtNem_S1EndChicken ; 9 Chicken
  22492. dc.w ArtTile_ArtNem_S1EndSquirrel ; 10 Squirrel
  22493.  
  22494. ; ===========================================================================
  22495. ; loc_119BE:
  22496. Obj28_Init:
  22497. tst.b subtype(a0)
  22498. beq.w Obj28_InitRandom
  22499. moveq #0,d0
  22500. move.b subtype(a0),d0
  22501. add.w d0,d0
  22502. move.b d0,routine(a0)
  22503. subi.w #$14,d0
  22504. move.w Obj28_ArtLocations(pc,d0.w),art_tile(a0)
  22505. add.w d0,d0
  22506. move.l Obj28_Mappings(pc,d0.w),mappings(a0)
  22507. lea Obj28_Speeds(pc),a1
  22508. move.w (a1,d0.w),animal_ground_x_vel(a0)
  22509. move.w (a1,d0.w),x_vel(a0)
  22510. move.w 2(a1,d0.w),animal_ground_y_vel(a0)
  22511. move.w 2(a1,d0.w),y_vel(a0)
  22512. bsr.w Adjust2PArtPointer
  22513. move.b #$C,y_radius(a0)
  22514. move.b #4,render_flags(a0)
  22515. bset #0,render_flags(a0)
  22516. move.b #6,priority(a0)
  22517. move.b #8,width_pixels(a0)
  22518. move.b #7,anim_frame_duration(a0)
  22519. bra.w DisplaySprite
  22520. ; ===========================================================================
  22521. ; loc_11A2C:
  22522. Obj28_InitRandom:
  22523. addq.b #2,routine(a0)
  22524. jsrto (RandomNumber).l, JmpTo_RandomNumber
  22525. move.w #make_art_tile(ArtTile_ArtNem_Animal_1,0,0),art_tile(a0)
  22526. andi.w #1,d0
  22527. beq.s +
  22528. move.w #make_art_tile(ArtTile_ArtNem_Animal_2,0,0),art_tile(a0)
  22529. +
  22530. moveq #0,d1
  22531. move.b (Current_Zone).w,d1
  22532. add.w d1,d1
  22533. add.w d0,d1
  22534. lea Obj28_ZoneAnimals(pc),a1
  22535. move.b (a1,d1.w),d0
  22536. move.b d0,animal_ground_routine_base(a0)
  22537. lsl.w #3,d0
  22538. lea Obj28_Properties(pc),a1
  22539. adda.w d0,a1
  22540. move.w (a1)+,animal_ground_x_vel(a0)
  22541. move.w (a1)+,animal_ground_y_vel(a0)
  22542. move.l (a1)+,mappings(a0)
  22543. bsr.w Adjust2PArtPointer
  22544. move.b #$C,y_radius(a0)
  22545. move.b #4,render_flags(a0)
  22546. bset #0,render_flags(a0)
  22547. move.b #6,priority(a0)
  22548. move.b #8,width_pixels(a0)
  22549. move.b #7,anim_frame_duration(a0)
  22550. move.b #2,mapping_frame(a0)
  22551. move.w #-$400,y_vel(a0)
  22552. tst.b objoff_38(a0)
  22553. bne.s ++
  22554. bsr.w SingleObjLoad
  22555. bne.s +
  22556. _move.b #ObjID_Points,id(a1) ; load obj29
  22557. move.w x_pos(a0),x_pos(a1)
  22558. move.w y_pos(a0),y_pos(a1)
  22559. move.w objoff_3E(a0),d0
  22560. lsr.w #1,d0
  22561. move.b d0,mapping_frame(a1)
  22562. + bra.w DisplaySprite
  22563. ; ===========================================================================
  22564. +
  22565. move.b #$1C,routine(a0)
  22566. clr.w x_vel(a0)
  22567. bra.w DisplaySprite
  22568. ; ===========================================================================
  22569. ;loc_11ADE
  22570. Obj28_Main:
  22571. tst.b render_flags(a0)
  22572. bpl.w DeleteObject
  22573. bsr.w ObjectMoveAndFall
  22574. tst.w y_vel(a0)
  22575. bmi.s +
  22576. jsr (ObjCheckFloorDist).l
  22577. tst.w d1
  22578. bpl.s +
  22579. add.w d1,y_pos(a0)
  22580. move.w animal_ground_x_vel(a0),x_vel(a0)
  22581. move.w animal_ground_y_vel(a0),y_vel(a0)
  22582. move.b #1,mapping_frame(a0)
  22583. move.b animal_ground_routine_base(a0),d0
  22584. add.b d0,d0
  22585. addq.b #4,d0
  22586. move.b d0,routine(a0)
  22587. tst.b objoff_38(a0)
  22588. beq.s +
  22589. btst #4,(Vint_runcount+3).w
  22590. beq.s +
  22591. neg.w x_vel(a0)
  22592. bchg #0,render_flags(a0)
  22593. + bra.w DisplaySprite
  22594. ; ===========================================================================
  22595. ;loc_11B38
  22596. Obj28_Walk:
  22597.  
  22598. bsr.w ObjectMoveAndFall
  22599. move.b #1,mapping_frame(a0)
  22600. tst.w y_vel(a0)
  22601. bmi.s +
  22602. move.b #0,mapping_frame(a0)
  22603. jsr (ObjCheckFloorDist).l
  22604. tst.w d1
  22605. bpl.s +
  22606. add.w d1,y_pos(a0)
  22607. move.w animal_ground_y_vel(a0),y_vel(a0)
  22608. +
  22609. tst.b subtype(a0)
  22610. bne.s Obj28_ChkDel
  22611. tst.b render_flags(a0)
  22612. bpl.w DeleteObject
  22613. bra.w DisplaySprite
  22614. ; ===========================================================================
  22615. ;loc_11B74
  22616. Obj28_Fly:
  22617. bsr.w ObjectMove
  22618. addi.w #$18,y_vel(a0)
  22619. tst.w y_vel(a0)
  22620. bmi.s +
  22621. jsr (ObjCheckFloorDist).l
  22622. tst.w d1
  22623. bpl.s +
  22624. add.w d1,y_pos(a0)
  22625. move.w animal_ground_y_vel(a0),y_vel(a0)
  22626. tst.b subtype(a0)
  22627. beq.s +
  22628. cmpi.b #$A,subtype(a0)
  22629. beq.s +
  22630. neg.w x_vel(a0)
  22631. bchg #0,render_flags(a0)
  22632. +
  22633. subq.b #1,anim_frame_duration(a0)
  22634. bpl.s +
  22635. move.b #1,anim_frame_duration(a0)
  22636. addq.b #1,mapping_frame(a0)
  22637. andi.b #1,mapping_frame(a0)
  22638. +
  22639. tst.b subtype(a0)
  22640. bne.s Obj28_ChkDel
  22641. tst.b render_flags(a0)
  22642. bpl.w DeleteObject
  22643. bra.w DisplaySprite
  22644. ; ===========================================================================
  22645. ;loc_11BD8
  22646. Obj28_ChkDel:
  22647. move.w x_pos(a0),d0
  22648. sub.w (MainCharacter+x_pos).w,d0
  22649. bcs.s +
  22650. subi.w #$180,d0
  22651. bpl.s +
  22652. tst.b render_flags(a0)
  22653. bpl.w DeleteObject
  22654. +
  22655. bra.w DisplaySprite
  22656. ; ===========================================================================
  22657. ;loc_11BF4
  22658. Obj28_Prison:
  22659. tst.b render_flags(a0)
  22660. bpl.w DeleteObject
  22661. subq.w #1,objoff_36(a0)
  22662. bne.w +
  22663. move.b #2,routine(a0)
  22664. move.b #1,priority(a0)
  22665. +
  22666. bra.w DisplaySprite
  22667. ; ===========================================================================
  22668. ;loc_11C14
  22669. Obj28_FlickyWait:
  22670. bsr.w ChkAnimalInRange
  22671. bcc.s +
  22672. move.w animal_ground_x_vel(a0),x_vel(a0)
  22673. move.w animal_ground_y_vel(a0),y_vel(a0)
  22674. move.b #$E,routine(a0)
  22675. bra.w Obj28_Fly
  22676. ; ===========================================================================
  22677. +
  22678. bra.w Obj28_ChkDel
  22679. ; ===========================================================================
  22680. ;loc_11C34
  22681. Obj28_FlickyJump:
  22682. bsr.w ChkAnimalInRange
  22683. bpl.s +
  22684. clr.w x_vel(a0)
  22685. clr.w animal_ground_x_vel(a0)
  22686. bsr.w ObjectMove
  22687. addi.w #$18,y_vel(a0)
  22688. bsr.w AnimalJump
  22689. bsr.w AnimalFaceSonic
  22690. subq.b #1,anim_frame_duration(a0)
  22691. bpl.s +
  22692. move.b #1,anim_frame_duration(a0)
  22693. addq.b #1,mapping_frame(a0)
  22694. andi.b #1,mapping_frame(a0)
  22695. +
  22696. bra.w Obj28_ChkDel
  22697. ; ===========================================================================
  22698. ;loc_11C6E
  22699. Obj28_RabbitWait:
  22700. bsr.w ChkAnimalInRange
  22701. bpl.s ++
  22702. move.w animal_ground_x_vel(a0),x_vel(a0)
  22703. move.w animal_ground_y_vel(a0),y_vel(a0)
  22704. move.b #4,routine(a0)
  22705. bra.w Obj28_Walk
  22706. ; ===========================================================================
  22707. ;loc_11C8A
  22708. Obj28_DoubleBounce:
  22709. bsr.w ObjectMoveAndFall
  22710. move.b #1,mapping_frame(a0)
  22711. tst.w y_vel(a0)
  22712. bmi.s ++
  22713. move.b #0,mapping_frame(a0)
  22714. jsr (ObjCheckFloorDist).l
  22715. tst.w d1
  22716. bpl.s ++
  22717. not.b objoff_29(a0)
  22718. bne.s +
  22719. neg.w x_vel(a0)
  22720. bchg #0,render_flags(a0)
  22721. +
  22722. add.w d1,y_pos(a0)
  22723. move.w animal_ground_y_vel(a0),y_vel(a0)
  22724. +
  22725. bra.w Obj28_ChkDel
  22726. ; ===========================================================================
  22727. ;loc_11CC8
  22728. Obj28_LandJump:
  22729. bsr.w ChkAnimalInRange
  22730. bpl.s +
  22731. clr.w x_vel(a0)
  22732. clr.w animal_ground_x_vel(a0)
  22733. bsr.w ObjectMoveAndFall
  22734. bsr.w AnimalJump
  22735. bsr.w AnimalFaceSonic
  22736. +
  22737. bra.w Obj28_ChkDel
  22738. ; ===========================================================================
  22739. ;loc_11CE6
  22740. Obj28_SingleBounce:
  22741. bsr.w ChkAnimalInRange
  22742. bpl.s +
  22743. bsr.w ObjectMoveAndFall
  22744. move.b #1,mapping_frame(a0)
  22745. tst.w y_vel(a0)
  22746. bmi.s +
  22747. move.b #0,mapping_frame(a0)
  22748. jsr (ObjCheckFloorDist).l
  22749. tst.w d1
  22750. bpl.s +
  22751. neg.w x_vel(a0)
  22752. bchg #0,render_flags(a0)
  22753. add.w d1,y_pos(a0)
  22754. move.w animal_ground_y_vel(a0),y_vel(a0)
  22755. +
  22756. bra.w Obj28_ChkDel
  22757. ; ===========================================================================
  22758. ;loc_11D24
  22759. Obj28_FlyBounce:
  22760. bsr.w ChkAnimalInRange
  22761. bpl.s +++
  22762. bsr.w ObjectMove
  22763. addi.w #$18,y_vel(a0)
  22764. tst.w y_vel(a0)
  22765. bmi.s ++
  22766. jsr (ObjCheckFloorDist).l
  22767. tst.w d1
  22768. bpl.s ++
  22769. not.b objoff_29(a0)
  22770. bne.s +
  22771. neg.w x_vel(a0)
  22772. bchg #0,render_flags(a0)
  22773. +
  22774. add.w d1,y_pos(a0)
  22775. move.w animal_ground_y_vel(a0),y_vel(a0)
  22776. +
  22777. subq.b #1,anim_frame_duration(a0)
  22778. bpl.s +
  22779. move.b #1,anim_frame_duration(a0)
  22780. addq.b #1,mapping_frame(a0)
  22781. andi.b #1,mapping_frame(a0)
  22782. +
  22783. bra.w Obj28_ChkDel
  22784.  
  22785. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  22786.  
  22787. ;sub_11D78
  22788. AnimalJump:
  22789. move.b #1,mapping_frame(a0)
  22790. tst.w y_vel(a0)
  22791. bmi.s + ; rts
  22792. move.b #0,mapping_frame(a0)
  22793. jsr (ObjCheckFloorDist).l
  22794. tst.w d1
  22795. bpl.s + ; rts
  22796. add.w d1,y_pos(a0)
  22797. move.w animal_ground_y_vel(a0),y_vel(a0)
  22798. +
  22799. rts
  22800. ; End of function AnimalJump
  22801.  
  22802.  
  22803. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  22804.  
  22805. ;sub_11DA0
  22806. AnimalFaceSonic:
  22807. bset #0,render_flags(a0)
  22808. move.w x_pos(a0),d0
  22809. sub.w (MainCharacter+x_pos).w,d0
  22810. bcc.s + ; rts
  22811. bclr #0,render_flags(a0)
  22812. +
  22813. rts
  22814. ; End of function AnimalFaceSonic
  22815.  
  22816.  
  22817. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  22818.  
  22819. ;sub_11DB8
  22820. ChkAnimalInRange:
  22821. move.w (MainCharacter+x_pos).w,d0
  22822. sub.w x_pos(a0),d0
  22823. subi.w #$B8,d0
  22824. rts
  22825. ; End of function ChkAnimalInRange
  22826.  
  22827. ; ===========================================================================
  22828. ; ----------------------------------------------------------------------------
  22829. ; Object 29 - "100 points" text
  22830. ; ----------------------------------------------------------------------------
  22831. ; Sprite_11DC6:
  22832. Obj29:
  22833. moveq #0,d0
  22834. move.b routine(a0),d0
  22835. move.w Obj29_Index(pc,d0.w),d1
  22836. jmp Obj29_Index(pc,d1.w)
  22837. ; ===========================================================================
  22838. ; off_11DD4:
  22839. Obj29_Index: offsetTable
  22840. offsetTableEntry.w Obj29_Init ; 0
  22841. offsetTableEntry.w Obj29_Main ; 2
  22842. ; ===========================================================================
  22843.  
  22844. Obj29_Init:
  22845. addq.b #2,routine(a0)
  22846. move.l #Obj29_MapUnc_11ED0,mappings(a0)
  22847. move.w #make_art_tile(ArtTile_ArtNem_Numbers,0,1),art_tile(a0)
  22848. bsr.w Adjust2PArtPointer
  22849. move.b #4,render_flags(a0)
  22850. move.b #1,priority(a0)
  22851. move.b #8,width_pixels(a0)
  22852. move.w #-$300,y_vel(a0) ; set initial speed (upwards)
  22853.  
  22854. Obj29_Main:
  22855. tst.w y_vel(a0) ; test speed
  22856. bpl.w DeleteObject ; if it's positive (>= 0), delete the object
  22857. bsr.w ObjectMove ; move the points
  22858. addi.w #$18,y_vel(a0) ; slow down
  22859. bra.w DisplaySprite
  22860. ; ===========================================================================
  22861. ; -------------------------------------------------------------------------------
  22862. ; sprite mappings
  22863. ; -------------------------------------------------------------------------------
  22864. Obj28_MapUnc_11E1C: BINCLUDE "mappings/sprite/obj28_a.bin"
  22865. ; -------------------------------------------------------------------------------
  22866. ; sprite mappings
  22867. ; -------------------------------------------------------------------------------
  22868. Obj28_MapUnc_11E40: BINCLUDE "mappings/sprite/obj28_b.bin"
  22869. ; -------------------------------------------------------------------------------
  22870. ; sprite mappings
  22871. ; -------------------------------------------------------------------------------
  22872. Obj28_MapUnc_11E64: BINCLUDE "mappings/sprite/obj28_c.bin"
  22873. ; -------------------------------------------------------------------------------
  22874. ; sprite mappings
  22875. ; -------------------------------------------------------------------------------
  22876. Obj28_MapUnc_11E88: BINCLUDE "mappings/sprite/obj28_d.bin"
  22877. ; -------------------------------------------------------------------------------
  22878. ; sprite mappings
  22879. ; -------------------------------------------------------------------------------
  22880. Obj28_MapUnc_11EAC: BINCLUDE "mappings/sprite/obj28_e.bin"
  22881. ; -------------------------------------------------------------------------------
  22882. ; sprite mappings
  22883. ; -------------------------------------------------------------------------------
  22884. Obj29_MapUnc_11ED0: BINCLUDE "mappings/sprite/obj29.bin"
  22885.  
  22886. if ~~removeJmpTos
  22887. JmpTo_RandomNumber
  22888. jmp (RandomNumber).l
  22889.  
  22890. align 4
  22891. endif
  22892.  
  22893.  
  22894.  
  22895.  
  22896. ; ===========================================================================
  22897. ; ----------------------------------------------------------------------------
  22898. ; Object 25 - A ring (usually only placed through placement mode)
  22899. ; ----------------------------------------------------------------------------
  22900. ; Obj_Ring:
  22901. Obj25:
  22902. moveq #0,d0
  22903. move.b routine(a0),d0
  22904. move.w Obj25_Index(pc,d0.w),d1
  22905. jmp Obj25_Index(pc,d1.w)
  22906. ; ===========================================================================
  22907. ; Obj_25_subtbl:
  22908. Obj25_Index: offsetTable
  22909. offsetTableEntry.w Obj25_Init ; 0
  22910. offsetTableEntry.w Obj25_Animate ; 2
  22911. offsetTableEntry.w Obj25_Collect ; 4
  22912. offsetTableEntry.w Obj25_Sparkle ; 6
  22913. offsetTableEntry.w Obj25_Delete ; 8
  22914. ; ===========================================================================
  22915. ; Obj_25_sub_0:
  22916. Obj25_Init:
  22917. addq.b #2,routine(a0)
  22918. move.w x_pos(a0),objoff_32(a0)
  22919. move.l #Obj25_MapUnc_12382,mappings(a0)
  22920. move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a0)
  22921. bsr.w Adjust2PArtPointer
  22922. move.b #4,render_flags(a0)
  22923. move.b #2,priority(a0)
  22924. move.b #$47,collision_flags(a0)
  22925. move.b #8,width_pixels(a0)
  22926. ; Obj_25_sub_2:
  22927. Obj25_Animate:
  22928. move.b (Rings_anim_frame).w,mapping_frame(a0)
  22929. move.w objoff_32(a0),d0
  22930. bra.w MarkObjGone2
  22931. ; ===========================================================================
  22932. ; Obj_25_sub_4:
  22933. Obj25_Collect:
  22934. addq.b #2,routine(a0)
  22935. move.b #0,collision_flags(a0)
  22936. move.b #1,priority(a0)
  22937. bsr.s CollectRing
  22938. ; Obj_25_sub_6:
  22939. Obj25_Sparkle:
  22940. lea (Ani_Ring).l,a1
  22941. bsr.w AnimateSprite
  22942. bra.w DisplaySprite
  22943. ; ===========================================================================
  22944. ; BranchTo4_DeleteObject
  22945. Obj25_Delete:
  22946. bra.w DeleteObject
  22947.  
  22948. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  22949.  
  22950. ; sub_11FC2:
  22951. CollectRing:
  22952. tst.b parent+1(a0) ; did Tails collect the ring?
  22953. bne.s CollectRing_Tails ; if yes, branch
  22954.  
  22955. CollectRing_Sonic:
  22956. cmpi.w #999,(Rings_Collected).w ; did Sonic collect 999 or more rings?
  22957. bhs.s CollectRing_1P ; if yes, branch
  22958. addq.w #1,(Rings_Collected).w ; add 1 to the number of collected rings
  22959.  
  22960. CollectRing_1P:
  22961.  
  22962. if gameRevision=0
  22963. cmpi.w #999,(Ring_count).w ; does the player 1 have 999 or more rings?
  22964. bhs.s + ; if yes, skip the increment
  22965. addq.w #1,(Ring_count).w ; add 1 to the ring count
  22966. +
  22967. ori.b #1,(Update_HUD_rings).w ; set flag to update the ring counter in the HUD
  22968. move.w #SndID_Ring,d0 ; prepare to play the ring sound
  22969. else
  22970. move.w #SndID_Ring,d0 ; prepare to play the ring sound
  22971. cmpi.w #999,(Ring_count).w ; does the player 1 have 999 or more rings?
  22972. bhs.s JmpTo_PlaySoundStereo ; if yes, play the ring sound
  22973. addq.w #1,(Ring_count).w ; add 1 to the ring count
  22974. ori.b #1,(Update_HUD_rings).w ; set flag to update the ring counter in the HUD
  22975. endif
  22976.  
  22977. cmpi.w #100,(Ring_count).w ; does the player 1 have less than 100 rings?
  22978. blo.s JmpTo_PlaySoundStereo ; if yes, play the ring sound
  22979. bset #1,(Extra_life_flags).w ; test and set the flag for the first extra life
  22980. beq.s + ; if it was clear before, branch
  22981. cmpi.w #200,(Ring_count).w ; does the player 1 have less than 200 rings?
  22982. blo.s JmpTo_PlaySoundStereo ; if yes, play the ring sound
  22983. bset #2,(Extra_life_flags).w ; test and set the flag for the second extra life
  22984. bne.s JmpTo_PlaySoundStereo ; if it was set before, play the ring sound
  22985. +
  22986. addq.b #1,(Life_count).w ; add 1 to the life count
  22987. addq.b #1,(Update_HUD_lives).w ; add 1 to the displayed life count
  22988. move.w #MusID_ExtraLife,d0 ; prepare to play the extra life jingle
  22989.  
  22990. JmpTo_PlaySoundStereo
  22991. jmp (PlaySoundStereo).l
  22992. ; ===========================================================================
  22993. rts
  22994. ; ===========================================================================
  22995.  
  22996. CollectRing_Tails:
  22997. cmpi.w #999,(Rings_Collected_2P).w ; did Tails collect 999 or more rings?
  22998. bhs.s + ; if yes, branch
  22999. addq.w #1,(Rings_Collected_2P).w ; add 1 to the number of collected rings
  23000. +
  23001. cmpi.w #999,(Ring_count_2P).w ; does Tails have 999 or more rings?
  23002. bhs.s + ; if yes, branch
  23003. addq.w #1,(Ring_count_2P).w ; add 1 to the ring count
  23004. +
  23005. tst.w (Two_player_mode).w ; are we in a 2P game?
  23006. beq.s CollectRing_1P ; if not, branch
  23007.  
  23008. ; CollectRing_2P:
  23009. ori.b #1,(Update_HUD_rings_2P).w ; set flag to update the ring counter in the second player's HUD
  23010. move.w #SndID_Ring,d0 ; prepare to play the ring sound
  23011. cmpi.w #100,(Ring_count_2P).w ; does the player 2 have less than 100 rings?
  23012. blo.s JmpTo2_PlaySoundStereo ; if yes, play the ring sound
  23013. bset #1,(Extra_life_flags_2P).w ; test and set the flag for the first extra life
  23014. beq.s + ; if it was clear before, branch
  23015. cmpi.w #200,(Ring_count_2P).w ; does the player 2 have less than 200 rings?
  23016. blo.s JmpTo2_PlaySoundStereo ; if yes, play the ring sound
  23017. bset #2,(Extra_life_flags_2P).w ; test and set the flag for the second extra life
  23018. bne.s JmpTo2_PlaySoundStereo ; if it was set before, play the ring sound
  23019. +
  23020. addq.b #1,(Life_count_2P).w ; add 1 to the life count
  23021. addq.b #1,(Update_HUD_lives_2P).w ; add 1 to the displayed life count
  23022. move.w #MusID_ExtraLife,d0 ; prepare to play the extra life jingle
  23023.  
  23024. JmpTo2_PlaySoundStereo
  23025. jmp (PlaySoundStereo).l
  23026. ; End of function CollectRing
  23027.  
  23028. ; ===========================================================================
  23029. ; ----------------------------------------------------------------------------
  23030. ; Object 37 - Scattering rings (generated when Sonic is hurt and has rings)
  23031. ; ----------------------------------------------------------------------------
  23032. ; Sprite_12078:
  23033. Obj37:
  23034. moveq #0,d0
  23035. move.b routine(a0),d0
  23036. move.w Obj37_Index(pc,d0.w),d1
  23037. jmp Obj37_Index(pc,d1.w)
  23038. ; ===========================================================================
  23039. ; Obj_37_subtbl:
  23040. Obj37_Index: offsetTable
  23041. offsetTableEntry.w Obj37_Init ; 0
  23042. offsetTableEntry.w Obj37_Main ; 2
  23043. offsetTableEntry.w Obj37_Collect ; 4
  23044. offsetTableEntry.w Obj37_Sparkle ; 6
  23045. offsetTableEntry.w Obj37_Delete ; 8
  23046. ; ===========================================================================
  23047. ; Obj_37_sub_0:
  23048. Obj37_Init:
  23049. movea.l a0,a1
  23050. moveq #0,d5
  23051. move.w (Ring_count).w,d5
  23052. tst.b parent+1(a0)
  23053. beq.s +
  23054. move.w (Ring_count_2P).w,d5
  23055. +
  23056. moveq #$20,d0
  23057. cmp.w d0,d5
  23058. blo.s +
  23059. move.w d0,d5
  23060. +
  23061. subq.w #1,d5
  23062. move.w #$288,d4
  23063. bra.s +
  23064. ; ===========================================================================
  23065.  
  23066. - bsr.w SingleObjLoad
  23067. bne.w +++
  23068. +
  23069. _move.b #ObjID_LostRings,id(a1) ; load obj37
  23070. addq.b #2,routine(a1)
  23071. move.b #8,y_radius(a1)
  23072. move.b #8,x_radius(a1)
  23073. move.w x_pos(a0),x_pos(a1)
  23074. move.w y_pos(a0),y_pos(a1)
  23075. move.l #Obj25_MapUnc_12382,mappings(a1)
  23076. move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a1)
  23077. bsr.w Adjust2PArtPointer2
  23078. move.b #$84,render_flags(a1)
  23079. move.b #3,priority(a1)
  23080. move.b #$47,collision_flags(a1)
  23081. move.b #8,width_pixels(a1)
  23082. move.b #-1,(Ring_spill_anim_counter).w
  23083. tst.w d4
  23084. bmi.s +
  23085. move.w d4,d0
  23086. jsrto (CalcSine).l, JmpTo4_CalcSine
  23087. move.w d4,d2
  23088. lsr.w #8,d2
  23089. asl.w d2,d0
  23090. asl.w d2,d1
  23091. move.w d0,d2
  23092. move.w d1,d3
  23093. addi.b #$10,d4
  23094. bcc.s +
  23095. subi.w #$80,d4
  23096. bcc.s +
  23097. move.w #$288,d4
  23098. +
  23099. move.w d2,x_vel(a1)
  23100. move.w d3,y_vel(a1)
  23101. neg.w d2
  23102. neg.w d4
  23103. dbf d5,-
  23104. +
  23105. move.w #SndID_RingSpill,d0
  23106. jsr (PlaySoundStereo).l
  23107. tst.b parent+1(a0)
  23108. bne.s +
  23109. move.w #0,(Ring_count).w
  23110. move.b #$80,(Update_HUD_rings).w
  23111. move.b #0,(Extra_life_flags).w
  23112. bra.s Obj37_Main
  23113. ; ===========================================================================
  23114. +
  23115. move.w #0,(Ring_count_2P).w
  23116. move.b #$80,(Update_HUD_rings_2P).w
  23117. move.b #0,(Extra_life_flags_2P).w
  23118. ; Obj_37_sub_2:
  23119. Obj37_Main:
  23120. move.b (Ring_spill_anim_frame).w,mapping_frame(a0)
  23121. bsr.w ObjectMove
  23122. addi.w #$18,y_vel(a0)
  23123. bmi.s loc_121B8
  23124. move.b (Vint_runcount+3).w,d0
  23125. add.b d7,d0
  23126. andi.b #7,d0
  23127. bne.s loc_121B8
  23128. tst.b render_flags(a0)
  23129. bpl.s loc_121D0
  23130. jsr (RingCheckFloorDist).l
  23131. tst.w d1
  23132. bpl.s loc_121B8
  23133. add.w d1,y_pos(a0)
  23134. move.w y_vel(a0),d0
  23135. asr.w #2,d0
  23136. sub.w d0,y_vel(a0)
  23137. neg.w y_vel(a0)
  23138.  
  23139. loc_121B8:
  23140.  
  23141. tst.b (Ring_spill_anim_counter).w
  23142. beq.s Obj37_Delete
  23143. move.w (Camera_Max_Y_pos_now).w,d0
  23144. addi.w #$E0,d0
  23145. cmp.w y_pos(a0),d0
  23146. blo.s Obj37_Delete
  23147. bra.w DisplaySprite
  23148. ; ===========================================================================
  23149.  
  23150. loc_121D0:
  23151. tst.w (Two_player_mode).w
  23152. bne.w Obj37_Delete
  23153. bra.s loc_121B8
  23154. ; ===========================================================================
  23155. ; Obj_37_sub_4:
  23156. Obj37_Collect:
  23157. addq.b #2,routine(a0)
  23158. move.b #0,collision_flags(a0)
  23159. move.b #1,priority(a0)
  23160. bsr.w CollectRing
  23161. ; Obj_37_sub_6:
  23162. Obj37_Sparkle:
  23163. lea (Ani_Ring).l,a1
  23164. bsr.w AnimateSprite
  23165. bra.w DisplaySprite
  23166. ; ===========================================================================
  23167. ; BranchTo5_DeleteObject
  23168. Obj37_Delete:
  23169. bra.w DeleteObject
  23170.  
  23171. ; Unused - dead code/data S1 big ring:
  23172. ; ===========================================================================
  23173. ; BigRing:
  23174. ; a0=object
  23175. moveq #0,d0
  23176. move.b routine(a0),d0
  23177. move.w BigRing_States(pc,d0.w),d1
  23178. jmp BigRing_States(pc,d1.w)
  23179. ; ===========================================================================
  23180. BigRing_States: offsetTable
  23181. offsetTableEntry.w BigRing_Init ; 0
  23182. offsetTableEntry.w BigRing_Main ; 2
  23183. offsetTableEntry.w BigRing_Enter ; 4
  23184. offsetTableEntry.w BigRing_Delete ; 6
  23185. ; ===========================================================================
  23186. ; loc_12216:
  23187. BigRing_Init:
  23188. move.l #Obj37_MapUnc_123E6,mappings(a0)
  23189. move.w #make_art_tile(ArtTile_ArtNem_BigRing,1,0),art_tile(a0)
  23190. bsr.w Adjust2PArtPointer
  23191. ori.b #4,render_flags(a0)
  23192. move.b #$40,width_pixels(a0)
  23193. tst.b render_flags(a0)
  23194. bpl.s BigRing_Main
  23195. cmpi.b #6,(Got_Emerald).w
  23196. beq.w BigRing_Delete
  23197. cmpi.w #50,(Ring_count).w
  23198. bhs.s +
  23199. rts
  23200. ; ===========================================================================
  23201. +
  23202. addq.b #2,routine(a0)
  23203. move.b #2,priority(a0)
  23204. move.b #$52,collision_flags(a0)
  23205. move.w #$C40,(BigRingGraphics).w
  23206. ; loc_12264:
  23207. BigRing_Main:
  23208. move.b (Rings_anim_frame).w,mapping_frame(a0)
  23209. move.w x_pos(a0),d0
  23210. andi.w #$FF80,d0
  23211. sub.w (Camera_X_pos_coarse).w,d0
  23212. cmpi.w #$280,d0
  23213. bhi.w DeleteObject
  23214. bra.w DisplaySprite
  23215. ; ===========================================================================
  23216. ; loc_12282:
  23217. BigRing_Enter:
  23218. subq.b #2,routine(a0)
  23219. move.b #0,collision_flags(a0)
  23220. bsr.w SingleObjLoad
  23221. bne.w +
  23222. ; Note: the object ID is not set
  23223. ; If you want to restore the big ring object, you'll also have to
  23224. ; restore the ring flash object (right after this) and assign its ID to
  23225. ; the created object here (a1).
  23226. ;move.b #ObjID_BigRingFlash,id(a1)
  23227. move.w x_pos(a0),x_pos(a1)
  23228. move.w y_pos(a0),y_pos(a1)
  23229. move.l a0,objoff_3C(a1)
  23230. move.w (MainCharacter+x_pos).w,d0
  23231. cmp.w x_pos(a0),d0
  23232. blo.s +
  23233. bset #0,render_flags(a1)
  23234. +
  23235. move.w #SndID_EnterGiantRing,d0
  23236. jsr (PlaySoundStereo).l
  23237. bra.s BigRing_Main
  23238. ; ===========================================================================
  23239. ; BranchTo6_DeleteObject
  23240. BigRing_Delete:
  23241. bra.w DeleteObject
  23242.  
  23243. ; Unused - dead code/data S1 ring flash:
  23244. ; ===========================================================================
  23245. ; BigRingFlash:
  23246. ; a0=object
  23247. moveq #0,d0
  23248. move.b routine(a0),d0
  23249. move.w BigRingFlash_States(pc,d0.w),d1
  23250. jmp BigRingFlash_States(pc,d1.w)
  23251. ; ===========================================================================
  23252. BigRingFlash_States: offsetTable
  23253. offsetTableEntry.w BigRingFlash_Init ; 0
  23254. offsetTableEntry.w BigRingFlash_Main ; 2
  23255. offsetTableEntry.w BigRingFlash_Delete ; 4
  23256. ; ===========================================================================
  23257. ; loc_122D8:
  23258. BigRingFlash_Init:
  23259. addq.b #2,routine(a0)
  23260. move.l #Obj37_MapUnc_124E6,mappings(a0)
  23261. move.w #make_art_tile(ArtTile_ArtNem_BigRing_Flash,1,0),art_tile(a0)
  23262. bsr.w Adjust2PArtPointer
  23263. ori.b #4,render_flags(a0)
  23264. move.b #0,priority(a0)
  23265. move.b #$20,width_pixels(a0)
  23266. move.b #-1,mapping_frame(a0)
  23267. ; loc_12306:
  23268. BigRingFlash_Main:
  23269. bsr.s BigRingFlash_Animate
  23270. move.w x_pos(a0),d0
  23271. andi.w #$FF80,d0
  23272. sub.w (Camera_X_pos_coarse).w,d0
  23273. cmpi.w #$280,d0
  23274. bhi.w DeleteObject
  23275. bra.w DisplaySprite
  23276.  
  23277. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  23278.  
  23279. ; sub_12320:
  23280. BigRingFlash_Animate:
  23281. subq.b #1,anim_frame_duration(a0) ; subtract 1 from frame duration
  23282. bpl.s + ; rts
  23283. move.b #1,anim_frame_duration(a0) ; reset frame duration (2 frames)
  23284. addq.b #1,mapping_frame(a0) ; use next animation frame
  23285. cmpi.b #8,mapping_frame(a0) ; have we reached the end of the animation frames?
  23286. bhs.s ++ ; if yes, branch
  23287. cmpi.b #3,mapping_frame(a0) ; have we reached the 4th animation frame?
  23288. bne.s + ; rts ; if not, return
  23289. movea.l objoff_3C(a0),a1 ; a1=object ; get the parent big ring object
  23290. move.b #6,routine(a1) ; set its routine to "delete"
  23291. move.b #AniIDSonAni_Blank,(MainCharacter+anim).w ; change the character's animation
  23292. move.b #1,(SpecialStage_flag_2P).w
  23293. lea (MainCharacter).w,a1 ; a1=character
  23294. bclr #status_sec_isInvincible,status_secondary(a1)
  23295. bclr #status_sec_hasShield,status_secondary(a1)
  23296. + rts
  23297. ; ===========================================================================
  23298. +
  23299. addq.b #2,routine(a0)
  23300. move.w #0,(MainCharacter).w ; delete the player object
  23301. addq.l #4,sp
  23302. rts
  23303. ; End of function BigRingFlash_Animate
  23304.  
  23305. ; ===========================================================================
  23306. ; BranchTo7_DeleteObject
  23307. BigRingFlash_Delete:
  23308. bra.w DeleteObject
  23309.  
  23310. ; end of dead code/data
  23311.  
  23312. ; ===========================================================================
  23313.  
  23314. ; animation script
  23315. ; byte_1237A:
  23316. Ani_Ring: offsetTable
  23317. offsetTableEntry.w + ; 0
  23318. + dc.b 5, 4, 5, 6, 7,$FC
  23319. ; -------------------------------------------------------------------------------
  23320. ; sprite mappings
  23321. ; -------------------------------------------------------------------------------
  23322. Obj25_MapUnc_12382: BINCLUDE "mappings/sprite/obj37_a.bin"
  23323.  
  23324. ; -------------------------------------------------------------------------------
  23325. ; Unused sprite mappings
  23326. ; -------------------------------------------------------------------------------
  23327. Obj37_MapUnc_123E6: BINCLUDE "mappings/sprite/obj37_b.bin"
  23328. ; -------------------------------------------------------------------------------
  23329. ; Unused sprite mappings
  23330. ; -------------------------------------------------------------------------------
  23331. Obj37_MapUnc_124E6: BINCLUDE "mappings/sprite/obj37_c.bin"
  23332.  
  23333. ; ===========================================================================
  23334. ; ----------------------------------------------------------------------------
  23335. ; Object DC - Ring prize from Casino Night Zone
  23336. ; ----------------------------------------------------------------------------
  23337. casino_prize_x_pos = objoff_30 ; X position of the ring with greater precision
  23338. casino_prize_y_pos = objoff_34 ; Y position of the ring with greater precision
  23339. casino_prize_machine_x_pos = objoff_38 ; X position of the slot machine that generated the ring
  23340. casino_prize_machine_y_pos = objoff_3A ; Y position of the slot machine that generated the ring
  23341. casino_prize_display_delay = objoff_3C ; number of frames before which the ring is displayed
  23342. ; Sprite_125E6:
  23343. ObjDC:
  23344. moveq #0,d0
  23345. move.b routine(a0),d0
  23346. move.w ObjDC_Index(pc,d0.w),d1
  23347. jmp ObjDC_Index(pc,d1.w)
  23348. ; ===========================================================================
  23349. ; off_125F4:
  23350. ObjDC_Index: offsetTable
  23351. offsetTableEntry.w ObjDC_Main ; 0
  23352. offsetTableEntry.w ObjDC_Animate ; 2
  23353. offsetTableEntry.w ObjDC_Delete ; 4
  23354. ; ===========================================================================
  23355. ; loc_125FA:
  23356. ObjDC_Main:
  23357. moveq #0,d1
  23358. move.w casino_prize_machine_x_pos(a0),d1
  23359. swap d1
  23360. move.l casino_prize_x_pos(a0),d0
  23361. sub.l d1,d0
  23362. asr.l #4,d0
  23363. sub.l d0,casino_prize_x_pos(a0)
  23364. move.w casino_prize_x_pos(a0),x_pos(a0)
  23365. moveq #0,d1
  23366. move.w casino_prize_machine_y_pos(a0),d1
  23367. swap d1
  23368. move.l casino_prize_y_pos(a0),d0
  23369. sub.l d1,d0
  23370. asr.l #4,d0
  23371. sub.l d0,casino_prize_y_pos(a0)
  23372. move.w casino_prize_y_pos(a0),y_pos(a0)
  23373. lea Ani_objDC(pc),a1
  23374. bsr.w AnimateSprite
  23375. subq.w #1,casino_prize_display_delay(a0)
  23376. bne.w DisplaySprite
  23377. movea.l objoff_2A(a0),a1
  23378. subq.w #1,(a1)
  23379. bsr.w CollectRing
  23380. addi_.b #2,routine(a0)
  23381. ; loc_1264E:
  23382. ObjDC_Animate:
  23383. lea Ani_Ring(pc),a1
  23384. bsr.w AnimateSprite
  23385. bra.w DisplaySprite
  23386. ; ===========================================================================
  23387. ; BranchTo8_DeleteObject
  23388. ObjDC_Delete:
  23389. bra.w DeleteObject
  23390. ; ===========================================================================
  23391. ; animation script
  23392. ; byte_1265E
  23393. Ani_objDC: offsetTable
  23394. offsetTableEntry.w + ; 0
  23395. + dc.b 1, 0, 1, 2, 3,$FF
  23396. ; ===========================================================================
  23397.  
  23398. if gameRevision<2
  23399. nop
  23400. endif
  23401.  
  23402. if ~~removeJmpTos
  23403. JmpTo4_CalcSine
  23404. jmp (CalcSine).l
  23405.  
  23406. align 4
  23407. endif
  23408.  
  23409.  
  23410.  
  23411.  
  23412. ; ===========================================================================
  23413. ; ----------------------------------------------------------------------------
  23414. ; Object 26 - Monitor
  23415. ;
  23416. ; The power-ups themselves are handled by the next object. This just does the
  23417. ; monitor collision and graphics.
  23418. ; ----------------------------------------------------------------------------
  23419. ; Obj_Monitor:
  23420. Obj26:
  23421. moveq #0,d0
  23422. move.b routine(a0),d0
  23423. move.w Obj26_Index(pc,d0.w),d1
  23424. jmp Obj26_Index(pc,d1.w)
  23425. ; ===========================================================================
  23426. ; obj_26_subtbl:
  23427. Obj26_Index: offsetTable
  23428. offsetTableEntry.w Obj26_Init ; 0
  23429. offsetTableEntry.w Obj26_Main ; 2
  23430. offsetTableEntry.w Obj26_Break ; 4
  23431. offsetTableEntry.w Obj26_Animate ; 6
  23432. offsetTableEntry.w BranchTo2_MarkObjGone ; 8
  23433. ; ===========================================================================
  23434. ; obj_26_sub_0: Obj_26_Init:
  23435. Obj26_Init:
  23436. addq.b #2,routine(a0)
  23437. move.b #$E,y_radius(a0)
  23438. move.b #$E,x_radius(a0)
  23439. move.l #Obj26_MapUnc_12D36,mappings(a0)
  23440. move.w #make_art_tile(ArtTile_ArtNem_Powerups,0,0),art_tile(a0)
  23441. bsr.w Adjust2PArtPointer
  23442. move.b #4,render_flags(a0)
  23443. move.b #3,priority(a0)
  23444. move.b #$F,width_pixels(a0)
  23445.  
  23446. lea (Object_Respawn_Table).w,a2
  23447. moveq #0,d0
  23448. move.b respawn_index(a0),d0
  23449. bclr #7,2(a2,d0.w)
  23450. btst #0,2(a2,d0.w) ; if this bit is set it means the monitor is already broken
  23451. beq.s +
  23452. move.b #8,routine(a0) ; set monitor to 'broken' state
  23453. move.b #$B,mapping_frame(a0)
  23454. rts
  23455. ; ---------------------------------------------------------------------------
  23456. +
  23457. move.b #$46,collision_flags(a0)
  23458. move.b subtype(a0),anim(a0) ; subtype = icon to display
  23459. tst.w (Two_player_mode).w ; is it two player mode?
  23460. beq.s Obj26_Main ; if not, branch
  23461. move.b #9,anim(a0) ; use '?' icon
  23462. ;obj_26_sub_2:
  23463. Obj26_Main:
  23464. move.b routine_secondary(a0),d0
  23465. beq.s SolidObject_Monitor
  23466. ; only when secondary routine isn't 0
  23467. ; make monitor fall
  23468. bsr.w ObjectMoveAndFall
  23469. jsr (ObjCheckFloorDist).l
  23470. tst.w d1 ; is monitor in the ground?
  23471. bpl.w SolidObject_Monitor ; if not, branch
  23472. add.w d1,y_pos(a0) ; move monitor out of the ground
  23473. clr.w y_vel(a0)
  23474. clr.b routine_secondary(a0) ; stop monitor from falling
  23475. ; loc_1271C:
  23476. SolidObject_Monitor:
  23477. move.w #$1A,d1 ; monitor's width
  23478. move.w #$F,d2
  23479. move.w d2,d3
  23480. addq.w #1,d3
  23481. move.w x_pos(a0),d4
  23482. lea (MainCharacter).w,a1 ; a1=character
  23483. moveq #p1_standing_bit,d6
  23484. movem.l d1-d4,-(sp)
  23485. bsr.w SolidObject_Monitor_Sonic
  23486. movem.l (sp)+,d1-d4
  23487. lea (Sidekick).w,a1 ; a1=character
  23488. moveq #p2_standing_bit,d6
  23489. bsr.w SolidObject_Monitor_Tails
  23490.  
  23491. Obj26_Animate:
  23492. lea (Ani_obj26).l,a1
  23493. bsr.w AnimateSprite
  23494.  
  23495. BranchTo2_MarkObjGone
  23496. bra.w MarkObjGone
  23497.  
  23498. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  23499. ; sub_12756:
  23500. SolidObject_Monitor_Sonic:
  23501. btst d6,status(a0) ; is Sonic standing on the monitor?
  23502. bne.s Obj26_ChkOverEdge ; if yes, branch
  23503. cmpi.b #AniIDSonAni_Roll,anim(a1) ; is Sonic spinning?
  23504. bne.w SolidObject_cont ; if not, branch
  23505. rts
  23506. ; End of function SolidObject_Monitor_Sonic
  23507.  
  23508.  
  23509. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  23510. ; sub_12768:
  23511. SolidObject_Monitor_Tails:
  23512. btst d6,status(a0) ; is Tails standing on the monitor?
  23513. bne.s Obj26_ChkOverEdge ; if yes, branch
  23514. tst.w (Two_player_mode).w ; is it two player mode?
  23515. beq.w SolidObject_cont ; if not, branch
  23516. ; in one player mode monitors always behave as solid for Tails
  23517. cmpi.b #2,anim(a1) ; is Tails spinning?
  23518. bne.w SolidObject_cont ; if not, branch
  23519. rts
  23520. ; End of function SolidObject_Monitor_Tails
  23521.  
  23522. ; ---------------------------------------------------------------------------
  23523. ; Checks if the player has walked over the edge of the monitor.
  23524. ; ---------------------------------------------------------------------------
  23525. ;loc_12782:
  23526. Obj26_ChkOverEdge:
  23527. move.w d1,d2
  23528. add.w d2,d2
  23529. btst #1,status(a1) ; is the character in the air?
  23530. bne.s + ; if yes, branch
  23531. ; check, if character is standing on
  23532. move.w x_pos(a1),d0
  23533. sub.w x_pos(a0),d0
  23534. add.w d1,d0
  23535. bmi.s + ; branch, if character is behind the left edge of the monitor
  23536. cmp.w d2,d0
  23537. blo.s Obj26_CharStandOn ; branch, if character is not beyond the right edge of the monitor
  23538. +
  23539. ; if the character isn't standing on the monitor
  23540. bclr #3,status(a1) ; clear 'on object' bit
  23541. bset #1,status(a1) ; set 'in air' bit
  23542. bclr d6,status(a0) ; clear 'standing on' bit for the current character
  23543. moveq #0,d4
  23544. rts
  23545. ; ---------------------------------------------------------------------------
  23546. ;loc_127B2:
  23547. Obj26_CharStandOn:
  23548. move.w d4,d2
  23549. bsr.w MvSonicOnPtfm
  23550. moveq #0,d4
  23551. rts
  23552. ; ===========================================================================
  23553. ;obj_26_sub_4:
  23554. Obj26_Break:
  23555. move.b status(a0),d0
  23556. andi.b #standing_mask|pushing_mask,d0 ; is someone touching the monitor?
  23557. beq.s Obj26_SpawnIcon ; if not, branch
  23558. move.b d0,d1
  23559. andi.b #p1_standing|p1_pushing,d1 ; is it the main character?
  23560. beq.s + ; if not, branch
  23561. andi.b #$D7,(MainCharacter+status).w
  23562. ori.b #2,(MainCharacter+status).w ; prevent Sonic from walking in the air
  23563. +
  23564. andi.b #p2_standing|p2_pushing,d0 ; is it the sidekick?
  23565. beq.s Obj26_SpawnIcon ; if not, branch
  23566. andi.b #$D7,(Sidekick+status).w
  23567. ori.b #2,(Sidekick+status).w ; prevent Tails from walking in the air
  23568. ;loc_127EC:
  23569. Obj26_SpawnIcon:
  23570. clr.b status(a0)
  23571. addq.b #2,routine(a0)
  23572. move.b #0,collision_flags(a0)
  23573. bsr.w SingleObjLoad
  23574. bne.s Obj26_SpawnSmoke
  23575. _move.b #ObjID_MonitorContents,id(a1) ; load obj2E
  23576. move.w x_pos(a0),x_pos(a1) ; set icon's position
  23577. move.w y_pos(a0),y_pos(a1)
  23578. move.b anim(a0),anim(a1)
  23579. move.w parent(a0),parent(a1) ; parent gets the item
  23580. ;loc_1281E:
  23581. Obj26_SpawnSmoke:
  23582. bsr.w SingleObjLoad
  23583. bne.s +
  23584. _move.b #ObjID_Explosion,id(a1) ; load obj27
  23585. addq.b #2,routine(a1)
  23586. move.w x_pos(a0),x_pos(a1)
  23587. move.w y_pos(a0),y_pos(a1)
  23588. +
  23589. lea (Object_Respawn_Table).w,a2
  23590. moveq #0,d0
  23591. move.b respawn_index(a0),d0
  23592. bset #0,2(a2,d0.w) ; mark monitor as destroyed
  23593. move.b #$A,anim(a0)
  23594. bra.w DisplaySprite
  23595. ; ===========================================================================
  23596. ; ----------------------------------------------------------------------------
  23597. ; Object 2E - Monitor contents (code for power-up behavior and rising image)
  23598. ; ----------------------------------------------------------------------------
  23599.  
  23600. Obj2E:
  23601. moveq #0,d0
  23602. move.b routine(a0),d0
  23603. move.w Obj2E_Index(pc,d0.w),d1
  23604. jmp Obj2E_Index(pc,d1.w)
  23605. ; ===========================================================================
  23606. ; off_12862:
  23607. Obj2E_Index: offsetTable
  23608. offsetTableEntry.w Obj2E_Init ; 0
  23609. offsetTableEntry.w Obj2E_Raise ; 2
  23610. offsetTableEntry.w Obj2E_Wait ; 4
  23611. ; ===========================================================================
  23612. ; Object initialization. Called if routine counter == 0.
  23613. ; loc_12868:
  23614. Obj2E_Init:
  23615. addq.b #2,routine(a0)
  23616. move.w #make_art_tile(ArtTile_ArtNem_Powerups,0,1),art_tile(a0)
  23617. bsr.w Adjust2PArtPointer
  23618. move.b #$24,render_flags(a0)
  23619. move.b #3,priority(a0)
  23620. move.b #8,width_pixels(a0)
  23621. move.w #-$300,y_vel(a0)
  23622. moveq #0,d0
  23623. move.b anim(a0),d0
  23624.  
  23625. tst.w (Two_player_mode).w ; is it two player mode?
  23626. beq.s loc_128C6 ; if not, branch
  23627. ; give 'random' item in two player mode
  23628. move.w (Timer_frames).w,d0 ; use the timer to determine which item
  23629. andi.w #7,d0 ; and 7 means there are 8 different items
  23630. addq.w #1,d0 ; add 1 to prevent getting the static monitor
  23631. tst.w (Two_player_items).w ; are monitors set to 'teleport only'?
  23632. beq.s + ; if not, branch
  23633. moveq #8,d0 ; force contents to be teleport
  23634. + ; keep teleport monitor from causing unwanted effects
  23635. cmpi.w #8,d0 ; teleport?
  23636. bne.s + ; if not, branch
  23637. move.b (Update_HUD_timer).w,d1
  23638. add.b (Update_HUD_timer_2P).w,d1
  23639. cmpi.b #2,d1 ; is either player done with the act?
  23640. beq.s + ; if not, branch
  23641. moveq #7,d0 ; give invincibility, instead
  23642. +
  23643. move.b d0,anim(a0)
  23644. ;loc_128C6:
  23645. loc_128C6: ; Determine correct mappings offset.
  23646. addq.b #1,d0
  23647. move.b d0,mapping_frame(a0)
  23648. movea.l #Obj26_MapUnc_12D36,a1
  23649. add.b d0,d0
  23650. adda.w (a1,d0.w),a1
  23651. addq.w #2,a1
  23652. move.l a1,mappings(a0)
  23653. ; loc_128DE:
  23654. Obj2E_Raise:
  23655. bsr.s +
  23656. bra.w DisplaySprite
  23657.  
  23658. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  23659.  
  23660. +
  23661. tst.w y_vel(a0) ; is icon still floating up?
  23662. bpl.w + ; if not, branch
  23663. bsr.w ObjectMove ; update position
  23664. addi.w #$18,y_vel(a0) ; reduce upward speed
  23665. rts
  23666. ; ---------------------------------------------------------------------------
  23667.  
  23668. +
  23669. addq.b #2,routine(a0)
  23670. move.w #$1D,anim_frame_duration(a0)
  23671. movea.w parent(a0),a1 ; a1=character
  23672. lea (Monitors_Broken).w,a2
  23673. cmpa.w #MainCharacter,a1 ; did Sonic break the monitor?
  23674. beq.s + ; if yes, branch
  23675. lea (Monitors_Broken_2P).w,a2
  23676.  
  23677. +
  23678. moveq #0,d0
  23679. move.b anim(a0),d0
  23680. add.w d0,d0
  23681. move.w Obj2E_Types(pc,d0.w),d0
  23682. jmp Obj2E_Types(pc,d0.w)
  23683. ; End of function
  23684.  
  23685. ; ===========================================================================
  23686. Obj2E_Types: offsetTable
  23687. offsetTableEntry.w robotnik_monitor ; 0 - Static
  23688. offsetTableEntry.w sonic_1up ; 1 - Sonic 1-up
  23689. offsetTableEntry.w tails_1up ; 2 - Tails 1-up
  23690. offsetTableEntry.w robotnik_monitor ; 3 - Robotnik
  23691. offsetTableEntry.w super_ring ; 4 - Super Ring
  23692. offsetTableEntry.w super_shoes ; 5 - Speed Shoes
  23693. offsetTableEntry.w shield_monitor ; 6 - Shield
  23694. offsetTableEntry.w invincible_monitor ; 7 - Invincibility
  23695. offsetTableEntry.w teleport_monitor ; 8 - Teleport
  23696. offsetTableEntry.w qmark_monitor ; 9 - Question mark
  23697. ; ===========================================================================
  23698. ; ---------------------------------------------------------------------------
  23699. ; Robotnik Monitor
  23700. ; hurts the player
  23701. ; ---------------------------------------------------------------------------
  23702. ; badnik_monitor:
  23703. robotnik_monitor:
  23704. addq.w #1,(a2)
  23705. bra.w Touch_ChkHurt2
  23706. ; ===========================================================================
  23707. ; ---------------------------------------------------------------------------
  23708. ; Sonic 1up Monitor
  23709. ; gives Sonic an extra life, or Tails in a 'Tails alone' game
  23710. ; ---------------------------------------------------------------------------
  23711. sonic_1up:
  23712. addq.w #1,(Monitors_Broken).w
  23713. addq.b #1,(Life_count).w
  23714. addq.b #1,(Update_HUD_lives).w
  23715. move.w #MusID_ExtraLife,d0
  23716. jmp (PlayMusic).l ; Play extra life music
  23717. ; ===========================================================================
  23718. ; ---------------------------------------------------------------------------
  23719. ; Tails 1up Monitor
  23720. ; gives Tails an extra life in two player mode
  23721. ; ---------------------------------------------------------------------------
  23722. tails_1up:
  23723. addq.w #1,(Monitors_Broken_2P).w
  23724. addq.b #1,(Life_count_2P).w
  23725. addq.b #1,(Update_HUD_lives_2P).w
  23726. move.w #MusID_ExtraLife,d0
  23727. jmp (PlayMusic).l ; Play extra life music
  23728. ; ===========================================================================
  23729. ; ---------------------------------------------------------------------------
  23730. ; Super Ring Monitor
  23731. ; gives the player 10 rings
  23732. ; ---------------------------------------------------------------------------
  23733. super_ring:
  23734. addq.w #1,(a2)
  23735.  
  23736. if gameRevision=0
  23737. lea (Ring_count).w,a2
  23738. lea (Update_HUD_rings).w,a3
  23739. lea (Extra_life_flags).w,a4
  23740. cmpa.w #MainCharacter,a1
  23741. beq.s +
  23742. lea (Ring_count_2P).w,a2
  23743. lea (Update_HUD_rings_2P).w,a3
  23744. lea (Extra_life_flags_2P).w,a4
  23745. + ; give player 10 rings
  23746. addi.w #10,(a2)
  23747. else
  23748. lea (Ring_count).w,a2
  23749. lea (Update_HUD_rings).w,a3
  23750. lea (Extra_life_flags).w,a4
  23751. lea (Rings_Collected).w,a5
  23752. cmpa.w #MainCharacter,a1
  23753. beq.s +
  23754. lea (Ring_count_2P).w,a2
  23755. lea (Update_HUD_rings_2P).w,a3
  23756. lea (Extra_life_flags_2P).w,a4
  23757. lea (Rings_Collected_2P).w,a5
  23758. +
  23759. addi.w #10,(a5)
  23760. cmpi.w #999,(a5)
  23761. blo.s +
  23762. move.w #999,(a5)
  23763.  
  23764. + ; give player 10 rings and max out at 999
  23765. addi.w #10,(a2)
  23766. cmpi.w #999,(a2)
  23767. blo.s +
  23768. move.w #999,(a2)
  23769. endif
  23770.  
  23771. +
  23772. ori.b #1,(a3)
  23773. cmpi.w #100,(a2)
  23774. blo.s + ; branch, if player has less than 100 rings
  23775. bset #1,(a4) ; set flag for first 1up
  23776. beq.s ChkPlayer_1up ; branch, if not yet set
  23777. cmpi.w #200,(a2)
  23778. blo.s + ; branch, if player has less than 200 rings
  23779. bset #2,(a4) ; set flag for second 1up
  23780. beq.s ChkPlayer_1up ; branch, if not yet set
  23781. +
  23782. move.w #SndID_Ring,d0
  23783. jmp (PlayMusic).l
  23784. ; ---------------------------------------------------------------------------
  23785. ;loc_129D4:
  23786. ChkPlayer_1up:
  23787. ; give 1up to correct player
  23788. cmpa.w #MainCharacter,a1
  23789. beq.w sonic_1up
  23790. bra.w tails_1up
  23791. ; ===========================================================================
  23792. ; ---------------------------------------------------------------------------
  23793. ; Super Sneakers Monitor
  23794. ; speeds the player up temporarily
  23795. ; ---------------------------------------------------------------------------
  23796. super_shoes:
  23797. addq.w #1,(a2)
  23798. bset #status_sec_hasSpeedShoes,status_secondary(a1) ; give super sneakers status
  23799. move.w #$4B0,speedshoes_time(a1)
  23800. cmpa.w #MainCharacter,a1 ; did the main character break the monitor?
  23801. bne.s super_shoes_Tails ; if not, branch
  23802. cmpi.w #2,(Player_mode).w ; is player using Tails?
  23803. beq.s super_shoes_Tails ; if yes, branch
  23804. move.w #$C00,(Sonic_top_speed).w ; set stats
  23805. move.w #$18,(Sonic_acceleration).w
  23806. move.w #$80,(Sonic_deceleration).w
  23807. bra.s +
  23808. ; ---------------------------------------------------------------------------
  23809. ;loc_12A10:
  23810. super_shoes_Tails:
  23811. move.w #$C00,(Tails_top_speed).w
  23812. move.w #$18,(Tails_acceleration).w
  23813. move.w #$80,(Tails_deceleration).w
  23814. +
  23815. move.w #MusID_SpeedUp,d0
  23816. jmp (PlayMusic).l ; Speed up tempo
  23817. ; ===========================================================================
  23818. ; ---------------------------------------------------------------------------
  23819. ; Shield Monitor
  23820. ; gives the player a shield that absorbs one hit
  23821. ; ---------------------------------------------------------------------------
  23822. shield_monitor:
  23823. addq.w #1,(a2)
  23824. bset #status_sec_hasShield,status_secondary(a1) ; give shield status
  23825. move.w #SndID_Shield,d0
  23826. jsr (PlayMusic).l
  23827. tst.b parent+1(a0)
  23828. bne.s +
  23829. move.b #ObjID_Shield,(Sonic_Shield+id).w ; load Obj38 (shield) at $FFFFD180
  23830. move.w a1,(Sonic_Shield+parent).w
  23831. rts
  23832. ; ---------------------------------------------------------------------------
  23833. + ; give shield to sidekick
  23834. move.b #ObjID_Shield,(Tails_Shield+id).w ; load Obj38 (shield) at $FFFFD1C0
  23835. move.w a1,(Tails_Shield+parent).w
  23836. rts
  23837. ; ===========================================================================
  23838. ; ---------------------------------------------------------------------------
  23839. ; Invincibility Monitor
  23840. ; makes the player temporarily invincible
  23841. ; ---------------------------------------------------------------------------
  23842. invincible_monitor:
  23843. addq.w #1,(a2)
  23844. tst.b (Super_Sonic_flag).w ; is Sonic super?
  23845. bne.s +++ ; rts ; if yes, branch
  23846. bset #status_sec_isInvincible,status_secondary(a1) ; give invincibility status
  23847. move.w #20*60,invincibility_time(a1) ; 20 seconds
  23848. tst.b (Current_Boss_ID).w ; don't change music during boss battles
  23849. bne.s +
  23850. cmpi.b #$C,air_left(a1) ; or when drowning
  23851. bls.s +
  23852. move.w #MusID_Invincible,d0
  23853. jsr (PlayMusic).l
  23854. +
  23855. tst.b parent+1(a0)
  23856. bne.s +
  23857. move.b #ObjID_InvStars,(Sonic_InvincibilityStars+id).w ; load Obj35 (invincibility stars) at $FFFFD200
  23858. move.w a1,(Sonic_InvincibilityStars+parent).w
  23859. rts
  23860. ; ---------------------------------------------------------------------------
  23861. + ; give invincibility to sidekick
  23862. move.b #ObjID_InvStars,(Tails_InvincibilityStars+id).w ; load Obj35 (invincibility stars) at $FFFFD300
  23863. move.w a1,(Tails_InvincibilityStars+parent).w
  23864. +
  23865. rts
  23866. ; ===========================================================================
  23867. ; ---------------------------------------------------------------------------
  23868. ; Teleport Monitor
  23869. ; swaps both players around
  23870. ; ---------------------------------------------------------------------------
  23871. ;loc_12AA6:
  23872. teleport_monitor:
  23873. addq.w #1,(a2)
  23874. cmpi.b #6,(MainCharacter+routine).w ; is player 1 dead or respawning?
  23875. bhs.s + ; if yes, branch
  23876. cmpi.b #6,(Sidekick+routine).w ; is player 2 dead or respawning?
  23877. blo.s swap_players ; if not, branch
  23878. + ; can't teleport if either player is dead
  23879. rts
  23880.  
  23881. ; ---------------------------------------------------------------------------
  23882. ; Routine to make both players swap positions
  23883. ; and handle anything else that needs to be done
  23884. ; ---------------------------------------------------------------------------
  23885. swap_players:
  23886. lea (teleport_swap_table).l,a3
  23887. moveq #(teleport_swap_table_end-teleport_swap_table)/6-1,d2 ; amount of entries in table - 1
  23888.  
  23889. process_swap_table:
  23890. movea.w (a3)+,a1 ; address for main character
  23891. movea.w (a3)+,a2 ; address for sidekick
  23892. move.w (a3)+,d1 ; amount of word length data to be swapped
  23893.  
  23894. - ; swap data between the main character and the sidekick d1 times
  23895. move.w (a1),d0
  23896. move.w (a2),(a1)+
  23897. move.w d0,(a2)+
  23898. dbf d1,-
  23899.  
  23900. dbf d2,process_swap_table ; process remaining entries in the list
  23901.  
  23902. move.b #1,(MainCharacter+next_anim).w
  23903. move.b #1,(Sidekick+next_anim).w
  23904. if gameRevision>0
  23905. move.b #0,(MainCharacter+mapping_frame).w
  23906. move.b #0,(Sidekick+mapping_frame).w
  23907. endif
  23908. move.b #-1,(Sonic_LastLoadedDPLC).w
  23909. move.b #-1,(Tails_LastLoadedDPLC).w
  23910. move.b #-1,(TailsTails_LastLoadedDPLC).w
  23911. lea (unk_F786).w,a1
  23912. lea (unk_F789).w,a2
  23913.  
  23914. moveq #2,d1
  23915. - move.b (a1),d0
  23916. move.b (a2),(a1)+
  23917. move.b d0,(a2)+
  23918. dbf d1,-
  23919.  
  23920. subi.w #$180,(Camera_Y_pos).w
  23921. subi.w #$180,(Camera_Y_pos_P2).w
  23922. move.w (MainCharacter+art_tile).w,d0
  23923. andi.w #drawing_mask,(MainCharacter+art_tile).w
  23924. tst.w (Sidekick+art_tile).w
  23925. bpl.s +
  23926. ori.w #high_priority,(MainCharacter+art_tile).w
  23927. +
  23928. andi.w #drawing_mask,(Sidekick+art_tile).w
  23929. tst.w d0
  23930. bpl.s +
  23931. ori.w #high_priority,(Sidekick+art_tile).w
  23932. +
  23933. move.b #1,(Camera_Max_Y_Pos_Changing).w
  23934. lea (Dynamic_Object_RAM).w,a1
  23935. moveq #(Dynamic_Object_RAM_End-Dynamic_Object_RAM)/object_size-1,d1
  23936.  
  23937. ; process objects:
  23938. swap_loop_objects:
  23939. cmpi.b #ObjID_PinballMode,id(a1) ; is it obj84 (pinball mode switcher)?
  23940. beq.s + ; if yes, branch
  23941. cmpi.b #ObjID_PlaneSwitcher,id(a1) ; is it obj03 (collision plane switcher)?
  23942. bne.s ++ ; if not, branch further
  23943.  
  23944. +
  23945. move.b objoff_34(a1),d0
  23946. move.b objoff_35(a1),objoff_34(a1)
  23947. move.b d0,objoff_35(a1)
  23948.  
  23949. +
  23950. cmpi.b #ObjID_PointPokey,id(a1) ; is it objD6 (CNZ point giver)?
  23951. bne.s + ; if not, branch
  23952. move.l objoff_30(a1),d0
  23953. move.l objoff_34(a1),objoff_30(a1)
  23954. move.l d0,objoff_34(a1)
  23955.  
  23956. +
  23957. cmpi.b #ObjID_LauncherSpring,id(a1) ; is it obj85 (CNZ pressure spring)?
  23958. bne.s + ; if not, branch
  23959. move.b objoff_36(a1),d0
  23960. move.b objoff_37(a1),objoff_36(a1)
  23961. move.b d0,objoff_37(a1)
  23962.  
  23963. +
  23964. lea next_object(a1),a1 ; look at next object ; a1=object
  23965. dbf d1,swap_loop_objects ; loop
  23966.  
  23967.  
  23968. lea (MainCharacter).w,a1 ; a1=character
  23969. move.b #ObjID_Shield,(Sonic_Shield+id).w ; load Obj38 (shield) at $FFFFD180
  23970. move.w a1,(Sonic_Shield+parent).w
  23971. move.b #ObjID_InvStars,(Sonic_InvincibilityStars+id).w ; load Obj35 (invincibility stars) at $FFFFD200
  23972. move.w a1,(Sonic_InvincibilityStars+parent).w
  23973. btst #2,status(a1) ; is Sonic spinning?
  23974. bne.s + ; if yes, branch
  23975. move.b #$13,y_radius(a1) ; set to standing height
  23976. move.b #9,x_radius(a1)
  23977. +
  23978. btst #3,status(a1) ; is Sonic on an object?
  23979. beq.s + ; if not, branch
  23980. moveq #0,d0
  23981. move.b interact(a1),d0
  23982. if object_size=$40
  23983. lsl.w #6,d0
  23984. else
  23985. mulu.w #object_size,d0
  23986. endif
  23987. addi.l #Object_RAM,d0
  23988. movea.l d0,a2 ; a2=object
  23989. bclr #4,status(a2)
  23990. bset #3,status(a2)
  23991.  
  23992. +
  23993. lea (Sidekick).w,a1 ; a1=character
  23994. move.b #ObjID_Shield,(Tails_Shield+id).w ; load Obj38 (shield) at $FFFFD1C0
  23995. move.w a1,(Tails_Shield+parent).w
  23996. move.b #ObjID_InvStars,(Tails_InvincibilityStars+id).w ; load Obj35 (invincibility) at $FFFFD300
  23997. move.w a1,(Tails_InvincibilityStars+parent).w
  23998. btst #2,status(a1) ; is Tails spinning?
  23999. bne.s + ; if yes, branch
  24000. move.b #$F,y_radius(a1) ; set to standing height
  24001. move.b #9,x_radius(a1)
  24002.  
  24003. +
  24004. btst #3,status(a1) ; is Tails on an object?
  24005. beq.s + ; if not, branch
  24006. moveq #0,d0
  24007. move.b interact(a1),d0
  24008. if object_size=$40
  24009. lsl.w #6,d0
  24010. else
  24011. mulu.w #object_size,d0
  24012. endif
  24013. addi.l #Object_RAM,d0
  24014. movea.l d0,a2 ; a2=object
  24015. bclr #3,status(a2)
  24016. bset #4,status(a2)
  24017.  
  24018. +
  24019. move.b #$40,(Teleport_timer).w
  24020. move.b #1,(Teleport_flag).w
  24021. move.w #SndID_Teleport,d0
  24022. jmp (PlayMusic).l
  24023. ; ===========================================================================
  24024. ; Table listing all the addresses for players 1 and 2 that need to be swapped
  24025. ; when a teleport monitor is destroyed
  24026. ;byte_12C52:
  24027. teleport_swap_table:
  24028. dc.w MainCharacter+x_pos, Sidekick+x_pos, $1B
  24029. dc.w Camera_X_pos_last, Camera_X_pos_last_P2, 0
  24030. dc.w Obj_respawn_index, Obj_respawn_index_P2, 0
  24031. dc.w Obj_load_addr_right, Obj_load_addr_2, 3
  24032. dc.w Sonic_top_speed, Tails_top_speed, 2
  24033. dc.w Ring_start_addr, Ring_start_addr_P2, 1
  24034. dc.w CNZ_Visible_bumpers_start, CNZ_Visible_bumpers_start_P2, 3
  24035. dc.w Camera_X_pos, Camera_X_pos_P2, $F
  24036. dc.w Camera_X_pos_coarse, Camera_X_pos_coarse_P2, 0
  24037. dc.w Camera_Min_X_pos, Tails_Min_X_pos, 3
  24038. dc.w Horiz_scroll_delay_val, Horiz_scroll_delay_val_P2, 1
  24039. dc.w Camera_Y_pos_bias, Camera_Y_pos_bias_P2, 0
  24040. dc.w Horiz_block_crossed_flag, Horiz_block_crossed_flag_P2, 3
  24041. dc.w Scroll_flags, Scroll_flags_P2, 3
  24042. dc.w Camera_RAM_copy, Camera_P2_copy, $F
  24043. dc.w Scroll_flags_copy, Scroll_flags_copy_P2, 3
  24044. dc.w Camera_X_pos_diff, Camera_X_pos_diff_P2, 1
  24045. dc.w Sonic_Pos_Record_Buf, Tails_Pos_Record_Buf, $7F
  24046. teleport_swap_table_end:
  24047. ; ===========================================================================
  24048. ; ---------------------------------------------------------------------------
  24049. ; '?' Monitor
  24050. ; doesn't actually do anything other than increase the player's monitor score
  24051. ; ---------------------------------------------------------------------------
  24052. qmark_monitor:
  24053. addq.w #1,(a2)
  24054. rts
  24055. ; ===========================================================================
  24056. ; ---------------------------------------------------------------------------
  24057. ; Holds icon in place for a while, then destroys it
  24058. ; ---------------------------------------------------------------------------
  24059. ;loc_12CC2:
  24060. Obj2E_Wait:
  24061. subq.w #1,anim_frame_duration(a0)
  24062. bmi.w DeleteObject
  24063. bra.w DisplaySprite
  24064. ; ===========================================================================
  24065. ; animation script
  24066. ; off_12CCE:
  24067. Ani_obj26: offsetTable
  24068. offsetTableEntry.w Ani_obj26_Static ; 0
  24069. offsetTableEntry.w Ani_obj26_Sonic ; 1
  24070. offsetTableEntry.w Ani_obj26_Tails ; 2
  24071. offsetTableEntry.w Ani_obj26_Eggman ; 3
  24072. offsetTableEntry.w Ani_obj26_Ring ; 4
  24073. offsetTableEntry.w Ani_obj26_Shoes ; 5
  24074. offsetTableEntry.w Ani_obj26_Shield ; 6
  24075. offsetTableEntry.w Ani_obj26_Invincibility ; 7
  24076. offsetTableEntry.w Ani_obj26_Teleport ; 8
  24077. offsetTableEntry.w Ani_obj26_QuestionMark ; 9
  24078. offsetTableEntry.w Ani_obj26_Broken ; $A
  24079. ; byte_12CE4:
  24080. Ani_obj26_Static:
  24081. dc.b $01 ; duration
  24082. dc.b $00 ; frame number (which sprite table to use)
  24083. dc.b $01 ; frame number
  24084. dc.b $FF ; terminator
  24085. ; byte_12CE8:
  24086. Ani_obj26_Sonic:
  24087. dc.b 1, 0, 2, 2, 1, 2, 2,$FF
  24088. ; byte_12CF0:
  24089. Ani_obj26_Tails:
  24090. dc.b 1, 0, 3, 3, 1, 3, 3,$FF
  24091. ; byte_12CF8:
  24092. Ani_obj26_Eggman:
  24093. dc.b 1, 0, 4, 4, 1, 4, 4,$FF
  24094. ; byte_12D00:
  24095. Ani_obj26_Ring:
  24096. dc.b 1, 0, 5, 5, 1, 5, 5,$FF
  24097. ; byte_12D08:
  24098. Ani_obj26_Shoes:
  24099. dc.b 1, 0, 6, 6, 1, 6, 6,$FF
  24100. ; byte_12D10:
  24101. Ani_obj26_Shield:
  24102. dc.b 1, 0, 7, 7, 1, 7, 7,$FF
  24103. ; byte_12D18:
  24104. Ani_obj26_Invincibility:
  24105. dc.b 1, 0, 8, 8, 1, 8, 8,$FF
  24106. ; byte_12D20:
  24107. Ani_obj26_Teleport:
  24108. dc.b 1, 0, 9, 9, 1, 9, 9,$FF
  24109. ; byte_12D28:
  24110. Ani_obj26_QuestionMark:
  24111. dc.b 1, 0, $A, $A, 1, $A, $A,$FF
  24112. ; byte_12D30:
  24113. Ani_obj26_Broken:
  24114. dc.b 2, 0, 1, $B,$FE, 1
  24115. even
  24116. ; ---------------------------------------------------------------------------------
  24117. ; Sprite Mappings - Sprite table for monitor and monitor contents (26, ??)
  24118. ; ---------------------------------------------------------------------------------
  24119. ; MapUnc_12D36: MapUnc_obj26:
  24120. Obj26_MapUnc_12D36: BINCLUDE "mappings/sprite/obj26.bin"
  24121. ; ===========================================================================
  24122.  
  24123. if gameRevision<2
  24124. nop
  24125. endif
  24126.  
  24127.  
  24128.  
  24129.  
  24130. ; ----------------------------------------------------------------------------
  24131. ; Object 0E - Flashing stars from intro
  24132. ; ----------------------------------------------------------------------------
  24133. ; Sprite_12E18:
  24134. Obj0E:
  24135. moveq #0,d0
  24136. move.b routine(a0),d0
  24137. move.w Obj0E_Index(pc,d0.w),d1
  24138. jmp Obj0E_Index(pc,d1.w)
  24139. ; ===========================================================================
  24140. ; off_12E26: Obj0E_States:
  24141. Obj0E_Index: offsetTable
  24142. offsetTableEntry.w Obj0E_Init ; 0
  24143. offsetTableEntry.w Obj0E_Sonic ; 2
  24144. offsetTableEntry.w Obj0E_Tails ; 4
  24145. offsetTableEntry.w Obj0E_LogoTop ; 6
  24146. offsetTableEntry.w Obj0E_LargeStar ; 8
  24147. offsetTableEntry.w Obj0E_SonicHand ; $A
  24148. offsetTableEntry.w Obj0E_SmallStar ; $C
  24149. offsetTableEntry.w Obj0E_SkyPiece ; $E
  24150. offsetTableEntry.w Obj0E_TailsHand ; $10
  24151. ; ===========================================================================
  24152. ; loc_12E38:
  24153. Obj0E_Init:
  24154. addq.b #2,routine(a0) ; useless, because it's overwritten with the subtype below
  24155. move.l #Obj0E_MapUnc_136A8,mappings(a0)
  24156. move.w #make_art_tile(ArtTile_ArtNem_TitleSprites,0,0),art_tile(a0)
  24157. move.b #4,priority(a0)
  24158. move.b subtype(a0),routine(a0)
  24159. bra.s Obj0E
  24160. ; ===========================================================================
  24161.  
  24162. Obj0E_Sonic:
  24163. addq.w #1,objoff_34(a0)
  24164. cmpi.w #$120,objoff_34(a0)
  24165. bhs.s +
  24166. bsr.w TitleScreen_SetFinalState
  24167. +
  24168. moveq #0,d0
  24169. move.b routine_secondary(a0),d0
  24170. move.w off_12E76(pc,d0.w),d1
  24171. jmp off_12E76(pc,d1.w)
  24172. ; ===========================================================================
  24173. off_12E76: offsetTable
  24174. offsetTableEntry.w Obj0E_Sonic_Init ; 0
  24175. offsetTableEntry.w loc_12EC2 ; 2
  24176. offsetTableEntry.w loc_12EE8 ; 4
  24177. offsetTableEntry.w loc_12F18 ; 6
  24178. offsetTableEntry.w loc_12F52 ; 8
  24179. offsetTableEntry.w Obj0E_Sonic_LastFrame ; $A
  24180. offsetTableEntry.w loc_12F7C ; $C
  24181. offsetTableEntry.w loc_12F9A ; $E
  24182. offsetTableEntry.w loc_12FD6 ; $10
  24183. offsetTableEntry.w loc_13014 ; $12
  24184. ; ===========================================================================
  24185. ; spawn more stars
  24186. Obj0E_Sonic_Init:
  24187. addq.b #2,routine_secondary(a0)
  24188. move.b #5,mapping_frame(a0)
  24189. move.w #$110,x_pixel(a0)
  24190. move.w #$E0,y_pixel(a0)
  24191. lea (IntroLargeStar).w,a1
  24192. move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro stars) at $FFFFB0C0
  24193. move.b #8,subtype(a1) ; large star
  24194. lea (IntroEmblemTop).w,a1
  24195. move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro stars) at $FFFFD140
  24196. move.b #6,subtype(a1) ; logo top
  24197. moveq #SndID_Sparkle,d0
  24198. jmpto (PlaySound).l, JmpTo4_PlaySound
  24199. ; ===========================================================================
  24200.  
  24201. loc_12EC2:
  24202. cmpi.w #$38,objoff_34(a0)
  24203. bhs.s +
  24204. rts
  24205. ; ===========================================================================
  24206. +
  24207. addq.b #2,routine_secondary(a0)
  24208. lea (TitleScreenPaletteChanger3).w,a1
  24209. move.b #ObjID_TtlScrPalChanger,id(a1) ; load objC9 (palette change)
  24210. move.b #0,subtype(a1)
  24211. st.b objoff_30(a0)
  24212. moveq #MusID_Title,d0 ; title music
  24213. jmpto (PlayMusic).l, JmpTo4_PlayMusic
  24214. ; ===========================================================================
  24215.  
  24216. loc_12EE8:
  24217. cmpi.w #$80,objoff_34(a0)
  24218. bhs.s +
  24219. rts
  24220. ; ===========================================================================
  24221. +
  24222. addq.b #2,routine_secondary(a0)
  24223. lea (Pal_133EC).l,a1
  24224. lea (Normal_palette).w,a2
  24225.  
  24226. moveq #$F,d6
  24227. - move.w (a1)+,(a2)+
  24228. dbf d6,-
  24229.  
  24230. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  24231.  
  24232.  
  24233. sub_12F08:
  24234. lea (IntroSmallStar1).w,a1
  24235. move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB180
  24236. move.b #$E,subtype(a1) ; piece of sky
  24237. rts
  24238. ; End of function sub_12F08
  24239.  
  24240. ; ===========================================================================
  24241.  
  24242. loc_12F18:
  24243. moveq #word_13046_end-word_13046+4,d2
  24244. lea (word_13046).l,a1
  24245.  
  24246. loc_12F20:
  24247. move.w objoff_2A(a0),d0
  24248. addq.w #1,d0
  24249. move.w d0,objoff_2A(a0)
  24250. andi.w #3,d0
  24251. bne.s +
  24252. move.w objoff_2C(a0),d1
  24253. addq.w #4,d1
  24254. cmp.w d2,d1
  24255. bhs.w loc_1310A
  24256. move.w d1,objoff_2C(a0)
  24257. move.l -4(a1,d1.w),d0
  24258. move.w d0,y_pixel(a0)
  24259. swap d0
  24260. move.w d0,x_pixel(a0)
  24261. +
  24262. bra.w DisplaySprite
  24263. ; ===========================================================================
  24264.  
  24265. loc_12F52:
  24266. lea (Ani_obj0E).l,a1
  24267. bsr.w AnimateSprite
  24268. bra.w DisplaySprite
  24269. ; ===========================================================================
  24270.  
  24271. Obj0E_Sonic_LastFrame:
  24272. addq.b #2,routine_secondary(a0)
  24273. move.b #$12,mapping_frame(a0)
  24274. lea (IntroSonicHand).w,a1
  24275. move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB1C0
  24276. move.b #$A,subtype(a1) ; Sonic's hand
  24277. bra.w DisplaySprite
  24278. ; ===========================================================================
  24279.  
  24280. loc_12F7C:
  24281. cmpi.w #$C0,objoff_34(a0)
  24282. blo.s +
  24283. addq.b #2,routine_secondary(a0)
  24284. lea (IntroTails).w,a1
  24285. move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB080
  24286. move.b #4,subtype(a1) ; Tails
  24287. +
  24288. bra.w DisplaySprite
  24289. ; ===========================================================================
  24290.  
  24291. loc_12F9A:
  24292. cmpi.w #$120,objoff_34(a0)
  24293. blo.s +
  24294. addq.b #2,routine_secondary(a0)
  24295. clr.w objoff_2C(a0)
  24296. st objoff_2F(a0)
  24297. lea (Normal_palette_line3).w,a1
  24298. move.w #$EEE,d0
  24299.  
  24300. moveq #$F,d6
  24301. - move.w d0,(a1)+
  24302. dbf d6,-
  24303.  
  24304. lea (TitleScreenPaletteChanger2).w,a1
  24305. move.b #ObjID_TtlScrPalChanger,id(a1) ; load objC9 (palette change handler) at $FFFFB240
  24306. move.b #2,subtype(a1)
  24307. move.b #ObjID_TitleMenu,(TitleScreenMenu+id).w ; load Obj0F (title screen menu) at $FFFFB400
  24308. +
  24309. bra.w DisplaySprite
  24310. ; ===========================================================================
  24311.  
  24312. loc_12FD6:
  24313. btst #6,(Graphics_Flags).w
  24314. beq.s +
  24315. cmpi.w #$190,objoff_34(a0)
  24316. beq.s ++
  24317. bra.w DisplaySprite
  24318. ; ===========================================================================
  24319. +
  24320. cmpi.w #$1D0,objoff_34(a0)
  24321. beq.s +
  24322. bra.w DisplaySprite
  24323. ; ===========================================================================
  24324. +
  24325. lea (IntroSmallStar2).w,a1
  24326. move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB440
  24327. move.b #$C,subtype(a1) ; small star
  24328. addq.b #2,routine_secondary(a0)
  24329. lea (IntroSmallStar1).w,a1
  24330. bsr.w DeleteObject2 ; delete object at $FFFFB180
  24331. bra.w DisplaySprite
  24332. ; ===========================================================================
  24333.  
  24334. loc_13014:
  24335. move.b (Vint_runcount+3).w,d0
  24336. andi.b #7,d0
  24337. bne.s ++
  24338. move.w objoff_2C(a0),d0
  24339. addq.w #2,d0
  24340. cmpi.w #CyclingPal_TitleStar_End-CyclingPal_TitleStar,d0
  24341. blo.s +
  24342. moveq #0,d0
  24343. +
  24344. move.w d0,objoff_2C(a0)
  24345. move.w CyclingPal_TitleStar(pc,d0.w),(Normal_palette_line3+$A).w
  24346. +
  24347. bra.w DisplaySprite
  24348. ; ===========================================================================
  24349. ; word_1303A:
  24350. CyclingPal_TitleStar:
  24351. binclude "art/palettes/Title Star Cycle.bin"
  24352. CyclingPal_TitleStar_End
  24353.  
  24354. word_13046:
  24355. dc.w $108, $D0
  24356. dc.w $100, $C0 ; 2
  24357. dc.w $F8, $B0 ; 4
  24358. dc.w $F6, $A6 ; 6
  24359. dc.w $FA, $9E ; 8
  24360. dc.w $100, $9A ; $A
  24361. dc.w $104, $99 ; $C
  24362. dc.w $108, $98 ; $E
  24363. word_13046_end
  24364. ; ===========================================================================
  24365.  
  24366. Obj0E_Tails:
  24367. moveq #0,d0
  24368. move.b routine_secondary(a0),d0
  24369. move.w off_13074(pc,d0.w),d1
  24370. jmp off_13074(pc,d1.w)
  24371. ; ===========================================================================
  24372. off_13074: offsetTable
  24373. offsetTableEntry.w Obj0E_Tails_Init ; 0
  24374. offsetTableEntry.w loc_13096 ; 2
  24375. offsetTableEntry.w loc_12F52 ; 4
  24376. offsetTableEntry.w loc_130A2 ; 6
  24377. offsetTableEntry.w BranchTo10_DisplaySprite ; 8
  24378. ; ===========================================================================
  24379.  
  24380. Obj0E_Tails_Init:
  24381. addq.b #2,routine_secondary(a0)
  24382. move.w #$D8,x_pixel(a0)
  24383. move.w #$D8,y_pixel(a0)
  24384. move.b #1,anim(a0)
  24385. rts
  24386. ; ===========================================================================
  24387.  
  24388. loc_13096:
  24389. moveq #word_130B8_end-word_130B8+4,d2
  24390. lea (word_130B8).l,a1
  24391. bra.w loc_12F20
  24392. ; ===========================================================================
  24393.  
  24394. loc_130A2:
  24395. addq.b #2,routine_secondary(a0)
  24396. lea (IntroTailsHand).w,a1
  24397. move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB200
  24398. move.b #$10,subtype(a1) ; Tails' hand
  24399.  
  24400. BranchTo10_DisplaySprite
  24401. bra.w DisplaySprite
  24402. ; ===========================================================================
  24403. word_130B8:
  24404. dc.w $D7,$C8
  24405. dc.w $D3,$B8 ; 2
  24406. dc.w $CE,$AC ; 4
  24407. dc.w $CC,$A6 ; 6
  24408. dc.w $CA,$A2 ; 8
  24409. dc.w $C9,$A1 ; $A
  24410. dc.w $C8,$A0 ; $C
  24411. word_130B8_end
  24412. ; ===========================================================================
  24413.  
  24414. Obj0E_LogoTop:
  24415. moveq #0,d0
  24416. move.b routine_secondary(a0),d0
  24417. move.w off_130E2(pc,d0.w),d1
  24418. jmp off_130E2(pc,d1.w)
  24419. ; ===========================================================================
  24420. off_130E2: offsetTable
  24421. offsetTableEntry.w Obj0E_LogoTop_Init ; 0
  24422. offsetTableEntry.w BranchTo11_DisplaySprite ; 2
  24423. ; ===========================================================================
  24424.  
  24425. Obj0E_LogoTop_Init:
  24426. move.b #$B,mapping_frame(a0)
  24427. tst.b (Graphics_Flags).w
  24428. bmi.s +
  24429. move.b #$A,mapping_frame(a0)
  24430. +
  24431. move.b #2,priority(a0)
  24432. move.w #$120,x_pixel(a0)
  24433. move.w #$E8,y_pixel(a0)
  24434.  
  24435. loc_1310A:
  24436. addq.b #2,routine_secondary(a0)
  24437.  
  24438. BranchTo11_DisplaySprite
  24439. bra.w DisplaySprite
  24440. ; ===========================================================================
  24441.  
  24442. Obj0E_SkyPiece:
  24443. moveq #0,d0
  24444. move.b routine_secondary(a0),d0
  24445. move.w off_13120(pc,d0.w),d1
  24446. jmp off_13120(pc,d1.w)
  24447. ; ===========================================================================
  24448. off_13120: offsetTable
  24449. offsetTableEntry.w Obj0E_SkyPiece_Init ; 0
  24450. offsetTableEntry.w BranchTo12_DisplaySprite ; 2
  24451. ; ===========================================================================
  24452.  
  24453. Obj0E_SkyPiece_Init:
  24454. addq.b #2,routine_secondary(a0)
  24455. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  24456. move.b #$11,mapping_frame(a0)
  24457. move.b #2,priority(a0)
  24458. move.w #$100,x_pixel(a0)
  24459. move.w #$F0,y_pixel(a0)
  24460.  
  24461. BranchTo12_DisplaySprite
  24462. bra.w DisplaySprite
  24463. ; ===========================================================================
  24464.  
  24465. Obj0E_LargeStar:
  24466. moveq #0,d0
  24467. move.b routine_secondary(a0),d0
  24468. move.w off_13158(pc,d0.w),d1
  24469. jmp off_13158(pc,d1.w)
  24470. ; ===========================================================================
  24471. off_13158: offsetTable
  24472. offsetTableEntry.w Obj0E_LargeStar_Init ; 0
  24473. offsetTableEntry.w loc_12F52 ; 2
  24474. offsetTableEntry.w loc_13190 ; 4
  24475. offsetTableEntry.w loc_1319E ; 6
  24476. ; ===========================================================================
  24477.  
  24478. Obj0E_LargeStar_Init:
  24479. addq.b #2,routine_secondary(a0)
  24480. move.b #$C,mapping_frame(a0)
  24481. ori.w #high_priority,art_tile(a0)
  24482. move.b #2,anim(a0)
  24483. move.b #1,priority(a0)
  24484. move.w #$100,x_pixel(a0)
  24485. move.w #$A8,y_pixel(a0)
  24486. move.w #4,objoff_2A(a0)
  24487. rts
  24488. ; ===========================================================================
  24489.  
  24490. loc_13190:
  24491. subq.w #1,objoff_2A(a0)
  24492. bmi.s +
  24493. rts
  24494. ; ===========================================================================
  24495. +
  24496. addq.b #2,routine_secondary(a0)
  24497. rts
  24498. ; ===========================================================================
  24499.  
  24500. loc_1319E:
  24501. move.b #2,routine_secondary(a0)
  24502. move.b #0,anim_frame(a0)
  24503. move.b #0,anim_frame_duration(a0)
  24504. move.w #6,objoff_2A(a0)
  24505. move.w objoff_2C(a0),d0
  24506. addq.w #4,d0
  24507. cmpi.w #word_131DC_end-word_131DC+4,d0
  24508. bhs.w DeleteObject
  24509. move.w d0,objoff_2C(a0)
  24510. move.l word_131DC-4(pc,d0.w),d0
  24511. move.w d0,y_pixel(a0)
  24512. swap d0
  24513. move.w d0,x_pixel(a0)
  24514. moveq #SndID_Sparkle,d0 ; play intro sparkle sound
  24515. jmpto (PlaySound).l, JmpTo4_PlaySound
  24516. ; ===========================================================================
  24517. ; unknown
  24518. word_131DC:
  24519. dc.w $DA, $F2
  24520. dc.w $170, $F8 ; 2
  24521. dc.w $132,$131 ; 4
  24522. dc.w $19E, $A2 ; 6
  24523. dc.w $C0, $E3 ; 8
  24524. dc.w $180, $E0 ; $A
  24525. dc.w $10D,$13B ; $C
  24526. dc.w $C0, $AB ; $E
  24527. dc.w $165, $107 ; $10
  24528. word_131DC_end
  24529. ; ===========================================================================
  24530.  
  24531. Obj0E_SonicHand:
  24532. moveq #0,d0
  24533. move.b routine_secondary(a0),d0
  24534. move.w off_1320E(pc,d0.w),d1
  24535. jmp off_1320E(pc,d1.w)
  24536. ; ===========================================================================
  24537. off_1320E: offsetTable
  24538. offsetTableEntry.w Obj0E_SonicHand_Init ; 0
  24539. offsetTableEntry.w loc_13234 ; 2
  24540. offsetTableEntry.w BranchTo13_DisplaySprite ; 4
  24541. ; ===========================================================================
  24542.  
  24543. Obj0E_SonicHand_Init:
  24544. addq.b #2,routine_secondary(a0)
  24545. move.b #9,mapping_frame(a0)
  24546. move.b #3,priority(a0)
  24547. move.w #$145,x_pixel(a0)
  24548. move.w #$BF,y_pixel(a0)
  24549.  
  24550. BranchTo13_DisplaySprite
  24551. bra.w DisplaySprite
  24552. ; ===========================================================================
  24553.  
  24554. loc_13234:
  24555. moveq #word_13240_end-word_13240+4,d2
  24556. lea (word_13240).l,a1
  24557. bra.w loc_12F20
  24558. ; ===========================================================================
  24559. word_13240:
  24560. dc.w $143, $C1
  24561. dc.w $140, $C2 ; 2
  24562. dc.w $141, $C1 ; 4
  24563. word_13240_end
  24564. ; ===========================================================================
  24565.  
  24566. Obj0E_TailsHand:
  24567. moveq #0,d0
  24568. move.b routine_secondary(a0),d0
  24569. move.w off_1325A(pc,d0.w),d1
  24570. jmp off_1325A(pc,d1.w)
  24571. ; ===========================================================================
  24572. off_1325A: offsetTable
  24573. offsetTableEntry.w Obj0E_TailsHand_Init ; 0
  24574. offsetTableEntry.w loc_13280 ; 2
  24575. offsetTableEntry.w BranchTo14_DisplaySprite ; 4
  24576. ; ===========================================================================
  24577.  
  24578. Obj0E_TailsHand_Init:
  24579. addq.b #2,routine_secondary(a0)
  24580. move.b #$13,mapping_frame(a0)
  24581. move.b #3,priority(a0)
  24582. move.w #$10F,x_pixel(a0)
  24583. move.w #$D5,y_pixel(a0)
  24584.  
  24585. BranchTo14_DisplaySprite
  24586. bra.w DisplaySprite
  24587. ; ===========================================================================
  24588.  
  24589. loc_13280:
  24590. moveq #word_1328C_end-word_1328C+4,d2
  24591. lea (word_1328C).l,a1
  24592. bra.w loc_12F20
  24593. ; ===========================================================================
  24594. word_1328C:
  24595. dc.w $10C, $D0
  24596. dc.w $10D, $D1 ; 2
  24597. word_1328C_end
  24598. ; ===========================================================================
  24599.  
  24600. Obj0E_SmallStar:
  24601. moveq #0,d0
  24602. move.b routine_secondary(a0),d0
  24603. move.w off_132A2(pc,d0.w),d1
  24604. jmp off_132A2(pc,d1.w)
  24605. ; ===========================================================================
  24606. off_132A2: offsetTable
  24607. offsetTableEntry.w Obj0E_SmallStar_Init ; 0
  24608. offsetTableEntry.w loc_132D2 ; 2
  24609. ; ===========================================================================
  24610.  
  24611. Obj0E_SmallStar_Init:
  24612. addq.b #2,routine_secondary(a0)
  24613. move.b #$C,mapping_frame(a0)
  24614. move.b #5,priority(a0)
  24615. move.w #$170,x_pixel(a0)
  24616. move.w #$80,y_pixel(a0)
  24617. move.b #3,anim(a0)
  24618. move.w #$8C,objoff_2A(a0)
  24619. bra.w DisplaySprite
  24620. ; ===========================================================================
  24621.  
  24622. loc_132D2:
  24623. subq.w #1,objoff_2A(a0)
  24624. bmi.w DeleteObject
  24625. subq.w #2,x_pixel(a0)
  24626. addq.w #1,y_pixel(a0)
  24627. lea (Ani_obj0E).l,a1
  24628. bsr.w AnimateSprite
  24629. bra.w DisplaySprite
  24630. ; ===========================================================================
  24631. ; ----------------------------------------------------------------------------
  24632. ; Object C9 - "Palette changing handler" from title screen
  24633. ; ----------------------------------------------------------------------------
  24634. ttlscrpalchanger_fadein_time_left = objoff_30
  24635. ttlscrpalchanger_fadein_time = objoff_31
  24636. ttlscrpalchanger_fadein_amount = objoff_32
  24637. ttlscrpalchanger_start_offset = objoff_34
  24638. ttlscrpalchanger_length = objoff_36
  24639. ttlscrpalchanger_codeptr = objoff_3A
  24640.  
  24641. ; Sprite_132F0:
  24642. ObjC9:
  24643. moveq #0,d0
  24644. move.b routine(a0),d0
  24645. move.w ObjC9_Index(pc,d0.w),d1
  24646. jmp ObjC9_Index(pc,d1.w)
  24647. ; ===========================================================================
  24648. ObjC9_Index: offsetTable
  24649. offsetTableEntry.w ObjC9_Init ; 0
  24650. offsetTableEntry.w ObjC9_Main ; 2
  24651. ; ===========================================================================
  24652.  
  24653. ObjC9_Init:
  24654. addq.b #2,routine(a0)
  24655. moveq #0,d0
  24656. move.b subtype(a0),d0
  24657. lea (PaletteChangerDataIndex).l,a1
  24658. adda.w (a1,d0.w),a1
  24659. move.l (a1)+,ttlscrpalchanger_codeptr(a0)
  24660. movea.l (a1)+,a2
  24661. move.b (a1)+,d0
  24662. move.w d0,ttlscrpalchanger_start_offset(a0)
  24663. lea (Target_palette).w,a3
  24664. adda.w d0,a3
  24665. move.b (a1)+,d0
  24666. move.w d0,ttlscrpalchanger_length(a0)
  24667.  
  24668. - move.w (a2)+,(a3)+
  24669. dbf d0,-
  24670.  
  24671. move.b (a1)+,d0
  24672. move.b d0,ttlscrpalchanger_fadein_time_left(a0)
  24673. move.b d0,ttlscrpalchanger_fadein_time(a0)
  24674. move.b (a1)+,ttlscrpalchanger_fadein_amount(a0)
  24675. rts
  24676. ; ===========================================================================
  24677.  
  24678. ObjC9_Main:
  24679. subq.b #1,ttlscrpalchanger_fadein_time_left(a0)
  24680. bpl.s +
  24681. move.b ttlscrpalchanger_fadein_time(a0),ttlscrpalchanger_fadein_time_left(a0)
  24682. subq.b #1,ttlscrpalchanger_fadein_amount(a0)
  24683. bmi.w DeleteObject
  24684. movea.l ttlscrpalchanger_codeptr(a0),a2
  24685. movea.l a0,a3
  24686. move.w ttlscrpalchanger_length(a0),d0
  24687. move.w ttlscrpalchanger_start_offset(a0),d1
  24688. lea (Normal_palette).w,a0
  24689. adda.w d1,a0
  24690. lea (Target_palette).w,a1
  24691. adda.w d1,a1
  24692.  
  24693. - jsr (a2) ; dynamic call! to Pal_FadeFromBlack.UpdateColour, loc_1344C, or loc_1348A, assuming the PaletteChangerData pointers haven't been changed
  24694. dbf d0,-
  24695.  
  24696. movea.l a3,a0
  24697. +
  24698. rts
  24699. ; ===========================================================================
  24700. ; off_1337C:
  24701. PaletteChangerDataIndex: offsetTable
  24702. offsetTableEntry.w off_1338C ; 0
  24703. offsetTableEntry.w off_13398 ; 2
  24704. offsetTableEntry.w off_133A4 ; 4
  24705. offsetTableEntry.w off_133B0 ; 6
  24706. offsetTableEntry.w off_133BC ; 8
  24707. offsetTableEntry.w off_133C8 ; $A
  24708. offsetTableEntry.w off_133D4 ; $C
  24709. offsetTableEntry.w off_133E0 ; $E
  24710.  
  24711. C9PalInfo macro codeptr,dataptr,loadtoOffset,length,fadeinTime,fadeinAmount
  24712. dc.l codeptr, dataptr
  24713. dc.b loadtoOffset, length, fadeinTime, fadeinAmount
  24714. endm
  24715.  
  24716. off_1338C: C9PalInfo Pal_FadeFromBlack.UpdateColour, Pal_1342C, $60, $F,2,$15
  24717. off_13398: C9PalInfo loc_1344C, Pal_1340C, $40, $F,4,7
  24718. off_133A4: C9PalInfo loc_1344C, Pal_AD1E, 0, $F,8,7
  24719. off_133B0: C9PalInfo loc_1348A, Pal_AD1E, 0, $F,8,7
  24720. off_133BC: C9PalInfo loc_1344C, Pal_AC7E, 0,$1F,4,7
  24721. off_133C8: C9PalInfo loc_1344C, Pal_ACDE, $40,$1F,4,7
  24722. off_133D4: C9PalInfo loc_1344C, Pal_AD3E, 0, $F,4,7
  24723. off_133E0: C9PalInfo loc_1344C, Pal_AC9E, 0,$1F,4,7
  24724.  
  24725. Pal_133EC: BINCLUDE "art/palettes/Title Sonic.bin"
  24726. Pal_1340C: BINCLUDE "art/palettes/Title Background.bin"
  24727. Pal_1342C: BINCLUDE "art/palettes/Title Emblem.bin"
  24728.  
  24729. ; ===========================================================================
  24730.  
  24731. loc_1344C:
  24732.  
  24733. move.b (a1)+,d2
  24734. andi.b #$E,d2
  24735. move.b (a0),d3
  24736. cmp.b d2,d3
  24737. bls.s loc_1345C
  24738. subq.b #2,d3
  24739. move.b d3,(a0)
  24740.  
  24741. loc_1345C:
  24742. addq.w #1,a0
  24743. move.b (a1)+,d2
  24744. move.b d2,d3
  24745. andi.b #$E0,d2
  24746. andi.b #$E,d3
  24747. move.b (a0),d4
  24748. move.b d4,d5
  24749. andi.b #$E0,d4
  24750. andi.b #$E,d5
  24751. cmp.b d2,d4
  24752. bls.s loc_1347E
  24753. subi.b #$20,d4
  24754.  
  24755. loc_1347E:
  24756. cmp.b d3,d5
  24757. bls.s loc_13484
  24758. subq.b #2,d5
  24759.  
  24760. loc_13484:
  24761. or.b d4,d5
  24762. move.b d5,(a0)+
  24763. rts
  24764. ; ===========================================================================
  24765.  
  24766. loc_1348A:
  24767. moveq #$E,d2
  24768. move.b (a0),d3
  24769. and.b d2,d3
  24770. cmp.b d2,d3
  24771. bhs.s loc_13498
  24772. addq.b #2,d3
  24773. move.b d3,(a0)
  24774.  
  24775. loc_13498:
  24776. addq.w #1,a0
  24777. move.b (a0),d3
  24778. move.b d3,d4
  24779. andi.b #$E0,d3
  24780. andi.b #$E,d4
  24781. cmpi.b #-$20,d3
  24782. bhs.s loc_134B0
  24783. addi.b #$20,d3
  24784.  
  24785. loc_134B0:
  24786. cmp.b d2,d4
  24787. bhs.s loc_134B6
  24788. addq.b #2,d4
  24789.  
  24790. loc_134B6:
  24791. or.b d3,d4
  24792. move.b d4,(a0)+
  24793. rts
  24794.  
  24795. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  24796.  
  24797.  
  24798. TitleScreen_SetFinalState:
  24799. tst.b objoff_2F(a0)
  24800. bne.w + ; rts
  24801. move.b (Ctrl_1_Press).w,d0
  24802. or.b (Ctrl_2_Press).w,d0
  24803. andi.b #button_up_mask|button_down_mask|button_left_mask|button_right_mask|button_B_mask|button_C_mask|button_A_mask,(Ctrl_1_Press).w
  24804. andi.b #button_up_mask|button_down_mask|button_left_mask|button_right_mask|button_B_mask|button_C_mask|button_A_mask,(Ctrl_2_Press).w
  24805. andi.b #button_start_mask,d0
  24806. beq.w + ; rts
  24807. st.b objoff_2F(a0)
  24808. move.b #$10,routine_secondary(a0)
  24809. move.b #$12,mapping_frame(a0)
  24810. move.w #$108,x_pixel(a0)
  24811. move.w #$98,y_pixel(a0)
  24812. lea (IntroSonicHand).w,a1
  24813. bsr.w TitleScreen_InitSprite
  24814. move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB1C0
  24815. move.b #$A,routine(a1) ; Sonic's hand
  24816. move.b #2,priority(a1)
  24817. move.b #9,mapping_frame(a1)
  24818. move.b #4,routine_secondary(a1)
  24819. move.w #$141,x_pixel(a1)
  24820. move.w #$C1,y_pixel(a1)
  24821. lea (IntroTails).w,a1
  24822. bsr.w TitleScreen_InitSprite
  24823. move.b #ObjID_IntroStars,id(a1) ; load obj0E
  24824. move.b #4,routine(a1) ; Tails
  24825. move.b #4,mapping_frame(a1)
  24826. move.b #6,routine_secondary(a1)
  24827. move.b #3,priority(a1)
  24828. move.w #$C8,x_pixel(a1)
  24829. move.w #$A0,y_pixel(a1)
  24830. lea (IntroTailsHand).w,a1
  24831. bsr.w TitleScreen_InitSprite
  24832. move.b #ObjID_IntroStars,id(a1) ; load obj0E
  24833. move.b #$10,routine(a1) ; Tails' hand
  24834. move.b #2,priority(a1)
  24835. move.b #$13,mapping_frame(a1)
  24836. move.b #4,routine_secondary(a1)
  24837. move.w #$10D,x_pixel(a1)
  24838. move.w #$D1,y_pixel(a1)
  24839. lea (IntroEmblemTop).w,a1
  24840. move.b #ObjID_IntroStars,id(a1) ; load obj0E
  24841. move.b #6,subtype(a1) ; logo top
  24842. bsr.w sub_12F08
  24843. move.b #ObjID_TitleMenu,(TitleScreenMenu+id).w ; load Obj0F (title screen menu) at $FFFFB400
  24844. lea (TitleScreenPaletteChanger).w,a1
  24845. bsr.w DeleteObject2
  24846. lea_ Pal_1342C,a1
  24847. lea (Normal_palette_line4).w,a2
  24848.  
  24849. moveq #7,d6
  24850. - move.l (a1)+,(a2)+
  24851. dbf d6,-
  24852.  
  24853. lea_ Pal_1340C,a1
  24854. lea (Normal_palette_line3).w,a2
  24855.  
  24856. moveq #7,d6
  24857. - move.l (a1)+,(a2)+
  24858. dbf d6,-
  24859.  
  24860. lea_ Pal_133EC,a1
  24861. lea (Normal_palette).w,a2
  24862.  
  24863. moveq #7,d6
  24864. - move.l (a1)+,(a2)+
  24865. dbf d6,-
  24866.  
  24867. tst.b objoff_30(a0)
  24868. bne.s + ; rts
  24869. moveq #MusID_Title,d0 ; title music
  24870. jsrto (PlayMusic).l, JmpTo4_PlayMusic
  24871. +
  24872. rts
  24873. ; End of function sub_134BC
  24874.  
  24875.  
  24876. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  24877.  
  24878.  
  24879. ;sub_135EA:
  24880. TitleScreen_InitSprite:
  24881.  
  24882. move.l #Obj0E_MapUnc_136A8,mappings(a1)
  24883. move.w #make_art_tile(ArtTile_ArtNem_TitleSprites,0,0),art_tile(a1)
  24884. move.b #4,priority(a1)
  24885. rts
  24886. ; End of function TitleScreen_InitSprite
  24887.  
  24888. ; ===========================================================================
  24889. ; ----------------------------------------------------------------------------
  24890. ; Object 0F - Title screen menu
  24891. ; ----------------------------------------------------------------------------
  24892. ; Sprite_13600:
  24893. Obj0F:
  24894. moveq #0,d0
  24895. move.b routine(a0),d0
  24896. move.w Obj0F_Index(pc,d0.w),d1
  24897. jsr Obj0F_Index(pc,d1.w)
  24898. bra.w DisplaySprite
  24899. ; ===========================================================================
  24900. ; off_13612: Obj0F_States:
  24901. Obj0F_Index: offsetTable
  24902. offsetTableEntry.w Obj0F_Init ; 0
  24903. offsetTableEntry.w Obj0F_Main ; 2
  24904. ; ===========================================================================
  24905. ; loc_13616:
  24906. Obj0F_Init:
  24907. addq.b #2,routine(a0) ; => Obj0F_Main
  24908. move.w #$128,x_pixel(a0)
  24909. move.w #$14C,y_pixel(a0)
  24910. move.l #Obj0F_MapUnc_13B70,mappings(a0)
  24911. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  24912. bsr.w Adjust2PArtPointer
  24913. andi.b #1,(Title_screen_option).w
  24914. move.b (Title_screen_option).w,mapping_frame(a0)
  24915.  
  24916. ; loc_13644:
  24917. Obj0F_Main:
  24918. moveq #0,d2
  24919. move.b (Title_screen_option).w,d2
  24920. move.b (Ctrl_1_Press).w,d0
  24921. or.b (Ctrl_2_Press).w,d0
  24922. btst #button_up,d0
  24923. beq.s +
  24924. subq.b #1,d2
  24925. bcc.s +
  24926. move.b #2,d2
  24927. +
  24928. btst #button_down,d0
  24929. beq.s +
  24930. addq.b #1,d2
  24931. cmpi.b #3,d2
  24932. blo.s +
  24933. moveq #0,d2
  24934. +
  24935. move.b d2,mapping_frame(a0)
  24936. move.b d2,(Title_screen_option).w
  24937. andi.b #button_up_mask|button_down_mask,d0
  24938. beq.s + ; rts
  24939. moveq #SndID_Blip,d0 ; selection blip sound
  24940. jsrto (PlaySound).l, JmpTo4_PlaySound
  24941. +
  24942. rts
  24943. ; ===========================================================================
  24944. ; animation script
  24945. ; off_13686:
  24946. Ani_obj0E: offsetTable
  24947. offsetTableEntry.w byte_1368E ; 0
  24948. offsetTableEntry.w byte_13694 ; 1
  24949. offsetTableEntry.w byte_1369C ; 2
  24950. offsetTableEntry.w byte_136A4 ; 3
  24951. byte_1368E:
  24952. dc.b 1
  24953. dc.b 5 ; 1
  24954. dc.b 6 ; 2
  24955. dc.b 7 ; 3
  24956. dc.b 8 ; 4
  24957. dc.b $FA ; 5
  24958. even
  24959. byte_13694:
  24960. dc.b 1
  24961. dc.b 0 ; 1
  24962. dc.b 1 ; 2
  24963. dc.b 2 ; 3
  24964. dc.b 3 ; 4
  24965. dc.b 4 ; 5
  24966. dc.b $FA ; 6
  24967. even
  24968. byte_1369C:
  24969. dc.b 1
  24970. dc.b $C ; 1
  24971. dc.b $D ; 2
  24972. dc.b $E ; 3
  24973. dc.b $D ; 4
  24974. dc.b $C ; 5
  24975. dc.b $FA ; 6
  24976. even
  24977. byte_136A4:
  24978. dc.b 3
  24979. dc.b $C ; 1
  24980. dc.b $F ; 2
  24981. dc.b $FF ; 3
  24982. even
  24983. ; -----------------------------------------------------------------------------
  24984. ; Sprite Mappings - Flashing stars from intro (Obj0E)
  24985. ; -----------------------------------------------------------------------------
  24986. Obj0E_MapUnc_136A8: BINCLUDE "mappings/sprite/obj0E.bin"
  24987. ; -----------------------------------------------------------------------------
  24988. ; sprite mappings
  24989. ; -----------------------------------------------------------------------------
  24990. Obj0F_MapUnc_13B70: BINCLUDE "mappings/sprite/obj0F.bin"
  24991.  
  24992. if ~~removeJmpTos
  24993. JmpTo4_PlaySound
  24994. jmp (PlaySound).l
  24995. JmpTo4_PlayMusic
  24996. jmp (PlayMusic).l
  24997.  
  24998. align 4
  24999. endif
  25000.  
  25001.  
  25002.  
  25003.  
  25004. ; ===========================================================================
  25005. ; ----------------------------------------------------------------------------
  25006. ; Object 34 - level title card (screen with red, yellow, and blue)
  25007. ; ----------------------------------------------------------------------------
  25008. titlecard_x_target = objoff_30 ; the X position the object will reach
  25009. titlecard_x_source = objoff_32 ; the X position the object starts from and will end at
  25010. titlecard_location = objoff_34 ; point up to which titlecard is drawn
  25011. titlecard_vram_dest = objoff_36 ; target of VRAM write
  25012. titlecard_vram_dest_2P = objoff_38 ; target of VRAM write
  25013. titlecard_split_point = objoff_3A ; point to split drawing for yellow and red portions
  25014. titlecard_leaveflag = objoff_3E ; whether or not titlecard is leaving screen
  25015. ; Sprite_13C48:
  25016. Obj34: ; (note: screen-space obj)
  25017. moveq #0,d0
  25018. move.b routine(a0),d0
  25019. move.w Obj34_Index(pc,d0.w),d1
  25020. jmp Obj34_Index(pc,d1.w)
  25021. ; ===========================================================================
  25022. Obj34_Index: offsetTable
  25023. offsetTableEntry.w Obj34_Init ; 0 - create all the title card objects
  25024. offsetTableEntry.w Obj34_BackgroundIn ; 2 - the background, coming in
  25025. offsetTableEntry.w Obj34_BottomPartIn ; 4 - the yellow part at the bottom, coming in
  25026. offsetTableEntry.w Obj34_LeftPartIn ; 6 - the red part on the left, coming in
  25027. offsetTableEntry.w Obj34_ZoneName ; 8 - the name of the zone, coming in
  25028. offsetTableEntry.w Obj34_Zone ; $A - the word "ZONE", coming in
  25029. offsetTableEntry.w Obj34_ActNumber ; $C - the act number, coming in
  25030. offsetTableEntry.w Obj34_LeftPartOut ; $E - red part on the left, going out
  25031. offsetTableEntry.w Obj34_BottomPartOut ; $10 - yellow part at the bottom, going out
  25032. offsetTableEntry.w Obj34_BackgroundOutInit ; $12 - the background, going out (first frame)
  25033. offsetTableEntry.w Obj34_BackgroundOut ; $14 - the background, going out
  25034. offsetTableEntry.w Obj34_WaitAndGoAway ; $16 - wait and go away, used by the zone name, "ZONE" and the act number
  25035. ; ===========================================================================
  25036. ; loc_13C6E:
  25037. Obj34_Init:
  25038. lea (a0),a1
  25039. lea Obj34_TitleCardData(pc),a2
  25040.  
  25041. moveq #(Obj34_TitleCardData_End-Obj34_TitleCardData)/$A-1,d1
  25042. - _move.b #ObjID_TitleCard,id(a1) ; load obj34
  25043. move.b (a2)+,routine(a1)
  25044. move.l #Obj34_MapUnc_147BA,mappings(a1)
  25045. move.b (a2)+,mapping_frame(a1)
  25046. move.b (a2)+,width_pixels(a1)
  25047. move.b (a2)+,anim_frame_duration(a1)
  25048. move.w (a2),x_pixel(a1)
  25049. move.w (a2)+,titlecard_x_source(a1)
  25050. move.w (a2)+,titlecard_x_target(a1)
  25051. move.w (a2)+,y_pixel(a1)
  25052. move.b #0,render_flags(a1)
  25053. lea next_object(a1),a1 ; a1=object
  25054. dbf d1,-
  25055.  
  25056. move.w #$26,(TitleCard_Bottom+titlecard_location).w
  25057. clr.w (Vscroll_Factor_FG).w
  25058. move.w #-$E0,(Vscroll_Factor_P2_FG).w
  25059.  
  25060. clearRAM Horiz_Scroll_Buf,Horiz_Scroll_Buf_End
  25061.  
  25062. rts
  25063. ; ===========================================================================
  25064. ; This macro declares data for an object. The data includes:
  25065. ; - the initial routine counter (byte)
  25066. ; - the initial mapping frame (byte)
  25067. ; - the width of the object (byte)
  25068. ; - the number of frames before it appears on screen (byte)
  25069. ; - the X position where it starts and where it will go back (word)
  25070. ; - the X position to reach (word)
  25071. ; - the Y position (word)
  25072. titlecardobjdata macro routine,frame,width,duration,xstart,xstop,y
  25073. dc.b routine,frame,width,duration
  25074. dc.w xstart,xstop,y
  25075. endm
  25076. ; word_13CD4:
  25077. Obj34_TitleCardData:
  25078. titlecardobjdata 8, 0, $80, $1B, $240, $120, $B8 ; zone name
  25079. titlecardobjdata $A, $11, $40, $1C, $28, $148, $D0 ; "ZONE"
  25080. titlecardobjdata $C, $12, $18, $1C, $68, $188, $D0 ; act number
  25081. titlecardobjdata 2, 0, 0, 0, 0, 0, 0 ; blue background
  25082. titlecardobjdata 4, $15, $48, 8, $2A8, $168,$120 ; bottom yellow part
  25083. titlecardobjdata 6, $16, 8, $15, $80, $F0, $F0 ; left red part
  25084. Obj34_TitleCardData_End:
  25085.  
  25086. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  25087.  
  25088. ; sub_13D10:
  25089. Obj34_Wait:
  25090. subq.b #1,anim_frame_duration(a0) ; subtract 1
  25091. bne.s + ; if it's not 0, branch
  25092. move.b #1,anim_frame_duration(a0) ; reset to 1
  25093. rts
  25094. ; ---------------------------------------------------------------------------
  25095. + addq.w #4,sp ; don't run the code after the call to this routine
  25096. rts
  25097. ; End of function Obj34_Wait
  25098.  
  25099. ; ===========================================================================
  25100. ; loc_13D22:
  25101. Obj34_BackgroundIn: ; the blue background (green when playing as Knuckles), coming in
  25102. moveq #$10,d0
  25103. moveq #8,d1
  25104. tst.w (Two_player_mode).w ; if two-player mode is on (1)
  25105. sne d6 ; then set d6 to $FF, else set d6 to $00
  25106. beq.s +
  25107. moveq #$20,d0
  25108. moveq #7,d1
  25109. +
  25110. move.w titlecard_location(a0),d2
  25111. cmp.w d0,d2
  25112. beq.s ++ ; rts
  25113. lsl.w d1,d2
  25114. move.w #VRAM_Plane_A_Name_Table,d0
  25115. add.w d2,d0
  25116. move.w d0,titlecard_vram_dest(a0)
  25117. tst.b d6
  25118. beq.s +
  25119. addi.w #VRAM_Plane_A_Name_Table_2P,d2
  25120. move.w d2,titlecard_vram_dest_2P(a0)
  25121. +
  25122. addq.w #1,titlecard_location(a0)
  25123. +
  25124. rts
  25125. ; ===========================================================================
  25126. ; loc_13D58:
  25127. Obj34_BottomPartIn: ; the yellow part at the bottom, coming in
  25128. jsr Obj34_Wait(pc)
  25129. move.w titlecard_location(a0),d0
  25130. bmi.w Obj34_MoveTowardsTargetPosition
  25131. add.w d0,d0
  25132. move.w #$80*$14/2,d1 ; $14 half-cells down (for 2P mode)
  25133. tst.w (Two_player_mode).w
  25134. sne d6
  25135. bne.s +
  25136. add.w d1,d1 ; double distance down for 1P mode
  25137. +
  25138. move.w #VRAM_Plane_A_Name_Table,d2
  25139. add.w d0,d2
  25140. add.w d1,d2
  25141. move.w d2,titlecard_vram_dest(a0)
  25142. tst.b d6
  25143. beq.s +
  25144. addi.w #VRAM_Plane_A_Name_Table_2P,d1
  25145. add.w d0,d1
  25146. move.w d1,titlecard_vram_dest_2P(a0)
  25147. +
  25148. subq.w #2,titlecard_location(a0)
  25149. move.w titlecard_location(a0),titlecard_split_point(a0)
  25150. cmpi.w #6,titlecard_location(a0) ; if titlecard_location(a0) is 6,
  25151. seq titlecard_location(a0) ; then set it to $FF, else set it to $00
  25152. bra.w Obj34_MoveTowardsTargetPosition
  25153. ; ===========================================================================
  25154. ; loc_13DA6:
  25155. Obj34_LeftPartIn: ; the red part on the left, coming in
  25156. jsr Obj34_Wait(pc)
  25157. tst.w titlecard_location(a0)
  25158. bmi.w Obj34_MoveTowardsTargetPosition
  25159. move.w #VRAM_Plane_A_Name_Table,titlecard_vram_dest(a0)
  25160. tst.w (Two_player_mode).w
  25161. beq.s +
  25162. move.w #VRAM_Plane_A_Name_Table_2P,titlecard_vram_dest_2P(a0)
  25163. +
  25164. addq.w #2,titlecard_location(a0)
  25165. move.w titlecard_location(a0),titlecard_split_point(a0)
  25166. cmpi.w #$E,titlecard_location(a0)
  25167. seq titlecard_location(a0)
  25168. bra.w Obj34_MoveTowardsTargetPosition
  25169. ; ===========================================================================
  25170. ; loc_13DDC:
  25171. Obj34_ZoneName: ; the name of the zone, coming in
  25172. jsr Obj34_Wait(pc)
  25173. move.b (Current_Zone).w,mapping_frame(a0)
  25174. bra.s Obj34_MoveTowardsTargetPosition
  25175. ; ===========================================================================
  25176. ; loc_13DE8:
  25177. Obj34_Zone: ; the word "ZONE", coming in
  25178. jsr Obj34_Wait(pc)
  25179. bra.s Obj34_MoveTowardsTargetPosition
  25180. ; ===========================================================================
  25181. ; loc_13DEE:
  25182. Obj34_ActNumber: ; the act number, coming in
  25183. jsr Obj34_Wait(pc)
  25184. move.b (Current_Zone).w,d0 ; get the current zone
  25185. cmpi.b #sky_chase_zone,d0 ; is it Sky Chase?
  25186. beq.s BranchTo9_DeleteObject ; if yes, branch
  25187. cmpi.b #wing_fortress_zone,d0 ; is it Wing Fortress?
  25188. beq.s BranchTo9_DeleteObject ; if yes, branch
  25189. cmpi.b #death_egg_zone,d0 ; is it Death Egg Zone?
  25190. beq.s BranchTo9_DeleteObject ; if yes, branch
  25191. move.b (Current_Act).w,d1 ; get the current act
  25192. addi.b #$12,d1 ; add $12 to it (this is the index of the "1" frame in the mappings)
  25193. cmpi.b #metropolis_zone_2,d0 ; are we in Metropolis Zone Act 3?
  25194. bne.s + ; if not, branch
  25195. moveq #$14,d1 ; use the "3" frame instead
  25196. +
  25197. move.b d1,mapping_frame(a0) ; set the mapping frame
  25198.  
  25199. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  25200.  
  25201. ; sub_13E1C:
  25202. Obj34_MoveTowardsTargetPosition:
  25203. moveq #$10,d0 ; set speed
  25204. move.w x_pixel(a0),d1 ; get the X position
  25205. cmp.w titlecard_x_target(a0),d1 ; compare with target position
  25206. beq.s ++ ; if it reached its target position, branch
  25207. bhi.s + ; if it's beyond the target position, branch
  25208. neg.w d0 ; negate the speed
  25209. +
  25210. sub.w d0,x_pixel(a0) ; move the object
  25211. cmpi.w #$200,x_pixel(a0) ; is it beyond $200?
  25212. bhi.s ++ ; if yes, return
  25213. +
  25214. bra.w DisplaySprite
  25215. ; ---------------------------------------------------------------------------
  25216. + rts
  25217. ; End of function Obj34_MoveTowardsTargetPosition
  25218.  
  25219. ; ===========================================================================
  25220.  
  25221. BranchTo9_DeleteObject
  25222. bra.w DeleteObject
  25223. ; ===========================================================================
  25224. ; loc_13E42:
  25225. Obj34_LeftPartOut: ; red part on the left, going out
  25226. move.w titlecard_location(a0),d0
  25227. bpl.s +
  25228. move.b #$10,TitleCard_Bottom-TitleCard_Left+routine(a0)
  25229. clr.w TitleCard_Bottom-TitleCard_Left+titlecard_location(a0)
  25230. bra.s BranchTo9_DeleteObject
  25231. ; ===========================================================================
  25232. +
  25233. add.w d0,d0
  25234. move.w #VRAM_Plane_A_Name_Table,titlecard_vram_dest(a0)
  25235. add.w d0,titlecard_vram_dest(a0)
  25236. tst.w (Two_player_mode).w
  25237. beq.s +
  25238. move.w #VRAM_Plane_A_Name_Table_2P,titlecard_vram_dest_2P(a0)
  25239. add.w d0,titlecard_vram_dest_2P(a0)
  25240. +
  25241. subq.w #4,titlecard_location(a0)
  25242. cmpi.w #-2,titlecard_location(a0)
  25243. bne.s +
  25244. clr.w titlecard_location(a0)
  25245. +
  25246. bra.w loc_13EC4
  25247. ; ===========================================================================
  25248. ; loc_13E84:
  25249. Obj34_BottomPartOut: ; yellow part at the bottom, going out
  25250. move.w titlecard_location(a0),d0
  25251. cmpi.w #$28,d0
  25252. bne.s +
  25253. move.b #$12,TitleCard_Background-TitleCard_Bottom+routine(a0)
  25254. bra.s BranchTo9_DeleteObject
  25255. ; ---------------------------------------------------------------------------
  25256. +
  25257. add.w d0,d0
  25258. move.w #$80*$14/2,d1 ; $14 half-cells down (for 2P mode)
  25259. tst.w (Two_player_mode).w
  25260. sne d6
  25261. bne.s +
  25262. add.w d1,d1 ; double distance down for 1P mode
  25263. +
  25264. move.w #VRAM_Plane_A_Name_Table,d2
  25265. add.w d0,d2
  25266. add.w d1,d2
  25267. move.w d2,titlecard_vram_dest(a0)
  25268. tst.b d6
  25269. beq.s +
  25270. addi.w #VRAM_Plane_A_Name_Table_2P,d1
  25271. add.w d0,d1
  25272. move.w d1,titlecard_vram_dest_2P(a0)
  25273. +
  25274. addq.w #4,titlecard_location(a0)
  25275.  
  25276. loc_13EC4:
  25277. moveq #$20,d0
  25278. move.w x_pixel(a0),d1
  25279. cmp.w titlecard_x_source(a0),d1
  25280. beq.s ++ ; rts
  25281. bhi.s +
  25282. neg.w d0
  25283. +
  25284. sub.w d0,x_pixel(a0)
  25285. cmpi.w #$200,x_pixel(a0)
  25286. bhi.s + ; rts
  25287. bra.w DisplaySprite
  25288. ; ---------------------------------------------------------------------------
  25289. + rts
  25290. ; ===========================================================================
  25291. ; loc_13EE6:
  25292. Obj34_BackgroundOutInit: ; the background, going out
  25293. move.l a0,-(sp)
  25294. move.l d7,-(sp)
  25295. bsr.w DeformBgLayer
  25296. move.l (sp)+,d7
  25297. movea.l (sp)+,a0 ; load 0bj address
  25298. addi_.b #2,routine(a0)
  25299. move.w #$F0,titlecard_location(a0)
  25300. ; loc_13EFE:
  25301. Obj34_BackgroundOut:
  25302. move.w titlecard_location(a0),d0
  25303. subi.w #$20,d0
  25304. cmpi.w #-$30,d0
  25305. beq.w BranchTo9_DeleteObject
  25306. move.w d0,titlecard_location(a0)
  25307. move.w d0,titlecard_vram_dest(a0)
  25308. rts
  25309. ; ===========================================================================
  25310. ; loc_13F18:
  25311. Obj34_WaitAndGoAway:
  25312. tst.w anim_frame_duration(a0)
  25313. beq.s +
  25314. subq.w #1,anim_frame_duration(a0)
  25315. bra.s +++ ; DisplaySprite
  25316. ; ---------------------------------------------------------------------------
  25317. +
  25318. moveq #$20,d0
  25319. move.w x_pixel(a0),d1
  25320. cmp.w titlecard_x_source(a0),d1
  25321. beq.s Obj34_LoadStandardWaterAndAnimalArt
  25322. bhi.s +
  25323. neg.w d0
  25324. +
  25325. sub.w d0,x_pixel(a0)
  25326. cmpi.w #$200,x_pixel(a0)
  25327. bhi.s Obj34_LoadStandardWaterAndAnimalArt
  25328. +
  25329. bra.w DisplaySprite
  25330. ; ===========================================================================
  25331. ; loc_13F44:
  25332. Obj34_LoadStandardWaterAndAnimalArt:
  25333. cmpa.w #TitleCard_ZoneName,a0 ; is this the zone name object?
  25334. bne.s + ; if not, just delete the title card
  25335. moveq #PLCID_StdWtr,d0 ; load the standard water graphics
  25336. jsrto (LoadPLC).l, JmpTo3_LoadPLC
  25337. moveq #0,d0
  25338. move.b (Current_Zone).w,d0
  25339. move.b Animal_PLCTable(pc,d0.w),d0 ; load the animal graphics for the current zone
  25340. jsrto (LoadPLC).l, JmpTo3_LoadPLC
  25341. +
  25342. bra.w DeleteObject ; delete the title card object
  25343. ; ===========================================================================
  25344. ;byte_13F62:
  25345. Animal_PLCTable: zoneOrderedTable 1,1
  25346. zoneTableEntry.b PLCID_EhzAnimals ; $0
  25347. zoneTableEntry.b PLCID_EhzAnimals ; $1
  25348. zoneTableEntry.b PLCID_EhzAnimals ; $2
  25349. zoneTableEntry.b PLCID_EhzAnimals ; $3
  25350. zoneTableEntry.b PLCID_MtzAnimals ; $4
  25351. zoneTableEntry.b PLCID_MtzAnimals ; $5
  25352. zoneTableEntry.b PLCID_WfzAnimals ; $6
  25353. zoneTableEntry.b PLCID_HtzAnimals ; $7
  25354. zoneTableEntry.b PLCID_HpzAnimals ; $8
  25355. zoneTableEntry.b PLCID_HpzAnimals ; $9
  25356. zoneTableEntry.b PLCID_OozAnimals ; $A
  25357. zoneTableEntry.b PLCID_MczAnimals ; $B
  25358. zoneTableEntry.b PLCID_CnzAnimals ; $C
  25359. zoneTableEntry.b PLCID_CpzAnimals ; $D
  25360. zoneTableEntry.b PLCID_DezAnimals ; $E
  25361. zoneTableEntry.b PLCID_ArzAnimals ; $F
  25362. zoneTableEntry.b PLCID_SczAnimals ; $10
  25363. zoneTableEnd
  25364.  
  25365. dc.b PLCID_SczAnimals ; level slot $11 (non-existent), not part of main table
  25366. even
  25367.  
  25368. ; ===========================================================================
  25369. ; ----------------------------------------------------------------------------
  25370. ; Object 39 - Game/Time Over text
  25371. ; ----------------------------------------------------------------------------
  25372. ; Sprite_13F74:
  25373. Obj39: ; (screen-space obj)
  25374. moveq #0,d0
  25375. move.b routine(a0),d0
  25376. move.w Obj39_Index(pc,d0.w),d1
  25377. jmp Obj39_Index(pc,d1.w)
  25378. ; ===========================================================================
  25379. Obj39_Index: offsetTable
  25380. offsetTableEntry.w Obj39_Init ; 0
  25381. offsetTableEntry.w Obj39_SlideIn ; 2
  25382. offsetTableEntry.w Obj39_Wait ; 4
  25383. ; ===========================================================================
  25384. ; loc_13F88:
  25385. Obj39_Init:
  25386. tst.l (Plc_Buffer).w
  25387. beq.s +
  25388. rts ; wait until the art is loaded
  25389. ; ---------------------------------------------------------------------------
  25390. +
  25391. addq.b #2,routine(a0)
  25392. move.w #$50,x_pixel(a0)
  25393. btst #0,mapping_frame(a0)
  25394. beq.s +
  25395. move.w #$1F0,x_pixel(a0)
  25396. +
  25397. move.w #$F0,y_pixel(a0)
  25398. move.l #Obj39_MapUnc_14C6C,mappings(a0)
  25399. move.w #make_art_tile(ArtTile_ArtNem_Game_Over,0,1),art_tile(a0)
  25400. bsr.w Adjust2PArtPointer
  25401. move.b #0,render_flags(a0)
  25402. move.b #0,priority(a0)
  25403. ; loc_13FCC:
  25404. Obj39_SlideIn:
  25405. moveq #$10,d1
  25406. cmpi.w #$120,x_pixel(a0)
  25407. beq.s Obj39_SetTimer
  25408. blo.s +
  25409. neg.w d1
  25410. +
  25411. add.w d1,x_pixel(a0)
  25412. bra.w DisplaySprite
  25413. ; ===========================================================================
  25414. ; loc_13FE2:
  25415. Obj39_SetTimer:
  25416. move.w #$2D0,anim_frame_duration(a0)
  25417. addq.b #2,routine(a0)
  25418. rts
  25419. ; ===========================================================================
  25420. ; loc_13FEE:
  25421. Obj39_Wait:
  25422. btst #0,mapping_frame(a0)
  25423. bne.w Obj39_Display
  25424. move.b (Ctrl_1_Press).w,d0
  25425. or.b (Ctrl_2_Press).w,d0
  25426. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  25427. bne.s Obj39_Dismiss
  25428. tst.w anim_frame_duration(a0)
  25429. beq.s Obj39_Dismiss
  25430. subq.w #1,anim_frame_duration(a0)
  25431. bra.w DisplaySprite
  25432. ; ===========================================================================
  25433. ; loc_14014:
  25434. Obj39_Dismiss:
  25435. tst.b (Time_Over_flag).w
  25436. bne.s Obj39_TimeOver
  25437. tst.b (Time_Over_flag_2P).w
  25438. bne.s Obj39_TimeOver
  25439. move.b #GameModeID_ContinueScreen,(Game_Mode).w ; => ContinueScreen
  25440. tst.b (Continue_count).w
  25441. bne.s Obj39_Check2PMode
  25442. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  25443. bra.s Obj39_Check2PMode
  25444. ; ===========================================================================
  25445. ; loc_14034:
  25446. Obj39_TimeOver:
  25447. clr.l (Saved_Timer).w
  25448. move.w #1,(Level_Inactive_flag).w
  25449. ; loc_1403E:
  25450. Obj39_Check2PMode:
  25451. tst.w (Two_player_mode).w
  25452. beq.s Obj39_Display
  25453.  
  25454. move.w #0,(Level_Inactive_flag).w
  25455. move.b #GameModeID_2PResults,(Game_Mode).w ; => TwoPlayerResults
  25456. move.w #VsRSID_Act,(Results_Screen_2P).w
  25457. tst.b (Time_Over_flag).w
  25458. bne.s Obj39_Display
  25459. tst.b (Time_Over_flag_2P).w
  25460. bne.s Obj39_Display
  25461. move.w #1,(Game_Over_2P).w
  25462. move.w #VsRSID_Zone,(Results_Screen_2P).w
  25463. jsrto (sub_8476).l, JmpTo_sub_8476
  25464. move.w #-1,(a4)
  25465. tst.b parent+1(a0)
  25466. beq.s +
  25467. addq.w #1,a4
  25468. +
  25469. move.b #-2,(a4)
  25470. ; BranchTo17_DisplaySprite
  25471. Obj39_Display:
  25472. bra.w DisplaySprite
  25473. ; ===========================================================================
  25474. ; ----------------------------------------------------------------------------
  25475. ; Object 3A - End of level results screen
  25476. ; ----------------------------------------------------------------------------
  25477. ; Sprite_14086:
  25478. Obj3A: ; (screen-space obj)
  25479. moveq #0,d0
  25480. move.b routine(a0),d0
  25481. move.w Obj3A_Index(pc,d0.w),d1
  25482. jmp Obj3A_Index(pc,d1.w)
  25483. ; ===========================================================================
  25484. ; off_14094:
  25485. Obj3A_Index: offsetTable
  25486. offsetTableEntry.w loc_140AC ; 0
  25487. offsetTableEntry.w loc_14102 ; 2
  25488. offsetTableEntry.w BranchTo_Obj34_MoveTowardsTargetPosition ; 4
  25489. offsetTableEntry.w loc_14146 ; 6
  25490. offsetTableEntry.w loc_14168 ; 8
  25491. offsetTableEntry.w loc_1419C ; $A
  25492. offsetTableEntry.w loc_141AA ; $C
  25493. offsetTableEntry.w loc_1419C ; $E
  25494. offsetTableEntry.w loc_14270 ; $10
  25495. offsetTableEntry.w loc_142B0 ; $12
  25496. offsetTableEntry.w loc_142CC ; $14
  25497. offsetTableEntry.w loc_1413A ; $16
  25498. ; ===========================================================================
  25499.  
  25500. loc_140AC:
  25501. tst.l (Plc_Buffer).w
  25502. beq.s +
  25503. rts
  25504. ; ---------------------------------------------------------------------------
  25505. +
  25506. movea.l a0,a1
  25507. lea byte_14380(pc),a2
  25508. moveq #7,d1
  25509.  
  25510. loc_140BC:
  25511. _move.b id(a1),d0
  25512. beq.s loc_140CE
  25513. cmpi.b #ObjID_Results,d0
  25514. beq.s loc_140CE
  25515. lea next_object(a1),a1 ; a1=object
  25516. bra.s loc_140BC
  25517. ; ===========================================================================
  25518.  
  25519. loc_140CE:
  25520.  
  25521. _move.b #ObjID_Results,id(a1) ; load obj3A
  25522. move.w (a2)+,x_pixel(a1)
  25523. move.w (a2)+,objoff_30(a1)
  25524. move.w (a2)+,y_pixel(a1)
  25525. move.b (a2)+,routine(a1)
  25526. move.b (a2)+,mapping_frame(a1)
  25527. move.l #Obj3A_MapUnc_14CBC,mappings(a1)
  25528. bsr.w Adjust2PArtPointer2
  25529. move.b #0,render_flags(a1)
  25530. lea next_object(a1),a1 ; a1=object
  25531. dbf d1,loc_140BC
  25532.  
  25533. loc_14102:
  25534. moveq #0,d0
  25535. cmpi.w #2,(Player_mode).w
  25536. bne.s loc_14118
  25537. addq.w #1,d0
  25538. btst #7,(Graphics_Flags).w
  25539. beq.s loc_14118
  25540. addq.w #1,d0
  25541.  
  25542. loc_14118:
  25543.  
  25544. move.b d0,mapping_frame(a0)
  25545. bsr.w Obj34_MoveTowardsTargetPosition
  25546. move.w x_pixel(a0),d0
  25547. cmp.w objoff_30(a0),d0
  25548. bne.w return_14138
  25549. move.b #$A,routine(a0)
  25550. move.w #$B4,anim_frame_duration(a0)
  25551.  
  25552. return_14138:
  25553. rts
  25554. ; ===========================================================================
  25555.  
  25556. loc_1413A:
  25557. tst.w (Perfect_rings_left).w
  25558. bne.w DeleteObject
  25559.  
  25560. BranchTo_Obj34_MoveTowardsTargetPosition
  25561. bra.w Obj34_MoveTowardsTargetPosition
  25562. ; ===========================================================================
  25563.  
  25564. loc_14146:
  25565. move.b (Current_Zone).w,d0
  25566. cmpi.b #sky_chase_zone,d0
  25567. beq.s loc_1415E
  25568. cmpi.b #wing_fortress_zone,d0
  25569. beq.s loc_1415E
  25570. cmpi.b #death_egg_zone,d0
  25571. bne.w Obj34_MoveTowardsTargetPosition
  25572.  
  25573. loc_1415E:
  25574.  
  25575. move.b #5,mapping_frame(a0)
  25576. bra.w Obj34_MoveTowardsTargetPosition
  25577. ; ===========================================================================
  25578.  
  25579. loc_14168:
  25580. move.b (Current_Zone).w,d0
  25581. cmpi.b #sky_chase_zone,d0
  25582. beq.w BranchTo9_DeleteObject
  25583. cmpi.b #wing_fortress_zone,d0
  25584. beq.w BranchTo9_DeleteObject
  25585. cmpi.b #death_egg_zone,d0
  25586. beq.w BranchTo9_DeleteObject
  25587. cmpi.b #metropolis_zone_2,d0
  25588. bne.s loc_1418E
  25589. moveq #8,d0
  25590. bra.s loc_14194
  25591. ; ===========================================================================
  25592.  
  25593. loc_1418E:
  25594. move.b (Current_Act).w,d0
  25595. addq.b #6,d0
  25596.  
  25597. loc_14194:
  25598. move.b d0,mapping_frame(a0)
  25599. bra.w Obj34_MoveTowardsTargetPosition
  25600. ; ===========================================================================
  25601.  
  25602. loc_1419C:
  25603. subq.w #1,anim_frame_duration(a0)
  25604. bne.s BranchTo18_DisplaySprite
  25605. addq.b #2,routine(a0)
  25606.  
  25607. BranchTo18_DisplaySprite
  25608. bra.w DisplaySprite
  25609. ; ===========================================================================
  25610.  
  25611. loc_141AA:
  25612. bsr.w DisplaySprite
  25613. move.b #1,(Update_Bonus_score).w
  25614. moveq #0,d0
  25615. tst.w (Bonus_Countdown_1).w
  25616. beq.s loc_141C6
  25617. addi.w #10,d0
  25618. subi.w #10,(Bonus_Countdown_1).w
  25619.  
  25620. loc_141C6:
  25621. tst.w (Bonus_Countdown_2).w
  25622. beq.s loc_141D6
  25623. addi.w #10,d0
  25624. subi.w #10,(Bonus_Countdown_2).w
  25625.  
  25626. loc_141D6:
  25627. tst.w (Bonus_Countdown_3).w
  25628. beq.s loc_141E6
  25629. addi.w #10,d0
  25630. subi.w #10,(Bonus_Countdown_3).w
  25631.  
  25632. loc_141E6:
  25633. add.w d0,(Total_Bonus_Countdown).w
  25634. tst.w d0
  25635. bne.s loc_14256
  25636. move.w #SndID_TallyEnd,d0
  25637. jsr (PlaySound).l
  25638. addq.b #2,routine(a0)
  25639. move.w #$B4,anim_frame_duration(a0)
  25640. cmpi.w #1000,(Total_Bonus_Countdown).w
  25641. blo.s return_14254
  25642. move.w #$12C,anim_frame_duration(a0)
  25643. lea next_object(a0),a1 ; a1=object
  25644.  
  25645. loc_14214:
  25646. _tst.b id(a1)
  25647. beq.s loc_14220
  25648. lea next_object(a1),a1 ; a1=object
  25649. bra.s loc_14214
  25650. ; ===========================================================================
  25651.  
  25652. loc_14220:
  25653. _move.b #ObjID_Results,id(a1) ; load obj3A (uses screen-space)
  25654. move.b #$12,routine(a1)
  25655. move.w #$188,x_pixel(a1)
  25656. move.w #$118,y_pixel(a1)
  25657. move.l #Obj3A_MapUnc_14CBC,mappings(a1)
  25658. bsr.w Adjust2PArtPointer2
  25659. move.b #0,render_flags(a1)
  25660. move.w #$3C,anim_frame_duration(a1)
  25661. addq.b #1,(Continue_count).w
  25662.  
  25663. return_14254:
  25664.  
  25665. rts
  25666. ; ===========================================================================
  25667.  
  25668. loc_14256:
  25669. jsr (AddPoints).l
  25670. move.b (Vint_runcount+3).w,d0
  25671. andi.b #3,d0
  25672. bne.s return_14254
  25673. move.w #SndID_Blip,d0
  25674. jmp (PlaySound).l
  25675. ; ===========================================================================
  25676.  
  25677. loc_14270:
  25678. moveq #0,d0
  25679. move.b (Current_Zone).w,d0
  25680. add.w d0,d0
  25681. add.b (Current_Act).w,d0
  25682. add.w d0,d0
  25683. lea LevelOrder(pc),a1
  25684. tst.w (Two_player_mode).w
  25685. beq.s loc_1428C
  25686. lea LevelOrder_2P(pc),a1
  25687.  
  25688. loc_1428C:
  25689. move.w (a1,d0.w),d0
  25690. tst.w d0
  25691. bpl.s loc_1429C
  25692. move.b #GameModeID_SegaScreen,(Game_Mode).w ; => SegaScreen
  25693. rts
  25694. ; ===========================================================================
  25695.  
  25696. loc_1429C:
  25697. move.w d0,(Current_ZoneAndAct).w
  25698. clr.b (Last_star_pole_hit).w
  25699. clr.b (Last_star_pole_hit_2P).w
  25700. move.w #1,(Level_Inactive_flag).w
  25701. rts
  25702. ; ===========================================================================
  25703.  
  25704. loc_142B0:
  25705. tst.w anim_frame_duration(a0)
  25706. beq.s loc_142BC
  25707. subq.w #1,anim_frame_duration(a0)
  25708. rts
  25709. ; ===========================================================================
  25710.  
  25711. loc_142BC:
  25712. addi_.b #2,routine(a0)
  25713. move.w #SndID_ContinueJingle,d0
  25714. jsr (PlaySound).l
  25715.  
  25716. loc_142CC:
  25717. subq.w #1,anim_frame_duration(a0)
  25718. bpl.s loc_142E2
  25719. move.w #$13,anim_frame_duration(a0)
  25720. addq.b #1,anim_frame(a0)
  25721. andi.b #1,anim_frame(a0)
  25722.  
  25723. loc_142E2:
  25724. moveq #$C,d0
  25725. add.b anim_frame(a0),d0
  25726. move.b d0,mapping_frame(a0)
  25727. btst #4,(Timer_frames+1).w
  25728. bne.w DisplaySprite
  25729. rts
  25730. ; ===========================================================================
  25731. ; -------------------------------------------------------------------------------
  25732. ; Main game level order
  25733.  
  25734. ; One value per act. That value is the level/act number of the level to load when
  25735. ; that act finishes.
  25736. ; -------------------------------------------------------------------------------
  25737. ;word_142F8:
  25738. LevelOrder: zoneOrderedTable 2,2 ; WrdArr_LevelOrder
  25739. zoneTableEntry.w emerald_hill_zone_act_2
  25740. zoneTableEntry.w chemical_plant_zone_act_1 ; 1
  25741. zoneTableEntry.w emerald_hill_zone_act_1 ; 2
  25742. zoneTableEntry.w emerald_hill_zone_act_1 ; 3
  25743. zoneTableEntry.w wood_zone_act_2 ; 4
  25744. zoneTableEntry.w metropolis_zone_act_1 ; 5
  25745. zoneTableEntry.w emerald_hill_zone_act_1 ; 6
  25746. zoneTableEntry.w emerald_hill_zone_act_1 ; 7
  25747. zoneTableEntry.w metropolis_zone_act_2 ; 8
  25748. zoneTableEntry.w metropolis_zone_act_3 ; 9
  25749. zoneTableEntry.w sky_chase_zone_act_1 ; 10
  25750. zoneTableEntry.w emerald_hill_zone_act_1 ; 11
  25751. zoneTableEntry.w death_egg_zone_act_1 ; 12
  25752. zoneTableEntry.w emerald_hill_zone_act_1 ; 13
  25753. zoneTableEntry.w hill_top_zone_act_2 ; 14
  25754. zoneTableEntry.w mystic_cave_zone_act_1 ; 15
  25755. zoneTableEntry.w hidden_palace_zone_act_2 ; 16
  25756. zoneTableEntry.w oil_ocean_zone_act_1 ; 17
  25757. zoneTableEntry.w emerald_hill_zone_act_1 ; 18
  25758. zoneTableEntry.w emerald_hill_zone_act_1 ; 19
  25759. zoneTableEntry.w oil_ocean_zone_act_2 ; 20
  25760. zoneTableEntry.w metropolis_zone_act_1 ; 21
  25761. zoneTableEntry.w mystic_cave_zone_act_2 ; 22
  25762. zoneTableEntry.w oil_ocean_zone_act_1 ; 23
  25763. zoneTableEntry.w casino_night_zone_act_2 ; 24
  25764. zoneTableEntry.w hill_top_zone_act_1 ; 25
  25765. zoneTableEntry.w chemical_plant_zone_act_2 ; 26
  25766. zoneTableEntry.w aquatic_ruin_zone_act_1 ; 27
  25767. zoneTableEntry.w $FFFF ; 28
  25768. zoneTableEntry.w emerald_hill_zone_act_1 ; 29
  25769. zoneTableEntry.w aquatic_ruin_zone_act_2 ; 30
  25770. zoneTableEntry.w casino_night_zone_act_1 ; 31
  25771. zoneTableEntry.w wing_fortress_zone_act_1 ; 32
  25772. zoneTableEntry.w emerald_hill_zone_act_1 ; 33
  25773. zoneTableEnd
  25774.  
  25775. ;word_1433C:
  25776. LevelOrder_2P: zoneOrderedTable 2,2 ; WrdArr_LevelOrder_2P
  25777. zoneTableEntry.w emerald_hill_zone_act_2
  25778. zoneTableEntry.w casino_night_zone_act_1 ; 1
  25779. zoneTableEntry.w emerald_hill_zone_act_1 ; 2
  25780. zoneTableEntry.w emerald_hill_zone_act_1 ; 3
  25781. zoneTableEntry.w wood_zone_act_2 ; 4
  25782. zoneTableEntry.w metropolis_zone_act_1 ; 5
  25783. zoneTableEntry.w emerald_hill_zone_act_1 ; 6
  25784. zoneTableEntry.w emerald_hill_zone_act_1 ; 7
  25785. zoneTableEntry.w metropolis_zone_act_2 ; 8
  25786. zoneTableEntry.w metropolis_zone_act_3 ; 9
  25787. zoneTableEntry.w sky_chase_zone_act_1 ; 10
  25788. zoneTableEntry.w emerald_hill_zone_act_1 ; 11
  25789. zoneTableEntry.w death_egg_zone_act_1 ; 12
  25790. zoneTableEntry.w emerald_hill_zone_act_1 ; 13
  25791. zoneTableEntry.w hill_top_zone_act_2 ; 14
  25792. zoneTableEntry.w mystic_cave_zone_act_1 ; 15
  25793. zoneTableEntry.w hidden_palace_zone_act_2 ; 16
  25794. zoneTableEntry.w oil_ocean_zone_act_1 ; 17
  25795. zoneTableEntry.w emerald_hill_zone_act_1 ; 18
  25796. zoneTableEntry.w emerald_hill_zone_act_1 ; 19
  25797. zoneTableEntry.w oil_ocean_zone_act_2 ; 20
  25798. zoneTableEntry.w metropolis_zone_act_1 ; 21
  25799. zoneTableEntry.w mystic_cave_zone_act_2 ; 22
  25800. zoneTableEntry.w $FFFF ; 23
  25801. zoneTableEntry.w casino_night_zone_act_2 ; 24
  25802. zoneTableEntry.w mystic_cave_zone_act_1 ; 25
  25803. zoneTableEntry.w chemical_plant_zone_act_2 ; 26
  25804. zoneTableEntry.w aquatic_ruin_zone_act_1 ; 27
  25805. zoneTableEntry.w $FFFF ; 28
  25806. zoneTableEntry.w emerald_hill_zone_act_1 ; 29
  25807. zoneTableEntry.w aquatic_ruin_zone_act_2 ; 30
  25808. zoneTableEntry.w casino_night_zone_act_1 ; 31
  25809. zoneTableEntry.w wing_fortress_zone_act_1 ; 32
  25810. zoneTableEntry.w emerald_hill_zone_act_1 ; 33
  25811. zoneTableEnd
  25812.  
  25813. byte_14380:
  25814. results_screen_object macro startx, targetx, y, routine, frame
  25815. dc.w startx, targetx, y
  25816. dc.b routine, frame
  25817. endm
  25818. results_screen_object $20, $120, $B8, 2, 0
  25819. results_screen_object $200, $100, $CA, 4, 3
  25820. results_screen_object $240, $140, $CA, 6, 4
  25821. results_screen_object $278, $178, $BE, 8, 6
  25822. results_screen_object $350, $120, $120, 4, 9
  25823. results_screen_object $320, $120, $F0, 4, $A
  25824. results_screen_object $330, $120, $100, 4, $B
  25825. results_screen_object $340, $120, $110, $16, $E
  25826. ; ===========================================================================
  25827. ; ----------------------------------------------------------------------------
  25828. ; Object 6F - End of special stage results screen
  25829. ; ----------------------------------------------------------------------------
  25830. ; Sprite_143C0:
  25831. Obj6F: ; (note: screen-space obj)
  25832. moveq #0,d0
  25833. moveq #0,d6
  25834. move.b routine(a0),d0
  25835. move.w Obj6F_Index(pc,d0.w),d1
  25836. jmp Obj6F_Index(pc,d1.w)
  25837. ; ===========================================================================
  25838. ; off_143D0:
  25839. Obj6F_Index: offsetTable
  25840. offsetTableEntry.w Obj6F_Init ; 0
  25841. offsetTableEntry.w Obj6F_InitEmeraldText ; 2
  25842. offsetTableEntry.w Obj6F_InitResultTitle ; 4
  25843. offsetTableEntry.w Obj6F_Emerald0 ; 6
  25844. offsetTableEntry.w Obj6F_Emerald1 ; 8
  25845. offsetTableEntry.w Obj6F_Emerald2 ; $A
  25846. offsetTableEntry.w Obj6F_Emerald3 ; $C
  25847. offsetTableEntry.w Obj6F_Emerald4 ; $E
  25848. offsetTableEntry.w Obj6F_Emerald5 ; $10
  25849. offsetTableEntry.w Obj6F_Emerald6 ; $12
  25850. offsetTableEntry.w BranchTo3_Obj34_MoveTowardsTargetPosition ; $14
  25851. offsetTableEntry.w Obj6F_P1Rings ; $16
  25852. offsetTableEntry.w Obj6F_P2Rings ; $18
  25853. offsetTableEntry.w Obj6F_DeleteIfNotEmerald ; $1A
  25854. offsetTableEntry.w Obj6F_TimedDisplay ; $1C
  25855. offsetTableEntry.w Obj6F_TallyScore ; $1E
  25856. offsetTableEntry.w Obj6F_TimedDisplay ; $20
  25857. offsetTableEntry.w Obj6F_DisplayOnly ; $22
  25858. offsetTableEntry.w Obj6F_TimedDisplay ; $24
  25859. offsetTableEntry.w Obj6F_TimedDisplay ; $26
  25860. offsetTableEntry.w Obj6F_TallyPerfect ; $28
  25861. offsetTableEntry.w Obj6F_PerfectBonus ; $2A
  25862. offsetTableEntry.w Obj6F_TimedDisplay ; $2C
  25863. offsetTableEntry.w Obj6F_DisplayOnly ; $2E
  25864. offsetTableEntry.w Obj6F_InitAndMoveSuperMsg ; $30
  25865. offsetTableEntry.w Obj6F_MoveToTargetPos ; $32
  25866. offsetTableEntry.w Obj6F_MoveAndDisplay ; $34
  25867. ; ===========================================================================
  25868. ;loc_14406
  25869. Obj6F_Init:
  25870. tst.l (Plc_Buffer).w
  25871. beq.s +
  25872. rts
  25873. ; ===========================================================================
  25874. +
  25875. movea.l a0,a1
  25876. lea byte_14752(pc),a2
  25877. moveq #$C,d1
  25878.  
  25879. - _move.b id(a0),id(a1) ; load obj6F
  25880. move.w (a2),x_pixel(a1)
  25881. move.w (a2)+,objoff_32(a1)
  25882. move.w (a2)+,objoff_30(a1)
  25883. move.w (a2)+,y_pixel(a1)
  25884. move.b (a2)+,routine(a1)
  25885. move.b (a2)+,mapping_frame(a1)
  25886. move.l #Obj6F_MapUnc_14ED0,mappings(a1)
  25887. move.b #$78,width_pixels(a1)
  25888. move.b #0,render_flags(a1)
  25889. lea next_object(a1),a1 ; go to next object ; a1=object
  25890. dbf d1,- ; loop
  25891.  
  25892. ;loc_14450
  25893. Obj6F_InitEmeraldText:
  25894. tst.b (Got_Emerald).w
  25895. beq.s +
  25896. move.b #4,mapping_frame(a0) ; "Chaos Emerald"
  25897. +
  25898. cmpi.b #7,(Emerald_count).w
  25899. bne.s +
  25900. move.b #$19,mapping_frame(a0) ; "Chaos Emeralds"
  25901. +
  25902. move.w objoff_30(a0),d0
  25903. cmp.w x_pixel(a0),d0
  25904. bne.s BranchTo2_Obj34_MoveTowardsTargetPosition
  25905. move.b #$1C,routine(a0) ; => Obj6F_TimedDisplay
  25906. move.w #$B4,anim_frame_duration(a0)
  25907.  
  25908. BranchTo2_Obj34_MoveTowardsTargetPosition
  25909. bra.w Obj34_MoveTowardsTargetPosition
  25910. ; ===========================================================================
  25911. ;loc_14484
  25912. Obj6F_InitResultTitle:
  25913. cmpi.b #7,(Emerald_count).w
  25914. bne.s +
  25915. moveq #$16,d0 ; "Sonic has all the"
  25916. bra.s ++
  25917. ; ===========================================================================
  25918. +
  25919. tst.b (Got_Emerald).w
  25920. beq.w DeleteObject
  25921. moveq #1,d0 ; "Sonic got a"
  25922. +
  25923. cmpi.w #2,(Player_mode).w
  25924. bne.s +
  25925. addq.w #1,d0 ; "Miles got a" or "Miles has all the"
  25926. btst #7,(Graphics_Flags).w
  25927. beq.s +
  25928. addq.w #1,d0 ; "Tails got a" or "Tails has all the"
  25929. +
  25930. move.b d0,mapping_frame(a0)
  25931. bra.w Obj34_MoveTowardsTargetPosition
  25932. ; ===========================================================================
  25933. ;loc_144B6
  25934. Obj6F_Emerald6:
  25935. addq.w #1,d6
  25936. ;loc_144B8
  25937. Obj6F_Emerald5:
  25938. addq.w #1,d6
  25939. ;loc_144BA
  25940. Obj6F_Emerald4:
  25941. addq.w #1,d6
  25942. ;loc_144BC
  25943. Obj6F_Emerald3:
  25944. addq.w #1,d6
  25945. ;loc_144BE
  25946. Obj6F_Emerald2:
  25947. addq.w #1,d6
  25948. ;loc_144C0
  25949. Obj6F_Emerald1:
  25950. addq.w #1,d6
  25951. ;loc_144C2
  25952. Obj6F_Emerald0:
  25953. lea (Got_Emeralds_array).w,a1
  25954. tst.b (a1,d6.w)
  25955. beq.w DeleteObject
  25956. btst #0,(Vint_runcount+3).w
  25957. beq.s +
  25958. bsr.w DisplaySprite
  25959. +
  25960. rts
  25961. ; ===========================================================================
  25962. ;loc_144DC
  25963. Obj6F_P2Rings:
  25964. tst.w (Player_mode).w
  25965. bne.w DeleteObject
  25966. cmpi.b #$26,(SpecialStageResults+routine).w ; Do we need space for perfect countdown?
  25967. beq.w DeleteObject ; Branch if yes
  25968. moveq #$E,d0 ; "Miles rings"
  25969. btst #7,(Graphics_Flags).w
  25970. beq.s +
  25971. addq.w #1,d0 ; "Tails rings"
  25972. +
  25973. lea (Bonus_Countdown_2).w,a1
  25974. bra.s loc_1455A
  25975. ; ===========================================================================
  25976. ;loc_14500
  25977. Obj6F_P1Rings:
  25978. cmpi.b #$26,(SpecialStageResults+routine).w ; Do we need space for perfect countdown?
  25979. bne.s + ; Branch if not
  25980. move.w #5000,(Bonus_Countdown_1).w ; Perfect bonus
  25981. move.b #$2A,routine(a0) ; => Obj6F_PerfectBonus
  25982. move.w #$120,y_pixel(a0)
  25983. st.b (Update_Bonus_score).w ; set to -1 (update)
  25984. move.w #SndID_Signpost,d0
  25985. jsr (PlaySound).l
  25986. move.w #$5A,(SpecialStageResults+anim_frame_duration).w
  25987. bra.w Obj6F_PerfectBonus
  25988. ; ===========================================================================
  25989. +
  25990. move.w (Player_mode).w,d0
  25991. beq.s ++
  25992. move.w #$120,y_pixel(a0)
  25993. subq.w #1,d0
  25994. beq.s ++
  25995. moveq #$E,d0 ; "Miles rings"
  25996. btst #7,(Graphics_Flags).w
  25997. beq.s +
  25998. addq.w #1,d0 ; "Tails rings"
  25999. +
  26000. lea (Bonus_Countdown_2).w,a1
  26001. bra.s loc_1455A
  26002. ; ===========================================================================
  26003. +
  26004. moveq #$D,d0 ; "Sonic rings"
  26005. lea (Bonus_Countdown_1).w,a1
  26006.  
  26007. loc_1455A:
  26008. tst.w (a1)
  26009. bne.s +
  26010. addq.w #5,d0 ; Rings text with zero points
  26011. +
  26012. move.b d0,mapping_frame(a0)
  26013.  
  26014. BranchTo3_Obj34_MoveTowardsTargetPosition
  26015. bra.w Obj34_MoveTowardsTargetPosition
  26016. ; ===========================================================================
  26017. ;loc_14568
  26018. Obj6F_DeleteIfNotEmerald:
  26019. tst.b (Got_Emerald).w
  26020. beq.w DeleteObject
  26021. bra.s BranchTo3_Obj34_MoveTowardsTargetPosition
  26022. ; ===========================================================================
  26023. ;loc_14572
  26024. Obj6F_TimedDisplay:
  26025. subq.w #1,anim_frame_duration(a0)
  26026. bne.s BranchTo19_DisplaySprite
  26027. addq.b #2,routine(a0)
  26028.  
  26029. BranchTo19_DisplaySprite
  26030. bra.w DisplaySprite
  26031. ; ===========================================================================
  26032. ;loc_14580
  26033. Obj6F_TallyScore:
  26034. bsr.w DisplaySprite
  26035. move.b #1,(Update_Bonus_score).w
  26036. moveq #0,d0
  26037. tst.w (Bonus_Countdown_1).w
  26038. beq.s +
  26039. addi.w #10,d0
  26040. subq.w #1,(Bonus_Countdown_1).w
  26041. +
  26042. tst.w (Bonus_Countdown_2).w
  26043. beq.s +
  26044. addi.w #10,d0
  26045. subq.w #1,(Bonus_Countdown_2).w
  26046. +
  26047. tst.w (Total_Bonus_Countdown).w
  26048. beq.s +
  26049. addi.w #10,d0
  26050. subi.w #10,(Total_Bonus_Countdown).w
  26051. +
  26052. tst.w d0
  26053. bne.s +++
  26054. move.w #SndID_TallyEnd,d0
  26055. jsr (PlaySound).l
  26056. addq.b #2,routine(a0) ; => Obj6F_TimedDisplay
  26057. move.w #$78,anim_frame_duration(a0)
  26058. tst.w (Perfect_rings_flag).w
  26059. bne.s +
  26060. cmpi.w #2,(Player_mode).w
  26061. beq.s ++ ; rts
  26062. tst.b (Got_Emerald).w
  26063. beq.s ++ ; rts
  26064. cmpi.b #7,(Emerald_count).w
  26065. bne.s ++ ; rts
  26066. move.b #$30,routine(a0) ; => Obj6F_InitAndMoveSuperMsg
  26067. rts
  26068. ; ===========================================================================
  26069. +
  26070. move.b #$24,routine(a0) ; => Obj6F_TimedDisplay
  26071. move.w #$5A,anim_frame_duration(a0)
  26072. /
  26073. rts
  26074. ; ===========================================================================
  26075. +
  26076. jsr (AddPoints).l
  26077. move.b (Vint_runcount+3).w,d0
  26078. andi.b #3,d0
  26079. bne.s - ; rts
  26080. move.w #SndID_Blip,d0
  26081. jmp (PlaySound).l
  26082. ; ===========================================================================
  26083. ;loc_1461C
  26084. Obj6F_DisplayOnly:
  26085. move.w #1,(Level_Inactive_flag).w
  26086. bra.w DisplaySprite
  26087. ; ===========================================================================
  26088. ;loc_14626
  26089. Obj6F_TallyPerfect:
  26090. bsr.w DisplaySprite
  26091. move.b #1,(Update_Bonus_score).w
  26092. moveq #0,d0
  26093. tst.w (Bonus_Countdown_1).w
  26094. beq.s +
  26095. addi.w #20,d0
  26096. subi.w #20,(Bonus_Countdown_1).w
  26097. +
  26098. tst.w d0
  26099. beq.s +
  26100. jsr (AddPoints).l
  26101. move.b (Vint_runcount+3).w,d0
  26102. andi.b #3,d0
  26103. bne.s ++ ; rts
  26104. move.w #SndID_Blip,d0
  26105. jmp (PlaySound).l
  26106. ; ===========================================================================
  26107. +
  26108. move.w #SndID_TallyEnd,d0
  26109. jsr (PlaySound).l
  26110. addq.b #4,routine(a0)
  26111. move.w #$78,anim_frame_duration(a0)
  26112. cmpi.w #2,(Player_mode).w
  26113. beq.s + ; rts
  26114. tst.b (Got_Emerald).w
  26115. beq.s + ; rts
  26116. cmpi.b #7,(Emerald_count).w
  26117. bne.s + ; rts
  26118. move.b #$30,routine(a0) ; => Obj6F_InitAndMoveSuperMsg
  26119. +
  26120. rts
  26121. ; ===========================================================================
  26122. ;loc_14692
  26123. Obj6F_PerfectBonus:
  26124. moveq #$11,d0 ; "Perfect bonus"
  26125. btst #3,(Vint_runcount+3).w
  26126. beq.s +
  26127. moveq #$15,d0 ; null text
  26128. +
  26129. move.b d0,mapping_frame(a0)
  26130. bra.w DisplaySprite
  26131. ; ===========================================================================
  26132. ;loc_146A6
  26133. Obj6F_InitAndMoveSuperMsg:
  26134. move.b #$32,next_object+routine(a0) ; => Obj6F_MoveToTargetPos
  26135. move.w x_pos(a0),d0
  26136. cmp.w objoff_32(a0),d0
  26137. bne.s Obj6F_MoveToTargetPos
  26138. move.b #$14,next_object+routine(a0) ; => BranchTo3_Obj34_MoveTowardsTargetPosition
  26139. subq.w #8,next_object+y_pixel(a0)
  26140. move.b #$1A,next_object+mapping_frame(a0) ; "Now Sonic can"
  26141. move.b #$34,routine(a0) ; => Obj6F_MoveAndDisplay
  26142. subq.w #8,y_pixel(a0)
  26143. move.b #$1B,mapping_frame(a0) ; "Change into"
  26144. lea (SpecialStageResults2).w,a1
  26145. _move.b id(a0),id(a1) ; load obj6F; (uses screen-space)
  26146. clr.w x_pixel(a1)
  26147. move.w #$120,objoff_30(a1)
  26148. move.w #$B4,y_pixel(a1)
  26149. move.b #$14,routine(a1) ; => BranchTo3_Obj34_MoveTowardsTargetPosition
  26150. move.b #$1C,mapping_frame(a1) ; "Super Sonic"
  26151. move.l #Obj6F_MapUnc_14ED0,mappings(a1)
  26152. move.b #$78,width_pixels(a1)
  26153. move.b #0,render_flags(a1)
  26154. bra.w DisplaySprite
  26155. ; ===========================================================================
  26156. ;loc_14714
  26157. Obj6F_MoveToTargetPos:
  26158. moveq #$20,d0
  26159. move.w x_pos(a0),d1
  26160. cmp.w objoff_32(a0),d1
  26161. beq.s BranchTo20_DisplaySprite
  26162. bhi.s +
  26163. neg.w d0
  26164. +
  26165. sub.w d0,x_pos(a0)
  26166. cmpi.w #$200,x_pos(a0)
  26167. bhi.s +
  26168.  
  26169. BranchTo20_DisplaySprite
  26170. bra.w DisplaySprite
  26171. ; ===========================================================================
  26172. +
  26173. rts
  26174. ; ===========================================================================
  26175. ;loc_14736
  26176. Obj6F_MoveAndDisplay:
  26177. move.w x_pos(a0),d0
  26178. cmp.w objoff_30(a0),d0
  26179. bne.w Obj34_MoveTowardsTargetPosition
  26180. move.w #$B4,anim_frame_duration(a0)
  26181. move.b #$20,routine(a0) ; => Obj6F_TimedDisplay
  26182. bra.w DisplaySprite
  26183. ; ===========================================================================
  26184. byte_14752:
  26185. ; startx targx starty routine map frame
  26186. results_screen_object $240, $120, $AA, 2, 0 ; "Special Stage"
  26187. results_screen_object 0, $120, $98, 4, 1 ; "Sonic got a"
  26188. results_screen_object $118, 0, $C4, 6, 5 ; Emerald 0
  26189. results_screen_object $130, 0, $D0, 8, 6 ; Emerald 1
  26190. results_screen_object $130, 0, $E8, $A, 7 ; Emerald 2
  26191. results_screen_object $118, 0, $F4, $C, 8 ; Emerald 3
  26192. results_screen_object $100, 0, $E8, $E, 9 ; Emerald 4
  26193. results_screen_object $100, 0, $D0, $10, $A ; Emerald 5
  26194. results_screen_object $118, 0, $DC, $12, $B ; Emerald 6
  26195. results_screen_object $330, $120, $108, $14, $C ; Score
  26196. results_screen_object $340, $120, $118, $16, $D ; Sonic Rings
  26197. results_screen_object $350, $120, $128, $18, $E ; Miles Rings
  26198. results_screen_object $360, $120, $138, $1A, $10 ; Gems Bonus
  26199. ; -------------------------------------------------------------------------------
  26200. ; sprite mappings
  26201. ; -------------------------------------------------------------------------------
  26202. Obj34_MapUnc_147BA: offsetTable
  26203. offsetTableEntry.w word_147E8
  26204. offsetTableEntry.w word_147E8
  26205. offsetTableEntry.w word_147E8
  26206. offsetTableEntry.w word_147E8
  26207. offsetTableEntry.w word_14842
  26208. offsetTableEntry.w word_14842
  26209. offsetTableEntry.w word_14B24
  26210. offsetTableEntry.w word_14894
  26211. offsetTableEntry.w word_148CE
  26212. offsetTableEntry.w word_147E8
  26213. offsetTableEntry.w word_14930
  26214. offsetTableEntry.w word_14972
  26215. offsetTableEntry.w word_149C4
  26216. offsetTableEntry.w word_14A1E
  26217. offsetTableEntry.w word_14B86
  26218. offsetTableEntry.w word_14A88
  26219. offsetTableEntry.w word_14AE2
  26220. offsetTableEntry.w word_14BC8
  26221. offsetTableEntry.w word_14BEA
  26222. offsetTableEntry.w word_14BF4
  26223. offsetTableEntry.w word_14BFE
  26224. offsetTableEntry.w word_14C08
  26225. offsetTableEntry.w word_14C32
  26226. word_147E8: dc.w $B
  26227. dc.w 5, $8580, $82C0, $FFC3
  26228. dc.w 9, $85DE, $82EF, $FFD0
  26229. dc.w 5, $8580, $82C0, $FFE8
  26230. dc.w 5, $85E4, $82F2, $FFF8
  26231. dc.w 5, $85E8, $82F4, 8
  26232. dc.w 5, $85EC, $82F6, $18
  26233. dc.w 5, $85F0, $82F8, $28
  26234. dc.w 5, $85F4, $82FA, $48
  26235. dc.w 1, $85F8, $82FC, $58
  26236. dc.w 5, $85EC, $82F6, $60
  26237. dc.w 5, $85EC, $82F6, $70
  26238. word_14842: dc.w $A
  26239. dc.w 9, $85DE, $82EF, $FFE0
  26240. dc.w 5, $8580, $82C0, $FFF8
  26241. dc.w 5, $85E4, $82F2, 8
  26242. dc.w 5, $85E8, $82F4, $18
  26243. dc.w 5, $8588, $82C4, $28
  26244. dc.w 5, $85EC, $82F6, $38
  26245. dc.w 5, $8588, $82C4, $48
  26246. dc.w 5, $85F0, $82F8, $58
  26247. dc.w 1, $85F4, $82FA, $68
  26248. dc.w 5, $85F6, $82FB, $70
  26249. word_14894: dc.w 7
  26250. dc.w 5, $85DE, $82EF, 8
  26251. dc.w 1, $85E2, $82F1, $18
  26252. dc.w 5, $85E4, $82F2, $20
  26253. dc.w 5, $85E4, $82F2, $30
  26254. dc.w 5, $85E8, $82F4, $51
  26255. dc.w 5, $8588, $82C4, $60
  26256. dc.w 5, $85EC, $82F6, $70
  26257. word_148CE: dc.w $C
  26258. dc.w 5, $85DE, $82EF, $FFB8
  26259. dc.w 1, $85E2, $82F1, $FFC8
  26260. dc.w 5, $85E4, $82F2, $FFD0
  26261. dc.w 5, $85E4, $82F2, $FFE0
  26262. dc.w 5, $8580, $82C0, $FFF0
  26263. dc.w 5, $8584, $82C2, 0
  26264. dc.w 5, $85E8, $82F4, $20
  26265. dc.w 5, $85EC, $82F6, $30
  26266. dc.w 5, $85F0, $82F8, $40
  26267. dc.w 5, $85EC, $82F6, $50
  26268. dc.w 5, $85F4, $82FA, $60
  26269. dc.w 5, $8580, $82C0, $70
  26270. word_14930: dc.w 8
  26271. dc.w 5, $8588, $82C4, $FFFB
  26272. dc.w 1, $85DE, $82EF, $B
  26273. dc.w 5, $85E0, $82F0, $13
  26274. dc.w 5, $8588, $82C4, $33
  26275. dc.w 5, $85E4, $82F2, $43
  26276. dc.w 5, $8580, $82C0, $53
  26277. dc.w 5, $85E8, $82F4, $60
  26278. dc.w 5, $8584, $82C2, $70
  26279. word_14972: dc.w $A
  26280. dc.w 9, $85DE, $82EF, $FFD0
  26281. dc.w 5, $85E4, $82F2, $FFE8
  26282. dc.w 5, $85E8, $82F4, $FFF8
  26283. dc.w 5, $85EC, $82F6, 8
  26284. dc.w 1, $85F0, $82F8, $18
  26285. dc.w 5, $85F2, $82F9, $20
  26286. dc.w 5, $85F2, $82F9, $41
  26287. dc.w 5, $85F6, $82FB, $50
  26288. dc.w 5, $85FA, $82FD, $60
  26289. dc.w 5, $8580, $82C0, $70
  26290. word_149C4: dc.w $B
  26291. dc.w 5, $85DE, $82EF, $FFD1
  26292. dc.w 5, $85E2, $82F1, $FFE0
  26293. dc.w 5, $85E6, $82F3, $FFF0
  26294. dc.w 1, $85EA, $82F5, 0
  26295. dc.w 5, $8584, $82C2, 8
  26296. dc.w 5, $8588, $82C4, $18
  26297. dc.w 5, $8584, $82C2, $38
  26298. dc.w 1, $85EA, $82F5, $48
  26299. dc.w 5, $85EC, $82F6, $50
  26300. dc.w 5, $85F0, $82F8, $60
  26301. dc.w 5, $85F4, $82FA, $70
  26302. word_14A1E: dc.w $D
  26303. dc.w 5, $85DE, $82EF, $FFA4
  26304. dc.w 5, $85E2, $82F1, $FFB4
  26305. dc.w 5, $8580, $82C0, $FFC4
  26306. dc.w 9, $85E6, $82F3, $FFD1
  26307. dc.w 1, $85EC, $82F6, $FFE9
  26308. dc.w 5, $85DE, $82EF, $FFF1
  26309. dc.w 5, $85EE, $82F7, 0
  26310. dc.w 5, $85F2, $82F9, $10
  26311. dc.w 5, $85F6, $82FB, $31
  26312. dc.w 5, $85F2, $82F9, $41
  26313. dc.w 5, $85EE, $82F7, $50
  26314. dc.w 5, $8584, $82C2, $60
  26315. dc.w 5, $85FA, $82FD, $70
  26316. word_14A88: dc.w $B
  26317. dc.w 5, $85DE, $82EF, $FFD2
  26318. dc.w 5, $85E2, $82F1, $FFE2
  26319. dc.w 5, $85E6, $82F3, $FFF2
  26320. dc.w 5, $85DE, $82EF, 0
  26321. dc.w 5, $85EA, $82F5, $10
  26322. dc.w 1, $85EE, $82F7, $20
  26323. dc.w 5, $85F0, $82F8, $28
  26324. dc.w 5, $85F4, $82FA, $48
  26325. dc.w 5, $85E6, $82F3, $58
  26326. dc.w 1, $85EE, $82F7, $68
  26327. dc.w 5, $8584, $82C2, $70
  26328. word_14AE2: dc.w 8
  26329. dc.w 5, $85DE, $82EF, $FFF0
  26330. dc.w 5, $85E2, $82F1, 0
  26331. dc.w 5, $85E6, $82F3, $10
  26332. dc.w 5, $85EA, $82F5, $30
  26333. dc.w 5, $85EE, $82F7, $40
  26334. dc.w 5, $85F2, $82F9, $50
  26335. dc.w 5, $85DE, $82EF, $60
  26336. dc.w 5, $8580, $82C0, $70
  26337. word_14B24: dc.w $C
  26338. dc.w 9, $85DE, $82EF, $FFB1
  26339. dc.w 1, $85E4, $82F2, $FFC8
  26340. dc.w 5, $8584, $82C2, $FFD0
  26341. dc.w 5, $85E6, $82F3, $FFE0
  26342. dc.w 5, $85EA, $82F5, 1
  26343. dc.w 5, $8588, $82C4, $10
  26344. dc.w 5, $85EE, $82F7, $20
  26345. dc.w 5, $85F2, $82F9, $30
  26346. dc.w 5, $85EE, $82F7, $40
  26347. dc.w 5, $8580, $82C0, $50
  26348. dc.w 5, $85F6, $82FB, $5F
  26349. dc.w 5, $85F6, $82FB, $6F
  26350. word_14B86: dc.w 8
  26351. dc.w 5, $85DE, $82EF, $FFF2
  26352. dc.w 5, $8580, $82C0, 2
  26353. dc.w 5, $85E2, $82F1, $10
  26354. dc.w 5, $85E6, $82F3, $20
  26355. dc.w 5, $85EA, $82F5, $30
  26356. dc.w 5, $8580, $82C0, $51
  26357. dc.w 5, $85EE, $82F7, $60
  26358. dc.w 5, $85EE, $82F7, $70
  26359. word_14BC8: dc.w 4
  26360. dc.w 5, $858C, $82C6, 1
  26361. dc.w 5, $8588, $82C4, $10
  26362. dc.w 5, $8584, $82C2, $20
  26363. dc.w 5, $8580, $82C0, $30
  26364. word_14BEA: dc.w 1
  26365. dc.w 7, $A590, $A2C8, 0
  26366. word_14BF4: dc.w 1
  26367. dc.w $B, $A598, $A2CC, 0
  26368. word_14BFE: dc.w 1
  26369. dc.w $B, $A5A4, $A2D2, 0
  26370. word_14C08: dc.w 5
  26371. dc.w $D, $85B0, $82D8, $FFB8
  26372. dc.w $D, $85B8, $82DC, $FFD8
  26373. dc.w $D, $85C0, $82E0, $FFF8
  26374. dc.w $D, $85C8, $82E4, $18
  26375. dc.w 5, $85D0, $82E8, $38
  26376. word_14C32: dc.w 7
  26377. dc.w $9003, $85D4, $82EA, 0
  26378. dc.w $B003, $85D4, $82EA, 0
  26379. dc.w $D003, $85D4, $82EA, 0
  26380. dc.w $F003, $85D4, $82EA, 0
  26381. dc.w $1003, $85D4, $82EA, 0
  26382. dc.w $3003, $85D4, $82EA, 0
  26383. dc.w $5003, $85D4, $82EA, 0
  26384. ; -------------------------------------------------------------------------------
  26385. ; sprite mappings
  26386. ; -------------------------------------------------------------------------------
  26387. Obj39_MapUnc_14C6C: BINCLUDE "mappings/sprite/obj39.bin"
  26388. ; -------------------------------------------------------------------------------
  26389. ; sprite mappings
  26390. ; -------------------------------------------------------------------------------
  26391. Obj3A_MapUnc_14CBC: offsetTable
  26392. offsetTableEntry.w word_14CDA
  26393. offsetTableEntry.w word_14D1C
  26394. offsetTableEntry.w word_14D5E
  26395. offsetTableEntry.w word_14DA0
  26396. offsetTableEntry.w word_14DDA
  26397. offsetTableEntry.w word_14BC8
  26398. offsetTableEntry.w word_14BEA
  26399. offsetTableEntry.w word_14BF4
  26400. offsetTableEntry.w word_14BFE
  26401. offsetTableEntry.w word_14DF4
  26402. offsetTableEntry.w word_14E1E
  26403. offsetTableEntry.w word_14E50
  26404. offsetTableEntry.w word_14E82
  26405. offsetTableEntry.w word_14E8C
  26406. offsetTableEntry.w word_14E96
  26407. word_14CDA: dc.w 8
  26408. dc.w 5, $85D0, $82E8, $FFC0
  26409. dc.w 5, $8588, $82C4, $FFD0
  26410. dc.w 5, $8584, $82C2, $FFE0
  26411. dc.w 1, $85C0, $82E0, $FFF0
  26412. dc.w 5, $85B4, $82DA, $FFF8
  26413. dc.w 5, $85B8, $82DC, $10
  26414. dc.w 5, $8588, $82C4, $20
  26415. dc.w 5, $85D4, $82EA, $2F
  26416. word_14D1C: dc.w 8
  26417. dc.w 9, $85C6, $82E3, $FFBC
  26418. dc.w 1, $85C0, $82E0, $FFD4
  26419. dc.w 5, $85C2, $82E1, $FFDC
  26420. dc.w 5, $8580, $82C0, $FFEC
  26421. dc.w 5, $85D0, $82E8, $FFFC
  26422. dc.w 5, $85B8, $82DC, $14
  26423. dc.w 5, $8588, $82C4, $24
  26424. dc.w 5, $85D4, $82EA, $33
  26425. word_14D5E: dc.w 8
  26426. dc.w 5, $85D4, $82EA, $FFC3
  26427. dc.w 5, $85B0, $82D8, $FFD0
  26428. dc.w 1, $85C0, $82E0, $FFE0
  26429. dc.w 5, $85C2, $82E1, $FFE8
  26430. dc.w 5, $85D0, $82E8, $FFF8
  26431. dc.w 5, $85B8, $82DC, $10
  26432. dc.w 5, $8588, $82C4, $20
  26433. dc.w 5, $85D4, $82EA, $2F
  26434. word_14DA0: dc.w 7
  26435. dc.w 5, $85D4, $82EA, $FFC8
  26436. dc.w 5, $85BC, $82DE, $FFD8
  26437. dc.w 5, $85CC, $82E6, $FFE8
  26438. dc.w 5, $8588, $82C4, $FFF8
  26439. dc.w 5, $85D8, $82EC, 8
  26440. dc.w 5, $85B8, $82DC, $18
  26441. dc.w 5, $85BC, $82DE, $28
  26442. word_14DDA: dc.w 3
  26443. dc.w 5, $85B0, $82D8, 0
  26444. dc.w 5, $85B4, $82DA, $10
  26445. dc.w 5, $85D4, $82EA, $1F
  26446. word_14DF4: dc.w 5
  26447. dc.w 9, $A5E6, $A2F3, $FFB8
  26448. dc.w 5, $A5EC, $A2F6, $FFD0
  26449. dc.w 5, $85F0, $82F8, $FFD4
  26450. dc.w $D, $8520, $8290, $38
  26451. dc.w 1, $86F0, $8378, $58
  26452. word_14E1E: dc.w 6
  26453. dc.w $D, $A6DA, $A36D, $FFA4
  26454. dc.w $D, $A5DE, $A2EF, $FFCC
  26455. dc.w 1, $A6CA, $A365, $FFEC
  26456. dc.w 5, $85F0, $82F8, $FFE8
  26457. dc.w $D, $8528, $8294, $38
  26458. dc.w 1, $86F0, $8378, $58
  26459. word_14E50: dc.w 6
  26460. dc.w $D, $A6D2, $A369, $FFA4
  26461. dc.w $D, $A5DE, $A2EF, $FFCC
  26462. dc.w 1, $A6CA, $A365, $FFEC
  26463. dc.w 5, $85F0, $82F8, $FFE8
  26464. dc.w $D, $8530, $8298, $38
  26465. dc.w 1, $86F0, $8378, $58
  26466. word_14E82: dc.w 1
  26467. dc.w 6, $85F4, $82FA, 0
  26468. word_14E8C: dc.w 1
  26469. dc.w 6, $85FA, $82FD, 0
  26470. word_14E96: dc.w 7
  26471. dc.w $D, $A540, $A2A0, $FF98
  26472. dc.w 9, $A548, $A2A4, $FFB8
  26473. dc.w $D, $A5DE, $A2EF, $FFD8
  26474. dc.w 1, $A6CA, $A365, $FFF8
  26475. dc.w 5, $85F0, $82F8, $FFF4
  26476. dc.w $D, $8538, $829C, $38
  26477. dc.w 1, $86F0, $8378, $58
  26478. ; -------------------------------------------------------------------------------
  26479. ; sprite mappings
  26480. ; -------------------------------------------------------------------------------
  26481. Obj6F_MapUnc_14ED0: BINCLUDE "mappings/sprite/obj6F.bin"
  26482. ; ===========================================================================
  26483.  
  26484. ;loc_15584: ; level title card drawing function called from Vint
  26485. DrawLevelTitleCard:
  26486. lea (VDP_data_port).l,a6
  26487. tst.w (TitleCard_ZoneName+titlecard_leaveflag).w
  26488. bne.w loc_15670
  26489. moveq #$3F,d5
  26490. move.l #make_block_tile_pair(ArtTile_ArtNem_TitleCard+$5A,0,0,0,1),d6
  26491. tst.w (Two_player_mode).w
  26492. beq.s loc_155A8
  26493. moveq #$1F,d5
  26494. move.l #make_block_tile_pair_2p(ArtTile_ArtNem_TitleCard+$5A,0,0,0,1),d6
  26495.  
  26496. loc_155A8:
  26497. lea (TitleCard_Background+titlecard_vram_dest).w,a0
  26498. moveq #1,d7 ; Once for P1, once for P2 (if in 2p mode)
  26499.  
  26500. loc_155AE:
  26501. move.w (a0)+,d0
  26502. beq.s loc_155C6
  26503. clr.w -2(a0)
  26504. jsr sub_15792(pc)
  26505. move.l d0,VDP_control_port-VDP_data_port(a6)
  26506. move.w d5,d4
  26507.  
  26508. loc_155C0:
  26509. move.l d6,(a6)
  26510. dbf d4,loc_155C0
  26511.  
  26512. loc_155C6:
  26513. dbf d7,loc_155AE
  26514. moveq #$26,d1
  26515. sub.w (TitleCard_Bottom+titlecard_split_point).w,d1
  26516. lsr.w #1,d1
  26517. subq.w #1,d1
  26518. moveq #7,d5
  26519. move.l #make_block_tile_pair(ArtTile_ArtNem_TitleCard+$5C,0,0,1,1),d6
  26520. tst.w (Two_player_mode).w
  26521. beq.s loc_155EA
  26522. moveq #3,d5
  26523. move.l #make_block_tile_pair_2p(ArtTile_ArtNem_TitleCard+$5C,0,0,1,1),d6
  26524.  
  26525. loc_155EA:
  26526. lea (TitleCard_Bottom+titlecard_vram_dest).w,a0
  26527. moveq #1,d7 ; Once for P1, once for P2 (if in 2p mode)
  26528.  
  26529. loc_155F0:
  26530. move.w (a0)+,d0
  26531. beq.s loc_15614
  26532. clr.w -2(a0)
  26533. jsr sub_15792(pc)
  26534. move.w d5,d4
  26535.  
  26536. loc_155FE:
  26537. move.l d0,VDP_control_port-VDP_data_port(a6)
  26538. move.w d1,d3
  26539.  
  26540. loc_15604:
  26541. move.l d6,(a6)
  26542. dbf d3,loc_15604
  26543. addi.l #vdpCommDelta($0080),d0
  26544. dbf d4,loc_155FE
  26545.  
  26546. loc_15614:
  26547. dbf d7,loc_155F0
  26548. move.w (TitleCard_Left+titlecard_split_point).w,d1 ; horizontal draw from left until this position
  26549. subq.w #1,d1
  26550. moveq #$D,d5
  26551. move.l #make_block_tile_pair(ArtTile_ArtNem_TitleCard+$58,0,0,0,1),d6 ; VRAM location of graphic to fill on left side
  26552. tst.w (Two_player_mode).w
  26553. beq.s loc_15634
  26554. moveq #6,d5
  26555. move.l #make_block_tile_pair_2p(ArtTile_ArtNem_TitleCard+$58,0,0,0,1),d6 ; VRAM location of graphic to fill on left side (2p)
  26556.  
  26557. loc_15634:
  26558. lea (TitleCard_Left+titlecard_vram_dest).w,a0 ; obj34 red title card left side part
  26559. moveq #1,d7 ; Once for P1, once for P2 (if in 2p mode)
  26560. move.w #$8F80,VDP_control_port-VDP_data_port(a6) ; VRAM pointer increment: $0080
  26561.  
  26562. loc_15640:
  26563. move.w (a0)+,d0
  26564. beq.s loc_15664
  26565. clr.w -2(a0)
  26566. jsr sub_15792(pc)
  26567. move.w d1,d4
  26568.  
  26569. loc_1564E:
  26570. move.l d0,VDP_control_port-VDP_data_port(a6)
  26571. move.w d5,d3
  26572.  
  26573. loc_15654:
  26574. move.l d6,(a6)
  26575. dbf d3,loc_15654
  26576. addi.l #vdpCommDelta($0002),d0
  26577. dbf d4,loc_1564E
  26578.  
  26579. loc_15664:
  26580. dbf d7,loc_15640
  26581. move.w #$8F02,VDP_control_port-VDP_data_port(a6) ; VRAM pointer increment: $0002
  26582. rts
  26583. ; ===========================================================================
  26584.  
  26585. loc_15670:
  26586. moveq #9,d3
  26587. moveq #3,d4
  26588. move.l #make_block_tile_pair(ArtTile_ArtNem_TitleCard+$5A,0,0,0,1),d5
  26589. move.l #make_block_tile_pair(ArtTile_ArtNem_TitleCard+$5C,0,0,1,1),d6
  26590. tst.w (Two_player_mode).w
  26591. beq.s +
  26592. moveq #4,d3
  26593. moveq #1,d4
  26594. move.l #make_block_tile_pair_2p(ArtTile_ArtNem_TitleCard+$5A,0,0,0,1),d5
  26595. move.l #make_block_tile_pair_2p(ArtTile_ArtNem_TitleCard+$5C,0,0,1,1),d6
  26596. +
  26597. lea (TitleCard_Left+titlecard_vram_dest).w,a0
  26598. moveq #1,d7 ; Once for P1, once for P2 (if in 2p mode)
  26599. move.w #$8F80,VDP_control_port-VDP_data_port(a6) ; VRAM pointer increment: $0080
  26600.  
  26601. loc_156A2:
  26602. move.w (a0)+,d0
  26603. beq.s loc_156CE
  26604. clr.w -2(a0)
  26605. jsr sub_15792(pc)
  26606. moveq #3,d2
  26607.  
  26608. loc_156B0:
  26609. move.l d0,VDP_control_port-VDP_data_port(a6)
  26610.  
  26611. move.w d3,d1
  26612. - move.l d5,(a6)
  26613. dbf d1,-
  26614.  
  26615. move.w d4,d1
  26616. - move.l d6,(a6)
  26617. dbf d1,-
  26618.  
  26619. addi.l #vdpCommDelta($0002),d0
  26620. dbf d2,loc_156B0
  26621.  
  26622. loc_156CE:
  26623. dbf d7,loc_156A2
  26624. move.w #$8F02,VDP_control_port-VDP_data_port(a6) ; VRAM pointer increment: $0002
  26625. moveq #7,d5
  26626. move.l #make_block_tile_pair(ArtTile_ArtNem_TitleCard+$5A,0,0,0,1),d6
  26627. tst.w (Two_player_mode).w
  26628. beq.s +
  26629. moveq #3,d5
  26630. move.l #make_block_tile_pair_2p(ArtTile_ArtNem_TitleCard+$5A,0,0,0,1),d6
  26631. +
  26632. lea (TitleCard_Bottom+titlecard_vram_dest).w,a0
  26633. moveq #1,d7 ; Once for P1, once for P2 (if in 2p mode)
  26634.  
  26635. loc_156F4:
  26636. move.w (a0)+,d0
  26637. beq.s loc_15714
  26638. clr.w -2(a0)
  26639. jsr sub_15792(pc)
  26640.  
  26641. move.w d5,d4
  26642. - move.l d0,VDP_control_port-VDP_data_port(a6)
  26643. move.l d6,(a6)
  26644. move.l d6,(a6)
  26645. addi.l #vdpCommDelta($0080),d0
  26646. dbf d4,-
  26647.  
  26648. loc_15714:
  26649. dbf d7,loc_156F4
  26650. move.w (TitleCard_Background+titlecard_vram_dest).w,d4
  26651. beq.s loc_1578C
  26652. lea VDP_control_port-VDP_data_port(a6),a5
  26653. tst.w (Two_player_mode).w
  26654. beq.s loc_15758
  26655. lea (Camera_X_pos_P2).w,a3
  26656. lea (Level_Layout).w,a4
  26657. move.w #vdpComm(VRAM_Plane_A_Name_Table_2P,VRAM,WRITE)>>16,d2
  26658.  
  26659. moveq #1,d6
  26660. - movem.l d4-d6,-(sp)
  26661. moveq #-$10,d5
  26662. move.w d4,d1
  26663. bsr.w CalcBlockVRAMPosB
  26664. move.w d1,d4
  26665. moveq #-$10,d5
  26666. moveq #$1F,d6
  26667. bsr.w DrawBlockRow
  26668. movem.l (sp)+,d4-d6
  26669. addi.w #$10,d4
  26670. dbf d6,-
  26671.  
  26672. loc_15758:
  26673. lea (Camera_X_pos).w,a3
  26674. lea (Level_Layout).w,a4
  26675. move.w #vdpComm(VRAM_Plane_A_Name_Table,VRAM,WRITE)>>16,d2
  26676. move.w (TitleCard_Background+titlecard_vram_dest).w,d4
  26677.  
  26678. moveq #1,d6
  26679. - movem.l d4-d6,-(sp)
  26680. moveq #-$10,d5
  26681. move.w d4,d1
  26682. bsr.w CalcBlockVRAMPos
  26683. move.w d1,d4
  26684. moveq #-$10,d5
  26685. moveq #$1F,d6
  26686. bsr.w DrawBlockRow
  26687. movem.l (sp)+,d4-d6
  26688. addi.w #$10,d4
  26689. dbf d6,-
  26690.  
  26691. loc_1578C:
  26692. clr.w (TitleCard_Background+titlecard_vram_dest).w
  26693. rts
  26694. ; ===========================================================================
  26695.  
  26696. ; ---------------------------------------------------------------------------
  26697. ; Subroutine to convert a VRAM address into a 32-bit VRAM write command word
  26698. ; Input:
  26699. ; d0 VRAM address (word)
  26700. ; Output:
  26701. ; d0 32-bit VDP command word for a VRAM write to specified address.
  26702. ; ---------------------------------------------------------------------------
  26703.  
  26704. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  26705.  
  26706.  
  26707. sub_15792:
  26708. andi.l #$FFFF,d0
  26709. lsl.l #2,d0
  26710. lsr.w #2,d0
  26711. ori.w #vdpComm($0000,VRAM,WRITE)>>16,d0
  26712. swap d0
  26713. rts
  26714. ; End of function sub_15792
  26715.  
  26716. ; ===========================================================================
  26717.  
  26718. ;loc_157A4
  26719. LoadTitleCardSS:
  26720. movem.l d0/a0,-(sp)
  26721. bsr.s LoadTitleCard0
  26722. movem.l (sp)+,d0/a0
  26723. bra.s loc_157EC
  26724.  
  26725. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  26726.  
  26727. ; sub_157B0:
  26728. LoadTitleCard0:
  26729. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_TitleCard),VRAM,WRITE),(VDP_control_port).l
  26730. lea (ArtNem_TitleCard).l,a0
  26731. jsrto (NemDec).l, JmpTo2_NemDec
  26732. lea (Level_Layout).w,a4
  26733. lea (ArtNem_TitleCard2).l,a0
  26734. jmpto (NemDecToRAM).l, JmpTo_NemDecToRAM
  26735. ; ===========================================================================
  26736. ; loc_157D2:
  26737. LoadTitleCard:
  26738. bsr.s LoadTitleCard0
  26739. moveq #0,d0
  26740. move.b (Current_Zone).w,d0
  26741. move.b Off_TitleCardLetters(pc,d0.w),d0
  26742. lea TitleCardLetters(pc),a0
  26743. lea (a0,d0.w),a0
  26744. move.l #vdpComm(tiles_to_bytes(ArtTile_LevelName),VRAM,WRITE),d0
  26745.  
  26746. loc_157EC:
  26747. move #$2700,sr
  26748. lea (Level_Layout).w,a1
  26749. lea (VDP_data_port).l,a6
  26750. move.l d0,4(a6)
  26751.  
  26752. loc_157FE:
  26753. moveq #0,d0
  26754. move.b (a0)+,d0
  26755. bmi.s loc_1581A
  26756. lsl.w #5,d0
  26757. lea (a1,d0.w),a2
  26758. moveq #0,d1
  26759. move.b (a0)+,d1
  26760. lsl.w #3,d1
  26761. subq.w #1,d1
  26762.  
  26763. loc_15812:
  26764. move.l (a2)+,(a6)
  26765. dbf d1,loc_15812
  26766. bra.s loc_157FE
  26767. ; ===========================================================================
  26768.  
  26769. loc_1581A:
  26770. move #$2300,sr
  26771. rts
  26772. ; ===========================================================================
  26773. ; byte_15820:
  26774. Off_TitleCardLetters:
  26775. dc.b TitleCardLetters_EHZ - TitleCardLetters ; 0
  26776. dc.b TitleCardLetters_EHZ - TitleCardLetters ; 1
  26777. dc.b TitleCardLetters_EHZ - TitleCardLetters ; 2
  26778. dc.b TitleCardLetters_EHZ - TitleCardLetters ; 3
  26779. dc.b TitleCardLetters_MTZ - TitleCardLetters ; 4
  26780. dc.b TitleCardLetters_MTZ - TitleCardLetters ; 5
  26781. dc.b TitleCardLetters_WFZ - TitleCardLetters ; 6
  26782. dc.b TitleCardLetters_HTZ - TitleCardLetters ; 7
  26783. dc.b TitleCardLetters_HPZ - TitleCardLetters ; 8
  26784. dc.b TitleCardLetters_EHZ - TitleCardLetters ; 9
  26785. dc.b TitleCardLetters_OOZ - TitleCardLetters ; A
  26786. dc.b TitleCardLetters_MCZ - TitleCardLetters ; B
  26787. dc.b TitleCardLetters_CNZ - TitleCardLetters ; C
  26788. dc.b TitleCardLetters_CPZ - TitleCardLetters ; D
  26789. dc.b TitleCardLetters_DEZ - TitleCardLetters ; E
  26790. dc.b TitleCardLetters_ARZ - TitleCardLetters ; F
  26791. dc.b TitleCardLetters_SCZ - TitleCardLetters ; 10
  26792. even
  26793.  
  26794. ; temporarily remap characters to title card letter format
  26795. ; Characters are encoded as Aa, Bb, Cc, etc. through a macro
  26796. charset 'A',0 ; can't have an embedded 0 in a string
  26797. charset 'B',"\4\8\xC\4\x10\x14\x18\x1C\x1E\x22\x26\x2A\4\4\x30\x34\x38\x3C\x40\x44\x48\x4C\x52\x56\4"
  26798. charset 'a',"\4\4\4\4\4\4\4\4\2\4\4\4\6\4\4\4\4\4\4\4\4\4\6\4\4"
  26799. charset '.',"\x5A"
  26800.  
  26801. ; Defines which letters load for the continue screen
  26802. ; Each letter occurs only once, and the letters ENOZ (i.e. ZONE) aren't loaded here
  26803. ; However, this is hidden by the titleLetters macro, and normal titles can be used
  26804. ; (the macro is defined near SpecialStage_ResultsLetters, which uses it before here)
  26805.  
  26806. ; word_15832:
  26807. TitleCardLetters:
  26808.  
  26809. TitleCardLetters_EHZ:
  26810. titleLetters "EMERALD HILL"
  26811. TitleCardLetters_MTZ:
  26812. titleLetters "METROPOLIS"
  26813. TitleCardLetters_HTZ:
  26814. titleLetters "HILL TOP"
  26815. TitleCardLetters_HPZ:
  26816. titleLetters "HIDDEN PALACE"
  26817. TitleCardLetters_OOZ:
  26818. titleLetters "OIL OCEAN"
  26819. TitleCardLetters_MCZ:
  26820. titleLetters "MYSTIC CAVE"
  26821. TitleCardLetters_CNZ:
  26822. titleLetters "CASINO NIGHT"
  26823. TitleCardLetters_CPZ:
  26824. titleLetters "CHEMICAL PLANT"
  26825. TitleCardLetters_ARZ:
  26826. titleLetters "AQUATIC RUIN"
  26827. TitleCardLetters_SCZ:
  26828. titleLetters "SKY CHASE"
  26829. TitleCardLetters_WFZ:
  26830. titleLetters "WING FORTRESS"
  26831. TitleCardLetters_DEZ:
  26832. titleLetters "DEATH EGG"
  26833.  
  26834. charset ; revert character set
  26835.  
  26836. ; ===========================================================================
  26837.  
  26838. if gameRevision<2
  26839. nop
  26840. endif
  26841.  
  26842. if ~~removeJmpTos
  26843. JmpTo2_NemDec
  26844. jmp (NemDec).l
  26845. JmpTo_NemDecToRAM
  26846. jmp (NemDecToRAM).l
  26847. JmpTo3_LoadPLC
  26848. jmp (LoadPLC).l
  26849. JmpTo_sub_8476
  26850. jmp (sub_8476).l
  26851.  
  26852. align 4
  26853. endif
  26854.  
  26855.  
  26856.  
  26857.  
  26858. ; ===========================================================================
  26859. ; ----------------------------------------------------------------------------
  26860. ; Object 36 - Spikes
  26861. ; ----------------------------------------------------------------------------
  26862. ; OST Variables:
  26863. spikes_base_x_pos = objoff_30 ; original x-position
  26864. spikes_base_y_pos = objoff_32 ; original y-position
  26865. spikes_retract_offset = objoff_34 ; actual position relative to base position
  26866. spikes_retract_state = objoff_36 ; 0 = positive offset, 1 = original position
  26867. spikes_retract_timer = objoff_38 ; delay, before spikes move again
  26868. ; Sprite_15900:
  26869. Obj36:
  26870. moveq #0,d0
  26871. move.b routine(a0),d0
  26872. move.w Obj36_Index(pc,d0.w),d1
  26873. jmp Obj36_Index(pc,d1.w)
  26874. ; ===========================================================================
  26875. ; off_1590E:
  26876. Obj36_Index: offsetTable
  26877. offsetTableEntry.w Obj36_Init ; 0
  26878. offsetTableEntry.w Obj36_Upright ; 2
  26879. offsetTableEntry.w Obj36_Sideways ; 4
  26880. offsetTableEntry.w Obj36_Upsidedown ; 6
  26881. ; ===========================================================================
  26882. ; byte_15916:
  26883. Obj36_InitData:
  26884. ; width_pixels
  26885. ; y_radius
  26886. dc.b $10,$10 ; 0 - Upright or ceiling spikes
  26887. dc.b $20,$10 ; 2
  26888. dc.b $30,$10 ; 4
  26889. dc.b $40,$10 ; 6
  26890. dc.b $10,$10 ; 8 - Sideways spikes
  26891. dc.b $10,$20 ; 10
  26892. dc.b $10,$30 ; 12
  26893. dc.b $10,$40 ; 14
  26894. ; ===========================================================================
  26895. ; loc_15926:
  26896. Obj36_Init:
  26897. addq.b #2,routine(a0) ; => Obj36_Upright
  26898. move.l #Obj36_MapUnc_15B68,mappings(a0)
  26899. move.w #make_art_tile(ArtTile_ArtNem_Spikes,1,0),art_tile(a0)
  26900. ori.b #4,render_flags(a0)
  26901. move.b #4,priority(a0)
  26902. move.b subtype(a0),d0
  26903. andi.b #$F,subtype(a0) ; lower 4 bits determine behavior, upper bits need to be removed
  26904. andi.w #$F0,d0
  26905. lea_ Obj36_InitData,a1 ; upper 4 bits determine size and orientation
  26906. lsr.w #3,d0 ; use upper 4 bits * 2 as offset
  26907. adda.w d0,a1
  26908. move.b (a1)+,width_pixels(a0)
  26909. move.b (a1)+,y_radius(a0)
  26910. lsr.w #1,d0 ; use upper 4 bits to determine mappings frame
  26911. move.b d0,mapping_frame(a0)
  26912. cmpi.b #4,d0 ; do spikes face sideways?
  26913. blo.s + ; if not, branch
  26914. addq.b #2,routine(a0) ; => Obj36_Sideways
  26915. move.w #make_art_tile(ArtTile_ArtNem_HorizSpike,1,0),art_tile(a0)
  26916. +
  26917. btst #1,status(a0) ; are spikes upsiede-down?
  26918. beq.s + ; if not, branch
  26919. move.b #6,routine(a0) ; => Obj36_Upsidedown
  26920. +
  26921. move.w x_pos(a0),spikes_base_x_pos(a0)
  26922. move.w y_pos(a0),spikes_base_y_pos(a0)
  26923. bra.w Adjust2PArtPointer
  26924. ; ===========================================================================
  26925. ; loc_15996:
  26926. Obj36_Upright:
  26927. bsr.w MoveSpikes
  26928. moveq #0,d1
  26929. move.b width_pixels(a0),d1
  26930. addi.w #$B,d1
  26931. moveq #0,d2
  26932. move.b y_radius(a0),d2
  26933. move.w d2,d3
  26934. addq.w #1,d3
  26935. move.w x_pos(a0),d4
  26936. bsr.w SolidObject
  26937. move.b status(a0),d6
  26938. andi.b #standing_mask,d6 ; are Sonic or Tails standing on the object?
  26939. beq.s Obj36_UprightEnd ; if not, branch
  26940. move.b d6,d0
  26941. andi.b #p1_standing,d0 ; is Sonic standing on the object?
  26942. beq.s + ; if not, branch
  26943. lea (MainCharacter).w,a1 ; a1=character
  26944. bsr.w Touch_ChkHurt2
  26945. +
  26946. andi.b #p2_standing,d6 ; is Tails standing on the object?
  26947. beq.s Obj36_UprightEnd ; if not, branch
  26948. lea (Sidekick).w,a1 ; a1=character
  26949. bsr.w Touch_ChkHurt2
  26950.  
  26951. ; loc_159DE:
  26952. Obj36_UprightEnd:
  26953. move.w spikes_base_x_pos(a0),d0
  26954. bra.w MarkObjGone2
  26955. ; ===========================================================================
  26956. ; loc_159E6:
  26957. Obj36_Sideways:
  26958. move.w x_pos(a0),-(sp)
  26959. bsr.w MoveSpikes
  26960. moveq #0,d1
  26961. move.b width_pixels(a0),d1
  26962. addi.w #$B,d1
  26963. moveq #0,d2
  26964. move.b y_radius(a0),d2
  26965. move.w d2,d3
  26966. addq.w #1,d3
  26967. move.w (sp)+,d4
  26968. bsr.w SolidObject
  26969. swap d6
  26970. andi.w #touch_side_mask,d6 ; are Sonic or Tails pushing against the side?
  26971. beq.s Obj36_SidewaysEnd ; if not, branch
  26972. move.b d6,d0
  26973. andi.b #p1_touch_side,d0 ; is Sonic pushing against the side?
  26974. beq.s + ; if not, branch
  26975. lea (MainCharacter).w,a1 ; a1=character
  26976. bsr.w Touch_ChkHurt2
  26977. bclr #p1_pushing_bit,status(a0)
  26978. +
  26979. andi.b #p2_touch_side,d6 ; is Tails pushing against the side?
  26980. beq.s Obj36_SidewaysEnd ; if not, branch
  26981. lea (Sidekick).w,a1 ; a1=character
  26982. bsr.w Touch_ChkHurt2
  26983. bclr #p2_pushing_bit,status(a0)
  26984.  
  26985. ; loc_15A3A:
  26986. Obj36_SidewaysEnd:
  26987. move.w spikes_base_x_pos(a0),d0
  26988. bra.w MarkObjGone2
  26989. ; ===========================================================================
  26990. ; loc_15A42:
  26991. Obj36_Upsidedown:
  26992. bsr.w MoveSpikes
  26993. moveq #0,d1
  26994. move.b width_pixels(a0),d1
  26995. addi.w #$B,d1
  26996. moveq #0,d2
  26997. move.b y_radius(a0),d2
  26998. move.w d2,d3
  26999. addq.w #1,d3
  27000. move.w x_pos(a0),d4
  27001. bsr.w SolidObject
  27002. swap d6
  27003. andi.w #touch_bottom_mask,d6 ; are Sonic or Tails touching the bottom?
  27004. beq.s Obj36_UpsidedownEnd ; if not, branch
  27005. move.b d6,d0
  27006. andi.b #p1_touch_bottom,d0 ; is Sonic touching the bottom?
  27007. beq.s + ; if not, branch
  27008. lea (MainCharacter).w,a1 ; a1=character
  27009. bsr.w Touch_ChkHurt2
  27010. +
  27011. andi.b #p2_touch_bottom,d6 ; is Tails touching the bottom?
  27012. beq.s Obj36_UpsidedownEnd ; if not, branch
  27013. lea (Sidekick).w,a1 ; a1=character
  27014. bsr.w Touch_ChkHurt2
  27015.  
  27016. ; loc_15A88:
  27017. Obj36_UpsidedownEnd:
  27018. move.w spikes_base_x_pos(a0),d0
  27019. bra.w MarkObjGone2
  27020.  
  27021. ; ---------------------------------------------------------------------------
  27022. ; Subroutine for checking if Sonic/Tails should be hurt and hurting them if so
  27023. ; unlike Touch_ChkHurt, the character is at a1 instead of a0
  27024. ; ---------------------------------------------------------------------------
  27025.  
  27026. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27027.  
  27028. Touch_ChkHurt2:
  27029. btst #status_sec_isInvincible,status_secondary(a1) ; is character invincible?
  27030. bne.s + ; rts ; if yes, branch
  27031. tst.w invulnerable_time(a1) ; is character invulnerable?
  27032. bne.s + ; rts ; if yes, branch
  27033. cmpi.b #4,routine(a1) ; is the character hurt, dieing, etc. ?
  27034. bhs.s + ; rts ; if yes, branch
  27035. move.l y_pos(a1),d3
  27036. move.w y_vel(a1),d0
  27037. ext.l d0
  27038. asl.l #8,d0
  27039. sub.l d0,d3
  27040. move.l d3,y_pos(a1)
  27041. movea.l a0,a2
  27042. movea.l a1,a0
  27043. jsr (HurtCharacter).l
  27044. movea.l a2,a0
  27045. +
  27046. rts
  27047. ; End of function Touch_ChkHurt2
  27048.  
  27049.  
  27050. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27051. ; handles direction, timing and movement of moving spikes
  27052.  
  27053. ; sub_15AC6:
  27054. MoveSpikes:
  27055. moveq #0,d0
  27056. move.b subtype(a0),d0
  27057. add.w d0,d0
  27058. move.w MoveSpikes_Behaviors(pc,d0.w),d1
  27059. jmp MoveSpikes_Behaviors(pc,d1.w)
  27060. ; End of function MoveSpikes
  27061.  
  27062. ; ===========================================================================
  27063. ; off_15AD6:
  27064. MoveSpikes_Behaviors: offsetTable
  27065. offsetTableEntry.w MoveSpikes_Still ; 0
  27066. offsetTableEntry.w MoveSpikes_Vertical ; 1
  27067. offsetTableEntry.w MoveSpikes_Horizontal ; 2
  27068. ; ===========================================================================
  27069. ; return_15ADC:
  27070. MoveSpikes_Still:
  27071. rts
  27072. ; ===========================================================================
  27073. ; loc_15ADE:
  27074. MoveSpikes_Vertical:
  27075. bsr.w MoveSpikes_Delay
  27076. moveq #0,d0
  27077. move.b spikes_retract_offset(a0),d0
  27078. add.w spikes_base_y_pos(a0),d0 ; apply offset to y-position
  27079. move.w d0,y_pos(a0)
  27080. rts
  27081. ; ===========================================================================
  27082. ; loc_15AF2:
  27083. MoveSpikes_Horizontal:
  27084. bsr.w MoveSpikes_Delay
  27085. moveq #0,d0
  27086. move.b spikes_retract_offset(a0),d0
  27087. add.w spikes_base_x_pos(a0),d0 ; apply offset to x-position
  27088. move.w d0,x_pos(a0)
  27089. rts
  27090.  
  27091. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27092.  
  27093. ; sub_15B06:
  27094. MoveSpikes_Delay:
  27095. tst.w spikes_retract_timer(a0) ; is it time for spikes to move again?
  27096. beq.s MoveSpikes_ChkDir ; if yes, branch
  27097. subq.w #1,spikes_retract_timer(a0) ; else, decrement timer
  27098. bne.s + ; rts ; branch, if timer didn't reach 0
  27099. tst.b render_flags(a0) ; are spikes on screen?
  27100. bpl.s + ; rts ; if not, branch
  27101. move.w #SndID_SpikesMove,d0 ; play spike movement sount
  27102. jsr (PlaySound).l
  27103. bra.s + ; rts
  27104. ; ===========================================================================
  27105. ; loc_15B24:
  27106. MoveSpikes_ChkDir:
  27107. tst.w spikes_retract_state(a0) ; do spikes need to move away from initial position?
  27108. beq.s MoveSpikes_Retract ; if yes, branch
  27109. subi.w #$800,spikes_retract_offset(a0) ; subtract 8 pixels from offset
  27110. bhs.s + ; rts ; branch, if offset is not yet 0
  27111. move.w #0,spikes_retract_offset(a0)
  27112. move.w #0,spikes_retract_state(a0) ; switch state
  27113. move.w #$3C,spikes_retract_timer(a0) ; reset timer
  27114. bra.s + ; rts
  27115. ; ===========================================================================
  27116. ; loc_15B46:
  27117. MoveSpikes_Retract:
  27118. addi.w #$800,spikes_retract_offset(a0) ; add 8 pixels to offset
  27119. cmpi.w #$2000,spikes_retract_offset(a0) ; is offset the width of one spike block (32 pixels)?
  27120. blo.s + ; rts ; if not, branch
  27121. move.w #$2000,spikes_retract_offset(a0)
  27122. move.w #1,spikes_retract_state(a0) ; switch state
  27123. move.w #$3C,spikes_retract_timer(a0) ; reset timer
  27124. +
  27125. rts
  27126. ; End of function MoveSpikes_Delay
  27127.  
  27128. ; ===========================================================================
  27129. ; -------------------------------------------------------------------------------
  27130. ; sprite mappings
  27131. ; -------------------------------------------------------------------------------
  27132. Obj36_MapUnc_15B68: BINCLUDE "mappings/sprite/obj36.bin"
  27133.  
  27134.  
  27135.  
  27136.  
  27137. ; ===========================================================================
  27138. ; ----------------------------------------------------------------------------
  27139. ; Object 3B - Purple rock (leftover from S1)
  27140. ; ----------------------------------------------------------------------------
  27141. ; Sprite_15CC8:
  27142. Obj3B:
  27143. moveq #0,d0
  27144. move.b routine(a0),d0
  27145. move.w Obj3B_Index(pc,d0.w),d1
  27146. jmp Obj3B_Index(pc,d1.w)
  27147. ; ===========================================================================
  27148. ; off_15CD6:
  27149. Obj3B_Index: offsetTable
  27150. offsetTableEntry.w Obj3B_Init ; 0
  27151. offsetTableEntry.w Obj3B_Main ; 2
  27152. ; ===========================================================================
  27153. ; loc_15CDA:
  27154. Obj3B_Init:
  27155. addq.b #2,routine(a0)
  27156. move.l #Obj3B_MapUnc_15D2E,mappings(a0)
  27157. move.w #make_art_tile(ArtTile_ArtNem_GHZ_Purple_Rock,3,0),art_tile(a0)
  27158. bsr.w Adjust2PArtPointer
  27159. move.b #4,render_flags(a0)
  27160. move.b #$13,width_pixels(a0)
  27161. move.b #4,priority(a0)
  27162. ; loc_15D02:
  27163. Obj3B_Main:
  27164. move.w #$1B,d1
  27165. move.w #$10,d2
  27166. move.w #$10,d3
  27167. move.w x_pos(a0),d4
  27168. bsr.w SolidObject
  27169. move.w x_pos(a0),d0
  27170. andi.w #$FF80,d0
  27171. sub.w (Camera_X_pos_coarse).w,d0
  27172. cmpi.w #$280,d0
  27173. bhi.w DeleteObject
  27174. bra.w DisplaySprite
  27175. ; ===========================================================================
  27176. ; -------------------------------------------------------------------------------
  27177. ; Unused sprite mappings
  27178. ; -------------------------------------------------------------------------------
  27179. Obj3B_MapUnc_15D2E: BINCLUDE "mappings/sprite/obj3B.bin"
  27180.  
  27181. if ~~removeJmpTos
  27182. align 4
  27183. endif
  27184. ; ===========================================================================
  27185. ; ----------------------------------------------------------------------------
  27186. ; Object 3C - Breakable wall (leftover from S1) (mostly unused)
  27187. ; ----------------------------------------------------------------------------
  27188. ; Sprite_15D44:
  27189. Obj3C:
  27190. moveq #0,d0
  27191. move.b routine(a0),d0
  27192. move.w Obj3C_Index(pc,d0.w),d1
  27193. jsr Obj3C_Index(pc,d1.w)
  27194. bra.w MarkObjGone
  27195. ; ===========================================================================
  27196. ; off_15D56:
  27197. Obj3C_Index: offsetTable
  27198. offsetTableEntry.w Obj3C_Init ; 0
  27199. offsetTableEntry.w Obj3C_Main ; 2
  27200. offsetTableEntry.w Obj3C_Fragment ; 4
  27201. ; ===========================================================================
  27202. ; loc_15D5C:
  27203. Obj3C_Init:
  27204. addq.b #2,routine(a0)
  27205. move.l #Obj3C_MapUnc_15ECC,mappings(a0)
  27206. move.w #make_art_tile(ArtTile_ArtNem_BreakWall,2,0),art_tile(a0)
  27207. bsr.w Adjust2PArtPointer
  27208. move.b #4,render_flags(a0)
  27209. move.b #$10,width_pixels(a0)
  27210. move.b #4,priority(a0)
  27211. move.b subtype(a0),mapping_frame(a0)
  27212. ; loc_15D8A:
  27213. Obj3C_Main:
  27214. move.w (MainCharacter+x_vel).w,objoff_30(a0)
  27215. move.w #$1B,d1
  27216. move.w #$20,d2
  27217. move.w #$20,d3
  27218. move.w x_pos(a0),d4
  27219. bsr.w SolidObject
  27220. btst #5,status(a0)
  27221. bne.s +
  27222. - rts
  27223. ; ===========================================================================
  27224. +
  27225. lea (MainCharacter).w,a1 ; a1=character
  27226. cmpi.b #2,anim(a1)
  27227. bne.s - ; rts
  27228. mvabs.w objoff_30(a0),d0
  27229. cmpi.w #$480,d0
  27230. blo.s - ; rts
  27231. move.w objoff_30(a0),x_vel(a1)
  27232. addq.w #4,x_pos(a1)
  27233. lea (Obj3C_FragmentSpeeds_LeftToRight).l,a4
  27234. move.w x_pos(a0),d0
  27235. cmp.w x_pos(a1),d0
  27236. blo.s +
  27237. subi_.w #8,x_pos(a1)
  27238. lea (Obj3C_FragmentSpeeds_RightToLeft).l,a4
  27239. +
  27240. move.w x_vel(a1),inertia(a1)
  27241. bclr #5,status(a0)
  27242. bclr #5,status(a1)
  27243. bsr.s BreakObjectToPieces
  27244. ; loc_15E02:
  27245. Obj3C_Fragment:
  27246. bsr.w ObjectMove
  27247. addi.w #$70,y_vel(a0)
  27248. tst.b render_flags(a0)
  27249. bpl.w DeleteObject
  27250. bra.w DisplaySprite
  27251.  
  27252. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27253.  
  27254. ; sub_15E18:
  27255. BreakObjectToPieces: ; splits up one object into its current mapping frame pieces
  27256. moveq #0,d0
  27257. move.b mapping_frame(a0),d0
  27258. add.w d0,d0
  27259. movea.l mappings(a0),a3
  27260. adda.w (a3,d0.w),a3 ; put address of appropriate frame to a3
  27261. move.w (a3)+,d1 ; amount of pieces the frame consists of
  27262. subq.w #1,d1
  27263. bset #5,render_flags(a0)
  27264. _move.b id(a0),d4
  27265. move.b render_flags(a0),d5
  27266. movea.l a0,a1
  27267. bra.s BreakObjectToPieces_InitObject
  27268. ; ===========================================================================
  27269. ; loc_15E3E:
  27270. BreakObjectToPieces_Loop:
  27271. bsr.w SingleObjLoad2
  27272. bne.s loc_15E82
  27273. addq.w #8,a3 ; next mapping piece
  27274. ; loc_15E46:
  27275. BreakObjectToPieces_InitObject:
  27276. move.b #4,routine(a1)
  27277. _move.b d4,id(a1) ; load object with ID of parent object and routine 4
  27278. move.l a3,mappings(a1)
  27279. move.b d5,render_flags(a1)
  27280. move.w x_pos(a0),x_pos(a1)
  27281. move.w y_pos(a0),y_pos(a1)
  27282. move.w art_tile(a0),art_tile(a1)
  27283. move.b priority(a0),priority(a1)
  27284. move.b width_pixels(a0),width_pixels(a1)
  27285. move.w (a4)+,x_vel(a1)
  27286. move.w (a4)+,y_vel(a1)
  27287. dbf d1,BreakObjectToPieces_Loop
  27288.  
  27289. loc_15E82:
  27290. move.w #SndID_SlowSmash,d0
  27291. jmp (PlaySound).l
  27292. ; End of function BreakObjectToPieces
  27293.  
  27294. ; ===========================================================================
  27295. ; word_15E8C:
  27296. Obj3C_FragmentSpeeds_LeftToRight:
  27297. ; x_vel,y_vel
  27298. dc.w $400,-$500 ; 0
  27299. dc.w $600,-$100 ; 2
  27300. dc.w $600, $100 ; 4
  27301. dc.w $400, $500 ; 6
  27302. dc.w $600,-$600 ; 8
  27303. dc.w $800,-$200 ; 10
  27304. dc.w $800, $200 ; 12
  27305. dc.w $600, $600 ; 14
  27306. ; word_15EAC:
  27307. Obj3C_FragmentSpeeds_RightToLeft:
  27308. dc.w -$600,-$600 ; 0
  27309. dc.w -$800,-$200 ; 2
  27310. dc.w -$800, $200 ; 4
  27311. dc.w -$600, $600 ; 6
  27312. dc.w -$400,-$500 ; 8
  27313. dc.w -$600,-$100 ; 10
  27314. dc.w -$600, $100 ; 12
  27315. dc.w -$400, $500 ; 14
  27316. ; -------------------------------------------------------------------------------
  27317. ; Unused sprite mappings
  27318. ; -------------------------------------------------------------------------------
  27319. Obj3C_MapUnc_15ECC: BINCLUDE "mappings/sprite/obj3C.bin"
  27320. ; ===========================================================================
  27321. bra.w ObjNull
  27322.  
  27323.  
  27324.  
  27325.  
  27326. ; -------------------------------------------------------------------------------
  27327. ; This runs the code of all the objects that are in Object_RAM
  27328. ; -------------------------------------------------------------------------------
  27329.  
  27330. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27331.  
  27332. ; sub_15F9C: ObjectsLoad:
  27333. RunObjects:
  27334. tst.b (Teleport_flag).w
  27335. bne.s RunObjects_End ; rts
  27336. lea (Object_RAM).w,a0 ; a0=object
  27337.  
  27338. moveq #(Dynamic_Object_RAM_End-Object_RAM)/object_size-1,d7 ; run the first $80 objects out of levels
  27339. moveq #0,d0
  27340. cmpi.b #GameModeID_Demo,(Game_Mode).w ; demo mode?
  27341. beq.s + ; if in a level in a demo, branch
  27342. cmpi.b #GameModeID_Level,(Game_Mode).w ; regular level mode?
  27343. bne.s RunObject ; if not in a level, branch to RunObject
  27344. +
  27345. move.w #(Object_RAM_End-Object_RAM)/object_size-1,d7 ; run the first $90 objects in levels
  27346. tst.w (Two_player_mode).w
  27347. bne.s RunObject ; if in 2 player competition mode, branch to RunObject
  27348.  
  27349. cmpi.b #6,(MainCharacter+routine).w
  27350. bhs.s RunObjectsWhenPlayerIsDead ; if dead, branch
  27351. ; continue straight to RunObject
  27352. ; ---------------------------------------------------------------------------
  27353.  
  27354. ; -------------------------------------------------------------------------------
  27355. ; This is THE place where each individual object's code gets called from
  27356. ; -------------------------------------------------------------------------------
  27357.  
  27358. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27359.  
  27360. ; sub_15FCC:
  27361. RunObject:
  27362. move.b id(a0),d0 ; get the object's ID
  27363. beq.s RunNextObject ; if it's obj00, skip it
  27364.  
  27365. add.w d0,d0
  27366. add.w d0,d0 ; d0 = object ID * 4
  27367. movea.l Obj_Index-4(pc,d0.w),a1 ; load the address of the object's code
  27368. jsr (a1) ; dynamic call! to one of the the entries in Obj_Index
  27369. moveq #0,d0
  27370.  
  27371. ; loc_15FDC:
  27372. RunNextObject:
  27373. lea next_object(a0),a0 ; load 0bj address
  27374. dbf d7,RunObject
  27375. ; return_15FE4:
  27376. RunObjects_End:
  27377. rts
  27378.  
  27379. ; ---------------------------------------------------------------------------
  27380. ; this skips certain objects to make enemies and things pause when Sonic dies
  27381. ; loc_15FE6:
  27382. RunObjectsWhenPlayerIsDead:
  27383. moveq #(Reserved_Object_RAM_End-Reserved_Object_RAM)/object_size-1,d7
  27384. bsr.s RunObject ; run the first $10 objects normally
  27385. moveq #(Dynamic_Object_RAM_End-Dynamic_Object_RAM)/object_size-1,d7
  27386. bsr.s RunObjectDisplayOnly ; all objects in this range are paused
  27387. moveq #(LevelOnly_Object_RAM_End-LevelOnly_Object_RAM)/object_size-1,d7
  27388. bra.s RunObject ; run the last $10 objects normally
  27389.  
  27390. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27391.  
  27392. ; sub_15FF2:
  27393. RunObjectDisplayOnly:
  27394. moveq #0,d0
  27395. move.b id(a0),d0 ; get the object's ID
  27396. beq.s + ; if it's obj00, skip it
  27397. tst.b render_flags(a0) ; should we render it?
  27398. bpl.s + ; if not, skip it
  27399. bsr.w DisplaySprite
  27400. +
  27401. lea next_object(a0),a0 ; load 0bj address
  27402. dbf d7,RunObjectDisplayOnly
  27403. rts
  27404. ; End of function RunObjectDisplayOnly
  27405.  
  27406. ; ===========================================================================
  27407. ; ---------------------------------------------------------------------------
  27408. ; OBJECT POINTER ARRAY ; object pointers ; sprite pointers ; object list ; sprite list
  27409. ;
  27410. ; This array contains the pointers to all the objects used in the game.
  27411. ; ---------------------------------------------------------------------------
  27412. Obj_Index: ; ObjPtrs: ; loc_1600C:
  27413. ObjPtr_Sonic: dc.l Obj01 ; Sonic
  27414. ObjPtr_Tails: dc.l Obj02 ; Tails
  27415. ObjPtr_PlaneSwitcher: dc.l Obj03 ; Collision plane/layer switcher
  27416. ObjPtr_WaterSurface: dc.l Obj04 ; Surface of the water
  27417. ObjPtr_TailsTails: dc.l Obj05 ; Tails' tails
  27418. ObjPtr_Spiral: dc.l Obj06 ; Rotating cylinder in MTZ, twisting spiral pathway in EHZ
  27419. ObjPtr_Oil: dc.l Obj07 ; Oil in OOZ
  27420. ObjPtr_SpindashDust:
  27421. ObjPtr_Splash: dc.l Obj08 ; Water splash in Aquatic Ruin Zone, Spindash dust
  27422. ObjPtr_SonicSS: dc.l Obj09 ; Sonic in Special Stage
  27423. ObjPtr_SmallBubbles: dc.l Obj0A ; Small bubbles from Sonic's face while underwater
  27424. ObjPtr_TippingFloor: dc.l Obj0B ; Section of pipe that tips you off from CPZ
  27425. dc.l Obj0C ; Small floating platform (unused)
  27426. ObjPtr_Signpost: dc.l Obj0D ; End of level signpost
  27427. ObjPtr_IntroStars: dc.l Obj0E ; Flashing stars from intro
  27428. ObjPtr_TitleMenu: dc.l Obj0F ; Title screen menu
  27429. ObjPtr_TailsSS: dc.l Obj10 ; Tails in Special Stage
  27430. ObjPtr_Bridge: dc.l Obj11 ; Bridge in Emerald Hill Zone and Hidden Palace Zone
  27431. ObjPtr_HPZEmerald: dc.l Obj12 ; Emerald from Hidden Palace Zone (unused)
  27432. ObjPtr_HPZWaterfall: dc.l Obj13 ; Waterfall in Hidden Palace Zone (unused)
  27433. ObjPtr_Seesaw: dc.l Obj14 ; Seesaw from Hill Top Zone
  27434. ObjPtr_SwingingPlatform:dc.l Obj15 ; Swinging platform from Aquatic Ruin Zone
  27435. ObjPtr_HTZLift: dc.l Obj16 ; Diagonally moving lift from HTZ
  27436. dc.l Obj17 ; GHZ rotating log helix spikes (from Sonic 1, unused)
  27437. ObjPtr_ARZPlatform:
  27438. ObjPtr_EHZPlatform: dc.l Obj18 ; Stationary floating platform from ARZ and EHZ
  27439. ObjPtr_CPZPlatform:
  27440. ObjPtr_OOZMovingPform:
  27441. ObjPtr_WFZPlatform: dc.l Obj19 ; Platform from CPZ, OOZ and WFZ
  27442. ObjPtr_HPZCollapsPform: dc.l Obj1A ; Collapsing platform from HPZ (and GHZ)
  27443. ObjPtr_SpeedBooster: dc.l Obj1B ; Speed booster from from CPZ
  27444. ObjPtr_Scenery:
  27445. ObjPtr_BridgeStake:
  27446. ObjPtr_FallingOil: dc.l Obj1C ; Bridge stake in Emerald Hill Zone and Hill Top Zone, falling oil in Oil Ocean Zone
  27447. ObjPtr_BlueBalls: dc.l Obj1D ; Blue balls in CPZ (jumping droplets hazard)
  27448. ObjPtr_CPZSpinTube: dc.l Obj1E ; Spin tube from CPZ
  27449. ObjPtr_CollapsPform: dc.l Obj1F ; Collapsing platform from ARZ, MCZ and OOZ (and MZ, SLZ and SBZ)
  27450. ObjPtr_LavaBubble: dc.l Obj20 ; Lava bubble from Hill Top Zone (boss weapon)
  27451. ObjPtr_HUD: dc.l Obj21 ; Score/Rings/Time display (HUD)
  27452. ObjPtr_ArrowShooter: dc.l Obj22 ; Arrow shooter from ARZ
  27453. ObjPtr_FallingPillar: dc.l Obj23 ; Pillar that drops its lower part from ARZ
  27454. ObjPtr_ARZBubbles: dc.l Obj24 ; Bubbles in Aquatic Ruin Zone
  27455. ObjPtr_Ring: dc.l Obj25 ; A ring
  27456. ObjPtr_Monitor: dc.l Obj26 ; Monitor
  27457. ObjPtr_Explosion: dc.l Obj27 ; An explosion, giving off an animal and 100 points
  27458. ObjPtr_Animal: dc.l Obj28 ; Animal and the 100 points from a badnik
  27459. ObjPtr_Points: dc.l Obj29 ; "100 points" text
  27460. ObjPtr_Stomper: dc.l Obj2A ; Stomper from MCZ
  27461. ObjPtr_RisingPillar: dc.l Obj2B ; Rising pillar from ARZ
  27462. ObjPtr_LeavesGenerator: dc.l Obj2C ; Sprite that makes leaves fly off when you hit it from ARZ
  27463. ObjPtr_Barrier: dc.l Obj2D ; One way barrier from CPZ and DEZ
  27464. ObjPtr_MonitorContents: dc.l Obj2E ; Monitor contents (code for power-up behavior and rising image)
  27465. ObjPtr_SmashableGround: dc.l Obj2F ; Smashable ground in Hill Top Zone
  27466. ObjPtr_RisingLava: dc.l Obj30 ; Large rising lava during earthquake in HTZ
  27467. ObjPtr_LavaMarker: dc.l Obj31 ; Lava collision marker
  27468. ObjPtr_BreakableBlock:
  27469. ObjPtr_BreakableRock: dc.l Obj32 ; Breakable block/rock from CPZ and HTZ
  27470. ObjPtr_OOZPoppingPform: dc.l Obj33 ; Green platform from OOZ
  27471. ObjPtr_TitleCard: dc.l Obj34 ; level title card (screen with red, yellow, and blue)
  27472. ObjPtr_InvStars: dc.l Obj35 ; Invincibility Stars
  27473. ObjPtr_Spikes: dc.l Obj36 ; Vertical spikes
  27474. ObjPtr_LostRings: dc.l Obj37 ; Scattering rings (generated when Sonic is hurt and has rings)
  27475. ObjPtr_Shield: dc.l Obj38 ; Shield
  27476. ObjPtr_GameOver:
  27477. ObjPtr_TimeOver: dc.l Obj39 ; Game/Time Over text
  27478. ObjPtr_Results: dc.l Obj3A ; End of level results screen
  27479. dc.l Obj3B ; Purple rock (from Sonic 1, unused)
  27480. dc.l Obj3C ; Breakable wall (leftover from S1) (mostly unused)
  27481. ObjPtr_OOZLauncher: dc.l Obj3D ; Block thingy in OOZ that launches you into the round ball things
  27482. ObjPtr_EggPrison: dc.l Obj3E ; Egg prison
  27483. ObjPtr_Fan: dc.l Obj3F ; Fan from OOZ
  27484. ObjPtr_Springboard: dc.l Obj40 ; Pressure spring from CPZ, ARZ, and MCZ (the red "diving board" springboard)
  27485. ObjPtr_Spring: dc.l Obj41 ; Spring
  27486. ObjPtr_SteamSpring: dc.l Obj42 ; Steam Spring from MTZ
  27487. ObjPtr_SlidingSpike: dc.l Obj43 ; Sliding spike obstacle thing from OOZ
  27488. ObjPtr_RoundBumper: dc.l Obj44 ; Round bumper from Casino Night Zone
  27489. ObjPtr_OOZSpring: dc.l Obj45 ; Pressure spring from OOZ
  27490. ObjPtr_OOZBall: dc.l Obj46 ; Ball from OOZ (unused, beta leftover)
  27491. ObjPtr_Button: dc.l Obj47 ; Button
  27492. ObjPtr_LauncherBall: dc.l Obj48 ; Round ball thing from OOZ that fires you off in a different direction
  27493. ObjPtr_EHZWaterfall: dc.l Obj49 ; Waterfall from EHZ
  27494. ObjPtr_Octus: dc.l Obj4A ; Octus (octopus badnik) from OOZ
  27495. ObjPtr_Buzzer: dc.l Obj4B ; Buzzer (Buzz bomber) from EHZ
  27496. dc.l ObjNull ; Obj4C
  27497. dc.l ObjNull ; Obj4D
  27498. dc.l ObjNull ; Obj4E
  27499. dc.l ObjNull ; Obj4F
  27500. ObjPtr_Aquis: dc.l Obj50 ; Aquis (seahorse badnik) from OOZ
  27501. ObjPtr_CNZBoss: dc.l Obj51 ; CNZ boss
  27502. ObjPtr_HTZBoss: dc.l Obj52 ; HTZ boss
  27503. ObjPtr_MTZBossOrb: dc.l Obj53 ; Shield orbs that surround MTZ boss
  27504. ObjPtr_MTZBoss: dc.l Obj54 ; MTZ boss
  27505. ObjPtr_OOZBoss: dc.l Obj55 ; OOZ boss
  27506. ObjPtr_EHZBoss: dc.l Obj56 ; EHZ boss
  27507. ObjPtr_MCZBoss: dc.l Obj57 ; MCZ boss
  27508. ObjPtr_BossExplosion: dc.l Obj58 ; Boss explosion
  27509. ObjPtr_SSEmerald: dc.l Obj59 ; Emerald from Special Stage
  27510. ObjPtr_SSMessage: dc.l Obj5A ; Messages/checkpoint from Special Stage
  27511. ObjPtr_SSRingSpill: dc.l Obj5B ; Ring spray/spill in Special Stage
  27512. ObjPtr_Masher: dc.l Obj5C ; Masher (jumping piranha fish badnik) from EHZ
  27513. ObjPtr_CPZBoss: dc.l Obj5D ; CPZ boss
  27514. ObjPtr_SSHUD: dc.l Obj5E ; HUD from Special Stage
  27515. ObjPtr_StartBanner:
  27516. ObjPtr_EndingController:dc.l Obj5F ; Start banner/"Ending controller" from Special Stage
  27517. ObjPtr_SSRing: dc.l Obj60 ; Rings from Special Stage
  27518. ObjPtr_SSBomb: dc.l Obj61 ; Bombs from Special Stage
  27519. dc.l ObjNull ; Obj62
  27520. ObjPtr_SSShadow: dc.l Obj63 ; Character shadow from Special Stage
  27521. ObjPtr_MTZTwinStompers: dc.l Obj64 ; Twin stompers from MTZ
  27522. ObjPtr_MTZLongPlatform: dc.l Obj65 ; Long moving platform from MTZ
  27523. ObjPtr_MTZSpringWall: dc.l Obj66 ; Yellow spring walls from MTZ
  27524. ObjPtr_MTZSpinTube: dc.l Obj67 ; Spin tube from MTZ
  27525. ObjPtr_SpikyBlock: dc.l Obj68 ; Block with a spike that comes out of each side sequentially from MTZ
  27526. ObjPtr_Nut: dc.l Obj69 ; Nut from MTZ
  27527. ObjPtr_MCZRotPforms:
  27528. ObjPtr_MTZMovingPforms: dc.l Obj6A ; Platform that moves when you walk off of it, from MTZ
  27529. ObjPtr_MTZPlatform:
  27530. ObjPtr_CPZSquarePform: dc.l Obj6B ; Immobile platform from MTZ
  27531. ObjPtr_Conveyor: dc.l Obj6C ; Small platform on pulleys (like at the start of MTZ2)
  27532. ObjPtr_FloorSpike: dc.l Obj6D ; Floor spike from MTZ
  27533. ObjPtr_LargeRotPform: dc.l Obj6E ; Platform moving in a circle (like at the start of MTZ3)
  27534. ObjPtr_SSResults: dc.l Obj6F ; End of special stage results screen
  27535. ObjPtr_Cog: dc.l Obj70 ; Giant rotating cog from MTZ
  27536. ObjPtr_MTZLavaBubble:
  27537. ObjPtr_HPZBridgeStake:
  27538. ObjPtr_PulsingOrb: dc.l Obj71 ; Bridge stake and pulsing orb from Hidden Palace Zone
  27539. ObjPtr_CNZConveyorBelt: dc.l Obj72 ; Conveyor belt from CNZ
  27540. ObjPtr_RotatingRings: dc.l Obj73 ; Solid rotating ring thing from Mystic Cave Zone (mostly unused)
  27541. ObjPtr_InvisibleBlock: dc.l Obj74 ; Invisible solid block
  27542. ObjPtr_MCZBrick: dc.l Obj75 ; Brick from MCZ
  27543. ObjPtr_SlidingSpikes: dc.l Obj76 ; Spike block that slides out of the wall from MCZ
  27544. ObjPtr_MCZBridge: dc.l Obj77 ; Bridge from MCZ
  27545. ObjPtr_CPZStaircase: dc.l Obj78 ; Stairs from CPZ that move down to open the way
  27546. ObjPtr_Starpost: dc.l Obj79 ; Star pole / starpost / checkpoint
  27547. ObjPtr_SidewaysPform: dc.l Obj7A ; Platform that moves back and fourth on top of water in CPZ
  27548. ObjPtr_PipeExitSpring: dc.l Obj7B ; Warp pipe exit spring from CPZ
  27549. ObjPtr_CPZPylon: dc.l Obj7C ; Big pylon in foreground of CPZ
  27550. dc.l Obj7D ; Points that can be gotten at the end of an act (unused leftover from S1)
  27551. ObjPtr_SuperSonicStars: dc.l Obj7E ; Super Sonic's stars
  27552. ObjPtr_VineSwitch: dc.l Obj7F ; Vine switch that you hang off in MCZ
  27553. ObjPtr_MovingVine: dc.l Obj80 ; Vine that you hang off and it moves down from MCZ
  27554. ObjPtr_MCZDrawbridge: dc.l Obj81 ; Long invisible vertical barrier
  27555. ObjPtr_SwingingPform: dc.l Obj82 ; Platform that is usually swinging, from ARZ
  27556. ObjPtr_ARZRotPforms: dc.l Obj83 ; 3 adjoined platforms from ARZ that rotate in a circle
  27557. ObjPtr_ForcedSpin:
  27558. ObjPtr_PinballMode: dc.l Obj84 ; Pinball mode enable/disable (CNZ)
  27559. ObjPtr_LauncherSpring: dc.l Obj85 ; Spring from CNZ that you hold jump on to pull back further
  27560. ObjPtr_Flipper: dc.l Obj86 ; Flipper from CNZ
  27561. ObjPtr_SSNumberOfRings: dc.l Obj87 ; Number of rings in Special Stage
  27562. ObjPtr_SSTailsTails: dc.l Obj88 ; Tails' tails in Special Stage
  27563. ObjPtr_ARZBoss: dc.l Obj89 ; ARZ boss
  27564. dc.l Obj8A ; Sonic Team Presents/Credits (seemingly unused leftover from S1)
  27565. ObjPtr_WFZPalSwitcher: dc.l Obj8B ; Cycling palette switcher from Wing Fortress Zone
  27566. ObjPtr_Whisp: dc.l Obj8C ; Whisp (blowfly badnik) from ARZ
  27567. ObjPtr_GrounderInWall: dc.l Obj8D ; Grounder in wall, from ARZ
  27568. ObjPtr_GrounderInWall2: dc.l Obj8D ; Obj8E = Obj8D
  27569. ObjPtr_GrounderWall: dc.l Obj8F ; Wall behind which Grounder hides, from ARZ
  27570. ObjPtr_GrounderRocks: dc.l Obj90 ; Rocks thrown by Grounder behind wall, from ARZ
  27571. ObjPtr_ChopChop: dc.l Obj91 ; Chop Chop (piranha/shark badnik) from ARZ
  27572. ObjPtr_Spiker: dc.l Obj92 ; Spiker (drill badnik) from HTZ
  27573. ObjPtr_SpikerDrill: dc.l Obj93 ; Drill thrown by Spiker from HTZ
  27574. ObjPtr_Rexon: dc.l Obj94 ; Rexon (lava snake badnik), from HTZ
  27575. ObjPtr_Sol: dc.l Obj95 ; Sol (fireball-throwing orbit badnik) from HTZ
  27576. ObjPtr_Rexon2: dc.l Obj94 ; Obj96 = Obj94
  27577. ObjPtr_RexonHead: dc.l Obj97 ; Rexon's head, from HTZ
  27578. ObjPtr_Projectile: dc.l Obj98 ; Projectile with optional gravity (EHZ coconut, CPZ spiny, etc.)
  27579. ObjPtr_Nebula: dc.l Obj99 ; Nebula (bomber badnik) from SCZ
  27580. ObjPtr_Turtloid: dc.l Obj9A ; Turtloid (turtle badnik) from Sky Chase Zone
  27581. ObjPtr_TurtloidRider: dc.l Obj9B ; Turtloid rider from Sky Chase Zone
  27582. ObjPtr_BalkiryJet: dc.l Obj9C ; Balkiry's jet from Sky Chase Zone
  27583. ObjPtr_Coconuts: dc.l Obj9D ; Coconuts (monkey badnik) from EHZ
  27584. ObjPtr_Crawlton: dc.l Obj9E ; Crawlton (snake badnik) from MCZ
  27585. ObjPtr_Shellcracker: dc.l Obj9F ; Shellcraker (crab badnik) from MTZ
  27586. ObjPtr_ShellcrackerClaw:dc.l ObjA0 ; Shellcracker's claw from MTZ
  27587. ObjPtr_Slicer: dc.l ObjA1 ; Slicer (praying mantis dude) from MTZ
  27588. ObjPtr_SlicerPincers: dc.l ObjA2 ; Slicer's pincers from MTZ
  27589. ObjPtr_Flasher: dc.l ObjA3 ; Flasher (firefly/glowbug badnik) from MCZ
  27590. ObjPtr_Asteron: dc.l ObjA4 ; Asteron (exploding starfish badnik) from MTZ
  27591. ObjPtr_Spiny: dc.l ObjA5 ; Spiny (crawling badnik) from CPZ
  27592. ObjPtr_SpinyOnWall: dc.l ObjA6 ; Spiny (on wall) from CPZ
  27593. ObjPtr_Grabber: dc.l ObjA7 ; Grabber (spider badnik) from CPZ
  27594. ObjPtr_GrabberLegs: dc.l ObjA8 ; Grabber's legs from CPZ
  27595. ObjPtr_GrabberBox: dc.l ObjA9 ; The little hanger box thing a Grabber's string comes out of
  27596. ObjPtr_GrabberString: dc.l ObjAA ; The thin white string a Grabber hangs from
  27597. dc.l ObjAB ; Unknown (maybe unused?)
  27598. ObjPtr_Balkiry: dc.l ObjAC ; Balkiry (jet badnik) from SCZ
  27599. ObjPtr_CluckerBase: dc.l ObjAD ; Clucker's base from WFZ
  27600. ObjPtr_Clucker: dc.l ObjAE ; Clucker (chicken badnik) from WFZ
  27601. ObjPtr_MechaSonic: dc.l ObjAF ; Mecha Sonic / Silver Sonic from DEZ
  27602. ObjPtr_SonicOnSegaScr: dc.l ObjB0 ; Sonic on the Sega screen
  27603. ObjPtr_SegaHideTM: dc.l ObjB1 ; Object that hides TM symbol on JP region
  27604. ObjPtr_Tornado: dc.l ObjB2 ; The Tornado (Tails' plane)
  27605. ObjPtr_Cloud: dc.l ObjB3 ; Clouds (placeable object) from SCZ
  27606. ObjPtr_VPropeller: dc.l ObjB4 ; Vertical propeller from WFZ
  27607. ObjPtr_HPropeller: dc.l ObjB5 ; Horizontal propeller from WFZ
  27608. ObjPtr_TiltingPlatform: dc.l ObjB6 ; Tilting platform from WFZ
  27609. ObjPtr_VerticalLaser: dc.l ObjB7 ; Unused huge vertical laser from WFZ
  27610. ObjPtr_WallTurret: dc.l ObjB8 ; Wall turret from WFZ
  27611. ObjPtr_Laser: dc.l ObjB9 ; Laser from WFZ that shoots down the Tornado
  27612. ObjPtr_WFZWheel: dc.l ObjBA ; Wheel from WFZ
  27613. dc.l ObjBB ; Unknown
  27614. ObjPtr_WFZShipFire: dc.l ObjBC ; Fire coming out of Robotnik's ship in WFZ
  27615. ObjPtr_SmallMetalPform: dc.l ObjBD ; Ascending/descending metal platforms from WFZ
  27616. ObjPtr_LateralCannon: dc.l ObjBE ; Lateral cannon (temporary platform that pops in/out) from WFZ
  27617. ObjPtr_WFZStick: dc.l ObjBF ; Rotaty-stick badnik from WFZ
  27618. ObjPtr_SpeedLauncher: dc.l ObjC0 ; Speed launcher from WFZ
  27619. ObjPtr_BreakablePlating:dc.l ObjC1 ; Breakable plating from WFZ / what sonic hangs onto on the back of Robotnic's getaway ship
  27620. ObjPtr_Rivet: dc.l ObjC2 ; Rivet thing you bust to get into ship at the end of WFZ
  27621. ObjPtr_TornadoSmoke: dc.l ObjC3 ; Plane's smoke from WFZ
  27622. ObjPtr_TornadoSmoke2: dc.l ObjC3 ; ObjC4 = ObjC3
  27623. ObjPtr_WFZBoss: dc.l ObjC5 ; WFZ boss
  27624. ObjPtr_Eggman: dc.l ObjC6 ; Eggman
  27625. ObjPtr_Eggrobo: dc.l ObjC7 ; Eggrobo (final boss) from Death Egg
  27626. ObjPtr_Crawl: dc.l ObjC8 ; Crawl (shield badnik) from CNZ
  27627. ObjPtr_TtlScrPalChanger:dc.l ObjC9 ; "Palette changing handler" from title screen
  27628. ObjPtr_CutScene: dc.l ObjCA ; Cut scene at end of game
  27629. ObjPtr_EndingSeqClouds: dc.l ObjCB ; Background clouds from ending sequence
  27630. ObjPtr_EndingSeqTrigger:dc.l ObjCC ; Trigger for rescue plane and birds from ending sequence
  27631. ObjPtr_EndingSeqBird: dc.l ObjCD ; Birds from ending sequence
  27632. ObjPtr_EndingSeqSonic:
  27633. ObjPtr_EndingSeqTails: dc.l ObjCE ; Sonic and Tails jumping off the plane from ending sequence
  27634. ObjPtr_TornadoHelixes: dc.l ObjCF ;"Plane's helixes" from ending sequence
  27635. dc.l ObjNull ; ObjD0
  27636. dc.l ObjNull ; ObjD1
  27637. ObjPtr_CNZRectBlocks: dc.l ObjD2 ; Flashing blocks that appear and disappear in a rectangular shape that you can walk across, from CNZ
  27638. ObjPtr_BombPrize: dc.l ObjD3 ; Bomb prize from CNZ
  27639. ObjPtr_CNZBigBlock: dc.l ObjD4 ; Big block from CNZ that moves back and fourth
  27640. ObjPtr_Elevator: dc.l ObjD5 ; Elevator from CNZ
  27641. ObjPtr_PointPokey: dc.l ObjD6 ; Pokey that gives out points from CNZ
  27642. ObjPtr_Bumper: dc.l ObjD7 ; Bumper from Casino Night Zone
  27643. ObjPtr_BonusBlock: dc.l ObjD8 ; Block thingy from CNZ that disappears after 3 hits
  27644. ObjPtr_Grab: dc.l ObjD9 ; Invisible sprite that you can hang on to, like the blocks in WFZ
  27645. ObjPtr_ContinueText:
  27646. ObjPtr_ContinueIcons: dc.l ObjDA ; Continue text
  27647. ObjPtr_ContinueChars: dc.l ObjDB ; Sonic lying down or Tails nagging (continue screen)
  27648. ObjPtr_RingPrize: dc.l ObjDC ; Ring prize from Casino Night Zone
  27649. ; ===========================================================================
  27650. ; ----------------------------------------------------------------------------
  27651. ; Object 4C, 4D, 4E, 4F, 62, D0, and D1
  27652.  
  27653. ; Object removed from the game. All it does is deallocate its array.
  27654. ; ----------------------------------------------------------------------------
  27655.  
  27656. ObjNull: ;;
  27657. bra.w DeleteObject
  27658.  
  27659. ; ---------------------------------------------------------------------------
  27660. ; Subroutine to make an object move and fall downward increasingly fast
  27661. ; This moves the object horizontally and vertically
  27662. ; and also applies gravity to its speed
  27663. ; ---------------------------------------------------------------------------
  27664.  
  27665. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27666.  
  27667. ; sub_16380: ObjectFall:
  27668. ObjectMoveAndFall:
  27669. move.l x_pos(a0),d2 ; load x position
  27670. move.l y_pos(a0),d3 ; load y position
  27671. move.w x_vel(a0),d0 ; load x speed
  27672. ext.l d0
  27673. asl.l #8,d0 ; shift velocity to line up with the middle 16 bits of the 32-bit position
  27674. add.l d0,d2 ; add x speed to x position ; note this affects the subpixel position x_sub(a0) = 2+x_pos(a0)
  27675. move.w y_vel(a0),d0 ; load y speed
  27676. addi.w #$38,y_vel(a0) ; increase vertical speed (apply gravity)
  27677. ext.l d0
  27678. asl.l #8,d0 ; shift velocity to line up with the middle 16 bits of the 32-bit position
  27679. add.l d0,d3 ; add old y speed to y position ; note this affects the subpixel position y_sub(a0) = 2+y_pos(a0)
  27680. move.l d2,x_pos(a0) ; store new x position
  27681. move.l d3,y_pos(a0) ; store new y position
  27682. rts
  27683. ; End of function ObjectMoveAndFall
  27684. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  27685.  
  27686. ; ---------------------------------------------------------------------------
  27687. ; Subroutine translating object speed to update object position
  27688. ; This moves the object horizontally and vertically
  27689. ; but does not apply gravity to it
  27690. ; ---------------------------------------------------------------------------
  27691.  
  27692. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27693.  
  27694. ; sub_163AC: SpeedToPos:
  27695. ObjectMove:
  27696. move.l x_pos(a0),d2 ; load x position
  27697. move.l y_pos(a0),d3 ; load y position
  27698. move.w x_vel(a0),d0 ; load horizontal speed
  27699. ext.l d0
  27700. asl.l #8,d0 ; shift velocity to line up with the middle 16 bits of the 32-bit position
  27701. add.l d0,d2 ; add to x-axis position ; note this affects the subpixel position x_sub(a0) = 2+x_pos(a0)
  27702. move.w y_vel(a0),d0 ; load vertical speed
  27703. ext.l d0
  27704. asl.l #8,d0 ; shift velocity to line up with the middle 16 bits of the 32-bit position
  27705. add.l d0,d3 ; add to y-axis position ; note this affects the subpixel position y_sub(a0) = 2+y_pos(a0)
  27706. move.l d2,x_pos(a0) ; update x-axis position
  27707. move.l d3,y_pos(a0) ; update y-axis position
  27708. rts
  27709. ; End of function ObjectMove
  27710. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  27711.  
  27712. ; ---------------------------------------------------------------------------
  27713. ; Routines to mark an enemy/monitor/ring/platform as destroyed
  27714. ; ---------------------------------------------------------------------------
  27715.  
  27716. ; ===========================================================================
  27717. ; input: a0 = the object
  27718. ; loc_163D2:
  27719. MarkObjGone:
  27720. tst.w (Two_player_mode).w ; is it two player mode?
  27721. beq.s + ; if not, branch
  27722. bra.w DisplaySprite
  27723. +
  27724. move.w x_pos(a0),d0
  27725. andi.w #$FF80,d0
  27726. sub.w (Camera_X_pos_coarse).w,d0
  27727. cmpi.w #$80+320+$40+$80,d0 ; This gives an object $80 pixels of room offscreen before being unloaded (the $40 is there to round up 320 to a multiple of $80)
  27728. bhi.w +
  27729. bra.w DisplaySprite
  27730.  
  27731. + lea (Object_Respawn_Table).w,a2
  27732. moveq #0,d0
  27733. move.b respawn_index(a0),d0
  27734. beq.s +
  27735. bclr #7,2(a2,d0.w)
  27736. +
  27737. bra.w DeleteObject
  27738. ; ===========================================================================
  27739. ; input: d0 = the object's x position
  27740. ; loc_1640A:
  27741. MarkObjGone2:
  27742. tst.w (Two_player_mode).w
  27743. beq.s +
  27744. bra.w DisplaySprite
  27745. +
  27746. andi.w #$FF80,d0
  27747. sub.w (Camera_X_pos_coarse).w,d0
  27748. cmpi.w #$80+320+$40+$80,d0 ; This gives an object $80 pixels of room offscreen before being unloaded (the $40 is there to round up 320 to a multiple of $80)
  27749. bhi.w +
  27750. bra.w DisplaySprite
  27751. +
  27752. lea (Object_Respawn_Table).w,a2
  27753. moveq #0,d0
  27754. move.b respawn_index(a0),d0
  27755. beq.s +
  27756. bclr #7,2(a2,d0.w)
  27757. +
  27758. bra.w DeleteObject
  27759. ; ===========================================================================
  27760. ; input: a0 = the object
  27761. ; does nothing instead of calling DisplaySprite in the case of no deletion
  27762. ; loc_1643E:
  27763. MarkObjGone3:
  27764. tst.w (Two_player_mode).w
  27765. beq.s +
  27766. rts
  27767. +
  27768. move.w x_pos(a0),d0
  27769. andi.w #$FF80,d0
  27770. sub.w (Camera_X_pos_coarse).w,d0
  27771. cmpi.w #$80+320+$40+$80,d0 ; This gives an object $80 pixels of room offscreen before being unloaded (the $40 is there to round up 320 to a multiple of $80)
  27772. bhi.w +
  27773. rts
  27774. +
  27775. lea (Object_Respawn_Table).w,a2
  27776. moveq #0,d0
  27777. move.b respawn_index(a0),d0
  27778. beq.s +
  27779. bclr #7,2(a2,d0.w)
  27780. +
  27781. bra.w DeleteObject
  27782. ; ===========================================================================
  27783. ; input: a0 = the object
  27784. ; loc_16472:
  27785. MarkObjGone_P1:
  27786. tst.w (Two_player_mode).w
  27787. bne.s MarkObjGone_P2
  27788. move.w x_pos(a0),d0
  27789. andi.w #$FF80,d0
  27790. sub.w (Camera_X_pos_coarse).w,d0
  27791. cmpi.w #$80+320+$40+$80,d0 ; This gives an object $80 pixels of room offscreen before being unloaded (the $40 is there to round up 320 to a multiple of $80)
  27792. bhi.w +
  27793. bra.w DisplaySprite
  27794. +
  27795. lea (Object_Respawn_Table).w,a2
  27796. moveq #0,d0
  27797. move.b respawn_index(a0),d0
  27798. beq.s +
  27799. bclr #7,2(a2,d0.w)
  27800. +
  27801. bra.w DeleteObject
  27802. ; ---------------------------------------------------------------------------
  27803. ; input: a0 = the object
  27804. ; loc_164A6:
  27805. MarkObjGone_P2:
  27806. move.w x_pos(a0),d0
  27807. andi.w #$FF00,d0
  27808. move.w d0,d1
  27809. sub.w (Camera_X_pos_coarse).w,d0
  27810. cmpi.w #$300,d0
  27811. bhi.w +
  27812. bra.w DisplaySprite
  27813. +
  27814. sub.w (Camera_X_pos_coarse_P2).w,d1
  27815. cmpi.w #$300,d1
  27816. bhi.w +
  27817. bra.w DisplaySprite
  27818. +
  27819. lea (Object_Respawn_Table).w,a2
  27820. moveq #0,d0
  27821. move.b respawn_index(a0),d0
  27822. beq.s +
  27823. bclr #7,2(a2,d0.w)
  27824. +
  27825. bra.w DeleteObject ; useless branch...
  27826.  
  27827. ; ---------------------------------------------------------------------------
  27828. ; Subroutine to delete an object
  27829. ; ---------------------------------------------------------------------------
  27830.  
  27831. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27832.  
  27833. ; freeObject:
  27834. DeleteObject:
  27835. movea.l a0,a1
  27836.  
  27837. ; sub_164E8:
  27838. DeleteObject2:
  27839. moveq #0,d1
  27840.  
  27841. moveq #bytesToLcnt(next_object),d0 ; we want to clear up to the next object
  27842. ; delete the object by setting all of its bytes to 0
  27843. - move.l d1,(a1)+
  27844. dbf d0,-
  27845. if object_size&3
  27846. move.w d1,(a1)+
  27847. endif
  27848.  
  27849. rts
  27850. ; End of function DeleteObject2
  27851.  
  27852.  
  27853.  
  27854.  
  27855. ; ---------------------------------------------------------------------------
  27856. ; Subroutine to display a sprite/object, when a0 is the object RAM
  27857. ; ---------------------------------------------------------------------------
  27858.  
  27859. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27860.  
  27861. ; sub_164F4:
  27862. DisplaySprite:
  27863. lea (Sprite_Table_Input).w,a1
  27864. move.w priority(a0),d0
  27865. lsr.w #1,d0
  27866. andi.w #$380,d0
  27867. adda.w d0,a1
  27868. cmpi.w #$7E,(a1)
  27869. bhs.s return_16510
  27870. addq.w #2,(a1)
  27871. adda.w (a1),a1
  27872. move.w a0,(a1)
  27873.  
  27874. return_16510:
  27875. rts
  27876. ; End of function DisplaySprite
  27877.  
  27878. ; ---------------------------------------------------------------------------
  27879. ; Subroutine to display a sprite/object, when a1 is the object RAM
  27880. ; ---------------------------------------------------------------------------
  27881.  
  27882. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27883.  
  27884. ; sub_16512:
  27885. DisplaySprite2:
  27886. lea (Sprite_Table_Input).w,a2
  27887. move.w priority(a1),d0
  27888. lsr.w #1,d0
  27889. andi.w #$380,d0
  27890. adda.w d0,a2
  27891. cmpi.w #$7E,(a2)
  27892. bhs.s return_1652E
  27893. addq.w #2,(a2)
  27894. adda.w (a2),a2
  27895. move.w a1,(a2)
  27896.  
  27897. return_1652E:
  27898. rts
  27899. ; End of function DisplaySprite2
  27900.  
  27901. ; ---------------------------------------------------------------------------
  27902. ; Subroutine to display a sprite/object, when a0 is the object RAM
  27903. ; and d0 is already (priority/2)&$380
  27904. ; ---------------------------------------------------------------------------
  27905.  
  27906. ; loc_16530:
  27907. DisplaySprite3:
  27908. lea (Sprite_Table_Input).w,a1
  27909. adda.w d0,a1
  27910. cmpi.w #$7E,(a1)
  27911. bhs.s return_16542
  27912. addq.w #2,(a1)
  27913. adda.w (a1),a1
  27914. move.w a0,(a1)
  27915.  
  27916. return_16542:
  27917. rts
  27918.  
  27919. ; ---------------------------------------------------------------------------
  27920. ; Subroutine to animate a sprite using an animation script
  27921. ; ---------------------------------------------------------------------------
  27922.  
  27923. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  27924.  
  27925. ; sub_16544:
  27926. AnimateSprite:
  27927. moveq #0,d0
  27928. move.b anim(a0),d0 ; move animation number to d0
  27929. cmp.b next_anim(a0),d0 ; is animation set to change?
  27930. beq.s Anim_Run ; if not, branch
  27931. move.b d0,next_anim(a0) ; set next anim to current current
  27932. move.b #0,anim_frame(a0) ; reset animation
  27933. move.b #0,anim_frame_duration(a0) ; reset frame duration
  27934. ; loc_16560:
  27935. Anim_Run:
  27936. subq.b #1,anim_frame_duration(a0) ; subtract 1 from frame duration
  27937. bpl.s Anim_Wait ; if time remains, branch
  27938. add.w d0,d0
  27939. adda.w (a1,d0.w),a1 ; calculate address of appropriate animation script
  27940. move.b (a1),anim_frame_duration(a0) ; load frame duration
  27941. moveq #0,d1
  27942. move.b anim_frame(a0),d1 ; load current frame number
  27943. move.b 1(a1,d1.w),d0 ; read sprite number from script
  27944. bmi.s Anim_End_FF ; if animation is complete, branch
  27945. ; loc_1657C:
  27946. Anim_Next:
  27947. andi.b #$7F,d0 ; clear sign bit
  27948. move.b d0,mapping_frame(a0) ; load sprite number
  27949. move.b status(a0),d1 ;* match the orientaion dictated by the object
  27950. andi.b #3,d1 ;* with the orientation used by the object engine
  27951. andi.b #$FC,render_flags(a0) ;*
  27952. or.b d1,render_flags(a0) ;*
  27953. addq.b #1,anim_frame(a0) ; next frame number
  27954. ; return_1659A:
  27955. Anim_Wait:
  27956. rts
  27957. ; ===========================================================================
  27958. ; loc_1659C:
  27959. Anim_End_FF:
  27960. addq.b #1,d0 ; is the end flag = $FF ?
  27961. bne.s Anim_End_FE ; if not, branch
  27962. move.b #0,anim_frame(a0) ; restart the animation
  27963. move.b 1(a1),d0 ; read sprite number
  27964. bra.s Anim_Next
  27965. ; ===========================================================================
  27966. ; loc_165AC:
  27967. Anim_End_FE:
  27968. addq.b #1,d0 ; is the end flag = $FE ?
  27969. bne.s Anim_End_FD ; if not, branch
  27970. move.b 2(a1,d1.w),d0 ; read the next byte in the script
  27971. sub.b d0,anim_frame(a0) ; jump back d0 bytes in the script
  27972. sub.b d0,d1
  27973. move.b 1(a1,d1.w),d0 ; read sprite number
  27974. bra.s Anim_Next
  27975. ; ===========================================================================
  27976. ; loc_165C0:
  27977. Anim_End_FD:
  27978. addq.b #1,d0 ; is the end flag = $FD ?
  27979. bne.s Anim_End_FC ; if not, branch
  27980. move.b 2(a1,d1.w),anim(a0) ; read next byte, run that animation
  27981. rts
  27982. ; ===========================================================================
  27983. ; loc_165CC:
  27984. Anim_End_FC:
  27985. addq.b #1,d0 ; is the end flag = $FC ?
  27986. bne.s Anim_End_FB ; if not, branch
  27987. addq.b #2,routine(a0) ; jump to next routine
  27988. move.b #0,anim_frame_duration(a0)
  27989. addq.b #1,anim_frame(a0)
  27990. rts
  27991. ; ===========================================================================
  27992. ; loc_165E0:
  27993. Anim_End_FB:
  27994. addq.b #1,d0 ; is the end flag = $FB ?
  27995. bne.s Anim_End_FA ; if not, branch
  27996. move.b #0,anim_frame(a0) ; reset animation
  27997. clr.b routine_secondary(a0) ; reset 2nd routine counter
  27998. rts
  27999. ; ===========================================================================
  28000. ; loc_165F0:
  28001. Anim_End_FA:
  28002. addq.b #1,d0 ; is the end flag = $FA ?
  28003. bne.s Anim_End_F9 ; if not, branch
  28004. addq.b #2,routine_secondary(a0) ; jump to next routine
  28005. rts
  28006. ; ===========================================================================
  28007. ; loc_165FA:
  28008. Anim_End_F9:
  28009. addq.b #1,d0 ; is the end flag = $F9 ?
  28010. bne.s Anim_End ; if not, branch
  28011. addq.b #2,objoff_2A(a0)
  28012. ; return_16602:
  28013. Anim_End:
  28014. rts
  28015. ; End of function AnimateSprite
  28016.  
  28017.  
  28018. ; ---------------------------------------------------------------------------
  28019. ; Subroutine to convert mappings (etc) to proper Megadrive sprites
  28020. ; ---------------------------------------------------------------------------
  28021.  
  28022. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  28023.  
  28024. ; sub_16604:
  28025. BuildSprites:
  28026. tst.w (Two_player_mode).w
  28027. bne.w BuildSprites_2P
  28028. lea (Sprite_Table).w,a2
  28029. moveq #0,d5
  28030. moveq #0,d4
  28031. tst.b (Level_started_flag).w
  28032. beq.s +
  28033. jsrto (BuildHUD).l, JmpTo_BuildHUD
  28034. bsr.w BuildRings
  28035. +
  28036. lea (Sprite_Table_Input).w,a4
  28037. moveq #7,d7 ; 8 priority levels
  28038. ; loc_16628:
  28039. BuildSprites_LevelLoop:
  28040. tst.w (a4) ; does this level have any objects?
  28041. beq.w BuildSprites_NextLevel ; if not, check the next one
  28042. moveq #2,d6
  28043. ; loc_16630:
  28044. BuildSprites_ObjLoop:
  28045. movea.w (a4,d6.w),a0 ; a0=object
  28046.  
  28047. if gameRevision=0
  28048. ; the additional check prevents a crash triggered by placing an object in debug mode while dead
  28049. ; unfortunately, the code it branches *to* causes a crash of its own
  28050. tst.b id(a0) ; is this object slot occupied?
  28051. beq.w BuildSprites_Unknown ; if not, branch
  28052. tst.l mappings(a0) ; does this object have any mappings?
  28053. beq.w BuildSprites_Unknown ; if not, branch
  28054. else
  28055. ; REV01 uses a better branch, but removed the useful check
  28056. tst.b id(a0) ; is this object slot occupied?
  28057. beq.w BuildSprites_NextObj ; if not, check next one
  28058. endif
  28059.  
  28060. andi.b #$7F,render_flags(a0) ; clear on-screen flag
  28061. move.b render_flags(a0),d0
  28062. move.b d0,d4
  28063. btst #6,d0 ; is the multi-draw flag set?
  28064. bne.w BuildSprites_MultiDraw ; if it is, branch
  28065. andi.w #$C,d0 ; is this to be positioned by screen coordinates?
  28066. beq.s BuildSprites_ScreenSpaceObj ; if it is, branch
  28067. lea (Camera_X_pos_copy).w,a1
  28068. moveq #0,d0
  28069. move.b width_pixels(a0),d0
  28070. move.w x_pos(a0),d3
  28071. sub.w (a1),d3
  28072. move.w d3,d1
  28073. add.w d0,d1 ; is the object right edge to the left of the screen?
  28074. bmi.w BuildSprites_NextObj ; if it is, branch
  28075. move.w d3,d1
  28076. sub.w d0,d1
  28077. cmpi.w #320,d1 ; is the object left edge to the right of the screen?
  28078. bge.w BuildSprites_NextObj ; if it is, branch
  28079. addi.w #128,d3
  28080. btst #4,d4 ; is the accurate Y check flag set?
  28081. beq.s BuildSprites_ApproxYCheck ; if not, branch
  28082. moveq #0,d0
  28083. move.b y_radius(a0),d0
  28084. move.w y_pos(a0),d2
  28085. sub.w 4(a1),d2
  28086. move.w d2,d1
  28087. add.w d0,d1
  28088. bmi.s BuildSprites_NextObj ; if the object is above the screen
  28089. move.w d2,d1
  28090. sub.w d0,d1
  28091. cmpi.w #224,d1
  28092. bge.s BuildSprites_NextObj ; if the object is below the screen
  28093. addi.w #128,d2
  28094. bra.s BuildSprites_DrawSprite
  28095. ; ===========================================================================
  28096. ; loc_166A6:
  28097. BuildSprites_ScreenSpaceObj:
  28098. move.w y_pixel(a0),d2
  28099. move.w x_pixel(a0),d3
  28100. bra.s BuildSprites_DrawSprite
  28101. ; ===========================================================================
  28102. ; loc_166B0:
  28103. BuildSprites_ApproxYCheck:
  28104. move.w y_pos(a0),d2
  28105. sub.w 4(a1),d2
  28106. addi.w #128,d2
  28107. andi.w #$7FF,d2
  28108. cmpi.w #-32+128,d2 ; assume Y radius to be 32 pixels
  28109. blo.s BuildSprites_NextObj
  28110. cmpi.w #32+128+224,d2
  28111. bhs.s BuildSprites_NextObj
  28112. ; loc_166CC:
  28113. BuildSprites_DrawSprite:
  28114. movea.l mappings(a0),a1
  28115. moveq #0,d1
  28116. btst #5,d4 ; is the static mappings flag set?
  28117. bne.s + ; if it is, branch
  28118. move.b mapping_frame(a0),d1
  28119. add.w d1,d1
  28120. adda.w (a1,d1.w),a1
  28121. move.w (a1)+,d1
  28122. subq.w #1,d1 ; get number of pieces
  28123. bmi.s ++ ; if there are 0 pieces, branch
  28124. +
  28125. bsr.w DrawSprite ; draw the sprite
  28126. +
  28127. ori.b #$80,render_flags(a0) ; set on-screen flag
  28128. ; loc_166F2:
  28129. BuildSprites_NextObj:
  28130. addq.w #2,d6 ; load next object
  28131. subq.w #2,(a4) ; decrement object count
  28132. bne.w BuildSprites_ObjLoop ; if there are objects left, repeat
  28133. ; loc_166FA:
  28134. BuildSprites_NextLevel:
  28135. lea $80(a4),a4 ; load next priority level
  28136. dbf d7,BuildSprites_LevelLoop ; loop
  28137. move.b d5,(Sprite_count).w
  28138. cmpi.b #80,d5 ; was the sprite limit reached?
  28139. beq.s + ; if it was, branch
  28140. move.l #0,(a2) ; set link field to 0
  28141. rts
  28142. +
  28143. move.b #0,-5(a2) ; set link field to 0
  28144. rts
  28145. ; ===========================================================================
  28146. if gameRevision=0
  28147. BuildSprites_Unknown:
  28148. ; in the Simon Wai beta, this was a simple BranchTo, but later builds have this mystery line
  28149. move.w (1).w,d0 ; causes a crash on hardware because of the word operation at an odd address
  28150. bra.s BuildSprites_NextObj
  28151. endif
  28152. ; loc_1671C:
  28153. BuildSprites_MultiDraw:
  28154. move.l a4,-(sp)
  28155. lea (Camera_X_pos).w,a4
  28156. movea.w art_tile(a0),a3
  28157. movea.l mappings(a0),a5
  28158. moveq #0,d0
  28159.  
  28160. ; check if object is within X bounds
  28161. move.b mainspr_width(a0),d0 ; load pixel width
  28162. move.w x_pos(a0),d3
  28163. sub.w (a4),d3
  28164. move.w d3,d1
  28165. add.w d0,d1
  28166. bmi.w BuildSprites_MultiDraw_NextObj
  28167. move.w d3,d1
  28168. sub.w d0,d1
  28169. cmpi.w #320,d1
  28170. bge.w BuildSprites_MultiDraw_NextObj
  28171. addi.w #128,d3
  28172.  
  28173. ; check if object is within Y bounds
  28174. btst #4,d4
  28175. beq.s +
  28176. moveq #0,d0
  28177. move.b mainspr_height(a0),d0 ; load pixel height
  28178. move.w y_pos(a0),d2
  28179. sub.w 4(a4),d2
  28180. move.w d2,d1
  28181. add.w d0,d1
  28182. bmi.w BuildSprites_MultiDraw_NextObj
  28183. move.w d2,d1
  28184. sub.w d0,d1
  28185. cmpi.w #224,d1
  28186. bge.w BuildSprites_MultiDraw_NextObj
  28187. addi.w #128,d2
  28188. bra.s ++
  28189. +
  28190. move.w y_pos(a0),d2
  28191. sub.w 4(a4),d2
  28192. addi.w #128,d2
  28193. andi.w #$7FF,d2
  28194. cmpi.w #-32+128,d2
  28195. blo.s BuildSprites_MultiDraw_NextObj
  28196. cmpi.w #32+128+224,d2
  28197. bhs.s BuildSprites_MultiDraw_NextObj
  28198. +
  28199. moveq #0,d1
  28200. move.b mainspr_mapframe(a0),d1 ; get current frame
  28201. beq.s +
  28202. add.w d1,d1
  28203. movea.l a5,a1
  28204. adda.w (a1,d1.w),a1
  28205. move.w (a1)+,d1
  28206. subq.w #1,d1
  28207. bmi.s +
  28208. move.w d4,-(sp)
  28209. bsr.w ChkDrawSprite ; draw the sprite
  28210. move.w (sp)+,d4
  28211. +
  28212. ori.b #$80,render_flags(a0) ; set onscreen flag
  28213. lea sub2_x_pos(a0),a6
  28214. moveq #0,d0
  28215. move.b mainspr_childsprites(a0),d0 ; get child sprite count
  28216. subq.w #1,d0 ; if there are 0, go to next object
  28217. bcs.s BuildSprites_MultiDraw_NextObj
  28218.  
  28219. - swap d0
  28220. move.w (a6)+,d3 ; get X pos
  28221. sub.w (a4),d3
  28222. addi.w #128,d3
  28223. move.w (a6)+,d2 ; get Y pos
  28224. sub.w 4(a4),d2
  28225. addi.w #128,d2
  28226. andi.w #$7FF,d2
  28227. addq.w #1,a6
  28228. moveq #0,d1
  28229. move.b (a6)+,d1 ; get mapping frame
  28230. add.w d1,d1
  28231. movea.l a5,a1
  28232. adda.w (a1,d1.w),a1
  28233. move.w (a1)+,d1
  28234. subq.w #1,d1
  28235. bmi.s +
  28236. move.w d4,-(sp)
  28237. bsr.w ChkDrawSprite
  28238. move.w (sp)+,d4
  28239. +
  28240. swap d0
  28241. dbf d0,- ; repeat for number of child sprites
  28242. ; loc_16804:
  28243. BuildSprites_MultiDraw_NextObj:
  28244. movea.l (sp)+,a4
  28245. bra.w BuildSprites_NextObj
  28246. ; End of function BuildSprites
  28247.  
  28248.  
  28249. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  28250.  
  28251. ; sub_1680A:
  28252. ChkDrawSprite:
  28253. cmpi.b #80,d5 ; has the sprite limit been reached?
  28254. blo.s DrawSprite_Cont ; if it hasn't, branch
  28255. rts ; otherwise, return
  28256. ; End of function ChkDrawSprite
  28257.  
  28258.  
  28259. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  28260.  
  28261. ; sub_16812:
  28262. DrawSprite:
  28263. movea.w art_tile(a0),a3
  28264. cmpi.b #80,d5
  28265. bhs.s DrawSprite_Done
  28266. ; loc_1681C:
  28267. DrawSprite_Cont:
  28268. btst #0,d4 ; is the sprite to be X-flipped?
  28269. bne.s DrawSprite_FlipX ; if it is, branch
  28270. btst #1,d4 ; is the sprite to be Y-flipped?
  28271. bne.w DrawSprite_FlipY ; if it is, branch
  28272. ; loc__1682A:
  28273. DrawSprite_Loop:
  28274. move.b (a1)+,d0
  28275. ext.w d0
  28276. add.w d2,d0
  28277. move.w d0,(a2)+ ; set Y pos
  28278. move.b (a1)+,(a2)+ ; set sprite size
  28279. addq.b #1,d5
  28280. move.b d5,(a2)+ ; set link field
  28281. move.w (a1)+,d0
  28282. add.w a3,d0
  28283. move.w d0,(a2)+ ; set art tile and flags
  28284. addq.w #2,a1
  28285. move.w (a1)+,d0
  28286. add.w d3,d0
  28287. andi.w #$1FF,d0
  28288. bne.s +
  28289. addq.w #1,d0 ; avoid activating sprite masking
  28290. +
  28291. move.w d0,(a2)+ ; set X pos
  28292. dbf d1,DrawSprite_Loop ; repeat for next sprite
  28293. ; return_16852:
  28294. DrawSprite_Done:
  28295. rts
  28296. ; ===========================================================================
  28297. ; loc_16854:
  28298. DrawSprite_FlipX:
  28299. btst #1,d4 ; is it to be Y-flipped as well?
  28300. bne.w DrawSprite_FlipXY ; if it is, branch
  28301.  
  28302. - move.b (a1)+,d0
  28303. ext.w d0
  28304. add.w d2,d0
  28305. move.w d0,(a2)+
  28306. move.b (a1)+,d4 ; store size for later use
  28307. move.b d4,(a2)+
  28308. addq.b #1,d5
  28309. move.b d5,(a2)+
  28310. move.w (a1)+,d0
  28311. add.w a3,d0
  28312. eori.w #$800,d0 ; toggle X flip flag
  28313. move.w d0,(a2)+
  28314. addq.w #2,a1
  28315. move.w (a1)+,d0
  28316. neg.w d0 ; negate X offset
  28317. move.b CellOffsets_XFlip(pc,d4.w),d4
  28318. sub.w d4,d0 ; subtract sprite size
  28319. add.w d3,d0
  28320. andi.w #$1FF,d0
  28321. bne.s +
  28322. addq.w #1,d0
  28323. +
  28324. move.w d0,(a2)+
  28325. dbf d1,-
  28326.  
  28327. rts
  28328. ; ===========================================================================
  28329. ; offsets for horizontally mirrored sprite pieces
  28330. CellOffsets_XFlip:
  28331. dc.b 8, 8, 8, 8 ; 4
  28332. dc.b $10,$10,$10,$10 ; 8
  28333. dc.b $18,$18,$18,$18 ; 12
  28334. dc.b $20,$20,$20,$20 ; 16
  28335. ; offsets for vertically mirrored sprite pieces
  28336. CellOffsets_YFlip:
  28337. dc.b 8,$10,$18,$20 ; 4
  28338. dc.b 8,$10,$18,$20 ; 8
  28339. dc.b 8,$10,$18,$20 ; 12
  28340. dc.b 8,$10,$18,$20 ; 16
  28341. ; ===========================================================================
  28342. ; loc_168B4:
  28343. DrawSprite_FlipY:
  28344. move.b (a1)+,d0
  28345. move.b (a1),d4
  28346. ext.w d0
  28347. neg.w d0
  28348. move.b CellOffsets_YFlip(pc,d4.w),d4
  28349. sub.w d4,d0
  28350. add.w d2,d0
  28351. move.w d0,(a2)+ ; set Y pos
  28352. move.b (a1)+,(a2)+ ; set size
  28353. addq.b #1,d5
  28354. move.b d5,(a2)+ ; set link field
  28355. move.w (a1)+,d0
  28356. add.w a3,d0
  28357. eori.w #$1000,d0 ; toggle Y flip flag
  28358. move.w d0,(a2)+ ; set art tile and flags
  28359. addq.w #2,a1
  28360. move.w (a1)+,d0
  28361. add.w d3,d0
  28362. andi.w #$1FF,d0
  28363. bne.s +
  28364. addq.w #1,d0
  28365. +
  28366. move.w d0,(a2)+ ; set X pos
  28367. dbf d1,DrawSprite_FlipY
  28368. rts
  28369. ; ===========================================================================
  28370. ; offsets for vertically mirrored sprite pieces
  28371. CellOffsets_YFlip2:
  28372. dc.b 8,$10,$18,$20 ; 4
  28373. dc.b 8,$10,$18,$20 ; 8
  28374. dc.b 8,$10,$18,$20 ; 12
  28375. dc.b 8,$10,$18,$20 ; 16
  28376. ; ===========================================================================
  28377. ; loc_168FC:
  28378. DrawSprite_FlipXY:
  28379. move.b (a1)+,d0
  28380. move.b (a1),d4
  28381. ext.w d0
  28382. neg.w d0
  28383. move.b CellOffsets_YFlip2(pc,d4.w),d4
  28384. sub.w d4,d0
  28385. add.w d2,d0
  28386. move.w d0,(a2)+
  28387. move.b (a1)+,d4
  28388. move.b d4,(a2)+
  28389. addq.b #1,d5
  28390. move.b d5,(a2)+
  28391. move.w (a1)+,d0
  28392. add.w a3,d0
  28393. eori.w #$1800,d0 ; toggle X and Y flip flags
  28394. move.w d0,(a2)+
  28395. addq.w #2,a1
  28396. move.w (a1)+,d0
  28397. neg.w d0
  28398. move.b CellOffsets_XFlip2(pc,d4.w),d4
  28399. sub.w d4,d0
  28400. add.w d3,d0
  28401. andi.w #$1FF,d0
  28402. bne.s +
  28403. addq.w #1,d0
  28404. +
  28405. move.w d0,(a2)+
  28406. dbf d1,DrawSprite_FlipXY
  28407. rts
  28408. ; End of function DrawSprite
  28409.  
  28410. ; ===========================================================================
  28411. ; offsets for horizontally mirrored sprite pieces
  28412. CellOffsets_XFlip2:
  28413. dc.b 8, 8, 8, 8 ; 4
  28414. dc.b $10,$10,$10,$10 ; 8
  28415. dc.b $18,$18,$18,$18 ; 12
  28416. dc.b $20,$20,$20,$20 ; 16
  28417. ; ===========================================================================
  28418.  
  28419. ; ---------------------------------------------------------------------------
  28420. ; Subroutine to convert mappings (etc) to proper Megadrive sprites
  28421. ; for 2-player (split screen) mode
  28422. ; ---------------------------------------------------------------------------
  28423.  
  28424. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  28425.  
  28426. ; loc_1694E:
  28427. BuildSprites_2P:
  28428. lea (Sprite_Table).w,a2
  28429. moveq #2,d5
  28430. moveq #0,d4
  28431. move.l #$1D80F01,(a2)+ ; mask all sprites
  28432. move.l #1,(a2)+
  28433. move.l #$1D80F02,(a2)+ ; from 216px to 248px
  28434. move.l #0,(a2)+
  28435. tst.b (Level_started_flag).w
  28436. beq.s +
  28437. jsrto (BuildHUD_P1).l, JmpTo_BuildHUD_P1
  28438. bsr.w BuildRings_P1
  28439. +
  28440. lea (Sprite_Table_Input).w,a4
  28441. moveq #7,d7
  28442. ; loc_16982:
  28443. BuildSprites_P1_LevelLoop:
  28444. move.w (a4),d0 ; does this priority level have any objects?
  28445. beq.w BuildSprites_P1_NextLevel ; if not, check next one
  28446. move.w d0,-(sp)
  28447. moveq #2,d6
  28448. ; loc_1698C:
  28449. BuildSprites_P1_ObjLoop:
  28450. movea.w (a4,d6.w),a0 ; a0=object
  28451. tst.b id(a0)
  28452. beq.w BuildSprites_P1_NextObj
  28453. andi.b #$7F,render_flags(a0)
  28454. move.b render_flags(a0),d0
  28455. move.b d0,d4
  28456. btst #6,d0
  28457. bne.w BuildSprites_P1_MultiDraw
  28458. andi.w #$C,d0
  28459. beq.s BuildSprites_P1_ScreenSpaceObj
  28460. lea (Camera_X_pos).w,a1
  28461. moveq #0,d0
  28462. move.b width_pixels(a0),d0
  28463. move.w x_pos(a0),d3
  28464. sub.w (a1),d3
  28465. move.w d3,d1
  28466. add.w d0,d1
  28467. bmi.w BuildSprites_P1_NextObj
  28468. move.w d3,d1
  28469. sub.w d0,d1
  28470. cmpi.w #320,d1
  28471. bge.s BuildSprites_P1_NextObj
  28472. addi.w #128,d3
  28473. btst #4,d4
  28474. beq.s BuildSprites_P1_ApproxYCheck
  28475. moveq #0,d0
  28476. move.b y_radius(a0),d0
  28477. move.w y_pos(a0),d2
  28478. sub.w 4(a1),d2
  28479. move.w d2,d1
  28480. add.w d0,d1
  28481. bmi.s BuildSprites_P1_NextObj
  28482. move.w d2,d1
  28483. sub.w d0,d1
  28484. cmpi.w #224,d1
  28485. bge.s BuildSprites_P1_NextObj
  28486. addi.w #256,d2
  28487. bra.s BuildSprites_P1_DrawSprite
  28488. ; ===========================================================================
  28489. ; loc_16A00:
  28490. BuildSprites_P1_ScreenSpaceObj:
  28491. move.w y_pixel(a0),d2
  28492. move.w x_pixel(a0),d3
  28493. addi.w #128,d2
  28494. bra.s BuildSprites_P1_DrawSprite
  28495. ; ===========================================================================
  28496. ; loc_16A0E:
  28497. BuildSprites_P1_ApproxYCheck:
  28498. move.w y_pos(a0),d2
  28499. sub.w 4(a1),d2
  28500. addi.w #128,d2
  28501. cmpi.w #-32+128,d2
  28502. blo.s BuildSprites_P1_NextObj
  28503. cmpi.w #32+128+224,d2
  28504. bhs.s BuildSprites_P1_NextObj
  28505. addi.w #128,d2
  28506. ; loc_16A2A:
  28507. BuildSprites_P1_DrawSprite:
  28508. movea.l mappings(a0),a1
  28509. moveq #0,d1
  28510. btst #5,d4
  28511. bne.s +
  28512. move.b mapping_frame(a0),d1
  28513. add.w d1,d1
  28514. adda.w (a1,d1.w),a1
  28515. move.w (a1)+,d1
  28516. subq.w #1,d1
  28517. bmi.s ++
  28518. +
  28519. bsr.w DrawSprite_2P
  28520. +
  28521. ori.b #$80,render_flags(a0)
  28522. ; loc_16A50:
  28523. BuildSprites_P1_NextObj:
  28524. addq.w #2,d6
  28525. subq.w #2,(sp)
  28526. bne.w BuildSprites_P1_ObjLoop
  28527. addq.w #2,sp
  28528. ; loc_16A5A:
  28529. BuildSprites_P1_NextLevel:
  28530. lea $80(a4),a4
  28531. dbf d7,BuildSprites_P1_LevelLoop
  28532. move.b d5,(Sprite_count).w
  28533. cmpi.b #80,d5
  28534. bhs.s +
  28535. move.l #0,(a2)
  28536. bra.s BuildSprites_P2
  28537. +
  28538. move.b #0,-5(a2)
  28539.  
  28540. ; build sprites for player 2
  28541.  
  28542. ; loc_16A7A:
  28543. BuildSprites_P2:
  28544. tst.w (Hint_flag).w ; has H-int occured yet?
  28545. bne.s BuildSprites_P2 ; if not, wait
  28546. lea (Sprite_Table_2).w,a2
  28547. moveq #0,d5
  28548. moveq #0,d4
  28549. tst.b (Level_started_flag).w
  28550. beq.s +
  28551. jsrto (BuildHUD_P2).l, JmpTo_BuildHUD_P2
  28552. bsr.w BuildRings_P2
  28553. +
  28554. lea (Sprite_Table_Input).w,a4
  28555. moveq #7,d7
  28556. ; loc_16A9C:
  28557. BuildSprites_P2_LevelLoop:
  28558. move.w (a4),d0
  28559. beq.w BuildSprites_P2_NextLevel
  28560. move.w d0,-(sp)
  28561. moveq #2,d6
  28562. ; loc_16AA6:
  28563. BuildSprites_P2_ObjLoop:
  28564. movea.w (a4,d6.w),a0 ; a0=object
  28565. tst.b id(a0)
  28566. beq.w BuildSprites_P2_NextObj
  28567. move.b render_flags(a0),d0
  28568. move.b d0,d4
  28569. btst #6,d0
  28570. bne.w BuildSprites_P2_MultiDraw
  28571. andi.w #$C,d0
  28572. beq.s BuildSprites_P2_ScreenSpaceObj
  28573. lea (Camera_X_pos_P2).w,a1
  28574. moveq #0,d0
  28575. move.b width_pixels(a0),d0
  28576. move.w x_pos(a0),d3
  28577. sub.w (a1),d3
  28578. move.w d3,d1
  28579. add.w d0,d1
  28580. bmi.w BuildSprites_P2_NextObj
  28581. move.w d3,d1
  28582. sub.w d0,d1
  28583. cmpi.w #320,d1
  28584. bge.s BuildSprites_P2_NextObj
  28585. addi.w #128,d3
  28586. btst #4,d4
  28587. beq.s BuildSprites_P2_ApproxYCheck
  28588. moveq #0,d0
  28589. move.b y_radius(a0),d0
  28590. move.w y_pos(a0),d2
  28591. sub.w 4(a1),d2
  28592. move.w d2,d1
  28593. add.w d0,d1
  28594. bmi.s BuildSprites_P2_NextObj
  28595. move.w d2,d1
  28596. sub.w d0,d1
  28597. cmpi.w #224,d1
  28598. bge.s BuildSprites_P2_NextObj
  28599. addi.w #256+224,d2
  28600. bra.s BuildSprites_P2_DrawSprite
  28601. ; ===========================================================================
  28602. ; loc_16B14:
  28603. BuildSprites_P2_ScreenSpaceObj:
  28604. move.w y_pixel(a0),d2
  28605. move.w x_pixel(a0),d3
  28606. addi.w #$160,d2
  28607. bra.s BuildSprites_P2_DrawSprite
  28608. ; ===========================================================================
  28609. ; loc_16B22:
  28610. BuildSprites_P2_ApproxYCheck:
  28611. move.w y_pos(a0),d2
  28612. sub.w 4(a1),d2
  28613. addi.w #128,d2
  28614. cmpi.w #-32+128,d2
  28615. blo.s BuildSprites_P2_NextObj
  28616. cmpi.w #32+128+224,d2
  28617. bhs.s BuildSprites_P2_NextObj
  28618. addi.w #128+224,d2
  28619. ; loc_16B3E:
  28620. BuildSprites_P2_DrawSprite:
  28621. movea.l mappings(a0),a1
  28622. moveq #0,d1
  28623. btst #5,d4
  28624. bne.s +
  28625. move.b mapping_frame(a0),d1
  28626. add.w d1,d1
  28627. adda.w (a1,d1.w),a1
  28628. move.w (a1)+,d1
  28629. subq.w #1,d1
  28630. bmi.s ++
  28631. +
  28632. bsr.w DrawSprite_2P
  28633. +
  28634. ori.b #$80,render_flags(a0)
  28635. ; loc_16B64:
  28636. BuildSprites_P2_NextObj:
  28637. addq.w #2,d6
  28638. subq.w #2,(sp)
  28639. bne.w BuildSprites_P2_ObjLoop
  28640. addq.w #2,sp
  28641. tst.b (Teleport_flag).w
  28642. bne.s BuildSprites_P2_NextLevel
  28643. move.w #0,(a4)
  28644. ; loc_16B78:
  28645. BuildSprites_P2_NextLevel:
  28646. lea $80(a4),a4
  28647. dbf d7,BuildSprites_P2_LevelLoop
  28648. move.b d5,(Sprite_count).w
  28649. cmpi.b #80,d5
  28650. beq.s +
  28651. move.l #0,(a2)
  28652. rts
  28653. +
  28654. move.b #0,-5(a2)
  28655. rts
  28656. ; ===========================================================================
  28657. ; loc_16B9A:
  28658. BuildSprites_P1_MultiDraw:
  28659. move.l a4,-(sp)
  28660. lea (Camera_X_pos).w,a4
  28661. movea.w art_tile(a0),a3
  28662. movea.l mappings(a0),a5
  28663. moveq #0,d0
  28664. move.b mainspr_width(a0),d0
  28665. move.w x_pos(a0),d3
  28666. sub.w (a4),d3
  28667. move.w d3,d1
  28668. add.w d0,d1
  28669. bmi.w BuildSprites_P1_MultiDraw_NextObj
  28670. move.w d3,d1
  28671. sub.w d0,d1
  28672. cmpi.w #320,d1
  28673. bge.w BuildSprites_P1_MultiDraw_NextObj
  28674. addi.w #128,d3
  28675. btst #4,d4
  28676. beq.s +
  28677. moveq #0,d0
  28678. move.b mainspr_height(a0),d0
  28679. move.w y_pos(a0),d2
  28680. sub.w 4(a4),d2
  28681. move.w d2,d1
  28682. add.w d0,d1
  28683. bmi.w BuildSprites_P1_MultiDraw_NextObj
  28684. move.w d2,d1
  28685. sub.w d0,d1
  28686. cmpi.w #224,d1
  28687. bge.w BuildSprites_P1_MultiDraw_NextObj
  28688. addi.w #256,d2
  28689. bra.s ++
  28690. +
  28691. move.w y_pos(a0),d2
  28692. sub.w 4(a4),d2
  28693. addi.w #128,d2
  28694. cmpi.w #-32+128,d2
  28695. blo.s BuildSprites_P1_MultiDraw_NextObj
  28696. cmpi.w #32+128+224,d2
  28697. bhs.s BuildSprites_P1_MultiDraw_NextObj
  28698. addi.w #128,d2
  28699. +
  28700. moveq #0,d1
  28701. move.b mainspr_mapframe(a0),d1
  28702. beq.s +
  28703. add.w d1,d1
  28704. movea.l a5,a1
  28705. adda.w (a1,d1.w),a1
  28706. move.w (a1)+,d1
  28707. subq.w #1,d1
  28708. bmi.s +
  28709. move.w d4,-(sp)
  28710. bsr.w ChkDrawSprite_2P
  28711. move.w (sp)+,d4
  28712. +
  28713. ori.b #$80,render_flags(a0)
  28714. lea sub2_x_pos(a0),a6
  28715. moveq #0,d0
  28716. move.b mainspr_childsprites(a0),d0
  28717. subq.w #1,d0
  28718. bcs.s BuildSprites_P1_MultiDraw_NextObj
  28719.  
  28720. - swap d0
  28721. move.w (a6)+,d3
  28722. sub.w (a4),d3
  28723. addi.w #128,d3
  28724. move.w (a6)+,d2
  28725. sub.w 4(a4),d2
  28726. addi.w #256,d2
  28727. addq.w #1,a6
  28728. moveq #0,d1
  28729. move.b (a6)+,d1
  28730. add.w d1,d1
  28731. movea.l a5,a1
  28732. adda.w (a1,d1.w),a1
  28733. move.w (a1)+,d1
  28734. subq.w #1,d1
  28735. bmi.s +
  28736. move.w d4,-(sp)
  28737. bsr.w ChkDrawSprite_2P
  28738. move.w (sp)+,d4
  28739. +
  28740. swap d0
  28741. dbf d0,-
  28742. ; loc_16C7E:
  28743. BuildSprites_P1_MultiDraw_NextObj:
  28744. movea.l (sp)+,a4
  28745. bra.w BuildSprites_P1_NextObj
  28746. ; ===========================================================================
  28747. ; loc_16C84:
  28748. BuildSprites_P2_MultiDraw:
  28749. move.l a4,-(sp)
  28750. lea (Camera_X_pos_P2).w,a4
  28751. movea.w art_tile(a0),a3
  28752. movea.l mappings(a0),a5
  28753. moveq #0,d0
  28754. move.b mainspr_width(a0),d0
  28755. move.w x_pos(a0),d3
  28756. sub.w (a4),d3
  28757. move.w d3,d1
  28758. add.w d0,d1
  28759. bmi.w BuildSprites_P2_MultiDraw_NextObj
  28760. move.w d3,d1
  28761. sub.w d0,d1
  28762. cmpi.w #320,d1
  28763. bge.w BuildSprites_P2_MultiDraw_NextObj
  28764. addi.w #128,d3
  28765. btst #4,d4
  28766. beq.s +
  28767. moveq #0,d0
  28768. move.b mainspr_height(a0),d0
  28769. move.w y_pos(a0),d2
  28770. sub.w 4(a4),d2
  28771. move.w d2,d1
  28772. add.w d0,d1
  28773. bmi.w BuildSprites_P2_MultiDraw_NextObj
  28774. move.w d2,d1
  28775. sub.w d0,d1
  28776. cmpi.w #224,d1
  28777. bge.w BuildSprites_P2_MultiDraw_NextObj
  28778. addi.w #256+224,d2
  28779. bra.s ++
  28780. +
  28781. move.w y_pos(a0),d2
  28782. sub.w 4(a4),d2
  28783. addi.w #128,d2
  28784. cmpi.w #-32+128,d2
  28785. blo.s BuildSprites_P2_MultiDraw_NextObj
  28786. cmpi.w #32+128+224,d2
  28787. bhs.s BuildSprites_P2_MultiDraw_NextObj
  28788. addi.w #128+224,d2
  28789. +
  28790. moveq #0,d1
  28791. move.b mainspr_mapframe(a0),d1
  28792. beq.s +
  28793. add.w d1,d1
  28794. movea.l a5,a1
  28795. adda.w (a1,d1.w),a1
  28796. move.w (a1)+,d1
  28797. subq.w #1,d1
  28798. bmi.s +
  28799. move.w d4,-(sp)
  28800. bsr.w ChkDrawSprite_2P
  28801. move.w (sp)+,d4
  28802. +
  28803. ori.b #$80,render_flags(a0)
  28804. lea sub2_x_pos(a0),a6
  28805. moveq #0,d0
  28806. move.b mainspr_childsprites(a0),d0
  28807. subq.w #1,d0
  28808. bcs.s BuildSprites_P2_MultiDraw_NextObj
  28809.  
  28810. - swap d0
  28811. move.w (a6)+,d3
  28812. sub.w (a4),d3
  28813. addi.w #128,d3
  28814. move.w (a6)+,d2
  28815. sub.w 4(a4),d2
  28816. addi.w #256+224,d2
  28817. addq.w #1,a6
  28818. moveq #0,d1
  28819. move.b (a6)+,d1
  28820. add.w d1,d1
  28821. movea.l a5,a1
  28822. adda.w (a1,d1.w),a1
  28823. move.w (a1)+,d1
  28824. subq.w #1,d1
  28825. bmi.s +
  28826. move.w d4,-(sp)
  28827. bsr.w ChkDrawSprite_2P
  28828. move.w (sp)+,d4
  28829. +
  28830. swap d0
  28831. dbf d0,-
  28832. ; loc_16D68:
  28833. BuildSprites_P2_MultiDraw_NextObj:
  28834. movea.l (sp)+,a4
  28835. bra.w BuildSprites_P2_NextObj
  28836.  
  28837. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  28838.  
  28839. ; adjust art pointer of object at a0 for 2-player mode
  28840. ; sub_16D6E:
  28841. Adjust2PArtPointer:
  28842. tst.w (Two_player_mode).w
  28843. beq.s + ; rts
  28844. move.w art_tile(a0),d0
  28845. andi.w #tile_mask,d0
  28846. lsr.w #1,d0
  28847. andi.w #nontile_mask,art_tile(a0)
  28848. add.w d0,art_tile(a0)
  28849. +
  28850. rts
  28851. ; End of function Adjust2PArtPointer
  28852.  
  28853.  
  28854. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  28855.  
  28856. ; adjust art pointer of object at a1 for 2-player mode
  28857. ; sub_16D8A:
  28858. Adjust2PArtPointer2:
  28859. tst.w (Two_player_mode).w
  28860. beq.s + ; rts
  28861. move.w art_tile(a1),d0
  28862. andi.w #tile_mask,d0
  28863. lsr.w #1,d0
  28864. andi.w #nontile_mask,art_tile(a1)
  28865. add.w d0,art_tile(a1)
  28866. +
  28867. rts
  28868. ; End of function Adjust2PArtPointer2
  28869.  
  28870.  
  28871. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  28872.  
  28873. ; sub_16DA6:
  28874. ChkDrawSprite_2P:
  28875. cmpi.b #80,d5
  28876. blo.s DrawSprite_2P_Loop
  28877. rts
  28878. ; End of function ChkDrawSprite_2P
  28879.  
  28880.  
  28881. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  28882.  
  28883. ; copy sprite art to VRAM, in 2-player mode
  28884.  
  28885. ; sub_16DAE:
  28886. DrawSprite_2P:
  28887. movea.w art_tile(a0),a3
  28888. cmpi.b #80,d5
  28889. bhs.s DrawSprite_2P_Done
  28890. btst #0,d4
  28891. bne.s DrawSprite_2P_FlipX
  28892. btst #1,d4
  28893. bne.w DrawSprite_2P_FlipY
  28894. ; loc_16DC6:
  28895. DrawSprite_2P_Loop:
  28896. move.b (a1)+,d0
  28897. ext.w d0
  28898. add.w d2,d0
  28899. move.w d0,(a2)+
  28900. move.b (a1)+,d4
  28901. move.b SpriteSizes_2P(pc,d4.w),(a2)+
  28902. addq.b #1,d5
  28903. move.b d5,(a2)+
  28904. addq.w #2,a1
  28905. move.w (a1)+,d0
  28906. add.w a3,d0
  28907. move.w d0,(a2)+
  28908. move.w (a1)+,d0
  28909. add.w d3,d0
  28910. andi.w #$1FF,d0
  28911. bne.s +
  28912. addq.w #1,d0
  28913. +
  28914. move.w d0,(a2)+
  28915. dbf d1,DrawSprite_2P_Loop
  28916. ; return_16DF2:
  28917. DrawSprite_2P_Done:
  28918. rts
  28919. ; ===========================================================================
  28920. ; cells are double the height in 2P mode, so halve the number of rows
  28921.  
  28922. ;byte_16DF4:
  28923. SpriteSizes_2P:
  28924. dc.b 0,0
  28925. dc.b 1,1
  28926. dc.b 4,4
  28927. dc.b 5,5
  28928. dc.b 8,8
  28929. dc.b 9,9
  28930. dc.b $C,$C
  28931. dc.b $D,$D
  28932. ; ===========================================================================
  28933. ; loc_16E04:
  28934. DrawSprite_2P_FlipX:
  28935. btst #1,d4
  28936. bne.w DrawSprite_2P_FlipXY
  28937.  
  28938. - move.b (a1)+,d0
  28939. ext.w d0
  28940. add.w d2,d0
  28941. move.w d0,(a2)+
  28942. move.b (a1)+,d4
  28943. move.b SpriteSizes_2P(pc,d4.w),(a2)+
  28944. addq.b #1,d5
  28945. move.b d5,(a2)+
  28946. addq.w #2,a1
  28947. move.w (a1)+,d0
  28948. add.w a3,d0
  28949. eori.w #$800,d0
  28950. move.w d0,(a2)+
  28951. move.w (a1)+,d0
  28952. neg.w d0
  28953. move.b byte_16E46(pc,d4.w),d4
  28954. sub.w d4,d0
  28955. add.w d3,d0
  28956. andi.w #$1FF,d0
  28957. bne.s +
  28958. addq.w #1,d0
  28959. +
  28960. move.w d0,(a2)+
  28961. dbf d1,-
  28962.  
  28963. rts
  28964. ; ===========================================================================
  28965. ; offsets for horizontally mirrored sprite pieces (2P)
  28966. byte_16E46:
  28967. dc.b 8, 8, 8, 8 ; 4
  28968. dc.b $10,$10,$10,$10 ; 8
  28969. dc.b $18,$18,$18,$18 ; 12
  28970. dc.b $20,$20,$20,$20 ; 16
  28971. ; offsets for vertically mirrored sprite pieces (2P)
  28972. byte_16E56:
  28973. dc.b 8,$10,$18,$20 ; 4
  28974. dc.b 8,$10,$18,$20 ; 8
  28975. dc.b 8,$10,$18,$20 ; 12
  28976. dc.b 8,$10,$18,$20 ; 16
  28977. ; ===========================================================================
  28978. ; loc_16E66:
  28979. DrawSprite_2P_FlipY:
  28980. move.b (a1)+,d0
  28981. move.b (a1),d4
  28982. ext.w d0
  28983. neg.w d0
  28984. move.b byte_16E56(pc,d4.w),d4
  28985. sub.w d4,d0
  28986. add.w d2,d0
  28987. move.w d0,(a2)+
  28988. move.b (a1)+,d4
  28989. move.b SpriteSizes_2P_2(pc,d4.w),(a2)+
  28990. addq.b #1,d5
  28991. move.b d5,(a2)+
  28992. addq.w #2,a1
  28993. move.w (a1)+,d0
  28994. add.w a3,d0
  28995. eori.w #$1000,d0
  28996. move.w d0,(a2)+
  28997. move.w (a1)+,d0
  28998. add.w d3,d0
  28999. andi.w #$1FF,d0
  29000. bne.s +
  29001. addq.w #1,d0
  29002. +
  29003. move.w d0,(a2)+
  29004. dbf d1,DrawSprite_2P_FlipY
  29005. rts
  29006. ; ===========================================================================
  29007. ; cells are double the height in 2P mode, so halve the number of rows
  29008.  
  29009. ; byte_16EA2:
  29010. SpriteSizes_2P_2:
  29011. dc.b 0,0
  29012. dc.b 1,1 ; 2
  29013. dc.b 4,4 ; 4
  29014. dc.b 5,5 ; 6
  29015. dc.b 8,8 ; 8
  29016. dc.b 9,9 ; 10
  29017. dc.b $C,$C ; 12
  29018. dc.b $D,$D ; 14
  29019. ; offsets for vertically mirrored sprite pieces (2P)
  29020. byte_16EB2:
  29021. dc.b 8,$10,$18,$20 ; 4
  29022. dc.b 8,$10,$18,$20 ; 8
  29023. dc.b 8,$10,$18,$20 ; 12
  29024. dc.b 8,$10,$18,$20 ; 16
  29025. ; ===========================================================================
  29026. ; loc_16EC2:
  29027. DrawSprite_2P_FlipXY:
  29028. move.b (a1)+,d0
  29029. move.b (a1),d4
  29030. ext.w d0
  29031. neg.w d0
  29032. move.b byte_16EB2(pc,d4.w),d4
  29033. sub.w d4,d0
  29034. add.w d2,d0
  29035. move.w d0,(a2)+
  29036. move.b (a1)+,d4
  29037. move.b SpriteSizes_2P_2(pc,d4.w),(a2)+
  29038. addq.b #1,d5
  29039. move.b d5,(a2)+
  29040. addq.w #2,a1
  29041. move.w (a1)+,d0
  29042. add.w a3,d0
  29043. eori.w #$1800,d0
  29044. move.w d0,(a2)+
  29045. move.w (a1)+,d0
  29046. neg.w d0
  29047. move.b byte_16F06(pc,d4.w),d4
  29048. sub.w d4,d0
  29049. add.w d3,d0
  29050. andi.w #$1FF,d0
  29051. bne.s +
  29052. addq.w #1,d0
  29053. +
  29054. move.w d0,(a2)+
  29055. dbf d1,DrawSprite_2P_FlipXY
  29056. rts
  29057. ; End of function DrawSprite_2P
  29058.  
  29059. ; ===========================================================================
  29060. ; offsets for horizontally mirrored sprite pieces (2P)
  29061. byte_16F06:
  29062. dc.b 8, 8, 8, 8 ; 4
  29063. dc.b $10,$10,$10,$10 ; 8
  29064. dc.b $18,$18,$18,$18 ; 12
  29065. dc.b $20,$20,$20,$20 ; 16
  29066.  
  29067. ; ===========================================================================
  29068. ; loc_16F16: ; unused/dead code? ; a0=object
  29069. move.w x_pos(a0),d0
  29070. sub.w (Camera_X_pos).w,d0
  29071. bmi.s +
  29072. cmpi.w #320,d0
  29073. bge.s +
  29074. move.w y_pos(a0),d1
  29075. sub.w (Camera_Y_pos).w,d1
  29076. bmi.s +
  29077. cmpi.w #$E0,d1
  29078. bge.s +
  29079. moveq #0,d0
  29080. rts
  29081. + moveq #1,d0
  29082. rts
  29083. ; ===========================================================================
  29084. ; loc_16F3E: ; unused/dead code? ; a0=object
  29085. moveq #0,d1
  29086. move.b width_pixels(a0),d1
  29087. move.w x_pos(a0),d0
  29088. sub.w (Camera_X_pos).w,d0
  29089. add.w d1,d0
  29090. bmi.s +
  29091. add.w d1,d1
  29092. sub.w d1,d0
  29093. cmpi.w #320,d0
  29094. bge.s +
  29095. move.w y_pos(a0),d1
  29096. sub.w (Camera_Y_pos).w,d1
  29097. bmi.s +
  29098. cmpi.w #$E0,d1
  29099. bge.s +
  29100. moveq #0,d0
  29101. rts
  29102. + moveq #1,d0
  29103. rts
  29104. ; ===========================================================================
  29105.  
  29106. if gameRevision=1
  29107. nop
  29108. endif
  29109.  
  29110. if ~~removeJmpTos
  29111. JmpTo_BuildHUD
  29112. jmp (BuildHUD).l
  29113. JmpTo_BuildHUD_P1
  29114. jmp (BuildHUD_P1).l
  29115. JmpTo_BuildHUD_P2
  29116. jmp (BuildHUD_P2).l
  29117.  
  29118. align 4
  29119. endif
  29120.  
  29121.  
  29122.  
  29123.  
  29124. ; ===========================================================================
  29125. ; ----------------------------------------------------------------------------
  29126. ; Pseudo-object that manages where rings are placed onscreen
  29127. ; as you move through the level, and otherwise updates them.
  29128. ; ----------------------------------------------------------------------------
  29129.  
  29130. ; loc_16F88:
  29131. RingsManager:
  29132. moveq #0,d0
  29133. move.b (Rings_manager_routine).w,d0
  29134. move.w RingsManager_States(pc,d0.w),d0
  29135. jmp RingsManager_States(pc,d0.w)
  29136. ; ===========================================================================
  29137. ; off_16F96:
  29138. RingsManager_States: offsetTable
  29139. offsetTableEntry.w RingsManager_Init ; 0
  29140. offsetTableEntry.w RingsManager_Main ; 2
  29141. ; ===========================================================================
  29142. ; loc_16F9A:
  29143. RingsManager_Init:
  29144. addq.b #2,(Rings_manager_routine).w ; => RingsManager_Main
  29145. bsr.w RingsManager_Setup ; perform initial setup
  29146. lea (Ring_Positions).w,a1
  29147. move.w (Camera_X_pos).w,d4
  29148. subq.w #8,d4
  29149. bhi.s +
  29150. moveq #1,d4 ; no negative values allowed
  29151. bra.s +
  29152. -
  29153. lea 6(a1),a1 ; load next ring
  29154. +
  29155. cmp.w 2(a1),d4 ; is the X pos of the ring < camera X pos?
  29156. bhi.s - ; if it is, check next ring
  29157. move.w a1,(Ring_start_addr).w ; set start addresses
  29158. move.w a1,(Ring_start_addr_P2).w
  29159. addi.w #320+16,d4 ; advance by a screen
  29160. bra.s +
  29161. -
  29162. lea 6(a1),a1 ; load next ring
  29163. +
  29164. cmp.w 2(a1),d4 ; is the X pos of the ring < camera X + 336?
  29165. bhi.s - ; if it is, check next ring
  29166. move.w a1,(Ring_end_addr).w ; set end addresses
  29167. move.w a1,(Ring_end_addr_P2).w
  29168. rts
  29169. ; ===========================================================================
  29170. ; loc_16FDE:
  29171. RingsManager_Main:
  29172. lea (Ring_consumption_table).w,a2
  29173. move.w (a2)+,d1
  29174. subq.w #1,d1 ; are any rings currently being consumed?
  29175. bcs.s ++ ; if not, branch
  29176.  
  29177. - move.w (a2)+,d0 ; is there a ring in this slot?
  29178. beq.s - ; if not, branch
  29179. movea.w d0,a1 ; load ring address
  29180. subq.b #1,(a1) ; decrement timer
  29181. bne.s + ; if it's not 0 yet, branch
  29182. move.b #6,(a1) ; reset timer
  29183. addq.b #1,1(a1); increment frame
  29184. cmpi.b #8,1(a1); is it destruction time yet?
  29185. bne.s + ; if not, branch
  29186. move.w #-1,(a1); destroy ring
  29187. move.w #0,-2(a2) ; clear ring entry
  29188. subq.w #1,(Ring_consumption_table).w ; subtract count
  29189. + dbf d1,- ; repeat for all rings in table
  29190. +
  29191. ; update ring start and end addresses
  29192. movea.w (Ring_start_addr).w,a1
  29193. move.w (Camera_X_pos).w,d4
  29194. subq.w #8,d4
  29195. bhi.s +
  29196. moveq #1,d4
  29197. bra.s +
  29198. -
  29199. lea 6(a1),a1
  29200. +
  29201. cmp.w 2(a1),d4
  29202. bhi.s -
  29203. bra.s +
  29204. -
  29205. subq.w #6,a1
  29206. +
  29207. cmp.w -4(a1),d4
  29208. bls.s -
  29209. move.w a1,(Ring_start_addr).w ; update start address
  29210.  
  29211. movea.w (Ring_end_addr).w,a2
  29212. addi.w #320+16,d4
  29213. bra.s +
  29214. -
  29215. lea 6(a2),a2
  29216. +
  29217. cmp.w 2(a2),d4
  29218. bhi.s -
  29219. bra.s +
  29220. -
  29221. subq.w #6,a2
  29222. +
  29223. cmp.w -4(a2),d4
  29224. bls.s -
  29225. move.w a2,(Ring_end_addr).w ; update end address
  29226. tst.w (Two_player_mode).w ; are we in 2P mode?
  29227. bne.s + ; if we are, update P2 addresses
  29228. move.w a1,(Ring_start_addr_P2).w ; otherwise, copy over P1 addresses
  29229. move.w a2,(Ring_end_addr_P2).w
  29230. rts
  29231. +
  29232. ; update ring start and end addresses for P2
  29233. movea.w (Ring_start_addr_P2).w,a1
  29234. move.w (Camera_X_pos_P2).w,d4
  29235. subq.w #8,d4
  29236. bhi.s +
  29237. moveq #1,d4
  29238. bra.s +
  29239. -
  29240. lea 6(a1),a1
  29241. +
  29242. cmp.w 2(a1),d4
  29243. bhi.s -
  29244. bra.s +
  29245. -
  29246. subq.w #6,a1
  29247. +
  29248. cmp.w -4(a1),d4
  29249. bls.s -
  29250. move.w a1,(Ring_start_addr_P2).w ; update start address
  29251.  
  29252. movea.w (Ring_end_addr_P2).w,a2
  29253. addi.w #320+16,d4
  29254. bra.s +
  29255. -
  29256. lea 6(a2),a2
  29257. +
  29258. cmp.w 2(a2),d4
  29259. bhi.s -
  29260. bra.s +
  29261. -
  29262. subq.w #6,a2
  29263. +
  29264. cmp.w -4(a2),d4
  29265. bls.s -
  29266. move.w a2,(Ring_end_addr_P2).w ; update end address
  29267. rts
  29268.  
  29269. ; ---------------------------------------------------------------------------
  29270. ; Subroutine to handle ring collision
  29271. ; ---------------------------------------------------------------------------
  29272.  
  29273. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  29274.  
  29275. ; loc_170BA:
  29276. Touch_Rings:
  29277. movea.w (Ring_start_addr).w,a1
  29278. movea.w (Ring_end_addr).w,a2
  29279. cmpa.w #MainCharacter,a0
  29280. beq.s +
  29281. movea.w (Ring_start_addr_P2).w,a1
  29282. movea.w (Ring_end_addr_P2).w,a2
  29283. +
  29284. cmpa.l a1,a2 ; are there no rings in this area?
  29285. beq.w Touch_Rings_Done ; if so, return
  29286. cmpi.w #$5A,invulnerable_time(a0)
  29287. bhs.w Touch_Rings_Done
  29288. move.w x_pos(a0),d2
  29289. move.w y_pos(a0),d3
  29290. subi_.w #8,d2 ; assume X radius to be 8
  29291. moveq #0,d5
  29292. move.b y_radius(a0),d5
  29293. subq.b #3,d5
  29294. sub.w d5,d3 ; subtract (Y radius - 3) from Y pos
  29295. cmpi.b #$4D,mapping_frame(a0)
  29296. bne.s + ; if you're not ducking, branch
  29297. addi.w #$C,d3
  29298. moveq #$A,d5
  29299. +
  29300. move.w #6,d1 ; set ring radius
  29301. move.w #12,d6 ; set ring diameter
  29302. move.w #16,d4 ; set Sonic's X diameter
  29303. add.w d5,d5 ; set Y diameter
  29304. ; loc_17112:
  29305. Touch_Rings_Loop:
  29306. tst.w (a1) ; has this ring already been collided with?
  29307. bne.w Touch_NextRing ; if it has, branch
  29308. move.w 2(a1),d0 ; get ring X pos
  29309. sub.w d1,d0 ; get ring left edge X pos
  29310. sub.w d2,d0 ; subtract Sonic's left edge X pos
  29311. bcc.s + ; if Sonic's to the left of the ring, branch
  29312. add.w d6,d0 ; add ring diameter
  29313. bcs.s ++ ; if Sonic's colliding, branch
  29314. bra.w Touch_NextRing ; otherwise, test next ring
  29315. +
  29316. cmp.w d4,d0 ; has Sonic crossed the ring?
  29317. bhi.w Touch_NextRing ; if he has, branch
  29318. +
  29319. move.w 4(a1),d0 ; get ring Y pos
  29320. sub.w d1,d0 ; get ring top edge pos
  29321. sub.w d3,d0 ; subtract Sonic's top edge pos
  29322. bcc.s + ; if Sonic's above the ring, branch
  29323. add.w d6,d0 ; add ring diameter
  29324. bcs.s ++ ; if Sonic's colliding, branch
  29325. bra.w Touch_NextRing ; otherwise, test next ring
  29326. +
  29327. cmp.w d5,d0 ; has Sonic crossed the ring?
  29328. bhi.w Touch_NextRing ; if he has, branch
  29329. +
  29330. move.w #$604,(a1) ; set frame and destruction timer
  29331. bsr.s Touch_ConsumeRing
  29332. lea (Ring_consumption_table+2).w,a3
  29333.  
  29334. - tst.w (a3)+ ; is this slot free?
  29335. bne.s - ; if not, repeat until you find one
  29336. move.w a1,-(a3) ; set ring address
  29337. addq.w #1,(Ring_consumption_table).w ; increase count
  29338. ; loc_1715C:
  29339. Touch_NextRing:
  29340. lea 6(a1),a1
  29341. cmpa.l a1,a2 ; are we at the last ring for this area?
  29342. bne.w Touch_Rings_Loop ; if not, branch
  29343. ; return_17166:
  29344. Touch_Rings_Done:
  29345. rts
  29346. ; ===========================================================================
  29347. ; loc_17168:
  29348. Touch_ConsumeRing:
  29349. subq.w #1,(Perfect_rings_left).w
  29350. cmpa.w #MainCharacter,a0 ; who collected the ring?
  29351. beq.w CollectRing_Sonic ; if it was Sonic, branch here
  29352. bra.w CollectRing_Tails ; if it was Tails, branch here
  29353.  
  29354. ; ---------------------------------------------------------------------------
  29355. ; Subroutine to draw on-screen rings
  29356. ; ---------------------------------------------------------------------------
  29357.  
  29358. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  29359.  
  29360. ; loc_17178:
  29361. BuildRings:
  29362. movea.w (Ring_start_addr).w,a0
  29363. movea.w (Ring_end_addr).w,a4
  29364. cmpa.l a0,a4 ; are there any rings on-screen?
  29365. bne.s + ; if there are, branch
  29366. rts ; otherwise, return
  29367. +
  29368. lea (Camera_X_pos).w,a3
  29369. ; loc_1718A:
  29370. BuildRings_Loop:
  29371. tst.w (a0) ; has this ring been consumed?
  29372. bmi.w BuildRings_NextRing ; if it has, branch
  29373. move.w 2(a0),d3 ; get ring X pos
  29374. sub.w (a3),d3 ; subtract camera X pos
  29375. addi.w #128,d3 ; screen top is 128x128 not 0x0
  29376. move.w 4(a0),d2 ; get ring Y pos
  29377. sub.w 4(a3),d2 ; subtract camera Y pos
  29378. andi.w #$7FF,d2
  29379. addi_.w #8,d2
  29380. bmi.s BuildRings_NextRing ; dunno how this check is supposed to work
  29381. cmpi.w #240,d2
  29382. bge.s BuildRings_NextRing ; if the ring is not on-screen, branch
  29383. addi.w #128-8,d2
  29384. lea (MapUnc_Rings).l,a1
  29385. moveq #0,d1
  29386. move.b 1(a0),d1 ; get ring frame
  29387. bne.s + ; if this ring is using a specific frame, branch
  29388. move.b (Rings_anim_frame).w,d1 ; use global frame
  29389. +
  29390. add.w d1,d1
  29391. adda.w (a1,d1.w),a1 ; get frame data address
  29392. move.b (a1)+,d0 ; get Y offset
  29393. ext.w d0
  29394. add.w d2,d0 ; add Y offset to Y pos
  29395. move.w d0,(a2)+ ; set Y pos
  29396. move.b (a1)+,(a2)+ ; set size
  29397. addq.b #1,d5
  29398. move.b d5,(a2)+ ; set link field
  29399. move.w (a1)+,d0 ; get art tile
  29400. addi.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),d0 ; add base art tile
  29401. move.w d0,(a2)+ ; set art tile and flags
  29402. addq.w #2,a1 ; skip 2P art tile
  29403. move.w (a1)+,d0 ; get X offset
  29404. add.w d3,d0 ; add base X pos
  29405. move.w d0,(a2)+ ; set X pos
  29406. ; loc_171EC:
  29407. BuildRings_NextRing:
  29408. lea 6(a0),a0
  29409. cmpa.l a0,a4
  29410. bne.w BuildRings_Loop
  29411. rts
  29412.  
  29413. ; ---------------------------------------------------------------------------
  29414. ; Subroutine to draw on-screen rings for player 1 in a 2P versus game
  29415. ; ---------------------------------------------------------------------------
  29416.  
  29417. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  29418.  
  29419. ; loc_171F8:
  29420. BuildRings_P1:
  29421. lea (Camera_X_pos).w,a3
  29422. move.w #128-8,d6
  29423. movea.w (Ring_start_addr).w,a0
  29424. movea.w (Ring_end_addr).w,a4
  29425. cmpa.l a0,a4 ; are there rings on-screen?
  29426. bne.s BuildRings_2P_Loop ; if there are, draw them
  29427. rts ; otherwise, return
  29428.  
  29429. ; ---------------------------------------------------------------------------
  29430. ; Subroutine to draw on-screen rings for player 2 in a 2P versus game
  29431. ; ---------------------------------------------------------------------------
  29432.  
  29433. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  29434.  
  29435. ; loc_1720E:
  29436. BuildRings_P2:
  29437. lea (Camera_X_pos_P2).w,a3
  29438. move.w #224+128-8,d6
  29439. movea.w (Ring_start_addr_P2).w,a0
  29440. movea.w (Ring_end_addr_P2).w,a4
  29441. cmpa.l a0,a4 ; are there rings on-screen?
  29442. bne.s BuildRings_2P_Loop ; if there are, draw them
  29443. rts ; otherwise, return
  29444. ; ===========================================================================
  29445. ; loc_17224:
  29446. BuildRings_2P_Loop:
  29447. tst.w (a0) ; has this ring been consumed?
  29448. bmi.w BuildRings_2P_NextRing ; if it has, branch
  29449. move.w 2(a0),d3 ; get ring X pos
  29450. sub.w (a3),d3 ; subtract camera X pos
  29451. addi.w #128,d3
  29452. move.w 4(a0),d2 ; get ring Y pos
  29453. sub.w 4(a3),d2 ; subtract camera Y pos
  29454. andi.w #$7FF,d2
  29455. addi.w #128+8,d2
  29456. bmi.s BuildRings_2P_NextRing
  29457. cmpi.w #240+128,d2
  29458. bge.s BuildRings_2P_NextRing
  29459. add.w d6,d2 ; add base Y pos
  29460. lea (MapUnc_Rings).l,a1
  29461. moveq #0,d1
  29462. move.b 1(a0),d1 ; use ring-specific frame
  29463. bne.s + ; if there is one
  29464. move.b (Rings_anim_frame).w,d1 ; otherwise use global frame
  29465. +
  29466. add.w d1,d1
  29467. adda.w (a1,d1.w),a1
  29468. move.b (a1)+,d0
  29469. ext.w d0
  29470. add.w d2,d0
  29471. move.w d0,(a2)+ ; set Y pos
  29472. move.b (a1)+,d4
  29473. move.b SpriteSizes_2P_3(pc,d4.w),(a2)+ ; set size
  29474. addq.b #1,d5
  29475. move.b d5,(a2)+ ; set link field
  29476. addq.w #2,a1
  29477. move.w (a1)+,d0
  29478. addi.w #make_art_tile_2p(ArtTile_ArtNem_Ring,1,0),d0
  29479. move.w d0,(a2)+ ; set art tile and flags
  29480. move.w (a1)+,d0
  29481. add.w d3,d0
  29482. move.w d0,(a2)+ ; set X pos
  29483.  
  29484. BuildRings_2P_NextRing:
  29485. lea 6(a0),a0 ; load next ring
  29486. cmpa.l a0,a4 ; are there any rings left?
  29487. bne.w BuildRings_2P_Loop ; if there are, loop
  29488. rts
  29489. ; ===========================================================================
  29490. ; cells are double the height in 2P mode, so halve the number of rows
  29491.  
  29492. ; byte_17294:
  29493. SpriteSizes_2P_3:
  29494. dc.b 0,0 ; 1
  29495. dc.b 1,1 ; 3
  29496. dc.b 4,4 ; 5
  29497. dc.b 5,5 ; 7
  29498. dc.b 8,8 ; 9
  29499. dc.b 9,9 ; 11
  29500. dc.b $C,$C ; 13
  29501. dc.b $D,$D ; 15
  29502.  
  29503. ; ---------------------------------------------------------------------------
  29504. ; Subroutine to perform initial rings manager setup
  29505. ; ---------------------------------------------------------------------------
  29506.  
  29507. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  29508.  
  29509. ; loc_172A4:
  29510. RingsManager_Setup:
  29511. clearRAM Ring_Positions,Ring_Positions_End
  29512. ; d0 = 0
  29513. lea (Ring_consumption_table).w,a1
  29514.  
  29515. move.w #bytesToLcnt(Ring_consumption_table_End-Ring_consumption_table-$40),d1 ; coding error, that '-$40' shouldn't be there
  29516. - move.l d0,(a1)+ ; only half of Ring_consumption_table is cleared
  29517. dbf d1,-
  29518.  
  29519. moveq #0,d5
  29520. moveq #0,d0
  29521. move.w (Current_ZoneAndAct).w,d0
  29522. ror.b #1,d0
  29523. lsr.w #6,d0
  29524. lea (Off_Rings).l,a1
  29525. move.w (a1,d0.w),d0
  29526. lea (a1,d0.w),a1
  29527. lea (Ring_Positions+6).w,a2 ; first ring is left blank
  29528. ; loc_172E0:
  29529. RingsMgr_NextRowOrCol:
  29530. move.w (a1)+,d2 ; is this the last ring?
  29531. bmi.s RingsMgr_SortRings ; if it is, sort the rings
  29532. move.w (a1)+,d3 ; is this a column of rings?
  29533. bmi.s RingsMgr_RingCol ; if it is, branch
  29534. move.w d3,d0
  29535. rol.w #4,d0
  29536. andi.w #7,d0 ; store number of rings
  29537. andi.w #$FFF,d3 ; store Y pos
  29538. ; loc_172F4:
  29539. RingsMgr_NextRingInRow:
  29540. move.w #0,(a2)+ ; set initial status
  29541. move.w d2,(a2)+ ; set X pos
  29542. move.w d3,(a2)+ ; set Y pos
  29543. addi.w #$18,d2 ; increment X pos
  29544. addq.w #1,d5 ; increment perfect counter
  29545. dbf d0,RingsMgr_NextRingInRow
  29546. bra.s RingsMgr_NextRowOrCol
  29547. ; ===========================================================================
  29548. ; loc_17308:
  29549. RingsMgr_RingCol:
  29550. move.w d3,d0
  29551. rol.w #4,d0
  29552. andi.w #7,d0 ; store number of rings
  29553. andi.w #$FFF,d3 ; store Y pos
  29554. ; loc_17314:
  29555. RingsMgr_NextRingInCol:
  29556. move.w #0,(a2)+ ; set initial status
  29557. move.w d2,(a2)+ ; set X pos
  29558. move.w d3,(a2)+ ; set Y pos
  29559. addi.w #$18,d3 ; increment Y pos
  29560. addq.w #1,d5 ; increment perfect counter
  29561. dbf d0,RingsMgr_NextRingInCol
  29562. bra.s RingsMgr_NextRowOrCol
  29563. ; ===========================================================================
  29564. ; loc_17328:
  29565. RingsMgr_SortRings:
  29566. move.w d5,(Perfect_rings_left).w
  29567. move.w #0,(Perfect_rings_flag).w ; no idea what this is
  29568. moveq #-1,d0
  29569. move.l d0,(a2)+ ; set X pos of last ring to -1
  29570. lea (Ring_Positions+2).w,a1 ; X pos of first ring
  29571.  
  29572. move.w #$FE,d3 ; sort 255 rings
  29573. - move.w d3,d4
  29574. lea 6(a1),a2 ; load next ring for comparison
  29575. move.w (a1),d0 ; get X pos of current ring
  29576.  
  29577. - tst.w (a2) ; is the next ring blank?
  29578. beq.s + ; if it is, branch
  29579. cmp.w (a2),d0 ; is the X pos of current ring <= X pos of next ring?
  29580. bls.s + ; if so, branch
  29581. move.l (a1),d1 ; otherwise, swap the rings
  29582. move.l (a2),d0
  29583. move.l d0,(a1)
  29584. move.l d1,(a2)
  29585. swap d0
  29586. +
  29587. lea 6(a2),a2 ; load next comparison ring
  29588. dbf d4,- ; repeat
  29589.  
  29590. lea 6(a1),a1 ; load next ring
  29591. dbf d3,-- ; repeat
  29592.  
  29593. rts
  29594. ; ===========================================================================
  29595.  
  29596. ; -------------------------------------------------------------------------------
  29597. ; sprite mappings
  29598. ; -------------------------------------------------------------------------------
  29599.  
  29600. ; off_1736A:
  29601. MapUnc_Rings: BINCLUDE "mappings/sprite/Rings.bin"
  29602.  
  29603. if ~~removeJmpTos
  29604. align 4
  29605. endif
  29606.  
  29607.  
  29608.  
  29609.  
  29610. ; ---------------------------------------------------------------------------
  29611. ; Pseudo-object to do collision with (and initialize?) the special bumpers in CNZ.
  29612. ; These are the bumpers that are part of the level layout but have object-like collision.
  29613. ; ---------------------------------------------------------------------------
  29614.  
  29615. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  29616.  
  29617. ; loc_173BC:
  29618. SpecialCNZBumpers:
  29619. moveq #0,d0
  29620. move.b (CNZ_Bumper_routine).w,d0
  29621. move.w SpecialCNZBumpers_Index(pc,d0.w),d0
  29622. jmp SpecialCNZBumpers_Index(pc,d0.w)
  29623. ; ===========================================================================
  29624. ; off_173CA:
  29625. SpecialCNZBumpers_Index: offsetTable
  29626. offsetTableEntry.w SpecialCNZBumpers_Init ; 0
  29627. offsetTableEntry.w SpecialCNZBumpers_Main ; 2
  29628. ; ===========================================================================
  29629. ; loc_173CE:
  29630. SpecialCNZBumpers_Init:
  29631. addq.b #2,(CNZ_Bumper_routine).w
  29632. lea (SpecialCNZBumpers_Act1).l,a1
  29633. tst.b (Current_Act).w
  29634. beq.s +
  29635. lea (SpecialCNZBumpers_Act2).l,a1
  29636. +
  29637. move.w (Camera_X_pos).w,d4
  29638. subq.w #8,d4
  29639. bhi.s +
  29640. moveq #1,d4
  29641. bra.s +
  29642. ; ===========================================================================
  29643. -
  29644. lea next_bumper(a1),a1
  29645. +
  29646. cmp.w bumper_x(a1),d4
  29647. bhi.s -
  29648. move.l a1,(CNZ_Visible_bumpers_start).w
  29649. move.l a1,(CNZ_Visible_bumpers_start_P2).w
  29650. addi.w #$150,d4
  29651. bra.s +
  29652. ; ===========================================================================
  29653. -
  29654. lea next_bumper(a1),a1
  29655. +
  29656. cmp.w bumper_x(a1),d4
  29657. bhi.s -
  29658. move.l a1,(CNZ_Visible_bumpers_end).w
  29659. move.l a1,(CNZ_Visible_bumpers_end_P2).w
  29660. move.b #1,(CNZ_Bumper_UnkFlag).w
  29661. rts
  29662. ; ===========================================================================
  29663. ; loc_17422:
  29664. SpecialCNZBumpers_Main:
  29665. movea.l (CNZ_Visible_bumpers_start).w,a1
  29666. move.w (Camera_X_pos).w,d4
  29667. subq.w #8,d4
  29668. bhi.s +
  29669. moveq #1,d4
  29670. bra.s +
  29671. ; ===========================================================================
  29672. -
  29673. lea next_bumper(a1),a1
  29674. +
  29675. cmp.w bumper_x(a1),d4
  29676. bhi.s -
  29677. bra.s +
  29678. ; ===========================================================================
  29679. -
  29680. subq.w #next_bumper,a1
  29681. +
  29682. cmp.w prev_bumper_x(a1),d4
  29683. bls.s -
  29684. move.l a1,(CNZ_Visible_bumpers_start).w
  29685. movea.l (CNZ_Visible_bumpers_end).w,a2
  29686. addi.w #$150,d4
  29687. bra.s +
  29688. ; ===========================================================================
  29689. -
  29690. lea next_bumper(a2),a2
  29691. +
  29692. cmp.w bumper_x(a2),d4
  29693. bhi.s -
  29694. bra.s +
  29695. ; ===========================================================================
  29696. -
  29697. subq.w #next_bumper,a2
  29698. +
  29699. cmp.w prev_bumper_x(a2),d4
  29700. bls.s -
  29701. move.l a2,(CNZ_Visible_bumpers_end).w
  29702. tst.w (Two_player_mode).w
  29703. bne.s +
  29704. move.l a1,(CNZ_Visible_bumpers_start_P2).w
  29705. move.l a2,(CNZ_Visible_bumpers_end_P2).w
  29706. rts
  29707. ; ===========================================================================
  29708. +
  29709. movea.l (CNZ_Visible_bumpers_start_P2).w,a1
  29710. move.w (Camera_X_pos_P2).w,d4
  29711. subq.w #8,d4
  29712. bhi.s +
  29713. moveq #1,d4
  29714. bra.s +
  29715. ; ===========================================================================
  29716. -
  29717. lea next_bumper(a1),a1
  29718. +
  29719. cmp.w bumper_x(a1),d4
  29720. bhi.s -
  29721. bra.s +
  29722. ; ===========================================================================
  29723. -
  29724. subq.w #next_bumper,a1
  29725. +
  29726. cmp.w prev_bumper_x(a1),d4
  29727. bls.s -
  29728. move.l a1,(CNZ_Visible_bumpers_start_P2).w
  29729. movea.l (CNZ_Visible_bumpers_end_P2).w,a2
  29730. addi.w #$150,d4
  29731. bra.s +
  29732. ; ===========================================================================
  29733. -
  29734. lea next_bumper(a2),a2
  29735. +
  29736. cmp.w bumper_x(a2),d4
  29737. bhi.s -
  29738. bra.s +
  29739. ; ===========================================================================
  29740. -
  29741. subq.w #next_bumper,a2
  29742. +
  29743. cmp.w prev_bumper_x(a2),d4
  29744. bls.s -
  29745. move.l a2,(CNZ_Visible_bumpers_end_P2).w
  29746. rts
  29747. ; ===========================================================================
  29748.  
  29749. Check_CNZ_bumpers:
  29750. movea.l (CNZ_Visible_bumpers_start).w,a1
  29751. movea.l (CNZ_Visible_bumpers_end).w,a2
  29752. cmpa.w #MainCharacter,a0
  29753. beq.s +
  29754. movea.l (CNZ_Visible_bumpers_start_P2).w,a1
  29755. movea.l (CNZ_Visible_bumpers_end_P2).w,a2
  29756. +
  29757. cmpa.l a1,a2
  29758. beq.w return_17578
  29759. move.w x_pos(a0),d2
  29760. move.w y_pos(a0),d3
  29761. subi.w #9,d2
  29762. moveq #0,d5
  29763. move.b y_radius(a0),d5
  29764. subq.b #3,d5
  29765. sub.w d5,d3
  29766. cmpi.b #$4D,mapping_frame(a0)
  29767. bne.s +
  29768. addi.w #$C,d3
  29769. moveq #$A,d5
  29770. +
  29771. move.w #$12,d4
  29772. add.w d5,d5
  29773.  
  29774. CNZ_Bumper_loop:
  29775. move.w bumper_id(a1),d0
  29776. andi.w #$E,d0
  29777. lea byte_17558(pc,d0.w),a3
  29778. moveq #0,d1
  29779. move.b (a3)+,d1
  29780. move.w bumper_x(a1),d0
  29781. sub.w d1,d0
  29782. sub.w d2,d0
  29783. bcc.s loc_17530
  29784. add.w d1,d1
  29785. add.w d1,d0
  29786. bcs.s loc_17536
  29787. bra.w CNZ_Bumper_next
  29788. ; ===========================================================================
  29789.  
  29790. loc_17530:
  29791. cmp.w d4,d0
  29792. bhi.w CNZ_Bumper_next
  29793.  
  29794. loc_17536:
  29795. moveq #0,d1
  29796. move.b (a3)+,d1
  29797. move.w bumper_y(a1),d0
  29798. sub.w d1,d0
  29799. sub.w d3,d0
  29800. bcc.s loc_17550
  29801. add.w d1,d1
  29802. add.w d1,d0
  29803. bcs.w loc_17564
  29804. bra.w CNZ_Bumper_next
  29805. ; ===========================================================================
  29806.  
  29807. loc_17550:
  29808. cmp.w d5,d0
  29809. bhi.w CNZ_Bumper_next
  29810. bra.s loc_17564
  29811. ; ===========================================================================
  29812. byte_17558:
  29813. dc.b $20
  29814. dc.b $20 ; 1
  29815. dc.b $20 ; 2
  29816. dc.b $20 ; 3
  29817. dc.b $40 ; 4
  29818. dc.b 8 ; 5
  29819. dc.b $40 ; 6
  29820. dc.b 8 ; 7
  29821. dc.b 8 ; 8
  29822. dc.b $40 ; 9
  29823. dc.b 8 ; 10
  29824. dc.b $40 ; 11
  29825. ; ===========================================================================
  29826.  
  29827. loc_17564:
  29828. move.w (a1),d0
  29829. move.w off_1757A(pc,d0.w),d0
  29830. jmp off_1757A(pc,d0.w)
  29831. ; ===========================================================================
  29832.  
  29833. CNZ_Bumper_next:
  29834. lea next_bumper(a1),a1
  29835. cmpa.l a1,a2
  29836. bne.w CNZ_Bumper_loop
  29837.  
  29838. return_17578:
  29839. rts
  29840. ; ===========================================================================
  29841. off_1757A: offsetTable
  29842. offsetTableEntry.w loc_17586 ; 0
  29843. offsetTableEntry.w loc_17638 ; 2
  29844. offsetTableEntry.w loc_1769E ; 4
  29845. offsetTableEntry.w loc_176F6 ; 6
  29846. offsetTableEntry.w loc_1774C ; 8
  29847. offsetTableEntry.w loc_177A4 ; $A
  29848. ; ===========================================================================
  29849.  
  29850. loc_17586:
  29851. move.w bumper_y(a1),d0
  29852. sub.w y_pos(a0),d0
  29853. neg.w d0
  29854. cmpi.w #$20,d0
  29855. blt.s loc_175A0
  29856. move.w #$A00,y_vel(a0)
  29857. bra.w loc_177FA
  29858. ; ===========================================================================
  29859.  
  29860. loc_175A0:
  29861. move.w bumper_x(a1),d0
  29862. sub.w x_pos(a0),d0
  29863. neg.w d0
  29864. cmpi.w #$20,d0
  29865. blt.s loc_175BA
  29866. move.w #$A00,x_vel(a0)
  29867. bra.w loc_177FA
  29868. ; ===========================================================================
  29869.  
  29870. loc_175BA:
  29871. move.w bumper_x(a1),d0
  29872. sub.w x_pos(a0),d0
  29873. cmpi.w #$20,d0
  29874. blt.s loc_175CC
  29875. move.w #$20,d0
  29876.  
  29877. loc_175CC:
  29878. add.w bumper_y(a1),d0
  29879. subq.w #8,d0
  29880. move.w y_pos(a0),d1
  29881. addi.w #$E,d1
  29882. sub.w d1,d0
  29883. bcc.s return_175E8
  29884. move.w #$20,d3
  29885. bsr.s loc_175EA
  29886. bra.w loc_177FA
  29887. ; ===========================================================================
  29888.  
  29889. return_175E8:
  29890. rts
  29891. ; ===========================================================================
  29892.  
  29893. loc_175EA:
  29894. move.w x_vel(a0),d1
  29895. move.w y_vel(a0),d2
  29896. jsr (CalcAngle).l
  29897. move.b d0,(unk_FFDC).w
  29898. sub.w d3,d0
  29899. mvabs.w d0,d1
  29900. neg.w d0
  29901. add.w d3,d0
  29902. move.b d0,(unk_FFDD).w
  29903. move.b d1,(unk_FFDF).w
  29904. cmpi.b #$38,d1
  29905. blo.s loc_17618
  29906. move.w d3,d0
  29907.  
  29908. loc_17618:
  29909. move.b d0,(unk_FFDE).w
  29910. jsr (CalcSine).l
  29911. muls.w #-$A00,d1
  29912. asr.l #8,d1
  29913. move.w d1,x_vel(a0)
  29914. muls.w #-$A00,d0
  29915. asr.l #8,d0
  29916. move.w d0,y_vel(a0)
  29917. rts
  29918. ; ===========================================================================
  29919.  
  29920. loc_17638:
  29921. move.w bumper_y(a1),d0
  29922. sub.w y_pos(a0),d0
  29923. neg.w d0
  29924. cmpi.w #$20,d0
  29925. blt.s loc_17652
  29926. move.w #$A00,y_vel(a0)
  29927. bra.w loc_177FA
  29928. ; ===========================================================================
  29929.  
  29930. loc_17652:
  29931. move.w bumper_x(a1),d0
  29932. sub.w x_pos(a0),d0
  29933. cmpi.w #$20,d0
  29934. blt.s loc_1766A
  29935. move.w #-$A00,x_vel(a0)
  29936. bra.w loc_177FA
  29937. ; ===========================================================================
  29938.  
  29939. loc_1766A:
  29940. move.w bumper_x(a1),d0
  29941. sub.w x_pos(a0),d0
  29942. neg.w d0
  29943. cmpi.w #$20,d0
  29944. blt.s loc_1767E
  29945. move.w #$20,d0
  29946.  
  29947. loc_1767E:
  29948. add.w bumper_y(a1),d0
  29949. subq.w #8,d0
  29950. move.w y_pos(a0),d1
  29951. addi.w #$E,d1
  29952. sub.w d1,d0
  29953. bcc.s return_1769C
  29954. move.w #$60,d3
  29955. bsr.w loc_175EA
  29956. bra.w loc_177FA
  29957. ; ===========================================================================
  29958.  
  29959. return_1769C:
  29960. rts
  29961. ; ===========================================================================
  29962.  
  29963. loc_1769E:
  29964. move.w bumper_y(a1),d0
  29965. sub.w y_pos(a0),d0
  29966. neg.w d0
  29967. cmpi.w #8,d0
  29968. blt.s loc_176B8
  29969. move.w #$A00,y_vel(a0)
  29970. bra.w loc_177FA
  29971. ; ===========================================================================
  29972.  
  29973. loc_176B8:
  29974. move.w bumper_x(a1),d0
  29975. sub.w x_pos(a0),d0
  29976. cmpi.w #$40,d0
  29977. blt.s loc_176D0
  29978. move.w #-$A00,x_vel(a0)
  29979. bra.w loc_177FA
  29980. ; ===========================================================================
  29981.  
  29982. loc_176D0:
  29983. neg.w d0
  29984. cmpi.w #$40,d0
  29985. blt.s loc_176E2
  29986. move.w #$A00,x_vel(a0)
  29987. bra.w loc_177FA
  29988. ; ===========================================================================
  29989.  
  29990. loc_176E2:
  29991. move.w #$38,d3
  29992. tst.w d0
  29993. bmi.s loc_176EE
  29994. move.w #$48,d3
  29995.  
  29996. loc_176EE:
  29997. bsr.w loc_175EA
  29998. bra.w loc_177FA
  29999. ; ===========================================================================
  30000.  
  30001. loc_176F6:
  30002. move.w bumper_y(a1),d0
  30003. sub.w y_pos(a0),d0
  30004. cmpi.w #8,d0
  30005. blt.s loc_1770E
  30006. move.w #-$A00,y_vel(a0)
  30007. bra.w loc_177FA
  30008. ; ===========================================================================
  30009.  
  30010. loc_1770E:
  30011. move.w bumper_x(a1),d0
  30012. sub.w x_pos(a0),d0
  30013. cmpi.w #$40,d0
  30014. blt.s loc_17726
  30015. move.w #-$A00,x_vel(a0)
  30016. bra.w loc_177FA
  30017. ; ===========================================================================
  30018.  
  30019. loc_17726:
  30020. neg.w d0
  30021. cmpi.w #$40,d0
  30022. blt.s loc_17738
  30023. move.w #$A00,x_vel(a0)
  30024. bra.w loc_177FA
  30025. ; ===========================================================================
  30026.  
  30027. loc_17738:
  30028. move.w #$C8,d3
  30029. tst.w d0
  30030. bmi.s loc_17744
  30031. move.w #$B8,d3
  30032.  
  30033. loc_17744:
  30034. bsr.w loc_175EA
  30035. bra.w loc_177FA
  30036. ; ===========================================================================
  30037.  
  30038. loc_1774C:
  30039. move.w bumper_x(a1),d0
  30040. sub.w x_pos(a0),d0
  30041. neg.w d0
  30042. cmpi.w #8,d0
  30043. blt.s loc_17766
  30044. move.w #$A00,x_vel(a0)
  30045. bra.w loc_177FA
  30046. ; ===========================================================================
  30047.  
  30048. loc_17766:
  30049. move.w bumper_y(a1),d0
  30050. sub.w y_pos(a0),d0
  30051. cmpi.w #$40,d0
  30052. blt.s loc_1777E
  30053. move.w #-$A00,y_vel(a0)
  30054. bra.w loc_177FA
  30055. ; ===========================================================================
  30056.  
  30057. loc_1777E:
  30058. neg.w d0
  30059. cmpi.w #$40,d0
  30060. blt.s loc_17790
  30061. move.w #$A00,x_vel(a0)
  30062. bra.w loc_177FA
  30063. ; ===========================================================================
  30064.  
  30065. loc_17790:
  30066. move.w #8,d3
  30067. tst.w d0
  30068. bmi.s loc_1779C
  30069. move.w #$F8,d3
  30070.  
  30071. loc_1779C:
  30072. bsr.w loc_175EA
  30073. bra.w loc_177FA
  30074. ; ===========================================================================
  30075.  
  30076. loc_177A4:
  30077. move.w bumper_x(a1),d0
  30078. sub.w x_pos(a0),d0
  30079. cmpi.w #8,d0
  30080. blt.s loc_177BC
  30081. move.w #$A00,x_vel(a0)
  30082. bra.w loc_177FA
  30083. ; ===========================================================================
  30084.  
  30085. loc_177BC:
  30086. move.w bumper_y(a1),d0
  30087. sub.w y_pos(a0),d0
  30088. cmpi.w #$40,d0
  30089. blt.s loc_177D4
  30090. move.w #-$A00,y_vel(a0)
  30091. bra.w loc_177FA
  30092. ; ===========================================================================
  30093.  
  30094. loc_177D4:
  30095. neg.w d0
  30096. cmpi.w #$40,d0
  30097. blt.s loc_177E6
  30098. move.w #$A00,x_vel(a0)
  30099. bra.w loc_177FA
  30100. ; ===========================================================================
  30101.  
  30102. loc_177E6:
  30103. move.w #$78,d3
  30104. tst.w d0
  30105. bmi.s loc_177F2
  30106. move.w #$88,d3
  30107.  
  30108. loc_177F2:
  30109. bsr.w loc_175EA
  30110. bra.w loc_177FA
  30111. loc_177FA:
  30112. bset #1,status(a0)
  30113. bclr #4,status(a0)
  30114. bclr #5,status(a0)
  30115. clr.b jumping(a0)
  30116. move.w #SndID_LargeBumper,d0
  30117. jmp (PlaySound).l
  30118. ; ===========================================================================
  30119. SpecialCNZBumpers_Act1: BINCLUDE "level/objects/CNZ 1 bumpers.bin" ; byte_1781A
  30120. SpecialCNZBumpers_Act2: BINCLUDE "level/objects/CNZ 2 bumpers.bin" ; byte_1795E
  30121. ; ===========================================================================
  30122.  
  30123. if gameRevision<2
  30124. nop
  30125. endif
  30126.  
  30127.  
  30128.  
  30129.  
  30130. ; ===========================================================================
  30131. ; ---------------------------------------------------------------------------
  30132. ; Objects Manager
  30133. ; Subroutine that keeps track of any objects that need to remember
  30134. ; their state, such as monitors or enemies.
  30135. ;
  30136. ; input variables:
  30137. ; -none-
  30138. ;
  30139. ; writes:
  30140. ; d0, d1
  30141. ; d2 = respawn index of object to load
  30142. ; d6 = camera position
  30143. ;
  30144. ; a0 = address in object placement list
  30145. ; a2 = respawn table
  30146. ; ---------------------------------------------------------------------------
  30147.  
  30148. ; loc_17AA4
  30149. ObjectsManager:
  30150. moveq #0,d0
  30151. move.b (Obj_placement_routine).w,d0
  30152. move.w ObjectsManager_States(pc,d0.w),d0
  30153. jmp ObjectsManager_States(pc,d0.w)
  30154. ; ===========================================================================
  30155. ObjectsManager_States: offsetTable
  30156. offsetTableEntry.w ObjectsManager_Init ; 0
  30157. offsetTableEntry.w ObjectsManager_Main ; 2
  30158. offsetTableEntry.w ObjectsManager_2P_Main ; 4
  30159. ; ===========================================================================
  30160. ; loc_17AB8
  30161. ObjectsManager_Init:
  30162. addq.b #2,(Obj_placement_routine).w
  30163. move.w (Current_ZoneAndAct).w,d0 ; If level == $0F01 (ARZ 2)...
  30164. ror.b #1,d0 ; then this yields $0F80...
  30165. lsr.w #6,d0 ; and this yields $003E.
  30166. lea (Off_Objects).l,a0 ; Next, we load the first pointer in the object layout list pointer index,
  30167. movea.l a0,a1 ; then copy it for quicker use later.
  30168. adda.w (a0,d0.w),a0 ; (Point1 * 2) + $003E
  30169. tst.w (Two_player_mode).w ; skip if not in 2-player vs mode
  30170. beq.s +
  30171. cmpi.b #casino_night_zone,(Current_Zone).w ; skip if not Casino Night Zone
  30172. bne.s +
  30173. lea (Objects_CNZ1_2P).l,a0 ; CNZ 1 2-player object layout
  30174. tst.b (Current_Act).w ; skip if not past act 1
  30175. beq.s +
  30176. lea (Objects_CNZ2_2P).l,a0 ; CNZ 2 2-player object layout
  30177. +
  30178. ; initialize each object load address with the first object in the layout
  30179. move.l a0,(Obj_load_addr_right).w
  30180. move.l a0,(Obj_load_addr_left).w
  30181. move.l a0,(Obj_load_addr_2).w
  30182. move.l a0,(Obj_load_addr_3).w
  30183. lea (Object_Respawn_Table).w,a2
  30184. move.w #$101,(a2)+ ; the first two bytes are not used as respawn values
  30185. ; instead, they are used to keep track of the current respawn indexes
  30186.  
  30187. ; Bug: The '+7E' shouldn't be here; this loop accidentally clears an additional $7E bytes
  30188. move.w #bytesToLcnt(Obj_respawn_data_End-Obj_respawn_data+$7E),d0 ; set loop counter
  30189. - clr.l (a2)+ ; loop clears all other respawn values
  30190. dbf d0,-
  30191.  
  30192. lea (Obj_respawn_index).w,a2 ; reset a2
  30193. moveq #0,d2
  30194. move.w (Camera_X_pos).w,d6
  30195. subi.w #$80,d6 ; look one chunk to the left
  30196. bcc.s + ; if the result was negative,
  30197. moveq #0,d6 ; cap at zero
  30198. +
  30199. andi.w #$FF80,d6 ; limit to increments of $80 (width of a chunk)
  30200. movea.l (Obj_load_addr_right).w,a0 ; load address of object placement list
  30201.  
  30202. - ; at the beginning of a level this gives respawn table entries to any object that is one chunk
  30203. ; behind the left edge of the screen that needs to remember its state (Monitors, Badniks, etc.)
  30204. cmp.w (a0),d6 ; is object's x position >= d6?
  30205. bls.s loc_17B3E ; if yes, branch
  30206. tst.b 2(a0) ; does the object get a respawn table entry?
  30207. bpl.s + ; if not, branch
  30208. move.b (a2),d2
  30209. addq.b #1,(a2) ; respawn index of next object to the right
  30210. +
  30211. addq.w #6,a0 ; next object
  30212. bra.s -
  30213. ; ---------------------------------------------------------------------------
  30214.  
  30215. loc_17B3E:
  30216. move.l a0,(Obj_load_addr_right).w ; remember rightmost object that has been processed, so far (we still need to look forward)
  30217. move.l a0,(Obj_load_addr_2).w
  30218. movea.l (Obj_load_addr_left).w,a0 ; reset a0
  30219. subi.w #$80,d6 ; look even farther left (any object behind this is out of range)
  30220. bcs.s loc_17B62 ; branch, if camera position would be behind level's left boundary
  30221.  
  30222. - ; count how many objects are behind the screen that are not in range and need to remember their state
  30223. cmp.w (a0),d6 ; is object's x position >= d6?
  30224. bls.s loc_17B62 ; if yes, branch
  30225. tst.b 2(a0) ; does the object get a respawn table entry?
  30226. bpl.s + ; if not, branch
  30227. addq.b #1,1(a2) ; respawn index of current object to the left
  30228.  
  30229. +
  30230. addq.w #6,a0
  30231. bra.s - ; continue with next object
  30232. ; ---------------------------------------------------------------------------
  30233.  
  30234. loc_17B62:
  30235. move.l a0,(Obj_load_addr_left).w ; remember current object from the left
  30236. move.l a0,(Obj_load_addr_3).w
  30237. move.w #-1,(Camera_X_pos_last).w ; make sure ObjectsManager_GoingForward is run
  30238. move.w #-1,(Camera_X_pos_last_P2).w
  30239. tst.w (Two_player_mode).w ; is it two player mode?
  30240. beq.s ObjectsManager_Main ; if not, branch
  30241. addq.b #2,(Obj_placement_routine).w
  30242. bra.w ObjectsManager_2P_Init
  30243. ; ---------------------------------------------------------------------------
  30244. ; loc_17B84
  30245. ObjectsManager_Main:
  30246. move.w (Camera_X_pos).w,d1
  30247. subi.w #$80,d1
  30248. andi.w #$FF80,d1
  30249. move.w d1,(Camera_X_pos_coarse).w
  30250.  
  30251. lea (Obj_respawn_index).w,a2
  30252. moveq #0,d2
  30253. move.w (Camera_X_pos).w,d6
  30254. andi.w #$FF80,d6
  30255. cmp.w (Camera_X_pos_last).w,d6 ; is the X range the same as last time?
  30256. beq.w ObjectsManager_SameXRange ; if yes, branch (rts)
  30257. bge.s ObjectsManager_GoingForward ; if new pos is greater than old pos, branch
  30258. ; if the player is moving back
  30259. move.w d6,(Camera_X_pos_last).w ; remember current position for next time
  30260. movea.l (Obj_load_addr_left).w,a0 ; get current object from the left
  30261. subi.w #$80,d6 ; look one chunk to the left
  30262. bcs.s loc_17BE6 ; branch, if camera position would be behind level's left boundary
  30263.  
  30264. - ; load all objects left of the screen that are now in range
  30265. cmp.w -6(a0),d6 ; is the previous object's X pos less than d6?
  30266. bge.s loc_17BE6 ; if it is, branch
  30267. subq.w #6,a0 ; get object's address
  30268. tst.b 2(a0) ; does the object get a respawn table entry?
  30269. bpl.s + ; if not, branch
  30270. subq.b #1,1(a2) ; respawn index of this object
  30271. move.b 1(a2),d2
  30272. +
  30273. bsr.w ChkLoadObj ; load object
  30274. bne.s + ; branch, if SST is full
  30275. subq.w #6,a0
  30276. bra.s - ; continue with previous object
  30277. ; ---------------------------------------------------------------------------
  30278.  
  30279. + ; undo a few things, if the object couldn't load
  30280. tst.b 2(a0) ; does the object get a respawn table entry?
  30281. bpl.s + ; if not, branch
  30282. addq.b #1,1(a2) ; since we didn't load the object, undo last change
  30283. +
  30284. addq.w #6,a0 ; go back to last object
  30285.  
  30286. loc_17BE6:
  30287. move.l a0,(Obj_load_addr_left).w ; remember current object from the left
  30288. movea.l (Obj_load_addr_right).w,a0 ; get next object from the right
  30289. addi.w #$300,d6 ; look two chunks beyond the right edge of the screen
  30290.  
  30291. - ; subtract number of objects that have been moved out of range (from the right side)
  30292. cmp.w -6(a0),d6 ; is the previous object's X pos less than d6?
  30293. bgt.s loc_17C04 ; if it is, branch
  30294. tst.b -4(a0) ; does the previous object get a respawn table entry?
  30295. bpl.s + ; if not, branch
  30296. subq.b #1,(a2) ; respawn index of next object to the right
  30297. +
  30298. subq.w #6,a0
  30299. bra.s - ; continue with previous object
  30300. ; ---------------------------------------------------------------------------
  30301.  
  30302. loc_17C04:
  30303. move.l a0,(Obj_load_addr_right).w ; remember next object from the right
  30304. rts
  30305. ; ---------------------------------------------------------------------------
  30306.  
  30307. ObjectsManager_GoingForward:
  30308. move.w d6,(Camera_X_pos_last).w
  30309. movea.l (Obj_load_addr_right).w,a0 ; get next object from the right
  30310. addi.w #$280,d6 ; look two chunks forward
  30311.  
  30312. - ; load all objects right of the screen that are now in range
  30313. cmp.w (a0),d6 ; is object's x position >= d6?
  30314. bls.s loc_17C2A ; if yes, branch
  30315. tst.b 2(a0) ; does the object get a respawn table entry?
  30316. bpl.s + ; if not, branch
  30317. move.b (a2),d2 ; respawn index of this object
  30318. addq.b #1,(a2) ; respawn index of next object to the right
  30319. +
  30320. bsr.w ChkLoadObj ; load object (and get address of next object)
  30321. beq.s - ; continue loading objects, if the SST isn't full
  30322.  
  30323. loc_17C2A:
  30324. move.l a0,(Obj_load_addr_right).w ; remember next object from the right
  30325. movea.l (Obj_load_addr_left).w,a0 ; get current object from the left
  30326. subi.w #$300,d6 ; look one chunk behind the left edge of the screen
  30327. bcs.s loc_17C4A ; branch, if camera position would be behind level's left boundary
  30328.  
  30329. - ; subtract number of objects that have been moved out of range (from the left)
  30330. cmp.w (a0),d6 ; is object's x position >= d6?
  30331. bls.s loc_17C4A ; if yes, branch
  30332. tst.b 2(a0) ; does the object get a respawn table entry?
  30333. bpl.s + ; if not, branch
  30334. addq.b #1,1(a2) ; respawn index of next object to the left
  30335. +
  30336. addq.w #6,a0
  30337. bra.s - ; continue with previous object
  30338. ; ---------------------------------------------------------------------------
  30339.  
  30340. loc_17C4A:
  30341. move.l a0,(Obj_load_addr_left).w ; remember current object from the left
  30342.  
  30343. ObjectsManager_SameXRange:
  30344. rts
  30345. ; ---------------------------------------------------------------------------
  30346. ; loc_17C50
  30347. ObjectsManager_2P_Init:
  30348. moveq #-1,d0
  30349. move.l d0,(unk_F780).w
  30350. move.l d0,(unk_F780+4).w
  30351. move.l d0,(unk_F780+8).w
  30352. move.l d0,(Camera_X_pos_last_P2).w ; both words that this sets to -1 are overwritten directly underneath, so this line is rather pointless...
  30353. move.w #0,(Camera_X_pos_last).w
  30354. move.w #0,(Camera_X_pos_last_P2).w
  30355. lea (Obj_respawn_index).w,a2
  30356. move.w (a2),(Obj_respawn_index_P2).w ; mirrior first two bytes (respawn indices) for player 2(?)
  30357. moveq #0,d2
  30358. ; run initialization for player 1
  30359. lea (Obj_respawn_index).w,a5
  30360. lea (Obj_load_addr_right).w,a4
  30361. lea (unk_F786).w,a1 ; = -1, -1, -1
  30362. lea (unk_F789).w,a6 ; = -1, -1, -1
  30363. moveq #-2,d6
  30364. bsr.w ObjMan2P_GoingForward
  30365. lea (unk_F786).w,a1
  30366. moveq #-1,d6
  30367. bsr.w ObjMan2P_GoingForward
  30368. lea (unk_F786).w,a1
  30369. moveq #0,d6
  30370. bsr.w ObjMan2P_GoingForward
  30371. ; run initialization for player 2
  30372. lea (Obj_respawn_index_P2).w,a5
  30373. lea (Obj_load_addr_2).w,a4
  30374. lea (unk_F789).w,a1
  30375. lea (unk_F786).w,a6
  30376. moveq #-2,d6
  30377. bsr.w ObjMan2P_GoingForward
  30378. lea (unk_F789).w,a1
  30379. moveq #-1,d6
  30380. bsr.w ObjMan2P_GoingForward
  30381. lea (unk_F789).w,a1
  30382. moveq #0,d6
  30383. bsr.w ObjMan2P_GoingForward
  30384.  
  30385. ; loc_17CCC
  30386. ObjectsManager_2P_Main:
  30387. move.w (Camera_X_pos).w,d1
  30388. andi.w #$FF00,d1
  30389. move.w d1,(Camera_X_pos_coarse).w
  30390.  
  30391. move.w (Camera_X_pos_P2).w,d1
  30392. andi.w #$FF00,d1
  30393. move.w d1,(Camera_X_pos_coarse_P2).w
  30394.  
  30395. move.b (Camera_X_pos).w,d6 ; get upper byte of camera positon
  30396. andi.w #$FF,d6
  30397. move.w (Camera_X_pos_last).w,d0
  30398. cmp.w (Camera_X_pos_last).w,d6 ; is the X range the same as last time?
  30399. beq.s + ; if yes, branch
  30400. move.w d6,(Camera_X_pos_last).w ; remember current position for next time
  30401. lea (Obj_respawn_index).w,a5
  30402. lea (Obj_load_addr_right).w,a4
  30403. lea (unk_F786).w,a1
  30404. lea (unk_F789).w,a6
  30405. bsr.s ObjectsManager_2P_Run
  30406. +
  30407. move.b (Camera_X_pos_P2).w,d6 ; get upper byte of camera positon
  30408. andi.w #$FF,d6
  30409. move.w (Camera_X_pos_last_P2).w,d0
  30410. cmp.w (Camera_X_pos_last_P2).w,d6 ; is the X range the same as last time?
  30411. beq.s return_17D34 ; if yes, branch (rts)
  30412. move.w d6,(Camera_X_pos_last_P2).w
  30413. lea (Obj_respawn_index_P2).w,a5
  30414. lea (Obj_load_addr_2).w,a4
  30415. lea (unk_F789).w,a1
  30416. lea (unk_F786).w,a6
  30417. bsr.s ObjectsManager_2P_Run
  30418.  
  30419. return_17D34:
  30420. rts
  30421. ; ===========================================================================
  30422.  
  30423. ObjectsManager_2P_Run:
  30424. lea (Obj_respawn_index).w,a2
  30425. moveq #0,d2
  30426. cmp.w d0,d6 ; is the X range the same as last time?
  30427. beq.w ObjectsManager_SameXRange ; if yes, branch (rts)
  30428. bge.w ObjMan2P_GoingForward ; if new pos is greater than old pos, branch
  30429. ; if the player is moving back
  30430. move.b 2(a1),d2
  30431. move.b 1(a1),2(a1)
  30432. move.b (a1),1(a1)
  30433. move.b d6,(a1)
  30434. cmp.b (a6),d2
  30435. beq.s +
  30436. cmp.b 1(a6),d2
  30437. beq.s +
  30438. cmp.b 2(a6),d2
  30439. beq.s +
  30440. bsr.w ObjectsManager_2P_UnkSub3
  30441. bra.s loc_17D70
  30442. ; ---------------------------------------------------------------------------
  30443.  
  30444. +
  30445. bsr.w ObjMan_2P_UnkSub2
  30446.  
  30447. loc_17D70:
  30448. bsr.w ObjMan_2P_UnkSub1
  30449. bne.s loc_17D94 ; if whatever checks were just performed were all not equal, branch
  30450. movea.l 4(a4),a0
  30451.  
  30452. -
  30453. cmp.b -6(a0),d6
  30454. bne.s loc_17D8E
  30455. tst.b -4(a0)
  30456. bpl.s +
  30457. subq.b #1,1(a5)
  30458. +
  30459. subq.w #6,a0
  30460. bra.s -
  30461. ; ---------------------------------------------------------------------------
  30462.  
  30463. loc_17D8E:
  30464. move.l a0,4(a4)
  30465. bra.s loc_17DCA
  30466. ; ---------------------------------------------------------------------------
  30467.  
  30468. loc_17D94:
  30469. movea.l 4(a4),a0
  30470. move.b d6,(a1)
  30471.  
  30472. -
  30473. cmp.b -6(a0),d6
  30474. bne.s loc_17DC6
  30475. subq.w #6,a0
  30476. tst.b 2(a0)
  30477. bpl.s +
  30478. subq.b #1,1(a5)
  30479. move.b 1(a5),d2
  30480. +
  30481. bsr.w ChkLoadObj_2P
  30482. bne.s loc_17DBA
  30483. subq.w #6,a0
  30484. bra.s -
  30485. ; ---------------------------------------------------------------------------
  30486.  
  30487. loc_17DBA:
  30488. tst.b 2(a0)
  30489. bpl.s +
  30490. addq.b #1,1(a5)
  30491. +
  30492. addq.w #6,a0
  30493.  
  30494. loc_17DC6:
  30495. move.l a0,4(a4)
  30496.  
  30497. loc_17DCA:
  30498. movea.l (a4),a0
  30499. addq.w #3,d6
  30500.  
  30501. -
  30502. cmp.b -6(a0),d6
  30503. bne.s loc_17DE0
  30504. tst.b -4(a0)
  30505. bpl.s +
  30506. subq.b #1,(a5)
  30507. +
  30508. subq.w #6,a0
  30509. bra.s -
  30510. ; ---------------------------------------------------------------------------
  30511.  
  30512. loc_17DE0:
  30513. move.l a0,(a4)
  30514. rts
  30515. ; ===========================================================================
  30516. ;loc_17DE4:
  30517. ObjMan2P_GoingForward:
  30518. addq.w #2,d6 ; look forward two chunks
  30519.  
  30520. move.b (a1),d2 ; shift positions in array left once
  30521. move.b 1(a1),(a1) ; nearest chunk to the right
  30522. move.b 2(a1),1(a1) ; middle chunk to the right
  30523. move.b d6,2(a1) ; farthest chunk to the right
  30524.  
  30525. cmp.b (a6),d2 ; compare farthset distance
  30526. beq.s +
  30527. cmp.b 1(a6),d2
  30528. beq.s +
  30529. cmp.b 2(a6),d2
  30530. beq.s +
  30531.  
  30532. bsr.w ObjectsManager_2P_UnkSub3 ; if not, run this sub-routine
  30533. bra.s loc_17E10
  30534. ; ---------------------------------------------------------------------------
  30535.  
  30536. +
  30537. bsr.w ObjMan_2P_UnkSub2
  30538.  
  30539. loc_17E10:
  30540. bsr.w ObjMan_2P_UnkSub1
  30541. bne.s loc_17E2C ; if whatever checks were just performed were all not equal, branch
  30542. movea.l (a4),a0
  30543.  
  30544. -
  30545. cmp.b (a0),d6
  30546. bne.s loc_17E28
  30547. tst.b 2(a0) ; does the object get a respawn table entry?
  30548. bpl.s + ; if not, branch
  30549. addq.b #1,(a5)
  30550. +
  30551. addq.w #6,a0
  30552. bra.s -
  30553. ; ===========================================================================
  30554.  
  30555. loc_17E28:
  30556. move.l a0,(a4)
  30557. bra.s loc_17E46
  30558. ; ===========================================================================
  30559.  
  30560. loc_17E2C:
  30561. movea.l (a4),a0
  30562. move.b d6,(a1)
  30563.  
  30564. -
  30565. cmp.b (a0),d6
  30566. bne.s loc_17E44
  30567. tst.b 2(a0) ; does the object get a respawn table entry?
  30568. bpl.s + ; if not, branch
  30569. move.b (a5),d2
  30570. addq.b #1,(a5)
  30571. +
  30572. bsr.w ChkLoadObj_2P
  30573. beq.s -
  30574.  
  30575. loc_17E44:
  30576. move.l a0,(a4)
  30577.  
  30578. loc_17E46:
  30579. movea.l 4(a4),a0
  30580. subq.w #3,d6
  30581. bcs.s loc_17E60
  30582.  
  30583. loc_17E4E:
  30584. cmp.b (a0),d6
  30585. bne.s loc_17E60
  30586. tst.b 2(a0)
  30587. bpl.s loc_17E5C
  30588. addq.b #1,1(a5)
  30589.  
  30590. loc_17E5C:
  30591. addq.w #6,a0
  30592. bra.s loc_17E4E
  30593. ; ===========================================================================
  30594.  
  30595. loc_17E60:
  30596. move.l a0,4(a4)
  30597. rts
  30598. ; ===========================================================================
  30599. ;loc_17E66:
  30600. ObjMan_2P_UnkSub1:
  30601. move.l a1,-(sp)
  30602. lea (unk_F780).w,a1
  30603. cmp.b (a1)+,d6
  30604. beq.s +
  30605. cmp.b (a1)+,d6
  30606. beq.s +
  30607. cmp.b (a1)+,d6
  30608. beq.s +
  30609. cmp.b (a1)+,d6
  30610. beq.s +
  30611. cmp.b (a1)+,d6
  30612. beq.s +
  30613. cmp.b (a1)+,d6
  30614. beq.s +
  30615. moveq #1,d0
  30616. +
  30617. movea.l (sp)+,a1
  30618. rts
  30619. ; ===========================================================================
  30620. ;loc_17E8A:
  30621. ObjMan_2P_UnkSub2:
  30622. lea (unk_F780).w,a1
  30623. lea (Dynamic_Object_RAM_2P_End).w,a3
  30624. tst.b (a1)+
  30625. bmi.s +
  30626. lea (Dynamic_Object_RAM_2P_End+$C*object_size).w,a3
  30627. tst.b (a1)+
  30628. bmi.s +
  30629. lea (Dynamic_Object_RAM_2P_End+$18*object_size).w,a3
  30630. tst.b (a1)+
  30631. bmi.s +
  30632. lea (Dynamic_Object_RAM_2P_End+$24*object_size).w,a3
  30633. tst.b (a1)+
  30634. bmi.s +
  30635. lea (Dynamic_Object_RAM_2P_End+$30*object_size).w,a3
  30636. tst.b (a1)+
  30637. bmi.s +
  30638. lea (Dynamic_Object_RAM_2P_End+$3C*object_size).w,a3
  30639. tst.b (a1)+
  30640. bmi.s +
  30641. nop
  30642. nop
  30643. +
  30644. subq.w #1,a1
  30645. rts
  30646. ; ===========================================================================
  30647. ; this sub-routine appears to determine which 12 byte block of object RAM
  30648. ; corresponds to the current out-of-range camera positon (in d2) and deletes
  30649. ; the objects in this block. This most likely takes over the functionality
  30650. ; of markObjGone, as that routine isn't called in two player mode.
  30651. ;loc_17EC6:
  30652. ObjectsManager_2P_UnkSub3:
  30653. lea (unk_F780).w,a1
  30654. lea (Dynamic_Object_RAM_2P_End).w,a3
  30655. cmp.b (a1)+,d2
  30656. beq.s +
  30657. lea (Dynamic_Object_RAM_2P_End+$C*object_size).w,a3
  30658. cmp.b (a1)+,d2
  30659. beq.s +
  30660. lea (Dynamic_Object_RAM_2P_End+$18*object_size).w,a3
  30661. cmp.b (a1)+,d2
  30662. beq.s +
  30663. lea (Dynamic_Object_RAM_2P_End+$24*object_size).w,a3
  30664. cmp.b (a1)+,d2
  30665. beq.s +
  30666. lea (Dynamic_Object_RAM_2P_End+$30*object_size).w,a3
  30667. cmp.b (a1)+,d2
  30668. beq.s +
  30669. lea (Dynamic_Object_RAM_2P_End+$3C*object_size).w,a3
  30670. cmp.b (a1)+,d2
  30671. beq.s +
  30672. nop
  30673. nop
  30674. +
  30675. move.b #-1,-(a1)
  30676. movem.l a1/a3,-(sp)
  30677. moveq #0,d1 ; used later to delete objects
  30678. moveq #$C-1,d2
  30679.  
  30680. ;loc_17F0A:
  30681. ObjMan2P_UnkSub3_DeleteBlockLoop:
  30682. tst.b (a3)
  30683. beq.s ObjMan2P_UnkSub3_DeleteBlock_SkipObj ; branch if slot is empty
  30684. movea.l a3,a1
  30685. moveq #0,d0
  30686. move.b respawn_index(a1),d0 ; does object remember its state?
  30687. beq.s + ; if not, branch
  30688. bclr #7,2(a2,d0.w) ; else, clear entry in respawn table
  30689.  
  30690. ; inlined DeleteObject2:
  30691. +
  30692. moveq #bytesToLcnt(next_object),d0 ; we want to clear up to the next object
  30693. ; note: d1 is already 0
  30694.  
  30695. ; delete the object by setting all of its bytes to 0
  30696. - move.l d1,(a1)+
  30697. dbf d0,-
  30698. if object_size&3
  30699. move.w d1,(a1)+
  30700. endif
  30701.  
  30702. ;loc_17F26:
  30703. ObjMan2P_UnkSub3_DeleteBlock_SkipObj:
  30704. lea next_object(a3),a3 ; a3=object
  30705. dbf d2,ObjMan2P_UnkSub3_DeleteBlockLoop
  30706. moveq #0,d2
  30707. movem.l (sp)+,a1/a3
  30708. rts
  30709. ; ===========================================================================
  30710. ; ---------------------------------------------------------------------------
  30711. ; Subroutine to check if an object needs to be loaded.
  30712. ;
  30713. ; input variables:
  30714. ; d2 = respawn index of object to be loaded
  30715. ;
  30716. ; a0 = address in object placement list
  30717. ; a2 = object respawn table
  30718. ;
  30719. ; writes:
  30720. ; d0, d1
  30721. ; a1 = object
  30722. ; ---------------------------------------------------------------------------
  30723. ;loc_17F36:
  30724. ChkLoadObj:
  30725. tst.b 2(a0) ; does the object get a respawn table entry?
  30726. bpl.s + ; if not, branch
  30727. bset #7,2(a2,d2.w) ; mark object as loaded
  30728. beq.s + ; branch if it wasn't already loaded
  30729. addq.w #6,a0 ; next object
  30730. moveq #0,d0 ; let the objects manager know that it can keep going
  30731. rts
  30732. ; ---------------------------------------------------------------------------
  30733.  
  30734. +
  30735. bsr.w SingleObjLoad ; find empty slot
  30736. bne.s return_17F7E ; branch, if there is no room left in the SST
  30737. move.w (a0)+,x_pos(a1)
  30738. move.w (a0)+,d0 ; there are three things stored in this word
  30739. bpl.s + ; branch, if the object doesn't get a respawn table entry
  30740. move.b d2,respawn_index(a1)
  30741. +
  30742. move.w d0,d1 ; copy for later
  30743. andi.w #$FFF,d0 ; get y-position
  30744. move.w d0,y_pos(a1)
  30745. rol.w #3,d1 ; adjust bits
  30746. andi.b #3,d1 ; get render flags
  30747. move.b d1,render_flags(a1)
  30748. move.b d1,status(a1)
  30749. _move.b (a0)+,id(a1) ; load obj
  30750. move.b (a0)+,subtype(a1)
  30751. moveq #0,d0
  30752.  
  30753. return_17F7E:
  30754. rts
  30755. ; ===========================================================================
  30756. ;loc_17F80:
  30757. ChkLoadObj_2P:
  30758. tst.b 2(a0) ; does the object get a respawn table entry?
  30759. bpl.s + ; if not, branch
  30760. bset #7,2(a2,d2.w) ; mark object as loaded
  30761. beq.s + ; branch if it wasn't already loaded
  30762. addq.w #6,a0 ; next object
  30763. moveq #0,d0 ; let the objects manager know that it can keep going
  30764. rts
  30765. ; ---------------------------------------------------------------------------
  30766.  
  30767. +
  30768. btst #4,2(a0) ; the bit that's being tested for here should always be zero,
  30769. beq.s + ; but assuming it weren't and this branch isn't taken,
  30770. bsr.w SingleObjLoad ; then this object would not be loaded into one of the 12
  30771. bne.s return_17FD8 ; byte blocks after Dynamic_Object_RAM_2P_End and would most
  30772. bra.s ChkLoadObj_2P_LoadData ; likely end up somwhere before this in Dynamic_Object_RAM
  30773. ; ---------------------------------------------------------------------------
  30774.  
  30775. +
  30776. bsr.w SingleObjLoad3 ; find empty slot in current 12 object block
  30777. bne.s return_17FD8 ; branch, if there is no room left in this block
  30778. ;loc_17FAA:
  30779. ChkLoadObj_2P_LoadData:
  30780. move.w (a0)+,x_pos(a1)
  30781. move.w (a0)+,d0 ; there are three things stored in this word
  30782. bpl.s + ; branch, if the object doesn't get a respawn table entry
  30783. move.b d2,respawn_index(a1)
  30784. +
  30785. move.w d0,d1 ; copy for later
  30786. andi.w #$FFF,d0 ; get y-position
  30787. move.w d0,y_pos(a1)
  30788. rol.w #3,d1 ; adjust bits
  30789. andi.b #3,d1 ; get render flags
  30790. move.b d1,render_flags(a1)
  30791. move.b d1,status(a1)
  30792. _move.b (a0)+,id(a1) ; load obj
  30793. move.b (a0)+,subtype(a1)
  30794. moveq #0,d0
  30795.  
  30796. return_17FD8:
  30797. rts
  30798. ; ===========================================================================
  30799. ; ---------------------------------------------------------------------------
  30800. ; Single object loading subroutine
  30801. ; Find an empty object array
  30802. ; ---------------------------------------------------------------------------
  30803.  
  30804. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  30805.  
  30806. ; loc_17FDA: ; allocObject:
  30807. SingleObjLoad:
  30808. lea (Dynamic_Object_RAM).w,a1 ; a1=object
  30809. move.w #(Dynamic_Object_RAM_End-Dynamic_Object_RAM)/object_size-1,d0 ; search to end of table
  30810. tst.w (Two_player_mode).w
  30811. beq.s +
  30812. move.w #(Dynamic_Object_RAM_2P_End-Dynamic_Object_RAM)/object_size-1,d0 ; search to $BF00 exclusive
  30813.  
  30814. /
  30815. tst.b id(a1) ; is object RAM slot empty?
  30816. beq.s return_17FF8 ; if yes, branch
  30817. lea next_object(a1),a1 ; load obj address ; goto next object RAM slot
  30818. dbf d0,- ; repeat until end
  30819.  
  30820. return_17FF8:
  30821. rts
  30822. ; ===========================================================================
  30823. ; ---------------------------------------------------------------------------
  30824. ; Single object loading subroutine
  30825. ; Find an empty object array AFTER the current one in the table
  30826. ; ---------------------------------------------------------------------------
  30827.  
  30828. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  30829.  
  30830. ; loc_17FFA: ; allocObjectAfterCurrent:
  30831. SingleObjLoad2:
  30832. movea.l a0,a1
  30833. move.w #Dynamic_Object_RAM_End,d0 ; $D000
  30834. sub.w a0,d0 ; subtract current object location
  30835. if object_size=$40
  30836. lsr.w #6,d0 ; divide by $40
  30837. else
  30838. divu.w #object_size,d0
  30839. endif
  30840. subq.w #1,d0 ; keep from going over the object zone
  30841. bcs.s return_18014
  30842.  
  30843. -
  30844. tst.b id(a1) ; is object RAM slot empty?
  30845. beq.s return_18014 ; if yes, branch
  30846. lea next_object(a1),a1 ; load obj address ; goto next object RAM slot
  30847. dbf d0,- ; repeat until end
  30848.  
  30849. return_18014:
  30850. rts
  30851. ; ===========================================================================
  30852. ; ---------------------------------------------------------------------------
  30853. ; Single object loading subroutine
  30854. ; Find an empty object at or within < 12 slots after a3
  30855. ; ---------------------------------------------------------------------------
  30856.  
  30857. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  30858.  
  30859. ; loc_18016:
  30860. SingleObjLoad3:
  30861. movea.l a3,a1
  30862. move.w #$B,d0
  30863.  
  30864. -
  30865. tst.b id(a1) ; is object RAM slot empty?
  30866. beq.s return_18028 ; if yes, branch
  30867. lea next_object(a1),a1 ; load obj address ; goto next object RAM slot
  30868. dbf d0,- ; repeat until end
  30869.  
  30870. return_18028:
  30871. rts
  30872. ; ===========================================================================
  30873.  
  30874. ;---------------------------------------------------------------------------------------
  30875. ; CNZ act 1 object layout for 2-player mode (various objects were deleted)
  30876. ;---------------------------------------------------------------------------------------
  30877. ; byte_1802A;
  30878. if gameRevision=0
  30879. Objects_CNZ1_2P: BINCLUDE "level/objects/CNZ_1_2P (REV00).bin"
  30880. else
  30881. ; a Crawl badnik was moved slightly further away from a ledge
  30882. ; 2 flippers were moved closer to a wall
  30883. Objects_CNZ1_2P: BINCLUDE "level/objects/CNZ_1_2P.bin"
  30884. endif
  30885. ;---------------------------------------------------------------------------------------
  30886. ; CNZ act 2 object layout for 2-player mode (various objects were deleted)
  30887. ;---------------------------------------------------------------------------------------
  30888. ; byte_18492:
  30889. if gameRevision=0
  30890. Objects_CNZ2_2P: BINCLUDE "level/objects/CNZ_2_2P (REV00).bin"
  30891. else
  30892. ; 4 Crawl badniks were slightly moved, placing them closer/farther away from ledges
  30893. ; 2 flippers were moved away from a wall to keep players from getting stuck behind them
  30894. Objects_CNZ2_2P: BINCLUDE "level/objects/CNZ_2_2P.bin"
  30895. endif
  30896.  
  30897.  
  30898.  
  30899. ; ===========================================================================
  30900. ; ----------------------------------------------------------------------------
  30901. ; Object 41 - Spring
  30902. ; ----------------------------------------------------------------------------
  30903. ; Sprite_18888:
  30904. Obj41:
  30905. moveq #0,d0
  30906. move.b routine(a0),d0
  30907. move.w Obj41_Index(pc,d0.w),d1
  30908. jsr Obj41_Index(pc,d1.w)
  30909. jmp (MarkObjGone).l
  30910. ; ===========================================================================
  30911. ; off_1889C:
  30912. Obj41_Index: offsetTable
  30913. offsetTableEntry.w Obj41_Init ; 0
  30914. offsetTableEntry.w Obj41_Up ; 2
  30915. offsetTableEntry.w Obj41_Horizontal ; 4
  30916. offsetTableEntry.w Obj41_Down ; 6
  30917. offsetTableEntry.w Obj41_DiagonallyUp ; 8
  30918. offsetTableEntry.w Obj41_DiagonallyDown ; $A
  30919. ; ===========================================================================
  30920. ; loc_188A8:
  30921. Obj41_Init:
  30922. addq.b #2,routine(a0)
  30923. move.l #Obj41_MapUnc_1901C,mappings(a0)
  30924. move.w #make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0),art_tile(a0)
  30925. ori.b #4,render_flags(a0)
  30926. move.b #$10,width_pixels(a0)
  30927. move.b #4,priority(a0)
  30928. move.b subtype(a0),d0
  30929. lsr.w #3,d0
  30930. andi.w #$E,d0
  30931. move.w Obj41_Init_Subtypes(pc,d0.w),d0
  30932. jmp Obj41_Init_Subtypes(pc,d0.w)
  30933. ; ===========================================================================
  30934. ; off_188DE:
  30935. Obj41_Init_Subtypes: offsetTable
  30936. offsetTableEntry.w Obj41_Init_Up ; 0
  30937. offsetTableEntry.w Obj41_Init_Horizontal ; 2
  30938. offsetTableEntry.w Obj41_Init_Down ; 4
  30939. offsetTableEntry.w Obj41_Init_DiagonallyUp ; 6
  30940. offsetTableEntry.w Obj41_Init_DiagonallyDown ; 8
  30941. ; ===========================================================================
  30942. ; loc_188E8:
  30943. Obj41_Init_Horizontal:
  30944. move.b #4,routine(a0)
  30945. move.b #2,anim(a0)
  30946. move.b #3,mapping_frame(a0)
  30947. move.w #make_art_tile(ArtTile_ArtNem_HrzntlSprng,0,0),art_tile(a0)
  30948. move.b #8,width_pixels(a0)
  30949. bra.s Obj41_Init_Common
  30950. ; ===========================================================================
  30951. ; loc_18908:
  30952. Obj41_Init_Down:
  30953. move.b #6,routine(a0)
  30954. move.b #6,mapping_frame(a0)
  30955. bset #1,status(a0)
  30956. bra.s Obj41_Init_Common
  30957. ; ===========================================================================
  30958. ; loc_1891C:
  30959. Obj41_Init_DiagonallyUp:
  30960. move.b #8,routine(a0)
  30961. move.b #4,anim(a0)
  30962. move.b #7,mapping_frame(a0)
  30963. move.w #make_art_tile(ArtTile_ArtNem_DignlSprng,0,0),art_tile(a0)
  30964. bra.s Obj41_Init_Common
  30965. ; ===========================================================================
  30966. ; loc_18936:
  30967. Obj41_Init_DiagonallyDown:
  30968. move.b #$A,routine(a0)
  30969. move.b #4,anim(a0)
  30970. move.b #$A,mapping_frame(a0)
  30971. move.w #make_art_tile(ArtTile_ArtNem_DignlSprng,0,0),art_tile(a0)
  30972. bset #1,status(a0)
  30973. ; loc_18954:
  30974. Obj41_Init_Up:
  30975. Obj41_Init_Common:
  30976. ; checks color of spring
  30977. move.b subtype(a0),d0
  30978. andi.w #2,d0
  30979. move.w Obj41_Strengths(pc,d0.w),objoff_30(a0)
  30980. btst #1,d0
  30981. beq.s +
  30982. bset #palette_bit_0,art_tile(a0)
  30983. move.l #Obj41_MapUnc_19032,mappings(a0)
  30984. +
  30985. bsr.w Adjust2PArtPointer
  30986. rts
  30987. ; ===========================================================================
  30988. ; word_1897C:
  30989. Obj41_Strengths:
  30990. ; Speed applied on Sonic
  30991. dc.w -$1000
  30992. dc.w -$A00
  30993. ; ===========================================================================
  30994. ; loc_18980:
  30995. Obj41_Up:
  30996. move.w #$1B,d1
  30997. move.w #8,d2
  30998. move.w #$10,d3
  30999. move.w x_pos(a0),d4
  31000. lea (MainCharacter).w,a1 ; a1=character
  31001. moveq #p1_standing_bit,d6
  31002. movem.l d1-d4,-(sp)
  31003. bsr.w SolidObject_Always_SingleCharacter
  31004. btst #p1_standing_bit,status(a0)
  31005. beq.s loc_189A8
  31006. bsr.s loc_189CA
  31007.  
  31008. loc_189A8:
  31009. movem.l (sp)+,d1-d4
  31010. lea (Sidekick).w,a1 ; a1=character
  31011. moveq #p2_standing_bit,d6
  31012. bsr.w SolidObject_Always_SingleCharacter
  31013. btst #p2_standing_bit,status(a0)
  31014. beq.s loc_189C0
  31015. bsr.s loc_189CA
  31016.  
  31017. loc_189C0:
  31018. lea (Ani_obj41).l,a1
  31019. bra.w AnimateSprite
  31020. ; ===========================================================================
  31021.  
  31022. loc_189CA:
  31023. move.w #$100,anim(a0)
  31024. addq.w #8,y_pos(a1)
  31025. move.w objoff_30(a0),y_vel(a1)
  31026. bset #1,status(a1)
  31027. bclr #3,status(a1)
  31028. move.b #AniIDSonAni_Spring,anim(a1)
  31029. move.b #2,routine(a1)
  31030. move.b subtype(a0),d0
  31031. bpl.s loc_189FE
  31032. move.w #0,x_vel(a1)
  31033.  
  31034. loc_189FE:
  31035. btst #0,d0
  31036. beq.s loc_18A3E
  31037. move.w #1,inertia(a1)
  31038. move.b #1,flip_angle(a1)
  31039. move.b #AniIDSonAni_Walk,anim(a1)
  31040. move.b #0,flips_remaining(a1)
  31041. move.b #4,flip_speed(a1)
  31042. btst #1,d0
  31043. bne.s loc_18A2E
  31044. move.b #1,flips_remaining(a1)
  31045.  
  31046. loc_18A2E:
  31047. btst #0,status(a1)
  31048. beq.s loc_18A3E
  31049. neg.b flip_angle(a1)
  31050. neg.w inertia(a1)
  31051.  
  31052. loc_18A3E:
  31053. andi.b #$C,d0
  31054. cmpi.b #4,d0
  31055. bne.s loc_18A54
  31056. move.b #$C,top_solid_bit(a1)
  31057. move.b #$D,lrb_solid_bit(a1)
  31058.  
  31059. loc_18A54:
  31060. cmpi.b #8,d0
  31061. bne.s loc_18A66
  31062. move.b #$E,top_solid_bit(a1)
  31063. move.b #$F,lrb_solid_bit(a1)
  31064.  
  31065. loc_18A66:
  31066. move.w #SndID_Spring,d0
  31067. jmp (PlaySound).l
  31068. ; ===========================================================================
  31069. ; loc_18A70:
  31070. Obj41_Horizontal:
  31071. move.w #$13,d1
  31072. move.w #$E,d2
  31073. move.w #$F,d3
  31074. move.w x_pos(a0),d4
  31075. lea (MainCharacter).w,a1 ; a1=character
  31076. moveq #p1_standing_bit,d6
  31077. movem.l d1-d4,-(sp)
  31078. bsr.w SolidObject_Always_SingleCharacter
  31079. btst #p1_pushing_bit,status(a0)
  31080. beq.s loc_18AB0
  31081. move.b status(a0),d1
  31082. move.w x_pos(a0),d0
  31083. sub.w x_pos(a1),d0
  31084. bcs.s loc_18AA8
  31085. eori.b #1,d1
  31086.  
  31087. loc_18AA8:
  31088. andi.b #1,d1
  31089. bne.s loc_18AB0
  31090. bsr.s loc_18AEE
  31091.  
  31092. loc_18AB0:
  31093. movem.l (sp)+,d1-d4
  31094. lea (Sidekick).w,a1 ; a1=character
  31095. moveq #p2_standing_bit,d6
  31096. bsr.w SolidObject_Always_SingleCharacter
  31097. btst #p2_pushing_bit,status(a0)
  31098. beq.s loc_18AE0
  31099. move.b status(a0),d1
  31100. move.w x_pos(a0),d0
  31101. sub.w x_pos(a1),d0
  31102. bcs.s loc_18AD8
  31103. eori.b #1,d1
  31104.  
  31105. loc_18AD8:
  31106. andi.b #1,d1
  31107. bne.s loc_18AE0
  31108. bsr.s loc_18AEE
  31109.  
  31110. loc_18AE0:
  31111. bsr.w loc_18BC6
  31112. lea (Ani_obj41).l,a1
  31113. bra.w AnimateSprite
  31114. ; ===========================================================================
  31115.  
  31116. loc_18AEE:
  31117. move.w #$300,anim(a0)
  31118. move.w objoff_30(a0),x_vel(a1)
  31119. addq.w #8,x_pos(a1)
  31120. bset #0,status(a1)
  31121. btst #0,status(a0)
  31122. bne.s loc_18B1C
  31123. bclr #0,status(a1)
  31124. subi.w #$10,x_pos(a1)
  31125. neg.w x_vel(a1)
  31126.  
  31127. loc_18B1C:
  31128. move.w #$F,move_lock(a1)
  31129. move.w x_vel(a1),inertia(a1)
  31130. btst #2,status(a1)
  31131. bne.s loc_18B36
  31132. move.b #AniIDSonAni_Walk,anim(a1)
  31133.  
  31134. loc_18B36:
  31135. move.b subtype(a0),d0
  31136. bpl.s loc_18B42
  31137. move.w #0,y_vel(a1)
  31138.  
  31139. loc_18B42:
  31140. btst #0,d0
  31141. beq.s loc_18B82
  31142. move.w #1,inertia(a1)
  31143. move.b #1,flip_angle(a1)
  31144. move.b #AniIDSonAni_Walk,anim(a1)
  31145. move.b #1,flips_remaining(a1)
  31146. move.b #8,flip_speed(a1)
  31147. btst #1,d0
  31148. bne.s loc_18B72
  31149. move.b #3,flips_remaining(a1)
  31150.  
  31151. loc_18B72:
  31152. btst #0,status(a1)
  31153. beq.s loc_18B82
  31154. neg.b flip_angle(a1)
  31155. neg.w inertia(a1)
  31156.  
  31157. loc_18B82:
  31158. andi.b #$C,d0
  31159. cmpi.b #4,d0
  31160. bne.s loc_18B98
  31161. move.b #$C,top_solid_bit(a1)
  31162. move.b #$D,lrb_solid_bit(a1)
  31163.  
  31164. loc_18B98:
  31165. cmpi.b #8,d0
  31166. bne.s loc_18BAA
  31167. move.b #$E,top_solid_bit(a1)
  31168. move.b #$F,lrb_solid_bit(a1)
  31169.  
  31170. loc_18BAA:
  31171. bclr #p1_pushing_bit,status(a0)
  31172. bclr #p2_pushing_bit,status(a0)
  31173. bclr #5,status(a1)
  31174. move.w #SndID_Spring,d0
  31175. jmp (PlaySound).l
  31176. ; ===========================================================================
  31177.  
  31178. loc_18BC6:
  31179. cmpi.b #3,anim(a0)
  31180. beq.w return_18C7E
  31181. move.w x_pos(a0),d0
  31182. move.w d0,d1
  31183. addi.w #$28,d1
  31184. btst #0,status(a0)
  31185. beq.s loc_18BE8
  31186. move.w d0,d1
  31187. subi.w #$28,d0
  31188.  
  31189. loc_18BE8:
  31190. move.w y_pos(a0),d2
  31191. move.w d2,d3
  31192. subi.w #$18,d2
  31193. addi.w #$18,d3
  31194. lea (MainCharacter).w,a1 ; a1=character
  31195. btst #1,status(a1)
  31196. bne.s loc_18C3C
  31197. move.w inertia(a1),d4
  31198. btst #0,status(a0)
  31199. beq.s loc_18C10
  31200. neg.w d4
  31201.  
  31202. loc_18C10:
  31203. tst.w d4
  31204. bmi.s loc_18C3C
  31205. move.w x_pos(a1),d4
  31206. cmp.w d0,d4
  31207. blo.w loc_18C3C
  31208. cmp.w d1,d4
  31209. bhs.w loc_18C3C
  31210. move.w y_pos(a1),d4
  31211. cmp.w d2,d4
  31212. blo.w loc_18C3C
  31213. cmp.w d3,d4
  31214. bhs.w loc_18C3C
  31215. move.w d0,-(sp)
  31216. bsr.w loc_18AEE
  31217. move.w (sp)+,d0
  31218.  
  31219. loc_18C3C:
  31220. lea (Sidekick).w,a1 ; a1=character
  31221. btst #1,status(a1)
  31222. bne.s return_18C7E
  31223. move.w inertia(a1),d4
  31224. btst #0,status(a0)
  31225. beq.s loc_18C56
  31226. neg.w d4
  31227.  
  31228. loc_18C56:
  31229. tst.w d4
  31230. bmi.s return_18C7E
  31231. move.w x_pos(a1),d4
  31232. cmp.w d0,d4
  31233. blo.w return_18C7E
  31234. cmp.w d1,d4
  31235. bhs.w return_18C7E
  31236. move.w y_pos(a1),d4
  31237. cmp.w d2,d4
  31238. blo.w return_18C7E
  31239. cmp.w d3,d4
  31240. bhs.w return_18C7E
  31241. bsr.w loc_18AEE
  31242.  
  31243. return_18C7E:
  31244. rts
  31245. ; ===========================================================================
  31246. ; loc_18C80:
  31247. Obj41_Down:
  31248. move.w #$1B,d1
  31249. move.w #8,d2
  31250. move.w #$10,d3
  31251. move.w x_pos(a0),d4
  31252. lea (MainCharacter).w,a1 ; a1=character
  31253. moveq #p1_standing_bit,d6
  31254. movem.l d1-d4,-(sp)
  31255. bsr.w SolidObject_Always_SingleCharacter
  31256. cmpi.w #-2,d4
  31257. bne.s loc_18CA6
  31258. bsr.s loc_18CC6
  31259.  
  31260. loc_18CA6:
  31261. movem.l (sp)+,d1-d4
  31262. lea (Sidekick).w,a1 ; a1=character
  31263. moveq #p2_standing_bit,d6
  31264. bsr.w SolidObject_Always_SingleCharacter
  31265. cmpi.w #-2,d4
  31266. bne.s loc_18CBC
  31267. bsr.s loc_18CC6
  31268.  
  31269. loc_18CBC:
  31270. lea (Ani_obj41).l,a1
  31271. bra.w AnimateSprite
  31272. ; ===========================================================================
  31273.  
  31274. loc_18CC6:
  31275. move.w #$100,anim(a0)
  31276. subq.w #8,y_pos(a1)
  31277. move.w objoff_30(a0),y_vel(a1)
  31278. neg.w y_vel(a1)
  31279. move.b subtype(a0),d0
  31280. bpl.s loc_18CE6
  31281. move.w #0,x_vel(a1)
  31282.  
  31283. loc_18CE6:
  31284. btst #0,d0
  31285. beq.s loc_18D26
  31286. move.w #1,inertia(a1)
  31287. move.b #1,flip_angle(a1)
  31288. move.b #AniIDSonAni_Walk,anim(a1)
  31289. move.b #0,flips_remaining(a1)
  31290. move.b #4,flip_speed(a1)
  31291. btst #1,d0
  31292. bne.s loc_18D16
  31293. move.b #1,flips_remaining(a1)
  31294.  
  31295. loc_18D16:
  31296. btst #0,status(a1)
  31297. beq.s loc_18D26
  31298. neg.b flip_angle(a1)
  31299. neg.w inertia(a1)
  31300.  
  31301. loc_18D26:
  31302. andi.b #$C,d0
  31303. cmpi.b #4,d0
  31304. bne.s loc_18D3C
  31305. move.b #$C,top_solid_bit(a1)
  31306. move.b #$D,lrb_solid_bit(a1)
  31307.  
  31308. loc_18D3C:
  31309. cmpi.b #8,d0
  31310. bne.s loc_18D4E
  31311. move.b #$E,top_solid_bit(a1)
  31312. move.b #$F,lrb_solid_bit(a1)
  31313.  
  31314. loc_18D4E:
  31315. bset #1,status(a1)
  31316. bclr #3,status(a1)
  31317. move.b #2,routine(a1)
  31318. move.w #SndID_Spring,d0
  31319. jmp (PlaySound).l
  31320. ; ===========================================================================
  31321. ; loc_18D6A:
  31322. Obj41_DiagonallyUp:
  31323. move.w #$1B,d1
  31324. move.w #$10,d2
  31325. move.w x_pos(a0),d4
  31326. lea Obj41_SlopeData_DiagUp(pc),a2
  31327. lea (MainCharacter).w,a1 ; a1=character
  31328. moveq #p1_standing_bit,d6
  31329. movem.l d1-d4,-(sp)
  31330. bsr.w SlopedSolid_SingleCharacter
  31331. btst #p1_standing_bit,status(a0)
  31332. beq.s loc_18D92
  31333. bsr.s loc_18DB4
  31334.  
  31335. loc_18D92:
  31336. movem.l (sp)+,d1-d4
  31337. lea (Sidekick).w,a1 ; a1=character
  31338. moveq #p2_standing_bit,d6
  31339. bsr.w SlopedSolid_SingleCharacter
  31340. btst #p2_standing_bit,status(a0)
  31341. beq.s loc_18DAA
  31342. bsr.s loc_18DB4
  31343.  
  31344. loc_18DAA:
  31345. lea (Ani_obj41).l,a1
  31346. bra.w AnimateSprite
  31347. ; ===========================================================================
  31348.  
  31349. loc_18DB4:
  31350. btst #0,status(a0)
  31351. bne.s loc_18DCA
  31352. move.w x_pos(a0),d0
  31353. subq.w #4,d0
  31354. cmp.w x_pos(a1),d0
  31355. blo.s loc_18DD8
  31356. rts
  31357. ; ===========================================================================
  31358.  
  31359. loc_18DCA:
  31360. move.w x_pos(a0),d0
  31361. addq.w #4,d0
  31362. cmp.w x_pos(a1),d0
  31363. bhs.s loc_18DD8
  31364. rts
  31365. ; ===========================================================================
  31366.  
  31367. loc_18DD8:
  31368. move.w #$500,anim(a0)
  31369. move.w objoff_30(a0),y_vel(a1)
  31370. move.w objoff_30(a0),x_vel(a1)
  31371. addq.w #6,y_pos(a1)
  31372. addq.w #6,x_pos(a1)
  31373. bset #0,status(a1)
  31374. btst #0,status(a0)
  31375. bne.s loc_18E10
  31376. bclr #0,status(a1)
  31377. subi.w #$C,x_pos(a1)
  31378. neg.w x_vel(a1)
  31379.  
  31380. loc_18E10:
  31381. bset #1,status(a1)
  31382. bclr #3,status(a1)
  31383. move.b #AniIDSonAni_Spring,anim(a1)
  31384. move.b #2,routine(a1)
  31385. move.b subtype(a0),d0
  31386. btst #0,d0
  31387. beq.s loc_18E6C
  31388. move.w #1,inertia(a1)
  31389. move.b #1,flip_angle(a1)
  31390. move.b #AniIDSonAni_Walk,anim(a1)
  31391. move.b #1,flips_remaining(a1)
  31392. move.b #8,flip_speed(a1)
  31393. btst #1,d0
  31394. bne.s loc_18E5C
  31395. move.b #3,flips_remaining(a1)
  31396.  
  31397. loc_18E5C:
  31398. btst #0,status(a1)
  31399. beq.s loc_18E6C
  31400. neg.b flip_angle(a1)
  31401. neg.w inertia(a1)
  31402.  
  31403. loc_18E6C:
  31404. andi.b #$C,d0
  31405. cmpi.b #4,d0
  31406. bne.s loc_18E82
  31407. move.b #$C,top_solid_bit(a1)
  31408. move.b #$D,lrb_solid_bit(a1)
  31409.  
  31410. loc_18E82:
  31411. cmpi.b #8,d0
  31412. bne.s loc_18E94
  31413. move.b #$E,top_solid_bit(a1)
  31414. move.b #$F,lrb_solid_bit(a1)
  31415.  
  31416. loc_18E94:
  31417. move.w #SndID_Spring,d0
  31418. jmp (PlaySound).l
  31419. ; ===========================================================================
  31420. ; loc_18E9E:
  31421. Obj41_DiagonallyDown:
  31422. move.w #$1B,d1
  31423. move.w #$10,d2
  31424. move.w x_pos(a0),d4
  31425. lea Obj41_SlopeData_DiagDown(pc),a2
  31426. lea (MainCharacter).w,a1 ; a1=character
  31427. moveq #p1_standing_bit,d6
  31428. movem.l d1-d4,-(sp)
  31429. bsr.w SlopedSolid_SingleCharacter
  31430. cmpi.w #-2,d4
  31431. bne.s loc_18EC4
  31432. bsr.s loc_18EE6
  31433.  
  31434. loc_18EC4:
  31435. movem.l (sp)+,d1-d4
  31436. lea (Sidekick).w,a1 ; a1=character
  31437. moveq #p2_standing_bit,d6
  31438. bsr.w SlopedSolid_SingleCharacter
  31439. cmpi.w #-2,d4
  31440. bne.s loc_18EDA
  31441. bsr.s loc_18EE6
  31442.  
  31443. loc_18EDA:
  31444. lea (Ani_obj41).l,a1
  31445. bra.w AnimateSprite
  31446. ; ===========================================================================
  31447. rts
  31448. ; ===========================================================================
  31449.  
  31450. loc_18EE6:
  31451. move.w #$500,anim(a0)
  31452. move.w objoff_30(a0),y_vel(a1)
  31453. neg.w y_vel(a1)
  31454. move.w objoff_30(a0),x_vel(a1)
  31455. subq.w #6,y_pos(a1)
  31456. addq.w #6,x_pos(a1)
  31457. bset #0,status(a1)
  31458. btst #0,status(a0)
  31459. bne.s loc_18F22
  31460. bclr #0,status(a1)
  31461. subi.w #$C,x_pos(a1)
  31462. neg.w x_vel(a1)
  31463.  
  31464. loc_18F22:
  31465. bset #1,status(a1)
  31466. bclr #3,status(a1)
  31467. move.b #2,routine(a1)
  31468. move.b subtype(a0),d0
  31469. btst #0,d0
  31470. beq.s loc_18F78
  31471. move.w #1,inertia(a1)
  31472. move.b #1,flip_angle(a1)
  31473. move.b #AniIDSonAni_Walk,anim(a1)
  31474. move.b #1,flips_remaining(a1)
  31475. move.b #8,flip_speed(a1)
  31476. btst #1,d0
  31477. bne.s loc_18F68
  31478. move.b #3,flips_remaining(a1)
  31479.  
  31480. loc_18F68:
  31481. btst #0,status(a1)
  31482. beq.s loc_18F78
  31483. neg.b flip_angle(a1)
  31484. neg.w inertia(a1)
  31485.  
  31486. loc_18F78:
  31487. andi.b #$C,d0
  31488. cmpi.b #4,d0
  31489. bne.s loc_18F8E
  31490. move.b #$C,top_solid_bit(a1)
  31491. move.b #$D,lrb_solid_bit(a1)
  31492.  
  31493. loc_18F8E:
  31494. cmpi.b #8,d0
  31495. bne.s loc_18FA0
  31496. move.b #$E,top_solid_bit(a1)
  31497. move.b #$F,lrb_solid_bit(a1)
  31498.  
  31499. loc_18FA0:
  31500. move.w #SndID_Spring,d0
  31501. jmp (PlaySound).l
  31502. ; ===========================================================================
  31503. ;byte_18FAA:
  31504. Obj41_SlopeData_DiagUp:
  31505. dc.b $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10, $E, $C, $A, 8
  31506. dc.b 6, 4, 2, 0,$FE,$FC,$FC,$FC,$FC,$FC,$FC,$FC; 16
  31507. ;byte_18FC6:
  31508. Obj41_SlopeData_DiagDown:
  31509. dc.b $F4,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F2,$F4,$F6,$F8
  31510. dc.b $FA,$FC,$FE, 0, 2, 4, 4, 4, 4, 4, 4, 4; 16
  31511.  
  31512. ; animation script
  31513. ; off_18FE2:
  31514. Ani_obj41: offsetTable
  31515. offsetTableEntry.w byte_18FEE ; 0
  31516. offsetTableEntry.w byte_18FF1 ; 1
  31517. offsetTableEntry.w byte_18FFD ; 2
  31518. offsetTableEntry.w byte_19000 ; 3
  31519. offsetTableEntry.w byte_1900C ; 4
  31520. offsetTableEntry.w byte_1900F ; 5
  31521. byte_18FEE:
  31522. dc.b $F
  31523. dc.b 0 ; 1
  31524. dc.b $FF ; 2
  31525. rev02even
  31526. byte_18FF1:
  31527. dc.b 0
  31528. dc.b 1 ; 1
  31529. dc.b 0 ; 2
  31530. dc.b 0 ; 3
  31531. dc.b 2 ; 4
  31532. dc.b 2 ; 5
  31533. dc.b 2 ; 6
  31534. dc.b 2 ; 7
  31535. dc.b 2 ; 8
  31536. dc.b 2 ; 9
  31537. dc.b $FD ; 10
  31538. dc.b 0 ; 11
  31539. rev02even
  31540. byte_18FFD:
  31541. dc.b $F
  31542. dc.b 3 ; 1
  31543. dc.b $FF ; 2
  31544. rev02even
  31545. byte_19000:
  31546. dc.b 0
  31547. dc.b 4 ; 1
  31548. dc.b 3 ; 2
  31549. dc.b 3 ; 3
  31550. dc.b 5 ; 4
  31551. dc.b 5 ; 5
  31552. dc.b 5 ; 6
  31553. dc.b 5 ; 7
  31554. dc.b 5 ; 8
  31555. dc.b 5 ; 9
  31556. dc.b $FD ; 10
  31557. dc.b 2 ; 11
  31558. rev02even
  31559. byte_1900C:
  31560. dc.b $F
  31561. dc.b 7 ; 1
  31562. dc.b $FF ; 2
  31563. rev02even
  31564. byte_1900F:
  31565. dc.b 0
  31566. dc.b 8 ; 1
  31567. dc.b 7 ; 2
  31568. dc.b 7 ; 3
  31569. dc.b 9 ; 4
  31570. dc.b 9 ; 5
  31571. dc.b 9 ; 6
  31572. dc.b 9 ; 7
  31573. dc.b 9 ; 8
  31574. dc.b 9 ; 9
  31575. dc.b $FD ; 10
  31576. dc.b 4 ; 11
  31577. even
  31578.  
  31579. ; ----------------------------------------------------------------------------
  31580. ; Primary sprite mappings for springs
  31581. ; ----------------------------------------------------------------------------
  31582. Obj41_MapUnc_1901C: offsetTable
  31583. offsetTableEntry.w word_19048 ; 0
  31584. offsetTableEntry.w word_1905A ; 1
  31585. offsetTableEntry.w word_19064 ; 2
  31586. offsetTableEntry.w word_19076 ; 3
  31587. offsetTableEntry.w word_19088 ; 4
  31588. offsetTableEntry.w word_19092 ; 5
  31589. offsetTableEntry.w word_190A4 ; 6
  31590. offsetTableEntry.w word_190B6 ; 7
  31591. offsetTableEntry.w word_190D8 ; 8
  31592. offsetTableEntry.w word_190F2 ; 9
  31593. offsetTableEntry.w word_19114 ; $A
  31594. ; -------------------------------------------------------------------------------
  31595. ; Secondary sprite mappings for springs
  31596. ; merged with the above mappings; can't split to file in a useful way...
  31597. ; -------------------------------------------------------------------------------
  31598. Obj41_MapUnc_19032: offsetTable
  31599. offsetTableEntry.w word_19048 ; 0
  31600. offsetTableEntry.w word_1905A ; 1
  31601. offsetTableEntry.w word_19064 ; 2
  31602. offsetTableEntry.w word_19076 ; 3
  31603. offsetTableEntry.w word_19088 ; 4
  31604. offsetTableEntry.w word_19092 ; 5
  31605. offsetTableEntry.w word_190A4 ; 6
  31606. offsetTableEntry.w word_19136 ; 7
  31607. offsetTableEntry.w word_19158 ; 8
  31608. offsetTableEntry.w word_19172 ; 9
  31609. offsetTableEntry.w word_19194 ; $A
  31610. word_19048:
  31611. dc.w 2
  31612. dc.w $F00D, 0, 0,$FFF0
  31613. dc.w 5, 8, 4,$FFF8; 4
  31614. word_1905A:
  31615. dc.w 1
  31616. dc.w $F80D, 0, 0,$FFF0
  31617. word_19064:
  31618. dc.w 2
  31619. dc.w $E00D, 0, 0,$FFF0
  31620. dc.w $F007, $C, 6,$FFF8; 4
  31621. word_19076:
  31622. dc.w 2
  31623. dc.w $F003, 0, 0, 0
  31624. dc.w $F801, 4, 2,$FFF8; 4
  31625. word_19088:
  31626. dc.w 1
  31627. dc.w $F003, 0, 0,$FFF8
  31628. word_19092:
  31629. dc.w 2
  31630. dc.w $F003, 0, 0, $10
  31631. dc.w $F809, 6, 3,$FFF8; 4
  31632. word_190A4:
  31633. dc.w 2
  31634. dc.w $D,$1000,$1000,$FFF0
  31635. dc.w $F005,$1008,$1004,$FFF8; 4
  31636. word_190B6:
  31637. dc.w 4
  31638. dc.w $F00D, 0, 0,$FFF0
  31639. dc.w 5, 8, 4, 0; 4
  31640. dc.w $FB05, $C, 6,$FFF6; 8
  31641. dc.w 5,$201C,$200E,$FFF0; 12
  31642. word_190D8:
  31643. dc.w 3
  31644. dc.w $F60D, 0, 0,$FFEA
  31645. dc.w $605, 8, 4,$FFFA; 4
  31646. dc.w 5,$201C,$200E,$FFF0; 8
  31647. word_190F2:
  31648. dc.w 4
  31649. dc.w $E60D, 0, 0,$FFFB
  31650. dc.w $F605, 8, 4, $B; 4
  31651. dc.w $F30B, $10, 8,$FFF6; 8
  31652. dc.w 5,$201C,$200E,$FFF0; 12
  31653. word_19114:
  31654. dc.w 4
  31655. dc.w $D,$1000,$1000,$FFF0
  31656. dc.w $F005,$1008,$1004, 0; 4
  31657. dc.w $F505,$100C,$1006,$FFF6; 8
  31658. dc.w $F005,$301C,$300E,$FFF0; 12
  31659. word_19136:
  31660. dc.w 4
  31661. dc.w $F00D, 0, 0,$FFF0
  31662. dc.w 5, 8, 4, 0; 4
  31663. dc.w $FB05, $C, 6,$FFF6; 8
  31664. dc.w 5, $1C, $E,$FFF0; 12
  31665. word_19158:
  31666. dc.w 3
  31667. dc.w $F60D, 0, 0,$FFEA
  31668. dc.w $605, 8, 4,$FFFA; 4
  31669. dc.w 5, $1C, $E,$FFF0; 8
  31670. word_19172:
  31671. dc.w 4
  31672. dc.w $E60D, 0, 0,$FFFB
  31673. dc.w $F605, 8, 4, $B; 4
  31674. dc.w $F30B, $10, 8,$FFF6; 8
  31675. dc.w 5, $1C, $E,$FFF0; 12
  31676. word_19194:
  31677. dc.w 4
  31678. dc.w $D,$1000,$1000,$FFF0
  31679. dc.w $F005,$1008,$1004, 0; 4
  31680. dc.w $F505,$100C,$1006,$FFF6; 8
  31681. dc.w $F005,$101C,$100E,$FFF0; 12
  31682. ; ===========================================================================
  31683.  
  31684. if gameRevision<2
  31685. nop
  31686. endif
  31687.  
  31688.  
  31689.  
  31690.  
  31691. ; ----------------------------------------------------------------------------
  31692. ; Object 0D - End of level sign post
  31693. ; ----------------------------------------------------------------------------
  31694. ; OST:
  31695. obj0D_spinframe = objoff_30 ; $30(a0)
  31696. obj0D_sparkleframe = objoff_34 ; $34(a0)
  31697. obj0D_finalanim = objoff_36 ; $36(a0) ; 4 if Tails only, 3 otherwise (determines what character to show)
  31698. ; ----------------------------------------------------------------------------
  31699.  
  31700. Obj0D:
  31701. moveq #0,d0
  31702. move.b routine(a0),d0
  31703. move.w Obj0D_Index(pc,d0.w),d1
  31704. jsr Obj0D_Index(pc,d1.w)
  31705. lea (Ani_obj0D).l,a1
  31706. bsr.w AnimateSprite
  31707. bsr.w PLCLoad_Signpost
  31708. bra.w MarkObjGone
  31709. ; ===========================================================================
  31710. ; off_191D8: Obj_0D_subtbl: Obj0D_States:
  31711. Obj0D_Index: offsetTable
  31712. offsetTableEntry.w Obj0D_Init ; 0
  31713. offsetTableEntry.w Obj0D_Main ; 2
  31714. ; ===========================================================================
  31715. ; loc_191DC: Obj_0D_sub_0:
  31716. Obj0D_Init:
  31717. tst.w (Two_player_mode).w
  31718. beq.s loc_19208
  31719. move.l #Obj0D_MapUnc_19656,mappings(a0)
  31720. move.w #make_art_tile(ArtTile_ArtNem_2p_Signpost,0,0),art_tile(a0)
  31721. move.b #-1,(Signpost_prev_frame).w
  31722. moveq #0,d1
  31723. move.w #$1020,d1
  31724. move.w #-$80,d4
  31725. moveq #0,d5
  31726. bsr.w loc_19564
  31727. bra.s loc_1922C
  31728. ; ---------------------------------------------------------------------------
  31729.  
  31730. loc_19208:
  31731. cmpi.w #metropolis_zone_act_2,(Current_ZoneAndAct).w
  31732. beq.s loc_1921E
  31733. tst.b (Current_Act).w
  31734. beq.s loc_1921E
  31735. move.w #0,x_pos(a0)
  31736. rts
  31737. ; ---------------------------------------------------------------------------
  31738. loc_1921E:
  31739. move.l #Obj0D_MapUnc_195BE,mappings(a0)
  31740. move.w #make_art_tile(ArtTile_ArtNem_Signpost,0,0),art_tile(a0)
  31741.  
  31742. loc_1922C:
  31743. addq.b #2,routine(a0) ; => Obj0D_Main
  31744. bsr.w Adjust2PArtPointer
  31745. move.b #4,render_flags(a0)
  31746. move.b #$18,width_pixels(a0)
  31747. move.b #4,priority(a0)
  31748. move.w #$3C3C,(Loser_Time_Left).w
  31749.  
  31750. ; loc_1924C: Obj_0D_sub_2:
  31751. Obj0D_Main:
  31752. tst.b (Update_HUD_timer).w
  31753. beq.w loc_192D6
  31754. lea (MainCharacter).w,a1 ; a1=character
  31755. move.w x_pos(a1),d0
  31756. sub.w x_pos(a0),d0
  31757. bcs.s loc_192D6
  31758. cmpi.w #$20,d0
  31759. bhs.s loc_192D6
  31760. move.w #SndID_Signpost,d0
  31761. jsr (PlayMusic).l ; play spinning sound
  31762. clr.b (Update_HUD_timer).w
  31763. move.w #1,anim(a0)
  31764. move.w #0,obj0D_spinframe(a0)
  31765. move.w (Camera_Max_X_pos).w,(Camera_Min_X_pos).w ; lock screen
  31766. move.b #2,routine_secondary(a0) ; => Obj0D_Main_State2
  31767. cmpi.b #$C,(Loser_Time_Left).w
  31768. bhi.s loc_192A0
  31769. move.w (Level_Music).w,d0
  31770. jsr (PlayMusic).l ; play zone music
  31771.  
  31772. loc_192A0:
  31773. tst.b obj0D_finalanim(a0)
  31774. bne.w loc_19350
  31775. move.b #3,obj0D_finalanim(a0)
  31776. cmpi.w #2,(Player_mode).w
  31777. bne.s loc_192BC
  31778. move.b #4,obj0D_finalanim(a0)
  31779.  
  31780. loc_192BC:
  31781. tst.w (Two_player_mode).w
  31782. beq.w loc_19350
  31783. move.w #$3C3C,(Loser_Time_Left).w
  31784. move.w #SndID_Signpost2P,d0 ; play different spinning sound
  31785. jsr (PlaySound).l
  31786. bra.s loc_19350
  31787. ; ---------------------------------------------------------------------------
  31788.  
  31789. loc_192D6:
  31790. tst.w (Two_player_mode).w
  31791. beq.s loc_19350
  31792. tst.b (Update_HUD_timer_2P).w
  31793. beq.s loc_19350
  31794. lea (Sidekick).w,a1 ; a1=character
  31795. move.w x_pos(a1),d0
  31796. sub.w x_pos(a0),d0
  31797. bcs.s loc_19350
  31798. cmpi.w #$20,d0
  31799. bhs.s loc_19350
  31800. move.w #SndID_Signpost,d0
  31801. jsr (PlayMusic).l
  31802. clr.b (Update_HUD_timer_2P).w
  31803. move.w #1,anim(a0)
  31804. move.w #0,obj0D_spinframe(a0)
  31805. move.w (Tails_Max_X_pos).w,(Tails_Min_X_pos).w
  31806. move.b #2,routine_secondary(a0) ; => Obj0D_Main_State2
  31807. cmpi.b #$C,(Loser_Time_Left).w
  31808. bhi.s loc_1932E
  31809. move.w (Level_Music).w,d0
  31810. jsr (PlayMusic).l
  31811.  
  31812. loc_1932E:
  31813. tst.b obj0D_finalanim(a0)
  31814. bne.s loc_19350
  31815. move.b #4,obj0D_finalanim(a0)
  31816. tst.w (Two_player_mode).w
  31817. beq.s loc_19350
  31818. move.w #$3C3C,(Loser_Time_Left).w
  31819. move.w #SndID_Signpost2P,d0
  31820. jsr (PlaySound).l
  31821.  
  31822. loc_19350:
  31823. moveq #0,d0
  31824. move.b routine_secondary(a0),d0
  31825. move.w Obj0D_Main_States(pc,d0.w),d1
  31826. jmp Obj0D_Main_States(pc,d1.w)
  31827. ; ===========================================================================
  31828. Obj0D_Main_States: offsetTable
  31829. offsetTableEntry.w Obj0D_Main_StateNull ; 0
  31830. offsetTableEntry.w Obj0D_Main_State2 ; 2
  31831. offsetTableEntry.w Obj0D_Main_State3 ; 4
  31832. offsetTableEntry.w Obj0D_Main_State4 ; 6
  31833. ; ===========================================================================
  31834. ; return_19366:
  31835. Obj0D_Main_StateNull:
  31836. rts
  31837. ; ===========================================================================
  31838. ; loc_19368:
  31839. Obj0D_Main_State2:
  31840. subq.w #1,obj0D_spinframe(a0)
  31841. bpl.s loc_19398
  31842. move.w #$3C,obj0D_spinframe(a0)
  31843. addq.b #1,anim(a0)
  31844. cmpi.b #3,anim(a0)
  31845. bne.s loc_19398
  31846. move.b #4,routine_secondary(a0) ; => Obj0D_Main_State3
  31847. move.b obj0D_finalanim(a0),anim(a0)
  31848. tst.w (Two_player_mode).w
  31849. beq.s loc_19398
  31850. move.b #6,routine_secondary(a0) ; => Obj0D_Main_State4
  31851.  
  31852. loc_19398:
  31853. subq.w #1,objoff_32(a0)
  31854. bpl.s return_19406
  31855. move.w #$B,objoff_32(a0)
  31856. moveq #0,d0
  31857. move.b obj0D_sparkleframe(a0),d0
  31858. addq.b #2,obj0D_sparkleframe(a0)
  31859. andi.b #$E,obj0D_sparkleframe(a0)
  31860. lea Obj0D_RingSparklePositions(pc,d0.w),a2
  31861. bsr.w SingleObjLoad
  31862. bne.s return_19406
  31863. _move.b #ObjID_Ring,id(a1) ; load obj25 (a ring) for the sparkly effects over the signpost
  31864. move.b #6,routine(a1) ; => Obj_25_sub_6
  31865. move.b (a2)+,d0
  31866. ext.w d0
  31867. add.w x_pos(a0),d0
  31868. move.w d0,x_pos(a1)
  31869. move.b (a2)+,d0
  31870. ext.w d0
  31871. add.w y_pos(a0),d0
  31872. move.w d0,y_pos(a1)
  31873. move.l #Obj25_MapUnc_12382,mappings(a1)
  31874. move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a1)
  31875. bsr.w Adjust2PArtPointer2
  31876. move.b #4,render_flags(a1)
  31877. move.b #2,priority(a1)
  31878. move.b #8,width_pixels(a1)
  31879.  
  31880. return_19406:
  31881. rts
  31882. ; ===========================================================================
  31883. ; byte_19408:
  31884. Obj0D_RingSparklePositions:
  31885. dc.b -24,-16 ; 1
  31886. dc.b 8, 8 ; 3
  31887. dc.b -16, 0 ; 5
  31888. dc.b 24, -8 ; 7
  31889. dc.b 0, -8 ; 9
  31890. dc.b 16, 0 ; 11
  31891. dc.b -24, 8 ; 13
  31892. dc.b 24, 16 ; 15
  31893. ; ===========================================================================
  31894. ; loc_19418:
  31895. Obj0D_Main_State3:
  31896. tst.w (Debug_placement_mode).w
  31897. bne.w return_194D0
  31898. btst #1,(MainCharacter+status).w
  31899. bne.s loc_19434
  31900. move.b #1,(Control_Locked).w
  31901. move.w #(button_right_mask<<8)|0,(Ctrl_1_Logical).w
  31902.  
  31903. loc_19434:
  31904. tst.b (MainCharacter).w
  31905. beq.s loc_1944C
  31906. move.w (MainCharacter+x_pos).w,d0
  31907. move.w (Camera_Max_X_pos).w,d1
  31908. addi.w #$128,d1
  31909. cmp.w d1,d0
  31910. blo.w return_194D0
  31911.  
  31912. loc_1944C:
  31913. move.b #0,routine_secondary(a0) ; => Obj0D_Main_StateNull
  31914. ;loc_19452:
  31915. Load_EndOfAct:
  31916. lea (MainCharacter).w,a1 ; a1=character
  31917. clr.b status_secondary(a1)
  31918. clr.b (Update_HUD_timer).w
  31919. bsr.w SingleObjLoad
  31920. bne.s +
  31921. move.b #ObjID_Results,id(a1) ; load obj3A (end of level results screen)
  31922. +
  31923. moveq #PLCID_Results,d0
  31924. cmpi.w #2,(Player_mode).w
  31925. bne.s +
  31926. moveq #PLCID_ResultsTails,d0
  31927. +
  31928. jsr (LoadPLC2).l
  31929. move.b #1,(Update_Bonus_score).w
  31930. moveq #0,d0
  31931. move.b (Timer_minute).w,d0
  31932. mulu.w #$3C,d0
  31933. moveq #0,d1
  31934. move.b (Timer_second).w,d1
  31935. add.w d1,d0
  31936. divu.w #$F,d0
  31937. moveq #$14,d1
  31938. cmp.w d1,d0
  31939. blo.s +
  31940. move.w d1,d0
  31941. +
  31942. add.w d0,d0
  31943. move.w TimeBonuses(pc,d0.w),(Bonus_Countdown_1).w
  31944. move.w (Ring_count).w,d0
  31945. mulu.w #$A,d0
  31946. move.w d0,(Bonus_Countdown_2).w
  31947. clr.w (Total_Bonus_Countdown).w
  31948. clr.w (Bonus_Countdown_3).w
  31949. tst.w (Perfect_rings_left).w
  31950. bne.s +
  31951. move.w #5000,(Bonus_Countdown_3).w
  31952. +
  31953. move.w #MusID_EndLevel,d0
  31954. jsr (PlayMusic).l
  31955.  
  31956. return_194D0:
  31957. rts
  31958. ; ===========================================================================
  31959. ; word_194D2:
  31960. TimeBonuses:
  31961. dc.w 5000, 5000, 1000, 500, 400, 400, 300, 300
  31962. dc.w 200, 200, 200, 200, 100, 100, 100, 100
  31963. dc.w 50, 50, 50, 50, 0
  31964. ; ===========================================================================
  31965. ; loc_194FC:
  31966. Obj0D_Main_State4:
  31967. subq.w #1,obj0D_spinframe(a0)
  31968. bpl.s return_19532
  31969. tst.b (Time_Over_flag).w
  31970. bne.s return_19532
  31971. tst.b (Time_Over_flag_2P).w
  31972. bne.s return_19532
  31973. tst.b (Update_HUD_timer).w
  31974. bne.s return_19532
  31975. tst.b (Update_HUD_timer_2P).w
  31976. bne.s return_19532
  31977. move.b #0,(Last_star_pole_hit).w
  31978. move.b #0,(Last_star_pole_hit_2P).w
  31979. move.b #GameModeID_2PResults,(Game_Mode).w ; => TwoPlayerResults
  31980. move.w #VsRSID_Act,(Results_Screen_2P).w
  31981.  
  31982. return_19532:
  31983. rts
  31984. ; ===========================================================================
  31985.  
  31986. PLCLoad_Signpost:
  31987. tst.w (Two_player_mode).w
  31988. beq.s return_1958C
  31989. moveq #0,d0
  31990. move.b mapping_frame(a0),d0
  31991. cmp.b (Signpost_prev_frame).w,d0
  31992. beq.s return_1958C
  31993. move.b d0,(Signpost_prev_frame).w
  31994. lea (Obj0D_MapRUnc_196EE).l,a2
  31995. add.w d0,d0
  31996. adda.w (a2,d0.w),a2
  31997. move.w (a2)+,d5
  31998. subq.w #1,d5
  31999. bmi.s return_1958C
  32000. move.w #tiles_to_bytes(ArtTile_ArtUnc_Signpost),d4
  32001.  
  32002. loc_19560:
  32003. moveq #0,d1
  32004. move.w (a2)+,d1
  32005.  
  32006. loc_19564:
  32007. move.w d1,d3
  32008. lsr.w #8,d3
  32009. andi.w #$F0,d3
  32010. addi.w #$10,d3
  32011. andi.w #$FFF,d1
  32012. lsl.l #5,d1
  32013. addi.l #ArtUnc_Signpost,d1
  32014. move.w d4,d2
  32015. add.w d3,d4
  32016. add.w d3,d4
  32017. jsr (QueueDMATransfer).l
  32018. dbf d5,loc_19560
  32019.  
  32020. return_1958C:
  32021. rts
  32022. ; ===========================================================================
  32023. ; animation script
  32024. ; off_1958E:
  32025. Ani_obj0D: offsetTable
  32026. offsetTableEntry.w byte_19598 ; 0
  32027. offsetTableEntry.w byte_1959B ; 1
  32028. offsetTableEntry.w byte_195A9 ; 2
  32029. offsetTableEntry.w byte_195B7 ; 3
  32030. offsetTableEntry.w byte_195BA ; 4
  32031. byte_19598: dc.b $0F, $02, $FF
  32032. rev02even
  32033. byte_1959B: dc.b $01, $02, $03, $04, $05, $01, $03, $04, $05, $00, $03, $04, $05, $FF
  32034. rev02even
  32035. byte_195A9: dc.b $01, $02, $03, $04, $05, $01, $03, $04, $05, $00, $03, $04, $05, $FF
  32036. rev02even
  32037. byte_195B7: dc.b $0F, $00, $FF
  32038. rev02even
  32039. byte_195BA: dc.b $0F, $01, $FF
  32040. even
  32041. ; -------------------------------------------------------------------------------
  32042. ; sprite mappings - Primary sprite table for object 0D (signpost)
  32043. ; -------------------------------------------------------------------------------
  32044. ; SprTbl_0D_Primary:
  32045. Obj0D_MapUnc_195BE: BINCLUDE "mappings/sprite/obj0D_a.bin"
  32046. ; -------------------------------------------------------------------------------
  32047. ; sprite mappings - Secondary sprite table for object 0D (signpost)
  32048. ; -------------------------------------------------------------------------------
  32049. ; SprTbl_0D_Scndary:
  32050. Obj0D_MapUnc_19656: BINCLUDE "mappings/sprite/obj0D_b.bin"
  32051. ; -------------------------------------------------------------------------------
  32052. ; dynamic pattern loading cues
  32053. ; -------------------------------------------------------------------------------
  32054. Obj0D_MapRUnc_196EE: BINCLUDE "mappings/spriteDPLC/obj0D.bin"
  32055. ; ===========================================================================
  32056.  
  32057. if gameRevision<2
  32058. nop
  32059. endif
  32060.  
  32061.  
  32062.  
  32063.  
  32064. ; ---------------------------------------------------------------------------
  32065. ; Solid object subroutines (includes spikes, blocks, rocks etc)
  32066. ; These check collision of Sonic/Tails with objects on the screen
  32067. ;
  32068. ; input variables:
  32069. ; d1 = object width
  32070. ; d2 = object height / 2 (when jumping)
  32071. ; d3 = object height / 2 (when walking)
  32072. ; d4 = object x-axis position
  32073. ;
  32074. ; address registers:
  32075. ; a0 = the object to check collision with
  32076. ; a1 = sonic or tails (set inside these subroutines)
  32077. ; ---------------------------------------------------------------------------
  32078.  
  32079. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  32080.  
  32081. ; loc_19718:
  32082. SolidObject:
  32083. lea (MainCharacter).w,a1 ; a1=character
  32084. moveq #p1_standing_bit,d6
  32085. movem.l d1-d4,-(sp) ; store input registers
  32086. bsr.s + ; first check collision with Sonic
  32087. movem.l (sp)+,d1-d4 ; restore input registers
  32088. lea (Sidekick).w,a1 ; a1=character ; now check collision with Tails
  32089. tst.b render_flags(a1)
  32090. bpl.w return_19776 ; return if no Tails
  32091. addq.b #1,d6
  32092. +
  32093. btst d6,status(a0)
  32094. beq.w SolidObject_OnScreenTest
  32095. move.w d1,d2
  32096. add.w d2,d2
  32097. btst #1,status(a1)
  32098. bne.s loc_1975A
  32099. move.w x_pos(a1),d0
  32100. sub.w x_pos(a0),d0
  32101. add.w d1,d0
  32102. bmi.s loc_1975A
  32103. cmp.w d2,d0
  32104. blo.s loc_1976E
  32105.  
  32106. loc_1975A:
  32107. bclr #3,status(a1)
  32108. bset #1,status(a1)
  32109. bclr d6,status(a0)
  32110. moveq #0,d4
  32111. rts
  32112. ; ---------------------------------------------------------------------------
  32113. loc_1976E:
  32114. move.w d4,d2
  32115. bsr.w MvSonicOnPtfm
  32116. moveq #0,d4
  32117.  
  32118. return_19776:
  32119. rts
  32120.  
  32121. ; ===========================================================================
  32122. ; there are a few slightly different SolidObject functions
  32123. ; specialized for certain objects, in this case, obj74 and obj30
  32124. ; These check for solidity even if the object is off-screen
  32125. ; loc_19778: SolidObject74_30:
  32126. SolidObject_Always:
  32127. lea (MainCharacter).w,a1 ; a1=character
  32128. moveq #p1_standing_bit,d6
  32129. movem.l d1-d4,-(sp)
  32130. bsr.s SolidObject_Always_SingleCharacter
  32131. movem.l (sp)+,d1-d4
  32132. lea (Sidekick).w,a1 ; a1=character
  32133. addq.b #1,d6
  32134. ;loc_1978E:
  32135. SolidObject_Always_SingleCharacter:
  32136. btst d6,status(a0)
  32137. beq.w SolidObject_cont
  32138. move.w d1,d2
  32139. add.w d2,d2
  32140. btst #1,status(a1)
  32141. bne.s loc_197B2
  32142. move.w x_pos(a1),d0
  32143. sub.w x_pos(a0),d0
  32144. add.w d1,d0
  32145. bmi.s loc_197B2
  32146. cmp.w d2,d0
  32147. blo.s loc_197C6
  32148.  
  32149. loc_197B2:
  32150. bclr #3,status(a1)
  32151. bset #1,status(a1)
  32152. bclr d6,status(a0)
  32153. moveq #0,d4
  32154. rts
  32155. ; ---------------------------------------------------------------------------
  32156. loc_197C6:
  32157. move.w d4,d2
  32158. bsr.w MvSonicOnPtfm
  32159. moveq #0,d4
  32160. rts
  32161.  
  32162. ; ===========================================================================
  32163. ; ---------------------------------------------------------------------------
  32164. ; Subroutine to collide Sonic/Tails with the top of a sloped solid like diagonal springs
  32165. ; ---------------------------------------------------------------------------
  32166. ;
  32167. ; input variables:
  32168. ; d1 = object width
  32169. ; d2 = object height / 2 (when jumping)
  32170. ; d3 = object height / 2 (when walking)
  32171. ; d4 = object x-axis position
  32172. ;
  32173. ; address registers:
  32174. ; a0 = the object to check collision with
  32175. ; a1 = sonic or tails (set inside these subroutines)
  32176. ; a2 = height data for slope
  32177. ; loc_197D0: SolidObject86_30:
  32178. SlopedSolid:
  32179. lea (MainCharacter).w,a1 ; a1=character
  32180. moveq #p1_standing_bit,d6
  32181. movem.l d1-d4,-(sp)
  32182. bsr.s SlopedSolid_SingleCharacter
  32183. movem.l (sp)+,d1-d4
  32184. lea (Sidekick).w,a1 ; a1=character
  32185. addq.b #1,d6
  32186.  
  32187. ; this gets called from a few more places...
  32188. ; loc_197E6: SolidObject_Simple:
  32189. SlopedSolid_SingleCharacter:
  32190. btst d6,status(a0)
  32191. beq.w SlopedSolid_cont
  32192. move.w d1,d2
  32193. add.w d2,d2
  32194. btst #1,status(a1)
  32195. bne.s loc_1980A
  32196. move.w x_pos(a1),d0
  32197. sub.w x_pos(a0),d0
  32198. add.w d1,d0
  32199. bmi.s loc_1980A
  32200. cmp.w d2,d0
  32201. blo.s loc_1981E
  32202.  
  32203. loc_1980A:
  32204. bclr #3,status(a1)
  32205. bset #1,status(a1)
  32206. bclr d6,status(a0)
  32207. moveq #0,d4
  32208. rts
  32209. ; ---------------------------------------------------------------------------
  32210. loc_1981E:
  32211. move.w d4,d2
  32212. bsr.w MvSonicOnSlope
  32213. moveq #0,d4
  32214. rts
  32215.  
  32216. ; ===========================================================================
  32217. ; unused/dead code for some SolidObject check
  32218. ; This is for a sloped object that is sloped at the top and at the bottom.
  32219. ; SolidObject_Unk: loc_19828:
  32220. ;DoubleSlopedSolid:
  32221. ; a0=object
  32222. lea (MainCharacter).w,a1 ; a1=character
  32223. moveq #p1_standing_bit,d6
  32224. movem.l d1-d4,-(sp)
  32225. bsr.s +
  32226. movem.l (sp)+,d1-d4
  32227. lea (Sidekick).w,a1 ; a1=character
  32228. addq.b #1,d6
  32229. +
  32230. btst d6,status(a0)
  32231. beq.w DoubleSlopedSolid_cont
  32232. move.w d1,d2
  32233. add.w d2,d2
  32234. btst #1,status(a1)
  32235. bne.s loc_19862
  32236. move.w x_pos(a1),d0
  32237. sub.w x_pos(a0),d0
  32238. add.w d1,d0
  32239. bmi.s loc_19862
  32240. cmp.w d2,d0
  32241. blo.s loc_19876
  32242.  
  32243. loc_19862:
  32244. bclr #3,status(a1)
  32245. bset #1,status(a1)
  32246. bclr d6,status(a0)
  32247. moveq #0,d4
  32248. rts
  32249. ; ---------------------------------------------------------------------------
  32250. loc_19876:
  32251. move.w d4,d2
  32252. bsr.w MvSonicOnDoubleSlope
  32253. moveq #0,d4
  32254. rts
  32255.  
  32256. ; ===========================================================================
  32257. ; loc_19880:
  32258. SolidObject45:
  32259. lea (MainCharacter).w,a1 ; a1=character
  32260. moveq #p1_standing_bit,d6
  32261. movem.l d1-d4,-(sp)
  32262. bsr.s loc_19896
  32263. movem.l (sp)+,d1-d4
  32264. lea (Sidekick).w,a1 ; a1=character
  32265. addq.b #1,d6
  32266.  
  32267. loc_19896:
  32268. btst d6,status(a0)
  32269. beq.w SolidObject45_cont
  32270. btst #1,status(a1)
  32271. bne.s loc_198B8
  32272. move.w x_pos(a1),d0
  32273. sub.w x_pos(a0),d0
  32274. add.w d1,d0
  32275. bmi.s loc_198B8
  32276. add.w d1,d1
  32277. cmp.w d1,d0
  32278. blo.s loc_198CC
  32279.  
  32280. loc_198B8:
  32281. bclr #3,status(a1)
  32282. bset #1,status(a1)
  32283. bclr d6,status(a0)
  32284. moveq #0,d4
  32285. rts
  32286. ; ---------------------------------------------------------------------------
  32287. loc_198CC:
  32288. ; Inlined call to MvSonicOnPtfm
  32289. move.w y_pos(a0),d0
  32290. sub.w d2,d0
  32291. add.w d3,d0
  32292. moveq #0,d1
  32293. move.b y_radius(a1),d1
  32294. sub.w d1,d0
  32295. move.w d0,y_pos(a1)
  32296. sub.w x_pos(a0),d4
  32297. sub.w d4,x_pos(a1)
  32298. moveq #0,d4
  32299. rts
  32300. ; ===========================================================================
  32301. ; loc_198EC: SolidObject45_alt:
  32302. SolidObject45_cont:
  32303. move.w x_pos(a1),d0
  32304. sub.w x_pos(a0),d0
  32305. add.w d1,d0
  32306. bmi.w SolidObject_TestClearPush
  32307. move.w d1,d4
  32308. add.w d4,d4
  32309. cmp.w d4,d0
  32310. bhi.w SolidObject_TestClearPush
  32311. move.w y_pos(a0),d5
  32312. add.w d3,d5
  32313. move.b y_radius(a1),d3
  32314. ext.w d3
  32315. add.w d3,d2
  32316. move.w y_pos(a1),d3
  32317. sub.w d5,d3
  32318. addq.w #4,d3
  32319. add.w d2,d3
  32320. bmi.w SolidObject_TestClearPush
  32321. move.w d2,d4
  32322. add.w d4,d4
  32323. cmp.w d4,d3
  32324. bhs.w SolidObject_TestClearPush
  32325. bra.w SolidObject_ChkBounds
  32326. ; ===========================================================================
  32327. ; loc_1992E: SolidObject86_30_alt:
  32328. SlopedSolid_cont:
  32329. move.w x_pos(a1),d0
  32330. sub.w x_pos(a0),d0
  32331. add.w d1,d0
  32332. bmi.w SolidObject_TestClearPush
  32333. move.w d1,d3
  32334. add.w d3,d3
  32335. cmp.w d3,d0
  32336. bhi.w SolidObject_TestClearPush
  32337. move.w d0,d5
  32338. btst #0,render_flags(a0)
  32339. beq.s +
  32340. not.w d5
  32341. add.w d3,d5
  32342. +
  32343. lsr.w #1,d5
  32344. move.b (a2,d5.w),d3
  32345. sub.b (a2),d3
  32346. ext.w d3
  32347. move.w y_pos(a0),d5
  32348. sub.w d3,d5
  32349. move.b y_radius(a1),d3
  32350. ext.w d3
  32351. add.w d3,d2
  32352. move.w y_pos(a1),d3
  32353. sub.w d5,d3
  32354. addq.w #4,d3
  32355. add.w d2,d3
  32356. bmi.w SolidObject_TestClearPush
  32357. move.w d2,d4
  32358. add.w d4,d4
  32359. cmp.w d4,d3
  32360. bhs.w SolidObject_TestClearPush
  32361. bra.w SolidObject_ChkBounds
  32362. ; ===========================================================================
  32363. ; unused/dead code
  32364. ; loc_19988: SolidObject_Unk_cont:
  32365. DoubleSlopedSolid_cont:
  32366. move.w x_pos(a1),d0
  32367. sub.w x_pos(a0),d0
  32368. add.w d1,d0
  32369. bmi.w SolidObject_TestClearPush
  32370. move.w d1,d3
  32371. add.w d3,d3
  32372. cmp.w d3,d0
  32373. bhi.w SolidObject_TestClearPush
  32374. move.w d0,d5
  32375. btst #0,render_flags(a0)
  32376. beq.s +
  32377. not.w d5
  32378. add.w d3,d5
  32379. +
  32380. andi.w #$FFFE,d5
  32381. move.b (a2,d5.w),d3
  32382. move.b 1(a2,d5.w),d2
  32383. ext.w d2
  32384. ext.w d3
  32385. move.w y_pos(a0),d5
  32386. sub.w d3,d5
  32387. move.w y_pos(a1),d3
  32388. sub.w d5,d3
  32389. move.b y_radius(a1),d5
  32390. ext.w d5
  32391. add.w d5,d3
  32392. addq.w #4,d3
  32393. bmi.w SolidObject_TestClearPush
  32394. add.w d5,d2
  32395. move.w d2,d4
  32396. add.w d5,d4
  32397. cmp.w d4,d3
  32398. bhs.w SolidObject_TestClearPush
  32399. bra.w SolidObject_ChkBounds
  32400. ; ===========================================================================
  32401. ; loc_199E8: SolidObject_cont:
  32402. SolidObject_OnScreenTest:
  32403. tst.b render_flags(a0)
  32404. bpl.w SolidObject_TestClearPush
  32405. ;loc_199F0:
  32406. SolidObject_cont:
  32407. ; We now perform the x portion of a bounding box check. To do this, we assume a
  32408. ; coordinate system where the x origin is at the object's left edge.
  32409. move.w x_pos(a1),d0 ; load Sonic's x position...
  32410. sub.w x_pos(a0),d0 ; ... and calculate his x position relative to the object
  32411. add.w d1,d0 ; assume object's left edge is at (0,0). This is also Sonic's distance to the object's left edge.
  32412. bmi.w SolidObject_TestClearPush ; branch, if Sonic is outside the object's left edge
  32413. move.w d1,d3
  32414. add.w d3,d3 ; calculate object's width
  32415. cmp.w d3,d0
  32416. bhi.w SolidObject_TestClearPush ; branch, if Sonic is outside the object's right edge
  32417. ; We now perform the y portion of a bounding box check. To do this, we assume a
  32418. ; coordinate system where the y origin is at the highest y position relative to the object
  32419. ; at which Sonic would still collide with it. This point is
  32420. ; y_pos(object) - width(object)/2 - y_radius(Sonic) - 4,
  32421. ; where object is stored in (a0), Sonic in (a1), and height(object)/2 in d2. This way
  32422. ; of doing it causes the object's hitbox to be vertically off-center by -4 pixels.
  32423. move.b y_radius(a1),d3 ; load Sonic's y radius
  32424. ext.w d3
  32425. add.w d3,d2 ; calculate maximum distance for a top collision
  32426. move.w y_pos(a1),d3 ; load Sonic's y position...
  32427. sub.w y_pos(a0),d3 ; ... and calculate his y position relative to the object
  32428. addq.w #4,d3 ; assume a slightly lower position for Sonic
  32429. add.w d2,d3 ; assume the highest position where Sonic would still be colliding with the object to be (0,0)
  32430. bmi.w SolidObject_TestClearPush ; branch, if Sonic is above this point
  32431. andi.w #$7FF,d3
  32432. move.w d2,d4
  32433. add.w d4,d4 ; calculate minimum distance for a bottom collision
  32434. cmp.w d4,d3
  32435. bhs.w SolidObject_TestClearPush ; branch, if Sonic is below this point
  32436. ;loc_19A2E:
  32437. SolidObject_ChkBounds:
  32438. tst.b obj_control(a1)
  32439. bmi.w SolidObject_TestClearPush ; branch, if object collisions are disabled for Sonic
  32440. cmpi.b #6,routine(a1) ; is Sonic dead?
  32441. bhs.w loc_19AEA ; if yes, branch
  32442. tst.w (Debug_placement_mode).w
  32443. bne.w loc_19AEA ; branch, if in debug mode
  32444.  
  32445. move.w d0,d5
  32446. cmp.w d0,d1
  32447. bhs.s + ; branch, if Sonic is to the object's left
  32448. add.w d1,d1
  32449. sub.w d1,d0
  32450. move.w d0,d5 ; calculate Sonic's distance to the object's right edge...
  32451. neg.w d5 ; ... and calculate the absolute value
  32452. +
  32453. move.w d3,d1
  32454. cmp.w d3,d2
  32455. bhs.s +
  32456. subq.w #4,d3
  32457. sub.w d4,d3
  32458. move.w d3,d1
  32459. neg.w d1
  32460. +
  32461. cmp.w d1,d5
  32462. bhi.w loc_19AEE ; branch, if horizontal distance is greater than vertical distance
  32463.  
  32464. loc_19A6A:
  32465. cmpi.w #4,d1
  32466. bls.s loc_19AB6
  32467. tst.w d0
  32468. beq.s loc_19A90
  32469. bmi.s loc_19A7E
  32470. tst.w x_vel(a1)
  32471. bmi.s loc_19A90
  32472. bra.s loc_19A84
  32473. ; ===========================================================================
  32474.  
  32475. loc_19A7E:
  32476. tst.w x_vel(a1)
  32477. bpl.s loc_19A90
  32478.  
  32479. loc_19A84:
  32480. move.w #0,inertia(a1)
  32481. move.w #0,x_vel(a1)
  32482.  
  32483. loc_19A90:
  32484. sub.w d0,x_pos(a1)
  32485. btst #1,status(a1)
  32486. bne.s loc_19AB6
  32487. move.l d6,d4
  32488. addq.b #pushing_bit_delta,d4 ; Character is pushing, not standing
  32489. bset d4,status(a0)
  32490. bset #5,status(a1)
  32491. move.w d6,d4
  32492. addi.b #($10-p1_standing_bit+p1_touch_side_bit),d4
  32493. bset d4,d6 ; This sets bits 0 (Sonic) or 1 (Tails) of high word of d6
  32494. moveq #1,d4
  32495. rts
  32496. ; ===========================================================================
  32497.  
  32498. loc_19AB6:
  32499. bsr.s loc_19ADC
  32500. move.w d6,d4
  32501. addi.b #($10-p1_standing_bit+p1_touch_side_bit),d4
  32502. bset d4,d6 ; This sets bits 0 (Sonic) or 1 (Tails) of high word of d6
  32503. moveq #1,d4
  32504. rts
  32505. ; ===========================================================================
  32506. ;loc_19AC4:
  32507. SolidObject_TestClearPush:
  32508. move.l d6,d4
  32509. addq.b #pushing_bit_delta,d4
  32510. btst d4,status(a0)
  32511. beq.s loc_19AEA
  32512. cmpi.b #AniIDSonAni_Roll,anim(a1)
  32513. beq.s loc_19ADC
  32514. move.w #AniIDSonAni_Run,anim(a1)
  32515.  
  32516. loc_19ADC:
  32517. move.l d6,d4
  32518. addq.b #pushing_bit_delta,d4
  32519. bclr d4,status(a0)
  32520. bclr #5,status(a1)
  32521.  
  32522. loc_19AEA:
  32523. moveq #0,d4
  32524. rts
  32525. ; ===========================================================================
  32526.  
  32527. loc_19AEE:
  32528. tst.w d3
  32529. bmi.s loc_19B06
  32530. cmpi.w #$10,d3
  32531. blo.s loc_19B56
  32532. cmpi.b #ObjID_LauncherSpring,id(a0)
  32533. bne.s SolidObject_TestClearPush
  32534. cmpi.w #$14,d3
  32535. blo.s loc_19B56
  32536. bra.s SolidObject_TestClearPush
  32537. ; ===========================================================================
  32538.  
  32539. loc_19B06:
  32540. tst.w y_vel(a1)
  32541. beq.s loc_19B28
  32542. bpl.s loc_19B1C
  32543. tst.w d3
  32544. bpl.s loc_19B1C
  32545. sub.w d3,y_pos(a1)
  32546. move.w #0,y_vel(a1)
  32547.  
  32548. loc_19B1C:
  32549. move.w d6,d4
  32550. addi.b #($10-p1_standing_bit+p1_touch_bottom_bit),d4
  32551. bset d4,d6 ; This sets bits 2 (Sonic) or 3 (Tails) of high word of d6
  32552. moveq #-2,d4
  32553. rts
  32554. ; ===========================================================================
  32555.  
  32556. loc_19B28:
  32557. btst #1,status(a1)
  32558. bne.s loc_19B1C
  32559. mvabs.w d0,d4
  32560. cmpi.w #$10,d4
  32561. blo.w loc_19A6A
  32562. move.l a0,-(sp)
  32563. movea.l a1,a0
  32564. jsr (KillCharacter).l
  32565. movea.l (sp)+,a0 ; load 0bj address
  32566. move.w d6,d4
  32567. addi.b #($10-p1_standing_bit+p1_touch_bottom_bit),d4
  32568. bset d4,d6 ; This sets bits 2 (Sonic) or 3 (Tails) of high word of d6
  32569. moveq #-2,d4
  32570. rts
  32571. ; ===========================================================================
  32572.  
  32573. loc_19B56:
  32574. subq.w #4,d3
  32575. moveq #0,d1
  32576. move.b width_pixels(a0),d1
  32577. move.w d1,d2
  32578. add.w d2,d2
  32579. add.w x_pos(a1),d1
  32580. sub.w x_pos(a0),d1
  32581. bmi.s loc_19B8E
  32582. cmp.w d2,d1
  32583. bhs.s loc_19B8E
  32584. tst.w y_vel(a1)
  32585. bmi.s loc_19B8E
  32586. sub.w d3,y_pos(a1)
  32587. subq.w #1,y_pos(a1)
  32588. bsr.w RideObject_SetRide
  32589. move.w d6,d4
  32590. addi.b #($10-p1_standing_bit+p1_touch_top_bit),d4
  32591. bset d4,d6 ; This sets bits 4 (Sonic) or 5 (Tails) of high word of d6
  32592. moveq #-1,d4
  32593. rts
  32594. ; ===========================================================================
  32595.  
  32596. loc_19B8E:
  32597. moveq #0,d4
  32598. rts
  32599. ; ===========================================================================
  32600.  
  32601. ; Subroutine to change Sonic's position with a platform
  32602. ; ---------------------------------------------------------------------------
  32603.  
  32604. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  32605. ; loc_19B92:
  32606.  
  32607. MvSonicOnPtfm:
  32608. move.w y_pos(a0),d0
  32609. sub.w d3,d0
  32610. bra.s loc_19BA2
  32611. ; ===========================================================================
  32612. ; a couple lines of unused/leftover/dead code from Sonic 1 ; a0=object
  32613. move.w y_pos(a0),d0
  32614. subi.w #9,d0
  32615.  
  32616. loc_19BA2:
  32617. tst.b obj_control(a1)
  32618. bmi.s return_19BCA
  32619. cmpi.b #6,routine(a1)
  32620. bhs.s return_19BCA
  32621. tst.w (Debug_placement_mode).w
  32622. bne.s return_19BCA
  32623. moveq #0,d1
  32624. move.b y_radius(a1),d1
  32625. sub.w d1,d0
  32626. move.w d0,y_pos(a1)
  32627. sub.w x_pos(a0),d2
  32628. sub.w d2,x_pos(a1)
  32629.  
  32630. return_19BCA:
  32631. rts
  32632. ; ===========================================================================
  32633. ;loc_19BCC:
  32634. MvSonicOnSlope:
  32635. btst #3,status(a1)
  32636. beq.s return_19C0C
  32637. move.w x_pos(a1),d0
  32638. sub.w x_pos(a0),d0
  32639. add.w d1,d0
  32640. lsr.w #1,d0
  32641. btst #0,render_flags(a0)
  32642. beq.s loc_19BEC
  32643. not.w d0
  32644. add.w d1,d0
  32645.  
  32646. loc_19BEC:
  32647. move.b (a2,d0.w),d1
  32648. ext.w d1
  32649. move.w y_pos(a0),d0
  32650. sub.w d1,d0
  32651. moveq #0,d1
  32652. move.b y_radius(a1),d1
  32653. sub.w d1,d0
  32654. move.w d0,y_pos(a1)
  32655. sub.w x_pos(a0),d2
  32656. sub.w d2,x_pos(a1)
  32657.  
  32658. return_19C0C:
  32659. rts
  32660. ; ===========================================================================
  32661. ; unused/dead code.
  32662. ; loc_19C0E:
  32663. MvSonicOnDoubleSlope:
  32664. btst #3,status(a1)
  32665. beq.s return_19C0C
  32666. move.w x_pos(a1),d0
  32667. sub.w x_pos(a0),d0
  32668. add.w d1,d0
  32669. btst #0,render_flags(a0)
  32670. beq.s loc_19C2C
  32671. not.w d0
  32672. add.w d1,d0
  32673.  
  32674. loc_19C2C:
  32675. andi.w #$FFFE,d0
  32676. bra.s loc_19BEC
  32677. ; ===========================================================================
  32678.  
  32679. ; ---------------------------------------------------------------------------
  32680. ; Subroutine to collide Sonic/Tails with the top of a platform
  32681. ; ---------------------------------------------------------------------------
  32682.  
  32683. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  32684. ;
  32685. ; input variables:
  32686. ; d1 = object width
  32687. ; d3 = object height / 2
  32688. ; d4 = object x-axis position
  32689. ;
  32690. ; address registers:
  32691. ; a0 = the object to check collision with
  32692. ; a1 = sonic or tails (set inside these subroutines)
  32693. ; loc_19C32:
  32694. PlatformObject:
  32695. lea (MainCharacter).w,a1 ; a1=character
  32696. moveq #p1_standing_bit,d6
  32697. movem.l d1-d4,-(sp)
  32698. bsr.s PlatformObject_SingleCharacter
  32699. movem.l (sp)+,d1-d4
  32700. lea (Sidekick).w,a1 ; a1=character
  32701. addq.b #1,d6
  32702. ; loc_19C48:
  32703. PlatformObject_SingleCharacter:
  32704. btst d6,status(a0)
  32705. beq.w PlatformObject_cont
  32706. move.w d1,d2
  32707. add.w d2,d2
  32708. btst #1,status(a1)
  32709. bne.s +
  32710. move.w x_pos(a1),d0
  32711. sub.w x_pos(a0),d0
  32712. add.w d1,d0
  32713. bmi.s +
  32714. cmp.w d2,d0
  32715. blo.s loc_19C80
  32716. +
  32717.  
  32718. bclr #3,status(a1)
  32719. bset #1,status(a1)
  32720. bclr d6,status(a0)
  32721. moveq #0,d4
  32722. rts
  32723. ; ---------------------------------------------------------------------------
  32724. loc_19C80:
  32725. move.w d4,d2
  32726. bsr.w MvSonicOnPtfm
  32727. moveq #0,d4
  32728. rts
  32729. ; ===========================================================================
  32730.  
  32731. ; ---------------------------------------------------------------------------
  32732. ; Subroutine to collide Sonic/Tails with the top of a sloped platform like a seesaw
  32733. ; ---------------------------------------------------------------------------
  32734.  
  32735. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  32736. ;
  32737. ; input variables:
  32738. ; d1 = object width
  32739. ; d3 = object height
  32740. ; d4 = object x-axis position
  32741. ;
  32742. ; address registers:
  32743. ; a0 = the object to check collision with
  32744. ; a1 = sonic or tails (set inside these subroutines)
  32745. ; a2 = height data for slope
  32746. ; loc_19C8A: SlopeObject:
  32747. SlopedPlatform:
  32748. lea (MainCharacter).w,a1 ; a1=character
  32749. moveq #p1_standing_bit,d6
  32750. movem.l d1-d4,-(sp)
  32751. bsr.s SlopedPlatform_SingleCharacter
  32752. movem.l (sp)+,d1-d4
  32753. lea (Sidekick).w,a1 ; a1=character
  32754. addq.b #1,d6
  32755. ; loc_19CA0:
  32756. SlopedPlatform_SingleCharacter:
  32757. btst d6,status(a0)
  32758. beq.w SlopedPlatform_cont
  32759. move.w d1,d2
  32760. add.w d2,d2
  32761. btst #1,status(a1)
  32762. bne.s loc_19CC4
  32763. move.w x_pos(a1),d0
  32764. sub.w x_pos(a0),d0
  32765. add.w d1,d0
  32766. bmi.s loc_19CC4
  32767. cmp.w d2,d0
  32768. blo.s loc_19CD8
  32769.  
  32770. loc_19CC4:
  32771. bclr #3,status(a1)
  32772. bset #1,status(a1)
  32773. bclr d6,status(a0)
  32774. moveq #0,d4
  32775. rts
  32776. ; ---------------------------------------------------------------------------
  32777. loc_19CD8:
  32778. move.w d4,d2
  32779. bsr.w MvSonicOnSlope
  32780. moveq #0,d4
  32781. rts
  32782. ; ===========================================================================
  32783. ; Identical to PlatformObject.
  32784. ;loc_19CE2:
  32785. PlatformObject2:
  32786. lea (MainCharacter).w,a1 ; a1=character
  32787. moveq #p1_standing_bit,d6
  32788. movem.l d1-d4,-(sp)
  32789. bsr.s loc_19CF8
  32790. movem.l (sp)+,d1-d4
  32791. lea (Sidekick).w,a1 ; a1=character
  32792. addq.b #1,d6
  32793.  
  32794. loc_19CF8:
  32795. btst d6,status(a0)
  32796. beq.w PlatformObject2_cont
  32797. move.w d1,d2
  32798. add.w d2,d2
  32799. btst #1,status(a1)
  32800. bne.s loc_19D1C
  32801. move.w x_pos(a1),d0
  32802. sub.w x_pos(a0),d0
  32803. add.w d1,d0
  32804. bmi.s loc_19D1C
  32805. cmp.w d2,d0
  32806. blo.s loc_19D30
  32807.  
  32808. loc_19D1C:
  32809. bclr #3,status(a1)
  32810. bset #1,status(a1)
  32811. bclr d6,status(a0)
  32812. moveq #0,d4
  32813. rts
  32814. ; ===========================================================================
  32815.  
  32816. loc_19D30:
  32817. move.w d4,d2
  32818. bsr.w MvSonicOnPtfm
  32819. moveq #0,d4
  32820. rts
  32821. ; ===========================================================================
  32822. ; Almost identical to PlatformObject, except that this function does nothing if
  32823. ; the character is already standing on a platform. Used only by the elevators
  32824. ; in CNZ.
  32825. ;loc_19D3A:
  32826. PlatformObjectD5:
  32827. lea (MainCharacter).w,a1 ; a1=character
  32828. moveq #p1_standing_bit,d6
  32829. movem.l d1-d4,-(sp)
  32830. bsr.s loc_19D50
  32831. movem.l (sp)+,d1-d4
  32832. lea (Sidekick).w,a1 ; a1=character
  32833. addq.b #1,d6
  32834.  
  32835. loc_19D50:
  32836. btst d6,status(a0)
  32837. bne.s loc_19D62
  32838. btst #3,status(a1)
  32839. bne.s loc_19D8E
  32840. bra.w PlatformObject_cont
  32841. ; ===========================================================================
  32842.  
  32843. loc_19D62:
  32844. move.w d1,d2
  32845. add.w d2,d2
  32846. btst #1,status(a1)
  32847. bne.s loc_19D7E
  32848. move.w x_pos(a1),d0
  32849. sub.w x_pos(a0),d0
  32850. add.w d1,d0
  32851. bmi.s loc_19D7E
  32852. cmp.w d2,d0
  32853. blo.s loc_19D92
  32854.  
  32855. loc_19D7E:
  32856. bclr #3,status(a1)
  32857. bset #1,status(a1)
  32858. bclr d6,status(a0)
  32859.  
  32860. loc_19D8E:
  32861. moveq #0,d4
  32862. rts
  32863. ; ===========================================================================
  32864.  
  32865. loc_19D92:
  32866. move.w d4,d2
  32867. bsr.w MvSonicOnPtfm
  32868. moveq #0,d4
  32869. rts
  32870. ; ===========================================================================
  32871. ; Used only by EHZ/HPZ log bridges. Very similar to PlatformObject_cont, but
  32872. ; d2 already has the full width of the log.
  32873. ;loc_19D9C:
  32874. PlatformObject11_cont:
  32875. tst.w y_vel(a1)
  32876. bmi.w return_19E8E
  32877. move.w x_pos(a1),d0
  32878. sub.w x_pos(a0),d0
  32879. add.w d1,d0
  32880. bmi.w return_19E8E
  32881. cmp.w d2,d0
  32882. bhs.w return_19E8E
  32883. bra.s loc_19DD8
  32884. ; ===========================================================================
  32885. ;loc_19DBA:
  32886. PlatformObject_cont:
  32887. tst.w y_vel(a1)
  32888. bmi.w return_19E8E
  32889. move.w x_pos(a1),d0
  32890. sub.w x_pos(a0),d0
  32891. add.w d1,d0
  32892. bmi.w return_19E8E
  32893. add.w d1,d1
  32894. cmp.w d1,d0
  32895. bhs.w return_19E8E
  32896.  
  32897. loc_19DD8:
  32898. move.w y_pos(a0),d0
  32899. sub.w d3,d0
  32900. ;loc_19DDE:
  32901. PlatformObject_ChkYRange:
  32902. move.w y_pos(a1),d2
  32903. move.b y_radius(a1),d1
  32904. ext.w d1
  32905. add.w d2,d1
  32906. addq.w #4,d1
  32907. sub.w d1,d0
  32908. bhi.w return_19E8E
  32909. cmpi.w #-$10,d0
  32910. blo.w return_19E8E
  32911. tst.b obj_control(a1)
  32912. bmi.w return_19E8E
  32913. cmpi.b #6,routine(a1)
  32914. bhs.w return_19E8E
  32915. add.w d0,d2
  32916. addq.w #3,d2
  32917. move.w d2,y_pos(a1)
  32918. ;loc_19E14:
  32919. RideObject_SetRide:
  32920. btst #3,status(a1)
  32921. beq.s loc_19E30
  32922. moveq #0,d0
  32923. move.b interact(a1),d0
  32924. if object_size=$40
  32925. lsl.w #6,d0
  32926. else
  32927. mulu.w #object_size,d0
  32928. endif
  32929. addi.l #Object_RAM,d0
  32930. movea.l d0,a3 ; a3=object
  32931. bclr d6,status(a3)
  32932.  
  32933. loc_19E30:
  32934. move.w a0,d0
  32935. subi.w #Object_RAM,d0
  32936. if object_size=$40
  32937. lsr.w #6,d0
  32938. else
  32939. divu.w #object_size,d0
  32940. endif
  32941. andi.w #$7F,d0
  32942. move.b d0,interact(a1)
  32943. move.b #0,angle(a1)
  32944. move.w #0,y_vel(a1)
  32945. move.w x_vel(a1),inertia(a1)
  32946. btst #1,status(a1)
  32947. beq.s loc_19E7E
  32948. move.l a0,-(sp)
  32949. movea.l a1,a0
  32950. move.w a0,d1
  32951. subi.w #Object_RAM,d1
  32952. bne.s loc_19E76
  32953. cmpi.w #2,(Player_mode).w
  32954. beq.s loc_19E76
  32955. jsr (Sonic_ResetOnFloor_Part2).l
  32956. bra.s loc_19E7C
  32957. ; ===========================================================================
  32958.  
  32959. loc_19E76:
  32960. jsr (Tails_ResetOnFloor_Part2).l
  32961.  
  32962. loc_19E7C:
  32963. movea.l (sp)+,a0 ; a0=character
  32964.  
  32965. loc_19E7E:
  32966. bset #3,status(a1)
  32967. bclr #1,status(a1)
  32968. bset d6,status(a0)
  32969.  
  32970. return_19E8E:
  32971. rts
  32972. ; ===========================================================================
  32973. ;loc_19E90:
  32974. SlopedPlatform_cont:
  32975. tst.w y_vel(a1)
  32976. bmi.w return_19E8E
  32977. move.w x_pos(a1),d0
  32978. sub.w x_pos(a0),d0
  32979. add.w d1,d0
  32980. bmi.s return_19E8E
  32981. add.w d1,d1
  32982. cmp.w d1,d0
  32983. bhs.s return_19E8E
  32984. btst #0,render_flags(a0)
  32985. beq.s loc_19EB6
  32986. not.w d0
  32987. add.w d1,d0
  32988.  
  32989. loc_19EB6:
  32990. lsr.w #1,d0
  32991. move.b (a2,d0.w),d3
  32992. ext.w d3
  32993. move.w y_pos(a0),d0
  32994. sub.w d3,d0
  32995. bra.w PlatformObject_ChkYRange
  32996. ; ===========================================================================
  32997. ; Basically identical to PlatformObject_cont
  32998. ;loc_19EC8:
  32999. PlatformObject2_cont:
  33000. tst.w y_vel(a1)
  33001. bmi.w return_19E8E
  33002. move.w x_pos(a1),d0
  33003. sub.w x_pos(a0),d0
  33004. add.w d1,d0
  33005. bmi.w return_19E8E
  33006. add.w d1,d1
  33007. cmp.w d1,d0
  33008. bhs.w return_19E8E
  33009. move.w y_pos(a0),d0
  33010. sub.w d3,d0
  33011. bra.w PlatformObject_ChkYRange
  33012. ; ===========================================================================
  33013. ; If a character is being dragged through terrain by this object, drop the
  33014. ; character on terrain instead.
  33015. ;loc_19EF0:
  33016. DropOnFloor:
  33017. lea (MainCharacter).w,a1 ; a1=character
  33018. btst #p1_standing_bit,status(a0)
  33019. beq.s loc_19F1E
  33020. jsr (ChkFloorEdge2).l
  33021. tst.w d1
  33022. beq.s loc_19F08
  33023. bpl.s loc_19F1E
  33024.  
  33025. loc_19F08:
  33026. lea (MainCharacter).w,a1 ; a1=character
  33027. bclr #3,status(a1)
  33028. bset #1,status(a1)
  33029. bclr #p1_standing_bit,status(a0)
  33030.  
  33031. loc_19F1E:
  33032. lea (Sidekick).w,a1 ; a1=character
  33033. btst #p2_standing_bit,status(a0)
  33034. beq.s loc_19F4C
  33035. jsr (ChkFloorEdge2).l
  33036. tst.w d1
  33037. beq.s loc_19F36
  33038. bpl.s loc_19F4C
  33039.  
  33040. loc_19F36:
  33041. lea (Sidekick).w,a1 ; a1=character
  33042. bclr #3,status(a1)
  33043. bset #1,status(a1)
  33044. bclr #p2_standing_bit,status(a0)
  33045.  
  33046. loc_19F4C:
  33047. moveq #0,d4
  33048. rts
  33049.  
  33050.  
  33051.  
  33052.  
  33053. ; ===========================================================================
  33054. ; ----------------------------------------------------------------------------
  33055. ; Object 01 - Sonic
  33056. ; ----------------------------------------------------------------------------
  33057. ; Sprite_19F50: Object_Sonic:
  33058. Obj01:
  33059. ; a0=character
  33060. tst.w (Debug_placement_mode).w ; is debug mode being used?
  33061. beq.s Obj01_Normal ; if not, branch
  33062. jmp (DebugMode).l
  33063. ; ---------------------------------------------------------------------------
  33064. ; loc_19F5C:
  33065. Obj01_Normal:
  33066. moveq #0,d0
  33067. move.b routine(a0),d0
  33068. move.w Obj01_Index(pc,d0.w),d1
  33069. jmp Obj01_Index(pc,d1.w)
  33070. ; ===========================================================================
  33071. ; off_19F6A: Obj01_States:
  33072. Obj01_Index: offsetTable
  33073. offsetTableEntry.w Obj01_Init ; 0
  33074. offsetTableEntry.w Obj01_Control ; 2
  33075. offsetTableEntry.w Obj01_Hurt ; 4
  33076. offsetTableEntry.w Obj01_Dead ; 6
  33077. offsetTableEntry.w Obj01_Gone ; 8
  33078. offsetTableEntry.w Obj01_Respawning ; $A
  33079. ; ===========================================================================
  33080. ; loc_19F76: Obj_01_Sub_0: Obj01_Main:
  33081. Obj01_Init:
  33082. addq.b #2,routine(a0) ; => Obj01_Control
  33083. move.b #$13,y_radius(a0) ; this sets Sonic's collision height (2*pixels)
  33084. move.b #9,x_radius(a0)
  33085. move.l #Mapunc_Sonic,mappings(a0)
  33086. move.b #2,priority(a0)
  33087. move.b #$18,width_pixels(a0)
  33088. move.b #4,render_flags(a0)
  33089. move.w #$600,(Sonic_top_speed).w ; set Sonic's top speed
  33090. move.w #$C,(Sonic_acceleration).w ; set Sonic's acceleration
  33091. move.w #$80,(Sonic_deceleration).w ; set Sonic's deceleration
  33092. tst.b (Last_star_pole_hit).w
  33093. bne.s Obj01_Init_Continued
  33094. ; only happens when not starting at a checkpoint:
  33095. move.w #make_art_tile(ArtTile_ArtUnc_Sonic,0,0),art_tile(a0)
  33096. bsr.w Adjust2PArtPointer
  33097. move.b #$C,top_solid_bit(a0)
  33098. move.b #$D,lrb_solid_bit(a0)
  33099. move.w x_pos(a0),(Saved_x_pos).w
  33100. move.w y_pos(a0),(Saved_y_pos).w
  33101. move.w art_tile(a0),(Saved_art_tile).w
  33102. move.w top_solid_bit(a0),(Saved_Solid_bits).w
  33103.  
  33104. Obj01_Init_Continued:
  33105. move.b #0,flips_remaining(a0)
  33106. move.b #4,flip_speed(a0)
  33107. move.b #0,(Super_Sonic_flag).w
  33108. move.b #$1E,air_left(a0)
  33109. subi.w #$20,x_pos(a0)
  33110. addi_.w #4,y_pos(a0)
  33111. move.w #0,(Sonic_Pos_Record_Index).w
  33112.  
  33113. move.w #$3F,d2
  33114. - bsr.w Sonic_RecordPos
  33115. subq.w #4,a1
  33116. move.l #0,(a1)
  33117. dbf d2,-
  33118.  
  33119. addi.w #$20,x_pos(a0)
  33120. subi_.w #4,y_pos(a0)
  33121.  
  33122. ; ---------------------------------------------------------------------------
  33123. ; Normal state for Sonic
  33124. ; ---------------------------------------------------------------------------
  33125. ; loc_1A030: Obj_01_Sub_2:
  33126. Obj01_Control:
  33127. tst.w (Debug_mode_flag).w ; is debug cheat enabled?
  33128. beq.s + ; if not, branch
  33129. btst #button_B,(Ctrl_1_Press).w ; is button B pressed?
  33130. beq.s + ; if not, branch
  33131. move.w #1,(Debug_placement_mode).w ; change Sonic into a ring/item
  33132. clr.b (Control_Locked).w ; unlock control
  33133. rts
  33134. ; -----------------------------------------------------------------------
  33135. + tst.b (Control_Locked).w ; are controls locked?
  33136. bne.s + ; if yes, branch
  33137. move.w (Ctrl_1).w,(Ctrl_1_Logical).w ; copy new held buttons, to enable joypad control
  33138. +
  33139. btst #0,obj_control(a0) ; is Sonic interacting with another object that holds him in place or controls his movement somehow?
  33140. bne.s + ; if yes, branch to skip Sonic's control
  33141. moveq #0,d0
  33142. move.b status(a0),d0
  33143. andi.w #6,d0 ; %0000 %0110
  33144. move.w Obj01_Modes(pc,d0.w),d1
  33145. jsr Obj01_Modes(pc,d1.w) ; run Sonic's movement control code
  33146. +
  33147. cmpi.w #-$100,(Camera_Min_Y_pos).w ; is vertical wrapping enabled?
  33148. bne.s + ; if not, branch
  33149. andi.w #$7FF,y_pos(a0) ; perform wrapping of Sonic's y position
  33150. +
  33151. bsr.s Sonic_Display
  33152. bsr.w Sonic_Super
  33153. bsr.w Sonic_RecordPos
  33154. bsr.w Sonic_Water
  33155. move.b (Primary_Angle).w,next_tilt(a0)
  33156. move.b (Secondary_Angle).w,tilt(a0)
  33157. tst.b (WindTunnel_flag).w
  33158. beq.s +
  33159. tst.b anim(a0)
  33160. bne.s +
  33161. move.b next_anim(a0),anim(a0)
  33162. +
  33163. bsr.w Sonic_Animate
  33164. tst.b obj_control(a0)
  33165. bmi.s +
  33166. jsr (TouchResponse).l
  33167. +
  33168. bra.w LoadSonicDynPLC
  33169.  
  33170. ; ===========================================================================
  33171. ; secondary states under state Obj01_Control
  33172. ; off_1A0BE:
  33173. Obj01_Modes: offsetTable
  33174. offsetTableEntry.w Obj01_MdNormal_Checks ; 0 - not airborne or rolling
  33175. offsetTableEntry.w Obj01_MdAir ; 2 - airborne
  33176. offsetTableEntry.w Obj01_MdRoll ; 4 - rolling
  33177. offsetTableEntry.w Obj01_MdJump ; 6 - jumping
  33178. ; ===========================================================================
  33179.  
  33180. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33181.  
  33182. ; loc_1A0C6:
  33183. Sonic_Display:
  33184. move.w invulnerable_time(a0),d0
  33185. beq.s Obj01_Display
  33186. subq.w #1,invulnerable_time(a0)
  33187. lsr.w #3,d0
  33188. bcc.s Obj01_ChkInvin
  33189. ; loc_1A0D4:
  33190. Obj01_Display:
  33191. jsr (DisplaySprite).l
  33192. ; loc_1A0DA:
  33193. Obj01_ChkInvin: ; Checks if invincibility has expired and disables it if it has.
  33194. btst #status_sec_isInvincible,status_secondary(a0)
  33195. beq.s Obj01_ChkShoes
  33196. tst.w invincibility_time(a0)
  33197. beq.s Obj01_ChkShoes ; If there wasn't any time left, that means we're in Super Sonic mode.
  33198. subq.w #1,invincibility_time(a0)
  33199. bne.s Obj01_ChkShoes
  33200. tst.b (Current_Boss_ID).w ; Don't change music if in a boss fight
  33201. bne.s Obj01_RmvInvin
  33202. cmpi.b #$C,air_left(a0) ; Don't change music if drowning
  33203. blo.s Obj01_RmvInvin
  33204. move.w (Level_Music).w,d0
  33205. jsr (PlayMusic).l
  33206. ;loc_1A106:
  33207. Obj01_RmvInvin:
  33208. bclr #status_sec_isInvincible,status_secondary(a0)
  33209. ; loc_1A10C:
  33210. Obj01_ChkShoes: ; Checks if Speed Shoes have expired and disables them if they have.
  33211. btst #status_sec_hasSpeedShoes,status_secondary(a0)
  33212. beq.s Obj01_ExitChk
  33213. tst.w speedshoes_time(a0)
  33214. beq.s Obj01_ExitChk
  33215. subq.w #1,speedshoes_time(a0)
  33216. bne.s Obj01_ExitChk
  33217. move.w #$600,(Sonic_top_speed).w
  33218. move.w #$C,(Sonic_acceleration).w
  33219. move.w #$80,(Sonic_deceleration).w
  33220. tst.b (Super_Sonic_flag).w
  33221. beq.s Obj01_RmvSpeed
  33222. move.w #$A00,(Sonic_top_speed).w
  33223. move.w #$30,(Sonic_acceleration).w
  33224. move.w #$100,(Sonic_deceleration).w
  33225. ; loc_1A14A:
  33226. Obj01_RmvSpeed:
  33227. bclr #status_sec_hasSpeedShoes,status_secondary(a0)
  33228. move.w #MusID_SlowDown,d0 ; Slow down tempo
  33229. jmp (PlayMusic).l
  33230. ; ---------------------------------------------------------------------------
  33231. ; return_1A15A:
  33232. Obj01_ExitChk:
  33233. rts
  33234. ; End of subroutine Sonic_Display
  33235.  
  33236. ; ---------------------------------------------------------------------------
  33237. ; Subroutine to record Sonic's previous positions for invincibility stars
  33238. ; and input/status flags for Tails' AI to follow
  33239. ; ---------------------------------------------------------------------------
  33240.  
  33241. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33242.  
  33243. ; loc_1A15C:
  33244. Sonic_RecordPos:
  33245. move.w (Sonic_Pos_Record_Index).w,d0
  33246. lea (Sonic_Pos_Record_Buf).w,a1
  33247. lea (a1,d0.w),a1
  33248. move.w x_pos(a0),(a1)+
  33249. move.w y_pos(a0),(a1)+
  33250. addq.b #4,(Sonic_Pos_Record_Index+1).w
  33251.  
  33252. lea (Sonic_Stat_Record_Buf).w,a1
  33253. lea (a1,d0.w),a1
  33254. move.w (Ctrl_1_Logical).w,(a1)+
  33255. move.w status(a0),(a1)+
  33256.  
  33257. rts
  33258. ; End of subroutine Sonic_RecordPos
  33259.  
  33260. ; ---------------------------------------------------------------------------
  33261. ; Subroutine for Sonic when he's underwater
  33262. ; ---------------------------------------------------------------------------
  33263.  
  33264. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33265.  
  33266. ; loc_1A186:
  33267. Sonic_Water:
  33268. tst.b (Water_flag).w ; does level have water?
  33269. bne.s Obj01_InWater ; if yes, branch
  33270.  
  33271. return_1A18C:
  33272. rts
  33273. ; ---------------------------------------------------------------------------
  33274. ; loc_1A18E:
  33275. Obj01_InWater:
  33276. move.w (Water_Level_1).w,d0
  33277. cmp.w y_pos(a0),d0 ; is Sonic above the water?
  33278. bge.s Obj01_OutWater ; if yes, branch
  33279.  
  33280. bset #6,status(a0) ; set underwater flag
  33281. bne.s return_1A18C ; if already underwater, branch
  33282.  
  33283. movea.l a0,a1
  33284. bsr.w ResumeMusic
  33285. move.b #ObjID_SmallBubbles,(Sonic_BreathingBubbles+id).w ; load Obj0A (sonic's breathing bubbles) at $FFFFD080
  33286. move.b #$81,(Sonic_BreathingBubbles+subtype).w
  33287. move.l a0,(Sonic_BreathingBubbles+$3C).w
  33288. move.w #$300,(Sonic_top_speed).w
  33289. move.w #6,(Sonic_acceleration).w
  33290. move.w #$40,(Sonic_deceleration).w
  33291. tst.b (Super_Sonic_flag).w
  33292. beq.s +
  33293. move.w #$500,(Sonic_top_speed).w
  33294. move.w #$18,(Sonic_acceleration).w
  33295. move.w #$80,(Sonic_deceleration).w
  33296. +
  33297. asr.w x_vel(a0)
  33298. asr.w y_vel(a0) ; memory operands can only be shifted one bit at a time
  33299. asr.w y_vel(a0)
  33300. beq.s return_1A18C
  33301. move.w #$100,(Sonic_Dust+anim).w ; splash animation
  33302. move.w #SndID_Splash,d0 ; splash sound
  33303. jmp (PlaySound).l
  33304. ; ---------------------------------------------------------------------------
  33305. ; loc_1A1FE:
  33306. Obj01_OutWater:
  33307. bclr #6,status(a0) ; unset underwater flag
  33308. beq.s return_1A18C ; if already above water, branch
  33309.  
  33310. movea.l a0,a1
  33311. bsr.w ResumeMusic
  33312. move.w #$600,(Sonic_top_speed).w
  33313. move.w #$C,(Sonic_acceleration).w
  33314. move.w #$80,(Sonic_deceleration).w
  33315. tst.b (Super_Sonic_flag).w
  33316. beq.s +
  33317. move.w #$A00,(Sonic_top_speed).w
  33318. move.w #$30,(Sonic_acceleration).w
  33319. move.w #$100,(Sonic_deceleration).w
  33320. +
  33321. cmpi.b #4,routine(a0) ; is Sonic falling back from getting hurt?
  33322. beq.s + ; if yes, branch
  33323. asl y_vel(a0)
  33324. +
  33325. tst.w y_vel(a0)
  33326. beq.w return_1A18C
  33327. move.w #$100,(Sonic_Dust+anim).w ; splash animation
  33328. movea.l a0,a1
  33329. bsr.w ResumeMusic
  33330. cmpi.w #-$1000,y_vel(a0)
  33331. bgt.s +
  33332. move.w #-$1000,y_vel(a0) ; limit upward y velocity exiting the water
  33333. +
  33334. move.w #SndID_Splash,d0 ; splash sound
  33335. jmp (PlaySound).l
  33336. ; End of subroutine Sonic_Water
  33337.  
  33338. ; ===========================================================================
  33339. ; ---------------------------------------------------------------------------
  33340. ; Start of subroutine Obj01_MdNormal
  33341. ; Called if Sonic is neither airborne nor rolling this frame
  33342. ; ---------------------------------------------------------------------------
  33343. ; loc_1A26E:
  33344. Obj01_MdNormal_Checks:
  33345. move.b (Ctrl_1_Press_Logical).w,d0
  33346. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  33347. bne.s Obj01_MdNormal
  33348. cmpi.b #$A,anim(a0)
  33349. beq.s return_1A2DE
  33350. cmpi.b #$B,anim(a0)
  33351. beq.s return_1A2DE
  33352. cmpi.b #5,anim(a0)
  33353. bne.s Obj01_MdNormal
  33354. cmpi.b #$1E,anim_frame(a0)
  33355. blo.s Obj01_MdNormal
  33356. move.b (Ctrl_1_Held_Logical).w,d0
  33357. andi.b #button_up_mask|button_down_mask|button_left_mask|button_right_mask|button_B_mask|button_C_mask|button_A_mask,d0
  33358. beq.s return_1A2DE
  33359. move.b #$A,anim(a0)
  33360. cmpi.b #$AC,anim_frame(a0)
  33361. blo.s return_1A2DE
  33362. move.b #$B,anim(a0)
  33363. bra.s return_1A2DE
  33364. ; ---------------------------------------------------------------------------
  33365. ; loc_1A2B8:
  33366. Obj01_MdNormal:
  33367. bsr.w Sonic_CheckSpindash
  33368. bsr.w Sonic_Jump
  33369. bsr.w Sonic_SlopeResist
  33370. bsr.w Sonic_Move
  33371. bsr.w Sonic_Roll
  33372. bsr.w Sonic_LevelBound
  33373. jsr (ObjectMove).l
  33374. bsr.w AnglePos
  33375. bsr.w Sonic_SlopeRepel
  33376.  
  33377. return_1A2DE:
  33378. rts
  33379. ; End of subroutine Obj01_MdNormal
  33380. ; ===========================================================================
  33381. ; Start of subroutine Obj01_MdAir
  33382. ; Called if Sonic is airborne, but not in a ball (thus, probably not jumping)
  33383. ; loc_1A2E0: Obj01_MdJump
  33384. Obj01_MdAir:
  33385. bsr.w Sonic_JumpHeight
  33386. bsr.w Sonic_ChgJumpDir
  33387. bsr.w Sonic_LevelBound
  33388. jsr (ObjectMoveAndFall).l
  33389. btst #6,status(a0) ; is Sonic underwater?
  33390. beq.s + ; if not, branch
  33391. subi.w #$28,y_vel(a0) ; reduce gravity by $28 ($38-$28=$10)
  33392. +
  33393. bsr.w Sonic_JumpAngle
  33394. bsr.w Sonic_DoLevelCollision
  33395. rts
  33396. ; End of subroutine Obj01_MdAir
  33397. ; ===========================================================================
  33398. ; Start of subroutine Obj01_MdRoll
  33399. ; Called if Sonic is in a ball, but not airborne (thus, probably rolling)
  33400. ; loc_1A30A:
  33401. Obj01_MdRoll:
  33402. tst.b pinball_mode(a0)
  33403. bne.s +
  33404. bsr.w Sonic_Jump
  33405. +
  33406. bsr.w Sonic_RollRepel
  33407. bsr.w Sonic_RollSpeed
  33408. bsr.w Sonic_LevelBound
  33409. jsr (ObjectMove).l
  33410. bsr.w AnglePos
  33411. bsr.w Sonic_SlopeRepel
  33412. rts
  33413. ; End of subroutine Obj01_MdRoll
  33414. ; ===========================================================================
  33415. ; Start of subroutine Obj01_MdJump
  33416. ; Called if Sonic is in a ball and airborne (he could be jumping but not necessarily)
  33417. ; Notes: This is identical to Obj01_MdAir, at least at this outer level.
  33418. ; Why they gave it a separate copy of the code, I don't know.
  33419. ; loc_1A330: Obj01_MdJump2:
  33420. Obj01_MdJump:
  33421. bsr.w Sonic_JumpHeight
  33422. bsr.w Sonic_ChgJumpDir
  33423. bsr.w Sonic_LevelBound
  33424. jsr (ObjectMoveAndFall).l
  33425. btst #6,status(a0) ; is Sonic underwater?
  33426. beq.s + ; if not, branch
  33427. subi.w #$28,y_vel(a0) ; reduce gravity by $28 ($38-$28=$10)
  33428. +
  33429. bsr.w Sonic_JumpAngle
  33430. bsr.w Sonic_DoLevelCollision
  33431. rts
  33432. ; End of subroutine Obj01_MdJump
  33433.  
  33434. ; ---------------------------------------------------------------------------
  33435. ; Subroutine to make Sonic walk/run
  33436. ; ---------------------------------------------------------------------------
  33437.  
  33438. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33439.  
  33440. ; loc_1A35A:
  33441. Sonic_Move:
  33442. move.w (Sonic_top_speed).w,d6
  33443. move.w (Sonic_acceleration).w,d5
  33444. move.w (Sonic_deceleration).w,d4
  33445. if status_sec_isSliding = 7
  33446. tst.b status_secondary(a0)
  33447. bmi.w Obj01_Traction
  33448. else
  33449. btst #status_sec_isSliding,status_secondary(a0)
  33450. bne.w Obj01_Traction
  33451. endif
  33452. tst.w move_lock(a0)
  33453. bne.w Obj01_ResetScr
  33454. btst #button_left,(Ctrl_1_Held_Logical).w ; is left being pressed?
  33455. beq.s Obj01_NotLeft ; if not, branch
  33456. bsr.w Sonic_MoveLeft
  33457. ; loc_1A382:
  33458. Obj01_NotLeft:
  33459. btst #button_right,(Ctrl_1_Held_Logical).w ; is right being pressed?
  33460. beq.s Obj01_NotRight ; if not, branch
  33461. bsr.w Sonic_MoveRight
  33462. ; loc_1A38E:
  33463. Obj01_NotRight:
  33464. move.b angle(a0),d0
  33465. addi.b #$20,d0
  33466. andi.b #$C0,d0 ; is Sonic on a slope?
  33467. bne.w Obj01_ResetScr ; if yes, branch
  33468. tst.w inertia(a0) ; is Sonic moving?
  33469. bne.w Obj01_ResetScr ; if yes, branch
  33470. bclr #5,status(a0)
  33471. move.b #AniIDSonAni_Wait,anim(a0) ; use "standing" animation
  33472. btst #3,status(a0)
  33473. beq.w Sonic_Balance
  33474. moveq #0,d0
  33475. move.b interact(a0),d0
  33476. if object_size=$40
  33477. lsl.w #6,d0
  33478. else
  33479. mulu.w #object_size,d0
  33480. endif
  33481. lea (Object_RAM).w,a1 ; a1=character
  33482. lea (a1,d0.w),a1 ; a1=object
  33483. tst.b status(a1)
  33484. bmi.w Sonic_Lookup
  33485. moveq #0,d1
  33486. move.b width_pixels(a1),d1
  33487. move.w d1,d2
  33488. add.w d2,d2
  33489. subq.w #2,d2
  33490. add.w x_pos(a0),d1
  33491. sub.w x_pos(a1),d1
  33492. tst.b (Super_Sonic_flag).w
  33493. bne.w SuperSonic_Balance
  33494. cmpi.w #2,d1
  33495. blt.s Sonic_BalanceOnObjLeft
  33496. cmp.w d2,d1
  33497. bge.s Sonic_BalanceOnObjRight
  33498. bra.w Sonic_Lookup
  33499. ; ---------------------------------------------------------------------------
  33500. ; loc_1A3FE:
  33501. SuperSonic_Balance:
  33502. cmpi.w #2,d1
  33503. blt.w SuperSonic_BalanceOnObjLeft
  33504. cmp.w d2,d1
  33505. bge.w SuperSonic_BalanceOnObjRight
  33506. bra.w Sonic_Lookup
  33507. ; ---------------------------------------------------------------------------
  33508. ; balancing checks for when you're on the right edge of an object
  33509. ; loc_1A410:
  33510. Sonic_BalanceOnObjRight:
  33511. btst #0,status(a0)
  33512. bne.s +
  33513. move.b #AniIDSonAni_Balance,anim(a0)
  33514. addq.w #6,d2
  33515. cmp.w d2,d1
  33516. blt.w Obj01_ResetScr
  33517. move.b #AniIDSonAni_Balance2,anim(a0)
  33518. bra.w Obj01_ResetScr
  33519. ; on right edge of object but facing left:
  33520. + move.b #AniIDSonAni_Balance3,anim(a0)
  33521. addq.w #6,d2
  33522. cmp.w d2,d1
  33523. blt.w Obj01_ResetScr
  33524. move.b #AniIDSonAni_Balance4,anim(a0)
  33525. bclr #0,status(a0)
  33526. bra.w Obj01_ResetScr
  33527. ; ---------------------------------------------------------------------------
  33528. ; balancing checks for when you're on the left edge of an object
  33529. ; loc_1A44E:
  33530. Sonic_BalanceOnObjLeft:
  33531. btst #0,status(a0)
  33532. beq.s +
  33533. move.b #AniIDSonAni_Balance,anim(a0)
  33534. cmpi.w #-4,d1
  33535. bge.w Obj01_ResetScr
  33536. move.b #AniIDSonAni_Balance2,anim(a0)
  33537. bra.w Obj01_ResetScr
  33538. ; on left edge of object but facing right:
  33539. + move.b #AniIDSonAni_Balance3,anim(a0)
  33540. cmpi.w #-4,d1
  33541. bge.w Obj01_ResetScr
  33542. move.b #AniIDSonAni_Balance4,anim(a0)
  33543. bset #0,status(a0)
  33544. bra.w Obj01_ResetScr
  33545. ; ---------------------------------------------------------------------------
  33546. ; balancing checks for when you're on the edge of part of the level
  33547. ; loc_1A48C:
  33548. Sonic_Balance:
  33549. jsr (ChkFloorEdge).l
  33550. cmpi.w #$C,d1
  33551. blt.w Sonic_Lookup
  33552. tst.b (Super_Sonic_flag).w
  33553. bne.w SuperSonic_Balance2
  33554. cmpi.b #3,next_tilt(a0)
  33555. bne.s Sonic_BalanceLeft
  33556. btst #0,status(a0)
  33557. bne.s +
  33558. move.b #AniIDSonAni_Balance,anim(a0)
  33559. move.w x_pos(a0),d3
  33560. subq.w #6,d3
  33561. jsr (ChkFloorEdge_Part2).l
  33562. cmpi.w #$C,d1
  33563. blt.w Obj01_ResetScr
  33564. move.b #AniIDSonAni_Balance2,anim(a0)
  33565. bra.w Obj01_ResetScr
  33566. ; on right edge but facing left:
  33567. + move.b #AniIDSonAni_Balance3,anim(a0)
  33568. move.w x_pos(a0),d3
  33569. subq.w #6,d3
  33570. jsr (ChkFloorEdge_Part2).l
  33571. cmpi.w #$C,d1
  33572. blt.w Obj01_ResetScr
  33573. move.b #AniIDSonAni_Balance4,anim(a0)
  33574. bclr #0,status(a0)
  33575. bra.w Obj01_ResetScr
  33576. ; ---------------------------------------------------------------------------
  33577. Sonic_BalanceLeft:
  33578. cmpi.b #3,tilt(a0)
  33579. bne.s Sonic_Lookup
  33580. btst #0,status(a0)
  33581. beq.s +
  33582. move.b #AniIDSonAni_Balance,anim(a0)
  33583. move.w x_pos(a0),d3
  33584. addq.w #6,d3
  33585. jsr (ChkFloorEdge_Part2).l
  33586. cmpi.w #$C,d1
  33587. blt.w Obj01_ResetScr
  33588. move.b #AniIDSonAni_Balance2,anim(a0)
  33589. bra.w Obj01_ResetScr
  33590. ; on left edge but facing right:
  33591. + move.b #AniIDSonAni_Balance3,anim(a0)
  33592. move.w x_pos(a0),d3
  33593. addq.w #6,d3
  33594. jsr (ChkFloorEdge_Part2).l
  33595. cmpi.w #$C,d1
  33596. blt.w Obj01_ResetScr
  33597. move.b #AniIDSonAni_Balance4,anim(a0)
  33598. bset #0,status(a0)
  33599. bra.w Obj01_ResetScr
  33600. ; ---------------------------------------------------------------------------
  33601. ; loc_1A55E:
  33602. SuperSonic_Balance2:
  33603. cmpi.b #3,next_tilt(a0)
  33604. bne.s loc_1A56E
  33605.  
  33606. ; loc_1A566:
  33607. SuperSonic_BalanceOnObjRight:
  33608. bclr #0,status(a0)
  33609. bra.s loc_1A57C
  33610. ; ---------------------------------------------------------------------------
  33611. loc_1A56E:
  33612. cmpi.b #3,tilt(a0)
  33613. bne.s Sonic_Lookup
  33614.  
  33615. ; loc_1A576:
  33616. SuperSonic_BalanceOnObjLeft:
  33617. bset #0,status(a0)
  33618.  
  33619. loc_1A57C:
  33620. move.b #AniIDSonAni_Balance,anim(a0)
  33621. bra.s Obj01_ResetScr
  33622. ; ---------------------------------------------------------------------------
  33623. ; loc_1A584:
  33624. Sonic_Lookup:
  33625. btst #button_up,(Ctrl_1_Held_Logical).w ; is up being pressed?
  33626. beq.s Sonic_Duck ; if not, branch
  33627. move.b #AniIDSonAni_LookUp,anim(a0) ; use "looking up" animation
  33628. addq.w #1,(Sonic_Look_delay_counter).w
  33629. cmpi.w #$78,(Sonic_Look_delay_counter).w
  33630. blo.s Obj01_ResetScr_Part2
  33631. move.w #$78,(Sonic_Look_delay_counter).w
  33632. cmpi.w #$C8,(Camera_Y_pos_bias).w
  33633. beq.s Obj01_UpdateSpeedOnGround
  33634. addq.w #2,(Camera_Y_pos_bias).w
  33635. bra.s Obj01_UpdateSpeedOnGround
  33636. ; ---------------------------------------------------------------------------
  33637. ; loc_1A5B2:
  33638. Sonic_Duck:
  33639. btst #button_down,(Ctrl_1_Held_Logical).w ; is down being pressed?
  33640. beq.s Obj01_ResetScr ; if not, branch
  33641. move.b #AniIDSonAni_Duck,anim(a0) ; use "ducking" animation
  33642. addq.w #1,(Sonic_Look_delay_counter).w
  33643. cmpi.w #$78,(Sonic_Look_delay_counter).w
  33644. blo.s Obj01_ResetScr_Part2
  33645. move.w #$78,(Sonic_Look_delay_counter).w
  33646. cmpi.w #8,(Camera_Y_pos_bias).w
  33647. beq.s Obj01_UpdateSpeedOnGround
  33648. subq.w #2,(Camera_Y_pos_bias).w
  33649. bra.s Obj01_UpdateSpeedOnGround
  33650.  
  33651. ; ===========================================================================
  33652. ; moves the screen back to its normal position after looking up or down
  33653. ; loc_1A5E0:
  33654. Obj01_ResetScr:
  33655. move.w #0,(Sonic_Look_delay_counter).w
  33656. ; loc_1A5E6:
  33657. Obj01_ResetScr_Part2:
  33658. cmpi.w #(224/2)-16,(Camera_Y_pos_bias).w ; is screen in its default position?
  33659. beq.s Obj01_UpdateSpeedOnGround ; if yes, branch.
  33660. bhs.s + ; depending on the sign of the difference,
  33661. addq.w #4,(Camera_Y_pos_bias).w ; either add 2
  33662. + subq.w #2,(Camera_Y_pos_bias).w ; or subtract 2
  33663.  
  33664. ; ---------------------------------------------------------------------------
  33665. ; updates Sonic's speed on the ground
  33666. ; ---------------------------------------------------------------------------
  33667. ; sub_1A5F8:
  33668. Obj01_UpdateSpeedOnGround:
  33669. tst.b (Super_Sonic_flag).w
  33670. beq.w +
  33671. move.w #$C,d5
  33672. +
  33673. move.b (Ctrl_1_Held_Logical).w,d0
  33674. andi.b #button_left_mask|button_right_mask,d0 ; is left/right pressed?
  33675. bne.s Obj01_Traction ; if yes, branch
  33676. move.w inertia(a0),d0
  33677. beq.s Obj01_Traction
  33678. bmi.s Obj01_SettleLeft
  33679.  
  33680. ; slow down when facing right and not pressing a direction
  33681. ; Obj01_SettleRight:
  33682. sub.w d5,d0
  33683. bcc.s +
  33684. move.w #0,d0
  33685. +
  33686. move.w d0,inertia(a0)
  33687. bra.s Obj01_Traction
  33688. ; ---------------------------------------------------------------------------
  33689. ; slow down when facing left and not pressing a direction
  33690. ; loc_1A624:
  33691. Obj01_SettleLeft:
  33692. add.w d5,d0
  33693. bcc.s +
  33694. move.w #0,d0
  33695. +
  33696. move.w d0,inertia(a0)
  33697.  
  33698. ; increase or decrease speed on the ground
  33699. ; loc_1A630:
  33700. Obj01_Traction:
  33701. move.b angle(a0),d0
  33702. jsr (CalcSine).l
  33703. muls.w inertia(a0),d1
  33704. asr.l #8,d1
  33705. move.w d1,x_vel(a0)
  33706. muls.w inertia(a0),d0
  33707. asr.l #8,d0
  33708. move.w d0,y_vel(a0)
  33709.  
  33710. ; stops Sonic from running through walls that meet the ground
  33711. ; loc_1A64E:
  33712. Obj01_CheckWallsOnGround:
  33713. move.b angle(a0),d0
  33714. addi.b #$40,d0
  33715. bmi.s return_1A6BE
  33716. move.b #$40,d1 ; Rotate 90 degrees clockwise
  33717. tst.w inertia(a0) ; Check inertia
  33718. beq.s return_1A6BE ; If not moving, don't do anything
  33719. bmi.s + ; If negative, branch
  33720. neg.w d1 ; Otherwise, we want to rotate counterclockwise
  33721. +
  33722. move.b angle(a0),d0
  33723. add.b d1,d0
  33724. move.w d0,-(sp)
  33725. bsr.w CalcRoomInFront
  33726. move.w (sp)+,d0
  33727. tst.w d1
  33728. bpl.s return_1A6BE
  33729. asl.w #8,d1
  33730. addi.b #$20,d0
  33731. andi.b #$C0,d0
  33732. beq.s loc_1A6BA
  33733. cmpi.b #$40,d0
  33734. beq.s loc_1A6A8
  33735. cmpi.b #$80,d0
  33736. beq.s loc_1A6A2
  33737. add.w d1,x_vel(a0)
  33738. bset #5,status(a0)
  33739. move.w #0,inertia(a0)
  33740. rts
  33741. ; ---------------------------------------------------------------------------
  33742. loc_1A6A2:
  33743. sub.w d1,y_vel(a0)
  33744. rts
  33745. ; ---------------------------------------------------------------------------
  33746. loc_1A6A8:
  33747. sub.w d1,x_vel(a0)
  33748. bset #5,status(a0)
  33749. move.w #0,inertia(a0)
  33750. rts
  33751. ; ---------------------------------------------------------------------------
  33752. loc_1A6BA:
  33753. add.w d1,y_vel(a0)
  33754.  
  33755. return_1A6BE:
  33756. rts
  33757. ; End of subroutine Sonic_Move
  33758.  
  33759.  
  33760. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33761.  
  33762. ; loc_1A6C0:
  33763. Sonic_MoveLeft:
  33764. move.w inertia(a0),d0
  33765. beq.s +
  33766. bpl.s Sonic_TurnLeft ; if Sonic is already moving to the right, branch
  33767. +
  33768. bset #0,status(a0)
  33769. bne.s +
  33770. bclr #5,status(a0)
  33771. move.b #AniIDSonAni_Run,next_anim(a0)
  33772. +
  33773. sub.w d5,d0 ; add acceleration to the left
  33774. move.w d6,d1
  33775. neg.w d1
  33776. cmp.w d1,d0 ; compare new speed with top speed
  33777. bgt.s + ; if new speed is less than the maximum, branch
  33778. add.w d5,d0 ; remove this frame's acceleration change
  33779. cmp.w d1,d0 ; compare speed with top speed
  33780. ble.s + ; if speed was already greater than the maximum, branch
  33781. move.w d1,d0 ; limit speed on ground going left
  33782. +
  33783. move.w d0,inertia(a0)
  33784. move.b #AniIDSonAni_Walk,anim(a0) ; use walking animation
  33785. rts
  33786. ; ---------------------------------------------------------------------------
  33787. ; loc_1A6FA:
  33788. Sonic_TurnLeft:
  33789. sub.w d4,d0
  33790. bcc.s +
  33791. move.w #-$80,d0
  33792. +
  33793. move.w d0,inertia(a0)
  33794. move.b angle(a0),d0
  33795. addi.b #$20,d0
  33796. andi.b #$C0,d0
  33797. bne.s return_1A744
  33798. cmpi.w #$400,d0
  33799. blt.s return_1A744
  33800. move.b #AniIDSonAni_Stop,anim(a0) ; use "stopping" animation
  33801. bclr #0,status(a0)
  33802. move.w #SndID_Skidding,d0
  33803. jsr (PlaySound).l
  33804. cmpi.b #$C,air_left(a0)
  33805. blo.s return_1A744 ; if he's drowning, branch to not make dust
  33806. move.b #6,(Sonic_Dust+routine).w
  33807. move.b #$15,(Sonic_Dust+mapping_frame).w
  33808.  
  33809. return_1A744:
  33810. rts
  33811. ; End of subroutine Sonic_MoveLeft
  33812.  
  33813.  
  33814. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33815.  
  33816. ; loc_1A746:
  33817. Sonic_MoveRight:
  33818. move.w inertia(a0),d0
  33819. bmi.s Sonic_TurnRight ; if Sonic is already moving to the left, branch
  33820. bclr #0,status(a0)
  33821. beq.s +
  33822. bclr #5,status(a0)
  33823. move.b #AniIDSonAni_Run,next_anim(a0)
  33824. +
  33825. add.w d5,d0 ; add acceleration to the right
  33826. cmp.w d6,d0 ; compare new speed with top speed
  33827. blt.s + ; if new speed is less than the maximum, branch
  33828. sub.w d5,d0 ; remove this frame's acceleration change
  33829. cmp.w d6,d0 ; compare speed with top speed
  33830. bge.s + ; if speed was already greater than the maximum, branch
  33831. move.w d6,d0 ; limit speed on ground going right
  33832. +
  33833. move.w d0,inertia(a0)
  33834. move.b #AniIDSonAni_Walk,anim(a0) ; use walking animation
  33835. rts
  33836. ; ---------------------------------------------------------------------------
  33837. ; loc_1A77A:
  33838. Sonic_TurnRight:
  33839. add.w d4,d0
  33840. bcc.s +
  33841. move.w #$80,d0
  33842. +
  33843. move.w d0,inertia(a0)
  33844. move.b angle(a0),d0
  33845. addi.b #$20,d0
  33846. andi.b #$C0,d0
  33847. bne.s return_1A7C4
  33848. cmpi.w #-$400,d0
  33849. bgt.s return_1A7C4
  33850. move.b #AniIDSonAni_Stop,anim(a0) ; use "stopping" animation
  33851. bset #0,status(a0)
  33852. move.w #SndID_Skidding,d0 ; use "stopping" sound
  33853. jsr (PlaySound).l
  33854. cmpi.b #$C,air_left(a0)
  33855. blo.s return_1A7C4 ; if he's drowning, branch to not make dust
  33856. move.b #6,(Sonic_Dust+routine).w
  33857. move.b #$15,(Sonic_Dust+mapping_frame).w
  33858.  
  33859. return_1A7C4:
  33860. rts
  33861. ; End of subroutine Sonic_MoveRight
  33862.  
  33863. ; ---------------------------------------------------------------------------
  33864. ; Subroutine to change Sonic's speed as he rolls
  33865. ; ---------------------------------------------------------------------------
  33866.  
  33867. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33868.  
  33869. ; loc_1A7C6:
  33870. Sonic_RollSpeed:
  33871. move.w (Sonic_top_speed).w,d6
  33872. asl.w #1,d6
  33873. move.w (Sonic_acceleration).w,d5
  33874. asr.w #1,d5 ; natural roll deceleration = 1/2 normal acceleration
  33875. move.w #$20,d4 ; controlled roll deceleration... interestingly,
  33876. ; this should be Sonic_deceleration/4 according to Tails_RollSpeed,
  33877. ; which means Sonic is much better than Tails at slowing down his rolling when he's underwater
  33878. if status_sec_isSliding = 7
  33879. tst.b status_secondary(a0)
  33880. bmi.w Obj01_Roll_ResetScr
  33881. else
  33882. btst #status_sec_isSliding,status_secondary(a0)
  33883. bne.w Obj01_Roll_ResetScr
  33884. endif
  33885. tst.w move_lock(a0)
  33886. bne.s Sonic_ApplyRollSpeed
  33887. btst #button_left,(Ctrl_1_Held_Logical).w ; is left being pressed?
  33888. beq.s + ; if not, branch
  33889. bsr.w Sonic_RollLeft
  33890. +
  33891. btst #button_right,(Ctrl_1_Held_Logical).w ; is right being pressed?
  33892. beq.s Sonic_ApplyRollSpeed ; if not, branch
  33893. bsr.w Sonic_RollRight
  33894.  
  33895. ; loc_1A7FC:
  33896. Sonic_ApplyRollSpeed:
  33897. move.w inertia(a0),d0
  33898. beq.s Sonic_CheckRollStop
  33899. bmi.s Sonic_ApplyRollSpeedLeft
  33900.  
  33901. ; Sonic_ApplyRollSpeedRight:
  33902. sub.w d5,d0
  33903. bcc.s +
  33904. move.w #0,d0
  33905. +
  33906. move.w d0,inertia(a0)
  33907. bra.s Sonic_CheckRollStop
  33908. ; ---------------------------------------------------------------------------
  33909. ; loc_1A812:
  33910. Sonic_ApplyRollSpeedLeft:
  33911. add.w d5,d0
  33912. bcc.s +
  33913. move.w #0,d0
  33914. +
  33915. move.w d0,inertia(a0)
  33916.  
  33917. ; loc_1A81E:
  33918. Sonic_CheckRollStop:
  33919. tst.w inertia(a0)
  33920. bne.s Obj01_Roll_ResetScr
  33921. tst.b pinball_mode(a0) ; note: the spindash flag has a different meaning when Sonic's already rolling -- it's used to mean he's not allowed to stop rolling
  33922. bne.s Sonic_KeepRolling
  33923. bclr #2,status(a0)
  33924. move.b #$13,y_radius(a0)
  33925. move.b #9,x_radius(a0)
  33926. move.b #AniIDSonAni_Wait,anim(a0)
  33927. subq.w #5,y_pos(a0)
  33928. bra.s Obj01_Roll_ResetScr
  33929.  
  33930. ; ---------------------------------------------------------------------------
  33931. ; magically gives Sonic an extra push if he's going to stop rolling where it's not allowed
  33932. ; (such as in an S-curve in HTZ or a stopper chamber in CNZ)
  33933. ; loc_1A848:
  33934. Sonic_KeepRolling:
  33935. move.w #$400,inertia(a0)
  33936. btst #0,status(a0)
  33937. beq.s Obj01_Roll_ResetScr
  33938. neg.w inertia(a0)
  33939.  
  33940. ; resets the screen to normal while rolling, like Obj01_ResetScr
  33941. ; loc_1A85A:
  33942. Obj01_Roll_ResetScr:
  33943. cmpi.w #(224/2)-16,(Camera_Y_pos_bias).w ; is screen in its default position?
  33944. beq.s Sonic_SetRollSpeeds ; if yes, branch
  33945. bhs.s + ; depending on the sign of the difference,
  33946. addq.w #4,(Camera_Y_pos_bias).w ; either add 2
  33947. + subq.w #2,(Camera_Y_pos_bias).w ; or subtract 2
  33948.  
  33949. ; loc_1A86C:
  33950. Sonic_SetRollSpeeds:
  33951. move.b angle(a0),d0
  33952. jsr (CalcSine).l
  33953. muls.w inertia(a0),d0
  33954. asr.l #8,d0
  33955. move.w d0,y_vel(a0) ; set y velocity based on $14 and angle
  33956. muls.w inertia(a0),d1
  33957. asr.l #8,d1
  33958. cmpi.w #$1000,d1
  33959. ble.s +
  33960. move.w #$1000,d1 ; limit Sonic's speed rolling right
  33961. +
  33962. cmpi.w #-$1000,d1
  33963. bge.s +
  33964. move.w #-$1000,d1 ; limit Sonic's speed rolling left
  33965. +
  33966. move.w d1,x_vel(a0) ; set x velocity based on $14 and angle
  33967. bra.w Obj01_CheckWallsOnGround
  33968. ; End of function Sonic_RollSpeed
  33969.  
  33970.  
  33971. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33972.  
  33973.  
  33974. ; loc_1A8A2:
  33975. Sonic_RollLeft:
  33976. move.w inertia(a0),d0
  33977. beq.s +
  33978. bpl.s Sonic_BrakeRollingRight
  33979. +
  33980. bset #0,status(a0)
  33981. move.b #AniIDSonAni_Roll,anim(a0) ; use "rolling" animation
  33982. rts
  33983. ; ---------------------------------------------------------------------------
  33984. ; loc_1A8B8:
  33985. Sonic_BrakeRollingRight:
  33986. sub.w d4,d0 ; reduce rightward rolling speed
  33987. bcc.s +
  33988. move.w #-$80,d0
  33989. +
  33990. move.w d0,inertia(a0)
  33991. rts
  33992. ; End of function Sonic_RollLeft
  33993.  
  33994.  
  33995. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  33996.  
  33997.  
  33998. ; loc_1A8C6:
  33999. Sonic_RollRight:
  34000. move.w inertia(a0),d0
  34001. bmi.s Sonic_BrakeRollingLeft
  34002. bclr #0,status(a0)
  34003. move.b #AniIDSonAni_Roll,anim(a0) ; use "rolling" animation
  34004. rts
  34005. ; ---------------------------------------------------------------------------
  34006. ; loc_1A8DA:
  34007. Sonic_BrakeRollingLeft:
  34008. add.w d4,d0 ; reduce leftward rolling speed
  34009. bcc.s +
  34010. move.w #$80,d0
  34011. +
  34012. move.w d0,inertia(a0)
  34013. rts
  34014. ; End of subroutine Sonic_RollRight
  34015.  
  34016.  
  34017. ; ---------------------------------------------------------------------------
  34018. ; Subroutine for moving Sonic left or right when he's in the air
  34019. ; ---------------------------------------------------------------------------
  34020.  
  34021. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34022.  
  34023. ; loc_1A8E8:
  34024. Sonic_ChgJumpDir:
  34025. move.w (Sonic_top_speed).w,d6
  34026. move.w (Sonic_acceleration).w,d5
  34027. asl.w #1,d5
  34028. btst #4,status(a0) ; did Sonic jump from rolling?
  34029. bne.s Obj01_Jump_ResetScr ; if yes, branch to skip midair control
  34030. move.w x_vel(a0),d0
  34031. btst #button_left,(Ctrl_1_Held_Logical).w
  34032. beq.s + ; if not holding left, branch
  34033.  
  34034. bset #0,status(a0)
  34035. sub.w d5,d0 ; add acceleration to the left
  34036. move.w d6,d1
  34037. neg.w d1
  34038. cmp.w d1,d0 ; compare new speed with top speed
  34039. bgt.s + ; if new speed is less than the maximum, branch
  34040. move.w d1,d0 ; limit speed in air going left, even if Sonic was already going faster (speed limit/cap)
  34041. +
  34042. btst #button_right,(Ctrl_1_Held_Logical).w
  34043. beq.s + ; if not holding right, branch
  34044.  
  34045. bclr #0,status(a0)
  34046. add.w d5,d0 ; accelerate right in the air
  34047. cmp.w d6,d0 ; compare new speed with top speed
  34048. blt.s + ; if new speed is less than the maximum, branch
  34049. move.w d6,d0 ; limit speed in air going right, even if Sonic was already going faster (speed limit/cap)
  34050. ; Obj01_JumpMove:
  34051. + move.w d0,x_vel(a0)
  34052.  
  34053. ; loc_1A932: Obj01_ResetScr2:
  34054. Obj01_Jump_ResetScr:
  34055. cmpi.w #(224/2)-16,(Camera_Y_pos_bias).w ; is screen in its default position?
  34056. beq.s Sonic_JumpPeakDecelerate ; if yes, branch
  34057. bhs.s + ; depending on the sign of the difference,
  34058. addq.w #4,(Camera_Y_pos_bias).w ; either add 2
  34059. + subq.w #2,(Camera_Y_pos_bias).w ; or subtract 2
  34060.  
  34061. ; loc_1A944:
  34062. Sonic_JumpPeakDecelerate:
  34063. cmpi.w #-$400,y_vel(a0) ; is Sonic moving faster than -$400 upwards?
  34064. blo.s return_1A972 ; if yes, return
  34065. move.w x_vel(a0),d0
  34066. move.w d0,d1
  34067. asr.w #5,d1 ; d1 = x_velocity / 32
  34068. beq.s return_1A972 ; return if d1 is 0
  34069. bmi.s Sonic_JumpPeakDecelerateLeft ; branch if moving left
  34070.  
  34071. ; Sonic_JumpPeakDecelerateRight:
  34072. sub.w d1,d0 ; reduce x velocity by d1
  34073. bcc.s +
  34074. move.w #0,d0
  34075. +
  34076. move.w d0,x_vel(a0)
  34077. rts
  34078. ;-------------------------------------------------------------
  34079. ; loc_1A966:
  34080. Sonic_JumpPeakDecelerateLeft:
  34081. sub.w d1,d0 ; reduce x velocity by d1
  34082. bcs.s +
  34083. move.w #0,d0
  34084. +
  34085. move.w d0,x_vel(a0)
  34086.  
  34087. return_1A972:
  34088. rts
  34089. ; End of subroutine Sonic_ChgJumpDir
  34090. ; ===========================================================================
  34091.  
  34092. ; ---------------------------------------------------------------------------
  34093. ; Subroutine to prevent Sonic from leaving the boundaries of a level
  34094. ; ---------------------------------------------------------------------------
  34095.  
  34096. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34097.  
  34098. ; loc_1A974:
  34099. Sonic_LevelBound:
  34100. move.l x_pos(a0),d1
  34101. move.w x_vel(a0),d0
  34102. ext.l d0
  34103. asl.l #8,d0
  34104. add.l d0,d1
  34105. swap d1
  34106. move.w (Camera_Min_X_pos).w,d0
  34107. addi.w #$10,d0
  34108. cmp.w d1,d0 ; has Sonic touched the left boundary?
  34109. bhi.s Sonic_Boundary_Sides ; if yes, branch
  34110. move.w (Camera_Max_X_pos).w,d0
  34111. addi.w #$128,d0
  34112. tst.b (Current_Boss_ID).w
  34113. bne.s +
  34114. addi.w #$40,d0
  34115. +
  34116. cmp.w d1,d0 ; has Sonic touched the right boundary?
  34117. bls.s Sonic_Boundary_Sides ; if yes, branch
  34118.  
  34119. ; loc_1A9A6:
  34120. Sonic_Boundary_CheckBottom:
  34121. move.w (Camera_Max_Y_pos_now).w,d0
  34122. addi.w #$E0,d0
  34123. cmp.w y_pos(a0),d0 ; has Sonic touched the bottom boundary?
  34124. blt.s Sonic_Boundary_Bottom ; if yes, branch
  34125. rts
  34126. ; ---------------------------------------------------------------------------
  34127. Sonic_Boundary_Bottom: ;;
  34128. jmpto (KillCharacter).l, JmpTo_KillCharacter
  34129. ; ===========================================================================
  34130.  
  34131. ; loc_1A9BA:
  34132. Sonic_Boundary_Sides:
  34133. move.w d0,x_pos(a0)
  34134. move.w #0,2+x_pos(a0) ; subpixel x
  34135. move.w #0,x_vel(a0)
  34136. move.w #0,inertia(a0)
  34137. bra.s Sonic_Boundary_CheckBottom
  34138. ; ===========================================================================
  34139.  
  34140. ; ---------------------------------------------------------------------------
  34141. ; Subroutine allowing Sonic to start rolling when he's moving
  34142. ; ---------------------------------------------------------------------------
  34143.  
  34144. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34145.  
  34146. ; loc_1A9D2:
  34147. Sonic_Roll:
  34148. if status_sec_isSliding = 7
  34149. tst.b status_secondary(a0)
  34150. bmi.s Obj01_NoRoll
  34151. else
  34152. btst #status_sec_isSliding,status_secondary(a0)
  34153. bne.s Obj01_NoRoll
  34154. endif
  34155. mvabs.w inertia(a0),d0
  34156. cmpi.w #$80,d0 ; is Sonic moving at $80 speed or faster?
  34157. blo.s Obj01_NoRoll ; if not, branch
  34158. move.b (Ctrl_1_Held_Logical).w,d0
  34159. andi.b #button_left_mask|button_right_mask,d0 ; is left/right being pressed?
  34160. bne.s Obj01_NoRoll ; if yes, branch
  34161. btst #button_down,(Ctrl_1_Held_Logical).w ; is down being pressed?
  34162. bne.s Obj01_ChkRoll ; if yes, branch
  34163. ; return_1A9F8:
  34164. Obj01_NoRoll:
  34165. rts
  34166.  
  34167. ; ---------------------------------------------------------------------------
  34168. ; loc_1A9FA:
  34169. Obj01_ChkRoll:
  34170. btst #2,status(a0) ; is Sonic already rolling?
  34171. beq.s Obj01_DoRoll ; if not, branch
  34172. rts
  34173.  
  34174. ; ---------------------------------------------------------------------------
  34175. ; loc_1AA04:
  34176. Obj01_DoRoll:
  34177. bset #2,status(a0)
  34178. move.b #$E,y_radius(a0)
  34179. move.b #7,x_radius(a0)
  34180. move.b #AniIDSonAni_Roll,anim(a0) ; use "rolling" animation
  34181. addq.w #5,y_pos(a0)
  34182. move.w #SndID_Roll,d0
  34183. jsr (PlaySound).l ; play rolling sound
  34184. tst.w inertia(a0)
  34185. bne.s return_1AA36
  34186. move.w #$200,inertia(a0)
  34187.  
  34188. return_1AA36:
  34189. rts
  34190. ; End of function Sonic_Roll
  34191.  
  34192.  
  34193. ; ---------------------------------------------------------------------------
  34194. ; Subroutine allowing Sonic to jump
  34195. ; ---------------------------------------------------------------------------
  34196.  
  34197. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34198.  
  34199. ; loc_1AA38:
  34200. Sonic_Jump:
  34201. move.b (Ctrl_1_Press_Logical).w,d0
  34202. andi.b #button_B_mask|button_C_mask|button_A_mask,d0 ; is A, B or C pressed?
  34203. beq.w return_1AAE6 ; if not, return
  34204. moveq #0,d0
  34205. move.b angle(a0),d0
  34206. addi.b #$80,d0
  34207. bsr.w CalcRoomOverHead
  34208. cmpi.w #6,d1 ; does Sonic have enough room to jump?
  34209. blt.w return_1AAE6 ; if not, branch
  34210. move.w #$680,d2
  34211. tst.b (Super_Sonic_flag).w
  34212. beq.s +
  34213. move.w #$800,d2 ; set higher jump speed if super
  34214. +
  34215. btst #6,status(a0) ; Test if underwater
  34216. beq.s +
  34217. move.w #$380,d2 ; set lower jump speed if under
  34218. +
  34219. moveq #0,d0
  34220. move.b angle(a0),d0
  34221. subi.b #$40,d0
  34222. jsr (CalcSine).l
  34223. muls.w d2,d1
  34224. asr.l #8,d1
  34225. add.w d1,x_vel(a0) ; make Sonic jump (in X... this adds nothing on level ground)
  34226. muls.w d2,d0
  34227. asr.l #8,d0
  34228. add.w d0,y_vel(a0) ; make Sonic jump (in Y)
  34229. bset #1,status(a0)
  34230. bclr #5,status(a0)
  34231. addq.l #4,sp
  34232. move.b #1,jumping(a0)
  34233. clr.b stick_to_convex(a0)
  34234. move.w #SndID_Jump,d0
  34235. jsr (PlaySound).l ; play jumping sound
  34236. move.b #$13,y_radius(a0)
  34237. move.b #9,x_radius(a0)
  34238. btst #2,status(a0)
  34239. bne.s Sonic_RollJump
  34240. move.b #$E,y_radius(a0)
  34241. move.b #7,x_radius(a0)
  34242. move.b #AniIDSonAni_Roll,anim(a0) ; use "jumping" animation
  34243. bset #2,status(a0)
  34244. addq.w #5,y_pos(a0)
  34245.  
  34246. return_1AAE6:
  34247. rts
  34248. ; ---------------------------------------------------------------------------
  34249. ; loc_1AAE8:
  34250. Sonic_RollJump:
  34251. bset #4,status(a0) ; set the rolling+jumping flag
  34252. rts
  34253. ; End of function Sonic_Jump
  34254.  
  34255.  
  34256. ; ---------------------------------------------------------------------------
  34257. ; Subroutine letting Sonic control the height of the jump
  34258. ; when the jump button is released
  34259. ; ---------------------------------------------------------------------------
  34260.  
  34261. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34262.  
  34263. ; ===========================================================================
  34264. ; loc_1AAF0:
  34265. Sonic_JumpHeight:
  34266. tst.b jumping(a0) ; is Sonic jumping?
  34267. beq.s Sonic_UpVelCap ; if not, branch
  34268.  
  34269. move.w #-$400,d1
  34270. btst #6,status(a0) ; is Sonic underwater?
  34271. beq.s + ; if not, branch
  34272. move.w #-$200,d1
  34273. +
  34274. cmp.w y_vel(a0),d1 ; is Sonic going up faster than d1?
  34275. ble.s + ; if not, branch
  34276. move.b (Ctrl_1_Held_Logical).w,d0
  34277. andi.b #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
  34278. bne.s + ; if yes, branch
  34279. move.w d1,y_vel(a0) ; immediately reduce Sonic's upward speed to d1
  34280. +
  34281. tst.b y_vel(a0) ; is Sonic exactly at the height of his jump?
  34282. beq.s Sonic_CheckGoSuper ; if yes, test for turning into Super Sonic
  34283. rts
  34284. ; ---------------------------------------------------------------------------
  34285. ; loc_1AB22:
  34286. Sonic_UpVelCap:
  34287. tst.b pinball_mode(a0) ; is Sonic charging a spindash or in a rolling-only area?
  34288. bne.s return_1AB36 ; if yes, return
  34289. cmpi.w #-$FC0,y_vel(a0) ; is Sonic moving up really fast?
  34290. bge.s return_1AB36 ; if not, return
  34291. move.w #-$FC0,y_vel(a0) ; cap upward speed
  34292.  
  34293. return_1AB36:
  34294. rts
  34295. ; End of subroutine Sonic_JumpHeight
  34296.  
  34297. ; ---------------------------------------------------------------------------
  34298. ; Subroutine called at the peak of a jump that transforms Sonic into Super Sonic
  34299. ; if he has enough rings and emeralds
  34300. ; ---------------------------------------------------------------------------
  34301.  
  34302. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34303.  
  34304. ; loc_1AB38: test_set_SS:
  34305. Sonic_CheckGoSuper:
  34306. tst.b (Super_Sonic_flag).w ; is Sonic already Super?
  34307. bne.s return_1ABA4 ; if yes, branch
  34308. cmpi.b #7,(Emerald_count).w ; does Sonic have exactly 7 emeralds?
  34309. bne.s return_1ABA4 ; if not, branch
  34310. cmpi.w #50,(Ring_count).w ; does Sonic have at least 50 rings?
  34311. blo.s return_1ABA4 ; if not, branch
  34312. if gameRevision=2
  34313. ; fixes a bug where the player can get stuck if transforming at the end of a level
  34314. tst.b (Update_HUD_timer).w ; has Sonic reached the end of the act?
  34315. beq.s return_1ABA4 ; if yes, branch
  34316. endif
  34317.  
  34318. move.b #1,(Super_Sonic_palette).w
  34319. move.b #$F,(Palette_timer).w
  34320. move.b #1,(Super_Sonic_flag).w
  34321. move.b #$81,obj_control(a0)
  34322. move.b #AniIDSupSonAni_Transform,anim(a0) ; use transformation animation
  34323. move.b #ObjID_SuperSonicStars,(SuperSonicStars+id).w ; load Obj7E (super sonic stars object) at $FFFFD040
  34324. move.w #$A00,(Sonic_top_speed).w
  34325. move.w #$30,(Sonic_acceleration).w
  34326. move.w #$100,(Sonic_deceleration).w
  34327. move.w #0,invincibility_time(a0)
  34328. bset #status_sec_isInvincible,status_secondary(a0) ; make Sonic invincible
  34329. move.w #SndID_SuperTransform,d0
  34330. jsr (PlaySound).l ; Play transformation sound effect.
  34331. move.w #MusID_SuperSonic,d0
  34332. jmp (PlayMusic).l ; load the Super Sonic song and return
  34333.  
  34334. ; ---------------------------------------------------------------------------
  34335. return_1ABA4:
  34336. rts
  34337. ; End of subroutine Sonic_CheckGoSuper
  34338.  
  34339.  
  34340. ; ---------------------------------------------------------------------------
  34341. ; Subroutine doing the extra logic for Super Sonic
  34342. ; ---------------------------------------------------------------------------
  34343.  
  34344. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34345.  
  34346. ; loc_1ABA6:
  34347. Sonic_Super:
  34348. tst.b (Super_Sonic_flag).w ; Ignore all this code if not Super Sonic
  34349. beq.w return_1AC3C
  34350. tst.b (Update_HUD_timer).w
  34351. beq.s Sonic_RevertToNormal ; ?
  34352. subq.w #1,(Super_Sonic_frame_count).w
  34353. bpl.w return_1AC3C
  34354. move.w #60,(Super_Sonic_frame_count).w ; Reset frame counter to 60
  34355. tst.w (Ring_count).w
  34356. beq.s Sonic_RevertToNormal
  34357. ori.b #1,(Update_HUD_rings).w
  34358. cmpi.w #1,(Ring_count).w
  34359. beq.s +
  34360. cmpi.w #10,(Ring_count).w
  34361. beq.s +
  34362. cmpi.w #100,(Ring_count).w
  34363. bne.s ++
  34364. +
  34365. ori.b #$80,(Update_HUD_rings).w
  34366. +
  34367. subq.w #1,(Ring_count).w
  34368. bne.s return_1AC3C
  34369. ; loc_1ABF2:
  34370. Sonic_RevertToNormal:
  34371. move.b #2,(Super_Sonic_palette).w ; Remove rotating palette
  34372. move.w #$28,(Palette_frame).w
  34373. move.b #0,(Super_Sonic_flag).w
  34374. move.b #1,next_anim(a0) ; Change animation back to normal ?
  34375. move.w #1,invincibility_time(a0) ; Remove invincibility
  34376. move.w #$600,(Sonic_top_speed).w
  34377. move.w #$C,(Sonic_acceleration).w
  34378. move.w #$80,(Sonic_deceleration).w
  34379. btst #6,status(a0) ; Check if underwater, return if not
  34380. beq.s return_1AC3C
  34381. move.w #$300,(Sonic_top_speed).w
  34382. move.w #6,(Sonic_acceleration).w
  34383. move.w #$40,(Sonic_deceleration).w
  34384.  
  34385. return_1AC3C:
  34386. rts
  34387. ; End of subroutine Sonic_Super
  34388.  
  34389. ; ---------------------------------------------------------------------------
  34390. ; Subroutine to check for starting to charge a spindash
  34391. ; ---------------------------------------------------------------------------
  34392.  
  34393. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34394.  
  34395. ; loc_1AC3E:
  34396. Sonic_CheckSpindash:
  34397. tst.b spindash_flag(a0)
  34398. bne.s Sonic_UpdateSpindash
  34399. cmpi.b #AniIDSonAni_Duck,anim(a0)
  34400. bne.s return_1AC8C
  34401. move.b (Ctrl_1_Press_Logical).w,d0
  34402. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  34403. beq.w return_1AC8C
  34404. move.b #AniIDSonAni_Spindash,anim(a0)
  34405. move.w #SndID_SpindashRev,d0
  34406. jsr (PlaySound).l
  34407. addq.l #4,sp
  34408. move.b #1,spindash_flag(a0)
  34409. move.w #0,spindash_counter(a0)
  34410. cmpi.b #$C,air_left(a0) ; if he's drowning, branch to not make dust
  34411. blo.s +
  34412. move.b #2,(Sonic_Dust+anim).w
  34413. +
  34414. bsr.w Sonic_LevelBound
  34415. bsr.w AnglePos
  34416.  
  34417. return_1AC8C:
  34418. rts
  34419. ; End of subroutine Sonic_CheckSpindash
  34420.  
  34421.  
  34422. ; ---------------------------------------------------------------------------
  34423. ; Subrouting to update an already-charging spindash
  34424. ; ---------------------------------------------------------------------------
  34425.  
  34426. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34427.  
  34428. ; loc_1AC8E:
  34429. Sonic_UpdateSpindash:
  34430. move.b (Ctrl_1_Held_Logical).w,d0
  34431. btst #button_down,d0
  34432. bne.w Sonic_ChargingSpindash
  34433.  
  34434. ; unleash the charged spindash and start rolling quickly:
  34435. move.b #$E,y_radius(a0)
  34436. move.b #7,x_radius(a0)
  34437. move.b #AniIDSonAni_Roll,anim(a0)
  34438. addq.w #5,y_pos(a0) ; add the difference between Sonic's rolling and standing heights
  34439. move.b #0,spindash_flag(a0)
  34440. moveq #0,d0
  34441. move.b spindash_counter(a0),d0
  34442. add.w d0,d0
  34443. move.w SpindashSpeeds(pc,d0.w),inertia(a0)
  34444. tst.b (Super_Sonic_flag).w
  34445. beq.s +
  34446. move.w SpindashSpeedsSuper(pc,d0.w),inertia(a0)
  34447. +
  34448. move.w inertia(a0),d0
  34449. subi.w #$800,d0
  34450. add.w d0,d0
  34451. andi.w #$1F00,d0
  34452. neg.w d0
  34453. addi.w #$2000,d0
  34454. move.w d0,(Horiz_scroll_delay_val).w
  34455. btst #0,status(a0)
  34456. beq.s +
  34457. neg.w inertia(a0)
  34458. +
  34459. bset #2,status(a0)
  34460. move.b #0,(Sonic_Dust+anim).w
  34461. move.w #SndID_SpindashRelease,d0 ; spindash zoom sound
  34462. jsr (PlaySound).l
  34463. bra.s Obj01_Spindash_ResetScr
  34464. ; ===========================================================================
  34465. ; word_1AD0C:
  34466. SpindashSpeeds:
  34467. dc.w $800 ; 0
  34468. dc.w $880 ; 1
  34469. dc.w $900 ; 2
  34470. dc.w $980 ; 3
  34471. dc.w $A00 ; 4
  34472. dc.w $A80 ; 5
  34473. dc.w $B00 ; 6
  34474. dc.w $B80 ; 7
  34475. dc.w $C00 ; 8
  34476. ; word_1AD1E:
  34477. SpindashSpeedsSuper:
  34478. dc.w $B00 ; 0
  34479. dc.w $B80 ; 1
  34480. dc.w $C00 ; 2
  34481. dc.w $C80 ; 3
  34482. dc.w $D00 ; 4
  34483. dc.w $D80 ; 5
  34484. dc.w $E00 ; 6
  34485. dc.w $E80 ; 7
  34486. dc.w $F00 ; 8
  34487. ; ===========================================================================
  34488. ; loc_1AD30:
  34489. Sonic_ChargingSpindash: ; If still charging the dash...
  34490. tst.w spindash_counter(a0)
  34491. beq.s +
  34492. move.w spindash_counter(a0),d0
  34493. lsr.w #5,d0
  34494. sub.w d0,spindash_counter(a0)
  34495. bcc.s +
  34496. move.w #0,spindash_counter(a0)
  34497. +
  34498. move.b (Ctrl_1_Press_Logical).w,d0
  34499. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  34500. beq.w Obj01_Spindash_ResetScr
  34501. move.w #(AniIDSonAni_Spindash<<8),anim(a0)
  34502. move.w #SndID_SpindashRev,d0
  34503. jsr (PlaySound).l
  34504. addi.w #$200,spindash_counter(a0)
  34505. cmpi.w #$800,spindash_counter(a0)
  34506. blo.s Obj01_Spindash_ResetScr
  34507. move.w #$800,spindash_counter(a0)
  34508.  
  34509. ; loc_1AD78:
  34510. Obj01_Spindash_ResetScr:
  34511. addq.l #4,sp
  34512. cmpi.w #(224/2)-16,(Camera_Y_pos_bias).w
  34513. beq.s loc_1AD8C
  34514. bhs.s +
  34515. addq.w #4,(Camera_Y_pos_bias).w
  34516. + subq.w #2,(Camera_Y_pos_bias).w
  34517.  
  34518. loc_1AD8C:
  34519. bsr.w Sonic_LevelBound
  34520. bsr.w AnglePos
  34521. rts
  34522. ; End of subroutine Sonic_UpdateSpindash
  34523.  
  34524.  
  34525. ; ---------------------------------------------------------------------------
  34526. ; Subroutine to slow Sonic walking up a slope
  34527. ; ---------------------------------------------------------------------------
  34528.  
  34529. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34530.  
  34531. ; loc_1AD96:
  34532. Sonic_SlopeResist:
  34533. move.b angle(a0),d0
  34534. addi.b #$60,d0
  34535. cmpi.b #$C0,d0
  34536. bhs.s return_1ADCA
  34537. move.b angle(a0),d0
  34538. jsr (CalcSine).l
  34539. muls.w #$20,d0
  34540. asr.l #8,d0
  34541. tst.w inertia(a0)
  34542. beq.s return_1ADCA
  34543. bmi.s loc_1ADC6
  34544. tst.w d0
  34545. beq.s +
  34546. add.w d0,inertia(a0) ; change Sonic's $14
  34547. +
  34548. rts
  34549. ; ---------------------------------------------------------------------------
  34550.  
  34551. loc_1ADC6:
  34552. add.w d0,inertia(a0)
  34553.  
  34554. return_1ADCA:
  34555. rts
  34556. ; End of subroutine Sonic_SlopeResist
  34557.  
  34558. ; ---------------------------------------------------------------------------
  34559. ; Subroutine to push Sonic down a slope while he's rolling
  34560. ; ---------------------------------------------------------------------------
  34561.  
  34562. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34563.  
  34564. ; loc_1ADCC:
  34565. Sonic_RollRepel:
  34566. move.b angle(a0),d0
  34567. addi.b #$60,d0
  34568. cmpi.b #-$40,d0
  34569. bhs.s return_1AE06
  34570. move.b angle(a0),d0
  34571. jsr (CalcSine).l
  34572. muls.w #$50,d0
  34573. asr.l #8,d0
  34574. tst.w inertia(a0)
  34575. bmi.s loc_1ADFC
  34576. tst.w d0
  34577. bpl.s loc_1ADF6
  34578. asr.l #2,d0
  34579.  
  34580. loc_1ADF6:
  34581. add.w d0,inertia(a0)
  34582. rts
  34583. ; ===========================================================================
  34584.  
  34585. loc_1ADFC:
  34586. tst.w d0
  34587. bmi.s loc_1AE02
  34588. asr.l #2,d0
  34589.  
  34590. loc_1AE02:
  34591. add.w d0,inertia(a0)
  34592.  
  34593. return_1AE06:
  34594. rts
  34595. ; End of function Sonic_RollRepel
  34596.  
  34597. ; ---------------------------------------------------------------------------
  34598. ; Subroutine to push Sonic down a slope
  34599. ; ---------------------------------------------------------------------------
  34600.  
  34601. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34602.  
  34603. ; loc_1AE08:
  34604. Sonic_SlopeRepel:
  34605. nop
  34606. tst.b stick_to_convex(a0)
  34607. bne.s return_1AE42
  34608. tst.w move_lock(a0)
  34609. bne.s loc_1AE44
  34610. move.b angle(a0),d0
  34611. addi.b #$20,d0
  34612. andi.b #$C0,d0
  34613. beq.s return_1AE42
  34614. mvabs.w inertia(a0),d0
  34615. cmpi.w #$280,d0
  34616. bhs.s return_1AE42
  34617. clr.w inertia(a0)
  34618. bset #1,status(a0)
  34619. move.w #$1E,move_lock(a0)
  34620.  
  34621. return_1AE42:
  34622. rts
  34623. ; ===========================================================================
  34624.  
  34625. loc_1AE44:
  34626. subq.w #1,move_lock(a0)
  34627. rts
  34628. ; End of function Sonic_SlopeRepel
  34629.  
  34630. ; ---------------------------------------------------------------------------
  34631. ; Subroutine to return Sonic's angle to 0 as he jumps
  34632. ; ---------------------------------------------------------------------------
  34633.  
  34634. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34635.  
  34636. ; loc_1AE4A:
  34637. Sonic_JumpAngle:
  34638. move.b angle(a0),d0 ; get Sonic's angle
  34639. beq.s Sonic_JumpFlip ; if already 0, branch
  34640. bpl.s loc_1AE5A ; if higher than 0, branch
  34641.  
  34642. addq.b #2,d0 ; increase angle
  34643. bcc.s BranchTo_Sonic_JumpAngleSet
  34644. moveq #0,d0
  34645.  
  34646. BranchTo_Sonic_JumpAngleSet
  34647. bra.s Sonic_JumpAngleSet
  34648. ; ===========================================================================
  34649.  
  34650. loc_1AE5A:
  34651. subq.b #2,d0 ; decrease angle
  34652. bcc.s Sonic_JumpAngleSet
  34653. moveq #0,d0
  34654.  
  34655. ; loc_1AE60:
  34656. Sonic_JumpAngleSet:
  34657. move.b d0,angle(a0)
  34658. ; End of function Sonic_JumpAngle
  34659. ; continue straight to Sonic_JumpFlip
  34660.  
  34661. ; ---------------------------------------------------------------------------
  34662. ; Updates Sonic's secondary angle if he's tumbling
  34663. ; ---------------------------------------------------------------------------
  34664.  
  34665. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34666.  
  34667. ; loc_1AE64:
  34668. Sonic_JumpFlip:
  34669. move.b flip_angle(a0),d0
  34670. beq.s return_1AEA8
  34671. tst.w inertia(a0)
  34672. bmi.s Sonic_JumpLeftFlip
  34673. ; loc_1AE70:
  34674. Sonic_JumpRightFlip:
  34675. move.b flip_speed(a0),d1
  34676. add.b d1,d0
  34677. bcc.s BranchTo_Sonic_JumpFlipSet
  34678. subq.b #1,flips_remaining(a0)
  34679. bcc.s BranchTo_Sonic_JumpFlipSet
  34680. move.b #0,flips_remaining(a0)
  34681. moveq #0,d0
  34682.  
  34683. BranchTo_Sonic_JumpFlipSet
  34684. bra.s Sonic_JumpFlipSet
  34685. ; ===========================================================================
  34686. ; loc_1AE88:
  34687. Sonic_JumpLeftFlip:
  34688. tst.b flip_turned(a0)
  34689. bne.s Sonic_JumpRightFlip
  34690. move.b flip_speed(a0),d1
  34691. sub.b d1,d0
  34692. bcc.s Sonic_JumpFlipSet
  34693. subq.b #1,flips_remaining(a0)
  34694. bcc.s Sonic_JumpFlipSet
  34695. move.b #0,flips_remaining(a0)
  34696. moveq #0,d0
  34697. ; loc_1AEA4:
  34698. Sonic_JumpFlipSet:
  34699. move.b d0,flip_angle(a0)
  34700.  
  34701. return_1AEA8:
  34702. rts
  34703. ; End of function Sonic_JumpFlip
  34704.  
  34705. ; ---------------------------------------------------------------------------
  34706. ; Subroutine for Sonic to interact with the floor and walls when he's in the air
  34707. ; ---------------------------------------------------------------------------
  34708.  
  34709. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34710.  
  34711. ; loc_1AEAA: Sonic_Floor:
  34712. Sonic_DoLevelCollision:
  34713. move.l #Primary_Collision,(Collision_addr).w
  34714. cmpi.b #$C,top_solid_bit(a0)
  34715. beq.s +
  34716. move.l #Secondary_Collision,(Collision_addr).w
  34717. +
  34718. move.b lrb_solid_bit(a0),d5
  34719. move.w x_vel(a0),d1
  34720. move.w y_vel(a0),d2
  34721. jsr (CalcAngle).l
  34722. subi.b #$20,d0
  34723. andi.b #$C0,d0
  34724. cmpi.b #$40,d0
  34725. beq.w Sonic_HitLeftWall
  34726. cmpi.b #$80,d0
  34727. beq.w Sonic_HitCeilingAndWalls
  34728. cmpi.b #$C0,d0
  34729. beq.w Sonic_HitRightWall
  34730. bsr.w CheckLeftWallDist
  34731. tst.w d1
  34732. bpl.s +
  34733. sub.w d1,x_pos(a0)
  34734. move.w #0,x_vel(a0) ; stop Sonic since he hit a wall
  34735. +
  34736. bsr.w CheckRightWallDist
  34737. tst.w d1
  34738. bpl.s +
  34739. add.w d1,x_pos(a0)
  34740. move.w #0,x_vel(a0) ; stop Sonic since he hit a wall
  34741. +
  34742. bsr.w Sonic_CheckFloor
  34743. tst.w d1
  34744. bpl.s return_1AF8A
  34745. move.b y_vel(a0),d2
  34746. addq.b #8,d2
  34747. neg.b d2
  34748. cmp.b d2,d1
  34749. bge.s +
  34750. cmp.b d2,d0
  34751. blt.s return_1AF8A
  34752. +
  34753. add.w d1,y_pos(a0)
  34754. move.b d3,angle(a0)
  34755. bsr.w Sonic_ResetOnFloor
  34756. move.b d3,d0
  34757. addi.b #$20,d0
  34758. andi.b #$40,d0
  34759. bne.s loc_1AF68
  34760. move.b d3,d0
  34761. addi.b #$10,d0
  34762. andi.b #$20,d0
  34763. beq.s loc_1AF5A
  34764. asr y_vel(a0)
  34765. bra.s loc_1AF7C
  34766. ; ===========================================================================
  34767.  
  34768. loc_1AF5A:
  34769. move.w #0,y_vel(a0)
  34770. move.w x_vel(a0),inertia(a0)
  34771. rts
  34772. ; ===========================================================================
  34773.  
  34774. loc_1AF68:
  34775. move.w #0,x_vel(a0) ; stop Sonic since he hit a wall
  34776. cmpi.w #$FC0,y_vel(a0)
  34777. ble.s loc_1AF7C
  34778. move.w #$FC0,y_vel(a0)
  34779.  
  34780. loc_1AF7C:
  34781. move.w y_vel(a0),inertia(a0)
  34782. tst.b d3
  34783. bpl.s return_1AF8A
  34784. neg.w inertia(a0)
  34785.  
  34786. return_1AF8A:
  34787. rts
  34788. ; ===========================================================================
  34789. ; loc_1AF8C:
  34790. Sonic_HitLeftWall:
  34791. bsr.w CheckLeftWallDist
  34792. tst.w d1
  34793. bpl.s Sonic_HitCeiling ; branch if distance is positive (not inside wall)
  34794. sub.w d1,x_pos(a0)
  34795. move.w #0,x_vel(a0) ; stop Sonic since he hit a wall
  34796. move.w y_vel(a0),inertia(a0)
  34797. rts
  34798. ; ===========================================================================
  34799. ; loc_1AFA6:
  34800. Sonic_HitCeiling:
  34801. bsr.w Sonic_CheckCeiling
  34802. tst.w d1
  34803. bpl.s Sonic_HitFloor ; branch if distance is positive (not inside ceiling)
  34804. sub.w d1,y_pos(a0)
  34805. tst.w y_vel(a0)
  34806. bpl.s return_1AFBE
  34807. move.w #0,y_vel(a0) ; stop Sonic in y since he hit a ceiling
  34808.  
  34809. return_1AFBE:
  34810. rts
  34811. ; ===========================================================================
  34812. ; loc_1AFC0:
  34813. Sonic_HitFloor:
  34814. tst.w y_vel(a0)
  34815. bmi.s return_1AFE6
  34816. bsr.w Sonic_CheckFloor
  34817. tst.w d1
  34818. bpl.s return_1AFE6
  34819. add.w d1,y_pos(a0)
  34820. move.b d3,angle(a0)
  34821. bsr.w Sonic_ResetOnFloor
  34822. move.w #0,y_vel(a0)
  34823. move.w x_vel(a0),inertia(a0)
  34824.  
  34825. return_1AFE6:
  34826. rts
  34827. ; ===========================================================================
  34828. ; loc_1AFE8:
  34829. Sonic_HitCeilingAndWalls:
  34830. bsr.w CheckLeftWallDist
  34831. tst.w d1
  34832. bpl.s +
  34833. sub.w d1,x_pos(a0)
  34834. move.w #0,x_vel(a0) ; stop Sonic since he hit a wall
  34835. +
  34836. bsr.w CheckRightWallDist
  34837. tst.w d1
  34838. bpl.s +
  34839. add.w d1,x_pos(a0)
  34840. move.w #0,x_vel(a0) ; stop Sonic since he hit a wall
  34841. +
  34842. bsr.w Sonic_CheckCeiling
  34843. tst.w d1
  34844. bpl.s return_1B042
  34845. sub.w d1,y_pos(a0)
  34846. move.b d3,d0
  34847. addi.b #$20,d0
  34848. andi.b #$40,d0
  34849. bne.s loc_1B02C
  34850. move.w #0,y_vel(a0) ; stop Sonic in y since he hit a ceiling
  34851. rts
  34852. ; ===========================================================================
  34853.  
  34854. loc_1B02C:
  34855. move.b d3,angle(a0)
  34856. bsr.w Sonic_ResetOnFloor
  34857. move.w y_vel(a0),inertia(a0)
  34858. tst.b d3
  34859. bpl.s return_1B042
  34860. neg.w inertia(a0)
  34861.  
  34862. return_1B042:
  34863. rts
  34864. ; ===========================================================================
  34865. ; loc_1B044:
  34866. Sonic_HitRightWall:
  34867. bsr.w CheckRightWallDist
  34868. tst.w d1
  34869. bpl.s Sonic_HitCeiling2
  34870. add.w d1,x_pos(a0)
  34871. move.w #0,x_vel(a0) ; stop Sonic since he hit a wall
  34872. move.w y_vel(a0),inertia(a0)
  34873. rts
  34874. ; ===========================================================================
  34875. ; identical to Sonic_HitCeiling...
  34876. ; loc_1B05E:
  34877. Sonic_HitCeiling2:
  34878. bsr.w Sonic_CheckCeiling
  34879. tst.w d1
  34880. bpl.s Sonic_HitFloor2
  34881. sub.w d1,y_pos(a0)
  34882. tst.w y_vel(a0)
  34883. bpl.s return_1B076
  34884. move.w #0,y_vel(a0) ; stop Sonic in y since he hit a ceiling
  34885.  
  34886. return_1B076:
  34887. rts
  34888. ; ===========================================================================
  34889. ; identical to Sonic_HitFloor...
  34890. ; loc_1B078:
  34891. Sonic_HitFloor2:
  34892. tst.w y_vel(a0)
  34893. bmi.s return_1B09E
  34894. bsr.w Sonic_CheckFloor
  34895. tst.w d1
  34896. bpl.s return_1B09E
  34897. add.w d1,y_pos(a0)
  34898. move.b d3,angle(a0)
  34899. bsr.w Sonic_ResetOnFloor
  34900. move.w #0,y_vel(a0)
  34901. move.w x_vel(a0),inertia(a0)
  34902.  
  34903. return_1B09E:
  34904. rts
  34905. ; End of function Sonic_DoLevelCollision
  34906.  
  34907.  
  34908.  
  34909. ; ---------------------------------------------------------------------------
  34910. ; Subroutine to reset Sonic's mode when he lands on the floor
  34911. ; ---------------------------------------------------------------------------
  34912.  
  34913. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  34914.  
  34915. ; loc_1B0A0:
  34916. Sonic_ResetOnFloor:
  34917. tst.b pinball_mode(a0)
  34918. bne.s Sonic_ResetOnFloor_Part3
  34919. move.b #AniIDSonAni_Walk,anim(a0)
  34920. ; loc_1B0AC:
  34921. Sonic_ResetOnFloor_Part2:
  34922. ; some routines outside of Tails' code can call Sonic_ResetOnFloor_Part2
  34923. ; when they mean to call Tails_ResetOnFloor_Part2, so fix that here
  34924. _cmpi.b #ObjID_Sonic,id(a0) ; is this object ID Sonic (obj01)?
  34925. bne.w Tails_ResetOnFloor_Part2 ; if not, branch to the Tails version of this code
  34926.  
  34927. btst #2,status(a0)
  34928. beq.s Sonic_ResetOnFloor_Part3
  34929. bclr #2,status(a0)
  34930. move.b #$13,y_radius(a0) ; this increases Sonic's collision height to standing
  34931. move.b #9,x_radius(a0)
  34932. move.b #AniIDSonAni_Walk,anim(a0) ; use running/walking/standing animation
  34933. subq.w #5,y_pos(a0) ; move Sonic up 5 pixels so the increased height doesn't push him into the ground
  34934. ; loc_1B0DA:
  34935. Sonic_ResetOnFloor_Part3:
  34936. bclr #1,status(a0)
  34937. bclr #5,status(a0)
  34938. bclr #4,status(a0)
  34939. move.b #0,jumping(a0)
  34940. move.w #0,(Chain_Bonus_counter).w
  34941. move.b #0,flip_angle(a0)
  34942. move.b #0,flip_turned(a0)
  34943. move.b #0,flips_remaining(a0)
  34944. move.w #0,(Sonic_Look_delay_counter).w
  34945. cmpi.b #AniIDSonAni_Hang2,anim(a0)
  34946. bne.s return_1B11E
  34947. move.b #AniIDSonAni_Walk,anim(a0)
  34948.  
  34949. return_1B11E:
  34950. rts
  34951.  
  34952. ; ===========================================================================
  34953. ; ---------------------------------------------------------------------------
  34954. ; Sonic when he gets hurt
  34955. ; ---------------------------------------------------------------------------
  34956. ; loc_1B120: Obj_01_Sub_4:
  34957. Obj01_Hurt:
  34958. tst.w (Debug_mode_flag).w
  34959. beq.s Obj01_Hurt_Normal
  34960. btst #button_B,(Ctrl_1_Press).w
  34961. beq.s Obj01_Hurt_Normal
  34962. move.w #1,(Debug_placement_mode).w
  34963. clr.b (Control_Locked).w
  34964. rts
  34965. ; ---------------------------------------------------------------------------
  34966. ; loc_1B13A:
  34967. Obj01_Hurt_Normal:
  34968. tst.b routine_secondary(a0)
  34969. bmi.w Sonic_HurtInstantRecover
  34970. jsr (ObjectMove).l
  34971. addi.w #$30,y_vel(a0)
  34972. btst #6,status(a0)
  34973. beq.s +
  34974. subi.w #$20,y_vel(a0)
  34975. +
  34976. cmpi.w #-$100,(Camera_Min_Y_pos).w
  34977. bne.s +
  34978. andi.w #$7FF,y_pos(a0)
  34979. +
  34980. bsr.w Sonic_HurtStop
  34981. bsr.w Sonic_LevelBound
  34982. bsr.w Sonic_RecordPos
  34983. bsr.w Sonic_Animate
  34984. bsr.w LoadSonicDynPLC
  34985. jmp (DisplaySprite).l
  34986. ; ===========================================================================
  34987. ; loc_1B184:
  34988. Sonic_HurtStop:
  34989. move.w (Camera_Max_Y_pos_now).w,d0
  34990. addi.w #$E0,d0
  34991. cmp.w y_pos(a0),d0
  34992. blt.w JmpTo_KillCharacter
  34993. bsr.w Sonic_DoLevelCollision
  34994. btst #1,status(a0)
  34995. bne.s return_1B1C8
  34996. moveq #0,d0
  34997. move.w d0,y_vel(a0)
  34998. move.w d0,x_vel(a0)
  34999. move.w d0,inertia(a0)
  35000. move.b d0,obj_control(a0)
  35001. move.b #AniIDSonAni_Walk,anim(a0)
  35002. subq.b #2,routine(a0) ; => Obj01_Control
  35003. move.w #$78,invulnerable_time(a0)
  35004. move.b #0,spindash_flag(a0)
  35005.  
  35006. return_1B1C8:
  35007. rts
  35008. ; ===========================================================================
  35009. ; makes Sonic recover control after being hurt before landing
  35010. ; seems to be unused
  35011. ; loc_1B1CA:
  35012. Sonic_HurtInstantRecover:
  35013. subq.b #2,routine(a0) ; => Obj01_Control
  35014. move.b #0,routine_secondary(a0)
  35015. bsr.w Sonic_RecordPos
  35016. bsr.w Sonic_Animate
  35017. bsr.w LoadSonicDynPLC
  35018. jmp (DisplaySprite).l
  35019. ; ===========================================================================
  35020.  
  35021. ; ---------------------------------------------------------------------------
  35022. ; Sonic when he dies
  35023. ; ...poor Sonic
  35024. ; ---------------------------------------------------------------------------
  35025.  
  35026. ; loc_1B1E6: Obj_01_Sub_6:
  35027. Obj01_Dead:
  35028. tst.w (Debug_mode_flag).w
  35029. beq.s +
  35030. btst #button_B,(Ctrl_1_Press).w
  35031. beq.s +
  35032. move.w #1,(Debug_placement_mode).w
  35033. clr.b (Control_Locked).w
  35034. rts
  35035. +
  35036. bsr.w CheckGameOver
  35037. jsr (ObjectMoveAndFall).l
  35038. bsr.w Sonic_RecordPos
  35039. bsr.w Sonic_Animate
  35040. bsr.w LoadSonicDynPLC
  35041. jmp (DisplaySprite).l
  35042.  
  35043. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  35044.  
  35045. ; loc_1B21C:
  35046. CheckGameOver:
  35047. move.b #1,(Scroll_lock).w
  35048. move.b #0,spindash_flag(a0)
  35049. move.w (Camera_Max_Y_pos_now).w,d0
  35050. addi.w #$100,d0
  35051. cmp.w y_pos(a0),d0
  35052. bge.w return_1B31A
  35053. move.b #8,routine(a0) ; => Obj01_Gone
  35054. move.w #$3C,restart_countdown(a0)
  35055. addq.b #1,(Update_HUD_lives).w ; update lives counter
  35056. subq.b #1,(Life_count).w ; subtract 1 from number of lives
  35057. bne.s Obj01_ResetLevel ; if it's not a game over, branch
  35058. move.w #0,restart_countdown(a0)
  35059. move.b #ObjID_GameOver,(GameOver_GameText+id).w ; load Obj39 (game over text)
  35060. move.b #ObjID_GameOver,(GameOver_OverText+id).w ; load Obj39 (game over text)
  35061. move.b #1,(GameOver_OverText+mapping_frame).w
  35062. move.w a0,(GameOver_GameText+parent).w
  35063. clr.b (Time_Over_flag).w
  35064. ; loc_1B26E:
  35065. Obj01_Finished:
  35066. clr.b (Update_HUD_timer).w
  35067. clr.b (Update_HUD_timer_2P).w
  35068. move.b #8,routine(a0) ; => Obj01_Gone
  35069. move.w #MusID_GameOver,d0
  35070. jsr (PlayMusic).l
  35071. moveq #PLCID_GameOver,d0
  35072. jmp (LoadPLC).l
  35073. ; End of function CheckGameOver
  35074.  
  35075. ; ===========================================================================
  35076. ; ---------------------------------------------------------------------------
  35077. ; Sonic when the level is restarted
  35078. ; ---------------------------------------------------------------------------
  35079. ; loc_1B28E:
  35080. Obj01_ResetLevel:
  35081. tst.b (Time_Over_flag).w
  35082. beq.s Obj01_ResetLevel_Part2
  35083. move.w #0,restart_countdown(a0)
  35084. move.b #ObjID_TimeOver,(TimeOver_TimeText+id).w ; load Obj39
  35085. move.b #ObjID_TimeOver,(TimeOver_OverText+id).w ; load Obj39
  35086. move.b #2,(TimeOver_TimeText+mapping_frame).w
  35087. move.b #3,(TimeOver_OverText+mapping_frame).w
  35088. move.w a0,(TimeOver_TimeText+parent).w
  35089. bra.s Obj01_Finished
  35090. ; ---------------------------------------------------------------------------
  35091. Obj01_ResetLevel_Part2:
  35092. tst.w (Two_player_mode).w
  35093. beq.s return_1B31A
  35094. move.b #0,(Scroll_lock).w
  35095. move.b #$A,routine(a0) ; => Obj01_Respawning
  35096. move.w (Saved_x_pos).w,x_pos(a0)
  35097. move.w (Saved_y_pos).w,y_pos(a0)
  35098. move.w (Saved_art_tile).w,art_tile(a0)
  35099. move.w (Saved_Solid_bits).w,top_solid_bit(a0)
  35100. clr.w (Ring_count).w
  35101. clr.b (Extra_life_flags).w
  35102. move.b #0,obj_control(a0)
  35103. move.b #5,anim(a0)
  35104. move.w #0,x_vel(a0)
  35105. move.w #0,y_vel(a0)
  35106. move.w #0,inertia(a0)
  35107. move.b #2,status(a0)
  35108. move.w #0,move_lock(a0)
  35109. move.w #0,restart_countdown(a0)
  35110.  
  35111. return_1B31A:
  35112. rts
  35113. ; ===========================================================================
  35114. ; ---------------------------------------------------------------------------
  35115. ; Sonic when he's offscreen and waiting for the level to restart
  35116. ; ---------------------------------------------------------------------------
  35117. ; loc_1B31C: Obj_01_Sub_8:
  35118. Obj01_Gone:
  35119. tst.w restart_countdown(a0)
  35120. beq.s +
  35121. subq.w #1,restart_countdown(a0)
  35122. bne.s +
  35123. move.w #1,(Level_Inactive_flag).w
  35124. +
  35125. rts
  35126. ; ===========================================================================
  35127. ; ---------------------------------------------------------------------------
  35128. ; Sonic when he's waiting for the camera to scroll back to where he respawned
  35129. ; ---------------------------------------------------------------------------
  35130. ; loc_1B330: Obj_01_Sub_A:
  35131. Obj01_Respawning:
  35132. tst.w (Camera_X_pos_diff).w
  35133. bne.s +
  35134. tst.w (Camera_Y_pos_diff).w
  35135. bne.s +
  35136. move.b #2,routine(a0) ; => Obj01_Control
  35137. +
  35138. bsr.w Sonic_Animate
  35139. bsr.w LoadSonicDynPLC
  35140. jmp (DisplaySprite).l
  35141. ; ===========================================================================
  35142.  
  35143. ; ---------------------------------------------------------------------------
  35144. ; Subroutine to animate Sonic's sprites
  35145. ; See also: AnimateSprite
  35146. ; ---------------------------------------------------------------------------
  35147.  
  35148. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  35149.  
  35150. ; loc_1B350:
  35151. Sonic_Animate:
  35152. lea (SonicAniData).l,a1
  35153. tst.b (Super_Sonic_flag).w
  35154. beq.s +
  35155. lea (SuperSonicAniData).l,a1
  35156. +
  35157. moveq #0,d0
  35158. move.b anim(a0),d0
  35159. cmp.b next_anim(a0),d0 ; has animation changed?
  35160. beq.s SAnim_Do ; if not, branch
  35161. move.b d0,next_anim(a0) ; set to next animation
  35162. move.b #0,anim_frame(a0) ; reset animation frame
  35163. move.b #0,anim_frame_duration(a0) ; reset frame duration
  35164. bclr #5,status(a0)
  35165. ; loc_1B384:
  35166. SAnim_Do:
  35167. add.w d0,d0
  35168. adda.w (a1,d0.w),a1 ; calculate address of appropriate animation script
  35169. move.b (a1),d0
  35170. bmi.s SAnim_WalkRun ; if animation is walk/run/roll/jump, branch
  35171. move.b status(a0),d1
  35172. andi.b #1,d1
  35173. andi.b #$FC,render_flags(a0)
  35174. or.b d1,render_flags(a0)
  35175. subq.b #1,anim_frame_duration(a0) ; subtract 1 from frame duration
  35176. bpl.s SAnim_Delay ; if time remains, branch
  35177. move.b d0,anim_frame_duration(a0) ; load frame duration
  35178. ; loc_1B3AA:
  35179. SAnim_Do2:
  35180. moveq #0,d1
  35181. move.b anim_frame(a0),d1 ; load current frame number
  35182. move.b 1(a1,d1.w),d0 ; read sprite number from script
  35183. cmpi.b #$F0,d0
  35184. bhs.s SAnim_End_FF ; if animation is complete, branch
  35185. ; loc_1B3BA:
  35186. SAnim_Next:
  35187. move.b d0,mapping_frame(a0) ; load sprite number
  35188. addq.b #1,anim_frame(a0) ; go to next frame
  35189. ; return_1B3C2:
  35190. SAnim_Delay:
  35191. rts
  35192. ; ===========================================================================
  35193. ; loc_1B3C4:
  35194. SAnim_End_FF:
  35195. addq.b #1,d0 ; is the end flag = $FF ?
  35196. bne.s SAnim_End_FE ; if not, branch
  35197. move.b #0,anim_frame(a0) ; restart the animation
  35198. move.b 1(a1),d0 ; read sprite number
  35199. bra.s SAnim_Next
  35200. ; ===========================================================================
  35201. ; loc_1B3D4:
  35202. SAnim_End_FE:
  35203. addq.b #1,d0 ; is the end flag = $FE ?
  35204. bne.s SAnim_End_FD ; if not, branch
  35205. move.b 2(a1,d1.w),d0 ; read the next byte in the script
  35206. sub.b d0,anim_frame(a0) ; jump back d0 bytes in the script
  35207. sub.b d0,d1
  35208. move.b 1(a1,d1.w),d0 ; read sprite number
  35209. bra.s SAnim_Next
  35210. ; ===========================================================================
  35211. ; loc_1B3E8:
  35212. SAnim_End_FD:
  35213. addq.b #1,d0 ; is the end flag = $FD ?
  35214. bne.s SAnim_End ; if not, branch
  35215. move.b 2(a1,d1.w),anim(a0) ; read next byte, run that animation
  35216. ; return_1B3F2:
  35217. SAnim_End:
  35218. rts
  35219. ; ===========================================================================
  35220. ; loc_1B3F4:
  35221. SAnim_WalkRun:
  35222. addq.b #1,d0 ; is the start flag = $FF ?
  35223. bne.w SAnim_Roll ; if not, branch
  35224. moveq #0,d0 ; is animation walking/running?
  35225. move.b flip_angle(a0),d0 ; if not, branch
  35226. bne.w SAnim_Tumble
  35227. moveq #0,d1
  35228. move.b angle(a0),d0 ; get Sonic's angle
  35229. bmi.s +
  35230. beq.s +
  35231. subq.b #1,d0
  35232. +
  35233. move.b status(a0),d2
  35234. andi.b #1,d2 ; is Sonic mirrored horizontally?
  35235. bne.s + ; if yes, branch
  35236. not.b d0 ; reverse angle
  35237. +
  35238. addi.b #$10,d0 ; add $10 to angle
  35239. bpl.s + ; if angle is $0-$7F, branch
  35240. moveq #3,d1
  35241. +
  35242. andi.b #$FC,render_flags(a0)
  35243. eor.b d1,d2
  35244. or.b d2,render_flags(a0)
  35245. btst #5,status(a0)
  35246. bne.w SAnim_Push
  35247. lsr.b #4,d0 ; divide angle by 16
  35248. andi.b #6,d0 ; angle must be 0, 2, 4 or 6
  35249. mvabs.w inertia(a0),d2 ; get Sonic's "speed" for animation purposes
  35250. if status_sec_isSliding = 7
  35251. tst.b status_secondary(a0)
  35252. bpl.w +
  35253. else
  35254. btst #status_sec_isSliding,status_secondary(a0)
  35255. beq.w +
  35256. endif
  35257. add.w d2,d2
  35258. +
  35259. tst.b (Super_Sonic_flag).w
  35260. bne.s SAnim_Super
  35261. lea (SonAni_Run).l,a1 ; use running animation
  35262. cmpi.w #$600,d2 ; is Sonic at running speed?
  35263. bhs.s + ; use running animation
  35264. lea (SonAni_Walk).l,a1 ; if yes, branch
  35265. add.b d0,d0
  35266. +
  35267. add.b d0,d0
  35268. move.b d0,d3
  35269. moveq #0,d1
  35270. move.b anim_frame(a0),d1
  35271. move.b 1(a1,d1.w),d0
  35272. cmpi.b #-1,d0
  35273. bne.s +
  35274. move.b #0,anim_frame(a0)
  35275. move.b 1(a1),d0
  35276. +
  35277. move.b d0,mapping_frame(a0)
  35278. add.b d3,mapping_frame(a0)
  35279. subq.b #1,anim_frame_duration(a0)
  35280. bpl.s return_1B4AC
  35281. neg.w d2
  35282. addi.w #$800,d2
  35283. bpl.s +
  35284. moveq #0,d2
  35285. +
  35286. lsr.w #8,d2
  35287. move.b d2,anim_frame_duration(a0) ; modify frame duration
  35288. addq.b #1,anim_frame(a0) ; modify frame number
  35289.  
  35290. return_1B4AC:
  35291. rts
  35292. ; ===========================================================================
  35293. ; loc_1B4AE:
  35294. SAnim_Super:
  35295. lea (SupSonAni_Run).l,a1 ; use fast animation
  35296. cmpi.w #$800,d2 ; is Sonic moving fast?
  35297. bhs.s SAnim_SuperRun ; if yes, branch
  35298. lea (SupSonAni_Walk).l,a1 ; use slower animation
  35299. add.b d0,d0
  35300. add.b d0,d0
  35301. bra.s SAnim_SuperWalk
  35302. ; ---------------------------------------------------------------------------
  35303. ; loc_1B4C6:
  35304. SAnim_SuperRun:
  35305. lsr.b #1,d0
  35306. ; loc_1B4C8:
  35307. SAnim_SuperWalk:
  35308. move.b d0,d3
  35309. moveq #0,d1
  35310. move.b anim_frame(a0),d1
  35311. move.b 1(a1,d1.w),d0
  35312. cmpi.b #-1,d0
  35313. bne.s +
  35314. move.b #0,anim_frame(a0)
  35315. move.b 1(a1),d0
  35316. +
  35317. move.b d0,mapping_frame(a0)
  35318. add.b d3,mapping_frame(a0)
  35319. move.b (Timer_frames+1).w,d1
  35320. andi.b #3,d1
  35321. bne.s +
  35322. cmpi.b #$B5,mapping_frame(a0)
  35323. bhs.s +
  35324. addi.b #$20,mapping_frame(a0)
  35325. +
  35326. subq.b #1,anim_frame_duration(a0)
  35327. bpl.s return_1B51E
  35328. neg.w d2
  35329. addi.w #$800,d2
  35330. bpl.s +
  35331. moveq #0,d2
  35332. +
  35333. lsr.w #8,d2
  35334. move.b d2,anim_frame_duration(a0)
  35335. addq.b #1,anim_frame(a0)
  35336.  
  35337. return_1B51E:
  35338. rts
  35339. ; ===========================================================================
  35340. ; loc_1B520:
  35341. SAnim_Tumble:
  35342. move.b flip_angle(a0),d0
  35343. moveq #0,d1
  35344. move.b status(a0),d2
  35345. andi.b #1,d2
  35346. bne.s SAnim_Tumble_Left
  35347.  
  35348. andi.b #$FC,render_flags(a0)
  35349. addi.b #$B,d0
  35350. divu.w #$16,d0
  35351. addi.b #$5F,d0
  35352. move.b d0,mapping_frame(a0)
  35353. move.b #0,anim_frame_duration(a0)
  35354. rts
  35355. ; ===========================================================================
  35356. ; loc_1B54E:
  35357. SAnim_Tumble_Left:
  35358. andi.b #$FC,render_flags(a0)
  35359. tst.b flip_turned(a0)
  35360. beq.s loc_1B566
  35361. ori.b #1,render_flags(a0)
  35362. addi.b #$B,d0
  35363. bra.s loc_1B572
  35364. ; ===========================================================================
  35365.  
  35366. loc_1B566:
  35367. ori.b #3,render_flags(a0)
  35368. neg.b d0
  35369. addi.b #$8F,d0
  35370.  
  35371. loc_1B572:
  35372. divu.w #$16,d0
  35373. addi.b #$5F,d0
  35374. move.b d0,mapping_frame(a0)
  35375. move.b #0,anim_frame_duration(a0)
  35376. rts
  35377. ; ===========================================================================
  35378. ; loc_1B586:
  35379. SAnim_Roll:
  35380. subq.b #1,anim_frame_duration(a0) ; subtract 1 from frame duration
  35381. bpl.w SAnim_Delay ; if time remains, branch
  35382. addq.b #1,d0 ; is the start flag = $FE ?
  35383. bne.s SAnim_Push ; if not, branch
  35384. mvabs.w inertia(a0),d2
  35385. lea (SonAni_Roll2).l,a1
  35386. cmpi.w #$600,d2
  35387. bhs.s +
  35388. lea (SonAni_Roll).l,a1
  35389. +
  35390. neg.w d2
  35391. addi.w #$400,d2
  35392. bpl.s +
  35393. moveq #0,d2
  35394. +
  35395. lsr.w #8,d2
  35396. move.b d2,anim_frame_duration(a0)
  35397. move.b status(a0),d1
  35398. andi.b #1,d1
  35399. andi.b #$FC,render_flags(a0)
  35400. or.b d1,render_flags(a0)
  35401. bra.w SAnim_Do2
  35402. ; ===========================================================================
  35403.  
  35404. SAnim_Push:
  35405. subq.b #1,anim_frame_duration(a0) ; subtract 1 from frame duration
  35406. bpl.w SAnim_Delay ; if time remains, branch
  35407. move.w inertia(a0),d2
  35408. bmi.s +
  35409. neg.w d2
  35410. +
  35411. addi.w #$800,d2
  35412. bpl.s +
  35413. moveq #0,d2
  35414. +
  35415. lsr.w #6,d2
  35416. move.b d2,anim_frame_duration(a0)
  35417. lea (SonAni_Push).l,a1
  35418. tst.b (Super_Sonic_flag).w
  35419. beq.s +
  35420. lea (SupSonAni_Push).l,a1
  35421. +
  35422. move.b status(a0),d1
  35423. andi.b #1,d1
  35424. andi.b #$FC,render_flags(a0)
  35425. or.b d1,render_flags(a0)
  35426. bra.w SAnim_Do2
  35427. ; ===========================================================================
  35428.  
  35429. ; ---------------------------------------------------------------------------
  35430. ; Animation script - Sonic
  35431. ; ---------------------------------------------------------------------------
  35432. ; off_1B618:
  35433. SonicAniData: offsetTable
  35434. SonAni_Walk_ptr: offsetTableEntry.w SonAni_Walk ; 0 ; 0
  35435. SonAni_Run_ptr: offsetTableEntry.w SonAni_Run ; 1 ; 1
  35436. SonAni_Roll_ptr: offsetTableEntry.w SonAni_Roll ; 2 ; 2
  35437. SonAni_Roll2_ptr: offsetTableEntry.w SonAni_Roll2 ; 3 ; 3
  35438. SonAni_Push_ptr: offsetTableEntry.w SonAni_Push ; 4 ; 4
  35439. SonAni_Wait_ptr: offsetTableEntry.w SonAni_Wait ; 5 ; 5
  35440. SonAni_Balance_ptr: offsetTableEntry.w SonAni_Balance ; 6 ; 6
  35441. SonAni_LookUp_ptr: offsetTableEntry.w SonAni_LookUp ; 7 ; 7
  35442. SonAni_Duck_ptr: offsetTableEntry.w SonAni_Duck ; 8 ; 8
  35443. SonAni_Spindash_ptr: offsetTableEntry.w SonAni_Spindash ; 9 ; 9
  35444. SonAni_Blink_ptr: offsetTableEntry.w SonAni_Blink ; 10 ; $A
  35445. SonAni_GetUp_ptr: offsetTableEntry.w SonAni_GetUp ; 11 ; $B
  35446. SonAni_Balance2_ptr: offsetTableEntry.w SonAni_Balance2 ; 12 ; $C
  35447. SonAni_Stop_ptr: offsetTableEntry.w SonAni_Stop ; 13 ; $D
  35448. SonAni_Float_ptr: offsetTableEntry.w SonAni_Float ; 14 ; $E
  35449. SonAni_Float2_ptr: offsetTableEntry.w SonAni_Float2 ; 15 ; $F
  35450. SonAni_Spring_ptr: offsetTableEntry.w SonAni_Spring ; 16 ; $10
  35451. SonAni_Hang_ptr: offsetTableEntry.w SonAni_Hang ; 17 ; $11
  35452. SonAni_Dash2_ptr: offsetTableEntry.w SonAni_Dash2 ; 18 ; $12
  35453. SonAni_Dash3_ptr: offsetTableEntry.w SonAni_Dash3 ; 19 ; $13
  35454. SonAni_Hang2_ptr: offsetTableEntry.w SonAni_Hang2 ; 20 ; $14
  35455. SonAni_Bubble_ptr: offsetTableEntry.w SonAni_Bubble ; 21 ; $15
  35456. SonAni_DeathBW_ptr: offsetTableEntry.w SonAni_DeathBW ; 22 ; $16
  35457. SonAni_Drown_ptr: offsetTableEntry.w SonAni_Drown ; 23 ; $17
  35458. SonAni_Death_ptr: offsetTableEntry.w SonAni_Death ; 24 ; $18
  35459. SonAni_Hurt_ptr: offsetTableEntry.w SonAni_Hurt ; 25 ; $19
  35460. SonAni_Hurt2_ptr: offsetTableEntry.w SonAni_Hurt ; 26 ; $1A
  35461. SonAni_Slide_ptr: offsetTableEntry.w SonAni_Slide ; 27 ; $1B
  35462. SonAni_Blank_ptr: offsetTableEntry.w SonAni_Blank ; 28 ; $1C
  35463. SonAni_Balance3_ptr: offsetTableEntry.w SonAni_Balance3 ; 29 ; $1D
  35464. SonAni_Balance4_ptr: offsetTableEntry.w SonAni_Balance4 ; 30 ; $1E
  35465. SupSonAni_Transform_ptr: offsetTableEntry.w SupSonAni_Transform ; 31 ; $1F
  35466. SonAni_Lying_ptr: offsetTableEntry.w SonAni_Lying ; 32 ; $20
  35467. SonAni_LieDown_ptr: offsetTableEntry.w SonAni_LieDown ; 33 ; $21
  35468.  
  35469. SonAni_Walk: dc.b $FF, $F,$10,$11,$12,$13,$14, $D, $E,$FF
  35470. rev02even
  35471. SonAni_Run: dc.b $FF,$2D,$2E,$2F,$30,$FF,$FF,$FF,$FF,$FF
  35472. rev02even
  35473. SonAni_Roll: dc.b $FE,$3D,$41,$3E,$41,$3F,$41,$40,$41,$FF
  35474. rev02even
  35475. SonAni_Roll2: dc.b $FE,$3D,$41,$3E,$41,$3F,$41,$40,$41,$FF
  35476. rev02even
  35477. SonAni_Push: dc.b $FD,$48,$49,$4A,$4B,$FF,$FF,$FF,$FF,$FF
  35478. rev02even
  35479. SonAni_Wait:
  35480. dc.b 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
  35481. dc.b 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2
  35482. dc.b 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 4, 4, 4, 5, 5
  35483. dc.b 5, 4, 4, 4, 5, 5, 5, 4, 4, 4, 5, 5, 5, 6, 6, 6
  35484. dc.b 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 5, 5, 5, 4, 4, 4
  35485. dc.b 5, 5, 5, 4, 4, 4, 5, 5, 5, 4, 4, 4, 5, 5, 5, 6
  35486. dc.b 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 5, 5, 5, 4
  35487. dc.b 4, 4, 5, 5, 5, 4, 4, 4, 5, 5, 5, 4, 4, 4, 5, 5
  35488. dc.b 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 5, 5
  35489. dc.b 5, 4, 4, 4, 5, 5, 5, 4, 4, 4, 5, 5, 5, 4, 4, 4
  35490. dc.b 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 8, 8
  35491. dc.b 8, 9, 9, 9,$FE, 6
  35492. rev02even
  35493. SonAni_Balance: dc.b 9,$CC,$CD,$CE,$CD,$FF
  35494. rev02even
  35495. SonAni_LookUp: dc.b 5, $B, $C,$FE, 1
  35496. rev02even
  35497. SonAni_Duck: dc.b 5,$4C,$4D,$FE, 1
  35498. rev02even
  35499. SonAni_Spindash:dc.b 0,$42,$43,$42,$44,$42,$45,$42,$46,$42,$47,$FF
  35500. rev02even
  35501. SonAni_Blink: dc.b 1, 2,$FD, 0
  35502. rev02even
  35503. SonAni_GetUp: dc.b 3, $A,$FD, 0
  35504. rev02even
  35505. SonAni_Balance2:dc.b 3,$C8,$C9,$CA,$CB,$FF
  35506. rev02even
  35507. SonAni_Stop: dc.b 5,$D2,$D3,$D4,$D5,$FD, 0 ; halt/skidding animation
  35508. rev02even
  35509. SonAni_Float: dc.b 7,$54,$59,$FF
  35510. rev02even
  35511. SonAni_Float2: dc.b 7,$54,$55,$56,$57,$58,$FF
  35512. rev02even
  35513. SonAni_Spring: dc.b $2F,$5B,$FD, 0
  35514. rev02even
  35515. SonAni_Hang: dc.b 1,$50,$51,$FF
  35516. rev02even
  35517. SonAni_Dash2: dc.b $F,$43,$43,$43,$FE, 1
  35518. rev02even
  35519. SonAni_Dash3: dc.b $F,$43,$44,$FE, 1
  35520. rev02even
  35521. SonAni_Hang2: dc.b $13,$6B,$6C,$FF
  35522. rev02even
  35523. SonAni_Bubble: dc.b $B,$5A,$5A,$11,$12,$FD, 0 ; breathe
  35524. rev02even
  35525. SonAni_DeathBW: dc.b $20,$5E,$FF
  35526. rev02even
  35527. SonAni_Drown: dc.b $20,$5D,$FF
  35528. rev02even
  35529. SonAni_Death: dc.b $20,$5C,$FF
  35530. rev02even
  35531. SonAni_Hurt: dc.b $40,$4E,$FF
  35532. rev02even
  35533. SonAni_Slide: dc.b 9,$4E,$4F,$FF
  35534. rev02even
  35535. SonAni_Blank: dc.b $77, 0,$FD, 0
  35536. rev02even
  35537. SonAni_Balance3:dc.b $13,$D0,$D1,$FF
  35538. rev02even
  35539. SonAni_Balance4:dc.b 3,$CF,$C8,$C9,$CA,$CB,$FE, 4
  35540. rev02even
  35541. SonAni_Lying: dc.b 9, 8, 9,$FF
  35542. rev02even
  35543. SonAni_LieDown: dc.b 3, 7,$FD, 0
  35544. even
  35545.  
  35546. ; ---------------------------------------------------------------------------
  35547. ; Animation script - Super Sonic
  35548. ; (many of these point to the data above this)
  35549. ; ---------------------------------------------------------------------------
  35550. SuperSonicAniData: offsetTable
  35551. offsetTableEntry.w SupSonAni_Walk ; 0 ; 0
  35552. offsetTableEntry.w SupSonAni_Run ; 1 ; 1
  35553. offsetTableEntry.w SonAni_Roll ; 2 ; 2
  35554. offsetTableEntry.w SonAni_Roll2 ; 3 ; 3
  35555. offsetTableEntry.w SupSonAni_Push ; 4 ; 4
  35556. offsetTableEntry.w SupSonAni_Stand ; 5 ; 5
  35557. offsetTableEntry.w SupSonAni_Balance ; 6 ; 6
  35558. offsetTableEntry.w SonAni_LookUp ; 7 ; 7
  35559. offsetTableEntry.w SupSonAni_Duck ; 8 ; 8
  35560. offsetTableEntry.w SonAni_Spindash ; 9 ; 9
  35561. offsetTableEntry.w SonAni_Blink ; 10 ; $A
  35562. offsetTableEntry.w SonAni_GetUp ; 11 ; $B
  35563. offsetTableEntry.w SonAni_Balance2 ; 12 ; $C
  35564. offsetTableEntry.w SonAni_Stop ; 13 ; $D
  35565. offsetTableEntry.w SonAni_Float ; 14 ; $E
  35566. offsetTableEntry.w SonAni_Float2 ; 15 ; $F
  35567. offsetTableEntry.w SonAni_Spring ; 16 ; $10
  35568. offsetTableEntry.w SonAni_Hang ; 17 ; $11
  35569. offsetTableEntry.w SonAni_Dash2 ; 18 ; $12
  35570. offsetTableEntry.w SonAni_Dash3 ; 19 ; $13
  35571. offsetTableEntry.w SonAni_Hang2 ; 20 ; $14
  35572. offsetTableEntry.w SonAni_Bubble ; 21 ; $15
  35573. offsetTableEntry.w SonAni_DeathBW ; 22 ; $16
  35574. offsetTableEntry.w SonAni_Drown ; 23 ; $17
  35575. offsetTableEntry.w SonAni_Death ; 24 ; $18
  35576. offsetTableEntry.w SonAni_Hurt ; 25 ; $19
  35577. offsetTableEntry.w SonAni_Hurt ; 26 ; $1A
  35578. offsetTableEntry.w SonAni_Slide ; 27 ; $1B
  35579. offsetTableEntry.w SonAni_Blank ; 28 ; $1C
  35580. offsetTableEntry.w SonAni_Balance3 ; 29 ; $1D
  35581. offsetTableEntry.w SonAni_Balance4 ; 30 ; $1E
  35582. offsetTableEntry.w SupSonAni_Transform ; 31 ; $1F
  35583.  
  35584. SupSonAni_Walk: dc.b $FF,$77,$78,$79,$7A,$7B,$7C,$75,$76,$FF
  35585. rev02even
  35586. SupSonAni_Run: dc.b $FF,$B5,$B9,$FF,$FF,$FF,$FF,$FF,$FF,$FF
  35587. rev02even
  35588. SupSonAni_Push: dc.b $FD,$BD,$BE,$BF,$C0,$FF,$FF,$FF,$FF,$FF
  35589. rev02even
  35590. SupSonAni_Stand: dc.b 7,$72,$73,$74,$73,$FF
  35591. rev02even
  35592. SupSonAni_Balance: dc.b 9,$C2,$C3,$C4,$C3,$C5,$C6,$C7,$C6,$FF
  35593. rev02even
  35594. SupSonAni_Duck: dc.b 5,$C1,$FF
  35595. rev02even
  35596. SupSonAni_Transform: dc.b 2,$6D,$6D,$6E,$6E,$6F,$70,$71,$70,$71,$70,$71,$70,$71,$FD, 0
  35597. even
  35598.  
  35599. ; ---------------------------------------------------------------------------
  35600. ; Sonic pattern loading subroutine
  35601. ; ---------------------------------------------------------------------------
  35602.  
  35603. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  35604.  
  35605. ; loc_1B848:
  35606. LoadSonicDynPLC:
  35607.  
  35608. moveq #0,d0
  35609. move.b mapping_frame(a0),d0 ; load frame number
  35610. ; loc_1B84E:
  35611. LoadSonicDynPLC_Part2:
  35612. cmp.b (Sonic_LastLoadedDPLC).w,d0
  35613. beq.s return_1B89A
  35614. move.b d0,(Sonic_LastLoadedDPLC).w
  35615. lea (MapRUnc_Sonic).l,a2
  35616. add.w d0,d0
  35617. adda.w (a2,d0.w),a2
  35618. move.w (a2)+,d5
  35619. subq.w #1,d5
  35620. bmi.s return_1B89A
  35621. move.w #tiles_to_bytes(ArtTile_ArtUnc_Sonic),d4
  35622. ; loc_1B86E:
  35623. SPLC_ReadEntry:
  35624. moveq #0,d1
  35625. move.w (a2)+,d1
  35626. move.w d1,d3
  35627. lsr.w #8,d3
  35628. andi.w #$F0,d3
  35629. addi.w #$10,d3
  35630. andi.w #$FFF,d1
  35631. lsl.l #5,d1
  35632. addi.l #ArtUnc_Sonic,d1
  35633. move.w d4,d2
  35634. add.w d3,d4
  35635. add.w d3,d4
  35636. jsr (QueueDMATransfer).l
  35637. dbf d5,SPLC_ReadEntry ; repeat for number of entries
  35638.  
  35639. return_1B89A:
  35640. rts
  35641. ; ===========================================================================
  35642.  
  35643. JmpTo_KillCharacter
  35644. jmp (KillCharacter).l
  35645.  
  35646. if ~~removeJmpTos
  35647. align 4
  35648. endif
  35649.  
  35650.  
  35651.  
  35652.  
  35653. ; ===========================================================================
  35654. ; ----------------------------------------------------------------------------
  35655. ; Object 02 - Tails
  35656. ; ----------------------------------------------------------------------------
  35657. ; Sprite_1B8A4: Object_Tails:
  35658. Obj02:
  35659. ; a0=character
  35660. cmpi.w #2,(Player_mode).w
  35661. bne.s +
  35662. move.w (Camera_Min_X_pos).w,(Tails_Min_X_pos).w
  35663. move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w
  35664. move.w (Camera_Max_Y_pos_now).w,(Tails_Max_Y_pos).w
  35665. +
  35666. moveq #0,d0
  35667. move.b routine(a0),d0
  35668. move.w Obj02_Index(pc,d0.w),d1
  35669. jmp Obj02_Index(pc,d1.w)
  35670. ; ===========================================================================
  35671. ; off_1B8CC: Obj02_States:
  35672. Obj02_Index: offsetTable
  35673. offsetTableEntry.w Obj02_Init ; 0
  35674. offsetTableEntry.w Obj02_Control ; 2
  35675. offsetTableEntry.w Obj02_Hurt ; 4
  35676. offsetTableEntry.w Obj02_Dead ; 6
  35677. offsetTableEntry.w Obj02_Gone ; 8
  35678. offsetTableEntry.w Obj02_Respawning ; $A
  35679. ; ===========================================================================
  35680. ; loc_1B8D8: Obj02_Main:
  35681. Obj02_Init:
  35682. addq.b #2,routine(a0) ; => Obj02_Normal
  35683. move.b #$F,y_radius(a0) ; this sets Tails' collision height (2*pixels) to less than Sonic's height
  35684. move.b #9,x_radius(a0)
  35685. move.l #MapUnc_Tails,mappings(a0)
  35686. move.b #2,priority(a0)
  35687. move.b #$18,width_pixels(a0)
  35688. move.b #$84,render_flags(a0) ; render_flags(Tails) = $80 | initial render_flags(Sonic)
  35689. move.w #$600,(Tails_top_speed).w ; set Tails' top speed
  35690. move.w #$C,(Tails_acceleration).w ; set Tails' acceleration
  35691. move.w #$80,(Tails_deceleration).w ; set Tails' deceleration
  35692. cmpi.w #2,(Player_mode).w
  35693. bne.s Obj02_Init_2Pmode
  35694. tst.b (Last_star_pole_hit).w
  35695. bne.s Obj02_Init_Continued
  35696. ; only happens when not starting at a checkpoint:
  35697. move.w #make_art_tile(ArtTile_ArtUnc_Tails,0,0),art_tile(a0)
  35698. bsr.w Adjust2PArtPointer
  35699. move.b #$C,top_solid_bit(a0)
  35700. move.b #$D,lrb_solid_bit(a0)
  35701. move.w x_pos(a0),(Saved_x_pos).w
  35702. move.w y_pos(a0),(Saved_y_pos).w
  35703. move.w art_tile(a0),(Saved_art_tile).w
  35704. move.w top_solid_bit(a0),(Saved_Solid_bits).w
  35705. bra.s Obj02_Init_Continued
  35706. ; ===========================================================================
  35707. ; loc_1B952:
  35708. Obj02_Init_2Pmode:
  35709. move.w #make_art_tile(ArtTile_ArtUnc_Tails,0,0),art_tile(a0)
  35710. bsr.w Adjust2PArtPointer
  35711. move.w (MainCharacter+top_solid_bit).w,top_solid_bit(a0)
  35712. tst.w (MainCharacter+art_tile).w
  35713. bpl.s Obj02_Init_Continued
  35714. ori.w #high_priority,art_tile(a0)
  35715. ; loc_1B96E:
  35716. Obj02_Init_Continued:
  35717. move.w x_pos(a0),(Saved_x_pos_2P).w
  35718. move.w y_pos(a0),(Saved_y_pos_2P).w
  35719. move.w art_tile(a0),(Saved_art_tile_2P).w
  35720. move.w top_solid_bit(a0),(Saved_Solid_bits_2P).w
  35721. move.b #0,flips_remaining(a0)
  35722. move.b #4,flip_speed(a0)
  35723. move.b #$1E,air_left(a0)
  35724. move.w #0,(Tails_CPU_routine).w ; set AI state to TailsCPU_Init
  35725. move.w #0,(Tails_control_counter).w
  35726. move.w #0,(Tails_respawn_counter).w
  35727. move.b #ObjID_TailsTails,(Tails_Tails+id).w ; load Obj05 (Tails' Tails) at $FFFFD000
  35728. move.w a0,(Tails_Tails+parent).w ; set its parent object to this
  35729.  
  35730. ; ---------------------------------------------------------------------------
  35731. ; Normal state for Tails
  35732. ; ---------------------------------------------------------------------------
  35733. ; loc_1B9B4:
  35734. Obj02_Control:
  35735. cmpa.w #MainCharacter,a0
  35736. bne.s Obj02_Control_Joypad2
  35737. move.w (Ctrl_1_Logical).w,(Ctrl_2_Logical).w
  35738. tst.b (Control_Locked).w ; are controls locked?
  35739. bne.s Obj02_Control_Part2 ; if yes, branch
  35740. move.w (Ctrl_1).w,(Ctrl_2_Logical).w ; copy new held buttons, to enable joypad control
  35741. move.w (Ctrl_1).w,(Ctrl_1_Logical).w
  35742. bra.s Obj02_Control_Part2
  35743. ; ---------------------------------------------------------------------------
  35744. ; loc_1B9D4:
  35745. Obj02_Control_Joypad2:
  35746. tst.b (Control_Locked_P2).w
  35747. bne.s +
  35748. move.w (Ctrl_2).w,(Ctrl_2_Logical).w
  35749. +
  35750. tst.w (Two_player_mode).w
  35751. bne.s Obj02_Control_Part2
  35752. bsr.w TailsCPU_Control
  35753. ; loc_1B9EA:
  35754. Obj02_Control_Part2:
  35755. btst #0,obj_control(a0) ; is Tails flying, or interacting with another object that holds him in place or controls his movement somehow?
  35756. bne.s + ; if yes, branch to skip Tails' control
  35757. moveq #0,d0
  35758. move.b status(a0),d0
  35759. andi.w #6,d0 ; %0000 %0110
  35760. move.w Obj02_Modes(pc,d0.w),d1
  35761. jsr Obj02_Modes(pc,d1.w) ; run Tails' movement control code
  35762. +
  35763. cmpi.w #-$100,(Camera_Min_Y_pos).w ; is vertical wrapping enabled?
  35764. bne.s + ; if not, branch
  35765. andi.w #$7FF,y_pos(a0) ; perform wrapping of Sonic's y position
  35766. +
  35767. bsr.s Tails_Display
  35768. bsr.w Tails_RecordPos
  35769. bsr.w Tails_Water
  35770. move.b (Primary_Angle).w,next_tilt(a0)
  35771. move.b (Secondary_Angle).w,tilt(a0)
  35772. tst.b (WindTunnel_flag).w
  35773. beq.s +
  35774. tst.b anim(a0)
  35775. bne.s +
  35776. move.b next_anim(a0),anim(a0)
  35777. +
  35778. bsr.w Tails_Animate
  35779. tst.b obj_control(a0)
  35780. bmi.s +
  35781. jsr (TouchResponse).l
  35782. +
  35783. bra.w LoadTailsDynPLC
  35784.  
  35785. ; ===========================================================================
  35786. ; secondary states under state Obj02_Normal
  35787. ; off_1BA4E:
  35788. Obj02_Modes: offsetTable
  35789. offsetTableEntry.w Obj02_MdNormal ; 0 - not airborne or rolling
  35790. offsetTableEntry.w Obj02_MdAir ; 2 - airborne
  35791. offsetTableEntry.w Obj02_MdRoll ; 4 - rolling
  35792. offsetTableEntry.w Obj02_MdJump ; 6 - jumping
  35793. ; ===========================================================================
  35794.  
  35795. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  35796.  
  35797. ; loc_1BA56:
  35798. Tails_Display:
  35799. move.w invulnerable_time(a0),d0
  35800. beq.s Obj02_Display
  35801. subq.w #1,invulnerable_time(a0)
  35802. lsr.w #3,d0
  35803. bcc.s Obj02_ChkInvinc
  35804. ; loc_1BA64:
  35805. Obj02_Display:
  35806. jsr (DisplaySprite).l
  35807. ; loc_1BA6A:
  35808. Obj02_ChkInvinc: ; Checks if invincibility has expired and disables it if it has.
  35809. btst #status_sec_isInvincible,status_secondary(a0)
  35810. beq.s Obj02_ChkShoes
  35811. tst.w invincibility_time(a0)
  35812. beq.s Obj02_ChkShoes
  35813. subq.w #1,invincibility_time(a0)
  35814. bne.s Obj02_ChkShoes
  35815. tst.b (Current_Boss_ID).w ; Don't change music if in a boss fight
  35816. bne.s Obj02_RmvInvin
  35817. cmpi.b #$C,air_left(a0) ; Don't change music if drowning
  35818. blo.s Obj02_RmvInvin
  35819. move.w (Level_Music).w,d0
  35820. jsr (PlayMusic).l
  35821. ; loc_1BA96:
  35822. Obj02_RmvInvin:
  35823. bclr #status_sec_isInvincible,status_secondary(a0)
  35824. ; loc_1BA9C:
  35825. Obj02_ChkShoes: ; Checks if Speed Shoes have expired and disables them if they have.
  35826. btst #status_sec_hasSpeedShoes,status_secondary(a0)
  35827. beq.s Obj02_ExitChk
  35828. tst.w speedshoes_time(a0)
  35829. beq.s Obj02_ExitChk
  35830. subq.w #1,speedshoes_time(a0)
  35831. bne.s Obj02_ExitChk
  35832. move.w #$600,(Tails_top_speed).w
  35833. move.w #$C,(Tails_acceleration).w
  35834. move.w #$80,(Tails_deceleration).w
  35835. ; Obj02_RmvSpeed:
  35836. bclr #status_sec_hasSpeedShoes,status_secondary(a0)
  35837. move.w #MusID_SlowDown,d0 ; Slow down tempo
  35838. jmp (PlayMusic).l
  35839. ; ===========================================================================
  35840. ; return_1BAD2:
  35841. Obj02_ExitChk:
  35842. rts
  35843. ; End of subroutine Tails_Display
  35844.  
  35845.  
  35846. ; ---------------------------------------------------------------------------
  35847. ; Tails' AI code for the Sonic and Tails mode 1-player game
  35848. ; ---------------------------------------------------------------------------
  35849.  
  35850. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  35851.  
  35852. ; loc_1BAD4:
  35853. TailsCPU_Control: ; a0=Tails
  35854. move.b (Ctrl_2_Held).w,d0 ; did the real player 2 hit something?
  35855. andi.b #button_up_mask|button_down_mask|button_left_mask|button_right_mask|button_B_mask|button_C_mask|button_A_mask,d0
  35856. beq.s + ; if not, branch
  35857. move.w #600,(Tails_control_counter).w ; give player 2 control for 10 seconds (minimum)
  35858. +
  35859. lea (MainCharacter).w,a1 ; a1=character ; a1=Sonic
  35860. move.w (Tails_CPU_routine).w,d0
  35861. move.w TailsCPU_States(pc,d0.w),d0
  35862. jmp TailsCPU_States(pc,d0.w)
  35863. ; ===========================================================================
  35864. ; off_1BAF4:
  35865. TailsCPU_States: offsetTable
  35866. offsetTableEntry.w TailsCPU_Init ; 0
  35867. offsetTableEntry.w TailsCPU_Spawning ; 2
  35868. offsetTableEntry.w TailsCPU_Flying ; 4
  35869. offsetTableEntry.w TailsCPU_Normal ; 6
  35870. offsetTableEntry.w TailsCPU_Panic ; 8
  35871.  
  35872. ; ===========================================================================
  35873. ; initial AI State
  35874. ; ---------------------------------------------------------------------------
  35875. ; loc_1BAFE:
  35876. TailsCPU_Init:
  35877. move.w #6,(Tails_CPU_routine).w ; => TailsCPU_Normal
  35878. move.b #0,obj_control(a0)
  35879. move.b #AniIDTailsAni_Walk,anim(a0)
  35880. move.w #0,x_vel(a0)
  35881. move.w #0,y_vel(a0)
  35882. move.w #0,inertia(a0)
  35883. move.b #0,status(a0)
  35884. move.w #0,(Tails_respawn_counter).w
  35885. rts
  35886.  
  35887. ; ===========================================================================
  35888. ; AI State where Tails is waiting to respawn
  35889. ; ---------------------------------------------------------------------------
  35890. ; loc_1BB30:
  35891. TailsCPU_Spawning:
  35892. move.b (Ctrl_2_Held_Logical).w,d0
  35893. andi.b #button_B_mask|button_C_mask|button_A_mask|button_start_mask,d0
  35894. bne.s TailsCPU_Respawn
  35895. move.w (Timer_frames).w,d0
  35896. andi.w #$3F,d0
  35897. bne.s return_1BB88
  35898. tst.b obj_control(a1)
  35899. bne.s return_1BB88
  35900. move.b status(a1),d0
  35901. andi.b #$D2,d0
  35902. bne.s return_1BB88
  35903. ; loc_1BB54:
  35904. TailsCPU_Respawn:
  35905. move.w #4,(Tails_CPU_routine).w ; => TailsCPU_Flying
  35906. move.w x_pos(a1),d0
  35907. move.w d0,x_pos(a0)
  35908. move.w d0,(Tails_CPU_target_x).w
  35909. move.w y_pos(a1),d0
  35910. move.w d0,(Tails_CPU_target_y).w
  35911. subi.w #$C0,d0
  35912. move.w d0,y_pos(a0)
  35913. ori.w #high_priority,art_tile(a0)
  35914. move.b #0,spindash_flag(a0)
  35915. move.w #0,spindash_counter(a0)
  35916.  
  35917. return_1BB88:
  35918. rts
  35919.  
  35920. ; ===========================================================================
  35921. ; AI State where Tails pretends to be a helicopter
  35922. ; ---------------------------------------------------------------------------
  35923. ; loc_1BB8A:
  35924. TailsCPU_Flying:
  35925. tst.b render_flags(a0)
  35926. bmi.s TailsCPU_FlyingOnscreen
  35927. addq.w #1,(Tails_respawn_counter).w
  35928. cmpi.w #$12C,(Tails_respawn_counter).w
  35929. blo.s TailsCPU_Flying_Part2
  35930. move.w #0,(Tails_respawn_counter).w
  35931. move.w #2,(Tails_CPU_routine).w ; => TailsCPU_Spawning
  35932. move.b #$81,obj_control(a0)
  35933. move.b #2,status(a0)
  35934. move.w #0,x_pos(a0)
  35935. move.w #0,y_pos(a0)
  35936. move.b #AniIDTailsAni_Fly,anim(a0)
  35937. rts
  35938. ; ---------------------------------------------------------------------------
  35939. ; loc_1BBC8:
  35940. TailsCPU_FlyingOnscreen:
  35941. move.w #0,(Tails_respawn_counter).w
  35942. ; loc_1BBCE:
  35943. TailsCPU_Flying_Part2:
  35944. lea (Sonic_Pos_Record_Buf).w,a2
  35945. move.w #$10,d2
  35946. lsl.b #2,d2
  35947. addq.b #4,d2
  35948. move.w (Sonic_Pos_Record_Index).w,d3
  35949. sub.b d2,d3
  35950. move.w (a2,d3.w),(Tails_CPU_target_x).w
  35951. move.w 2(a2,d3.w),(Tails_CPU_target_y).w
  35952. tst.b (Water_flag).w
  35953. beq.s +
  35954. move.w (Water_Level_1).w,d0
  35955. subi.w #$10,d0
  35956. cmp.w (Tails_CPU_target_y).w,d0
  35957. bge.s +
  35958. move.w d0,(Tails_CPU_target_y).w
  35959. +
  35960. move.w x_pos(a0),d0
  35961. sub.w (Tails_CPU_target_x).w,d0
  35962. beq.s loc_1BC54
  35963. mvabs.w d0,d2
  35964. lsr.w #4,d2
  35965. cmpi.w #$C,d2
  35966. blo.s +
  35967. moveq #$C,d2
  35968. +
  35969. mvabs.b x_vel(a1),d1
  35970. add.b d1,d2
  35971. addq.w #1,d2
  35972. tst.w d0
  35973. bmi.s loc_1BC40
  35974. bset #0,status(a0)
  35975. cmp.w d0,d2
  35976. blo.s +
  35977. move.w d0,d2
  35978. moveq #0,d0
  35979. +
  35980. neg.w d2
  35981. bra.s loc_1BC50
  35982. ; ---------------------------------------------------------------------------
  35983.  
  35984. loc_1BC40:
  35985. bclr #0,status(a0)
  35986. neg.w d0
  35987. cmp.w d0,d2
  35988. blo.s loc_1BC50
  35989. move.b d0,d2
  35990. moveq #0,d0
  35991.  
  35992. loc_1BC50:
  35993. add.w d2,x_pos(a0)
  35994.  
  35995. loc_1BC54:
  35996. moveq #1,d2
  35997. move.w y_pos(a0),d1
  35998. sub.w (Tails_CPU_target_y).w,d1
  35999. beq.s loc_1BC68
  36000. bmi.s loc_1BC64
  36001. neg.w d2
  36002.  
  36003. loc_1BC64:
  36004. add.w d2,y_pos(a0)
  36005.  
  36006. loc_1BC68:
  36007. lea (Sonic_Stat_Record_Buf).w,a2
  36008. move.b 2(a2,d3.w),d2
  36009. andi.b #$D2,d2
  36010. bne.s return_1BCDE
  36011. or.w d0,d1
  36012. bne.s return_1BCDE
  36013. move.w #6,(Tails_CPU_routine).w ; => TailsCPU_Normal
  36014. move.b #0,obj_control(a0)
  36015. move.b #AniIDTailsAni_Walk,anim(a0)
  36016. move.w #0,x_vel(a0)
  36017. move.w #0,y_vel(a0)
  36018. move.w #0,inertia(a0)
  36019. move.b #2,status(a0)
  36020. move.w #0,move_lock(a0)
  36021. andi.w #drawing_mask,art_tile(a0)
  36022. tst.b art_tile(a1)
  36023. bpl.s +
  36024. ori.w #high_priority,art_tile(a0)
  36025. +
  36026. move.b top_solid_bit(a1),top_solid_bit(a0)
  36027. move.b lrb_solid_bit(a1),lrb_solid_bit(a0)
  36028. cmpi.b #AniIDTailsAni_Spindash,anim(a1)
  36029. beq.s return_1BCDE
  36030. move.b spindash_flag(a0),d0
  36031. beq.s return_1BCDE
  36032. move.b d0,spindash_flag(a1)
  36033. bsr.w loc_212C4
  36034.  
  36035. return_1BCDE:
  36036. rts
  36037.  
  36038. ; ===========================================================================
  36039. ; AI State where Tails follows the player normally
  36040. ; ---------------------------------------------------------------------------
  36041. ; loc_1BCE0:
  36042. TailsCPU_Normal:
  36043. cmpi.b #6,(MainCharacter+routine).w ; is Sonic dead?
  36044. blo.s TailsCPU_Normal_SonicOK ; if not, branch
  36045. ; Sonic's dead; fly down to his corpse
  36046. move.w #4,(Tails_CPU_routine).w ; => TailsCPU_Flying
  36047. move.b #0,spindash_flag(a0)
  36048. move.w #0,spindash_counter(a0)
  36049. move.b #$81,obj_control(a0)
  36050. move.b #2,status(a0)
  36051. move.b #AniIDTailsAni_Fly,anim(a0)
  36052. rts
  36053. ; ---------------------------------------------------------------------------
  36054. ; loc_1BD0E:
  36055. TailsCPU_Normal_SonicOK:
  36056. bsr.w TailsCPU_CheckDespawn
  36057. tst.w (Tails_control_counter).w ; if CPU has control
  36058. bne.w TailsCPU_Normal_HumanControl ; (if not, branch)
  36059. tst.b obj_control(a0) ; and Tails isn't fully object controlled (&$80)
  36060. bmi.w TailsCPU_Normal_HumanControl ; (if not, branch)
  36061. tst.w move_lock(a0) ; and Tails' movement is locked (usually because he just fell down a slope)
  36062. beq.s + ; (if not, branch)
  36063. tst.w inertia(a0) ; and Tails is stopped, then...
  36064. bne.s + ; (if not, branch)
  36065. move.w #8,(Tails_CPU_routine).w ; => TailsCPU_Panic
  36066. +
  36067. lea (Sonic_Pos_Record_Buf).w,a1
  36068. move.w #$10,d1
  36069. lsl.b #2,d1
  36070. addq.b #4,d1
  36071. move.w (Sonic_Pos_Record_Index).w,d0
  36072. sub.b d1,d0
  36073. move.w (a1,d0.w),d2 ; d2 = earlier x position of Sonic
  36074. move.w 2(a1,d0.w),d3 ; d3 = earlier y position of Sonic
  36075. lea (Sonic_Stat_Record_Buf).w,a1
  36076. move.w (a1,d0.w),d1 ; d1 = earlier input of Sonic
  36077. move.b 2(a1,d0.w),d4 ; d4 = earlier status of Sonic
  36078. move.w d1,d0
  36079. btst #5,status(a0) ; is Tails pushing against something?
  36080. beq.s + ; if not, branch
  36081. btst #5,d4 ; was Sonic pushing against something?
  36082. beq.w TailsCPU_Normal_FilterAction_Part2 ; if not, branch elsewhere
  36083.  
  36084. ; either Tails isn't pushing, or Tails and Sonic are both pushing
  36085. + sub.w x_pos(a0),d2
  36086. beq.s TailsCPU_Normal_Stand ; branch if Tails is already lined up horizontally with Sonic
  36087. bpl.s TailsCPU_Normal_FollowRight
  36088. neg.w d2
  36089.  
  36090. ; Tails wants to go left because that's where Sonic is
  36091. ; loc_1BD76: TailsCPU_Normal_FollowLeft:
  36092. cmpi.w #$10,d2
  36093. blo.s +
  36094. andi.w #~(((button_left_mask|button_right_mask)<<8)|(button_left_mask|button_right_mask)),d1 ; AND out Sonic's left/right input...
  36095. ori.w #(button_left_mask<<8)|button_left_mask,d1 ; ...and give Tails his own
  36096. +
  36097. tst.w inertia(a0)
  36098. beq.s TailsCPU_Normal_FilterAction
  36099. btst #0,status(a0)
  36100. beq.s TailsCPU_Normal_FilterAction
  36101. subq.w #1,x_pos(a0)
  36102. bra.s TailsCPU_Normal_FilterAction
  36103. ; ===========================================================================
  36104. ; Tails wants to go right because that's where Sonic is
  36105. ; loc_1BD98:
  36106. TailsCPU_Normal_FollowRight:
  36107. cmpi.w #$10,d2
  36108. blo.s +
  36109. andi.w #~(((button_left_mask|button_right_mask)<<8)|(button_left_mask|button_right_mask)),d1 ; AND out Sonic's left/right input
  36110. ori.w #(button_right_mask<<8)|button_right_mask,d1 ; ...and give Tails his own
  36111. +
  36112. tst.w inertia(a0)
  36113. beq.s TailsCPU_Normal_FilterAction
  36114. btst #0,status(a0)
  36115. bne.s TailsCPU_Normal_FilterAction
  36116. addq.w #1,x_pos(a0)
  36117. bra.s TailsCPU_Normal_FilterAction
  36118. ; ===========================================================================
  36119. ; Tails is happy where he is
  36120. ; loc_1BDBA:
  36121. TailsCPU_Normal_Stand:
  36122. bclr #0,status(a0)
  36123. move.b d4,d0
  36124. andi.b #1,d0
  36125. beq.s TailsCPU_Normal_FilterAction
  36126. bset #0,status(a0)
  36127.  
  36128. ; Filter the action we chose depending on a few things
  36129. ; loc_1BDCE:
  36130. TailsCPU_Normal_FilterAction:
  36131. tst.b (Tails_CPU_jumping).w
  36132. beq.s +
  36133. ori.w #((button_B_mask|button_C_mask|button_A_mask)<<8),d1
  36134. btst #1,status(a0)
  36135. bne.s TailsCPU_Normal_SendAction
  36136. move.b #0,(Tails_CPU_jumping).w
  36137. +
  36138. move.w (Timer_frames).w,d0
  36139. andi.w #$FF,d0
  36140. beq.s +
  36141. cmpi.w #$40,d2
  36142. bhs.s TailsCPU_Normal_SendAction
  36143. +
  36144. sub.w y_pos(a0),d3
  36145. beq.s TailsCPU_Normal_SendAction
  36146. bpl.s TailsCPU_Normal_SendAction
  36147. neg.w d3
  36148. cmpi.w #$20,d3
  36149. blo.s TailsCPU_Normal_SendAction
  36150. ; loc_1BE06:
  36151. TailsCPU_Normal_FilterAction_Part2:
  36152. move.b (Timer_frames+1).w,d0
  36153. andi.b #$3F,d0
  36154. bne.s TailsCPU_Normal_SendAction
  36155. cmpi.b #AniIDTailsAni_Duck,anim(a0)
  36156. beq.s TailsCPU_Normal_SendAction
  36157. ori.w #((button_B_mask|button_C_mask|button_A_mask)<<8)|(button_B_mask|button_C_mask|button_A_mask),d1
  36158. move.b #1,(Tails_CPU_jumping).w
  36159.  
  36160. ; Send the action we chose by storing it into player 2's input
  36161. ; loc_1BE22:
  36162. TailsCPU_Normal_SendAction:
  36163. move.w d1,(Ctrl_2_Logical).w
  36164. rts
  36165.  
  36166. ; ===========================================================================
  36167. ; Follow orders from controller 2
  36168. ; and decrease the counter to when the CPU will regain control
  36169. ; loc_1BE28:
  36170. TailsCPU_Normal_HumanControl:
  36171. tst.w (Tails_control_counter).w
  36172. beq.s + ; don't decrease if it's already 0
  36173. subq.w #1,(Tails_control_counter).w
  36174. +
  36175. rts
  36176.  
  36177. ; ===========================================================================
  36178. ; loc_1BE34:
  36179. TailsCPU_Despawn:
  36180. move.w #0,(Tails_control_counter).w
  36181. move.w #0,(Tails_respawn_counter).w
  36182. move.w #2,(Tails_CPU_routine).w ; => TailsCPU_Spawning
  36183. move.b #$81,obj_control(a0)
  36184. move.b #2,status(a0)
  36185. move.w #$4000,x_pos(a0)
  36186. move.w #0,y_pos(a0)
  36187. move.b #AniIDTailsAni_Fly,anim(a0)
  36188. rts
  36189. ; ===========================================================================
  36190. ; sub_1BE66:
  36191. TailsCPU_CheckDespawn:
  36192. tst.b render_flags(a0)
  36193. bmi.s TailsCPU_ResetRespawnTimer
  36194. btst #3,status(a0)
  36195. beq.s TailsCPU_TickRespawnTimer
  36196.  
  36197. moveq #0,d0
  36198. move.b interact(a0),d0
  36199. if object_size=$40
  36200. lsl.w #6,d0
  36201. else
  36202. mulu.w #object_size,d0
  36203. endif
  36204. addi.l #Object_RAM,d0
  36205. movea.l d0,a3 ; a3=object
  36206. move.b (Tails_interact_ID).w,d0
  36207. cmp.b (a3),d0
  36208. bne.s BranchTo_TailsCPU_Despawn
  36209.  
  36210. ; loc_1BE8C:
  36211. TailsCPU_TickRespawnTimer:
  36212. addq.w #1,(Tails_respawn_counter).w
  36213. cmpi.w #$12C,(Tails_respawn_counter).w
  36214. blo.s TailsCPU_UpdateObjInteract
  36215.  
  36216. BranchTo_TailsCPU_Despawn
  36217. bra.w TailsCPU_Despawn
  36218. ; ===========================================================================
  36219. ; loc_1BE9C:
  36220. TailsCPU_ResetRespawnTimer:
  36221. move.w #0,(Tails_respawn_counter).w
  36222. ; loc_1BEA2:
  36223. TailsCPU_UpdateObjInteract:
  36224. moveq #0,d0
  36225. move.b interact(a0),d0
  36226. if object_size=$40
  36227. lsl.w #6,d0
  36228. else
  36229. mulu.w #object_size,d0
  36230. endif
  36231. addi.l #Object_RAM,d0
  36232. movea.l d0,a3 ; a3=object
  36233. move.b (a3),(Tails_interact_ID).w
  36234. rts
  36235.  
  36236. ; ===========================================================================
  36237. ; AI State where Tails stops, drops, and spindashes in Sonic's direction
  36238. ; ---------------------------------------------------------------------------
  36239. ; loc_1BEB8:
  36240. TailsCPU_Panic:
  36241. bsr.w TailsCPU_CheckDespawn
  36242. tst.w (Tails_control_counter).w
  36243. bne.w return_1BF36
  36244. tst.w move_lock(a0)
  36245. bne.s return_1BF36
  36246. tst.b spindash_flag(a0)
  36247. bne.s TailsCPU_Panic_ChargingDash
  36248.  
  36249. tst.w inertia(a0)
  36250. bne.s return_1BF36
  36251. bclr #0,status(a0)
  36252. move.w x_pos(a0),d0
  36253. sub.w x_pos(a1),d0
  36254. bcs.s +
  36255. bset #0,status(a0)
  36256. +
  36257. move.w #(button_down_mask<<8)|button_down_mask,(Ctrl_2_Logical).w
  36258. move.b (Timer_frames+1).w,d0
  36259. andi.b #$7F,d0
  36260. beq.s TailsCPU_Panic_ReleaseDash
  36261.  
  36262. cmpi.b #AniIDTailsAni_Duck,anim(a0)
  36263. bne.s return_1BF36
  36264. move.w #((button_down_mask|button_B_mask|button_C_mask|button_A_mask)<<8)|(button_down_mask|button_B_mask|button_C_mask|button_A_mask),(Ctrl_2_Logical).w
  36265. rts
  36266. ; ---------------------------------------------------------------------------
  36267. ; loc_1BF0C:
  36268. TailsCPU_Panic_ChargingDash:
  36269. move.w #(button_down_mask<<8)|button_down_mask,(Ctrl_2_Logical).w
  36270. move.b (Timer_frames+1).w,d0
  36271. andi.b #$7F,d0
  36272. bne.s TailsCPU_Panic_RevDash
  36273.  
  36274. ; loc_1BF1C:
  36275. TailsCPU_Panic_ReleaseDash:
  36276. move.w #0,(Ctrl_2_Logical).w
  36277. move.w #6,(Tails_CPU_routine).w ; => TailsCPU_Normal
  36278. rts
  36279. ; ---------------------------------------------------------------------------
  36280. ; loc_1BF2A:
  36281. TailsCPU_Panic_RevDash:
  36282. andi.b #$1F,d0
  36283. bne.s return_1BF36
  36284. ori.w #((button_B_mask|button_C_mask|button_A_mask)<<8)|(button_B_mask|button_C_mask|button_A_mask),(Ctrl_2_Logical).w
  36285.  
  36286. return_1BF36:
  36287. rts
  36288. ; End of function TailsCPU_Control
  36289.  
  36290.  
  36291. ; ---------------------------------------------------------------------------
  36292. ; Subroutine to record Tails' previous positions for invincibility stars
  36293. ; ---------------------------------------------------------------------------
  36294.  
  36295. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36296.  
  36297. ; loc_1BF38:
  36298. Tails_RecordPos:
  36299. move.w (Tails_Pos_Record_Index).w,d0
  36300. lea (Tails_Pos_Record_Buf).w,a1
  36301. lea (a1,d0.w),a1
  36302. move.w x_pos(a0),(a1)+
  36303. move.w y_pos(a0),(a1)+
  36304. addq.b #4,(Tails_Pos_Record_Index+1).w
  36305.  
  36306. rts
  36307. ; End of subroutine Tails_RecordPos
  36308.  
  36309. ; ---------------------------------------------------------------------------
  36310. ; Subroutine for Tails when he's underwater
  36311. ; ---------------------------------------------------------------------------
  36312.  
  36313. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36314.  
  36315. ; loc_1BF52:
  36316. Tails_Water:
  36317. tst.b (Water_flag).w ; does level have water?
  36318. bne.s Obj02_InWater ; if yes, branch
  36319.  
  36320. return_1BF58:
  36321. rts
  36322. ; ---------------------------------------------------------------------------
  36323. ; loc_1BF5A:
  36324. Obj02_InWater:
  36325. move.w (Water_Level_1).w,d0
  36326. cmp.w y_pos(a0),d0 ; is Sonic above the water?
  36327. bge.s Obj02_OutWater ; if yes, branch
  36328.  
  36329. bset #6,status(a0) ; set underwater flag
  36330. bne.s return_1BF58 ; if already underwater, branch
  36331.  
  36332. movea.l a0,a1
  36333. bsr.w ResumeMusic
  36334. move.b #ObjID_SmallBubbles,(Tails_BreathingBubbles+id).w ; load Obj0A (tail's breathing bubbles) at $FFFFD0C0
  36335. move.b #$81,(Tails_BreathingBubbles+subtype).w
  36336. move.l a0,(Tails_BreathingBubbles+$3C).w ; set its parent to be this (obj0A uses $3C instead of $3E for some reason)
  36337. move.w #$300,(Tails_top_speed).w
  36338. move.w #6,(Tails_acceleration).w
  36339. move.w #$40,(Tails_deceleration).w
  36340. asr x_vel(a0)
  36341. asr y_vel(a0)
  36342. asr y_vel(a0)
  36343. beq.s return_1BF58
  36344. move.w #$100,(Tails_Dust+anim).w ; splash animation
  36345. move.w #SndID_Splash,d0 ; splash sound
  36346. jmp (PlaySound).l
  36347. ; ---------------------------------------------------------------------------
  36348. ; loc_1BFB2:
  36349. Obj02_OutWater:
  36350. bclr #6,status(a0) ; unset underwater flag
  36351. beq.s return_1BF58 ; if already above water, branch
  36352.  
  36353. movea.l a0,a1
  36354. bsr.w ResumeMusic
  36355. move.w #$600,(Tails_top_speed).w
  36356. move.w #$C,(Tails_acceleration).w
  36357. move.w #$80,(Tails_deceleration).w
  36358.  
  36359. cmpi.b #4,routine(a0) ; is Tails falling back from getting hurt?
  36360. beq.s + ; if yes, branch
  36361. asl y_vel(a0)
  36362. +
  36363. tst.w y_vel(a0)
  36364. beq.w return_1BF58
  36365. move.w #$100,(Tails_Dust+anim).w ; splash animation
  36366. movea.l a0,a1
  36367. bsr.w ResumeMusic
  36368. cmpi.w #-$1000,y_vel(a0)
  36369. bgt.s +
  36370. move.w #-$1000,y_vel(a0) ; limit upward y velocity exiting the water
  36371. +
  36372. move.w #SndID_Splash,d0 ; splash sound
  36373. jmp (PlaySound).l
  36374. ; End of subroutine Tails_Water
  36375.  
  36376. ; ===========================================================================
  36377. ; ---------------------------------------------------------------------------
  36378. ; Start of subroutine Obj02_MdNormal
  36379. ; Called if Tails is neither airborne nor rolling this frame
  36380. ; ---------------------------------------------------------------------------
  36381. ; loc_1C00A:
  36382. Obj02_MdNormal:
  36383. bsr.w Tails_CheckSpindash
  36384. bsr.w Tails_Jump
  36385. bsr.w Tails_SlopeResist
  36386. bsr.w Tails_Move
  36387. bsr.w Tails_Roll
  36388. bsr.w Tails_LevelBound
  36389. jsr (ObjectMove).l
  36390. bsr.w AnglePos
  36391. bsr.w Tails_SlopeRepel
  36392. rts
  36393. ; End of subroutine Obj02_MdNormal
  36394. ; ===========================================================================
  36395. ; Start of subroutine Obj02_MdAir
  36396. ; Called if Tails is airborne, but not in a ball (thus, probably not jumping)
  36397. ; loc_1C032: Obj02_MdJump
  36398. Obj02_MdAir:
  36399. bsr.w Tails_JumpHeight
  36400. bsr.w Tails_ChgJumpDir
  36401. bsr.w Tails_LevelBound
  36402. jsr (ObjectMoveAndFall).l
  36403. btst #6,status(a0) ; is Tails underwater?
  36404. beq.s + ; if not, branch
  36405. subi.w #$28,y_vel(a0) ; reduce gravity by $28 ($38-$28=$10)
  36406. +
  36407. bsr.w Tails_JumpAngle
  36408. bsr.w Tails_DoLevelCollision
  36409. rts
  36410. ; End of subroutine Obj02_MdAir
  36411. ; ===========================================================================
  36412. ; Start of subroutine Obj02_MdRoll
  36413. ; Called if Tails is in a ball, but not airborne (thus, probably rolling)
  36414. ; loc_1C05C:
  36415. Obj02_MdRoll:
  36416. tst.b pinball_mode(a0)
  36417. bne.s +
  36418. bsr.w Tails_Jump
  36419. +
  36420. bsr.w Tails_RollRepel
  36421. bsr.w Tails_RollSpeed
  36422. bsr.w Tails_LevelBound
  36423. jsr (ObjectMove).l
  36424. bsr.w AnglePos
  36425. bsr.w Tails_SlopeRepel
  36426. rts
  36427. ; End of subroutine Obj02_MdRoll
  36428. ; ===========================================================================
  36429. ; Start of subroutine Obj02_MdJump
  36430. ; Called if Tails is in a ball and airborne (he could be jumping but not necessarily)
  36431. ; Notes: This is identical to Obj02_MdAir, at least at this outer level.
  36432. ; Why they gave it a separate copy of the code, I don't know.
  36433. ; loc_1C082: Obj02_MdJump2:
  36434. Obj02_MdJump:
  36435. bsr.w Tails_JumpHeight
  36436. bsr.w Tails_ChgJumpDir
  36437. bsr.w Tails_LevelBound
  36438. jsr (ObjectMoveAndFall).l
  36439. btst #6,status(a0) ; is Tails underwater?
  36440. beq.s + ; if not, branch
  36441. subi.w #$28,y_vel(a0) ; reduce gravity by $28 ($38-$28=$10)
  36442. +
  36443. bsr.w Tails_JumpAngle
  36444. bsr.w Tails_DoLevelCollision
  36445. rts
  36446. ; End of subroutine Obj02_MdJump
  36447.  
  36448. ; ---------------------------------------------------------------------------
  36449. ; Subroutine to make Tails walk/run
  36450. ; ---------------------------------------------------------------------------
  36451.  
  36452. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36453.  
  36454. ; loc_1C0AC:
  36455. Tails_Move:
  36456. move.w (Tails_top_speed).w,d6
  36457. move.w (Tails_acceleration).w,d5
  36458. move.w (Tails_deceleration).w,d4
  36459. if status_sec_isSliding = 7
  36460. tst.b status_secondary(a0)
  36461. bmi.w Obj02_Traction
  36462. else
  36463. btst #status_sec_isSliding,status_secondary(a0)
  36464. bne.w Obj02_Traction
  36465. endif
  36466. tst.w move_lock(a0)
  36467. bne.w Obj02_ResetScr
  36468. btst #button_left,(Ctrl_2_Held_Logical).w ; is left being pressed?
  36469. beq.s Obj02_NotLeft ; if not, branch
  36470. bsr.w Tails_MoveLeft
  36471. ; loc_1C0D4:
  36472. Obj02_NotLeft:
  36473. btst #button_right,(Ctrl_2_Held_Logical).w ; is right being pressed?
  36474. beq.s Obj02_NotRight ; if not, branch
  36475. bsr.w Tails_MoveRight
  36476. ; loc_1C0E0:
  36477. Obj02_NotRight:
  36478. move.b angle(a0),d0
  36479. addi.b #$20,d0
  36480. andi.b #$C0,d0 ; is Tails on a slope?
  36481. bne.w Obj02_ResetScr ; if yes, branch
  36482. tst.w inertia(a0) ; is Tails moving?
  36483. bne.w Obj02_ResetScr ; if yes, branch
  36484. bclr #5,status(a0)
  36485. move.b #AniIDTailsAni_Wait,anim(a0) ; use "standing" animation
  36486. btst #3,status(a0)
  36487. beq.s Tails_Balance
  36488. moveq #0,d0
  36489. move.b interact(a0),d0
  36490. if object_size=$40
  36491. lsl.w #6,d0
  36492. else
  36493. mulu.w #object_size,d0
  36494. endif
  36495. lea (Object_RAM).w,a1 ; a1=character
  36496. lea (a1,d0.w),a1 ; a1=object
  36497. tst.b status(a1)
  36498. bmi.s Tails_Lookup
  36499. moveq #0,d1
  36500. move.b width_pixels(a1),d1
  36501. move.w d1,d2
  36502. add.w d2,d2
  36503. subq.w #4,d2
  36504. add.w x_pos(a0),d1
  36505. sub.w x_pos(a1),d1
  36506. cmpi.w #4,d1
  36507. blt.s Tails_BalanceOnObjLeft
  36508. cmp.w d2,d1
  36509. bge.s Tails_BalanceOnObjRight
  36510. bra.s Tails_Lookup
  36511. ; ---------------------------------------------------------------------------
  36512. ; balancing checks for Tails
  36513. ; loc_1C142:
  36514. Tails_Balance:
  36515. jsr (ChkFloorEdge).l
  36516. cmpi.w #$C,d1
  36517. blt.s Tails_Lookup
  36518. cmpi.b #3,next_tilt(a0)
  36519. bne.s Tails_BalanceLeft
  36520. ; loc_1C156:
  36521. Tails_BalanceOnObjRight:
  36522. bclr #0,status(a0)
  36523. bra.s Tails_BalanceDone
  36524. ; ---------------------------------------------------------------------------
  36525. ; loc_1C15E:
  36526. Tails_BalanceLeft:
  36527. cmpi.b #3,tilt(a0)
  36528. bne.s Tails_Lookup
  36529. ; loc_1C166:
  36530. Tails_BalanceOnObjLeft:
  36531. bset #0,status(a0)
  36532. ; loc_1C16C:
  36533. Tails_BalanceDone:
  36534. move.b #AniIDTailsAni_Balance,anim(a0)
  36535. bra.s Obj02_ResetScr
  36536. ; ---------------------------------------------------------------------------
  36537. ; loc_1C174:
  36538. Tails_Lookup:
  36539. btst #button_up,(Ctrl_2_Held_Logical).w ; is up being pressed?
  36540. beq.s Tails_Duck ; if not, branch
  36541. move.b #AniIDTailsAni_LookUp,anim(a0) ; use "looking up" animation
  36542. addq.w #1,(Tails_Look_delay_counter).w
  36543. cmpi.w #$78,(Tails_Look_delay_counter).w
  36544. blo.s Obj02_ResetScr_Part2
  36545. move.w #$78,(Tails_Look_delay_counter).w
  36546. cmpi.w #$C8,(Camera_Y_pos_bias_P2).w
  36547. beq.s Obj02_UpdateSpeedOnGround
  36548. addq.w #2,(Camera_Y_pos_bias_P2).w
  36549. bra.s Obj02_UpdateSpeedOnGround
  36550. ; ---------------------------------------------------------------------------
  36551. ; loc_1C1A2:
  36552. Tails_Duck:
  36553. btst #button_down,(Ctrl_2_Held_Logical).w ; is down being pressed?
  36554. beq.s Obj02_ResetScr ; if not, branch
  36555. move.b #AniIDTailsAni_Duck,anim(a0) ; use "ducking" animation
  36556. addq.w #1,(Tails_Look_delay_counter).w
  36557. cmpi.w #$78,(Tails_Look_delay_counter).w
  36558. blo.s Obj02_ResetScr_Part2
  36559. move.w #$78,(Tails_Look_delay_counter).w
  36560. cmpi.w #8,(Camera_Y_pos_bias_P2).w
  36561. beq.s Obj02_UpdateSpeedOnGround
  36562. subq.w #2,(Camera_Y_pos_bias_P2).w
  36563. bra.s Obj02_UpdateSpeedOnGround
  36564.  
  36565. ; ===========================================================================
  36566. ; moves the screen back to its normal position after looking up or down
  36567. ; loc_1C1D0:
  36568. Obj02_ResetScr:
  36569. move.w #0,(Tails_Look_delay_counter).w
  36570. ; loc_1C1D6:
  36571. Obj02_ResetScr_Part2:
  36572. cmpi.w #(224/2)-16,(Camera_Y_pos_bias_P2).w ; is screen in its default position?
  36573. beq.s Obj02_UpdateSpeedOnGround ; if yes, branch.
  36574. bhs.s + ; depending on the sign of the difference,
  36575. addq.w #4,(Camera_Y_pos_bias_P2).w ; either add 2
  36576. + subq.w #2,(Camera_Y_pos_bias_P2).w ; or subtract 2
  36577.  
  36578. ; ---------------------------------------------------------------------------
  36579. ; updates Tails' speed on the ground
  36580. ; ---------------------------------------------------------------------------
  36581. ; loc_1C1E8:
  36582. Obj02_UpdateSpeedOnGround:
  36583. move.b (Ctrl_2_Held_Logical).w,d0
  36584. andi.b #button_left_mask|button_right_mask,d0 ; is left/right pressed?
  36585. bne.s Obj02_Traction ; if yes, branch
  36586. move.w inertia(a0),d0
  36587. beq.s Obj02_Traction
  36588. bmi.s Obj02_SettleLeft
  36589.  
  36590. ; slow down when facing right and not pressing a direction
  36591. ; Obj02_SettleRight:
  36592. sub.w d5,d0
  36593. bcc.s +
  36594. move.w #0,d0
  36595. +
  36596. move.w d0,inertia(a0)
  36597. bra.s Obj02_Traction
  36598. ; ---------------------------------------------------------------------------
  36599. ; slow down when facing left and not pressing a direction
  36600. ; loc_1C208:
  36601. Obj02_SettleLeft:
  36602. add.w d5,d0
  36603. bcc.s +
  36604. move.w #0,d0
  36605. +
  36606. move.w d0,inertia(a0)
  36607.  
  36608. ; increase or decrease speed on the ground
  36609. ; loc_1C214:
  36610. Obj02_Traction:
  36611. move.b angle(a0),d0
  36612. jsr (CalcSine).l
  36613. muls.w inertia(a0),d1
  36614. asr.l #8,d1
  36615. move.w d1,x_vel(a0)
  36616. muls.w inertia(a0),d0
  36617. asr.l #8,d0
  36618. move.w d0,y_vel(a0)
  36619.  
  36620. ; stops Tails from running through walls that meet the ground
  36621. ; loc_1C232:
  36622. Obj02_CheckWallsOnGround:
  36623. move.b angle(a0),d0
  36624. addi.b #$40,d0
  36625. bmi.s return_1C2A2
  36626. move.b #$40,d1
  36627. tst.w inertia(a0)
  36628. beq.s return_1C2A2
  36629. bmi.s +
  36630. neg.w d1
  36631. +
  36632. move.b angle(a0),d0
  36633. add.b d1,d0
  36634. move.w d0,-(sp)
  36635. bsr.w CalcRoomInFront
  36636. move.w (sp)+,d0
  36637. tst.w d1
  36638. bpl.s return_1C2A2
  36639. asl.w #8,d1
  36640. addi.b #$20,d0
  36641. andi.b #$C0,d0
  36642. beq.s loc_1C29E
  36643. cmpi.b #$40,d0
  36644. beq.s loc_1C28C
  36645. cmpi.b #$80,d0
  36646. beq.s loc_1C286
  36647. add.w d1,x_vel(a0)
  36648. bset #5,status(a0)
  36649. move.w #0,inertia(a0)
  36650. rts
  36651. ; ---------------------------------------------------------------------------
  36652.  
  36653. loc_1C286:
  36654. sub.w d1,y_vel(a0)
  36655. rts
  36656. ; ---------------------------------------------------------------------------
  36657.  
  36658. loc_1C28C:
  36659. sub.w d1,x_vel(a0)
  36660. bset #5,status(a0)
  36661. move.w #0,inertia(a0)
  36662. rts
  36663. ; ---------------------------------------------------------------------------
  36664. loc_1C29E:
  36665. add.w d1,y_vel(a0)
  36666.  
  36667. return_1C2A2:
  36668. rts
  36669. ; End of subroutine Tails_Move
  36670.  
  36671.  
  36672. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36673.  
  36674. ; loc_1C2A4:
  36675. Tails_MoveLeft:
  36676. move.w inertia(a0),d0
  36677. beq.s +
  36678. bpl.s Tails_TurnLeft ; if Tails is already moving to the right, branch
  36679. +
  36680. bset #0,status(a0)
  36681. bne.s +
  36682. bclr #5,status(a0)
  36683. move.b #AniIDTailsAni_Run,next_anim(a0)
  36684. +
  36685. sub.w d5,d0 ; add acceleration to the left
  36686. move.w d6,d1
  36687. neg.w d1
  36688. cmp.w d1,d0 ; compare new speed with top speed
  36689. bgt.s + ; if new speed is less than the maximum, branch
  36690. add.w d5,d0 ; remove this frame's acceleration change
  36691. cmp.w d1,d0 ; compare speed with top speed
  36692. ble.s + ; if speed was already greater than the maximum, branch
  36693. move.w d1,d0 ; limit speed on ground going left
  36694. +
  36695. move.w d0,inertia(a0)
  36696. move.b #AniIDTailsAni_Walk,anim(a0) ; use walking animation
  36697. rts
  36698. ; ---------------------------------------------------------------------------
  36699. ; loc_1C2DE:
  36700. Tails_TurnLeft:
  36701. sub.w d4,d0
  36702. bcc.s +
  36703. move.w #-$80,d0
  36704. +
  36705. move.w d0,inertia(a0)
  36706. move.b angle(a0),d0
  36707. addi.b #$20,d0
  36708. andi.b #$C0,d0
  36709. bne.s return_1C328
  36710. cmpi.w #$400,d0
  36711. blt.s return_1C328
  36712. move.b #AniIDTailsAni_Stop,anim(a0) ; use "stopping" animation
  36713. bclr #0,status(a0)
  36714. move.w #SndID_Skidding,d0
  36715. jsr (PlaySound).l
  36716. cmpi.b #$C,air_left(a0)
  36717. blo.s return_1C328 ; if he's drowning, branch to not make dust
  36718. move.b #6,(Tails_Dust+routine).w
  36719. move.b #$15,(Tails_Dust+mapping_frame).w
  36720.  
  36721. return_1C328:
  36722. rts
  36723. ; End of subroutine Tails_MoveLeft
  36724.  
  36725.  
  36726. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36727.  
  36728. ; loc_1C32A:
  36729. Tails_MoveRight:
  36730. move.w inertia(a0),d0
  36731. bmi.s Tails_TurnRight
  36732. bclr #0,status(a0)
  36733. beq.s +
  36734. bclr #5,status(a0)
  36735. move.b #AniIDTailsAni_Run,next_anim(a0)
  36736. +
  36737. add.w d5,d0 ; add acceleration to the right
  36738. cmp.w d6,d0 ; compare new speed with top speed
  36739. blt.s + ; if new speed is less than the maximum, branch
  36740. sub.w d5,d0 ; remove this frame's acceleration change
  36741. cmp.w d6,d0 ; compare speed with top speed
  36742. bge.s + ; if speed was already greater than the maximum, branch
  36743. move.w d6,d0 ; limit speed on ground going right
  36744. +
  36745. move.w d0,inertia(a0)
  36746. move.b #AniIDTailsAni_Walk,anim(a0) ; use walking animation
  36747. rts
  36748. ; ---------------------------------------------------------------------------
  36749. ; loc_1C35E:
  36750. Tails_TurnRight:
  36751. add.w d4,d0
  36752. bcc.s +
  36753. move.w #$80,d0
  36754. +
  36755. move.w d0,inertia(a0)
  36756. move.b angle(a0),d0
  36757. addi.b #$20,d0
  36758. andi.b #$C0,d0
  36759. bne.s return_1C3A8
  36760. cmpi.w #-$400,d0
  36761. bgt.s return_1C3A8
  36762. move.b #AniIDTailsAni_Stop,anim(a0) ; use "stopping" animation
  36763. bset #0,status(a0)
  36764. move.w #SndID_Skidding,d0 ; use "stopping" sound
  36765. jsr (PlaySound).l
  36766. cmpi.b #$C,air_left(a0)
  36767. blo.s return_1C3A8 ; if he's drowning, branch to not make dust
  36768. move.b #6,(Tails_Dust+routine).w
  36769. move.b #$15,(Tails_Dust+mapping_frame).w
  36770.  
  36771. return_1C3A8:
  36772. rts
  36773. ; End of subroutine Tails_MoveRight
  36774.  
  36775. ; ---------------------------------------------------------------------------
  36776. ; Subroutine to change Tails' speed as he rolls
  36777. ; ---------------------------------------------------------------------------
  36778.  
  36779. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36780.  
  36781. ; loc_1C3AA:
  36782. Tails_RollSpeed:
  36783. move.w (Tails_top_speed).w,d6
  36784. asl.w #1,d6
  36785. move.w (Tails_acceleration).w,d5
  36786. asr.w #1,d5 ; natural roll deceleration = 1/2 normal acceleration
  36787. move.w (Tails_deceleration).w,d4
  36788. asr.w #2,d4 ; controlled roll deceleration...
  36789. ; interestingly, Tails is much worse at this than Sonic when underwater
  36790. if status_sec_isSliding = 7
  36791. tst.b status_secondary(a0)
  36792. bmi.w Obj02_Roll_ResetScr
  36793. else
  36794. btst #status_sec_isSliding,status_secondary(a0)
  36795. bne.w Obj02_Roll_ResetScr
  36796. endif
  36797. tst.w move_lock(a0)
  36798. bne.s Tails_ApplyRollSpeed
  36799. btst #button_left,(Ctrl_2_Held_Logical).w ; is left being pressed?
  36800. beq.s + ; if not, branch
  36801. bsr.w Tails_RollLeft
  36802. +
  36803. btst #button_right,(Ctrl_2_Held_Logical).w ; is right being pressed?
  36804. beq.s Tails_ApplyRollSpeed ; if not, branch
  36805. bsr.w Tails_RollRight
  36806.  
  36807. ; loc_1C3E2:
  36808. Tails_ApplyRollSpeed:
  36809. move.w inertia(a0),d0
  36810. beq.s Tails_CheckRollStop
  36811. bmi.s Tails_ApplyRollSpeedLeft
  36812.  
  36813. ; Tails_ApplyRollSpeedRight:
  36814. sub.w d5,d0
  36815. bcc.s +
  36816. move.w #0,d0
  36817. +
  36818. move.w d0,inertia(a0)
  36819. bra.s Tails_CheckRollStop
  36820. ; ---------------------------------------------------------------------------
  36821. ; loc_1C3F8:
  36822. Tails_ApplyRollSpeedLeft:
  36823. add.w d5,d0
  36824. bcc.s +
  36825. move.w #0,d0
  36826. +
  36827. move.w d0,inertia(a0)
  36828.  
  36829. ; loc_1C404
  36830. Tails_CheckRollStop:
  36831. tst.w inertia(a0)
  36832. bne.s Obj02_Roll_ResetScr
  36833. tst.b pinball_mode(a0) ; note: the spindash flag has a different meaning when Tails is already rolling -- it's used to mean he's not allowed to stop rolling
  36834. bne.s Tails_KeepRolling
  36835. bclr #2,status(a0)
  36836. move.b #$F,y_radius(a0) ; sets standing height to only slightly higher than rolling height, unlike Sonic
  36837. move.b #9,x_radius(a0)
  36838. move.b #AniIDTailsAni_Wait,anim(a0)
  36839. subq.w #1,y_pos(a0)
  36840. bra.s Obj02_Roll_ResetScr
  36841.  
  36842. ; ---------------------------------------------------------------------------
  36843. ; magically gives Tails an extra push if he's going to stop rolling where it's not allowed
  36844. ; (such as in an S-curve in HTZ or a stopper chamber in CNZ)
  36845. ; loc_1C42E:
  36846. Tails_KeepRolling:
  36847. move.w #$400,inertia(a0)
  36848. btst #0,status(a0)
  36849. beq.s Obj02_Roll_ResetScr
  36850. neg.w inertia(a0)
  36851.  
  36852. ; resets the screen to normal while rolling, like Obj02_ResetScr
  36853. ; loc_1C440:
  36854. Obj02_Roll_ResetScr:
  36855. cmpi.w #(224/2)-16,(Camera_Y_pos_bias_P2).w ; is screen in its default position?
  36856. beq.s Tails_SetRollSpeed ; if yes, branch
  36857. bhs.s + ; depending on the sign of the difference,
  36858. addq.w #4,(Camera_Y_pos_bias_P2).w ; either add 2
  36859. + subq.w #2,(Camera_Y_pos_bias_P2).w ; or subtract 2
  36860.  
  36861. ; loc_1C452:
  36862. Tails_SetRollSpeed:
  36863. move.b angle(a0),d0
  36864. jsr (CalcSine).l
  36865. muls.w inertia(a0),d0
  36866. asr.l #8,d0
  36867. move.w d0,y_vel(a0) ; set y velocity based on $14 and angle
  36868. muls.w inertia(a0),d1
  36869. asr.l #8,d1
  36870. cmpi.w #$1000,d1
  36871. ble.s +
  36872. move.w #$1000,d1 ; limit Tails' speed rolling right
  36873. +
  36874. cmpi.w #-$1000,d1
  36875. bge.s +
  36876. move.w #-$1000,d1 ; limit Tails' speed rolling left
  36877. +
  36878. move.w d1,x_vel(a0) ; set x velocity based on $14 and angle
  36879. bra.w Obj02_CheckWallsOnGround
  36880. ; End of function Tails_RollSpeed
  36881.  
  36882.  
  36883. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36884.  
  36885.  
  36886. ; loc_1C488:
  36887. Tails_RollLeft:
  36888. move.w inertia(a0),d0
  36889. beq.s +
  36890. bpl.s Tails_BrakeRollingRight
  36891. +
  36892. bset #0,status(a0)
  36893. move.b #AniIDTailsAni_Roll,anim(a0) ; use "rolling" animation
  36894. rts
  36895. ; ---------------------------------------------------------------------------
  36896. ; loc_1C49E:
  36897. Tails_BrakeRollingRight:
  36898. sub.w d4,d0 ; reduce rightward rolling speed
  36899. bcc.s +
  36900. move.w #-$80,d0
  36901. +
  36902. move.w d0,inertia(a0)
  36903. rts
  36904. ; End of function Tails_RollLeft
  36905.  
  36906.  
  36907. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36908.  
  36909.  
  36910. ; loc_1C4AC:
  36911. Tails_RollRight:
  36912. move.w inertia(a0),d0
  36913. bmi.s Tails_BrakeRollingLeft
  36914. bclr #0,status(a0)
  36915. move.b #AniIDTailsAni_Roll,anim(a0) ; use "rolling" animation
  36916. rts
  36917. ; ---------------------------------------------------------------------------
  36918. ; loc_1C4C0:
  36919. Tails_BrakeRollingLeft:
  36920. add.w d4,d0 ; reduce leftward rolling speed
  36921. bcc.s +
  36922. move.w #$80,d0
  36923. +
  36924. move.w d0,inertia(a0)
  36925. rts
  36926. ; End of subroutine Tails_RollRight
  36927.  
  36928.  
  36929. ; ---------------------------------------------------------------------------
  36930. ; Subroutine for moving Tails left or right when he's in the air
  36931. ; ---------------------------------------------------------------------------
  36932.  
  36933. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  36934.  
  36935. ; loc_1C4CE:
  36936. Tails_ChgJumpDir:
  36937. move.w (Tails_top_speed).w,d6
  36938. move.w (Tails_acceleration).w,d5
  36939. asl.w #1,d5
  36940. btst #4,status(a0) ; did Tails jump from rolling?
  36941. bne.s Obj02_Jump_ResetScr ; if yes, branch to skip midair control
  36942. move.w x_vel(a0),d0
  36943. btst #button_left,(Ctrl_2_Held_Logical).w
  36944. beq.s + ; if not holding left, branch
  36945.  
  36946. bset #0,status(a0)
  36947. sub.w d5,d0 ; add acceleration to the left
  36948. move.w d6,d1
  36949. neg.w d1
  36950. cmp.w d1,d0 ; compare new speed with top speed
  36951. bgt.s + ; if new speed is less than the maximum, branch
  36952. move.w d1,d0 ; limit speed in air going left, even if Tails was already going faster (speed limit/cap)
  36953. +
  36954. btst #button_right,(Ctrl_2_Held_Logical).w
  36955. beq.s + ; if not holding right, branch
  36956.  
  36957. bclr #0,status(a0)
  36958. add.w d5,d0 ; accelerate right in the air
  36959. cmp.w d6,d0 ; compare new speed with top speed
  36960. blt.s + ; if new speed is less than the maximum, branch
  36961. move.w d6,d0 ; limit speed in air going right, even if Tails was already going faster (speed limit/cap)
  36962. ; Obj02_JumpMove:
  36963. + move.w d0,x_vel(a0)
  36964.  
  36965. ; loc_1C518: Obj02_ResetScr2:
  36966. Obj02_Jump_ResetScr:
  36967. cmpi.w #(224/2)-16,(Camera_Y_pos_bias_P2).w ; is screen in its default position?
  36968. beq.s Tails_JumpPeakDecelerate ; if yes, branch
  36969. bhs.s + ; depending on the sign of the difference,
  36970. addq.w #4,(Camera_Y_pos_bias_P2).w ; either add 2
  36971. + subq.w #2,(Camera_Y_pos_bias_P2).w ; or subtract 2
  36972.  
  36973. ; loc_1C52A:
  36974. Tails_JumpPeakDecelerate:
  36975. cmpi.w #-$400,y_vel(a0) ; is Tails moving faster than -$400 upwards?
  36976. blo.s return_1C558 ; if yes, return
  36977. move.w x_vel(a0),d0
  36978. move.w d0,d1
  36979. asr.w #5,d1 ; d1 = x_velocity / 32
  36980. beq.s return_1C558 ; return if d1 is 0
  36981. bmi.s Tails_JumpPeakDecelerateLeft
  36982.  
  36983. ; Tails_JumpPeakDecelerateRight:
  36984. sub.w d1,d0 ; reduce x velocity by d1
  36985. bcc.s +
  36986. move.w #0,d0
  36987. +
  36988. move.w d0,x_vel(a0)
  36989. rts
  36990. ; ---------------------------------------------------------------------------
  36991. ; loc_1C54C:
  36992. Tails_JumpPeakDecelerateLeft:
  36993. sub.w d1,d0 ; reduce x velocity by d1
  36994. bcs.s +
  36995. move.w #0,d0
  36996. +
  36997. move.w d0,x_vel(a0)
  36998.  
  36999. return_1C558:
  37000. rts
  37001. ; End of subroutine Tails_ChgJumpDir
  37002. ; ===========================================================================
  37003.  
  37004. ; ---------------------------------------------------------------------------
  37005. ; Subroutine to prevent Tails from leaving the boundaries of a level
  37006. ; ---------------------------------------------------------------------------
  37007.  
  37008. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37009.  
  37010. ; loc_1C55A:
  37011. Tails_LevelBound:
  37012. move.l x_pos(a0),d1
  37013. move.w x_vel(a0),d0
  37014. ext.l d0
  37015. asl.l #8,d0
  37016. add.l d0,d1
  37017. swap d1
  37018. move.w (Tails_Min_X_pos).w,d0
  37019. addi.w #$10,d0
  37020. cmp.w d1,d0 ; has Tails touched the left boundary?
  37021. bhi.s Tails_Boundary_Sides ; if yes, branch
  37022. move.w (Tails_Max_X_pos).w,d0
  37023. addi.w #$128,d0
  37024. tst.b (Current_Boss_ID).w
  37025. bne.s +
  37026. addi.w #$40,d0
  37027. +
  37028. cmp.w d1,d0 ; has Tails touched the right boundary?
  37029. bls.s Tails_Boundary_Sides ; if yes, branch
  37030.  
  37031. ; loc_1C58C:
  37032. Tails_Boundary_CheckBottom:
  37033. move.w (Tails_Max_Y_pos).w,d0
  37034. addi.w #$E0,d0
  37035. cmp.w y_pos(a0),d0 ; has Tails touched the bottom boundary?
  37036. blt.s Tails_Boundary_Bottom ; if yes, branch
  37037. rts
  37038. ; ---------------------------------------------------------------------------
  37039. Tails_Boundary_Bottom: ;;
  37040. jmpto (KillCharacter).l, JmpTo2_KillCharacter
  37041. ; ===========================================================================
  37042.  
  37043. ; loc_1C5A0:
  37044. Tails_Boundary_Sides:
  37045. move.w d0,x_pos(a0)
  37046. move.w #0,2+x_pos(a0) ; subpixel x
  37047. move.w #0,x_vel(a0)
  37048. move.w #0,inertia(a0)
  37049. bra.s Tails_Boundary_CheckBottom
  37050. ; ===========================================================================
  37051.  
  37052. ; ---------------------------------------------------------------------------
  37053. ; Subroutine allowing Tails to start rolling when he's moving
  37054. ; ---------------------------------------------------------------------------
  37055.  
  37056. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37057.  
  37058. ; loc_1C5B8:
  37059. Tails_Roll:
  37060. if status_sec_isSliding = 7
  37061. tst.b status_secondary(a0)
  37062. bmi.s Obj02_NoRoll
  37063. else
  37064. btst #status_sec_isSliding,status_secondary(a0)
  37065. bne.w Obj02_NoRoll
  37066. endif
  37067. mvabs.w inertia(a0),d0
  37068. cmpi.w #$80,d0 ; is Tails moving at $80 speed or faster?
  37069. blo.s Obj02_NoRoll ; if not, branch
  37070. move.b (Ctrl_2_Held_Logical).w,d0
  37071. andi.b #button_left_mask|button_right_mask,d0 ; is left/right being pressed?
  37072. bne.s Obj02_NoRoll ; if yes, branch
  37073. btst #button_down,(Ctrl_2_Held_Logical).w ; is down being pressed?
  37074. bne.s Obj02_ChkRoll ; if yes, branch
  37075. ; return_1C5DE:
  37076. Obj02_NoRoll:
  37077. rts
  37078.  
  37079. ; ---------------------------------------------------------------------------
  37080. ; loc_1C5E0:
  37081. Obj02_ChkRoll:
  37082. btst #2,status(a0) ; is Tails already rolling?
  37083. beq.s Obj02_DoRoll ; if not, branch
  37084. rts
  37085.  
  37086. ; ---------------------------------------------------------------------------
  37087. ; loc_1C5EA:
  37088. Obj02_DoRoll:
  37089. bset #2,status(a0)
  37090. move.b #$E,y_radius(a0)
  37091. move.b #7,x_radius(a0)
  37092. move.b #AniIDTailsAni_Roll,anim(a0) ; use "rolling" animation
  37093. addq.w #1,y_pos(a0)
  37094. move.w #SndID_Roll,d0
  37095. jsr (PlaySound).l ; play rolling sound
  37096. tst.w inertia(a0)
  37097. bne.s return_1C61C
  37098. move.w #$200,inertia(a0)
  37099.  
  37100. return_1C61C:
  37101. rts
  37102. ; End of function Tails_Roll
  37103.  
  37104.  
  37105. ; ---------------------------------------------------------------------------
  37106. ; Subroutine allowing Tails to jump
  37107. ; ---------------------------------------------------------------------------
  37108.  
  37109. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37110.  
  37111. ; loc_1C61E:
  37112. Tails_Jump:
  37113. move.b (Ctrl_2_Press_Logical).w,d0
  37114. andi.b #button_B_mask|button_C_mask|button_A_mask,d0 ; is A, B or C pressed?
  37115. beq.w return_1C6C2 ; if not, return
  37116. moveq #0,d0
  37117. move.b angle(a0),d0
  37118. addi.b #$80,d0
  37119. bsr.w CalcRoomOverHead
  37120. cmpi.w #6,d1 ; does Tails have enough room to jump?
  37121. blt.w return_1C6C2 ; if not, branch
  37122. move.w #$680,d2
  37123. btst #6,status(a0) ; Test if underwater
  37124. beq.s +
  37125. move.w #$380,d2 ; set lower jump speed if underwater
  37126. +
  37127. moveq #0,d0
  37128. move.b angle(a0),d0
  37129. subi.b #$40,d0
  37130. jsr (CalcSine).l
  37131. muls.w d2,d1
  37132. asr.l #8,d1
  37133. add.w d1,x_vel(a0) ; make Tails jump (in X... this adds nothing on level ground)
  37134. muls.w d2,d0
  37135. asr.l #8,d0
  37136. add.w d0,y_vel(a0) ; make Tails jump (in Y)
  37137. bset #1,status(a0)
  37138. bclr #5,status(a0)
  37139. addq.l #4,sp
  37140. move.b #1,jumping(a0)
  37141. clr.b stick_to_convex(a0)
  37142. move.w #SndID_Jump,d0
  37143. jsr (PlaySound).l ; play jumping sound
  37144. move.b #$F,y_radius(a0)
  37145. move.b #9,x_radius(a0)
  37146. btst #2,status(a0)
  37147. bne.s Tails_RollJump
  37148. move.b #$E,y_radius(a0)
  37149. move.b #7,x_radius(a0)
  37150. move.b #AniIDTailsAni_Roll,anim(a0) ; use "jumping" animation
  37151. bset #2,status(a0)
  37152. addq.w #1,y_pos(a0)
  37153.  
  37154. return_1C6C2:
  37155. rts
  37156. ; ---------------------------------------------------------------------------
  37157. ; loc_1C6C4:
  37158. Tails_RollJump:
  37159. bset #4,status(a0) ; set the rolling+jumping flag
  37160. rts
  37161. ; End of function Tails_Jump
  37162.  
  37163.  
  37164. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37165.  
  37166. ; ===========================================================================
  37167. ; loc_1C6CC:
  37168. Tails_JumpHeight:
  37169. tst.b jumping(a0) ; is Tails jumping?
  37170. beq.s Tails_UpVelCap ; if not, branch
  37171.  
  37172. move.w #-$400,d1
  37173. btst #6,status(a0) ; is Tails underwater?
  37174. beq.s + ; if not, branch
  37175. move.w #-$200,d1
  37176. +
  37177. cmp.w y_vel(a0),d1 ; is Tails going up faster than d1?
  37178. ble.s + ; if not, branch
  37179. move.b (Ctrl_2_Held_Logical).w,d0
  37180. andi.b #button_B_mask|button_C_mask|button_A_mask,d0 ; is a jump button pressed?
  37181. bne.s + ; if yes, branch
  37182. move.w d1,y_vel(a0) ; immediately reduce Tails's upward speed to d1
  37183. +
  37184. rts
  37185. ; ---------------------------------------------------------------------------
  37186. ; loc_1C6F8:
  37187. Tails_UpVelCap:
  37188. tst.b pinball_mode(a0) ; is Tails charging a spindash or in a rolling-only area?
  37189. bne.s return_1C70C ; if yes, return
  37190. cmpi.w #-$FC0,y_vel(a0) ; is Tails moving up really fast?
  37191. bge.s return_1C70C ; if not, return
  37192. move.w #-$FC0,y_vel(a0) ; cap upward speed
  37193.  
  37194. return_1C70C:
  37195. rts
  37196. ; End of subroutine Tails_JumpHeight
  37197.  
  37198. ; ---------------------------------------------------------------------------
  37199. ; Subroutine to check for starting to charge a spindash
  37200. ; ---------------------------------------------------------------------------
  37201.  
  37202. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37203.  
  37204. ; loc_1C70E:
  37205. Tails_CheckSpindash:
  37206. tst.b spindash_flag(a0)
  37207. bne.s Tails_UpdateSpindash
  37208. cmpi.b #AniIDTailsAni_Duck,anim(a0)
  37209. bne.s return_1C75C
  37210. move.b (Ctrl_2_Press_Logical).w,d0
  37211. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  37212. beq.w return_1C75C
  37213. move.b #AniIDTailsAni_Spindash,anim(a0)
  37214. move.w #SndID_SpindashRev,d0
  37215. jsr (PlaySound).l
  37216. addq.l #4,sp
  37217. move.b #1,spindash_flag(a0)
  37218. move.w #0,spindash_counter(a0)
  37219. cmpi.b #$C,air_left(a0) ; if he's drowning, branch to not make dust
  37220. blo.s loc_1C754
  37221. move.b #2,(Tails_Dust+anim).w
  37222.  
  37223. loc_1C754:
  37224. bsr.w Tails_LevelBound
  37225. bsr.w AnglePos
  37226.  
  37227. return_1C75C:
  37228. rts
  37229. ; End of subroutine Tails_CheckSpindash
  37230.  
  37231.  
  37232. ; ---------------------------------------------------------------------------
  37233. ; Subrouting to update an already-charging spindash
  37234. ; ---------------------------------------------------------------------------
  37235.  
  37236. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37237.  
  37238. ; loc_1C75E:
  37239. Tails_UpdateSpindash:
  37240. move.b (Ctrl_2_Held_Logical).w,d0
  37241. btst #button_down,d0
  37242. bne.s Tails_ChargingSpindash
  37243.  
  37244. ; unleash the charged spindash and start rolling quickly:
  37245. move.b #$E,y_radius(a0)
  37246. move.b #7,x_radius(a0)
  37247. move.b #AniIDTailsAni_Roll,anim(a0)
  37248. addq.w #1,y_pos(a0) ; add the difference between Tails' rolling and standing heights
  37249. move.b #0,spindash_flag(a0)
  37250. moveq #0,d0
  37251. move.b spindash_counter(a0),d0
  37252. add.w d0,d0
  37253. move.w Tails_SpindashSpeeds(pc,d0.w),inertia(a0)
  37254. move.w inertia(a0),d0
  37255. subi.w #$800,d0
  37256. add.w d0,d0
  37257. andi.w #$1F00,d0
  37258. neg.w d0
  37259. addi.w #$2000,d0
  37260. move.w d0,(Horiz_scroll_delay_val_P2).w
  37261. btst #0,status(a0)
  37262. beq.s +
  37263. neg.w inertia(a0)
  37264. +
  37265. bset #2,status(a0)
  37266. move.b #0,(Tails_Dust+anim).w
  37267. move.w #SndID_SpindashRelease,d0 ; spindash zoom sound
  37268. jsr (PlaySound).l
  37269. bra.s loc_1C828
  37270. ; ===========================================================================
  37271. ; word_1C7CE:
  37272. Tails_SpindashSpeeds:
  37273. dc.w $800 ; 0
  37274. dc.w $880 ; 1
  37275. dc.w $900 ; 2
  37276. dc.w $980 ; 3
  37277. dc.w $A00 ; 4
  37278. dc.w $A80 ; 5
  37279. dc.w $B00 ; 6
  37280. dc.w $B80 ; 7
  37281. dc.w $C00 ; 8
  37282. ; ===========================================================================
  37283. ; loc_1C7E0:
  37284. Tails_ChargingSpindash: ; If still charging the dash...
  37285. tst.w spindash_counter(a0)
  37286. beq.s loc_1C7F8
  37287. move.w spindash_counter(a0),d0
  37288. lsr.w #5,d0
  37289. sub.w d0,spindash_counter(a0)
  37290. bcc.s loc_1C7F8
  37291. move.w #0,spindash_counter(a0)
  37292.  
  37293. loc_1C7F8:
  37294. move.b (Ctrl_2_Press_Logical).w,d0
  37295. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  37296. beq.w loc_1C828
  37297. move.w #(AniIDTailsAni_Spindash<<8),anim(a0)
  37298. move.w #SndID_SpindashRev,d0
  37299. jsr (PlaySound).l
  37300. addi.w #$200,spindash_counter(a0)
  37301. cmpi.w #$800,spindash_counter(a0)
  37302. blo.s loc_1C828
  37303. move.w #$800,spindash_counter(a0)
  37304.  
  37305. loc_1C828:
  37306. addq.l #4,sp
  37307. cmpi.w #(224/2)-16,(Camera_Y_pos_bias_P2).w
  37308. beq.s loc_1C83C
  37309. bhs.s +
  37310. addq.w #4,(Camera_Y_pos_bias_P2).w
  37311. + subq.w #2,(Camera_Y_pos_bias_P2).w
  37312.  
  37313. loc_1C83C:
  37314. bsr.w Tails_LevelBound
  37315. bsr.w AnglePos
  37316. rts
  37317. ; End of subroutine Tails_UpdateSpindash
  37318.  
  37319.  
  37320. ; ---------------------------------------------------------------------------
  37321. ; Subroutine to slow Tails walking up a slope
  37322. ; ---------------------------------------------------------------------------
  37323.  
  37324. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37325.  
  37326. ; loc_1C846:
  37327. Tails_SlopeResist:
  37328. move.b angle(a0),d0
  37329. addi.b #$60,d0
  37330. cmpi.b #$C0,d0
  37331. bhs.s return_1C87A
  37332. move.b angle(a0),d0
  37333. jsr (CalcSine).l
  37334. muls.w #$20,d0
  37335. asr.l #8,d0
  37336. tst.w inertia(a0)
  37337. beq.s return_1C87A
  37338. bmi.s loc_1C876
  37339. tst.w d0
  37340. beq.s +
  37341. add.w d0,inertia(a0) ; change Tails' $14
  37342. +
  37343. rts
  37344. ; ---------------------------------------------------------------------------
  37345.  
  37346. loc_1C876:
  37347. add.w d0,inertia(a0)
  37348.  
  37349. return_1C87A:
  37350. rts
  37351. ; End of subroutine Tails_SlopeResist
  37352.  
  37353. ; ---------------------------------------------------------------------------
  37354. ; Subroutine to push Tails down a slope while he's rolling
  37355. ; ---------------------------------------------------------------------------
  37356.  
  37357. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37358.  
  37359. ; loc_1C87C:
  37360. Tails_RollRepel:
  37361. move.b angle(a0),d0
  37362. addi.b #$60,d0
  37363. cmpi.b #-$40,d0
  37364. bhs.s return_1C8B6
  37365. move.b angle(a0),d0
  37366. jsr (CalcSine).l
  37367. muls.w #$50,d0
  37368. asr.l #8,d0
  37369. tst.w inertia(a0)
  37370. bmi.s loc_1C8AC
  37371. tst.w d0
  37372. bpl.s loc_1C8A6
  37373. asr.l #2,d0
  37374.  
  37375. loc_1C8A6:
  37376. add.w d0,inertia(a0)
  37377. rts
  37378. ; ===========================================================================
  37379.  
  37380. loc_1C8AC:
  37381. tst.w d0
  37382. bmi.s loc_1C8B2
  37383. asr.l #2,d0
  37384.  
  37385. loc_1C8B2:
  37386. add.w d0,inertia(a0)
  37387.  
  37388. return_1C8B6:
  37389. rts
  37390. ; End of function Tails_RollRepel
  37391.  
  37392. ; ---------------------------------------------------------------------------
  37393. ; Subroutine to push Tails down a slope
  37394. ; ---------------------------------------------------------------------------
  37395.  
  37396. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37397.  
  37398. ; loc_1C8B8:
  37399. Tails_SlopeRepel:
  37400. nop
  37401. tst.b stick_to_convex(a0)
  37402. bne.s return_1C8F2
  37403. tst.w move_lock(a0)
  37404. bne.s loc_1C8F4
  37405. move.b angle(a0),d0
  37406. addi.b #$20,d0
  37407. andi.b #$C0,d0
  37408. beq.s return_1C8F2
  37409. mvabs.w inertia(a0),d0
  37410. cmpi.w #$280,d0
  37411. bhs.s return_1C8F2
  37412. clr.w inertia(a0)
  37413. bset #1,status(a0)
  37414. move.w #$1E,move_lock(a0)
  37415.  
  37416. return_1C8F2:
  37417. rts
  37418. ; ===========================================================================
  37419.  
  37420. loc_1C8F4:
  37421. subq.w #1,move_lock(a0)
  37422. rts
  37423. ; End of function Tails_SlopeRepel
  37424.  
  37425. ; ---------------------------------------------------------------------------
  37426. ; Subroutine to return Tails' angle to 0 as he jumps
  37427. ; ---------------------------------------------------------------------------
  37428.  
  37429. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37430.  
  37431. ; loc_1C8FA:
  37432. Tails_JumpAngle:
  37433. move.b angle(a0),d0 ; get Tails' angle
  37434. beq.s Tails_JumpFlip ; if already 0, branch
  37435. bpl.s loc_1C90A ; if higher than 0, branch
  37436.  
  37437. addq.b #2,d0 ; increase angle
  37438. bcc.s BranchTo_Tails_JumpAngleSet
  37439. moveq #0,d0
  37440.  
  37441. BranchTo_Tails_JumpAngleSet
  37442. bra.s Tails_JumpAngleSet
  37443. ; ===========================================================================
  37444.  
  37445. loc_1C90A:
  37446. subq.b #2,d0 ; decrease angle
  37447. bcc.s Tails_JumpAngleSet
  37448. moveq #0,d0
  37449.  
  37450. ; loc_1C910:
  37451. Tails_JumpAngleSet:
  37452. move.b d0,angle(a0)
  37453. ; End of function Tails_JumpAngle
  37454. ; continue straight to Tails_JumpFlip
  37455.  
  37456. ; ---------------------------------------------------------------------------
  37457. ; Updates Tails' secondary angle if he's tumbling
  37458. ; ---------------------------------------------------------------------------
  37459.  
  37460. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37461.  
  37462. ; loc_1C914:
  37463. Tails_JumpFlip:
  37464. move.b flip_angle(a0),d0
  37465. beq.s return_1C958
  37466. tst.w inertia(a0)
  37467. bmi.s Tails_JumpLeftFlip
  37468. ; loc_1C920:
  37469. Tails_JumpRightFlip:
  37470. move.b flip_speed(a0),d1
  37471. add.b d1,d0
  37472. bcc.s BranchTo_Tails_JumpFlipSet
  37473. subq.b #1,flips_remaining(a0)
  37474. bcc.s BranchTo_Tails_JumpFlipSet
  37475. move.b #0,flips_remaining(a0)
  37476. moveq #0,d0
  37477.  
  37478. BranchTo_Tails_JumpFlipSet
  37479. bra.s Tails_JumpFlipSet
  37480. ; ===========================================================================
  37481. ; loc_1C938:
  37482. Tails_JumpLeftFlip:
  37483. tst.b flip_turned(a0)
  37484. bne.s Tails_JumpRightFlip
  37485. move.b flip_speed(a0),d1
  37486. sub.b d1,d0
  37487. bcc.s Tails_JumpFlipSet
  37488. subq.b #1,flips_remaining(a0)
  37489. bcc.s Tails_JumpFlipSet
  37490. move.b #0,flips_remaining(a0)
  37491. moveq #0,d0
  37492. ; loc_1C954:
  37493. Tails_JumpFlipSet:
  37494. move.b d0,flip_angle(a0)
  37495.  
  37496. return_1C958:
  37497. rts
  37498. ; End of function Tails_JumpFlip
  37499.  
  37500. ; ---------------------------------------------------------------------------
  37501. ; Subroutine for Tails to interact with the floor and walls when he's in the air
  37502. ; ---------------------------------------------------------------------------
  37503.  
  37504. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37505.  
  37506. ; loc_1C95A: Tails_Floor:
  37507. Tails_DoLevelCollision:
  37508. move.l #Primary_Collision,(Collision_addr).w
  37509. cmpi.b #$C,top_solid_bit(a0)
  37510. beq.s +
  37511. move.l #Secondary_Collision,(Collision_addr).w
  37512. +
  37513. move.b lrb_solid_bit(a0),d5
  37514. move.w x_vel(a0),d1
  37515. move.w y_vel(a0),d2
  37516. jsr (CalcAngle).l
  37517. subi.b #$20,d0
  37518. andi.b #$C0,d0
  37519. cmpi.b #$40,d0
  37520. beq.w Tails_HitLeftWall
  37521. cmpi.b #$80,d0
  37522. beq.w Tails_HitCeilingAndWalls
  37523. cmpi.b #$C0,d0
  37524. beq.w Tails_HitRightWall
  37525. bsr.w CheckLeftWallDist
  37526. tst.w d1
  37527. bpl.s +
  37528. sub.w d1,x_pos(a0)
  37529. move.w #0,x_vel(a0) ; stop Tails since he hit a wall
  37530. +
  37531. bsr.w CheckRightWallDist
  37532. tst.w d1
  37533. bpl.s +
  37534. add.w d1,x_pos(a0)
  37535. move.w #0,x_vel(a0) ; stop Tails since he hit a wall
  37536. +
  37537. bsr.w Sonic_CheckFloor
  37538. tst.w d1
  37539. bpl.s return_1CA3A
  37540. move.b y_vel(a0),d2
  37541. addq.b #8,d2
  37542. neg.b d2
  37543. cmp.b d2,d1
  37544. bge.s +
  37545. cmp.b d2,d0
  37546. blt.s return_1CA3A
  37547. +
  37548. add.w d1,y_pos(a0)
  37549. move.b d3,angle(a0)
  37550. bsr.w Tails_ResetOnFloor
  37551. move.b d3,d0
  37552. addi.b #$20,d0
  37553. andi.b #$40,d0
  37554. bne.s loc_1CA18
  37555. move.b d3,d0
  37556. addi.b #$10,d0
  37557. andi.b #$20,d0
  37558. beq.s loc_1CA0A
  37559. asr y_vel(a0)
  37560. bra.s loc_1CA2C
  37561. ; ===========================================================================
  37562.  
  37563. loc_1CA0A:
  37564. move.w #0,y_vel(a0)
  37565. move.w x_vel(a0),inertia(a0)
  37566. rts
  37567. ; ===========================================================================
  37568.  
  37569. loc_1CA18:
  37570. move.w #0,x_vel(a0) ; stop Tails since he hit a wall
  37571. cmpi.w #$FC0,y_vel(a0)
  37572. ble.s loc_1CA2C
  37573. move.w #$FC0,y_vel(a0)
  37574.  
  37575. loc_1CA2C:
  37576. move.w y_vel(a0),inertia(a0)
  37577. tst.b d3
  37578. bpl.s return_1CA3A
  37579. neg.w inertia(a0)
  37580.  
  37581. return_1CA3A:
  37582. rts
  37583. ; ===========================================================================
  37584. ; loc_1CA3C:
  37585. Tails_HitLeftWall:
  37586. bsr.w CheckLeftWallDist
  37587. tst.w d1
  37588. bpl.s Tails_HitCeiling ; branch if distance is positive (not inside wall)
  37589. sub.w d1,x_pos(a0)
  37590. move.w #0,x_vel(a0) ; stop Tails since he hit a wall
  37591. move.w y_vel(a0),inertia(a0)
  37592. rts
  37593. ; ===========================================================================
  37594. ; loc_1CA56:
  37595. Tails_HitCeiling:
  37596. bsr.w Sonic_CheckCeiling
  37597. tst.w d1
  37598. bpl.s Tails_HitFloor ; branch if distance is positive (not inside ceiling)
  37599. sub.w d1,y_pos(a0)
  37600. tst.w y_vel(a0)
  37601. bpl.s return_1CA6E
  37602. move.w #0,y_vel(a0) ; stop Tails in y since he hit a ceiling
  37603.  
  37604. return_1CA6E:
  37605. rts
  37606. ; ===========================================================================
  37607. ; loc_1CA70:
  37608. Tails_HitFloor:
  37609. tst.w y_vel(a0)
  37610. bmi.s return_1CA96
  37611. bsr.w Sonic_CheckFloor
  37612. tst.w d1
  37613. bpl.s return_1CA96
  37614. add.w d1,y_pos(a0)
  37615. move.b d3,angle(a0)
  37616. bsr.w Tails_ResetOnFloor
  37617. move.w #0,y_vel(a0)
  37618. move.w x_vel(a0),inertia(a0)
  37619.  
  37620. return_1CA96:
  37621. rts
  37622. ; ===========================================================================
  37623. ; loc_1CA98:
  37624. Tails_HitCeilingAndWalls:
  37625. bsr.w CheckLeftWallDist
  37626. tst.w d1
  37627. bpl.s +
  37628. sub.w d1,x_pos(a0)
  37629. move.w #0,x_vel(a0) ; stop Tails since he hit a wall
  37630. +
  37631. bsr.w CheckRightWallDist
  37632. tst.w d1
  37633. bpl.s +
  37634. add.w d1,x_pos(a0)
  37635. move.w #0,x_vel(a0) ; stop Tails since he hit a wall
  37636. +
  37637. bsr.w Sonic_CheckCeiling
  37638. tst.w d1
  37639. bpl.s return_1CAF2
  37640. sub.w d1,y_pos(a0)
  37641. move.b d3,d0
  37642. addi.b #$20,d0
  37643. andi.b #$40,d0
  37644. bne.s loc_1CADC
  37645. move.w #0,y_vel(a0) ; stop Tails in y since he hit a ceiling
  37646. rts
  37647. ; ===========================================================================
  37648.  
  37649. loc_1CADC:
  37650. move.b d3,angle(a0)
  37651. bsr.w Tails_ResetOnFloor
  37652. move.w y_vel(a0),inertia(a0)
  37653. tst.b d3
  37654. bpl.s return_1CAF2
  37655. neg.w inertia(a0)
  37656.  
  37657. return_1CAF2:
  37658. rts
  37659. ; ===========================================================================
  37660. ; loc_1CAF4:
  37661. Tails_HitRightWall:
  37662. bsr.w CheckRightWallDist
  37663. tst.w d1
  37664. bpl.s Tails_HitCeiling2
  37665. add.w d1,x_pos(a0)
  37666. move.w #0,x_vel(a0) ; stop Tails since he hit a wall
  37667. move.w y_vel(a0),inertia(a0)
  37668. rts
  37669. ; ===========================================================================
  37670. ; identical to Tails_HitCeiling...
  37671. ; loc_1CB0E:
  37672. Tails_HitCeiling2:
  37673. bsr.w Sonic_CheckCeiling
  37674. tst.w d1
  37675. bpl.s Tails_HitFloor2
  37676. sub.w d1,y_pos(a0)
  37677. tst.w y_vel(a0)
  37678. bpl.s return_1CB26
  37679. move.w #0,y_vel(a0) ; stop Tails in y since he hit a ceiling
  37680.  
  37681. return_1CB26:
  37682. rts
  37683. ; ===========================================================================
  37684. ; identical to Tails_HitFloor...
  37685. ; loc_1CB28:
  37686. Tails_HitFloor2:
  37687. tst.w y_vel(a0)
  37688. bmi.s return_1CB4E
  37689. bsr.w Sonic_CheckFloor
  37690. tst.w d1
  37691. bpl.s return_1CB4E
  37692. add.w d1,y_pos(a0)
  37693. move.b d3,angle(a0)
  37694. bsr.w Tails_ResetOnFloor
  37695. move.w #0,y_vel(a0)
  37696. move.w x_vel(a0),inertia(a0)
  37697.  
  37698. return_1CB4E:
  37699. rts
  37700. ; End of function Tails_DoLevelCollision
  37701.  
  37702.  
  37703.  
  37704. ; ---------------------------------------------------------------------------
  37705. ; Subroutine to reset Tails' mode when he lands on the floor
  37706. ; ---------------------------------------------------------------------------
  37707.  
  37708. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37709.  
  37710. ; loc_1CB50:
  37711. Tails_ResetOnFloor:
  37712. tst.b pinball_mode(a0)
  37713. bne.s Tails_ResetOnFloor_Part3
  37714. move.b #AniIDTailsAni_Walk,anim(a0)
  37715. ; loc_1CB5C:
  37716. Tails_ResetOnFloor_Part2:
  37717. btst #2,status(a0)
  37718. beq.s Tails_ResetOnFloor_Part3
  37719. bclr #2,status(a0)
  37720. move.b #$F,y_radius(a0) ; this slightly increases Tails' collision height to standing
  37721. move.b #9,x_radius(a0)
  37722. move.b #AniIDTailsAni_Walk,anim(a0) ; use running/walking/standing animation
  37723. subq.w #1,y_pos(a0) ; move Tails up 1 pixel so the increased height doesn't push him slightly into the ground
  37724. ; loc_1CB80:
  37725. Tails_ResetOnFloor_Part3:
  37726. bclr #1,status(a0)
  37727. bclr #5,status(a0)
  37728. bclr #4,status(a0)
  37729. move.b #0,jumping(a0)
  37730. move.w #0,(Chain_Bonus_counter).w
  37731. move.b #0,flip_angle(a0)
  37732. move.b #0,flip_turned(a0)
  37733. move.b #0,flips_remaining(a0)
  37734. move.w #0,(Tails_Look_delay_counter).w
  37735. cmpi.b #AniIDTailsAni_Hang2,anim(a0)
  37736. bne.s return_1CBC4
  37737. move.b #AniIDTailsAni_Walk,anim(a0)
  37738.  
  37739. return_1CBC4:
  37740. rts
  37741. ; End of subroutine Tails_ResetOnFloor
  37742.  
  37743. ; ===========================================================================
  37744. ; ---------------------------------------------------------------------------
  37745. ; Tails when he gets hurt
  37746. ; ---------------------------------------------------------------------------
  37747. ; loc_1CBC6:
  37748. Obj02_Hurt:
  37749. jsr (ObjectMove).l
  37750. addi.w #$30,y_vel(a0)
  37751. btst #6,status(a0)
  37752. beq.s +
  37753. subi.w #$20,y_vel(a0)
  37754. +
  37755. cmpi.w #-$100,(Camera_Min_Y_pos).w
  37756. bne.s +
  37757. andi.w #$7FF,y_pos(a0)
  37758. +
  37759. bsr.w Tails_HurtStop
  37760. bsr.w Tails_LevelBound
  37761. bsr.w Tails_RecordPos
  37762. bsr.w Tails_Animate
  37763. bsr.w LoadTailsDynPLC
  37764. jmp (DisplaySprite).l
  37765. ; ===========================================================================
  37766. ; loc_1CC08:
  37767. Tails_HurtStop:
  37768. move.w (Tails_Max_Y_pos).w,d0
  37769. addi.w #$E0,d0
  37770. cmp.w y_pos(a0),d0
  37771. blt.w JmpTo2_KillCharacter
  37772. bsr.w Tails_DoLevelCollision
  37773. btst #1,status(a0)
  37774. bne.s return_1CC4E
  37775. moveq #0,d0
  37776. move.w d0,y_vel(a0)
  37777. move.w d0,x_vel(a0)
  37778. move.w d0,inertia(a0)
  37779. move.b d0,obj_control(a0)
  37780. move.b #AniIDTailsAni_Walk,anim(a0)
  37781. move.b #2,routine(a0) ; => Obj02_Control
  37782. move.w #$78,invulnerable_time(a0)
  37783. move.b #0,spindash_flag(a0)
  37784.  
  37785. return_1CC4E:
  37786. rts
  37787. ; ===========================================================================
  37788.  
  37789. ; ---------------------------------------------------------------------------
  37790. ; Tails when he dies
  37791. ; .
  37792. ; ---------------------------------------------------------------------------
  37793.  
  37794. ; loc_1CC50:
  37795. Obj02_Dead:
  37796. bsr.w Obj02_CheckGameOver
  37797. jsr (ObjectMoveAndFall).l
  37798. bsr.w Tails_RecordPos
  37799. bsr.w Tails_Animate
  37800. bsr.w LoadTailsDynPLC
  37801. jmp (DisplaySprite).l
  37802.  
  37803. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37804.  
  37805. ; loc_1CC6C:
  37806. Obj02_CheckGameOver:
  37807. cmpi.w #2,(Player_mode).w ; is it a Tails Alone game?
  37808. beq.w CheckGameOver ; if yes, branch... goodness, code reuse
  37809. move.b #1,(Scroll_lock_P2).w
  37810. move.b #0,spindash_flag(a0)
  37811. move.w (Tails_Max_Y_pos).w,d0
  37812. addi.w #$100,d0
  37813. cmp.w y_pos(a0),d0
  37814. bge.w return_1CD8E
  37815. move.b #2,routine(a0)
  37816. tst.w (Two_player_mode).w
  37817. bne.s Obj02_CheckGameOver_2Pmode
  37818. bra.w TailsCPU_Despawn
  37819. ; ---------------------------------------------------------------------------
  37820. ; loc_1CCA2:
  37821. Obj02_CheckGameOver_2Pmode:
  37822. addq.b #1,(Update_HUD_lives_2P).w
  37823. subq.b #1,(Life_count_2P).w
  37824. bne.s Obj02_ResetLevel
  37825. move.w #0,restart_countdown(a0)
  37826. move.b #ObjID_GameOver,(GameOver_GameText+id).w ; load Obj39
  37827. move.b #ObjID_GameOver,(GameOver_OverText+id).w ; load Obj39
  37828. move.b #1,(GameOver_OverText+mapping_frame).w
  37829. move.w a0,(GameOver_GameText+parent).w
  37830. clr.b (Time_Over_flag_2P).w
  37831. ; loc_1CCCC:
  37832. Obj02_Finished:
  37833. clr.b (Update_HUD_timer).w
  37834. clr.b (Update_HUD_timer_2P).w
  37835. move.b #8,routine(a0)
  37836. move.w #MusID_GameOver,d0
  37837. jsr (PlayMusic).l
  37838. moveq #PLCID_GameOver,d0
  37839. jmp (LoadPLC).l
  37840. ; End of function Obj02_CheckGameOver
  37841.  
  37842. ; ===========================================================================
  37843. ; ---------------------------------------------------------------------------
  37844. ; Tails when the level is restarted
  37845. ; ---------------------------------------------------------------------------
  37846. ; loc_1CCEC:
  37847. Obj02_ResetLevel:
  37848. tst.b (Time_Over_flag).w
  37849.  
  37850. if gameRevision=0
  37851. bne.s Obj02_ResetLevel_Part3
  37852. else
  37853. beq.s Obj02_ResetLevel_Part2
  37854. tst.b (Time_Over_flag_2P).w
  37855. beq.s Obj02_ResetLevel_Part3
  37856. move.w #0,restart_countdown(a0)
  37857. clr.b (Update_HUD_timer).w
  37858. clr.b (Update_HUD_timer_2P).w
  37859. move.b #8,routine(a0)
  37860. rts
  37861. endif
  37862.  
  37863. ; ---------------------------------------------------------------------------
  37864. Obj02_ResetLevel_Part2:
  37865. tst.b (Time_Over_flag_2P).w
  37866. beq.s Obj02_ResetLevel_Part3
  37867. move.w #0,restart_countdown(a0)
  37868. move.b #ObjID_TimeOver,(TimeOver_TimeText+id).w ; load Obj39
  37869. move.b #ObjID_TimeOver,(TimeOver_OverText+id).w ; load Obj39
  37870. move.b #2,(TimeOver_TimeText+mapping_frame).w
  37871. move.b #3,(TimeOver_OverText+mapping_frame).w
  37872. move.w a0,(TimeOver_TimeText+parent).w
  37873. bra.s Obj02_Finished
  37874. ; ---------------------------------------------------------------------------
  37875. Obj02_ResetLevel_Part3:
  37876. move.b #0,(Scroll_lock_P2).w
  37877. move.b #$A,routine(a0) ; => Obj02_Respawning
  37878. move.w (Saved_x_pos_2P).w,x_pos(a0)
  37879. move.w (Saved_y_pos_2P).w,y_pos(a0)
  37880. move.w (Saved_art_tile_2P).w,art_tile(a0)
  37881. move.w (Saved_Solid_bits_2P).w,top_solid_bit(a0)
  37882. clr.w (Ring_count_2P).w
  37883. clr.b (Extra_life_flags_2P).w
  37884. move.b #0,obj_control(a0)
  37885. move.b #5,anim(a0)
  37886. move.w #0,x_vel(a0)
  37887. move.w #0,y_vel(a0)
  37888. move.w #0,inertia(a0)
  37889. move.b #2,status(a0)
  37890. move.w #0,move_lock(a0)
  37891.  
  37892. return_1CD8E:
  37893. rts
  37894. ; ===========================================================================
  37895. ; ---------------------------------------------------------------------------
  37896. ; Tails when he's offscreen and waiting for the level to restart
  37897. ; ---------------------------------------------------------------------------
  37898. ; loc_1CD90:
  37899. Obj02_Gone:
  37900. tst.w restart_countdown(a0)
  37901. beq.s +
  37902. subq.w #1,restart_countdown(a0)
  37903. bne.s +
  37904. move.w #1,(Level_Inactive_flag).w
  37905. +
  37906. rts
  37907. ; ===========================================================================
  37908. ; ---------------------------------------------------------------------------
  37909. ; Tails when he's waiting for the camera to scroll back to where he respawned
  37910. ; ---------------------------------------------------------------------------
  37911. ; loc_1CDA4:
  37912. Obj02_Respawning:
  37913. tst.w (Camera_X_pos_diff_P2).w
  37914. bne.s +
  37915. tst.w (Camera_Y_pos_diff_P2).w
  37916. bne.s +
  37917. move.b #2,routine(a0)
  37918. +
  37919. bsr.w Tails_Animate
  37920. bsr.w LoadTailsDynPLC
  37921. jmp (DisplaySprite).l
  37922. ; ===========================================================================
  37923.  
  37924. ; ---------------------------------------------------------------------------
  37925. ; Subroutine to animate Tails' sprites
  37926. ; See also: AnimateSprite and Sonic_Animate
  37927. ; ---------------------------------------------------------------------------
  37928.  
  37929. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  37930.  
  37931. ; loc_1CDC4:
  37932. Tails_Animate:
  37933. lea (TailsAniData).l,a1
  37934. ; loc_1CDCA:
  37935. Tails_Animate_Part2:
  37936. moveq #0,d0
  37937. move.b anim(a0),d0
  37938. cmp.b next_anim(a0),d0 ; has animation changed?
  37939. beq.s TAnim_Do ; if not, branch
  37940. move.b d0,next_anim(a0) ; set to next animation
  37941. move.b #0,anim_frame(a0) ; reset animation frame
  37942. move.b #0,anim_frame_duration(a0) ; reset frame duration
  37943. bclr #5,status(a0)
  37944. ; loc_1CDEC:
  37945. TAnim_Do:
  37946. add.w d0,d0
  37947. adda.w (a1,d0.w),a1 ; calculate address of appropriate animation script
  37948. move.b (a1),d0
  37949. bmi.s TAnim_WalkRunZoom ; if animation is walk/run/roll/jump, branch
  37950. move.b status(a0),d1
  37951. andi.b #1,d1
  37952. andi.b #$FC,render_flags(a0)
  37953. or.b d1,render_flags(a0)
  37954. subq.b #1,anim_frame_duration(a0) ; subtract 1 from frame duration
  37955. bpl.s TAnim_Delay ; if time remains, branch
  37956. move.b d0,anim_frame_duration(a0) ; load frame duration
  37957. ; loc_1CE12:
  37958. TAnim_Do2:
  37959. moveq #0,d1
  37960. move.b anim_frame(a0),d1 ; load current frame number
  37961. move.b 1(a1,d1.w),d0 ; read sprite number from script
  37962. cmpi.b #$F0,d0
  37963. bhs.s TAnim_End_FF ; if animation is complete, branch
  37964. ; loc_1CE22:
  37965. TAnim_Next:
  37966. move.b d0,mapping_frame(a0) ; load sprite number
  37967. addq.b #1,anim_frame(a0) ; go to next frame
  37968. ; return_1CE2A:
  37969. TAnim_Delay:
  37970. rts
  37971. ; ===========================================================================
  37972. ; loc_1CE2C:
  37973. TAnim_End_FF:
  37974. addq.b #1,d0 ; is the end flag = $FF ?
  37975. bne.s TAnim_End_FE ; if not, branch
  37976. move.b #0,anim_frame(a0) ; restart the animation
  37977. move.b 1(a1),d0 ; read sprite number
  37978. bra.s TAnim_Next
  37979. ; ===========================================================================
  37980. ; loc_1CE3C:
  37981. TAnim_End_FE:
  37982. addq.b #1,d0 ; is the end flag = $FE ?
  37983. bne.s TAnim_End_FD ; if not, branch
  37984. move.b 2(a1,d1.w),d0 ; read the next byte in the script
  37985. sub.b d0,anim_frame(a0) ; jump back d0 bytes in the script
  37986. sub.b d0,d1
  37987. move.b 1(a1,d1.w),d0 ; read sprite number
  37988. bra.s TAnim_Next
  37989. ; ===========================================================================
  37990. ; loc_1CE50:
  37991. TAnim_End_FD:
  37992. addq.b #1,d0 ; is the end flag = $FD ?
  37993. bne.s TAnim_End ; if not, branch
  37994. move.b 2(a1,d1.w),anim(a0) ; read next byte, run that animation
  37995. ; return_1CE5A:
  37996. TAnim_End:
  37997. rts
  37998. ; ===========================================================================
  37999. ; loc_1CE5C:
  38000. TAnim_WalkRunZoom: ; a0=character
  38001. ; note: for some reason SAnim_WalkRun doesn't need to do this here...
  38002. subq.b #1,anim_frame_duration(a0) ; subtract 1 from Tails' frame duration
  38003. bpl.s TAnim_Delay ; if time remains, branch
  38004.  
  38005. addq.b #1,d0 ; is the end flag = $FF ?
  38006. bne.w TAnim_Roll ; if not, branch
  38007. moveq #0,d0 ; is animation walking/running?
  38008. move.b flip_angle(a0),d0 ; if not, branch
  38009. bne.w TAnim_Tumble
  38010. moveq #0,d1
  38011. move.b angle(a0),d0 ; get Tails' angle
  38012. bmi.s +
  38013. beq.s +
  38014. subq.b #1,d0
  38015. +
  38016. move.b status(a0),d2
  38017. andi.b #1,d2 ; is Tails mirrored horizontally?
  38018. bne.s + ; if yes, branch
  38019. not.b d0 ; reverse angle
  38020. +
  38021. addi.b #$10,d0 ; add $10 to angle
  38022. bpl.s + ; if angle is $0-$7F, branch
  38023. moveq #3,d1
  38024. +
  38025. andi.b #$FC,render_flags(a0)
  38026. eor.b d1,d2
  38027. or.b d2,render_flags(a0)
  38028. btst #5,status(a0)
  38029. bne.w TAnim_Push
  38030. lsr.b #4,d0 ; divide angle by 16
  38031. andi.b #6,d0 ; angle must be 0, 2, 4 or 6
  38032. mvabs.w inertia(a0),d2 ; get Tails' "speed" for animation purposes
  38033. if status_sec_isSliding = 7
  38034. tst.b status_secondary(a0)
  38035. bpl.w +
  38036. else
  38037. btst #status_sec_isSliding,status_secondary(a0)
  38038. beq.w +
  38039. endif
  38040. add.w d2,d2
  38041. +
  38042. move.b d0,d3
  38043. add.b d3,d3
  38044. add.b d3,d3
  38045. lea (TailsAni_Walk).l,a1
  38046.  
  38047. cmpi.w #$600,d2 ; is Tails going pretty fast?
  38048. blo.s TAnim_SpeedSelected ; if not, branch
  38049. lea (TailsAni_Run).l,a1
  38050. move.b d0,d1
  38051. lsr.b #1,d1
  38052. add.b d1,d0
  38053. add.b d0,d0
  38054. move.b d0,d3
  38055.  
  38056. cmpi.w #$700,d2 ; is Tails going really fast?
  38057. blo.s TAnim_SpeedSelected ; if not, branch
  38058. lea (TailsAni_HaulAss).l,a1
  38059.  
  38060. ; loc_1CEEE:
  38061. TAnim_SpeedSelected:
  38062. neg.w d2
  38063. addi.w #$800,d2
  38064. bpl.s +
  38065. moveq #0,d2
  38066. +
  38067. lsr.w #8,d2
  38068. move.b d2,anim_frame_duration(a0) ; modify frame duration
  38069. bsr.w TAnim_Do2
  38070. add.b d3,mapping_frame(a0)
  38071. rts
  38072. ; ===========================================================================
  38073. ; loc_1CF08
  38074. TAnim_Tumble:
  38075. move.b flip_angle(a0),d0
  38076. moveq #0,d1
  38077. move.b status(a0),d2
  38078. andi.b #1,d2
  38079. bne.s TAnim_Tumble_Left
  38080. andi.b #$FC,render_flags(a0)
  38081. addi.b #$B,d0
  38082. divu.w #$16,d0
  38083. addi.b #$75,d0
  38084. move.b d0,mapping_frame(a0)
  38085. move.b #0,anim_frame_duration(a0)
  38086. rts
  38087. ; ===========================================================================
  38088. ; loc_1CF36
  38089. TAnim_Tumble_Left:
  38090. andi.b #$FC,render_flags(a0)
  38091. tst.b flip_turned(a0)
  38092. beq.s +
  38093. ori.b #1,render_flags(a0)
  38094. addi.b #$B,d0
  38095. bra.s ++
  38096. ; ===========================================================================
  38097. +
  38098. ori.b #3,render_flags(a0)
  38099. neg.b d0
  38100. addi.b #$8F,d0
  38101. +
  38102. divu.w #$16,d0
  38103. addi.b #$75,d0
  38104. move.b d0,mapping_frame(a0)
  38105. move.b #0,anim_frame_duration(a0)
  38106. rts
  38107.  
  38108. ; ===========================================================================
  38109. ; loc_1CF6E:
  38110. TAnim_Roll:
  38111. addq.b #1,d0 ; is the end flag = $FE ?
  38112. bne.s TAnim_GetTailFrame ; if not, branch
  38113. mvabs.w inertia(a0),d2
  38114. lea (TailsAni_Roll2).l,a1
  38115. cmpi.w #$600,d2
  38116. bhs.s +
  38117. lea (TailsAni_Roll).l,a1
  38118. +
  38119. neg.w d2
  38120. addi.w #$400,d2
  38121. bpl.s +
  38122. moveq #0,d2
  38123. +
  38124. lsr.w #8,d2
  38125. move.b d2,anim_frame_duration(a0)
  38126. move.b status(a0),d1
  38127. andi.b #1,d1
  38128. andi.b #$FC,render_flags(a0)
  38129. or.b d1,render_flags(a0)
  38130. bra.w TAnim_Do2
  38131. ; ===========================================================================
  38132. ; loc_1CFB2
  38133. TAnim_Push:
  38134. move.w inertia(a0),d2
  38135. bmi.s +
  38136. neg.w d2
  38137. +
  38138. addi.w #$800,d2
  38139. bpl.s +
  38140. moveq #0,d2
  38141. +
  38142. lsr.w #6,d2
  38143. move.b d2,anim_frame_duration(a0)
  38144. lea (TailsAni_Push).l,a1
  38145. move.b status(a0),d1
  38146. andi.b #1,d1
  38147. andi.b #$FC,render_flags(a0)
  38148. or.b d1,render_flags(a0)
  38149. bra.w TAnim_Do2
  38150.  
  38151. ; ===========================================================================
  38152. ; loc_1CFE4:
  38153. TAnim_GetTailFrame:
  38154. move.w x_vel(a2),d1
  38155. move.w y_vel(a2),d2
  38156. jsr (CalcAngle).l
  38157. moveq #0,d1
  38158. move.b status(a0),d2
  38159. andi.b #1,d2
  38160. bne.s loc_1D002
  38161. not.b d0
  38162. bra.s loc_1D006
  38163. ; ===========================================================================
  38164.  
  38165. loc_1D002:
  38166. addi.b #$80,d0
  38167.  
  38168. loc_1D006:
  38169. addi.b #$10,d0
  38170. bpl.s +
  38171. moveq #3,d1
  38172. +
  38173. andi.b #$FC,render_flags(a0)
  38174. eor.b d1,d2
  38175. or.b d2,render_flags(a0)
  38176. lsr.b #3,d0
  38177. andi.b #$C,d0
  38178. move.b d0,d3
  38179. lea (Obj05Ani_Directional).l,a1
  38180. move.b #3,anim_frame_duration(a0)
  38181. bsr.w TAnim_Do2
  38182. add.b d3,mapping_frame(a0)
  38183. rts
  38184. ; ===========================================================================
  38185.  
  38186. ; ---------------------------------------------------------------------------
  38187. ; Animation script - Tails
  38188. ; ---------------------------------------------------------------------------
  38189. ; off_1D038:
  38190. TailsAniData: offsetTable
  38191. TailsAni_Walk_ptr: offsetTableEntry.w TailsAni_Walk ; 0 ; 0
  38192. TailsAni_Run_ptr: offsetTableEntry.w TailsAni_Run ; 1 ; 1
  38193. TailsAni_Roll_ptr: offsetTableEntry.w TailsAni_Roll ; 2 ; 2
  38194. TailsAni_Roll2_ptr: offsetTableEntry.w TailsAni_Roll2 ; 3 ; 3
  38195. TailsAni_Push_ptr: offsetTableEntry.w TailsAni_Push ; 4 ; 4
  38196. TailsAni_Wait_ptr: offsetTableEntry.w TailsAni_Wait ; 5 ; 5
  38197. TailsAni_Balance_ptr: offsetTableEntry.w TailsAni_Balance ; 6 ; 6
  38198. TailsAni_LookUp_ptr: offsetTableEntry.w TailsAni_LookUp ; 7 ; 7
  38199. TailsAni_Duck_ptr: offsetTableEntry.w TailsAni_Duck ; 8 ; 8
  38200. TailsAni_Spindash_ptr: offsetTableEntry.w TailsAni_Spindash ; 9 ; 9
  38201. TailsAni_Dummy1_ptr: offsetTableEntry.w TailsAni_Dummy1 ; 10 ; $A
  38202. TailsAni_Dummy2_ptr: offsetTableEntry.w TailsAni_Dummy2 ; 11 ; $B
  38203. TailsAni_Dummy3_ptr: offsetTableEntry.w TailsAni_Dummy3 ; 12 ; $C
  38204. TailsAni_Stop_ptr: offsetTableEntry.w TailsAni_Stop ; 13 ; $D
  38205. TailsAni_Float_ptr: offsetTableEntry.w TailsAni_Float ; 14 ; $E
  38206. TailsAni_Float2_ptr: offsetTableEntry.w TailsAni_Float2 ; 15 ; $F
  38207. TailsAni_Spring_ptr: offsetTableEntry.w TailsAni_Spring ; 16 ; $10
  38208. TailsAni_Hang_ptr: offsetTableEntry.w TailsAni_Hang ; 17 ; $11
  38209. TailsAni_Blink_ptr: offsetTableEntry.w TailsAni_Blink ; 18 ; $12
  38210. TailsAni_Blink2_ptr: offsetTableEntry.w TailsAni_Blink2 ; 19 ; $13
  38211. TailsAni_Hang2_ptr: offsetTableEntry.w TailsAni_Hang2 ; 20 ; $14
  38212. TailsAni_Bubble_ptr: offsetTableEntry.w TailsAni_Bubble ; 21 ; $15
  38213. TailsAni_DeathBW_ptr: offsetTableEntry.w TailsAni_DeathBW ; 22 ; $16
  38214. TailsAni_Drown_ptr: offsetTableEntry.w TailsAni_Drown ; 23 ; $17
  38215. TailsAni_Death_ptr: offsetTableEntry.w TailsAni_Death ; 24 ; $18
  38216. TailsAni_Hurt_ptr: offsetTableEntry.w TailsAni_Hurt ; 25 ; $19
  38217. TailsAni_Hurt2_ptr: offsetTableEntry.w TailsAni_Hurt2 ; 26 ; $1A
  38218. TailsAni_Slide_ptr: offsetTableEntry.w TailsAni_Slide ; 27 ; $1B
  38219. TailsAni_Blank_ptr: offsetTableEntry.w TailsAni_Blank ; 28 ; $1C
  38220. TailsAni_Dummy4_ptr: offsetTableEntry.w TailsAni_Dummy4 ; 29 ; $1D
  38221. TailsAni_Dummy5_ptr: offsetTableEntry.w TailsAni_Dummy5 ; 30 ; $1E
  38222. TailsAni_HaulAss_ptr: offsetTableEntry.w TailsAni_HaulAss ; 31 ; $1F
  38223. TailsAni_Fly_ptr: offsetTableEntry.w TailsAni_Fly ; 32 ; $20
  38224.  
  38225. TailsAni_Walk: dc.b $FF,$10,$11,$12,$13,$14,$15, $E, $F,$FF
  38226. rev02even
  38227. TailsAni_Run: dc.b $FF,$2E,$2F,$30,$31,$FF,$FF,$FF,$FF,$FF
  38228. rev02even
  38229. TailsAni_Roll: dc.b 1,$48,$47,$46,$FF
  38230. rev02even
  38231. TailsAni_Roll2: dc.b 1,$48,$47,$46,$FF
  38232. rev02even
  38233. TailsAni_Push: dc.b $FD,$63,$64,$65,$66,$FF,$FF,$FF,$FF,$FF
  38234. rev02even
  38235. TailsAni_Wait: dc.b 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1
  38236. dc.b 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1
  38237. dc.b 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
  38238. dc.b 6, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 6,$FE,$1C
  38239. rev02even
  38240. TailsAni_Balance: dc.b 9,$69,$69,$6A,$6A,$69,$69,$6A,$6A,$69,$69,$6A,$6A,$69,$69,$6A
  38241. dc.b $6A,$69,$69,$6A,$6A,$69,$6A,$FF
  38242. rev02even
  38243. TailsAni_LookUp: dc.b $3F, 4,$FF
  38244. rev02even
  38245. TailsAni_Duck: dc.b $3F,$5B,$FF
  38246. rev02even
  38247. TailsAni_Spindash: dc.b 0,$60,$61,$62,$FF
  38248. rev02even
  38249. TailsAni_Dummy1: dc.b $3F,$82,$FF
  38250. rev02even
  38251. TailsAni_Dummy2: dc.b 7, 8, 8, 9,$FD, 5
  38252. rev02even
  38253. TailsAni_Dummy3: dc.b 7, 9,$FD, 5
  38254. rev02even
  38255. TailsAni_Stop: dc.b 7,$67,$68,$67,$68,$FD, 0
  38256. rev02even
  38257. TailsAni_Float: dc.b 9,$6E,$73,$FF
  38258. rev02even
  38259. TailsAni_Float2: dc.b 9,$6E,$6F,$70,$71,$72,$FF
  38260. rev02even
  38261. TailsAni_Spring: dc.b 3,$59,$5A,$59,$5A,$59,$5A,$59,$5A,$59,$5A,$59,$5A,$FD, 0
  38262. rev02even
  38263. TailsAni_Hang: dc.b 5,$6C,$6D,$FF
  38264. rev02even
  38265. TailsAni_Blink: dc.b $F, 1, 2, 3,$FE, 1
  38266. rev02even
  38267. TailsAni_Blink2: dc.b $F, 1, 2,$FE, 1
  38268. rev02even
  38269. TailsAni_Hang2: dc.b $13,$85,$86,$FF
  38270. rev02even
  38271. TailsAni_Bubble: dc.b $B,$74,$74,$12,$13,$FD, 0
  38272. rev02even
  38273. TailsAni_DeathBW: dc.b $20,$5D,$FF
  38274. rev02even
  38275. TailsAni_Drown: dc.b $2F,$5D,$FF
  38276. rev02even
  38277. TailsAni_Death: dc.b 3,$5D,$FF
  38278. rev02even
  38279. TailsAni_Hurt: dc.b 3,$5D,$FF
  38280. rev02even
  38281. TailsAni_Hurt2: dc.b 3,$5C,$FF
  38282. rev02even
  38283. TailsAni_Slide: dc.b 9,$6B,$5C,$FF
  38284. rev02even
  38285. TailsAni_Blank: dc.b $77, 0,$FD, 0
  38286. rev02even
  38287. TailsAni_Dummy4: dc.b 3, 1, 2, 3, 4, 5, 6, 7, 8,$FF
  38288. rev02even
  38289. TailsAni_Dummy5: dc.b 3, 1, 2, 3, 4, 5, 6, 7, 8,$FF
  38290. rev02even
  38291. TailsAni_HaulAss: dc.b $FF,$32,$33,$FF
  38292. dc.b $FF,$FF,$FF,$FF,$FF,$FF
  38293. rev02even
  38294. TailsAni_Fly: dc.b 1,$5E,$5F,$FF
  38295. even
  38296.  
  38297. ; ===========================================================================
  38298.  
  38299. ; ---------------------------------------------------------------------------
  38300. ; Tails' Tails pattern loading subroutine
  38301. ; ---------------------------------------------------------------------------
  38302.  
  38303. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  38304.  
  38305. ; loc_1D184:
  38306. LoadTailsTailsDynPLC:
  38307. moveq #0,d0
  38308. move.b mapping_frame(a0),d0
  38309. cmp.b (TailsTails_LastLoadedDPLC).w,d0
  38310. beq.s return_1D1FE
  38311. move.b d0,(TailsTails_LastLoadedDPLC).w
  38312. lea (MapRUnc_Tails).l,a2
  38313. add.w d0,d0
  38314. adda.w (a2,d0.w),a2
  38315. move.w (a2)+,d5
  38316. subq.w #1,d5
  38317. bmi.s return_1D1FE
  38318. move.w #tiles_to_bytes(ArtTile_ArtUnc_Tails_Tails),d4
  38319. bra.s TPLC_ReadEntry
  38320.  
  38321. ; ---------------------------------------------------------------------------
  38322. ; Tails pattern loading subroutine
  38323. ; ---------------------------------------------------------------------------
  38324.  
  38325. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  38326.  
  38327. ; loc_1D1AC:
  38328. LoadTailsDynPLC:
  38329. moveq #0,d0
  38330. move.b mapping_frame(a0),d0 ; load frame number
  38331. ; loc_1D1B2:
  38332. LoadTailsDynPLC_Part2:
  38333. cmp.b (Tails_LastLoadedDPLC).w,d0
  38334. beq.s return_1D1FE
  38335. move.b d0,(Tails_LastLoadedDPLC).w
  38336. lea (MapRUnc_Tails).l,a2
  38337. add.w d0,d0
  38338. adda.w (a2,d0.w),a2
  38339. move.w (a2)+,d5
  38340. subq.w #1,d5
  38341. bmi.s return_1D1FE
  38342. move.w #tiles_to_bytes(ArtTile_ArtUnc_Tails),d4
  38343. ; loc_1D1D2:
  38344. TPLC_ReadEntry:
  38345. moveq #0,d1
  38346. move.w (a2)+,d1
  38347. move.w d1,d3
  38348. lsr.w #8,d3
  38349. andi.w #$F0,d3
  38350. addi.w #$10,d3
  38351. andi.w #$FFF,d1
  38352. lsl.l #5,d1
  38353. addi.l #ArtUnc_Tails,d1
  38354. move.w d4,d2
  38355. add.w d3,d4
  38356. add.w d3,d4
  38357. jsr (QueueDMATransfer).l
  38358. dbf d5,TPLC_ReadEntry ; repeat for number of entries
  38359.  
  38360. return_1D1FE:
  38361. rts
  38362. ; ===========================================================================
  38363. ; ----------------------------------------------------------------------------
  38364. ; Object 05 - Tails' tails
  38365. ; ----------------------------------------------------------------------------
  38366. ; Sprite_1D200:
  38367. Obj05:
  38368. moveq #0,d0
  38369. move.b routine(a0),d0
  38370. move.w Obj05_Index(pc,d0.w),d1
  38371. jmp Obj05_Index(pc,d1.w)
  38372. ; ===========================================================================
  38373. ; off_1D20E: Obj05_States:
  38374. Obj05_Index: offsetTable
  38375. offsetTableEntry.w Obj05_Init ; 0
  38376. offsetTableEntry.w Obj05_Main ; 2
  38377. ; ===========================================================================
  38378.  
  38379. Obj05_parent_prev_anim = objoff_30
  38380.  
  38381. ; loc_1D212
  38382. Obj05_Init:
  38383. addq.b #2,routine(a0) ; => Obj05_Main
  38384. move.l #MapUnc_Tails,mappings(a0)
  38385. move.w #make_art_tile(ArtTile_ArtUnc_Tails_Tails,0,0),art_tile(a0)
  38386. bsr.w Adjust2PArtPointer
  38387. move.b #2,priority(a0)
  38388. move.b #$18,width_pixels(a0)
  38389. move.b #4,render_flags(a0)
  38390.  
  38391. ; loc_1D23A:
  38392. Obj05_Main:
  38393. movea.w parent(a0),a2 ; a2=character
  38394. move.b angle(a2),angle(a0)
  38395. move.b status(a2),status(a0)
  38396. move.w x_pos(a2),x_pos(a0)
  38397. move.w y_pos(a2),y_pos(a0)
  38398. andi.w #drawing_mask,art_tile(a0)
  38399. tst.w art_tile(a2)
  38400. bpl.s +
  38401. ori.w #high_priority,art_tile(a0)
  38402. +
  38403. moveq #0,d0
  38404. move.b anim(a2),d0
  38405. btst #5,status(a2)
  38406. beq.s +
  38407. moveq #4,d0
  38408. +
  38409. ; This is here so Obj05Ani_Flick works
  38410. ; It changes anim(a0) itself, so we don't want the below code changing it as well
  38411. cmp.b Obj05_parent_prev_anim(a0),d0 ; Did Tails' animation change?
  38412. beq.s .display
  38413. move.b d0,Obj05_parent_prev_anim(a0)
  38414. move.b Obj05AniSelection(pc,d0.w),anim(a0) ; If so, update Tails' tails' animation
  38415. ; loc_1D288:
  38416. .display:
  38417. lea (Obj05AniData).l,a1
  38418. bsr.w Tails_Animate_Part2
  38419. bsr.w LoadTailsTailsDynPLC
  38420. jsr (DisplaySprite).l
  38421. rts
  38422. ; ===========================================================================
  38423. ; animation master script table for the tails
  38424. ; chooses which animation script to run depending on what Tails is doing
  38425. ; byte_1D29E:
  38426. Obj05AniSelection:
  38427. dc.b 0,0 ; TailsAni_Walk,Run ->
  38428. dc.b 3 ; TailsAni_Roll -> Directional
  38429. dc.b 3 ; TailsAni_Roll2 -> Directional
  38430. dc.b 9 ; TailsAni_Push -> Pushing
  38431. dc.b 1 ; TailsAni_Wait -> Swish
  38432. dc.b 0 ; TailsAni_Balance -> Blank
  38433. dc.b 2 ; TailsAni_LookUp -> Flick
  38434. dc.b 1 ; TailsAni_Duck -> Swish
  38435. dc.b 7 ; TailsAni_Spindash -> Spindash
  38436. dc.b 0,0,0 ; TailsAni_Dummy1,2,3 ->
  38437. dc.b 8 ; TailsAni_Stop -> Skidding
  38438. dc.b 0,0 ; TailsAni_Float,2 ->
  38439. dc.b 0 ; TailsAni_Spring ->
  38440. dc.b 0 ; TailsAni_Hang ->
  38441. dc.b 0,0 ; TailsAni_Blink,2 ->
  38442. dc.b $A ; TailsAni_Hang2 -> Hanging
  38443. dc.b 0 ; TailsAni_Bubble ->
  38444. dc.b 0,0,0,0 ; TailsAni_Death,2,3,4 ->
  38445. dc.b 0,0 ; TailsAni_Hurt,Slide ->
  38446. dc.b 0 ; TailsAni_Blank ->
  38447. dc.b 0,0 ; TailsAni_Dummy4,5 ->
  38448. dc.b 0 ; TailsAni_HaulAss ->
  38449. dc.b 0 ; TailsAni_Fly ->
  38450. even
  38451.  
  38452. ; ---------------------------------------------------------------------------
  38453. ; Animation script - Tails' tails
  38454. ; ---------------------------------------------------------------------------
  38455. ; off_1D2C0:
  38456. Obj05AniData: offsetTable
  38457. offsetTableEntry.w Obj05Ani_Blank ; 0
  38458. offsetTableEntry.w Obj05Ani_Swish ; 1
  38459. offsetTableEntry.w Obj05Ani_Flick ; 2
  38460. offsetTableEntry.w Obj05Ani_Directional ; 3
  38461. offsetTableEntry.w Obj05Ani_DownLeft ; 4
  38462. offsetTableEntry.w Obj05Ani_Down ; 5
  38463. offsetTableEntry.w Obj05Ani_DownRight ; 6
  38464. offsetTableEntry.w Obj05Ani_Spindash ; 7
  38465. offsetTableEntry.w Obj05Ani_Skidding ; 8
  38466. offsetTableEntry.w Obj05Ani_Pushing ; 9
  38467. offsetTableEntry.w Obj05Ani_Hanging ; $A
  38468.  
  38469. Obj05Ani_Blank: dc.b $20, 0,$FF
  38470. rev02even
  38471. Obj05Ani_Swish: dc.b 7, 9, $A, $B, $C, $D,$FF
  38472. rev02even
  38473. Obj05Ani_Flick: dc.b 3, 9, $A, $B, $C, $D,$FD, 1
  38474. rev02even
  38475. Obj05Ani_Directional: dc.b $FC,$49,$4A,$4B,$4C,$FF ; Tails is moving right
  38476. rev02even
  38477. Obj05Ani_DownLeft: dc.b 3,$4D,$4E,$4F,$50,$FF ; Tails is moving up-right
  38478. rev02even
  38479. Obj05Ani_Down: dc.b 3,$51,$52,$53,$54,$FF ; Tails is moving up
  38480. rev02even
  38481. Obj05Ani_DownRight: dc.b 3,$55,$56,$57,$58,$FF ; Tails is moving up-left
  38482. rev02even
  38483. Obj05Ani_Spindash: dc.b 2,$81,$82,$83,$84,$FF
  38484. rev02even
  38485. Obj05Ani_Skidding: dc.b 2,$87,$88,$89,$8A,$FF
  38486. rev02even
  38487. Obj05Ani_Pushing: dc.b 9,$87,$88,$89,$8A,$FF
  38488. rev02even
  38489. Obj05Ani_Hanging: dc.b 9,$81,$82,$83,$84,$FF
  38490. even
  38491.  
  38492. ; ===========================================================================
  38493.  
  38494. JmpTo2_KillCharacter
  38495. jmp (KillCharacter).l
  38496. ; ===========================================================================
  38497. align 4
  38498.  
  38499.  
  38500.  
  38501.  
  38502. ; ===========================================================================
  38503. ; ----------------------------------------------------------------------------
  38504. ; Object 0A - Small bubbles from Sonic's face while underwater
  38505. ; ----------------------------------------------------------------------------
  38506. ; Sprite_1D320:
  38507. Obj0A:
  38508. moveq #0,d0
  38509. move.b routine(a0),d0
  38510. move.w Obj0A_Index(pc,d0.w),d1
  38511. jmp Obj0A_Index(pc,d1.w)
  38512. ; ===========================================================================
  38513. ; off_1D32E: Obj0A_States:
  38514. Obj0A_Index: offsetTable
  38515. offsetTableEntry.w Obj0A_Init ; 0
  38516. offsetTableEntry.w Obj0A_Animate ; 2
  38517. offsetTableEntry.w Obj0A_ChkWater ; 4
  38518. offsetTableEntry.w Obj0A_Display ; 6
  38519. offsetTableEntry.w JmpTo5_DeleteObject ; 8
  38520. offsetTableEntry.w Obj0A_Countdown ; $A
  38521. offsetTableEntry.w Obj0A_AirLeft ; $C
  38522. offsetTableEntry.w Obj0A_DisplayNumber ; $E
  38523. offsetTableEntry.w JmpTo5_DeleteObject ; $10
  38524. ; ===========================================================================
  38525. ; loc_1D340: Obj0A_Main:
  38526. Obj0A_Init:
  38527. addq.b #2,routine(a0)
  38528. move.l #Obj24_MapUnc_1FBF6,mappings(a0)
  38529. tst.b parent+1(a0)
  38530. beq.s +
  38531. move.l #Obj24_MapUnc_1FC18,mappings(a0)
  38532. +
  38533. move.w #make_art_tile(ArtTile_ArtNem_BigBubbles,0,1),art_tile(a0)
  38534. move.b #$84,render_flags(a0)
  38535. move.b #$10,width_pixels(a0)
  38536. move.b #1,priority(a0)
  38537. move.b subtype(a0),d0
  38538. bpl.s loc_1D388
  38539. addq.b #8,routine(a0)
  38540. andi.w #$7F,d0
  38541. move.b d0,objoff_33(a0)
  38542. bra.w Obj0A_Countdown
  38543. ; ===========================================================================
  38544.  
  38545. loc_1D388:
  38546. move.b d0,anim(a0)
  38547. move.w x_pos(a0),objoff_30(a0)
  38548. move.w #-$88,y_vel(a0)
  38549.  
  38550. ; loc_1D398:
  38551. Obj0A_Animate:
  38552. lea (Ani_obj0A).l,a1
  38553. jsr (AnimateSprite).l
  38554.  
  38555. ; loc_1D3A4:
  38556. Obj0A_ChkWater:
  38557. move.w (Water_Level_1).w,d0
  38558. cmp.w y_pos(a0),d0 ; has bubble reached the water surface?
  38559. blo.s Obj0A_Wobble ; if not, branch
  38560. ; pop the bubble:
  38561. move.b #6,routine(a0)
  38562. addq.b #7,anim(a0)
  38563. cmpi.b #$D,anim(a0)
  38564. beq.s Obj0A_Display
  38565. blo.s Obj0A_Display
  38566. move.b #$D,anim(a0)
  38567. bra.s Obj0A_Display
  38568. ; ===========================================================================
  38569. ; loc_1D3CA:
  38570. Obj0A_Wobble:
  38571. tst.b (WindTunnel_flag).w
  38572. beq.s +
  38573. addq.w #4,objoff_30(a0)
  38574. +
  38575. move.b angle(a0),d0
  38576. addq.b #1,angle(a0)
  38577. andi.w #$7F,d0
  38578. lea (Obj0A_WobbleData).l,a1
  38579. move.b (a1,d0.w),d0
  38580. ext.w d0
  38581. add.w objoff_30(a0),d0
  38582. move.w d0,x_pos(a0)
  38583. bsr.s Obj0A_ShowNumber
  38584. jsr (ObjectMove).l
  38585. tst.b render_flags(a0)
  38586. bpl.s JmpTo4_DeleteObject
  38587. jmp (DisplaySprite).l
  38588. ; ===========================================================================
  38589.  
  38590. JmpTo4_DeleteObject
  38591. jmp (DeleteObject).l
  38592. ; ===========================================================================
  38593. ; loc_1D40E:
  38594. Obj0A_DisplayNumber:
  38595. movea.l objoff_3C(a0),a2 ; a2=character
  38596. cmpi.b #$C,air_left(a2)
  38597. bhi.s JmpTo5_DeleteObject
  38598.  
  38599. ; loc_1D41A:
  38600. Obj0A_Display:
  38601. bsr.s Obj0A_ShowNumber
  38602. lea (Ani_obj0A).l,a1
  38603. jsr (AnimateSprite).l
  38604. jmp (DisplaySprite).l
  38605. ; ===========================================================================
  38606.  
  38607. JmpTo5_DeleteObject
  38608. jmp (DeleteObject).l
  38609. ; ===========================================================================
  38610. ; loc_1D434:
  38611. Obj0A_AirLeft:
  38612. movea.l objoff_3C(a0),a2 ; a2=character
  38613. cmpi.b #$C,air_left(a2) ; check air remaining
  38614. bhi.s JmpTo6_DeleteObject ; if higher than $C, branch
  38615. subq.w #1,objoff_38(a0)
  38616. bne.s Obj0A_Display2
  38617. move.b #$E,routine(a0)
  38618. addq.b #7,anim(a0)
  38619. bra.s Obj0A_Display
  38620. ; ===========================================================================
  38621. ; loc_1D452:
  38622. Obj0A_Display2:
  38623. lea (Ani_obj0A).l,a1
  38624. jsr (AnimateSprite).l
  38625. bsr.w Obj0A_LoadCountdownArt
  38626. tst.b render_flags(a0)
  38627. bpl.s JmpTo6_DeleteObject
  38628. jmp (DisplaySprite).l
  38629. ; ===========================================================================
  38630.  
  38631. JmpTo6_DeleteObject
  38632. jmp (DeleteObject).l
  38633. ; ===========================================================================
  38634. ; loc_1D474:
  38635. Obj0A_ShowNumber:
  38636. tst.w objoff_38(a0)
  38637. beq.s return_1D4BE
  38638. subq.w #1,objoff_38(a0)
  38639. bne.s return_1D4BE
  38640. cmpi.b #7,anim(a0)
  38641. bhs.s return_1D4BE
  38642. move.w #$F,objoff_38(a0)
  38643. clr.w y_vel(a0)
  38644. move.b #$80,render_flags(a0)
  38645. move.w x_pos(a0),d0
  38646. sub.w (Camera_X_pos).w,d0
  38647. addi.w #$80,d0
  38648. move.w d0,x_pixel(a0)
  38649. move.w y_pos(a0),d0
  38650. sub.w (Camera_Y_pos).w,d0
  38651. addi.w #$80,d0
  38652. move.w d0,y_pixel(a0)
  38653. move.b #$C,routine(a0)
  38654.  
  38655. return_1D4BE:
  38656. rts
  38657. ; ===========================================================================
  38658. ; byte_1D4C0:
  38659. Obj0A_WobbleData:
  38660. dc.b 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2;16
  38661. dc.b 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3;32
  38662. dc.b 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2;48
  38663. dc.b 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0;64
  38664. dc.b 0,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-3,-3,-3,-3,-3;80
  38665. dc.b -3,-3,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4;96
  38666. dc.b -4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-3;112
  38667. dc.b -3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-1,-1,-1,-1,-1;128
  38668.  
  38669. ; Unused S1 leftover
  38670. ; This was used by LZ's water ripple effect in REV01
  38671. dc.b 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2;144
  38672. dc.b 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3;160
  38673. dc.b 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2;176
  38674. dc.b 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0;192
  38675. dc.b 0,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-3,-3,-3,-3,-3;208
  38676. dc.b -3,-3,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4;224
  38677. dc.b -4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-3;240
  38678. dc.b -3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-1,-1,-1,-1,-1;256
  38679. ; ===========================================================================
  38680. ; the countdown numbers go over the dust and splash effect tiles in VRAM
  38681. ; loc_1D5C0:
  38682. Obj0A_LoadCountdownArt:
  38683. moveq #0,d1
  38684. move.b mapping_frame(a0),d1
  38685. cmpi.b #8,d1
  38686. blo.s return_1D604
  38687. cmpi.b #$E,d1
  38688. bhs.s return_1D604
  38689. cmp.b objoff_2E(a0),d1
  38690. beq.s return_1D604
  38691. move.b d1,objoff_2E(a0)
  38692. subq.w #8,d1
  38693. move.w d1,d0
  38694. add.w d1,d1
  38695. add.w d0,d1
  38696. lsl.w #6,d1
  38697. addi.l #ArtUnc_Countdown,d1
  38698. move.w #tiles_to_bytes(ArtTile_ArtNem_SonicDust),d2
  38699. tst.b parent+1(a0)
  38700. beq.s +
  38701. move.w #tiles_to_bytes(ArtTile_ArtNem_TailsDust),d2
  38702. +
  38703. move.w #$60,d3
  38704. jsr (QueueDMATransfer).l
  38705.  
  38706. return_1D604:
  38707. rts
  38708. ; ===========================================================================
  38709.  
  38710. ; loc_1D606:
  38711. Obj0A_Countdown:
  38712. movea.l objoff_3C(a0),a2 ; a2=character
  38713. tst.w objoff_2C(a0)
  38714. bne.w loc_1D708
  38715. cmpi.b #6,routine(a2)
  38716. bhs.w return_1D81C
  38717. btst #6,status(a2)
  38718. beq.w return_1D81C
  38719. subq.w #1,objoff_38(a0)
  38720. bpl.w loc_1D72C
  38721. move.w #$3B,objoff_38(a0)
  38722. move.w #1,objoff_36(a0)
  38723. jsr (RandomNumber).l
  38724. andi.w #1,d0
  38725. move.b d0,objoff_34(a0)
  38726. moveq #0,d0
  38727. move.b air_left(a2),d0 ; check air remaining
  38728. cmpi.w #$19,d0
  38729. beq.s Obj0A_WarnSound ; play ding sound if air is $19
  38730. cmpi.w #$14,d0
  38731. beq.s Obj0A_WarnSound ; play ding sound if air is $14
  38732. cmpi.w #$F,d0
  38733. beq.s Obj0A_WarnSound ; play ding sound if air is $F
  38734. cmpi.w #$C,d0
  38735. bhi.s Obj0A_ReduceAir ; if air is above $C, branch
  38736. bne.s +
  38737. tst.b parent+1(a0)
  38738. bne.s +
  38739. move.w #MusID_Countdown,d0
  38740. jsr (PlayMusic).l ; play countdown music
  38741. +
  38742. subq.b #1,objoff_32(a0)
  38743. bpl.s Obj0A_ReduceAir
  38744. move.b objoff_33(a0),objoff_32(a0)
  38745. bset #7,objoff_36(a0)
  38746. bra.s Obj0A_ReduceAir
  38747. ; ===========================================================================
  38748. ; loc_1D68C:
  38749. Obj0A_WarnSound:
  38750. tst.b parent+1(a0)
  38751. bne.s Obj0A_ReduceAir
  38752. move.w #SndID_WaterWarning,d0
  38753. jsr (PlaySound).l ; play "ding-ding" warning sound
  38754.  
  38755. ; loc_1D69C:
  38756. Obj0A_ReduceAir:
  38757. subq.b #1,air_left(a2) ; subtract 1 from air remaining
  38758. bcc.w BranchTo_Obj0A_MakeItem ; if air is above 0, branch
  38759. move.b #$81,obj_control(a2) ; lock controls
  38760. move.w #SndID_Drown,d0
  38761. jsr (PlaySound).l ; play drowning sound
  38762. move.b #$A,objoff_34(a0)
  38763. move.w #1,objoff_36(a0)
  38764. move.w #$78,objoff_2C(a0)
  38765. movea.l a2,a1
  38766. bsr.w ResumeMusic
  38767. move.l a0,-(sp)
  38768. movea.l a2,a0
  38769. bsr.w Sonic_ResetOnFloor_Part2
  38770. move.b #$17,anim(a0) ; use Sonic's drowning animation
  38771. bset #1,status(a0)
  38772. bset #high_priority_bit,art_tile(a0)
  38773. move.w #0,y_vel(a0)
  38774. move.w #0,x_vel(a0)
  38775. move.w #0,inertia(a0)
  38776. movea.l (sp)+,a0 ; load 0bj address ; restore a0 = obj0A
  38777. cmpa.w #MainCharacter,a2
  38778. bne.s + ; if it isn't player 1, branch
  38779. move.b #1,(Deform_lock).w
  38780. +
  38781. rts
  38782. ; ===========================================================================
  38783.  
  38784. loc_1D708:
  38785. subq.w #1,objoff_2C(a0)
  38786. bne.s +
  38787. move.b #6,routine(a2)
  38788. rts
  38789. ; ---------------------------------------------------------------------------
  38790. + move.l a0,-(sp)
  38791. movea.l a2,a0
  38792. jsr (ObjectMove).l
  38793. addi.w #$10,y_vel(a0)
  38794. movea.l (sp)+,a0 ; load 0bj address
  38795. bra.s loc_1D72C
  38796. ; ===========================================================================
  38797.  
  38798. BranchTo_Obj0A_MakeItem
  38799. bra.s Obj0A_MakeItem
  38800. ; ===========================================================================
  38801.  
  38802. loc_1D72C:
  38803. tst.w objoff_36(a0)
  38804. beq.w return_1D81C
  38805. subq.w #1,objoff_3A(a0)
  38806. bpl.w return_1D81C
  38807.  
  38808. ; loc_1D73C:
  38809. Obj0A_MakeItem:
  38810. jsr (RandomNumber).l
  38811. andi.w #$F,d0
  38812. addq.w #8,d0
  38813. move.w d0,objoff_3A(a0)
  38814. jsr (SingleObjLoad).l
  38815. bne.w return_1D81C
  38816. _move.b id(a0),id(a1) ; load obj0A
  38817. move.w x_pos(a2),x_pos(a1) ; match its X position to Sonic
  38818. moveq #6,d0
  38819. btst #0,status(a2)
  38820. beq.s +
  38821. neg.w d0
  38822. move.b #$40,angle(a1)
  38823. +
  38824. add.w d0,x_pos(a1)
  38825. move.w y_pos(a2),y_pos(a1)
  38826. move.l objoff_3C(a0),objoff_3C(a1)
  38827. move.b #6,subtype(a1)
  38828. tst.w objoff_2C(a0)
  38829. beq.w loc_1D7C6
  38830.  
  38831. andi.w #7,objoff_3A(a0)
  38832. addi.w #0,objoff_3A(a0)
  38833. move.w y_pos(a2),d0
  38834. subi.w #$C,d0
  38835. move.w d0,y_pos(a1)
  38836. jsr (RandomNumber).l
  38837. move.b d0,angle(a1)
  38838. move.w (Timer_frames).w,d0
  38839. andi.b #3,d0
  38840. bne.s loc_1D812
  38841. move.b #$E,subtype(a1)
  38842. bra.s loc_1D812
  38843. ; ---------------------------------------------------------------------------
  38844. ; has something to do with making bubbles come out less regularly
  38845. ; when Sonic is almost drowning
  38846. loc_1D7C6:
  38847. btst #7,objoff_36(a0)
  38848. beq.s loc_1D812
  38849. moveq #0,d2
  38850. move.b air_left(a2),d2
  38851. cmpi.b #$C,d2
  38852. bhs.s loc_1D812
  38853. lsr.w #1,d2
  38854. jsr (RandomNumber).l
  38855. andi.w #3,d0
  38856. bne.s +
  38857. bset #6,objoff_36(a0)
  38858. bne.s loc_1D812
  38859. move.b d2,subtype(a1)
  38860. move.w #$1C,objoff_38(a1)
  38861. +
  38862. tst.b objoff_34(a0)
  38863. bne.s loc_1D812
  38864. bset #6,objoff_36(a0)
  38865. bne.s loc_1D812
  38866. move.b d2,subtype(a1)
  38867. move.w #$1C,objoff_38(a1)
  38868.  
  38869. loc_1D812:
  38870. subq.b #1,objoff_34(a0)
  38871. bpl.s return_1D81C
  38872. clr.w objoff_36(a0)
  38873.  
  38874. return_1D81C:
  38875. rts
  38876. ; ===========================================================================
  38877.  
  38878. ; ---------------------------------------------------------------------------
  38879. ; Subroutine to play music after a countdown (when Sonic leaves the water)
  38880. ; ---------------------------------------------------------------------------
  38881.  
  38882. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  38883.  
  38884. ; loc_1D81E:
  38885. ResumeMusic:
  38886. cmpi.b #$C,air_left(a1)
  38887. bhi.s ResumeMusic_Done ; branch if countdown hasn't started yet
  38888.  
  38889. cmpa.w #MainCharacter,a1
  38890. bne.s ResumeMusic_Done ; branch if it isn't player 1
  38891.  
  38892. move.w (Level_Music).w,d0 ; prepare to play current level's music
  38893.  
  38894. btst #status_sec_isInvincible,status_secondary(a1)
  38895. beq.s + ; branch if Sonic is not invincible
  38896. move.w #MusID_Invincible,d0 ; prepare to play invincibility music
  38897. +
  38898. tst.b (Super_Sonic_flag).w
  38899. beq.w + ; branch if it isn't Super Sonic
  38900. move.w #MusID_SuperSonic,d0 ; prepare to play super sonic music
  38901. +
  38902. tst.b (Current_Boss_ID).w
  38903. beq.s + ; branch if not in a boss fight
  38904. move.w #MusID_Boss,d0 ; prepare to play boss music
  38905. +
  38906. jsr (PlayMusic).l
  38907. ; return_1D858:
  38908. ResumeMusic_Done:
  38909. move.b #$1E,air_left(a1) ; reset air to full
  38910. rts
  38911.  
  38912. ; ===========================================================================
  38913. ; animation script for the bubbles
  38914. ; off_1D860:
  38915. Ani_obj0A: offsetTable
  38916. offsetTableEntry.w byte_1D87E ; 0
  38917. offsetTableEntry.w byte_1D887 ; 1
  38918. offsetTableEntry.w byte_1D890 ; 2
  38919. offsetTableEntry.w byte_1D899 ; 3
  38920. offsetTableEntry.w byte_1D8A2 ; 4
  38921. offsetTableEntry.w byte_1D8AB ; 5
  38922. offsetTableEntry.w byte_1D8B4 ; 6
  38923. offsetTableEntry.w byte_1D8B9 ; 7
  38924. offsetTableEntry.w byte_1D8C1 ; 8
  38925. offsetTableEntry.w byte_1D8C9 ; 9
  38926. offsetTableEntry.w byte_1D8D1 ; $A
  38927. offsetTableEntry.w byte_1D8D9 ; $B
  38928. offsetTableEntry.w byte_1D8E1 ; $C
  38929. offsetTableEntry.w byte_1D8E9 ; $D
  38930. offsetTableEntry.w byte_1D8EB ; $E
  38931. byte_1D87E: dc.b 5, 0, 1, 2, 3, 4, 8, 8,$FC
  38932. rev02even
  38933. byte_1D887: dc.b 5, 0, 1, 2, 3, 4, 9, 9,$FC
  38934. rev02even
  38935. byte_1D890: dc.b 5, 0, 1, 2, 3, 4, $A, $A,$FC
  38936. rev02even
  38937. byte_1D899: dc.b 5, 0, 1, 2, 3, 4, $B, $B,$FC
  38938. rev02even
  38939. byte_1D8A2: dc.b 5, 0, 1, 2, 3, 4, $C, $C,$FC
  38940. rev02even
  38941. byte_1D8AB: dc.b 5, 0, 1, 2, 3, 4, $D, $D,$FC
  38942. rev02even
  38943. byte_1D8B4: dc.b $E, 0, 1, 2,$FC
  38944. rev02even
  38945. byte_1D8B9: dc.b 7,$10, 8,$10, 8,$10, 8,$FC
  38946. rev02even
  38947. byte_1D8C1: dc.b 7,$10, 9,$10, 9,$10, 9,$FC
  38948. rev02even
  38949. byte_1D8C9: dc.b 7,$10, $A,$10, $A,$10, $A,$FC
  38950. rev02even
  38951. byte_1D8D1: dc.b 7,$10, $B,$10, $B,$10, $B,$FC
  38952. rev02even
  38953. byte_1D8D9: dc.b 7,$10, $C,$10, $C,$10, $C,$FC
  38954. rev02even
  38955. byte_1D8E1: dc.b 7,$10, $D,$10, $D,$10, $D,$FC
  38956. rev02even
  38957. byte_1D8E9: dc.b $E,$FC
  38958. rev02even
  38959. byte_1D8EB: dc.b $E, 1, 2, 3, 4,$FC
  38960. even
  38961.  
  38962.  
  38963.  
  38964.  
  38965. ; ===========================================================================
  38966. ; ----------------------------------------------------------------------------
  38967. ; Object 38 - Shield
  38968. ; ----------------------------------------------------------------------------
  38969. ; Sprite_1D8F2:
  38970. Obj38:
  38971. moveq #0,d0
  38972. move.b routine(a0),d0
  38973. move.w Obj38_Index(pc,d0.w),d1
  38974. jmp Obj38_Index(pc,d1.w)
  38975. ; ===========================================================================
  38976. ; off_1D900:
  38977. Obj38_Index: offsetTable
  38978. offsetTableEntry.w Obj38_Main ; 0
  38979. offsetTableEntry.w Obj38_Shield ; 2
  38980. ; ===========================================================================
  38981. ; loc_1D904:
  38982. Obj38_Main:
  38983. addq.b #2,routine(a0)
  38984. move.l #Obj38_MapUnc_1DBE4,mappings(a0)
  38985. move.b #4,render_flags(a0)
  38986. move.b #1,priority(a0)
  38987. move.b #$18,width_pixels(a0)
  38988. move.w #make_art_tile(ArtTile_ArtNem_Shield,0,0),art_tile(a0)
  38989. bsr.w Adjust2PArtPointer
  38990. ; loc_1D92C:
  38991. Obj38_Shield:
  38992. movea.w parent(a0),a2 ; a2=character
  38993. btst #status_sec_isInvincible,status_secondary(a2)
  38994. bne.s return_1D976
  38995. btst #status_sec_hasShield,status_secondary(a2)
  38996. beq.s JmpTo7_DeleteObject
  38997. move.w x_pos(a2),x_pos(a0)
  38998. move.w y_pos(a2),y_pos(a0)
  38999. move.b status(a2),status(a0)
  39000. andi.w #drawing_mask,art_tile(a0)
  39001. tst.w art_tile(a2)
  39002. bpl.s Obj38_Display
  39003. ori.w #high_priority,art_tile(a0)
  39004. ; loc_1D964:
  39005. Obj38_Display:
  39006. lea (Ani_obj38).l,a1
  39007. jsr (AnimateSprite).l
  39008. jmp (DisplaySprite).l
  39009. ; ===========================================================================
  39010.  
  39011. return_1D976:
  39012. rts
  39013. ; ===========================================================================
  39014.  
  39015. JmpTo7_DeleteObject
  39016. jmp (DeleteObject).l
  39017. ; ===========================================================================
  39018. ; ----------------------------------------------------------------------------
  39019. ; Object 35 - Invincibility Stars
  39020. ; ----------------------------------------------------------------------------
  39021. ; Sprite_1D97E:
  39022. Obj35:
  39023. moveq #0,d0
  39024. move.b objoff_A(a0),d0
  39025. move.w Obj35_Index(pc,d0.w),d1
  39026. jmp Obj35_Index(pc,d1.w)
  39027. ; ===========================================================================
  39028. ; off_1D98C:
  39029. Obj35_Index: offsetTable
  39030. offsetTableEntry.w loc_1D9A4 ; 0
  39031. offsetTableEntry.w loc_1DA0C ; 2
  39032. offsetTableEntry.w loc_1DA80 ; 4
  39033.  
  39034. off_1D992:
  39035. dc.l byte_1DB8F
  39036. dc.w $B
  39037. dc.l byte_1DBA4
  39038. dc.w $160D
  39039. dc.l byte_1DBBD
  39040. dc.w $2C0D
  39041. ; ===========================================================================
  39042.  
  39043. loc_1D9A4:
  39044. moveq #0,d2
  39045. lea off_1D992-6(pc),a2
  39046. lea (a0),a1
  39047.  
  39048. moveq #3,d1
  39049. - _move.b id(a0),id(a1) ; load obj35
  39050. move.b #4,objoff_A(a1) ; => loc_1DA80
  39051. move.l #Obj35_MapUnc_1DCBC,mappings(a1)
  39052. move.w #make_art_tile(ArtTile_ArtNem_Invincible_stars,0,0),art_tile(a1)
  39053. bsr.w Adjust2PArtPointer2
  39054. move.b #4,render_flags(a1)
  39055. bset #6,render_flags(a1)
  39056. move.b #$10,mainspr_width(a1)
  39057. move.b #2,mainspr_childsprites(a1)
  39058. move.w parent(a0),parent(a1)
  39059. move.b d2,objoff_36(a1)
  39060. addq.w #1,d2
  39061. move.l (a2)+,objoff_30(a1)
  39062. move.w (a2)+,objoff_34(a1)
  39063. lea next_object(a1),a1 ; a1=object
  39064. dbf d1,-
  39065.  
  39066. move.b #2,objoff_A(a0) ; => loc_1DA0C
  39067. move.b #4,objoff_34(a0)
  39068.  
  39069. loc_1DA0C:
  39070. movea.w parent(a0),a1 ; a1=character
  39071. btst #status_sec_isInvincible,status_secondary(a1)
  39072. beq.w DeleteObject
  39073. move.w x_pos(a1),d0
  39074. move.w d0,x_pos(a0)
  39075. move.w y_pos(a1),d1
  39076. move.w d1,y_pos(a0)
  39077. lea sub2_x_pos(a0),a2
  39078. lea byte_1DB82(pc),a3
  39079. moveq #0,d5
  39080.  
  39081. loc_1DA34:
  39082. move.w objoff_38(a0),d2
  39083. move.b (a3,d2.w),d5
  39084. bpl.s loc_1DA44
  39085. clr.w objoff_38(a0)
  39086. bra.s loc_1DA34
  39087. ; ===========================================================================
  39088.  
  39089. loc_1DA44:
  39090. addq.w #1,objoff_38(a0)
  39091. lea byte_1DB42(pc),a6
  39092. move.b objoff_34(a0),d6
  39093. jsr loc_1DB2C(pc)
  39094. move.w d2,(a2)+ ; sub2_x_pos
  39095. move.w d3,(a2)+ ; sub2_y_pos
  39096. move.w d5,(a2)+ ; sub2_mapframe
  39097. addi.w #$20,d6
  39098. jsr loc_1DB2C(pc)
  39099. move.w d2,(a2)+ ; sub3_x_pos
  39100. move.w d3,(a2)+ ; sub3_y_pos
  39101. move.w d5,(a2)+ ; sub3_mapframe
  39102. moveq #$12,d0
  39103. btst #0,status(a1)
  39104. beq.s loc_1DA74
  39105. neg.w d0
  39106.  
  39107. loc_1DA74:
  39108. add.b d0,objoff_34(a0)
  39109. move.w #$80,d0
  39110. bra.w DisplaySprite3
  39111. ; ===========================================================================
  39112.  
  39113. loc_1DA80:
  39114. movea.w parent(a0),a1 ; a1=character
  39115. btst #status_sec_isInvincible,status_secondary(a1)
  39116. beq.w DeleteObject
  39117. cmpi.w #2,(Player_mode).w
  39118. beq.s loc_1DAA4
  39119. lea (Sonic_Pos_Record_Index).w,a5
  39120. lea (Sonic_Pos_Record_Buf).w,a6
  39121. tst.b parent+1(a0)
  39122. beq.s loc_1DAAC
  39123.  
  39124. loc_1DAA4:
  39125. lea (Tails_Pos_Record_Index).w,a5
  39126. lea (Tails_Pos_Record_Buf).w,a6
  39127.  
  39128. loc_1DAAC:
  39129. move.b objoff_36(a0),d1
  39130. lsl.b #2,d1
  39131. move.w d1,d2
  39132. add.w d1,d1
  39133. add.w d2,d1
  39134. move.w (a5),d0
  39135. sub.b d1,d0
  39136. lea (a6,d0.w),a2
  39137. move.w (a2)+,d0
  39138. move.w (a2)+,d1
  39139. move.w d0,x_pos(a0)
  39140. move.w d1,y_pos(a0)
  39141. lea sub2_x_pos(a0),a2
  39142. movea.l objoff_30(a0),a3
  39143.  
  39144. loc_1DAD4:
  39145. move.w objoff_38(a0),d2
  39146. move.b (a3,d2.w),d5
  39147. bpl.s loc_1DAE4
  39148. clr.w objoff_38(a0)
  39149. bra.s loc_1DAD4
  39150. ; ===========================================================================
  39151.  
  39152. loc_1DAE4:
  39153. swap d5
  39154. add.b objoff_35(a0),d2
  39155. move.b (a3,d2.w),d5
  39156. addq.w #1,objoff_38(a0)
  39157. lea byte_1DB42(pc),a6
  39158. move.b objoff_34(a0),d6
  39159. jsr loc_1DB2C(pc)
  39160. move.w d2,(a2)+ ; sub2_x_pos
  39161. move.w d3,(a2)+ ; sub2_y_pos
  39162. move.w d5,(a2)+ ; sub2_mapframe
  39163. addi.w #$20,d6
  39164. swap d5
  39165. jsr loc_1DB2C(pc)
  39166. move.w d2,(a2)+ ; sub3_x_pos
  39167. move.w d3,(a2)+ ; sub3_y_pos
  39168. move.w d5,(a2)+ ; sub3_mapframe
  39169. moveq #2,d0
  39170. btst #0,status(a1)
  39171. beq.s loc_1DB20
  39172. neg.w d0
  39173.  
  39174. loc_1DB20:
  39175. add.b d0,objoff_34(a0)
  39176. move.w #$80,d0
  39177. bra.w DisplaySprite3
  39178. ; ===========================================================================
  39179.  
  39180. loc_1DB2C:
  39181. andi.w #$3E,d6
  39182. move.b (a6,d6.w),d2
  39183. move.b 1(a6,d6.w),d3
  39184. ext.w d2
  39185. ext.w d3
  39186. add.w d0,d2
  39187. add.w d1,d3
  39188. rts
  39189. ; ===========================================================================
  39190. ; unknown
  39191. byte_1DB42: dc.w $F00, $F03, $E06, $D08, $B0B, $80D, $60E, $30F
  39192. dc.w $10, -$3F1, -$6F2, -$8F3, -$BF5, -$DF8, -$EFA, -$FFD
  39193. dc.w $F000, -$F04, -$E07, -$D09, -$B0C, -$80E, -$60F, -$310
  39194. dc.w -$10, $3F0, $6F1, $8F2, $BF4, $DF7, $EF9, $FFC
  39195.  
  39196. byte_1DB82: dc.b 8, 5, 7, 6, 6, 7, 5, 8, 6, 7, 7, 6,$FF
  39197. rev02even
  39198. byte_1DB8F: dc.b 8, 7, 6, 5, 4, 3, 4, 5, 6, 7,$FF
  39199. dc.b 3, 4, 5, 6, 7, 8, 7, 6, 5, 4
  39200. rev02even
  39201. byte_1DBA4: dc.b 8, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7,$FF
  39202. dc.b 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3
  39203. rev02even
  39204. byte_1DBBD: dc.b 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6,$FF
  39205. dc.b 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2
  39206. even
  39207.  
  39208. ; animation script
  39209. ; byte_1DBD6
  39210. Ani_obj38: offsetTable
  39211. offsetTableEntry.w + ; 0
  39212. + dc.b 0, 5, 0, 5, 1, 5, 2, 5, 3, 5, 4,$FF
  39213.  
  39214. ; -------------------------------------------------------------------------------
  39215. ; sprite mappings
  39216. ; -------------------------------------------------------------------------------
  39217. Obj38_MapUnc_1DBE4: BINCLUDE "mappings/sprite/obj38.bin"
  39218. ; -------------------------------------------------------------------------------
  39219. ; sprite mappings
  39220. ; -------------------------------------------------------------------------------
  39221. Obj35_MapUnc_1DCBC: BINCLUDE "mappings/sprite/obj35.bin"
  39222.  
  39223. ; ===========================================================================
  39224. ; ----------------------------------------------------------------------------
  39225. ; Object 08 - Water splash in Aquatic Ruin Zone, Spindash dust
  39226. ; ----------------------------------------------------------------------------
  39227. ; Sprite_1DD20:
  39228. Obj08:
  39229. moveq #0,d0
  39230. move.b routine(a0),d0
  39231. move.w Obj08_Index(pc,d0.w),d1
  39232. jmp Obj08_Index(pc,d1.w)
  39233. ; ===========================================================================
  39234. ; off_1DD2E:
  39235. Obj08_Index: offsetTable
  39236. offsetTableEntry.w Obj08_Init ; 0
  39237. offsetTableEntry.w Obj08_Main ; 2
  39238. offsetTableEntry.w BranchTo16_DeleteObject ; 4
  39239. offsetTableEntry.w Obj08_CheckSkid ; 6
  39240. ; ===========================================================================
  39241. ; loc_1DD36:
  39242. Obj08_Init:
  39243. addq.b #2,routine(a0)
  39244. move.l #Obj08_MapUnc_1DF5E,mappings(a0)
  39245. ori.b #4,render_flags(a0)
  39246. move.b #1,priority(a0)
  39247. move.b #$10,width_pixels(a0)
  39248. move.w #make_art_tile(ArtTile_ArtNem_SonicDust,0,0),art_tile(a0)
  39249. move.w #MainCharacter,parent(a0)
  39250. move.w #tiles_to_bytes(ArtTile_ArtNem_SonicDust),objoff_3C(a0)
  39251. cmpa.w #Sonic_Dust,a0
  39252. beq.s +
  39253. move.b #1,objoff_34(a0)
  39254. cmpi.w #2,(Player_mode).w
  39255. beq.s +
  39256. move.w #make_art_tile(ArtTile_ArtNem_TailsDust,0,0),art_tile(a0)
  39257. move.w #Sidekick,parent(a0)
  39258. move.w #tiles_to_bytes(ArtTile_ArtNem_TailsDust),objoff_3C(a0)
  39259. +
  39260. bsr.w Adjust2PArtPointer
  39261.  
  39262. ; loc_1DD90:
  39263. Obj08_Main:
  39264. movea.w parent(a0),a2 ; a2=character
  39265. moveq #0,d0
  39266. move.b anim(a0),d0 ; use current animation as a secondary routine counter
  39267. add.w d0,d0
  39268. move.w Obj08_DisplayModes(pc,d0.w),d1
  39269. jmp Obj08_DisplayModes(pc,d1.w)
  39270. ; ===========================================================================
  39271. ; off_1DDA4:
  39272. Obj08_DisplayModes: offsetTable
  39273. offsetTableEntry.w Obj08_Display ; 0
  39274. offsetTableEntry.w Obj08_MdSplash ; 2
  39275. offsetTableEntry.w Obj08_MdSpindashDust ; 4
  39276. offsetTableEntry.w Obj08_MdSkidDust ; 6
  39277. ; ===========================================================================
  39278. ; loc_1DDAC:
  39279. Obj08_MdSplash:
  39280. move.w (Water_Level_1).w,y_pos(a0)
  39281. tst.b next_anim(a0)
  39282. bne.s Obj08_Display
  39283. move.w x_pos(a2),x_pos(a0)
  39284. move.b #0,status(a0)
  39285. andi.w #drawing_mask,art_tile(a0)
  39286. bra.s Obj08_Display
  39287. ; ===========================================================================
  39288. ; loc_1DDCC:
  39289. Obj08_MdSpindashDust:
  39290. cmpi.b #$C,air_left(a2)
  39291. blo.s Obj08_ResetDisplayMode
  39292. cmpi.b #4,routine(a2)
  39293. bhs.s Obj08_ResetDisplayMode
  39294. tst.b spindash_flag(a2)
  39295. beq.s Obj08_ResetDisplayMode
  39296. move.w x_pos(a2),x_pos(a0)
  39297. move.w y_pos(a2),y_pos(a0)
  39298. move.b status(a2),status(a0)
  39299. andi.b #1,status(a0)
  39300. tst.b objoff_34(a0)
  39301. beq.s +
  39302. subi_.w #4,y_pos(a0)
  39303. +
  39304. tst.b next_anim(a0)
  39305. bne.s Obj08_Display
  39306. andi.w #drawing_mask,art_tile(a0)
  39307. tst.w art_tile(a2)
  39308. bpl.s Obj08_Display
  39309. ori.w #high_priority,art_tile(a0)
  39310. bra.s Obj08_Display
  39311. ; ===========================================================================
  39312. ; loc_1DE20:
  39313. Obj08_MdSkidDust:
  39314. cmpi.b #$C,air_left(a2)
  39315. blo.s Obj08_ResetDisplayMode
  39316.  
  39317. ; loc_1DE28:
  39318. Obj08_Display:
  39319. lea (Ani_obj08).l,a1
  39320. jsr (AnimateSprite).l
  39321. bsr.w Obj08_LoadDustOrSplashArt
  39322. jmp (DisplaySprite).l
  39323. ; ===========================================================================
  39324. ; loc_1DE3E:
  39325. Obj08_ResetDisplayMode:
  39326. move.b #0,anim(a0)
  39327. rts
  39328. ; ===========================================================================
  39329.  
  39330. BranchTo16_DeleteObject
  39331. bra.w DeleteObject
  39332. ; ===========================================================================
  39333. ; loc_1DE4A:
  39334. Obj08_CheckSkid:
  39335. movea.w parent(a0),a2 ; a2=character
  39336. cmpi.b #AniIDSonAni_Stop,anim(a2) ; SonAni_Stop
  39337. beq.s Obj08_SkidDust
  39338. move.b #2,routine(a0)
  39339. move.b #0,objoff_32(a0)
  39340. rts
  39341. ; ===========================================================================
  39342. ; loc_1DE64:
  39343. Obj08_SkidDust:
  39344. subq.b #1,objoff_32(a0)
  39345. bpl.s loc_1DEE0
  39346. move.b #3,objoff_32(a0)
  39347. bsr.w SingleObjLoad
  39348. bne.s loc_1DEE0
  39349. _move.b id(a0),id(a1) ; load obj08
  39350. move.w x_pos(a2),x_pos(a1)
  39351. move.w y_pos(a2),y_pos(a1)
  39352. addi.w #$10,y_pos(a1)
  39353. tst.b objoff_34(a0)
  39354. beq.s +
  39355. subi_.w #4,y_pos(a1)
  39356. +
  39357. move.b #0,status(a1)
  39358. move.b #3,anim(a1)
  39359. addq.b #2,routine(a1)
  39360. move.l mappings(a0),mappings(a1)
  39361. move.b render_flags(a0),render_flags(a1)
  39362. move.b #1,priority(a1)
  39363. move.b #4,width_pixels(a1)
  39364. move.w art_tile(a0),art_tile(a1)
  39365. move.w parent(a0),parent(a1)
  39366. andi.w #drawing_mask,art_tile(a1)
  39367. tst.w art_tile(a2)
  39368. bpl.s loc_1DEE0
  39369. ori.w #high_priority,art_tile(a1)
  39370.  
  39371. loc_1DEE0:
  39372. bsr.s Obj08_LoadDustOrSplashArt
  39373. rts
  39374. ; ===========================================================================
  39375. ; loc_1DEE4:
  39376. Obj08_LoadDustOrSplashArt:
  39377. moveq #0,d0
  39378. move.b mapping_frame(a0),d0
  39379. cmp.b objoff_30(a0),d0
  39380. beq.s return_1DF36
  39381. move.b d0,objoff_30(a0)
  39382. lea (Obj08_MapRUnc_1E074).l,a2
  39383. add.w d0,d0
  39384. adda.w (a2,d0.w),a2
  39385. move.w (a2)+,d5
  39386. subq.w #1,d5
  39387. bmi.s return_1DF36
  39388. move.w objoff_3C(a0),d4
  39389.  
  39390. - moveq #0,d1
  39391. move.w (a2)+,d1
  39392. move.w d1,d3
  39393. lsr.w #8,d3
  39394. andi.w #$F0,d3
  39395. addi.w #$10,d3
  39396. andi.w #$FFF,d1
  39397. lsl.l #5,d1
  39398. addi.l #ArtUnc_Splash,d1
  39399. move.w d4,d2
  39400. add.w d3,d4
  39401. add.w d3,d4
  39402. jsr (QueueDMATransfer).l
  39403. dbf d5,-
  39404.  
  39405. return_1DF36:
  39406. rts
  39407. ; ===========================================================================
  39408. ; animation script
  39409. ; off_1DF38:
  39410. Ani_obj08: offsetTable
  39411. offsetTableEntry.w Obj08Ani_Null ; 0
  39412. offsetTableEntry.w Obj08Ani_Splash ; 1
  39413. offsetTableEntry.w Obj08Ani_Dash ; 2
  39414. offsetTableEntry.w Obj08Ani_Skid ; 3
  39415. Obj08Ani_Null: dc.b $1F, 0,$FF
  39416. rev02even
  39417. Obj08Ani_Splash:dc.b 3, 1, 2, 3, 4, 5, 6, 7, 8, 9,$FD, 0
  39418. rev02even
  39419. Obj08Ani_Dash: dc.b 1, $A, $B, $C, $D, $E, $F,$10,$FF
  39420. rev02even
  39421. Obj08Ani_Skid: dc.b 3,$11,$12,$13,$14,$FC
  39422. even
  39423. ; -------------------------------------------------------------------------------
  39424. ; sprite mappings
  39425. ; -------------------------------------------------------------------------------
  39426. Obj08_MapUnc_1DF5E: BINCLUDE "mappings/sprite/obj08.bin"
  39427. ; -------------------------------------------------------------------------------
  39428. ; dynamic pattern loading cues
  39429. ; -------------------------------------------------------------------------------
  39430. Obj08_MapRUnc_1E074: BINCLUDE "mappings/spriteDPLC/obj08.bin"
  39431. ; ===========================================================================
  39432. ; ----------------------------------------------------------------------------
  39433. ; Object 7E - Super Sonic's stars
  39434. ; ----------------------------------------------------------------------------
  39435. ; Sprite_1E0F0:
  39436. Obj7E:
  39437. moveq #0,d0
  39438. move.b routine(a0),d0
  39439. move.w Obj7E_Index(pc,d0.w),d1
  39440. jmp Obj7E_Index(pc,d1.w)
  39441. ; ===========================================================================
  39442. ; off_1E0FE: Obj7E_States:
  39443. Obj7E_Index: offsetTable
  39444. offsetTableEntry.w Obj7E_Init ; 0
  39445. offsetTableEntry.w Obj7E_Main ; 2
  39446. ; ===========================================================================
  39447. ; loc_1E102:
  39448. Obj7E_Init:
  39449. addq.b #2,routine(a0)
  39450. move.l #Obj7E_MapUnc_1E1BE,mappings(a0)
  39451. move.b #4,render_flags(a0)
  39452. move.b #1,priority(a0)
  39453. move.b #$18,width_pixels(a0)
  39454. move.w #make_art_tile(ArtTile_ArtNem_SuperSonic_stars,0,0),art_tile(a0)
  39455. bsr.w Adjust2PArtPointer
  39456. btst #high_priority_bit,(MainCharacter+art_tile).w
  39457. beq.s Obj7E_Main
  39458. bset #high_priority_bit,art_tile(a0)
  39459. ; loc_1E138:
  39460. Obj7E_Main:
  39461. tst.b (Super_Sonic_flag).w
  39462. beq.s JmpTo8_DeleteObject
  39463. tst.b objoff_30(a0)
  39464. beq.s loc_1E188
  39465. subq.b #1,anim_frame_duration(a0)
  39466. bpl.s loc_1E170
  39467. move.b #1,anim_frame_duration(a0)
  39468. addq.b #1,mapping_frame(a0)
  39469. cmpi.b #6,mapping_frame(a0)
  39470. blo.s loc_1E170
  39471. move.b #0,mapping_frame(a0)
  39472. move.b #0,objoff_30(a0)
  39473. move.b #1,objoff_31(a0)
  39474. rts
  39475. ; ===========================================================================
  39476.  
  39477. loc_1E170:
  39478. tst.b objoff_31(a0)
  39479. bne.s JmpTo6_DisplaySprite
  39480.  
  39481. loc_1E176:
  39482. move.w (MainCharacter+x_pos).w,x_pos(a0)
  39483. move.w (MainCharacter+y_pos).w,y_pos(a0)
  39484.  
  39485. JmpTo6_DisplaySprite
  39486. jmp (DisplaySprite).l
  39487. ; ===========================================================================
  39488.  
  39489. loc_1E188:
  39490. tst.b (MainCharacter+obj_control).w
  39491. bne.s loc_1E1AA
  39492. mvabs.w (MainCharacter+inertia).w,d0
  39493. cmpi.w #$800,d0
  39494. blo.s loc_1E1AA
  39495. move.b #0,mapping_frame(a0)
  39496. move.b #1,objoff_30(a0)
  39497. bra.s loc_1E176
  39498. ; ===========================================================================
  39499.  
  39500. loc_1E1AA:
  39501. move.b #0,objoff_30(a0)
  39502. move.b #0,objoff_31(a0)
  39503. rts
  39504. ; ===========================================================================
  39505.  
  39506. JmpTo8_DeleteObject
  39507. jmp (DeleteObject).l
  39508. ; ===========================================================================
  39509. ; -------------------------------------------------------------------------------
  39510. ; sprite mappings
  39511. ; -------------------------------------------------------------------------------
  39512. Obj7E_MapUnc_1E1BE: BINCLUDE "mappings/sprite/obj7E.bin"
  39513. ; ===========================================================================
  39514.  
  39515. if gameRevision<2
  39516. nop
  39517. endif
  39518.  
  39519.  
  39520.  
  39521.  
  39522. ; ---------------------------------------------------------------------------
  39523. ; Subroutine to change Sonic's angle & position as he walks along the floor
  39524. ; ---------------------------------------------------------------------------
  39525.  
  39526. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  39527.  
  39528. ; loc_1E234: Sonic_AnglePos:
  39529. AnglePos:
  39530. move.l #Primary_Collision,(Collision_addr).w
  39531. cmpi.b #$C,top_solid_bit(a0)
  39532. beq.s +
  39533. move.l #Secondary_Collision,(Collision_addr).w
  39534. +
  39535. move.b top_solid_bit(a0),d5
  39536. btst #3,status(a0)
  39537. beq.s +
  39538. moveq #0,d0
  39539. move.b d0,(Primary_Angle).w
  39540. move.b d0,(Secondary_Angle).w
  39541. rts
  39542. ; ---------------------------------------------------------------------------
  39543. + moveq #3,d0
  39544. move.b d0,(Primary_Angle).w
  39545. move.b d0,(Secondary_Angle).w
  39546. move.b angle(a0),d0
  39547. addi.b #$20,d0
  39548. bpl.s loc_1E286
  39549. move.b angle(a0),d0
  39550. bpl.s +
  39551. subq.b #1,d0
  39552. +
  39553. addi.b #$20,d0
  39554. bra.s loc_1E292
  39555. ; ---------------------------------------------------------------------------
  39556. loc_1E286:
  39557. move.b angle(a0),d0
  39558. bpl.s loc_1E28E
  39559. addq.b #1,d0
  39560.  
  39561. loc_1E28E:
  39562. addi.b #$1F,d0
  39563.  
  39564. loc_1E292:
  39565. andi.b #$C0,d0
  39566. cmpi.b #$40,d0
  39567. beq.w Sonic_WalkVertL
  39568. cmpi.b #$80,d0
  39569. beq.w Sonic_WalkCeiling
  39570. cmpi.b #$C0,d0
  39571. beq.w Sonic_WalkVertR
  39572. move.w y_pos(a0),d2
  39573. move.w x_pos(a0),d3
  39574. moveq #0,d0
  39575. move.b y_radius(a0),d0
  39576. ext.w d0
  39577. add.w d0,d2
  39578. move.b x_radius(a0),d0
  39579. ext.w d0
  39580. add.w d0,d3
  39581. lea (Primary_Angle).w,a4
  39582. movea.w #$10,a3
  39583. move.w #0,d6
  39584. bsr.w FindFloor
  39585. move.w d1,-(sp)
  39586. move.w y_pos(a0),d2
  39587. move.w x_pos(a0),d3
  39588. moveq #0,d0
  39589. move.b y_radius(a0),d0
  39590. ext.w d0
  39591. add.w d0,d2
  39592. move.b x_radius(a0),d0
  39593. ext.w d0
  39594. neg.w d0
  39595. add.w d0,d3
  39596. lea (Secondary_Angle).w,a4
  39597. movea.w #$10,a3
  39598. move.w #0,d6
  39599. bsr.w FindFloor
  39600. move.w (sp)+,d0
  39601. bsr.w Sonic_Angle
  39602. tst.w d1
  39603. beq.s return_1E31C
  39604. bpl.s loc_1E31E
  39605. cmpi.w #-$E,d1
  39606. blt.s return_1E31C
  39607. add.w d1,y_pos(a0)
  39608.  
  39609. return_1E31C:
  39610. rts
  39611. ; ===========================================================================
  39612.  
  39613. loc_1E31E:
  39614. mvabs.b x_vel(a0),d0
  39615. addq.b #4,d0
  39616. cmpi.b #$E,d0
  39617. blo.s +
  39618. move.b #$E,d0
  39619. +
  39620. cmp.b d0,d1
  39621. bgt.s loc_1E33C
  39622.  
  39623. loc_1E336:
  39624. add.w d1,y_pos(a0)
  39625. rts
  39626. ; ===========================================================================
  39627.  
  39628. loc_1E33C:
  39629. tst.b stick_to_convex(a0)
  39630. bne.s loc_1E336
  39631. bset #1,status(a0)
  39632. bclr #5,status(a0)
  39633. move.b #AniIDSonAni_Run,next_anim(a0)
  39634. rts
  39635. ; ===========================================================================
  39636.  
  39637. ; ---------------------------------------------------------------------------
  39638. ; Subroutine to change Sonic's angle as he walks along the floor
  39639. ; ---------------------------------------------------------------------------
  39640.  
  39641. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  39642.  
  39643. ; loc_1E356:
  39644. Sonic_Angle:
  39645. move.b (Secondary_Angle).w,d2
  39646. cmp.w d0,d1
  39647. ble.s +
  39648. move.b (Primary_Angle).w,d2
  39649. move.w d0,d1
  39650. +
  39651. btst #0,d2
  39652. bne.s loc_1E380
  39653. move.b d2,d0
  39654. sub.b angle(a0),d0
  39655. bpl.s +
  39656. neg.b d0
  39657. +
  39658. cmpi.b #$20,d0
  39659. bhs.s loc_1E380
  39660. move.b d2,angle(a0)
  39661. rts
  39662. ; ===========================================================================
  39663.  
  39664. loc_1E380:
  39665. move.b angle(a0),d2
  39666. addi.b #$20,d2
  39667. andi.b #$C0,d2
  39668. move.b d2,angle(a0)
  39669. rts
  39670. ; End of function Sonic_Angle
  39671.  
  39672. ; ---------------------------------------------------------------------------
  39673. ; Subroutine allowing Sonic to walk up a vertical slope/wall to his right
  39674. ; ---------------------------------------------------------------------------
  39675.  
  39676. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  39677.  
  39678. ; loc_1E392:
  39679. Sonic_WalkVertR:
  39680. move.w y_pos(a0),d2
  39681. move.w x_pos(a0),d3
  39682. moveq #0,d0
  39683. move.b x_radius(a0),d0
  39684. ext.w d0
  39685. neg.w d0
  39686. add.w d0,d2
  39687. move.b y_radius(a0),d0
  39688. ext.w d0
  39689. add.w d0,d3
  39690. lea (Primary_Angle).w,a4
  39691. movea.w #$10,a3
  39692. move.w #0,d6
  39693. bsr.w FindWall
  39694. move.w d1,-(sp)
  39695. move.w y_pos(a0),d2
  39696. move.w x_pos(a0),d3
  39697. moveq #0,d0
  39698. move.b x_radius(a0),d0
  39699. ext.w d0
  39700. add.w d0,d2
  39701. move.b y_radius(a0),d0
  39702. ext.w d0
  39703. add.w d0,d3
  39704. lea (Secondary_Angle).w,a4
  39705. movea.w #$10,a3
  39706. move.w #0,d6
  39707. bsr.w FindWall
  39708. move.w (sp)+,d0
  39709. bsr.w Sonic_Angle
  39710. tst.w d1
  39711. beq.s return_1E400
  39712. bpl.s loc_1E402
  39713. cmpi.w #-$E,d1
  39714. blt.s return_1E400
  39715. add.w d1,x_pos(a0)
  39716.  
  39717. return_1E400:
  39718. rts
  39719. ; ===========================================================================
  39720.  
  39721. loc_1E402:
  39722. mvabs.b y_vel(a0),d0
  39723. addq.b #4,d0
  39724. cmpi.b #$E,d0
  39725. blo.s +
  39726. move.b #$E,d0
  39727. +
  39728. cmp.b d0,d1
  39729. bgt.s loc_1E420
  39730.  
  39731. loc_1E41A:
  39732. add.w d1,x_pos(a0)
  39733. rts
  39734. ; ===========================================================================
  39735.  
  39736. loc_1E420:
  39737. tst.b stick_to_convex(a0)
  39738. bne.s loc_1E41A
  39739. bset #1,status(a0)
  39740. bclr #5,status(a0)
  39741. move.b #AniIDSonAni_Run,next_anim(a0)
  39742. rts
  39743. ; ===========================================================================
  39744. ;loc_1E43A
  39745. Sonic_WalkCeiling:
  39746. move.w y_pos(a0),d2
  39747. move.w x_pos(a0),d3
  39748. moveq #0,d0
  39749. move.b y_radius(a0),d0
  39750. ext.w d0
  39751. sub.w d0,d2
  39752. eori.w #$F,d2
  39753. move.b x_radius(a0),d0
  39754. ext.w d0
  39755. add.w d0,d3
  39756. lea (Primary_Angle).w,a4
  39757. movea.w #-$10,a3
  39758. move.w #$800,d6
  39759. bsr.w FindFloor
  39760. move.w d1,-(sp)
  39761. move.w y_pos(a0),d2
  39762. move.w x_pos(a0),d3
  39763. moveq #0,d0
  39764. move.b y_radius(a0),d0
  39765. ext.w d0
  39766. sub.w d0,d2
  39767. eori.w #$F,d2
  39768. move.b x_radius(a0),d0
  39769. ext.w d0
  39770. sub.w d0,d3
  39771. lea (Secondary_Angle).w,a4
  39772. movea.w #-$10,a3
  39773. move.w #$800,d6
  39774. bsr.w FindFloor
  39775. move.w (sp)+,d0
  39776. bsr.w Sonic_Angle
  39777. tst.w d1
  39778. beq.s return_1E4AE
  39779. bpl.s loc_1E4B0
  39780. cmpi.w #-$E,d1
  39781. blt.s return_1E4AE
  39782. sub.w d1,y_pos(a0)
  39783.  
  39784. return_1E4AE:
  39785. rts
  39786. ; ===========================================================================
  39787.  
  39788. loc_1E4B0:
  39789. mvabs.b x_vel(a0),d0
  39790. addq.b #4,d0
  39791. cmpi.b #$E,d0
  39792. blo.s +
  39793. move.b #$E,d0
  39794. +
  39795. cmp.b d0,d1
  39796. bgt.s loc_1E4CE
  39797.  
  39798. loc_1E4C8:
  39799. sub.w d1,y_pos(a0)
  39800. rts
  39801. ; ===========================================================================
  39802.  
  39803. loc_1E4CE:
  39804. tst.b stick_to_convex(a0)
  39805. bne.s loc_1E4C8
  39806. bset #1,status(a0)
  39807. bclr #5,status(a0)
  39808. move.b #AniIDSonAni_Run,next_anim(a0)
  39809. rts
  39810. ; ===========================================================================
  39811. ;loc_1E4E8
  39812. Sonic_WalkVertL:
  39813. move.w y_pos(a0),d2
  39814. move.w x_pos(a0),d3
  39815. moveq #0,d0
  39816. move.b x_radius(a0),d0
  39817. ext.w d0
  39818. sub.w d0,d2
  39819. move.b y_radius(a0),d0
  39820. ext.w d0
  39821. sub.w d0,d3
  39822. eori.w #$F,d3
  39823. lea (Primary_Angle).w,a4
  39824. movea.w #-$10,a3
  39825. move.w #$400,d6
  39826. bsr.w FindWall
  39827. move.w d1,-(sp)
  39828. move.w y_pos(a0),d2
  39829. move.w x_pos(a0),d3
  39830. moveq #0,d0
  39831. move.b x_radius(a0),d0
  39832. ext.w d0
  39833. add.w d0,d2
  39834. move.b y_radius(a0),d0
  39835. ext.w d0
  39836. sub.w d0,d3
  39837. eori.w #$F,d3
  39838. lea (Secondary_Angle).w,a4
  39839. movea.w #-$10,a3
  39840. move.w #$400,d6
  39841. bsr.w FindWall
  39842. move.w (sp)+,d0
  39843. bsr.w Sonic_Angle
  39844. tst.w d1
  39845. beq.s return_1E55C
  39846. bpl.s loc_1E55E
  39847. cmpi.w #-$E,d1
  39848. blt.s return_1E55C
  39849. sub.w d1,x_pos(a0)
  39850.  
  39851. return_1E55C:
  39852. rts
  39853. ; ===========================================================================
  39854.  
  39855. loc_1E55E:
  39856. mvabs.b y_vel(a0),d0
  39857. addq.b #4,d0
  39858. cmpi.b #$E,d0
  39859. blo.s +
  39860. move.b #$E,d0
  39861. +
  39862. cmp.b d0,d1
  39863. bgt.s loc_1E57C
  39864.  
  39865. loc_1E576:
  39866. sub.w d1,x_pos(a0)
  39867. rts
  39868. ; ===========================================================================
  39869.  
  39870. loc_1E57C:
  39871. tst.b stick_to_convex(a0)
  39872. bne.s loc_1E576
  39873. bset #1,status(a0)
  39874. bclr #5,status(a0)
  39875. move.b #AniIDSonAni_Run,next_anim(a0)
  39876. rts
  39877. ; ===========================================================================
  39878. ; ---------------------------------------------------------------------------
  39879. ; Subroutine to find which tile is in the specified location
  39880. ; d2 = y_pos
  39881. ; d3 = x_pos
  39882. ; returns relevant block ID in (a1)
  39883. ; a1 is pointer to block in chunk table
  39884. ; ---------------------------------------------------------------------------
  39885.  
  39886. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  39887.  
  39888. ; loc_1E596: Floor_ChkTile:
  39889. Find_Tile:
  39890. move.w d2,d0 ; y_pos
  39891. add.w d0,d0
  39892. andi.w #$F00,d0 ; rounded 2*y_pos
  39893. move.w d3,d1 ; x_pos
  39894. lsr.w #3,d1
  39895. move.w d1,d4
  39896. lsr.w #4,d1 ; x_pos/128 = x_of_chunk
  39897. andi.w #$7F,d1
  39898. add.w d1,d0 ; d0 is relevant chunk ID now
  39899. moveq #-1,d1
  39900. clr.w d1 ; d1 is now $FFFF0000 = Chunk_Table
  39901. lea (Level_Layout).w,a1
  39902. move.b (a1,d0.w),d1 ; move 128*128 chunk ID to d1
  39903. add.w d1,d1
  39904. move.w word_1E5D0(pc,d1.w),d1
  39905. move.w d2,d0 ; y_pos
  39906. andi.w #$70,d0
  39907. add.w d0,d1
  39908. andi.w #$E,d4 ; x_pos/8
  39909. add.w d4,d1
  39910. movea.l d1,a1 ; address of block ID
  39911. rts
  39912. ; ===========================================================================
  39913. ; precalculated values for Find_Tile
  39914. ; (Sonic 1 calculated it every time instead of using a table)
  39915. word_1E5D0:
  39916. c := 0
  39917. rept 256
  39918. dc.w c
  39919. c := c+$80
  39920. endm
  39921. ; ===========================================================================
  39922.  
  39923. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  39924.  
  39925. ; Scans vertically for up to 2 16x16 blocks to find solid ground or ceiling.
  39926. ; d2 = y_pos
  39927. ; d3 = x_pos
  39928. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  39929. ; d6 = $0000 for no flip, $0800 for vertical flip
  39930. ; a3 = delta-y for next location to check if current one is empty
  39931. ; a4 = pointer to angle buffer
  39932. ; returns relevant block ID in (a1)
  39933. ; returns distance in d1
  39934. ; returns angle in (a4)
  39935.  
  39936. ; loc_1E7D0:
  39937. FindFloor:
  39938. bsr.w Find_Tile
  39939. move.w (a1),d0
  39940. move.w d0,d4
  39941. andi.w #$3FF,d0
  39942. beq.s loc_1E7E2
  39943. btst d5,d4
  39944. bne.s loc_1E7F0
  39945.  
  39946. loc_1E7E2:
  39947. add.w a3,d2
  39948. bsr.w FindFloor2
  39949. sub.w a3,d2
  39950. addi.w #$10,d1
  39951. rts
  39952. ; ===========================================================================
  39953.  
  39954. loc_1E7F0: ; block has some solidity
  39955. movea.l (Collision_addr).w,a2 ; pointer to collision data, i.e. blockID -> collisionID array
  39956. move.b (a2,d0.w),d0 ; get collisionID
  39957. andi.w #$FF,d0
  39958. beq.s loc_1E7E2
  39959. lea (ColCurveMap).l,a2
  39960. move.b (a2,d0.w),(a4) ; get angle from AngleMap --> (a4)
  39961. lsl.w #4,d0
  39962. move.w d3,d1 ; x_pos
  39963. btst #$A,d4 ; adv.blockID in d4 - X flipping
  39964. beq.s +
  39965. not.w d1
  39966. neg.b (a4)
  39967. +
  39968. btst #$B,d4 ; Y flipping
  39969. beq.s +
  39970. addi.b #$40,(a4)
  39971. neg.b (a4)
  39972. subi.b #$40,(a4)
  39973. +
  39974. andi.w #$F,d1 ; x_pos (mod 16)
  39975. add.w d0,d1 ; d0 = 16*blockID -> offset in ColArray to look up
  39976. lea (ColArray).l,a2
  39977. move.b (a2,d1.w),d0 ; heigth from ColArray
  39978. ext.w d0
  39979. eor.w d6,d4
  39980. btst #$B,d4 ; Y flipping
  39981. beq.s +
  39982. neg.w d0
  39983. +
  39984. tst.w d0
  39985. beq.s loc_1E7E2 ; no collision
  39986. bmi.s loc_1E85E
  39987. cmpi.b #$10,d0
  39988. beq.s loc_1E86A
  39989. move.w d2,d1
  39990. andi.w #$F,d1
  39991. add.w d1,d0
  39992. move.w #$F,d1
  39993. sub.w d0,d1
  39994. rts
  39995. ; ===========================================================================
  39996.  
  39997. loc_1E85E:
  39998. move.w d2,d1
  39999. andi.w #$F,d1
  40000. add.w d1,d0
  40001. bpl.w loc_1E7E2
  40002.  
  40003. loc_1E86A:
  40004. sub.w a3,d2
  40005. bsr.w FindFloor2
  40006. add.w a3,d2
  40007. subi.w #$10,d1
  40008. rts
  40009. ; End of function FindFloor
  40010.  
  40011.  
  40012. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40013.  
  40014. ; Checks a 16x16 block to find solid ground or ceiling.
  40015. ; d2 = y_pos
  40016. ; d3 = x_pos
  40017. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  40018. ; d6 = $0000 for no flip, $0800 for vertical flip
  40019. ; a4 = pointer to angle buffer
  40020. ; returns relevant block ID in (a1)
  40021. ; returns distance in d1
  40022. ; returns angle in (a4)
  40023.  
  40024. ; loc_1E878:
  40025. FindFloor2:
  40026. bsr.w Find_Tile
  40027. move.w (a1),d0
  40028. move.w d0,d4
  40029. andi.w #$3FF,d0
  40030. beq.s loc_1E88A
  40031. btst d5,d4
  40032. bne.s loc_1E898
  40033.  
  40034. loc_1E88A:
  40035. move.w #$F,d1
  40036. move.w d2,d0
  40037. andi.w #$F,d0
  40038. sub.w d0,d1
  40039. rts
  40040. ; ===========================================================================
  40041.  
  40042. loc_1E898:
  40043. movea.l (Collision_addr).w,a2
  40044. move.b (a2,d0.w),d0
  40045. andi.w #$FF,d0
  40046. beq.s loc_1E88A
  40047. lea (ColCurveMap).l,a2
  40048. move.b (a2,d0.w),(a4)
  40049. lsl.w #4,d0
  40050. move.w d3,d1
  40051. btst #$A,d4
  40052. beq.s +
  40053. not.w d1
  40054. neg.b (a4)
  40055. +
  40056. btst #$B,d4
  40057. beq.s +
  40058. addi.b #$40,(a4)
  40059. neg.b (a4)
  40060. subi.b #$40,(a4)
  40061. +
  40062. andi.w #$F,d1
  40063. add.w d0,d1
  40064. lea (ColArray).l,a2
  40065. move.b (a2,d1.w),d0
  40066. ext.w d0
  40067. eor.w d6,d4
  40068. btst #$B,d4
  40069. beq.s +
  40070. neg.w d0
  40071. +
  40072. tst.w d0
  40073. beq.s loc_1E88A
  40074. bmi.s loc_1E900
  40075. move.w d2,d1
  40076. andi.w #$F,d1
  40077. add.w d1,d0
  40078. move.w #$F,d1
  40079. sub.w d0,d1
  40080. rts
  40081. ; ===========================================================================
  40082.  
  40083. loc_1E900:
  40084. move.w d2,d1
  40085. andi.w #$F,d1
  40086. add.w d1,d0
  40087. bpl.w loc_1E88A
  40088. not.w d1
  40089. rts
  40090. ; ===========================================================================
  40091.  
  40092. ; Checks a 16x16 block to find solid ground or ceiling. May check an additional
  40093. ; 16x16 block up for ceilings.
  40094. ; d2 = y_pos
  40095. ; d3 = x_pos
  40096. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  40097. ; d6 = $0000 for no flip, $0800 for vertical flip
  40098. ; a4 = pointer to angle buffer
  40099. ; returns relevant block ID in (a1)
  40100. ; returns distance in d1
  40101. ; returns angle in (a4)
  40102.  
  40103. ; loc_1E910: Obj_CheckInFloor:
  40104. Ring_FindFloor:
  40105. bsr.w Find_Tile
  40106. move.w (a1),d0
  40107. move.w d0,d4
  40108. andi.w #$3FF,d0
  40109. beq.s loc_1E922
  40110. btst d5,d4
  40111. bne.s loc_1E928
  40112.  
  40113. loc_1E922:
  40114. move.w #$10,d1
  40115. rts
  40116. ; ===========================================================================
  40117.  
  40118. loc_1E928:
  40119. movea.l (Collision_addr).w,a2
  40120. move.b (a2,d0.w),d0
  40121. andi.w #$FF,d0
  40122. beq.s loc_1E922
  40123. lea (ColCurveMap).l,a2
  40124. move.b (a2,d0.w),(a4)
  40125. lsl.w #4,d0
  40126. move.w d3,d1
  40127. btst #$A,d4
  40128. beq.s +
  40129. not.w d1
  40130. neg.b (a4)
  40131. +
  40132. btst #$B,d4
  40133. beq.s +
  40134. addi.b #$40,(a4)
  40135. neg.b (a4)
  40136. subi.b #$40,(a4)
  40137. +
  40138. andi.w #$F,d1
  40139. add.w d0,d1
  40140. lea (ColArray).l,a2
  40141. move.b (a2,d1.w),d0
  40142. ext.w d0
  40143. eor.w d6,d4
  40144. btst #$B,d4
  40145. beq.s +
  40146. neg.w d0
  40147. +
  40148. tst.w d0
  40149. beq.s loc_1E922
  40150. bmi.s loc_1E996
  40151. cmpi.b #$10,d0
  40152. beq.s loc_1E9A2
  40153. move.w d2,d1
  40154. andi.w #$F,d1
  40155. add.w d1,d0
  40156. move.w #$F,d1
  40157. sub.w d0,d1
  40158. rts
  40159. ; ===========================================================================
  40160.  
  40161. loc_1E996:
  40162. move.w d2,d1
  40163. andi.w #$F,d1
  40164. add.w d1,d0
  40165. bpl.w loc_1E922
  40166.  
  40167. loc_1E9A2:
  40168. sub.w a3,d2
  40169. bsr.w FindFloor2
  40170. add.w a3,d2
  40171. subi.w #$10,d1
  40172. rts
  40173. ; ===========================================================================
  40174.  
  40175. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40176.  
  40177. ; Scans horizontally for up to 2 16x16 blocks to find solid walls.
  40178. ; d2 = y_pos
  40179. ; d3 = x_pos
  40180. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  40181. ; d6 = $0000 for no flip, $0400 for horizontal flip
  40182. ; a3 = delta-x for next location to check if current one is empty
  40183. ; a4 = pointer to angle buffer
  40184. ; returns relevant block ID in (a1)
  40185. ; returns distance to left/right in d1
  40186. ; returns angle in (a4)
  40187.  
  40188. ; loc_1E9B0:
  40189. FindWall:
  40190. bsr.w Find_Tile
  40191. move.w (a1),d0
  40192. move.w d0,d4
  40193. andi.w #$3FF,d0 ; plain blockID
  40194. beq.s loc_1E9C2 ; no collision
  40195. btst d5,d4
  40196. bne.s loc_1E9D0
  40197.  
  40198. loc_1E9C2:
  40199. add.w a3,d3
  40200. bsr.w FindWall2
  40201. sub.w a3,d3
  40202. addi.w #$10,d1
  40203. rts
  40204. ; ===========================================================================
  40205.  
  40206. loc_1E9D0:
  40207. movea.l (Collision_addr).w,a2
  40208. move.b (a2,d0.w),d0
  40209. andi.w #$FF,d0 ; relevant collisionArrayEntry
  40210. beq.s loc_1E9C2
  40211. lea (ColCurveMap).l,a2
  40212. move.b (a2,d0.w),(a4)
  40213. lsl.w #4,d0 ; offset in collision array
  40214. move.w d2,d1 ; y
  40215. btst #$B,d4 ; y-mirror?
  40216. beq.s +
  40217. not.w d1
  40218. addi.b #$40,(a4)
  40219. neg.b (a4)
  40220. subi.b #$40,(a4)
  40221. +
  40222. btst #$A,d4 ; x-mirror?
  40223. beq.s +
  40224. neg.b (a4)
  40225. +
  40226. andi.w #$F,d1 ; y
  40227. add.w d0,d1 ; line to look up
  40228. lea (ColArray2).l,a2 ; rotated collision array
  40229. move.b (a2,d1.w),d0 ; collision value
  40230. ext.w d0
  40231. eor.w d6,d4 ; set x-flip flag if from the right
  40232. btst #$A,d4 ; x-mirror?
  40233. beq.s +
  40234. neg.w d0
  40235. +
  40236. tst.w d0
  40237. beq.s loc_1E9C2
  40238. bmi.s loc_1EA3E
  40239. cmpi.b #$10,d0
  40240. beq.s loc_1EA4A
  40241. move.w d3,d1 ; x
  40242. andi.w #$F,d1
  40243. add.w d1,d0
  40244. move.w #$F,d1
  40245. sub.w d0,d1
  40246. rts
  40247. ; ===========================================================================
  40248.  
  40249. loc_1EA3E:
  40250. move.w d3,d1
  40251. andi.w #$F,d1
  40252. add.w d1,d0
  40253. bpl.w loc_1E9C2 ; no collision
  40254.  
  40255. loc_1EA4A:
  40256. sub.w a3,d3
  40257. bsr.w FindWall2
  40258. add.w a3,d3
  40259. subi.w #$10,d1
  40260. rts
  40261. ; End of function FindWall
  40262.  
  40263.  
  40264. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40265.  
  40266. ; Checks a 16x16 blocks to find solid walls.
  40267. ; d2 = y_pos
  40268. ; d3 = x_pos
  40269. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  40270. ; d6 = $0000 for no flip, $0400 for horizontal flip
  40271. ; a4 = pointer to angle buffer
  40272. ; returns relevant block ID in (a1)
  40273. ; returns distance to left/right in d1
  40274. ; returns angle in (a4)
  40275.  
  40276. ; loc_1EA58:
  40277. FindWall2:
  40278. bsr.w Find_Tile
  40279. move.w (a1),d0
  40280. move.w d0,d4
  40281. andi.w #$3FF,d0
  40282. beq.s loc_1EA6A
  40283. btst d5,d4
  40284. bne.s loc_1EA78
  40285.  
  40286. loc_1EA6A:
  40287. move.w #$F,d1
  40288. move.w d3,d0
  40289. andi.w #$F,d0
  40290. sub.w d0,d1
  40291. rts
  40292. ; ===========================================================================
  40293.  
  40294. loc_1EA78:
  40295. movea.l (Collision_addr).w,a2
  40296. move.b (a2,d0.w),d0
  40297. andi.w #$FF,d0
  40298. beq.s loc_1EA6A
  40299. lea (ColCurveMap).l,a2
  40300. move.b (a2,d0.w),(a4)
  40301. lsl.w #4,d0
  40302. move.w d2,d1
  40303. btst #$B,d4
  40304. beq.s +
  40305. not.w d1
  40306. addi.b #$40,(a4)
  40307. neg.b (a4)
  40308. subi.b #$40,(a4)
  40309. +
  40310. btst #$A,d4
  40311. beq.s +
  40312. neg.b (a4)
  40313. +
  40314. andi.w #$F,d1
  40315. add.w d0,d1
  40316. lea (ColArray2).l,a2
  40317. move.b (a2,d1.w),d0
  40318. ext.w d0
  40319. eor.w d6,d4
  40320. btst #$A,d4
  40321. beq.s +
  40322. neg.w d0
  40323. +
  40324. tst.w d0
  40325. beq.s loc_1EA6A
  40326. bmi.s loc_1EAE0
  40327. move.w d3,d1
  40328. andi.w #$F,d1
  40329. add.w d1,d0
  40330. move.w #$F,d1
  40331. sub.w d0,d1
  40332. rts
  40333. ; ===========================================================================
  40334.  
  40335. loc_1EAE0:
  40336. move.w d3,d1
  40337. andi.w #$F,d1
  40338. add.w d1,d0
  40339. bpl.w loc_1EA6A
  40340. not.w d1
  40341. rts
  40342. ; End of function FindWall2
  40343.  
  40344. ; ---------------------------------------------------------------------------
  40345. ; Unused floor/wall subroutine - logs something to do with collision
  40346. ; ---------------------------------------------------------------------------
  40347.  
  40348. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40349.  
  40350. ; return_1EAF0:
  40351. FloorLog_Unk:
  40352. rts
  40353. ; ---------------------------------------------------------------------------
  40354. lea (ColArray).l,a1
  40355. lea (ColArray).l,a2
  40356.  
  40357. ; for d3 from 255 to 0
  40358. move.w #$FF,d3
  40359. - moveq #$10,d5
  40360.  
  40361. ; for d2 from 15 to 0
  40362. move.w #$F,d2
  40363. - moveq #0,d4
  40364.  
  40365. ; for d1 from 15 to 0
  40366. move.w #$F,d1
  40367. - move.w (a1)+,d0
  40368. lsr.l d5,d0
  40369. addx.w d4,d4
  40370. dbf d1,- ; end for d1
  40371.  
  40372. move.w d4,(a2)+
  40373. suba.w #$20,a1
  40374. subq.w #1,d5
  40375. dbf d2,-- ; end for d2
  40376.  
  40377. adda.w #$20,a1
  40378. dbf d3,--- ; end for d3
  40379.  
  40380. lea (ColArray).l,a1
  40381. lea (ColArray2).l,a2
  40382. bsr.s FloorLog_Unk2
  40383. lea (ColArray).l,a1
  40384. lea (ColArray).l,a2
  40385.  
  40386. ; End of function FloorLog_Unk
  40387.  
  40388. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40389.  
  40390. ; loc_1EB46:
  40391. FloorLog_Unk2:
  40392. move.w #$FFF,d3
  40393.  
  40394. - moveq #0,d2
  40395. move.w #$F,d1
  40396. move.w (a1)+,d0
  40397. beq.s loc_1EB78
  40398. bmi.s ++
  40399.  
  40400. - lsr.w #1,d0
  40401. bcc.s +
  40402. addq.b #1,d2
  40403. + dbf d1,-
  40404.  
  40405. bra.s loc_1EB7A
  40406. ; ===========================================================================
  40407. +
  40408. cmpi.w #-1,d0
  40409. beq.s ++
  40410.  
  40411. - lsl.w #1,d0
  40412. bcc.s +
  40413. subq.b #1,d2
  40414. + dbf d1,-
  40415.  
  40416. bra.s loc_1EB7A
  40417. ; ===========================================================================
  40418. +
  40419. move.w #$10,d0
  40420.  
  40421. loc_1EB78:
  40422. move.w d0,d2
  40423.  
  40424. loc_1EB7A:
  40425. move.b d2,(a2)+
  40426. dbf d3,---
  40427.  
  40428. rts
  40429.  
  40430. ; End of function FloorLog_Unk2
  40431.  
  40432. if gameRevision<2
  40433. nop
  40434. endif
  40435.  
  40436.  
  40437.  
  40438.  
  40439. ; ---------------------------------------------------------------------------
  40440. ; Subroutine to calculate how much space is in front of Sonic or Tails on the ground
  40441. ; d0 = some input angle
  40442. ; d1 = output about how many pixels (up to some high enough amount)
  40443. ; ---------------------------------------------------------------------------
  40444.  
  40445. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40446.  
  40447. ; loc_1EB84: Sonic_WalkSpeed:
  40448. CalcRoomInFront:
  40449. move.l #Primary_Collision,(Collision_addr).w
  40450. cmpi.b #$C,top_solid_bit(a0)
  40451. beq.s +
  40452. move.l #Secondary_Collision,(Collision_addr).w
  40453. +
  40454. move.b lrb_solid_bit(a0),d5 ; Want walls or ceilings
  40455. move.l x_pos(a0),d3
  40456. move.l y_pos(a0),d2
  40457. move.w x_vel(a0),d1
  40458. ext.l d1
  40459. asl.l #8,d1
  40460. add.l d1,d3
  40461. move.w y_vel(a0),d1
  40462. ext.l d1
  40463. asl.l #8,d1
  40464. add.l d1,d2
  40465. swap d2
  40466. swap d3
  40467. move.b d0,(Primary_Angle).w
  40468. move.b d0,(Secondary_Angle).w
  40469. move.b d0,d1
  40470. addi.b #$20,d0
  40471. bpl.s loc_1EBDC
  40472.  
  40473. move.b d1,d0
  40474. bpl.s +
  40475. subq.b #1,d0
  40476. +
  40477. addi.b #$20,d0
  40478. bra.s loc_1EBE6
  40479. ; ---------------------------------------------------------------------------
  40480. loc_1EBDC:
  40481. move.b d1,d0
  40482. bpl.s +
  40483. addq.b #1,d0
  40484. +
  40485. addi.b #$1F,d0
  40486.  
  40487. loc_1EBE6:
  40488. andi.b #$C0,d0
  40489. beq.w CheckFloorDist_Part2 ; Player is going mostly down
  40490. cmpi.b #$80,d0
  40491. beq.w CheckCeilingDist_Part2 ; Player is going mostly up
  40492. andi.b #$38,d1
  40493. bne.s +
  40494. addq.w #8,d2
  40495. +
  40496. cmpi.b #$40,d0
  40497. beq.w CheckLeftWallDist_Part2 ; Player is going mostly left
  40498. bra.w CheckRightWallDist_Part2 ; Player is going mostly right
  40499.  
  40500. ; End of function CalcRoomInFront
  40501.  
  40502.  
  40503. ; ---------------------------------------------------------------------------
  40504. ; Subroutine to calculate how much space is empty above Sonic's/Tails' head
  40505. ; d0 = input angle perpendicular to the spine
  40506. ; d1 = output about how many pixels are overhead (up to some high enough amount)
  40507. ; ---------------------------------------------------------------------------
  40508.  
  40509. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40510.  
  40511. ; sub_1EC0A:
  40512. CalcRoomOverHead:
  40513. move.l #Primary_Collision,(Collision_addr).w
  40514. cmpi.b #$C,top_solid_bit(a0)
  40515. beq.s +
  40516. move.l #Secondary_Collision,(Collision_addr).w
  40517. +
  40518. move.b lrb_solid_bit(a0),d5
  40519. move.b d0,(Primary_Angle).w
  40520. move.b d0,(Secondary_Angle).w
  40521. addi.b #$20,d0
  40522. andi.b #$C0,d0
  40523. cmpi.b #$40,d0
  40524. beq.w CheckLeftCeilingDist
  40525. cmpi.b #$80,d0
  40526. beq.w Sonic_CheckCeiling
  40527. cmpi.b #$C0,d0
  40528. beq.w CheckRightCeilingDist
  40529.  
  40530. ; End of function CalcRoomOverHead
  40531.  
  40532. ; ---------------------------------------------------------------------------
  40533. ; Subroutine to check if Sonic/Tails is near the floor
  40534. ; ---------------------------------------------------------------------------
  40535.  
  40536. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40537.  
  40538. ; loc_1EC4E: Sonic_HitFloor:
  40539. Sonic_CheckFloor:
  40540. move.l #Primary_Collision,(Collision_addr).w
  40541. cmpi.b #$C,top_solid_bit(a0)
  40542. beq.s +
  40543. move.l #Secondary_Collision,(Collision_addr).w
  40544. +
  40545. move.b top_solid_bit(a0),d5
  40546. move.w y_pos(a0),d2
  40547. move.w x_pos(a0),d3
  40548. moveq #0,d0
  40549. move.b y_radius(a0),d0
  40550. ext.w d0
  40551. add.w d0,d2
  40552. move.b x_radius(a0),d0
  40553. ext.w d0
  40554. add.w d0,d3
  40555. lea (Primary_Angle).w,a4
  40556. movea.w #$10,a3
  40557. move.w #0,d6
  40558. bsr.w FindFloor
  40559. move.w d1,-(sp)
  40560. move.w y_pos(a0),d2
  40561. move.w x_pos(a0),d3
  40562. moveq #0,d0
  40563. move.b y_radius(a0),d0
  40564. ext.w d0
  40565. add.w d0,d2
  40566. move.b x_radius(a0),d0
  40567. ext.w d0
  40568. sub.w d0,d3
  40569. lea (Secondary_Angle).w,a4
  40570. movea.w #$10,a3
  40571. move.w #0,d6
  40572. bsr.w FindFloor
  40573. move.w (sp)+,d0
  40574. move.b #0,d2
  40575.  
  40576. loc_1ECC6:
  40577. move.b (Secondary_Angle).w,d3
  40578. cmp.w d0,d1
  40579. ble.s loc_1ECD4
  40580. move.b (Primary_Angle).w,d3
  40581. exg d0,d1
  40582.  
  40583. loc_1ECD4:
  40584. btst #0,d3
  40585. beq.s +
  40586. move.b d2,d3
  40587. +
  40588. rts
  40589. ; ===========================================================================
  40590.  
  40591. ; a bit of unused/dead code here
  40592. ;CheckFloorDist:
  40593. move.w y_pos(a0),d2 ; a0=character
  40594. move.w x_pos(a0),d3
  40595.  
  40596. ; Checks a 16x16 block to find solid ground. May check an additional
  40597. ; 16x16 block up for ceilings.
  40598. ; d2 = y_pos
  40599. ; d3 = x_pos
  40600. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  40601. ; returns relevant block ID in (a1)
  40602. ; returns distance in d1
  40603. ; returns angle in d3, or zero if angle was odd
  40604. ;loc_1ECE6:
  40605. CheckFloorDist_Part2:
  40606. addi.w #$A,d2
  40607. lea (Primary_Angle).w,a4
  40608. movea.w #$10,a3
  40609. move.w #0,d6
  40610. bsr.w FindFloor
  40611. move.b #0,d2
  40612.  
  40613. ; d2 what to use as angle if (Primary_Angle).w is odd
  40614. ; returns angle in d3, or value in d2 if angle was odd
  40615. loc_1ECFE:
  40616. move.b (Primary_Angle).w,d3
  40617. btst #0,d3
  40618. beq.s +
  40619. move.b d2,d3
  40620. +
  40621. rts
  40622. ; ===========================================================================
  40623.  
  40624. ; Unused collision checking subroutine
  40625.  
  40626. move.w x_pos(a0),d3 ; a0=character
  40627. move.w y_pos(a0),d2
  40628. subq.w #4,d2
  40629. move.l #Primary_Collision,(Collision_addr).w
  40630. cmpi.b #$D,lrb_solid_bit(a0)
  40631. beq.s +
  40632. move.l #Secondary_Collision,(Collision_addr).w
  40633. +
  40634. lea (Primary_Angle).w,a4
  40635. move.b #0,(a4)
  40636. movea.w #$10,a3
  40637. move.w #0,d6
  40638. move.b lrb_solid_bit(a0),d5
  40639. bsr.w FindFloor
  40640. move.b (Primary_Angle).w,d3
  40641. btst #0,d3
  40642. beq.s +
  40643. move.b #0,d3
  40644. +
  40645. rts
  40646.  
  40647. ; ===========================================================================
  40648. ; loc_1ED56:
  40649. ChkFloorEdge:
  40650. move.w x_pos(a0),d3
  40651. ; loc_1ED5A:
  40652. ChkFloorEdge_Part2:
  40653. move.w y_pos(a0),d2
  40654. moveq #0,d0
  40655. move.b y_radius(a0),d0
  40656. ext.w d0
  40657. add.w d0,d2
  40658. move.l #Primary_Collision,(Collision_addr).w
  40659. cmpi.b #$C,top_solid_bit(a0)
  40660. beq.s +
  40661. move.l #Secondary_Collision,(Collision_addr).w
  40662. +
  40663. lea (Primary_Angle).w,a4
  40664. move.b #0,(a4)
  40665. movea.w #$10,a3
  40666. move.w #0,d6
  40667. move.b top_solid_bit(a0),d5
  40668. bsr.w FindFloor
  40669. move.b (Primary_Angle).w,d3
  40670. btst #0,d3
  40671. beq.s +
  40672. move.b #0,d3
  40673. +
  40674. rts
  40675. ; ===========================================================================
  40676. ; Identical to ChkFloorEdge except that this uses a1 instead of a0
  40677. ;loc_1EDA8:
  40678. ChkFloorEdge2:
  40679. move.w x_pos(a1),d3
  40680. move.w y_pos(a1),d2
  40681. moveq #0,d0
  40682. move.b y_radius(a1),d0
  40683. ext.w d0
  40684. add.w d0,d2
  40685. move.l #Primary_Collision,(Collision_addr).w
  40686. cmpi.b #$C,top_solid_bit(a1)
  40687. beq.s +
  40688. move.l #Secondary_Collision,(Collision_addr).w
  40689. +
  40690. lea (Primary_Angle).w,a4
  40691. move.b #0,(a4)
  40692. movea.w #$10,a3
  40693. move.w #0,d6
  40694. move.b top_solid_bit(a1),d5
  40695. bsr.w FindFloor
  40696. move.b (Primary_Angle).w,d3
  40697. btst #0,d3
  40698. beq.s return_1EDF8
  40699. move.b #0,d3
  40700.  
  40701. return_1EDF8:
  40702. rts
  40703. ; ===========================================================================
  40704.  
  40705. ; ---------------------------------------------------------------------------
  40706. ; Subroutine checking if an object should interact with the floor
  40707. ; (objects such as a monitor Sonic bumps from underneath)
  40708. ; ---------------------------------------------------------------------------
  40709.  
  40710. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40711.  
  40712. ; loc_1EDFA: ObjHitFloor:
  40713. ObjCheckFloorDist:
  40714. move.w x_pos(a0),d3
  40715. move.w y_pos(a0),d2
  40716. move.b y_radius(a0),d0
  40717. ext.w d0
  40718. add.w d0,d2
  40719. lea (Primary_Angle).w,a4
  40720. move.b #0,(a4)
  40721. movea.w #$10,a3
  40722. move.w #0,d6
  40723. moveq #$C,d5
  40724. bsr.w FindFloor
  40725. move.b (Primary_Angle).w,d3
  40726. btst #0,d3
  40727. beq.s +
  40728. move.b #0,d3
  40729. +
  40730. rts
  40731. ; ===========================================================================
  40732.  
  40733. ; ---------------------------------------------------------------------------
  40734. ; Collision check used to let the HTZ boss fire attack to hit the ground
  40735. ; ---------------------------------------------------------------------------
  40736.  
  40737. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40738.  
  40739. ; loc_1EE30:
  40740. FireCheckFloorDist:
  40741. move.w x_pos(a1),d3
  40742. move.w y_pos(a1),d2
  40743. move.b y_radius(a1),d0
  40744. ext.w d0
  40745. add.w d0,d2
  40746. lea (Primary_Angle).w,a4
  40747. move.b #0,(a4)
  40748. movea.w #$10,a3
  40749. move.w #0,d6
  40750. moveq #$C,d5
  40751. bra.w FindFloor
  40752. ; End of function FireCheckFloorDist
  40753.  
  40754. ; ---------------------------------------------------------------------------
  40755. ; Collision check used to let scattered rings bounce on the ground
  40756. ; ---------------------------------------------------------------------------
  40757.  
  40758. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40759.  
  40760. ; loc_1EE56:
  40761. RingCheckFloorDist:
  40762. move.w x_pos(a0),d3
  40763. move.w y_pos(a0),d2
  40764. move.b y_radius(a0),d0
  40765. ext.w d0
  40766. add.w d0,d2
  40767. lea (Primary_Angle).w,a4
  40768. move.b #0,(a4)
  40769. movea.w #$10,a3
  40770. move.w #0,d6
  40771. moveq #$C,d5
  40772. bra.w Ring_FindFloor
  40773. ; End of function RingCheckFloorDist
  40774.  
  40775. ; ---------------------------------------------------------------------------
  40776. ; Stores a distance to the nearest wall above Sonic/Tails,
  40777. ; where "above" = right, into d1
  40778. ; ---------------------------------------------------------------------------
  40779.  
  40780. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40781.  
  40782. ; loc_1EE7C:
  40783. CheckRightCeilingDist:
  40784. move.w y_pos(a0),d2
  40785. move.w x_pos(a0),d3
  40786. moveq #0,d0
  40787. move.b x_radius(a0),d0
  40788. ext.w d0
  40789. sub.w d0,d2
  40790. move.b y_radius(a0),d0
  40791. ext.w d0
  40792. add.w d0,d3
  40793. lea (Primary_Angle).w,a4
  40794. movea.w #$10,a3
  40795. move.w #0,d6
  40796. bsr.w FindWall
  40797. move.w d1,-(sp)
  40798. move.w y_pos(a0),d2
  40799. move.w x_pos(a0),d3
  40800. moveq #0,d0
  40801. move.b x_radius(a0),d0
  40802. ext.w d0
  40803. add.w d0,d2
  40804. move.b y_radius(a0),d0
  40805. ext.w d0
  40806. add.w d0,d3
  40807. lea (Secondary_Angle).w,a4
  40808. movea.w #$10,a3
  40809. move.w #0,d6
  40810. bsr.w FindWall
  40811. move.w (sp)+,d0
  40812. move.b #-$40,d2
  40813. bra.w loc_1ECC6
  40814. ; End of function CheckRightCeilingDist
  40815.  
  40816. ; ---------------------------------------------------------------------------
  40817. ; Stores a distance to the nearest wall on the right of Sonic/Tails into d1
  40818. ; ---------------------------------------------------------------------------
  40819.  
  40820. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40821.  
  40822. ; Checks a 16x16 block to find solid walls. May check an additional
  40823. ; 16x16 block up for walls.
  40824. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  40825. ; returns relevant block ID in (a1)
  40826. ; returns distance in d1
  40827. ; returns angle in d3, or zero if angle was odd
  40828. ; sub_1EEDC:
  40829. CheckRightWallDist:
  40830. move.w y_pos(a0),d2
  40831. move.w x_pos(a0),d3
  40832. ; loc_1EEE4:
  40833. CheckRightWallDist_Part2:
  40834. addi.w #$A,d3
  40835. lea (Primary_Angle).w,a4
  40836. movea.w #$10,a3
  40837. move.w #0,d6
  40838. bsr.w FindWall
  40839. move.b #-$40,d2
  40840. bra.w loc_1ECFE
  40841. ; End of function CheckRightWallDist
  40842.  
  40843. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40844.  
  40845. ; loc_1EF00: ObjCheckLeftWallDist:
  40846. ObjCheckRightWallDist:
  40847. add.w x_pos(a0),d3
  40848. move.w y_pos(a0),d2
  40849. lea (Primary_Angle).w,a4
  40850. move.b #0,(a4)
  40851. movea.w #$10,a3
  40852. move.w #0,d6
  40853. moveq #$D,d5
  40854. bsr.w FindWall
  40855. move.b (Primary_Angle).w,d3
  40856. btst #0,d3
  40857. beq.s +
  40858. move.b #-$40,d3
  40859. +
  40860. rts
  40861. ; End of function ObjCheckRightWallDist
  40862.  
  40863. ; ---------------------------------------------------------------------------
  40864. ; Stores a distance from Sonic/Tails to the nearest ceiling into d1
  40865. ; ---------------------------------------------------------------------------
  40866.  
  40867. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40868.  
  40869. ; loc_1EF2E: Sonic_DontRunOnWalls: CheckCeilingDist:
  40870. Sonic_CheckCeiling:
  40871. move.w y_pos(a0),d2
  40872. move.w x_pos(a0),d3
  40873. moveq #0,d0
  40874. move.b y_radius(a0),d0
  40875. ext.w d0
  40876. sub.w d0,d2
  40877. eori.w #$F,d2 ; flip position upside-down within the current 16x16 block?
  40878. move.b x_radius(a0),d0
  40879. ext.w d0
  40880. add.w d0,d3
  40881. lea (Primary_Angle).w,a4
  40882. movea.w #-$10,a3
  40883. move.w #$800,d6
  40884. bsr.w FindFloor
  40885. move.w d1,-(sp)
  40886.  
  40887. move.w y_pos(a0),d2
  40888. move.w x_pos(a0),d3
  40889. moveq #0,d0
  40890. move.b y_radius(a0),d0
  40891. ext.w d0
  40892. sub.w d0,d2
  40893. eori.w #$F,d2
  40894. move.b x_radius(a0),d0
  40895. ext.w d0
  40896. sub.w d0,d3
  40897. lea (Secondary_Angle).w,a4
  40898. movea.w #-$10,a3
  40899. move.w #$800,d6
  40900. bsr.w FindFloor
  40901. move.w (sp)+,d0
  40902.  
  40903. move.b #$80,d2
  40904. bra.w loc_1ECC6
  40905. ; End of function Sonic_CheckCeiling
  40906.  
  40907. ; ===========================================================================
  40908. ; a bit of unused/dead code here
  40909. ;CheckCeilingDist:
  40910. move.w y_pos(a0),d2 ; a0=character
  40911. move.w x_pos(a0),d3
  40912.  
  40913. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40914.  
  40915. ; Checks a 16x16 block to find solid ceiling. May check an additional
  40916. ; 16x16 block up for ceilings.
  40917. ; d2 = y_pos
  40918. ; d3 = x_pos
  40919. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  40920. ; returns relevant block ID in (a1)
  40921. ; returns distance in d1
  40922. ; returns angle in d3, or zero if angle was odd
  40923. ; loc_1EF9E: CheckSlopeDist:
  40924. CheckCeilingDist_Part2:
  40925. subi.w #$A,d2
  40926. eori.w #$F,d2
  40927. lea (Primary_Angle).w,a4
  40928. movea.w #-$10,a3
  40929. move.w #$800,d6
  40930. bsr.w FindFloor
  40931. move.b #$80,d2
  40932. bra.w loc_1ECFE
  40933. ; End of function CheckCeilingDist
  40934.  
  40935. ; ---------------------------------------------------------------------------
  40936. ; Stores a distance to the nearest wall above the object into d1
  40937. ; ---------------------------------------------------------------------------
  40938.  
  40939. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40940.  
  40941. ; loc_1EFBE: ObjHitCeiling:
  40942. ObjCheckCeilingDist:
  40943. move.w y_pos(a0),d2
  40944. move.w x_pos(a0),d3
  40945. moveq #0,d0
  40946. move.b y_radius(a0),d0
  40947. ext.w d0
  40948. sub.w d0,d2
  40949. eori.w #$F,d2
  40950. lea (Primary_Angle).w,a4
  40951. movea.w #-$10,a3
  40952. move.w #$800,d6
  40953. moveq #$D,d5
  40954. bsr.w FindFloor
  40955. move.b (Primary_Angle).w,d3
  40956. btst #0,d3
  40957. beq.s +
  40958. move.b #$80,d3
  40959. +
  40960. rts
  40961. ; End of function ObjCheckCeilingDist
  40962.  
  40963. ; ---------------------------------------------------------------------------
  40964. ; Stores a distance to the nearest wall above Sonic/Tails,
  40965. ; where "above" = left, into d1
  40966. ; ---------------------------------------------------------------------------
  40967.  
  40968. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  40969.  
  40970. ; loc_1EFF6:
  40971. CheckLeftCeilingDist:
  40972. move.w y_pos(a0),d2
  40973. move.w x_pos(a0),d3
  40974. moveq #0,d0
  40975. move.b x_radius(a0),d0
  40976. ext.w d0
  40977. sub.w d0,d2
  40978. move.b y_radius(a0),d0
  40979. ext.w d0
  40980. sub.w d0,d3
  40981. eori.w #$F,d3
  40982. lea (Primary_Angle).w,a4
  40983. movea.w #-$10,a3
  40984. move.w #$400,d6
  40985. bsr.w FindWall
  40986. move.w d1,-(sp)
  40987.  
  40988. move.w y_pos(a0),d2
  40989. move.w x_pos(a0),d3
  40990. moveq #0,d0
  40991. move.b x_radius(a0),d0
  40992. ext.w d0
  40993. add.w d0,d2
  40994. move.b y_radius(a0),d0
  40995. ext.w d0
  40996. sub.w d0,d3
  40997. eori.w #$F,d3
  40998. lea (Secondary_Angle).w,a4
  40999. movea.w #-$10,a3
  41000. move.w #$400,d6
  41001. bsr.w FindWall
  41002. move.w (sp)+,d0
  41003. move.b #$40,d2
  41004. bra.w loc_1ECC6
  41005. ; End of function CheckLeftCeilingDist
  41006.  
  41007. ; ---------------------------------------------------------------------------
  41008. ; Stores a distance to the nearest wall on the left of Sonic/Tails into d1
  41009. ; ---------------------------------------------------------------------------
  41010.  
  41011. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  41012.  
  41013. ; Checks a 16x16 block to find solid walls. May check an additional
  41014. ; 16x16 block up for walls.
  41015. ; d5 = ($c,$d) or ($e,$f) - solidity type bit (L/R/B or top)
  41016. ; returns relevant block ID in (a1)
  41017. ; returns distance in d1
  41018. ; returns angle in d3, or zero if angle was odd
  41019. ; loc_1F05E: Sonic_HitWall:
  41020. CheckLeftWallDist:
  41021. move.w y_pos(a0),d2
  41022. move.w x_pos(a0),d3
  41023. ; loc_1F066:
  41024. CheckLeftWallDist_Part2:
  41025. subi.w #$A,d3
  41026. eori.w #$F,d3
  41027. lea (Primary_Angle).w,a4
  41028. movea.w #-$10,a3
  41029. move.w #$400,d6
  41030. bsr.w FindWall
  41031. move.b #$40,d2
  41032. bra.w loc_1ECFE
  41033. ; End of function CheckLeftWallDist
  41034.  
  41035. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  41036.  
  41037. ; loc_1F086: ObjCheckRightWallDist:
  41038. ObjCheckLeftWallDist:
  41039. add.w x_pos(a0),d3
  41040. move.w y_pos(a0),d2
  41041. ; Engine bug: colliding with left walls is erratic with this function.
  41042. ; The cause is this: a missing instruction to flip collision on the found
  41043. ; 16x16 block; this one:
  41044. ;eori.w #$F,d3
  41045. lea (Primary_Angle).w,a4
  41046. move.b #0,(a4)
  41047. movea.w #-$10,a3
  41048. move.w #$400,d6
  41049. moveq #$D,d5
  41050. bsr.w FindWall
  41051. move.b (Primary_Angle).w,d3
  41052. btst #0,d3
  41053. beq.s +
  41054. move.b #$40,d3
  41055. +
  41056. rts
  41057.  
  41058.  
  41059.  
  41060.  
  41061. ; ===========================================================================
  41062. ; ----------------------------------------------------------------------------
  41063. ; Object 79 - Star pole / starpost / checkpoint
  41064. ; ----------------------------------------------------------------------------
  41065. ; Sprite_1F0B4:
  41066. Obj79:
  41067. moveq #0,d0
  41068. move.b routine(a0),d0
  41069. move.w Obj79_Index(pc,d0.w),d1
  41070. jmp Obj79_Index(pc,d1.w)
  41071. ; ===========================================================================
  41072. ; off_1F0C2: Obj79_States:
  41073. Obj79_Index: offsetTable
  41074. offsetTableEntry.w Obj79_Init ; 0
  41075. offsetTableEntry.w Obj79_Main ; 2
  41076. offsetTableEntry.w Obj79_Animate ; 4
  41077. offsetTableEntry.w Obj79_Dongle ; 6
  41078. offsetTableEntry.w Obj79_Star ; 8
  41079. ; ===========================================================================
  41080. ; loc_1F0CC:
  41081. Obj79_Init:
  41082. addq.b #2,routine(a0) ; => Obj79_Main
  41083. move.l #Obj79_MapUnc_1F424,mappings(a0)
  41084. move.w #make_art_tile(ArtTile_ArtNem_Checkpoint,0,0),art_tile(a0)
  41085. jsrto (Adjust2PArtPointer).l, JmpTo3_Adjust2PArtPointer
  41086. move.b #4,render_flags(a0)
  41087. move.b #8,width_pixels(a0)
  41088. move.b #5,priority(a0)
  41089. lea (Object_Respawn_Table).w,a2
  41090. moveq #0,d0
  41091. move.b respawn_index(a0),d0
  41092. bclr #7,2(a2,d0.w)
  41093. btst #0,2(a2,d0.w)
  41094. bne.s loc_1F120
  41095. move.b (Last_star_pole_hit).w,d1
  41096. andi.b #$7F,d1
  41097. move.b subtype(a0),d2
  41098. andi.b #$7F,d2
  41099. cmp.b d2,d1
  41100. blo.s Obj79_Main
  41101.  
  41102. loc_1F120:
  41103. bset #0,2(a2,d0.w)
  41104. move.b #2,anim(a0)
  41105.  
  41106. ; loc_1F12C:
  41107. Obj79_Main:
  41108. tst.w (Debug_placement_mode).w
  41109. bne.w Obj79_Animate
  41110. lea (MainCharacter).w,a3 ; a3=character
  41111. move.b (Last_star_pole_hit).w,d1
  41112. bsr.s Obj79_CheckActivation
  41113. tst.w (Two_player_mode).w
  41114. beq.w Obj79_Animate
  41115. lea (Sidekick).w,a3 ; a3=character
  41116. move.b (Last_star_pole_hit_2P).w,d1
  41117. bsr.s Obj79_CheckActivation
  41118. bra.w Obj79_Animate
  41119. ; ---------------------------------------------------------------------------
  41120. ; loc_1F154:
  41121. Obj79_CheckActivation:
  41122. andi.b #$7F,d1
  41123. move.b subtype(a0),d2
  41124. andi.b #$7F,d2
  41125. cmp.b d2,d1
  41126. bhs.w loc_1F222
  41127. move.w x_pos(a3),d0
  41128. sub.w x_pos(a0),d0
  41129. addi_.w #8,d0
  41130. cmpi.w #$10,d0
  41131. bhs.w return_1F220
  41132. move.w y_pos(a3),d0
  41133. sub.w y_pos(a0),d0
  41134. addi.w #$40,d0
  41135. cmpi.w #$68,d0
  41136. bhs.w return_1F220
  41137. move.w #SndID_Checkpoint,d0 ; checkpoint ding-dong sound
  41138. jsr (PlaySound).l
  41139. jsr (SingleObjLoad).l
  41140. bne.s loc_1F206
  41141. _move.b #ObjID_Starpost,id(a1) ; load obj79
  41142. move.b #6,routine(a1) ; => Obj79_Dongle
  41143. move.w x_pos(a0),objoff_30(a1)
  41144. move.w y_pos(a0),objoff_32(a1)
  41145. subi.w #$14,objoff_32(a1)
  41146. move.l mappings(a0),mappings(a1)
  41147. move.w art_tile(a0),art_tile(a1)
  41148. move.b #4,render_flags(a1)
  41149. move.b #8,width_pixels(a1)
  41150. move.b #4,priority(a1)
  41151. move.b #2,mapping_frame(a1)
  41152. move.w #$20,objoff_36(a1)
  41153. move.w a0,parent(a1)
  41154. tst.w (Two_player_mode).w
  41155. bne.s loc_1F206
  41156. cmpi.b #7,(Emerald_count).w
  41157. beq.s loc_1F206
  41158. cmpi.w #50,(Ring_count).w
  41159. blo.s loc_1F206
  41160. bsr.w Obj79_MakeSpecialStars
  41161.  
  41162. loc_1F206:
  41163. move.b #1,anim(a0)
  41164. bsr.w Obj79_SaveData
  41165. lea (Object_Respawn_Table).w,a2
  41166. moveq #0,d0
  41167. move.b respawn_index(a0),d0
  41168. bset #0,2(a2,d0.w)
  41169.  
  41170. return_1F220:
  41171. rts
  41172. ; ===========================================================================
  41173.  
  41174. loc_1F222:
  41175. tst.b anim(a0)
  41176. bne.s return_1F22E
  41177. move.b #2,anim(a0)
  41178.  
  41179. return_1F22E:
  41180. rts
  41181. ; ===========================================================================
  41182. ; loc_1F230:
  41183. Obj79_Animate:
  41184. lea (Ani_obj79).l,a1
  41185. jsrto (AnimateSprite).l, JmpTo2_AnimateSprite
  41186. jmp (MarkObjGone).l
  41187. ; ===========================================================================
  41188. ; loc_1F240:
  41189. Obj79_Dongle:
  41190. subq.w #1,objoff_36(a0)
  41191. bpl.s Obj79_MoveDonglyThing
  41192. movea.w parent(a0),a1 ; a1=object
  41193. cmpi.b #ObjID_Starpost,id(a1)
  41194. bne.s +
  41195. move.b #2,anim(a1)
  41196. move.b #0,mapping_frame(a1)
  41197. +
  41198. jmp (DeleteObject).l
  41199. ; ===========================================================================
  41200. ; loc_1F262:
  41201. Obj79_MoveDonglyThing:
  41202. move.b angle(a0),d0
  41203. subi.b #$10,angle(a0)
  41204. subi.b #$40,d0
  41205. jsr (CalcSine).l
  41206. muls.w #$C00,d1
  41207. swap d1
  41208. add.w objoff_30(a0),d1
  41209. move.w d1,x_pos(a0)
  41210. muls.w #$C00,d0
  41211. swap d0
  41212. add.w objoff_32(a0),d0
  41213. move.w d0,y_pos(a0)
  41214. jmp (MarkObjGone).l
  41215. ; ===========================================================================
  41216. ; hit a starpost / save checkpoint
  41217. ; loc_1F298:
  41218. Obj79_SaveData:
  41219. cmpa.w #MainCharacter,a3 ; is it player 1?
  41220. bne.w Obj79_SaveDataPlayer2 ; if not, branch
  41221. move.b subtype(a0),(Last_star_pole_hit).w
  41222. move.b (Last_star_pole_hit).w,(Saved_Last_star_pole_hit).w
  41223. move.w x_pos(a0),(Saved_x_pos).w
  41224. move.w y_pos(a0),(Saved_y_pos).w
  41225. move.w (MainCharacter+art_tile).w,(Saved_art_tile).w
  41226. move.w (MainCharacter+top_solid_bit).w,(Saved_Solid_bits).w
  41227. move.w (Ring_count).w,(Saved_Ring_count).w
  41228. move.b (Extra_life_flags).w,(Saved_Extra_life_flags).w
  41229. move.l (Timer).w,(Saved_Timer).w
  41230. move.b (Dynamic_Resize_Routine).w,(Saved_Dynamic_Resize_Routine).w
  41231. move.w (Camera_Max_Y_pos_now).w,(Saved_Camera_Max_Y_pos).w
  41232. move.w (Camera_X_pos).w,(Saved_Camera_X_pos).w
  41233. move.w (Camera_Y_pos).w,(Saved_Camera_Y_pos).w
  41234. move.w (Camera_BG_X_pos).w,(Saved_Camera_BG_X_pos).w
  41235. move.w (Camera_BG_Y_pos).w,(Saved_Camera_BG_Y_pos).w
  41236. move.w (Camera_BG2_X_pos).w,(Saved_Camera_BG2_X_pos).w
  41237. move.w (Camera_BG2_Y_pos).w,(Saved_Camera_BG2_Y_pos).w
  41238. move.w (Camera_BG3_X_pos).w,(Saved_Camera_BG3_X_pos).w
  41239. move.w (Camera_BG3_Y_pos).w,(Saved_Camera_BG3_Y_pos).w
  41240. move.w (Water_Level_2).w,(Saved_Water_Level).w
  41241. move.b (Water_routine).w,(Saved_Water_routine).w
  41242. move.b (Water_fullscreen_flag).w,(Saved_Water_move).w
  41243. rts
  41244. ; ===========================================================================
  41245. ; second player hit a checkpoint in 2-player mode
  41246. ; loc_1F326:
  41247. Obj79_SaveDataPlayer2:
  41248. move.b subtype(a0),(Last_star_pole_hit_2P).w
  41249. move.b (Last_star_pole_hit_2P).w,(Saved_Last_star_pole_hit_2P).w
  41250. move.w x_pos(a0),(Saved_x_pos_2P).w
  41251. move.w y_pos(a0),(Saved_y_pos_2P).w
  41252. move.w (Sidekick+art_tile).w,(Saved_art_tile_2P).w
  41253. move.w (Sidekick+top_solid_bit).w,(Saved_Solid_bits_2P).w
  41254. move.w (Ring_count_2P).w,(Saved_Ring_count_2P).w
  41255. move.b (Extra_life_flags_2P).w,(Saved_Extra_life_flags_2P).w
  41256. move.l (Timer_2P).w,(Saved_Timer_2P).w
  41257. rts
  41258. ; ===========================================================================
  41259. ; continue from a starpost / load checkpoint
  41260. ; loc_1F35E:
  41261. Obj79_LoadData:
  41262. move.b (Saved_Last_star_pole_hit).w,(Last_star_pole_hit).w
  41263. move.w (Saved_x_pos).w,(MainCharacter+x_pos).w
  41264. move.w (Saved_y_pos).w,(MainCharacter+y_pos).w
  41265. move.w (Saved_Ring_count).w,(Ring_count).w
  41266. move.b (Saved_Extra_life_flags).w,(Extra_life_flags).w
  41267. clr.w (Ring_count).w
  41268. clr.b (Extra_life_flags).w
  41269. move.l (Saved_Timer).w,(Timer).w
  41270. move.b #59,(Timer_frame).w
  41271. subq.b #1,(Timer_second).w
  41272. move.w (Saved_art_tile).w,(MainCharacter+art_tile).w
  41273. move.w (Saved_Solid_bits).w,(MainCharacter+top_solid_bit).w
  41274. move.b (Saved_Dynamic_Resize_Routine).w,(Dynamic_Resize_Routine).w
  41275. move.b (Saved_Water_routine).w,(Water_routine).w
  41276. move.w (Saved_Camera_Max_Y_pos).w,(Camera_Max_Y_pos_now).w
  41277. move.w (Saved_Camera_Max_Y_pos).w,(Camera_Max_Y_pos).w
  41278. move.w (Saved_Camera_X_pos).w,(Camera_X_pos).w
  41279. move.w (Saved_Camera_Y_pos).w,(Camera_Y_pos).w
  41280. move.w (Saved_Camera_BG_X_pos).w,(Camera_BG_X_pos).w
  41281. move.w (Saved_Camera_BG_Y_pos).w,(Camera_BG_Y_pos).w
  41282. move.w (Saved_Camera_BG2_X_pos).w,(Camera_BG2_X_pos).w
  41283. move.w (Saved_Camera_BG2_Y_pos).w,(Camera_BG2_Y_pos).w
  41284. move.w (Saved_Camera_BG3_X_pos).w,(Camera_BG3_X_pos).w
  41285. move.w (Saved_Camera_BG3_Y_pos).w,(Camera_BG3_Y_pos).w
  41286. tst.b (Water_flag).w ; does the level have water?
  41287. beq.s + ; if not, branch to skip loading water stuff
  41288. move.w (Saved_Water_Level).w,(Water_Level_2).w
  41289. move.b (Saved_Water_routine).w,(Water_routine).w
  41290. move.b (Saved_Water_move).w,(Water_fullscreen_flag).w
  41291. +
  41292. tst.b (Last_star_pole_hit).w
  41293. bpl.s return_1F412
  41294. move.w (Saved_x_pos).w,d0
  41295. subi.w #$A0,d0
  41296. move.w d0,(Camera_Min_X_pos).w
  41297.  
  41298. return_1F412:
  41299. rts
  41300. ; ===========================================================================
  41301. ; animation script
  41302. ; off_1F414:
  41303. Ani_obj79: offsetTable
  41304. offsetTableEntry.w byte_1F41A ; 0
  41305. offsetTableEntry.w byte_1F41D ; 1
  41306. offsetTableEntry.w byte_1F420 ; 2
  41307. byte_1F41A:
  41308. dc.b $F, 0,$FF
  41309. rev02even
  41310. byte_1F41D:
  41311. dc.b $F, 1,$FF
  41312. rev02even
  41313. byte_1F420:
  41314. dc.b 3, 0, 4,$FF
  41315. even
  41316. ; -------------------------------------------------------------------------------
  41317. ; sprite mappings
  41318. ; -------------------------------------------------------------------------------
  41319. Obj79_MapUnc_1F424: BINCLUDE "mappings/sprite/obj79_a.bin"
  41320. ; -------------------------------------------------------------------------------
  41321. ; sprite mappings
  41322. ; -------------------------------------------------------------------------------
  41323. Obj79_MapUnc_1F4A0: BINCLUDE "mappings/sprite/obj79_b.bin"
  41324. ; ===========================================================================
  41325.  
  41326. ; loc_1F4C4:
  41327. Obj79_MakeSpecialStars:
  41328. moveq #4-1,d1 ; execute the loop 4 times (1 for each star)
  41329. moveq #0,d2
  41330.  
  41331. - bsr.w SingleObjLoad2
  41332. bne.s + ; rts
  41333. _move.b id(a0),id(a1) ; load obj79
  41334. move.l #Obj79_MapUnc_1F4A0,mappings(a1)
  41335. move.w #make_art_tile(ArtTile_ArtNem_Checkpoint,0,0),art_tile(a1)
  41336. move.b #4,render_flags(a1)
  41337. move.b #8,routine(a1) ; => Obj79_Star
  41338. move.w x_pos(a0),d0
  41339. move.w d0,x_pos(a1)
  41340. move.w d0,objoff_30(a1)
  41341. move.w y_pos(a0),d0
  41342. subi.w #$30,d0
  41343. move.w d0,y_pos(a1)
  41344. move.w d0,objoff_32(a1)
  41345. move.b priority(a0),priority(a1)
  41346. move.b #8,width_pixels(a1)
  41347. move.b #1,mapping_frame(a1)
  41348. move.w #-$400,x_vel(a1)
  41349. move.w #0,y_vel(a1)
  41350. move.w d2,objoff_34(a1) ; set the angle
  41351. addi.w #$40,d2 ; increase the angle for next time
  41352. dbf d1,- ; loop
  41353. +
  41354. rts
  41355. ; ===========================================================================
  41356. ; loc_1F536:
  41357. Obj79_Star:
  41358. move.b collision_property(a0),d0
  41359. beq.w loc_1F554
  41360. andi.b #1,d0
  41361. beq.s +
  41362. move.b #1,(SpecialStage_flag_2P).w
  41363. move.b #GameModeID_SpecialStage,(Game_Mode).w ; => SpecialStage
  41364. +
  41365. clr.b collision_property(a0)
  41366.  
  41367. loc_1F554:
  41368. addi.w #$A,objoff_34(a0)
  41369. move.w objoff_34(a0),d0
  41370. andi.w #$FF,d0
  41371. jsr (CalcSine).l
  41372. asr.w #5,d0
  41373. asr.w #3,d1
  41374. move.w d1,d3
  41375. move.w objoff_34(a0),d2
  41376. andi.w #$3E0,d2
  41377. lsr.w #5,d2
  41378. moveq #2,d5
  41379. moveq #0,d4
  41380. cmpi.w #$10,d2
  41381. ble.s +
  41382. neg.w d1
  41383. +
  41384. andi.w #$F,d2
  41385. cmpi.w #8,d2
  41386. ble.s loc_1F594
  41387. neg.w d2
  41388. andi.w #7,d2
  41389.  
  41390. loc_1F594:
  41391. lsr.w #1,d2
  41392. beq.s +
  41393. add.w d1,d4
  41394. +
  41395. asl.w #1,d1
  41396. dbf d5,loc_1F594
  41397.  
  41398. asr.w #4,d4
  41399. add.w d4,d0
  41400. addq.w #1,objoff_36(a0)
  41401. move.w objoff_36(a0),d1
  41402. cmpi.w #$80,d1
  41403. beq.s loc_1F5BE
  41404. bgt.s loc_1F5C4
  41405.  
  41406. loc_1F5B4:
  41407. muls.w d1,d0
  41408. muls.w d1,d3
  41409. asr.w #7,d0
  41410. asr.w #7,d3
  41411. bra.s loc_1F5D6
  41412. ; ===========================================================================
  41413.  
  41414. loc_1F5BE:
  41415. move.b #$D8,collision_flags(a0)
  41416.  
  41417. loc_1F5C4:
  41418. cmpi.w #$180,d1
  41419. ble.s loc_1F5D6
  41420. neg.w d1
  41421. addi.w #$200,d1
  41422. bmi.w JmpTo10_DeleteObject
  41423. bra.s loc_1F5B4
  41424. ; ===========================================================================
  41425.  
  41426. loc_1F5D6:
  41427. move.w objoff_30(a0),d2
  41428. add.w d3,d2
  41429. move.w d2,x_pos(a0)
  41430. move.w objoff_32(a0),d2
  41431. add.w d0,d2
  41432. move.w d2,y_pos(a0)
  41433. addq.b #1,anim_frame(a0)
  41434. move.b anim_frame(a0),d0
  41435. andi.w #6,d0
  41436. lsr.w #1,d0
  41437. cmpi.b #3,d0
  41438. bne.s +
  41439. moveq #1,d0
  41440. +
  41441. move.b d0,mapping_frame(a0)
  41442. jmpto (MarkObjGone).l, JmpTo_MarkObjGone
  41443. ; ===========================================================================
  41444.  
  41445. JmpTo10_DeleteObject
  41446. jmp (DeleteObject).l
  41447. ; ===========================================================================
  41448.  
  41449. if gameRevision<2
  41450. nop
  41451. endif
  41452.  
  41453. if ~~removeJmpTos
  41454. JmpTo_MarkObjGone
  41455. jmp (MarkObjGone).l
  41456. JmpTo2_AnimateSprite
  41457. jmp (AnimateSprite).l
  41458. JmpTo3_Adjust2PArtPointer
  41459. jmp (Adjust2PArtPointer).l
  41460.  
  41461. align 4
  41462. endif
  41463.  
  41464.  
  41465.  
  41466.  
  41467. ; ===========================================================================
  41468. ; ----------------------------------------------------------------------------
  41469. ; Object 7D - Points that can be gotten at the end of an act (leftover from S1) (unused)
  41470. ; ----------------------------------------------------------------------------
  41471. ; Sprite_1F624:
  41472. Obj7D:
  41473. moveq #0,d0
  41474. move.b routine(a0),d0
  41475. move.w Obj7D_Index(pc,d0.w),d1
  41476. jmp Obj7D_Index(pc,d1.w)
  41477. ; ===========================================================================
  41478. ; off_1F632: Obj7D_States:
  41479. Obj7D_Index: offsetTable
  41480. offsetTableEntry.w Obj7D_Init ; 0
  41481. offsetTableEntry.w Obj7D_Main ; 2
  41482. ; ===========================================================================
  41483. ; loc_1F636:
  41484. Obj7D_Init:
  41485. moveq #$10,d2
  41486. move.w d2,d3
  41487. add.w d3,d3
  41488. lea (MainCharacter).w,a1 ; a1=character
  41489. move.w x_pos(a1),d0
  41490. sub.w x_pos(a0),d0
  41491. add.w d2,d0
  41492. cmp.w d3,d0
  41493. bhs.s Obj7D_NoAdd
  41494. move.w y_pos(a1),d1
  41495. sub.w y_pos(a0),d1
  41496. add.w d2,d1
  41497. cmp.w d3,d1
  41498. bhs.s Obj7D_NoAdd
  41499. tst.w (Debug_placement_mode).w
  41500. bne.s Obj7D_NoAdd
  41501. tst.b (SpecialStage_flag_2P).w
  41502. bne.s Obj7D_NoAdd
  41503. addq.b #2,routine(a0)
  41504. move.l #Obj7D_MapUnc_1F6FE,mappings(a0)
  41505. move.w #make_art_tile(ArtTile_ArtNem_EndPoints,0,1),art_tile(a0)
  41506. jsrto (Adjust2PArtPointer).l, JmpTo4_Adjust2PArtPointer
  41507. ori.b #4,render_flags(a0)
  41508. move.b #0,priority(a0)
  41509. move.b #$10,width_pixels(a0)
  41510. move.b subtype(a0),mapping_frame(a0)
  41511. move.w #$77,objoff_30(a0)
  41512. move.w #SndID_Bonus,d0
  41513. jsr (PlaySound).l
  41514. moveq #0,d0
  41515. move.b subtype(a0),d0
  41516. add.w d0,d0
  41517. move.w word_1F6D2(pc,d0.w),d0
  41518. jsr (AddPoints).l
  41519.  
  41520. Obj7D_NoAdd:
  41521. move.w x_pos(a0),d0
  41522. andi.w #$FF80,d0
  41523. sub.w (Camera_X_pos_coarse).w,d0
  41524. cmpi.w #$280,d0
  41525. bhi.s JmpTo11_DeleteObject
  41526. rts
  41527. ; ===========================================================================
  41528.  
  41529. JmpTo11_DeleteObject
  41530. jmp (DeleteObject).l
  41531. ; ===========================================================================
  41532. word_1F6D2:
  41533. dc.w 0
  41534. dc.w 1000 ; 1
  41535. dc.w 100 ; 2
  41536. dc.w 1 ; 3
  41537. ; ===========================================================================
  41538. ; loc_1F6DA:
  41539. Obj7D_Main:
  41540. subq.w #1,objoff_30(a0)
  41541. bmi.s JmpTo12_DeleteObject
  41542. move.w x_pos(a0),d0
  41543. andi.w #$FF80,d0
  41544. sub.w (Camera_X_pos_coarse).w,d0
  41545. cmpi.w #$280,d0
  41546. bhi.s JmpTo12_DeleteObject
  41547. jmp (DisplaySprite).l
  41548. ; ===========================================================================
  41549.  
  41550. JmpTo12_DeleteObject
  41551. jmp (DeleteObject).l
  41552. ; ===========================================================================
  41553. ; -------------------------------------------------------------------------------
  41554. ; Unused sprite mappings
  41555. ; -------------------------------------------------------------------------------
  41556. Obj7D_MapUnc_1F6FE: BINCLUDE "mappings/sprite/obj7D.bin"
  41557. ; ===========================================================================
  41558.  
  41559. if gameRevision<2
  41560. nop
  41561. endif
  41562.  
  41563. if ~~removeJmpTos
  41564. JmpTo4_Adjust2PArtPointer
  41565. jmp (Adjust2PArtPointer).l
  41566.  
  41567. align 4
  41568. endif
  41569.  
  41570.  
  41571.  
  41572.  
  41573. ; ===========================================================================
  41574. ; ----------------------------------------------------------------------------
  41575. ; Object 44 - Round bumper from Casino Night Zone
  41576. ; ----------------------------------------------------------------------------
  41577. ; Sprite_1F730:
  41578. Obj44:
  41579. moveq #0,d0
  41580. move.b routine(a0),d0
  41581. move.w Obj44_Index(pc,d0.w),d1
  41582. jmp Obj44_Index(pc,d1.w)
  41583. ; ===========================================================================
  41584. ; off_1F73E: Obj44_States:
  41585. Obj44_Index: offsetTable
  41586. offsetTableEntry.w Obj44_Init ; 0
  41587. offsetTableEntry.w Obj44_Main ; 2
  41588. ; ===========================================================================
  41589. ; loc_1F742:
  41590. Obj44_Init:
  41591. addq.b #2,routine(a0) ; => Obj44_Main
  41592. move.l #Obj44_MapUnc_1F85A,mappings(a0)
  41593. move.w #make_art_tile(ArtTile_ArtNem_CNZRoundBumper,2,0),art_tile(a0)
  41594. jsrto (Adjust2PArtPointer).l, JmpTo5_Adjust2PArtPointer
  41595. move.b #4,render_flags(a0)
  41596. move.b #$10,width_pixels(a0)
  41597. move.b #1,priority(a0)
  41598. move.b #$D7,collision_flags(a0)
  41599.  
  41600. ; loc_1F770:
  41601. Obj44_Main:
  41602. move.b collision_property(a0),d0
  41603. beq.w loc_1F83E
  41604. lea (MainCharacter).w,a1 ; a1=character
  41605. bclr #0,collision_property(a0)
  41606. beq.s +
  41607. bsr.s Obj44_BumpCharacter
  41608. +
  41609. lea (Sidekick).w,a1 ; a1=character
  41610. bclr #1,collision_property(a0)
  41611. beq.s +
  41612. bsr.s Obj44_BumpCharacter
  41613. +
  41614. clr.b collision_property(a0)
  41615. bra.w loc_1F83E
  41616. ; ===========================================================================
  41617. ; loc_1F79C:
  41618. Obj44_BumpCharacter:
  41619. move.w x_pos(a0),d1
  41620. move.w y_pos(a0),d2
  41621. sub.w x_pos(a1),d1
  41622. sub.w y_pos(a1),d2
  41623. jsr (CalcAngle).l
  41624. move.b (Timer_frames).w,d1
  41625. andi.w #3,d1
  41626. add.w d1,d0
  41627. jsr (CalcSine).l
  41628. muls.w #-$700,d1
  41629. asr.l #8,d1
  41630. move.w d1,x_vel(a1)
  41631. muls.w #-$700,d0
  41632. asr.l #8,d0
  41633. move.w d0,y_vel(a1)
  41634. bset #1,status(a1)
  41635. bclr #4,status(a1)
  41636. bclr #5,status(a1)
  41637. clr.b jumping(a1)
  41638. move.b #1,anim(a0)
  41639. move.w #SndID_Bumper,d0
  41640. jsr (PlaySound).l
  41641. lea (Object_Respawn_Table).w,a2
  41642. moveq #0,d0
  41643. move.b respawn_index(a0),d0
  41644. beq.s +
  41645. cmpi.b #$8A,2(a2,d0.w)
  41646. bhs.s return_1F83C
  41647. addq.b #1,2(a2,d0.w)
  41648. +
  41649. moveq #1,d0
  41650. movea.w a1,a3
  41651. jsr (AddPoints2).l
  41652. bsr.w SingleObjLoad
  41653. bne.s return_1F83C
  41654. _move.b #ObjID_Points,id(a1) ; load obj29
  41655. move.w x_pos(a0),x_pos(a1)
  41656. move.w y_pos(a0),y_pos(a1)
  41657. move.b #4,mapping_frame(a1)
  41658.  
  41659. return_1F83C:
  41660. rts
  41661. ; ===========================================================================
  41662.  
  41663. loc_1F83E:
  41664. lea (Ani_obj44).l,a1
  41665. jsrto (AnimateSprite).l, JmpTo3_AnimateSprite
  41666. jmpto (MarkObjGone).l, JmpTo2_MarkObjGone
  41667. ; ===========================================================================
  41668. ; animation script
  41669. ; off_1F84C:
  41670. Ani_obj44: offsetTable
  41671. offsetTableEntry.w byte_1F850 ; 0
  41672. offsetTableEntry.w byte_1F853 ; 1
  41673. byte_1F850: dc.b $F, 0,$FF
  41674. rev02even
  41675. byte_1F853: dc.b 3, 1, 0, 1,$FD, 0
  41676. even
  41677. ; -------------------------------------------------------------------------------
  41678. ; sprite mappings
  41679. ; -------------------------------------------------------------------------------
  41680. Obj44_MapUnc_1F85A: BINCLUDE "mappings/sprite/obj44.bin"
  41681. ; ===========================================================================
  41682.  
  41683. if gameRevision<2
  41684. nop
  41685. endif
  41686.  
  41687. if ~~removeJmpTos
  41688. JmpTo2_MarkObjGone
  41689. jmp (MarkObjGone).l
  41690. JmpTo3_AnimateSprite
  41691. jmp (AnimateSprite).l
  41692. JmpTo5_Adjust2PArtPointer
  41693. jmp (Adjust2PArtPointer).l
  41694.  
  41695. align 4
  41696. endif
  41697.  
  41698.  
  41699.  
  41700.  
  41701. ; ===========================================================================
  41702. ; ----------------------------------------------------------------------------
  41703. ; Object 24 - Bubbles in Aquatic Ruin Zone
  41704. ; ----------------------------------------------------------------------------
  41705. ; Sprite_1F8A8:
  41706. Obj24:
  41707. moveq #0,d0
  41708. move.b routine(a0),d0
  41709. move.w Obj24_Index(pc,d0.w),d1
  41710. jmp Obj24_Index(pc,d1.w)
  41711. ; ===========================================================================
  41712. ; off_1F8B6:
  41713. Obj24_Index: offsetTable
  41714. offsetTableEntry.w Obj24_Init ; 0
  41715. offsetTableEntry.w loc_1F924 ; 2
  41716. offsetTableEntry.w loc_1F93E ; 4
  41717. offsetTableEntry.w loc_1F99E ; 6
  41718. offsetTableEntry.w BranchTo_JmpTo15_DeleteObject ; 8
  41719. offsetTableEntry.w loc_1F9C0 ; $A
  41720. ; ===========================================================================
  41721. ; loc_1F8C2:
  41722. Obj24_Init:
  41723. addq.b #2,routine(a0)
  41724. move.l #Obj24_MapUnc_1FBF6,mappings(a0)
  41725. move.w #make_art_tile(ArtTile_ArtNem_BigBubbles,0,1),art_tile(a0)
  41726. jsrto (Adjust2PArtPointer).l, JmpTo6_Adjust2PArtPointer
  41727. move.b #$84,render_flags(a0)
  41728. move.b #$10,width_pixels(a0)
  41729. move.b #1,priority(a0)
  41730. move.b subtype(a0),d0
  41731. bpl.s loc_1F90A
  41732. addq.b #8,routine(a0)
  41733. andi.w #$7F,d0
  41734. move.b d0,objoff_32(a0)
  41735. move.b d0,objoff_33(a0)
  41736. move.b #6,anim(a0)
  41737. bra.w loc_1F9C0
  41738. ; ===========================================================================
  41739.  
  41740. loc_1F90A:
  41741. move.b d0,anim(a0)
  41742. move.w x_pos(a0),objoff_30(a0)
  41743. move.w #-$88,y_vel(a0)
  41744. jsr (RandomNumber).l
  41745. move.b d0,angle(a0)
  41746.  
  41747. loc_1F924:
  41748. lea (Ani_obj24).l,a1
  41749. jsr (AnimateSprite).l
  41750. cmpi.b #6,mapping_frame(a0)
  41751. bne.s loc_1F93E
  41752. move.b #1,objoff_2E(a0)
  41753.  
  41754. loc_1F93E:
  41755.  
  41756. move.w (Water_Level_1).w,d0
  41757. cmp.w y_pos(a0),d0
  41758. blo.s loc_1F956
  41759. move.b #6,routine(a0)
  41760. addq.b #3,anim(a0)
  41761. bra.w loc_1F99E
  41762. ; ===========================================================================
  41763.  
  41764. loc_1F956:
  41765. move.b angle(a0),d0
  41766. addq.b #1,angle(a0)
  41767. andi.w #$7F,d0
  41768. lea (Obj0A_WobbleData).l,a1
  41769. move.b (a1,d0.w),d0
  41770. ext.w d0
  41771. add.w objoff_30(a0),d0
  41772. move.w d0,x_pos(a0)
  41773. tst.b objoff_2E(a0)
  41774. beq.s loc_1F988
  41775. bsr.w loc_1FB02
  41776. cmpi.b #6,routine(a0)
  41777. beq.s loc_1F99E
  41778.  
  41779. loc_1F988:
  41780. jsrto (ObjectMove).l, JmpTo3_ObjectMove
  41781. tst.b render_flags(a0)
  41782. bpl.s JmpTo13_DeleteObject
  41783. jmp (DisplaySprite).l
  41784. ; ===========================================================================
  41785.  
  41786. JmpTo13_DeleteObject
  41787. jmp (DeleteObject).l
  41788. ; ===========================================================================
  41789.  
  41790. loc_1F99E:
  41791.  
  41792. lea (Ani_obj24).l,a1
  41793. jsr (AnimateSprite).l
  41794. tst.b render_flags(a0)
  41795. bpl.s JmpTo14_DeleteObject
  41796. jmp (DisplaySprite).l
  41797. ; ===========================================================================
  41798.  
  41799. JmpTo14_DeleteObject
  41800. jmp (DeleteObject).l
  41801. ; ===========================================================================
  41802.  
  41803. if removeJmpTos
  41804. JmpTo15_DeleteObject
  41805. endif
  41806.  
  41807. BranchTo_JmpTo15_DeleteObject
  41808. jmpto (DeleteObject).l, JmpTo15_DeleteObject
  41809. ; ===========================================================================
  41810.  
  41811. loc_1F9C0:
  41812.  
  41813. tst.w objoff_36(a0)
  41814. bne.s loc_1FA22
  41815. move.w (Water_Level_1).w,d0
  41816. cmp.w y_pos(a0),d0
  41817. bhs.w loc_1FACE
  41818. tst.b render_flags(a0)
  41819. bpl.w loc_1FACE
  41820. subq.w #1,objoff_38(a0)
  41821. bpl.w loc_1FAC2
  41822. move.w #1,objoff_36(a0)
  41823.  
  41824. loc_1F9E8:
  41825. jsr (RandomNumber).l
  41826. move.w d0,d1
  41827. andi.w #7,d0
  41828. cmpi.w #6,d0
  41829. bhs.s loc_1F9E8
  41830. move.b d0,objoff_34(a0)
  41831. andi.w #$C,d1
  41832. lea (byte_1FAF0).l,a1
  41833. adda.w d1,a1
  41834. move.l a1,objoff_3C(a0)
  41835. subq.b #1,objoff_32(a0)
  41836. bpl.s BranchTo_loc_1FA2A
  41837. move.b objoff_33(a0),objoff_32(a0)
  41838. bset #7,objoff_36(a0)
  41839.  
  41840. BranchTo_loc_1FA2A
  41841. bra.s loc_1FA2A
  41842. ; ===========================================================================
  41843.  
  41844. loc_1FA22:
  41845. subq.w #1,objoff_38(a0)
  41846. bpl.w loc_1FAC2
  41847.  
  41848. loc_1FA2A:
  41849. jsr (RandomNumber).l
  41850. andi.w #$1F,d0
  41851. move.w d0,objoff_38(a0)
  41852. bsr.w SingleObjLoad
  41853. bne.s loc_1FAA6
  41854. _move.b id(a0),id(a1) ; load obj24
  41855. move.w x_pos(a0),x_pos(a1)
  41856. jsr (RandomNumber).l
  41857. andi.w #$F,d0
  41858. subq.w #8,d0
  41859. add.w d0,x_pos(a1)
  41860. move.w y_pos(a0),y_pos(a1)
  41861. moveq #0,d0
  41862. move.b objoff_34(a0),d0
  41863. movea.l objoff_3C(a0),a2 ; a2=object
  41864. move.b (a2,d0.w),subtype(a1)
  41865. btst #7,objoff_36(a0)
  41866. beq.s loc_1FAA6
  41867. jsr (RandomNumber).l
  41868. andi.w #3,d0
  41869. bne.s loc_1FA92
  41870. bset #6,objoff_36(a0)
  41871. bne.s loc_1FAA6
  41872. move.b #2,subtype(a1)
  41873.  
  41874. loc_1FA92:
  41875. tst.b objoff_34(a0)
  41876. bne.s loc_1FAA6
  41877. bset #6,objoff_36(a0)
  41878. bne.s loc_1FAA6
  41879. move.b #2,subtype(a1)
  41880.  
  41881. loc_1FAA6:
  41882. subq.b #1,objoff_34(a0)
  41883. bpl.s loc_1FAC2
  41884. jsr (RandomNumber).l
  41885. andi.w #$7F,d0
  41886. addi.w #$80,d0
  41887. add.w d0,objoff_38(a0)
  41888. clr.w objoff_36(a0)
  41889.  
  41890. loc_1FAC2:
  41891. lea (Ani_obj24).l,a1
  41892. jsr (AnimateSprite).l
  41893.  
  41894. loc_1FACE:
  41895. move.w x_pos(a0),d0
  41896. andi.w #$FF80,d0
  41897. sub.w (Camera_X_pos_coarse).w,d0
  41898. cmpi.w #$280,d0
  41899. bhi.w JmpTo15_DeleteObject
  41900. move.w (Water_Level_1).w,d0
  41901. cmp.w y_pos(a0),d0
  41902. blo.w JmpTo7_DisplaySprite
  41903. rts
  41904.  
  41905. if removeJmpTos
  41906. JmpTo7_DisplaySprite
  41907. jmp (DisplaySprite).l
  41908. endif
  41909. ; ===========================================================================
  41910. byte_1FAF0:
  41911. dc.b 0
  41912. dc.b 1 ; 1
  41913. dc.b 0 ; 2
  41914. dc.b 0 ; 3
  41915. dc.b 0 ; 4
  41916. dc.b 0 ; 5
  41917. dc.b 1 ; 6
  41918. dc.b 0 ; 7
  41919. dc.b 0 ; 8
  41920. dc.b 0 ; 9
  41921. dc.b 0 ; 10
  41922. dc.b 1 ; 11
  41923. dc.b 0 ; 12
  41924. dc.b 1 ; 13
  41925. dc.b 0 ; 14
  41926. dc.b 0 ; 15
  41927. dc.b 1 ; 16
  41928. dc.b 0 ; 17
  41929. ; ===========================================================================
  41930.  
  41931. loc_1FB02:
  41932. lea (MainCharacter).w,a1 ; a1=character
  41933. bsr.s loc_1FB0C
  41934. lea (Sidekick).w,a1 ; a1=character
  41935.  
  41936. loc_1FB0C:
  41937. tst.b obj_control(a1)
  41938. bmi.w return_1FBCA
  41939. move.w x_pos(a1),d0
  41940. move.w x_pos(a0),d1
  41941. subi.w #$10,d1
  41942. cmp.w d0,d1
  41943. bhs.w return_1FBCA
  41944. addi.w #$20,d1
  41945. cmp.w d0,d1
  41946. blo.w return_1FBCA
  41947. move.w y_pos(a1),d0
  41948. move.w y_pos(a0),d1
  41949. cmp.w d0,d1
  41950. bhs.w return_1FBCA
  41951. addi.w #$10,d1
  41952. cmp.w d0,d1
  41953. blo.w return_1FBCA
  41954. bsr.w ResumeMusic
  41955. move.w #SndID_InhalingBubble,d0
  41956. jsr (PlaySound).l
  41957. clr.w x_vel(a1)
  41958. clr.w y_vel(a1)
  41959. clr.w inertia(a1)
  41960. move.b #AniIDSonAni_Bubble,anim(a1)
  41961. move.w #$23,move_lock(a1)
  41962. move.b #0,jumping(a1)
  41963. bclr #5,status(a1)
  41964. bclr #4,status(a1)
  41965. btst #2,status(a1)
  41966. beq.w loc_1FBB8
  41967. cmpi.b #1,(a1)
  41968. bne.s loc_1FBA8
  41969. bclr #2,status(a1)
  41970. move.b #$13,y_radius(a1)
  41971. move.b #9,x_radius(a1)
  41972. subq.w #5,y_pos(a1)
  41973. bra.s loc_1FBB8
  41974. ; ===========================================================================
  41975.  
  41976. loc_1FBA8:
  41977. move.b #$F,y_radius(a1)
  41978. move.b #9,x_radius(a1)
  41979. subq.w #1,y_pos(a1)
  41980.  
  41981. loc_1FBB8:
  41982. cmpi.b #6,routine(a0)
  41983. beq.s return_1FBCA
  41984. move.b #6,routine(a0)
  41985. addq.b #3,anim(a0)
  41986.  
  41987. return_1FBCA:
  41988. rts
  41989. ; ===========================================================================
  41990. ; -------------------------------------------------------------------------------
  41991. ; sprite animations
  41992. ; -------------------------------------------------------------------------------
  41993. ; animation script
  41994. ; off_1FBCC:
  41995. Ani_obj24: offsetTable
  41996. offsetTableEntry.w byte_1FBDA ; 0
  41997. offsetTableEntry.w byte_1FBDF ; 1
  41998. offsetTableEntry.w byte_1FBE5 ; 2
  41999. offsetTableEntry.w byte_1FBEC ; 3
  42000. offsetTableEntry.w byte_1FBEC ; 4
  42001. offsetTableEntry.w byte_1FBEE ; 5
  42002. offsetTableEntry.w byte_1FBF2 ; 6
  42003. byte_1FBDA: dc.b $E, 0, 1, 2,$FC
  42004. rev02even
  42005. byte_1FBDF: dc.b $E, 1, 2, 3, 4,$FC
  42006. rev02even
  42007. byte_1FBE5: dc.b $E, 2, 3, 4, 5, 6,$FC
  42008. rev02even
  42009. byte_1FBEC: dc.b 4,$FC
  42010. rev02even
  42011. byte_1FBEE: dc.b 4, 6, 7,$FC
  42012. rev02even
  42013. byte_1FBF2: dc.b $F, $E, $F,$FF
  42014. even
  42015. ; -------------------------------------------------------------------------------
  42016. ; sprite mappings
  42017. ; -------------------------------------------------------------------------------
  42018. Obj24_MapUnc_1FBF6: offsetTable
  42019. offsetTableEntry.w word_1FC3A ; 0
  42020. offsetTableEntry.w word_1FC44 ; 1
  42021. offsetTableEntry.w word_1FC44 ; 2
  42022. offsetTableEntry.w word_1FC4E ; 3
  42023. offsetTableEntry.w word_1FC58 ; 4
  42024. offsetTableEntry.w word_1FC62 ; 5
  42025. offsetTableEntry.w word_1FC6C ; 6
  42026. offsetTableEntry.w word_1FC76 ; 7
  42027. offsetTableEntry.w word_1FC98 ; 8
  42028. offsetTableEntry.w word_1FC98 ; 9
  42029. offsetTableEntry.w word_1FC98 ; $A
  42030. offsetTableEntry.w word_1FC98 ; $B
  42031. offsetTableEntry.w word_1FC98 ; $C
  42032. offsetTableEntry.w word_1FC98 ; $D
  42033. offsetTableEntry.w word_1FCA2 ; $E
  42034. offsetTableEntry.w word_1FCAC ; $F
  42035. offsetTableEntry.w word_1FCB6 ; $10
  42036. ; -------------------------------------------------------------------------------
  42037. ; sprite mappings
  42038. ; merged with the above mappings, can't split to file in a useful way...
  42039. ; -------------------------------------------------------------------------------
  42040. Obj24_MapUnc_1FC18: offsetTable
  42041. offsetTableEntry.w word_1FC3A ; 0
  42042. offsetTableEntry.w word_1FC44 ; 1
  42043. offsetTableEntry.w word_1FC44 ; 2
  42044. offsetTableEntry.w word_1FC4E ; 3
  42045. offsetTableEntry.w word_1FC58 ; 4
  42046. offsetTableEntry.w word_1FC62 ; 5
  42047. offsetTableEntry.w word_1FC6C ; 6
  42048. offsetTableEntry.w word_1FC76 ; 7
  42049. offsetTableEntry.w word_1FCB8 ; 8
  42050. offsetTableEntry.w word_1FCB8 ; 9
  42051. offsetTableEntry.w word_1FCB8 ; $A
  42052. offsetTableEntry.w word_1FCB8 ; $B
  42053. offsetTableEntry.w word_1FCB8 ; $C
  42054. offsetTableEntry.w word_1FCB8 ; $D
  42055. offsetTableEntry.w word_1FCA2 ; $E
  42056. offsetTableEntry.w word_1FCAC ; $F
  42057. offsetTableEntry.w word_1FCB6 ; $10
  42058. word_1FC3A:
  42059. dc.w 1
  42060. dc.w $FC00, $008D, $0046, $FFFC
  42061. word_1FC44:
  42062. dc.w 1
  42063. dc.w $FC00, $008E, $0047, $FFFC
  42064. word_1FC4E:
  42065. dc.w 1
  42066. dc.w $F805, $008F, $0047, $FFF8
  42067. word_1FC58:
  42068. dc.w 1
  42069. dc.w $F805, $0093, $0049, $FFF8
  42070. word_1FC62:
  42071. dc.w 1
  42072. dc.w $F40A, $001C, $000E, $FFF4
  42073. word_1FC6C:
  42074. dc.w 1
  42075. dc.w $F00F, $0008, $0004, $FFF0
  42076. word_1FC76:
  42077. dc.w 4
  42078. dc.w $F005, $0018, $000C, $FFF0
  42079. dc.w $F005, $0818, $080C, $0000
  42080. dc.w $0005, $1018, $100C, $FFF0
  42081. dc.w $0005, $1818, $180C, $0000
  42082. word_1FC98:
  42083. dc.w 1
  42084. dc.w $F406, $1F41, $1BA0, $FFF8
  42085. word_1FCA2:
  42086. dc.w 1
  42087. dc.w $F805, $0000, $0000, $FFF8
  42088. word_1FCAC:
  42089. dc.w 1
  42090. dc.w $F805, $0004, $0002, $FFF8
  42091. word_1FCB6:
  42092. dc.w 0
  42093. word_1FCB8:
  42094. dc.w 1
  42095. dc.w $F406, $1F31, $1B98, $FFF8
  42096. ; ===========================================================================
  42097.  
  42098. if gameRevision<2
  42099. nop
  42100. endif
  42101.  
  42102. if ~~removeJmpTos
  42103. JmpTo7_DisplaySprite
  42104. jmp (DisplaySprite).l
  42105. JmpTo15_DeleteObject
  42106. jmp (DeleteObject).l
  42107. JmpTo6_Adjust2PArtPointer
  42108. jmp (Adjust2PArtPointer).l
  42109. ; loc_1FCD6:
  42110. JmpTo3_ObjectMove
  42111. jmp (ObjectMove).l
  42112.  
  42113. align 4
  42114. endif
  42115.  
  42116.  
  42117.  
  42118.  
  42119. ; ===========================================================================
  42120. ; ----------------------------------------------------------------------------
  42121. ; Object 03 - Collision plane/layer switcher
  42122. ; ----------------------------------------------------------------------------
  42123. ; Sprite_1FCDC:
  42124. Obj03:
  42125. moveq #0,d0
  42126. move.b routine(a0),d0
  42127. move.w Obj03_Index(pc,d0.w),d1
  42128. jsr Obj03_Index(pc,d1.w)
  42129. jmp (MarkObjGone3).l
  42130. ; ===========================================================================
  42131. ; off_1FCF0:
  42132. Obj03_Index: offsetTable
  42133. offsetTableEntry.w Obj03_Init ; 0
  42134. offsetTableEntry.w Obj03_MainX ; 2
  42135. offsetTableEntry.w Obj03_MainY ; 4
  42136. ; ===========================================================================
  42137. ; loc_1FCF6:
  42138. Obj03_Init:
  42139. addq.b #2,routine(a0) ; => Obj03_MainX
  42140. move.l #Obj03_MapUnc_1FFB8,mappings(a0)
  42141. move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a0)
  42142. jsrto (Adjust2PArtPointer).l, JmpTo7_Adjust2PArtPointer
  42143. ori.b #4,render_flags(a0)
  42144. move.b #$10,width_pixels(a0)
  42145. move.b #5,priority(a0)
  42146. move.b subtype(a0),d0
  42147. btst #2,d0
  42148. beq.s Obj03_Init_CheckX
  42149. ;Obj03_Init_CheckY:
  42150. addq.b #2,routine(a0) ; => Obj03_MainY
  42151. andi.w #7,d0
  42152. move.b d0,mapping_frame(a0)
  42153. andi.w #3,d0
  42154. add.w d0,d0
  42155. move.w word_1FD68(pc,d0.w),objoff_32(a0)
  42156. move.w y_pos(a0),d1
  42157. lea (MainCharacter).w,a1 ; a1=character
  42158. cmp.w y_pos(a1),d1
  42159. bhs.s +
  42160. move.b #1,objoff_34(a0)
  42161. +
  42162. lea (Sidekick).w,a1 ; a1=character
  42163. cmp.w y_pos(a1),d1
  42164. bhs.s +
  42165. move.b #1,objoff_35(a0)
  42166. +
  42167. bra.w Obj03_MainY
  42168. ; ===========================================================================
  42169. word_1FD68:
  42170. dc.w $20
  42171. dc.w $40 ; 1
  42172. dc.w $80 ; 2
  42173. dc.w $100 ; 3
  42174. ; ===========================================================================
  42175. ; loc_1FD70:
  42176. Obj03_Init_CheckX:
  42177. andi.w #3,d0
  42178. move.b d0,mapping_frame(a0)
  42179. add.w d0,d0
  42180. move.w word_1FD68(pc,d0.w),objoff_32(a0)
  42181. move.w x_pos(a0),d1
  42182. lea (MainCharacter).w,a1 ; a1=character
  42183. cmp.w x_pos(a1),d1
  42184. bhs.s +
  42185. move.b #1,objoff_34(a0)
  42186. +
  42187. lea (Sidekick).w,a1 ; a1=character
  42188. cmp.w x_pos(a1),d1
  42189. bhs.s +
  42190. move.b #1,objoff_35(a0)
  42191. +
  42192.  
  42193. ; loc_1FDA4:
  42194. Obj03_MainX:
  42195. tst.w (Debug_placement_mode).w
  42196. bne.w return_1FEAC
  42197. move.w x_pos(a0),d1
  42198. lea objoff_34(a0),a2
  42199. lea (MainCharacter).w,a1 ; a1=character
  42200. bsr.s +
  42201. lea (Sidekick).w,a1 ; a1=character
  42202.  
  42203. + tst.b (a2)+
  42204. bne.s Obj03_MainX_Alt
  42205. cmp.w x_pos(a1),d1
  42206. bhi.w return_1FEAC
  42207. move.b #1,-1(a2)
  42208. move.w y_pos(a0),d2
  42209. move.w d2,d3
  42210. move.w objoff_32(a0),d4
  42211. sub.w d4,d2
  42212. add.w d4,d3
  42213. move.w y_pos(a1),d4
  42214. cmp.w d2,d4
  42215. blt.w return_1FEAC
  42216. cmp.w d3,d4
  42217. bge.w return_1FEAC
  42218. move.b subtype(a0),d0
  42219. bpl.s +
  42220. btst #1,status(a1)
  42221. bne.w return_1FEAC
  42222. +
  42223. btst #0,render_flags(a0)
  42224. bne.s +
  42225. move.b #$C,top_solid_bit(a1)
  42226. move.b #$D,lrb_solid_bit(a1)
  42227. btst #3,d0
  42228. beq.s +
  42229. move.b #$E,top_solid_bit(a1)
  42230. move.b #$F,lrb_solid_bit(a1)
  42231. +
  42232. andi.w #drawing_mask,art_tile(a1)
  42233. btst #5,d0
  42234. beq.s return_1FEAC
  42235. ori.w #high_priority,art_tile(a1)
  42236. bra.s return_1FEAC
  42237. ; ===========================================================================
  42238. ; loc_1FE38:
  42239. Obj03_MainX_Alt:
  42240. cmp.w x_pos(a1),d1
  42241. bls.w return_1FEAC
  42242. move.b #0,-1(a2)
  42243. move.w y_pos(a0),d2
  42244. move.w d2,d3
  42245. move.w objoff_32(a0),d4
  42246. sub.w d4,d2
  42247. add.w d4,d3
  42248. move.w y_pos(a1),d4
  42249. cmp.w d2,d4
  42250. blt.w return_1FEAC
  42251. cmp.w d3,d4
  42252. bge.w return_1FEAC
  42253. move.b subtype(a0),d0
  42254. bpl.s +
  42255. btst #1,status(a1)
  42256. bne.w return_1FEAC
  42257. +
  42258. btst #0,render_flags(a0)
  42259. bne.s +
  42260. move.b #$C,top_solid_bit(a1)
  42261. move.b #$D,lrb_solid_bit(a1)
  42262. btst #4,d0
  42263. beq.s +
  42264. move.b #$E,top_solid_bit(a1)
  42265. move.b #$F,lrb_solid_bit(a1)
  42266. +
  42267. andi.w #drawing_mask,art_tile(a1)
  42268. btst #6,d0
  42269. beq.s return_1FEAC
  42270. ori.w #high_priority,art_tile(a1)
  42271.  
  42272. return_1FEAC:
  42273. rts
  42274. ; ===========================================================================
  42275.  
  42276. Obj03_MainY:
  42277. tst.w (Debug_placement_mode).w
  42278. bne.w return_1FFB6
  42279. move.w y_pos(a0),d1
  42280. lea objoff_34(a0),a2
  42281. lea (MainCharacter).w,a1 ; a1=character
  42282. bsr.s +
  42283. lea (Sidekick).w,a1 ; a1=character
  42284.  
  42285. + tst.b (a2)+
  42286. bne.s Obj03_MainY_Alt
  42287. cmp.w y_pos(a1),d1
  42288. bhi.w return_1FFB6
  42289. move.b #1,-1(a2)
  42290. move.w x_pos(a0),d2
  42291. move.w d2,d3
  42292. move.w objoff_32(a0),d4
  42293. sub.w d4,d2
  42294. add.w d4,d3
  42295. move.w x_pos(a1),d4
  42296. cmp.w d2,d4
  42297. blt.w return_1FFB6
  42298. cmp.w d3,d4
  42299. bge.w return_1FFB6
  42300. move.b subtype(a0),d0
  42301. bpl.s +
  42302. btst #1,status(a1)
  42303. bne.w return_1FFB6
  42304. +
  42305. btst #0,render_flags(a0)
  42306. bne.s +
  42307. move.b #$C,top_solid_bit(a1)
  42308. move.b #$D,lrb_solid_bit(a1)
  42309. btst #3,d0
  42310. beq.s +
  42311. move.b #$E,top_solid_bit(a1)
  42312. move.b #$F,lrb_solid_bit(a1)
  42313. +
  42314. andi.w #drawing_mask,art_tile(a1)
  42315. btst #5,d0
  42316. beq.s return_1FFB6
  42317. ori.w #high_priority,art_tile(a1)
  42318. bra.s return_1FFB6
  42319. ; ===========================================================================
  42320. ; loc_1FF42:
  42321. Obj03_MainY_Alt:
  42322. cmp.w y_pos(a1),d1
  42323. bls.w return_1FFB6
  42324. move.b #0,-1(a2)
  42325. move.w x_pos(a0),d2
  42326. move.w d2,d3
  42327. move.w objoff_32(a0),d4
  42328. sub.w d4,d2
  42329. add.w d4,d3
  42330. move.w x_pos(a1),d4
  42331. cmp.w d2,d4
  42332. blt.w return_1FFB6
  42333. cmp.w d3,d4
  42334. bge.w return_1FFB6
  42335. move.b subtype(a0),d0
  42336. bpl.s +
  42337. btst #1,status(a1)
  42338. bne.w return_1FFB6
  42339. +
  42340. btst #0,render_flags(a0)
  42341. bne.s +
  42342. move.b #$C,top_solid_bit(a1)
  42343. move.b #$D,lrb_solid_bit(a1)
  42344. btst #4,d0
  42345. beq.s +
  42346. move.b #$E,top_solid_bit(a1)
  42347. move.b #$F,lrb_solid_bit(a1)
  42348. +
  42349. andi.w #drawing_mask,art_tile(a1)
  42350. btst #6,d0
  42351. beq.s return_1FFB6
  42352. ori.w #high_priority,art_tile(a1)
  42353.  
  42354. return_1FFB6:
  42355. rts
  42356. ; ===========================================================================
  42357. ; -------------------------------------------------------------------------------
  42358. ; sprite mappings
  42359. ; -------------------------------------------------------------------------------
  42360. Obj03_MapUnc_1FFB8: BINCLUDE "mappings/sprite/obj03.bin"
  42361. ; ===========================================================================
  42362.  
  42363. if ~~removeJmpTos
  42364. JmpTo7_Adjust2PArtPointer
  42365. jmp (Adjust2PArtPointer).l
  42366.  
  42367. align 4
  42368. endif
  42369.  
  42370.  
  42371.  
  42372.  
  42373. ; ===========================================================================
  42374. ; ----------------------------------------------------------------------------
  42375. ; Object 0B - Section of pipe that tips you off from CPZ
  42376. ; ----------------------------------------------------------------------------
  42377. ; Sprite_2009C:
  42378. Obj0B:
  42379. moveq #0,d0
  42380. move.b routine(a0),d0
  42381. move.w Obj0B_Index(pc,d0.w),d1
  42382. jmp Obj0B_Index(pc,d1.w)
  42383. ; ===========================================================================
  42384. ; off_200AA:
  42385. Obj0B_Index: offsetTable
  42386. offsetTableEntry.w Obj0B_Init ; 0
  42387. offsetTableEntry.w loc_20104 ; 2
  42388. offsetTableEntry.w loc_20112 ; 4
  42389. ; ===========================================================================
  42390.  
  42391. obj0B_duration_current = objoff_30
  42392. obj0B_duration_initial = objoff_32
  42393. obj0B_delay = objoff_36
  42394.  
  42395. ; loc_200B0:
  42396. Obj0B_Init:
  42397. addq.b #2,routine(a0)
  42398. move.l #Obj0B_MapUnc_201A0,mappings(a0)
  42399. move.w #make_art_tile(ArtTile_ArtNem_CPZAnimatedBits,3,1),art_tile(a0)
  42400. jsrto (Adjust2PArtPointer).l, JmpTo8_Adjust2PArtPointer
  42401. ori.b #4,render_flags(a0)
  42402. move.b #$10,width_pixels(a0)
  42403. move.b #4,priority(a0)
  42404. moveq #0,d0
  42405. move.b subtype(a0),d0
  42406. andi.w #$F0,d0
  42407. addi.w #$10,d0
  42408. move.w d0,d1
  42409. subq.w #1,d0
  42410. move.w d0,obj0B_duration_current(a0)
  42411. move.w d0,obj0B_duration_initial(a0)
  42412. moveq #0,d0
  42413. move.b subtype(a0),d0
  42414. andi.w #$F,d0
  42415. addq.w #1,d0
  42416. lsl.w #4,d0
  42417. move.b d0,obj0B_delay(a0)
  42418.  
  42419. loc_20104:
  42420. move.b (Vint_runcount+3).w,d0
  42421. add.b obj0B_delay(a0),d0
  42422. bne.s loc_2013C
  42423. addq.b #2,routine(a0)
  42424.  
  42425. loc_20112:
  42426. subq.w #1,obj0B_duration_current(a0)
  42427. bpl.s loc_20130
  42428. move.w #$7F,obj0B_duration_current(a0)
  42429. tst.b anim(a0)
  42430. beq.s +
  42431. move.w obj0B_duration_initial(a0),obj0B_duration_current(a0)
  42432. +
  42433. bchg #0,anim(a0)
  42434.  
  42435. loc_20130:
  42436. lea (Ani_obj0B).l,a1
  42437. jsr (AnimateSprite).l
  42438.  
  42439. loc_2013C:
  42440. tst.b mapping_frame(a0)
  42441. bne.s +
  42442. moveq #0,d1
  42443. move.b width_pixels(a0),d1
  42444. moveq #$11,d3
  42445. move.w x_pos(a0),d4
  42446. bsr.w PlatformObject
  42447. jmpto (MarkObjGone).l, JmpTo3_MarkObjGone
  42448. ; ---------------------------------------------------------------------------
  42449. +
  42450. move.b status(a0),d0
  42451. andi.b #standing_mask,d0
  42452. beq.s BranchTo_JmpTo3_MarkObjGone
  42453. bclr #p1_standing_bit,status(a0)
  42454. beq.s +
  42455. bclr #3,(MainCharacter+status).w
  42456. bset #1,(MainCharacter+status).w
  42457. +
  42458. bclr #p2_standing_bit,status(a0)
  42459. beq.s BranchTo_JmpTo3_MarkObjGone
  42460. bclr #3,(Sidekick+status).w
  42461. bset #1,(Sidekick+status).w
  42462.  
  42463. BranchTo_JmpTo3_MarkObjGone
  42464. jmpto (MarkObjGone).l, JmpTo3_MarkObjGone
  42465. ; ===========================================================================
  42466. ; animation script
  42467. ; off_2018C:
  42468. Ani_obj0B: offsetTable
  42469. offsetTableEntry.w byte_20190 ; 0
  42470. offsetTableEntry.w byte_20198 ; 1
  42471. byte_20190:
  42472. dc.b 7, 0, 1, 2, 3, 4,$FE, 1
  42473. byte_20198:
  42474. dc.b 7, 4, 3, 2, 1, 0,$FE, 1
  42475. even
  42476. ; -------------------------------------------------------------------------------
  42477. ; sprite mappings
  42478. ; -------------------------------------------------------------------------------
  42479. Obj0B_MapUnc_201A0: BINCLUDE "mappings/sprite/obj0B.bin"
  42480. ; ===========================================================================
  42481.  
  42482. if ~~removeJmpTos
  42483. JmpTo3_MarkObjGone
  42484. jmp (MarkObjGone).l
  42485. JmpTo8_Adjust2PArtPointer
  42486. jmp (Adjust2PArtPointer).l
  42487.  
  42488. align 4
  42489. endif
  42490.  
  42491.  
  42492.  
  42493.  
  42494. ; ===========================================================================
  42495. ; ----------------------------------------------------------------------------
  42496. ; Object 0C - Small floating platform (unused)
  42497. ; (used in CPZ in the Nick Arcade prototype)
  42498. ; ----------------------------------------------------------------------------
  42499. ; Sprite_20210:
  42500. Obj0C:
  42501. moveq #0,d0
  42502. move.b routine(a0),d0
  42503. move.w Obj0C_Index(pc,d0.w),d1
  42504. jmp Obj0C_Index(pc,d1.w)
  42505. ; ===========================================================================
  42506. ; off_2021E
  42507. Obj0C_Index: offsetTable
  42508. offsetTableEntry.w Obj0C_Init ; 0
  42509. offsetTableEntry.w Obj0C_Main ; 2
  42510. ; ===========================================================================
  42511. ; loc_20222:
  42512. Obj0C_Init:
  42513. addq.b #2,routine(a0)
  42514. move.l #Obj0C_MapUnc_202FA,mappings(a0)
  42515. move.w #make_art_tile(ArtTile_ArtNem_FloatPlatform,3,1),art_tile(a0)
  42516. jsrto (Adjust2PArtPointer).l, JmpTo9_Adjust2PArtPointer
  42517. ori.b #4,render_flags(a0)
  42518. move.b #$10,width_pixels(a0)
  42519. move.b #4,priority(a0)
  42520. move.w y_pos(a0),d0
  42521. subi.w #$10,d0
  42522. move.w d0,objoff_3A(a0)
  42523. moveq #0,d0
  42524. move.b subtype(a0),d0
  42525. andi.w #$F0,d0
  42526. addi.w #$10,d0
  42527. move.w d0,d1
  42528. subq.w #1,d0
  42529. move.w d0,objoff_30(a0)
  42530. move.w d0,objoff_32(a0)
  42531. moveq #0,d0
  42532. move.b subtype(a0),d0
  42533. andi.w #$F,d0
  42534. move.b d0,objoff_3E(a0)
  42535. move.b d0,objoff_3F(a0)
  42536. ; loc_20282:
  42537. Obj0C_Main:
  42538. move.b objoff_3C(a0),d0
  42539. beq.s loc_202C0
  42540. cmpi.b #$80,d0
  42541. bne.s loc_202D0
  42542. move.b objoff_3D(a0),d1
  42543. bne.s loc_202A2
  42544. subq.b #1,objoff_3E(a0)
  42545. bpl.s loc_202A2
  42546. move.b objoff_3F(a0),objoff_3E(a0)
  42547. bra.s loc_202D0
  42548. ; ===========================================================================
  42549.  
  42550. loc_202A2:
  42551. addq.b #1,objoff_3D(a0)
  42552. move.b d1,d0
  42553. jsrto (CalcSine).l, JmpTo5_CalcSine
  42554. addi_.w #8,d0
  42555. asr.w #6,d0
  42556. subi.w #$10,d0
  42557. add.w objoff_3A(a0),d0
  42558. move.w d0,y_pos(a0)
  42559. bra.s loc_202E6
  42560. ; ===========================================================================
  42561.  
  42562. loc_202C0:
  42563. move.w (Vint_runcount+2).w,d1
  42564. andi.w #$3FF,d1
  42565. bne.s loc_202D4
  42566. move.b #1,objoff_3D(a0)
  42567.  
  42568. loc_202D0:
  42569. addq.b #1,objoff_3C(a0)
  42570.  
  42571. loc_202D4:
  42572. jsrto (CalcSine).l, JmpTo5_CalcSine
  42573. addi_.w #8,d1
  42574. asr.w #4,d1
  42575. add.w objoff_3A(a0),d1
  42576. move.w d1,y_pos(a0)
  42577.  
  42578. loc_202E6:
  42579. moveq #0,d1
  42580. move.b width_pixels(a0),d1
  42581. moveq #9,d3
  42582. move.w x_pos(a0),d4
  42583. bsr.w PlatformObject
  42584. jmpto (MarkObjGone).l, JmpTo4_MarkObjGone
  42585. ; ===========================================================================
  42586. ; ----------------------------------------------------------------------------
  42587. ; Unused sprite mappings
  42588. ; ----------------------------------------------------------------------------
  42589. Obj0C_MapUnc_202FA: BINCLUDE "mappings/sprite/obj0C.bin"
  42590. ; ===========================================================================
  42591.  
  42592. if gameRevision<2
  42593. nop
  42594. endif
  42595.  
  42596. if ~~removeJmpTos
  42597. JmpTo4_MarkObjGone
  42598. jmp (MarkObjGone).l
  42599. JmpTo9_Adjust2PArtPointer
  42600. jmp (Adjust2PArtPointer).l
  42601. JmpTo5_CalcSine
  42602. jmp (CalcSine).l
  42603.  
  42604. align 4
  42605. endif
  42606.  
  42607.  
  42608.  
  42609.  
  42610. ; ===========================================================================
  42611. ; ----------------------------------------------------------------------------
  42612. ; Object 12 - Emerald from Hidden Palace Zone (unused)
  42613. ; ----------------------------------------------------------------------------
  42614. ; Sprite_2031C:
  42615. Obj12:
  42616. moveq #0,d0
  42617. move.b routine(a0),d0
  42618. move.w Obj12_Index(pc,d0.w),d1
  42619. jmp Obj12_Index(pc,d1.w)
  42620. ; ===========================================================================
  42621. ; off_2032A
  42622. Obj12_Index: offsetTable
  42623. offsetTableEntry.w Obj12_Init ; 0
  42624. offsetTableEntry.w Obj12_Main ; 2
  42625. ; ===========================================================================
  42626. ; loc_2032E:
  42627. Obj12_Init:
  42628. addq.b #2,routine(a0)
  42629. move.l #Obj12_MapUnc_20382,mappings(a0)
  42630. move.w #make_art_tile(ArtTile_ArtNem_HPZ_Emerald,3,0),art_tile(a0)
  42631. jsrto (Adjust2PArtPointer).l, JmpTo10_Adjust2PArtPointer
  42632. move.b #4,render_flags(a0)
  42633. move.b #$20,width_pixels(a0)
  42634. move.b #4,priority(a0)
  42635. ; loc_20356:
  42636. Obj12_Main:
  42637. move.w #$20,d1
  42638. move.w #$10,d2
  42639. move.w #$10,d3
  42640. move.w x_pos(a0),d4
  42641. bsr.w SolidObject
  42642. move.w x_pos(a0),d0
  42643. andi.w #$FF80,d0
  42644. sub.w (Camera_X_pos_coarse).w,d0
  42645. cmpi.w #$280,d0
  42646. bhi.w JmpTo16_DeleteObject
  42647. jmpto (DisplaySprite).l, JmpTo8_DisplaySprite
  42648. ; ===========================================================================
  42649. ; -------------------------------------------------------------------------------
  42650. ; sprite mappings (unused)
  42651. ; -------------------------------------------------------------------------------
  42652. Obj12_MapUnc_20382: BINCLUDE "mappings/sprite/obj12.bin"
  42653. ; ===========================================================================
  42654.  
  42655. if gameRevision<2
  42656. nop
  42657. endif
  42658.  
  42659. if ~~removeJmpTos
  42660. JmpTo8_DisplaySprite
  42661. jmp (DisplaySprite).l
  42662. JmpTo16_DeleteObject
  42663. jmp (DeleteObject).l
  42664. JmpTo10_Adjust2PArtPointer
  42665. jmp (Adjust2PArtPointer).l
  42666.  
  42667. align 4
  42668. else
  42669. JmpTo16_DeleteObject
  42670. jmp (DeleteObject).l
  42671. endif
  42672.  
  42673.  
  42674.  
  42675.  
  42676. ; ===========================================================================
  42677. ; ----------------------------------------------------------------------------
  42678. ; Object 13 - Waterfall in Hidden Palace Zone (unused)
  42679. ; ----------------------------------------------------------------------------
  42680. ; Sprite_203AC:
  42681. Obj13:
  42682. moveq #0,d0
  42683. move.b routine(a0),d0
  42684. move.w Obj13_Index(pc,d0.w),d1
  42685. jmp Obj13_Index(pc,d1.w)
  42686. ; ===========================================================================
  42687. ; off_203BA
  42688. Obj13_Index: offsetTable
  42689. offsetTableEntry.w Obj13_Init ; 0
  42690. offsetTableEntry.w Obj13_Main ; 2
  42691. offsetTableEntry.w Obj13_ChkDel ; 4
  42692. ; ===========================================================================
  42693. ; loc_203C0:
  42694. Obj13_Init:
  42695. addq.b #2,routine(a0)
  42696. move.l #Obj13_MapUnc_20528,mappings(a0)
  42697. move.w #make_art_tile(ArtTile_ArtNem_HPZ_Waterfall,3,1),art_tile(a0)
  42698. jsrto (Adjust2PArtPointer).l, JmpTo11_Adjust2PArtPointer
  42699. move.b #4,render_flags(a0)
  42700. move.b #$10,width_pixels(a0)
  42701. move.b #1,priority(a0)
  42702. move.b #$12,mapping_frame(a0)
  42703. bsr.s Obj13_LoadSubObject
  42704. move.b #$A0,y_radius(a1)
  42705. bset #4,render_flags(a1)
  42706. move.l a1,objoff_38(a0)
  42707. move.w y_pos(a0),objoff_34(a0)
  42708. move.w y_pos(a0),objoff_36(a0)
  42709. cmpi.b #$10,subtype(a0)
  42710. blo.s loc_2046C
  42711. bsr.s Obj13_LoadSubObject
  42712. move.l a1,objoff_3C(a0)
  42713. move.w y_pos(a0),y_pos(a1)
  42714. addi.w #$98,y_pos(a1)
  42715. bra.s loc_2046C
  42716. ; ===========================================================================
  42717. ; loc_20428:
  42718. Obj13_LoadSubObject:
  42719. jsr (SingleObjLoad2).l
  42720. bne.s + ; rts
  42721. _move.b #ObjID_HPZWaterfall,id(a1) ; load obj13
  42722. addq.b #4,routine(a1)
  42723. move.w x_pos(a0),x_pos(a1)
  42724. move.w y_pos(a0),y_pos(a1)
  42725. move.l #Obj13_MapUnc_20528,mappings(a1)
  42726. move.w #make_art_tile(ArtTile_ArtNem_HPZ_Waterfall,3,1),art_tile(a1)
  42727. jsrto (Adjust2PArtPointer2).l, JmpTo2_Adjust2PArtPointer2
  42728. move.b #4,render_flags(a1)
  42729. move.b #$10,width_pixels(a1)
  42730. move.b #1,priority(a1)
  42731. + rts
  42732. ; ===========================================================================
  42733.  
  42734. loc_2046C:
  42735. moveq #0,d1
  42736. move.b subtype(a0),d1
  42737. move.w objoff_34(a0),d0
  42738. subi.w #$78,d0
  42739. lsl.w #4,d1
  42740. add.w d1,d0
  42741. move.w d0,y_pos(a0)
  42742. move.w d0,objoff_34(a0)
  42743. ; loc_20486:
  42744. Obj13_Main:
  42745. movea.l objoff_38(a0),a1 ; a1=object
  42746. move.b #$12,mapping_frame(a0)
  42747. move.w objoff_34(a0),d0
  42748. move.w (Water_Level_1).w,d1
  42749. cmp.w d0,d1
  42750. bhs.s +
  42751. move.w d1,d0
  42752. +
  42753. move.w d0,y_pos(a0)
  42754. sub.w objoff_36(a0),d0
  42755. addi.w #$80,d0
  42756. bmi.s loc_204F0
  42757. lsr.w #4,d0
  42758. move.w d0,d1
  42759. cmpi.w #$F,d0
  42760. blo.s +
  42761. moveq #$F,d0
  42762. +
  42763. move.b d0,mapping_frame(a1)
  42764. cmpi.b #$10,subtype(a0)
  42765. blo.s loc_204D8
  42766. movea.l objoff_3C(a0),a1 ; a1=object
  42767. subi.w #$F,d1
  42768. bcc.s +
  42769. moveq #0,d1
  42770. +
  42771. addi.w #$13,d1
  42772. move.b d1,mapping_frame(a1)
  42773.  
  42774. loc_204D8:
  42775. move.w x_pos(a0),d0
  42776. andi.w #$FF80,d0
  42777. sub.w (Camera_X_pos_coarse).w,d0
  42778. cmpi.w #$280,d0
  42779. bhi.w JmpTo17_DeleteObject
  42780. jmpto (DisplaySprite).l, JmpTo9_DisplaySprite
  42781. ; ===========================================================================
  42782.  
  42783. loc_204F0:
  42784. moveq #$13,d0
  42785. move.b d0,mapping_frame(a0)
  42786. move.b d0,mapping_frame(a1)
  42787. move.w x_pos(a0),d0
  42788. andi.w #$FF80,d0
  42789. sub.w (Camera_X_pos_coarse).w,d0
  42790. cmpi.w #$280,d0
  42791. bhi.w JmpTo17_DeleteObject
  42792. rts
  42793. ; ===========================================================================
  42794. ; loc_20510:
  42795. Obj13_ChkDel:
  42796. move.w x_pos(a0),d0
  42797. andi.w #$FF80,d0
  42798. sub.w (Camera_X_pos_coarse).w,d0
  42799. cmpi.w #$280,d0
  42800. bhi.w JmpTo17_DeleteObject
  42801. jmpto (DisplaySprite).l, JmpTo9_DisplaySprite
  42802. ; ===========================================================================
  42803. ; -------------------------------------------------------------------------------
  42804. ; sprite mappings (unused)
  42805. ; -------------------------------------------------------------------------------
  42806. Obj13_MapUnc_20528: BINCLUDE "mappings/sprite/obj13.bin"
  42807. ; ===========================================================================
  42808.  
  42809. if ~~removeJmpTos
  42810. JmpTo9_DisplaySprite
  42811. jmp (DisplaySprite).l
  42812. JmpTo17_DeleteObject
  42813. jmp (DeleteObject).l
  42814. JmpTo2_Adjust2PArtPointer2
  42815. jmp (Adjust2PArtPointer2).l
  42816. JmpTo11_Adjust2PArtPointer
  42817. jmp (Adjust2PArtPointer).l
  42818.  
  42819. align 4
  42820. else
  42821. JmpTo17_DeleteObject
  42822. jmp (DeleteObject).l
  42823. endif
  42824.  
  42825.  
  42826.  
  42827.  
  42828. ; ===========================================================================
  42829. ; ----------------------------------------------------------------------------
  42830. ; Object 04 - Surface of the water - water surface
  42831. ; ----------------------------------------------------------------------------
  42832.  
  42833. Obj04:
  42834. moveq #0,d0
  42835. move.b routine(a0),d0
  42836. move.w Obj04_Index(pc,d0.w),d1
  42837. jmp Obj04_Index(pc,d1.w)
  42838. ; ===========================================================================
  42839. ; off_208EA:
  42840. Obj04_Index: offsetTable
  42841. offsetTableEntry.w Obj04_Init ; 0
  42842. offsetTableEntry.w Obj04_Action ; 2
  42843. offsetTableEntry.w Obj04_Action2 ; 4
  42844. ; ===========================================================================
  42845. ; loc_208F0: Obj04_Main:
  42846. Obj04_Init:
  42847. addq.b #2,routine(a0) ; => Obj04_Action
  42848. move.l #Obj04_MapUnc_20A0E,mappings(a0)
  42849. move.w #make_art_tile(ArtTile_ArtNem_WaterSurface,0,1),art_tile(a0)
  42850. jsrto (Adjust2PArtPointer).l, JmpTo12_Adjust2PArtPointer
  42851. move.b #4,render_flags(a0)
  42852. move.b #$80,width_pixels(a0)
  42853. move.w x_pos(a0),objoff_30(a0)
  42854. cmpi.b #aquatic_ruin_zone,(Current_Zone).w
  42855. bne.s Obj04_Action
  42856. addq.b #2,routine(a0) ; Obj04_Action2
  42857. move.l #Obj04_MapUnc_20AFE,mappings(a0)
  42858. bra.w Obj04_Action2
  42859. ; ===========================================================================
  42860. ; loc_20930:
  42861. Obj04_Action:
  42862. move.w (Water_Level_1).w,d1
  42863. move.w d1,y_pos(a0)
  42864. tst.b objoff_32(a0)
  42865. bne.s Obj04_Animate
  42866. btst #button_start,(Ctrl_1_Press).w ; is Start button pressed?
  42867. beq.s loc_20962 ; if not, branch
  42868. addq.b #3,mapping_frame(a0) ; use different frames
  42869. move.b #1,objoff_32(a0) ; stop animation
  42870. bra.s loc_20962
  42871. ; ===========================================================================
  42872. ; loc_20952:
  42873. Obj04_Animate:
  42874. tst.w (Game_paused).w ; is the game paused?
  42875. bne.s loc_20962 ; if yes, branch
  42876. move.b #0,objoff_32(a0) ; resume animation
  42877. subq.b #3,mapping_frame(a0) ; use normal frames
  42878.  
  42879. loc_20962:
  42880. lea (Anim_obj04).l,a1
  42881. moveq #0,d1
  42882. move.b anim_frame(a0),d1
  42883. move.b (a1,d1.w),mapping_frame(a0)
  42884. addq.b #1,anim_frame(a0)
  42885. andi.b #$3F,anim_frame(a0)
  42886. jmpto (DisplaySprite).l, JmpTo10_DisplaySprite
  42887. ; ===========================================================================
  42888. ; water sprite animation 'script' (custom format for this object)
  42889. ; byte_20982:
  42890. Anim_obj04:
  42891. dc.b 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1
  42892. dc.b 1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2
  42893. dc.b 2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1
  42894. dc.b 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
  42895. ; ===========================================================================
  42896. ; loc_209C2:
  42897. Obj04_Action2:
  42898. move.w (Water_Level_1).w,d1
  42899. move.w d1,y_pos(a0)
  42900. tst.b objoff_32(a0)
  42901. bne.s Obj04_Animate2
  42902. btst #button_start,(Ctrl_1_Press).w ; is Start button pressed?
  42903. beq.s loc_209F4 ; if not, branch
  42904. addq.b #2,mapping_frame(a0) ; use different frames
  42905. move.b #1,objoff_32(a0) ; stop animation
  42906. bra.s BranchTo_JmpTo10_DisplaySprite
  42907. ; ===========================================================================
  42908. ; loc_209E4:
  42909. Obj04_Animate2:
  42910. tst.w (Game_paused).w ; is the game paused?
  42911. bne.s BranchTo_JmpTo10_DisplaySprite ; if yes, branch
  42912. move.b #0,objoff_32(a0) ; resume animation
  42913. subq.b #2,mapping_frame(a0) ; use normal frames
  42914.  
  42915. loc_209F4:
  42916. subq.b #1,anim_frame_duration(a0)
  42917. bpl.s BranchTo_JmpTo10_DisplaySprite
  42918. move.b #5,anim_frame_duration(a0)
  42919. addq.b #1,mapping_frame(a0)
  42920. andi.b #1,mapping_frame(a0)
  42921.  
  42922. BranchTo_JmpTo10_DisplaySprite
  42923. jmpto (DisplaySprite).l, JmpTo10_DisplaySprite
  42924. ; ===========================================================================
  42925. ; -------------------------------------------------------------------------------
  42926. ; sprite mappings
  42927. ; -------------------------------------------------------------------------------
  42928. Obj04_MapUnc_20A0E: BINCLUDE "mappings/sprite/obj04_a.bin"
  42929. ; -------------------------------------------------------------------------------
  42930. ; sprite mappings
  42931. ; -------------------------------------------------------------------------------
  42932. Obj04_MapUnc_20AFE: BINCLUDE "mappings/sprite/obj04_b.bin"
  42933. ; ===========================================================================
  42934. ; ----------------------------------------------------------------------------
  42935. ; Object 49 - Waterfall from EHZ
  42936. ; ----------------------------------------------------------------------------
  42937. ; Sprite_20B9E:
  42938. Obj49:
  42939. moveq #0,d0
  42940. move.b routine(a0),d0
  42941. move.w Obj49_Index(pc,d0.w),d1
  42942. jmp Obj49_Index(pc,d1.w)
  42943. ; ===========================================================================
  42944. ; off_20BAC:
  42945. Obj49_Index: offsetTable
  42946. offsetTableEntry.w Obj49_Init ; 0
  42947. offsetTableEntry.w Obj49_ChkDel ; 2
  42948. ; ===========================================================================
  42949. ; loc_20BB0: Obj49_Main:
  42950. Obj49_Init:
  42951. addq.b #2,routine(a0)
  42952. move.l #Obj49_MapUnc_20C50,mappings(a0)
  42953. move.w #make_art_tile(ArtTile_ArtNem_Waterfall,1,0),art_tile(a0)
  42954. jsrto (Adjust2PArtPointer).l, JmpTo12_Adjust2PArtPointer
  42955. move.b #4,render_flags(a0)
  42956. move.b #$20,width_pixels(a0)
  42957. move.w x_pos(a0),objoff_30(a0)
  42958. move.b #0,priority(a0)
  42959. move.b #$80,y_radius(a0)
  42960. bset #4,render_flags(a0)
  42961. ; loc_20BEA:
  42962. Obj49_ChkDel:
  42963. tst.w (Two_player_mode).w
  42964. bne.s +
  42965. move.w x_pos(a0),d0
  42966. andi.w #$FF80,d0
  42967. sub.w (Camera_X_pos_coarse).w,d0
  42968. cmpi.w #$280,d0
  42969. bhi.w JmpTo18_DeleteObject
  42970. +
  42971. move.w x_pos(a0),d1
  42972. move.w d1,d2
  42973. subi.w #$40,d1
  42974. addi.w #$40,d2
  42975. move.b subtype(a0),d3
  42976. move.b #0,mapping_frame(a0)
  42977. move.w (MainCharacter+x_pos).w,d0
  42978. cmp.w d1,d0
  42979. blo.s loc_20C36
  42980. cmp.w d2,d0
  42981. bhs.s loc_20C36
  42982. move.b #1,mapping_frame(a0)
  42983. add.b d3,mapping_frame(a0)
  42984. jmpto (DisplaySprite).l, JmpTo10_DisplaySprite
  42985. ; ===========================================================================
  42986.  
  42987. loc_20C36:
  42988. move.w (Sidekick+x_pos).w,d0
  42989. cmp.w d1,d0
  42990. blo.s Obj49_Display
  42991. cmp.w d2,d0
  42992. bhs.s Obj49_Display
  42993. move.b #1,mapping_frame(a0)
  42994. ; loc_20C48:
  42995. Obj49_Display:
  42996. add.b d3,mapping_frame(a0)
  42997. jmpto (DisplaySprite).l, JmpTo10_DisplaySprite
  42998. ; ===========================================================================
  42999. ; -------------------------------------------------------------------------------
  43000. ; sprite mappings
  43001. ; -------------------------------------------------------------------------------
  43002. Obj49_MapUnc_20C50: BINCLUDE "mappings/sprite/obj49.bin"
  43003.  
  43004.  
  43005.  
  43006.  
  43007. ; ===========================================================================
  43008. ; ----------------------------------------------------------------------------
  43009. ; Object 31 - Lava collision marker
  43010. ; ----------------------------------------------------------------------------
  43011. ; Sprite_20DEC:
  43012. Obj31:
  43013. moveq #0,d0
  43014. move.b routine(a0),d0
  43015. move.w Obj31_Index(pc,d0.w),d1
  43016. jmp Obj31_Index(pc,d1.w)
  43017. ; ===========================================================================
  43018. ; off_20DFA: Obj31_States:
  43019. Obj31_Index: offsetTable
  43020. offsetTableEntry.w Obj31_Init ; 0
  43021. offsetTableEntry.w Obj31_Main ; 2
  43022. ; ---------------------------------------------------------------------------
  43023. ; byte_20DFE:
  43024. Obj31_CollisionFlagsBySubtype:
  43025. dc.b $96 ; 0
  43026. dc.b $94 ; 1
  43027. dc.b $95 ; 2
  43028. dc.b 0 ; 3
  43029. ; ===========================================================================
  43030. ; loc_20E02:
  43031. Obj31_Init:
  43032. addq.b #2,routine(a0) ; => Obj31_Main
  43033. moveq #0,d0
  43034. move.b subtype(a0),d0
  43035. move.b Obj31_CollisionFlagsBySubtype(pc,d0.w),collision_flags(a0)
  43036. move.l #Obj31_MapUnc_20E6C,mappings(a0)
  43037. tst.w (Debug_placement_mode).w
  43038. beq.s +
  43039. move.l #Obj31_MapUnc_20E74,mappings(a0)
  43040. +
  43041. move.w #make_art_tile(ArtTile_ArtNem_Powerups,0,1),art_tile(a0)
  43042. move.b #$84,render_flags(a0)
  43043. move.b #$80,width_pixels(a0)
  43044. move.b #4,priority(a0)
  43045. move.b subtype(a0),mapping_frame(a0)
  43046.  
  43047. ; loc_20E46:
  43048. Obj31_Main:
  43049. tst.w (Two_player_mode).w
  43050. bne.s +
  43051. move.w x_pos(a0),d0
  43052. andi.w #$FF80,d0
  43053. sub.w (Camera_X_pos_coarse).w,d0
  43054. cmpi.w #$280,d0
  43055. bhi.w JmpTo18_DeleteObject
  43056. +
  43057. tst.w (Debug_placement_mode).w
  43058. beq.s + ; rts
  43059. jsrto (DisplaySprite).l, JmpTo10_DisplaySprite
  43060. +
  43061. rts
  43062. ; ===========================================================================
  43063. ; -------------------------------------------------------------------------------
  43064. ; sprite non-mappings
  43065. ; -------------------------------------------------------------------------------
  43066. Obj31_MapUnc_20E6C: BINCLUDE "mappings/sprite/obj31_a.bin"
  43067. ; -------------------------------------------------------------------------------
  43068. ; sprite mappings
  43069. ; -------------------------------------------------------------------------------
  43070. Obj31_MapUnc_20E74: BINCLUDE "mappings/sprite/obj31_b.bin"
  43071. ; ===========================================================================
  43072.  
  43073.  
  43074.  
  43075.  
  43076. ; ----------------------------------------------------------------------------
  43077. ; Object 74 - Invisible solid block
  43078. ; ----------------------------------------------------------------------------
  43079. ; Sprite_20EE0:
  43080. Obj74:
  43081. moveq #0,d0
  43082. move.b routine(a0),d0
  43083. move.w Obj74_Index(pc,d0.w),d1
  43084. jmp Obj74_Index(pc,d1.w)
  43085. ; ===========================================================================
  43086. ; off_20EEE: Obj74_States:
  43087. Obj74_Index: offsetTable
  43088. offsetTableEntry.w Obj74_Init ; 0
  43089. offsetTableEntry.w Obj74_Main ; 2
  43090. ; ===========================================================================
  43091. ; loc_20EF2:
  43092. Obj74_Init:
  43093. addq.b #2,routine(a0) ; => Obj74_Main
  43094. move.l #Obj74_MapUnc_20F66,mappings(a0)
  43095. move.w #make_art_tile(ArtTile_ArtNem_Powerups,0,1),art_tile(a0)
  43096. jsrto (Adjust2PArtPointer).l, JmpTo12_Adjust2PArtPointer
  43097. ori.b #4,render_flags(a0)
  43098. move.b subtype(a0),d0
  43099. move.b d0,d1
  43100. andi.w #$F0,d0
  43101. addi.w #$10,d0
  43102. lsr.w #1,d0
  43103. move.b d0,width_pixels(a0)
  43104. andi.w #$F,d1
  43105. addq.w #1,d1
  43106. lsl.w #3,d1
  43107. move.b d1,y_radius(a0)
  43108.  
  43109. ; loc_20F2E:
  43110. Obj74_Main:
  43111. moveq #0,d1
  43112. move.b width_pixels(a0),d1
  43113. addi.w #$B,d1
  43114. moveq #0,d2
  43115. move.b y_radius(a0),d2
  43116. move.w d2,d3
  43117. addq.w #1,d3
  43118. move.w x_pos(a0),d4
  43119. bsr.w SolidObject_Always
  43120. tst.w (Two_player_mode).w
  43121. bne.s +
  43122. move.w x_pos(a0),d0
  43123. andi.w #$FF80,d0
  43124. sub.w (Camera_X_pos_coarse).w,d0
  43125. cmpi.w #$280,d0
  43126. bhi.w JmpTo18_DeleteObject
  43127. if gameRevision=0
  43128. ; this object was visible with debug mode in REV00
  43129. +
  43130. tst.w (Debug_placement_mode).w
  43131. beq.s + ; rts
  43132. jmp (DisplaySprite).l
  43133. endif
  43134. +
  43135. rts
  43136. ; ===========================================================================
  43137. ; -------------------------------------------------------------------------------
  43138. ; sprite mappings
  43139. ; -------------------------------------------------------------------------------
  43140. Obj74_MapUnc_20F66: BINCLUDE "mappings/sprite/obj74.bin"
  43141.  
  43142.  
  43143.  
  43144.  
  43145. ; ===========================================================================
  43146. ; ----------------------------------------------------------------------------
  43147. ; Object 7C - Big pylon in foreground of CPZ
  43148. ; ----------------------------------------------------------------------------
  43149. ; Sprite_20FD2:
  43150. Obj7C:
  43151. moveq #0,d0
  43152. move.b routine(a0),d0
  43153. move.w Obj7C_Index(pc,d0.w),d1
  43154. jmp Obj7C_Index(pc,d1.w)
  43155. ; ===========================================================================
  43156. ; off_20FE0: Obj7C_States:
  43157. Obj7C_Index: offsetTable
  43158. offsetTableEntry.w Obj7C_Init ; 0
  43159. offsetTableEntry.w Obj7C_Main ; 2
  43160. ; ===========================================================================
  43161. ; loc_20FE4:
  43162. Obj7C_Init:
  43163. addq.b #2,routine(a0) ; => Obj7C_Main
  43164. move.l #Obj7C_MapUnc_2103C,mappings(a0)
  43165. move.w #make_art_tile(ArtTile_ArtNem_CPZMetalThings,2,1),art_tile(a0)
  43166. jsrto (Adjust2PArtPointer).l, JmpTo12_Adjust2PArtPointer
  43167. move.b #$10,width_pixels(a0)
  43168. move.b #7,priority(a0)
  43169.  
  43170. ; loc_21006:
  43171. Obj7C_Main:
  43172. move.w (Camera_X_pos).w,d1
  43173. andi.w #$3FF,d1
  43174. cmpi.w #$2E0,d1
  43175. bhs.s + ; rts
  43176. asr.w #1,d1
  43177. move.w d1,d0
  43178. asr.w #1,d1
  43179. add.w d1,d0
  43180. neg.w d0
  43181. move.w d0,x_pixel(a0)
  43182. move.w (Camera_Y_pos).w,d1
  43183. asr.w #1,d1
  43184. andi.w #$3F,d1
  43185. neg.w d1
  43186. addi.w #$100,d1
  43187. move.w d1,y_pixel(a0)
  43188. jmpto (DisplaySprite).l, JmpTo10_DisplaySprite
  43189. ; ---------------------------------------------------------------------------
  43190. + rts
  43191. ; ===========================================================================
  43192. ; -------------------------------------------------------------------------------
  43193. ; sprite mappings
  43194. ; -------------------------------------------------------------------------------
  43195. Obj7C_MapUnc_2103C: BINCLUDE "mappings/sprite/obj7C.bin"
  43196.  
  43197.  
  43198.  
  43199.  
  43200. ; ===========================================================================
  43201. ; ----------------------------------------------------------------------------
  43202. ; Object 27 - An explosion, giving off an animal and 100 points
  43203. ; ----------------------------------------------------------------------------
  43204. ; Sprite_21088:
  43205. Obj27:
  43206. moveq #0,d0
  43207. move.b routine(a0),d0
  43208. move.w Obj27_Index(pc,d0.w),d1
  43209. jmp Obj27_Index(pc,d1.w)
  43210. ; ===========================================================================
  43211. ; off_21096: Obj27_States:
  43212. Obj27_Index: offsetTable
  43213. offsetTableEntry.w Obj27_InitWithAnimal ; 0
  43214. offsetTableEntry.w Obj27_Init ; 2
  43215. offsetTableEntry.w Obj27_Main ; 4
  43216. ; ===========================================================================
  43217. ; loc_2109C: Obj27_Init:
  43218. Obj27_InitWithAnimal:
  43219. addq.b #2,routine(a0) ; => Obj27_Init
  43220. jsrto (SingleObjLoad).l, JmpTo2_SingleObjLoad
  43221. bne.s Obj27_Init
  43222. _move.b #ObjID_Animal,id(a1) ; load obj28 (Animal and 100 points)
  43223. move.w x_pos(a0),x_pos(a1)
  43224. move.w y_pos(a0),y_pos(a1)
  43225. move.w parent(a0),parent(a1)
  43226.  
  43227. ; loc_210BE: Obj27_Init2:
  43228. Obj27_Init:
  43229. addq.b #2,routine(a0) ; => Obj27_Main
  43230. move.l #Obj27_MapUnc_21120,mappings(a0)
  43231. move.w #make_art_tile(ArtTile_ArtNem_Explosion,0,0),art_tile(a0)
  43232. jsrto (Adjust2PArtPointer).l, JmpTo12_Adjust2PArtPointer
  43233. move.b #4,render_flags(a0)
  43234. move.b #1,priority(a0)
  43235. move.b #0,collision_flags(a0)
  43236. move.b #$C,width_pixels(a0)
  43237. move.b #3,anim_frame_duration(a0)
  43238. move.b #0,mapping_frame(a0)
  43239. move.w #SndID_Explosion,d0
  43240. jsr (PlaySound).l
  43241.  
  43242. ; loc_21102:
  43243. Obj27_Main:
  43244. subq.b #1,anim_frame_duration(a0)
  43245. bpl.s +
  43246. move.b #7,anim_frame_duration(a0)
  43247. addq.b #1,mapping_frame(a0)
  43248. cmpi.b #5,mapping_frame(a0)
  43249. beq.w JmpTo18_DeleteObject
  43250. +
  43251. jmpto (DisplaySprite).l, JmpTo10_DisplaySprite
  43252. ; ===========================================================================
  43253. ; -------------------------------------------------------------------------------
  43254. ; sprite mappings
  43255. ; -------------------------------------------------------------------------------
  43256. Obj27_MapUnc_21120: BINCLUDE "mappings/sprite/obj27.bin"
  43257.  
  43258.  
  43259.  
  43260.  
  43261. ; ===========================================================================
  43262. ; ----------------------------------------------------------------------------
  43263. ; Object 84 - Pinball mode enable/disable
  43264. ; (used in Casino Night Zone to determine when Sonic should stay in a ball)
  43265. ; ----------------------------------------------------------------------------
  43266. ; Sprite_2115C:
  43267. Obj84:
  43268. moveq #0,d0
  43269. move.b routine(a0),d0
  43270. move.w Obj84_Index(pc,d0.w),d1
  43271. jsr Obj84_Index(pc,d1.w)
  43272. jmp (MarkObjGone3).l
  43273. ; ===========================================================================
  43274. ; off_21170: Obj84_States:
  43275. Obj84_Index: offsetTable
  43276. offsetTableEntry.w Obj84_Init ; 0
  43277. offsetTableEntry.w Obj84_MainX ; 2
  43278. offsetTableEntry.w Obj84_MainY ; 4
  43279. ; ===========================================================================
  43280. ; loc_21176:
  43281. Obj84_Init:
  43282. addq.b #2,routine(a0) ; => Obj84_MainX
  43283. move.l #Obj03_MapUnc_1FFB8,mappings(a0)
  43284. move.w #make_art_tile(ArtTile_ArtNem_Ring,0,0),art_tile(a0)
  43285. jsrto (Adjust2PArtPointer).l, JmpTo12_Adjust2PArtPointer
  43286. ori.b #4,render_flags(a0)
  43287. move.b #$10,width_pixels(a0)
  43288. move.b #5,priority(a0)
  43289. move.b subtype(a0),d0
  43290. btst #2,d0
  43291. beq.s Obj84_Init_CheckX
  43292. addq.b #2,routine(a0) ; => Obj84_MainY
  43293. andi.w #7,d0
  43294. move.b d0,mapping_frame(a0)
  43295. andi.w #3,d0
  43296. add.w d0,d0
  43297. move.w word_211E8(pc,d0.w),objoff_32(a0)
  43298. move.w y_pos(a0),d1
  43299. lea (MainCharacter).w,a1 ; a1=character
  43300. cmp.w y_pos(a1),d1
  43301. bhs.s +
  43302. move.b #1,objoff_34(a0)
  43303. +
  43304. lea (Sidekick).w,a1 ; a1=character
  43305. cmp.w y_pos(a1),d1
  43306. bhs.s +
  43307. move.b #1,objoff_35(a0)
  43308. +
  43309. bra.w Obj84_MainY
  43310. ; ===========================================================================
  43311. word_211E8:
  43312. dc.w $20
  43313. dc.w $40 ; 1
  43314. dc.w $80 ; 2
  43315. dc.w $100 ; 3
  43316. ; ===========================================================================
  43317. ; loc_211F0:
  43318. Obj84_Init_CheckX:
  43319. andi.w #3,d0
  43320. move.b d0,mapping_frame(a0)
  43321. add.w d0,d0
  43322. move.w word_211E8(pc,d0.w),objoff_32(a0)
  43323. move.w x_pos(a0),d1
  43324. lea (MainCharacter).w,a1 ; a1=character
  43325. cmp.w x_pos(a1),d1
  43326. bhs.s +
  43327. move.b #1,objoff_34(a0)
  43328. +
  43329. lea (Sidekick).w,a1 ; a1=character
  43330. cmp.w x_pos(a1),d1
  43331. bhs.s Obj84_MainX
  43332. move.b #1,objoff_35(a0)
  43333.  
  43334. ; loc_21224:
  43335. Obj84_MainX:
  43336.  
  43337. tst.w (Debug_placement_mode).w
  43338. bne.s return_21284
  43339. move.w x_pos(a0),d1
  43340. lea objoff_34(a0),a2 ; a2=object
  43341. lea (MainCharacter).w,a1 ; a1=character
  43342. bsr.s +
  43343. lea (Sidekick).w,a1 ; a1=character
  43344. cmpi.w #4,(Tails_CPU_routine).w ; TailsCPU_Flying
  43345. beq.s return_21284
  43346.  
  43347. + tst.b (a2)+
  43348. bne.s Obj84_MainX_Alt
  43349. cmp.w x_pos(a1),d1
  43350. bhi.s return_21284
  43351. move.b #1,-1(a2)
  43352. move.w y_pos(a0),d2
  43353. move.w d2,d3
  43354. move.w objoff_32(a0),d4
  43355. sub.w d4,d2
  43356. add.w d4,d3
  43357. move.w y_pos(a1),d4
  43358. cmp.w d2,d4
  43359. blo.s return_21284
  43360. cmp.w d3,d4
  43361. bhs.s return_21284
  43362. btst #0,render_flags(a0)
  43363. bne.s +
  43364. move.b #1,pinball_mode(a1) ; enable must-roll "pinball mode"
  43365. bra.s loc_212C4
  43366. ; ---------------------------------------------------------------------------
  43367. + move.b #0,pinball_mode(a1) ; disable pinball mode
  43368.  
  43369. return_21284:
  43370. rts
  43371. ; ===========================================================================
  43372. ; loc_21286:
  43373. Obj84_MainX_Alt:
  43374. cmp.w x_pos(a1),d1
  43375. bls.s return_21284
  43376. move.b #0,-1(a2)
  43377. move.w y_pos(a0),d2
  43378. move.w d2,d3
  43379. move.w objoff_32(a0),d4
  43380. sub.w d4,d2
  43381. add.w d4,d3
  43382. move.w y_pos(a1),d4
  43383. cmp.w d2,d4
  43384. blo.s return_21284
  43385. cmp.w d3,d4
  43386. bhs.s return_21284
  43387. btst #0,render_flags(a0)
  43388. beq.s +
  43389. move.b #1,pinball_mode(a1)
  43390. bra.s loc_212C4
  43391. ; ---------------------------------------------------------------------------
  43392. + move.b #0,pinball_mode(a1)
  43393. rts
  43394. ; ===========================================================================
  43395.  
  43396. loc_212C4:
  43397. btst #2,status(a1)
  43398. beq.s +
  43399. rts
  43400. ; ---------------------------------------------------------------------------
  43401. + bset #2,status(a1)
  43402. move.b #$E,y_radius(a1)
  43403. move.b #7,x_radius(a1)
  43404. move.b #AniIDSonAni_Roll,anim(a1)
  43405. addq.w #5,y_pos(a1)
  43406. move.w #SndID_Roll,d0
  43407. jsr (PlaySound).l
  43408. rts
  43409.  
  43410. ; ===========================================================================
  43411. ; loc_212F6:
  43412. Obj84_MainY:
  43413.  
  43414. tst.w (Debug_placement_mode).w
  43415. bne.s return_21350
  43416. move.w y_pos(a0),d1
  43417. lea objoff_34(a0),a2 ; a2=object
  43418. lea (MainCharacter).w,a1 ; a1=character
  43419. bsr.s +
  43420. lea (Sidekick).w,a1 ; a1=character
  43421. +
  43422. tst.b (a2)+
  43423. bne.s Obj84_MainY_Alt
  43424. cmp.w y_pos(a1),d1
  43425. bhi.s return_21350
  43426. move.b #1,-1(a2)
  43427. move.w x_pos(a0),d2
  43428. move.w d2,d3
  43429. move.w objoff_32(a0),d4
  43430. sub.w d4,d2
  43431. add.w d4,d3
  43432. move.w x_pos(a1),d4
  43433. cmp.w d2,d4
  43434. blo.s return_21350
  43435. cmp.w d3,d4
  43436. bhs.s return_21350
  43437. btst #0,render_flags(a0)
  43438. bne.s +
  43439. move.b #1,pinball_mode(a1)
  43440. bra.w loc_212C4
  43441. ; ---------------------------------------------------------------------------
  43442. + move.b #0,pinball_mode(a1)
  43443.  
  43444. return_21350:
  43445. rts
  43446. ; ===========================================================================
  43447. ; loc_21352:
  43448. Obj84_MainY_Alt:
  43449. cmp.w y_pos(a1),d1
  43450. bls.s return_21350
  43451. move.b #0,-1(a2)
  43452. move.w x_pos(a0),d2
  43453. move.w d2,d3
  43454. move.w objoff_32(a0),d4
  43455. sub.w d4,d2
  43456. add.w d4,d3
  43457. move.w x_pos(a1),d4
  43458. cmp.w d2,d4
  43459. blo.s return_21350
  43460. cmp.w d3,d4
  43461. bhs.s return_21350
  43462. btst #0,render_flags(a0)
  43463. beq.s +
  43464. move.b #1,pinball_mode(a1)
  43465. bra.w loc_212C4
  43466. ; ---------------------------------------------------------------------------
  43467. + move.b #0,pinball_mode(a1)
  43468. rts
  43469.  
  43470.  
  43471.  
  43472.  
  43473. ; ===========================================================================
  43474. ; ----------------------------------------------------------------------------
  43475. ; Object 8B - Cycling palette switcher from Wing Fortress Zone
  43476. ; ----------------------------------------------------------------------------
  43477. ; Sprite_21392:
  43478. Obj8B:
  43479. moveq #0,d0
  43480. move.b routine(a0),d0
  43481. move.w Obj8B_Index(pc,d0.w),d1
  43482. jsr Obj8B_Index(pc,d1.w)
  43483. jmp (MarkObjGone3).l
  43484. ; ===========================================================================
  43485. ; off_213A6:
  43486. Obj8B_Index: offsetTable
  43487. offsetTableEntry.w Obj8B_Init ; 0
  43488. offsetTableEntry.w Obj8B_Main ; 2
  43489. ; ===========================================================================
  43490. word_213AA:
  43491. dc.w $20
  43492. dc.w $40 ; 1
  43493. dc.w $80 ; 2
  43494. dc.w $100 ; 3
  43495. ; ===========================================================================
  43496. ; loc_213B2:
  43497. Obj8B_Init:
  43498. addq.b #2,routine(a0)
  43499. move.l #Obj03_MapUnc_1FFB8,mappings(a0)
  43500. move.w #make_art_tile(ArtTile_ArtNem_Ring,0,0),art_tile(a0)
  43501. jsrto (Adjust2PArtPointer).l, JmpTo12_Adjust2PArtPointer
  43502. ori.b #4,render_flags(a0)
  43503. move.b #$10,width_pixels(a0)
  43504. move.b #5,priority(a0)
  43505. move.b subtype(a0),d0
  43506. andi.w #3,d0
  43507. move.b d0,mapping_frame(a0)
  43508. add.w d0,d0
  43509. move.w word_213AA(pc,d0.w),objoff_32(a0)
  43510. move.w x_pos(a0),d1
  43511. lea (MainCharacter).w,a1 ; a1=character
  43512. cmp.w x_pos(a1),d1
  43513. bhs.s loc_21402
  43514. move.b #1,objoff_34(a0)
  43515.  
  43516. loc_21402:
  43517. lea (Sidekick).w,a1 ; a1=character
  43518. cmp.w x_pos(a1),d1
  43519. bhs.s Obj8B_Main
  43520. move.b #1,objoff_35(a0)
  43521. ; loc_21412:
  43522. Obj8B_Main:
  43523. tst.w (Debug_placement_mode).w
  43524. bne.s return_2146A
  43525. move.w x_pos(a0),d1
  43526. lea objoff_34(a0),a2 ; a2=object
  43527. lea (MainCharacter).w,a1 ; a1=character
  43528. bsr.s loc_2142A
  43529. lea (Sidekick).w,a1 ; a1=character
  43530.  
  43531. loc_2142A:
  43532. tst.b (a2)+
  43533. bne.s loc_2146C
  43534. cmp.w x_pos(a1),d1
  43535. bhi.s return_2146A
  43536. move.b #1,-1(a2)
  43537. move.w y_pos(a0),d2
  43538. move.w d2,d3
  43539. move.w objoff_32(a0),d4
  43540. sub.w d4,d2
  43541. add.w d4,d3
  43542. move.w y_pos(a1),d4
  43543. cmp.w d2,d4
  43544. blo.s return_2146A
  43545. cmp.w d3,d4
  43546. bhs.s return_2146A
  43547. btst #0,render_flags(a0)
  43548. bne.s +
  43549. move.b #1,(WFZ_SCZ_Fire_Toggle).w
  43550. rts
  43551. ; ---------------------------------------------------------------------------
  43552. + move.b #0,(WFZ_SCZ_Fire_Toggle).w
  43553.  
  43554. return_2146A:
  43555. rts
  43556. ; ===========================================================================
  43557.  
  43558. loc_2146C:
  43559. cmp.w x_pos(a1),d1
  43560. bls.s return_2146A
  43561. move.b #0,-1(a2)
  43562. move.w y_pos(a0),d2
  43563. move.w d2,d3
  43564. move.w objoff_32(a0),d4
  43565. sub.w d4,d2
  43566. add.w d4,d3
  43567. move.w y_pos(a1),d4
  43568. cmp.w d2,d4
  43569. blo.s return_2146A
  43570. cmp.w d3,d4
  43571. bhs.s return_2146A
  43572. btst #0,render_flags(a0)
  43573. beq.s +
  43574. move.b #1,(WFZ_SCZ_Fire_Toggle).w
  43575. rts
  43576. ; ---------------------------------------------------------------------------
  43577. + move.b #0,(WFZ_SCZ_Fire_Toggle).w
  43578. rts
  43579. ; ===========================================================================
  43580.  
  43581. if gameRevision<2
  43582. nop
  43583. endif
  43584.  
  43585. if ~~removeJmpTos
  43586. ; loc_214AC:
  43587. JmpTo10_DisplaySprite
  43588. jmp (DisplaySprite).l
  43589. JmpTo18_DeleteObject
  43590. jmp (DeleteObject).l
  43591. JmpTo2_SingleObjLoad
  43592. jmp (SingleObjLoad).l
  43593. JmpTo12_Adjust2PArtPointer
  43594. jmp (Adjust2PArtPointer).l
  43595.  
  43596. align 4
  43597. else
  43598. JmpTo18_DeleteObject
  43599. jmp (DeleteObject).l
  43600. endif
  43601.  
  43602.  
  43603.  
  43604.  
  43605. ; ===========================================================================
  43606. ; ----------------------------------------------------------------------------
  43607. ; Object 06 - Rotating cylinder in MTZ, twisting spiral pathway in EHZ
  43608. ; ----------------------------------------------------------------------------
  43609. ; Sprite_214C4:
  43610. Obj06:
  43611. moveq #0,d0
  43612. move.b routine(a0),d0
  43613. move.w Obj06_Index(pc,d0.w),d1
  43614. jsr Obj06_Index(pc,d1.w)
  43615. tst.w (Two_player_mode).w
  43616. beq.s Obj06_ChkDel
  43617. rts
  43618. ; ---------------------------------------------------------------------------
  43619. ; seems to be an optimization to delete the object the instant it goes offscreen
  43620. ; only in 1-player mode, because it would screw up the other player
  43621. ; loc_214DA:
  43622. Obj06_ChkDel:
  43623. move.w x_pos(a0),d0
  43624. andi.w #$FF80,d0
  43625. sub.w (Camera_X_pos_coarse).w,d0
  43626. cmpi.w #$280,d0
  43627. bhi.s JmpTo19_DeleteObject
  43628. rts
  43629. ; ---------------------------------------------------------------------------
  43630. JmpTo19_DeleteObject
  43631. jmp (DeleteObject).l
  43632.  
  43633. ; ===========================================================================
  43634. ; off_214F4:
  43635. Obj06_Index: offsetTable
  43636. offsetTableEntry.w Obj06_Init ; 0
  43637. offsetTableEntry.w Obj06_Spiral ; 2
  43638. offsetTableEntry.w Obj06_Cylinder ; 4
  43639. ; ===========================================================================
  43640. ; loc_214FA:
  43641. Obj06_Init:
  43642. addq.b #2,routine(a0) ; => Obj06_Spiral
  43643. move.b #$D0,width_pixels(a0)
  43644. tst.b subtype(a0)
  43645. bpl.s Obj06_Spiral
  43646. addq.b #2,routine(a0) ; => Obj06_Cylinder
  43647. bra.w Obj06_Cylinder
  43648.  
  43649. ; ===========================================================================
  43650. ; spiral pathway from EHZ
  43651. ; loc_21512:
  43652. Obj06_Spiral:
  43653. lea (MainCharacter).w,a1 ; a1=character
  43654. moveq #p1_standing_bit,d6
  43655. bsr.s +
  43656. lea (Sidekick).w,a1 ; a1=character
  43657. addq.b #1,d6
  43658. +
  43659. btst d6,status(a0)
  43660. bne.w loc_215C0
  43661. btst #1,status(a1)
  43662. bne.w return_215BE
  43663. btst #3,status(a1)
  43664. bne.s loc_21580
  43665. move.w x_pos(a1),d0
  43666. sub.w x_pos(a0),d0
  43667. tst.w x_vel(a1)
  43668. bmi.s loc_21556
  43669. cmpi.w #-$C0,d0
  43670. bgt.s return_215BE
  43671. cmpi.w #-$D0,d0
  43672. blt.s return_215BE
  43673. bra.s loc_21562
  43674. ; ---------------------------------------------------------------------------
  43675.  
  43676. loc_21556:
  43677. cmpi.w #$C0,d0
  43678. blt.s return_215BE
  43679. cmpi.w #$D0,d0
  43680. bgt.s return_215BE
  43681.  
  43682. loc_21562:
  43683. move.w y_pos(a1),d1
  43684. sub.w y_pos(a0),d1
  43685. subi.w #$10,d1
  43686. cmpi.w #$30,d1
  43687. bhs.s return_215BE
  43688. tst.b obj_control(a1)
  43689. bne.s return_215BE
  43690. bsr.w RideObject_SetRide
  43691. rts
  43692. ; ---------------------------------------------------------------------------
  43693.  
  43694. loc_21580:
  43695. move.w x_pos(a1),d0
  43696. sub.w x_pos(a0),d0
  43697. tst.w x_vel(a1)
  43698. bmi.s loc_2159C
  43699. cmpi.w #-$B0,d0
  43700. bgt.s return_215BE
  43701. cmpi.w #-$C0,d0
  43702. blt.s return_215BE
  43703. bra.s loc_215A8
  43704. ; ---------------------------------------------------------------------------
  43705.  
  43706. loc_2159C:
  43707. cmpi.w #$B0,d0
  43708. blt.s return_215BE
  43709. cmpi.w #$C0,d0
  43710. bgt.s return_215BE
  43711.  
  43712. loc_215A8:
  43713. move.w y_pos(a1),d1
  43714. sub.w y_pos(a0),d1
  43715. subi.w #$10,d1
  43716. cmpi.w #$30,d1
  43717. bhs.s return_215BE
  43718. bsr.w RideObject_SetRide
  43719.  
  43720. return_215BE:
  43721. rts
  43722. ; ---------------------------------------------------------------------------
  43723.  
  43724. loc_215C0:
  43725. mvabs.w inertia(a1),d0
  43726. cmpi.w #$600,d0
  43727. blo.s Obj06_Spiral_CharacterFallsOff
  43728. btst #1,status(a1)
  43729. bne.s Obj06_Spiral_CharacterFallsOff
  43730. move.w x_pos(a1),d0
  43731. sub.w x_pos(a0),d0
  43732. addi.w #$D0,d0
  43733. bmi.s Obj06_Spiral_CharacterFallsOff
  43734. cmpi.w #$1A0,d0
  43735. blo.s Obj06_Spiral_MoveCharacter
  43736.  
  43737. ; loc_215EA:
  43738. Obj06_Spiral_CharacterFallsOff:
  43739. bclr #3,status(a1)
  43740. bclr d6,status(a0)
  43741. move.b #0,flips_remaining(a1)
  43742. move.b #4,flip_speed(a1)
  43743. rts
  43744.  
  43745. ; ---------------------------------------------------------------------------
  43746. ; loc_21602:
  43747. Obj06_Spiral_MoveCharacter:
  43748. btst #3,status(a1)
  43749. beq.s return_215BE
  43750. move.b Obj06_CosineTable(pc,d0.w),d1
  43751. ext.w d1
  43752. move.w y_pos(a0),d2
  43753. add.w d1,d2
  43754. moveq #0,d1
  43755. move.b y_radius(a1),d1
  43756. subi.w #$13,d1
  43757. sub.w d1,d2
  43758. move.w d2,y_pos(a1)
  43759. lsr.w #3,d0
  43760. andi.w #$3F,d0
  43761. move.b Obj06_FlipAngleTable(pc,d0.w),flip_angle(a1)
  43762. rts
  43763.  
  43764. ; ===========================================================================
  43765. ; byte_21634:
  43766. Obj06_FlipAngleTable:
  43767. dc.b 0, 0, 1, 1; 4
  43768. dc.b $16, $16, $16, $16; 8
  43769. dc.b $2C, $2C, $2C, $2C; 12
  43770. dc.b $42, $42, $42, $42; 16
  43771. dc.b $58, $58, $58, $58; 20
  43772. dc.b $6E, $6E, $6E, $6E; 24
  43773. dc.b $84, $84, $84, $84; 28
  43774. dc.b $9A, $9A, $9A, $9A; 32
  43775. dc.b $B0, $B0, $B0, $B0; 36
  43776. dc.b $C6, $C6, $C6, $C6; 40
  43777. dc.b $DC, $DC, $DC, $DC; 44
  43778. dc.b $F2, $F2, $F2, $F2; 48
  43779. dc.b 1, 1, 0, 0; 52
  43780. ; byte_21668:
  43781. Obj06_CosineTable:
  43782. dc.b 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32; 16
  43783. dc.b 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 31, 31; 32
  43784. dc.b 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 30, 30, 30; 48
  43785. dc.b 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, 28, 28, 28, 27; 64
  43786. dc.b 27, 27, 27, 26, 26, 26, 25, 25, 25, 24, 24, 24, 23, 23, 22, 22; 80
  43787. dc.b 21, 21, 20, 20, 19, 18, 18, 17, 16, 16, 15, 14, 14, 13, 12, 12; 96
  43788. dc.b 11, 10, 10, 9, 8, 8, 7, 6, 6, 5, 4, 4, 3, 2, 2, 1; 112
  43789. dc.b 0, -1, -2, -2, -3, -4, -4, -5, -6, -7, -7, -8, -9, -9,-10,-10; 128
  43790. dc.b -11,-11,-12,-12,-13,-14,-14,-15,-15,-16,-16,-17,-17,-18,-18,-19; 144
  43791. dc.b -19,-19,-20,-21,-21,-22,-22,-23,-23,-24,-24,-25,-25,-26,-26,-27; 160
  43792. dc.b -27,-28,-28,-28,-29,-29,-30,-30,-30,-31,-31,-31,-32,-32,-32,-33; 176
  43793. dc.b -33,-33,-33,-34,-34,-34,-35,-35,-35,-35,-35,-35,-35,-35,-36,-36; 192
  43794. dc.b -36,-36,-36,-36,-36,-36,-36,-37,-37,-37,-37,-37,-37,-37,-37,-37; 208
  43795. dc.b -37,-37,-37,-37,-37,-37,-37,-37,-37,-37,-37,-37,-37,-37,-37,-37; 224
  43796. dc.b -37,-37,-37,-37,-36,-36,-36,-36,-36,-36,-36,-35,-35,-35,-35,-35; 240
  43797. dc.b -35,-35,-35,-34,-34,-34,-33,-33,-33,-33,-32,-32,-32,-31,-31,-31; 256
  43798. dc.b -30,-30,-30,-29,-29,-28,-28,-28,-27,-27,-26,-26,-25,-25,-24,-24; 272
  43799. dc.b -23,-23,-22,-22,-21,-21,-20,-19,-19,-18,-18,-17,-16,-16,-15,-14; 288
  43800. dc.b -14,-13,-12,-11,-11,-10, -9, -8, -7, -7, -6, -5, -4, -3, -2, -1; 304
  43801. dc.b 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, 10, 11, 12, 13; 320
  43802. dc.b 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21; 336
  43803. dc.b 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26; 352
  43804. dc.b 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29; 368
  43805. dc.b 29, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31; 384
  43806. dc.b 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32; 400
  43807. dc.b 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32; 416
  43808.  
  43809. ; ===========================================================================
  43810. ; rotating meshed cage from MTZ
  43811. ; loc_21808:
  43812. Obj06_Cylinder:
  43813. lea (MainCharacter).w,a1 ; a1=character
  43814. lea (MTZCylinder_Angle_Sonic).w,a2
  43815. moveq #p1_standing_bit,d6
  43816. bsr.s +
  43817. lea (Sidekick).w,a1 ; a1=character
  43818. lea (MTZCylinder_Angle_Tails).w,a2
  43819. addq.b #1,d6
  43820. +
  43821. btst d6,status(a0)
  43822. bne.w loc_2188C
  43823. move.w x_pos(a1),d0
  43824. sub.w x_pos(a0),d0
  43825. cmpi.w #-$C0,d0
  43826. blt.s return_2188A
  43827. cmpi.w #$C0,d0
  43828. bge.s return_2188A
  43829. move.w y_pos(a0),d0
  43830. addi.w #$3C,d0
  43831. move.w y_pos(a1),d2
  43832. move.b y_radius(a1),d1
  43833. ext.w d1
  43834. add.w d2,d1
  43835. addq.w #4,d1
  43836. sub.w d1,d0
  43837. bhi.s return_2188A
  43838. cmpi.w #-$10,d0
  43839. blo.s return_2188A
  43840. cmpi.b #6,routine(a1)
  43841. bhs.s return_2188A
  43842. add.w d0,d2
  43843. addq.w #3,d2
  43844. move.w d2,y_pos(a1)
  43845. move.b #1,flip_turned(a1) ; face the other way
  43846. bsr.w RideObject_SetRide
  43847. move.w #AniIDSonAni_Run,anim(a1)
  43848. move.b #0,(a2)
  43849. tst.w inertia(a1)
  43850. bne.s return_2188A
  43851. move.w #1,inertia(a1)
  43852.  
  43853. return_2188A:
  43854. rts
  43855. ; ===========================================================================
  43856.  
  43857. loc_2188C:
  43858. btst #1,status(a1)
  43859. bne.s loc_218C6
  43860. move.w x_pos(a1),d0
  43861. sub.w x_pos(a0),d0
  43862. addi.w #$C0,d0
  43863. bmi.s loc_218A8
  43864. cmpi.w #$180,d0
  43865. blo.s loc_218E0
  43866.  
  43867. loc_218A8:
  43868. bclr #3,status(a1)
  43869. bclr d6,status(a0)
  43870. move.b #0,flips_remaining(a1)
  43871. move.b #4,flip_speed(a1)
  43872. bset #1,status(a1)
  43873. rts
  43874. ; ---------------------------------------------------------------------------
  43875. loc_218C6:
  43876. move.b (a2),d0
  43877. addi.b #$20,d0
  43878. cmpi.b #$40,d0
  43879. bhs.s +
  43880. asr y_vel(a1)
  43881. bra.s loc_218A8
  43882. ; ---------------------------------------------------------------------------
  43883. + move.w #0,y_vel(a1)
  43884. bra.s loc_218A8
  43885. ; ===========================================================================
  43886.  
  43887. loc_218E0:
  43888. btst #3,status(a1)
  43889. beq.s return_2188A
  43890. move.b (a2),d0
  43891. jsrto (CalcSine).l, JmpTo6_CalcSine
  43892. muls.w #$2800,d1
  43893. swap d1
  43894. move.w y_pos(a0),d2
  43895. add.w d1,d2
  43896. moveq #0,d1
  43897. move.b y_radius(a1),d1
  43898. subi.w #$13,d1
  43899. sub.w d1,d2
  43900. move.w d2,y_pos(a1)
  43901. move.b (a2),d0
  43902. move.b d0,flip_angle(a1)
  43903. addq.b #4,(a2)
  43904. tst.w inertia(a1)
  43905. bne.s return_2191E
  43906. move.w #1,inertia(a1)
  43907.  
  43908. return_2191E:
  43909. rts
  43910. ; ===========================================================================
  43911.  
  43912. if ~~removeJmpTos
  43913. JmpTo6_CalcSine
  43914. jmp (CalcSine).l
  43915.  
  43916. align 4
  43917. endif
  43918.  
  43919.  
  43920.  
  43921.  
  43922. ; ===========================================================================
  43923. ; ----------------------------------------------------------------------------
  43924. ; Object 14 - See saw from Hill Top Zone
  43925. ; ----------------------------------------------------------------------------
  43926. ; Sprite_21928:
  43927. Obj14:
  43928. moveq #0,d0
  43929. move.b routine(a0),d0
  43930. move.w Obj14_Index(pc,d0.w),d1
  43931. jsr Obj14_Index(pc,d1.w)
  43932. move.w objoff_30(a0),d0
  43933. jmpto (MarkObjGone2).l, JmpTo_MarkObjGone2
  43934. ; ===========================================================================
  43935. ; off_2193E:
  43936. Obj14_Index: offsetTable
  43937. offsetTableEntry.w Obj14_Init ; 0
  43938. offsetTableEntry.w Obj14_Main ; 2
  43939. offsetTableEntry.w return_21A74 ; 4
  43940. offsetTableEntry.w Obj14_Ball_Init ; 6
  43941. offsetTableEntry.w Obj14_Ball_Main ; 8
  43942. offsetTableEntry.w Obj14_Ball_Fly ; $A
  43943. ; ===========================================================================
  43944. ; loc_2194A:
  43945. Obj14_Init:
  43946. addq.b #2,routine(a0)
  43947. move.l #Obj14_MapUnc_21CF0,mappings(a0)
  43948. move.w #make_art_tile(ArtTile_ArtNem_HtzSeeSaw,0,0),art_tile(a0)
  43949. jsrto (Adjust2PArtPointer).l, JmpTo13_Adjust2PArtPointer
  43950. ori.b #4,render_flags(a0)
  43951. move.b #4,priority(a0)
  43952. move.b #$30,width_pixels(a0)
  43953. move.w x_pos(a0),objoff_30(a0)
  43954. tst.b subtype(a0)
  43955. bne.s loc_219A4
  43956. jsrto (SingleObjLoad2).l, JmpTo3_SingleObjLoad2
  43957. bne.s loc_219A4
  43958. _move.b #ObjID_Seesaw,id(a1) ; load obj14
  43959. addq.b #6,routine(a1)
  43960. move.w x_pos(a0),x_pos(a1)
  43961. move.w y_pos(a0),y_pos(a1)
  43962. move.b status(a0),status(a1)
  43963. move.l a0,objoff_3C(a1)
  43964.  
  43965. loc_219A4:
  43966. btst #0,status(a0)
  43967. beq.s loc_219B2
  43968. move.b #2,mapping_frame(a0)
  43969.  
  43970. loc_219B2:
  43971. move.b mapping_frame(a0),objoff_3A(a0)
  43972.  
  43973. Obj14_Main:
  43974. move.b objoff_3A(a0),d1
  43975. btst #p1_standing_bit,status(a0)
  43976. beq.s loc_21A12
  43977. moveq #2,d1
  43978. lea (MainCharacter).w,a1 ; a1=character
  43979. move.w x_pos(a0),d0
  43980. sub.w x_pos(a1),d0
  43981. bcc.s +
  43982. neg.w d0
  43983. moveq #0,d1
  43984. +
  43985. cmpi.w #8,d0
  43986. bhs.s +
  43987. moveq #1,d1
  43988. +
  43989. btst #p2_standing_bit,status(a0)
  43990. beq.s Obj14_UpdateMappingAndCollision
  43991. moveq #2,d2
  43992. lea (Sidekick).w,a1 ; a1=character
  43993. move.w x_pos(a0),d0
  43994. sub.w x_pos(a1),d0
  43995. bcc.s +
  43996. neg.w d0
  43997. moveq #0,d2
  43998. +
  43999. cmpi.w #8,d0
  44000. bhs.s +
  44001. moveq #1,d2
  44002. +
  44003. add.w d2,d1
  44004. cmpi.w #3,d1
  44005. bne.s +
  44006. addq.w #1,d1
  44007. +
  44008. lsr.w #1,d1
  44009. bra.s Obj14_UpdateMappingAndCollision
  44010. ; ===========================================================================
  44011.  
  44012. loc_21A12:
  44013. btst #p2_standing_bit,status(a0)
  44014. beq.s loc_21A38
  44015. moveq #2,d1
  44016. lea (Sidekick).w,a1 ; a1=character
  44017. move.w x_pos(a0),d0
  44018. sub.w x_pos(a1),d0
  44019. bcc.s +
  44020. neg.w d0
  44021. moveq #0,d1
  44022. +
  44023. cmpi.w #8,d0
  44024. bhs.s Obj14_UpdateMappingAndCollision
  44025. moveq #1,d1
  44026. bra.s Obj14_UpdateMappingAndCollision
  44027. ; ===========================================================================
  44028.  
  44029. loc_21A38:
  44030. move.w (MainCharacter+y_vel).w,d0
  44031. move.w (Sidekick+y_vel).w,d2
  44032. cmp.w d0,d2
  44033. blt.s +
  44034. move.w d2,d0
  44035. +
  44036. move.w d0,objoff_38(a0)
  44037.  
  44038. ; loc_21A4A:
  44039. Obj14_UpdateMappingAndCollision:
  44040. bsr.w Obj14_SetMapping
  44041. lea (byte_21C8E).l,a2
  44042. btst #0,mapping_frame(a0)
  44043. beq.s +
  44044. lea (byte_21CBF).l,a2
  44045. +
  44046. move.w x_pos(a0),-(sp)
  44047. moveq #0,d1
  44048. move.b width_pixels(a0),d1
  44049. moveq #8,d3
  44050. move.w (sp)+,d4
  44051. bra.w SlopedPlatform
  44052. ; ===========================================================================
  44053.  
  44054. return_21A74:
  44055. rts
  44056. ; ===========================================================================
  44057.  
  44058. ; loc_21A76:
  44059. Obj14_SetMapping:
  44060. move.b mapping_frame(a0),d0
  44061. cmp.b d1,d0
  44062. beq.s return_21AA0
  44063. bhs.s +
  44064. addq.b #2,d0
  44065. +
  44066. subq.b #1,d0
  44067. move.b d0,mapping_frame(a0)
  44068. move.b d1,objoff_3A(a0)
  44069. bclr #0,render_flags(a0)
  44070. btst #1,mapping_frame(a0)
  44071. beq.s return_21AA0
  44072. bset #0,render_flags(a0)
  44073.  
  44074. return_21AA0:
  44075. rts
  44076. ; ===========================================================================
  44077. ; loc_21AA2:
  44078. Obj14_Ball_Init:
  44079. addq.b #2,routine(a0)
  44080. move.l #Obj14_MapUnc_21D7C,mappings(a0)
  44081. move.w #make_art_tile(ArtTile_ArtNem_Sol,0,0),art_tile(a0)
  44082. jsrto (Adjust2PArtPointer).l, JmpTo13_Adjust2PArtPointer
  44083. ori.b #4,render_flags(a0)
  44084. move.b #4,priority(a0)
  44085. move.b #$8B,collision_flags(a0)
  44086. move.b #$C,width_pixels(a0)
  44087. move.w x_pos(a0),objoff_30(a0) ; save seesaw x position
  44088. addi.w #$28,x_pos(a0)
  44089. addi.w #$10,y_pos(a0)
  44090. move.w y_pos(a0),objoff_34(a0) ; save bottom of seesaw y position
  44091. btst #0,status(a0)
  44092. beq.s Obj14_Ball_Main
  44093. subi.w #$50,x_pos(a0)
  44094. move.b #2,objoff_3A(a0)
  44095. ; loc_21AFC:
  44096. Obj14_Ball_Main:
  44097. bsr.w Obj14_Animate
  44098. movea.l objoff_3C(a0),a1 ; a1=parent object (seesaw)
  44099. moveq #0,d0
  44100. move.b objoff_3A(a0),d0 ; d0 = ball angle - seesaw angle
  44101. sub.b objoff_3A(a1),d0
  44102. beq.s Obj14_SetBallToRestOnSeeSaw
  44103. bcc.s +
  44104. neg.b d0
  44105. +
  44106. move.w #-$818,d1
  44107. move.w #-$114,d2
  44108. cmpi.b #1,d0
  44109. beq.s +
  44110. move.w #-$AF0,d1
  44111. move.w #-$CC,d2
  44112. cmpi.w #$A00,objoff_38(a1) ; check if character y_vel that jumped on
  44113. blt.s + ; seesaw > 2560
  44114. move.w #-$E00,d1
  44115. move.w #-$A0,d2
  44116. +
  44117. move.w d1,y_vel(a0)
  44118. move.w d2,x_vel(a0)
  44119. move.w x_pos(a0),d0
  44120. sub.w objoff_30(a0),d0
  44121. bcc.s +
  44122. neg.w x_vel(a0)
  44123. +
  44124. addq.b #2,routine(a0)
  44125. bra.s Obj14_Ball_Fly
  44126. ; ===========================================================================
  44127.  
  44128. ; loc_21B56:
  44129. Obj14_SetBallToRestOnSeeSaw:
  44130. lea (Obj14_YOffsets).l,a2
  44131. moveq #0,d0
  44132. move.b mapping_frame(a1),d0
  44133. move.w #$28,d2
  44134. move.w x_pos(a0),d1
  44135. sub.w objoff_30(a0),d1
  44136. bcc.s +
  44137. neg.w d2
  44138. addq.w #2,d0
  44139. +
  44140. add.w d0,d0
  44141. move.w objoff_34(a0),d1 ; d1 = bottom of seesaw y position
  44142. add.w (a2,d0.w),d1 ; + offset for current angle
  44143. move.w d1,y_pos(a0) ; set y position so ball rests on seesaw
  44144. add.w objoff_30(a0),d2
  44145. move.w d2,x_pos(a0)
  44146. clr.w y_sub(a0)
  44147. clr.w x_sub(a0)
  44148. rts
  44149. ; ===========================================================================
  44150.  
  44151. Obj14_Ball_Fly:
  44152.  
  44153. bsr.w Obj14_Animate
  44154. tst.w y_vel(a0)
  44155. bpl.s loc_21BB6
  44156. jsrto (ObjectMoveAndFall).l, JmpTo_ObjectMoveAndFall
  44157. move.w objoff_34(a0),d0 ; d0 = bottom of seesaw y position
  44158. subi.w #$2F,d0
  44159. cmp.w y_pos(a0),d0
  44160. bgt.s return_21BB4
  44161. jsrto (ObjectMoveAndFall).l, JmpTo_ObjectMoveAndFall
  44162.  
  44163. return_21BB4:
  44164. rts
  44165. ; ===========================================================================
  44166.  
  44167. loc_21BB6:
  44168. jsrto (ObjectMoveAndFall).l, JmpTo_ObjectMoveAndFall
  44169. movea.l objoff_3C(a0),a1 ; a1=parent object (seesaw)
  44170. lea (Obj14_YOffsets).l,a2
  44171. moveq #0,d0
  44172. move.b mapping_frame(a1),d0
  44173. move.w x_pos(a0),d1
  44174. sub.w objoff_30(a0),d1
  44175. bcc.s +
  44176. addq.w #2,d0
  44177. +
  44178. add.w d0,d0
  44179. move.w objoff_34(a0),d1 ; d1 = bottom of seesaw y position
  44180. add.w (a2,d0.w),d1 ; + offset for current angle
  44181. cmp.w y_pos(a0),d1 ; return if y position < d1
  44182. bgt.s return_21C2A
  44183. movea.l objoff_3C(a0),a1 ; a1=parent object (seesaw)
  44184. moveq #2,d1 ; d1 = x_vel >= 0 ? 0 : 2
  44185. tst.w x_vel(a0)
  44186. bmi.s +
  44187. moveq #0,d1
  44188. +
  44189. move.b d1,objoff_3A(a1) ; set seesaw angle to d1
  44190. move.b d1,objoff_3A(a0) ; set ball angle to d1
  44191. cmp.b mapping_frame(a1),d1
  44192. beq.s loc_21C1E
  44193.  
  44194. ; launch main character if stood on seesaw
  44195. lea (MainCharacter).w,a2 ; a2=character
  44196. bclr #p1_standing_bit,status(a1)
  44197. beq.s +
  44198. bsr.s Obj14_LaunchCharacter
  44199. +
  44200. ; launch sidekick if stood on seesaw
  44201. lea (Sidekick).w,a2 ; a2=character
  44202. bclr #p2_standing_bit,status(a1)
  44203. beq.s loc_21C1E
  44204. bsr.s Obj14_LaunchCharacter
  44205.  
  44206. loc_21C1E:
  44207. clr.w x_vel(a0) ; clear ball velocity
  44208. clr.w y_vel(a0)
  44209. subq.b #2,routine(a0) ; set ball to main state
  44210.  
  44211. return_21C2A:
  44212. rts
  44213. ; ===========================================================================
  44214.  
  44215. ; loc_21C2C:
  44216. Obj14_LaunchCharacter:
  44217. move.w y_vel(a0),y_vel(a2) ; set character y velocity to inverse of sol
  44218. neg.w y_vel(a2) ; y velocity
  44219. bset #1,status(a2) ; set character airborne flag
  44220. bclr #3,status(a2) ; clear character on object flag
  44221. clr.b jumping(a2) ; clear character jumping flag
  44222. move.b #AniIDSonAni_Spring,anim(a2) ; set character to spring animation
  44223. move.b #2,routine(a2) ; set character to airborne state
  44224. move.w #SndID_Spring,d0 ; play spring sound
  44225. jmp (PlaySound).l
  44226. ; ===========================================================================
  44227. ; heights of the contact point of the ball on the seesaw
  44228. ; word_21C5C:
  44229. Obj14_YOffsets:
  44230. dc.w -8, -28, -47, -28, -8 ; low, balanced, high, balanced, low
  44231. ; ===========================================================================
  44232.  
  44233. ; loc_21C66:
  44234. Obj14_Animate:
  44235. move.b (Timer_frames+1).w,d0
  44236. andi.b #3,d0
  44237. bne.s Obj14_SetSolToFaceMainCharacter
  44238. bchg #palette_bit_0,art_tile(a0)
  44239.  
  44240. Obj14_SetSolToFaceMainCharacter:
  44241. andi.b #$FE,render_flags(a0)
  44242. move.w (MainCharacter+x_pos).w,d0
  44243. sub.w x_pos(a0),d0
  44244. bcs.s return_21C8C
  44245. ori.b #1,render_flags(a0)
  44246.  
  44247. return_21C8C:
  44248. rts
  44249. ; ===========================================================================
  44250. byte_21C8E:
  44251. dc.b $14,$14,$16,$18,$1A,$1C,$1A,$18,$16,$14,$13,$12,$11,$10, $F, $E
  44252. dc.b $D, $C, $B, $A, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,$FF,$FE; 16
  44253. dc.b $FD,$FC,$FB,$FA,$F9,$F8,$F7,$F6,$F5,$F4,$F3,$F2,$F2,$F2,$F2,$F2; 32
  44254. dc.b $F2 ; 48
  44255.  
  44256. rev02even
  44257. byte_21CBF:
  44258. dc.b 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
  44259. dc.b 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5; 16
  44260. dc.b 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5; 32
  44261.  
  44262. even
  44263. ; -------------------------------------------------------------------------------
  44264. ; sprite mappings
  44265. ; -------------------------------------------------------------------------------
  44266. Obj14_MapUnc_21CF0: BINCLUDE "mappings/sprite/obj14_a.bin"
  44267. ; -------------------------------------------------------------------------------
  44268. ; sprite mappings
  44269. ; -------------------------------------------------------------------------------
  44270. Obj14_MapUnc_21D7C: BINCLUDE "mappings/sprite/obj14_b.bin"
  44271. ; ===========================================================================
  44272.  
  44273. if ~~removeJmpTos
  44274. JmpTo3_SingleObjLoad2
  44275. jmp (SingleObjLoad2).l
  44276. JmpTo13_Adjust2PArtPointer
  44277. jmp (Adjust2PArtPointer).l
  44278. JmpTo_ObjectMoveAndFall
  44279. jmp (ObjectMoveAndFall).l
  44280. JmpTo_MarkObjGone2
  44281. jmp (MarkObjGone2).l
  44282.  
  44283. align 4
  44284. endif
  44285.  
  44286.  
  44287.  
  44288.  
  44289. ; ===========================================================================
  44290. ; ----------------------------------------------------------------------------
  44291. ; Object 16 - Diagonally moving lift from HTZ
  44292. ; ----------------------------------------------------------------------------
  44293. ; Sprite_21DAC:
  44294. Obj16:
  44295. moveq #0,d0
  44296. move.b routine(a0),d0
  44297. move.w Obj16_Index(pc,d0.w),d1
  44298. jmp Obj16_Index(pc,d1.w)
  44299. ; ===========================================================================
  44300. ; off_21DBA:
  44301. Obj16_Index: offsetTable
  44302. offsetTableEntry.w Obj16_Init ; 0
  44303. offsetTableEntry.w Obj16_Main ; 2
  44304. ; ===========================================================================
  44305. ; loc_21DBE:
  44306. Obj16_Init:
  44307. addq.b #2,routine(a0)
  44308. move.l #Obj16_MapUnc_21F14,mappings(a0)
  44309. move.w #make_art_tile(ArtTile_ArtNem_HtzZipline,2,0),art_tile(a0)
  44310. jsrto (Adjust2PArtPointer).l, JmpTo14_Adjust2PArtPointer
  44311. ori.b #4,render_flags(a0)
  44312. move.b #$20,width_pixels(a0)
  44313. move.b #0,mapping_frame(a0)
  44314. move.b #1,priority(a0)
  44315. move.w x_pos(a0),objoff_30(a0)
  44316. move.w y_pos(a0),objoff_32(a0)
  44317. move.b #$40,y_radius(a0)
  44318. bset #4,render_flags(a0)
  44319. moveq #0,d0
  44320. move.b subtype(a0),d0
  44321. lsl.w #3,d0
  44322. move.w d0,objoff_34(a0)
  44323. ; loc_21E10:
  44324. Obj16_Main:
  44325. move.w x_pos(a0),-(sp)
  44326. bsr.w Obj16_RunSecondaryRoutine
  44327. moveq #0,d1
  44328. move.b width_pixels(a0),d1
  44329. move.w #-$28,d3
  44330. move.w (sp)+,d4
  44331. jsrto (PlatformObject).l, JmpTo3_PlatformObject
  44332. jmpto (MarkObjGone).l, JmpTo5_MarkObjGone
  44333. ; ===========================================================================
  44334. ; loc_21E2C:
  44335. Obj16_RunSecondaryRoutine:
  44336. moveq #0,d0
  44337. move.b routine_secondary(a0),d0
  44338. move.w Obj16_Main_States(pc,d0.w),d1
  44339. jmp Obj16_Main_States(pc,d1.w)
  44340. ; ===========================================================================
  44341. ; off_21E3A:
  44342. Obj16_Main_States: offsetTable
  44343. offsetTableEntry.w Obj16_Wait ; 0
  44344. offsetTableEntry.w Obj16_Slide ; 2
  44345. offsetTableEntry.w Obj16_Fall ; 4
  44346. ; ===========================================================================
  44347. ; loc_21E40:
  44348. Obj16_Wait:
  44349. move.b status(a0),d0 ; get the status flags
  44350. andi.b #standing_mask,d0 ; is one of the players standing on it?
  44351. beq.s ++ ; if not, branch
  44352. addq.b #2,routine_secondary(a0)
  44353. move.w #$200,x_vel(a0)
  44354. btst #0,status(a0)
  44355. beq.s +
  44356. neg.w x_vel(a0)
  44357. +
  44358. move.w #$100,y_vel(a0)
  44359. +
  44360. rts
  44361. ; ===========================================================================
  44362. ; loc_21E68:
  44363. Obj16_Slide:
  44364. move.w (Timer_frames).w,d0
  44365. andi.w #$F,d0 ; play the sound only every 16 frames
  44366. bne.s +
  44367. move.w #SndID_HTZLiftClick,d0
  44368. jsr (PlaySound).l
  44369. +
  44370. jsrto (ObjectMove).l, JmpTo4_ObjectMove
  44371. subq.w #1,objoff_34(a0)
  44372. bne.s + ; rts
  44373. addq.b #2,routine_secondary(a0)
  44374. move.b #2,mapping_frame(a0)
  44375. move.w #0,x_vel(a0)
  44376. move.w #0,y_vel(a0)
  44377. jsrto (SingleObjLoad2).l, JmpTo4_SingleObjLoad2
  44378. bne.s + ; rts
  44379. _move.b #ObjID_Scenery,id(a1) ; load obj1C
  44380. move.w x_pos(a0),x_pos(a1)
  44381. move.w y_pos(a0),y_pos(a1)
  44382. move.b render_flags(a0),render_flags(a1)
  44383. move.b #6,subtype(a1)
  44384. + rts
  44385. ; ===========================================================================
  44386. ; loc_21EC2:
  44387. Obj16_Fall:
  44388. jsrto (ObjectMove).l, JmpTo4_ObjectMove
  44389. addi.w #$38,y_vel(a0)
  44390. move.w (Camera_Max_Y_pos_now).w,d0
  44391. addi.w #$E0,d0
  44392. cmp.w y_pos(a0),d0
  44393. bhs.s +++ ; rts
  44394. move.b status(a0),d0
  44395. andi.b #standing_mask,d0
  44396. beq.s ++
  44397. bclr #p1_standing_bit,status(a0)
  44398. beq.s +
  44399. bclr #3,(MainCharacter+status).w
  44400. bset #1,(MainCharacter+status).w
  44401. +
  44402. bclr #p2_standing_bit,status(a0)
  44403. beq.s +
  44404. bclr #3,(Sidekick+status).w
  44405. bset #1,(Sidekick+status).w
  44406. +
  44407. move.w #$4000,x_pos(a0)
  44408. +
  44409. rts
  44410. ; ===========================================================================
  44411. ; -------------------------------------------------------------------------------
  44412. ; sprite mappings
  44413. ; -------------------------------------------------------------------------------
  44414. Obj16_MapUnc_21F14: BINCLUDE "mappings/sprite/obj16.bin"
  44415. ; ===========================================================================
  44416.  
  44417. if ~~removeJmpTos
  44418. JmpTo5_MarkObjGone
  44419. jmp (MarkObjGone).l
  44420. JmpTo4_SingleObjLoad2
  44421. jmp (SingleObjLoad2).l
  44422. JmpTo14_Adjust2PArtPointer
  44423. jmp (Adjust2PArtPointer).l
  44424. JmpTo3_PlatformObject
  44425. jmp (PlatformObject).l
  44426. ; loc_22010:
  44427. JmpTo4_ObjectMove
  44428. jmp (ObjectMove).l
  44429.  
  44430. align 4
  44431. else
  44432. dc.b $01,$02,$1E,$42 ; ??? (unused)
  44433. endif
  44434.  
  44435.  
  44436.  
  44437.  
  44438. ; ===========================================================================
  44439. ; ----------------------------------------------------------------------------
  44440. ; Object 19 - Platform from CPZ, OOZ and WFZ
  44441. ; ----------------------------------------------------------------------------
  44442. ; Sprite_22018:
  44443. Obj19:
  44444. moveq #0,d0
  44445. move.b routine(a0),d0
  44446. move.w Obj19_Index(pc,d0.w),d1
  44447. jmp Obj19_Index(pc,d1.w)
  44448. ; ===========================================================================
  44449. ; off_22026: Obj19_States:
  44450. Obj19_Index: offsetTable
  44451. offsetTableEntry.w Obj19_Init ; 0
  44452. offsetTableEntry.w Obj19_Main ; 2
  44453. ; ---------------------------------------------------------------------------
  44454. ; word_2202A:
  44455. Obj19_SubtypeProperties:
  44456. ; width_pixels
  44457. ; mapping_frame
  44458. dc.b $20, 0
  44459. dc.b $18, 1
  44460. dc.b $40, 2
  44461. dc.b $20, 3
  44462. ; ===========================================================================
  44463. ; loc_22032:
  44464. Obj19_Init:
  44465. addq.b #2,routine(a0) ; => Obj19_Main
  44466. move.l #Obj19_MapUnc_2222A,mappings(a0)
  44467.  
  44468. move.w #make_art_tile(ArtTile_ArtNem_CPZElevator,3,0),art_tile(a0) ; set default art
  44469.  
  44470. cmpi.b #oil_ocean_zone,(Current_Zone).w ; are we in OOZ?
  44471. bne.s + ; if not, branch
  44472. move.w #make_art_tile(ArtTile_ArtNem_OOZElevator,3,0),art_tile(a0) ; set OOZ art
  44473. +
  44474. cmpi.b #wing_fortress_zone,(Current_Zone).w ; are we in WFZ?
  44475. bne.s + ; if not, branch
  44476. move.w #make_art_tile(ArtTile_ArtNem_WfzFloatingPlatform,1,1),art_tile(a0) ; set WTZ art
  44477. +
  44478. jsrto (Adjust2PArtPointer).l, JmpTo15_Adjust2PArtPointer
  44479. move.b #4,render_flags(a0)
  44480. moveq #0,d0
  44481. move.b subtype(a0),d0
  44482. lsr.w #3,d0
  44483. andi.w #$1E,d0
  44484. lea Obj19_SubtypeProperties(pc,d0.w),a2
  44485. move.b (a2)+,width_pixels(a0)
  44486. move.b (a2)+,mapping_frame(a0)
  44487. move.b #4,priority(a0)
  44488. move.w x_pos(a0),objoff_30(a0)
  44489. move.w y_pos(a0),objoff_32(a0)
  44490. andi.b #$F,subtype(a0)
  44491. cmpi.b #3,subtype(a0)
  44492. bne.s loc_220AA
  44493. btst #0,status(a0)
  44494. bne.s loc_220B2
  44495.  
  44496. loc_220AA:
  44497. cmpi.b #7,subtype(a0)
  44498. bne.s Obj19_Main
  44499.  
  44500. loc_220B2:
  44501. subi.w #$C0,y_pos(a0)
  44502.  
  44503. ; loc_220B8:
  44504. Obj19_Main:
  44505. move.w x_pos(a0),-(sp)
  44506. bsr.w Obj19_Move
  44507. moveq #0,d1
  44508. move.b width_pixels(a0),d1
  44509. move.w #$11,d3
  44510. move.w (sp)+,d4
  44511. jsrto (PlatformObject).l, JmpTo4_PlatformObject
  44512. move.w objoff_30(a0),d0
  44513. andi.w #$FF80,d0
  44514. sub.w (Camera_X_pos_coarse).w,d0
  44515. cmpi.w #$280,d0
  44516. bhi.w JmpTo20_DeleteObject
  44517. jmpto (DisplaySprite).l, JmpTo11_DisplaySprite
  44518. ; ---------------------------------------------------------------------------
  44519. ; loc_220E8:
  44520. Obj19_Move:
  44521. moveq #0,d0
  44522. move.b subtype(a0),d0
  44523. andi.w #$F,d0
  44524. add.w d0,d0
  44525. move.w Obj19_MoveTypes(pc,d0.w),d1
  44526. jmp Obj19_MoveTypes(pc,d1.w)
  44527. ; ===========================================================================
  44528. ; platform movement routine table
  44529. ; off_220FC:
  44530. Obj19_MoveTypes:offsetTable
  44531. offsetTableEntry.w Obj19_MoveRoutine1 ; 0
  44532. offsetTableEntry.w Obj19_MoveRoutine2 ; 1
  44533. offsetTableEntry.w Obj19_MoveRoutine3 ; 2
  44534. offsetTableEntry.w Obj19_MoveRoutine4 ; 3
  44535. offsetTableEntry.w Obj19_MoveRoutine5 ; 4
  44536. offsetTableEntry.w Obj19_MoveRoutineNull ; 5
  44537. offsetTableEntry.w Obj19_MoveRoutine6 ; 6
  44538. offsetTableEntry.w Obj19_MoveRoutine6 ; 7
  44539. offsetTableEntry.w Obj19_MoveRoutine7 ; 8
  44540. offsetTableEntry.w Obj19_MoveRoutine7 ; 9
  44541. offsetTableEntry.w Obj19_MoveRoutine7 ; $A
  44542. offsetTableEntry.w Obj19_MoveRoutine7 ; $B
  44543. offsetTableEntry.w Obj19_MoveRoutine8 ; $C
  44544. offsetTableEntry.w Obj19_MoveRoutine8 ; $D
  44545. offsetTableEntry.w Obj19_MoveRoutine8 ; $E
  44546. offsetTableEntry.w Obj19_MoveRoutine8 ; $F
  44547.  
  44548. ; ===========================================================================
  44549. ; loc_2211C:
  44550. Obj19_MoveRoutine1:
  44551. move.b (Oscillating_Data+8).w,d0
  44552. move.w #$40,d1
  44553. bra.s Obj19_MoveRoutine2_Part2
  44554.  
  44555. ; ===========================================================================
  44556. ; loc_22126:
  44557. Obj19_MoveRoutine2:
  44558. move.b (Oscillating_Data+$C).w,d0
  44559. move.w #$60,d1
  44560. ; loc_2212E:
  44561. Obj19_MoveRoutine2_Part2:
  44562. btst #0,status(a0)
  44563. beq.s +
  44564. neg.w d0
  44565. add.w d1,d0
  44566. +
  44567. move.w objoff_30(a0),d1
  44568. sub.w d0,d1
  44569. move.w d1,x_pos(a0)
  44570. rts
  44571.  
  44572. ; ===========================================================================
  44573. ; loc_22146:
  44574. Obj19_MoveRoutine3:
  44575. move.b (Oscillating_Data+$1C).w,d0
  44576. move.w #$80,d1
  44577. btst #0,status(a0)
  44578. beq.s +
  44579. neg.w d0
  44580. add.w d1,d0
  44581. +
  44582. move.w objoff_32(a0),d1
  44583. sub.w d0,d1
  44584. move.w d1,y_pos(a0)
  44585. rts
  44586.  
  44587. ; ===========================================================================
  44588. ; loc_22166:
  44589. Obj19_MoveRoutine4:
  44590. move.b status(a0),d0
  44591. andi.b #standing_mask,d0
  44592. beq.s + ; rts
  44593. addq.b #1,subtype(a0)
  44594. + rts
  44595.  
  44596. ; ===========================================================================
  44597. ; loc_22176:
  44598. Obj19_MoveRoutine5:
  44599. jsrto (ObjectMove).l, JmpTo5_ObjectMove
  44600. moveq #8,d1
  44601. move.w objoff_32(a0),d0
  44602. subi.w #$60,d0
  44603. cmp.w y_pos(a0),d0
  44604. bhs.s +
  44605. neg.w d1
  44606. +
  44607. add.w d1,y_vel(a0)
  44608. bne.s Obj19_MoveRoutineNull
  44609. addq.b #1,subtype(a0)
  44610.  
  44611. ; return_22196:
  44612. Obj19_MoveRoutineNull:
  44613. rts
  44614.  
  44615. ; ===========================================================================
  44616. ; loc_22198:
  44617. Obj19_MoveRoutine6:
  44618. jsrto (ObjectMove).l, JmpTo5_ObjectMove
  44619. moveq #8,d1
  44620. move.w objoff_32(a0),d0
  44621. subi.w #$60,d0
  44622. cmp.w y_pos(a0),d0
  44623. bhs.s +
  44624. neg.w d1
  44625. +
  44626. add.w d1,y_vel(a0)
  44627. rts
  44628.  
  44629. ; ===========================================================================
  44630. ; loc_221B4:
  44631. Obj19_MoveRoutine7:
  44632. move.b (Oscillating_Data+$38).w,d1
  44633. subi.b #$40,d1
  44634. ext.w d1
  44635. move.b (Oscillating_Data+$3C).w,d2
  44636. subi.b #$40,d2
  44637. ext.w d2
  44638. btst #2,d0
  44639. beq.s +
  44640. neg.w d1
  44641. neg.w d2
  44642. +
  44643. btst #1,d0
  44644. beq.s +
  44645. neg.w d1
  44646. exg d1,d2
  44647. +
  44648. add.w objoff_30(a0),d1
  44649. move.w d1,x_pos(a0)
  44650. add.w objoff_32(a0),d2
  44651. move.w d2,y_pos(a0)
  44652. rts
  44653.  
  44654. ; ===========================================================================
  44655. ; loc_221EE:
  44656. Obj19_MoveRoutine8:
  44657. move.b (Oscillating_Data+$38).w,d1
  44658. subi.b #$40,d1
  44659. ext.w d1
  44660. move.b (Oscillating_Data+$3C).w,d2
  44661. subi.b #$40,d2
  44662. ext.w d2
  44663. btst #2,d0
  44664. beq.s +
  44665. neg.w d1
  44666. neg.w d2
  44667. +
  44668. btst #1,d0
  44669. beq.s +
  44670. neg.w d1
  44671. exg d1,d2
  44672. +
  44673. neg.w d1
  44674. add.w objoff_30(a0),d1
  44675. move.w d1,x_pos(a0)
  44676. add.w objoff_32(a0),d2
  44677. move.w d2,y_pos(a0)
  44678. rts
  44679. ; ===========================================================================
  44680. ; -------------------------------------------------------------------------------
  44681. ; sprite mappings
  44682. ; -------------------------------------------------------------------------------
  44683. Obj19_MapUnc_2222A: BINCLUDE "mappings/sprite/obj19.bin"
  44684. ; ===========================================================================
  44685.  
  44686. if gameRevision<2
  44687. nop
  44688. endif
  44689.  
  44690. if ~~removeJmpTos
  44691. JmpTo11_DisplaySprite
  44692. jmp (DisplaySprite).l
  44693. JmpTo20_DeleteObject
  44694. jmp (DeleteObject).l
  44695. JmpTo15_Adjust2PArtPointer
  44696. jmp (Adjust2PArtPointer).l
  44697. JmpTo4_PlatformObject
  44698. jmp (PlatformObject).l
  44699. ; loc_222A4:
  44700. JmpTo5_ObjectMove
  44701. jmp (ObjectMove).l
  44702.  
  44703. align 4
  44704. else
  44705. JmpTo20_DeleteObject
  44706. jmp (DeleteObject).l
  44707. endif
  44708.  
  44709.  
  44710.  
  44711.  
  44712. ; ===========================================================================
  44713. ; ----------------------------------------------------------------------------
  44714. ; Object 1B - Speed booster from CPZ
  44715. ; ----------------------------------------------------------------------------
  44716. speedbooster_boostspeed = objoff_30
  44717. ; Sprite_222AC:
  44718. Obj1B:
  44719. moveq #0,d0
  44720. move.b routine(a0),d0
  44721. move.w Obj1B_Index(pc,d0.w),d1
  44722. jmp Obj1B_Index(pc,d1.w)
  44723. ; ===========================================================================
  44724. ; off_222BA:
  44725. Obj1B_Index: offsetTable
  44726. offsetTableEntry.w Obj1B_Init ; 0
  44727. offsetTableEntry.w Obj1B_Main ; 2
  44728. ; ---------------------------------------------------------------------------
  44729. ; word_222BE:
  44730. Obj1B_BoosterSpeeds:
  44731. dc.w $1000
  44732. dc.w $A00
  44733. ; ===========================================================================
  44734. ; loc_222C2:
  44735. Obj1B_Init:
  44736. addq.b #2,routine(a0) ; => Obj1B_Main
  44737. move.l #Obj1B_MapUnc_223E2,mappings(a0)
  44738. move.w #make_art_tile(ArtTile_ArtNem_CPZBooster,3,1),art_tile(a0)
  44739. jsrto (Adjust2PArtPointer).l, JmpTo16_Adjust2PArtPointer
  44740. ori.b #4,render_flags(a0)
  44741. move.b #$20,width_pixels(a0)
  44742. move.b #1,priority(a0)
  44743. move.b subtype(a0),d0
  44744. andi.w #2,d0
  44745. move.w Obj1B_BoosterSpeeds(pc,d0.w),speedbooster_boostspeed(a0)
  44746.  
  44747. ; loc_222F8:
  44748. Obj1B_Main:
  44749. move.b (Timer_frames+1).w,d0
  44750. andi.b #2,d0
  44751. move.b d0,mapping_frame(a0)
  44752. move.w x_pos(a0),d0
  44753. move.w d0,d1
  44754. subi.w #$10,d0
  44755. addi.w #$10,d1
  44756. move.w y_pos(a0),d2
  44757. move.w d2,d3
  44758. subi.w #$10,d2
  44759. addi.w #$10,d3
  44760.  
  44761. lea (MainCharacter).w,a1 ; a1=character
  44762. btst #1,status(a1)
  44763. bne.s +
  44764. move.w x_pos(a1),d4
  44765. cmp.w d0,d4
  44766. blo.w +
  44767. cmp.w d1,d4
  44768. bhs.w +
  44769. move.w y_pos(a1),d4
  44770. cmp.w d2,d4
  44771. blo.w +
  44772. cmp.w d3,d4
  44773. bhs.w +
  44774. move.w d0,-(sp)
  44775. bsr.w Obj1B_GiveBoost
  44776. move.w (sp)+,d0
  44777. +
  44778. lea (Sidekick).w,a1 ; a1=character
  44779. btst #1,status(a1)
  44780. bne.s +
  44781. move.w x_pos(a1),d4
  44782. cmp.w d0,d4
  44783. blo.w +
  44784. cmp.w d1,d4
  44785. bhs.w +
  44786. move.w y_pos(a1),d4
  44787. cmp.w d2,d4
  44788. blo.w +
  44789. cmp.w d3,d4
  44790. bhs.w +
  44791. bsr.w Obj1B_GiveBoost
  44792. +
  44793. jmpto (MarkObjGone).l, JmpTo6_MarkObjGone
  44794.  
  44795. ; ===========================================================================
  44796. ; sub_22388:
  44797. Obj1B_GiveBoost:
  44798. move.w x_vel(a1),d0
  44799. btst #0,status(a0)
  44800. beq.s +
  44801. neg.w d0 ; d0 = absolute value of character's x velocity
  44802. +
  44803. cmpi.w #$1000,d0 ; is the character already going super fast?
  44804. bge.s Obj1B_GiveBoost_Done ; if yes, branch to not change the speed
  44805. move.w speedbooster_boostspeed(a0),x_vel(a1) ; make the character go super fast
  44806. bclr #0,status(a1) ; turn him right
  44807. btst #0,status(a0) ; was that the correct direction?
  44808. beq.s + ; if yes, branch
  44809. bset #0,status(a1) ; turn him left
  44810. neg.w x_vel(a1) ; make the boosting direction left
  44811. +
  44812. move.w #$F,move_lock(a1) ; don't let him turn around for a few frames
  44813. move.w x_vel(a1),inertia(a1) ; update his inertia value
  44814. bclr #5,status(a0)
  44815. bclr #6,status(a0)
  44816. bclr #5,status(a1)
  44817. ; loc_223D8:
  44818. Obj1B_GiveBoost_Done:
  44819. move.w #SndID_Spring,d0 ; spring boing sound
  44820. jmp (PlaySound).l
  44821. ; ===========================================================================
  44822. ; -------------------------------------------------------------------------------
  44823. ; sprite mappings
  44824. ; -------------------------------------------------------------------------------
  44825. Obj1B_MapUnc_223E2: BINCLUDE "mappings/sprite/obj1B.bin"
  44826. ; ===========================================================================
  44827.  
  44828. if ~~removeJmpTos
  44829. JmpTo6_MarkObjGone
  44830. jmp (MarkObjGone).l
  44831. JmpTo16_Adjust2PArtPointer
  44832. jmp (Adjust2PArtPointer).l
  44833.  
  44834. align 4
  44835. endif
  44836.  
  44837.  
  44838.  
  44839.  
  44840. ; ===========================================================================
  44841. ; ----------------------------------------------------------------------------
  44842. ; Object 1D - Blue balls in CPZ
  44843. ; ----------------------------------------------------------------------------
  44844. ; Sprite_22408:
  44845. Obj1D:
  44846. moveq #0,d0
  44847. move.b routine(a0),d0
  44848. move.w Obj1D_Index(pc,d0.w),d1
  44849. jmp Obj1D_Index(pc,d1.w)
  44850. ; ===========================================================================
  44851. ; off_22416: Obj1D_States:
  44852. Obj1D_Index: offsetTable
  44853. offsetTableEntry.w Obj1D_Init ; 0
  44854. offsetTableEntry.w Obj1D_Wait ; 2
  44855. offsetTableEntry.w Obj1D_MoveArc ; 4
  44856. offsetTableEntry.w Obj1D_Wait ; 6
  44857. offsetTableEntry.w Obj1D_MoveStraight ; 8
  44858. ; ---------------------------------------------------------------------------
  44859. ; unused table of speed values
  44860. ; word_22420:
  44861. dc.w -$480
  44862. dc.w -$500
  44863. dc.w -$600
  44864. dc.w -$700
  44865. ; ===========================================================================
  44866. ; loc_22428:
  44867. Obj1D_Init:
  44868. addq.b #2,routine(a0) ; => Obj1D_Wait
  44869. move.w #-$480,y_vel(a0)
  44870. moveq #0,d1
  44871. move.b subtype(a0),d1
  44872. move.b d1,d0
  44873. andi.b #$F,d1 ; number of blue balls
  44874. moveq #2,d5 ; routine number
  44875. andi.b #$F0,d0
  44876. beq.s +
  44877. moveq #6,d5 ; routine number
  44878. +
  44879. move.b status(a0),d4
  44880. moveq #0,d2
  44881. movea.l a0,a1
  44882. bra.s Obj1D_InitBall
  44883. ; ---------------------------------------------------------------------------
  44884. Obj1D_LoadBall:
  44885. jsrto (SingleObjLoad2).l, JmpTo5_SingleObjLoad2
  44886. bne.s ++
  44887. ; loc_22458:
  44888. Obj1D_InitBall:
  44889. _move.b id(a0),id(a1) ; load obj1D
  44890. move.b d5,routine(a1) ; => Obj1D_Wait (either one)
  44891. move.w x_pos(a0),x_pos(a1)
  44892. move.w y_pos(a0),y_pos(a1)
  44893. move.l #Obj1D_MapUnc_22576,mappings(a1)
  44894. move.w #make_art_tile(ArtTile_ArtNem_CPZDroplet,3,0),art_tile(a1)
  44895. jsrto (Adjust2PArtPointer2).l, JmpTo3_Adjust2PArtPointer2
  44896. move.b #4,render_flags(a1)
  44897. move.b #3,priority(a1)
  44898. move.b #%10001011,collision_flags(a1)
  44899. move.w x_pos(a1),objoff_38(a1)
  44900. move.w y_pos(a1),objoff_30(a1)
  44901. move.w y_vel(a0),y_vel(a1)
  44902. move.w y_vel(a1),objoff_34(a1)
  44903. move.b #8,width_pixels(a1)
  44904. move.w #$60,objoff_3A(a1)
  44905. move.w #$B,objoff_36(a1)
  44906. andi.b #1,d4
  44907. beq.s +
  44908. neg.w objoff_36(a1)
  44909. neg.w objoff_3A(a1)
  44910. +
  44911. move.w d2,objoff_32(a1)
  44912. addq.w #3,d2
  44913. +
  44914. dbf d1,Obj1D_LoadBall
  44915. rts
  44916. ; ===========================================================================
  44917. ; loc_224D6:
  44918. Obj1D_Wait:
  44919. subq.w #1,objoff_32(a0)
  44920. bpl.s BranchTo_JmpTo7_MarkObjGone
  44921. addq.b #2,routine(a0) ; => Obj1D_MoveArc or Obj1D_MoveStraight
  44922. move.w #$3B,objoff_32(a0)
  44923. move.w #SndID_Gloop,d0
  44924. jsr (PlaySoundLocal).l
  44925.  
  44926. BranchTo_JmpTo7_MarkObjGone
  44927. jmpto (MarkObjGone).l, JmpTo7_MarkObjGone
  44928. ; ===========================================================================
  44929. ; loc_224F4:
  44930. Obj1D_MoveArc:
  44931. jsrto (ObjectMove).l, JmpTo6_ObjectMove
  44932. move.w objoff_36(a0),d0
  44933. add.w d0,x_vel(a0)
  44934. addi.w #$18,y_vel(a0)
  44935. bne.s +
  44936. neg.w objoff_36(a0)
  44937. +
  44938. move.w objoff_30(a0),d0
  44939. cmp.w y_pos(a0),d0
  44940. bhi.s BranchTo2_JmpTo7_MarkObjGone
  44941. move.w objoff_34(a0),y_vel(a0)
  44942. clr.w x_vel(a0)
  44943. subq.b #2,routine(a0) ; => Obj1D_Wait
  44944.  
  44945. BranchTo2_JmpTo7_MarkObjGone
  44946. jmpto (MarkObjGone).l, JmpTo7_MarkObjGone
  44947. ; ===========================================================================
  44948. ; loc_22528:
  44949. Obj1D_MoveStraight:
  44950. jsrto (ObjectMove).l, JmpTo6_ObjectMove
  44951. addi.w #$18,y_vel(a0)
  44952. bne.s +
  44953. move.w objoff_3A(a0),d0
  44954. add.w objoff_38(a0),d0
  44955. move.w d0,x_pos(a0)
  44956. +
  44957. cmpi.w #$180,y_vel(a0)
  44958. bne.s +
  44959. move.w #SndID_Gloop,d0
  44960. jsr (PlaySoundLocal).l
  44961. +
  44962. move.w objoff_30(a0),d0
  44963. cmp.w y_pos(a0),d0
  44964. bhi.s BranchTo3_JmpTo7_MarkObjGone
  44965. move.w objoff_34(a0),y_vel(a0)
  44966. move.w objoff_38(a0),x_pos(a0)
  44967. move.w #SndID_Gloop,d0
  44968. jsr (PlaySoundLocal).l
  44969.  
  44970. BranchTo3_JmpTo7_MarkObjGone
  44971. jmpto (MarkObjGone).l, JmpTo7_MarkObjGone
  44972. ; ===========================================================================
  44973. ; -------------------------------------------------------------------------------
  44974. ; sprite mappings
  44975. ; -------------------------------------------------------------------------------
  44976. Obj1D_MapUnc_22576: BINCLUDE "mappings/sprite/obj1D.bin"
  44977. ; ===========================================================================
  44978.  
  44979. if gameRevision<2
  44980. nop
  44981. endif
  44982.  
  44983. if ~~removeJmpTos
  44984. JmpTo7_MarkObjGone
  44985. jmp (MarkObjGone).l
  44986. JmpTo5_SingleObjLoad2
  44987. jmp (SingleObjLoad2).l
  44988. JmpTo3_Adjust2PArtPointer2
  44989. jmp (Adjust2PArtPointer2).l
  44990. ; loc_22596:
  44991. JmpTo6_ObjectMove
  44992. jmp (ObjectMove).l
  44993.  
  44994. align 4
  44995. endif
  44996.  
  44997.  
  44998.  
  44999.  
  45000. ; ===========================================================================
  45001. ; ----------------------------------------------------------------------------
  45002. ; Object 1E - Spin tube from CPZ
  45003. ; ----------------------------------------------------------------------------
  45004. ; Sprite_2259C:
  45005. Obj1E:
  45006. moveq #0,d0
  45007. move.b routine(a0),d0
  45008. move.w Obj1E_Index(pc,d0.w),d1
  45009. jsr Obj1E_Index(pc,d1.w)
  45010. move.b objoff_2C(a0),d0
  45011. add.b objoff_36(a0),d0
  45012. beq.w JmpTo_MarkObjGone3
  45013. rts
  45014.  
  45015. if removeJmpTos
  45016. JmpTo_MarkObjGone3
  45017. jmp (MarkObjGone3).l
  45018. endif
  45019. ; ===========================================================================
  45020. ; JmpTbl_225B8: Obj1E_States:
  45021. Obj1E_Index: offsetTable
  45022. offsetTableEntry.w Obj1E_Init ; 0
  45023. offsetTableEntry.w Obj1E_Main ; 2
  45024. ; ===========================================================================
  45025. word_225BC:
  45026. dc.w $A0 ; 0
  45027. dc.w $100 ; 2
  45028. dc.w $120 ; 4
  45029. ; ===========================================================================
  45030. ; loc_225C2: LoadSubtype_1E:
  45031. Obj1E_Init:
  45032. addq.b #2,routine(a0)
  45033. move.b subtype(a0),d0
  45034. add.w d0,d0
  45035. andi.w #6,d0
  45036. move.w word_225BC(pc,d0.w),objoff_2A(a0)
  45037. ; loc_225D6:
  45038. Obj1E_Main:
  45039. lea (MainCharacter).w,a1 ; a1=character
  45040. lea objoff_2C(a0),a4
  45041. bsr.s +
  45042. lea (Sidekick).w,a1 ; a1=character
  45043. lea objoff_36(a0),a4
  45044. +
  45045. moveq #0,d0
  45046. move.b (a4),d0
  45047. move.w Obj1E_Modes(pc,d0.w),d0
  45048. jmp Obj1E_Modes(pc,d0.w)
  45049. ; ===========================================================================
  45050. ; off_225F4:
  45051. Obj1E_Modes: offsetTable
  45052. offsetTableEntry.w loc_225FC ; 0
  45053. offsetTableEntry.w loc_2271A ; 2
  45054. offsetTableEntry.w loc_227FE ; 4
  45055. offsetTableEntry.w loc_2286A ; 6
  45056. ; ===========================================================================
  45057.  
  45058. loc_225FC:
  45059. tst.w (Debug_placement_mode).w
  45060. bne.w return_22718
  45061. move.w objoff_2A(a0),d2
  45062. move.w x_pos(a1),d0
  45063. sub.w x_pos(a0),d0
  45064. cmp.w d2,d0
  45065. bhs.w return_22718
  45066. move.w y_pos(a1),d1
  45067. sub.w y_pos(a0),d1
  45068. cmpi.w #$80,d1
  45069. bhs.w return_22718
  45070. cmpi.b #$20,anim(a1)
  45071. beq.w return_22718
  45072.  
  45073. moveq #0,d3
  45074. cmpi.w #$A0,d2
  45075. beq.s +
  45076. moveq #8,d3
  45077. cmpi.w #$120,d2
  45078. beq.s +
  45079. moveq #4,d3
  45080. neg.w d0
  45081. addi.w #$100,d0
  45082. +
  45083. cmpi.w #$80,d0
  45084. blo.s loc_2267E
  45085. moveq #0,d2
  45086. move.b subtype(a0),d0
  45087. lsr.w #2,d0
  45088. andi.w #$F,d0
  45089. move.b byte_2266E(pc,d0.w),d2
  45090. cmpi.b #2,d2
  45091. bne.s loc_22688
  45092. move.b (Timer_second).w,d2
  45093. andi.b #1,d2
  45094. bra.s loc_22688
  45095. ; ===========================================================================
  45096. byte_2266E:
  45097. dc.b 2
  45098. dc.b 2 ; 1
  45099. dc.b 2 ; 2
  45100. dc.b 2 ; 3
  45101. dc.b 2 ; 4
  45102. dc.b 2 ; 5
  45103. dc.b 2 ; 6
  45104. dc.b 2 ; 7
  45105. dc.b 2 ; 8
  45106. dc.b 2 ; 9
  45107. dc.b 0 ; 10
  45108. dc.b 2 ; 11
  45109. dc.b 0 ; 12
  45110. dc.b 1 ; 13
  45111. dc.b 2 ; 14
  45112. dc.b 1 ; 15
  45113. ; ===========================================================================
  45114.  
  45115. loc_2267E:
  45116. moveq #2,d2
  45117. cmpi.w #$40,d1
  45118. bhs.s loc_22688
  45119. moveq #3,d2
  45120.  
  45121. loc_22688:
  45122. move.b d2,1(a4)
  45123. add.w d3,d2
  45124. add.w d2,d2
  45125. andi.w #$1E,d2
  45126. lea off_22980(pc),a2
  45127. adda.w (a2,d2.w),a2
  45128. move.w (a2)+,4(a4)
  45129. subq.w #4,4(a4)
  45130. move.w (a2)+,d4
  45131. add.w x_pos(a0),d4
  45132. move.w d4,x_pos(a1)
  45133. move.w (a2)+,d5
  45134. add.w y_pos(a0),d5
  45135. move.w d5,y_pos(a1)
  45136. move.l a2,6(a4)
  45137. move.w (a2)+,d4
  45138. add.w x_pos(a0),d4
  45139. move.w (a2)+,d5
  45140. add.w y_pos(a0),d5
  45141. addq.b #2,(a4)
  45142. move.b #$81,obj_control(a1)
  45143. move.b #AniIDSonAni_Roll,anim(a1)
  45144. move.w #$800,inertia(a1)
  45145. move.w #0,x_vel(a1)
  45146. move.w #0,y_vel(a1)
  45147. bclr #5,status(a0)
  45148. bclr #5,status(a1)
  45149. bset #1,status(a1)
  45150. move.b #0,jumping(a1)
  45151. bclr #high_priority_bit,art_tile(a1)
  45152. move.w #$800,d2
  45153. bsr.w loc_22902
  45154. move.w #SndID_Roll,d0
  45155. jsr (PlaySound).l
  45156.  
  45157. return_22718:
  45158. rts
  45159. ; ===========================================================================
  45160.  
  45161. loc_2271A:
  45162. subq.b #1,2(a4)
  45163. bpl.s Obj1E_MoveCharacter
  45164. movea.l 6(a4),a2
  45165. move.w (a2)+,d4
  45166. add.w x_pos(a0),d4
  45167. move.w d4,x_pos(a1)
  45168. move.w (a2)+,d5
  45169. add.w y_pos(a0),d5
  45170. move.w d5,y_pos(a1)
  45171. tst.b 1(a4)
  45172. bpl.s +
  45173. subq.w #8,a2
  45174. +
  45175. move.l a2,6(a4)
  45176. subq.w #4,4(a4)
  45177. beq.s loc_22784
  45178. move.w (a2)+,d4
  45179. add.w x_pos(a0),d4
  45180. move.w (a2)+,d5
  45181. add.w y_pos(a0),d5
  45182. move.w #$800,d2
  45183. bra.w loc_22902
  45184. ; ===========================================================================
  45185. ; update the position of Sonic/Tails in the CPZ tube
  45186. ; loc_2275E:
  45187. Obj1E_MoveCharacter:
  45188. move.l x_pos(a1),d2
  45189. move.l y_pos(a1),d3
  45190. move.w x_vel(a1),d0
  45191. ext.l d0
  45192. asl.l #8,d0
  45193. add.l d0,d2
  45194. move.w y_vel(a1),d0
  45195. ext.l d0
  45196. asl.l #8,d0
  45197. add.l d0,d3
  45198. move.l d2,x_pos(a1)
  45199. move.l d3,y_pos(a1)
  45200. rts
  45201. ; ===========================================================================
  45202.  
  45203. loc_22784:
  45204. cmpi.b #4,1(a4)
  45205. bhs.s loc_227A6
  45206. move.b subtype(a0),d0
  45207. andi.w #$FC,d0
  45208. add.b 1(a4),d0
  45209. move.b #4,1(a4)
  45210. move.b byte_227BE(pc,d0.w),d0
  45211. bne.w loc_22892
  45212.  
  45213. loc_227A6:
  45214. andi.w #$7FF,y_pos(a1)
  45215. move.b #6,(a4)
  45216. clr.b obj_control(a1)
  45217. move.w #SndID_SpindashRelease,d0
  45218. jmp (PlaySound).l
  45219. ; ===========================================================================
  45220. byte_227BE:
  45221. dc.b 2, 1, 0, 0
  45222. dc.b -1, 3, 0, 0
  45223. dc.b 4, -2, 0, 0
  45224. dc.b -3, -4, 0, 0
  45225. dc.b -5, -5, 0, 0
  45226. dc.b 7, 6, 0, 0
  45227. dc.b -7, -6, 0, 0
  45228. dc.b 8, 9, 0, 0
  45229. dc.b -8, -9, 0, 0
  45230. dc.b 11, 10, 0, 0
  45231. dc.b 12, 0, 0, 0
  45232. dc.b -11,-10, 0, 0
  45233. dc.b -12, 0, 0, 0
  45234. dc.b 0, 13, 0, 0
  45235. dc.b -13, 14, 0, 0
  45236. dc.b 0,-14, 0, 0
  45237. ; ===========================================================================
  45238.  
  45239. loc_227FE:
  45240. subq.b #1,2(a4)
  45241. bpl.s Obj1E_MoveCharacter_2
  45242. movea.l 6(a4),a2
  45243. move.w (a2)+,d4
  45244. move.w d4,x_pos(a1)
  45245. move.w (a2)+,d5
  45246. move.w d5,y_pos(a1)
  45247. tst.b 1(a4)
  45248. bpl.s loc_2281C
  45249. subq.w #8,a2
  45250.  
  45251. loc_2281C:
  45252. move.l a2,6(a4)
  45253. subq.w #4,4(a4)
  45254. beq.s loc_22858
  45255. move.w (a2)+,d4
  45256. move.w (a2)+,d5
  45257. move.w #$800,d2
  45258. bra.w loc_22902
  45259. ; ===========================================================================
  45260. ; update the position of Sonic/Tails in the CPZ tube
  45261. ; loc_22832:
  45262. Obj1E_MoveCharacter_2:
  45263. move.l x_pos(a1),d2
  45264. move.l y_pos(a1),d3
  45265. move.w x_vel(a1),d0
  45266. ext.l d0
  45267. asl.l #8,d0
  45268. add.l d0,d2
  45269. move.w y_vel(a1),d0
  45270. ext.l d0
  45271. asl.l #8,d0
  45272. add.l d0,d3
  45273. move.l d2,x_pos(a1)
  45274. move.l d3,y_pos(a1)
  45275. rts
  45276. ; ===========================================================================
  45277.  
  45278. loc_22858:
  45279. andi.w #$7FF,y_pos(a1)
  45280. clr.b (a4)
  45281. move.w #SndID_SpindashRelease,d0
  45282. jmp (PlaySound).l
  45283. ; ===========================================================================
  45284.  
  45285. loc_2286A:
  45286. move.w objoff_2A(a0),d2
  45287. move.w x_pos(a1),d0
  45288. sub.w x_pos(a0),d0
  45289. cmp.w d2,d0
  45290. bhs.w loc_2288E
  45291. move.w y_pos(a1),d1
  45292. sub.w y_pos(a0),d1
  45293. cmpi.w #$80,d1
  45294. bhs.w loc_2288E
  45295. rts
  45296. ; ===========================================================================
  45297.  
  45298. loc_2288E:
  45299. clr.b (a4)
  45300. rts
  45301. ; ===========================================================================
  45302.  
  45303. loc_22892:
  45304. bpl.s loc_228C4
  45305. neg.b d0
  45306. move.b #-4,1(a4)
  45307. add.w d0,d0
  45308. lea (off_22E88).l,a2
  45309. adda.w (a2,d0.w),a2
  45310. move.w (a2)+,d0
  45311. subq.w #4,d0
  45312. move.w d0,4(a4)
  45313. lea (a2,d0.w),a2
  45314. move.w (a2)+,d4
  45315. move.w d4,x_pos(a1)
  45316. move.w (a2)+,d5
  45317. move.w d5,y_pos(a1)
  45318. subq.w #8,a2
  45319. bra.s loc_228E4
  45320. ; ===========================================================================
  45321.  
  45322. loc_228C4:
  45323. add.w d0,d0
  45324. lea (off_22E88).l,a2
  45325. adda.w (a2,d0.w),a2
  45326. move.w (a2)+,4(a4)
  45327. subq.w #4,4(a4)
  45328. move.w (a2)+,d4
  45329. move.w d4,x_pos(a1)
  45330. move.w (a2)+,d5
  45331. move.w d5,y_pos(a1)
  45332.  
  45333. loc_228E4:
  45334. move.l a2,6(a4)
  45335. move.w (a2)+,d4
  45336. move.w (a2)+,d5
  45337. move.w #$800,d2
  45338. bsr.w loc_22902
  45339. move.w #SndID_Roll,d0
  45340. jsr (PlaySound).l
  45341. addq.b #2,(a4)
  45342. rts
  45343. ; ===========================================================================
  45344.  
  45345. loc_22902:
  45346. moveq #0,d0
  45347. move.w d2,d3
  45348. move.w d4,d0
  45349. sub.w x_pos(a1),d0
  45350. bge.s +
  45351. neg.w d0
  45352. neg.w d2
  45353. +
  45354. moveq #0,d1
  45355. move.w d5,d1
  45356. sub.w y_pos(a1),d1
  45357. bge.s +
  45358. neg.w d1
  45359. neg.w d3
  45360. +
  45361. cmp.w d0,d1
  45362. blo.s loc_22952
  45363. moveq #0,d1
  45364. move.w d5,d1
  45365. sub.w y_pos(a1),d1
  45366. swap d1
  45367. divs.w d3,d1
  45368. moveq #0,d0
  45369. move.w d4,d0
  45370. sub.w x_pos(a1),d0
  45371. beq.s +
  45372. swap d0
  45373. divs.w d1,d0
  45374. +
  45375. move.w d0,x_vel(a1)
  45376. move.w d3,y_vel(a1)
  45377. abs.w d1
  45378. move.w d1,2(a4)
  45379. rts
  45380. ; ===========================================================================
  45381.  
  45382. loc_22952:
  45383. moveq #0,d0
  45384. move.w d4,d0
  45385. sub.w x_pos(a1),d0
  45386. swap d0
  45387. divs.w d2,d0
  45388. moveq #0,d1
  45389. move.w d5,d1
  45390. sub.w y_pos(a1),d1
  45391. beq.s +
  45392. swap d1
  45393. divs.w d0,d1
  45394. +
  45395. move.w d1,y_vel(a1)
  45396. move.w d2,x_vel(a1)
  45397. abs.w d0
  45398. move.w d0,2(a4)
  45399. rts
  45400. ; ===========================================================================
  45401. obj1E67Size macro {INTLABEL}
  45402. __LABEL__ label *
  45403. dc.w __LABEL___End-__LABEL__-2
  45404. endm
  45405. ; -------------------------------------------------------------------------------
  45406. ; spin tube data - entry/exit
  45407. ; -------------------------------------------------------------------------------
  45408. ; off_22980:
  45409. include "misc/obj1E_a.asm"
  45410. ; -------------------------------------------------------------------------------
  45411. ; spin tube data - main tube
  45412. ; -------------------------------------------------------------------------------
  45413. ; off_22E88:
  45414. include "misc/obj1E_b.asm"
  45415. ; ===========================================================================
  45416.  
  45417. if gameRevision<2
  45418. nop
  45419. endif
  45420.  
  45421. if ~~removeJmpTos
  45422. JmpTo_MarkObjGone3
  45423. jmp (MarkObjGone3).l
  45424.  
  45425. align 4
  45426. endif
  45427.  
  45428.  
  45429.  
  45430.  
  45431. ; ===========================================================================
  45432. ; ----------------------------------------------------------------------------
  45433. ; Object 20 - Lava bubble from Hill Top Zone (boss weapon)
  45434. ; ----------------------------------------------------------------------------
  45435. ; Sprite_22FF8:
  45436. Obj20:
  45437. moveq #0,d0
  45438. move.b routine(a0),d0
  45439. move.w Obj20_Index(pc,d0.w),d1
  45440. jmp Obj20_Index(pc,d1.w)
  45441. ; ===========================================================================
  45442. ; off_23006:
  45443. Obj20_Index: offsetTable
  45444. offsetTableEntry.w Obj20_Init ; 0
  45445. offsetTableEntry.w loc_23076 ; 2
  45446. offsetTableEntry.w loc_23084 ; 4
  45447. offsetTableEntry.w loc_2311E ; 6
  45448. offsetTableEntry.w loc_23144 ; 8
  45449. offsetTableEntry.w loc_231D2 ; $A
  45450. offsetTableEntry.w BranchTo_JmpTo21_DeleteObject ; $C
  45451. ; ===========================================================================
  45452. ; loc_23014:
  45453. Obj20_Init:
  45454. addq.b #2,routine(a0)
  45455. move.b #8,y_radius(a0)
  45456. move.b #8,x_radius(a0)
  45457. move.l #Obj20_MapUnc_23254,mappings(a0)
  45458. move.w #make_art_tile(ArtTile_ArtNem_HtzFireball,0,1),art_tile(a0)
  45459. jsrto (Adjust2PArtPointer).l, JmpTo17_Adjust2PArtPointer
  45460. ori.b #4,render_flags(a0)
  45461. move.b #3,priority(a0)
  45462. move.b #8,width_pixels(a0)
  45463. move.w y_pos(a0),objoff_30(a0)
  45464. moveq #0,d0
  45465. move.b subtype(a0),d0
  45466. lsl.w #3,d0
  45467. andi.w #$780,d0
  45468. neg.w d0
  45469. move.w d0,x_vel(a0)
  45470. move.w d0,y_vel(a0)
  45471. move.b subtype(a0),d0
  45472. andi.w #$F,d0
  45473. lsl.w #4,d0
  45474. move.w d0,objoff_32(a0)
  45475. move.w d0,objoff_34(a0)
  45476.  
  45477. loc_23076:
  45478. lea (Ani_obj20).l,a1
  45479. jsrto (AnimateSprite).l, JmpTo4_AnimateSprite
  45480. jmpto (MarkObjGone).l, JmpTo8_MarkObjGone
  45481. ; ===========================================================================
  45482.  
  45483. loc_23084:
  45484. cmpi.b #5,anim_frame_duration(a0)
  45485. bne.s loc_230B4
  45486. jsrto (SingleObjLoad2).l, JmpTo6_SingleObjLoad2
  45487. bne.s loc_230A6
  45488. bsr.s loc_230C2
  45489. jsrto (SingleObjLoad2).l, JmpTo6_SingleObjLoad2
  45490. bne.s loc_230A6
  45491. bsr.s loc_230C2
  45492. neg.w x_vel(a1)
  45493. bset #0,render_flags(a1)
  45494.  
  45495. loc_230A6:
  45496. move.w #SndID_ArrowFiring,d0
  45497. jsr (PlaySound).l
  45498. addq.b #2,routine(a0)
  45499.  
  45500. loc_230B4:
  45501. lea (Ani_obj20).l,a1
  45502. jsrto (AnimateSprite).l, JmpTo4_AnimateSprite
  45503. jmpto (MarkObjGone).l, JmpTo8_MarkObjGone
  45504. ; ===========================================================================
  45505.  
  45506. loc_230C2:
  45507. _move.b #ObjID_LavaBubble,id(a1) ; load obj20
  45508. move.b #8,routine(a1)
  45509. move.w x_pos(a0),x_pos(a1)
  45510. move.w y_pos(a0),y_pos(a1)
  45511. move.w x_vel(a0),x_vel(a1)
  45512. move.w y_vel(a0),y_vel(a1)
  45513. move.b #8,y_radius(a1)
  45514. move.b #8,x_radius(a1)
  45515. move.l mappings(a0),mappings(a1)
  45516. move.w art_tile(a0),art_tile(a1)
  45517. ori.b #4,render_flags(a1)
  45518. move.b #3,priority(a1)
  45519. move.b #8,width_pixels(a1)
  45520. move.b #$8B,collision_flags(a1)
  45521. move.w y_pos(a1),objoff_30(a1)
  45522. rts
  45523. ; ===========================================================================
  45524.  
  45525. loc_2311E:
  45526. subq.w #1,objoff_32(a0)
  45527. bpl.s loc_23136
  45528. move.w objoff_34(a0),objoff_32(a0)
  45529. move.b #2,routine(a0)
  45530. move.w #1,anim(a0)
  45531.  
  45532. loc_23136:
  45533. lea (Ani_obj20).l,a1
  45534. jsrto (AnimateSprite).l, JmpTo4_AnimateSprite
  45535. jmpto (MarkObjGone).l, JmpTo8_MarkObjGone
  45536. ; ===========================================================================
  45537.  
  45538. loc_23144:
  45539. subq.b #1,anim_frame_duration(a0)
  45540. bpl.s loc_2315A
  45541. move.b #7,anim_frame_duration(a0)
  45542. addq.b #1,mapping_frame(a0)
  45543. andi.b #1,mapping_frame(a0)
  45544.  
  45545. loc_2315A:
  45546. jsrto (ObjectMove).l, JmpTo7_ObjectMove
  45547. addi.w #$18,y_vel(a0)
  45548. move.w (Camera_Max_Y_pos_now).w,d0
  45549. addi.w #$E0,d0
  45550. cmp.w y_pos(a0),d0
  45551. bhs.s loc_23176
  45552. jmpto (DeleteObject).l, JmpTo21_DeleteObject
  45553. ; ===========================================================================
  45554.  
  45555. loc_23176:
  45556. bclr #1,render_flags(a0)
  45557. tst.w y_vel(a0)
  45558. bmi.s BranchTo_JmpTo8_MarkObjGone
  45559. bset #1,render_flags(a0)
  45560. bsr.w ObjCheckFloorDist
  45561. tst.w d1
  45562. bpl.s BranchTo_JmpTo8_MarkObjGone
  45563. add.w d1,y_pos(a0)
  45564. addq.b #2,routine(a0)
  45565. move.b #2,anim(a0)
  45566. move.b #4,mapping_frame(a0)
  45567. move.w #0,y_vel(a0)
  45568. move.l #Obj20_MapUnc_23294,mappings(a0)
  45569. move.w #make_art_tile(ArtTile_ArtNem_Buzzer_Fireball_1,0,1),art_tile(a0)
  45570. jsrto (Adjust2PArtPointer).l, JmpTo17_Adjust2PArtPointer
  45571. move.b #0,mapping_frame(a0)
  45572. move.w #9,objoff_32(a0)
  45573. move.b #3,objoff_36(a0)
  45574.  
  45575. BranchTo_JmpTo8_MarkObjGone
  45576. jmpto (MarkObjGone).l, JmpTo8_MarkObjGone
  45577. ; ===========================================================================
  45578.  
  45579. loc_231D2:
  45580. subq.w #1,objoff_32(a0)
  45581. bpl.s loc_23224
  45582. move.w #$7F,objoff_32(a0)
  45583. subq.b #1,objoff_36(a0)
  45584. bmi.s loc_23224
  45585. jsrto (SingleObjLoad2).l, JmpTo6_SingleObjLoad2
  45586. bne.s loc_23224
  45587. moveq #0,d0
  45588.  
  45589. move.w #bytesToLcnt(object_size),d1
  45590.  
  45591. loc_231F0:
  45592. move.l (a0,d0.w),(a1,d0.w)
  45593. addq.w #4,d0
  45594. dbf d1,loc_231F0
  45595. if object_size&3
  45596. move.w (a0,d0.w),(a1,d0.w)
  45597. endif
  45598.  
  45599. move.w #9,objoff_32(a1)
  45600. move.w #$200,anim(a1)
  45601. move.w #$E,d0
  45602. tst.w x_vel(a1)
  45603. bpl.s loc_23214
  45604. neg.w d0
  45605.  
  45606. loc_23214:
  45607. add.w d0,x_pos(a1)
  45608. move.l a1,-(sp)
  45609. bsr.w FireCheckFloorDist
  45610. movea.l (sp)+,a1 ; a1=object
  45611. add.w d1,y_pos(a1)
  45612.  
  45613. loc_23224:
  45614. lea (Ani_obj20).l,a1
  45615. jsrto (AnimateSprite).l, JmpTo4_AnimateSprite
  45616. jmpto (MarkObjGone).l, JmpTo8_MarkObjGone
  45617. ; ===========================================================================
  45618.  
  45619. BranchTo_JmpTo21_DeleteObject
  45620. jmpto (DeleteObject).l, JmpTo21_DeleteObject
  45621. ; ===========================================================================
  45622. ; animation script
  45623. ; off_23236:
  45624. Ani_obj20: offsetTable
  45625. offsetTableEntry.w byte_2323C ; 0
  45626. offsetTableEntry.w byte_23243 ; 1
  45627. offsetTableEntry.w byte_23246 ; 2
  45628. byte_2323C: dc.b $B, 2, 3,$FC, 4,$FD, 1
  45629. rev02even
  45630. byte_23243: dc.b $7F, 5,$FF
  45631. rev02even
  45632. byte_23246: dc.b 5, 4, 5, 2, 3, 0, 1, 0, 1, 2, 3, 4, 5,$FC
  45633. even
  45634.  
  45635. ; -------------------------------------------------------------------------------
  45636. ; sprite mappings
  45637. ; -------------------------------------------------------------------------------
  45638. Obj20_MapUnc_23254: BINCLUDE "mappings/sprite/obj20_a.bin"
  45639. ; -------------------------------------------------------------------------------
  45640. ; sprite mappings
  45641. ; -------------------------------------------------------------------------------
  45642. Obj20_MapUnc_23294: BINCLUDE "mappings/sprite/obj20_b.bin"
  45643. ; ===========================================================================
  45644.  
  45645. if ~~removeJmpTos
  45646. JmpTo21_DeleteObject
  45647. jmp (DeleteObject).l
  45648. JmpTo8_MarkObjGone
  45649. jmp (MarkObjGone).l
  45650. JmpTo6_SingleObjLoad2
  45651. jmp (SingleObjLoad2).l
  45652. JmpTo4_AnimateSprite
  45653. jmp (AnimateSprite).l
  45654. JmpTo17_Adjust2PArtPointer
  45655. jmp (Adjust2PArtPointer).l
  45656. ; loc_232FA:
  45657. JmpTo7_ObjectMove
  45658. jmp (ObjectMove).l
  45659.  
  45660. align 4
  45661. endif
  45662.  
  45663.  
  45664.  
  45665.  
  45666. ; ===========================================================================
  45667. ; ----------------------------------------------------------------------------
  45668. ; Object 2F - Smashable ground in Hill Top Zone
  45669. ; ----------------------------------------------------------------------------
  45670. ; Sprite_23300:
  45671. Obj2F:
  45672. moveq #0,d0
  45673. move.b routine(a0),d0
  45674. move.w Obj2F_Index(pc,d0.w),d1
  45675. jmp Obj2F_Index(pc,d1.w)
  45676. ; ===========================================================================
  45677. ; off_2330E:
  45678. Obj2F_Index: offsetTable
  45679. offsetTableEntry.w Obj2F_Init ; 0
  45680. offsetTableEntry.w Obj2F_Main ; 2
  45681. offsetTableEntry.w Obj2F_Fragment ; 4
  45682. ; ===========================================================================
  45683. ; byte_23314:
  45684. Obj2F_Properties:
  45685. ; y_radius
  45686. ; mapping_frame
  45687. dc.b $24, 0 ; 0
  45688. dc.b $20, 2 ; 2
  45689. dc.b $18, 4 ; 4
  45690. dc.b $10, 6 ; 6
  45691. dc.b 8, 8 ; 8
  45692. ; ===========================================================================
  45693. ; loc_2331E:
  45694. Obj2F_Init:
  45695. addq.b #2,routine(a0)
  45696. move.l #Obj2F_MapUnc_236FA,mappings(a0)
  45697. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,2,1),art_tile(a0)
  45698. jsrto (Adjust2PArtPointer).l, JmpTo18_Adjust2PArtPointer
  45699. move.b #4,render_flags(a0)
  45700. move.b #$10,width_pixels(a0)
  45701. move.b #4,priority(a0)
  45702. moveq #0,d0
  45703. move.b subtype(a0),d0
  45704. andi.w #$1E,d0
  45705. lea Obj2F_Properties(pc,d0.w),a2
  45706. move.b (a2)+,y_radius(a0)
  45707. move.b (a2)+,mapping_frame(a0)
  45708. move.b #$20,y_radius(a0)
  45709. bset #4,render_flags(a0)
  45710. ; loc_23368:
  45711. Obj2F_Main:
  45712. move.w (Chain_Bonus_counter).w,objoff_38(a0)
  45713. move.b (MainCharacter+anim).w,objoff_32(a0)
  45714. move.b (Sidekick+anim).w,objoff_33(a0)
  45715. moveq #0,d1
  45716. move.b width_pixels(a0),d1
  45717. addi.w #$B,d1
  45718. moveq #0,d2
  45719. move.b y_radius(a0),d2
  45720. move.w d2,d3
  45721. addq.w #1,d3
  45722. move.w x_pos(a0),d4
  45723. jsrto (SolidObject).l, JmpTo3_SolidObject
  45724. move.b status(a0),d0
  45725. andi.b #standing_mask,d0
  45726. bne.s +
  45727.  
  45728. BranchTo_JmpTo9_MarkObjGone
  45729. jmpto (MarkObjGone).l, JmpTo9_MarkObjGone
  45730. ; ===========================================================================
  45731. +
  45732. cmpi.b #standing_mask,d0
  45733. bne.s loc_23408
  45734. cmpi.b #AniIDSonAni_Roll,objoff_32(a0)
  45735. bne.s loc_233C0
  45736. tst.b subtype(a0)
  45737. bmi.s loc_233F0
  45738. cmpi.b #$E,(MainCharacter+top_solid_bit).w
  45739. beq.s loc_233F0
  45740.  
  45741. loc_233C0:
  45742. move.b #$C,(MainCharacter+top_solid_bit).w
  45743. move.b #$D,(MainCharacter+lrb_solid_bit).w
  45744. cmpi.b #AniIDSonAni_Roll,objoff_33(a0)
  45745. bne.s loc_233E2
  45746. tst.b subtype(a0)
  45747. bmi.s loc_233F0
  45748. cmpi.b #$E,(Sidekick+top_solid_bit).w
  45749. beq.s loc_233F0
  45750.  
  45751. loc_233E2:
  45752. move.b #$C,(Sidekick+top_solid_bit).w
  45753. move.b #$D,(Sidekick+lrb_solid_bit).w
  45754. bra.s BranchTo_JmpTo9_MarkObjGone
  45755. ; ===========================================================================
  45756.  
  45757. loc_233F0:
  45758. lea (MainCharacter).w,a1 ; a1=character
  45759. move.b objoff_32(a0),d0
  45760. bsr.s loc_2343E
  45761. lea (Sidekick).w,a1 ; a1=character
  45762. move.b objoff_33(a0),d0
  45763. bsr.s loc_2343E
  45764. bra.w loc_234A4
  45765. ; ===========================================================================
  45766.  
  45767. loc_23408:
  45768. move.b d0,d1
  45769. andi.b #p1_standing,d1
  45770. beq.s loc_23470
  45771. cmpi.b #AniIDSonAni_Roll,objoff_32(a0)
  45772. bne.s loc_23426
  45773. tst.b subtype(a0)
  45774. bmi.s loc_23436
  45775. cmpi.b #$E,(MainCharacter+top_solid_bit).w
  45776. beq.s loc_23436
  45777.  
  45778. loc_23426:
  45779. move.b #$C,(MainCharacter+top_solid_bit).w
  45780. move.b #$D,(MainCharacter+lrb_solid_bit).w
  45781. bra.w BranchTo_JmpTo9_MarkObjGone
  45782. ; ===========================================================================
  45783.  
  45784. loc_23436:
  45785. lea (MainCharacter).w,a1 ; a1=character
  45786. bsr.s loc_23444
  45787. bra.s loc_234A4
  45788. ; ===========================================================================
  45789.  
  45790. loc_2343E:
  45791. cmpi.b #AniIDSonAni_Roll,d0
  45792. bne.s loc_2345C
  45793.  
  45794. loc_23444:
  45795. bset #2,status(a1)
  45796. move.b #$E,y_radius(a1)
  45797. move.b #7,x_radius(a1)
  45798. move.b #AniIDSonAni_Roll,anim(a1)
  45799.  
  45800. loc_2345C:
  45801. bset #1,status(a1)
  45802. bclr #3,status(a1)
  45803. move.b #2,routine(a1)
  45804. rts
  45805. ; ===========================================================================
  45806.  
  45807. loc_23470:
  45808. andi.b #p2_standing,d0
  45809. beq.w BranchTo_JmpTo9_MarkObjGone
  45810. cmpi.b #AniIDSonAni_Roll,objoff_33(a0)
  45811. bne.s loc_2348E
  45812. tst.b subtype(a0)
  45813. bmi.s loc_2349E
  45814. cmpi.b #$E,(Sidekick+top_solid_bit).w
  45815. beq.s loc_2349E
  45816.  
  45817. loc_2348E:
  45818. move.b #$C,(Sidekick+top_solid_bit).w
  45819. move.b #$D,(Sidekick+lrb_solid_bit).w
  45820. bra.w BranchTo_JmpTo9_MarkObjGone
  45821. ; ===========================================================================
  45822.  
  45823. loc_2349E:
  45824. lea (Sidekick).w,a1 ; a1=character
  45825. bsr.s loc_23444
  45826.  
  45827. loc_234A4:
  45828. move.w objoff_38(a0),(Chain_Bonus_counter).w
  45829. andi.b #~standing_mask,status(a0)
  45830. lea (byte_234F2).l,a4
  45831. moveq #0,d0
  45832. move.b mapping_frame(a0),d0
  45833. addq.b #1,mapping_frame(a0)
  45834. move.l d0,d1
  45835. add.w d0,d0
  45836. add.w d0,d0
  45837. lea (a4,d0.w),a4
  45838. neg.w d1
  45839. addi.w #9,d1
  45840. move.w #$18,d2
  45841. jsrto (BreakObjectToPieces).l, JmpTo_BreakObjectToPieces
  45842. bsr.w SmashableObject_LoadPoints
  45843. ; loc_234DC:
  45844. Obj2F_Fragment:
  45845. jsrto (ObjectMove).l, JmpTo8_ObjectMove
  45846. addi.w #$18,y_vel(a0)
  45847. tst.b render_flags(a0)
  45848. bpl.w JmpTo22_DeleteObject
  45849. jmpto (DisplaySprite).l, JmpTo12_DisplaySprite
  45850. ; ===========================================================================
  45851. byte_234F2:
  45852. dc.b $FF
  45853. dc.b 0 ; 1
  45854. dc.b $F8 ; 2
  45855. dc.b 0 ; 3
  45856. dc.b 1 ; 4
  45857. dc.b 0 ; 5
  45858. dc.b $F8 ; 6
  45859. dc.b 0 ; 7
  45860. dc.b $FF ; 8
  45861. dc.b $20 ; 9
  45862. dc.b $F9 ; 10
  45863. dc.b 0 ; 11
  45864. dc.b 0 ; 12
  45865. dc.b $E0 ; 13
  45866. dc.b $F9 ; 14
  45867. dc.b 0 ; 15
  45868. dc.b $FF ; 16
  45869. dc.b $40 ; 17
  45870. dc.b $FA ; 18
  45871. dc.b 0 ; 19
  45872. dc.b 0 ; 20
  45873. dc.b $C0 ; 21
  45874. dc.b $FA ; 22
  45875. dc.b 0 ; 23
  45876. dc.b $FF ; 24
  45877. dc.b $60 ; 25
  45878. dc.b $FB ; 26
  45879. dc.b 0 ; 27
  45880. dc.b 0 ; 28
  45881. dc.b $A0 ; 29
  45882. dc.b $FB ; 30
  45883. dc.b 0 ; 31
  45884. dc.b $FF ; 32
  45885. dc.b $80 ; 33
  45886. dc.b $FC ; 34
  45887. dc.b 0 ; 35
  45888. dc.b 0 ; 36
  45889. dc.b $80 ; 37
  45890. dc.b $FC ; 38
  45891. dc.b 0 ; 39
  45892. ; ===========================================================================
  45893. ; ----------------------------------------------------------------------------
  45894. ; Object 32 - Breakable block/rock from CPZ and HTZ
  45895. ; ----------------------------------------------------------------------------
  45896. breakableblock_mainchar_anim = objoff_32
  45897. breakableblock_sidekick_anim = objoff_33
  45898. ; Sprite_2351A:
  45899. Obj32:
  45900. moveq #0,d0
  45901. move.b routine(a0),d0
  45902. move.w Obj32_Index(pc,d0.w),d1
  45903. jmp Obj32_Index(pc,d1.w)
  45904. ; ===========================================================================
  45905. ; off_23528:
  45906. Obj32_Index: offsetTable
  45907. offsetTableEntry.w Obj32_Init ; 0
  45908. offsetTableEntry.w Obj32_Main ; 2
  45909. offsetTableEntry.w Obj32_Fragment ; 4
  45910. ; ===========================================================================
  45911. ; loc_2352E:
  45912. Obj32_Init:
  45913. addq.b #2,routine(a0)
  45914. move.l #Obj32_MapUnc_23852,mappings(a0)
  45915. move.w #make_art_tile(ArtTile_ArtNem_HtzRock,2,0),art_tile(a0)
  45916. move.b #$18,width_pixels(a0)
  45917. move.l #Obj32_VelArray1,objoff_3C(a0)
  45918. cmpi.b #chemical_plant_zone,(Current_Zone).w
  45919. bne.s +
  45920. move.l #Obj32_MapUnc_23886,mappings(a0)
  45921. move.w #make_art_tile(ArtTile_ArtNem_CPZMetalBlock,3,0),art_tile(a0)
  45922. move.b #$10,width_pixels(a0)
  45923. move.l #Obj32_VelArray2,objoff_3C(a0)
  45924. +
  45925. jsrto (Adjust2PArtPointer).l, JmpTo18_Adjust2PArtPointer
  45926. move.b #4,render_flags(a0)
  45927. move.b #4,priority(a0)
  45928. ; loc_23582:
  45929. Obj32_Main:
  45930. move.w (Chain_Bonus_counter).w,objoff_38(a0)
  45931. move.b (MainCharacter+anim).w,breakableblock_mainchar_anim(a0)
  45932. move.b (Sidekick+anim).w,breakableblock_sidekick_anim(a0)
  45933. moveq #0,d1
  45934. move.b width_pixels(a0),d1
  45935. addi.w #$B,d1
  45936. move.w #$10,d2
  45937. move.w #$11,d3
  45938. move.w x_pos(a0),d4
  45939. jsrto (SolidObject).l, JmpTo3_SolidObject
  45940. move.b status(a0),d0
  45941. andi.b #standing_mask,d0 ; is at least one player standing on the object?
  45942. bne.s Obj32_SupportingSomeone
  45943.  
  45944. BranchTo2_JmpTo9_MarkObjGone
  45945. jmpto (MarkObjGone).l, JmpTo9_MarkObjGone
  45946. ; ===========================================================================
  45947. ; loc_235BC:
  45948. Obj32_SupportingSomeone:
  45949. cmpi.b #standing_mask,d0 ; are BOTH players standing on the object?
  45950. bne.s Obj32_SupportingOnePlayerOnly ; if not, branch
  45951. cmpi.b #AniIDSonAni_Roll,breakableblock_mainchar_anim(a0)
  45952. beq.s +
  45953. cmpi.b #AniIDSonAni_Roll,breakableblock_sidekick_anim(a0)
  45954. bne.s BranchTo2_JmpTo9_MarkObjGone
  45955. +
  45956. lea (MainCharacter).w,a1 ; a1=character
  45957. move.b breakableblock_mainchar_anim(a0),d0
  45958. bsr.s Obj32_SetCharacterOffBlock
  45959. lea (Sidekick).w,a1 ; a1=character
  45960. move.b breakableblock_sidekick_anim(a0),d0
  45961. bsr.s Obj32_SetCharacterOffBlock
  45962. bra.w Obj32_Destroy
  45963. ; ===========================================================================
  45964. ; loc_235EA:
  45965. Obj32_SupportingOnePlayerOnly:
  45966. move.b d0,d1
  45967. andi.b #p1_standing,d1 ; is the main character standing on the object?
  45968. beq.s Obj32_SupportingSidekick ; if not, branch
  45969. cmpi.b #AniIDSonAni_Roll,breakableblock_mainchar_anim(a0)
  45970. bne.s BranchTo2_JmpTo9_MarkObjGone
  45971. lea (MainCharacter).w,a1 ; a1=character
  45972. bsr.s Obj32_BouncePlayer
  45973. bra.s Obj32_Destroy
  45974. ; ===========================================================================
  45975. ; loc_23602:
  45976. Obj32_SetCharacterOffBlock:
  45977. cmpi.b #AniIDSonAni_Roll,d0
  45978. bne.s +
  45979. ; loc_23608:
  45980. Obj32_BouncePlayer:
  45981. bset #2,status(a1)
  45982. move.b #$E,y_radius(a1)
  45983. move.b #7,x_radius(a1)
  45984. move.b #AniIDSonAni_Roll,anim(a1)
  45985. move.w #-$300,y_vel(a1)
  45986. +
  45987. bset #1,status(a1)
  45988. bclr #3,status(a1)
  45989. move.b #2,routine(a1)
  45990. rts
  45991. ; ===========================================================================
  45992. ; loc_2363A:
  45993. Obj32_SupportingSidekick:
  45994. andi.b #p2_standing,d0 ; is the sidekick standing on the object? (at this point, it should...)
  45995. beq.w BranchTo2_JmpTo9_MarkObjGone ; if, by miracle, he's not, branch
  45996. cmpi.b #2,breakableblock_sidekick_anim(a0)
  45997. bne.w BranchTo2_JmpTo9_MarkObjGone
  45998. lea (Sidekick).w,a1 ; a1=character
  45999. bsr.s Obj32_BouncePlayer
  46000. ; loc_23652:
  46001. Obj32_Destroy:
  46002. move.w objoff_38(a0),(Chain_Bonus_counter).w
  46003. andi.b #~standing_mask,status(a0)
  46004. movea.l objoff_3C(a0),a4
  46005. jsrto (BreakObjectToPieces).l, JmpTo_BreakObjectToPieces
  46006. bsr.w SmashableObject_LoadPoints
  46007. ; loc_2366A:
  46008. Obj32_Fragment:
  46009. jsrto (ObjectMove).l, JmpTo8_ObjectMove
  46010. addi.w #$18,y_vel(a0)
  46011. tst.b render_flags(a0)
  46012. bpl.w JmpTo22_DeleteObject
  46013. jmpto (DisplaySprite).l, JmpTo12_DisplaySprite
  46014. ; ===========================================================================
  46015. ; velocity array for smashed bits, two words for each fragment
  46016. ; byte_23680:
  46017. Obj32_VelArray1:
  46018. ; x_vel y_vel
  46019. dc.w -$200,-$200
  46020. dc.w 0,-$280
  46021. dc.w $200,-$200
  46022. dc.w -$1C0,-$1C0
  46023. dc.w 0,-$200
  46024. dc.w $1C0,-$1C0
  46025. ;byte_23698:
  46026. Obj32_VelArray2:
  46027. ; x_vel y_vel
  46028. dc.w -$100,-$200
  46029. dc.w $100,-$200
  46030. dc.w -$C0,-$1C0
  46031. dc.w $C0,-$1C0
  46032.  
  46033. ; ===========================================================================
  46034. ; loc_236A8:
  46035. SmashableObject_LoadPoints:
  46036. jsrto (SingleObjLoad).l, JmpTo3_SingleObjLoad
  46037. bne.s +++ ; rts
  46038. _move.b #ObjID_Points,id(a1) ; load obj29
  46039. move.w x_pos(a0),x_pos(a1)
  46040. move.w y_pos(a0),y_pos(a1)
  46041. move.w (Chain_Bonus_counter).w,d2
  46042. addq.w #2,(Chain_Bonus_counter).w
  46043. cmpi.w #6,d2
  46044. blo.s +
  46045. moveq #6,d2
  46046. +
  46047. moveq #0,d0
  46048. move.w SmashableObject_ScoreBonus(pc,d2.w),d0
  46049. cmpi.w #$20,(Chain_Bonus_counter).w
  46050. blo.s +
  46051. move.w #1000,d0
  46052. moveq #$A,d2
  46053. +
  46054. jsr (AddPoints).l
  46055. lsr.w #1,d2
  46056. move.b d2,mapping_frame(a1)
  46057. +
  46058. rts
  46059. ; ===========================================================================
  46060. ; word_236F2:
  46061. SmashableObject_ScoreBonus:
  46062. dc.w 10
  46063. dc.w 20 ; 1
  46064. dc.w 50 ; 2
  46065. dc.w 100 ; 3
  46066. ; ----------------------------------------------------------------------------
  46067. ; sprite mappings
  46068. ; ----------------------------------------------------------------------------
  46069. Obj2F_MapUnc_236FA: BINCLUDE "mappings/sprite/obj2F.bin"
  46070. ; ----------------------------------------------------------------------------
  46071. ; sprite mappings
  46072. ; ----------------------------------------------------------------------------
  46073. Obj32_MapUnc_23852: BINCLUDE "mappings/sprite/obj32_a.bin"
  46074. ; ----------------------------------------------------------------------------
  46075. ; sprite mappings
  46076. ; ----------------------------------------------------------------------------
  46077. Obj32_MapUnc_23886: BINCLUDE "mappings/sprite/obj32_b.bin"
  46078. ; ===========================================================================
  46079.  
  46080. if gameRevision<2
  46081. nop
  46082. endif
  46083.  
  46084. if ~~removeJmpTos
  46085. JmpTo12_DisplaySprite
  46086. jmp (DisplaySprite).l
  46087. JmpTo22_DeleteObject
  46088. jmp (DeleteObject).l
  46089. JmpTo3_SingleObjLoad
  46090. jmp (SingleObjLoad).l
  46091. JmpTo9_MarkObjGone
  46092. jmp (MarkObjGone).l
  46093. JmpTo18_Adjust2PArtPointer
  46094. jmp (Adjust2PArtPointer).l
  46095. JmpTo_BreakObjectToPieces
  46096. jmp (BreakObjectToPieces).l
  46097. JmpTo3_SolidObject
  46098. jmp (SolidObject).l
  46099. ; loc_238D6:
  46100. JmpTo8_ObjectMove
  46101. jmp (ObjectMove).l
  46102.  
  46103. align 4
  46104. else
  46105. JmpTo22_DeleteObject
  46106. jmp (DeleteObject).l
  46107. endif
  46108.  
  46109.  
  46110.  
  46111.  
  46112. ; ===========================================================================
  46113. ; ----------------------------------------------------------------------------
  46114. ; Object 30 - Large rising lava during earthquake in HTZ
  46115. ; ----------------------------------------------------------------------------
  46116. ; Sprite_238DC:
  46117. Obj30:
  46118. moveq #0,d0
  46119. move.b routine(a0),d0
  46120. move.w Obj30_Index(pc,d0.w),d1
  46121. jmp Obj30_Index(pc,d1.w)
  46122. ; ===========================================================================
  46123. ; off_238EA:
  46124. Obj30_Index: offsetTable
  46125. offsetTableEntry.w Obj30_Init ; 0
  46126. offsetTableEntry.w Obj30_Main ; 2
  46127. ; ===========================================================================
  46128. ; byte_238EE:
  46129. Obj30_Widths:
  46130. dc.b $C0
  46131. dc.b 0 ; 1
  46132. dc.b $C0 ; 2
  46133. dc.b 0 ; 3
  46134. dc.b $C0 ; 4
  46135. dc.b 0 ; 5
  46136. dc.b $E0 ; 6
  46137. dc.b 0 ; 7
  46138. dc.b $C0 ; 8
  46139. dc.b 0 ; 9
  46140. ; ===========================================================================
  46141. ; loc_238F8:
  46142. Obj30_Init:
  46143. addq.b #2,routine(a0)
  46144. move.w y_pos(a0),objoff_32(a0)
  46145. move.w x_pos(a0),objoff_30(a0)
  46146. moveq #0,d0
  46147. move.b subtype(a0),d0
  46148. move.b Obj30_Widths(pc,d0.w),width_pixels(a0)
  46149. cmpi.b #6,d0
  46150. blo.s Obj30_Main
  46151. bne.s +
  46152. cmpi.w #$380,(Camera_Y_pos).w
  46153. bhs.s Obj30_Main
  46154. bra.s ++
  46155. ; ===========================================================================
  46156. +
  46157. cmpi.w #$380,(Camera_Y_pos).w
  46158. blo.s Obj30_Main
  46159. +
  46160. lea (Object_Respawn_Table).w,a2
  46161. moveq #0,d0
  46162. move.b respawn_index(a0),d0
  46163. beq.s +
  46164. bclr #7,2(a2,d0.w)
  46165. +
  46166. jmpto (DeleteObject).l, JmpTo23_DeleteObject
  46167. ; ===========================================================================
  46168. ; loc_23944:
  46169. Obj30_Main:
  46170. move.w objoff_32(a0),d0
  46171. add.w (Camera_BG_Y_offset).w,d0
  46172. move.w d0,y_pos(a0)
  46173. moveq #0,d0
  46174. move.b subtype(a0),d0
  46175. move.w Obj30_Modes(pc,d0.w),d1
  46176. jsr Obj30_Modes(pc,d1.w)
  46177. tst.b (Screen_Shaking_Flag_HTZ).w
  46178. beq.w JmpTo2_MarkObjGone3
  46179. rts
  46180. ; ===========================================================================
  46181. ; off_23968:
  46182. Obj30_Modes: offsetTable
  46183. offsetTableEntry.w loc_23972 ; 0
  46184. offsetTableEntry.w loc_23972 ; 2
  46185. offsetTableEntry.w loc_2398A ; 4
  46186. offsetTableEntry.w loc_239D0 ; 6
  46187. offsetTableEntry.w loc_239EA ; 8
  46188. ; ===========================================================================
  46189.  
  46190. loc_23972:
  46191. move.w #$CB,d1
  46192. move.w #$80,d2
  46193. move.w #$81,d3
  46194. move.w x_pos(a0),d4
  46195. jsrto (SolidObject_Always).l, JmpTo_SolidObject_Always
  46196. jmpto (DropOnFloor).l, JmpTo_DropOnFloor
  46197. ; ===========================================================================
  46198.  
  46199. loc_2398A:
  46200. move.w #$CB,d1
  46201. move.w #$78,d2
  46202. move.w #$79,d3
  46203. move.w x_pos(a0),d4
  46204. jsrto (SolidObject_Always).l, JmpTo_SolidObject_Always
  46205. jsrto (DropOnFloor).l, JmpTo_DropOnFloor
  46206. ; loc_239A2:
  46207. Obj30_HurtSupportedPlayers:
  46208. btst #p1_standing_bit,status(a0)
  46209. beq.s +
  46210. move.l a0,-(sp)
  46211. movea.l a0,a1
  46212. lea (MainCharacter).w,a0 ; a0=character
  46213. jsrto (Touch_ChkHurt).l, JmpTo_Touch_ChkHurt
  46214. movea.l (sp)+,a0 ; load 0bj address
  46215. +
  46216. btst #p2_standing_bit,status(a0)
  46217. beq.s +
  46218. move.l a0,-(sp)
  46219. movea.l a0,a1
  46220. lea (Sidekick).w,a0 ; a0=character
  46221. jsrto (Touch_ChkHurt).l, JmpTo_Touch_ChkHurt
  46222. movea.l (sp)+,a0 ; load 0bj address
  46223. +
  46224. rts
  46225. ; ===========================================================================
  46226.  
  46227. loc_239D0:
  46228. move.w #$EB,d1
  46229. move.w #$78,d2
  46230. move.w #$79,d3
  46231. move.w x_pos(a0),d4
  46232. jsrto (SolidObject_Always).l, JmpTo_SolidObject_Always
  46233. jsrto (DropOnFloor).l, JmpTo_DropOnFloor
  46234. bra.s Obj30_HurtSupportedPlayers
  46235. ; ===========================================================================
  46236.  
  46237. loc_239EA:
  46238. move.w #$CB,d1
  46239. move.w #$2E,d2
  46240. move.w x_pos(a0),d4
  46241. lea (Obj30_SlopeData).l,a2
  46242. jsrto (SlopedSolid).l, JmpTo_SlopedSolid
  46243. jmpto (DropOnFloor).l, JmpTo_DropOnFloor
  46244. ; ===========================================================================
  46245. ;byte_23A04:
  46246. Obj30_SlopeData:
  46247. dc.b $30,$30,$30,$30,$30,$30,$30,$30,$2F,$2F,$2E,$2E,$2D,$2D,$2C,$2C
  46248. dc.b $2B,$2B,$2A,$2A,$29,$29,$28,$28,$27,$27,$26,$26,$25,$25,$24,$24; 16
  46249. dc.b $23,$23,$22,$22,$21,$21,$20,$20,$1F,$1F,$1E,$1E,$1D,$1D,$1C,$1C; 32
  46250. dc.b $1B,$1B,$1A,$1A,$19,$19,$18,$18,$17,$17,$16,$16,$15,$15,$14,$14; 48
  46251. dc.b $13,$13,$12,$12,$11,$11,$10,$10, $F, $F, $E, $E, $D, $D, $C, $C; 64
  46252. dc.b $B, $B, $A, $A, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4; 80
  46253. dc.b 3, 3, 2, 2, 1, 1, 0, 0,$FF,$FF,$FE,$FE,$FD,$FD,$FC,$FC; 96
  46254. dc.b $FB,$FB,$FA,$FA,$F9,$F9,$F8,$F8,$F7,$F7,$F6,$F6,$F5,$F5,$F4,$F4; 112
  46255. dc.b $F3,$F3,$F2,$F2,$F1,$F1,$F0,$F0,$EF,$EF,$EE,$EE,$ED,$ED,$EC,$EC; 128
  46256. dc.b $EB,$EB,$EA,$EA,$E9,$E9,$E8,$E8,$E7,$E7,$E6,$E6,$E5,$E5,$E4,$E4; 144
  46257. dc.b $E3,$E3,$E2,$E2,$E1,$E1,$E0,$E0,$DF,$DF,$DE,$DE,$DD,$DD,$DC,$DC; 160
  46258. dc.b $DB,$DB,$DA,$DA,$D9,$D9,$D8,$D8,$D7,$D7,$D6,$D6,$D5,$D5,$D4,$D4; 176
  46259. dc.b $D3,$D3,$D2,$D2,$D1,$D1,$D0,$D0,$D0,$D0,$D0,$D0; 192
  46260. ; ===========================================================================
  46261.  
  46262. if ~~removeJmpTos
  46263. JmpTo23_DeleteObject
  46264. jmp (DeleteObject).l
  46265. JmpTo_Touch_ChkHurt
  46266. jmp (Touch_ChkHurt).l
  46267. JmpTo2_MarkObjGone3
  46268. jmp (MarkObjGone3).l
  46269. JmpTo_DropOnFloor
  46270. jmp (DropOnFloor).l
  46271. JmpTo_SolidObject_Always
  46272. jmp (SolidObject_Always).l
  46273. JmpTo_SlopedSolid
  46274. jmp (SlopedSolid).l
  46275.  
  46276. align 4
  46277. else
  46278. JmpTo2_MarkObjGone3
  46279. jmp (MarkObjGone3).l
  46280. endif
  46281.  
  46282.  
  46283.  
  46284.  
  46285. ; ===========================================================================
  46286. ; ----------------------------------------------------------------------------
  46287. ; Object 33 - Green platform from OOZ
  46288. ; ----------------------------------------------------------------------------
  46289. ; Sprite_23AF4:
  46290. Obj33:
  46291. moveq #0,d0
  46292. move.b routine(a0),d0
  46293. move.w Obj33_Index(pc,d0.w),d1
  46294. jmp Obj33_Index(pc,d1.w)
  46295. ; ===========================================================================
  46296. ; off_23B02:
  46297. Obj33_Index: offsetTable
  46298. offsetTableEntry.w Obj33_Init ; 0
  46299. offsetTableEntry.w Obj33_Main ; 2
  46300. offsetTableEntry.w Obj33_Flame ; 4
  46301. ; ===========================================================================
  46302. ; loc_23B08:
  46303. Obj33_Init:
  46304. addq.b #2,routine(a0)
  46305. move.l #Obj33_MapUnc_23DDC,mappings(a0)
  46306. move.w #make_art_tile(ArtTile_ArtNem_BurnerLid,3,0),art_tile(a0)
  46307. move.b #4,render_flags(a0)
  46308. move.b #3,priority(a0)
  46309. move.b #$18,width_pixels(a0)
  46310. move.w y_pos(a0),objoff_30(a0)
  46311. addq.b #2,routine_secondary(a0)
  46312. move.w #$78,objoff_36(a0)
  46313. tst.b subtype(a0)
  46314. beq.s +
  46315. move.b #4,routine_secondary(a0)
  46316. +
  46317. jsrto (SingleObjLoad2).l, JmpTo7_SingleObjLoad2
  46318. bne.s Obj33_Main
  46319. _move.b id(a0),id(a1) ; load obj33
  46320. move.b #4,routine(a1)
  46321. move.w x_pos(a0),x_pos(a1)
  46322. move.w y_pos(a0),y_pos(a1)
  46323. subi.w #$10,y_pos(a1)
  46324. move.l #Obj33_MapUnc_23DF0,mappings(a1)
  46325. move.w #make_art_tile(ArtTile_ArtNem_OOZBurn,3,0),art_tile(a1)
  46326. move.b #4,render_flags(a1)
  46327. move.b #4,priority(a1)
  46328. move.b #$10,width_pixels(a1)
  46329. move.l a0,objoff_3C(a1)
  46330. ; loc_23B90:
  46331. Obj33_Main:
  46332. move.w x_pos(a0),-(sp)
  46333. moveq #0,d0
  46334. move.b routine_secondary(a0),d0
  46335. move.w Obj33_Modes(pc,d0.w),d1
  46336. jsr Obj33_Modes(pc,d1.w)
  46337. move.w (sp)+,d4
  46338. moveq #0,d1
  46339. move.b width_pixels(a0),d1
  46340. addi.w #$B,d1
  46341. moveq #8,d2
  46342. move.w d2,d3
  46343. addq.w #1,d3
  46344. jsrto (SolidObject).l, JmpTo4_SolidObject
  46345. jmpto (MarkObjGone).l, JmpTo10_MarkObjGone
  46346. ; ===========================================================================
  46347. ; off_23BBC:
  46348. Obj33_Modes: offsetTable
  46349. offsetTableEntry.w loc_23BC6 ; 0
  46350. offsetTableEntry.w loc_23BEA ; 2
  46351. offsetTableEntry.w loc_23C26 ; 4
  46352. offsetTableEntry.w loc_23D20 ; 6
  46353. offsetTableEntry.w return_23D98 ; 8
  46354. ; ===========================================================================
  46355.  
  46356. loc_23BC6:
  46357. subq.w #1,objoff_36(a0)
  46358. bpl.s + ; rts
  46359. move.w #$78,objoff_36(a0)
  46360. move.l #-$96800,objoff_32(a0)
  46361. addq.b #2,routine_secondary(a0)
  46362. move.w #SndID_OOZLidPop,d0
  46363. jsr (PlaySoundLocal).l
  46364. +
  46365. rts
  46366. ; ===========================================================================
  46367.  
  46368. loc_23BEA:
  46369. move.l y_pos(a0),d1
  46370. add.l objoff_32(a0),d1
  46371. move.l d1,y_pos(a0)
  46372. addi.l #$3800,objoff_32(a0)
  46373. swap d1
  46374. cmp.w objoff_30(a0),d1
  46375. blo.s ++ ; rts
  46376. move.l objoff_32(a0),d0
  46377. cmpi.l #$10000,d0
  46378. bhs.s +
  46379. subq.b #2,routine_secondary(a0)
  46380. +
  46381. lsr.l #2,d0
  46382. neg.l d0
  46383. move.l d0,objoff_32(a0)
  46384. move.w objoff_30(a0),y_pos(a0)
  46385. +
  46386. rts
  46387. ; ===========================================================================
  46388.  
  46389. loc_23C26:
  46390. move.w x_pos(a0),d2
  46391. move.w d2,d3
  46392. subi.w #$10,d2
  46393. addi.w #$10,d3
  46394. move.b status(a0),d0
  46395. andi.b #standing_mask,d0
  46396. beq.s ++ ; rts
  46397. cmpi.b #standing_mask,d0
  46398. beq.s loc_23CA0
  46399. lea (MainCharacter).w,a1 ; a1=character
  46400. moveq #p1_standing_bit,d6
  46401. bsr.s +
  46402. lea (Sidekick).w,a1 ; a1=character
  46403. addq.b #1,d6
  46404. +
  46405. btst d6,status(a0)
  46406. beq.s + ; rts
  46407. move.w x_pos(a1),d0
  46408. cmp.w d2,d0
  46409. blo.s + ; rts
  46410. cmp.w d3,d0
  46411. bhs.s + ; rts
  46412.  
  46413. move.b #1,obj_control(a1)
  46414. move.w #0,inertia(a1)
  46415. move.w #0,x_vel(a1)
  46416. move.w #0,y_vel(a1)
  46417. bclr #5,status(a1)
  46418. bclr #high_priority_bit,art_tile(a1)
  46419. move.l #-$96800,objoff_32(a0)
  46420. addq.b #2,routine_secondary(a0)
  46421. move.w #SndID_OOZLidPop,d0
  46422. jsr (PlaySoundLocal).l
  46423. +
  46424. rts
  46425. ; ===========================================================================
  46426.  
  46427. loc_23CA0:
  46428. lea (MainCharacter).w,a1 ; a1=character
  46429. move.w x_pos(a1),d0
  46430. cmp.w d2,d0
  46431. blo.s + ; rts
  46432. cmp.w d3,d0
  46433. bhs.s + ; rts
  46434. lea (Sidekick).w,a2 ; a2=character
  46435. move.w x_pos(a2),d0
  46436. cmp.w d2,d0
  46437. blo.s + ; rts
  46438. cmp.w d3,d0
  46439. bhs.s + ; rts
  46440.  
  46441. move.b #1,obj_control(a1)
  46442. move.w #0,inertia(a1)
  46443. move.w #0,x_vel(a1)
  46444. move.w #0,y_vel(a1)
  46445. bclr #5,status(a1)
  46446. bclr #high_priority_bit,art_tile(a1)
  46447. move.b #1,obj_control(a2)
  46448. move.w #0,inertia(a2)
  46449. move.w #0,x_vel(a2)
  46450. move.w #0,y_vel(a2)
  46451. bclr #5,status(a2)
  46452. bclr #high_priority_bit,art_tile(a2)
  46453. move.l #-$96800,objoff_32(a0)
  46454. addq.b #2,routine_secondary(a0)
  46455. move.w #SndID_OOZLidPop,d0
  46456. jsr (PlaySoundLocal).l
  46457. +
  46458. rts
  46459. ; ===========================================================================
  46460.  
  46461. loc_23D20:
  46462. move.l y_pos(a0),d1
  46463. add.l objoff_32(a0),d1
  46464. move.l d1,y_pos(a0)
  46465. addi.l #$3800,objoff_32(a0)
  46466. swap d1
  46467. move.w objoff_30(a0),d0
  46468. subi.w #$7D,d0
  46469. cmp.w d0,d1
  46470. bne.s + ; rts
  46471. addq.b #2,routine_secondary(a0)
  46472. lea (MainCharacter).w,a1 ; a1=character
  46473. move.b status(a0),d0
  46474. andi.b #p1_standing,d0
  46475. bsr.s loc_23D60
  46476. lea (Sidekick).w,a1 ; a1=character
  46477. move.b status(a0),d0
  46478. andi.b #p2_standing,d0
  46479.  
  46480. loc_23D60:
  46481. beq.s + ; rts
  46482. move.w x_pos(a0),x_pos(a1)
  46483. move.b #AniIDSonAni_Roll,anim(a1)
  46484. move.w #$800,inertia(a1)
  46485. bset #1,status(a1)
  46486. move.w #-$1000,y_vel(a1)
  46487. bclr #3,status(a1)
  46488. move.b #0,obj_control(a1)
  46489. move.w #SndID_Spring,d0
  46490. jsr (PlaySoundLocal).l
  46491. +
  46492. rts
  46493. ; ===========================================================================
  46494.  
  46495. return_23D98:
  46496. rts
  46497. ; ===========================================================================
  46498. ; loc_23D9A:
  46499. Obj33_Flame:
  46500. movea.l objoff_3C(a0),a1 ; a1=object
  46501. move.w y_pos(a0),d0
  46502. sub.w y_pos(a1),d0
  46503. cmpi.w #$14,d0
  46504. blt.s Obj33_FlameOff
  46505. move.b #$9B,collision_flags(a0)
  46506. lea (Ani_obj33).l,a1
  46507. jsr (AnimateSprite).l
  46508. jmpto (MarkObjGone).l, JmpTo10_MarkObjGone
  46509. ; ===========================================================================
  46510. ; loc_23DC2:
  46511. Obj33_FlameOff:
  46512. move.b #0,collision_flags(a0)
  46513. move.b #0,anim_frame(a0)
  46514. rts
  46515. ; ===========================================================================
  46516. ; animation script
  46517. ; off_23DD0:
  46518. Ani_obj33: offsetTable
  46519. offsetTableEntry.w + ; 0
  46520. + dc.b 2, 2, 0, 2, 0, 2, 0, 1,$FF
  46521. even
  46522. ; ----------------------------------------------------------------------------
  46523. ; sprite mappings
  46524. ; ----------------------------------------------------------------------------
  46525. Obj33_MapUnc_23DDC: BINCLUDE "mappings/sprite/obj33_a.bin"
  46526. ; ----------------------------------------------------------------------------
  46527. ; sprite mappings
  46528. ; ----------------------------------------------------------------------------
  46529. Obj33_MapUnc_23DF0: BINCLUDE "mappings/sprite/obj33_b.bin"
  46530. ; ===========================================================================
  46531.  
  46532. if ~~removeJmpTos
  46533. JmpTo10_MarkObjGone
  46534. jmp (MarkObjGone).l
  46535. JmpTo7_SingleObjLoad2
  46536. jmp (SingleObjLoad2).l
  46537. JmpTo4_SolidObject
  46538. jmp (SolidObject).l
  46539.  
  46540. align 4
  46541. endif
  46542.  
  46543.  
  46544.  
  46545.  
  46546. ; ===========================================================================
  46547. ; ----------------------------------------------------------------------------
  46548. ; Object 43 - Sliding spike obstacle thing from OOZ
  46549. ; ----------------------------------------------------------------------------
  46550. ; Sprite_23E40:
  46551. Obj43:
  46552. moveq #0,d0
  46553. move.b routine(a0),d0
  46554. move.w Obj43_Index(pc,d0.w),d1
  46555. jmp Obj43_Index(pc,d1.w)
  46556. ; ===========================================================================
  46557. ; off_23E4E:
  46558. Obj43_Index: offsetTable
  46559. offsetTableEntry.w Obj43_Init ; 0
  46560. offsetTableEntry.w loc_23F0A ; 2
  46561. offsetTableEntry.w loc_23F5C ; 4
  46562. ; ---------------------------------------------------------------------------
  46563. byte_23E54:
  46564. dc.b 0
  46565. dc.b $68 ; 1
  46566. dc.b 0 ; 2
  46567. dc.b 0 ; 3
  46568. dc.b 0 ; 4
  46569. dc.b 0 ; 5
  46570. dc.b 1 ; 6
  46571. dc.b $E8 ; 7
  46572. dc.b $FF ; 8
  46573. dc.b $E8 ; 9
  46574. dc.b 0 ; 10
  46575. dc.b $18 ; 11
  46576. dc.b 1 ; 12
  46577. dc.b $A8 ; 13
  46578. dc.b $FF ; 14
  46579. dc.b $A8 ; 15
  46580. dc.b $FF ; 16
  46581. dc.b $D8 ; 17
  46582. ; ===========================================================================
  46583. ; loc_23E66:
  46584. Obj43_Init:
  46585. addq.b #2,routine(a0)
  46586. move.w #make_art_tile(ArtTile_ArtNem_SpikyThing,2,1),art_tile(a0)
  46587. jsrto (Adjust2PArtPointer).l, JmpTo19_Adjust2PArtPointer
  46588. moveq #0,d1
  46589. move.b subtype(a0),d1
  46590. lea byte_23E54(pc,d1.w),a2
  46591. move.b (a2)+,d1
  46592. movea.l a0,a1
  46593. bra.s loc_23EA8
  46594. ; ===========================================================================
  46595.  
  46596. loc_23E84:
  46597. jsrto (SingleObjLoad2).l, JmpTo8_SingleObjLoad2
  46598. bne.s loc_23ED4
  46599. _move.b id(a0),id(a1) ; load obj43
  46600. move.b #4,routine(a1)
  46601. move.w x_pos(a0),x_pos(a1)
  46602. move.w y_pos(a0),y_pos(a1)
  46603. move.b #1,objoff_36(a1)
  46604.  
  46605. loc_23EA8:
  46606. move.l #Obj43_MapUnc_23FE0,mappings(a1)
  46607. move.w art_tile(a0),art_tile(a1)
  46608. move.b #4,render_flags(a1)
  46609. move.b #4,priority(a1)
  46610. move.b #$18,width_pixels(a1)
  46611. move.b #$A5,collision_flags(a1)
  46612. move.w x_pos(a1),objoff_30(a1)
  46613.  
  46614. loc_23ED4:
  46615. dbf d1,loc_23E84
  46616. move.l a0,objoff_3C(a1)
  46617. move.l a1,objoff_3C(a0)
  46618. moveq #0,d1
  46619. move.b (a2)+,d1
  46620. move.w objoff_30(a0),d0
  46621. sub.w d1,d0
  46622. move.w d0,objoff_32(a0)
  46623. move.w d0,objoff_32(a1)
  46624. add.w d1,d0
  46625. add.w d1,d0
  46626. move.w d0,objoff_34(a0)
  46627. move.w d0,objoff_34(a1)
  46628. move.w (a2)+,d0
  46629. add.w d0,x_pos(a0)
  46630. move.w (a2)+,d0
  46631. add.w d0,x_pos(a1)
  46632.  
  46633. loc_23F0A:
  46634. bsr.s loc_23F66
  46635. move.w objoff_32(a0),d0
  46636. andi.w #$FF80,d0
  46637. sub.w (Camera_X_pos_coarse).w,d0
  46638. cmpi.w #$280,d0
  46639. bls.s JmpTo13_DisplaySprite
  46640. move.w objoff_34(a0),d0
  46641. andi.w #$FF80,d0
  46642. sub.w (Camera_X_pos_coarse).w,d0
  46643. cmpi.w #$280,d0
  46644. bhi.s loc_23F36
  46645.  
  46646. JmpTo13_DisplaySprite
  46647. jmp (DisplaySprite).l
  46648. ; ===========================================================================
  46649.  
  46650. loc_23F36:
  46651. movea.l objoff_3C(a0),a1 ; a1=object
  46652. cmpa.l a0,a1
  46653. beq.s loc_23F44
  46654. jsr (DeleteObject2).l
  46655.  
  46656. loc_23F44:
  46657. lea (Object_Respawn_Table).w,a2
  46658. moveq #0,d0
  46659. move.b respawn_index(a0),d0
  46660. beq.s JmpTo24_DeleteObject
  46661. bclr #7,2(a2,d0.w)
  46662.  
  46663. JmpTo24_DeleteObject
  46664. jmp (DeleteObject).l
  46665. ; ===========================================================================
  46666.  
  46667. loc_23F5C:
  46668. bsr.s loc_23F66
  46669. bsr.s loc_23FB0
  46670. jmp (DisplaySprite).l
  46671. ; ===========================================================================
  46672.  
  46673. loc_23F66:
  46674. tst.b objoff_36(a0)
  46675. bne.s loc_23F8E
  46676. move.w x_pos(a0),d1
  46677. subq.w #1,d1
  46678. cmp.w objoff_32(a0),d1
  46679. bne.s loc_23F88
  46680. move.b #1,objoff_36(a0)
  46681. move.w #SndID_SlidingSpike,d0
  46682. jsr (PlaySoundLocal).l
  46683.  
  46684. loc_23F88:
  46685. move.w d1,x_pos(a0)
  46686. rts
  46687. ; ===========================================================================
  46688.  
  46689. loc_23F8E:
  46690. move.w x_pos(a0),d1
  46691. addq.w #1,d1
  46692. cmp.w objoff_34(a0),d1
  46693. bne.s loc_23FAA
  46694. move.b #0,objoff_36(a0)
  46695. move.w #SndID_SlidingSpike,d0
  46696. jsr (PlaySoundLocal).l
  46697.  
  46698. loc_23FAA:
  46699. move.w d1,x_pos(a0)
  46700. rts
  46701. ; ===========================================================================
  46702.  
  46703. loc_23FB0:
  46704. movea.l objoff_3C(a0),a1 ; a1=object
  46705. move.w x_pos(a0),d0
  46706. subi.w #$18,d0
  46707. move.w x_pos(a1),d2
  46708. addi.w #$18,d2
  46709. cmp.w d0,d2
  46710. bne.s return_23FDE
  46711. eori.b #1,objoff_36(a0)
  46712. eori.b #1,objoff_36(a1)
  46713. move.w #SndID_SlidingSpike,d0
  46714. jsr (PlaySoundLocal).l
  46715.  
  46716. return_23FDE:
  46717. rts
  46718. ; ===========================================================================
  46719. ; ----------------------------------------------------------------------------
  46720. ; sprite mappings
  46721. ; ----------------------------------------------------------------------------
  46722. Obj43_MapUnc_23FE0: BINCLUDE "mappings/sprite/obj43.bin"
  46723. ; ===========================================================================
  46724.  
  46725. if ~~removeJmpTos
  46726. JmpTo8_SingleObjLoad2
  46727. jmp (SingleObjLoad2).l
  46728. JmpTo19_Adjust2PArtPointer
  46729. jmp (Adjust2PArtPointer).l
  46730.  
  46731. align 4
  46732. endif
  46733.  
  46734.  
  46735.  
  46736.  
  46737. ; ===========================================================================
  46738. ; ----------------------------------------------------------------------------
  46739. ; Object 07 - Oil Ocean in OOZ
  46740. ; ----------------------------------------------------------------------------
  46741. ; OST:
  46742. oil_char1submersion = objoff_38 ; $38(a0)
  46743. oil_char2submersion = objoff_3A ; $3A(a0)
  46744. ; ----------------------------------------------------------------------------
  46745. ; Sprite_24020:
  46746. Obj07:
  46747. moveq #0,d0
  46748. move.b routine(a0),d0
  46749. move.w Obj07_Index(pc,d0.w),d1
  46750. jmp Obj07_Index(pc,d1.w)
  46751. ; ===========================================================================
  46752. ; off_2402E: Obj07_States:
  46753. Obj07_Index: offsetTable
  46754. offsetTableEntry.w Obj07_Init ; 0
  46755. offsetTableEntry.w Obj07_Main ; 2
  46756. ; ===========================================================================
  46757. ; loc_24032:
  46758. Obj07_Init:
  46759. addq.b #2,routine(a0) ; => Obj07_Main
  46760. move.w #$758,y_pos(a0)
  46761. move.b #$20,width_pixels(a0)
  46762. move.w y_pos(a0),objoff_30(a0)
  46763. move.b #$30,oil_char1submersion(a0)
  46764. bset #7,status(a0)
  46765.  
  46766. ; loc_24054:
  46767. Obj07_Main:
  46768. ; check player 1
  46769. tst.w (Debug_placement_mode).w
  46770. bne.w Obj07_End
  46771. lea (MainCharacter).w,a1 ; a1=character
  46772. moveq #p1_standing,d1
  46773. move.b status(a0),d0
  46774. and.b d1,d0
  46775. bne.s Obj07_CheckKillChar1
  46776. cmpi.b #$30,oil_char1submersion(a0)
  46777. beq.s Obj07_CheckSupportChar1
  46778. addq.b #1,oil_char1submersion(a0)
  46779. bra.s Obj07_CheckSupportChar1
  46780. ; ---------------------------------------------------------------------------
  46781. ; loc_24078:
  46782. Obj07_CheckKillChar1:
  46783. tst.b oil_char1submersion(a0)
  46784. beq.s Obj07_SuffocateCharacter
  46785. subq.b #1,oil_char1submersion(a0)
  46786.  
  46787. ; loc_24082:
  46788. Obj07_CheckSupportChar1:
  46789. moveq #$20,d1
  46790. moveq #0,d3
  46791. move.b oil_char1submersion(a0),d3
  46792. moveq #p1_standing_bit,d6
  46793. move.w x_pos(a1),d4
  46794. move.w d4,x_pos(a0)
  46795. jsrto (PlatformObject_SingleCharacter).l, JmpTo_PlatformObject_SingleCharacter ; stop the character from falling past the oil
  46796.  
  46797. ; check player 2
  46798. lea (Sidekick).w,a1 ; a1=character
  46799. moveq #p2_standing,d1
  46800. move.b status(a0),d0
  46801. and.b d1,d0
  46802. bne.s Obj07_CheckKillChar2
  46803. cmpi.b #$30,oil_char2submersion(a0)
  46804. beq.s Obj07_CheckSupportChar2
  46805. addq.b #1,oil_char2submersion(a0)
  46806. bra.s Obj07_CheckSupportChar2
  46807. ; ---------------------------------------------------------------------------
  46808. ; loc_240B4:
  46809. Obj07_CheckKillChar2:
  46810. tst.b oil_char2submersion(a0)
  46811. beq.s Obj07_SuffocateCharacter
  46812. subq.b #1,oil_char2submersion(a0)
  46813.  
  46814. ; loc_240BE:
  46815. Obj07_CheckSupportChar2:
  46816. moveq #$20,d1
  46817. moveq #0,d3
  46818. move.b oil_char2submersion(a0),d3
  46819. moveq #p2_standing_bit,d6
  46820. move.w x_pos(a1),d4
  46821. move.w d4,x_pos(a0)
  46822. jsrto (PlatformObject_SingleCharacter).l, JmpTo_PlatformObject_SingleCharacter ; stop the character from falling past the oil
  46823.  
  46824. rts
  46825. ; ---------------------------------------------------------------------------
  46826. ; loc_240D6:
  46827. Obj07_SuffocateCharacter:
  46828. not.b d1
  46829. and.b d1,status(a0)
  46830. move.l a0,-(sp)
  46831. movea.l a0,a2
  46832. movea.l a1,a0
  46833. jsrto (KillCharacter).l, JmpTo3_KillCharacter
  46834. movea.l (sp)+,a0 ; load 0bj address
  46835.  
  46836. Obj07_End:
  46837. rts
  46838. ; ===========================================================================
  46839.  
  46840. if gameRevision<2
  46841. nop
  46842. endif
  46843.  
  46844. if ~~removeJmpTos
  46845. JmpTo3_KillCharacter
  46846. jmp (KillCharacter).l
  46847. JmpTo_PlatformObject_SingleCharacter
  46848. jmp (PlatformObject_SingleCharacter).l
  46849.  
  46850. align 4
  46851. endif
  46852.  
  46853.  
  46854.  
  46855.  
  46856. ; ===========================================================================
  46857. ; ----------------------------------------------------------------------------
  46858. ; Object 45 - Pressure spring from OOZ
  46859. ; ----------------------------------------------------------------------------
  46860. ; Sprite_240F8:
  46861. Obj45:
  46862. moveq #0,d0
  46863. move.b routine(a0),d0
  46864. move.w Obj45_Index(pc,d0.w),d1
  46865. jsr Obj45_Index(pc,d1.w)
  46866. jmpto (MarkObjGone).l, JmpTo11_MarkObjGone
  46867. ; ===========================================================================
  46868. ; off_2410A:
  46869. Obj45_Index: offsetTable
  46870. offsetTableEntry.w Obj45_Init ; 0
  46871. offsetTableEntry.w loc_24186 ; 2
  46872. offsetTableEntry.w loc_2427A ; 4
  46873. ; ===========================================================================
  46874. ; loc_24110:
  46875. Obj45_Init:
  46876. addq.b #2,routine(a0)
  46877. move.l #Obj45_MapUnc_2451A,mappings(a0)
  46878. move.w #make_art_tile(ArtTile_ArtNem_PushSpring,2,0),art_tile(a0)
  46879. ori.b #4,render_flags(a0)
  46880. move.b #$10,width_pixels(a0)
  46881. move.b #4,priority(a0)
  46882. move.b subtype(a0),d0
  46883. lsr.w #3,d0
  46884. andi.w #$E,d0
  46885. move.w Obj45_InitRoutines(pc,d0.w),d0
  46886. jmp Obj45_InitRoutines(pc,d0.w)
  46887. ; ===========================================================================
  46888. ; off_24146:
  46889. Obj45_InitRoutines: offsetTable
  46890. offsetTableEntry.w loc_2416E ; 0
  46891. offsetTableEntry.w loc_2414A ; 2
  46892. ; ===========================================================================
  46893.  
  46894. loc_2414A:
  46895. move.b #4,routine(a0)
  46896. move.b #1,anim(a0)
  46897. move.b #$A,mapping_frame(a0)
  46898. move.w #make_art_tile(ArtTile_ArtNem_PushSpring,2,0),art_tile(a0)
  46899. move.b #$14,width_pixels(a0)
  46900. move.w x_pos(a0),objoff_34(a0)
  46901.  
  46902. loc_2416E:
  46903. move.b subtype(a0),d0
  46904. andi.w #2,d0
  46905. move.w word_24182(pc,d0.w),objoff_30(a0)
  46906. jsrto (Adjust2PArtPointer).l, JmpTo20_Adjust2PArtPointer
  46907. rts
  46908. ; ===========================================================================
  46909. word_24182:
  46910. dc.w $F000
  46911. dc.w $F600 ; 1
  46912. ; ===========================================================================
  46913.  
  46914. loc_24186:
  46915. move.b status(a0),d0
  46916. andi.b #standing_mask,d0
  46917. bne.s loc_2419C
  46918. tst.b objoff_32(a0)
  46919. beq.s loc_241A8
  46920. subq.b #1,objoff_32(a0)
  46921. bra.s loc_241A8
  46922. ; ===========================================================================
  46923.  
  46924. loc_2419C:
  46925. cmpi.b #9,objoff_32(a0)
  46926. beq.s loc_241C6
  46927. addq.b #1,objoff_32(a0)
  46928.  
  46929. loc_241A8:
  46930. moveq #0,d3
  46931. move.b objoff_32(a0),d3
  46932. move.b d3,mapping_frame(a0)
  46933. add.w d3,d3
  46934. move.w #$1B,d1
  46935. move.w #$14,d2
  46936. move.w x_pos(a0),d4
  46937. jsrto (SolidObject45).l, JmpTo_SolidObject45
  46938. rts
  46939. ; ===========================================================================
  46940.  
  46941. loc_241C6:
  46942. lea (MainCharacter).w,a1 ; a1=character
  46943. moveq #p1_standing_bit,d6
  46944. bsr.s loc_241D4
  46945. lea (Sidekick).w,a1 ; a1=character
  46946. moveq #p2_standing_bit,d6
  46947.  
  46948. loc_241D4:
  46949. bclr d6,status(a0)
  46950. beq.w return_24278
  46951. move.w objoff_30(a0),y_vel(a1)
  46952. bset #1,status(a1)
  46953. bclr #3,status(a1)
  46954. move.b #AniIDSonAni_Spring,anim(a1)
  46955. move.b #2,routine(a1)
  46956. move.b subtype(a0),d0
  46957. bpl.s loc_24206
  46958. move.w #0,x_vel(a1)
  46959.  
  46960. loc_24206:
  46961. btst #0,d0
  46962. beq.s loc_24246
  46963. move.w #1,inertia(a1)
  46964. move.b #1,flip_angle(a1)
  46965. move.b #AniIDSonAni_Walk,anim(a1)
  46966. move.b #0,flips_remaining(a1)
  46967. move.b #4,flip_speed(a1)
  46968. btst #1,d0
  46969. bne.s loc_24236
  46970. move.b #1,flips_remaining(a1)
  46971.  
  46972. loc_24236:
  46973. btst #0,status(a1)
  46974. beq.s loc_24246
  46975. neg.b flip_angle(a1)
  46976. neg.w inertia(a1)
  46977.  
  46978. loc_24246:
  46979. andi.b #$C,d0
  46980. cmpi.b #4,d0
  46981. bne.s loc_2425C
  46982. move.b #$C,top_solid_bit(a1)
  46983. move.b #$D,lrb_solid_bit(a1)
  46984.  
  46985. loc_2425C:
  46986. cmpi.b #8,d0
  46987. bne.s loc_2426E
  46988. move.b #$E,top_solid_bit(a1)
  46989. move.b #$F,lrb_solid_bit(a1)
  46990.  
  46991. loc_2426E:
  46992. move.w #SndID_Spring,d0
  46993. jmp (PlaySound).l
  46994. ; ===========================================================================
  46995.  
  46996. return_24278:
  46997. rts
  46998. ; ===========================================================================
  46999.  
  47000. loc_2427A:
  47001. move.b #0,objoff_36(a0)
  47002. move.w #$1F,d1
  47003. move.w #$C,d2
  47004. move.w #$D,d3
  47005. move.w x_pos(a0),d4
  47006. lea (MainCharacter).w,a1 ; a1=character
  47007. moveq #p1_standing_bit,d6
  47008. movem.l d1-d4,-(sp)
  47009. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo_SolidObject_Always_SingleCharacter
  47010. cmpi.w #1,d4
  47011. bne.s loc_242C0
  47012. move.b status(a0),d1
  47013. move.w x_pos(a0),d2
  47014. sub.w x_pos(a1),d2
  47015. bcs.s loc_242B6
  47016. eori.b #1,d1
  47017.  
  47018. loc_242B6:
  47019. andi.b #1,d1
  47020. bne.s loc_242C0
  47021. bsr.w loc_2433C
  47022.  
  47023. loc_242C0:
  47024. movem.l (sp)+,d1-d4
  47025. lea (Sidekick).w,a1 ; a1=character
  47026. moveq #p2_standing_bit,d6
  47027. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo_SolidObject_Always_SingleCharacter
  47028. cmpi.w #1,d4
  47029. bne.s loc_242EE
  47030. move.b status(a0),d1
  47031. move.w x_pos(a0),d2
  47032. sub.w x_pos(a1),d2
  47033. bcs.s loc_242E6
  47034. eori.b #1,d1
  47035.  
  47036. loc_242E6:
  47037. andi.b #1,d1
  47038. bne.s loc_242EE
  47039. bsr.s loc_2433C
  47040.  
  47041. loc_242EE:
  47042. tst.b objoff_36(a0)
  47043. bne.s return_2433A
  47044. move.w objoff_34(a0),d0
  47045. cmp.w x_pos(a0),d0
  47046. beq.s return_2433A
  47047. bhs.s loc_2431C
  47048. subq.b #4,mapping_frame(a0)
  47049. subq.w #4,x_pos(a0)
  47050. cmp.w x_pos(a0),d0
  47051. blo.s loc_24336
  47052. move.b #$A,mapping_frame(a0)
  47053. move.w objoff_34(a0),x_pos(a0)
  47054. bra.s loc_24336
  47055. ; ===========================================================================
  47056.  
  47057. loc_2431C:
  47058. subq.b #4,mapping_frame(a0)
  47059. addq.w #4,x_pos(a0)
  47060. cmp.w x_pos(a0),d0
  47061. bhs.s loc_24336
  47062. move.b #$A,mapping_frame(a0)
  47063. move.w objoff_34(a0),x_pos(a0)
  47064.  
  47065. loc_24336:
  47066. bsr.w loc_243D0
  47067.  
  47068. return_2433A:
  47069. rts
  47070. ; ===========================================================================
  47071.  
  47072. loc_2433C:
  47073. btst #0,status(a0)
  47074. beq.s loc_24378
  47075. btst #0,status(a1)
  47076. bne.w return_243CE
  47077. tst.w d0
  47078. bne.w loc_2435E
  47079. tst.w inertia(a1)
  47080. beq.s return_243CE
  47081. bpl.s loc_243C8
  47082. bra.s return_243CE
  47083. ; ===========================================================================
  47084.  
  47085. loc_2435E:
  47086. move.w objoff_34(a0),d0
  47087. addi.w #$12,d0
  47088. cmp.w x_pos(a0),d0
  47089. beq.s loc_243C8
  47090. addq.w #1,x_pos(a0)
  47091. moveq #1,d0
  47092. move.w #$40,d1
  47093. bra.s loc_243A6
  47094. ; ===========================================================================
  47095.  
  47096. loc_24378:
  47097. btst #0,status(a1)
  47098. beq.s return_243CE
  47099. tst.w d0
  47100. bne.w loc_2438E
  47101. tst.w inertia(a1)
  47102. bmi.s loc_243C8
  47103. bra.s return_243CE
  47104. ; ===========================================================================
  47105.  
  47106. loc_2438E:
  47107. move.w objoff_34(a0),d0
  47108. subi.w #$12,d0
  47109. cmp.w x_pos(a0),d0
  47110. beq.s loc_243C8
  47111. subq.w #1,x_pos(a0)
  47112. moveq #-1,d0
  47113. move.w #-$40,d1
  47114.  
  47115. loc_243A6:
  47116. add.w d0,x_pos(a1)
  47117. move.w d1,inertia(a1)
  47118. move.w #0,x_vel(a1)
  47119. move.w objoff_34(a0),d0
  47120. sub.w x_pos(a0),d0
  47121. bcc.s loc_243C0
  47122. neg.w d0
  47123.  
  47124. loc_243C0:
  47125. addi.w #$A,d0
  47126. move.b d0,mapping_frame(a0)
  47127.  
  47128. loc_243C8:
  47129. move.b #1,objoff_36(a0)
  47130.  
  47131. return_243CE:
  47132. rts
  47133. ; ===========================================================================
  47134.  
  47135. loc_243D0:
  47136. move.b status(a0),d0
  47137. andi.b #pushing_mask,d0
  47138. beq.w return_244D0
  47139. lea (MainCharacter).w,a1 ; a1=character
  47140. moveq #p1_pushing_bit,d6
  47141. bsr.s loc_243EA
  47142. lea (Sidekick).w,a1 ; a1=character
  47143. moveq #p2_pushing_bit,d6
  47144.  
  47145. loc_243EA:
  47146. bclr d6,status(a0)
  47147. beq.w return_244D0
  47148. move.w objoff_34(a0),d0
  47149. sub.w x_pos(a0),d0
  47150. bcc.s loc_243FE
  47151. neg.w d0
  47152.  
  47153. loc_243FE:
  47154. addi.w #$A,d0
  47155. lsl.w #7,d0
  47156. neg.w d0
  47157. move.w d0,x_vel(a1)
  47158. subq.w #4,x_pos(a1)
  47159. bset #0,status(a1)
  47160. btst #0,status(a0)
  47161. bne.s loc_2442C
  47162. bclr #0,status(a1)
  47163. addi_.w #8,x_pos(a1)
  47164. neg.w x_vel(a1)
  47165.  
  47166. loc_2442C:
  47167. move.w #$F,move_lock(a1)
  47168. move.w x_vel(a1),inertia(a1)
  47169. btst #2,status(a1)
  47170. bne.s loc_24446
  47171. move.b #AniIDSonAni_Walk,anim(a1)
  47172.  
  47173. loc_24446:
  47174. move.b subtype(a0),d0
  47175. bpl.s loc_24452
  47176. move.w #0,y_vel(a1)
  47177.  
  47178. loc_24452:
  47179. btst #0,d0
  47180. beq.s loc_24492
  47181. move.w #1,inertia(a1)
  47182. move.b #1,flip_angle(a1)
  47183. move.b #AniIDSonAni_Walk,anim(a1)
  47184. move.b #1,flips_remaining(a1)
  47185. move.b #8,flip_speed(a1)
  47186. btst #1,d0
  47187. bne.s loc_24482
  47188. move.b #3,flips_remaining(a1)
  47189.  
  47190. loc_24482:
  47191. btst #0,status(a1)
  47192. beq.s loc_24492
  47193. neg.b flip_angle(a1)
  47194. neg.w inertia(a1)
  47195.  
  47196. loc_24492:
  47197. andi.b #$C,d0
  47198. cmpi.b #4,d0
  47199. bne.s loc_244A8
  47200. move.b #$C,top_solid_bit(a1)
  47201. move.b #$D,lrb_solid_bit(a1)
  47202.  
  47203. loc_244A8:
  47204. cmpi.b #8,d0
  47205. bne.s loc_244BA
  47206. move.b #$E,top_solid_bit(a1)
  47207. move.b #$F,lrb_solid_bit(a1)
  47208.  
  47209. loc_244BA:
  47210. bclr #5,status(a1)
  47211. move.b #AniIDSonAni_Run,next_anim(a1)
  47212. move.w #SndID_Spring,d0 ; play spring bounce sound
  47213. jmp (PlaySound).l
  47214. ; ===========================================================================
  47215.  
  47216. return_244D0:
  47217. rts
  47218. ; ===========================================================================
  47219. ; off_244D2:
  47220. ; Unused animation script
  47221. Ani_obj45: offsetTable
  47222. offsetTableEntry.w byte_244D6 ; 0
  47223. offsetTableEntry.w byte_244F8 ; 1
  47224. byte_244D6:
  47225. dc.b 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9, 9, 9
  47226. dc.b 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0; 16
  47227. dc.b 0,$FF ; 32
  47228. byte_244F8:
  47229. dc.b 0, $A, $B, $C, $D, $E, $F,$10,$11,$12,$13,$13,$13,$13,$13,$13
  47230. dc.b $13,$13,$12,$11,$10, $F, $E, $D, $C, $B, $A, $A, $A, $A, $A, $A; 16
  47231. dc.b $A,$FF ; 32
  47232. ; ----------------------------------------------------------------------------
  47233. ; sprite mappings
  47234. ; ----------------------------------------------------------------------------
  47235. Obj45_MapUnc_2451A: BINCLUDE "mappings/sprite/obj45.bin"
  47236. ; ===========================================================================
  47237. ; ----------------------------------------------------------------------------
  47238. ; Object 46 - Ball from OOZ (unused, beta leftover)
  47239. ; ----------------------------------------------------------------------------
  47240. ; Sprite_24A16:
  47241. Obj46:
  47242. moveq #0,d0
  47243. move.b routine(a0),d0
  47244. move.w Obj46_Index(pc,d0.w),d1
  47245. jmp Obj46_Index(pc,d1.w)
  47246. ; ===========================================================================
  47247. ; off_24A24:
  47248. Obj46_Index: offsetTable
  47249. offsetTableEntry.w Obj46_Init ; 0 - Init
  47250. offsetTableEntry.w Obj46_Inactive ; 2 - Ball inactive
  47251. offsetTableEntry.w Obj46_Moving ; 4 - Ball moving
  47252. offsetTableEntry.w Obj46_PressureSpring ; 6 - Pressure Spring
  47253. ; ===========================================================================
  47254. ; loc_24A2C:
  47255. Obj46_Init:
  47256. lea (Object_Respawn_Table).w,a2
  47257. moveq #0,d0
  47258. move.b respawn_index(a0),d0
  47259. beq.s +
  47260. bclr #7,2(a2,d0.w)
  47261. bset #0,2(a2,d0.w)
  47262. bne.w JmpTo25_DeleteObject
  47263. +
  47264. ; loads the ball itself
  47265. addq.b #2,routine(a0)
  47266. move.b #$F,y_radius(a0)
  47267. move.b #$F,x_radius(a0)
  47268. move.l #Obj46_MapUnc_24C52,mappings(a0)
  47269. move.w #make_art_tile(ArtTile_ArtNem_BallThing,3,0),art_tile(a0)
  47270. jsrto (Adjust2PArtPointer).l, JmpTo20_Adjust2PArtPointer
  47271. move.b #4,render_flags(a0)
  47272. move.b #3,priority(a0)
  47273. move.w x_pos(a0),objoff_34(a0)
  47274. move.w y_pos(a0),objoff_36(a0)
  47275. move.b #$10,width_pixels(a0)
  47276. move.b #0,mapping_frame(a0)
  47277. move.w #0,objoff_14(a0)
  47278. move.b #1,objoff_1F(a0)
  47279.  
  47280. ; Obj46_InitPressureSpring: ; loads the spring under the ball
  47281. jsrto (SingleObjLoad).l, JmpTo4_SingleObjLoad
  47282. bne.s +
  47283. _move.b #ObjID_OOZBall,id(a1) ; load obj46
  47284. addq.b #6,routine(a1)
  47285. move.w x_pos(a0),x_pos(a1)
  47286. move.w y_pos(a0),y_pos(a1)
  47287. addi.w #$12,y_pos(a1)
  47288. move.l #Obj45_MapUnc_2451A,mappings(a1)
  47289. move.w #make_art_tile(ArtTile_ArtNem_PushSpring,2,0),art_tile(a1)
  47290. ori.b #4,render_flags(a1)
  47291. move.b #$10,width_pixels(a1)
  47292. move.b #4,priority(a1)
  47293. move.b #9,mapping_frame(a1)
  47294. move.l a0,objoff_3C(a1)
  47295. +
  47296. move.l a1,objoff_3C(a0)
  47297. ; loc_24AEA:
  47298. Obj46_Inactive:
  47299. btst #button_A,(Ctrl_2_Press).w
  47300. bne.s +
  47301. lea (ButtonVine_Trigger).w,a2
  47302. moveq #0,d0
  47303. move.b subtype(a0),d0
  47304. lsr.w #4,d0
  47305. tst.b (a2,d0.w)
  47306. beq.s ++
  47307. +
  47308. addq.b #2,routine(a0)
  47309. bset #1,status(a0)
  47310. move.w #-$300,y_vel(a0)
  47311. move.w #$100,objoff_14(a0)
  47312. movea.l objoff_3C(a0),a1 ; a1=object
  47313. move.b #1,objoff_30(a1)
  47314. btst #0,status(a0)
  47315. beq.s +
  47316. neg.w objoff_14(a0)
  47317. +
  47318. bsr.w loc_24BF0
  47319. jmpto (MarkObjGone).l, JmpTo11_MarkObjGone
  47320. ; ===========================================================================
  47321. ; loc_24B38:
  47322. Obj46_Moving:
  47323. move.w x_pos(a0),-(sp)
  47324. jsrto (ObjectMove).l, JmpTo9_ObjectMove
  47325. btst #1,status(a0)
  47326. beq.s loc_24B8C
  47327. addi.w #$18,y_vel(a0)
  47328. bmi.s +
  47329. move.w (Camera_Max_Y_pos_now).w,d0
  47330. addi.w #$E0,d0
  47331. cmp.w y_pos(a0),d0
  47332. blo.s loc_24BC4
  47333. jsr (ObjCheckFloorDist).l
  47334. tst.w d1
  47335. bpl.w +
  47336. add.w d1,y_pos(a0)
  47337. clr.w y_vel(a0)
  47338. bclr #1,status(a0)
  47339. move.w #$100,x_vel(a0)
  47340. btst #0,status(a0)
  47341. beq.s +
  47342. neg.w x_vel(a0)
  47343. +
  47344. bra.s loc_24BA4
  47345. ; ===========================================================================
  47346.  
  47347. loc_24B8C:
  47348. jsr (ObjCheckFloorDist).l
  47349. cmpi.w #8,d1
  47350. blt.s loc_24BA0
  47351. bset #1,status(a0)
  47352. bra.s loc_24BA4
  47353. ; ===========================================================================
  47354.  
  47355. loc_24BA0:
  47356. add.w d1,y_pos(a0)
  47357.  
  47358. loc_24BA4:
  47359. moveq #0,d1
  47360. move.b width_pixels(a0),d1
  47361. addi.w #$B,d1
  47362. move.w #$10,d2
  47363. move.w #$11,d3
  47364. move.w (sp)+,d4
  47365. jsrto (SolidObject).l, JmpTo5_SolidObject
  47366. bsr.w loc_24BF0
  47367. jmpto (MarkObjGone).l, JmpTo11_MarkObjGone
  47368. ; ===========================================================================
  47369.  
  47370. loc_24BC4:
  47371. move.w (sp)+,d4
  47372. lea (Object_Respawn_Table).w,a2
  47373. moveq #0,d0
  47374. move.b respawn_index(a0),d0
  47375. beq.s BranchTo_JmpTo25_DeleteObject
  47376. bclr #7,2(a2,d0.w)
  47377.  
  47378. if removeJmpTos
  47379. JmpTo25_DeleteObject
  47380. endif
  47381.  
  47382. BranchTo_JmpTo25_DeleteObject
  47383. jmpto (DeleteObject).l, JmpTo25_DeleteObject
  47384. ; ===========================================================================
  47385. ; loc_24BDC:
  47386. Obj46_PressureSpring:
  47387. tst.b objoff_30(a0)
  47388. beq.s +
  47389. subq.b #1,mapping_frame(a0)
  47390. bne.s +
  47391. clr.b objoff_30(a0)
  47392. +
  47393. jmpto (MarkObjGone).l, JmpTo11_MarkObjGone
  47394. ; ===========================================================================
  47395.  
  47396. loc_24BF0:
  47397. tst.b mapping_frame(a0)
  47398. beq.s +
  47399. move.b #0,mapping_frame(a0)
  47400. rts
  47401. ; ===========================================================================
  47402. +
  47403. move.b objoff_14(a0),d0
  47404. beq.s loc_24C2A
  47405. bmi.s loc_24C32
  47406. subq.b #1,anim_frame_duration(a0)
  47407. bpl.s loc_24C2A
  47408. neg.b d0
  47409. addq.b #8,d0
  47410. bcs.s +
  47411. moveq #0,d0
  47412. +
  47413. move.b d0,anim_frame_duration(a0)
  47414. move.b objoff_1F(a0),d0
  47415. addq.b #1,d0
  47416. cmpi.b #4,d0
  47417. bne.s +
  47418. moveq #1,d0
  47419. +
  47420. move.b d0,objoff_1F(a0)
  47421.  
  47422. loc_24C2A:
  47423. move.b objoff_1F(a0),mapping_frame(a0)
  47424. rts
  47425. ; ===========================================================================
  47426.  
  47427. loc_24C32:
  47428. subq.b #1,anim_frame_duration(a0)
  47429. bpl.s loc_24C2A
  47430. addq.b #8,d0
  47431. bcs.s +
  47432. moveq #0,d0
  47433. +
  47434. move.b d0,anim_frame_duration(a0)
  47435. move.b objoff_1F(a0),d0
  47436. subq.b #1,d0
  47437. bne.s +
  47438. moveq #3,d0
  47439. +
  47440. move.b d0,objoff_1F(a0)
  47441. bra.s loc_24C2A
  47442. ; ===========================================================================
  47443. ; ----------------------------------------------------------------------------
  47444. ; Unused sprite mappings
  47445. ; ----------------------------------------------------------------------------
  47446. Obj46_MapUnc_24C52: BINCLUDE "mappings/sprite/obj46.bin"
  47447. ; ===========================================================================
  47448.  
  47449. if gameRevision<2
  47450. nop
  47451. endif
  47452.  
  47453. if ~~removeJmpTos
  47454. JmpTo25_DeleteObject
  47455. jmp (DeleteObject).l
  47456. JmpTo4_SingleObjLoad
  47457. jmp (SingleObjLoad).l
  47458. ; some of these are still used, for some reason:
  47459. JmpTo11_MarkObjGone
  47460. jmp (MarkObjGone).l
  47461. JmpTo20_Adjust2PArtPointer
  47462. jmp (Adjust2PArtPointer).l
  47463. JmpTo5_SolidObject
  47464. jmp (SolidObject).l
  47465. JmpTo_SolidObject_Always_SingleCharacter
  47466. jmp (SolidObject_Always_SingleCharacter).l
  47467. JmpTo_SolidObject45
  47468. jmp (SolidObject45).l
  47469. ; loc_24CEE:
  47470. JmpTo9_ObjectMove
  47471. jmp (ObjectMove).l
  47472.  
  47473. align 4
  47474. endif
  47475.  
  47476.  
  47477.  
  47478.  
  47479. ; ===========================================================================
  47480. ; ----------------------------------------------------------------------------
  47481. ; Object 47 - Button
  47482. ; ----------------------------------------------------------------------------
  47483. ; Sprite_24CF4:
  47484. Obj47:
  47485. moveq #0,d0
  47486. move.b routine(a0),d0
  47487. move.w Obj47_Index(pc,d0.w),d1
  47488. jmp Obj47_Index(pc,d1.w)
  47489. ; ===========================================================================
  47490. ; off_24D02:
  47491. Obj47_Index: offsetTable
  47492. offsetTableEntry.w Obj47_Init ; 0
  47493. offsetTableEntry.w Obj47_Main ; 2
  47494. ; ===========================================================================
  47495. ; loc_24D06:
  47496. Obj47_Init:
  47497. addq.b #2,routine(a0)
  47498. move.l #Obj47_MapUnc_24D96,mappings(a0)
  47499. move.w #make_art_tile(ArtTile_ArtNem_Button,0,0),art_tile(a0)
  47500. jsrto (Adjust2PArtPointer).l, JmpTo21_Adjust2PArtPointer
  47501. move.b #4,render_flags(a0)
  47502. move.b #$10,width_pixels(a0)
  47503. move.b #4,priority(a0)
  47504. addq.w #4,y_pos(a0)
  47505. ; loc_24D32:
  47506. Obj47_Main:
  47507. tst.b render_flags(a0)
  47508. bpl.s BranchTo_JmpTo12_MarkObjGone
  47509. move.w #$1B,d1
  47510. move.w #4,d2
  47511. move.w #5,d3
  47512. move.w x_pos(a0),d4
  47513. jsrto (SolidObject).l, JmpTo6_SolidObject
  47514. move.b #0,mapping_frame(a0)
  47515. move.b subtype(a0),d0
  47516. andi.w #$F,d0
  47517. lea (ButtonVine_Trigger).w,a3
  47518. lea (a3,d0.w),a3
  47519. moveq #0,d3
  47520. btst #6,subtype(a0)
  47521. beq.s +
  47522. moveq #7,d3
  47523. +
  47524. move.b status(a0),d0
  47525. andi.b #standing_mask,d0
  47526. bne.s +
  47527. bclr d3,(a3)
  47528. bra.s BranchTo_JmpTo12_MarkObjGone
  47529. ; ===========================================================================
  47530. +
  47531. tst.b (a3)
  47532. bne.s +
  47533. move.w #SndID_Blip,d0
  47534. jsr (PlaySound).l
  47535. +
  47536. bset d3,(a3)
  47537. move.b #1,mapping_frame(a0)
  47538.  
  47539. BranchTo_JmpTo12_MarkObjGone
  47540. jmpto (MarkObjGone).l, JmpTo12_MarkObjGone
  47541. ; ===========================================================================
  47542. ; ----------------------------------------------------------------------------
  47543. ; sprite mappings
  47544. ; ----------------------------------------------------------------------------
  47545. Obj47_MapUnc_24D96: BINCLUDE "mappings/sprite/obj47.bin"
  47546. ; ===========================================================================
  47547.  
  47548. if gameRevision<2
  47549. nop
  47550. endif
  47551.  
  47552. if ~~removeJmpTos
  47553. JmpTo12_MarkObjGone
  47554. jmp (MarkObjGone).l
  47555. JmpTo21_Adjust2PArtPointer
  47556. jmp (Adjust2PArtPointer).l
  47557. JmpTo6_SolidObject
  47558. jmp (SolidObject).l
  47559.  
  47560. align 4
  47561. endif
  47562.  
  47563.  
  47564.  
  47565.  
  47566. ; ===========================================================================
  47567. ; ----------------------------------------------------------------------------
  47568. ; Object 3D - Block thingy in OOZ that launches you into the round ball things
  47569. ; ----------------------------------------------------------------------------
  47570. ; Sprite_24DD0:
  47571. Obj3D:
  47572. moveq #0,d0
  47573. move.b routine(a0),d0
  47574. move.w Obj3D_Index(pc,d0.w),d1
  47575. jmp Obj3D_Index(pc,d1.w)
  47576. ; ===========================================================================
  47577. ; off_24DDE:
  47578. Obj3D_Index: offsetTable
  47579. offsetTableEntry.w Obj3D_Init ; 0
  47580. offsetTableEntry.w Obj3D_Main ; 2
  47581. offsetTableEntry.w Obj3D_Fragment ; 4
  47582. offsetTableEntry.w Obj3D_InvisibleLauncher ; 6
  47583. ; ===========================================================================
  47584. ; loc_24DE6:
  47585. Obj3D_Init:
  47586. addq.b #2,routine(a0)
  47587. move.l #Obj3D_MapUnc_250BA,mappings(a0)
  47588. move.w #make_art_tile(ArtTile_ArtNem_StripedBlocksVert,3,0),art_tile(a0)
  47589. tst.b subtype(a0)
  47590. beq.s +
  47591. move.w #make_art_tile(ArtTile_ArtNem_StripedBlocksHoriz,3,0),art_tile(a0)
  47592. move.b #2,mapping_frame(a0)
  47593. +
  47594. jsrto (Adjust2PArtPointer).l, JmpTo22_Adjust2PArtPointer
  47595. move.b #4,render_flags(a0)
  47596. move.b #$10,width_pixels(a0)
  47597. bset #7,status(a0)
  47598. move.b #4,priority(a0)
  47599. ; loc_24E26:
  47600. Obj3D_Main:
  47601. move.b (MainCharacter+anim).w,objoff_32(a0)
  47602. move.b (Sidekick+anim).w,objoff_33(a0)
  47603. move.w (MainCharacter+y_vel).w,objoff_34(a0)
  47604. move.w (Sidekick+y_vel).w,objoff_36(a0)
  47605. move.w #$1B,d1
  47606. move.w #$10,d2
  47607. move.w #$11,d3
  47608. move.w x_pos(a0),d4
  47609. jsrto (SolidObject).l, JmpTo7_SolidObject
  47610. move.b status(a0),d0
  47611. andi.b #standing_mask,d0
  47612. bne.s loc_24E60
  47613.  
  47614. BranchTo_JmpTo13_MarkObjGone
  47615. jmpto (MarkObjGone).l, JmpTo13_MarkObjGone
  47616. ; ===========================================================================
  47617.  
  47618. loc_24E60:
  47619. cmpi.b #standing_mask,d0
  47620. bne.s loc_24E96
  47621. cmpi.b #AniIDSonAni_Roll,objoff_32(a0)
  47622. beq.s loc_24E76
  47623. cmpi.b #AniIDSonAni_Roll,objoff_33(a0)
  47624. bne.s BranchTo_JmpTo13_MarkObjGone
  47625.  
  47626. loc_24E76:
  47627. lea (MainCharacter).w,a1 ; a1=character
  47628. move.b objoff_32(a0),d0
  47629. move.w objoff_34(a0),d1
  47630. bsr.s loc_24EB2
  47631. lea (Sidekick).w,a1 ; a1=character
  47632. move.b objoff_33(a0),d0
  47633. move.w objoff_36(a0),d1
  47634. bsr.s loc_24EB2
  47635. bra.w loc_24F04
  47636. ; ===========================================================================
  47637.  
  47638. loc_24E96:
  47639. move.b d0,d1
  47640. andi.b #p1_standing,d1
  47641. beq.s loc_24EE8
  47642. cmpi.b #AniIDSonAni_Roll,objoff_32(a0)
  47643. bne.s BranchTo_JmpTo13_MarkObjGone
  47644. lea (MainCharacter).w,a1 ; a1=character
  47645. move.w objoff_34(a0),d1
  47646. bsr.s loc_24EB8
  47647. bra.s loc_24F04
  47648. ; ===========================================================================
  47649.  
  47650. loc_24EB2:
  47651. cmpi.b #AniIDSonAni_Roll,d0
  47652. bne.s loc_24ED4
  47653.  
  47654. loc_24EB8:
  47655. bset #2,status(a1)
  47656. move.b #$E,y_radius(a1)
  47657. move.b #7,x_radius(a1)
  47658. move.b #AniIDSonAni_Roll,anim(a1)
  47659. move.w d1,y_vel(a1)
  47660.  
  47661. loc_24ED4:
  47662. bset #1,status(a1)
  47663. bclr #3,status(a1)
  47664. move.b #2,routine(a1)
  47665. rts
  47666. ; ===========================================================================
  47667.  
  47668. loc_24EE8:
  47669. andi.b #p2_standing,d0
  47670. beq.w BranchTo_JmpTo13_MarkObjGone
  47671. cmpi.b #AniIDSonAni_Roll,objoff_33(a0)
  47672. bne.w BranchTo_JmpTo13_MarkObjGone
  47673. lea (Sidekick).w,a1 ; a1=character
  47674. move.w objoff_36(a0),d1
  47675. bsr.s loc_24EB8
  47676.  
  47677. loc_24F04:
  47678. andi.b #~standing_mask,status(a0)
  47679. jsrto (SingleObjLoad2).l, JmpTo9_SingleObjLoad2
  47680. bne.s loc_24F28
  47681. moveq #0,d0
  47682. move.w #$A,d1
  47683.  
  47684. loc_24F16:
  47685. move.l (a0,d0.w),(a1,d0.w)
  47686. addq.w #4,d0
  47687. dbf d1,loc_24F16
  47688. move.b #6,routine(a1)
  47689.  
  47690. loc_24F28:
  47691. lea (word_2507A).l,a4
  47692. addq.b #1,mapping_frame(a0)
  47693. moveq #$F,d1
  47694. move.w #$18,d2
  47695. jsrto (BreakObjectToPieces).l, JmpTo2_BreakObjectToPieces
  47696. ; loc_24F3C:
  47697. Obj3D_Fragment:
  47698. jsrto (ObjectMove).l, JmpTo10_ObjectMove
  47699. addi.w #$18,y_vel(a0)
  47700. tst.b render_flags(a0)
  47701. bpl.w JmpTo26_DeleteObject
  47702. jmpto (DisplaySprite).l, JmpTo14_DisplaySprite
  47703. ; ===========================================================================
  47704. ; loc_24F52:
  47705. Obj3D_InvisibleLauncher:
  47706. lea (MainCharacter).w,a1 ; a1=character
  47707. lea objoff_2C(a0),a4
  47708. bsr.s loc_24F74
  47709. lea (Sidekick).w,a1 ; a1=character
  47710. lea objoff_36(a0),a4
  47711. bsr.s loc_24F74
  47712. move.b objoff_2C(a0),d0
  47713. add.b objoff_36(a0),d0
  47714. beq.w JmpTo3_MarkObjGone3
  47715. rts
  47716. ; ===========================================================================
  47717.  
  47718. loc_24F74:
  47719. moveq #0,d0
  47720. move.b (a4),d0
  47721. move.w off_24F80(pc,d0.w),d0
  47722. jmp off_24F80(pc,d0.w)
  47723. ; ===========================================================================
  47724. off_24F80: offsetTable
  47725. offsetTableEntry.w loc_24F84 ; 0
  47726. offsetTableEntry.w loc_25036 ; 2
  47727. ; ===========================================================================
  47728.  
  47729. loc_24F84:
  47730. move.w x_pos(a1),d0
  47731. sub.w x_pos(a0),d0
  47732. addi.w #$10,d0
  47733. cmpi.w #$20,d0
  47734. bhs.w return_25034
  47735. move.w y_pos(a1),d1
  47736. sub.w y_pos(a0),d1
  47737. tst.b subtype(a0)
  47738. beq.s loc_24FAA
  47739. addi.w #$10,d1
  47740.  
  47741. loc_24FAA:
  47742. cmpi.w #$10,d1
  47743. bhs.w return_25034
  47744. cmpa.w #Sidekick,a1
  47745. bne.s loc_24FC2
  47746. cmpi.w #4,(Tails_CPU_routine).w ; TailsCPU_Flying
  47747. beq.w return_25034
  47748.  
  47749. loc_24FC2:
  47750. addq.b #2,(a4)
  47751. move.b #$81,obj_control(a1)
  47752. move.b #AniIDSonAni_Roll,anim(a1)
  47753. move.w #$800,inertia(a1)
  47754. tst.b subtype(a0)
  47755. beq.s loc_24FF0
  47756. move.w x_pos(a0),x_pos(a1)
  47757. move.w #0,x_vel(a1)
  47758. move.w #-$800,y_vel(a1)
  47759. bra.s loc_25002
  47760. ; ===========================================================================
  47761.  
  47762. loc_24FF0:
  47763. move.w y_pos(a0),y_pos(a1)
  47764. move.w #$800,x_vel(a1)
  47765. move.w #0,y_vel(a1)
  47766.  
  47767. loc_25002:
  47768. bclr #5,status(a0)
  47769. bclr #5,status(a1)
  47770. bset #1,status(a1)
  47771. bset #3,status(a1)
  47772. move.w a0,d0
  47773. subi.w #Object_RAM,d0
  47774. if object_size=$40
  47775. lsr.w #6,d0
  47776. else
  47777. divu.w #object_size,d0
  47778. endif
  47779. andi.w #$7F,d0
  47780. move.b d0,interact(a1)
  47781. move.w #SndID_Roll,d0
  47782. jsr (PlaySound).l
  47783.  
  47784. return_25034:
  47785. rts
  47786. ; ===========================================================================
  47787.  
  47788. loc_25036:
  47789. tst.b render_flags(a1)
  47790. bmi.s Obj3D_MoveCharacter
  47791. move.b #0,obj_control(a1)
  47792. bset #1,status(a1)
  47793. bclr #3,status(a1)
  47794. move.b #0,(a4)
  47795. rts
  47796. ; ===========================================================================
  47797. ; update the position of Sonic/Tails from the block thing to the launcher
  47798. ; loc_25054:
  47799. Obj3D_MoveCharacter:
  47800. move.l x_pos(a1),d2
  47801. move.l y_pos(a1),d3
  47802. move.w x_vel(a1),d0
  47803. ext.l d0
  47804. asl.l #8,d0
  47805. add.l d0,d2
  47806. move.w y_vel(a1),d0
  47807. ext.l d0
  47808. asl.l #8,d0
  47809. add.l d0,d3
  47810. move.l d2,x_pos(a1)
  47811. move.l d3,y_pos(a1)
  47812. rts
  47813. ; ===========================================================================
  47814. word_2507A:
  47815. dc.w -$400,-$400 ; 0
  47816. dc.w -$200,-$400 ; 2
  47817. dc.w $200,-$400 ; 4
  47818. dc.w $400,-$400 ; 6
  47819. dc.w -$3C0,-$200 ; 8
  47820. dc.w -$1C0,-$200 ; 10
  47821. dc.w $1C0,-$200 ; 12
  47822. dc.w $3C0,-$200 ; 14
  47823. dc.w -$380, $200 ; 16
  47824. dc.w -$180, $200 ; 18
  47825. dc.w $180, $200 ; 20
  47826. dc.w $380, $200 ; 22
  47827. dc.w -$340, $400 ; 24
  47828. dc.w -$140, $400 ; 26
  47829. dc.w $140, $400 ; 28
  47830. dc.w $340, $400 ; 30
  47831. ; ----------------------------------------------------------------------------
  47832. ; sprite mappings
  47833. ; ----------------------------------------------------------------------------
  47834. Obj3D_MapUnc_250BA: BINCLUDE "mappings/sprite/obj3D.bin"
  47835. ; ===========================================================================
  47836.  
  47837. if gameRevision<2
  47838. nop
  47839. endif
  47840.  
  47841. if ~~removeJmpTos
  47842. JmpTo14_DisplaySprite
  47843. jmp (DisplaySprite).l
  47844. JmpTo26_DeleteObject
  47845. jmp (DeleteObject).l
  47846. JmpTo13_MarkObjGone
  47847. jmp (MarkObjGone).l
  47848. JmpTo9_SingleObjLoad2
  47849. jmp (SingleObjLoad2).l
  47850. JmpTo3_MarkObjGone3
  47851. jmp (MarkObjGone3).l
  47852. JmpTo22_Adjust2PArtPointer
  47853. jmp (Adjust2PArtPointer).l
  47854. JmpTo2_BreakObjectToPieces
  47855. jmp (BreakObjectToPieces).l
  47856. JmpTo7_SolidObject
  47857. jmp (SolidObject).l
  47858. ; loc_2523C:
  47859. JmpTo10_ObjectMove
  47860. jmp (ObjectMove).l
  47861.  
  47862. align 4
  47863. else
  47864. JmpTo3_MarkObjGone3
  47865. jmp (MarkObjGone3).l
  47866. JmpTo26_DeleteObject
  47867. jmp (DeleteObject).l
  47868. ; Unused
  47869. ;JmpTo13_MarkObjGone
  47870. jmp (MarkObjGone).l
  47871. endif
  47872.  
  47873.  
  47874.  
  47875.  
  47876. ; ===========================================================================
  47877. ; ----------------------------------------------------------------------------
  47878. ; Object 48 - Round ball thing from OOZ that fires you off in a different direction (sphere)
  47879. ; ----------------------------------------------------------------------------
  47880. ; Sprite_25244:
  47881. Obj48:
  47882. moveq #0,d0
  47883. move.b routine(a0),d0
  47884. move.w Obj48_Index(pc,d0.w),d1
  47885. jsr Obj48_Index(pc,d1.w)
  47886. move.b objoff_2C(a0),d0
  47887. add.b objoff_36(a0),d0
  47888. beq.w JmpTo14_MarkObjGone
  47889. jmpto (DisplaySprite).l, JmpTo15_DisplaySprite
  47890.  
  47891. if removeJmpTos
  47892. JmpTo14_MarkObjGone
  47893. jmp (MarkObjGone).l
  47894. endif
  47895. ; ===========================================================================
  47896. ; off_25262:
  47897. Obj48_Index: offsetTable
  47898. offsetTableEntry.w Obj48_Init ; 0
  47899. offsetTableEntry.w Obj48_Main ; 2
  47900. ; ===========================================================================
  47901. ; byte_25266:
  47902. Obj48_Properties:
  47903. ; render_flags
  47904. ; objoff_3F
  47905. dc.b 4, 0 ; 0
  47906. dc.b 6, 7 ; 2
  47907. dc.b 7, 0 ; 4
  47908. dc.b 5, 7 ; 6
  47909. dc.b 5, 0 ; 8
  47910. dc.b 4, 7 ; 10
  47911. dc.b 6, 0 ; 12
  47912. dc.b 7, 7 ; 14
  47913. ; ===========================================================================
  47914. ; loc_25276:
  47915. Obj48_Init:
  47916. addq.b #2,routine(a0)
  47917. move.l #Obj48_MapUnc_254FE,mappings(a0)
  47918. move.w #make_art_tile(ArtTile_ArtNem_LaunchBall,3,0),art_tile(a0)
  47919. jsrto (Adjust2PArtPointer).l, JmpTo23_Adjust2PArtPointer
  47920. move.b subtype(a0),d0
  47921. andi.w #$F,d0
  47922. btst #0,status(a0)
  47923. beq.s +
  47924. addq.w #4,d0
  47925. +
  47926. add.w d0,d0
  47927. move.b Obj48_Properties(pc,d0.w),render_flags(a0)
  47928. move.b Obj48_Properties+1(pc,d0.w),objoff_3F(a0)
  47929. beq.s +
  47930. move.b #1,objoff_3E(a0)
  47931. +
  47932. move.b objoff_3F(a0),mapping_frame(a0)
  47933. move.b #$28,width_pixels(a0)
  47934. move.b #1,priority(a0)
  47935. ; loc_252C6:
  47936. Obj48_Main:
  47937. lea (MainCharacter).w,a1 ; a1=character
  47938. lea objoff_2C(a0),a4
  47939. moveq #objoff_2C,d2
  47940. bsr.s loc_252DC
  47941. lea (Sidekick).w,a1 ; a1=character
  47942. lea objoff_36(a0),a4
  47943. moveq #objoff_36,d2
  47944.  
  47945. loc_252DC:
  47946. moveq #0,d0
  47947. move.b (a4),d0
  47948. move.w Obj48_Modes(pc,d0.w),d0
  47949. jmp Obj48_Modes(pc,d0.w)
  47950. ; ===========================================================================
  47951. ; off_252E8:
  47952. Obj48_Modes: offsetTable
  47953. offsetTableEntry.w loc_252F0 ; 0
  47954. offsetTableEntry.w loc_253C6 ; 2
  47955. offsetTableEntry.w loc_25474 ; 4
  47956. offsetTableEntry.w loc_254F2 ; 6
  47957. ; ===========================================================================
  47958.  
  47959. loc_252F0:
  47960. tst.w (Debug_placement_mode).w
  47961. bne.w return_253C4
  47962. move.w x_pos(a1),d0
  47963. sub.w x_pos(a0),d0
  47964. addi.w #$10,d0
  47965. cmpi.w #$20,d0
  47966. bhs.w return_253C4
  47967. move.w y_pos(a1),d1
  47968. sub.w y_pos(a0),d1
  47969. addi.w #$10,d1
  47970. cmpi.w #$20,d1
  47971. bhs.w return_253C4
  47972. cmpa.w #Sidekick,a1
  47973. bne.s +
  47974. cmpi.w #4,(Tails_CPU_routine).w ; TailsCPU_Flying
  47975. beq.w return_253C4
  47976. +
  47977. cmpi.b #6,routine(a1)
  47978. bhs.w return_253C4
  47979. tst.w (Debug_placement_mode).w
  47980. bne.w return_253C4
  47981. btst #3,status(a1)
  47982. beq.s +
  47983. moveq #0,d0
  47984. move.b interact(a1),d0
  47985. if object_size=$40
  47986. lsl.w #6,d0
  47987. else
  47988. mulu.w #object_size,d0
  47989. endif
  47990. addi.l #Object_RAM,d0
  47991. movea.l d0,a3 ; a3=object
  47992. move.b #0,(a3,d2.w)
  47993. +
  47994. move.w a0,d0
  47995. subi.w #Object_RAM,d0
  47996. if object_size=$40
  47997. lsr.w #6,d0
  47998. else
  47999. divu.w #object_size,d0
  48000. endif
  48001. andi.w #$7F,d0
  48002. move.b d0,interact(a1)
  48003. addq.b #2,(a4)
  48004. move.w x_pos(a0),x_pos(a1)
  48005. move.w y_pos(a0),y_pos(a1)
  48006. move.b #$81,obj_control(a1)
  48007. move.b #2,anim(a1)
  48008. move.w #$1000,inertia(a1)
  48009. move.w #0,x_vel(a1)
  48010. move.w #0,y_vel(a1)
  48011. bclr #5,status(a0)
  48012. bclr #5,status(a1)
  48013. bset #1,status(a1)
  48014. bset #3,status(a1)
  48015. move.b objoff_3F(a0),mapping_frame(a0)
  48016. move.w #SndID_Roll,d0
  48017. jsr (PlaySound).l
  48018.  
  48019. return_253C4:
  48020. rts
  48021. ; ===========================================================================
  48022.  
  48023. loc_253C6:
  48024. tst.b objoff_3E(a0)
  48025. bne.s loc_253EE
  48026. cmpi.b #7,mapping_frame(a0)
  48027. beq.s loc_25408
  48028. subq.w #1,anim_frame_duration(a0)
  48029. bpl.s return_253EC
  48030. move.w #7,anim_frame_duration(a0)
  48031. addq.b #1,mapping_frame(a0)
  48032. cmpi.b #7,mapping_frame(a0)
  48033. beq.s loc_25408
  48034.  
  48035. return_253EC:
  48036. rts
  48037. ; ===========================================================================
  48038.  
  48039. loc_253EE:
  48040. tst.b mapping_frame(a0)
  48041. beq.s loc_25408
  48042. subq.w #1,anim_frame_duration(a0)
  48043. bpl.s return_253EC
  48044. move.w #7,anim_frame_duration(a0)
  48045. subq.b #1,mapping_frame(a0)
  48046. beq.s loc_25408
  48047. rts
  48048. ; ===========================================================================
  48049.  
  48050. loc_25408:
  48051. addq.b #2,(a4)
  48052. move.b subtype(a0),d0
  48053. addq.b #1,d0
  48054. btst #0,status(a0)
  48055. beq.s +
  48056. subq.b #2,d0
  48057. +
  48058. andi.w #3,d0
  48059. add.w d0,d0
  48060. add.w d0,d0
  48061. move.w word_25464(pc,d0.w),x_vel(a1)
  48062. move.w word_25464+2(pc,d0.w),y_vel(a1)
  48063. move.w #3,anim_frame_duration(a0)
  48064. tst.b subtype(a0)
  48065. bpl.s return_25462
  48066. move.b #0,obj_control(a1)
  48067. bset #1,status(a1)
  48068. bclr #3,status(a1)
  48069. move.b #0,jumping(a1)
  48070. move.b #2,routine(a1)
  48071. move.b #6,(a4)
  48072. move.w #7,objoff_3C(a0)
  48073.  
  48074. return_25462:
  48075. rts
  48076. ; ===========================================================================
  48077. word_25464:
  48078. dc.w 0,-$1000
  48079. dc.w $1000, 0 ; 2
  48080. dc.w 0, $1000 ; 4
  48081. dc.w -$1000, 0 ; 6
  48082. ; ===========================================================================
  48083.  
  48084. loc_25474:
  48085. tst.b render_flags(a1)
  48086. bmi.s loc_25492
  48087. move.b #0,obj_control(a1)
  48088. bset #1,status(a1)
  48089. bclr #3,status(a1)
  48090. move.b #0,(a4)
  48091. rts
  48092. ; ===========================================================================
  48093.  
  48094. loc_25492:
  48095. cmpi.b #2,objoff_2C(a0)
  48096. beq.s Obj48_MoveCharacter
  48097. cmpi.b #2,objoff_36(a0)
  48098. beq.s Obj48_MoveCharacter
  48099. subq.w #1,anim_frame_duration(a0)
  48100. bpl.s Obj48_MoveCharacter
  48101. move.w #1,anim_frame_duration(a0)
  48102. tst.b objoff_3E(a0)
  48103. beq.s loc_254C2
  48104. cmpi.b #7,mapping_frame(a0)
  48105. beq.s Obj48_MoveCharacter
  48106. addq.b #1,mapping_frame(a0)
  48107. bra.s Obj48_MoveCharacter
  48108. ; ===========================================================================
  48109.  
  48110. loc_254C2:
  48111. tst.b mapping_frame(a0)
  48112. beq.s Obj48_MoveCharacter
  48113. subq.b #1,mapping_frame(a0)
  48114.  
  48115. ; update the position of Sonic/Tails between launchers
  48116. ; loc_254CC:
  48117. Obj48_MoveCharacter:
  48118. move.l x_pos(a1),d2
  48119. move.l y_pos(a1),d3
  48120. move.w x_vel(a1),d0
  48121. ext.l d0
  48122. asl.l #8,d0
  48123. add.l d0,d2
  48124. move.w y_vel(a1),d0
  48125. ext.l d0
  48126. asl.l #8,d0
  48127. add.l d0,d3
  48128. move.l d2,x_pos(a1)
  48129. move.l d3,y_pos(a1)
  48130. rts
  48131. ; ===========================================================================
  48132.  
  48133. loc_254F2:
  48134. subq.w #1,objoff_3C(a0)
  48135. bpl.s + ; rts
  48136. move.b #0,(a4)
  48137. +
  48138. rts
  48139. ; ===========================================================================
  48140. ; ----------------------------------------------------------------------------
  48141. ; sprite mappings
  48142. ; ----------------------------------------------------------------------------
  48143. Obj48_MapUnc_254FE: BINCLUDE "mappings/sprite/obj48.bin"
  48144. ; ===========================================================================
  48145.  
  48146. if gameRevision<2
  48147. nop
  48148. endif
  48149.  
  48150. if ~~removeJmpTos
  48151. JmpTo15_DisplaySprite
  48152. jmp (DisplaySprite).l
  48153. JmpTo14_MarkObjGone
  48154. jmp (MarkObjGone).l
  48155. JmpTo23_Adjust2PArtPointer
  48156. jmp (Adjust2PArtPointer).l
  48157.  
  48158. align 4
  48159. endif
  48160.  
  48161.  
  48162.  
  48163.  
  48164. ; ===========================================================================
  48165. ; ----------------------------------------------------------------------------
  48166. ; Object 22 - Arrow shooter from ARZ
  48167. ; ----------------------------------------------------------------------------
  48168. ; Sprite_25694:
  48169. Obj22:
  48170. moveq #0,d0
  48171. move.b routine(a0),d0
  48172. move.w Obj22_Index(pc,d0.w),d1
  48173. jmp Obj22_Index(pc,d1.w)
  48174. ; ===========================================================================
  48175. ; off_256A2:
  48176. Obj22_Index: offsetTable
  48177. offsetTableEntry.w Obj22_Init ; 0
  48178. offsetTableEntry.w Obj22_Main ; 2
  48179. offsetTableEntry.w Obj22_ShootArrow ; 4
  48180. offsetTableEntry.w Obj22_Arrow_Init ; 6
  48181. offsetTableEntry.w Obj22_Arrow ; 8
  48182. ; ===========================================================================
  48183. ; loc_256AC:
  48184. Obj22_Init:
  48185. addq.b #2,routine(a0)
  48186. move.l #Obj22_MapUnc_25804,mappings(a0)
  48187. move.w #make_art_tile(ArtTile_ArtNem_ArrowAndShooter,0,0),art_tile(a0)
  48188. jsrto (Adjust2PArtPointer).l, JmpTo24_Adjust2PArtPointer
  48189. ori.b #4,render_flags(a0)
  48190. move.b #3,priority(a0)
  48191. move.b #$10,width_pixels(a0)
  48192. move.b #1,mapping_frame(a0)
  48193. andi.b #$F,subtype(a0)
  48194. ; loc_256E0:
  48195. Obj22_Main:
  48196. cmpi.b #2,anim(a0)
  48197. beq.s Obj22_Animate
  48198. moveq #0,d2
  48199. lea (MainCharacter).w,a1 ; a1=character
  48200. bsr.s Obj22_DetectPlayer
  48201. lea (Sidekick).w,a1 ; a1=character
  48202. bsr.s Obj22_DetectPlayer
  48203. tst.b d2
  48204. bne.s +
  48205. tst.b anim(a0)
  48206. beq.s +
  48207. moveq #2,d2
  48208. +
  48209. move.b d2,anim(a0)
  48210. ; loc_25706:
  48211. Obj22_Animate:
  48212. lea (Ani_obj22).l,a1
  48213. jsrto (AnimateSprite).l, JmpTo5_AnimateSprite
  48214. jmpto (MarkObjGone).l, JmpTo15_MarkObjGone
  48215. ; ===========================================================================
  48216. ; loc_25714:
  48217. Obj22_DetectPlayer:
  48218. move.w x_pos(a0),d0
  48219. sub.w x_pos(a1),d0 ; is the player on the left of the shooter?
  48220. bcc.s + ; if yes, branch
  48221. neg.w d0
  48222. +
  48223. cmpi.w #$40,d0 ; is the player within $40 pixels of the shooter?
  48224. bhs.s + ; if not, branch
  48225. moveq #1,d2 ; change the shooter's animation
  48226. +
  48227. rts
  48228. ; ===========================================================================
  48229. ; loc_2572A:
  48230. Obj22_ShootArrow:
  48231. jsrto (SingleObjLoad).l, JmpTo5_SingleObjLoad
  48232. bne.s +
  48233. _move.b id(a0),id(a1) ; load obj22
  48234. addq.b #6,routine(a1)
  48235. move.l mappings(a0),mappings(a1)
  48236. move.w art_tile(a0),art_tile(a1)
  48237. move.w x_pos(a0),x_pos(a1)
  48238. move.w y_pos(a0),y_pos(a1)
  48239. move.b render_flags(a0),render_flags(a1)
  48240. move.b status(a0),status(a1)
  48241. move.w #SndID_PreArrowFiring,d0
  48242. jsr (PlaySound).l
  48243. +
  48244. subq.b #2,routine(a0)
  48245. lea (Ani_obj22).l,a1
  48246. jsrto (AnimateSprite).l, JmpTo5_AnimateSprite
  48247. jmpto (MarkObjGone).l, JmpTo15_MarkObjGone
  48248. ; ===========================================================================
  48249. ; loc_2577A:
  48250. Obj22_Arrow_Init:
  48251. addq.b #2,routine(a0)
  48252. move.b #8,y_radius(a0)
  48253. move.b #$10,x_radius(a0)
  48254. move.b #4,priority(a0)
  48255. move.b #$9B,collision_flags(a0)
  48256. move.b #8,width_pixels(a0)
  48257. move.b #0,mapping_frame(a0)
  48258. move.w #$400,x_vel(a0)
  48259. btst #0,status(a0)
  48260. beq.s +
  48261. neg.w x_vel(a0)
  48262. +
  48263. move.w #SndID_ArrowFiring,d0
  48264. jsr (PlaySound).l
  48265. ; loc_257BE:
  48266. Obj22_Arrow:
  48267. jsrto (ObjectMove).l, JmpTo11_ObjectMove
  48268. btst #0,status(a0)
  48269. bne.s loc_257DE
  48270. moveq #-8,d3
  48271. bsr.w ObjCheckLeftWallDist
  48272. tst.w d1
  48273. bmi.w BranchTo_JmpTo27_DeleteObject
  48274. jmpto (MarkObjGone).l, JmpTo15_MarkObjGone
  48275. ; ===========================================================================
  48276.  
  48277. BranchTo_JmpTo27_DeleteObject
  48278. jmpto (DeleteObject).l, JmpTo27_DeleteObject
  48279. ; ===========================================================================
  48280.  
  48281. loc_257DE:
  48282. moveq #8,d3
  48283. bsr.w ObjCheckRightWallDist
  48284. tst.w d1
  48285. bmi.w BranchTo_JmpTo27_DeleteObject
  48286. jmpto (MarkObjGone).l, JmpTo15_MarkObjGone
  48287. ; ===========================================================================
  48288. ; animation script
  48289. ; off_257EE:
  48290. Ani_obj22: offsetTable
  48291. offsetTableEntry.w byte_257F4 ; 0
  48292. offsetTableEntry.w byte_257F7 ; 1
  48293. offsetTableEntry.w byte_257FB ; 2
  48294. byte_257F4: dc.b $1F, 1,$FF
  48295. rev02even
  48296. byte_257F7: dc.b 3, 1, 2,$FF
  48297. rev02even
  48298. byte_257FB: dc.b 7, 3, 4,$FC, 4, 3, 1,$FD, 0
  48299. even
  48300. ; ----------------------------------------------------------------------------
  48301. ; sprite mappings
  48302. ; ----------------------------------------------------------------------------
  48303. Obj22_MapUnc_25804: BINCLUDE "mappings/sprite/obj22.bin"
  48304. ; ===========================================================================
  48305.  
  48306. if ~~removeJmpTos
  48307. JmpTo27_DeleteObject
  48308. jmp (DeleteObject).l
  48309. JmpTo5_SingleObjLoad
  48310. jmp (SingleObjLoad).l
  48311. JmpTo15_MarkObjGone
  48312. jmp (MarkObjGone).l
  48313. JmpTo5_AnimateSprite
  48314. jmp (AnimateSprite).l
  48315. JmpTo24_Adjust2PArtPointer
  48316. jmp (Adjust2PArtPointer).l
  48317. ; loc_25886:
  48318. JmpTo11_ObjectMove
  48319. jmp (ObjectMove).l
  48320.  
  48321. align 4
  48322. endif
  48323.  
  48324.  
  48325.  
  48326.  
  48327. ; ===========================================================================
  48328. ; ----------------------------------------------------------------------------
  48329. ; Object 23 - Pillar that drops its lower part from ARZ
  48330. ; ----------------------------------------------------------------------------
  48331. ; Sprite_2588C:
  48332. Obj23:
  48333. moveq #0,d0
  48334. move.b routine(a0),d0
  48335. move.w Obj23_Index(pc,d0.w),d1
  48336. jmp Obj23_Index(pc,d1.w)
  48337. ; ===========================================================================
  48338. ; off_2589A:
  48339. Obj23_Index: offsetTable
  48340. offsetTableEntry.w Obj23_Init ; 0
  48341. offsetTableEntry.w Obj23_Main ; 2
  48342. ; ===========================================================================
  48343. ; loc_2589E:
  48344. Obj23_Init:
  48345. addq.b #2,routine(a0)
  48346. move.l #Obj23_MapUnc_259E6,mappings(a0)
  48347. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,1,0),art_tile(a0)
  48348. jsrto (Adjust2PArtPointer).l, JmpTo25_Adjust2PArtPointer
  48349. ori.b #4,render_flags(a0)
  48350. move.b #$10,width_pixels(a0)
  48351. move.b #$20,y_radius(a0)
  48352. move.b #4,priority(a0)
  48353. jsrto (SingleObjLoad2).l, JmpTo10_SingleObjLoad2
  48354. bne.s Obj23_Main
  48355. _move.b id(a0),id(a1) ; load obj23
  48356. addq.b #2,routine(a1)
  48357. addq.b #2,routine_secondary(a1)
  48358. move.l mappings(a0),mappings(a1)
  48359. move.w art_tile(a0),art_tile(a1)
  48360. move.w x_pos(a0),x_pos(a1)
  48361. move.w x_pos(a0),objoff_30(a1)
  48362. move.w y_pos(a0),y_pos(a1)
  48363. addi.w #$30,y_pos(a1)
  48364. move.b render_flags(a0),render_flags(a1)
  48365. move.b #$10,width_pixels(a1)
  48366. move.b #$10,y_radius(a1)
  48367. move.b #4,priority(a1)
  48368. move.b #1,mapping_frame(a1)
  48369. ; loc_25922:
  48370. Obj23_Main:
  48371. move.w x_pos(a0),-(sp)
  48372. bsr.w loc_25948
  48373. moveq #0,d1
  48374. move.b width_pixels(a0),d1
  48375. addi.w #$B,d1
  48376. moveq #0,d2
  48377. move.b y_radius(a0),d2
  48378. move.w d2,d3
  48379. addq.w #1,d3
  48380. move.w (sp)+,d4
  48381. jsrto (SolidObject).l, JmpTo8_SolidObject
  48382. jmpto (MarkObjGone).l, JmpTo16_MarkObjGone
  48383. ; ===========================================================================
  48384.  
  48385. loc_25948:
  48386. moveq #0,d0
  48387. move.b routine_secondary(a0),d0
  48388. move.w Obj23_Modes(pc,d0.w),d1
  48389. jmp Obj23_Modes(pc,d1.w)
  48390. ; ===========================================================================
  48391. ; off_25956:
  48392. Obj23_Modes: offsetTable
  48393. offsetTableEntry.w return_2598C ; 0
  48394. offsetTableEntry.w loc_2595E ; 2
  48395. offsetTableEntry.w loc_2598E ; 4
  48396. offsetTableEntry.w loc_259B8 ; 6
  48397. ; ===========================================================================
  48398.  
  48399. loc_2595E:
  48400. tst.w (Debug_placement_mode).w
  48401. bne.s return_2598C
  48402. lea (MainCharacter).w,a1 ; a1=character
  48403. bsr.s loc_2596E
  48404. lea (Sidekick).w,a1 ; a1=character
  48405.  
  48406. loc_2596E:
  48407. move.w x_pos(a0),d0
  48408. sub.w x_pos(a1),d0
  48409. bcc.s +
  48410. neg.w d0
  48411. +
  48412. cmpi.w #$80,d0
  48413. bhs.s return_2598C
  48414. move.b #4,routine_secondary(a0)
  48415. move.w #8,objoff_34(a0)
  48416.  
  48417. return_2598C:
  48418. rts
  48419. ; ===========================================================================
  48420.  
  48421. loc_2598E:
  48422. move.w objoff_34(a0),d0
  48423. subq.w #1,d0
  48424. bcc.s loc_2599C
  48425. addq.b #2,routine_secondary(a0)
  48426. rts
  48427. ; ===========================================================================
  48428.  
  48429. loc_2599C:
  48430. move.w d0,objoff_34(a0)
  48431. move.b byte_259B0(pc,d0.w),d0
  48432. ext.w d0
  48433. add.w objoff_30(a0),d0
  48434. move.w d0,x_pos(a0)
  48435. rts
  48436. ; ===========================================================================
  48437. byte_259B0:
  48438. dc.b 0 ; 0
  48439. dc.b 1 ; 1
  48440. dc.b -1 ; 2
  48441. dc.b 1 ; 3
  48442. dc.b 0 ; 4
  48443. dc.b -1 ; 5
  48444. dc.b 0 ; 6
  48445. dc.b 1 ; 7
  48446. ; ===========================================================================
  48447.  
  48448. loc_259B8:
  48449. jsrto (ObjectMove).l, JmpTo12_ObjectMove
  48450. addi.w #$38,y_vel(a0)
  48451. bsr.w ObjCheckFloorDist
  48452. tst.w d1
  48453. bpl.w +
  48454. add.w d1,y_pos(a0)
  48455. clr.w y_vel(a0)
  48456. move.w y_pos(a0),objoff_32(a0)
  48457. move.b #2,mapping_frame(a0)
  48458. clr.b routine_secondary(a0)
  48459. +
  48460. rts
  48461. ; ===========================================================================
  48462. ; ----------------------------------------------------------------------------
  48463. ; sprite mappings
  48464. ; ----------------------------------------------------------------------------
  48465. Obj23_MapUnc_259E6: BINCLUDE "mappings/sprite/obj23.bin"
  48466. ; ===========================================================================
  48467. ; ----------------------------------------------------------------------------
  48468. ; Object 2B - Rising pillar from ARZ
  48469. ; ----------------------------------------------------------------------------
  48470. ; Sprite_25A5A:
  48471. Obj2B:
  48472. moveq #0,d0
  48473. move.b routine(a0),d0
  48474. move.w Obj2B_Index(pc,d0.w),d1
  48475. jmp Obj2B_Index(pc,d1.w)
  48476. ; ===========================================================================
  48477. ; off_25A68:
  48478. Obj2B_Index: offsetTable
  48479. offsetTableEntry.w Obj2B_Init ; 0
  48480. offsetTableEntry.w Obj2B_Main ; 2
  48481. offsetTableEntry.w loc_25B8E ; 4
  48482. ; ===========================================================================
  48483. ; loc_25A6E:
  48484. Obj2B_Init:
  48485. addq.b #2,routine(a0)
  48486. move.l #Obj2B_MapUnc_25C6E,mappings(a0)
  48487. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,1,0),art_tile(a0)
  48488. jsrto (Adjust2PArtPointer).l, JmpTo25_Adjust2PArtPointer
  48489. ori.b #4,render_flags(a0)
  48490. move.b #$10,width_pixels(a0)
  48491. move.b #$18,y_radius(a0)
  48492. move.b #4,priority(a0)
  48493. ; loc_25A9C:
  48494. Obj2B_Main:
  48495. move.w x_pos(a0),-(sp)
  48496. bsr.w loc_25B28
  48497. moveq #0,d1
  48498. move.b width_pixels(a0),d1
  48499. addi.w #$B,d1
  48500. moveq #0,d2
  48501. move.b y_radius(a0),d2
  48502. move.w d2,d3
  48503. addq.w #1,d3
  48504. move.w (sp)+,d4
  48505. jsrto (SolidObject).l, JmpTo8_SolidObject
  48506. move.b status(a0),d0
  48507. andi.b #standing_mask,d0
  48508. bne.w loc_25ACE
  48509. jmpto (MarkObjGone).l, JmpTo16_MarkObjGone
  48510. ; ===========================================================================
  48511.  
  48512. loc_25ACE:
  48513. lea (word_25BBE).l,a4
  48514. lea (byte_25BB0).l,a2
  48515. addq.b #7,mapping_frame(a0)
  48516. bsr.w loc_25BF6
  48517. lea (MainCharacter).w,a1 ; a1=character
  48518. moveq #p1_standing_bit,d6
  48519. bsr.s loc_25AF6
  48520. lea (Sidekick).w,a1 ; a1=character
  48521. addq.b #1,d6
  48522. bsr.s loc_25AF6
  48523. bra.w loc_25B8E
  48524. ; ===========================================================================
  48525.  
  48526. loc_25AF6:
  48527. bclr d6,status(a0)
  48528. beq.s return_25B26
  48529. bset #2,status(a1)
  48530. move.b #$E,y_radius(a1)
  48531. move.b #7,x_radius(a1)
  48532. move.b #AniIDSonAni_Roll,anim(a1)
  48533. bset #1,status(a1)
  48534. bclr #3,status(a1)
  48535. move.b #2,routine(a1)
  48536.  
  48537. return_25B26:
  48538. rts
  48539. ; ===========================================================================
  48540.  
  48541. loc_25B28:
  48542. moveq #0,d0
  48543. move.b routine_secondary(a0),d0
  48544. move.w off_25B36(pc,d0.w),d1
  48545. jmp off_25B36(pc,d1.w)
  48546. ; ===========================================================================
  48547. off_25B36: offsetTable
  48548. offsetTableEntry.w loc_25B3C ; 0
  48549. offsetTableEntry.w loc_25B66 ; 2
  48550. offsetTableEntry.w return_25B64 ; 4
  48551. ; ===========================================================================
  48552.  
  48553. loc_25B3C:
  48554. tst.w (Debug_placement_mode).w
  48555. bne.s return_25B64
  48556. lea (MainCharacter).w,a1 ; a1=character
  48557. bsr.s loc_25B4C
  48558. lea (Sidekick).w,a1 ; a1=character
  48559.  
  48560. loc_25B4C:
  48561. move.w x_pos(a0),d0
  48562. sub.w x_pos(a1),d0
  48563. bcc.s loc_25B58
  48564. neg.w d0
  48565.  
  48566. loc_25B58:
  48567. cmpi.w #$40,d0
  48568. bhs.s return_25B64
  48569. move.b #2,routine_secondary(a0)
  48570.  
  48571. return_25B64:
  48572.  
  48573. rts
  48574. ; ===========================================================================
  48575.  
  48576. loc_25B66:
  48577. subq.w #1,objoff_34(a0)
  48578. bcc.s return_25B8C
  48579. move.w #3,objoff_34(a0)
  48580. subq.w #4,y_pos(a0)
  48581. addq.b #4,y_radius(a0)
  48582. addq.b #1,mapping_frame(a0)
  48583. cmpi.b #6,mapping_frame(a0)
  48584. bne.s return_25B8C
  48585. move.b #4,routine_secondary(a0)
  48586.  
  48587. return_25B8C:
  48588. rts
  48589. ; ===========================================================================
  48590.  
  48591. loc_25B8E:
  48592.  
  48593. tst.b objoff_3F(a0)
  48594. beq.s loc_25B9A
  48595. subq.b #1,objoff_3F(a0)
  48596. bra.s loc_25BA4
  48597. ; ===========================================================================
  48598.  
  48599. loc_25B9A:
  48600. jsrto (ObjectMove).l, JmpTo12_ObjectMove
  48601. addi.w #$18,y_vel(a0)
  48602.  
  48603. loc_25BA4:
  48604. tst.b render_flags(a0)
  48605. bpl.w JmpTo28_DeleteObject
  48606. jmpto (DisplaySprite).l, JmpTo16_DisplaySprite
  48607. ; ===========================================================================
  48608. byte_25BB0:
  48609. dc.b 0
  48610. dc.b 0 ; 1
  48611. dc.b 0 ; 2
  48612. dc.b 0 ; 3
  48613. dc.b 4 ; 4
  48614. dc.b 4 ; 5
  48615. dc.b 8 ; 6
  48616. dc.b 8 ; 7
  48617. dc.b $C ; 8
  48618. dc.b $C ; 9
  48619. dc.b $10 ; 10
  48620. dc.b $10 ; 11
  48621. dc.b $14 ; 12
  48622. dc.b $14 ; 13
  48623. word_25BBE:
  48624. dc.w -$200,-$200,$200,-$200 ; 0
  48625. dc.w -$1C0,-$1C0,$1C0,-$1C0 ; 4
  48626. dc.w -$180,-$180,$180,-$180 ; 8
  48627. dc.w -$140,-$140,$140,-$140 ; 12
  48628. dc.w -$100,-$100,$100,-$100 ; 16
  48629. dc.w -$C0, -$C0, $C0, -$C0 ; 20
  48630. dc.w -$80, -$80, $80, -$80 ; 24
  48631. ; ===========================================================================
  48632.  
  48633. loc_25BF6:
  48634. moveq #0,d0
  48635. move.b mapping_frame(a0),d0
  48636. add.w d0,d0
  48637. movea.l mappings(a0),a3
  48638. adda.w (a3,d0.w),a3
  48639. move.w (a3)+,d1
  48640. subq.w #1,d1
  48641. bset #5,render_flags(a0)
  48642. _move.b id(a0),d4
  48643. move.b render_flags(a0),d5
  48644. movea.l a0,a1
  48645. bra.s loc_25C24
  48646. ; ===========================================================================
  48647.  
  48648. loc_25C1C:
  48649. jsrto (SingleObjLoad2).l, JmpTo10_SingleObjLoad2
  48650. bne.s loc_25C64
  48651. addq.w #8,a3
  48652.  
  48653. loc_25C24:
  48654. move.b #4,routine(a1)
  48655. _move.b d4,id(a1) ; load obj2B?
  48656. move.l a3,mappings(a1)
  48657. move.b d5,render_flags(a1)
  48658. move.w x_pos(a0),x_pos(a1)
  48659. move.w y_pos(a0),y_pos(a1)
  48660. move.w art_tile(a0),art_tile(a1)
  48661. move.b priority(a0),priority(a1)
  48662. move.b width_pixels(a0),width_pixels(a1)
  48663. move.w (a4)+,x_vel(a1)
  48664. move.w (a4)+,y_vel(a1)
  48665. move.b (a2)+,objoff_3F(a1)
  48666. dbf d1,loc_25C1C
  48667.  
  48668. loc_25C64:
  48669. move.w #SndID_SlowSmash,d0
  48670. jmp (PlaySound).l
  48671. ; ===========================================================================
  48672. ; ----------------------------------------------------------------------------
  48673. ; sprite mappings
  48674. ; ----------------------------------------------------------------------------
  48675. Obj2B_MapUnc_25C6E: BINCLUDE "mappings/sprite/obj2B.bin"
  48676. ; ===========================================================================
  48677.  
  48678. if gameRevision<2
  48679. nop
  48680. endif
  48681.  
  48682. if ~~removeJmpTos
  48683. JmpTo16_DisplaySprite
  48684. jmp (DisplaySprite).l
  48685. JmpTo28_DeleteObject
  48686. jmp (DeleteObject).l
  48687. JmpTo16_MarkObjGone
  48688. jmp (MarkObjGone).l
  48689. JmpTo10_SingleObjLoad2
  48690. jmp (SingleObjLoad2).l
  48691. JmpTo25_Adjust2PArtPointer
  48692. jmp (Adjust2PArtPointer).l
  48693. JmpTo8_SolidObject
  48694. jmp (SolidObject).l
  48695. ; loc_260FC:
  48696. JmpTo12_ObjectMove
  48697. jmp (ObjectMove).l
  48698.  
  48699. align 4
  48700. else
  48701. JmpTo28_DeleteObject
  48702. jmp (DeleteObject).l
  48703. endif
  48704.  
  48705.  
  48706.  
  48707.  
  48708. ; ===========================================================================
  48709. ; ----------------------------------------------------------------------------
  48710. ; Object 2C - Sprite that makes leaves fly off when you hit it from ARZ
  48711. ; ----------------------------------------------------------------------------
  48712. ; Sprite_26104:
  48713. Obj2C:
  48714. moveq #0,d0
  48715. move.b routine(a0),d0
  48716. move.w Obj2C_Index(pc,d0.w),d1
  48717. jmp Obj2C_Index(pc,d1.w)
  48718. ; ===========================================================================
  48719. ; off_26112:
  48720. Obj2C_Index: offsetTable
  48721. offsetTableEntry.w Obj2C_Init ; 0
  48722. offsetTableEntry.w Obj2C_Main ; 2
  48723. offsetTableEntry.w loc_26296 ; 4
  48724. ; ===========================================================================
  48725. ; byte_26118:
  48726. Obj2C_CollisionFlags:
  48727. dc.b $D6
  48728. dc.b $D4 ; 1
  48729. dc.b $D5 ; 2
  48730. dc.b 0 ; 3
  48731. ; ===========================================================================
  48732. ; loc_2611C:
  48733. Obj2C_Init:
  48734. addq.b #2,routine(a0)
  48735. moveq #0,d0
  48736. move.b subtype(a0),d0
  48737. move.b Obj2C_CollisionFlags(pc,d0.w),collision_flags(a0)
  48738. move.l #Obj31_MapUnc_20E74,mappings(a0)
  48739. move.w #make_art_tile(ArtTile_ArtNem_Powerups,0,1),art_tile(a0)
  48740. move.b #$84,render_flags(a0)
  48741. move.b #$80,width_pixels(a0)
  48742. move.b #4,priority(a0)
  48743. move.b subtype(a0),mapping_frame(a0)
  48744. ; loc_26152:
  48745. Obj2C_Main:
  48746. move.w x_pos(a0),d0
  48747. andi.w #$FF80,d0
  48748. sub.w (Camera_X_pos_coarse).w,d0
  48749. cmpi.w #$280,d0
  48750. bhi.w JmpTo29_DeleteObject
  48751. move.b collision_property(a0),d0
  48752. beq.s loc_261C2
  48753. move.w objoff_2E(a0),d0
  48754. beq.s +
  48755. add.b (Timer_frames+1).w,d0
  48756. andi.w #$F,d0
  48757. bne.s loc_26198
  48758. +
  48759. lea (MainCharacter).w,a2 ; a2=character
  48760. bclr #0,collision_property(a0)
  48761. beq.s Obj2C_RemoveCollision
  48762. bsr.s loc_261C8
  48763. tst.w objoff_2E(a0)
  48764. bne.s Obj2C_RemoveCollision
  48765. move.w (Timer_frames).w,objoff_2E(a0)
  48766. bra.s Obj2C_RemoveCollision
  48767. ; ===========================================================================
  48768.  
  48769. loc_26198:
  48770. addi_.w #8,d0
  48771. andi.w #$F,d0
  48772. bne.s Obj2C_RemoveCollision
  48773. lea (Sidekick).w,a2 ; a2=character
  48774. bclr #1,collision_property(a0)
  48775. beq.s Obj2C_RemoveCollision
  48776. bsr.s loc_261C8
  48777. tst.w objoff_2E(a0)
  48778. bne.s Obj2C_RemoveCollision
  48779. move.w (Timer_frames).w,objoff_2E(a0)
  48780. ; loc_261BC:
  48781. Obj2C_RemoveCollision:
  48782. clr.b collision_property(a0)
  48783. rts
  48784. ; ===========================================================================
  48785.  
  48786. loc_261C2:
  48787. clr.w objoff_2E(a0)
  48788. rts
  48789. ; ===========================================================================
  48790.  
  48791. loc_261C8:
  48792. mvabs.w x_vel(a2),d0
  48793. cmpi.w #$200,d0
  48794. bhs.s loc_261E4
  48795. mvabs.w y_vel(a2),d0
  48796. cmpi.w #$200,d0
  48797. blo.s loc_261C2
  48798.  
  48799. loc_261E4:
  48800. lea (Obj2C_Speeds).l,a3
  48801. moveq #3,d6
  48802.  
  48803. loc_261EC:
  48804. jsrto (SingleObjLoad).l, JmpTo6_SingleObjLoad
  48805. bne.w loc_26278
  48806. _move.b #ObjID_LeavesGenerator,id(a1) ; load obj2C
  48807. move.b #4,routine(a1)
  48808. move.w x_pos(a2),x_pos(a1)
  48809. move.w y_pos(a2),y_pos(a1)
  48810. jsrto (RandomNumber).l, JmpTo2_RandomNumber
  48811. andi.w #$F,d0
  48812. subq.w #8,d0
  48813. add.w d0,x_pos(a1)
  48814. swap d0
  48815. andi.w #$F,d0
  48816. subq.w #8,d0
  48817. add.w d0,y_pos(a1)
  48818. move.w (a3)+,x_vel(a1)
  48819. move.w (a3)+,y_vel(a1)
  48820. btst #0,status(a2)
  48821. beq.s +
  48822. neg.w x_vel(a1)
  48823. +
  48824. move.w x_pos(a1),objoff_30(a1)
  48825. move.w y_pos(a1),objoff_34(a1)
  48826. andi.b #1,d0
  48827. move.b d0,mapping_frame(a1)
  48828. move.l #Obj2C_MapUnc_2631E,mappings(a1)
  48829. move.w #make_art_tile(ArtTile_ArtNem_Leaves,3,1),art_tile(a1)
  48830. move.b #$84,render_flags(a1)
  48831. move.b #8,width_pixels(a1)
  48832. move.b #1,priority(a1)
  48833. move.b #4,objoff_38(a1)
  48834. move.b d1,angle(a0)
  48835.  
  48836. loc_26278:
  48837. dbf d6,loc_261EC
  48838. move.w #SndID_Leaves,d0
  48839. jmp (PlaySound).l
  48840. ; ===========================================================================
  48841. ; byte_26286: word_26286:
  48842. Obj2C_Speeds:
  48843. dc.w -$80,-$80 ; 0
  48844. dc.w $C0,-$40 ; 1
  48845. dc.w -$C0, $40 ; 2
  48846. dc.w $80, $80 ; 3
  48847. ; ===========================================================================
  48848.  
  48849. loc_26296:
  48850. move.b objoff_38(a0),d0
  48851. add.b d0,angle(a0)
  48852. add.b (Vint_runcount+3).w,d0
  48853. andi.w #$1F,d0
  48854. bne.s +
  48855. add.b d7,d0
  48856. andi.b #1,d0
  48857. beq.s +
  48858. neg.b objoff_38(a0)
  48859. +
  48860. move.l objoff_30(a0),d2
  48861. move.l objoff_34(a0),d3
  48862. move.w x_vel(a0),d0
  48863. ext.l d0
  48864. asl.l #8,d0
  48865. add.l d0,d2
  48866. move.w y_vel(a0),d0
  48867. ext.l d0
  48868. asl.l #8,d0
  48869. add.l d0,d3
  48870. move.l d2,objoff_30(a0)
  48871. move.l d3,objoff_34(a0)
  48872. swap d2
  48873. andi.w #3,d3
  48874. addq.w #4,d3
  48875. add.w d3,y_vel(a0)
  48876. move.b angle(a0),d0
  48877. jsrto (CalcSine).l, JmpTo7_CalcSine
  48878. asr.w #6,d0
  48879. add.w objoff_30(a0),d0
  48880. move.w d0,x_pos(a0)
  48881. asr.w #6,d1
  48882. add.w objoff_34(a0),d1
  48883. move.w d1,y_pos(a0)
  48884. subq.b #1,anim_frame_duration(a0)
  48885. bpl.s +
  48886. move.b #$B,anim_frame_duration(a0)
  48887. bchg #1,mapping_frame(a0)
  48888. +
  48889. tst.b render_flags(a0)
  48890. bpl.w JmpTo29_DeleteObject
  48891. jmpto (DisplaySprite).l, JmpTo17_DisplaySprite
  48892.  
  48893. if removeJmpTos
  48894. JmpTo29_DeleteObject
  48895. jmp (DeleteObject).l
  48896. endif
  48897. ; ===========================================================================
  48898. ; ----------------------------------------------------------------------------
  48899. ; sprite mappings
  48900. ; ----------------------------------------------------------------------------
  48901. Obj2C_MapUnc_2631E: BINCLUDE "mappings/sprite/obj2C.bin"
  48902. ; ===========================================================================
  48903.  
  48904. if gameRevision<2
  48905. nop
  48906. endif
  48907.  
  48908. if ~~removeJmpTos
  48909. JmpTo17_DisplaySprite
  48910. jmp (DisplaySprite).l
  48911. JmpTo29_DeleteObject
  48912. jmp (DeleteObject).l
  48913. JmpTo6_SingleObjLoad
  48914. jmp (SingleObjLoad).l
  48915. JmpTo2_RandomNumber
  48916. jmp (RandomNumber).l
  48917. JmpTo7_CalcSine
  48918. jmp (CalcSine).l
  48919.  
  48920. align 4
  48921. endif
  48922.  
  48923.  
  48924.  
  48925.  
  48926. ; ===========================================================================
  48927. ; ----------------------------------------------------------------------------
  48928. ; Object 40 - Pressure spring from CPZ, ARZ, and MCZ (the red "diving board" springboard)
  48929. ; ----------------------------------------------------------------------------
  48930. ; Sprite_26370:
  48931. Obj40:
  48932. moveq #0,d0
  48933. move.b routine(a0),d0
  48934. move.w Obj40_Index(pc,d0.w),d1
  48935. jsr Obj40_Index(pc,d1.w)
  48936. jmpto (MarkObjGone).l, JmpTo17_MarkObjGone
  48937. ; ===========================================================================
  48938. ; off_26382:
  48939. Obj40_Index: offsetTable
  48940. offsetTableEntry.w Obj40_Init ; 0
  48941. offsetTableEntry.w Obj40_Main ; 2
  48942. ; ---------------------------------------------------------------------------
  48943. ; it seems this object's strength was once controlled by subtype
  48944. ; these would be applied to the player's y_vel
  48945. ; word_26386:
  48946. Obj40_Strengths:
  48947. dc.w -$400 ; 0
  48948. dc.w -$A00 ; 2
  48949. ; inaccessible
  48950. dc.w -$800 ; 4
  48951. ; ===========================================================================
  48952. ; loc_2638C:
  48953. Obj40_Init:
  48954. addq.b #2,routine(a0)
  48955. move.l #Obj40_MapUnc_265F4,mappings(a0)
  48956. move.w #make_art_tile(ArtTile_ArtNem_LeverSpring,0,0),art_tile(a0)
  48957. jsrto (Adjust2PArtPointer).l, JmpTo26_Adjust2PArtPointer
  48958. ori.b #4,render_flags(a0)
  48959. move.b #$1C,width_pixels(a0)
  48960. move.b #4,priority(a0)
  48961. bset #7,status(a0)
  48962. move.b subtype(a0),d0
  48963. andi.w #2,d0 ; there is enough data for this to be capped at 4
  48964. move.w Obj40_Strengths(pc,d0.w),objoff_30(a0) ; this is never read
  48965. ; loc_263C8:
  48966. Obj40_Main:
  48967. lea (Ani_obj40).l,a1
  48968. jsrto (AnimateSprite).l, JmpTo6_AnimateSprite
  48969. move.w #$27,d1
  48970. move.w #8,d2
  48971. move.w x_pos(a0),d4
  48972. lea Obj40_SlopeData_DiagUp(pc),a2
  48973. tst.b mapping_frame(a0)
  48974. beq.s +
  48975. lea Obj40_SlopeData_Straight(pc),a2
  48976. +
  48977. lea (MainCharacter).w,a1 ; a1=character
  48978. moveq #p1_standing_bit,d6
  48979. movem.l d1-d4,-(sp)
  48980. jsrto (SlopedSolid_SingleCharacter).l, JmpTo_SlopedSolid_SingleCharacter
  48981. btst #p1_standing_bit,status(a0)
  48982. beq.s +
  48983. bsr.s loc_2641E
  48984. +
  48985. movem.l (sp)+,d1-d4
  48986. lea (Sidekick).w,a1 ; a1=character
  48987. moveq #p2_standing_bit,d6
  48988. jsrto (SlopedSolid_SingleCharacter).l, JmpTo_SlopedSolid_SingleCharacter
  48989. btst #p2_standing_bit,status(a0)
  48990. beq.s + ; rts
  48991. bsr.s loc_2641E
  48992. +
  48993. rts
  48994. ; ===========================================================================
  48995.  
  48996. loc_2641E:
  48997. btst #0,status(a0)
  48998. bne.s loc_26436
  48999. move.w x_pos(a0),d0
  49000. subi.w #$10,d0
  49001. cmp.w x_pos(a1),d0
  49002. blo.s loc_26446
  49003. rts
  49004. ; ===========================================================================
  49005.  
  49006. loc_26436:
  49007. move.w x_pos(a0),d0
  49008. addi.w #$10,d0
  49009. cmp.w x_pos(a1),d0
  49010. bhs.s loc_26446
  49011. rts
  49012. ; ===========================================================================
  49013.  
  49014. loc_26446:
  49015. cmpi.b #1,anim(a0)
  49016. beq.s loc_26456
  49017. move.w #$100,anim(a0)
  49018. rts
  49019. ; ===========================================================================
  49020.  
  49021. loc_26456:
  49022. tst.b mapping_frame(a0)
  49023. beq.s loc_2645E
  49024. rts
  49025. ; ===========================================================================
  49026.  
  49027. loc_2645E:
  49028. move.w x_pos(a0),d0
  49029. subi.w #$1C,d0
  49030. sub.w x_pos(a1),d0
  49031. neg.w d0
  49032. btst #0,status(a0)
  49033. beq.s loc_2647A
  49034. not.w d0
  49035. addi.w #$27,d0
  49036.  
  49037. loc_2647A:
  49038. tst.w d0
  49039. bpl.s loc_26480
  49040. moveq #0,d0
  49041.  
  49042. loc_26480:
  49043. lea (byte_26550).l,a3
  49044. move.b (a3,d0.w),d0
  49045. move.w #-$400,y_vel(a1)
  49046. sub.b d0,y_vel(a1)
  49047. bset #0,status(a1)
  49048. btst #0,status(a0)
  49049. bne.s loc_264AA
  49050. bclr #0,status(a1)
  49051. neg.b d0
  49052.  
  49053. loc_264AA:
  49054. mvabs.w x_vel(a1),d1
  49055. cmpi.w #$400,d1
  49056. blo.s loc_264BC
  49057. sub.b d0,x_vel(a1)
  49058.  
  49059. loc_264BC:
  49060. bset #1,status(a1)
  49061. bclr #3,status(a1)
  49062. move.b #AniIDSonAni_Spring,anim(a1)
  49063. move.b #2,routine(a1)
  49064. move.b #0,spindash_flag(a1)
  49065. move.b subtype(a0),d0
  49066. btst #0,d0
  49067. beq.s loc_2651E
  49068. move.w #1,inertia(a1)
  49069. move.b #1,flip_angle(a1)
  49070. move.b #AniIDSonAni_Walk,anim(a1)
  49071. move.b #1,flips_remaining(a1)
  49072. move.b #8,flip_speed(a1)
  49073. btst #1,d0
  49074. bne.s loc_2650E
  49075. move.b #3,flips_remaining(a1)
  49076.  
  49077. loc_2650E:
  49078. btst #0,status(a1)
  49079. beq.s loc_2651E
  49080. neg.b flip_angle(a1)
  49081. neg.w inertia(a1)
  49082.  
  49083. loc_2651E:
  49084. andi.b #$C,d0
  49085. cmpi.b #4,d0
  49086. bne.s loc_26534
  49087. move.b #$C,top_solid_bit(a1)
  49088. move.b #$D,lrb_solid_bit(a1)
  49089.  
  49090. loc_26534:
  49091. cmpi.b #8,d0
  49092. bne.s loc_26546
  49093. move.b #$E,top_solid_bit(a1)
  49094. move.b #$F,lrb_solid_bit(a1)
  49095.  
  49096. loc_26546:
  49097. move.w #SndID_Spring,d0
  49098. jmp (PlaySound).l
  49099. ; ===========================================================================
  49100. byte_26550:
  49101. dc.b 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  49102. dc.b 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1; 16
  49103. dc.b 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2; 32
  49104. dc.b 3, 3, 3, 3, 3, 3, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0; 48
  49105. dc.b 0, 0, 0, 0, 0, 0, 0, 0; 64
  49106. ;byte_26598:
  49107. Obj40_SlopeData_DiagUp:
  49108. dc.b 8, 8, 8, 8, 8, 8, 8, 9, $A, $B, $C, $D, $E, $F,$10,$10
  49109. dc.b $11,$12,$13,$14,$14,$15,$15,$16,$17,$18,$18,$18,$18,$18,$18,$18; 16
  49110. dc.b $18,$18,$18,$18,$18,$18,$18,$18; 32
  49111. ;byte_265C0:
  49112. Obj40_SlopeData_Straight:
  49113. dc.b 8, 8, 8, 8, 8, 8, 8, 9, $A, $B, $C, $C, $C, $C, $D, $D
  49114. dc.b $D, $D, $D, $D, $E, $E, $F, $F,$10,$10,$10,$10, $F, $F, $E, $E; 16
  49115. dc.b $D, $D, $D, $D, $D, $D, $D, $D; 32
  49116.  
  49117. ; animation script
  49118. ; off_265E8:
  49119. Ani_obj40: offsetTable
  49120. offsetTableEntry.w byte_265EC ; 0
  49121. offsetTableEntry.w byte_265EF ; 1
  49122. byte_265EC: dc.b $F, 0,$FF
  49123. rev02even
  49124. byte_265EF: dc.b 3, 1, 0,$FD, 0
  49125. even
  49126. ; ----------------------------------------------------------------------------
  49127. ; sprite mappings
  49128. ; ----------------------------------------------------------------------------
  49129. Obj40_MapUnc_265F4: BINCLUDE "mappings/sprite/obj40.bin"
  49130. ; ===========================================================================
  49131.  
  49132. if ~~removeJmpTos
  49133. JmpTo17_MarkObjGone
  49134. jmp (MarkObjGone).l
  49135. JmpTo6_AnimateSprite
  49136. jmp (AnimateSprite).l
  49137. JmpTo26_Adjust2PArtPointer
  49138. jmp (Adjust2PArtPointer).l
  49139. JmpTo_SlopedSolid_SingleCharacter
  49140. jmp (SlopedSolid_SingleCharacter).l
  49141.  
  49142. align 4
  49143. endif
  49144.  
  49145.  
  49146.  
  49147.  
  49148. ; ===========================================================================
  49149. ; ----------------------------------------------------------------------------
  49150. ; Object 42 - Steam Spring from MTZ
  49151. ; ----------------------------------------------------------------------------
  49152. ; Sprite_26634:
  49153. Obj42:
  49154. moveq #0,d0
  49155. move.b routine(a0),d0
  49156. move.w Obj42_Index(pc,d0.w),d1
  49157. jmp Obj42_Index(pc,d1.w)
  49158. ; ===========================================================================
  49159. ; off_26642:
  49160. Obj42_Index: offsetTable
  49161. offsetTableEntry.w Obj42_Init ; 0
  49162. offsetTableEntry.w loc_26688 ; 2
  49163. offsetTableEntry.w loc_2683A ; 4
  49164. ; ===========================================================================
  49165. ; loc_26648:
  49166. Obj42_Init:
  49167. addq.b #2,routine(a0)
  49168. move.l #Obj42_MapUnc_2686C,mappings(a0)
  49169. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,3,0),art_tile(a0)
  49170. ori.b #4,render_flags(a0)
  49171. move.b #$10,width_pixels(a0)
  49172. move.b #4,priority(a0)
  49173. jsrto (Adjust2PArtPointer).l, JmpTo27_Adjust2PArtPointer
  49174. move.b #7,mapping_frame(a0)
  49175. move.w y_pos(a0),objoff_34(a0)
  49176. move.w #$10,objoff_36(a0)
  49177. addi.w #$10,y_pos(a0)
  49178.  
  49179. loc_26688:
  49180. move.w #$1B,d1
  49181. move.w #$10,d2
  49182. move.w #$10,d3
  49183. move.w x_pos(a0),d4
  49184. lea (MainCharacter).w,a1 ; a1=character
  49185. moveq #p1_standing_bit,d6
  49186. movem.l d1-d4,-(sp)
  49187. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo2_SolidObject_Always_SingleCharacter
  49188. btst #p1_standing_bit,status(a0)
  49189. beq.s +
  49190. bsr.w loc_2678E
  49191. +
  49192. movem.l (sp)+,d1-d4
  49193. lea (Sidekick).w,a1 ; a1=character
  49194. moveq #p2_standing_bit,d6
  49195. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo2_SolidObject_Always_SingleCharacter
  49196. btst #p2_standing_bit,status(a0)
  49197. beq.s +
  49198. bsr.w loc_2678E
  49199. +
  49200. move.b routine_secondary(a0),d0
  49201. bne.s loc_266E4
  49202. subq.w #1,objoff_32(a0)
  49203. bpl.s BranchTo_JmpTo18_MarkObjGone
  49204. move.w #$3B,objoff_32(a0)
  49205. addq.b #2,routine_secondary(a0)
  49206. bra.s BranchTo_JmpTo18_MarkObjGone
  49207. ; ===========================================================================
  49208.  
  49209. loc_266E4:
  49210. subq.b #2,d0
  49211. bne.s loc_26716
  49212. subq.w #8,objoff_36(a0)
  49213. bne.s loc_26708
  49214. addq.b #2,routine_secondary(a0)
  49215. bsr.s loc_2674C
  49216. addi.w #$28,x_pos(a1)
  49217. bsr.s loc_2674C
  49218. subi.w #$28,x_pos(a1)
  49219. bset #0,render_flags(a1)
  49220.  
  49221. loc_26708:
  49222. move.w objoff_36(a0),d0
  49223. add.w objoff_34(a0),d0
  49224. move.w d0,y_pos(a0)
  49225. bra.s BranchTo_JmpTo18_MarkObjGone
  49226. ; ===========================================================================
  49227.  
  49228. loc_26716:
  49229. subq.b #2,d0
  49230. bne.s loc_2672C
  49231. subq.w #1,objoff_32(a0)
  49232. bpl.s BranchTo_JmpTo18_MarkObjGone
  49233. move.w #$3B,objoff_32(a0)
  49234. addq.b #2,routine_secondary(a0)
  49235. bra.s BranchTo_JmpTo18_MarkObjGone
  49236. ; ===========================================================================
  49237.  
  49238. loc_2672C:
  49239. addq.w #8,objoff_36(a0)
  49240. cmpi.w #$10,objoff_36(a0)
  49241. bne.s loc_2673C
  49242. clr.b routine_secondary(a0)
  49243.  
  49244. loc_2673C:
  49245. move.w objoff_36(a0),d0
  49246. add.w objoff_34(a0),d0
  49247. move.w d0,y_pos(a0)
  49248.  
  49249. BranchTo_JmpTo18_MarkObjGone
  49250. jmpto (MarkObjGone).l, JmpTo18_MarkObjGone
  49251. ; ===========================================================================
  49252.  
  49253. loc_2674C:
  49254. jsrto (SingleObjLoad).l, JmpTo7_SingleObjLoad
  49255. bne.s +
  49256. _move.b id(a0),id(a1) ; load obj42
  49257. addq.b #4,routine(a1)
  49258. move.w x_pos(a0),x_pos(a1)
  49259. move.w objoff_34(a0),y_pos(a1)
  49260. move.b #7,anim_frame_duration(a1)
  49261. move.l mappings(a0),mappings(a1)
  49262. move.w #make_art_tile(ArtTile_ArtNem_MtzSteam,1,0),art_tile(a1)
  49263. ori.b #4,render_flags(a1)
  49264. move.b #$18,width_pixels(a1)
  49265. move.b #4,priority(a1)
  49266. +
  49267. rts
  49268. ; ===========================================================================
  49269.  
  49270. loc_2678E:
  49271. cmpi.b #2,routine_secondary(a0)
  49272. beq.s loc_26798
  49273. rts
  49274. ; ===========================================================================
  49275.  
  49276. loc_26798:
  49277. move.w #-$A00,y_vel(a1)
  49278. bset #1,status(a1)
  49279. bclr #3,status(a1)
  49280. move.b #AniIDSonAni_Spring,anim(a1)
  49281. move.b #2,routine(a1)
  49282. move.b #0,spindash_flag(a1)
  49283. move.b subtype(a0),d0
  49284. bpl.s +
  49285. move.w #0,x_vel(a1)
  49286. +
  49287. btst #0,d0
  49288. beq.s loc_26808
  49289. move.w #1,inertia(a1)
  49290. move.b #1,flip_angle(a1)
  49291. move.b #AniIDSonAni_Walk,anim(a1)
  49292. move.b #0,flips_remaining(a1)
  49293. move.b #4,flip_speed(a1)
  49294. btst #1,d0
  49295. bne.s +
  49296. move.b #1,flips_remaining(a1)
  49297. +
  49298. btst #0,status(a1)
  49299. beq.s loc_26808
  49300. neg.b flip_angle(a1)
  49301. neg.w inertia(a1)
  49302.  
  49303. loc_26808:
  49304. andi.b #$C,d0
  49305. cmpi.b #4,d0
  49306. bne.s +
  49307. move.b #$C,top_solid_bit(a1)
  49308. move.b #$D,lrb_solid_bit(a1)
  49309. +
  49310. cmpi.b #8,d0
  49311. bne.s +
  49312. move.b #$E,top_solid_bit(a1)
  49313. move.b #$F,lrb_solid_bit(a1)
  49314. +
  49315. move.w #SndID_Spring,d0
  49316. jmp (PlaySound).l
  49317. ; ===========================================================================
  49318.  
  49319. loc_2683A:
  49320. subq.b #1,anim_frame_duration(a0)
  49321. bpl.s ++
  49322. move.b #7,anim_frame_duration(a0)
  49323. move.b #0,collision_flags(a0)
  49324. addq.b #1,mapping_frame(a0)
  49325. cmpi.b #3,mapping_frame(a0)
  49326. bne.s +
  49327. move.b #$A6,collision_flags(a0)
  49328. +
  49329. cmpi.b #7,mapping_frame(a0)
  49330. beq.w JmpTo30_DeleteObject
  49331. +
  49332. jmpto (DisplaySprite).l, JmpTo18_DisplaySprite
  49333.  
  49334. if removeJmpTos
  49335. JmpTo30_DeleteObject
  49336. jmp (DeleteObject).l
  49337. endif
  49338. ; ===========================================================================
  49339. ; ----------------------------------------------------------------------------
  49340. ; sprite mappings
  49341. ; ----------------------------------------------------------------------------
  49342. Obj42_MapUnc_2686C: BINCLUDE "mappings/sprite/obj42.bin"
  49343. ; ===========================================================================
  49344.  
  49345. if ~~removeJmpTos
  49346. JmpTo18_DisplaySprite
  49347. jmp (DisplaySprite).l
  49348. JmpTo30_DeleteObject
  49349. jmp (DeleteObject).l
  49350. JmpTo7_SingleObjLoad
  49351. jmp (SingleObjLoad).l
  49352. JmpTo18_MarkObjGone
  49353. jmp (MarkObjGone).l
  49354. JmpTo27_Adjust2PArtPointer
  49355. jmp (Adjust2PArtPointer).l
  49356. JmpTo2_SolidObject_Always_SingleCharacter
  49357. jmp (SolidObject_Always_SingleCharacter).l
  49358.  
  49359. align 4
  49360. endif
  49361.  
  49362.  
  49363.  
  49364.  
  49365. ; ===========================================================================
  49366. ; ----------------------------------------------------------------------------
  49367. ; Object 64 - Twin stompers from MTZ
  49368. ; ----------------------------------------------------------------------------
  49369. ; Sprite_26920:
  49370. Obj64:
  49371. moveq #0,d0
  49372. move.b routine(a0),d0
  49373. move.w Obj64_Index(pc,d0.w),d1
  49374. jmp Obj64_Index(pc,d1.w)
  49375. ; ===========================================================================
  49376. ; off_2692E:
  49377. Obj64_Index: offsetTable
  49378. offsetTableEntry.w Obj64_Init ; 0
  49379. offsetTableEntry.w Obj64_Main ; 2
  49380. ; ===========================================================================
  49381. ; byte_26932:
  49382. Obj64_Properties:
  49383. ; width_pixels
  49384. ; objoff_2E
  49385. dc.b $40, $C
  49386. dc.b $40, 1 ; 2
  49387. dc.b $10,$20 ; 4
  49388. dc.b $40, 1 ; 6
  49389. ; ===========================================================================
  49390. ; loc_2693A:
  49391. Obj64_Init:
  49392. addq.b #2,routine(a0)
  49393. moveq #0,d0
  49394. move.b subtype(a0),d0
  49395. lsr.w #2,d0
  49396. andi.w #$1C,d0
  49397. lea Obj64_Properties(pc,d0.w),a3
  49398. move.b (a3)+,width_pixels(a0)
  49399. move.b (a3)+,objoff_2E(a0)
  49400. lsr.w #2,d0
  49401. move.b d0,mapping_frame(a0)
  49402. bne.s +
  49403. move.b #$6C,y_radius(a0)
  49404. bset #4,render_flags(a0)
  49405. +
  49406. move.l #Obj64_MapUnc_26A5C,mappings(a0)
  49407. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,1,0),art_tile(a0)
  49408. jsrto (Adjust2PArtPointer).l, JmpTo28_Adjust2PArtPointer
  49409. ori.b #4,render_flags(a0)
  49410. move.b #4,priority(a0)
  49411. move.w x_pos(a0),objoff_34(a0)
  49412. move.w y_pos(a0),objoff_30(a0)
  49413. moveq #0,d0
  49414. move.b (a3)+,d0
  49415. move.w d0,objoff_3C(a0)
  49416. andi.b #$F,subtype(a0)
  49417. ; loc_269A2:
  49418. Obj64_Main:
  49419. move.w x_pos(a0),-(sp)
  49420. moveq #0,d0
  49421. move.b subtype(a0),d0
  49422. add.w d0,d0
  49423. move.w Obj64_Modes(pc,d0.w),d1
  49424. jsr Obj64_Modes(pc,d1.w)
  49425. move.w (sp)+,d4
  49426. tst.b render_flags(a0)
  49427. bpl.s +
  49428. moveq #0,d1
  49429. move.b width_pixels(a0),d1
  49430. addi.w #$B,d1
  49431. moveq #0,d2
  49432. move.b objoff_2E(a0),d2
  49433. move.w d2,d3
  49434. addq.w #1,d3
  49435. jsrto (SolidObject).l, JmpTo9_SolidObject
  49436. +
  49437. move.w objoff_34(a0),d0
  49438. andi.w #$FF80,d0
  49439. sub.w (Camera_X_pos_coarse).w,d0
  49440. cmpi.w #$280,d0
  49441. bhi.s JmpTo31_DeleteObject
  49442. jmp (DisplaySprite).l
  49443. ; ===========================================================================
  49444.  
  49445. JmpTo31_DeleteObject
  49446. jmp (DeleteObject).l
  49447. ; ===========================================================================
  49448. ; off_269F4:
  49449. Obj64_Modes: offsetTable
  49450. offsetTableEntry.w return_269F8 ; 0
  49451. offsetTableEntry.w loc_269FA ; 2
  49452. ; ===========================================================================
  49453.  
  49454. return_269F8:
  49455. rts
  49456. ; ===========================================================================
  49457.  
  49458. loc_269FA:
  49459. tst.b objoff_38(a0)
  49460. bne.s loc_26A1E
  49461. tst.w objoff_3A(a0)
  49462. beq.s loc_26A0C
  49463. subq.w #8,objoff_3A(a0)
  49464. bra.s loc_26A3E
  49465. ; ===========================================================================
  49466.  
  49467. loc_26A0C:
  49468. subq.w #1,objoff_36(a0)
  49469. bpl.s loc_26A3E
  49470. move.w #$5A,objoff_36(a0)
  49471. move.b #1,objoff_38(a0)
  49472.  
  49473. loc_26A1E:
  49474. move.w objoff_3A(a0),d0
  49475. cmp.w objoff_3C(a0),d0
  49476. beq.s loc_26A2E
  49477. addq.w #8,objoff_3A(a0)
  49478. bra.s loc_26A3E
  49479. ; ===========================================================================
  49480.  
  49481. loc_26A2E:
  49482. subq.w #1,objoff_36(a0)
  49483. bpl.s loc_26A3E
  49484. move.w #$5A,objoff_36(a0)
  49485. clr.b objoff_38(a0)
  49486.  
  49487. loc_26A3E:
  49488. move.w objoff_3A(a0),d0
  49489. btst #0,status(a0)
  49490. beq.s loc_26A50
  49491. neg.w d0
  49492. addi.w #$40,d0
  49493.  
  49494. loc_26A50:
  49495. move.w objoff_30(a0),d1
  49496. add.w d0,d1
  49497. move.w d1,y_pos(a0)
  49498. rts
  49499. ; ===========================================================================
  49500. ; ----------------------------------------------------------------------------
  49501. ; sprite mappings
  49502. ; ----------------------------------------------------------------------------
  49503. Obj64_MapUnc_26A5C: BINCLUDE "mappings/sprite/obj64.bin"
  49504. ; ===========================================================================
  49505.  
  49506. if ~~removeJmpTos
  49507. JmpTo28_Adjust2PArtPointer
  49508. jmp (Adjust2PArtPointer).l
  49509. JmpTo9_SolidObject
  49510. jmp (SolidObject).l
  49511.  
  49512. align 4
  49513. endif
  49514.  
  49515.  
  49516.  
  49517.  
  49518. ; ===========================================================================
  49519. ; ----------------------------------------------------------------------------
  49520. ; Object 65 - Long moving platform from MTZ
  49521. ; ----------------------------------------------------------------------------
  49522. ; Sprite_26AE0:
  49523. Obj65:
  49524. moveq #0,d0
  49525. move.b routine(a0),d0
  49526. move.w Obj65_Index(pc,d0.w),d1
  49527. jmp Obj65_Index(pc,d1.w)
  49528. ; ===========================================================================
  49529. ; off_26AEE:
  49530. Obj65_Index: offsetTable
  49531. offsetTableEntry.w Obj65_Init ; 0
  49532. offsetTableEntry.w loc_26C1C ; 2
  49533. offsetTableEntry.w loc_26EA4 ; 4
  49534. offsetTableEntry.w loc_26EC2 ; 6
  49535. ; ---------------------------------------------------------------------------
  49536. ; byte_26AF6:
  49537. Obj65_Properties:
  49538. ; width_pixels
  49539. ; radius
  49540. dc.b $40, $C
  49541. dc.b $80, 1 ; 2
  49542. dc.b $20, $C ; 4
  49543. dc.b $40, 3 ; 6
  49544. dc.b $10,$10 ; 8
  49545. dc.b $20, 0 ; 10
  49546. dc.b $40, $C ; 12
  49547. dc.b $80, 7 ; 14
  49548. ; ===========================================================================
  49549. ; loc_26B06:
  49550. Obj65_Init:
  49551. addq.b #2,routine(a0)
  49552. move.l #Obj65_Obj6A_Obj6B_MapUnc_26EC8,mappings(a0)
  49553. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,3,0),art_tile(a0)
  49554. jsrto (Adjust2PArtPointer).l, JmpTo29_Adjust2PArtPointer
  49555. ori.b #4,render_flags(a0)
  49556. move.b #4,priority(a0)
  49557. moveq #0,d0
  49558. move.b subtype(a0),d0
  49559. lsr.w #2,d0
  49560. andi.w #$1C,d0
  49561. lea Obj65_Properties(pc,d0.w),a3
  49562. move.b (a3)+,width_pixels(a0)
  49563. move.b (a3)+,y_radius(a0)
  49564. lsr.w #2,d0
  49565. move.b d0,mapping_frame(a0)
  49566. cmpi.b #1,d0
  49567. bne.s +
  49568. bset #7,status(a0)
  49569. +
  49570. cmpi.b #2,d0
  49571. bne.s loc_26B6E
  49572. addq.b #4,routine(a0)
  49573. move.l #Obj65_MapUnc_26F04,mappings(a0)
  49574. move.w #make_art_tile(ArtTile_ArtNem_MtzCog,3,0),art_tile(a0)
  49575. bra.w loc_26EC2
  49576. ; ===========================================================================
  49577.  
  49578. loc_26B6E:
  49579. move.w x_pos(a0),objoff_34(a0)
  49580. move.w y_pos(a0),objoff_30(a0)
  49581. moveq #0,d0
  49582. move.b (a3)+,d0
  49583. move.w d0,objoff_3C(a0)
  49584. moveq #0,d0
  49585. move.b subtype(a0),d0
  49586. bpl.w loc_26C16
  49587. andi.b #$F,d0
  49588. move.b d0,objoff_3E(a0)
  49589. move.b (a3),subtype(a0)
  49590. cmpi.b #7,(a3)
  49591. bne.s +
  49592. move.w objoff_3C(a0),objoff_3A(a0)
  49593. +
  49594. jsrto (SingleObjLoad2).l, JmpTo11_SingleObjLoad2
  49595. bne.s loc_26C04
  49596. _move.b id(a0),id(a1) ; load obj65
  49597. addq.b #4,routine(a1)
  49598. move.w x_pos(a0),x_pos(a1)
  49599. move.w y_pos(a0),y_pos(a1)
  49600. addi.w #-$4C,x_pos(a1)
  49601. addi.w #$14,y_pos(a1)
  49602. btst #0,status(a0)
  49603. bne.s +
  49604. subi.w #-$18,x_pos(a1)
  49605. bset #0,render_flags(a1)
  49606. +
  49607. move.l #Obj65_MapUnc_26F04,mappings(a1)
  49608. move.w #make_art_tile(ArtTile_ArtNem_MtzCog,3,0),art_tile(a1)
  49609. ori.b #4,render_flags(a1)
  49610. move.b #$10,width_pixels(a1)
  49611. move.b #4,priority(a1)
  49612. move.l a0,objoff_3C(a1)
  49613.  
  49614. loc_26C04:
  49615. lea (Object_Respawn_Table).w,a2
  49616. moveq #0,d0
  49617. move.b respawn_index(a0),d0
  49618. beq.s loc_26C16
  49619. bclr #7,2(a2,d0.w)
  49620.  
  49621. loc_26C16:
  49622. andi.b #$F,subtype(a0)
  49623.  
  49624. loc_26C1C:
  49625. move.w x_pos(a0),objoff_2E(a0)
  49626. moveq #0,d0
  49627. move.b subtype(a0),d0
  49628. add.w d0,d0
  49629. move.w off_26C7E(pc,d0.w),d1
  49630. jsr off_26C7E(pc,d1.w)
  49631. move.w objoff_2E(a0),d4
  49632. moveq #0,d1
  49633. move.b width_pixels(a0),d1
  49634. addi_.w #5,d1
  49635. moveq #0,d2
  49636. move.b y_radius(a0),d2
  49637. move.w d2,d3
  49638. addq.w #1,d3
  49639. jsrto (SolidObject).l, JmpTo10_SolidObject
  49640. move.w objoff_34(a0),d0
  49641. andi.w #$FF80,d0
  49642. sub.w (Camera_X_pos_coarse).w,d0
  49643. cmpi.w #$280,d0
  49644. bhi.s loc_26C66
  49645. jmp (DisplaySprite).l
  49646. ; ===========================================================================
  49647.  
  49648. loc_26C66:
  49649. lea (Object_Respawn_Table).w,a2
  49650. moveq #0,d0
  49651. move.b respawn_index(a0),d0
  49652. beq.s +
  49653. bclr #7,2(a2,d0.w)
  49654. +
  49655. jmp (DeleteObject).l
  49656. ; ===========================================================================
  49657. off_26C7E: offsetTable
  49658. offsetTableEntry.w return_26C8E ; 0
  49659. offsetTableEntry.w loc_26CA4 ; 1
  49660. offsetTableEntry.w loc_26D34 ; 2
  49661. offsetTableEntry.w loc_26D94 ; 3
  49662. offsetTableEntry.w loc_26E3C ; 4
  49663. offsetTableEntry.w loc_26E4A ; 5
  49664. offsetTableEntry.w loc_26C90 ; 6
  49665. offsetTableEntry.w loc_26D14 ; 7
  49666. ; ===========================================================================
  49667.  
  49668. return_26C8E:
  49669. rts
  49670. ; ===========================================================================
  49671.  
  49672. loc_26C90:
  49673. tst.b objoff_38(a0)
  49674. bne.s BranchTo_loc_26CC2
  49675. subq.w #1,objoff_36(a0)
  49676. bne.s loc_26CD0
  49677. move.b #1,objoff_38(a0)
  49678.  
  49679. BranchTo_loc_26CC2
  49680. bra.s loc_26CC2
  49681. ; ===========================================================================
  49682.  
  49683. loc_26CA4:
  49684. tst.b objoff_38(a0)
  49685. bne.s loc_26CC2
  49686. lea (ButtonVine_Trigger).w,a2
  49687. moveq #0,d0
  49688. move.b objoff_3E(a0),d0
  49689. btst #0,(a2,d0.w)
  49690. beq.s loc_26CD0
  49691. move.b #1,objoff_38(a0)
  49692.  
  49693. loc_26CC2:
  49694. move.w objoff_3C(a0),d0
  49695. cmp.w objoff_3A(a0),d0
  49696. beq.s loc_26CF2
  49697. addq.w #2,objoff_3A(a0)
  49698.  
  49699. loc_26CD0:
  49700. move.w objoff_3A(a0),d0
  49701. btst #0,status(a0)
  49702. beq.s +
  49703. neg.w d0
  49704. addi.w #$80,d0
  49705. +
  49706. move.w objoff_34(a0),d1
  49707. sub.w d0,d1
  49708. move.w d1,x_pos(a0)
  49709. move.w d1,objoff_2E(a0)
  49710. rts
  49711. ; ===========================================================================
  49712.  
  49713. loc_26CF2:
  49714. addq.b #1,subtype(a0)
  49715. move.w #$B4,objoff_36(a0)
  49716. clr.b objoff_38(a0)
  49717. lea (Object_Respawn_Table).w,a2
  49718. moveq #0,d0
  49719. move.b respawn_index(a0),d0
  49720. beq.s loc_26CD0
  49721. bset #0,2(a2,d0.w)
  49722. bra.s loc_26CD0
  49723. ; ===========================================================================
  49724.  
  49725. loc_26D14:
  49726. tst.b objoff_38(a0)
  49727. bne.s +
  49728. lea (ButtonVine_Trigger).w,a2
  49729. moveq #0,d0
  49730. move.b objoff_3E(a0),d0
  49731. btst #0,(a2,d0.w)
  49732. beq.s loc_26D50
  49733. move.b #1,objoff_38(a0)
  49734. +
  49735. bra.s loc_26D46
  49736. ; ===========================================================================
  49737.  
  49738. loc_26D34:
  49739. tst.b objoff_38(a0)
  49740. bne.s loc_26D46
  49741. subq.w #1,objoff_36(a0)
  49742. bne.s loc_26D50
  49743. move.b #1,objoff_38(a0)
  49744.  
  49745. loc_26D46:
  49746. tst.w objoff_3A(a0)
  49747. beq.s loc_26D72
  49748. subq.w #2,objoff_3A(a0)
  49749.  
  49750. loc_26D50:
  49751. move.w objoff_3A(a0),d0
  49752. btst #0,status(a0)
  49753. beq.s +
  49754. neg.w d0
  49755. addi.w #$80,d0
  49756. +
  49757. move.w objoff_34(a0),d1
  49758. sub.w d0,d1
  49759. move.w d1,x_pos(a0)
  49760. move.w d1,objoff_2E(a0)
  49761. rts
  49762. ; ===========================================================================
  49763.  
  49764. loc_26D72:
  49765. subq.b #1,subtype(a0)
  49766. move.w #$B4,objoff_36(a0)
  49767. clr.b objoff_38(a0)
  49768. lea (Object_Respawn_Table).w,a2
  49769. moveq #0,d0
  49770. move.b respawn_index(a0),d0
  49771. beq.s loc_26D50
  49772. bclr #0,2(a2,d0.w)
  49773. bra.s loc_26D50
  49774. ; ===========================================================================
  49775.  
  49776. loc_26D94:
  49777. move.w objoff_34(a0),d4
  49778. move.w d4,d5
  49779. btst #0,status(a0)
  49780. bne.s loc_26DAC
  49781. subi.w #$20,d4
  49782. addi.w #$60,d5
  49783. bra.s loc_26DB4
  49784. ; ===========================================================================
  49785.  
  49786. loc_26DAC:
  49787. subi.w #$A0,d4
  49788. subi.w #$20,d5
  49789.  
  49790. loc_26DB4:
  49791. move.w y_pos(a0),d2
  49792. move.w d2,d3
  49793. subi.w #$10,d2
  49794. addi.w #$40,d3
  49795. moveq #0,d1
  49796. move.w (MainCharacter+x_pos).w,d0
  49797. cmp.w d4,d0
  49798. blo.s +
  49799. cmp.w d5,d0
  49800. bhs.s +
  49801. move.w (MainCharacter+y_pos).w,d0
  49802. cmp.w d2,d0
  49803. blo.s +
  49804. cmp.w d3,d0
  49805. bhs.s +
  49806. moveq #1,d1
  49807. +
  49808. move.w (Sidekick+x_pos).w,d0
  49809. cmp.w d4,d0
  49810. blo.s +
  49811. cmp.w d5,d0
  49812. bhs.s +
  49813. move.w (Sidekick+y_pos).w,d0
  49814. cmp.w d2,d0
  49815. blo.s +
  49816. cmp.w d3,d0
  49817. bhs.s +
  49818. moveq #1,d1
  49819. +
  49820. tst.b d1
  49821. beq.s loc_26E0E
  49822. move.w objoff_3C(a0),d0
  49823. cmp.w objoff_3A(a0),d0
  49824. beq.s return_26E3A
  49825. addi.w #$10,objoff_3A(a0)
  49826. bra.s loc_26E1A
  49827. ; ===========================================================================
  49828.  
  49829. loc_26E0E:
  49830. tst.w objoff_3A(a0)
  49831. beq.s loc_26E1A
  49832. subi.w #$10,objoff_3A(a0)
  49833.  
  49834. loc_26E1A:
  49835. move.w objoff_3A(a0),d0
  49836. btst #0,status(a0)
  49837. beq.s +
  49838. neg.w d0
  49839. addi.w #$40,d0
  49840. +
  49841. move.w objoff_34(a0),d1
  49842. sub.w d0,d1
  49843. move.w d1,x_pos(a0)
  49844. move.w d1,objoff_2E(a0)
  49845.  
  49846. return_26E3A:
  49847. rts
  49848. ; ===========================================================================
  49849.  
  49850. loc_26E3C:
  49851. btst #p1_standing_bit,status(a0)
  49852. beq.s +
  49853. addq.b #1,subtype(a0)
  49854. +
  49855. rts
  49856. ; ===========================================================================
  49857.  
  49858. loc_26E4A:
  49859. tst.b objoff_38(a0)
  49860. bne.s loc_26E84
  49861. addq.w #2,x_pos(a0)
  49862. cmpi.b #metropolis_zone_2,(Current_Zone).w
  49863. bne.s loc_26E74
  49864. cmpi.w #$1CC0,x_pos(a0)
  49865. beq.s loc_26E6C
  49866. cmpi.w #$2940,x_pos(a0)
  49867. bne.s loc_26E96
  49868.  
  49869. loc_26E6C:
  49870. move.b #0,subtype(a0)
  49871. bra.s loc_26E96
  49872. ; ===========================================================================
  49873.  
  49874. loc_26E74:
  49875. cmpi.w #$1BC0,x_pos(a0)
  49876. bne.s loc_26E96
  49877. move.b #1,objoff_38(a0)
  49878. bra.s loc_26E96
  49879. ; ===========================================================================
  49880.  
  49881. loc_26E84:
  49882. subq.w #2,x_pos(a0)
  49883. cmpi.w #$1880,x_pos(a0)
  49884. bne.s loc_26E96
  49885. move.b #0,objoff_38(a0)
  49886.  
  49887. loc_26E96:
  49888. move.w x_pos(a0),objoff_34(a0)
  49889. move.w x_pos(a0),(MTZ_Platform_Cog_X).w
  49890. rts
  49891. ; ===========================================================================
  49892.  
  49893. loc_26EA4:
  49894. movea.l objoff_3C(a0),a1 ; a1=object
  49895. move.w objoff_3A(a1),d0
  49896.  
  49897. loc_26EAC:
  49898. andi.w #7,d0
  49899. move.b byte_26EBA(pc,d0.w),mapping_frame(a0)
  49900. jmpto (MarkObjGone).l, JmpTo19_MarkObjGone
  49901. ; ===========================================================================
  49902. byte_26EBA:
  49903. dc.b 0
  49904. dc.b 0 ; 1
  49905. dc.b 2 ; 2
  49906. dc.b 2 ; 3
  49907. dc.b 2 ; 4
  49908. dc.b 1 ; 5
  49909. dc.b 1 ; 6
  49910. dc.b 1 ; 7
  49911. ; ===========================================================================
  49912.  
  49913. loc_26EC2:
  49914. move.w (MTZ_Platform_Cog_X).w,d0
  49915. bra.s loc_26EAC
  49916. ; ===========================================================================
  49917. ; ----------------------------------------------------------------------------
  49918. ; sprite mappings
  49919. ; ----------------------------------------------------------------------------
  49920. Obj65_Obj6A_Obj6B_MapUnc_26EC8: BINCLUDE "mappings/sprite/obj65_a.bin"
  49921. ; ----------------------------------------------------------------------------
  49922. ; sprite mappings
  49923. ; ----------------------------------------------------------------------------
  49924. Obj65_MapUnc_26F04: BINCLUDE "mappings/sprite/obj65_b.bin"
  49925. ; ===========================================================================
  49926.  
  49927. if ~~removeJmpTos
  49928. JmpTo19_MarkObjGone
  49929. jmp (MarkObjGone).l
  49930. JmpTo11_SingleObjLoad2
  49931. jmp (SingleObjLoad2).l
  49932. JmpTo29_Adjust2PArtPointer
  49933. jmp (Adjust2PArtPointer).l
  49934. JmpTo10_SolidObject
  49935. jmp (SolidObject).l
  49936.  
  49937. align 4
  49938. endif
  49939.  
  49940.  
  49941.  
  49942.  
  49943. ; ===========================================================================
  49944. ; ----------------------------------------------------------------------------
  49945. ; Object 66 - Yellow spring walls from MTZ
  49946. ; ----------------------------------------------------------------------------
  49947. ; Sprite_26F58:
  49948. Obj66:
  49949. moveq #0,d0
  49950. move.b routine(a0),d0
  49951. move.w Obj66_Index(pc,d0.w),d1
  49952. jmp Obj66_Index(pc,d1.w)
  49953. ; ===========================================================================
  49954. ; off_26F66:
  49955. Obj66_Index: offsetTable
  49956. offsetTableEntry.w Obj66_Init ; 0
  49957. offsetTableEntry.w Obj66_Main ; 2
  49958. ; ===========================================================================
  49959. ; loc_26F6A:
  49960. Obj66_Init:
  49961. addq.b #2,routine(a0)
  49962. move.l #Obj66_MapUnc_27120,mappings(a0)
  49963. move.w #make_art_tile(ArtTile_ArtNem_Powerups,0,1),art_tile(a0)
  49964. jsrto (Adjust2PArtPointer).l, JmpTo30_Adjust2PArtPointer
  49965. ori.b #4,render_flags(a0)
  49966. move.b #8,width_pixels(a0)
  49967. move.b #4,priority(a0)
  49968. move.b #$40,y_radius(a0)
  49969. move.b subtype(a0),d0
  49970. lsr.b #4,d0
  49971. andi.b #7,d0
  49972. move.b d0,mapping_frame(a0)
  49973. beq.s Obj66_Main
  49974. move.b #$80,y_radius(a0)
  49975. ; loc_26FAE:
  49976. Obj66_Main:
  49977. move.w #$13,d1
  49978. moveq #0,d2
  49979. move.b y_radius(a0),d2
  49980. move.w d2,d3
  49981. addq.w #1,d3
  49982. move.w x_pos(a0),d4
  49983. lea (MainCharacter).w,a1 ; a1=character
  49984. moveq #p1_standing_bit,d6
  49985. movem.l d1-d4,-(sp)
  49986. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo3_SolidObject_Always_SingleCharacter
  49987. cmpi.b #1,d4
  49988. bne.s loc_26FF6
  49989. btst #1,status(a1)
  49990. beq.s loc_26FF6
  49991. move.b status(a0),d1
  49992. move.w x_pos(a0),d0
  49993. sub.w x_pos(a1),d0
  49994. bcs.s +
  49995. eori.b #1,d1
  49996. +
  49997. andi.b #1,d1
  49998. bne.s loc_26FF6
  49999. bsr.s loc_27042
  50000.  
  50001. loc_26FF6:
  50002. movem.l (sp)+,d1-d4
  50003. lea (Sidekick).w,a1 ; a1=character
  50004. moveq #p2_standing_bit,d6
  50005. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo3_SolidObject_Always_SingleCharacter
  50006. cmpi.b #1,d4
  50007. bne.s loc_2702C
  50008. btst #1,status(a1)
  50009. beq.s loc_2702C
  50010. move.b status(a0),d1
  50011. move.w x_pos(a0),d0
  50012. sub.w x_pos(a1),d0
  50013. bcs.s +
  50014. eori.b #1,d1
  50015. +
  50016. andi.b #1,d1
  50017. bne.s loc_2702C
  50018. bsr.s loc_27042
  50019.  
  50020. loc_2702C:
  50021. move.w x_pos(a0),d0
  50022. andi.w #$FF80,d0
  50023. sub.w (Camera_X_pos_coarse).w,d0
  50024. cmpi.w #$280,d0
  50025. bhi.w JmpTo33_DeleteObject
  50026. if gameRevision=0
  50027. ; this object was visible with debug mode in REV00
  50028. tst.w (Debug_placement_mode).w
  50029. beq.s + ; rts
  50030. jsrto (DisplaySprite).l, JmpTo47_DisplaySprite
  50031. +
  50032. endif
  50033. rts
  50034.  
  50035. if removeJmpTos
  50036. JmpTo33_DeleteObject
  50037. jmp (DeleteObject).l
  50038. endif
  50039. ; ===========================================================================
  50040. loc_27042:
  50041. if gameRevision>0
  50042. ; REV00 didn't prevent the player from bouncing if they were hurt or dead
  50043. cmpi.b #4,routine(a1)
  50044. blo.s loc_2704C
  50045. rts
  50046. endif
  50047. ; ===========================================================================
  50048.  
  50049. loc_2704C:
  50050. move.w objoff_30(a0),x_vel(a1)
  50051. move.w #-$800,x_vel(a1)
  50052. move.w #-$800,y_vel(a1)
  50053. bset #0,status(a1)
  50054. btst #0,status(a0)
  50055. bne.s +
  50056. bclr #0,status(a1)
  50057. neg.w x_vel(a1)
  50058. +
  50059. move.w #$F,move_lock(a1)
  50060. move.w x_vel(a1),inertia(a1)
  50061. btst #2,status(a1)
  50062. bne.s +
  50063. move.b #AniIDSonAni_Walk,anim(a1)
  50064. +
  50065. move.b subtype(a0),d0
  50066. bpl.s +
  50067. move.w #0,y_vel(a1)
  50068. +
  50069. btst #0,d0
  50070. beq.s loc_270DC
  50071. move.w #1,inertia(a1)
  50072. move.b #1,flip_angle(a1)
  50073. move.b #AniIDSonAni_Walk,anim(a1)
  50074. move.b #1,flips_remaining(a1)
  50075. move.b #8,flip_speed(a1)
  50076. btst #1,d0
  50077. bne.s +
  50078. move.b #3,flips_remaining(a1)
  50079. +
  50080. btst #0,status(a1)
  50081. beq.s loc_270DC
  50082. neg.b flip_angle(a1)
  50083. neg.w inertia(a1)
  50084.  
  50085. loc_270DC:
  50086. andi.b #$C,d0
  50087. cmpi.b #4,d0
  50088. bne.s +
  50089. move.b #$C,top_solid_bit(a1)
  50090. move.b #$D,lrb_solid_bit(a1)
  50091. +
  50092. cmpi.b #8,d0
  50093. bne.s +
  50094. move.b #$E,top_solid_bit(a1)
  50095. move.b #$F,lrb_solid_bit(a1)
  50096. +
  50097. bclr #p1_pushing_bit,status(a0)
  50098. bclr #p2_pushing_bit,status(a0)
  50099. bclr #5,status(a1)
  50100. move.w #SndID_Spring,d0
  50101. jmp (PlaySound).l
  50102. ; ===========================================================================
  50103. ; ----------------------------------------------------------------------------
  50104. ; sprite mappings
  50105. ; ----------------------------------------------------------------------------
  50106. Obj66_MapUnc_27120: BINCLUDE "mappings/sprite/obj66.bin"
  50107. ; ===========================================================================
  50108.  
  50109. if ~~removeJmpTos
  50110.  
  50111. if gameRevision=0
  50112. JmpTo47_DisplaySprite
  50113. jmp (DisplaySprite).l
  50114. endif
  50115.  
  50116. JmpTo33_DeleteObject
  50117. jmp (DeleteObject).l
  50118. JmpTo30_Adjust2PArtPointer
  50119. jmp (Adjust2PArtPointer).l
  50120. JmpTo3_SolidObject_Always_SingleCharacter
  50121. jmp (SolidObject_Always_SingleCharacter).l
  50122.  
  50123. align 4
  50124. endif
  50125.  
  50126.  
  50127.  
  50128.  
  50129. ; ===========================================================================
  50130. ; ----------------------------------------------------------------------------
  50131. ; Object 67 - Spin tube from MTZ
  50132. ; ----------------------------------------------------------------------------
  50133. ; Sprite_2715C:
  50134. Obj67:
  50135. moveq #0,d0
  50136. move.b routine(a0),d0
  50137. move.w Obj67_Index(pc,d0.w),d1
  50138. jsr Obj67_Index(pc,d1.w)
  50139. move.b objoff_2C(a0),d0
  50140. add.b objoff_36(a0),d0
  50141. beq.w JmpTo4_MarkObjGone3
  50142. lea (Ani_obj67).l,a1
  50143. jsrto (AnimateSprite).l, JmpTo7_AnimateSprite
  50144. jmpto (DisplaySprite).l, JmpTo19_DisplaySprite
  50145. ; ===========================================================================
  50146. ; off_27184:
  50147. Obj67_Index: offsetTable
  50148. offsetTableEntry.w Obj67_Init ; 0
  50149. offsetTableEntry.w Obj67_Main ; 2
  50150. ; ===========================================================================
  50151. ; loc_27188:
  50152. Obj67_Init:
  50153. addq.b #2,routine(a0)
  50154. move.l #Obj67_MapUnc_27548,mappings(a0)
  50155. move.w #make_art_tile(ArtTile_ArtNem_MtzSpinTubeFlash,3,0),art_tile(a0)
  50156. ori.b #4,render_flags(a0)
  50157. move.b #$10,width_pixels(a0)
  50158. move.b #5,priority(a0)
  50159. ; loc_271AC:
  50160. Obj67_Main:
  50161. lea (MainCharacter).w,a1 ; a1=character
  50162. lea objoff_2C(a0),a4
  50163. bsr.s loc_271BE
  50164. lea (Sidekick).w,a1 ; a1=character
  50165. lea objoff_36(a0),a4
  50166.  
  50167. loc_271BE:
  50168. moveq #0,d0
  50169. move.b (a4),d0
  50170. move.w off_271CA(pc,d0.w),d0
  50171. jmp off_271CA(pc,d0.w)
  50172. ; ===========================================================================
  50173. off_271CA: offsetTable
  50174. offsetTableEntry.w loc_271D0 ; 0
  50175. offsetTableEntry.w loc_27260 ; 2
  50176. offsetTableEntry.w loc_27294 ; 4
  50177. ; ===========================================================================
  50178.  
  50179. loc_271D0:
  50180. tst.w (Debug_placement_mode).w
  50181. bne.w return_2725E
  50182. move.w x_pos(a1),d0
  50183. sub.w x_pos(a0),d0
  50184. addq.w #3,d0
  50185. btst #0,status(a0)
  50186. beq.s +
  50187. addi.w #$A,d0
  50188. +
  50189. cmpi.w #$10,d0
  50190. bhs.s return_2725E
  50191. move.w y_pos(a1),d1
  50192. sub.w y_pos(a0),d1
  50193. addi.w #$20,d1
  50194. cmpi.w #$40,d1
  50195. bhs.s return_2725E
  50196. tst.b obj_control(a1)
  50197. bne.s return_2725E
  50198. addq.b #2,(a4)
  50199. move.b #$81,obj_control(a1)
  50200. move.b #AniIDSonAni_Roll,anim(a1)
  50201. move.w #$800,inertia(a1)
  50202. move.w #0,x_vel(a1)
  50203. move.w #0,y_vel(a1)
  50204. bclr #5,status(a0)
  50205. bclr #5,status(a1)
  50206. bset #1,status(a1)
  50207. move.w x_pos(a0),x_pos(a1)
  50208. move.w y_pos(a0),y_pos(a1)
  50209. clr.b 1(a4)
  50210. move.w #SndID_Roll,d0
  50211. jsr (PlaySound).l
  50212. move.w #$100,anim(a0)
  50213.  
  50214. return_2725E:
  50215. rts
  50216. ; ===========================================================================
  50217.  
  50218. loc_27260:
  50219. move.b 1(a4),d0
  50220. addq.b #2,1(a4)
  50221. jsr (CalcSine).l
  50222. asr.w #5,d0
  50223. move.w y_pos(a0),d2
  50224. sub.w d0,d2
  50225. move.w d2,y_pos(a1)
  50226. cmpi.b #$80,1(a4)
  50227. bne.s +
  50228. bsr.w loc_27310
  50229. addq.b #2,(a4)
  50230. move.w #SndID_SpindashRelease,d0
  50231. jsr (PlaySound).l
  50232. +
  50233. rts
  50234. ; ===========================================================================
  50235.  
  50236. loc_27294:
  50237. subq.b #1,2(a4)
  50238. bpl.s Obj67_MoveCharacter
  50239. movea.l 6(a4),a2
  50240. move.w (a2)+,d4
  50241. move.w d4,x_pos(a1)
  50242. move.w (a2)+,d5
  50243. move.w d5,y_pos(a1)
  50244. tst.b subtype(a0)
  50245. bpl.s +
  50246. subq.w #8,a2
  50247. +
  50248. move.l a2,6(a4)
  50249. subq.w #4,4(a4)
  50250. beq.s loc_272EE
  50251. move.w (a2)+,d4
  50252. move.w (a2)+,d5
  50253. move.w #$1000,d2
  50254. bra.w loc_27374
  50255. ; ===========================================================================
  50256. ; update the position of Sonic/Tails in the MTZ tube
  50257. ; loc_272C8:
  50258. Obj67_MoveCharacter:
  50259. move.l x_pos(a1),d2
  50260. move.l y_pos(a1),d3
  50261. move.w x_vel(a1),d0
  50262. ext.l d0
  50263. asl.l #8,d0
  50264. add.l d0,d2
  50265. move.w y_vel(a1),d0
  50266. ext.l d0
  50267. asl.l #8,d0
  50268. add.l d0,d3
  50269. move.l d2,x_pos(a1)
  50270. move.l d3,y_pos(a1)
  50271. rts
  50272. ; ===========================================================================
  50273.  
  50274. loc_272EE:
  50275. andi.w #$7FF,y_pos(a1)
  50276. clr.b (a4)
  50277. clr.b obj_control(a1)
  50278. btst #4,subtype(a0)
  50279. bne.s +
  50280. move.w #0,x_vel(a1)
  50281. move.w #0,y_vel(a1)
  50282. +
  50283. rts
  50284. ; ===========================================================================
  50285.  
  50286. loc_27310:
  50287. move.b subtype(a0),d0
  50288. bpl.s loc_27344
  50289. neg.b d0
  50290. andi.w #$F,d0
  50291. add.w d0,d0
  50292. lea (off_273F2).l,a2
  50293. adda.w (a2,d0.w),a2
  50294. move.w (a2)+,d0
  50295. subq.w #4,d0
  50296. move.w d0,4(a4)
  50297. lea (a2,d0.w),a2
  50298. move.w (a2)+,d4
  50299. move.w d4,x_pos(a1)
  50300. move.w (a2)+,d5
  50301. move.w d5,y_pos(a1)
  50302. subq.w #8,a2
  50303. bra.s loc_27368
  50304. ; ===========================================================================
  50305.  
  50306. loc_27344:
  50307. andi.w #$F,d0
  50308. add.w d0,d0
  50309. lea (off_273F2).l,a2
  50310. adda.w (a2,d0.w),a2
  50311. move.w (a2)+,4(a4)
  50312. subq.w #4,4(a4)
  50313. move.w (a2)+,d4
  50314. move.w d4,x_pos(a1)
  50315. move.w (a2)+,d5
  50316. move.w d5,y_pos(a1)
  50317.  
  50318. loc_27368:
  50319. move.l a2,6(a4)
  50320. move.w (a2)+,d4
  50321. move.w (a2)+,d5
  50322. move.w #$1000,d2
  50323.  
  50324. loc_27374:
  50325. moveq #0,d0
  50326. move.w d2,d3
  50327. move.w d4,d0
  50328. sub.w x_pos(a1),d0
  50329. bge.s loc_27384
  50330. neg.w d0
  50331. neg.w d2
  50332.  
  50333. loc_27384:
  50334. moveq #0,d1
  50335. move.w d5,d1
  50336. sub.w y_pos(a1),d1
  50337. bge.s loc_27392
  50338. neg.w d1
  50339. neg.w d3
  50340.  
  50341. loc_27392:
  50342. cmp.w d0,d1
  50343. blo.s loc_273C4
  50344. moveq #0,d1
  50345. move.w d5,d1
  50346. sub.w y_pos(a1),d1
  50347. swap d1
  50348. divs.w d3,d1
  50349. moveq #0,d0
  50350. move.w d4,d0
  50351. sub.w x_pos(a1),d0
  50352. beq.s loc_273B0
  50353. swap d0
  50354. divs.w d1,d0
  50355.  
  50356. loc_273B0:
  50357. move.w d0,x_vel(a1)
  50358. move.w d3,y_vel(a1)
  50359. abs.w d1
  50360. move.w d1,2(a4)
  50361. rts
  50362. ; ===========================================================================
  50363.  
  50364. loc_273C4:
  50365. moveq #0,d0
  50366. move.w d4,d0
  50367. sub.w x_pos(a1),d0
  50368. swap d0
  50369. divs.w d2,d0
  50370. moveq #0,d1
  50371. move.w d5,d1
  50372. sub.w y_pos(a1),d1
  50373. beq.s loc_273DE
  50374. swap d1
  50375. divs.w d0,d1
  50376.  
  50377. loc_273DE:
  50378. move.w d1,y_vel(a1)
  50379. move.w d2,x_vel(a1)
  50380. abs.w d0
  50381. move.w d0,2(a4)
  50382. rts
  50383. ; ===========================================================================
  50384. ; MTZ tube position data
  50385. ; off_273F2:
  50386. include "misc/obj67.asm"
  50387. ; animation script
  50388. ; byte_2752E:
  50389. Ani_obj67: offsetTable
  50390. offsetTableEntry.w byte_27532 ; 0
  50391. offsetTableEntry.w byte_27535 ; 1
  50392. byte_27532:
  50393. dc.b $1F, 0,$FF
  50394. rev02even
  50395. byte_27535:
  50396. dc.b 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0,$FE, 2
  50397. even
  50398. ; ----------------------------------------------------------------------------
  50399. ; sprite mappings
  50400. ; ----------------------------------------------------------------------------
  50401. Obj67_MapUnc_27548: BINCLUDE "mappings/sprite/obj67.bin"
  50402. ; ===========================================================================
  50403.  
  50404. if ~~removeJmpTos
  50405. JmpTo19_DisplaySprite
  50406. jmp (DisplaySprite).l
  50407. JmpTo7_AnimateSprite
  50408. jmp (AnimateSprite).l
  50409. JmpTo4_MarkObjGone3
  50410. jmp (MarkObjGone3).l
  50411.  
  50412. align 4
  50413. else
  50414. JmpTo4_MarkObjGone3
  50415. jmp (MarkObjGone3).l
  50416. endif
  50417.  
  50418.  
  50419.  
  50420.  
  50421. ; ===========================================================================
  50422. ; ----------------------------------------------------------------------------
  50423. ; Object 68 - Block with a spike that comes out of each side sequentially from MTZ
  50424. ; ----------------------------------------------------------------------------
  50425. spikearoundblock_initial_x_pos = objoff_30
  50426. spikearoundblock_initial_y_pos = objoff_32
  50427. spikearoundblock_offset = objoff_34 ; offset from the center
  50428. spikearoundblock_position = objoff_36 ; 0 = retracted or expanding, 1 = expanded or retracting
  50429. spikearoundblock_waiting = objoff_38 ; 0 = moving, 1 = waiting
  50430. ; Sprite_27594:
  50431. Obj68:
  50432. moveq #0,d0
  50433. move.b routine(a0),d0
  50434. move.w Obj68_Index(pc,d0.w),d1
  50435. jmp Obj68_Index(pc,d1.w)
  50436. ; ===========================================================================
  50437. ; off_275A2:
  50438. Obj68_Index: offsetTable
  50439. offsetTableEntry.w Obj68_Init ; 0
  50440. offsetTableEntry.w Obj68_Block ; 2
  50441. offsetTableEntry.w Obj68_Spike ; 4
  50442. ; ===========================================================================
  50443. ; loc_275A8:
  50444. Obj68_Init:
  50445. addq.b #2,routine(a0)
  50446. move.l #Obj68_Obj6D_MapUnc_27750,mappings(a0)
  50447. move.w #make_art_tile(ArtTile_ArtNem_MtzSpikeBlock,3,0),art_tile(a0)
  50448. jsrto (Adjust2PArtPointer).l, JmpTo31_Adjust2PArtPointer
  50449. move.b #4,render_flags(a0)
  50450. move.b #$10,width_pixels(a0)
  50451. move.b #4,priority(a0)
  50452. jsrto (SingleObjLoad2).l, JmpTo12_SingleObjLoad2
  50453. bne.s +
  50454. _move.b id(a0),id(a1) ; load obj68
  50455. addq.b #4,routine(a1)
  50456. move.w x_pos(a0),x_pos(a1)
  50457. move.w y_pos(a0),y_pos(a1)
  50458. move.w x_pos(a1),spikearoundblock_initial_x_pos(a1)
  50459. move.w y_pos(a1),spikearoundblock_initial_y_pos(a1)
  50460. move.l mappings(a0),mappings(a1)
  50461. move.w #make_art_tile(ArtTile_ArtNem_MtzSpike,1,0),art_tile(a1)
  50462. ori.b #4,render_flags(a1)
  50463. move.b #$10,width_pixels(a1)
  50464. move.b #4,priority(a1)
  50465. move.w (Timer_frames).w,d0
  50466. lsr.w #6,d0
  50467. move.w d0,d1
  50468. andi.w #1,d0
  50469. move.w d0,spikearoundblock_position(a1)
  50470. lsr.w #1,d1
  50471. add.b subtype(a0),d1
  50472. andi.w #3,d1
  50473. move.b d1,routine_secondary(a1)
  50474. move.b d1,mapping_frame(a1)
  50475. lea (Obj68_CollisionFlags).l,a2
  50476. move.b (a2,d1.w),collision_flags(a1)
  50477. +
  50478. move.b #4,mapping_frame(a0)
  50479. ; loc_2764A:
  50480. Obj68_Block:
  50481. move.w #$1B,d1
  50482. move.w #$10,d2
  50483. move.w #$11,d3
  50484. move.w x_pos(a0),d4
  50485. jsrto (SolidObject).l, JmpTo11_SolidObject
  50486. jmpto (MarkObjGone).l, JmpTo20_MarkObjGone
  50487. ; ===========================================================================
  50488. ; loc_27662:
  50489. Obj68_Spike:
  50490. bsr.w Obj68_Spike_Action
  50491. moveq #0,d0
  50492. move.b routine_secondary(a0),d0
  50493. add.w d0,d0
  50494. move.w Obj68_Spike_Directions(pc,d0.w),d1
  50495. jsr Obj68_Spike_Directions(pc,d1.w)
  50496. move.w spikearoundblock_initial_x_pos(a0),d0
  50497. jmpto (MarkObjGone2).l, JmpTo2_MarkObjGone2
  50498. ; ===========================================================================
  50499. ; off_2767E:
  50500. Obj68_Spike_Directions: offsetTable
  50501. offsetTableEntry.w Obj68_Spike_Up ; 0
  50502. offsetTableEntry.w Obj68_Spike_Right ; 1
  50503. offsetTableEntry.w Obj68_Spike_Down ; 2
  50504. offsetTableEntry.w Obj68_Spike_Left ; 3
  50505. ; ===========================================================================
  50506. ; These routines update the position of the spike.
  50507. ; ===========================================================================
  50508. ; loc_27686:
  50509. Obj68_Spike_Up:
  50510. moveq #0,d0
  50511. move.b spikearoundblock_offset(a0),d0
  50512. neg.w d0
  50513. add.w spikearoundblock_initial_y_pos(a0),d0
  50514. move.w d0,y_pos(a0)
  50515. rts
  50516. ; ===========================================================================
  50517. ; loc_27698:
  50518. Obj68_Spike_Right:
  50519. moveq #0,d0
  50520. move.b spikearoundblock_offset(a0),d0
  50521. add.w spikearoundblock_initial_x_pos(a0),d0
  50522. move.w d0,x_pos(a0)
  50523. rts
  50524. ; ===========================================================================
  50525. ; loc_276A8:
  50526. Obj68_Spike_Down:
  50527. moveq #0,d0
  50528. move.b spikearoundblock_offset(a0),d0
  50529. add.w spikearoundblock_initial_y_pos(a0),d0
  50530. move.w d0,y_pos(a0)
  50531. rts
  50532. ; ===========================================================================
  50533. ; loc_276B8:
  50534. Obj68_Spike_Left:
  50535. moveq #0,d0
  50536. move.b spikearoundblock_offset(a0),d0
  50537. neg.w d0
  50538. add.w spikearoundblock_initial_x_pos(a0),d0
  50539. move.w d0,x_pos(a0)
  50540. rts
  50541. ; ===========================================================================
  50542. ; loc_276CA:
  50543. Obj68_Spike_Action:
  50544. tst.w spikearoundblock_waiting(a0)
  50545. beq.s +
  50546. move.b (Timer_frames+1).w,d0
  50547. andi.b #$3F,d0
  50548. bne.s Obj68_Spike_Action_End
  50549. clr.w spikearoundblock_waiting(a0)
  50550. tst.b render_flags(a0) ; is the spike on the screen?
  50551. bpl.s + ; if not, branch
  50552. move.w #SndID_SpikesMove,d0
  50553. jsr (PlaySound).l
  50554. +
  50555. tst.w spikearoundblock_position(a0)
  50556. beq.s Obj68_Spike_Expanding
  50557. ; Obj68_Spike_Retracting:
  50558. subi.w #$800,spikearoundblock_offset(a0) ; retract the spike
  50559. bcc.s Obj68_Spike_Action_End
  50560. move.w #0,spikearoundblock_offset(a0)
  50561. move.w #0,spikearoundblock_position(a0)
  50562. move.w #1,spikearoundblock_waiting(a0)
  50563. addq.b #1,routine_secondary(a0)
  50564. andi.b #3,routine_secondary(a0)
  50565. moveq #0,d0
  50566. move.b routine_secondary(a0),d0
  50567. move.b d0,mapping_frame(a0)
  50568. move.b Obj68_CollisionFlags(pc,d0.w),collision_flags(a0)
  50569. rts
  50570. ; ===========================================================================
  50571. ; loc_2772A:
  50572. Obj68_Spike_Expanding:
  50573. addi.w #$800,spikearoundblock_offset(a0) ; expand the spike
  50574. cmpi.w #$2000,spikearoundblock_offset(a0) ; did it reach full expansion?
  50575. blo.s Obj68_Spike_Action_End ; if not, return
  50576. move.w #$2000,spikearoundblock_offset(a0)
  50577. move.w #1,spikearoundblock_position(a0)
  50578. move.w #1,spikearoundblock_waiting(a0)
  50579. ; return_2774A:
  50580. Obj68_Spike_Action_End:
  50581. rts
  50582. ; ===========================================================================
  50583. ; byte_2774C:
  50584. Obj68_CollisionFlags:
  50585. dc.b $84 ; 0
  50586. dc.b $A6 ; 1
  50587. dc.b $84 ; 2
  50588. dc.b $A6 ; 3
  50589. ; ----------------------------------------------------------------------------
  50590. ; sprite mappings
  50591. ; ----------------------------------------------------------------------------
  50592. Obj68_Obj6D_MapUnc_27750: BINCLUDE "mappings/sprite/obj68.bin"
  50593. ; ===========================================================================
  50594. ; ----------------------------------------------------------------------------
  50595. ; Object 6D - Floor spike from MTZ
  50596. ; ----------------------------------------------------------------------------
  50597. floorspike_initial_x_pos = objoff_30
  50598. floorspike_initial_y_pos = objoff_32
  50599. floorspike_offset = objoff_34 ; on the y axis
  50600. floorspike_position = objoff_36 ; 0 = retracted or expanding, 1 = expanded or retracting
  50601. floorspike_waiting = objoff_38 ; 0 = moving, 1 = waiting
  50602. floorspike_delay = objoff_3A ; short delay before the spike retracts
  50603. ; Sprite_27794:
  50604. Obj6D:
  50605. moveq #0,d0
  50606. move.b routine(a0),d0
  50607. move.w Obj6D_Index(pc,d0.w),d1
  50608. jmp Obj6D_Index(pc,d1.w)
  50609. ; ===========================================================================
  50610. ; off_277A2:
  50611. Obj6D_Index: offsetTable
  50612. offsetTableEntry.w Obj6D_Init ; 0
  50613. offsetTableEntry.w Obj6D_Main ; 2
  50614. ; ===========================================================================
  50615. ; loc_277A6:
  50616. Obj6D_Init:
  50617. addq.b #2,routine(a0)
  50618. move.l #Obj68_Obj6D_MapUnc_27750,mappings(a0)
  50619. move.w #make_art_tile(ArtTile_ArtNem_MtzSpike,1,0),art_tile(a0)
  50620. jsrto (Adjust2PArtPointer).l, JmpTo31_Adjust2PArtPointer
  50621. ori.b #4,render_flags(a0)
  50622. move.b #4,width_pixels(a0)
  50623. move.b #4,priority(a0)
  50624. move.w x_pos(a0),floorspike_initial_x_pos(a0)
  50625. move.w y_pos(a0),floorspike_initial_y_pos(a0)
  50626. move.b #$84,collision_flags(a0)
  50627. ; loc_277E0:
  50628. Obj6D_Main:
  50629. bsr.w Obj6D_Action
  50630. moveq #0,d0
  50631. move.b floorspike_offset(a0),d0
  50632. neg.w d0
  50633. add.w floorspike_initial_y_pos(a0),d0
  50634. move.w d0,y_pos(a0)
  50635. move.w floorspike_initial_x_pos(a0),d0
  50636. jmpto (MarkObjGone2).l, JmpTo2_MarkObjGone2
  50637. ; ===========================================================================
  50638. ; loc_277FC:
  50639. Obj6D_Action:
  50640. tst.w floorspike_delay(a0)
  50641. beq.s +
  50642. subq.w #1,floorspike_delay(a0)
  50643. rts
  50644. ; ---------------------------------------------------------------------------
  50645. +
  50646. tst.w floorspike_waiting(a0)
  50647. beq.s +
  50648. move.b (Timer_frames+1).w,d0
  50649. sub.b subtype(a0),d0
  50650. andi.b #$7F,d0
  50651. bne.s Obj6D_Action_End
  50652. clr.w floorspike_waiting(a0)
  50653. +
  50654. tst.w floorspike_position(a0)
  50655. beq.s Obj6D_Expanding
  50656. ; Obj6D_Retracting:
  50657. subi.w #$400,floorspike_offset(a0)
  50658. bcc.s Obj6D_Action_End
  50659. move.w #0,floorspike_offset(a0)
  50660. move.w #0,floorspike_position(a0)
  50661. move.w #1,floorspike_waiting(a0)
  50662. rts
  50663. ; ===========================================================================
  50664. ; loc_27842:
  50665. Obj6D_Expanding:
  50666. addi.w #$400,floorspike_offset(a0)
  50667. cmpi.w #$2000,floorspike_offset(a0)
  50668. blo.s Obj6D_Action_End
  50669. move.w #$2000,floorspike_offset(a0)
  50670. move.w #1,floorspike_position(a0)
  50671. move.w #3,floorspike_delay(a0)
  50672. ; return_27862:
  50673. Obj6D_Action_End:
  50674. rts
  50675. ; ===========================================================================
  50676.  
  50677. if ~~removeJmpTos
  50678. JmpTo20_MarkObjGone
  50679. jmp (MarkObjGone).l
  50680. JmpTo12_SingleObjLoad2
  50681. jmp (SingleObjLoad2).l
  50682. JmpTo31_Adjust2PArtPointer
  50683. jmp (Adjust2PArtPointer).l
  50684. JmpTo11_SolidObject
  50685. jmp (SolidObject).l
  50686. JmpTo2_MarkObjGone2
  50687. jmp (MarkObjGone2).l
  50688.  
  50689. align 4
  50690. endif
  50691.  
  50692.  
  50693.  
  50694.  
  50695. ; ===========================================================================
  50696. ; ----------------------------------------------------------------------------
  50697. ; Object 69 - Nut from MTZ
  50698. ; ----------------------------------------------------------------------------
  50699. ; Sprite_27884:
  50700. Obj69:
  50701. moveq #0,d0
  50702. move.b routine(a0),d0
  50703. move.w Obj69_Index(pc,d0.w),d1
  50704. jmp Obj69_Index(pc,d1.w)
  50705. ; ===========================================================================
  50706. ; off_27892:
  50707. Obj69_Index: offsetTable
  50708. offsetTableEntry.w Obj69_Init ; 0
  50709. offsetTableEntry.w Obj69_Main ; 2
  50710. offsetTableEntry.w loc_279FC ; 4
  50711. offsetTableEntry.w loc_278F4 ; 6
  50712. ; ===========================================================================
  50713. ; loc_2789A:
  50714. Obj69_Init:
  50715. addq.b #2,routine(a0)
  50716. move.l #Obj69_MapUnc_27A26,mappings(a0)
  50717. move.w #make_art_tile(ArtTile_ArtNem_MtzAsstBlocks,1,0),art_tile(a0)
  50718. jsrto (Adjust2PArtPointer).l, JmpTo32_Adjust2PArtPointer
  50719. move.b #4,render_flags(a0)
  50720. move.b #$20,width_pixels(a0)
  50721. move.b #$B,y_radius(a0)
  50722. move.b #4,priority(a0)
  50723. move.w y_pos(a0),objoff_32(a0)
  50724. move.b subtype(a0),d0
  50725. andi.w #$7F,d0
  50726. lsl.w #3,d0
  50727. move.w d0,objoff_36(a0)
  50728. ; loc_278DC:
  50729. Obj69_Main:
  50730. lea (MainCharacter).w,a1 ; a1=character
  50731. lea objoff_38(a0),a4
  50732. moveq #p1_standing_bit,d6
  50733. bsr.s Obj69_Action
  50734. lea (Sidekick).w,a1 ; a1=character
  50735. lea objoff_3C(a0),a4
  50736. moveq #p2_standing_bit,d6
  50737. bsr.s Obj69_Action
  50738.  
  50739. loc_278F4:
  50740.  
  50741. andi.w #$7FF,y_pos(a0)
  50742. move.w #$2B,d1
  50743. move.w #$C,d2
  50744. move.w #$D,d3
  50745. move.w x_pos(a0),d4
  50746. jsrto (SolidObject).l, JmpTo12_SolidObject
  50747. jmpto (MarkObjGone).l, JmpTo21_MarkObjGone
  50748. ; ===========================================================================
  50749. ; loc_27912:
  50750. Obj69_Action:
  50751. btst d6,status(a0)
  50752. bne.s +
  50753. clr.b (a4)
  50754. +
  50755. moveq #0,d0
  50756. move.b (a4),d0
  50757. move.w Obj69_Modes(pc,d0.w),d0
  50758. jmp Obj69_Modes(pc,d0.w)
  50759. ; ===========================================================================
  50760. ; off_27926:
  50761. Obj69_Modes: offsetTable
  50762. offsetTableEntry.w loc_2792C ; 0
  50763. offsetTableEntry.w loc_2794C ; 2
  50764. offsetTableEntry.w loc_2796E ; 4
  50765. ; ===========================================================================
  50766.  
  50767. loc_2792C:
  50768. btst d6,status(a0)
  50769. bne.s +
  50770. rts
  50771. ; ===========================================================================
  50772. +
  50773. addq.b #2,(a4)
  50774. move.b #0,1(a4)
  50775. move.w x_pos(a0),d0
  50776. sub.w x_pos(a1),d0
  50777. bcc.s loc_2794C
  50778. move.b #1,1(a4)
  50779.  
  50780. loc_2794C:
  50781.  
  50782. move.w x_pos(a1),d0
  50783. sub.w x_pos(a0),d0
  50784. tst.b 1(a4)
  50785. beq.s +
  50786. addi.w #$F,d0
  50787. +
  50788. cmpi.w #$10,d0
  50789. bhs.s + ; rts
  50790. move.w x_pos(a0),x_pos(a1)
  50791. addq.b #2,(a4)
  50792. +
  50793. rts
  50794. ; ===========================================================================
  50795.  
  50796. loc_2796E:
  50797. move.w x_pos(a1),d0
  50798. sub.w x_pos(a0),d0
  50799. bcc.s loc_279D4
  50800. add.w d0,objoff_34(a0)
  50801. move.w x_pos(a0),x_pos(a1)
  50802. move.w objoff_34(a0),d0
  50803. asr.w #3,d0
  50804. move.w d0,d1
  50805. asr.w #1,d0
  50806. andi.w #3,d0
  50807. move.b d0,mapping_frame(a0)
  50808. neg.w d1
  50809. add.w objoff_32(a0),d1
  50810. move.w d1,y_pos(a0)
  50811. sub.w objoff_32(a0),d1
  50812. move.w objoff_36(a0),d0
  50813. cmp.w d0,d1
  50814. blt.s return_279D2
  50815. move.w d0,d1
  50816. add.w objoff_32(a0),d1
  50817. move.w d1,y_pos(a0)
  50818. lsl.w #3,d0
  50819. neg.w d0
  50820. move.w d0,objoff_34(a0)
  50821. move.b #0,mapping_frame(a0)
  50822. tst.b subtype(a0)
  50823. bmi.s loc_279CC
  50824. clr.b (a4)
  50825. rts
  50826. ; ===========================================================================
  50827.  
  50828. loc_279CC:
  50829. move.b #4,routine(a0)
  50830.  
  50831. return_279D2:
  50832. rts
  50833. ; ===========================================================================
  50834.  
  50835. loc_279D4:
  50836. add.w d0,objoff_34(a0)
  50837. move.w x_pos(a0),x_pos(a1)
  50838. move.w objoff_34(a0),d0
  50839. asr.w #3,d0
  50840. move.w d0,d1
  50841. asr.w #1,d0
  50842. andi.w #3,d0
  50843. move.b d0,mapping_frame(a0)
  50844. neg.w d1
  50845. add.w objoff_32(a0),d1
  50846. move.w d1,y_pos(a0)
  50847. rts
  50848. ; ===========================================================================
  50849.  
  50850. loc_279FC:
  50851. jsrto (ObjectMove).l, JmpTo13_ObjectMove
  50852. addi.w #$38,y_vel(a0)
  50853. jsrto (ObjCheckFloorDist).l, JmpTo_ObjCheckFloorDist
  50854. tst.w d1
  50855. bpl.w +
  50856. add.w d1,y_pos(a0)
  50857. andi.w #$7FF,y_pos(a0)
  50858. clr.w y_vel(a0)
  50859. addq.b #2,routine(a0)
  50860. +
  50861. bra.w loc_278F4
  50862. ; ===========================================================================
  50863. ; ----------------------------------------------------------------------------
  50864. ; sprite mappings
  50865. ; ----------------------------------------------------------------------------
  50866. Obj69_MapUnc_27A26: BINCLUDE "mappings/sprite/obj69.bin"
  50867. ; ===========================================================================
  50868.  
  50869. if gameRevision<2
  50870. nop
  50871. endif
  50872.  
  50873. if ~~removeJmpTos
  50874. JmpTo21_MarkObjGone
  50875. jmp (MarkObjGone).l
  50876. JmpTo_ObjCheckFloorDist
  50877. jmp (ObjCheckFloorDist).l
  50878. JmpTo32_Adjust2PArtPointer
  50879. jmp (Adjust2PArtPointer).l
  50880. JmpTo12_SolidObject
  50881. jmp (SolidObject).l
  50882. ; loc_27AA8:
  50883. JmpTo13_ObjectMove
  50884. jmp (ObjectMove).l
  50885.  
  50886. align 4
  50887. endif
  50888.  
  50889.  
  50890.  
  50891.  
  50892. ; ===========================================================================
  50893. ; ----------------------------------------------------------------------------
  50894. ; Object 6A - Platform that moves when you walk off of it, from MTZ
  50895. ; ----------------------------------------------------------------------------
  50896. ; Sprite_27AB0:
  50897. Obj6A:
  50898. moveq #0,d0
  50899. move.b routine(a0),d0
  50900. move.w Obj6A_Index(pc,d0.w),d1
  50901. jmp Obj6A_Index(pc,d1.w)
  50902. ; ===========================================================================
  50903. ; off_27ABE:
  50904. Obj6A_Index: offsetTable
  50905. offsetTableEntry.w Obj6A_Init ; 0
  50906. offsetTableEntry.w loc_27BDE ; 2
  50907. offsetTableEntry.w loc_27C66 ; 4
  50908. ; ===========================================================================
  50909. ; loc_27AC4:
  50910. Obj6A_Init:
  50911. addq.b #2,routine(a0)
  50912. move.l #Obj65_Obj6A_Obj6B_MapUnc_26EC8,mappings(a0)
  50913. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,3,0),art_tile(a0)
  50914. ori.b #4,render_flags(a0)
  50915. move.b #4,priority(a0)
  50916. move.b #$20,width_pixels(a0)
  50917. move.b #$C,y_radius(a0)
  50918. move.l #byte_27CDC,objoff_2C(a0)
  50919. move.b #1,mapping_frame(a0)
  50920. cmpi.b #mystic_cave_zone,(Current_Zone).w
  50921. bne.w loc_27BC4
  50922. addq.b #2,routine(a0)
  50923. move.l #Obj6A_MapUnc_27D30,mappings(a0)
  50924. move.w #make_art_tile(ArtTile_ArtNem_Crate,3,0),art_tile(a0)
  50925. move.b #$20,width_pixels(a0)
  50926. move.b #$20,y_radius(a0)
  50927. move.l #byte_27CF4,objoff_2C(a0)
  50928. btst #0,status(a0)
  50929. beq.s +
  50930. move.l #byte_27D12,objoff_2C(a0)
  50931. +
  50932. move.b #0,mapping_frame(a0)
  50933. cmpi.b #$18,subtype(a0)
  50934. bne.w loc_27BD0
  50935. jsrto (SingleObjLoad2).l, JmpTo13_SingleObjLoad2
  50936. bne.s ++
  50937. bsr.s Obj6A_InitSubObject
  50938. addi.w #$40,x_pos(a1)
  50939. addi.w #$40,y_pos(a1)
  50940. move.b #6,subtype(a1)
  50941. btst #0,status(a0)
  50942. beq.s +
  50943. move.b #$C,subtype(a1)
  50944. +
  50945. jsrto (SingleObjLoad2).l, JmpTo13_SingleObjLoad2
  50946. bne.s +
  50947. bsr.s Obj6A_InitSubObject
  50948. subi.w #$40,x_pos(a1)
  50949. addi.w #$40,y_pos(a1)
  50950. move.b #$C,subtype(a1)
  50951. btst #0,status(a0)
  50952. beq.s +
  50953. move.b #6,subtype(a1)
  50954. +
  50955. bra.s loc_27BC4
  50956. ; ===========================================================================
  50957. ; loc_27B9E:
  50958. Obj6A_InitSubObject:
  50959. _move.b id(a0),id(a1) ; load obj6A
  50960. move.w x_pos(a0),x_pos(a1)
  50961. move.w y_pos(a0),y_pos(a1)
  50962. move.w x_pos(a0),objoff_32(a1)
  50963. move.w y_pos(a0),objoff_30(a1)
  50964. move.b status(a0),status(a1)
  50965. rts
  50966. ; ===========================================================================
  50967.  
  50968. loc_27BC4:
  50969. move.w x_pos(a0),objoff_32(a0)
  50970. move.w y_pos(a0),objoff_30(a0)
  50971.  
  50972. loc_27BD0:
  50973. jsrto (Adjust2PArtPointer).l, JmpTo33_Adjust2PArtPointer
  50974. move.b subtype(a0),objoff_38(a0)
  50975. bra.w loc_27CA2
  50976. ; ===========================================================================
  50977.  
  50978. loc_27BDE:
  50979. move.w x_pos(a0),-(sp)
  50980. tst.w objoff_36(a0)
  50981. bne.s loc_27C2E
  50982. move.b objoff_3C(a0),d1
  50983. move.b status(a0),d0
  50984. btst #p1_standing_bit,d0
  50985. bne.s loc_27C0A
  50986. btst #p1_standing_bit,d1
  50987. beq.s loc_27C0E
  50988. move.b #1,objoff_36(a0)
  50989. move.b #0,objoff_3C(a0)
  50990. bra.s loc_27C3E
  50991. ; ===========================================================================
  50992.  
  50993. loc_27C0A:
  50994. move.b d0,objoff_3C(a0)
  50995.  
  50996. loc_27C0E:
  50997. btst #p2_standing_bit,d0
  50998. bne.s loc_27C28
  50999. btst #p2_standing_bit,d1
  51000. beq.s loc_27C3E
  51001. move.b #1,objoff_36(a0)
  51002. move.b #0,objoff_3C(a0)
  51003. bra.s loc_27C3E
  51004. ; ===========================================================================
  51005.  
  51006. loc_27C28:
  51007. move.b d0,objoff_3C(a0)
  51008. bra.s loc_27C3E
  51009. ; ===========================================================================
  51010. loc_27C2E:
  51011. jsr (ObjectMove).l
  51012. subq.w #1,objoff_34(a0)
  51013. bne.s loc_27C3E
  51014. bsr.w loc_27CA2
  51015.  
  51016. loc_27C3E:
  51017. move.w (sp)+,d4
  51018. tst.b render_flags(a0)
  51019. bpl.s loc_27C5E
  51020. moveq #0,d1
  51021. move.b width_pixels(a0),d1
  51022. addi.w #$B,d1
  51023. moveq #0,d2
  51024. move.b y_radius(a0),d2
  51025. move.w d2,d3
  51026. addq.w #1,d3
  51027. jsrto (SolidObject).l, JmpTo13_SolidObject
  51028.  
  51029. loc_27C5E:
  51030. move.w objoff_32(a0),d0
  51031. jmpto (MarkObjGone2).l, JmpTo3_MarkObjGone2
  51032. ; ===========================================================================
  51033.  
  51034. loc_27C66:
  51035. move.w x_pos(a0),-(sp)
  51036. jsr (ObjectMove).l
  51037. subq.w #1,objoff_34(a0)
  51038. bne.s loc_27C7A
  51039. bsr.w loc_27CA2
  51040.  
  51041. loc_27C7A:
  51042. move.w (sp)+,d4
  51043. tst.b render_flags(a0)
  51044. bpl.s loc_27C9A
  51045. moveq #0,d1
  51046. move.b width_pixels(a0),d1
  51047. addi.w #$B,d1
  51048. moveq #0,d2
  51049. move.b y_radius(a0),d2
  51050. move.w d2,d3
  51051. addq.w #1,d3
  51052. jsrto (SolidObject).l, JmpTo13_SolidObject
  51053.  
  51054. loc_27C9A:
  51055. move.w objoff_32(a0),d0
  51056. jmpto (MarkObjGone2).l, JmpTo3_MarkObjGone2
  51057. ; ===========================================================================
  51058.  
  51059. loc_27CA2:
  51060. moveq #0,d0
  51061. move.b objoff_38(a0),d0
  51062. movea.l objoff_2C(a0),a1 ; a1=object
  51063. lea (a1,d0.w),a1
  51064. move.w (a1)+,x_vel(a0)
  51065. move.w (a1)+,y_vel(a0)
  51066. move.w (a1)+,objoff_34(a0)
  51067. move.w #7,objoff_3A(a0)
  51068. move.b #0,objoff_36(a0)
  51069. addq.b #6,objoff_38(a0)
  51070. cmpi.b #$18,objoff_38(a0)
  51071. blo.s return_27CDA
  51072. move.b #0,objoff_38(a0)
  51073.  
  51074. return_27CDA:
  51075. rts
  51076. ; ===========================================================================
  51077. byte_27CDC:
  51078. dc.b 0, 0, 4, 0, 0,$10, 4, 0,$FE, 0, 0,$20, 0, 0, 4, 0
  51079. dc.b 0,$10,$FC, 0,$FE, 0, 0,$20; 16
  51080. byte_27CF4:
  51081. dc.b 0, 0, 1, 0, 0,$40,$FF, 0, 0, 0, 0,$80, 0, 0,$FF, 0
  51082. dc.b 0,$40, 1, 0, 0, 0, 0,$80, 1, 0, 0, 0, 0,$40; 16
  51083. byte_27D12:
  51084. dc.b 0, 0, 1, 0, 0,$40, 1, 0, 0, 0, 0,$80, 0, 0,$FF, 0
  51085. dc.b 0,$40,$FF, 0, 0, 0, 0,$80,$FF, 0, 0, 0, 0,$40; 16
  51086. ; ----------------------------------------------------------------------------
  51087. ; sprite mappings
  51088. ; ----------------------------------------------------------------------------
  51089. Obj6A_MapUnc_27D30: BINCLUDE "mappings/sprite/obj6A.bin"
  51090. ; ===========================================================================
  51091.  
  51092. if ~~removeJmpTos
  51093. JmpTo13_SingleObjLoad2
  51094. jmp (SingleObjLoad2).l
  51095. JmpTo33_Adjust2PArtPointer
  51096. jmp (Adjust2PArtPointer).l
  51097. JmpTo13_SolidObject
  51098. jmp (SolidObject).l
  51099. JmpTo3_MarkObjGone2
  51100. jmp (MarkObjGone2).l
  51101.  
  51102. align 4
  51103. endif
  51104.  
  51105.  
  51106.  
  51107.  
  51108. ; ===========================================================================
  51109. ; ----------------------------------------------------------------------------
  51110. ; Object 6B - Immobile platform from MTZ
  51111. ; ----------------------------------------------------------------------------
  51112. ; Sprite_27D6C:
  51113. Obj6B:
  51114. moveq #0,d0
  51115. move.b routine(a0),d0
  51116. move.w Obj6B_Index(pc,d0.w),d1
  51117. jmp Obj6B_Index(pc,d1.w)
  51118. ; ===========================================================================
  51119. ; off_27D7A:
  51120. Obj6B_Index: offsetTable
  51121. offsetTableEntry.w Obj6B_Init ; 0
  51122. offsetTableEntry.w Obj6B_Main ; 2
  51123. ; ===========================================================================
  51124. byte_27D7E:
  51125. dc.b $20
  51126. dc.b $C ; 1
  51127. dc.b 1 ; 2
  51128. dc.b 0 ; 3
  51129. dc.b $10 ; 4
  51130. dc.b $10 ; 5
  51131. dc.b 0 ; 6
  51132. dc.b 0 ; 7
  51133. ; ===========================================================================
  51134. ; loc_27D86:
  51135. Obj6B_Init:
  51136. addq.b #2,routine(a0)
  51137. move.l #Obj65_Obj6A_Obj6B_MapUnc_26EC8,mappings(a0)
  51138. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,3,0),art_tile(a0)
  51139. cmpi.b #chemical_plant_zone,(Current_Zone).w
  51140. bne.s +
  51141. move.l #Obj6B_MapUnc_2800E,mappings(a0)
  51142. move.w #make_art_tile(ArtTile_ArtNem_CPZStairBlock,3,0),art_tile(a0)
  51143. +
  51144. jsrto (Adjust2PArtPointer).l, JmpTo34_Adjust2PArtPointer
  51145. move.b #4,render_flags(a0)
  51146. move.b #3,priority(a0)
  51147. moveq #0,d0
  51148. move.b subtype(a0),d0
  51149. lsr.w #2,d0
  51150. andi.w #$1C,d0
  51151. lea byte_27D7E(pc,d0.w),a2
  51152. move.b (a2)+,width_pixels(a0)
  51153. move.b (a2)+,y_radius(a0)
  51154. move.b (a2)+,mapping_frame(a0)
  51155. move.w x_pos(a0),objoff_34(a0)
  51156. move.w y_pos(a0),objoff_30(a0)
  51157. move.b status(a0),objoff_2E(a0)
  51158. moveq #0,d0
  51159. move.b subtype(a0),d0
  51160. andi.w #$F,d0
  51161. subq.w #8,d0
  51162. bcs.s Obj6B_Main
  51163. lsl.w #2,d0
  51164. lea (Oscillating_Data+$2A).w,a2
  51165. lea (a2,d0.w),a2
  51166. tst.w (a2)
  51167. bpl.s Obj6B_Main
  51168. bchg #0,objoff_2E(a0)
  51169. ; loc_27E0E:
  51170. Obj6B_Main:
  51171. move.w x_pos(a0),-(sp)
  51172. moveq #0,d0
  51173. move.b subtype(a0),d0
  51174. andi.w #$F,d0
  51175. add.w d0,d0
  51176. move.w Obj6B_Types(pc,d0.w),d1
  51177. jsr Obj6B_Types(pc,d1.w)
  51178. move.w (sp)+,d4
  51179. tst.b render_flags(a0)
  51180. bpl.s +
  51181. moveq #0,d1
  51182. move.b width_pixels(a0),d1
  51183. addi.w #$B,d1
  51184. moveq #0,d2
  51185. move.b y_radius(a0),d2
  51186. move.w d2,d3
  51187. addq.w #1,d3
  51188. jsrto (SolidObject).l, JmpTo14_SolidObject
  51189. +
  51190. move.w objoff_34(a0),d0
  51191. jmpto (MarkObjGone2).l, JmpTo4_MarkObjGone2
  51192. ; ===========================================================================
  51193. ; off_27E4E:
  51194. Obj6B_Types: offsetTable
  51195. offsetTableEntry.w Obj6B_Type_Immobile ; 0
  51196. offsetTableEntry.w loc_27E68 ; 1
  51197. offsetTableEntry.w loc_27E74 ; 2
  51198. offsetTableEntry.w loc_27E96 ; 3
  51199. offsetTableEntry.w loc_27EA2 ; 4
  51200. offsetTableEntry.w loc_27EC4 ; 5
  51201. offsetTableEntry.w loc_27EE2 ; 6
  51202. offsetTableEntry.w loc_27F10 ; 7
  51203. offsetTableEntry.w loc_27F4E ; 8
  51204. offsetTableEntry.w loc_27F60 ; 9
  51205. offsetTableEntry.w loc_27F70 ; $A
  51206. offsetTableEntry.w loc_27F80 ; $B
  51207. ; ===========================================================================
  51208. ; return_27E66:
  51209. Obj6B_Type_Immobile:
  51210. rts
  51211. ; ===========================================================================
  51212.  
  51213. loc_27E68:
  51214. move.w #$40,d1
  51215. moveq #0,d0
  51216. move.b (Oscillating_Data+8).w,d0
  51217. bra.s +
  51218. ; ===========================================================================
  51219.  
  51220. loc_27E74:
  51221. move.w #$80,d1
  51222. moveq #0,d0
  51223. move.b (Oscillating_Data+$1C).w,d0
  51224. +
  51225. btst #0,status(a0)
  51226. beq.s +
  51227. neg.w d0
  51228. add.w d1,d0
  51229. +
  51230. move.w objoff_34(a0),d1
  51231. sub.w d0,d1
  51232. move.w d1,x_pos(a0)
  51233. rts
  51234. ; ===========================================================================
  51235.  
  51236. loc_27E96:
  51237. move.w #$40,d1
  51238. moveq #0,d0
  51239. move.b (Oscillating_Data+8).w,d0
  51240. bra.s loc_27EAC
  51241. ; ===========================================================================
  51242.  
  51243. loc_27EA2:
  51244. move.w #$80,d1
  51245. moveq #0,d0
  51246. move.b (Oscillating_Data+$1C).w,d0
  51247.  
  51248. loc_27EAC:
  51249. btst #0,status(a0)
  51250. beq.s loc_27EB8
  51251. neg.w d0
  51252. add.w d1,d0
  51253.  
  51254. loc_27EB8:
  51255. move.w objoff_30(a0),d1
  51256. sub.w d0,d1
  51257. move.w d1,y_pos(a0)
  51258. rts
  51259. ; ===========================================================================
  51260.  
  51261. loc_27EC4:
  51262. move.b (Oscillating_Data).w,d0
  51263. lsr.w #1,d0
  51264. add.w objoff_30(a0),d0
  51265. move.w d0,y_pos(a0)
  51266. move.b status(a0),d1
  51267. andi.b #standing_mask,d1
  51268. beq.s return_27EE0
  51269. addq.b #1,subtype(a0)
  51270.  
  51271. return_27EE0:
  51272. rts
  51273. ; ===========================================================================
  51274.  
  51275. loc_27EE2:
  51276. move.l y_pos(a0),d3
  51277. move.w y_vel(a0),d0
  51278. ext.l d0
  51279. asl.l #8,d0
  51280. add.l d0,d3
  51281. move.l d3,y_pos(a0)
  51282. addi_.w #8,y_vel(a0)
  51283. move.w (Camera_Max_Y_pos_now).w,d0
  51284. addi.w #$E0,d0
  51285. cmp.w y_pos(a0),d0
  51286. bhs.s return_27F0E
  51287. move.b #0,subtype(a0)
  51288.  
  51289. return_27F0E:
  51290. rts
  51291. ; ===========================================================================
  51292.  
  51293. loc_27F10:
  51294. tst.b objoff_38(a0)
  51295. bne.s loc_27F26
  51296. move.b status(a0),d0
  51297. andi.b #standing_mask,d0
  51298. beq.s return_27F4C
  51299. move.b #8,objoff_38(a0)
  51300.  
  51301. loc_27F26:
  51302. jsrto (ObjectMove).l, JmpTo14_ObjectMove
  51303. andi.w #$7FF,y_pos(a0)
  51304. cmpi.w #$2A8,y_vel(a0)
  51305. bne.s loc_27F3C
  51306. neg.b objoff_38(a0)
  51307.  
  51308. loc_27F3C:
  51309. move.b objoff_38(a0),d1
  51310. ext.w d1
  51311. add.w d1,y_vel(a0)
  51312. bne.s return_27F4C
  51313. clr.b subtype(a0)
  51314.  
  51315. return_27F4C:
  51316. rts
  51317. ; ===========================================================================
  51318.  
  51319. loc_27F4E:
  51320. move.w #$10,d1
  51321. moveq #0,d0
  51322. move.b (Oscillating_Data+$28).w,d0
  51323. lsr.w #1,d0
  51324. move.w (Oscillating_Data+$2A).w,d3
  51325. bra.s loc_27F8E
  51326. ; ===========================================================================
  51327.  
  51328. loc_27F60:
  51329. move.w #$30,d1
  51330. moveq #0,d0
  51331. move.b (Oscillating_Data+$2C).w,d0
  51332. move.w (Oscillating_Data+$2E).w,d3
  51333. bra.s loc_27F8E
  51334. ; ===========================================================================
  51335.  
  51336. loc_27F70:
  51337. move.w #$50,d1
  51338. moveq #0,d0
  51339. move.b (Oscillating_Data+$30).w,d0
  51340. move.w (Oscillating_Data+$32).w,d3
  51341. bra.s loc_27F8E
  51342. ; ===========================================================================
  51343.  
  51344. loc_27F80:
  51345. move.w #$70,d1
  51346. moveq #0,d0
  51347. move.b (Oscillating_Data+$34).w,d0
  51348. move.w (Oscillating_Data+$36).w,d3
  51349.  
  51350. loc_27F8E:
  51351. tst.w d3
  51352. bne.s loc_27F9C
  51353. addq.b #1,objoff_2E(a0)
  51354. andi.b #3,objoff_2E(a0)
  51355.  
  51356. loc_27F9C:
  51357. move.b objoff_2E(a0),d2
  51358. andi.b #3,d2
  51359. bne.s loc_27FBC
  51360. sub.w d1,d0
  51361. add.w objoff_34(a0),d0
  51362. move.w d0,x_pos(a0)
  51363. neg.w d1
  51364. add.w objoff_30(a0),d1
  51365. move.w d1,y_pos(a0)
  51366. rts
  51367. ; ===========================================================================
  51368.  
  51369. loc_27FBC:
  51370. subq.b #1,d2
  51371. bne.s loc_27FDA
  51372. subq.w #1,d1
  51373. sub.w d1,d0
  51374. neg.w d0
  51375. add.w objoff_30(a0),d0
  51376. move.w d0,y_pos(a0)
  51377. addq.w #1,d1
  51378. add.w objoff_34(a0),d1
  51379. move.w d1,x_pos(a0)
  51380. rts
  51381. ; ===========================================================================
  51382.  
  51383. loc_27FDA:
  51384. subq.b #1,d2
  51385. bne.s loc_27FF8
  51386. subq.w #1,d1
  51387. sub.w d1,d0
  51388. neg.w d0
  51389. add.w objoff_34(a0),d0
  51390. move.w d0,x_pos(a0)
  51391. addq.w #1,d1
  51392. add.w objoff_30(a0),d1
  51393. move.w d1,y_pos(a0)
  51394. rts
  51395. ; ===========================================================================
  51396.  
  51397. loc_27FF8:
  51398. sub.w d1,d0
  51399. add.w objoff_30(a0),d0
  51400. move.w d0,y_pos(a0)
  51401. neg.w d1
  51402. add.w objoff_34(a0),d1
  51403. move.w d1,x_pos(a0)
  51404. rts
  51405. ; ===========================================================================
  51406. ; ----------------------------------------------------------------------------
  51407. ; sprite mappings
  51408. ; ----------------------------------------------------------------------------
  51409. Obj6B_MapUnc_2800E: BINCLUDE "mappings/sprite/obj6B.bin"
  51410. ; ===========================================================================
  51411.  
  51412. if gameRevision<2
  51413. nop
  51414. endif
  51415.  
  51416. if ~~removeJmpTos
  51417. JmpTo34_Adjust2PArtPointer
  51418. jmp (Adjust2PArtPointer).l
  51419. JmpTo14_SolidObject
  51420. jmp (SolidObject).l
  51421. JmpTo4_MarkObjGone2
  51422. jmp (MarkObjGone2).l
  51423. ; loc_2802E:
  51424. JmpTo14_ObjectMove
  51425. jmp (ObjectMove).l
  51426.  
  51427. align 4
  51428. endif
  51429.  
  51430.  
  51431.  
  51432.  
  51433. ; ===========================================================================
  51434. ; ----------------------------------------------------------------------------
  51435. ; Object 6C - Small platform on pulleys (like at the start of MTZ2)
  51436. ; ----------------------------------------------------------------------------
  51437. ; Sprite_28034:
  51438. Obj6C:
  51439. moveq #0,d0
  51440. move.b routine(a0),d0
  51441. move.w Obj6C_Index(pc,d0.w),d1
  51442. jsr Obj6C_Index(pc,d1.w)
  51443. move.w objoff_30(a0),d0
  51444. andi.w #$FF80,d0
  51445. sub.w (Camera_X_pos_coarse).w,d0
  51446. cmpi.w #$280,d0
  51447. bhi.s +
  51448. jmpto (DisplaySprite).l, JmpTo20_DisplaySprite
  51449. ; ===========================================================================
  51450. + jmpto (DeleteObject).l, JmpTo34_DeleteObject
  51451. ; ===========================================================================
  51452. ; off_2805C:
  51453. Obj6C_Index: offsetTable
  51454. offsetTableEntry.w Obj6C_Init ; 0
  51455. offsetTableEntry.w Obj6C_Main ; 2
  51456. ; ===========================================================================
  51457. ; loc_28060:
  51458. Obj6C_Init:
  51459. move.b subtype(a0),d0
  51460. bmi.w loc_28112
  51461. addq.b #2,routine(a0)
  51462. move.l #Obj6C_MapUnc_28372,mappings(a0)
  51463. move.w #make_art_tile(ArtTile_ArtNem_LavaCup,3,0),art_tile(a0)
  51464. ori.b #4,render_flags(a0)
  51465. move.b #$10,width_pixels(a0)
  51466. move.b #4,priority(a0)
  51467. jsrto (Adjust2PArtPointer).l, JmpTo35_Adjust2PArtPointer
  51468. move.b #0,mapping_frame(a0)
  51469. moveq #0,d0
  51470. move.b subtype(a0),d0
  51471. move.w d0,d1
  51472. lsr.w #3,d0
  51473. andi.w #$1E,d0
  51474. lea off_28252(pc),a2
  51475. adda.w (a2,d0.w),a2
  51476. move.w (a2)+,objoff_38(a0)
  51477. move.l a2,objoff_3C(a0)
  51478. andi.w #$F,d1
  51479. lsl.w #2,d1
  51480. move.b d1,objoff_38(a0)
  51481. move.b #4,objoff_3A(a0)
  51482. btst #0,status(a0)
  51483. beq.s loc_280F2
  51484. neg.b objoff_3A(a0)
  51485. moveq #0,d1
  51486. move.b objoff_38(a0),d1
  51487. add.b objoff_3A(a0),d1
  51488. cmp.b objoff_39(a0),d1
  51489. blo.s loc_280EE
  51490. move.b d1,d0
  51491. moveq #0,d1
  51492. tst.b d0
  51493. bpl.s loc_280EE
  51494. move.b objoff_39(a0),d1
  51495. subq.b #4,d1
  51496.  
  51497. loc_280EE:
  51498. move.b d1,objoff_38(a0)
  51499.  
  51500. loc_280F2:
  51501. move.w (a2,d1.w),d0
  51502. add.w objoff_30(a0),d0
  51503. move.w d0,objoff_34(a0)
  51504. move.w 2(a2,d1.w),d0
  51505. add.w objoff_32(a0),d0
  51506. move.w d0,objoff_36(a0)
  51507. bsr.w loc_281DA
  51508. bra.w Obj6C_Main
  51509. ; ===========================================================================
  51510.  
  51511. loc_28112:
  51512. andi.w #$7F,d0
  51513. add.w d0,d0
  51514. lea (off_282D6).l,a2
  51515. adda.w (a2,d0.w),a2
  51516. move.w (a2)+,d1
  51517. movea.l a0,a1
  51518. move.w x_pos(a0),d2
  51519. move.w y_pos(a0),d3
  51520. bra.s Obj6C_LoadSubObject
  51521. ; ===========================================================================
  51522. ; loc_28130:
  51523. Obj6C_SubObjectsLoop:
  51524. jsrto (SingleObjLoad).l, JmpTo8_SingleObjLoad
  51525. bne.s +
  51526. ; loc_28136:
  51527. Obj6C_LoadSubObject:
  51528. _move.b #ObjID_Conveyor,id(a1) ; load obj6C
  51529. move.w (a2)+,d0
  51530. add.w d2,d0
  51531. move.w d0,x_pos(a1)
  51532. move.w (a2)+,d0
  51533. add.w d3,d0
  51534. move.w d0,y_pos(a1)
  51535. move.w d2,objoff_30(a1)
  51536. move.w d3,objoff_32(a1)
  51537. move.w (a2)+,d0
  51538. move.b d0,subtype(a1)
  51539. move.b status(a0),status(a1)
  51540. +
  51541. dbf d1,Obj6C_SubObjectsLoop
  51542. addq.l #4,sp
  51543. rts
  51544. ; ===========================================================================
  51545. ; loc_28168:
  51546. Obj6C_Main:
  51547. move.w x_pos(a0),-(sp)
  51548. bsr.w loc_2817E
  51549. moveq #0,d1
  51550. move.b width_pixels(a0),d1
  51551. moveq #8,d3
  51552. move.w (sp)+,d4
  51553. jmpto (PlatformObject).l, JmpTo5_PlatformObject
  51554. ; ===========================================================================
  51555.  
  51556. loc_2817E:
  51557. move.w x_pos(a0),d0
  51558. cmp.w objoff_34(a0),d0
  51559. bne.s loc_281D4
  51560. move.w y_pos(a0),d0
  51561. cmp.w objoff_36(a0),d0
  51562. bne.s loc_281D4
  51563. moveq #0,d1
  51564. move.b objoff_38(a0),d1
  51565. add.b objoff_3A(a0),d1
  51566. cmp.b objoff_39(a0),d1
  51567. blo.s loc_281B0
  51568. move.b d1,d0
  51569. moveq #0,d1
  51570. tst.b d0
  51571. bpl.s loc_281B0
  51572. move.b objoff_39(a0),d1
  51573. subq.b #4,d1
  51574.  
  51575. loc_281B0:
  51576. move.b d1,objoff_38(a0)
  51577. movea.l objoff_3C(a0),a1 ; a1=object
  51578. move.w (a1,d1.w),d0
  51579. add.w objoff_30(a0),d0
  51580. move.w d0,objoff_34(a0)
  51581. move.w 2(a1,d1.w),d0
  51582. add.w objoff_32(a0),d0
  51583. move.w d0,objoff_36(a0)
  51584. bsr.w loc_281DA
  51585.  
  51586. loc_281D4:
  51587. jsrto (ObjectMove).l, JmpTo15_ObjectMove
  51588. rts
  51589. ; ===========================================================================
  51590.  
  51591. loc_281DA:
  51592. moveq #0,d0
  51593. move.w #-$100,d2
  51594. move.w x_pos(a0),d0
  51595. sub.w objoff_34(a0),d0
  51596. bcc.s loc_281EE
  51597. neg.w d0
  51598. neg.w d2
  51599.  
  51600. loc_281EE:
  51601. moveq #0,d1
  51602. move.w #-$100,d3
  51603. move.w y_pos(a0),d1
  51604. sub.w objoff_36(a0),d1
  51605. bcc.s loc_28202
  51606. neg.w d1
  51607. neg.w d3
  51608.  
  51609. loc_28202:
  51610. cmp.w d0,d1
  51611. blo.s loc_2822C
  51612. move.w x_pos(a0),d0
  51613. sub.w objoff_34(a0),d0
  51614. beq.s loc_28218
  51615. ext.l d0
  51616. asl.l #8,d0
  51617. divs.w d1,d0
  51618. neg.w d0
  51619.  
  51620. loc_28218:
  51621. move.w d0,x_vel(a0)
  51622. move.w d3,y_vel(a0)
  51623. swap d0
  51624. move.w d0,x_sub(a0)
  51625. clr.w y_sub(a0)
  51626. rts
  51627. ; ===========================================================================
  51628.  
  51629. loc_2822C:
  51630. move.w y_pos(a0),d1
  51631. sub.w objoff_36(a0),d1
  51632. beq.s loc_2823E
  51633. ext.l d1
  51634. asl.l #8,d1
  51635. divs.w d0,d1
  51636. neg.w d1
  51637.  
  51638. loc_2823E:
  51639. move.w d1,y_vel(a0)
  51640. move.w d2,x_vel(a0)
  51641. swap d1
  51642. move.w d1,y_sub(a0)
  51643. clr.w x_sub(a0)
  51644. rts
  51645. ; ===========================================================================
  51646. off_28252: offsetTable
  51647. offsetTableEntry.w byte_28258 ; 0
  51648. offsetTableEntry.w byte_28282 ; 1
  51649. offsetTableEntry.w byte_282AC ; 2
  51650. byte_28258:
  51651. dc.b 0,$28, 0, 0, 0, 0,$FF,$EA, 0, $A,$FF,$E0, 0,$20,$FF,$E0
  51652. dc.b 0,$E0,$FF,$EA, 0,$F6, 0, 0, 1, 0, 0,$16, 0,$F6, 0,$20; 16
  51653. dc.b 0,$E0, 0,$20, 0,$20, 0,$16, 0, $A; 32
  51654. byte_28282:
  51655. dc.b 0,$28, 0, 0, 0, 0,$FF,$EA, 0, $A,$FF,$E0, 0,$20,$FF,$E0
  51656. dc.b 1,$60,$FF,$EA, 1,$76, 0, 0, 1,$80, 0,$16, 1,$76, 0,$20; 16
  51657. dc.b 1,$60, 0,$20, 0,$20, 0,$16, 0, $A; 32
  51658. byte_282AC:
  51659. dc.b 0,$28, 0, 0, 0, 0,$FF,$EA, 0, $A,$FF,$E0, 0,$20,$FF,$E0
  51660. dc.b 1,$E0,$FF,$EA, 1,$F6, 0, 0, 2, 0, 0,$16, 1,$F6, 0,$20; 16
  51661. dc.b 1,$E0, 0,$20, 0,$20, 0,$16, 0, $A; 32
  51662. ; ---------------------------------------------------------------------------
  51663. off_282D6: offsetTable
  51664. offsetTableEntry.w byte_282DC ; 0
  51665. offsetTableEntry.w byte_2830E ; 1
  51666. offsetTableEntry.w byte_28340 ; 2
  51667. byte_282DC:
  51668. dc.b 0, 7, 0, 0, 0, 0, 0, 1,$FF,$E0, 0,$3A, 0, 3,$FF,$E0
  51669. dc.b 0,$80, 0, 3,$FF,$E0, 0,$C6, 0, 3, 0, 0, 1, 0, 0, 6; 16
  51670. dc.b 0,$20, 0,$C6, 0, 8, 0,$20, 0,$80, 0, 8, 0,$20, 0,$3A; 32
  51671. dc.b 0, 8 ; 48
  51672. byte_2830E:
  51673. dc.b 0, 7, 0, 0, 0, 0, 0,$11,$FF,$E0, 0,$5A, 0,$13,$FF,$E0
  51674. dc.b 0,$C0, 0,$13,$FF,$E0, 1,$26, 0,$13, 0, 0, 1,$80, 0,$16; 16
  51675. dc.b 0,$20, 1,$26, 0,$18, 0,$20, 0,$C0, 0,$18, 0,$20, 0,$5A; 32
  51676. dc.b 0,$18 ; 48
  51677. byte_28340:
  51678. dc.b 0, 7, 0, 0, 0, 0, 0,$21,$FF,$E0, 0,$7A, 0,$23,$FF,$E0
  51679. dc.b 1, 0, 0,$23,$FF,$E0, 1,$86, 0,$23, 0, 0, 2, 0, 0,$26; 16
  51680. dc.b 0,$20, 1,$86, 0,$28, 0,$20, 1, 0, 0,$28, 0,$20, 0,$7A; 32
  51681. dc.b 0,$28 ; 48
  51682. ; ----------------------------------------------------------------------------
  51683. ; sprite mappings
  51684. ; ----------------------------------------------------------------------------
  51685. Obj6C_MapUnc_28372: BINCLUDE "mappings/sprite/obj6C.bin"
  51686. ; ===========================================================================
  51687.  
  51688. if gameRevision<2
  51689. nop
  51690. endif
  51691.  
  51692. if ~~removeJmpTos
  51693. JmpTo20_DisplaySprite
  51694. jmp (DisplaySprite).l
  51695. JmpTo34_DeleteObject
  51696. jmp (DeleteObject).l
  51697. JmpTo8_SingleObjLoad
  51698. jmp (SingleObjLoad).l
  51699. JmpTo35_Adjust2PArtPointer
  51700. jmp (Adjust2PArtPointer).l
  51701. JmpTo5_PlatformObject
  51702. jmp (PlatformObject).l
  51703. ; loc_283A6:
  51704. JmpTo15_ObjectMove
  51705. jmp (ObjectMove).l
  51706.  
  51707. align 4
  51708. endif
  51709.  
  51710.  
  51711.  
  51712.  
  51713. ; ===========================================================================
  51714. ; ----------------------------------------------------------------------------
  51715. ; Object 6E - Platform moving in a circle (like at the start of MTZ3)
  51716. ; ----------------------------------------------------------------------------
  51717. ; Sprite_283AC:
  51718. Obj6E:
  51719. moveq #0,d0
  51720. move.b routine(a0),d0
  51721. move.w Obj6E_Index(pc,d0.w),d1
  51722. jmp Obj6E_Index(pc,d1.w)
  51723. ; ===========================================================================
  51724. ; off_283BA:
  51725. Obj6E_Index: offsetTable
  51726. offsetTableEntry.w Obj6E_Init ; 0
  51727. offsetTableEntry.w loc_28432 ; 2
  51728. offsetTableEntry.w loc_284BC ; 4
  51729. ; ===========================================================================
  51730. byte_283C0:
  51731. ; width_pixels
  51732. ; radius
  51733. dc.b $10, $C
  51734. dc.b $28, 8 ; 2
  51735. dc.b $60,$18 ; 4
  51736. dc.b $C, $C ; 6
  51737. ; ===========================================================================
  51738. ; loc_283C8:
  51739. Obj6E_Init:
  51740. addq.b #2,routine(a0)
  51741. move.l #Obj6E_MapUnc_2852C,mappings(a0)
  51742. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,3,0),art_tile(a0)
  51743. jsrto (Adjust2PArtPointer).l, JmpTo36_Adjust2PArtPointer
  51744. ori.b #4,render_flags(a0)
  51745. move.b #4,priority(a0)
  51746. moveq #0,d0
  51747. move.b subtype(a0),d0
  51748. lsr.w #3,d0
  51749. andi.w #$E,d0
  51750. lea byte_283C0(pc,d0.w),a3
  51751. move.b (a3)+,width_pixels(a0)
  51752. move.b (a3)+,y_radius(a0)
  51753. lsr.w #1,d0
  51754. move.b d0,mapping_frame(a0)
  51755. move.w x_pos(a0),objoff_34(a0)
  51756. move.w y_pos(a0),objoff_30(a0)
  51757. cmpi.b #3,d0
  51758. bne.s loc_28432
  51759. addq.b #2,routine(a0)
  51760. move.w #make_art_tile(ArtTile_ArtNem_MtzWheelIndent,3,0),art_tile(a0)
  51761. jsrto (Adjust2PArtPointer).l, JmpTo36_Adjust2PArtPointer
  51762. move.b #5,priority(a0)
  51763. bra.w loc_284BC
  51764. ; ===========================================================================
  51765.  
  51766. loc_28432:
  51767.  
  51768. move.w x_pos(a0),-(sp)
  51769. move.b (Oscillating_Data+$20).w,d1
  51770. subi.b #$38,d1
  51771. ext.w d1
  51772. move.b (Oscillating_Data+$24).w,d2
  51773. subi.b #$38,d2
  51774. ext.w d2
  51775. btst #0,subtype(a0)
  51776. beq.s +
  51777. neg.w d1
  51778. neg.w d2
  51779. +
  51780. btst #1,subtype(a0)
  51781. beq.s +
  51782. neg.w d1
  51783. exg d1,d2
  51784. +
  51785. add.w objoff_34(a0),d1
  51786. move.w d1,x_pos(a0)
  51787. add.w objoff_30(a0),d2
  51788. move.w d2,y_pos(a0)
  51789. move.w (sp)+,d4
  51790. moveq #0,d1
  51791. move.b width_pixels(a0),d1
  51792. addi.w #$B,d1
  51793. moveq #0,d2
  51794. move.b y_radius(a0),d2
  51795. move.w d2,d3
  51796. addq.w #1,d3
  51797. jsrto (SolidObject).l, JmpTo15_SolidObject
  51798. move.w objoff_34(a0),d0
  51799. andi.w #$FF80,d0
  51800. sub.w (Camera_X_pos_coarse).w,d0
  51801. cmpi.w #$280,d0
  51802. bhi.s +
  51803. jmp (DisplaySprite).l
  51804. ; ===========================================================================
  51805. +
  51806. lea (Object_Respawn_Table).w,a2
  51807. moveq #0,d0
  51808. move.b respawn_index(a0),d0
  51809. beq.s +
  51810. bclr #7,2(a2,d0.w)
  51811. +
  51812. jmp (DeleteObject).l
  51813. ; ===========================================================================
  51814.  
  51815. loc_284BC:
  51816.  
  51817. move.b (Oscillating_Data+$20).w,d1
  51818. lsr.b #1,d1
  51819. subi.b #$1C,d1
  51820. ext.w d1
  51821. move.b (Oscillating_Data+$24).w,d2
  51822. lsr.b #1,d2
  51823. subi.b #$1C,d2
  51824. ext.w d2
  51825. btst #0,subtype(a0)
  51826. beq.s +
  51827. neg.w d1
  51828. neg.w d2
  51829. +
  51830. btst #1,subtype(a0)
  51831. beq.s +
  51832. neg.w d1
  51833. exg d1,d2
  51834. +
  51835. add.w objoff_34(a0),d1
  51836. move.w d1,x_pos(a0)
  51837. add.w objoff_30(a0),d2
  51838. move.w d2,y_pos(a0)
  51839. move.w objoff_34(a0),d0
  51840. andi.w #$FF80,d0
  51841. sub.w (Camera_X_pos_coarse).w,d0
  51842. cmpi.w #$280,d0
  51843. bhi.s +
  51844. jmp (DisplaySprite).l
  51845. ; ===========================================================================
  51846. +
  51847. lea (Object_Respawn_Table).w,a2
  51848. moveq #0,d0
  51849. move.b respawn_index(a0),d0
  51850. beq.s +
  51851. bclr #7,2(a2,d0.w)
  51852. +
  51853. jmp (DeleteObject).l
  51854. ; ===========================================================================
  51855. ; ----------------------------------------------------------------------------
  51856. ; sprite mappings
  51857. ; ----------------------------------------------------------------------------
  51858. Obj6E_MapUnc_2852C: BINCLUDE "mappings/sprite/obj6E.bin"
  51859. ; ===========================================================================
  51860.  
  51861. if ~~removeJmpTos
  51862. JmpTo36_Adjust2PArtPointer
  51863. jmp (Adjust2PArtPointer).l
  51864. JmpTo15_SolidObject
  51865. jmp (SolidObject).l
  51866.  
  51867. align 4
  51868. endif
  51869.  
  51870.  
  51871.  
  51872.  
  51873. ; ===========================================================================
  51874. ; ----------------------------------------------------------------------------
  51875. ; Object 70 - Giant rotating cog from MTZ
  51876. ; ----------------------------------------------------------------------------
  51877. ; Sprite_285C0:
  51878. Obj70:
  51879. moveq #0,d0
  51880. move.b routine(a0),d0
  51881. move.w Obj70_Index(pc,d0.w),d1
  51882. jmp Obj70_Index(pc,d1.w)
  51883. ; ===========================================================================
  51884. ; off_285CE:
  51885. Obj70_Index: offsetTable
  51886. offsetTableEntry.w Obj70_Init ; 0
  51887. offsetTableEntry.w Obj70_Main ; 2
  51888. ; ===========================================================================
  51889. ; loc_285D2:
  51890. Obj70_Init:
  51891. moveq #7,d1
  51892. moveq #0,d4
  51893. lea (Obj70_Positions).l,a2
  51894. movea.l a0,a1
  51895. move.w x_pos(a0),d2
  51896. move.w y_pos(a0),d3
  51897. bset #7,status(a0)
  51898. bra.s Obj70_LoadSubObject
  51899. ; ===========================================================================
  51900. ; loc_285EE:
  51901. Obj70_SubObjectLoop:
  51902. jsrto (SingleObjLoad2).l, JmpTo14_SingleObjLoad2
  51903. bne.s +
  51904. ; loc_285F4:
  51905. Obj70_LoadSubObject:
  51906. _move.b id(a0),id(a1) ; load obj70
  51907. addq.b #2,routine(a1)
  51908. move.l #Obj70_MapUnc_28786,mappings(a1)
  51909. move.w #make_art_tile(ArtTile_ArtNem_MtzWheel,3,0),art_tile(a1)
  51910. jsrto (Adjust2PArtPointer2).l, JmpTo4_Adjust2PArtPointer2
  51911. move.b #4,render_flags(a1)
  51912. move.b #4,priority(a1)
  51913. move.b #$10,width_pixels(a1)
  51914. move.w d2,objoff_32(a1)
  51915. move.w d3,objoff_30(a1)
  51916. move.b (a2)+,d0
  51917. ext.w d0
  51918. add.w d2,d0
  51919. move.w d0,x_pos(a1)
  51920. move.b (a2)+,d0
  51921. ext.w d0
  51922. add.w d3,d0
  51923. move.w d0,y_pos(a1)
  51924. move.b (a2)+,mapping_frame(a1)
  51925. move.w d4,objoff_34(a1)
  51926. addq.w #3,d4
  51927. move.b status(a0),status(a1)
  51928. +
  51929. dbf d1,Obj70_SubObjectLoop
  51930. ; loc_28652:
  51931. Obj70_Main:
  51932. move.w x_pos(a0),-(sp)
  51933. move.b (Timer_frames+1).w,d0
  51934. move.b d0,d1
  51935. andi.w #$F,d0
  51936. bne.s loc_286CA
  51937. move.w objoff_36(a0),d1
  51938. btst #0,status(a0)
  51939. beq.s loc_28684
  51940. subi.w #$18,d1
  51941. bcc.s loc_286A2
  51942. moveq #$48,d1
  51943. subq.w #3,objoff_34(a0)
  51944. bcc.s loc_286A2
  51945. move.w #$15,objoff_34(a0)
  51946. bra.s loc_286A2
  51947. ; ===========================================================================
  51948.  
  51949. loc_28684:
  51950. addi.w #$18,d1
  51951. cmpi.w #$60,d1
  51952. blo.s loc_286A2
  51953. moveq #0,d1
  51954. addq.w #3,objoff_34(a0)
  51955. cmpi.w #$18,objoff_34(a0)
  51956. blo.s loc_286A2
  51957. move.w #0,objoff_34(a0)
  51958.  
  51959. loc_286A2:
  51960. move.w d1,objoff_36(a0)
  51961. add.w objoff_34(a0),d1
  51962. lea Obj70_Positions(pc,d1.w),a1
  51963. move.b (a1)+,d0
  51964. ext.w d0
  51965. add.w objoff_32(a0),d0
  51966. move.w d0,x_pos(a0)
  51967. move.b (a1)+,d0
  51968. ext.w d0
  51969. add.w objoff_30(a0),d0
  51970. move.w d0,y_pos(a0)
  51971. move.b (a1)+,mapping_frame(a0)
  51972.  
  51973. loc_286CA:
  51974. move.b mapping_frame(a0),d0
  51975. add.w d0,d0
  51976. andi.w #$1E,d0
  51977. moveq #0,d1
  51978. moveq #0,d2
  51979. move.b byte_28706(pc,d0.w),d1
  51980. move.b byte_28706+1(pc,d0.w),d2
  51981. move.w d2,d3
  51982. move.w (sp)+,d4
  51983. jsrto (SolidObject).l, JmpTo16_SolidObject
  51984. move.w objoff_32(a0),d0
  51985. andi.w #$FF80,d0
  51986. sub.w (Camera_X_pos_coarse).w,d0
  51987. cmpi.w #$280,d0
  51988. bhi.s +
  51989. jmp (DisplaySprite).l
  51990. ; ===========================================================================
  51991. +
  51992. jmp (DeleteObject).l
  51993. ; ===========================================================================
  51994. byte_28706:
  51995. dc.b $10,$10 ; 0
  51996. dc.b $10,$10 ; 2
  51997. dc.b $10,$10 ; 4
  51998. dc.b $10,$10 ; 6
  51999. dc.b $10,$10 ; 8
  52000. dc.b $10,$10 ; 10
  52001. dc.b $10,$10 ; 12
  52002. dc.b $10, $C ; 14
  52003. dc.b $10, 8 ; 16
  52004. dc.b $10, $C ; 18
  52005. dc.b $10,$10 ; 20
  52006. dc.b $10,$10 ; 22
  52007. dc.b $10,$10 ; 24
  52008. dc.b $10,$10 ; 26
  52009. dc.b $10,$10 ; 28
  52010. dc.b $10,$10 ; 30
  52011. ; byte_28726:
  52012. Obj70_Positions:
  52013. ; initial positions
  52014. ; x_pos, y_pos, mapping_frame
  52015. dc.b 0,$B8, 0
  52016. dc.b $32,$CE, 4
  52017. dc.b $48, 0, 8
  52018. dc.b $32,$32, $C
  52019. dc.b 0,$48,$10
  52020. dc.b $CE,$32,$14
  52021. dc.b $B8, 0,$18
  52022. dc.b $CE,$CE,$1C
  52023.  
  52024. dc.b $D,$B8, 1
  52025. dc.b $3F,$DA, 5
  52026. dc.b $48, $C, 9
  52027. dc.b $27,$3C, $D
  52028. dc.b $F3,$48,$11
  52029. dc.b $C1,$26,$15
  52030. dc.b $B8,$F4,$19
  52031. dc.b $D9,$C4,$1D
  52032.  
  52033. dc.b $19,$BC, 2
  52034. dc.b $46,$E9, 6
  52035. dc.b $46,$17, $A
  52036. dc.b $19,$44, $E
  52037. dc.b $E7,$44,$12
  52038. dc.b $BA,$17,$16
  52039. dc.b $BA,$E9,$1A
  52040. dc.b $E7,$BC,$1E
  52041.  
  52042. dc.b $27,$C4, 3
  52043. dc.b $48,$F4, 7
  52044. dc.b $3F,$26, $B
  52045. dc.b $D,$48, $F
  52046. dc.b $D9,$3C,$13
  52047. dc.b $B8, $C,$17
  52048. dc.b $C1,$DA,$1B
  52049. dc.b $F3,$B8,$1F
  52050. ; ----------------------------------------------------------------------------
  52051. ; sprite mappings
  52052. ; ----------------------------------------------------------------------------
  52053. Obj70_MapUnc_28786: BINCLUDE "mappings/sprite/obj70.bin"
  52054. ; ===========================================================================
  52055.  
  52056. if gameRevision<2
  52057. nop
  52058. endif
  52059.  
  52060. if ~~removeJmpTos
  52061. JmpTo14_SingleObjLoad2
  52062. jmp (SingleObjLoad2).l
  52063. JmpTo4_Adjust2PArtPointer2
  52064. jmp (Adjust2PArtPointer2).l
  52065. JmpTo16_SolidObject
  52066. jmp (SolidObject).l
  52067.  
  52068. align 4
  52069. endif
  52070.  
  52071.  
  52072.  
  52073.  
  52074. ; ===========================================================================
  52075. ; ----------------------------------------------------------------------------
  52076. ; Object 72 - Conveyor belt from CNZ
  52077. ; ----------------------------------------------------------------------------
  52078. ; Sprite_2893C:
  52079. Obj72:
  52080. moveq #0,d0
  52081. move.b routine(a0),d0
  52082. move.w Obj72_Index(pc,d0.w),d1
  52083. jmp Obj72_Index(pc,d1.w)
  52084. ; ===========================================================================
  52085. ; off_2894A:
  52086. Obj72_Index: offsetTable
  52087. offsetTableEntry.w Obj72_Init ; 0
  52088. offsetTableEntry.w Obj72_Main ; 2
  52089. ; ===========================================================================
  52090. ; loc_2894E:
  52091. Obj72_Init:
  52092. addq.b #2,routine(a0)
  52093. move.w #$30,objoff_3C(a0)
  52094. move.b subtype(a0),d0
  52095. bpl.s +
  52096. move.w #$70,objoff_3C(a0)
  52097. +
  52098. andi.b #$7F,d0
  52099. lsl.b #4,d0
  52100. move.b d0,objoff_38(a0)
  52101. move.w #2,objoff_36(a0)
  52102. btst #0,status(a0)
  52103. beq.s Obj72_Main
  52104. neg.w objoff_36(a0)
  52105. ; loc_28980:
  52106. Obj72_Main:
  52107. lea (MainCharacter).w,a1 ; a1=character
  52108. bsr.s Obj72_Action
  52109. lea (Sidekick).w,a1 ; a1=character
  52110. bsr.s Obj72_Action
  52111. jmpto (MarkObjGone3).l, JmpTo5_MarkObjGone3
  52112. ; ===========================================================================
  52113. ; loc_28990:
  52114. Obj72_Action:
  52115. moveq #0,d2
  52116. move.b objoff_38(a0),d2
  52117. move.w d2,d3
  52118. add.w d3,d3
  52119. move.w x_pos(a1),d0
  52120. sub.w x_pos(a0),d0
  52121. add.w d2,d0
  52122. cmp.w d3,d0
  52123. bhs.s + ; rts
  52124. move.w y_pos(a1),d1
  52125. sub.w y_pos(a0),d1
  52126. move.w objoff_3C(a0),d0
  52127. add.w d0,d1
  52128. cmp.w d0,d1
  52129. bhs.s + ; rts
  52130. btst #1,status(a1)
  52131. bne.s + ; rts
  52132. move.w objoff_36(a0),d0
  52133. add.w d0,x_pos(a1)
  52134. +
  52135. rts
  52136. ; ===========================================================================
  52137.  
  52138. if ~~removeJmpTos
  52139. JmpTo5_MarkObjGone3
  52140. jmp (MarkObjGone3).l
  52141.  
  52142. align 4
  52143. endif
  52144.  
  52145.  
  52146.  
  52147.  
  52148. ; ===========================================================================
  52149. ; ----------------------------------------------------------------------------
  52150. ; Object 73 - Solid rotating ring thing from Mystic Cave Zone
  52151. ; (unused, but can be seen in debug mode)
  52152. ; ----------------------------------------------------------------------------
  52153. ; Sprite_289D4:
  52154. Obj73:
  52155. moveq #0,d0
  52156. move.b routine(a0),d0
  52157. move.w Obj73_Index(pc,d0.w),d1
  52158. jmp Obj73_Index(pc,d1.w)
  52159. ; ===========================================================================
  52160. ; off_289E2:
  52161. Obj73_Index: offsetTable
  52162. offsetTableEntry.w Obj73_Init ; 0
  52163. offsetTableEntry.w Obj73_Main ; 2
  52164. offsetTableEntry.w Obj73_SubObject ; 4
  52165. ; ===========================================================================
  52166. ; loc_289E8:
  52167. Obj73_Init:
  52168. addq.b #2,routine(a0)
  52169. move.l #Obj73_MapUnc_28B9C,mappings(a0)
  52170. move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a0)
  52171. jsrto (Adjust2PArtPointer).l, JmpTo37_Adjust2PArtPointer
  52172. move.b #4,render_flags(a0)
  52173. move.b #4,priority(a0)
  52174. move.b #8,width_pixels(a0)
  52175. move.w x_pos(a0),objoff_3A(a0)
  52176. move.w y_pos(a0),objoff_38(a0)
  52177. move.b #0,collision_flags(a0)
  52178. bset #7,status(a0)
  52179. move.b subtype(a0),d1
  52180. andi.b #$F0,d1
  52181. ext.w d1
  52182. asl.w #3,d1
  52183. move.w d1,objoff_3E(a0)
  52184. move.b status(a0),d0
  52185. ror.b #2,d0
  52186. andi.b #$C0,d0
  52187. move.b d0,angle(a0)
  52188. lea objoff_29(a0),a2
  52189. move.b subtype(a0),d1
  52190. andi.w #7,d1
  52191. move.b #0,(a2)+
  52192. move.w d1,d3
  52193. lsl.w #4,d3
  52194. move.b d3,objoff_3C(a0)
  52195. subq.w #1,d1
  52196. bcs.s Obj73_LoadSubObject_End
  52197. btst #3,subtype(a0)
  52198. beq.s Obj73_LoadSubObject
  52199. subq.w #1,d1
  52200. bcs.s Obj73_LoadSubObject_End
  52201. ; loc_28A6E:
  52202. Obj73_LoadSubObject:
  52203. jsrto (SingleObjLoad).l, JmpTo9_SingleObjLoad
  52204. bne.s Obj73_LoadSubObject_End
  52205. addq.b #1,objoff_29(a0)
  52206. move.w a1,d5
  52207. subi.w #Object_RAM,d5
  52208. if object_size=$40
  52209. lsr.w #6,d5
  52210. else
  52211. divu.w #object_size,d5
  52212. endif
  52213. andi.w #$7F,d5
  52214. move.b d5,(a2)+
  52215. move.b #4,routine(a1)
  52216. _move.b id(a0),id(a1) ; load obj73
  52217. move.l mappings(a0),mappings(a1)
  52218. move.w art_tile(a0),art_tile(a1)
  52219. move.b render_flags(a0),render_flags(a1)
  52220. move.b priority(a0),priority(a1)
  52221. move.b width_pixels(a0),width_pixels(a1)
  52222. move.b collision_flags(a0),collision_flags(a1)
  52223. move.b status(a0),status(a1)
  52224. subi.b #$10,d3
  52225. move.b d3,objoff_3C(a1)
  52226. dbf d1,Obj73_LoadSubObject
  52227. ; loc_28AC8:
  52228. Obj73_LoadSubObject_End:
  52229.  
  52230. move.w a0,d5
  52231. subi.w #Object_RAM,d5
  52232. if object_size=$40
  52233. lsr.w #6,d5
  52234. else
  52235. divu.w #object_size,d5
  52236. endif
  52237. andi.w #$7F,d5
  52238. move.b d5,(a2)+
  52239. ; loc_28AD6:
  52240. Obj73_Main:
  52241. move.w x_pos(a0),-(sp)
  52242. bsr.w loc_28AF4
  52243. move.w #8,d1
  52244. move.w #8,d2
  52245. move.w d2,d3
  52246. addq.w #1,d3
  52247. move.w (sp)+,d4
  52248. jsrto (SolidObject).l, JmpTo17_SolidObject
  52249. bra.w loc_28B46
  52250. ; ===========================================================================
  52251.  
  52252. loc_28AF4:
  52253. move.w objoff_3E(a0),d0
  52254. add.w d0,angle(a0)
  52255. move.b angle(a0),d0
  52256. jsr (CalcSine).l
  52257. move.w objoff_38(a0),d2
  52258. move.w objoff_3A(a0),d3
  52259. lea objoff_29(a0),a2
  52260. moveq #0,d6
  52261. move.b (a2)+,d6
  52262.  
  52263. loc_28B16:
  52264. moveq #0,d4
  52265. move.b (a2)+,d4
  52266. if object_size=$40
  52267. lsl.w #6,d4
  52268. else
  52269. mulu.w #object_size,d4
  52270. endif
  52271. addi.l #Object_RAM,d4
  52272. movea.l d4,a1 ; a1=object
  52273. moveq #0,d4
  52274. move.b objoff_3C(a1),d4
  52275. move.l d4,d5
  52276. muls.w d0,d4
  52277. asr.l #8,d4
  52278. muls.w d1,d5
  52279. asr.l #8,d5
  52280. add.w d2,d4
  52281. add.w d3,d5
  52282. move.w d4,y_pos(a1)
  52283. move.w d5,x_pos(a1)
  52284. dbf d6,loc_28B16
  52285. rts
  52286. ; ===========================================================================
  52287.  
  52288. loc_28B46:
  52289. move.w objoff_3A(a0),d0
  52290. andi.w #$FF80,d0
  52291. sub.w (Camera_X_pos_coarse).w,d0
  52292. cmpi.w #$280,d0
  52293. bhi.w +
  52294. jmpto (DisplaySprite).l, JmpTo21_DisplaySprite
  52295. ; ===========================================================================
  52296. +
  52297. moveq #0,d2
  52298. lea objoff_29(a0),a2
  52299.  
  52300. move.b (a2)+,d2
  52301. - moveq #0,d0
  52302. move.b (a2)+,d0
  52303. if object_size=$40
  52304. lsl.w #6,d0
  52305. else
  52306. mulu.w #object_size,d0
  52307. endif
  52308. addi.l #Object_RAM,d0
  52309. movea.l d0,a1 ; a1=object
  52310. jsrto (DeleteObject2).l, JmpTo_DeleteObject2
  52311. dbf d2,-
  52312. rts
  52313. ; ===========================================================================
  52314. ; loc_28B7E:
  52315. Obj73_SubObject:
  52316. move.w #8,d1
  52317. move.w #8,d2
  52318. move.w d2,d3
  52319. addq.w #1,d3
  52320. move.w objoff_36(a0),d4
  52321. jsrto (SolidObject).l, JmpTo17_SolidObject
  52322. move.w x_pos(a0),objoff_36(a0)
  52323. jmpto (DisplaySprite).l, JmpTo21_DisplaySprite
  52324. ; ===========================================================================
  52325. ; ----------------------------------------------------------------------------
  52326. ; sprite mappings
  52327. ; ----------------------------------------------------------------------------
  52328. Obj73_MapUnc_28B9C: BINCLUDE "mappings/sprite/obj73.bin"
  52329. ; ===========================================================================
  52330.  
  52331. if ~~removeJmpTos
  52332. JmpTo21_DisplaySprite
  52333. jmp (DisplaySprite).l
  52334. JmpTo9_SingleObjLoad
  52335. jmp (SingleObjLoad).l
  52336. JmpTo_DeleteObject2
  52337. jmp (DeleteObject2).l
  52338. JmpTo37_Adjust2PArtPointer
  52339. jmp (Adjust2PArtPointer).l
  52340. JmpTo17_SolidObject
  52341. jmp (SolidObject).l
  52342.  
  52343. align 4
  52344. endif
  52345.  
  52346.  
  52347.  
  52348.  
  52349. ; ===========================================================================
  52350. ; ----------------------------------------------------------------------------
  52351. ; Object 75 - Brick from MCZ
  52352. ; ----------------------------------------------------------------------------
  52353. ; Sprite_28BC8:
  52354. Obj75:
  52355. btst #6,render_flags(a0)
  52356. bne.w +
  52357. moveq #0,d0
  52358. move.b routine(a0),d0
  52359. move.w Obj75_Index(pc,d0.w),d1
  52360. jmp Obj75_Index(pc,d1.w)
  52361. ; ===========================================================================
  52362. +
  52363. move.w #$280,d0
  52364. jmpto (DisplaySprite3).l, JmpTo_DisplaySprite3
  52365. ; ===========================================================================
  52366. ; off_28BE8:
  52367. Obj75_Index: offsetTable
  52368. offsetTableEntry.w Obj75_Init ; 0
  52369. offsetTableEntry.w Obj75_Main ; 2
  52370. offsetTableEntry.w loc_28D6C ; 4
  52371. ; ===========================================================================
  52372. ; loc_28BEE:
  52373. Obj75_Init:
  52374. addq.b #2,routine(a0)
  52375. move.l #Obj75_MapUnc_28D8A,mappings(a0)
  52376. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,1,0),art_tile(a0)
  52377. jsrto (Adjust2PArtPointer).l, JmpTo38_Adjust2PArtPointer
  52378. move.b #4,render_flags(a0)
  52379. move.b #5,priority(a0)
  52380. move.b #$10,width_pixels(a0)
  52381. move.w x_pos(a0),objoff_30(a0)
  52382. move.w y_pos(a0),objoff_32(a0)
  52383. move.b subtype(a0),d1
  52384. move.b d1,d0
  52385. andi.w #$F,d1
  52386. andi.b #$F0,d0
  52387. ext.w d0
  52388. asl.w #3,d0
  52389. move.w d0,objoff_34(a0)
  52390. move.b status(a0),d0
  52391. ror.b #2,d0
  52392. andi.b #$C0,d0
  52393. move.b d0,angle(a0)
  52394. cmpi.b #$F,d1
  52395. bne.s +
  52396. addq.b #2,routine(a0)
  52397. move.b #4,priority(a0)
  52398. move.b #2,mapping_frame(a0)
  52399. rts
  52400. ; ===========================================================================
  52401. +
  52402. move.b #$9A,collision_flags(a0)
  52403. jsrto (SingleObjLoad2).l, JmpTo15_SingleObjLoad2
  52404. bne.s Obj75_Main
  52405. _move.b id(a0),id(a1) ; load obj75
  52406. move.l mappings(a0),mappings(a1)
  52407. move.w art_tile(a0),art_tile(a1)
  52408. move.b #4,render_flags(a1)
  52409. bset #6,render_flags(a1)
  52410. move.b #$40,mainspr_width(a1)
  52411. move.w x_pos(a0),d2
  52412. move.w y_pos(a0),d3
  52413. move.b d1,mainspr_childsprites(a1)
  52414. subq.w #1,d1
  52415. lea sub2_x_pos(a1),a2
  52416.  
  52417. - move.w d2,(a2)+ ; sub?_x_pos
  52418. move.w d3,(a2)+ ; sub?_y_pos
  52419. move.w #1,(a2)+ ; sub?_mapframe
  52420. dbf d1,-
  52421.  
  52422. move.w d2,x_pos(a1)
  52423. move.w d3,y_pos(a1)
  52424. move.b #0,mainspr_mapframe(a1)
  52425. move.l a1,objoff_3C(a0)
  52426. move.b #$40,mainspr_height(a1)
  52427. bset #4,render_flags(a1)
  52428. ; loc_28CCA:
  52429. Obj75_Main:
  52430. moveq #0,d0
  52431. moveq #0,d1
  52432. move.w objoff_34(a0),d0
  52433. add.w d0,angle(a0)
  52434. move.b angle(a0),d0
  52435. jsrto (CalcSine).l, JmpTo8_CalcSine
  52436. move.w objoff_32(a0),d2
  52437. move.w objoff_30(a0),d3
  52438. moveq #0,d6
  52439. movea.l objoff_3C(a0),a1 ; a1=object
  52440. move.b mainspr_childsprites(a1),d6
  52441. subq.w #1,d6
  52442. bcs.s loc_28D3E
  52443. swap d0
  52444. swap d1
  52445. asr.l #4,d0
  52446. asr.l #4,d1
  52447. moveq #0,d4
  52448. moveq #0,d5
  52449. lea sub2_x_pos(a1),a2
  52450.  
  52451. - movem.l d4-d5,-(sp)
  52452. swap d4
  52453. swap d5
  52454. add.w d2,d4
  52455. add.w d3,d5
  52456. move.w d5,(a2)+ ; sub?_x_pos
  52457. move.w d4,(a2)+ ; sub?_y_pos
  52458. movem.l (sp)+,d4-d5
  52459. add.l d0,d4
  52460. add.l d1,d5
  52461. addq.w #next_subspr-4,a2
  52462. dbf d6,-
  52463.  
  52464. swap d4
  52465. swap d5
  52466. add.w d2,d4
  52467. add.w d3,d5
  52468. move.w d5,x_pos(a0)
  52469. move.w d4,y_pos(a0)
  52470. move.w sub6_x_pos(a1),x_pos(a1)
  52471. move.w sub6_y_pos(a1),y_pos(a1)
  52472.  
  52473. loc_28D3E:
  52474. tst.w (Two_player_mode).w
  52475. beq.s +
  52476. jmpto (DisplaySprite).l, JmpTo22_DisplaySprite
  52477. ; ===========================================================================
  52478. +
  52479. move.w objoff_30(a0),d0
  52480. andi.w #$FF80,d0
  52481. sub.w (Camera_X_pos_coarse).w,d0
  52482. cmpi.w #$280,d0
  52483. bhi.w +
  52484. jmpto (DisplaySprite).l, JmpTo22_DisplaySprite
  52485. ; ===========================================================================
  52486. +
  52487. movea.l objoff_3C(a0),a1 ; a1=object
  52488. jsrto (DeleteObject2).l, JmpTo2_DeleteObject2
  52489. jmpto (DeleteObject).l, JmpTo38_DeleteObject
  52490. ; ===========================================================================
  52491.  
  52492. loc_28D6C:
  52493. moveq #0,d1
  52494. move.b width_pixels(a0),d1
  52495. addi.w #$B,d1
  52496. move.w #$10,d2
  52497. move.w #$11,d3
  52498. move.w x_pos(a0),d4
  52499. jsrto (SolidObject).l, JmpTo18_SolidObject
  52500. jmpto (MarkObjGone).l, JmpTo22_MarkObjGone
  52501. ; ===========================================================================
  52502. ; ----------------------------------------------------------------------------
  52503. ; sprite mappings
  52504. ; ----------------------------------------------------------------------------
  52505. Obj75_MapUnc_28D8A: BINCLUDE "mappings/sprite/obj75.bin"
  52506. ; ===========================================================================
  52507.  
  52508. if gameRevision<2
  52509. nop
  52510. endif
  52511.  
  52512. if ~~removeJmpTos
  52513. JmpTo_DisplaySprite3
  52514. jmp (DisplaySprite3).l
  52515. JmpTo22_DisplaySprite
  52516. jmp (DisplaySprite).l
  52517. JmpTo38_DeleteObject
  52518. jmp (DeleteObject).l
  52519. JmpTo22_MarkObjGone
  52520. jmp (MarkObjGone).l
  52521. JmpTo2_DeleteObject2
  52522. jmp (DeleteObject2).l
  52523. JmpTo15_SingleObjLoad2
  52524. jmp (SingleObjLoad2).l
  52525. JmpTo38_Adjust2PArtPointer
  52526. jmp (Adjust2PArtPointer).l
  52527. JmpTo8_CalcSine
  52528. jmp (CalcSine).l
  52529. JmpTo18_SolidObject
  52530. jmp (SolidObject).l
  52531.  
  52532. align 4
  52533. endif
  52534.  
  52535.  
  52536.  
  52537.  
  52538. ; ===========================================================================
  52539. ; ----------------------------------------------------------------------------
  52540. ; Object 76 - Spike block that slides out of the wall from MCZ
  52541. ; ----------------------------------------------------------------------------
  52542. sliding_spikes_remaining_movement = objoff_36
  52543. ; Sprite_28DF8:
  52544. Obj76:
  52545. moveq #0,d0
  52546. move.b routine(a0),d0
  52547. move.w Obj76_Index(pc,d0.w),d1
  52548. jmp Obj76_Index(pc,d1.w)
  52549. ; ===========================================================================
  52550. ; off_28E06:
  52551. Obj76_Index: offsetTable
  52552. offsetTableEntry.w Obj76_Init ; 0
  52553. offsetTableEntry.w Obj76_Main ; 2
  52554. ; ===========================================================================
  52555. ; byte_28E0A:
  52556. Obj76_InitData:
  52557. dc.b $40 ; width_pixels
  52558. dc.b $10 ; y_radius
  52559. dc.b 0 ; mapping_frame
  52560. even
  52561. ; ===========================================================================
  52562. ; loc_28E0E:
  52563. Obj76_Init:
  52564. addq.b #2,routine(a0)
  52565. move.l #Obj76_MapUnc_28F3A,mappings(a0)
  52566. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  52567. jsrto (Adjust2PArtPointer).l, JmpTo39_Adjust2PArtPointer
  52568. ori.b #4,render_flags(a0)
  52569. move.b #4,priority(a0)
  52570. moveq #0,d0
  52571. move.b subtype(a0),d0 ; this is always 0 in the original layouts...
  52572. lsr.w #2,d0
  52573. andi.w #$1C,d0
  52574. lea Obj76_InitData(pc,d0.w),a2
  52575. move.b (a2)+,width_pixels(a0)
  52576. move.b (a2)+,y_radius(a0)
  52577. move.b (a2)+,mapping_frame(a0)
  52578. move.w x_pos(a0),objoff_34(a0)
  52579. move.w y_pos(a0),objoff_30(a0)
  52580. andi.w #$F,subtype(a0)
  52581. ; loc_28E5E:
  52582. Obj76_Main:
  52583. move.w x_pos(a0),-(sp)
  52584. moveq #0,d0
  52585. move.b subtype(a0),d0
  52586. move.w Obj76_Modes(pc,d0.w),d1
  52587. jsr Obj76_Modes(pc,d1.w)
  52588. move.w (sp)+,d4
  52589. tst.b render_flags(a0)
  52590. bpl.s loc_28EC2
  52591. moveq #0,d1
  52592. move.b width_pixels(a0),d1
  52593. addi.w #$B,d1
  52594. moveq #0,d2
  52595. move.b y_radius(a0),d2
  52596. move.w d2,d3
  52597. addq.w #1,d3
  52598. jsrto (SolidObject).l, JmpTo19_SolidObject
  52599. swap d6
  52600. andi.w #touch_side_mask,d6
  52601. beq.s loc_28EC2
  52602. move.b d6,d0
  52603. andi.b #p1_touch_side,d0
  52604. beq.s +
  52605. lea (MainCharacter).w,a1 ; a1=character
  52606. jsrto (Touch_ChkHurt2).l, JmpTo_Touch_ChkHurt2
  52607. bclr #p1_pushing_bit,status(a0)
  52608. +
  52609. andi.b #p2_touch_side,d6
  52610. beq.s loc_28EC2
  52611. lea (Sidekick).w,a1 ; a1=character
  52612. jsrto (Touch_ChkHurt2).l, JmpTo_Touch_ChkHurt2
  52613. bclr #p2_pushing_bit,status(a0)
  52614.  
  52615. loc_28EC2:
  52616. move.w objoff_34(a0),d0
  52617. jmpto (MarkObjGone2).l, JmpTo5_MarkObjGone2
  52618. ; ===========================================================================
  52619. ; off_28ECA:
  52620. Obj76_Modes: offsetTable
  52621. offsetTableEntry.w Obj76_CheckPlayers ; 0
  52622. offsetTableEntry.w Obj76_SlideOut ; 2
  52623. ; ===========================================================================
  52624. ; loc_28ECE:
  52625. Obj76_CheckPlayers:
  52626. lea (MainCharacter).w,a1 ; a1=character
  52627. bsr.s Obj76_CheckPlayer
  52628. lea (Sidekick).w,a1 ; a1=character
  52629. ; loc_28ED8:
  52630. Obj76_CheckPlayer:
  52631. btst #1,status(a1)
  52632. bne.s ++ ; rts
  52633. move.w x_pos(a1),d0
  52634. sub.w x_pos(a0),d0
  52635. addi.w #$C0,d0
  52636. btst #0,status(a0)
  52637. beq.s +
  52638. subi.w #$100,d0
  52639. +
  52640. cmpi.w #$80,d0
  52641. bhs.s + ; rts
  52642. move.w y_pos(a1),d0
  52643. sub.w y_pos(a0),d0
  52644. addi.w #$10,d0
  52645. cmpi.w #$20,d0
  52646. bhs.s + ; rts
  52647. move.b #2,subtype(a0)
  52648. move.w #$80,sliding_spikes_remaining_movement(a0)
  52649. + rts
  52650. ; ===========================================================================
  52651. ; loc_28F1E:
  52652. Obj76_SlideOut:
  52653. tst.w sliding_spikes_remaining_movement(a0)
  52654. beq.s ++ ; rts
  52655. subq.w #1,sliding_spikes_remaining_movement(a0)
  52656. moveq #-1,d0
  52657. btst #0,status(a0)
  52658. beq.s +
  52659. neg.w d0
  52660. + add.w d0,x_pos(a0)
  52661. + rts
  52662. ; ===========================================================================
  52663. ; ----------------------------------------------------------------------------
  52664. ; sprite mappings
  52665. ; ----------------------------------------------------------------------------
  52666. Obj76_MapUnc_28F3A: BINCLUDE "mappings/sprite/obj76.bin"
  52667. ; ===========================================================================
  52668.  
  52669. if gameRevision<2
  52670. nop
  52671. endif
  52672.  
  52673. if ~~removeJmpTos
  52674. JmpTo_Touch_ChkHurt2
  52675. jmp (Touch_ChkHurt2).l
  52676. JmpTo39_Adjust2PArtPointer
  52677. jmp (Adjust2PArtPointer).l
  52678. JmpTo19_SolidObject
  52679. jmp (SolidObject).l
  52680. JmpTo5_MarkObjGone2
  52681. jmp (MarkObjGone2).l
  52682.  
  52683. align 4
  52684. endif
  52685.  
  52686.  
  52687.  
  52688.  
  52689. ; ===========================================================================
  52690. ; ----------------------------------------------------------------------------
  52691. ; Object 77 - Bridge from MCZ
  52692. ; ----------------------------------------------------------------------------
  52693. ; Sprite_28F88:
  52694. Obj77:
  52695. moveq #0,d0
  52696. move.b routine(a0),d0
  52697. move.w Obj77_Index(pc,d0.w),d1
  52698. jmp Obj77_Index(pc,d1.w)
  52699. ; ===========================================================================
  52700. ; off_28F96:
  52701. Obj77_Index: offsetTable
  52702. offsetTableEntry.w Obj77_Init ; 0
  52703. offsetTableEntry.w Obj77_Main ; 2
  52704. ; ===========================================================================
  52705. ; loc_28F9A:
  52706. Obj77_Init:
  52707. addq.b #2,routine(a0)
  52708. move.l #Obj77_MapUnc_29064,mappings(a0)
  52709. move.w #make_art_tile(ArtTile_ArtNem_MCZGateLog,3,0),art_tile(a0)
  52710. jsrto (Adjust2PArtPointer).l, JmpTo40_Adjust2PArtPointer
  52711. ori.b #4,render_flags(a0)
  52712. move.b #$80,width_pixels(a0)
  52713. ; loc_28FBC:
  52714. Obj77_Main:
  52715. tst.b objoff_34(a0)
  52716. bne.s +
  52717. lea (ButtonVine_Trigger).w,a2
  52718. moveq #0,d0
  52719. move.b subtype(a0),d0
  52720. btst #0,(a2,d0.w)
  52721. beq.s +
  52722. move.b #1,objoff_34(a0)
  52723. bchg #0,anim(a0)
  52724. tst.b render_flags(a0)
  52725. bpl.s +
  52726. move.w #SndID_DoorSlam,d0
  52727. jsr (PlaySound).l
  52728. +
  52729. lea (Ani_obj77).l,a1
  52730. jsr (AnimateSprite).l
  52731. tst.b mapping_frame(a0)
  52732. bne.s Obj77_DropCharacters
  52733. move.w #$4B,d1
  52734. move.w #8,d2
  52735. move.w d2,d3
  52736. addq.w #1,d3
  52737. move.w x_pos(a0),d4
  52738. jsrto (SolidObject).l, JmpTo20_SolidObject
  52739. jmpto (MarkObjGone).l, JmpTo23_MarkObjGone
  52740. ; ===========================================================================
  52741.  
  52742. ; Check if the characters are standing on it. If a character is standing on the
  52743. ; bridge, the "standing on object" flag is cleared so that it falls.
  52744.  
  52745. ; loc_2901A:
  52746. Obj77_DropCharacters:
  52747. move.b status(a0),d0
  52748. andi.b #standing_mask,d0
  52749. beq.s +++
  52750. move.b d0,d1
  52751. andi.b #p1_standing,d0
  52752. beq.s +
  52753. lea (MainCharacter).w,a1 ; a1=character
  52754. bclr #3,status(a1)
  52755. +
  52756. andi.b #p2_standing,d1
  52757. beq.s +
  52758. lea (Sidekick).w,a1 ; a1=character
  52759. bclr #3,status(a1)
  52760. +
  52761. andi.b #~standing_mask,status(a0)
  52762. +
  52763. jmpto (MarkObjGone).l, JmpTo23_MarkObjGone
  52764. ; ===========================================================================
  52765. ; ----------------------------------------------------------------------------
  52766. ; animation script
  52767. ; ----------------------------------------------------------------------------
  52768. ; off_29050:
  52769. Ani_obj77: offsetTable
  52770. offsetTableEntry.w Ani_obj77_Close ; 0
  52771. offsetTableEntry.w Ani_obj77_Open ; 1
  52772. ; byte_29054:
  52773. Ani_obj77_Close:
  52774. dc.b 3, 4, 3, 2, 1, 0,$FE, 1
  52775. ; byte_2905C:
  52776. Ani_obj77_Open:
  52777. dc.b 3, 0, 1, 2, 3, 4,$FE, 1
  52778. even
  52779. ; ----------------------------------------------------------------------------
  52780. ; sprite mappings
  52781. ; ----------------------------------------------------------------------------
  52782. Obj77_MapUnc_29064: BINCLUDE "mappings/sprite/obj77.bin"
  52783. ; ===========================================================================
  52784.  
  52785. if ~~removeJmpTos
  52786. JmpTo23_MarkObjGone
  52787. jmp (MarkObjGone).l
  52788. JmpTo40_Adjust2PArtPointer
  52789. jmp (Adjust2PArtPointer).l
  52790. JmpTo20_SolidObject
  52791. jmp (SolidObject).l
  52792.  
  52793. align 4
  52794. endif
  52795.  
  52796.  
  52797.  
  52798.  
  52799. ; ===========================================================================
  52800. ; ----------------------------------------------------------------------------
  52801. ; Object 78 - Stairs from CPZ that move down to open the way
  52802. ; ----------------------------------------------------------------------------
  52803. ; Sprite_291CC:
  52804. Obj78:
  52805. moveq #0,d0
  52806. move.b routine(a0),d0
  52807. move.w Obj78_Index(pc,d0.w),d1
  52808. jsr Obj78_Index(pc,d1.w)
  52809. move.w objoff_30(a0),d0
  52810. jmpto (MarkObjGone2).l, JmpTo6_MarkObjGone2
  52811. ; ===========================================================================
  52812. ; off_291E2:
  52813. Obj78_Index: offsetTable
  52814. offsetTableEntry.w Obj78_Init ; 0
  52815. offsetTableEntry.w Obj78_Main ; 2
  52816. offsetTableEntry.w loc_29280 ; 4
  52817. ; ===========================================================================
  52818. ; loc_291E8:
  52819. Obj78_Init:
  52820. addq.b #2,routine(a0)
  52821. moveq #objoff_34,d3
  52822. moveq #2,d4
  52823. btst #0,status(a0)
  52824. beq.s +
  52825. moveq #objoff_3A,d3
  52826. moveq #-2,d4
  52827. +
  52828. move.w x_pos(a0),d2
  52829. movea.l a0,a1
  52830. moveq #3,d1
  52831. bra.s Obj78_LoadSubObject
  52832. ; ===========================================================================
  52833. ; loc_29206:
  52834. Obj78_SubObjectLoop:
  52835. jsrto (SingleObjLoad2).l, JmpTo16_SingleObjLoad2
  52836. bne.w Obj78_Main
  52837. move.b #4,routine(a1)
  52838. ; loc_29214:
  52839. Obj78_LoadSubObject:
  52840. _move.b id(a0),id(a1) ; load obj78
  52841. move.l #Obj6B_MapUnc_2800E,mappings(a1)
  52842. move.w #make_art_tile(ArtTile_ArtNem_CPZStairBlock,3,0),art_tile(a1)
  52843. jsrto (Adjust2PArtPointer2).l, JmpTo5_Adjust2PArtPointer2
  52844. move.b #4,render_flags(a1)
  52845. move.b #3,priority(a1)
  52846. move.b #$10,width_pixels(a1)
  52847. move.b subtype(a0),subtype(a1)
  52848. move.w d2,x_pos(a1)
  52849. move.w y_pos(a0),y_pos(a1)
  52850. move.w x_pos(a0),objoff_30(a1)
  52851. move.w y_pos(a1),objoff_32(a1)
  52852. addi.w #$20,d2
  52853. move.b d3,objoff_2F(a1)
  52854. move.l a0,objoff_3C(a1)
  52855. add.b d4,d3
  52856. dbf d1,Obj78_SubObjectLoop
  52857.  
  52858. ; loc_2926C:
  52859. Obj78_Main:
  52860. moveq #0,d0
  52861. move.b subtype(a0),d0
  52862. andi.w #7,d0
  52863. add.w d0,d0
  52864. move.w Obj78_Types(pc,d0.w),d1
  52865. jsr Obj78_Types(pc,d1.w)
  52866.  
  52867. loc_29280:
  52868. movea.l objoff_3C(a0),a2 ; a2=object
  52869. moveq #0,d0
  52870. move.b objoff_2F(a0),d0
  52871. move.w (a2,d0.w),d0
  52872. add.w objoff_32(a0),d0
  52873. move.w d0,y_pos(a0)
  52874. moveq #0,d1
  52875. move.b width_pixels(a0),d1
  52876. addi.w #$B,d1
  52877. move.w #$10,d2
  52878. move.w #$11,d3
  52879. move.w x_pos(a0),d4
  52880. jsrto (SolidObject).l, JmpTo21_SolidObject
  52881. swap d6
  52882. or.b d6,objoff_2E(a2)
  52883. rts
  52884. ; ===========================================================================
  52885. ; off_292B8:
  52886. Obj78_Types: offsetTable
  52887. offsetTableEntry.w loc_292C8 ; 0
  52888. offsetTableEntry.w loc_29334 ; 1
  52889. offsetTableEntry.w loc_292EC ; 2
  52890. offsetTableEntry.w loc_29334 ; 3
  52891. offsetTableEntry.w loc_292C8 ; 4
  52892. offsetTableEntry.w loc_2935E ; 5
  52893. offsetTableEntry.w loc_292EC ; 6
  52894. offsetTableEntry.w loc_2935E ; 7
  52895. ; ===========================================================================
  52896.  
  52897. loc_292C8:
  52898. tst.w objoff_2C(a0)
  52899. bne.s loc_292E0
  52900. move.b objoff_2E(a0),d0
  52901. andi.b #touch_top_mask,d0
  52902. beq.s return_292DE
  52903. move.w #$1E,objoff_2C(a0)
  52904.  
  52905. return_292DE:
  52906. rts
  52907. ; ===========================================================================
  52908.  
  52909. loc_292E0:
  52910. subq.w #1,objoff_2C(a0)
  52911. bne.s return_292DE
  52912. addq.b #1,subtype(a0)
  52913. rts
  52914. ; ===========================================================================
  52915.  
  52916. loc_292EC:
  52917. tst.w objoff_2C(a0)
  52918. bne.s loc_29304
  52919. move.b objoff_2E(a0),d0
  52920. andi.b #touch_bottom_mask,d0
  52921. beq.s return_29302
  52922. move.w #$3C,objoff_2C(a0)
  52923.  
  52924. return_29302:
  52925. rts
  52926. ; ===========================================================================
  52927.  
  52928. loc_29304:
  52929. subq.w #1,objoff_2C(a0)
  52930. bne.s loc_29310
  52931. addq.b #1,subtype(a0)
  52932. rts
  52933. ; ===========================================================================
  52934.  
  52935. loc_29310:
  52936. lea objoff_34(a0),a1 ; a1=object
  52937. move.w objoff_2C(a0),d0
  52938. lsr.b #2,d0
  52939. andi.b #1,d0
  52940. move.w d0,(a1)+
  52941. eori.b #1,d0
  52942. move.w d0,(a1)+
  52943. eori.b #1,d0
  52944. move.w d0,(a1)+
  52945. eori.b #1,d0
  52946. move.w d0,(a1)+
  52947. rts
  52948. ; ===========================================================================
  52949.  
  52950. loc_29334:
  52951. lea objoff_34(a0),a1 ; a1=object
  52952. cmpi.w #$80,(a1)
  52953. beq.s return_2935C
  52954. addq.w #1,(a1)
  52955. moveq #0,d1
  52956. move.w (a1)+,d1
  52957. swap d1
  52958. lsr.l #1,d1
  52959. move.l d1,d2
  52960. lsr.l #1,d1
  52961. move.l d1,d3
  52962. add.l d2,d3
  52963. swap d1
  52964. swap d2
  52965. swap d3
  52966. move.w d3,(a1)+
  52967. move.w d2,(a1)+
  52968. move.w d1,(a1)+
  52969.  
  52970. return_2935C:
  52971. rts
  52972. ; ===========================================================================
  52973.  
  52974. loc_2935E:
  52975. lea objoff_34(a0),a1 ; a1=object
  52976. cmpi.w #-$80,(a1)
  52977. beq.s return_29386
  52978. subq.w #1,(a1)
  52979. moveq #0,d1
  52980. move.w (a1)+,d1
  52981. swap d1
  52982. asr.l #1,d1
  52983. move.l d1,d2
  52984. asr.l #1,d1
  52985. move.l d1,d3
  52986. add.l d2,d3
  52987. swap d1
  52988. swap d2
  52989. swap d3
  52990. move.w d3,(a1)+
  52991. move.w d2,(a1)+
  52992. move.w d1,(a1)+
  52993.  
  52994. return_29386:
  52995. rts
  52996. ; ===========================================================================
  52997.  
  52998. if ~~removeJmpTos
  52999. JmpTo16_SingleObjLoad2
  53000. jmp (SingleObjLoad2).l
  53001. JmpTo5_Adjust2PArtPointer2
  53002. jmp (Adjust2PArtPointer2).l
  53003. JmpTo21_SolidObject
  53004. jmp (SolidObject).l
  53005. JmpTo6_MarkObjGone2
  53006. jmp (MarkObjGone2).l
  53007.  
  53008. align 4
  53009. endif
  53010.  
  53011.  
  53012.  
  53013.  
  53014. ; ===========================================================================
  53015. ; ----------------------------------------------------------------------------
  53016. ; Object 7A - Platform that moves back and forth on top of water in CPZ
  53017. ; ----------------------------------------------------------------------------
  53018. ; Sprite_293A0:
  53019. Obj7A:
  53020. moveq #0,d0
  53021. move.b routine(a0),d0
  53022. move.w Obj7A_Index(pc,d0.w),d1
  53023. jmp Obj7A_Index(pc,d1.w)
  53024. ; ===========================================================================
  53025. ; off_293AE:
  53026. Obj7A_Index: offsetTable
  53027. offsetTableEntry.w Obj7A_Init ; 0
  53028. offsetTableEntry.w Obj7A_Main ; 2
  53029. offsetTableEntry.w Obj7A_SubObject ; 4
  53030. ; ===========================================================================
  53031. byte_293B4:
  53032. dc.b 0
  53033. dc.b $68 ; 1
  53034. dc.b $FF ; 2
  53035. dc.b $98 ; 3
  53036. dc.b 0 ; 4
  53037. dc.b 0 ; 5
  53038. dc.b 1 ; 6
  53039. dc.b $A8 ; 7
  53040. dc.b $FF ; 8
  53041. dc.b $50 ; 9
  53042. dc.b 0 ; 10
  53043. dc.b $40 ; 11
  53044. dc.b 1 ; 12
  53045. dc.b $E8 ; 13
  53046. dc.b $FF ; 14
  53047. dc.b $80 ; 15
  53048. dc.b 0 ; 16
  53049. dc.b $80 ; 17
  53050. dc.b 0 ; 18
  53051. dc.b $68 ; 19
  53052. dc.b 0 ; 20
  53053. dc.b $67 ; 21
  53054. dc.b 0 ; 22
  53055. dc.b 0 ; 23
  53056. ; ===========================================================================
  53057. ; loc_293CC:
  53058. Obj7A_Init:
  53059. addq.b #2,routine(a0)
  53060. move.l #Obj7A_MapUnc_29564,mappings(a0)
  53061. move.w #make_art_tile(ArtTile_ArtNem_CPZStairBlock,3,1),art_tile(a0)
  53062. cmpi.b #mystic_cave_zone,(Current_Zone).w
  53063. bne.s +
  53064. move.l #Obj15_Obj7A_MapUnc_10256,mappings(a0)
  53065. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  53066. +
  53067. jsrto (Adjust2PArtPointer).l, JmpTo41_Adjust2PArtPointer
  53068. moveq #0,d1
  53069. move.b subtype(a0),d1
  53070. lea byte_293B4(pc,d1.w),a2
  53071. move.b (a2)+,d1
  53072. movea.l a0,a1
  53073. bra.s Obj7A_LoadSubObject
  53074. ; ===========================================================================
  53075. ; loc_29408:
  53076. Obj7A_SubObjectLoop:
  53077. jsrto (SingleObjLoad2).l, JmpTo17_SingleObjLoad2
  53078. bne.s Obj7A_SubObjectLoop_End
  53079. _move.b id(a0),id(a1) ; load obj7A
  53080. move.b #4,routine(a1)
  53081. move.w x_pos(a0),x_pos(a1)
  53082. move.w y_pos(a0),y_pos(a1)
  53083. ; loc_29426:
  53084. Obj7A_LoadSubObject:
  53085. move.l mappings(a0),mappings(a1)
  53086. move.w art_tile(a0),art_tile(a1)
  53087. move.b #4,render_flags(a1)
  53088. move.b #4,priority(a1)
  53089. move.b #$18,width_pixels(a1)
  53090. move.w x_pos(a1),objoff_30(a1)
  53091. ; loc_2944A:
  53092. Obj7A_SubObjectLoop_End:
  53093. dbf d1,Obj7A_SubObjectLoop
  53094.  
  53095. move.l a0,objoff_3C(a1)
  53096. move.l a1,objoff_3C(a0)
  53097. cmpi.b #$C,subtype(a0)
  53098. bne.s +
  53099. move.b #1,objoff_36(a0)
  53100. +
  53101. moveq #0,d1
  53102. move.b (a2)+,d1
  53103. move.w objoff_30(a0),d0
  53104. sub.w d1,d0
  53105. move.w d0,objoff_32(a0)
  53106. move.w d0,objoff_32(a1)
  53107. add.w d1,d0
  53108. add.w d1,d0
  53109. move.w d0,objoff_34(a0)
  53110. move.w d0,objoff_34(a1)
  53111. move.w (a2)+,d0
  53112. add.w d0,x_pos(a0)
  53113. move.w (a2)+,d0
  53114. add.w d0,x_pos(a1)
  53115. ; loc_2948E:
  53116. Obj7A_Main:
  53117. bsr.s loc_294F4
  53118. tst.w (Two_player_mode).w
  53119. beq.s + ; if 2P VS mode is off, branch
  53120. jmpto (DisplaySprite).l, JmpTo24_DisplaySprite
  53121. ; ===========================================================================
  53122. +
  53123. move.w objoff_32(a0),d0
  53124. andi.w #$FF80,d0
  53125. sub.w (Camera_X_pos_coarse).w,d0
  53126. cmpi.w #$280,d0
  53127. bls.s +
  53128. move.w objoff_34(a0),d0
  53129. andi.w #$FF80,d0
  53130. sub.w (Camera_X_pos_coarse).w,d0
  53131. cmpi.w #$280,d0
  53132. bhi.s loc_294C4
  53133. +
  53134. jmp (DisplaySprite).l
  53135. ; ===========================================================================
  53136.  
  53137. loc_294C4:
  53138. movea.l objoff_3C(a0),a1 ; a1=object
  53139. cmpa.l a0,a1
  53140. beq.s +
  53141. jsr (DeleteObject2).l
  53142. +
  53143. lea (Object_Respawn_Table).w,a2
  53144. moveq #0,d0
  53145. move.b respawn_index(a0),d0
  53146. beq.s JmpTo39_DeleteObject
  53147. bclr #7,2(a2,d0.w)
  53148.  
  53149. JmpTo39_DeleteObject
  53150. jmp (DeleteObject).l
  53151. ; ===========================================================================
  53152. ; loc_294EA:
  53153. Obj7A_SubObject:
  53154. bsr.s loc_294F4
  53155. bsr.s loc_2953E
  53156. jmp (DisplaySprite).l
  53157. ; ===========================================================================
  53158.  
  53159. loc_294F4:
  53160. move.w x_pos(a0),-(sp)
  53161. tst.b objoff_36(a0)
  53162. beq.s loc_29516
  53163. move.w x_pos(a0),d0
  53164. subq.w #1,d0
  53165. cmp.w objoff_32(a0),d0
  53166. bne.s +
  53167. move.b #0,objoff_36(a0)
  53168. +
  53169. move.w d0,x_pos(a0)
  53170. bra.s loc_2952C
  53171. ; ===========================================================================
  53172.  
  53173. loc_29516:
  53174. move.w x_pos(a0),d0
  53175. addq.w #1,d0
  53176. cmp.w objoff_34(a0),d0
  53177. bne.s +
  53178. move.b #1,objoff_36(a0)
  53179. +
  53180. move.w d0,x_pos(a0)
  53181.  
  53182. loc_2952C:
  53183. moveq #0,d1
  53184. move.b width_pixels(a0),d1
  53185. move.w #8,d3
  53186. move.w (sp)+,d4
  53187. jsrto (PlatformObject).l, JmpTo6_PlatformObject
  53188. rts
  53189. ; ===========================================================================
  53190.  
  53191. loc_2953E:
  53192. movea.l objoff_3C(a0),a1 ; a1=object
  53193. move.w x_pos(a0),d0
  53194. subi.w #$18,d0
  53195. move.w x_pos(a1),d2
  53196. addi.w #$18,d2
  53197. cmp.w d0,d2
  53198. bne.s + ; rts
  53199. eori.b #1,objoff_36(a0)
  53200. eori.b #1,objoff_36(a1)
  53201. +
  53202. rts
  53203. ; ===========================================================================
  53204. ; ----------------------------------------------------------------------------
  53205. ; sprite mappings
  53206. ; ----------------------------------------------------------------------------
  53207. Obj7A_MapUnc_29564: BINCLUDE "mappings/sprite/obj7A.bin"
  53208. ; ===========================================================================
  53209.  
  53210. if ~~removeJmpTos
  53211. JmpTo24_DisplaySprite
  53212. jmp (DisplaySprite).l
  53213. JmpTo17_SingleObjLoad2
  53214. jmp (SingleObjLoad2).l
  53215. JmpTo41_Adjust2PArtPointer
  53216. jmp (Adjust2PArtPointer).l
  53217. JmpTo6_PlatformObject
  53218. jmp (PlatformObject).l
  53219.  
  53220. align 4
  53221. endif
  53222.  
  53223.  
  53224.  
  53225.  
  53226. ; ===========================================================================
  53227. ; ----------------------------------------------------------------------------
  53228. ; Object 7B - Warp pipe exit spring from CPZ
  53229. ; ----------------------------------------------------------------------------
  53230. ; Sprite_29590:
  53231. Obj7B:
  53232. moveq #0,d0
  53233. move.b routine(a0),d0
  53234. move.w Obj7B_Index(pc,d0.w),d1
  53235. jsr Obj7B_Index(pc,d1.w)
  53236. tst.w (Two_player_mode).w
  53237. beq.s +
  53238. jmpto (DisplaySprite).l, JmpTo25_DisplaySprite
  53239. ; ===========================================================================
  53240. +
  53241. move.w x_pos(a0),d0
  53242. andi.w #$FF80,d0
  53243. sub.w (Camera_X_pos_coarse).w,d0
  53244. cmpi.w #$280,d0
  53245. bhi.w JmpTo40_DeleteObject
  53246. jmpto (DisplaySprite).l, JmpTo25_DisplaySprite
  53247.  
  53248. if removeJmpTos
  53249. JmpTo40_DeleteObject
  53250. jmp (DeleteObject).l
  53251. endif
  53252. ; ===========================================================================
  53253. ; off_295C0:
  53254. Obj7B_Index: offsetTable
  53255. offsetTableEntry.w Obj7B_Init ; 0
  53256. offsetTableEntry.w Obj7B_Main ; 2
  53257. ; ===========================================================================
  53258. ; byte_295C4:
  53259. Obj7B_Strengths:
  53260. ; Speed applied on Sonic
  53261. dc.w -$1000
  53262. dc.w -$A80
  53263. ; ===========================================================================
  53264. ; loc_295C8:
  53265. Obj7B_Init:
  53266. addq.b #2,routine(a0)
  53267. move.l #Obj7B_MapUnc_29780,mappings(a0)
  53268. move.w #make_art_tile(ArtTile_ArtNem_CPZTubeSpring,0,0),art_tile(a0)
  53269. ori.b #4,render_flags(a0)
  53270. move.b #$10,width_pixels(a0)
  53271. move.b #1,priority(a0)
  53272. move.b subtype(a0),d0
  53273. andi.w #2,d0
  53274. move.w Obj7B_Strengths(pc,d0.w),objoff_30(a0)
  53275. jsrto (Adjust2PArtPointer).l, JmpTo42_Adjust2PArtPointer
  53276. ; loc_295FE:
  53277. Obj7B_Main:
  53278. cmpi.b #1,mapping_frame(a0)
  53279. beq.s loc_29648
  53280. move.w #$1B,d1
  53281. move.w #8,d2
  53282. move.w #$10,d3
  53283. move.w x_pos(a0),d4
  53284. lea (MainCharacter).w,a1 ; a1=character
  53285. moveq #p1_standing_bit,d6
  53286. movem.l d1-d4,-(sp)
  53287. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo4_SolidObject_Always_SingleCharacter
  53288. btst #p1_standing_bit,status(a0)
  53289. beq.s +
  53290. bsr.w loc_296C2
  53291. +
  53292. movem.l (sp)+,d1-d4
  53293. lea (Sidekick).w,a1 ; a1=character
  53294. moveq #p2_standing_bit,d6
  53295. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo4_SolidObject_Always_SingleCharacter
  53296. btst #p2_standing_bit,status(a0)
  53297. beq.s loc_29648
  53298. bsr.s loc_296C2
  53299.  
  53300. loc_29648:
  53301. move.w x_pos(a0),d4
  53302. move.w d4,d5
  53303. subi.w #$10,d4
  53304. addi.w #$10,d5
  53305. move.w y_pos(a0),d2
  53306. move.w d2,d3
  53307. addi.w #$30,d3
  53308. move.w (MainCharacter+x_pos).w,d0
  53309. cmp.w d4,d0
  53310. blo.s loc_29686
  53311. cmp.w d5,d0
  53312. bhs.s loc_29686
  53313. move.w (MainCharacter+y_pos).w,d0
  53314. cmp.w d2,d0
  53315. blo.s loc_29686
  53316. cmp.w d3,d0
  53317. bhs.s loc_29686
  53318. cmpi.b #2,next_anim(a0)
  53319. beq.s loc_29686
  53320. move.b #2,anim(a0)
  53321.  
  53322. loc_29686:
  53323. move.w (Sidekick+x_pos).w,d0
  53324. cmp.w d4,d0
  53325. blo.s loc_296B6
  53326. cmp.w d5,d0
  53327. bhs.s loc_296B6
  53328. move.w (Sidekick+y_pos).w,d0
  53329. cmp.w d2,d0
  53330. blo.s loc_296B6
  53331. cmp.w d3,d0
  53332. bhs.s loc_296B6
  53333. cmpi.w #4,(Tails_CPU_routine).w ; TailsCPU_Flying
  53334. beq.w loc_296B6
  53335. cmpi.b #3,next_anim(a0)
  53336. beq.s loc_296B6
  53337. move.b #3,anim(a0)
  53338.  
  53339. loc_296B6:
  53340. lea (Ani_obj7B).l,a1
  53341. jmpto (AnimateSprite).l, JmpTo8_AnimateSprite
  53342. ; ===========================================================================
  53343. rts
  53344. ; ===========================================================================
  53345.  
  53346. loc_296C2:
  53347. move.w #$100,anim(a0)
  53348. addq.w #4,y_pos(a1)
  53349. move.w objoff_30(a0),y_vel(a1)
  53350. bset #1,status(a1)
  53351. bclr #3,status(a1)
  53352. move.b #AniIDSonAni_Spring,anim(a1)
  53353. move.b #2,routine(a1)
  53354. move.b subtype(a0),d0
  53355. bpl.s +
  53356. move.w #0,x_vel(a1)
  53357. +
  53358. btst #0,d0
  53359. beq.s loc_29736
  53360. move.w #1,inertia(a1)
  53361. move.b #1,flip_angle(a1)
  53362. move.b #AniIDSonAni_Walk,anim(a1)
  53363. move.b #0,flips_remaining(a1)
  53364. move.b #4,flip_speed(a1)
  53365. btst #1,d0
  53366. bne.s +
  53367. move.b #1,flips_remaining(a1)
  53368. +
  53369. btst #0,status(a1)
  53370. beq.s loc_29736
  53371. neg.b flip_angle(a1)
  53372. neg.w inertia(a1)
  53373.  
  53374. loc_29736:
  53375. andi.b #$C,d0
  53376. cmpi.b #4,d0
  53377. bne.s +
  53378. move.b #$C,top_solid_bit(a1)
  53379. move.b #$D,lrb_solid_bit(a1)
  53380. +
  53381. cmpi.b #8,d0
  53382. bne.s +
  53383. move.b #$E,top_solid_bit(a1)
  53384. move.b #$F,lrb_solid_bit(a1)
  53385. +
  53386. move.w #SndID_Spring,d0
  53387. jmp (PlaySound).l
  53388. ; ===========================================================================
  53389. ; animation script
  53390. ; off_29768:
  53391. Ani_obj7B: offsetTable
  53392. offsetTableEntry.w byte_29770 ; 0
  53393. offsetTableEntry.w byte_29773 ; 1
  53394. offsetTableEntry.w byte_29777 ; 2
  53395. offsetTableEntry.w byte_29777 ; 3
  53396. byte_29770: dc.b $F, 0,$FF
  53397. rev02even
  53398. byte_29773: dc.b 0, 3,$FD, 0
  53399. rev02even
  53400. byte_29777: dc.b 5, 1, 2, 2, 2, 4,$FD, 0
  53401. even
  53402. ; ----------------------------------------------------------------------------
  53403. ; sprite mappings
  53404. ; ----------------------------------------------------------------------------
  53405. Obj7B_MapUnc_29780: BINCLUDE "mappings/sprite/obj7B.bin"
  53406. ; ===========================================================================
  53407.  
  53408. if gameRevision<2
  53409. nop
  53410. endif
  53411.  
  53412. if ~~removeJmpTos
  53413. JmpTo25_DisplaySprite
  53414. jmp (DisplaySprite).l
  53415. JmpTo40_DeleteObject
  53416. jmp (DeleteObject).l
  53417. JmpTo8_AnimateSprite
  53418. jmp (AnimateSprite).l
  53419. JmpTo42_Adjust2PArtPointer
  53420. jmp (Adjust2PArtPointer).l
  53421. JmpTo4_SolidObject_Always_SingleCharacter
  53422. jmp (SolidObject_Always_SingleCharacter).l
  53423.  
  53424. align 4
  53425. endif
  53426.  
  53427.  
  53428.  
  53429.  
  53430. ; ===========================================================================
  53431. ; ----------------------------------------------------------------------------
  53432. ; Object 7F - Vine switch that you hang off in MCZ
  53433. ; ----------------------------------------------------------------------------
  53434. ; Sprite_297E4:
  53435. Obj7F:
  53436. moveq #0,d0
  53437. move.b routine(a0),d0
  53438. move.w Obj7F_Index(pc,d0.w),d1
  53439. jmp Obj7F_Index(pc,d1.w)
  53440. ; ===========================================================================
  53441. ; off_297F2:
  53442. Obj7F_Index: offsetTable
  53443. offsetTableEntry.w Obj7F_Init ; 0
  53444. offsetTableEntry.w Obj7F_Main ; 2
  53445. ; ===========================================================================
  53446. ; loc_297F6:
  53447. Obj7F_Init:
  53448. addq.b #2,routine(a0)
  53449. move.l #Obj7F_MapUnc_29938,mappings(a0)
  53450. move.w #make_art_tile(ArtTile_ArtNem_VineSwitch,3,0),art_tile(a0)
  53451. jsrto (Adjust2PArtPointer).l, JmpTo43_Adjust2PArtPointer
  53452. move.b #4,render_flags(a0)
  53453. move.b #8,width_pixels(a0)
  53454. move.b #4,priority(a0)
  53455. ; loc_2981E:
  53456. Obj7F_Main:
  53457. lea objoff_30(a0),a2
  53458. lea (MainCharacter).w,a1 ; a1=character
  53459. move.w (Ctrl_1).w,d0
  53460. bsr.s Obj7F_Action
  53461. lea (Sidekick).w,a1 ; a1=character
  53462. addq.w #1,a2
  53463. move.w (Ctrl_2).w,d0
  53464. bsr.s Obj7F_Action
  53465. jmpto (MarkObjGone).l, JmpTo24_MarkObjGone
  53466. ; ===========================================================================
  53467. ; loc_2983C:
  53468. Obj7F_Action:
  53469. tst.b (a2)
  53470. beq.s loc_29890
  53471. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  53472. beq.w return_29936
  53473. clr.b obj_control(a1)
  53474. clr.b (a2)
  53475. move.b #$12,2(a2)
  53476. andi.w #(button_up_mask|button_down_mask|button_left_mask|button_right_mask)<<8,d0
  53477. beq.s +
  53478. move.b #$3C,2(a2)
  53479. +
  53480. move.w #-$300,y_vel(a1)
  53481. move.b subtype(a0),d0
  53482. andi.w #$F,d0
  53483. lea (ButtonVine_Trigger).w,a3
  53484. lea (a3,d0.w),a3
  53485. bclr #0,(a3)
  53486. move.b #0,mapping_frame(a0)
  53487. tst.w objoff_30(a0)
  53488. beq.s +
  53489. move.b #1,mapping_frame(a0)
  53490. +
  53491. bra.w return_29936
  53492. ; ===========================================================================
  53493.  
  53494. loc_29890:
  53495. tst.b 2(a2)
  53496. beq.s +
  53497. subq.b #1,2(a2)
  53498. bne.w return_29936
  53499. +
  53500. move.w x_pos(a1),d0
  53501. sub.w x_pos(a0),d0
  53502. addi.w #$C,d0
  53503. cmpi.w #$18,d0
  53504. bhs.w return_29936
  53505. move.w y_pos(a1),d1
  53506. sub.w y_pos(a0),d1
  53507. subi.w #$28,d1
  53508. cmpi.w #$10,d1
  53509. bhs.w return_29936
  53510. tst.b obj_control(a1)
  53511. bmi.s return_29936
  53512. cmpi.b #4,routine(a1)
  53513. bhs.s return_29936
  53514. tst.w (Debug_placement_mode).w
  53515. bne.s return_29936
  53516. clr.w x_vel(a1)
  53517. clr.w y_vel(a1)
  53518. clr.w inertia(a1)
  53519. move.w x_pos(a0),x_pos(a1)
  53520. move.w y_pos(a0),y_pos(a1)
  53521. addi.w #$30,y_pos(a1)
  53522. move.b #AniIDSonAni_Hang2,anim(a1)
  53523. move.b #1,obj_control(a1)
  53524. move.b #1,(a2)
  53525. move.b subtype(a0),d0
  53526. andi.w #$F,d0
  53527. lea (ButtonVine_Trigger).w,a3
  53528. bset #0,(a3,d0.w)
  53529. move.w #SndID_Blip,d0
  53530. jsr (PlaySound).l
  53531. move.b #0,mapping_frame(a0)
  53532. tst.w objoff_30(a0)
  53533. beq.s return_29936
  53534. move.b #1,mapping_frame(a0)
  53535.  
  53536. return_29936:
  53537. rts
  53538. ; ===========================================================================
  53539. ; ----------------------------------------------------------------------------
  53540. ; sprite mappings
  53541. ; ----------------------------------------------------------------------------
  53542. Obj7F_MapUnc_29938: BINCLUDE "mappings/sprite/obj7F.bin"
  53543. ; ===========================================================================
  53544.  
  53545. if ~~removeJmpTos
  53546. JmpTo24_MarkObjGone
  53547. jmp (MarkObjGone).l
  53548. JmpTo43_Adjust2PArtPointer
  53549. jmp (Adjust2PArtPointer).l
  53550.  
  53551. align 4
  53552. endif
  53553.  
  53554.  
  53555.  
  53556.  
  53557. ; ===========================================================================
  53558. ; ----------------------------------------------------------------------------
  53559. ; Object 80 - Vine that you hang off and it moves down from MCZ
  53560. ; ----------------------------------------------------------------------------
  53561. ; Sprite_2997C:
  53562. Obj80:
  53563. moveq #0,d0
  53564. move.b routine(a0),d0
  53565. move.w Obj80_Index(pc,d0.w),d1
  53566. jmp Obj80_Index(pc,d1.w)
  53567. ; ===========================================================================
  53568. ; off_2998A:
  53569. Obj80_Index: offsetTable
  53570. offsetTableEntry.w Obj80_Init ; 0 - Init
  53571. offsetTableEntry.w Obj80_MCZ_Main ; 2 - MCZ Vine
  53572. offsetTableEntry.w Obj80_WFZ_Main ; 4 - WFZ Hook
  53573. ; ===========================================================================
  53574. ; loc_29990:
  53575. Obj80_Init:
  53576. addq.b #2,routine(a0)
  53577. move.b #4,render_flags(a0)
  53578. move.b #$10,width_pixels(a0)
  53579. move.b #4,priority(a0)
  53580. move.b #$80,y_radius(a0)
  53581. bset #4,render_flags(a0)
  53582. move.w y_pos(a0),objoff_3C(a0)
  53583. cmpi.b #wing_fortress_zone,(Current_Zone).w
  53584. bne.s Obj80_MCZ_Init
  53585. addq.b #2,routine(a0)
  53586. move.l #Obj80_MapUnc_29DD0,mappings(a0)
  53587. move.w #make_art_tile(ArtTile_ArtNem_WfzHook_Fudge,1,0),art_tile(a0)
  53588. jsrto (Adjust2PArtPointer).l, JmpTo44_Adjust2PArtPointer
  53589. move.w #$A0,objoff_2E(a0)
  53590. move.b subtype(a0),d0
  53591. move.b d0,d1
  53592. andi.b #$F,d0
  53593. beq.s +
  53594. move.w #$60,objoff_2E(a0)
  53595. +
  53596. move.b subtype(a0),d0
  53597. move.w #2,objoff_3A(a0)
  53598. andi.b #$70,d1
  53599. beq.s +
  53600. move.w objoff_2E(a0),d0
  53601. move.w d0,objoff_38(a0)
  53602. move.b #1,objoff_36(a0)
  53603. add.w d0,y_pos(a0)
  53604. lsr.w #4,d0
  53605. addq.w #1,d0
  53606. move.b d0,mapping_frame(a0)
  53607. +
  53608. bra.w Obj80_WFZ_Main
  53609. ; ===========================================================================
  53610. ; loc_29A1C:
  53611. Obj80_MCZ_Init:
  53612. move.l #Obj80_MapUnc_29C64,mappings(a0)
  53613. move.w #make_art_tile(ArtTile_ArtNem_VinePulley,3,0),art_tile(a0)
  53614. jsrto (Adjust2PArtPointer).l, JmpTo44_Adjust2PArtPointer
  53615. move.w #$B0,objoff_2E(a0)
  53616. move.b subtype(a0),d0
  53617. bpl.s +
  53618. move.b #1,objoff_34(a0)
  53619. +
  53620. move.w #2,objoff_3A(a0)
  53621. andi.b #$70,d0
  53622. beq.s Obj80_MCZ_Main
  53623. move.w objoff_2E(a0),d0
  53624. move.w d0,objoff_38(a0)
  53625. move.b #1,objoff_36(a0)
  53626. add.w d0,y_pos(a0)
  53627. lsr.w #5,d0
  53628. addq.w #1,d0
  53629. move.b d0,mapping_frame(a0)
  53630. ; loc_29A66:
  53631. Obj80_MCZ_Main:
  53632. tst.b objoff_36(a0)
  53633. beq.s loc_29A74
  53634. tst.w objoff_30(a0)
  53635. bne.s loc_29A8A
  53636. bra.s loc_29A7A
  53637. ; ===========================================================================
  53638.  
  53639. loc_29A74:
  53640. tst.w objoff_30(a0)
  53641. beq.s loc_29A8A
  53642.  
  53643. loc_29A7A:
  53644. move.w objoff_38(a0),d2
  53645. cmp.w objoff_2E(a0),d2
  53646. beq.s loc_29AAE
  53647. add.w objoff_3A(a0),d2
  53648. bra.s loc_29A94
  53649. ; ===========================================================================
  53650.  
  53651. loc_29A8A:
  53652. move.w objoff_38(a0),d2
  53653. beq.s loc_29AAE
  53654. sub.w objoff_3A(a0),d2
  53655.  
  53656. loc_29A94:
  53657. move.w d2,objoff_38(a0)
  53658. move.w objoff_3C(a0),d0
  53659. add.w d2,d0
  53660. move.w d0,y_pos(a0)
  53661. move.w d2,d0
  53662. beq.s +
  53663. lsr.w #5,d0
  53664. addq.w #1,d0
  53665. +
  53666. move.b d0,mapping_frame(a0)
  53667.  
  53668. loc_29AAE:
  53669. lea objoff_30(a0),a2
  53670. lea (MainCharacter).w,a1 ; a1=character
  53671. move.w (Ctrl_1).w,d0
  53672. bsr.s Obj80_Action
  53673. lea (Sidekick).w,a1 ; a1=character
  53674. addq.w #1,a2
  53675. move.w (Ctrl_2).w,d0
  53676. bsr.s Obj80_Action
  53677. jmpto (MarkObjGone).l, JmpTo25_MarkObjGone
  53678. ; ===========================================================================
  53679. ; loc_29ACC:
  53680. Obj80_Action:
  53681. tst.b (a2)
  53682. beq.w loc_29B5E
  53683. tst.b render_flags(a1)
  53684. bpl.s loc_29B42
  53685. cmpi.b #4,routine(a1)
  53686. bhs.s loc_29B42
  53687. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  53688. beq.w loc_29B50
  53689. clr.b obj_control(a1)
  53690. clr.b (a2)
  53691. move.b #$12,2(a2)
  53692. andi.w #(button_up_mask|button_down_mask|button_left_mask|button_right_mask)<<8,d0
  53693. beq.w +
  53694. move.b #$3C,2(a2)
  53695. +
  53696. btst #(button_left+8),d0
  53697. beq.s +
  53698. move.w #-$200,x_vel(a1)
  53699. +
  53700. btst #(button_right+8),d0
  53701. beq.s +
  53702. move.w #$200,x_vel(a1)
  53703. +
  53704. move.w #-$380,y_vel(a1)
  53705. bset #1,status(a1)
  53706. tst.b objoff_34(a0)
  53707. beq.s + ; rts
  53708. move.b subtype(a0),d0
  53709. andi.w #$F,d0
  53710. lea (ButtonVine_Trigger).w,a3
  53711. lea (a3,d0.w),a3
  53712. bclr #0,(a3)
  53713. +
  53714. rts
  53715. ; ===========================================================================
  53716.  
  53717. loc_29B42:
  53718. clr.b obj_control(a1)
  53719. clr.b (a2)
  53720. move.b #$3C,2(a2)
  53721. rts
  53722. ; ===========================================================================
  53723.  
  53724. loc_29B50:
  53725. move.w y_pos(a0),y_pos(a1)
  53726. addi.w #$94,y_pos(a1)
  53727. rts
  53728. ; ===========================================================================
  53729.  
  53730. loc_29B5E:
  53731. tst.b 2(a2)
  53732. beq.s +
  53733. subq.b #1,2(a2)
  53734. bne.w return_29BF8
  53735. +
  53736. move.w x_pos(a1),d0
  53737. sub.w x_pos(a0),d0
  53738. addi.w #$10,d0
  53739. cmpi.w #$20,d0
  53740. bhs.w return_29BF8
  53741. move.w y_pos(a1),d1
  53742. sub.w y_pos(a0),d1
  53743. subi.w #$88,d1
  53744. cmpi.w #$18,d1
  53745. bhs.w return_29BF8
  53746. tst.b obj_control(a1)
  53747. bmi.s return_29BF8
  53748. cmpi.b #4,routine(a1)
  53749. bhs.s return_29BF8
  53750. tst.w (Debug_placement_mode).w
  53751. bne.s return_29BF8
  53752. clr.w x_vel(a1)
  53753. clr.w y_vel(a1)
  53754. clr.w inertia(a1)
  53755. move.w x_pos(a0),x_pos(a1)
  53756. move.w y_pos(a0),y_pos(a1)
  53757. addi.w #$94,y_pos(a1)
  53758. move.b #AniIDSonAni_Hang2,anim(a1)
  53759. move.b #1,obj_control(a1)
  53760. move.b #1,(a2)
  53761. tst.b objoff_34(a0)
  53762. beq.s return_29BF8
  53763. move.b subtype(a0),d0
  53764. andi.w #$F,d0
  53765. lea (ButtonVine_Trigger).w,a3
  53766. bset #0,(a3,d0.w)
  53767. move.w #SndID_Blip,d0
  53768. jsr (PlaySound).l
  53769.  
  53770. return_29BF8:
  53771. rts
  53772. ; ===========================================================================
  53773. ; loc_29BFA:
  53774. Obj80_WFZ_Main:
  53775. tst.b objoff_36(a0)
  53776. beq.s loc_29C08
  53777. tst.w objoff_30(a0)
  53778. bne.s loc_29C1E
  53779. bra.s loc_29C0E
  53780. ; ===========================================================================
  53781.  
  53782. loc_29C08:
  53783. tst.w objoff_30(a0)
  53784. beq.s loc_29C1E
  53785.  
  53786. loc_29C0E:
  53787. move.w objoff_38(a0),d2
  53788. cmp.w objoff_2E(a0),d2
  53789. beq.s loc_29C42
  53790. add.w objoff_3A(a0),d2
  53791. bra.s loc_29C28
  53792. ; ===========================================================================
  53793.  
  53794. loc_29C1E:
  53795. move.w objoff_38(a0),d2
  53796. beq.s loc_29C42
  53797. sub.w objoff_3A(a0),d2
  53798.  
  53799. loc_29C28:
  53800. move.w d2,objoff_38(a0)
  53801. move.w objoff_3C(a0),d0
  53802. add.w d2,d0
  53803. move.w d0,y_pos(a0)
  53804. move.w d2,d0
  53805. beq.s +
  53806. lsr.w #4,d0
  53807. addq.w #1,d0
  53808. +
  53809. move.b d0,mapping_frame(a0)
  53810.  
  53811. loc_29C42:
  53812. lea objoff_30(a0),a2
  53813. lea (MainCharacter).w,a1 ; a1=character
  53814. move.w (Ctrl_1).w,d0
  53815. bsr.w Obj80_Action
  53816. lea (Sidekick).w,a1 ; a1=character
  53817. addq.w #1,a2
  53818. move.w (Ctrl_2).w,d0
  53819. bsr.w Obj80_Action
  53820. jmpto (MarkObjGone).l, JmpTo25_MarkObjGone
  53821. ; ===========================================================================
  53822. ; ----------------------------------------------------------------------------
  53823. ; sprite mappings
  53824. ; ----------------------------------------------------------------------------
  53825. Obj80_MapUnc_29C64: BINCLUDE "mappings/sprite/obj80_a.bin"
  53826. ; ----------------------------------------------------------------------------
  53827. ; sprite mappings
  53828. ; ----------------------------------------------------------------------------
  53829. Obj80_MapUnc_29DD0: BINCLUDE "mappings/sprite/obj80_b.bin"
  53830. ; ===========================================================================
  53831.  
  53832. if ~~removeJmpTos
  53833. JmpTo25_MarkObjGone
  53834. jmp (MarkObjGone).l
  53835. JmpTo44_Adjust2PArtPointer
  53836. jmp (Adjust2PArtPointer).l
  53837.  
  53838. align 4
  53839. endif
  53840.  
  53841.  
  53842.  
  53843.  
  53844. ; ===========================================================================
  53845. ; ----------------------------------------------------------------------------
  53846. ; Object 81 - Drawbridge (MCZ)
  53847. ; ----------------------------------------------------------------------------
  53848. ; Sprite_2A000:
  53849. Obj81:
  53850. btst #6,render_flags(a0)
  53851. bne.w +
  53852. moveq #0,d0
  53853. move.b routine(a0),d0
  53854. move.w Obj81_Index(pc,d0.w),d1
  53855. jmp Obj81_Index(pc,d1.w)
  53856. ; ===========================================================================
  53857. +
  53858. move.w #$280,d0
  53859. jmpto (DisplaySprite3).l, JmpTo2_DisplaySprite3
  53860. ; ===========================================================================
  53861. ; off_2A020:
  53862. Obj81_Index: offsetTable
  53863. offsetTableEntry.w Obj81_Init ; 0
  53864. offsetTableEntry.w Obj81_BridgeUp ; 2
  53865. offsetTableEntry.w loc_2A18A ; 4
  53866. ; ===========================================================================
  53867. ; loc_2A026:
  53868. Obj81_Init:
  53869. addq.b #2,routine(a0)
  53870. move.l #Obj81_MapUnc_2A24E,mappings(a0)
  53871. move.w #make_art_tile(ArtTile_ArtNem_MCZGateLog,3,0),art_tile(a0)
  53872. jsrto (Adjust2PArtPointer).l, JmpTo45_Adjust2PArtPointer
  53873. move.b #4,render_flags(a0)
  53874. move.b #5,priority(a0)
  53875. move.b #8,width_pixels(a0)
  53876. ori.b #$80,status(a0)
  53877. move.w x_pos(a0),objoff_30(a0)
  53878. move.w y_pos(a0),objoff_32(a0)
  53879. subi.w #$48,y_pos(a0)
  53880. move.b #-$40,angle(a0)
  53881. moveq #-$10,d4
  53882. btst #1,status(a0)
  53883. beq.s +
  53884. addi.w #$90,y_pos(a0)
  53885. move.b #$40,angle(a0)
  53886. neg.w d4
  53887. +
  53888. move.w #$100,d1
  53889. btst #0,status(a0)
  53890. beq.s +
  53891. neg.w d1
  53892. +
  53893. move.w d1,objoff_34(a0)
  53894. jsrto (SingleObjLoad2).l, JmpTo18_SingleObjLoad2
  53895. bne.s Obj81_BridgeUp
  53896. _move.b id(a0),id(a1) ; load obj81
  53897. move.l mappings(a0),mappings(a1)
  53898. move.w art_tile(a0),art_tile(a1)
  53899. move.b #4,render_flags(a1)
  53900. bset #6,render_flags(a1)
  53901. move.b #$40,mainspr_width(a1)
  53902. move.w objoff_30(a0),d2
  53903. move.w objoff_32(a0),d3
  53904. moveq #8,d1
  53905. move.b d1,mainspr_childsprites(a1)
  53906. subq.w #1,d1
  53907. lea sub2_x_pos(a1),a2
  53908.  
  53909. - add.w d4,d3
  53910. move.w d2,(a2)+ ; sub?_x_pos
  53911. move.w d3,(a2)+ ; sub?_y_pos
  53912. move.w #1,(a2)+ ; sub?_mapframe
  53913. dbf d1,-
  53914.  
  53915. move.w sub6_x_pos(a1),x_pos(a1)
  53916. move.w sub6_y_pos(a1),y_pos(a1)
  53917. move.l a1,objoff_3C(a0)
  53918. move.b #$40,mainspr_height(a1)
  53919. bset #4,render_flags(a1)
  53920. ; loc_2A0FE:
  53921. Obj81_BridgeUp:
  53922. lea (ButtonVine_Trigger).w,a2
  53923. moveq #0,d0
  53924. move.b subtype(a0),d0
  53925. btst #0,(a2,d0.w)
  53926. beq.s +
  53927. tst.b objoff_36(a0)
  53928. bne.s +
  53929. move.b #1,objoff_36(a0)
  53930. move.w #SndID_DrawbridgeMove,d0
  53931. jsr (PlaySoundStereo).l
  53932. cmpi.b #$81,status(a0)
  53933. bne.s +
  53934. move.w objoff_30(a0),x_pos(a0)
  53935. subi.w #$48,x_pos(a0)
  53936. +
  53937. tst.b objoff_36(a0)
  53938. beq.s loc_2A188
  53939. move.w #$48,d1
  53940. tst.b angle(a0)
  53941. beq.s loc_2A154
  53942. cmpi.b #$80,angle(a0)
  53943. bne.s loc_2A180
  53944. neg.w d1
  53945.  
  53946. loc_2A154:
  53947. move.w objoff_32(a0),y_pos(a0)
  53948. move.w objoff_30(a0),x_pos(a0)
  53949. add.w d1,x_pos(a0)
  53950. move.b #$40,width_pixels(a0)
  53951. move.b #0,objoff_36(a0)
  53952. move.w #SndID_DrawbridgeDown,d0
  53953. jsr (PlaySound).l
  53954. addq.b #2,routine(a0)
  53955. bra.s loc_2A188
  53956. ; ===========================================================================
  53957.  
  53958. loc_2A180:
  53959. move.w objoff_34(a0),d0
  53960. add.w d0,angle(a0)
  53961.  
  53962. loc_2A188:
  53963. bsr.s loc_2A1EA
  53964.  
  53965. loc_2A18A:
  53966. move.w #$13,d1
  53967. move.w #$40,d2
  53968. move.w #$41,d3
  53969. move.b angle(a0),d0
  53970. beq.s loc_2A1A8
  53971. cmpi.b #$40,d0
  53972. beq.s loc_2A1B4
  53973. cmpi.b #-$40,d0
  53974. bhs.s loc_2A1B4
  53975.  
  53976. loc_2A1A8:
  53977. move.w #$4B,d1
  53978. move.w #8,d2
  53979. move.w #9,d3
  53980.  
  53981. loc_2A1B4:
  53982. move.w x_pos(a0),d4
  53983. jsrto (SolidObject).l, JmpTo22_SolidObject
  53984. tst.w (Two_player_mode).w
  53985. beq.s +
  53986. jmpto (DisplaySprite).l, JmpTo26_DisplaySprite
  53987. ; ---------------------------------------------------------------------------
  53988. +
  53989. move.w objoff_30(a0),d0
  53990. andi.w #$FF80,d0
  53991. sub.w (Camera_X_pos_coarse).w,d0
  53992. cmpi.w #$280,d0
  53993. bhi.w +
  53994. jmpto (DisplaySprite).l, JmpTo26_DisplaySprite
  53995. ; ---------------------------------------------------------------------------
  53996. +
  53997. movea.l objoff_3C(a0),a1 ; a1=object
  53998. jsrto (DeleteObject2).l, JmpTo3_DeleteObject2
  53999. jmpto (DeleteObject).l, JmpTo41_DeleteObject
  54000. ; ===========================================================================
  54001.  
  54002. loc_2A1EA:
  54003. tst.b objoff_36(a0)
  54004. beq.s return_2A24C
  54005. moveq #0,d0
  54006. moveq #0,d1
  54007. move.b angle(a0),d0
  54008. jsrto (CalcSine).l, JmpTo9_CalcSine
  54009. move.w objoff_32(a0),d2
  54010. move.w objoff_30(a0),d3
  54011. moveq #0,d6
  54012. movea.l objoff_3C(a0),a1 ; a1=object
  54013. move.b mainspr_childsprites(a1),d6
  54014. subq.w #1,d6
  54015. bcs.s return_2A24C
  54016. swap d0
  54017. swap d1
  54018. asr.l #4,d0
  54019. asr.l #4,d1
  54020. move.l d0,d4
  54021. move.l d1,d5
  54022. lea sub2_x_pos(a1),a2
  54023.  
  54024. - movem.l d4-d5,-(sp)
  54025. swap d4
  54026. swap d5
  54027. add.w d2,d4
  54028. add.w d3,d5
  54029. move.w d5,(a2)+ ; sub?_x_pos
  54030. move.w d4,(a2)+ ; sub?_y_pos
  54031. movem.l (sp)+,d4-d5
  54032. add.l d0,d4
  54033. add.l d1,d5
  54034. addq.w #next_subspr-4,a2
  54035. dbf d6,-
  54036.  
  54037. move.w sub6_x_pos(a1),x_pos(a1)
  54038. move.w sub6_y_pos(a1),y_pos(a1)
  54039.  
  54040. return_2A24C:
  54041. rts
  54042. ; ===========================================================================
  54043. ; ----------------------------------------------------------------------------
  54044. ; sprite mappings
  54045. ; ----------------------------------------------------------------------------
  54046. Obj81_MapUnc_2A24E: BINCLUDE "mappings/sprite/obj81.bin"
  54047. ; ===========================================================================
  54048.  
  54049. if gameRevision<2
  54050. nop
  54051. endif
  54052.  
  54053. if ~~removeJmpTos
  54054. JmpTo2_DisplaySprite3
  54055. jmp (DisplaySprite3).l
  54056. JmpTo26_DisplaySprite
  54057. jmp (DisplaySprite).l
  54058. JmpTo41_DeleteObject
  54059. jmp (DeleteObject).l
  54060. JmpTo3_DeleteObject2
  54061. jmp (DeleteObject2).l
  54062. JmpTo18_SingleObjLoad2
  54063. jmp (SingleObjLoad2).l
  54064. JmpTo45_Adjust2PArtPointer
  54065. jmp (Adjust2PArtPointer).l
  54066. JmpTo9_CalcSine
  54067. jmp (CalcSine).l
  54068. JmpTo22_SolidObject
  54069. jmp (SolidObject).l
  54070.  
  54071. align 4
  54072. endif
  54073.  
  54074.  
  54075.  
  54076.  
  54077. ; ===========================================================================
  54078. ; ----------------------------------------------------------------------------
  54079. ; Object 82 - Platform that is usually swinging, from ARZ
  54080. ; ----------------------------------------------------------------------------
  54081. ; Sprite_2A290:
  54082. Obj82:
  54083. moveq #0,d0
  54084. move.b routine(a0),d0
  54085. move.w Obj82_Index(pc,d0.w),d1
  54086. jmp Obj82_Index(pc,d1.w)
  54087. ; ===========================================================================
  54088. ; off_2A29E:
  54089. Obj82_Index: offsetTable
  54090. offsetTableEntry.w Obj82_Init ; 0
  54091. offsetTableEntry.w Obj82_Main ; 2
  54092. ; ===========================================================================
  54093. ; byte_2A2A2:
  54094. Obj82_Properties:
  54095. ; width_pixels
  54096. ; y_radius
  54097. dc.b $20, 8 ; 0
  54098. dc.b $1C,$30 ; 2
  54099. ; Unused and broken; these don't have an associated frame, so using them crashes the game
  54100. dc.b $10,$10 ; 4
  54101. dc.b $10,$10 ; 6
  54102. ; ===========================================================================
  54103. ; loc_2A2AA:
  54104. Obj82_Init:
  54105. addq.b #2,routine(a0)
  54106. move.l #Obj82_MapUnc_2A476,mappings(a0)
  54107. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  54108. jsrto (Adjust2PArtPointer).l, JmpTo46_Adjust2PArtPointer
  54109. move.b #4,render_flags(a0)
  54110. move.b #3,priority(a0)
  54111. moveq #0,d0
  54112. move.b subtype(a0),d0
  54113. lsr.w #3,d0
  54114. andi.w #$E,d0
  54115. lea Obj82_Properties(pc,d0.w),a2
  54116. move.b (a2)+,width_pixels(a0)
  54117. move.b (a2),y_radius(a0)
  54118. lsr.w #1,d0
  54119. move.b d0,mapping_frame(a0)
  54120. move.w x_pos(a0),objoff_34(a0)
  54121. move.w y_pos(a0),objoff_30(a0)
  54122. move.b subtype(a0),d0
  54123. andi.b #$F,d0
  54124. beq.s +
  54125. cmpi.b #7,d0
  54126. beq.s +
  54127. move.b #1,objoff_38(a0)
  54128. +
  54129. andi.b #$F,subtype(a0)
  54130. ; loc_2A312:
  54131. Obj82_Main:
  54132. move.w x_pos(a0),-(sp)
  54133. moveq #0,d0
  54134. move.b subtype(a0),d0
  54135. add.w d0,d0
  54136. move.w Obj82_Types(pc,d0.w),d1
  54137. jsr Obj82_Types(pc,d1.w)
  54138. move.w (sp)+,d4
  54139. tst.b render_flags(a0)
  54140. bpl.s +
  54141.  
  54142. moveq #0,d1
  54143. move.b width_pixels(a0),d1
  54144. addi.w #$B,d1
  54145. moveq #0,d2
  54146. move.b y_radius(a0),d2
  54147. move.w d2,d3
  54148. addq.w #1,d3
  54149. jsrto (SolidObject).l, JmpTo23_SolidObject
  54150. swap d6
  54151. move.b d6,objoff_3F(a0)
  54152. bsr.w loc_2A432
  54153. +
  54154. move.w objoff_34(a0),d0
  54155. jmpto (MarkObjGone2).l, JmpTo7_MarkObjGone2
  54156. ; ===========================================================================
  54157. ; off_2A358:
  54158. Obj82_Types: offsetTable
  54159. offsetTableEntry.w return_2A368 ; 0
  54160. offsetTableEntry.w loc_2A36A ; 1
  54161. offsetTableEntry.w loc_2A392 ; 2
  54162. offsetTableEntry.w loc_2A36A ; 3
  54163. offsetTableEntry.w loc_2A3B6 ; 4
  54164. offsetTableEntry.w loc_2A3D8 ; 5
  54165. offsetTableEntry.w loc_2A392 ; 6
  54166. offsetTableEntry.w loc_2A3EC ; 7
  54167. ; ===========================================================================
  54168.  
  54169. return_2A368:
  54170. rts
  54171. ; ===========================================================================
  54172.  
  54173. loc_2A36A:
  54174. tst.w objoff_36(a0)
  54175. bne.s loc_2A382
  54176. move.b status(a0),d0
  54177. andi.b #standing_mask,d0
  54178. beq.s return_2A380
  54179. move.w #$1E,objoff_36(a0)
  54180.  
  54181. return_2A380:
  54182. rts
  54183. ; ===========================================================================
  54184.  
  54185. loc_2A382:
  54186. subq.w #1,objoff_36(a0)
  54187. bne.s return_2A380
  54188. addq.b #1,subtype(a0)
  54189. clr.b objoff_38(a0)
  54190. rts
  54191. ; ===========================================================================
  54192.  
  54193. loc_2A392:
  54194. jsrto (ObjectMove).l, JmpTo16_ObjectMove
  54195. addi_.w #8,y_vel(a0)
  54196. jsrto (ObjCheckFloorDist).l, JmpTo2_ObjCheckFloorDist
  54197. tst.w d1
  54198. bpl.w return_2A3B4
  54199. addq.w #1,d1
  54200. add.w d1,y_pos(a0)
  54201. clr.w y_vel(a0)
  54202. clr.b subtype(a0)
  54203.  
  54204. return_2A3B4:
  54205. rts
  54206. ; ===========================================================================
  54207.  
  54208. loc_2A3B6:
  54209. jsrto (ObjectMove).l, JmpTo16_ObjectMove
  54210. subi_.w #8,y_vel(a0)
  54211. jsrto (ObjCheckCeilingDist).l, JmpTo_ObjCheckCeilingDist
  54212. tst.w d1
  54213. bpl.w return_2A3D6
  54214. sub.w d1,y_pos(a0)
  54215. clr.w y_vel(a0)
  54216. clr.b subtype(a0)
  54217.  
  54218. return_2A3D6:
  54219. rts
  54220. ; ===========================================================================
  54221.  
  54222. loc_2A3D8:
  54223. move.b objoff_3F(a0),d0
  54224. andi.b #3,d0
  54225. beq.s return_2A3EA
  54226. addq.b #1,subtype(a0)
  54227. clr.b objoff_38(a0)
  54228.  
  54229. return_2A3EA:
  54230. rts
  54231. ; ===========================================================================
  54232.  
  54233. loc_2A3EC:
  54234. move.w (Water_Level_1).w,d0
  54235. sub.w y_pos(a0),d0
  54236. beq.s return_2A430
  54237. bcc.s loc_2A414
  54238. cmpi.w #-2,d0
  54239. bge.s loc_2A400
  54240. moveq #-2,d0
  54241.  
  54242. loc_2A400:
  54243. add.w d0,y_pos(a0)
  54244. jsrto (ObjCheckCeilingDist).l, JmpTo_ObjCheckCeilingDist
  54245. tst.w d1
  54246. bpl.w return_2A412
  54247. sub.w d1,y_pos(a0)
  54248.  
  54249. return_2A412:
  54250. rts
  54251. ; ===========================================================================
  54252.  
  54253. loc_2A414:
  54254. cmpi.w #2,d0
  54255. ble.s loc_2A41C
  54256. moveq #2,d0
  54257.  
  54258. loc_2A41C:
  54259. add.w d0,y_pos(a0)
  54260. jsrto (ObjCheckFloorDist).l, JmpTo2_ObjCheckFloorDist
  54261. tst.w d1
  54262. bpl.w return_2A430
  54263. addq.w #1,d1
  54264. add.w d1,y_pos(a0)
  54265.  
  54266. return_2A430:
  54267. rts
  54268. ; ===========================================================================
  54269.  
  54270. loc_2A432:
  54271. tst.b objoff_38(a0)
  54272. beq.s return_2A474
  54273. move.b status(a0),d0
  54274. andi.b #standing_mask,d0
  54275. bne.s loc_2A44E
  54276. tst.b objoff_3E(a0)
  54277. beq.s return_2A474
  54278. subq.b #4,objoff_3E(a0)
  54279. bra.s loc_2A45A
  54280. ; ===========================================================================
  54281.  
  54282. loc_2A44E:
  54283. cmpi.b #$40,objoff_3E(a0)
  54284. beq.s return_2A474
  54285. addq.b #4,objoff_3E(a0)
  54286.  
  54287. loc_2A45A:
  54288. move.b objoff_3E(a0),d0
  54289. jsr (CalcSine).l
  54290. move.w #$400,d1
  54291. muls.w d1,d0
  54292. swap d0
  54293. add.w objoff_30(a0),d0
  54294. move.w d0,y_pos(a0)
  54295.  
  54296. return_2A474:
  54297. rts
  54298. ; ===========================================================================
  54299. ; ----------------------------------------------------------------------------
  54300. ; sprite mappings
  54301. ; ----------------------------------------------------------------------------
  54302. Obj82_MapUnc_2A476: BINCLUDE "mappings/sprite/obj82.bin"
  54303. ; ===========================================================================
  54304.  
  54305. if gameRevision<2
  54306. nop
  54307. endif
  54308.  
  54309. if ~~removeJmpTos
  54310. JmpTo2_ObjCheckFloorDist
  54311. jmp (ObjCheckFloorDist).l
  54312. JmpTo46_Adjust2PArtPointer
  54313. jmp (Adjust2PArtPointer).l
  54314. JmpTo_ObjCheckCeilingDist
  54315. jmp (ObjCheckCeilingDist).l
  54316. JmpTo23_SolidObject
  54317. jmp (SolidObject).l
  54318. JmpTo7_MarkObjGone2
  54319. jmp (MarkObjGone2).l
  54320. ; loc_2A4F6:
  54321. JmpTo16_ObjectMove
  54322. jmp (ObjectMove).l
  54323.  
  54324. align 4
  54325. endif
  54326.  
  54327.  
  54328.  
  54329.  
  54330. ; ===========================================================================
  54331. ; ----------------------------------------------------------------------------
  54332. ; Object 83 - 3 adjoined platforms from ARZ that rotate in a circle
  54333. ; ----------------------------------------------------------------------------
  54334. ; OST Variables:
  54335. Obj83_last_x_pos = objoff_2C ; word
  54336. Obj83_speed = objoff_2E ; word
  54337. Obj83_initial_x_pos = objoff_30 ; word
  54338. Obj83_initial_y_pos = objoff_32 ; word
  54339. ; Child object RAM pointers
  54340. Obj83_childobjptr_chains = objoff_34 ; longword ; chain multisprite object
  54341. Obj83_childobjptr_platform2 = objoff_38 ; longword ; 2nd platform object (parent object is 1st platform)
  54342. Obj83_childobjptr_platform3 = objoff_3C ; longword ; 3rd platform object
  54343.  
  54344. ; Sprite_2A4FC:
  54345. Obj83:
  54346. btst #6,render_flags(a0)
  54347. bne.w .isMultispriteObject
  54348. moveq #0,d0
  54349. move.b routine(a0),d0
  54350. move.w Obj83_Index(pc,d0.w),d1
  54351. jmp Obj83_Index(pc,d1.w)
  54352. ; ===========================================================================
  54353. .isMultispriteObject:
  54354. move.w #$280,d0
  54355. jmpto (DisplaySprite3).l, JmpTo3_DisplaySprite3
  54356. ; ===========================================================================
  54357. ; off_2A51C:
  54358. Obj83_Index: offsetTable
  54359. offsetTableEntry.w Obj83_Init ; 0
  54360. offsetTableEntry.w Obj83_Main ; 2
  54361. offsetTableEntry.w Obj83_PlatformSubObject ; 4
  54362. ; ===========================================================================
  54363. ; loc_2A522:
  54364. Obj83_Init:
  54365. addq.b #2,routine(a0)
  54366. move.l #Obj15_Obj83_MapUnc_1021E,mappings(a0)
  54367. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  54368. jsrto (Adjust2PArtPointer).l, JmpTo47_Adjust2PArtPointer
  54369. move.b #4,render_flags(a0)
  54370. move.b #4,priority(a0)
  54371. move.b #$20,width_pixels(a0)
  54372. move.w x_pos(a0),Obj83_initial_x_pos(a0)
  54373. move.w y_pos(a0),Obj83_initial_y_pos(a0)
  54374.  
  54375. ; Setup subtype variables (rotation speed and other unused variable)
  54376. move.b subtype(a0),d1
  54377. move.b d1,d0
  54378. andi.w #$F,d1 ; The lower 4 bits of subtype are unused, making these instructions useless
  54379. andi.b #$F0,d0
  54380. ext.w d0
  54381. asl.w #3,d0
  54382. move.w d0,Obj83_speed(a0)
  54383.  
  54384. ; Set angle according to X-flip and Y-flip
  54385. move.b status(a0),d0
  54386. ror.b #2,d0
  54387. andi.b #$C0,d0
  54388. move.b d0,angle(a0)
  54389.  
  54390. ; Create child object (chain multisprite)
  54391. jsrto (SingleObjLoad2).l, JmpTo19_SingleObjLoad2
  54392. bne.s .noRAMforChildObjects
  54393.  
  54394. _move.b id(a0),id(a1) ; load obj83
  54395. move.l mappings(a0),mappings(a1)
  54396. move.w art_tile(a0),art_tile(a1)
  54397. move.b #4,render_flags(a1)
  54398. bset #6,render_flags(a1)
  54399. move.b #$40,mainspr_width(a1)
  54400. moveq #8,d1
  54401. move.b d1,mainspr_childsprites(a1)
  54402. subq.w #1,d1
  54403. lea sub2_x_pos(a1),a2
  54404.  
  54405. .nextChildSprite:
  54406. addq.w #next_subspr-2,a2
  54407. move.w #1,(a2)+ ; sub?_mapframe
  54408. dbf d1,.nextChildSprite
  54409.  
  54410. move.b #1,mainspr_mapframe(a1)
  54411. move.b #$40,mainspr_height(a1)
  54412. bset #4,render_flags(a1)
  54413. move.l a1,Obj83_childobjptr_chains(a0)
  54414.  
  54415. ; Create remaining child objects: platform 2 and 3
  54416. bsr.s Obj83_LoadSubObject
  54417. move.l a1,Obj83_childobjptr_platform2(a0)
  54418. bsr.s Obj83_LoadSubObject
  54419. move.l a1,Obj83_childobjptr_platform3(a0)
  54420.  
  54421. .noRAMforChildObjects:
  54422. bra.s Obj83_Main
  54423. ; ===========================================================================
  54424. ; loc_2A5DE:
  54425. Obj83_LoadSubObject:
  54426. jsrto (SingleObjLoad2).l, JmpTo19_SingleObjLoad2
  54427. bne.s .noRAMforChildObject ; rts
  54428. addq.b #4,routine(a1)
  54429. _move.b id(a0),id(a1) ; load obj
  54430. move.l mappings(a0),mappings(a1)
  54431. move.w art_tile(a0),art_tile(a1)
  54432. move.b #4,render_flags(a1)
  54433. move.b #4,priority(a1)
  54434. move.b #$20,width_pixels(a1)
  54435. move.w x_pos(a0),Obj83_initial_x_pos(a1)
  54436. move.w y_pos(a0),Obj83_initial_y_pos(a1)
  54437. move.w x_pos(a0),Obj83_last_x_pos(a1)
  54438.  
  54439. .noRAMforChildObject:
  54440. rts
  54441. ; ===========================================================================
  54442. ; loc_2A620:
  54443. Obj83_Main:
  54444. move.w x_pos(a0),-(sp)
  54445. moveq #0,d0
  54446. moveq #0,d1
  54447. move.w Obj83_speed(a0),d0
  54448. add.w d0,angle(a0)
  54449. move.w Obj83_initial_y_pos(a0),d2
  54450. move.w Obj83_initial_x_pos(a0),d3
  54451. moveq #0,d6
  54452. movea.l Obj83_childobjptr_chains(a0),a1 ; a1=object
  54453. lea sub2_x_pos(a1),a2
  54454.  
  54455. ; Update first row of chains
  54456. move.b angle(a0),d0
  54457. jsrto (CalcSine).l, JmpTo10_CalcSine
  54458. swap d0
  54459. swap d1
  54460. asr.l #4,d0
  54461. asr.l #4,d1
  54462. move.l d0,d4
  54463. move.l d1,d5
  54464. swap d4
  54465. swap d5
  54466. add.w d2,d4
  54467. add.w d3,d5
  54468. move.w d5,x_pos(a1) ; update chainlink mainsprite x_pos
  54469. move.w d4,y_pos(a1) ; update chainlink mainsprite y_pos
  54470. move.l d0,d4
  54471. move.l d1,d5
  54472. add.l d0,d4
  54473. add.l d1,d5
  54474. moveq #1,d6 ; Update 2 chainlink childsprites (the third chainlink is the mainsprite, which has already been updated)
  54475. bsr.w Obj83_UpdateChainSpritePosition
  54476. swap d4
  54477. swap d5
  54478. add.w d2,d4
  54479. add.w d3,d5
  54480. move.w d5,x_pos(a0)
  54481. move.w d4,y_pos(a0)
  54482.  
  54483. ; Update second row of chains
  54484. move.b angle(a0),d0
  54485. addi.b #256/3,d0 ; 360 degrees = 256
  54486. jsrto (CalcSine).l, JmpTo10_CalcSine
  54487. swap d0
  54488. swap d1
  54489. asr.l #4,d0
  54490. asr.l #4,d1
  54491. move.l d0,d4
  54492. move.l d1,d5
  54493. moveq #2,d6 ; Update 3 chainlink childsprites
  54494. bsr.w Obj83_UpdateChainSpritePosition
  54495. swap d4
  54496. swap d5
  54497. add.w d2,d4
  54498. add.w d3,d5
  54499. movea.l Obj83_childobjptr_platform2(a0),a1 ; a1=object
  54500. move.w d5,x_pos(a1)
  54501. move.w d4,y_pos(a1)
  54502.  
  54503. ; Update third row of chains
  54504. move.b angle(a0),d0
  54505. subi.b #256/3,d0 ; 360 degrees = 256
  54506. jsrto (CalcSine).l, JmpTo10_CalcSine
  54507. swap d0
  54508. swap d1
  54509. asr.l #4,d0
  54510. asr.l #4,d1
  54511. move.l d0,d4
  54512. move.l d1,d5
  54513. moveq #2,d6 ; Update 3 chainlink childsprites
  54514. bsr.w Obj83_UpdateChainSpritePosition
  54515. swap d4
  54516. swap d5
  54517. add.w d2,d4
  54518. add.w d3,d5
  54519. movea.l Obj83_childobjptr_platform3(a0),a1 ; a1=object
  54520. move.w d5,x_pos(a1)
  54521. move.w d4,y_pos(a1)
  54522.  
  54523. moveq #0,d1
  54524. move.b width_pixels(a0),d1
  54525. addi.w #$B,d1
  54526. move.w #8,d2
  54527. move.w #9,d3
  54528. move.w (sp)+,d4
  54529. jsrto (PlatformObject).l, JmpTo7_PlatformObject
  54530. tst.w (Two_player_mode).w
  54531. beq.s .notTwoPlayerMode
  54532. jmpto (DisplaySprite).l, JmpTo27_DisplaySprite
  54533. ; ===========================================================================
  54534. .notTwoPlayerMode:
  54535. move.w Obj83_initial_x_pos(a0),d0
  54536. andi.w #$FF80,d0
  54537. sub.w (Camera_X_pos_coarse).w,d0
  54538. cmpi.w #$280,d0
  54539. bhi.w .objectOffscreen
  54540. jmpto (DisplaySprite).l, JmpTo27_DisplaySprite
  54541. ; ===========================================================================
  54542. .objectOffscreen:
  54543. movea.l Obj83_childobjptr_chains(a0),a1 ; a1=object
  54544. jsrto (DeleteObject2).l, JmpTo4_DeleteObject2
  54545. jmpto (DeleteObject).l, JmpTo42_DeleteObject
  54546. ; ===========================================================================
  54547. ; loc_2A72E:
  54548. Obj83_UpdateChainSpritePosition:
  54549. .nextChainSprite:
  54550. movem.l d4-d5,-(sp)
  54551. swap d4
  54552. swap d5
  54553. add.w d2,d4
  54554. add.w d3,d5
  54555. move.w d5,(a2)+ ; sub?_x_pos
  54556. move.w d4,(a2)+ ; sub?_y_pos
  54557. movem.l (sp)+,d4-d5
  54558. add.l d0,d4
  54559. add.l d1,d5
  54560. addq.w #next_subspr-4,a2
  54561. dbf d6,.nextChainSprite
  54562. rts
  54563. ; ===========================================================================
  54564. ; loc_2A74E: Obj83_SubObject:
  54565. Obj83_PlatformSubObject:
  54566. moveq #0,d1
  54567. move.b width_pixels(a0),d1
  54568. addi.w #$B,d1
  54569. move.w #8,d2
  54570. move.w #9,d3
  54571. move.w Obj83_last_x_pos(a0),d4
  54572. jsrto (PlatformObject).l, JmpTo7_PlatformObject
  54573. move.w x_pos(a0),Obj83_last_x_pos(a0)
  54574. move.w Obj83_initial_x_pos(a0),d0
  54575. jmpto (MarkObjGone2).l, JmpTo8_MarkObjGone2
  54576. ; ===========================================================================
  54577.  
  54578. if gameRevision<2
  54579. nop
  54580. endif
  54581.  
  54582. if ~~removeJmpTos
  54583. JmpTo3_DisplaySprite3
  54584. jmp (DisplaySprite3).l
  54585. JmpTo27_DisplaySprite
  54586. jmp (DisplaySprite).l
  54587. JmpTo42_DeleteObject
  54588. jmp (DeleteObject).l
  54589. JmpTo4_DeleteObject2
  54590. jmp (DeleteObject2).l
  54591. JmpTo19_SingleObjLoad2
  54592. jmp (SingleObjLoad2).l
  54593. JmpTo47_Adjust2PArtPointer
  54594. jmp (Adjust2PArtPointer).l
  54595. JmpTo10_CalcSine
  54596. jmp (CalcSine).l
  54597. JmpTo7_PlatformObject
  54598. jmp (PlatformObject).l
  54599. JmpTo8_MarkObjGone2
  54600. jmp (MarkObjGone2).l
  54601.  
  54602. align 4
  54603. endif
  54604.  
  54605.  
  54606.  
  54607.  
  54608. ; ===========================================================================
  54609. ; ----------------------------------------------------------------------------
  54610. ; Object 3F - Fan from OOZ
  54611. ; ----------------------------------------------------------------------------
  54612. ; Sprite_2A7B0:
  54613. Obj3F:
  54614. moveq #0,d0
  54615. move.b routine(a0),d0
  54616. move.w Obj3F_Index(pc,d0.w),d1
  54617. jmp Obj3F_Index(pc,d1.w)
  54618. ; ===========================================================================
  54619. ; off_2A7BE:
  54620. Obj3F_Index: offsetTable
  54621. offsetTableEntry.w Obj3F_Init ; 0
  54622. offsetTableEntry.w Obj3F_Horizontal ; 2 - pushes horizontally
  54623. offsetTableEntry.w Obj3F_Vertical ; 4 - pushes vertically
  54624. ; ===========================================================================
  54625. ; loc_2A7C4:
  54626. Obj3F_Init:
  54627. addq.b #2,routine(a0)
  54628. move.l #Obj3F_MapUnc_2AA12,mappings(a0)
  54629. move.w #make_art_tile(ArtTile_ArtNem_OOZFanHoriz,3,0),art_tile(a0)
  54630. jsrto (Adjust2PArtPointer).l, JmpTo48_Adjust2PArtPointer
  54631. ori.b #4,render_flags(a0)
  54632. move.b #$10,width_pixels(a0)
  54633. move.b #4,priority(a0)
  54634. tst.b subtype(a0)
  54635. bpl.s Obj3F_Horizontal
  54636. addq.b #2,routine(a0)
  54637. move.l #Obj3F_MapUnc_2AAC4,mappings(a0)
  54638. bra.w Obj3F_Vertical
  54639. ; ===========================================================================
  54640. ; loc_2A802:
  54641. Obj3F_Horizontal:
  54642. btst #1,subtype(a0)
  54643. bne.s loc_2A82A
  54644. subq.w #1,objoff_30(a0)
  54645. bpl.s loc_2A82A
  54646. move.w #0,objoff_34(a0)
  54647. move.w #$78,objoff_30(a0)
  54648. bchg #0,objoff_32(a0)
  54649. beq.s loc_2A82A
  54650. move.w #$B4,objoff_30(a0)
  54651.  
  54652. loc_2A82A:
  54653. tst.b objoff_32(a0)
  54654. beq.w loc_2A84E
  54655. subq.b #1,anim_frame_duration(a0)
  54656. bpl.s BranchTo_JmpTo26_MarkObjGone
  54657. cmpi.w #$400,objoff_34(a0)
  54658. bhs.s BranchTo_JmpTo26_MarkObjGone
  54659. addi.w #$2A,objoff_34(a0)
  54660. move.b objoff_34(a0),anim_frame_duration(a0)
  54661. bra.s loc_2A86A
  54662. ; ===========================================================================
  54663.  
  54664. loc_2A84E:
  54665. lea (MainCharacter).w,a1 ; a1=character
  54666. bsr.w loc_2A894
  54667. lea (Sidekick).w,a1 ; a1=character
  54668. bsr.w loc_2A894
  54669. subq.b #1,anim_frame_duration(a0)
  54670. bpl.s BranchTo_JmpTo26_MarkObjGone
  54671. move.b #0,anim_frame_duration(a0)
  54672.  
  54673. loc_2A86A:
  54674. addq.b #1,anim_frame(a0)
  54675. cmpi.b #6,anim_frame(a0)
  54676. blo.s loc_2A87C
  54677. move.b #0,anim_frame(a0)
  54678.  
  54679. loc_2A87C:
  54680. moveq #0,d0
  54681. btst #0,subtype(a0)
  54682. beq.s loc_2A888
  54683. moveq #5,d0
  54684.  
  54685. loc_2A888:
  54686. add.b anim_frame(a0),d0
  54687. move.b d0,mapping_frame(a0)
  54688.  
  54689. BranchTo_JmpTo26_MarkObjGone
  54690. jmpto (MarkObjGone).l, JmpTo26_MarkObjGone
  54691. ; ===========================================================================
  54692.  
  54693. loc_2A894:
  54694. cmpi.b #4,routine(a1)
  54695. bhs.s return_2A8FC
  54696. tst.b obj_control(a1)
  54697. bne.s return_2A8FC
  54698. move.w x_pos(a1),d0
  54699. sub.w x_pos(a0),d0
  54700. btst #0,status(a0)
  54701. bne.s loc_2A8B4
  54702. neg.w d0
  54703.  
  54704. loc_2A8B4:
  54705. addi.w #$50,d0
  54706. cmpi.w #$F0,d0
  54707. bhs.s return_2A8FC
  54708. move.w y_pos(a1),d1
  54709. addi.w #$60,d1
  54710. sub.w y_pos(a0),d1
  54711. bcs.s return_2A8FC
  54712. cmpi.w #$70,d1
  54713. bhs.s return_2A8FC
  54714. subi.w #$50,d0
  54715. bcc.s loc_2A8DC
  54716. not.w d0
  54717. add.w d0,d0
  54718.  
  54719. loc_2A8DC:
  54720. addi.w #$60,d0
  54721. btst #0,status(a0)
  54722. bne.s loc_2A8EA
  54723. neg.w d0
  54724.  
  54725. loc_2A8EA:
  54726. neg.b d0
  54727. asr.w #4,d0
  54728. btst #0,subtype(a0)
  54729. beq.s loc_2A8F8
  54730. neg.w d0
  54731.  
  54732. loc_2A8F8:
  54733. add.w d0,x_pos(a1)
  54734.  
  54735. return_2A8FC:
  54736. rts
  54737. ; ===========================================================================
  54738. ; loc_2A8FE:
  54739. Obj3F_Vertical:
  54740. btst #1,subtype(a0)
  54741. bne.s loc_2A926
  54742. subq.w #1,objoff_30(a0)
  54743. bpl.s loc_2A926
  54744. move.w #0,objoff_34(a0)
  54745. move.w #$78,objoff_30(a0)
  54746. bchg #0,objoff_32(a0)
  54747. beq.s loc_2A926
  54748. move.w #$B4,objoff_30(a0)
  54749.  
  54750. loc_2A926:
  54751. tst.b objoff_32(a0)
  54752. beq.w loc_2A94A
  54753. subq.b #1,anim_frame_duration(a0)
  54754. bpl.s BranchTo2_JmpTo26_MarkObjGone
  54755. cmpi.w #$400,objoff_34(a0)
  54756. bhs.s BranchTo2_JmpTo26_MarkObjGone
  54757. addi.w #$2A,objoff_34(a0)
  54758. move.b objoff_34(a0),anim_frame_duration(a0)
  54759. bra.s loc_2A966
  54760. ; ===========================================================================
  54761.  
  54762. loc_2A94A:
  54763. lea (MainCharacter).w,a1 ; a1=character
  54764. bsr.w loc_2A990
  54765. lea (Sidekick).w,a1 ; a1=character
  54766. bsr.w loc_2A990
  54767. subq.b #1,anim_frame_duration(a0)
  54768. bpl.s BranchTo2_JmpTo26_MarkObjGone
  54769. move.b #0,anim_frame_duration(a0)
  54770.  
  54771. loc_2A966:
  54772. addq.b #1,anim_frame(a0)
  54773. cmpi.b #6,anim_frame(a0)
  54774. blo.s +
  54775. move.b #0,anim_frame(a0)
  54776. +
  54777. moveq #0,d0
  54778. btst #0,subtype(a0)
  54779. beq.s +
  54780. moveq #5,d0
  54781. +
  54782. add.b anim_frame(a0),d0
  54783. move.b d0,mapping_frame(a0)
  54784.  
  54785. BranchTo2_JmpTo26_MarkObjGone
  54786. jmpto (MarkObjGone).l, JmpTo26_MarkObjGone
  54787. ; ===========================================================================
  54788.  
  54789. loc_2A990:
  54790. cmpi.b #4,routine(a1)
  54791. bhs.s return_2AA10
  54792. tst.b obj_control(a1)
  54793. bne.s return_2AA10
  54794. move.w x_pos(a1),d0
  54795. sub.w x_pos(a0),d0
  54796. addi.w #$40,d0
  54797. cmpi.w #$80,d0
  54798. bhs.s return_2AA10
  54799. moveq #0,d1
  54800. move.b (Oscillating_Data+$14).w,d1
  54801. add.w y_pos(a1),d1
  54802. addi.w #$60,d1
  54803. sub.w y_pos(a0),d1
  54804. bcs.s return_2AA10
  54805. cmpi.w #$90,d1
  54806. bhs.s return_2AA10
  54807. subi.w #$60,d1
  54808. bcs.s +
  54809. not.w d1
  54810. add.w d1,d1
  54811. +
  54812. addi.w #$60,d1
  54813. neg.w d1
  54814. asr.w #4,d1
  54815. add.w d1,y_pos(a1)
  54816. bset #1,status(a1)
  54817. move.w #0,y_vel(a1)
  54818. move.w #1,inertia(a1)
  54819. tst.b flip_angle(a1)
  54820. bne.s return_2AA10
  54821. move.b #1,flip_angle(a1)
  54822. move.b #AniIDSonAni_Walk,anim(a1)
  54823. move.b #$7F,flips_remaining(a1)
  54824. move.b #8,flip_speed(a1)
  54825.  
  54826. return_2AA10:
  54827. rts
  54828. ; ===========================================================================
  54829. ; ----------------------------------------------------------------------------
  54830. ; sprite mappings
  54831. ; ----------------------------------------------------------------------------
  54832. ; sidefacing fan
  54833. Obj3F_MapUnc_2AA12: BINCLUDE "mappings/sprite/obj3F_a.bin"
  54834. ; upfacing fan
  54835. Obj3F_MapUnc_2AAC4: BINCLUDE "mappings/sprite/obj3F_b.bin"
  54836. ; ===========================================================================
  54837.  
  54838. if gameRevision<2
  54839. nop
  54840. endif
  54841.  
  54842. if ~~removeJmpTos
  54843. JmpTo26_MarkObjGone
  54844. jmp (MarkObjGone).l
  54845. JmpTo48_Adjust2PArtPointer
  54846. jmp (Adjust2PArtPointer).l
  54847.  
  54848. align 4
  54849. endif
  54850.  
  54851.  
  54852.  
  54853.  
  54854. ; ===========================================================================
  54855. ; ----------------------------------------------------------------------------
  54856. ; Object 85 - Spring from CNZ that you hold jump on to pull back further
  54857. ; ----------------------------------------------------------------------------
  54858. ; Sprite_2AB84:
  54859. Obj85:
  54860. moveq #0,d0
  54861. move.b routine(a0),d0
  54862. move.w Obj85_Index(pc,d0.w),d1
  54863. jsr Obj85_Index(pc,d1.w)
  54864. move.w #$200,d0
  54865. tst.w (Two_player_mode).w
  54866. beq.s +
  54867. jmpto (DisplaySprite3).l, JmpTo4_DisplaySprite3
  54868. ; ===========================================================================
  54869. +
  54870. move.w x_pos(a0),d1
  54871. andi.w #$FF80,d1
  54872. sub.w (Camera_X_pos_coarse).w,d1
  54873. cmpi.w #$280,d1
  54874. bhi.w +
  54875. jmpto (DisplaySprite3).l, JmpTo4_DisplaySprite3
  54876. ; ===========================================================================
  54877. +
  54878. lea (Object_Respawn_Table).w,a2
  54879. moveq #0,d0
  54880. move.b respawn_index(a0),d0
  54881. beq.s BranchTo_JmpTo43_DeleteObject
  54882. bclr #7,2(a2,d0.w)
  54883.  
  54884. BranchTo_JmpTo43_DeleteObject
  54885. jmpto (DeleteObject).l, JmpTo43_DeleteObject
  54886. ; ===========================================================================
  54887. ; off_2ABCE:
  54888. Obj85_Index: offsetTable
  54889. offsetTableEntry.w Obj85_Init ; 0
  54890. offsetTableEntry.w Obj85_Up ; 2
  54891. offsetTableEntry.w Obj85_Diagonal ; 4
  54892. ; ===========================================================================
  54893. ; loc_2ABD4:
  54894. Obj85_Init:
  54895. addq.b #2,routine(a0)
  54896. move.l #Obj85_MapUnc_2B07E,mappings(a0)
  54897. move.w #make_art_tile(ArtTile_ArtNem_CNZVertPlunger,0,0),art_tile(a0)
  54898. tst.b subtype(a0)
  54899. beq.s +
  54900. move.l #Obj85_MapUnc_2B0EC,mappings(a0)
  54901. move.w #make_art_tile(ArtTile_ArtNem_CNZDiagPlunger,0,0),art_tile(a0)
  54902. +
  54903. jsrto (Adjust2PArtPointer).l, JmpTo49_Adjust2PArtPointer
  54904. move.b #4,render_flags(a0)
  54905. bset #6,render_flags(a0)
  54906. move.b #1,mainspr_mapframe(a0)
  54907. tst.b subtype(a0)
  54908. beq.s Obj85_Init_Up
  54909. addq.b #2,routine(a0)
  54910. move.b #$20,mainspr_width(a0)
  54911. move.b #$18,width_pixels(a0)
  54912. move.w x_pos(a0),objoff_2E(a0)
  54913. move.w y_pos(a0),objoff_34(a0)
  54914. move.w x_pos(a0),d2
  54915. move.w y_pos(a0),d3
  54916. addi.w #0,d3
  54917. move.b #1,mainspr_childsprites(a0)
  54918. lea sub2_x_pos(a0),a2
  54919. move.w d2,(a2)+ ; sub2_x_pos
  54920. move.w d3,(a2)+ ; sub2_y_pos
  54921. move.w #2,(a2)+ ; sub2_mapframe
  54922. bra.w Obj85_Diagonal
  54923. ; ===========================================================================
  54924. ; loc_2AC54:
  54925. Obj85_Init_Up:
  54926. move.b #$18,mainspr_width(a0)
  54927. move.b #$18,width_pixels(a0)
  54928. move.w y_pos(a0),objoff_34(a0)
  54929. move.w x_pos(a0),d2
  54930. move.w y_pos(a0),d3
  54931. addi.w #$20,d3
  54932. move.b #1,mainspr_childsprites(a0)
  54933. lea sub2_x_pos(a0),a2
  54934. move.w d2,(a2)+ ; sub2_x_pos
  54935. move.w d3,(a2)+ ; sub2_y_pos
  54936. move.w #2,(a2)+ ; sub2_mapframe
  54937. ; loc_2AC84:
  54938. Obj85_Up:
  54939. move.b #0,objoff_3A(a0)
  54940. move.w objoff_34(a0),d0
  54941. add.w objoff_38(a0),d0
  54942. move.w d0,y_pos(a0)
  54943. move.b #2,sub2_mapframe(a0)
  54944. cmpi.w #$10,objoff_38(a0)
  54945. blo.s +
  54946. move.b #3,sub2_mapframe(a0)
  54947. +
  54948. move.w #$23,d1
  54949. move.w #$20,d2
  54950. move.w #$1D,d3
  54951. move.w x_pos(a0),d4
  54952. lea objoff_36(a0),a2
  54953. lea (MainCharacter).w,a1 ; a1=character
  54954. move.w (Ctrl_1_Logical).w,d5
  54955. moveq #p1_standing_bit,d6
  54956. movem.l d1-d4,-(sp)
  54957. bsr.s loc_2AD26
  54958. movem.l (sp)+,d1-d4
  54959. lea (Sidekick).w,a1 ; a1=character
  54960. addq.w #1,a2
  54961. move.w (Ctrl_2).w,d5
  54962. moveq #p2_standing_bit,d6
  54963. bsr.s loc_2AD26
  54964. tst.w objoff_36(a0)
  54965. beq.s loc_2AD14
  54966. tst.w objoff_38(a0)
  54967. beq.s return_2AD24
  54968. moveq #0,d0
  54969. cmpi.b #1,objoff_36(a0)
  54970. bne.s +
  54971. or.w (Ctrl_1_Logical).w,d0
  54972. +
  54973. cmpi.b #1,objoff_37(a0)
  54974. bne.s +
  54975. or.w (Ctrl_2).w,d0
  54976. +
  54977. andi.w #(button_B_mask|button_C_mask|button_A_mask)<<8,d0
  54978. bne.s return_2AD24
  54979. move.w #$202,objoff_36(a0)
  54980. rts
  54981. ; ===========================================================================
  54982.  
  54983. loc_2AD14:
  54984. move.b #1,mainspr_mapframe(a0)
  54985. subq.w #4,objoff_38(a0)
  54986. bcc.s return_2AD24
  54987. clr.w objoff_38(a0)
  54988.  
  54989. return_2AD24:
  54990. rts
  54991. ; ===========================================================================
  54992.  
  54993. loc_2AD26:
  54994. move.b (a2),d0
  54995. bne.s loc_2AD7A
  54996.  
  54997. loc_2AD2A:
  54998. tst.w (Debug_placement_mode).w
  54999. bne.s return_2AD78
  55000. tst.w y_vel(a1)
  55001. bmi.s return_2AD78
  55002. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo5_SolidObject_Always_SingleCharacter
  55003. btst d6,status(a0)
  55004. beq.s return_2AD78
  55005. move.b #$81,obj_control(a1)
  55006. move.w x_pos(a0),x_pos(a1)
  55007. move.w #0,x_vel(a1)
  55008. move.w #0,y_vel(a1)
  55009. move.w #0,inertia(a1)
  55010. bset #2,status(a1)
  55011. move.b #$E,y_radius(a1)
  55012. move.b #7,x_radius(a1)
  55013. move.b #AniIDSonAni_Roll,anim(a1)
  55014. addq.b #1,(a2)
  55015.  
  55016. return_2AD78:
  55017. rts
  55018. ; ===========================================================================
  55019.  
  55020. loc_2AD7A:
  55021. if gameRevision>0
  55022. cmpi.b #4,routine(a1)
  55023. bhs.s return_2AD78
  55024. endif
  55025. subq.b #1,d0
  55026. bne.w loc_2AE0C
  55027. tst.b render_flags(a1)
  55028. bmi.s loc_2ADB0
  55029. bclr d6,status(a0)
  55030. bset #1,status(a1)
  55031. bclr #3,status(a1)
  55032. move.b #2,routine(a1)
  55033. move.b #0,obj_control(a1)
  55034. move.b #0,(a2)
  55035. rts
  55036. ; ===========================================================================
  55037.  
  55038. loc_2ADB0:
  55039. andi.w #(button_B_mask|button_C_mask|button_A_mask)<<8,d5
  55040. beq.s loc_2ADFE
  55041. tst.b objoff_3A(a0)
  55042. bne.s loc_2ADFE
  55043. move.b #1,objoff_3A(a0)
  55044. subq.b #1,objoff_32(a0)
  55045. bpl.s loc_2ADDA
  55046. move.b #3,objoff_32(a0)
  55047. cmpi.w #$20,objoff_38(a0)
  55048. beq.s loc_2ADDA
  55049. addq.w #1,objoff_38(a0)
  55050.  
  55051. loc_2ADDA:
  55052. subq.b #1,objoff_33(a0)
  55053. bpl.s loc_2ADF8
  55054. move.w objoff_38(a0),d0
  55055. subi.w #$20,d0
  55056. neg.w d0
  55057. lsr.w #1,d0
  55058. move.b d0,objoff_33(a0)
  55059. bchg #2,mainspr_mapframe(a0)
  55060. bra.s loc_2ADFE
  55061. ; ===========================================================================
  55062.  
  55063. loc_2ADF8:
  55064. move.b #1,mainspr_mapframe(a0)
  55065.  
  55066. loc_2ADFE:
  55067. move.w y_pos(a0),d0
  55068. subi.w #$2E,d0
  55069. move.w d0,y_pos(a1)
  55070. rts
  55071. ; ===========================================================================
  55072.  
  55073. loc_2AE0C:
  55074. move.b #0,(a2)
  55075. bclr d6,status(a0)
  55076. beq.w loc_2AD2A
  55077. move.w objoff_38(a0),d0
  55078. addi.w #$10,d0
  55079. lsl.w #7,d0
  55080. neg.w d0
  55081. move.w d0,y_vel(a1)
  55082. move.w #0,x_vel(a1)
  55083. move.w #$800,inertia(a1)
  55084. bset #1,status(a1)
  55085. bclr #3,status(a1)
  55086. move.b #2,routine(a1)
  55087. move.b #0,obj_control(a1)
  55088. move.w #SndID_CNZLaunch,d0
  55089. jmp (PlaySound).l
  55090. ; ===========================================================================
  55091. ; loc_2AE56:
  55092. Obj85_Diagonal:
  55093. move.b #0,objoff_3A(a0)
  55094. move.w objoff_38(a0),d1
  55095. lsr.w #1,d1
  55096. move.w objoff_2E(a0),d0
  55097. sub.w d1,d0
  55098. move.w d0,x_pos(a0)
  55099. move.w objoff_34(a0),d0
  55100. add.w d1,d0
  55101. move.w d0,y_pos(a0)
  55102. move.b #2,sub2_mapframe(a0)
  55103. cmpi.w #$10,objoff_38(a0)
  55104. blo.s +
  55105. move.b #3,sub2_mapframe(a0)
  55106. +
  55107. move.w #$23,d1
  55108. move.w #8,d2
  55109. move.w #5,d3
  55110. move.w x_pos(a0),d4
  55111. lea objoff_36(a0),a2
  55112. lea (MainCharacter).w,a1 ; a1=character
  55113. move.w (Ctrl_1_Logical).w,d5
  55114. moveq #p1_standing_bit,d6
  55115. movem.l d1-d4,-(sp)
  55116. bsr.s loc_2AF06
  55117. movem.l (sp)+,d1-d4
  55118. lea (Sidekick).w,a1 ; a1=character
  55119. addq.w #1,a2
  55120. move.w (Ctrl_2).w,d5
  55121. moveq #p2_standing_bit,d6
  55122. bsr.s loc_2AF06
  55123. tst.w objoff_36(a0)
  55124. beq.s loc_2AEF4
  55125. tst.w objoff_38(a0)
  55126. beq.s return_2AF04
  55127. moveq #0,d0
  55128. cmpi.b #1,objoff_36(a0)
  55129. bne.s +
  55130. or.w (Ctrl_1_Logical).w,d0
  55131. +
  55132. cmpi.b #1,objoff_37(a0)
  55133. bne.s +
  55134. or.w (Ctrl_2).w,d0
  55135. +
  55136. andi.w #(button_B_mask|button_C_mask|button_A_mask)<<8,d0
  55137. bne.s return_2AF04
  55138. move.w #$202,objoff_36(a0)
  55139. rts
  55140. ; ===========================================================================
  55141.  
  55142. loc_2AEF4:
  55143. move.b #1,mainspr_mapframe(a0)
  55144. subq.w #4,objoff_38(a0)
  55145. bcc.s return_2AF04
  55146. clr.w objoff_38(a0)
  55147.  
  55148. return_2AF04:
  55149. rts
  55150. ; ===========================================================================
  55151.  
  55152. loc_2AF06:
  55153. move.b (a2),d0
  55154. bne.s loc_2AF7A
  55155. tst.w (Debug_placement_mode).w
  55156. bne.s return_2AF78
  55157. tst.w y_vel(a1)
  55158. bmi.s return_2AF78
  55159. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo5_SolidObject_Always_SingleCharacter
  55160. btst d6,status(a0)
  55161. bne.s loc_2AF2E
  55162. move.b d6,d0
  55163. addq.b #pushing_bit_delta,d0
  55164. btst d0,status(a0)
  55165. beq.s return_2AF78
  55166. bset d6,status(a0)
  55167.  
  55168. loc_2AF2E:
  55169. move.b #$81,obj_control(a1)
  55170. move.w x_pos(a0),x_pos(a1)
  55171. addi.w #$13,x_pos(a1)
  55172. move.w y_pos(a0),y_pos(a1)
  55173. subi.w #$13,y_pos(a1)
  55174. move.w #0,x_vel(a1)
  55175. move.w #0,y_vel(a1)
  55176. move.w #0,inertia(a1)
  55177. bset #2,status(a1)
  55178. move.b #$E,y_radius(a1)
  55179. move.b #7,x_radius(a1)
  55180. move.b #AniIDSonAni_Roll,anim(a1)
  55181. addq.b #1,(a2)
  55182.  
  55183. return_2AF78:
  55184. rts
  55185. ; ===========================================================================
  55186.  
  55187. loc_2AF7A:
  55188. if gameRevision>0
  55189. cmpi.b #4,routine(a1)
  55190. bhs.s return_2AF78
  55191. endif
  55192. subq.b #1,d0
  55193. bne.w loc_2B018
  55194. tst.b render_flags(a1)
  55195. bmi.s loc_2AFB0
  55196. bclr d6,status(a0)
  55197. bset #1,status(a1)
  55198. bclr #3,status(a1)
  55199. move.b #2,routine(a1)
  55200. move.b #0,obj_control(a1)
  55201. move.b #0,(a2)
  55202. rts
  55203. ; ===========================================================================
  55204.  
  55205. loc_2AFB0:
  55206. andi.w #(button_B_mask|button_C_mask|button_A_mask)<<8,d5
  55207. beq.s loc_2AFFE
  55208. tst.b objoff_3A(a0)
  55209. bne.s loc_2AFFE
  55210. move.b #1,objoff_3A(a0)
  55211. subq.b #1,objoff_32(a0)
  55212. bpl.s loc_2AFDA
  55213. move.b #3,objoff_32(a0)
  55214. cmpi.w #$1C,objoff_38(a0)
  55215. beq.s loc_2AFDA
  55216. addq.w #1,objoff_38(a0)
  55217.  
  55218. loc_2AFDA:
  55219. subq.b #1,objoff_33(a0)
  55220. bpl.s loc_2AFF8
  55221. move.w objoff_38(a0),d0
  55222. subi.w #$1C,d0
  55223. neg.w d0
  55224. lsr.w #1,d0
  55225. move.b d0,objoff_33(a0)
  55226. bchg #2,mainspr_mapframe(a0)
  55227. bra.s loc_2AFFE
  55228. ; ===========================================================================
  55229.  
  55230. loc_2AFF8:
  55231. move.b #1,mainspr_mapframe(a0)
  55232.  
  55233. loc_2AFFE:
  55234. move.w x_pos(a0),d0
  55235. addi.w #$13,d0
  55236. move.w d0,x_pos(a1)
  55237. move.w y_pos(a0),d0
  55238. subi.w #$13,d0
  55239. move.w d0,y_pos(a1)
  55240. rts
  55241. ; ===========================================================================
  55242.  
  55243. loc_2B018:
  55244. move.b #0,(a2)
  55245. bclr d6,status(a0)
  55246. beq.w return_2AF78
  55247. move.w objoff_38(a0),d0
  55248. addi_.w #4,d0
  55249. lsl.w #7,d0
  55250. move.w d0,x_vel(a1)
  55251. neg.w d0
  55252. move.w d0,y_vel(a1)
  55253. move.w #$800,inertia(a1)
  55254. bset #1,status(a1)
  55255. bclr #3,status(a1)
  55256. tst.b subtype(a0)
  55257. bpl.s loc_2B068
  55258. neg.w d0
  55259. move.w d0,inertia(a1)
  55260. bclr #0,status(a1)
  55261. bclr #1,status(a1)
  55262. move.b #-$20,angle(a1)
  55263.  
  55264. loc_2B068:
  55265. move.b #2,routine(a1)
  55266. move.b #0,obj_control(a1)
  55267. move.w #SndID_CNZLaunch,d0
  55268. jmp (PlaySound).l
  55269. ; ===========================================================================
  55270. ; ----------------------------------------------------------------------------
  55271. ; sprite mappings
  55272. ; ----------------------------------------------------------------------------
  55273. Obj85_MapUnc_2B07E: BINCLUDE "mappings/sprite/obj85_a.bin"
  55274. Obj85_MapUnc_2B0EC: BINCLUDE "mappings/sprite/obj85_b.bin"
  55275. ; ===========================================================================
  55276.  
  55277. if ~~removeJmpTos
  55278. JmpTo4_DisplaySprite3
  55279. jmp (DisplaySprite3).l
  55280. JmpTo43_DeleteObject
  55281. jmp (DeleteObject).l
  55282. JmpTo49_Adjust2PArtPointer
  55283. jmp (Adjust2PArtPointer).l
  55284. JmpTo5_SolidObject_Always_SingleCharacter
  55285. jmp (SolidObject_Always_SingleCharacter).l
  55286.  
  55287. align 4
  55288. endif
  55289.  
  55290.  
  55291.  
  55292.  
  55293. ; ===========================================================================
  55294. ; ----------------------------------------------------------------------------
  55295. ; Object 86 - Flipper from CNZ
  55296. ; ----------------------------------------------------------------------------
  55297. ; Sprite_2B140:
  55298. Obj86:
  55299. moveq #0,d0
  55300. move.b routine(a0),d0
  55301. move.w Obj86_Index(pc,d0.w),d1
  55302. jsr Obj86_Index(pc,d1.w)
  55303. jmpto (MarkObjGone).l, JmpTo27_MarkObjGone
  55304. ; ===========================================================================
  55305. ; off_2B152:
  55306. Obj86_Index: offsetTable
  55307. offsetTableEntry.w Obj86_Init ; 0
  55308. offsetTableEntry.w Obj86_UpwardsType ; 2 - sends you upwards
  55309. offsetTableEntry.w Obj86_HorizontalType ; 4 - sends you leftward/rightward
  55310. ; ===========================================================================
  55311. ; loc_2B158:
  55312. Obj86_Init:
  55313. addq.b #2,routine(a0)
  55314. move.l #Obj86_MapUnc_2B45A,mappings(a0)
  55315. move.w #make_art_tile(ArtTile_ArtNem_CNZFlipper,2,0),art_tile(a0)
  55316. jsrto (Adjust2PArtPointer).l, JmpTo50_Adjust2PArtPointer
  55317. ori.b #4,render_flags(a0)
  55318. move.b #$18,width_pixels(a0)
  55319. move.b #4,priority(a0)
  55320. tst.b subtype(a0)
  55321. beq.s Obj86_UpwardsType
  55322. addq.b #2,routine(a0)
  55323. move.b #2,anim(a0)
  55324. bra.w Obj86_HorizontalType
  55325. ; ===========================================================================
  55326. ; loc_2B194:
  55327. Obj86_UpwardsType:
  55328. tst.w (Debug_placement_mode).w
  55329. bne.s return_2B208
  55330. lea (byte_2B3C6).l,a2
  55331. move.b mapping_frame(a0),d0
  55332. beq.s loc_2B1B6
  55333. lea (byte_2B3EA).l,a2
  55334. subq.b #1,d0
  55335. beq.s loc_2B1B6
  55336. lea (byte_2B40E).l,a2
  55337.  
  55338. loc_2B1B6:
  55339. move.w #$23,d1
  55340. move.w #6,d2
  55341. move.w x_pos(a0),d4
  55342. jsrto (SlopedSolid).l, JmpTo2_SlopedSolid
  55343. lea objoff_36(a0),a3
  55344. lea (MainCharacter).w,a1 ; a1=character
  55345. move.w (Ctrl_1_Logical).w,d5
  55346. moveq #p1_standing_bit,d6
  55347. bsr.s loc_2B20A
  55348. addq.w #1,a3
  55349. lea (Sidekick).w,a1 ; a1=character
  55350. move.w (Ctrl_2).w,d5
  55351. moveq #p2_standing_bit,d6
  55352. bsr.s loc_2B20A
  55353. tst.b objoff_38(a0)
  55354. beq.s loc_2B1FE
  55355. clr.b objoff_38(a0)
  55356. bsr.w loc_2B290
  55357. subq.w #1,a3
  55358. lea (MainCharacter).w,a1 ; a1=character
  55359. moveq #p1_standing_bit,d6
  55360. bsr.w loc_2B290
  55361.  
  55362. loc_2B1FE:
  55363. lea (Ani_obj86).l,a1
  55364. jmpto (AnimateSprite).l, JmpTo9_AnimateSprite
  55365. ; ===========================================================================
  55366.  
  55367. return_2B208:
  55368. rts
  55369. ; ===========================================================================
  55370.  
  55371. loc_2B20A:
  55372. move.b (a3),d0
  55373. bne.s loc_2B23C
  55374. btst d6,status(a0)
  55375. beq.s return_2B208
  55376. move.b #1,obj_control(a1)
  55377. move.b #$E,y_radius(a1)
  55378. move.b #7,x_radius(a1)
  55379. move.b #AniIDSonAni_Roll,anim(a1)
  55380. bset #2,status(a1)
  55381. bne.s loc_2B238
  55382. addq.w #5,y_pos(a1)
  55383.  
  55384. loc_2B238:
  55385. addq.b #1,(a3)
  55386. rts
  55387. ; ===========================================================================
  55388.  
  55389. loc_2B23C:
  55390. andi.w #button_B_mask|button_C_mask|button_A_mask,d5
  55391. bne.s loc_2B288
  55392. btst d6,status(a0)
  55393. bne.s loc_2B254
  55394. move.b #0,obj_control(a1)
  55395. move.b #0,(a3)
  55396. rts
  55397. ; ===========================================================================
  55398.  
  55399. loc_2B254:
  55400. moveq #0,d1
  55401. move.b mapping_frame(a0),d1
  55402. subq.w #1,d1
  55403. bset #0,status(a1)
  55404. btst #0,status(a0)
  55405. bne.s loc_2B272
  55406. neg.w d1
  55407. bclr #0,status(a1)
  55408.  
  55409. loc_2B272:
  55410. add.w d1,x_pos(a1)
  55411. lsl.w #8,d1
  55412. move.w d1,x_vel(a1)
  55413. move.w d1,inertia(a1)
  55414. move.w #0,y_vel(a1)
  55415. rts
  55416. ; ===========================================================================
  55417.  
  55418. loc_2B288:
  55419. move.b #1,objoff_38(a0)
  55420. rts
  55421. ; ===========================================================================
  55422.  
  55423. loc_2B290:
  55424. bclr d6,status(a0)
  55425. beq.w return_2B208
  55426. move.w x_pos(a1),d0
  55427. sub.w x_pos(a0),d0
  55428. btst #0,status(a0)
  55429. beq.s loc_2B2AA
  55430. neg.w d0
  55431.  
  55432. loc_2B2AA:
  55433. addi.w #$23,d0
  55434. move.w d0,d2
  55435. cmpi.w #$40,d2
  55436. blo.s loc_2B2BA
  55437. move.w #$40,d2
  55438.  
  55439. loc_2B2BA:
  55440. lsl.w #5,d2
  55441. addi.w #$800,d2
  55442. neg.w d2
  55443. asr.w #2,d0
  55444. addi.w #$40,d0
  55445. jsrto (CalcSine).l, JmpTo11_CalcSine
  55446. muls.w d2,d0
  55447. muls.w d2,d1
  55448. asr.l #8,d0
  55449. asr.l #8,d1
  55450. move.w d0,y_vel(a1)
  55451. btst #0,status(a0)
  55452. beq.s loc_2B2E2
  55453. neg.w d1
  55454.  
  55455. loc_2B2E2:
  55456. move.w d1,x_vel(a1)
  55457. bset #1,status(a1)
  55458. bclr #3,status(a1)
  55459. move.b #2,routine(a1)
  55460. move.b #0,obj_control(a1)
  55461. move.b #1,anim(a0)
  55462. move.b #0,(a3)
  55463. move.w #SndID_Flipper,d0
  55464. jmp (PlaySound).l
  55465. ; ===========================================================================
  55466. ; loc_2B312:
  55467. Obj86_HorizontalType:
  55468. move.w #$13,d1
  55469. move.w #$18,d2
  55470. move.w #$19,d3
  55471. move.w x_pos(a0),d4
  55472. lea (MainCharacter).w,a1 ; a1=character
  55473. moveq #p1_standing_bit,d6
  55474. movem.l d1-d4,-(sp)
  55475. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo6_SolidObject_Always_SingleCharacter
  55476. btst #p1_pushing_bit,status(a0)
  55477. beq.s loc_2B33A
  55478. bsr.s loc_2B35C
  55479.  
  55480. loc_2B33A:
  55481. movem.l (sp)+,d1-d4
  55482. lea (Sidekick).w,a1 ; a1=character
  55483. moveq #p2_standing_bit,d6
  55484. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo6_SolidObject_Always_SingleCharacter
  55485. btst #p2_pushing_bit,status(a0)
  55486. beq.s loc_2B352
  55487. bsr.s loc_2B35C
  55488.  
  55489. loc_2B352:
  55490. lea (Ani_obj86).l,a1
  55491. jmpto (AnimateSprite).l, JmpTo9_AnimateSprite
  55492. ; ===========================================================================
  55493.  
  55494. loc_2B35C:
  55495. move.w #$300,anim(a0)
  55496. move.w #-$1000,x_vel(a1)
  55497. addq.w #8,x_pos(a1)
  55498. bset #0,status(a1)
  55499. move.w x_pos(a0),d0
  55500. sub.w x_pos(a1),d0
  55501. bcc.s loc_2B392
  55502. bclr #0,status(a1)
  55503. subi.w #$10,x_pos(a1)
  55504. neg.w x_vel(a1)
  55505. move.w #$400,anim(a0)
  55506.  
  55507. loc_2B392:
  55508. move.w #$F,move_lock(a1)
  55509. move.w x_vel(a1),inertia(a1)
  55510. move.b #$E,y_radius(a1)
  55511. move.b #7,x_radius(a1)
  55512. move.b #AniIDSonAni_Roll,anim(a1)
  55513. bset #2,status(a1)
  55514. bne.s loc_2B3BC
  55515. addq.w #5,y_pos(a1)
  55516.  
  55517. loc_2B3BC:
  55518. move.w #SndID_Flipper,d0
  55519. jmp (PlaySound).l
  55520. ; ===========================================================================
  55521. byte_2B3C6:
  55522. dc.b 7, 7, 7, 7, 7, 7, 7, 8, 9, $A, $B, $A, 9, 8, 7, 6
  55523. dc.b 5, 4, 3, 2, 1, 0,$FF,$FE,$FD,$FC,$FB,$FA,$F9,$F8,$F7,$F6; 16
  55524. dc.b $F5,$F4,$F3,$F2 ; 32
  55525. byte_2B3EA:
  55526. dc.b 6, 6, 6, 6, 6, 6, 7, 8, 9, 9, 9, 9, 9, 9, 8, 8
  55527. dc.b 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 4, 4; 16
  55528. dc.b 4, 4, 4, 4 ; 32
  55529. byte_2B40E:
  55530. dc.b 5, 5, 5, 5, 5, 6, 7, 8, 9, $A, $B, $B, $C, $C, $D, $D
  55531. dc.b $E, $E, $F, $F,$10,$10,$11,$11,$12,$12,$11,$11,$10,$10,$10,$10; 16
  55532. dc.b $10,$10,$10,$10 ; 32
  55533.  
  55534. ; animation script
  55535. ; off_2B432:
  55536. Ani_obj86: offsetTable
  55537. offsetTableEntry.w byte_2B43C ; 0
  55538. offsetTableEntry.w byte_2B43F ; 1
  55539. offsetTableEntry.w byte_2B445 ; 2
  55540. offsetTableEntry.w byte_2B448 ; 3
  55541. offsetTableEntry.w byte_2B451 ; 4
  55542. byte_2B43C: dc.b $F, 0,$FF
  55543. rev02even
  55544. byte_2B43F: dc.b 3, 1, 2, 1,$FD, 0
  55545. rev02even
  55546. byte_2B445: dc.b $F, 4,$FF
  55547. rev02even
  55548. byte_2B448: dc.b 0, 5, 4, 3, 3, 3, 3,$FD, 2
  55549. rev02even
  55550. byte_2B451: dc.b 0, 3, 4, 5, 5, 5, 5,$FD, 2
  55551. even
  55552. ; ----------------------------------------------------------------------------
  55553. ; sprite mappings
  55554. ; ----------------------------------------------------------------------------
  55555. Obj86_MapUnc_2B45A: BINCLUDE "mappings/sprite/obj86.bin"
  55556. ; ===========================================================================
  55557.  
  55558. if gameRevision<2
  55559. nop
  55560. endif
  55561.  
  55562. if ~~removeJmpTos
  55563. JmpTo27_MarkObjGone
  55564. jmp (MarkObjGone).l
  55565. JmpTo9_AnimateSprite
  55566. jmp (AnimateSprite).l
  55567. JmpTo50_Adjust2PArtPointer
  55568. jmp (Adjust2PArtPointer).l
  55569. JmpTo11_CalcSine
  55570. jmp (CalcSine).l
  55571. JmpTo6_SolidObject_Always_SingleCharacter
  55572. jmp (SolidObject_Always_SingleCharacter).l
  55573. JmpTo2_SlopedSolid
  55574. jmp (SlopedSolid).l
  55575.  
  55576. align 4
  55577. endif
  55578.  
  55579.  
  55580.  
  55581.  
  55582. ; ===========================================================================
  55583. ; ----------------------------------------------------------------------------
  55584. ; Object D2 - Flashing blocks that appear and disappear in a rectangular shape that you can walk across, from CNZ
  55585. ; ----------------------------------------------------------------------------
  55586. ; Sprite_2B528:
  55587. ObjD2:
  55588. moveq #0,d0
  55589. move.b routine(a0),d0
  55590. move.w ObjD2_Index(pc,d0.w),d1
  55591. jmp ObjD2_Index(pc,d1.w)
  55592. ; ===========================================================================
  55593. ; off_2B536:
  55594. ObjD2_Index: offsetTable
  55595. offsetTableEntry.w ObjD2_Init ; 0
  55596. offsetTableEntry.w ObjD2_Main ; 2
  55597. ; ===========================================================================
  55598. ; loc_2B53A:
  55599. ObjD2_Init:
  55600. addq.b #2,routine(a0)
  55601. move.l #ObjD2_MapUnc_2B694,mappings(a0)
  55602. move.w #make_art_tile(ArtTile_ArtNem_CNZSnake,2,0),art_tile(a0)
  55603. jsrto (Adjust2PArtPointer).l, JmpTo51_Adjust2PArtPointer
  55604. ori.b #4,render_flags(a0)
  55605. move.b #8,width_pixels(a0)
  55606. move.b #4,priority(a0)
  55607. move.w x_pos(a0),objoff_30(a0)
  55608. move.w y_pos(a0),objoff_32(a0)
  55609. moveq #0,d0
  55610. move.b subtype(a0),d0
  55611. lsl.w #4,d0
  55612. move.w d0,objoff_38(a0)
  55613. bsr.w loc_2B60C
  55614. ; loc_2B57E:
  55615. ObjD2_Main:
  55616. tst.w objoff_38(a0)
  55617. beq.s +
  55618. subq.w #1,objoff_38(a0)
  55619. jmpto (MarkObjGone3).l, JmpTo6_MarkObjGone3
  55620. ; ===========================================================================
  55621. +
  55622. subq.w #1,objoff_3A(a0)
  55623. bpl.s loc_2B5EC
  55624. move.w #$F,objoff_3A(a0)
  55625. addq.b #1,mapping_frame(a0)
  55626. andi.b #$F,mapping_frame(a0)
  55627. bne.s loc_2B5EA
  55628. moveq #0,d0
  55629. move.b subtype(a0),d0
  55630. lsl.w #4,d0
  55631. move.w d0,objoff_38(a0)
  55632. move.b status(a0),d0
  55633. andi.b #standing_mask,d0
  55634. beq.s loc_2B5E2
  55635. bclr #p1_standing_bit,status(a0)
  55636. beq.s +
  55637. bclr #3,(MainCharacter+status).w
  55638. bset #1,(MainCharacter+status).w
  55639. +
  55640. bclr #p2_standing_bit,status(a0)
  55641. beq.s loc_2B5E2
  55642. bclr #3,(Sidekick+status).w
  55643. bset #1,(Sidekick+status).w
  55644.  
  55645. loc_2B5E2:
  55646. move.w objoff_30(a0),x_pos(a0)
  55647. bra.s loc_2B60C
  55648. ; ===========================================================================
  55649.  
  55650. loc_2B5EA:
  55651. bsr.s loc_2B60C
  55652.  
  55653. loc_2B5EC:
  55654. move.w objoff_34(a0),d1
  55655. addi.w #$B,d1
  55656. move.w objoff_36(a0),d2
  55657. move.w d2,d3
  55658. addq.w #1,d3
  55659. move.w x_pos(a0),d4
  55660. jsrto (SolidObject).l, JmpTo24_SolidObject
  55661. move.w objoff_30(a0),d0
  55662. jmpto (MarkObjGone2).l, JmpTo9_MarkObjGone2
  55663. ; ===========================================================================
  55664.  
  55665. loc_2B60C:
  55666. moveq #0,d0
  55667. move.b mapping_frame(a0),d0
  55668. add.w d0,d0
  55669. add.w d0,d0
  55670. lea byte_2B654(pc,d0.w),a1
  55671. move.b (a1)+,d0
  55672. ext.w d0
  55673. btst #0,status(a0)
  55674. beq.s +
  55675. neg.w d0
  55676. +
  55677. add.w objoff_30(a0),d0
  55678. move.w d0,x_pos(a0)
  55679. move.b (a1)+,d0
  55680. ext.w d0
  55681. add.w objoff_32(a0),d0
  55682. move.w d0,y_pos(a0)
  55683. moveq #0,d1
  55684. moveq #0,d2
  55685. moveq #0,d3
  55686. move.b (a1)+,d1
  55687. move.b (a1)+,d2
  55688. move.w d1,objoff_34(a0)
  55689. move.b d1,width_pixels(a0)
  55690. move.w d2,objoff_36(a0)
  55691. rts
  55692. ; ===========================================================================
  55693. byte_2B654:
  55694. dc.b $D8,$18, 8, 8,$D8,$10, 8,$10,$D8, 8, 8,$18,$D8, 0, 8,$20
  55695. dc.b $E0, 0,$10,$20,$E8,$F8,$18,$18,$F0,$F0,$20,$10,$F8,$E8,$28, 8; 16
  55696. dc.b 8,$E8,$28, 8,$10,$F0,$20,$10,$18,$F8,$18,$18,$20, 0,$10,$20; 32
  55697. dc.b $28, 0, 8,$20,$28, 8, 8,$18,$28,$10, 8,$10,$28,$18, 8, 8; 48
  55698. ; ----------------------------------------------------------------------------
  55699. ; sprite mappings
  55700. ; ----------------------------------------------------------------------------
  55701. ObjD2_MapUnc_2B694: BINCLUDE "mappings/sprite/objD2.bin"
  55702. ; ===========================================================================
  55703.  
  55704. if gameRevision<2
  55705. nop
  55706. endif
  55707.  
  55708. if ~~removeJmpTos
  55709. JmpTo6_MarkObjGone3
  55710. jmp (MarkObjGone3).l
  55711. JmpTo51_Adjust2PArtPointer
  55712. jmp (Adjust2PArtPointer).l
  55713. JmpTo24_SolidObject
  55714. jmp (SolidObject).l
  55715. JmpTo9_MarkObjGone2
  55716. jmp (MarkObjGone2).l
  55717.  
  55718. align 4
  55719. endif
  55720.  
  55721.  
  55722.  
  55723.  
  55724. ; ===========================================================================
  55725. ; ----------------------------------------------------------------------------
  55726. ; Object D3 - Bomb prize from CNZ
  55727. ; ----------------------------------------------------------------------------
  55728. ; Note: see object DC (ring prize) for SST entries (casino_prize_*)
  55729.  
  55730. ; Sprite_2B84C:
  55731. ObjD3:
  55732. moveq #0,d1
  55733. move.w casino_prize_machine_x_pos(a0),d1
  55734. swap d1
  55735. move.l casino_prize_x_pos(a0),d0
  55736. sub.l d1,d0
  55737. asr.l #4,d0
  55738. sub.l d0,casino_prize_x_pos(a0)
  55739. move.w casino_prize_x_pos(a0),x_pos(a0)
  55740. moveq #0,d1
  55741. move.w casino_prize_machine_y_pos(a0),d1
  55742. swap d1
  55743. move.l casino_prize_y_pos(a0),d0
  55744. sub.l d1,d0
  55745. asr.l #4,d0
  55746. sub.l d0,casino_prize_y_pos(a0)
  55747. move.w casino_prize_y_pos(a0),y_pos(a0)
  55748. subq.w #1,casino_prize_display_delay(a0)
  55749. bne.w JmpTo28_DisplaySprite
  55750. movea.l objoff_2A(a0),a1
  55751. subq.w #1,(a1)
  55752. cmpi.w #5,(Bonus_Countdown_3).w
  55753. blo.s +
  55754. clr.w (Bonus_Countdown_3).w
  55755. move.w #SndID_HurtBySpikes,d0
  55756. jsr (PlaySoundStereo).l
  55757. +
  55758. tst.b parent+1(a0)
  55759. beq.s ++
  55760. tst.w (Ring_count_2P).w
  55761. beq.s +
  55762. subq.w #1,(Ring_count_2P).w
  55763. ori.b #$81,(Update_HUD_rings_2P).w
  55764. +
  55765. tst.w (Two_player_mode).w
  55766. bne.s BranchTo_JmpTo44_DeleteObject
  55767. +
  55768. tst.w (Ring_count).w
  55769. beq.s BranchTo_JmpTo44_DeleteObject
  55770. subq.w #1,(Ring_count).w
  55771. ori.b #$81,(Update_HUD_rings).w
  55772.  
  55773. BranchTo_JmpTo44_DeleteObject
  55774. jmpto (DeleteObject).l, JmpTo44_DeleteObject
  55775.  
  55776. if removeJmpTos
  55777. JmpTo28_DisplaySprite
  55778. jmp (DisplaySprite).l
  55779. endif
  55780. ; ===========================================================================
  55781. ; ----------------------------------------------------------------------------
  55782. ; sprite mappings
  55783. ; ----------------------------------------------------------------------------
  55784. ObjD3_MapUnc_2B8D4: BINCLUDE "mappings/sprite/objD6_a.bin"
  55785. ; ===========================================================================
  55786.  
  55787. if ~~removeJmpTos
  55788. JmpTo28_DisplaySprite
  55789. jmp (DisplaySprite).l
  55790. JmpTo44_DeleteObject
  55791. jmp (DeleteObject).l
  55792.  
  55793. align 4
  55794. endif
  55795.  
  55796.  
  55797.  
  55798.  
  55799. ; ===========================================================================
  55800. ; ----------------------------------------------------------------------------
  55801. ; Object D4 - Big block from CNZ that moves back and forth
  55802. ; ----------------------------------------------------------------------------
  55803. ; Sprite_2B8EC:
  55804. ObjD4:
  55805. moveq #0,d0
  55806. move.b routine(a0),d0
  55807. move.w ObjD4_Index(pc,d0.w),d1
  55808. jmp ObjD4_Index(pc,d1.w)
  55809. ; ===========================================================================
  55810. ; off_2B8FA:
  55811. ObjD4_Index: offsetTable
  55812. offsetTableEntry.w ObjD4_Init ; 0
  55813. offsetTableEntry.w ObjD4_Main ; 2
  55814. ; ===========================================================================
  55815. ; loc_2B8FE:
  55816. ObjD4_Init:
  55817. addq.b #2,routine(a0)
  55818. move.l #ObjD4_MapUnc_2B9CA,mappings(a0)
  55819. move.w #make_art_tile(ArtTile_ArtNem_BigMovingBlock,2,0),art_tile(a0)
  55820. jsrto (Adjust2PArtPointer).l, JmpTo52_Adjust2PArtPointer
  55821. move.b #4,render_flags(a0)
  55822. move.b #$20,width_pixels(a0)
  55823. move.b #4,priority(a0)
  55824. move.w x_pos(a0),objoff_30(a0)
  55825. move.w y_pos(a0),objoff_32(a0)
  55826. move.w #$8000,x_sub(a0)
  55827. move.w #$8000,y_sub(a0)
  55828. tst.b subtype(a0)
  55829. bne.s loc_2B95A
  55830. subi.w #$60,x_pos(a0)
  55831. btst #0,status(a0)
  55832. beq.s ObjD4_Main
  55833. addi.w #$C0,x_pos(a0)
  55834. bra.s ObjD4_Main
  55835. ; ===========================================================================
  55836.  
  55837. loc_2B95A:
  55838. subi.w #$60,y_pos(a0)
  55839. btst #1,status(a0)
  55840. beq.s ObjD4_Main
  55841. addi.w #$C0,y_pos(a0)
  55842. ; loc_2B96E:
  55843. ObjD4_Main:
  55844. move.w x_pos(a0),-(sp)
  55845. moveq #0,d0
  55846. move.b subtype(a0),d0
  55847. move.w ObjD4_Types(pc,d0.w),d1
  55848. jsr ObjD4_Types(pc,d1.w)
  55849. jsrto (ObjectMove).l, JmpTo17_ObjectMove
  55850. move.w #$2B,d1
  55851. move.w #$20,d2
  55852. move.w #$21,d3
  55853. move.w (sp)+,d4
  55854. jsrto (SolidObject).l, JmpTo25_SolidObject
  55855. move.w objoff_30(a0),d0
  55856. jmpto (MarkObjGone2).l, JmpTo10_MarkObjGone2
  55857. ; ===========================================================================
  55858. ; off_2B99E:
  55859. ObjD4_Types: offsetTable
  55860. offsetTableEntry.w ObjD4_Horizontal ; 0
  55861. offsetTableEntry.w ObjD4_Vertical ; 2
  55862. ; ===========================================================================
  55863. ; loc_2B9A2:
  55864. ObjD4_Horizontal:
  55865. moveq #4,d1
  55866. move.w objoff_30(a0),d0
  55867. cmp.w x_pos(a0),d0
  55868. bhi.s +
  55869. neg.w d1
  55870. +
  55871. add.w d1,x_vel(a0)
  55872. rts
  55873. ; ===========================================================================
  55874. ; loc_2B9B6:
  55875. ObjD4_Vertical:
  55876. moveq #4,d1
  55877. move.w objoff_32(a0),d0
  55878. cmp.w y_pos(a0),d0
  55879. bhi.s +
  55880. neg.w d1
  55881. +
  55882. add.w d1,y_vel(a0)
  55883. rts
  55884. ; ===========================================================================
  55885. ; ----------------------------------------------------------------------------
  55886. ; sprite mappings
  55887. ; ----------------------------------------------------------------------------
  55888. ObjD4_MapUnc_2B9CA: BINCLUDE "mappings/sprite/objD4.bin"
  55889. ; ===========================================================================
  55890.  
  55891. if gameRevision<2
  55892. nop
  55893. endif
  55894.  
  55895. if ~~removeJmpTos
  55896. JmpTo52_Adjust2PArtPointer
  55897. jmp (Adjust2PArtPointer).l
  55898. JmpTo25_SolidObject
  55899. jmp (SolidObject).l
  55900. JmpTo10_MarkObjGone2
  55901. jmp (MarkObjGone2).l
  55902. ; loc_2BA02:
  55903. JmpTo17_ObjectMove
  55904. jmp (ObjectMove).l
  55905.  
  55906. align 4
  55907. endif
  55908.  
  55909.  
  55910.  
  55911.  
  55912. ; ===========================================================================
  55913. ; ----------------------------------------------------------------------------
  55914. ; Object D5 - Elevator from CNZ
  55915. ; ----------------------------------------------------------------------------
  55916. ; Sprite_2BA08:
  55917. ObjD5:
  55918. moveq #0,d0
  55919. move.b routine(a0),d0
  55920. move.w ObjD5_Index(pc,d0.w),d1
  55921. jmp ObjD5_Index(pc,d1.w)
  55922. ; ===========================================================================
  55923. ; off_2BA16:
  55924. ObjD5_Index: offsetTable
  55925. offsetTableEntry.w ObjD5_Init ; 0
  55926. offsetTableEntry.w ObjD5_Main ; 2
  55927. ; ===========================================================================
  55928. ; loc_2BA1A:
  55929. ObjD5_Init:
  55930. addq.b #2,routine(a0)
  55931. move.l #ObjD5_MapUnc_2BB40,mappings(a0)
  55932. move.w #make_art_tile(ArtTile_ArtNem_CNZElevator,2,0),art_tile(a0)
  55933. jsrto (Adjust2PArtPointer).l, JmpTo53_Adjust2PArtPointer
  55934. move.b #4,render_flags(a0)
  55935. move.b #$10,width_pixels(a0)
  55936. move.b #4,priority(a0)
  55937. move.w y_pos(a0),objoff_32(a0)
  55938. move.w #$8000,y_sub(a0)
  55939. moveq #0,d0
  55940. move.b subtype(a0),d0
  55941. lsl.w #2,d0
  55942. sub.w d0,y_pos(a0)
  55943. btst #0,status(a0)
  55944. beq.s ObjD5_Main
  55945. add.w d0,d0
  55946. add.w d0,y_pos(a0)
  55947. ; loc_2BA68:
  55948. ObjD5_Main:
  55949. jsrto (ObjectMove).l, JmpTo18_ObjectMove
  55950. move.w objoff_34(a0),d0
  55951. move.w off_2BA94(pc,d0.w),d1
  55952. jsr off_2BA94(pc,d1.w)
  55953. cmpi.w #6,objoff_34(a0)
  55954. bhs.s +
  55955. move.w #$10,d1
  55956. move.w #9,d3
  55957. move.w x_pos(a0),d4
  55958. jsrto (PlatformObjectD5).l, JmpTo_PlatformObjectD5
  55959. +
  55960. jmpto (MarkObjGone).l, JmpTo28_MarkObjGone
  55961. ; ===========================================================================
  55962. off_2BA94: offsetTable
  55963. offsetTableEntry.w loc_2BA9C ; 0
  55964. offsetTableEntry.w loc_2BAB6 ; 2
  55965. offsetTableEntry.w loc_2BAEE ; 4
  55966. offsetTableEntry.w loc_2BB08 ; 6
  55967. ; ===========================================================================
  55968.  
  55969. loc_2BA9C:
  55970. move.b status(a0),d0
  55971. andi.w #standing_mask,d0
  55972. beq.s + ; rts
  55973. move.w #SndID_CNZElevator,d0
  55974. jsr (PlaySound).l
  55975. addq.w #2,objoff_34(a0)
  55976. +
  55977. rts
  55978. ; ===========================================================================
  55979.  
  55980. loc_2BAB6:
  55981. moveq #8,d1
  55982. move.w objoff_32(a0),d0
  55983. cmp.w y_pos(a0),d0
  55984. bhs.s +
  55985. neg.w d1
  55986. +
  55987. add.w d1,y_vel(a0)
  55988. bne.s + ; rts
  55989. addq.w #2,objoff_34(a0)
  55990. move.w d0,y_pos(a0)
  55991. moveq #0,d0
  55992. move.b subtype(a0),d0
  55993. lsl.w #2,d0
  55994. sub.w d0,y_pos(a0)
  55995. btst #0,status(a0)
  55996. bne.s + ; rts
  55997. add.w d0,d0
  55998. add.w d0,y_pos(a0)
  55999. +
  56000. rts
  56001. ; ===========================================================================
  56002.  
  56003. loc_2BAEE:
  56004. move.b status(a0),d0
  56005. andi.w #standing_mask,d0
  56006. bne.s + ; rts
  56007. move.w #SndID_CNZElevator,d0
  56008. jsr (PlaySound).l
  56009. addq.w #2,objoff_34(a0)
  56010. +
  56011. rts
  56012. ; ===========================================================================
  56013.  
  56014. loc_2BB08:
  56015. moveq #8,d1
  56016. move.w objoff_32(a0),d0
  56017. cmp.w y_pos(a0),d0
  56018. bhs.s +
  56019. neg.w d1
  56020. +
  56021. add.w d1,y_vel(a0)
  56022. bne.s + ; rts
  56023. clr.w objoff_34(a0)
  56024. move.w d0,y_pos(a0)
  56025. moveq #0,d0
  56026. move.b subtype(a0),d0
  56027. lsl.w #2,d0
  56028. sub.w d0,y_pos(a0)
  56029. btst #0,status(a0)
  56030. beq.s + ; rts
  56031. add.w d0,d0
  56032. add.w d0,y_pos(a0)
  56033. +
  56034. rts
  56035. ; ===========================================================================
  56036. ; ----------------------------------------------------------------------------
  56037. ; sprite mappings
  56038. ; ----------------------------------------------------------------------------
  56039. ObjD5_MapUnc_2BB40: BINCLUDE "mappings/sprite/objD5.bin"
  56040. ; ===========================================================================
  56041.  
  56042. if ~~removeJmpTos
  56043. JmpTo28_MarkObjGone
  56044. jmp (MarkObjGone).l
  56045. JmpTo53_Adjust2PArtPointer
  56046. jmp (Adjust2PArtPointer).l
  56047. JmpTo_PlatformObjectD5
  56048. jmp (PlatformObjectD5).l
  56049. ; loc_2BB66:
  56050. JmpTo18_ObjectMove
  56051. jmp (ObjectMove).l
  56052.  
  56053. align 4
  56054. endif
  56055.  
  56056.  
  56057.  
  56058.  
  56059. ; ===========================================================================
  56060. ; ----------------------------------------------------------------------------
  56061. ; Object D6 - Pokey that gives out points from CNZ
  56062. ; ----------------------------------------------------------------------------
  56063. ; Sprite_2BB6C:
  56064. ObjD6:
  56065. moveq #0,d0
  56066. move.b routine(a0),d0
  56067. move.w ObjD6_Index(pc,d0.w),d1
  56068. jmp ObjD6_Index(pc,d1.w)
  56069. ; ===========================================================================
  56070. ; off_2BB7A:
  56071. ObjD6_Index: offsetTable
  56072. offsetTableEntry.w ObjD6_Init ; 0
  56073. offsetTableEntry.w ObjD6_Main ; 2
  56074. ; ===========================================================================
  56075. ; loc_2BB7E:
  56076. ObjD6_Init:
  56077. addq.b #2,routine(a0)
  56078. move.l #ObjD6_MapUnc_2BEBC,mappings(a0)
  56079. move.w #make_art_tile(ArtTile_ArtNem_CNZCage,0,0),art_tile(a0)
  56080. jsrto (Adjust2PArtPointer).l, JmpTo54_Adjust2PArtPointer
  56081. move.b #4,render_flags(a0)
  56082. move.b #$18,width_pixels(a0)
  56083. move.b #1,priority(a0)
  56084. ; loc_2BBA6:
  56085. ObjD6_Main:
  56086. move.w #$23,d1
  56087. move.w #$10,d2
  56088. move.w #$11,d3
  56089. move.w x_pos(a0),d4
  56090. lea objoff_30(a0),a2
  56091. lea (MainCharacter).w,a1 ; a1=character
  56092. moveq #p1_standing_bit,d6
  56093. movem.l d1-d4,-(sp)
  56094. bsr.w loc_2BBE8
  56095. movem.l (sp)+,d1-d4
  56096. lea objoff_34(a0),a2 ; a2=object
  56097. lea (Sidekick).w,a1 ; a1=character
  56098. moveq #p2_standing_bit,d6
  56099. bsr.w loc_2BBE8
  56100. lea (Ani_objD6).l,a1
  56101. jsrto (AnimateSprite).l, JmpTo10_AnimateSprite
  56102. jmpto (MarkObjGone).l, JmpTo29_MarkObjGone
  56103. ; ===========================================================================
  56104.  
  56105. loc_2BBE8:
  56106. move.w (a2),d0
  56107. move.w off_2BBF2(pc,d0.w),d0
  56108. jmp off_2BBF2(pc,d0.w)
  56109. ; ===========================================================================
  56110. off_2BBF2: offsetTable
  56111. offsetTableEntry.w loc_2BBF8 ; 0
  56112. offsetTableEntry.w loc_2BDF8 ; 2
  56113. offsetTableEntry.w loc_2BE9C ; 4
  56114. ; ===========================================================================
  56115.  
  56116. loc_2BBF8:
  56117. tst.b obj_control(a1)
  56118. bne.w return_2BC84
  56119. tst.b subtype(a0)
  56120. beq.s loc_2BC0C
  56121. tst.w (SlotMachineInUse).w
  56122. bne.s return_2BC84
  56123.  
  56124. loc_2BC0C:
  56125. jsrto (SolidObject_Always_SingleCharacter).l, JmpTo7_SolidObject_Always_SingleCharacter
  56126. tst.w d4
  56127. bpl.s return_2BC84
  56128. move.w x_pos(a0),x_pos(a1)
  56129. move.w y_pos(a0),y_pos(a1)
  56130. move.w #0,x_vel(a1)
  56131. move.w #0,y_vel(a1)
  56132. move.w #0,inertia(a1)
  56133. move.b #$81,obj_control(a1)
  56134. bset #2,status(a1)
  56135. move.b #$E,y_radius(a1)
  56136. move.b #7,x_radius(a1)
  56137. move.b #AniIDSonAni_Roll,anim(a1)
  56138. move.b #1,anim(a0)
  56139. addq.w #2,(a2)+
  56140. move.w #$78,(a2)
  56141. move.w a1,parent(a0)
  56142. tst.b subtype(a0)
  56143. beq.s return_2BC84
  56144. cmpi.b #$18,(SlotMachine_Routine).w ; Is it the null routine?
  56145. bne.s return_2BC84 ; Branch if not
  56146. move.b #8,(SlotMachine_Routine).w ; => SlotMachine_Routine3
  56147. clr.w objoff_2E(a0)
  56148. move.w #-1,(SlotMachineInUse).w
  56149. move.w #-1,objoff_2A(a0)
  56150.  
  56151. return_2BC84:
  56152. rts
  56153. ; ===========================================================================
  56154.  
  56155. loc_2BC86:
  56156. move.w (SlotMachine_Reward).w,d0
  56157. bpl.w loc_2BD4E
  56158. tst.w objoff_2A(a0)
  56159. bpl.s +
  56160. move.w #$64,objoff_2A(a0)
  56161. +
  56162. tst.w objoff_2A(a0)
  56163. beq.w +
  56164. btst #0,(Timer_frames+1).w
  56165. beq.w loc_2BD48
  56166. cmpi.w #$10,objoff_2C(a0)
  56167. bhs.w loc_2BD48
  56168. jsrto (SingleObjLoad).l, JmpTo10_SingleObjLoad
  56169. bne.w loc_2BD48
  56170. _move.b #ObjID_BombPrize,id(a1) ; load objD3
  56171. move.l #ObjD3_MapUnc_2B8D4,mappings(a1)
  56172. move.w #make_art_tile(ArtTile_ArtNem_CNZBonusSpike,0,0),art_tile(a1)
  56173. jsrto (Adjust2PArtPointer2).l, JmpTo6_Adjust2PArtPointer2
  56174. move.b #4,render_flags(a1)
  56175. move.b #$10,width_pixels(a1)
  56176. move.b #4,priority(a1)
  56177. move.w #$1E,casino_prize_display_delay(a1)
  56178. move.w objoff_2E(a0),objoff_2E(a1)
  56179. addi.w #$90,objoff_2E(a0)
  56180. move.w x_pos(a0),casino_prize_machine_x_pos(a1)
  56181. move.w y_pos(a0),casino_prize_machine_y_pos(a1)
  56182. move.w objoff_2E(a1),d0
  56183. jsrto (CalcSine).l, JmpTo12_CalcSine
  56184. asr.w #1,d1
  56185. add.w casino_prize_machine_x_pos(a1),d1
  56186. move.w d1,casino_prize_x_pos(a1)
  56187. move.w d1,x_pos(a1)
  56188. asr.w #1,d0
  56189. add.w casino_prize_machine_y_pos(a1),d0
  56190. move.w d0,casino_prize_y_pos(a1)
  56191. move.w d0,y_pos(a1)
  56192. lea objoff_2C(a0),a2
  56193. move.l a2,objoff_2A(a1)
  56194. move.w parent(a0),parent(a1)
  56195. addq.w #1,objoff_2C(a0)
  56196. subq.w #1,objoff_2A(a0)
  56197. +
  56198. tst.w objoff_2C(a0)
  56199. beq.w loc_2BE2E
  56200.  
  56201. loc_2BD48:
  56202. addq.w #1,(Bonus_Countdown_3).w
  56203. rts
  56204. ; ===========================================================================
  56205.  
  56206. loc_2BD4E:
  56207. beq.w +
  56208. btst #0,(Timer_frames+1).w
  56209. beq.w return_2BDF6
  56210. cmpi.w #$10,objoff_2C(a0)
  56211. bhs.w return_2BDF6
  56212. jsrto (SingleObjLoad).l, JmpTo10_SingleObjLoad
  56213. bne.w return_2BDF6
  56214. _move.b #ObjID_RingPrize,id(a1) ; load objDC
  56215. move.l #Obj25_MapUnc_12382,mappings(a1)
  56216. move.w #make_art_tile(ArtTile_ArtNem_Ring,1,0),art_tile(a1)
  56217. jsrto (Adjust2PArtPointer2).l, JmpTo6_Adjust2PArtPointer2
  56218. move.b #4,render_flags(a1)
  56219. move.b #3,priority(a1)
  56220. move.b #8,width_pixels(a1)
  56221. move.w #$1A,casino_prize_display_delay(a1)
  56222. move.w objoff_2E(a0),objoff_2E(a1)
  56223. addi.w #$89,objoff_2E(a0)
  56224. move.w x_pos(a0),casino_prize_machine_x_pos(a1)
  56225. move.w y_pos(a0),casino_prize_machine_y_pos(a1)
  56226. move.w objoff_2E(a1),d0
  56227. jsrto (CalcSine).l, JmpTo12_CalcSine
  56228. asr.w #1,d1
  56229. add.w casino_prize_machine_x_pos(a1),d1
  56230. move.w d1,casino_prize_x_pos(a1)
  56231. move.w d1,x_pos(a1)
  56232. asr.w #1,d0
  56233. add.w casino_prize_machine_y_pos(a1),d0
  56234. move.w d0,casino_prize_y_pos(a1)
  56235. move.w d0,y_pos(a1)
  56236. lea objoff_2C(a0),a2
  56237. move.l a2,objoff_2A(a1)
  56238. move.w parent(a0),parent(a1)
  56239. addq.w #1,objoff_2C(a0)
  56240. subq.w #1,(SlotMachine_Reward).w
  56241. +
  56242. tst.w objoff_2C(a0)
  56243. beq.s loc_2BE2E
  56244.  
  56245. return_2BDF6:
  56246. rts
  56247. ; ===========================================================================
  56248.  
  56249. loc_2BDF8:
  56250. tst.b render_flags(a0)
  56251. bpl.s loc_2BE2E
  56252. tst.b subtype(a0)
  56253. beq.s loc_2BE28
  56254. move.w a1,objoff_3E(a0)
  56255. cmpi.b #$18,(SlotMachine_Routine).w ; Is it the null routine?
  56256. beq.w loc_2BC86 ; Branch if yes
  56257. move.b (Vint_runcount+3).w,d0
  56258. andi.w #$F,d0
  56259. bne.s + ; rts
  56260. move.w #SndID_CasinoBonus,d0
  56261. jsr (PlaySound).l
  56262. +
  56263. rts
  56264. ; ===========================================================================
  56265.  
  56266. loc_2BE28:
  56267. subq.w #1,2(a2)
  56268. bpl.s loc_2BE5E
  56269.  
  56270. loc_2BE2E:
  56271. move.w #0,objoff_2C(a0)
  56272. move.b #0,anim(a0)
  56273. move.b #0,objoff_2A(a1)
  56274. bclr d6,status(a0)
  56275. bclr #3,status(a1)
  56276. bset #1,status(a1)
  56277. move.w #$400,y_vel(a1)
  56278. addq.w #2,(a2)+
  56279. move.w #$1E,(a2)
  56280. rts
  56281. ; ===========================================================================
  56282.  
  56283. loc_2BE5E:
  56284. move.w 2(a2),d0
  56285. andi.w #$F,d0
  56286. bne.s + ; rts
  56287. move.w #SndID_CasinoBonus,d0
  56288. jsr (PlaySound).l
  56289. moveq #10,d0
  56290. movea.w a1,a3
  56291. jsr (AddPoints2).l
  56292. jsrto (SingleObjLoad).l, JmpTo10_SingleObjLoad
  56293. bne.s + ; rts
  56294. _move.b #ObjID_Points,id(a1) ; load obj29
  56295. move.w x_pos(a0),x_pos(a1)
  56296. move.w y_pos(a0),y_pos(a1)
  56297. move.b #0,mapping_frame(a1)
  56298. +
  56299. rts
  56300. ; ===========================================================================
  56301.  
  56302. loc_2BE9C:
  56303. subq.w #1,2(a2)
  56304. bpl.s + ; rts
  56305. clr.w (a2)
  56306. tst.b subtype(a0)
  56307. beq.s + ; rts
  56308. clr.w (SlotMachineInUse).w
  56309. +
  56310. rts
  56311. ; ===========================================================================
  56312. ; animation script
  56313. ; off_2BEB0:
  56314. Ani_objD6: offsetTable
  56315. offsetTableEntry.w byte_2BEB4 ; 0
  56316. offsetTableEntry.w byte_2BEB7 ; 1
  56317. byte_2BEB4: dc.b $F, 0,$FF
  56318. rev02even
  56319. byte_2BEB7: dc.b 1, 1, 0,$FF
  56320. even
  56321. ; ------------------------------------------------------------------------------
  56322. ; sprite mappings
  56323. ; ------------------------------------------------------------------------------
  56324. ObjD6_MapUnc_2BEBC: BINCLUDE "mappings/sprite/objD6_b.bin"
  56325. ; ===========================================================================
  56326.  
  56327.  
  56328. ; ------------------------------------------------------------------------------
  56329. ; runs the slot machines in CNZ
  56330. ; ------------------------------------------------------------------------------
  56331.  
  56332. slot_rout = 0
  56333. slot_timer = 1
  56334. slot_index = 3
  56335. slots_targ = 4
  56336. slot1_targ = 4
  56337. slot23_targ = 5
  56338. slots_data = 6
  56339. slot1_index = slots_data
  56340. slot1_offset = slots_data+1
  56341. slot1_speed = slots_data+2
  56342. slot1_rout = slots_data+3
  56343. slot2_index = slots_data+4
  56344. slot2_offset = slots_data+5
  56345. slot2_speed = slots_data+6
  56346. slot2_rout = slots_data+7
  56347. slot3_index = slots_data+8
  56348. slot3_offset = slots_data+9
  56349. slot3_speed = slots_data+10
  56350. slot3_rout = slots_data+11
  56351.  
  56352. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  56353.  
  56354. ; loc_2BF24:
  56355. SlotMachine:
  56356. lea (SlotMachineVariables).w,a4
  56357. moveq #0,d0
  56358. _move.b slot_rout(a4),d0
  56359. jmp SlotMachine_JmpTable(pc,d0.w)
  56360. ; ===========================================================================
  56361. ; loc_2BF32:
  56362. SlotMachine_JmpTable: ;;
  56363. bra.w SlotMachine_Routine1 ; $00
  56364. bra.w SlotMachine_Routine2 ; $04
  56365. bra.w SlotMachine_Routine3 ; $08
  56366. bra.w SlotMachine_Routine4 ; $0C
  56367. bra.w SlotMachine_Routine5 ; $10
  56368. bra.w SlotMachine_Routine6 ; $14
  56369. rts ; $18
  56370. ; ===========================================================================
  56371. ; loc_2BF4C:
  56372. SlotMachine_Routine1:
  56373. movea.l a4,a1 ; Copy destination
  56374.  
  56375. moveq #8,d0 ; 18 bytes, in words
  56376. - clr.w (a1)+
  56377. dbf d0,-
  56378.  
  56379. move.b (Vint_runcount+3).w,d0 ; 'Random' seed
  56380. move.b d0,slot1_index(a4) ; Only last 3 bits matter
  56381. ror.b #3,d0 ; Remove last 3 bits
  56382. move.b d0,slot2_index(a4) ; Again, only last 3 bits matter
  56383. ror.b #3,d0 ; Remove 3 more bits (only have 2 bits now!)
  56384. move.b d0,slot3_index(a4) ; Only 3 bits matter, but we only have 2 anyway
  56385. move.b #8,slot1_offset(a4) ; This will set a draw from start of tile
  56386. move.b #8,slot2_offset(a4) ; This will set a draw from start of tile
  56387. move.b #8,slot3_offset(a4) ; This will set a draw from start of tile
  56388. move.b #8,slot1_speed(a4) ; Initial rolling speed
  56389. move.b #8,slot2_speed(a4) ; Initial rolling speed
  56390. move.b #8,slot3_speed(a4) ; Initial rolling speed
  56391. move.b #1,slot_timer(a4) ; Roll each slot once
  56392. _addq.b #4,slot_rout(a4) ; => SlotMachine_Routine2
  56393. rts
  56394. ; ===========================================================================
  56395. ; loc_2BF9A:
  56396. SlotMachine_Routine2:
  56397. bsr.w SlotMachine_DrawSlot ; Draw the slots
  56398. tst.b slot_timer(a4) ; Are we still rolling?
  56399. beq.s + ; Branch if not
  56400. rts
  56401. ; ===========================================================================
  56402. +
  56403. _move.b #$18,slot_rout(a4) ; => null routine (rts)
  56404. clr.w slot1_speed(a4) ; Stop slot 1
  56405. clr.w slot2_speed(a4) ; Stop slot 2
  56406. clr.w slot3_speed(a4) ; Stop slot 3
  56407. rts
  56408. ; ===========================================================================
  56409. ; loc_2BFBA:
  56410. SlotMachine_Routine3:
  56411. move.b (Vint_runcount+3).w,d0 ; 'Random' seed
  56412. andi.b #7,d0 ; Only want last 3 bits
  56413. subq.b #4,d0 ; Subtract 4...
  56414. addi.b #$30,d0 ; ... then add $30 (why not just add $2C?)
  56415. move.b d0,slot1_speed(a4) ; This is our starting speed for slot 1
  56416. move.b (Vint_runcount+3).w,d0 ; 'Random' seed
  56417. rol.b #4,d0 ; Get top nibble...
  56418. andi.b #7,d0 ; ... but discard what was the sign bit
  56419. subq.b #4,d0 ; Subtract 4...
  56420. addi.b #$30,d0 ; ... then add $30 (why not just add $2C?)
  56421. move.b d0,slot2_speed(a4) ; This is our starting speed for slot 2
  56422. move.b (Vint_runcount+2).w,d0 ; 'Random' seed
  56423. andi.b #7,d0 ; Only want last 3 bits
  56424. subq.b #4,d0 ; Subtract 4...
  56425. addi.b #$30,d0 ; ... then add $30 (why not just add $2C?)
  56426. move.b d0,slot3_speed(a4) ; This is our starting speed for slot 3
  56427. move.b #2,slot_timer(a4) ; Roll each slot twice under these conditions
  56428. clr.b slot_index(a4) ; => SlotMachine_Subroutine1
  56429. clr.b slot1_rout(a4) ; => SlotMachine_Routine5_1
  56430. clr.b slot2_rout(a4) ; => SlotMachine_Routine5_1
  56431. clr.b slot3_rout(a4) ; => SlotMachine_Routine5_1
  56432. _addq.b #4,slot_rout(a4) ; => SlotMachine_Routine4
  56433. move.b (Vint_runcount+3).w,d0 ; 'Random' seed
  56434. ror.b #3,d0 ; Mess it around
  56435. lea (SlotTargetValues).l,a2
  56436.  
  56437. - sub.b (a2),d0 ; Subtract from random seed
  56438. bcs.s + ; Branch if result is less than zero
  56439. addq.w #3,a2 ; Advance 3 bytes
  56440. bra.s - ; Keep looping
  56441. ; ===========================================================================
  56442. +
  56443. cmpi.b #-1,(a2) ; Is the previous value -1?
  56444. beq.s + ; Branch if yes (end of array)
  56445. move.b 1(a2),slot1_targ(a4) ; Target value for slot 1
  56446. move.b 2(a2),slot23_targ(a4) ; Target values for slots 2 and 3
  56447. rts
  56448. ; ===========================================================================
  56449. +
  56450. move.b d0,d1 ; Copy our 'random' value
  56451. andi.w #7,d1 ; Want only last 3 bits
  56452. lea (SlotSequence1).l,a1 ; Slot sequence array for slot 1
  56453. move.b (a1,d0.w),slot1_targ(a4) ; Uhhh... use d0 as array index? This should have been d1! Anyway, set slot 1 target
  56454. ror.b #3,d0 ; Rotate it
  56455. move.b d0,d1 ; Copy it
  56456. andi.w #7,d1 ; Want only last 3 bits
  56457. lea (SlotSequence2).l,a1 ; Slot sequence array for slot 2
  56458. move.b (a1,d1.w),d2 ; Use as array index
  56459. lsl.b #4,d2 ; Move to high nibble
  56460. ror.b #3,d0 ; Rotate it again
  56461. andi.w #7,d0 ; Want only last 3 bits
  56462. lea (SlotSequence3).l,a1 ; Slot sequence array for slot 3
  56463. or.b (a1,d0.w),d2 ; Combine with earlier value
  56464. move.b d2,slot23_targ(a4) ; Target values for slots 2 and 3
  56465. rts
  56466. ; ===========================================================================
  56467. ; loc_2C070:
  56468. SlotMachine_Routine4:
  56469. bsr.w SlotMachine_DrawSlot
  56470. tst.b slot_timer(a4) ; Are slots still going?
  56471. beq.s + ; Branch if not
  56472. rts
  56473. ; ===========================================================================
  56474. +
  56475. addi.b #$30,slot1_speed(a4) ; Increase slot 1 speed
  56476. addi.b #$30,slot2_speed(a4) ; Increase slot 2 speed
  56477. addi.b #$30,slot3_speed(a4) ; Increase slot 3 speed
  56478. move.b (Vint_runcount+3).w,d0 ; 'Random' seed
  56479. andi.b #$F,d0 ; Want only low nibble
  56480. addi.b #$C,d0 ; Increase by $C
  56481. move.b d0,slot_timer(a4) ; New value for slot timer
  56482. clr.b 2(a4) ; Clear otherwise unused variable
  56483. _addq.b #4,slot_rout(a4) ; => SlotMachine_Routine5
  56484. rts
  56485. ; ===========================================================================
  56486. ; loc_2C0A8:
  56487. SlotMachine_Routine5:
  56488. bsr.w SlotMachine_DrawSlot
  56489. cmpi.b #$C,slot1_rout(a4) ; Is slot done?
  56490. bne.s + ; Branch if not
  56491. cmpi.b #$C,slot2_rout(a4) ; Is slot done?
  56492. bne.s + ; Branch if not
  56493. cmpi.b #$C,slot3_rout(a4) ; Is slot done?
  56494. beq.w SlotMachine_Routine6 ; Branch if yes
  56495. +
  56496. moveq #0,d0 ; Clear d0
  56497. move.b slot_index(a4),d0 ; Get current slot index
  56498. lea slots_data(a4),a1 ; a1 = pointer to slots data
  56499. adda.w d0,a1 ; a1 = pointer to current slot data
  56500. lea (SlotSequence1).l,a3 ; Get pointer to slot sequences
  56501. add.w d0,d0 ; Turn into index
  56502. adda.w d0,a3 ; Get sequence for this slot
  56503. moveq #0,d0 ; Clear d0 again
  56504. move.b slot1_rout-slot1_index(a1),d0 ; Slot routine
  56505. jmp SlotMachine_Routine5_JmpTable(pc,d0.w)
  56506. ; ===========================================================================
  56507. ; loc_2C0E6
  56508. SlotMachine_Routine5_JmpTable: ;;
  56509. bra.w SlotMachine_Routine5_1 ; $00
  56510. bra.w SlotMachine_Routine5_2 ; $04
  56511. bra.w SlotMachine_Routine5_3 ; $08
  56512. bra.w SlotMachine_Routine5_4 ; $0C
  56513. ; ===========================================================================
  56514. ;loc_2C0F6
  56515. SlotMachine_GetTargetForSlot:
  56516. move.w slots_targ(a4),d1 ; Get target slot faces
  56517. move.b slot_index(a4),d0 ; Get current slot index
  56518. beq.s + ; Branch if zero
  56519. lsr.w d0,d1 ; Shift slot face into position
  56520. +
  56521. andi.w #7,d1 ; Only 8 slot faces
  56522. cmpi.b #5,d1 ; Is this above bar?
  56523. bgt.s + ; Branch if yes
  56524. rts
  56525. ; ===========================================================================
  56526. +
  56527. subq.b #2,d1 ; Wrap back to ring/bar
  56528. rts
  56529. ; ===========================================================================
  56530. ;loc_2C112
  56531. SlotMachine_ChangeTarget:
  56532. move.w #$FFF0,d2 ; Kept faces mask
  56533. andi.w #$F,d1 ; New slot target
  56534. move.b slot_index(a4),d0 ; Get current slot
  56535. beq.s + ; Branch if it is slot 0
  56536. lsl.w d0,d1 ; Shift new slot target into position
  56537. rol.w d0,d2 ; Shift kept faces mask into position
  56538. +
  56539. and.w d2,slots_targ(a4) ; Mask off current slot
  56540. or.w d1,slots_targ(a4) ; Put in new value for it
  56541. andi.w #$777,slots_targ(a4) ; Slots are only 0-7
  56542. rts
  56543. ; ===========================================================================
  56544. ; loc_2C134:
  56545. SlotMachine_Routine5_1:
  56546. tst.b slot_index(a4) ; Is this slot 1?
  56547. bne.s + ; Branch if not
  56548. tst.b slot_timer(a4) ; Is timer positive or zero?
  56549. bmi.s ++ ; Branch if not
  56550. rts
  56551. ; ===========================================================================
  56552. +
  56553. cmpi.b #8,slot1_rout-slot2_index(a1) ; Is previous slot in state SlotMachine_Routine5_3 or SlotMachine_Routine5_4?
  56554. bge.s + ; Branch if yes
  56555. rts
  56556. ; ===========================================================================
  56557. +
  56558. bsr.s SlotMachine_GetTargetForSlot
  56559. move.w (a1),d0 ; Get current slot index/offset
  56560. subi.w #$A0,d0 ; Subtract 20 lines (2.5 tiles) from it
  56561. lsr.w #8,d0 ; Get effective slot index
  56562. andi.w #7,d0 ; Only want 3 bits
  56563. move.b (a3,d0.w),d0 ; Get face from sequence
  56564. cmp.b d1,d0 ; Are we close to target?
  56565. beq.s + ; Branch if yes
  56566. rts
  56567. ; ===========================================================================
  56568. +
  56569. addq.b #4,slot1_rout-slot1_index(a1) ; => SlotMachine_Routine5_2
  56570. move.b #$60,slot1_speed-slot1_index(a1) ; Decrease slot speed
  56571. rts
  56572. ; ===========================================================================
  56573. ; loc_2C170:
  56574. SlotMachine_Routine5_2:
  56575. bsr.s SlotMachine_GetTargetForSlot
  56576. move.w (a1),d0 ; Get current slot index/offset
  56577. addi.w #$F0,d0 ; Add 30 lines (3.75 tiles) to it
  56578. andi.w #$700,d0 ; Limit to 8 faces
  56579. lsr.w #8,d0 ; Get effective slot index
  56580. move.b (a3,d0.w),d0 ; Get face from sequence
  56581. cmp.b d0,d1 ; Are we this close to target?
  56582. beq.s loc_2C1AE ; Branch if yes
  56583. cmpi.b #$20,slot1_speed-slot1_index(a1) ; Is slot speed more than $20?
  56584. bls.s + ; Branch if not
  56585. subi.b #$C,slot1_speed-slot1_index(a1) ; Reduce slot speed
  56586. +
  56587. cmpi.b #$18,slot1_speed-slot1_index(a1) ; Is slot speed $18 or less?
  56588. bgt.s + ; Branch if not
  56589. rts
  56590. ; ===========================================================================
  56591. +
  56592. cmpi.b #$80,slot1_offset-slot1_index(a1) ; Is offset $80 or less?
  56593. bls.s + ; Branch if yes
  56594. rts
  56595. ; ===========================================================================
  56596. +
  56597. subq.b #2,slot1_speed-slot1_index(a1) ; Reduce slot speed
  56598. rts
  56599. ; ===========================================================================
  56600.  
  56601. loc_2C1AE:
  56602. move.w (a1),d0 ; Get current slot index/offset
  56603. addi.w #$80,d0 ; Subtract 16 lines (2 tiles) to it
  56604. move.w d0,d1 ; Copy to d1
  56605. andi.w #$700,d1 ; Limit to 8 faces
  56606. subi.w #$10,d1 ; Subtract 2 lines (1/4 tile) from it
  56607. move.w d1,(a1) ; Store new value for index/offset
  56608. lsr.w #8,d0 ; Convert to index
  56609. andi.w #7,d0 ; Limit to 8 faces
  56610. move.b (a3,d0.w),d1 ; Get face from sequence
  56611. bsr.w SlotMachine_ChangeTarget ; Set slot index to face number, indtead of sequence index
  56612. move.b #-8,slot1_speed-slot1_index(a1) ; Rotate slowly on the other direction
  56613. addq.b #4,slot1_rout-slot1_index(a1) ; => SlotMachine_Routine5_3
  56614. rts
  56615. ; ===========================================================================
  56616. ; loc_2C1DA:
  56617. SlotMachine_Routine5_3:
  56618. tst.b slot1_offset-slot1_index(a1) ; Is offset zero?
  56619. beq.s + ; Branch if yes
  56620. rts
  56621. ; ===========================================================================
  56622. +
  56623. clr.b slot1_speed-slot1_index(a1) ; Stop slot
  56624. addq.b #4,slot1_rout-slot1_index(a1) ; => SlotMachine_Routine5_4
  56625. rts
  56626. ; ===========================================================================
  56627. ; return_2C1EC:
  56628. SlotMachine_Routine5_4:
  56629. rts
  56630. ; ===========================================================================
  56631. ; loc_2C1EE:
  56632. SlotMachine_Routine6:
  56633. clr.w slot1_speed(a4) ; Stop slot 1
  56634. clr.w slot2_speed(a4) ; Stop slot 2
  56635. clr.w slot3_speed(a4) ; Stop slot 3
  56636. clr.b slot_timer(a4) ; Stop drawing the slots
  56637. bsr.w SlotMachine_ChooseReward
  56638. _move.b #$18,slot_rout(a4) ; => null routine (rts)
  56639. rts
  56640. ; ===========================================================================
  56641. ; loc_2C20A
  56642. SlotMachine_DrawSlot:
  56643. moveq #0,d0 ; Clear d0
  56644. move.b slot_index(a4),d0 ; d0 = index of slot to draw
  56645. lea slots_data(a4),a1 ; a1 = pointer to slots data
  56646. adda.w d0,a1 ; a1 = pointer to current slot data
  56647. lea (SlotSequence1).l,a3 ; Get slot sequence
  56648. adda.w d0,a3 ; Add offset...
  56649. adda.w d0,a3 ; ... twice
  56650. jmp BranchTo_SlotMachine_Subroutine(pc,d0.w)
  56651. ; ===========================================================================
  56652.  
  56653. BranchTo_SlotMachine_Subroutine
  56654. bra.w SlotMachine_Subroutine1 ; $00
  56655. bra.w SlotMachine_Subroutine2 ; $04
  56656. ; bra.w SlotMachine_Subroutine3 ; $08
  56657. ;SlotMachine_Subroutine3:
  56658. clr.b slot_index(a4) ; => SlotMachine_Subroutine1
  56659. subq.b #1,slot_timer(a4) ; Decrease timer
  56660. move.w #tiles_to_bytes(ArtTile_ArtUnc_CNZSlotPics_3),d2 ; DMA destination
  56661. bra.s +
  56662. ; ===========================================================================
  56663. ; loc_2C23A:
  56664. SlotMachine_Subroutine1:
  56665. addq.b #4,slot_index(a4) ; => SlotMachine_Subroutine2
  56666. move.w #tiles_to_bytes(ArtTile_ArtUnc_CNZSlotPics_1),d2 ; DMA destination
  56667. bra.w +
  56668. ; ===========================================================================
  56669. ; loc_2C246:
  56670. SlotMachine_Subroutine2:
  56671. addq.b #4,slot_index(a4) ; => SlotMachine_Subroutine3
  56672. move.w #tiles_to_bytes(ArtTile_ArtUnc_CNZSlotPics_2),d2 ; DMA destination
  56673. +
  56674. move.w (a1),d0 ; Get last pixel offset
  56675. move.b 2(a1),d1 ; Get slot rotation speed
  56676. ext.w d1 ; Extend to word
  56677. sub.w d1,(a1) ; Modify pixel offset
  56678. move.w (a1),d3 ; Get current pixel offset
  56679. andi.w #$7F8,d0 ; Get only desired bits of last pixel offset
  56680. andi.w #$7F8,d3 ; Get only desired bits of current pixel offset
  56681. cmp.w d0,d3 ; Are those equal?
  56682. bne.s + ; Branch if not (need new picture)
  56683. rts
  56684. ; ---------------------------------------------------------------------------
  56685. +
  56686. bsr.w SlotMachine_GetPixelRow ; Get pointer to pixel row
  56687. lea (Block_Table+$1000).w,a1 ; Destination for pixel rows
  56688.  
  56689. move.w #4*8-1,d1 ; Slot picture is 4 tiles
  56690. - move.l $80(a2),$80(a1) ; Copy pixel row for second column
  56691. move.l $100(a2),$100(a1) ; Copy pixel row for third column
  56692. move.l $180(a2),$180(a1) ; Copy pixel row for fourth column
  56693. move.l (a2)+,(a1)+ ; Copy pixel row for first column, advance destination to next line
  56694. addq.b #8,d3 ; Increase offset by 8 (byte operation)
  56695. bne.s + ; If the result is not zero, branch
  56696. addi.w #$100,d3 ; Advance to next slot picture
  56697. andi.w #$700,d3 ; Limit the sequence to 8 pictures
  56698. bsr.w SlotMachine_GetPixelRow ; Need pointer to next pixel row
  56699. +
  56700. dbf d1,- ; Loop for aoo pixel rows
  56701.  
  56702. move.l #(Block_Table+$1000)&$FFFFFF,d1 ; Source
  56703. tst.w (Two_player_mode).w
  56704. beq.s +
  56705. addi.w #tiles_to_bytes(ArtTile_ArtUnc_CNZSlotPics_1_2p-ArtTile_ArtUnc_CNZSlotPics_1),d2
  56706. +
  56707. move.w #$100,d3 ; Number of bytes
  56708. jsr (QueueDMATransfer).l
  56709. rts
  56710. ; ===========================================================================
  56711. ; loc_2C2B8
  56712. SlotMachine_GetPixelRow:
  56713. move.w d3,d0 ; d0 = pixel offset into slot picture
  56714. lsr.w #8,d0 ; Convert offset into index
  56715. andi.w #7,d0 ; Limit each sequence to 8 pictures
  56716. move.b (a3,d0.w),d0 ; Get slot pic id
  56717. andi.w #7,d0 ; Get only lower 3 bits; leaves space for 2 more images
  56718. ror.w #7,d0 ; Equal to shifting left 9 places, or multiplying by 4*4 tiles, in bytes
  56719. lea (ArtUnc_CNZSlotPics).l,a2 ; Load slot pictures
  56720. adda.w d0,a2 ; a2 = pointer to first tile of slot picture
  56721. move.w d3,d0 ; d0 = d3
  56722. andi.w #$F8,d0 ; Strip high word (picture index)
  56723. lsr.w #1,d0 ; Convert into bytes
  56724. adda.w d0,a2 ; a2 = pointer to desired pixel row
  56725. rts
  56726. ; ==========================================================================
  56727. ; loc_2C2DE:
  56728. SlotMachine_ChooseReward:
  56729. move.b slot23_targ(a4),d2 ; Get slots 2 and 3
  56730. move.b d2,d3 ; Copy to d3
  56731. andi.w #$F0,d2 ; Strip off slot 3 nibble
  56732. lsr.w #4,d2 ; Shift slot 2 to position
  56733. andi.w #$F,d3 ; Strip off slot 2 nibble
  56734. moveq #0,d0 ; Clear d0
  56735. cmp.b slot1_targ(a4),d2 ; Are slots 1 and 2 equal?
  56736. bne.s + ; Branch if not
  56737. addq.w #4,d0
  56738. +
  56739. cmp.b slot1_targ(a4),d3 ; Are slots 1 and 3 equal?
  56740. bne.s + ; Branch if not
  56741. addq.w #8,d0
  56742. +
  56743. jmp SlotMachine_ChooseReward_JmpTable(pc,d0.w)
  56744. ; ==========================================================================
  56745. ; loc_2C304:
  56746. SlotMachine_ChooseReward_JmpTable: ;;
  56747. bra.w SlotMachine_Unmatched1 ; $00
  56748. bra.w SlotMachine_Match12 ; $04
  56749. bra.w SlotMachine_Match13 ; $08
  56750. ; ==========================================================================
  56751. ; SlotMachine_TripleMatch:
  56752. move.w d2,d0 ; d0 = reward index
  56753. bsr.w SlotMachine_GetReward
  56754. move.w d0,slots_targ(a4) ; Store reward
  56755. rts
  56756. ; ===========================================================================
  56757. ;loc_2C31C
  56758. SlotMachine_Match13:
  56759. cmpi.b #3,d3 ; is slot 3 a jackpot?
  56760. bne.s + ; Branch if not
  56761. move.w d2,d0 ; Slot 2 is reward index
  56762. bsr.w SlotMachine_GetReward
  56763. bsr.w SlotMachine_QuadrupleUp
  56764. move.w d0,slots_targ(a4) ; Store reward
  56765. rts
  56766. ; ===========================================================================
  56767. +
  56768. cmpi.b #3,d2 ; Is slot 2 a jackpot?
  56769. bne.w SlotMachine_Unmatched1 ; Branch if not
  56770. move.w d3,d0 ; Slot 3 is reward index
  56771. bsr.w SlotMachine_GetReward
  56772. bsr.w SlotMachine_DoubleUp
  56773. move.w d0,slots_targ(a4) ; Store reward
  56774. rts
  56775. ; ===========================================================================
  56776. ;loc_2C34A
  56777. SlotMachine_Match12:
  56778. cmpi.b #3,d2 ; Is slot 2 a jackpot?
  56779. bne.s + ; Branch if not
  56780. move.w d3,d0 ; Slot 3 is reward index
  56781. bsr.s SlotMachine_GetReward
  56782. bsr.w SlotMachine_QuadrupleUp
  56783. move.w d0,slots_targ(a4) ; Store reward
  56784. rts
  56785. ; ===========================================================================
  56786. +
  56787. cmpi.b #3,d3 ; Is slot 3 a jackpot?
  56788. bne.w SlotMachine_Unmatched1 ; Branch if not
  56789. move.w d2,d0 ; Slot 2 is reward index
  56790. bsr.s SlotMachine_GetReward
  56791. bsr.w SlotMachine_DoubleUp
  56792. move.w d0,slots_targ(a4) ; Store reward
  56793. rts
  56794. ; ===========================================================================
  56795. ;loc_2C374
  56796. SlotMachine_Unmatched1:
  56797. cmp.b d2,d3 ; Are slots 2 and 3 equal?
  56798. bne.s SlotMachine_CheckBars ; Branch if not
  56799. cmpi.b #3,slot1_targ(a4) ; Is slot 1 a jackpot?
  56800. bne.s + ; Branch if not
  56801. move.w d2,d0 ; Use slot 2 as reward index
  56802. bsr.s SlotMachine_GetReward
  56803. bsr.w SlotMachine_DoubleUp
  56804. move.w d0,slots_targ(a4) ; Store reward
  56805. rts
  56806. ; ===========================================================================
  56807. +
  56808. cmpi.b #3,d2 ; Is slot 2 a jackpot?
  56809. bne.s SlotMachine_CheckBars ; Branch if not
  56810. move.b slot1_targ(a4),d0 ; Get slot 1 face
  56811. andi.w #$F,d0 ; Strip high nibble
  56812. bsr.s SlotMachine_GetReward
  56813. bsr.w SlotMachine_QuadrupleUp
  56814. move.w d0,slots_targ(a4) ; Store reward
  56815. rts
  56816. ; ===========================================================================
  56817. ;loc_2C3A8
  56818. SlotMachine_CheckBars:
  56819. moveq #2,d1 ; Number of rings per bar
  56820. moveq #0,d0 ; Start with zero
  56821. cmpi.b #5,slot1_targ(a4) ; Is slot 1 a bar?
  56822. bne.s + ; Branch if not
  56823. add.w d1,d0 ; Gain 2 rings
  56824. +
  56825. cmpi.b #5,d2 ; Is slot 2 a bar?
  56826. bne.s + ; Branch if not
  56827. add.w d1,d0 ; Gain 2 rings
  56828. +
  56829. cmpi.b #5,d3 ; Is slot 3 a bar?
  56830. bne.s + ; Branch if not
  56831. add.w d1,d0 ; Gain 2 rings
  56832. +
  56833. move.w d0,slots_targ(a4) ; Store reward
  56834. ; For bars, the code past this line is useless. There should be an rts here.
  56835.  
  56836. ;loc_2C3CA
  56837. SlotMachine_GetReward:
  56838. add.w d0,d0 ; Convert to index
  56839. lea (SlotRingRewards).l,a2 ; Ring reward array
  56840. move.w (a2,d0.w),d0 ; Get ring reward
  56841. rts
  56842. ; ===========================================================================
  56843. ;loc_2C3D8
  56844. SlotMachine_QuadrupleUp:
  56845. asl.w #2,d0 ; Quadruple reward
  56846. rts
  56847. ; ===========================================================================
  56848. ;loc_2C3DC
  56849. SlotMachine_DoubleUp:
  56850. add.w d0,d0 ; Double reward
  56851. rts
  56852.  
  56853. ; ===========================================================================
  56854. ; data for the slot machines
  56855. ;byte_2C3E0
  56856. SlotRingRewards: dc.w 30, 25, -1, 150, 10, 20
  56857. rev02even
  56858. ;byte_2C3EC
  56859. SlotTargetValues: dc.b 8, 3,$33, $12, 0,$00, $12, 1,$11 ,$24, 2,$22
  56860. dc.b $1E, 4,$44, $1E, 5,$55, $FF,$F,$FF
  56861. rev02even
  56862. ;byte_2C401
  56863. SlotSequence1: dc.b 3, 0, 1, 4, 2, 5, 4, 1
  56864. rev02even
  56865. ;byte_2C409
  56866. SlotSequence2: dc.b 3, 0, 1, 4, 2, 5, 0, 2
  56867. rev02even
  56868. ;byte_2C411
  56869. SlotSequence3: dc.b 3, 0, 1, 4, 2, 5, 4, 1
  56870. even
  56871. ; ===========================================================================
  56872.  
  56873. if gameRevision<2
  56874. nop
  56875. endif
  56876.  
  56877. if ~~removeJmpTos
  56878. JmpTo10_SingleObjLoad
  56879. jmp (SingleObjLoad).l
  56880. JmpTo29_MarkObjGone
  56881. jmp (MarkObjGone).l
  56882. JmpTo10_AnimateSprite
  56883. jmp (AnimateSprite).l
  56884. JmpTo6_Adjust2PArtPointer2
  56885. jmp (Adjust2PArtPointer2).l
  56886. JmpTo54_Adjust2PArtPointer
  56887. jmp (Adjust2PArtPointer).l
  56888. JmpTo12_CalcSine
  56889. jmp (CalcSine).l
  56890. JmpTo7_SolidObject_Always_SingleCharacter
  56891. jmp (SolidObject_Always_SingleCharacter).l
  56892.  
  56893. align 4
  56894. endif
  56895.  
  56896.  
  56897.  
  56898.  
  56899. ; ===========================================================================
  56900. ; ----------------------------------------------------------------------------
  56901. ; Object D7 - Bumper from Casino Night Zone
  56902. ; ----------------------------------------------------------------------------
  56903. ; Sprite_2C448:
  56904. ObjD7:
  56905. moveq #0,d0
  56906. move.b routine(a0),d0
  56907. move.w ObjD7_Index(pc,d0.w),d1
  56908. jmp ObjD7_Index(pc,d1.w)
  56909. ; ===========================================================================
  56910. ; off_2C456:
  56911. ObjD7_Index: offsetTable
  56912. offsetTableEntry.w ObjD7_Init ; 0
  56913. offsetTableEntry.w ObjD7_Main ; 2
  56914. ; ===========================================================================
  56915. ; loc_2C45A:
  56916. ObjD7_Init:
  56917. addq.b #2,routine(a0)
  56918. move.l #ObjD7_MapUnc_2C626,mappings(a0)
  56919. move.w #make_art_tile(ArtTile_ArtNem_CNZHexBumper,2,0),art_tile(a0)
  56920. jsrto (Adjust2PArtPointer).l, JmpTo55_Adjust2PArtPointer
  56921. move.b #4,render_flags(a0)
  56922. move.b #$10,width_pixels(a0)
  56923. move.b #1,priority(a0)
  56924. move.b #$CA,collision_flags(a0)
  56925. btst #0,status(a0)
  56926. beq.s +
  56927. move.b #1,objoff_34(a0)
  56928. +
  56929. move.w x_pos(a0),d0
  56930. move.w d0,d1
  56931. subi.w #$60,d0
  56932. move.w d0,objoff_30(a0)
  56933. addi.w #$60,d1
  56934. move.w d1,objoff_32(a0)
  56935. ; loc_2C4AC:
  56936. ObjD7_Main:
  56937. move.b collision_property(a0),d0
  56938. beq.w ObjD7_MainContinued
  56939. lea (MainCharacter).w,a1 ; a1=character
  56940. bclr #0,collision_property(a0)
  56941. beq.s +
  56942. bsr.s ObjD7_BouncePlayerOff
  56943. +
  56944. lea (Sidekick).w,a1 ; a1=character
  56945. bclr #1,collision_property(a0)
  56946. beq.s +
  56947. bsr.s ObjD7_BouncePlayerOff
  56948. +
  56949. clr.b collision_property(a0)
  56950. bra.w ObjD7_MainContinued
  56951. ; ===========================================================================
  56952. ; loc_2C4D8:
  56953. ObjD7_BouncePlayerOff:
  56954. move.w x_pos(a0),d1
  56955. move.w y_pos(a0),d2
  56956. sub.w x_pos(a1),d1
  56957. sub.w y_pos(a1),d2
  56958. jsr (CalcAngle).l
  56959. addi.b #$20,d0
  56960. andi.w #$C0,d0
  56961. cmpi.w #$40,d0
  56962. beq.s ObjD7_BounceDown
  56963. cmpi.w #$80,d0
  56964. beq.s ObjD7_BounceRight
  56965. cmpi.w #$C0,d0
  56966. beq.s ObjD7_BounceUp
  56967. move.w #-$800,x_vel(a1)
  56968. move.b #2,anim(a0)
  56969. bra.s ObjD7_BounceEnd
  56970. ; ===========================================================================
  56971. ; loc_2C516:
  56972. ObjD7_BounceDown:
  56973. subi.w #$200,x_vel(a1)
  56974. tst.w d1
  56975. bpl.s +
  56976. addi.w #$400,x_vel(a1)
  56977. +
  56978. move.w #-$800,y_vel(a1)
  56979. move.b #1,anim(a0)
  56980. bra.s ObjD7_BounceEnd
  56981. ; ===========================================================================
  56982. ; loc_2C534:
  56983. ObjD7_BounceRight:
  56984. move.w #$800,x_vel(a1)
  56985. move.b #2,anim(a0)
  56986. bra.s ObjD7_BounceEnd
  56987. ; ===========================================================================
  56988. ; loc_2C542:
  56989. ObjD7_BounceUp:
  56990. subi.w #$200,x_vel(a1)
  56991. tst.w d1
  56992. bpl.s +
  56993. addi.w #$400,x_vel(a1)
  56994. +
  56995. move.w #$800,y_vel(a1)
  56996. move.b #1,anim(a0)
  56997. ; loc_2C55E:
  56998. ObjD7_BounceEnd:
  56999. bset #1,status(a1)
  57000. bclr #4,status(a1)
  57001. bclr #5,status(a1)
  57002. clr.b jumping(a1)
  57003. move.w #SndID_Bumper,d0
  57004. jmp (PlaySound).l
  57005. ; ===========================================================================
  57006. ; loc_2C57E:
  57007. ObjD7_MainContinued:
  57008. lea (Ani_objD7).l,a1
  57009. jsrto (AnimateSprite).l, JmpTo11_AnimateSprite
  57010. tst.b subtype(a0)
  57011. beq.w JmpTo30_MarkObjGone
  57012. tst.b objoff_34(a0)
  57013. beq.s loc_2C5AE
  57014. move.w x_pos(a0),d0
  57015. subq.w #1,d0
  57016. cmp.w objoff_30(a0),d0
  57017. bne.s +
  57018. move.b #0,objoff_34(a0)
  57019. +
  57020. move.w d0,x_pos(a0)
  57021. bra.s loc_2C5C4
  57022. ; ===========================================================================
  57023.  
  57024. loc_2C5AE:
  57025. move.w x_pos(a0),d0
  57026. addq.w #1,d0
  57027. cmp.w objoff_32(a0),d0
  57028. bne.s +
  57029. move.b #1,objoff_34(a0)
  57030. +
  57031. move.w d0,x_pos(a0)
  57032.  
  57033. loc_2C5C4:
  57034. tst.w (Two_player_mode).w
  57035. beq.s +
  57036. jmpto (DisplaySprite).l, JmpTo30_DisplaySprite
  57037. ; ---------------------------------------------------------------------------
  57038. +
  57039. move.w objoff_30(a0),d0
  57040. andi.w #$FF80,d0
  57041. sub.w (Camera_X_pos_coarse).w,d0
  57042. cmpi.w #$280,d0
  57043. bls.s +
  57044. move.w objoff_32(a0),d0
  57045. andi.w #$FF80,d0
  57046. sub.w (Camera_X_pos_coarse).w,d0
  57047. cmpi.w #$280,d0
  57048. bhi.s loc_2C5F8
  57049. +
  57050. jmp (DisplaySprite).l
  57051. ; ===========================================================================
  57052.  
  57053. loc_2C5F8:
  57054. lea (Object_Respawn_Table).w,a2
  57055. moveq #0,d0
  57056. move.b respawn_index(a0),d0
  57057. beq.s +
  57058. bclr #7,2(a2,d0.w)
  57059. +
  57060. jmp (DeleteObject).l
  57061.  
  57062. if removeJmpTos
  57063. JmpTo30_MarkObjGone
  57064. jmp (MarkObjGone).l
  57065. endif
  57066. ; ===========================================================================
  57067. ; animation script
  57068. ; off_2C610:
  57069. Ani_objD7: offsetTable
  57070. offsetTableEntry.w byte_2C616 ; 0
  57071. offsetTableEntry.w byte_2C619 ; 1
  57072. offsetTableEntry.w byte_2C61F ; 2
  57073. byte_2C616: dc.b $F, 0,$FF
  57074. rev02even
  57075. byte_2C619: dc.b 3, 1, 0, 1,$FD, 0
  57076. rev02even
  57077. byte_2C61F: dc.b 3, 2, 0, 2,$FD, 0
  57078. even
  57079. ; ----------------------------------------------------------------------------
  57080. ; sprite mappings
  57081. ; ----------------------------------------------------------------------------
  57082. ObjD7_MapUnc_2C626: BINCLUDE "mappings/sprite/objD7.bin"
  57083. ; ===========================================================================
  57084.  
  57085. if gameRevision<2
  57086. nop
  57087. endif
  57088.  
  57089. if ~~removeJmpTos
  57090. JmpTo30_DisplaySprite
  57091. jmp (DisplaySprite).l
  57092. JmpTo30_MarkObjGone
  57093. jmp (MarkObjGone).l
  57094. JmpTo11_AnimateSprite
  57095. jmp (AnimateSprite).l
  57096. JmpTo55_Adjust2PArtPointer
  57097. jmp (Adjust2PArtPointer).l
  57098.  
  57099. align 4
  57100. endif
  57101.  
  57102.  
  57103.  
  57104.  
  57105. ; ===========================================================================
  57106. ; ----------------------------------------------------------------------------
  57107. ; Object D8 - Block thingy from CNZ that disappears after 3 hits (UFO saucer-shaped)
  57108. ; ----------------------------------------------------------------------------
  57109. ; Sprite_2C6AC:
  57110. ObjD8:
  57111. moveq #0,d0
  57112. move.b routine(a0),d0
  57113. move.w ObjD8_Index(pc,d0.w),d1
  57114. jmp ObjD8_Index(pc,d1.w)
  57115. ; ===========================================================================
  57116. ; off_2C6BA:
  57117. ObjD8_Index: offsetTable
  57118. offsetTableEntry.w ObjD8_Init ; 0
  57119. offsetTableEntry.w loc_2C6FC ; 2
  57120. offsetTableEntry.w loc_2C884 ; 4
  57121. ; ===========================================================================
  57122. ; loc_2C6C0:
  57123. ObjD8_Init:
  57124. addq.b #2,routine(a0)
  57125. move.l #ObjD8_MapUnc_2C8C4,mappings(a0)
  57126. move.w #make_art_tile(ArtTile_ArtNem_CNZMiniBumper,2,0),art_tile(a0)
  57127. jsrto (Adjust2PArtPointer).l, JmpTo56_Adjust2PArtPointer
  57128. move.b #4,render_flags(a0)
  57129. move.b #$10,width_pixels(a0)
  57130. move.b #1,priority(a0)
  57131. move.b #$D7,collision_flags(a0)
  57132. move.b subtype(a0),d0
  57133. rol.b #2,d0
  57134. andi.b #3,d0
  57135. move.b d0,anim(a0)
  57136.  
  57137. loc_2C6FC:
  57138. move.b collision_property(a0),d0
  57139. bne.w loc_2C70A
  57140. tst.w objoff_30(a0)
  57141. beq.s loc_2C740
  57142.  
  57143. loc_2C70A:
  57144. lea objoff_30(a0),a4
  57145. tst.b (a4)
  57146. beq.s loc_2C716
  57147. subq.b #1,(a4)
  57148. bra.s loc_2C724
  57149. ; ===========================================================================
  57150.  
  57151. loc_2C716:
  57152. lea (MainCharacter).w,a1 ; a1=character
  57153. bclr #0,collision_property(a0)
  57154. beq.s loc_2C724
  57155. bsr.s loc_2C74E
  57156.  
  57157. loc_2C724:
  57158. addq.w #1,a4
  57159. tst.b (a4)
  57160. beq.s loc_2C72E
  57161. subq.b #1,(a4)
  57162. bra.s loc_2C73C
  57163. ; ===========================================================================
  57164.  
  57165. loc_2C72E:
  57166. lea (Sidekick).w,a1 ; a1=character
  57167. bclr #1,collision_property(a0)
  57168. beq.s loc_2C73C
  57169. bsr.s loc_2C74E
  57170.  
  57171. loc_2C73C:
  57172. clr.b collision_property(a0)
  57173.  
  57174. loc_2C740:
  57175. lea (Ani_objD8).l,a1
  57176. jsrto (AnimateSprite).l, JmpTo12_AnimateSprite
  57177. jmpto (MarkObjGone).l, JmpTo31_MarkObjGone
  57178. ; ===========================================================================
  57179.  
  57180. loc_2C74E:
  57181. move.b mapping_frame(a0),d0
  57182. subq.b #3,d0
  57183. beq.s loc_2C75C
  57184. bcc.s loc_2C77A
  57185. addq.b #3,d0
  57186. bne.s loc_2C77A
  57187.  
  57188. loc_2C75C:
  57189. move.b #3,anim(a0)
  57190. move.w #-$700,y_vel(a1)
  57191. move.w y_pos(a0),d2
  57192. sub.w y_pos(a1),d2
  57193. bpl.s BranchTo_loc_2C806
  57194. neg.w y_vel(a1)
  57195.  
  57196. BranchTo_loc_2C806
  57197. bra.w loc_2C806
  57198. ; ===========================================================================
  57199.  
  57200. loc_2C77A:
  57201. subq.b #1,d0
  57202. bne.s loc_2C7EC
  57203. move.b #4,anim(a0)
  57204. move.w #$20,d3
  57205. btst #0,status(a0)
  57206. bne.s loc_2C794
  57207. move.w #$60,d3
  57208.  
  57209. loc_2C794:
  57210. move.w x_vel(a1),d1
  57211. move.w y_vel(a1),d2
  57212. jsr (CalcAngle).l
  57213. sub.w d3,d0
  57214. mvabs.w d0,d1
  57215. neg.w d0
  57216. add.w d3,d0
  57217. cmpi.b #$40,d1
  57218. bhs.s loc_2C7BE
  57219. cmpi.b #$38,d1
  57220. blo.s loc_2C7D0
  57221. move.w d3,d0
  57222. bra.s loc_2C7D0
  57223. ; ===========================================================================
  57224.  
  57225. loc_2C7BE:
  57226. subi.w #$80,d1
  57227. neg.w d1
  57228. cmpi.b #$38,d1
  57229. blo.s loc_2C7D0
  57230. move.w d3,d0
  57231. addi.w #$80,d0
  57232.  
  57233. loc_2C7D0:
  57234. jsr (CalcSine).l
  57235. muls.w #-$700,d1
  57236. asr.l #8,d1
  57237. move.w d1,x_vel(a1)
  57238. muls.w #-$700,d0
  57239. asr.l #8,d0
  57240. move.w d0,y_vel(a1)
  57241. bra.s loc_2C806
  57242. ; ===========================================================================
  57243.  
  57244. loc_2C7EC:
  57245. move.b #5,anim(a0)
  57246. move.w #-$700,x_vel(a1)
  57247. move.w x_pos(a0),d2
  57248. sub.w x_pos(a1),d2
  57249. bpl.s loc_2C806
  57250. neg.w x_vel(a1)
  57251.  
  57252. loc_2C806:
  57253. bset #1,status(a1)
  57254. bclr #4,status(a1)
  57255. bclr #5,status(a1)
  57256. clr.b jumping(a1)
  57257. move.w #SndID_BonusBumper,d0
  57258. jsr (PlaySound).l
  57259. movea.w a1,a3
  57260. moveq #4,d3
  57261. moveq #1,d0
  57262. subi.w #palette_line_1,art_tile(a0)
  57263. bcc.s loc_2C85C
  57264. addi.w #palette_line_1,art_tile(a0)
  57265. move.b #4,routine(a0)
  57266. lea (CNZ_saucer_data).w,a1
  57267. move.b subtype(a0),d1
  57268. andi.w #$3F,d1 ; This means CNZ_saucer_data is only $40 bytes large
  57269. lea (a1,d1.w),a1
  57270. addq.b #1,(a1)
  57271. cmpi.b #3,(a1)
  57272. blo.s loc_2C85C
  57273. moveq #2,d3
  57274. moveq #50,d0
  57275.  
  57276. loc_2C85C:
  57277. jsr (AddPoints2).l
  57278. jsrto (SingleObjLoad).l, JmpTo11_SingleObjLoad
  57279. bne.s loc_2C87E
  57280. _move.b #ObjID_Points,id(a1) ; load obj29
  57281. move.w x_pos(a0),x_pos(a1)
  57282. move.w y_pos(a0),y_pos(a1)
  57283. move.b d3,mapping_frame(a1)
  57284.  
  57285. loc_2C87E:
  57286. move.b #4,(a4)
  57287. rts
  57288. ; ===========================================================================
  57289.  
  57290. loc_2C884:
  57291. lea (Ani_objD8).l,a1
  57292. jsrto (AnimateSprite).l, JmpTo12_AnimateSprite
  57293. cmpi.b #3,anim(a0)
  57294. blo.w JmpTo46_DeleteObject
  57295. jmpto (MarkObjGone).l, JmpTo31_MarkObjGone
  57296.  
  57297. if removeJmpTos
  57298. JmpTo46_DeleteObject
  57299. jmp (DeleteObject).l
  57300. endif
  57301. ; ===========================================================================
  57302. ; animation script
  57303. ; off_2C89C:
  57304. Ani_objD8: offsetTable
  57305. offsetTableEntry.w byte_2C8A8 ; 0
  57306. offsetTableEntry.w byte_2C8AB ; 1
  57307. offsetTableEntry.w byte_2C8AE ; 2
  57308. offsetTableEntry.w byte_2C8B1 ; 3
  57309. offsetTableEntry.w byte_2C8B7 ; 4
  57310. offsetTableEntry.w byte_2C8BD ; 5
  57311. byte_2C8A8: dc.b $F, 0,$FF
  57312. rev02even
  57313. byte_2C8AB: dc.b $F, 1,$FF
  57314. rev02even
  57315. byte_2C8AE: dc.b $F, 2,$FF
  57316. rev02even
  57317. byte_2C8B1: dc.b 3, 3, 0, 3,$FD, 0
  57318. rev02even
  57319. byte_2C8B7: dc.b 3, 4, 1, 4,$FD, 1
  57320. rev02even
  57321. byte_2C8BD: dc.b 3, 5, 2, 5,$FD, 2
  57322. even
  57323. ; ----------------------------------------------------------------------------
  57324. ; sprite mappings
  57325. ; ----------------------------------------------------------------------------
  57326. ObjD8_MapUnc_2C8C4: BINCLUDE "mappings/sprite/objD8.bin"
  57327. ; ===========================================================================
  57328.  
  57329. if ~~removeJmpTos
  57330. JmpTo46_DeleteObject
  57331. jmp (DeleteObject).l
  57332. JmpTo11_SingleObjLoad
  57333. jmp (SingleObjLoad).l
  57334. JmpTo31_MarkObjGone
  57335. jmp (MarkObjGone).l
  57336. JmpTo12_AnimateSprite
  57337. jmp (AnimateSprite).l
  57338. JmpTo56_Adjust2PArtPointer
  57339. jmp (Adjust2PArtPointer).l
  57340.  
  57341. align 4
  57342. endif
  57343.  
  57344.  
  57345.  
  57346.  
  57347. ; ===========================================================================
  57348. ; ----------------------------------------------------------------------------
  57349. ; Object D9 - Invisible sprite that you can hang on to, like the blocks in WFZ
  57350. ; ----------------------------------------------------------------------------
  57351. ; Sprite_2C92C:
  57352. ObjD9:
  57353. moveq #0,d0
  57354. move.b routine(a0),d0
  57355. move.w ObjD9_Index(pc,d0.w),d1
  57356. jmp ObjD9_Index(pc,d1.w)
  57357. ; ===========================================================================
  57358. ; off_2C93A:
  57359. ObjD9_Index: offsetTable
  57360. offsetTableEntry.w ObjD9_Init ; 0
  57361. offsetTableEntry.w ObjD9_Main ; 2
  57362. ; ===========================================================================
  57363. ; loc_2C93E:
  57364. ObjD9_Init:
  57365. addq.b #2,routine(a0)
  57366. move.b #4,render_flags(a0)
  57367. move.b #$18,width_pixels(a0)
  57368. move.b #4,priority(a0)
  57369. ; loc_2C954:
  57370. ObjD9_Main:
  57371. lea objoff_30(a0),a2
  57372. lea (MainCharacter).w,a1 ; a1=character
  57373. move.w (Ctrl_1).w,d0
  57374. bsr.s ObjD9_CheckCharacter
  57375. lea (Sidekick).w,a1 ; a1=character
  57376. addq.w #1,a2
  57377. move.w (Ctrl_2).w,d0
  57378. bsr.s ObjD9_CheckCharacter
  57379. jmpto (MarkObjGone3).l, JmpTo7_MarkObjGone3
  57380. ; ===========================================================================
  57381. ; loc_2C972:
  57382. ObjD9_CheckCharacter:
  57383. tst.b (a2)
  57384. beq.s loc_2C9A0
  57385. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  57386. beq.w ObjD9_CheckCharacter_End
  57387. clr.b obj_control(a1)
  57388. clr.b (a2)
  57389. move.b #$12,2(a2)
  57390. andi.w #(button_up_mask|button_down_mask|button_left_mask|button_right_mask)<<8,d0
  57391. beq.s +
  57392. move.b #$3C,2(a2)
  57393. +
  57394. move.w #-$300,y_vel(a1)
  57395. bra.w ObjD9_CheckCharacter_End
  57396. ; ===========================================================================
  57397.  
  57398. loc_2C9A0:
  57399. tst.b 2(a2)
  57400. beq.s +
  57401. subq.b #1,2(a2)
  57402. bne.w ObjD9_CheckCharacter_End
  57403. +
  57404. move.w x_pos(a1),d0
  57405. sub.w x_pos(a0),d0
  57406. addi.w #$18,d0
  57407. cmpi.w #$30,d0
  57408. bhs.w ObjD9_CheckCharacter_End
  57409. move.w y_pos(a1),d1
  57410. sub.w y_pos(a0),d1
  57411. cmpi.w #$10,d1
  57412. bhs.w ObjD9_CheckCharacter_End
  57413. tst.b obj_control(a1)
  57414. bmi.s ObjD9_CheckCharacter_End
  57415. cmpi.b #6,routine(a1)
  57416. bhs.s ObjD9_CheckCharacter_End
  57417. tst.w (Debug_placement_mode).w
  57418. bne.s ObjD9_CheckCharacter_End
  57419. clr.w x_vel(a1)
  57420. clr.w y_vel(a1)
  57421. clr.w inertia(a1)
  57422. move.w y_pos(a0),y_pos(a1)
  57423. move.b #AniIDSonAni_Hang2,anim(a1)
  57424. move.b #1,obj_control(a1)
  57425. move.b #1,(a2)
  57426. ; return_2CA08:
  57427. ObjD9_CheckCharacter_End:
  57428. rts
  57429. ; ===========================================================================
  57430.  
  57431. if gameRevision<2
  57432. nop
  57433. endif
  57434.  
  57435. if ~~removeJmpTos
  57436. JmpTo7_MarkObjGone3
  57437. jmp (MarkObjGone3).l
  57438.  
  57439. align 4
  57440. endif
  57441.  
  57442.  
  57443.  
  57444.  
  57445. ; ===========================================================================
  57446. ; ----------------------------------------------------------------------------
  57447. ; Object 4A - Octus (octopus badnik) from OOZ
  57448. ; ----------------------------------------------------------------------------
  57449. octus_start_position = objoff_2A
  57450. ; Sprite_2CA14:
  57451. Obj4A:
  57452. moveq #0,d0
  57453. move.b routine(a0),d0
  57454. move.w Obj4A_Index(pc,d0.w),d1
  57455. jmp Obj4A_Index(pc,d1.w)
  57456. ; ===========================================================================
  57457. ; off_2CA22:
  57458. Obj4A_Index: offsetTable
  57459. offsetTableEntry.w Obj4A_Init ; 0
  57460. offsetTableEntry.w Obj4A_Main ; 2
  57461. offsetTableEntry.w Obj4A_Angry ; 4 - unused
  57462. offsetTableEntry.w Obj4A_Bullet ; 6
  57463. ; ===========================================================================
  57464. ; loc_2CA2A:
  57465. Obj4A_Bullet:
  57466. subi_.w #1,objoff_2C(a0)
  57467. bmi.s +
  57468. rts
  57469. ; ---------------------------------------------------------------------------
  57470. +
  57471. jsrto (ObjectMove).l, JmpTo19_ObjectMove
  57472. lea (Ani_obj4A).l,a1
  57473. jsrto (AnimateSprite).l, JmpTo13_AnimateSprite
  57474. jmpto (MarkObjGone).l, JmpTo32_MarkObjGone
  57475. ; ===========================================================================
  57476. ; loc_2CA46:
  57477. Obj4A_Angry: ; Used by removed sub-object
  57478. subq.w #1,objoff_2C(a0)
  57479. beq.w JmpTo47_DeleteObject
  57480. jmpto (DisplaySprite).l, JmpTo31_DisplaySprite
  57481.  
  57482. if removeJmpTos
  57483. JmpTo47_DeleteObject
  57484. jmp (DeleteObject).l
  57485. endif
  57486. ; ===========================================================================
  57487. ; loc_2CA52:
  57488. Obj4A_Init:
  57489. move.l #Obj4A_MapUnc_2CBFE,mappings(a0)
  57490. move.w #make_art_tile(ArtTile_ArtNem_Octus,1,0),art_tile(a0)
  57491. ori.b #4,render_flags(a0)
  57492. move.b #$A,collision_flags(a0)
  57493. move.b #4,priority(a0)
  57494. move.b #$10,width_pixels(a0)
  57495. move.b #$B,y_radius(a0)
  57496. move.b #8,x_radius(a0)
  57497. jsrto (ObjectMoveAndFall).l, JmpTo2_ObjectMoveAndFall
  57498. jsr (ObjCheckFloorDist).l
  57499. tst.w d1
  57500. bpl.s +
  57501. add.w d1,y_pos(a0)
  57502. move.w #0,y_vel(a0)
  57503. addq.b #2,routine(a0)
  57504. move.w x_pos(a0),d0
  57505. sub.w (MainCharacter+x_pos).w,d0
  57506. bpl.s +
  57507. bchg #0,status(a0)
  57508. +
  57509. move.w y_pos(a0),octus_start_position(a0)
  57510. rts
  57511. ; ===========================================================================
  57512. ; loc_2CAB8:
  57513. Obj4A_Main:
  57514. moveq #0,d0
  57515. move.b routine_secondary(a0),d0
  57516. move.w Obj4A_Main_Index(pc,d0.w),d1
  57517. jsr Obj4A_Main_Index(pc,d1.w)
  57518. lea (Ani_obj4A).l,a1
  57519. jsrto (AnimateSprite).l, JmpTo13_AnimateSprite
  57520. jmpto (MarkObjGone).l, JmpTo32_MarkObjGone
  57521. ; ===========================================================================
  57522. ; off_2CAD4:
  57523. Obj4A_Main_Index: offsetTable
  57524. offsetTableEntry.w Obj4A_WaitForCharacter ; 0
  57525. offsetTableEntry.w Obj4A_DelayBeforeMoveUp ; 2
  57526. offsetTableEntry.w Obj4A_MoveUp ; 4
  57527. offsetTableEntry.w Obj4A_Hover ; 6
  57528. offsetTableEntry.w Obj4A_MoveDown ; 8
  57529. ; ===========================================================================
  57530. ; loc_2CADE:
  57531. Obj4A_WaitForCharacter:
  57532. move.w x_pos(a0),d0
  57533. sub.w (MainCharacter+x_pos).w,d0
  57534. cmpi.w #$80,d0
  57535. bgt.s + ; rts
  57536. cmpi.w #-$80,d0
  57537. blt.s + ; rts
  57538. addq.b #2,routine_secondary(a0)
  57539. move.b #3,anim(a0)
  57540. move.w #$20,objoff_2C(a0)
  57541. +
  57542. rts
  57543. ; ===========================================================================
  57544. ; loc_2CB04:
  57545. Obj4A_DelayBeforeMoveUp:
  57546. subq.w #1,objoff_2C(a0)
  57547. bmi.s +
  57548. rts
  57549. ; ---------------------------------------------------------------------------
  57550. +
  57551. addq.b #2,routine_secondary(a0)
  57552. move.b #4,anim(a0)
  57553. move.w #-$200,y_vel(a0)
  57554. jmpto (ObjectMove).l, JmpTo19_ObjectMove
  57555. ; ===========================================================================
  57556. ; loc_2CB20:
  57557. Obj4A_MoveUp:
  57558. addi.w #$10,y_vel(a0)
  57559. bpl.s +
  57560. jmpto (ObjectMove).l, JmpTo19_ObjectMove
  57561. ; ===========================================================================
  57562. +
  57563. addq.b #2,routine_secondary(a0)
  57564. move.w #$3C,objoff_2C(a0)
  57565. bra.w Obj4A_FireBullet
  57566. ; ===========================================================================
  57567. ; loc_2CB3A:
  57568. Obj4A_Hover:
  57569. subq.w #1,objoff_2C(a0)
  57570. bmi.s +
  57571. rts
  57572. ; ---------------------------------------------------------------------------
  57573. +
  57574. addq.b #2,routine_secondary(a0)
  57575. rts
  57576. ; ===========================================================================
  57577. ; loc_2CB48:
  57578. Obj4A_MoveDown:
  57579. addi.w #$10,y_vel(a0)
  57580. move.w y_pos(a0),d0
  57581. cmp.w octus_start_position(a0),d0
  57582. bhs.s +
  57583. jmpto (ObjectMove).l, JmpTo19_ObjectMove
  57584. ; ===========================================================================
  57585. +
  57586. clr.b routine_secondary(a0)
  57587. clr.b anim(a0)
  57588. clr.w y_vel(a0)
  57589. move.b #1,mapping_frame(a0)
  57590. rts
  57591. ; ===========================================================================
  57592. ; loc_2CB70:
  57593. Obj4A_FireBullet:
  57594. ; In the Simon Wai beta, the object loads another object
  57595. ; here, which makes it look angry as it fires.
  57596. ; This object would have used Obj4A_Angry.
  57597. jsr (SingleObjLoad).l
  57598. bne.s + ; rts
  57599. _move.b #ObjID_Octus,id(a1) ; load obj4A
  57600. move.b #6,routine(a1)
  57601. move.l #Obj4A_MapUnc_2CBFE,mappings(a1)
  57602. move.w #make_art_tile(ArtTile_ArtNem_Octus,1,0),art_tile(a1)
  57603. move.b #4,priority(a1)
  57604. move.b #$10,width_pixels(a1)
  57605. move.w x_pos(a0),x_pos(a1)
  57606. move.w y_pos(a0),y_pos(a1)
  57607. move.w #$F,objoff_2C(a1)
  57608. move.b render_flags(a0),render_flags(a1)
  57609. move.b status(a0),status(a1)
  57610. move.b #2,anim(a1)
  57611. move.b #$98,collision_flags(a1)
  57612. move.w #-$200,x_vel(a1)
  57613. btst #0,render_flags(a1)
  57614. beq.s + ; rts
  57615. neg.w x_vel(a1)
  57616. +
  57617. rts
  57618. ; ===========================================================================
  57619. ; animation script
  57620. ; off_2CBDC:
  57621. Ani_obj4A: offsetTable
  57622. offsetTableEntry.w byte_2CBE6 ; 0
  57623. offsetTableEntry.w byte_2CBEA ; 1
  57624. offsetTableEntry.w byte_2CBEF ; 2
  57625. offsetTableEntry.w byte_2CBF4 ; 3
  57626. offsetTableEntry.w byte_2CBF8 ; 4
  57627. byte_2CBE6: dc.b $F, 1, 0,$FF
  57628. rev02even
  57629. byte_2CBEA: dc.b 3, 1, 2, 3,$FF
  57630. rev02even
  57631. byte_2CBEF: dc.b 2, 5, 6,$FF
  57632. even
  57633. byte_2CBF4: dc.b $F, 4,$FF
  57634. even
  57635. byte_2CBF8: dc.b 7, 0, 1,$FD, 1
  57636. even
  57637. ; ----------------------------------------------------------------------------
  57638. ; sprite mappings
  57639. ; ----------------------------------------------------------------------------
  57640. Obj4A_MapUnc_2CBFE: BINCLUDE "mappings/sprite/obj4A.bin"
  57641.  
  57642. if ~~removeJmpTos
  57643. align 4
  57644. endif
  57645. ; ===========================================================================
  57646.  
  57647. if ~~removeJmpTos
  57648. JmpTo31_DisplaySprite
  57649. jmp (DisplaySprite).l
  57650. JmpTo47_DeleteObject
  57651. jmp (DeleteObject).l
  57652. JmpTo32_MarkObjGone
  57653. jmp (MarkObjGone).l
  57654. JmpTo13_AnimateSprite
  57655. jmp (AnimateSprite).l
  57656. JmpTo2_ObjectMoveAndFall
  57657. jmp (ObjectMoveAndFall).l
  57658. ; loc_2CCC2:
  57659. JmpTo19_ObjectMove
  57660. jmp (ObjectMove).l
  57661.  
  57662. align 4
  57663. endif
  57664.  
  57665.  
  57666.  
  57667.  
  57668. ; ===========================================================================
  57669. ; ----------------------------------------------------------------------------
  57670. ; Object 50 - Aquis (seahorse badnik) from OOZ
  57671. ; ----------------------------------------------------------------------------
  57672. ; OST Variables:
  57673. Obj50_unkown1 = objoff_2A ; word
  57674. Obj50_shooting_flag = objoff_2D ; byte ; if set, shooting is disabled
  57675. Obj50_shots_remaining = objoff_2E ; word ; number of shots before retreating
  57676. Obj50_unkown2 = objoff_30 ; word
  57677. Obj50_unkown3 = objoff_32 ; word
  57678. Obj50_unkown4 = objoff_34 ; word
  57679. Obj50_child = objoff_36 ; long ; pointer to wing object (main)
  57680. Obj50_parent = objoff_36 ; long ; pointer to main object (wing)
  57681. Obj50_unkown5 = objoff_3A ; word
  57682. Obj50_timer = objoff_3C ; byte ; time spent following the player before shooting and time to wait before actually shooting
  57683.  
  57684. ; Sprite_2CCC8:
  57685. Obj50:
  57686. moveq #0,d0
  57687. move.b routine(a0),d0
  57688. move.w Obj50_Index(pc,d0.w),d1
  57689. jmp Obj50_Index(pc,d1.w)
  57690. ; ===========================================================================
  57691. ; off_2CCD6:
  57692. Obj50_Index: offsetTable
  57693. offsetTableEntry.w Obj50_Init ; 0
  57694. offsetTableEntry.w Obj50_Main ; 2
  57695. offsetTableEntry.w Obj50_Wing ; 4
  57696. offsetTableEntry.w Obj50_Bullet ; 6
  57697. ; ===========================================================================
  57698. ; loc_2CCDE:
  57699. Obj50_Init:
  57700. addq.b #2,routine(a0)
  57701. move.l #Obj50_MapUnc_2CF94,mappings(a0)
  57702. move.w #make_art_tile(ArtTile_ArtNem_Aquis,1,0),art_tile(a0)
  57703. ori.b #4,render_flags(a0)
  57704. move.b #$A,collision_flags(a0)
  57705. move.b #4,priority(a0)
  57706. move.b #$10,width_pixels(a0)
  57707. move.w #-$100,x_vel(a0)
  57708. move.b subtype(a0),d0
  57709. move.b d0,d1
  57710. andi.w #$F0,d1
  57711. lsl.w #4,d1
  57712. move.w d1,Obj50_shots_remaining(a0) ; looks like the number of shots could be set via subtype at one point
  57713. move.w d1,Obj50_unkown2(a0) ; unused
  57714. andi.w #$F,d0
  57715. lsl.w #4,d0
  57716. subq.w #1,d0
  57717. move.w d0,Obj50_unkown3(a0) ; unused
  57718. move.w d0,Obj50_unkown4(a0) ; unused
  57719. move.w y_pos(a0),Obj50_unkown1(a0) ; unused
  57720. move.w (Water_Level_1).w,Obj50_unkown5(a0)
  57721. move.b #3,Obj50_shots_remaining(a0) ; hardcoded to three shots
  57722.  
  57723. ; creat wing child object
  57724. jsrto (SingleObjLoad).l, JmpTo12_SingleObjLoad
  57725. bne.s Obj50_Main
  57726.  
  57727. _move.b #ObjID_Aquis,id(a1) ; load obj50
  57728. move.b #4,routine(a1) ; => Obj50_Wing
  57729. move.w x_pos(a0),x_pos(a1)
  57730. move.w y_pos(a0),y_pos(a1)
  57731. addi.w #$A,x_pos(a1)
  57732. addi.w #-6,y_pos(a1)
  57733. move.l #Obj50_MapUnc_2CF94,mappings(a1)
  57734. move.w #make_art_tile(ArtTile_ArtNem_Aquis,1,0),art_tile(a1)
  57735. ori.b #4,render_flags(a1)
  57736. move.b #3,priority(a1)
  57737. move.b status(a0),status(a1)
  57738. move.b #3,anim(a1)
  57739. move.l a1,Obj50_child(a0)
  57740. move.l a0,Obj50_parent(a1)
  57741. bset #6,status(a0) ; set compund sprite flag. This is useless, as the object doesn't define any child spites, nor does it set its child sprite count
  57742. ; loc_2CDA2:
  57743. Obj50_Main:
  57744. lea (Ani_obj50).l,a1
  57745. jsrto (AnimateSprite).l, JmpTo14_AnimateSprite
  57746. moveq #0,d0
  57747. move.b routine_secondary(a0),d0
  57748. move.w Obj50_Main_Index(pc,d0.w),d1
  57749. jsr Obj50_Main_Index(pc,d1.w)
  57750. bsr.w Obj50_ControlWing
  57751. jmpto (MarkObjGone).l, JmpTo33_MarkObjGone
  57752. ; ===========================================================================
  57753. ; off_2CDC2:
  57754. Obj50_Main_Index: offsetTable
  57755. offsetTableEntry.w Obj50_CheckIfOnScreen ; 0
  57756. offsetTableEntry.w Obj50_Chase ; 2
  57757. offsetTableEntry.w Obj50_Shooting ; 4
  57758. offsetTableEntry.w BranchTo_JmpTo20_ObjectMove ; 6
  57759. ; ===========================================================================
  57760. ; loc_2CDCA:
  57761. Obj50_Wing:
  57762. movea.l Obj50_parent(a0),a1 ; a1=object
  57763. tst.b id(a1) ; is parent object's slot empty?
  57764. beq.w JmpTo48_DeleteObject ; if yes, branch
  57765. cmpi.b #ObjID_Aquis,(a1) ; is parent object ObjID_Aquis?
  57766. bne.w JmpTo48_DeleteObject ; if not, branch
  57767. btst #7,status(a1) ; is parent object marked as destroyed?
  57768. bne.w JmpTo48_DeleteObject ; if yes, branch
  57769. lea (Ani_obj50).l,a1
  57770. jsrto (AnimateSprite).l, JmpTo14_AnimateSprite
  57771. jmpto (DisplaySprite).l, JmpTo32_DisplaySprite
  57772. ; ===========================================================================
  57773. ; loc_2CDF4:
  57774. Obj50_Bullet:
  57775. jsrto (ObjectMove).l, JmpTo20_ObjectMove
  57776. lea (Ani_obj50).l,a1
  57777. jsrto (AnimateSprite).l, JmpTo14_AnimateSprite
  57778. jmpto (MarkObjGone).l, JmpTo33_MarkObjGone
  57779. ; ===========================================================================
  57780. ; wait and do nothing until on screen
  57781. ; loc_2CE06:
  57782. Obj50_CheckIfOnScreen:
  57783. tst.b render_flags(a0)
  57784. bmi.s +
  57785. rts
  57786. ; ===========================================================================
  57787. +
  57788. addq.b #2,routine_secondary(a0) ; => Obj50_Chase
  57789. rts
  57790. ; ===========================================================================
  57791. ; loc_2CE14:
  57792. Obj50_Chase:
  57793. bsr.w Obj50_FollowPlayer
  57794. rts
  57795. ; ===========================================================================
  57796. ; loc_2CE1A:
  57797. Obj50_Shooting:
  57798. bsr.w Obj50_WaitForNextShot
  57799. bsr.w Obj50_ChkIfShoot
  57800. rts
  57801. ; ===========================================================================
  57802. ; loc_2CE24:
  57803. Obj50_ChkIfShoot:
  57804. tst.b Obj50_shooting_flag(a0) ; is object allowed to shoot?
  57805. bne.w return_2CEAC ; if not, branch
  57806. st Obj50_shooting_flag(a0) ; else, disallow shooting after this
  57807. jsrto (Obj_GetOrientationToPlayer).l, JmpTo_Obj_GetOrientationToPlayer
  57808. tst.w d1 ; is player above object?
  57809. beq.s return_2CEAC ; if yes, don't shoot
  57810. cmpi.w #$FFF0,d1 ; ? d1 should only be 0 or 2 here...
  57811. bhs.s return_2CEAC
  57812.  
  57813. ; shoot bullet
  57814. jsrto (SingleObjLoad).l, JmpTo12_SingleObjLoad
  57815. bne.s return_2CEAC
  57816. _move.b #ObjID_Aquis,id(a1) ; load obj50
  57817. move.b #6,routine(a1) ; => Obj50_Bullet
  57818. move.w x_pos(a0),x_pos(a1) ; align with parent object
  57819. move.w y_pos(a0),y_pos(a1)
  57820. move.l #Obj50_MapUnc_2CF94,mappings(a1)
  57821. move.w #make_art_tile(ArtTile_ArtNem_Aquis,1,0),art_tile(a1)
  57822. ori.b #4,render_flags(a1)
  57823. move.b #3,priority(a1)
  57824. move.b #$98,collision_flags(a1)
  57825. move.b #2,anim(a1)
  57826. move.w #$A,d0 ; set y offset
  57827. move.w #$10,d1 ; set x offset
  57828. move.w #-$300,d2 ; set x velocity
  57829. btst #0,status(a0) ; is object facing right?
  57830. beq.s + ; if yes, branch
  57831. neg.w d1 ; else, align bullet with other side of object...
  57832. neg.w d2 ; ... and move in the opposite direction
  57833. +
  57834. sub.w d0,y_pos(a1)
  57835. sub.w d1,x_pos(a1)
  57836. move.w d2,x_vel(a1)
  57837. move.w #$200,y_vel(a1)
  57838.  
  57839. return_2CEAC:
  57840. rts
  57841. ; ===========================================================================
  57842. ; follow player for a while; target is whichever character is the closest
  57843. ; loc_2CEAE:
  57844. Obj50_FollowPlayer:
  57845. subq.b #1,Obj50_timer(a0)
  57846. bmi.s Obj50_DoneFollowing ; branch, if counter has expired
  57847. jsrto (Obj_GetOrientationToPlayer).l, JmpTo_Obj_GetOrientationToPlayer
  57848. bclr #0,status(a0) ; face right
  57849. tst.w d0
  57850. beq.s + ; branch, if player is right from object
  57851. bset #0,status(a0) ; otherwise, face left
  57852. +
  57853. ; make object move towards player; d0 and d1 were set by the GetOrientationToPlayer routine
  57854. move.w Obj50_Speeds(pc,d0.w),d2
  57855. add.w d2,x_vel(a0)
  57856. move.w Obj50_Speeds(pc,d1.w),d2
  57857. add.w d2,y_vel(a0)
  57858. move.w #$100,d0 ; $100 is object's max x...
  57859. move.w d0,d1 ; ... and y velocity
  57860. jsrto (Obj_CapSpeed).l, JmpTo_Obj_CapSpeed
  57861. jmpto (ObjectMove).l, JmpTo20_ObjectMove
  57862. ; ===========================================================================
  57863. ; word_2CEE6:
  57864. Obj50_Speeds:
  57865. dc.w -$10 ; 0 - left/up
  57866. dc.w $10 ; 2 - right/down
  57867. ; ===========================================================================
  57868. ; loc_2CEEA:
  57869. Obj50_DoneFollowing:
  57870. addq.b #2,routine_secondary(a0) ; => Obj50_Shooting
  57871. move.b #$20,Obj50_timer(a0)
  57872. jmpto (Obj_MoveStop).l, JmpTo_Obj_MoveStop
  57873. ; ===========================================================================
  57874. ; loc_2CEF8:
  57875. Obj50_WaitForNextShot:
  57876. subq.b #1,Obj50_timer(a0) ; wait for a while
  57877. bmi.s + ; branch, if counter has expired
  57878. rts
  57879. ; ===========================================================================
  57880. + ; check if object is out of shots and flee if it is
  57881. subq.b #1,Obj50_shots_remaining(a0)
  57882. bmi.s Obj50_GoAway ; branch, if object is out of atttacks
  57883. ; otherwise, shoot and return to chasing the player
  57884. subq.b #2,routine_secondary(a0) ; => Obj50_Chase
  57885. move.w #-$100,y_vel(a0)
  57886. move.b #$80,Obj50_timer(a0) ; reset timer
  57887. clr.b Obj50_shooting_flag(a0) ; reenbale shooting
  57888. rts
  57889. ; ===========================================================================
  57890. ; loc_2CF1C:
  57891. Obj50_GoAway:
  57892. move.b #6,routine_secondary(a0) ; => BranchTo_JmpTo20_ObjectMove
  57893. move.w #-$200,x_vel(a0) ; fly off to the left
  57894. clr.w y_vel(a0)
  57895. rts
  57896. ; ===========================================================================
  57897.  
  57898. BranchTo_JmpTo20_ObjectMove
  57899. jmpto (ObjectMove).l, JmpTo20_ObjectMove
  57900. ; ===========================================================================
  57901. ; loc_2CF32:
  57902. Obj50_ControlWing:
  57903. moveq #$A,d0 ; x offset
  57904. moveq #-6,d1 ; y offset
  57905. movea.l Obj50_child(a0),a1 ; a1=object
  57906. move.w x_pos(a0),x_pos(a1) ; align child with parent object
  57907. move.w y_pos(a0),y_pos(a1)
  57908. move.b status(a0),status(a1)
  57909. move.b respawn_index(a0),respawn_index(a1)
  57910. move.b render_flags(a0),render_flags(a1)
  57911. btst #0,status(a1) ; is object facing right?
  57912. beq.s + ; if yes, branch
  57913. neg.w d0 ; else, align wing with other side of object
  57914. +
  57915. add.w d0,x_pos(a1)
  57916. add.w d1,y_pos(a1)
  57917. rts
  57918. ; ===========================================================================
  57919. ; animation script
  57920. ; off_2CF6C:
  57921. Ani_obj50: offsetTable
  57922. offsetTableEntry.w Ani_obj50_Normal ; 0
  57923. offsetTableEntry.w byte_2CF7B ; 1
  57924. offsetTableEntry.w Ani_obj50_Bullet ; 2
  57925. offsetTableEntry.w Ani_obj50_Wing ; 3
  57926. offsetTableEntry.w byte_2CF8D ; 4
  57927. offsetTableEntry.w byte_2CF90 ; 5
  57928. Ani_obj50_Normal: dc.b $E, 0,$FF ; byte_2CF78
  57929. rev02even
  57930. byte_2CF7B: dc.b 5, 3, 4, 3, 4, 3, 4,$FF
  57931. rev02even
  57932. Ani_obj50_Bullet: dc.b 3, 5, 6, 7, 6,$FF ; byte_2CF83
  57933. rev02even
  57934. Ani_obj50_Wing: dc.b 3, 1, 2,$FF ; byte_2CF89
  57935. rev02even
  57936. byte_2CF8D: dc.b 1, 5,$FF
  57937. rev02even
  57938. byte_2CF90: dc.b $E, 8,$FF
  57939. even
  57940. ; ----------------------------------------------------------------------------
  57941. ; sprite mappings
  57942. ; ----------------------------------------------------------------------------
  57943. Obj50_MapUnc_2CF94: BINCLUDE "mappings/sprite/obj50.bin"
  57944. ; ===========================================================================
  57945.  
  57946. if ~~removeJmpTos
  57947. JmpTo32_DisplaySprite
  57948. jmp (DisplaySprite).l
  57949. JmpTo48_DeleteObject
  57950. jmp (DeleteObject).l
  57951. JmpTo12_SingleObjLoad
  57952. jmp (SingleObjLoad).l
  57953. JmpTo33_MarkObjGone
  57954. jmp (MarkObjGone).l
  57955. JmpTo14_AnimateSprite
  57956. jmp (AnimateSprite).l
  57957. JmpTo_Obj_GetOrientationToPlayer
  57958. jmp (Obj_GetOrientationToPlayer).l
  57959. JmpTo_Obj_CapSpeed
  57960. jmp (Obj_CapSpeed).l
  57961. JmpTo_Obj_MoveStop
  57962. jmp (Obj_MoveStop).l
  57963. ; loc_2D060:
  57964. JmpTo20_ObjectMove
  57965. jmp (ObjectMove).l
  57966.  
  57967. align 4
  57968. else
  57969. JmpTo48_DeleteObject
  57970. jmp (DeleteObject).l
  57971. endif
  57972.  
  57973.  
  57974.  
  57975.  
  57976. ; ===========================================================================
  57977. ; ----------------------------------------------------------------------------
  57978. ; Object 4B - Buzzer (Buzz bomber) from EHZ
  57979. ; ----------------------------------------------------------------------------
  57980. ; OST Variables:
  57981. Obj4B_parent = objoff_2A ; long
  57982. Obj4B_move_timer = objoff_2E ; word
  57983. Obj4B_turn_delay = objoff_30 ; word
  57984. Obj4B_shooting_flag = objoff_32 ; byte
  57985. Obj4B_shot_timer = objoff_34 ; word
  57986.  
  57987. ; Sprite_2D068: ; Obj_Buzzer:
  57988. Obj4B:
  57989. moveq #0,d0
  57990. move.b routine(a0),d0
  57991. move.w Obj4B_Index(pc,d0.w),d1
  57992. jmp Obj4B_Index(pc,d1.w)
  57993. ; ===========================================================================
  57994. ; off_2D076:
  57995. Obj4B_Index: offsetTable
  57996. offsetTableEntry.w Obj4B_Init ; 0
  57997. offsetTableEntry.w Obj4B_Main ; 2
  57998. offsetTableEntry.w Obj4B_Flame ; 4
  57999. offsetTableEntry.w Obj4B_Projectile ; 6
  58000. ; ===========================================================================
  58001. ; loc_2D07E:
  58002. Obj4B_Projectile:
  58003. jsrto (ObjectMove).l, JmpTo21_ObjectMove
  58004. lea (Ani_obj4B).l,a1
  58005. jsrto (AnimateSprite).l, JmpTo15_AnimateSprite
  58006. jmpto (MarkObjGone_P1).l, JmpTo_MarkObjGone_P1
  58007. ; ===========================================================================
  58008. ; loc_2D090:
  58009. Obj4B_Flame:
  58010. movea.l Obj4B_parent(a0),a1 ; a1=object
  58011. tst.b id(a1)
  58012. beq.w JmpTo49_DeleteObject ; branch, if object slot is empty. This check is incomplete and very unreliable; check Obj50_Wing to see how it should be done
  58013. tst.w Obj4B_turn_delay(a1)
  58014. bmi.s + ; branch, if parent isn't currently turning around
  58015. rts
  58016. ; ---------------------------------------------------------------------------
  58017. + ; follow parent object
  58018. move.w x_pos(a1),x_pos(a0)
  58019. move.w y_pos(a1),y_pos(a0)
  58020. move.b status(a1),status(a0)
  58021. move.b render_flags(a1),render_flags(a0)
  58022. lea (Ani_obj4B).l,a1
  58023. jsrto (AnimateSprite).l, JmpTo15_AnimateSprite
  58024. jmpto (MarkObjGone_P1).l, JmpTo_MarkObjGone_P1
  58025. ; ===========================================================================
  58026. ; loc_2D0C8:
  58027. Obj4B_Init:
  58028. move.l #Obj4B_MapUnc_2D2EA,mappings(a0)
  58029. move.w #make_art_tile(ArtTile_ArtNem_Buzzer,0,0),art_tile(a0)
  58030. jsrto (Adjust2PArtPointer).l, JmpTo57_Adjust2PArtPointer
  58031. ori.b #4,render_flags(a0)
  58032. move.b #$A,collision_flags(a0)
  58033. move.b #4,priority(a0)
  58034. move.b #$10,width_pixels(a0)
  58035. move.b #$10,y_radius(a0)
  58036. move.b #$18,x_radius(a0)
  58037. move.b #3,priority(a0)
  58038. addq.b #2,routine(a0) ; => Obj4B_Main
  58039.  
  58040. ; load exhaust flame object
  58041. jsrto (SingleObjLoad2).l, JmpTo20_SingleObjLoad2
  58042. bne.s + ; rts
  58043.  
  58044. _move.b #ObjID_Buzzer,id(a1) ; load obj4B
  58045. move.b #4,routine(a1) ; => Obj4B_Flame
  58046. move.l #Obj4B_MapUnc_2D2EA,mappings(a1)
  58047. move.w #make_art_tile(ArtTile_ArtNem_Buzzer,0,0),art_tile(a1)
  58048. jsrto (Adjust2PArtPointer2).l, JmpTo7_Adjust2PArtPointer2
  58049. move.b #4,priority(a1)
  58050. move.b #$10,width_pixels(a1)
  58051. move.b status(a0),status(a1)
  58052. move.b render_flags(a0),render_flags(a1)
  58053. move.b #1,anim(a1)
  58054. move.l a0,Obj4B_parent(a1)
  58055. move.w x_pos(a0),x_pos(a1)
  58056. move.w y_pos(a0),y_pos(a1)
  58057. move.w #$100,Obj4B_move_timer(a0)
  58058. move.w #-$100,x_vel(a0)
  58059. btst #0,render_flags(a0)
  58060. beq.s + ; rts
  58061. neg.w x_vel(a0)
  58062. +
  58063. rts
  58064. ; ===========================================================================
  58065. ; loc_2D174:
  58066. Obj4B_Main:
  58067. moveq #0,d0
  58068. move.b routine_secondary(a0),d0
  58069. move.w Obj4B_Buzzer_States(pc,d0.w),d1
  58070. jsr Obj4B_Buzzer_States(pc,d1.w)
  58071. lea (Ani_obj4B).l,a1
  58072. jsrto (AnimateSprite).l, JmpTo15_AnimateSprite
  58073. jmpto (MarkObjGone_P1).l, JmpTo_MarkObjGone_P1
  58074. ; ===========================================================================
  58075. ; off_2D190:
  58076. Obj4B_Buzzer_States: offsetTable
  58077. offsetTableEntry.w Obj4B_Roaming ; 0
  58078. offsetTableEntry.w Obj4B_Shooting ; 2
  58079. ; ===========================================================================
  58080. ; loc_2D194:
  58081. Obj4B_Roaming:
  58082. bsr.w Obj4B_ChkPlayers
  58083. subq.w #1,Obj4B_turn_delay(a0)
  58084. move.w Obj4B_turn_delay(a0),d0
  58085. cmpi.w #$F,d0
  58086. beq.s Obj4B_TurnAround
  58087. tst.w d0
  58088. bpl.s return_2D1B8
  58089. subq.w #1,Obj4B_move_timer(a0)
  58090. bgt.w JmpTo21_ObjectMove
  58091. move.w #$1E,Obj4B_turn_delay(a0)
  58092.  
  58093. return_2D1B8:
  58094. rts
  58095. ; ---------------------------------------------------------------------------
  58096. ; loc_2D1BA:
  58097. Obj4B_TurnAround:
  58098. sf Obj4B_shooting_flag(a0) ; reenable shooting
  58099. neg.w x_vel(a0) ; reverse movement direction
  58100. bchg #0,render_flags(a0)
  58101. bchg #0,status(a0)
  58102. move.w #$100,Obj4B_move_timer(a0)
  58103. rts
  58104. ; ===========================================================================
  58105. ; Start of subroutine Obj4B_ChkPlayers
  58106. ; sub_2D1D6:
  58107. Obj4B_ChkPlayers:
  58108. tst.b Obj4B_shooting_flag(a0)
  58109. bne.w return_2D232 ; branch, if shooting is disabled
  58110. move.w x_pos(a0),d0
  58111. lea (MainCharacter).w,a1 ; a1=character
  58112. btst #0,(Vint_runcount+3).w
  58113. beq.s + ; target Sidekick on uneven frames
  58114. lea (Sidekick).w,a1 ; a1=character
  58115. +
  58116. sub.w x_pos(a1),d0 ; get object's distance to player
  58117. move.w d0,d1 ; save value for later
  58118. bpl.s + ; branch, if it was positive
  58119. neg.w d0 ; get absolute value
  58120. +
  58121. ; test if player is inside an 8 pixel wide strip
  58122. cmpi.w #$28,d0
  58123. blt.s return_2D232
  58124. cmpi.w #$30,d0
  58125. bgt.s return_2D232
  58126.  
  58127. tst.w d1 ; test sign of distance
  58128. bpl.s Obj4B_PlayerIsLeft ; branch, if player is left from object
  58129. btst #0,render_flags(a0)
  58130. beq.s return_2D232 ; branch, if object is facing right
  58131. bra.s Obj4B_ReadyToShoot
  58132. ; ---------------------------------------------------------------------------
  58133. ; loc_2D216:
  58134. Obj4B_PlayerIsLeft:
  58135. btst #0,render_flags(a0)
  58136. bne.s return_2D232 ; branch, if object is facing left
  58137.  
  58138. ; loc_2D21E:
  58139. Obj4B_ReadyToShoot:
  58140. st Obj4B_shooting_flag(a0) ; disable shooting
  58141. addq.b #2,routine_secondary(a0) ; => Obj4B_Shooting
  58142. move.b #3,anim(a0) ; play shooting animation
  58143. move.w #$32,Obj4B_shot_timer(a0)
  58144.  
  58145. return_2D232:
  58146. rts
  58147. ; End of subroutine Obj4B_ChkPlayers
  58148. ; ===========================================================================
  58149. ; loc_2D234:
  58150. Obj4B_Shooting:
  58151. move.w Obj4B_shot_timer(a0),d0 ; get timer value
  58152. subq.w #1,d0 ; decrement
  58153. blt.s Obj4B_DoneShooting ; branch, if timer has expired
  58154. move.w d0,Obj4B_shot_timer(a0) ; update timer value
  58155. cmpi.w #$14,d0 ; has timer reached a certain value?
  58156. beq.s Obj4B_ShootProjectile ; if yes, branch
  58157. rts
  58158. ; ---------------------------------------------------------------------------
  58159. ; loc_2D248:
  58160. Obj4B_DoneShooting:
  58161. subq.b #2,routine_secondary(a0) ; => Obj4B_Roaming
  58162. rts
  58163. ; ---------------------------------------------------------------------------
  58164. ; loc_2D24E
  58165. Obj4B_ShootProjectile:
  58166. jsr (SingleObjLoad2).l ; Find next open object space
  58167. bne.s +
  58168.  
  58169. _move.b #ObjID_Buzzer,id(a1) ; load obj4B
  58170. move.b #6,routine(a1) ; => Obj4B_Projectile
  58171. move.l #Obj4B_MapUnc_2D2EA,mappings(a1)
  58172. move.w #make_art_tile(ArtTile_ArtNem_Buzzer,0,0),art_tile(a1)
  58173. jsrto (Adjust2PArtPointer2).l, JmpTo7_Adjust2PArtPointer2
  58174. move.b #4,priority(a1)
  58175. move.b #$98,collision_flags(a1)
  58176. move.b #$10,width_pixels(a1)
  58177. move.b status(a0),status(a1)
  58178. move.b render_flags(a0),render_flags(a1)
  58179. move.b #2,anim(a1)
  58180. move.w x_pos(a0),x_pos(a1)
  58181. move.w y_pos(a0),y_pos(a1)
  58182. addi.w #$18,y_pos(a1) ; align vertically with stinger
  58183. move.w #$D,d0 ; absolute horizontal offset for stinger
  58184. move.w #$180,y_vel(a1)
  58185. move.w #-$180,x_vel(a1)
  58186. btst #0,render_flags(a1) ; is object facing left?
  58187. beq.s + ; if not, branch
  58188. neg.w x_vel(a1) ; move in other direction
  58189. neg.w d0 ; make offset negative
  58190. +
  58191. add.w d0,x_pos(a1) ; align horizontally with stinger
  58192. rts
  58193. ; ===========================================================================
  58194. ; animation script
  58195. ; off_2D2CE:
  58196. Ani_obj4B: offsetTable
  58197. offsetTableEntry.w byte_2D2D6 ; 0
  58198. offsetTableEntry.w byte_2D2D9 ; 1
  58199. offsetTableEntry.w byte_2D2DD ; 2
  58200. offsetTableEntry.w byte_2D2E1 ; 3
  58201. byte_2D2D6: dc.b $0F, $00, $FF
  58202. rev02even
  58203. byte_2D2D9: dc.b $02, $03, $04, $FF
  58204. rev02even
  58205. byte_2D2DD: dc.b $03, $05, $06, $FF
  58206. rev02even
  58207. byte_2D2E1: dc.b $09, $01, $01, $01, $01, $01, $FD, $00
  58208. even
  58209. ; ----------------------------------------------------------------------------
  58210. ; sprite mappings -- Buzz Bomber Sprite Table
  58211. ; ----------------------------------------------------------------------------
  58212. ; MapUnc_2D2EA: SprTbl_Buzzer:
  58213. Obj4B_MapUnc_2D2EA: BINCLUDE "mappings/sprite/obj4B.bin"
  58214.  
  58215. if ~~removeJmpTos
  58216. align 4
  58217. endif
  58218. ; ===========================================================================
  58219.  
  58220. if ~~removeJmpTos
  58221. ; loc_2D368:
  58222. JmpTo49_DeleteObject
  58223. jmp (DeleteObject).l
  58224. JmpTo20_SingleObjLoad2
  58225. jmp (SingleObjLoad2).l
  58226. JmpTo15_AnimateSprite
  58227. jmp (AnimateSprite).l
  58228. JmpTo7_Adjust2PArtPointer2
  58229. jmp (Adjust2PArtPointer2).l
  58230. JmpTo_MarkObjGone_P1
  58231. jmp (MarkObjGone_P1).l
  58232. JmpTo57_Adjust2PArtPointer
  58233. jmp (Adjust2PArtPointer).l
  58234. ; loc_2D38C:
  58235. JmpTo21_ObjectMove
  58236. jmp (ObjectMove).l
  58237.  
  58238. align 4
  58239. else
  58240. JmpTo49_DeleteObject
  58241. jmp (DeleteObject).l
  58242. ; loc_2D38C:
  58243. JmpTo21_ObjectMove
  58244. jmp (ObjectMove).l
  58245. endif
  58246.  
  58247.  
  58248.  
  58249.  
  58250. ; ===========================================================================
  58251. ; ----------------------------------------------------------------------------
  58252. ; Object 5C - Masher (jumping piranha fish badnik) from EHZ
  58253. ; ----------------------------------------------------------------------------
  58254. ; OST Variables:
  58255. Obj5C_initial_y_pos = objoff_30 ; word
  58256.  
  58257. ; Sprite_2D394:
  58258. Obj5C:
  58259. moveq #0,d0
  58260. move.b routine(a0),d0
  58261. move.w Obj5C_Index(pc,d0.w),d1
  58262. jsr Obj5C_Index(pc,d1.w)
  58263. jmpto (MarkObjGone).l, JmpTo34_MarkObjGone
  58264. ; ===========================================================================
  58265. ; off_2D3A6:
  58266. Obj5C_Index: offsetTable
  58267. offsetTableEntry.w Obj5C_Init ; 0
  58268. offsetTableEntry.w Obj5C_Main ; 2
  58269. ; ===========================================================================
  58270. ; loc_2D3AA:
  58271. Obj5C_Init:
  58272. addq.b #2,routine(a0)
  58273. move.l #Obj5C_MapUnc_2D442,mappings(a0)
  58274. move.w #make_art_tile(ArtTile_ArtNem_Masher,0,0),art_tile(a0)
  58275. jsrto (Adjust2PArtPointer).l, JmpTo58_Adjust2PArtPointer
  58276. move.b #4,render_flags(a0)
  58277. move.b #4,priority(a0)
  58278. move.b #9,collision_flags(a0)
  58279. move.b #$10,width_pixels(a0)
  58280. move.w #-$400,y_vel(a0)
  58281. move.w y_pos(a0),Obj5C_initial_y_pos(a0) ; set initial (and lowest) y position
  58282. ; loc_2D3E4:
  58283. Obj5C_Main:
  58284. lea (Ani_obj5C).l,a1
  58285. jsrto (AnimateSprite).l, JmpTo16_AnimateSprite
  58286. jsrto (ObjectMove).l, JmpTo22_ObjectMove
  58287. addi.w #$18,y_vel(a0) ; apply gravity
  58288. move.w Obj5C_initial_y_pos(a0),d0
  58289. cmp.w y_pos(a0),d0 ; has object reached its initial y position?
  58290. bhs.s + ; if not, branch
  58291. move.w d0,y_pos(a0)
  58292. move.w #-$500,y_vel(a0) ; jump
  58293. +
  58294. move.b #1,anim(a0)
  58295. subi.w #$C0,d0
  58296. cmp.w y_pos(a0),d0
  58297. bhs.s + ; rts
  58298. move.b #0,anim(a0)
  58299. tst.w y_vel(a0) ; is object falling?
  58300. bmi.s + ; rts ; if not, branch
  58301. move.b #2,anim(a0) ; use closed mouth animation
  58302. +
  58303. rts
  58304. ; ===========================================================================
  58305. ; animation script
  58306. ; off_2D430:
  58307. Ani_obj5C: offsetTable
  58308. offsetTableEntry.w byte_2D436 ; 0
  58309. offsetTableEntry.w byte_2D43A ; 1
  58310. offsetTableEntry.w byte_2D43E ; 2
  58311. byte_2D436: dc.b 7, 0, 1,$FF
  58312. byte_2D43A: dc.b 3, 0, 1,$FF
  58313. byte_2D43E: dc.b 7, 0,$FF
  58314. even
  58315. ; ----------------------------------------------------------------------------
  58316. ; sprite mappings
  58317. ; ----------------------------------------------------------------------------
  58318. Obj5C_MapUnc_2D442: BINCLUDE "mappings/sprite/obj5C.bin"
  58319.  
  58320. if ~~removeJmpTos
  58321. align 4
  58322. endif
  58323. ; ===========================================================================
  58324.  
  58325. if ~~removeJmpTos
  58326. JmpTo34_MarkObjGone
  58327. jmp (MarkObjGone).l
  58328. JmpTo16_AnimateSprite
  58329. jmp (AnimateSprite).l
  58330. JmpTo58_Adjust2PArtPointer
  58331. jmp (Adjust2PArtPointer).l
  58332. ; loc_2D48E:
  58333. JmpTo22_ObjectMove
  58334. jmp (ObjectMove).l
  58335.  
  58336. align 4
  58337. endif
  58338.  
  58339.  
  58340.  
  58341.  
  58342. ; ===========================================================================
  58343. ; ----------------------------------------------------------------------------
  58344. ; Object 58 - Boss explosion
  58345. ; ----------------------------------------------------------------------------
  58346. ; Sprite_2D494:
  58347. Obj58:
  58348. moveq #0,d0
  58349. move.b routine(a0),d0
  58350. move.w Obj58_Index(pc,d0.w),d1
  58351. jmp Obj58_Index(pc,d1.w)
  58352. ; ===========================================================================
  58353. ; off_2D4A2:
  58354. Obj58_Index: offsetTable
  58355. offsetTableEntry.w Obj58_Init ; 0
  58356. offsetTableEntry.w Obj58_Main ; 2
  58357. ; ===========================================================================
  58358. ; loc_2D4A6:
  58359. Obj58_Init:
  58360. addq.b #2,routine(a0)
  58361. move.l #Obj58_MapUnc_2D50A,mappings(a0)
  58362. move.w #make_art_tile(ArtTile_ArtNem_FieryExplosion,0,1),art_tile(a0)
  58363. jsrto (Adjust2PArtPointer).l, JmpTo59_Adjust2PArtPointer
  58364. move.b #4,render_flags(a0)
  58365. move.b #0,priority(a0)
  58366. move.b #0,collision_flags(a0)
  58367. move.b #$C,width_pixels(a0)
  58368. move.b #7,anim_frame_duration(a0)
  58369. move.b #0,mapping_frame(a0)
  58370. move.w #SndID_BossExplosion,d0
  58371. jmp (PlaySound).l
  58372. ; ===========================================================================
  58373. rts
  58374. ; ===========================================================================
  58375. ; loc_2D4EC:
  58376. Obj58_Main:
  58377. subq.b #1,anim_frame_duration(a0)
  58378. bpl.s +
  58379. move.b #7,anim_frame_duration(a0)
  58380. addq.b #1,mapping_frame(a0)
  58381. cmpi.b #7,mapping_frame(a0)
  58382. beq.w JmpTo50_DeleteObject
  58383. +
  58384. jmpto (DisplaySprite).l, JmpTo33_DisplaySprite
  58385.  
  58386. if removeJmpTos
  58387. JmpTo50_DeleteObject
  58388. jmp (DeleteObject).l
  58389. endif
  58390. ; ===========================================================================
  58391. ; ----------------------------------------------------------------------------
  58392. ; sprite mappings
  58393. ; ----------------------------------------------------------------------------
  58394. Obj58_MapUnc_2D50A: BINCLUDE "mappings/sprite/obj58.bin"
  58395. ; ===========================================================================
  58396.  
  58397. ; Unused - a little dead code here (until the next label)
  58398. ;Boss_HoverPos:
  58399. move.b boss_sine_count(a0),d0 ; a0=object
  58400. jsr (CalcSine).l
  58401. asr.w #6,d0
  58402. add.w (Boss_Y_pos).w,d0
  58403. move.w d0,y_pos(a0)
  58404. move.w (Boss_X_pos).w,x_pos(a0)
  58405. addq.b #2,boss_sine_count(a0)
  58406.  
  58407. ;loc_2D57C
  58408. Boss_HandleHits:
  58409. cmpi.b #8,boss_routine(a0) ; is boss exploding or retreating?
  58410. bhs.s return_2D5C2 ; if yes, branch
  58411. tst.b boss_hitcount2(a0) ; has boss run out of hits?
  58412. beq.s Boss_Defeat ; if yes, branch
  58413. tst.b collision_flags(a0) ; are boss' collisions enabled?
  58414. bne.s return_2D5C2 ; if yes, branch
  58415. tst.b boss_invulnerable_time(a0) ; is boss invulnerable?
  58416. bne.s + ; if yes, branch
  58417. move.b #$20,boss_invulnerable_time(a0) ; make boss invulnerable
  58418. move.w #SndID_BossHit,d0 ; play "boss hit" sound
  58419. jsr (PlaySound).l
  58420. +
  58421. ; do palette flashing effect
  58422. lea (Normal_palette_line2+2).w,a1
  58423. moveq #0,d0 ; 0000 = black
  58424. tst.w (a1) ; is current color black?
  58425. bne.s + ; if not, branch
  58426. move.w #$EEE,d0 ; 0EEE = white
  58427. +
  58428. move.w d0,(a1) ; set color to white or black
  58429. subq.b #1,boss_invulnerable_time(a0) ; decrease boss' invulnerable time
  58430. bne.s return_2D5C2 ; branch, if it hasn't run out
  58431. move.b #$F,collision_flags(a0) ; else, restore collisions
  58432.  
  58433. return_2D5C2:
  58434. rts
  58435. ; ===========================================================================
  58436. ; loc_2D5C4:
  58437. Boss_Defeat:
  58438. moveq #100,d0
  58439. jsrto (AddPoints).l, JmpTo_AddPoints
  58440. move.w #$B3,(Boss_Countdown).w
  58441. move.b #8,boss_routine(a0)
  58442. moveq #PLCID_Capsule,d0
  58443. jsrto (LoadPLC).l, JmpTo4_LoadPLC
  58444. rts
  58445. ; ===========================================================================
  58446.  
  58447. ;loc_2D5DE:
  58448. Boss_MoveObject:
  58449. move.l (Boss_X_pos).w,d2
  58450. move.l (Boss_Y_pos).w,d3
  58451. move.w (Boss_X_vel).w,d0
  58452. ext.l d0
  58453. asl.l #8,d0
  58454. add.l d0,d2
  58455. move.w (Boss_Y_vel).w,d0
  58456. ext.l d0
  58457. asl.l #8,d0
  58458. add.l d0,d3
  58459. move.l d2,(Boss_X_pos).w
  58460. move.l d3,(Boss_Y_pos).w
  58461. rts
  58462. ; ===========================================================================
  58463. ; a1 = animation script pointer
  58464. ;AnimationArray: up to 8 2-byte entries:
  58465. ; 4-bit: anim_ID (1)
  58466. ; 4-bit: anim_ID (2) - the relevant one
  58467. ; 4-bit: anim_frame
  58468. ; 4-bit: anim_timer until next anim_frame
  58469. ; if anim_ID (1) & (2) are not equal, new animation data is loaded
  58470.  
  58471. ;loc_2D604:
  58472. AnimateBoss:
  58473. moveq #0,d6
  58474. movea.l a1,a4 ; address of animation script
  58475. lea (Boss_AnimationArray).w,a2
  58476. lea mainspr_mapframe(a0),a3 ; mapframe 1 (main object)
  58477. tst.b (a3)
  58478. bne.s +
  58479. addq.w #2,a2
  58480. bra.s ++
  58481. ; ----------------------------------------------------------------------------
  58482. +
  58483. bsr.w AnimateBoss_Loop
  58484.  
  58485. +
  58486. moveq #0,d6
  58487. move.b mainspr_childsprites(a0),d6 ; number of child sprites
  58488. subq.w #1,d6 ; = amount of iterations to run the code from AnimateBoss_Loop
  58489. bmi.s return_2D690 ; if was 0, don't run
  58490. lea sub2_mapframe(a0),a3 ; mapframe 2
  58491. ; ----------------------------------------------------------------------------
  58492. ;loc_2D62A:
  58493. AnimateBoss_Loop: ; increases a2 (AnimationArray) by 2 each iteration
  58494. movea.l a4,a1
  58495. moveq #0,d0
  58496. moveq #0,d1
  58497. moveq #0,d2
  58498. moveq #0,d4
  58499. move.b (a2)+,d0
  58500. move.b d0,d1
  58501. lsr.b #4,d1 ; anim_ID (1)
  58502. andi.b #$F,d0 ; anim_ID (2)
  58503. move.b d0,d2
  58504. cmp.b d0,d1
  58505. beq.s +
  58506. st d4 ; anim_IDs not equal
  58507. +
  58508. move.b d0,d5
  58509. lsl.b #4,d5
  58510. or.b d0,d5 ; anim_ID (2) in both nybbles
  58511. move.b (a2)+,d0
  58512. move.b d0,d1
  58513. lsr.b #4,d1 ; anim_frame
  58514. tst.b d4 ; are the anim_IDs equal?
  58515. beq.s +
  58516. moveq #0,d0
  58517. moveq #0,d1 ; reset d0,d1 if anim_IDs not equal
  58518. +
  58519. andi.b #$F,d0 ; timer until next anim_frame
  58520. subi_.b #1,d0
  58521. bpl.s loc_2D67C ; timer not yet at 0, and anim_IDs are equal
  58522.  
  58523. add.w d2,d2 ; anim_ID (2)
  58524. adda.w (a1,d2.w),a1 ; address of animation data with this ID
  58525. move.b (a1),d0 ; animation speed
  58526. move.b 1(a1,d1.w),d2 ; mapping_frame of first/next anim_frame
  58527. bmi.s AnimateBoss_CmdParam ; if animation command parameter, branch
  58528.  
  58529. loc_2D672:
  58530. andi.b #$7F,d2
  58531. move.b d2,(a3) ; store mapping_frame to OST of object
  58532. addi_.b #1,d1 ; anim_frame
  58533.  
  58534. loc_2D67C:
  58535. lsl.b #4,d1
  58536. or.b d1,d0
  58537. move.b d0,-1(a2) ; (2nd byte) anim_frame and anim_timer
  58538. move.b d5,-2(a2) ; (1st byte) anim_ID (both nybbles)
  58539. adda_.w #6,a3 ; mapping_frame of next subobject
  58540. dbf d6,AnimateBoss_Loop
  58541.  
  58542. return_2D690:
  58543. rts
  58544. ; ----------------------------------------------------------------------------
  58545. ;loc_2D692:
  58546. AnimateBoss_CmdParam: ; parameter $FF - reset animation to first frame
  58547. addq.b #1,d2
  58548. bne.s +
  58549. move.b #0,d1
  58550. move.b 1(a1),d2
  58551. bra.s loc_2D672
  58552. ; ----------------------------------------------------------------------------
  58553. + ; parameter $FE - increase boss routine
  58554. addq.b #1,d2
  58555. bne.s +
  58556. addi_.b #2,angle(a0) ; boss routine
  58557. rts
  58558. ; ----------------------------------------------------------------------------
  58559. + ; parameter $FD - change anim_ID to byte after parameter
  58560. addq.b #1,d2
  58561. bne.s +
  58562. andi.b #$F0,d5 ; keep anim_ID (1)
  58563. or.b 2(a1,d1.w),d5 ; set anim_ID (2)
  58564. bra.s loc_2D67C
  58565. ; ----------------------------------------------------------------------------
  58566. + ; parameter $FC - jump back to anim_frame d1
  58567. addq.b #1,d2
  58568. bne.s + ; rts
  58569. moveq #0,d3
  58570. move.b 2(a1,d1.w),d1 ; anim_frame
  58571. move.b 1(a1,d1.w),d2 ; mapping_frame
  58572. bra.s loc_2D672
  58573. ; ----------------------------------------------------------------------------
  58574. + ; parameter $80-$FB
  58575. rts
  58576. ; ===========================================================================
  58577.  
  58578. ;loc_2D6CC:
  58579. Boss_LoadExplosion:
  58580. move.b (Vint_runcount+3).w,d0
  58581. andi.b #7,d0
  58582. bne.s + ; rts
  58583. jsr (SingleObjLoad).l
  58584. bne.s + ; rts
  58585. _move.b #ObjID_BossExplosion,id(a1) ; load obj58
  58586. move.w x_pos(a0),x_pos(a1)
  58587. move.w y_pos(a0),y_pos(a1)
  58588. jsr (RandomNumber).l
  58589. move.w d0,d1
  58590. moveq #0,d1
  58591. move.b d0,d1
  58592. lsr.b #2,d1
  58593. subi.w #$20,d1
  58594. add.w d1,x_pos(a1)
  58595. lsr.w #8,d0
  58596. lsr.b #2,d0
  58597. subi.w #$20,d0
  58598. add.w d0,y_pos(a1)
  58599. +
  58600. rts
  58601. ; ===========================================================================
  58602.  
  58603. if ~~removeJmpTos
  58604. JmpTo33_DisplaySprite
  58605. jmp (DisplaySprite).l
  58606. JmpTo50_DeleteObject
  58607. jmp (DeleteObject).l
  58608. JmpTo4_LoadPLC
  58609. jmp (LoadPLC).l
  58610. JmpTo_AddPoints
  58611. jmp (AddPoints).l
  58612. JmpTo59_Adjust2PArtPointer
  58613. jmp (Adjust2PArtPointer).l
  58614.  
  58615. align 4
  58616. endif
  58617.  
  58618.  
  58619.  
  58620.  
  58621. ; ===========================================================================
  58622. ; ----------------------------------------------------------------------------
  58623. ; Object 5D - CPZ boss
  58624. ; ----------------------------------------------------------------------------
  58625. ; OST Variables:
  58626. Obj5D_timer2 = objoff_2A
  58627. Obj5D_pipe_segments = objoff_2C
  58628. Obj5D_status = objoff_2D
  58629. Obj5D_status2 = objoff_2E
  58630. Obj5D_x_vel = objoff_2E ; and $2F
  58631. Obj5D_x_pos_next = objoff_30
  58632. Obj5D_timer = objoff_30
  58633. Obj5D_y_offset = objoff_31
  58634. Obj5D_timer3 = objoff_32
  58635. Obj5D_parent = objoff_34
  58636. Obj5D_y_pos_next = objoff_38
  58637. Obj5D_defeat_timer = objoff_3C
  58638. Obj5D_flag = objoff_3C
  58639. Obj5D_timer4 = objoff_3C
  58640. Obj5D_invulnerable_time = objoff_3E
  58641. Obj5D_hover_counter = objoff_3F
  58642.  
  58643. ; Sprite_2D734:
  58644. Obj5D:
  58645. moveq #0,d0
  58646. move.b routine(a0),d0
  58647. move.w Obj5D_Index(pc,d0.w),d1
  58648. jmp Obj5D_Index(pc,d1.w)
  58649. ; ===========================================================================
  58650. ; off_2D742:
  58651. Obj5D_Index: offsetTable
  58652. offsetTableEntry.w Obj5D_Init ; 0
  58653. offsetTableEntry.w Obj5D_Main ; 2
  58654. offsetTableEntry.w Obj5D_Pipe ; 4
  58655. offsetTableEntry.w Obj5D_Pipe_Pump ; 6
  58656. offsetTableEntry.w Obj5D_Pipe_Retract ; 8
  58657. offsetTableEntry.w Obj5D_Dripper ; $A
  58658. offsetTableEntry.w Obj5D_Gunk ; $C
  58659. offsetTableEntry.w Obj5D_PipeSegment ; $E
  58660. offsetTableEntry.w Obj5D_Container ; $10
  58661. offsetTableEntry.w Obj5D_Pump ; $12
  58662. offsetTableEntry.w Obj5D_FallingParts ; $14
  58663. offsetTableEntry.w Obj5D_Robotnik ; $16
  58664. offsetTableEntry.w Obj5D_Flame ; $18
  58665. offsetTableEntry.w Obj5D_1A ; $1A
  58666. ; ===========================================================================
  58667. ; loc_2D75E:
  58668. Obj5D_Init:
  58669. ; main vehicle
  58670. move.l #Obj5D_MapUnc_2ED8C,mappings(a0)
  58671. move.w #make_art_tile(ArtTile_ArtNem_Eggpod_3,1,0),art_tile(a0)
  58672. ori.b #4,render_flags(a0)
  58673. move.b #$20,width_pixels(a0)
  58674. move.w #$2B80,x_pos(a0)
  58675. move.w #$4B0,y_pos(a0)
  58676. move.b #3,priority(a0)
  58677. move.b #$F,collision_flags(a0)
  58678. move.b #8,collision_property(a0)
  58679. addq.b #2,routine(a0) ; => Obj5D_Main
  58680. move.w x_pos(a0),Obj5D_x_pos_next(a0)
  58681. move.w y_pos(a0),Obj5D_y_pos_next(a0)
  58682. bclr #3,Obj5D_status(a0)
  58683. jsrto (Adjust2PArtPointer).l, JmpTo60_Adjust2PArtPointer
  58684.  
  58685. ; robotnik sitting in his eggmobile
  58686. jsr (SingleObjLoad2).l
  58687. bne.w loc_2D8AC
  58688. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  58689. move.l a0,Obj5D_parent(a1)
  58690. move.l a1,Obj5D_parent(a0)
  58691. move.l #Obj5D_MapUnc_2ED8C,mappings(a1)
  58692. move.w #make_art_tile(ArtTile_ArtNem_Eggpod_3,0,0),art_tile(a1)
  58693. move.b #4,render_flags(a1)
  58694. move.b #$20,width_pixels(a1)
  58695. move.b #3,priority(a1)
  58696. move.l x_pos(a0),x_pos(a1)
  58697. move.l y_pos(a0),y_pos(a1)
  58698. move.b #$16,routine(a1) ; => Obj5D_Robotnik
  58699. move.b #1,anim(a1)
  58700. move.b render_flags(a0),render_flags(a1)
  58701. jsrto (Adjust2PArtPointer2).l, JmpTo8_Adjust2PArtPointer2
  58702. tst.b subtype(a0)
  58703. bmi.w loc_2D8AC
  58704.  
  58705. ; eggmobile's exhaust flame
  58706. jsr (SingleObjLoad2).l
  58707. bne.w loc_2D8AC
  58708. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  58709. move.l a0,Obj5D_parent(a1)
  58710. move.l #Obj5D_MapUnc_2EE88,mappings(a1)
  58711. move.w #make_art_tile(ArtTile_ArtNem_EggpodJets_1,0,0),art_tile(a1)
  58712. jsrto (Adjust2PArtPointer2).l, JmpTo8_Adjust2PArtPointer2
  58713. move.b #1,anim_frame_duration(a0)
  58714. move.b #4,render_flags(a1)
  58715. move.b #$20,width_pixels(a1)
  58716. move.b #3,priority(a1)
  58717. move.l x_pos(a0),x_pos(a1)
  58718. move.l y_pos(a0),y_pos(a1)
  58719. move.b #$18,routine(a1) ; => Obj5D_Flame
  58720. move.b render_flags(a0),render_flags(a1)
  58721.  
  58722. ; large pump mechanism on top of eggmobile
  58723. jsr (SingleObjLoad2).l
  58724. bne.s loc_2D8AC
  58725. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  58726. move.l a0,Obj5D_parent(a1)
  58727. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  58728. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  58729. move.b #4,render_flags(a1)
  58730. move.b #$20,width_pixels(a1)
  58731. move.b #2,priority(a1)
  58732. move.l x_pos(a0),x_pos(a1)
  58733. move.l y_pos(a0),y_pos(a1)
  58734. move.b #$12,routine(a1) ; => Obj5D_Pump
  58735.  
  58736. loc_2D8AC:
  58737. ; glass container that dumps mega mack on player
  58738. jsr (SingleObjLoad2).l
  58739. bne.s loc_2D908
  58740. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  58741. move.l a0,Obj5D_parent(a1)
  58742. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  58743. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  58744. move.b #4,render_flags(a1)
  58745. move.b #$20,width_pixels(a1)
  58746. move.b #4,priority(a1)
  58747. move.l x_pos(a0),x_pos(a1)
  58748. move.l y_pos(a0),y_pos(a1)
  58749. subi.w #$38,y_pos(a1)
  58750. subi.w #$10,x_pos(a1)
  58751. move.w #-$10,Obj5D_x_vel(a1)
  58752. addi.b #$10,routine(a1) ; => Obj5D_Container
  58753. move.b #6,anim(a1)
  58754.  
  58755. loc_2D908:
  58756. ; pipe used to suck mega mack from tube below
  58757. jsr (SingleObjLoad2).l
  58758. bne.s return_2D94C
  58759. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  58760. move.l a0,Obj5D_parent(a1)
  58761. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  58762. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  58763. move.b #4,render_flags(a1)
  58764. move.b #$20,width_pixels(a1)
  58765. move.b #4,priority(a1)
  58766. move.l x_pos(a0),x_pos(a1)
  58767. move.l y_pos(a0),y_pos(a1)
  58768. move.b #4,routine(a1) ; => Obj5D_Pipe
  58769.  
  58770. return_2D94C:
  58771. rts
  58772. ; ===========================================================================
  58773.  
  58774. Obj5D_Main:
  58775. bsr.w Obj5D_LookAtChar
  58776. moveq #0,d0
  58777. move.b routine_secondary(a0),d0
  58778. move.w Obj5D_Main_Index(pc,d0.w),d1
  58779. jsr Obj5D_Main_Index(pc,d1.w)
  58780. lea (Ani_obj5D_b).l,a1
  58781. jsr (AnimateSprite).l
  58782. move.b status(a0),d0
  58783. andi.b #3,d0
  58784. andi.b #$FC,render_flags(a0)
  58785. or.b d0,render_flags(a0)
  58786. jmp (DisplaySprite).l
  58787. ; ===========================================================================
  58788. Obj5D_Main_Index: offsetTable
  58789. offsetTableEntry.w Obj5D_Main_0 ; 0
  58790. offsetTableEntry.w Obj5D_Main_2 ; 2
  58791. offsetTableEntry.w Obj5D_Main_4 ; 4
  58792. offsetTableEntry.w Obj5D_Main_6 ; 6
  58793. offsetTableEntry.w Obj5D_Main_8 ; 8
  58794. offsetTableEntry.w Obj5D_Main_A ; $A
  58795. offsetTableEntry.w Obj5D_Main_C ; $C
  58796. ; ===========================================================================
  58797. ; Makes the boss look in Sonic's direction under certain circumstances.
  58798.  
  58799. Obj5D_LookAtChar:
  58800. cmpi.b #8,routine_secondary(a0)
  58801. bge.s +
  58802. move.w (MainCharacter+x_pos).w,d0
  58803. sub.w x_pos(a0),d0
  58804. bgt.s ++
  58805. bclr #0,status(a0)
  58806. +
  58807. rts
  58808. ; ---------------------------------------------------------------------------
  58809. +
  58810. bset #0,status(a0)
  58811. rts
  58812. ; ===========================================================================
  58813.  
  58814. Obj5D_Main_8:
  58815. subq.w #1,Obj5D_defeat_timer(a0)
  58816. bpl.w Obj5D_Main_Explode
  58817. bset #0,status(a0)
  58818. bclr #7,status(a0)
  58819. clr.w x_vel(a0)
  58820. addq.b #2,routine_secondary(a0) ; => Obj5D_Main_A
  58821. move.w #-$26,Obj5D_defeat_timer(a0)
  58822. rts
  58823. ; ===========================================================================
  58824.  
  58825. Obj5D_Main_A:
  58826. addq.w #1,Obj5D_defeat_timer(a0)
  58827. beq.s +
  58828. bpl.s ++
  58829. addi.w #$18,y_vel(a0)
  58830. bra.s Obj5D_Main_A_End
  58831. ; ---------------------------------------------------------------------------
  58832. +
  58833. clr.w y_vel(a0)
  58834. bra.s Obj5D_Main_A_End
  58835. ; ---------------------------------------------------------------------------
  58836. +
  58837. cmpi.w #$30,Obj5D_defeat_timer(a0)
  58838. blo.s +
  58839. beq.s ++
  58840. cmpi.w #$38,Obj5D_defeat_timer(a0)
  58841. blo.s Obj5D_Main_A_End
  58842. addq.b #2,routine_secondary(a0) ; => Obj5D_Main_C
  58843. bra.s Obj5D_Main_A_End
  58844. ; ---------------------------------------------------------------------------
  58845. +
  58846. subi_.w #8,y_vel(a0)
  58847. bra.s Obj5D_Main_A_End
  58848. ; ---------------------------------------------------------------------------
  58849. +
  58850. clr.w y_vel(a0)
  58851. jsrto (PlayLevelMusic).l, JmpTo_PlayLevelMusic
  58852. jsrto (LoadPLC_AnimalExplosion).l, JmpTo_LoadPLC_AnimalExplosion
  58853.  
  58854. Obj5D_Main_A_End:
  58855. bsr.w Obj5D_Main_Move
  58856. bra.w Obj5D_Main_Pos_and_Collision
  58857. ; ===========================================================================
  58858.  
  58859. Obj5D_Main_C:
  58860. bset #6,Obj5D_status2(a0)
  58861. move.w #$400,x_vel(a0)
  58862. move.w #-$40,y_vel(a0)
  58863. cmpi.w #$2C30,(Camera_Max_X_pos).w
  58864. bhs.s +
  58865. addq.w #2,(Camera_Max_X_pos).w
  58866. bra.s Obj5D_Main_C_End
  58867. ; ===========================================================================
  58868. +
  58869. tst.b render_flags(a0)
  58870. bpl.s Obj5D_Main_Delete
  58871.  
  58872. Obj5D_Main_C_End:
  58873. bsr.w Obj5D_Main_Move
  58874. bra.w Obj5D_Main_Pos_and_Collision
  58875. ; ===========================================================================
  58876.  
  58877. Obj5D_Main_Delete:
  58878. addq.l #4,sp
  58879. movea.l Obj5D_parent(a0),a1 ; a1=object
  58880. jsr (DeleteObject2).l
  58881.  
  58882. if removeJmpTos
  58883. JmpTo51_DeleteObject
  58884. endif
  58885.  
  58886. jmp (DeleteObject).l
  58887. ; ===========================================================================
  58888.  
  58889. Obj5D_Main_0:
  58890. move.w #$100,y_vel(a0)
  58891. bsr.w Obj5D_Main_Move
  58892. cmpi.w #$4C0,Obj5D_y_pos_next(a0)
  58893. bne.s Obj5D_Main_Pos_and_Collision
  58894. move.w #0,y_vel(a0)
  58895. addq.b #2,routine_secondary(a0) ; => Obj5D_Main_2
  58896.  
  58897. Obj5D_Main_Pos_and_Collision:
  58898. ; do hovering motion using sine wave
  58899. move.b Obj5D_hover_counter(a0),d0
  58900. jsr (CalcSine).l
  58901. asr.w #6,d0
  58902. add.w Obj5D_y_pos_next(a0),d0 ; get y position for next frame, add sine value
  58903. move.w d0,y_pos(a0) ; set y and x positions
  58904. move.w Obj5D_x_pos_next(a0),x_pos(a0)
  58905. addq.b #2,Obj5D_hover_counter(a0)
  58906.  
  58907. cmpi.b #8,routine_secondary(a0) ; exploding or retreating?
  58908. bhs.s return_2DAE8 ; if yes, branch
  58909. tst.b status(a0)
  58910. bmi.s Obj5D_Defeated ; branch, if boss is defeated
  58911. tst.b collision_flags(a0)
  58912. bne.s return_2DAE8 ; branch, if collisions are not turned off
  58913.  
  58914. ; if collisions are turned off, it means the boss was hit
  58915. tst.b Obj5D_invulnerable_time(a0)
  58916. bne.s + ; branch, if still invulnerable
  58917. move.b #$20,Obj5D_invulnerable_time(a0)
  58918. move.w #SndID_BossHit,d0
  58919. jsr (PlaySound).l
  58920. +
  58921. lea (Normal_palette_line2+2).w,a1
  58922. moveq #0,d0 ; color black
  58923. tst.w (a1) ; test palette entry
  58924. bne.s + ; branch, if it's not black
  58925. move.w #$EEE,d0 ; color white
  58926. +
  58927. move.w d0,(a1) ; set color for flashing effect
  58928. subq.b #1,Obj5D_invulnerable_time(a0)
  58929. bne.s return_2DAE8
  58930. move.b #$F,collision_flags(a0) ; restore collisions
  58931. bclr #1,Obj5D_status(a0)
  58932.  
  58933. return_2DAE8:
  58934. rts
  58935. ; ===========================================================================
  58936. ; called when status bit 7 is set (check Touch_Enemy_Part2)
  58937.  
  58938. Obj5D_Defeated:
  58939. moveq #100,d0
  58940. jsrto (AddPoints).l, JmpTo2_AddPoints
  58941. move.b #8,routine_secondary(a0) ; => Obj5D_Main_8
  58942. move.w #$B3,Obj5D_defeat_timer(a0)
  58943. movea.l Obj5D_parent(a0),a1 ; a1=object
  58944. move.b #4,anim(a1)
  58945. moveq #PLCID_Capsule,d0
  58946. jmpto (LoadPLC).l, JmpTo5_LoadPLC
  58947. ; ===========================================================================
  58948. rts
  58949. ; ===========================================================================
  58950.  
  58951. Obj5D_Main_Move:
  58952. move.l Obj5D_x_pos_next(a0),d2
  58953. move.l Obj5D_y_pos_next(a0),d3
  58954. move.w x_vel(a0),d0
  58955. ext.l d0
  58956. asl.l #8,d0
  58957. add.l d0,d2
  58958. move.w y_vel(a0),d0
  58959. ext.l d0
  58960. asl.l #8,d0
  58961. add.l d0,d3
  58962. move.l d2,Obj5D_x_pos_next(a0)
  58963. move.l d3,Obj5D_y_pos_next(a0)
  58964. rts
  58965. ; ===========================================================================
  58966. ; Creates an explosion every 8 frames at a random position relative to boss.
  58967.  
  58968. Obj5D_Main_Explode:
  58969. move.b (Vint_runcount+3).w,d0
  58970. andi.b #7,d0
  58971. bne.s + ; rts
  58972. jsr (SingleObjLoad).l
  58973. bne.s + ; rts
  58974. _move.b #ObjID_BossExplosion,id(a1) ; load obj58
  58975. move.w x_pos(a0),x_pos(a1)
  58976. move.w y_pos(a0),y_pos(a1)
  58977. jsr (RandomNumber).l
  58978. move.w d0,d1
  58979. moveq #0,d1
  58980. move.b d0,d1
  58981. lsr.b #2,d1
  58982. subi.w #$20,d1
  58983. add.w d1,x_pos(a1)
  58984. lsr.w #8,d0
  58985. lsr.b #2,d0
  58986. subi.w #$20,d0
  58987. add.w d0,y_pos(a1)
  58988. +
  58989. rts
  58990. ; ===========================================================================
  58991. ; Creates an explosion.
  58992.  
  58993. Obj5D_Main_Explode2:
  58994. jsr (SingleObjLoad).l
  58995. bne.s + ; rts
  58996. _move.b #ObjID_BossExplosion,id(a1) ; load obj58
  58997. move.w x_pos(a0),x_pos(a1)
  58998. move.w y_pos(a0),y_pos(a1)
  58999. +
  59000. rts
  59001. ; ===========================================================================
  59002.  
  59003. Obj5D_Main_2:
  59004. btst #3,Obj5D_status(a0) ; is boss on the left side of the arena?
  59005. bne.s + ; if yes, branch
  59006. move.w #$2B30,d0 ; right side of arena
  59007. bra.s ++
  59008. ; ---------------------------------------------------------------------------
  59009. +
  59010. move.w #$2A50,d0 ; left side of arena
  59011. +
  59012. move.w d0,d1
  59013. sub.w Obj5D_x_pos_next(a0),d0
  59014. bpl.s +
  59015. neg.w d0 ; get absolute value
  59016. +
  59017. cmpi.w #3,d0
  59018. ble.s Obj5D_Main_2_Stop ; branch, if boss is within 3 pixels to his target
  59019. cmp.w Obj5D_x_pos_next(a0),d1
  59020. bgt.s Obj5D_Main_2_MoveRight
  59021.  
  59022. ;Obj5D_Main_2_MoveLeft:
  59023. move.w #-$300,x_vel(a0)
  59024. bra.s Obj5D_Main_2_End
  59025. ; ---------------------------------------------------------------------------
  59026.  
  59027. Obj5D_Main_2_MoveRight:
  59028. move.w #$300,x_vel(a0)
  59029.  
  59030. Obj5D_Main_2_End:
  59031. bsr.w Obj5D_Main_Move
  59032. bra.w Obj5D_Main_Pos_and_Collision
  59033. ; ===========================================================================
  59034.  
  59035. Obj5D_Main_2_Stop:
  59036. cmpi.w #$4C0,Obj5D_y_pos_next(a0)
  59037. bne.w Obj5D_Main_Pos_and_Collision
  59038. move.w #0,x_vel(a0)
  59039. move.w #0,y_vel(a0)
  59040. addq.b #2,routine_secondary(a0) ; => Obj5D_Main_4
  59041. bchg #3,Obj5D_status(a0) ; indicate boss is now at the other side
  59042. bset #0,Obj5D_status2(a0) ; action 0
  59043. bra.w Obj5D_Main_Pos_and_Collision
  59044. ; ===========================================================================
  59045. ; when status2 bit 0 set, wait for something
  59046.  
  59047. Obj5D_Main_4:
  59048. btst #0,Obj5D_status2(a0) ; action 0?
  59049. beq.s + ; if not, branch
  59050. bra.w Obj5D_Main_Pos_and_Collision
  59051. ; ---------------------------------------------------------------------------
  59052. +
  59053. addq.b #2,routine_secondary(a0) ; => Obj5D_Main_6
  59054. bra.w Obj5D_Main_Pos_and_Collision
  59055. ; ===========================================================================
  59056.  
  59057. Obj5D_Main_6:
  59058. move.w (MainCharacter+x_pos).w,d0
  59059. addi.w #$4C,d0
  59060. cmp.w Obj5D_x_pos_next(a0),d0
  59061. bgt.s Obj5D_Main_6_MoveRight
  59062. beq.w Obj5D_Main_Pos_and_Collision
  59063.  
  59064. ;Obj5D_Main_6_MoveLeft:
  59065. subi.l #$10000,Obj5D_x_pos_next(a0) ; move left one pixel
  59066. ; stop at left boundary
  59067. cmpi.w #$2A28,Obj5D_x_pos_next(a0)
  59068. bgt.w Obj5D_Main_Pos_and_Collision
  59069. move.w #$2A28,Obj5D_x_pos_next(a0)
  59070. bra.w Obj5D_Main_Pos_and_Collision
  59071. ; ---------------------------------------------------------------------------
  59072.  
  59073. Obj5D_Main_6_MoveRight:
  59074. addi.l #$10000,Obj5D_x_pos_next(a0) ; move right one pixel
  59075. ; stop at right boundary
  59076. cmpi.w #$2B70,Obj5D_x_pos_next(a0)
  59077. blt.w Obj5D_Main_Pos_and_Collision
  59078. move.w #$2B70,Obj5D_x_pos_next(a0)
  59079. bra.w Obj5D_Main_Pos_and_Collision
  59080. ; ===========================================================================
  59081.  
  59082. Obj5D_FallingParts:
  59083. cmpi.b #-7,Obj5D_timer(a0)
  59084. beq.s +
  59085. subi_.b #1,Obj5D_timer(a0)
  59086. bgt.w JmpTo34_DisplaySprite
  59087. bsr.w Obj5D_Main_Explode2
  59088. move.b #-7,Obj5D_timer(a0)
  59089. move.w #$1E,Obj5D_timer2(a0)
  59090. +
  59091. subq.w #1,Obj5D_timer2(a0)
  59092. bpl.w JmpTo34_DisplaySprite
  59093. move.w x_vel(a0),d0
  59094. add.w d0,x_pos(a0)
  59095. move.l y_pos(a0),d3
  59096. move.w y_vel(a0),d0
  59097. addi.w #$38,y_vel(a0)
  59098. ext.l d0
  59099. asl.l #8,d0
  59100. add.l d0,d3
  59101. move.l d3,y_pos(a0)
  59102. cmpi.l #$5800000,d3
  59103. bhs.w JmpTo51_DeleteObject
  59104. jmpto (MarkObjGone).l, JmpTo35_MarkObjGone
  59105. ; ===========================================================================
  59106.  
  59107. Obj5D_Pump:
  59108. btst #7,status(a0)
  59109. bne.s +
  59110. movea.l Obj5D_parent(a0),a1 ; a1=object
  59111. move.l x_pos(a1),x_pos(a0)
  59112. move.l y_pos(a1),y_pos(a0)
  59113. move.b render_flags(a1),render_flags(a0)
  59114. move.b status(a1),status(a0)
  59115. movea.l #Ani_Obj5D_Dripper,a1
  59116. jsr (AnimateSprite).l
  59117. jmp (DisplaySprite).l
  59118. ; ---------------------------------------------------------------------------
  59119. +
  59120. moveq #$22,d3
  59121. move.b #$78,Obj5D_timer(a0)
  59122. movea.l Obj5D_parent(a0),a1 ; a1=object
  59123. move.w x_pos(a1),x_pos(a0)
  59124. move.w y_pos(a1),y_pos(a0)
  59125. move.b d3,mapping_frame(a0)
  59126. move.b #$14,routine(a0) ; => Obj5D_FallingParts
  59127. jsr (RandomNumber).l
  59128. asr.w #8,d0
  59129. asr.w #6,d0
  59130. move.w d0,x_vel(a0)
  59131. move.w #-$380,y_vel(a0)
  59132. moveq #1,d2
  59133. addq.w #1,d3
  59134.  
  59135. -
  59136. jsr (SingleObjLoad).l
  59137. bne.w JmpTo51_DeleteObject
  59138. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59139. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  59140. move.b d3,mapping_frame(a1)
  59141. move.b #$14,routine(a1) ; => Obj5D_FallingParts
  59142. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  59143. move.b #4,render_flags(a1)
  59144. move.b #$20,width_pixels(a1)
  59145. move.b #2,priority(a1)
  59146. move.w x_pos(a0),x_pos(a1)
  59147. move.w y_pos(a0),y_pos(a1)
  59148. move.b status(a0),status(a1)
  59149. move.b render_flags(a0),render_flags(a1)
  59150. jsr (RandomNumber).l
  59151. asr.w #8,d0
  59152. asr.w #6,d0
  59153. move.w d0,x_vel(a1)
  59154. move.w #-$380,y_vel(a1)
  59155. swap d0
  59156. addi.b #$1E,d0
  59157. andi.w #$7F,d0
  59158. move.b d0,Obj5D_timer(a1)
  59159. addq.w #1,d3
  59160. dbf d2,-
  59161. rts
  59162. ; ===========================================================================
  59163. ; Object to control the pipe's actions before pumping starts.
  59164.  
  59165. Obj5D_Pipe:
  59166. moveq #0,d0
  59167. move.b routine_secondary(a0),d0
  59168. move.w Obj5D_Pipe_Index(pc,d0.w),d1
  59169. jmp Obj5D_Pipe_Index(pc,d1.w)
  59170. ; ===========================================================================
  59171. Obj5D_Pipe_Index: offsetTable
  59172. offsetTableEntry.w Obj5D_Pipe_0 ; 0
  59173. offsetTableEntry.w Obj5D_Pipe_2_Load ; 2
  59174. ; ===========================================================================
  59175. ; wait for main vehicle's action 0
  59176.  
  59177. Obj5D_Pipe_0:
  59178. movea.l Obj5D_parent(a0),a1 ; parent = main vehicle ; a1=object
  59179. btst #0,Obj5D_status2(a1) ; parent's action 0?
  59180. bne.s + ; if yes, branch
  59181. ; else, do nothing
  59182. rts
  59183. ; ---------------------------------------------------------------------------
  59184. +
  59185. move.w x_pos(a1),x_pos(a0)
  59186. move.w y_pos(a1),y_pos(a0)
  59187. addi.w #$18,y_pos(a0)
  59188. move.w #$C,Obj5D_pipe_segments(a0)
  59189. addq.b #2,routine_secondary(a0) ; => Obj5D_Pipe_2_Load
  59190. movea.l a0,a1
  59191. bra.s Obj5D_Pipe_2_Load_Part2 ; skip initial loading setup
  59192. ; ===========================================================================
  59193. ; load pipe segments, first object controls rest of pipe
  59194. ; objects not loaded in a loop => one segment loaded per frame
  59195. ; pipe extends gradually
  59196.  
  59197. Obj5D_Pipe_2_Load:
  59198. jsr (SingleObjLoad2).l
  59199. beq.s +
  59200. rts
  59201. ; ---------------------------------------------------------------------------
  59202. +
  59203. move.l a0,Obj5D_parent(a1)
  59204.  
  59205. Obj5D_Pipe_2_Load_Part2:
  59206. subq.w #1,Obj5D_pipe_segments(a0) ; is pipe fully extended?
  59207. blt.s Obj5D_Pipe_2_Load_End ; if yes, branch
  59208.  
  59209. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59210. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  59211. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  59212. move.b #4,render_flags(a1)
  59213. move.b #$20,width_pixels(a1)
  59214. move.b #5,priority(a1)
  59215. move.w x_pos(a0),x_pos(a1)
  59216. move.w y_pos(a0),y_pos(a1)
  59217.  
  59218. ; calculate y position for current pipe segment
  59219. move.w Obj5D_pipe_segments(a0),d0
  59220. subi.w #$B,d0 ; $B = maximum number of pipe segments -1, result is always negative or zero
  59221. neg.w d0 ; positive value needed
  59222. lsl.w #3,d0 ; multiply with 8
  59223. move.w d0,Obj5D_y_pos_next(a1)
  59224. add.w d0,y_pos(a1)
  59225. move.b #1,anim(a1)
  59226. cmpi.b #2,routine_secondary(a1)
  59227. beq.w Obj5D_PipeSegment ; only true for the first object
  59228. move.b #$E,routine(a1) ; => Obj5D_PipeSegment
  59229. bra.w Obj5D_PipeSegment
  59230. ; ===========================================================================
  59231. ; once all pipe segments have been loaded, switch to pumping routine
  59232.  
  59233. Obj5D_Pipe_2_Load_End:
  59234. move.b #0,routine_secondary(a0)
  59235. move.b #6,routine(a0) ; => Obj5D_Pipe_Pump_0
  59236. bra.w Obj5D_PipeSegment
  59237. ; ===========================================================================
  59238. ; Object to control the pipe's actions while pumping.
  59239.  
  59240. Obj5D_Pipe_Pump:
  59241. moveq #0,d0
  59242. move.b routine_secondary(a0),d0
  59243. move.w Obj5D_Pipe_Pump_Index(pc,d0.w),d1
  59244. jmp Obj5D_Pipe_Pump_Index(pc,d1.w)
  59245. ; ===========================================================================
  59246. Obj5D_Pipe_Pump_Index: offsetTable
  59247. offsetTableEntry.w Obj5D_Pipe_Pump_0 ; 0
  59248. offsetTableEntry.w Obj5D_Pipe_Pump_2 ; 2
  59249. offsetTableEntry.w Obj5D_Pipe_Pump_4 ; 4
  59250. ; ===========================================================================
  59251. ; prepares for pumping animation
  59252.  
  59253. Obj5D_Pipe_Pump_0:
  59254. jsr (SingleObjLoad2).l
  59255. bne.w Obj5D_PipeSegment
  59256. move.b #$E,routine(a0) ; => Obj5D_PipeSegment ; temporarily turn control object into a pipe segment
  59257. move.b #6,routine(a1)
  59258. move.b #2,routine_secondary(a1) ; => Obj5D_Pipe_Pump_2
  59259. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59260. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  59261. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  59262. move.b #4,render_flags(a1)
  59263. move.b #$20,width_pixels(a1)
  59264. move.b #4,priority(a1)
  59265. move.b #2,Obj5D_timer3(a1)
  59266. move.w x_pos(a0),x_pos(a1)
  59267. move.w y_pos(a0),y_pos(a1)
  59268.  
  59269. ; starting position for pumping animation
  59270. move.w #$B*8,d0
  59271. move.b d0,Obj5D_y_offset(a1)
  59272. add.w d0,y_pos(a1)
  59273. move.b #2,anim(a1)
  59274. move.l a0,Obj5D_parent(a1) ; address of control object
  59275. move.b #$12,Obj5D_timer(a1)
  59276. jsr (SingleObjLoad2).l
  59277. bne.s BranchTo_Obj5D_PipeSegment
  59278. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59279. move.b #$A,routine(a1) ; => Obj5D_Dripper
  59280. move.l Obj5D_parent(a0),Obj5D_parent(a1)
  59281.  
  59282. BranchTo_Obj5D_PipeSegment
  59283. bra.w Obj5D_PipeSegment
  59284. ; ===========================================================================
  59285. ; do pumping animation
  59286.  
  59287. Obj5D_Pipe_Pump_2:
  59288. movea.l Obj5D_parent(a0),a1 ; parent = pipe segment (control object) ; a1=object
  59289. movea.l Obj5D_parent(a1),a2 ; parent = main vehicle ; a2=object
  59290. btst #7,status(a2) ; has boss been defeated?
  59291. bne.w JmpTo51_DeleteObject ; if yes, branch
  59292. move.w x_pos(a1),x_pos(a0)
  59293. move.w y_pos(a1),y_pos(a0)
  59294.  
  59295. subi_.b #1,Obj5D_timer(a0) ; animation timer
  59296. bne.s Obj5D_Pipe_Pump_2_End
  59297. ; when timer reaches zero
  59298. move.b #$12,Obj5D_timer(a0) ; reset animation timer
  59299. subi_.b #8,Obj5D_y_offset(a0) ; move one segment up
  59300. bgt.s Obj5D_Pipe_Pump_2_End
  59301. bmi.s + ; pumping sequence is over when y offset becomes negative
  59302.  
  59303. ; one final delay when last segment is reached
  59304. move.b #3,anim(a0)
  59305. move.b #$C,Obj5D_timer(a0)
  59306. bra.s Obj5D_Pipe_Pump_2_End
  59307. ; ---------------------------------------------------------------------------
  59308. + ; when pumping sequence is over
  59309. move.b #6,Obj5D_timer(a0)
  59310. move.b #4,routine_secondary(a0) ; => Obj5D_Pipe_Pump_4
  59311. rts
  59312. ; ---------------------------------------------------------------------------
  59313.  
  59314. Obj5D_Pipe_Pump_2_End:
  59315. ; set y position based on y offset
  59316. moveq #0,d0
  59317. move.b Obj5D_y_offset(a0),d0
  59318. add.w d0,y_pos(a0)
  59319. lea (Ani_Obj5D_Dripper).l,a1
  59320. jsr (AnimateSprite).l
  59321. jmp (DisplaySprite).l
  59322. ; ===========================================================================
  59323.  
  59324. Obj5D_Pipe_Pump_4:
  59325. subi_.b #1,Obj5D_timer(a0) ; wait a few frames
  59326. beq.s +
  59327. rts
  59328. ; ---------------------------------------------------------------------------
  59329. +
  59330. subq.b #1,Obj5D_timer3(a0)
  59331. beq.s +
  59332. move.b #2,anim(a0)
  59333. move.b #$12,Obj5D_timer(a0)
  59334. move.b #2,routine_secondary(a0) ; => Obj5D_Pipe_Pump_2
  59335. move.b #$B*8,Obj5D_y_offset(a0)
  59336. +
  59337. ; set control object's routine
  59338. movea.l Obj5D_parent(a0),a1 ; parent = pipe segment (control object) ; a1=object
  59339. move.b #8,routine(a1) ; => Obj5D_Pipe_Retract
  59340. move.b #$B*8,Obj5D_y_offset(a1)
  59341. bra.w JmpTo51_DeleteObject
  59342. ; ===========================================================================
  59343. ; Object to control the pipe's actions after pumping is finished.
  59344.  
  59345. Obj5D_Pipe_Retract:
  59346. tst.b Obj5D_flag(a0) ; is flag set?
  59347. bne.s loc_2DFEE ; if yes, branch
  59348.  
  59349. moveq #0,d0
  59350. move.b Obj5D_y_offset(a0),d0
  59351. add.w y_pos(a0),d0 ; get y pos of current pipe segment
  59352. lea (MainCharacter).w,a1 ; a1=object
  59353. moveq #(Dynamic_Object_RAM_End-Object_RAM)/object_size-1,d1
  59354.  
  59355. Obj5D_Pipe_Retract_Loop:
  59356. cmp.w y_pos(a1),d0 ; compare object's y position with current y offset
  59357. beq.s Obj5D_Pipe_Retract_ChkID ; if they match, branch
  59358. lea next_object(a1),a1 ; a1=object
  59359. dbf d1,Obj5D_Pipe_Retract_Loop ; continue as long as there are object slots left
  59360. bra.s Obj5D_PipeSegment
  59361. ; ===========================================================================
  59362.  
  59363. loc_2DFD8:
  59364. st Obj5D_flag(a0)
  59365. bra.s Obj5D_PipeSegment
  59366. ; ===========================================================================
  59367.  
  59368. Obj5D_Pipe_Retract_ChkID:
  59369. moveq #0,d7
  59370. move.b #ObjID_CPZBoss,d7
  59371. cmp.b id(a1),d7 ; is object a subtype of the CPZ Boss?
  59372. beq.s loc_2DFF0 ; if yes, branch
  59373. dbf d1,Obj5D_Pipe_Retract_Loop
  59374. bra.s Obj5D_PipeSegment
  59375. ; ===========================================================================
  59376.  
  59377. loc_2DFEE:
  59378. movea.l a0,a1
  59379.  
  59380. loc_2DFF0:
  59381. bset #7,status(a1) ; mark segment for deletion
  59382. subi_.b #8,Obj5D_y_offset(a0) ; position of next segment up
  59383. beq.s loc_2DFD8
  59384.  
  59385. Obj5D_PipeSegment:
  59386. movea.l Obj5D_parent(a0),a1 ; a1=object
  59387. movea.l Obj5D_parent(a1),a2 ; a2=object
  59388. btst #7,status(a2) ; has boss been defeated?
  59389. bne.s Obj5D_PipeSegment_End ; if yes, branch
  59390.  
  59391. move.w x_pos(a1),x_pos(a0)
  59392. move.w y_pos(a1),y_pos(a0)
  59393. cmpi.b #4,routine_secondary(a0)
  59394. bne.s +
  59395. addi.w #$18,y_pos(a0)
  59396. +
  59397. btst #7,status(a0) ; is object marked for deletion?
  59398. bne.s BranchTo_JmpTo51_DeleteObject ; if yes, branch
  59399. move.w Obj5D_y_pos_next(a0),d0
  59400. add.w d0,y_pos(a0)
  59401. lea (Ani_Obj5D_Dripper).l,a1
  59402. jsr (AnimateSprite).l
  59403. jmp (DisplaySprite).l
  59404. ; ===========================================================================
  59405.  
  59406. BranchTo_JmpTo51_DeleteObject
  59407. bra.w JmpTo51_DeleteObject
  59408. ; ===========================================================================
  59409.  
  59410. Obj5D_PipeSegment_End:
  59411. move.b #$14,routine(a0)
  59412. jsr (RandomNumber).l
  59413. asr.w #8,d0
  59414. asr.w #6,d0
  59415. move.w d0,x_vel(a0)
  59416. move.w #-$380,y_vel(a0)
  59417. swap d0
  59418. addi.b #$1E,d0
  59419. andi.w #$7F,d0
  59420. move.b d0,Obj5D_timer(a0)
  59421. jmpto (DisplaySprite).l, JmpTo34_DisplaySprite
  59422. ; ===========================================================================
  59423.  
  59424. Obj5D_Dripper:
  59425. btst #7,status(a0)
  59426. bne.w JmpTo51_DeleteObject
  59427. moveq #0,d0
  59428. move.b routine_secondary(a0),d0
  59429. move.w Obj5D_Dripper_States(pc,d0.w),d1
  59430. jmp Obj5D_Dripper_States(pc,d1.w)
  59431. ; ===========================================================================
  59432. Obj5D_Dripper_States: offsetTable
  59433. offsetTableEntry.w Obj5D_Dripper_0 ; 0
  59434. offsetTableEntry.w Obj5D_Dripper_2 ; 2
  59435. offsetTableEntry.w Obj5D_Dripper_4 ; 4
  59436. ; ===========================================================================
  59437.  
  59438. Obj5D_Dripper_0:
  59439. addq.b #2,routine_secondary(a0) ; => Obj5D_Dripper_2
  59440. _move.b #ObjID_CPZBoss,id(a0) ; load 0bj5D
  59441. move.l #Obj5D_MapUnc_2EADC,mappings(a0)
  59442. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,3,0),art_tile(a0)
  59443. move.b #4,render_flags(a0)
  59444. move.b #$20,width_pixels(a0)
  59445. move.b #4,priority(a0)
  59446. movea.l Obj5D_parent(a0),a1 ; a1=object
  59447. move.w x_pos(a1),x_pos(a0)
  59448. move.w y_pos(a1),y_pos(a0)
  59449. move.b #$F,Obj5D_timer(a0)
  59450. move.b #4,anim(a0)
  59451.  
  59452. Obj5D_Dripper_2:
  59453. subq.b #1,Obj5D_timer(a0)
  59454. bne.s +
  59455. move.b #5,anim(a0)
  59456. move.b #4,Obj5D_timer(a0)
  59457. addq.b #2,routine_secondary(a0)
  59458. subi.w #$24,y_pos(a0)
  59459. subi_.w #2,x_pos(a0)
  59460. rts
  59461. ; ---------------------------------------------------------------------------
  59462. +
  59463. movea.l Obj5D_parent(a0),a1 ; a1=object
  59464. move.w x_pos(a1),x_pos(a0)
  59465. move.w y_pos(a1),y_pos(a0)
  59466. move.b status(a1),status(a0)
  59467. move.b render_flags(a1),render_flags(a0)
  59468. lea (Ani_Obj5D_Dripper).l,a1
  59469. jsr (AnimateSprite).l
  59470. jmp (DisplaySprite).l
  59471. ; ===========================================================================
  59472.  
  59473. Obj5D_Dripper_4:
  59474. subq.b #1,Obj5D_timer(a0)
  59475. bne.s +
  59476. move.b #0,routine_secondary(a0)
  59477. movea.l Obj5D_parent(a0),a1 ; a1=object
  59478. bset #1,Obj5D_status2(a1)
  59479. addq.b #1,Obj5D_timer4(a0)
  59480. cmpi.b #$C,Obj5D_timer4(a0)
  59481. bge.w JmpTo51_DeleteObject
  59482. rts
  59483. ; ---------------------------------------------------------------------------
  59484. +
  59485. movea.l Obj5D_parent(a0),a1 ; a1=object
  59486. move.w x_pos(a1),x_pos(a0)
  59487. move.w y_pos(a1),y_pos(a0)
  59488. subi.w #$24,y_pos(a0)
  59489. subi_.w #2,x_pos(a0)
  59490. btst #0,render_flags(a0)
  59491. beq.s +
  59492. addi_.w #4,x_pos(a0)
  59493. +
  59494. lea (Ani_Obj5D_Dripper).l,a1
  59495. jsr (AnimateSprite).l
  59496. jmp (DisplaySprite).l
  59497. ; ===========================================================================
  59498.  
  59499. Obj5D_Container:
  59500. moveq #0,d0
  59501. move.b routine_secondary(a0),d0
  59502. move.w Obj5D_Container_States(pc,d0.w),d1
  59503. jmp Obj5D_Container_States(pc,d1.w)
  59504. ; ===========================================================================
  59505. Obj5D_Container_States: offsetTable
  59506. offsetTableEntry.w Obj5D_Container_Init ; 0
  59507. offsetTableEntry.w Obj5D_Container_Main ; 2
  59508. offsetTableEntry.w Obj5D_Container_Floor ; 4
  59509. offsetTableEntry.w Obj5D_Container_Extend ; 6
  59510. offsetTableEntry.w Obj5D_Container_Floor2 ; 8
  59511. offsetTableEntry.w Obj5D_Container_FallOff ; A
  59512. ; ===========================================================================
  59513.  
  59514. Obj5D_Container_Init:
  59515. movea.l Obj5D_parent(a0),a1 ; a1=object
  59516. btst #7,Obj5D_status2(a1)
  59517. bne.s +
  59518. bset #7,Obj5D_status2(a1)
  59519. jsr (SingleObjLoad2).l
  59520. bne.s +
  59521. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59522. move.l a0,Obj5D_parent(a1)
  59523. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  59524. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  59525. move.b #4,render_flags(a1)
  59526. move.b #$20,width_pixels(a1)
  59527. move.b #4,priority(a1)
  59528. move.l x_pos(a0),x_pos(a1)
  59529. move.l y_pos(a0),y_pos(a1)
  59530. move.b #$10,routine(a1)
  59531. move.b #4,routine_secondary(a1) ; => Obj5D_Container_Floor
  59532. move.b #9,anim(a1)
  59533. +
  59534. jsr (SingleObjLoad2).l
  59535. bne.s +
  59536. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59537. move.l a0,Obj5D_parent(a1)
  59538. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  59539. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,3,0),art_tile(a1)
  59540. move.b #4,render_flags(a1)
  59541. move.b #$20,width_pixels(a1)
  59542. move.b #4,priority(a1)
  59543. move.l x_pos(a0),x_pos(a1)
  59544. move.l y_pos(a0),y_pos(a1)
  59545. addi.b #$10,routine(a1)
  59546. move.b #6,routine_secondary(a1) ; => Obj5D_Container_Extend
  59547. +
  59548. addq.b #2,routine_secondary(a0) ; => Obj5D_Container_Main
  59549.  
  59550. Obj5D_Container_Main:
  59551. movea.l Obj5D_parent(a0),a1 ; a1=object
  59552. move.w x_pos(a1),x_pos(a0)
  59553. move.w y_pos(a1),y_pos(a0)
  59554. subi.w #$38,y_pos(a0)
  59555. btst #7,status(a0)
  59556. bne.s loc_2E2E0
  59557. btst #2,Obj5D_status2(a1)
  59558. beq.s +
  59559. bsr.w loc_2E4CE
  59560. bsr.w loc_2E3F2
  59561. bra.s loc_2E2AC
  59562. ; ---------------------------------------------------------------------------
  59563. +
  59564. btst #5,Obj5D_status2(a1)
  59565. beq.s loc_2E2AC
  59566. subq.w #1,Obj5D_timer2(a0)
  59567. bne.s loc_2E2AC
  59568. bclr #5,Obj5D_status2(a1)
  59569. bset #3,Obj5D_status2(a1)
  59570. bset #4,Obj5D_status2(a1)
  59571.  
  59572. loc_2E2AC:
  59573. movea.l Obj5D_parent(a0),a1 ; a1=object
  59574. move.b status(a1),status(a0)
  59575. move.b render_flags(a1),render_flags(a0)
  59576. move.w Obj5D_x_vel(a0),d0
  59577. btst #0,render_flags(a0)
  59578. beq.s +
  59579. neg.w d0
  59580. +
  59581. add.w d0,x_pos(a0)
  59582. lea (Ani_Obj5D_Dripper).l,a1
  59583. jsr (AnimateSprite).l
  59584. jmp (DisplaySprite).l
  59585. ; ===========================================================================
  59586.  
  59587. loc_2E2E0:
  59588. move.b #$A,routine_secondary(a0)
  59589. bra.s loc_2E2AC
  59590. ; ===========================================================================
  59591.  
  59592. Obj5D_Container_FallOff:
  59593. move.l d7,-(sp)
  59594. move.b #$1E,Obj5D_timer(a0)
  59595. movea.l Obj5D_parent(a0),a1 ; a1=object
  59596. move.w x_pos(a1),x_pos(a0)
  59597. move.w y_pos(a1),y_pos(a0)
  59598. subi.w #$38,y_pos(a0)
  59599. move.w Obj5D_x_vel(a0),d0
  59600. btst #0,render_flags(a0)
  59601. beq.s +
  59602. neg.w d0
  59603. +
  59604. add.w d0,x_pos(a0)
  59605. move.b #$20,mapping_frame(a0)
  59606. move.b #$14,routine(a0)
  59607. jsr (RandomNumber).l
  59608. asr.w #8,d0
  59609. asr.w #6,d0
  59610. move.w d0,x_vel(a0)
  59611. move.w #-$380,y_vel(a0)
  59612. moveq #0,d7
  59613. move.w Obj5D_x_vel(a0),d0
  59614. addi.w #$18,d0
  59615. bge.s loc_2E356
  59616. addi.w #$18,d0
  59617. bge.s loc_2E354
  59618. addi.w #$18,d0
  59619. bge.s loc_2E352
  59620. addq.w #1,d7
  59621.  
  59622. loc_2E352:
  59623. addq.w #1,d7
  59624.  
  59625. loc_2E354:
  59626. addq.w #1,d7
  59627.  
  59628. loc_2E356:
  59629. subq.w #1,d7
  59630. bmi.w loc_2E3E6
  59631.  
  59632. loc_2E35C:
  59633. jsr (SingleObjLoad).l
  59634. bne.w JmpTo51_DeleteObject
  59635. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59636. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  59637. move.b #$21,mapping_frame(a1)
  59638. move.b #$14,routine(a1)
  59639. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  59640. move.b render_flags(a0),render_flags(a1)
  59641. move.b #$20,width_pixels(a1)
  59642. move.b #2,priority(a1)
  59643. move.w x_pos(a0),x_pos(a1)
  59644. move.w y_pos(a0),y_pos(a1)
  59645. addi_.w #8,y_pos(a1)
  59646. move.w d7,d2
  59647. add.w d2,d2
  59648. move.w word_2E3EC(pc,d2.w),d3
  59649. btst #0,render_flags(a0)
  59650. beq.s +
  59651. neg.w d3
  59652. +
  59653. add.w d3,x_pos(a1)
  59654. jsr (RandomNumber).l
  59655. asr.w #8,d0
  59656. asr.w #6,d0
  59657. move.w d0,x_vel(a1)
  59658. move.w #-$380,y_vel(a1)
  59659. swap d0
  59660. addi.b #$1E,d0
  59661. andi.w #$7F,d0
  59662. move.b d0,Obj5D_timer(a1)
  59663. dbf d7,loc_2E35C
  59664.  
  59665. loc_2E3E6:
  59666. move.l (sp)+,d7
  59667.  
  59668. if removeJmpTos
  59669. JmpTo34_DisplaySprite
  59670. endif
  59671.  
  59672. jmpto (DisplaySprite).l, JmpTo34_DisplaySprite
  59673. ; ===========================================================================
  59674. word_2E3EC:
  59675. dc.w $18
  59676. dc.w $30 ; 1
  59677. dc.w $48 ; 2
  59678. ; ===========================================================================
  59679.  
  59680. loc_2E3F2:
  59681. btst #3,Obj5D_status2(a1)
  59682. bne.w return_2E4CC
  59683. btst #4,Obj5D_status2(a1)
  59684. bne.w return_2E4CC
  59685. cmpi.w #-$14,Obj5D_x_vel(a0)
  59686. blt.s +
  59687. btst #1,Obj5D_status(a1)
  59688. beq.w return_2E4CC
  59689. bclr #1,Obj5D_status(a1)
  59690. bset #2,Obj5D_status(a1)
  59691. bra.s loc_2E464
  59692. ; ---------------------------------------------------------------------------
  59693. +
  59694. cmpi.w #-$40,Obj5D_x_vel(a0)
  59695. bge.w return_2E4CC
  59696. move.w (MainCharacter+x_pos).w,d1
  59697. subi_.w #8,d1
  59698. btst #0,render_flags(a0)
  59699. beq.s +
  59700. add.w Obj5D_x_vel(a0),d1
  59701. sub.w x_pos(a0),d1
  59702. bgt.w return_2E4CC
  59703. cmpi.w #-$18,d1
  59704. bge.s loc_2E464
  59705. rts
  59706. ; ---------------------------------------------------------------------------
  59707. +
  59708. sub.w Obj5D_x_vel(a0),d1
  59709. sub.w x_pos(a0),d1
  59710. blt.s return_2E4CC
  59711. cmpi.w #$18,d1
  59712. bgt.s return_2E4CC
  59713.  
  59714. loc_2E464:
  59715. bset #5,Obj5D_status2(a1)
  59716. bclr #2,Obj5D_status2(a1)
  59717. move.w #$12,Obj5D_timer2(a0)
  59718. jsr (SingleObjLoad2).l
  59719. bne.s return_2E4CC
  59720. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59721. move.l a0,Obj5D_parent(a1)
  59722. move.b #$10,routine(a1)
  59723. move.b #8,routine_secondary(a1)
  59724. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  59725. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  59726. move.b #4,render_flags(a1)
  59727. move.b #$20,width_pixels(a1)
  59728. move.b #5,priority(a1)
  59729. move.l x_pos(a0),x_pos(a1)
  59730. move.l y_pos(a0),y_pos(a1)
  59731. move.b #$B,anim(a1)
  59732. move.w #$24,Obj5D_timer2(a1)
  59733.  
  59734. return_2E4CC:
  59735. rts
  59736. ; ===========================================================================
  59737.  
  59738. loc_2E4CE:
  59739. moveq #1,d0
  59740. btst #4,Obj5D_status2(a1)
  59741. bne.s +
  59742. moveq #-1,d0
  59743. +
  59744. cmpi.w #-$10,Obj5D_x_vel(a0)
  59745. bne.s loc_2E552
  59746. bclr #4,Obj5D_status2(a1)
  59747. beq.s loc_2E552
  59748. bclr #2,Obj5D_status2(a1)
  59749. clr.b routine_secondary(a0)
  59750. movea.l a1,a2
  59751. jsr (SingleObjLoad2).l
  59752. bne.s return_2E550
  59753. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  59754. move.l Obj5D_parent(a0),Obj5D_parent(a1)
  59755. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  59756. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,1,0),art_tile(a1)
  59757. move.b #4,render_flags(a1)
  59758. move.b #$20,width_pixels(a1)
  59759. move.b #4,priority(a1)
  59760. move.l x_pos(a0),x_pos(a1)
  59761. move.l y_pos(a0),y_pos(a1)
  59762. move.b #4,routine(a1)
  59763. move.b #0,routine_secondary(a0)
  59764. bra.s return_2E550
  59765. ; ===========================================================================
  59766. move.b #$A,routine(a1)
  59767. move.l Obj5D_parent(a0),Obj5D_parent(a1)
  59768.  
  59769. return_2E550:
  59770. rts
  59771. ; ===========================================================================
  59772.  
  59773. loc_2E552:
  59774. move.w Obj5D_x_vel(a0),d1
  59775. cmpi.w #-$28,d1
  59776. bge.s loc_2E59C
  59777. cmpi.w #-$40,d1
  59778. bge.s loc_2E594
  59779. move.b #8,anim(a0)
  59780. cmpi.w #-$58,d1
  59781. blt.s loc_2E57E
  59782. bgt.s loc_2E578
  59783. btst #4,Obj5D_status2(a1)
  59784. beq.s return_2E57C
  59785.  
  59786. loc_2E578:
  59787. add.w d0,Obj5D_x_vel(a0)
  59788.  
  59789. return_2E57C:
  59790. rts
  59791. ; ===========================================================================
  59792.  
  59793. loc_2E57E:
  59794. move.w #-$58,Obj5D_x_vel(a0)
  59795. btst #0,render_flags(a0)
  59796. beq.s loc_2E578
  59797. move.w #$58,Obj5D_x_vel(a0)
  59798. bra.s loc_2E578
  59799. ; ===========================================================================
  59800.  
  59801. loc_2E594:
  59802. move.b #7,anim(a0)
  59803. bra.s loc_2E578
  59804. ; ===========================================================================
  59805.  
  59806. loc_2E59C:
  59807. move.b #6,anim(a0)
  59808. bra.s loc_2E578
  59809. ; ===========================================================================
  59810.  
  59811. Obj5D_Container_Extend:
  59812. btst #7,status(a0)
  59813. bne.w JmpTo51_DeleteObject
  59814. movea.l Obj5D_parent(a0),a1 ; a1=object
  59815. move.l Obj5D_parent(a1),d0
  59816. beq.w JmpTo51_DeleteObject
  59817. movea.l d0,a1 ; a1=object
  59818. bclr #3,Obj5D_status2(a1)
  59819. beq.s +
  59820. move.b #$C,routine(a0)
  59821. move.b #0,routine_secondary(a0)
  59822. move.b #$87,collision_flags(a0)
  59823. bra.s Obj5D_Container_Floor_End
  59824. ; ----------------------------------------------------------------------------
  59825. +
  59826. bclr #1,Obj5D_status2(a1)
  59827. bne.s +
  59828. tst.b anim(a0)
  59829. bne.s Obj5D_Container_Floor_End
  59830. rts
  59831. ; ---------------------------------------------------------------------------
  59832. +
  59833. tst.b anim(a0)
  59834. bne.s +
  59835. move.b #$B,anim(a0)
  59836. +
  59837. addi_.b #1,anim(a0)
  59838. cmpi.b #$17,anim(a0)
  59839. blt.s Obj5D_Container_Floor_End
  59840. bclr #0,Obj5D_status2(a1)
  59841. bset #2,Obj5D_status2(a1)
  59842. bra.s Obj5D_Container_Floor_End
  59843. ; ===========================================================================
  59844.  
  59845. Obj5D_Container_Floor:
  59846. btst #7,status(a0)
  59847. bne.w JmpTo51_DeleteObject
  59848. movea.l Obj5D_parent(a0),a1 ; a1=object
  59849. movea.l Obj5D_parent(a1),a1
  59850. btst #5,Obj5D_status2(a1)
  59851. beq.s Obj5D_Container_Floor_End
  59852. cmpi.b #9,anim(a0)
  59853. bne.s Obj5D_Container_Floor_End
  59854. move.b #$A,anim(a0)
  59855.  
  59856. Obj5D_Container_Floor_End:
  59857. movea.l Obj5D_parent(a0),a1 ; a1=object
  59858. move.w x_pos(a1),x_pos(a0)
  59859. move.w y_pos(a1),y_pos(a0)
  59860. move.b render_flags(a1),render_flags(a0)
  59861. move.b status(a1),status(a0)
  59862. lea (Ani_Obj5D_Dripper).l,a1
  59863. jsr (AnimateSprite).l
  59864. jmp (DisplaySprite).l
  59865. ; ===========================================================================
  59866.  
  59867. Obj5D_Container_Floor2:
  59868. btst #7,status(a0)
  59869. bne.w JmpTo51_DeleteObject
  59870. subq.w #1,Obj5D_timer2(a0)
  59871. beq.w JmpTo51_DeleteObject
  59872. bra.s Obj5D_Container_Floor_End
  59873. ; ===========================================================================
  59874.  
  59875. Obj5D_Gunk:
  59876. moveq #0,d0
  59877. move.b routine_secondary(a0),d0
  59878. move.w Obj5D_Gunk_States(pc,d0.w),d1
  59879. jmp Obj5D_Gunk_States(pc,d1.w)
  59880. ; ===========================================================================
  59881. Obj5D_Gunk_States: offsetTable
  59882. offsetTableEntry.w Obj5D_Gunk_Init ; 0
  59883. offsetTableEntry.w Obj5D_Gunk_Main ; 2
  59884. offsetTableEntry.w Obj5D_Gunk_Droplets ; 4
  59885. offsetTableEntry.w Obj5D_Gunk_6 ; 6
  59886. offsetTableEntry.w Obj5D_Gunk_8 ; 8
  59887. ; ===========================================================================
  59888.  
  59889. Obj5D_Gunk_Init:
  59890. addq.b #2,routine_secondary(a0) ; => Obj5D_Gunk_Main
  59891. move.b #$20,y_radius(a0)
  59892. move.b #$19,anim(a0)
  59893. move.w #0,y_vel(a0)
  59894. movea.l Obj5D_parent(a0),a1 ; a1=object
  59895. movea.l Obj5D_parent(a1),a1
  59896. btst #2,Obj5D_status(a1)
  59897. beq.s Obj5D_Gunk_Main
  59898. bclr #2,Obj5D_status(a1)
  59899. move.b #6,routine_secondary(a0) ; => Obj5D_Gunk_6
  59900. move.w #9,Obj5D_timer2(a0)
  59901.  
  59902. Obj5D_Gunk_Main:
  59903. jsrto (ObjectMoveAndFall).l, JmpTo3_ObjectMoveAndFall
  59904. jsr (ObjCheckFloorDist).l
  59905. tst.w d1
  59906. bmi.s + ; branch, if hit the floor
  59907. cmpi.w #$518,y_pos(a0)
  59908. bge.s Obj5D_Gunk_OffScreen ; branch, if fallen off screen
  59909. lea (Ani_Obj5D_Dripper).l,a1
  59910. jsr (AnimateSprite).l
  59911. jmp (DisplaySprite).l
  59912. ; ===========================================================================
  59913. +
  59914. add.w d1,y_pos(a0)
  59915. movea.l Obj5D_parent(a0),a1 ; a1=object
  59916. movea.l Obj5D_parent(a1),a1
  59917. bset #2,Obj5D_status2(a1)
  59918. bset #4,Obj5D_status2(a1)
  59919. move.b #2,routine_secondary(a1)
  59920. addq.b #2,routine_secondary(a0) ; => Obj5D_Gunk_Droplets
  59921. move.b #0,subtype(a0)
  59922. move.w #SndID_MegaMackDrop,d0
  59923. jsrto (PlaySound).l, JmpTo5_PlaySound
  59924. jmp (DisplaySprite).l
  59925. ; ===========================================================================
  59926.  
  59927. Obj5D_Gunk_OffScreen:
  59928. movea.l Obj5D_parent(a0),a1 ; a1=object
  59929. movea.l Obj5D_parent(a1),a1
  59930. bset #2,Obj5D_status2(a1)
  59931. bset #4,Obj5D_status2(a1)
  59932. move.b #2,routine_secondary(a1)
  59933. bra.w JmpTo51_DeleteObject
  59934. ; ===========================================================================
  59935.  
  59936. Obj5D_Gunk_6:
  59937. subi_.w #1,Obj5D_timer2(a0)
  59938. bpl.s +
  59939. move.b #2,priority(a0)
  59940. move.b #$25,mapping_frame(a0)
  59941. movea.l Obj5D_parent(a0),a1 ; a1=object
  59942. movea.l Obj5D_parent(a1),a1 ; a1=object
  59943. move.w x_pos(a1),x_pos(a0)
  59944. move.w y_pos(a1),y_pos(a0)
  59945. addq.b #2,routine_secondary(a0) ; => Obj5D_Gunk_8
  59946. move.b #8,anim_frame_duration(a0)
  59947. bra.s Obj5D_Gunk_8
  59948. ; ===========================================================================
  59949. +
  59950. jsrto (ObjectMove).l, JmpTo23_ObjectMove
  59951. lea (Ani_Obj5D_Dripper).l,a1
  59952. jsr (AnimateSprite).l
  59953. jmp (DisplaySprite).l
  59954. ; ===========================================================================
  59955.  
  59956. Obj5D_Gunk_8:
  59957. subi_.b #1,anim_frame_duration(a0)
  59958. bpl.s +
  59959. addi_.b #1,mapping_frame(a0)
  59960. move.b #8,anim_frame_duration(a0)
  59961. cmpi.b #$27,mapping_frame(a0)
  59962. bgt.w Obj5D_Gunk_OffScreen
  59963. blt.s +
  59964. addi.b #$C,anim_frame_duration(a0)
  59965. +
  59966. movea.l Obj5D_parent(a0),a1 ; a1=object
  59967. movea.l Obj5D_parent(a1),a1 ; a1=object
  59968. move.w x_pos(a1),x_pos(a0)
  59969. move.w y_pos(a1),y_pos(a0)
  59970. jmp (DisplaySprite).l
  59971. ; ===========================================================================
  59972.  
  59973. Obj5D_Gunk_Droplets:
  59974. moveq #0,d0
  59975. move.b subtype(a0),d0
  59976. bne.w Obj5D_Gunk_Droplets_Move
  59977. addi.w #$18,y_pos(a0)
  59978. addi.w #$C,x_pos(a0)
  59979. btst #0,render_flags(a0)
  59980. beq.s +
  59981. subi.w #$18,x_pos(a0)
  59982. +
  59983. move.b #4,y_radius(a0)
  59984. move.b #4,x_radius(a0)
  59985. addq.b #1,subtype(a0)
  59986. move.b #9,mapping_frame(a0)
  59987. move.w y_vel(a0),d0
  59988. lsr.w #1,d0
  59989. neg.w d0
  59990. move.w d0,y_vel(a0)
  59991. jsr (RandomNumber).l
  59992. asr.w #6,d0
  59993. bmi.s +
  59994. addi.w #$200,d0
  59995. +
  59996. addi.w #-$100,d0
  59997. move.w d0,x_vel(a0)
  59998. move.b #0,collision_flags(a0)
  59999. moveq #3,d3
  60000.  
  60001. Obj5D_Gunk_Droplets_Loop:
  60002. jsr (SingleObjLoad2).l
  60003. bne.w BranchTo_JmpTo34_DisplaySprite
  60004. _move.b #ObjID_CPZBoss,id(a1) ; load obj5D
  60005. move.l a0,Obj5D_parent(a1)
  60006. move.l #Obj5D_MapUnc_2EADC,mappings(a1)
  60007. move.w #make_art_tile(ArtTile_ArtNem_CPZBoss,3,0),art_tile(a1)
  60008. move.b #4,render_flags(a1)
  60009. move.b #$20,width_pixels(a1)
  60010. move.b #2,priority(a1)
  60011. move.l x_pos(a0),x_pos(a1)
  60012. move.l y_pos(a0),y_pos(a1)
  60013. move.b #4,y_radius(a1)
  60014. move.b #4,x_radius(a1)
  60015. move.b #9,mapping_frame(a1)
  60016. move.b #$C,routine(a1)
  60017. move.b #4,routine_secondary(a1)
  60018. move.b #1,subtype(a1)
  60019. move.w y_vel(a0),y_vel(a1)
  60020. move.b collision_flags(a0),collision_flags(a1)
  60021. jsr (RandomNumber).l
  60022. asr.w #6,d0
  60023. bmi.s +
  60024. addi.w #$80,d0
  60025. +
  60026. addi.w #-$80,d0
  60027. move.w d0,x_vel(a1)
  60028. swap d0
  60029. andi.w #$3FF,d0
  60030. sub.w d0,y_vel(a1)
  60031. dbf d3,Obj5D_Gunk_Droplets_Loop
  60032.  
  60033. BranchTo_JmpTo34_DisplaySprite
  60034. jmpto (DisplaySprite).l, JmpTo34_DisplaySprite
  60035. ; ===========================================================================
  60036.  
  60037. Obj5D_Gunk_Droplets_Move:
  60038. jsrto (ObjectMoveAndFall).l, JmpTo3_ObjectMoveAndFall
  60039. jsr (ObjCheckFloorDist).l
  60040. tst.w d1
  60041. bmi.s +
  60042. jmpto (MarkObjGone).l, JmpTo35_MarkObjGone
  60043. ; ---------------------------------------------------------------------------
  60044. +
  60045. bra.w JmpTo51_DeleteObject
  60046. ; ===========================================================================
  60047.  
  60048. ; a bit of unused/dead code here
  60049. add.w d1,y_pos(a0) ; a0=object
  60050. move.w y_vel(a0),d0
  60051. lsr.w #1,d0
  60052. neg.w d0
  60053. move.w d0,y_vel(a0)
  60054. jmpto (DisplaySprite).l, JmpTo34_DisplaySprite
  60055.  
  60056. ; ===========================================================================
  60057.  
  60058. Obj5D_Robotnik:
  60059. movea.l Obj5D_parent(a0),a1 ; a1=object
  60060. move.l x_pos(a1),x_pos(a0)
  60061. move.l y_pos(a1),y_pos(a0)
  60062. move.b status(a1),status(a0)
  60063. move.b render_flags(a1),render_flags(a0)
  60064. move.b Obj5D_invulnerable_time(a1),d0
  60065. cmpi.b #$1F,d0
  60066. bne.s +
  60067. move.b #2,anim(a0)
  60068. +
  60069. cmpi.b #4,(MainCharacter+routine).w
  60070. beq.s +
  60071. cmpi.b #4,(Sidekick+routine).w
  60072. bne.s Obj5D_Robotnik_End
  60073. +
  60074. move.b #3,anim(a0)
  60075.  
  60076. Obj5D_Robotnik_End:
  60077. lea (Ani_obj5D_b).l,a1
  60078. jsr (AnimateSprite).l
  60079. jmp (DisplaySprite).l
  60080. ; ===========================================================================
  60081. byte_2E94A:
  60082. dc.b 0
  60083. dc.b $FF ; 1
  60084. dc.b 1 ; 2
  60085. dc.b 0 ; 3
  60086. ; ===========================================================================
  60087.  
  60088. Obj5D_Flame:
  60089. btst #7,status(a0)
  60090. bne.s loc_2E9A8
  60091. movea.l Obj5D_parent(a0),a1 ; a1=object
  60092. move.l x_pos(a1),x_pos(a0)
  60093. move.l y_pos(a1),y_pos(a0)
  60094. move.b status(a1),status(a0)
  60095. move.b render_flags(a1),render_flags(a0)
  60096. subq.b #1,anim_frame_duration(a0)
  60097. bpl.s loc_2E996
  60098. move.b #1,anim_frame_duration(a0)
  60099. move.b Obj5D_timer2(a0),d0
  60100. addq.b #1,d0
  60101. cmpi.b #2,d0
  60102. ble.s +
  60103. moveq #0,d0
  60104. +
  60105. move.b byte_2E94A(pc,d0.w),mapping_frame(a0)
  60106. move.b d0,Obj5D_timer2(a0)
  60107.  
  60108. loc_2E996:
  60109. cmpi.b #-1,mapping_frame(a0)
  60110. bne.w JmpTo34_DisplaySprite
  60111. move.b #0,mapping_frame(a0)
  60112. rts
  60113. ; ===========================================================================
  60114.  
  60115. loc_2E9A8:
  60116. movea.l Obj5D_parent(a0),a1 ; a1=object
  60117. btst #6,Obj5D_status2(a1)
  60118. bne.s +
  60119. rts
  60120. ; ===========================================================================
  60121. +
  60122. addq.b #2,routine_secondary(a0)
  60123. move.l #Obj5D_MapUnc_2EEA0,mappings(a0)
  60124. move.w #make_art_tile(ArtTile_ArtNem_EggpodJets_1,0,0),art_tile(a0)
  60125. jsrto (Adjust2PArtPointer).l, JmpTo60_Adjust2PArtPointer
  60126. move.b #0,mapping_frame(a0)
  60127. move.b #5,anim_frame_duration(a0)
  60128. movea.l Obj5D_parent(a0),a1 ; a1=object
  60129. move.w x_pos(a1),x_pos(a0)
  60130. move.w y_pos(a1),y_pos(a0)
  60131. addi_.w #4,y_pos(a0)
  60132. subi.w #$28,x_pos(a0)
  60133. rts
  60134. ; ===========================================================================
  60135.  
  60136. Obj5D_1A:
  60137. subq.b #1,anim_frame_duration(a0)
  60138. bpl.s BranchTo2_JmpTo34_DisplaySprite
  60139. move.b #5,anim_frame_duration(a0)
  60140. addq.b #1,mapping_frame(a0)
  60141. cmpi.b #4,mapping_frame(a0)
  60142. bne.w BranchTo2_JmpTo34_DisplaySprite
  60143. move.b #0,mapping_frame(a0)
  60144. movea.l Obj5D_parent(a0),a1 ; a1=object
  60145. move.b id(a1),d0
  60146. beq.w JmpTo51_DeleteObject ; branch, if parent object is gone
  60147. move.w x_pos(a1),x_pos(a0)
  60148. move.w y_pos(a1),y_pos(a0)
  60149. addi_.w #4,y_pos(a0)
  60150. subi.w #$28,x_pos(a0)
  60151.  
  60152. BranchTo2_JmpTo34_DisplaySprite
  60153. jmpto (DisplaySprite).l, JmpTo34_DisplaySprite
  60154. ; ===========================================================================
  60155. ; animation script
  60156. ; off_2EA3C:
  60157. Ani_Obj5D_Dripper: offsetTable
  60158. offsetTableEntry.w byte_2EA72 ; 0
  60159. offsetTableEntry.w byte_2EA75 ; 1
  60160. offsetTableEntry.w byte_2EA78 ; 2
  60161. offsetTableEntry.w byte_2EA7D ; 3
  60162. offsetTableEntry.w byte_2EA81 ; 4
  60163. offsetTableEntry.w byte_2EA88 ; 5
  60164. offsetTableEntry.w byte_2EA8B ; 6
  60165. offsetTableEntry.w byte_2EA8E ; 7
  60166. offsetTableEntry.w byte_2EA91 ; 8
  60167. offsetTableEntry.w byte_2EA94 ; 9
  60168. offsetTableEntry.w byte_2EA97 ; $A
  60169. offsetTableEntry.w byte_2EAA3 ; $B
  60170. offsetTableEntry.w byte_2EAAE ; $C
  60171. offsetTableEntry.w byte_2EAB1 ; $D
  60172. offsetTableEntry.w byte_2EAB4 ; $E
  60173. offsetTableEntry.w byte_2EAB7 ; $F
  60174. offsetTableEntry.w byte_2EABA ; $10
  60175. offsetTableEntry.w byte_2EABD ; $11
  60176. offsetTableEntry.w byte_2EAC0 ; $12
  60177. offsetTableEntry.w byte_2EAC3 ; $13
  60178. offsetTableEntry.w byte_2EAC6 ; $14
  60179. offsetTableEntry.w byte_2EAC9 ; $15
  60180. offsetTableEntry.w byte_2EACC ; $16
  60181. offsetTableEntry.w byte_2EACF ; $17
  60182. offsetTableEntry.w byte_2EAD2 ; $18
  60183. offsetTableEntry.w byte_2EAD5 ; $19
  60184. offsetTableEntry.w byte_2EAD9 ; $1A
  60185. byte_2EA72: dc.b $F, 0,$FF
  60186. rev02even
  60187. byte_2EA75: dc.b $F, 1,$FF
  60188. rev02even
  60189. byte_2EA78: dc.b 5, 2, 3, 2,$FF
  60190. rev02even
  60191. byte_2EA7D: dc.b 5, 2, 3,$FF
  60192. rev02even
  60193. byte_2EA81: dc.b 2, 4, 5, 6, 7, 8,$FF
  60194. rev02even
  60195. byte_2EA88: dc.b 3, 9,$FF
  60196. rev02even
  60197. byte_2EA8B: dc.b $F, $A,$FF
  60198. rev02even
  60199. byte_2EA8E: dc.b $F,$1C,$FF
  60200. rev02even
  60201. byte_2EA91: dc.b $F,$1E,$FF
  60202. rev02even
  60203. byte_2EA94: dc.b $F, $B,$FF
  60204. rev02even
  60205. byte_2EA97: dc.b 3, $C, $C, $D, $D, $D, $D, $D, $C, $C,$FD, 9
  60206. rev02even
  60207. byte_2EAA3: dc.b 3, $E, $E, $F, $F, $F, $F, $F, $E, $E,$FF
  60208. rev02even
  60209. byte_2EAAE: dc.b $F,$10,$FF
  60210. rev02even
  60211. byte_2EAB1: dc.b $F,$11,$FF
  60212. rev02even
  60213. byte_2EAB4: dc.b $F,$12,$FF
  60214. rev02even
  60215. byte_2EAB7: dc.b $F,$13,$FF
  60216. rev02even
  60217. byte_2EABA: dc.b $F,$14,$FF
  60218. rev02even
  60219. byte_2EABD: dc.b $F,$15,$FF
  60220. rev02even
  60221. byte_2EAC0: dc.b $F,$16,$FF
  60222. rev02even
  60223. byte_2EAC3: dc.b $F,$17,$FF
  60224. rev02even
  60225. byte_2EAC6: dc.b $F,$18,$FF
  60226. rev02even
  60227. byte_2EAC9: dc.b $F,$19,$FF
  60228. rev02even
  60229. byte_2EACC: dc.b $F,$1A,$FF
  60230. rev02even
  60231. byte_2EACF: dc.b $F,$1B,$FF
  60232. rev02even
  60233. byte_2EAD2: dc.b $F,$1C,$FF
  60234. rev02even
  60235. byte_2EAD5: dc.b 1,$1D,$1F,$FF
  60236. rev02even
  60237. byte_2EAD9: dc.b $F,$1E,$FF
  60238. even
  60239. ; ----------------------------------------------------------------------------
  60240. ; sprite mappings - uses ArtNem_CPZBoss
  60241. ; ----------------------------------------------------------------------------
  60242. Obj5D_MapUnc_2EADC: BINCLUDE "mappings/sprite/obj5D_a.bin"
  60243.  
  60244. ; animation script
  60245. ; off_2ED5C:
  60246. Ani_obj5D_b: offsetTable
  60247. offsetTableEntry.w byte_2ED66 ; 0
  60248. offsetTableEntry.w byte_2ED69 ; 1
  60249. offsetTableEntry.w byte_2ED6D ; 2
  60250. offsetTableEntry.w byte_2ED76 ; 3
  60251. offsetTableEntry.w byte_2ED7F ; 4
  60252. byte_2ED66: dc.b $F, 0,$FF
  60253. rev02even
  60254. byte_2ED69: dc.b 7, 1, 2,$FF
  60255. rev02even
  60256. byte_2ED6D: dc.b 7, 5, 5, 5, 5, 5, 5,$FD, 1
  60257. rev02even
  60258. byte_2ED76: dc.b 7, 3, 4, 3, 4, 3, 4,$FD, 1
  60259. rev02even
  60260. byte_2ED7F: dc.b $F, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,$FD, 1
  60261. even
  60262.  
  60263. ; ----------------------------------------------------------------------------
  60264. ; sprite mappings - uses ArtNem_Eggpod
  60265. ; ----------------------------------------------------------------------------
  60266. Obj5D_MapUnc_2ED8C: BINCLUDE "mappings/sprite/obj5D_b.bin"
  60267. ; ----------------------------------------------------------------------------
  60268. ; sprite mappings - uses ArtNem_EggpodJets
  60269. ; ----------------------------------------------------------------------------
  60270. Obj5D_MapUnc_2EE88: BINCLUDE "mappings/sprite/obj5D_c.bin"
  60271. ; ----------------------------------------------------------------------------
  60272. ; sprite mappings - uses ArtNem_BossSmoke
  60273. ; ----------------------------------------------------------------------------
  60274. Obj5D_MapUnc_2EEA0: BINCLUDE "mappings/sprite/obj5D_d.bin"
  60275. ; ===========================================================================
  60276.  
  60277. if ~~removeJmpTos
  60278. JmpTo34_DisplaySprite
  60279. jmp (DisplaySprite).l
  60280. JmpTo51_DeleteObject
  60281. jmp (DeleteObject).l
  60282. JmpTo35_MarkObjGone
  60283. jmp (MarkObjGone).l
  60284. JmpTo5_PlaySound
  60285. jmp (PlaySound).l
  60286. JmpTo8_Adjust2PArtPointer2
  60287. jmp (Adjust2PArtPointer2).l
  60288. JmpTo5_LoadPLC
  60289. jmp (LoadPLC).l
  60290. JmpTo2_AddPoints
  60291. jmp (AddPoints).l
  60292. JmpTo60_Adjust2PArtPointer
  60293. jmp (Adjust2PArtPointer).l
  60294. JmpTo_PlayLevelMusic
  60295. jmp (PlayLevelMusic).l
  60296. JmpTo_LoadPLC_AnimalExplosion
  60297. jmp (LoadPLC_AnimalExplosion).l
  60298. JmpTo3_ObjectMoveAndFall
  60299. jmp (ObjectMoveAndFall).l
  60300. ; loc_2EF12:
  60301. JmpTo23_ObjectMove
  60302. jmp (ObjectMove).l
  60303.  
  60304. align 4
  60305. endif
  60306.  
  60307.  
  60308.  
  60309.  
  60310. ; ===========================================================================
  60311. ; ----------------------------------------------------------------------------
  60312. ; Object 56 - EHZ boss
  60313. ; the bottom part of the vehicle with the ability to fly is the parent object
  60314. ; ----------------------------------------------------------------------------
  60315. ; Sprite_2EF18:
  60316. Obj56:
  60317. moveq #0,d0
  60318. move.b routine(a0),d0
  60319. move.w Obj56_Index(pc,d0.w),d1
  60320. jmp Obj56_Index(pc,d1.w)
  60321. ; ===========================================================================
  60322. ; off_2EF26:
  60323. Obj56_Index: offsetTable
  60324. offsetTableEntry.w Obj56_Init ; 0 - Init
  60325. offsetTableEntry.w loc_2F262 ; 2 - Flying vehicle, bottom = main object
  60326. offsetTableEntry.w loc_2F54E ; 4 - Propeller normal
  60327. offsetTableEntry.w loc_2F5F6 ; 6 - Vehicle on ground
  60328. offsetTableEntry.w loc_2F664 ; 8 - Wheels
  60329. offsetTableEntry.w loc_2F7F4 ; A - Spike
  60330. offsetTableEntry.w loc_2F52A ; C - Propeller after defeat
  60331. offsetTableEntry.w loc_2F8DA ; E - Flying vehicle, top
  60332. ; ===========================================================================
  60333.  
  60334. ; #7,status(ax) set via collision response routine (Touch_Enemy_Part2)
  60335. ; when after a hit collision_property(ax) = hitcount has reached zero
  60336. ; objoff_2A(ax) used as timer (countdown)
  60337. ; objoff_2C(ax) tertiary rountine counter
  60338. ; #0,objoff_2D(ax) set when robotnik is on ground
  60339. ; #1,objoff_2D(ax) set when robotnik is active (moving back & forth)
  60340. ; #2,objoff_2D(ax) set when robotnik is flying off after being defeated
  60341. ; #3,objoff_2D(ax) flag to separate spike from vehicle
  60342. ; objoff_2E(ax) y_position of wheels
  60343. ; objoff_34(ax) parent object
  60344. ; objoff_3C(ax) timer after defeat
  60345.  
  60346. ; loc_2EF36:
  60347. Obj56_Init:
  60348. move.l #Obj56_MapUnc_2FAF8,mappings(a0) ; main object
  60349. move.w #make_art_tile(ArtTile_ArtNem_Eggpod_1,1,0),art_tile(a0) ; vehicle with ability to fly, bottom part
  60350. ori.b #4,render_flags(a0)
  60351. move.b #$81,subtype(a0)
  60352. move.w #$29D0,x_pos(a0)
  60353. move.w #$426,y_pos(a0)
  60354. move.b #$20,width_pixels(a0)
  60355. move.b #$14,y_radius(a0)
  60356. move.b #4,priority(a0)
  60357. move.b #$F,collision_flags(a0)
  60358. move.b #8,collision_property(a0) ; hitcount
  60359. addq.b #2,routine(a0)
  60360. move.w x_pos(a0),objoff_30(a0)
  60361. move.w y_pos(a0),objoff_38(a0)
  60362. jsrto (Adjust2PArtPointer).l, JmpTo61_Adjust2PArtPointer
  60363. jsr (SingleObjLoad2).l ; vehicle with ability to fly, top part
  60364. bne.w +
  60365.  
  60366. _move.b #ObjID_EHZBoss,id(a1) ; load obj56
  60367. move.l a0,objoff_34(a1) ; link top and bottom to each other
  60368. move.l a1,objoff_34(a0) ; i.e. addresses for cross references
  60369. move.l #Obj56_MapUnc_2FAF8,mappings(a1)
  60370. move.w #make_art_tile(ArtTile_ArtNem_Eggpod_1,0,0),art_tile(a1)
  60371. move.b #4,render_flags(a1)
  60372. move.b #$20,width_pixels(a1)
  60373. move.b #4,priority(a1)
  60374. move.l x_pos(a0),x_pos(a1)
  60375. move.l y_pos(a0),y_pos(a1)
  60376. move.b #$E,routine(a1)
  60377. move.b #1,anim(a1) ; normal animation
  60378. move.b render_flags(a0),render_flags(a1)
  60379. +
  60380. jsr (SingleObjLoad2).l ; Vehicle on ground
  60381. bne.s +
  60382.  
  60383. _move.b #ObjID_EHZBoss,id(a1) ; load obj56
  60384. move.l a0,objoff_34(a1) ; linked to main object
  60385. move.l #Obj56_MapUnc_2FA58,mappings(a1)
  60386. move.w #make_art_tile(ArtTile_ArtNem_EHZBoss,0,0),art_tile(a1)
  60387. jsrto (Adjust2PArtPointer2).l, JmpTo9_Adjust2PArtPointer2
  60388. move.b #4,render_flags(a1)
  60389. move.b #$30,width_pixels(a1)
  60390. move.b #$10,y_radius(a1)
  60391. move.b #3,priority(a1)
  60392. move.w #$2AF0,x_pos(a1)
  60393. move.l y_pos(a0),y_pos(a1)
  60394. move.b #6,routine(a1)
  60395. +
  60396. bsr.w loc_2F098
  60397. subi_.w #8,objoff_38(a0)
  60398. move.w #$2AF0,x_pos(a0)
  60399. move.w #$2F8,y_pos(a0)
  60400. jsr (SingleObjLoad2).l ; propeller normal
  60401. bne.s + ; rts
  60402.  
  60403. _move.b #ObjID_EHZBoss,id(a1) ; load obj56
  60404. move.l a0,objoff_34(a1) ; linked to main object
  60405. move.l #Obj56_MapUnc_2F970,mappings(a1)
  60406. move.w #make_art_tile(ArtTile_ArtNem_EggChoppers,1,0),art_tile(a1)
  60407. jsrto (Adjust2PArtPointer2).l, JmpTo9_Adjust2PArtPointer2
  60408. move.b #4,render_flags(a1)
  60409. move.b #$40,width_pixels(a1)
  60410. move.b #3,priority(a1)
  60411. move.l x_pos(a0),x_pos(a1)
  60412. move.l y_pos(a0),y_pos(a1)
  60413. move.w #$1E,objoff_2A(a1)
  60414. move.b #4,routine(a1)
  60415. +
  60416. rts
  60417. ; ---------------------------------------------------------------------------
  60418.  
  60419. loc_2F098:
  60420. jsr (SingleObjLoad2).l ; first foreground wheel
  60421. bne.s +
  60422.  
  60423. _move.b #ObjID_EHZBoss,id(a1) ; load obj56
  60424. move.l a0,objoff_34(a1) ; linked to main object
  60425. move.l #Obj56_MapUnc_2FA58,mappings(a1)
  60426. move.w #make_art_tile(ArtTile_ArtNem_EHZBoss,1,0),art_tile(a1)
  60427. jsrto (Adjust2PArtPointer2).l, JmpTo9_Adjust2PArtPointer2
  60428. move.b #4,render_flags(a1)
  60429. move.b #$10,width_pixels(a1)
  60430. move.b #2,priority(a1)
  60431. move.b #$10,y_radius(a1)
  60432. move.b #$10,x_radius(a1)
  60433. move.w #$2AF0,x_pos(a1)
  60434. move.l y_pos(a0),y_pos(a1)
  60435. addi.w #$1C,x_pos(a1)
  60436. addi.w #$C,y_pos(a1)
  60437. move.b #8,routine(a1)
  60438. move.b #4,mapping_frame(a1)
  60439. move.b #1,anim(a1)
  60440. move.w #$A,objoff_2A(a1)
  60441. move.b #0,subtype(a1)
  60442. +
  60443. jsr (SingleObjLoad2).l ; second foreground wheel
  60444. bne.s +
  60445.  
  60446. _move.b #ObjID_EHZBoss,id(a1) ; load obj56
  60447. move.l a0,objoff_34(a1) ; linked to main object
  60448. move.l #Obj56_MapUnc_2FA58,mappings(a1)
  60449. move.w #make_art_tile(ArtTile_ArtNem_EHZBoss,1,0),art_tile(a1)
  60450. jsrto (Adjust2PArtPointer2).l, JmpTo9_Adjust2PArtPointer2
  60451. move.b #4,render_flags(a1)
  60452. move.b #$10,width_pixels(a1)
  60453. move.b #2,priority(a1)
  60454. move.b #$10,y_radius(a1)
  60455. move.b #$10,x_radius(a1)
  60456. move.w #$2AF0,x_pos(a1)
  60457. move.l y_pos(a0),y_pos(a1)
  60458. addi.w #-$C,x_pos(a1)
  60459. addi.w #$C,y_pos(a1)
  60460. move.b #8,routine(a1)
  60461. move.b #4,mapping_frame(a1)
  60462. move.b #1,anim(a1)
  60463. move.w #$A,objoff_2A(a1)
  60464. move.b #1,subtype(a1)
  60465. +
  60466. jsr (SingleObjLoad2).l ; background wheel
  60467. bne.s +
  60468.  
  60469. _move.b #ObjID_EHZBoss,id(a1) ; load obj56
  60470. move.l a0,objoff_34(a1) ; linked to main object
  60471. move.l #Obj56_MapUnc_2FA58,mappings(a1)
  60472. move.w #make_art_tile(ArtTile_ArtNem_EHZBoss,1,0),art_tile(a1)
  60473. jsrto (Adjust2PArtPointer2).l, JmpTo9_Adjust2PArtPointer2
  60474. move.b #4,render_flags(a1)
  60475. move.b #$10,width_pixels(a1)
  60476. move.b #3,priority(a1)
  60477. move.b #$10,y_radius(a1)
  60478. move.b #$10,x_radius(a1)
  60479. move.w #$2AF0,x_pos(a1)
  60480. move.l y_pos(a0),y_pos(a1)
  60481. addi.w #-$2C,x_pos(a1)
  60482. addi.w #$C,y_pos(a1)
  60483. move.b #8,routine(a1)
  60484. move.b #6,mapping_frame(a1)
  60485. move.b #2,anim(a1)
  60486. move.w #$A,objoff_2A(a1)
  60487. move.b #2,subtype(a1)
  60488. +
  60489. jsr (SingleObjLoad2).l ; Spike
  60490. bne.s +
  60491.  
  60492. _move.b #ObjID_EHZBoss,id(a1) ; load obj56
  60493. move.l a0,objoff_34(a1) ; linked to main object
  60494. move.l #Obj56_MapUnc_2FA58,mappings(a1)
  60495. move.w #make_art_tile(ArtTile_ArtNem_EHZBoss,1,0),art_tile(a1)
  60496. jsrto (Adjust2PArtPointer2).l, JmpTo9_Adjust2PArtPointer2
  60497. move.b #4,render_flags(a1)
  60498. move.b #$20,width_pixels(a1)
  60499. move.b #2,priority(a1)
  60500. move.w #$2AF0,x_pos(a1)
  60501. move.l y_pos(a0),y_pos(a1)
  60502. addi.w #-$36,x_pos(a1)
  60503. addi_.w #8,y_pos(a1)
  60504. move.b #$A,routine(a1)
  60505. move.b #1,mapping_frame(a1)
  60506. move.b #0,anim(a1)
  60507. +
  60508. rts
  60509. ; ===========================================================================
  60510.  
  60511. loc_2F262: ; Obj56_VehicleMain:
  60512. moveq #0,d0
  60513. move.b routine_secondary(a0),d0
  60514. move.w off_2F270(pc,d0.w),d1
  60515. jmp off_2F270(pc,d1.w)
  60516. ; ---------------------------------------------------------------------------
  60517. off_2F270: offsetTable
  60518. offsetTableEntry.w loc_2F27C ; 0 - approaching diagonally
  60519. offsetTableEntry.w loc_2F2A8 ; 2 - final approaching stage (vertically/waiting)
  60520. offsetTableEntry.w loc_2F304 ; 4 - moving back and forth
  60521. offsetTableEntry.w loc_2F336 ; 6 - boss defeated, falling/lying on ground
  60522. offsetTableEntry.w loc_2F374 ; 8 - boss idle for $C frames
  60523. offsetTableEntry.w loc_2F38A ; A - flying off, moving camera
  60524. ; ===========================================================================
  60525.  
  60526. loc_2F27C: ; Obj56_VehicleMain_Sub0:
  60527. move.b #0,collision_flags(a0)
  60528. cmpi.w #$29D0,x_pos(a0) ; reached the point to unite with bottom vehicle?
  60529. ble.s loc_2F29A
  60530. subi_.w #1,x_pos(a0)
  60531. addi_.w #1,y_pos(a0) ; move diagonally down
  60532. bra.w JmpTo35_DisplaySprite
  60533. ; ---------------------------------------------------------------------------
  60534.  
  60535. loc_2F29A:
  60536. move.w #$29D0,x_pos(a0)
  60537. addq.b #2,routine_secondary(a0) ; next routine
  60538. bra.w JmpTo35_DisplaySprite
  60539. ; ===========================================================================
  60540.  
  60541. loc_2F2A8: ; Obj56_VehicleMain_Sub2:
  60542. moveq #0,d0
  60543. move.b objoff_2C(a0),d0 ; tertiary routine
  60544. move.w off_2F2B6(pc,d0.w),d1
  60545. jmp off_2F2B6(pc,d1.w)
  60546. ; ---------------------------------------------------------------------------
  60547. off_2F2B6: offsetTable
  60548. offsetTableEntry.w loc_2F2BA ; 0 - moving down to ground vehicle vertically
  60549. offsetTableEntry.w loc_2F2E0 ; 2 - not moving, delay until activation
  60550. ; ---------------------------------------------------------------------------
  60551.  
  60552. loc_2F2BA: ; Obj56_VehicleMain_Sub2_0:
  60553. cmpi.w #$41E,y_pos(a0)
  60554. bge.s loc_2F2CC
  60555. addi_.w #1,y_pos(a0) ; move vertically (down)
  60556. bra.w JmpTo35_DisplaySprite
  60557. ; ---------------------------------------------------------------------------
  60558.  
  60559. loc_2F2CC:
  60560. addq.b #2,objoff_2C(a0) ; tertiary routine
  60561. bset #0,objoff_2D(a0) ; robotnik on ground (relevant for propeller)
  60562. move.w #$3C,objoff_2A(a0) ; timer for standing still
  60563. bra.w JmpTo35_DisplaySprite
  60564. ; ---------------------------------------------------------------------------
  60565.  
  60566. loc_2F2E0: ; Obj56_VehicleMain_Sub2_2:
  60567. subi_.w #1,objoff_2A(a0) ; timer
  60568. bpl.w JmpTo35_DisplaySprite
  60569. move.w #-$200,x_vel(a0)
  60570. addq.b #2,routine_secondary(a0)
  60571. move.b #$F,collision_flags(a0)
  60572. bset #1,objoff_2D(a0) ; boss now active and moving
  60573. bra.w JmpTo35_DisplaySprite
  60574. ; ===========================================================================
  60575.  
  60576. loc_2F304: ; Obj56_VehicleMain_Sub4:
  60577. bsr.w loc_2F4A6 ; routine to handle hits
  60578. bsr.w loc_2F484 ; position check, sets direction
  60579. move.w objoff_2E(a0),d0 ; y_position of wheels
  60580. lsr.w #1,d0
  60581. subi.w #$14,d0
  60582. move.w d0,y_pos(a0) ; set y_pos depending on wheels
  60583. move.w #0,objoff_2E(a0)
  60584. move.l x_pos(a0),d2
  60585. move.w x_vel(a0),d0
  60586. ext.l d0
  60587. asl.l #8,d0
  60588. add.l d0,d2
  60589. move.l d2,x_pos(a0) ; set x_pos depening on velocity
  60590. bra.w JmpTo35_DisplaySprite
  60591. ; ===========================================================================
  60592.  
  60593. loc_2F336: ; Obj56_VehicleMain_Sub6:
  60594. subq.w #1,objoff_3C(a0) ; timer set after defeat
  60595. bmi.s loc_2F35C ; if countdown finished
  60596. bsr.w Boss_LoadExplosion
  60597. jsrto (ObjectMoveAndFall).l, JmpTo4_ObjectMoveAndFall
  60598. jsrto (ObjCheckFloorDist).l, JmpTo3_ObjCheckFloorDist
  60599. tst.w d1
  60600. bpl.w JmpTo35_DisplaySprite
  60601. add.w d1,y_pos(a0)
  60602. move.w #0,y_vel(a0) ; set to ground and stand still
  60603. bra.w JmpTo35_DisplaySprite
  60604. ; ---------------------------------------------------------------------------
  60605.  
  60606. loc_2F35C:
  60607. clr.w x_vel(a0)
  60608. addq.b #2,routine_secondary(a0)
  60609. move.w #-$26,objoff_3C(a0)
  60610. move.w #$C,objoff_2A(a0)
  60611. bra.w JmpTo35_DisplaySprite
  60612. ; ===========================================================================
  60613.  
  60614. loc_2F374: ; Obj56_VehicleMain_Sub8:
  60615. subq.w #1,objoff_2A(a0) ; timer
  60616. bpl.w JmpTo35_DisplaySprite
  60617. addq.b #2,routine_secondary(a0)
  60618. move.b #0,objoff_2C(a0) ; tertiary routine
  60619. bra.w JmpTo35_DisplaySprite
  60620. ; ===========================================================================
  60621.  
  60622. loc_2F38A: ; Obj56_VehicleMain_SubA:
  60623. moveq #0,d0
  60624. move.b objoff_2C(a0),d0 ; tertiary routine
  60625. move.w off_2F39C(pc,d0.w),d1
  60626. jsr off_2F39C(pc,d1.w)
  60627. bra.w JmpTo35_DisplaySprite
  60628. ; ===========================================================================
  60629. off_2F39C: offsetTable
  60630. offsetTableEntry.w loc_2F3A2 ; 0 - initialize propellor
  60631. offsetTableEntry.w loc_2F424 ; 2 - waiting
  60632. offsetTableEntry.w loc_2F442 ; 4 - flying off
  60633. ; ===========================================================================
  60634.  
  60635. loc_2F3A2: ; Obj56_VehicleMain_SubA_0:
  60636. bclr #0,objoff_2D(a0) ; robotnik off ground
  60637. jsrto (SingleObjLoad2).l, JmpTo21_SingleObjLoad2 ; reload propeller after defeat
  60638. bne.w + ; rts
  60639.  
  60640. _move.b #ObjID_EHZBoss,id(a1) ; load obj56
  60641. move.l a0,objoff_34(a1) ; linked to main object
  60642. move.l #Obj56_MapUnc_2F970,mappings(a1)
  60643. move.w #make_art_tile(ArtTile_ArtNem_EggChoppers,1,0),art_tile(a1)
  60644. jsrto (Adjust2PArtPointer2).l, JmpTo9_Adjust2PArtPointer2
  60645. move.b #4,render_flags(a1)
  60646. move.b #$20,width_pixels(a1)
  60647. move.b #3,priority(a1)
  60648. move.l x_pos(a0),x_pos(a1)
  60649. move.l y_pos(a0),y_pos(a1)
  60650. addi.w #$C,y_pos(a1)
  60651. move.b status(a0),status(a1)
  60652. move.b render_flags(a0),render_flags(a1)
  60653. move.b #$C,routine(a1)
  60654. move.b #2,anim(a1)
  60655. move.w #$10,objoff_2A(a1) ; timer
  60656. move.w #$32,objoff_2A(a0) ; timer
  60657. addq.b #2,objoff_2C(a0) ; tertiary routine - increase
  60658. jsrto (PlayLevelMusic).l, JmpTo2_PlayLevelMusic ; play level Music
  60659. move.b #1,(Boss_defeated_flag).w
  60660. +
  60661. rts
  60662. ; ===========================================================================
  60663.  
  60664. loc_2F424: ; Obj56_VehicleMain_SubA_2:
  60665. subi_.w #1,objoff_2A(a0) ; timer
  60666. bpl.s + ; rts
  60667. bset #2,objoff_2D(a0) ; robotnik flying off
  60668. move.w #$60,objoff_2A(a0) ; timer
  60669. addq.b #2,objoff_2C(a0) ; tertiary routine
  60670. jsrto (LoadPLC_AnimalExplosion).l, JmpTo2_LoadPLC_AnimalExplosion ; PLC_Explosion
  60671. +
  60672. rts
  60673. ; ===========================================================================
  60674.  
  60675. loc_2F442: ; Obj56_VehicleMain_SubA_4:
  60676. subi_.w #1,objoff_2A(a0) ; timer
  60677. bpl.s loc_2F45C
  60678. bset #0,status(a0)
  60679. bset #0,render_flags(a0)
  60680. addq.w #6,x_pos(a0)
  60681. bra.s loc_2F460
  60682. ; ===========================================================================
  60683.  
  60684. loc_2F45C:
  60685. subq.w #1,y_pos(a0)
  60686.  
  60687. loc_2F460:
  60688. cmpi.w #$2AB0,(Camera_Max_X_pos).w
  60689. bhs.s loc_2F46E
  60690. addq.w #2,(Camera_Max_X_pos).w
  60691. bra.s return_2F482
  60692. ; ===========================================================================
  60693.  
  60694. loc_2F46E:
  60695. tst.b render_flags(a0)
  60696. bmi.s return_2F482
  60697. addq.w #4,sp
  60698. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  60699. jsrto (DeleteObject2).l, JmpTo5_DeleteObject2
  60700. jmpto (DeleteObject).l, JmpTo52_DeleteObject
  60701. ; ===========================================================================
  60702.  
  60703. return_2F482:
  60704. rts
  60705. ; ===========================================================================
  60706.  
  60707. loc_2F484: ; shared routine, checks positions and sets direction
  60708. move.w x_pos(a0),d0
  60709. cmpi.w #$28A0,d0 ; beyond left boundary?
  60710. ble.s loc_2F494
  60711. cmpi.w #$2B08,d0
  60712. blt.s return_2F4A4 ; beyond right boundary?
  60713.  
  60714. loc_2F494: ; beyond boundary
  60715. bchg #0,status(a0) ; change direction
  60716. bchg #0,render_flags(a0) ; mirror sprite
  60717. neg.w x_vel(a0) ; change direction of velocity
  60718.  
  60719. return_2F4A4:
  60720. rts
  60721. ; ===========================================================================
  60722.  
  60723. loc_2F4A6: ; routine to handle hits
  60724. cmpi.b #6,routine_secondary(a0) ; is only called when value is 4?
  60725. bhs.s return_2F4EC ; thus unnecessary? (return if greater or equal than 6)
  60726. tst.b status(a0)
  60727. bmi.s loc_2F4EE ; sonic has just defeated the boss (i.e. bit 7 set)
  60728. tst.b collision_flags(a0) ; set to 0 when boss was hit by Touch_Enemy_Part2
  60729. bne.s return_2F4EC ; not 0, i.e. boss not hit
  60730. tst.b objoff_3E(a0)
  60731. bne.s loc_2F4D0 ; boss already invincibile
  60732. move.b #$20,objoff_3E(a0) ; boss invincibility timer
  60733. move.w #SndID_BossHit,d0
  60734. jsr (PlaySound).l ; play boss hit sound
  60735.  
  60736. loc_2F4D0:
  60737. lea (Normal_palette_line2+2).w,a1
  60738. moveq #0,d0 ; black
  60739. tst.w (a1)
  60740. bne.s loc_2F4DE ; already not black (i.e. white)?
  60741. move.w #$EEE,d0 ; white
  60742.  
  60743. loc_2F4DE:
  60744. move.w d0,(a1) ; set respective color
  60745. subq.b #1,objoff_3E(a0) ; decrease boss invincibility timer
  60746. bne.s return_2F4EC
  60747. move.b #$F,collision_flags(a0) ; if invincibility ended, allow collision again
  60748.  
  60749. return_2F4EC:
  60750. rts
  60751. ; ===========================================================================
  60752.  
  60753. loc_2F4EE: ; boss defeated
  60754. moveq #100,d0
  60755. jsrto (AddPoints).l, JmpTo3_AddPoints ; add 1000 points, reward for defeating boss
  60756. move.b #6,routine_secondary(a0)
  60757. move.w #0,x_vel(a0)
  60758. move.w #-$180,y_vel(a0)
  60759. move.w #$B3,objoff_3C(a0) ; timer
  60760. bset #3,objoff_2D(a0) ; flag to separate spike from vehicle
  60761. movea.l objoff_34(a0),a1 ; address top part
  60762. move.b #4,anim(a1) ; flying off animation
  60763. move.b #6,mapping_frame(a1)
  60764. moveq #PLCID_Capsule,d0
  60765. jmpto (LoadPLC).l, JmpTo6_LoadPLC ; load egg prison
  60766. ; ===========================================================================
  60767. rts
  60768. ; ===========================================================================
  60769.  
  60770. loc_2F52A: ; Obj56_PropellerReloaded: ; Propeller after defeat
  60771. subi_.w #1,y_pos(a0) ; move up
  60772. subi_.w #1,objoff_2A(a0) ; decrease timer
  60773. bpl.w JmpTo35_DisplaySprite
  60774. move.b #4,routine(a0) ; Propeller normal
  60775. lea (Ani_obj56_a).l,a1
  60776. jsrto (AnimateSprite).l, JmpTo17_AnimateSprite
  60777. bra.w JmpTo35_DisplaySprite
  60778. ; ===========================================================================
  60779.  
  60780. loc_2F54E: ; Obj56_Propeller: ; Propeller normal
  60781. moveq #0,d0
  60782. move.b routine_secondary(a0),d0
  60783. move.w off_2F55C(pc,d0.w),d1
  60784. jmp off_2F55C(pc,d1.w)
  60785. ; ---------------------------------------------------------------------------
  60786. off_2F55C: offsetTable
  60787. offsetTableEntry.w loc_2F560 ; 0 - robotnik in air
  60788. offsetTableEntry.w loc_2F5C6 ; 2 - robotnik on ground
  60789. ; ---------------------------------------------------------------------------
  60790.  
  60791. loc_2F560: ; Obj56_Propeller_Sub0
  60792. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  60793. cmpi.b #ObjID_EHZBoss,id(a1)
  60794. bne.w JmpTo52_DeleteObject ; if boss non-existant
  60795. btst #0,objoff_2D(a1) ; is robotnik on ground?
  60796. beq.s loc_2F58E ; if not, branch
  60797. move.b #1,anim(a0)
  60798. move.w #$18,objoff_2A(a0) ; timer until deletion
  60799. addq.b #2,routine_secondary(a0)
  60800. move.b #MusID_StopSFX,d0
  60801. jsrto (PlaySound).l, JmpTo6_PlaySound
  60802. bra.s loc_2F5A0
  60803. ; ---------------------------------------------------------------------------
  60804.  
  60805. loc_2F58E: ; not on ground
  60806. move.b (Vint_runcount+3).w,d0
  60807. andi.b #$1F,d0
  60808. bne.s loc_2F5A0
  60809. move.b #SndID_Helicopter,d0
  60810. jsrto (PlaySound).l, JmpTo6_PlaySound
  60811.  
  60812. loc_2F5A0:
  60813. move.w x_pos(a1),x_pos(a0)
  60814. move.w y_pos(a1),y_pos(a0)
  60815. move.b status(a1),status(a0)
  60816. move.b render_flags(a1),render_flags(a0)
  60817. lea (Ani_obj56_a).l,a1
  60818. jsrto (AnimateSprite).l, JmpTo17_AnimateSprite
  60819. bra.w JmpTo35_DisplaySprite
  60820. ; ---------------------------------------------------------------------------
  60821.  
  60822. loc_2F5C6: ; Obj56_Propeller_Sub2
  60823. subi_.w #1,objoff_2A(a0) ; timer
  60824. bpl.s loc_2F5E8
  60825. cmpi.w #-$10,objoff_2A(a0)
  60826. ble.w JmpTo52_DeleteObject
  60827. move.b #4,priority(a0)
  60828. addi_.w #1,y_pos(a0) ; move down
  60829. bra.w JmpTo35_DisplaySprite
  60830. ; ---------------------------------------------------------------------------
  60831.  
  60832. loc_2F5E8:
  60833. lea (Ani_obj56_a).l,a1
  60834. jsrto (AnimateSprite).l, JmpTo17_AnimateSprite
  60835. bra.w JmpTo35_DisplaySprite
  60836. ; ===========================================================================
  60837.  
  60838. loc_2F5F6: ; Obj56_GroundVehicle:
  60839. tst.b routine_secondary(a0)
  60840. bne.s loc_2F626
  60841. ; Obj56_GroundVehicle_Sub0:
  60842. cmpi.w #$28F0,(Camera_Min_X_pos).w
  60843. blo.w JmpTo35_DisplaySprite
  60844. cmpi.w #$29D0,x_pos(a0)
  60845. ble.s loc_2F618
  60846. subi_.w #1,x_pos(a0)
  60847. bra.w JmpTo35_DisplaySprite
  60848. ; ---------------------------------------------------------------------------
  60849.  
  60850. loc_2F618:
  60851. move.w #$29D0,x_pos(a0)
  60852. addq.b #2,routine_secondary(a0)
  60853. bra.w JmpTo35_DisplaySprite
  60854. ; ---------------------------------------------------------------------------
  60855.  
  60856. loc_2F626: ; Obj56_GroundVehicle_Sub2:
  60857. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  60858. btst #1,objoff_2D(a1)
  60859. beq.w JmpTo35_DisplaySprite ; boss not moving yet (inactive)
  60860. btst #2,objoff_2D(a1) ; robotnik flying off flag
  60861. bne.w JmpTo35_DisplaySprite
  60862. move.w x_pos(a1),x_pos(a0)
  60863. move.w y_pos(a1),y_pos(a0)
  60864. addi_.w #8,y_pos(a0)
  60865. move.b status(a1),status(a0)
  60866. bmi.w JmpTo35_DisplaySprite
  60867. move.b render_flags(a1),render_flags(a0)
  60868. bra.w JmpTo35_DisplaySprite
  60869. ; ===========================================================================
  60870.  
  60871. loc_2F664: ; Obj56_Wheel:
  60872. moveq #0,d0
  60873. move.b routine_secondary(a0),d0
  60874. move.w off_2F672(pc,d0.w),d1
  60875. jmp off_2F672(pc,d1.w)
  60876. ; ---------------------------------------------------------------------------
  60877. off_2F672: offsetTable
  60878. offsetTableEntry.w loc_2F67C ; 0 - wheels moving towards start position
  60879. offsetTableEntry.w loc_2F714 ; 2 - standing still (boss inactive)
  60880. offsetTableEntry.w loc_2F746 ; 4 - normal mode (boss active)
  60881. offsetTableEntry.w loc_2F7A6 ; 6 - inactive while defeat
  60882. offsetTableEntry.w loc_2F7D2 ; 8 - wheels bouncing away after defeat
  60883. ; ---------------------------------------------------------------------------
  60884.  
  60885. loc_2F67C: ; Obj56_Wheel_Sub0:
  60886. cmpi.w #$28F0,(Camera_Min_X_pos).w
  60887. blo.w JmpTo35_DisplaySprite
  60888. move.w #$100,y_vel(a0)
  60889. cmpi.b #1,subtype(a0) ; wheel number (0-2)
  60890. bgt.s loc_2F6B6 ; background wheel
  60891. beq.s loc_2F6A6 ; second foreground wheel
  60892. ; ---------------------------------------------------------------------------
  60893. cmpi.w #$29EC,x_pos(a0) ; first foreground wheel
  60894. ble.s loc_2F6C6
  60895. subi_.w #1,x_pos(a0)
  60896. bra.s loc_2F6E8
  60897.  
  60898. loc_2F6A6: ; second foreground wheel
  60899. cmpi.w #$29C4,x_pos(a0)
  60900. ble.s loc_2F6D2
  60901. subi_.w #1,x_pos(a0)
  60902. bra.s loc_2F6E8
  60903.  
  60904. loc_2F6B6: ; background wheel
  60905. cmpi.w #$29A4,x_pos(a0)
  60906. ble.s loc_2F6DE
  60907. subi_.w #1,x_pos(a0)
  60908. bra.s loc_2F6E8
  60909. ; ---------------------------------------------------------------------------
  60910.  
  60911. loc_2F6C6: ; first foreground wheel
  60912. move.w #$29EC,x_pos(a0)
  60913. addq.b #2,routine_secondary(a0)
  60914. bra.s loc_2F6E8
  60915.  
  60916. loc_2F6D2: ; second foreground wheel
  60917. move.w #$29C4,x_pos(a0)
  60918. addq.b #2,routine_secondary(a0)
  60919. bra.s loc_2F6E8
  60920.  
  60921. loc_2F6DE: ; background wheel
  60922. move.w #$29A4,x_pos(a0)
  60923. addq.b #2,routine_secondary(a0)
  60924. ; ---------------------------------------------------------------------------
  60925.  
  60926. loc_2F6E8: ; routine for all wheels
  60927. jsrto (ObjectMoveAndFall).l, JmpTo4_ObjectMoveAndFall
  60928. jsr (ObjCheckFloorDist).l
  60929. tst.w d1
  60930. bpl.s loc_2F6FA
  60931. add.w d1,y_pos(a0) ; reset on floor
  60932.  
  60933. loc_2F6FA:
  60934. tst.b routine_secondary(a0)
  60935. beq.s loc_2F706
  60936. move.w #-$200,x_vel(a0) ; if reached position, set velocity
  60937.  
  60938. loc_2F706:
  60939. lea (Ani_obj56_b).l,a1
  60940. jsrto (AnimateSprite).l, JmpTo17_AnimateSprite
  60941. bra.w JmpTo35_DisplaySprite
  60942. ; ---------------------------------------------------------------------------
  60943.  
  60944. loc_2F714: ; Obj56_Wheel_Sub2:
  60945. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  60946. cmpi.b #ObjID_EHZBoss,id(a1)
  60947. bne.w JmpTo52_DeleteObject ; if boss non-existant
  60948. btst #1,objoff_2D(a1)
  60949. beq.w JmpTo35_DisplaySprite ; boss not moving yet (inactive)
  60950. addq.b #2,routine_secondary(a0)
  60951. cmpi.b #2,priority(a0)
  60952. bne.s BranchTo_JmpTo35_DisplaySprite
  60953. move.w y_pos(a0),d0
  60954. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  60955. add.w d0,objoff_2E(a1)
  60956.  
  60957. BranchTo_JmpTo35_DisplaySprite
  60958. bra.w JmpTo35_DisplaySprite
  60959. ; ---------------------------------------------------------------------------
  60960.  
  60961. loc_2F746: ; Obj56_Wheel_Sub4:
  60962. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  60963. cmpi.b #ObjID_EHZBoss,id(a1)
  60964. bne.w JmpTo52_DeleteObject ; if boss non-existant
  60965. move.b status(a1),status(a0)
  60966. move.b render_flags(a1),render_flags(a0)
  60967. tst.b status(a0)
  60968. bpl.s loc_2F768 ; has sonic just defeated the boss (i.e. bit7 set)?
  60969. addq.b #2,routine_secondary(a0) ; if yes, Sub6
  60970.  
  60971. loc_2F768:
  60972. bsr.w loc_2F484 ; position check, sets direction
  60973. jsrto (ObjectMoveAndFall).l, JmpTo4_ObjectMoveAndFall
  60974. jsr (ObjCheckFloorDist).l
  60975. tst.w d1
  60976. bpl.s loc_2F77E
  60977. add.w d1,y_pos(a0) ; reset on floor
  60978.  
  60979. loc_2F77E:
  60980. move.w #$100,y_vel(a0)
  60981. cmpi.b #2,priority(a0)
  60982. bne.s loc_2F798
  60983. move.w y_pos(a0),d0
  60984. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  60985. add.w d0,objoff_2E(a1)
  60986.  
  60987. loc_2F798:
  60988. lea (Ani_obj56_b).l,a1
  60989. jsrto (AnimateSprite).l, JmpTo17_AnimateSprite
  60990. bra.w JmpTo35_DisplaySprite
  60991. ; ---------------------------------------------------------------------------
  60992.  
  60993. loc_2F7A6: ; Obj56_Wheel_Sub6:
  60994. subi_.w #1,objoff_2A(a0) ; timer, initially set to $A (first delay until wheels rolling off)
  60995. bpl.w JmpTo35_DisplaySprite
  60996. addq.b #2,routine_secondary(a0) ; Sub8
  60997. move.w #$A,objoff_2A(a0)
  60998. move.w #-$300,y_vel(a0) ; first bounce higher
  60999. cmpi.b #2,priority(a0)
  61000. beq.w JmpTo35_DisplaySprite
  61001. neg.w x_vel(a0) ; into other direction
  61002. bra.w JmpTo35_DisplaySprite
  61003. ; ---------------------------------------------------------------------------
  61004.  
  61005. loc_2F7D2: ; Obj56_Wheel_Sub8:
  61006. subq.w #1,objoff_2A(a0) ; timer, initially set to $A (second delay until wheels rolling off)
  61007. bpl.w JmpTo35_DisplaySprite
  61008. jsrto (ObjectMoveAndFall).l, JmpTo4_ObjectMoveAndFall
  61009. jsrto (ObjCheckFloorDist).l, JmpTo3_ObjCheckFloorDist
  61010. tst.w d1
  61011. bpl.s BranchTo_JmpTo36_MarkObjGone
  61012. move.w #-$200,y_vel(a0) ; negative velocity to have bouncing effect
  61013. add.w d1,y_pos(a0) ; reset on floor
  61014.  
  61015. BranchTo_JmpTo36_MarkObjGone
  61016. jmpto (MarkObjGone).l, JmpTo36_MarkObjGone
  61017. ; ===========================================================================
  61018.  
  61019. loc_2F7F4: ; Obj56_Spike:
  61020. tst.b routine_secondary(a0)
  61021. bne.s loc_2F824
  61022. ; Obj56_Spike_Sub0:
  61023. cmpi.w #$28F0,(Camera_Min_X_pos).w
  61024. blo.w JmpTo35_DisplaySprite
  61025. cmpi.w #$299A,x_pos(a0)
  61026. ble.s loc_2F816
  61027. subi_.w #1,x_pos(a0)
  61028. bra.w JmpTo35_DisplaySprite
  61029. ; ---------------------------------------------------------------------------
  61030.  
  61031. loc_2F816:
  61032. move.w #$299A,x_pos(a0)
  61033. addq.b #2,routine_secondary(a0)
  61034. bra.w JmpTo35_DisplaySprite
  61035. ; ---------------------------------------------------------------------------
  61036.  
  61037. loc_2F824: ; Obj56_Spike_Sub2:
  61038. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  61039. cmpi.b #ObjID_EHZBoss,id(a1)
  61040. bne.w JmpTo52_DeleteObject ; if boss non-existant
  61041. btst #3,objoff_2D(a1)
  61042. bne.s loc_2F88A ; spike separated from vehicle
  61043. bsr.w loc_2F8AA
  61044. btst #1,objoff_2D(a1)
  61045. beq.w JmpTo35_DisplaySprite ; boss not moving yet (inactive)
  61046. move.b #$8B,collision_flags(a0) ; spike still linked to vehicle
  61047. move.w x_pos(a1),x_pos(a0)
  61048. move.w y_pos(a1),y_pos(a0)
  61049. move.b status(a1),status(a0) ; transfer positions
  61050. move.b render_flags(a1),render_flags(a0)
  61051. addi.w #$10,y_pos(a0) ; vertical offset
  61052. move.w #-$36,d0
  61053. btst #0,status(a0)
  61054. beq.s loc_2F878
  61055. neg.w d0
  61056.  
  61057. loc_2F878:
  61058. add.w d0,x_pos(a0) ; horizontal offset
  61059. lea (Ani_obj56_b).l,a1
  61060. jsrto (AnimateSprite).l, JmpTo17_AnimateSprite
  61061. bra.w JmpTo35_DisplaySprite
  61062. ; ---------------------------------------------------------------------------
  61063.  
  61064. loc_2F88A: ; spike separated from vehicle
  61065. move.w #-3,d0 ; velocity of spike in pixels/frame
  61066. btst #0,status(a0) ; check direction
  61067. beq.s loc_2F898
  61068. neg.w d0
  61069.  
  61070. loc_2F898:
  61071. add.w d0,x_pos(a0)
  61072. lea (Ani_obj56_b).l,a1
  61073. jsrto (AnimateSprite).l, JmpTo17_AnimateSprite
  61074. bra.w JmpTo35_DisplaySprite
  61075. ; ---------------------------------------------------------------------------
  61076.  
  61077. loc_2F8AA:
  61078. cmpi.b #1,collision_property(a1) ; hit counter, only 1 life left?
  61079. beq.s loc_2F8B4
  61080. rts
  61081. ; ---------------------------------------------------------------------------
  61082.  
  61083. loc_2F8B4:
  61084. move.w x_pos(a0),d0
  61085. sub.w (MainCharacter+x_pos).w,d0
  61086. bpl.s loc_2F8C8
  61087. btst #0,status(a1) ; sonic right from spike
  61088. bne.s loc_2F8D2 ; spike facing right
  61089. rts
  61090. ; ---------------------------------------------------------------------------
  61091.  
  61092. loc_2F8C8:
  61093. btst #0,status(a1) ; sonic left from spike
  61094. beq.s loc_2F8D2 ; spike facing left
  61095. rts
  61096. ; ---------------------------------------------------------------------------
  61097.  
  61098. loc_2F8D2:
  61099. bset #3,objoff_2D(a1) ; flag to separate spike from vehicle
  61100. rts
  61101. ; ===========================================================================
  61102.  
  61103. loc_2F8DA: ; Obj56_VehicleTop:
  61104. movea.l objoff_34(a0),a1 ; parent address (vehicle)
  61105. move.l x_pos(a1),x_pos(a0)
  61106. move.l y_pos(a1),y_pos(a0)
  61107. move.b status(a1),status(a0) ; update position and status
  61108. move.b render_flags(a1),render_flags(a0)
  61109. move.b objoff_3E(a1),d0 ; boss invincibility timer
  61110. cmpi.b #$1F,d0 ; boss just got hit?
  61111. bne.s loc_2F906
  61112. move.b #2,anim(a0) ; robotnik animation when hit
  61113.  
  61114. loc_2F906:
  61115. cmpi.b #4,(MainCharacter+routine).w ; Sonic = ball
  61116. beq.s loc_2F916
  61117. cmpi.b #4,(Sidekick+routine).w ; Tails = ball
  61118. bne.s loc_2F924
  61119.  
  61120. loc_2F916:
  61121. cmpi.b #2,anim(a0) ; check eggman animation (when hit)
  61122. beq.s loc_2F924
  61123. move.b #3,anim(a0) ; eggman animation when hurting sonic
  61124.  
  61125. loc_2F924:
  61126. lea (Ani_obj56_c).l,a1 ; animation script
  61127. jsr (AnimateSprite).l
  61128. jmp (DisplaySprite).l
  61129. ; ===========================================================================
  61130. ; animation script
  61131. ; off_2F936:
  61132. Ani_obj56_a: offsetTable
  61133. offsetTableEntry.w byte_2F93C ; 0
  61134. offsetTableEntry.w byte_2F940 ; 1
  61135. offsetTableEntry.w byte_2F956 ; 2
  61136. byte_2F93C:
  61137. dc.b 1, 5, 6,$FF
  61138. byte_2F940:
  61139. dc.b 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0, 0, 0
  61140. dc.b 0, 0, 0, 0, 0,$FF; 16
  61141. byte_2F956:
  61142. dc.b 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 3, 3, 3, 2
  61143. dc.b 2, 2, 1, 1, 1, 5, 6,$FE, 2
  61144. even
  61145. ; ----------------------------------------------------------------------------
  61146. ; sprite mappings
  61147. ; ----------------------------------------------------------------------------
  61148. Obj56_MapUnc_2F970: BINCLUDE "mappings/sprite/obj56_a.bin"
  61149. ; propeller
  61150. ; 7 frames
  61151.  
  61152. ; animation script
  61153. ; off_2FA44:
  61154. Ani_obj56_b: offsetTable
  61155. offsetTableEntry.w byte_2FA4A ; 0
  61156. offsetTableEntry.w byte_2FA4F ; 1
  61157. offsetTableEntry.w byte_2FA53 ; 2
  61158. byte_2FA4A:
  61159. dc.b 5, 1, 2, 3,$FF ; spike
  61160. rev02even
  61161. byte_2FA4F:
  61162. dc.b 1, 4, 5,$FF ; foreground wheel
  61163. rev02even
  61164. byte_2FA53:
  61165. dc.b 1, 6, 7,$FF ; background wheel
  61166. even
  61167.  
  61168. ; ----------------------------------------------------------------------------
  61169. ; sprite mappings
  61170. ; ----------------------------------------------------------------------------
  61171. Obj56_MapUnc_2FA58: BINCLUDE "mappings/sprite/obj56_b.bin"
  61172. ; ground vehicle
  61173. ; frame 0 = vehicle itself
  61174. ; frame 1-3 = spike
  61175. ; frame 4-5 = foreground wheel
  61176. ; frame 6-7 = background wheel
  61177.  
  61178. ; animation script
  61179. ; off_2FAC8:
  61180. Ani_obj56_c: offsetTable
  61181. offsetTableEntry.w byte_2FAD2 ; 0
  61182. offsetTableEntry.w byte_2FAD5 ; 1
  61183. offsetTableEntry.w byte_2FAD9 ; 2
  61184. offsetTableEntry.w byte_2FAE2 ; 3
  61185. offsetTableEntry.w byte_2FAEB ; 4
  61186. byte_2FAD2: dc.b $F, 0,$FF ; bottom
  61187. rev02even
  61188. byte_2FAD5: dc.b 7, 1, 2,$FF ; top, normal
  61189. rev02even
  61190. byte_2FAD9: dc.b 7, 5, 5, 5, 5, 5, 5,$FD, 1 ; top, when hit
  61191. rev02even
  61192. byte_2FAE2: dc.b 7, 3, 4, 3, 4, 3, 4,$FD, 1 ; top, laughter (when hurting sonic)
  61193. rev02even
  61194. byte_2FAEB: dc.b $F, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,$FD, 1 ; top, when flying off
  61195. even ; for top part, after end of special animations always return to normal one ($FD->1)
  61196.  
  61197. ; ----------------------------------------------------------------------------
  61198. ; sprite mappings
  61199. ; ----------------------------------------------------------------------------
  61200. Obj56_MapUnc_2FAF8: BINCLUDE "mappings/sprite/obj56_c.bin"
  61201. ; flying vehicle
  61202. ; frame 0 = bottom
  61203. ; frame 1-2 = top, normal
  61204. ; frame 3-4 = top, laughter
  61205. ; frame 5 = top, when hit
  61206. ; frame 6 = top, when flying off
  61207. ; ===========================================================================
  61208.  
  61209. if ~~removeJmpTos
  61210. JmpTo35_DisplaySprite
  61211. jmp (DisplaySprite).l
  61212. JmpTo52_DeleteObject
  61213. jmp (DeleteObject).l
  61214. JmpTo36_MarkObjGone
  61215. jmp (MarkObjGone).l
  61216. JmpTo5_DeleteObject2
  61217. jmp (DeleteObject2).l
  61218. JmpTo6_PlaySound
  61219. jmp (PlaySound).l
  61220. JmpTo21_SingleObjLoad2
  61221. jmp (SingleObjLoad2).l
  61222. JmpTo17_AnimateSprite
  61223. jmp (AnimateSprite).l
  61224. JmpTo9_Adjust2PArtPointer2
  61225. jmp (Adjust2PArtPointer2).l
  61226. JmpTo3_ObjCheckFloorDist
  61227. jmp (ObjCheckFloorDist).l
  61228. JmpTo6_LoadPLC
  61229. jmp (LoadPLC).l
  61230. JmpTo3_AddPoints
  61231. jmp (AddPoints).l
  61232. JmpTo61_Adjust2PArtPointer
  61233. jmp (Adjust2PArtPointer).l
  61234. JmpTo2_PlayLevelMusic ; play level Music
  61235. jmp (PlayLevelMusic).l
  61236. JmpTo2_LoadPLC_AnimalExplosion ; PLC_Explosion
  61237. jmp (LoadPLC_AnimalExplosion).l
  61238. JmpTo4_ObjectMoveAndFall
  61239. jmp (ObjectMoveAndFall).l
  61240.  
  61241. align 4
  61242. else
  61243. JmpTo52_DeleteObject
  61244. jmp (DeleteObject).l
  61245. JmpTo35_DisplaySprite
  61246. jmp (DisplaySprite).l
  61247. endif
  61248.  
  61249.  
  61250.  
  61251.  
  61252. ; ===========================================================================
  61253. ; ----------------------------------------------------------------------------
  61254. ; Object 52 - HTZ boss
  61255. ; ----------------------------------------------------------------------------
  61256. ; Sprite_2FC50:
  61257. Obj52:
  61258. moveq #0,d0
  61259. move.b boss_subtype(a0),d0
  61260. move.w Obj52_Index(pc,d0.w),d1
  61261. jmp Obj52_Index(pc,d1.w)
  61262. ; ===========================================================================
  61263. ; off_2FC5E:
  61264. Obj52_Index: offsetTable
  61265. offsetTableEntry.w Obj52_Init ; 0
  61266. offsetTableEntry.w Obj52_Mobile ; 2
  61267. offsetTableEntry.w Obj52_FlameThrower ; 4
  61268. offsetTableEntry.w Obj52_LavaBall ; 6
  61269. offsetTableEntry.w loc_30210 ; 8
  61270. ; ===========================================================================
  61271. ; loc_2FC68:
  61272. Obj52_Init:
  61273. move.l #Obj52_MapUnc_302BC,mappings(a0)
  61274. move.w #make_art_tile(ArtTile_ArtNem_Eggpod_2,0,0),art_tile(a0)
  61275. ori.b #4,render_flags(a0)
  61276. move.b #-$70,mainspr_width(a0)
  61277. move.b #-$70,mainspr_height(a0)
  61278. move.b #4,priority(a0)
  61279. move.w #$3040,x_pos(a0)
  61280. move.w #$580,y_pos(a0)
  61281. move.b #1,objoff_2C(a0)
  61282. move.b #1,mainspr_mapframe(a0)
  61283. addq.b #2,boss_subtype(a0)
  61284. bset #6,render_flags(a0)
  61285. move.b #$32,collision_flags(a0)
  61286. move.b #8,objoff_32(a0)
  61287. move.w #-$E0,(Boss_Y_vel).w
  61288. move.w x_pos(a0),(Boss_X_pos).w
  61289. move.w y_pos(a0),(Boss_Y_pos).w
  61290. clr.b objoff_14(a0)
  61291. move.w x_pos(a0),sub2_x_pos(a0)
  61292. move.w y_pos(a0),sub2_y_pos(a0)
  61293. move.b #2,sub2_mapframe(a0)
  61294. bsr.w loc_2FCEA
  61295. rts
  61296. ; ===========================================================================
  61297.  
  61298. loc_2FCEA:
  61299. lea (Boss_AnimationArray).w,a2
  61300. move.b #6,(a2)+
  61301. move.b #0,(a2)+
  61302. move.b #$10,(a2)+
  61303. move.b #0,(a2)+
  61304. rts
  61305. ; ===========================================================================
  61306.  
  61307. ; loc_2FD00:
  61308. Obj52_Mobile:
  61309. moveq #0,d0
  61310. move.b angle(a0),d0
  61311. move.w off_2FD0E(pc,d0.w),d1
  61312. jmp off_2FD0E(pc,d1.w)
  61313. ; ===========================================================================
  61314. off_2FD0E: offsetTable
  61315. offsetTableEntry.w Obj52_Mobile_Raise ; 0
  61316. offsetTableEntry.w Obj52_Mobile_Flamethrower ; 2
  61317. offsetTableEntry.w Obj52_Mobile_BeginLower ; 4
  61318. offsetTableEntry.w Obj52_Mobile_Lower ; 6
  61319. offsetTableEntry.w Obj52_Mobile_Defeated ; 8
  61320. ; ===========================================================================
  61321.  
  61322. ; loc_2FD18:
  61323. Obj52_Mobile_Raise:
  61324. move.b #0,(Boss_CollisionRoutine).w
  61325. bsr.w Boss_MoveObject
  61326. tst.b objoff_2C(a0)
  61327. bne.s loc_2FD32
  61328. cmpi.w #$518,(Boss_Y_pos).w
  61329. bgt.s loc_2FD50
  61330. bra.s loc_2FD3A
  61331. ; ===========================================================================
  61332.  
  61333. loc_2FD32:
  61334. cmpi.w #$4FC,(Boss_Y_pos).w
  61335. bgt.s loc_2FD50
  61336.  
  61337. loc_2FD3A:
  61338. move.w #0,(Boss_Y_vel).w
  61339. move.b #4,mapping_frame(a0)
  61340. addq.b #2,angle(a0)
  61341. move.b #$3C,objoff_3E(a0)
  61342.  
  61343. loc_2FD50:
  61344. move.w (Boss_Y_pos).w,y_pos(a0)
  61345. bsr.w loc_300A4
  61346.  
  61347. if removeJmpTos
  61348. JmpTo36_DisplaySprite
  61349. endif
  61350.  
  61351. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61352. ; ===========================================================================
  61353.  
  61354. ; loc_2FD5E:
  61355. Obj52_Mobile_Flamethrower:
  61356. subi_.b #1,objoff_3E(a0)
  61357. bpl.s Obj52_Mobile_Hover
  61358. move.b #1,(Boss_CollisionRoutine).w
  61359. move.b #1,mainspr_childsprites(a0)
  61360. cmpi.b #-$18,objoff_3E(a0)
  61361. bne.s Obj52_Mobile_Hover
  61362. jsrto (SingleObjLoad).l, JmpTo13_SingleObjLoad
  61363. bne.s loc_2FDAA
  61364. _move.b #ObjID_HTZBoss,id(a1) ; load obj52
  61365. move.b #4,boss_subtype(a1)
  61366. move.b render_flags(a0),render_flags(a1)
  61367. andi.b #1,render_flags(a1)
  61368. move.w x_pos(a0),x_pos(a1)
  61369. move.w y_pos(a0),y_pos(a1)
  61370. move.b #$2F,objoff_3E(a0)
  61371.  
  61372. loc_2FDAA:
  61373. bsr.w loc_300A4
  61374. bsr.w loc_2FEDE
  61375. lea (Ani_obj52).l,a1
  61376. bsr.w AnimateBoss
  61377. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61378. ; ===========================================================================
  61379.  
  61380. ; loc_2FDC0:
  61381. Obj52_Mobile_Hover:
  61382. move.b mapping_frame(a0),d0
  61383. jsr (CalcSine).l
  61384. asr.w #7,d1
  61385. add.w (Boss_Y_pos).w,d1
  61386. move.w d1,y_pos(a0)
  61387. addq.b #4,mapping_frame(a0)
  61388. bra.s loc_2FDAA
  61389. ; ===========================================================================
  61390.  
  61391. ; loc_2FDDA:
  61392. Obj52_Mobile_BeginLower:
  61393. move.b #0,(Boss_CollisionRoutine).w
  61394. move.b #0,mainspr_childsprites(a0)
  61395. move.b #$10,(Boss_AnimationArray+2).w
  61396. move.b #0,(Boss_AnimationArray+3).w
  61397. subi_.b #1,objoff_3E(a0)
  61398. bne.w Obj52_Mobile_Hover
  61399. move.w #$E0,(Boss_Y_vel).w
  61400. addq.b #2,angle(a0)
  61401. bsr.w loc_2FEDE
  61402. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61403. ; ===========================================================================
  61404.  
  61405. ; loc_2FE0E:
  61406. Obj52_Mobile_Lower:
  61407. bsr.w Boss_MoveObject
  61408. tst.b objoff_2C(a0)
  61409. bne.s loc_2FE22
  61410. cmpi.w #$538,(Boss_Y_pos).w
  61411. blt.s loc_2FE58
  61412. bra.s Obj52_CreateLavaBall
  61413. ; ===========================================================================
  61414.  
  61415. loc_2FE22:
  61416. cmpi.w #$548,(Boss_Y_pos).w
  61417. blt.s loc_2FE58
  61418.  
  61419. ; loc_2FE2A
  61420. Obj52_CreateLavaBall:
  61421. tst.b objoff_38(a0)
  61422. bne.s loc_2FE58
  61423. st objoff_38(a0)
  61424. jsrto (SingleObjLoad).l, JmpTo13_SingleObjLoad
  61425. bne.s loc_2FE58
  61426. move.b #ObjID_HTZBoss,id(a1) ; load obj52
  61427. move.b #6,boss_subtype(a1)
  61428. move.w x_pos(a0),x_pos(a1)
  61429. move.w y_pos(a0),y_pos(a1)
  61430. move.b #SndID_LavaBall,d0
  61431. jsrto (PlaySound).l, JmpTo7_PlaySound
  61432.  
  61433. loc_2FE58:
  61434. tst.b objoff_2C(a0)
  61435. bne.s loc_2FE6E
  61436. cmpi.w #$5A0,(Boss_Y_pos).w
  61437. blt.s loc_2FED0
  61438. move.w #$5A0,(Boss_Y_pos).w
  61439. bra.s loc_2FE7C
  61440. ; ===========================================================================
  61441.  
  61442. loc_2FE6E:
  61443. cmpi.w #$580,(Boss_Y_pos).w
  61444. blt.s loc_2FED0
  61445. move.w #$580,(Boss_Y_pos).w
  61446.  
  61447. loc_2FE7C:
  61448. move.w #-$E0,(Boss_Y_vel).w
  61449. move.b #0,angle(a0)
  61450. sf objoff_38(a0)
  61451. move.w (MainCharacter+x_pos).w,d0
  61452. subi.w #$2FC0,d0
  61453. bmi.s loc_2FEA8
  61454. move.w #$580,(Boss_Y_pos).w
  61455. move.w #$3040,x_pos(a0)
  61456. st objoff_2C(a0)
  61457. bra.s loc_2FEB8
  61458. ; ===========================================================================
  61459.  
  61460. loc_2FEA8:
  61461. move.w #$2F40,x_pos(a0)
  61462. move.w #$5A0,(Boss_Y_pos).w
  61463. sf objoff_2C(a0)
  61464.  
  61465. loc_2FEB8:
  61466. move.w x_pos(a0),d0
  61467. cmp.w (MainCharacter+x_pos).w,d0
  61468. bgt.s loc_2FECA
  61469. bset #0,render_flags(a0)
  61470. bra.s loc_2FED0
  61471. ; ===========================================================================
  61472.  
  61473. loc_2FECA:
  61474. bclr #0,render_flags(a0)
  61475.  
  61476. loc_2FED0:
  61477. move.w (Boss_Y_pos).w,y_pos(a0)
  61478. bsr.w loc_300A4
  61479. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61480. ; ===========================================================================
  61481.  
  61482. loc_2FEDE:
  61483. move.w x_pos(a0),d0
  61484. move.w y_pos(a0),d1
  61485. move.w d0,sub2_x_pos(a0)
  61486. move.w d1,sub2_y_pos(a0)
  61487. rts
  61488. ; ===========================================================================
  61489.  
  61490. ; loc_2FEF0:
  61491. Obj52_FlameThrower:
  61492. moveq #0,d0
  61493. move.b routine_secondary(a0),d0
  61494. move.w off_2FEFE(pc,d0.w),d1
  61495. jmp off_2FEFE(pc,d1.w)
  61496. ; ===========================================================================
  61497. off_2FEFE: offsetTable
  61498. offsetTableEntry.w loc_2FF02 ; 0
  61499. offsetTableEntry.w loc_2FF50 ; 2
  61500. ; ===========================================================================
  61501.  
  61502. loc_2FF02:
  61503. move.l #Obj52_MapUnc_302BC,mappings(a0)
  61504. move.w #make_art_tile(ArtTile_ArtNem_HTZBoss,0,0),art_tile(a0)
  61505. ori.b #4,render_flags(a0)
  61506. move.b #4,priority(a0)
  61507. addq.b #2,routine_secondary(a0)
  61508. move.b #5,anim(a0)
  61509. move.b #$98,collision_flags(a0)
  61510. subi.w #$1C,y_pos(a0)
  61511. move.w #-$70,d0
  61512. move.w #-4,d1
  61513. btst #0,render_flags(a0)
  61514. beq.s loc_2FF46
  61515. neg.w d0
  61516. neg.w d1
  61517.  
  61518. loc_2FF46:
  61519. add.w d0,x_pos(a0)
  61520. move.w d1,x_vel(a0)
  61521. rts
  61522. ; ===========================================================================
  61523.  
  61524. loc_2FF50:
  61525. move.w x_vel(a0),d1
  61526. add.w d1,x_pos(a0)
  61527. lea (Ani_obj52).l,a1
  61528. jsrto (AnimateSprite).l, JmpTo18_AnimateSprite
  61529. jmpto (MarkObjGone).l, JmpTo37_MarkObjGone
  61530. ; ===========================================================================
  61531.  
  61532. ; loc_2FF66:
  61533. Obj52_LavaBall:
  61534. moveq #0,d0
  61535. move.b routine_secondary(a0),d0
  61536. move.w off_2FF74(pc,d0.w),d1
  61537. jmp off_2FF74(pc,d1.w)
  61538. ; ===========================================================================
  61539. off_2FF74: offsetTable
  61540. offsetTableEntry.w loc_2FF78 ; 0
  61541. offsetTableEntry.w loc_30008 ; 2
  61542. ; ===========================================================================
  61543.  
  61544. loc_2FF78:
  61545. movea.l a0,a1
  61546. moveq #0,d2
  61547. moveq #1,d1
  61548. bra.s loc_2FF94
  61549. ; ===========================================================================
  61550.  
  61551. loc_2FF80:
  61552. jsrto (SingleObjLoad).l, JmpTo13_SingleObjLoad
  61553. bne.w return_30006
  61554. move.w x_pos(a0),x_pos(a1)
  61555. move.w y_pos(a0),y_pos(a1)
  61556.  
  61557. loc_2FF94:
  61558. move.b #ObjID_HTZBoss,id(a1) ; load obj52
  61559. move.b #6,boss_subtype(a1)
  61560. move.l #Obj52_MapUnc_302BC,mappings(a1)
  61561. move.w #make_art_tile(ArtTile_ArtNem_HTZBoss,0,0),art_tile(a1)
  61562. ori.b #4,render_flags(a1)
  61563. move.b #3,priority(a1)
  61564. addq.b #2,routine_secondary(a1)
  61565. move.b #7,anim(a1)
  61566. move.b #$8B,collision_flags(a1)
  61567. move.b d2,objoff_2E(a1)
  61568. move.b #8,y_radius(a1)
  61569. move.b #8,x_radius(a1)
  61570. move.w x_pos(a1),objoff_2A(a1)
  61571. move.w #$1C00,d0
  61572. tst.w d2
  61573. bne.s loc_2FFE8
  61574. neg.w d0
  61575.  
  61576. loc_2FFE8:
  61577. move.w d0,x_vel(a1)
  61578. move.w #-$5400,y_vel(a1)
  61579. cmpi.w #$2F40,x_pos(a1)
  61580. beq.s loc_30000
  61581. move.w #-$6400,y_vel(a1)
  61582.  
  61583. loc_30000:
  61584. addq.w #1,d2
  61585. dbf d1,loc_2FF80
  61586.  
  61587. return_30006:
  61588. rts
  61589. ; ===========================================================================
  61590.  
  61591. loc_30008:
  61592. bsr.w Obj52_LavaBall_Move
  61593. jsrto (ObjCheckFloorDist).l, JmpTo4_ObjCheckFloorDist
  61594. tst.w d1
  61595. bpl.s loc_30064
  61596. add.w d1,y_pos(a0)
  61597. move.b #ObjID_LavaBubble,id(a0) ; load 0bj20
  61598. move.b #$A,routine(a0)
  61599. move.b #2,anim(a0)
  61600. move.b #4,mapping_frame(a0)
  61601. move.w #0,y_vel(a0)
  61602. move.l #Obj20_MapUnc_23294,mappings(a0)
  61603. move.w #make_art_tile(ArtTile_ArtNem_Buzzer_Fireball_1,0,1),art_tile(a0)
  61604. jsrto (Adjust2PArtPointer).l, JmpTo62_Adjust2PArtPointer
  61605. move.b #0,mapping_frame(a0)
  61606. move.w #9,objoff_32(a0)
  61607. move.b #3,objoff_36(a0)
  61608. move.b #SndID_FireBurn,d0
  61609. jsrto (PlaySound).l, JmpTo7_PlaySound
  61610. jmpto (Obj20).l, JmpTo_Obj20
  61611. ; ===========================================================================
  61612.  
  61613. loc_30064:
  61614. lea (Ani_obj52).l,a1
  61615. jsrto (AnimateSprite).l, JmpTo18_AnimateSprite
  61616. jmpto (MarkObjGone).l, JmpTo37_MarkObjGone
  61617. ; ===========================================================================
  61618.  
  61619. ; loc_30072:
  61620. Obj52_LavaBall_Move:
  61621. move.l objoff_2A(a0),d2
  61622. move.l y_pos(a0),d3
  61623. move.w x_vel(a0),d0
  61624. ext.l d0
  61625. asl.l #4,d0
  61626. add.l d0,d2
  61627. move.w y_vel(a0),d0
  61628. addi.w #$380,y_vel(a0)
  61629. ext.l d0
  61630. asl.l #4,d0
  61631. add.l d0,d3
  61632. move.l d2,objoff_2A(a0)
  61633. move.l d3,y_pos(a0)
  61634. move.w objoff_2A(a0),x_pos(a0)
  61635. rts
  61636. ; ===========================================================================
  61637.  
  61638. loc_300A4:
  61639. cmpi.b #8,angle(a0)
  61640. bhs.s return_300EA
  61641. tst.b objoff_32(a0)
  61642. beq.s Obj52_Defeat
  61643. tst.b collision_flags(a0)
  61644. bne.s return_300EA
  61645. tst.b objoff_14(a0)
  61646. bne.s loc_300CE
  61647. move.b #$20,objoff_14(a0)
  61648. move.w #SndID_BossHit,d0
  61649. jsr (PlaySound).l
  61650.  
  61651. loc_300CE:
  61652. lea (Normal_palette_line2+2).w,a1
  61653. moveq #0,d0
  61654. tst.w (a1)
  61655. bne.s loc_300DC
  61656. move.w #$EEE,d0
  61657.  
  61658. loc_300DC:
  61659. move.w d0,(a1)
  61660. subq.b #1,objoff_14(a0)
  61661. bne.s return_300EA
  61662. move.b #$32,collision_flags(a0)
  61663.  
  61664. return_300EA:
  61665. rts
  61666. ; ===========================================================================
  61667.  
  61668. ; loc_300EC:
  61669. Obj52_Defeat:
  61670. moveq #100,d0
  61671. jsrto (AddPoints).l, JmpTo4_AddPoints
  61672. move.w #$B3,(Boss_Countdown).w
  61673. move.b #8,angle(a0)
  61674. moveq #PLCID_Capsule,d0
  61675. jsrto (LoadPLC).l, JmpTo7_LoadPLC
  61676. rts
  61677. ; ===========================================================================
  61678.  
  61679. ; loc_30106:
  61680. Obj52_Mobile_Defeated:
  61681. move.b #0,mainspr_childsprites(a0)
  61682. subi_.w #1,(Boss_Countdown).w
  61683. bmi.s loc_30142
  61684. cmpi.w #$1E,(Boss_Countdown).w
  61685. bgt.s Obj52_Mobile_UpdateExplosion
  61686. move.b #$10,mainspr_mapframe(a0)
  61687. bsr.w Boss_LoadExplosion
  61688. move.b (Vint_runcount+3).w,d0
  61689. andi.b #$1F,d0
  61690. bne.w JmpTo36_DisplaySprite
  61691. bsr.w Obj52_CreateSmoke
  61692. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61693. ; ===========================================================================
  61694.  
  61695. ; loc_3013A:
  61696. Obj52_Mobile_UpdateExplosion:
  61697. bsr.w Boss_LoadExplosion
  61698. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61699. ; ===========================================================================
  61700.  
  61701. loc_30142:
  61702. move.b (Vint_runcount+3).w,d0
  61703. andi.b #$1F,d0
  61704. bne.w Obj52_Mobile_Flee
  61705. bsr.w Obj52_CreateSmoke
  61706.  
  61707. ; loc_30152:
  61708. Obj52_Mobile_Flee:
  61709. cmpi.w #-$3C,(Boss_Countdown).w
  61710. bgt.w JmpTo36_DisplaySprite
  61711. tst.b (Boss_defeated_flag).w
  61712. bne.s loc_30170
  61713. jsrto (PlayLevelMusic).l, JmpTo3_PlayLevelMusic
  61714. jsrto (LoadPLC_AnimalExplosion).l, JmpTo3_LoadPLC_AnimalExplosion
  61715. move.b #1,(Boss_defeated_flag).w
  61716.  
  61717. loc_30170:
  61718. addq.w #2,y_pos(a0)
  61719. cmpi.w #$3160,(Camera_Max_X_pos).w
  61720. bhs.s loc_30182
  61721. addq.w #2,(Camera_Max_X_pos).w
  61722. bra.s BranchTo_JmpTo36_DisplaySprite
  61723. ; ===========================================================================
  61724.  
  61725. loc_30182:
  61726. tst.b render_flags(a0)
  61727. bpl.s loc_301AA
  61728. tst.b objoff_2C(a0)
  61729. bne.s loc_3019C
  61730. cmpi.w #$578,y_pos(a0)
  61731. bgt.w loc_301AA
  61732. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61733. ; ===========================================================================
  61734.  
  61735. loc_3019C:
  61736. cmpi.w #$588,y_pos(a0)
  61737. bgt.w loc_301AA
  61738.  
  61739. BranchTo_JmpTo36_DisplaySprite
  61740. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61741. ; ===========================================================================
  61742.  
  61743. loc_301AA:
  61744. move.w #$3160,(Camera_Max_X_pos).w
  61745.  
  61746. if removeJmpTos
  61747. JmpTo53_DeleteObject
  61748. endif
  61749.  
  61750. jmpto (DeleteObject).l, JmpTo53_DeleteObject
  61751. ; ===========================================================================
  61752.  
  61753. ; loc_301B4:
  61754. Obj52_CreateSmoke
  61755. jsrto (SingleObjLoad).l, JmpTo13_SingleObjLoad
  61756. bne.s return_3020E
  61757. move.b #ObjID_HTZBoss,id(a1) ; load obj52
  61758. move.b #8,boss_subtype(a1)
  61759. move.l #Obj52_MapUnc_30258,mappings(a1)
  61760. move.w #make_art_tile(ArtTile_ArtNem_BossSmoke_2,0,0),art_tile(a1)
  61761. ori.b #4,render_flags(a1)
  61762. move.b #1,priority(a1)
  61763. move.w x_pos(a0),x_pos(a1)
  61764. move.w y_pos(a0),y_pos(a1)
  61765. move.w x_pos(a0),objoff_2A(a1)
  61766. subi.w #$28,y_pos(a1)
  61767. move.w #-$60,x_vel(a1)
  61768. move.w #-$C0,y_vel(a1)
  61769. move.b #0,mapping_frame(a1)
  61770. move.b #$11,anim_frame_duration(a1)
  61771.  
  61772. return_3020E:
  61773. rts
  61774. ; ===========================================================================
  61775.  
  61776. loc_30210:
  61777. subq.b #1,anim_frame_duration(a0)
  61778. bpl.s loc_3022A
  61779. move.b #$11,anim_frame_duration(a0)
  61780. addq.b #1,mapping_frame(a0)
  61781. cmpi.b #4,mapping_frame(a0)
  61782. beq.w JmpTo53_DeleteObject
  61783.  
  61784. loc_3022A:
  61785. move.l objoff_2A(a0),d2
  61786. move.l y_pos(a0),d3
  61787. move.w x_vel(a0),d0
  61788. ext.l d0
  61789. asl.l #8,d0
  61790. add.l d0,d2
  61791. move.w y_vel(a0),d0
  61792. ext.l d0
  61793. asl.l #8,d0
  61794. add.l d0,d3
  61795. move.l d2,objoff_2A(a0)
  61796. move.w objoff_2A(a0),x_pos(a0)
  61797. move.l d3,y_pos(a0)
  61798. jmpto (DisplaySprite).l, JmpTo36_DisplaySprite
  61799. ; ===========================================================================
  61800. ; ----------------------------------------------------------------------------
  61801. ; sprite mappings - uses ArtNem_BossSmoke
  61802. ; ----------------------------------------------------------------------------
  61803. Obj52_MapUnc_30258: BINCLUDE "mappings/sprite/obj52_a.bin"
  61804.  
  61805. ; animation script
  61806. ; off_30288:
  61807. Ani_obj52: offsetTable
  61808. offsetTableEntry.w byte_30298 ; 0
  61809. offsetTableEntry.w byte_3029D ; 1
  61810. offsetTableEntry.w byte_302A2 ; 2
  61811. offsetTableEntry.w byte_302A7 ; 3
  61812. offsetTableEntry.w byte_302AC ; 4
  61813. offsetTableEntry.w byte_302B0 ; 5
  61814. offsetTableEntry.w byte_302B4 ; 6
  61815. offsetTableEntry.w byte_302B7 ; 7
  61816. byte_30298: dc.b 1, 2, 3,$FD, 1
  61817. rev02even
  61818. byte_3029D: dc.b 2, 4, 5,$FD, 2
  61819. rev02even
  61820. byte_302A2: dc.b 3, 6, 7,$FD, 3
  61821. rev02even
  61822. byte_302A7: dc.b 4, 8, 9,$FD, 4
  61823. rev02even
  61824. byte_302AC: dc.b 5, $A, $B,$FE
  61825. rev02even
  61826. byte_302B0: dc.b 3, $C, $D,$FF
  61827. rev02even
  61828. byte_302B4: dc.b $F, 1,$FF
  61829. rev02even
  61830. byte_302B7: dc.b 3, $E, $F,$FF
  61831. even
  61832. ; ----------------------------------------------------------------------------
  61833. ; sprite mappings - uses ArtNem_Eggpod + ?
  61834. ; ----------------------------------------------------------------------------
  61835. Obj52_MapUnc_302BC: BINCLUDE "mappings/sprite/obj52_b.bin"
  61836.  
  61837. if ~~removeJmpTos
  61838. align 4
  61839. endif
  61840. ; ===========================================================================
  61841.  
  61842. if ~~removeJmpTos
  61843. JmpTo36_DisplaySprite
  61844. jmp (DisplaySprite).l
  61845. JmpTo53_DeleteObject
  61846. jmp (DeleteObject).l
  61847. JmpTo13_SingleObjLoad
  61848. jmp (SingleObjLoad).l
  61849. JmpTo37_MarkObjGone
  61850. jmp (MarkObjGone).l
  61851. JmpTo7_PlaySound
  61852. jmp (PlaySound).l
  61853. JmpTo18_AnimateSprite
  61854. jmp (AnimateSprite).l
  61855. JmpTo4_ObjCheckFloorDist
  61856. jmp (ObjCheckFloorDist).l
  61857. JmpTo7_LoadPLC
  61858. jmp (LoadPLC).l
  61859. JmpTo_Obj20
  61860. jmp (Obj20).l
  61861. JmpTo4_AddPoints
  61862. jmp (AddPoints).l
  61863. JmpTo62_Adjust2PArtPointer
  61864. jmp (Adjust2PArtPointer).l
  61865. JmpTo3_PlayLevelMusic
  61866. jmp (PlayLevelMusic).l
  61867. JmpTo3_LoadPLC_AnimalExplosion
  61868. jmp (LoadPLC_AnimalExplosion).l
  61869.  
  61870. align 4
  61871. endif
  61872.  
  61873.  
  61874.  
  61875.  
  61876. ; ===========================================================================
  61877. ; ----------------------------------------------------------------------------
  61878. ; Object 89 - ARZ boss
  61879. ; ----------------------------------------------------------------------------
  61880. ; OST Variables:
  61881. ; Main Vehicle
  61882. obj89_hammer_y_vel = objoff_2E ; falling hammer's y velocity
  61883. obj89_target = objoff_38
  61884. obj89_hammer_y_pos = objoff_3A ; falling hammer's y position
  61885. obj89_hammer_flags = objoff_3E
  61886.  
  61887. ; Pillars & Arrows
  61888. obj89_pillar_parent = objoff_2A ; address of main vehicle
  61889. obj89_pillar_shake_time = objoff_30
  61890. obj89_pillar_shaking = objoff_38
  61891. obj89_eyes_timer = objoff_30
  61892. obj89_arrow_routine = objoff_2A
  61893. obj89_arrow_timer = objoff_30
  61894. obj89_arrow_parent2 = objoff_34
  61895. obj89_arrow_parent = objoff_38 ; address of main vehicle
  61896.  
  61897. ; Sprite_30480:
  61898. Obj89:
  61899. moveq #0,d0
  61900. move.b boss_subtype(a0),d0
  61901. move.w Obj89_Index(pc,d0.w),d1
  61902. jmp Obj89_Index(pc,d1.w)
  61903. ; ===========================================================================
  61904. ; off_3048E:
  61905. Obj89_Index: offsetTable
  61906. offsetTableEntry.w Obj89_Init ; 0 - Init
  61907. offsetTableEntry.w Obj89_Main ; 2 - Main Vehicle
  61908. offsetTableEntry.w Obj89_Pillar ; 4 - Pillars & Arrows
  61909. ; ===========================================================================
  61910. ; loc_30494:
  61911. Obj89_Init:
  61912. tst.l (Plc_Buffer).w ; is art finished loading?
  61913. beq.s + ; if yes, branch
  61914. rts
  61915. ; ---------------------------------------------------------------------------
  61916. +
  61917. tst.w (Player_mode).w ; is player mode anything other than Sonic & Tails?
  61918. bne.s Obj89_Init_RaisePillars ; if yes, branch
  61919. move.w (MainCharacter+x_pos).w,d0
  61920. cmpi.w #$2A60,d0 ; is Sonic too close to the left edge?
  61921. blt.w Obj89_Init_Standard ; if yes, branch
  61922. cmpi.w #$2B60,d0 ; is Sonic too close to the right edge?
  61923. bgt.w Obj89_Init_Standard ; if yes, branch
  61924. cmpi.b #$81,(Sidekick+obj_control).w
  61925. beq.w Obj89_Init_RaisePillars ; branch, if Tails is flying
  61926. move.w (Sidekick+x_pos).w,d0
  61927. cmpi.w #$2A60,d0 ; is Tails too close to the left edge?
  61928. blt.w Obj89_Init_Standard ; if yes, branch
  61929. cmpi.w #$2B60,d0 ; is Tails too close to the right edge?
  61930. bgt.w Obj89_Init_Standard ; if yes, branch
  61931.  
  61932. ; loc_304D4:
  61933. Obj89_Init_RaisePillars:
  61934. move.b #1,(Screen_Shaking_Flag).w ; make screen shake
  61935. move.w #make_art_tile(ArtTile_ArtNem_ARZBoss,0,0),art_tile(a0)
  61936. move.l #Obj89_MapUnc_30E04,mappings(a0)
  61937. ori.b #4,render_flags(a0)
  61938. move.b #$20,mainspr_width(a0)
  61939. move.b #2,priority(a0)
  61940. move.b #2,boss_subtype(a0) ; => Obj89_Main
  61941. move.w #$2AE0,x_pos(a0)
  61942. move.w #$388,y_pos(a0)
  61943. move.w #$2AE0,(Boss_X_pos).w
  61944. move.w #$388,(Boss_Y_pos).w
  61945. bset #6,render_flags(a0)
  61946. move.b #3,mainspr_childsprites(a0)
  61947. move.b #$F,collision_flags(a0)
  61948. move.b #8,boss_hitcount2(a0)
  61949. move.b #8,mainspr_mapframe(a0)
  61950. move.w #-$380,obj89_hammer_y_vel(a0)
  61951. clr.b (Boss_CollisionRoutine).w ; disable special collisions
  61952. move.w #$2AE0,sub2_x_pos(a0) ;
  61953. move.w #$488,sub2_y_pos(a0)
  61954. move.b #0,sub2_mapframe(a0)
  61955. move.w #$2AE0,sub3_x_pos(a0) ;
  61956. move.w #$488,sub3_y_pos(a0)
  61957. move.b #9,sub3_mapframe(a0)
  61958. move.w #$2AE0,sub4_x_pos(a0) ;
  61959. move.w #$488,sub4_y_pos(a0)
  61960. move.b #6,sub4_mapframe(a0)
  61961. move.w #$100,(Boss_Y_vel).w
  61962.  
  61963. ; load first pillar object
  61964. jsrto (SingleObjLoad).l, JmpTo14_SingleObjLoad
  61965. bne.w Obj89_Init_Standard
  61966. move.b #ObjID_ARZBoss,id(a1) ; load obj89
  61967. move.l #Obj89_MapUnc_30D68,mappings(a1)
  61968. ori.b #4,render_flags(a1)
  61969. move.w #make_art_tile(ArtTile_ArtNem_ARZBoss,0,0),art_tile(a1)
  61970. move.b #$10,width_pixels(a1)
  61971. move.b #4,priority(a1)
  61972. move.w #$2A50,x_pos(a1)
  61973. move.w #$510,y_pos(a1)
  61974. addq.b #4,boss_subtype(a1) ; => Obj89_Pillar
  61975. move.l a0,obj89_pillar_parent(a1)
  61976. move.b #0,mapping_frame(a1)
  61977. move.b #2,priority(a1)
  61978. move.b #$20,y_radius(a1)
  61979. movea.l a1,a2 ; save first pillar's address
  61980. jsrto (SingleObjLoad2).l, JmpTo22_SingleObjLoad2
  61981. bne.s Obj89_Init_Standard
  61982. moveq #0,d0
  61983.  
  61984. move.w #bytesToLcnt(object_size),d1
  61985.  
  61986. ; loc_305DC:
  61987. Obj89_Init_DuplicatePillar:
  61988. move.l (a2,d0.w),(a1,d0.w)
  61989. addq.w #4,d0
  61990. dbf d1,Obj89_Init_DuplicatePillar
  61991. if object_size&3
  61992. move.w (a2,d0.w),(a1,d0.w)
  61993. endif
  61994.  
  61995. bset #0,render_flags(a1)
  61996. move.w #$2B70,x_pos(a1) ; move pillar to other side of boss area
  61997.  
  61998. ; loc_305F4:
  61999. Obj89_Init_Standard:
  62000. bsr.w Obj89_Init_AnimationArray
  62001. rts
  62002. ; ===========================================================================
  62003. ; loc_305FA:
  62004. Obj89_Init_AnimationArray:
  62005. lea (Boss_AnimationArray).w,a2
  62006. move.b #4,(a2)+ ; main vehicle
  62007. move.b #0,(a2)+
  62008. move.b #0,(a2)+ ; face
  62009. move.b #0,(a2)+
  62010. move.b #2,(a2)+ ; hammer
  62011. move.b #0,(a2)+
  62012. move.b #1,(a2)+ ; flames
  62013. move.b #0,(a2)+
  62014. rts
  62015. ; ===========================================================================
  62016. ; loc_30620:
  62017. Obj89_Main:
  62018. moveq #0,d0
  62019. move.b boss_routine(a0),d0
  62020. move.w Obj89_Main_Index(pc,d0.w),d1
  62021. jmp Obj89_Main_Index(pc,d1.w)
  62022. ; ===========================================================================
  62023. ; off_3062E:
  62024. Obj89_Main_Index: offsetTable ; main boss object
  62025. offsetTableEntry.w Obj89_Main_Sub0 ; 0 - moving down into arena
  62026. offsetTableEntry.w Obj89_Main_Sub2 ; 2 - moving left/right
  62027. offsetTableEntry.w Obj89_Main_Sub4 ; 4 - having reached pillar
  62028. offsetTableEntry.w Obj89_Main_Sub6 ; 6 - hit with hammer
  62029. offsetTableEntry.w Obj89_Main_Sub8 ; 8 - boss exploding
  62030. offsetTableEntry.w Obj89_Main_SubA ; A - move boss down and alter a little up again
  62031. offsetTableEntry.w Obj89_Main_SubC ; C - beaten boss moving away
  62032. ; ===========================================================================
  62033. ; loc_3063C:
  62034. Obj89_Main_Sub0:
  62035. bsr.w Boss_MoveObject
  62036. bsr.w Obj89_Main_HandleFace
  62037. bsr.w Obj89_Main_AlignParts
  62038. cmpi.w #$430,(Boss_Y_pos).w ; has boss reached its target?
  62039. blt.s Obj89_Main_Sub0_Standard ; if not, branch
  62040. move.w #$430,(Boss_Y_pos).w
  62041. addi_.b #2,boss_routine(a0) ; => Obj89_Main_Sub2
  62042. move.w #0,(Boss_Y_vel).w ; stop y movement
  62043. move.w #-$C8,(Boss_X_vel).w ; move leftward
  62044. st obj89_target(a0)
  62045.  
  62046. ; loc_3066C:
  62047. Obj89_Main_Sub0_Standard:
  62048. lea (Ani_obj89_b).l,a1
  62049. bsr.w AnimateBoss
  62050. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62051. ; ===========================================================================
  62052. ; loc_3067A:
  62053. Obj89_Main_Sub2:
  62054. bsr.w Boss_MoveObject
  62055. bsr.w Obj89_Main_HandleFace
  62056. bsr.w Obj89_Main_AlignParts
  62057. tst.b obj89_target(a0) ; is boss going left?
  62058. bne.s Obj89_Main_Sub2_GoingLeft ; if yes, branch
  62059. cmpi.w #$2B10,(Boss_X_pos).w ; is boss right in front of the right pillar?
  62060. blt.s Obj89_Main_Sub2_Standard ; branch, if still too far away
  62061. bra.s Obj89_Main_Sub2_AtTarget
  62062. ; ===========================================================================
  62063. ; loc_30696:
  62064. Obj89_Main_Sub2_GoingLeft:
  62065. cmpi.w #$2AB0,(Boss_X_pos).w ; is boss right in front of the left pillar?
  62066. bgt.s Obj89_Main_Sub2_Standard ; branch, if still too far away
  62067.  
  62068. ; loc_3069E:
  62069. Obj89_Main_Sub2_AtTarget:
  62070. addi_.b #2,boss_routine(a0) ; => Obj89_Main_Sub4
  62071. move.w #0,(Boss_X_vel).w
  62072.  
  62073. ; loc_306AA:
  62074. Obj89_Main_Sub2_Standard:
  62075. lea (Ani_obj89_b).l,a1
  62076. bsr.w AnimateBoss
  62077. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62078. ; ===========================================================================
  62079. ; loc_306B8:
  62080. Obj89_Main_Sub4:
  62081. bsr.w Boss_MoveObject
  62082. bsr.w Obj89_Main_HandleFace
  62083. bsr.w Obj89_Main_AlignParts
  62084. cmpi.b #-$40,boss_sine_count(a0) ; has boss reached the right height in its hovering animation?
  62085. bne.s Obj89_Main_Sub4_Standard ; if not, branch
  62086. lea (Boss_AnimationArray).w,a1
  62087. andi.b #$F0,2*2(a1) ; reset hammer animation
  62088. ori.b #3,2*2(a1) ; reset hammer animation timer
  62089. addq.b #2,boss_routine(a0) ; => Obj89_Main_Sub6
  62090. btst #0,render_flags(a0)
  62091. sne obj89_target(a0) ; target opposite side
  62092. move.w #$1E,(Boss_Countdown).w
  62093. move.b #SndID_Hammer,d0
  62094. jsrto (PlaySound).l, JmpTo8_PlaySound
  62095.  
  62096. ; loc_306F8:
  62097. Obj89_Main_Sub4_Standard:
  62098. lea (Ani_obj89_b).l,a1
  62099. bsr.w AnimateBoss
  62100. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62101. ; ===========================================================================
  62102. ; loc_30706:
  62103. Obj89_Main_Sub6:
  62104. cmpi.w #$14,(Boss_Countdown).w ; has counter reached a specific value?
  62105. bne.s + ; if not, branch
  62106. bset #0,obj89_hammer_flags(a0) ; hammer just hit a pillar
  62107. move.b #1,(Boss_CollisionRoutine).w ; enable hammer collision
  62108. +
  62109. subi_.w #1,(Boss_Countdown).w ; decrement counter
  62110. bpl.s Obj89_Main_Sub6_Standard ; branch, if counter > 0
  62111. clr.b (Boss_CollisionRoutine).w ; disable hammer collision
  62112. move.b #2,boss_routine(a0) ; => Obj89_Main_Sub2
  62113. bchg #0,render_flags(a0) ; face opposite direction
  62114. beq.s Obj89_Main_Sub6_MoveRight ; branch, if new direction is right
  62115. move.w #-$C8,(Boss_X_vel).w ; move left
  62116. bra.s Obj89_Main_Sub6_Standard
  62117. ; ===========================================================================
  62118. ; loc_3073C:
  62119. Obj89_Main_Sub6_MoveRight:
  62120. move.w #$C8,(Boss_X_vel).w ; move right
  62121.  
  62122. ; loc_30742:
  62123. Obj89_Main_Sub6_Standard:
  62124. bsr.w Boss_MoveObject
  62125. bsr.w Obj89_Main_HandleFace
  62126. bsr.w Obj89_Main_AlignParts
  62127. lea (Ani_obj89_b).l,a1
  62128. bsr.w AnimateBoss
  62129. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62130. ; ===========================================================================
  62131. ; loc_3075C:
  62132. Obj89_Main_HandleFace:
  62133. bsr.w Obj89_Main_HandleHoveringAndHits
  62134. cmpi.b #4,(MainCharacter+routine).w ; is Sonic hurt?
  62135. beq.s Obj89_Main_Laugh ; if yes, branch
  62136. cmpi.b #4,(Sidekick+routine).w ; is Tails hurt?
  62137. bne.s Obj89_Main_ChkHurt ; if not, branch
  62138.  
  62139. ; loc_30770:
  62140. Obj89_Main_Laugh:
  62141. lea (Boss_AnimationArray).w,a1
  62142. move.b #$31,1*2+1(a1) ; use laughing animation
  62143.  
  62144. ; loc_3077A:
  62145. Obj89_Main_ChkHurt:
  62146. cmpi.b #$3F,boss_invulnerable_time(a0) ; was boss hurt?
  62147. bne.s return_3078C ; if not, branch
  62148. lea (Boss_AnimationArray).w,a1
  62149. move.b #-$40,1*2+1(a1) ; use hurt animation
  62150.  
  62151. return_3078C:
  62152. rts
  62153. ; ===========================================================================
  62154. ; loc_3078E:
  62155. Obj89_Main_HandleHoveringAndHits:
  62156. move.b boss_sine_count(a0),d0
  62157. jsr (CalcSine).l
  62158. asr.w #6,d0
  62159. add.w (Boss_Y_pos).w,d0
  62160. move.w d0,y_pos(a0)
  62161. move.w (Boss_X_pos).w,x_pos(a0)
  62162. addq.b #2,boss_sine_count(a0)
  62163. cmpi.b #8,boss_routine(a0) ; has boss been defeated?
  62164. bhs.s return_307F2 ; if yes, branch
  62165. tst.b boss_hitcount2(a0) ; has boss run out of hits?
  62166. beq.s Obj89_Main_KillBoss ; if yes, branch
  62167. tst.b collision_flags(a0) ; are boss's collisions enabled?
  62168. bne.s return_307F2 ; if yes, branch
  62169. tst.b boss_invulnerable_time(a0) ; is boss invulnerable?
  62170. bne.s Obj89_Main_Flash ; if yes, branch
  62171. move.b #$40,boss_invulnerable_time(a0) ; make boss invulnerable
  62172. move.w #SndID_BossHit,d0 ; play "boss hit" sound
  62173. jsr (PlaySound).l
  62174.  
  62175. ; loc_307D6:
  62176. Obj89_Main_Flash:
  62177. lea (Normal_palette_line2+2).w,a1
  62178. moveq #0,d0 ; 0000 = black
  62179. tst.w (a1) ; is current color black?
  62180. bne.s + ; if not, branch
  62181. move.w #$EEE,d0 ; 0EEE = white
  62182. +
  62183. move.w d0,(a1) ; set color
  62184. subq.b #1,boss_invulnerable_time(a0)
  62185. bne.s return_307F2 ; branch, if invulnerability hasn't run out
  62186. move.b #$F,collision_flags(a0) ; restore collisions
  62187.  
  62188. return_307F2:
  62189. rts
  62190. ; ===========================================================================
  62191. ; loc_307F4:
  62192. Obj89_Main_KillBoss:
  62193. moveq #100,d0
  62194. jsrto (AddPoints).l, JmpTo5_AddPoints
  62195. move.w #$B3,(Boss_Countdown).w ; set timer
  62196. move.b #8,boss_routine(a0) ; => Obj89_Main_Sub8
  62197. lea (Boss_AnimationArray).w,a1
  62198. move.b #5,1*2(a1) ; use defeated animation
  62199. move.b #0,1*2+1(a1) ; reset animation
  62200. moveq #PLCID_Capsule,d0
  62201. jsrto (LoadPLC).l, JmpTo8_LoadPLC
  62202. move.b #5,sub2_mapframe(a0)
  62203. rts
  62204. ; ===========================================================================
  62205. ; loc_30824:
  62206. Obj89_Main_AlignParts:
  62207. move.w x_pos(a0),d0
  62208. move.w y_pos(a0),d1
  62209. move.w d0,sub2_x_pos(a0)
  62210. move.w d1,sub2_y_pos(a0)
  62211. move.w d0,sub4_x_pos(a0)
  62212. move.w d1,sub4_y_pos(a0)
  62213. tst.b boss_defeated(a0)
  62214. bne.s Obj89_Main_DropHammer ; branch, if boss was defeated
  62215. move.w d0,sub3_x_pos(a0)
  62216. move.w d1,sub3_y_pos(a0)
  62217. move.w d1,obj89_hammer_y_pos(a0)
  62218. rts
  62219. ; ===========================================================================
  62220. ; loc_30850:
  62221. Obj89_Main_DropHammer:
  62222. cmpi.w #$78,(Boss_Countdown).w
  62223. bgt.s return_3088A ; wait until timer is below $78
  62224. subi_.w #1,sub3_x_pos(a0) ; make hammer move left
  62225. move.l obj89_hammer_y_pos(a0),d0
  62226. move.w obj89_hammer_y_vel(a0),d1
  62227. addi.w #$38,obj89_hammer_y_vel(a0) ; add gravity
  62228. ext.l d1
  62229. asl.l #8,d1
  62230. add.l d1,d0
  62231. move.l d0,obj89_hammer_y_pos(a0) ; update position
  62232. move.w obj89_hammer_y_pos(a0),sub3_y_pos(a0)
  62233. cmpi.w #$540,sub3_y_pos(a0) ; has the hammer reached the bottom?
  62234. blt.s return_3088A ; if not, branch
  62235. move.w #0,obj89_hammer_y_vel(a0) ; else, make hammer invisible
  62236.  
  62237. return_3088A:
  62238. rts
  62239. ; ===========================================================================
  62240. ; loc_3088C:
  62241. Obj89_Main_Sub8:
  62242. st boss_defeated(a0)
  62243. subq.w #1,(Boss_Countdown).w
  62244. bmi.s Obj89_Main_SetupEscapeAnim
  62245. bsr.w Boss_LoadExplosion
  62246. bra.s Obj89_Main_Sub8_Standard
  62247. ; ===========================================================================
  62248. ; loc_3089C:
  62249. Obj89_Main_SetupEscapeAnim:
  62250. move.b #3,mainspr_childsprites(a0)
  62251. lea (Boss_AnimationArray).w,a2
  62252. move.b #1,2*2(a2) ; hammer
  62253. move.b #0,2*2+1(a2)
  62254. move.b #0,1*2(a2) ; face
  62255. move.b #0,1*2+1(a2)
  62256. bset #0,render_flags(a0)
  62257. clr.w (Boss_X_vel).w ; stop movement
  62258. clr.w (Boss_Y_vel).w
  62259. addq.b #2,boss_routine(a0) ; => Obj89_Main_SubA
  62260. move.w #-$12,(Boss_Countdown).w
  62261.  
  62262. ; loc_308D6:
  62263. Obj89_Main_Sub8_Standard:
  62264. move.w (Boss_Y_pos).w,y_pos(a0)
  62265. move.w (Boss_X_pos).w,x_pos(a0)
  62266. lea (Ani_obj89_b).l,a1
  62267. bsr.w AnimateBoss
  62268. bsr.w Obj89_Main_AlignParts
  62269. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62270. ; ===========================================================================
  62271. ; loc_308F4:
  62272. Obj89_Main_SubA:
  62273. addq.w #1,(Boss_Countdown).w ; note: countdown starts out as -$12
  62274. beq.s Obj89_Main_SubA_StopFall ; branch, if countdown reached 0
  62275. bpl.s Obj89_Main_SubA_Phase2 ; branch, if falling phase is over
  62276. addi.w #$18,(Boss_Y_vel).w ; else, make boss fall
  62277. bra.s Obj89_Main_SubA_Standard
  62278. ; ===========================================================================
  62279. ; loc_30904:
  62280. Obj89_Main_SubA_StopFall:
  62281. clr.w (Boss_Y_vel).w ; stop fall
  62282. bra.s Obj89_Main_SubA_Standard
  62283. ; ===========================================================================
  62284. ; loc_3090A:
  62285. Obj89_Main_SubA_Phase2:
  62286. cmpi.w #$18,(Boss_Countdown).w
  62287. blo.s Obj89_Main_SubA_Ascend
  62288. beq.s Obj89_Main_SubA_StopAscent
  62289. cmpi.w #$20,(Boss_Countdown).w
  62290. blo.s Obj89_Main_SubA_Standard
  62291. addq.b #2,boss_routine(a0) ; => Obj89_Main_SubC
  62292. bra.s Obj89_Main_SubA_Standard
  62293. ; ===========================================================================
  62294. ; loc_30922:
  62295. Obj89_Main_SubA_Ascend:
  62296. subi_.w #8,(Boss_Y_vel).w ; ascend slowly
  62297. bra.s Obj89_Main_SubA_Standard
  62298. ; ===========================================================================
  62299. ; loc_3092A:
  62300. Obj89_Main_SubA_StopAscent:
  62301. clr.w (Boss_Y_vel).w ; stop ascent
  62302. jsrto (PlayLevelMusic).l, JmpTo4_PlayLevelMusic
  62303. jsrto (LoadPLC_AnimalExplosion).l, JmpTo4_LoadPLC_AnimalExplosion
  62304.  
  62305. ; loc_30936:
  62306. Obj89_Main_SubA_Standard:
  62307. bsr.w Boss_MoveObject
  62308. bsr.w Obj89_Main_HandleHoveringAndHits
  62309. move.w (Boss_Y_pos).w,y_pos(a0)
  62310. move.w (Boss_X_pos).w,x_pos(a0)
  62311. lea (Ani_obj89_b).l,a1
  62312. bsr.w AnimateBoss
  62313. bsr.w Obj89_Main_AlignParts
  62314. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62315. ; ===========================================================================
  62316. ; loc_3095C:
  62317. Obj89_Main_SubC:
  62318. move.w #$400,(Boss_X_vel).w
  62319. move.w #-$40,(Boss_Y_vel).w
  62320. cmpi.w #$2C00,(Camera_Max_X_pos).w ; has camera reached its target position?
  62321. bhs.s Obj89_Main_SubC_ChkDelete ; if yes, branch
  62322. addq.w #2,(Camera_Max_X_pos).w ; else, move camera
  62323. bra.s Obj89_Main_SubC_Standard
  62324. ; ===========================================================================
  62325. ; loc_30976:
  62326. Obj89_Main_SubC_ChkDelete:
  62327. tst.b render_flags(a0) ; is boss still visible?
  62328. bpl.s JmpTo54_DeleteObject ; if not, branch
  62329.  
  62330. ; loc_3097C:
  62331. Obj89_Main_SubC_Standard:
  62332. bsr.w Boss_MoveObject
  62333. bsr.w Obj89_Main_HandleHoveringAndHits
  62334. move.w (Boss_Y_pos).w,y_pos(a0)
  62335. move.w (Boss_X_pos).w,x_pos(a0)
  62336. lea (Ani_obj89_b).l,a1
  62337. bsr.w AnimateBoss
  62338. bsr.w Obj89_Main_AlignParts
  62339. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62340. ; ===========================================================================
  62341.  
  62342. JmpTo54_DeleteObject
  62343. jmp (DeleteObject).l
  62344. ; ===========================================================================
  62345. ; loc_309A8:
  62346. Obj89_Pillar:
  62347. moveq #0,d0
  62348. movea.l obj89_pillar_parent(a0),a1 ; a1=object
  62349. cmpi.b #8,boss_routine(a1) ; has boss been defeated?
  62350. blt.s Obj89_Pillar_Normal ; if not, branch
  62351. move.b #4,routine_secondary(a0)
  62352.  
  62353. ; loc_309BC:
  62354. Obj89_Pillar_Normal:
  62355. move.b routine_secondary(a0),d0
  62356. move.w Obj89_Pillar_Index(pc,d0.w),d1
  62357. jmp Obj89_Pillar_Index(pc,d1.w)
  62358. ; ===========================================================================
  62359. ; off_309C8:
  62360. Obj89_Pillar_Index: offsetTable ; pillar/arrow object
  62361. offsetTableEntry.w Obj89_Pillar_Sub0 ; 0 - raise pillars
  62362. offsetTableEntry.w Obj89_Pillar_Sub2 ; 2 - pillars shaking(?)
  62363. offsetTableEntry.w Obj89_Pillar_Sub4 ; 4 - move pillars down
  62364. offsetTableEntry.w Obj89_Arrow ; 6 - arrow
  62365. offsetTableEntry.w Obj89_Pillar_BulgingEyes ; 8 - pillar normal (standing)
  62366. ; ===========================================================================
  62367. ; loc_309D2:
  62368. Obj89_Pillar_Sub0:
  62369. bsr.w Obj89_Pillar_SolidObject
  62370. move.b (Vint_runcount+3).w,d0
  62371. andi.b #$1F,d0
  62372. bne.s +
  62373. move.w #SndID_Rumbling2,d0 ; play rumbling sound every 32 frames
  62374. jsrto (PlaySound).l, JmpTo8_PlaySound
  62375. +
  62376. subi_.w #1,y_pos(a0) ; raise pillar
  62377. cmpi.w #$488,y_pos(a0) ; has pillar reached its target height?
  62378. bgt.s BranchTo_JmpTo37_DisplaySprite ; if not, branch
  62379. addq.b #2,routine_secondary(a0) ; => Obj89_Pillar_Sub2
  62380. move.b #0,(Screen_Shaking_Flag).w ; stop screen shaking
  62381.  
  62382. BranchTo_JmpTo37_DisplaySprite
  62383. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62384. ; ===========================================================================
  62385. ; loc_30A04:
  62386. Obj89_Pillar_Sub2:
  62387. ; note: the boss switches targets before bit 0 of obj89_hammer_flags is set. In other
  62388. ; words, it's always the pillar facing the new target that fires.
  62389. bsr.w Obj89_Pillar_SolidObject
  62390. movea.l obj89_pillar_parent(a0),a3 ; a3=object
  62391. btst #0,obj89_hammer_flags(a3)
  62392. beq.s Obj89_Pillar_Sub2_Standard ; branch, if hammer hasn't hit a pillar
  62393. tst.b obj89_target(a3) ; is boss targeting the right?
  62394. beq.s Obj89_Pillar_Sub2_RightPillar ; if yes, branch
  62395. btst #0,render_flags(a0) ; is pillar facing left?
  62396. beq.s Obj89_Pillar_Sub2_Standard ; if not, branch
  62397. bra.s loc_30A2C
  62398. ; ===========================================================================
  62399. ; loc_30A24:
  62400. Obj89_Pillar_Sub2_RightPillar:
  62401. btst #0,render_flags(a0) ; is pillar facing right?
  62402. bne.s Obj89_Pillar_Sub2_Standard ; if not, branch
  62403.  
  62404. loc_30A2C:
  62405. bclr #0,obj89_hammer_flags(a3) ; clear "hitting-pillar" flag
  62406. bsr.w Obj89_Pillar_Shoot ; shoot an arrow
  62407. st obj89_pillar_shaking(a0) ; make pillar shake
  62408.  
  62409. ; loc_30A3A:
  62410. Obj89_Pillar_Sub2_Standard:
  62411. bsr.w Obj89_Pillar_ChkShake
  62412. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62413. ; ===========================================================================
  62414. ; loc_30A42:
  62415. Obj89_Pillar_ChkShake:
  62416. tst.b obj89_pillar_shaking(a0) ; is pillar shaking?
  62417. beq.s return_30AAE ; if not, branch
  62418. tst.w obj89_pillar_shake_time(a0) ; has timer been set?
  62419. bgt.s + ; if yes, branch
  62420. move.w #$1F,obj89_pillar_shake_time(a0); else, initialize timer
  62421. +
  62422. subi_.w #1,obj89_pillar_shake_time(a0)
  62423. bgt.s Obj89_Pillar_Shake ; branch, if timer hasn't expired
  62424. sf obj89_pillar_shaking(a0) ; stop shaking
  62425. move.w #0,obj89_pillar_shake_time(a0) ; clear timer
  62426. tst.b obj89_target(a3) ; is boss targeting the left?
  62427. bne.s + ; if yes, branch
  62428. move.w #$2A50,x_pos(a0) ; reset x position of left pillar
  62429. bra.s Obj89_Pillar_Sub2_End
  62430. ; ===========================================================================
  62431. +
  62432. move.w #$2B70,x_pos(a0) ; reset x position of right pillar
  62433.  
  62434. ; loc_30A7A:
  62435. Obj89_Pillar_Sub2_End:
  62436. move.w #$488,y_pos(a0) ; reset y position
  62437. bra.s return_30AAE
  62438. ; ===========================================================================
  62439. ; loc_30A82:
  62440. Obj89_Pillar_Shake:
  62441. move.w #$2A50,d1 ; load left pillar's default x position
  62442. tst.b obj89_target(a3) ; is boss targeting the left
  62443. beq.s + ; if not, branch
  62444. move.w #$2B70,d1 ; load right pillar's default x position
  62445. +
  62446. move.b (Vint_runcount+3).w,d0
  62447. andi.w #1,d0
  62448. add.w d0,d0
  62449. add.w Obj89_Pillar_ShakeOffsets(pc,d0.w),d1
  62450. move.w d1,x_pos(a0) ; add offset to x position
  62451. move.w #$488,d1 ; load pillar's default y position
  62452. add.w Obj89_Pillar_ShakeOffsets(pc,d0.w),d1
  62453. move.w d1,y_pos(a0) ; add offset to y position
  62454.  
  62455. return_30AAE:
  62456. rts
  62457. ; ===========================================================================
  62458. ; word_30AB0:
  62459. Obj89_Pillar_ShakeOffsets:
  62460. dc.w 1 ; 0
  62461. dc.w -1 ; 1
  62462. ; ===========================================================================
  62463. ; loc_30AB4:
  62464. Obj89_Pillar_Shoot:
  62465. jsrto (SingleObjLoad).l, JmpTo14_SingleObjLoad
  62466. bne.w return_30B40
  62467. _move.b #ObjID_ARZBoss,id(a1) ; load obj89
  62468. move.b #4,boss_subtype(a1)
  62469. move.b #8,routine_secondary(a1) ; => Obj89_Pillar_BulgingEyes
  62470. move.l #Obj89_MapUnc_30D68,mappings(a1)
  62471. move.w #make_art_tile(ArtTile_ArtNem_ARZBoss,0,0),art_tile(a1)
  62472. ori.b #4,render_flags(a1)
  62473. moveq #0,d6
  62474. move.b #2,mapping_frame(a1)
  62475. move.w #$2A6A,x_pos(a1) ; align with left pillar
  62476. tst.b obj89_target(a3) ; is boss targeting the right?
  62477. beq.s + ; if yes, branch
  62478. st d6
  62479. move.w #$2B56,x_pos(a1) ; align with right pillar
  62480. bset #0,render_flags(a1)
  62481. +
  62482. move.w #$28,obj89_eyes_timer(a1)
  62483. jsrto (RandomNumber).l, JmpTo3_RandomNumber
  62484. andi.w #3,d0
  62485. add.w d0,d0
  62486. move.w Obj89_Arrow_Offsets(pc,d0.w),y_pos(a1)
  62487. movea.l a1,a2
  62488. jsrto (SingleObjLoad).l, JmpTo14_SingleObjLoad
  62489. bne.s return_30B40
  62490. _move.b #ObjID_ARZBoss,id(a1) ; load obj89
  62491. move.b #4,boss_subtype(a1)
  62492. move.b #6,routine_secondary(a1) ; => Obj89_Arrow
  62493. move.l a2,obj89_arrow_parent2(a1)
  62494. move.b d6,subtype(a1)
  62495. move.l a3,obj89_arrow_parent(a1)
  62496.  
  62497. return_30B40:
  62498. rts
  62499. ; ===========================================================================
  62500. ; word_30B42:
  62501. Obj89_Arrow_Offsets:
  62502. dc.w $458
  62503. dc.w $478 ; 1
  62504. dc.w $498 ; 2
  62505. dc.w $4B8 ; 3
  62506. ; ===========================================================================
  62507. ; loc_30B4A:
  62508. Obj89_Pillar_Sub4:
  62509. move.b #1,(Screen_Shaking_Flag).w ; make screen shake
  62510. addi_.w #1,y_pos(a0) ; lower pillar
  62511. cmpi.w #$510,y_pos(a0) ; has pillar lowered into the ground?
  62512. blt.s BranchTo2_JmpTo37_DisplaySprite ; if not, branch
  62513. move.b #0,(Screen_Shaking_Flag).w ; else, stop shaking the screen
  62514. jmpto (DeleteObject).l, JmpTo55_DeleteObject
  62515. ; ===========================================================================
  62516.  
  62517. BranchTo2_JmpTo37_DisplaySprite
  62518. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62519. ; ===========================================================================
  62520. ; loc_30B6C:
  62521. Obj89_Pillar_BulgingEyes:
  62522. subi_.w #1,obj89_eyes_timer(a0)
  62523. beq.w JmpTo55_DeleteObject
  62524. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62525. ; ===========================================================================
  62526. ; loc_30B7A:
  62527. Obj89_Pillar_SolidObject:
  62528. move.w #$23,d1
  62529. move.w #$44,d2
  62530. move.w #$45,d3
  62531. move.w x_pos(a0),d4
  62532. move.w y_pos(a0),-(sp)
  62533. addi_.w #4,y_pos(a0) ; assume a slightly lower y position
  62534. jsrto (SolidObject).l, JmpTo26_SolidObject
  62535. move.w (sp)+,y_pos(a0) ; restore y position
  62536. rts
  62537. ; ===========================================================================
  62538. ;loc_30B9E:
  62539. Obj89_Arrow:
  62540. moveq #0,d0
  62541. movea.l obj89_arrow_parent(a0),a1 ; a1=object
  62542. cmpi.b #8,boss_routine(a1) ; has boss been defeated?
  62543. blt.s Obj89_Arrow_Normal ; if not, branch
  62544. move.b #6,obj89_arrow_routine(a0) ; => Obj89_Arrow_Sub6
  62545.  
  62546. ; loc_30BB2:
  62547. Obj89_Arrow_Normal:
  62548. move.b obj89_arrow_routine(a0),d0
  62549. move.w Obj89_Arrow_Index(pc,d0.w),d1
  62550. jmp Obj89_Arrow_Index(pc,d1.w)
  62551. ; ===========================================================================
  62552. ; off_30BBE:
  62553. Obj89_Arrow_Index: offsetTable
  62554. offsetTableEntry.w Obj89_Arrow_Init ; 0 - launch arrow (init)
  62555. offsetTableEntry.w Obj89_Arrow_Sub2 ; 2 - arrow in air
  62556. offsetTableEntry.w Obj89_Arrow_Sub4 ; 4 - arrow stuck
  62557. offsetTableEntry.w Obj89_Arrow_Sub6 ; 6 - falling down
  62558. offsetTableEntry.w BranchTo_JmpTo55_DeleteObject ; 8 - delete arrow
  62559. ; ===========================================================================
  62560. ; loc_30BC8:
  62561. Obj89_Arrow_Init:
  62562. move.l #Obj89_MapUnc_30D68,mappings(a0)
  62563. move.w #make_art_tile(ArtTile_ArtNem_ARZBoss,0,0),art_tile(a0)
  62564. ori.b #4,render_flags(a0)
  62565. move.b #-$70,mainspr_width(a0)
  62566. move.b #4,priority(a0)
  62567. addq.b #2,obj89_arrow_routine(a0) ; => Obj89_Arrow_Sub2
  62568. movea.l obj89_arrow_parent2(a0),a1 ; a1=object
  62569. move.w x_pos(a1),x_pos(a0) ; align with parent object
  62570. move.w y_pos(a1),y_pos(a0)
  62571. move.w #4,y_vel(a0)
  62572. move.b #4,mapping_frame(a0)
  62573. addi.w #9,y_pos(a0)
  62574. tst.b subtype(a0) ; was arrow fired from right pillar?
  62575. beq.s + ; if not, branch
  62576. bset #0,status(a0) ; make arrow face left
  62577. bset #0,render_flags(a0)
  62578. move.w #-3,x_vel(a0) ; move left
  62579. bra.s Obj89_Arrow_Init_End
  62580. ; ===========================================================================
  62581. +
  62582. move.w #3,x_vel(a0) ; move right
  62583.  
  62584. ; loc_30C2E:
  62585. Obj89_Arrow_Init_End:
  62586. move.b #$B0,collision_flags(a0)
  62587. rts
  62588. ; ===========================================================================
  62589. ; loc_30C36:
  62590. Obj89_Arrow_Sub2:
  62591. btst #7,status(a0)
  62592. beq.s +
  62593. move.b #8,obj89_arrow_routine(a0) ; => BranchTo_JmpTo55_DeleteObject
  62594. +
  62595. move.w x_pos(a0),d0 ; load x position...
  62596. add.w x_vel(a0),d0 ; ... and add x velocity
  62597. tst.w x_vel(a0) ; is arrow moving right?
  62598. bpl.s Obj89_Arrow_Sub2_GoingRight ; if yes, branch
  62599. cmpi.w #$2A77,d0
  62600. bgt.s Obj89_Arrow_Sub2_Move ; branch, if arrow hasn't reached left pillar
  62601. move.w #$2A77,d0 ; else, make arrow stick to left pillar
  62602. bra.s Obj89_Arrow_Sub2_Stop
  62603. ; ===========================================================================
  62604. ; loc_30C5E:
  62605. Obj89_Arrow_Sub2_GoingRight:
  62606. cmpi.w #$2B49,d0
  62607. blt.s Obj89_Arrow_Sub2_Move ; branch, if arrow hasn't reached right pillar
  62608. move.w #$2B49,d0 ; else, make arrow stick to right pillar
  62609.  
  62610. ; loc_30C68:
  62611. Obj89_Arrow_Sub2_Stop:
  62612. addi_.b #2,obj89_arrow_routine(a0) ; => Obj89_Arrow_Sub4
  62613. move.w d0,x_pos(a0) ; update position
  62614. move.b #SndID_ArrowStick,d0
  62615. jsrto (PlaySound).l, JmpTo8_PlaySound
  62616. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62617. ; ===========================================================================
  62618. ; loc_30C7E:
  62619. Obj89_Arrow_Sub2_Move:
  62620. move.w d0,x_pos(a0) ; update position
  62621. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62622. ; ===========================================================================
  62623. ; loc_30C86:
  62624. Obj89_Arrow_Sub4:
  62625. move.b #0,collision_flags(a0) ; make arrow harmless
  62626. btst #7,status(a0)
  62627. beq.s +
  62628. addi_.b #2,obj89_arrow_routine(a0) ; => Obj89_Arrow_Sub6
  62629. +
  62630. bsr.w Obj89_Arrow_Platform
  62631. lea (Ani_obj89_a).l,a1
  62632. jsrto (AnimateSprite).l, JmpTo19_AnimateSprite
  62633. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62634. ; ===========================================================================
  62635. ; loc_30CAC:
  62636. Obj89_Arrow_Sub6:
  62637. bsr.w Obj89_Arrow_ChkDropPlayers
  62638. move.w y_pos(a0),d0 ; load y position...
  62639. add.w y_vel(a0),d0 ; ... and add y velocity
  62640. cmpi.w #$4F0,d0 ; has arrow dropped to the ground?
  62641. bgt.w JmpTo55_DeleteObject ; if yes, branch
  62642. move.w d0,y_pos(a0) ; update y position
  62643. jmpto (DisplaySprite).l, JmpTo37_DisplaySprite
  62644. ; ===========================================================================
  62645.  
  62646. if removeJmpTos
  62647. JmpTo55_DeleteObject
  62648. endif
  62649.  
  62650. BranchTo_JmpTo55_DeleteObject
  62651. jmpto (DeleteObject).l, JmpTo55_DeleteObject
  62652. ; ===========================================================================
  62653. ; loc_30CCC:
  62654. Obj89_Arrow_Platform:
  62655. tst.w obj89_arrow_timer(a0) ; is timer set?
  62656. bne.s Obj89_Arrow_Platform_Decay ; if yes, branch
  62657. move.w #$1B,d1
  62658. move.w #1,d2
  62659. move.w #2,d3
  62660. move.w x_pos(a0),d4
  62661. jsrto (PlatformObject).l, JmpTo8_PlatformObject
  62662. btst #3,status(a0) ; is Sonic standing on the arrow?
  62663. beq.s return_30D02 ; if not, branch
  62664. move.w #$1F,obj89_arrow_timer(a0) ; else, set timer
  62665.  
  62666. ; loc_30CF4:
  62667. Obj89_Arrow_Platform_Decay:
  62668. subi_.w #1,obj89_arrow_timer(a0) ; decrement timer
  62669. bne.s return_30D02 ; branch, if timer hasn't expired
  62670. move.b #6,obj89_arrow_routine(a0) ; => Obj89_Arrow_Sub6
  62671.  
  62672. return_30D02:
  62673. rts
  62674. ; ===========================================================================
  62675. ; loc_30D04:
  62676. Obj89_Arrow_ChkDropPlayers:
  62677. bclr #p1_standing_bit,status(a0)
  62678. beq.s + ; branch, if Sonic wasn't standing on the arrow
  62679. lea (MainCharacter).w,a1 ; a1=character
  62680. bsr.s Obj89_Arrow_DropPlayer
  62681. +
  62682. bclr #p2_standing_bit,status(a0)
  62683. beq.s return_30D2A ; branch, if Tails wasn't standing on the arrow
  62684. lea (Sidekick).w,a1 ; a1=character
  62685.  
  62686. ; loc_30D1E:
  62687. Obj89_Arrow_DropPlayer:
  62688. bset #1,status(a1)
  62689. bclr #3,status(a1)
  62690.  
  62691. return_30D2A:
  62692. rts
  62693. ; ===========================================================================
  62694. ; animation script
  62695. ; off_30D2C:
  62696. Ani_obj89_a: offsetTable
  62697. offsetTableEntry.w byte_30D30 ; 0
  62698. offsetTableEntry.w byte_30D47 ; 1
  62699. byte_30D30: dc.b 1, 4, 6, 5, 4, 6, 4, 5, 4, 6, 4, 4, 6, 5, 4, 6
  62700. dc.b 4, 5, 4, 6, 4,$FD, 1; 16
  62701. rev02even
  62702.  
  62703. byte_30D47: dc.b $F, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
  62704. dc.b 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,$F9; 16
  62705. even
  62706. ; ----------------------------------------------------------------------------
  62707. ; sprite mappings
  62708. ; ----------------------------------------------------------------------------
  62709. Obj89_MapUnc_30D68: BINCLUDE "mappings/sprite/obj89_a.bin"
  62710.  
  62711. ; animation script
  62712. ; off_30DC8:
  62713. Ani_obj89_b: offsetTable
  62714. offsetTableEntry.w byte_30DD4 ; 0
  62715. offsetTableEntry.w byte_30DEA ; 2
  62716. offsetTableEntry.w byte_30DEE ; 4
  62717. offsetTableEntry.w byte_30DF1 ; 6
  62718. offsetTableEntry.w byte_30DFD ; 8
  62719. offsetTableEntry.w byte_30E00 ; $A
  62720. byte_30DD4: dc.b 7, 0, 1,$FF, 2, 3, 2, 3, 2, 3, 2, 3,$FF, 4, 4, 4
  62721. dc.b 4, 4, 4, 4, 4,$FF; 16
  62722. rev02even
  62723. byte_30DEA: dc.b 1, 6, 7,$FF
  62724. rev02even
  62725. byte_30DEE: dc.b $F, 9,$FF
  62726. rev02even
  62727. byte_30DF1: dc.b 2, $A, $A, $B, $B, $B, $B, $B, $A, $A,$FD, 2
  62728. rev02even
  62729. byte_30DFD: dc.b $F, 8,$FF
  62730. rev02even
  62731. byte_30E00: dc.b 7, 5,$FF
  62732. even
  62733. ; ----------------------------------------------------------------------------
  62734. ; sprite mappings
  62735. ; ----------------------------------------------------------------------------
  62736. Obj89_MapUnc_30E04: BINCLUDE "mappings/sprite/obj89_b.bin"
  62737. ; ===========================================================================
  62738.  
  62739. if ~~removeJmpTos
  62740. JmpTo37_DisplaySprite
  62741. jmp (DisplaySprite).l
  62742. JmpTo55_DeleteObject
  62743. jmp (DeleteObject).l
  62744. JmpTo14_SingleObjLoad
  62745. jmp (SingleObjLoad).l
  62746. JmpTo8_PlaySound
  62747. jmp (PlaySound).l
  62748. JmpTo22_SingleObjLoad2
  62749. jmp (SingleObjLoad2).l
  62750. JmpTo19_AnimateSprite
  62751. jmp (AnimateSprite).l
  62752. JmpTo3_RandomNumber
  62753. jmp (RandomNumber).l
  62754. JmpTo8_LoadPLC
  62755. jmp (LoadPLC).l
  62756. JmpTo5_AddPoints
  62757. jmp (AddPoints).l
  62758. JmpTo4_PlayLevelMusic
  62759. jmp (PlayLevelMusic).l
  62760. JmpTo4_LoadPLC_AnimalExplosion
  62761. jmp (LoadPLC_AnimalExplosion).l
  62762. JmpTo8_PlatformObject
  62763. jmp (PlatformObject).l
  62764. JmpTo26_SolidObject
  62765. jmp (SolidObject).l
  62766.  
  62767. align 4
  62768. endif
  62769.  
  62770.  
  62771.  
  62772.  
  62773. ; ===========================================================================
  62774. ; ----------------------------------------------------------------------------
  62775. ; Object 57 - MCZ boss
  62776. ; ----------------------------------------------------------------------------
  62777. ; OST: first $10 bytes for main sprite, 6 bytes for childsprites (5th byte unused)
  62778. obj57_sub5_y_vel = $2E ; word - y_vel of second digger when falling down
  62779. obj57_sub2_y_vel = $30 ; word - y_vel of first digger when falling down
  62780. obj57_sub2_y_pos2 = $34 ; longword - y_pos of first digger when falling down
  62781. obj57_sub5_y_pos2 = $3A ; longword - y_pos of second digger when falling down
  62782. ; ----------------------------------------------------------------------------
  62783. ; Sprite_30FA4:
  62784. Obj57:
  62785. moveq #0,d0
  62786. move.b boss_subtype(a0),d0
  62787. move.w Obj57_Index(pc,d0.w),d1
  62788. jmp Obj57_Index(pc,d1.w)
  62789. ; ===========================================================================
  62790. ;off_30FB2:
  62791. Obj57_Index: offsetTable
  62792. offsetTableEntry.w Obj57_Init ; 0 - Init
  62793. offsetTableEntry.w Obj57_Main ; 2 - Main Vehicle
  62794. offsetTableEntry.w Obj57_FallingStuff ; 4 - Spikes & Stones
  62795. ; ===========================================================================
  62796. ;loc_30FB8:
  62797. Obj57_Init:
  62798. move.l #Obj57_MapUnc_316EC,mappings(a0)
  62799. move.w #make_art_tile(ArtTile_ArtNem_MCZBoss,0,0),art_tile(a0)
  62800. ori.b #4,render_flags(a0)
  62801. move.b #3,priority(a0) ; gets overwritten
  62802. move.w #$21A0,x_pos(a0)
  62803. move.w #$560,y_pos(a0)
  62804. move.b #5,mainspr_mapframe(a0)
  62805. addq.b #2,boss_subtype(a0)
  62806. move.b #2,boss_routine(a0)
  62807. bset #6,render_flags(a0) ; use subobjects for rendering
  62808. move.b #4,mainspr_childsprites(a0)
  62809. move.b #$F,collision_flags(a0)
  62810. move.b #8,boss_hitcount2(a0)
  62811. move.w x_pos(a0),(Boss_X_pos).w
  62812. move.w y_pos(a0),(Boss_Y_pos).w
  62813. move.w #$C0,(Boss_Y_vel).w ; move down
  62814. move.b #0,(Boss_CollisionRoutine).w
  62815. move.b #1,(Screen_Shaking_Flag).w
  62816. move.b #$40,mainspr_width(a0)
  62817. move.w x_pos(a0),sub2_x_pos(a0)
  62818. move.w y_pos(a0),sub2_y_pos(a0)
  62819. move.b #2,sub2_mapframe(a0)
  62820. move.w x_pos(a0),sub3_x_pos(a0)
  62821. move.w y_pos(a0),sub3_y_pos(a0)
  62822. move.b #1,sub3_mapframe(a0)
  62823. move.w x_pos(a0),sub4_x_pos(a0)
  62824. move.w y_pos(a0),sub4_y_pos(a0)
  62825. move.b #$E,sub4_mapframe(a0)
  62826. move.w x_pos(a0),sub5_x_pos(a0)
  62827. move.w y_pos(a0),sub5_y_pos(a0)
  62828. move.b #2,sub5_mapframe(a0)
  62829. subi.w #$28,sub5_x_pos(a0)
  62830. move.w #$28,(Boss_Countdown).w
  62831. move.w #-$380,obj57_sub5_y_vel(a0)
  62832. move.w #-$380,obj57_sub2_y_vel(a0)
  62833.  
  62834. bsr.w Obj57_InitAnimationData
  62835. rts
  62836. ; ===========================================================================
  62837. ;loc_31090:
  62838. Obj57_InitAnimationData:
  62839. lea (Boss_AnimationArray).w,a2
  62840. move.b #2,(a2)+ ; hover thingies (fire on)
  62841. move.b #0,(a2)+
  62842. move.b #3,(a2)+ ; digger 1 (vertical)
  62843. move.b #0,(a2)+
  62844. move.b #$10,(a2)+ ; main vehicle
  62845. move.b #0,(a2)+
  62846. move.b #$D,(a2)+ ; main vehicle center (including robotnik's face)
  62847. move.b #0,(a2)+
  62848. move.b #3,(a2)+ ; digger 2 (vertical)
  62849. move.b #0,(a2)+
  62850. rts
  62851. ; ===========================================================================
  62852. ;loc_310BE:
  62853. Obj57_Main: ; Main Vehicle
  62854. moveq #0,d0
  62855. move.b boss_routine(a0),d0
  62856. move.w Obj57_Main_Index(pc,d0.w),d1
  62857. jmp Obj57_Main_Index(pc,d1.w)
  62858. ; ===========================================================================
  62859. ;off_310CC:
  62860. Obj57_Main_Index: offsetTable
  62861. offsetTableEntry.w Obj57_Main_Sub0 ; 0 - boss just moving up
  62862. offsetTableEntry.w Obj57_Main_Sub2 ; 2 - boss moving down, stuff falling down
  62863. offsetTableEntry.w Obj57_Main_Sub4 ; 4 - moving down, stop stuff falling down
  62864. offsetTableEntry.w Obj57_Main_Sub6 ; 6 - digger transition (rotation), moving back and forth
  62865. offsetTableEntry.w Obj57_Main_Sub8 ; 8 - boss defeated, standing still, exploding
  62866. offsetTableEntry.w Obj57_Main_SubA ; $A - slowly hovering down, no explosions
  62867. offsetTableEntry.w Obj57_Main_SubC ; $C - moving away fast
  62868. ; ===========================================================================
  62869. ;loc_310DA:
  62870. Obj57_Main_Sub0: ; boss just moving up
  62871. subi_.w #1,(Boss_Countdown).w ; countdown
  62872. bpl.s Obj57_Main_Sub0_Continue
  62873. move.b #0,(Boss_AnimationArray+5).w ; reset anim main vehicle
  62874. bsr.w Boss_MoveObject
  62875. cmpi.w #$560,(Boss_Y_pos).w ; a little above top screen boundary
  62876. bgt.s Obj57_Main_Sub0_Continue ; if below that, branch
  62877. move.w #$100,(Boss_Y_vel).w
  62878. move.w (MainCharacter+x_pos).w,d3
  62879. cmpi.w #$2190,d3
  62880. bhs.s +
  62881. move.w #$2200,d3
  62882. bra.s ++
  62883. ; ===========================================================================
  62884. +
  62885. move.w #$2120,d3
  62886. +
  62887. move.w d3,(Boss_X_pos).w
  62888. addq.b #2,boss_routine(a0) ; stuff falling down
  62889. bclr #0,render_flags(a0)
  62890. move.w (MainCharacter+x_pos).w,d0
  62891. sub.w (Boss_X_pos).w,d0
  62892. bmi.s Obj57_Main_Sub0_Continue
  62893. bset #0,render_flags(a0)
  62894. ;loc_3112C:
  62895. Obj57_Main_Sub0_Continue: ; if countdown finished or boss below $560
  62896. cmpi.w #$28,(Boss_Countdown).w
  62897. bne.s +
  62898. move.b #0,(Boss_CollisionRoutine).w
  62899. +
  62900. cmpi.w #$620,(Boss_Y_pos).w ; if above, screenshaking & stones
  62901. bge.s Obj57_Main_Sub0_Standard
  62902. move.b #1,(Screen_Shaking_Flag).w
  62903. bsr.w Obj57_SpawnStoneSpike
  62904.  
  62905. Obj57_Main_Sub0_Standard:
  62906. move.w (Boss_Y_pos).w,y_pos(a0)
  62907. move.w (Boss_X_pos).w,x_pos(a0)
  62908. bsr.w Obj57_HandleHits
  62909. lea (Ani_obj57).l,a1
  62910. bsr.w AnimateBoss
  62911. bsr.w Obj57_TransferPositions
  62912. jmpto (DisplaySprite).l, JmpTo38_DisplaySprite
  62913. ; ===========================================================================
  62914. ;loc_3116E:
  62915. Obj57_Main_Sub2: ; boss moving down, stuff falling down
  62916. bsr.w Boss_MoveObject
  62917. bsr.w Obj57_SpawnStoneSpike
  62918. cmpi.w #$620,(Boss_Y_pos).w ; if below...
  62919. blt.s Obj57_Main_Sub2_Standard
  62920. addq.b #2,boss_routine(a0) ; ...next routine
  62921. move.b #0,(Screen_Shaking_Flag).w ; no screen shaking
  62922.  
  62923. Obj57_Main_Sub2_Standard:
  62924. move.w (Boss_Y_pos).w,y_pos(a0)
  62925. move.w (Boss_X_pos).w,x_pos(a0)
  62926. bsr.w Obj57_HandleHits
  62927. lea (Ani_obj57).l,a1
  62928. bsr.w AnimateBoss
  62929. bsr.w Obj57_TransferPositions
  62930. jmpto (DisplaySprite).l, JmpTo38_DisplaySprite
  62931. ; ===========================================================================
  62932. ;loc_311AA:
  62933. Obj57_Main_Sub4: ; moving down, stop stuff falling down
  62934. bsr.w Boss_MoveObject
  62935. cmpi.w #$660,(Boss_Y_pos).w
  62936. blt.s Obj57_Main_Sub4_Standard ; if above, keep moving down
  62937. move.w #$660,(Boss_Y_pos).w ; if below, routine 6 + new anim
  62938. addq.b #2,boss_routine(a0)
  62939. lea (Boss_AnimationArray).w,a1
  62940. andi.b #$F0,2(a1)
  62941. ori.b #6,2(a1) ; (6) prepare for digger rotation to diag/hztl
  62942. andi.b #$F0,8(a1)
  62943. ori.b #6,8(a1) ; (6) prepare for digger rotation to diag/hztl
  62944. andi.b #$F0,6(a1)
  62945. ori.b #$D,6(a1) ; (D) robotnik face normal
  62946. move.b #$20,5(a1) ; main vehicle light on
  62947. move.w #$64,(Boss_Countdown).w
  62948. move.b #$30,1(a1) ; hover thingies fire off
  62949. bclr #0,render_flags(a0)
  62950. move.w (MainCharacter+x_pos).w,d0
  62951. sub.w (Boss_X_pos).w,d0
  62952. bmi.s +
  62953. bset #0,render_flags(a0)
  62954. +
  62955. move.w #-$200,(Boss_X_vel).w ; boss moving horizontally
  62956. move.w #0,(Boss_Y_vel).w
  62957. btst #0,render_flags(a0)
  62958. beq.s Obj57_Main_Sub4_Standard
  62959. neg.w (Boss_X_vel).w
  62960.  
  62961. Obj57_Main_Sub4_Standard:
  62962. move.w (Boss_Y_pos).w,y_pos(a0)
  62963. move.w (Boss_X_pos).w,x_pos(a0)
  62964. bsr.w Obj57_HandleHits
  62965. lea (Ani_obj57).l,a1
  62966. bsr.w AnimateBoss
  62967. bsr.w Obj57_TransferPositions
  62968. jmpto (DisplaySprite).l, JmpTo38_DisplaySprite
  62969. ; ===========================================================================
  62970. ;loc_3124A:
  62971. Obj57_Main_Sub6: ; digger transition (rotation), moving back and forth
  62972. subi_.w #1,(Boss_Countdown).w
  62973. cmpi.w #$28,(Boss_Countdown).w
  62974. bgt.w Obj57_Main_Sub6_Standard
  62975. move.b #1,(Boss_CollisionRoutine).w
  62976. tst.w (Boss_Countdown).w
  62977. bpl.w Obj57_Main_Sub6_Standard
  62978. tst.b boss_hurt_sonic(a0) ; has sonic just been hurt?
  62979. beq.s +
  62980. sf boss_hurt_sonic(a0) ; if yes, clear this flag
  62981. bra.s Obj57_Main_Sub6_ReAscend1
  62982. ; ===========================================================================
  62983. +
  62984. bsr.w Boss_MoveObject
  62985. cmpi.w #$2120,(Boss_X_pos).w
  62986. bgt.s +
  62987. move.w #$2120,(Boss_X_pos).w
  62988. bra.s Obj57_Main_Sub6_ReAscend2
  62989. ; ===========================================================================
  62990. +
  62991. cmpi.w #$2200,(Boss_X_pos).w
  62992. blt.s Obj57_Main_Sub6_Standard
  62993. move.w #$2200,(Boss_X_pos).w
  62994. bra.s Obj57_Main_Sub6_ReAscend2
  62995. ; ===========================================================================
  62996. ;loc_31298:
  62997. Obj57_Main_Sub6_ReAscend1: ; that's a dumb name for a label
  62998. lea (Boss_AnimationArray).w,a1
  62999. move.b #$30,7(a1) ; face grin after hurting sonic
  63000. ;loc_312A2:
  63001. Obj57_Main_Sub6_ReAscend2: ; set to routine 0 and make boss move up again
  63002. move.w #0,(Boss_X_vel).w
  63003. move.b #0,boss_routine(a0)
  63004. lea (Boss_AnimationArray).w,a1
  63005. andi.b #$F0,2(a1)
  63006. ori.b #$B,2(a1) ; (B) prepare for digger rotation to diag/vert
  63007. andi.b #$F0,8(a1)
  63008. ori.b #$B,8(a1) ; (B) prepare for digger rotation to diag/vert
  63009. move.b #0,1(a1) ; hover thingies fire on
  63010. andi.b #$F0,6(a1)
  63011. ori.b #$D,6(a1) ; (D) robotnik face normal
  63012. move.w #$64,(Boss_Countdown).w
  63013. move.w #-$C0,(Boss_Y_vel).w ; move up
  63014.  
  63015. Obj57_Main_Sub6_Standard:
  63016. move.w (Boss_Y_pos).w,y_pos(a0)
  63017. move.w (Boss_X_pos).w,x_pos(a0)
  63018. bsr.w Obj57_HandleHits
  63019. lea (Ani_obj57).l,a1
  63020. bsr.w AnimateBoss
  63021. bsr.w Obj57_TransferPositions
  63022. jmpto (DisplaySprite).l, JmpTo38_DisplaySprite
  63023. ; ===========================================================================
  63024. ;loc_3130A:
  63025. Obj57_TransferPositions:
  63026. move.w x_pos(a0),d0
  63027. move.w y_pos(a0),d1
  63028. move.w d0,sub3_x_pos(a0)
  63029. move.w d1,sub3_y_pos(a0)
  63030. move.w d0,sub4_x_pos(a0)
  63031. move.w d1,sub4_y_pos(a0)
  63032. tst.b boss_defeated(a0)
  63033. bne.s Obj57_FallApart ; if boss defeated
  63034. move.w d0,sub5_x_pos(a0)
  63035. move.w d1,sub5_y_pos(a0)
  63036. move.w d0,sub2_x_pos(a0)
  63037. move.w d1,sub2_y_pos(a0)
  63038. move.w d1,obj57_sub5_y_pos2(a0)
  63039. move.w d1,obj57_sub2_y_pos2(a0)
  63040. btst #0,render_flags(a0)
  63041. beq.s +
  63042. addi.w #$28,sub5_x_pos(a0)
  63043. rts
  63044. ; ===========================================================================
  63045. +
  63046. subi.w #$28,sub5_x_pos(a0)
  63047. rts
  63048. ; ===========================================================================
  63049. ;loc_31358:
  63050. Obj57_FallApart: ; make the digger thingies fall down
  63051. cmpi.w #$78,(Boss_Countdown).w
  63052. bgt.s return_313C4
  63053. subi_.w #1,sub5_x_pos(a0)
  63054. move.l obj57_sub5_y_pos2(a0),d0
  63055. move.w obj57_sub5_y_vel(a0),d1
  63056. addi.w #$38,obj57_sub5_y_vel(a0)
  63057. ext.l d1
  63058. asl.l #8,d1
  63059. add.l d1,d0
  63060. move.l d0,obj57_sub5_y_pos2(a0)
  63061. move.w obj57_sub5_y_pos2(a0),sub5_y_pos(a0)
  63062. cmpi.w #$6F0,sub5_y_pos(a0)
  63063. blt.s +
  63064. move.w #0,obj57_sub5_y_vel(a0)
  63065. + ; second one
  63066. addi_.w #1,sub2_x_pos(a0)
  63067. move.l obj57_sub2_y_pos2(a0),d0
  63068. move.w obj57_sub2_y_vel(a0),d1
  63069. addi.w #$38,obj57_sub2_y_vel(a0)
  63070. ext.l d1
  63071. asl.l #8,d1
  63072. add.l d1,d0
  63073. move.l d0,obj57_sub2_y_pos2(a0)
  63074. move.w obj57_sub2_y_pos2(a0),sub2_y_pos(a0)
  63075. cmpi.w #$6F0,sub2_y_pos(a0)
  63076. blt.s return_313C4
  63077. move.w #0,obj57_sub2_y_vel(a0)
  63078.  
  63079. return_313C4:
  63080. rts
  63081. ; ===========================================================================
  63082. ;loc_313C6:
  63083. Obj57_SpawnStoneSpike: ; decide whether stone or spike
  63084. move.b (Vint_runcount+3).w,d1 ; not so random number?
  63085. sf d2
  63086. andi.b #$1F,d1
  63087. beq.s Obj57_LoadStoneSpike
  63088. andi.b #7,d1
  63089. bne.s return_31438
  63090. st d2
  63091. ;loc_313DA:
  63092. Obj57_LoadStoneSpike:
  63093. jsrto (RandomNumber).l, JmpTo4_RandomNumber
  63094. swap d1
  63095. andi.w #$1FF,d1
  63096. addi.w #$20F0,d1
  63097. cmpi.w #$2230,d1
  63098. bgt.s Obj57_LoadStoneSpike
  63099. jsrto (SingleObjLoad).l, JmpTo15_SingleObjLoad
  63100. bne.s return_31438
  63101. move.b #ObjID_MCZBoss,id(a1) ; load obj57
  63102. move.b #4,boss_subtype(a1)
  63103. move.w d1,x_pos(a1)
  63104. move.w #$5F0,y_pos(a1)
  63105. move.l #Obj57_MapUnc_316EC,mappings(a1)
  63106. move.w #make_art_tile(ArtTile_ArtUnc_FallingRocks,0,0),art_tile(a1)
  63107. ori.b #4,render_flags(a1)
  63108. move.b #3,priority(a1)
  63109. move.b #$D,mapping_frame(a1)
  63110. tst.b d2
  63111. bne.s return_31438 ; stone
  63112. move.b #$14,mapping_frame(a1) ; spike
  63113. move.b #$B1,collision_flags(a1)
  63114.  
  63115. return_31438:
  63116. rts
  63117. ; ===========================================================================
  63118. ;loc_3143A:
  63119. Obj57_HandleHits:
  63120. bsr.w Obj57_HandleHits_Main
  63121. cmpi.b #$1F,boss_invulnerable_time(a0)
  63122. bne.s + ; rts
  63123. lea (Boss_AnimationArray).w,a1
  63124. move.b #$C0,7(a1) ; face grin when hit
  63125. +
  63126. rts
  63127. ; ===========================================================================
  63128. ;loc_31452:
  63129. Obj57_AddSinusOffset: ; called from routine $A and $C
  63130. move.b boss_sine_count(a0),d0 ; sinus offset something
  63131. jsr (CalcSine).l
  63132. asr.w #6,d0
  63133. add.w (Boss_Y_pos).w,d0
  63134. move.w d0,y_pos(a0)
  63135. move.w (Boss_X_pos).w,x_pos(a0)
  63136. addq.b #2,boss_sine_count(a0) ; increment frame counter for sinus offset
  63137. ;loc_31470:
  63138. Obj57_HandleHits_Main:
  63139. cmpi.b #8,boss_routine(a0)
  63140. bhs.s return_314B6 ; skip if boss already defeated
  63141. tst.b boss_hitcount2(a0)
  63142. beq.s Obj57_FinalDefeat
  63143. tst.b collision_flags(a0)
  63144. bne.s return_314B6
  63145. tst.b boss_invulnerable_time(a0)
  63146. bne.s +
  63147. move.b #$20,boss_invulnerable_time(a0) ; set invincibility timer
  63148. move.w #SndID_BossHit,d0
  63149. jsr (PlaySound).l
  63150. +
  63151. lea (Normal_palette_line2+2).w,a1
  63152. moveq #0,d0
  63153. tst.w (a1)
  63154. bne.s +
  63155. move.w #$EEE,d0
  63156. +
  63157. move.w d0,(a1)
  63158. subq.b #1,boss_invulnerable_time(a0)
  63159. bne.s return_314B6
  63160. move.b #$F,collision_flags(a0)
  63161.  
  63162. return_314B6:
  63163. rts
  63164. ; ===========================================================================
  63165. ;loc_314B8:
  63166. Obj57_FinalDefeat:
  63167. moveq #100,d0
  63168. jsrto (AddPoints).l, JmpTo6_AddPoints
  63169. move.w #$B3,(Boss_Countdown).w
  63170. move.b #8,boss_routine(a0) ; routine boss defeated
  63171. moveq #PLCID_Capsule,d0
  63172. jsrto (LoadPLC).l, JmpTo9_LoadPLC
  63173. rts
  63174. ; ===========================================================================
  63175. ;loc_314D2:
  63176. Obj57_Main_Sub8: ; boss defeated, standing still, exploding
  63177. st boss_defeated(a0)
  63178. move.b #0,(Screen_Shaking_Flag).w
  63179. subq.w #1,(Boss_Countdown).w ; countdown initially $B3
  63180. bmi.s + ; branch if countdown finished
  63181. move.b #$13,sub4_mapframe(a0) ; burnt face
  63182. move.b #7,mainspr_mapframe(a0)
  63183. bsr.w Boss_LoadExplosion
  63184. bra.s Obj57_Main_Sub8_Standard
  63185. ; ===========================================================================
  63186. +
  63187. bset #0,render_flags(a0)
  63188. clr.w (Boss_X_vel).w
  63189. clr.w (Boss_Y_vel).w
  63190. addq.b #2,boss_routine(a0) ; next routine
  63191. move.b #$12,sub4_mapframe(a0) ; face grin when hit
  63192. move.w #-$12,(Boss_Countdown).w
  63193.  
  63194. Obj57_Main_Sub8_Standard:
  63195. move.w (Boss_Y_pos).w,y_pos(a0)
  63196. move.w (Boss_X_pos).w,x_pos(a0)
  63197. bsr.w Obj57_TransferPositions
  63198. jmpto (DisplaySprite).l, JmpTo38_DisplaySprite
  63199. ; ===========================================================================
  63200. ;loc_31526:
  63201. Obj57_Main_SubA: ; slowly hovering down, no explosions
  63202. addq.w #1,(Boss_Countdown).w ; countdown initially -$12
  63203. beq.s ++ ; reset y_vel
  63204. bpl.s +++
  63205. cmpi.w #$620,(Boss_Y_pos).w
  63206. bhs.s +
  63207. subq.w #1,(Boss_Countdown).w
  63208. +
  63209. addi.w #$10,(Boss_Y_vel).w ; add gravity
  63210. bra.s Obj57_Main_SubA_Standard
  63211. ; ===========================================================================
  63212. +
  63213. clr.w (Boss_Y_vel).w
  63214. bra.s Obj57_Main_SubA_Standard
  63215. ; ===========================================================================
  63216. +
  63217. cmpi.w #$18,(Boss_Countdown).w
  63218. blo.s + ; accelerate boss upwards
  63219. beq.s ++ ; reset y_vel, PlayLevelMusic
  63220. cmpi.w #$20,(Boss_Countdown).w
  63221. blo.s Obj57_Main_SubA_Standard
  63222. lea (Boss_AnimationArray).w,a1
  63223. move.b #$D,7(a1) ; face grin when hit
  63224. _move.b #2,0(a2) ; There is a bug here. This should be a1 instead of a2. A random part of RAM gets written to instead.
  63225. move.b #0,1(a1) ; hover thingies fire off
  63226. addq.b #2,boss_routine(a0)
  63227. bra.s Obj57_Main_SubA_Standard
  63228. ; ===========================================================================
  63229. +
  63230. subi_.w #8,(Boss_Y_vel).w
  63231. bra.s Obj57_Main_SubA_Standard
  63232. ; ===========================================================================
  63233. +
  63234. clr.w (Boss_Y_vel).w
  63235. jsrto (PlayLevelMusic).l, JmpTo5_PlayLevelMusic
  63236. jsrto (LoadPLC_AnimalExplosion).l, JmpTo5_LoadPLC_AnimalExplosion
  63237. ;loc_3158A:
  63238. Obj57_Main_SubA_Standard:
  63239. bsr.w Boss_MoveObject
  63240. bsr.w Obj57_AddSinusOffset
  63241. move.w (Boss_Y_pos).w,y_pos(a0)
  63242. move.w (Boss_X_pos).w,x_pos(a0)
  63243. bsr.w Obj57_TransferPositions
  63244. jmpto (DisplaySprite).l, JmpTo38_DisplaySprite
  63245. ; ===========================================================================
  63246. ;loc_315A6:
  63247. Obj57_Main_SubC: ; moving away fast
  63248. move.w #$400,(Boss_X_vel).w
  63249. move.w #-$40,(Boss_Y_vel).w ; escape to the right
  63250. cmpi.w #$2240,(Camera_Max_X_pos).w
  63251. beq.s +
  63252. addq.w #2,(Camera_Max_X_pos).w
  63253. bra.s Obj57_Main_SubC_Standard
  63254. ; ===========================================================================
  63255. +
  63256. tst.b render_flags(a0)
  63257. bpl.s JmpTo56_DeleteObject ; if off screen
  63258. ;loc_315C6:
  63259. Obj57_Main_SubC_Standard:
  63260. bsr.w Boss_MoveObject
  63261. bsr.w Obj57_AddSinusOffset
  63262. move.w (Boss_Y_pos).w,y_pos(a0)
  63263. move.w (Boss_X_pos).w,x_pos(a0)
  63264. lea (Ani_obj57).l,a1
  63265. bsr.w AnimateBoss
  63266. bsr.w Obj57_TransferPositions
  63267. jmpto (DisplaySprite).l, JmpTo38_DisplaySprite
  63268. ; ===========================================================================
  63269.  
  63270. JmpTo56_DeleteObject
  63271. jmp (DeleteObject).l
  63272. ; ===========================================================================
  63273. ;loc_315F2:
  63274. Obj57_FallingStuff: ; Spikes & Stones
  63275. jsrto (ObjectMoveAndFall).l, JmpTo5_ObjectMoveAndFall
  63276. subi.w #$28,sub2_y_pos(a0) ; decrease gravity
  63277. cmpi.w #$6F0,y_pos(a0) ; if below boundary, delete
  63278. if ~~removeJmpTos
  63279. bgt.w JmpTo57_DeleteObject
  63280. else
  63281. bgt.s JmpTo56_DeleteObject
  63282. endif
  63283. jmpto (DisplaySprite).l, JmpTo38_DisplaySprite
  63284. ; ===========================================================================
  63285. ; off_3160A: Obj57_AnimIndex:
  63286. Ani_obj57: offsetTable
  63287. offsetTableEntry.w byte_31628 ; 0 - main vehicle
  63288. offsetTableEntry.w byte_3162E ; 1 - digger diagonal
  63289. offsetTableEntry.w byte_31631 ; 2 - hover fire thingies to keep boss in air
  63290. offsetTableEntry.w byte_31638 ; 3 - digger vertical animated 1 -> (4)
  63291. offsetTableEntry.w byte_31649 ; 4 - digger vertical animated 2 -> (5)
  63292. offsetTableEntry.w byte_3165A ; 5 - digger vertical animated 3 (loop)
  63293. offsetTableEntry.w byte_31661 ; 6 - digger vertical animated 4 -> (7)
  63294. offsetTableEntry.w byte_31673 ; 7 - digger vertical + diagonal transition -> (8)
  63295. offsetTableEntry.w byte_31684 ; 8 - digger horizontal animated 1 -> (9)
  63296. offsetTableEntry.w byte_31695 ; 9 - digger horizontal animated 2 -> (A)
  63297. offsetTableEntry.w byte_316A6 ; A - digger horizontal animated 3 (loop)
  63298. offsetTableEntry.w byte_316AD ; B - digger horizontal animated 4 -> (C)
  63299. offsetTableEntry.w byte_316BF ; C - digger horizontal + diagonal transition -> (3)
  63300. offsetTableEntry.w byte_316D1 ; D - center vehicle, robotnik's face normal
  63301. offsetTableEntry.w byte_316E8 ; E - center vehicle, robotnik's face when hit
  63302. byte_31628: dc.b $F, 1,$FF ; light off
  63303. dc.b 0,$FC, 2 ; light on; (3) subanimation
  63304. rev02even
  63305. byte_3162E: dc.b 5, 8,$FF
  63306. rev02even
  63307. byte_31631: dc.b 1, 5, 6,$FF ; fire on
  63308. dc.b 7,$FC, 3 ; fire off; (4) subanimation
  63309. rev02even
  63310. byte_31638: dc.b 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4,$FD, 4
  63311. rev02even
  63312. byte_31649: dc.b 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 2, 2, 3, 3,$FD, 5
  63313. rev02even
  63314. byte_3165A: dc.b 1, 4, 2, 3, 4,$FC, 1
  63315. rev02even
  63316. byte_31661: dc.b 1, 2, 3, 4, 4, 2, 2, 3, 3, 3, 4, 4, 4, 2, 2, 2,$FD, 7
  63317. rev02even
  63318. byte_31673: dc.b 1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 2, 8, 8, 8,$FD, 8
  63319. rev02even
  63320. byte_31684: dc.b 1, 9, 9, 9, 9, 9, $A, $A, $A, $A, $A, $B, $B, $B, $B,$FD, 9
  63321. rev02even
  63322. byte_31695: dc.b 1, 9, 9, 9, 9, $A, $A, $A, $B, $B, $B, 9, 9, $A, $A,$FD, $A
  63323. rev02even
  63324. byte_316A6: dc.b 1, $B, 9, $A, $B,$FC, 1
  63325. rev02even
  63326. byte_316AD: dc.b 1, 9, $A, $B, $B, 9, 9, $A, $A, $A, $B, $B, $B, 9, 9, 9,$FD, $C
  63327. rev02even
  63328. byte_316BF: dc.b 1, 9, $A, $A, $A, $A, $B, $B, $B, $B, $B, 9, 8, 8, 8, 8,$FD, 3
  63329. rev02even
  63330. byte_316D1: dc.b 7, $E, $F,$FF
  63331. dc.b $10,$11,$10,$11,$10,$11,$10,$11,$FF ; (4) subanimation (grin after hurting sonic)
  63332. dc.b $12,$12,$12,$12,$12,$12,$12,$12,$12,$FF ; (D) subanimation (grin when hit)
  63333. rev02even
  63334. byte_316E8: dc.b 7,$12,$FF
  63335. even
  63336. ; ----------------------------------------------------------------------------
  63337. ; sprite mappings
  63338. ; ----------------------------------------------------------------------------
  63339. Obj57_MapUnc_316EC: BINCLUDE "mappings/sprite/obj57.bin"
  63340. ; ===========================================================================
  63341.  
  63342. if ~~removeJmpTos
  63343. JmpTo38_DisplaySprite
  63344. jmp (DisplaySprite).l
  63345. JmpTo57_DeleteObject
  63346. jmp (DeleteObject).l
  63347. JmpTo15_SingleObjLoad
  63348. jmp (SingleObjLoad).l
  63349. JmpTo4_RandomNumber
  63350. jmp (RandomNumber).l
  63351. JmpTo9_LoadPLC
  63352. jmp (LoadPLC).l
  63353. JmpTo6_AddPoints
  63354. jmp (AddPoints).l
  63355. JmpTo5_PlayLevelMusic
  63356. jmp (PlayLevelMusic).l
  63357. JmpTo5_LoadPLC_AnimalExplosion
  63358. jmp (LoadPLC_AnimalExplosion).l
  63359. JmpTo5_ObjectMoveAndFall
  63360. jmp (ObjectMoveAndFall).l
  63361.  
  63362. align 4
  63363. endif
  63364.  
  63365.  
  63366.  
  63367.  
  63368. ; ===========================================================================
  63369. ; ----------------------------------------------------------------------------
  63370. ; Object 51 - CNZ boss
  63371. ; ----------------------------------------------------------------------------
  63372. ; Sprite_318F0:
  63373. Obj51:
  63374. moveq #0,d0
  63375. move.b boss_subtype(a0),d0
  63376. move.w Obj51_Index(pc,d0.w),d1
  63377. jmp Obj51_Index(pc,d1.w)
  63378. ; ===========================================================================
  63379. ; off_318FE:
  63380. Obj51_Index: offsetTable
  63381. offsetTableEntry.w Obj51_Init ; 0
  63382. offsetTableEntry.w loc_31A04 ; 2
  63383. offsetTableEntry.w loc_31F24 ; 4
  63384. ; ===========================================================================
  63385. ; loc_31904:
  63386. Obj51_Init:
  63387. move.l #Obj51_MapUnc_320EA,mappings(a0)
  63388. move.w #make_art_tile(ArtTile_ArtNem_CNZBoss_Fudge,0,0),art_tile(a0)
  63389. ori.b #4,render_flags(a0)
  63390. move.b #3,priority(a0)
  63391. move.w #$2A46,x_pos(a0)
  63392. move.w #$654,y_pos(a0)
  63393. move.b #0,mainspr_mapframe(a0)
  63394. move.b #$20,mainspr_width(a0)
  63395. move.b #$80,mainspr_height(a0)
  63396. addq.b #2,boss_subtype(a0)
  63397. move.b #0,angle(a0)
  63398. bset #6,render_flags(a0)
  63399. move.b #4,mainspr_childsprites(a0)
  63400. move.b #$F,collision_flags(a0)
  63401. move.b #8,objoff_32(a0)
  63402. move.w x_pos(a0),(Boss_X_pos).w
  63403. move.w y_pos(a0),(Boss_Y_pos).w
  63404. move.w x_pos(a0),sub2_x_pos(a0)
  63405. move.w y_pos(a0),sub2_y_pos(a0)
  63406. move.b #5,sub2_mapframe(a0)
  63407. move.w x_pos(a0),sub3_x_pos(a0)
  63408. move.w y_pos(a0),sub3_y_pos(a0)
  63409. move.b #1,sub3_mapframe(a0)
  63410. move.w x_pos(a0),sub4_x_pos(a0)
  63411. move.w y_pos(a0),sub4_y_pos(a0)
  63412. move.b #6,sub4_mapframe(a0)
  63413. move.w x_pos(a0),sub5_x_pos(a0)
  63414. move.w y_pos(a0),sub5_y_pos(a0)
  63415. move.b #2,sub5_mapframe(a0)
  63416. move.b #0,objoff_38(a0)
  63417. move.w #0,(Boss_Y_vel).w
  63418. move.w #-$180,(Boss_X_vel).w
  63419. move.b #0,objoff_2D(a0)
  63420. move.w #1,(Boss_Countdown).w
  63421. bsr.w loc_319D6
  63422. rts
  63423. ; ===========================================================================
  63424.  
  63425. loc_319D6:
  63426. lea (Boss_AnimationArray).w,a2
  63427. move.b #8,(a2)+
  63428. move.b #0,(a2)+
  63429. move.b #1,(a2)+
  63430. move.b #0,(a2)+
  63431. move.b #$10,(a2)+
  63432. move.b #0,(a2)+
  63433. move.b #3,(a2)+
  63434. move.b #0,(a2)+
  63435. move.b #2,(a2)+
  63436. move.b #0,(a2)+
  63437. rts
  63438. ; ===========================================================================
  63439.  
  63440. loc_31A04:
  63441. tst.b (Boss_CollisionRoutine).w
  63442. beq.s loc_31A1C
  63443. move.b (Vint_runcount+3).w,d0
  63444. andi.b #$1F,d0
  63445. bne.s loc_31A1C
  63446. move.b #SndID_CNZBossZap,d0
  63447. jsrto (PlaySound).l, JmpTo9_PlaySound
  63448.  
  63449. loc_31A1C:
  63450. moveq #0,d0
  63451. move.b angle(a0),d0
  63452. move.w off_31A2A(pc,d0.w),d1
  63453. jmp off_31A2A(pc,d1.w)
  63454. ; ===========================================================================
  63455. off_31A2A: offsetTable
  63456. offsetTableEntry.w loc_31A36 ; 0
  63457. offsetTableEntry.w loc_31BA8 ; 2
  63458. offsetTableEntry.w loc_31C22 ; 4
  63459. offsetTableEntry.w loc_31D5C ; 6
  63460. offsetTableEntry.w loc_31DCC ; 8
  63461. offsetTableEntry.w loc_31E2A ; $A
  63462. ; ===========================================================================
  63463.  
  63464. loc_31A36:
  63465. moveq #0,d0
  63466. move.b objoff_38(a0),d0
  63467. move.w off_31A44(pc,d0.w),d0
  63468. jmp off_31A44(pc,d0.w)
  63469. ; ===========================================================================
  63470. off_31A44: offsetTable
  63471. offsetTableEntry.w loc_31A48 ; 0
  63472. offsetTableEntry.w loc_31A78 ; 2
  63473. ; ===========================================================================
  63474.  
  63475. loc_31A48:
  63476. cmpi.w #$28C0,(Boss_X_pos).w
  63477. bgt.s BranchTo_loc_31AA4
  63478. move.w #$28C0,(Boss_X_pos).w
  63479. move.w #0,(Boss_Y_vel).w
  63480. move.w #$180,(Boss_X_vel).w
  63481. move.b #2,objoff_38(a0)
  63482. bset #0,render_flags(a0)
  63483. move.b #0,objoff_2D(a0)
  63484.  
  63485. BranchTo_loc_31AA4
  63486. bra.w loc_31AA4
  63487. ; ===========================================================================
  63488.  
  63489. loc_31A78:
  63490. cmpi.w #$29C0,(Boss_X_pos).w
  63491. blt.s loc_31AA4
  63492. move.w #$29C0,(Boss_X_pos).w
  63493. move.w #0,(Boss_Y_vel).w
  63494. move.w #-$180,(Boss_X_vel).w
  63495. move.b #0,objoff_38(a0)
  63496. bclr #0,render_flags(a0)
  63497. move.b #0,objoff_2D(a0)
  63498.  
  63499. loc_31AA4:
  63500. bsr.w Boss_MoveObject
  63501. tst.b objoff_3F(a0)
  63502. beq.s loc_31AB6
  63503. subq.b #1,objoff_3F(a0)
  63504. bra.w loc_31B46
  63505. ; ===========================================================================
  63506.  
  63507. loc_31AB6:
  63508. move.w (MainCharacter+x_pos).w,d0
  63509. sub.w x_pos(a0),d0
  63510. addi.w #$10,d0
  63511. cmpi.w #$20,d0
  63512. bhs.s loc_31B46
  63513. cmpi.w #$6B0,(MainCharacter+y_pos).w
  63514. blo.s loc_31B06
  63515. cmpi.b #3,objoff_2D(a0)
  63516. bhs.s loc_31B46
  63517. addq.b #1,objoff_2D(a0)
  63518. addq.b #2,angle(a0)
  63519. move.b #8,(Boss_AnimationArray).w
  63520. move.b #0,(Boss_AnimationArray+3).w
  63521. move.b #0,(Boss_AnimationArray+9).w
  63522. move.b #0,(Boss_CollisionRoutine).w
  63523. bsr.w loc_31BF2
  63524. move.w #$50,(Boss_Countdown).w
  63525. bra.w loc_31C08
  63526. ; ===========================================================================
  63527.  
  63528. loc_31B06:
  63529. cmpi.w #$67C,(MainCharacter+y_pos).w
  63530. blo.s loc_31B46
  63531. move.b #$F,mainspr_mapframe(a0)
  63532. move.b #2,(Boss_CollisionRoutine).w
  63533. move.b #$20,(Boss_AnimationArray+3).w
  63534. move.b #$20,(Boss_AnimationArray+9).w
  63535. move.b #9,(Boss_AnimationArray).w
  63536. addq.b #4,angle(a0)
  63537. move.w #0,(Boss_X_vel).w
  63538. move.w #$180,(Boss_Y_vel).w
  63539. move.b #0,objoff_3E(a0)
  63540. bra.w loc_31C08
  63541. ; ===========================================================================
  63542.  
  63543. loc_31B46:
  63544. bra.w +
  63545. + addi_.w #1,(Boss_Countdown).w
  63546. move.w (Boss_Countdown).w,d0
  63547. andi.w #$3F,d0
  63548. bne.w loc_31C08
  63549. btst #6,(Boss_Countdown+1).w
  63550. beq.s loc_31B86
  63551. move.b #$F,mainspr_mapframe(a0)
  63552. move.b #2,(Boss_CollisionRoutine).w
  63553. move.b #$20,(Boss_AnimationArray+3).w
  63554. move.b #$20,(Boss_AnimationArray+9).w
  63555. move.b #9,(Boss_AnimationArray).w
  63556. bra.w loc_31C08
  63557. ; ===========================================================================
  63558.  
  63559. loc_31B86:
  63560. move.b #$C,mainspr_mapframe(a0)
  63561. move.b #1,(Boss_CollisionRoutine).w
  63562. move.b #0,(Boss_AnimationArray+3).w
  63563. move.b #0,(Boss_AnimationArray+9).w
  63564. move.b #4,(Boss_AnimationArray).w
  63565. bra.w loc_31C08
  63566. ; ===========================================================================
  63567.  
  63568. loc_31BA8:
  63569. move.b #0,(Boss_CollisionRoutine).w
  63570. subi_.w #1,(Boss_Countdown).w
  63571. bne.s loc_31BC6
  63572. move.b #$20,(Boss_AnimationArray+3).w
  63573. move.b #$20,(Boss_AnimationArray+9).w
  63574. bra.w loc_31C08
  63575. ; ===========================================================================
  63576.  
  63577. loc_31BC6:
  63578. cmpi.w #-$14,(Boss_Countdown).w
  63579. bgt.w loc_31C08
  63580. move.b #0,(Boss_AnimationArray+3).w
  63581. move.b #0,(Boss_AnimationArray+9).w
  63582. move.b #0,angle(a0)
  63583. move.w #-1,(Boss_Countdown).w
  63584. move.b #$40,objoff_3F(a0)
  63585. bra.w loc_31C08
  63586. ; ===========================================================================
  63587.  
  63588. loc_31BF2:
  63589. jsrto (SingleObjLoad).l, JmpTo16_SingleObjLoad
  63590. bne.s return_31C06
  63591. move.b #ObjID_CNZBoss,id(a1) ; load obj51
  63592. move.b #4,boss_subtype(a1)
  63593. move.l a0,objoff_34(a1)
  63594.  
  63595. return_31C06:
  63596. rts
  63597. ; ===========================================================================
  63598.  
  63599. loc_31C08:
  63600. bsr.w loc_31CDC
  63601. bsr.w loc_31E76
  63602. bsr.w loc_31C92
  63603. lea (Ani_obj51).l,a1
  63604. bsr.w AnimateBoss
  63605.  
  63606. if removeJmpTos
  63607. JmpTo39_DisplaySprite
  63608. endif
  63609.  
  63610. jmpto (DisplaySprite).l, JmpTo39_DisplaySprite
  63611. ; ===========================================================================
  63612.  
  63613. loc_31C22:
  63614. bsr.w Boss_MoveObject
  63615. tst.b objoff_3E(a0)
  63616. bne.s loc_31C60
  63617. cmpi.w #$680,y_pos(a0)
  63618. blo.s loc_31C08
  63619. move.w #0,(Boss_X_vel).w
  63620. move.w #-$180,(Boss_Y_vel).w
  63621. move.b #-1,objoff_3E(a0)
  63622. move.b #1,(Boss_CollisionRoutine).w
  63623. move.b #0,(Boss_AnimationArray+3).w
  63624. move.b #0,(Boss_AnimationArray+9).w
  63625. move.b #4,(Boss_AnimationArray).w
  63626. bra.s loc_31C08
  63627. ; ===========================================================================
  63628.  
  63629. loc_31C60:
  63630. cmpi.w #$654,y_pos(a0)
  63631. bhs.s loc_31C08
  63632. move.b #0,angle(a0)
  63633. move.w #0,(Boss_Y_vel).w
  63634. move.w #-$180,(Boss_X_vel).w
  63635. btst #0,render_flags(a0)
  63636. beq.s BranchTo_loc_31C08
  63637. move.w #$180,(Boss_X_vel).w
  63638. move.b #$C,mainspr_mapframe(a0)
  63639.  
  63640. BranchTo_loc_31C08
  63641. bra.w loc_31C08
  63642. ; ===========================================================================
  63643.  
  63644. loc_31C92:
  63645. cmpi.b #$2F,mainspr_height(a0)
  63646. bne.s loc_31CAC
  63647. lea (Boss_AnimationArray).w,a1
  63648. andi.b #$F0,6(a1)
  63649. ori.b #6,6(a1)
  63650. rts
  63651. ; ===========================================================================
  63652.  
  63653. loc_31CAC:
  63654. cmpi.b #4,(MainCharacter+routine).w
  63655. beq.s loc_31CBC
  63656. cmpi.b #4,(Sidekick+routine).w
  63657. bne.s return_31CDA
  63658.  
  63659. loc_31CBC:
  63660. lea (Boss_AnimationArray).w,a1
  63661. move.b 6(a1),d0
  63662. andi.b #$F,d0
  63663. cmpi.b #6,d0
  63664. beq.s return_31CDA
  63665. andi.b #$F0,6(a1)
  63666. ori.b #5,6(a1)
  63667.  
  63668. return_31CDA:
  63669. rts
  63670. ; ===========================================================================
  63671.  
  63672. loc_31CDC:
  63673. move.b mapping_frame(a0),d0
  63674. jsr (CalcSine).l
  63675. asr.w #6,d0
  63676. add.w (Boss_Y_pos).w,d0
  63677. move.w d0,y_pos(a0)
  63678. move.w (Boss_X_pos).w,x_pos(a0)
  63679. addq.b #2,mapping_frame(a0)
  63680. cmpi.b #6,angle(a0)
  63681. bhs.s return_31D40
  63682. tst.b objoff_32(a0)
  63683. beq.s loc_31D42
  63684. tst.b collision_flags(a0)
  63685. bne.s return_31D40
  63686. tst.b mainspr_height(a0)
  63687. bne.s loc_31D24
  63688. move.b #$30,mainspr_height(a0)
  63689. move.w #SndID_BossHit,d0
  63690. jsr (PlaySound).l
  63691.  
  63692. loc_31D24:
  63693. lea (Normal_palette_line2+2).w,a1
  63694. moveq #0,d0
  63695. tst.w (a1)
  63696. bne.s loc_31D32
  63697. move.w #$EEE,d0
  63698.  
  63699. loc_31D32:
  63700. move.w d0,(a1)
  63701. subq.b #1,mainspr_height(a0)
  63702. bne.s return_31D40
  63703. move.b #$F,collision_flags(a0)
  63704.  
  63705. return_31D40:
  63706. rts
  63707. ; ===========================================================================
  63708.  
  63709. loc_31D42:
  63710. moveq #100,d0
  63711. jsrto (AddPoints).l, JmpTo7_AddPoints
  63712. move.w #$B3,(Boss_Countdown).w
  63713. move.b #6,angle(a0)
  63714. moveq #PLCID_Capsule,d0
  63715. jsrto (LoadPLC).l, JmpTo10_LoadPLC
  63716. rts
  63717. ; ===========================================================================
  63718.  
  63719. loc_31D5C:
  63720. st objoff_2C(a0)
  63721. subq.w #1,(Boss_Countdown).w
  63722. bmi.s loc_31D7E
  63723. move.b #0,(Boss_CollisionRoutine).w
  63724. move.b #0,mainspr_mapframe(a0)
  63725. move.b #$B,collision_property(a0)
  63726. bsr.w Boss_LoadExplosion
  63727. bra.s loc_31DB8
  63728. ; ===========================================================================
  63729.  
  63730. loc_31D7E:
  63731. bset #0,render_flags(a0)
  63732. clr.w (Boss_X_vel).w
  63733. clr.w (Boss_Y_vel).w
  63734. addq.b #2,angle(a0)
  63735. lea (Boss_AnimationArray).w,a1
  63736. andi.b #$F0,6(a1)
  63737. ori.b #3,6(a1)
  63738. _move.b #8,0(a1)
  63739. move.b #$DD,(Level_Layout+$C54).w
  63740. move.b #1,(Screen_redraw_flag).w
  63741. move.w #-$12,(Boss_Countdown).w
  63742.  
  63743. loc_31DB8:
  63744. move.w (Boss_Y_pos).w,y_pos(a0)
  63745. move.w (Boss_X_pos).w,x_pos(a0)
  63746. bsr.w loc_31E76
  63747. jmpto (DisplaySprite).l, JmpTo39_DisplaySprite
  63748. ; ===========================================================================
  63749.  
  63750. loc_31DCC:
  63751. addq.w #1,(Boss_Countdown).w
  63752. beq.s loc_31DDC
  63753. bpl.s loc_31DE2
  63754. addi.w #$18,(Boss_Y_vel).w
  63755. bra.s loc_31E0E
  63756. ; ===========================================================================
  63757.  
  63758. loc_31DDC:
  63759. clr.w (Boss_Y_vel).w
  63760. bra.s loc_31E0E
  63761. ; ===========================================================================
  63762.  
  63763. loc_31DE2:
  63764. cmpi.w #$18,(Boss_Countdown).w
  63765. blo.s loc_31DFA
  63766. beq.s loc_31E02
  63767. cmpi.w #$20,(Boss_Countdown).w
  63768. blo.s loc_31E0E
  63769. addq.b #2,angle(a0)
  63770. bra.s loc_31E0E
  63771. ; ===========================================================================
  63772.  
  63773. loc_31DFA:
  63774. subi_.w #8,(Boss_Y_vel).w
  63775. bra.s loc_31E0E
  63776. ; ===========================================================================
  63777.  
  63778. loc_31E02:
  63779. clr.w (Boss_Y_vel).w
  63780. jsrto (PlayLevelMusic).l, JmpTo6_PlayLevelMusic
  63781. jsrto (LoadPLC_AnimalExplosion).l, JmpTo6_LoadPLC_AnimalExplosion
  63782.  
  63783. loc_31E0E:
  63784. bsr.w Boss_MoveObject
  63785. bsr.w loc_31CDC
  63786. move.w (Boss_Y_pos).w,y_pos(a0)
  63787. move.w (Boss_X_pos).w,x_pos(a0)
  63788. bsr.w loc_31E76
  63789. jmpto (DisplaySprite).l, JmpTo39_DisplaySprite
  63790. ; ===========================================================================
  63791.  
  63792. loc_31E2A:
  63793. move.w #$400,(Boss_X_vel).w
  63794. move.w #-$40,(Boss_Y_vel).w
  63795. cmpi.w #$2B20,(Camera_Max_X_pos).w
  63796. beq.s loc_31E44
  63797. addq.w #2,(Camera_Max_X_pos).w
  63798. bra.s loc_31E4A
  63799. ; ===========================================================================
  63800.  
  63801. loc_31E44:
  63802. tst.b render_flags(a0)
  63803. bpl.s JmpTo58_DeleteObject
  63804.  
  63805. loc_31E4A:
  63806. bsr.w Boss_MoveObject
  63807. bsr.w loc_31CDC
  63808. move.w (Boss_Y_pos).w,y_pos(a0)
  63809. move.w (Boss_X_pos).w,x_pos(a0)
  63810. bsr.w loc_31E76
  63811. lea (Ani_obj51).l,a1
  63812. bsr.w AnimateBoss
  63813. jmpto (DisplaySprite).l, JmpTo39_DisplaySprite
  63814. ; ===========================================================================
  63815.  
  63816. if removeJmpTos
  63817. JmpTo59_DeleteObject
  63818. endif
  63819.  
  63820. JmpTo58_DeleteObject
  63821. jmp (DeleteObject).l
  63822. ; ===========================================================================
  63823.  
  63824. loc_31E76:
  63825. move.w x_pos(a0),d0
  63826. move.w y_pos(a0),d1
  63827. move.w d0,sub3_x_pos(a0)
  63828. move.w d1,sub3_y_pos(a0)
  63829. move.w d0,sub4_x_pos(a0)
  63830. move.w d1,sub4_y_pos(a0)
  63831. tst.b objoff_2C(a0)
  63832. bne.s loc_31EAE
  63833. move.w d0,sub5_x_pos(a0)
  63834. move.w d1,sub5_y_pos(a0)
  63835. move.w d0,sub2_x_pos(a0)
  63836. move.w d1,sub2_y_pos(a0)
  63837. move.w d1,objoff_3A(a0)
  63838. move.w d1,objoff_34(a0)
  63839. rts
  63840. ; ===========================================================================
  63841.  
  63842. loc_31EAE:
  63843. cmpi.w #$78,(Boss_Countdown).w
  63844. bgt.s return_31F22
  63845. subi_.w #1,sub5_x_pos(a0)
  63846. move.l objoff_3A(a0),d0
  63847. move.w objoff_2E(a0),d1
  63848. addi.w #$38,objoff_2E(a0)
  63849. ext.l d1
  63850. asl.l #8,d1
  63851. add.l d1,d0
  63852. move.l d0,objoff_3A(a0)
  63853. move.w objoff_3A(a0),sub5_y_pos(a0)
  63854. cmpi.w #$6F0,sub5_y_pos(a0)
  63855. blt.s loc_31EE8
  63856. move.w #0,objoff_2E(a0)
  63857.  
  63858. loc_31EE8:
  63859. cmpi.w #$3C,(Boss_Countdown).w
  63860. bgt.s return_31F22
  63861. addi_.w #1,sub2_x_pos(a0)
  63862. move.l objoff_34(a0),d0
  63863. move.w objoff_30(a0),d1
  63864. addi.w #$38,objoff_30(a0)
  63865. ext.l d1
  63866. asl.l #8,d1
  63867. add.l d1,d0
  63868. move.l d0,objoff_34(a0)
  63869. move.w objoff_34(a0),sub2_y_pos(a0)
  63870. cmpi.w #$6F0,sub2_y_pos(a0)
  63871. blt.s return_31F22
  63872. move.w #0,objoff_30(a0)
  63873.  
  63874. return_31F22:
  63875. rts
  63876. ; ===========================================================================
  63877.  
  63878. loc_31F24:
  63879. movea.l objoff_34(a0),a1 ; a1=object
  63880. cmpi.b #6,angle(a1)
  63881. bhs.w JmpTo59_DeleteObject
  63882. moveq #0,d0
  63883. move.b routine_secondary(a0),d0
  63884. move.w off_31F40(pc,d0.w),d1
  63885. jmp off_31F40(pc,d1.w)
  63886. ; ===========================================================================
  63887. off_31F40: offsetTable
  63888. offsetTableEntry.w loc_31F48 ; 0
  63889. offsetTableEntry.w loc_31F96 ; 2
  63890. offsetTableEntry.w loc_31FDC ; 4
  63891. offsetTableEntry.w loc_32080 ; 6
  63892. ; ===========================================================================
  63893.  
  63894. loc_31F48:
  63895. move.l #Obj51_MapUnc_320EA,mappings(a0)
  63896. move.w #make_art_tile(ArtTile_ArtNem_CNZBoss_Fudge,0,0),art_tile(a0)
  63897. ori.b #4,render_flags(a0)
  63898. move.b #7,priority(a0)
  63899. addq.b #2,routine_secondary(a0)
  63900. movea.l objoff_34(a0),a1 ; a1=object
  63901. move.w x_pos(a1),x_pos(a0)
  63902. move.w y_pos(a1),y_pos(a0)
  63903. addi.w #$30,y_pos(a0)
  63904. move.b #8,y_radius(a0)
  63905. move.b #8,x_radius(a0)
  63906. move.b #$12,mapping_frame(a0)
  63907. move.b #$98,collision_flags(a0)
  63908. rts
  63909. ; ===========================================================================
  63910.  
  63911. loc_31F96:
  63912. movea.l objoff_34(a0),a1 ; a1=object
  63913. move.w x_pos(a1),x_pos(a0)
  63914. move.w y_pos(a1),y_pos(a0)
  63915. move.w objoff_28(a0),d0
  63916. add.w d0,y_pos(a0)
  63917. addi_.w #1,d0
  63918. cmpi.w #$2E,d0
  63919. blt.s +
  63920. move.w #$2E,d0
  63921. +
  63922. move.w d0,objoff_28(a0)
  63923. tst.w (Boss_Countdown).w
  63924. bne.w JmpTo39_DisplaySprite
  63925. addq.b #2,routine_secondary(a0)
  63926. move.w #0,x_vel(a0)
  63927. move.w #0,y_vel(a0)
  63928. jmpto (DisplaySprite).l, JmpTo39_DisplaySprite
  63929. ; ===========================================================================
  63930.  
  63931. loc_31FDC:
  63932. bsr.w loc_31FF8
  63933. jsr (ObjCheckFloorDist).l
  63934. tst.w d1
  63935. bpl.w JmpTo39_DisplaySprite
  63936. add.w d1,y_pos(a0)
  63937. bsr.w loc_32030
  63938. jmpto (DisplaySprite).l, JmpTo39_DisplaySprite
  63939. ; ===========================================================================
  63940.  
  63941. loc_31FF8:
  63942. moveq #0,d2
  63943. move.w x_pos(a0),d2
  63944. swap d2
  63945. moveq #0,d3
  63946. move.w y_pos(a0),d3
  63947. swap d3
  63948. move.w x_vel(a0),d0
  63949. ext.l d0
  63950. asl.l #8,d0
  63951. add.l d0,d2
  63952. move.w y_vel(a0),d0
  63953. ext.l d0
  63954. asl.l #8,d0
  63955. add.l d0,d3
  63956. addi.w #$38,y_vel(a0)
  63957. swap d2
  63958. move.w d2,x_pos(a0)
  63959. swap d3
  63960. move.w d3,y_pos(a0)
  63961. rts
  63962. ; ===========================================================================
  63963.  
  63964. loc_32030:
  63965. move.b #SndID_BossExplosion,d0
  63966. jsrto (PlaySound).l, JmpTo9_PlaySound
  63967. move.w #make_art_tile(ArtTile_ArtNem_CNZBoss_Fudge,0,0),art_tile(a0)
  63968. move.b #7,anim(a0)
  63969. move.w #-$300,y_vel(a0)
  63970. move.w #-$100,x_vel(a0)
  63971. move.b #4,boss_subtype(a0)
  63972. move.b #6,routine_secondary(a0)
  63973. move.b #$98,collision_flags(a0)
  63974. jsrto (SingleObjLoad2).l, JmpTo23_SingleObjLoad2
  63975. bne.s return_3207E
  63976. moveq #0,d0
  63977.  
  63978. move.w #bytesToLcnt(object_size),d1
  63979.  
  63980. loc_3206E:
  63981. move.l (a0,d0.w),(a1,d0.w)
  63982. addq.w #4,d0
  63983. dbf d1,loc_3206E
  63984. if object_size&3
  63985. move.w (a0,d0.w),(a1,d0.w)
  63986. endif
  63987.  
  63988. neg.w x_vel(a1)
  63989.  
  63990. return_3207E:
  63991. rts
  63992. ; ===========================================================================
  63993.  
  63994. loc_32080:
  63995. bsr.w loc_31FF8
  63996. lea (Ani_obj51).l,a1
  63997. jsrto (AnimateSprite).l, JmpTo20_AnimateSprite
  63998. cmpi.w #$705,y_pos(a0)
  63999. blo.w JmpTo39_DisplaySprite
  64000. jmpto JmpTo59_DeleteObject, JmpTo59_DeleteObject
  64001. ; ===========================================================================
  64002. ; animation script
  64003. ; off_3209C:
  64004. Ani_obj51: offsetTable
  64005. offsetTableEntry.w byte_320B0 ; 0
  64006. offsetTableEntry.w byte_320B3 ; 1
  64007. offsetTableEntry.w byte_320B9 ; 2
  64008. offsetTableEntry.w byte_320BF ; 3
  64009. offsetTableEntry.w byte_320C3 ; 4
  64010. offsetTableEntry.w byte_320C8 ; 5
  64011. offsetTableEntry.w byte_320D3 ; 6
  64012. offsetTableEntry.w byte_320DD ; 7
  64013. offsetTableEntry.w byte_320E1 ; 8
  64014. offsetTableEntry.w byte_320E4 ; 9
  64015. byte_320B0: dc.b $F, 1,$FF
  64016. rev02even
  64017. byte_320B3: dc.b $F, 4,$FF, 5,$FC, 2
  64018. rev02even
  64019. byte_320B9: dc.b $F, 2,$FF, 3,$FC, 2
  64020. rev02even
  64021. byte_320BF: dc.b 7, 6, 7,$FF
  64022. rev02even
  64023. byte_320C3: dc.b 1, $C, $D, $E,$FF
  64024. rev02even
  64025. byte_320C8: dc.b 7, 8, 9, 8, 9, 8, 9, 8, 9,$FD, 3
  64026. rev02even
  64027. byte_320D3: dc.b 7, $A, $A, $A, $A, $A, $A, $A,$FD, 3
  64028. rev02even
  64029. byte_320DD: dc.b 3,$13,$14,$FF
  64030. rev02even
  64031. byte_320E1: dc.b 1, 0,$FF
  64032. rev02even
  64033. byte_320E4: dc.b 1, $F,$10,$11,$FF
  64034. even
  64035. ; ----------------------------------------------------------------------------
  64036. ; sprite mappings
  64037. ; ----------------------------------------------------------------------------
  64038. Obj51_MapUnc_320EA: BINCLUDE "mappings/sprite/obj51.bin"
  64039. ; ===========================================================================
  64040.  
  64041. if ~~removeJmpTos
  64042. JmpTo39_DisplaySprite
  64043. jmp (DisplaySprite).l
  64044. JmpTo59_DeleteObject
  64045. jmp (DeleteObject).l
  64046. JmpTo16_SingleObjLoad
  64047. jmp (SingleObjLoad).l
  64048. JmpTo9_PlaySound
  64049. jmp (PlaySound).l
  64050. JmpTo23_SingleObjLoad2
  64051. jmp (SingleObjLoad2).l
  64052. JmpTo20_AnimateSprite
  64053. jmp (AnimateSprite).l
  64054. JmpTo10_LoadPLC
  64055. jmp (LoadPLC).l
  64056. JmpTo7_AddPoints
  64057. jmp (AddPoints).l
  64058. JmpTo6_PlayLevelMusic
  64059. jmp (PlayLevelMusic).l
  64060. JmpTo6_LoadPLC_AnimalExplosion
  64061. jmp (LoadPLC_AnimalExplosion).l
  64062.  
  64063. align 4
  64064. endif
  64065.  
  64066.  
  64067.  
  64068.  
  64069. ; ===========================================================================
  64070. ; ----------------------------------------------------------------------------
  64071. ; Object 54 - MTZ boss
  64072. ; ----------------------------------------------------------------------------
  64073. ; Sprite_32288:
  64074. Obj54:
  64075. moveq #0,d0
  64076. move.b boss_subtype(a0),d0
  64077. move.w Obj54_Index(pc,d0.w),d1
  64078. jmp Obj54_Index(pc,d1.w)
  64079. ; ===========================================================================
  64080. ; off_32296:
  64081. Obj54_Index: offsetTable
  64082. offsetTableEntry.w Obj54_Init ; 0
  64083. offsetTableEntry.w Obj54_Main ; 2
  64084. offsetTableEntry.w Obj54_Laser ; 4
  64085. offsetTableEntry.w Obj54_LaserShooter ; 6
  64086. ; ===========================================================================
  64087. ; loc_3229E:
  64088. Obj54_Init:
  64089. move.l #Obj54_MapUnc_32DC6,mappings(a0)
  64090. move.w #make_art_tile(ArtTile_ArtNem_MTZBoss,0,0),art_tile(a0)
  64091. ori.b #4,render_flags(a0)
  64092. move.b #3,priority(a0)
  64093. move.w #$2B50,x_pos(a0)
  64094. move.w #$380,y_pos(a0)
  64095. move.b #2,mainspr_mapframe(a0)
  64096. addq.b #2,boss_subtype(a0) ; => Obj54_Main
  64097. bset #6,render_flags(a0)
  64098. move.b #2,mainspr_childsprites(a0)
  64099. move.b #$F,collision_flags(a0)
  64100. move.b #8,boss_hitcount2(a0)
  64101. move.b #7,objoff_3E(a0)
  64102. move.w x_pos(a0),(Boss_X_pos).w
  64103. move.w y_pos(a0),(Boss_Y_pos).w
  64104. move.w #0,(Boss_X_vel).w
  64105. move.w #$100,(Boss_Y_vel).w
  64106. move.b #$20,mainspr_width(a0)
  64107. clr.b objoff_2B(a0)
  64108. clr.b objoff_2C(a0)
  64109. move.b #$40,mapping_frame(a0)
  64110. move.b #$27,objoff_33(a0)
  64111. move.b #$27,objoff_39(a0)
  64112. move.w x_pos(a0),sub2_x_pos(a0)
  64113. move.w y_pos(a0),sub2_y_pos(a0)
  64114. move.b #$C,sub2_mapframe(a0)
  64115. move.w x_pos(a0),sub3_x_pos(a0)
  64116. move.w y_pos(a0),sub3_y_pos(a0)
  64117. move.b #0,sub3_mapframe(a0)
  64118. jsrto (SingleObjLoad).l, JmpTo17_SingleObjLoad
  64119. bne.s +
  64120. move.b #ObjID_MTZBoss,id(a1) ; load obj54
  64121. move.b #6,boss_subtype(a1) ; => Obj54_LaserShooter
  64122. move.b #$13,mapping_frame(a1)
  64123. move.l #Obj54_MapUnc_32DC6,mappings(a1)
  64124. move.w #make_art_tile(ArtTile_ArtNem_MTZBoss,0,0),art_tile(a1)
  64125. ori.b #4,render_flags(a1)
  64126. move.b #6,priority(a1)
  64127. move.w x_pos(a0),x_pos(a1)
  64128. move.w y_pos(a0),y_pos(a1)
  64129. move.l a0,objoff_34(a1)
  64130. move.b #$20,width_pixels(a1)
  64131. jsrto (SingleObjLoad).l, JmpTo17_SingleObjLoad
  64132. bne.s +
  64133. move.b #ObjID_MTZBossOrb,id(a1) ; load obj53
  64134. move.l a0,objoff_34(a1)
  64135. +
  64136. lea (Boss_AnimationArray).w,a2
  64137. move.b #$10,(a2)+
  64138. move.b #0,(a2)+
  64139. move.b #3,(a2)+
  64140. move.b #0,(a2)+
  64141. move.b #1,(a2)+
  64142. move.b #0,(a2)+
  64143. rts
  64144. ; ===========================================================================
  64145. ;loc_323BA
  64146. Obj54_Main:
  64147. moveq #0,d0
  64148. move.b angle(a0),d0
  64149. move.w Obj54_MainSubStates(pc,d0.w),d1
  64150. jmp Obj54_MainSubStates(pc,d1.w)
  64151. ; ===========================================================================
  64152. Obj54_MainSubStates: offsetTable
  64153. offsetTableEntry.w Obj54_MainSub0 ; 0
  64154. offsetTableEntry.w Obj54_MainSub2 ; 2
  64155. offsetTableEntry.w Obj54_MainSub4 ; 4
  64156. offsetTableEntry.w Obj54_MainSub6 ; 6
  64157. offsetTableEntry.w Obj54_MainSub8 ; 8
  64158. offsetTableEntry.w Obj54_MainSubA ; $A
  64159. offsetTableEntry.w Obj54_MainSubC ; $C
  64160. offsetTableEntry.w Obj54_MainSubE ; $E
  64161. offsetTableEntry.w Obj54_MainSub10 ; $10
  64162. offsetTableEntry.w Obj54_MainSub12 ; $12
  64163. ; ===========================================================================
  64164. ;loc_323DC
  64165. Obj54_MainSub0:
  64166. bsr.w Boss_MoveObject
  64167. move.w (Boss_Y_pos).w,y_pos(a0)
  64168. cmpi.w #$4A0,(Boss_Y_pos).w
  64169. blo.s +
  64170. addq.b #2,angle(a0) ; => Obj54_MainSub2
  64171. move.w #0,(Boss_Y_vel).w
  64172. move.w #-$100,(Boss_X_vel).w
  64173. bclr #7,objoff_2B(a0)
  64174. bclr #0,render_flags(a0)
  64175. move.w (MainCharacter+x_pos).w,d0
  64176. cmp.w (Boss_X_pos).w,d0
  64177. blo.s +
  64178. move.w #$100,(Boss_X_vel).w
  64179. bset #7,objoff_2B(a0)
  64180. bset #0,render_flags(a0)
  64181. +
  64182. bsr.w Obj54_AnimateFace
  64183. lea (Ani_obj53).l,a1
  64184. bsr.w AnimateBoss
  64185. bsr.w Obj54_AlignSprites
  64186. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64187. ; ===========================================================================
  64188. ;loc_3243C
  64189. Obj54_Float:
  64190. move.b mapping_frame(a0),d0
  64191. jsr (CalcSine).l
  64192. asr.w #6,d0
  64193. add.w (Boss_Y_pos).w,d0
  64194. move.w d0,y_pos(a0)
  64195. addq.b #4,mapping_frame(a0)
  64196. rts
  64197. ; ===========================================================================
  64198. ;loc_32456
  64199. Obj54_MainSub2:
  64200. bsr.w Boss_MoveObject
  64201. btst #7,objoff_2B(a0)
  64202. bne.s +
  64203. cmpi.w #$2AD0,(Boss_X_pos).w
  64204. bhs.s Obj54_MoveAndShow
  64205. bchg #7,objoff_2B(a0)
  64206. move.w #$100,(Boss_X_vel).w
  64207. bset #0,render_flags(a0)
  64208. bset #6,objoff_2B(a0)
  64209. beq.s Obj54_MoveAndShow
  64210. addq.b #2,angle(a0) ; => Obj54_MainSub4
  64211. move.w #-$100,(Boss_Y_vel).w
  64212. bra.s Obj54_MoveAndShow
  64213. ; ===========================================================================
  64214. +
  64215. cmpi.w #$2BD0,(Boss_X_pos).w
  64216. blo.s Obj54_MoveAndShow
  64217. bchg #7,objoff_2B(a0)
  64218. move.w #-$100,(Boss_X_vel).w
  64219. bclr #0,render_flags(a0)
  64220. bset #6,objoff_2B(a0)
  64221. beq.s Obj54_MoveAndShow
  64222. addq.b #2,angle(a0) ; => Obj54_MainSub4
  64223. move.w #-$100,(Boss_Y_vel).w
  64224. ;loc_324BC
  64225. Obj54_MoveAndShow:
  64226. move.w (Boss_X_pos).w,x_pos(a0)
  64227. bsr.w Obj54_Float
  64228. ;loc_324C6
  64229. Obj54_Display:
  64230. bsr.w Obj54_AnimateFace
  64231. lea (Ani_obj53).l,a1
  64232. bsr.w AnimateBoss
  64233. bsr.w Obj54_AlignSprites
  64234. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64235. ; ===========================================================================
  64236. ;loc_324DC
  64237. Obj54_MainSub4:
  64238. bsr.w Boss_MoveObject
  64239. cmpi.w #$470,(Boss_Y_pos).w
  64240. bhs.s +
  64241. move.w #0,(Boss_Y_vel).w
  64242. +
  64243. btst #7,objoff_2B(a0)
  64244. bne.s +
  64245. cmpi.w #$2B50,(Boss_X_pos).w
  64246. bhs.s ++
  64247. move.w #0,(Boss_X_vel).w
  64248. bra.s ++
  64249. ; ===========================================================================
  64250. +
  64251. cmpi.w #$2B50,(Boss_X_pos).w
  64252. blo.s +
  64253. move.w #0,(Boss_X_vel).w
  64254. +
  64255. move.w (Boss_X_vel).w,d0
  64256. or.w (Boss_Y_vel).w,d0
  64257. bne.s BranchTo_Obj54_MoveAndShow
  64258. addq.b #2,angle(a0) ; => Obj54_MainSub6
  64259.  
  64260. BranchTo_Obj54_MoveAndShow
  64261. bra.s Obj54_MoveAndShow
  64262. ; ===========================================================================
  64263. ;loc_32524
  64264. Obj54_MainSub6:
  64265. cmpi.b #$68,objoff_33(a0)
  64266. bhs.s +
  64267. addq.b #1,objoff_33(a0)
  64268. addq.b #1,objoff_39(a0)
  64269. bra.s BranchTo2_Obj54_MoveAndShow
  64270. ; ===========================================================================
  64271. +
  64272. subq.b #1,objoff_39(a0)
  64273. bne.s BranchTo2_Obj54_MoveAndShow
  64274. addq.b #2,angle(a0) ; => Obj54_MainSub8
  64275.  
  64276. BranchTo2_Obj54_MoveAndShow
  64277. bra.w Obj54_MoveAndShow
  64278. ; ===========================================================================
  64279. ;loc_32544
  64280. Obj54_MainSub8:
  64281. cmpi.b #$27,objoff_33(a0)
  64282. blo.s +
  64283. subq.b #1,objoff_33(a0)
  64284. bra.s BranchTo3_Obj54_MoveAndShow
  64285. ; ===========================================================================
  64286. +
  64287. addq.b #1,objoff_39(a0)
  64288. cmpi.b #$27,objoff_39(a0)
  64289. blo.s BranchTo3_Obj54_MoveAndShow
  64290. move.w #$100,(Boss_Y_vel).w
  64291. move.b #0,angle(a0) ; => Obj54_MainSub0
  64292. bclr #6,objoff_2B(a0)
  64293.  
  64294. BranchTo3_Obj54_MoveAndShow
  64295. bra.w Obj54_MoveAndShow
  64296. ; ===========================================================================
  64297. ;loc_32574
  64298. Obj54_MainSubA:
  64299. tst.b objoff_39(a0)
  64300. beq.s +
  64301. subq.b #1,objoff_39(a0)
  64302. bra.s ++
  64303. ; ===========================================================================
  64304. +
  64305. move.b #-1,objoff_3A(a0)
  64306. +
  64307. cmpi.b #$27,objoff_33(a0)
  64308. blo.s +
  64309. subq.b #1,objoff_33(a0)
  64310. +
  64311. bsr.w Boss_MoveObject
  64312. cmpi.w #$420,(Boss_Y_pos).w
  64313. bhs.s +
  64314. move.w #0,(Boss_Y_vel).w
  64315. +
  64316. tst.b objoff_2C(a0)
  64317. bne.s BranchTo4_Obj54_MoveAndShow
  64318. tst.b objoff_3A(a0)
  64319. beq.s +
  64320. move.b #$80,objoff_3A(a0)
  64321. +
  64322. addq.b #2,angle(a0) ; => Obj54_MainSubC
  64323.  
  64324. BranchTo4_Obj54_MoveAndShow
  64325. bra.w Obj54_MoveAndShow
  64326. ; ===========================================================================
  64327. ;loc_325BE
  64328. Obj54_MainSubC:
  64329. tst.b objoff_3E(a0)
  64330. beq.s ++
  64331. tst.b objoff_3A(a0)
  64332. bne.s BranchTo5_Obj54_MoveAndShow
  64333. cmpi.b #$27,objoff_39(a0)
  64334. bhs.s +
  64335. addq.b #1,objoff_39(a0)
  64336. bra.s BranchTo5_Obj54_MoveAndShow
  64337. ; ===========================================================================
  64338. +
  64339. move.w #$100,(Boss_Y_vel).w
  64340. move.b #0,angle(a0) ; => Obj54_MainSub0
  64341. bclr #6,objoff_2B(a0)
  64342. bra.s BranchTo5_Obj54_MoveAndShow
  64343. ; ===========================================================================
  64344. +
  64345. move.w #-$180,(Boss_Y_vel).w
  64346. move.w #-$100,(Boss_X_vel).w
  64347. bclr #0,render_flags(a0)
  64348. btst #7,objoff_2B(a0)
  64349. beq.s +
  64350. move.w #$100,(Boss_X_vel).w
  64351. bset #0,render_flags(a0)
  64352. +
  64353. move.b #$E,angle(a0) ; => Obj54_MainSubE
  64354. move.b #0,objoff_2E(a0)
  64355. bclr #6,objoff_2B(a0)
  64356. move.b #0,objoff_2F(a0)
  64357.  
  64358. BranchTo5_Obj54_MoveAndShow
  64359. bra.w Obj54_MoveAndShow
  64360. ; ===========================================================================
  64361. ;loc_3262E
  64362. Obj54_MainSubE:
  64363. tst.b objoff_2F(a0)
  64364. beq.s +
  64365. subq.b #1,objoff_2F(a0)
  64366. bra.w Obj54_Display
  64367. ; ===========================================================================
  64368. +
  64369. moveq #0,d0
  64370. move.b objoff_2E(a0),d0
  64371. move.w off_3264A(pc,d0.w),d1
  64372. jmp off_3264A(pc,d1.w)
  64373. ; ===========================================================================
  64374. off_3264A: offsetTable
  64375. offsetTableEntry.w loc_32650 ; 0
  64376. offsetTableEntry.w loc_326B8 ; 2
  64377. offsetTableEntry.w loc_32704 ; 4
  64378. ; ===========================================================================
  64379.  
  64380. loc_32650:
  64381. bsr.w Boss_MoveObject
  64382. cmpi.w #$420,(Boss_Y_pos).w
  64383. bhs.s +
  64384. move.w #0,(Boss_Y_vel).w
  64385. +
  64386. btst #7,objoff_2B(a0)
  64387. bne.s +
  64388. cmpi.w #$2AF0,(Boss_X_pos).w
  64389. bhs.s BranchTo6_Obj54_MoveAndShow
  64390. addq.b #2,objoff_2E(a0)
  64391. move.w #$180,(Boss_Y_vel).w
  64392. move.b #3,objoff_2D(a0)
  64393. move.w #$1E,(Boss_Countdown).w
  64394. bset #0,render_flags(a0)
  64395. bra.s BranchTo6_Obj54_MoveAndShow
  64396. ; ===========================================================================
  64397. +
  64398. cmpi.w #$2BB0,(Boss_X_pos).w
  64399. blo.s BranchTo6_Obj54_MoveAndShow
  64400. addq.b #2,objoff_2E(a0)
  64401. move.w #$180,(Boss_Y_vel).w
  64402. move.b #3,objoff_2D(a0)
  64403. move.w #$1E,(Boss_Countdown).w
  64404. bclr #0,render_flags(a0)
  64405.  
  64406. BranchTo6_Obj54_MoveAndShow
  64407. bra.w Obj54_MoveAndShow
  64408. ; ===========================================================================
  64409.  
  64410. loc_326B8:
  64411. bsr.w Boss_MoveObject
  64412. cmpi.w #$4A0,(Boss_Y_pos).w
  64413. blo.s +
  64414. move.w #-$180,(Boss_Y_vel).w
  64415. addq.b #2,objoff_2E(a0)
  64416. bchg #7,objoff_2B(a0)
  64417. bra.s +++
  64418. ; ===========================================================================
  64419. +
  64420. btst #7,objoff_2B(a0)
  64421. bne.s +
  64422. cmpi.w #$2AD0,(Boss_X_pos).w
  64423. bhs.s ++
  64424. move.w #0,(Boss_X_vel).w
  64425. bra.s ++
  64426. ; ===========================================================================
  64427. +
  64428. cmpi.w #$2BD0,(Boss_X_pos).w
  64429. blo.s +
  64430. move.w #0,(Boss_X_vel).w
  64431. +
  64432. bsr.w Obj54_FireLaser
  64433. bra.w Obj54_MoveAndShow
  64434. ; ===========================================================================
  64435.  
  64436. loc_32704:
  64437. bsr.w Boss_MoveObject
  64438. cmpi.w #$470,(Boss_Y_pos).w
  64439. bhs.s +
  64440. move.w #$100,(Boss_X_vel).w
  64441. btst #7,objoff_2B(a0)
  64442. bne.s +
  64443. move.w #-$100,(Boss_X_vel).w
  64444. +
  64445. cmpi.w #$420,(Boss_Y_pos).w
  64446. bhs.s +
  64447. move.w #0,(Boss_Y_vel).w
  64448. move.b #0,objoff_2E(a0)
  64449. +
  64450. bsr.w Obj54_FireLaser
  64451. bra.w Obj54_MoveAndShow
  64452. ; ===========================================================================
  64453. ;loc_32740
  64454. Obj54_FireLaser:
  64455. subi_.w #1,(Boss_Countdown).w
  64456. bne.s + ; rts
  64457. tst.b objoff_2D(a0)
  64458. beq.s + ; rts
  64459. subq.b #1,objoff_2D(a0)
  64460. jsrto (SingleObjLoad).l, JmpTo17_SingleObjLoad
  64461. bne.s + ; rts
  64462. move.b #ObjID_MTZBoss,id(a1) ; load obj54
  64463. move.b #4,boss_subtype(a1) ; => Obj54_Laser
  64464. move.l a0,objoff_34(a1)
  64465. move.w #$1E,(Boss_Countdown).w
  64466. move.b #$10,objoff_2F(a0)
  64467. +
  64468. rts
  64469. ; ===========================================================================
  64470. ;loc_32774
  64471. Obj54_AlignSprites:
  64472. move.w x_pos(a0),d0
  64473. move.w y_pos(a0),d1
  64474. move.w d0,sub2_x_pos(a0)
  64475. move.w d1,sub2_y_pos(a0)
  64476. move.w d0,sub3_x_pos(a0)
  64477. move.w d1,sub3_y_pos(a0)
  64478. rts
  64479. ; ===========================================================================
  64480. ;loc_3278E
  64481. Obj54_AnimateFace:
  64482. bsr.w Obj54_CheckHit
  64483. cmpi.b #$3F,boss_invulnerable_time(a0)
  64484. bne.s ++
  64485. st.b objoff_38(a0)
  64486. lea (Boss_AnimationArray).w,a1
  64487. andi.b #$F0,2(a1)
  64488. ori.b #5,2(a1)
  64489. tst.b objoff_3E(a0)
  64490. beq.s +
  64491. move.b #$A,angle(a0) ; => Obj54_MainSubA
  64492. move.w #-$180,(Boss_Y_vel).w
  64493. subq.b #1,objoff_3E(a0)
  64494. move.w #0,(Boss_X_vel).w
  64495. +
  64496. move.w #0,(Boss_X_vel).w
  64497. rts
  64498. ; ===========================================================================
  64499. +
  64500. cmpi.b #4,(MainCharacter+routine).w
  64501. beq.s +
  64502. cmpi.b #4,(Sidekick+routine).w
  64503. bne.s ++ ; rts
  64504. +
  64505. lea (Boss_AnimationArray).w,a1
  64506. move.b 2(a1),d0
  64507. andi.b #$F,d0
  64508. cmpi.b #4,d0
  64509. beq.s + ; rts
  64510. andi.b #$F0,2(a1)
  64511. ori.b #4,2(a1)
  64512. +
  64513. rts
  64514. ; ===========================================================================
  64515. ;loc_32802
  64516. Obj54_MainSub10:
  64517. subq.w #1,(Boss_Countdown).w
  64518. cmpi.w #$3C,(Boss_Countdown).w
  64519. blo.s ++
  64520. bmi.s +
  64521. bsr.w Boss_LoadExplosion
  64522. lea (Boss_AnimationArray).w,a1
  64523. move.b #7,2(a1)
  64524. bra.s ++
  64525. ; ===========================================================================
  64526. +
  64527. bset #0,render_flags(a0)
  64528. clr.w (Boss_X_vel).w
  64529. clr.w (Boss_Y_vel).w
  64530. addq.b #2,angle(a0) ; => Obj54_MainSub12
  64531. move.w #-$12,(Boss_Countdown).w
  64532. lea (Boss_AnimationArray).w,a1
  64533. move.b #3,2(a1)
  64534. jsrto (PlayLevelMusic).l, JmpTo7_PlayLevelMusic
  64535. +
  64536. move.w (Boss_Y_pos).w,y_pos(a0)
  64537. move.w (Boss_X_pos).w,x_pos(a0)
  64538. lea (Ani_obj53).l,a1
  64539. bsr.w AnimateBoss
  64540. bsr.w Obj54_AlignSprites
  64541. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64542. ; ===========================================================================
  64543. ;loc_32864
  64544. Obj54_MainSub12:
  64545. move.w #$400,(Boss_X_vel).w
  64546. move.w #-$40,(Boss_Y_vel).w
  64547. cmpi.w #$2BF0,(Camera_Max_X_pos).w
  64548. bhs.s +
  64549. addq.w #2,(Camera_Max_X_pos).w
  64550. bra.s ++
  64551. ; ===========================================================================
  64552. +
  64553. tst.b render_flags(a0)
  64554. bpl.s JmpTo60_DeleteObject
  64555. +
  64556. tst.b (Boss_defeated_flag).w
  64557. bne.s +
  64558. move.b #1,(Boss_defeated_flag).w
  64559. jsrto (LoadPLC_AnimalExplosion).l, JmpTo7_LoadPLC_AnimalExplosion
  64560. +
  64561. bsr.w Boss_MoveObject
  64562. bsr.w loc_328C0
  64563. move.w (Boss_Y_pos).w,y_pos(a0)
  64564. move.w (Boss_X_pos).w,x_pos(a0)
  64565. lea (Ani_obj53).l,a1
  64566. bsr.w AnimateBoss
  64567. bsr.w Obj54_AlignSprites
  64568. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64569. ; ===========================================================================
  64570.  
  64571. JmpTo60_DeleteObject
  64572. jmp (DeleteObject).l
  64573. ; ===========================================================================
  64574.  
  64575. loc_328C0:
  64576. move.b mapping_frame(a0),d0
  64577. jsr (CalcSine).l
  64578. asr.w #6,d0
  64579. add.w (Boss_Y_pos).w,d0
  64580. move.w d0,y_pos(a0)
  64581. move.w (Boss_X_pos).w,x_pos(a0)
  64582. addq.b #2,mapping_frame(a0)
  64583. ;loc_328DE
  64584. Obj54_CheckHit:
  64585. cmpi.b #$10,angle(a0)
  64586. bhs.s return_32924
  64587. tst.b boss_hitcount2(a0)
  64588. beq.s Obj54_Defeated
  64589. tst.b collision_flags(a0)
  64590. bne.s return_32924
  64591. tst.b boss_invulnerable_time(a0)
  64592. bne.s +
  64593. move.b #$40,boss_invulnerable_time(a0)
  64594. move.w #SndID_BossHit,d0
  64595. jsr (PlaySound).l
  64596. +
  64597. lea (Normal_palette_line2+2).w,a1
  64598. moveq #0,d0
  64599. tst.w (a1)
  64600. bne.s +
  64601. move.w #$EEE,d0
  64602. +
  64603. move.w d0,(a1)
  64604. subq.b #1,boss_invulnerable_time(a0)
  64605. bne.s return_32924
  64606. move.b #$F,collision_flags(a0)
  64607.  
  64608. return_32924:
  64609. rts
  64610. ; ===========================================================================
  64611. ;loc_32926
  64612. Obj54_Defeated:
  64613. moveq #100,d0
  64614. jsrto (AddPoints).l, JmpTo8_AddPoints
  64615. move.w #$EF,(Boss_Countdown).w
  64616. move.b #$10,angle(a0) ; => Obj54_MainSub10
  64617. moveq #PLCID_Capsule,d0
  64618. jsrto (LoadPLC).l, JmpTo11_LoadPLC
  64619. rts
  64620. ; ===========================================================================
  64621. ; ----------------------------------------------------------------------------
  64622. ; Object 53 - Shield orbs that surround MTZ boss
  64623. ; ----------------------------------------------------------------------------
  64624. ; Sprite_32940:
  64625. Obj53:
  64626. moveq #0,d0
  64627. move.b routine(a0),d0
  64628. move.w Obj53_Index(pc,d0.w),d1
  64629. jmp Obj53_Index(pc,d1.w)
  64630. ; ===========================================================================
  64631. ; off_3294E:
  64632. Obj53_Index: offsetTable
  64633. offsetTableEntry.w Obj53_Init ; 0
  64634. offsetTableEntry.w Obj53_Main ; 2
  64635. offsetTableEntry.w Obj53_BreakAway ; 4
  64636. offsetTableEntry.w Obj53_BounceAround ; 6
  64637. offsetTableEntry.w Obj53_Burst ; 8
  64638. ; ===========================================================================
  64639. ; loc_32958:
  64640. Obj53_Init:
  64641. movea.l a0,a1
  64642. moveq #6,d3
  64643. moveq #0,d2
  64644. bra.s +
  64645. ; ===========================================================================
  64646. - jsrto (SingleObjLoad).l, JmpTo17_SingleObjLoad
  64647. bne.s ++
  64648. +
  64649. move.b #$20,width_pixels(a1)
  64650. move.l objoff_34(a0),objoff_34(a1)
  64651. move.b #ObjID_MTZBossOrb,id(a1) ; load obj53
  64652. move.l #Obj54_MapUnc_32DC6,mappings(a1)
  64653. move.w #make_art_tile(ArtTile_ArtNem_MTZBoss,0,0),art_tile(a1)
  64654. ori.b #4,render_flags(a1)
  64655. move.b #3,priority(a1)
  64656. addq.b #2,routine(a1) ; => Obj53_Main
  64657. move.b #5,mapping_frame(a1)
  64658. move.b byte_329CC(pc,d2.w),objoff_28(a1)
  64659. move.b byte_329CC(pc,d2.w),objoff_3B(a1)
  64660. move.b byte_329D3(pc,d2.w),objoff_3A(a1)
  64661. move.b #$40,objoff_29(a1)
  64662. move.b #$87,collision_flags(a1)
  64663. move.b #2,collision_property(a1)
  64664. move.b #0,objoff_3C(a1)
  64665. addq.w #1,d2
  64666. dbf d3,-
  64667. +
  64668. rts
  64669. ; ===========================================================================
  64670. byte_329CC:
  64671. dc.b $24
  64672. dc.b $6C ; 1
  64673. dc.b $B4 ; 2
  64674. dc.b $FC ; 3
  64675. dc.b $48 ; 4
  64676. dc.b $90 ; 5
  64677. dc.b $D8 ; 6
  64678. rev02even
  64679. byte_329D3:
  64680. dc.b 0
  64681. dc.b 1 ; 1
  64682. dc.b 1 ; 2
  64683. dc.b 0 ; 3
  64684. dc.b 1 ; 4
  64685. dc.b 1 ; 5
  64686. dc.b 0 ; 6
  64687. even
  64688. ; ===========================================================================
  64689. ;loc_329DA
  64690. Obj53_Main:
  64691. movea.l objoff_34(a0),a1 ; a1=object
  64692. move.w y_pos(a1),objoff_2A(a0)
  64693. subi_.w #4,objoff_2A(a0)
  64694. move.w x_pos(a1),objoff_38(a0)
  64695. tst.b objoff_38(a1)
  64696. beq.s Obj53_ClearBossCollision
  64697. move.b #0,objoff_38(a1)
  64698. addi_.b #1,objoff_2C(a1)
  64699. addq.b #2,routine(a0) ; => Obj53_BreakAway
  64700. move.b #$3C,objoff_32(a0)
  64701. move.b #2,anim(a0)
  64702. move.w #-$400,y_vel(a0)
  64703. move.w #-$80,d1
  64704. move.w (MainCharacter+x_pos).w,d0
  64705. sub.w x_pos(a0),d0
  64706. bpl.s +
  64707. neg.w d1
  64708. +
  64709. cmpi.w #$2AF0,x_pos(a0)
  64710. bhs.s +
  64711. move.w #$80,d1
  64712. +
  64713. cmpi.w #$2BB0,x_pos(a0)
  64714. blo.s +
  64715. move.w #-$80,d1
  64716. +
  64717. bclr #0,render_flags(a0)
  64718. tst.w d1
  64719. bmi.s +
  64720. bset #0,render_flags(a0)
  64721. +
  64722. move.w d1,x_vel(a0)
  64723. bra.s +
  64724. ; ===========================================================================
  64725. ;loc_32A56
  64726. Obj53_ClearBossCollision:
  64727. cmpi.b #2,collision_property(a0)
  64728. beq.s +
  64729. move.b #0,collision_flags(a1)
  64730. +
  64731. bsr.w Obj53_OrbitBoss
  64732. bsr.w Obj53_SetAnimPriority
  64733. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64734. ; ===========================================================================
  64735. ;loc_32A70
  64736. Obj53_OrbitBoss:
  64737. move.b objoff_29(a0),d0
  64738. jsr (CalcSine).l
  64739. move.w d0,d3
  64740. moveq #0,d1
  64741. move.b objoff_33(a1),d1
  64742. muls.w d1,d0
  64743. move.w d0,d5
  64744. move.w d0,d4
  64745. move.b objoff_39(a1),d2
  64746. tst.b objoff_3A(a1)
  64747. beq.s +
  64748. move.w #$10,d2
  64749. +
  64750. muls.w d3,d2
  64751. move.w objoff_38(a0),d6
  64752. move.b objoff_28(a0),d0
  64753. jsr (CalcSine).l
  64754. muls.w d0,d5
  64755. swap d5
  64756. add.w d6,d5
  64757. move.w d5,x_pos(a0)
  64758. muls.w d1,d4
  64759. swap d4
  64760. move.w d4,objoff_30(a0)
  64761. move.w objoff_2A(a0),d6
  64762. move.b objoff_3B(a0),d0
  64763. tst.b objoff_3A(a1)
  64764. beq.s +
  64765. move.b objoff_3C(a0),d0
  64766. +
  64767. jsr (CalcSine).l
  64768. muls.w d0,d2
  64769. swap d2
  64770. add.w d6,d2
  64771. move.w d2,y_pos(a0)
  64772. addq.b #4,objoff_28(a0)
  64773. tst.b objoff_3A(a1)
  64774. bne.s +
  64775. addq.b #8,objoff_3B(a0)
  64776. rts
  64777. ; ===========================================================================
  64778. +
  64779. cmpi.b #-1,objoff_3A(a1)
  64780. beq.s ++
  64781. cmpi.b #$80,objoff_3A(a1)
  64782. bne.s +
  64783. subq.b #2,objoff_3C(a0)
  64784. bpl.s return_32B18
  64785. clr.b objoff_3C(a0)
  64786. +
  64787. move.b #0,objoff_3A(a1)
  64788. rts
  64789. ; ===========================================================================
  64790. +
  64791. cmpi.b #$40,objoff_3C(a0)
  64792. bhs.s return_32B18
  64793. addq.b #2,objoff_3C(a0)
  64794.  
  64795. return_32B18:
  64796. rts
  64797. ; ===========================================================================
  64798. ;loc_32B1A
  64799. Obj53_SetAnimPriority:
  64800. move.w objoff_30(a0),d0
  64801. bmi.s ++
  64802. cmpi.w #$C,d0
  64803. blt.s +
  64804. move.b #3,mapping_frame(a0)
  64805. move.b #1,priority(a0)
  64806. rts
  64807. ; ===========================================================================
  64808. +
  64809. move.b #4,mapping_frame(a0)
  64810. move.b #2,priority(a0)
  64811. rts
  64812. ; ===========================================================================
  64813. +
  64814. cmpi.w #-$C,d0
  64815. blt.s +
  64816. move.b #4,mapping_frame(a0)
  64817. move.b #6,priority(a0)
  64818. rts
  64819. ; ===========================================================================
  64820. +
  64821. move.b #5,mapping_frame(a0)
  64822. move.b #7,priority(a0)
  64823. rts
  64824. ; ===========================================================================
  64825. ;loc_32B64
  64826. Obj53_BreakAway:
  64827. tst.b objoff_32(a0)
  64828. bmi.s +
  64829. subq.b #1,objoff_32(a0)
  64830. bpl.s +
  64831. move.b #$DA,collision_flags(a0)
  64832. +
  64833. jsrto (ObjectMoveAndFall).l, JmpTo6_ObjectMoveAndFall
  64834. subi.w #$20,y_vel(a0)
  64835. cmpi.w #$180,y_vel(a0)
  64836. blt.s +
  64837. move.w #$180,y_vel(a0)
  64838. +
  64839. cmpi.w #$4AC,y_pos(a0)
  64840. blo.s Obj53_Animate
  64841. move.w #$4AC,y_pos(a0)
  64842. move.w #$4AC,objoff_2E(a0)
  64843. move.b #1,objoff_2C(a0)
  64844. addq.b #2,routine(a0)
  64845. bsr.w Obj53_FaceLeader
  64846. ;loc_32BB0
  64847. Obj53_Animate:
  64848. bsr.w +
  64849. lea (Ani_obj53).l,a1
  64850. jsrto (AnimateSprite).l, JmpTo21_AnimateSprite
  64851. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64852. ; ===========================================================================
  64853. +
  64854. cmpi.b #-2,collision_property(a0)
  64855. bgt.s + ; rts
  64856. move.b #$14,mapping_frame(a0)
  64857. move.b #6,anim(a0)
  64858. addq.b #2,routine(a0)
  64859. +
  64860. rts
  64861. ; ===========================================================================
  64862. ;loc_32BDC
  64863. Obj53_BounceAround:
  64864. tst.b objoff_32(a0)
  64865. bmi.s +
  64866. subq.b #1,objoff_32(a0)
  64867. bpl.s +
  64868. move.b #$DA,collision_flags(a0)
  64869. +
  64870. bsr.w Obj53_CheckPlayerHit
  64871. cmpi.b #$B,mapping_frame(a0)
  64872. bne.s Obj53_Animate
  64873. move.b objoff_2C(a0),d0
  64874. jsr (CalcSine).l
  64875. neg.w d0
  64876. asr.w #2,d0
  64877. add.w objoff_2E(a0),d0
  64878. cmpi.w #$4AC,d0
  64879. bhs.s ++
  64880. move.w d0,y_pos(a0)
  64881. addq.b #1,objoff_2C(a0)
  64882. btst #0,objoff_2C(a0)
  64883. beq.w JmpTo40_DisplaySprite
  64884. moveq #-1,d0
  64885. btst #0,render_flags(a0)
  64886. beq.s +
  64887. neg.w d0
  64888. +
  64889. add.w d0,x_pos(a0)
  64890. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64891. ; ===========================================================================
  64892. +
  64893. move.w #$4AC,y_pos(a0)
  64894. bsr.w Obj53_FaceLeader
  64895. move.b #1,objoff_2C(a0)
  64896. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64897. ; ===========================================================================
  64898. ;loc_32C4C
  64899. Obj53_FaceLeader:
  64900. move.w (MainCharacter+x_pos).w,d0
  64901. sub.w x_pos(a0),d0
  64902. bpl.s +
  64903. bclr #0,render_flags(a0)
  64904. rts
  64905. ; ===========================================================================
  64906. +
  64907. bset #0,render_flags(a0)
  64908. rts
  64909. ; ===========================================================================
  64910. ;loc_32C66
  64911. Obj53_CheckPlayerHit:
  64912. cmpi.b #4,(MainCharacter+routine).w
  64913. beq.s +
  64914. cmpi.b #4,(Sidekick+routine).w
  64915. bne.s ++
  64916. +
  64917. move.b #$14,mapping_frame(a0)
  64918. move.b #6,anim(a0)
  64919. +
  64920. cmpi.b #-2,collision_property(a0)
  64921. bgt.s +
  64922. move.b #$14,mapping_frame(a0)
  64923. move.b #6,anim(a0)
  64924. +
  64925. rts
  64926. ; ===========================================================================
  64927. ;loc_32C98
  64928. Obj53_Burst:
  64929. move.b #SndID_BossExplosion,d0
  64930. jsrto (PlaySound).l, JmpTo10_PlaySound
  64931. movea.l objoff_34(a0),a1 ; a1=object
  64932. subi_.b #1,objoff_2C(a1)
  64933.  
  64934. if removeJmpTos
  64935. JmpTo61_DeleteObject
  64936. endif
  64937.  
  64938. jmpto (DeleteObject).l, JmpTo61_DeleteObject
  64939. ; ===========================================================================
  64940. ;loc_32CAE
  64941. Obj54_Laser:
  64942. moveq #0,d0
  64943. move.b routine_secondary(a0),d0
  64944. move.w off_32CBC(pc,d0.w),d0
  64945. jmp off_32CBC(pc,d0.w)
  64946. ; ===========================================================================
  64947. off_32CBC: offsetTable
  64948. offsetTableEntry.w Obj54_Laser_Init ; 0
  64949. offsetTableEntry.w Obj54_Laser_Main ; 2
  64950. ; ===========================================================================
  64951. ;loc_32CC0
  64952. Obj54_Laser_Init:
  64953. move.l #Obj54_MapUnc_32DC6,mappings(a0)
  64954. move.w #make_art_tile(ArtTile_ArtNem_MTZBoss,0,0),art_tile(a0)
  64955. ori.b #4,render_flags(a0)
  64956. move.b #5,priority(a0)
  64957. move.b #$12,mapping_frame(a0)
  64958. addq.b #2,routine_secondary(a0) ; => Obj54_Laser_Main
  64959. movea.l objoff_34(a0),a1 ; a1=object
  64960. move.b #$50,width_pixels(a0)
  64961. move.w x_pos(a1),x_pos(a0)
  64962. move.w y_pos(a1),y_pos(a0)
  64963. addi_.w #7,y_pos(a0)
  64964. subi_.w #4,x_pos(a0)
  64965. move.w #-$400,d0
  64966. btst #0,render_flags(a1)
  64967. beq.s +
  64968. neg.w d0
  64969. addi_.w #8,x_pos(a0)
  64970. +
  64971. move.w d0,x_vel(a0)
  64972. move.b #$99,collision_flags(a0)
  64973. move.b #SndID_LaserBurst,d0
  64974. jsrto (PlaySound).l, JmpTo10_PlaySound
  64975. ;loc_32D2C
  64976. Obj54_Laser_Main:
  64977. jsrto (ObjectMove).l, JmpTo24_ObjectMove
  64978. cmpi.w #$2AB0,x_pos(a0)
  64979. blo.w JmpTo61_DeleteObject
  64980. cmpi.w #$2BF0,x_pos(a0)
  64981. bhs.w JmpTo61_DeleteObject
  64982. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  64983. ; ===========================================================================
  64984. ;loc_32D48
  64985. Obj54_LaserShooter:
  64986. movea.l objoff_34(a0),a1 ; a1=object
  64987. cmpi.b #ObjID_MTZBoss,id(a1)
  64988. bne.w JmpTo61_DeleteObject
  64989. move.w x_pos(a1),x_pos(a0)
  64990. move.w y_pos(a1),y_pos(a0)
  64991. bclr #0,render_flags(a0)
  64992. btst #0,render_flags(a1)
  64993. beq.w JmpTo40_DisplaySprite
  64994. bset #0,render_flags(a0)
  64995.  
  64996. if removeJmpTos
  64997. JmpTo40_DisplaySprite
  64998. endif
  64999.  
  65000. jmpto (DisplaySprite).l, JmpTo40_DisplaySprite
  65001. ; ===========================================================================
  65002. ; animation script
  65003. ; off_32D7A:
  65004. Ani_obj53: offsetTable
  65005. offsetTableEntry.w byte_32D8A ; 0
  65006. offsetTableEntry.w byte_32D8D ; 1
  65007. offsetTableEntry.w byte_32D91 ; 2
  65008. offsetTableEntry.w byte_32DA6 ; 3
  65009. offsetTableEntry.w byte_32DAA ; 4
  65010. offsetTableEntry.w byte_32DB5 ; 5
  65011. offsetTableEntry.w byte_32DC0 ; 6
  65012. offsetTableEntry.w byte_32DC3 ; 7
  65013. byte_32D8A: dc.b $F, 2,$FF
  65014. rev02even
  65015. byte_32D8D: dc.b 1, 0, 1,$FF
  65016. rev02even
  65017. byte_32D91: dc.b 3, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 6, 7, 6, 7, 8
  65018. dc.b 9, $A, $B,$FE, 1; 16
  65019. rev02even
  65020. byte_32DA6: dc.b 7, $C, $D,$FF
  65021. rev02even
  65022. byte_32DAA: dc.b 7, $E, $F, $E, $F, $E, $F, $E, $F,$FD, 3
  65023. rev02even
  65024. byte_32DB5: dc.b 7,$10,$10,$10,$10,$10,$10,$10,$10,$FD, 3
  65025. rev02even
  65026. byte_32DC0: dc.b 1,$14,$FC
  65027. rev02even
  65028. byte_32DC3: dc.b 7,$11,$FF
  65029. even
  65030. ; ----------------------------------------------------------------------------
  65031. ; sprite mappings
  65032. ; ----------------------------------------------------------------------------
  65033. Obj54_MapUnc_32DC6: BINCLUDE "mappings/sprite/obj54.bin"
  65034.  
  65035. if ~~removeJmpTos
  65036. align 4
  65037. endif
  65038. ; ===========================================================================
  65039.  
  65040. if ~~removeJmpTos
  65041. JmpTo40_DisplaySprite
  65042. jmp (DisplaySprite).l
  65043. JmpTo61_DeleteObject
  65044. jmp (DeleteObject).l
  65045. JmpTo17_SingleObjLoad
  65046. jmp (SingleObjLoad).l
  65047. JmpTo10_PlaySound
  65048. jmp (PlaySound).l
  65049. JmpTo21_AnimateSprite
  65050. jmp (AnimateSprite).l
  65051. JmpTo11_LoadPLC
  65052. jmp (LoadPLC).l
  65053. JmpTo8_AddPoints
  65054. jmp (AddPoints).l
  65055. JmpTo7_PlayLevelMusic
  65056. jmp (PlayLevelMusic).l
  65057. JmpTo7_LoadPLC_AnimalExplosion
  65058. jmp (LoadPLC_AnimalExplosion).l
  65059. JmpTo6_ObjectMoveAndFall
  65060. jmp (ObjectMoveAndFall).l
  65061. ; loc_32F88:
  65062. JmpTo24_ObjectMove
  65063. jmp (ObjectMove).l
  65064.  
  65065. align 4
  65066. endif
  65067.  
  65068.  
  65069.  
  65070.  
  65071. ; ===========================================================================
  65072. ; ----------------------------------------------------------------------------
  65073. ; Object 55 - OOZ boss
  65074. ; ----------------------------------------------------------------------------
  65075. ; OST Variables:
  65076. Obj55_status = objoff_2A ; bitfield
  65077. Obj55_anim_frame_duration = objoff_2C ; number of frames the laser shooter displays its shooting frame
  65078. Obj55_shot_count = objoff_38 ; number of lasers the shooter fires during its attack phase
  65079. Obj55_laser_pos = objoff_3E ; bitfield, each of the first four bits stands for one of the possible y positions a laser can be fired from
  65080.  
  65081. Obj55_Wave_delay = objoff_32 ; time before the next part of the wave is created
  65082. Obj55_Wave_parent = objoff_34 ; pointer to main vehicle
  65083. Obj55_Wave_count = objoff_36 ; number of waves to make
  65084.  
  65085. ; Sprite_32F90:
  65086. Obj55:
  65087. moveq #0,d0
  65088. move.b boss_subtype(a0),d0
  65089. move.w Obj55_Index(pc,d0.w),d1
  65090. jmp Obj55_Index(pc,d1.w)
  65091. ; ===========================================================================
  65092. ; off_32F9E:
  65093. Obj55_Index: offsetTable
  65094. offsetTableEntry.w Obj55_Init ; 0 - Init
  65095. offsetTableEntry.w Obj55_Main ; 2 - Main Vehicle
  65096. offsetTableEntry.w Obj55_LaserShooter ; 4 - Laser Shooter
  65097. offsetTableEntry.w Obj55_SpikeChain ; 6 - Spiked Chain
  65098. offsetTableEntry.w Obj55_Laser ; 8 - Laser
  65099. ; ===========================================================================
  65100. ; loc_32FA8:
  65101. Obj55_Init:
  65102. move.l #Obj55_MapUnc_33756,mappings(a0)
  65103. move.w #make_art_tile(ArtTile_ArtNem_OOZBoss,0,0),art_tile(a0)
  65104. ori.b #4,render_flags(a0)
  65105. move.b #3,priority(a0)
  65106. bset #6,render_flags(a0) ; object consists of multiple sprites
  65107. move.b #0,mainspr_childsprites(a0)
  65108. addq.b #2,boss_subtype(a0) ; => Obj55_Main
  65109. move.b #$F,collision_flags(a0)
  65110. move.b #8,boss_hitcount2(a0)
  65111. move.b #$40,mainspr_width(a0)
  65112. rts
  65113. ; ===========================================================================
  65114. ; loc_32FE6:
  65115. Obj55_Main:
  65116. moveq #0,d0
  65117. move.b boss_routine(a0),d0
  65118. move.w Obj55_Main_Index(pc,d0.w),d1
  65119. jmp Obj55_Main_Index(pc,d1.w)
  65120. ; ===========================================================================
  65121. ; off_32FF4:
  65122. Obj55_Main_Index: offsetTable
  65123. offsetTableEntry.w Obj55_Main_Init ; 0 - boss' initial state
  65124. offsetTableEntry.w Obj55_Main_Surface ; 2 - moving up
  65125. offsetTableEntry.w Obj55_Main_Wait ; 4 - stay in place for a while
  65126. offsetTableEntry.w Obj55_Main_Dive ; 6 - moving down
  65127. offsetTableEntry.w Obj55_Main_Defeated ; 8 - boss defeated and escaping
  65128. ; ===========================================================================
  65129. ; loc_32FFE:
  65130. Obj55_Main_Init:
  65131. move.w #$2940,(Boss_X_pos).w
  65132. bclr #0,render_flags(a0) ; face right
  65133. move.w (MainCharacter+x_pos).w,d1
  65134. cmpi.w #$293A,d1 ; is player on the left side of the arena?
  65135. bhs.s + ; if not, branch
  65136. bchg #0,render_flags(a0) ; face left
  65137. +
  65138. move.w #$2D0,y_pos(a0)
  65139. move.w #$2D0,(Boss_Y_pos).w
  65140. move.b #8,mainspr_mapframe(a0)
  65141. move.b #1,mainspr_childsprites(a0)
  65142. addq.b #2,boss_routine(a0) ; => Obj55_Main_Surface
  65143. move.w #-$80,(Boss_Y_vel).w
  65144. move.b #$F,collision_flags(a0)
  65145. move.w x_pos(a0),sub2_x_pos(a0)
  65146. move.w y_pos(a0),sub2_y_pos(a0)
  65147. clr.b boss_sine_count(a0)
  65148. clr.b Obj55_status(a0)
  65149. move.b #8,sub2_mapframe(a0)
  65150. lea (Boss_AnimationArray).w,a2
  65151. move.b #5,(a2)+
  65152. move.b #0,(a2)+
  65153. move.b #1,(a2)+
  65154. move.b #0,(a2)
  65155. move.b #0,(Boss_CollisionRoutine).w
  65156. rts
  65157. ; ===========================================================================
  65158. ; loc_33078:
  65159. Obj55_Main_Surface:
  65160. bsr.w Boss_MoveObject
  65161. move.w (Boss_X_pos).w,x_pos(a0)
  65162. bsr.w Obj55_HoverPos
  65163. cmpi.w #$290,(Boss_Y_pos).w ; has boss reached its target position?
  65164. bhs.w Obj55_Main_End ; if not, branch
  65165. move.w #$290,(Boss_Y_pos).w
  65166. addq.b #2,boss_routine(a0) ; => Obj55_Main_Wait
  65167. move.w #$A8,(Boss_Countdown).w
  65168. btst #7,Obj55_status(a0) ; was boss hit?
  65169. bne.w Obj55_Main_End ; if yes, branch
  65170. lea (Boss_AnimationArray).w,a2
  65171. move.b #$10,(a2)+
  65172. move.b #0,(a2)
  65173. bra.w Obj55_Main_End
  65174. ; ===========================================================================
  65175. ; loc_330BA:
  65176. Obj55_Main_Wait:
  65177. btst #7,Obj55_status(a0) ; was boss hit?
  65178. bne.s + ; if yes, branch
  65179. bsr.w Obj55_HoverPos
  65180. subi_.w #1,(Boss_Countdown).w ; hover in place for a while
  65181. bpl.w Obj55_Main_End
  65182. lea (Boss_AnimationArray).w,a2
  65183. move.b #5,(a2)+
  65184. move.b #0,(a2)
  65185. +
  65186. addq.b #2,boss_routine(a0) ; => Obj55_Main_Dive
  65187. move.w #-$40,(Boss_Y_vel).w ; bob up a little before diving
  65188. bra.w Obj55_Main_End
  65189. ; ===========================================================================
  65190. ; does the hovering effect
  65191. ; loc_330EA:
  65192. Obj55_HoverPos:
  65193. move.b boss_sine_count(a0),d0
  65194. jsr (CalcSine).l
  65195. asr.w #7,d1
  65196. add.w (Boss_Y_pos).w,d1
  65197. move.w d1,y_pos(a0)
  65198. addq.b #4,boss_sine_count(a0)
  65199. rts
  65200. ; ===========================================================================
  65201. ; loc_33104:
  65202. Obj55_Main_Dive:
  65203. bsr.w Boss_MoveObject
  65204. move.w (Boss_Y_pos).w,y_pos(a0)
  65205. move.w (Boss_X_pos).w,x_pos(a0)
  65206. btst #6,Obj55_status(a0) ; is boss done rising?
  65207. bne.s Obj55_Main_Dive_Part2 ; if yes, branch
  65208. cmpi.w #$28C,(Boss_Y_pos).w ; has boss reached initial destination (rising before diving)?
  65209. bhs.w Obj55_Main_End ; if not, branch
  65210. move.w #$28C,(Boss_Y_pos).w
  65211. move.w #$80,(Boss_Y_vel).w
  65212. ori.b #$40,Obj55_status(a0) ; set diving bit
  65213. bra.w Obj55_Main_End
  65214. ; ===========================================================================
  65215. ; loc_3313C:
  65216. Obj55_Main_Dive_Part2:
  65217. cmpi.w #$2D0,(Boss_Y_pos).w ; has boss reached its target position?
  65218. blo.s Obj55_Main_End ; if yes, branch
  65219. move.w #$2D0,(Boss_Y_pos).w
  65220. clr.b boss_routine(a0)
  65221. addq.b #2,boss_subtype(a0) ; => Obj55_LaserShooter
  65222. btst #7,Obj55_status(a0) ; was boss hit?
  65223. beq.s Obj55_Main_End ; if not, branch
  65224. addq.b #2,boss_subtype(a0) ; => Obj55_SpikeChain
  65225.  
  65226. ; loc_3315E:
  65227. Obj55_Main_End:
  65228. bsr.w Obj55_HandleHits
  65229. lea (Ani_obj55).l,a1
  65230. bsr.w AnimateBoss
  65231. bsr.w Obj55_AlignSprites
  65232. jmpto (DisplaySprite).l, JmpTo41_DisplaySprite
  65233. ; ===========================================================================
  65234. ; loc_33174:
  65235. Obj55_HandleHits:
  65236. bsr.w Boss_HandleHits
  65237. cmpi.b #$1F,boss_invulnerable_time(a0)
  65238. bne.s return_33192
  65239. lea (Boss_AnimationArray).w,a1
  65240. andi.b #$F0,(a1)
  65241. ori.b #3,(a1)
  65242. ori.b #$80,Obj55_status(a0) ; set boss hit bit
  65243.  
  65244. return_33192:
  65245. rts
  65246. ; ===========================================================================
  65247. ; loc_33194:
  65248. Obj55_AlignSprites:
  65249. move.w x_pos(a0),d0
  65250. move.w y_pos(a0),d1
  65251. move.w d0,sub2_x_pos(a0)
  65252. move.w d1,sub2_y_pos(a0)
  65253. rts
  65254. ; ===========================================================================
  65255. ; loc_331A6:
  65256. Obj55_Main_Defeated:
  65257. clr.w (Normal_palette_line2+2).w ; set color to black
  65258. subq.w #1,(Boss_Countdown).w ; wait for a while
  65259. bmi.s Obj55_Main_Defeated_Part2 ; branch, if wait is over
  65260. cmpi.w #$1E,(Boss_Countdown).w ; has boss waited for a certain ammount of time?
  65261. bhs.s Obj55_Explode ; if not, branch
  65262. move.b #$B,mainspr_mapframe(a0) ; use defeated animation
  65263. jmpto (DisplaySprite).l, JmpTo41_DisplaySprite
  65264. ; ===========================================================================
  65265. ; loc_331C2:
  65266. Obj55_Explode:
  65267. bsr.w Boss_LoadExplosion
  65268. jmpto (DisplaySprite).l, JmpTo41_DisplaySprite
  65269. ; ===========================================================================
  65270. ; loc_331CA:
  65271. Obj55_Main_Defeated_Part2:
  65272. tst.b (Boss_defeated_flag).w ; has boss been defeated?
  65273. bne.s Obj55_ReleaseCamera ; if yes, branch
  65274. jsrto (PlayLevelMusic).l, JmpTo8_PlayLevelMusic
  65275. jsrto (LoadPLC_AnimalExplosion).l, JmpTo8_LoadPLC_AnimalExplosion
  65276. move.b #1,(Boss_defeated_flag).w
  65277.  
  65278. ; loc_331DE:
  65279. Obj55_ReleaseCamera:
  65280. cmpi.w #$2A20,(Camera_Max_X_pos).w ; has camera reached its destination?
  65281. bhs.s Obj55_ChkDelete ; if yes, branch
  65282. addq.w #2,(Camera_Max_X_pos).w ; else, move camera some more
  65283. bra.s Obj55_Defeated_Sink
  65284. ; ===========================================================================
  65285. ; loc_331EC:
  65286. Obj55_ChkDelete:
  65287. move.w #$2A20,(Camera_Max_X_pos).w
  65288. cmpi.w #$2D0,y_pos(a0) ; has boss reached its target position?
  65289. bhs.s BranchTo_JmpTo62_DeleteObject ; if yes, branch
  65290.  
  65291. ; loc_331FA:
  65292. Obj55_Defeated_Sink:
  65293. addi_.w #1,y_pos(a0)
  65294. bsr.s Obj55_AlignSprites
  65295. jmpto (DisplaySprite).l, JmpTo41_DisplaySprite
  65296. ; ===========================================================================
  65297. if removeJmpTos
  65298. JmpTo62_DeleteObject
  65299. endif
  65300.  
  65301. BranchTo_JmpTo62_DeleteObject
  65302. jmpto (DeleteObject).l, JmpTo62_DeleteObject
  65303. ; ===========================================================================
  65304. ; loc_3320A:
  65305. Obj55_LaserShooter:
  65306. moveq #0,d0
  65307. move.b boss_routine(a0),d0
  65308. move.w Obj55_LaserShooter_Index(pc,d0.w),d1
  65309. jmp Obj55_LaserShooter_Index(pc,d1.w)
  65310. ; ===========================================================================
  65311. ; off_33218:
  65312. Obj55_LaserShooter_Index: offsetTable
  65313. offsetTableEntry.w Obj55_LaserShooter_Init ; 0 - laser shooter's initial state
  65314. offsetTableEntry.w Obj55_LaserShooter_Rise ; 2 - moving up
  65315. offsetTableEntry.w Obj55_LaserShooter_ChooseTarget ; 4 - stay in place for a while
  65316. offsetTableEntry.w Obj55_LaserShooter_Aim ; 6 - move towards target and shoot
  65317. offsetTableEntry.w Obj55_LaserShooter_Lower ; 8 - moving down
  65318. ; ===========================================================================
  65319. ; loc_33222:
  65320. Obj55_LaserShooter_Init:
  65321. clr.w (Normal_palette_line2+2).w ; reset palette flash
  65322. move.w #$2940,(Boss_X_pos).w
  65323. bclr #0,render_flags(a0)
  65324. move.w (MainCharacter+x_pos).w,d1
  65325. cmpi.w #$293A,d1 ; is player left from center?
  65326. blo.s + ; if yes, branch
  65327. bchg #0,render_flags(a0)
  65328. +
  65329. move.w #$2B0,(Boss_Y_pos).w
  65330. move.w #$2B0,y_pos(a0)
  65331. move.b #2,boss_routine(a0) ; => Obj55_LaserShooter_Rise
  65332. move.b #$8A,collision_flags(a0)
  65333. move.b #5,mainspr_mapframe(a0)
  65334. moveq #7,d0
  65335. moveq #7,d2
  65336. moveq #0,d4
  65337. move.w (Boss_Y_pos).w,d5
  65338.  
  65339. - ; initialize chain
  65340. addi.w #$F,d5
  65341. move.b d0,sub2_mapframe(a0,d4.w)
  65342. move.w d5,sub2_y_pos(a0,d4.w)
  65343. addq.w #next_subspr,d4
  65344. dbf d2,-
  65345.  
  65346. move.b #8,mainspr_childsprites(a0)
  65347. move.w #-$80,(Boss_Y_vel).w
  65348. move.b #0,Obj55_laser_pos(a0)
  65349. move.b #1,(Boss_CollisionRoutine).w
  65350. rts
  65351. ; ===========================================================================
  65352. ; loc_33296:
  65353. Obj55_LaserShooter_Rise:
  65354. bsr.w Boss_MoveObject
  65355. cmpi.w #$240,(Boss_Y_pos).w ; has laser shooter reached its destination?
  65356. bhs.w Obj55_LaserShooter_End ; if not, branch
  65357. move.w #$240,(Boss_Y_pos).w
  65358. move.w #0,(Boss_Y_vel).w
  65359. addi_.b #2,boss_routine(a0) ; => Obj55_LaserShooter_ChooseTarget
  65360. move.w #$80,(Boss_Countdown).w
  65361. move.b #3,Obj55_shot_count(a0) ; prepare to shoot 3 lasers
  65362. bra.w Obj55_LaserShooter_End
  65363. ; ===========================================================================
  65364. ; loc_332C6:
  65365. Obj55_LaserShooter_ChooseTarget:
  65366. subq.b #1,Obj55_anim_frame_duration(a0) ; is firing animation finished?
  65367. bne.s + ; if not, branch
  65368. move.b #5,mainspr_mapframe(a0) ; reset animation frame to not firing
  65369. +
  65370. subi_.w #1,(Boss_Countdown).w ; wait for a while
  65371. bne.w Obj55_LaserShooter_End ; branch, as long as wait isn't over
  65372. subi_.b #1,Obj55_shot_count(a0) ; decrement number of shots left
  65373. bmi.s Obj55_LaserShooter_DoneShooting ; branch, if no shots left
  65374. jsrto (RandomNumber).l, JmpTo5_RandomNumber
  65375.  
  65376. - ; find first valid firing position
  65377. addq.b #1,d0 ; next position
  65378. andi.w #3,d0 ; limit to 4 possible values
  65379. btst d0,Obj55_laser_pos(a0) ; was a laser already shot in this position?
  65380. bne.s - ; if yes, branch
  65381.  
  65382. bset d0,Obj55_laser_pos(a0) ; set posion as used
  65383. add.w d0,d0
  65384. move.w Obj55_LaserTargets(pc,d0.w),(Boss_Countdown).w ; set target positon
  65385. addq.b #2,boss_routine(a0) ; => Obj55_LaserShooter_Aim
  65386. bsr.w Obj55_MoveTowardTarget
  65387. bra.w Obj55_LaserShooter_End
  65388. ; ===========================================================================
  65389. ; loc_3330C:
  65390. Obj55_LaserShooter_DoneShooting:
  65391. move.w #$80,(Boss_Y_vel).w
  65392. move.b #8,boss_routine(a0) ; => Obj55_LaserShooter_Lower
  65393. bra.w Obj55_LaserShooter_End
  65394. ; ===========================================================================
  65395. ; word_3331C:
  65396. Obj55_LaserTargets:
  65397. dc.w $238 ; 0
  65398. dc.w $230 ; 2
  65399. dc.w $240 ; 4
  65400. dc.w $25F ; 6
  65401. ; ===========================================================================
  65402. ; loc_33324:
  65403. Obj55_LaserShooter_Aim:
  65404. bsr.w Boss_MoveObject
  65405. move.w (Boss_Countdown).w,d0
  65406. tst.w (Boss_Y_vel).w ; is laser shooter moving up?
  65407. bmi.s Obj55_LaserShooter_Aim_MovingUp ; if yes, branch
  65408. cmp.w (Boss_Y_pos).w,d0 ; has laser shooter reached its destination?
  65409. blo.s Obj55_LaserShooter_Fire ; if yes, branch
  65410. bra.w Obj55_LaserShooter_End
  65411. ; ===========================================================================
  65412. ; loc_3333C:
  65413. Obj55_LaserShooter_Aim_MovingUp:
  65414. cmp.w (Boss_Y_pos).w,d0 ; has laser shooter reached its destination?
  65415. blo.s Obj55_LaserShooter_End ; if not, branch
  65416.  
  65417. ; loc_33342:
  65418. Obj55_LaserShooter_Fire:
  65419. move.w #0,(Boss_Y_vel).w
  65420. move.b #8,Obj55_anim_frame_duration(a0)
  65421. move.b #6,mainspr_mapframe(a0) ; use firing frame
  65422. jsrto (SingleObjLoad).l, JmpTo18_SingleObjLoad
  65423. bne.w Obj55_LaserShooter_End
  65424. move.b #ObjID_OOZBoss,id(a1) ; load obj55
  65425. move.b #8,boss_subtype(a1) ; => Obj55_Laser
  65426. move.l a0,Obj55_Wave_parent(a1)
  65427. move.b #SndID_LaserBurst,d0
  65428. jsrto (PlaySound).l, JmpTo11_PlaySound
  65429. move.b #4,boss_routine(a0) ; => Obj55_LaserShooter_ChooseTarget
  65430. move.w #$28,(Boss_Countdown).w
  65431. move.w #-$80,(Boss_Y_vel).w
  65432. bra.w Obj55_LaserShooter_End
  65433. ; ===========================================================================
  65434. ; loc_33388:
  65435. Obj55_LaserShooter_Lower:
  65436. subq.b #1,Obj55_anim_frame_duration(a0) ; is firing animation finished?
  65437. bne.s + ; if not, branch
  65438. move.b #5,mainspr_mapframe(a0) ; reset animation frame to not firing
  65439. +
  65440. bsr.w Boss_MoveObject
  65441. cmpi.w #$2B0,(Boss_Y_pos).w ; has laser shooter reached its destination?
  65442. blo.s Obj55_LaserShooter_End ; if not, branch
  65443. move.w #$2B0,(Boss_Y_pos).w
  65444. move.w #0,(Boss_Y_vel).w
  65445. move.b #0,boss_routine(a0)
  65446. move.b #2,boss_subtype(a0) ; => Obj55_Main_Init
  65447. rts
  65448. ; ===========================================================================
  65449. ; loc_333BA:
  65450. Obj55_LaserShooter_End:
  65451. bsr.w Obj55_LaserShooter_FacePlayer
  65452. bsr.w Obj55_LaserShooter_Wind
  65453. jmpto (DisplaySprite).l, JmpTo41_DisplaySprite
  65454. ; ===========================================================================
  65455. ; sets the laser shooter's y velocity so that it moves toward its target
  65456. ; loc_333C6:
  65457. Obj55_MoveTowardTarget:
  65458. move.w (Boss_Countdown).w,d0
  65459. sub.w (Boss_Y_pos).w,d0
  65460. bpl.s Obj55_LaserShooter_MoveUp ; branch, if laser shooter is below target
  65461. move.w #-$80,(Boss_Y_vel).w
  65462. rts
  65463. ; ===========================================================================
  65464. ; loc_333D8:
  65465. Obj55_LaserShooter_MoveUp:
  65466. move.w #$80,(Boss_Y_vel).w
  65467. rts
  65468. ; ===========================================================================
  65469. ; loc_333E0:
  65470. Obj55_LaserShooter_FacePlayer:
  65471. move.w (MainCharacter+x_pos).w,d0
  65472. sub.w x_pos(a0),d0
  65473. blt.s Obj55_LaserShooter_FaceLeft ; branch, if player is to the left
  65474. subi_.w #8,d0 ; allow an 8 pixel margin
  65475. blt.s return_333F6
  65476. bset #0,render_flags(a0)
  65477.  
  65478. return_333F6:
  65479. rts
  65480. ; ===========================================================================
  65481. ; loc_333F8:
  65482. Obj55_LaserShooter_FaceLeft:
  65483. addi_.w #8,d0 ; allow an 8 pixel margin
  65484. bgt.s return_333F6
  65485. bclr #0,render_flags(a0)
  65486. rts
  65487. ; ===========================================================================
  65488. ; creates the twisting effect
  65489. ; loc_33406:
  65490. Obj55_LaserShooter_Wind:
  65491. move.w (Boss_X_pos).w,d5
  65492. move.w (Boss_Y_pos).w,d6
  65493. move.b boss_sine_count(a0),d3
  65494. move.b d3,d0
  65495. bsr.w Obj55_LaserShooter_CalcSineRelative
  65496. move.w d1,x_pos(a0)
  65497. move.w d0,y_pos(a0)
  65498. addi_.b #2,boss_sine_count(a0)
  65499. moveq #7,d2
  65500. moveq #0,d4
  65501.  
  65502. - addi.w #$F,d6
  65503. subi.b #$10,d3
  65504. bsr.w Obj55_LaserShooter_CalcSineRelative
  65505. move.w d1,sub2_x_pos(a0,d4.w)
  65506. move.w d0,sub2_y_pos(a0,d4.w)
  65507. addq.w #next_subspr,d4
  65508. dbf d2,-
  65509. rts
  65510. ; ===========================================================================
  65511. ; loc_33446:
  65512. Obj55_LaserShooter_CalcSineRelative:
  65513. move.b d3,d0
  65514. jsrto (CalcSine).l, JmpTo13_CalcSine
  65515. asr.w #4,d1
  65516. add.w d5,d1
  65517. asr.w #6,d0
  65518. add.w d6,d0
  65519. rts
  65520. ; ===========================================================================
  65521. ; loc_33456:
  65522. Obj55_SpikeChain:
  65523. moveq #0,d0
  65524. move.b boss_routine(a0),d0
  65525. move.w Obj55_SpikeChain_Index(pc,d0.w),d1
  65526. jmp Obj55_SpikeChain_Index(pc,d1.w)
  65527. ; ===========================================================================
  65528. ; off_33464:
  65529. Obj55_SpikeChain_Index: offsetTable
  65530. offsetTableEntry.w Obj55_SpikeChain_Init ; 0 - spiked chain's initial state
  65531. offsetTableEntry.w Obj55_SpikeChain_Main ; 2 - spiked chain moving at an arc
  65532. ; ===========================================================================
  65533. ; loc_33468:
  65534. Obj55_SpikeChain_Init:
  65535. clr.w (Normal_palette_line2+2).w ; reset palette flash
  65536. move.w #$28C0,(Boss_X_pos).w
  65537. bclr #0,render_flags(a0)
  65538. move.w (MainCharacter+x_pos).w,d1
  65539. cmpi.w #$293A,d1 ; is player on the left side of the arena?
  65540. blo.s + ; if yes, branch
  65541. move.w #$29C0,(Boss_X_pos).w
  65542. bset #0,render_flags(a0)
  65543. +
  65544. move.w #$2A0,(Boss_Y_pos).w
  65545. move.b #2,mainspr_mapframe(a0)
  65546. move.b #$8A,collision_flags(a0)
  65547. addq.b #2,boss_routine(a0) ; => Obj55_SpikeChain_Main
  65548. move.b #$80,mainspr_width(a0)
  65549. clr.b boss_sine_count(a0)
  65550. moveq #7,d0
  65551. moveq #7,d1
  65552. moveq #0,d2
  65553.  
  65554. - move.b d1,sub2_mapframe(a0,d2.w)
  65555. addq.w #next_subspr,d2
  65556. dbf d0,-
  65557.  
  65558. move.b #8,mainspr_childsprites(a0)
  65559. move.b #2,(Boss_CollisionRoutine).w
  65560. rts
  65561. ; ===========================================================================
  65562. ; loc_334CC:
  65563. Obj55_SpikeChain_Main:
  65564. bsr.w Obj55_SpikeChain_Move
  65565. cmpi.b #$FE,boss_sine_count(a0) ; has chain reached a certain angle?
  65566. blo.s Obj55_SpikeChain_End ; if not, branch
  65567. move.b #0,boss_routine(a0)
  65568. move.b #4,boss_subtype(a0) ; => Obj55_LaserShooter_Init
  65569. rts
  65570. ; ===========================================================================
  65571. ; loc_334E6:
  65572. Obj55_SpikeChain_End:
  65573. bsr.w Obj55_SpikeChain_SetAnimFrame
  65574. jmpto (DisplaySprite).l, JmpTo41_DisplaySprite
  65575. ; ===========================================================================
  65576. ; loc_334EE:
  65577. Obj55_SpikeChain_Move:
  65578. move.b boss_sine_count(a0),d0
  65579. addi.b #$40,d0
  65580. move.b d0,d3
  65581. bsr.w Obj55_SpikeChain_Rotate
  65582. move.w d1,x_pos(a0)
  65583. move.w d0,y_pos(a0)
  65584. addi_.b #1,boss_sine_count(a0)
  65585. moveq #7,d2
  65586. moveq #0,d4
  65587.  
  65588. - subi_.b #6,d3
  65589. bsr.w Obj55_SpikeChain_Rotate
  65590. move.w d1,sub2_x_pos(a0,d4.w)
  65591. move.w d0,sub2_y_pos(a0,d4.w)
  65592. addq.w #next_subspr,d4
  65593. dbf d2,-
  65594. rts
  65595. ; ===========================================================================
  65596. ; loc_33526:
  65597. Obj55_SpikeChain_Rotate:
  65598. move.b d3,d0
  65599. jsrto (CalcSine).l, JmpTo13_CalcSine
  65600. muls.w #$68,d1
  65601. asr.l #8,d1
  65602. btst #0,render_flags(a0)
  65603. bne.s +
  65604. neg.w d1
  65605. +
  65606. add.w (Boss_X_pos).w,d1
  65607. muls.w #$68,d0
  65608. asr.l #8,d0
  65609. add.w (Boss_Y_pos).w,d0
  65610. rts
  65611. ; ===========================================================================
  65612. ; loc_3354C:
  65613. Obj55_SpikeChain_SetAnimFrame:
  65614. move.b boss_sine_count(a0),d0
  65615. moveq #$15,d1
  65616. cmpi.b #$52,d0
  65617. blo.s +
  65618. moveq #3,d1
  65619. cmpi.b #$6B,d0
  65620. blo.s +
  65621. moveq #2,d1
  65622. cmpi.b #-$6E,d0
  65623. blo.s +
  65624. moveq #4,d1
  65625. +
  65626. move.b d1,mainspr_mapframe(a0)
  65627. rts
  65628. ; ===========================================================================
  65629. ; loc_33570:
  65630. Obj55_Laser:
  65631. moveq #0,d0
  65632. move.b routine_secondary(a0),d0
  65633. move.w Obj55_Laser_Index(pc,d0.w),d0
  65634. jmp Obj55_Laser_Index(pc,d0.w)
  65635. ; ===========================================================================
  65636. ; off_3357E:
  65637. Obj55_Laser_Index: offsetTable
  65638. offsetTableEntry.w Obj55_Laser_Init ; 0 - Init
  65639. offsetTableEntry.w Obj55_Laser_Main ; 2 - Laser moving horizontally
  65640. offsetTableEntry.w Obj55_Wave ; 4 - Energy wave that moves along the ground
  65641. offsetTableEntry.w BranchTo2_JmpTo62_DeleteObject ; 6 - Delete (triggered by an animation)
  65642. ; ===========================================================================
  65643. ; loc_33586:
  65644. Obj55_Laser_Init:
  65645. addq.b #2,routine_secondary(a0) ; => Obj55_Laser_Main
  65646. move.l #Obj55_MapUnc_33756,mappings(a0)
  65647. move.w #make_art_tile(ArtTile_ArtNem_OOZBoss,0,0),art_tile(a0)
  65648. ori.b #4,render_flags(a0)
  65649. move.b #4,priority(a0)
  65650. movea.l Obj55_Wave_parent(a0),a1 ; a1=object
  65651. move.w x_pos(a1),x_pos(a0)
  65652. move.w y_pos(a1),y_pos(a0)
  65653. move.b #$C,mapping_frame(a0)
  65654. move.w #-$20,d0
  65655. move.w #-$400,x_vel(a0)
  65656. btst #0,render_flags(a1)
  65657. beq.s +
  65658. neg.w d0
  65659. neg.w x_vel(a0)
  65660. +
  65661. add.w d0,x_pos(a0)
  65662. move.b #$AF,collision_flags(a0)
  65663. rts
  65664. ; ===========================================================================
  65665. ; loc_335DE:
  65666. Obj55_Laser_Main:
  65667. bsr.w Obj55_Laser_ChkGround
  65668. jsrto (ObjectMove).l, JmpTo25_ObjectMove
  65669. cmpi.w #$2870,x_pos(a0) ; has laser moved off screen going left?
  65670. blo.w JmpTo62_DeleteObject ; if yes, branch
  65671. cmpi.w #$2A10,x_pos(a0) ; has laser moved off screen going right?
  65672. bhs.w JmpTo62_DeleteObject ; if yes, branch
  65673. jmpto (DisplaySprite).l, JmpTo41_DisplaySprite
  65674. ; ===========================================================================
  65675. ; checks if laser hit the ground
  65676. ; loc_335FE:
  65677. Obj55_Laser_ChkGround:
  65678. cmpi.w #$250,y_pos(a0) ; is laser on ground level?
  65679. blo.s return_33626 ; if not, branch
  65680. tst.w x_vel(a0) ; is laser moving left?
  65681. bmi.w Obj55_Laser_ChkGroundLeft ; if yes, branch
  65682. move.w x_pos(a0),d0
  65683. cmpi.w #$2980,d0
  65684. bhs.s return_33626
  65685. cmpi.w #$297C,d0
  65686. blo.w return_33626
  65687. move.w #$2988,d1 ; wave's start position
  65688. bra.s Obj55_Laser_CreateWave
  65689. ; ===========================================================================
  65690.  
  65691. return_33626:
  65692. rts
  65693. ; ===========================================================================
  65694. ; loc_33628:
  65695. Obj55_Laser_ChkGroundLeft:
  65696. move.w x_pos(a0),d0
  65697. cmpi.w #$2900,d0
  65698. blo.s return_3363E
  65699. cmpi.w #$2904,d0
  65700. bhs.s return_3363E
  65701. move.w #$28F8,d1 ; wave's start position
  65702. bra.s Obj55_Laser_CreateWave
  65703. ; ===========================================================================
  65704.  
  65705. return_3363E:
  65706. rts
  65707. ; ===========================================================================
  65708. ; loc_33640:
  65709. Obj55_Laser_CreateWave:
  65710. jsrto (SingleObjLoad).l, JmpTo18_SingleObjLoad
  65711. bne.s return_336B0
  65712. move.b #ObjID_OOZBoss,id(a1) ; load obj55
  65713. move.b #8,boss_subtype(a1)
  65714. move.b #4,routine_secondary(a1) ; => Obj55_Wave
  65715. move.b #$8B,collision_flags(a1)
  65716. move.b #2,anim(a1)
  65717. move.b #$D,mapping_frame(a1)
  65718. move.w #0,y_vel(a1)
  65719. move.l #Obj55_MapUnc_33756,mappings(a1)
  65720. move.w #make_art_tile(ArtTile_ArtNem_OOZBoss,0,0),art_tile(a1)
  65721. jsrto (Adjust2PArtPointer).l, JmpTo63_Adjust2PArtPointer
  65722. ori.b #4,render_flags(a1)
  65723. move.b #2,priority(a1)
  65724. move.w #5,Obj55_Wave_delay(a1)
  65725. move.b #7,Obj55_Wave_count(a1)
  65726. move.w x_vel(a0),x_vel(a1)
  65727. move.w d1,x_pos(a1)
  65728. move.w #$250,y_pos(a1)
  65729. move.b #SndID_LaserFloor,d0
  65730. jsrto (PlaySound).l, JmpTo11_PlaySound
  65731.  
  65732. return_336B0:
  65733. rts
  65734. ; ===========================================================================
  65735. ; loc_336B2:
  65736. Obj55_Wave:
  65737. subq.w #1,Obj55_Wave_delay(a0)
  65738. bpl.s Obj55_Wave_End
  65739. move.w #$C7,Obj55_Wave_delay(a0)
  65740. subq.b #1,Obj55_Wave_count(a0)
  65741. bmi.s Obj55_Wave_End
  65742. jsrto (SingleObjLoad2).l, JmpTo24_SingleObjLoad2
  65743. bne.s Obj55_Wave_End
  65744. moveq #0,d0
  65745.  
  65746. move.w #bytesToLcnt(object_size),d1
  65747.  
  65748. - move.l (a0,d0.w),(a1,d0.w) ; make new object a copy of this one
  65749. addq.w #4,d0
  65750. dbf d1,-
  65751. if object_size&3
  65752. move.w (a0,d0.w),(a1,d0.w) ; make new object a copy of this one
  65753. endif
  65754.  
  65755. move.w #5,Obj55_Wave_delay(a1)
  65756. move.w #$200,anim(a1)
  65757. move.w #$10,d0 ; place new wave object 16 pixels next to current one
  65758. tst.w x_vel(a1) ; is object going left?
  65759. bpl.s + ; if not, branch
  65760. neg.w d0 ; flip offset
  65761. +
  65762. add.w d0,x_pos(a1) ; set position
  65763. move.b #SndID_LaserFloor,d0
  65764. jsrto (PlaySound).l, JmpTo11_PlaySound
  65765.  
  65766. Obj55_Wave_End:
  65767. lea (Ani_obj55).l,a1
  65768. jsrto (AnimateSprite).l, JmpTo22_AnimateSprite
  65769. jmpto (MarkObjGone).l, JmpTo38_MarkObjGone
  65770. ; ===========================================================================
  65771.  
  65772. BranchTo2_JmpTo62_DeleteObject
  65773. bra.w JmpTo62_DeleteObject
  65774. ; ===========================================================================
  65775. ; animation script
  65776. ; off_33712:
  65777. Ani_obj55: offsetTable
  65778. offsetTableEntry.w byte_3371E
  65779. offsetTableEntry.w byte_33738
  65780. offsetTableEntry.w byte_3373B
  65781. offsetTableEntry.w byte_3374D
  65782. offsetTableEntry.w byte_33750
  65783. offsetTableEntry.w byte_33753
  65784. byte_3371E:
  65785. dc.b 9, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9
  65786. dc.b 9, 8, 8, 8, 8, 9, 9, 9, 9,$FF; 16
  65787. rev02even
  65788. byte_33738:
  65789. dc.b $F, 1,$FF
  65790. rev02even
  65791. byte_3373B:
  65792. dc.b 1, $D,$11, $E,$12, $F,$13,$10,$14,$14,$10,$13, $F,$12, $E,$11
  65793. dc.b $D,$FA ; 16
  65794. rev02even
  65795. byte_3374D:
  65796. dc.b $F, $A,$FF
  65797. rev02even
  65798. byte_33750:
  65799. dc.b $F, $B,$FF
  65800. rev02even
  65801. byte_33753:
  65802. dc.b $F, 8,$FF
  65803. even
  65804. ; ----------------------------------------------------------------------------
  65805. ; sprite mappings
  65806. ; ----------------------------------------------------------------------------
  65807. Obj55_MapUnc_33756: BINCLUDE "mappings/sprite/obj55.bin"
  65808. ; ===========================================================================
  65809.  
  65810. if ~~removeJmpTos
  65811. JmpTo41_DisplaySprite
  65812. jmp (DisplaySprite).l
  65813. JmpTo62_DeleteObject
  65814. jmp (DeleteObject).l
  65815. JmpTo18_SingleObjLoad
  65816. jmp (SingleObjLoad).l
  65817. JmpTo38_MarkObjGone
  65818. jmp (MarkObjGone).l
  65819. JmpTo11_PlaySound
  65820. jmp (PlaySound).l
  65821. JmpTo24_SingleObjLoad2
  65822. jmp (SingleObjLoad2).l
  65823. JmpTo22_AnimateSprite
  65824. jmp (AnimateSprite).l
  65825. JmpTo5_RandomNumber
  65826. jmp (RandomNumber).l
  65827. JmpTo63_Adjust2PArtPointer
  65828. jmp (Adjust2PArtPointer).l
  65829. JmpTo13_CalcSine
  65830. jmp (CalcSine).l
  65831. JmpTo8_PlayLevelMusic
  65832. jmp (PlayLevelMusic).l
  65833. JmpTo8_LoadPLC_AnimalExplosion
  65834. jmp (LoadPLC_AnimalExplosion).l
  65835. ; loc_338E4:
  65836. JmpTo25_ObjectMove
  65837. jmp (ObjectMove).l
  65838.  
  65839. align 4
  65840. endif
  65841.  
  65842.  
  65843.  
  65844.  
  65845. ; ===========================================================================
  65846. ; ----------------------------------------------------------------------------
  65847. ; Object 09 - Sonic in Special Stage
  65848. ; ----------------------------------------------------------------------------
  65849. ; Sprite_338EC:
  65850. Obj09:
  65851. bsr.w loc_33908
  65852. moveq #0,d0
  65853. move.b routine(a0),d0
  65854. move.w Obj09_Index(pc,d0.w),d1
  65855. jmp Obj09_Index(pc,d1.w)
  65856. ; ===========================================================================
  65857. ; off_338FE:
  65858. Obj09_Index: offsetTable
  65859. offsetTableEntry.w Obj09_Init ; 0
  65860. offsetTableEntry.w Obj09_MdNormal ; 2
  65861. offsetTableEntry.w Obj09_MdJump ; 4
  65862. offsetTableEntry.w Obj09_Index ; 6 - invalid
  65863. offsetTableEntry.w Obj09_MdAir ; 8
  65864. ; ===========================================================================
  65865.  
  65866. loc_33908:
  65867. lea (SS_Ctrl_Record_Buf_End).w,a1
  65868.  
  65869. moveq #(SS_Ctrl_Record_Buf_End-SS_Ctrl_Record_Buf)/2-2,d0
  65870. - move.w -4(a1),-(a1)
  65871. dbf d0,-
  65872.  
  65873. move.w (Ctrl_1_Logical).w,-(a1)
  65874. rts
  65875. ; ===========================================================================
  65876. ; loc_3391C:
  65877. Obj09_Init:
  65878. move.b #2,routine(a0)
  65879. moveq #0,d0
  65880. move.l d0,ss_x_pos(a0)
  65881. move.w #$80,d1
  65882. move.w d1,ss_y_pos(a0)
  65883. move.w d0,ss_y_sub(a0)
  65884. add.w (SS_Offset_X).w,d0
  65885. move.w d0,x_pos(a0)
  65886. add.w (SS_Offset_Y).w,d1
  65887. move.w d1,y_pos(a0)
  65888. move.b #$E,y_radius(a0)
  65889. move.b #7,x_radius(a0)
  65890. move.l #Obj09_MapUnc_34212,mappings(a0)
  65891. move.w #make_art_tile(ArtTile_ArtNem_SpecialSonic,1,0),art_tile(a0)
  65892. move.b #4,render_flags(a0)
  65893. move.b #3,priority(a0)
  65894. move.w #$6E,ss_z_pos(a0)
  65895. clr.b (SS_Swap_Positions_Flag).w
  65896. move.w #$400,ss_init_flip_timer(a0)
  65897. move.b #$40,angle(a0)
  65898. move.b #1,(Sonic_LastLoadedDPLC).w
  65899. clr.b ss_slide_timer(a0)
  65900. bclr #6,status(a0)
  65901. clr.b collision_property(a0)
  65902. clr.b ss_dplc_timer(a0)
  65903. movea.l #SpecialStageShadow_Sonic,a1
  65904. move.b #ObjID_SSShadow,id(a1) ; load obj63 (shadow) at $FFFFB140
  65905. move.w x_pos(a0),x_pos(a1)
  65906. move.w y_pos(a0),y_pos(a1)
  65907. addi.w #$18,y_pos(a1)
  65908. move.l #Obj63_MapUnc_34492,mappings(a1)
  65909. move.w #make_art_tile(ArtTile_ArtNem_SpecialFlatShadow,3,0),art_tile(a1)
  65910. move.b #4,render_flags(a1)
  65911. move.b #4,priority(a1)
  65912. move.l a0,ss_parent(a1)
  65913. bra.w LoadSSSonicDynPLC
  65914. ; ===========================================================================
  65915.  
  65916. Obj09_MdNormal:
  65917. tst.b routine_secondary(a0)
  65918. bne.s Obj09_Hurt
  65919. lea (Ctrl_1_Held_Logical).w,a2
  65920. bsr.w SSPlayer_Move
  65921. bsr.w SSPlayer_Traction
  65922. bsr.w SSPlayerSwapPositions
  65923. bsr.w SSObjectMove
  65924. bsr.w SSAnglePos
  65925. bsr.w SSSonic_Jump
  65926. bsr.w SSPlayer_SetAnimation
  65927. lea (off_341E4).l,a1
  65928. bsr.w SSPlayer_Animate
  65929. bsr.w SSPlayer_Collision
  65930. bra.w LoadSSSonicDynPLC
  65931. ; ===========================================================================
  65932.  
  65933. Obj09_Hurt:
  65934. bsr.w SSHurt_Animation
  65935. bsr.w SSPlayerSwapPositions
  65936. bsr.w SSObjectMove
  65937. bsr.w SSAnglePos
  65938. bra.w LoadSSSonicDynPLC
  65939. ; ===========================================================================
  65940.  
  65941. SSHurt_Animation:
  65942. moveq #0,d0
  65943. move.b ss_hurt_timer(a0),d0
  65944. addi_.b #8,d0
  65945. move.b d0,ss_hurt_timer(a0)
  65946. bne.s +
  65947. move.b #0,routine_secondary(a0)
  65948. move.b #$1E,ss_dplc_timer(a0)
  65949. +
  65950. add.b angle(a0),d0
  65951. andi.b #$FC,render_flags(a0)
  65952. subi.b #$10,d0
  65953. lsr.b #5,d0
  65954. add.w d0,d0
  65955. move.b byte_33A92(pc,d0.w),mapping_frame(a0)
  65956. move.b byte_33A92+1(pc,d0.w),d0
  65957. or.b d0,render_flags(a0)
  65958. move.b ss_hurt_timer(a0),d0
  65959. subi_.b #8,d0
  65960. bne.s return_33A90
  65961. move.b d0,collision_property(a0)
  65962. cmpa.l #MainCharacter,a0
  65963. bne.s +
  65964. tst.w (Ring_count).w
  65965. beq.s return_33A90
  65966. bra.s ++
  65967. ; ===========================================================================
  65968. +
  65969. tst.w (Ring_count_2P).w
  65970. beq.s return_33A90
  65971. +
  65972. jsrto (SSSingleObjLoad).l, JmpTo_SSSingleObjLoad
  65973. bne.s return_33A90
  65974. move.l a0,ss_parent(a1)
  65975. move.b #ObjID_SSRingSpill,id(a1) ; load obj5B
  65976.  
  65977. return_33A90:
  65978. rts
  65979. ; ===========================================================================
  65980. byte_33A92:
  65981. dc.b 4, 1
  65982. dc.b 0, 0 ; 2
  65983. dc.b 4, 0 ; 4
  65984. dc.b $C, 0 ; 6
  65985. dc.b 4, 2 ; 8
  65986. dc.b 0, 2 ; 10
  65987. dc.b 4, 3 ; 12
  65988. dc.b $C, 1 ; 14
  65989. dword_33AA2:
  65990. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($000) ; Sonic in upright position, $58 tiles
  65991. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($058) ; Sonic in diagonal position, $CC tiles
  65992. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($124) ; Sonic in horizontal position, $4D tiles
  65993. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($171) ; Sonic in ball form, $12 tiles
  65994. ; ===========================================================================
  65995.  
  65996. LoadSSSonicDynPLC:
  65997. move.b ss_dplc_timer(a0),d0
  65998. beq.s +
  65999. subq.b #1,d0
  66000. move.b d0,ss_dplc_timer(a0)
  66001. andi.b #1,d0
  66002. beq.s +
  66003. rts
  66004. ; ===========================================================================
  66005. +
  66006. jsrto (DisplaySprite).l, JmpTo42_DisplaySprite
  66007. lea dword_33AA2(pc),a3
  66008. lea (Sonic_LastLoadedDPLC).w,a4
  66009. move.w #tiles_to_bytes(ArtTile_ArtNem_SpecialSonic),d4
  66010. moveq #0,d1
  66011.  
  66012. LoadSSPlayerDynPLC:
  66013. moveq #0,d0
  66014. move.b mapping_frame(a0),d0
  66015. cmp.b (a4),d0
  66016. beq.s return_33B3E
  66017. move.b d0,(a4)
  66018. moveq #0,d6
  66019. cmpi.b #4,d0
  66020. blt.s loc_33AFE
  66021. addq.w #4,d6
  66022. cmpi.b #$C,d0
  66023. blt.s loc_33AFE
  66024. addq.w #4,d6
  66025. cmpi.b #$10,d0
  66026. blt.s loc_33AFE
  66027. addq.b #4,d6
  66028.  
  66029. loc_33AFE:
  66030. move.l (a3,d6.w),d6
  66031. add.w d1,d0
  66032. add.w d0,d0
  66033. lea (Obj09_MapRUnc_345FA).l,a2
  66034. adda.w (a2,d0.w),a2
  66035. move.w (a2)+,d5
  66036. subq.w #1,d5
  66037. bmi.s return_33B3E
  66038.  
  66039. SSPLC_ReadEntry:
  66040. moveq #0,d1
  66041. move.w (a2)+,d1
  66042. move.w d1,d3
  66043. lsr.w #8,d3
  66044. andi.w #$F0,d3
  66045. addi.w #$10,d3
  66046. andi.w #$FFF,d1
  66047. lsl.w #1,d1
  66048. add.l d6,d1
  66049. move.w d4,d2
  66050. add.w d3,d4
  66051. add.w d3,d4
  66052. jsr (QueueDMATransfer).l
  66053. dbf d5,SSPLC_ReadEntry
  66054.  
  66055. return_33B3E:
  66056. rts
  66057. ; ===========================================================================
  66058.  
  66059. SSSonic_Jump:
  66060. lea (Ctrl_1_Press_Logical).w,a2
  66061.  
  66062. SSPlayer_Jump:
  66063. move.b (a2),d0
  66064. andi.b #button_B_mask|button_C_mask|button_A_mask,d0
  66065. beq.w return_33BAC
  66066. move.w #$780,d2
  66067. moveq #0,d0
  66068. move.b angle(a0),d0
  66069. addi.b #$80,d0
  66070. jsr (CalcSine).l
  66071. muls.w d2,d1
  66072. asr.l #8,d1
  66073. add.w d1,x_vel(a0)
  66074. muls.w d2,d0
  66075. asr.l #7,d0
  66076. add.w d0,y_vel(a0)
  66077. bset #2,status(a0)
  66078. move.b #4,routine(a0)
  66079. move.b #3,anim(a0)
  66080. moveq #0,d0
  66081. move.b d0,anim_frame_duration(a0)
  66082. move.b d0,anim_frame(a0)
  66083. move.b d0,collision_property(a0)
  66084. tst.b (SS_2p_Flag).w
  66085. bne.s loc_33B9E
  66086. tst.w (Player_mode).w
  66087. bne.s loc_33BA2
  66088.  
  66089. loc_33B9E:
  66090. not.b (SS_Swap_Positions_Flag).w
  66091.  
  66092. loc_33BA2:
  66093. move.w #SndID_Jump,d0
  66094. jsr (PlaySound).l
  66095.  
  66096. return_33BAC:
  66097. rts
  66098. ; ===========================================================================
  66099.  
  66100. Obj09_MdJump:
  66101. lea (Ctrl_1_Held_Logical).w,a2
  66102. bsr.w SSPlayer_ChgJumpDir
  66103. bsr.w SSObjectMoveAndFall
  66104. bsr.w SSPlayer_JumpAngle
  66105. bsr.w SSPlayer_DoLevelCollision
  66106. bsr.w SSPlayerSwapPositions
  66107. bsr.w SSAnglePos
  66108. lea (off_341E4).l,a1
  66109. bsr.w SSPlayer_Animate
  66110. bra.w LoadSSSonicDynPLC
  66111. ; ===========================================================================
  66112.  
  66113. Obj09_MdAir:
  66114. lea (Ctrl_1_Held_Logical).w,a2
  66115. bsr.w SSPlayer_ChgJumpDir
  66116. bsr.w SSObjectMoveAndFall
  66117. bsr.w SSPlayer_JumpAngle
  66118. bsr.w SSPlayer_DoLevelCollision
  66119. bsr.w SSPlayerSwapPositions
  66120. bsr.w SSAnglePos
  66121. bsr.w SSPlayer_SetAnimation
  66122. lea (off_341E4).l,a1
  66123. bsr.w SSPlayer_Animate
  66124. bra.w LoadSSSonicDynPLC
  66125. ; ===========================================================================
  66126.  
  66127. SSObjectMoveAndFall:
  66128. move.l ss_x_pos(a0),d2
  66129. move.l ss_y_pos(a0),d3
  66130. move.w x_vel(a0),d0
  66131. ext.l d0
  66132. asl.l #8,d0
  66133. add.l d0,d2
  66134. move.w y_vel(a0),d0
  66135. addi.w #$A8,y_vel(a0) ; Apply gravity
  66136. ext.l d0
  66137. asl.l #8,d0
  66138. add.l d0,d3
  66139. move.l d2,ss_x_pos(a0)
  66140. move.l d3,ss_y_pos(a0)
  66141. rts
  66142. ; ===========================================================================
  66143.  
  66144. SSPlayer_ChgJumpDir:
  66145. move.b (a2),d0
  66146. btst #button_left,d0
  66147. bne.s +
  66148. btst #button_right,d0
  66149. bne.w ++
  66150. rts
  66151. ; ===========================================================================
  66152. +
  66153. subi.w #$40,x_vel(a0)
  66154. rts
  66155. ; ===========================================================================
  66156. +
  66157. addi.w #$40,x_vel(a0)
  66158. rts
  66159. ; ===========================================================================
  66160.  
  66161. SSPlayer_JumpAngle:
  66162. moveq #0,d2
  66163. moveq #0,d3
  66164. move.w ss_y_pos(a0),d2
  66165. bmi.s SSPlayer_JumpAngle_above_screen
  66166. move.w ss_x_pos(a0),d3
  66167. bmi.s +++
  66168. cmp.w d2,d3
  66169. blo.s ++
  66170. bne.s +
  66171. tst.w d3
  66172. bne.s +
  66173. move.b #$40,angle(a0)
  66174. rts
  66175. ; ===========================================================================
  66176. +
  66177. lsl.l #5,d2
  66178. divu.w d3,d2
  66179. move.b d2,angle(a0)
  66180. rts
  66181. ; ===========================================================================
  66182. +
  66183. lsl.l #5,d3
  66184. divu.w d2,d3
  66185. subi.w #$40,d3
  66186. neg.w d3
  66187. move.b d3,angle(a0)
  66188. rts
  66189. ; ===========================================================================
  66190. +
  66191. neg.w d3
  66192. cmp.w d2,d3
  66193. bhs.s +
  66194. lsl.l #5,d3
  66195. divu.w d2,d3
  66196. addi.w #$40,d3
  66197. move.b d3,angle(a0)
  66198. rts
  66199. ; ===========================================================================
  66200. +
  66201. lsl.l #5,d2
  66202. divu.w d3,d2
  66203. subi.w #$80,d2
  66204. neg.w d2
  66205. move.b d2,angle(a0)
  66206. rts
  66207. ; ===========================================================================
  66208.  
  66209. SSPlayer_JumpAngle_above_screen:
  66210. neg.w d2
  66211. move.w ss_x_pos(a0),d3
  66212. bpl.s ++
  66213. neg.w d3
  66214. cmp.w d2,d3
  66215. blo.s +
  66216. lsl.l #5,d2
  66217. divu.w d3,d2
  66218. addi.w #$80,d2
  66219. move.b d2,angle(a0)
  66220. rts
  66221. ; ===========================================================================
  66222. +
  66223. lsl.l #5,d3
  66224. divu.w d2,d3
  66225. subi.w #$C0,d3
  66226. neg.w d3
  66227. move.b d3,angle(a0)
  66228. rts
  66229. ; ===========================================================================
  66230. +
  66231. cmp.w d2,d3
  66232. bhs.s +
  66233. lsl.l #5,d3
  66234. divu.w d2,d3
  66235. addi.w #$C0,d3
  66236. move.b d3,angle(a0)
  66237. rts
  66238. ; ===========================================================================
  66239. +
  66240. lsl.l #5,d2
  66241. divu.w d3,d2
  66242. subi.w #$100,d2
  66243. neg.w d2
  66244. move.b d2,angle(a0)
  66245. rts
  66246. ; ===========================================================================
  66247.  
  66248. loc_33D02:
  66249. moveq #0,d6
  66250. moveq #0,d0
  66251. move.w ss_x_pos(a1),d0
  66252. bpl.s loc_33D10
  66253. st d6
  66254. neg.w d0
  66255.  
  66256. loc_33D10:
  66257. lsl.l #7,d0
  66258. divu.w ss_z_pos(a1),d0
  66259. move.b byte_33D32(pc,d0.w),d0
  66260. tst.b d6
  66261. bne.s loc_33D24
  66262. subi.b #$80,d0
  66263. neg.b d0
  66264.  
  66265. loc_33D24:
  66266. tst.w ss_y_pos(a1)
  66267. bpl.s loc_33D2C
  66268. neg.b d0
  66269.  
  66270. loc_33D2C:
  66271. move.b d0,angle(a0)
  66272. rts
  66273. ; ===========================================================================
  66274. byte_33D32:
  66275. dc.b $40,$40,$40,$40,$41,$41,$41,$42,$42,$42,$43,$43,$43,$44,$44,$44
  66276. dc.b $45,$45,$45,$46,$46,$46,$47,$47,$47,$48,$48,$48,$48,$49,$49,$49; 16
  66277. dc.b $4A,$4A,$4A,$4B,$4B,$4B,$4C,$4C,$4C,$4D,$4D,$4D,$4E,$4E,$4E,$4F; 32
  66278. dc.b $4F,$50,$50,$50,$51,$51,$51,$52,$52,$52,$53,$53,$53,$54,$54,$54; 48
  66279. dc.b $55,$55,$56,$56,$56,$57,$57,$57,$58,$58,$59,$59,$59,$5A,$5A,$5B; 64
  66280. dc.b $5B,$5B,$5C,$5C,$5D,$5D,$5E,$5E,$5E,$5F,$5F,$60,$60,$61,$61,$62; 80
  66281. dc.b $62,$63,$63,$64,$64,$65,$65,$66,$66,$67,$67,$68,$68,$69,$6A,$6A; 96
  66282. dc.b $6B,$6C,$6C,$6D,$6E,$6E,$6F,$70,$71,$72,$73,$74,$75,$77,$78,$7A; 112
  66283. dc.b $80, 0 ; 128
  66284. ; ===========================================================================
  66285.  
  66286. SSPlayer_DoLevelCollision:
  66287. move.w ss_y_pos(a0),d0
  66288. ble.s +
  66289. muls.w d0,d0
  66290. move.w ss_x_pos(a0),d1
  66291. muls.w d1,d1
  66292. add.w d1,d0
  66293. move.w ss_z_pos(a0),d1
  66294. mulu.w d1,d1
  66295. cmp.l d1,d0
  66296. blo.s +
  66297. move.b #2,routine(a0)
  66298. bclr #2,status(a0)
  66299. moveq #0,d0
  66300. move.w d0,x_vel(a0)
  66301. move.w d0,y_vel(a0)
  66302. move.w d0,inertia(a0) ; This makes player stop on ground
  66303. move.b d0,ss_slide_timer(a0)
  66304. bset #6,status(a0)
  66305. bsr.w SSObjectMove
  66306. bsr.w SSAnglePos
  66307. +
  66308. rts
  66309. ; ===========================================================================
  66310.  
  66311. SSPlayer_Collision:
  66312. tst.b collision_property(a0)
  66313. beq.s return_33E42
  66314. clr.b collision_property(a0)
  66315. tst.b ss_dplc_timer(a0)
  66316. bne.s return_33E42
  66317. clr.b inertia(a0) ; clears only high byte, leaving a bit of speed
  66318. cmpa.l #MainCharacter,a0
  66319. bne.s +
  66320. st.b (SS_Swap_Positions_Flag).w
  66321. tst.w (Ring_count).w
  66322. beq.s loc_33E38
  66323. bra.s ++
  66324. ; ===========================================================================
  66325. +
  66326. clr.b (SS_Swap_Positions_Flag).w
  66327. tst.w (Ring_count_2P).w
  66328. beq.s loc_33E38
  66329. +
  66330. move.w #SndID_RingSpill,d0
  66331. jsr (PlaySound).l
  66332.  
  66333. loc_33E38:
  66334. move.b #2,routine_secondary(a0) ; hurt state
  66335. clr.b ss_hurt_timer(a0)
  66336.  
  66337. return_33E42:
  66338. rts
  66339. ; ===========================================================================
  66340.  
  66341. SSPlayerSwapPositions:
  66342. tst.w (Player_mode).w
  66343. bne.s return_33E8E
  66344. move.w ss_z_pos(a0),d0
  66345. cmpa.l #MainCharacter,a0
  66346. bne.s loc_33E5E
  66347. tst.b (SS_Swap_Positions_Flag).w
  66348. beq.s loc_33E6E
  66349. bra.s loc_33E64
  66350. ; ===========================================================================
  66351.  
  66352. loc_33E5E:
  66353. tst.b (SS_Swap_Positions_Flag).w
  66354. bne.s loc_33E6E
  66355.  
  66356. loc_33E64:
  66357. cmpi.w #$80,d0
  66358. beq.s return_33E8E
  66359. addq.w #1,d0
  66360. bra.s loc_33E76
  66361. ; ===========================================================================
  66362.  
  66363. loc_33E6E:
  66364. cmpi.w #$6E,d0
  66365. beq.s return_33E8E
  66366. subq.w #1,d0
  66367.  
  66368. loc_33E76:
  66369. move.w d0,ss_z_pos(a0)
  66370. cmpi.w #$77,d0
  66371. bhs.s loc_33E88
  66372. move.b #3,priority(a0)
  66373. rts
  66374. ; ===========================================================================
  66375.  
  66376. loc_33E88:
  66377. move.b #2,priority(a0)
  66378.  
  66379. return_33E8E:
  66380. rts
  66381. ; ===========================================================================
  66382. byte_33E90:
  66383. dc.b 1, 1
  66384. dc.b 0, 0 ; 2
  66385. dc.b 1, 0 ; 4
  66386. dc.b 2, 0 ; 6
  66387. dc.b 1, 2 ; 8
  66388. dc.b 0, 2 ; 10
  66389. dc.b 1, 3 ; 12
  66390. dc.b 2, 1 ; 14
  66391. ; ===========================================================================
  66392.  
  66393. SSPlayer_SetAnimation:
  66394. btst #2,status(a0)
  66395. beq.s +
  66396. move.b #3,anim(a0)
  66397. andi.b #$FC,status(a0)
  66398. rts
  66399. ; ===========================================================================
  66400. +
  66401. moveq #0,d0
  66402. move.b angle(a0),d0
  66403. subi.b #$10,d0
  66404. lsr.b #5,d0
  66405. move.b d0,d1
  66406. add.w d0,d0
  66407. move.b byte_33E90(pc,d0.w),d2
  66408. cmp.b anim(a0),d2
  66409. bne.s +
  66410. cmp.b ss_last_angle_index(a0),d1
  66411. beq.s return_33EFE
  66412. +
  66413. move.b d1,ss_last_angle_index(a0)
  66414. move.b d2,anim(a0)
  66415. move.b byte_33E90+1(pc,d0.w),d0
  66416. andi.b #$FC,status(a0)
  66417. or.b d0,status(a0)
  66418. cmpi.b #1,d1
  66419. beq.s loc_33EF8
  66420. cmpi.b #5,d1
  66421. bne.s return_33EFE
  66422.  
  66423. loc_33EF8:
  66424. move.w #$400,ss_init_flip_timer(a0)
  66425.  
  66426. return_33EFE:
  66427. rts
  66428. ; ===========================================================================
  66429.  
  66430. SSPlayer_Animate:
  66431. moveq #0,d0
  66432. move.b anim(a0),d0
  66433. cmp.b next_anim(a0),d0
  66434. beq.s SSAnim_Do
  66435. move.b #0,anim_frame(a0)
  66436. move.b d0,next_anim(a0)
  66437. move.b #0,anim_frame_duration(a0)
  66438.  
  66439. SSAnim_Do:
  66440. subq.b #1,anim_frame_duration(a0)
  66441. bpl.s SSAnim_Delay
  66442. add.w d0,d0
  66443. adda.w (a1,d0.w),a1
  66444. move.b (SS_player_anim_frame_timer).w,d0
  66445. lsr.b #1,d0
  66446. move.b d0,anim_frame_duration(a0)
  66447. cmpi.b #0,anim(a0)
  66448. bne.s +
  66449. subi_.b #1,ss_flip_timer(a0)
  66450. bgt.s +
  66451. bchg #0,status(a0)
  66452. bchg #0,render_flags(a0)
  66453. move.b ss_init_flip_timer(a0),ss_flip_timer(a0)
  66454. +
  66455. moveq #0,d1
  66456. move.b anim_frame(a0),d1
  66457. move.b 1(a1,d1.w),d0
  66458. bpl.s +
  66459. move.b #0,anim_frame(a0)
  66460. move.b 1(a1),d0
  66461. +
  66462. andi.b #$7F,d0
  66463. move.b d0,mapping_frame(a0)
  66464. move.b status(a0),d1
  66465. andi.b #3,d1
  66466. andi.b #$FC,render_flags(a0)
  66467. or.b d1,render_flags(a0)
  66468. addq.b #1,anim_frame(a0)
  66469.  
  66470. SSAnim_Delay:
  66471. rts
  66472. ; ===========================================================================
  66473.  
  66474. SSPlayer_Move:
  66475. move.w inertia(a0),d2
  66476. move.b (a2),d0
  66477. btst #button_left,d0
  66478. bne.s SSPlayer_MoveLeft
  66479. btst #button_right,d0
  66480. bne.w SSPlayer_MoveRight
  66481. bset #6,status(a0)
  66482. bne.s +
  66483. move.b #$1E,ss_slide_timer(a0)
  66484. +
  66485. move.b angle(a0),d0
  66486. bmi.s +
  66487. subi.b #$38,d0
  66488. cmpi.b #$10,d0
  66489. bhs.s +
  66490. move.w d2,d1
  66491. asr.w #3,d1
  66492. sub.w d1,d2
  66493. bra.s ++
  66494. ; ===========================================================================
  66495. +
  66496. move.w d2,d1
  66497. asr.w #3,d1
  66498. sub.w d1,d2
  66499. +
  66500. move.w d2,inertia(a0)
  66501. move.b ss_slide_timer(a0),d0
  66502. beq.s +
  66503. subq.b #1,d0
  66504. move.b d0,ss_slide_timer(a0)
  66505. +
  66506. rts
  66507. ; ===========================================================================
  66508.  
  66509. SSPlayer_MoveLeft:
  66510. addi.w #$60,d2
  66511. cmpi.w #$600,d2
  66512. ble.s +
  66513. move.w #$600,d2
  66514. bra.s +
  66515. ; ===========================================================================
  66516.  
  66517. SSPlayer_MoveRight:
  66518. subi.w #$60,d2
  66519. cmpi.w #-$600,d2
  66520. bge.s +
  66521. move.w #-$600,d2
  66522. +
  66523. move.w d2,inertia(a0)
  66524. bclr #6,status(a0)
  66525. clr.b ss_slide_timer(a0)
  66526. rts
  66527. ; ===========================================================================
  66528.  
  66529. SSPlayer_Traction:
  66530. tst.b ss_slide_timer(a0)
  66531. bne.s +
  66532. move.b angle(a0),d0
  66533. jsr (CalcSine).l
  66534. muls.w #$50,d1
  66535. asr.l #8,d1
  66536. add.w d1,inertia(a0)
  66537. +
  66538. move.b angle(a0),d0
  66539. bpl.s return_34048
  66540. addi_.b #4,d0
  66541. cmpi.b #-$78,d0
  66542. blo.s return_34048
  66543. mvabs.w inertia(a0),d0
  66544. cmpi.w #$100,d0
  66545. bhs.s return_34048
  66546. move.b #8,routine(a0)
  66547.  
  66548. return_34048:
  66549. rts
  66550. ; ===========================================================================
  66551.  
  66552. SSObjectMove:
  66553. moveq #0,d0
  66554. moveq #0,d1
  66555. move.w inertia(a0),d2
  66556. bpl.s +
  66557. neg.w d2
  66558. lsr.w #8,d2
  66559. sub.b d2,angle(a0)
  66560. bra.s ++
  66561. ; ===========================================================================
  66562. +
  66563. lsr.w #8,d2
  66564. add.b d2,angle(a0)
  66565. +
  66566. move.b angle(a0),d0
  66567. jsr (CalcSine).l
  66568. muls.w ss_z_pos(a0),d1
  66569. asr.l #8,d1
  66570. move.w d1,ss_x_pos(a0)
  66571. muls.w ss_z_pos(a0),d0
  66572. asr.l #8,d0
  66573. move.w d0,ss_y_pos(a0)
  66574. rts
  66575. ; ===========================================================================
  66576.  
  66577. SSAnglePos:
  66578. move.w ss_x_pos(a0),d0
  66579. muls.w #$CC,d0
  66580. asr.l #8,d0
  66581. add.w (SS_Offset_X).w,d0
  66582. move.w d0,x_pos(a0)
  66583. move.w ss_y_pos(a0),d0
  66584. add.w (SS_Offset_Y).w,d0
  66585. move.w d0,y_pos(a0)
  66586. rts
  66587. ; ===========================================================================
  66588. ; ----------------------------------------------------------------------------
  66589. ; Object 63 - Character shadow from Special Stage
  66590. ; ----------------------------------------------------------------------------
  66591. ; Sprite_340A4:
  66592. Obj63:
  66593. movea.l ss_parent(a0),a1 ; a1=object
  66594. cmpa.l #MainCharacter,a1
  66595. bne.s loc_340BC
  66596. movea.l #MainCharacter,a1 ; a1=character
  66597. bsr.s loc_340CC
  66598. jmpto (DisplaySprite).l, JmpTo42_DisplaySprite
  66599. ; ===========================================================================
  66600.  
  66601. loc_340BC:
  66602. movea.l #Sidekick,a1 ; a1=object
  66603. bsr.s loc_340CC
  66604. bsr.w loc_341BA
  66605. jmpto (DisplaySprite).l, JmpTo42_DisplaySprite
  66606. ; ===========================================================================
  66607.  
  66608. loc_340CC:
  66609. cmpi.b #2,routine(a1)
  66610. beq.w loc_34108
  66611. bsr.w loc_33D02
  66612. move.b angle(a0),d0
  66613. jsr (CalcSine).l
  66614. muls.w ss_z_pos(a1),d1
  66615. muls.w #$CC,d1
  66616. swap d1
  66617. add.w (SS_Offset_X).w,d1
  66618. move.w d1,x_pos(a0)
  66619. muls.w ss_z_pos(a1),d0
  66620. asr.l #8,d0
  66621. add.w (SS_Offset_Y).w,d0
  66622. move.w d0,y_pos(a0)
  66623. bra.w loc_3411A
  66624. ; ===========================================================================
  66625.  
  66626. loc_34108:
  66627. move.w x_pos(a1),x_pos(a0)
  66628. move.w y_pos(a1),y_pos(a0)
  66629. move.b angle(a1),angle(a0)
  66630.  
  66631. loc_3411A:
  66632. moveq #0,d0
  66633. move.b angle(a0),d0
  66634. subi.b #$10,d0
  66635. lsr.b #5,d0
  66636. move.b d0,d1
  66637. lsl.w #3,d0
  66638. lea word_3417A(pc),a2
  66639. adda.w d0,a2
  66640. move.w (a2)+,art_tile(a0)
  66641. move.w (a2)+,d0
  66642. add.w d0,x_pos(a0)
  66643. move.w (a2)+,d0
  66644. add.w d0,y_pos(a0)
  66645. move.b (a2)+,mapping_frame(a0)
  66646. move.b render_flags(a0),d0
  66647. andi.b #$FC,d0
  66648. or.b (a2)+,d0
  66649. move.b d0,render_flags(a0)
  66650. tst.b angle(a0)
  66651. bpl.s return_34178
  66652. cmpi.b #3,d1
  66653. beq.s loc_34164
  66654. cmpi.b #7,d1
  66655. bne.s loc_3416A
  66656.  
  66657. loc_34164:
  66658. addi_.b #3,mapping_frame(a0)
  66659.  
  66660. loc_3416A:
  66661. move.w (SS_Offset_Y).w,d1
  66662. sub.w y_pos(a0),d1
  66663. add.w d1,d1
  66664. add.w d1,y_pos(a0)
  66665.  
  66666. return_34178:
  66667. rts
  66668. ; ===========================================================================
  66669. word_3417A:
  66670. dc.w make_art_tile(ArtTile_ArtNem_SpecialDiagShadow,3,0), $14, $14, $101
  66671. dc.w make_art_tile(ArtTile_ArtNem_SpecialFlatShadow,3,0), 0, $18, 0; 4
  66672. dc.w make_art_tile(ArtTile_ArtNem_SpecialDiagShadow,3,0),$FFEC, $14, $100; 8
  66673. dc.w make_art_tile(ArtTile_ArtNem_SpecialSideShadow,3,0),$FFEC, 0, $200; 12
  66674. dc.w make_art_tile(ArtTile_ArtNem_SpecialDiagShadow,3,0),$FFEC,$FFEC, $700; 16
  66675. dc.w make_art_tile(ArtTile_ArtNem_SpecialFlatShadow,3,0), 0,$FFE8, $900; 20
  66676. dc.w make_art_tile(ArtTile_ArtNem_SpecialDiagShadow,3,0), $14,$FFEC, $701; 24
  66677. dc.w make_art_tile(ArtTile_ArtNem_SpecialSideShadow,3,0), $14, 0, $201; 28
  66678. ; ===========================================================================
  66679.  
  66680. loc_341BA:
  66681. cmpi.b #1,anim(a1)
  66682. bne.s return_341E0
  66683. move.b status(a1),d1
  66684. andi.w #3,d1
  66685. cmpi.b #2,d1
  66686. bhs.s return_341E0
  66687. move.b byte_341E2(pc,d1.w),d0
  66688. ext.w d0
  66689. add.w d0,x_pos(a0)
  66690. subi_.w #4,y_pos(a0)
  66691.  
  66692. return_341E0:
  66693. rts
  66694. ; ===========================================================================
  66695. ; animation script
  66696. byte_341E2: dc.b 4, -4
  66697. off_341E4: offsetTable
  66698. offsetTableEntry.w byte_341EE ; 0
  66699. offsetTableEntry.w byte_341F4 ; 1
  66700. offsetTableEntry.w byte_341FE ; 2
  66701. offsetTableEntry.w byte_34204 ; 3
  66702. offsetTableEntry.w byte_34208 ; 4
  66703. byte_341EE:
  66704. dc.b 3, 0, 1, 2, 3,$FF
  66705. byte_341F4:
  66706. dc.b 3, 4, 5, 6, 7, 8, 9, $A, $B,$FF
  66707. byte_341FE:
  66708. dc.b 3, $C, $D, $E, $F,$FF
  66709. byte_34204:
  66710. dc.b 1,$10,$11,$FF
  66711. byte_34208:
  66712. dc.b 3, 0, 4, $C, 4, 0, 4, $C, 4,$FF
  66713. even
  66714. ; ----------------------------------------------------------------------------
  66715. ; sprite mappings - uses ArtNem_SpecialSonicAndTails
  66716. ; ----------------------------------------------------------------------------
  66717. Obj09_MapUnc_34212: BINCLUDE "mappings/sprite/obj09.bin"
  66718. ; ----------------------------------------------------------------------------
  66719. ; sprite mappings for special stage shadows
  66720. ; ----------------------------------------------------------------------------
  66721. Obj63_MapUnc_34492: BINCLUDE "mappings/sprite/obj63.bin"
  66722. ; ----------------------------------------------------------------------------
  66723. ; custom dynamic pattern loading cues for special stage Sonic, Tails and
  66724. ; Tails' tails
  66725. ; The first $12 frames are for Sonic, and the next $12 frames are for Tails.
  66726. ; The last $15 frames are for Tails' tails.
  66727. ; The first $24 frames are almost normal dplcs -- the only difference being
  66728. ; that the art tile to load is pre-shifted left by 4 bits.
  66729. ; The same applies to the last $15 frames, but they have yet another difference:
  66730. ; a small space optimization. These frames only have one dplc per frame ever,
  66731. ; hence the two-byte dplc count is removed from each frame.
  66732. ; ----------------------------------------------------------------------------
  66733. Obj09_MapRUnc_345FA: BINCLUDE "mappings/spriteDPLC/obj09.bin"
  66734. ; ===========================================================================
  66735.  
  66736. if ~~removeJmpTos
  66737. JmpTo42_DisplaySprite
  66738. jmp (DisplaySprite).l
  66739. JmpTo_SSSingleObjLoad
  66740. jmp (SSSingleObjLoad).l
  66741.  
  66742. align 4
  66743. endif
  66744.  
  66745.  
  66746.  
  66747.  
  66748. ; ===========================================================================
  66749. ; ----------------------------------------------------------------------------
  66750. ; Object 10 - Tails in Special Stage
  66751. ; ----------------------------------------------------------------------------
  66752. ; Sprite_347EC:
  66753. Obj10:
  66754. moveq #0,d0
  66755. move.b routine(a0),d0
  66756. move.w Obj10_Index(pc,d0.w),d1
  66757. jmp Obj10_Index(pc,d1.w)
  66758. ; ===========================================================================
  66759. ; off_347FA:
  66760. Obj10_Index: offsetTable
  66761. offsetTableEntry.w Obj10_Init ; 0
  66762. offsetTableEntry.w Obj10_MdNormal ; 1
  66763. offsetTableEntry.w Obj10_MdJump ; 2
  66764. offsetTableEntry.w Obj10_Index ; 3 - invalid
  66765. offsetTableEntry.w Obj10_MdAir ; 4
  66766. ; ===========================================================================
  66767. ; loc_34804:
  66768. Obj10_Init:
  66769. addq.b #2,routine(a0)
  66770. moveq #0,d0
  66771. move.w d0,ss_x_pos(a0)
  66772. move.w #$80,d1
  66773. move.w d1,ss_y_pos(a0)
  66774. add.w (SS_Offset_X).w,d0
  66775. move.w d0,x_pos(a0)
  66776. add.w (SS_Offset_Y).w,d1
  66777. move.w d1,y_pos(a0)
  66778. move.b #$E,y_radius(a0)
  66779. move.b #7,x_radius(a0)
  66780. move.l #Obj10_MapUnc_34B3E,mappings(a0)
  66781. move.w #make_art_tile(ArtTile_ArtNem_SpecialTails,2,0),art_tile(a0)
  66782. move.b #4,render_flags(a0)
  66783. move.b #2,priority(a0)
  66784. move.w #$80,ss_z_pos(a0)
  66785. tst.w (Player_mode).w
  66786. beq.s loc_34864
  66787. move.b #3,priority(a0)
  66788. move.w #$6E,ss_z_pos(a0)
  66789.  
  66790. loc_34864:
  66791. move.w #$400,ss_init_flip_timer(a0)
  66792. move.b #$40,angle(a0)
  66793. move.b #1,(Tails_LastLoadedDPLC).w
  66794. clr.b collision_property(a0)
  66795. clr.b ss_dplc_timer(a0)
  66796. bsr.w LoadSSTailsDynPLC
  66797. movea.l #SpecialStageShadow_Tails,a1
  66798. move.b #ObjID_SSShadow,id(a1) ; load obj63 (shadow) at $FFFFB180
  66799. move.w x_pos(a0),x_pos(a1)
  66800. move.w y_pos(a0),y_pos(a1)
  66801. addi.w #$18,y_pos(a1)
  66802. move.l #Obj63_MapUnc_34492,mappings(a1)
  66803. move.w #make_art_tile(ArtTile_ArtNem_SpecialFlatShadow,3,0),art_tile(a1)
  66804. move.b #4,render_flags(a1)
  66805. move.b #4,priority(a1)
  66806. move.l a0,ss_parent(a1)
  66807. movea.l #SpecialStageTails_Tails,a1
  66808. move.b #ObjID_SSTailsTails,id(a1) ; load obj88
  66809. move.w x_pos(a0),x_pos(a1)
  66810. move.w y_pos(a0),y_pos(a1)
  66811. move.l #Obj88_MapUnc_34DA8,mappings(a1)
  66812. move.w #make_art_tile(ArtTile_ArtNem_SpecialTails_Tails,2,0),art_tile(a1)
  66813. move.b #4,render_flags(a1)
  66814. move.b priority(a0),priority(a1)
  66815. subi_.b #1,priority(a1)
  66816. move.l a0,ss_parent(a1)
  66817. movea.l a1,a0
  66818. move.b #1,(TailsTails_LastLoadedDPLC).w
  66819. clr.b ss_dplc_timer(a0)
  66820. movea.l ss_parent(a0),a0 ; load 0bj address
  66821. rts
  66822. ; ===========================================================================
  66823.  
  66824. Obj10_MdNormal:
  66825. tst.b routine_secondary(a0)
  66826. bne.s Obj10_Hurt
  66827. bsr.w SSTailsCPU_Control
  66828. lea (Ctrl_2_Held_Logical).w,a2
  66829. tst.w (Player_mode).w
  66830. beq.s +
  66831. lea (Ctrl_1_Held_Logical).w,a2
  66832. +
  66833. bsr.w SSPlayer_Move
  66834. bsr.w SSPlayer_Traction
  66835. moveq #1,d0
  66836. bsr.w SSPlayerSwapPositions
  66837. bsr.w SSObjectMove
  66838. bsr.w SSAnglePos
  66839. lea (Ctrl_2_Press_Logical).w,a2
  66840. tst.w (Player_mode).w
  66841. beq.s +
  66842. lea (Ctrl_1_Press_Logical).w,a2
  66843. +
  66844. bsr.w SSPlayer_Jump
  66845. bsr.w SSPlayer_SetAnimation
  66846. lea (off_34B1C).l,a1
  66847. bsr.w SSPlayer_Animate
  66848. bsr.w SSPlayer_Collision
  66849. bra.w LoadSSTailsDynPLC
  66850. ; ===========================================================================
  66851.  
  66852. Obj10_Hurt:
  66853. bsr.w SSHurt_Animation
  66854. bsr.w SSPlayerSwapPositions
  66855. bsr.w SSObjectMove
  66856. bsr.w SSAnglePos
  66857. bra.w LoadSSTailsDynPLC
  66858. ; ===========================================================================
  66859.  
  66860. SSTailsCPU_Control:
  66861. tst.b (SS_2p_Flag).w
  66862. bne.s +
  66863. tst.w (Player_mode).w
  66864. beq.s ++
  66865. +
  66866. rts
  66867. ; ===========================================================================
  66868. +
  66869. move.b (Ctrl_2_Held_Logical).w,d0
  66870. andi.b #button_up_mask|button_down_mask|button_left_mask|button_right_mask|button_B_mask|button_C_mask|button_A_mask,d0
  66871. beq.s +
  66872. moveq #0,d0
  66873. moveq #3,d1
  66874. lea (SS_Ctrl_Record_Buf).w,a1
  66875. -
  66876. move.l d0,(a1)
  66877. move.l d0,(a1)
  66878. dbf d1,-
  66879. move.w #$B4,(Tails_control_counter).w
  66880. rts
  66881. ; ===========================================================================
  66882. +
  66883. tst.w (Tails_control_counter).w
  66884. beq.s +
  66885. subq.w #1,(Tails_control_counter).w
  66886. rts
  66887. ; ===========================================================================
  66888. +
  66889. lea (SS_Last_Ctrl_Record).w,a1
  66890. move.w (a1),(Ctrl_2_Logical).w
  66891. rts
  66892. ; ===========================================================================
  66893. dword_349B8:
  66894. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($183) ; Tails in upright position, $3D tiles
  66895. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($1C0) ; Tails in diagonal position, $A4 tiles
  66896. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($264) ; Tails in horizontal position, $3A tiles
  66897. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($29E) ; Tails in ball form, $10 tiles
  66898. ; ===========================================================================
  66899.  
  66900. LoadSSTailsDynPLC:
  66901. move.b ss_dplc_timer(a0),d0
  66902. beq.s +
  66903. subq.b #1,d0
  66904. move.b d0,ss_dplc_timer(a0)
  66905. andi.b #1,d0
  66906. beq.s +
  66907. rts
  66908. ; ===========================================================================
  66909. +
  66910. jsrto (DisplaySprite).l, JmpTo43_DisplaySprite
  66911. lea dword_349B8(pc),a3
  66912. lea (Tails_LastLoadedDPLC).w,a4
  66913. move.w #tiles_to_bytes(ArtTile_ArtNem_SpecialTails),d4
  66914. moveq #$12,d1
  66915. bra.w LoadSSPlayerDynPLC
  66916. ; ===========================================================================
  66917.  
  66918. Obj10_MdJump:
  66919. lea (Ctrl_2_Held_Logical).w,a2
  66920. tst.w (Player_mode).w
  66921. beq.s +
  66922. lea (Ctrl_1_Held_Logical).w,a2
  66923. +
  66924. bsr.w SSPlayer_ChgJumpDir
  66925. bsr.w SSObjectMoveAndFall
  66926. bsr.w SSPlayer_DoLevelCollision
  66927. bsr.w SSPlayerSwapPositions
  66928. bsr.w SSAnglePos
  66929. bsr.w SSPlayer_JumpAngle
  66930. lea (off_34B1C).l,a1
  66931. bsr.w SSPlayer_Animate
  66932. bra.s LoadSSTailsDynPLC
  66933. ; ===========================================================================
  66934.  
  66935. Obj10_MdAir:
  66936. lea (Ctrl_2_Held_Logical).w,a2
  66937. tst.w (Player_mode).w
  66938. beq.s +
  66939. lea (Ctrl_1_Held_Logical).w,a2
  66940. +
  66941. bsr.w SSPlayer_ChgJumpDir
  66942. bsr.w SSObjectMoveAndFall
  66943. bsr.w SSPlayer_JumpAngle
  66944. bsr.w SSPlayer_DoLevelCollision
  66945. bsr.w SSPlayerSwapPositions
  66946. bsr.w SSAnglePos
  66947. bsr.w SSPlayer_SetAnimation
  66948. lea (off_34B1C).l,a1
  66949. bsr.w SSPlayer_Animate
  66950. bra.w LoadSSTailsDynPLC
  66951. ; ===========================================================================
  66952. ; ----------------------------------------------------------------------------
  66953. ; Object 88 - Tails' tails in Special Stage
  66954. ; ----------------------------------------------------------------------------
  66955. ; Sprite_34A5C:
  66956. Obj88:
  66957. movea.l ss_parent(a0),a1 ; load obj address of Tails
  66958. move.w x_pos(a1),x_pos(a0)
  66959. move.w y_pos(a1),y_pos(a0)
  66960. move.b render_flags(a1),render_flags(a0)
  66961. move.b status(a1),status(a0)
  66962. move.b anim(a1),anim(a0)
  66963. move.b priority(a1),d0
  66964. subq.b #1,d0
  66965. move.b d0,priority(a0)
  66966. cmpi.b #3,anim(a0)
  66967. bhs.s return_34A9E
  66968. lea (Ani_obj88).l,a1
  66969. jsrto (AnimateSprite).l, JmpTo23_AnimateSprite
  66970. bra.w LoadSSTailsTailsDynPLC
  66971. ; ===========================================================================
  66972.  
  66973. return_34A9E:
  66974. rts
  66975. ; ===========================================================================
  66976. dword_34AA0:
  66977. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($2AE) ; Tails' tails when he is in upright position, $35 tiles
  66978. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($2E3) ; Tails' tails when he is in diagonal position, $3B tiles
  66979. dc.l (SSRAM_ArtNem_SpecialSonicAndTails & $FFFFFF) + tiles_to_bytes($31E) ; Tails' tails when he is in horizontal position, $35 tiles
  66980. ; ===========================================================================
  66981.  
  66982. LoadSSTailsTailsDynPLC:
  66983. movea.l ss_parent(a0),a1 ; load obj address of Tails
  66984. move.b ss_dplc_timer(a1),d0
  66985. beq.s +
  66986. andi.b #1,d0
  66987. beq.s +
  66988. rts
  66989. ; ===========================================================================
  66990. +
  66991. jsrto (DisplaySprite).l, JmpTo43_DisplaySprite
  66992. moveq #0,d0
  66993. move.b mapping_frame(a0),d0
  66994. cmp.b (TailsTails_LastLoadedDPLC).w,d0
  66995. beq.s return_34B1A
  66996. move.b d0,(TailsTails_LastLoadedDPLC).w
  66997. moveq #0,d6
  66998. cmpi.b #7,d0
  66999. blt.s loc_34AE4
  67000. addq.w #4,d6
  67001. cmpi.b #$E,d0
  67002. blt.s loc_34AE4
  67003. addq.w #4,d6
  67004.  
  67005. loc_34AE4:
  67006. move.l dword_34AA0(pc,d6.w),d6
  67007. addi.w #$24,d0
  67008. add.w d0,d0
  67009. lea (Obj09_MapRUnc_345FA).l,a2
  67010. adda.w (a2,d0.w),a2
  67011. move.w #tiles_to_bytes(ArtTile_ArtNem_SpecialTails_Tails),d2
  67012. moveq #0,d1
  67013. move.w (a2)+,d1
  67014. move.w d1,d3
  67015. lsr.w #8,d3
  67016. andi.w #$F0,d3
  67017. addi.w #$10,d3
  67018. andi.w #$FFF,d1
  67019. lsl.w #1,d1
  67020. add.l d6,d1
  67021. jsr (QueueDMATransfer).l
  67022.  
  67023. return_34B1A:
  67024. rts
  67025. ; ===========================================================================
  67026. off_34B1C: offsetTable
  67027. offsetTableEntry.w byte_34B24 ; 0
  67028. offsetTableEntry.w byte_34B2A ; 1
  67029. offsetTableEntry.w byte_34B34 ; 2
  67030. offsetTableEntry.w byte_34B3A ; 3
  67031. byte_34B24:
  67032. dc.b 3, 0, 1, 2, 3,$FF
  67033. byte_34B2A:
  67034. dc.b 3, 4, 5, 6, 7, 8, 9, $A, $B,$FF
  67035. byte_34B34:
  67036. dc.b 3, $C, $D, $E, $F,$FF
  67037. byte_34B3A:
  67038. dc.b 1,$10,$11,$FF
  67039. ; ----------------------------------------------------------------------------
  67040. ; sprite mappings
  67041. ; ----------------------------------------------------------------------------
  67042. Obj10_MapUnc_34B3E: BINCLUDE "mappings/sprite/obj10.bin"
  67043.  
  67044. ; animation script
  67045. ; off_34D86:
  67046. Ani_obj88: offsetTable
  67047. offsetTableEntry.w byte_34D8C ; 0
  67048. offsetTableEntry.w byte_34D95 ; 1
  67049. offsetTableEntry.w byte_34D9E ; 2
  67050. byte_34D8C: dc.b 3, 0, 1, 2, 3, 4, 5, 6,$FF
  67051. rev02even
  67052. byte_34D95: dc.b 3, 7, 8, 9, $A, $B, $C, $D,$FF
  67053. rev02even
  67054. byte_34D9E: dc.b 3, $E, $F,$10,$11,$12,$13,$14,$FF
  67055. even
  67056. ; ----------------------------------------------------------------------------
  67057. ; sprite mappings for Tails' tails in special stage
  67058. ; ----------------------------------------------------------------------------
  67059. Obj88_MapUnc_34DA8: BINCLUDE "mappings/sprite/obj88.bin"
  67060. ; ===========================================================================
  67061.  
  67062. if ~~removeJmpTos
  67063. JmpTo43_DisplaySprite
  67064. jmp (DisplaySprite).l
  67065. JmpTo23_AnimateSprite
  67066. jmp (AnimateSprite).l
  67067.  
  67068. align 4
  67069. endif
  67070.  
  67071.  
  67072.  
  67073.  
  67074. ; ===========================================================================
  67075. ; ----------------------------------------------------------------------------
  67076. ; Object 61 - Bombs from Special Stage
  67077. ; ----------------------------------------------------------------------------
  67078. ; Sprite_34EB0:
  67079. Obj61:
  67080. moveq #0,d0
  67081. move.b routine(a0),d0
  67082. move.w Obj61_Index(pc,d0.w),d1
  67083. jmp Obj61_Index(pc,d1.w)
  67084. ; ===========================================================================
  67085. ; off_34EBE:
  67086. Obj61_Index: offsetTable
  67087. offsetTableEntry.w Obj61_Init ; 0
  67088. offsetTableEntry.w loc_34F06 ; 2
  67089. offsetTableEntry.w loc_3533A ; 4
  67090. offsetTableEntry.w loc_34F6A ; 6
  67091. ; ===========================================================================
  67092. ; loc_34EC6:
  67093. Obj61_Init:
  67094. addq.b #2,routine(a0)
  67095. move.w #$7F,x_pos(a0)
  67096. move.w #$58,y_pos(a0)
  67097. move.l #Obj61_MapUnc_36508,mappings(a0)
  67098. move.w #make_art_tile(ArtTile_ArtNem_SpecialBomb,1,0),art_tile(a0)
  67099. move.b #4,render_flags(a0)
  67100. move.b #3,priority(a0)
  67101. move.b #2,collision_flags(a0)
  67102. move.b #-1,(SS_unk_DB4D).w
  67103. tst.b angle(a0)
  67104. bmi.s loc_34F06
  67105. bsr.w loc_3529C
  67106.  
  67107. loc_34F06:
  67108. bsr.w loc_3512A
  67109. bsr.w loc_351A0
  67110. lea (Ani_obj61).l,a1
  67111. bsr.w loc_3539E
  67112. tst.b render_flags(a0)
  67113. bpl.s return_34F26
  67114. bsr.w loc_34F28
  67115. bra.w JmpTo44_DisplaySprite
  67116. ; ===========================================================================
  67117.  
  67118. return_34F26:
  67119. rts
  67120. ; ===========================================================================
  67121.  
  67122. loc_34F28:
  67123. move.w #8,d6
  67124. bsr.w loc_350A0
  67125. bcc.s return_34F68
  67126. move.b #1,collision_property(a1)
  67127. move.w #SndID_SlowSmash,d0
  67128. jsr (PlaySoundStereo).l
  67129. move.b #6,routine(a0)
  67130. move.b #0,anim_frame(a0)
  67131. move.b #0,anim_frame_duration(a0)
  67132. move.l objoff_34(a0),d0
  67133. beq.s return_34F68
  67134. move.l #0,objoff_34(a0)
  67135. movea.l d0,a1 ; a1=object
  67136. st objoff_2A(a1)
  67137.  
  67138. return_34F68:
  67139. rts
  67140. ; ===========================================================================
  67141.  
  67142. loc_34F6A:
  67143. move.b #$A,anim(a0)
  67144. move.w #make_art_tile(ArtTile_ArtNem_SpecialExplosion,2,0),art_tile(a0)
  67145. bsr.w loc_34F90
  67146. bsr.w loc_3512A
  67147. bsr.w loc_351A0
  67148. lea (Ani_obj61).l,a1
  67149. jsrto (AnimateSprite).l, JmpTo24_AnimateSprite
  67150. bra.w JmpTo44_DisplaySprite
  67151. ; ===========================================================================
  67152.  
  67153. loc_34F90:
  67154. cmpi.w #4,objoff_30(a0)
  67155. bhs.s return_34F9E
  67156. move.b #1,priority(a0)
  67157.  
  67158. return_34F9E:
  67159. rts
  67160. ; ===========================================================================
  67161. ; ----------------------------------------------------------------------------
  67162. ; Object 60 - Rings from Special Stage
  67163. ; ----------------------------------------------------------------------------
  67164. ; Sprite_34FA0:
  67165. Obj60:
  67166. moveq #0,d0
  67167. move.b routine(a0),d0
  67168. move.w Obj60_Index(pc,d0.w),d1
  67169. jmp Obj60_Index(pc,d1.w)
  67170. ; ===========================================================================
  67171. ; off_34FAE:
  67172. Obj60_Index: offsetTable
  67173. offsetTableEntry.w Obj60_Init ; 0
  67174. offsetTableEntry.w loc_34FF0 ; 1
  67175. offsetTableEntry.w loc_3533A ; 2
  67176. offsetTableEntry.w loc_35010 ; 3
  67177. ; ===========================================================================
  67178. ; loc_34FB6:
  67179. Obj60_Init:
  67180. addq.b #2,routine(a0)
  67181. move.w #$7F,x_pos(a0)
  67182. move.w #$58,y_pos(a0)
  67183. move.l #Obj5A_Obj5B_Obj60_MapUnc_3632A,mappings(a0)
  67184. move.w #make_art_tile(ArtTile_ArtNem_SpecialRings,3,0),art_tile(a0)
  67185. move.b #4,render_flags(a0)
  67186. move.b #3,priority(a0)
  67187. move.b #1,collision_flags(a0)
  67188. tst.b angle(a0)
  67189. bmi.s loc_34FF0
  67190. bsr.w loc_3529C
  67191.  
  67192. loc_34FF0:
  67193.  
  67194. bsr.w loc_3512A
  67195. bsr.w loc_351A0
  67196. bsr.w loc_35036
  67197. lea (Ani_obj5B_obj60).l,a1
  67198. bsr.w loc_3539E
  67199. tst.b render_flags(a0)
  67200. bmi.w JmpTo44_DisplaySprite
  67201. rts
  67202. ; ===========================================================================
  67203.  
  67204. loc_35010:
  67205. move.b #$A,anim(a0)
  67206. move.w #make_art_tile(ArtTile_ArtNem_SpecialStars,2,0),art_tile(a0)
  67207. bsr.w loc_34F90
  67208. bsr.w loc_3512A
  67209. bsr.w loc_351A0
  67210. lea (Ani_obj5B_obj60).l,a1
  67211. jsrto (AnimateSprite).l, JmpTo24_AnimateSprite
  67212. bra.w JmpTo44_DisplaySprite
  67213. ; ===========================================================================
  67214.  
  67215. loc_35036:
  67216. move.w #$A,d6
  67217. bsr.w loc_350A0
  67218. bcc.s return_3509E
  67219. cmpa.l #MainCharacter,a1
  67220. bne.s loc_3504E
  67221. addq.w #1,(Ring_count).w
  67222. bra.s loc_35052
  67223. ; ===========================================================================
  67224.  
  67225. loc_3504E:
  67226. addq.w #1,(Ring_count_2P).w
  67227.  
  67228. loc_35052:
  67229. addq.b #1,ss_rings_units(a1)
  67230. cmpi.b #$A,ss_rings_units(a1)
  67231. blt.s loc_3507A
  67232. addq.b #1,ss_rings_tens(a1)
  67233. move.b #0,ss_rings_units(a1)
  67234. cmpi.b #$A,ss_rings_tens(a1)
  67235. blt.s loc_3507A
  67236. addq.b #1,ss_rings_hundreds(a1)
  67237. move.b #0,ss_rings_tens(a1)
  67238.  
  67239. loc_3507A:
  67240. move.b #6,routine(a0)
  67241. move.l objoff_34(a0),d0
  67242. beq.s loc_35094
  67243. move.l #0,objoff_34(a0)
  67244. movea.l d0,a1 ; a1=object
  67245. st objoff_2A(a1)
  67246.  
  67247. loc_35094:
  67248. move.w #SndID_Ring,d0
  67249. jsr (PlaySoundStereo).l
  67250.  
  67251. return_3509E:
  67252. rts
  67253. ; ===========================================================================
  67254.  
  67255. loc_350A0:
  67256. cmpi.b #8,anim(a0)
  67257. bne.s loc_350DC
  67258. tst.b collision_flags(a0)
  67259. beq.s loc_350DC
  67260. lea (MainCharacter).w,a2 ; a2=object (special stage sonic)
  67261. lea (Sidekick).w,a3 ; a3=object (special stage tails)
  67262. move.w objoff_34(a2),d0
  67263. cmp.w objoff_34(a3),d0
  67264. blo.s loc_350CE
  67265. movea.l a3,a1
  67266. bsr.w loc_350E2
  67267. bcs.s return_350E0
  67268. movea.l a2,a1
  67269. bra.w loc_350E2
  67270. ; ===========================================================================
  67271.  
  67272. loc_350CE:
  67273. movea.l a2,a1
  67274. bsr.w loc_350E2
  67275. bcs.s return_350E0
  67276. movea.l a3,a1
  67277. bra.w loc_350E2
  67278. ; ===========================================================================
  67279.  
  67280. loc_350DC:
  67281. move #0,ccr
  67282.  
  67283. return_350E0:
  67284. rts
  67285. ; ===========================================================================
  67286.  
  67287. loc_350E2:
  67288. tst.b (a1)
  67289. beq.s loc_3511A
  67290. cmpi.b #2,routine(a1)
  67291. bne.s loc_3511A
  67292. tst.b routine_secondary(a1)
  67293. bne.s loc_3511A
  67294. move.b angle(a1),d0
  67295. move.b angle(a0),d1
  67296. move.b d1,d2
  67297. add.b d6,d1
  67298. bcs.s loc_35110
  67299. sub.b d6,d2
  67300. bcs.s loc_35112
  67301. cmp.b d1,d0
  67302. bhs.s loc_3511A
  67303. cmp.b d2,d0
  67304. bhs.s loc_35120
  67305. bra.s loc_3511A
  67306. ; ===========================================================================
  67307.  
  67308. loc_35110:
  67309. sub.b d6,d2
  67310.  
  67311. loc_35112:
  67312. cmp.b d1,d0
  67313. blo.s loc_35120
  67314. cmp.b d2,d0
  67315. bhs.s loc_35120
  67316.  
  67317. loc_3511A:
  67318. move #0,ccr
  67319. rts
  67320. ; ===========================================================================
  67321.  
  67322. loc_35120:
  67323. clr.b collision_flags(a0)
  67324. move #1,ccr
  67325. rts
  67326. ; ===========================================================================
  67327.  
  67328. loc_3512A:
  67329. btst #7,status(a0)
  67330. bne.s loc_3516C
  67331. cmpi.b #4,(SSTrack_drawing_index).w
  67332. bne.s loc_35146
  67333. subi.l #$CCCC,objoff_30(a0)
  67334. ble.s loc_3516C
  67335. bra.s loc_35150
  67336. ; ===========================================================================
  67337.  
  67338. loc_35146:
  67339. subi.l #$CCCD,objoff_30(a0)
  67340. ble.s loc_3516C
  67341.  
  67342. loc_35150:
  67343. cmpi.b #$A,anim(a0)
  67344. beq.s return_3516A
  67345. move.w objoff_30(a0),d0
  67346. cmpi.w #$1D,d0
  67347. ble.s loc_35164
  67348. moveq #$1E,d0
  67349.  
  67350. loc_35164:
  67351. move.b byte_35180(pc,d0.w),anim(a0)
  67352.  
  67353. return_3516A:
  67354. rts
  67355. ; ===========================================================================
  67356.  
  67357. loc_3516C:
  67358. move.l (sp)+,d0
  67359. move.l objoff_34(a0),d0
  67360. beq.w JmpTo63_DeleteObject
  67361. movea.l d0,a1 ; a1=object
  67362. st objoff_2A(a1)
  67363.  
  67364. if removeJmpTos
  67365. JmpTo63_DeleteObject
  67366. endif
  67367.  
  67368. jmpto (DeleteObject).l, JmpTo63_DeleteObject
  67369. ; ===========================================================================
  67370. byte_35180:
  67371. dc.b 9, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 3
  67372. dc.b 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0; 16
  67373. ; ===========================================================================
  67374.  
  67375. loc_351A0:
  67376. move.w d7,-(sp)
  67377. moveq #0,d2
  67378. moveq #0,d3
  67379. moveq #0,d4
  67380. moveq #0,d5
  67381. moveq #0,d6
  67382. moveq #0,d7
  67383. movea.l (SS_CurrentPerspective).w,a1
  67384. move.w objoff_30(a0),d0
  67385. beq.w loc_35258
  67386. cmp.w (a1)+,d0
  67387. bgt.w loc_35258
  67388. subq.w #1,d0
  67389. add.w d0,d0
  67390. move.w d0,d1
  67391. add.w d0,d0
  67392. add.w d1,d0
  67393. tst.b (SSTrack_Orientation).w
  67394. bne.w loc_35260
  67395. move.b 4(a1,d0.w),d6
  67396. move.b 5(a1,d0.w),d7
  67397. beq.s loc_351E8
  67398. move.b angle(a0),d1
  67399. cmp.b d6,d1
  67400. blo.s loc_351E8
  67401. cmp.b d7,d1
  67402. blo.s loc_35258
  67403.  
  67404. loc_351E8:
  67405. move.b (a1,d0.w),d2
  67406. move.b 2(a1,d0.w),d4
  67407. move.b 3(a1,d0.w),d5
  67408. move.b 1(a1,d0.w),d3
  67409.  
  67410. loc_351F8:
  67411. bpl.s loc_35202
  67412. cmpi.b #$48,d3
  67413. blo.s loc_35202
  67414. ext.w d3
  67415.  
  67416. loc_35202:
  67417. move.b angle(a0),d0
  67418. jsrto (CalcSine).l, JmpTo14_CalcSine
  67419. muls.w d4,d1
  67420. muls.w d5,d0
  67421. asr.l #8,d0
  67422. asr.l #8,d1
  67423. add.w d2,d1
  67424. add.w d3,d0
  67425. move.w d1,x_pos(a0)
  67426. move.w d0,y_pos(a0)
  67427. move.l objoff_34(a0),d0
  67428. beq.s loc_3524E
  67429. movea.l d0,a1 ; a1=object
  67430. move.b angle(a0),d0
  67431. jsrto (CalcSine).l, JmpTo14_CalcSine
  67432. move.w d4,d7
  67433. lsr.w #2,d7
  67434. add.w d7,d4
  67435. muls.w d4,d1
  67436. move.w d5,d7
  67437. asr.w #2,d7
  67438. add.w d7,d5
  67439. muls.w d5,d0
  67440. asr.l #8,d0
  67441. asr.l #8,d1
  67442. add.w d2,d1
  67443. add.w d3,d0
  67444. move.w d1,x_pos(a1)
  67445. move.w d0,y_pos(a1)
  67446.  
  67447. loc_3524E:
  67448. ori.b #$80,render_flags(a0)
  67449.  
  67450. loc_35254:
  67451. move.w (sp)+,d7
  67452. rts
  67453. ; ===========================================================================
  67454.  
  67455. loc_35258:
  67456. andi.b #$7F,render_flags(a0)
  67457. bra.s loc_35254
  67458. ; ===========================================================================
  67459.  
  67460. loc_35260:
  67461. move.b #$80,d1
  67462. move.b 4(a1,d0.w),d6
  67463. move.b 5(a1,d0.w),d7
  67464. beq.s loc_35282
  67465. sub.w d1,d6
  67466. sub.w d1,d7
  67467. neg.w d6
  67468. neg.w d7
  67469. move.b angle(a0),d1
  67470. cmp.b d7,d1
  67471. blo.s loc_35282
  67472. cmp.b d6,d1
  67473. blo.s loc_35258
  67474.  
  67475. loc_35282:
  67476. move.b (a1,d0.w),d2
  67477. move.b 2(a1,d0.w),d4
  67478. move.b 3(a1,d0.w),d5
  67479. subi.w #$100,d2
  67480. neg.w d2
  67481. move.b 1(a1,d0.w),d3
  67482. bra.w loc_351F8
  67483. ; ===========================================================================
  67484.  
  67485. loc_3529C:
  67486. jsrto (SSSingleObjLoad2).l, JmpTo_SSSingleObjLoad2
  67487. bne.w return_3532C
  67488. move.l a0,objoff_34(a1)
  67489. move.b (a0),(a1)
  67490. move.b #4,routine(a1)
  67491. move.l #Obj63_MapUnc_34492,mappings(a1)
  67492. move.w #make_art_tile(ArtTile_ArtNem_SpecialFlatShadow,3,0),art_tile(a1)
  67493. move.b #4,render_flags(a1)
  67494. move.b #5,priority(a1)
  67495. move.b angle(a0),d0
  67496. cmpi.b #$10,d0
  67497. bgt.s loc_352E6
  67498. bset #0,render_flags(a1)
  67499. move.b #2,objoff_2B(a1)
  67500. move.l a1,objoff_34(a0)
  67501. rts
  67502. ; ===========================================================================
  67503.  
  67504. loc_352E6:
  67505. cmpi.b #$30,d0
  67506. bgt.s loc_352FE
  67507. bset #0,render_flags(a1)
  67508. move.b #1,objoff_2B(a1)
  67509. move.l a1,objoff_34(a0)
  67510. rts
  67511. ; ===========================================================================
  67512.  
  67513. loc_352FE:
  67514. cmpi.b #$50,d0
  67515. bgt.s loc_35310
  67516. move.b #0,objoff_2B(a1)
  67517. move.l a1,objoff_34(a0)
  67518. rts
  67519. ; ===========================================================================
  67520.  
  67521. loc_35310:
  67522. cmpi.b #$70,d0
  67523. bgt.s loc_35322
  67524. move.b #1,objoff_2B(a1)
  67525. move.l a1,objoff_34(a0)
  67526. rts
  67527. ; ===========================================================================
  67528.  
  67529. loc_35322:
  67530. move.b #2,objoff_2B(a1)
  67531. move.l a1,objoff_34(a0)
  67532.  
  67533. return_3532C:
  67534. rts
  67535. ; ===========================================================================
  67536. dc.b 0
  67537. dc.b 0 ; 1
  67538. dc.b 0 ; 2
  67539. dc.b $18 ; 3
  67540. dc.b 0 ; 4
  67541. dc.b $14 ; 5
  67542. dc.b 0 ; 6
  67543. dc.b $14 ; 7
  67544. dc.b 0 ; 8
  67545. dc.b $14 ; 9
  67546. dc.b 0 ; 10
  67547. dc.b 0 ; 11
  67548. ; ===========================================================================
  67549.  
  67550. loc_3533A:
  67551. tst.b objoff_2A(a0)
  67552. bne.w BranchTo_JmpTo63_DeleteObject
  67553. movea.l objoff_34(a0),a1 ; a1=object
  67554. tst.b render_flags(a1)
  67555. bmi.s loc_3534E
  67556. rts
  67557. ; ===========================================================================
  67558.  
  67559. loc_3534E:
  67560. moveq #9,d0
  67561. sub.b anim(a1),d0
  67562. addi_.b #1,d0
  67563. cmpi.b #$A,d0
  67564. bne.s loc_35362
  67565. move.w #9,d0
  67566.  
  67567. loc_35362:
  67568. move.w d0,d1
  67569. add.w d0,d0
  67570. add.w d1,d0
  67571. moveq #0,d1
  67572. move.b objoff_2B(a0),d1
  67573. beq.s loc_3538A
  67574. cmpi.b #1,d1
  67575. beq.s loc_35380
  67576. add.w d1,d0
  67577. move.w #make_art_tile(ArtTile_ArtNem_SpecialSideShadow,3,0),art_tile(a0)
  67578. bra.s loc_35392
  67579. ; ===========================================================================
  67580.  
  67581. loc_35380:
  67582. add.w d1,d0
  67583. move.w #make_art_tile(ArtTile_ArtNem_SpecialDiagShadow,3,0),art_tile(a0)
  67584. bra.s loc_35392
  67585. ; ===========================================================================
  67586.  
  67587. loc_3538A:
  67588. add.w d1,d0
  67589. move.w #make_art_tile(ArtTile_ArtNem_SpecialFlatShadow,3,0),art_tile(a0)
  67590.  
  67591. loc_35392:
  67592. move.b d0,mapping_frame(a0)
  67593. bra.w JmpTo44_DisplaySprite
  67594. ; ===========================================================================
  67595.  
  67596. BranchTo_JmpTo63_DeleteObject
  67597. jmpto (DeleteObject).l, JmpTo63_DeleteObject
  67598. ; ===========================================================================
  67599.  
  67600. loc_3539E:
  67601. subq.b #1,anim_frame_duration(a0)
  67602. bpl.s return_353E8
  67603. moveq #0,d0
  67604. move.b anim(a0),d0
  67605. add.w d0,d0
  67606. adda.w (a1,d0.w),a1
  67607. move.b (a1),anim_frame_duration(a0)
  67608. moveq #0,d1
  67609. move.b anim_frame(a0),d1
  67610. move.b 1(a1,d1.w),d0
  67611. bpl.s loc_353CA
  67612. move.b #0,anim_frame(a0)
  67613. move.b 1(a1),d0
  67614.  
  67615. loc_353CA:
  67616. andi.b #$7F,d0
  67617. move.b d0,mapping_frame(a0)
  67618. move.b status(a0),d1
  67619. andi.b #3,d1
  67620. andi.b #$FC,render_flags(a0)
  67621. or.b d1,render_flags(a0)
  67622. addq.b #1,anim_frame(a0)
  67623.  
  67624. return_353E8:
  67625. rts
  67626. ; ===========================================================================
  67627. byte_353EA:
  67628. dc.b $38
  67629. dc.b $48 ; 1
  67630. dc.b $2A ; 2
  67631. dc.b $56 ; 3
  67632. dc.b $1C ; 4
  67633. dc.b $64 ; 5
  67634. dc.b $E ; 6
  67635. dc.b $72 ; 7
  67636. dc.b 0 ; 8
  67637. dc.b $80 ; 9
  67638. byte_353F4:
  67639. dc.b $40
  67640. dc.b $30 ; 1
  67641. dc.b $50 ; 2
  67642. dc.b $20 ; 3
  67643. dc.b $60 ; 4
  67644. dc.b $10 ; 5
  67645. dc.b $70 ; 6
  67646. dc.b 0 ; 7
  67647. dc.b $80 ; 8
  67648. dc.b 0 ; 9
  67649. ; ===========================================================================
  67650. ; ----------------------------------------------------------------------------
  67651. ; Object 5B - Ring spray/spill in Special Stage
  67652. ; ----------------------------------------------------------------------------
  67653. ; Sprite_353FE:
  67654. Obj5B:
  67655. moveq #0,d0
  67656. move.b routine(a0),d0
  67657. move.w Obj5B_Index(pc,d0.w),d1
  67658. jmp Obj5B_Index(pc,d1.w)
  67659. ; ===========================================================================
  67660. ; off_3540C:
  67661. Obj5B_Index: offsetTable
  67662. offsetTableEntry.w Obj5B_Init ; 0
  67663. offsetTableEntry.w Obj5B_Main ; 2
  67664. ; ===========================================================================
  67665. ; loc_35410:
  67666. Obj5B_Init:
  67667. movea.l ss_parent(a0),a3
  67668. moveq #0,d1
  67669. move.b ss_rings_tens(a3),d1
  67670. beq.s loc_35428
  67671. subi_.b #1,ss_rings_tens(a3)
  67672. move.w #$A,d1
  67673. bra.s loc_35458
  67674. ; ===========================================================================
  67675.  
  67676. loc_35428:
  67677. move.b ss_rings_hundreds(a3),d1
  67678. beq.s loc_35440
  67679. subi_.b #1,ss_rings_hundreds(a3)
  67680. move.b #9,ss_rings_tens(a3)
  67681. move.w #$A,d1
  67682. bra.s loc_35458
  67683. ; ===========================================================================
  67684.  
  67685. loc_35440:
  67686. move.b ss_rings_units(a3),d1
  67687. beq.s loc_3545C
  67688. move.b #0,ss_rings_units(a3)
  67689. btst #0,d1
  67690. beq.s loc_35458
  67691. lea_ byte_353F4,a2
  67692. bra.s loc_3545C
  67693. ; ===========================================================================
  67694.  
  67695. loc_35458:
  67696. lea_ byte_353EA,a2
  67697. loc_3545C:
  67698. cmpi.b #ObjID_SonicSS,(a3)
  67699. bne.s loc_35468
  67700. sub.w d1,(Ring_count).w
  67701. bra.s loc_3546C
  67702. ; ===========================================================================
  67703.  
  67704. loc_35468:
  67705. sub.w d1,(Ring_count_2P).w
  67706.  
  67707. loc_3546C:
  67708. move.w d1,d2
  67709. subq.w #1,d2
  67710. bmi.w JmpTo63_DeleteObject
  67711. movea.l a0,a1
  67712. bra.s loc_3547E
  67713. ; ===========================================================================
  67714.  
  67715. loc_35478:
  67716. jsrto (SSSingleObjLoad).l, JmpTo2_SSSingleObjLoad
  67717. bne.s loc_354DE
  67718.  
  67719. loc_3547E:
  67720. move.b #ObjID_SSRingSpill,id(a1) ; load obj5B
  67721. move.b #2,routine(a1)
  67722. move.l #Obj5A_Obj5B_Obj60_MapUnc_3632A,mappings(a1)
  67723. move.w #make_art_tile(ArtTile_ArtNem_SpecialRings,3,0),art_tile(a1)
  67724. move.b #4,render_flags(a1)
  67725. move.b #5,priority(a1)
  67726. move.b #0,collision_flags(a1)
  67727. move.b #8,anim(a1)
  67728. move.w x_pos(a3),x_pos(a1)
  67729. move.w y_pos(a3),y_pos(a1)
  67730. move.b angle(a3),d0
  67731. addi.b #$40,d0
  67732. add.b (a2)+,d0
  67733. jsr (CalcSine).l
  67734. muls.w #$400,d1
  67735. asr.l #8,d1
  67736. move.w d1,x_vel(a1)
  67737. muls.w #$1000,d0
  67738. asr.l #8,d0
  67739. move.w d0,y_vel(a1)
  67740.  
  67741. loc_354DE:
  67742. dbf d2,loc_35478
  67743. rts
  67744. ; ===========================================================================
  67745. ; loc_354E4:
  67746. Obj5B_Main:
  67747. jsrto (ObjectMoveAndFall).l, JmpTo7_ObjectMoveAndFall
  67748. addi.w #$80,y_vel(a0)
  67749. bsr.w loc_3551C
  67750. tst.w x_pos(a0)
  67751. bmi.w JmpTo63_DeleteObject
  67752. cmpi.w #$100,x_pos(a0)
  67753. bhs.w JmpTo63_DeleteObject
  67754. cmpi.w #$E0,y_pos(a0)
  67755. bgt.w JmpTo63_DeleteObject
  67756. lea (Ani_obj5B_obj60).l,a1
  67757. jsrto (AnimateSprite).l, JmpTo24_AnimateSprite
  67758. bra.w JmpTo44_DisplaySprite
  67759. ; ===========================================================================
  67760.  
  67761. loc_3551C:
  67762. tst.w y_vel(a0)
  67763. bmi.w +
  67764. move.b #0,priority(a0)
  67765. move.b #9,anim(a0)
  67766. +
  67767. rts
  67768. ; ===========================================================================
  67769. rts
  67770. ; ===========================================================================
  67771.  
  67772. SSRainbowPaletteColors:
  67773. move.w word_35548(pc,d0.w),(Normal_palette_line4+$16).w
  67774. move.w word_35548+2(pc,d0.w),(Normal_palette_line4+$18).w
  67775. move.w word_35548+4(pc,d0.w),(Normal_palette_line4+$1A).w
  67776. rts
  67777. ; ===========================================================================
  67778. word_35548:
  67779. dc.w $EE, $88, $44
  67780. dc.w $EE, $CC, $88 ; 3
  67781. ; ===========================================================================
  67782. ; ----------------------------------------------------------------------------
  67783. ; Object 5A - Messages/checkpoint from Special Stage
  67784. ; ----------------------------------------------------------------------------
  67785. ; Sprite_35554:
  67786. Obj5A:
  67787. moveq #0,d0
  67788. move.b routine(a0),d0
  67789. move.w Obj5A_Index(pc,d0.w),d1
  67790. jmp Obj5A_Index(pc,d1.w)
  67791. ; ===========================================================================
  67792. ; off_35562:
  67793. Obj5A_Index: offsetTable
  67794. offsetTableEntry.w Obj5A_Init ; 0
  67795. offsetTableEntry.w Obj5A_CheckpointRainbow ; 2
  67796. offsetTableEntry.w Obj5A_TextFlyoutInit ; 4
  67797. offsetTableEntry.w Obj5A_Handshake ; 6
  67798. offsetTableEntry.w Obj5A_TextFlyout ; 8
  67799. offsetTableEntry.w Obj5A_MostRingsWin ; $A
  67800. offsetTableEntry.w Obj5A_RingCheckTrigger ; $C
  67801. offsetTableEntry.w Obj5A_RingsNeeded ; $E
  67802. offsetTableEntry.w Obj5A_FlashMessage ; $10
  67803. offsetTableEntry.w Obj5A_MoveAndFlash ; $12
  67804. offsetTableEntry.w Obj5A_FlashOnly ; $14
  67805. ; ===========================================================================
  67806. ; loc_35578:
  67807. Obj5A_Init:
  67808. tst.b (SS_NoCheckpoint_flag).w
  67809. bne.s Obj5A_RingsMessageInit
  67810. movea.l (SSTrack_last_mappings_copy).w,a1
  67811. cmpa.l #MapSpec_Straight4,a1
  67812. blt.s ++ ; rts
  67813. cmpa.l #MapSpec_Drop1,a1
  67814. bge.s ++ ; rts
  67815. moveq #6,d0
  67816. bsr.s SSRainbowPaletteColors
  67817. st.b (SS_Checkpoint_Rainbow_flag).w
  67818. moveq #6,d0
  67819. -
  67820. jsrto (SSSingleObjLoad).l, JmpTo2_SSSingleObjLoad
  67821. bne.s +
  67822. move.b #ObjID_SSMessage,id(a1) ; load obj5A
  67823. move.b #2,routine(a1) ; => Obj5A_CheckpointRainbow
  67824. move.l #Obj5A_Obj5B_Obj60_MapUnc_3632A,mappings(a1)
  67825. move.w #make_art_tile(ArtTile_ArtNem_SpecialRings,3,0),art_tile(a1)
  67826. move.b #4,render_flags(a1)
  67827. move.b #5,priority(a1)
  67828. move.b d0,objoff_2A(a1)
  67829. move.w #0,objoff_30(a1)
  67830. move.b #-1,mapping_frame(a1)
  67831. + dbf d0,-
  67832.  
  67833. bra.w JmpTo63_DeleteObject
  67834. ; ===========================================================================
  67835. +
  67836. rts
  67837. ; ===========================================================================
  67838. ;loc_355E0
  67839. Obj5A_RingsMessageInit:
  67840. sf.b (SS_NoCheckpoint_flag).w
  67841. tst.b (SS_2p_Flag).w
  67842. bne.w JmpTo63_DeleteObject
  67843. sf.b (SS_HideRingsToGo).w
  67844. sf.b (SS_TriggerRingsToGo).w
  67845. move.w #0,(SS_NoRingsTogoLifetime).w
  67846. move.b #0,objoff_3A(a0)
  67847. bra.w JmpTo63_DeleteObject
  67848. ; ===========================================================================
  67849. ; temporarily remap characters to title card letter format
  67850. ; Characters are encoded as Aa, Bb, Cc, etc. through a macro
  67851. charset 'a','z','A' ; Convert to uppercase
  67852. charset 'A',"\xD\x11\7\x11\1\x11"
  67853. charset 'G',0 ; can't have an embedded 0 in a string
  67854. charset 'H',"\xB\4\x11\x11\9\xF\5\8\xC\x11\3\6\2\xA\x11\x10\x11\xE\x11"
  67855. charset '!',"\x11"
  67856. charset '.',"\x12"
  67857.  
  67858. specialText macro letters
  67859. dc.b letters
  67860. dc.b $FF ; output string terminator
  67861. endm
  67862.  
  67863. Obj5A_RingsToGoText:
  67864. specialText "RING"
  67865. specialText "!OGOT"
  67866. specialText "S"
  67867. even
  67868.  
  67869. Obj5A_ToGoOffsets:
  67870. dc.w $C0 ; 0
  67871. dc.w $B8 ; 1
  67872. dc.w $B0 ; 2
  67873. dc.w $A0 ; 3
  67874. dc.w $98 ; 4
  67875. dc.w $88 ; 5
  67876.  
  67877. charset ; revert character set
  67878.  
  67879. ; ===========================================================================
  67880. ;loc_3561E
  67881. Obj5A_CreateRingsToGoText:
  67882. st.b (SS_TriggerRingsToGo).w
  67883. jsrto (SSSingleObjLoad).l, JmpTo2_SSSingleObjLoad
  67884. bne.w return_356E4
  67885. move.l #Obj5F_MapUnc_72D2,mappings(a1)
  67886. move.w #make_art_tile(ArtTile_ArtNem_SpecialHUD,2,0),art_tile(a1)
  67887. move.b #ObjID_SSMessage,id(a1) ; load obj5A
  67888. move.b #4,render_flags(a1)
  67889. move.b #1,priority(a1)
  67890. bset #6,render_flags(a1)
  67891. move.b #0,mainspr_childsprites(a1)
  67892. move.b #$E,routine(a1) ; => Obj5A_RingsNeeded
  67893. lea sub2_x_pos(a1),a2
  67894. move.w #$5A,d1
  67895. move.w #$38,d2
  67896. moveq #0,d0
  67897. moveq #2,d3
  67898.  
  67899. - move.w d1,(a2)+ ; sub?_x_pos
  67900. move.w d2,(a2)+ ; sub?_y_pos
  67901. move.w d0,(a2)+ ; sub?_mapframe
  67902. subq.w #8,d1
  67903. dbf d3,-
  67904. lea Obj5A_RingsToGoText(pc),a3
  67905. move.w #$68,d1
  67906. move.w #$38,d2
  67907.  
  67908. - move.b (a3)+,d0
  67909. bmi.s +
  67910. jsrto (SSSingleObjLoad).l, JmpTo2_SSSingleObjLoad
  67911. bne.s return_356E4
  67912. bsr.s Init_Obj5A
  67913. move.b #$10,routine(a1)
  67914. move.w d1,x_pos(a1)
  67915. move.w d2,y_pos(a1)
  67916. move.b d0,mapping_frame(a1)
  67917. addq.w #8,d1
  67918. bra.s -
  67919. ; ===========================================================================
  67920. +
  67921. lea Obj5A_ToGoOffsets(pc),a2
  67922.  
  67923. - move.b (a3)+,d0
  67924. bmi.s +
  67925. jsrto (SSSingleObjLoad).l, JmpTo2_SSSingleObjLoad
  67926. bne.s return_356E4
  67927. bsr.s Init_Obj5A
  67928. move.b #$12,routine(a1) ; => Obj5A_MoveAndFlash
  67929. move.w (a2)+,objoff_2A(a1)
  67930. move.w d2,y_pos(a1)
  67931. move.b d0,mapping_frame(a1)
  67932. bra.s -
  67933. ; ===========================================================================
  67934. +
  67935. move.b (a3)+,d0
  67936. jsrto (SSSingleObjLoad).l, JmpTo2_SSSingleObjLoad
  67937. bne.s return_356E4
  67938. bsr.s Init_Obj5A
  67939. move.b #$14,routine(a1) ; => Obj5A_FlashOnly
  67940. move.w (a2)+,x_pos(a1)
  67941. move.w d2,y_pos(a1)
  67942. move.b d0,mapping_frame(a1)
  67943.  
  67944. return_356E4:
  67945. rts
  67946. ; ===========================================================================
  67947. ;loc_356E6
  67948. Init_Obj5A:
  67949. move.b #ObjID_SSMessage,id(a1) ; load obj5A
  67950. move.l #Obj5A_MapUnc_35E1E,mappings(a1)
  67951. move.w #make_art_tile(ArtTile_ArtNem_SpecialMessages,2,0),art_tile(a1)
  67952. move.b #4,render_flags(a1)
  67953. move.b #1,priority(a1)
  67954. rts
  67955. ; ===========================================================================
  67956. ;loc_35706
  67957. Obj5A_RingsNeeded:
  67958. move.b (SS_TriggerRingsToGo).w,(SS_HideRingsToGo).w
  67959. bne.s +
  67960. bsr.s ++
  67961. bra.w Obj5A_FlashMessage
  67962. ; ===========================================================================
  67963. +
  67964. rts
  67965. ; ===========================================================================
  67966. +
  67967. move.w (Ring_count).w,d0
  67968. cmpi.w #1,(Player_mode).w
  67969. blt.s +
  67970. beq.s ++
  67971. move.w (Ring_count_2P).w,d0
  67972. bra.s ++
  67973. ; ===========================================================================
  67974. +
  67975. add.w (Ring_count_2P).w,d0
  67976. +
  67977. sub.w (SS_Ring_Requirement).w,d0
  67978. neg.w d0
  67979. bgt.s +
  67980. moveq #0,d0
  67981. moveq #1,d2
  67982. addi_.w #1,(SS_NoRingsTogoLifetime).w
  67983. cmpi.w #$C,(SS_NoRingsTogoLifetime).w
  67984. blo.s loc_3577A
  67985. st.b (SS_HideRingsToGo).w
  67986. bra.s loc_3577A
  67987. ; ===========================================================================
  67988. +
  67989. ; This code converts the remaining rings into binary coded decimal format.
  67990. moveq #0,d1
  67991. move.w d0,d1
  67992. moveq #0,d0
  67993. cmpi.w #100,d1
  67994. blt.s +
  67995.  
  67996. - addi.w #$100,d0
  67997. subi.w #100,d1
  67998. bgt.s -
  67999. +
  68000. divu.w #$A,d1
  68001. lsl.w #4,d1
  68002. or.b d1,d0
  68003. swap d1
  68004. or.b d1,d0
  68005. move.w #0,(SS_NoRingsTogoLifetime).w
  68006. sf.b (SS_HideRingsToGo).w
  68007.  
  68008. loc_3577A:
  68009. moveq #1,d2
  68010. lea sub2_x_pos(a0),a1
  68011. move.w d0,(SS_RingsToGoBCD).w
  68012. move.w d0,d1
  68013. andi.w #$F,d1
  68014. move.b d1,sub2_mapframe-sub2_x_pos(a1)
  68015. lsr.w #4,d0
  68016. beq.s +
  68017. addq.w #1,d2
  68018. move.w d0,d1
  68019. andi.w #$F,d1
  68020. move.b d1,sub3_mapframe-sub2_x_pos(a1)
  68021. lsr.w #4,d0
  68022. beq.s +
  68023. addq.w #1,d2
  68024. andi.w #$F,d0
  68025. move.b d0,sub4_mapframe-sub2_x_pos(a1)
  68026. +
  68027. move.b d2,mainspr_childsprites(a0)
  68028. rts
  68029. ; ===========================================================================
  68030. ;loc_357B2
  68031. Obj5A_FlashMessage:
  68032. tst.b (SS_NoCheckpointMsg_flag).w
  68033. bne.w + ; rts
  68034. tst.b (SS_HideRingsToGo).w
  68035. bne.s + ; rts
  68036. move.b (Vint_runcount+3).w,d0
  68037. andi.b #7,d0
  68038. cmpi.b #6,d0
  68039. blo.w JmpTo44_DisplaySprite
  68040. +
  68041. rts
  68042. ; ===========================================================================
  68043. ;loc_357D2
  68044. Obj5A_MoveAndFlash:
  68045. moveq #0,d0
  68046. cmpi.w #2,(SS_RingsToGoBCD).w
  68047. bhs.s +
  68048. moveq #-8,d0
  68049. +
  68050. add.w objoff_2A(a0),d0
  68051. move.w d0,x_pos(a0)
  68052. bra.s Obj5A_FlashMessage
  68053. ; ===========================================================================
  68054. ;loc_357E8
  68055. Obj5A_FlashOnly:
  68056. moveq #0,d0
  68057. cmpi.w #2,(SS_RingsToGoBCD).w
  68058. bhs.s Obj5A_FlashMessage
  68059. rts
  68060. ; ===========================================================================
  68061. Obj5A_Rainbow_Frames:
  68062. dc.b 0
  68063. dc.b 1 ; 1
  68064. dc.b 1 ; 2
  68065. dc.b 1 ; 3
  68066. dc.b 2 ; 4
  68067. dc.b 4 ; 5
  68068. dc.b 6 ; 6
  68069. dc.b 8 ; 7
  68070. dc.b 9 ; 8
  68071. dc.b $FF ; 9
  68072. ; ===========================================================================
  68073. ;loc_357FE
  68074. Obj5A_CheckpointRainbow:
  68075. cmpi.b #4,(SSTrack_drawing_index).w
  68076. bne.s +
  68077. move.w objoff_2C(a0),d0
  68078. move.b Obj5A_Rainbow_Frames(pc,d0.w),mapping_frame(a0)
  68079. bmi.w ++
  68080. addi_.w #1,objoff_2C(a0)
  68081. moveq #0,d0
  68082. move.b objoff_2A(a0),d0
  68083. add.w d0,d0
  68084. add.w objoff_30(a0),d0
  68085. move.b Obj5A_Rainbow_Positions(pc,d0.w),1+x_pos(a0)
  68086. move.b Obj5A_Rainbow_Positions+1(pc,d0.w),1+y_pos(a0)
  68087. addi.w #$E,objoff_30(a0)
  68088. bra.w JmpTo44_DisplaySprite
  68089. ; ===========================================================================
  68090. +
  68091. tst.b mapping_frame(a0)
  68092. bpl.w JmpTo44_DisplaySprite
  68093. rts
  68094. ; ===========================================================================
  68095. Obj5A_Rainbow_Positions:
  68096. ; x, y
  68097. dc.b $F6,$F6
  68098. dc.b $70,$5E ; 2
  68099. dc.b $76,$58 ; 4
  68100. dc.b $7E,$56 ; 6
  68101. dc.b $88,$58 ; 8
  68102. dc.b $8E,$5E ; 10
  68103. dc.b $F6,$F6 ; 12
  68104. dc.b $F6,$F6 ; 14
  68105. dc.b $6D,$5A ; 16
  68106. dc.b $74,$54 ; 18
  68107. dc.b $7E,$50 ; 20
  68108. dc.b $8A,$54 ; 22
  68109. dc.b $92,$5A ; 24
  68110. dc.b $F6,$F6 ; 26
  68111. dc.b $F6,$F6 ; 28
  68112. dc.b $6A,$58 ; 30
  68113. dc.b $72,$50 ; 32
  68114. dc.b $7E,$4C ; 34
  68115. dc.b $8C,$50 ; 36
  68116. dc.b $94,$58 ; 38
  68117. dc.b $F6,$F6 ; 40
  68118. dc.b $F6,$F6 ; 42
  68119. dc.b $68,$56 ; 44
  68120. dc.b $70,$4C ; 46
  68121. dc.b $7E,$48 ; 48
  68122. dc.b $8E,$4C ; 50
  68123. dc.b $96,$56 ; 52
  68124. dc.b $F6,$F6 ; 54
  68125. dc.b $62,$5E ; 56
  68126. dc.b $66,$50 ; 58
  68127. dc.b $70,$46 ; 60
  68128. dc.b $7E,$42 ; 62
  68129. dc.b $8E,$46 ; 64
  68130. dc.b $98,$50 ; 66
  68131. dc.b $9C,$5E ; 68
  68132. dc.b $5C,$5A ; 70
  68133. dc.b $62,$4A ; 72
  68134. dc.b $70,$3E ; 74
  68135. dc.b $7E,$38 ; 76
  68136. dc.b $8E,$3E ; 78
  68137. dc.b $9C,$4A ; 80
  68138. dc.b $A2,$5A ; 82
  68139. dc.b $54,$54 ; 84
  68140. dc.b $5A,$3E ; 86
  68141. dc.b $6A,$30 ; 88
  68142. dc.b $7E,$2A ; 90
  68143. dc.b $94,$30 ; 92
  68144. dc.b $A4,$3E ; 94
  68145. dc.b $AA,$54 ; 96
  68146. dc.b $42,$4A ; 98
  68147. dc.b $4C,$28 ; 100
  68148. dc.b $62,$12 ; 102
  68149. dc.b $7E, $A ; 104
  68150. dc.b $9C,$12 ; 106
  68151. dc.b $B2,$28 ; 108
  68152. dc.b $BC,$4A ; 110
  68153. dc.b $16,$26 ; 112
  68154. dc.b $28,$FC ; 114
  68155. dc.b $EC,$EC ; 116
  68156. dc.b $EC,$EC ; 118
  68157. dc.b $EC,$EC ; 120
  68158. dc.b $D6,$FC ; 122
  68159. dc.b $E8,$26 ; 124
  68160. ; ===========================================================================
  68161. +
  68162. cmpi.w #$E8,x_pos(a0)
  68163. bne.w JmpTo63_DeleteObject
  68164. moveq #0,d0
  68165. bsr.w SSRainbowPaletteColors
  68166. sf.b (SS_Checkpoint_Rainbow_flag).w
  68167. st.b (SS_NoCheckpointMsg_flag).w
  68168. tst.b (SS_2p_Flag).w ; Is it VS mode?
  68169. beq.w loc_35978 ; Branch if not
  68170. move.w #SndID_Checkpoint,d0
  68171. jsr (PlaySound).l
  68172. addi.b #$10,(SS_2P_BCD_Score).w
  68173. moveq #0,d6
  68174. addi_.b #1,(Current_Special_Act).w
  68175. move.w #$C,d0
  68176. move.w (Ring_count).w,d2
  68177. cmp.w (Ring_count_2P).w,d2
  68178. bgt.s ++
  68179. beq.s +++
  68180. subi.b #$10,(SS_2P_BCD_Score).w
  68181. addi_.b #1,(SS_2P_BCD_Score).w
  68182. move.w #$E,d0
  68183. tst.b (Graphics_Flags).w
  68184. bpl.s +
  68185. move.w #$14,d0
  68186. +
  68187. move.w #palette_line_1,d6
  68188. +
  68189. move.w #$80,d3
  68190. bsr.w Obj5A_CreateCheckpointWingedHand
  68191. add.w d6,art_tile(a1)
  68192. add.w d6,2(a2)
  68193. bsr.w Obj5A_PrintPhrase
  68194. bra.w JmpTo63_DeleteObject
  68195. ; ===========================================================================
  68196. +
  68197. subi.b #$10,(SS_2P_BCD_Score).w
  68198. move.w #$10,d0
  68199. bsr.w Obj5A_PrintPhrase
  68200. cmpi.b #3,(Current_Special_Act).w
  68201. beq.s +
  68202. move.w #$46,objoff_2A(a0)
  68203. move.b #$A,routine(a0)
  68204. rts
  68205. ; ===========================================================================
  68206. +
  68207. bsr.w Obj5A_VSReset
  68208. move.w #$46,objoff_2A(a0)
  68209. move.b #$C,routine(a0)
  68210. rts
  68211. ; ===========================================================================
  68212.  
  68213. loc_35978:
  68214. move.w #6,d1
  68215. move.w #SndID_Error,d0
  68216. move.w (Ring_count).w,d2
  68217. add.w (Ring_count_2P).w,d2
  68218. cmp.w (SS_Ring_Requirement).w,d2
  68219. blt.s +
  68220. move.w #4,d1
  68221. move.w #SndID_Checkpoint,d0
  68222. +
  68223. jsr (PlaySound).l
  68224. move.w d1,d0
  68225. bsr.w Obj5A_PrintCheckpointMessage
  68226. bra.w JmpTo63_DeleteObject
  68227. ; ===========================================================================
  68228. ;loc_359A6
  68229. Obj5A_MostRingsWin:
  68230. subi_.w #1,objoff_2A(a0)
  68231. beq.s +
  68232. rts
  68233. ; ===========================================================================
  68234. +
  68235. move.w #$A,d0 ; MOST RINGS WINS
  68236. bsr.w Obj5A_PrintPhrase
  68237. bra.w JmpTo63_DeleteObject
  68238. ; ===========================================================================
  68239. ;loc_359BC
  68240. Obj5A_RingCheckTrigger:
  68241. subi_.w #1,objoff_2A(a0)
  68242. beq.s +
  68243. rts
  68244. ; ===========================================================================
  68245. +
  68246. st.b (SS_Check_Rings_flag).w
  68247. bra.w SSClearObjs
  68248. ; ===========================================================================
  68249. ;loc_359CE
  68250. Obj5A_Handshake:
  68251. cmpi.b #$15,mapping_frame(a0) ; Is this the hand?
  68252. bne.s ++ ; if not, branch
  68253. move.w objoff_30(a0),d0 ; Target y position for handshake
  68254. tst.b objoff_2E(a0)
  68255. bne.s +
  68256. subi_.w #1,y_pos(a0)
  68257. subi_.w #4,d0
  68258. cmp.w y_pos(a0),d0
  68259. blt.s ++
  68260. addi_.w #1,d0
  68261. move.w d0,y_pos(a0)
  68262. st.b objoff_2E(a0)
  68263. bra.s ++
  68264. ; ===========================================================================
  68265. +
  68266. addi_.w #1,y_pos(a0)
  68267. addi_.w #4,d0
  68268. cmp.w y_pos(a0),d0
  68269. bgt.s +
  68270. subi_.w #1,d0
  68271. move.w d0,y_pos(a0)
  68272. sf.b objoff_2E(a0)
  68273. +
  68274. subi_.w #1,objoff_2A(a0)
  68275. bne.w JmpTo44_DisplaySprite
  68276. tst.b objoff_2F(a0)
  68277. beq.s +
  68278. -
  68279. move.w #MusID_FadeOut,d0
  68280. jsr (PlayMusic).l
  68281. move.w #$30,objoff_2A(a0)
  68282. move.b #$C,routine(a0) ; => Obj5A_RingCheckTrigger
  68283. rts
  68284. ; ===========================================================================
  68285. +
  68286. cmpi.b #$15,mapping_frame(a0) ; Is this the hand?
  68287. bne.w JmpTo63_DeleteObject ; Branch if not
  68288. tst.w objoff_30(a0)
  68289. beq.w JmpTo63_DeleteObject
  68290. tst.b (SS_2p_Flag).w ; Is this VS mode?
  68291. beq.s + ; Branch if not
  68292. bsr.w Obj5A_VSReset
  68293. cmpi.b #3,(Current_Special_Act).w
  68294. beq.s -
  68295. move.w #$A,d0
  68296. bsr.w Obj5A_PrintPhrase
  68297. bra.w JmpTo63_DeleteObject
  68298. ; ===========================================================================
  68299. +
  68300. bsr.w Obj5A_CreateRingReqMessage
  68301. bra.w JmpTo63_DeleteObject
  68302. ; ===========================================================================
  68303. ;loc_35A7A
  68304. Obj5A_VSReset:
  68305. lea (SS2p_RingBuffer).w,a3
  68306. moveq #0,d0
  68307. move.b (Current_Special_Act).w,d0
  68308. subq.w #1,d0
  68309. add.w d0,d0
  68310. add.w d0,d0
  68311. move.w (Ring_count).w,(a3,d0.w)
  68312. move.w (Ring_count_2P).w,2(a3,d0.w)
  68313. move.w #0,(Ring_count).w
  68314. move.w #0,(Ring_count_2P).w
  68315. moveq #0,d0
  68316. move.w d0,(MainCharacter+ss_rings_base).w
  68317. move.b d0,(MainCharacter+ss_rings_units).w
  68318. move.w d0,(Sidekick+ss_rings_base).w
  68319. move.b d0,(Sidekick+ss_rings_units).w
  68320. rts
  68321. ; ===========================================================================
  68322. ;loc_35AB6
  68323. Obj5A_CreateCheckpointWingedHand:
  68324. move.w #$48,d4
  68325. tst.b (SS_2p_Flag).w ; Is this VS mode?
  68326. beq.s + ; Branch if not
  68327. move.w #$1C,d4
  68328. +
  68329. jsrto (SSSingleObjLoad).l, JmpTo2_SSSingleObjLoad
  68330. bne.w + ; rts
  68331. move.b #ObjID_SSMessage,id(a1) ; load obj5A
  68332. move.b #6,routine(a1) ; => Obj5A_Handshake
  68333. move.l #Obj5A_MapUnc_35E1E,mappings(a1)
  68334. move.w #make_art_tile(ArtTile_ArtNem_SpecialMessages,1,0),art_tile(a1)
  68335. move.b #4,render_flags(a1)
  68336. move.b #1,priority(a1)
  68337. move.w d3,x_pos(a1)
  68338. move.w d4,y_pos(a1)
  68339. move.w #$46,objoff_2A(a1)
  68340. move.b #$14,mapping_frame(a1) ; Checkpoint wings
  68341. movea.l a1,a2
  68342. jsrto (SSSingleObjLoad).l, JmpTo2_SSSingleObjLoad
  68343. bne.s + ; rts
  68344. move.b #ObjID_SSMessage,id(a1) ; load obj5A
  68345. move.b #6,routine(a1) ; => Obj5A_Handshake
  68346. move.l #Obj5A_MapUnc_35E1E,mappings(a1)
  68347. move.w #make_art_tile(ArtTile_ArtNem_SpecialMessages,1,0),art_tile(a1)
  68348. move.b #4,render_flags(a1)
  68349. move.b #0,priority(a1)
  68350. move.w d3,x_pos(a1)
  68351. move.w d4,y_pos(a1)
  68352. move.w d4,objoff_30(a1) ; Target y position for handshake
  68353. move.w #$46,objoff_2A(a1)
  68354. move.b #$15,mapping_frame(a1) ; Checkpoint hand
  68355. cmpi.w #6,d0 ; Does player have enough rings?
  68356. bne.s + ; If yes, return
  68357. st.b objoff_2F(a1) ; Flag for failed checkpoint
  68358. bset #1,render_flags(a1) ; Point thumb down
  68359. +
  68360. rts
  68361. ; ===========================================================================
  68362. ;loc_35B5A
  68363. Obj5A_TextFlyoutInit:
  68364. subi_.w #1,objoff_2A(a0)
  68365. bne.w JmpTo44_DisplaySprite
  68366. cmpi.b #$13,mapping_frame(a0) ; Is this the hand or wings?
  68367. bgt.w JmpTo63_DeleteObject ; If yes, branch
  68368. move.b #8,routine(a0) ; Obj5A_TextFlyout
  68369. move.w #8,objoff_14(a0)
  68370. move.w x_pos(a0),d1
  68371. subi.w #$80,d1
  68372. move.w y_pos(a0),d2
  68373. subi.w #$70,d2
  68374. jsrto (CalcAngle).l, JmpTo_CalcAngle
  68375. move.b d0,angle(a0)
  68376. bra.w JmpTo44_DisplaySprite
  68377. ; ===========================================================================
  68378. ; this makes special stage messages like "most rings wins!" fly off the screen
  68379. ;loc_35B96
  68380. Obj5A_TextFlyout:
  68381. moveq #0,d0
  68382. move.b angle(a0),d0
  68383. jsrto (CalcSine).l, JmpTo14_CalcSine
  68384. muls.w objoff_14(a0),d0
  68385. muls.w objoff_14(a0),d1
  68386. asr.w #8,d0
  68387. asr.w #8,d1
  68388. add.w d1,x_pos(a0)
  68389. add.w d0,y_pos(a0)
  68390. cmpi.w #0,x_pos(a0)
  68391. blt.w JmpTo63_DeleteObject
  68392. cmpi.w #$100,x_pos(a0)
  68393. bgt.w JmpTo63_DeleteObject
  68394. cmpi.w #0,y_pos(a0)
  68395. blt.w JmpTo63_DeleteObject
  68396. bra.w JmpTo44_DisplaySprite
  68397. ; ===========================================================================
  68398. ;loc_35BD6
  68399. Obj5A_PrintNumber:
  68400. jsrto (SSSingleObjLoad2).l, JmpTo_SSSingleObjLoad2
  68401. bne.s + ; rts
  68402. move.b d0,mapping_frame(a1)
  68403. move.l #Obj5F_MapUnc_72D2,mappings(a1)
  68404. move.w #make_art_tile(ArtTile_ArtNem_SpecialHUD,2,0),art_tile(a1)
  68405. move.b #ObjID_SSMessage,id(a1) ; load obj5A
  68406. move.b #4,routine(a1) ; Obj5A_TextFlyoutInit
  68407. move.b #4,render_flags(a1)
  68408. move.b #1,priority(a1)
  68409. move.w d1,x_pos(a1)
  68410. move.w d2,y_pos(a1)
  68411. move.w #$46,objoff_2A(a1)
  68412. +
  68413. rts
  68414. ; ===========================================================================
  68415. ; Subroutine to draw checkpoint or message text
  68416. ; d0 = text ID
  68417. ; d1 = x position of first letter
  68418. ; d2 = y position
  68419. ;loc_35C14
  68420. Obj5A_PrintWord:
  68421. lea SSMessage_TextFrames(pc),a3
  68422. adda.w (a3,d0.w),a3
  68423.  
  68424. - move.b (a3)+,d0
  68425. bmi.s + ; rts
  68426. jsrto (SSSingleObjLoad2).l, JmpTo_SSSingleObjLoad2
  68427. bne.s + ; rts
  68428. move.b d0,mapping_frame(a1)
  68429. move.l #Obj5A_MapUnc_35E1E,mappings(a1)
  68430. move.w #make_art_tile(ArtTile_ArtNem_SpecialMessages,2,0),art_tile(a1)
  68431. move.b #ObjID_SSMessage,id(a1) ; load obj5A
  68432. move.b #4,routine(a1) ; Obj5A_TextFlyoutInit
  68433. move.b #4,render_flags(a1)
  68434. move.b #1,priority(a1)
  68435. move.w d1,x_pos(a1)
  68436. move.w d2,y_pos(a1)
  68437. move.w #$46,objoff_2A(a1)
  68438. addq.w #8,d1
  68439. bra.s -
  68440. ; ===========================================================================
  68441. +
  68442. rts
  68443. ; ===========================================================================
  68444. ; temporarily remap characters to title card letter format
  68445. ; Characters are encoded as Aa, Bb, Cc, etc. through a macro
  68446. charset 'a','z','A' ; Convert to uppercase
  68447. charset 'A',"\xD\x11\7\x11\1\x11"
  68448. charset 'G',0 ; can't have an embedded 0 in a string
  68449. charset 'H',"\xB\4\x11\x11\9\xF\5\8\xC\x11\3\6\2\xA\x11\x10\x11\xE\x11"
  68450. charset '!',"\x11"
  68451. charset '.',"\x12"
  68452.  
  68453. ; Text words
  68454. ;off_35C62
  68455. SSMessage_TextFrames: offsetTable
  68456. offsetTableEntry.w byte_35C86 ; 0
  68457. offsetTableEntry.w byte_35C8A ; 2
  68458. offsetTableEntry.w byte_35C90 ; 4
  68459. offsetTableEntry.w byte_35C96 ; 6
  68460. offsetTableEntry.w byte_35C9A ; 8
  68461. offsetTableEntry.w byte_35CA1 ; $A
  68462. offsetTableEntry.w byte_35CA8 ; $C
  68463. offsetTableEntry.w byte_35CAD ; $E
  68464. offsetTableEntry.w byte_35CB3 ;$10
  68465. offsetTableEntry.w byte_35CB9 ;$12
  68466. offsetTableEntry.w byte_35CBF ;$14
  68467. offsetTableEntry.w byte_35CC4 ;$16
  68468. offsetTableEntry.w byte_35CC8 ;$18
  68469. offsetTableEntry.w byte_35CCE ;$1A
  68470. offsetTableEntry.w byte_35CD3 ;$1C
  68471. offsetTableEntry.w byte_35CD5 ;$1E
  68472. offsetTableEntry.w byte_35CD9 ;$20
  68473. offsetTableEntry.w byte_35CDB ;$22
  68474. byte_35C86: specialText "GET"
  68475. rev02even
  68476. byte_35C8A: specialText "RINGS"
  68477. rev02even
  68478. byte_35C90: specialText "COOL!"
  68479. rev02even
  68480. byte_35C96: specialText "NOT"
  68481. rev02even
  68482. byte_35C9A: specialText "ENOUGH"
  68483. rev02even
  68484. byte_35CA1: specialText "PLAYER"
  68485. rev02even
  68486. byte_35CA8: specialText "MOST"
  68487. rev02even
  68488. byte_35CAD: specialText "WINS!"
  68489. rev02even
  68490. byte_35CB3: specialText "SONIC"
  68491. rev02even
  68492. byte_35CB9: specialText "MILES"
  68493. rev02even
  68494. byte_35CBF: specialText "TIE!"
  68495. rev02even
  68496. byte_35CC4: specialText "WIN"
  68497. rev02even
  68498. byte_35CC8: specialText "TWICE"
  68499. rev02even
  68500. byte_35CCE: specialText "ALL!"
  68501. rev02even
  68502. byte_35CD3: specialText "!"
  68503. rev02even
  68504. byte_35CD5: specialText "..."
  68505. rev02even
  68506. byte_35CD9: dc.b $13,$FF ; VS
  68507. rev02even
  68508. byte_35CDB: specialText "TAILS"
  68509. even
  68510.  
  68511. charset ; revert character set
  68512.  
  68513. ; ===========================================================================
  68514. ;loc_35CE2
  68515. Obj5A_CreateRingReqMessage:
  68516. moveq #0,d0 ; GET
  68517. move.w #$54,d1 ; x
  68518. move.w #$6C,d2 ; y
  68519. bsr.w Obj5A_PrintWord
  68520. jsrto (SSStartNewAct).l, JmpTo_SSStartNewAct
  68521. move.w d1,d4 ; Binary coded decimal ring requirements
  68522. move.w d2,d5 ; Digit count - 1 (minumum 2 digits)
  68523. movea.w d2,a3 ; Copy of above, but in a3.
  68524. move.w #$80,d1 ; x position of least digit
  68525. cmpi.w #2,d2 ; Do we need hundreds digit?
  68526. beq.s + ; if yes, branch
  68527. subi_.w #8,d1 ; Otherwise, move digits to the left
  68528.  
  68529. + move.w #$6C,d2 ; y position of digits
  68530.  
  68531. - move.w d4,d6 ; Copy BCD reuirements
  68532. lsr.w #4,d4 ; Next BCD digit
  68533. andi.w #$F,d6 ; Extract least digit
  68534. move.b d6,d0
  68535. swap d5
  68536. bsr.w Obj5A_PrintNumber
  68537. subi_.w #8,d1 ; Set position for next digit
  68538. swap d5
  68539. dbf d5,-
  68540.  
  68541. moveq #2,d0 ; RINGS!
  68542. lea (SSMessage_TextPhrases).l,a2
  68543. adda.w (a2,d0.w),a2
  68544. move.w #$6C,d2 ; y
  68545. move.w #$84,d1 ; x
  68546. cmpa.w #2,a3 ; Do we need space for hundreds digit?
  68547. bne.s + ; Branch if not
  68548. addi_.w #8,d1 ; Move digits to right
  68549.  
  68550. / moveq #0,d0
  68551. move.b (a2)+,d0
  68552. bmi.s +
  68553. bsr.w Obj5A_PrintWord
  68554. bra.s -
  68555. ; ===========================================================================
  68556. +
  68557. rts
  68558. ; ===========================================================================
  68559. ;loc_35D52
  68560. Obj5A_PrintCheckpointMessage:
  68561. move.w #$80,d3 ; x
  68562. bsr.w Obj5A_CreateCheckpointWingedHand
  68563. cmpi.w #1,(Player_mode).w
  68564. ble.s loc_35D6E
  68565. addi.w #palette_line_1,art_tile(a1)
  68566. addi.w #palette_line_1,art_tile(a2)
  68567.  
  68568. loc_35D6E:
  68569. move.w #$74,d1 ; x
  68570. move.w #$68,d2 ; y
  68571. lea (SSMessage_TextPhrases).l,a2
  68572. adda.w (a2,d0.w),a2 ; Fetch phrase
  68573. cmpi.b #4,d0 ; Is it 'COOL!'?
  68574. beq.s + ; Branch if yes
  68575. move.w #$5E,d1 ; Move text otherwise
  68576.  
  68577. / moveq #0,d0
  68578. move.b (a2)+,d0
  68579. bmi.s ++ ; rts
  68580. cmpi.b #2,d0
  68581. bne.s +
  68582. move.w #$5E,d1 ; x
  68583. move.w #$7E,d2 ; y
  68584. +
  68585. bsr.w Obj5A_PrintWord
  68586. addi_.w #8,d1
  68587. bra.s -
  68588. ; ===========================================================================
  68589. +
  68590. rts
  68591. ; ===========================================================================
  68592. ;loc_35DAA
  68593. Obj5A_PrintPhrase:
  68594. move.w d0,d3
  68595. subq.w #8,d3
  68596. lsr.w #1,d3
  68597. moveq #0,d1
  68598. move.b byte_35DD6(pc,d3.w),d1
  68599. move.w #$48,d2
  68600. lea (SSMessage_TextPhrases).l,a2
  68601. adda.w (a2,d0.w),a2
  68602.  
  68603. - moveq #0,d0
  68604. move.b (a2)+,d0
  68605. bmi.s + ; rts
  68606. bsr.w Obj5A_PrintWord
  68607. addi_.w #8,d1
  68608. bra.s -
  68609. ; ===========================================================================
  68610. +
  68611. rts
  68612. ; ===========================================================================
  68613. byte_35DD6:
  68614. dc.b $48
  68615. dc.b $44 ; 1
  68616. dc.b $58 ; 2
  68617. dc.b $58 ; 3
  68618. dc.b $74 ; 4
  68619. dc.b $3C ; 5
  68620. dc.b $58 ; 6
  68621. dc.b 0 ; 7
  68622.  
  68623. ; Text phrases
  68624. ;off_35DDE
  68625. SSMessage_TextPhrases: offsetTable
  68626. offsetTableEntry.w byte_35DF6 ; 0
  68627. offsetTableEntry.w byte_35DF7 ; 2
  68628. offsetTableEntry.w byte_35DFA ; 4
  68629. offsetTableEntry.w byte_35DFC ; 6
  68630. offsetTableEntry.w byte_35E01 ; 8
  68631. offsetTableEntry.w byte_35E05 ; $A
  68632. offsetTableEntry.w byte_35E09 ; $C
  68633. offsetTableEntry.w byte_35E0C ; $E
  68634. offsetTableEntry.w byte_35E0F ;$10
  68635. offsetTableEntry.w byte_35E11 ;$12
  68636. offsetTableEntry.w byte_35E16 ;$14
  68637. offsetTableEntry.w byte_35E19 ;$16
  68638. byte_35DF6: dc.b $FF ; (empty)
  68639. byte_35DF7: dc.b 2,$1C,$FF ; RINGS!
  68640. byte_35DFA: dc.b 4,$FF ; COOL!
  68641. byte_35DFC: dc.b 6, 8, 2,$1E,$FF ; NOT ENOUGH RINGS...
  68642. byte_35E01: dc.b $A,$20, $A,$FF ; PLAYER VS PLAYER
  68643. byte_35E05: dc.b $C, 2, $E,$FF ; MOST RINGS WINS
  68644. byte_35E09: dc.b $10, $E,$FF ; SONIC WINS
  68645. byte_35E0C: dc.b $12, $E,$FF ; MILES WINS
  68646. byte_35E0F: dc.b $14,$FF ; TIE!
  68647. byte_35E11: dc.b $16,$18,$16,$1A,$FF ; WIN TWICE WIN ALL!
  68648. byte_35E16: dc.b $22, $E,$FF ; TAILS WINS
  68649. byte_35E19: dc.b 2,$24,$26,$1C,$FF ; RINGS ?? ?? !
  68650. even
  68651. ; ----------------------------------------------------------------------------
  68652. ; sprite mappings
  68653. ; ----------------------------------------------------------------------------
  68654. Obj5A_MapUnc_35E1E: BINCLUDE "mappings/sprite/obj5A.bin"
  68655. ; ===========================================================================
  68656.  
  68657. loc_35F76:
  68658. add.w d0,d0
  68659. move.w d0,d1
  68660. add.w d0,d0
  68661. add.w d1,d0
  68662. move.w word_35F92(pc,d0.w),(Normal_palette_line4+$16).w
  68663. move.w word_35F92+2(pc,d0.w),(Normal_palette_line4+$18).w
  68664. move.w word_35F92+4(pc,d0.w),(Normal_palette_line4+$1A).w
  68665. rts
  68666. ; ===========================================================================
  68667. ; Special Stage Chaos Emerald palette
  68668. word_35F92: BINCLUDE "art/palettes/SS Emerald.bin"
  68669. ; ===========================================================================
  68670. ; ----------------------------------------------------------------------------
  68671. ; Object 59 - Emerald from Special Stage
  68672. ; ----------------------------------------------------------------------------
  68673. ; Sprite_35FBC:
  68674. Obj59:
  68675. moveq #0,d0
  68676. move.b routine(a0),d0
  68677. move.w Obj59_Index(pc,d0.w),d1
  68678. jmp Obj59_Index(pc,d1.w)
  68679. ; ===========================================================================
  68680. ; off_35FCA:
  68681. Obj59_Index: offsetTable
  68682. offsetTableEntry.w Obj59_Init ; 0
  68683. offsetTableEntry.w loc_36022 ; 2
  68684. offsetTableEntry.w loc_3533A ; 4
  68685. offsetTableEntry.w loc_36160 ; 6
  68686. offsetTableEntry.w loc_36172 ; 8
  68687. ; ===========================================================================
  68688. ; loc_35FD4:
  68689. Obj59_Init:
  68690. st.b (SS_NoCheckpointMsg_flag).w
  68691. st.b (SS_Pause_Only_flag).w
  68692. subi_.w #1,objoff_2A(a0)
  68693. cmpi.w #-$3C,objoff_2A(a0)
  68694. beq.s +
  68695. rts
  68696. ; ---------------------------------------------------------------------------
  68697. +
  68698. moveq #0,d0
  68699. move.b (Current_Special_Stage).w,d0
  68700. bsr.s loc_35F76
  68701. addq.b #2,routine(a0)
  68702. move.l #Obj59_MapUnc_3625A,mappings(a0)
  68703. move.w #make_art_tile(ArtTile_ArtNem_SpecialEmerald,3,0),art_tile(a0)
  68704. move.b #4,render_flags(a0)
  68705. move.b #4,priority(a0)
  68706. move.w #$36,objoff_30(a0)
  68707. move.b #$40,angle(a0)
  68708. bsr.w loc_3529C
  68709.  
  68710. loc_36022:
  68711. bsr.w loc_360F0
  68712. bsr.w loc_3512A
  68713. bsr.w loc_3603C
  68714. lea (off_36228).l,a1
  68715. bsr.w loc_3539E
  68716. bra.w JmpTo44_DisplaySprite
  68717. ; ===========================================================================
  68718.  
  68719. loc_3603C:
  68720. move.w d7,-(sp)
  68721. moveq #0,d2
  68722. moveq #0,d3
  68723. moveq #0,d4
  68724. moveq #0,d5
  68725. moveq #0,d6
  68726. moveq #0,d7
  68727. movea.l (SS_CurrentPerspective).w,a1
  68728. adda_.l #2,a1
  68729. move.w objoff_30(a0),d0
  68730. subq.w #1,d0
  68731. add.w d0,d0
  68732. move.w d0,d1
  68733. add.w d0,d0
  68734. add.w d1,d0
  68735. move.b (a1,d0.w),d2
  68736. move.b 1(a1,d0.w),d3
  68737. move.b 2(a1,d0.w),d4
  68738. move.b 3(a1,d0.w),d5
  68739. move.w d5,d6
  68740. swap d5
  68741. move.w d6,d5
  68742. move.w d4,d6
  68743. swap d4
  68744. move.w d6,d4
  68745. bpl.s loc_36088
  68746. cmpi.b #$48,d3
  68747. blo.s loc_36088
  68748. ext.w d3
  68749.  
  68750. loc_36088:
  68751. move.w d4,d6
  68752. add.w d4,d4
  68753. add.w d6,d4
  68754. lsr.w #2,d4
  68755. move.w d5,d6
  68756. add.w d5,d5
  68757. add.w d6,d5
  68758. lsr.w #2,d5
  68759. move.b angle(a0),d0
  68760. jsrto (CalcSine).l, JmpTo14_CalcSine
  68761. muls.w d4,d1
  68762. muls.w d5,d0
  68763. asr.l #8,d0
  68764. asr.l #8,d1
  68765. add.w d2,d1
  68766. add.w d3,d0
  68767. move.w d1,x_pos(a0)
  68768. move.w d0,y_pos(a0)
  68769. move.b d1,objoff_3A(a0)
  68770. move.b d0,objoff_3B(a0)
  68771. swap d4
  68772. swap d5
  68773. movea.l objoff_34(a0),a1 ; a1=object
  68774. move.b angle(a0),d0
  68775. jsrto (CalcSine).l, JmpTo14_CalcSine
  68776. move.w d4,d6
  68777. lsr.w #2,d6
  68778. add.w d6,d4
  68779. muls.w d4,d1
  68780. move.w d5,d6
  68781. asr.w #2,d6
  68782. add.w d6,d5
  68783. muls.w d5,d0
  68784. asr.l #8,d0
  68785. asr.l #8,d1
  68786. add.w d2,d1
  68787. add.w d3,d0
  68788. move.w d1,x_pos(a1)
  68789. move.w d0,y_pos(a1)
  68790. move.w (sp)+,d7
  68791. rts
  68792. ; ===========================================================================
  68793.  
  68794. loc_360F0:
  68795. cmpi.b #3,anim(a0)
  68796. blo.s return_36140
  68797. tst.b objoff_3E(a0)
  68798. bne.s loc_3610C
  68799. move.w #MusID_FadeOut,d0
  68800. jsr (PlayMusic).l
  68801. st objoff_3E(a0)
  68802.  
  68803. loc_3610C:
  68804. cmpi.b #6,anim(a0)
  68805. blo.s return_36140
  68806. move.w (Ring_count).w,d2
  68807. add.w (Ring_count_2P).w,d2
  68808. cmp.w (SS_Ring_Requirement).w,d2
  68809. blt.s loc_36142
  68810. cmpi.b #9,anim(a0)
  68811. blo.s return_36140
  68812. move.w #$63,objoff_2A(a0)
  68813. move.b #8,routine(a0)
  68814. move.w #MusID_Emerald,d0
  68815. jsr (PlayMusic).l
  68816.  
  68817. return_36140:
  68818. rts
  68819. ; ===========================================================================
  68820.  
  68821. loc_36142:
  68822. move.l #0,(SS_New_Speed_Factor).w
  68823. move.b #6,routine(a0)
  68824. move.w #$4F,objoff_2A(a0)
  68825. move.w #6,d0
  68826. bsr.w loc_35D6E
  68827. rts
  68828. ; ===========================================================================
  68829.  
  68830. loc_36160:
  68831. subi_.w #1,objoff_2A(a0)
  68832. bpl.w JmpTo44_DisplaySprite
  68833. st.b (SS_Check_Rings_flag).w
  68834. bra.w SSClearObjs
  68835. ; ===========================================================================
  68836.  
  68837. loc_36172:
  68838. subi_.w #1,objoff_2A(a0)
  68839. bpl.s loc_361A4
  68840. moveq #0,d0
  68841. move.b (Current_Special_Stage).w,d0
  68842. lea (Got_Emeralds_array).w,a0
  68843. st (a0,d0.w)
  68844. st (Got_Emerald).w
  68845. addi_.b #1,(Current_Special_Stage).w
  68846. addi_.b #1,(Emerald_count).w
  68847. st.b (SS_Check_Rings_flag).w
  68848. bsr.w SSClearObjs
  68849. move.l (sp)+,d0
  68850. rts
  68851. ; ===========================================================================
  68852.  
  68853. loc_361A4:
  68854. addi_.b #1,objoff_3C(a0)
  68855. moveq #0,d0
  68856. moveq #0,d2
  68857. move.b objoff_3B(a0),d2
  68858. move.b objoff_3C(a0),d0
  68859. lsr.w #2,d0
  68860. andi.w #3,d0
  68861. add.b byte_361C8(pc,d0.w),d2
  68862. move.w d2,y_pos(a0)
  68863. bra.w JmpTo44_DisplaySprite
  68864. ; ===========================================================================
  68865. byte_361C8:
  68866. dc.b $FF
  68867. dc.b 0 ; 1
  68868. dc.b 1 ; 2
  68869. dc.b 0 ; 3
  68870. ; ===========================================================================
  68871. ;loc_361CC
  68872. SSClearObjs:
  68873. movea.l #(SS_Object_RAM&$FFFFFF),a1
  68874.  
  68875. move.w #(SS_Object_RAM_End-SS_Object_RAM)/$10-1,d0
  68876. moveq #0,d1
  68877.  
  68878. loc_361D8:
  68879. rept $10/4
  68880. move.l d1,(a1)+
  68881. endm
  68882. dbf d0,loc_361D8
  68883. .c := ((SS_Object_RAM_End-SS_Object_RAM)#$10)/4
  68884. if .c
  68885. rept .c
  68886. move.l d1,(a1)+
  68887. endm
  68888. endif
  68889. .c := ((SS_Object_RAM_End-SS_Object_RAM)#$10)&2
  68890. if .c
  68891. rept .c
  68892. move.w d1,(a1)+
  68893. endm
  68894. endif
  68895.  
  68896. ; Bug: The '+4' shouldn't be here; clearRAM accidentally clears an additional 4 bytes
  68897. clearRAM SS_Sprite_Table,SS_Sprite_Table_End+4
  68898.  
  68899. rts
  68900. ; ===========================================================================
  68901. ; unused/dead code ; a0=object
  68902. cmpi.b #$B,(SSTrack_drawing_index).w
  68903. blo.s loc_36208
  68904. subi.l #$4445,objoff_30(a0)
  68905. bra.s loc_36210
  68906. ; ---------------------------------------------------------------------------
  68907. loc_36208:
  68908. subi.l #$4444,objoff_30(a0)
  68909. loc_36210:
  68910. move.w objoff_30(a0),d0
  68911. cmpi.w #$1D,d0
  68912. ble.s +
  68913. moveq #$1E,d0
  68914. +
  68915. lea_ byte_35180,a1
  68916. move.b (a1,d0.w),anim(a0)
  68917. rts
  68918. ; end of unused code
  68919.  
  68920. ; ===========================================================================
  68921. ; animation script for object 59
  68922. off_36228: offsetTable
  68923. offsetTableEntry.w byte_3623C ; 0
  68924. offsetTableEntry.w byte_3623F ; 1
  68925. offsetTableEntry.w byte_36242 ; 2
  68926. offsetTableEntry.w byte_36245 ; 3
  68927. offsetTableEntry.w byte_36248 ; 4
  68928. offsetTableEntry.w byte_3624B ; 5
  68929. offsetTableEntry.w byte_3624E ; 6
  68930. offsetTableEntry.w byte_36251 ; 7
  68931. offsetTableEntry.w byte_36254 ; 8
  68932. offsetTableEntry.w byte_36257 ; 9
  68933. byte_3623C:
  68934. dc.b $B, 0,$FF
  68935. rev02even
  68936. byte_3623F:
  68937. dc.b $B, 1,$FF
  68938. rev02even
  68939. byte_36242:
  68940. dc.b $B, 2,$FF
  68941. rev02even
  68942. byte_36245:
  68943. dc.b $B, 3,$FF
  68944. rev02even
  68945. byte_36248:
  68946. dc.b $B, 4,$FF
  68947. rev02even
  68948. byte_3624B:
  68949. dc.b $B, 5,$FF
  68950. rev02even
  68951. byte_3624E:
  68952. dc.b $B, 6,$FF
  68953. rev02even
  68954. byte_36251:
  68955. dc.b $B, 7,$FF
  68956. rev02even
  68957. byte_36254:
  68958. dc.b $B, 8,$FF
  68959. rev02even
  68960. byte_36257:
  68961. dc.b $B, 9,$FF
  68962. even
  68963. ; ----------------------------------------------------------------------------
  68964. ; sprite mappings
  68965. ; ----------------------------------------------------------------------------
  68966. Obj59_MapUnc_3625A: BINCLUDE "mappings/sprite/obj59.bin"
  68967.  
  68968. ; animation script:
  68969. ; off_362D2:
  68970. Ani_obj5B_obj60:offsetTable
  68971. offsetTableEntry.w byte_362E8 ; 0
  68972. offsetTableEntry.w byte_362EE ; 1
  68973. offsetTableEntry.w byte_362F4 ; 2
  68974. offsetTableEntry.w byte_362FA ; 3
  68975. offsetTableEntry.w byte_36300 ; 4
  68976. offsetTableEntry.w byte_36306 ; 5
  68977. offsetTableEntry.w byte_3630C ; 6
  68978. offsetTableEntry.w byte_36312 ; 7
  68979. offsetTableEntry.w byte_36318 ; 8
  68980. offsetTableEntry.w byte_3631E ; 9
  68981. offsetTableEntry.w byte_36324 ; $A
  68982. byte_362E8: dc.b 5, 0, $A,$14, $A,$FF
  68983. rev02even
  68984. byte_362EE: dc.b 5, 1, $B,$15, $B,$FF
  68985. rev02even
  68986. byte_362F4: dc.b 5, 2, $C,$16, $C,$FF
  68987. rev02even
  68988. byte_362FA: dc.b 5, 3, $D,$17, $D,$FF
  68989. rev02even
  68990. byte_36300: dc.b 5, 4, $E,$18, $E,$FF
  68991. rev02even
  68992. byte_36306: dc.b 5, 5, $F,$19, $F,$FF
  68993. rev02even
  68994. byte_3630C: dc.b 5, 6,$10,$1A,$10,$FF
  68995. rev02even
  68996. byte_36312: dc.b 5, 7,$11,$1B,$11,$FF
  68997. rev02even
  68998. byte_36318: dc.b 5, 8,$12,$1C,$12,$FF
  68999. rev02even
  69000. byte_3631E: dc.b 5, 9,$13,$1D,$13,$FF
  69001. rev02even
  69002. byte_36324: dc.b 1,$1E,$1F,$20,$FF
  69003. even
  69004. ; ----------------------------------------------------------------------------
  69005. ; sprite mappings
  69006. ; ----------------------------------------------------------------------------
  69007. Obj5A_Obj5B_Obj60_MapUnc_3632A: BINCLUDE "mappings/sprite/obj5A_5B_60.bin"
  69008.  
  69009. ; animation script:
  69010. ; off_364CE:
  69011. Ani_obj61: offsetTable
  69012. offsetTableEntry.w byte_364E4 ; 0
  69013. offsetTableEntry.w byte_364E7 ; 1
  69014. offsetTableEntry.w byte_364EA ; 2
  69015. offsetTableEntry.w byte_364ED ; 3
  69016. offsetTableEntry.w byte_364F0 ; 4
  69017. offsetTableEntry.w byte_364F3 ; 5
  69018. offsetTableEntry.w byte_364F6 ; 6
  69019. offsetTableEntry.w byte_364F9 ; 7
  69020. offsetTableEntry.w byte_364FC ; 8
  69021. offsetTableEntry.w byte_364FF ; 9
  69022. offsetTableEntry.w byte_36502 ; $A
  69023. byte_364E4: dc.b $B, 0,$FF
  69024. rev02even
  69025. byte_364E7: dc.b $B, 1,$FF
  69026. rev02even
  69027. byte_364EA: dc.b $B, 2,$FF
  69028. rev02even
  69029. byte_364ED: dc.b $B, 3,$FF
  69030. rev02even
  69031. byte_364F0: dc.b $B, 4,$FF
  69032. rev02even
  69033. byte_364F3: dc.b $B, 5,$FF
  69034. rev02even
  69035. byte_364F6: dc.b $B, 6,$FF
  69036. rev02even
  69037. byte_364F9: dc.b $B, 7,$FF
  69038. rev02even
  69039. byte_364FC: dc.b $B, 8,$FF
  69040. rev02even
  69041. byte_364FF: dc.b $B, 9,$FF
  69042. rev02even
  69043. byte_36502: dc.b 2, $A, $B, $C,$FF
  69044. even
  69045. ; ----------------------------------------------------------------------------
  69046. ; sprite mappings
  69047. ; ----------------------------------------------------------------------------
  69048. Obj61_MapUnc_36508: BINCLUDE "mappings/sprite/obj61.bin"
  69049. ; ===========================================================================
  69050.  
  69051. JmpTo44_DisplaySprite
  69052. jmp (DisplaySprite).l
  69053. ; ===========================================================================
  69054.  
  69055. if ~~removeJmpTos
  69056. JmpTo63_DeleteObject
  69057. jmp (DeleteObject).l
  69058. JmpTo24_AnimateSprite
  69059. jmp (AnimateSprite).l
  69060. JmpTo_SSStartNewAct
  69061. jmp (SSStartNewAct).l
  69062. JmpTo_CalcAngle
  69063. jmp (CalcAngle).l
  69064. JmpTo14_CalcSine
  69065. jmp (CalcSine).l
  69066. JmpTo7_ObjectMoveAndFall
  69067. jmp (ObjectMoveAndFall).l
  69068. JmpTo_SSSingleObjLoad2
  69069. jmp (SSSingleObjLoad2).l
  69070. JmpTo2_SSSingleObjLoad
  69071. jmp (SSSingleObjLoad).l
  69072.  
  69073. align 4
  69074. endif
  69075. ; ===========================================================================
  69076.  
  69077.  
  69078.  
  69079.  
  69080. ; ---------------------------------------------------------------------------
  69081. ; LoadSubObject
  69082. ; loads information from a sub-object into this object a0
  69083. ; ---------------------------------------------------------------------------
  69084.  
  69085. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  69086.  
  69087. ; loc_365F4:
  69088. LoadSubObject:
  69089. moveq #0,d0
  69090. move.b subtype(a0),d0
  69091. ; loc_365FA:
  69092. LoadSubObject_Part2:
  69093. move.w SubObjData_Index(pc,d0.w),d0
  69094. lea SubObjData_Index(pc,d0.w),a1
  69095. ; loc_36602:
  69096. LoadSubObject_Part3:
  69097. move.l (a1)+,mappings(a0)
  69098. move.w (a1)+,art_tile(a0)
  69099. jsr (Adjust2PArtPointer).l
  69100. move.b (a1)+,d0
  69101. or.b d0,render_flags(a0)
  69102. move.b (a1)+,priority(a0)
  69103. move.b (a1)+,width_pixels(a0)
  69104. move.b (a1),collision_flags(a0)
  69105. addq.b #2,routine(a0)
  69106. rts
  69107.  
  69108. ; ===========================================================================
  69109. ; table that maps from the subtype ID to which address to load the data from
  69110. ; the format of the data there is
  69111. ; dc.l Pointer_To_Sprite_Mappings
  69112. ; dc.w VRAM_Location
  69113. ; dc.b render_flags, priority, width_pixels, collision_flags
  69114. ;
  69115. ; for whatever reason, only Obj8C and later have entries in this table
  69116.  
  69117. ; off_36628:
  69118. SubObjData_Index: offsetTable
  69119. offsetTableEntry.w Obj8C_SubObjData ; $0
  69120. offsetTableEntry.w Obj8D_SubObjData ; $2
  69121. offsetTableEntry.w Obj90_SubObjData ; $4
  69122. offsetTableEntry.w Obj90_SubObjData2 ; $6
  69123. offsetTableEntry.w Obj91_SubObjData ; $8
  69124. offsetTableEntry.w Obj92_SubObjData ; $A
  69125. offsetTableEntry.w Invalid_SubObjData ; $C
  69126. offsetTableEntry.w Obj94_SubObjData ; $E
  69127. offsetTableEntry.w Obj94_SubObjData2 ; $10
  69128. offsetTableEntry.w Obj99_SubObjData2 ; $12
  69129. offsetTableEntry.w Obj99_SubObjData ; $14
  69130. offsetTableEntry.w Obj9A_SubObjData ; $16
  69131. offsetTableEntry.w Obj9B_SubObjData ; $18
  69132. offsetTableEntry.w Obj9C_SubObjData ; $1A
  69133. offsetTableEntry.w Obj9A_SubObjData2 ; $1C
  69134. offsetTableEntry.w Obj9D_SubObjData ; $1E
  69135. offsetTableEntry.w Obj9D_SubObjData2 ; $20
  69136. offsetTableEntry.w Obj9E_SubObjData ; $22
  69137. offsetTableEntry.w Obj9F_SubObjData ; $24
  69138. offsetTableEntry.w ObjA0_SubObjData ; $26
  69139. offsetTableEntry.w ObjA1_SubObjData ; $28
  69140. offsetTableEntry.w ObjA2_SubObjData ; $2A
  69141. offsetTableEntry.w ObjA3_SubObjData ; $2C
  69142. offsetTableEntry.w ObjA4_SubObjData ; $2E
  69143. offsetTableEntry.w ObjA4_SubObjData2 ; $30
  69144. offsetTableEntry.w ObjA5_SubObjData ; $32
  69145. offsetTableEntry.w ObjA6_SubObjData ; $34
  69146. offsetTableEntry.w ObjA7_SubObjData ; $36
  69147. offsetTableEntry.w ObjA7_SubObjData2 ; $38
  69148. offsetTableEntry.w ObjA8_SubObjData ; $3A
  69149. offsetTableEntry.w ObjA8_SubObjData2 ; $3C
  69150. offsetTableEntry.w ObjA7_SubObjData3 ; $3E
  69151. offsetTableEntry.w ObjAC_SubObjData ; $40
  69152. offsetTableEntry.w ObjAD_SubObjData ; $42
  69153. offsetTableEntry.w ObjAD_SubObjData2 ; $44
  69154. offsetTableEntry.w ObjAD_SubObjData3 ; $46
  69155. offsetTableEntry.w ObjAF_SubObjData2 ; $48
  69156. offsetTableEntry.w ObjAF_SubObjData ; $4A
  69157. offsetTableEntry.w ObjB0_SubObjData ; $4C
  69158. offsetTableEntry.w ObjB1_SubObjData ; $4E
  69159. offsetTableEntry.w ObjB2_SubObjData ; $50
  69160. offsetTableEntry.w ObjB2_SubObjData ; $52
  69161. offsetTableEntry.w ObjB2_SubObjData ; $54
  69162. offsetTableEntry.w ObjBC_SubObjData2 ; $56
  69163. offsetTableEntry.w ObjBC_SubObjData2 ; $58
  69164. offsetTableEntry.w ObjB3_SubObjData ; $5A
  69165. offsetTableEntry.w ObjB2_SubObjData2 ; $5C
  69166. offsetTableEntry.w ObjB3_SubObjData ; $5E
  69167. offsetTableEntry.w ObjB3_SubObjData ; $60
  69168. offsetTableEntry.w ObjB3_SubObjData ; $62
  69169. offsetTableEntry.w ObjB4_SubObjData ; $64
  69170. offsetTableEntry.w ObjB5_SubObjData ; $66
  69171. offsetTableEntry.w ObjB5_SubObjData ; $68
  69172. offsetTableEntry.w ObjB6_SubObjData ; $6A
  69173. offsetTableEntry.w ObjB6_SubObjData ; $6C
  69174. offsetTableEntry.w ObjB6_SubObjData ; $6E
  69175. offsetTableEntry.w ObjB6_SubObjData ; $70
  69176. offsetTableEntry.w ObjB7_SubObjData ; $72
  69177. offsetTableEntry.w ObjB8_SubObjData ; $74
  69178. offsetTableEntry.w ObjB9_SubObjData ; $76
  69179. offsetTableEntry.w ObjBA_SubObjData ; $78
  69180. offsetTableEntry.w ObjBB_SubObjData ; $7A
  69181. offsetTableEntry.w ObjBC_SubObjData2 ; $7C
  69182. offsetTableEntry.w ObjBD_SubObjData ; $7E
  69183. offsetTableEntry.w ObjBD_SubObjData ; $80
  69184. offsetTableEntry.w ObjBE_SubObjData ; $82
  69185. offsetTableEntry.w ObjBE_SubObjData2 ; $84
  69186. offsetTableEntry.w ObjC0_SubObjData ; $86
  69187. offsetTableEntry.w ObjC1_SubObjData ; $88
  69188. offsetTableEntry.w ObjC2_SubObjData ; $8A
  69189. offsetTableEntry.w Invalid_SubObjData2 ; $8C
  69190. offsetTableEntry.w ObjB8_SubObjData2 ; $8E
  69191. offsetTableEntry.w ObjC3_SubObjData ; $90
  69192. offsetTableEntry.w ObjC5_SubObjData ; $92
  69193. offsetTableEntry.w ObjC5_SubObjData2 ; $94
  69194. offsetTableEntry.w ObjC5_SubObjData3 ; $96
  69195. offsetTableEntry.w ObjC5_SubObjData3 ; $98
  69196. offsetTableEntry.w ObjC5_SubObjData3 ; $9A
  69197. offsetTableEntry.w ObjC5_SubObjData3 ; $9C
  69198. offsetTableEntry.w ObjC5_SubObjData3 ; $9E
  69199. offsetTableEntry.w ObjC6_SubObjData2 ; $A0
  69200. offsetTableEntry.w ObjC5_SubObjData4 ; $A2
  69201. offsetTableEntry.w ObjAF_SubObjData3 ; $A4
  69202. offsetTableEntry.w ObjC6_SubObjData3 ; $A6
  69203. offsetTableEntry.w ObjC6_SubObjData4 ; $A8
  69204. offsetTableEntry.w ObjC6_SubObjData ; $AA
  69205. offsetTableEntry.w ObjC8_SubObjData ; $AC
  69206. ; ===========================================================================
  69207. ; ---------------------------------------------------------------------------
  69208. ; Get Orientation To Player
  69209. ; Returns the horizontal and vertical distances of the closest player object.
  69210. ;
  69211. ; input variables:
  69212. ; a0 = object
  69213. ;
  69214. ; returns:
  69215. ; a1 = address of closest player character
  69216. ; d0 = 0 if player is left from object, 2 if right
  69217. ; d1 = 0 if player is above object, 2 if below
  69218. ; d2 = closest character's horizontal distance to object
  69219. ; d3 = closest character's vertical distance to object
  69220. ;
  69221. ; writes:
  69222. ; d0, d1, d2, d3, d4, d5
  69223. ; a1
  69224. ; a2 = sidekick
  69225. ; ---------------------------------------------------------------------------
  69226. ;loc_366D6:
  69227. Obj_GetOrientationToPlayer:
  69228. moveq #0,d0
  69229. moveq #0,d1
  69230. lea (MainCharacter).w,a1 ; a1=character
  69231. move.w x_pos(a0),d2
  69232. sub.w x_pos(a1),d2
  69233. mvabs.w d2,d4 ; absolute horizontal distance to main character
  69234. lea (Sidekick).w,a2 ; a2=character
  69235. move.w x_pos(a0),d3
  69236. sub.w x_pos(a2),d3
  69237. mvabs.w d3,d5 ; absolute horizontal distance to sidekick
  69238. cmp.w d5,d4 ; get shorter distance
  69239. bls.s + ; branch, if main character is closer
  69240. ; if sidekick is closer
  69241. movea.l a2,a1
  69242. move.w d3,d2
  69243. +
  69244. tst.w d2 ; is player to enemy's left?
  69245. bpl.s + ; if not, branch
  69246. addq.w #2,d0
  69247. +
  69248. move.w y_pos(a0),d3
  69249. sub.w y_pos(a1),d3 ; vertical distance to closest character
  69250. bhs.s + ; branch, if enemy is under
  69251. addq.w #2,d1
  69252. +
  69253. rts
  69254. ; ===========================================================================
  69255. ; ---------------------------------------------------------------------------
  69256. ; Cap Object Speed
  69257. ; Prevents an object from going over a specified speed value.
  69258. ;
  69259. ; input variables:
  69260. ; d0 = max x velocity
  69261. ; d1 = max y velocity
  69262. ;
  69263. ; a0 = object
  69264. ;
  69265. ; writes:
  69266. ; d0, d1, d2, d3
  69267. ; ---------------------------------------------------------------------------
  69268. ; loc_3671A:
  69269. Obj_CapSpeed:
  69270. move.w x_vel(a0),d2
  69271. bpl.s + ; branch, if object is moving right
  69272. ; going left
  69273. neg.w d0 ; set opposite direction
  69274. cmp.w d0,d2 ; is object's current x velocity lower than max?
  69275. bhs.s ++ ; if yes, branch
  69276. move.w d0,d2 ; else, cap speed
  69277. bra.w ++
  69278. ; ===========================================================================
  69279. + ; going right
  69280. cmp.w d0,d2 ; is object's current x velocity lower than max?
  69281. bls.s + ; if yes, branch
  69282. move.w d0,d2 ; else, cap speed
  69283. +
  69284. move.w y_vel(a0),d3
  69285. bpl.s + ; branch, if object is moving down
  69286. ; going up
  69287. neg.w d1 ; set opposite direction
  69288. cmp.w d1,d3 ; is object's current y velocity lower than max?
  69289. bhs.s ++ ; if yes, branch
  69290. move.w d1,d3 ; else, cap speed
  69291. bra.w ++
  69292. ; ===========================================================================
  69293. + ; going down
  69294. cmp.w d1,d3 ; is object's current y velocity lower than max?
  69295. bls.s + ; if yes, branch
  69296. move.w d1,d3 ; else, cap speed
  69297. + ; update speed
  69298. move.w d2,x_vel(a0)
  69299. move.w d3,y_vel(a0)
  69300. rts
  69301. ; ===========================================================================
  69302. ; ---------------------------------------------------------------------------
  69303. ; Movement Stop
  69304. ; Stops an object's movement.
  69305. ;
  69306. ; input variables:
  69307. ; a0 = object
  69308. ;
  69309. ; writes:
  69310. ; d0 = 0
  69311. ; ---------------------------------------------------------------------------
  69312. ;loc_36754:
  69313. Obj_MoveStop:
  69314. moveq #0,d0
  69315. move.w d0,x_vel(a0)
  69316. move.w d0,y_vel(a0)
  69317. rts
  69318. ; ===========================================================================
  69319. ; ---------------------------------------------------------------------------
  69320. ; Align Child XY
  69321. ; Moves a referenced object to the position of the current object with
  69322. ; variable x and y offset.
  69323. ;
  69324. ; input variables:
  69325. ; d0 = x offset
  69326. ; d1 = y offset
  69327. ;
  69328. ; a0 = parent object
  69329. ; a1 = child object
  69330. ;
  69331. ; writes:
  69332. ; d2 = new x position
  69333. ; d3 = new y position
  69334. ; ---------------------------------------------------------------------------
  69335. ;loc_36760:
  69336. Obj_AlignChildXY:
  69337. move.w x_pos(a0),d2
  69338. add.w d0,d2
  69339. move.w d2,x_pos(a1)
  69340. move.w y_pos(a0),d3
  69341. add.w d1,d3
  69342. move.w d3,y_pos(a1)
  69343. rts
  69344. ; ===========================================================================
  69345.  
  69346. loc_36776:
  69347. move.w (Tornado_Velocity_X).w,d0
  69348. add.w d0,x_pos(a0)
  69349. move.w (Tornado_Velocity_Y).w,d0
  69350. add.w d0,y_pos(a0)
  69351. rts
  69352. ; ===========================================================================
  69353. ; ---------------------------------------------------------------------------
  69354. ; Delete If Behind Screen
  69355. ; deletes an object if it scrolls off the left side of the screen
  69356. ;
  69357. ; input variables:
  69358. ; a0 = object
  69359. ;
  69360. ; writes:
  69361. ; d0
  69362. ; ---------------------------------------------------------------------------
  69363. ;loc_36788:
  69364. Obj_DeleteBehindScreen:
  69365. tst.w (Two_player_mode).w
  69366. beq.s +
  69367. jmp (DisplaySprite).l
  69368. +
  69369. ; when not in two player mode
  69370. move.w x_pos(a0),d0
  69371. andi.w #$FF80,d0
  69372. sub.w (Camera_X_pos_coarse).w,d0
  69373. bmi.w JmpTo64_DeleteObject
  69374. jmp (DisplaySprite).l
  69375. ; ===========================================================================
  69376.  
  69377. loc_367AA:
  69378. move.b render_flags(a0),d0
  69379. if gameRevision<2
  69380. andi.b #$FC,d0
  69381. move.b status(a0),d2
  69382. andi.b #$FC,d2
  69383. move.b render_flags(a1),d1
  69384. andi.b #3,d1
  69385. else
  69386. ; now causes a bug where some sprites are displayed backwards (Silver Sonic's sparks and Grabber's legs)
  69387. andi.b #$FD,d0
  69388. move.b status(a0),d2
  69389. andi.b #$FD,d2
  69390. move.b render_flags(a1),d1
  69391. andi.b #2,d1
  69392. endif
  69393. or.b d1,d0
  69394. or.b d1,d2
  69395. move.b d0,render_flags(a0)
  69396. move.b d2,status(a0)
  69397. rts
  69398. ; ===========================================================================
  69399.  
  69400. ;loc_367D0:
  69401. LoadChildObject:
  69402. jsr (SingleObjLoad2).l
  69403. bne.s + ; rts
  69404. move.w (a2)+,d0
  69405. move.w a1,(a0,d0.w) ; store pointer to child in parent's SST
  69406. _move.b (a2)+,id(a1) ; load obj
  69407. move.b (a2)+,subtype(a1)
  69408. move.w a0,objoff_2C(a1) ; store pointer to parent in child's SST
  69409. move.w x_pos(a0),x_pos(a1)
  69410. move.w y_pos(a0),y_pos(a1)
  69411. +
  69412. rts
  69413. ; ===========================================================================
  69414. ; unused/dead code ; a0=object
  69415. bsr.w Obj_GetOrientationToPlayer
  69416. bclr #0,render_flags(a0)
  69417. bclr #0,status(a0)
  69418. tst.w d0
  69419. beq.s return_36818
  69420. bset #0,render_flags(a0)
  69421. bset #0,status(a0)
  69422.  
  69423. return_36818:
  69424. rts
  69425. ; ===========================================================================
  69426. ; ---------------------------------------------------------------------------
  69427. ; Create Projectiles
  69428. ; Creates a specified number of generic moving projectiles.
  69429. ;
  69430. ; input variables:
  69431. ; d2 = subtype, used for object initialization (refer to LoadSubObject)
  69432. ; d6 = number of projectiles to create -1
  69433. ;
  69434. ; a2 = projectile stat list
  69435. ; format:
  69436. ; dc.b x_offset, y_offset, x_vel, y_vel, mapping_frame, render_flags
  69437. ;
  69438. ; writes:
  69439. ; d0
  69440. ; d1 = index in list
  69441. ; d6 = num objects
  69442. ;
  69443. ; a1 = addres of new projectile
  69444. ; a3 = movement type (ObjectMove)
  69445. ; ---------------------------------------------------------------------------
  69446. ;loc_3681A:
  69447. Obj_CreateProjectiles:
  69448. moveq #0,d1
  69449. ; loop creates d6+1 projectiles
  69450. -
  69451. jsr (SingleObjLoad2).l
  69452. bne.s return_3686E
  69453. _move.b #ObjID_Projectile,id(a1) ; load obj98
  69454. move.b d2,subtype(a1) ; used for object initialization
  69455. move.w x_pos(a0),x_pos(a1) ; align objects
  69456. move.w y_pos(a0),y_pos(a1)
  69457. lea (ObjectMove).l,a3 ; set movement type
  69458. move.l a3,objoff_2A(a1)
  69459. lea (a2,d1.w),a3 ; get address in list
  69460. move.b (a3)+,d0 ; get x offset
  69461. ext.w d0
  69462. add.w d0,x_pos(a1)
  69463. move.b (a3)+,d0 ; get y offset
  69464. ext.w d0
  69465. add.w d0,y_pos(a1)
  69466. move.b (a3)+,x_vel(a1) ; set movement values
  69467. move.b (a3)+,y_vel(a1)
  69468. move.b (a3)+,mapping_frame(a1) ; set map frame
  69469. move.b (a3)+,render_flags(a1) ; set render flags
  69470. addq.w #6,d1
  69471. dbf d6,-
  69472.  
  69473. return_3686E:
  69474. rts
  69475. ; ===========================================================================
  69476. ; ---------------------------------------------------------------------------
  69477. ; Subroutine to animate a sprite using an animation script
  69478. ; Works like AnimateSprite, except for:
  69479. ; * this function does not change render flags to match orientation given by
  69480. ; the status byte;
  69481. ; * the function returns 0 on d0 if it changed the mapping frame, or 1 if an
  69482. ; end-of-animation flag was found ($FC to $FF);
  69483. ; * it is only used by Mecha Sonic;
  69484. ; * some of the end-of-animation flags work differently.
  69485. ; ---------------------------------------------------------------------------
  69486.  
  69487. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  69488.  
  69489. ; loc_36870:
  69490. AnimateSprite_Checked:
  69491. moveq #0,d0
  69492. move.b anim(a0),d0 ; move animation number to d0
  69493. cmp.b next_anim(a0),d0 ; is animation set to change?
  69494. beq.s AnimChk_Run ; if not, branch
  69495. move.b d0,next_anim(a0) ; set next anim to current current
  69496. move.b #0,anim_frame(a0) ; reset animation
  69497. move.b #0,anim_frame_duration(a0) ; reset frame duration
  69498.  
  69499. AnimChk_Run:
  69500. subq.b #1,anim_frame_duration(a0) ; subtract 1 from frame duration
  69501. bpl.s AnimChk_Wait ; if time remains, branch
  69502. add.w d0,d0
  69503. adda.w (a1,d0.w),a1 ; calculate address of appropriate animation script
  69504. move.b (a1),anim_frame_duration(a0) ; load frame duration
  69505. moveq #0,d1
  69506. move.b anim_frame(a0),d1 ; load current frame number
  69507. move.b 1(a1,d1.w),d0 ; read sprite number from script
  69508. bmi.s AnimChk_End_FF ; if animation is complete, branch
  69509. ;loc_368A8
  69510. AnimChk_Next:
  69511. move.b d0,mapping_frame(a0) ; load sprite number
  69512. addq.b #1,anim_frame(a0) ; next frame number
  69513. ;loc_368B0
  69514. AnimChk_Wait:
  69515. moveq #0,d0 ; Return 0
  69516. rts
  69517. ; ---------------------------------------------------------------------------
  69518. ;loc_368B4
  69519. AnimChk_End_FF:
  69520. addq.b #1,d0 ; is the end flag = $FF ?
  69521. bne.s AnimChk_End_FE ; if not, branch
  69522. move.b #0,anim_frame(a0) ; restart the animation
  69523. move.b 1(a1),d0 ; read sprite number
  69524. bsr.s AnimChk_Next
  69525. moveq #1,d0 ; Return 1
  69526. rts
  69527. ; ---------------------------------------------------------------------------
  69528. ;loc_368C8
  69529. AnimChk_End_FE:
  69530. addq.b #1,d0 ; is the end flag = $FE ?
  69531. bne.s AnimChk_End_FD ; if not, branch
  69532. addq.b #2,routine(a0) ; jump to next routine
  69533. move.b #0,anim_frame_duration(a0)
  69534. addq.b #1,anim_frame(a0)
  69535. moveq #1,d0 ; Return 1
  69536. rts
  69537. ; ---------------------------------------------------------------------------
  69538. ;loc_368DE
  69539. AnimChk_End_FD:
  69540. addq.b #1,d0 ; is the end flag = $FD ?
  69541. bne.s AnimChk_End_FC ; if not, branch
  69542. addq.b #2,routine_secondary(a0) ; jump to next routine
  69543. moveq #1,d0 ; Return 1
  69544. rts
  69545. ; ---------------------------------------------------------------------------
  69546. ;loc_368EA
  69547. AnimChk_End_FC:
  69548. addq.b #1,d0 ; is the end flag = $FC ?
  69549. bne.s AnimChk_End ; if not, branch
  69550. move.b #1,anim_frame_duration(a0) ; Force frame duration to 1
  69551. moveq #1,d0 ; Return 1
  69552.  
  69553. AnimChk_End:
  69554. rts
  69555. ; ===========================================================================
  69556. ; ---------------------------------------------------------------------------
  69557. ; Delete If Off-Screen
  69558. ; deletes an object if it is too far away from the screen
  69559. ;
  69560. ; input variables:
  69561. ; a0 = object
  69562. ;
  69563. ; writes:
  69564. ; d0
  69565. ; ---------------------------------------------------------------------------
  69566. ;loc_368F8:
  69567. Obj_DeleteOffScreen:
  69568. tst.w (Two_player_mode).w
  69569. beq.s +
  69570. jmp (DisplaySprite).l
  69571. +
  69572. ; when not in two player mode
  69573. move.w x_pos(a0),d0
  69574. andi.w #$FF80,d0
  69575. sub.w (Camera_X_pos_coarse).w,d0
  69576. cmpi.w #$280,d0
  69577. bhi.w JmpTo64_DeleteObject
  69578. jmp (DisplaySprite).l
  69579. ; ===========================================================================
  69580.  
  69581. if removeJmpTos
  69582. JmpTo65_DeleteObject
  69583. endif
  69584.  
  69585. JmpTo64_DeleteObject
  69586. jmp (DeleteObject).l
  69587.  
  69588.  
  69589.  
  69590.  
  69591. ; ===========================================================================
  69592. ; ----------------------------------------------------------------------------
  69593. ; Object 8C - Whisp (blowfly badnik) from ARZ
  69594. ; ----------------------------------------------------------------------------
  69595. ; Sprite_36924:
  69596. Obj8C:
  69597. moveq #0,d0
  69598. move.b routine(a0),d0
  69599. move.w Obj8C_Index(pc,d0.w),d1
  69600. jmp Obj8C_Index(pc,d1.w)
  69601. ; ===========================================================================
  69602. ; off_36932: Obj8C_States:
  69603. Obj8C_Index: offsetTable
  69604. offsetTableEntry.w Obj8C_Init ; 0
  69605. offsetTableEntry.w loc_3694E ; 1
  69606. offsetTableEntry.w loc_369A8 ; 2
  69607. offsetTableEntry.w loc_36958 ; 3
  69608. offsetTableEntry.w loc_36A26 ; 4
  69609. ; ===========================================================================
  69610. ; loc_3693C:
  69611. Obj8C_Init:
  69612. bsr.w LoadSubObject
  69613. move.b #$10,objoff_2A(a0)
  69614. move.b #4,objoff_2B(a0)
  69615. rts
  69616. ; ===========================================================================
  69617.  
  69618. loc_3694E:
  69619. tst.b render_flags(a0)
  69620. bmi.s loc_36970
  69621. bra.w Obj8C_Animate
  69622. ; ===========================================================================
  69623.  
  69624. loc_36958:
  69625. subq.b #1,objoff_2A(a0)
  69626. bmi.s loc_36970
  69627. ; loc_3695E:
  69628. Obj8C_Animate:
  69629. lea (Ani_obj8C).l,a1
  69630. jsr (AnimateSprite).l
  69631. jmp (MarkObjGone).l
  69632. ; ===========================================================================
  69633.  
  69634. loc_36970:
  69635. subq.b #1,objoff_2B(a0)
  69636. bpl.s loc_36996
  69637. move.b #8,routine(a0)
  69638. bclr #0,status(a0)
  69639. clr.w y_vel(a0)
  69640. move.w #-$200,x_vel(a0)
  69641. move.w #-$200,y_vel(a0)
  69642. bra.w loc_36A26
  69643. ; ===========================================================================
  69644.  
  69645. loc_36996:
  69646. move.b #4,routine(a0)
  69647. move.w #-$100,y_vel(a0)
  69648. move.b #$60,objoff_2A(a0)
  69649.  
  69650. loc_369A8:
  69651. subq.b #1,objoff_2A(a0)
  69652. bmi.s loc_369F8
  69653. bsr.w Obj_GetOrientationToPlayer
  69654. bclr #0,status(a0)
  69655. tst.w d0
  69656. beq.s loc_369C2
  69657. bset #0,status(a0)
  69658.  
  69659. loc_369C2:
  69660. move.w word_369F4(pc,d0.w),d2
  69661. add.w d2,x_vel(a0)
  69662. move.w word_369F4(pc,d1.w),d2
  69663. add.w d2,y_vel(a0)
  69664. move.w #$200,d0
  69665. move.w d0,d1
  69666. bsr.w Obj_CapSpeed
  69667. jsr (ObjectMove).l
  69668. lea (Ani_obj8C).l,a1
  69669. jsr (AnimateSprite).l
  69670. jmp (MarkObjGone).l
  69671. ; ===========================================================================
  69672. word_369F4:
  69673. dc.w -$10
  69674. dc.w $10
  69675. ; ===========================================================================
  69676.  
  69677. loc_369F8:
  69678. move.b #6,routine(a0)
  69679. jsr (RandomNumber).l
  69680. move.l (RNG_seed).w,d0
  69681. andi.b #$1F,d0
  69682. move.b d0,objoff_2A(a0)
  69683. bsr.w Obj_MoveStop
  69684. lea (Ani_obj8C).l,a1
  69685. jsr (AnimateSprite).l
  69686. jmp (MarkObjGone).l
  69687. ; ===========================================================================
  69688.  
  69689. loc_36A26:
  69690. jsr (ObjectMove).l
  69691. lea (Ani_obj8C).l,a1
  69692. jsr (AnimateSprite).l
  69693. jmp (MarkObjGone).l
  69694. ; ===========================================================================
  69695. ; off_36A3E:
  69696. Obj8C_SubObjData:
  69697. subObjData Obj8C_MapUnc_36A4E,make_art_tile(ArtTile_ArtNem_Whisp,1,1),4,4,$C,$B
  69698. ; animation script
  69699. ; off_36A48:
  69700. Ani_obj8C: offsetTable
  69701. offsetTableEntry.w + ; 0
  69702. + dc.b 1, 0, 1,$FF
  69703. even
  69704. ; ------------------------------------------------------------------------
  69705. ; sprite mappings
  69706. ; ------------------------------------------------------------------------
  69707. Obj8C_MapUnc_36A4E: BINCLUDE "mappings/sprite/obj8C.bin"
  69708. ; ===========================================================================
  69709. ; ----------------------------------------------------------------------------
  69710. ; Object 8D - Grounder in wall, from ARZ
  69711. ; ----------------------------------------------------------------------------
  69712. ; Sprite_36A76:
  69713. Obj8D:
  69714. moveq #0,d0
  69715. move.b routine(a0),d0
  69716. move.w Obj8D_Index(pc,d0.w),d1
  69717. jmp Obj8D_Index(pc,d1.w)
  69718. ; ===========================================================================
  69719. ; off_36A84:
  69720. Obj8D_Index: offsetTable
  69721. offsetTableEntry.w Obj8D_Init ; 0
  69722. offsetTableEntry.w loc_36ADC ; 2
  69723. offsetTableEntry.w Obj8D_Animate ; 4
  69724. offsetTableEntry.w loc_36B0E ; 6
  69725. offsetTableEntry.w loc_36B34 ; 8
  69726. offsetTableEntry.w loc_36B6A ; $A
  69727. ; ===========================================================================
  69728. ; loc_36A90:
  69729. Obj8D_Init:
  69730. bsr.w LoadSubObject
  69731. bclr #1,render_flags(a0)
  69732. beq.s +
  69733. bclr #1,status(a0)
  69734. andi.w #drawing_mask,art_tile(a0)
  69735. +
  69736. move.b #$14,y_radius(a0)
  69737. move.b #$10,x_radius(a0)
  69738. jsr (ObjCheckFloorDist).l
  69739. tst.w d1
  69740. bpl.s +
  69741. add.w d1,y_pos(a0)
  69742. move.w #0,y_vel(a0)
  69743. +
  69744. _move.b id(a0),d0
  69745. subi.b #ObjID_GrounderInWall,d0
  69746. beq.w loc_36C64
  69747. move.b #6,routine(a0)
  69748. rts
  69749. ; ===========================================================================
  69750.  
  69751. loc_36ADC:
  69752. bsr.w Obj_GetOrientationToPlayer
  69753. abs.w d2
  69754. cmpi.w #$60,d2
  69755. bls.s +
  69756. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69757. ; ===========================================================================
  69758. +
  69759. addq.b #2,routine(a0)
  69760. st objoff_2B(a0)
  69761. bsr.w loc_36C2C
  69762. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69763. ; ===========================================================================
  69764. ; loc_36B00:
  69765. Obj8D_Animate:
  69766. lea (Ani_obj8D_b).l,a1
  69767. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  69768. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69769. ; ===========================================================================
  69770.  
  69771. loc_36B0E:
  69772. addq.b #2,routine(a0)
  69773. bsr.w Obj_GetOrientationToPlayer
  69774. move.w Obj8D_Directions(pc,d0.w),x_vel(a0)
  69775. bclr #0,status(a0)
  69776. tst.w d0
  69777. beq.s +
  69778. bset #0,status(a0)
  69779. +
  69780. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69781. ; ===========================================================================
  69782. ; word_36B30:
  69783. Obj8D_Directions:
  69784. dc.w -$100
  69785. dc.w $100 ; 1
  69786. ; ===========================================================================
  69787.  
  69788. loc_36B34:
  69789. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  69790. jsr (ObjCheckFloorDist).l
  69791. cmpi.w #-1,d1
  69792. blt.s loc_36B5C
  69793. cmpi.w #$C,d1
  69794. bge.s loc_36B5C
  69795. add.w d1,y_pos(a0)
  69796. lea (Ani_obj8D_a).l,a1
  69797. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  69798. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69799. ; ===========================================================================
  69800.  
  69801. loc_36B5C:
  69802. addq.b #2,routine(a0)
  69803. move.b #$3B,objoff_2A(a0)
  69804. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69805. ; ===========================================================================
  69806.  
  69807. loc_36B6A:
  69808. subq.b #1,objoff_2A(a0)
  69809. bmi.s loc_36B74
  69810. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69811. ; ===========================================================================
  69812.  
  69813. loc_36B74:
  69814. move.b #8,routine(a0)
  69815. neg.w x_vel(a0)
  69816. bchg #0,status(a0)
  69817. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69818. ; ===========================================================================
  69819. ; ----------------------------------------------------------------------------
  69820. ; Object 8F - Wall behind which Grounder hides, from ARZ
  69821. ; ----------------------------------------------------------------------------
  69822. ; Sprite_36B88:
  69823. Obj8F:
  69824. moveq #0,d0
  69825. move.b routine(a0),d0
  69826. move.w Obj8F_Index(pc,d0.w),d1
  69827. jmp Obj8F_Index(pc,d1.w)
  69828. ; ===========================================================================
  69829. ; off_36B96:
  69830. Obj8F_Index: offsetTable
  69831. offsetTableEntry.w Obj8F_Init ; 0
  69832. offsetTableEntry.w loc_36BA6 ; 2
  69833. offsetTableEntry.w Obj8F_Move ; 4
  69834. ; ===========================================================================
  69835. ; loc_36B9C:
  69836. Obj8F_Init:
  69837. bsr.w LoadSubObject
  69838. clr.w art_tile(a0)
  69839. rts
  69840. ; ===========================================================================
  69841.  
  69842. loc_36BA6:
  69843. movea.w objoff_2C(a0),a1 ; a1=object
  69844. tst.b objoff_2B(a1)
  69845. bne.s +
  69846. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69847. ; ===========================================================================
  69848. +
  69849. addq.b #2,routine(a0)
  69850. move.w objoff_2E(a0),d0
  69851. move.b Obj8F_Directions(pc,d0.w),x_vel(a0)
  69852. move.b Obj8F_Directions+1(pc,d0.w),y_vel(a0)
  69853. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69854. ; ===========================================================================
  69855. ; byte_36BCC:
  69856. Obj8F_Directions:
  69857. dc.b 1,-2 ; 0
  69858. dc.b 1,-1 ; 2
  69859. dc.b -1,-2 ; 4
  69860. dc.b -1,-1 ; 6
  69861. ; ===========================================================================
  69862. ; ----------------------------------------------------------------------------
  69863. ; Object 90 - Rocks thrown by Grounder behind wall, from ARZ
  69864. ; ----------------------------------------------------------------------------
  69865. ; Sprite_36BD4:
  69866. Obj90:
  69867. moveq #0,d0
  69868. move.b routine(a0),d0
  69869. move.w Obj90_Index(pc,d0.w),d1
  69870. jmp Obj90_Index(pc,d1.w)
  69871. ; ===========================================================================
  69872. ; off_36BE2:
  69873. Obj90_Index: offsetTable
  69874. offsetTableEntry.w Obj90_Init ; 0
  69875. offsetTableEntry.w Obj90_Move ; 2
  69876. ; ===========================================================================
  69877. ; loc_36BE6:
  69878. Obj90_Init:
  69879. bsr.w LoadSubObject
  69880. move.w #make_art_tile(ArtTile_ArtNem_Grounder,2,0),art_tile(a0)
  69881. move.w objoff_2E(a0),d0
  69882. move.b Obj90_Directions(pc,d0.w),x_vel(a0)
  69883. move.b Obj90_Directions+1(pc,d0.w),y_vel(a0)
  69884. lsr.w #1,d0
  69885. move.b Obj90_Frames(pc,d0.w),mapping_frame(a0)
  69886. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69887. ; ===========================================================================
  69888. ; byte_36C0C:
  69889. Obj90_Frames:
  69890. dc.b 0
  69891. dc.b 2 ; 1
  69892. dc.b 0 ; 2
  69893. dc.b 1 ; 3
  69894. dc.b 0 ; 4
  69895. dc.b 0 ; 5
  69896. ; ===========================================================================
  69897. ; byte_36C12:
  69898. Obj90_Directions:
  69899. dc.b -1, -4
  69900. dc.b 4, -3 ; 2
  69901. dc.b 2, 0 ; 4
  69902. dc.b -3, -1 ; 6
  69903. dc.b -3, -3 ; 8
  69904. ; ===========================================================================
  69905. ; loc_36C1C:
  69906. Obj8F_Move:
  69907. Obj90_Move:
  69908. tst.b render_flags(a0)
  69909. bpl.w JmpTo65_DeleteObject
  69910. jsrto (ObjectMoveAndFall).l, JmpTo8_ObjectMoveAndFall
  69911. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  69912. ; ===========================================================================
  69913.  
  69914. loc_36C2C:
  69915. moveq #0,d1
  69916.  
  69917. moveq #4,d6
  69918. - jsrto (SingleObjLoad).l, JmpTo19_SingleObjLoad
  69919. bne.s + ; rts
  69920. bsr.w loc_36C40
  69921. dbf d6,-
  69922. +
  69923. rts
  69924. ; ===========================================================================
  69925.  
  69926. loc_36C40:
  69927. _move.b #ObjID_GrounderRocks,id(a1) ; load obj90
  69928. move.b #6,subtype(a1) ; <== Obj90_SubObjData2
  69929. move.w a0,objoff_2C(a1)
  69930. move.w d1,objoff_2E(a1)
  69931. move.w x_pos(a0),x_pos(a1)
  69932. move.w y_pos(a0),y_pos(a1)
  69933. addq.w #2,d1
  69934. rts
  69935. ; ===========================================================================
  69936.  
  69937. loc_36C64:
  69938. moveq #0,d1
  69939.  
  69940. moveq #3,d6
  69941. - jsrto (SingleObjLoad).l, JmpTo19_SingleObjLoad
  69942. bne.s + ; rts
  69943. bsr.w loc_36C78
  69944. dbf d6,-
  69945. +
  69946. rts
  69947. ; ===========================================================================
  69948.  
  69949. loc_36C78:
  69950. _move.b #ObjID_GrounderWall,id(a1) ; load obj8F
  69951. move.b #4,subtype(a1) ; <== Obj90_SubObjData
  69952. move.w a0,objoff_2C(a1)
  69953. move.w d1,objoff_2E(a1)
  69954. move.l x_pos(a0),d0
  69955. swap d0
  69956. moveq #0,d2
  69957. move.b byte_36CBC(pc,d1.w),d2
  69958. ext.w d2
  69959. add.w d2,d0
  69960. swap d0
  69961. move.l d0,x_pos(a1)
  69962. move.l y_pos(a0),d0
  69963. swap d0
  69964. moveq #0,d2
  69965. move.b byte_36CBC+1(pc,d1.w),d2
  69966. ext.w d2
  69967. add.w d2,d0
  69968. swap d0
  69969. move.l d0,y_pos(a1)
  69970. addq.w #2,d1
  69971. rts
  69972. ; ===========================================================================
  69973. byte_36CBC:
  69974. dc.b 0,-$14
  69975. dc.b $10, -4 ; 2
  69976. dc.b 0, $C ; 4
  69977. dc.b -$10, -4 ; 6
  69978. ; off_36CC4:
  69979. Obj8D_SubObjData:
  69980. subObjData Obj8D_MapUnc_36CF0,make_art_tile(ArtTile_ArtNem_Grounder,1,1),4,5,$10,2
  69981. ; off_36CCE:
  69982. Obj90_SubObjData:
  69983. subObjData Obj90_MapUnc_36D00,make_art_tile(ArtTile_ArtKos_LevelArt,0,0),$84,4,$10,0
  69984. ; off_36CD8:
  69985. Obj90_SubObjData2:
  69986. subObjData Obj90_MapUnc_36CFA,make_art_tile(ArtTile_ArtNem_Grounder,1,1),$84,4,8,0
  69987.  
  69988. ; animation script
  69989. Ani_obj8D_a: offsetTable
  69990. offsetTableEntry.w + ; 0
  69991. + dc.b 3, 2, 3, 4,$FF
  69992. even
  69993. ; animation script
  69994. ; off_36CEA:
  69995. Ani_obj8D_b: offsetTable
  69996. offsetTableEntry.w +
  69997. + dc.b 7, 0, 1,$FC
  69998. even
  69999. ; -----------------------------------------------------------------------------
  70000. ; sprite mappings (obj8D)
  70001. ; -----------------------------------------------------------------------------
  70002. Obj8D_MapUnc_36CF0: offsetTable
  70003. offsetTableEntry.w word_36D02 ; 0
  70004. offsetTableEntry.w word_36D24 ; 2
  70005. offsetTableEntry.w word_36D46 ; 4
  70006. offsetTableEntry.w word_36D58 ; 6
  70007. offsetTableEntry.w word_36D6A ; 8
  70008. ; -----------------------------------------------------------------------------
  70009. ; sprite mappings (obj90)
  70010. ; -----------------------------------------------------------------------------
  70011. Obj90_MapUnc_36CFA: offsetTable
  70012. offsetTableEntry.w word_36D7C ; 0
  70013. offsetTableEntry.w word_36D86 ; 2
  70014. offsetTableEntry.w word_36D90 ; 4
  70015. ; -----------------------------------------------------------------------------
  70016. ; sprite mappings (obj90)
  70017. ; -----------------------------------------------------------------------------
  70018. Obj90_MapUnc_36D00: offsetTable
  70019. offsetTableEntry.w word_36D9A ; 0
  70020. word_36D02:
  70021. dc.w 4
  70022. dc.w $F400, 0, 0,$FFF8
  70023. dc.w $FC06, 1, 0,$FFF0 ; 4
  70024. dc.w $F400, $800, $800, 0 ; 8
  70025. dc.w $FC06, $801, $800, 0 ; 12
  70026. word_36D24:
  70027. dc.w 4
  70028. dc.w $EC00, 7, 3,$FFF8
  70029. dc.w $F407, 8, 4,$FFF0 ; 4
  70030. dc.w $EC00, $807, $803, 0 ; 8
  70031. dc.w $F407, $808, $804, 0 ; 12
  70032. word_36D46:
  70033. dc.w 2
  70034. dc.w $EC0F, $10, 8,$FFF0
  70035. dc.w $C0C, $20, $10,$FFF0 ; 4
  70036. word_36D58:
  70037. dc.w 2
  70038. dc.w $EC0F, $10, 8,$FFF0
  70039. dc.w $C0C, $24, $12,$FFF0 ; 4
  70040. word_36D6A:
  70041. dc.w 2
  70042. dc.w $EC0F, $10, 8,$FFF0
  70043. dc.w $C0C, $28, $14,$FFF0 ; 4
  70044. word_36D7C:
  70045. dc.w 1
  70046. dc.w $F805, $2C, $16,$FFF8
  70047. word_36D86:
  70048. dc.w 1
  70049. dc.w $FC00, $30, $18,$FFFC
  70050. word_36D90:
  70051. dc.w 1
  70052. dc.w $FC00, $31, $18,$FFFC
  70053. word_36D9A:
  70054. dc.w 2
  70055. dc.w $F805,$4093,$4049,$FFF0
  70056. dc.w $F805,$4097,$404B, 0 ; 4
  70057. ; ===========================================================================
  70058. ; ----------------------------------------------------------------------------
  70059. ; Object 91 - Chop Chop (piranha/shark badnik) from ARZ
  70060. ; ----------------------------------------------------------------------------
  70061. ; OST Variables:
  70062. Obj91_move_timer = objoff_2A ; time to wait before turning around
  70063. Obj91_bubble_timer = objoff_2C ; time to wait before producing a bubble
  70064. ; Sprite_36DAC:
  70065. Obj91:
  70066. moveq #0,d0
  70067. move.b routine(a0),d0
  70068. move.w Obj91_Index(pc,d0.w),d1
  70069. jmp Obj91_Index(pc,d1.w)
  70070. ; ===========================================================================
  70071. ; off_36DBA:
  70072. Obj91_Index: offsetTable
  70073. offsetTableEntry.w Obj91_Init ; 0 - Initialize object variables
  70074. offsetTableEntry.w Obj91_Main ; 2 - Moving back and forth until Sonic or Tails approach
  70075. offsetTableEntry.w Obj91_Waiting ; 4 - Stopped, opening and closing mouth
  70076. offsetTableEntry.w Obj91_Charge ; 6 - Charging at Sonic or Tails
  70077. ; ===========================================================================
  70078. ; loc_36DC2:
  70079. Obj91_Init:
  70080. bsr.w LoadSubObject
  70081. move.w #$200,Obj91_move_timer(a0)
  70082. move.w #$50,Obj91_bubble_timer(a0)
  70083. moveq #$40,d0 ; enemy speed
  70084. btst #0,status(a0) ; is enemy facing left?
  70085. bne.s + ; if not, branch
  70086. neg.w d0 ; else reverse movement direction
  70087. +
  70088. move.w d0,x_vel(a0) ; set speed
  70089. rts
  70090. ; ===========================================================================
  70091. ; loc_36DE4:
  70092. Obj91_Main:
  70093. subq.b #1,Obj91_bubble_timer(a0)
  70094. bne.s + ; branch, if timer isn't done counting down
  70095. bsr.w Obj91_MakeBubble
  70096. +
  70097. subq.w #1,Obj91_move_timer(a0)
  70098. bpl.s + ; branch, if timer isn't done counting down
  70099. move.w #$200,Obj91_move_timer(a0) ; else, reset timer...
  70100. bchg #0,status(a0) ; ... change direction...
  70101. bchg #0,render_flags(a0)
  70102. neg.w x_vel(a0) ; ... and reverse movement
  70103. +
  70104. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70105. bsr.w Obj_GetOrientationToPlayer
  70106. move.w d2,d4
  70107. move.w d3,d5
  70108. bsr.w Obj91_TestCharacterPos ; are Sonic or Tails close enough to attack?
  70109. bne.s Obj91_PrepareCharge ; if yes, prepare to charge at them
  70110. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70111. ; ===========================================================================
  70112. ; loc_36E20
  70113. Obj91_PrepareCharge:
  70114. addq.b #2,routine(a0) ; => Obj91_Waiting
  70115. move.b #$10,Obj91_move_timer(a0) ; time to wait before charging at the player
  70116. clr.w x_vel(a0) ; stop movement
  70117. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70118. ; ===========================================================================
  70119. ; loc_36E32:
  70120. Obj91_Waiting:
  70121. subq.b #1,Obj91_move_timer(a0)
  70122. bmi.s Obj91_MoveTowardsPlayer ; branch, if wait time is over
  70123. bra.w Obj91_Animate
  70124. ; ===========================================================================
  70125. ; loc_36E3C:
  70126. Obj91_MoveTowardsPlayer:
  70127. addq.b #2,routine(a0) ; => Obj91_Charge
  70128. bsr.w Obj_GetOrientationToPlayer
  70129. lsr.w #1,d0 ; set speed based on closest character
  70130. move.b Obj91_HorizontalSpeeds(pc,d0.w),x_vel(a0) ; horizontal
  70131. addi.w #$10,d3
  70132. cmpi.w #$20,d3 ; is closest character withing $10 pixels above or $F pixels below?
  70133. blo.s + ; if not, branch
  70134. lsr.w #1,d1 ; set speed based on closest character
  70135. move.b Obj91_VerticalSpeeds(pc,d1.w),1+y_vel(a0) ; vertical
  70136. +
  70137. bra.w Obj91_Animate
  70138. ; ===========================================================================
  70139. ; byte_36E62:
  70140. Obj91_HorizontalSpeeds:
  70141. dc.b -2 ; 0 - player is left from object -> move left
  70142. dc.b 2 ; 1 - player is right from object -> move right
  70143. ; byte_36E64:
  70144. Obj91_VerticalSpeeds:
  70145. dc.b $80 ; 0 - player is above object -> ... move down?
  70146. dc.b $80 ; 1 - player is below object -> move down
  70147. ; ===========================================================================
  70148. ; loc_36E66:
  70149. Obj91_Charge:
  70150. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70151. ; loc_36E6A:
  70152. Obj91_Animate:
  70153. lea (Ani_obj91).l,a1
  70154. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  70155. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70156. ; ===========================================================================
  70157. ; loc_36E78:
  70158. Obj91_MakeBubble:
  70159. move.w #$50,Obj91_bubble_timer(a0) ; reset timer
  70160. jsrto (SingleObjLoad).l, JmpTo19_SingleObjLoad
  70161. bne.s return_36EB0
  70162. _move.b #ObjID_SmallBubbles,id(a1) ; load obj
  70163. move.b #6,subtype(a1) ; <== Obj90_SubObjData2
  70164. move.w x_pos(a0),x_pos(a1) ; align objects horizontally
  70165. moveq #$14,d0 ; load x-offset
  70166. btst #0,render_flags(a0) ; is object facing left?
  70167. beq.s + ; if not, branch
  70168. neg.w d0 ; else mirror offset
  70169. +
  70170. add.w d0,x_pos(a1) ; add horizontal offset
  70171. move.w y_pos(a0),y_pos(a1) ; align objects vertically
  70172. addq.w #6,y_pos(a1) ; move object 6 pixels down
  70173.  
  70174. return_36EB0:
  70175. rts
  70176. ; ===========================================================================
  70177. ; loc_36EB2:
  70178. Obj91_TestCharacterPos:
  70179. addi.w #$20,d3
  70180. cmpi.w #$40,d3 ; is character too low?
  70181. bhs.s Obj91_DoNotCharge ; if yes, branch
  70182. tst.w d2 ; is character to the left?
  70183. bmi.s Obj91_TestPosLeft ; if yes, branch
  70184. tst.w x_vel(a0) ; is object moving left, towards character?
  70185. bpl.s Obj91_DoNotCharge ; if not, branch
  70186. bra.w Obj91_TestHorizontalDist
  70187. ; ===========================================================================
  70188. ; loc_36ECA:
  70189. Obj91_TestPosLeft:
  70190. tst.w x_vel(a0) ; is object moving right, towards character?
  70191. bmi.s Obj91_DoNotCharge ; if not, branch
  70192. neg.w d2 ; get absolute value
  70193.  
  70194. ; loc_36ED2:
  70195. Obj91_TestHorizontalDist:
  70196. cmpi.w #$20,d2 ; is distance less than $20?
  70197. blo.s Obj91_DoNotCharge ; if yes, don't attack
  70198. cmpi.w #$A0,d2 ; is distance less than $A0?
  70199. blo.s Obj91_PlayerInRange ; if yes, attack
  70200.  
  70201. ; loc_36EDE:
  70202. Obj91_DoNotCharge:
  70203. moveq #0,d2 ; -> don't charge at player
  70204. rts
  70205. ; ===========================================================================
  70206. ; loc_36EE2:
  70207. Obj91_PlayerInRange:
  70208. moveq #1,d2 ; -> charge at player
  70209. rts
  70210. ; ===========================================================================
  70211. ; off_36EE6:
  70212. Obj91_SubObjData:
  70213. subObjData Obj91_MapUnc_36EF6,make_art_tile(ArtTile_ArtNem_ChopChop,1,0),4,4,$10,2
  70214.  
  70215. ; animation script
  70216. ; off_36EF0:
  70217. Ani_obj91: offsetTable
  70218. offsetTableEntry.w +
  70219. + dc.b 4, 0, 1,$FF ; 0
  70220. even
  70221. ; --------------------------------------------------------------------------
  70222. ; sprite mappings
  70223. ; --------------------------------------------------------------------------
  70224. Obj91_MapUnc_36EF6: BINCLUDE "mappings/sprite/obj91.bin"
  70225.  
  70226.  
  70227.  
  70228.  
  70229. ; ===========================================================================
  70230. ; ----------------------------------------------------------------------------
  70231. ; Object 92 - Spiker (drill badnik) from HTZ
  70232. ; ----------------------------------------------------------------------------
  70233. ; Sprite_36F0E:
  70234. Obj92:
  70235. moveq #0,d0
  70236. move.b routine(a0),d0
  70237. move.w Obj92_Index(pc,d0.w),d1
  70238. jmp Obj92_Index(pc,d1.w)
  70239. ; ===========================================================================
  70240. ; off_36F1C:
  70241. Obj92_Index: offsetTable
  70242. offsetTableEntry.w Obj92_Init ; 0
  70243. offsetTableEntry.w loc_36F3C ; 2
  70244. offsetTableEntry.w loc_36F68 ; 4
  70245. offsetTableEntry.w loc_36F90 ; 6
  70246. ; ===========================================================================
  70247. ; loc_36F24:
  70248. Obj92_Init:
  70249. bsr.w LoadSubObject
  70250. move.b #$40,objoff_2A(a0)
  70251. move.w #$80,x_vel(a0)
  70252. bchg #0,status(a0)
  70253. rts
  70254. ; ===========================================================================
  70255.  
  70256. loc_36F3C:
  70257. bsr.w loc_3703E
  70258. bne.s loc_36F48
  70259. subq.b #1,objoff_2A(a0)
  70260. bmi.s loc_36F5A
  70261.  
  70262. loc_36F48:
  70263. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70264. lea (Ani_obj92).l,a1
  70265. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  70266. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70267. ; ===========================================================================
  70268.  
  70269. loc_36F5A:
  70270. addq.b #2,routine(a0)
  70271. move.b #$10,objoff_2A(a0)
  70272. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70273. ; ===========================================================================
  70274.  
  70275. loc_36F68:
  70276. bsr.w loc_3703E
  70277. bne.s +
  70278. subq.b #1,objoff_2A(a0)
  70279. bmi.s loc_36F78
  70280. +
  70281. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70282. ; ===========================================================================
  70283.  
  70284. loc_36F78:
  70285. subq.b #2,routine(a0)
  70286. move.b #$40,objoff_2A(a0)
  70287. neg.w x_vel(a0)
  70288. bchg #0,status(a0)
  70289. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70290. ; ===========================================================================
  70291.  
  70292. loc_36F90:
  70293. move.b objoff_2E(a0),d0
  70294. cmpi.b #8,d0
  70295. beq.s loc_36FA4
  70296. subq.b #1,d0
  70297. move.b d0,objoff_2E(a0)
  70298. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70299. ; ===========================================================================
  70300.  
  70301. loc_36FA4:
  70302. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  70303. bne.s loc_36FDC
  70304. st objoff_2B(a0)
  70305. _move.b #ObjID_SpikerDrill,id(a1) ; load obj93
  70306. move.b subtype(a0),subtype(a1)
  70307. move.w a0,objoff_2C(a1)
  70308. move.w x_pos(a0),x_pos(a1)
  70309. move.w y_pos(a0),y_pos(a1)
  70310. move.b #4,mapping_frame(a1)
  70311. move.b #2,mapping_frame(a0)
  70312. move.b #1,anim(a0)
  70313.  
  70314. loc_36FDC:
  70315. move.b objoff_2F(a0),routine(a0)
  70316. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70317. ; ===========================================================================
  70318. ; ----------------------------------------------------------------------------
  70319. ; Object 93 - Drill thrown by Spiker from HTZ
  70320. ; ----------------------------------------------------------------------------
  70321. ; Sprite_36FE6:
  70322. Obj93:
  70323. moveq #0,d0
  70324. move.b routine(a0),d0
  70325. move.w Obj93_Index(pc,d0.w),d1
  70326. jmp Obj93_Index(pc,d1.w)
  70327. ; ===========================================================================
  70328. ; off_36FF4:
  70329. Obj93_Index: offsetTable
  70330. offsetTableEntry.w Obj93_Init ; 0
  70331. offsetTableEntry.w loc_37028 ; 2
  70332. ; ===========================================================================
  70333. ; loc_36FF8:
  70334. Obj93_Init:
  70335. bsr.w LoadSubObject
  70336. ori.b #$80,render_flags(a0)
  70337. ori.b #$80,collision_flags(a0)
  70338. movea.w objoff_2C(a0),a1 ; a1=object
  70339. move.b render_flags(a1),d0
  70340. andi.b #3,d0
  70341. or.b d0,render_flags(a0)
  70342. moveq #2,d1
  70343. btst #1,d0
  70344. bne.s +
  70345. neg.w d1
  70346. +
  70347. move.b d1,y_vel(a0)
  70348. rts
  70349. ; ===========================================================================
  70350.  
  70351. loc_37028:
  70352. tst.b render_flags(a0)
  70353. bpl.w JmpTo65_DeleteObject
  70354. bchg #0,render_flags(a0)
  70355. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70356. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70357. ; ===========================================================================
  70358.  
  70359. loc_3703E:
  70360. tst.b objoff_2B(a0)
  70361. bne.s loc_37062
  70362. tst.b render_flags(a0)
  70363. bpl.s loc_37062
  70364. bsr.w Obj_GetOrientationToPlayer
  70365. addi.w #$20,d2
  70366. cmpi.w #$40,d2
  70367. bhs.s loc_37062
  70368. addi.w #$80,d3
  70369. cmpi.w #$100,d3
  70370. blo.s loc_37066
  70371.  
  70372. loc_37062:
  70373. moveq #0,d0
  70374. rts
  70375. ; ===========================================================================
  70376.  
  70377. loc_37066:
  70378. move.b routine(a0),objoff_2F(a0)
  70379. move.b #6,routine(a0)
  70380. move.b #$10,objoff_2E(a0)
  70381. moveq #1,d0
  70382. rts
  70383. ; ===========================================================================
  70384. ; off_3707C:
  70385. Obj92_SubObjData:
  70386. subObjData Obj92_Obj93_MapUnc_37092,make_art_tile(ArtTile_ArtKos_LevelArt,0,0),4,4,$10,$12
  70387. ; animation script
  70388. ; off_37086:
  70389. Ani_obj92: offsetTable
  70390. offsetTableEntry.w byte_3708A ; 0
  70391. offsetTableEntry.w byte_3708E ; 2
  70392. byte_3708A: dc.b 9, 0, 1,$FF
  70393. byte_3708E: dc.b 9, 2, 3,$FF
  70394. even
  70395. ; ---------------------------------------------------------------------------
  70396. ; sprite mappings
  70397. ; ---------------------------------------------------------------------------
  70398. Obj92_Obj93_MapUnc_37092: BINCLUDE "mappings/sprite/obj93.bin"
  70399. ; ===========================================================================
  70400. ; ----------------------------------------------------------------------------
  70401. ; Object 95 - Sol (fireball-throwing orbit badnik) from HTZ
  70402. ; ----------------------------------------------------------------------------
  70403. ; Sprite_370FE:
  70404. Obj95:
  70405. moveq #0,d0
  70406. move.b routine(a0),d0
  70407. move.w Obj95_Index(pc,d0.w),d1
  70408. jmp Obj95_Index(pc,d1.w)
  70409. ; ===========================================================================
  70410. ; off_3710C:
  70411. Obj95_Index: offsetTable
  70412. offsetTableEntry.w Obj95_Init ; 0
  70413. offsetTableEntry.w Obj95_WaitForPlayer ; 2
  70414. offsetTableEntry.w loc_37224 ; 4
  70415. offsetTableEntry.w Obj95_FireballUpdate ; 6
  70416. offsetTableEntry.w loc_372B8 ; 8
  70417. ; ===========================================================================
  70418. ; loc_37116:
  70419. Obj95_Init:
  70420. move.l #Obj95_MapUnc_372E6,mappings(a0)
  70421. move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
  70422. jsrto (Adjust2PArtPointer).l, JmpTo64_Adjust2PArtPointer
  70423. ori.b #4,render_flags(a0)
  70424. move.b #4,priority(a0)
  70425. move.b #$B,collision_flags(a0)
  70426. move.b #$C,width_pixels(a0)
  70427. move.w #-$40,x_vel(a0)
  70428. moveq #0,d2
  70429. lea objoff_37(a0),a2
  70430. movea.l a2,a3
  70431. addq.w #1,a2
  70432. moveq #3,d1
  70433.  
  70434. ; loc_37152:
  70435. Obj95_NextFireball:
  70436. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  70437. bne.s loc_371AE
  70438. addq.b #1,(a3)
  70439. move.w a1,d5
  70440. subi.w #MainCharacter,d5
  70441. if object_size=$40
  70442. lsr.w #6,d5
  70443. else
  70444. divu.w #object_size,d5
  70445. endif
  70446. andi.w #$7F,d5
  70447. move.b d5,(a2)+
  70448. _move.b id(a0),id(a1) ; load obj95
  70449. move.b #6,routine(a1)
  70450. move.l mappings(a0),mappings(a1)
  70451. move.w art_tile(a0),art_tile(a1)
  70452. ori.b #4,render_flags(a1)
  70453. move.b #4,priority(a1)
  70454. move.b #8,width_pixels(a1)
  70455. move.b #3,mapping_frame(a1)
  70456. move.b #$98,collision_flags(a1)
  70457. move.b d2,angle(a1)
  70458. addi.b #$40,d2
  70459. move.l a0,objoff_3C(a1)
  70460. dbf d1,Obj95_NextFireball
  70461.  
  70462. loc_371AE:
  70463. moveq #1,d0
  70464. btst #0,status(a0)
  70465. beq.s loc_371BA
  70466. neg.w d0
  70467.  
  70468. loc_371BA:
  70469. move.b d0,objoff_36(a0)
  70470. move.b subtype(a0),routine(a0)
  70471. addq.b #2,routine(a0)
  70472. move.w #-$40,x_vel(a0)
  70473. btst #0,status(a0)
  70474. beq.s return_371DA
  70475. neg.w x_vel(a0)
  70476.  
  70477. return_371DA:
  70478. rts
  70479. ; ===========================================================================
  70480.  
  70481. ; loc_371DC:
  70482. Obj95_WaitForPlayer:
  70483. move.w (MainCharacter+x_pos).w,d0
  70484. sub.w x_pos(a0),d0
  70485. bcc.s loc_371E8
  70486. neg.w d0
  70487.  
  70488. loc_371E8:
  70489. cmpi.w #$A0,d0
  70490. bhs.s loc_3720C
  70491. move.w (MainCharacter+y_pos).w,d0
  70492. sub.w y_pos(a0),d0
  70493. bcc.s loc_371FA
  70494. neg.w d0
  70495.  
  70496. loc_371FA:
  70497. cmpi.w #$50,d0
  70498. bhs.s loc_3720C
  70499. tst.w (Debug_placement_mode).w
  70500. bne.s loc_3720C
  70501. move.b #1,anim(a0)
  70502.  
  70503. loc_3720C:
  70504. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70505. lea (Ani_obj95_a).l,a1
  70506. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  70507. andi.b #3,mapping_frame(a0)
  70508. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70509. ; ===========================================================================
  70510.  
  70511. loc_37224:
  70512. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70513. lea (Ani_obj95_b).l,a1
  70514. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  70515. andi.b #3,mapping_frame(a0)
  70516. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70517. ; ===========================================================================
  70518.  
  70519. ; loc_3723C:
  70520. Obj95_FireballUpdate:
  70521. lea (Ani_obj95_b).l,a1
  70522. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  70523. movea.l objoff_3C(a0),a1 ; a1=object
  70524. _cmpi.b #ObjID_Sol,id(a1) ; check if parent object is still alive
  70525. bne.w JmpTo65_DeleteObject
  70526. cmpi.b #2,mapping_frame(a1)
  70527. bne.s Obj95_FireballOrbit
  70528. cmpi.b #$40,angle(a0)
  70529. bne.s Obj95_FireballOrbit
  70530. addq.b #2,routine(a0)
  70531. move.b #0,anim(a0)
  70532. subq.b #1,objoff_37(a1)
  70533. bne.s loc_37278
  70534. addq.b #2,routine(a1)
  70535.  
  70536. loc_37278:
  70537. move.w #-$200,x_vel(a0)
  70538. btst #0,status(a1)
  70539. beq.s +
  70540. neg.w x_vel(a0)
  70541. +
  70542. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  70543. ; ===========================================================================
  70544.  
  70545. ; loc_3728E:
  70546. Obj95_FireballOrbit:
  70547. move.b angle(a0),d0
  70548. jsr (CalcSine).l
  70549. asr.w #4,d1
  70550. add.w x_pos(a1),d1
  70551. move.w d1,x_pos(a0)
  70552. asr.w #4,d0
  70553. add.w y_pos(a1),d0
  70554. move.w d0,y_pos(a0)
  70555. move.b objoff_36(a1),d0
  70556. add.b d0,angle(a0)
  70557. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  70558. ; ===========================================================================
  70559.  
  70560. loc_372B8:
  70561. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70562. tst.b render_flags(a0)
  70563. bpl.w JmpTo65_DeleteObject
  70564. lea (Ani_obj95_b).l,a1
  70565. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  70566. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  70567. ; ===========================================================================
  70568. ; animation script
  70569. ; off_372D2:
  70570. Ani_obj95_a: offsetTable
  70571. offsetTableEntry.w byte_372D6 ; 0
  70572. offsetTableEntry.w byte_372DA ; 1
  70573. byte_372D6: dc.b $F, 0,$FF, 0
  70574. byte_372DA: dc.b $F, 1, 2,$FE, 1
  70575. even
  70576. ; animation script
  70577. ; off_372E0:
  70578. Ani_obj95_b: offsetTable
  70579. offsetTableEntry.w +
  70580. + dc.b 5, 3, 4,$FF
  70581. even
  70582. ; ----------------------------------------------------------------------------
  70583. ; sprite mappings
  70584. ; ----------------------------------------------------------------------------
  70585. Obj95_MapUnc_372E6: BINCLUDE "mappings/sprite/obj95.bin"
  70586.  
  70587. Invalid_SubObjData:
  70588.  
  70589. ; ===========================================================================
  70590. ; ----------------------------------------------------------------------------
  70591. ; Object 94,96 - Rexon (lava snake badnik), from HTZ
  70592. ; ----------------------------------------------------------------------------
  70593. ; Sprite_37322:
  70594. Obj94:
  70595. moveq #0,d0
  70596. move.b routine(a0),d0
  70597. move.w Obj94_Index(pc,d0.w),d1
  70598. jmp Obj94_Index(pc,d1.w)
  70599. ; ===========================================================================
  70600. ; off_37330:
  70601. Obj94_Index: offsetTable
  70602. offsetTableEntry.w Obj94_Init ; 0
  70603. offsetTableEntry.w Obj94_WaitForPlayer ; 2
  70604. offsetTableEntry.w Obj94_ReadyToCreateHead ; 4
  70605. offsetTableEntry.w Obj94_PostCreateHead ; 6
  70606. ; ===========================================================================
  70607. ; loc_37338:
  70608. Obj94_Init:
  70609. bsr.w LoadSubObject
  70610. move.b #2,mapping_frame(a0)
  70611. move.w #-$20,x_vel(a0)
  70612. move.b #$80,objoff_2A(a0)
  70613. rts
  70614. ; ===========================================================================
  70615.  
  70616. ; loc_37350:
  70617. Obj94_WaitForPlayer:
  70618. bsr.w Obj_GetOrientationToPlayer
  70619. addi.w #$60,d2
  70620. cmpi.w #$100,d2
  70621. bhs.s loc_37362
  70622. bsr.w Obj94_CreateHead
  70623.  
  70624. loc_37362:
  70625. move.w x_pos(a0),-(sp)
  70626. bsr.w Obj94_CheckTurnAround
  70627. move.w #$1B,d1
  70628. move.w #8,d2
  70629. move.w #$11,d3
  70630. move.w (sp)+,d4
  70631. jsrto (SolidObject).l, JmpTo27_SolidObject
  70632. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70633. ; ===========================================================================
  70634.  
  70635. ; loc_37380:
  70636. Obj94_CheckTurnAround:
  70637. subq.b #1,objoff_2A(a0)
  70638. bpl.s loc_37396
  70639. move.b #$80,objoff_2A(a0)
  70640. neg.w x_vel(a0)
  70641. bchg #0,render_flags(a0)
  70642.  
  70643. loc_37396:
  70644. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70645. rts
  70646. ; ===========================================================================
  70647.  
  70648. ; loc_3739C:
  70649. Obj94_ReadyToCreateHead:
  70650. bsr.w Obj_GetOrientationToPlayer
  70651. addi.w #$60,d2
  70652. cmpi.w #$100,d2
  70653. bhs.s loc_373AE
  70654. bsr.w Obj94_CreateHead
  70655.  
  70656. loc_373AE:
  70657. bsr.w Obj94_SolidCollision
  70658. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70659. ; ===========================================================================
  70660.  
  70661. ; loc_373B6:
  70662. Obj94_SolidCollision:
  70663. move.w #$1B,d1
  70664. move.w #8,d2
  70665. move.w #8,d3
  70666. move.w x_pos(a0),d4
  70667. jmpto (SolidObject).l, JmpTo27_SolidObject
  70668. ; ===========================================================================
  70669.  
  70670. ; loc_373CA:
  70671. Obj94_PostCreateHead:
  70672. bsr.s Obj94_SolidCollision
  70673. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70674. ; ===========================================================================
  70675. ; ----------------------------------------------------------------------------
  70676. ; Object 97 - Rexon's head, from HTZ
  70677. ; ----------------------------------------------------------------------------
  70678. ; Sprite_373D0:
  70679. Obj97:
  70680. moveq #0,d0
  70681. move.b routine(a0),d0
  70682. move.w Obj97_Index(pc,d0.w),d1
  70683. jmp Obj97_Index(pc,d1.w)
  70684. ; ===========================================================================
  70685. ; off_373DE:
  70686. Obj97_Index: offsetTable
  70687. offsetTableEntry.w Obj97_Init ; 0
  70688. offsetTableEntry.w Obj97_InitialWait ; 2
  70689. offsetTableEntry.w Obj97_RaiseHead ; 4
  70690. offsetTableEntry.w Obj97_Normal ; 6
  70691. offsetTableEntry.w Obj97_DeathDrop ; 8
  70692. ; ===========================================================================
  70693. ; loc_373E8:
  70694. Obj97_Init:
  70695. bsr.w LoadSubObject
  70696. move.b #8,width_pixels(a0)
  70697. moveq #$28,d0
  70698. btst #0,render_flags(a0)
  70699. bne.s +
  70700. moveq #-$18,d0
  70701. +
  70702. add.w d0,x_pos(a0)
  70703. addi.w #$10,y_pos(a0)
  70704. move.b #1,objoff_38(a0)
  70705. movea.w objoff_2C(a0),a1 ; a1=object
  70706. lea objoff_2E(a1),a1
  70707. move.b #$B,collision_flags(a0)
  70708. moveq #0,d0
  70709. move.w objoff_2E(a0),d0
  70710. cmpi.w #8,d0
  70711. beq.s +
  70712. move.b #1,mapping_frame(a0)
  70713. move.b #$8B,collision_flags(a0)
  70714. move.w (a1,d0.w),objoff_30(a0)
  70715. +
  70716. move.w 6(a1),objoff_32(a0)
  70717. lsr.w #1,d0
  70718. move.b byte_3744E(pc,d0.w),objoff_2A(a0)
  70719. move.b d0,objoff_39(a0)
  70720. rts
  70721. ; ===========================================================================
  70722. byte_3744E:
  70723. dc.b $1E
  70724. dc.b $18 ; 1
  70725. dc.b $12 ; 2
  70726. dc.b $C ; 3
  70727. dc.b 6 ; 4
  70728. dc.b 0 ; 5
  70729. ; ===========================================================================
  70730.  
  70731. ; loc_37454:
  70732. Obj97_InitialWait:
  70733. if gameRevision<2
  70734. bsr.w Obj97_CheckHeadIsAlive
  70735. subq.b #1,objoff_2A(a0)
  70736. bmi.s Obj97_StartRaise
  70737. else
  70738. ; fixes an occational crash when defeated
  70739. subq.b #1,objoff_2A(a0)
  70740. bmi.s Obj97_StartRaise
  70741. bsr.w Obj97_CheckHeadIsAlive
  70742. endif
  70743. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70744. ; ===========================================================================
  70745.  
  70746. ; loc_37462:
  70747. Obj97_StartRaise:
  70748. addq.b #2,routine(a0)
  70749. move.w #-$120,x_vel(a0)
  70750. move.w #-$200,y_vel(a0)
  70751. move.w objoff_2E(a0),d0
  70752. subi_.w #8,d0
  70753. neg.w d0
  70754. lsr.w #1,d0
  70755. move.b byte_3744E(pc,d0.w),objoff_2A(a0)
  70756. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70757. ; ===========================================================================
  70758.  
  70759. ; loc_37488:
  70760. Obj97_RaiseHead:
  70761. if gameRevision<2
  70762. bsr.w Obj97_CheckHeadIsAlive
  70763. moveq #$10,d0
  70764. add.w d0,x_vel(a0)
  70765. subq.b #1,objoff_2A(a0)
  70766. bmi.s Obj97_StartNormalState
  70767. else
  70768. ; fixes an occational crash when defeated
  70769. moveq #$10,d0
  70770. add.w d0,x_vel(a0)
  70771. subq.b #1,objoff_2A(a0)
  70772. bmi.s Obj97_StartNormalState
  70773. bsr.w Obj97_CheckHeadIsAlive
  70774. endif
  70775. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  70776. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70777. ; ===========================================================================
  70778.  
  70779. ; loc_374A0:
  70780. Obj97_StartNormalState:
  70781. addq.b #2,routine(a0)
  70782. bsr.w Obj_MoveStop
  70783. move.b #$20,objoff_2A(a0)
  70784. move.w objoff_2E(a0),d0
  70785. lsr.w #1,d0
  70786. move.b byte_374BE(pc,d0.w),objoff_2B(a0)
  70787. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70788. ; ===========================================================================
  70789. byte_374BE:
  70790. dc.b $24
  70791. dc.b $20 ; 1
  70792. dc.b $1C ; 2
  70793. dc.b $1A ; 3
  70794. ; ===========================================================================
  70795.  
  70796. ; loc_374C2:
  70797. Obj97_Normal:
  70798. bsr.w Obj97_CheckHeadIsAlive
  70799. cmpi.w #8,objoff_2E(a0)
  70800. bne.s loc_374D8
  70801. subq.b #1,objoff_2A(a0)
  70802. bpl.s loc_374D8
  70803. bsr.w Obj97_FireProjectile
  70804.  
  70805. loc_374D8:
  70806. move.b objoff_39(a0),d0
  70807. addq.b #1,d0
  70808. move.b d0,objoff_39(a0)
  70809. andi.b #3,d0
  70810. bne.s +
  70811. bsr.w loc_3758A
  70812. bsr.w Obj97_Oscillate
  70813. +
  70814. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70815. ; ===========================================================================
  70816.  
  70817. ; loc_374F4:
  70818. Obj97_DeathDrop:
  70819. move.w (Camera_Max_Y_pos_now).w,d0
  70820. addi.w #$E0,d0
  70821. cmp.w y_pos(a0),d0
  70822. blo.w JmpTo65_DeleteObject
  70823. jsrto (ObjectMoveAndFall).l, JmpTo8_ObjectMoveAndFall
  70824. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  70825. ; ===========================================================================
  70826.  
  70827. ; loc_3750C:
  70828. Obj97_CheckHeadIsAlive:
  70829. movea.w objoff_32(a0),a1 ; a1=object
  70830. cmpi.b #ObjID_RexonHead,(a1)
  70831. beq.s + ; rts
  70832. move.b #8,routine(a0)
  70833. move.w objoff_2E(a0),d0
  70834. move.w word_37528(pc,d0.w),x_vel(a0)
  70835. +
  70836. rts
  70837. ; ===========================================================================
  70838. word_37528:
  70839. dc.w $80
  70840. dc.w -$100 ; 1
  70841. dc.w $100 ; 2
  70842. dc.w -$80 ; 3
  70843. dc.w $80 ; 4
  70844. ; ===========================================================================
  70845.  
  70846. ; loc_37532:
  70847. Obj97_FireProjectile:
  70848. move.b #$7F,objoff_2A(a0)
  70849. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  70850. bne.s ++ ; rts
  70851. _move.b #ObjID_Projectile,id(a1) ; load obj98
  70852. move.b #3,mapping_frame(a1)
  70853. move.b #$10,subtype(a1) ; <== Obj94_SubObjData2
  70854. move.w x_pos(a0),x_pos(a1)
  70855. move.w y_pos(a0),y_pos(a1)
  70856. lea (ObjectMove).l,a2
  70857. move.l a2,objoff_2A(a1)
  70858. moveq #1,d0
  70859. moveq #$10,d1
  70860. btst #0,render_flags(a0)
  70861. bne.s +
  70862. neg.w d0
  70863. neg.w d1
  70864. +
  70865. move.b d0,x_vel(a1)
  70866. add.w d1,x_pos(a1)
  70867. addq.w #4,y_pos(a1)
  70868. move.b #$80,1+y_vel(a1)
  70869. +
  70870. rts
  70871. ; ===========================================================================
  70872.  
  70873. loc_3758A:
  70874. move.b objoff_2B(a0),d0
  70875. move.b objoff_38(a0),d1
  70876. add.b d1,d0
  70877. move.b d0,objoff_2B(a0)
  70878. subi.b #$18,d0
  70879. beq.s +
  70880. bcs.s +
  70881. cmpi.b #$10,d0
  70882. blo.s ++ ; rts
  70883. +
  70884. neg.b objoff_38(a0)
  70885. +
  70886. rts
  70887. ; ===========================================================================
  70888.  
  70889. ; loc_375AC:
  70890. Obj94_CreateHead:
  70891. move.b #6,routine(a0)
  70892. bclr #0,render_flags(a0)
  70893. tst.w d0
  70894. beq.s +
  70895. bset #0,render_flags(a0)
  70896. +
  70897. bsr.w Obj_MoveStop
  70898. lea objoff_2C(a0),a2
  70899. moveq #0,d1
  70900. moveq #4,d6
  70901.  
  70902. loc_375CE:
  70903. jsrto (SingleObjLoad).l, JmpTo19_SingleObjLoad
  70904. bne.s + ; rts
  70905. _move.b #ObjID_RexonHead,id(a1) ; load obj97
  70906. move.b render_flags(a0),render_flags(a1)
  70907. move.b subtype(a0),subtype(a1)
  70908. move.w a0,objoff_2C(a1)
  70909. move.w a1,(a2)+
  70910. move.w d1,objoff_2E(a1)
  70911. move.w x_pos(a0),x_pos(a1)
  70912. move.w y_pos(a0),y_pos(a1)
  70913. addq.w #2,d1
  70914. dbf d6,loc_375CE
  70915. +
  70916. rts
  70917. ; ===========================================================================
  70918.  
  70919. ; loc_37604:
  70920. Obj97_Oscillate:
  70921. move.w objoff_30(a0),d0
  70922. beq.s + ; rts
  70923. movea.w d0,a1 ; a1=object
  70924. lea byte_376A8(pc),a2
  70925. moveq #0,d0
  70926. move.b objoff_2B(a0),d0
  70927. andi.b #$7F,d0
  70928. move.w d0,d1
  70929. andi.w #$1F,d0
  70930. add.w d0,d0
  70931. move.b (a2,d0.w),d2
  70932. ext.w d2
  70933. move.b 1(a2,d0.w),d3
  70934. ext.w d3
  70935. lsr.w #4,d1
  70936. andi.w #6,d1
  70937. move.w off_37652(pc,d1.w),d1
  70938. jsr off_37652(pc,d1.w)
  70939. move.w x_pos(a0),d4
  70940. add.w d2,d4
  70941. move.w d4,x_pos(a1)
  70942. move.b 1+y_pos(a0),d5
  70943. add.b d3,d5
  70944. move.b d5,1+y_pos(a1)
  70945. +
  70946. rts
  70947. ; ===========================================================================
  70948. off_37652: offsetTable
  70949. offsetTableEntry.w return_3765A ; 0
  70950. offsetTableEntry.w loc_3765C ; $20
  70951. offsetTableEntry.w loc_37662 ; $40
  70952. offsetTableEntry.w loc_37668 ; $60
  70953. ; ===========================================================================
  70954.  
  70955. return_3765A:
  70956. rts
  70957. ; ===========================================================================
  70958.  
  70959. loc_3765C:
  70960. exg d2,d3
  70961. neg.w d3
  70962. rts
  70963. ; ===========================================================================
  70964.  
  70965. loc_37662:
  70966. neg.w d2
  70967. neg.w d3
  70968. rts
  70969. ; ===========================================================================
  70970.  
  70971. loc_37668:
  70972. exg d2,d3
  70973. neg.w d2
  70974. rts
  70975. ; ===========================================================================
  70976. ; off_3766E:
  70977. Obj94_SubObjData:
  70978. subObjData Obj94_Obj98_MapUnc_37678,make_art_tile(ArtTile_ArtNem_Rexon,3,0),4,4,$10,0
  70979. ; ------------------------------------------------------------------------
  70980. ; sprite mappings
  70981. ; ------------------------------------------------------------------------
  70982. Obj94_Obj98_MapUnc_37678: BINCLUDE "mappings/sprite/obj97.bin"
  70983.  
  70984. ; seems to be a lookup table for oscillating horizontal position offset
  70985. byte_376A8:
  70986. dc.b $F, 0
  70987. dc.b $F,$FF ; 1
  70988. dc.b $F,$FF ; 2
  70989. dc.b $F,$FE ; 3
  70990. dc.b $F,$FD ; 4
  70991. dc.b $F,$FC ; 5
  70992. dc.b $E,$FC ; 6
  70993. dc.b $E,$FB ; 7
  70994. dc.b $E,$FA ; 8
  70995. dc.b $E,$FA ; 9
  70996. dc.b $D,$F9 ; 10
  70997. dc.b $D,$F8 ; 11
  70998. dc.b $C,$F8 ; 12
  70999. dc.b $C,$F7 ; 13
  71000. dc.b $C,$F6 ; 14
  71001. dc.b $B,$F6 ; 15
  71002. dc.b $B,$F5 ; 16
  71003. dc.b $A,$F5 ; 17
  71004. dc.b $A,$F4 ; 18
  71005. dc.b 9,$F4 ; 19
  71006. dc.b 8,$F4 ; 20
  71007. dc.b 8,$F3 ; 21
  71008. dc.b 7,$F3 ; 22
  71009. dc.b 6,$F2 ; 23
  71010. dc.b 6,$F2 ; 24
  71011. dc.b 5,$F2 ; 25
  71012. dc.b 4,$F2 ; 26
  71013. dc.b 4,$F1 ; 27
  71014. dc.b 3,$F1 ; 28
  71015. dc.b 2,$F1 ; 29
  71016. dc.b 1,$F1 ; 30
  71017. dc.b 1,$F1 ; 31
  71018.  
  71019.  
  71020.  
  71021.  
  71022. ; ===========================================================================
  71023. ; ----------------------------------------------------------------------------
  71024. ; Object 98 - Projectile with optional gravity (EHZ coconut, CPZ spiny, etc.)
  71025. ; ----------------------------------------------------------------------------
  71026. ; Sprite_376E8:
  71027. Obj98:
  71028. moveq #0,d0
  71029. move.b routine(a0),d0
  71030. move.w Obj98_Index(pc,d0.w),d1
  71031. jmp Obj98_Index(pc,d1.w)
  71032. ; ===========================================================================
  71033. ; off_376F6: Obj98_States:
  71034. Obj98_Index: offsetTable
  71035. offsetTableEntry.w Obj98_Init ; 0
  71036. offsetTableEntry.w Obj98_Main ; 2
  71037. ; ===========================================================================
  71038. ; loc_376FA:
  71039. Obj98_Init: ;;
  71040. bra.w LoadSubObject
  71041. ; ===========================================================================
  71042. ; loc_376FE:
  71043. Obj98_Main:
  71044. tst.b render_flags(a0)
  71045. bpl.w JmpTo65_DeleteObject
  71046. movea.l objoff_2A(a0),a1
  71047. jsr (a1) ; dynamic call! to Obj98_NebulaBombFall, Obj98_TurtloidShotMove, Obj98_CoconutFall, Obj98_CluckerShotMove, Obj98_SpinyShotFall, or Obj98_WallTurretShotMove, assuming the code hasn't been changed
  71048. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71049.  
  71050. ; ===========================================================================
  71051. ; for obj99
  71052. ; loc_37710:
  71053. Obj98_NebulaBombFall:
  71054. bchg #palette_bit_0,art_tile(a0) ; bypass the animation system and make it blink
  71055. jmpto (ObjectMoveAndFall).l, JmpTo8_ObjectMoveAndFall
  71056.  
  71057. ; ===========================================================================
  71058. ; for obj9A
  71059. ; loc_3771A:
  71060. Obj98_TurtloidShotMove:
  71061. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71062. lea (Ani_TurtloidShot).l,a1
  71063. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  71064.  
  71065. ; ===========================================================================
  71066. ; for obj9D
  71067. ; loc_37728:
  71068. Obj98_CoconutFall:
  71069. addi.w #$20,y_vel(a0) ; apply gravity (less than normal)
  71070. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71071. rts
  71072.  
  71073. ; ===========================================================================
  71074. ; for objAE
  71075. ; loc_37734:
  71076. Obj98_CluckerShotMove:
  71077. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71078. lea (Ani_CluckerShot).l,a1
  71079. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  71080.  
  71081. ; ===========================================================================
  71082. ; for objA6
  71083. ; loc_37742:
  71084. Obj98_SpinyShotFall:
  71085. addi.w #$20,y_vel(a0) ; apply gravity (less than normal)
  71086. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71087. lea (Ani_SpinyShot).l,a1
  71088. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  71089.  
  71090. ; ===========================================================================
  71091. ; for objB8
  71092. ; loc_37756:
  71093. Obj98_WallTurretShotMove:
  71094. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71095. lea (Ani_WallTurretShot).l,a1
  71096. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  71097.  
  71098. ; ===========================================================================
  71099. ; off_37764:
  71100. Obj94_SubObjData2:
  71101. subObjData Obj94_Obj98_MapUnc_37678,make_art_tile(ArtTile_ArtNem_Rexon,1,0),$84,4,4,$98
  71102. ; off_3776E:
  71103. Obj99_SubObjData:
  71104. subObjData Obj99_Obj98_MapUnc_3789A,make_art_tile(ArtTile_ArtNem_Nebula,1,1),$84,4,8,$8B
  71105. ; off_37778:
  71106. Obj9A_SubObjData2:
  71107. subObjData Obj9A_Obj98_MapUnc_37B62,make_art_tile(ArtTile_ArtNem_Turtloid,0,0),$84,4,4,$98
  71108. ; off_37782:
  71109. Obj9D_SubObjData2:
  71110. subObjData Obj9D_Obj98_MapUnc_37D96,make_art_tile(ArtTile_ArtNem_Coconuts,0,0),$84,4,8,$8B
  71111. ; off_3778C:
  71112. ObjA4_SubObjData2:
  71113. subObjData ObjA4_Obj98_MapUnc_38A96,make_art_tile(ArtTile_ArtNem_MtzSupernova,0,1),$84,5,4,$98
  71114. ; off_37796:
  71115. ObjA6_SubObjData:
  71116. subObjData ObjA5_ObjA6_Obj98_MapUnc_38CCA,make_art_tile(ArtTile_ArtNem_Spiny,1,0),$84,5,4,$98
  71117. ; off_377A0:
  71118. ObjA7_SubObjData3:
  71119. subObjData ObjA7_ObjA8_ObjA9_Obj98_MapUnc_3921A,make_art_tile(ArtTile_ArtNem_Grabber,1,1),$84,4,4,$98
  71120. ; off_377AA:
  71121. ObjAD_SubObjData3:
  71122. subObjData ObjAD_Obj98_MapUnc_395B4,make_art_tile(ArtTile_ArtNem_WfzScratch,0,0),$84,5,4,$98
  71123. ; off_377B4:
  71124. ObjAF_SubObjData:
  71125. subObjData ObjAF_Obj98_MapUnc_39E68,make_art_tile(ArtTile_ArtNem_CNZBonusSpike,1,0),$84,5,4,$98
  71126. ; off_377BE:
  71127. ObjB8_SubObjData2:
  71128. subObjData ObjB8_Obj98_MapUnc_3BA46,make_art_tile(ArtTile_ArtNem_WfzWallTurret,0,0),$84,3,4,$98
  71129.  
  71130.  
  71131.  
  71132.  
  71133. ; ===========================================================================
  71134. ; ----------------------------------------------------------------------------
  71135. ; Object 99 - Nebula (bomber badnik) from SCZ
  71136. ; ----------------------------------------------------------------------------
  71137. ; Sprite_377C8:
  71138. Obj99:
  71139. moveq #0,d0
  71140. move.b routine(a0),d0
  71141. move.w Obj99_Index(pc,d0.w),d1
  71142. jmp Obj99_Index(pc,d1.w)
  71143. ; ===========================================================================
  71144. ; off_377D6:
  71145. Obj99_Index: offsetTable
  71146. offsetTableEntry.w Obj99_Init
  71147. offsetTableEntry.w loc_377E8
  71148. offsetTableEntry.w loc_3781C
  71149. ; ===========================================================================
  71150. ; loc_377DC:
  71151. Obj99_Init:
  71152. bsr.w LoadSubObject
  71153. move.w #-$C0,x_vel(a0)
  71154. rts
  71155. ; ===========================================================================
  71156.  
  71157. loc_377E8:
  71158. bsr.w Obj_GetOrientationToPlayer
  71159. tst.w d0
  71160. bne.s loc_377FA
  71161. cmpi.w #$80,d2
  71162. bhs.s loc_377FA
  71163. bsr.w loc_37810
  71164.  
  71165. loc_377FA:
  71166. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71167. bsr.w loc_36776
  71168. lea (Ani_obj99).l,a1
  71169. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  71170. bra.w Obj_DeleteBehindScreen
  71171. ; ===========================================================================
  71172.  
  71173. loc_37810:
  71174. addq.b #2,routine(a0)
  71175. move.w #-$A0,y_vel(a0)
  71176. rts
  71177. ; ===========================================================================
  71178.  
  71179. loc_3781C:
  71180. tst.b objoff_2A(a0)
  71181. bne.s loc_37834
  71182. bsr.w Obj_GetOrientationToPlayer
  71183. addi_.w #8,d2
  71184. cmpi.w #$10,d2
  71185. bhs.s loc_37834
  71186. bsr.w loc_37850
  71187.  
  71188. loc_37834:
  71189. addi_.w #1,y_vel(a0)
  71190. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71191. bsr.w loc_36776
  71192. lea (Ani_obj99).l,a1
  71193. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  71194. bra.w Obj_DeleteBehindScreen
  71195. ; ===========================================================================
  71196.  
  71197. loc_37850:
  71198. st objoff_2A(a0)
  71199. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  71200. bne.s return_37886
  71201. _move.b #ObjID_Projectile,id(a1) ; load obj98
  71202. move.b #4,mapping_frame(a1)
  71203. move.b #$14,subtype(a1) ; <== Obj99_SubObjData
  71204. move.w x_pos(a0),x_pos(a1)
  71205. move.w y_pos(a0),y_pos(a1)
  71206. addi.w #$18,y_pos(a1)
  71207. lea_ Obj98_NebulaBombFall,a2
  71208. move.l a2,objoff_2A(a1)
  71209.  
  71210. return_37886:
  71211. rts
  71212. ; ===========================================================================
  71213. ; off_37888:
  71214. Obj99_SubObjData2:
  71215. subObjData Obj99_Obj98_MapUnc_3789A,make_art_tile(ArtTile_ArtNem_Nebula,1,1),4,4,$10,6
  71216. ; animation script
  71217. ; off_37892:
  71218. Ani_obj99: offsetTable
  71219. offsetTableEntry.w + ; 0
  71220. + dc.b 3, 0, 1, 2, 3,$FF
  71221. even
  71222. ; ----------------------------------------------------------------------------
  71223. ; sprite mappings
  71224. ; ----------------------------------------------------------------------------
  71225. Obj99_Obj98_MapUnc_3789A: BINCLUDE "mappings/sprite/obj99.bin"
  71226. ; ===========================================================================
  71227. ; ----------------------------------------------------------------------------
  71228. ; Object 9A - Turtloid (turtle badnik) from Sky Chase Zone
  71229. ; ----------------------------------------------------------------------------
  71230. ; Sprite_37936:
  71231. Obj9A:
  71232. moveq #0,d0
  71233. move.b routine(a0),d0
  71234. move.w Obj9A_Index(pc,d0.w),d1
  71235. jmp Obj9A_Index(pc,d1.w)
  71236. ; ===========================================================================
  71237. ; off_37944:
  71238. Obj9A_Index: offsetTable
  71239. offsetTableEntry.w Obj9A_Init ; 0
  71240. offsetTableEntry.w Obj9A_Main ; 2
  71241. ; ===========================================================================
  71242. ; loc_37948:
  71243. Obj9A_Init:
  71244. bsr.w LoadSubObject
  71245. move.w #-$80,x_vel(a0)
  71246. bsr.w loc_37A4A
  71247. lea (Ani_obj9A).l,a1
  71248. move.l a1,objoff_2E(a0)
  71249. bra.w loc_37ABE
  71250. ; ===========================================================================
  71251. ; loc_37964:
  71252. Obj9A_Main:
  71253. moveq #0,d0
  71254. move.b routine_secondary(a0),d0
  71255. move.w off_3797A(pc,d0.w),d1
  71256. jsr off_3797A(pc,d1.w)
  71257. bsr.w loc_37982
  71258. bra.w Obj_DeleteBehindScreen
  71259. ; ===========================================================================
  71260. off_3797A: offsetTable
  71261. offsetTableEntry.w loc_379A0 ; 0
  71262. offsetTableEntry.w loc_379CA ; 2
  71263. offsetTableEntry.w loc_379EA ; 4
  71264. offsetTableEntry.w return_37A04 ; 6
  71265. ; ===========================================================================
  71266.  
  71267. loc_37982:
  71268. move.w x_pos(a0),-(sp)
  71269. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71270. bsr.w loc_36776
  71271. move.w #$18,d1
  71272. move.w #8,d2
  71273. move.w #$E,d3
  71274. move.w (sp)+,d4
  71275. jmpto (PlatformObject).l, JmpTo9_PlatformObject
  71276. ; ===========================================================================
  71277.  
  71278. loc_379A0:
  71279. bsr.w Obj_GetOrientationToPlayer
  71280. tst.w d0
  71281. bmi.w return_37A48
  71282. cmpi.w #$80,d2
  71283. bhs.w return_37A48
  71284. addq.b #2,routine_secondary(a0)
  71285. move.w #0,x_vel(a0)
  71286. move.b #4,objoff_2A(a0)
  71287. move.b #1,mapping_frame(a0)
  71288. rts
  71289. ; ===========================================================================
  71290.  
  71291. loc_379CA:
  71292. subq.b #1,objoff_2A(a0)
  71293. bpl.w return_37A48
  71294. addq.b #2,routine_secondary(a0)
  71295. move.b #8,objoff_2A(a0)
  71296. movea.w objoff_2C(a0),a1 ; a1=object
  71297. move.b #3,mapping_frame(a1)
  71298. bra.w loc_37AF2
  71299. ; ===========================================================================
  71300.  
  71301. loc_379EA:
  71302. subq.b #1,objoff_2A(a0)
  71303. bpl.s return_37A02
  71304. addq.b #2,routine_secondary(a0)
  71305. move.w #-$80,x_vel(a0)
  71306. clr.b mapping_frame(a0)
  71307. movea.w objoff_2C(a0),a1 ; a1=object
  71308.  
  71309. return_37A02:
  71310. rts
  71311. ; ===========================================================================
  71312.  
  71313. return_37A04:
  71314. rts
  71315. ; ===========================================================================
  71316. ; ----------------------------------------------------------------------------
  71317. ; Object 9B - Turtloid rider from Sky Chase Zone
  71318. ; ----------------------------------------------------------------------------
  71319. ; Sprite_37A06:
  71320. Obj9B:
  71321. moveq #0,d0
  71322. move.b routine(a0),d0
  71323. move.w Obj9B_Index(pc,d0.w),d1
  71324. jmp Obj9B_Index(pc,d1.w)
  71325. ; ===========================================================================
  71326. ; off_37A14:
  71327. Obj9B_Index: offsetTable
  71328. offsetTableEntry.w Obj9B_Init ; 0
  71329. offsetTableEntry.w Obj9B_Main ; 2
  71330. ; ===========================================================================
  71331. ; BranchTo_LoadSubObject
  71332. Obj9B_Init:
  71333. bra.w LoadSubObject
  71334. ; ===========================================================================
  71335. ; loc_37A1C:
  71336. Obj9B_Main:
  71337. movea.w objoff_2C(a0),a1 ; a1=object
  71338. lea word_37A2C(pc),a2
  71339. bsr.w loc_37A30
  71340. bra.w Obj_DeleteBehindScreen
  71341. ; ===========================================================================
  71342. word_37A2C:
  71343. dc.w 4 ; 0
  71344. dc.w -$18 ; 1
  71345. ; ===========================================================================
  71346.  
  71347. loc_37A30:
  71348. move.l x_pos(a1),x_pos(a0)
  71349. move.l y_pos(a1),y_pos(a0)
  71350. move.w (a2)+,d0
  71351. add.w d0,x_pos(a0)
  71352. move.w (a2)+,d0
  71353. add.w d0,y_pos(a0)
  71354.  
  71355. return_37A48:
  71356. rts
  71357. ; ===========================================================================
  71358.  
  71359. loc_37A4A:
  71360. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  71361. bne.s return_37A80
  71362. _move.b #ObjID_TurtloidRider,id(a1) ; load obj9B
  71363. move.b #2,mapping_frame(a1)
  71364. move.b #$18,subtype(a1) ; <== Obj9B_SubObjData
  71365. move.w a0,objoff_2C(a1)
  71366. move.w a1,objoff_2C(a0)
  71367. move.w x_pos(a0),x_pos(a1)
  71368. addq.w #4,x_pos(a1)
  71369. move.w y_pos(a0),y_pos(a1)
  71370. subi.w #$18,y_pos(a1)
  71371.  
  71372. return_37A80:
  71373. rts
  71374. ; ===========================================================================
  71375. ; ----------------------------------------------------------------------------
  71376. ; Object 9C - Balkiry's jet from Sky Chase Zone
  71377. ; ----------------------------------------------------------------------------
  71378. ; Sprite_37A82:
  71379. Obj9C:
  71380. moveq #0,d0
  71381. move.b routine(a0),d0
  71382. move.w Obj9C_Index(pc,d0.w),d1
  71383. jmp Obj9C_Index(pc,d1.w)
  71384. ; ===========================================================================
  71385. ; off_37A90:
  71386. Obj9C_Index: offsetTable
  71387. offsetTableEntry.w Obj9C_Init
  71388. offsetTableEntry.w Obj9C_Main
  71389. ; ===========================================================================
  71390. ; BranchTo2_LoadSubObject
  71391. Obj9C_Init:
  71392. bra.w LoadSubObject
  71393. ; ===========================================================================
  71394. ; loc_37A98:
  71395. Obj9C_Main:
  71396. movea.w objoff_2C(a0),a1 ; a1=object
  71397. move.b objoff_32(a0),d0
  71398. cmp.b (a1),d0
  71399. bne.w JmpTo65_DeleteObject
  71400. move.l x_pos(a1),x_pos(a0)
  71401. move.l y_pos(a1),y_pos(a0)
  71402. movea.l objoff_2E(a0),a1
  71403. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  71404. bra.w Obj_DeleteBehindScreen
  71405. ; ===========================================================================
  71406.  
  71407. loc_37ABE:
  71408. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  71409. bne.s + ; rts
  71410. _move.b #ObjID_BalkiryJet,id(a1) ; load obj9C
  71411. move.b #6,mapping_frame(a1)
  71412. move.b #$1A,subtype(a1) ; <== Obj9C_SubObjData
  71413. move.w a0,objoff_2C(a1)
  71414. move.w x_pos(a0),x_pos(a1)
  71415. move.w y_pos(a0),y_pos(a1)
  71416. move.l objoff_2E(a0),objoff_2E(a1)
  71417. move.b (a0),objoff_32(a1)
  71418. +
  71419. rts
  71420.  
  71421. ; ===========================================================================
  71422. ; this code is for Obj9A
  71423.  
  71424. loc_37AF2:
  71425. jsrto (SingleObjLoad).l, JmpTo19_SingleObjLoad
  71426. bne.s + ; rts
  71427. _move.b #ObjID_Projectile,id(a1) ; load obj98
  71428. move.b #6,mapping_frame(a1)
  71429. move.b #$1C,subtype(a1) ; <== Obj9A_SubObjData2
  71430. move.w x_pos(a0),x_pos(a1)
  71431. subi.w #$14,x_pos(a1)
  71432. move.w y_pos(a0),y_pos(a1)
  71433. addi.w #$A,y_pos(a1)
  71434. move.w #-$100,x_vel(a1)
  71435. lea_ Obj98_TurtloidShotMove,a2
  71436. move.l a2,objoff_2A(a1)
  71437. +
  71438. rts
  71439. ; ===========================================================================
  71440. ; off_37B32:
  71441. Obj9A_SubObjData:
  71442. subObjData Obj9A_Obj98_MapUnc_37B62,make_art_tile(ArtTile_ArtNem_Turtloid,0,0),4,5,$18,0
  71443. ; off_37B3C:
  71444. Obj9B_SubObjData:
  71445. subObjData Obj9A_Obj98_MapUnc_37B62,make_art_tile(ArtTile_ArtNem_Turtloid,0,0),4,4,$C,$1A
  71446. ; off_37B46:
  71447. Obj9C_SubObjData:
  71448. subObjData Obj9A_Obj98_MapUnc_37B62,make_art_tile(ArtTile_ArtNem_Turtloid,0,0),4,5,8,0
  71449.  
  71450. ; animation script
  71451. ; off_37B50: TurtloidShotAniData:
  71452. Ani_TurtloidShot: offsetTable
  71453. offsetTableEntry.w +
  71454. + dc.b 1, 4, 5,$FF
  71455. even
  71456.  
  71457. ; animation script
  71458. ; off_37B56:
  71459. Ani_obj9A: offsetTable
  71460. offsetTableEntry.w +
  71461. + dc.b 1, 6, 7,$FF
  71462. even
  71463.  
  71464. ; animation script
  71465. ; off_37B5C:
  71466. Ani_obj9C: offsetTable
  71467. offsetTableEntry.w +
  71468. + dc.b 1, 8, 9,$FF
  71469. even
  71470. ; ----------------------------------------------------------------------------
  71471. ; sprite mappings
  71472. ; ----------------------------------------------------------------------------
  71473. Obj9A_Obj98_MapUnc_37B62: BINCLUDE "mappings/sprite/obj9C.bin"
  71474.  
  71475.  
  71476.  
  71477.  
  71478. ; ===========================================================================
  71479. ; ----------------------------------------------------------------------------
  71480. ; Object 9D - Coconuts (monkey badnik) from EHZ
  71481. ; ----------------------------------------------------------------------------
  71482. ; OST Variables:
  71483. Obj9D_timer = objoff_2A ; byte
  71484. Obj9D_climb_table_index = objoff_2C ; word
  71485. Obj9D_attack_timer = objoff_2E ; byte ; time player needs to spend close to object before it attacks
  71486. ; Sprite_37BFA:
  71487. Obj9D:
  71488. moveq #0,d0
  71489. move.b routine(a0),d0
  71490. move.w Obj9D_Index(pc,d0.w),d1
  71491. jmp Obj9D_Index(pc,d1.w)
  71492. ; ===========================================================================
  71493. ; off_37C08:
  71494. Obj9D_Index: offsetTable
  71495. offsetTableEntry.w Obj9D_Init ; 0
  71496. offsetTableEntry.w Obj9D_Idle ; 2
  71497. offsetTableEntry.w Obj9D_Climbing ; 4
  71498. offsetTableEntry.w Obj9D_Throwing ; 6
  71499. ; ===========================================================================
  71500. ; loc_37C10:
  71501. Obj9D_Init:
  71502. bsr.w LoadSubObject
  71503. move.b #$10,Obj9D_timer(a0)
  71504. rts
  71505. ; ===========================================================================
  71506. ; loc_37C1C: Obj9D_Main:
  71507. Obj9D_Idle:
  71508. bsr.w Obj_GetOrientationToPlayer
  71509. bclr #0,render_flags(a0) ; face right
  71510. bclr #0,status(a0)
  71511. tst.w d0 ; is player to object's left?
  71512. beq.s + ; if not, branch
  71513. bset #0,render_flags(a0) ; face left
  71514. bset #0,status(a0)
  71515. +
  71516. addi.w #$60,d2
  71517. cmpi.w #$C0,d2
  71518. bcc.s + ; branch, if distance to player is greater than 60 in either direction
  71519. tst.b Obj9D_attack_timer(a0) ; wait for a bit before attacking
  71520. beq.s Obj9D_StartThrowing ; branch, when done waiting
  71521. subq.b #1,Obj9D_attack_timer(a0)
  71522. +
  71523. subq.b #1,Obj9D_timer(a0) ; wait for a bit...
  71524. bmi.s Obj9D_StartClimbing ; branch, when done waiting
  71525. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71526. ; ---------------------------------------------------------------------------
  71527.  
  71528. Obj9D_StartClimbing:
  71529. addq.b #2,routine(a0) ; => Obj9D_Climbing
  71530. bsr.w Obj9D_SetClimbingDirection
  71531. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71532. ; ---------------------------------------------------------------------------
  71533. ; loc_37C66:
  71534. Obj9D_StartThrowing:
  71535. move.b #6,routine(a0) ; => Obj9D_Throwing
  71536. move.b #1,mapping_frame(a0) ; display first throwing frame
  71537. move.b #8,Obj9D_timer(a0) ; set time to display frame
  71538. move.b #$20,Obj9D_attack_timer(a0) ; reset timer
  71539. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71540. ; ---------------------------------------------------------------------------
  71541. ; loc_37C82:
  71542. Obj9D_SetClimbingDirection:
  71543. move.w Obj9D_climb_table_index(a0),d0
  71544. cmpi.w #$C,d0
  71545. blo.s + ; branch, if index is less than $C
  71546. moveq #0,d0 ; otherwise, reset to 0
  71547. +
  71548. lea Obj9D_ClimbData(pc,d0.w),a1
  71549. addq.w #2,d0
  71550. move.w d0,Obj9D_climb_table_index(a0)
  71551. move.b (a1)+,y_vel(a0) ; climbing speed
  71552. move.b (a1)+,Obj9D_timer(a0) ; time to spend moving at this speed
  71553. rts
  71554. ; ===========================================================================
  71555. ; byte_37CA2:
  71556. Obj9D_ClimbData:
  71557. dc.b -1,$20
  71558. dc.b 1,$18 ; 2
  71559. dc.b -1,$10 ; 4
  71560. dc.b 1,$28 ; 6
  71561. dc.b -1,$20 ; 8
  71562. dc.b 1,$10 ; 10
  71563. ; ===========================================================================
  71564. ; loc_37CAE: Obj09_Climbing:
  71565. Obj9D_Climbing:
  71566. subq.b #1,Obj9D_timer(a0)
  71567. beq.s Obj9D_StopClimbing ; branch, if done moving
  71568. jsrto (ObjectMove).l, JmpTo26_ObjectMove ; else, keep moving
  71569. lea (Ani_obj09).l,a1
  71570. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  71571. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71572. ; ===========================================================================
  71573. ; loc_37CC6:
  71574. Obj9D_StopClimbing:
  71575. subq.b #2,routine(a0) ; => Obj9D_Idle
  71576. move.b #$10,Obj9D_timer(a0) ; time to remain idle
  71577. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71578. ; ===========================================================================
  71579. ; loc_37CD4: Obj09_Throwing:
  71580. Obj9D_Throwing:
  71581. moveq #0,d0
  71582. move.b routine_secondary(a0),d0
  71583. move.w Obj9D_ThrowingStates(pc,d0.w),d1
  71584. jsr Obj9D_ThrowingStates(pc,d1.w)
  71585. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71586. ; ===========================================================================
  71587. ; off_37CE6:
  71588. Obj9D_ThrowingStates: offsetTable
  71589. offsetTableEntry.w Obj9D_ThrowingHandRaised ; 0
  71590. offsetTableEntry.w Obj9D_ThrowingHandLowered ; 2
  71591. ; ===========================================================================
  71592. ; loc_37CEA:
  71593. Obj9D_ThrowingHandRaised:
  71594. subq.b #1,Obj9D_timer(a0) ; wait for a bit...
  71595. bmi.s +
  71596. rts
  71597. ; ---------------------------------------------------------------------------
  71598. + addq.b #2,routine_secondary(a0) ; => Obj9D_ThrowingHandLowered
  71599. move.b #8,Obj9D_timer(a0)
  71600. move.b #2,mapping_frame(a0) ; display second throwing frame
  71601. bra.w Obj9D_CreateCoconut
  71602. ; ===========================================================================
  71603. ; loc_37D06:
  71604. Obj9D_ThrowingHandLowered:
  71605. subq.b #1,Obj9D_timer(a0) ; wait for a bit...
  71606. bmi.s +
  71607. rts
  71608. ; ---------------------------------------------------------------------------
  71609. + clr.b routine_secondary(a0) ; reset routine counter for next time
  71610. move.b #4,routine(a0) ; => Obj9D_Climbing
  71611. move.b #8,Obj9D_timer(a0) ; this gets overwrittten by the next subroutine...
  71612. bra.w Obj9D_SetClimbingDirection
  71613. ; ===========================================================================
  71614. ; loc_37D22:
  71615. Obj9D_CreateCoconut:
  71616. jsrto (SingleObjLoad).l, JmpTo19_SingleObjLoad
  71617. bne.s return_37D74 ; branch, if no free slots
  71618. _move.b #ObjID_Projectile,id(a1) ; load obj98
  71619. move.b #3,mapping_frame(a1)
  71620. move.b #$20,subtype(a1) ; <== Obj9D_SubObjData2
  71621. move.w x_pos(a0),x_pos(a1) ; align with parent object
  71622. move.w y_pos(a0),y_pos(a1)
  71623. addi.w #-$D,y_pos(a1) ; offset slightly upward
  71624. moveq #0,d0 ; use rightfacing data
  71625. btst #0,render_flags(a0) ; is object facing left?
  71626. bne.s + ; if yes, branch
  71627. moveq #4,d0 ; use leftfacing data
  71628. +
  71629. lea Obj9D_ThrowData(pc,d0.w),a2
  71630. move.w (a2)+,d0
  71631. add.w d0,x_pos(a1) ; offset slightly left or right depending on object's direction
  71632. move.w (a2)+,x_vel(a1) ; set projectile speed
  71633. move.w #-$100,y_vel(a1)
  71634. lea_ Obj98_CoconutFall,a2 ; set the routine used to move the projectile
  71635. move.l a2,objoff_2A(a1)
  71636.  
  71637. return_37D74:
  71638. rts
  71639. ; ===========================================================================
  71640. ; word_37D76:
  71641. Obj9D_ThrowData:
  71642. dc.w -$B, $100 ; 0
  71643. dc.w $B, -$100 ; 4
  71644. ; off_37D7E:
  71645. Obj9D_SubObjData:
  71646. subObjData Obj9D_Obj98_MapUnc_37D96,make_art_tile(ArtTile_ArtNem_Coconuts,0,0),4,5,$C,9
  71647.  
  71648. ; animation script
  71649. ; off_37D88:
  71650. Ani_obj09: offsetTable
  71651. offsetTableEntry.w byte_37D8C ; 0
  71652. offsetTableEntry.w byte_37D90 ; 1
  71653. byte_37D8C: dc.b 5, 0, 1,$FF
  71654. byte_37D90: dc.b 9, 1, 2, 1,$FF
  71655. even
  71656. ; ------------------------------------------------------------------------
  71657. ; sprite mappings
  71658. ; ------------------------------------------------------------------------
  71659. Obj9D_Obj98_MapUnc_37D96: BINCLUDE "mappings/sprite/obj9D.bin"
  71660.  
  71661.  
  71662.  
  71663.  
  71664. ; ===========================================================================
  71665. ; ----------------------------------------------------------------------------
  71666. ; Object 9E - Crawlton (snake badnik) from MCZ
  71667. ; ----------------------------------------------------------------------------
  71668. ; Sprite_37E16:
  71669. Obj9E:
  71670. moveq #0,d0
  71671. move.b objoff_3B(a0),d0
  71672. move.w Obj9E_Index(pc,d0.w),d1
  71673. jmp Obj9E_Index(pc,d1.w)
  71674. ; ===========================================================================
  71675. ; off_37E24:
  71676. Obj9E_Index: offsetTable
  71677. offsetTableEntry.w Obj9E_Init ; 0
  71678. offsetTableEntry.w loc_37E42 ; 2
  71679. offsetTableEntry.w loc_37E98 ; 4
  71680. offsetTableEntry.w loc_37EB6 ; 6
  71681. offsetTableEntry.w loc_37ED4 ; 8
  71682. offsetTableEntry.w loc_37EFC ; $A
  71683. ; ===========================================================================
  71684. ; loc_37E30:
  71685. Obj9E_Init:
  71686. bsr.w LoadSubObject
  71687. move.b #$80,y_radius(a0)
  71688. addq.b #2,objoff_3B(a0)
  71689. bra.w loc_37F74
  71690. ; ===========================================================================
  71691.  
  71692. loc_37E42:
  71693. bsr.w Obj_GetOrientationToPlayer
  71694. move.w d2,d4
  71695. move.w d3,d5
  71696. addi.w #$80,d2
  71697. cmpi.w #$100,d2
  71698. bhs.s +
  71699. addi.w #$80,d3
  71700. cmpi.w #$100,d3
  71701. blo.s loc_37E62
  71702. +
  71703. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71704. ; ===========================================================================
  71705.  
  71706. loc_37E62:
  71707. addq.b #2,objoff_3B(a0)
  71708. move.b #$10,objoff_3A(a0)
  71709. bclr #0,render_flags(a0)
  71710. tst.w d0
  71711. beq.s +
  71712. bset #0,render_flags(a0)
  71713. +
  71714. neg.w d4
  71715. lsl.w #3,d4
  71716. andi.w #$FF00,d4
  71717. move.w d4,x_vel(a0)
  71718. neg.w d5
  71719. lsl.w #3,d5
  71720. andi.w #$FF00,d5
  71721. move.w d5,y_vel(a0)
  71722. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71723. ; ===========================================================================
  71724.  
  71725. loc_37E98:
  71726. subq.b #1,objoff_3A(a0)
  71727. bmi.s +
  71728. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71729. ; ---------------------------------------------------------------------------
  71730. +
  71731. addq.b #2,objoff_3B(a0)
  71732. move.b #8,objoff_39(a0)
  71733. move.b #$1C,objoff_3A(a0)
  71734. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71735. ; ===========================================================================
  71736.  
  71737. loc_37EB6:
  71738. subq.b #1,objoff_3A(a0)
  71739. beq.s +
  71740. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71741. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71742. ; ---------------------------------------------------------------------------
  71743. +
  71744. move.b objoff_39(a0),objoff_3B(a0)
  71745. move.b #$20,objoff_3A(a0)
  71746. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71747. ; ===========================================================================
  71748.  
  71749. loc_37ED4:
  71750. subq.b #1,objoff_3A(a0)
  71751. beq.s +
  71752. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71753. ; ---------------------------------------------------------------------------
  71754. +
  71755. move.b #6,objoff_3B(a0)
  71756. move.b #2,objoff_39(a0)
  71757. move.b #$1C,objoff_3A(a0)
  71758. neg.w x_vel(a0)
  71759. neg.w y_vel(a0)
  71760. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71761. ; ===========================================================================
  71762.  
  71763. loc_37EFC:
  71764. movea.w parent(a0),a1 ; a1=object
  71765. cmpi.b #ObjID_Crawlton,id(a1)
  71766. bne.w JmpTo65_DeleteObject
  71767. bclr #0,render_flags(a0)
  71768. btst #0,render_flags(a1)
  71769. beq.s +
  71770. bset #0,render_flags(a0)
  71771. +
  71772. move.b #$80,objoff_14(a0)
  71773. move.w x_pos(a1),x_pos(a0)
  71774. move.w y_pos(a1),y_pos(a0)
  71775. cmpi.b #6,objoff_3B(a1)
  71776. bne.s loc_37F6C
  71777. move.w x_vel(a1),d2
  71778. asr.w #8,d2
  71779. move.w y_vel(a1),d3
  71780. asr.w #8,d3
  71781. lea sub2_x_pos(a0),a2
  71782. move.b objoff_3A(a1),d0
  71783. moveq #$18,d1
  71784.  
  71785. moveq #6,d6
  71786. - move.w (a2),d4 ; sub?_x_pos
  71787. move.w 2(a2),d5 ; sub?_y_pos
  71788. cmp.b d1,d0
  71789. bhs.s +
  71790. add.w d2,d4
  71791. add.w d3,d5
  71792. +
  71793. move.w d4,(a2)+ ; sub?_x_pos
  71794. move.w d5,(a2)+ ; sub?_y_pos
  71795. subi_.b #4,d1
  71796. bcs.s loc_37F6C
  71797. addq.w #next_subspr-4,a2
  71798. dbf d6,-
  71799.  
  71800. loc_37F6C:
  71801. move.w #$280,d0
  71802. jmpto (DisplaySprite3).l, JmpTo5_DisplaySprite3
  71803. ; ===========================================================================
  71804.  
  71805. loc_37F74:
  71806. jsrto (SingleObjLoad).l, JmpTo19_SingleObjLoad
  71807. bne.s + ; rts
  71808. _move.b #ObjID_Crawlton,id(a1) ; load obj9E
  71809. move.b render_flags(a0),render_flags(a1)
  71810. bset #6,render_flags(a1)
  71811. move.l mappings(a0),mappings(a1)
  71812. move.w art_tile(a0),art_tile(a1)
  71813. move.b #$A,objoff_3B(a1)
  71814. move.b #0,mainspr_mapframe(a1)
  71815. move.b #$80,mainspr_width(a1)
  71816. move.b #7,mainspr_childsprites(a1)
  71817. move.w a0,parent(a1)
  71818. move.w x_pos(a0),d2
  71819. move.w d2,x_pos(a1)
  71820. move.w y_pos(a0),d3
  71821. move.w d3,y_pos(a1)
  71822. move.b #$80,objoff_14(a1)
  71823. bset #4,render_flags(a1)
  71824. lea sub2_x_pos(a1),a2
  71825.  
  71826. moveq #6,d6
  71827. - move.w d2,(a2)+ ; sub?_x_pos
  71828. move.w d3,(a2)+ ; sub?_y_pos
  71829. move.w #2,(a2)+ ; sub?_mapframe
  71830. addi.w #$10,d1
  71831. dbf d6,-
  71832. +
  71833. rts
  71834. ; ===========================================================================
  71835. ; off_37FE8:
  71836. Obj9E_SubObjData:
  71837. subObjData Obj9E_MapUnc_37FF2,make_art_tile(ArtTile_ArtNem_Crawlton,1,0),4,4,$80,$B
  71838. ; -------------------------------------------------------------------------------
  71839. ; sprite mappings
  71840. ; -------------------------------------------------------------------------------
  71841. Obj9E_MapUnc_37FF2: BINCLUDE "mappings/sprite/obj9E.bin"
  71842.  
  71843.  
  71844.  
  71845.  
  71846. ; ===========================================================================
  71847. ; ----------------------------------------------------------------------------
  71848. ; Object 9F - Shellcraker (crab badnik) from MTZ
  71849. ; ----------------------------------------------------------------------------
  71850. ; Sprite_3800C:
  71851. Obj9F:
  71852. moveq #0,d0
  71853. move.b routine(a0),d0
  71854. move.w Obj9F_Index(pc,d0.w),d1
  71855. jmp Obj9F_Index(pc,d1.w)
  71856. ; ===========================================================================
  71857. ; off_3801A:
  71858. Obj9F_Index: offsetTable
  71859. offsetTableEntry.w Obj9F_Init ; 0
  71860. offsetTableEntry.w loc_3804E ; 2
  71861. offsetTableEntry.w loc_380C4 ; 4
  71862. offsetTableEntry.w loc_380FC ; 6
  71863. ; ===========================================================================
  71864. ; loc_38022:
  71865. Obj9F_Init:
  71866. bsr.w LoadSubObject
  71867. btst #0,render_flags(a0)
  71868. beq.s +
  71869. bset #0,status(a0)
  71870. +
  71871. move.w #-$40,x_vel(a0)
  71872. move.b #$C,y_radius(a0)
  71873. move.b #$18,x_radius(a0)
  71874. move.w #$140,objoff_2A(a0)
  71875. rts
  71876. ; ===========================================================================
  71877.  
  71878. loc_3804E:
  71879. bsr.w Obj_GetOrientationToPlayer
  71880. tst.w d0
  71881. beq.s loc_3805E
  71882. btst #0,render_flags(a0)
  71883. beq.s loc_38068
  71884.  
  71885. loc_3805E:
  71886. addi.w #$60,d2
  71887. cmpi.w #$C0,d2
  71888. blo.s loc_380AE
  71889.  
  71890. loc_38068:
  71891. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  71892. jsr (ObjCheckFloorDist).l
  71893. cmpi.w #-8,d1
  71894. blt.s loc_38096
  71895. cmpi.w #$C,d1
  71896. bge.s loc_38096
  71897. add.w d1,y_pos(a0)
  71898. subq.w #1,objoff_2A(a0)
  71899. bmi.s loc_3809A
  71900. lea (Ani_obj9F).l,a1
  71901. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  71902. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71903. ; ===========================================================================
  71904.  
  71905. loc_38096:
  71906. neg.w x_vel(a0)
  71907.  
  71908. loc_3809A:
  71909. addq.b #2,routine(a0)
  71910. move.b #0,mapping_frame(a0)
  71911. move.w #$3B,objoff_2A(a0)
  71912. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71913. ; ===========================================================================
  71914.  
  71915. loc_380AE:
  71916. move.b #6,routine(a0)
  71917. move.b #0,mapping_frame(a0)
  71918. move.w #8,objoff_2A(a0)
  71919. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71920. ; ===========================================================================
  71921.  
  71922. loc_380C4:
  71923. tst.b render_flags(a0)
  71924. bpl.s loc_380E4
  71925. bsr.w Obj_GetOrientationToPlayer
  71926. tst.w d0
  71927. beq.s loc_380DA
  71928. btst #0,render_flags(a0)
  71929. beq.s loc_380E4
  71930.  
  71931. loc_380DA:
  71932. addi.w #$60,d2
  71933. cmpi.w #$C0,d2
  71934. blo.s loc_380AE
  71935.  
  71936. loc_380E4:
  71937. subq.w #1,objoff_2A(a0)
  71938. bmi.s loc_380EE
  71939. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71940. ; ===========================================================================
  71941.  
  71942. loc_380EE:
  71943. subq.b #2,routine(a0)
  71944. move.w #$140,objoff_2A(a0)
  71945. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71946. ; ===========================================================================
  71947.  
  71948. loc_380FC:
  71949. moveq #0,d0
  71950. move.b routine_secondary(a0),d0
  71951. move.w off_3810E(pc,d0.w),d1
  71952. jsr off_3810E(pc,d1.w)
  71953. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  71954. ; ===========================================================================
  71955. off_3810E: offsetTable
  71956. offsetTableEntry.w loc_38114 ; 0
  71957. offsetTableEntry.w loc_3812A ; 2
  71958. offsetTableEntry.w loc_3813E ; 4
  71959. ; ===========================================================================
  71960.  
  71961. loc_38114:
  71962. subq.w #1,objoff_2A(a0)
  71963. bmi.s loc_3811C
  71964. rts
  71965. ; ===========================================================================
  71966.  
  71967. loc_3811C:
  71968. addq.b #2,routine_secondary(a0)
  71969. move.b #3,mapping_frame(a0)
  71970. bra.w loc_38292
  71971. ; ===========================================================================
  71972.  
  71973. loc_3812A:
  71974. tst.b objoff_2C(a0)
  71975. bne.s loc_38132
  71976. rts
  71977. ; ===========================================================================
  71978.  
  71979. loc_38132:
  71980. addq.b #2,routine_secondary(a0)
  71981. move.w #$20,objoff_2A(a0)
  71982. rts
  71983. ; ===========================================================================
  71984.  
  71985. loc_3813E:
  71986. subq.w #1,objoff_2A(a0)
  71987. bmi.s loc_38146
  71988. rts
  71989. ; ===========================================================================
  71990.  
  71991. loc_38146:
  71992. clr.b routine_secondary(a0)
  71993. clr.b objoff_2C(a0)
  71994. move.b #2,routine(a0)
  71995. move.w #$140,objoff_2A(a0)
  71996. rts
  71997. ; ===========================================================================
  71998. ; ----------------------------------------------------------------------------
  71999. ; Object A0 - Shellcracker's claw from MTZ
  72000. ; ----------------------------------------------------------------------------
  72001. ; Sprite_3815C:
  72002. ObjA0:
  72003. moveq #0,d0
  72004. move.b routine(a0),d0
  72005. move.w ObjA0_Index(pc,d0.w),d1
  72006. jmp ObjA0_Index(pc,d1.w)
  72007. ; ===========================================================================
  72008. ; off_3816A:
  72009. ObjA0_Index: offsetTable
  72010. offsetTableEntry.w ObjA0_Init ; 0
  72011. offsetTableEntry.w loc_381AC ; 2
  72012. offsetTableEntry.w loc_38280 ; 4
  72013. ; ===========================================================================
  72014. ; loc_38170:
  72015. ObjA0_Init:
  72016. bsr.w LoadSubObject
  72017. movea.w objoff_2C(a0),a1 ; a1=object
  72018. move.b render_flags(a1),d0
  72019. andi.b #1,d0
  72020. or.b d0,render_flags(a0)
  72021. move.w objoff_2E(a0),d0
  72022. beq.s loc_38198
  72023. move.b #4,mapping_frame(a0)
  72024. addq.w #6,x_pos(a0)
  72025. addq.w #6,y_pos(a0)
  72026.  
  72027. loc_38198:
  72028. lsr.w #1,d0
  72029. move.b byte_381A4(pc,d0.w),objoff_2A(a0)
  72030. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72031. ; ===========================================================================
  72032. byte_381A4:
  72033. dc.b 0 ; 0
  72034. dc.b 3 ; 1
  72035. dc.b 5 ; 2
  72036. dc.b 7 ; 3
  72037. dc.b 9 ; 4
  72038. dc.b $B ; 5
  72039. dc.b $D ; 6
  72040. dc.b $F ; 7
  72041. ; ===========================================================================
  72042.  
  72043. loc_381AC:
  72044. movea.w objoff_2C(a0),a1 ; a1=object
  72045. cmpi.b #ObjID_Shellcracker,id(a1)
  72046. bne.s loc_381D0
  72047. moveq #0,d0
  72048. move.b routine_secondary(a0),d0
  72049. move.w off_381C8(pc,d0.w),d1
  72050. jsr off_381C8(pc,d1.w)
  72051. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72052. ; ===========================================================================
  72053. off_381C8: offsetTable
  72054. offsetTableEntry.w loc_381E0 ; 0
  72055. offsetTableEntry.w loc_3822A ; 2
  72056. offsetTableEntry.w loc_38244 ; 4
  72057. offsetTableEntry.w loc_38258 ; 6
  72058. ; ===========================================================================
  72059.  
  72060. loc_381D0:
  72061. move.b #4,routine(a0)
  72062. move.w #$40,objoff_2A(a0)
  72063. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72064. ; ===========================================================================
  72065.  
  72066. loc_381E0:
  72067. subq.b #1,objoff_2A(a0)
  72068. beq.s loc_381EA
  72069. bmi.s loc_381EA
  72070. rts
  72071. ; ===========================================================================
  72072.  
  72073. loc_381EA:
  72074. addq.b #2,routine_secondary(a0)
  72075. move.w objoff_2E(a0),d0
  72076. cmpi.w #$E,d0
  72077. bhs.s loc_3821A
  72078. move.w #-$400,d2
  72079. btst #0,render_flags(a0)
  72080. beq.s loc_38206
  72081. neg.w d2
  72082.  
  72083. loc_38206:
  72084. move.w d2,x_vel(a0)
  72085. lsr.w #1,d0
  72086. move.b byte_38222(pc,d0.w),d1
  72087. move.b d1,objoff_2A(a0)
  72088. move.b d1,objoff_2B(a0)
  72089. rts
  72090. ; ===========================================================================
  72091.  
  72092. loc_3821A:
  72093. move.w #$B,objoff_2A(a0)
  72094. rts
  72095. ; ===========================================================================
  72096. byte_38222:
  72097. dc.b $D ; 0
  72098. dc.b $C ; 1
  72099. dc.b $A ; 2
  72100. dc.b 8 ; 3
  72101. dc.b 6 ; 4
  72102. dc.b 4 ; 5
  72103. dc.b 2 ; 6
  72104. dc.b 0 ; 7
  72105. ; ===========================================================================
  72106.  
  72107. loc_3822A:
  72108. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  72109. subq.b #1,objoff_2A(a0)
  72110. beq.s loc_38238
  72111. bmi.s loc_38238
  72112. rts
  72113. ; ===========================================================================
  72114.  
  72115. loc_38238:
  72116. addq.b #2,routine_secondary(a0)
  72117. move.b #8,objoff_2A(a0)
  72118. rts
  72119. ; ===========================================================================
  72120.  
  72121. loc_38244:
  72122. subq.b #1,objoff_2A(a0)
  72123. beq.s loc_3824E
  72124. bmi.s loc_3824E
  72125. rts
  72126. ; ===========================================================================
  72127.  
  72128. loc_3824E:
  72129. addq.b #2,routine_secondary(a0)
  72130. neg.w x_vel(a0)
  72131. rts
  72132. ; ===========================================================================
  72133.  
  72134. loc_38258:
  72135. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  72136. subq.b #1,objoff_2B(a0)
  72137. beq.s loc_38266
  72138. bmi.s loc_38266
  72139. rts
  72140. ; ===========================================================================
  72141.  
  72142. loc_38266:
  72143. tst.w objoff_2E(a0)
  72144. bne.s loc_3827A
  72145. movea.w objoff_2C(a0),a1 ; a1=object
  72146. move.b #0,mapping_frame(a1)
  72147. st objoff_2C(a1)
  72148.  
  72149. loc_3827A:
  72150. addq.w #4,sp
  72151. bra.w JmpTo65_DeleteObject
  72152. ; ===========================================================================
  72153.  
  72154. loc_38280:
  72155. jsrto (ObjectMoveAndFall).l, JmpTo8_ObjectMoveAndFall
  72156. subi_.w #1,objoff_2A(a0)
  72157. bmi.w JmpTo65_DeleteObject
  72158. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72159. ; ===========================================================================
  72160.  
  72161. loc_38292:
  72162. moveq #0,d1
  72163. moveq #7,d6
  72164.  
  72165. loc_38296:
  72166. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  72167. bne.s return_382EE
  72168. _move.b #ObjID_ShellcrackerClaw,id(a1) ; load objA0
  72169. move.b #$26,subtype(a1) ; <== ObjA0_SubObjData
  72170. move.b #5,mapping_frame(a1)
  72171. move.b #4,priority(a1)
  72172. move.w a0,objoff_2C(a1)
  72173. move.w d1,objoff_2E(a1)
  72174. move.w x_pos(a0),x_pos(a1)
  72175. move.w #-$14,d2
  72176. btst #0,render_flags(a0)
  72177. beq.s loc_382D8
  72178. neg.w d2
  72179. tst.w d1
  72180. beq.s loc_382D8
  72181. subi.w #$C,d2
  72182.  
  72183. loc_382D8:
  72184. add.w d2,x_pos(a1)
  72185. move.w y_pos(a0),y_pos(a1)
  72186. subi_.w #8,y_pos(a1)
  72187. addq.w #2,d1
  72188. dbf d6,loc_38296
  72189.  
  72190. return_382EE:
  72191. rts
  72192. ; ===========================================================================
  72193. ; off_382F0:
  72194. Obj9F_SubObjData:
  72195. subObjData Obj9F_MapUnc_38314,make_art_tile(ArtTile_ArtNem_Crabmeat,0,0),4,5,$18,$A
  72196. ; off_382FA:
  72197. ObjA0_SubObjData:
  72198. subObjData Obj9F_MapUnc_38314,make_art_tile(ArtTile_ArtNem_Crabmeat,0,0),4,4,$C,$9A
  72199. ; animation script
  72200. ; off_38304:
  72201. Ani_obj9F: offsetTable
  72202. offsetTableEntry.w byte_38308 ; 0
  72203. offsetTableEntry.w byte_3830E ; 1
  72204. byte_38308: dc.b $E, 0, 1, 2,$FF, 0
  72205. byte_3830E: dc.b $E, 0, 2, 1,$FF
  72206. even
  72207. ; ----------------------------------------------------------------------------
  72208. ; sprite mappings
  72209. ; ----------------------------------------------------------------------------
  72210. Obj9F_MapUnc_38314: BINCLUDE "mappings/sprite/objA0.bin"
  72211. ; ===========================================================================
  72212. ; ----------------------------------------------------------------------------
  72213. ; Object A1 - Slicer (praying mantis dude) from MTZ
  72214. ; ----------------------------------------------------------------------------
  72215. ; Sprite_383B4:
  72216. ObjA1:
  72217. moveq #0,d0
  72218. move.b routine(a0),d0
  72219. move.w ObjA1_Index(pc,d0.w),d1
  72220. jmp ObjA1_Index(pc,d1.w)
  72221. ; ===========================================================================
  72222. ; off_383C2:
  72223. ObjA1_Index: offsetTable
  72224. offsetTableEntry.w ObjA1_Init ; 0
  72225. offsetTableEntry.w ObjA1_Main ; 2
  72226. offsetTableEntry.w loc_38466 ; 4
  72227. offsetTableEntry.w loc_38482 ; 6
  72228. offsetTableEntry.w BranchTo5_JmpTo39_MarkObjGone ; 8
  72229. ; ===========================================================================
  72230. ; loc_383CC:
  72231. ObjA1_Init:
  72232. bsr.w LoadSubObject
  72233. move.w #-$40,d0
  72234. btst #0,render_flags(a0)
  72235. beq.s loc_383DE
  72236. neg.w d0
  72237.  
  72238. loc_383DE:
  72239. move.w d0,x_vel(a0)
  72240. move.b #$10,y_radius(a0)
  72241. move.b #$10,x_radius(a0)
  72242. rts
  72243. ; ===========================================================================
  72244.  
  72245. ObjA1_Main:
  72246. tst.b render_flags(a0)
  72247. bpl.s loc_3841C
  72248. bsr.w Obj_GetOrientationToPlayer
  72249. btst #0,render_flags(a0)
  72250. beq.s loc_38404
  72251. subq.w #2,d0
  72252.  
  72253. loc_38404:
  72254. tst.w d0
  72255. bne.s loc_3841C
  72256. addi.w #$80,d2
  72257. cmpi.w #$100,d2
  72258. bhs.s loc_3841C
  72259. addi.w #$40,d3
  72260. cmpi.w #$80,d3
  72261. blo.s loc_38452
  72262.  
  72263. loc_3841C:
  72264. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  72265. jsr (ObjCheckFloorDist).l
  72266. cmpi.w #-8,d1
  72267. blt.s loc_38444
  72268. cmpi.w #$C,d1
  72269. bge.s loc_38444
  72270. add.w d1,y_pos(a0)
  72271. lea (Ani_objA1).l,a1
  72272. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72273. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72274. ; ===========================================================================
  72275.  
  72276. loc_38444:
  72277. addq.b #2,routine(a0)
  72278. move.b #$3B,objoff_2A(a0)
  72279. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72280. ; ===========================================================================
  72281.  
  72282. loc_38452:
  72283. addq.b #4,routine(a0)
  72284. move.b #3,mapping_frame(a0)
  72285. move.b #8,objoff_2A(a0)
  72286. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72287. ; ===========================================================================
  72288.  
  72289. loc_38466:
  72290. subq.b #1,objoff_2A(a0)
  72291. bmi.s loc_38470
  72292. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72293. ; ===========================================================================
  72294.  
  72295. loc_38470:
  72296. subq.b #2,routine(a0)
  72297. neg.w x_vel(a0)
  72298. bchg #0,status(a0)
  72299. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72300. ; ===========================================================================
  72301.  
  72302. loc_38482:
  72303. subq.b #1,objoff_2A(a0)
  72304. bmi.s loc_3848C
  72305. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72306. ; ===========================================================================
  72307.  
  72308. loc_3848C:
  72309. addq.b #2,routine(a0)
  72310. move.b #4,mapping_frame(a0)
  72311. bsr.w ObjA1_LoadPincers
  72312. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72313. ; ===========================================================================
  72314.  
  72315. BranchTo5_JmpTo39_MarkObjGone
  72316. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72317. ; ===========================================================================
  72318. ; ----------------------------------------------------------------------------
  72319. ; Object A2 - Slicer's pincers from MTZ
  72320. ; ----------------------------------------------------------------------------
  72321. ; Sprite_384A2:
  72322. ObjA2:
  72323. moveq #0,d0
  72324. move.b routine(a0),d0
  72325. move.w ObjA2_Index(pc,d0.w),d1
  72326. jmp ObjA2_Index(pc,d1.w)
  72327. ; ===========================================================================
  72328. ; off_384B0:
  72329. ObjA2_Index: offsetTable
  72330. offsetTableEntry.w ObjA2_Init ; 0
  72331. offsetTableEntry.w ObjA2_Main ; 2
  72332. offsetTableEntry.w ObjA2_Main2 ; 4
  72333. ; ===========================================================================
  72334. ; loc_384B6:
  72335. ObjA2_Init:
  72336. bsr.w LoadSubObject
  72337. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72338. ; ===========================================================================
  72339.  
  72340. ObjA2_Main:
  72341. tst.b render_flags(a0)
  72342. bpl.w JmpTo65_DeleteObject
  72343. subq.w #1,objoff_2A(a0)
  72344. bmi.s loc_3851A
  72345. movea.w objoff_2C(a0),a1 ; a1=object
  72346. cmpi.b #ObjID_Slicer,(a1)
  72347. bne.s loc_3851A
  72348. moveq #0,d0
  72349. move.b routine_secondary(a0),d0
  72350. move.w off_384F6(pc,d0.w),d1
  72351. jsr off_384F6(pc,d1.w)
  72352. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  72353. lea (Ani_objA2).l,a1
  72354. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72355. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72356. ; ===========================================================================
  72357. off_384F6: offsetTable
  72358. offsetTableEntry.w +
  72359. ; ===========================================================================
  72360. +
  72361. bsr.w Obj_GetOrientationToPlayer
  72362. move.w ObjA2_acceleration(pc,d0.w),d2
  72363. add.w d2,x_vel(a0)
  72364. move.w ObjA2_acceleration(pc,d1.w),d2
  72365. add.w d2,y_vel(a0)
  72366. move.w #$200,d0
  72367. move.w d0,d1
  72368. bra.w Obj_CapSpeed
  72369. ; ===========================================================================
  72370. ObjA2_acceleration: dc.w -$10, $10
  72371. ; ===========================================================================
  72372.  
  72373. loc_3851A:
  72374. addq.b #2,routine(a0)
  72375. move.w #$60,objoff_2A(a0)
  72376.  
  72377. ObjA2_Main2:
  72378. subq.w #1,objoff_2A(a0)
  72379. bmi.w JmpTo65_DeleteObject
  72380. jsrto (ObjectMoveAndFall).l, JmpTo8_ObjectMoveAndFall
  72381. lea (Ani_objA2).l,a1
  72382. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72383. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72384. ; ===========================================================================
  72385.  
  72386. ObjA1_LoadPincers:
  72387. lea objoff_3C(a0),a2 ; a2=object
  72388. moveq #0,d1
  72389. moveq #1,d6
  72390.  
  72391. loc_38546:
  72392. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  72393. bne.s return_385BA
  72394. _move.b #ObjID_SlicerPincers,id(a1) ; load objA2
  72395. move.b #$2A,subtype(a1) ; <== ObjA2_SubObjData
  72396. move.b render_flags(a0),render_flags(a1)
  72397. move.b #5,mapping_frame(a1)
  72398. move.b #4,priority(a1)
  72399. move.w #$78,objoff_2A(a1)
  72400. move.w a0,objoff_2C(a1)
  72401. move.w a1,(a2)+
  72402. move.w #-$200,d0
  72403. btst #0,render_flags(a1)
  72404. beq.s loc_3858A
  72405. neg.w d0
  72406. bset #0,status(a1)
  72407.  
  72408. loc_3858A:
  72409. move.w d0,x_vel(a1)
  72410. lea ObjA1_Pincer_Offsets(pc,d1.w),a3
  72411. move.b (a3)+,d0
  72412. ext.w d0
  72413. btst #0,render_flags(a1)
  72414. beq.s loc_385A0
  72415. neg.w d0
  72416.  
  72417. loc_385A0:
  72418. add.w x_pos(a0),d0
  72419. move.w d0,x_pos(a1)
  72420. move.b (a3)+,d0
  72421. ext.w d0
  72422. add.w y_pos(a0),d0
  72423. move.w d0,y_pos(a1)
  72424. addq.w #2,d1
  72425. dbf d6,loc_38546
  72426.  
  72427. return_385BA:
  72428. rts
  72429. ; ===========================================================================
  72430. ObjA1_Pincer_Offsets:
  72431. dc.b 6, 0 ; 0
  72432. dc.b -$10, 0 ; 3
  72433. ; off_385C0
  72434. ObjA1_SubObjData:
  72435. subObjData ObjA1_MapUnc_385E2,make_art_tile(ArtTile_ArtNem_MtzMantis,1,0),4,5,$10,6
  72436. ; off_385CA:
  72437. ObjA2_SubObjData:
  72438. subObjData ObjA1_MapUnc_385E2,make_art_tile(ArtTile_ArtNem_MtzMantis,1,0),4,4,$10,$9A
  72439. ; animation script
  72440. ; off_385D4:
  72441. Ani_objA1: offsetTable
  72442. offsetTableEntry.w + ; 0
  72443. + dc.b $13, 0, 2,$FF
  72444. even
  72445. ; animation script
  72446. ; off_385DA:
  72447. Ani_objA2: offsetTable
  72448. offsetTableEntry.w + ; 0
  72449. + dc.b 3, 5, 6, 7, 8,$FF
  72450. even
  72451. ; ----------------------------------------------------------------------------
  72452. ; sprite mappings
  72453. ; ----------------------------------------------------------------------------
  72454. ObjA1_MapUnc_385E2: BINCLUDE "mappings/sprite/objA2.bin"
  72455.  
  72456.  
  72457.  
  72458.  
  72459. ; ===========================================================================
  72460. ; ----------------------------------------------------------------------------
  72461. ; Object A3 - Flasher (firefly/glowbug badnik) from MCZ
  72462. ; ----------------------------------------------------------------------------
  72463. ; Sprite_3873E:
  72464. ObjA3:
  72465. moveq #0,d0
  72466. move.b routine(a0),d0
  72467. move.w ObjA3_Index(pc,d0.w),d1
  72468. jmp ObjA3_Index(pc,d1.w)
  72469. ; ===========================================================================
  72470. ; off_3874C:
  72471. ObjA3_Index: offsetTable
  72472. offsetTableEntry.w loc_3875A ; 0
  72473. offsetTableEntry.w loc_38766 ; 2
  72474. offsetTableEntry.w loc_38794 ; 4
  72475. offsetTableEntry.w loc_38832 ; 6
  72476. offsetTableEntry.w loc_3885C ; 8
  72477. offsetTableEntry.w loc_38880 ; $A
  72478. offsetTableEntry.w loc_3888E ; $C
  72479. ; ===========================================================================
  72480.  
  72481. loc_3875A:
  72482. bsr.w LoadSubObject
  72483. move.w #$40,objoff_2A(a0)
  72484. rts
  72485. ; ===========================================================================
  72486.  
  72487. loc_38766:
  72488. subq.w #1,objoff_2A(a0)
  72489. bmi.s loc_38770
  72490. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72491. ; ===========================================================================
  72492.  
  72493. loc_38770:
  72494. addq.b #2,routine(a0)
  72495. move.w #-$100,x_vel(a0)
  72496. move.w #$40,y_vel(a0)
  72497. move.w #2,objoff_2E(a0)
  72498. clr.w objoff_2A(a0)
  72499. move.w #$80,objoff_30(a0)
  72500. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72501. ; ===========================================================================
  72502.  
  72503. loc_38794:
  72504. subq.w #1,objoff_30(a0)
  72505. bmi.s loc_387FC
  72506. move.w objoff_2A(a0),d0
  72507. bmi.w JmpTo65_DeleteObject
  72508. bclr #0,render_flags(a0)
  72509. bclr #0,status(a0)
  72510. tst.w x_vel(a0)
  72511. bmi.s loc_387C0
  72512. bset #0,render_flags(a0)
  72513. bset #0,status(a0)
  72514.  
  72515. loc_387C0:
  72516. addq.w #1,d0
  72517. move.w d0,objoff_2A(a0)
  72518. move.w objoff_2C(a0),d1
  72519. move.w word_38810(pc,d1.w),d2
  72520. cmp.w d2,d0
  72521. blo.s loc_387EC
  72522. addq.w #2,d1
  72523. move.w d1,objoff_2C(a0)
  72524. lea byte_38820(pc,d1.w),a1
  72525. tst.b (a1)+
  72526. beq.s loc_387E4
  72527. neg.w objoff_2E(a0)
  72528.  
  72529. loc_387E4:
  72530. tst.b (a1)+
  72531. beq.s loc_387EC
  72532. neg.w y_vel(a0)
  72533.  
  72534. loc_387EC:
  72535. move.w objoff_2E(a0),d0
  72536. add.w d0,x_vel(a0)
  72537. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  72538. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72539. ; ===========================================================================
  72540.  
  72541. loc_387FC:
  72542. addq.b #2,routine(a0)
  72543. move.w #$80,objoff_30(a0)
  72544. ori.b #$80,collision_flags(a0)
  72545. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72546. ; ===========================================================================
  72547. word_38810:
  72548. dc.w $100
  72549. dc.w $1A0 ; 1
  72550. dc.w $208 ; 2
  72551. dc.w $285 ; 3
  72552. dc.w $300 ; 4
  72553. dc.w $340 ; 5
  72554. dc.w $390 ; 6
  72555. dc.w $440 ; 7
  72556. byte_38820:
  72557. dc.b $F0
  72558. dc.b 0 ; 1
  72559. dc.b 1 ; 2
  72560. dc.b 1 ; 3
  72561. dc.b 0 ; 4
  72562. dc.b 1 ; 5
  72563. dc.b 1 ; 6
  72564. dc.b 1 ; 7
  72565. dc.b 0 ; 8
  72566. dc.b 1 ; 9
  72567. dc.b 0 ; 10
  72568. dc.b 1 ; 11
  72569. dc.b 1 ; 12
  72570. dc.b 0 ; 13
  72571. dc.b 0 ; 14
  72572. dc.b 1 ; 15
  72573. dc.b 0 ; 16
  72574. dc.b 1 ; 17
  72575. ; ===========================================================================
  72576.  
  72577. loc_38832:
  72578. move.b routine(a0),d2
  72579. lea (Ani_objA3_a).l,a1
  72580. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72581. cmp.b routine(a0),d2
  72582. bne.s loc_3884A
  72583. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72584. ; ===========================================================================
  72585.  
  72586. loc_3884A:
  72587. clr.l mapping_frame(a0)
  72588. clr.w anim_frame_duration(a0)
  72589. move.b #3,mapping_frame(a0)
  72590. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72591. ; ===========================================================================
  72592.  
  72593. loc_3885C:
  72594. subq.w #1,objoff_30(a0)
  72595. bmi.s loc_38870
  72596. lea (Ani_objA3_b).l,a1
  72597. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72598. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72599. ; ===========================================================================
  72600.  
  72601. loc_38870:
  72602. addq.b #2,routine(a0)
  72603. clr.l mapping_frame(a0)
  72604. clr.w anim_frame_duration(a0)
  72605. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72606. ; ===========================================================================
  72607.  
  72608. loc_38880:
  72609. lea (Ani_objA3_c).l,a1
  72610. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72611. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72612. ; ===========================================================================
  72613.  
  72614. loc_3888E:
  72615. move.b #4,routine(a0)
  72616. move.w #$80,objoff_30(a0)
  72617. andi.b #$7F,collision_flags(a0)
  72618. clr.l mapping_frame(a0)
  72619. clr.w anim_frame_duration(a0)
  72620. jmpto (MarkObjGone_P1).l, JmpTo2_MarkObjGone_P1
  72621. ; ===========================================================================
  72622. ; off_388AC:
  72623. ObjA3_SubObjData:
  72624. subObjData ObjA3_MapUnc_388F0,make_art_tile(ArtTile_ArtNem_Flasher,0,1),4,4,$10,6
  72625.  
  72626. ; animation script
  72627. ; off_388B6:
  72628. Ani_objA3_a: offsetTable
  72629. offsetTableEntry.w + ; 0
  72630. + dc.b 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1
  72631. dc.b 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 3, 4, $FC
  72632. even
  72633. ; animation script
  72634. ; off_388DA:
  72635. Ani_objA3_b: offsetTable
  72636. offsetTableEntry.w + ; 0
  72637. + dc.b 0, 2, 0, 3, 0, 4, 0, 3, 0,$FF
  72638. even
  72639. ; animation script
  72640. ; off_388E6:
  72641. Ani_objA3_c: offsetTable
  72642. offsetTableEntry.w + ; 0
  72643. + dc.b 3, 4, 3, 2, 1, 0,$FC
  72644. even
  72645. ; -------------------------------------------------------------------------------
  72646. ; sprite mappings
  72647. ; -------------------------------------------------------------------------------
  72648. ObjA3_MapUnc_388F0: BINCLUDE "mappings/sprite/objA3.bin"
  72649.  
  72650.  
  72651.  
  72652.  
  72653. ; ===========================================================================
  72654. ; ----------------------------------------------------------------------------
  72655. ; Object A4 - Asteron (exploding starfish badnik) from MTZ
  72656. ; ----------------------------------------------------------------------------
  72657. ; Sprite_3899C:
  72658. ObjA4:
  72659. moveq #0,d0
  72660. move.b routine(a0),d0
  72661. move.w ObjA4_Index(pc,d0.w),d1
  72662. jmp ObjA4_Index(pc,d1.w)
  72663. ; ===========================================================================
  72664. ; off_389AA:
  72665. ObjA4_Index: offsetTable
  72666. offsetTableEntry.w ObjA4_Init ; 0
  72667. offsetTableEntry.w loc_389B6 ; 2
  72668. offsetTableEntry.w loc_389DA ; 4
  72669. offsetTableEntry.w loc_38A2C ; 6
  72670. ; ===========================================================================
  72671. ; BranchTo3_LoadSubObject
  72672. ObjA4_Init:
  72673. bra.w LoadSubObject
  72674. ; ===========================================================================
  72675.  
  72676. loc_389B6:
  72677. bsr.w Obj_GetOrientationToPlayer
  72678. addi.w #$60,d2
  72679. cmpi.w #$C0,d2
  72680. bhs.s BranchTo6_JmpTo39_MarkObjGone
  72681. addi.w #$40,d3
  72682. cmpi.w #$80,d3
  72683. blo.s loc_389D2
  72684.  
  72685. BranchTo6_JmpTo39_MarkObjGone
  72686. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72687. ; ===========================================================================
  72688.  
  72689. loc_389D2:
  72690. addq.b #2,routine(a0)
  72691. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72692. ; ===========================================================================
  72693.  
  72694. loc_389DA:
  72695. bsr.w Obj_GetOrientationToPlayer
  72696. abs.w d2
  72697. cmpi.w #$10,d2
  72698. blo.s loc_389FA
  72699. cmpi.w #$60,d2
  72700. bhs.s loc_389FA
  72701. move.w word_38A1A(pc,d0.w),x_vel(a0)
  72702. bsr.w loc_38A1E
  72703.  
  72704. loc_389FA:
  72705. abs.w d3
  72706. cmpi.w #$10,d3
  72707. blo.s BranchTo7_JmpTo39_MarkObjGone
  72708. cmpi.w #$60,d3
  72709. bhs.s BranchTo7_JmpTo39_MarkObjGone
  72710. move.w word_38A1A(pc,d1.w),y_vel(a0)
  72711. bsr.w loc_38A1E
  72712.  
  72713. BranchTo7_JmpTo39_MarkObjGone
  72714. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72715. ; ===========================================================================
  72716. word_38A1A:
  72717. dc.w -$40 ; 0
  72718. dc.w $40 ; 1
  72719. ; ===========================================================================
  72720.  
  72721. loc_38A1E:
  72722. move.b #6,routine(a0)
  72723. move.b #$40,objoff_2A(a0)
  72724. rts
  72725. ; ===========================================================================
  72726.  
  72727. loc_38A2C:
  72728. subq.b #1,objoff_2A(a0)
  72729. bmi.s loc_38A44
  72730. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  72731. lea (Ani_objA4).l,a1
  72732. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72733. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72734. ; ===========================================================================
  72735.  
  72736. loc_38A44:
  72737. _move.b #ObjID_Explosion,id(a0) ; load 0bj27
  72738. move.b #2,routine(a0)
  72739. bsr.w loc_38A58
  72740. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72741. ; ===========================================================================
  72742.  
  72743. loc_38A58:
  72744. move.b #$30,d2
  72745. moveq #4,d6
  72746. lea (word_38A68).l,a2
  72747. bra.w Obj_CreateProjectiles
  72748. ; ===========================================================================
  72749. word_38A68:
  72750. dc.w $F8
  72751. dc.w $FC
  72752. dc.w $200
  72753. dc.w $8FC
  72754. dc.w $3FF
  72755. dc.w $301
  72756. dc.w $808
  72757. dc.w $303
  72758. dc.w $401
  72759. dc.w $F808
  72760. dc.w $FD03
  72761. dc.w $400
  72762. dc.w $F8FC
  72763. dc.w $FDFF
  72764. dc.w $300
  72765. ; off_38A86:
  72766. ObjA4_SubObjData:
  72767. subObjData ObjA4_Obj98_MapUnc_38A96,make_art_tile(ArtTile_ArtNem_MtzSupernova,0,1),4,4,$10,$B
  72768. ; animation script
  72769. ; off_38A90:
  72770. Ani_objA4: offsetTable
  72771. offsetTableEntry.w + ; 0
  72772. + dc.b 1, 0, 1,$FF
  72773. even
  72774. ; ----------------------------------------------------------------------------
  72775. ; sprite mappings
  72776. ; ----------------------------------------------------------------------------
  72777. ObjA4_Obj98_MapUnc_38A96: BINCLUDE "mappings/sprite/objA4.bin"
  72778.  
  72779.  
  72780.  
  72781.  
  72782. ; ===========================================================================
  72783. ; ----------------------------------------------------------------------------
  72784. ; Object A5 - Spiny (crawling badnik) from CPZ
  72785. ; ----------------------------------------------------------------------------
  72786. ; Sprite_38AEA:
  72787. ObjA5:
  72788. moveq #0,d0
  72789. move.b routine(a0),d0
  72790. move.w ObjA5_Index(pc,d0.w),d1
  72791. jmp ObjA5_Index(pc,d1.w)
  72792. ; ===========================================================================
  72793. ; off_38AF8:
  72794. ObjA5_Index: offsetTable
  72795. offsetTableEntry.w ObjA5_Init ; 0
  72796. offsetTableEntry.w loc_38B10 ; 2
  72797. offsetTableEntry.w loc_38B62 ; 4
  72798. ; ===========================================================================
  72799. ; loc_38AFE:
  72800. ObjA5_Init:
  72801. bsr.w LoadSubObject
  72802. move.w #-$40,x_vel(a0)
  72803. move.w #$80,objoff_2A(a0)
  72804. rts
  72805. ; ===========================================================================
  72806.  
  72807. loc_38B10:
  72808. tst.b objoff_2B(a0)
  72809. beq.s loc_38B1E
  72810. subq.b #1,objoff_2B(a0)
  72811. bra.w loc_38B2C
  72812. ; ===========================================================================
  72813.  
  72814. loc_38B1E:
  72815. bsr.w Obj_GetOrientationToPlayer
  72816. addi.w #$60,d2
  72817. cmpi.w #$C0,d2
  72818. blo.s loc_38B4E
  72819.  
  72820. loc_38B2C:
  72821. subq.b #1,objoff_2A(a0)
  72822. bne.s loc_38B3C
  72823. move.w #$80,objoff_2A(a0)
  72824. neg.w x_vel(a0)
  72825.  
  72826. loc_38B3C:
  72827. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  72828. lea (Ani_objA5).l,a1
  72829. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72830. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72831. ; ===========================================================================
  72832.  
  72833. loc_38B4E:
  72834. addq.b #2,routine(a0)
  72835. move.b #$28,objoff_2B(a0)
  72836. move.b #2,mapping_frame(a0)
  72837. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72838. ; ===========================================================================
  72839.  
  72840. loc_38B62:
  72841. subq.b #1,objoff_2B(a0)
  72842. bmi.s loc_38B78
  72843. cmpi.b #$14,objoff_2B(a0)
  72844. bne.s +
  72845. bsr.w loc_38C22
  72846. +
  72847. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72848. ; ===========================================================================
  72849.  
  72850. loc_38B78:
  72851. subq.b #2,routine(a0)
  72852. move.b #$40,objoff_2B(a0)
  72853. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72854. ; ===========================================================================
  72855. ; ----------------------------------------------------------------------------
  72856. ; Object A6 - Spiny (on wall) from CPZ
  72857. ; ----------------------------------------------------------------------------
  72858. ; Sprite_38B86:
  72859. ObjA6:
  72860. moveq #0,d0
  72861. move.b routine(a0),d0
  72862. move.w ObjA6_Index(pc,d0.w),d1
  72863. jmp ObjA6_Index(pc,d1.w)
  72864. ; ===========================================================================
  72865. ; off_38B94:
  72866. ObjA6_Index: offsetTable
  72867. offsetTableEntry.w ObjA6_Init ; 0
  72868. offsetTableEntry.w loc_38BAC ; 2
  72869. offsetTableEntry.w loc_38BFE ; 4
  72870. ; ===========================================================================
  72871. ; loc_38B9A:
  72872. ObjA6_Init:
  72873. bsr.w LoadSubObject
  72874. move.w #-$40,y_vel(a0)
  72875. move.w #$80,objoff_2A(a0)
  72876. rts
  72877. ; ===========================================================================
  72878.  
  72879. loc_38BAC:
  72880. tst.b objoff_2B(a0)
  72881. beq.s loc_38BBA
  72882. subq.b #1,objoff_2B(a0)
  72883. bra.w loc_38BC8
  72884. ; ===========================================================================
  72885.  
  72886. loc_38BBA:
  72887. bsr.w Obj_GetOrientationToPlayer
  72888. addi.w #$60,d2
  72889. cmpi.w #$C0,d2
  72890. blo.s loc_38BEA
  72891.  
  72892. loc_38BC8:
  72893. subq.b #1,objoff_2A(a0)
  72894. bne.s +
  72895. move.w #$80,objoff_2A(a0)
  72896. neg.w y_vel(a0)
  72897. +
  72898. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  72899. lea (Ani_objA6).l,a1
  72900. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  72901. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72902. ; ===========================================================================
  72903.  
  72904. loc_38BEA:
  72905. addq.b #2,routine(a0)
  72906. move.b #$28,objoff_2B(a0)
  72907. move.b #5,mapping_frame(a0)
  72908. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72909. ; ===========================================================================
  72910.  
  72911. loc_38BFE:
  72912. subq.b #1,objoff_2B(a0)
  72913. bmi.s loc_38C14
  72914. cmpi.b #$14,objoff_2B(a0)
  72915. bne.s +
  72916. bsr.w loc_38C6E
  72917. +
  72918. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72919. ; ===========================================================================
  72920.  
  72921. loc_38C14:
  72922. subq.b #2,routine(a0)
  72923. move.b #$40,objoff_2B(a0)
  72924. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  72925. ; ===========================================================================
  72926.  
  72927. loc_38C22:
  72928. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  72929. bne.s ++ ; rts
  72930. _move.b #ObjID_Projectile,id(a1) ; load obj98
  72931. move.b #6,mapping_frame(a1)
  72932. move.b #$34,subtype(a1) ; <== ObjA6_SubObjData
  72933. move.w x_pos(a0),x_pos(a1)
  72934. move.w y_pos(a0),y_pos(a1)
  72935. move.w #-$300,y_vel(a1)
  72936. move.w #$100,d1
  72937. lea (MainCharacter).w,a2 ; a2=character
  72938. move.w x_pos(a0),d0
  72939. cmp.w x_pos(a2),d0
  72940. blo.s +
  72941. neg.w d1
  72942. +
  72943. move.w d1,x_vel(a1)
  72944. lea_ Obj98_SpinyShotFall,a2
  72945. move.l a2,objoff_2A(a1)
  72946. +
  72947. rts
  72948. ; ===========================================================================
  72949.  
  72950. loc_38C6E:
  72951. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  72952. bne.s ++ ; rts
  72953. _move.b #ObjID_Projectile,id(a1) ; load obj98
  72954. move.b #6,mapping_frame(a1)
  72955. move.b #$34,subtype(a1) ; <== ObjA6_SubObjData
  72956. move.w x_pos(a0),x_pos(a1)
  72957. move.w y_pos(a0),y_pos(a1)
  72958. move.w #$300,d1
  72959. btst #0,render_flags(a0)
  72960. beq.s +
  72961. neg.w d1
  72962. +
  72963. move.w d1,x_vel(a1)
  72964. lea_ Obj98_SpinyShotFall,a2
  72965. move.l a2,objoff_2A(a1)
  72966. +
  72967. rts
  72968. ; ===========================================================================
  72969. ; off_38CAE:
  72970. ObjA5_SubObjData:
  72971. subObjData ObjA5_ObjA6_Obj98_MapUnc_38CCA,make_art_tile(ArtTile_ArtNem_Spiny,1,0),4,4,8,$B
  72972. ; animation scripts
  72973. ; off_38CB8
  72974. Ani_objA5: offsetTable
  72975. offsetTableEntry.w + ; 0
  72976. + dc.b 9, 0, 1,$FF
  72977. even
  72978. ; off_38CBE
  72979. Ani_objA6: offsetTable
  72980. offsetTableEntry.w + ; 0
  72981. + dc.b 9, 3, 4,$FF
  72982. even
  72983. ; off_38CC4
  72984. Ani_SpinyShot: offsetTable
  72985. offsetTableEntry.w + ; 0
  72986. + dc.b 3, 6, 7,$FF
  72987. even
  72988. ; ------------------------------------------------------------------------------
  72989. ; sprite mappings
  72990. ; ------------------------------------------------------------------------------
  72991. ObjA5_ObjA6_Obj98_MapUnc_38CCA: BINCLUDE "mappings/sprite/objA6.bin"
  72992. ; ===========================================================================
  72993. ; ----------------------------------------------------------------------------
  72994. ; Object A7 - Grabber (spider badnik) from CPZ
  72995. ; ----------------------------------------------------------------------------
  72996. ; Sprite_38DBA:
  72997. ObjA7:
  72998. moveq #0,d0
  72999. move.b routine(a0),d0
  73000. move.w ObjA7_Index(pc,d0.w),d1
  73001. jmp ObjA7_Index(pc,d1.w)
  73002. ; ===========================================================================
  73003. ; off_38DC8:
  73004. ObjA7_Index: offsetTable
  73005. offsetTableEntry.w ObjA7_Init ; 0
  73006. offsetTableEntry.w ObjA7_Main ; 2
  73007. ; ===========================================================================
  73008. ; loc_38DCC:
  73009. ObjA7_Init:
  73010. bsr.w LoadSubObject
  73011. move.w #-$40,d0
  73012. btst #0,render_flags(a0)
  73013. beq.s +
  73014. neg.w d0
  73015. +
  73016. move.w d0,x_vel(a0)
  73017. move.w #$FF,objoff_2A(a0)
  73018. move.b #2,objoff_2D(a0)
  73019. lea (word_391E0).l,a2
  73020. bsr.w LoadChildObject
  73021. lea (word_391E4).l,a2
  73022. bsr.w LoadChildObject
  73023. lea (word_391E8).l,a2
  73024. bra.w LoadChildObject
  73025. ; ===========================================================================
  73026. ; loc_38E0C:
  73027. ObjA7_Main:
  73028. moveq #0,d0
  73029. move.b routine_secondary(a0),d0
  73030. move.w off_38E46(pc,d0.w),d1
  73031. jsr off_38E46(pc,d1.w)
  73032. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  73033. moveq #0,d0
  73034. moveq #$10,d1
  73035. movea.w objoff_3C(a0),a1 ; a1=object
  73036. bsr.w Obj_AlignChildXY
  73037. movea.w parent(a0),a1 ; a1=object
  73038. move.w x_pos(a0),x_pos(a1)
  73039. movea.w objoff_3A(a0),a1 ; a1=object
  73040. move.w x_pos(a0),x_pos(a1)
  73041. lea objoff_3A(a0),a2 ; a2=object
  73042. bra.w loc_39182
  73043. ; ===========================================================================
  73044. off_38E46: offsetTable
  73045. offsetTableEntry.w loc_38E52 ; 0
  73046. offsetTableEntry.w loc_38E9A ; 2
  73047. offsetTableEntry.w loc_38EB4 ; 4
  73048. offsetTableEntry.w loc_38F3E ; 6
  73049. offsetTableEntry.w loc_38F58 ; 8
  73050. offsetTableEntry.w BranchTo_ObjA7_CheckExplode ; $A
  73051. ; ===========================================================================
  73052.  
  73053. loc_38E52:
  73054. bsr.w Obj_GetOrientationToPlayer
  73055. addi.w #$40,d2
  73056. cmpi.w #$80,d2
  73057. bhs.s loc_38E66
  73058. cmpi.w #-$80,d3
  73059. bhi.s loc_38E84
  73060.  
  73061. loc_38E66:
  73062. subq.w #1,objoff_2A(a0)
  73063. bpl.s return_38E82
  73064. move.w #$FF,objoff_2A(a0)
  73065. neg.w x_vel(a0)
  73066. bchg #0,render_flags(a0)
  73067. bchg #0,status(a0)
  73068.  
  73069. return_38E82:
  73070. rts
  73071. ; ===========================================================================
  73072.  
  73073. loc_38E84:
  73074. addq.b #2,routine_secondary(a0)
  73075. move.w x_vel(a0),objoff_2E(a0)
  73076. clr.w x_vel(a0)
  73077. move.b #$10,objoff_2C(a0)
  73078. rts
  73079. ; ===========================================================================
  73080.  
  73081. loc_38E9A:
  73082. subq.b #1,objoff_2C(a0)
  73083. bmi.s loc_38EA2
  73084. rts
  73085. ; ===========================================================================
  73086.  
  73087. loc_38EA2:
  73088. addq.b #2,routine_secondary(a0)
  73089. move.w #$200,y_vel(a0)
  73090. move.b #$40,objoff_2C(a0)
  73091. rts
  73092. ; ===========================================================================
  73093.  
  73094. loc_38EB4:
  73095. tst.b objoff_30(a0)
  73096. bne.s ObjA7_GrabCharacter
  73097. subq.b #1,objoff_2C(a0)
  73098. beq.s loc_38ED6
  73099. cmpi.b #$20,objoff_2C(a0)
  73100. bne.s loc_38ECC
  73101. neg.w y_vel(a0)
  73102.  
  73103. loc_38ECC:
  73104. lea (Ani_objA7).l,a1
  73105. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  73106. ; ===========================================================================
  73107.  
  73108. loc_38ED6:
  73109. move.b #0,routine_secondary(a0)
  73110. clr.w y_vel(a0)
  73111. move.w objoff_2E(a0),x_vel(a0)
  73112. move.b #0,mapping_frame(a0)
  73113. rts
  73114. ; ===========================================================================
  73115.  
  73116. ;loc_38EEE:
  73117. ObjA7_GrabCharacter:
  73118. addq.b #2,routine_secondary(a0)
  73119. movea.w objoff_32(a0),a1
  73120. move.b #$81,obj_control(a1)
  73121. clr.w x_vel(a1)
  73122. clr.w y_vel(a1)
  73123. move.b #AniIDSonAni_Float,anim(a1)
  73124. move.b #1,mapping_frame(a0)
  73125. tst.w y_vel(a0)
  73126. bmi.s loc_38F2A
  73127. neg.w y_vel(a0)
  73128. move.b objoff_2C(a0),d0
  73129. subi.b #$40,d0
  73130. neg.w d0
  73131. addq.b #1,d0
  73132. move.b d0,objoff_2C(a0)
  73133.  
  73134. loc_38F2A:
  73135. move.b #1,objoff_2A(a0)
  73136. move.b #$10,objoff_2B(a0)
  73137. move.b #$20,objoff_37(a0)
  73138. rts
  73139. ; ===========================================================================
  73140.  
  73141. loc_38F3E:
  73142. bsr.w ObjA7_CheckExplode
  73143. bsr.w loc_390BC
  73144. subq.b #1,objoff_2C(a0)
  73145. beq.s loc_38F4E
  73146. rts
  73147. ; ===========================================================================
  73148.  
  73149. loc_38F4E:
  73150. addq.b #2,routine_secondary(a0)
  73151. clr.w y_vel(a0)
  73152. rts
  73153. ; ===========================================================================
  73154.  
  73155. loc_38F58:
  73156. bsr.w ObjA7_CheckExplode
  73157. bra.w loc_390BC
  73158. ; ===========================================================================
  73159. rts
  73160. ; ===========================================================================
  73161.  
  73162. BranchTo_ObjA7_CheckExplode
  73163. bra.w ObjA7_CheckExplode
  73164. ; ===========================================================================
  73165. ; ----------------------------------------------------------------------------
  73166. ; Object A8 - Grabber's legs from CPZ
  73167. ; ----------------------------------------------------------------------------
  73168. ; Sprite_38F66:
  73169. ObjA8:
  73170. moveq #0,d0
  73171. move.b routine(a0),d0
  73172. move.w ObjA8_Index(pc,d0.w),d1
  73173. jmp ObjA8_Index(pc,d1.w)
  73174. ; ===========================================================================
  73175. ; off_38F74:
  73176. ObjA8_Index: offsetTable
  73177. offsetTableEntry.w ObjA8_Init ; 0
  73178. offsetTableEntry.w loc_38F88 ; 2
  73179. offsetTableEntry.w loc_38FE8 ; 4
  73180. offsetTableEntry.w loc_39022 ; 6
  73181. ; ===========================================================================
  73182. ; loc_38F7C:
  73183. ObjA8_Init:
  73184. bsr.w LoadSubObject
  73185. move.b #3,mapping_frame(a0)
  73186. rts
  73187. ; ===========================================================================
  73188.  
  73189. loc_38F88:
  73190. movea.w objoff_2C(a0),a1 ; a1=object
  73191. cmpi.b #ObjID_Grabber,id(a1)
  73192. bne.w JmpTo65_DeleteObject
  73193. bsr.w loc_367AA
  73194. movea.w objoff_2C(a0),a1 ; a1=object
  73195. move.b mapping_frame(a1),d0
  73196. addq.b #3,d0
  73197. move.b d0,mapping_frame(a0)
  73198. move.b collision_property(a0),d0
  73199. beq.s BranchTo2_JmpTo45_DisplaySprite
  73200. clr.b collision_property(a0)
  73201. cmpi.b #4,routine_secondary(a1)
  73202. bne.s BranchTo2_JmpTo45_DisplaySprite
  73203. andi.b #3,d0
  73204. beq.s BranchTo2_JmpTo45_DisplaySprite
  73205. clr.b collision_flags(a0)
  73206. addq.b #2,routine(a0)
  73207. add.w d0,d0
  73208. st objoff_30(a1)
  73209. move.w word_38FE0-6(pc,d0.w),objoff_32(a1)
  73210. move.w word_38FE0(pc,d0.w),objoff_34(a1)
  73211.  
  73212. BranchTo2_JmpTo45_DisplaySprite
  73213. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73214. ; ===========================================================================
  73215. dc.w MainCharacter ; -2
  73216. dc.w Sidekick ; -1
  73217. word_38FE0: dc.w MainCharacter ; 0
  73218. dc.w Ctrl_1_Held ; 1
  73219. dc.w Ctrl_2_Held ; 2
  73220. dc.w Ctrl_1_Held ; 3
  73221. ; ===========================================================================
  73222.  
  73223. loc_38FE8:
  73224. movea.w objoff_2C(a0),a1 ; a1=object
  73225. move.w objoff_32(a1),d0
  73226. beq.s loc_3901A
  73227. movea.w d0,a2 ; a2=object
  73228. cmpi.b #ObjID_Grabber,id(a1)
  73229. bne.s loc_3900A
  73230. move.w x_pos(a0),x_pos(a2)
  73231. move.w y_pos(a0),y_pos(a2)
  73232. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73233. ; ===========================================================================
  73234.  
  73235. loc_3900A:
  73236. move.b #0,obj_control(a2)
  73237. bset #1,status(a2)
  73238. bra.w JmpTo65_DeleteObject
  73239. ; ===========================================================================
  73240.  
  73241. loc_3901A:
  73242. addq.b #2,routine(a0)
  73243. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73244. ; ===========================================================================
  73245.  
  73246. loc_39022:
  73247. movea.w objoff_2C(a0),a1 ; a1=object
  73248. cmpi.b #ObjID_Grabber,id(a1) ; compare to objA7
  73249. bne.w JmpTo65_DeleteObject
  73250. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73251. ; ===========================================================================
  73252. ; ----------------------------------------------------------------------------
  73253. ; Object A9 - The little hanger box thing a Grabber's string comes out of
  73254. ; ----------------------------------------------------------------------------
  73255. ; Sprite_39032:
  73256. ObjA9:
  73257. moveq #0,d0
  73258. move.b routine(a0),d0
  73259. move.w ObjA9_Index(pc,d0.w),d1
  73260. jmp ObjA9_Index(pc,d1.w)
  73261. ; ===========================================================================
  73262. ; off_39040:
  73263. ObjA9_Index: offsetTable
  73264. offsetTableEntry.w ObjA9_Init ; 0
  73265. offsetTableEntry.w ObjA9_Main ; 2
  73266. ; ===========================================================================
  73267. ; loc_39044:
  73268. ObjA9_Init:
  73269. bsr.w LoadSubObject
  73270. move.b #2,mapping_frame(a0)
  73271. subi.w #$C,y_pos(a0)
  73272. rts
  73273. ; ===========================================================================
  73274. ; loc_39056:
  73275. ObjA9_Main:
  73276. movea.w objoff_2C(a0),a1 ; a1=object
  73277. cmpi.b #ObjID_Grabber,id(a1) ; compare to objA7 (grabber badnik)
  73278. bne.w JmpTo65_DeleteObject
  73279. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73280. ; ===========================================================================
  73281. ; ----------------------------------------------------------------------------
  73282. ; Object AA - The thin white string a Grabber hangs from
  73283. ; ----------------------------------------------------------------------------
  73284. ; Sprite_39066:
  73285. ObjAA:
  73286. moveq #0,d0
  73287. move.b routine(a0),d0
  73288. move.w ObjAA_Index(pc,d0.w),d1
  73289. jmp ObjAA_Index(pc,d1.w)
  73290. ; ===========================================================================
  73291. ; off_39074:
  73292. ObjAA_Index: offsetTable
  73293. offsetTableEntry.w ObjAA_Init ; 0
  73294. offsetTableEntry.w ObjAA_Main ; 2
  73295. ; ===========================================================================
  73296. ; loc_39078:
  73297. ObjAA_Init:
  73298. bsr.w LoadSubObject
  73299. subq.w #8,y_pos(a0)
  73300. rts
  73301. ; ===========================================================================
  73302. ; loc_39082:
  73303. ObjAA_Main:
  73304. movea.w objoff_2C(a0),a1 ; a1=object
  73305. cmpi.b #ObjID_Grabber,id(a1) ; compare to objA7 (grabber badnik)
  73306. bne.w JmpTo65_DeleteObject
  73307. move.w y_pos(a1),d0
  73308. sub.w y_pos(a0),d0
  73309. bmi.s +
  73310. lsr.w #4,d0
  73311. move.b d0,mapping_frame(a0)
  73312. +
  73313. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73314.  
  73315. ; ===========================================================================
  73316. ; ----------------------------------------------------------------------------
  73317. ; Object AB - Removed object (unknown, unused)
  73318. ; ----------------------------------------------------------------------------
  73319. ; Sprite_390A2:
  73320. ObjAB:
  73321. moveq #0,d0
  73322. move.b routine(a0),d0
  73323. move.w ObjAB_Index(pc,d0.w),d1
  73324. jmp ObjAB_Index(pc,d1.w)
  73325. ; ===========================================================================
  73326. ; off_390B0:
  73327. ObjAB_Index: offsetTable
  73328. offsetTableEntry.w ObjAB_Init
  73329. offsetTableEntry.w ObjAB_Main
  73330. ; ===========================================================================
  73331. ; BranchTo4_LoadSubObject
  73332. ObjAB_Init:
  73333. bra.w LoadSubObject
  73334. ; ===========================================================================
  73335. ; BranchTo10_JmpTo39_MarkObjGone
  73336. ObjAB_Main:
  73337. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73338. ; ===========================================================================
  73339. ; END OF OBJECT AB
  73340.  
  73341.  
  73342. ; ---------------------------------------------------------------------------
  73343. ; Some subroutine for the Grabber badnik
  73344. ; ---------------------------------------------------------------------------
  73345.  
  73346. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  73347.  
  73348. loc_390BC:
  73349. movea.w objoff_34(a0),a1 ; a1=object
  73350. move.w (a1),d0
  73351. tst.b objoff_31(a0)
  73352. beq.s loc_390E6
  73353. subq.b #1,objoff_37(a0)
  73354. beq.s loc_390FA
  73355. move.b objoff_36(a0),d1
  73356. andi.b #$C,d0
  73357. beq.s return_390E4
  73358. cmp.b d1,d0
  73359. beq.s return_390E4
  73360. move.b d0,objoff_36(a0)
  73361. addq.b #1,objoff_38(a0)
  73362.  
  73363. return_390E4:
  73364. rts
  73365. ; ---------------------------------------------------------------------------
  73366. loc_390E6:
  73367. andi.b #$C,d0
  73368. beq.s return_390E4
  73369. nop
  73370. st objoff_31(a0)
  73371. move.b d0,objoff_36(a0)
  73372. nop
  73373. rts
  73374. ; ---------------------------------------------------------------------------
  73375. loc_390FA:
  73376. cmpi.b #4,objoff_38(a0)
  73377. blo.s +
  73378. move.b #$A,routine_secondary(a0)
  73379. clr.w y_vel(a0)
  73380. clr.b collision_flags(a0)
  73381. movea.w objoff_32(a0),a2 ; a2=object
  73382. move.b #0,obj_control(a2)
  73383. bset #1,status(a2)
  73384. move.b #AniIDSonAni_Walk,anim(a2)
  73385. clr.w objoff_32(a0)
  73386. +
  73387. move.b #$20,objoff_37(a0)
  73388. clr.b objoff_31(a0)
  73389. clr.b objoff_38(a0)
  73390. rts
  73391. ; End of subroutine loc_390BC
  73392.  
  73393. ; ---------------------------------------------------------------------------
  73394. ; Grabber death check subroutine
  73395. ; ---------------------------------------------------------------------------
  73396.  
  73397. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  73398.  
  73399. ; loc_3913A:
  73400. ObjA7_CheckExplode:
  73401. subq.b #1,objoff_2A(a0)
  73402. bne.s +
  73403. move.b objoff_2B(a0),objoff_2A(a0)
  73404. subq.b #1,objoff_2B(a0)
  73405. beq.s ObjA7_Poof
  73406. bchg #palette_bit_0,art_tile(a0)
  73407. +
  73408. rts
  73409. ; ---------------------------------------------------------------------------
  73410. ; loc_39154:
  73411. ObjA7_Poof:
  73412. _move.b #ObjID_Explosion,id(a0) ; load 0bj27 (transform into explosion)
  73413. move.b #2,routine(a0)
  73414. bset #palette_bit_0,art_tile(a0)
  73415. move.w objoff_32(a0),d0
  73416. beq.s +
  73417. movea.w d0,a2 ; a2=object
  73418. move.b #0,objoff_2A(a2)
  73419. bset #1,status(a2)
  73420. move.b #$B,collision_flags(a0)
  73421. +
  73422. rts
  73423. ; End of subroutine ObjA7_CheckExplode
  73424. ; ===========================================================================
  73425.  
  73426. ; ---------------------------------------------------------------------------
  73427. ; Yet another subroutine for the Grabber badnik
  73428. ; ---------------------------------------------------------------------------
  73429.  
  73430. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  73431.  
  73432. loc_39182:
  73433. tst.w (Two_player_mode).w
  73434. beq.s +
  73435. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73436. ; ---------------------------------------------------------------------------
  73437. + move.w x_pos(a0),d0
  73438. andi.w #$FF80,d0
  73439. sub.w (Camera_X_pos_coarse).w,d0
  73440. cmpi.w #$280,d0
  73441. bhi.w +
  73442. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73443. ; ---------------------------------------------------------------------------
  73444. + lea (Object_Respawn_Table).w,a3
  73445. moveq #0,d0
  73446. move.b respawn_index(a0),d0
  73447. beq.s +
  73448. bclr #7,2(a3,d0.w)
  73449. +
  73450. tst.b objoff_30(a0)
  73451. beq.s +
  73452. movea.w objoff_32(a0),a3
  73453. move.b #0,$2A(a3)
  73454. bset #1,$22(a3)
  73455. +
  73456. moveq #0,d6
  73457. move.b objoff_2D(a0),d6
  73458.  
  73459. - movea.w (a2)+,a1
  73460. jsrto (DeleteObject2).l, JmpTo6_DeleteObject2
  73461. dbf d6,-
  73462.  
  73463. bra.w JmpTo65_DeleteObject
  73464. ; End of subroutine loc_39182
  73465.  
  73466. ; ===========================================================================
  73467. word_391E0:
  73468. dc.w objoff_3E
  73469. dc.b ObjID_GrabberBox
  73470. dc.b $3A
  73471. word_391E4:
  73472. dc.w objoff_3C
  73473. dc.b ObjID_GrabberLegs
  73474. dc.b $38
  73475. word_391E8:
  73476. dc.w objoff_3A
  73477. dc.b ObjID_GrabberString
  73478. dc.b $3C
  73479. ; off_391EC:
  73480. ObjA7_SubObjData:
  73481. subObjData ObjA7_ObjA8_ObjA9_Obj98_MapUnc_3921A,make_art_tile(ArtTile_ArtNem_Grabber,1,1),4,4,$10,$B
  73482. ; off_391F6:
  73483. ObjA7_SubObjData2:
  73484. subObjData ObjA7_ObjA8_ObjA9_Obj98_MapUnc_3921A,make_art_tile(ArtTile_ArtNem_Grabber,1,1),4,1,$10,$D7
  73485. ; off_39200:
  73486. ObjA8_SubObjData:
  73487. subObjData ObjA7_ObjA8_ObjA9_Obj98_MapUnc_3921A,make_art_tile(ArtTile_ArtNem_Grabber,1,1),4,4,4,0
  73488. ; off_3920A:
  73489. ObjA8_SubObjData2:
  73490. subObjData ObjAA_MapUnc_39228,make_art_tile(ArtTile_ArtNem_Grabber,1,1),4,5,4,0
  73491. ; animation script
  73492. ; off_39214:
  73493. Ani_objA7: offsetTable
  73494. offsetTableEntry.w byte_39216 ; 0
  73495. byte_39216:
  73496. dc.b 7, 0, 1,$FF
  73497. even
  73498. ; ----------------------------------------------------------------------------
  73499. ; sprite mappings - objA7,objA8,objA9
  73500. ; ----------------------------------------------------------------------------
  73501. ObjA7_ObjA8_ObjA9_Obj98_MapUnc_3921A: offsetTable
  73502. offsetTableEntry.w word_3923A ; 0
  73503. offsetTableEntry.w word_39254 ; 1
  73504. offsetTableEntry.w word_3926E ; 2
  73505. offsetTableEntry.w word_39278 ; 3
  73506. offsetTableEntry.w word_39282 ; 4
  73507. offsetTableEntry.w word_3928C ; 5
  73508. offsetTableEntry.w word_39296 ; 6
  73509. ; -------------------------------------------------------------------------------
  73510. ; sprite mappings - objAA (string of various lengths)
  73511. ; -------------------------------------------------------------------------------
  73512. ObjAA_MapUnc_39228: offsetTable
  73513. offsetTableEntry.w word_392A0 ; 0
  73514. offsetTableEntry.w word_392AA ; 1
  73515. offsetTableEntry.w word_392B4 ; 2
  73516. offsetTableEntry.w word_392C6 ; 3
  73517. offsetTableEntry.w word_392D8 ; 4
  73518. ; Unused - The spider badnik never goes down enough for these to appear
  73519. offsetTableEntry.w word_3930C ; 5 ; This is in the wrong place - this should be frame 6
  73520. offsetTableEntry.w word_392F2 ; 6 ; This is in the wrong place - this should be frame 5
  73521. offsetTableEntry.w word_3932E ; 7
  73522. offsetTableEntry.w word_3932E ; 8 ; This should point to word_39350
  73523. word_3923A:
  73524. dc.w 3
  73525. dc.w $F801, 0, 0,$FFE5
  73526. dc.w $F80D, 2, 1,$FFED; 4
  73527. dc.w $809, $1D, $E,$FFF1; 8
  73528. word_39254:
  73529. dc.w 3
  73530. dc.w $F801, 0, 0,$FFE5
  73531. dc.w $F80D, 2, 1,$FFED; 4
  73532. dc.w $80D, $23, $11,$FFF1; 8
  73533. word_3926E:
  73534. dc.w 1
  73535. dc.w $FC00, $A, 5,$FFFC
  73536. word_39278:
  73537. dc.w 1
  73538. dc.w $F809, $F, 7,$FFF9
  73539. word_39282:
  73540. dc.w 1
  73541. dc.w $F80D, $15, $A,$FFF9
  73542. word_3928C:
  73543. dc.w 1
  73544. dc.w $FC00, $2B, $15,$FFFC
  73545. word_39296:
  73546. dc.w 1
  73547. dc.w $FC00, $2C, $16,$FFFC
  73548. word_392A0:
  73549. dc.w 1
  73550. dc.w 1, $B, 5,$FFFC
  73551. word_392AA:
  73552. dc.w 1
  73553. dc.w 3, $B, 5,$FFFC
  73554. word_392B4:
  73555. dc.w 2
  73556. dc.w 1, $B, 5,$FFFC
  73557. dc.w $1003, $B, 5,$FFFC; 4
  73558. word_392C6:
  73559. dc.w 2
  73560. dc.w 3, $B, 5,$FFFC
  73561. dc.w $2003, $B, 5,$FFFC; 4
  73562. word_392D8:
  73563. dc.w 3
  73564. dc.w 1, $B, 5,$FFFC
  73565. dc.w $1003, $B, 5,$FFFC; 4
  73566. dc.w $3003, $B, 5,$FFFC; 8
  73567. word_392F2:
  73568. dc.w 3
  73569. dc.w 3, $B, 5,$FFFC
  73570. dc.w $2003, $B, 5,$FFFC; 4
  73571. dc.w $4003, $B, 5,$FFFC; 8
  73572. word_3930C:
  73573. dc.w 4
  73574. dc.w 1, $B, 5,$FFFC
  73575. dc.w $1003, $B, 5,$FFFC; 4
  73576. dc.w $3003, $B, 5,$FFFC; 8
  73577. dc.w $5003, $B, 5,$FFFC; 12
  73578. word_3932E:
  73579. dc.w 4
  73580. dc.w 3, $B, 5,$FFFC
  73581. dc.w $2003, $B, 5,$FFFC; 4
  73582. dc.w $4003, $B, 5,$FFFC; 8
  73583. dc.w $6003, $B, 5,$FFFC; 12
  73584. ; Unused frame
  73585. ;word_39350:
  73586. dc.w 5
  73587. dc.w 1, $B, 5,$FFFC
  73588. dc.w $1003, $B, 5,$FFFC; 4
  73589. dc.w $3003, $B, 5,$FFFC; 8
  73590. dc.w $5003, $B, 5,$FFFC; 12
  73591. dc.w $7003, $B, 5,$FFFC; 16
  73592.  
  73593.  
  73594.  
  73595.  
  73596. ; ===========================================================================
  73597. ; ----------------------------------------------------------------------------
  73598. ; Object AC - Balkiry (jet badnik) from SCZ
  73599. ; ----------------------------------------------------------------------------
  73600. ; Sprite_3937A:
  73601. ObjAC:
  73602. moveq #0,d0
  73603. move.b routine(a0),d0
  73604. move.w ObjAC_Index(pc,d0.w),d1
  73605. jmp ObjAC_Index(pc,d1.w)
  73606. ; ===========================================================================
  73607. ; off_39388:
  73608. ObjAC_Index: offsetTable
  73609. offsetTableEntry.w ObjAC_Init ; 0
  73610. offsetTableEntry.w ObjAC_Main ; 2
  73611. ; ===========================================================================
  73612. ; loc_3938C:
  73613. ObjAC_Init:
  73614. bsr.w LoadSubObject
  73615. move.b #1,mapping_frame(a0)
  73616. move.w #-$300,x_vel(a0)
  73617. bclr #1,render_flags(a0)
  73618. beq.s +
  73619. move.w #-$500,x_vel(a0)
  73620. +
  73621. lea_ Ani_obj9C,a1
  73622. move.l a1,objoff_2E(a0)
  73623. bra.w loc_37ABE
  73624. ; ===========================================================================
  73625. ; loc_393B6:
  73626. ObjAC_Main:
  73627. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  73628. bsr.w loc_36776
  73629. bra.w Obj_DeleteBehindScreen
  73630. ; ===========================================================================
  73631. ; off_393C2:
  73632. ObjAC_SubObjData:
  73633. subObjData ObjAC_MapUnc_393CC,make_art_tile(ArtTile_ArtNem_Balkrie,0,0),4,4,$20,8
  73634. ; ----------------------------------------------------------------------------
  73635. ; sprite mappings
  73636. ; ----------------------------------------------------------------------------
  73637. ObjAC_MapUnc_393CC: BINCLUDE "mappings/sprite/objAC.bin"
  73638.  
  73639.  
  73640.  
  73641.  
  73642. ; ===========================================================================
  73643. ; ----------------------------------------------------------------------------
  73644. ; Object AD - Clucker's base from WFZ
  73645. ; ----------------------------------------------------------------------------
  73646. ; Sprite_3941C:
  73647. ObjAD:
  73648. moveq #0,d0
  73649. move.b routine(a0),d0
  73650. move.w ObjAD_Index(pc,d0.w),d1
  73651. jmp ObjAD_Index(pc,d1.w)
  73652. ; ===========================================================================
  73653. ; off_3942A:
  73654. ObjAD_Index: offsetTable
  73655. offsetTableEntry.w ObjAD_Init ; 0
  73656. offsetTableEntry.w ObjAD_Main ; 2
  73657. ; ===========================================================================
  73658. ; loc_3942E:
  73659. ObjAD_Init:
  73660. bsr.w LoadSubObject
  73661. move.b #$C,mapping_frame(a0)
  73662. rts
  73663. ; ===========================================================================
  73664. ; loc_3943A:
  73665. ObjAD_Main:
  73666. move.w #$1B,d1
  73667. move.w #8,d2
  73668. move.w #8,d3
  73669. move.w x_pos(a0),d4
  73670. jsrto (SolidObject).l, JmpTo27_SolidObject
  73671. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73672. ; ===========================================================================
  73673. ; ----------------------------------------------------------------------------
  73674. ; Object AE - Clucker (chicken badnik) from WFZ
  73675. ; ----------------------------------------------------------------------------
  73676. ; Sprite_39452:
  73677. ObjAE:
  73678. moveq #0,d0
  73679. move.b routine(a0),d0
  73680. move.w ObjAE_Index(pc,d0.w),d1
  73681. jmp ObjAE_Index(pc,d1.w)
  73682. ; ===========================================================================
  73683. ; off_39460:
  73684. ObjAE_Index: offsetTable
  73685. offsetTableEntry.w ObjAE_Init ; 0
  73686. offsetTableEntry.w loc_39488 ; 2
  73687. offsetTableEntry.w loc_394A2 ; 4
  73688. offsetTableEntry.w loc_394D2 ; 6
  73689. offsetTableEntry.w loc_394E0 ; 8
  73690. offsetTableEntry.w loc_39508 ; $A
  73691. offsetTableEntry.w loc_39516 ; $C
  73692. ; ===========================================================================
  73693. ; loc_3946E:
  73694. ObjAE_Init:
  73695. bsr.w LoadSubObject
  73696. move.b #$15,mapping_frame(a0)
  73697. btst #0,render_flags(a0)
  73698. beq.s +
  73699. bset #0,status(a0)
  73700. +
  73701. rts
  73702. ; ===========================================================================
  73703.  
  73704. loc_39488:
  73705. bsr.w Obj_GetOrientationToPlayer
  73706. addi.w #$80,d2
  73707. cmpi.w #$100,d2
  73708. blo.s +
  73709. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73710. ; ===========================================================================
  73711. +
  73712. addq.b #2,routine(a0)
  73713. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73714. ; ===========================================================================
  73715.  
  73716. loc_394A2:
  73717. move.b routine(a0),d2
  73718. lea (Ani_objAE_a).l,a1
  73719. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  73720. cmp.b routine(a0),d2
  73721. bne.s +
  73722. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73723. ; ===========================================================================
  73724. +
  73725. lea mapping_frame(a0),a1
  73726. clr.l (a1)
  73727. clr.w anim_frame_duration-mapping_frame(a1)
  73728. move.b #8,(a1)
  73729. move.b #6,collision_flags(a0)
  73730. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73731. ; ===========================================================================
  73732.  
  73733. loc_394D2:
  73734. lea (Ani_objAE_b).l,a1
  73735. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  73736. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73737. ; ===========================================================================
  73738.  
  73739. loc_394E0:
  73740. tst.b objoff_2A(a0)
  73741. beq.s +
  73742. subq.b #1,objoff_2A(a0)
  73743. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73744. ; ===========================================================================
  73745. +
  73746. addq.b #2,routine(a0)
  73747. lea mapping_frame(a0),a1
  73748. clr.l (a1)
  73749. clr.w anim_frame_duration-mapping_frame(a1)
  73750. move.b #$B,(a1)
  73751. bsr.w loc_39526
  73752. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73753. ; ===========================================================================
  73754.  
  73755. loc_39508:
  73756. lea (Ani_objAE_c).l,a1
  73757. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  73758. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73759. ; ===========================================================================
  73760.  
  73761. loc_39516:
  73762. move.b #8,routine(a0)
  73763. move.b #$40,objoff_2A(a0)
  73764. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  73765. ; ===========================================================================
  73766.  
  73767. loc_39526:
  73768. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  73769. bne.s ++ ; rts
  73770. _move.b #ObjID_Projectile,id(a1) ; load obj98
  73771. move.b #$D,mapping_frame(a1)
  73772. move.b #$46,subtype(a1) ; <== ObjAD_SubObjData3
  73773. move.w x_pos(a0),x_pos(a1)
  73774. move.w y_pos(a0),y_pos(a1)
  73775. addi.w #$B,y_pos(a1)
  73776. move.w #-$200,d0
  73777. move.w #-8,d1
  73778. btst #0,render_flags(a0)
  73779. beq.s +
  73780. neg.w d0
  73781. neg.w d1
  73782. +
  73783. move.w d0,x_vel(a1)
  73784. add.w d1,x_pos(a1)
  73785. lea_ Obj98_CluckerShotMove,a2
  73786. move.l a2,objoff_2A(a1)
  73787. +
  73788. rts
  73789. ; ===========================================================================
  73790. ObjAD_SubObjData:
  73791. subObjData ObjAD_Obj98_MapUnc_395B4,make_art_tile(ArtTile_ArtNem_WfzScratch,0,0),4,4,$18,0
  73792. ObjAD_SubObjData2:
  73793. subObjData ObjAD_Obj98_MapUnc_395B4,make_art_tile(ArtTile_ArtNem_WfzScratch,0,0),4,5,$10,0
  73794.  
  73795. ; animation script
  73796. ; off_3958A
  73797. Ani_objAE_a: offsetTable
  73798. offsetTableEntry.w + ; 0
  73799. + dc.b 1, 0, 1, 2, 3, 4, 5, 6, 7,$FC
  73800. even
  73801.  
  73802. ; animation script
  73803. ; off_39596
  73804. Ani_objAE_b: offsetTable
  73805. offsetTableEntry.w + ; 0
  73806. + dc.b 1, 8, 9, $A, $B, $B, $B, $B,$FC
  73807. even
  73808.  
  73809. ; animation script
  73810. ; off_395A2
  73811. Ani_objAE_c: offsetTable
  73812. offsetTableEntry.w + ; 0
  73813. + dc.b 3, $A, $B,$FC
  73814. even
  73815.  
  73816. ; animation script
  73817. ; off_395A8
  73818. Ani_CluckerShot:offsetTable
  73819. offsetTableEntry.w + ; 0
  73820. + dc.b 3, $D, $E, $F,$10,$11,$12,$13,$14,$FF
  73821. even
  73822.  
  73823. ; ----------------------------------------------------------------------------
  73824. ; sprite mappings
  73825. ; ----------------------------------------------------------------------------
  73826. ObjAD_Obj98_MapUnc_395B4: BINCLUDE "mappings/sprite/objAE.bin"
  73827.  
  73828.  
  73829.  
  73830.  
  73831. ; ===========================================================================
  73832. ; ----------------------------------------------------------------------------
  73833. ; Object AF - Mecha Sonic / Silver Sonic from DEZ
  73834. ; (also handles Eggman's remote-control window)
  73835. ; ----------------------------------------------------------------------------
  73836. ; Sprite_3972C:
  73837. ObjAF:
  73838. moveq #0,d0
  73839. move.b routine(a0),d0
  73840. move.w ObjAF_Index(pc,d0.w),d1
  73841. jmp ObjAF_Index(pc,d1.w)
  73842. ; ===========================================================================
  73843. ; off_3973A:
  73844. ObjAF_Index: offsetTable
  73845. offsetTableEntry.w ObjAF_Init ; 0
  73846. offsetTableEntry.w loc_397AC ; 2
  73847. offsetTableEntry.w loc_397E6 ; 4
  73848. offsetTableEntry.w loc_397FE ; 6
  73849. offsetTableEntry.w loc_3984A ; 8
  73850. offsetTableEntry.w loc_398C0 ; $A
  73851. offsetTableEntry.w loc_39B92 ; $C
  73852. offsetTableEntry.w loc_39BBA ; $E
  73853. offsetTableEntry.w loc_39BCC ; $10
  73854. offsetTableEntry.w loc_39BE2 ; $12
  73855. offsetTableEntry.w loc_39BEA ; $14
  73856. offsetTableEntry.w loc_39C02 ; $16
  73857. offsetTableEntry.w loc_39C0A ; $18
  73858. offsetTableEntry.w loc_39C12 ; $1A
  73859. offsetTableEntry.w loc_39C2A ; $1C
  73860. offsetTableEntry.w loc_39C42 ; $1E
  73861. offsetTableEntry.w loc_39C50 ; $20
  73862. offsetTableEntry.w loc_39CA0 ; $22
  73863. ; ===========================================================================
  73864. ; loc_3975E:
  73865. ObjAF_Init:
  73866. bsr.w LoadSubObject
  73867. move.b #$1B,y_radius(a0)
  73868. move.b #$10,x_radius(a0)
  73869. move.b #0,collision_flags(a0)
  73870. move.b #8,collision_property(a0)
  73871. lea (word_39DC2).l,a2
  73872. bsr.w LoadChildObject
  73873. move.b #$E,routine(a1)
  73874. lea (word_39DC6).l,a2
  73875. bsr.w LoadChildObject
  73876. move.b #$14,routine(a1)
  73877. lea (word_39DCA).l,a2
  73878. bsr.w LoadChildObject
  73879. move.b #$1A,routine(a1)
  73880. rts
  73881. ; ===========================================================================
  73882.  
  73883. loc_397AC:
  73884. move.w (Camera_X_pos).w,d0
  73885. cmpi.w #$224,d0
  73886. bhs.s loc_397BA
  73887. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73888. ; ===========================================================================
  73889.  
  73890. loc_397BA:
  73891. addq.b #2,routine(a0)
  73892. move.w #$3C,objoff_2A(a0)
  73893. move.w #$100,y_vel(a0)
  73894. move.w #$224,d0
  73895. move.w d0,(Camera_Min_X_pos).w
  73896. move.w d0,(Camera_Max_X_pos).w
  73897. move.b #9,(Current_Boss_ID).w
  73898. moveq #MusID_FadeOut,d0
  73899. jsrto (PlaySound).l, JmpTo12_PlaySound
  73900. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73901. ; ===========================================================================
  73902.  
  73903. loc_397E6:
  73904. subq.w #1,objoff_2A(a0)
  73905. bmi.s loc_397F0
  73906. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73907. ; ===========================================================================
  73908.  
  73909. loc_397F0:
  73910. addq.b #2,routine(a0)
  73911. moveq #MusID_Boss,d0
  73912. jsrto (PlayMusic).l, JmpTo5_PlayMusic
  73913. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73914. ; ===========================================================================
  73915.  
  73916. loc_397FE:
  73917. move.b (Vint_runcount+3).w,d0
  73918. andi.b #$1F,d0
  73919. bne.s loc_3980E
  73920. moveq #SndID_Fire,d0
  73921. jsrto (PlaySound).l, JmpTo12_PlaySound
  73922.  
  73923. loc_3980E:
  73924. jsr (ObjCheckFloorDist).l
  73925. tst.w d1
  73926. bmi.s loc_39830
  73927. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  73928. moveq #0,d0
  73929. moveq #0,d1
  73930. movea.w parent(a0),a1 ; a1=object
  73931. bsr.w Obj_AlignChildXY
  73932. bsr.w loc_39D4A
  73933. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73934. ; ===========================================================================
  73935.  
  73936. loc_39830:
  73937. add.w d1,y_pos(a0)
  73938. move.w #0,y_vel(a0)
  73939. move.b #$1A,collision_flags(a0)
  73940. bset #1,status(a0)
  73941. bra.w loc_399D6
  73942. ; ===========================================================================
  73943.  
  73944. loc_3984A:
  73945. bsr.w loc_39CAE
  73946. bsr.w loc_39D1C
  73947. subq.b #1,objoff_2A(a0)
  73948. beq.s loc_39886
  73949. cmpi.b #$32,objoff_2A(a0)
  73950. bne.s loc_3986A
  73951. moveq #SndID_MechaSonicBuzz,d0
  73952. jsrto (PlaySound).l, JmpTo12_PlaySound
  73953. jsrto (DisplaySprite).l, JmpTo45_DisplaySprite
  73954.  
  73955. loc_3986A:
  73956. jsr (ObjCheckFloorDist).l
  73957. add.w d1,y_pos(a0)
  73958. lea (off_39DE2).l,a1
  73959. bsr.w AnimateSprite_Checked
  73960. bsr.w loc_39D4A
  73961. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73962. ; ===========================================================================
  73963.  
  73964. loc_39886:
  73965. addq.b #2,routine(a0)
  73966. moveq #0,d0
  73967. move.b objoff_2F(a0),d0
  73968. andi.b #$F,d0
  73969. move.b byte_398B0(pc,d0.w),routine_secondary(a0)
  73970. addq.b #1,objoff_2F(a0)
  73971. clr.b objoff_2E(a0)
  73972. movea.w objoff_3C(a0),a1 ; a1=object
  73973. move.b #$16,routine(a1)
  73974. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  73975. ; ===========================================================================
  73976. byte_398B0:
  73977. dc.b 6
  73978. dc.b 0 ; 1
  73979. dc.b $10 ; 2
  73980. dc.b 6 ; 3
  73981. dc.b 6 ; 4
  73982. dc.b $1E ; 5
  73983. dc.b 0 ; 6
  73984. dc.b $10 ; 7
  73985. dc.b 6 ; 8
  73986. dc.b 6 ; 9
  73987. dc.b $10 ; 10
  73988. dc.b 6 ; 11
  73989. dc.b 0 ; 12
  73990. dc.b 6 ; 13
  73991. dc.b $10 ; 14
  73992. dc.b $1E ; 15
  73993. ; ===========================================================================
  73994.  
  73995. loc_398C0:
  73996. bsr.w loc_39CAE
  73997. bsr.w loc_39D1C
  73998. moveq #0,d0
  73999. move.b routine_secondary(a0),d0
  74000. move.w off_398F2(pc,d0.w),d1
  74001. jsr off_398F2(pc,d1.w)
  74002. moveq #0,d0
  74003. moveq #0,d1
  74004. movea.w parent(a0),a1 ; a1=object
  74005. bsr.w Obj_AlignChildXY
  74006. bsr.w loc_39D4A
  74007. bsr.w Obj_AlignChildXY
  74008. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  74009. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74010. ; ===========================================================================
  74011. off_398F2: offsetTable
  74012. offsetTableEntry.w loc_3991E ; 0
  74013. offsetTableEntry.w loc_39946 ; 2
  74014. offsetTableEntry.w loc_39976 ; 4
  74015. offsetTableEntry.w loc_39A0A ; 6
  74016. offsetTableEntry.w loc_39A1C ; 8
  74017. offsetTableEntry.w loc_39A44 ; $A
  74018. offsetTableEntry.w loc_39A68 ; $C
  74019. offsetTableEntry.w loc_39A96 ; $E
  74020. offsetTableEntry.w loc_39A0A ; $10
  74021. offsetTableEntry.w loc_39A1C ; $12
  74022. offsetTableEntry.w loc_39AAA ; $14
  74023. offsetTableEntry.w loc_39ACE ; $16
  74024. offsetTableEntry.w loc_39AF4 ; $18
  74025. offsetTableEntry.w loc_39B28 ; $1A
  74026. offsetTableEntry.w loc_39A96 ; $1C
  74027. offsetTableEntry.w loc_39A0A ; $1E
  74028. offsetTableEntry.w loc_39A1C ; $20
  74029. offsetTableEntry.w loc_39AAA ; $22
  74030. offsetTableEntry.w loc_39ACE ; $24
  74031. offsetTableEntry.w loc_39B44 ; $26
  74032. offsetTableEntry.w loc_39B28 ; $28
  74033. offsetTableEntry.w loc_39A96 ; $2A
  74034. ; ===========================================================================
  74035.  
  74036. loc_3991E:
  74037. addq.b #2,routine_secondary(a0)
  74038. move.b #3,mapping_frame(a0)
  74039. move.b #2,objoff_2C(a0)
  74040.  
  74041. loc_3992E:
  74042. move.b #$20,objoff_2A(a0)
  74043. movea.w parent(a0),a1 ; a1=object
  74044. move.b #$10,routine(a1)
  74045. move.b #1,anim(a1)
  74046. rts
  74047. ; ===========================================================================
  74048.  
  74049. loc_39946:
  74050. subq.b #1,objoff_2A(a0)
  74051. bmi.s loc_3994E
  74052. rts
  74053. ; ===========================================================================
  74054.  
  74055. loc_3994E:
  74056. addq.b #2,routine_secondary(a0)
  74057. move.b #$40,objoff_2A(a0)
  74058. move.b #1,anim(a0)
  74059. move.w #$800,d0
  74060. bsr.w loc_39D60
  74061. movea.w parent(a0),a1 ; a1=object
  74062. move.b #2,anim(a1)
  74063. moveq #SndID_SpindashRelease,d0
  74064. jmpto (PlaySound).l, JmpTo12_PlaySound
  74065. ; ===========================================================================
  74066.  
  74067. loc_39976:
  74068. subq.b #1,objoff_2A(a0)
  74069. bmi.s loc_399C2
  74070. cmpi.b #$20,objoff_2A(a0)
  74071. bne.s loc_39994
  74072. move.b #2,anim(a0)
  74073. movea.w parent(a0),a1 ; a1=object
  74074. move.b #$12,routine(a1)
  74075.  
  74076. loc_39994:
  74077. bsr.w loc_39D72
  74078. lea (off_39DE2).l,a1
  74079. bsr.w AnimateSprite_Checked
  74080. cmpi.b #2,anim(a0)
  74081. bne.s return_399C0
  74082. cmpi.b #2,anim_frame(a0)
  74083. bne.s return_399C0
  74084. cmpi.b #3,anim_frame_duration(a0)
  74085. bne.s return_399C0
  74086. bchg #0,render_flags(a0)
  74087.  
  74088. return_399C0:
  74089. rts
  74090. ; ===========================================================================
  74091.  
  74092. loc_399C2:
  74093. subq.b #1,objoff_2C(a0)
  74094. beq.s loc_399D6
  74095. move.b #2,routine_secondary(a0)
  74096. clr.w x_vel(a0)
  74097. bra.w loc_3992E
  74098. ; ===========================================================================
  74099.  
  74100. loc_399D6:
  74101. move.b #8,routine(a0)
  74102. move.b #0,anim(a0)
  74103. move.b #$64,objoff_2A(a0)
  74104. clr.w x_vel(a0)
  74105. movea.w parent(a0),a1 ; a1=object
  74106. move.b #$12,routine(a1)
  74107. movea.w objoff_3C(a0),a1 ; a1=object
  74108. move.b #$18,routine(a1)
  74109. moveq #SndID_MechaSonicBuzz,d0
  74110. jsrto (PlaySound).l, JmpTo12_PlaySound
  74111. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74112. ; ===========================================================================
  74113.  
  74114. loc_39A0A:
  74115. addq.b #2,routine_secondary(a0)
  74116. move.b #3,mapping_frame(a0)
  74117. move.b #3,anim(a0)
  74118. rts
  74119. ; ===========================================================================
  74120.  
  74121. loc_39A1C:
  74122. lea (off_39DE2).l,a1
  74123. bsr.w AnimateSprite_Checked
  74124. bne.s loc_39A2A
  74125. rts
  74126. ; ===========================================================================
  74127.  
  74128. loc_39A2A:
  74129. addq.b #2,routine_secondary(a0)
  74130. move.b #$20,objoff_2A(a0)
  74131. move.b #4,anim(a0)
  74132. moveq #SndID_LaserBeam,d0
  74133. jsrto (PlaySound).l, JmpTo12_PlaySound
  74134. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74135. ; ===========================================================================
  74136.  
  74137. loc_39A44:
  74138. subq.b #1,objoff_2A(a0)
  74139. bmi.s loc_39A56
  74140. lea (off_39DE2).l,a1
  74141. bsr.w AnimateSprite_Checked
  74142. rts
  74143. ; ===========================================================================
  74144.  
  74145. loc_39A56:
  74146. addq.b #2,routine_secondary(a0)
  74147. move.b #$40,objoff_2A(a0)
  74148. move.w #$800,d0
  74149. bra.w loc_39D60
  74150. ; ===========================================================================
  74151.  
  74152. loc_39A68:
  74153. subq.b #1,objoff_2A(a0)
  74154. bmi.s loc_39A7C
  74155. bsr.w loc_39D72
  74156. lea (off_39DE2).l,a1
  74157. bra.w AnimateSprite_Checked
  74158. ; ===========================================================================
  74159.  
  74160. loc_39A7C:
  74161. addq.b #2,routine_secondary(a0)
  74162. move.b #5,anim(a0)
  74163. bchg #0,render_flags(a0)
  74164. clr.w x_vel(a0)
  74165. clr.w y_vel(a0)
  74166. rts
  74167. ; ===========================================================================
  74168.  
  74169. loc_39A96:
  74170. lea (off_39DE2).l,a1
  74171. bsr.w AnimateSprite_Checked
  74172. bne.w BranchTo_loc_399D6
  74173. rts
  74174. ; ===========================================================================
  74175.  
  74176. BranchTo_loc_399D6
  74177. bra.w loc_399D6
  74178. ; ===========================================================================
  74179.  
  74180. loc_39AAA:
  74181. subq.b #1,objoff_2A(a0)
  74182. bmi.s loc_39ABC
  74183. lea (off_39DE2).l,a1
  74184. bsr.w AnimateSprite_Checked
  74185. rts
  74186. ; ===========================================================================
  74187.  
  74188. loc_39ABC:
  74189. addq.b #2,routine_secondary(a0)
  74190. move.b #$40,objoff_2A(a0)
  74191. move.w #$400,d0
  74192. bra.w loc_39D60
  74193. ; ===========================================================================
  74194.  
  74195. loc_39ACE:
  74196. subq.b #1,objoff_2A(a0)
  74197. cmpi.b #$3C,objoff_2A(a0)
  74198. bne.s loc_39ADE
  74199. bsr.w loc_39AE8
  74200.  
  74201. loc_39ADE:
  74202. lea (off_39DE2).l,a1
  74203. bra.w AnimateSprite_Checked
  74204. ; ===========================================================================
  74205.  
  74206. loc_39AE8:
  74207. addq.b #2,routine_secondary(a0)
  74208. move.w #-$600,y_vel(a0)
  74209. rts
  74210. ; ===========================================================================
  74211.  
  74212. loc_39AF4:
  74213. subq.b #1,objoff_2A(a0)
  74214. bmi.w loc_39A7C
  74215. jsr (ObjCheckFloorDist).l
  74216. tst.w d1
  74217. bpl.s loc_39B0A
  74218. bsr.w loc_39B1A
  74219.  
  74220. loc_39B0A:
  74221. addi.w #$38,y_vel(a0)
  74222. lea (off_39DE2).l,a1
  74223. bra.w AnimateSprite_Checked
  74224. ; ===========================================================================
  74225.  
  74226. loc_39B1A:
  74227. addq.b #2,routine_secondary(a0)
  74228. add.w d1,y_pos(a0)
  74229. clr.w y_vel(a0)
  74230. rts
  74231. ; ===========================================================================
  74232.  
  74233. loc_39B28:
  74234. subq.b #1,objoff_2A(a0)
  74235. bmi.w loc_39A7C
  74236. jsr (ObjCheckFloorDist).l
  74237. add.w d1,y_pos(a0)
  74238. lea (off_39DE2).l,a1
  74239. bra.w AnimateSprite_Checked
  74240. ; ===========================================================================
  74241.  
  74242. loc_39B44:
  74243. subq.b #1,objoff_2A(a0)
  74244. bmi.w loc_39A7C
  74245. tst.b objoff_2E(a0)
  74246. bne.s loc_39B66
  74247. tst.w y_vel(a0)
  74248. bmi.s loc_39B66
  74249. st objoff_2E(a0)
  74250. bsr.w loc_39D82
  74251. moveq #SndID_SpikeSwitch,d0
  74252. jsrto (PlaySound).l, JmpTo12_PlaySound
  74253.  
  74254. loc_39B66:
  74255. jsr (ObjCheckFloorDist).l
  74256. tst.w d1
  74257. bpl.s loc_39B74
  74258. bsr.w loc_39B84
  74259.  
  74260. loc_39B74:
  74261. addi.w #$38,y_vel(a0)
  74262. lea (off_39DE2).l,a1
  74263. bra.w AnimateSprite_Checked
  74264. ; ===========================================================================
  74265.  
  74266. loc_39B84:
  74267. addq.b #2,routine_secondary(a0)
  74268. add.w d1,y_pos(a0)
  74269. clr.w y_vel(a0)
  74270. rts
  74271. ; ===========================================================================
  74272.  
  74273. loc_39B92:
  74274. clr.b collision_flags(a0)
  74275. subq.w #1,objoff_32(a0)
  74276. bmi.s loc_39BA4
  74277. jsrto (Boss_LoadExplosion).l, JmpTo_Boss_LoadExplosion
  74278. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74279. ; ===========================================================================
  74280.  
  74281. loc_39BA4:
  74282. move.w #$1000,(Camera_Max_X_pos).w
  74283. addq.b #2,(Dynamic_Resize_Routine).w
  74284. move.b (Level_Music).w,d0
  74285. jsrto (PlayMusic).l, JmpTo5_PlayMusic
  74286. bra.w JmpTo65_DeleteObject
  74287. ; ===========================================================================
  74288.  
  74289. loc_39BBA:
  74290. bsr.w LoadSubObject
  74291. move.b #8,width_pixels(a0)
  74292. move.b #0,collision_flags(a0)
  74293. rts
  74294. ; ===========================================================================
  74295.  
  74296. loc_39BCC:
  74297. movea.w objoff_2C(a0),a1 ; a1=object
  74298. bsr.w loc_367AA
  74299. lea (off_39E30).l,a1
  74300. bsr.w AnimateSprite_Checked
  74301. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74302. ; ===========================================================================
  74303.  
  74304. loc_39BE2:
  74305. andi.b #$7F,render_flags(a0)
  74306. rts
  74307. ; ===========================================================================
  74308.  
  74309. loc_39BEA:
  74310. bsr.w LoadSubObject
  74311. move.b #8,width_pixels(a0)
  74312. move.b #$B,mapping_frame(a0)
  74313. move.b #3,priority(a0)
  74314. rts
  74315. ; ===========================================================================
  74316.  
  74317. loc_39C02:
  74318. move.b #0,collision_flags(a0)
  74319. rts
  74320. ; ===========================================================================
  74321.  
  74322. loc_39C0A:
  74323. move.b #$98,collision_flags(a0)
  74324. rts
  74325. ; ===========================================================================
  74326.  
  74327. loc_39C12:
  74328. bsr.w LoadSubObject
  74329. move.b #4,mapping_frame(a0)
  74330. move.w #$2C0,x_pos(a0)
  74331. move.w #$139,y_pos(a0)
  74332. rts
  74333. ; ===========================================================================
  74334.  
  74335. loc_39C2A:
  74336. movea.w objoff_2C(a0),a1 ; a1=object
  74337. bclr #1,status(a1)
  74338. bne.s loc_39C3A
  74339. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74340. ; ===========================================================================
  74341.  
  74342. loc_39C3A:
  74343. addq.b #2,routine(a0)
  74344. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74345. ; ===========================================================================
  74346.  
  74347. loc_39C42:
  74348. lea (Ani_objAF_c).l,a1
  74349. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  74350. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74351. ; ===========================================================================
  74352.  
  74353. loc_39C50:
  74354. movea.w objoff_2C(a0),a1 ; a1=object
  74355. lea (MainCharacter).w,a2 ; a2=character
  74356. btst #2,status(a1)
  74357. bne.s loc_39C92
  74358. move.b #2,anim(a0)
  74359. cmpi.b #4,routine(a2)
  74360. bne.s loc_39C78
  74361. move.b #3,anim(a0)
  74362. bra.w loc_39C84
  74363. ; ===========================================================================
  74364.  
  74365. loc_39C78:
  74366. tst.b collision_flags(a1)
  74367. bne.s loc_39C84
  74368. move.b #4,anim(a0)
  74369.  
  74370. loc_39C84:
  74371. lea (Ani_objAF_c).l,a1
  74372. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  74373. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74374. ; ===========================================================================
  74375.  
  74376. loc_39C92:
  74377. addq.b #2,routine(a0)
  74378. move.b #1,anim(a0)
  74379. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74380. ; ===========================================================================
  74381.  
  74382. loc_39CA0:
  74383. lea (Ani_objAF_c).l,a1
  74384. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  74385. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  74386. ; ===========================================================================
  74387.  
  74388. loc_39CAE:
  74389. tst.b collision_property(a0)
  74390. beq.s loc_39CF0
  74391. tst.b collision_flags(a0)
  74392. bne.s return_39CEE
  74393. tst.b objoff_30(a0)
  74394. bne.s loc_39CD0
  74395. move.b #$20,objoff_30(a0)
  74396. move.w #SndID_BossHit,d0
  74397. jsr (PlaySound).l
  74398.  
  74399. loc_39CD0:
  74400. lea (Normal_palette_line2+2).w,a1
  74401. moveq #0,d0
  74402. tst.w (a1)
  74403. bne.s loc_39CDE
  74404. move.w #$EEE,d0
  74405.  
  74406. loc_39CDE:
  74407. move.w d0,(a1)
  74408. subq.b #1,objoff_30(a0)
  74409. bne.s return_39CEE
  74410. clr.w (Normal_palette_line2+2).w
  74411. bsr.w loc_39D24
  74412.  
  74413. return_39CEE:
  74414. rts
  74415. ; ===========================================================================
  74416.  
  74417. loc_39CF0:
  74418. moveq #100,d0
  74419. bsr.w AddPoints
  74420. move.w #$FF,objoff_32(a0)
  74421. move.b #$C,routine(a0)
  74422. clr.b collision_flags(a0)
  74423. bset #2,status(a0)
  74424. movea.w objoff_3C(a0),a1 ; a1=object
  74425. jsrto (DeleteObject2).l, JmpTo6_DeleteObject2
  74426. movea.w parent(a0),a1 ; a1=object
  74427. jmpto (DeleteObject2).l, JmpTo6_DeleteObject2
  74428. ; ===========================================================================
  74429.  
  74430. loc_39D1C:
  74431. tst.b collision_flags(a0)
  74432. beq.w return_37A48
  74433.  
  74434. loc_39D24:
  74435. move.b mapping_frame(a0),d0
  74436. cmpi.b #6,d0
  74437. beq.s loc_39D42
  74438. cmpi.b #7,d0
  74439. beq.s loc_39D42
  74440. cmpi.b #8,d0
  74441. beq.s loc_39D42
  74442. move.b #$1A,collision_flags(a0)
  74443. rts
  74444. ; ===========================================================================
  74445.  
  74446. loc_39D42:
  74447. move.b #$9A,collision_flags(a0)
  74448. rts
  74449. ; ===========================================================================
  74450.  
  74451. loc_39D4A:
  74452. moveq #$C,d0
  74453. moveq #-$C,d1
  74454. btst #0,render_flags(a0)
  74455. beq.s loc_39D58
  74456. neg.w d0
  74457.  
  74458. loc_39D58:
  74459. movea.w objoff_3C(a0),a1 ; a1=object
  74460. bra.w Obj_AlignChildXY
  74461. ; ===========================================================================
  74462.  
  74463. loc_39D60:
  74464. tst.b objoff_2D(a0)
  74465. bne.s loc_39D68
  74466. neg.w d0
  74467.  
  74468. loc_39D68:
  74469. not.b objoff_2D(a0)
  74470. move.w d0,x_vel(a0)
  74471. rts
  74472. ; ===========================================================================
  74473.  
  74474. loc_39D72:
  74475. moveq #$20,d0
  74476. tst.w x_vel(a0)
  74477. bmi.s loc_39D7C
  74478. neg.w d0
  74479.  
  74480. loc_39D7C:
  74481. add.w d0,x_vel(a0)
  74482. rts
  74483. ; ===========================================================================
  74484.  
  74485. loc_39D82:
  74486. move.b #$4A,d2
  74487. moveq #7,d6
  74488. lea (byte_39D92).l,a2
  74489. bra.w Obj_CreateProjectiles
  74490. ; ===========================================================================
  74491. byte_39D92:
  74492. dc.b 0,$E8, 0,$FD, $F, 0,$F0,$F0,$FE,$FE,$10, 0,$E8, 0,$FD, 0
  74493. dc.b $11, 0,$F0,$10,$FE, 2,$12, 0, 0,$18, 0, 3,$13, 0,$10,$10; 16
  74494. dc.b 2, 2,$14, 0,$18, 0, 3, 0,$15, 0,$10,$F0, 2,$FE,$16, 0; 32
  74495. word_39DC2:
  74496. dc.w objoff_3E
  74497. dc.b ObjID_MechaSonic
  74498. dc.b $48
  74499. word_39DC6:
  74500. dc.w objoff_3C
  74501. dc.b ObjID_MechaSonic
  74502. dc.b $48
  74503. word_39DCA:
  74504. dc.w objoff_3A
  74505. dc.b ObjID_MechaSonic
  74506. dc.b $A4
  74507. ; off_39DCE:
  74508. ObjAF_SubObjData2:
  74509. subObjData ObjAF_Obj98_MapUnc_39E68,make_art_tile(ArtTile_ArtNem_SilverSonic,1,0),4,4,$10,$1A
  74510. ; off_39DD8:
  74511. ObjAF_SubObjData3:
  74512. subObjData ObjAF_MapUnc_3A08C,make_art_tile(ArtTile_ArtNem_DEZWindow,0,0),4,6,$10,0
  74513.  
  74514. ; animation script
  74515. off_39DE2: offsetTable
  74516. offsetTableEntry.w byte_39DEE ; 0
  74517. offsetTableEntry.w byte_39DF4 ; 1
  74518. offsetTableEntry.w byte_39DF8 ; 2
  74519. offsetTableEntry.w byte_39DFE ; 3
  74520. offsetTableEntry.w byte_39E14 ; 4
  74521. offsetTableEntry.w byte_39E1A ; 5
  74522. byte_39DEE:
  74523. dc.b 2, 0, 1, 2,$FF, 0
  74524. byte_39DF4:
  74525. dc.b $45, 3,$FD, 0
  74526. byte_39DF8:
  74527. dc.b 3, 4, 5, 4, 3,$FC
  74528. byte_39DFE:
  74529. dc.b 3, 3, 3, 6, 6, 6, 7, 7, 7, 8, 8, 8, 6, 6, 7, 7
  74530. dc.b 8, 8, 6, 7, 8,$FC; 16
  74531. byte_39E14:
  74532. dc.b 2, 6, 7, 8,$FF, 0
  74533. byte_39E1A:
  74534. dc.b 3, 8, 7, 6, 8, 8, 7, 7, 6, 6, 8, 8, 8, 7, 7, 7
  74535. dc.b 6, 6, 6, 3, 3,$FC; 16
  74536. even
  74537.  
  74538. ; animation script
  74539. off_39E30: offsetTable
  74540. offsetTableEntry.w byte_39E36 ; 0
  74541. offsetTableEntry.w byte_39E3A ; 1
  74542. offsetTableEntry.w byte_39E3E ; 2
  74543. byte_39E36:
  74544. dc.b 1, $B, $C,$FF
  74545. byte_39E3A:
  74546. dc.b 1, $D, $E,$FF
  74547. byte_39E3E:
  74548. dc.b 1, 9, $A,$FF
  74549. even
  74550.  
  74551. ; animation script
  74552. ; off_39E42:
  74553. Ani_objAF_c: offsetTable
  74554. offsetTableEntry.w byte_39E4C ; 0
  74555. offsetTableEntry.w byte_39E54 ; 1
  74556. offsetTableEntry.w byte_39E5C ; 2
  74557. offsetTableEntry.w byte_39E60 ; 3
  74558. offsetTableEntry.w byte_39E64 ; 4
  74559. byte_39E4C: dc.b 3, 4, 3, 2, 1, 0,$FC, 0
  74560. byte_39E54: dc.b 3, 0, 1, 2, 3, 4,$FA, 0
  74561. byte_39E5C: dc.b 3, 5, 5,$FF
  74562. byte_39E60: dc.b 3, 5, 6,$FF
  74563. byte_39E64: dc.b 3, 7, 7,$FF
  74564. even
  74565. ; ----------------------------------------------------------------------------
  74566. ; sprite mappings
  74567. ; ----------------------------------------------------------------------------
  74568. ObjAF_Obj98_MapUnc_39E68: BINCLUDE "mappings/sprite/objAF_a.bin"
  74569. ; ----------------------------------------------------------------------------
  74570. ; sprite mappings
  74571. ; ----------------------------------------------------------------------------
  74572. ObjAF_MapUnc_3A08C: BINCLUDE "mappings/sprite/objAF_b.bin"
  74573.  
  74574.  
  74575.  
  74576.  
  74577. ; ===========================================================================
  74578. ; ----------------------------------------------------------------------------
  74579. ; Object B0 - Sonic on the Sega screen
  74580. ; ----------------------------------------------------------------------------
  74581. ; Sprite_3A1DC:
  74582. ObjB0:
  74583. moveq #0,d0
  74584. move.b routine(a0),d0
  74585. move.w ObjB0_Index(pc,d0.w),d1
  74586. jmp ObjB0_Index(pc,d1.w)
  74587. ; ===========================================================================
  74588. ; off_3A1EA:
  74589. ObjB0_Index: offsetTable
  74590. offsetTableEntry.w ObjB0_Init ; 0
  74591. offsetTableEntry.w ObjB0_RunLeft ; 2
  74592. offsetTableEntry.w ObjB0_MidWipe ; 4
  74593. offsetTableEntry.w ObjB0_RunRight ; 6
  74594. offsetTableEntry.w ObjB0_EndWipe ; 8
  74595. offsetTableEntry.w return_3A3F6 ; $A
  74596. ; ===========================================================================
  74597.  
  74598. ObjB0_Init:
  74599. bsr.w LoadSubObject
  74600. move.w #$1E8,x_pixel(a0)
  74601. move.w #$F0,y_pixel(a0)
  74602. move.w #$B,objoff_2A(a0)
  74603. move.w #2,(SegaScr_VInt_Subrout).w
  74604. bset #0,render_flags(a0)
  74605. bset #0,status(a0)
  74606.  
  74607. ; Initialize streak horizontal offsets for Sonic going left.
  74608. ; 9 full lines (8 pixels) + 6 pixels, 2-byte interleaved entries for PNT A and PNT B
  74609. lea (Horiz_Scroll_Buf + 2 * 2 * (9 * 8 + 6)).w,a1
  74610. lea Streak_Horizontal_offsets(pc),a2
  74611. moveq #0,d0
  74612. moveq #$22,d6 ; Number of streaks-1
  74613. - move.b (a2)+,d0
  74614. add.w d0,(a1)
  74615. addq.w #2 * 2 * 2,a1 ; Advance to next streak 2 pixels down
  74616. dbf d6,-
  74617.  
  74618. lea off_3A294(pc),a1 ; pointers to mapping DPLC data
  74619. lea (ArtUnc_Sonic).l,a3
  74620. lea (Chunk_Table).l,a5
  74621. moveq #4-1,d5 ; there are 4 mapping frames to loop over
  74622.  
  74623. ; this copies the tiles that we want to scale up from ROM to RAM
  74624. ;loc_3A246:
  74625. ;CopySpriteTilesToRAMForSegaScreen:
  74626. - movea.l (a1)+,a2
  74627. move.w (a2)+,d6 ; get the number of pieces in this mapping frame
  74628. subq.w #1,d6
  74629. - move.w (a2)+,d0
  74630. move.w d0,d1
  74631. ; Depending on the exact location (and size) of the art being used,
  74632. ; you may encounter an overflow in the original code which garbles
  74633. ; the enlarged Sonic. The following code fixes this:
  74634. if 1==0
  74635. andi.l #$FFF,d0
  74636. lsl.l #5,d0
  74637. lea (a3,d0.l),a4 ; source ROM address of tiles to copy
  74638. else
  74639. andi.w #$FFF,d0
  74640. lsl.w #5,d0
  74641. lea (a3,d0.w),a4 ; source ROM address of tiles to copy
  74642. endif
  74643. andi.w #$F000,d1 ; abcd000000000000
  74644. rol.w #4,d1 ; (this calculation can be done smaller and faster
  74645. addq.w #1,d1 ; by doing rol.w #7,d1 addq.w #7,d1
  74646. lsl.w #3,d1 ; instead of these 4 lines)
  74647. subq.w #1,d1 ; 000000000abcd111 ; number of dwords to copy minus 1
  74648. - move.l (a4)+,(a5)+
  74649. dbf d1,- ; copy all of the pixels in this piece into the temp buffer
  74650. dbf d6,-- ; loop per piece in the frame
  74651. dbf d5,--- ; loop per mapping frame
  74652.  
  74653. ; this scales up the tiles by 2
  74654. ;ScaleUpSpriteTiles:
  74655. move.w d7,-(sp)
  74656. moveq #0,d0
  74657. moveq #0,d1
  74658. lea SonicRunningSpriteScaleData(pc),a6
  74659. moveq #4*2-1,d7 ; there are 4 sprite mapping frames with 2 pieces each
  74660. - movea.l (a6)+,a1 ; source in RAM of tile graphics to enlarge
  74661. movea.l (a6)+,a2 ; destination in RAM of enlarged graphics
  74662. move.b (a6)+,d0 ; width of the sprite piece to enlarge (minus 1)
  74663. move.b (a6)+,d1 ; height of the sprite piece to enlarge (minus 1)
  74664. bsr.w Scale_2x
  74665. dbf d7,- ; loop over each piece
  74666. move.w (sp)+,d7
  74667.  
  74668. rts
  74669. ; ===========================================================================
  74670. ; These next four things are pointers to Sonic's dereferenced
  74671. ; DPLC entries of his "running animation" frames for the SEGA screen.
  74672. ; I want that DPLC data split into a binary file for use with editors,
  74673. ; but unfortunately there's no way to refer to BINCLUDE'd bytes
  74674. ; from within AS, so I put an educated guess (default) here and
  74675. ; run an external program (fixpointer.exe) to fix it later.
  74676. ; WARNING: the build script needs editing if you rename this label
  74677. off_3A294:
  74678. dc.l (MapRUnc_Sonic+$33A) ;dc.l word_7181A
  74679. dc.l (MapRUnc_Sonic+$340) ;dc.l word_71820
  74680. dc.l (MapRUnc_Sonic+$346) ;dc.l word_71826
  74681. dc.l (MapRUnc_Sonic+$34C) ;dc.l word_7182C
  74682.  
  74683. map_piece macro width,height
  74684. dc.l copysrc,copydst
  74685. dc.b width-1,height-1
  74686. copysrc := copysrc + tiles_to_bytes(width * height)
  74687. copydst := copydst + tiles_to_bytes(width * height) * 2 * 2
  74688. endm
  74689. ;word_3A2A4:
  74690. SonicRunningSpriteScaleData:
  74691. copysrc := Chunk_Table
  74692. copydst := Chunk_Table + $B00
  74693. SegaScreenScaledSpriteDataStart = copydst
  74694. rept 4 ; repeat 4 times since there are 4 frames to scale up
  74695. ; piece 1 of each frame (the smaller top piece):
  74696. map_piece 3,2
  74697. ; piece 2 of each frame (the larger bottom piece):
  74698. map_piece 4,4
  74699. endm
  74700. SegaScreenScaledSpriteDataEnd = copydst
  74701. if copysrc > SegaScreenScaledSpriteDataStart
  74702. fatal "Scale copy source overran allocated size. Try changing the initial value of copydst to Chunk_Table+$\{copysrc-Chunk_Table}"
  74703. endif
  74704. ; ===========================================================================
  74705.  
  74706. ObjB0_RunLeft:
  74707. subi.w #$20,x_pos(a0)
  74708. subq.w #1,objoff_2A(a0)
  74709. bmi.s loc_3A312
  74710. bsr.w ObjB0_Move_Streaks_Left
  74711. lea (Ani_objB0).l,a1
  74712. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  74713. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74714. ; ===========================================================================
  74715.  
  74716. loc_3A312:
  74717. addq.b #2,routine(a0)
  74718. move.w #$C,objoff_2A(a0)
  74719. move.b #1,objoff_2C(a0)
  74720. move.b #-1,objoff_2D(a0)
  74721. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74722. ; ===========================================================================
  74723.  
  74724. ObjB0_MidWipe:
  74725. tst.w objoff_2A(a0)
  74726. beq.s loc_3A33A
  74727. subq.w #1,objoff_2A(a0)
  74728. bsr.w ObjB0_Move_Streaks_Left
  74729.  
  74730. loc_3A33A:
  74731. lea word_3A49E(pc),a1
  74732. bsr.w loc_3A44E
  74733. bne.s loc_3A346
  74734. rts
  74735. ; ===========================================================================
  74736.  
  74737. loc_3A346:
  74738. addq.b #2,routine(a0)
  74739. bchg #0,render_flags(a0)
  74740. move.w #$B,objoff_2A(a0)
  74741. move.w #4,(SegaScr_VInt_Subrout).w
  74742. subi.w #$28,x_pos(a0)
  74743. bchg #0,render_flags(a0)
  74744. bchg #0,status(a0)
  74745.  
  74746. ; This clears a lot more than the horizontal scroll buffer, which is $400 bytes.
  74747. ; This is because the loop counter is erroneously set to $400, instead of ($400/4)-1.
  74748. clearRAM Horiz_Scroll_Buf,Horiz_Scroll_Buf_End+$C04 ; Bug: That '+$C04' shouldn't be there; accidentally clears an additional $C04 bytes
  74749.  
  74750. ; Initialize streak horizontal offsets for Sonic going right.
  74751. ; 9 full lines (8 pixels) + 7 pixels, 2-byte interleaved entries for PNT A and PNT B
  74752. lea (Horiz_Scroll_Buf + 2 * 2 * (9 * 8 + 7)).w,a1
  74753. lea Streak_Horizontal_offsets(pc),a2
  74754. moveq #0,d0
  74755. moveq #$22,d6 ; Number of streaks-1
  74756.  
  74757. loc_3A38A:
  74758. move.b (a2)+,d0
  74759. sub.w d0,(a1)
  74760. addq.w #2 * 2 * 2,a1 ; Advance to next streak 2 pixels down
  74761. dbf d6,loc_3A38A
  74762. rts
  74763. ; ===========================================================================
  74764.  
  74765. ObjB0_RunRight:
  74766. subq.w #1,objoff_2A(a0)
  74767. bmi.s loc_3A3B4
  74768. addi.w #$20,x_pos(a0)
  74769. bsr.w ObjB0_Move_Streaks_Right
  74770. lea (Ani_objB0).l,a1
  74771. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  74772. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74773. ; ===========================================================================
  74774.  
  74775. loc_3A3B4:
  74776. addq.b #2,routine(a0)
  74777. move.w #$C,objoff_2A(a0)
  74778. move.b #1,objoff_2C(a0)
  74779. move.b #-1,objoff_2D(a0)
  74780. rts
  74781. ; ===========================================================================
  74782.  
  74783. ObjB0_EndWipe:
  74784. tst.w objoff_2A(a0)
  74785. beq.s loc_3A3DA
  74786. subq.w #1,objoff_2A(a0)
  74787. bsr.w ObjB0_Move_Streaks_Right
  74788.  
  74789. loc_3A3DA:
  74790. lea word_3A514(pc),a1
  74791. bsr.w loc_3A44E
  74792. bne.s loc_3A3E6
  74793. rts
  74794. ; ===========================================================================
  74795.  
  74796. loc_3A3E6:
  74797. addq.b #2,routine(a0)
  74798. st (SegaScr_PalDone_Flag).w
  74799. move.b #SndID_SegaSound,d0
  74800. jsrto (PlaySound).l, JmpTo12_PlaySound
  74801.  
  74802. return_3A3F6:
  74803. rts
  74804. ; ===========================================================================
  74805. ; ----------------------------------------------------------------------------
  74806. ; Object B1 - Object that hides TM symbol on JP region
  74807. ; ----------------------------------------------------------------------------
  74808. ; Sprite_3A3F8:
  74809. ObjB1:
  74810. moveq #0,d0
  74811. move.b routine(a0),d0
  74812. move.w ObjB1_Index(pc,d0.w),d1
  74813. jmp ObjB1_Index(pc,d1.w)
  74814. ; ===========================================================================
  74815. ; off_3A406:
  74816. ObjB1_Index: offsetTable
  74817. offsetTableEntry.w ObjB1_Init ; 0
  74818. offsetTableEntry.w ObjB1_Main ; 2
  74819. ; ===========================================================================
  74820. ; loc_3A40A:
  74821. ObjB1_Init:
  74822. bsr.w LoadSubObject
  74823. move.b #4,mapping_frame(a0)
  74824. move.w #$174,x_pixel(a0)
  74825. move.w #$D8,y_pixel(a0)
  74826. rts
  74827. ; ===========================================================================
  74828. ; BranchTo4_JmpTo45_DisplaySprite
  74829. ObjB1_Main:
  74830. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  74831. ; ===========================================================================
  74832.  
  74833. ObjB0_Move_Streaks_Left:
  74834. ; 9 full lines (8 pixels) + 6 pixels, 2-byte interleaved entries for PNT A and PNT B
  74835. lea (Horiz_Scroll_Buf + 2 * 2 * (9 * 8 + 6)).w,a1
  74836.  
  74837. move.w #$22,d6 ; Number of streaks-1
  74838. - subi.w #$20,(a1)
  74839. addq.w #2 * 2 * 2,a1 ; Advance to next streak 2 pixels down
  74840. dbf d6,-
  74841. rts
  74842. ; ===========================================================================
  74843.  
  74844. ObjB0_Move_Streaks_Right:
  74845. ; 9 full lines (8 pixels) + 7 pixels, 2-byte interleaved entries for PNT A and PNT B
  74846. lea (Horiz_Scroll_Buf + 2 * 2 * (9 * 8 + 7)).w,a1
  74847.  
  74848. move.w #$22,d6 ; Number of streaks-1
  74849. - addi.w #$20,(a1)
  74850. addq.w #2 * 2 * 2,a1 ; Advance to next streak 2 pixels down
  74851. dbf d6,-
  74852. rts
  74853. ; ===========================================================================
  74854.  
  74855. loc_3A44E:
  74856. subq.b #1,objoff_2C(a0)
  74857. bne.s loc_3A496
  74858. moveq #0,d0
  74859. move.b objoff_2D(a0),d0
  74860. addq.b #1,d0
  74861. cmp.b 1(a1),d0
  74862. blo.s loc_3A468
  74863. tst.b 3(a1)
  74864. bne.s loc_3A49A
  74865.  
  74866. loc_3A468:
  74867. move.b d0,objoff_2D(a0)
  74868. _move.b 0(a1),objoff_2C(a0)
  74869. lea 6(a1),a2 ; This loads a palette: Sega Screen 2.bin or Sega Screen 3.bin
  74870. moveq #0,d1
  74871. move.b 2(a1),d1
  74872. move.w d1,d2
  74873. tst.w d0
  74874. beq.s loc_3A48C
  74875.  
  74876. loc_3A482:
  74877. subq.b #1,d0
  74878. beq.s loc_3A48A
  74879. add.w d2,d1
  74880. bra.s loc_3A482
  74881. ; ===========================================================================
  74882.  
  74883. loc_3A48A:
  74884. adda.w d1,a2
  74885.  
  74886. loc_3A48C:
  74887. movea.w 4(a1),a3
  74888.  
  74889. loc_3A490:
  74890. move.w (a2)+,(a3)+
  74891. subq.w #2,d2
  74892. bne.s loc_3A490
  74893.  
  74894. loc_3A496:
  74895. moveq #0,d0
  74896. rts
  74897. ; ===========================================================================
  74898.  
  74899. loc_3A49A:
  74900. moveq #1,d0
  74901. rts
  74902. ; ===========================================================================
  74903.  
  74904. ; probably some sort of description of how to use the following palette
  74905. word_3A49E:
  74906. dc.b 4 ; 0 ; How many frames before each iteration
  74907. dc.b 7 ; 1 ; How many iterations
  74908. dc.b $10 ; 2 ; Number of colors * 2 to skip each iteration
  74909. dc.b $FF ; 3 ; Some sort of flag
  74910. dc.w Normal_palette+$10 ; 4 ; First target palette entry
  74911.  
  74912. ; Palette for the SEGA screen (background and pre-wipe foreground) (7 frames)
  74913. ;pal_3A4A4:
  74914. BINCLUDE "art/palettes/Sega Screen 2.bin"
  74915.  
  74916.  
  74917. ; probably some sort of description of how to use the following palette
  74918. word_3A514:
  74919. dc.b 4 ; 0 ; How many frames before each iteration
  74920. dc.b 7 ; 1 ; How many iterations
  74921. dc.b $10 ; 2 ; Number of colors * 2 to skip each iteration
  74922. dc.b $FF ; 3 ; Some sort of flag
  74923. dc.w Normal_palette ; 4 ; First target palette entry
  74924.  
  74925. ; Palette for the SEGA screen (wiping and post-wipe foreground) (7 frames)
  74926. ;pal_3A51A:
  74927. BINCLUDE "art/palettes/Sega Screen 3.bin"
  74928.  
  74929. ; off_3A58A:
  74930. ObjB0_SubObjData:
  74931. subObjData ObjB1_MapUnc_3A5A6,make_art_tile(ArtTile_ArtUnc_Giant_Sonic,2,1),0,1,$10,0
  74932.  
  74933. ; off_3A594:
  74934. ObjB1_SubObjData:
  74935. subObjData ObjB1_MapUnc_3A5A6,make_art_tile(ArtTile_ArtNem_Sega_Logo+2,0,0),0,2,8,0
  74936.  
  74937. ; animation script
  74938. ; off_3A59E:
  74939. Ani_objB0: offsetTable
  74940. offsetTableEntry.w + ; 0
  74941. + dc.b 0, 0, 1, 2, 3,$FF
  74942. even
  74943.  
  74944. ; ------------------------------------------------------------------------------
  74945. ; sprite mappings
  74946. ; Gigantic Sonic (2x size) mappings for the SEGA screen
  74947. ; also has the "trademark hider" mappings
  74948. ; ------------------------------------------------------------------------------
  74949. ObjB1_MapUnc_3A5A6: BINCLUDE "mappings/sprite/objB1.bin"
  74950. ; ===========================================================================
  74951. ;loc_3A68A
  74952. SegaScr_VInt:
  74953. move.w (SegaScr_VInt_Subrout).w,d0
  74954. beq.w return_37A48
  74955. clr.w (SegaScr_VInt_Subrout).w
  74956. move.w off_3A69E-2(pc,d0.w),d0
  74957. jmp off_3A69E(pc,d0.w)
  74958. ; ===========================================================================
  74959. off_3A69E: offsetTable
  74960. offsetTableEntry.w loc_3A6A2 ; 0
  74961. offsetTableEntry.w loc_3A6D4 ; 2
  74962. ; ===========================================================================
  74963.  
  74964. loc_3A6A2:
  74965. dma68kToVDP SegaScreenScaledSpriteDataStart,tiles_to_bytes(ArtTile_ArtUnc_Giant_Sonic),\
  74966. SegaScreenScaledSpriteDataEnd-SegaScreenScaledSpriteDataStart,VRAM
  74967.  
  74968. lea ObjB1_Streak_fade_to_right(pc),a1
  74969. ; 9 full lines ($100 bytes each) plus $28 8-pixel cells
  74970. move.l #vdpComm(VRAM_SegaScr_Plane_A_Name_Table + planeLocH80($28,9),VRAM,WRITE),d0 ; $49500003
  74971. bra.w loc_3A710
  74972. ; ===========================================================================
  74973.  
  74974. loc_3A6D4:
  74975. dmaFillVRAM 0,VRAM_SegaScr_Plane_A_Name_Table,VRAM_SegaScr_Plane_Table_Size ; clear Plane A pattern name table
  74976.  
  74977. lea ObjB1_Streak_fade_to_left(pc),a1
  74978. ; $49A00003; 9 full lines ($100 bytes each) plus $50 8-pixel cells
  74979. move.l #vdpComm(VRAM_SegaScr_Plane_A_Name_Table + planeLocH80($50,9),VRAM,WRITE),d0
  74980. bra.w loc_3A710
  74981. loc_3A710:
  74982. lea (VDP_data_port).l,a6
  74983. ; This is the line delta; for each line, the code below
  74984. ; writes $30 entries, leaving $50 untouched.
  74985. move.l #vdpCommDelta(planeLocH80(0,1)),d6 ; $1000000
  74986. moveq #7,d1 ; Inner loop: repeat 8 times
  74987. moveq #9,d2 ; Outer loop: repeat $A times
  74988. -
  74989. move.l d0,4(a6) ; Send command to VDP: set address to write to
  74990. move.w d1,d3 ; Reset inner loop counter
  74991. movea.l a1,a2 ; Reset data pointer
  74992. -
  74993. move.w (a2)+,d4 ; Read one pattern name table entry
  74994. bclr #$A,d4 ; Test bit $A and clear (flag for end of line)
  74995. beq.s + ; Branch if bit was clear
  74996. bsr.w loc_3A742 ; Fill rest of line with this set of pixels
  74997. +
  74998. move.w d4,(a6) ; Write PNT entry
  74999. dbf d3,-
  75000. add.l d6,d0 ; Point to the next VRAM area to be written to
  75001. dbf d2,--
  75002. rts
  75003. ; ===========================================================================
  75004.  
  75005. loc_3A742:
  75006. moveq #$28,d5 ; Fill next $29 entries...
  75007. -
  75008. move.w d4,(a6) ; ... using the PNT entry that had bit $A set
  75009. dbf d5,-
  75010. rts
  75011. ; ===========================================================================
  75012. ; Pattern A name table entries, with special flag detailed below
  75013. ; These are used for the streaks, and point to VRAM in the $1000-$10FF range
  75014. ObjB1_Streak_fade_to_right:
  75015. dc.w make_block_tile(ArtTile_ArtNem_Trails+0,0,0,1,1) ; 0
  75016. dc.w make_block_tile(ArtTile_ArtNem_Trails+1,0,0,1,1) ; 2
  75017. dc.w make_block_tile(ArtTile_ArtNem_Trails+2,0,0,1,1) ; 4
  75018. dc.w make_block_tile(ArtTile_ArtNem_Trails+3,0,0,1,1) ; 6
  75019. dc.w make_block_tile(ArtTile_ArtNem_Trails+4,0,0,1,1) ; 8
  75020. dc.w make_block_tile(ArtTile_ArtNem_Trails+5,0,0,1,1) ; 10
  75021. dc.w make_block_tile(ArtTile_ArtNem_Trails+6,0,0,1,1) ; 12
  75022. dc.w make_block_tile(ArtTile_ArtNem_Trails+7,0,0,1,1) | (1 << $A) ; 14 ; Bit $A is used as a flag to use this tile $29 times
  75023. ObjB1_Streak_fade_to_left:
  75024. dc.w make_block_tile(ArtTile_ArtNem_Trails+7,0,0,1,1) | (1 << $A) ; 0 ; Bit $A is used as a flag to use this tile $29 times
  75025. dc.w make_block_tile(ArtTile_ArtNem_Trails+6,0,0,1,1) ; 2
  75026. dc.w make_block_tile(ArtTile_ArtNem_Trails+5,0,0,1,1) ; 4
  75027. dc.w make_block_tile(ArtTile_ArtNem_Trails+4,0,0,1,1) ; 6
  75028. dc.w make_block_tile(ArtTile_ArtNem_Trails+3,0,0,1,1) ; 8
  75029. dc.w make_block_tile(ArtTile_ArtNem_Trails+2,0,0,1,1) ; 10
  75030. dc.w make_block_tile(ArtTile_ArtNem_Trails+1,0,0,1,1) ; 12
  75031. dc.w make_block_tile(ArtTile_ArtNem_Trails+0,0,0,1,1) ; 14
  75032. Streak_Horizontal_offsets:
  75033. dc.b $12
  75034. dc.b 4 ; 1
  75035. dc.b 4 ; 2
  75036. dc.b 2 ; 3
  75037. dc.b 2 ; 4
  75038. dc.b 2 ; 5
  75039. dc.b 2 ; 6
  75040. dc.b 0 ; 7
  75041. dc.b 0 ; 8
  75042. dc.b 0 ; 9
  75043. dc.b 0 ; 10
  75044. dc.b 0 ; 11
  75045. dc.b 0 ; 12
  75046. dc.b 0 ; 13
  75047. dc.b 0 ; 14
  75048. dc.b 4 ; 15
  75049. dc.b 4 ; 16
  75050. dc.b 6 ; 17
  75051. dc.b $A ; 18
  75052. dc.b 8 ; 19
  75053. dc.b 6 ; 20
  75054. dc.b 4 ; 21
  75055. dc.b 4 ; 22
  75056. dc.b 4 ; 23
  75057. dc.b 4 ; 24
  75058. dc.b 6 ; 25
  75059. dc.b 6 ; 26
  75060. dc.b 8 ; 27
  75061. dc.b 8 ; 28
  75062. dc.b $A ; 29
  75063. dc.b $A ; 30
  75064. dc.b $C ; 31
  75065. dc.b $E ; 32
  75066. dc.b $10 ; 33
  75067. dc.b $16 ; 34
  75068. dc.b 0 ; 35
  75069.  
  75070.  
  75071.  
  75072.  
  75073. ; ===========================================================================
  75074. ; ----------------------------------------------------------------------------
  75075. ; Object B2 - The Tornado (Tails' plane)
  75076. ; ----------------------------------------------------------------------------
  75077. ; Sprite_3A790:
  75078. ObjB2:
  75079. moveq #0,d0
  75080. move.b routine(a0),d0
  75081. move.w ObjB2_Index(pc,d0.w),d1
  75082. jmp ObjB2_Index(pc,d1.w)
  75083. ; ===========================================================================
  75084. ; off_3A79E:
  75085. ObjB2_Index: offsetTable
  75086. offsetTableEntry.w ObjB2_Init ; 0
  75087. offsetTableEntry.w ObjB2_Main_SCZ ; 2
  75088. offsetTableEntry.w ObjB2_Main_WFZ_Start ; 4
  75089. offsetTableEntry.w ObjB2_Main_WFZ_End ; 6
  75090. offsetTableEntry.w ObjB2_Invisible_grabber ; 8
  75091. offsetTableEntry.w loc_3AD0C ; $A
  75092. offsetTableEntry.w loc_3AD2A ; $C
  75093. offsetTableEntry.w loc_3AD42 ; $E
  75094. ; ===========================================================================
  75095. ; loc_3A7AE:
  75096. ObjB2_Init:
  75097. bsr.w LoadSubObject
  75098. moveq #0,d0
  75099. move.b subtype(a0),d0
  75100. subi.b #$4E,d0
  75101. move.b d0,routine(a0)
  75102. cmpi.w #2,(Player_mode).w
  75103. bne.s +
  75104. cmpi.b #8,d0
  75105. bhs.s +
  75106. move.b #4,mapping_frame(a0)
  75107. move.b #1,anim(a0)
  75108. + ; BranchTo5_JmpTo45_DisplaySprite
  75109. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75110. ; ===========================================================================
  75111. ; loc_3A7DE:
  75112. ObjB2_Main_SCZ:
  75113. bsr.w ObjB2_Animate_Pilot
  75114. tst.w (Debug_placement_mode).w
  75115. bne.w ObjB2_animate
  75116. lea (MainCharacter).w,a1 ; a1=character
  75117. move.w art_tile(a1),d0
  75118. andi.w #high_priority,d0
  75119. move.w art_tile(a0),d1
  75120. andi.w #drawing_mask,d1
  75121. or.w d0,d1
  75122. move.w d1,art_tile(a0)
  75123. move.w x_pos(a0),-(sp)
  75124. bsr.w ObjB2_Move_with_player
  75125. move.b status(a0),objoff_2E(a0)
  75126. move.w #$1B,d1
  75127. move.w #8,d2
  75128. move.w #9,d3
  75129. move.w (sp)+,d4
  75130. jsrto (SolidObject).l, JmpTo27_SolidObject
  75131. bsr.w ObjB2_Move_obbey_player
  75132. move.b objoff_2E(a0),d0
  75133. move.b status(a0),d1
  75134. if gameRevision<2
  75135. andi.b #p1_standing,d0 ; 'on object' bit
  75136. andi.b #p1_standing,d1 ; 'on object' bit
  75137. else
  75138. ; 'fixes' the player being able to spin dash off the Tornado
  75139. andi.b #1,d0 ; 'in air' bit
  75140. andi.b #1,d1 ; 'in air' bit
  75141. endif
  75142. eor.b d0,d1
  75143. move.b d1,objoff_2E(a0)
  75144. lea (MainCharacter).w,a1 ; a1=character
  75145. move.w x_pos(a1),d1
  75146. move.w (Camera_X_pos).w,d0
  75147. move.w d0,(Camera_Min_X_pos).w
  75148. move.w d0,d2
  75149. addi.w #$11,d2
  75150. cmp.w d2,d1
  75151. bhi.s +
  75152. addq.w #1,d1
  75153. move.w d1,x_pos(a1)
  75154. + ; loc_3A85E:
  75155. cmpi.w #$1400,d0
  75156. blo.s loc_3A878
  75157. cmpi.w #$1568,d1
  75158. bhs.s ObjB2_SCZ_Finished
  75159. st (Control_Locked).w
  75160. move.w #(button_right_mask<<8)|button_right_mask,(Ctrl_1_Logical).w
  75161. bra.w loc_3A87C
  75162. ; ===========================================================================
  75163.  
  75164. loc_3A878:
  75165. subi.w #$40,d0
  75166.  
  75167. loc_3A87C:
  75168. move.w d0,(Camera_Max_X_pos).w
  75169. ; loc_3A880:
  75170. ObjB2_animate:
  75171. lea (Ani_objB2_a).l,a1
  75172. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  75173. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75174. ; ===========================================================================
  75175. ; loc_3A88E:
  75176. ObjB2_SCZ_Finished:
  75177. bsr.w ObjB2_Deactivate_level
  75178. move.w #wing_fortress_zone_act_1,(Current_ZoneAndAct).w
  75179. bra.s ObjB2_animate
  75180. ; ===========================================================================
  75181. ; loc_3A89A:
  75182. ObjB2_Main_WFZ_Start:
  75183. bsr.w ObjB2_Animate_Pilot
  75184. moveq #0,d0
  75185. move.b routine_secondary(a0),d0
  75186. move.w off_3A8BA(pc,d0.w),d1
  75187. jsr off_3A8BA(pc,d1.w)
  75188. lea (Ani_objB2_a).l,a1
  75189. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  75190. jmpto (Obj_DeleteOffScreen).l, Obj_DeleteOffScreen
  75191. ; ===========================================================================
  75192. off_3A8BA: offsetTable
  75193. offsetTableEntry.w ObjB2_Main_WFZ_Start_init ; 0
  75194. offsetTableEntry.w ObjB2_Main_WFZ_Start_main ; 2
  75195. offsetTableEntry.w ObjB2_Main_WFZ_Start_shot_down ; 4
  75196. offsetTableEntry.w ObjB2_Main_WFZ_Start_fall_down ; 6
  75197. ; ===========================================================================
  75198. ; loc_3A8C2:
  75199. ObjB2_Main_WFZ_Start_init:
  75200. addq.b #2,routine_secondary(a0)
  75201. move.w #$C0,objoff_32(a0)
  75202. move.w #$100,x_vel(a0)
  75203. rts
  75204. ; ===========================================================================
  75205. ; loc_3A8D4:
  75206. ObjB2_Main_WFZ_Start_main:
  75207. subq.w #1,objoff_32(a0)
  75208. bmi.s +
  75209. move.w x_pos(a0),-(sp)
  75210. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  75211. bsr.w loc_36776
  75212. move.w #$1B,d1
  75213. move.w #8,d2
  75214. move.w #9,d3
  75215. move.w (sp)+,d4
  75216. jsrto (SolidObject).l, JmpTo27_SolidObject
  75217. bra.w ObjB2_Horizontal_limit
  75218. ; ===========================================================================
  75219. + ; loc_3A8FC:
  75220. addq.b #2,routine_secondary(a0)
  75221. move.w #$60,objoff_2A(a0)
  75222. move.w #1,objoff_32(a0)
  75223. move.w #$100,x_vel(a0)
  75224. move.w #$100,y_vel(a0)
  75225. rts
  75226. ; ===========================================================================
  75227. ; loc_3A91A:
  75228. ObjB2_Main_WFZ_Start_shot_down:
  75229. move.b (Vint_runcount+3).w,d0
  75230. andi.b #$1F,d0
  75231. bne.s +
  75232. moveq #SndID_Scatter,d0
  75233. jsrto (PlaySound).l, JmpTo12_PlaySound
  75234. + ; loc_3A92A:
  75235. subq.w #1,objoff_2A(a0)
  75236. bmi.s +
  75237. - ; loc_3A930:
  75238. bsr.w ObjB2_Align_plane
  75239. subq.w #1,objoff_32(a0)
  75240. bne.w return_37A48
  75241. move.w #$E,objoff_32(a0)
  75242. bra.w ObjB2_Main_WFZ_Start_load_smoke
  75243. ; ===========================================================================
  75244. + ; loc_3A946:
  75245. addq.b #2,routine_secondary(a0)
  75246. bra.w loc_3B7BC
  75247. ; ===========================================================================
  75248. ; loc_3A94E:
  75249. ObjB2_Main_WFZ_Start_fall_down:
  75250. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  75251. bra.s -
  75252. ; ===========================================================================
  75253. ; loc_3A954:
  75254. ObjB2_Main_WFZ_End:
  75255. bsr.w ObjB2_Animate_Pilot
  75256. moveq #0,d0
  75257. move.b routine_secondary(a0),d0
  75258. move.w ObjB2_Main_WFZ_states(pc,d0.w),d1
  75259. jsr ObjB2_Main_WFZ_states(pc,d1.w)
  75260. lea (Ani_objB2_a).l,a1
  75261. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  75262. ; ===========================================================================
  75263. ; off_3A970:
  75264. ObjB2_Main_WFZ_states: offsetTable
  75265. offsetTableEntry.w ObjB2_Wait_Leader_position ; 0
  75266. offsetTableEntry.w ObjB2_Move_Leader_edge ; 2
  75267. offsetTableEntry.w ObjB2_Wait_for_plane ; 4
  75268. offsetTableEntry.w ObjB2_Prepare_to_jump ; 6
  75269. offsetTableEntry.w ObjB2_Jump_to_plane ; 8
  75270. offsetTableEntry.w ObjB2_Landed_on_plane ; $A
  75271. offsetTableEntry.w ObjB2_Approaching_ship ; $C
  75272. offsetTableEntry.w ObjB2_Jump_to_ship ; $E
  75273. offsetTableEntry.w ObjB2_Dock_on_DEZ ; $10
  75274. ; ===========================================================================
  75275. ; loc_3A982:
  75276. ObjB2_Wait_Leader_position:
  75277. lea (MainCharacter).w,a1 ; a1=character
  75278. cmpi.w #$5EC,y_pos(a1)
  75279. blo.s + ; rts
  75280. clr.w (Ctrl_1_Logical).w
  75281. addq.w #1,objoff_2E(a0)
  75282. cmpi.w #$40,objoff_2E(a0)
  75283. bhs.s ++
  75284. + ; return_3A99E:
  75285. rts
  75286. ; ===========================================================================
  75287. + ; loc_3A9A0:
  75288. addq.b #2,routine_secondary(a0)
  75289. move.w #$2E58,x_pos(a0)
  75290. move.w #$66C,y_pos(a0)
  75291. lea (MainCharacter).w,a1 ; a1=character
  75292. bsr.w ObjB2_Waiting_animation
  75293. lea (word_3AFBC).l,a2
  75294. bsr.w LoadChildObject
  75295. move.w #$3118,x_pos(a1)
  75296. move.w #$3F0,y_pos(a1)
  75297. lea (word_3AFB8).l,a2
  75298. bsr.w LoadChildObject
  75299. move.w #$3070,x_pos(a1)
  75300. move.w #$3B0,y_pos(a1)
  75301. lea (word_3AFB8).l,a2
  75302. bsr.w LoadChildObject
  75303. move.w #$3070,x_pos(a1)
  75304. move.w #$430,y_pos(a1)
  75305. lea (word_3AFC0).l,a2
  75306. bsr.w LoadChildObject
  75307. clr.w x_pos(a1)
  75308. clr.w y_pos(a1)
  75309. rts
  75310. ; ===========================================================================
  75311. ; loc_3AA0E: ObjB2_Move_Leader_egde:
  75312. ObjB2_Move_Leader_edge:
  75313. lea (MainCharacter).w,a1 ; a1=character
  75314. cmpi.w #$2E30,x_pos(a1)
  75315. bhs.s +
  75316. move.w #(button_right_mask<<8)|button_right_mask,(Ctrl_1_Logical).w
  75317. rts
  75318. ; ===========================================================================
  75319. + ; loc_3AA22:
  75320. addq.b #2,routine_secondary(a0)
  75321. clr.w (Ctrl_1_Logical).w
  75322. clr.w x_vel(a1)
  75323. clr.w y_vel(a1)
  75324. clr.w inertia(a1)
  75325. move.w #$600,(Sonic_top_speed).w
  75326. move.w #$C,(Sonic_acceleration).w
  75327. move.w #$80,(Sonic_deceleration).w
  75328. bra.w ObjB2_Waiting_animation
  75329. ; ===========================================================================
  75330. ; loc_3AA4C:
  75331. ObjB2_Wait_for_plane:
  75332. cmpi.w #$380,(Camera_BG_X_offset).w
  75333. bhs.s +
  75334. clr.w (Ctrl_1_Logical).w
  75335. bra.w ObjB2_Waiting_animation
  75336. ; ===========================================================================
  75337. + ; loc_3AA5C:
  75338. addq.b #2,routine_secondary(a0)
  75339. move.w #$100,x_vel(a0)
  75340. move.w #-$100,y_vel(a0)
  75341. clr.w objoff_2A(a0)
  75342. bra.w ObjB2_Waiting_animation
  75343. ; ===========================================================================
  75344. ; loc_3AA74:
  75345. ObjB2_Prepare_to_jump:
  75346. bsr.w ObjB2_Waiting_animation
  75347. addq.w #1,objoff_2A(a0)
  75348. cmpi.w #$30,objoff_2A(a0)
  75349. bne.s +
  75350. addq.b #2,routine_secondary(a0)
  75351. move.w #(button_A_mask<<8)|button_A_mask,(Ctrl_1_Logical).w
  75352. move.w #$38,objoff_2E(a0)
  75353. tst.b (Super_Sonic_flag).w
  75354. beq.s +
  75355. move.w #$28,objoff_2E(a0)
  75356. + ; loc_3AAA0:
  75357. bsr.w ObjB2_Align_plane
  75358. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75359. ; ===========================================================================
  75360. ; loc_3AAA8:
  75361. ObjB2_Jump_to_plane:
  75362. clr.w (Ctrl_1_Logical).w
  75363. addq.w #1,objoff_2A(a0)
  75364. subq.w #1,objoff_2E(a0)
  75365. bmi.s +
  75366. move.w #((button_right_mask|button_A_mask)<<8)|button_right_mask|button_A_mask,(Ctrl_1_Logical).w
  75367. + ; loc_3AABC:
  75368. bsr.w ObjB2_Align_plane
  75369. btst #p1_standing_bit,status(a0)
  75370. beq.s +
  75371. addq.b #2,routine_secondary(a0)
  75372. move.w #$20,objoff_2E(a0)
  75373. lea (Level_Layout+$0D2).w,a1
  75374. move.l #$501F0025,(a1)+
  75375. lea (Level_Layout+$1D2).w,a1
  75376. move.l #$25001F50,(a1)+
  75377. lea (Level_Layout+$BD6).w,a1
  75378. move.l #$501F0025,(a1)+
  75379. lea (Level_Layout+$CD6).w,a1
  75380. move.l #$25001F50,(a1)+
  75381. + ; BranchTo6_JmpTo45_DisplaySprite:
  75382. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75383. ; ===========================================================================
  75384. ; loc_3AAFE:
  75385. ObjB2_Landed_on_plane:
  75386. addq.w #1,objoff_2A(a0)
  75387. cmpi.w #$100,objoff_2A(a0)
  75388. blo.s loc_3AB18
  75389. addq.b #2,routine_secondary(a0)
  75390. movea.w objoff_3A(a0),a1 ; a1=object ??
  75391. move.b #2,routine_secondary(a1)
  75392.  
  75393. loc_3AB18:
  75394. clr.w (Ctrl_1_Logical).w
  75395. lea (MainCharacter).w,a1 ; a1=character
  75396. move.w x_pos(a0),x_pos(a1)
  75397. clr.w x_vel(a1)
  75398. clr.w y_vel(a1)
  75399. clr.w inertia(a1)
  75400. bclr #1,status(a1)
  75401. bclr #2,status(a1)
  75402. move.l #$1000505,mapping_frame(a1)
  75403. move.w #$100,anim_frame_duration(a1)
  75404. move.b #$13,y_radius(a1)
  75405. cmpi.w #2,(Player_mode).w
  75406. bne.s +
  75407. move.b #$F,y_radius(a1)
  75408. + ; loc_3AB60:
  75409. bsr.w ObjB2_Align_plane
  75410. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75411. ; ===========================================================================
  75412. ; loc_3AB68:
  75413. ObjB2_Approaching_ship:
  75414. clr.w (Ctrl_1_Logical).w
  75415. bsr.w ObjB2_Waiting_animation
  75416. cmpi.w #$437,objoff_2A(a0)
  75417. blo.s loc_3AB8A
  75418. addq.b #2,routine_secondary(a0)
  75419. ; loc_3AB7C:
  75420. ObjB2_Jump_to_ship:
  75421. cmpi.w #$447,objoff_2A(a0)
  75422. bhs.s loc_3AB8A
  75423. move.w #(button_A_mask<<8)|button_A_mask,(Ctrl_1_Logical).w
  75424.  
  75425. loc_3AB8A:
  75426. cmpi.w #$460,objoff_2A(a0)
  75427. blo.s ObjB2_Dock_on_DEZ
  75428. move.b #6,(Dynamic_Resize_Routine).w ; => LevEvents_WFZ_Routine4
  75429. addq.b #2,routine_secondary(a0)
  75430. lea (word_3AFB8).l,a2
  75431. bsr.w LoadChildObject
  75432. move.w #$3090,x_pos(a1)
  75433. move.w #$3D0,y_pos(a1)
  75434. lea (word_3AFB8).l,a2
  75435. bsr.w LoadChildObject
  75436. move.w #$30C0,x_pos(a1)
  75437. move.w #$3F0,y_pos(a1)
  75438. lea (word_3AFB8).l,a2
  75439. bsr.w LoadChildObject
  75440. move.w #$3090,x_pos(a1)
  75441. move.w #$410,y_pos(a1)
  75442. ; loc_3ABDE:
  75443. ObjB2_Dock_on_DEZ:
  75444. cmpi.w #$9C0,objoff_2A(a0)
  75445. bhs.s ObjB2_Start_DEZ
  75446. move.w objoff_2A(a0),d0
  75447. addq.w #1,d0
  75448. move.w d0,objoff_2A(a0)
  75449. move.w objoff_34(a0),d1
  75450. move.w word_3AC16(pc,d1.w),d2
  75451. cmp.w d2,d0
  75452. blo.s loc_3AC0E
  75453. addq.w #2,d1
  75454. move.w d1,objoff_34(a0)
  75455. lea byte_3AC2A(pc,d1.w),a1
  75456. move.b (a1)+,x_vel(a0)
  75457. move.b (a1)+,y_vel(a0)
  75458.  
  75459. loc_3AC0E:
  75460. bsr.w ObjB2_Align_plane
  75461. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75462. ; ===========================================================================
  75463. word_3AC16:
  75464. dc.w $1E0
  75465. dc.w $260 ; 1
  75466. dc.w $2A0 ; 2
  75467. dc.w $2C0 ; 3
  75468. dc.w $300 ; 4
  75469. dc.w $3A0 ; 5
  75470. dc.w $3F0 ; 6
  75471. dc.w $460 ; 7
  75472. dc.w $4A0 ; 8
  75473. dc.w $580 ; 9
  75474. byte_3AC2A:
  75475. dc.b $FF
  75476. dc.b $FF ; 1
  75477. dc.b 1 ; 2
  75478. dc.b 0 ; 3
  75479. dc.b 0 ; 4
  75480. dc.b 1 ; 5
  75481. dc.b 1 ; 6
  75482. dc.b $FF ; 7
  75483. dc.b 1 ; 8
  75484. dc.b 1 ; 9
  75485. dc.b 1 ; 10
  75486. dc.b $FF ; 11
  75487. dc.b $FF ; 12
  75488. dc.b 1 ; 13
  75489. dc.b $FF ; 14
  75490. dc.b $FF ; 15
  75491. dc.b $FF ; 16
  75492. dc.b 1 ; 17
  75493. dc.b $FE ; 18
  75494. dc.b 0 ; 19
  75495. dc.b 0 ; 20
  75496. dc.b 0 ; 21
  75497. ; ===========================================================================
  75498. ; loc_3AC40:
  75499. ObjB2_Start_DEZ:
  75500. move.w #death_egg_zone_act_1,(Current_ZoneAndAct).w
  75501. ; loc_3AC46:
  75502. ObjB2_Deactivate_level:
  75503. move.w #1,(Level_Inactive_flag).w
  75504. clr.b (Last_star_pole_hit).w
  75505. clr.b (Last_star_pole_hit_2P).w
  75506. rts
  75507. ; ===========================================================================
  75508. ; loc_3AC56:
  75509. ObjB2_Waiting_animation:
  75510. lea (MainCharacter).w,a1 ; a1=character
  75511. move.l #$1000505,mapping_frame(a1)
  75512. move.w #$100,anim_frame_duration(a1)
  75513. rts
  75514. ; ===========================================================================
  75515. ; loc_3AC6A:
  75516. ObjB2_Invisible_grabber:
  75517. moveq #0,d0
  75518. move.b routine_secondary(a0),d0
  75519. move.w off_3AC78(pc,d0.w),d1
  75520. jmp off_3AC78(pc,d1.w)
  75521. ; ===========================================================================
  75522. off_3AC78: offsetTable
  75523. offsetTableEntry.w loc_3AC7E ; 0
  75524. offsetTableEntry.w loc_3AC84 ; 2
  75525. offsetTableEntry.w loc_3ACF2 ; 4
  75526. ; ===========================================================================
  75527.  
  75528. loc_3AC7E:
  75529. move.b #$C7,collision_flags(a0)
  75530.  
  75531. loc_3AC84:
  75532. tst.b collision_property(a0)
  75533. beq.s return_3ACF0
  75534. addq.b #2,routine_secondary(a0)
  75535. clr.b collision_flags(a0)
  75536. move.w #(224/2)+8,(Camera_Y_pos_bias).w
  75537. movea.w objoff_2C(a0),a1 ; a1=object
  75538. bset #6,status(a1)
  75539. lea (MainCharacter).w,a1 ; a1=character
  75540. clr.w x_vel(a1)
  75541. clr.w y_vel(a1)
  75542. move.w x_pos(a0),d0
  75543. subi.w #$10,d0
  75544. move.w d0,x_pos(a1)
  75545. cmpi.w #2,(Player_mode).w
  75546. bne.s loc_3ACC8
  75547. subi.w #$10,y_pos(a1)
  75548.  
  75549. loc_3ACC8:
  75550. bset #0,status(a1)
  75551. bclr #1,status(a1)
  75552. bclr #2,status(a1)
  75553. move.b #AniIDSonAni_Hang,anim(a1)
  75554. move.b #1,(MainCharacter+obj_control).w
  75555. move.b #1,(WindTunnel_holding_flag).w
  75556. clr.w (Ctrl_1_Logical).w
  75557.  
  75558. return_3ACF0:
  75559. rts
  75560. ; ===========================================================================
  75561.  
  75562. loc_3ACF2:
  75563. lea (MainCharacter).w,a1 ; a1=character
  75564. clr.w x_vel(a1)
  75565. clr.w y_vel(a1)
  75566. move.w x_pos(a0),d0
  75567. subi.w #$10,d0
  75568. move.w d0,x_pos(a1)
  75569. rts
  75570. ; ===========================================================================
  75571.  
  75572. loc_3AD0C:
  75573. moveq #0,d0
  75574. move.b routine_secondary(a0),d0
  75575. move.w off_3AD1A(pc,d0.w),d1
  75576. jmp off_3AD1A(pc,d1.w)
  75577. ; ===========================================================================
  75578. off_3AD1A: offsetTable
  75579. offsetTableEntry.w + ; 0
  75580. ; ===========================================================================
  75581. + ; loc_3AD1C:
  75582. bchg #2,status(a0)
  75583. bne.w return_37A48
  75584. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75585. ; ===========================================================================
  75586.  
  75587. loc_3AD2A:
  75588. moveq #0,d0
  75589. move.b routine_secondary(a0),d0
  75590. move.w off_3AD38(pc,d0.w),d1
  75591. jmp off_3AD38(pc,d1.w)
  75592. ; ===========================================================================
  75593. off_3AD38: offsetTable
  75594. offsetTableEntry.w + ; 0
  75595. ; ===========================================================================
  75596. + ; loc_3AD3A:
  75597. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  75598. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  75599. ; ===========================================================================
  75600.  
  75601. loc_3AD42:
  75602. moveq #0,d0
  75603. move.b routine_secondary(a0),d0
  75604. move.w off_3AD50(pc,d0.w),d1
  75605. jmp off_3AD50(pc,d1.w)
  75606. ; ===========================================================================
  75607. off_3AD50: offsetTable
  75608. offsetTableEntry.w loc_3AD54 ; 0
  75609. offsetTableEntry.w loc_3AD5C ; 2
  75610. ; ===========================================================================
  75611.  
  75612. loc_3AD54:
  75613. bsr.w loc_3AD6E
  75614. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75615. ; ===========================================================================
  75616.  
  75617. loc_3AD5C:
  75618. bsr.w loc_3AD6E
  75619. lea (Ani_objB2_b).l,a1
  75620. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  75621. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  75622. ; ===========================================================================
  75623.  
  75624. loc_3AD6E:
  75625. movea.w objoff_2C(a0),a1 ; a1=object
  75626. move.w x_pos(a1),d0
  75627. subi.w #$C,d0
  75628. move.w d0,x_pos(a0)
  75629. move.w y_pos(a1),d0
  75630. addi.w #$28,d0
  75631. move.w d0,y_pos(a0)
  75632. rts
  75633. ; ===========================================================================
  75634. ; loc_3AD8C:
  75635. ObjB2_Align_plane:
  75636. move.w x_pos(a0),-(sp)
  75637. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  75638. bsr.w loc_36776
  75639. move.w #$1B,d1
  75640. move.w #8,d2
  75641. move.w #9,d3
  75642. move.w (sp)+,d4
  75643. jmpto (SolidObject).l, JmpTo27_SolidObject
  75644. ; ===========================================================================
  75645. ; loc_3ADAA:
  75646. ObjB2_Move_with_player:
  75647. lea (MainCharacter).w,a1 ; a1=character
  75648. btst #3,status(a1)
  75649. beq.s ObjB2_Move_below_player
  75650. bsr.w ObjB2_Move_vert
  75651. bsr.w ObjB2_Vertical_limit
  75652. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  75653. bra.w loc_36776
  75654. ; ===========================================================================
  75655. ; loc_3ADC6:
  75656. ObjB2_Move_below_player:
  75657. tst.b objoff_2E(a0)
  75658. beq.s loc_3ADD4
  75659. bsr.w Obj_GetOrientationToPlayer
  75660. move.w d2,objoff_38(a0)
  75661.  
  75662. loc_3ADD4:
  75663. move.w #1,d0
  75664. move.w objoff_38(a0),d3
  75665. beq.s loc_3ADE8
  75666. bmi.s loc_3ADE2
  75667. neg.w d0
  75668.  
  75669. loc_3ADE2:
  75670. add.w d0,d3
  75671. move.w d3,objoff_38(a0)
  75672.  
  75673. loc_3ADE8:
  75674. move.w x_pos(a1),d1
  75675. add.w d3,d1
  75676. move.w d1,x_pos(a0)
  75677. bra.w loc_36776
  75678. ; ===========================================================================
  75679. ; loc_3ADF6:
  75680. ObjB2_Move_vert:
  75681. tst.b objoff_2F(a0)
  75682. bne.s loc_3AE16
  75683. tst.b objoff_2E(a0)
  75684. beq.s return_3AE38
  75685. st objoff_2F(a0)
  75686. clr.b objoff_30(a0)
  75687. move.w #$200,y_vel(a0)
  75688. move.b #$14,objoff_31(a0)
  75689.  
  75690. loc_3AE16:
  75691. subq.b #1,objoff_31(a0)
  75692. bpl.s loc_3AE26
  75693. clr.b objoff_2F(a0)
  75694. clr.w y_vel(a0)
  75695. rts
  75696. ; ===========================================================================
  75697.  
  75698. loc_3AE26:
  75699. move.w y_vel(a0),d0
  75700. cmpi.w #-$100,d0
  75701. ble.s loc_3AE34
  75702. addi.w #-$20,d0
  75703.  
  75704. loc_3AE34:
  75705. move.w d0,y_vel(a0)
  75706.  
  75707. return_3AE38:
  75708. rts
  75709. ; ===========================================================================
  75710. ; loc_3AE3A:
  75711. ObjB2_Move_obbey_player:
  75712. lea (MainCharacter).w,a1 ; a1=character
  75713. btst #3,status(a1)
  75714. beq.s ObjB2_Move_vert2
  75715. tst.b objoff_2F(a0)
  75716. bne.s loc_3AE72
  75717. clr.w y_vel(a0)
  75718. move.w (Ctrl_1).w,d2
  75719. move.w #$80,d3
  75720. andi.w #(button_up_mask|button_down_mask)<<8,d2
  75721. beq.s loc_3AE72
  75722. andi.w #button_down_mask<<8,d2
  75723. bne.s loc_3AE66
  75724. neg.w d3
  75725.  
  75726. loc_3AE66:
  75727. move.w d3,y_vel(a0)
  75728. bsr.w ObjB2_Vertical_limit
  75729. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  75730.  
  75731. loc_3AE72:
  75732. bsr.w Obj_GetOrientationToPlayer
  75733. moveq #$10,d3
  75734. add.w d3,d2
  75735. cmpi.w #$20,d2
  75736. blo.s return_3AE9E
  75737. mvabs.w inertia(a1),d2
  75738. cmpi.w #$900,d2
  75739. bhs.s return_3AE9E
  75740. tst.w d0
  75741. beq.s loc_3AE94
  75742. neg.w d3
  75743.  
  75744. loc_3AE94:
  75745. move.w x_pos(a1),d1
  75746. add.w d3,d1
  75747. move.w d1,x_pos(a0)
  75748.  
  75749. return_3AE9E:
  75750. rts
  75751. ; ===========================================================================
  75752. ; loc_3AEA0:
  75753. ObjB2_Move_vert2:
  75754. tst.b objoff_30(a0)
  75755. bne.s loc_3AEC0
  75756. tst.b objoff_2E(a0)
  75757. beq.s return_3AE9E
  75758. st objoff_30(a0)
  75759. clr.b objoff_2F(a0)
  75760. move.w #$200,y_vel(a0)
  75761. move.b #$2B,objoff_31(a0)
  75762.  
  75763. loc_3AEC0:
  75764. subq.b #1,objoff_31(a0)
  75765. bpl.s loc_3AED0
  75766. clr.b objoff_30(a0)
  75767. clr.w y_vel(a0)
  75768. rts
  75769. ; ===========================================================================
  75770.  
  75771. loc_3AED0:
  75772. move.w y_vel(a0),d0
  75773. cmpi.w #-$100,d0
  75774. ble.s loc_3AEDE
  75775. addi.w #-$20,d0
  75776.  
  75777. loc_3AEDE:
  75778. move.w d0,y_vel(a0)
  75779. bsr.w ObjB2_Vertical_limit
  75780. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  75781. rts
  75782. ; ===========================================================================
  75783. ; loc_3AEEC:
  75784. ObjB2_Horizontal_limit:
  75785. bsr.w Obj_GetOrientationToPlayer
  75786. moveq #$10,d3
  75787. add.w d3,d2
  75788. cmpi.w #$20,d2
  75789. blo.s return_3AF0A
  75790. tst.w d0
  75791. beq.s loc_3AF00
  75792. neg.w d3
  75793.  
  75794. loc_3AF00:
  75795. move.w x_pos(a0),d1
  75796. sub.w d3,d1
  75797. move.w d1,x_pos(a1)
  75798.  
  75799. return_3AF0A:
  75800. rts
  75801. ; ===========================================================================
  75802. ; loc_3AF0C:
  75803. ObjB2_Vertical_limit:
  75804. move.w (Camera_Y_pos).w,d0
  75805. move.w y_pos(a0),d1
  75806. move.w y_vel(a0),d2
  75807. beq.s return_3AF32
  75808. bpl.s loc_3AF26
  75809. addi.w #$34,d0
  75810. cmp.w d0,d1
  75811. blo.s loc_3AF2E
  75812. rts
  75813. ; ===========================================================================
  75814.  
  75815. loc_3AF26:
  75816. addi.w #$A8,d0
  75817. cmp.w d0,d1
  75818. blo.s return_3AF32
  75819.  
  75820. loc_3AF2E:
  75821. clr.w y_vel(a0)
  75822.  
  75823. return_3AF32:
  75824. rts
  75825. ; ===========================================================================
  75826. ; loc_3AF34:
  75827. ObjB2_Main_WFZ_Start_load_smoke:
  75828. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  75829. bne.s +
  75830. _move.b #ObjID_TornadoSmoke2,id(a1) ; load objC3
  75831. move.b #$90,subtype(a1) ; <== ObjC3_SubObjData
  75832. move.w a0,objoff_2C(a1)
  75833. move.w x_pos(a0),x_pos(a1)
  75834. move.w y_pos(a0),y_pos(a1)
  75835. + ; return_3AF56:
  75836. rts
  75837. ; ===========================================================================
  75838. ; loc_3AF58:
  75839. ObjB2_Animate_Pilot:
  75840. subq.b #1,objoff_37(a0)
  75841. bmi.s +
  75842. rts
  75843. ; ===========================================================================
  75844. + ; loc_3AF60:
  75845. move.b #8,objoff_37(a0)
  75846. moveq #0,d0
  75847. move.b objoff_36(a0),d0
  75848. moveq #Tails_pilot_frames_end-Tails_pilot_frames,d1
  75849. cmpi.w #2,(Player_mode).w
  75850. bne.s +
  75851. moveq #Sonic_pilot_frames_end-Sonic_pilot_frames,d1
  75852. + ; loc_3AF78:
  75853. addq.b #1,d0
  75854. cmp.w d1,d0
  75855. blo.s +
  75856. moveq #0,d0
  75857. + ; loc_3AF80:
  75858. move.b d0,objoff_36(a0)
  75859. cmpi.w #2,(Player_mode).w
  75860. bne.s +
  75861. move.b Sonic_pilot_frames(pc,d0.w),d0
  75862. jmpto (LoadSonicDynPLC_Part2).l, JmpTo_LoadSonicDynPLC_Part2
  75863. ; ===========================================================================
  75864. + ; loc_3AF94:
  75865. move.b Tails_pilot_frames(pc,d0.w),d0
  75866. jmpto (LoadTailsDynPLC_Part2).l, JmpTo_LoadTailsDynPLC_Part2
  75867. ; ===========================================================================
  75868. ; byte_3AF9C:
  75869. Sonic_pilot_frames:
  75870. dc.b $2D
  75871. dc.b $2E ; 1
  75872. dc.b $2F ; 2
  75873. dc.b $30 ; 3
  75874. Sonic_pilot_frames_end:
  75875.  
  75876. ; byte_3AFA0:
  75877. Tails_pilot_frames:
  75878. dc.b $10
  75879. dc.b $10 ; 1
  75880. dc.b $10 ; 2
  75881. dc.b $10 ; 3
  75882. dc.b 1 ; 4
  75883. dc.b 2 ; 5
  75884. dc.b 3 ; 6
  75885. dc.b 2 ; 7
  75886. dc.b 1 ; 8
  75887. dc.b 1 ; 9
  75888. dc.b $10 ; 10
  75889. dc.b $10 ; 11
  75890. dc.b $10 ; 12
  75891. dc.b $10 ; 13
  75892. dc.b 1 ; 14
  75893. dc.b 2 ; 15
  75894. dc.b 3 ; 16
  75895. dc.b 2 ; 17
  75896. dc.b 1 ; 18
  75897. dc.b 1 ; 19
  75898. dc.b 4 ; 20
  75899. dc.b 4 ; 21
  75900. dc.b 1 ; 22
  75901. dc.b 1 ; 23
  75902. Tails_pilot_frames_end:
  75903.  
  75904. word_3AFB8:
  75905. dc.w objoff_3E
  75906. dc.b ObjID_Tornado
  75907. dc.b $58
  75908. word_3AFBC:
  75909. dc.w objoff_3C
  75910. dc.b ObjID_Tornado
  75911. dc.b $56
  75912. word_3AFC0:
  75913. dc.w objoff_3A
  75914. dc.b ObjID_Tornado
  75915. dc.b $5C
  75916. ; seems unused
  75917. dc.w objoff_3E
  75918. dc.b ObjID_Tornado
  75919. dc.b $5A
  75920. ; off_3AFC8:
  75921. ObjB2_SubObjData:
  75922. subObjData ObjB2_MapUnc_3AFF2,make_art_tile(ArtTile_ArtNem_Tornado,0,1),4,4,$60,0
  75923. ; off_3AFD2:
  75924. ObjB2_SubObjData2:
  75925. subObjData ObjB2_MapUnc_3B292,make_art_tile(ArtTile_ArtNem_TornadoThruster,0,0),4,3,$40,0
  75926. ; animation script
  75927. ; off_3AFDC:
  75928. Ani_objB2_a: offsetTable
  75929. offsetTableEntry.w byte_3AFE0 ; 0
  75930. offsetTableEntry.w byte_3AFE6 ; 1
  75931. byte_3AFE0: dc.b 0, 0, 1, 2, 3,$FF
  75932. byte_3AFE6: dc.b 0, 4, 5, 6, 7,$FF
  75933. even
  75934. ; animation script
  75935. ; off_3AFEC:
  75936. Ani_objB2_b: offsetTable
  75937. offsetTableEntry.w + ; 0
  75938. ; byte_3AFEE:
  75939. + dc.b 0, 1, 2,$FF
  75940. even
  75941. ; -----------------------------------------------------------------------------
  75942. ; sprite mappings
  75943. ; -----------------------------------------------------------------------------
  75944. ObjB2_MapUnc_3AFF2: BINCLUDE "mappings/sprite/objB2_a.bin"
  75945. ; -----------------------------------------------------------------------------
  75946. ; sprite mappings
  75947. ; -----------------------------------------------------------------------------
  75948. ObjB2_MapUnc_3B292: BINCLUDE "mappings/sprite/objB2_b.bin"
  75949.  
  75950.  
  75951. ; ===========================================================================
  75952. ; ----------------------------------------------------------------------------
  75953. ; Object B3 - Clouds (placeable object) from SCZ
  75954. ; ----------------------------------------------------------------------------
  75955. ; Sprite_3B2DE:
  75956. ObjB3:
  75957. moveq #0,d0
  75958. move.b routine(a0),d0
  75959. move.w ObjB3_Index(pc,d0.w),d1
  75960. jmp ObjB3_Index(pc,d1.w)
  75961. ; ===========================================================================
  75962. ; off_3B2EC:
  75963. ObjB3_Index: offsetTable
  75964. offsetTableEntry.w ObjB3_Init ; 0
  75965. offsetTableEntry.w ObjB3_Main ; 2
  75966. ; ===========================================================================
  75967. ; loc_3B2F0:
  75968. ObjB3_Init:
  75969. bsr.w LoadSubObject
  75970. moveq #0,d0
  75971. move.b subtype(a0),d0
  75972. subi.b #$5E,d0
  75973. move.w word_3B30C(pc,d0.w),x_vel(a0)
  75974. lsr.w #1,d0
  75975. move.b d0,mapping_frame(a0)
  75976. rts
  75977. ; ===========================================================================
  75978. word_3B30C:
  75979. dc.w -$80
  75980. dc.w -$40 ; 1
  75981. dc.w -$20 ; 2
  75982. ; ===========================================================================
  75983. ; loc_3B312:
  75984. ObjB3_Main:
  75985. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  75986. move.w (Tornado_Velocity_X).w,d0
  75987. add.w d0,x_pos(a0)
  75988. bra.w Obj_DeleteBehindScreen
  75989. ; ===========================================================================
  75990. ; off_3B322:
  75991. ObjB3_SubObjData:
  75992. subObjData ObjB3_MapUnc_3B32C,make_art_tile(ArtTile_ArtNem_Clouds,2,0),4,6,$30,0
  75993.  
  75994. ; -----------------------------------------------------------------------------
  75995. ; sprite mappings
  75996. ; -----------------------------------------------------------------------------
  75997. ObjB3_MapUnc_3B32C: BINCLUDE "mappings/sprite/objB3.bin"
  75998.  
  75999.  
  76000.  
  76001.  
  76002. ; ===========================================================================
  76003. ; ----------------------------------------------------------------------------
  76004. ; Object B4 - Vertical propeller from WFZ
  76005. ; ----------------------------------------------------------------------------
  76006. ; Sprite_3B36A:
  76007. ObjB4:
  76008. moveq #0,d0
  76009. move.b routine(a0),d0
  76010. move.w ObjB4_Index(pc,d0.w),d1
  76011. jmp ObjB4_Index(pc,d1.w)
  76012. ; ===========================================================================
  76013. ; off_3B378:
  76014. ObjB4_Index: offsetTable
  76015. offsetTableEntry.w ObjB4_Init ; 0
  76016. offsetTableEntry.w ObjB4_Main ; 2
  76017. ; ===========================================================================
  76018. ; loc_3B37C:
  76019. ObjB4_Init:
  76020. bsr.w LoadSubObject
  76021. bclr #1,render_flags(a0)
  76022. beq.s +
  76023. clr.b collision_flags(a0)
  76024. +
  76025. rts
  76026. ; ===========================================================================
  76027. ; loc_3B38E:
  76028. ObjB4_Main:
  76029. lea (Ani_objB4).l,a1
  76030. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  76031. move.b (Vint_runcount+3).w,d0
  76032. andi.b #$1F,d0
  76033. bne.s +
  76034. moveq #SndID_Helicopter,d0
  76035. jsrto (PlaySoundLocal).l, JmpTo_PlaySoundLocal
  76036. +
  76037. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76038. ; ===========================================================================
  76039. ; off_3B3AC:
  76040. ObjB4_SubObjData:
  76041. subObjData ObjB4_MapUnc_3B3BE,make_art_tile(ArtTile_ArtNem_WfzVrtclPrpllr,1,1),4,4,4,$A8
  76042. ; animation script
  76043. ; off_3B3B6:
  76044. Ani_objB4: offsetTable
  76045. offsetTableEntry.w + ; 0
  76046. + dc.b 1, 0, 1, 2,$FF, 0
  76047. even
  76048. ; ----------------------------------------------------------------------------
  76049. ; sprite mappings
  76050. ; ----------------------------------------------------------------------------
  76051. ObjB4_MapUnc_3B3BE: BINCLUDE "mappings/sprite/objB4.bin"
  76052. ; ===========================================================================
  76053. ; ----------------------------------------------------------------------------
  76054. ; Object B5 - Horizontal propeller from WFZ
  76055. ; ----------------------------------------------------------------------------
  76056. ; Sprite_3B3FA:
  76057. ObjB5:
  76058. moveq #0,d0
  76059. move.b routine(a0),d0
  76060. move.w ObjB5_Index(pc,d0.w),d1
  76061. jmp ObjB5_Index(pc,d1.w)
  76062. ; ===========================================================================
  76063. ; off_3B408:
  76064. ObjB5_Index: offsetTable
  76065. offsetTableEntry.w ObjB5_Init ; 0
  76066. offsetTableEntry.w ObjB5_Main ; 2 - used in WFZ
  76067. offsetTableEntry.w ObjB5_Animate ; 4 - used in SCZ, no effect on players
  76068. ; ===========================================================================
  76069. ; loc_3B40E:
  76070. ObjB5_Init:
  76071. bsr.w LoadSubObject
  76072. move.b #4,anim(a0)
  76073. move.b subtype(a0),d0
  76074. subi.b #$64,d0
  76075. move.b d0,routine(a0)
  76076. rts
  76077. ; ===========================================================================
  76078. ; loc_3B426:
  76079. ObjB5_Main:
  76080. moveq #0,d0
  76081. move.b routine_secondary(a0),d0
  76082. move.w off_3B442(pc,d0.w),d1
  76083. jsr off_3B442(pc,d1.w)
  76084. lea (Ani_objB5).l,a1
  76085. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  76086. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76087. ; ===========================================================================
  76088. off_3B442: offsetTable
  76089. offsetTableEntry.w + ; 0
  76090. ; ===========================================================================
  76091. + bra.w ObjB5_CheckPlayers
  76092. ; ===========================================================================
  76093. ; loc_3B448:
  76094. ObjB5_Animate:
  76095. lea (Ani_objB5).l,a1
  76096. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  76097. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76098. ; ===========================================================================
  76099. ; loc_3B456:
  76100. ObjB5_CheckPlayers:
  76101. cmpi.b #4,anim(a0)
  76102. bne.s ++ ; rts
  76103. lea (MainCharacter).w,a1 ; a1=character
  76104. bsr.w ObjB5_CheckPlayer
  76105. lea (Sidekick).w,a1 ; a1=character
  76106. ; loc_3B46A:
  76107. ObjB5_CheckPlayer:
  76108. move.w x_pos(a1),d0
  76109. sub.w x_pos(a0),d0
  76110. addi.w #$40,d0
  76111. cmpi.w #$80,d0
  76112. bhs.s ++ ; rts
  76113. moveq #0,d1
  76114. move.b (Oscillating_Data+$14).w,d1
  76115. add.w y_pos(a1),d1
  76116. addi.w #$60,d1
  76117. sub.w y_pos(a0),d1
  76118. bcs.s ++ ; rts
  76119. cmpi.w #$90,d1
  76120. bhs.s ++ ; rts
  76121. subi.w #$60,d1
  76122. bcs.s +
  76123. not.w d1
  76124. add.w d1,d1
  76125. +
  76126. addi.w #$60,d1
  76127. neg.w d1
  76128. asr.w #4,d1
  76129. add.w d1,y_pos(a1)
  76130. bset #1,status(a1)
  76131. move.w #0,y_vel(a1)
  76132. move.w #1,inertia(a1)
  76133. tst.b flip_angle(a1)
  76134. bne.s + ; rts
  76135. move.b #1,flip_angle(a1)
  76136. move.b #AniIDSonAni_Float2,anim(a1)
  76137. move.b #$7F,flips_remaining(a1)
  76138. move.b #8,flip_speed(a1)
  76139. +
  76140. rts
  76141. ; ===========================================================================
  76142. ; off_3B4DE:
  76143. ObjB5_SubObjData:
  76144. subObjData ObjB5_MapUnc_3B548,make_art_tile(ArtTile_ArtNem_WfzHrzntlPrpllr,1,1),4,4,$40,0
  76145.  
  76146. ; animation script
  76147. ; off_3B4E8:
  76148. Ani_objB5: offsetTable
  76149. offsetTableEntry.w byte_3B4FC ; 0
  76150. offsetTableEntry.w byte_3B506 ; 1
  76151. offsetTableEntry.w byte_3B50E ; 2
  76152. offsetTableEntry.w byte_3B516 ; 3
  76153. offsetTableEntry.w byte_3B51C ; 4
  76154. offsetTableEntry.w byte_3B524 ; 5
  76155. offsetTableEntry.w byte_3B52A ; 6
  76156. offsetTableEntry.w byte_3B532 ; 7
  76157. offsetTableEntry.w byte_3B53A ; 8
  76158. offsetTableEntry.w byte_3B544 ; 9
  76159. byte_3B4FC: dc.b 7, 0, 1, 2, 3, 4, 5,$FD, 1, 0
  76160. byte_3B506: dc.b 4, 0, 1, 2, 3, 4,$FD, 2
  76161. byte_3B50E: dc.b 3, 5, 0, 1, 2,$FD, 3, 0
  76162. byte_3B516: dc.b 2, 3, 4, 5,$FD, 4
  76163. byte_3B51C: dc.b 1, 0, 1, 2, 3, 4, 5,$FF
  76164. byte_3B524: dc.b 2, 5, 4, 3,$FD, 6
  76165. byte_3B52A: dc.b 3, 2, 1, 0, 5,$FD, 7, 0
  76166. byte_3B532: dc.b 4, 4, 3, 2, 1, 0,$FD, 8
  76167. byte_3B53A: dc.b 7, 5, 4, 3, 2, 1, 0,$FD, 9, 0
  76168. byte_3B544: dc.b $7E, 0,$FF
  76169. even
  76170. ; ----------------------------------------------------------------------------
  76171. ; sprite mappings
  76172. ; ----------------------------------------------------------------------------
  76173. ObjB5_MapUnc_3B548: BINCLUDE "mappings/sprite/objB5.bin"
  76174. ; ===========================================================================
  76175. ; ----------------------------------------------------------------------------
  76176. ; Object B6 - Tilting platform from WFZ
  76177. ; ----------------------------------------------------------------------------
  76178. ; Sprite_3B5D0:
  76179. ObjB6:
  76180. moveq #0,d0
  76181. move.b routine(a0),d0
  76182. move.w ObjB6_Index(pc,d0.w),d1
  76183. jmp ObjB6_Index(pc,d1.w)
  76184. ; ===========================================================================
  76185. ; off_3B5DE:
  76186. ObjB6_Index: offsetTable
  76187. offsetTableEntry.w ObjB6_Init ; 0
  76188. offsetTableEntry.w loc_3B602 ; 2
  76189. offsetTableEntry.w loc_3B65C ; 4
  76190. offsetTableEntry.w loc_3B6C8 ; 6
  76191. offsetTableEntry.w loc_3B73C ; 8
  76192. ; ===========================================================================
  76193. ; loc_3B5E8:
  76194. ObjB6_Init:
  76195. moveq #0,d0
  76196. move.b #($35<<1),d0
  76197. bsr.w LoadSubObject_Part2
  76198. move.b subtype(a0),d0
  76199. andi.b #6,d0
  76200. addq.b #2,d0
  76201. move.b d0,routine(a0)
  76202. rts
  76203. ; ===========================================================================
  76204.  
  76205. loc_3B602:
  76206. moveq #0,d0
  76207. move.b routine_secondary(a0),d0
  76208. move.w off_3B614(pc,d0.w),d1
  76209. jsr off_3B614(pc,d1.w)
  76210. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76211. ; ===========================================================================
  76212. off_3B614: offsetTable
  76213. offsetTableEntry.w loc_3B61C ; 0
  76214. offsetTableEntry.w loc_3B624 ; 2
  76215. offsetTableEntry.w loc_3B644 ; 4
  76216. offsetTableEntry.w loc_3B64E ; 6
  76217. ; ===========================================================================
  76218.  
  76219. loc_3B61C:
  76220. addq.b #2,routine_secondary(a0)
  76221. bra.w loc_3B77E
  76222. ; ===========================================================================
  76223.  
  76224. loc_3B624:
  76225. bsr.w loc_3B790
  76226. move.b (Vint_runcount+3).w,d0
  76227. andi.b #$F0,d0
  76228. cmp.b subtype(a0),d0
  76229. beq.s loc_3B638
  76230. rts
  76231. ; ===========================================================================
  76232.  
  76233. loc_3B638:
  76234. addq.b #2,routine_secondary(a0)
  76235. clr.b anim(a0)
  76236. bra.w loc_3B7BC
  76237. ; ===========================================================================
  76238.  
  76239. loc_3B644:
  76240. lea (Ani_objB6).l,a1
  76241. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  76242. ; ===========================================================================
  76243.  
  76244. loc_3B64E:
  76245. move.b #2,routine_secondary(a0)
  76246. move.w #$C0,objoff_2A(a0)
  76247. rts
  76248. ; ===========================================================================
  76249.  
  76250. loc_3B65C:
  76251. moveq #0,d0
  76252. move.b routine_secondary(a0),d0
  76253. move.w off_3B66E(pc,d0.w),d1
  76254. jsr off_3B66E(pc,d1.w)
  76255. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76256. ; ===========================================================================
  76257. off_3B66E: offsetTable
  76258. offsetTableEntry.w loc_3B61C
  76259. offsetTableEntry.w loc_3B674
  76260. offsetTableEntry.w loc_3B6A6
  76261. ; ===========================================================================
  76262.  
  76263. loc_3B674:
  76264. bsr.w loc_3B790
  76265. subq.w #1,objoff_2A(a0)
  76266. bmi.s +
  76267. rts
  76268. ; ===========================================================================
  76269. +
  76270. addq.b #2,routine_secondary(a0)
  76271. move.b #$20,objoff_2A(a0)
  76272. move.b #3,anim(a0)
  76273. clr.b anim_frame(a0)
  76274. clr.b anim_frame_duration(a0)
  76275. bsr.w loc_3B7BC
  76276. bsr.w loc_3B7F8
  76277. moveq #SndID_Fire,d0
  76278. jmpto (PlaySound).l, JmpTo12_PlaySound
  76279. ; ===========================================================================
  76280.  
  76281. loc_3B6A6:
  76282. subq.b #1,objoff_2A(a0)
  76283. bmi.s +
  76284. lea (Ani_objB6).l,a1
  76285. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  76286. ; ===========================================================================
  76287. +
  76288. move.b #2,routine_secondary(a0)
  76289. clr.b mapping_frame(a0)
  76290. move.w #$C0,objoff_2A(a0)
  76291. rts
  76292. ; ===========================================================================
  76293.  
  76294. loc_3B6C8:
  76295. moveq #0,d0
  76296. move.b routine_secondary(a0),d0
  76297. move.w off_3B6DA(pc,d0.w),d1
  76298. jsr off_3B6DA(pc,d1.w)
  76299. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76300. ; ===========================================================================
  76301. off_3B6DA: offsetTable
  76302. offsetTableEntry.w loc_3B6E2 ; 0
  76303. offsetTableEntry.w loc_3B6FE ; 2
  76304. offsetTableEntry.w loc_3B72C ; 4
  76305. offsetTableEntry.w loc_3B736 ; 6
  76306. ; ===========================================================================
  76307.  
  76308. loc_3B6E2:
  76309. bsr.w loc_3B790
  76310. move.b status(a0),d0
  76311. andi.b #standing_mask,d0
  76312. bne.s +
  76313. rts
  76314. ; ===========================================================================
  76315. +
  76316. addq.b #2,routine_secondary(a0)
  76317. move.w #$10,objoff_2A(a0)
  76318. rts
  76319. ; ===========================================================================
  76320.  
  76321. loc_3B6FE:
  76322. bsr.w loc_3B790
  76323. subq.w #1,objoff_2A(a0)
  76324. bmi.s +
  76325. rts
  76326. ; ===========================================================================
  76327. +
  76328. addq.b #2,routine_secondary(a0)
  76329. move.b #0,anim(a0)
  76330. bsr.w Obj_GetOrientationToPlayer
  76331. bclr #0,status(a0)
  76332. tst.w d0
  76333. bne.s +
  76334. bset #0,status(a0)
  76335. +
  76336. bra.w loc_3B7BC
  76337. ; ===========================================================================
  76338.  
  76339. loc_3B72C:
  76340. lea (Ani_objB6).l,a1
  76341. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  76342. ; ===========================================================================
  76343.  
  76344. loc_3B736:
  76345. clr.b routine_secondary(a0)
  76346. rts
  76347. ; ===========================================================================
  76348.  
  76349. loc_3B73C:
  76350. moveq #0,d0
  76351. move.b routine_secondary(a0),d0
  76352. move.w off_3B74E(pc,d0.w),d1
  76353. jsr off_3B74E(pc,d1.w)
  76354. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76355. ; ===========================================================================
  76356. off_3B74E: offsetTable
  76357. offsetTableEntry.w loc_3B756 ; 0
  76358. offsetTableEntry.w loc_3B764 ; 2
  76359. offsetTableEntry.w loc_3B644 ; 4
  76360. offsetTableEntry.w loc_3B64E ; 6
  76361. ; ===========================================================================
  76362.  
  76363. loc_3B756:
  76364. addq.b #2,routine_secondary(a0)
  76365. move.b #2,mapping_frame(a0)
  76366. bra.w loc_3B77E
  76367. ; ===========================================================================
  76368.  
  76369. loc_3B764:
  76370. bsr.w loc_3B7A6
  76371. subq.w #1,objoff_2A(a0)
  76372. bmi.s loc_3B770
  76373. rts
  76374. ; ===========================================================================
  76375.  
  76376. loc_3B770:
  76377. addq.b #2,routine_secondary(a0)
  76378. move.b #4,anim(a0)
  76379. bra.w loc_3B7BC
  76380. ; ===========================================================================
  76381.  
  76382. loc_3B77E:
  76383. move.b subtype(a0),d0
  76384. andi.w #$F0,d0
  76385. move.b d0,subtype(a0)
  76386. move.w d0,objoff_2A(a0)
  76387. rts
  76388. ; ===========================================================================
  76389.  
  76390. loc_3B790:
  76391. move.w x_pos(a0),-(sp)
  76392. move.w #$23,d1
  76393. move.w #4,d2
  76394. move.w #4,d3
  76395. move.w (sp)+,d4
  76396. jmpto (SolidObject).l, JmpTo27_SolidObject
  76397. ; ===========================================================================
  76398.  
  76399. loc_3B7A6:
  76400. move.w x_pos(a0),-(sp)
  76401. move.w #$F,d1
  76402. move.w #$18,d2
  76403. move.w #$18,d3
  76404. move.w (sp)+,d4
  76405. jmpto (SolidObject).l, JmpTo27_SolidObject
  76406. ; ===========================================================================
  76407.  
  76408. loc_3B7BC:
  76409. move.b status(a0),d0
  76410. if gameRevision<2
  76411. andi.b #standing_mask,d0
  76412. else
  76413. ; I don't know what this change was meant to do, but it causes
  76414. ; Sonic to not fall off ObjBD's ascending platforms when they retract,
  76415. ; making him hover.
  76416. andi.b #2,d0
  76417. endif
  76418. beq.s return_3B7F6
  76419. bclr #p1_standing_bit,status(a0)
  76420. beq.s loc_3B7DE
  76421. lea (MainCharacter).w,a1 ; a1=character
  76422. bclr #3,status(a1)
  76423. bset #1,status(a1)
  76424.  
  76425. loc_3B7DE:
  76426. bclr #p2_standing_bit,status(a0)
  76427. beq.s return_3B7F6
  76428. lea (Sidekick).w,a1 ; a1=character
  76429. bclr #4,status(a1)
  76430. bset #1,status(a1)
  76431.  
  76432. return_3B7F6:
  76433. rts
  76434. ; ===========================================================================
  76435.  
  76436. loc_3B7F8:
  76437. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  76438. bne.s +
  76439. _move.b #ObjID_VerticalLaser,id(a1) ; load objB7 (huge unused vertical laser!)
  76440. move.b #$72,subtype(a1) ; <== ObjB7_SubObjData
  76441. move.w x_pos(a0),x_pos(a1)
  76442. move.w y_pos(a0),y_pos(a1)
  76443. +
  76444. rts
  76445. ; ===========================================================================
  76446. ; off_3B818:
  76447. ObjB6_SubObjData:
  76448. subObjData ObjB6_MapUnc_3B856,make_art_tile(ArtTile_ArtNem_WfzTiltPlatforms,1,1),4,4,$10,0
  76449.  
  76450. ; animation script
  76451. ; off_3B822:
  76452. Ani_objB6: offsetTable
  76453. offsetTableEntry.w byte_3B830 ; 0
  76454. offsetTableEntry.w byte_3B836 ; 1
  76455. offsetTableEntry.w byte_3B83A ; 2
  76456. offsetTableEntry.w byte_3B840 ; 3
  76457. offsetTableEntry.w byte_3B846 ; 4
  76458. offsetTableEntry.w byte_3B84C ; 5
  76459. offsetTableEntry.w byte_3B850 ; 6
  76460. byte_3B830: dc.b 3, 1, 2,$FD, 1, 0
  76461. byte_3B836: dc.b $3F, 2,$FD, 2
  76462. byte_3B83A: dc.b 3, 2, 1, 0,$FA, 0
  76463. byte_3B840: dc.b 1, 0, 1, 2, 3,$FF
  76464. byte_3B846: dc.b 3, 1, 0,$FD, 5, 0
  76465. byte_3B84C: dc.b $3F, 0,$FD, 6
  76466. byte_3B850: dc.b 3, 0, 1, 2,$FA, 0
  76467. even
  76468. ; ----------------------------------------------------------------------------
  76469. ; sprite mappings
  76470. ; ----------------------------------------------------------------------------
  76471. ObjB6_MapUnc_3B856: BINCLUDE "mappings/sprite/objB6.bin"
  76472. ; ===========================================================================
  76473. ; ----------------------------------------------------------------------------
  76474. ; Object B7 - Unused huge vertical laser from WFZ
  76475. ; ----------------------------------------------------------------------------
  76476. ; Sprite_3B8A6:
  76477. ObjB7:
  76478. moveq #0,d0
  76479. move.b routine(a0),d0
  76480. move.w ObjB7_Index(pc,d0.w),d1
  76481. jmp ObjB7_Index(pc,d1.w)
  76482. ; ===========================================================================
  76483. ; off_3B8B4:
  76484. ObjB7_Index: offsetTable
  76485. offsetTableEntry.w ObjB7_Init ; 0
  76486. offsetTableEntry.w ObjB7_Main ; 2
  76487. ; ===========================================================================
  76488. ; loc_3B8B8:
  76489. ObjB7_Init:
  76490. bsr.w LoadSubObject
  76491. move.b #$20,objoff_2A(a0)
  76492. rts
  76493. ; ===========================================================================
  76494. ; loc_3B8C4:
  76495. ObjB7_Main:
  76496. subq.b #1,objoff_2A(a0)
  76497. beq.w JmpTo65_DeleteObject
  76498. bchg #0,objoff_2B(a0)
  76499. beq.w return_37A48
  76500. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76501. ; ===========================================================================
  76502. ; off_3B8DA:
  76503. ObjB7_SubObjData:
  76504. subObjData ObjB7_MapUnc_3B8E4,make_art_tile(ArtTile_ArtNem_WfzVrtclLazer,2,1),4,4,$18,$A9
  76505. ObjB7_MapUnc_3B8E4: BINCLUDE "mappings/sprite/objB7.bin"
  76506.  
  76507. ; ===========================================================================
  76508. ; ----------------------------------------------------------------------------
  76509. ; Object B8 - Wall turret from WFZ
  76510. ; ----------------------------------------------------------------------------
  76511. ; Sprite_3B968:
  76512. ObjB8:
  76513. moveq #0,d0
  76514. move.b routine(a0),d0
  76515. move.w ObjB8_Index(pc,d0.w),d1
  76516. jmp ObjB8_Index(pc,d1.w)
  76517. ; ===========================================================================
  76518. ; off_3B976:
  76519. ObjB8_Index: offsetTable
  76520. offsetTableEntry.w ObjB8_Init ; 0
  76521. offsetTableEntry.w loc_3B980 ; 2
  76522. offsetTableEntry.w loc_3B9AA ; 4
  76523. ; ===========================================================================
  76524. ; BranchTo5_LoadSubObject
  76525. ObjB8_Init:
  76526. bra.w LoadSubObject
  76527. ; ===========================================================================
  76528.  
  76529. loc_3B980:
  76530. tst.b render_flags(a0)
  76531. bpl.s +
  76532. bsr.w Obj_GetOrientationToPlayer
  76533. tst.w d1
  76534. beq.s +
  76535. addi.w #$60,d2
  76536. cmpi.w #$C0,d2
  76537. blo.s ++
  76538. +
  76539. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76540. ; ===========================================================================
  76541. +
  76542. addq.b #2,routine(a0)
  76543. move.w #2,objoff_2A(a0)
  76544. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76545. ; ===========================================================================
  76546.  
  76547. loc_3B9AA:
  76548. bsr.w Obj_GetOrientationToPlayer
  76549. moveq #0,d6
  76550. addi.w #$20,d2
  76551. cmpi.w #$40,d2
  76552. blo.s loc_3B9C0
  76553. move.w d0,d6
  76554. lsr.w #1,d6
  76555. addq.w #1,d6
  76556.  
  76557. loc_3B9C0:
  76558. move.b d6,mapping_frame(a0)
  76559. subq.w #1,objoff_2A(a0)
  76560. bne.s +
  76561. move.w #$60,objoff_2A(a0)
  76562. bsr.w loc_3B9D8
  76563. +
  76564. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76565. ; ===========================================================================
  76566.  
  76567. loc_3B9D8:
  76568. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  76569. bne.s + ; rts
  76570. _move.b #ObjID_Projectile,id(a1) ; load obj98
  76571. move.b #3,mapping_frame(a1)
  76572. move.b #$8E,subtype(a1) ; <== ObjB8_SubObjData2
  76573. move.w x_pos(a0),x_pos(a1)
  76574. move.w y_pos(a0),y_pos(a1)
  76575. lea_ Obj98_WallTurretShotMove,a2
  76576. move.l a2,objoff_2A(a1)
  76577. moveq #0,d0
  76578. move.b mapping_frame(a0),d0
  76579. lsl.w #2,d0
  76580. lea byte_3BA2A(pc,d0.w),a2
  76581. move.b (a2)+,d0
  76582. ext.w d0
  76583. add.w d0,x_pos(a1)
  76584. move.b (a2)+,d0
  76585. ext.w d0
  76586. add.w d0,y_pos(a1)
  76587. move.b (a2)+,x_vel(a1)
  76588. move.b (a2)+,y_vel(a1)
  76589. +
  76590. rts
  76591. ; ===========================================================================
  76592. byte_3BA2A:
  76593. dc.b 0
  76594. dc.b $18 ; 1
  76595. dc.b 0 ; 2
  76596. dc.b 1 ; 3
  76597. dc.b $EF ; 4
  76598. dc.b $10 ; 5
  76599. dc.b $FF ; 6
  76600. dc.b 1 ; 7
  76601. dc.b $11 ; 8
  76602. dc.b $10 ; 9
  76603. dc.b 1 ; 10
  76604. dc.b 1 ; 11
  76605. ; off_3BA36:
  76606. ObjB8_SubObjData:
  76607. subObjData ObjB8_Obj98_MapUnc_3BA46,make_art_tile(ArtTile_ArtNem_WfzWallTurret,0,0),4,4,$10,0
  76608. ; animation script
  76609. ; off_3BA40:
  76610. Ani_WallTurretShot: offsetTable
  76611. offsetTableEntry.w + ; 0
  76612. + dc.b 2, 3, 4,$FF
  76613. even
  76614. ; ----------------------------------------------------------------------------
  76615. ; sprite mappings
  76616. ; ----------------------------------------------------------------------------
  76617. ObjB8_Obj98_MapUnc_3BA46: BINCLUDE "mappings/sprite/objB8.bin"
  76618. ; ===========================================================================
  76619. ; ----------------------------------------------------------------------------
  76620. ; Object B9 - Laser from WFZ that shoots down the Tornado
  76621. ; ----------------------------------------------------------------------------
  76622. ; Sprite_3BABA:
  76623. ObjB9:
  76624. moveq #0,d0
  76625. move.b routine(a0),d0
  76626. move.w ObjB9_Index(pc,d0.w),d1
  76627. jmp ObjB9_Index(pc,d1.w)
  76628. ; ===========================================================================
  76629. ; off_3BAC8:
  76630. ObjB9_Index: offsetTable
  76631. offsetTableEntry.w ObjB9_Init
  76632. offsetTableEntry.w loc_3BAD2
  76633. offsetTableEntry.w loc_3BAF0
  76634. ; ===========================================================================
  76635. ; BranchTo6_LoadSubObject
  76636. ObjB9_Init:
  76637. bra.w LoadSubObject
  76638. ; ===========================================================================
  76639.  
  76640. loc_3BAD2:
  76641. tst.b render_flags(a0)
  76642. bmi.s +
  76643. bra.w loc_3BAF8
  76644. ; ===========================================================================
  76645. +
  76646. addq.b #2,routine(a0)
  76647. move.w #-$1000,x_vel(a0)
  76648. moveq #SndID_LargeLaser,d0
  76649. jsrto (PlaySound).l, JmpTo12_PlaySound
  76650. bra.w loc_3BAF8
  76651. ; ===========================================================================
  76652.  
  76653. loc_3BAF0:
  76654. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  76655. bra.w loc_3BAF8
  76656. loc_3BAF8:
  76657. move.w x_pos(a0),d0
  76658. move.w (Camera_X_pos).w,d1
  76659. subi.w #$40,d1
  76660. cmp.w d1,d0
  76661. blt.w JmpTo65_DeleteObject
  76662. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  76663. ; ===========================================================================
  76664. ; off_3BB0E:
  76665. ObjB9_SubObjData:
  76666. subObjData ObjB9_MapUnc_3BB18,make_art_tile(ArtTile_ArtNem_WfzHrzntlLazer,2,1),4,1,$60,0
  76667. ; ----------------------------------------------------------------------------
  76668. ; sprite mappings
  76669. ; ----------------------------------------------------------------------------
  76670. ObjB9_MapUnc_3BB18: BINCLUDE "mappings/sprite/objB9.bin"
  76671. ; ===========================================================================
  76672. ; ----------------------------------------------------------------------------
  76673. ; Object BA - Wheel from WFZ
  76674. ; ----------------------------------------------------------------------------
  76675. ; Sprite_3BB4C:
  76676. ObjBA:
  76677. moveq #0,d0
  76678. move.b routine(a0),d0
  76679. move.w ObjBA_Index(pc,d0.w),d1
  76680. jmp ObjBA_Index(pc,d1.w)
  76681. ; ===========================================================================
  76682. ; off_3BB5A:
  76683. ObjBA_Index: offsetTable
  76684. offsetTableEntry.w ObjBA_Init ; 0
  76685. offsetTableEntry.w ObjBA_Main ; 2
  76686. ; ===========================================================================
  76687. ; BranchTo7_LoadSubObject
  76688. ObjBA_Init:
  76689. bra.w LoadSubObject
  76690. ; ===========================================================================
  76691. ; BranchTo14_JmpTo39_MarkObjGone
  76692. ObjBA_Main:
  76693. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76694. ; ===========================================================================
  76695. ; off_3BB66:
  76696. ObjBA_SubObjData:
  76697. subObjData ObjBA_MapUnc_3BB70,make_art_tile(ArtTile_ArtNem_WfzConveyorBeltWheel,2,1),4,4,$10,0
  76698. ; ----------------------------------------------------------------------------
  76699. ; sprite mappings
  76700. ; ----------------------------------------------------------------------------
  76701. ObjBA_MapUnc_3BB70: BINCLUDE "mappings/sprite/objBA.bin"
  76702. ; ===========================================================================
  76703. ; ----------------------------------------------------------------------------
  76704. ; Object BB - Removed object (unknown, unused)
  76705. ; ----------------------------------------------------------------------------
  76706. ; Sprite_3BB7C:
  76707. ObjBB:
  76708. moveq #0,d0
  76709. move.b routine(a0),d0
  76710. move.w ObjBB_Index(pc,d0.w),d1
  76711. jmp ObjBB_Index(pc,d1.w)
  76712. ; ===========================================================================
  76713. ; off_3BB8A:
  76714. ObjBB_Index: offsetTable
  76715. offsetTableEntry.w ObjBB_Init ; 0
  76716. offsetTableEntry.w ObjBB_Main ; 2
  76717. ; ===========================================================================
  76718. ; BranchTo8_LoadSubObject
  76719. ObjBB_Init:
  76720. bra.w LoadSubObject
  76721. ; ===========================================================================
  76722. ; BranchTo15_JmpTo39_MarkObjGone
  76723. ObjBB_Main:
  76724. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76725. ; ===========================================================================
  76726. ; off_3BB96:
  76727. ObjBB_SubObjData:
  76728. subObjData ObjBB_MapUnc_3BBA0,make_art_tile(ArtTile_ArtNem_Unknown,1,0),4,4,$C,9
  76729. ; ----------------------------------------------------------------------------
  76730. ; sprite mappings
  76731. ; ----------------------------------------------------------------------------
  76732. ObjBB_MapUnc_3BBA0: BINCLUDE "mappings/sprite/objBB.bin"
  76733. ; ===========================================================================
  76734. ; ----------------------------------------------------------------------------
  76735. ; Object BC - Fire coming out of Robotnik's ship in WFZ
  76736. ; ----------------------------------------------------------------------------
  76737. ; Sprite_3BBBC:
  76738. ObjBC:
  76739. moveq #0,d0
  76740. move.b routine(a0),d0
  76741. move.w ObjBC_Index(pc,d0.w),d1
  76742. jmp ObjBC_Index(pc,d1.w)
  76743. ; ===========================================================================
  76744. ; off_3BBCA:
  76745. ObjBC_Index: offsetTable
  76746. offsetTableEntry.w ObjBC_Init
  76747. offsetTableEntry.w ObjBC_Main
  76748. ; ===========================================================================
  76749. ; loc_3BBCE:
  76750. ObjBC_Init:
  76751. bsr.w LoadSubObject
  76752. move.w x_pos(a0),objoff_2C(a0)
  76753. rts
  76754. ; ===========================================================================
  76755. ; loc_3BBDA:
  76756. ObjBC_Main:
  76757. move.w objoff_2C(a0),d0
  76758. move.w (Camera_BG_X_offset).w,d1
  76759. cmpi.w #$380,d1
  76760. bhs.w JmpTo65_DeleteObject
  76761. add.w d1,d0
  76762. move.w d0,x_pos(a0)
  76763. bchg #0,objoff_2A(a0)
  76764. beq.w return_37A48
  76765. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  76766. ; ===========================================================================
  76767. ; off_3BBFE:
  76768. ObjBC_SubObjData2:
  76769. subObjData ObjBC_MapUnc_3BC08,make_art_tile(ArtTile_ArtNem_WfzThrust,2,0),4,4,$10,0
  76770. ; ----------------------------------------------------------------------------
  76771. ; sprite mappings
  76772. ; ----------------------------------------------------------------------------
  76773. ObjBC_MapUnc_3BC08: BINCLUDE "mappings/sprite/objBC.bin"
  76774. ; ===========================================================================
  76775. ; ----------------------------------------------------------------------------
  76776. ; Object BD - Ascending/descending metal platforms from WFZ
  76777. ; ----------------------------------------------------------------------------
  76778. ; Sprite_3BC1C:
  76779. ObjBD:
  76780. moveq #0,d0
  76781. move.b routine(a0),d0
  76782. move.w ObjBD_Index(pc,d0.w),d1
  76783. jmp ObjBD_Index(pc,d1.w)
  76784. ; ===========================================================================
  76785. ; off_3BC2A:
  76786. ObjBD_Index: offsetTable
  76787. offsetTableEntry.w ObjBD_Init ; 0
  76788. offsetTableEntry.w loc_3BC3C ; 2
  76789. offsetTableEntry.w loc_3BC50 ; 4
  76790. ; ===========================================================================
  76791. ; loc_3BC30:
  76792. ObjBD_Init:
  76793. addq.b #2,routine(a0)
  76794. move.w #1,objoff_2A(a0)
  76795. rts
  76796. ; ===========================================================================
  76797.  
  76798. loc_3BC3C:
  76799. subq.w #1,objoff_2A(a0)
  76800. bne.s +
  76801. move.w #$40,objoff_2A(a0)
  76802. bsr.w loc_3BCF8
  76803. +
  76804. jmpto (MarkObjGone3).l, JmpTo8_MarkObjGone3
  76805. ; ===========================================================================
  76806.  
  76807. loc_3BC50:
  76808. moveq #0,d0
  76809. move.b routine_secondary(a0),d0
  76810. move.w off_3BC62(pc,d0.w),d1
  76811. jsr off_3BC62(pc,d1.w)
  76812. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76813. ; ===========================================================================
  76814. off_3BC62: offsetTable
  76815. offsetTableEntry.w loc_3BC6C ; 0
  76816. offsetTableEntry.w loc_3BCAC ; 2
  76817. offsetTableEntry.w loc_3BCB6 ; 4
  76818. offsetTableEntry.w loc_3BCCC ; 6
  76819. offsetTableEntry.w loc_3BCD6 ; 8
  76820. ; ===========================================================================
  76821.  
  76822. loc_3BC6C:
  76823. bsr.w LoadSubObject
  76824. move.b #2,mapping_frame(a0)
  76825. subq.b #2,routine(a0)
  76826. addq.b #2,routine_secondary(a0)
  76827. move.w #$C7,objoff_2A(a0)
  76828. btst #0,render_flags(a0)
  76829. beq.s loc_3BC92
  76830. move.w #$1C7,objoff_2A(a0)
  76831.  
  76832. loc_3BC92:
  76833. moveq #0,d0
  76834. move.b subtype(a0),d0
  76835. subi.b #$7E,d0
  76836. move.b d0,subtype(a0)
  76837. move.w word_3BCA8(pc,d0.w),y_vel(a0)
  76838. rts
  76839. ; ===========================================================================
  76840. word_3BCA8:
  76841. dc.w -$100
  76842. dc.w $100 ; 1
  76843. ; ===========================================================================
  76844.  
  76845. loc_3BCAC:
  76846. lea (Ani_objBD).l,a1
  76847. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  76848. ; ===========================================================================
  76849.  
  76850. loc_3BCB6:
  76851. subq.w #1,objoff_2A(a0)
  76852. bmi.s loc_3BCC0
  76853. bra.w loc_3BCDE
  76854. ; ===========================================================================
  76855.  
  76856. loc_3BCC0:
  76857. addq.b #2,routine_secondary(a0)
  76858. move.b #1,anim(a0)
  76859. rts
  76860. ; ===========================================================================
  76861.  
  76862. loc_3BCCC:
  76863. lea (Ani_objBD).l,a1
  76864. jmpto (AnimateSprite).l, JmpTo25_AnimateSprite
  76865. ; ===========================================================================
  76866.  
  76867. loc_3BCD6:
  76868. bsr.w loc_3B7BC
  76869. bra.w JmpTo65_DeleteObject
  76870. ; ===========================================================================
  76871.  
  76872. loc_3BCDE:
  76873. move.w x_pos(a0),-(sp)
  76874. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  76875. move.w #$23,d1
  76876. move.w #4,d2
  76877. move.w #5,d3
  76878. move.w (sp)+,d4
  76879. jmpto (PlatformObject).l, JmpTo9_PlatformObject
  76880. ; ===========================================================================
  76881.  
  76882. loc_3BCF8:
  76883. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  76884. bne.s + ; rts
  76885. _move.b #ObjID_SmallMetalPform,id(a1) ; load objBD
  76886. move.w x_pos(a0),x_pos(a1)
  76887. move.w y_pos(a0),y_pos(a1)
  76888. move.b #4,routine(a1)
  76889. move.b subtype(a0),subtype(a1)
  76890. move.b render_flags(a0),render_flags(a1)
  76891. +
  76892. rts
  76893. ; ===========================================================================
  76894. ; off_3BD24:
  76895. ObjBD_SubObjData:
  76896. subObjData ObjBD_MapUnc_3BD3E,make_art_tile(ArtTile_ArtNem_WfzBeltPlatform,3,1),4,4,$18,0
  76897. ; animation script
  76898. ; off_3BD2E:
  76899. Ani_objBD: offsetTable
  76900. offsetTableEntry.w byte_3BD32 ; 0
  76901. offsetTableEntry.w byte_3BD38 ; 1
  76902. byte_3BD32: dc.b 3, 2, 1, 0,$FA, 0
  76903. byte_3BD38: dc.b 1, 0, 1, 2,$FA
  76904. even
  76905. ; ----------------------------------------------------------------------------
  76906. ; sprite mappings
  76907. ; ----------------------------------------------------------------------------
  76908. ObjBD_MapUnc_3BD3E: BINCLUDE "mappings/sprite/objBD.bin"
  76909. ; ===========================================================================
  76910. ; ----------------------------------------------------------------------------
  76911. ; Object BE - Lateral cannon (temporary platform that pops in/out) from WFZ
  76912. ; ----------------------------------------------------------------------------
  76913. ; Sprite_3BD7A:
  76914. ObjBE:
  76915. moveq #0,d0
  76916. move.b routine(a0),d0
  76917. move.w ObjBE_Index(pc,d0.w),d1
  76918. jmp ObjBE_Index(pc,d1.w)
  76919. ; ===========================================================================
  76920. ; off_3BD88:
  76921. ObjBE_Index: offsetTable
  76922. offsetTableEntry.w ObjBE_Init ; 0
  76923. offsetTableEntry.w loc_3BDA2 ; 2
  76924. offsetTableEntry.w loc_3BDC6 ; 4
  76925. offsetTableEntry.w loc_3BDD4 ; 6
  76926. offsetTableEntry.w loc_3BDC6 ; 8
  76927. offsetTableEntry.w loc_3BDF4 ; $A
  76928. ; ===========================================================================
  76929. ; loc_3BD94:
  76930. ObjBE_Init:
  76931. moveq #0,d0
  76932. move.b #($41<<1),d0
  76933. bsr.w LoadSubObject_Part2
  76934. bra.w loc_3B77E
  76935. ; ===========================================================================
  76936.  
  76937. loc_3BDA2:
  76938. move.b (Vint_runcount+3).w,d0
  76939. andi.b #$F0,d0
  76940. cmp.b subtype(a0),d0
  76941. beq.s +
  76942. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76943. ; ---------------------------------------------------------------------------
  76944. +
  76945. addq.b #2,routine(a0)
  76946. clr.b anim(a0)
  76947. move.w #$A0,objoff_2A(a0)
  76948. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76949. ; ===========================================================================
  76950.  
  76951. loc_3BDC6:
  76952. lea (Ani_objBE).l,a1
  76953. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  76954. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76955. ; ===========================================================================
  76956.  
  76957. loc_3BDD4:
  76958. subq.w #1,objoff_2A(a0)
  76959. beq.s +
  76960. bsr.w loc_3BE04
  76961. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76962. ; ---------------------------------------------------------------------------
  76963. +
  76964. addq.b #2,routine(a0)
  76965. move.b #1,anim(a0)
  76966. bsr.w loc_3B7BC
  76967. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76968. ; ===========================================================================
  76969.  
  76970. loc_3BDF4:
  76971. move.b #2,routine(a0)
  76972. move.w #$40,objoff_2A(a0)
  76973. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  76974. ; ===========================================================================
  76975.  
  76976. loc_3BE04:
  76977. move.b mapping_frame(a0),d0
  76978. cmpi.b #3,d0
  76979. beq.s +
  76980. cmpi.b #4,d0
  76981. bne.w loc_3B7BC
  76982. +
  76983. move.w x_pos(a0),-(sp)
  76984. move.w #$23,d1
  76985. move.w #$18,d2
  76986. move.w #$19,d3
  76987. move.w (sp)+,d4
  76988. jmpto (PlatformObject).l, JmpTo9_PlatformObject
  76989. ; ===========================================================================
  76990. ; off_3BE2C:
  76991. ObjBE_SubObjData:
  76992. subObjData ObjBE_MapUnc_3BE46,make_art_tile(ArtTile_ArtNem_WfzGunPlatform,3,1),4,4,$18,0
  76993. ; animation script
  76994. ; off_3BE36:
  76995. Ani_objBE: offsetTable
  76996. offsetTableEntry.w byte_3BE3A ; 0
  76997. offsetTableEntry.w byte_3BE40 ; 1
  76998. byte_3BE3A: dc.b 5, 0, 1, 2, 3,$FC
  76999. byte_3BE40: dc.b 5, 3, 2, 1, 0,$FC
  77000. even
  77001. ; ----------------------------------------------------------------------------
  77002. ; sprite mappings
  77003. ; ----------------------------------------------------------------------------
  77004. ObjBE_MapUnc_3BE46: BINCLUDE "mappings/sprite/objBE.bin"
  77005. ; ===========================================================================
  77006. ; ----------------------------------------------------------------------------
  77007. ; Object BF - Rotaty-stick badnik from WFZ
  77008. ; ----------------------------------------------------------------------------
  77009. ; Sprite_3BEAA:
  77010. ObjBF:
  77011. moveq #0,d0
  77012. move.b routine(a0),d0
  77013. move.w ObjBF_Index(pc,d0.w),d1
  77014. jmp ObjBF_Index(pc,d1.w)
  77015. ; ===========================================================================
  77016. ; off_3BEB8:
  77017. ObjBF_Index: offsetTable
  77018. offsetTableEntry.w ObjBF_Init ; 0
  77019. offsetTableEntry.w ObjBF_Animate ; 2
  77020. ; ===========================================================================
  77021. ; BranchTo9_LoadSubObject
  77022. ObjBF_Init:
  77023. bra.w LoadSubObject
  77024. ; ===========================================================================
  77025. ; loc_3BEC0:
  77026. ObjBF_Animate:
  77027. lea (Ani_objBF).l,a1
  77028. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  77029. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  77030. ; ===========================================================================
  77031. ; off_3BECE:
  77032. ObjBE_SubObjData2:
  77033. subObjData ObjBF_MapUnc_3BEE0,make_art_tile(ArtTile_ArtNem_WfzUnusedBadnik,3,1),4,4,4,4
  77034. ; animation script
  77035. ; off_3BED8:
  77036. Ani_objBF: offsetTable
  77037. offsetTableEntry.w + ; 0
  77038. + dc.b 1, 0, 1, 2,$FF
  77039. even
  77040. ; ----------------------------------------------------------------------------
  77041. ; sprite mappings
  77042. ; ----------------------------------------------------------------------------
  77043. ObjBF_MapUnc_3BEE0: BINCLUDE "mappings/sprite/objBF.bin"
  77044. ; ===========================================================================
  77045. ; ----------------------------------------------------------------------------
  77046. ; Object C0 - Speed launcher from WFZ
  77047. ; ----------------------------------------------------------------------------
  77048. ; Sprite_3BF04:
  77049. ObjC0:
  77050. moveq #0,d0
  77051. move.b routine(a0),d0
  77052. move.w ObjC0_Index(pc,d0.w),d1
  77053. jmp ObjC0_Index(pc,d1.w)
  77054. ; ===========================================================================
  77055. ; off_3BF12:
  77056. ObjC0_Index: offsetTable
  77057. offsetTableEntry.w ObjC0_Init ; 0
  77058. offsetTableEntry.w ObjC0_Main ; 2
  77059. ; ===========================================================================
  77060. ; loc_3BF16:
  77061. ObjC0_Init:
  77062. move.w #($43<<1),d0
  77063. bsr.w LoadSubObject_Part2
  77064. moveq #0,d0
  77065. move.b subtype(a0),d0
  77066. lsl.w #4,d0
  77067. btst #0,status(a0)
  77068. bne.s +
  77069. neg.w d0
  77070. +
  77071. move.w x_pos(a0),d1
  77072. move.w d1,objoff_34(a0)
  77073. add.w d1,d0
  77074. move.w d0,objoff_32(a0)
  77075. ; loc_3BF3E:
  77076. ObjC0_Main:
  77077. moveq #0,d0
  77078. move.b routine_secondary(a0),d0
  77079. move.w off_3BF60(pc,d0.w),d1
  77080. jsr off_3BF60(pc,d1.w)
  77081. move.w #$10,d1
  77082. move.w #$11,d3
  77083. move.w x_pos(a0),d4
  77084. jsrto (PlatformObject).l, JmpTo9_PlatformObject
  77085. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  77086. ; ===========================================================================
  77087. off_3BF60: offsetTable
  77088. offsetTableEntry.w loc_3BF66
  77089. offsetTableEntry.w loc_3BFD8
  77090. offsetTableEntry.w loc_3C062
  77091. ; ===========================================================================
  77092.  
  77093. loc_3BF66:
  77094. move.b status(a0),d0
  77095. andi.b #standing_mask,d0
  77096. beq.s +++ ; rts
  77097. addq.b #2,routine_secondary(a0)
  77098. move.w #$C00,x_vel(a0)
  77099. move.w #$80,objoff_30(a0)
  77100. btst #0,status(a0)
  77101. bne.s +
  77102. neg.w x_vel(a0)
  77103. neg.w objoff_30(a0)
  77104. +
  77105. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  77106. move.b status(a0),d0
  77107. move.b d0,d1
  77108. andi.b #p1_standing,d1
  77109. beq.s +
  77110. lea (MainCharacter).w,a1 ; a1=character
  77111. bsr.s loc_3BFB4
  77112. +
  77113. andi.b #p2_standing,d0
  77114. beq.s + ; rts
  77115. lea (Sidekick).w,a1 ; a1=character
  77116. bsr.s loc_3BFB4
  77117. +
  77118. rts
  77119. ; ===========================================================================
  77120.  
  77121. loc_3BFB4:
  77122. clr.w inertia(a1)
  77123. clr.w x_vel(a1)
  77124. move.w x_pos(a0),x_pos(a1)
  77125. bclr #0,status(a1)
  77126. btst #0,status(a0)
  77127. bne.s +
  77128. bset #0,status(a1)
  77129. +
  77130. rts
  77131. ; ===========================================================================
  77132.  
  77133. loc_3BFD8:
  77134. move.w objoff_30(a0),d0
  77135. add.w d0,x_vel(a0)
  77136. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  77137. move.w objoff_32(a0),d0
  77138. sub.w x_pos(a0),d0
  77139. btst #0,status(a0)
  77140. beq.s +
  77141. neg.w d0
  77142. +
  77143. tst.w d0
  77144. bpl.s loc_3C034
  77145. move.b status(a0),d0
  77146. andi.b #standing_mask,d0
  77147. beq.s return_3C01E
  77148. move.b d0,d1
  77149. andi.b #p1_standing,d1
  77150. beq.s +
  77151. lea (MainCharacter).w,a1 ; a1=character
  77152. bsr.s loc_3BFB4
  77153. +
  77154. andi.b #p2_standing,d0
  77155. beq.s return_3C01E
  77156. lea (Sidekick).w,a1 ; a1=character
  77157. bsr.s loc_3BFB4
  77158.  
  77159. return_3C01E:
  77160. rts
  77161. ; ===========================================================================
  77162.  
  77163. loc_3C020:
  77164. move.w x_vel(a0),x_vel(a1)
  77165. move.w #-$400,y_vel(a1)
  77166. bset #1,status(a1)
  77167. rts
  77168. ; ===========================================================================
  77169.  
  77170. loc_3C034:
  77171. addq.b #2,routine_secondary(a0)
  77172. move.w objoff_32(a0),x_pos(a0)
  77173. move.b status(a0),d0
  77174. andi.b #standing_mask,d0
  77175. beq.s loc_3C062
  77176. move.b d0,d1
  77177. andi.b #p1_standing,d1
  77178. beq.s loc_3C056
  77179. lea (MainCharacter).w,a1 ; a1=character
  77180. bsr.s loc_3C020
  77181.  
  77182. loc_3C056:
  77183. andi.b #p2_standing,d0
  77184. beq.s loc_3C062
  77185. lea (Sidekick).w,a1 ; a1=character
  77186. bsr.s loc_3C020
  77187.  
  77188. loc_3C062:
  77189. move.w x_pos(a0),d0
  77190. moveq #4,d1
  77191. tst.w objoff_30(a0) ; if objoff_30(a0) is positive,
  77192. spl d2 ; then set d2 to $FF, else set d2 to $00
  77193. bmi.s +
  77194. neg.w d1
  77195. +
  77196. add.w d1,d0
  77197. cmp.w objoff_34(a0),d0
  77198. bhs.s +
  77199. not.b d2
  77200. +
  77201. tst.b d2
  77202. bne.s +
  77203. clr.b routine_secondary(a0)
  77204. move.w objoff_34(a0),d0
  77205. +
  77206. move.w d0,x_pos(a0)
  77207. rts
  77208. ; ===========================================================================
  77209. ; off_3C08E:
  77210. ObjC0_SubObjData:
  77211. subObjData ObjC0_MapUnc_3C098,make_art_tile(ArtTile_ArtNem_WfzLaunchCatapult,1,0),4,4,$10,0
  77212. ; ----------------------------------------------------------------------------
  77213. ; sprite mappings
  77214. ; ----------------------------------------------------------------------------
  77215. ObjC0_MapUnc_3C098: BINCLUDE "mappings/sprite/objC0.bin"
  77216. ; ===========================================================================
  77217. ; ----------------------------------------------------------------------------
  77218. ; Object C1 - Breakable plating from WFZ
  77219. ; (and what sonic hangs onto on the back of Robotnic's getaway ship)
  77220. ; ----------------------------------------------------------------------------
  77221. ; Sprite_3C0AC:
  77222. ObjC1:
  77223. moveq #0,d0
  77224. move.b routine(a0),d0
  77225. move.w ObjC1_Index(pc,d0.w),d1
  77226. jmp ObjC1_Index(pc,d1.w)
  77227. ; ===========================================================================
  77228. ; off_3C0BA:
  77229. ObjC1_Index: offsetTable
  77230. offsetTableEntry.w ObjC1_Init ; 0
  77231. offsetTableEntry.w ObjC1_Main ; 2
  77232. offsetTableEntry.w ObjC1_Breakup ; 4
  77233. ; ===========================================================================
  77234. ; loc_3C0C0:
  77235. ObjC1_Init:
  77236. move.w #($44<<1),d0
  77237. bsr.w LoadSubObject_Part2
  77238. moveq #0,d0
  77239. move.b subtype(a0),d0
  77240. mulu.w #$3C,d0
  77241. move.w d0,objoff_30(a0)
  77242.  
  77243. ObjC1_Main:
  77244. tst.b objoff_32(a0)
  77245. beq.s loc_3C140
  77246. tst.w objoff_30(a0)
  77247. beq.s +
  77248. subq.w #1,objoff_30(a0)
  77249. beq.s loc_3C12E
  77250. +
  77251. lea (MainCharacter).w,a1 ; a1=character
  77252. move.w y_pos(a0),d0
  77253. subi.w #$18,d0
  77254. btst #button_up,(Ctrl_1_Held).w
  77255. beq.s +
  77256. subq.w #1,y_pos(a1)
  77257. cmp.w y_pos(a1),d0
  77258. blo.s +
  77259. move.w d0,y_pos(a1)
  77260. +
  77261. addi.w #$30,d0
  77262. btst #button_down,(Ctrl_1_Held).w
  77263. beq.s +
  77264. addq.w #1,y_pos(a1)
  77265. cmp.w y_pos(a1),d0
  77266. bhs.s +
  77267. move.w d0,y_pos(a1)
  77268. +
  77269. move.b (Ctrl_1_Press_Logical).w,d0
  77270. andi.w #button_B_mask|button_C_mask|button_A_mask,d0
  77271. beq.s BranchTo16_JmpTo39_MarkObjGone
  77272.  
  77273. loc_3C12E:
  77274. clr.b collision_flags(a0)
  77275. clr.b (MainCharacter+obj_control).w
  77276. clr.b (WindTunnel_holding_flag).w
  77277. clr.b objoff_32(a0)
  77278. bra.s loc_3C19A
  77279. ; ===========================================================================
  77280.  
  77281. loc_3C140:
  77282. tst.b collision_property(a0)
  77283. beq.s BranchTo16_JmpTo39_MarkObjGone
  77284. lea (MainCharacter).w,a1 ; a1=character
  77285. move.w x_pos(a0),d0
  77286. subi.w #$14,d0
  77287. cmp.w x_pos(a1),d0
  77288. bhs.s BranchTo16_JmpTo39_MarkObjGone
  77289. clr.b collision_property(a0)
  77290. cmpi.b #4,routine(a1)
  77291. bhs.s BranchTo16_JmpTo39_MarkObjGone
  77292. clr.w x_vel(a1)
  77293. clr.w y_vel(a1)
  77294. move.w x_pos(a0),d0
  77295. subi.w #$14,d0
  77296. move.w d0,x_pos(a1)
  77297. bset #0,status(a1)
  77298. move.b #AniIDSonAni_Hang,anim(a1)
  77299. move.b #1,(MainCharacter+obj_control).w
  77300. move.b #1,(WindTunnel_holding_flag).w
  77301. move.b #1,objoff_32(a0)
  77302.  
  77303. BranchTo16_JmpTo39_MarkObjGone
  77304. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  77305. ; ===========================================================================
  77306.  
  77307. loc_3C19A:
  77308. lea (byte_3C1E4).l,a4
  77309. lea (byte_3C1E0).l,a2
  77310. bsr.w loc_3C1F4
  77311.  
  77312. ObjC1_Breakup:
  77313. tst.b objoff_3F(a0)
  77314. beq.s +
  77315. subq.b #1,objoff_3F(a0)
  77316. bra.s ++
  77317. ; ===========================================================================
  77318. +
  77319. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  77320. addi_.w #8,y_vel(a0)
  77321. lea (Ani_objC1).l,a1
  77322. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  77323. +
  77324. tst.b render_flags(a0)
  77325. bpl.w JmpTo65_DeleteObject
  77326. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77327. ; ===========================================================================
  77328. ; animation script
  77329. ; off_3C1D6:
  77330. Ani_objC1: offsetTable
  77331. offsetTableEntry.w + ; 0
  77332. + dc.b 3, 2, 3, 4, 5, 1,$FF
  77333. even
  77334.  
  77335. ; unknown
  77336. byte_3C1E0:
  77337. dc.b 0
  77338. dc.b 4 ; 1
  77339. dc.b $18 ; 2
  77340. dc.b $20 ; 3
  77341. byte_3C1E4:
  77342. dc.w -$10
  77343. dc.w -$10 ; 2
  77344. dc.w -$10 ; 4
  77345. dc.w $10 ; 6
  77346. dc.w -$30 ; 8
  77347. dc.w -$10 ; 10
  77348. dc.w -$30 ; 12
  77349. dc.w $10 ; 14
  77350. ; ===========================================================================
  77351.  
  77352. loc_3C1F4:
  77353. move.w x_pos(a0),d2
  77354. move.w y_pos(a0),d3
  77355. move.b priority(a0),d4
  77356. subq.b #1,d4
  77357. moveq #3,d1
  77358. movea.l a0,a1
  77359. bra.s loc_3C20E
  77360. ; ===========================================================================
  77361.  
  77362. loc_3C208:
  77363. jsrto (SingleObjLoad2).l, JmpTo25_SingleObjLoad2
  77364. bne.s loc_3C26C
  77365.  
  77366. loc_3C20E:
  77367. move.b #4,routine(a1)
  77368. _move.b id(a0),id(a1) ; load obj
  77369. move.l mappings(a0),mappings(a1)
  77370. move.w art_tile(a0),art_tile(a1)
  77371. move.b #$84,render_flags(a1)
  77372. move.w x_pos(a0),x_pos(a1)
  77373. move.w y_pos(a0),y_pos(a1)
  77374. move.w (a4)+,d0
  77375. add.w d2,d0
  77376. move.w d0,x_pos(a1)
  77377. move.w (a4)+,d0
  77378. add.w d3,d0
  77379. move.w d0,y_pos(a1)
  77380. move.b d4,priority(a1)
  77381. move.b #$10,width_pixels(a1)
  77382. move.b #1,mapping_frame(a1)
  77383. move.w #-$400,x_vel(a1)
  77384. move.w #0,y_vel(a1)
  77385. move.b (a2)+,objoff_3F(a1)
  77386. dbf d1,loc_3C208
  77387.  
  77388. loc_3C26C:
  77389. move.w #SndID_SlowSmash,d0
  77390. jmp (PlaySound).l
  77391. ; ===========================================================================
  77392. ; off_3C276:
  77393. ObjC1_SubObjData:
  77394. subObjData ObjC1_MapUnc_3C280,make_art_tile(ArtTile_ArtNem_BreakPanels,3,1),4,4,$40,$E1
  77395. ; ----------------------------------------------------------------------------
  77396. ; sprite mappings
  77397. ; ----------------------------------------------------------------------------
  77398. ObjC1_MapUnc_3C280: BINCLUDE "mappings/sprite/objC1.bin"
  77399. ; ===========================================================================
  77400. ; ----------------------------------------------------------------------------
  77401. ; Object C2 - Rivet thing you bust to get into ship at the end of WFZ
  77402. ; ----------------------------------------------------------------------------
  77403. ; Sprite_3C328:
  77404. ObjC2:
  77405. moveq #0,d0
  77406. move.b routine(a0),d0
  77407. move.w ObjC2_Index(pc,d0.w),d1
  77408. jmp ObjC2_Index(pc,d1.w)
  77409. ; ===========================================================================
  77410. ; off_3C336:
  77411. ObjC2_Index: offsetTable
  77412. offsetTableEntry.w ObjC2_Init ; 0
  77413. offsetTableEntry.w ObjC2_Main ; 2
  77414. ; ===========================================================================
  77415. ; BranchTo10_LoadSubObject
  77416. ObjC2_Init:
  77417. bra.w LoadSubObject
  77418. ; ===========================================================================
  77419. ; loc_3C33E:
  77420. ObjC2_Main:
  77421. move.b (MainCharacter+anim).w,objoff_30(a0)
  77422. move.w x_pos(a0),-(sp)
  77423. move.w #$1B,d1
  77424. move.w #8,d2
  77425. move.w #9,d3
  77426. move.w (sp)+,d4
  77427. jsrto (SolidObject).l, JmpTo27_SolidObject
  77428. btst #p1_standing_bit,status(a0)
  77429. bne.s ObjC2_Bust
  77430. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  77431. ; ===========================================================================
  77432. ; loc_3C366:
  77433. ObjC2_Bust:
  77434. cmpi.b #2,objoff_30(a0)
  77435. bne.s +
  77436. move.w #$2880,(Camera_Min_X_pos).w
  77437. bclr #p1_standing_bit,status(a0)
  77438. _move.b #ObjID_Explosion,id(a0) ; load 0bj27 (transform into explosion)
  77439. move.b #2,routine(a0)
  77440. bset #1,(MainCharacter+status).w
  77441. bclr #3,(MainCharacter+status).w
  77442. lea (Level_Layout+$850).w,a1 ; alter the level layout
  77443. move.l #$8A707172,(a1)+
  77444. move.w #$7374,(a1)+
  77445. lea (Level_Layout+$950).w,a1
  77446. move.l #$6E787978,(a1)+
  77447. move.w #$787A,(a1)+
  77448. move.b #1,(Screen_redraw_flag).w
  77449. +
  77450. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  77451. ; ===========================================================================
  77452. ; off_3C3B8:
  77453. ObjC2_SubObjData:
  77454. subObjData ObjC2_MapUnc_3C3C2,make_art_tile(ArtTile_ArtNem_WfzSwitch,1,1),4,4,$10,0
  77455. ; ----------------------------------------------------------------------------
  77456. ; sprite mappings
  77457. ; ----------------------------------------------------------------------------
  77458. ObjC2_MapUnc_3C3C2: BINCLUDE "mappings/sprite/objC2.bin"
  77459.  
  77460. Invalid_SubObjData2:
  77461.  
  77462. ; ===========================================================================
  77463. ; ----------------------------------------------------------------------------
  77464. ; Object C3,C4 - Plane's smoke from WFZ
  77465. ; ----------------------------------------------------------------------------
  77466. ; Sprite_3C3D6:
  77467. ObjC3:
  77468. moveq #0,d0
  77469. move.b routine(a0),d0
  77470. move.w ObjC3_Index(pc,d0.w),d1
  77471. jmp ObjC3_Index(pc,d1.w)
  77472. ; ===========================================================================
  77473. ; off_3C3E4:
  77474. ObjC3_Index: offsetTable
  77475. offsetTableEntry.w ObjC3_Init
  77476. offsetTableEntry.w ObjC3_Main
  77477. ; ===========================================================================
  77478. ; loc_3C3E8:
  77479. ObjC3_Init:
  77480. bsr.w LoadSubObject
  77481. move.b #7,anim_frame_duration(a0)
  77482. jsrto (RandomNumber).l, JmpTo6_RandomNumber
  77483. move.w (RNG_seed).w,d0
  77484. andi.w #$1C,d0
  77485. sub.w d0,x_pos(a0)
  77486. addi.w #$10,y_pos(a0)
  77487. move.w #-$100,y_vel(a0)
  77488. move.w #-$100,x_vel(a0)
  77489. rts
  77490. ; ===========================================================================
  77491. ; loc_3C416:
  77492. ObjC3_Main:
  77493. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  77494. subq.b #1,anim_frame_duration(a0)
  77495. bpl.s +
  77496. move.b #7,anim_frame_duration(a0)
  77497. addq.b #1,mapping_frame(a0)
  77498. cmpi.b #5,mapping_frame(a0)
  77499. beq.w JmpTo65_DeleteObject
  77500. +
  77501. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77502. ; ===========================================================================
  77503. ; off_3C438:
  77504. ObjC3_SubObjData:
  77505. subObjData Obj27_MapUnc_21120,make_art_tile(ArtTile_ArtNem_Explosion,0,0),4,5,$C,0
  77506. ; ===========================================================================
  77507. ; ----------------------------------------------------------------------------
  77508. ; Object C5 - WFZ boss
  77509. ; ----------------------------------------------------------------------------
  77510. ; Sprite_3C442:
  77511. ObjC5:
  77512. moveq #0,d0
  77513. move.b routine(a0),d0
  77514. move.w ObjC5_Index(pc,d0.w),d1
  77515. jmp ObjC5_Index(pc,d1.w)
  77516. ; ===========================================================================
  77517. ObjC5_Index: offsetTable
  77518. offsetTableEntry.w ObjC5_Init ; 0 - Main loading sequence
  77519. offsetTableEntry.w ObjC5_LaserCase ; 2 - Laser case (inside is laser)
  77520. offsetTableEntry.w ObjC5_LaserWall ; 4 - Laser wall
  77521. offsetTableEntry.w ObjC5_PlatformReleaser ; 6 - Platform releaser
  77522. offsetTableEntry.w ObjC5_Platform ; 8 - Platform
  77523. offsetTableEntry.w ObjC5_PlatformHurt ; $A - Invisible object that gets the platform's spikes to hurt sonic
  77524. offsetTableEntry.w ObjC5_LaserShooter ; $C - Laser shooter
  77525. offsetTableEntry.w ObjC5_Laser ; $E - Laser
  77526. offsetTableEntry.w ObjC5_Robotnik ; $10 - Robotnik
  77527. offsetTableEntry.w ObjC5_RobotnikPlatform ; $12 - Platform Robotnik's on
  77528. ; ===========================================================================
  77529.  
  77530. ObjC5_Init:
  77531. bsr.w LoadSubObject
  77532. move.b subtype(a0),d0
  77533. subi.b #$90,d0
  77534. move.b d0,routine(a0)
  77535. rts
  77536. ; ===========================================================================
  77537.  
  77538. ObjC5_LaserCase: ; also the "mother" object
  77539. moveq #0,d0
  77540. move.b routine_secondary(a0),d0
  77541. move.w ObjC5_CaseIndex(pc,d0.w),d1
  77542. jsr ObjC5_CaseIndex(pc,d1.w)
  77543. bra.w ObjC5_HandleHits
  77544. ; ===========================================================================
  77545. ObjC5_CaseIndex:offsetTable
  77546. offsetTableEntry.w ObjC5_CaseBoundary ; 0 - Sets up boundaries for movement and basic things
  77547. offsetTableEntry.w ObjC5_CaseWaitStart ; 2 - Waits for sonic to start
  77548. offsetTableEntry.w ObjC5_CaseWaitDown ; 4 - Waits to make the laser go down
  77549. offsetTableEntry.w ObjC5_CaseDown ; 6 - Moves the case down
  77550. offsetTableEntry.w ObjC5_CaseXSpeed ; 8 - Sets an X speed for the case
  77551. offsetTableEntry.w ObjC5_CaseBoundaryChk ; $A - Checks to make sure the case doesn't go through the boundaries
  77552. offsetTableEntry.w ObjC5_CaseAnimate ; $C - Animates the case (opening and closing)
  77553. offsetTableEntry.w ObjC5_CaseLSLoad ; $E - Laser shooter loading
  77554. offsetTableEntry.w ObjC5_CaseLSDown ; $10 - Moves the laser shooter down
  77555. offsetTableEntry.w ObjC5_CaseWaitLoadLaser ; $12 - Waits to load the laser
  77556. offsetTableEntry.w ObjC5_CaseWaitMove ; $14 - Waits to move (checks if laser is completely loaded (as big as it gets))
  77557. offsetTableEntry.w ObjC5_CaseBoundaryLaserChk ; $16 - Checks boundaries when moving with the laser
  77558. offsetTableEntry.w ObjC5_CaseLSUp ; $18 - wait for laser shooter to go back up
  77559. offsetTableEntry.w ObjC5_CaseAnimate ; $1A - Animates the case (opening and closing)
  77560. offsetTableEntry.w ObjC5_CaseStartOver ; $1C - Sets secondary routine to 8
  77561. offsetTableEntry.w ObjC5_CaseDefeated ; $1E - When defeated goes here (explosions and stuff)
  77562. ; ===========================================================================
  77563.  
  77564. ObjC5_CaseBoundary:
  77565. addq.b #2,routine_secondary(a0)
  77566. move.b #0,collision_flags(a0)
  77567. move.b #8,collision_property(a0) ; Hit points
  77568. move.w #$442,d0
  77569. move.w d0,(Camera_Max_Y_pos_now).w
  77570. move.w d0,(Camera_Max_Y_pos).w
  77571. move.w x_pos(a0),d0
  77572. subi.w #$60,d0 ; Max Left position
  77573. move.w d0,objoff_34(a0)
  77574. addi.w #$C0,d0 ; Max Right Position
  77575. move.w d0,objoff_36(a0)
  77576. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77577. ; ===========================================================================
  77578.  
  77579. ObjC5_CaseWaitStart:
  77580. bsr.w Obj_GetOrientationToPlayer
  77581. addi.w #$20,d2
  77582. cmpi.w #$40,d2 ; How far away sonic is to start the boss
  77583. blo.s ObjC5_CaseStart
  77584. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77585. ; ===========================================================================
  77586.  
  77587. ObjC5_CaseStart:
  77588. addq.b #2,routine_secondary(a0)
  77589. move.w #$40,y_vel(a0) ; Speed at which the laser carrier goes down
  77590. lea (ObjC5_LaserWallData).l,a2
  77591. bsr.w LoadChildObject
  77592. subi.w #$88,x_pos(a1) ; where to load the left laser wall (x)
  77593. addi.w #$60,y_pos(a1) ; left laser wall (y)
  77594. lea (ObjC5_LaserWallData).l,a2
  77595. bsr.w LoadChildObject
  77596. addi.w #$88,x_pos(a1) ; right laser wall (x)
  77597. addi.w #$60,y_pos(a1) ; right laser wall (y)
  77598. lea (ObjC5_LaserShooterData).l,a2
  77599. bsr.w LoadChildObject
  77600. lea (ObjC5_PlatformReleaserData).l,a2
  77601. bsr.w LoadChildObject
  77602. lea (ObjC5_RobotnikData).l,a2
  77603. bsr.w LoadChildObject
  77604. move.w #$5A,objoff_2A(a0) ; How long for the boss music to start playing and the boss to start
  77605. moveq #MusID_FadeOut,d0
  77606. jsrto (PlaySound).l, JmpTo12_PlaySound
  77607. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77608. ; ===========================================================================
  77609.  
  77610. ObjC5_CaseWaitDown:
  77611. subq.w #1,objoff_2A(a0)
  77612. bmi.s ObjC5_CaseSpeedDown
  77613. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77614. ; ===========================================================================
  77615.  
  77616. ObjC5_CaseSpeedDown:
  77617. addq.b #2,routine_secondary(a0)
  77618. move.w #$60,objoff_2A(a0) ; How long the laser carrier goes down
  77619. moveq #MusID_Boss,d0
  77620. jsrto (PlayMusic).l, JmpTo5_PlayMusic
  77621. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77622. ; ===========================================================================
  77623.  
  77624. ObjC5_CaseDown:
  77625. subq.w #1,objoff_2A(a0)
  77626. beq.s ObjC5_CaseStopDown
  77627. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  77628. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77629. ; ===========================================================================
  77630.  
  77631. ObjC5_CaseStopDown:
  77632. addq.b #2,routine_secondary(a0)
  77633. clr.w y_vel(a0) ; stop the laser carrier from going down
  77634. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77635. ; ===========================================================================
  77636.  
  77637. ObjC5_CaseXSpeed:
  77638. addq.b #2,routine_secondary(a0)
  77639. bsr.w Obj_GetOrientationToPlayer
  77640. move.w #$100,d1 ; Speed of carrier (when going back and forth before sending out laser)
  77641. tst.w d0
  77642. bne.s ObjC5_CasePMLoader
  77643. neg.w d1
  77644.  
  77645. ObjC5_CasePMLoader:
  77646. move.w d1,x_vel(a0)
  77647. bset #2,status(a0) ; makes the platform maker load
  77648. move.w #$70,objoff_2A(a0) ; how long to go back and forth before letting out laser
  77649. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77650. ; ===========================================================================
  77651.  
  77652. ObjC5_CaseBoundaryChk: ; waits and makes sure the carrier does not go beyond the limit
  77653. subq.w #1,objoff_2A(a0)
  77654. bmi.s ObjC5_CaseOpeningAnim
  77655. move.w x_pos(a0),d0
  77656. tst.w x_vel(a0)
  77657. bmi.s ObjC5_CaseBoundaryChk2
  77658. cmp.w objoff_36(a0),d0
  77659. bhs.s ObjC5_CaseNegSpeed
  77660. bra.w ObjC5_CaseMoveDisplay
  77661. ; ===========================================================================
  77662.  
  77663. ObjC5_CaseBoundaryChk2:
  77664. cmp.w objoff_34(a0),d0
  77665. bhs.s ObjC5_CaseMoveDisplay
  77666.  
  77667. ObjC5_CaseNegSpeed:
  77668. neg.w x_vel(a0)
  77669.  
  77670. ObjC5_CaseMoveDisplay:
  77671. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  77672. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77673. ; ===========================================================================
  77674.  
  77675. ObjC5_CaseOpeningAnim:
  77676. addq.b #2,routine_secondary(a0)
  77677. clr.b anim(a0)
  77678. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77679. ; ===========================================================================
  77680.  
  77681. ObjC5_CaseAnimate:
  77682. lea (Ani_objC5).l,a1
  77683. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  77684. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77685. ; ===========================================================================
  77686.  
  77687. ObjC5_CaseLSLoad: ; loads up the laser shooter (LS)
  77688. addq.b #2,routine_secondary(a0)
  77689. move.w #$E,objoff_2A(a0) ; Time the laser shooter moves down
  77690. movea.w objoff_3C(a0),a1 ; a1=object (laser shooter)
  77691. move.b #4,routine_secondary(a1)
  77692. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77693. ; ===========================================================================
  77694.  
  77695. ObjC5_CaseLSDown:
  77696. subq.w #1,objoff_2A(a0)
  77697. beq.s ObjC5_CaseAddCollision
  77698. movea.w objoff_3C(a0),a1 ; a1=object (laser shooter)
  77699. addq.w #1,y_pos(a1) ; laser shooter down speed
  77700. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77701. ; ===========================================================================
  77702.  
  77703. ObjC5_CaseAddCollision:
  77704. addq.b #2,routine_secondary(a0)
  77705. move.w #$40,objoff_2A(a0) ; Length before shooting laser
  77706. bset #4,status(a0) ; makes the hit sound and flashes happen only once when you hit it
  77707. bset #6,status(a0) ; makes sure collision gets restored
  77708. move.b #6,collision_flags(a0)
  77709. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77710. ; ===========================================================================
  77711.  
  77712. ObjC5_CaseWaitLoadLaser:
  77713. subq.w #1,objoff_2A(a0)
  77714. bmi.s ObjC5_CaseLoadLaser
  77715. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77716. ; ===========================================================================
  77717.  
  77718. ObjC5_CaseLoadLaser:
  77719. addq.b #2,routine_secondary(a0)
  77720. lea (ObjC5_LaserData).l,a2
  77721. bsr.w LoadChildObject ; loads laser
  77722. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77723. ; ===========================================================================
  77724.  
  77725. ObjC5_CaseWaitMove:
  77726. movea.w parent(a0),a1 ; a1=object
  77727. btst #2,status(a1) ; waits to check if laser fired
  77728. bne.s ObjC5_CaseLaserSpeed
  77729. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77730. ; ===========================================================================
  77731.  
  77732. ObjC5_CaseLaserSpeed:
  77733. addq.b #2,routine_secondary(a0)
  77734. move.w #$80,objoff_2A(a0) ; how long to move the laser
  77735. bsr.w Obj_GetOrientationToPlayer ; tests if sonic is to the right or left
  77736. move.w #$80,d1 ; Speed when moving with laser
  77737. tst.w d0
  77738. bne.s ObjC5_CaseLaserSpeedSet
  77739. neg.w d1
  77740.  
  77741. ObjC5_CaseLaserSpeedSet:
  77742. move.w d1,x_vel(a0)
  77743. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77744. ; ===========================================================================
  77745.  
  77746. ObjC5_CaseBoundaryLaserChk: ; make sure you stay in range when firing laser
  77747. subq.w #1,objoff_2A(a0)
  77748. bmi.s ObjC5_CaseStopLaserDelete
  77749. move.w x_pos(a0),d0
  77750. tst.w x_vel(a0)
  77751. bmi.s ObjC5_CaseBoundaryLaserChk2
  77752. cmp.w objoff_36(a0),d0
  77753. bhs.s ObjC5_CaseLaserStopMove
  77754. bra.w ObjC5_CaseLaserMoveDisplay
  77755. ; ===========================================================================
  77756.  
  77757. ObjC5_CaseBoundaryLaserChk2:
  77758. cmp.w objoff_34(a0),d0
  77759. bhs.s ObjC5_CaseLaserMoveDisplay
  77760.  
  77761. ObjC5_CaseLaserStopMove:
  77762. clr.w x_vel(a0) ; stop moving
  77763.  
  77764. ObjC5_CaseLaserMoveDisplay:
  77765. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  77766. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77767. ; ===========================================================================
  77768.  
  77769. ObjC5_CaseStopLaserDelete: ; stops collision and deletes laser
  77770. addq.b #2,routine_secondary(a0)
  77771. move.w #$E,objoff_2A(a0) ; time for laser shooter to move back up
  77772. bclr #3,status(a0)
  77773. bclr #4,status(a0)
  77774. bclr #6,status(a0)
  77775. clr.b collision_flags(a0) ; no more collision
  77776. movea.w parent(a0),a1 ; a1=object (laser)
  77777. jsrto (DeleteObject2).l, JmpTo6_DeleteObject2 ; delete the laser
  77778. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77779. ; ===========================================================================
  77780.  
  77781. ObjC5_CaseLSUp:
  77782. subq.w #1,objoff_2A(a0)
  77783. beq.s ObjC5_CaseClosingAnim
  77784. movea.w objoff_3C(a0),a1 ; a1=object (laser shooter)
  77785. subq.w #1,y_pos(a1)
  77786. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77787. ; ===========================================================================
  77788.  
  77789. ObjC5_CaseClosingAnim: ;sets which animation to do
  77790. addq.b #2,routine_secondary(a0)
  77791. move.b #1,anim(a0)
  77792. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77793. ; ===========================================================================
  77794.  
  77795. ObjC5_CaseStartOver:
  77796. move.b #8,routine_secondary(a0)
  77797. bsr.w ObjC5_CaseXSpeed
  77798. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77799. ; ===========================================================================
  77800.  
  77801. ObjC5_CaseDefeated:
  77802. clr.b collision_flags(a0)
  77803. st collision_property(a0)
  77804. bclr #6,status(a0)
  77805. subq.w #1,objoff_30(a0) ; timer
  77806. bmi.s ObjC5_End
  77807. jsrto (Boss_LoadExplosion).l, JmpTo_Boss_LoadExplosion
  77808. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77809. ; ===========================================================================
  77810.  
  77811. ObjC5_End: ; play music and change camera speed
  77812. moveq #MusID_WFZ,d0
  77813. jsrto (PlayMusic).l, JmpTo5_PlayMusic
  77814. move.w #$720,d0
  77815. move.w d0,(Camera_Max_Y_pos_now).w
  77816. move.w d0,(Camera_Max_Y_pos).w
  77817. bsr.w JmpTo65_DeleteObject
  77818. addq.w #4,sp
  77819. rts
  77820. ; ===========================================================================
  77821.  
  77822. ObjC5_LaserWall:
  77823. moveq #0,d0
  77824. move.b routine_secondary(a0),d0
  77825. move.w ObjC5_LaserWallIndex(pc,d0.w),d1
  77826. jsr ObjC5_LaserWallIndex(pc,d1.w)
  77827. tst.b (a0)
  77828. beq.w return_37A48
  77829. move.w x_pos(a0),-(sp)
  77830. move.w #$13,d1
  77831. move.w #$40,d2
  77832. move.w #$80,d3
  77833. move.w (sp)+,d4
  77834. jmpto (SolidObject).l, JmpTo27_SolidObject
  77835. ; ===========================================================================
  77836. ObjC5_LaserWallIndex: offsetTable
  77837. offsetTableEntry.w ObjC5_LaserWallMappings ; 0 - selects the mappings
  77838. offsetTableEntry.w ObjC5_LaserWallWaitDelete ; 2 - Waits till set to delete (when the boss is defeated)
  77839. offsetTableEntry.w ObjC5_LaserWallDelete ; 4 - After a little time it deletes
  77840. ; ===========================================================================
  77841.  
  77842. ObjC5_LaserWallMappings:
  77843. addq.b #2,routine_secondary(a0)
  77844. move.b #$C,mapping_frame(a0) ; loads the laser wall from the WFZ boss art
  77845. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77846. ; ===========================================================================
  77847.  
  77848. ObjC5_LaserWallWaitDelete:
  77849. movea.w objoff_2C(a0),a1 ; a1=object
  77850. btst #5,status(a1)
  77851. bne.s ObjC5_LaserWallTimerSet
  77852. bchg #0,objoff_2F(a0) ; makes it "flash" if set it won't flash
  77853. bne.w return_37A48
  77854. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77855. ; ===========================================================================
  77856.  
  77857. ObjC5_LaserWallTimerSet: ; sets a small timer
  77858. addq.b #2,routine_secondary(a0)
  77859. move.b #4,objoff_30(a0)
  77860. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77861. ; ===========================================================================
  77862.  
  77863. ObjC5_LaserWallDelete:
  77864. subq.b #1,anim_frame_duration(a0)
  77865. bpl.w return_37A48
  77866. move.b anim_frame_duration(a0),d0
  77867. move.b anim_frame(a0),d1
  77868. addq.b #2,d0
  77869. bpl.s ObjC5_LaserWallDisplay
  77870. move.b d1,anim_frame_duration(a0)
  77871. subq.b #1,objoff_30(a0)
  77872. bpl.s ObjC5_LaserWallDisplay
  77873. move.b #$10,objoff_30(a0)
  77874. addq.b #1,d1
  77875. cmpi.b #5,d1
  77876. bhs.w JmpTo65_DeleteObject
  77877. move.b d1,anim_frame(a0)
  77878. move.b d1,anim_frame_duration(a0)
  77879.  
  77880. ObjC5_LaserWallDisplay:
  77881. bclr #0,objoff_2F(a0)
  77882. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77883. ; ===========================================================================
  77884.  
  77885. ObjC5_PlatformReleaser:
  77886. moveq #0,d0
  77887. move.b routine_secondary(a0),d0
  77888. move.w ObjC5_PlatformReleaserIndex(pc,d0.w),d1
  77889. jmp ObjC5_PlatformReleaserIndex(pc,d1.w)
  77890. ; ===========================================================================
  77891. ObjC5_PlatformReleaserIndex: offsetTable
  77892. offsetTableEntry.w ObjC5_PlatformReleaserInit ; 0 - Load mappings and position
  77893. offsetTableEntry.w ObjC5_PlatformReleaserWaitDown ; 2 - Waits for laser case to move down
  77894. offsetTableEntry.w ObjC5_PlatformReleaserDown ; 4 - Goes down until time limit is up
  77895. offsetTableEntry.w ObjC5_PlatformReleaserLoadWait ; 6 - Waits to load the platforms (the interval of time between each is from this) and makes sure only 3 are loaded
  77896. offsetTableEntry.w ObjC5_PlatformReleaserDelete ; 8 - Explodes then deletes
  77897. ; ===========================================================================
  77898.  
  77899. ObjC5_PlatformReleaserInit:
  77900. addq.b #2,routine_secondary(a0)
  77901. move.b #5,mapping_frame(a0)
  77902. addq.w #8,y_pos(a0) ; Move down a little
  77903. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77904. ; ===========================================================================
  77905.  
  77906. ObjC5_PlatformReleaserWaitDown:
  77907. movea.w objoff_2C(a0),a1 ; a1=object laser case
  77908. btst #2,status(a1) ; checks if laser case is done moving down (so it starts loading the platforms)
  77909. bne.s ObjC5_PlatformReleaserSetDown
  77910. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77911. ; ===========================================================================
  77912.  
  77913. ObjC5_PlatformReleaserSetDown:
  77914. addq.b #2,routine_secondary(a0)
  77915. move.w #$40,objoff_2A(a0) ; time to go down
  77916. move.w #$40,y_vel(a0) ; speed to go down
  77917. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77918. ; ===========================================================================
  77919.  
  77920. ObjC5_PlatformReleaserDown:
  77921. subq.w #1,objoff_2A(a0)
  77922. beq.s ObjC5_PlatformReleaserStop
  77923. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  77924. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77925. ; ===========================================================================
  77926.  
  77927. ObjC5_PlatformReleaserStop:
  77928. addq.b #2,routine_secondary(a0)
  77929. clr.w y_vel(a0)
  77930. move.w #$10,objoff_2A(a0)
  77931. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77932. ; ===========================================================================
  77933.  
  77934. ObjC5_PlatformReleaserLoadWait:
  77935. movea.w objoff_2C(a0),a1 ; a1=object
  77936. btst #5,status(a1)
  77937. bne.s ObjC5_PlatformReleaserDestroyP
  77938. subq.w #1,objoff_2A(a0)
  77939. bne.s BranchTo8_JmpTo45_DisplaySprite
  77940. move.w #$80,objoff_2A(a0) ; Time between loading platforms
  77941. moveq #0,d0
  77942. move.b objoff_2E(a0),d0
  77943. addq.b #1,d0
  77944. cmpi.b #3,d0 ; How many platforms to load
  77945. blo.s ObjC5_PlatformReleaserLoadP
  77946. moveq #0,d0
  77947.  
  77948. ObjC5_PlatformReleaserLoadP: ; P=Platforms
  77949. move.b d0,objoff_2E(a0)
  77950. tst.b objoff_30(a0,d0.w)
  77951. bne.s BranchTo8_JmpTo45_DisplaySprite
  77952. st objoff_30(a0,d0.w)
  77953. lea (ObjC5_PlatformData).l,a2
  77954. bsr.w LoadChildObject
  77955. move.b objoff_2E(a0),objoff_2E(a1)
  77956.  
  77957. BranchTo8_JmpTo45_DisplaySprite
  77958. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77959. ; ===========================================================================
  77960.  
  77961. ObjC5_PlatformReleaserDestroyP: ; P=Platforms
  77962. addq.b #2,routine_secondary(a0)
  77963. bset #5,status(a0) ; destroy platforms
  77964. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77965. ; ===========================================================================
  77966.  
  77967. ObjC5_PlatformReleaserDelete:
  77968. movea.w objoff_2C(a0),a1 ; a1=object
  77969. cmpi.b #ObjID_WFZBoss,id(a1)
  77970. bne.w JmpTo65_DeleteObject
  77971. jsrto (Boss_LoadExplosion).l, JmpTo_Boss_LoadExplosion
  77972. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77973. ; ===========================================================================
  77974.  
  77975. ObjC5_Platform:
  77976. moveq #0,d0
  77977. move.b routine_secondary(a0),d0
  77978. move.w ObjC5_PlatformIndex(pc,d0.w),d1
  77979. jsr ObjC5_PlatformIndex(pc,d1.w)
  77980. lea (Ani_objC5).l,a1
  77981. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  77982. tst.b (a0)
  77983. beq.w return_37A48
  77984. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  77985. ; ===========================================================================
  77986. ObjC5_PlatformIndex: offsetTable
  77987. offsetTableEntry.w ObjC5_PlatformInit ; 0 - Selects mappings, anim ation, y speed and loads the object that hurts sonic (by spiky area)
  77988. offsetTableEntry.w ObjC5_PlatformDownWait ; 2 - Wait till the platform goes down some
  77989. offsetTableEntry.w ObjC5_PlatformTestChangeDirection ; 4 - checks if time limit is over and if so to change direction
  77990. ; ===========================================================================
  77991.  
  77992. ObjC5_PlatformInit:
  77993. addq.b #2,routine_secondary(a0)
  77994. move.b #3,anim(a0)
  77995. move.b #7,mapping_frame(a0)
  77996. move.w #$100,y_vel(a0) ; Y speed
  77997. move.w #$60,objoff_2A(a0)
  77998. lea (ObjC5_PlatformHurtData).l,a2 ; loads the invisible object that hurts sonic
  77999. bra.w LoadChildObject
  78000. ; ===========================================================================
  78001.  
  78002. ObjC5_PlatformDownWait: ; waits for it to go down some
  78003. bsr.w ObjC5_PlatformCheckExplode
  78004. subq.w #1,objoff_2A(a0)
  78005. beq.s ObjC5_PlatformLeft
  78006. bra.w ObjC5_PlatformMakeSolid
  78007. ; ===========================================================================
  78008.  
  78009. ObjC5_PlatformLeft: ; goes left and makes a time limit (for going left)
  78010. addq.b #2,routine_secondary(a0)
  78011. move.w #$60,objoff_2A(a0)
  78012. move.w #-$100,x_vel(a0) ; X speed
  78013. move.w y_pos(a0),objoff_34(a0)
  78014. bra.w ObjC5_PlatformMakeSolid
  78015. ; ===========================================================================
  78016.  
  78017. ObjC5_PlatformTestChangeDirection:
  78018. bsr.w ObjC5_PlatformCheckExplode
  78019. subq.w #1,objoff_2A(a0)
  78020. bne.s ObjC5_PlatformTestLeftRight
  78021. move.w #$C0,objoff_2A(a0)
  78022. neg.w x_vel(a0)
  78023.  
  78024. ObjC5_PlatformTestLeftRight: ; tests to see if a value should be added to go left or right
  78025. moveq #4,d0
  78026. move.w y_pos(a0),d1
  78027. cmp.w objoff_34(a0),d1
  78028. blo.s ObjC5_PlatformChangeY
  78029. neg.w d0
  78030.  
  78031. ObjC5_PlatformChangeY: ; give it that curving feel
  78032. add.w d0,y_vel(a0)
  78033. bra.w ObjC5_PlatformMakeSolid
  78034.  
  78035. ObjC5_PlatformMakeSolid: ; makes into a platform and moves
  78036. move.w x_pos(a0),-(sp)
  78037. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  78038. move.w #$10,d1
  78039. move.w #8,d2
  78040. move.w #8,d3
  78041. move.w (sp)+,d4
  78042. jmpto (PlatformObject).l, JmpTo9_PlatformObject
  78043. ; ===========================================================================
  78044.  
  78045. ObjC5_PlatformCheckExplode: ; checks to see if platforms should explode
  78046. movea.w objoff_2C(a0),a1 ; a1=object
  78047. btst #5,status(a1)
  78048. bne.w ObjC5_PlatformExplode
  78049. rts
  78050. ; ===========================================================================
  78051.  
  78052. ObjC5_PlatformExplode:
  78053. bsr.w loc_3B7BC
  78054. move.b #ObjID_BossExplosion,id(a0) ; load 0bj58 (explosion)
  78055. clr.b routine(a0)
  78056. movea.w objoff_3C(a0),a1 ; a1=object (invisible hurting thing)
  78057. jsrto (DeleteObject2).l, JmpTo6_DeleteObject2
  78058. addq.w #4,sp
  78059. rts
  78060. ; ===========================================================================
  78061.  
  78062. ObjC5_PlatformHurt:
  78063. moveq #0,d0
  78064. move.b routine_secondary(a0),d0
  78065. move.w ObjC5_PlatformHurtIndex(pc,d0.w),d1
  78066. jmp ObjC5_PlatformHurtIndex(pc,d1.w)
  78067. ; ===========================================================================
  78068. ObjC5_PlatformHurtIndex: offsetTable
  78069. offsetTableEntry.w ObjC5_PlatformHurtCollision ; 0 - Gives collision that hurts sonic
  78070. offsetTableEntry.w ObjC5_PlatformHurtFollowPlatform ; 2 - Follows around the platform and waits to be deleted
  78071. ; ===========================================================================
  78072.  
  78073. ObjC5_PlatformHurtCollision:
  78074. addq.b #2,routine_secondary(a0)
  78075. move.b #$98,collision_flags(a0)
  78076. rts
  78077. ; ===========================================================================
  78078.  
  78079. ObjC5_PlatformHurtFollowPlatform:
  78080. movea.w objoff_2C(a0),a1 ; a1=object (platform)
  78081. btst #5,status(a1)
  78082. bne.w JmpTo65_DeleteObject
  78083. move.w x_pos(a1),x_pos(a0)
  78084. move.w y_pos(a1),d0
  78085. addi.w #$C,d0
  78086. move.w d0,y_pos(a0)
  78087. rts
  78088. ; ===========================================================================
  78089.  
  78090. ObjC5_LaserShooter:
  78091. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  78092. btst #5,status(a1)
  78093. bne.w JmpTo65_DeleteObject
  78094. moveq #0,d0
  78095. move.b routine_secondary(a0),d0
  78096. move.w ObjC5_LaserShooterIndex(pc,d0.w),d1
  78097. jmp ObjC5_LaserShooterIndex(pc,d1.w)
  78098. ; ===========================================================================
  78099. ObjC5_LaserShooterIndex: offsetTable
  78100. offsetTableEntry.w ObjC5_LaserShooterInit ; 0 - Loads up mappings
  78101. offsetTableEntry.w ObjC5_LaserShooterFollow ; 2 - Goes back and forth with the laser case
  78102. offsetTableEntry.w ObjC5_LaserShooterDown ; 4 - Laser case sets it to this routine which then makes it go down
  78103. ; ===========================================================================
  78104.  
  78105. ObjC5_LaserShooterInit:
  78106. addq.b #2,routine_secondary(a0)
  78107. move.b #4,mapping_frame(a0)
  78108. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78109. ; ===========================================================================
  78110.  
  78111. ObjC5_LaserShooterFollow:
  78112. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  78113. move.w x_pos(a1),x_pos(a0)
  78114. move.w y_pos(a1),y_pos(a0)
  78115. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78116. ; ===========================================================================
  78117.  
  78118. ObjC5_LaserShooterDown:
  78119. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  78120. move.w x_pos(a1),x_pos(a0)
  78121. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78122. ; ===========================================================================
  78123.  
  78124. ObjC5_Laser:
  78125. movea.w objoff_2C(a0),a1 ; a1=object
  78126. btst #5,status(a1)
  78127. bne.w JmpTo65_DeleteObject
  78128. moveq #0,d0
  78129. move.b routine_secondary(a0),d0
  78130. move.w ObjC5_LaserIndex(pc,d0.w),d1
  78131. jsr ObjC5_LaserIndex(pc,d1.w)
  78132. bchg #0,objoff_2F(a0)
  78133. bne.w return_37A48
  78134. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78135. ; ===========================================================================
  78136. ObjC5_LaserIndex: offsetTable
  78137. offsetTableEntry.w ObjC5_LaserInit ; 0 - Loads mappings and collision and such
  78138. offsetTableEntry.w ObjC5_LaserFlash ; 2 - Makes the laser flash (gives the charging up effect)
  78139. offsetTableEntry.w ObjC5_LaseWaitShoot ; 4 - Waits a little to launch the laser when it's done flickering (charging)
  78140. offsetTableEntry.w ObjC5_LaserShoot ; 6 - Shoots down the laser untill it's fully shot out
  78141. offsetTableEntry.w ObjC5_LaserMove ; 8 - Moves with laser case and shooter
  78142. ; ===========================================================================
  78143.  
  78144. ObjC5_LaserInit:
  78145. addq.b #2,routine_secondary(a0)
  78146. move.b #$D,mapping_frame(a0)
  78147. move.b #4,priority(a0)
  78148. move.b #0,collision_flags(a0)
  78149. addi.w #$10,y_pos(a0)
  78150. move.b #$C,anim_frame(a0)
  78151. subq.w #3,y_pos(a0)
  78152. rts
  78153. ; ===========================================================================
  78154.  
  78155. ObjC5_LaserFlash:
  78156. bset #0,objoff_2F(a0)
  78157. subq.b #1,anim_frame_duration(a0)
  78158. bpl.s ObjC5_LaserNoLaser
  78159. move.b anim_frame_duration(a0),d0
  78160. addq.b #2,d0
  78161. bpl.s ObjC5_LaserFlicker
  78162. move.b anim_frame(a0),d0
  78163. subq.b #1,d0
  78164. beq.s ObjC5_LaseNext
  78165. move.b d0,anim_frame(a0)
  78166. move.b d0,anim_frame_duration(a0)
  78167.  
  78168. ObjC5_LaserFlicker: ; this is what makes the laser flicker before being fully loaded (covering laser shooter)
  78169. bclr #0,objoff_2F(a0)
  78170.  
  78171. ObjC5_LaserNoLaser: ; without this the laser would just stay on the shooter not going down
  78172. rts
  78173. ; ===========================================================================
  78174.  
  78175. ObjC5_LaseNext: ; just sets up a time to wait for the laser to shoot when it's loaded and done flickering
  78176. addq.b #2,routine_secondary(a0)
  78177. move.w #$40,objoff_2A(a0)
  78178. rts
  78179. ; ===========================================================================
  78180.  
  78181. ObjC5_LaseWaitShoot:
  78182. subq.w #1,objoff_2A(a0)
  78183. bmi.s ObjC5_LaseStartShooting
  78184. rts
  78185. ; ===========================================================================
  78186.  
  78187. ObjC5_LaseStartShooting:
  78188. addq.b #2,routine_secondary(a0)
  78189. addi.w #$10,y_pos(a0)
  78190. rts
  78191. ; ===========================================================================
  78192.  
  78193. ObjC5_LaserShoot:
  78194. moveq #0,d0
  78195. move.b objoff_2E(a0),d0
  78196. addq.b #1,d0
  78197. cmpi.b #5,d0
  78198. bhs.s ObjC5_LaseShotOut
  78199. addi.w #$10,y_pos(a0)
  78200. move.b d0,objoff_2E(a0)
  78201. move.b ObjC5_LaserMappingsData(pc,d0.w),mapping_frame(a0)
  78202. move.b ObjC5_LaserCollisionData(pc,d0.w),collision_flags(a0)
  78203. rts
  78204. ; ===========================================================================
  78205.  
  78206. ObjC5_LaseShotOut: ; laser is fully shot out and lets the laser case know so it moves
  78207. addq.b #2,routine_secondary(a0)
  78208. move.w #$80,objoff_2A(a0)
  78209. bset #2,status(a0)
  78210. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  78211. bset #3,status(a1)
  78212. rts
  78213. ; ===========================================================================
  78214. ObjC5_LaserMappingsData:
  78215. dc.b $E
  78216. dc.b $F ; 1
  78217. dc.b $10 ; 2
  78218. dc.b $11 ; 3
  78219. dc.b $12 ; 4
  78220. dc.b 0 ; 5
  78221. ObjC5_LaserCollisionData:
  78222. dc.b $86
  78223. dc.b $AB ; 1
  78224. dc.b $AC ; 2
  78225. dc.b $AD ; 3
  78226. dc.b $AE ; 4
  78227. dc.b 0 ; 5
  78228. ; ===========================================================================
  78229.  
  78230. ObjC5_LaserMove:
  78231. movea.w objoff_2C(a0),a1 ; a1=object
  78232. move.w x_pos(a1),x_pos(a0)
  78233. rts
  78234. ; ===========================================================================
  78235.  
  78236. ObjC5_Robotnik:
  78237. moveq #0,d0
  78238. move.b routine_secondary(a0),d0
  78239. move.w ObjC5_RobotnikIndex(pc,d0.w),d1
  78240. jmp ObjC5_RobotnikIndex(pc,d1.w)
  78241. ; ===========================================================================
  78242. ObjC5_RobotnikIndex: offsetTable
  78243. offsetTableEntry.w ObjC5_RobotnikInit ; 0 - Loads art, animation and position
  78244. offsetTableEntry.w ObjC5_RobotnikAnimate ; 2 - Animates Robotnik and waits till the case is defeated
  78245. offsetTableEntry.w ObjC5_RobotnikDown ; 4 - Goes down until timer is up
  78246. ; ===========================================================================
  78247.  
  78248. ObjC5_RobotnikInit:
  78249. addq.b #2,routine_secondary(a0)
  78250. move.b #0,mapping_frame(a0)
  78251. move.b #1,anim(a0)
  78252. move.w #$2C60,x_pos(a0)
  78253. move.w #$4E6,y_pos(a0)
  78254. lea (ObjC5_RobotnikPlatformData).l,a2
  78255. bsr.w LoadChildObject
  78256. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78257. ; ===========================================================================
  78258.  
  78259. ObjC5_RobotnikAnimate:
  78260. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  78261. btst #5,status(a1)
  78262. bne.s ObjC5_RobotnikTimer
  78263. lea (Ani_objC5_objC6).l,a1
  78264. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  78265. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78266. ; ===========================================================================
  78267.  
  78268. ObjC5_RobotnikTimer: ; Increase routine and set timer
  78269. addq.b #2,routine_secondary(a0)
  78270. move.w #$C0,objoff_2A(a0)
  78271. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78272. ; ===========================================================================
  78273.  
  78274. ObjC5_RobotnikDown:
  78275. subq.w #1,objoff_2A(a0)
  78276. bmi.s ObjC5_RobotnikDelete
  78277. addq.w #1,y_pos(a0)
  78278. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78279. ; ===========================================================================
  78280.  
  78281. ObjC5_RobotnikDelete: ; Deletes robotnik and the platform he's on
  78282. movea.w parent(a0),a1 ; a1=object (Robotnik Platform)
  78283. jsrto (DeleteObject2).l, JmpTo6_DeleteObject2
  78284. bra.w JmpTo65_DeleteObject
  78285. ; ===========================================================================
  78286.  
  78287. ObjC5_RobotnikPlatform: ; Just displays the platform and move accordingly to the robotnik object
  78288. movea.w objoff_2C(a0),a1 ; a1=object (robotnik)
  78289. move.w y_pos(a1),d0
  78290. addi.w #$26,d0
  78291. move.w d0,y_pos(a0)
  78292. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78293. ; ===========================================================================
  78294. ; some unused/dead code, At one point it appears a section of the platform was solid
  78295. move.w x_pos(a0),-(sp)
  78296. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  78297. move.w #$F,d1
  78298. move.w #8,d2
  78299. move.w #8,d3
  78300. move.w (sp)+,d4
  78301. jmpto (PlatformObject).l, JmpTo9_PlatformObject
  78302. ; ===========================================================================
  78303.  
  78304. ObjC5_HandleHits:
  78305. tst.b collision_property(a0)
  78306. beq.s ObjC5_NoHitPointsLeft
  78307. tst.b collision_flags(a0)
  78308. bne.s return_3CC3A
  78309. tst.b objoff_30(a0)
  78310. bne.s ObjC5_FlashSetUp
  78311. btst #6,status(a0)
  78312. beq.s return_3CC3A
  78313. move.b #$20,objoff_30(a0)
  78314. move.w #SndID_BossHit,d0
  78315. jsr (PlaySound).l
  78316.  
  78317. ObjC5_FlashSetUp:
  78318. lea (Normal_palette_line2+2).w,a1
  78319. moveq #0,d0
  78320. tst.w (a1)
  78321. bne.s ObjC5_FlashCollisionRestore
  78322. move.w #$EEE,d0
  78323.  
  78324. ObjC5_FlashCollisionRestore:
  78325. move.w d0,(a1)
  78326. subq.b #1,objoff_30(a0)
  78327. bne.s return_3CC3A
  78328. btst #4,status(a0) ; makes sure the boss doesn't need collision
  78329. beq.s return_3CC3A
  78330. move.b #6,collision_flags(a0) ; restore collision
  78331.  
  78332. return_3CC3A:
  78333. rts
  78334. ; ===========================================================================
  78335.  
  78336. ObjC5_NoHitPointsLeft: ; when the boss is defeated this tells it what to do
  78337. moveq #100,d0
  78338. bsr.w AddPoints
  78339. clr.b collision_flags(a0)
  78340. move.w #$EF,objoff_30(a0)
  78341. move.b #$1E,routine_secondary(a0)
  78342. bset #5,status(a0)
  78343. bclr #6,status(a0)
  78344. rts
  78345. ; ===========================================================================
  78346. ObjC5_LaserWallData:
  78347. dc.w objoff_2A
  78348. dc.b ObjID_WFZBoss
  78349. dc.b $94
  78350. ObjC5_PlatformData:
  78351. dc.w objoff_3E
  78352. dc.b ObjID_WFZBoss
  78353. dc.b $98
  78354. ObjC5_PlatformHurtData:
  78355. dc.w objoff_3C
  78356. dc.b ObjID_WFZBoss
  78357. dc.b $9A
  78358. ObjC5_LaserShooterData:
  78359. dc.w objoff_3C
  78360. dc.b ObjID_WFZBoss
  78361. dc.b $9C
  78362. ObjC5_PlatformReleaserData:
  78363. dc.w objoff_3A
  78364. dc.b ObjID_WFZBoss
  78365. dc.b $96
  78366. ObjC5_LaserData:
  78367. dc.w objoff_3E
  78368. dc.b ObjID_WFZBoss
  78369. dc.b $9E
  78370. ObjC5_RobotnikData:
  78371. dc.w objoff_38
  78372. dc.b ObjID_WFZBoss
  78373. dc.b $A0
  78374. ObjC5_RobotnikPlatformData:
  78375. dc.w objoff_3E
  78376. dc.b ObjID_WFZBoss
  78377. dc.b $A2
  78378.  
  78379. ; off_3CC80:
  78380. ObjC5_SubObjData: ; Laser Case
  78381. subObjData ObjC5_MapUnc_3CCD8,make_art_tile(ArtTile_ArtNem_WFZBoss,0,0),4,4,$20,0
  78382. ; off_3CC8A:
  78383. ObjC5_SubObjData2: ; Laser Walls
  78384. subObjData ObjC5_MapUnc_3CCD8,make_art_tile(ArtTile_ArtNem_WFZBoss,0,0),4,1,8,0
  78385. ; off_3CC94:
  78386. ObjC5_SubObjData3: ; Platforms, platform releaser, laser and laser shooter
  78387. subObjData ObjC5_MapUnc_3CCD8,make_art_tile(ArtTile_ArtNem_WFZBoss,0,0),4,5,$10,0
  78388. ; off_3CC9E:
  78389. ObjC6_SubObjData2: ; Robotnik
  78390. subObjData ObjC6_MapUnc_3D0EE,make_art_tile(ArtTile_ArtKos_LevelArt,0,0),4,5,$20,0
  78391. ; off_3CCA8:
  78392. ObjC5_SubObjData4: ; Robotnik platform
  78393. subObjData ObjC5_MapUnc_3CEBC,make_art_tile(ArtTile_ArtNem_WfzFloatingPlatform,1,1),4,5,$20,0
  78394.  
  78395. ; animation script
  78396. ; off_3CCB2:
  78397. Ani_objC5: offsetTable
  78398. offsetTableEntry.w byte_3CCBA ; 0
  78399. offsetTableEntry.w byte_3CCC4 ; 1
  78400. offsetTableEntry.w byte_3CCCC ; 2
  78401. offsetTableEntry.w byte_3CCD0 ; 3
  78402. byte_3CCBA: dc.b 5, 0, 1, 2, 3, 3, 3, 3,$FA, 0
  78403. byte_3CCC4: dc.b 3, 3, 2, 1, 0, 0,$FA, 0
  78404. byte_3CCCC: dc.b 3, 5, 6,$FF
  78405. byte_3CCD0: dc.b 3, 7, 8, 9, $A, $B,$FF
  78406. even
  78407. ; ----------------------------------------------------------------------------
  78408. ; sprite mappings
  78409. ; ----------------------------------------------------------------------------
  78410. ObjC5_MapUnc_3CCD8: BINCLUDE "mappings/sprite/objC5_a.bin"
  78411. ; ----------------------------------------------------------------------------
  78412. ; sprite mappings
  78413. ; ----------------------------------------------------------------------------
  78414. ObjC5_MapUnc_3CEBC: BINCLUDE "mappings/sprite/objC5_b.bin"
  78415.  
  78416.  
  78417.  
  78418.  
  78419. ; ===========================================================================
  78420. ; ----------------------------------------------------------------------------
  78421. ; Object C6 - Eggman
  78422. ; ----------------------------------------------------------------------------
  78423. ; Sprite_3CED0:
  78424. ObjC6:
  78425. moveq #0,d0
  78426. move.b routine(a0),d0
  78427. move.w ObjC6_Index(pc,d0.w),d1
  78428. jmp ObjC6_Index(pc,d1.w)
  78429. ; ===========================================================================
  78430. ; off_3CEDE: ObjC6_States:
  78431. ObjC6_Index: offsetTable
  78432. offsetTableEntry.w ObjC6_Init ; 0
  78433. offsetTableEntry.w ObjC6_State2 ; 2
  78434. offsetTableEntry.w ObjC6_State3 ; 4
  78435. offsetTableEntry.w ObjC6_State4 ; 6
  78436. ; ===========================================================================
  78437. ; loc_3CEE6:
  78438. ObjC6_Init:
  78439. bsr.w LoadSubObject
  78440. move.b subtype(a0),d0
  78441. subi.b #$A4,d0
  78442. move.b d0,routine(a0) ; => ObjC6_State2, ObjC6_State3, or ObjC6_State4 ??
  78443. rts
  78444. ; ===========================================================================
  78445. ; loc_3CEF8:
  78446. ObjC6_State2:
  78447. moveq #0,d0
  78448. move.b routine_secondary(a0),d0
  78449. move.w ObjC6_State2_States(pc,d0.w),d1
  78450. jmp ObjC6_State2_States(pc,d1.w)
  78451. ; ===========================================================================
  78452. ; off_3CF06:
  78453. ObjC6_State2_States: offsetTable
  78454. offsetTableEntry.w ObjC6_State2_State1 ; 0
  78455. offsetTableEntry.w ObjC6_State2_State2 ; 2
  78456. offsetTableEntry.w ObjC6_State2_State3 ; 4
  78457. offsetTableEntry.w ObjC6_State2_State4 ; 6
  78458. offsetTableEntry.w ObjC6_State2_State5 ; 8
  78459. ; ===========================================================================
  78460. ; loc_3CF10:
  78461. ObjC6_State2_State1: ; a1=object (set in loc_3D94C)
  78462. addq.b #2,routine_secondary(a0) ; => ObjC6_State2_State2
  78463. lea (word_3D0D0).l,a2
  78464. bsr.w LoadChildObject
  78465. move.w #$3F8,x_pos(a1)
  78466. move.w #$160,y_pos(a1)
  78467. move.w a0,(DEZ_Eggman).w
  78468. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78469. ; ===========================================================================
  78470. ; loc_3CF32:
  78471. ObjC6_State2_State2:
  78472. bsr.w Obj_GetOrientationToPlayer
  78473. addi.w #$5C,d2
  78474. cmpi.w #$B8,d2
  78475. blo.s loc_3CF44
  78476. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78477. ; ---------------------------------------------------------------------------
  78478. loc_3CF44:
  78479. addq.b #2,routine_secondary(a0) ; => ObjC6_State2_State3
  78480. move.w #$18,objoff_2A(a0)
  78481. move.b #1,mapping_frame(a0)
  78482. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78483. ; ===========================================================================
  78484. ; loc_3CF58:
  78485. ObjC6_State2_State3:
  78486. subq.w #1,objoff_2A(a0)
  78487. bmi.s loc_3CF62
  78488. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78489. ; ---------------------------------------------------------------------------
  78490. loc_3CF62:
  78491. addq.b #2,routine_secondary(a0) ; => ObjC6_State2_State4
  78492. bset #2,status(a0)
  78493. move.w #$200,x_vel(a0)
  78494. move.w #$10,objoff_2A(a0)
  78495. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78496. ; ===========================================================================
  78497. ; loc_3CF7C:
  78498. ObjC6_State2_State4:
  78499. cmpi.w #$810,x_pos(a0)
  78500. bhs.s loc_3CFC0
  78501. bsr.w Obj_GetOrientationToPlayer
  78502. addi.w #$50,d2
  78503. cmpi.w #$A0,d2
  78504. bhs.s +
  78505. move.w x_pos(a1),d0
  78506. addi.w #$50,d0
  78507. move.w d0,x_pos(a0)
  78508. +
  78509. subq.w #1,objoff_2A(a0)
  78510. bpl.s +
  78511. move.w #$20,objoff_2A(a0)
  78512. bsr.w loc_3D00C
  78513. +
  78514. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  78515. lea (Ani_objC5_objC6).l,a1
  78516. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  78517. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78518. ; ===========================================================================
  78519.  
  78520. loc_3CFC0:
  78521. move.b #2,mapping_frame(a0)
  78522. clr.w x_vel(a0)
  78523. tst.b render_flags(a0)
  78524. bpl.s +
  78525. addq.b #2,routine_secondary(a0) ; => ObjC6_State2_State5
  78526. move.w #$80,x_vel(a0)
  78527. move.w #-$200,y_vel(a0)
  78528. move.b #2,mapping_frame(a0)
  78529. move.w #$50,objoff_2A(a0)
  78530. bset #3,status(a0)
  78531. +
  78532. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78533. ; ===========================================================================
  78534. ; loc_3CFF6:
  78535. ObjC6_State2_State5:
  78536. subq.w #1,objoff_2A(a0)
  78537. bmi.w JmpTo65_DeleteObject
  78538. addi.w #$10,y_vel(a0)
  78539. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  78540. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78541. ; ===========================================================================
  78542.  
  78543. loc_3D00C:
  78544. lea (word_3D0D4).l,a2
  78545. bsr.w LoadChildObject
  78546. move.b #$AA,subtype(a1) ; <== ObjC6_SubObjData
  78547. move.b #5,mapping_frame(a1)
  78548. move.w #-$100,x_vel(a1)
  78549. subi.w #$18,y_pos(a1)
  78550. move.w #8,objoff_2A(a1)
  78551. rts
  78552. ; ===========================================================================
  78553. ; loc_3D036:
  78554. ObjC6_State3:
  78555. moveq #0,d0
  78556. move.b routine_secondary(a0),d0
  78557. move.w ObjC6_State3_States(pc,d0.w),d1
  78558. jmp ObjC6_State3_States(pc,d1.w)
  78559. ; ===========================================================================
  78560. ; off_3D044:
  78561. ObjC6_State3_States: offsetTable
  78562. offsetTableEntry.w ObjC6_State3_State1 ; 0
  78563. offsetTableEntry.w ObjC6_State3_State2 ; 2
  78564. offsetTableEntry.w ObjC6_State3_State3 ; 4
  78565. ; ===========================================================================
  78566. ; loc_3D04A:
  78567. ObjC6_State3_State1:
  78568. movea.w objoff_2C(a0),a1 ; a1=object
  78569. btst #2,status(a1)
  78570. bne.s loc_3D05E
  78571. bsr.w loc_3D086
  78572. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78573. ; ---------------------------------------------------------------------------
  78574. loc_3D05E:
  78575. addq.b #2,routine_secondary(a0) ; => ObjC6_State3_State2
  78576. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78577. ; ===========================================================================
  78578. ; loc_3D066:
  78579. ObjC6_State3_State2:
  78580. bsr.w loc_3D086
  78581. lea (Ani_objC6).l,a1
  78582. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  78583. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78584. ; ===========================================================================
  78585. ; loc_3D078:
  78586. ObjC6_State3_State3:
  78587. lea (MainCharacter).w,a1 ; a1=character
  78588. bclr #5,status(a1)
  78589. bra.w JmpTo65_DeleteObject
  78590. ; ===========================================================================
  78591.  
  78592. loc_3D086:
  78593. move.w x_pos(a0),-(sp)
  78594. move.w #$13,d1
  78595. move.w #$20,d2
  78596. move.w #$20,d3
  78597. move.w (sp)+,d4
  78598. jmpto (SolidObject).l, JmpTo27_SolidObject
  78599. ; ===========================================================================
  78600. ; loc_3D09C:
  78601. ObjC6_State4:
  78602. subq.w #1,objoff_2A(a0)
  78603. bmi.w JmpTo65_DeleteObject
  78604. addi.w #$10,y_vel(a0)
  78605. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  78606. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78607. ; ===========================================================================
  78608. ; off_3D0B2:
  78609. ObjC6_SubObjData3:
  78610. subObjData ObjC6_MapUnc_3D0EE,make_art_tile(ArtTile_ArtKos_LevelArt,0,0),4,5,$18,0
  78611. ; off_3D0BC:
  78612. ObjC6_SubObjData4:
  78613. subObjData ObjC6_MapUnc_3D1DE,make_art_tile(ArtTile_ArtNem_ConstructionStripes_1,1,0),4,1,8,0
  78614. ; off_3D0C6:
  78615. ObjC6_SubObjData:
  78616. subObjData ObjC6_MapUnc_3D0EE,make_art_tile(ArtTile_ArtKos_LevelArt,0,0),4,5,4,0
  78617. word_3D0D0:
  78618. dc.w objoff_3E
  78619. dc.b ObjID_Eggman
  78620. dc.b $A8
  78621. word_3D0D4:
  78622. dc.w objoff_3C
  78623. dc.b ObjID_Eggman
  78624. dc.b $AA
  78625. ; animation script
  78626. ; off_3D0D8:
  78627. Ani_objC5_objC6:offsetTable
  78628. offsetTableEntry.w byte_3D0DC ; 0
  78629. offsetTableEntry.w byte_3D0E2 ; 1
  78630. byte_3D0DC: dc.b 5, 2, 3, 4,$FF, 0
  78631. byte_3D0E2: dc.b 5, 6, 7,$FF
  78632. even
  78633. ; animation script
  78634. ; off_3D0E6:
  78635. Ani_objC6: offsetTable
  78636. offsetTableEntry.w + ; 0
  78637. + dc.b 1, 0, 1, 2, 3,$FA
  78638. even
  78639. ; ----------------------------------------------------------------------------
  78640. ; sprite mappings ; Robotnik running
  78641. ; ----------------------------------------------------------------------------
  78642. ObjC6_MapUnc_3D0EE: BINCLUDE "mappings/sprite/objC6_a.bin"
  78643. ; ----------------------------------------------------------------------------
  78644. ; sprite mappings
  78645. ; ----------------------------------------------------------------------------
  78646. ObjC6_MapUnc_3D1DE: BINCLUDE "mappings/sprite/objC6_b.bin"
  78647.  
  78648.  
  78649.  
  78650.  
  78651. ; ===========================================================================
  78652. ; ----------------------------------------------------------------------------
  78653. ; Object C8 - Crawl (shield badnik) from CNZ
  78654. ; ----------------------------------------------------------------------------
  78655. ; Sprite_3D23E:
  78656. ObjC8:
  78657. moveq #0,d0
  78658. move.b routine(a0),d0
  78659. move.w ObjC8_Index(pc,d0.w),d1
  78660. jmp ObjC8_Index(pc,d1.w)
  78661. ; ===========================================================================
  78662. ; off_3D24C:
  78663. ObjC8_Index: offsetTable
  78664. offsetTableEntry.w ObjC8_Init ; 0
  78665. offsetTableEntry.w loc_3D27C ; 2
  78666. offsetTableEntry.w loc_3D2A6 ; 4
  78667. offsetTableEntry.w loc_3D2D4 ; 6
  78668. ; ===========================================================================
  78669. ; loc_3D254:
  78670. ObjC8_Init:
  78671. bsr.w LoadSubObject
  78672. move.w #$200,objoff_2A(a0)
  78673. moveq #$20,d0
  78674. btst #0,render_flags(a0)
  78675. bne.s +
  78676. neg.w d0
  78677. +
  78678. move.w d0,x_vel(a0)
  78679. move.b #$F,y_radius(a0)
  78680. move.b #$10,x_radius(a0)
  78681. rts
  78682. ; ===========================================================================
  78683.  
  78684. loc_3D27C:
  78685. subq.w #1,objoff_2A(a0)
  78686. beq.s +
  78687. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  78688. bsr.w loc_3D416
  78689. lea (Ani_objC8).l,a1
  78690. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  78691. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78692. ; ===========================================================================
  78693. +
  78694. addq.b #2,routine(a0)
  78695. move.w #$3B,objoff_2A(a0)
  78696. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78697. ; ===========================================================================
  78698.  
  78699. loc_3D2A6:
  78700. subq.w #1,objoff_2A(a0)
  78701. bmi.s +
  78702. bsr.w loc_3D416
  78703. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78704. ; ===========================================================================
  78705. +
  78706. move.b #2,routine(a0)
  78707. move.w #$200,objoff_2A(a0)
  78708. neg.w x_vel(a0)
  78709. bchg #0,render_flags(a0)
  78710. bchg #0,status(a0)
  78711. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78712. ; ===========================================================================
  78713.  
  78714. loc_3D2D4:
  78715. move.b #$D7,collision_flags(a0)
  78716. bsr.w Obj_GetOrientationToPlayer
  78717. move.w d2,d4
  78718. addi.w #$40,d2
  78719. cmpi.w #$80,d2
  78720. bhs.w loc_3D39A
  78721. addi.w #$40,d3
  78722. cmpi.w #$80,d3
  78723. bhs.w loc_3D39A
  78724. bclr #3,status(a0)
  78725. bne.w loc_3D386
  78726. move.b collision_property(a0),d0
  78727. beq.s BranchTo18_JmpTo39_MarkObjGone
  78728. bclr #0,collision_property(a0)
  78729. beq.s +++
  78730. cmpi.b #AniIDSonAni_Roll,anim(a1)
  78731. bne.s loc_3D36C
  78732. btst #1,status(a1)
  78733. bne.s ++
  78734. bsr.w Obj_GetOrientationToPlayer
  78735. btst #0,render_flags(a0)
  78736. beq.s +
  78737. subq.w #2,d0
  78738. +
  78739. tst.w d0
  78740. bne.s loc_3D390
  78741. +
  78742. bsr.s loc_3D3A4
  78743. +
  78744. lea (Sidekick).w,a1 ; a1=character
  78745. bclr #1,collision_property(a0)
  78746. beq.s +++
  78747. cmpi.b #AniIDTailsAni_Roll,anim(a1)
  78748. bne.s loc_3D36C
  78749. btst #1,status(a1)
  78750. bne.s ++
  78751. bsr.w Obj_GetOrientationToPlayer
  78752. btst #0,render_flags(a0)
  78753. beq.s +
  78754. subq.w #2,d0
  78755. +
  78756. tst.w d0
  78757. bne.s loc_3D390
  78758. +
  78759. bsr.s loc_3D3A4
  78760. +
  78761. clr.b collision_property(a0)
  78762.  
  78763. BranchTo18_JmpTo39_MarkObjGone
  78764. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78765. ; ===========================================================================
  78766.  
  78767. loc_3D36C:
  78768. move.b #$97,collision_flags(a0)
  78769. btst #status_sec_isInvincible,status_secondary(a1)
  78770. beq.s +
  78771. move.b #$17,collision_flags(a0)
  78772. +
  78773. bset #3,status(a0)
  78774.  
  78775. loc_3D386:
  78776. move.b #1,mapping_frame(a0)
  78777. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78778. ; ===========================================================================
  78779.  
  78780. loc_3D390:
  78781. move.b #$17,collision_flags(a0)
  78782. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78783. ; ===========================================================================
  78784.  
  78785. loc_3D39A:
  78786. move.b objoff_2C(a0),routine(a0)
  78787. jmpto (MarkObjGone).l, JmpTo39_MarkObjGone
  78788. ; ===========================================================================
  78789.  
  78790. loc_3D3A4:
  78791. move.b #2,mapping_frame(a0)
  78792. btst #1,status(a1)
  78793. beq.s +
  78794. move.b #3,mapping_frame(a0)
  78795. +
  78796. move.w x_pos(a0),d1
  78797. move.w y_pos(a0),d2
  78798. sub.w x_pos(a1),d1
  78799. sub.w y_pos(a1),d2
  78800. jsr (CalcAngle).l
  78801. move.b (Timer_frames).w,d1
  78802. andi.w #3,d1
  78803. add.w d1,d0
  78804. jsr (CalcSine).l
  78805. muls.w #-$700,d1
  78806. asr.l #8,d1
  78807. move.w d1,x_vel(a1)
  78808. muls.w #-$700,d0
  78809. asr.l #8,d0
  78810. move.w d0,y_vel(a1)
  78811. bset #1,status(a1)
  78812. bclr #4,status(a1)
  78813. bclr #5,status(a1)
  78814. clr.b jumping(a1)
  78815. move.w #SndID_Bumper,d0
  78816. jsr (PlaySound).l
  78817. rts
  78818. ; ===========================================================================
  78819. ; unused
  78820. rts
  78821. ; ===========================================================================
  78822.  
  78823. loc_3D416:
  78824. bsr.w Obj_GetOrientationToPlayer
  78825. addi.w #$40,d2
  78826. cmpi.w #$80,d2
  78827. bhs.s + ; rts
  78828. addi.w #$40,d3
  78829. cmpi.w #$80,d3
  78830. bhs.s + ; rts
  78831. move.b routine(a0),objoff_2C(a0)
  78832. move.b #6,routine(a0)
  78833. clr.b mapping_frame(a0)
  78834. +
  78835. rts
  78836. ; ===========================================================================
  78837. ; off_3D440:
  78838. ObjC8_SubObjData:
  78839. subObjData ObjC8_MapUnc_3D450,make_art_tile(ArtTile_ArtNem_Crawl,0,1),4,3,$10,$D7
  78840. ; animation script
  78841. ; off_3D44A:
  78842. Ani_objC8: offsetTable
  78843. offsetTableEntry.w + ; 0
  78844. + dc.b $13, 0, 1,$FF
  78845. even
  78846. ; ----------------------------------------------------------------------------
  78847. ; sprite mappings ; Crawl CNZ
  78848. ; ----------------------------------------------------------------------------
  78849. ObjC8_MapUnc_3D450: BINCLUDE "mappings/sprite/objC8.bin"
  78850.  
  78851.  
  78852.  
  78853.  
  78854. ; ===========================================================================
  78855. ; ----------------------------------------------------------------------------
  78856. ; Object C7 - Eggrobo (final boss) from Death Egg
  78857. ; ----------------------------------------------------------------------------
  78858. ; Sprite_3D4C8:
  78859. ObjC7:
  78860. moveq #0,d0
  78861. move.b routine(a0),d0
  78862. move.w ObjC7_Index(pc,d0.w),d1
  78863. jmp ObjC7_Index(pc,d1.w)
  78864. ; ===========================================================================
  78865. ; off_3D4D6:
  78866. ObjC7_Index: offsetTable
  78867. offsetTableEntry.w ObjC7_Init ; 0
  78868. offsetTableEntry.w ObjC7_Body ; 2
  78869. offsetTableEntry.w ObjC7_Shoulder ; 4
  78870. offsetTableEntry.w ObjC7_FrontLowerLeg ; 6
  78871. offsetTableEntry.w ObjC7_FrontForearm ; 8
  78872. offsetTableEntry.w ObjC7_Arm ; $A
  78873. offsetTableEntry.w ObjC7_FrontThigh ; $C
  78874. offsetTableEntry.w ObjC7_Head ; $E
  78875. offsetTableEntry.w ObjC7_Jet ; $10
  78876. offsetTableEntry.w ObjC7_BackLowerLeg ; $12
  78877. offsetTableEntry.w ObjC7_BackForearm ; $14
  78878. offsetTableEntry.w ObjC7_BackThigh ; $16
  78879. offsetTableEntry.w ObjC7_TargettingSensor ; $18
  78880. offsetTableEntry.w ObjC7_TargettingLock ; $1A
  78881. offsetTableEntry.w ObjC7_EggmanBomb ; $1C
  78882. offsetTableEntry.w ObjC7_FallingPieces ; $1E
  78883. offsetTableEntry.w ObjC7_SetupEnding ; $20
  78884. ; ===========================================================================
  78885. ; loc_3D4F8:
  78886. ObjC7_Init:
  78887. lea ObjC7_SubObjData(pc),a1
  78888. bsr.w LoadSubObject_Part3
  78889. move.b subtype(a0),routine(a0)
  78890. rts
  78891. ; ===========================================================================
  78892. ;loc_3D508
  78893. ObjC7_Body:
  78894. moveq #0,d0
  78895. move.b routine_secondary(a0),d0
  78896. move.w off_3D51A(pc,d0.w),d1
  78897. jsr off_3D51A(pc,d1.w)
  78898. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  78899. ; ===========================================================================
  78900. off_3D51A: offsetTable
  78901. offsetTableEntry.w loc_3D52A ; 0
  78902. offsetTableEntry.w loc_3D5A8 ; 2
  78903. offsetTableEntry.w loc_3D5C2 ; 4
  78904. offsetTableEntry.w loc_3D5EA ; 6
  78905. offsetTableEntry.w loc_3D62E ; 8
  78906. offsetTableEntry.w loc_3D640 ; $A
  78907. offsetTableEntry.w loc_3D684 ; $C
  78908. offsetTableEntry.w loc_3D8D2 ; $E
  78909. ; ===========================================================================
  78910.  
  78911. loc_3D52A:
  78912. addq.b #2,routine_secondary(a0)
  78913. move.b #3,mapping_frame(a0)
  78914. move.b #5,priority(a0)
  78915. lea (ChildObjC7_Shoulder).l,a2
  78916. bsr.w LoadChildObject
  78917. lea (ChildObjC7_FrontForearm).l,a2
  78918. bsr.w LoadChildObject
  78919. lea (ChildObjC7_FrontLowerLeg).l,a2
  78920. bsr.w LoadChildObject
  78921. lea (ChildObjC7_Arm).l,a2
  78922. bsr.w LoadChildObject
  78923. lea (ChildObjC7_FrontThigh).l,a2
  78924. bsr.w LoadChildObject
  78925. lea (ChildObjC7_Head).l,a2
  78926. bsr.w LoadChildObject
  78927. lea (ChildObjC7_Jet).l,a2
  78928. bsr.w LoadChildObject
  78929. lea (ChildObjC7_BackLowerLeg).l,a2
  78930. bsr.w LoadChildObject
  78931. lea (ChildObjC7_BackForearm).l,a2
  78932. bsr.w LoadChildObject
  78933. lea (ChildObjC7_BackThigh).l,a2
  78934. bsr.w LoadChildObject
  78935. lea (ObjC7_ChildDeltas).l,a1
  78936. bra.w ObjC7_PositionChildren
  78937. ; ===========================================================================
  78938.  
  78939. loc_3D5A8:
  78940. btst #2,status(a0)
  78941. bne.s +
  78942. rts
  78943. ; ---------------------------------------------------------------------------
  78944. +
  78945. addq.b #2,routine_secondary(a0)
  78946. move.b #$3C,anim_frame_duration(a0)
  78947. moveq #MusID_FadeOut,d0
  78948. jmpto (PlaySound).l, JmpTo12_PlaySound
  78949. ; ===========================================================================
  78950.  
  78951. loc_3D5C2:
  78952. subq.b #1,anim_frame_duration(a0)
  78953. bmi.s +
  78954. rts
  78955. ; ---------------------------------------------------------------------------
  78956. +
  78957. addq.b #2,routine_secondary(a0)
  78958. move.b #$79,anim_frame_duration(a0)
  78959. move.w #-$100,y_vel(a0)
  78960. movea.w objoff_38(a0),a1 ; a1=object
  78961. move.b #4,routine_secondary(a1)
  78962. moveq #MusID_EndBoss,d0
  78963. jmpto (PlayMusic).l, JmpTo5_PlayMusic
  78964. ; ===========================================================================
  78965.  
  78966. loc_3D5EA:
  78967. subq.b #1,anim_frame_duration(a0)
  78968. beq.s +
  78969. moveq #SndID_Rumbling,d0
  78970. jsrto (PlaySound).l, JmpTo12_PlaySound
  78971. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  78972. lea (ObjC7_ChildDeltas).l,a1
  78973. bra.w ObjC7_PositionChildren
  78974. ; ---------------------------------------------------------------------------
  78975. +
  78976. addq.b #2,routine_secondary(a0)
  78977. clr.w y_vel(a0)
  78978. move.b #$1F,anim_frame_duration(a0)
  78979. move.b #$16,collision_flags(a0)
  78980. move.b #$C,collision_property(a0)
  78981. bsr.w ObjC7_InitCollision
  78982. movea.w objoff_38(a0),a1 ; a1=object
  78983. move.b #6,routine_secondary(a1)
  78984. rts
  78985. ; ===========================================================================
  78986.  
  78987. loc_3D62E:
  78988. bsr.w ObjC7_CheckHit
  78989. subq.b #1,anim_frame_duration(a0)
  78990. bmi.s +
  78991. rts
  78992. ; ---------------------------------------------------------------------------
  78993. +
  78994. addq.b #2,routine_secondary(a0)
  78995. rts
  78996. ; ===========================================================================
  78997.  
  78998. loc_3D640:
  78999. bsr.w ObjC7_CheckHit
  79000. addq.b #2,routine_secondary(a0)
  79001. move.b #$20,anim_frame_duration(a0)
  79002. move.b angle(a0),d0
  79003. addq.b #1,d0
  79004. move.b d0,angle(a0)
  79005. andi.w #3,d0
  79006. move.b byte_3D680(pc,d0.w),d0
  79007. move.b d0,anim(a0)
  79008. clr.b next_anim(a0)
  79009. cmpi.b #2,d0
  79010. bne.s + ; rts
  79011. movea.w objoff_38(a0),a1 ; a1=object
  79012. move.b #4,routine_secondary(a1)
  79013. move.b #2,anim(a1)
  79014. +
  79015. rts
  79016. ; ===========================================================================
  79017. byte_3D680:
  79018. dc.b 2
  79019. dc.b 0 ; 1
  79020. dc.b 2 ; 2
  79021. dc.b 4 ; 3
  79022. ; ===========================================================================
  79023.  
  79024. loc_3D684:
  79025. bsr.w ObjC7_CheckHit
  79026. moveq #0,d0
  79027. move.b anim(a0),d0
  79028. move.w off_3D696(pc,d0.w),d1
  79029. jmp off_3D696(pc,d1.w)
  79030. ; ===========================================================================
  79031. off_3D696: offsetTable
  79032. offsetTableEntry.w loc_3D6AA ; 0
  79033. offsetTableEntry.w loc_3D702 ; 2
  79034. offsetTableEntry.w loc_3D83C ; 4
  79035. ; ===========================================================================
  79036. subq.b #1,anim_frame_duration(a0)
  79037. bmi.s +
  79038. rts
  79039. ; ---------------------------------------------------------------------------
  79040. +
  79041. addq.b #2,anim(a0)
  79042. rts
  79043. ; ===========================================================================
  79044.  
  79045. loc_3D6AA:
  79046. moveq #0,d0
  79047. move.b next_anim(a0),d0
  79048. move.w off_3D6B8(pc,d0.w),d1
  79049. jmp off_3D6B8(pc,d1.w)
  79050. ; ===========================================================================
  79051. off_3D6B8: offsetTable
  79052. offsetTableEntry.w loc_3D6C0 ; 0
  79053. offsetTableEntry.w loc_3D6CE ; 2
  79054. offsetTableEntry.w loc_3D6C0 ; 4
  79055. offsetTableEntry.w loc_3D6E8 ; 6
  79056. ; ===========================================================================
  79057.  
  79058. loc_3D6C0:
  79059. subq.b #1,anim_frame_duration(a0)
  79060. bmi.s +
  79061. rts
  79062. ; ---------------------------------------------------------------------------
  79063. +
  79064. addq.b #2,next_anim(a0)
  79065. rts
  79066. ; ===========================================================================
  79067.  
  79068. loc_3D6CE:
  79069. lea (off_3E40C).l,a1
  79070. bsr.w loc_3E1AA
  79071. bne.s +
  79072. rts
  79073. ; ---------------------------------------------------------------------------
  79074. +
  79075. addq.b #2,next_anim(a0)
  79076. move.b #$40,anim_frame_duration(a0)
  79077. rts
  79078. ; ===========================================================================
  79079.  
  79080. loc_3D6E8:
  79081. lea (off_3E42C).l,a1
  79082. bsr.w loc_3E1AA
  79083. bne.s +
  79084. rts
  79085. ; ---------------------------------------------------------------------------
  79086. +
  79087. subq.b #2,routine_secondary(a0)
  79088. move.b #$40,anim_frame_duration(a0)
  79089. rts
  79090. ; ===========================================================================
  79091.  
  79092. loc_3D702:
  79093. moveq #0,d0
  79094. move.b next_anim(a0),d0
  79095. move.w off_3D710(pc,d0.w),d1
  79096. jmp off_3D710(pc,d1.w)
  79097. ; ===========================================================================
  79098. off_3D710: offsetTable
  79099. offsetTableEntry.w loc_3D6C0 ; 0
  79100. offsetTableEntry.w loc_3D720 ; 2
  79101. offsetTableEntry.w loc_3D744 ; 4
  79102. offsetTableEntry.w loc_3D6C0 ; 6
  79103. offsetTableEntry.w loc_3D784 ; 8
  79104. offsetTableEntry.w loc_3D7B8 ; $A
  79105. offsetTableEntry.w loc_3D7F0 ; $C
  79106. offsetTableEntry.w loc_3D82E ; $C
  79107. ; ===========================================================================
  79108.  
  79109. loc_3D720:
  79110. lea (off_3E3D0).l,a1
  79111. bsr.w loc_3E1AA
  79112. bne.s +
  79113. rts
  79114. ; ---------------------------------------------------------------------------
  79115. +
  79116. addq.b #2,next_anim(a0)
  79117. move.b #$80,anim_frame_duration(a0)
  79118. clr.w x_vel(a0)
  79119. move.w #-$200,y_vel(a0)
  79120. rts
  79121. ; ===========================================================================
  79122.  
  79123. loc_3D744:
  79124. subq.b #1,anim_frame_duration(a0)
  79125. bmi.s ++
  79126. move.b (Vint_runcount+3).w,d0
  79127. andi.b #$1F,d0
  79128. bne.s +
  79129. moveq #SndID_Fire,d0
  79130. jsrto (PlaySoundLocal).l, JmpTo_PlaySoundLocal
  79131. +
  79132. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  79133. lea (ObjC7_ChildDeltas).l,a1
  79134. bra.w ObjC7_PositionChildren
  79135. ; ---------------------------------------------------------------------------
  79136. +
  79137. addq.b #2,next_anim(a0)
  79138. clr.w y_vel(a0)
  79139. lea (ChildObjC7_TargettingSensor).l,a2
  79140. bsr.w LoadChildObject
  79141. clr.w x_vel(a0)
  79142. clr.w objoff_28(a0)
  79143. rts
  79144. ; ===========================================================================
  79145.  
  79146. loc_3D784:
  79147. move.w objoff_28(a0),d0
  79148. bne.s +
  79149. rts
  79150. ; ---------------------------------------------------------------------------
  79151. +
  79152. addq.b #2,next_anim(a0)
  79153. move.w d0,x_pos(a0)
  79154. bclr #0,render_flags(a0)
  79155. cmpi.w #$780,d0
  79156. bhs.s +
  79157. bset #0,render_flags(a0)
  79158. +
  79159. bsr.w loc_3E168
  79160. move.w #$800,y_vel(a0)
  79161. move.b #$20,anim_frame_duration(a0)
  79162. rts
  79163. ; ===========================================================================
  79164.  
  79165. loc_3D7B8:
  79166. subq.b #1,anim_frame_duration(a0)
  79167. bmi.s +
  79168. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  79169. lea (ObjC7_ChildDeltas).l,a1
  79170. bra.w ObjC7_PositionChildren
  79171. ; ---------------------------------------------------------------------------
  79172. +
  79173. addq.b #2,next_anim(a0)
  79174. clr.w y_vel(a0)
  79175. move.b #1,(Screen_Shaking_Flag).w
  79176. move.w #$40,(DEZ_Shake_Timer).w
  79177. movea.w objoff_38(a0),a1 ; a1=object
  79178. move.b #6,routine_secondary(a1)
  79179. moveq #SndID_Smash,d0
  79180. jmpto (PlaySound).l, JmpTo12_PlaySound
  79181. ; ===========================================================================
  79182.  
  79183. loc_3D7F0:
  79184. lea (off_3E30A).l,a1
  79185. bsr.w loc_3E1AA
  79186. bne.s +
  79187. rts
  79188. ; ---------------------------------------------------------------------------
  79189. +
  79190. lea (ObjC7_ChildDeltas).l,a1
  79191. bsr.w ObjC7_PositionChildren
  79192. bsr.w Obj_GetOrientationToPlayer
  79193. btst #0,render_flags(a0)
  79194. beq.s +
  79195. subq.w #2,d0
  79196. +
  79197. tst.w d0
  79198. bne.s +
  79199. subq.b #2,routine_secondary(a0)
  79200. rts
  79201. ; ---------------------------------------------------------------------------
  79202. +
  79203. addq.b #2,next_anim(a0)
  79204. move.b #$60,anim_frame_duration(a0)
  79205. bra.w CreateEggmanBombs
  79206. ; ===========================================================================
  79207.  
  79208. loc_3D82E:
  79209. subq.b #1,anim_frame_duration(a0)
  79210. bmi.s +
  79211. rts
  79212. ; ---------------------------------------------------------------------------
  79213. +
  79214. subq.b #2,routine_secondary(a0)
  79215. rts
  79216. ; ===========================================================================
  79217.  
  79218. loc_3D83C:
  79219. moveq #0,d0
  79220. move.b next_anim(a0),d0
  79221. move.w off_3D84A(pc,d0.w),d1
  79222. jmp off_3D84A(pc,d1.w)
  79223. ; ===========================================================================
  79224. off_3D84A: offsetTable
  79225. offsetTableEntry.w loc_3D6C0 ; 0
  79226. offsetTableEntry.w loc_3D856 ; 2
  79227. offsetTableEntry.w loc_3D6C0 ; 4
  79228. offsetTableEntry.w loc_3D89E ; 6
  79229. offsetTableEntry.w loc_3D6C0 ; 8
  79230. offsetTableEntry.w loc_3D8B8 ; $A
  79231. ; ===========================================================================
  79232.  
  79233. loc_3D856:
  79234. bset #6,status(a0)
  79235. lea (off_3E2F6).l,a1
  79236. bsr.w loc_3E1AA
  79237. bne.s +
  79238. rts
  79239. ; ---------------------------------------------------------------------------
  79240. +
  79241. bsr.w Obj_GetOrientationToPlayer
  79242. btst #0,render_flags(a0)
  79243. beq.s +
  79244. subq.w #2,d0
  79245. +
  79246. tst.w d0
  79247. bne.s +
  79248. addq.b #2,next_anim(a0)
  79249. move.b #$40,anim_frame_duration(a0)
  79250. bset #4,status(a0)
  79251. rts
  79252. ; ---------------------------------------------------------------------------
  79253. +
  79254. move.b #8,next_anim(a0)
  79255. move.b #$20,anim_frame_duration(a0)
  79256. bra.w CreateEggmanBombs
  79257. ; ===========================================================================
  79258.  
  79259. loc_3D89E:
  79260. subq.b #1,anim_frame_duration(a0)
  79261. bmi.s +
  79262. rts
  79263. ; ---------------------------------------------------------------------------
  79264. +
  79265. addq.b #2,next_anim(a0)
  79266. bset #5,status(a0)
  79267. move.b #$40,anim_frame_duration(a0)
  79268. rts
  79269. ; ===========================================================================
  79270.  
  79271. loc_3D8B8:
  79272. lea (off_3E300).l,a1
  79273. bsr.w loc_3E1AA
  79274. bne.s +
  79275. rts
  79276. ; ---------------------------------------------------------------------------
  79277. +
  79278. subq.b #2,routine_secondary(a0)
  79279. bclr #6,status(a0)
  79280. rts
  79281. ; ===========================================================================
  79282.  
  79283. loc_3D8D2:
  79284. moveq #0,d0
  79285. move.b anim(a0),d0
  79286. move.w off_3D8E0(pc,d0.w),d1
  79287. jmp off_3D8E0(pc,d1.w)
  79288. ; ===========================================================================
  79289. off_3D8E0: offsetTable
  79290. offsetTableEntry.w loc_3D8E6 ; 0
  79291. offsetTableEntry.w loc_3D922 ; 2
  79292. offsetTableEntry.w loc_3D93C ; 4
  79293. ; ===========================================================================
  79294.  
  79295. loc_3D8E6:
  79296. jsrto (Boss_LoadExplosion).l, JmpTo_Boss_LoadExplosion
  79297. jsrto (ObjectMoveAndFall).l, JmpTo8_ObjectMoveAndFall
  79298. move.w y_pos(a0),d0
  79299. cmpi.w #$15C,d0
  79300. bhs.s +
  79301. rts
  79302. ; ---------------------------------------------------------------------------
  79303. +
  79304. move.w #$15C,y_pos(a0)
  79305. move.w y_vel(a0),d0
  79306. bmi.s +
  79307. lsr.w #2,d0
  79308. cmpi.w #$100,d0
  79309. blo.s +
  79310. neg.w d0
  79311. move.w d0,y_vel(a0)
  79312. rts
  79313. ; ---------------------------------------------------------------------------
  79314. +
  79315. addq.b #2,anim(a0)
  79316. move.b #$40,anim_frame_duration(a0)
  79317. rts
  79318. ; ===========================================================================
  79319.  
  79320. loc_3D922:
  79321. subq.b #1,anim_frame_duration(a0)
  79322. bmi.s +
  79323. jmpto (Boss_LoadExplosion).l, JmpTo_Boss_LoadExplosion
  79324. ; ---------------------------------------------------------------------------
  79325. +
  79326. addq.b #2,anim(a0)
  79327. st (Control_Locked).w
  79328. move.w #$1000,(Camera_Max_X_pos).w
  79329. rts
  79330. ; ===========================================================================
  79331.  
  79332. loc_3D93C:
  79333. move.w #(button_right_mask<<8)|button_right_mask,(Ctrl_1_Logical).w
  79334. cmpi.w #$840,(Camera_X_pos).w
  79335. bhs.s +
  79336. rts
  79337. ; ---------------------------------------------------------------------------
  79338. +
  79339. move.b #$20,routine(a0)
  79340. clr.b routine_secondary(a0)
  79341. move.w #$20,objoff_2A(a0)
  79342. move.b #1,(Screen_Shaking_Flag).w
  79343. move.w #$1000,(DEZ_Shake_Timer).w
  79344. movea.w objoff_36(a0),a1 ; a1=object
  79345. jmpto (DeleteObject2).l, JmpTo6_DeleteObject2
  79346. ; ===========================================================================
  79347. ;loc_3D970
  79348. ObjC7_SetupEnding:
  79349. move.b (Vint_runcount+3).w,d0
  79350. andi.b #$1F,d0
  79351. bne.s +
  79352. moveq #SndID_Rumbling2,d0
  79353. jsrto (PlaySound).l, JmpTo12_PlaySound
  79354. subq.w #1,objoff_2A(a0)
  79355. +
  79356. lea (MainCharacter).w,a1 ; a1=character
  79357. move.w x_pos(a1),d0
  79358. sub.w objoff_2A(a0),d0
  79359. move.w d0,x_pos(a0)
  79360. move.w y_pos(a1),y_pos(a0)
  79361. bsr.w loc_3DFBA
  79362. moveq #0,d0
  79363. move.b routine_secondary(a0),d0
  79364. move.w off_3D9AC(pc,d0.w),d1
  79365. jmp off_3D9AC(pc,d1.w)
  79366. ; ===========================================================================
  79367. off_3D9AC: offsetTable
  79368. offsetTableEntry.w loc_3D9B0 ; 0
  79369. offsetTableEntry.w loc_3D9D6 ; 2
  79370. ; ===========================================================================
  79371.  
  79372. loc_3D9B0:
  79373. lea (MainCharacter).w,a1 ; a1=character
  79374. cmpi.w #$EC0,x_pos(a1)
  79375. bhs.s loc_3D9BE
  79376. rts
  79377. ; ===========================================================================
  79378.  
  79379. loc_3D9BE:
  79380. addq.b #2,routine_secondary(a0)
  79381. move.w #$3F,(Palette_fade_range).w
  79382. move.b #$16,anim_frame_duration(a0)
  79383. move.w #$7FFF,(PalCycle_Timer).w
  79384. rts
  79385. ; ===========================================================================
  79386.  
  79387. loc_3D9D6:
  79388. subq.b #1,anim_frame_duration(a0)
  79389. beq.w +
  79390. movea.l a0,a1
  79391. lea (Normal_palette).w,a0
  79392.  
  79393. moveq #$3F,d0
  79394. - jsrto (Pal_FadeToWhite.UpdateColour).l, JmpTo_Pal_FadeToWhite_UpdateColour
  79395. dbf d0,-
  79396. movea.l a1,a0
  79397. rts
  79398. ; ---------------------------------------------------------------------------
  79399. +
  79400. move.l #$EEE0EEE,d0
  79401. lea (Normal_palette).w,a1
  79402.  
  79403. moveq #$1F,d6
  79404. - move.l d0,(a1)+
  79405. dbf d6,-
  79406.  
  79407. moveq #MusID_FadeOut,d0
  79408. jsrto (PlaySound).l, JmpTo12_PlaySound
  79409. move.b #GameModeID_EndingSequence,(Game_Mode).w ; => EndingSequence
  79410. bra.w JmpTo65_DeleteObject
  79411. ; ===========================================================================
  79412.  
  79413. ObjC7_Shoulder:
  79414. moveq #0,d0
  79415. move.b routine_secondary(a0),d0
  79416. move.w off_3DA34(pc,d0.w),d1
  79417. jsr off_3DA34(pc,d1.w)
  79418. lea byte_3DA38(pc),a1
  79419. bsr.w loc_3E282
  79420. tst.b (a0)
  79421. beq.w return_37A48
  79422. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79423. ; ===========================================================================
  79424. off_3DA34: offsetTable
  79425. offsetTableEntry.w loc_3DA3C ; 0
  79426. offsetTableEntry.w return_3DA48 ; 2
  79427. ; ===========================================================================
  79428. byte_3DA38:
  79429. dc.b 0
  79430. dc.b $C ; 1
  79431. dc.b $FF ; 2
  79432. dc.b $EC ; 3
  79433. ; ===========================================================================
  79434.  
  79435. loc_3DA3C:
  79436. addq.b #2,routine_secondary(a0)
  79437. move.b #4,mapping_frame(a0)
  79438. rts
  79439. ; ===========================================================================
  79440.  
  79441. return_3DA48:
  79442. rts
  79443. ; ===========================================================================
  79444. ;loc_3DA4A
  79445. ObjC7_FrontLowerLeg:
  79446. moveq #0,d0
  79447. move.b routine_secondary(a0),d0
  79448. move.w off_3DA62(pc,d0.w),d1
  79449. jsr off_3DA62(pc,d1.w)
  79450. tst.b (a0)
  79451. beq.w return_37A48
  79452. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79453. ; ===========================================================================
  79454. off_3DA62: offsetTable
  79455. offsetTableEntry.w loc_3DA66 ; 0
  79456. offsetTableEntry.w return_3DA72 ; 2
  79457. ; ===========================================================================
  79458.  
  79459. loc_3DA66:
  79460. addq.b #2,routine_secondary(a0)
  79461. move.b #$B,mapping_frame(a0)
  79462. rts
  79463. ; ===========================================================================
  79464.  
  79465. return_3DA72:
  79466. rts
  79467. ; ===========================================================================
  79468. ;loc_3DA74
  79469. ObjC7_FrontForearm:
  79470. moveq #0,d0
  79471. move.b routine_secondary(a0),d0
  79472. move.w off_3DA96(pc,d0.w),d1
  79473. jsr off_3DA96(pc,d1.w)
  79474. tst.b (a0)
  79475. beq.w return_37A48
  79476. btst #6,status(a0)
  79477. bne.w return_37A48
  79478. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79479. ; ===========================================================================
  79480. off_3DA96: offsetTable
  79481. offsetTableEntry.w loc_3DAA0 ; 0
  79482. offsetTableEntry.w loc_3DAAC ; 2
  79483. offsetTableEntry.w loc_3DACC ; 4
  79484. offsetTableEntry.w loc_3DB32 ; 6
  79485. offsetTableEntry.w loc_3DB5A ; 8
  79486. ; ===========================================================================
  79487.  
  79488. loc_3DAA0:
  79489. addq.b #2,routine_secondary(a0)
  79490. move.b #6,mapping_frame(a0)
  79491. rts
  79492. ; ===========================================================================
  79493.  
  79494. loc_3DAAC:
  79495. movea.w objoff_2C(a0),a1 ; a1=object
  79496. bclr #4,status(a1)
  79497. bne.s +
  79498. rts
  79499. ; ---------------------------------------------------------------------------
  79500. +
  79501. addq.b #2,routine_secondary(a0)
  79502. move.w #$10,objoff_2A(a0)
  79503. move.w y_pos(a0),objoff_2E(a0)
  79504. rts
  79505. ; ===========================================================================
  79506.  
  79507. loc_3DACC:
  79508. subq.w #1,objoff_2A(a0)
  79509. bmi.s +
  79510. addi.w #$20,y_vel(a0)
  79511. jmpto (ObjectMove).l, JmpTo26_ObjectMove
  79512. ; ---------------------------------------------------------------------------
  79513. +
  79514. addq.b #2,routine_secondary(a0)
  79515. move.w #$20,objoff_2A(a0)
  79516. bsr.w Obj_GetOrientationToPlayer
  79517. abs.w d2
  79518. cmpi.w #$100,d2
  79519. blo.s +
  79520. move.w #$FF,d2
  79521. +
  79522. andi.w #$C0,d2
  79523. lsr.w #5,d2
  79524. move.w word_3DB2A(pc,d2.w),d2
  79525. tst.w d1
  79526. bne.s +
  79527. neg.w d2
  79528. +
  79529. move.w d2,y_vel(a0)
  79530. move.w #$800,d2
  79531. movea.w objoff_2C(a0),a1 ; a1=object
  79532. btst #0,render_flags(a0)
  79533. bne.s +
  79534. neg.w d2
  79535. +
  79536. move.w d2,x_vel(a0)
  79537. moveq #SndID_SpindashRelease,d0
  79538. jmpto (PlaySound).l, JmpTo12_PlaySound
  79539. ; ===========================================================================
  79540. word_3DB2A:
  79541. dc.w $200
  79542. dc.w $100 ; 1
  79543. dc.w $80 ; 2
  79544. dc.w 0 ; 3
  79545. ; ===========================================================================
  79546.  
  79547. loc_3DB32:
  79548. subq.w #1,objoff_2A(a0)
  79549. bmi.s +
  79550. jmpto (ObjectMove).l, JmpTo26_ObjectMove
  79551. ; ---------------------------------------------------------------------------
  79552. +
  79553. addq.b #2,routine_secondary(a0)
  79554. neg.w x_vel(a0)
  79555. move.w #$20,objoff_2A(a0)
  79556. move.w objoff_2E(a0),d0
  79557. sub.w y_pos(a0),d0
  79558. asl.w #3,d0
  79559. move.w d0,y_vel(a0)
  79560. rts
  79561. ; ===========================================================================
  79562.  
  79563. loc_3DB5A:
  79564. subq.w #1,objoff_2A(a0)
  79565. bmi.s +
  79566. jmpto (ObjectMove).l, JmpTo26_ObjectMove
  79567. ; ---------------------------------------------------------------------------
  79568. +
  79569. move.b #2,routine_secondary(a0)
  79570. clr.w x_vel(a0)
  79571. clr.w y_vel(a0)
  79572. rts
  79573. ; ===========================================================================
  79574. ;loc_3DB74
  79575. ObjC7_Arm:
  79576. moveq #0,d0
  79577. move.b routine_secondary(a0),d0
  79578. move.w off_3DB8C(pc,d0.w),d1
  79579. jsr off_3DB8C(pc,d1.w)
  79580. tst.b (a0)
  79581. beq.w return_37A48
  79582. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79583. ; ===========================================================================
  79584. off_3DB8C: offsetTable
  79585. offsetTableEntry.w loc_3DB90 ; 0
  79586. offsetTableEntry.w return_3DB9C ; 2
  79587. ; ===========================================================================
  79588.  
  79589. loc_3DB90:
  79590. addq.b #2,routine_secondary(a0)
  79591. move.b #5,mapping_frame(a0)
  79592. rts
  79593. ; ===========================================================================
  79594.  
  79595. return_3DB9C:
  79596. rts
  79597. ; ===========================================================================
  79598. ;loc_3DB9E
  79599. ObjC7_FrontThigh:
  79600. moveq #0,d0
  79601. move.b routine_secondary(a0),d0
  79602. move.w off_3DBB6(pc,d0.w),d1
  79603. jsr off_3DBB6(pc,d1.w)
  79604. tst.b (a0)
  79605. beq.w return_37A48
  79606. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79607. ; ===========================================================================
  79608. off_3DBB6: offsetTable
  79609. offsetTableEntry.w loc_3DBBA ; 0
  79610. offsetTableEntry.w return_3DBC6 ; 2
  79611. ; ===========================================================================
  79612.  
  79613. loc_3DBBA:
  79614. addq.b #2,routine_secondary(a0)
  79615. move.b #$A,mapping_frame(a0)
  79616. rts
  79617. ; ===========================================================================
  79618.  
  79619. return_3DBC6:
  79620. rts
  79621. ; ===========================================================================
  79622. ;loc_3DBC8
  79623. ObjC7_Head:
  79624. moveq #0,d0
  79625. move.b routine_secondary(a0),d0
  79626. move.w off_3DBE8(pc,d0.w),d1
  79627. jsr off_3DBE8(pc,d1.w)
  79628. lea byte_3DBF2(pc),a1
  79629. bsr.w loc_3E282
  79630. tst.b (a0)
  79631. beq.w return_37A48
  79632. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79633. ; ===========================================================================
  79634. off_3DBE8: offsetTable
  79635. offsetTableEntry.w loc_3DBF6 ; 0
  79636. offsetTableEntry.w loc_3DC02 ; 2
  79637. offsetTableEntry.w loc_3DC1C ; 4
  79638. offsetTableEntry.w loc_3DC2A ; 6
  79639. offsetTableEntry.w loc_3DC46 ; 8
  79640. ; ===========================================================================
  79641. byte_3DBF2:
  79642. dc.b 0
  79643. dc.b 0 ; 1
  79644. dc.b $FF ; 2
  79645. dc.b $CC ; 3
  79646. ; ===========================================================================
  79647.  
  79648. loc_3DBF6:
  79649. addq.b #2,routine_secondary(a0)
  79650. move.b #$15,mapping_frame(a0)
  79651. rts
  79652. ; ===========================================================================
  79653.  
  79654. loc_3DC02:
  79655. movea.w (DEZ_Eggman).w,a1
  79656. btst #3,$22(a1)
  79657. bne.s +
  79658. rts
  79659. ; ---------------------------------------------------------------------------
  79660. +
  79661. addq.b #2,routine_secondary(a0)
  79662. move.w #$40,objoff_2A(a0)
  79663. rts
  79664. ; ===========================================================================
  79665.  
  79666. loc_3DC1C:
  79667. lea (Ani_objC7_a).l,a1
  79668. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  79669. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79670. ; ===========================================================================
  79671.  
  79672. loc_3DC2A:
  79673. subq.w #1,objoff_2A(a0)
  79674. bmi.s +
  79675. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79676. ; ---------------------------------------------------------------------------
  79677. +
  79678. addq.b #2,routine_secondary(a0)
  79679. movea.w objoff_2C(a0),a1 ; a1=object
  79680. bset #2,status(a1)
  79681. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79682. ; ===========================================================================
  79683.  
  79684. loc_3DC46:
  79685. move.b #-1,collision_property(a0)
  79686. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79687. ; ===========================================================================
  79688. ;loc_3DC50
  79689. ObjC7_Jet:
  79690. moveq #0,d0
  79691. move.b routine_secondary(a0),d0
  79692. move.w off_3DC66(pc,d0.w),d1
  79693. jsr off_3DC66(pc,d1.w)
  79694. lea byte_3DC70(pc),a1
  79695. bra.w loc_3E282
  79696. ; ===========================================================================
  79697. off_3DC66: offsetTable
  79698. offsetTableEntry.w loc_3DC74
  79699. offsetTableEntry.w loc_3DC80
  79700. offsetTableEntry.w loc_3DC86
  79701. offsetTableEntry.w loc_3DC94
  79702. offsetTableEntry.w loc_3DC80
  79703. ; ===========================================================================
  79704. byte_3DC70:
  79705. dc.b 0
  79706. dc.b $38 ; 1
  79707. dc.b 0 ; 2
  79708. dc.b $18 ; 3
  79709. ; ===========================================================================
  79710.  
  79711. loc_3DC74:
  79712. addq.b #2,routine_secondary(a0)
  79713. move.b #$C,mapping_frame(a0)
  79714. rts
  79715. ; ===========================================================================
  79716.  
  79717. loc_3DC80:
  79718. move.b #3,anim(a0)
  79719.  
  79720. loc_3DC86:
  79721. lea (Ani_objC7_b).l,a1
  79722. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  79723. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79724. ; ===========================================================================
  79725.  
  79726. loc_3DC94:
  79727. move.b #1,anim(a0)
  79728. bra.s loc_3DC86
  79729. ; ===========================================================================
  79730. ;loc_3DC9C
  79731. ObjC7_BackLowerLeg:
  79732. moveq #0,d0
  79733. move.b routine_secondary(a0),d0
  79734. move.w off_3DCB4(pc,d0.w),d1
  79735. jsr off_3DCB4(pc,d1.w)
  79736. tst.b (a0)
  79737. beq.w return_37A48
  79738. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79739. ; ===========================================================================
  79740. off_3DCB4: offsetTable
  79741. offsetTableEntry.w loc_3DCB8 ; 0
  79742. offsetTableEntry.w return_3DCCA ; 2
  79743. ; ===========================================================================
  79744.  
  79745. loc_3DCB8:
  79746. addq.b #2,routine_secondary(a0)
  79747. move.b #$B,mapping_frame(a0)
  79748. move.b #5,priority(a0)
  79749. rts
  79750. ; ===========================================================================
  79751.  
  79752. return_3DCCA:
  79753. rts
  79754. ; ===========================================================================
  79755. ;loc_3DCCC
  79756. ObjC7_BackForearm:
  79757. moveq #0,d0
  79758. move.b routine_secondary(a0),d0
  79759. move.w off_3DCE4(pc,d0.w),d1
  79760. jsr off_3DCE4(pc,d1.w)
  79761. tst.b (a0)
  79762. beq.w return_37A48
  79763. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79764. ; ===========================================================================
  79765. off_3DCE4: offsetTable
  79766. offsetTableEntry.w loc_3DCEE ; 0
  79767. offsetTableEntry.w loc_3DD00 ; 2
  79768. offsetTableEntry.w loc_3DACC ; 4
  79769. offsetTableEntry.w loc_3DB32 ; 6
  79770. offsetTableEntry.w loc_3DB5A ; 8
  79771. ; ===========================================================================
  79772.  
  79773. loc_3DCEE:
  79774. addq.b #2,routine_secondary(a0)
  79775. move.b #6,mapping_frame(a0)
  79776. move.b #5,priority(a0)
  79777. rts
  79778. ; ===========================================================================
  79779.  
  79780. loc_3DD00:
  79781. movea.w objoff_2C(a0),a1 ; a1=object
  79782. bclr #5,status(a1)
  79783. bne.s +
  79784. rts
  79785. ; ---------------------------------------------------------------------------
  79786. +
  79787. addq.b #2,routine_secondary(a0)
  79788. move.w #$10,objoff_2A(a0)
  79789. move.w y_pos(a0),objoff_2E(a0)
  79790. rts
  79791. ; ===========================================================================
  79792. ;loc_3DD20
  79793. ObjC7_BackThigh:
  79794. moveq #0,d0
  79795. move.b routine_secondary(a0),d0
  79796. move.w off_3DD38(pc,d0.w),d1
  79797. jsr off_3DD38(pc,d1.w)
  79798. tst.b (a0)
  79799. beq.w return_37A48
  79800. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79801. ; ===========================================================================
  79802. off_3DD38: offsetTable
  79803. offsetTableEntry.w loc_3DD3C ; 0
  79804. offsetTableEntry.w return_3DD4E ; 2
  79805. ; ===========================================================================
  79806.  
  79807. loc_3DD3C:
  79808. addq.b #2,routine_secondary(a0)
  79809. move.b #$A,mapping_frame(a0)
  79810. move.b #5,priority(a0)
  79811. rts
  79812. ; ===========================================================================
  79813.  
  79814. return_3DD4E:
  79815. rts
  79816. ; ===========================================================================
  79817. ;loc_3DD50
  79818. ObjC7_TargettingSensor:
  79819. moveq #0,d0
  79820. move.b routine_secondary(a0),d0
  79821. move.w off_3DD5E(pc,d0.w),d1
  79822. jmp off_3DD5E(pc,d1.w)
  79823. ; ===========================================================================
  79824. off_3DD5E: offsetTable
  79825. offsetTableEntry.w loc_3DD64 ; 0
  79826. offsetTableEntry.w loc_3DDA6 ; 2
  79827. offsetTableEntry.w loc_3DE3C ; 4
  79828. ; ===========================================================================
  79829.  
  79830. loc_3DD64:
  79831. addq.b #2,routine_secondary(a0)
  79832. move.b #$10,mapping_frame(a0)
  79833. ori.w #high_priority,art_tile(a0)
  79834. move.b #1,priority(a0)
  79835. move.w #$A0,objoff_2A(a0)
  79836. lea (MainCharacter).w,a1 ; a1=character
  79837. move.w x_pos(a1),x_pos(a0)
  79838. move.w y_pos(a1),y_pos(a0)
  79839. move.w x_vel(a1),objoff_30(a0)
  79840. move.w y_vel(a1),objoff_32(a0)
  79841. move.w #$18,angle(a0)
  79842. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79843. ; ===========================================================================
  79844.  
  79845. loc_3DDA6:
  79846. subq.w #1,objoff_2A(a0)
  79847. bmi.s loc_3DE0A
  79848. lea next_object(a0),a1 ; a1=object
  79849. movea.l a1,a2
  79850. move.w -(a1),y_vel(a0)
  79851. move.w -(a1),x_vel(a0)
  79852.  
  79853. moveq #2,d6
  79854. - move.l -(a1),-(a2)
  79855. dbf d6,-
  79856.  
  79857. lea (MainCharacter).w,a2 ; a2=character
  79858. move.w x_vel(a2),d0
  79859. bne.s +
  79860. move.w x_pos(a2),x_pos(a0)
  79861. +
  79862. move.w d0,(a1)+
  79863. move.w y_vel(a2),d0
  79864. bne.s +
  79865. move.w y_pos(a2),y_pos(a0)
  79866. +
  79867. move.w d0,(a1)+
  79868. jsrto (ObjectMove).l, JmpTo26_ObjectMove
  79869. lea (Ani_objC7_c).l,a1
  79870. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  79871. subq.b #1,angle(a0)
  79872. bpl.s +
  79873. subq.b #1,objoff_27(a0)
  79874. move.b objoff_27(a0),angle(a0)
  79875. moveq #SndID_Beep,d0
  79876. jsrto (PlaySound).l, JmpTo12_PlaySound
  79877. +
  79878. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79879. ; ===========================================================================
  79880.  
  79881. loc_3DE0A:
  79882. addq.b #2,routine_secondary(a0)
  79883. move.w #$40,objoff_2A(a0)
  79884. move.b #4,angle(a0)
  79885. lea (MainCharacter).w,a1 ; a1=character
  79886. move.w x_pos(a1),x_pos(a0)
  79887. move.w y_pos(a1),y_pos(a0)
  79888. lea (ChildObjC7_TargettingLock).l,a2
  79889. bsr.w LoadChildObject
  79890. clr.w x_vel(a0)
  79891. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79892. ; ===========================================================================
  79893.  
  79894. loc_3DE3C:
  79895. subq.w #1,objoff_2A(a0)
  79896. bmi.s loc_3DE62
  79897. lea (Ani_objC7_c).l,a1
  79898. jsrto (AnimateSprite).l, JmpTo25_AnimateSprite
  79899. subq.b #1,angle(a0)
  79900. bpl.s +
  79901. move.b #4,angle(a0)
  79902. moveq #SndID_Beep,d0
  79903. jsrto (PlaySound).l, JmpTo12_PlaySound
  79904. +
  79905. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79906. ; ===========================================================================
  79907.  
  79908. loc_3DE62:
  79909. movea.w objoff_2C(a0),a1 ; a1=object
  79910. move.w x_pos(a0),objoff_28(a1)
  79911. bra.w JmpTo65_DeleteObject
  79912. ; ===========================================================================
  79913. ;loc_3DE70
  79914. ObjC7_TargettingLock:
  79915. moveq #0,d0
  79916. move.b routine_secondary(a0),d0
  79917. move.w off_3DE7E(pc,d0.w),d1
  79918. jmp off_3DE7E(pc,d1.w)
  79919. ; ===========================================================================
  79920. off_3DE7E: offsetTable
  79921. offsetTableEntry.w loc_3DE82 ; 0
  79922. offsetTableEntry.w loc_3DEA2 ; 2
  79923. ; ===========================================================================
  79924.  
  79925. loc_3DE82:
  79926. addq.b #2,routine_secondary(a0)
  79927. move.b #$14,mapping_frame(a0)
  79928. move.b #1,priority(a0)
  79929. ori.w #high_priority,art_tile(a0)
  79930. move.w #4,objoff_2A(a0)
  79931. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79932. ; ===========================================================================
  79933.  
  79934. loc_3DEA2:
  79935. movea.w objoff_2C(a0),a1 ; a1=object
  79936. tst.b (a1)
  79937. beq.w JmpTo65_DeleteObject
  79938. subq.w #1,objoff_2A(a0)
  79939. bne.s +
  79940. move.w #4,objoff_2A(a0)
  79941. bchg #palette_bit_0,art_tile(a0)
  79942. +
  79943. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79944. ; ===========================================================================
  79945. ;loc_3DEC2
  79946. ObjC7_EggmanBomb:
  79947. moveq #0,d0
  79948. move.b routine_secondary(a0),d0
  79949. move.w off_3DED0(pc,d0.w),d1
  79950. jmp off_3DED0(pc,d1.w)
  79951. ; ===========================================================================
  79952. off_3DED0: offsetTable
  79953. offsetTableEntry.w loc_3DED8
  79954. offsetTableEntry.w loc_3DF04
  79955. offsetTableEntry.w loc_3DF36
  79956. offsetTableEntry.w loc_3DF80
  79957. ; ===========================================================================
  79958.  
  79959. loc_3DED8:
  79960. addq.b #2,routine_secondary(a0)
  79961. move.b #$E,mapping_frame(a0)
  79962. move.b #$89,collision_flags(a0)
  79963. move.b #5,priority(a0)
  79964. move.b #$C,width_pixels(a0)
  79965. lea byte_3DF00(pc),a1
  79966. bsr.w loc_3E282
  79967. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79968. ; ===========================================================================
  79969. byte_3DF00:
  79970. dc.b 0
  79971. dc.b $38 ; 1
  79972. dc.b $FF ; 2
  79973. dc.b $EC ; 3
  79974. ; ===========================================================================
  79975.  
  79976. loc_3DF04:
  79977. movea.w objoff_2C(a0),a1 ; a1=object
  79978. btst #7,status(a1)
  79979. bne.s loc_3DF4C
  79980. jsrto (ObjectMoveAndFall).l, JmpTo8_ObjectMoveAndFall
  79981. move.w y_pos(a0),d0
  79982. cmpi.w #$170,d0
  79983. bhs.s +
  79984. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79985. ; ===========================================================================
  79986. +
  79987. addq.b #2,routine_secondary(a0)
  79988. move.w #$170,y_pos(a0)
  79989. move.w #$40,objoff_2A(a0)
  79990. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  79991. ; ===========================================================================
  79992.  
  79993. loc_3DF36:
  79994. movea.w objoff_2C(a0),a1 ; a1=object
  79995. btst #7,status(a1)
  79996. bne.s loc_3DF4C
  79997. subq.w #1,objoff_2A(a0)
  79998. bmi.s loc_3DF4C
  79999. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  80000. ; ===========================================================================
  80001.  
  80002. loc_3DF4C:
  80003. move.b #6,routine_secondary(a0)
  80004. move.l #Obj58_MapUnc_2D50A,mappings(a0)
  80005. move.w #make_art_tile(ArtTile_ArtNem_FieryExplosion,0,0),art_tile(a0)
  80006. move.b #1,priority(a0)
  80007. move.b #7,anim_frame_duration(a0)
  80008. move.b #0,mapping_frame(a0)
  80009. move.w #SndID_BossExplosion,d0
  80010. jsr (PlaySound).l
  80011. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  80012. ; ===========================================================================
  80013.  
  80014. loc_3DF80:
  80015. subq.b #1,anim_frame_duration(a0)
  80016. bpl.s +
  80017. move.b #7,anim_frame_duration(a0)
  80018. addq.b #1,mapping_frame(a0)
  80019. cmpi.b #5,mapping_frame(a0)
  80020. blo.s +
  80021. clr.b collision_flags(a0)
  80022. cmpi.b #7,mapping_frame(a0)
  80023. beq.w JmpTo65_DeleteObject
  80024. +
  80025. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  80026. ; ===========================================================================
  80027. ;loc_3DFAA
  80028. ObjC7_FallingPieces:
  80029. subq.w #1,objoff_2A(a0)
  80030. bmi.w JmpTo65_DeleteObject
  80031. jsrto (ObjectMoveAndFall).l, JmpTo8_ObjectMoveAndFall
  80032. jmpto (DisplaySprite).l, JmpTo45_DisplaySprite
  80033. ; ===========================================================================
  80034.  
  80035. loc_3DFBA:
  80036. jsr (SingleObjLoad).l
  80037. bne.s + ; rts
  80038. _move.b #ObjID_BossExplosion,id(a1) ; load obj
  80039. move.w x_pos(a0),x_pos(a1)
  80040. move.w y_pos(a0),y_pos(a1)
  80041. jsr (RandomNumber).l
  80042. move.w d0,d1
  80043. moveq #0,d1
  80044. move.b d0,d1
  80045. lsr.b #2,d1
  80046. subi.w #$30,d1
  80047. add.w d1,x_pos(a1)
  80048. lsr.w #8,d0
  80049. lsr.b #2,d0
  80050. subi.w #$30,d0
  80051. add.w d0,y_pos(a1)
  80052. +
  80053. rts
  80054. ; ===========================================================================
  80055. ;loc_3DFF8
  80056. ObjC7_CheckHit:
  80057. tst.b collision_property(a0)
  80058. beq.s ObjC7_Beaten
  80059. tst.b objoff_2A(a0)
  80060. bne.s ObjC7_Flashing
  80061. tst.b collision_flags(a0)
  80062. beq.s +
  80063. movea.w objoff_36(a0),a1 ; a1=object
  80064. tst.b collision_flags(a1)
  80065. bne.s +++ ; rts
  80066. clr.b collision_flags(a0)
  80067. subq.b #1,collision_property(a0)
  80068. beq.s ObjC7_Beaten
  80069. +
  80070. move.b #$3C,objoff_2A(a0)
  80071. move.w #SndID_BossHit,d0
  80072. jsr (PlaySound).l
  80073. ;loc_3E02E
  80074. ObjC7_Flashing:
  80075. lea (Normal_palette_line2+2).w,a1
  80076. moveq #0,d0
  80077. tst.w (a1)
  80078. bne.s +
  80079. move.w #$EEE,d0
  80080. +
  80081. move.w d0,(a1)
  80082. subq.b #1,objoff_2A(a0)
  80083. bne.s +
  80084. clr.w (Normal_palette_line2+2).w
  80085. move.b #$16,collision_flags(a0)
  80086. movea.w objoff_36(a0),a1 ; a1=object
  80087. move.b #$2A,collision_flags(a1)
  80088. +
  80089. rts
  80090. ; ===========================================================================
  80091. ;loc_3E05A
  80092. ObjC7_Beaten:
  80093. moveq #100,d0
  80094. bsr.w AddPoints
  80095. clr.b anim_frame_duration(a0)
  80096. move.b #$E,routine_secondary(a0)
  80097. bset #7,status(a0)
  80098. clr.b anim(a0)
  80099. clr.b collision_flags(a0)
  80100. clr.w x_vel(a0)
  80101. clr.w y_vel(a0)
  80102. bsr.w ObjC7_RemoveCollision
  80103. bsr.w ObjC7_Break
  80104. movea.w objoff_38(a0),a1 ; a1=object
  80105. jsrto (DeleteObject2).l, JmpTo6_DeleteObject2
  80106. addq.w #4,sp
  80107. rts
  80108. ; ===========================================================================
  80109. ;loc_3E094
  80110. ObjC7_Break:
  80111. lea (ObjC7_BreakOffsets).l,a1
  80112. lea ObjC7_BreakSpeeds(pc),a2
  80113. moveq #0,d0
  80114. moveq #ObjC7_BreakOffsets_End-ObjC7_BreakOffsets-1,d6
  80115.  
  80116. - move.b (a1)+,d0
  80117. movea.w (a0,d0.w),a3 ; a3=object
  80118. move.b #$1E,routine(a3)
  80119. clr.b routine_secondary(a3)
  80120. move.w #$80,objoff_2A(a3)
  80121. move.w (a2)+,x_vel(a3)
  80122. move.w (a2)+,y_vel(a3)
  80123. dbf d6,-
  80124. rts
  80125. ; ===========================================================================
  80126. ;word_3E0C6
  80127. ObjC7_BreakSpeeds:
  80128. dc.w $200,-$400
  80129. dc.w -$100,-$100 ; 2
  80130. dc.w $300,-$300 ; 4
  80131. dc.w -$100,-$400 ; 6
  80132. dc.w $180,-$200 ; 8
  80133. dc.w -$200,-$300 ; 10
  80134. dc.w 0,-$400 ; 12
  80135. dc.w $100,-$300 ; 14
  80136. ObjC7_BreakSpeeds_End
  80137. ;byte_3E0E6
  80138. ObjC7_BreakOffsets:
  80139. dc.b objoff_2C
  80140. dc.b objoff_2E ; 1
  80141. dc.b objoff_30 ; 2
  80142. dc.b objoff_32 ; 3
  80143. dc.b objoff_34 ; 4
  80144. dc.b objoff_3A ; 5
  80145. dc.b objoff_3C ; 6
  80146. dc.b objoff_3E ; 7
  80147. ObjC7_BreakOffsets_End
  80148. ; ===========================================================================
  80149. ;loc_3E0EE
  80150. ObjC7_InitCollision:
  80151. lea ObjC7_ChildOffsets(pc),a1
  80152. lea ObjC7_ChildCollision(pc),a2
  80153. moveq #0,d0
  80154.  
  80155. moveq #ObjC7_ChildCollision_End-ObjC7_ChildCollision-1,d6
  80156. - move.b (a1)+,d0
  80157. movea.w (a0,d0.w),a3 ; a3=object
  80158. move.b (a2)+,collision_flags(a3)
  80159. dbf d6,-
  80160.  
  80161. rts
  80162. ; ===========================================================================
  80163. ;byte_3E10A
  80164. ObjC7_ChildCollision:
  80165. dc.b 0
  80166. dc.b $8F ; 1
  80167. dc.b $9C ; 2
  80168. dc.b 0 ; 3
  80169. dc.b $86 ; 4
  80170. dc.b $2A ; 5
  80171. dc.b $8B ; 6
  80172. dc.b $8F ; 7
  80173. dc.b $9C ; 8
  80174. dc.b $8B ; 9
  80175. ObjC7_ChildCollision_End
  80176. ;byte_3E114
  80177. ObjC7_ChildOffsets:
  80178. dc.b objoff_2C
  80179. dc.b objoff_2E ; 1
  80180. dc.b objoff_30 ; 2
  80181. dc.b objoff_32 ; 3
  80182. dc.b objoff_34 ; 4
  80183. dc.b objoff_36 ; 5
  80184. dc.b objoff_38 ; 6
  80185. dc.b objoff_3A ; 7
  80186. dc.b objoff_3C ; 8
  80187. dc.b objoff_3E ; 9
  80188. ObjC7_ChildOffsets_End
  80189. ; ===========================================================================
  80190. ;loc_3E11E
  80191. ObjC7_RemoveCollision:
  80192. lea ObjC7_ChildOffsets(pc),a1
  80193. moveq #0,d0
  80194. moveq #ObjC7_ChildOffsets_End-ObjC7_ChildOffsets-1,d6
  80195.  
  80196. - move.b (a1)+,d0
  80197. movea.w (a0,d0.w),a3 ; a3=object
  80198. clr.b collision_flags(a3)
  80199. dbf d6,-
  80200. rts
  80201. ; ===========================================================================
  80202. ;loc_3E136
  80203. CreateEggmanBombs:
  80204. lea EggmanBomb_InitSpeeds(pc),a3
  80205. moveq #1,d6
  80206.  
  80207. - lea (ChildObjC7_EggmanBomb).l,a2
  80208. bsr.w LoadChildObject
  80209. move.w (a3)+,d0
  80210. btst #0,render_flags(a0)
  80211. beq.s +
  80212. neg.w d0
  80213. +
  80214. move.w d0,x_vel(a1)
  80215. move.w (a3)+,y_vel(a1)
  80216. dbf d6,-
  80217. rts
  80218. ; ===========================================================================
  80219. ;word_3E160
  80220. EggmanBomb_InitSpeeds:
  80221. dc.w $60,-$800
  80222. dc.w $C0,-$A00
  80223. ; ===========================================================================
  80224.  
  80225. loc_3E168:
  80226. move.b render_flags(a0),d0
  80227. andi.b #1,d0
  80228. moveq #0,d1
  80229. lea byte_3E19E(pc),a1
  80230.  
  80231. - move.b (a1)+,d1
  80232. beq.w return_37A48
  80233. movea.w (a0,d1.w),a2 ; a2=object
  80234. move.b render_flags(a2),d2
  80235. andi.b #$FE,d2
  80236. or.b d0,d2
  80237. move.b d2,render_flags(a2)
  80238. move.b status(a2),d2
  80239. andi.b #$FE,d2
  80240. or.b d0,d2
  80241. move.b d2,status(a2)
  80242. bra.s -
  80243. ; ===========================================================================
  80244. byte_3E19E:
  80245. dc.b $2C
  80246. dc.b $2E ; 1
  80247. dc.b $30 ; 2
  80248. dc.b $32 ; 3
  80249. dc.b $34 ; 4
  80250. dc.b $36 ; 5
  80251. dc.b $38 ; 6
  80252. dc.b $3A ; 7
  80253. dc.b $3C ; 8
  80254. dc.b $3E ; 9
  80255. dc.b 0 ; 10
  80256. dc.b 0 ; 11
  80257. ; ===========================================================================
  80258.  
  80259. loc_3E1AA:
  80260. movea.l (a1)+,a2
  80261. moveq #0,d0
  80262. move.b anim_frame(a0),d0
  80263. move.b (a1,d0.w),d0
  80264. move.b d0,d1
  80265. moveq #0,d4
  80266. andi.w #$C0,d1
  80267. beq.s +
  80268. bsr.w loc_3E23E
  80269. +
  80270. add.w d0,d0
  80271. adda.w (a2,d0.w),a2
  80272. move.b (a2)+,d0
  80273. move.b (a2)+,d3
  80274. move.b objoff_1F(a0),d2
  80275. addq.b #1,d2
  80276. cmp.b d3,d2
  80277. blo.s +
  80278. addq.b #1,anim_frame(a0)
  80279. moveq #0,d2
  80280. +
  80281. move.b d2,objoff_1F(a0)
  80282. moveq #0,d5
  80283.  
  80284. - move.b (a2)+,d5
  80285. movea.w (a0,d5.w),a3 ; a3=object
  80286. tst.w d5
  80287. bne.s +
  80288. movea.l a0,a3
  80289. +
  80290. move.l x_pos(a3),d2
  80291. move.b (a2)+,d1
  80292. ext.w d1
  80293. asl.w #4,d1
  80294. btst #0,render_flags(a0)
  80295. beq.s +
  80296. neg.w d1
  80297. +
  80298. tst.w d4
  80299. beq.s +
  80300. neg.w d1
  80301. +
  80302. ext.l d1
  80303. asl.l #8,d1
  80304. add.l d1,d2
  80305. move.l d2,x_pos(a3)
  80306. move.l y_pos(a3),d3
  80307. move.b (a2)+,d1
  80308. ext.w d1
  80309. asl.w #4,d1
  80310. tst.w d4
  80311. beq.s +
  80312. neg.w d1
  80313. +
  80314. ext.l d1
  80315. asl.l #8,d1
  80316. add.l d1,d3
  80317. move.l d3,y_pos(a3)
  80318. dbf d0,-
  80319.  
  80320. moveq #0,d1
  80321. rts
  80322. ; ===========================================================================
  80323.  
  80324. loc_3E236:
  80325. clr.b anim_frame(a0)
  80326. moveq #1,d1
  80327.  
  80328. return_3E23C:
  80329. rts
  80330. ; ===========================================================================
  80331.  
  80332. loc_3E23E:
  80333. andi.b #$3F,d0
  80334. rol.b #3,d1
  80335. move.w off_3E24C-2(pc,d1.w),d1
  80336. jmp off_3E24C(pc,d1.w)
  80337. ; ===========================================================================
  80338. off_3E24C: offsetTable
  80339. offsetTableEntry.w loc_3E252
  80340. offsetTableEntry.w loc_3E27A
  80341. offsetTableEntry.w loc_3E27E
  80342. ; ===========================================================================
  80343.  
  80344. loc_3E252:
  80345. tst.b objoff_1F(a0)
  80346. bne.s return_3E23C
  80347. move.b anim_frame(a0),d1
  80348. addq.b #1,d1
  80349. move.b (a1,d1.w),d0
  80350. jsrto (PlaySound).l, JmpTo12_PlaySound ; sound id most likely came from off_3E40C or off_3E42C
  80351. addq.b #1,d1
  80352. move.b d1,anim_frame(a0)
  80353. move.b (a1,d1.w),d0
  80354. move.b d0,d1
  80355. andi.b #$C0,d1
  80356. bne.s loc_3E23E
  80357. rts
  80358. ; ===========================================================================
  80359.  
  80360. loc_3E27A:
  80361. moveq #1,d4
  80362. rts
  80363. ; ===========================================================================
  80364.  
  80365. loc_3E27E:
  80366. addq.w #4,sp
  80367. bra.s loc_3E236
  80368. ; ===========================================================================
  80369.  
  80370. loc_3E282:
  80371. movea.w objoff_2C(a0),a2 ; a2=object
  80372. move.w x_pos(a2),d0
  80373. move.w (a1)+,d1
  80374. btst #0,render_flags(a2)
  80375. beq.s +
  80376. neg.w d1
  80377. +
  80378. add.w d1,d0
  80379. move.w d0,x_pos(a0)
  80380. move.w y_pos(a2),d0
  80381. add.w (a1)+,d0
  80382. move.w d0,y_pos(a0)
  80383. rts
  80384. ; ===========================================================================
  80385. ;loc_3E2A8
  80386. ObjC7_PositionChildren:
  80387. moveq #0,d0
  80388. moveq #0,d6
  80389.  
  80390. move.b (a1)+,d6
  80391. - move.b (a1)+,d0
  80392. movea.w (a0,d0.w),a2 ; a2=object
  80393. move.w x_pos(a0),d1
  80394. move.b (a1)+,d2
  80395. ext.w d2
  80396. btst #0,render_flags(a0)
  80397. beq.s +
  80398. neg.w d2
  80399. +
  80400. add.w d2,d1
  80401. move.w d1,x_pos(a2)
  80402. move.w y_pos(a0),d1
  80403. move.b (a1)+,d2
  80404. ext.w d2
  80405. add.w d2,d1
  80406. move.w d1,y_pos(a2)
  80407. dbf d6,-
  80408. rts
  80409. ; ===========================================================================
  80410. ;byte_3E2E0
  80411. ObjC7_ChildDeltas:
  80412. dc.b 6
  80413. dc.b $2E ; 1
  80414. dc.b $FC ; 2
  80415. dc.b $3C ; 3
  80416. dc.b $30 ; 4
  80417. dc.b $F4 ; 5
  80418. dc.b 8 ; 6
  80419. dc.b $32 ; 7
  80420. dc.b $C ; 8
  80421. dc.b $F8 ; 9
  80422. dc.b $34 ; 10
  80423. dc.b 4 ; 11
  80424. dc.b $24 ; 12
  80425. dc.b $3A ; 13
  80426. dc.b $FC ; 14
  80427. dc.b $3C ; 15
  80428. dc.b $3C ; 16
  80429. dc.b $F4 ; 17
  80430. dc.b 8 ; 18
  80431. dc.b $3E ; 19
  80432. dc.b 4 ; 20
  80433. dc.b $24 ; 21
  80434. off_3E2F6:
  80435. dc.l ObjC7_GroupAni_3E318
  80436. dc.b 0, 1, 2, 3, $FF, 0
  80437. off_3E300:
  80438. dc.l ObjC7_GroupAni_3E318
  80439. dc.b 5, 6, 7, 8, $FF, 0
  80440. off_3E30A:
  80441. dc.l ObjC7_GroupAni_3E318
  80442. dc.b 0, 1, 2, 3, 4, 5, 6, 7, 8, $C0
  80443. ; -----------------------------------------------------------------------------
  80444. ; Custom animation
  80445. ; -----------------------------------------------------------------------------
  80446. ; must be on the same line as a label that has a corresponding _End label later
  80447. c7anilistheader macro maxframe,{INTLABEL}
  80448. __LABEL__ label *
  80449. dc.b ((__LABEL___End - __LABEL__ - 2) / 3) - 1,maxframe
  80450. endm
  80451.  
  80452. ; macro for a animation data
  80453. c7ani macro pieceOffset,deltax,deltay
  80454. dc.b pieceOffset,deltax,deltay
  80455. endm
  80456.  
  80457. ObjC7_GroupAni_3E318: offsetTable ;BINCLUDE "mappings/sprite/objC7_a.bin"
  80458. offsetTableEntry.w byte_3E32A
  80459. offsetTableEntry.w byte_3E33E
  80460. offsetTableEntry.w byte_3E352
  80461. offsetTableEntry.w byte_3E366
  80462. offsetTableEntry.w byte_3E37A
  80463. offsetTableEntry.w byte_3E380
  80464. offsetTableEntry.w byte_3E394
  80465. offsetTableEntry.w byte_3E3A8
  80466. offsetTableEntry.w byte_3E3BC
  80467.  
  80468. byte_3E32A: c7anilistheader 8
  80469. c7ani $00, $E0, $0C
  80470. c7ani objoff_30, $E0, $0C
  80471. c7ani objoff_32, $E0, $0C
  80472. c7ani objoff_3C, $E0, $0C
  80473. c7ani objoff_34, $F8, $04
  80474. c7ani objoff_3E, $F8, $04
  80475. byte_3E32A_End
  80476.  
  80477. byte_3E33E: c7anilistheader 8
  80478. c7ani $00, $EC, $14
  80479. c7ani objoff_30, $EC, $14
  80480. c7ani objoff_32, $EC, $14
  80481. c7ani objoff_3C, $EC, $14
  80482. c7ani objoff_34, $FA, $06
  80483. c7ani objoff_3E, $FA, $06
  80484. byte_3E33E_End
  80485.  
  80486. byte_3E352: c7anilistheader 8
  80487. c7ani $00, $F8, $14
  80488. c7ani objoff_30, $F8, $14
  80489. c7ani objoff_32, $F8, $14
  80490. c7ani objoff_3C, $F8, $14
  80491. c7ani objoff_34, $FE, $04
  80492. c7ani objoff_3E, $FE, $04
  80493. byte_3E352_End
  80494.  
  80495. byte_3E366: c7anilistheader 8
  80496. c7ani $00, $FC, $0C
  80497. c7ani objoff_30, $FC, $0C
  80498. c7ani objoff_32, $FC, $0C
  80499. c7ani objoff_3C, $FC, $0c
  80500. c7ani objoff_34, $00, $02
  80501. c7ani objoff_3E, $00, $02
  80502. byte_3E366_End
  80503.  
  80504. byte_3E37A: c7anilistheader 8
  80505. c7ani $00, $00, $00
  80506. byte_3E37A_End
  80507. even
  80508. byte_3E380: c7anilistheader 8
  80509. c7ani $00, $04, $E8
  80510. c7ani objoff_30, $04, $E8
  80511. c7ani objoff_32, $04, $E8
  80512. c7ani objoff_3C, $04, $E8
  80513. c7ani objoff_34, $02, $FA
  80514. c7ani objoff_3E, $02, $FA
  80515. byte_3E380_End
  80516.  
  80517. byte_3E394: c7anilistheader 8
  80518. c7ani $00, $0C, $E8
  80519. c7ani objoff_30, $0C, $E8
  80520. c7ani objoff_32, $0C, $E8
  80521. c7ani objoff_3C, $0C, $E8
  80522. c7ani objoff_34, $04, $FC
  80523. c7ani objoff_3E, $04, $FC
  80524. byte_3E394_End
  80525.  
  80526. byte_3E3A8: c7anilistheader 8
  80527. c7ani $00, $18, $F4
  80528. c7ani objoff_30, $18, $F4
  80529. c7ani objoff_32, $18, $F4
  80530. c7ani objoff_3C, $18, $F4
  80531. c7ani objoff_34, $04, $FC
  80532. c7ani objoff_3E, $04, $FC
  80533. byte_3E3A8_End
  80534.  
  80535. byte_3E3BC: c7anilistheader 8
  80536. c7ani $00, $18, $FC
  80537. c7ani objoff_30, $18, $FC
  80538. c7ani objoff_32, $18, $FC
  80539. c7ani objoff_3C, $18, $FC
  80540. c7ani objoff_34, $06, $FE
  80541. c7ani objoff_3E, $06, $FE
  80542. byte_3E3BC_End
  80543.  
  80544. off_3E3D0:
  80545. dc.l ObjC7_GroupAni_3E3D8
  80546. dc.b 0, 1, 2, $C0
  80547. ; -----------------------------------------------------------------------------
  80548. ; Custom animation
  80549. ; -----------------------------------------------------------------------------
  80550. ObjC7_GroupAni_3E3D8: offsetTable ;BINCLUDE "mappings/sprite/objC7_b.bin"
  80551. offsetTableEntry.w byte_3E3DE
  80552. offsetTableEntry.w byte_3E3F2
  80553. offsetTableEntry.w byte_3E3F8
  80554.  
  80555. byte_3E3DE: c7anilistheader $10
  80556. c7ani $00, $00, $04
  80557. c7ani objoff_30, $00, $04
  80558. c7ani objoff_32, $00, $04
  80559. c7ani objoff_3C, $00, $04
  80560. c7ani objoff_34, $00, $04
  80561. c7ani objoff_3E, $00, $04
  80562. byte_3E3DE_End
  80563.  
  80564. byte_3E3F2: c7anilistheader $10
  80565. c7ani $00, $00, $00
  80566. byte_3E3F2_End
  80567. even
  80568. byte_3E3F8: c7anilistheader 8
  80569. c7ani $00, $00, $F8
  80570. c7ani objoff_30, $00, $F8
  80571. c7ani objoff_32, $00, $F8
  80572. c7ani objoff_3C, $00, $F8
  80573. c7ani objoff_34, $00, $F8
  80574. c7ani objoff_3E, $00, $F8
  80575. byte_3E3F8_End
  80576.  
  80577. off_3E40C:
  80578. dc.l ObjC7_GroupAni_3E438
  80579. dc.b 0, 1, 2, 3, $40, SndID_Hammer
  80580. dc.b 4, 5, 6, 7, 8, $40, SndID_Hammer
  80581. dc.b 9, $A, 1, 2, 3, $40, SndID_Hammer
  80582. dc.b 4, 5, 6, 7, 8, $40, SndID_Hammer, $C0
  80583. off_3E42C:
  80584. dc.l ObjC7_GroupAni_3E438
  80585. dc.b $88, $87, $86, $85, $B, $40, SndID_Hammer, $C0
  80586. ; -----------------------------------------------------------------------------
  80587. ; Custom animation
  80588. ; -----------------------------------------------------------------------------
  80589. ObjC7_GroupAni_3E438: offsetTable ;BINCLUDE "mappings/sprite/objC7_c.bin"
  80590. offsetTableEntry.w byte_3E450
  80591. offsetTableEntry.w byte_3E468
  80592. offsetTableEntry.w byte_3E480
  80593. offsetTableEntry.w byte_3E494
  80594. offsetTableEntry.w byte_3E4AC
  80595. offsetTableEntry.w byte_3E4C4
  80596. offsetTableEntry.w byte_3E4D6
  80597. offsetTableEntry.w byte_3E4EE
  80598. offsetTableEntry.w byte_3E502
  80599. offsetTableEntry.w byte_3E51A
  80600. offsetTableEntry.w byte_3E532
  80601. offsetTableEntry.w byte_3E544
  80602.  
  80603. byte_3E450: c7anilistheader $20
  80604. c7ani objoff_34, $F8, $F8
  80605. c7ani objoff_2E, $F8, $F8
  80606. c7ani $00, $00, $FC
  80607. c7ani objoff_30, $04, $FB
  80608. c7ani objoff_32, $03, $FB
  80609. c7ani objoff_3C, $FC, $FB
  80610. c7ani objoff_3E, $00, $FE
  80611. byte_3E450_End
  80612. even
  80613. byte_3E468: c7anilistheader $10
  80614. c7ani objoff_34, $F0, $FC
  80615. c7ani objoff_2E, $F0, $FC
  80616. c7ani $00, $F0, $FC
  80617. c7ani objoff_30, $F4, $FB
  80618. c7ani objoff_32, $F3, $FB
  80619. c7ani objoff_3C, $EC, $FB
  80620. c7ani objoff_3E, $F8, $00
  80621. byte_3E468_End
  80622. even
  80623. byte_3E480: c7anilistheader $10
  80624. c7ani objoff_34, $F8, $04
  80625. c7ani objoff_2E, $F8, $04
  80626. c7ani $00, $F8, $04
  80627. c7ani objoff_30, $FC, $03
  80628. c7ani objoff_32, $FB, $03
  80629. c7ani objoff_3C, $F4, $03
  80630. byte_3E480_End
  80631.  
  80632. byte_3E494: c7anilistheader $10
  80633. c7ani objoff_34, $FC, $10
  80634. c7ani objoff_2E, $F8, $10
  80635. c7ani $00, $00, $08
  80636. c7ani objoff_30, $F8, $0A
  80637. c7ani objoff_32, $FA, $0A
  80638. c7ani objoff_3C, $08, $0A
  80639. c7ani objoff_3E, $00, $08
  80640. byte_3E494_End
  80641. even
  80642. byte_3E4AC: c7anilistheader $20
  80643. c7ani objoff_34, $FE, $FE
  80644. c7ani $00, $F4, $FC
  80645. c7ani objoff_30, $F0, $FD
  80646. c7ani objoff_32, $F1, $FD
  80647. c7ani objoff_3C, $F8, $FD
  80648. c7ani objoff_3E, $EC, $FA
  80649. c7ani objoff_3A, $E8, $FC
  80650. byte_3E4AC_End
  80651. even
  80652. byte_3E4C4: c7anilistheader $20
  80653. c7ani objoff_3E, $F8, $FC
  80654. c7ani objoff_3A, $F8, $FC
  80655. c7ani objoff_30, $FC, $FF
  80656. c7ani objoff_32, $FD, $FF
  80657. c7ani objoff_3C, $04, $FF
  80658. byte_3E4C4_End
  80659. even
  80660. byte_3E4D6: c7anilistheader $10
  80661. c7ani objoff_3E, $F0, $FC
  80662. c7ani objoff_3A, $F0, $FC
  80663. c7ani $00, $F0, $FC
  80664. c7ani objoff_30, $EC, $FB
  80665. c7ani objoff_32, $ED, $FB
  80666. c7ani objoff_3C, $F4, $FB
  80667. c7ani objoff_34, $F8, $00
  80668. byte_3E4D6_End
  80669. even
  80670. byte_3E4EE: c7anilistheader $10
  80671. c7ani objoff_3E, $F8, $04
  80672. c7ani objoff_3A, $F8, $04
  80673. c7ani $00, $F8, $04
  80674. c7ani objoff_30, $F4, $03
  80675. c7ani objoff_32, $F5, $03
  80676. c7ani objoff_3C, $FC, $03
  80677. byte_3E4EE_End
  80678.  
  80679. byte_3E502: c7anilistheader $10
  80680. c7ani objoff_3E, $FC, $10
  80681. c7ani objoff_3A, $F8, $10
  80682. c7ani $00, $00, $08
  80683. c7ani objoff_30, $08, $0A
  80684. c7ani objoff_32, $06, $0A
  80685. c7ani objoff_3C, $F8, $0A
  80686. c7ani objoff_34, $00, $08
  80687. byte_3E502_End
  80688. even
  80689. byte_3E51A: c7anilistheader $20
  80690. c7ani objoff_3E, $FE, $FE
  80691. c7ani $00, $F4, $FC
  80692. c7ani objoff_30, $F8, $FD
  80693. c7ani objoff_32, $F7, $FD
  80694. c7ani objoff_3C, $F1, $FD
  80695. c7ani objoff_34, $EC, $FA
  80696. c7ani objoff_2E, $E8, $FC
  80697. byte_3E51A_End
  80698. even
  80699. byte_3E532: c7anilistheader $20
  80700. c7ani objoff_34, $F8, $FC
  80701. c7ani objoff_2E, $F8, $FC
  80702. c7ani objoff_30, $04, $FF
  80703. c7ani objoff_32, $03, $FF
  80704. c7ani objoff_3C, $FC, $FF
  80705. byte_3E532_End
  80706. even
  80707. byte_3E544: c7anilistheader $10
  80708. c7ani objoff_3E, $00, $08
  80709. c7ani objoff_3A, $00, $08
  80710. c7ani $00, $00, $08
  80711. c7ani objoff_30, $00, $08
  80712. c7ani objoff_32, $00, $08
  80713. c7ani objoff_3C, $00, $08
  80714. c7ani objoff_34, $00, $08
  80715. byte_3E544_End
  80716. even
  80717.  
  80718. ;word_3E55C
  80719. ChildObjC7_Shoulder:
  80720. dc.w objoff_2C
  80721. dc.b ObjID_Eggrobo
  80722. dc.b 4
  80723. ;word_3E560
  80724. ChildObjC7_FrontLowerLeg:
  80725. dc.w objoff_2E
  80726. dc.b ObjID_Eggrobo
  80727. dc.b 6
  80728. ;word_3E564
  80729. ChildObjC7_FrontForearm:
  80730. dc.w objoff_30
  80731. dc.b ObjID_Eggrobo
  80732. dc.b 8
  80733. ;word_3E568
  80734. ChildObjC7_Arm:
  80735. dc.w objoff_32
  80736. dc.b ObjID_Eggrobo
  80737. dc.b $A
  80738. ;word_3E56C
  80739. ChildObjC7_FrontThigh:
  80740. dc.w objoff_34
  80741. dc.b ObjID_Eggrobo
  80742. dc.b $C
  80743. ;word_3E570
  80744. ChildObjC7_Head:
  80745. dc.w objoff_36
  80746. dc.b ObjID_Eggrobo
  80747. dc.b $E
  80748. ;word_3E574
  80749. ChildObjC7_Jet:
  80750. dc.w objoff_38
  80751. dc.b ObjID_Eggrobo
  80752. dc.b $10
  80753. ;word_3E578
  80754. ChildObjC7_BackLowerLeg:
  80755. dc.w objoff_3A
  80756. dc.b ObjID_Eggrobo
  80757. dc.b $12
  80758. ;word_3E57C
  80759. ChildObjC7_BackForearm:
  80760. dc.w objoff_3C
  80761. dc.b ObjID_Eggrobo
  80762. dc.b $14
  80763. ;word_3E580
  80764. ChildObjC7_BackThigh:
  80765. dc.w objoff_3E
  80766. dc.b ObjID_Eggrobo
  80767. dc.b $16
  80768. ;word_3E584
  80769. ChildObjC7_TargettingSensor:
  80770. dc.w objoff_10
  80771. dc.b ObjID_Eggrobo
  80772. dc.b $18
  80773. ;word_3E588
  80774. ChildObjC7_TargettingLock:
  80775. dc.w objoff_10
  80776. dc.b ObjID_Eggrobo
  80777. dc.b $1A
  80778. ;word_3E58C
  80779. ChildObjC7_EggmanBomb:
  80780. dc.w objoff_10
  80781. dc.b ObjID_Eggrobo
  80782. dc.b $1C
  80783. ;off_3E590
  80784. ObjC7_SubObjData:
  80785. subObjData ObjC7_MapUnc_3E5F8,make_art_tile(ArtTile_ArtNem_DEZBoss,0,0),4,4,$38,$00
  80786.  
  80787. ; animation script
  80788. ; off_3E59A:
  80789. Ani_objC7_a: offsetTable
  80790. offsetTableEntry.w +
  80791. + dc.b 7,$15,$15,$15,$15,$15,$15,$15,$15, 0, 1, 2,$FA
  80792. even
  80793.  
  80794. ; animation script
  80795. ; off_3E5AA:
  80796. Ani_objC7_b: offsetTable
  80797. offsetTableEntry.w byte_3E5B2
  80798. offsetTableEntry.w byte_3E5B6
  80799. offsetTableEntry.w byte_3E5D0
  80800. offsetTableEntry.w byte_3E5EA
  80801. byte_3E5B2: dc.b 1, $C, $D,$FF
  80802. byte_3E5B6: dc.b 1, $C, $D, $C, $C, $D, $D, $C, $C, $C, $D, $D, $D, $C, $C, $C
  80803. dc.b $C, $C, $D, $D, $D, $D, $D, $D,$FA, 0; 16
  80804. byte_3E5D0: dc.b 1, $D, $D, $D, $D, $D, $D, $C, $C, $C, $C, $C, $D, $D, $D, $C
  80805. dc.b $C, $C, $D, $D, $C, $C, $D, $C,$FD, 0; 16
  80806. byte_3E5EA: dc.b 0, $D,$15,$FF
  80807. even
  80808.  
  80809. ; animation script
  80810. ; off_3E5EE:
  80811. Ani_objC7_c: offsetTable
  80812. offsetTableEntry.w byte_3E5F0
  80813. byte_3E5F0: dc.b 3,$13,$12,$11,$10,$16,$FF
  80814. even
  80815. ; ------------------------------------------------------------------------------
  80816. ; sprite mappings
  80817. ; ------------------------------------------------------------------------------
  80818. ObjC7_MapUnc_3E5F8: BINCLUDE "mappings/sprite/objC7.bin"
  80819. ; ===========================================================================
  80820.  
  80821. ; ---------------------------------------------------------------------------
  80822. ; Subroutine to upscale graphics by a factor of 2x, based on given mappings
  80823. ; data for correct positioning of tiles.
  80824. ;
  80825. ; This code is awfully structured and planned: whenever a 3-column sprite piece
  80826. ; is scaled, it scales the next tiles that were copied to RAM as if the piece
  80827. ; had 4 columns; this will then be promptly overwritten by the next piece. If
  80828. ; this happens near the end of the buffer, you will get a buffer overrun.
  80829. ; Moreover, when the number of rows in the sprite piece is also 3 or 4, the code
  80830. ; will make an incorrect computation for the output of the next subpiece, which
  80831. ; causes the output to overwrite art from the previous subpiece. Thus, this code
  80832. ; fails if there is a 3x3 or a 3x4 sprite piece in the source mappings. Sadly,
  80833. ; this issue is basically unfixable without rewriting the code entirely.
  80834. ;
  80835. ; Input:
  80836. ; a1 Location of tiles to be enlarged
  80837. ; a2 Destination buffer for enlarged tiles
  80838. ; d0 Width-1 of sprite piece
  80839. ; d1 Height-1 of sprite piece
  80840. ; ---------------------------------------------------------------------------
  80841.  
  80842. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  80843.  
  80844. ;loc_3E89E
  80845. Scale_2x:
  80846. move.w d1,d2 ; Copy piece height-1
  80847. andi.w #1,d2 ; Want only low bit -- this is 1 for Wx2 or Wx4 pieces, 0 otherwise
  80848. addq.w #1,d2 ; Make it into 2 for Wx2 or Wx4 pieces, 1 otherwise
  80849. lsl.w #6,d2 ; This is now $80 (4 tiles) for Wx2 or Wx4 pieces, $40 (2 tiles) otherwise
  80850. swap d2 ; Save it to high word
  80851. move.w d1,d3 ; Copy piece height-1 again
  80852. lsr.w #1,d3 ; This time, want high bit (1 for Wx3 or Wx4, 0 for Wx2 or Wx1)
  80853. addq.w #1,d3 ; Make it into 2 for Wx3 or Wx4 pieces, 1 otherwise
  80854. lsl.w #6,d3 ; This is now $80 (4 tiles) for Wx3 or Wx4 pieces, $40 (2 tiles) otherwise
  80855. swap d3 ; Save it to high word
  80856. bsr.w .upscale_part1 ; Scale the first line???; sets a3 = ???, a5 = ???
  80857. btst #1,d0 ; Is this a 1xH or a 2xH piece?
  80858. beq.w return_37A48 ; Return if yes
  80859. btst #1,d1 ; Is this a Wx3 or a Wx4 piece?
  80860. bne.s .set_dest ; Branch if yes
  80861. movea.l a3,a5 ; Advance to next column instead
  80862.  
  80863. .set_dest:
  80864. movea.l a5,a2 ; Set new output location
  80865.  
  80866. .upscale_part1:
  80867. movea.l a2,a4 ; Copy destination to a4
  80868. swap d2 ; Get height offset
  80869. lea (a2,d2.w),a3 ; Output location for next tile
  80870. swap d2 ; Save height offset again
  80871. move.w d1,d5 ; Copy height-1
  80872. andi.w #1,d5 ; How many tiles we want to do-1 -- this is 1 for Wx2 or Wx4 pieces, 0 otherwise
  80873. bsr.w Scale2x_SingleTile
  80874. btst #1,d1 ; Are we upscaling a Wx3 or Wx4 piece?
  80875. beq.s .done_cols ; Branch if not
  80876. swap d2 ; Get height offset
  80877. move.w d2,d4 ; Copy it to d4
  80878. swap d2 ; Save height offset again
  80879. add.w d4,d4 ; This is now $100 (8 tiles) for Wx4 pieces, $80 (4 tiles) for Wx3 pieces
  80880. move.w d0,d3 ; Copy piece width-1
  80881. andi.w #1,d3 ; Want only low bit -- this is 1 for 2xH or 4xH pieces, 0 otherwise
  80882. lsl.w d3,d4 ; This is now: $200 (16 tiles) for 2x4 or 4x4 pieces; $100 (8 tiles) for 2x3, 4x3, 1x4 or 3x4 pieces; $80 (4 tiles) for 1x3 or 3x3 pieces
  80883. adda.w d4,a4 ; Advance to this location
  80884. move.w d1,d5 ; Copy height-1
  80885. lsr.w #1,d5 ; How many tiles we want to do-1 -- this is 1 for Wx4 pieces, 0 for Wx3 pieces
  80886. swap d3 ; Get height offset
  80887. lea (a4,d3.w),a5 ; Output location for next tile
  80888. swap d3 ; Save height offset again
  80889. bsr.w Scale2x_SingleTile2
  80890.  
  80891. .done_cols:
  80892. btst #0,d0 ; Is this a 1xH or 3xH piece?
  80893. bne.s .keep_upscaling ; Branch if not
  80894. btst #1,d0 ; Was this a single column piece?
  80895. beq.s .done ; Return if so
  80896.  
  80897. .keep_upscaling:
  80898. swap d2 ; Get height offset
  80899. lea (a2,d2.w),a2 ; Output location for next tile
  80900. lea (a2,d2.w),a3 ; Output location for next tile
  80901. swap d2 ; Save height offset again
  80902. move.w d1,d5 ; Copy height-1
  80903. andi.w #1,d5 ; How many tiles we want to do -- this is 1 for Wx2 or Wx4 pieces, 0 otherwise
  80904. bsr.w Scale2x_SingleTile
  80905. btst #1,d1 ; Are we upscaling a Wx3 or Wx4 piece?
  80906. beq.s .done ; Branch if not
  80907. move.w d1,d5 ; Copy height-1
  80908. lsr.w #1,d5 ; How many tiles we want to do-1 -- this is 1 for Wx4 or Wx3 pieces, 0 otherwise
  80909. swap d3 ; Get height offset
  80910. lea (a4,d3.w),a4 ; Output location for next tile
  80911. lea (a4,d3.w),a5 ; Output location for next tile
  80912. swap d3 ; Save height offset again
  80913. bsr.w Scale2x_SingleTile2
  80914.  
  80915. .done:
  80916. rts
  80917. ; ===========================================================================
  80918. ; Upscales the given tile to the pair of tiles on the output pointers.
  80919. ;
  80920. ; Input:
  80921. ; a1 Pixel source
  80922. ; d5 Number of tiles-1 to upscale
  80923. ; a2 Location of output tiles for left pixels
  80924. ; a3 Location of output tiles for right pixels
  80925. ; Output:
  80926. ; a1 Pixel source after processed tiles
  80927. ; a2 Location of output tiles for left pixels after scaled tiles
  80928. ; a3 Location of output tiles for right pixels after scaled tiles
  80929. ;loc_3E944
  80930. Scale2x_SingleTile:
  80931. moveq #7,d6 ; 8 rows per tile
  80932.  
  80933. .loop:
  80934. bsr.w Scale_2x_LeftPixels ; Upscale pixels 0-3 of current row
  80935. addq.w #4,a2 ; Advance write destination by one row (8 pixels)
  80936. bsr.w Scale_2x_RightPixels ; Upscale pixels 4-7 of current row
  80937. addq.w #4,a3 ; Advance write destination by one row (8 pixels)
  80938. dbf d6,.loop
  80939.  
  80940. dbf d5,Scale2x_SingleTile
  80941.  
  80942. rts
  80943. ; ===========================================================================
  80944. ; Upscales the given tile to the pair of tiles on the output pointers.
  80945. ;
  80946. ; Input:
  80947. ; a1 Pixel source
  80948. ; d5 Number of tiles-1 to upscale
  80949. ; a4 Location of output tiles for left pixels
  80950. ; a5 Location of output tiles for right pixels
  80951. ; Output:
  80952. ; a1 Pixel source after processed tiles
  80953. ; a4 Location of output tiles for left pixels after scaled tiles
  80954. ; a5 Location of output tiles for right pixels after scaled tiles
  80955. ;loc_3E95C
  80956. Scale2x_SingleTile2:
  80957. moveq #7,d6 ; 8 rows per tile
  80958.  
  80959. .loop:
  80960. bsr.w Scale_2x_LeftPixels2 ; Upscale pixels 0-3 of current row
  80961. addq.w #4,a4 ; Advance write destination by one row (8 pixels)
  80962. bsr.w Scale_2x_RightPixels2 ; Upscale pixels 4-7 of current row
  80963. addq.w #4,a5 ; Advance write destination by one row (8 pixels)
  80964. dbf d6,.loop
  80965.  
  80966. dbf d5,Scale2x_SingleTile2
  80967.  
  80968. rts
  80969. ; ===========================================================================
  80970. ; Upscales the leftmost 4 pixels on the current row into the corresponding two
  80971. ; rows of the output tile
  80972. ;loc_3E974
  80973. Scale_2x_LeftPixels:
  80974. bsr.w .upscale_pixel_pair
  80975.  
  80976. .upscale_pixel_pair:
  80977. move.b (a1)+,d2 ; Read two pixels
  80978. move.b d2,d3 ; Save them
  80979. andi.b #$F0,d2 ; Get left pixel
  80980. move.b d2,d4 ; Copy it...
  80981. lsr.b #4,d4 ; ... shift it down into place...
  80982. or.b d2,d4 ; ... and make it into two pixels of the same color
  80983. move.b d4,(a2)+ ; Save to top tile, both on one row...
  80984. move.b d4,3(a2) ; ... and on the row below
  80985. andi.b #$F,d3 ; Get saved right pixel
  80986. move.b d3,d4 ; Copy it...
  80987. lsl.b #4,d4 ; ... shift it up into place...
  80988. or.b d3,d4 ; ... and make it into two pixels of the same color
  80989. move.b d4,(a2)+ ; Save to top tile, both on one row...
  80990. move.b d4,3(a2) ; ... and on the row below
  80991. rts
  80992. ; ===========================================================================
  80993. ; Upscales the rightmost 4 pixels on the current row into the corresponding two
  80994. ; rows of the output tile
  80995. ;loc_3E99E
  80996. Scale_2x_RightPixels:
  80997. bsr.w .upscale_pixel_pair
  80998.  
  80999. .upscale_pixel_pair:
  81000. move.b (a1)+,d2 ; Read two pixels
  81001. move.b d2,d3 ; Save them
  81002. andi.b #$F0,d2 ; Get left pixel
  81003. move.b d2,d4 ; Copy it...
  81004. lsr.b #4,d4 ; ... shift it down into place...
  81005. or.b d2,d4 ; ... and make it into two pixels of the same color
  81006. move.b d4,(a3)+ ; Save to bottom tile, both on one row...
  81007. move.b d4,3(a3) ; ... and on the row below
  81008. andi.b #$F,d3 ; Get saved right pixel
  81009. move.b d3,d4 ; Copy it...
  81010. lsl.b #4,d4 ; ... shift it up into place...
  81011. or.b d3,d4 ; ... and make it into two pixels of the same color
  81012. move.b d4,(a3)+ ; Save to bottom tile, both on one row...
  81013. move.b d4,3(a3) ; ... and on the row below
  81014. rts
  81015. ; ===========================================================================
  81016. ; Upscales the leftmost 4 pixels on the current row into the corresponding two
  81017. ; rows of the output tile
  81018. ;loc_3E9C8
  81019. Scale_2x_LeftPixels2:
  81020. bsr.w .upscale_pixel_pair
  81021.  
  81022. .upscale_pixel_pair:
  81023. move.b (a1)+,d2 ; Read two pixels
  81024. move.b d2,d3 ; Save them
  81025. andi.b #$F0,d2 ; Get left pixel
  81026. move.b d2,d4 ; Copy it...
  81027. lsr.b #4,d4 ; ... shift it down into place...
  81028. or.b d2,d4 ; ... and make it into two pixels of the same color
  81029. move.b d4,(a4)+ ; Save to top tile, both on one row...
  81030. move.b d4,3(a4) ; ... and on the row below
  81031. andi.b #$F,d3 ; Get saved right pixel
  81032. move.b d3,d4 ; Copy it...
  81033. lsl.b #4,d4 ; ... shift it up into place...
  81034. or.b d3,d4 ; ... and make it into two pixels of the same color
  81035. move.b d4,(a4)+ ; Save to top tile, both on one row...
  81036. move.b d4,3(a4) ; ... and on the row below
  81037. rts
  81038. ; ===========================================================================
  81039. ; Upscales the rightmost 4 pixels on the current row into the corresponding two
  81040. ; rows of the output tile
  81041. ;loc_3E9F2
  81042. Scale_2x_RightPixels2:
  81043. bsr.w .upscale_pixel_pair
  81044.  
  81045. .upscale_pixel_pair:
  81046. move.b (a1)+,d2 ; Read two pixels
  81047. move.b d2,d3 ; Save them
  81048. andi.b #$F0,d2 ; Get left pixel
  81049. move.b d2,d4 ; Copy it...
  81050. lsr.b #4,d4 ; ... shift it down into place...
  81051. or.b d2,d4 ; ... and make it into two pixels of the same color
  81052. move.b d4,(a5)+ ; Save to bottom tile, both on one row...
  81053. move.b d4,3(a5) ; ... and on the row below
  81054. andi.b #$F,d3 ; Get saved right pixel
  81055. move.b d3,d4 ; Copy it...
  81056. lsl.b #4,d4 ; ... shift it up into place...
  81057. or.b d3,d4 ; ... and make it into two pixels of the same color
  81058. move.b d4,(a5)+ ; Save to bottom tile, both on one row...
  81059. move.b d4,3(a5) ; ... and on the row below
  81060. rts
  81061. ; ===========================================================================
  81062.  
  81063. ; this data seems to be unused
  81064. dc.b $12,$34,$56,$78
  81065. dc.b $12,$34,$56,$78 ; 4
  81066. dc.b $12,$34,$56,$78 ; 8
  81067. dc.b $12,$34,$56,$78 ; 12
  81068. dc.b $12,$34,$56,$78 ; 16
  81069. dc.b $12,$34,$56,$78 ; 20
  81070. dc.b $12,$34,$56,$78 ; 24
  81071. dc.b $12,$34,$56,$78 ; 28
  81072.  
  81073. ; ===========================================================================
  81074.  
  81075. if ~~removeJmpTos
  81076. JmpTo5_DisplaySprite3
  81077. jmp (DisplaySprite3).l
  81078. JmpTo45_DisplaySprite
  81079. jmp (DisplaySprite).l
  81080. JmpTo65_DeleteObject
  81081. jmp (DeleteObject).l
  81082. JmpTo19_SingleObjLoad
  81083. jmp (SingleObjLoad).l
  81084. JmpTo39_MarkObjGone
  81085. jmp (MarkObjGone).l
  81086. JmpTo6_DeleteObject2
  81087. jmp (DeleteObject2).l
  81088. JmpTo12_PlaySound
  81089. jmp (PlaySound).l
  81090. JmpTo25_SingleObjLoad2
  81091. jmp (SingleObjLoad2).l
  81092. JmpTo25_AnimateSprite
  81093. jmp (AnimateSprite).l
  81094. JmpTo_PlaySoundLocal
  81095. jmp (PlaySoundLocal).l
  81096. JmpTo6_RandomNumber
  81097. jmp (RandomNumber).l
  81098. JmpTo2_MarkObjGone_P1
  81099. jmp (MarkObjGone_P1).l
  81100. JmpTo_Pal_FadeToWhite_UpdateColour
  81101. jmp (Pal_FadeToWhite.UpdateColour).l
  81102. JmpTo_LoadTailsDynPLC_Part2
  81103. jmp (LoadTailsDynPLC_Part2).l
  81104. JmpTo_LoadSonicDynPLC_Part2
  81105. jmp (LoadSonicDynPLC_Part2).l
  81106. JmpTo8_MarkObjGone3
  81107. jmp (MarkObjGone3).l
  81108. JmpTo64_Adjust2PArtPointer
  81109. jmp (Adjust2PArtPointer).l
  81110. JmpTo5_PlayMusic
  81111. jmp (PlayMusic).l
  81112. JmpTo_Boss_LoadExplosion
  81113. jmp (Boss_LoadExplosion).l
  81114. JmpTo9_PlatformObject
  81115. jmp (PlatformObject).l
  81116. JmpTo27_SolidObject
  81117. jmp (SolidObject).l
  81118. JmpTo8_ObjectMoveAndFall
  81119. jmp (ObjectMoveAndFall).l
  81120. ; loc_3EAC0:
  81121. JmpTo26_ObjectMove
  81122. jmp (ObjectMove).l
  81123.  
  81124. align 4
  81125. endif
  81126.  
  81127.  
  81128.  
  81129.  
  81130. ; ===========================================================================
  81131. ; ----------------------------------------------------------------------------
  81132. ; Object 8A - Sonic Team Presents/Credits (leftover from S1) (seemingly unused)
  81133. ; ----------------------------------------------------------------------------
  81134. ; Sprite_3EAC8:
  81135. Obj8A: ; (screen-space obj)
  81136. moveq #0,d0
  81137. move.b routine(a0),d0
  81138. move.w Obj8A_Index(pc,d0.w),d1
  81139. jmp Obj8A_Index(pc,d1.w)
  81140. ; ===========================================================================
  81141. ; off_3EAD6:
  81142. Obj8A_Index: offsetTable
  81143. offsetTableEntry.w Obj8A_Init
  81144. offsetTableEntry.w Obj8A_Display
  81145. ; ===========================================================================
  81146. ; loc_3EADA:
  81147. Obj8A_Init:
  81148. addq.b #2,routine(a0)
  81149. move.w #$120,x_pixel(a0)
  81150. move.w #$F0,y_pixel(a0)
  81151. move.l #Obj8A_MapUnc_3EB4E,mappings(a0)
  81152. move.w #make_art_tile($05A0,0,0),art_tile(a0)
  81153. jsrto (Adjust2PArtPointer).l, JmpTo65_Adjust2PArtPointer
  81154. move.w (Ending_demo_number).w,d0
  81155. move.b d0,mapping_frame(a0)
  81156. move.b #0,render_flags(a0)
  81157. move.b #0,priority(a0)
  81158. cmpi.b #GameModeID_TitleScreen,(Game_Mode).w ; title screen??
  81159. bne.s Obj8A_Display ; if not, branch
  81160. move.w #make_art_tile($0300,0,0),art_tile(a0)
  81161. jsrto (Adjust2PArtPointer).l, JmpTo65_Adjust2PArtPointer
  81162. move.b #$A,mapping_frame(a0)
  81163. tst.b ($FFFFFFD3).w
  81164. beq.s Obj8A_Display
  81165. cmpi.b #button_down_mask|button_B_mask|button_C_mask|button_A_mask,(Ctrl_1_Held).w
  81166. bne.s Obj8A_Display
  81167. move.w #$EEE,(Target_palette_line3).w
  81168. move.w #$880,(Target_palette_line3+2).w
  81169. jmp (DeleteObject).l
  81170. ; ===========================================================================
  81171. ; JmpTo46_DisplaySprite
  81172. Obj8A_Display:
  81173. jmp (DisplaySprite).l
  81174. ; ===========================================================================
  81175. ; ----------------------------------------------------------------------------
  81176. ; sprite mappings (unused?)
  81177. ; ----------------------------------------------------------------------------
  81178. Obj8A_MapUnc_3EB4E: BINCLUDE "mappings/sprite/obj8A.bin"
  81179. ; ===========================================================================
  81180.  
  81181. if gameRevision<2
  81182. nop
  81183. endif
  81184.  
  81185. if ~~removeJmpTos
  81186. JmpTo65_Adjust2PArtPointer
  81187. jmp (Adjust2PArtPointer).l
  81188.  
  81189. align 4
  81190. endif
  81191.  
  81192.  
  81193.  
  81194.  
  81195. ; ===========================================================================
  81196. ; ----------------------------------------------------------------------------
  81197. ; Object 3E - Egg prison
  81198. ; ----------------------------------------------------------------------------
  81199. ; Sprite_3F1E4:
  81200. Obj3E:
  81201. moveq #0,d0
  81202. move.b routine(a0),d0
  81203. move.w Obj3E_Index(pc,d0.w),d1
  81204. jmp Obj3E_Index(pc,d1.w)
  81205. ; ===========================================================================
  81206. ; off_3F1F2:
  81207. Obj3E_Index: offsetTable
  81208. offsetTableEntry.w loc_3F212 ; 0
  81209. offsetTableEntry.w loc_3F278 ; 2
  81210. offsetTableEntry.w loc_3F354 ; 4
  81211. offsetTableEntry.w loc_3F38E ; 6
  81212. offsetTableEntry.w loc_3F3A8 ; 8
  81213. offsetTableEntry.w loc_3F406 ; $A
  81214. ; ----------------------------------------------------------------------------
  81215. ; byte_3F1FE:
  81216. Obj3E_ObjLoadData:
  81217. dc.b 0, 2,$20, 4, 0
  81218. dc.b $28, 4,$10, 5, 4 ; 5
  81219. dc.b $18, 6, 8, 3, 5 ; 10
  81220. dc.b 0, 8,$20, 4, 0 ; 15
  81221. ; ===========================================================================
  81222.  
  81223. loc_3F212:
  81224. movea.l a0,a1
  81225. lea objoff_38(a0),a3
  81226. lea Obj3E_ObjLoadData(pc),a2
  81227. moveq #3,d1
  81228. bra.s loc_3F228
  81229. ; ===========================================================================
  81230.  
  81231. loc_3F220:
  81232. jsrto (SingleObjLoad).l, JmpTo20_SingleObjLoad
  81233. bne.s loc_3F272
  81234. move.w a1,(a3)+
  81235.  
  81236. loc_3F228:
  81237. _move.b id(a0),id(a1) ; load obj
  81238. move.w x_pos(a0),x_pos(a1)
  81239. move.w y_pos(a0),y_pos(a1)
  81240. move.w y_pos(a0),objoff_30(a1)
  81241. move.l #Obj3E_MapUnc_3F436,mappings(a1)
  81242. move.w #make_art_tile(ArtTile_ArtNem_Capsule,1,0),art_tile(a1)
  81243. move.b #$84,render_flags(a1)
  81244. moveq #0,d0
  81245. move.b (a2)+,d0
  81246. sub.w d0,y_pos(a1)
  81247. move.w y_pos(a1),objoff_30(a1)
  81248. move.b (a2)+,routine(a1)
  81249. move.b (a2)+,width_pixels(a1)
  81250. move.b (a2)+,priority(a1)
  81251. move.b (a2)+,mapping_frame(a1)
  81252.  
  81253. loc_3F272:
  81254. dbf d1,loc_3F220
  81255. rts
  81256. ; ===========================================================================
  81257.  
  81258. loc_3F278:
  81259. moveq #0,d0
  81260. move.b routine_secondary(a0),d0
  81261. move.w off_3F2AE(pc,d0.w),d1
  81262. jsr off_3F2AE(pc,d1.w)
  81263. move.w #$2B,d1
  81264. move.w #$18,d2
  81265. move.w #$18,d3
  81266. move.w x_pos(a0),d4
  81267. jsr (SolidObject).l
  81268. lea (Ani_obj3E).l,a1
  81269. jsr (AnimateSprite).l
  81270. jmp (MarkObjGone).l
  81271. ; ===========================================================================
  81272. off_3F2AE: offsetTable
  81273. offsetTableEntry.w loc_3F2B4 ; 0
  81274. offsetTableEntry.w loc_3F2FC ; 2
  81275. offsetTableEntry.w return_3F352 ; 4
  81276. ; ===========================================================================
  81277.  
  81278. loc_3F2B4:
  81279. movea.w objoff_38(a0),a1 ; a1=object
  81280. tst.w objoff_32(a1)
  81281. beq.s ++ ; rts
  81282. movea.w objoff_3A(a0),a2 ; a2=object
  81283. jsr (SingleObjLoad).l
  81284. bne.s +
  81285. _move.b #ObjID_Explosion,id(a1) ; load obj
  81286. addq.b #2,routine(a1)
  81287. move.w x_pos(a2),x_pos(a1)
  81288. move.w y_pos(a2),y_pos(a1)
  81289. +
  81290. move.w #-$400,y_vel(a2)
  81291. move.w #$800,x_vel(a2)
  81292. addq.b #2,routine_secondary(a2)
  81293. move.w #$1D,objoff_34(a0)
  81294. addq.b #2,routine_secondary(a0)
  81295. +
  81296. rts
  81297. ; ===========================================================================
  81298.  
  81299. loc_3F2FC:
  81300. subq.w #1,objoff_34(a0)
  81301. bpl.s return_3F352
  81302. move.b #1,anim(a0)
  81303. moveq #7,d6
  81304. move.w #$9A,d5
  81305. moveq #-$1C,d4
  81306.  
  81307. - jsr (SingleObjLoad).l
  81308. bne.s +
  81309. _move.b #ObjID_Animal,id(a1) ; load obj
  81310. move.w x_pos(a0),x_pos(a1)
  81311. move.w y_pos(a0),y_pos(a1)
  81312. add.w d4,x_pos(a1)
  81313. move.b #1,objoff_38(a1)
  81314. addq.w #7,d4
  81315. move.w d5,objoff_36(a1)
  81316. subq.w #8,d5
  81317. dbf d6,-
  81318. +
  81319. movea.w objoff_3C(a0),a2 ; a2=object
  81320. move.w #$B4,anim_frame_duration(a2)
  81321. addq.b #2,routine_secondary(a2)
  81322. addq.b #2,routine_secondary(a0)
  81323.  
  81324. return_3F352:
  81325. rts
  81326. ; ===========================================================================
  81327.  
  81328. loc_3F354:
  81329. move.w #$1B,d1
  81330. move.w #8,d2
  81331. move.w #8,d3
  81332. move.w x_pos(a0),d4
  81333. jsr (SolidObject).l
  81334. move.w objoff_30(a0),y_pos(a0)
  81335. move.b status(a0),d0
  81336. andi.b #standing_mask,d0
  81337. beq.s +
  81338. addq.w #8,y_pos(a0)
  81339. clr.b (Update_HUD_timer).w
  81340. move.w #1,objoff_32(a0)
  81341. +
  81342. jmp (MarkObjGone).l
  81343. ; ===========================================================================
  81344.  
  81345. loc_3F38E:
  81346. tst.b routine_secondary(a0)
  81347. beq.s +
  81348. tst.b render_flags(a0)
  81349. bpl.w JmpTo66_DeleteObject
  81350. jsr (ObjectMoveAndFall).l
  81351. +
  81352. jmp (MarkObjGone).l
  81353.  
  81354. if removeJmpTos
  81355. JmpTo66_DeleteObject
  81356. jmp (DeleteObject).l
  81357. endif
  81358. ; ===========================================================================
  81359.  
  81360. loc_3F3A8:
  81361. tst.b routine_secondary(a0)
  81362. beq.s return_3F404
  81363. move.b (Vint_runcount+3).w,d0
  81364. andi.b #7,d0
  81365. bne.s loc_3F3F4
  81366. jsr (SingleObjLoad).l
  81367. bne.s loc_3F3F4
  81368. _move.b #ObjID_Animal,id(a1) ; load obj
  81369. move.w x_pos(a0),x_pos(a1)
  81370. move.w y_pos(a0),y_pos(a1)
  81371. jsr (RandomNumber).l
  81372. andi.w #$1F,d0
  81373. subq.w #6,d0
  81374. tst.w d1
  81375. bpl.s +
  81376. neg.w d0
  81377. +
  81378. add.w d0,x_pos(a1)
  81379. move.b #1,objoff_38(a1)
  81380. move.w #$C,objoff_36(a1)
  81381.  
  81382. loc_3F3F4:
  81383. subq.w #1,anim_frame_duration(a0)
  81384. bne.s return_3F404
  81385. addq.b #2,routine(a0)
  81386. move.w #$B4,anim_frame_duration(a0)
  81387.  
  81388. return_3F404:
  81389. rts
  81390. ; ===========================================================================
  81391.  
  81392. loc_3F406:
  81393. moveq #(Dynamic_Object_RAM_End-Dynamic_Object_RAM)/object_size-1,d0
  81394. moveq #ObjID_Animal,d1
  81395. lea (Dynamic_Object_RAM).w,a1
  81396.  
  81397. - cmp.b id(a1),d1
  81398. beq.s + ; rts
  81399. lea next_object(a1),a1 ; a1=object
  81400. dbf d0,-
  81401.  
  81402. jsr (Load_EndOfAct).l
  81403. jmp (DeleteObject).l
  81404. ; ===========================================================================
  81405. + rts
  81406. ; ===========================================================================
  81407. ; animation script
  81408. ; off_3F428:
  81409. Ani_obj3E: offsetTable
  81410. offsetTableEntry.w byte_3F42C ; 0
  81411. offsetTableEntry.w byte_3F42F ; 1
  81412. byte_3F42C: dc.b $F, 0,$FF
  81413. rev02even
  81414. byte_3F42F: dc.b 3, 0, 1, 2, 3,$FE, 1
  81415. even
  81416. ; ----------------------------------------------------------------------------
  81417. ; sprite mappings
  81418. ; ----------------------------------------------------------------------------
  81419. Obj3E_MapUnc_3F436: BINCLUDE "mappings/sprite/obj3E.bin"
  81420. ; ===========================================================================
  81421.  
  81422. if gameRevision<2
  81423. nop
  81424. endif
  81425.  
  81426. if ~~removeJmpTos
  81427. JmpTo66_DeleteObject
  81428. jmp (DeleteObject).l
  81429. JmpTo20_SingleObjLoad
  81430. jmp (SingleObjLoad).l
  81431.  
  81432. align 4
  81433. endif
  81434.  
  81435.  
  81436.  
  81437.  
  81438. ; ---------------------------------------------------------------------------
  81439. ; Object touch response subroutine - $20(a0) in the object RAM
  81440. ; collides Sonic with most objects (enemies, rings, monitors...) in the level
  81441. ; ---------------------------------------------------------------------------
  81442.  
  81443. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  81444.  
  81445. ; loc_3F554:
  81446. TouchResponse:
  81447. nop
  81448. jsrto (Touch_Rings).l, JmpTo_Touch_Rings
  81449. ; Bumpers in CNZ
  81450. cmpi.b #casino_night_zone,(Current_Zone).w
  81451. bne.s +
  81452. jsrto (Check_CNZ_bumpers).l, JmpTo_Check_CNZ_bumpers
  81453. +
  81454. tst.b (Current_Boss_ID).w
  81455. bne.w Touch_Boss
  81456. move.w x_pos(a0),d2 ; load Sonic's position into d2,d3
  81457. move.w y_pos(a0),d3
  81458. subi_.w #8,d2
  81459. moveq #0,d5
  81460. move.b y_radius(a0),d5
  81461. subq.b #3,d5
  81462. sub.w d5,d3
  81463. cmpi.b #$4D,mapping_frame(a0) ; is Sonic ducking?
  81464. bne.s Touch_NoDuck ; if not, branch
  81465. addi.w #$C,d3
  81466. moveq #$A,d5
  81467. ; loc_3F592:
  81468. Touch_NoDuck:
  81469. move.w #$10,d4
  81470. add.w d5,d5
  81471. lea (Dynamic_Object_RAM).w,a1
  81472. move.w #(Dynamic_Object_RAM_End-Dynamic_Object_RAM)/object_size-1,d6
  81473. ; loc_3F5A0:
  81474. Touch_Loop:
  81475. move.b collision_flags(a1),d0
  81476. bne.w Touch_Width
  81477. ; loc_3F5A8:
  81478. Touch_NextObj:
  81479. lea next_object(a1),a1 ; load obj address ; goto next object
  81480. dbf d6,Touch_Loop ; repeat 6F more times
  81481.  
  81482. moveq #0,d0
  81483. rts
  81484. ; ===========================================================================
  81485. ; loc_3F5B4: Touch_Height:
  81486. Touch_Width:
  81487. andi.w #$3F,d0
  81488. add.w d0,d0
  81489. lea Touch_Sizes(pc,d0.w),a2
  81490. moveq #0,d1
  81491. move.b (a2)+,d1
  81492. move.w x_pos(a1),d0
  81493. sub.w d1,d0
  81494. sub.w d2,d0
  81495. bcc.s loc_3F5D6
  81496. add.w d1,d1
  81497. add.w d1,d0
  81498. bcs.s Touch_Height
  81499. bra.w Touch_NextObj
  81500. ; ===========================================================================
  81501.  
  81502. loc_3F5D6:
  81503. cmp.w d4,d0
  81504. bhi.w Touch_NextObj
  81505. ; loc_3F5DC: Touch_Width:
  81506. Touch_Height:
  81507. moveq #0,d1
  81508. move.b (a2)+,d1
  81509. move.w y_pos(a1),d0
  81510. sub.w d1,d0
  81511. sub.w d3,d0
  81512. bcc.s loc_3F5F6
  81513. add.w d1,d1
  81514. add.w d1,d0
  81515. bcs.w Touch_ChkValue
  81516. bra.w Touch_NextObj
  81517. ; ===========================================================================
  81518.  
  81519. loc_3F5F6:
  81520. cmp.w d5,d0
  81521. bhi.w Touch_NextObj
  81522. bra.w Touch_ChkValue
  81523. ; ===========================================================================
  81524. ; collision sizes (width,height)
  81525. ; byte_3F600:
  81526. Touch_Sizes:
  81527. dc.b 4, 4 ; 0
  81528. dc.b $14,$14 ; 1
  81529. dc.b $C,$14 ; 2
  81530. dc.b $14, $C ; 3
  81531. dc.b 4,$10 ; 4
  81532. dc.b $C,$12 ; 5
  81533. dc.b $10,$10 ; 6 - monitors
  81534. dc.b 6, 6 ; 7 - rings
  81535. dc.b $18, $C ; 8
  81536. dc.b $C,$10 ; 9
  81537. dc.b $10, 8 ; $A
  81538. dc.b 8, 8 ; $B
  81539. dc.b $14,$10 ; $C
  81540. dc.b $14, 8 ; $D
  81541. dc.b $E, $E ; $E
  81542. dc.b $18,$18 ; $F
  81543. dc.b $28,$10 ; $10
  81544. dc.b $10,$18 ; $11
  81545. dc.b 8,$10 ; $12
  81546. dc.b $20,$70 ; $13
  81547. dc.b $40,$20 ; $14
  81548. dc.b $80,$20 ; $15
  81549. dc.b $20,$20 ; $16
  81550. dc.b 8, 8 ; $17
  81551. dc.b 4, 4 ; $18
  81552. dc.b $20, 8 ; $19
  81553. dc.b $C, $C ; $1A
  81554. dc.b 8, 4 ; $1B
  81555. dc.b $18, 4 ; $1C
  81556. dc.b $28, 4 ; $1D
  81557. dc.b 4, 8 ; $1E
  81558. dc.b 4,$18 ; $1F
  81559. dc.b 4,$28 ; $20
  81560. dc.b 4,$10 ; $21
  81561. dc.b $18,$18 ; $22
  81562. dc.b $C,$18 ; $23
  81563. dc.b $48, 8 ; $24
  81564. dc.b $18,$28 ; $25
  81565. dc.b $10, 4 ; $26
  81566. dc.b $20, 2 ; $27
  81567. dc.b 4,$40 ; $28
  81568. dc.b $18,$80 ; $29
  81569. dc.b $20,$10 ; $2A
  81570. dc.b $10,$20 ; $2B
  81571. dc.b $10,$30 ; $2C
  81572. dc.b $10,$40 ; $2D
  81573. dc.b $10,$50 ; $2E
  81574. dc.b $10, 2 ; $2F
  81575. dc.b $10, 1 ; $30
  81576. dc.b 2, 8 ; $31
  81577. dc.b $20,$1C ; $32
  81578. ; ===========================================================================
  81579. ; loc_3F666:
  81580. Touch_Boss:
  81581. lea Touch_Sizes(pc),a3
  81582. move.w x_pos(a0),d2
  81583. move.w y_pos(a0),d3
  81584. subi_.w #8,d2
  81585. moveq #0,d5
  81586. move.b y_radius(a0),d5
  81587. subq.b #3,d5
  81588. sub.w d5,d3
  81589. cmpi.b #$4D,mapping_frame(a0)
  81590. bne.s +
  81591. addi.w #$C,d3
  81592. moveq #$A,d5
  81593. +
  81594. move.w #$10,d4
  81595. add.w d5,d5
  81596. lea (Dynamic_Object_RAM).w,a1
  81597. move.w #(Dynamic_Object_RAM_End-Dynamic_Object_RAM)/object_size-1,d6
  81598.  
  81599. loc_3F69C:
  81600. move.b collision_flags(a1),d0
  81601. bne.s loc_3F6AE
  81602.  
  81603. loc_3F6A2:
  81604. lea next_object(a1),a1 ; a1=object
  81605. dbf d6,loc_3F69C
  81606.  
  81607. moveq #0,d0
  81608. rts
  81609. ; ===========================================================================
  81610.  
  81611. loc_3F6AE:
  81612. bsr.w BossSpecificCollision
  81613. andi.w #$3F,d0
  81614. beq.s loc_3F6A2
  81615. add.w d0,d0
  81616. lea (a3,d0.w),a2
  81617. moveq #0,d1
  81618. move.b (a2)+,d1
  81619. move.w x_pos(a1),d0
  81620. sub.w d1,d0
  81621. sub.w d2,d0
  81622. bcc.s loc_3F6D4
  81623. add.w d1,d1
  81624. add.w d1,d0
  81625. bcs.s loc_3F6D8
  81626. bra.s loc_3F6A2
  81627. ; ===========================================================================
  81628.  
  81629. loc_3F6D4:
  81630. cmp.w d4,d0
  81631. bhi.s loc_3F6A2
  81632.  
  81633. loc_3F6D8:
  81634. moveq #0,d1
  81635. move.b (a2)+,d1
  81636. move.w y_pos(a1),d0
  81637. sub.w d1,d0
  81638. sub.w d3,d0
  81639. bcc.s loc_3F6EE
  81640. add.w d1,d1
  81641. add.w d1,d0
  81642. bcs.s Touch_ChkValue
  81643. bra.s loc_3F6A2
  81644. ; ===========================================================================
  81645.  
  81646. loc_3F6EE:
  81647. cmp.w d5,d0
  81648. bhi.s loc_3F6A2
  81649. ; loc_3F6F2:
  81650. Touch_ChkValue:
  81651. move.b collision_flags(a1),d1 ; load touch response number
  81652. andi.b #$C0,d1 ; is touch response $40 or higher?
  81653. beq.w Touch_Enemy ; if not, branch
  81654. cmpi.b #$C0,d1 ; is touch response $C0 or higher?
  81655. beq.w Touch_Special ; if yes, branch
  81656. tst.b d1 ; is touch response $80-$BF ?
  81657. bmi.w Touch_ChkHurt ; if yes, branch
  81658. ; touch response is $40-$7F
  81659. move.b collision_flags(a1),d0
  81660. andi.b #$3F,d0
  81661. cmpi.b #6,d0 ; is touch response $46 ?
  81662. beq.s Touch_Monitor ; if yes, branch
  81663. move.w (MainCharacter+invulnerable_time).w,d0
  81664. tst.w (Two_player_mode).w
  81665. beq.s +
  81666. move.w invulnerable_time(a0),d0
  81667. +
  81668. cmpi.w #90,d0
  81669. bhs.w +
  81670. move.b #4,routine(a1) ; set the object's routine counter
  81671. move.w a0,parent(a1)
  81672. +
  81673. rts
  81674. ; ===========================================================================
  81675. ; loc_3F73C:
  81676. Touch_Monitor:
  81677. tst.w y_vel(a0) ; is Sonic moving upwards?
  81678. bpl.s loc_3F768 ; if not, branch
  81679. move.w y_pos(a0),d0
  81680. subi.w #$10,d0
  81681. cmp.w y_pos(a1),d0
  81682. blo.s return_3F78A
  81683. neg.w y_vel(a0) ; reverse Sonic's y-motion
  81684. move.w #-$180,y_vel(a1)
  81685. tst.b routine_secondary(a1)
  81686. bne.s return_3F78A
  81687. move.b #4,routine_secondary(a1) ; set the monitor's routine counter
  81688. rts
  81689. ; ===========================================================================
  81690.  
  81691. loc_3F768:
  81692. cmpa.w #MainCharacter,a0
  81693. beq.s +
  81694. tst.w (Two_player_mode).w
  81695. beq.s return_3F78A
  81696. +
  81697. cmpi.b #AniIDSonAni_Roll,anim(a0)
  81698. bne.s return_3F78A
  81699. neg.w y_vel(a0) ; reverse Sonic's y-motion
  81700. move.b #4,routine(a1)
  81701. move.w a0,parent(a1)
  81702.  
  81703. return_3F78A:
  81704. rts
  81705. ; ===========================================================================
  81706. ; loc_3F78C:
  81707. Touch_Enemy:
  81708. btst #status_sec_isInvincible,status_secondary(a0) ; is Sonic invincible?
  81709. bne.s + ; if yes, branch
  81710. cmpi.b #AniIDSonAni_Spindash,anim(a0)
  81711. beq.s +
  81712. cmpi.b #AniIDSonAni_Roll,anim(a0) ; is Sonic rolling?
  81713. bne.w Touch_ChkHurt ; if not, branch
  81714. +
  81715. btst #6,render_flags(a1)
  81716. beq.s Touch_Enemy_Part2
  81717. tst.b boss_hitcount2(a1)
  81718. beq.s return_3F7C6
  81719. neg.w x_vel(a0)
  81720. neg.w y_vel(a0)
  81721. move.b #0,collision_flags(a1)
  81722. subq.b #1,boss_hitcount2(a1)
  81723.  
  81724. return_3F7C6:
  81725. rts
  81726. ; ---------------------------------------------------------------------------
  81727. ; loc_3F7C8:
  81728. Touch_Enemy_Part2:
  81729. tst.b collision_property(a1)
  81730. beq.s Touch_KillEnemy
  81731. neg.w x_vel(a0)
  81732. neg.w y_vel(a0)
  81733. move.b #0,collision_flags(a1)
  81734. subq.b #1,collision_property(a1)
  81735. bne.s return_3F7E8
  81736. bset #7,status(a1)
  81737.  
  81738. return_3F7E8:
  81739. rts
  81740. ; ===========================================================================
  81741. ; loc_3F7EA:
  81742. Touch_KillEnemy:
  81743. bset #7,status(a1)
  81744. moveq #0,d0
  81745. move.w (Chain_Bonus_counter).w,d0
  81746. addq.w #2,(Chain_Bonus_counter).w ; add 2 to chain bonus counter
  81747. cmpi.w #6,d0
  81748. blo.s loc_3F802
  81749. moveq #6,d0
  81750.  
  81751. loc_3F802:
  81752. move.w d0,objoff_3E(a1)
  81753. move.w Enemy_Points(pc,d0.w),d0
  81754. cmpi.w #$20,(Chain_Bonus_counter).w ; have 16 enemies been destroyed?
  81755. blo.s loc_3F81C ; if not, branch
  81756. move.w #1000,d0 ; fix bonus to 10000 points
  81757. move.w #$A,objoff_3E(a1)
  81758.  
  81759. loc_3F81C:
  81760. movea.w a0,a3
  81761. bsr.w AddPoints2
  81762. _move.b #ObjID_Explosion,id(a1) ; load obj
  81763. move.b #0,routine(a1)
  81764. tst.w y_vel(a0)
  81765. bmi.s loc_3F844
  81766. move.w y_pos(a0),d0
  81767. cmp.w y_pos(a1),d0
  81768. bhs.s loc_3F84C
  81769. neg.w y_vel(a0)
  81770. rts
  81771. ; ===========================================================================
  81772.  
  81773. loc_3F844:
  81774. addi.w #$100,y_vel(a0)
  81775. rts
  81776. ; ===========================================================================
  81777.  
  81778. loc_3F84C:
  81779. subi.w #$100,y_vel(a0)
  81780. rts
  81781. ; ===========================================================================
  81782. ; byte_3F854:
  81783. Enemy_Points: dc.w 10, 20, 50, 100
  81784. ; ===========================================================================
  81785.  
  81786. loc_3F85C:
  81787. bset #7,status(a1)
  81788.  
  81789. ; ---------------------------------------------------------------------------
  81790. ; Subroutine for checking if Sonic/Tails should be hurt and hurting them if so
  81791. ; note: sonic or tails must be at a0
  81792. ; ---------------------------------------------------------------------------
  81793.  
  81794. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  81795.  
  81796. ; loc_3F862:
  81797. Touch_ChkHurt:
  81798. btst #status_sec_isInvincible,status_secondary(a0) ; is Sonic invincible?
  81799. beq.s Touch_Hurt ; if not, branch
  81800. ; loc_3F86A:
  81801. Touch_NoHurt:
  81802. moveq #-1,d0
  81803. rts
  81804. ; ---------------------------------------------------------------------------
  81805. ; loc_3F86E:
  81806. Touch_Hurt:
  81807. nop
  81808. tst.w invulnerable_time(a0)
  81809. bne.s Touch_NoHurt
  81810. movea.l a1,a2
  81811.  
  81812. ; End of function TouchResponse
  81813. ; continue straight to HurtCharacter
  81814.  
  81815. ; ---------------------------------------------------------------------------
  81816. ; Hurting Sonic/Tails subroutine
  81817. ; ---------------------------------------------------------------------------
  81818.  
  81819. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  81820.  
  81821. ; loc_3F878: HurtSonic:
  81822. HurtCharacter:
  81823. move.w (Ring_count).w,d0
  81824. cmpa.w #MainCharacter,a0
  81825. beq.s loc_3F88C
  81826. tst.w (Two_player_mode).w
  81827. beq.s Hurt_Sidekick
  81828. move.w (Ring_count_2P).w,d0
  81829.  
  81830. loc_3F88C:
  81831. btst #status_sec_hasShield,status_secondary(a0)
  81832. bne.s Hurt_Shield
  81833. tst.w d0
  81834. beq.w KillCharacter
  81835. jsr (SingleObjLoad).l
  81836. bne.s Hurt_Shield
  81837. _move.b #ObjID_LostRings,id(a1) ; load obj
  81838. move.w x_pos(a0),x_pos(a1)
  81839. move.w y_pos(a0),y_pos(a1)
  81840. move.w a0,parent(a1)
  81841.  
  81842. ; loc_3F8B8:
  81843. Hurt_Shield:
  81844. bclr #status_sec_hasShield,status_secondary(a0) ; remove shield
  81845.  
  81846. ; loc_3F8BE:
  81847. Hurt_Sidekick:
  81848. move.b #4,routine(a0)
  81849. jsrto (Sonic_ResetOnFloor_Part2).l, JmpTo_Sonic_ResetOnFloor_Part2
  81850. bset #1,status(a0)
  81851. move.w #-$400,y_vel(a0) ; make Sonic bounce away from the object
  81852. move.w #-$200,x_vel(a0)
  81853. btst #6,status(a0) ; underwater?
  81854. beq.s Hurt_Reverse ; if not, branch
  81855. move.w #-$200,y_vel(a0) ; bounce slower
  81856. move.w #-$100,x_vel(a0)
  81857.  
  81858. ; loc_3F8EE:
  81859. Hurt_Reverse:
  81860. move.w x_pos(a0),d0
  81861. cmp.w x_pos(a2),d0
  81862. blo.s Hurt_ChkSpikes ; if Sonic is left of the object, branch
  81863. neg.w x_vel(a0) ; if Sonic is right of the object, reverse
  81864.  
  81865. ; loc_3F8FC:
  81866. Hurt_ChkSpikes:
  81867. move.w #0,inertia(a0)
  81868. move.b #AniIDSonAni_Hurt2,anim(a0)
  81869. move.w #$78,invulnerable_time(a0)
  81870. move.w #SndID_Hurt,d0 ; load normal damage sound
  81871. cmpi.b #ObjID_Spikes,(a2) ; was damage caused by spikes?
  81872. bne.s Hurt_Sound ; if not, branch
  81873. move.w #SndID_HurtBySpikes,d0 ; load spikes damage sound
  81874.  
  81875. ; loc_3F91C:
  81876. Hurt_Sound:
  81877. jsr (PlaySound).l
  81878. moveq #-1,d0
  81879. rts
  81880. ; ===========================================================================
  81881.  
  81882. ; ---------------------------------------------------------------------------
  81883. ; Subroutine to kill Sonic or Tails
  81884. ; ---------------------------------------------------------------------------
  81885.  
  81886. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  81887.  
  81888. ; loc_3F926: KillSonic:
  81889. KillCharacter:
  81890. tst.w (Debug_placement_mode).w
  81891. bne.s ++
  81892. clr.b status_secondary(a0)
  81893. move.b #6,routine(a0)
  81894. jsrto (Sonic_ResetOnFloor_Part2).l, JmpTo_Sonic_ResetOnFloor_Part2
  81895. bset #1,status(a0)
  81896. move.w #-$700,y_vel(a0)
  81897. move.w #0,x_vel(a0)
  81898. move.w #0,inertia(a0)
  81899. move.b #AniIDSonAni_Death,anim(a0)
  81900. bset #high_priority_bit,art_tile(a0)
  81901. move.w #SndID_Hurt,d0
  81902. cmpi.b #ObjID_Spikes,id(a2)
  81903. bne.s +
  81904. move.w #SndID_HurtBySpikes,d0
  81905. +
  81906. jsr (PlaySound).l
  81907. +
  81908. moveq #-1,d0
  81909. rts
  81910. ; ===========================================================================
  81911. ;loc_3F976:
  81912. Touch_Special:
  81913. move.b collision_flags(a1),d1
  81914. andi.b #$3F,d1
  81915. cmpi.b #6,d1
  81916. beq.s loc_3FA00
  81917. cmpi.b #7,d1
  81918. beq.w loc_3FA18
  81919. cmpi.b #$B,d1
  81920. beq.s BranchTo_loc_3F85C
  81921. cmpi.b #$A,d1
  81922. beq.s loc_3FA00
  81923. cmpi.b #$C,d1
  81924. beq.s loc_3F9CE
  81925. cmpi.b #$14,d1
  81926. beq.s loc_3FA00
  81927. cmpi.b #$15,d1
  81928. beq.s loc_3FA00
  81929. cmpi.b #$16,d1
  81930. beq.s loc_3FA00
  81931. cmpi.b #$17,d1
  81932. beq.s loc_3FA00
  81933. cmpi.b #$18,d1
  81934. beq.s loc_3FA00
  81935. cmpi.b #$1A,d1
  81936. beq.s loc_3FA22
  81937. cmpi.b #$21,d1
  81938. beq.s loc_3FA12
  81939. rts
  81940. ; ===========================================================================
  81941.  
  81942. BranchTo_loc_3F85C
  81943. bra.w loc_3F85C
  81944. ; ===========================================================================
  81945.  
  81946. loc_3F9CE:
  81947. sub.w d0,d5
  81948. cmpi.w #8,d5
  81949. bhs.s BranchTo_Touch_Enemy
  81950. move.w x_pos(a1),d0
  81951. subq.w #4,d0
  81952. btst #0,status(a1)
  81953. beq.s loc_3F9E8
  81954. subi.w #$10,d0
  81955.  
  81956. loc_3F9E8:
  81957. sub.w d2,d0
  81958. bcc.s loc_3F9F4
  81959. addi.w #$18,d0
  81960. bcs.s BranchTo_Touch_ChkHurt
  81961. bra.s BranchTo_Touch_Enemy
  81962. ; ===========================================================================
  81963.  
  81964. loc_3F9F4:
  81965. cmp.w d4,d0
  81966. bhi.s BranchTo_Touch_Enemy
  81967.  
  81968. BranchTo_Touch_ChkHurt
  81969. bra.w Touch_ChkHurt
  81970. ; ===========================================================================
  81971.  
  81972. BranchTo_Touch_Enemy
  81973. bra.w Touch_Enemy
  81974. ; ===========================================================================
  81975.  
  81976. loc_3FA00:
  81977. move.w a0,d1
  81978. subi.w #Object_RAM,d1
  81979. beq.s +
  81980. addq.b #1,collision_property(a1)
  81981. +
  81982. addq.b #1,collision_property(a1)
  81983. rts
  81984. ; ===========================================================================
  81985.  
  81986. loc_3FA12:
  81987. addq.b #1,collision_property(a1)
  81988. rts
  81989. ; ===========================================================================
  81990.  
  81991. loc_3FA18:
  81992. move.b #2,collision_property(a1)
  81993. bra.w Touch_Enemy
  81994. ; ===========================================================================
  81995.  
  81996. loc_3FA22:
  81997. move.b #-1,collision_property(a1)
  81998. bra.w Touch_Enemy
  81999. ; ===========================================================================
  82000. ; loc_3FA2C:
  82001. BossSpecificCollision:
  82002. cmpi.b #$F,d0
  82003. bne.s + ; rts
  82004. moveq #0,d0
  82005. move.b (Current_Boss_ID).w,d0
  82006. beq.s + ; rts
  82007. subq.w #1,d0
  82008. add.w d0,d0
  82009. move.w BossCollision_Index(pc,d0.w),d0
  82010. jmp BossCollision_Index(pc,d0.w)
  82011. ; ===========================================================================
  82012. + rts
  82013. ; ===========================================================================
  82014. ; off_3FA48:
  82015. BossCollision_Index:offsetTable ; jump depending on boss ID
  82016. offsetTableEntry.w BossCollision_EHZ_CPZ
  82017. offsetTableEntry.w BossCollision_EHZ_CPZ
  82018. offsetTableEntry.w BossCollision_HTZ
  82019. offsetTableEntry.w BossCollision_ARZ
  82020. offsetTableEntry.w BossCollision_MCZ
  82021. offsetTableEntry.w BossCollision_CNZ
  82022. offsetTableEntry.w BossCollision_MTZ
  82023. offsetTableEntry.w BossCollision_OOZ
  82024. offsetTableEntry.w return_3FA5E
  82025. ; ===========================================================================
  82026. ;loc_3FA5A:
  82027. BossCollision_EHZ_CPZ:
  82028. move.b collision_flags(a1),d0
  82029.  
  82030. return_3FA5E:
  82031. rts
  82032. ; ===========================================================================
  82033. ;loc_3FA60:
  82034. BossCollision_HTZ:
  82035. tst.b (Boss_CollisionRoutine).w
  82036. bne.s +
  82037. rts
  82038. ; ---------------------------------------------------------------------------
  82039. +
  82040. move.w d7,-(sp)
  82041. moveq #0,d1
  82042. move.b objoff_15(a1),d1
  82043. subq.b #2,d1
  82044. cmpi.b #7,d1
  82045. bgt.s loc_3FAA8
  82046. move.w d1,d7
  82047. add.w d7,d7
  82048. move.w x_pos(a1),d0
  82049. btst #0,render_flags(a1)
  82050. beq.s loc_3FA8E
  82051. add.w word_3FAB0(pc,d7.w),d0
  82052. bra.s loc_3FA92
  82053. ; ===========================================================================
  82054.  
  82055. loc_3FA8E:
  82056. sub.w word_3FAB0(pc,d7.w),d0
  82057.  
  82058. loc_3FA92:
  82059. move.b byte_3FAC0(pc,d1.w),d1
  82060. ori.l #$40000,d1
  82061. move.w y_pos(a1),d7
  82062. subi.w #$1C,d7
  82063. bsr.w Boss_DoCollision
  82064.  
  82065. loc_3FAA8:
  82066. move.w (sp)+,d7
  82067. move.b collision_flags(a1),d0
  82068. rts
  82069. ; ===========================================================================
  82070. word_3FAB0:
  82071. dc.w $1C
  82072. dc.w $20 ; 1
  82073. dc.w $28 ; 2
  82074. dc.w $34 ; 3
  82075. dc.w $3C ; 4
  82076. dc.w $44 ; 5
  82077. dc.w $60 ; 6
  82078. dc.w $70 ; 7
  82079. byte_3FAC0:
  82080. dc.b 4
  82081. dc.b 4 ; 1
  82082. dc.b 8 ; 2
  82083. dc.b $C ; 3
  82084. dc.b $14 ; 4
  82085. dc.b $1C ; 5
  82086. dc.b $24 ; 6
  82087. dc.b 8 ; 7
  82088. ; ===========================================================================
  82089. ;loc_3FAC8:
  82090. BossCollision_ARZ:
  82091. move.w d7,-(sp)
  82092. move.w x_pos(a1),d0
  82093. move.w y_pos(a1),d7
  82094. tst.b (Boss_CollisionRoutine).w
  82095. beq.s ++
  82096. addi_.w #4,d7
  82097. subi.w #$50,d0
  82098. btst #0,render_flags(a1)
  82099. beq.s +
  82100. addi.w #$A0,d0
  82101. +
  82102. move.l #$140010,d1
  82103. bsr.w Boss_DoCollision
  82104. +
  82105. move.w (sp)+,d7
  82106. move.b collision_flags(a1),d0
  82107. rts
  82108. ; ===========================================================================
  82109. ;loc_3FAFE:
  82110. BossCollision_MCZ:
  82111. sf boss_hurt_sonic(a1)
  82112. cmpi.b #1,(Boss_CollisionRoutine).w
  82113. blt.s BossCollision_MCZ2
  82114. ; Boss_CollisionRoutine = 1, i.e. diggers pointing to the side
  82115. move.w d7,-(sp)
  82116. move.w x_pos(a1),d0
  82117. move.w y_pos(a1),d7
  82118. addi_.w #4,d7
  82119. subi.w #$30,d0
  82120. btst #0,render_flags(a1) ; left or right?
  82121. beq.s +
  82122. addi.w #$60,d0 ; x+$30, otherwise x-$30
  82123. +
  82124. move.l #$40004,d1 ; heigth 4, width 4
  82125. bsr.w Boss_DoCollision
  82126. move.w (sp)+,d7
  82127. move.b collision_flags(a1),d0
  82128. cmpi.w #$78,invulnerable_time(a0)
  82129. bne.s + ; rts
  82130. st boss_hurt_sonic(a1) ; sonic has just been hurt flag
  82131. +
  82132. rts
  82133. ; ===========================================================================
  82134. ; Boss_CollisionRoutine = 0, i.e. diggers pointing towards top
  82135. ;loc_3FB46:
  82136. BossCollision_MCZ2:
  82137. move.w d7,-(sp)
  82138. movea.w #$14,a5
  82139. movea.w #0,a4
  82140.  
  82141. - move.w x_pos(a1),d0
  82142. move.w y_pos(a1),d7
  82143. subi.w #$20,d7
  82144. add.w a5,d0 ; first check x+$14, second x-$14
  82145. move.l #$100004,d1 ; heigth $10, width 4
  82146. bsr.w Boss_DoCollision
  82147. movea.w #-$14,a5
  82148. adda_.w #1,a4
  82149. cmpa.w #1,a4
  82150. beq.s - ; jump back once for second check
  82151. move.w (sp)+,d7
  82152. move.b collision_flags(a1),d0
  82153. cmpi.w #$78,invulnerable_time(a0)
  82154. bne.s + ; rts
  82155. st boss_hurt_sonic(a1) ; sonic has just been hurt flag
  82156. +
  82157. rts
  82158. ; ===========================================================================
  82159. ;loc_3FB8A:
  82160. BossCollision_CNZ:
  82161. tst.b (Boss_CollisionRoutine).w
  82162. beq.s ++
  82163. move.w d7,-(sp)
  82164. move.w x_pos(a1),d0
  82165. move.w y_pos(a1),d7
  82166. addi.w #$28,d7
  82167. move.l #$80010,d1
  82168. cmpi.b #1,(Boss_CollisionRoutine).w
  82169. beq.s +
  82170. move.w #$20,d1
  82171. subi_.w #8,d7
  82172. addi_.w #4,d0
  82173. +
  82174. bsr.w Boss_DoCollision
  82175. move.w (sp)+,d7
  82176. +
  82177. move.b collision_flags(a1),d0
  82178. rts
  82179. ; ===========================================================================
  82180. ;loc_3FBC4:
  82181. BossCollision_MTZ:
  82182. move.b collision_flags(a1),d0
  82183. rts
  82184. ; ===========================================================================
  82185. ;loc_3FBCA:
  82186. BossCollision_OOZ:
  82187. cmpi.b #1,(Boss_CollisionRoutine).w
  82188. blt.s loc_3FC46
  82189. beq.s loc_3FC1C
  82190. move.w d7,-(sp)
  82191. move.w x_pos(a1),d0
  82192. move.w y_pos(a1),d7
  82193. moveq #0,d1
  82194. move.b mainspr_mapframe(a1),d1
  82195. subq.b #2,d1
  82196. add.w d1,d1
  82197. btst #0,render_flags(a1)
  82198. beq.s loc_3FBF6
  82199. add.w word_3FC10(pc,d1.w),d0
  82200. bra.s loc_3FBFA
  82201. ; ===========================================================================
  82202.  
  82203. loc_3FBF6:
  82204. sub.w word_3FC10(pc,d1.w),d0
  82205.  
  82206. loc_3FBFA:
  82207. sub.w word_3FC10+2(pc,d1.w),d7
  82208. move.l #$60008,d1
  82209. bsr.w Boss_DoCollision
  82210. move.w (sp)+,d7
  82211. move.w #0,d0
  82212. rts
  82213. ; ===========================================================================
  82214. word_3FC10:
  82215. dc.w $14, 0
  82216. dc.w $10, $10
  82217. dc.w $10, -$10
  82218. ; ===========================================================================
  82219.  
  82220. loc_3FC1C:
  82221. move.w d7,-(sp)
  82222. move.w x_pos(a1),d0
  82223. move.w y_pos(a1),d7
  82224. moveq #$10,d1
  82225. btst #0,render_flags(a1)
  82226. beq.s +
  82227. neg.w d1
  82228. +
  82229. sub.w d1,d0
  82230. move.l #$8000C,d1
  82231. bsr.w loc_3FC7A
  82232. move.w (sp)+,d7
  82233. move.b #0,d0
  82234. rts
  82235. ; ===========================================================================
  82236.  
  82237. loc_3FC46:
  82238. move.b collision_flags(a1),d0
  82239. rts
  82240. ; ===========================================================================
  82241. ;loc_3FC4C:
  82242. ; d7 = y_boss, d3 = y_sonic, d1 (high word) = heigth
  82243. ; d0 = x_boss, d2 = x_sonic, d1 (low word) = width
  82244. Boss_DoCollision:
  82245. sub.w d1,d0
  82246. sub.w d2,d0
  82247. bcc.s loc_3FC5A
  82248. add.w d1,d1
  82249. add.w d1,d0
  82250. bcs.s loc_3FC5E
  82251.  
  82252. return_3FC58:
  82253. rts
  82254. ; ===========================================================================
  82255.  
  82256. loc_3FC5A:
  82257. cmp.w d4,d0
  82258. bhi.s return_3FC58
  82259.  
  82260. loc_3FC5E:
  82261. swap d1
  82262. sub.w d1,d7
  82263. sub.w d3,d7
  82264. bcc.s loc_3FC70
  82265. add.w d1,d1
  82266. add.w d1,d7
  82267. bcs.w Touch_ChkHurt
  82268. bra.s return_3FC58
  82269. ; ===========================================================================
  82270.  
  82271. loc_3FC70:
  82272. cmp.w d5,d7
  82273. bhi.w return_3FC58
  82274. bra.w Touch_ChkHurt
  82275. ; ===========================================================================
  82276.  
  82277. loc_3FC7A:
  82278. sub.w d1,d0
  82279. sub.w d2,d0
  82280. bcc.s loc_3FC88
  82281. add.w d1,d1
  82282. add.w d1,d0
  82283. bcs.s loc_3FC8C
  82284.  
  82285. return_3FC86:
  82286. rts
  82287. ; ===========================================================================
  82288.  
  82289. loc_3FC88:
  82290. cmp.w d4,d0
  82291. bhi.s return_3FC86
  82292.  
  82293. loc_3FC8C:
  82294. swap d1
  82295. sub.w d1,d7
  82296. sub.w d3,d7
  82297. bcc.s loc_3FC9E
  82298. add.w d1,d1
  82299. add.w d1,d7
  82300. bcs.w loc_3FCA4
  82301. bra.s return_3FC86
  82302. ; ===========================================================================
  82303.  
  82304. loc_3FC9E:
  82305. cmp.w d5,d7
  82306. bhi.w return_3FC86
  82307.  
  82308. loc_3FCA4:
  82309. neg.w x_vel(a0)
  82310. neg.w y_vel(a0)
  82311. rts
  82312. ; ===========================================================================
  82313.  
  82314. if gameRevision<2
  82315. nop
  82316. endif
  82317.  
  82318. if ~~removeJmpTos
  82319. JmpTo_Sonic_ResetOnFloor_Part2
  82320. jmp (Sonic_ResetOnFloor_Part2).l
  82321. JmpTo_Check_CNZ_bumpers
  82322. jmp (Check_CNZ_bumpers).l
  82323. JmpTo_Touch_Rings
  82324. jmp (Touch_Rings).l
  82325.  
  82326. align 4
  82327. endif
  82328.  
  82329.  
  82330.  
  82331.  
  82332. ; ===========================================================================
  82333. ;loc_3FCC4:
  82334. AniArt_Load:
  82335. moveq #0,d0
  82336. move.b (Current_Zone).w,d0
  82337. add.w d0,d0
  82338. add.w d0,d0
  82339. move.w PLC_DYNANM+2(pc,d0.w),d1
  82340. lea PLC_DYNANM(pc,d1.w),a2
  82341. move.w PLC_DYNANM(pc,d0.w),d0
  82342. jmp PLC_DYNANM(pc,d0.w)
  82343. ; ===========================================================================
  82344. rts
  82345. ; ===========================================================================
  82346.  
  82347.  
  82348.  
  82349.  
  82350. ; ---------------------------------------------------------------------------
  82351. ; ZONE ANIMATION PROCEDURES AND SCRIPTS
  82352. ;
  82353. ; Each zone gets two entries in this jump table. The first entry points to the
  82354. ; zone's animation procedure (usually Dynamic_Normal, but some zones have special
  82355. ; procedures for complicated animations). The second points to the zone's animation
  82356. ; script.
  82357. ;
  82358. ; Note that Animated_Null is not a valid animation script, so don't pair it up
  82359. ; with anything except Dynamic_Null, or bad things will happen (for example, a bus error exception).
  82360. ; ---------------------------------------------------------------------------
  82361. PLC_DYNANM: zoneOrderedOffsetTable 2,2 ; Zone ID
  82362. zoneOffsetTableEntry.w Dynamic_Normal ; $00
  82363. zoneOffsetTableEntry.w Animated_EHZ
  82364.  
  82365. zoneOffsetTableEntry.w Dynamic_Null ; $01
  82366. zoneOffsetTableEntry.w Animated_Null
  82367.  
  82368. zoneOffsetTableEntry.w Dynamic_Null ; $02
  82369. zoneOffsetTableEntry.w Animated_Null
  82370.  
  82371. zoneOffsetTableEntry.w Dynamic_Null ; $03
  82372. zoneOffsetTableEntry.w Animated_Null
  82373.  
  82374. zoneOffsetTableEntry.w Dynamic_Normal ; $04
  82375. zoneOffsetTableEntry.w Animated_MTZ
  82376.  
  82377. zoneOffsetTableEntry.w Dynamic_Normal ; $05
  82378. zoneOffsetTableEntry.w Animated_MTZ
  82379.  
  82380. zoneOffsetTableEntry.w Dynamic_Null ; $06
  82381. zoneOffsetTableEntry.w Animated_Null
  82382.  
  82383. zoneOffsetTableEntry.w Dynamic_HTZ ; $07
  82384. zoneOffsetTableEntry.w Animated_HTZ
  82385.  
  82386. zoneOffsetTableEntry.w Dynamic_Normal ; $08
  82387. zoneOffsetTableEntry.w Animated_HPZ
  82388.  
  82389. zoneOffsetTableEntry.w Dynamic_Null ; $09
  82390. zoneOffsetTableEntry.w Animated_Null
  82391.  
  82392. zoneOffsetTableEntry.w Dynamic_Normal ; $0A
  82393. zoneOffsetTableEntry.w Animated_OOZ
  82394.  
  82395. zoneOffsetTableEntry.w Dynamic_Null ; $0B
  82396. zoneOffsetTableEntry.w Animated_Null
  82397.  
  82398. zoneOffsetTableEntry.w Dynamic_CNZ ; $0C
  82399. zoneOffsetTableEntry.w Animated_CNZ
  82400.  
  82401. zoneOffsetTableEntry.w Dynamic_Normal ; $0D
  82402. zoneOffsetTableEntry.w Animated_CPZ
  82403.  
  82404. zoneOffsetTableEntry.w Dynamic_Normal ; $0E
  82405. zoneOffsetTableEntry.w Animated_DEZ
  82406.  
  82407. zoneOffsetTableEntry.w Dynamic_ARZ ; $0F
  82408. zoneOffsetTableEntry.w Animated_ARZ
  82409.  
  82410. zoneOffsetTableEntry.w Dynamic_Null ; $10
  82411. zoneOffsetTableEntry.w Animated_Null
  82412. zoneTableEnd
  82413. ; ===========================================================================
  82414.  
  82415. Dynamic_Null:
  82416. rts
  82417. ; ===========================================================================
  82418.  
  82419. Dynamic_HTZ:
  82420. tst.w (Two_player_mode).w
  82421. bne.w Dynamic_Normal
  82422. lea (Anim_Counters).w,a3
  82423. moveq #0,d0
  82424. move.w (Camera_X_pos).w,d1
  82425. neg.w d1
  82426. asr.w #3,d1
  82427. move.w (Camera_X_pos).w,d0
  82428. lsr.w #4,d0
  82429. add.w d1,d0
  82430. subi.w #$10,d0
  82431. divu.w #$30,d0
  82432. swap d0
  82433. cmp.b 1(a3),d0
  82434. beq.s BranchTo_loc_3FE5C
  82435. move.b d0,1(a3)
  82436. move.w d0,d2
  82437. andi.w #7,d0
  82438. add.w d0,d0
  82439. add.w d0,d0
  82440. add.w d0,d0
  82441. move.w d0,d1
  82442. add.w d0,d0
  82443. add.w d1,d0
  82444. andi.w #$38,d2
  82445. lsr.w #2,d2
  82446. add.w d2,d0
  82447. lea word_3FD9C(pc,d0.w),a4
  82448. moveq #5,d5
  82449. move.w #tiles_to_bytes(ArtTile_ArtUnc_HTZMountains),d4
  82450.  
  82451. loc_3FD7C:
  82452. moveq #-1,d1
  82453. move.w (a4)+,d1
  82454. andi.l #$FFFFFF,d1
  82455. move.w d4,d2
  82456. moveq #$40,d3
  82457. jsr (QueueDMATransfer).l
  82458. addi.w #$80,d4
  82459. dbf d5,loc_3FD7C
  82460.  
  82461. BranchTo_loc_3FE5C
  82462. bra.w loc_3FE5C
  82463. ; ===========================================================================
  82464. ; HTZ mountain art main RAM addresses?
  82465. word_3FD9C:
  82466. dc.w $80, $180, $280, $580, $600, $700 ; 6
  82467. dc.w $80, $180, $280, $580, $600, $700 ; 12
  82468. dc.w $980, $A80, $B80, $C80, $D00, $D80 ; 18
  82469. dc.w $980, $A80, $B80, $C80, $D00, $D80 ; 24
  82470. dc.w $E80,$1180,$1200,$1280,$1300,$1380 ; 30
  82471. dc.w $E80,$1180,$1200,$1280,$1300,$1380 ; 36
  82472. dc.w $1400,$1480,$1500,$1580,$1600,$1900 ; 42
  82473. dc.w $1400,$1480,$1500,$1580,$1600,$1900 ; 48
  82474. dc.w $1D00,$1D80,$1E00,$1F80,$2400,$2580 ; 54
  82475. dc.w $1D00,$1D80,$1E00,$1F80,$2400,$2580 ; 60
  82476. dc.w $2600,$2680,$2780,$2B00,$2F00,$3280 ; 66
  82477. dc.w $2600,$2680,$2780,$2B00,$2F00,$3280 ; 72
  82478. dc.w $3600,$3680,$3780,$3C80,$3D00,$3F00 ; 78
  82479. dc.w $3600,$3680,$3780,$3C80,$3D00,$3F00 ; 84
  82480. dc.w $3F80,$4080,$4480,$4580,$4880,$4900 ; 90
  82481. dc.w $3F80,$4080,$4480,$4580,$4880,$4900 ; 96
  82482. ; ===========================================================================
  82483.  
  82484. loc_3FE5C:
  82485. lea (TempArray_LayerDef).w,a1
  82486. move.w (Camera_X_pos).w,d2
  82487. neg.w d2
  82488. asr.w #3,d2
  82489. move.l a2,-(sp)
  82490. lea (ArtUnc_HTZClouds).l,a0
  82491. lea (Chunk_Table+$7C00).l,a2
  82492. moveq #$F,d1
  82493.  
  82494. loc_3FE78:
  82495. move.w (a1)+,d0
  82496. neg.w d0
  82497. add.w d2,d0
  82498. andi.w #$1F,d0
  82499. lsr.w #1,d0
  82500. bcc.s loc_3FE8A
  82501. addi.w #$200,d0
  82502.  
  82503. loc_3FE8A:
  82504. lea (a0,d0.w),a4
  82505. lsr.w #1,d0
  82506. bcs.s loc_3FEB4
  82507. move.l (a4)+,(a2)+
  82508. adda.w #$3C,a2
  82509. move.l (a4)+,(a2)+
  82510. adda.w #$3C,a2
  82511. move.l (a4)+,(a2)+
  82512. adda.w #$3C,a2
  82513. move.l (a4)+,(a2)+
  82514. suba.w #$C0,a2
  82515. adda.w #$20,a0
  82516. dbf d1,loc_3FE78
  82517. bra.s loc_3FEEC
  82518. ; ===========================================================================
  82519.  
  82520. loc_3FEB4:
  82521. rept 3
  82522. rept 4
  82523. move.b (a4)+,(a2)+
  82524. endm
  82525. adda.w #$3C,a2
  82526. endm
  82527. rept 4
  82528. move.b (a4)+,(a2)+
  82529. endm
  82530. suba.w #$C0,a2
  82531. adda.w #$20,a0
  82532. dbf d1,loc_3FE78
  82533.  
  82534. loc_3FEEC:
  82535. move.l #(Chunk_Table+$7C00) & $FFFFFF,d1
  82536. move.w #tiles_to_bytes(ArtTile_ArtUnc_HTZClouds),d2
  82537. move.w #$80,d3
  82538. jsr (QueueDMATransfer).l
  82539. movea.l (sp)+,a2
  82540. addq.w #2,a3
  82541. bra.w loc_3FF30
  82542. ; ===========================================================================
  82543.  
  82544. Dynamic_CNZ:
  82545. tst.b (Current_Boss_ID).w
  82546. beq.s +
  82547. rts
  82548. ; ---------------------------------------------------------------------------
  82549. +
  82550. lea (Animated_CNZ).l,a2
  82551. tst.w (Two_player_mode).w
  82552. beq.s Dynamic_Normal
  82553. lea (Animated_CNZ_2P).l,a2
  82554. bra.s Dynamic_Normal
  82555. ; ===========================================================================
  82556.  
  82557. Dynamic_ARZ:
  82558. tst.b (Current_Boss_ID).w
  82559. beq.s Dynamic_Normal
  82560. rts
  82561. ; ===========================================================================
  82562.  
  82563. Dynamic_Normal:
  82564. lea (Anim_Counters).w,a3
  82565.  
  82566. loc_3FF30:
  82567. move.w (a2)+,d6 ; Get number of scripts in list
  82568. ; S&K checks for empty lists, here
  82569. ; bpl.s .listnotempty ; If there are any, continue
  82570. ; rts
  82571. ;.listnotempty:
  82572.  
  82573. ; loc_3FF32:
  82574. .loop:
  82575. subq.b #1,(a3) ; Tick down frame duration
  82576. bcc.s .nextscript ; If frame isn't over, move on to next script
  82577.  
  82578. ;.nextframe:
  82579. moveq #0,d0
  82580. move.b 1(a3),d0 ; Get current frame
  82581. cmp.b 6(a2),d0 ; Have we processed the last frame in the script?
  82582. blo.s .notlastframe
  82583. moveq #0,d0 ; If so, reset to first frame
  82584. move.b d0,1(a3) ; ''
  82585. ; loc_3FF48:
  82586. .notlastframe:
  82587. addq.b #1,1(a3) ; Consider this frame processed; set counter to next frame
  82588. move.b (a2),(a3) ; Set frame duration to global duration value
  82589. bpl.s .globalduration
  82590. ; If script uses per-frame durations, use those instead
  82591. add.w d0,d0
  82592. move.b 9(a2,d0.w),(a3) ; Set frame duration to current frame's duration value
  82593. ; loc_3FF56:
  82594. .globalduration:
  82595. ; Prepare for DMA transfer
  82596. ; Get relative address of frame's art
  82597. move.b 8(a2,d0.w),d0 ; Get tile ID
  82598. lsl.w #5,d0 ; Turn it into an offset
  82599. ; Get VRAM destination address
  82600. move.w 4(a2),d2
  82601. ; Get ROM source address
  82602. move.l (a2),d1 ; Get start address of animated tile art
  82603. andi.l #$FFFFFF,d1
  82604. add.l d0,d1 ; Offset into art, to get the address of new frame
  82605. ; Get size of art to be transferred
  82606. moveq #0,d3
  82607. move.b 7(a2),d3
  82608. lsl.w #4,d3 ; Turn it into actual size (in words)
  82609. ; Use d1, d2 and d3 to queue art for transfer
  82610. jsr (QueueDMATransfer).l
  82611. ; loc_3FF78:
  82612. .nextscript:
  82613. move.b 6(a2),d0 ; Get total size of frame data
  82614. tst.b (a2) ; Is per-frame duration data present?
  82615. bpl.s .globalduration2; If not, keep the current size; it's correct
  82616. add.b d0,d0 ; Double size to account for the additional frame duration data
  82617. ; loc_3FF82:
  82618. .globalduration2:
  82619. addq.b #1,d0
  82620. andi.w #$FE,d0 ; Round to next even address, if it isn't already
  82621. lea 8(a2,d0.w),a2 ; Advance to next script in list
  82622. addq.w #2,a3 ; Advance to next script's slot in a3 (usually Anim_Counters)
  82623. dbf d6,.loop
  82624. rts
  82625. ; ===========================================================================
  82626. ; ZONE ANIMATION SCRIPTS
  82627. ;
  82628. ; The Dynamic_Normal subroutine uses these scripts to reload certain tiles,
  82629. ; thus animating them. All the relevant art must be uncompressed, because
  82630. ; otherwise the subroutine would spend so much time waiting for the art to be
  82631. ; decompressed that the VBLANK window would close before all the animating was done.
  82632.  
  82633. ; zoneanimdecl -1, ArtUnc_Flowers1, ArtTile_ArtUnc_Flowers1, 6, 2
  82634. ; -1 Global frame duration. If -1, then each frame will use its own duration, instead
  82635. ; ArtUnc_Flowers1 Source address
  82636. ; ArtTile_ArtUnc_Flowers1 Destination VRAM address
  82637. ; 6 Number of frames
  82638. ; 2 Number of tiles to load into VRAM for each frame
  82639.  
  82640. ; dc.b 0,$7F ; Start of the script proper
  82641. ; 0 Tile ID of first tile in ArtUnc_Flowers1 to transfer
  82642. ; $7F Frame duration. Only here if global duration is -1
  82643.  
  82644. ; loc_3FF94:
  82645. Animated_EHZ: zoneanimstart
  82646. ; Flowers
  82647. zoneanimdecl -1, ArtUnc_Flowers1, ArtTile_ArtUnc_Flowers1, 6, 2
  82648. dc.b 0,$7F ; Start of the script proper
  82649. dc.b 2,$13
  82650. dc.b 0, 7
  82651. dc.b 2, 7
  82652. dc.b 0, 7
  82653. dc.b 2, 7
  82654. even
  82655. ; Flowers
  82656. zoneanimdecl -1, ArtUnc_Flowers2, ArtTile_ArtUnc_Flowers2, 8, 2
  82657. dc.b 2,$7F
  82658. dc.b 0, $B
  82659. dc.b 2, $B
  82660. dc.b 0, $B
  82661. dc.b 2, 5
  82662. dc.b 0, 5
  82663. dc.b 2, 5
  82664. dc.b 0, 5
  82665. even
  82666. ; Flowers
  82667. zoneanimdecl 7, ArtUnc_Flowers3, ArtTile_ArtUnc_Flowers3, 2, 2
  82668. dc.b 0
  82669. dc.b 2
  82670. even
  82671. ; Flowers
  82672. zoneanimdecl -1, ArtUnc_Flowers4, ArtTile_ArtUnc_Flowers4, 8, 2
  82673. dc.b 0,$7F
  82674. dc.b 2, 7
  82675. dc.b 0, 7
  82676. dc.b 2, 7
  82677. dc.b 0, 7
  82678. dc.b 2, $B
  82679. dc.b 0, $B
  82680. dc.b 2, $B
  82681. even
  82682. ; Pulsing thing against checkered background
  82683. zoneanimdecl -1, ArtUnc_EHZPulseBall, ArtTile_ArtUnc_EHZPulseBall, 6, 2
  82684. dc.b 0,$17
  82685. dc.b 2, 9
  82686. dc.b 4, $B
  82687. dc.b 6,$17
  82688. dc.b 4, $B
  82689. dc.b 2, 9
  82690. even
  82691.  
  82692. zoneanimend
  82693.  
  82694. Animated_MTZ: zoneanimstart
  82695. ; Spinning metal cylinder
  82696. zoneanimdecl 0, ArtUnc_MTZCylinder, ArtTile_ArtUnc_MTZCylinder, 8,$10
  82697. dc.b 0
  82698. dc.b $10
  82699. dc.b $20
  82700. dc.b $30
  82701. dc.b $40
  82702. dc.b $50
  82703. dc.b $60
  82704. dc.b $70
  82705. even
  82706. ; lava
  82707. zoneanimdecl $D, ArtUnc_Lava, ArtTile_ArtUnc_Lava, 6,$C
  82708. dc.b 0
  82709. dc.b $C
  82710. dc.b $18
  82711. dc.b $24
  82712. dc.b $18
  82713. dc.b $C
  82714. even
  82715. ; MTZ background animated section
  82716. zoneanimdecl -1, ArtUnc_MTZAnimBack, ArtTile_ArtUnc_MTZAnimBack_1, 4, 6
  82717. dc.b 0,$13
  82718. dc.b 6, 7
  82719. dc.b $C,$13
  82720. dc.b 6, 7
  82721. even
  82722. ; MTZ background animated section
  82723. zoneanimdecl -1, ArtUnc_MTZAnimBack, ArtTile_ArtUnc_MTZAnimBack_2, 4, 6
  82724. dc.b $C,$13
  82725. dc.b 6, 7
  82726. dc.b 0,$13
  82727. dc.b 6, 7
  82728. even
  82729.  
  82730. zoneanimend
  82731.  
  82732. Animated_HTZ: zoneanimstart
  82733. ; Flowers
  82734. zoneanimdecl -1, ArtUnc_Flowers1, ArtTile_ArtUnc_Flowers1, 6, 2
  82735. dc.b 0,$7F
  82736. dc.b 2,$13
  82737. dc.b 0, 7
  82738. dc.b 2, 7
  82739. dc.b 0, 7
  82740. dc.b 2, 7
  82741. even
  82742. ; Flowers
  82743. zoneanimdecl -1, ArtUnc_Flowers2, ArtTile_ArtUnc_Flowers2, 8, 2
  82744. dc.b 2,$7F
  82745. dc.b 0, $B
  82746. dc.b 2, $B
  82747. dc.b 0, $B
  82748. dc.b 2, 5
  82749. dc.b 0, 5
  82750. dc.b 2, 5
  82751. dc.b 0, 5
  82752. even
  82753. ; Flowers
  82754. zoneanimdecl 7, ArtUnc_Flowers3, ArtTile_ArtUnc_Flowers3, 2, 2
  82755. dc.b 0
  82756. dc.b 2
  82757. even
  82758. ; Flowers
  82759. zoneanimdecl -1, ArtUnc_Flowers4, ArtTile_ArtUnc_Flowers4, 8, 2
  82760. dc.b 0,$7F
  82761. dc.b 2, 7
  82762. dc.b 0, 7
  82763. dc.b 2, 7
  82764. dc.b 0, 7
  82765. dc.b 2, $B
  82766. dc.b 0, $B
  82767. dc.b 2, $B
  82768. even
  82769. ; Pulsing thing against checkered background
  82770. zoneanimdecl -1, ArtUnc_EHZPulseBall, ArtTile_ArtUnc_EHZPulseBall, 6, 2
  82771. dc.b 0,$17
  82772. dc.b 2, 9
  82773. dc.b 4, $B
  82774. dc.b 6,$17
  82775. dc.b 4, $B
  82776. dc.b 2, 9
  82777. even
  82778.  
  82779. zoneanimend
  82780.  
  82781. ; word_4009C: Animated_OOZ:
  82782. Animated_HPZ: zoneanimstart
  82783. ; Supposed to be the pulsing orb from HPZ, but uses OOZ's pulsing ball art
  82784. zoneanimdecl 8, ArtUnc_HPZPulseOrb, ArtTile_ArtUnc_HPZPulseOrb_1, 6, 8
  82785. dc.b 0
  82786. dc.b 0
  82787. dc.b 8
  82788. dc.b $10
  82789. dc.b $10
  82790. dc.b 8
  82791. even
  82792. ; Supposed to be the pulsing orb from HPZ, but uses OOZ's pulsing ball art
  82793. zoneanimdecl 8, ArtUnc_HPZPulseOrb, ArtTile_ArtUnc_HPZPulseOrb_2, 6, 8
  82794. dc.b 8
  82795. dc.b $10
  82796. dc.b $10
  82797. dc.b 8
  82798. dc.b 0
  82799. dc.b 0
  82800. even
  82801. ; Supposed to be the pulsing orb from HPZ, but uses OOZ's pulsing ball art
  82802. zoneanimdecl 8, ArtUnc_HPZPulseOrb, ArtTile_ArtUnc_HPZPulseOrb_3, 6, 8
  82803. dc.b $10
  82804. dc.b 8
  82805. dc.b 0
  82806. dc.b 0
  82807. dc.b 8
  82808. dc.b $10
  82809. even
  82810.  
  82811. zoneanimend
  82812.  
  82813. ; word_400C8: Animated_OOZ2:
  82814. Animated_OOZ: zoneanimstart
  82815. ; Pulsing ball from OOZ
  82816. zoneanimdecl -1, ArtUnc_OOZPulseBall, ArtTile_ArtUnc_OOZPulseBall, 4, 4
  82817. dc.b 0, $B
  82818. dc.b 4, 5
  82819. dc.b 8, 9
  82820. dc.b 4, 3
  82821. even
  82822. ; Square rotating around ball in OOZ
  82823. zoneanimdecl 6, ArtUnc_OOZSquareBall1, ArtTile_ArtUnc_OOZSquareBall1, 4, 4
  82824. dc.b 0
  82825. dc.b 4
  82826. dc.b 8
  82827. dc.b $C
  82828. even
  82829. ; Square rotating around ball
  82830. zoneanimdecl 6, ArtUnc_OOZSquareBall2, ArtTile_ArtUnc_OOZSquareBall2, 4, 4
  82831. dc.b 0
  82832. dc.b 4
  82833. dc.b 8
  82834. dc.b $C
  82835. even
  82836. ; Oil
  82837. zoneanimdecl $11, ArtUnc_Oil1, ArtTile_ArtUnc_Oil1, 6,$10
  82838. dc.b 0
  82839. dc.b $10
  82840. dc.b $20
  82841. dc.b $30
  82842. dc.b $20
  82843. dc.b $10
  82844. even
  82845. ; Oil
  82846. zoneanimdecl $11, ArtUnc_Oil2, ArtTile_ArtUnc_Oil2, 6,$10
  82847. dc.b 0
  82848. dc.b $10
  82849. dc.b $20
  82850. dc.b $30
  82851. dc.b $20
  82852. dc.b $10
  82853. even
  82854.  
  82855. zoneanimend
  82856.  
  82857. Animated_CNZ: zoneanimstart
  82858. ; Flipping foreground section in CNZ
  82859. zoneanimdecl -1, ArtUnc_CNZFlipTiles, ArtTile_ArtUnc_CNZFlipTiles_2, $10,$10
  82860. dc.b 0,$C7
  82861. dc.b $10, 5
  82862. dc.b $20, 5
  82863. dc.b $30, 5
  82864. dc.b $40,$C7
  82865. dc.b $50, 5
  82866. dc.b $20, 5
  82867. dc.b $60, 5
  82868. dc.b 0, 5
  82869. dc.b $10, 5
  82870. dc.b $20, 5
  82871. dc.b $30, 5
  82872. dc.b $40, 5
  82873. dc.b $50, 5
  82874. dc.b $20, 5
  82875. dc.b $60, 5
  82876. even
  82877. ; Flipping foreground section in CNZ
  82878. zoneanimdecl -1, ArtUnc_CNZFlipTiles, ArtTile_ArtUnc_CNZFlipTiles_1, $10,$10
  82879. dc.b $70, 5
  82880. dc.b $80, 5
  82881. dc.b $20, 5
  82882. dc.b $90, 5
  82883. dc.b $A0, 5
  82884. dc.b $B0, 5
  82885. dc.b $20, 5
  82886. dc.b $C0, 5
  82887. dc.b $70,$C7
  82888. dc.b $80, 5
  82889. dc.b $20, 5
  82890. dc.b $90, 5
  82891. dc.b $A0,$C7
  82892. dc.b $B0, 5
  82893. dc.b $20, 5
  82894. dc.b $C0, 5
  82895. even
  82896.  
  82897. zoneanimend
  82898.  
  82899. ; word_40160:
  82900. Animated_CNZ_2P: zoneanimstart
  82901. ; Flipping foreground section in CNZ
  82902. zoneanimdecl -1, ArtUnc_CNZFlipTiles, ArtTile_ArtUnc_CNZFlipTiles_2_2p, $10,$10
  82903. dc.b 0,$C7
  82904. dc.b $10, 5
  82905. dc.b $20, 5
  82906. dc.b $30, 5
  82907. dc.b $40,$C7
  82908. dc.b $50, 5
  82909. dc.b $20, 5
  82910. dc.b $60, 5
  82911. dc.b 0, 5
  82912. dc.b $10, 5
  82913. dc.b $20, 5
  82914. dc.b $30, 5
  82915. dc.b $40, 5
  82916. dc.b $50, 5
  82917. dc.b $20, 5
  82918. dc.b $60, 5
  82919. even
  82920. ; Flipping foreground section in CNZ
  82921. zoneanimdecl -1, ArtUnc_CNZFlipTiles, ArtTile_ArtUnc_CNZFlipTiles_1_2p, $10,$10
  82922. dc.b $70, 5
  82923. dc.b $80, 5
  82924. dc.b $20, 5
  82925. dc.b $90, 5
  82926. dc.b $A0, 5
  82927. dc.b $B0, 5
  82928. dc.b $20, 5
  82929. dc.b $C0, 5
  82930. dc.b $70,$C7
  82931. dc.b $80, 5
  82932. dc.b $20, 5
  82933. dc.b $90, 5
  82934. dc.b $A0,$C7
  82935. dc.b $B0, 5
  82936. dc.b $20, 5
  82937. dc.b $C0, 5
  82938. even
  82939.  
  82940. zoneanimend
  82941.  
  82942. Animated_CPZ: zoneanimstart
  82943. ; Animated background section in CPZ and DEZ
  82944. zoneanimdecl 4, ArtUnc_CPZAnimBack, ArtTile_ArtUnc_CPZAnimBack, 8, 2
  82945. dc.b 0
  82946. dc.b 2
  82947. dc.b 4
  82948. dc.b 6
  82949. dc.b 8
  82950. dc.b $A
  82951. dc.b $C
  82952. dc.b $E
  82953. even
  82954.  
  82955. zoneanimend
  82956.  
  82957. Animated_DEZ: zoneanimstart
  82958. ; Animated background section in CPZ and DEZ
  82959. zoneanimdecl 4, ArtUnc_CPZAnimBack, ArtTile_ArtUnc_DEZAnimBack, 8, 2
  82960. dc.b 0
  82961. dc.b 2
  82962. dc.b 4
  82963. dc.b 6
  82964. dc.b 8
  82965. dc.b $A
  82966. dc.b $C
  82967. dc.b $E
  82968. even
  82969.  
  82970. zoneanimend
  82971.  
  82972. Animated_ARZ: zoneanimstart
  82973. ; Waterfall patterns
  82974. zoneanimdecl 5, ArtUnc_Waterfall1, ArtTile_ArtUnc_Waterfall1_2, 2, 4
  82975. dc.b 0
  82976. dc.b 4
  82977. even
  82978. ; Waterfall patterns
  82979. zoneanimdecl 5, ArtUnc_Waterfall1, ArtTile_ArtUnc_Waterfall1_1, 2, 4
  82980. dc.b 4
  82981. dc.b 0
  82982. even
  82983. ; Waterfall patterns
  82984. zoneanimdecl 5, ArtUnc_Waterfall2, ArtTile_ArtUnc_Waterfall2, 2, 4
  82985. dc.b 0
  82986. dc.b 4
  82987. even
  82988. ; Waterfall patterns
  82989. zoneanimdecl 5, ArtUnc_Waterfall3, ArtTile_ArtUnc_Waterfall3, 2, 4
  82990. dc.b 0
  82991. dc.b 4
  82992. even
  82993.  
  82994. zoneanimend
  82995.  
  82996. Animated_Null:
  82997. ; invalid
  82998. ; ===========================================================================
  82999.  
  83000. ; ---------------------------------------------------------------------------
  83001. ; Unused mystery function
  83002. ; In CPZ, within a certain range of camera X coordinates spanning
  83003. ; exactly 2 screens (a boss fight or cutscene?),
  83004. ; once every 8 frames, make the entire screen refresh and do... SOMETHING...
  83005. ; (in 2 separate 512-byte blocks of memory, move around a bunch of bytes)
  83006. ; Maybe some abandoned scrolling effect?
  83007. ; ---------------------------------------------------------------------------
  83008.  
  83009. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  83010.  
  83011. ; sub_40200:
  83012. cmpi.b #chemical_plant_zone,(Current_Zone).w
  83013. beq.s +
  83014. - rts
  83015. ; ===========================================================================
  83016. ; this shifts all blocks of the chunks $EA-$ED and $FA-$FD one block to the
  83017. ; left and the last block in each row (chunk $ED/$FD) to the beginning
  83018. ; i.e. rotates the blocks to the left by one
  83019. +
  83020. move.w (Camera_X_pos).w,d0
  83021. cmpi.w #$1940,d0
  83022. blo.s - ; rts
  83023. cmpi.w #$1F80,d0
  83024. bhs.s - ; rts
  83025. subq.b #1,(CPZ_UnkScroll_Timer).w
  83026. bpl.s - ; rts ; do it every 8th frame
  83027. move.b #7,(CPZ_UnkScroll_Timer).w
  83028. move.b #1,(Screen_redraw_flag).w
  83029. lea (Chunk_Table+$7500).l,a1 ; chunks $EA-$ED, $FFFF7500 - $FFFF7700
  83030. bsr.s +
  83031. lea (Chunk_Table+$7D00).l,a1 ; chunks $FA-$FD, $FFFF7D00 - $FFFF7F00
  83032. +
  83033. move.w #7,d1
  83034.  
  83035. - move.w (a1),d0
  83036. rept 3 ; do this for 3 chunks
  83037. rept 7
  83038. move.w 2(a1),(a1)+ ; shift 1st line of chunk by 1 block to the left (+3*14 bytes)
  83039. endm
  83040. move.w $72(a1),(a1)+ ; first block of next chunk to the left into previous chunk (+3*2 bytes)
  83041. adda.w #$70,a1 ; go to next chunk (+336 bytes)
  83042. endm
  83043. rept 7 ; now do it for the 4th chunk
  83044. move.w 2(a1),(a1)+ ; shift 1st line of chunk by 1 block to the left (+14 bytes)
  83045. endm
  83046. move.w d0,(a1)+ ; move 1st block of 1st chunk to last block of last chunk (+2 bytes, subsubtotal = 400 bytes)
  83047. suba.w #$180,a1 ; go to the next row in the first chunk (-384 bytes, subtotal = -16 bytes)
  83048. dbf d1,- ; now do this again for rows 2-8 in these chunks
  83049. ; 400 + 7 * (-16) = 512 byte range was affected
  83050. rts
  83051. ; ===========================================================================
  83052.  
  83053. loc_402D4:
  83054. cmpi.b #hill_top_zone,(Current_Zone).w
  83055. bne.s +
  83056. bsr.w PatchHTZTiles
  83057. move.b #-1,(Anim_Counters+1).w
  83058. move.w #-1,(TempArray_LayerDef+$20).w
  83059. +
  83060. cmpi.b #chemical_plant_zone,(Current_Zone).w
  83061. bne.s +
  83062. move.b #-1,(Anim_Counters+1).w
  83063. +
  83064. moveq #0,d0
  83065. move.b (Current_Zone).w,d0
  83066. add.w d0,d0
  83067. move.w AnimPatMaps(pc,d0.w),d0
  83068. lea AnimPatMaps(pc,d0.w),a0
  83069. tst.w (Two_player_mode).w
  83070. beq.s +
  83071. cmpi.b #casino_night_zone,(Current_Zone).w
  83072. bne.s +
  83073. lea (APM_CNZ2P).l,a0
  83074. +
  83075. tst.w (a0)
  83076. beq.s + ; rts
  83077. lea (Block_Table).w,a1
  83078. adda.w (a0)+,a1
  83079. move.w (a0)+,d1
  83080. tst.w (Two_player_mode).w
  83081. bne.s LoadLevelBlocks_2P
  83082.  
  83083. ; loc_40330:
  83084. LoadLevelBlocks:
  83085. move.w (a0)+,(a1)+ ; copy blocks to RAM
  83086. dbf d1,LoadLevelBlocks ; loop using d1
  83087. +
  83088. rts
  83089. ; ===========================================================================
  83090. ; loc_40338:
  83091. LoadLevelBlocks_2P:
  83092. ; There's a bug in here, where d1, the loop counter,
  83093. ; is overwritten with VRAM data
  83094. move.w (a0)+,d0
  83095. move.w d0,d1
  83096. andi.w #nontile_mask,d0 ; d0 holds the preserved non-tile data
  83097. andi.w #tile_mask,d1 ; d1 holds the tile index (overwrites loop counter!)
  83098. lsr.w #1,d1 ; half tile index
  83099. or.w d1,d0 ; put them back together
  83100. move.w d0,(a1)+
  83101. dbf d1,LoadLevelBlocks_2P ; loop using d1, which we just overwrote
  83102. rts
  83103. ; ===========================================================================
  83104.  
  83105. ; --------------------------------------------------------------------------------------
  83106. ; Animated Pattern Mappings (16x16)
  83107. ; --------------------------------------------------------------------------------------
  83108. ; off_40350:
  83109. AnimPatMaps: zoneOrderedOffsetTable 2,1
  83110. zoneOffsetTableEntry.w APM_EHZ ; 0
  83111. zoneOffsetTableEntry.w APM_Null ; 1
  83112. zoneOffsetTableEntry.w APM_Null ; 2
  83113. zoneOffsetTableEntry.w APM_Null ; 3
  83114. zoneOffsetTableEntry.w APM_MTZ ; 4
  83115. zoneOffsetTableEntry.w APM_MTZ ; 5
  83116. zoneOffsetTableEntry.w APM_Null ; 6
  83117. zoneOffsetTableEntry.w APM_EHZ ; 7
  83118. zoneOffsetTableEntry.w APM_HPZ ; 8
  83119. zoneOffsetTableEntry.w APM_Null ; 9
  83120. zoneOffsetTableEntry.w APM_OOZ ; $A
  83121. zoneOffsetTableEntry.w APM_Null ; $B
  83122. zoneOffsetTableEntry.w APM_CNZ ; $C
  83123. zoneOffsetTableEntry.w APM_CPZ ; $D
  83124. zoneOffsetTableEntry.w APM_DEZ ; $E
  83125. zoneOffsetTableEntry.w APM_ARZ ; $F
  83126. zoneOffsetTableEntry.w APM_Null ;$10
  83127. zoneTableEnd
  83128.  
  83129. begin_animpat macro {INTLABEL}
  83130. __LABEL__ label *
  83131. __LABEL___Len := __LABEL___End - __LABEL___Blocks
  83132. dc.w $1800 - __LABEL___Len
  83133. dc.w bytesToWcnt(__LABEL___Len)
  83134. __LABEL___Blocks:
  83135. endm
  83136.  
  83137. ; byte_40372:
  83138. APM_EHZ: begin_animpat
  83139. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$0 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$4 ,0,0,2,0)
  83140. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$1 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$5 ,0,0,2,0)
  83141.  
  83142. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$8 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$C ,0,0,2,0)
  83143. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$9 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$D ,0,0,2,0)
  83144.  
  83145. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$10,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$14,0,0,2,0)
  83146. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$11,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$15,0,0,2,0)
  83147.  
  83148. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$2 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$6 ,0,0,2,0)
  83149. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$3 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$7 ,0,0,2,0)
  83150.  
  83151. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$A ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$E ,0,0,2,0)
  83152. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$B ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$F ,0,0,2,0)
  83153.  
  83154. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$12,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$16,0,0,2,0)
  83155. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$13,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$17,0,0,2,0)
  83156.  
  83157. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$18,0,0,3,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$1A,0,0,3,0)
  83158. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$19,0,0,3,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$1B,0,0,3,0)
  83159.  
  83160. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$1C,0,0,3,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$1E,0,0,3,0)
  83161. dc.w make_block_tile(ArtTile_ArtUnc_EHZMountains+$1D,0,0,3,0),make_block_tile(ArtTile_ArtUnc_EHZMountains+$1F,0,0,3,0)
  83162.  
  83163. dc.w make_block_tile(ArtTile_ArtUnc_EHZPulseBall+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZPulseBall+$0,1,0,2,0)
  83164. dc.w make_block_tile(ArtTile_ArtUnc_EHZPulseBall+$1,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZPulseBall+$1,1,0,2,0)
  83165.  
  83166. dc.w make_block_tile(ArtTile_ArtKos_Checkers+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZPulseBall+$0,0,0,2,0)
  83167. dc.w make_block_tile(ArtTile_ArtKos_Checkers+$1,0,0,2,0),make_block_tile(ArtTile_ArtUnc_EHZPulseBall+$1,0,0,2,0)
  83168.  
  83169. dc.w make_block_tile(ArtTile_ArtUnc_EHZPulseBall+$0,1,0,2,0),make_block_tile(ArtTile_ArtKos_Checkers+$0,1,0,2,0)
  83170. dc.w make_block_tile(ArtTile_ArtUnc_EHZPulseBall+$1,1,0,2,0),make_block_tile(ArtTile_ArtKos_Checkers+$1,1,0,2,0)
  83171.  
  83172. dc.w make_block_tile(ArtTile_ArtUnc_Flowers1+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_Flowers1+$0,1,0,3,0)
  83173. dc.w make_block_tile(ArtTile_ArtUnc_Flowers1+$1,0,0,3,0),make_block_tile(ArtTile_ArtUnc_Flowers1+$1,1,0,3,0)
  83174.  
  83175. dc.w make_block_tile(ArtTile_ArtUnc_Flowers2+$0,0,0,3,1),make_block_tile(ArtTile_ArtUnc_Flowers2+$0,1,0,3,1)
  83176. dc.w make_block_tile(ArtTile_ArtUnc_Flowers2+$1,0,0,3,1),make_block_tile(ArtTile_ArtUnc_Flowers2+$1,1,0,3,1)
  83177.  
  83178. dc.w make_block_tile(ArtTile_ArtUnc_Flowers3+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_Flowers3+$0,1,0,3,0)
  83179. dc.w make_block_tile(ArtTile_ArtUnc_Flowers3+$1,0,0,3,0),make_block_tile(ArtTile_ArtUnc_Flowers3+$1,1,0,3,0)
  83180.  
  83181. dc.w make_block_tile(ArtTile_ArtUnc_Flowers4+$0,0,0,3,1),make_block_tile(ArtTile_ArtUnc_Flowers4+$0,1,0,3,1)
  83182. dc.w make_block_tile(ArtTile_ArtUnc_Flowers4+$1,0,0,3,1),make_block_tile(ArtTile_ArtUnc_Flowers4+$1,1,0,3,1)
  83183. APM_EHZ_End:
  83184.  
  83185.  
  83186.  
  83187. ; byte_403EE:
  83188. APM_MTZ: begin_animpat
  83189. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$0,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$0,1,0,1,0)
  83190. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$1,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$1,1,0,1,0)
  83191.  
  83192. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$2,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$2,1,0,1,0)
  83193. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$3,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$3,1,0,1,0)
  83194.  
  83195. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$E,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$E,0,0,3,0)
  83196. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$F,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$F,0,0,3,0)
  83197.  
  83198. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$C,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$C,0,0,3,0)
  83199. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$D,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$D,0,0,3,0)
  83200.  
  83201. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$A,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$A,0,0,3,0)
  83202. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$B,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$B,0,0,3,0)
  83203.  
  83204. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$8,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$8,0,0,3,0)
  83205. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$9,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$9,0,0,3,0)
  83206.  
  83207. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$6,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$6,0,0,3,0)
  83208. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$7,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$7,0,0,3,0)
  83209.  
  83210. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$4,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$4,0,0,3,0)
  83211. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$5,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$5,0,0,3,0)
  83212.  
  83213. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$2,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$2,0,0,3,0)
  83214. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$3,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$3,0,0,3,0)
  83215.  
  83216. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$0,0,0,3,0)
  83217. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$1,0,0,3,0),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$1,0,0,3,0)
  83218.  
  83219. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$4,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$4,1,0,1,0)
  83220. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$5,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_1+$5,1,0,1,0)
  83221.  
  83222. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$0,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$0,1,0,1,0)
  83223. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$1,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$1,1,0,1,0)
  83224.  
  83225. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$2,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$2,1,0,1,0)
  83226. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$3,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$3,1,0,1,0)
  83227.  
  83228. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$4,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$4,1,0,1,0)
  83229. dc.w make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$5,0,0,1,0),make_block_tile(ArtTile_ArtUnc_MTZAnimBack_2+$5,1,0,1,0)
  83230.  
  83231. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,1),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,1)
  83232. dc.w make_block_tile(ArtTile_ArtUnc_Lava+$0 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Lava+$1 ,0,0,2,1)
  83233.  
  83234. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,1),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,1)
  83235. dc.w make_block_tile(ArtTile_ArtUnc_Lava+$2 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Lava+$3 ,0,0,2,1)
  83236.  
  83237. dc.w make_block_tile(ArtTile_ArtUnc_Lava+$4 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Lava+$5 ,0,0,2,1)
  83238. dc.w make_block_tile(ArtTile_ArtUnc_Lava+$8 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Lava+$9 ,0,0,2,1)
  83239.  
  83240. dc.w make_block_tile(ArtTile_ArtUnc_Lava+$6 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Lava+$7 ,0,0,2,1)
  83241. dc.w make_block_tile(ArtTile_ArtUnc_Lava+$A ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Lava+$B ,0,0,2,1)
  83242.  
  83243. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$E,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$E,0,0,3,1)
  83244. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$F,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$F,0,0,3,1)
  83245.  
  83246. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$C,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$C,0,0,3,1)
  83247. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$D,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$D,0,0,3,1)
  83248.  
  83249. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$A,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$A,0,0,3,1)
  83250. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$B,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$B,0,0,3,1)
  83251.  
  83252. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$8,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$8,0,0,3,1)
  83253. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$9,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$9,0,0,3,1)
  83254.  
  83255. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$6,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$6,0,0,3,1)
  83256. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$7,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$7,0,0,3,1)
  83257.  
  83258. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$4,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$4,0,0,3,1)
  83259. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$5,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$5,0,0,3,1)
  83260.  
  83261. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$2,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$2,0,0,3,1)
  83262. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$3,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$3,0,0,3,1)
  83263.  
  83264. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$0,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$0,0,0,3,1)
  83265. dc.w make_block_tile(ArtTile_ArtUnc_MTZCylinder+$1,0,0,3,1),make_block_tile(ArtTile_ArtUnc_MTZCylinder+$1,0,0,3,1)
  83266. APM_MTZ_End:
  83267.  
  83268.  
  83269.  
  83270. ; byte_404C2:
  83271. APM_HPZ: begin_animpat
  83272. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$1,0,0,3,0)
  83273. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$2,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$3,0,0,3,0)
  83274.  
  83275. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$4,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$5,0,0,3,0)
  83276. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$6,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$7,0,0,3,0)
  83277.  
  83278. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$1,0,0,3,0)
  83279. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$2,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$3,0,0,3,0)
  83280.  
  83281. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$4,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$5,0,0,3,0)
  83282. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$6,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$7,0,0,3,0)
  83283.  
  83284. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$1,0,0,3,0)
  83285. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$2,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$3,0,0,3,0)
  83286.  
  83287. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$4,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$5,0,0,3,0)
  83288. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$6,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$7,0,0,3,0)
  83289.  
  83290. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$1,0,0,2,0)
  83291. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$2,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$3,0,0,2,0)
  83292.  
  83293. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$4,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$5,0,0,2,0)
  83294. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$6,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$7,0,0,2,0)
  83295.  
  83296. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$1,0,0,2,0)
  83297. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$2,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$3,0,0,2,0)
  83298.  
  83299. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$4,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$5,0,0,2,0)
  83300. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$6,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$7,0,0,2,0)
  83301.  
  83302. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$1,0,0,2,0)
  83303. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$2,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$3,0,0,2,0)
  83304.  
  83305. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$4,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$5,0,0,2,0)
  83306. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$6,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$7,0,0,2,0)
  83307.  
  83308. if gameRevision<2
  83309. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$0,0,0,3,0)
  83310. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$2,0,0,3,0)
  83311. else
  83312. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$0,0,0,3,0)
  83313. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$2,0,0,3,0)
  83314. endif
  83315.  
  83316. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$1,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$4,0,0,3,0)
  83317. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$3,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$6,0,0,3,0)
  83318.  
  83319. if gameRevision<2
  83320. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$5,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83321. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$7,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83322.  
  83323. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$0,0,0,3,0)
  83324. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$2,0,0,3,0)
  83325. else
  83326. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$5,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0)
  83327. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$7,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0)
  83328.  
  83329. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$0,0,0,3,0)
  83330. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$2,0,0,3,0)
  83331. endif
  83332.  
  83333. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$1,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$4,0,0,3,0)
  83334. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$3,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$6,0,0,3,0)
  83335.  
  83336. if gameRevision<2
  83337. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$5,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83338. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$7,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83339.  
  83340. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$0,0,0,3,0)
  83341. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$2,0,0,3,0)
  83342. else
  83343. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$5,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0)
  83344. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$7,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0)
  83345.  
  83346. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$0,0,0,3,0)
  83347. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$2,0,0,3,0)
  83348. endif
  83349.  
  83350. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$1,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$4,0,0,3,0)
  83351. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$3,0,0,3,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$6,0,0,3,0)
  83352.  
  83353. if gameRevision<2
  83354. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$5,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83355. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$7,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83356.  
  83357. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$0,0,0,2,0)
  83358. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$2,0,0,2,0)
  83359. else
  83360. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$5,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0)
  83361. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$7,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,3,0)
  83362.  
  83363. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$0,0,0,2,0)
  83364. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$2,0,0,2,0)
  83365. endif
  83366.  
  83367. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$1,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$4,0,0,2,0)
  83368. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$3,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$6,0,0,2,0)
  83369.  
  83370. if gameRevision<2
  83371. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$5,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83372. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$7,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83373.  
  83374. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$0,0,0,2,0)
  83375. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$2,0,0,2,0)
  83376. else
  83377. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$5,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0)
  83378. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_1+$7,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0)
  83379.  
  83380. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$0,0,0,2,0)
  83381. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$2,0,0,2,0)
  83382. endif
  83383.  
  83384. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$1,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$4,0,0,2,0)
  83385. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$3,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$6,0,0,2,0)
  83386.  
  83387. if gameRevision<2
  83388. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$5,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83389. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$7,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83390.  
  83391. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$0,0,0,2,0)
  83392. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$2,0,0,2,0)
  83393. else
  83394. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$5,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0)
  83395. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_2+$7,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0)
  83396.  
  83397. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$0,0,0,2,0)
  83398. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$2,0,0,2,0)
  83399. endif
  83400.  
  83401. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$1,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$4,0,0,2,0)
  83402. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$3,0,0,2,0),make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$6,0,0,2,0)
  83403.  
  83404. if gameRevision<2
  83405. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$5,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83406. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$7,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83407. else
  83408. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$5,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0)
  83409. dc.w make_block_tile(ArtTile_ArtUnc_HPZPulseOrb_3+$7,0,0,2,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0)
  83410. endif
  83411. APM_HPZ_End:
  83412.  
  83413.  
  83414.  
  83415. ; byte_405B6:
  83416. APM_OOZ: begin_animpat
  83417. dc.w make_block_tile(ArtTile_ArtUnc_OOZPulseBall+$0,0,0,0,1),make_block_tile(ArtTile_ArtUnc_OOZPulseBall+$2,0,0,0,1)
  83418. dc.w make_block_tile(ArtTile_ArtUnc_OOZPulseBall+$1,0,0,0,1),make_block_tile(ArtTile_ArtUnc_OOZPulseBall+$3,0,0,0,1)
  83419.  
  83420. dc.w make_block_tile(ArtTile_ArtUnc_OOZSquareBall1+$0,0,0,3,1),make_block_tile(ArtTile_ArtUnc_OOZSquareBall1+$1,0,0,3,1)
  83421. dc.w make_block_tile(ArtTile_ArtUnc_OOZSquareBall1+$2,0,0,3,1),make_block_tile(ArtTile_ArtUnc_OOZSquareBall1+$3,0,0,3,1)
  83422.  
  83423. if gameRevision<2
  83424. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_OOZSquareBall2+$0,0,0,3,0)
  83425. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_OOZSquareBall2+$2,0,0,3,0)
  83426.  
  83427. dc.w make_block_tile(ArtTile_ArtUnc_OOZSquareBall2+$1,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83428. dc.w make_block_tile(ArtTile_ArtUnc_OOZSquareBall2+$3,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,0,0)
  83429. else
  83430. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_OOZSquareBall2+$0,0,0,3,0)
  83431. dc.w make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_OOZSquareBall2+$2,0,0,3,0)
  83432.  
  83433. dc.w make_block_tile(ArtTile_ArtUnc_OOZSquareBall2+$1,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0)
  83434. dc.w make_block_tile(ArtTile_ArtUnc_OOZSquareBall2+$3,0,0,3,0),make_block_tile(ArtTile_ArtKos_LevelArt+$0,0,0,2,0)
  83435. endif
  83436.  
  83437. dc.w make_block_tile(ArtTile_ArtUnc_Oil1+$0,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil1+$1,0,0,2,1)
  83438. dc.w make_block_tile(ArtTile_ArtUnc_Oil1+$8,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil1+$9,0,0,2,1)
  83439.  
  83440. dc.w make_block_tile(ArtTile_ArtUnc_Oil1+$2,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil1+$3,0,0,2,1)
  83441. dc.w make_block_tile(ArtTile_ArtUnc_Oil1+$A,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil1+$B,0,0,2,1)
  83442.  
  83443. dc.w make_block_tile(ArtTile_ArtUnc_Oil1+$4,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil1+$5,0,0,2,1)
  83444. dc.w make_block_tile(ArtTile_ArtUnc_Oil1+$C,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil1+$D,0,0,2,1)
  83445.  
  83446. dc.w make_block_tile(ArtTile_ArtUnc_Oil1+$6,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil1+$7,0,0,2,1)
  83447. dc.w make_block_tile(ArtTile_ArtUnc_Oil1+$E,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil1+$F,0,0,2,1)
  83448.  
  83449. dc.w make_block_tile(ArtTile_ArtUnc_Oil2+$0,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil2+$1,0,0,2,1)
  83450. dc.w make_block_tile(ArtTile_ArtUnc_Oil2+$8,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil2+$9,0,0,2,1)
  83451.  
  83452. dc.w make_block_tile(ArtTile_ArtUnc_Oil2+$2,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil2+$3,0,0,2,1)
  83453. dc.w make_block_tile(ArtTile_ArtUnc_Oil2+$A,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil2+$B,0,0,2,1)
  83454.  
  83455. dc.w make_block_tile(ArtTile_ArtUnc_Oil2+$4,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil2+$5,0,0,2,1)
  83456. dc.w make_block_tile(ArtTile_ArtUnc_Oil2+$C,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil2+$D,0,0,2,1)
  83457.  
  83458. dc.w make_block_tile(ArtTile_ArtUnc_Oil2+$6,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil2+$7,0,0,2,1)
  83459. dc.w make_block_tile(ArtTile_ArtUnc_Oil2+$E,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Oil2+$F,0,0,2,1)
  83460. APM_OOZ_End:
  83461.  
  83462.  
  83463.  
  83464. ; byte_4061A:
  83465. APM_CNZ: begin_animpat
  83466. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$4,0,0,0,0)
  83467. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$1,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$5,0,0,0,0)
  83468.  
  83469. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$8,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$C,0,0,0,0)
  83470. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$9,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$D,0,0,0,0)
  83471.  
  83472. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$2,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$6,0,0,0,0)
  83473. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$3,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$7,0,0,0,0)
  83474.  
  83475. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$A,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$E,0,0,0,0)
  83476. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$B,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1+$F,0,0,0,0)
  83477.  
  83478. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$4,0,0,0,0)
  83479. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$1,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$5,0,0,0,0)
  83480.  
  83481. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$8,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$C,0,0,0,0)
  83482. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$9,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$D,0,0,0,0)
  83483.  
  83484. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$2,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$6,0,0,0,0)
  83485. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$3,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$7,0,0,0,0)
  83486.  
  83487. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$A,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$E,0,0,0,0)
  83488. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$B,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2+$F,0,0,0,0)
  83489.  
  83490. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$4,0,0,0,0)
  83491. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$1,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$5,0,0,0,0)
  83492.  
  83493. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$8,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$C,0,0,0,0)
  83494. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$9,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$D,0,0,0,0)
  83495.  
  83496. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$2,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$6,0,0,0,0)
  83497. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$3,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$7,0,0,0,0)
  83498.  
  83499. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$A,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$E,0,0,0,0)
  83500. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$B,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3+$F,0,0,0,0)
  83501.  
  83502. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$0,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$4,0,0,3,1)
  83503. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$1,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$5,0,0,3,1)
  83504.  
  83505. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$8,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$C,0,0,3,1)
  83506. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$9,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$D,0,0,3,1)
  83507.  
  83508. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$2,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$6,0,0,3,1)
  83509. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$3,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$7,0,0,3,1)
  83510.  
  83511. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$A,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$E,0,0,3,1)
  83512. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$B,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2+$F,0,0,3,1)
  83513.  
  83514. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$0,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$4,0,0,3,1)
  83515. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$1,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$5,0,0,3,1)
  83516.  
  83517. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$8,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$C,0,0,3,1)
  83518. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$9,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$D,0,0,3,1)
  83519.  
  83520. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$2,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$6,0,0,3,1)
  83521. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$3,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$7,0,0,3,1)
  83522.  
  83523. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$A,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$E,0,0,3,1)
  83524. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$B,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1+$F,0,0,3,1)
  83525. APM_CNZ_End:
  83526.  
  83527.  
  83528.  
  83529. ; byte_406BE:
  83530. APM_CNZ2P: begin_animpat
  83531. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$4,0,0,0,0)
  83532. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$1,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$5,0,0,0,0)
  83533.  
  83534. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$8,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$C,0,0,0,0)
  83535. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$9,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$D,0,0,0,0)
  83536.  
  83537. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$2,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$6,0,0,0,0)
  83538. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$3,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$7,0,0,0,0)
  83539.  
  83540. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$A,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$E,0,0,0,0)
  83541. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$B,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_1_2p+$F,0,0,0,0)
  83542.  
  83543. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$4,0,0,0,0)
  83544. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$1,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$5,0,0,0,0)
  83545.  
  83546. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$8,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$C,0,0,0,0)
  83547. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$9,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$D,0,0,0,0)
  83548.  
  83549. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$2,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$6,0,0,0,0)
  83550. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$3,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$7,0,0,0,0)
  83551.  
  83552. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$A,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$E,0,0,0,0)
  83553. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$B,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_2_2p+$F,0,0,0,0)
  83554.  
  83555. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$0,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$4,0,0,0,0)
  83556. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$1,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$5,0,0,0,0)
  83557.  
  83558. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$8,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$C,0,0,0,0)
  83559. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$9,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$D,0,0,0,0)
  83560.  
  83561. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$2,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$6,0,0,0,0)
  83562. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$3,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$7,0,0,0,0)
  83563.  
  83564. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$A,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$E,0,0,0,0)
  83565. dc.w make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$B,0,0,0,0),make_block_tile(ArtTile_ArtUnc_CNZSlotPics_3_2p+$F,0,0,0,0)
  83566.  
  83567. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$0,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$4,0,0,3,1)
  83568. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$1,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$5,0,0,3,1)
  83569.  
  83570. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$8,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$C,0,0,3,1)
  83571. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$9,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$D,0,0,3,1)
  83572.  
  83573. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$2,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$6,0,0,3,1)
  83574. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$3,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$7,0,0,3,1)
  83575.  
  83576. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$A,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$E,0,0,3,1)
  83577. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$B,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_2_2p+$F,0,0,3,1)
  83578.  
  83579. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$0,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$4,0,0,3,1)
  83580. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$1,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$5,0,0,3,1)
  83581.  
  83582. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$8,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$C,0,0,3,1)
  83583. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$9,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$D,0,0,3,1)
  83584.  
  83585. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$2,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$6,0,0,3,1)
  83586. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$3,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$7,0,0,3,1)
  83587.  
  83588. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$A,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$E,0,0,3,1)
  83589. dc.w make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$B,0,0,3,1),make_block_tile(ArtTile_ArtUnc_CNZFlipTiles_1_2p+$F,0,0,3,1)
  83590. APM_CNZ2P_End:
  83591.  
  83592.  
  83593.  
  83594. ; byte_40762:
  83595. APM_CPZ: begin_animpat
  83596. dc.w make_block_tile(ArtTile_ArtUnc_CPZAnimBack+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_CPZAnimBack+$1,0,0,2,0)
  83597. dc.w make_block_tile(ArtTile_ArtUnc_CPZAnimBack+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_CPZAnimBack+$1,0,0,2,0)
  83598. APM_CPZ_End:
  83599.  
  83600.  
  83601.  
  83602. ; byte_4076E:
  83603. APM_DEZ: begin_animpat
  83604. dc.w make_block_tile(ArtTile_ArtUnc_DEZAnimBack+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_DEZAnimBack+$1,0,0,2,0)
  83605. dc.w make_block_tile(ArtTile_ArtUnc_DEZAnimBack+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_DEZAnimBack+$1,0,0,2,0)
  83606. APM_DEZ_End:
  83607.  
  83608.  
  83609.  
  83610. ; byte_4077A:
  83611. APM_ARZ: begin_animpat
  83612. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall3+$0 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall3+$1 ,0,0,2,1)
  83613. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall3+$2 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall3+$3 ,0,0,2,1)
  83614.  
  83615. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall2+$0 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall2+$1 ,0,0,2,1)
  83616. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall2+$2 ,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall2+$3 ,0,0,2,1)
  83617.  
  83618. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_1+$0,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall1_1+$1,0,0,2,1)
  83619. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_1+$2,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall1_1+$3,0,0,2,1)
  83620.  
  83621. ;These are invalid animation entries for waterfalls (bug in original game):
  83622. if 1==1
  83623. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$C,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$D,0,0,2,1)
  83624. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$E,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$F,0,0,2,1)
  83625. else
  83626. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$0,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$1,0,0,2,1)
  83627. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$2,0,0,2,1),make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$3,0,0,2,1)
  83628. endif
  83629.  
  83630. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall3+$0 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall3+$1 ,0,0,2,0)
  83631. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall3+$2 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall3+$3 ,0,0,2,0)
  83632.  
  83633. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall2+$0 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall2+$1 ,0,0,2,0)
  83634. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall2+$2 ,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall2+$3 ,0,0,2,0)
  83635.  
  83636. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_1+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall1_1+$1,0,0,2,0)
  83637. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_1+$2,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall1_1+$3,0,0,2,0)
  83638.  
  83639. ;These are invalid animation entries for waterfalls (bug in original game):
  83640. if 1==1
  83641. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$C,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$D,0,0,2,0)
  83642. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$E,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$F,0,0,2,0)
  83643. else
  83644. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$0,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$1,0,0,2,0)
  83645. dc.w make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$2,0,0,2,0),make_block_tile(ArtTile_ArtUnc_Waterfall1_2+$3,0,0,2,0)
  83646. endif
  83647. APM_ARZ_End:
  83648.  
  83649.  
  83650.  
  83651. ; byte_407BE:
  83652. APM_Null: dc.w 0
  83653. ; ===========================================================================
  83654. ; loc_407C0:
  83655. PatchHTZTiles:
  83656. lea (ArtNem_HTZCliffs).l,a0
  83657. lea (Object_RAM+$800).w,a4
  83658. jsrto (NemDecToRAM).l, JmpTo2_NemDecToRAM
  83659. lea (Object_RAM+$800).w,a1
  83660. lea_ word_3FD9C,a4
  83661. moveq #0,d2
  83662. moveq #7,d4
  83663.  
  83664. loc_407DA:
  83665. moveq #5,d3
  83666.  
  83667. loc_407DC:
  83668. moveq #-1,d0
  83669. move.w (a4)+,d0
  83670. movea.l d0,a2
  83671. moveq #$1F,d1
  83672.  
  83673. loc_407E4:
  83674. move.l (a1),(a2)+
  83675. move.l d2,(a1)+
  83676. dbf d1,loc_407E4
  83677. dbf d3,loc_407DC
  83678. adda.w #$C,a4
  83679. dbf d4,loc_407DA
  83680. rts
  83681. ; ===========================================================================
  83682.  
  83683. if gameRevision<2
  83684. nop
  83685. endif
  83686.  
  83687. if ~~removeJmpTos
  83688. JmpTo2_NemDecToRAM
  83689. jmp (NemDecToRAM).l
  83690.  
  83691. align 4
  83692. endif
  83693.  
  83694.  
  83695.  
  83696.  
  83697. ; ---------------------------------------------------------------------------
  83698. ; Subroutine to draw the HUD
  83699. ; ---------------------------------------------------------------------------
  83700.  
  83701. hud_letter_num_tiles = 2
  83702. hud_letter_vdp_delta = vdpCommDelta(tiles_to_bytes(hud_letter_num_tiles))
  83703.  
  83704. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  83705.  
  83706. ; loc_40804:
  83707. BuildHUD:
  83708. tst.w (Ring_count).w
  83709. beq.s ++ ; blink ring count if it's 0
  83710. moveq #0,d1
  83711. btst #3,(Timer_frames+1).w
  83712. bne.s + ; only blink on certain frames
  83713. cmpi.b #9,(Timer_minute).w ; should the minutes counter blink?
  83714. bne.s + ; if not, branch
  83715. addq.w #2,d1 ; set mapping frame time counter blink
  83716. +
  83717. bra.s ++
  83718. +
  83719. moveq #0,d1
  83720. btst #3,(Timer_frames+1).w
  83721. bne.s + ; only blink on certain frames
  83722. addq.w #1,d1 ; set mapping frame for ring count blink
  83723. cmpi.b #9,(Timer_minute).w
  83724. bne.s +
  83725. addq.w #2,d1 ; set mapping frame for double blink
  83726. +
  83727. move.w #128+16,d3 ; set X pos
  83728. move.w #128+136,d2 ; set Y pos
  83729. lea (HUD_MapUnc_40A9A).l,a1
  83730. movea.w #make_art_tile(ArtTile_ArtNem_HUD,0,1),a3 ; set art tile and flags
  83731. add.w d1,d1
  83732. adda.w (a1,d1.w),a1
  83733. move.w (a1)+,d1
  83734. subq.w #1,d1
  83735. bmi.s +
  83736. jsrto (DrawSprite_Loop).l, JmpTo_DrawSprite_Loop ; draw frame
  83737. +
  83738. rts
  83739. ; End of function BuildHUD
  83740.  
  83741. ; ===========================================================================
  83742.  
  83743. BuildHUD_P1:
  83744. tst.w (Ring_count).w
  83745. beq.s BuildHUD_P1_NoRings
  83746. moveq #0,d1
  83747. btst #3,(Timer_frames+1).w
  83748. bne.s +
  83749. cmpi.b #9,(Timer_minute).w
  83750. bne.s +
  83751. addq.w #2,d1 ; make TIME flash
  83752. +
  83753. bra.s BuildHUD_P1_Continued
  83754. ; ===========================================================================
  83755. ; loc_40876:
  83756. BuildHUD_P1_NoRings:
  83757. moveq #0,d1
  83758. btst #3,(Timer_frames+1).w
  83759. bne.s BuildHUD_P1_Continued
  83760. addq.w #1,d1 ; make RINGS flash
  83761. cmpi.b #9,(Timer_minute).w
  83762. bne.s BuildHUD_P1_Continued
  83763. addq.w #2,d1 ; make TIME flash
  83764. ; loc_4088C:
  83765. BuildHUD_P1_Continued:
  83766. move.w #$90,d3
  83767. move.w #$188,d2
  83768. lea (HUD_MapUnc_40BEA).l,a1
  83769. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Text_2P,0,1),a3
  83770. add.w d1,d1
  83771. adda.w (a1,d1.w),a1
  83772. move.w (a1)+,d1
  83773. subq.w #1,d1
  83774. jsrto (DrawSprite_2P_Loop).l, JmpTo_DrawSprite_2P_Loop
  83775. move.w #$B8,d3
  83776. move.w #$108,d2
  83777. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Numbers_2P,0,1),a3
  83778. moveq #0,d7
  83779. move.b (Timer_minute).w,d7
  83780. bsr.w sub_4092E
  83781. bsr.w sub_4096A
  83782. moveq #0,d7
  83783. move.b (Timer_second).w,d7
  83784. bsr.w loc_40938
  83785. move.w #$C0,d3
  83786. move.w #$118,d2
  83787. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Numbers_2P,0,1),a3
  83788. moveq #0,d7
  83789. move.w (Ring_count).w,d7
  83790. bsr.w sub_40984
  83791. tst.b (Update_HUD_timer_2P).w
  83792. bne.s +
  83793. tst.b (Update_HUD_timer).w
  83794. beq.s +
  83795. move.w #$110,d3
  83796. move.w #$1B8,d2
  83797. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Numbers_2P,0,1),a3
  83798. moveq #0,d7
  83799. move.b (Loser_Time_Left).w,d7
  83800. bsr.w loc_40938
  83801. +
  83802. moveq #4,d1
  83803. move.w #$90,d3
  83804. move.w #$188,d2
  83805. lea (HUD_MapUnc_40BEA).l,a1
  83806. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Text_2P,0,1),a3
  83807. add.w d1,d1
  83808. adda.w (a1,d1.w),a1
  83809. move.w (a1)+,d1
  83810. subq.w #1,d1
  83811. jsrto (DrawSprite_2P_Loop).l, JmpTo_DrawSprite_2P_Loop
  83812. moveq #0,d4
  83813. rts
  83814.  
  83815. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  83816.  
  83817.  
  83818. sub_4092E:
  83819.  
  83820. lea (Hud_1).l,a4
  83821. moveq #0,d6
  83822. bra.s loc_40940
  83823. ; ===========================================================================
  83824.  
  83825. loc_40938:
  83826.  
  83827. lea (Hud_10).l,a4
  83828. moveq #1,d6
  83829.  
  83830. loc_40940:
  83831.  
  83832. moveq #0,d1
  83833. move.l (a4)+,d4
  83834.  
  83835. loc_40944:
  83836. sub.l d4,d7
  83837. bcs.s loc_4094C
  83838. addq.w #1,d1
  83839. bra.s loc_40944
  83840. ; ===========================================================================
  83841.  
  83842. loc_4094C:
  83843. add.l d4,d7
  83844. lea (HUD_MapUnc_40C82).l,a1
  83845. add.w d1,d1
  83846. adda.w (a1,d1.w),a1
  83847. move.w (a1)+,d1
  83848. subq.w #1,d1
  83849. jsrto (DrawSprite_2P_Loop).l, JmpTo_DrawSprite_2P_Loop
  83850. addq.w #8,d3
  83851. dbf d6,loc_40940
  83852. rts
  83853. ; End of function sub_4092E
  83854.  
  83855.  
  83856. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  83857.  
  83858.  
  83859. sub_4096A:
  83860.  
  83861. moveq #$A,d1
  83862. lea (HUD_MapUnc_40C82).l,a1
  83863. add.w d1,d1
  83864. adda.w (a1,d1.w),a1
  83865. move.w (a1)+,d1
  83866. subq.w #1,d1
  83867. jsrto (DrawSprite_2P_Loop).l, JmpTo_DrawSprite_2P_Loop
  83868. addq.w #8,d3
  83869. rts
  83870. ; End of function sub_4096A
  83871.  
  83872.  
  83873. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  83874.  
  83875.  
  83876. sub_40984:
  83877.  
  83878. lea (Hud_100).l,a4
  83879. moveq #2,d6
  83880.  
  83881. loc_4098C:
  83882. moveq #0,d1
  83883. move.l (a4)+,d4
  83884.  
  83885. loc_40990:
  83886. sub.l d4,d7
  83887. bcs.s loc_40998
  83888. addq.w #1,d1
  83889. bra.s loc_40990
  83890. ; ===========================================================================
  83891.  
  83892. loc_40998:
  83893. add.l d4,d7
  83894. tst.w d6
  83895. beq.s loc_409AA
  83896. tst.w d1
  83897. beq.s loc_409A6
  83898. bset #$1F,d6
  83899.  
  83900. loc_409A6:
  83901. tst.l d6
  83902. bpl.s loc_409BE
  83903.  
  83904. loc_409AA:
  83905. lea (HUD_MapUnc_40C82).l,a1
  83906. add.w d1,d1
  83907. adda.w (a1,d1.w),a1
  83908. move.w (a1)+,d1
  83909. subq.w #1,d1
  83910. jsrto (DrawSprite_2P_Loop).l, JmpTo_DrawSprite_2P_Loop
  83911.  
  83912. loc_409BE:
  83913. addq.w #8,d3
  83914. dbf d6,loc_4098C
  83915. rts
  83916. ; End of function sub_40984
  83917.  
  83918. ; ===========================================================================
  83919.  
  83920. BuildHUD_P2:
  83921. tst.w (Ring_count_2P).w
  83922. beq.s BuildHUD_P2_NoRings
  83923. moveq #0,d1
  83924. btst #3,(Timer_frames+1).w
  83925. bne.s +
  83926. cmpi.b #9,(Timer_minute_2P).w
  83927. bne.s +
  83928. addq.w #2,d1
  83929. +
  83930. bra.s BuildHUD_P2_Continued
  83931. ; ===========================================================================
  83932. ; loc_409E2:
  83933. BuildHUD_P2_NoRings:
  83934. moveq #0,d1
  83935. btst #3,(Timer_frames+1).w
  83936. bne.s BuildHUD_P2_Continued
  83937. addq.w #1,d1
  83938. cmpi.b #9,(Timer_minute_2P).w
  83939. bne.s BuildHUD_P2_Continued
  83940. addq.w #2,d1
  83941. ; loc_409F8:
  83942. BuildHUD_P2_Continued:
  83943. move.w #$90,d3
  83944. move.w #$268,d2
  83945. lea (HUD_MapUnc_40BEA).l,a1
  83946. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Text_2P,0,1),a3
  83947. add.w d1,d1
  83948. adda.w (a1,d1.w),a1
  83949. move.w (a1)+,d1
  83950. subq.w #1,d1
  83951. jsrto (DrawSprite_2P_Loop).l, JmpTo_DrawSprite_2P_Loop
  83952. move.w #$B8,d3
  83953. move.w #$1E8,d2
  83954. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Numbers_2P,0,1),a3
  83955. moveq #0,d7
  83956. move.b (Timer_minute_2P).w,d7
  83957. bsr.w sub_4092E
  83958. bsr.w sub_4096A
  83959. moveq #0,d7
  83960. move.b (Timer_second_2P).w,d7
  83961. bsr.w loc_40938
  83962. move.w #$C0,d3
  83963. move.w #$1F8,d2
  83964. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Numbers_2P,0,1),a3
  83965. moveq #0,d7
  83966. move.w (Ring_count_2P).w,d7
  83967. bsr.w sub_40984
  83968. tst.b (Update_HUD_timer).w
  83969. bne.s +
  83970. tst.b (Update_HUD_timer_2P).w
  83971. beq.s +
  83972. move.w #$110,d3
  83973. move.w #$298,d2
  83974. movea.w #make_art_tile_2p(ArtTile_Art_HUD_Numbers_2P,0,1),a3
  83975. moveq #0,d7
  83976. move.b (Loser_Time_Left).w,d7
  83977. bsr.w loc_40938
  83978. +
  83979. moveq #5,d1
  83980. move.w #$90,d3
  83981. move.w #$268,d2
  83982. lea (HUD_MapUnc_40BEA).l,a1
  83983. movea.w #make_art_tile_2p(ArtTile_ArtNem_Powerups,0,1),a3
  83984. add.w d1,d1
  83985. adda.w (a1,d1.w),a1
  83986. move.w (a1)+,d1
  83987. subq.w #1,d1
  83988. jsrto (DrawSprite_2P_Loop).l, JmpTo_DrawSprite_2P_Loop
  83989. moveq #0,d4
  83990. rts
  83991. ; ===========================================================================
  83992.  
  83993. ; sprite mappings for the HUD
  83994. ; uses the art in VRAM from $D940 - $FC00
  83995. HUD_MapUnc_40A9A: BINCLUDE "mappings/sprite/hud_a.bin"
  83996.  
  83997.  
  83998. HUD_MapUnc_40BEA: BINCLUDE "mappings/sprite/hud_b.bin"
  83999.  
  84000.  
  84001. HUD_MapUnc_40C82: BINCLUDE "mappings/sprite/hud_c.bin"
  84002.  
  84003. ; ---------------------------------------------------------------------------
  84004. ; Add points subroutine
  84005. ; subroutine to add to Player 1's score
  84006. ; ---------------------------------------------------------------------------
  84007.  
  84008. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84009.  
  84010. ; sub_40D06:
  84011. AddPoints:
  84012. move.b #1,(Update_HUD_score).w
  84013. lea (Score).w,a3
  84014. add.l d0,(a3) ; add d0*10 to the score
  84015. move.l #999999,d1
  84016. cmp.l (a3),d1 ; is #999999 higher than the score?
  84017. bhi.s + ; if yes, branch
  84018. move.l d1,(a3) ; set score to #999999
  84019. +
  84020. move.l (a3),d0
  84021. cmp.l (Next_Extra_life_score).w,d0
  84022. blo.s + ; rts
  84023. addi.l #5000,(Next_Extra_life_score).w
  84024. addq.b #1,(Life_count).w
  84025. addq.b #1,(Update_HUD_lives).w
  84026. move.w #MusID_ExtraLife,d0
  84027. jmp (PlayMusic).l
  84028. ; ===========================================================================
  84029. + rts
  84030. ; End of function AddPoints
  84031.  
  84032.  
  84033. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84034.  
  84035. ; ---------------------------------------------------------------------------
  84036. ; Add points subroutine
  84037. ; subroutine to add to Player 2's score
  84038. ; (goes to AddPoints to add to Player 1's score instead if this is not Player 2)
  84039. ; ---------------------------------------------------------------------------
  84040.  
  84041. ; sub_40D42:
  84042. AddPoints2:
  84043. tst.w (Two_player_mode).w
  84044. beq.s AddPoints
  84045. cmpa.w #MainCharacter,a3
  84046. beq.s AddPoints
  84047. move.b #1,(Update_HUD_score_2P).w
  84048. lea (Score_2P).w,a3
  84049. add.l d0,(a3) ; add d0*10 to the score
  84050. move.l #999999,d1
  84051. cmp.l (a3),d1 ; is #999999 higher than the score?
  84052. bhi.s + ; if yes, branch
  84053. move.l d1,(a3) ; set score to #999999
  84054. +
  84055. move.l (a3),d0
  84056. cmp.l (Next_Extra_life_score_2P).w,d0
  84057. blo.s + ; rts
  84058. addi.l #5000,(Next_Extra_life_score_2P).w
  84059. addq.b #1,(Life_count_2P).w
  84060. addq.b #1,(Update_HUD_lives_2P).w
  84061. move.w #MusID_ExtraLife,d0
  84062. jmp (PlayMusic).l
  84063. ; ===========================================================================
  84064. + rts
  84065. ; End of function AddPoints2
  84066.  
  84067. ; ---------------------------------------------------------------------------
  84068. ; Subroutine to update the HUD
  84069. ; ---------------------------------------------------------------------------
  84070.  
  84071. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84072.  
  84073. ; sub_40D8A:
  84074. HudUpdate:
  84075. nop
  84076. lea (VDP_data_port).l,a6
  84077. tst.w (Two_player_mode).w
  84078. bne.w loc_40F50
  84079. tst.w (Debug_mode_flag).w ; is debug mode on?
  84080. bne.w loc_40E9A ; if yes, branch
  84081. tst.b (Update_HUD_score).w ; does the score need updating?
  84082. beq.s Hud_ChkRings ; if not, branch
  84083. clr.b (Update_HUD_score).w
  84084. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Score),VRAM,WRITE),d0 ; set VRAM address
  84085. move.l (Score).w,d1 ; load score
  84086. bsr.w Hud_Score
  84087. ; loc_40DBA:
  84088. Hud_ChkRings:
  84089. tst.b (Update_HUD_rings).w ; does the ring counter need updating?
  84090. beq.s Hud_ChkTime ; if not, branch
  84091. bpl.s loc_40DC6
  84092. bsr.w Hud_InitRings
  84093.  
  84094. loc_40DC6:
  84095. clr.b (Update_HUD_rings).w
  84096. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Rings),VRAM,WRITE),d0
  84097. moveq #0,d1
  84098. move.w (Ring_count).w,d1
  84099. bsr.w Hud_Rings
  84100. ; loc_40DDA:
  84101. Hud_ChkTime:
  84102. tst.b (Update_HUD_timer).w ; does the time need updating?
  84103. beq.s Hud_ChkLives ; if not, branch
  84104. tst.w (Game_paused).w ; is the game paused?
  84105. bne.s Hud_ChkLives ; if yes, branch
  84106. lea (Timer).w,a1
  84107. cmpi.l #$93B3B,(a1)+ ; is the time 9.59?
  84108. beq.w loc_40E84 ; if yes, branch
  84109. addq.b #1,-(a1)
  84110. cmpi.b #60,(a1)
  84111. blo.s Hud_ChkLives
  84112. move.b #0,(a1)
  84113. addq.b #1,-(a1)
  84114. cmpi.b #60,(a1)
  84115. blo.s +
  84116. move.b #0,(a1)
  84117. addq.b #1,-(a1)
  84118. cmpi.b #9,(a1)
  84119. blo.s +
  84120. move.b #9,(a1)
  84121. +
  84122. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Minutes),VRAM,WRITE),d0
  84123. moveq #0,d1
  84124. move.b (Timer_minute).w,d1
  84125. bsr.w Hud_Mins
  84126. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Seconds),VRAM,WRITE),d0
  84127. moveq #0,d1
  84128. move.b (Timer_second).w,d1
  84129. bsr.w Hud_Secs
  84130. ; loc_40E38:
  84131. Hud_ChkLives:
  84132. tst.b (Update_HUD_lives).w ; does the lives counter need updating?
  84133. beq.s Hud_ChkBonus ; if not, branch
  84134. clr.b (Update_HUD_lives).w
  84135. bsr.w Hud_Lives
  84136. ; loc_40E46:
  84137. Hud_ChkBonus:
  84138. tst.b (Update_Bonus_score).w ; do time/ring bonus counters need updating?
  84139. beq.s Hud_End ; if not, branch
  84140. clr.b (Update_Bonus_score).w
  84141. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Bonus_Score),VRAM,WRITE),(VDP_control_port).l
  84142. moveq #0,d1
  84143. move.w (Total_Bonus_Countdown).w,d1
  84144. bsr.w Hud_TimeRingBonus
  84145. moveq #0,d1
  84146. move.w (Bonus_Countdown_1).w,d1 ; load time bonus
  84147. bsr.w Hud_TimeRingBonus
  84148. moveq #0,d1
  84149. move.w (Bonus_Countdown_2).w,d1 ; load ring bonus
  84150. bsr.w Hud_TimeRingBonus
  84151. moveq #0,d1
  84152. move.w (Bonus_Countdown_3).w,d1 ; load perfect bonus
  84153. bsr.w Hud_TimeRingBonus
  84154. ; return_40E82:
  84155. Hud_End:
  84156. rts
  84157. ; ===========================================================================
  84158.  
  84159. loc_40E84:
  84160. clr.b (Update_HUD_timer).w
  84161. lea (MainCharacter).w,a0 ; a0=character
  84162. movea.l a0,a2
  84163. bsr.w KillCharacter
  84164. move.b #1,(Time_Over_flag).w
  84165. rts
  84166. ; ===========================================================================
  84167.  
  84168. loc_40E9A:
  84169. bsr.w HudDb_XY
  84170. tst.b (Update_HUD_rings).w
  84171. beq.s loc_40EBE
  84172. bpl.s loc_40EAA
  84173. bsr.w Hud_InitRings
  84174.  
  84175. loc_40EAA:
  84176. clr.b (Update_HUD_rings).w
  84177. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Rings),VRAM,WRITE),d0
  84178.  
  84179. moveq #0,d1
  84180. move.w (Ring_count).w,d1
  84181. bsr.w Hud_Rings
  84182.  
  84183. loc_40EBE:
  84184. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Seconds),VRAM,WRITE),d0
  84185. moveq #0,d1
  84186. move.b (Sprite_count).w,d1
  84187. bsr.w Hud_Secs
  84188. tst.b (Update_HUD_lives).w
  84189. beq.s loc_40EDC
  84190. clr.b (Update_HUD_lives).w
  84191. bsr.w Hud_Lives
  84192.  
  84193. loc_40EDC:
  84194. tst.b (Update_Bonus_score).w
  84195. beq.s loc_40F18
  84196. clr.b (Update_Bonus_score).w
  84197. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Bonus_Score),VRAM,WRITE),(VDP_control_port).l
  84198. moveq #0,d1
  84199. move.w (Total_Bonus_Countdown).w,d1
  84200. bsr.w Hud_TimeRingBonus
  84201. moveq #0,d1
  84202. move.w (Bonus_Countdown_1).w,d1
  84203. bsr.w Hud_TimeRingBonus
  84204. moveq #0,d1
  84205. move.w (Bonus_Countdown_2).w,d1
  84206. bsr.w Hud_TimeRingBonus
  84207. moveq #0,d1
  84208. move.w (Bonus_Countdown_3).w,d1
  84209. bsr.w Hud_TimeRingBonus
  84210.  
  84211. loc_40F18:
  84212. tst.w (Game_paused).w
  84213. bne.s return_40F4E
  84214. lea (Timer).w,a1
  84215. cmpi.l #$93B3B,(a1)+
  84216. nop
  84217. addq.b #1,-(a1)
  84218. cmpi.b #$3C,(a1)
  84219. blo.s return_40F4E
  84220. move.b #0,(a1)
  84221. addq.b #1,-(a1)
  84222. cmpi.b #$3C,(a1)
  84223. blo.s return_40F4E
  84224. move.b #0,(a1)
  84225. addq.b #1,-(a1)
  84226. cmpi.b #9,(a1)
  84227. blo.s return_40F4E
  84228. move.b #9,(a1)
  84229.  
  84230. return_40F4E:
  84231. rts
  84232. ; ===========================================================================
  84233.  
  84234. loc_40F50:
  84235. tst.w (Game_paused).w
  84236. bne.w return_4101A
  84237. tst.b (Update_HUD_timer).w
  84238. beq.s loc_40F90
  84239. lea (Timer).w,a1
  84240. cmpi.l #$93B3B,(a1)+
  84241. beq.w TimeOver
  84242. addq.b #1,-(a1)
  84243. cmpi.b #$3C,(a1)
  84244. blo.s loc_40F90
  84245. move.b #0,(a1)
  84246. addq.b #1,-(a1)
  84247. cmpi.b #$3C,(a1)
  84248. blo.s loc_40F90
  84249. move.b #0,(a1)
  84250. addq.b #1,-(a1)
  84251. cmpi.b #9,(a1)
  84252. blo.s loc_40F90
  84253. move.b #9,(a1)
  84254.  
  84255. loc_40F90:
  84256. tst.b (Update_HUD_timer_2P).w
  84257. beq.s loc_40FC8
  84258. lea (Timer_2P).w,a1
  84259. cmpi.l #$93B3B,(a1)+
  84260. beq.w TimeOver2
  84261. addq.b #1,-(a1)
  84262. cmpi.b #$3C,(a1)
  84263. blo.s loc_40FC8
  84264. move.b #0,(a1)
  84265. addq.b #1,-(a1)
  84266. cmpi.b #$3C,(a1)
  84267. blo.s loc_40FC8
  84268. move.b #0,(a1)
  84269. addq.b #1,-(a1)
  84270. cmpi.b #9,(a1)
  84271. blo.s loc_40FC8
  84272. move.b #9,(a1)
  84273.  
  84274. loc_40FC8:
  84275. tst.b (Update_HUD_lives).w
  84276. beq.s loc_40FD6
  84277. clr.b (Update_HUD_lives).w
  84278. bsr.w Hud_Lives
  84279.  
  84280. loc_40FD6:
  84281. tst.b (Update_HUD_lives_2P).w
  84282. beq.s loc_40FE4
  84283. clr.b (Update_HUD_lives_2P).w
  84284. bsr.w Hud_Lives2
  84285.  
  84286. loc_40FE4:
  84287. move.b (Update_HUD_timer).w,d0
  84288. or.b (Update_HUD_timer_2P).w,d0
  84289. beq.s return_4101A
  84290. lea (Loser_Time_Left).w,a1
  84291. tst.w (a1)+
  84292. beq.s return_4101A
  84293. subq.b #1,-(a1)
  84294. bhi.s return_4101A
  84295. move.b #$3C,(a1)
  84296. cmpi.b #$C,-1(a1)
  84297. bne.s loc_41010
  84298. move.w #MusID_Countdown,d0
  84299. jsr (PlayMusic).l
  84300.  
  84301. loc_41010:
  84302. subq.b #1,-(a1)
  84303. bcc.s return_4101A
  84304. move.w #0,(a1)
  84305. bsr.s TimeOver0
  84306.  
  84307. return_4101A:
  84308.  
  84309. rts
  84310. ; End of function HudUpdate
  84311.  
  84312.  
  84313. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84314.  
  84315. ; sub_4101C:
  84316. TimeOver0:
  84317. tst.b (Update_HUD_timer).w
  84318. bne.s TimeOver
  84319. tst.b (Update_HUD_timer_2P).w
  84320. bne.s TimeOver2
  84321. rts
  84322. ; ===========================================================================
  84323. ; loc_4102A:
  84324. TimeOver:
  84325. clr.b (Update_HUD_timer).w
  84326. lea (MainCharacter).w,a0 ; a0=character
  84327. movea.l a0,a2
  84328. bsr.w KillCharacter
  84329. move.b #1,(Time_Over_flag).w
  84330. tst.b (Update_HUD_timer_2P).w
  84331. beq.s + ; rts
  84332. ; loc_41044:
  84333. TimeOver2:
  84334. clr.b (Update_HUD_timer_2P).w
  84335. lea (Sidekick).w,a0 ; a0=character
  84336. movea.l a0,a2
  84337. bsr.w KillCharacter
  84338. move.b #1,(Time_Over_flag_2P).w
  84339. +
  84340. rts
  84341. ; End of function TimeOver0
  84342.  
  84343.  
  84344. ; ---------------------------------------------------------------------------
  84345. ; Subroutine to initialize ring counter on the HUD
  84346. ; ---------------------------------------------------------------------------
  84347.  
  84348. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84349.  
  84350. ; sub_4105A:
  84351. ; Hud_LoadZero:
  84352. Hud_InitRings:
  84353. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Rings),VRAM,WRITE),(VDP_control_port).l
  84354. lea Hud_TilesRings(pc),a2
  84355. move.w #(Hud_TilesBase_End-Hud_TilesRings)-1,d2
  84356. bra.s loc_41090
  84357.  
  84358. ; ---------------------------------------------------------------------------
  84359. ; Subroutine to load uncompressed HUD patterns ("E", "0", colon)
  84360. ; ---------------------------------------------------------------------------
  84361.  
  84362. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84363.  
  84364. ; loc_4106E:
  84365. Hud_Base:
  84366. lea (VDP_data_port).l,a6
  84367. bsr.w Hud_Lives
  84368. tst.w (Two_player_mode).w
  84369. bne.s loc_410BC
  84370. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Score_E),VRAM,WRITE),(VDP_control_port).l
  84371. lea Hud_TilesBase(pc),a2
  84372. move.w #(Hud_TilesBase_End-Hud_TilesBase)-1,d2
  84373.  
  84374. loc_41090:
  84375. lea Art_Hud(pc),a1
  84376.  
  84377. loc_41094:
  84378. move.w #8*hud_letter_num_tiles-1,d1
  84379. move.b (a2)+,d0
  84380. bmi.s loc_410B0
  84381. ext.w d0
  84382. lsl.w #5,d0
  84383. lea (a1,d0.w),a3
  84384.  
  84385. loc_410A4:
  84386. move.l (a3)+,(a6)
  84387. dbf d1,loc_410A4
  84388.  
  84389. loc_410AA:
  84390. dbf d2,loc_41094
  84391. rts
  84392. ; ===========================================================================
  84393.  
  84394. loc_410B0:
  84395. move.l #0,(a6)
  84396. dbf d1,loc_410B0
  84397. bra.s loc_410AA
  84398. ; End of function Hud_Base
  84399.  
  84400. ; ===========================================================================
  84401.  
  84402. loc_410BC:
  84403. bsr.w Hud_Lives2
  84404. move.l #Art_Hud,d1 ; source addreses
  84405. move.w #tiles_to_bytes(ArtTile_Art_HUD_Numbers_2P),d2 ; destination VRAM address
  84406. move.w #$160,d3 ; DMA transfer length
  84407. jmp (QueueDMATransfer).l
  84408. ; ===========================================================================
  84409.  
  84410. charset ' ',$FF
  84411. charset '0',0
  84412. charset '1',2
  84413. charset '2',4
  84414. charset '3',6
  84415. charset '4',8
  84416. charset '5',$A
  84417. charset '6',$C
  84418. charset '7',$E
  84419. charset '8',$10
  84420. charset '9',$12
  84421. charset ':',$14
  84422. charset 'E',$16
  84423.  
  84424. ; byte_410D4:
  84425. Hud_TilesBase:
  84426. dc.b "E 0"
  84427. dc.b "0:00"
  84428. ; byte_410E0:
  84429. ; Hud_TilesZero:
  84430. Hud_TilesRings:
  84431. dc.b " 0"
  84432. Hud_TilesBase_End
  84433.  
  84434. charset
  84435. even
  84436.  
  84437. ; ---------------------------------------------------------------------------
  84438. ; Subroutine to load debug mode numbers patterns
  84439. ; ---------------------------------------------------------------------------
  84440.  
  84441. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84442.  
  84443. ; sub_410E4:
  84444. HudDb_XY:
  84445. move.l #vdpComm(tiles_to_bytes(ArtTile_HUD_Score_E),VRAM,WRITE),(VDP_control_port).l
  84446. move.w (Camera_X_pos).w,d1
  84447. swap d1
  84448. move.w (MainCharacter+x_pos).w,d1
  84449. bsr.s HudDb_XY2
  84450. move.w (Camera_Y_pos).w,d1
  84451. swap d1
  84452. move.w (MainCharacter+y_pos).w,d1
  84453. ; loc_41104:
  84454. HudDb_XY2:
  84455. moveq #7,d6
  84456. lea (Art_Text).l,a1
  84457. ; loc_4110C:
  84458. HudDb_XYLoop:
  84459. rol.w #4,d1
  84460. move.w d1,d2
  84461. andi.w #$F,d2
  84462. cmpi.w #$A,d2
  84463. blo.s loc_4111E
  84464. addi_.w #7,d2
  84465.  
  84466. loc_4111E:
  84467. lsl.w #5,d2
  84468. lea (a1,d2.w),a3
  84469. rept 8
  84470. move.l (a3)+,(a6)
  84471. endm
  84472. swap d1
  84473. dbf d6,HudDb_XYLoop
  84474. rts
  84475. ; End of function HudDb_XY
  84476.  
  84477. ; ---------------------------------------------------------------------------
  84478. ; Subroutine to load rings numbers patterns
  84479. ; ---------------------------------------------------------------------------
  84480.  
  84481. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84482.  
  84483. ; sub_4113C:
  84484. Hud_Rings:
  84485. lea (Hud_100).l,a2
  84486. moveq #2,d6
  84487. bra.s Hud_LoadArt
  84488. ; End of function Hud_Rings
  84489.  
  84490. ; ---------------------------------------------------------------------------
  84491. ; Subroutine to load score numbers patterns
  84492. ; ---------------------------------------------------------------------------
  84493.  
  84494. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84495.  
  84496. ; sub_41146:
  84497. Hud_Score:
  84498. lea (Hud_100000).l,a2
  84499. moveq #5,d6
  84500. ; loc_4114E:
  84501. Hud_LoadArt:
  84502. moveq #0,d4
  84503. lea Art_Hud(pc),a1
  84504. ; loc_41154:
  84505. Hud_ScoreLoop:
  84506. moveq #0,d2
  84507. move.l (a2)+,d3
  84508.  
  84509. loc_41158:
  84510. sub.l d3,d1
  84511. bcs.s loc_41160
  84512. addq.w #1,d2
  84513. bra.s loc_41158
  84514. ; ===========================================================================
  84515.  
  84516. loc_41160:
  84517. add.l d3,d1
  84518. tst.w d2
  84519. beq.s loc_4116A
  84520. move.w #1,d4
  84521.  
  84522. loc_4116A:
  84523. tst.w d4
  84524. beq.s loc_41198
  84525. lsl.w #6,d2
  84526. move.l d0,4(a6)
  84527. lea (a1,d2.w),a3
  84528. rept 8*hud_letter_num_tiles
  84529. move.l (a3)+,(a6)
  84530. endm
  84531.  
  84532. loc_41198:
  84533. addi.l #hud_letter_vdp_delta,d0
  84534. dbf d6,Hud_ScoreLoop
  84535. rts
  84536. ; End of function Hud_Score
  84537.  
  84538. ; ---------------------------------------------------------------------------
  84539. ; Subroutine to load countdown numbers on the continue screen
  84540. ; ---------------------------------------------------------------------------
  84541.  
  84542. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84543.  
  84544. ; sub_411A4:
  84545. ContScrCounter:
  84546. move.l #vdpComm(tiles_to_bytes(ArtTile_ContinueCountdown),VRAM,WRITE),(VDP_control_port).l
  84547. lea (VDP_data_port).l,a6
  84548. lea (Hud_10).l,a2
  84549. moveq #1,d6
  84550. moveq #0,d4
  84551. lea Art_Hud(pc),a1
  84552. ; loc_411C2:
  84553. ContScr_Loop:
  84554. moveq #0,d2
  84555. move.l (a2)+,d3
  84556.  
  84557. loc_411C6:
  84558. sub.l d3,d1
  84559. bcs.s loc_411CE
  84560. addq.w #1,d2
  84561. bra.s loc_411C6
  84562. ; ===========================================================================
  84563.  
  84564. loc_411CE:
  84565. add.l d3,d1
  84566. lsl.w #6,d2
  84567. lea (a1,d2.w),a3
  84568. rept 16
  84569. move.l (a3)+,(a6)
  84570. endm
  84571. dbf d6,ContScr_Loop ; repeat 1 more time
  84572. rts
  84573. ; End of function ContScrCounter
  84574.  
  84575. ; ===========================================================================
  84576. ; ---------------------------------------------------------------------------
  84577. ; for HUD counter
  84578. ; ---------------------------------------------------------------------------
  84579. ; byte_411FC:
  84580. Hud_100000: dc.l 100000 ; byte_41200: ; Hud_10000:
  84581. dc.l 10000 ; byte_41204:
  84582. Hud_1000: dc.l 1000 ; byte_41208:
  84583. Hud_100: dc.l 100 ; byte_4120C:
  84584. Hud_10: dc.l 10 ; byte_41210:
  84585. Hud_1: dc.l 1
  84586.  
  84587. ; ---------------------------------------------------------------------------
  84588. ; Subroutine to load time numbers patterns
  84589. ; ---------------------------------------------------------------------------
  84590.  
  84591. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84592.  
  84593. ; sub_41214:
  84594. Hud_Mins:
  84595. lea_ Hud_1,a2
  84596. moveq #0,d6
  84597. bra.s loc_41222
  84598. ; ===========================================================================
  84599. ; loc_4121C:
  84600. Hud_Secs:
  84601. lea_ Hud_10,a2
  84602. moveq #1,d6
  84603.  
  84604. loc_41222:
  84605. moveq #0,d4
  84606. lea Art_Hud(pc),a1
  84607. ; loc_41228:
  84608. Hud_TimeLoop:
  84609. moveq #0,d2
  84610. move.l (a2)+,d3
  84611.  
  84612. loc_4122C:
  84613. sub.l d3,d1
  84614. bcs.s loc_41234
  84615. addq.w #1,d2
  84616. bra.s loc_4122C
  84617. ; ===========================================================================
  84618.  
  84619. loc_41234:
  84620. add.l d3,d1
  84621. tst.w d2
  84622. beq.s loc_4123E
  84623. move.w #1,d4
  84624.  
  84625. loc_4123E:
  84626. lsl.w #6,d2
  84627. move.l d0,4(a6)
  84628. lea (a1,d2.w),a3
  84629. rept 8*hud_letter_num_tiles
  84630. move.l (a3)+,(a6)
  84631. endm
  84632. addi.l #hud_letter_vdp_delta,d0
  84633. dbf d6,Hud_TimeLoop
  84634. rts
  84635. ; End of function Hud_Mins
  84636.  
  84637. ; ---------------------------------------------------------------------------
  84638. ; Subroutine to load time/ring bonus numbers patterns
  84639. ; ---------------------------------------------------------------------------
  84640.  
  84641. ; ===========================================================================
  84642. ; loc_41274:
  84643. Hud_TimeRingBonus:
  84644. lea_ Hud_1000,a2
  84645. moveq #3,d6
  84646. moveq #0,d4
  84647. lea Art_Hud(pc),a1
  84648. ; loc_41280:
  84649. Hud_BonusLoop:
  84650. moveq #0,d2
  84651. move.l (a2)+,d3
  84652.  
  84653. loc_41284:
  84654. sub.l d3,d1
  84655. bcs.s loc_4128C
  84656. addq.w #1,d2
  84657. bra.s loc_41284
  84658. ; ===========================================================================
  84659.  
  84660. loc_4128C:
  84661. add.l d3,d1
  84662. tst.w d2
  84663. beq.s loc_41296
  84664. move.w #1,d4
  84665.  
  84666. loc_41296:
  84667. tst.w d4
  84668. beq.s Hud_ClrBonus
  84669. lsl.w #6,d2
  84670. lea (a1,d2.w),a3
  84671. rept 8*hud_letter_num_tiles
  84672. move.l (a3)+,(a6)
  84673. endm
  84674.  
  84675. loc_412C0:
  84676. dbf d6,Hud_BonusLoop ; repeat 3 more times
  84677. rts
  84678. ; ===========================================================================
  84679. ; loc_412C6:
  84680. Hud_ClrBonus:
  84681. moveq #8*hud_letter_num_tiles-1,d5
  84682. ; loc_412C8:
  84683. Hud_ClrBonusLoop:
  84684. move.l #0,(a6)
  84685. dbf d5,Hud_ClrBonusLoop
  84686. bra.s loc_412C0
  84687.  
  84688. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84689.  
  84690. ; ---------------------------------------------------------------------------
  84691. ; Subroutine to load uncompressed lives counter patterns (Sonic)
  84692. ; ---------------------------------------------------------------------------
  84693.  
  84694. ; sub_412D4:
  84695. Hud_Lives2:
  84696. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtUnc_2p_life_counter_lives),VRAM,WRITE),d0
  84697. moveq #0,d1
  84698. move.b (Life_count_2P).w,d1
  84699. bra.s loc_412EE
  84700. ; End of function Hud_Lives2
  84701.  
  84702. ; ---------------------------------------------------------------------------
  84703. ; Subroutine to load uncompressed lives counter patterns (Tails)
  84704. ; ---------------------------------------------------------------------------
  84705.  
  84706. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84707.  
  84708. ; sub_412E2:
  84709. Hud_Lives:
  84710. move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_life_counter_lives),VRAM,WRITE),d0
  84711. moveq #0,d1
  84712. move.b (Life_count).w,d1
  84713.  
  84714. loc_412EE:
  84715. lea_ Hud_10,a2
  84716. moveq #1,d6
  84717. moveq #0,d4
  84718. lea Art_LivesNums(pc),a1
  84719. ; loc_412FA:
  84720. Hud_LivesLoop:
  84721. move.l d0,4(a6)
  84722. moveq #0,d2
  84723. move.l (a2)+,d3
  84724. - sub.l d3,d1
  84725. bcs.s loc_4130A
  84726. addq.w #1,d2
  84727. bra.s -
  84728. ; ===========================================================================
  84729.  
  84730. loc_4130A:
  84731. add.l d3,d1
  84732. tst.w d2
  84733. beq.s loc_41314
  84734. move.w #1,d4
  84735.  
  84736. loc_41314:
  84737. tst.w d4
  84738. beq.s Hud_ClrLives
  84739.  
  84740. loc_41318:
  84741. lsl.w #5,d2
  84742. lea (a1,d2.w),a3
  84743. rept 8
  84744. move.l (a3)+,(a6)
  84745. endm
  84746.  
  84747. loc_4132E:
  84748. addi.l #hud_letter_vdp_delta,d0
  84749. dbf d6,Hud_LivesLoop ; repeat 1 more time
  84750. rts
  84751. ; ===========================================================================
  84752. ; loc_4133A:
  84753. Hud_ClrLives:
  84754. tst.w d6
  84755. beq.s loc_41318
  84756. moveq #7,d5
  84757. ; loc_41340:
  84758. Hud_ClrLivesLoop:
  84759. move.l #0,(a6)
  84760. dbf d5,Hud_ClrLivesLoop
  84761. bra.s loc_4132E
  84762. ; End of function Hud_Lives
  84763.  
  84764. ; ===========================================================================
  84765. ; ArtUnc_4134C:
  84766. Art_Hud: BINCLUDE "art/uncompressed/Big and small numbers used on counters - 1.bin"
  84767. ; ArtUnc_4164C:
  84768. Art_LivesNums: BINCLUDE "art/uncompressed/Big and small numbers used on counters - 2.bin"
  84769. ; ArtUnc_4178C:
  84770. Art_Text: BINCLUDE "art/uncompressed/Big and small numbers used on counters - 3.bin"
  84771.  
  84772. if ~~removeJmpTos
  84773. JmpTo_DrawSprite_2P_Loop
  84774. jmp (DrawSprite_2P_Loop).l
  84775. JmpTo_DrawSprite_Loop
  84776. jmp (DrawSprite_Loop).l
  84777.  
  84778. align 4
  84779. endif
  84780.  
  84781.  
  84782.  
  84783.  
  84784. ; ===========================================================================
  84785. ; ---------------------------------------------------------------------------
  84786. ; When debug mode is currently in use
  84787. ; ---------------------------------------------------------------------------
  84788. ; loc_41A78:
  84789. DebugMode:
  84790. moveq #0,d0
  84791. move.b (Debug_placement_mode).w,d0
  84792. move.w Debug_Index(pc,d0.w),d1
  84793. jmp Debug_Index(pc,d1.w)
  84794. ; ===========================================================================
  84795. ; off_41A86:
  84796. Debug_Index: offsetTable
  84797. offsetTableEntry.w Debug_Init ; 0
  84798. offsetTableEntry.w Debug_Main ; 2
  84799. ; ===========================================================================
  84800. ; loc_41A8A: Debug_Main:
  84801. Debug_Init:
  84802. addq.b #2,(Debug_placement_mode).w
  84803. move.w (Camera_Min_Y_pos).w,(Camera_Min_Y_pos_Debug_Copy).w
  84804. move.w (Camera_Max_Y_pos).w,(Camera_Max_Y_pos_Debug_Copy).w
  84805. cmpi.b #sky_chase_zone,(Current_Zone).w
  84806. bne.s +
  84807. move.w #0,(Camera_Min_X_pos).w
  84808. move.w #$3FFF,(Camera_Max_X_pos).w
  84809. +
  84810. andi.w #$7FF,(MainCharacter+y_pos).w
  84811. andi.w #$7FF,(Camera_Y_pos).w
  84812. andi.w #$7FF,(Camera_BG_Y_pos).w
  84813. clr.b (Scroll_lock).w
  84814. move.b #0,mapping_frame(a0)
  84815. move.b #AniIDSonAni_Walk,anim(a0)
  84816. ; S1 leftover
  84817. cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; special stage mode? (you can't enter debug mode in S2's special stage)
  84818. bne.s .islevel ; if not, branch
  84819. moveq #6,d0 ; force zone 6's debug object list (was the ending in S1)
  84820. bra.s .selectlist
  84821. ; ===========================================================================
  84822. .islevel:
  84823. moveq #0,d0
  84824. move.b (Current_Zone).w,d0
  84825.  
  84826. .selectlist:
  84827. lea (JmpTbl_DbgObjLists).l,a2
  84828. add.w d0,d0
  84829. adda.w (a2,d0.w),a2
  84830. move.w (a2)+,d6
  84831. cmp.b (Debug_object).w,d6
  84832. bhi.s +
  84833. move.b #0,(Debug_object).w
  84834. +
  84835. bsr.w LoadDebugObjectSprite
  84836. move.b #$C,(Debug_Accel_Timer).w
  84837. move.b #1,(Debug_Speed).w
  84838. ; loc_41B0C:
  84839. Debug_Main:
  84840. ; S1 leftover
  84841. moveq #6,d0 ; force zone 6's debug object list (was the ending in S1)
  84842. cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; special stage mode? (you can't enter debug mode in S2's special stage)
  84843. beq.s .isntlevel ; if yes, branch
  84844.  
  84845. moveq #0,d0
  84846. move.b (Current_Zone).w,d0
  84847.  
  84848. .isntlevel:
  84849. lea (JmpTbl_DbgObjLists).l,a2
  84850. add.w d0,d0
  84851. adda.w (a2,d0.w),a2
  84852. move.w (a2)+,d6
  84853. bsr.w Debug_Control
  84854. jmp (DisplaySprite).l
  84855.  
  84856. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  84857.  
  84858. ; sub_41B34:
  84859. Debug_Control:
  84860. ;Debug_ControlMovement:
  84861. moveq #0,d4
  84862. move.w #1,d1
  84863. move.b (Ctrl_1_Press).w,d4
  84864. andi.w #button_up_mask|button_down_mask|button_left_mask|button_right_mask,d4
  84865. bne.s Debug_Move
  84866. move.b (Ctrl_1_Held).w,d0
  84867. andi.w #button_up_mask|button_down_mask|button_left_mask|button_right_mask,d0
  84868. bne.s Debug_ContinueMoving
  84869. move.b #$C,(Debug_Accel_Timer).w
  84870. move.b #$F,(Debug_Speed).w
  84871. bra.w Debug_ControlObjects
  84872. ; ===========================================================================
  84873. ; loc_41B5E:
  84874. Debug_ContinueMoving:
  84875. subq.b #1,(Debug_Accel_Timer).w
  84876. bne.s Debug_TimerNotOver
  84877. move.b #1,(Debug_Accel_Timer).w
  84878. addq.b #1,(Debug_Speed).w
  84879. bne.s Debug_Move
  84880. move.b #-1,(Debug_Speed).w
  84881. ; loc_41B76:
  84882. Debug_Move:
  84883. move.b (Ctrl_1_Held).w,d4
  84884. ; loc_41B7A:
  84885. Debug_TimerNotOver:
  84886. moveq #0,d1
  84887. move.b (Debug_Speed).w,d1
  84888. addq.w #1,d1
  84889. swap d1
  84890. asr.l #4,d1
  84891. move.l y_pos(a0),d2
  84892. move.l x_pos(a0),d3
  84893.  
  84894. ; Move up
  84895. btst #button_up,d4
  84896. beq.s .upNotHeld
  84897. sub.l d1,d2
  84898. moveq #0,d0
  84899. move.w (Camera_Min_Y_pos).w,d0
  84900. swap d0
  84901. cmp.l d0,d2
  84902. bge.s .minYPosNotReached
  84903. move.l d0,d2
  84904. .minYPosNotReached:
  84905. ; loc_41BA4:
  84906. .upNotHeld:
  84907. ; Move down
  84908. btst #button_down,d4
  84909. beq.s .downNotHeld
  84910. add.l d1,d2
  84911. moveq #0,d0
  84912. move.w (Camera_Max_Y_pos).w,d0
  84913. addi.w #224-1,d0
  84914. swap d0
  84915. cmp.l d0,d2
  84916. blt.s .maxYPosNotReached
  84917. move.l d0,d2
  84918. .maxYPosNotReached:
  84919. ; loc_41BBE:
  84920. .downNotHeld:
  84921. ; Move left
  84922. btst #button_left,d4
  84923. beq.s .leftNotHeld
  84924. sub.l d1,d3
  84925. bcc.s .minXPosNotReached
  84926. moveq #0,d3
  84927. .minXPosNotReached:
  84928. ; loc_41BCA:
  84929. .leftNotHeld:
  84930. ; Move right
  84931. btst #button_right,d4
  84932. beq.s .rightNotHeld
  84933. add.l d1,d3
  84934. ; loc_41BD2:
  84935. .rightNotHeld:
  84936. move.l d2,y_pos(a0)
  84937. move.l d3,x_pos(a0)
  84938. ; loc_41BDA:
  84939. Debug_ControlObjects:
  84940. ;Debug_CycleObjectsBackwards:
  84941. btst #button_A,(Ctrl_1_Held).w
  84942. beq.s Debug_SpawnObject
  84943. btst #button_C,(Ctrl_1_Press).w
  84944. beq.s Debug_CycleObjects
  84945. ; Cycle backwards though object list
  84946. subq.b #1,(Debug_object).w
  84947. bcc.s BranchTo_LoadDebugObjectSprite
  84948. add.b d6,(Debug_object).w
  84949. bra.s BranchTo_LoadDebugObjectSprite
  84950. ; ===========================================================================
  84951. ; loc_41BF6:
  84952. Debug_CycleObjects:
  84953. btst #button_A,(Ctrl_1_Press).w
  84954. beq.s Debug_SpawnObject
  84955. ; Cycle forwards though object list
  84956. addq.b #1,(Debug_object).w
  84957. cmp.b (Debug_object).w,d6
  84958. bhi.s BranchTo_LoadDebugObjectSprite
  84959. move.b #0,(Debug_object).w
  84960.  
  84961. BranchTo_LoadDebugObjectSprite
  84962. bra.w LoadDebugObjectSprite
  84963. ; ===========================================================================
  84964. ; loc_41C12:
  84965. Debug_SpawnObject:
  84966. btst #button_C,(Ctrl_1_Press).w
  84967. beq.s Debug_ExitDebugMode
  84968. ; Spawn object
  84969. jsr (SingleObjLoad).l
  84970. bne.s Debug_ExitDebugMode
  84971. move.w x_pos(a0),x_pos(a1)
  84972. move.w y_pos(a0),y_pos(a1)
  84973. _move.b mappings(a0),id(a1) ; load obj
  84974. move.b render_flags(a0),render_flags(a1)
  84975. move.b render_flags(a0),status(a1)
  84976. andi.b #$7F,status(a1)
  84977. moveq #0,d0
  84978. move.b (Debug_object).w,d0
  84979. lsl.w #3,d0
  84980. move.b 4(a2,d0.w),subtype(a1)
  84981. rts
  84982. ; ===========================================================================
  84983. ; loc_41C56:
  84984. Debug_ExitDebugMode:
  84985. btst #button_B,(Ctrl_1_Press).w
  84986. beq.s return_41CB6
  84987. ; Exit debug mode
  84988. moveq #0,d0
  84989. move.w d0,(Debug_placement_mode).w
  84990. lea (MainCharacter).w,a1 ; a1=character
  84991. move.l #Mapunc_Sonic,mappings(a1)
  84992. move.w #make_art_tile(ArtTile_ArtUnc_Sonic,0,0),art_tile(a1)
  84993. tst.w (Two_player_mode).w
  84994. beq.s .notTwoPlayerMode
  84995. move.w #make_art_tile_2p(ArtTile_ArtUnc_Sonic,0,0),art_tile(a1)
  84996. ; loc_41C82:
  84997. .notTwoPlayerMode:
  84998. bsr.s sub_41CB8
  84999. move.b #$13,y_radius(a1)
  85000. move.b #9,x_radius(a1)
  85001. move.w (Camera_Min_Y_pos_Debug_Copy).w,(Camera_Min_Y_pos).w
  85002. move.w (Camera_Max_Y_pos_Debug_Copy).w,(Camera_Max_Y_pos).w
  85003. ; useless leftover; this is for S1's special stage
  85004. cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; special stage mode?
  85005. bne.s return_41CB6 ; if not, branch
  85006. move.b #AniIDSonAni_Roll,(MainCharacter+anim).w
  85007. bset #2,(MainCharacter+status).w
  85008. bset #1,(MainCharacter+status).w
  85009.  
  85010. return_41CB6:
  85011. rts
  85012. ; End of function Debug_Control
  85013.  
  85014.  
  85015. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  85016.  
  85017.  
  85018. sub_41CB8:
  85019. move.b d0,anim(a1)
  85020. move.w d0,2+x_pos(a1) ; subpixel x
  85021. move.w d0,2+y_pos(a1) ; subpixel y
  85022. move.b d0,obj_control(a1)
  85023. move.b d0,spindash_flag(a1)
  85024. move.w d0,x_vel(a1)
  85025. move.w d0,y_vel(a1)
  85026. move.w d0,inertia(a1)
  85027. move.b #2,status(a1)
  85028. move.b #2,routine(a1)
  85029. move.b #0,routine_secondary(a1)
  85030. rts
  85031. ; End of function sub_41CB8
  85032.  
  85033.  
  85034. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  85035.  
  85036. ; sub_41CEC:
  85037. LoadDebugObjectSprite:
  85038. moveq #0,d0
  85039. move.b (Debug_object).w,d0
  85040. lsl.w #3,d0
  85041. move.l (a2,d0.w),mappings(a0)
  85042. move.w 6(a2,d0.w),art_tile(a0)
  85043. move.b 5(a2,d0.w),mapping_frame(a0)
  85044. jsrto (Adjust2PArtPointer).l, JmpTo66_Adjust2PArtPointer
  85045. rts
  85046. ; End of function LoadDebugObjectSprite
  85047.  
  85048. ; ===========================================================================
  85049. ; ---------------------------------------------------------------------------
  85050. ; OBJECT DEBUG LISTS
  85051.  
  85052. ; The jump table goes by level ID, so Metropolis Zone's list is repeated to
  85053. ; account for its third act. Hidden Palace Zone uses Oil Ocean Zone's list.
  85054. ; ---------------------------------------------------------------------------
  85055. JmpTbl_DbgObjLists: zoneOrderedOffsetTable 2,1
  85056. zoneOffsetTableEntry.w DbgObjList_EHZ ; 0
  85057. zoneOffsetTableEntry.w DbgObjList_Def ; 1
  85058. zoneOffsetTableEntry.w DbgObjList_Def ; 2
  85059. zoneOffsetTableEntry.w DbgObjList_Def ; 3
  85060. zoneOffsetTableEntry.w DbgObjList_MTZ ; 4
  85061. zoneOffsetTableEntry.w DbgObjList_MTZ ; 5
  85062. zoneOffsetTableEntry.w DbgObjList_WFZ ; 6
  85063. zoneOffsetTableEntry.w DbgObjList_HTZ ; 7
  85064. zoneOffsetTableEntry.w DbgObjList_HPZ ; 8
  85065. zoneOffsetTableEntry.w DbgObjList_Def ; 9
  85066. zoneOffsetTableEntry.w DbgObjList_OOZ ; $A
  85067. zoneOffsetTableEntry.w DbgObjList_MCZ ; $B
  85068. zoneOffsetTableEntry.w DbgObjList_CNZ ; $C
  85069. zoneOffsetTableEntry.w DbgObjList_CPZ ; $D
  85070. zoneOffsetTableEntry.w DbgObjList_Def ; $E
  85071. zoneOffsetTableEntry.w DbgObjList_ARZ ; $F
  85072. zoneOffsetTableEntry.w DbgObjList_SCZ ; $10
  85073. zoneTableEnd
  85074.  
  85075. ; macro for a debug object list header
  85076. ; must be on the same line as a label that has a corresponding _End label later
  85077. dbglistheader macro {INTLABEL}
  85078. __LABEL__ label *
  85079. dc.w ((__LABEL___End - __LABEL__ - 2) >> 3)
  85080. endm
  85081.  
  85082. ; macro to define debug list object data
  85083. dbglistobj macro obj, mapaddr, subtype, frame, vram
  85084. dc.l obj<<24|mapaddr
  85085. dc.b subtype,frame
  85086. dc.w vram
  85087. endm
  85088.  
  85089. DbgObjList_Def: dbglistheader
  85090. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0) ; obj25 = ring
  85091. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0) ; obj26 = monitor
  85092. DbgObjList_Def_End
  85093.  
  85094. DbgObjList_EHZ: dbglistheader
  85095. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85096. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85097. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85098. dbglistobj ObjID_PlaneSwitcher, Obj03_MapUnc_1FFB8, 9, 1, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85099. dbglistobj ObjID_EHZWaterfall, Obj49_MapUnc_20C50, 0, 0, make_art_tile(ArtTile_ArtNem_Waterfall,1,0)
  85100. dbglistobj ObjID_EHZWaterfall, Obj49_MapUnc_20C50, 2, 3, make_art_tile(ArtTile_ArtNem_Waterfall,1,0)
  85101. dbglistobj ObjID_EHZWaterfall, Obj49_MapUnc_20C50, 4, 5, make_art_tile(ArtTile_ArtNem_Waterfall,1,0)
  85102. dbglistobj ObjID_EHZPlatform, Obj18_MapUnc_107F6, 1, 0, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85103. dbglistobj ObjID_EHZPlatform, Obj18_MapUnc_107F6, $9A, 1, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85104. dbglistobj ObjID_Spikes, Obj36_MapUnc_15B68, 0, 0, make_art_tile(ArtTile_ArtNem_Spikes,1,0)
  85105. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $81, 0, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85106. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $90, 3, make_art_tile(ArtTile_ArtNem_HrzntlSprng,0,0)
  85107. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $A0, 6, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85108. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $30, 7, make_art_tile(ArtTile_ArtNem_DignlSprng,0,0)
  85109. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $40, $A, make_art_tile(ArtTile_ArtNem_DignlSprng,0,0)
  85110. dbglistobj ObjID_Buzzer, Obj4B_MapUnc_2D2EA, 0, 0, make_art_tile(ArtTile_ArtNem_Buzzer,0,0)
  85111. dbglistobj ObjID_Masher, Obj5C_MapUnc_2D442, 0, 0, make_art_tile(ArtTile_ArtNem_Masher,0,0)
  85112. dbglistobj ObjID_Coconuts, Obj9D_Obj98_MapUnc_37D96, $1E, 0, make_art_tile(ArtTile_ArtNem_Coconuts,0,0)
  85113. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85114. DbgObjList_EHZ_End
  85115.  
  85116. DbgObjList_MTZ: dbglistheader
  85117. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85118. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85119. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85120. dbglistobj ObjID_PlaneSwitcher, Obj03_MapUnc_1FFB8, 9, 1, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85121. dbglistobj ObjID_SteamSpring, Obj42_MapUnc_2686C, 1, 7, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85122. dbglistobj ObjID_MTZTwinStompers, Obj64_MapUnc_26A5C, 1, 0, make_art_tile(ArtTile_ArtKos_LevelArt,1,0)
  85123. dbglistobj ObjID_MTZTwinStompers, Obj64_MapUnc_26A5C, $11, 1, make_art_tile(ArtTile_ArtKos_LevelArt,1,0)
  85124. dbglistobj ObjID_MTZLongPlatform, Obj65_Obj6A_Obj6B_MapUnc_26EC8, $80, 0, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85125. dbglistobj ObjID_MTZLongPlatform, Obj65_Obj6A_Obj6B_MapUnc_26EC8, $13, 1, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85126. dbglistobj ObjID_Button, Obj47_MapUnc_24D96, 0, 2, make_art_tile(ArtTile_ArtNem_Button,0,0)
  85127. dbglistobj ObjID_Barrier, Obj2D_MapUnc_11822, 1, 1, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85128. dbglistobj ObjID_MTZSpringWall, Obj66_MapUnc_27120, 1, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85129. dbglistobj ObjID_MTZSpringWall, Obj66_MapUnc_27120, $11, 1, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85130. dbglistobj ObjID_SpikyBlock, Obj68_Obj6D_MapUnc_27750, 0, 4, make_art_tile(ArtTile_ArtNem_MtzSpikeBlock,3,0)
  85131. dbglistobj ObjID_Nut, Obj69_MapUnc_27A26, 4, 0, make_art_tile(ArtTile_ArtNem_MtzAsstBlocks,1,0)
  85132. dbglistobj ObjID_MTZMovingPforms, Obj65_Obj6A_Obj6B_MapUnc_26EC8, 0, 1, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85133. dbglistobj ObjID_MTZPlatform, Obj65_Obj6A_Obj6B_MapUnc_26EC8, 7, 1, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85134. dbglistobj ObjID_FloorSpike, Obj68_Obj6D_MapUnc_27750, 0, 0, make_art_tile(ArtTile_ArtNem_MtzSpike,1,0)
  85135. dbglistobj ObjID_LargeRotPform, Obj6E_MapUnc_2852C, 0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85136. dbglistobj ObjID_LargeRotPform, Obj6E_MapUnc_2852C, $10, 1, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85137. dbglistobj ObjID_LargeRotPform, Obj6E_MapUnc_2852C, $20, 2, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85138. dbglistobj ObjID_Cog, Obj70_MapUnc_28786, $10, 0, make_art_tile(ArtTile_ArtNem_MtzWheel,3,1)
  85139. dbglistobj ObjID_MTZLavaBubble, Obj71_MapUnc_11576, $22, 5, make_art_tile(ArtTile_ArtNem_MtzLavaBubble,2,0)
  85140. dbglistobj ObjID_Scenery, Obj1C_MapUnc_11552, 0, 0, make_art_tile(ArtTile_ArtNem_BoltEnd_Rope,2,0)
  85141. dbglistobj ObjID_Scenery, Obj1C_MapUnc_11552, 1, 1, make_art_tile(ArtTile_ArtNem_BoltEnd_Rope,2,0)
  85142. dbglistobj ObjID_Scenery, Obj1C_MapUnc_11552, 3, 2, make_art_tile(ArtTile_ArtNem_BoltEnd_Rope,1,0)
  85143. dbglistobj ObjID_MTZLongPlatform, Obj65_Obj6A_Obj6B_MapUnc_26EC8, $B0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,3,0)
  85144. dbglistobj ObjID_Shellcracker, Obj9F_MapUnc_38314, $24, 0, make_art_tile(ArtTile_ArtNem_Crabmeat,0,0)
  85145. dbglistobj ObjID_Asteron, ObjA4_Obj98_MapUnc_38A96, $2E, 0, make_art_tile(ArtTile_ArtNem_MtzSupernova,0,1)
  85146. dbglistobj ObjID_Slicer, ObjA1_MapUnc_385E2, $28, 0, make_art_tile(ArtTile_ArtNem_MtzMantis,1,0)
  85147. dbglistobj ObjID_LavaMarker, Obj31_MapUnc_20E74, 0, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85148. dbglistobj ObjID_LavaMarker, Obj31_MapUnc_20E74, 1, 1, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85149. dbglistobj ObjID_LavaMarker, Obj31_MapUnc_20E74, 2, 2, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85150. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85151. DbgObjList_MTZ_End
  85152.  
  85153. DbgObjList_WFZ: dbglistheader
  85154. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85155. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85156. dbglistobj ObjID_WFZPalSwitcher, Obj03_MapUnc_1FFB8, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,0,0)
  85157. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85158. dbglistobj ObjID_Cloud, ObjB3_MapUnc_3B32C, $5E, 0, make_art_tile(ArtTile_ArtNem_Clouds,2,0)
  85159. dbglistobj ObjID_Cloud, ObjB3_MapUnc_3B32C, $60, 1, make_art_tile(ArtTile_ArtNem_Clouds,2,0)
  85160. dbglistobj ObjID_Cloud, ObjB3_MapUnc_3B32C, $62, 2, make_art_tile(ArtTile_ArtNem_Clouds,2,0)
  85161. dbglistobj ObjID_VPropeller, ObjB4_MapUnc_3B3BE, $64, 0, make_art_tile(ArtTile_ArtNem_WfzVrtclPrpllr,1,1)
  85162. dbglistobj ObjID_HPropeller, ObjB5_MapUnc_3B548, $66, 0, make_art_tile(ArtTile_ArtNem_WfzHrzntlPrpllr,1,1)
  85163. dbglistobj ObjID_HPropeller, ObjB5_MapUnc_3B548, $68, 0, make_art_tile(ArtTile_ArtNem_WfzHrzntlPrpllr,1,1)
  85164. dbglistobj ObjID_CluckerBase, ObjAD_Obj98_MapUnc_395B4, $42, $C, make_art_tile(ArtTile_ArtNem_WfzScratch,0,0)
  85165. dbglistobj ObjID_Clucker, ObjAD_Obj98_MapUnc_395B4, $44, $B, make_art_tile(ArtTile_ArtNem_WfzScratch,0,0)
  85166. dbglistobj ObjID_TiltingPlatform, ObjB6_MapUnc_3B856, $6A, 0, make_art_tile(ArtTile_ArtNem_WfzTiltPlatforms,1,1)
  85167. dbglistobj ObjID_TiltingPlatform, ObjB6_MapUnc_3B856, $6C, 0, make_art_tile(ArtTile_ArtNem_WfzTiltPlatforms,1,1)
  85168. dbglistobj ObjID_TiltingPlatform, ObjB6_MapUnc_3B856, $6E, 0, make_art_tile(ArtTile_ArtNem_WfzTiltPlatforms,1,1)
  85169. dbglistobj ObjID_TiltingPlatform, ObjB6_MapUnc_3B856, $70, 0, make_art_tile(ArtTile_ArtNem_WfzTiltPlatforms,1,1)
  85170. dbglistobj ObjID_VerticalLaser, ObjB7_MapUnc_3B8E4, $72, 0, make_art_tile(ArtTile_ArtNem_WfzVrtclLazer,2,1)
  85171. dbglistobj ObjID_WallTurret, ObjB8_Obj98_MapUnc_3BA46, $74, 0, make_art_tile(ArtTile_ArtNem_WfzWallTurret,0,0)
  85172. dbglistobj ObjID_Laser, ObjB9_MapUnc_3BB18, $76, 0, make_art_tile(ArtTile_ArtNem_WfzHrzntlLazer,2,1)
  85173. dbglistobj ObjID_WFZWheel, ObjBA_MapUnc_3BB70, $78, 0, make_art_tile(ArtTile_ArtNem_WfzConveyorBeltWheel,2,1)
  85174. dbglistobj ObjID_WFZShipFire, ObjBC_MapUnc_3BC08, $7C, 0, make_art_tile(ArtTile_ArtNem_WfzThrust,2,0)
  85175. dbglistobj ObjID_SmallMetalPform, ObjBD_MapUnc_3BD3E, $7E, 0, make_art_tile(ArtTile_ArtNem_WfzBeltPlatform,3,1)
  85176. dbglistobj ObjID_SmallMetalPform, ObjBD_MapUnc_3BD3E, $80, 0, make_art_tile(ArtTile_ArtNem_WfzBeltPlatform,3,1)
  85177. dbglistobj ObjID_LateralCannon, ObjBE_MapUnc_3BE46, $82, 0, make_art_tile(ArtTile_ArtNem_WfzGunPlatform,3,1)
  85178. dbglistobj ObjID_WFZStick, ObjBF_MapUnc_3BEE0, $84, 0, make_art_tile(ArtTile_ArtNem_WfzUnusedBadnik,3,1)
  85179. dbglistobj ObjID_SpeedLauncher, ObjC0_MapUnc_3C098, 8, 0, make_art_tile(ArtTile_ArtNem_WfzLaunchCatapult,1,0)
  85180. dbglistobj ObjID_BreakablePlating, ObjC1_MapUnc_3C280, $88, 0, make_art_tile(ArtTile_ArtNem_BreakPanels,3,1)
  85181. dbglistobj ObjID_Rivet, ObjC2_MapUnc_3C3C2, $8A, 0, make_art_tile(ArtTile_ArtNem_WfzSwitch,1,1)
  85182. dbglistobj ObjID_WFZPlatform, Obj19_MapUnc_2222A, $38, 3, make_art_tile(ArtTile_ArtNem_WfzFloatingPlatform,1,1)
  85183. dbglistobj ObjID_Grab, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85184. dbglistobj ObjID_MovingVine, Obj80_MapUnc_29DD0, 0, 0, make_art_tile(ArtTile_ArtNem_WfzHook_Fudge,1,0)
  85185. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85186. DbgObjList_WFZ_End
  85187.  
  85188. DbgObjList_HTZ: dbglistheader
  85189. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85190. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85191. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85192. dbglistobj ObjID_ForcedSpin, Obj03_MapUnc_1FFB8, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,0,0)
  85193. dbglistobj ObjID_ForcedSpin, Obj03_MapUnc_1FFB8, 4, 4, make_art_tile(ArtTile_ArtNem_Ring,0,0)
  85194. dbglistobj ObjID_PlaneSwitcher, Obj03_MapUnc_1FFB8, 9, 1, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85195. dbglistobj ObjID_EHZPlatform, Obj18_MapUnc_107F6, 1, 0, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85196. dbglistobj ObjID_EHZPlatform, Obj18_MapUnc_107F6, $9A, 1, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85197. dbglistobj ObjID_Spikes, Obj36_MapUnc_15B68, 0, 0, make_art_tile(ArtTile_ArtNem_Spikes,1,0)
  85198. dbglistobj ObjID_Seesaw, Obj14_MapUnc_21CF0, 0, 0, make_art_tile(ArtTile_ArtNem_HtzSeeSaw,0,0)
  85199. dbglistobj ObjID_Barrier, Obj2D_MapUnc_11822, 0, 0, make_art_tile(ArtTile_ArtNem_HtzValveBarrier,1,0)
  85200. dbglistobj ObjID_SmashableGround, Obj2F_MapUnc_236FA, 0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,2,1)
  85201. dbglistobj ObjID_LavaBubble, Obj20_MapUnc_23254, $44, 2, make_art_tile(ArtTile_ArtNem_HtzFireball,0,1)
  85202. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $81, 0, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85203. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $90, 3, make_art_tile(ArtTile_ArtNem_HrzntlSprng,0,0)
  85204. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $A0, 6, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85205. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $30, 7, make_art_tile(ArtTile_ArtNem_DignlSprng,0,0)
  85206. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $40, $A, make_art_tile(ArtTile_ArtNem_DignlSprng,0,0)
  85207. dbglistobj ObjID_HTZLift, Obj16_MapUnc_21F14, 0, 0, make_art_tile(ArtTile_ArtNem_HtzZipline,2,0)
  85208. dbglistobj ObjID_BridgeStake, Obj16_MapUnc_21F14, 4, 3, make_art_tile(ArtTile_ArtNem_HtzZipline,2,0)
  85209. dbglistobj ObjID_BridgeStake, Obj16_MapUnc_21F14, 5, 4, make_art_tile(ArtTile_ArtNem_HtzZipline,2,0)
  85210. dbglistobj ObjID_Scenery, Obj1C_MapUnc_113D6, 7, 0, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85211. dbglistobj ObjID_Scenery, Obj1C_MapUnc_113D6, 8, 1, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85212. dbglistobj ObjID_BreakableRock, Obj32_MapUnc_23852, 0, 0, make_art_tile(ArtTile_ArtNem_HtzRock,2,0)
  85213. dbglistobj ObjID_LavaMarker, Obj31_MapUnc_20E74, 0, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85214. dbglistobj ObjID_LavaMarker, Obj31_MapUnc_20E74, 1, 1, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85215. dbglistobj ObjID_LavaMarker, Obj31_MapUnc_20E74, 2, 2, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85216. dbglistobj ObjID_Rexon2, Obj94_Obj98_MapUnc_37678, $E, 2, make_art_tile(ArtTile_ArtNem_Rexon,3,0)
  85217. dbglistobj ObjID_Spiker, Obj92_Obj93_MapUnc_37092, $A, 0, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85218. dbglistobj ObjID_Sol, Obj95_MapUnc_372E6, 0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85219. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85220. DbgObjList_HTZ_End
  85221.  
  85222. DbgObjList_HPZ:; dbglistheader
  85223. ; dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85224. ; dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85225. ;DbgObjList_HPZ_End
  85226.  
  85227. DbgObjList_OOZ: dbglistheader
  85228. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85229. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85230. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85231. dbglistobj ObjID_OOZPoppingPform, Obj33_MapUnc_23DDC, 1, 0, make_art_tile(ArtTile_ArtNem_BurnerLid,3,0)
  85232. dbglistobj ObjID_SlidingSpike, Obj43_MapUnc_23FE0, 0, 0, make_art_tile(ArtTile_ArtNem_SpikyThing,2,1)
  85233. dbglistobj ObjID_OOZMovingPform, Obj19_MapUnc_2222A, $23, 2, make_art_tile(ArtTile_ArtNem_OOZElevator,3,0)
  85234. dbglistobj ObjID_OOZSpring, Obj45_MapUnc_2451A, 2, 0, make_art_tile(ArtTile_ArtNem_PushSpring,2,0)
  85235. dbglistobj ObjID_OOZSpring, Obj45_MapUnc_2451A, $12, $A, make_art_tile(ArtTile_ArtNem_PushSpring,2,0)
  85236. dbglistobj ObjID_OOZBall, Obj46_MapUnc_24C52, 0, 1, make_art_tile(ArtTile_ArtNem_BallThing,3,0)
  85237. dbglistobj ObjID_Button, Obj47_MapUnc_24D96, 0, 2, make_art_tile(ArtTile_ArtNem_Button,0,0)
  85238. dbglistobj ObjID_SwingingPlatform, Obj15_MapUnc_101E8, $88, 1, make_art_tile(ArtTile_ArtNem_OOZSwingPlat,2,0)
  85239. dbglistobj ObjID_OOZLauncher, Obj3D_MapUnc_250BA, 0, 0, make_art_tile(ArtTile_ArtNem_StripedBlocksVert,3,0)
  85240. dbglistobj ObjID_LauncherBall, Obj48_MapUnc_254FE, $80, 0, make_art_tile(ArtTile_ArtNem_LaunchBall,3,0)
  85241. dbglistobj ObjID_LauncherBall, Obj48_MapUnc_254FE, $81, 1, make_art_tile(ArtTile_ArtNem_LaunchBall,3,0)
  85242. dbglistobj ObjID_LauncherBall, Obj48_MapUnc_254FE, $82, 2, make_art_tile(ArtTile_ArtNem_LaunchBall,3,0)
  85243. dbglistobj ObjID_LauncherBall, Obj48_MapUnc_254FE, $83, 3, make_art_tile(ArtTile_ArtNem_LaunchBall,3,0)
  85244. dbglistobj ObjID_CollapsPform, Obj1F_MapUnc_110C6, 0, 0, make_art_tile(ArtTile_ArtNem_OOZPlatform,3,0)
  85245. dbglistobj ObjID_Fan, Obj3F_MapUnc_2AA12, 0, 0, make_art_tile(ArtTile_ArtNem_OOZFanHoriz,3,0)
  85246. dbglistobj ObjID_Fan, Obj3F_MapUnc_2AAC4, $80, 0, make_art_tile(ArtTile_ArtNem_OOZFanHoriz,3,0)
  85247. dbglistobj ObjID_Aquis, Obj50_MapUnc_2CF94, 0, 0, make_art_tile(ArtTile_ArtNem_Aquis,1,0)
  85248. dbglistobj ObjID_Octus, Obj4A_MapUnc_2CBFE, 0, 0, make_art_tile(ArtTile_ArtNem_Octus,1,0)
  85249. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_11406, $A, 0, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85250. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_11406, $B, 1, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85251. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_11406, $C, 2, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85252. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_11406, $D, 3, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85253. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_11406, $E, 4, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85254. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_11406, $F, 5, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85255. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_114AE, $10, 0, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85256. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_114AE, $11, 1, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85257. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_114AE, $12, 2, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85258. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_114AE, $13, 3, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85259. dbglistobj ObjID_FallingOil, Obj1C_MapUnc_114AE, $14, 4, make_art_tile(ArtTile_ArtNem_Oilfall2,2,0)
  85260. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85261. DbgObjList_OOZ_End
  85262.  
  85263. DbgObjList_MCZ: dbglistheader
  85264. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85265. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85266. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85267. dbglistobj ObjID_SwingingPlatform, Obj15_Obj7A_MapUnc_10256, $48, 2, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85268. dbglistobj ObjID_CollapsPform, Obj1F_MapUnc_11106, 0, 0, make_art_tile(ArtTile_ArtNem_MCZCollapsePlat,3,0)
  85269. dbglistobj ObjID_RotatingRings, Obj73_MapUnc_28B9C, $F5, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85270. dbglistobj ObjID_MCZRotPforms, Obj6A_MapUnc_27D30, $18, 0, make_art_tile(ArtTile_ArtNem_Crate,3,0)
  85271. dbglistobj ObjID_Stomper, Obj2A_MapUnc_11666, 0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85272. dbglistobj ObjID_Spikes, Obj36_MapUnc_15B68, 0, 0, make_art_tile(ArtTile_ArtNem_Spikes,1,0)
  85273. dbglistobj ObjID_Spikes, Obj36_MapUnc_15B68, $40, 4, make_art_tile(ArtTile_ArtNem_HorizSpike,1,0)
  85274. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $81, 0, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85275. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $90, 3, make_art_tile(ArtTile_ArtNem_HrzntlSprng,0,0)
  85276. dbglistobj ObjID_Springboard, Obj40_MapUnc_265F4, 1, 0, make_art_tile(ArtTile_ArtNem_LeverSpring,0,0)
  85277. dbglistobj ObjID_InvisibleBlock, Obj74_MapUnc_20F66, $11, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85278. dbglistobj ObjID_MCZBrick, Obj75_MapUnc_28D8A, $18, 2, make_art_tile(ArtTile_ArtKos_LevelArt,1,0)
  85279. dbglistobj ObjID_SlidingSpikes, Obj76_MapUnc_28F3A, 0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85280. dbglistobj ObjID_MCZBridge, Obj77_MapUnc_29064, 1, 0, make_art_tile(ArtTile_ArtNem_MCZGateLog,3,0)
  85281. dbglistobj ObjID_VineSwitch, Obj7F_MapUnc_29938, 0, 0, make_art_tile(ArtTile_ArtNem_VineSwitch,3,0)
  85282. dbglistobj ObjID_MovingVine, Obj80_MapUnc_29C64, 0, 0, make_art_tile(ArtTile_ArtNem_VinePulley,3,0)
  85283. dbglistobj ObjID_MCZDrawbridge, Obj81_MapUnc_2A24E, 0, 1, make_art_tile(ArtTile_ArtNem_MCZGateLog,3,0)
  85284. dbglistobj ObjID_SidewaysPform, Obj15_Obj7A_MapUnc_10256, $12, 0, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85285. dbglistobj ObjID_Flasher, ObjA3_MapUnc_388F0, $2C, 0, make_art_tile(ArtTile_ArtNem_Flasher,0,1)
  85286. dbglistobj ObjID_Crawlton, Obj9E_MapUnc_37FF2, $22, 0, make_art_tile(ArtTile_ArtNem_Crawlton,1,0)
  85287. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85288. DbgObjList_MCZ_End
  85289.  
  85290. DbgObjList_CNZ: dbglistheader
  85291. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85292. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85293. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85294. dbglistobj ObjID_PinballMode, Obj03_MapUnc_1FFB8, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,0,0)
  85295. dbglistobj ObjID_PinballMode, Obj03_MapUnc_1FFB8, 4, 4, make_art_tile(ArtTile_ArtNem_Ring,0,0)
  85296. dbglistobj ObjID_PlaneSwitcher, Obj03_MapUnc_1FFB8, 9, 1, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85297. dbglistobj ObjID_PlaneSwitcher, Obj03_MapUnc_1FFB8, $D, 5, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85298. dbglistobj ObjID_RoundBumper, Obj44_MapUnc_1F85A, 0, 0, make_art_tile(ArtTile_ArtNem_CNZRoundBumper,2,0)
  85299. dbglistobj ObjID_LauncherSpring, Obj85_MapUnc_2B07E, 0, 0, make_art_tile(ArtTile_ArtNem_CNZVertPlunger,0,0)
  85300. dbglistobj ObjID_LauncherSpring, Obj85_MapUnc_2B0EC, $81, 0, make_art_tile(ArtTile_ArtNem_CNZDiagPlunger,0,0)
  85301. dbglistobj ObjID_Flipper, Obj86_MapUnc_2B45A, 0, 0, make_art_tile(ArtTile_ArtNem_CNZFlipper,2,0)
  85302. dbglistobj ObjID_Flipper, Obj86_MapUnc_2B45A, 1, 4, make_art_tile(ArtTile_ArtNem_CNZFlipper,2,0)
  85303. dbglistobj ObjID_CNZRectBlocks, ObjD2_MapUnc_2B694, 1, 0, make_art_tile(ArtTile_ArtNem_CNZSnake,2,0)
  85304. dbglistobj ObjID_BombPrize, ObjD3_MapUnc_2B8D4, 0, 0, make_art_tile(ArtTile_ArtNem_CNZBonusSpike,0,0)
  85305. dbglistobj ObjID_CNZBigBlock, ObjD4_MapUnc_2B9CA, 0, 0, make_art_tile(ArtTile_ArtNem_BigMovingBlock,2,0)
  85306. dbglistobj ObjID_CNZBigBlock, ObjD4_MapUnc_2B9CA, 2, 0, make_art_tile(ArtTile_ArtNem_BigMovingBlock,2,0)
  85307. dbglistobj ObjID_Elevator, ObjD5_MapUnc_2BB40, $18, 0, make_art_tile(ArtTile_ArtNem_CNZElevator,2,0)
  85308. dbglistobj ObjID_PointPokey, ObjD6_MapUnc_2BEBC, 1, 0, make_art_tile(ArtTile_ArtNem_CNZCage,0,0)
  85309. dbglistobj ObjID_Bumper, ObjD7_MapUnc_2C626, 0, 0, make_art_tile(ArtTile_ArtNem_CNZHexBumper,2,0)
  85310. dbglistobj ObjID_BonusBlock, ObjD8_MapUnc_2C8C4, 0, 0, make_art_tile(ArtTile_ArtNem_CNZMiniBumper,2,0)
  85311. dbglistobj ObjID_BonusBlock, ObjD8_MapUnc_2C8C4, $40, 1, make_art_tile(ArtTile_ArtNem_CNZMiniBumper,2,0)
  85312. dbglistobj ObjID_BonusBlock, ObjD8_MapUnc_2C8C4, $80, 2, make_art_tile(ArtTile_ArtNem_CNZMiniBumper,2,0)
  85313. dbglistobj ObjID_Crawl, ObjC8_MapUnc_3D450, $AC, 0, make_art_tile(ArtTile_ArtNem_Crawl,0,1)
  85314. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85315. DbgObjList_CNZ_End
  85316.  
  85317. DbgObjList_CPZ: dbglistheader
  85318. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85319. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85320. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85321. dbglistobj ObjID_TippingFloor, Obj0B_MapUnc_201A0, $70, 0, make_art_tile(ArtTile_ArtNem_CPZAnimatedBits,3,1)
  85322. dbglistobj ObjID_SpeedBooster, Obj1B_MapUnc_223E2, 0, 0, make_art_tile(ArtTile_ArtNem_CPZBooster,3,1)
  85323. dbglistobj ObjID_BlueBalls, Obj1D_MapUnc_22576, 5, 0, make_art_tile(ArtTile_ArtNem_CPZDroplet,3,1)
  85324. dbglistobj ObjID_CPZPlatform, Obj19_MapUnc_2222A, 6, 0, make_art_tile(ArtTile_ArtNem_CPZElevator,3,0)
  85325. dbglistobj ObjID_Barrier, Obj2D_MapUnc_11822, 2, 2, make_art_tile(ArtTile_ArtNem_ConstructionStripes_2,1,0)
  85326. dbglistobj ObjID_BreakableBlock, Obj32_MapUnc_23886, 0, 0, make_art_tile(ArtTile_ArtNem_CPZMetalBlock,3,0)
  85327. dbglistobj ObjID_CPZSquarePform, Obj6B_MapUnc_2800E, $10, 0, make_art_tile(ArtTile_ArtNem_CPZStairBlock,3,0)
  85328. dbglistobj ObjID_CPZStaircase, Obj6B_MapUnc_2800E, 0, 0, make_art_tile(ArtTile_ArtNem_CPZStairBlock,3,0)
  85329. dbglistobj ObjID_SidewaysPform, Obj7A_MapUnc_29564, 0, 0, make_art_tile(ArtTile_ArtNem_CPZStairBlock,3,1)
  85330. dbglistobj ObjID_PipeExitSpring, Obj7B_MapUnc_29780, 2, 0, make_art_tile(ArtTile_ArtNem_CPZTubeSpring,0,0)
  85331. dbglistobj ObjID_PlaneSwitcher, Obj03_MapUnc_1FFB8, 9, 1, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85332. dbglistobj ObjID_PlaneSwitcher, Obj03_MapUnc_1FFB8, $D, 5, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85333. dbglistobj ObjID_Spikes, Obj36_MapUnc_15B68, 0, 0, make_art_tile(ArtTile_ArtNem_Spikes,1,0)
  85334. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $81, 0, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85335. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $90, 3, make_art_tile(ArtTile_ArtNem_HrzntlSprng,0,0)
  85336. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $A0, 6, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85337. dbglistobj ObjID_Springboard, Obj40_MapUnc_265F4, 1, 0, make_art_tile(ArtTile_ArtNem_LeverSpring,0,0)
  85338. dbglistobj ObjID_Spiny, ObjA5_ObjA6_Obj98_MapUnc_38CCA, $32, 0, make_art_tile(ArtTile_ArtNem_Spiny,1,0)
  85339. dbglistobj ObjID_SpinyOnWall, ObjA5_ObjA6_Obj98_MapUnc_38CCA, $32, 3, make_art_tile(ArtTile_ArtNem_Spiny,1,0)
  85340. dbglistobj ObjID_Grabber, ObjA7_ObjA8_ObjA9_Obj98_MapUnc_3921A, $36, 0, make_art_tile(ArtTile_ArtNem_Grabber,1,1)
  85341. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85342. DbgObjList_CPZ_End
  85343.  
  85344. DbgObjList_ARZ: dbglistheader
  85345. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85346. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85347. dbglistobj ObjID_Starpost, Obj79_MapUnc_1F424, 1, 0, make_art_tile(ArtTile_ArtNem_Checkpoint,0,0)
  85348. dbglistobj ObjID_SwingingPlatform, Obj15_Obj83_MapUnc_1021E, $88, 2, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85349. dbglistobj ObjID_ARZPlatform, Obj18_MapUnc_1084E, 1, 0, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85350. dbglistobj ObjID_ARZPlatform, Obj18_MapUnc_1084E, $9A, 1, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85351. dbglistobj ObjID_ArrowShooter, Obj22_MapUnc_25804, 0, 1, make_art_tile(ArtTile_ArtNem_ArrowAndShooter,0,0)
  85352. dbglistobj ObjID_FallingPillar, Obj23_MapUnc_259E6, 0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,1,0)
  85353. dbglistobj ObjID_RisingPillar, Obj2B_MapUnc_25C6E, 0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,1,0)
  85354. dbglistobj ObjID_LeavesGenerator, Obj31_MapUnc_20E74, 0, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85355. dbglistobj ObjID_LeavesGenerator, Obj31_MapUnc_20E74, 1, 1, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85356. dbglistobj ObjID_LeavesGenerator, Obj31_MapUnc_20E74, 2, 2, make_art_tile(ArtTile_ArtNem_Powerups,0,1)
  85357. dbglistobj ObjID_Springboard, Obj40_MapUnc_265F4, 1, 0, make_art_tile(ArtTile_ArtNem_LeverSpring,0,0)
  85358. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $81, 0, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85359. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $90, 3, make_art_tile(ArtTile_ArtNem_HrzntlSprng,0,0)
  85360. dbglistobj ObjID_Spring, Obj41_MapUnc_1901C, $A0, 6, make_art_tile(ArtTile_ArtNem_VrtclSprng,0,0)
  85361. dbglistobj ObjID_PlaneSwitcher, Obj03_MapUnc_1FFB8, 9, 1, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85362. dbglistobj ObjID_Spikes, Obj36_MapUnc_15B68, 0, 0, make_art_tile(ArtTile_ArtNem_Spikes,1,0)
  85363. dbglistobj ObjID_Barrier, Obj2D_MapUnc_11822, 3, 3, make_art_tile(ArtTile_ArtNem_ARZBarrierThing,1,0)
  85364. dbglistobj ObjID_CollapsPform, Obj1F_MapUnc_1115E, 0, 0, make_art_tile(ArtTile_ArtKos_LevelArt,2,0)
  85365. dbglistobj ObjID_SwingingPform, Obj82_MapUnc_2A476, 3, 0, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85366. dbglistobj ObjID_SwingingPform, Obj82_MapUnc_2A476, $11, 1, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85367. dbglistobj ObjID_ARZRotPforms, Obj15_Obj83_MapUnc_1021E, $10, 1, make_art_tile(ArtTile_ArtKos_LevelArt,0,0)
  85368. dbglistobj ObjID_ARZBubbles, Obj24_MapUnc_1FBF6, $81, $E, make_art_tile(ArtTile_ArtNem_BigBubbles,0,1)
  85369. dbglistobj ObjID_ChopChop, Obj91_MapUnc_36EF6, 8, 0, make_art_tile(ArtTile_ArtNem_ChopChop,1,0)
  85370. dbglistobj ObjID_Whisp, Obj8C_MapUnc_36A4E, 0, 0, make_art_tile(ArtTile_ArtNem_Whisp,1,1)
  85371. dbglistobj ObjID_GrounderInWall, Obj8D_MapUnc_36CF0, 2, 0, make_art_tile(ArtTile_ArtNem_Grounder,1,1)
  85372. dbglistobj ObjID_GrounderInWall2, Obj8D_MapUnc_36CF0, 2, 0, make_art_tile(ArtTile_ArtNem_Grounder,1,1)
  85373. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85374. DbgObjList_ARZ_End
  85375.  
  85376. DbgObjList_SCZ: dbglistheader
  85377. dbglistobj ObjID_Ring, Obj25_MapUnc_12382, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,1,0)
  85378. dbglistobj ObjID_Monitor, Obj26_MapUnc_12D36, 8, 0, make_art_tile(ArtTile_ArtNem_Powerups,0,0)
  85379. dbglistobj ObjID_WFZPalSwitcher, Obj03_MapUnc_1FFB8, 0, 0, make_art_tile(ArtTile_ArtNem_Ring,0,0)
  85380. dbglistobj ObjID_Cloud, ObjB3_MapUnc_3B32C, $5E, 0, make_art_tile(ArtTile_ArtNem_Clouds,2,0)
  85381. dbglistobj ObjID_Cloud, ObjB3_MapUnc_3B32C, $60, 1, make_art_tile(ArtTile_ArtNem_Clouds,2,0)
  85382. dbglistobj ObjID_Cloud, ObjB3_MapUnc_3B32C, $62, 2, make_art_tile(ArtTile_ArtNem_Clouds,2,0)
  85383. dbglistobj ObjID_VPropeller, ObjB4_MapUnc_3B3BE, $64, 0, make_art_tile(ArtTile_ArtNem_WfzVrtclPrpllr,1,1)
  85384. dbglistobj ObjID_HPropeller, ObjB5_MapUnc_3B548, $66, 0, make_art_tile(ArtTile_ArtNem_WfzHrzntlPrpllr,1,1)
  85385. dbglistobj ObjID_HPropeller, ObjB5_MapUnc_3B548, $68, 0, make_art_tile(ArtTile_ArtNem_WfzHrzntlPrpllr,1,1)
  85386. dbglistobj ObjID_Turtloid, Obj9A_Obj98_MapUnc_37B62, $16, 0, make_art_tile(ArtTile_ArtNem_Turtloid,0,0)
  85387. dbglistobj ObjID_Balkiry, ObjAC_MapUnc_393CC, $40, 0, make_art_tile(ArtTile_ArtNem_Balkrie,0,0)
  85388. dbglistobj ObjID_Nebula, Obj99_Obj98_MapUnc_3789A, $12, 0, make_art_tile(ArtTile_ArtNem_Nebula,1,1)
  85389. dbglistobj ObjID_EggPrison, Obj3E_MapUnc_3F436, 0, 0, make_art_tile(ArtTile_ArtNem_Capsule,1,0)
  85390. DbgObjList_SCZ_End
  85391.  
  85392. if ~~removeJmpTos
  85393. JmpTo66_Adjust2PArtPointer
  85394. jmp (Adjust2PArtPointer).l
  85395.  
  85396. align 4
  85397. endif
  85398.  
  85399.  
  85400.  
  85401.  
  85402. ; ---------------------------------------------------------------------------
  85403. ; "MAIN LEVEL LOAD BLOCK" (after Nemesis)
  85404. ;
  85405. ; This struct array tells the engine where to find all the art associated with
  85406. ; a particular zone. Each zone gets three longwords, in which it stores three
  85407. ; pointers (in the lower 24 bits) and three jump table indeces (in the upper eight
  85408. ; bits). The assembled data looks something like this:
  85409. ;
  85410. ; aaBBBBBB
  85411. ; ccDDDDDD
  85412. ; eeFFFFFF
  85413. ;
  85414. ; aa = index for primary pattern load request list
  85415. ; BBBBBB = pointer to level art
  85416. ; cc = index for secondary pattern load request list
  85417. ; DDDDDD = pointer to 16x16 block mappings
  85418. ; ee = index for palette
  85419. ; FFFFFF = pointer to 128x128 block mappings
  85420. ;
  85421. ; Nemesis refers to this as the "main level load block". However, that name implies
  85422. ; that this is code (obviously, it isn't), or at least that it points to the level's
  85423. ; collision, object and ring placement arrays (it only points to art...
  85424. ; although the 128x128 mappings do affect the actual level layout and collision)
  85425. ; ---------------------------------------------------------------------------
  85426.  
  85427. ; declare some global variables to be used by the levartptrs macro
  85428. cur_zone_id := 0
  85429. cur_zone_str := "0"
  85430.  
  85431. ; macro for declaring a "main level load block" (MLLB)
  85432. levartptrs macro plc1,plc2,palette,art,map16x16,map128x128
  85433. !org LevelArtPointers+zone_id_{cur_zone_str}*12
  85434. dc.l (plc1<<24)|art
  85435. dc.l (plc2<<24)|map16x16
  85436. dc.l (palette<<24)|map128x128
  85437. cur_zone_id := cur_zone_id+1
  85438. cur_zone_str := "\{cur_zone_id}"
  85439. endm
  85440.  
  85441. ; BEGIN SArt_Ptrs Art_Ptrs_Array[17]
  85442. ; dword_42594: MainLoadBlocks: saArtPtrs:
  85443. LevelArtPointers:
  85444. levartptrs PLCID_Ehz1, PLCID_Ehz2, PalID_EHZ, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 0 ; EHZ ; EMERALD HILL ZONE
  85445. levartptrs PLCID_Miles1up, PLCID_MilesLife, PalID_EHZ2, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 1 ; LEV1 ; LEVEL 1 (UNUSED)
  85446. levartptrs PLCID_Tails1up, PLCID_TailsLife, PalID_WZ, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 2 ; LEV2 ; LEVEL 2 (UNUSED)
  85447. levartptrs PLCID_Unused1, PLCID_Unused2, PalID_EHZ3, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 3 ; LEV3 ; LEVEL 3 (UNUSED)
  85448. levartptrs PLCID_Mtz1, PLCID_Mtz2, PalID_MTZ, ArtKos_MTZ, BM16_MTZ, BM128_MTZ ; 4 ; MTZ ; METROPOLIS ZONE ACTS 1 & 2
  85449. levartptrs PLCID_Mtz1, PLCID_Mtz2, PalID_MTZ, ArtKos_MTZ, BM16_MTZ, BM128_MTZ ; 5 ; MTZ3 ; METROPOLIS ZONE ACT 3
  85450. levartptrs PLCID_Wfz1, PLCID_Wfz2, PalID_WFZ, ArtKos_SCZ, BM16_WFZ, BM128_WFZ ; 6 ; WFZ ; WING FORTRESS ZONE
  85451. levartptrs PLCID_Htz1, PLCID_Htz2, PalID_HTZ, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 7 ; HTZ ; HILL TOP ZONE
  85452. levartptrs PLCID_Hpz1, PLCID_Hpz2, PalID_HPZ, ArtKos_HPZ, BM16_HPZ, BM128_HPZ ; 8 ; HPZ ; HIDDEN PALACE ZONE (UNUSED)
  85453. levartptrs PLCID_Unused3, PLCID_Unused4, PalID_EHZ4, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 9 ; LEV9 ; LEVEL 9 (UNUSED)
  85454. levartptrs PLCID_Ooz1, PLCID_Ooz2, PalID_OOZ, ArtKos_OOZ, BM16_OOZ, BM128_OOZ ; $A ; OOZ ; OIL OCEAN ZONE
  85455. levartptrs PLCID_Mcz1, PLCID_Mcz2, PalID_MCZ, ArtKos_MCZ, BM16_MCZ, BM128_MCZ ; $B ; MCZ ; MYSTIC CAVE ZONE
  85456. levartptrs PLCID_Cnz1, PLCID_Cnz2, PalID_CNZ, ArtKos_CNZ, BM16_CNZ, BM128_CNZ ; $C ; CNZ ; CASINO NIGHT ZONE
  85457. levartptrs PLCID_Cpz1, PLCID_Cpz2, PalID_CPZ, ArtKos_CPZ, BM16_CPZ, BM128_CPZ ; $D ; CPZ ; CHEMICAL PLANT ZONE
  85458. levartptrs PLCID_Dez1, PLCID_Dez2, PalID_DEZ, ArtKos_CPZ, BM16_CPZ, BM128_CPZ ; $E ; DEZ ; DEATH EGG ZONE
  85459. levartptrs PLCID_Arz1, PLCID_Arz2, PalID_ARZ, ArtKos_ARZ, BM16_ARZ, BM128_ARZ ; $F ; ARZ ; AQUATIC RUIN ZONE
  85460. levartptrs PLCID_Scz1, PLCID_Scz2, PalID_SCZ, ArtKos_SCZ, BM16_WFZ, BM128_WFZ ; $10 ; SCZ ; SKY CHASE ZONE
  85461.  
  85462. if (cur_zone_id<>no_of_zones)&&(MOMPASS=1)
  85463. message "Warning: Table LevelArtPointers has \{cur_zone_id/1.0} entries, but it should have \{no_of_zones/1.0} entries"
  85464. endif
  85465. !org LevelArtPointers+cur_zone_id*12
  85466.  
  85467. ; ---------------------------------------------------------------------------
  85468. ; END Art_Ptrs_Array[17]
  85469.  
  85470.  
  85471.  
  85472.  
  85473. ; ---------------------------------------------------------------------------
  85474. ; PATTERN LOAD REQUEST LISTS
  85475. ;
  85476. ; Pattern load request lists are simple structures used to load
  85477. ; Nemesis-compressed art for sprites.
  85478. ;
  85479. ; The decompressor predictably moves down the list, so request 0 is processed first, etc.
  85480. ; This only matters if your addresses are bad and you overwrite art loaded in a previous request.
  85481. ;
  85482.  
  85483. ; NOTICE: The load queue buffer can only hold $10 (16) load requests. None of the routines
  85484. ; that load PLRs into the queue do any bounds checking, so it's possible to create a buffer
  85485. ; overflow and completely screw up the variables stored directly after the queue buffer.
  85486. ; (in my experience this is a guaranteed crash or hang)
  85487. ;
  85488. ; Many levels queue more than 16 items overall,
  85489. ; but they don't exceed the limit because
  85490. ; their PLRs are split into multiple parts (like PlrList_Mtz1 and PlrList_Mtz2)
  85491. ; and they fully process the first part before requesting the rest.
  85492. ;
  85493. ; If you can find some extra RAM for it (which is easy in Sonic 2),
  85494. ; you can increase this limit by increasing the size of Plc_Buffer.
  85495. ; ---------------------------------------------------------------------------
  85496.  
  85497. ;---------------------------------------------------------------------------------------
  85498. ; Table of pattern load request lists. Remember to use word-length data when adding lists
  85499. ; otherwise you'll break the array.
  85500. ;---------------------------------------------------------------------------------------
  85501. ; word_42660 ; OffInd_PlrLists:
  85502. ArtLoadCues: offsetTable
  85503. PLCptr_Std1: offsetTableEntry.w PlrList_Std1 ; 0
  85504. PLCptr_Std2: offsetTableEntry.w PlrList_Std2 ; 1
  85505. PLCptr_StdWtr: offsetTableEntry.w PlrList_StdWtr ; 2
  85506. PLCptr_GameOver: offsetTableEntry.w PlrList_GameOver ; 3
  85507. PLCptr_Ehz1: offsetTableEntry.w PlrList_Ehz1 ; 4
  85508. PLCptr_Ehz2: offsetTableEntry.w PlrList_Ehz2 ; 5
  85509. PLCptr_Miles1up: offsetTableEntry.w PlrList_Miles1up ; 6
  85510. PLCptr_MilesLife: offsetTableEntry.w PlrList_MilesLifeCounter ; 7
  85511. PLCptr_Tails1up: offsetTableEntry.w PlrList_Tails1up ; 8
  85512. PLCptr_TailsLife: offsetTableEntry.w PlrList_TailsLifeCounter ; 9
  85513. PLCptr_Unused1: offsetTableEntry.w PlrList_Mtz1 ; 10
  85514. PLCptr_Unused2: offsetTableEntry.w PlrList_Mtz1 ; 11
  85515. PLCptr_Mtz1: offsetTableEntry.w PlrList_Mtz1 ; 12
  85516. PLCptr_Mtz2: offsetTableEntry.w PlrList_Mtz2 ; 13
  85517. offsetTableEntry.w PlrList_Wfz1 ; 14
  85518. offsetTableEntry.w PlrList_Wfz1 ; 15
  85519. PLCptr_Wfz1: offsetTableEntry.w PlrList_Wfz1 ; 16
  85520. PLCptr_Wfz2: offsetTableEntry.w PlrList_Wfz2 ; 17
  85521. PLCptr_Htz1: offsetTableEntry.w PlrList_Htz1 ; 18
  85522. PLCptr_Htz2: offsetTableEntry.w PlrList_Htz2 ; 19
  85523. PLCptr_Hpz1: offsetTableEntry.w PlrList_Hpz1 ; 20
  85524. PLCptr_Hpz2: offsetTableEntry.w PlrList_Hpz2 ; 21
  85525. PLCptr_Unused3: offsetTableEntry.w PlrList_Ooz1 ; 22
  85526. PLCptr_Unused4: offsetTableEntry.w PlrList_Ooz1 ; 23
  85527. PLCptr_Ooz1: offsetTableEntry.w PlrList_Ooz1 ; 24
  85528. PLCptr_Ooz2: offsetTableEntry.w PlrList_Ooz2 ; 25
  85529. PLCptr_Mcz1: offsetTableEntry.w PlrList_Mcz1 ; 26
  85530. PLCptr_Mcz2: offsetTableEntry.w PlrList_Mcz2 ; 27
  85531. PLCptr_Cnz1: offsetTableEntry.w PlrList_Cnz1 ; 28
  85532. PLCptr_Cnz2: offsetTableEntry.w PlrList_Cnz2 ; 29
  85533. PLCptr_Cpz1: offsetTableEntry.w PlrList_Cpz1 ; 30
  85534. PLCptr_Cpz2: offsetTableEntry.w PlrList_Cpz2 ; 31
  85535. PLCptr_Dez1: offsetTableEntry.w PlrList_Dez1 ; 32
  85536. PLCptr_Dez2: offsetTableEntry.w PlrList_Dez2 ; 33
  85537. PLCptr_Arz1: offsetTableEntry.w PlrList_Arz1 ; 34
  85538. PLCptr_Arz2: offsetTableEntry.w PlrList_Arz2 ; 35
  85539. PLCptr_Scz1: offsetTableEntry.w PlrList_Scz1 ; 36
  85540. PLCptr_Scz2: offsetTableEntry.w PlrList_Scz2 ; 37
  85541. PLCptr_Results: offsetTableEntry.w PlrList_Results ; 38
  85542. PLCptr_Signpost: offsetTableEntry.w PlrList_Signpost ; 39
  85543. PLCptr_CpzBoss: offsetTableEntry.w PlrList_CpzBoss ; 40
  85544. PLCptr_EhzBoss: offsetTableEntry.w PlrList_EhzBoss ; 41
  85545. PLCptr_HtzBoss: offsetTableEntry.w PlrList_HtzBoss ; 42
  85546. PLCptr_ArzBoss: offsetTableEntry.w PlrList_ArzBoss ; 43
  85547. PLCptr_MczBoss: offsetTableEntry.w PlrList_MczBoss ; 44
  85548. PLCptr_CnzBoss: offsetTableEntry.w PlrList_CnzBoss ; 45
  85549. PLCptr_MtzBoss: offsetTableEntry.w PlrList_MtzBoss ; 46
  85550. PLCptr_OozBoss: offsetTableEntry.w PlrList_OozBoss ; 47
  85551. PLCptr_FieryExplosion: offsetTableEntry.w PlrList_FieryExplosion ; 48
  85552. PLCptr_DezBoss: offsetTableEntry.w PlrList_DezBoss ; 49
  85553. PLCptr_EhzAnimals: offsetTableEntry.w PlrList_EhzAnimals ; 50
  85554. PLCptr_MczAnimals: offsetTableEntry.w PlrList_MczAnimals ; 51
  85555. PLCptr_HtzAnimals:
  85556. PLCptr_MtzAnimals:
  85557. PLCptr_WfzAnimals: offsetTableEntry.w PlrList_WfzAnimals ; 52
  85558. PLCptr_DezAnimals: offsetTableEntry.w PlrList_DezAnimals ; 53
  85559. PLCptr_HpzAnimals: offsetTableEntry.w PlrList_HpzAnimals ; 54
  85560. PLCptr_OozAnimals: offsetTableEntry.w PlrList_OozAnimals ; 55
  85561. PLCptr_SczAnimals: offsetTableEntry.w PlrList_SczAnimals ; 56
  85562. PLCptr_CnzAnimals: offsetTableEntry.w PlrList_CnzAnimals ; 57
  85563. PLCptr_CpzAnimals: offsetTableEntry.w PlrList_CpzAnimals ; 58
  85564. PLCptr_ArzAnimals: offsetTableEntry.w PlrList_ArzAnimals ; 59
  85565. PLCptr_SpecialStage: offsetTableEntry.w PlrList_SpecialStage ; 60
  85566. PLCptr_SpecStageBombs: offsetTableEntry.w PlrList_SpecStageBombs ; 61
  85567. PLCptr_WfzBoss: offsetTableEntry.w PlrList_WfzBoss ; 62
  85568. PLCptr_Tornado: offsetTableEntry.w PlrList_Tornado ; 63
  85569. PLCptr_Capsule: offsetTableEntry.w PlrList_Capsule ; 64
  85570. PLCptr_Explosion: offsetTableEntry.w PlrList_Explosion ; 65
  85571. PLCptr_ResultsTails: offsetTableEntry.w PlrList_ResultsTails ; 66
  85572.  
  85573. ; macro for a pattern load request list header
  85574. ; must be on the same line as a label that has a corresponding _End label later
  85575. plrlistheader macro {INTLABEL}
  85576. __LABEL__ label *
  85577. dc.w (((__LABEL___End - __LABEL__Plc) / 6) - 1)
  85578. __LABEL__Plc:
  85579. endm
  85580.  
  85581. ; macro for a pattern load request
  85582. plreq macro toVRAMaddr,fromROMaddr
  85583. dc.l fromROMaddr
  85584. dc.w tiles_to_bytes(toVRAMaddr)
  85585. endm
  85586.  
  85587. ;---------------------------------------------------------------------------------------
  85588. ; PATTERN LOAD REQUEST LIST
  85589. ; Standard 1 - loaded for every level
  85590. ;---------------------------------------------------------------------------------------
  85591. PlrList_Std1: plrlistheader
  85592. plreq ArtTile_ArtNem_HUD, ArtNem_HUD
  85593. plreq ArtTile_ArtNem_life_counter, ArtNem_Sonic_life_counter
  85594. plreq ArtTile_ArtNem_Ring, ArtNem_Ring
  85595. plreq ArtTile_ArtNem_Numbers, ArtNem_Numbers
  85596. PlrList_Std1_End
  85597. ;---------------------------------------------------------------------------------------
  85598. ; PATTERN LOAD REQUEST LIST
  85599. ; Standard 2 - loaded for every level
  85600. ;---------------------------------------------------------------------------------------
  85601. PlrList_Std2: plrlistheader
  85602. plreq ArtTile_ArtNem_Checkpoint, ArtNem_Checkpoint
  85603. plreq ArtTile_ArtNem_Powerups, ArtNem_Powerups
  85604. plreq ArtTile_ArtNem_Shield, ArtNem_Shield
  85605. plreq ArtTile_ArtNem_Invincible_stars, ArtNem_Invincible_stars
  85606. PlrList_Std2_End
  85607. ;---------------------------------------------------------------------------------------
  85608. ; PATTERN LOAD REQUEST LIST
  85609. ; Aquatic level standard
  85610. ;---------------------------------------------------------------------------------------
  85611. PlrList_StdWtr: plrlistheader
  85612. plreq ArtTile_ArtNem_Explosion, ArtNem_Explosion
  85613. plreq ArtTile_ArtNem_SuperSonic_stars, ArtNem_SuperSonic_stars
  85614. plreq ArtTile_ArtNem_Bubbles, ArtNem_Bubbles
  85615. PlrList_StdWtr_End
  85616. ;---------------------------------------------------------------------------------------
  85617. ; PATTERN LOAD REQUEST LIST
  85618. ; Game/Time over
  85619. ;---------------------------------------------------------------------------------------
  85620. PlrList_GameOver: plrlistheader
  85621. plreq ArtTile_ArtNem_Game_Over, ArtNem_Game_Over
  85622. PlrList_GameOver_End
  85623. ;---------------------------------------------------------------------------------------
  85624. ; PATTERN LOAD REQUEST LIST
  85625. ; Emerald Hill Zone primary
  85626. ;---------------------------------------------------------------------------------------
  85627. PlrList_Ehz1: plrlistheader
  85628. plreq ArtTile_ArtNem_Waterfall, ArtNem_Waterfall
  85629. plreq ArtTile_ArtNem_EHZ_Bridge, ArtNem_EHZ_Bridge
  85630. plreq ArtTile_ArtNem_Buzzer_Fireball_2, ArtNem_Buzzer_Fireball
  85631. plreq ArtTile_ArtNem_Buzzer, ArtNem_Buzzer
  85632. plreq ArtTile_ArtNem_Coconuts, ArtNem_Coconuts
  85633. plreq ArtTile_ArtNem_Masher, ArtNem_Masher
  85634. PlrList_Ehz1_End
  85635. ;---------------------------------------------------------------------------------------
  85636. ; PATTERN LOAD REQUEST LIST
  85637. ; Emerald Hill Zone secondary
  85638. ;---------------------------------------------------------------------------------------
  85639. PlrList_Ehz2: plrlistheader
  85640. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  85641. plreq ArtTile_ArtNem_DignlSprng, ArtNem_DignlSprng
  85642. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  85643. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  85644. PlrList_Ehz2_End
  85645. ;---------------------------------------------------------------------------------------
  85646. ; Pattern load queue
  85647. ; Miles 1up patch
  85648. ;---------------------------------------------------------------------------------------
  85649. PlrList_Miles1up: plrlistheader
  85650. plreq ArtTile_ArtUnc_2p_life_counter, ArtUnc_MilesLife
  85651. PlrList_Miles1up_End
  85652. ;---------------------------------------------------------------------------------------
  85653. ; Pattern load queue
  85654. ; Miles life counter
  85655. ;---------------------------------------------------------------------------------------
  85656. PlrList_MilesLifeCounter: plrlistheader
  85657. plreq ArtTile_ArtNem_life_counter, ArtUnc_MilesLife
  85658. PlrList_MilesLifeCounter_End
  85659. ;---------------------------------------------------------------------------------------
  85660. ; Pattern load queue
  85661. ; Tails 1up patch
  85662. ;---------------------------------------------------------------------------------------
  85663. PlrList_Tails1up: plrlistheader
  85664. plreq ArtTile_ArtUnc_2p_life_counter, ArtNem_TailsLife
  85665. PlrList_Tails1up_End
  85666. ;---------------------------------------------------------------------------------------
  85667. ; Pattern load queue
  85668. ; Tails life counter
  85669. ;---------------------------------------------------------------------------------------
  85670. PlrList_TailsLifeCounter: plrlistheader
  85671. plreq ArtTile_ArtNem_life_counter, ArtNem_TailsLife
  85672. PlrList_TailsLifeCounter_End
  85673. ;---------------------------------------------------------------------------------------
  85674. ; PATTERN LOAD REQUEST LIST
  85675. ; Metropolis Zone primary
  85676. ;---------------------------------------------------------------------------------------
  85677. PlrList_Mtz1: plrlistheader
  85678. plreq ArtTile_ArtNem_MtzWheel, ArtNem_MtzWheel
  85679. plreq ArtTile_ArtNem_MtzWheelIndent, ArtNem_MtzWheelIndent
  85680. plreq ArtTile_ArtNem_LavaCup, ArtNem_LavaCup
  85681. plreq ArtTile_ArtNem_BoltEnd_Rope, ArtNem_BoltEnd_Rope
  85682. plreq ArtTile_ArtNem_MtzSteam, ArtNem_MtzSteam
  85683. plreq ArtTile_ArtNem_MtzSpikeBlock, ArtNem_MtzSpikeBlock
  85684. plreq ArtTile_ArtNem_MtzSpike, ArtNem_MtzSpike
  85685. plreq ArtTile_ArtNem_Crabmeat, ArtNem_Crabmeat
  85686. plreq ArtTile_ArtNem_MtzSupernova, ArtNem_MtzSupernova
  85687. PlrList_Mtz1_End
  85688. ;---------------------------------------------------------------------------------------
  85689. ; PATTERN LOAD REQUEST LIST
  85690. ; Metropolis Zone secondary
  85691. ;---------------------------------------------------------------------------------------
  85692. PlrList_Mtz2: plrlistheader
  85693. plreq ArtTile_ArtNem_Button, ArtNem_Button
  85694. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  85695. plreq ArtTile_ArtNem_MtzMantis, ArtNem_MtzMantis
  85696. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  85697. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  85698. plreq ArtTile_ArtNem_MtzAsstBlocks, ArtNem_MtzAsstBlocks
  85699. plreq ArtTile_ArtNem_MtzLavaBubble, ArtNem_MtzLavaBubble
  85700. plreq ArtTile_ArtNem_MtzCog, ArtNem_MtzCog
  85701. plreq ArtTile_ArtNem_MtzSpinTubeFlash, ArtNem_MtzSpinTubeFlash
  85702. PlrList_Mtz2_End
  85703. ;---------------------------------------------------------------------------------------
  85704. ; PATTERN LOAD REQUEST LIST
  85705. ; Wing Fortress Zone primary
  85706. ;---------------------------------------------------------------------------------------
  85707. PlrList_Wfz1: plrlistheader
  85708. plreq ArtTile_ArtNem_Tornado, ArtNem_Tornado
  85709. plreq ArtTile_ArtNem_Clouds, ArtNem_Clouds
  85710. plreq ArtTile_ArtNem_WfzVrtclPrpllr, ArtNem_WfzVrtclPrpllr
  85711. plreq ArtTile_ArtNem_WfzHrzntlPrpllr, ArtNem_WfzHrzntlPrpllr
  85712. plreq ArtTile_ArtNem_Balkrie, ArtNem_Balkrie
  85713. plreq ArtTile_ArtNem_BreakPanels, ArtNem_BreakPanels
  85714. plreq ArtTile_ArtNem_WfzScratch, ArtNem_WfzScratch
  85715. plreq ArtTile_ArtNem_WfzTiltPlatforms, ArtNem_WfzTiltPlatforms
  85716. ; These two are already in the list, so this is redundant
  85717. plreq ArtTile_ArtNem_Tornado, ArtNem_Tornado
  85718. plreq ArtTile_ArtNem_Clouds, ArtNem_Clouds
  85719. PlrList_Wfz1_End
  85720. ;---------------------------------------------------------------------------------------
  85721. ; PATTERN LOAD REQUEST LIST
  85722. ; Wing Fortress Zone secondary
  85723. ;---------------------------------------------------------------------------------------
  85724. PlrList_Wfz2: plrlistheader
  85725. plreq ArtTile_ArtNem_WfzVrtclPrpllr, ArtNem_WfzVrtclPrpllr
  85726. plreq ArtTile_ArtNem_WfzHrzntlPrpllr, ArtNem_WfzHrzntlPrpllr
  85727. plreq ArtTile_ArtNem_WfzVrtclLazer, ArtNem_WfzVrtclLazer
  85728. plreq ArtTile_ArtNem_WfzWallTurret, ArtNem_WfzWallTurret
  85729. plreq ArtTile_ArtNem_WfzHrzntlLazer, ArtNem_WfzHrzntlLazer
  85730. plreq ArtTile_ArtNem_WfzConveyorBeltWheel, ArtNem_WfzConveyorBeltWheel
  85731. plreq ArtTile_ArtNem_WfzHook, ArtNem_WfzHook
  85732. plreq ArtTile_ArtNem_WfzThrust, ArtNem_WfzThrust
  85733. plreq ArtTile_ArtNem_WfzBeltPlatform, ArtNem_WfzBeltPlatform
  85734. plreq ArtTile_ArtNem_WfzGunPlatform, ArtNem_WfzGunPlatform
  85735. plreq ArtTile_ArtNem_WfzUnusedBadnik, ArtNem_WfzUnusedBadnik
  85736. plreq ArtTile_ArtNem_WfzLaunchCatapult, ArtNem_WfzLaunchCatapult
  85737. plreq ArtTile_ArtNem_WfzSwitch, ArtNem_WfzSwitch
  85738. plreq ArtTile_ArtNem_WfzFloatingPlatform, ArtNem_WfzFloatingPlatform
  85739. PlrList_Wfz2_End
  85740. ;---------------------------------------------------------------------------------------
  85741. ; PATTERN LOAD REQUEST LIST
  85742. ; Hill Top Zone primary
  85743. ;---------------------------------------------------------------------------------------
  85744. PlrList_Htz1: plrlistheader
  85745. plreq ArtTile_ArtNem_Buzzer_Fireball_1, ArtNem_Buzzer_Fireball
  85746. plreq ArtTile_ArtNem_HtzRock, ArtNem_HtzRock
  85747. plreq ArtTile_ArtNem_HtzSeeSaw, ArtNem_HtzSeeSaw
  85748. plreq ArtTile_ArtNem_Sol, ArtNem_Sol
  85749. plreq ArtTile_ArtNem_Rexon, ArtNem_Rexon
  85750. plreq ArtTile_ArtNem_Spiker, ArtNem_Spiker
  85751. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  85752. plreq ArtTile_ArtNem_DignlSprng, ArtNem_DignlSprng
  85753. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  85754. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  85755. PlrList_Htz1_End
  85756. ;---------------------------------------------------------------------------------------
  85757. ; PATTERN LOAD REQUEST LIST
  85758. ; Hill Top Zone secondary
  85759. ;---------------------------------------------------------------------------------------
  85760. PlrList_Htz2: plrlistheader
  85761. plreq ArtTile_ArtNem_HtzZipline, ArtNem_HtzZipline
  85762. plreq ArtTile_ArtNem_HtzFireball, ArtNem_HtzFireball
  85763. plreq ArtTile_ArtNem_HtzValveBarrier, ArtNem_HtzValveBarrier
  85764. PlrList_Htz2_End
  85765. ;---------------------------------------------------------------------------------------
  85766. ; Pattern load queue
  85767. ; HPZ Primary
  85768. ;---------------------------------------------------------------------------------------
  85769. PlrList_Hpz1: ;plrlistheader
  85770. ; plreq ArtTile_ArtNem_WaterSurface, ArtNem_WaterSurface
  85771. ;PlrList_Hpz1_End
  85772. ;---------------------------------------------------------------------------------------
  85773. ; Pattern load queue
  85774. ; HPZ Secondary
  85775. ;---------------------------------------------------------------------------------------
  85776. PlrList_Hpz2: ;plrlistheader
  85777. ;PlrList_Hpz2_End
  85778. ;---------------------------------------------------------------------------------------
  85779. ; Pattern load queue
  85780. ; OOZ Primary
  85781. ;---------------------------------------------------------------------------------------
  85782. PlrList_Ooz1: plrlistheader
  85783. plreq ArtTile_ArtNem_OOZBurn, ArtNem_OOZBurn
  85784. plreq ArtTile_ArtNem_OOZElevator, ArtNem_OOZElevator
  85785. plreq ArtTile_ArtNem_SpikyThing, ArtNem_SpikyThing
  85786. plreq ArtTile_ArtNem_BurnerLid, ArtNem_BurnerLid
  85787. plreq ArtTile_ArtNem_StripedBlocksVert, ArtNem_StripedBlocksVert
  85788. plreq ArtTile_ArtNem_Oilfall, ArtNem_Oilfall
  85789. plreq ArtTile_ArtNem_Oilfall2, ArtNem_Oilfall2
  85790. plreq ArtTile_ArtNem_BallThing, ArtNem_BallThing
  85791. plreq ArtTile_ArtNem_LaunchBall, ArtNem_LaunchBall
  85792. PlrList_Ooz1_End
  85793. ;---------------------------------------------------------------------------------------
  85794. ; Pattern load queue
  85795. ; OOZ Secondary
  85796. ;---------------------------------------------------------------------------------------
  85797. PlrList_Ooz2: plrlistheader
  85798. plreq ArtTile_ArtNem_OOZPlatform, ArtNem_OOZPlatform
  85799. plreq ArtTile_ArtNem_PushSpring, ArtNem_PushSpring
  85800. plreq ArtTile_ArtNem_OOZSwingPlat, ArtNem_OOZSwingPlat
  85801. plreq ArtTile_ArtNem_StripedBlocksHoriz, ArtNem_StripedBlocksHoriz
  85802. plreq ArtTile_ArtNem_OOZFanHoriz, ArtNem_OOZFanHoriz
  85803. plreq ArtTile_ArtNem_Button, ArtNem_Button
  85804. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  85805. plreq ArtTile_ArtNem_DignlSprng, ArtNem_DignlSprng
  85806. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  85807. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  85808. plreq ArtTile_ArtNem_Aquis, ArtNem_Aquis
  85809. plreq ArtTile_ArtNem_Octus, ArtNem_Octus
  85810. PlrList_Ooz2_End
  85811. ;---------------------------------------------------------------------------------------
  85812. ; Pattern load queue
  85813. ; MCZ Primary
  85814. ;---------------------------------------------------------------------------------------
  85815. PlrList_Mcz1: plrlistheader
  85816. plreq ArtTile_ArtNem_Crate, ArtNem_Crate
  85817. plreq ArtTile_ArtNem_MCZCollapsePlat, ArtNem_MCZCollapsePlat
  85818. plreq ArtTile_ArtNem_VineSwitch, ArtNem_VineSwitch
  85819. plreq ArtTile_ArtNem_VinePulley, ArtNem_VinePulley
  85820. plreq ArtTile_ArtNem_Flasher, ArtNem_Flasher
  85821. plreq ArtTile_ArtNem_Crawlton, ArtNem_Crawlton
  85822. PlrList_Mcz1_End
  85823. ;---------------------------------------------------------------------------------------
  85824. ; Pattern load queue
  85825. ; MCZ Secondary
  85826. ;---------------------------------------------------------------------------------------
  85827. PlrList_Mcz2: plrlistheader
  85828. plreq ArtTile_ArtNem_HorizSpike, ArtNem_HorizSpike
  85829. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  85830. plreq ArtTile_ArtNem_MCZGateLog, ArtNem_MCZGateLog
  85831. plreq ArtTile_ArtNem_LeverSpring, ArtNem_LeverSpring
  85832. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  85833. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  85834. PlrList_Mcz2_End
  85835. ;---------------------------------------------------------------------------------------
  85836. ; Pattern load queue
  85837. ; CNZ Primary
  85838. ;---------------------------------------------------------------------------------------
  85839. PlrList_Cnz1: plrlistheader
  85840. plreq ArtTile_ArtNem_Crawl, ArtNem_Crawl
  85841. plreq ArtTile_ArtNem_BigMovingBlock, ArtNem_BigMovingBlock
  85842. plreq ArtTile_ArtNem_CNZSnake, ArtNem_CNZSnake
  85843. plreq ArtTile_ArtNem_CNZBonusSpike, ArtNem_CNZBonusSpike
  85844. plreq ArtTile_ArtNem_CNZElevator, ArtNem_CNZElevator
  85845. plreq ArtTile_ArtNem_CNZCage, ArtNem_CNZCage
  85846. plreq ArtTile_ArtNem_CNZHexBumper, ArtNem_CNZHexBumper
  85847. plreq ArtTile_ArtNem_CNZRoundBumper, ArtNem_CNZRoundBumper
  85848. plreq ArtTile_ArtNem_CNZFlipper, ArtNem_CNZFlipper
  85849. plreq ArtTile_ArtNem_CNZMiniBumper, ArtNem_CNZMiniBumper
  85850. PlrList_Cnz1_End
  85851. ;---------------------------------------------------------------------------------------
  85852. ; Pattern load queue
  85853. ; CNZ Secondary
  85854. ;---------------------------------------------------------------------------------------
  85855. PlrList_Cnz2: plrlistheader
  85856. plreq ArtTile_ArtNem_CNZDiagPlunger, ArtNem_CNZDiagPlunger
  85857. plreq ArtTile_ArtNem_CNZVertPlunger, ArtNem_CNZVertPlunger
  85858. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  85859. plreq ArtTile_ArtNem_DignlSprng, ArtNem_DignlSprng
  85860. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  85861. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  85862. PlrList_Cnz2_End
  85863. ;---------------------------------------------------------------------------------------
  85864. ; Pattern load queue
  85865. ; CPZ Primary
  85866. ;---------------------------------------------------------------------------------------
  85867. PlrList_Cpz1: plrlistheader
  85868. plreq ArtTile_ArtNem_CPZMetalThings, ArtNem_CPZMetalThings
  85869. plreq ArtTile_ArtNem_ConstructionStripes_2, ArtNem_ConstructionStripes
  85870. plreq ArtTile_ArtNem_CPZBooster, ArtNem_CPZBooster
  85871. plreq ArtTile_ArtNem_CPZElevator, ArtNem_CPZElevator
  85872. plreq ArtTile_ArtNem_CPZAnimatedBits, ArtNem_CPZAnimatedBits
  85873. plreq ArtTile_ArtNem_CPZTubeSpring, ArtNem_CPZTubeSpring
  85874. plreq ArtTile_ArtNem_WaterSurface, ArtNem_WaterSurface
  85875. plreq ArtTile_ArtNem_CPZStairBlock, ArtNem_CPZStairBlock
  85876. plreq ArtTile_ArtNem_CPZMetalBlock, ArtNem_CPZMetalBlock
  85877. PlrList_Cpz1_End
  85878. ;---------------------------------------------------------------------------------------
  85879. ; Pattern load queue
  85880. ; CPZ Secondary
  85881. ;---------------------------------------------------------------------------------------
  85882. PlrList_Cpz2: plrlistheader
  85883. plreq ArtTile_ArtNem_Grabber, ArtNem_Grabber
  85884. plreq ArtTile_ArtNem_Spiny, ArtNem_Spiny
  85885. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  85886. plreq ArtTile_ArtNem_DignlSprng, ArtNem_CPZDroplet
  85887. plreq ArtTile_ArtNem_LeverSpring, ArtNem_LeverSpring
  85888. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  85889. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  85890. PlrList_Cpz2_End
  85891. ;---------------------------------------------------------------------------------------
  85892. ; Pattern load queue
  85893. ; DEZ Primary
  85894. ;---------------------------------------------------------------------------------------
  85895. PlrList_Dez1: plrlistheader
  85896. plreq ArtTile_ArtNem_ConstructionStripes_1, ArtNem_ConstructionStripes
  85897. PlrList_Dez1_End
  85898. ;---------------------------------------------------------------------------------------
  85899. ; Pattern load queue
  85900. ; DEZ Secondary
  85901. ;---------------------------------------------------------------------------------------
  85902. PlrList_Dez2: plrlistheader
  85903. plreq ArtTile_ArtNem_SilverSonic, ArtNem_SilverSonic
  85904. plreq ArtTile_ArtNem_DEZWindow, ArtNem_DEZWindow
  85905. plreq ArtTile_ArtNem_RobotnikRunning, ArtNem_RobotnikRunning
  85906. plreq ArtTile_ArtNem_RobotnikUpper, ArtNem_RobotnikUpper
  85907. plreq ArtTile_ArtNem_RobotnikLower, ArtNem_RobotnikLower
  85908. PlrList_Dez2_End
  85909. ;---------------------------------------------------------------------------------------
  85910. ; Pattern load queue
  85911. ; ARZ Primary
  85912. ;---------------------------------------------------------------------------------------
  85913. PlrList_Arz1: plrlistheader
  85914. plreq ArtTile_ArtNem_ARZBarrierThing, ArtNem_ARZBarrierThing
  85915. plreq ArtTile_ArtNem_WaterSurface, ArtNem_WaterSurface2
  85916. plreq ArtTile_ArtNem_Leaves, ArtNem_Leaves
  85917. plreq ArtTile_ArtNem_ArrowAndShooter, ArtNem_ArrowAndShooter
  85918. PlrList_Arz1_End
  85919. ;---------------------------------------------------------------------------------------
  85920. ; Pattern load queue
  85921. ; ARZ Secondary
  85922. ;---------------------------------------------------------------------------------------
  85923. PlrList_Arz2: plrlistheader
  85924. plreq ArtTile_ArtNem_ChopChop, ArtNem_ChopChop
  85925. plreq ArtTile_ArtNem_Whisp, ArtNem_Whisp
  85926. plreq ArtTile_ArtNem_Grounder, ArtNem_Grounder
  85927. plreq ArtTile_ArtNem_BigBubbles, ArtNem_BigBubbles
  85928. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  85929. plreq ArtTile_ArtNem_LeverSpring, ArtNem_LeverSpring
  85930. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  85931. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  85932. PlrList_Arz2_End
  85933. ;---------------------------------------------------------------------------------------
  85934. ; Pattern load queue
  85935. ; SCZ Primary
  85936. ;---------------------------------------------------------------------------------------
  85937. PlrList_Scz1: plrlistheader
  85938. plreq ArtTile_ArtNem_Tornado, ArtNem_Tornado
  85939. PlrList_Scz1_End
  85940. ;---------------------------------------------------------------------------------------
  85941. ; Pattern load queue
  85942. ; SCZ Secondary
  85943. ;---------------------------------------------------------------------------------------
  85944. PlrList_Scz2: plrlistheader
  85945. plreq ArtTile_ArtNem_Clouds, ArtNem_Clouds
  85946. plreq ArtTile_ArtNem_WfzVrtclPrpllr, ArtNem_WfzVrtclPrpllr
  85947. plreq ArtTile_ArtNem_WfzHrzntlPrpllr, ArtNem_WfzHrzntlPrpllr
  85948. plreq ArtTile_ArtNem_Balkrie, ArtNem_Balkrie
  85949. plreq ArtTile_ArtNem_Turtloid, ArtNem_Turtloid
  85950. plreq ArtTile_ArtNem_Nebula, ArtNem_Nebula
  85951. PlrList_Scz2_End
  85952. ;---------------------------------------------------------------------------------------
  85953. ; Pattern load queue
  85954. ; Sonic end of level results screen
  85955. ;---------------------------------------------------------------------------------------
  85956. PlrList_Results: plrlistheader
  85957. plreq ArtTile_ArtNem_TitleCard, ArtNem_TitleCard
  85958. plreq ArtTile_ArtNem_ResultsText, ArtNem_ResultsText
  85959. plreq ArtTile_ArtNem_MiniCharacter, ArtNem_MiniSonic
  85960. plreq ArtTile_ArtNem_Perfect, ArtNem_Perfect
  85961. PlrList_Results_End
  85962. ;---------------------------------------------------------------------------------------
  85963. ; Pattern load queue
  85964. ; End of level signpost
  85965. ;---------------------------------------------------------------------------------------
  85966. PlrList_Signpost: plrlistheader
  85967. plreq ArtTile_ArtNem_Signpost, ArtNem_Signpost
  85968. PlrList_Signpost_End
  85969. ;---------------------------------------------------------------------------------------
  85970. ; Pattern load queue
  85971. ; CPZ Boss
  85972. ;---------------------------------------------------------------------------------------
  85973. PlrList_CpzBoss: plrlistheader
  85974. plreq ArtTile_ArtNem_Eggpod_3, ArtNem_Eggpod
  85975. plreq ArtTile_ArtNem_CPZBoss, ArtNem_CPZBoss
  85976. plreq ArtTile_ArtNem_EggpodJets_1, ArtNem_EggpodJets
  85977. plreq ArtTile_ArtNem_BossSmoke_1, ArtNem_BossSmoke
  85978. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  85979. PlrList_CpzBoss_End
  85980. ;---------------------------------------------------------------------------------------
  85981. ; Pattern load queue
  85982. ; EHZ Boss
  85983. ;---------------------------------------------------------------------------------------
  85984. PlrList_EhzBoss: plrlistheader
  85985. plreq ArtTile_ArtNem_Eggpod_1, ArtNem_Eggpod
  85986. plreq ArtTile_ArtNem_EHZBoss, ArtNem_EHZBoss
  85987. plreq ArtTile_ArtNem_EggChoppers, ArtNem_EggChoppers
  85988. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  85989. PlrList_EhzBoss_End
  85990. ;---------------------------------------------------------------------------------------
  85991. ; Pattern load queue
  85992. ; HTZ Boss
  85993. ;---------------------------------------------------------------------------------------
  85994. PlrList_HtzBoss: plrlistheader
  85995. plreq ArtTile_ArtNem_Eggpod_2, ArtNem_Eggpod
  85996. plreq ArtTile_ArtNem_HTZBoss, ArtNem_HTZBoss
  85997. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  85998. plreq ArtTile_ArtNem_BossSmoke_2, ArtNem_BossSmoke
  85999. PlrList_HtzBoss_End
  86000. ;---------------------------------------------------------------------------------------
  86001. ; Pattern load queue
  86002. ; ARZ Boss
  86003. ;---------------------------------------------------------------------------------------
  86004. PlrList_ArzBoss: plrlistheader
  86005. plreq ArtTile_ArtNem_Eggpod_4, ArtNem_Eggpod
  86006. plreq ArtTile_ArtNem_ARZBoss, ArtNem_ARZBoss
  86007. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86008. PlrList_ArzBoss_End
  86009. ;---------------------------------------------------------------------------------------
  86010. ; Pattern load queue
  86011. ; MCZ Boss
  86012. ;---------------------------------------------------------------------------------------
  86013. PlrList_MczBoss: plrlistheader
  86014. plreq ArtTile_ArtNem_Eggpod_4, ArtNem_Eggpod
  86015. plreq ArtTile_ArtNem_MCZBoss, ArtNem_MCZBoss
  86016. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86017. PlrList_MczBoss_End
  86018. ;---------------------------------------------------------------------------------------
  86019. ; Pattern load queue
  86020. ; CNZ Boss
  86021. ;---------------------------------------------------------------------------------------
  86022. PlrList_CnzBoss: plrlistheader
  86023. plreq ArtTile_ArtNem_Eggpod_4, ArtNem_Eggpod
  86024. plreq ArtTile_ArtNem_CNZBoss, ArtNem_CNZBoss
  86025. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86026. PlrList_CnzBoss_End
  86027. ;---------------------------------------------------------------------------------------
  86028. ; Pattern load queue
  86029. ; MTZ Boss
  86030. ;---------------------------------------------------------------------------------------
  86031. PlrList_MtzBoss: plrlistheader
  86032. plreq ArtTile_ArtNem_Eggpod_4, ArtNem_Eggpod
  86033. plreq ArtTile_ArtNem_MTZBoss, ArtNem_MTZBoss
  86034. plreq ArtTile_ArtNem_EggpodJets_2, ArtNem_EggpodJets
  86035. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86036. PlrList_MtzBoss_End
  86037. ;---------------------------------------------------------------------------------------
  86038. ; Pattern load queue
  86039. ; OOZ Boss
  86040. ;---------------------------------------------------------------------------------------
  86041. PlrList_OozBoss: plrlistheader
  86042. plreq ArtTile_ArtNem_OOZBoss, ArtNem_OOZBoss
  86043. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86044. PlrList_OozBoss_End
  86045. ;---------------------------------------------------------------------------------------
  86046. ; Pattern load queue
  86047. ; Fiery Explosion
  86048. ;---------------------------------------------------------------------------------------
  86049. PlrList_FieryExplosion: plrlistheader
  86050. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86051. PlrList_FieryExplosion_End
  86052. ;---------------------------------------------------------------------------------------
  86053. ; Pattern load queue
  86054. ; Death Egg
  86055. ;---------------------------------------------------------------------------------------
  86056. PlrList_DezBoss: plrlistheader
  86057. plreq ArtTile_ArtNem_DEZBoss, ArtNem_DEZBoss
  86058. PlrList_DezBoss_End
  86059. ;---------------------------------------------------------------------------------------
  86060. ; Pattern load queue
  86061. ; EHZ Animals
  86062. ;---------------------------------------------------------------------------------------
  86063. PlrList_EhzAnimals: plrlistheader
  86064. plreq ArtTile_ArtNem_Animal_1, ArtNem_Squirrel
  86065. plreq ArtTile_ArtNem_Animal_2, ArtNem_Bird
  86066. PlrList_EhzAnimals_End
  86067. ;---------------------------------------------------------------------------------------
  86068. ; Pattern load queue
  86069. ; MCZ Animals
  86070. ;---------------------------------------------------------------------------------------
  86071. PlrList_MczAnimals: plrlistheader
  86072. plreq ArtTile_ArtNem_Animal_1, ArtNem_Mouse
  86073. plreq ArtTile_ArtNem_Animal_2, ArtNem_Chicken
  86074. PlrList_MczAnimals_End
  86075. ;---------------------------------------------------------------------------------------
  86076. ; Pattern load queue
  86077. ; HTZ/MTZ/WFZ animals
  86078. ;---------------------------------------------------------------------------------------
  86079. PlrList_HtzAnimals:
  86080. PlrList_MtzAnimals:
  86081. PlrList_WfzAnimals: plrlistheader
  86082. plreq ArtTile_ArtNem_Animal_1, ArtNem_Beaver
  86083. plreq ArtTile_ArtNem_Animal_2, ArtNem_Eagle
  86084. PlrList_HtzAnimals_End
  86085. PlrList_MtzAnimals_End
  86086. PlrList_WfzAnimals_End
  86087. ;---------------------------------------------------------------------------------------
  86088. ; Pattern load queue
  86089. ; DEZ Animals
  86090. ;---------------------------------------------------------------------------------------
  86091. PlrList_DezAnimals: plrlistheader
  86092. plreq ArtTile_ArtNem_Animal_1, ArtNem_Pig
  86093. plreq ArtTile_ArtNem_Animal_2, ArtNem_Chicken
  86094. PlrList_DezAnimals_End
  86095. ;---------------------------------------------------------------------------------------
  86096. ; Pattern load queue
  86097. ; HPZ animals
  86098. ;---------------------------------------------------------------------------------------
  86099. PlrList_HpzAnimals: plrlistheader
  86100. plreq ArtTile_ArtNem_Animal_1, ArtNem_Mouse
  86101. plreq ArtTile_ArtNem_Animal_2, ArtNem_Seal
  86102. PlrList_HpzAnimals_End
  86103. ;---------------------------------------------------------------------------------------
  86104. ; Pattern load queue
  86105. ; OOZ Animals
  86106. ;---------------------------------------------------------------------------------------
  86107. PlrList_OozAnimals: plrlistheader
  86108. plreq ArtTile_ArtNem_Animal_1, ArtNem_Penguin
  86109. plreq ArtTile_ArtNem_Animal_2, ArtNem_Seal
  86110. PlrList_OozAnimals_End
  86111. ;---------------------------------------------------------------------------------------
  86112. ; Pattern load queue
  86113. ; SCZ Animals
  86114. ;---------------------------------------------------------------------------------------
  86115. PlrList_SczAnimals: plrlistheader
  86116. plreq ArtTile_ArtNem_Animal_1, ArtNem_Turtle
  86117. plreq ArtTile_ArtNem_Animal_2, ArtNem_Chicken
  86118. PlrList_SczAnimals_End
  86119. ;---------------------------------------------------------------------------------------
  86120. ; Pattern load queue
  86121. ; CNZ Animals
  86122. ;---------------------------------------------------------------------------------------
  86123. PlrList_CnzAnimals: plrlistheader
  86124. plreq ArtTile_ArtNem_Animal_1, ArtNem_Bear
  86125. plreq ArtTile_ArtNem_Animal_2, ArtNem_Bird
  86126. PlrList_CnzAnimals_End
  86127. ;---------------------------------------------------------------------------------------
  86128. ; Pattern load queue
  86129. ; CPZ Animals
  86130. ;---------------------------------------------------------------------------------------
  86131. PlrList_CpzAnimals: plrlistheader
  86132. plreq ArtTile_ArtNem_Animal_1, ArtNem_Rabbit
  86133. plreq ArtTile_ArtNem_Animal_2, ArtNem_Eagle
  86134. PlrList_CpzAnimals_End
  86135. ;---------------------------------------------------------------------------------------
  86136. ; Pattern load queue
  86137. ; ARZ Animals
  86138. ;---------------------------------------------------------------------------------------
  86139. PlrList_ArzAnimals: plrlistheader
  86140. plreq ArtTile_ArtNem_Animal_1, ArtNem_Penguin
  86141. plreq ArtTile_ArtNem_Animal_2, ArtNem_Bird
  86142. PlrList_ArzAnimals_End
  86143. ;---------------------------------------------------------------------------------------
  86144. ; Pattern load queue
  86145. ; Special Stage
  86146. ;---------------------------------------------------------------------------------------
  86147. PlrList_SpecialStage: plrlistheader
  86148. plreq ArtTile_ArtNem_SpecialEmerald, ArtNem_SpecialEmerald
  86149. plreq ArtTile_ArtNem_SpecialMessages, ArtNem_SpecialMessages
  86150. plreq ArtTile_ArtNem_SpecialHUD, ArtNem_SpecialHUD
  86151. plreq ArtTile_ArtNem_SpecialFlatShadow, ArtNem_SpecialFlatShadow
  86152. plreq ArtTile_ArtNem_SpecialDiagShadow, ArtNem_SpecialDiagShadow
  86153. plreq ArtTile_ArtNem_SpecialSideShadow, ArtNem_SpecialSideShadow
  86154. plreq ArtTile_ArtNem_SpecialExplosion, ArtNem_SpecialExplosion
  86155. plreq ArtTile_ArtNem_SpecialRings, ArtNem_SpecialRings
  86156. plreq ArtTile_ArtNem_SpecialStart, ArtNem_SpecialStart
  86157. plreq ArtTile_ArtNem_SpecialPlayerVSPlayer, ArtNem_SpecialPlayerVSPlayer
  86158. plreq ArtTile_ArtNem_SpecialBack, ArtNem_SpecialBack
  86159. plreq ArtTile_ArtNem_SpecialStars, ArtNem_SpecialStars
  86160. plreq ArtTile_ArtNem_SpecialTailsText, ArtNem_SpecialTailsText
  86161. PlrList_SpecialStage_End
  86162. ;---------------------------------------------------------------------------------------
  86163. ; Pattern load queue
  86164. ; Special Stage Bombs
  86165. ;---------------------------------------------------------------------------------------
  86166. PlrList_SpecStageBombs: plrlistheader
  86167. plreq ArtTile_ArtNem_SpecialBomb, ArtNem_SpecialBomb
  86168. PlrList_SpecStageBombs_End
  86169. ;---------------------------------------------------------------------------------------
  86170. ; Pattern load queue
  86171. ; WFZ Boss
  86172. ;---------------------------------------------------------------------------------------
  86173. PlrList_WfzBoss: plrlistheader
  86174. plreq ArtTile_ArtNem_WFZBoss, ArtNem_WFZBoss
  86175. plreq ArtTile_ArtNem_RobotnikRunning, ArtNem_RobotnikRunning
  86176. plreq ArtTile_ArtNem_RobotnikUpper, ArtNem_RobotnikUpper
  86177. plreq ArtTile_ArtNem_RobotnikLower, ArtNem_RobotnikLower
  86178. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86179. PlrList_WfzBoss_End
  86180. ;---------------------------------------------------------------------------------------
  86181. ; Pattern load queue
  86182. ; Tornado
  86183. ;---------------------------------------------------------------------------------------
  86184. PlrList_Tornado: plrlistheader
  86185. plreq ArtTile_ArtNem_Tornado, ArtNem_Tornado
  86186. plreq ArtTile_ArtNem_TornadoThruster, ArtNem_TornadoThruster
  86187. plreq ArtTile_ArtNem_Clouds, ArtNem_Clouds
  86188. PlrList_Tornado_End
  86189. ;---------------------------------------------------------------------------------------
  86190. ; Pattern load queue
  86191. ; Capsule/Egg Prison
  86192. ;---------------------------------------------------------------------------------------
  86193. PlrList_Capsule: plrlistheader
  86194. plreq ArtTile_ArtNem_Capsule, ArtNem_Capsule
  86195. PlrList_Capsule_End
  86196. ;---------------------------------------------------------------------------------------
  86197. ; Pattern load queue
  86198. ; Normal explosion
  86199. ;---------------------------------------------------------------------------------------
  86200. PlrList_Explosion: plrlistheader
  86201. plreq ArtTile_ArtNem_Explosion, ArtNem_Explosion
  86202. PlrList_Explosion_End
  86203. ;---------------------------------------------------------------------------------------
  86204. ; Pattern load queue
  86205. ; Tails end of level results screen
  86206. ;---------------------------------------------------------------------------------------
  86207. PlrList_ResultsTails: plrlistheader
  86208. plreq ArtTile_ArtNem_TitleCard, ArtNem_TitleCard
  86209. plreq ArtTile_ArtNem_ResultsText, ArtNem_ResultsText
  86210. plreq ArtTile_ArtNem_MiniCharacter, ArtNem_MiniTails
  86211. plreq ArtTile_ArtNem_Perfect, ArtNem_Perfect
  86212. PlrList_ResultsTails_End
  86213.  
  86214.  
  86215.  
  86216.  
  86217. ;---------------------------------------------------------------------------------------
  86218. ; Weird revision-specific duplicates of portions of the PLR lists (unused)
  86219. ;---------------------------------------------------------------------------------------
  86220. if gameRevision=0
  86221. ; half of PlrList_ResultsTails
  86222. plreq ArtTile_ArtNem_MiniCharacter, ArtNem_MiniTails
  86223. plreq ArtTile_ArtNem_Perfect, ArtNem_Perfect
  86224. PlrList_ResultsTails_Dup_End
  86225. dc.l 0
  86226. elseif gameRevision=2
  86227. ; half of the second ARZ PLR list
  86228. ;plreq ArtTile_ArtNem_Grounder, ArtNem_Grounder ; cut in half
  86229. ;dc.l ArtNem_Grounder
  86230. dc.w tiles_to_bytes(ArtTile_ArtNem_Grounder)
  86231.  
  86232. plreq ArtTile_ArtNem_BigBubbles, ArtNem_BigBubbles
  86233. plreq ArtTile_ArtNem_Spikes, ArtNem_Spikes
  86234. plreq ArtTile_ArtNem_LeverSpring, ArtNem_LeverSpring
  86235. plreq ArtTile_ArtNem_VrtclSprng, ArtNem_VrtclSprng
  86236. plreq ArtTile_ArtNem_HrzntlSprng, ArtNem_HrzntlSprng
  86237. PlrList_Arz2_Dup_End
  86238. ;---------------------------------------------------------------------------------------
  86239. ; Pattern load queue (duplicate)
  86240. ; SCZ Primary
  86241. ;---------------------------------------------------------------------------------------
  86242. PlrList_Scz1_Dup: plrlistheader
  86243. plreq ArtTile_ArtNem_Tornado, ArtNem_Tornado
  86244. PlrList_Scz1_Dup_End
  86245. ;---------------------------------------------------------------------------------------
  86246. ; Pattern load queue (duplicate)
  86247. ; SCZ Secondary
  86248. ;---------------------------------------------------------------------------------------
  86249. PlrList_Scz2_Dup: plrlistheader
  86250. plreq ArtTile_ArtNem_Clouds, ArtNem_Clouds
  86251. plreq ArtTile_ArtNem_WfzVrtclPrpllr, ArtNem_WfzVrtclPrpllr
  86252. plreq ArtTile_ArtNem_WfzHrzntlPrpllr, ArtNem_WfzHrzntlPrpllr
  86253. plreq ArtTile_ArtNem_Balkrie, ArtNem_Balkrie
  86254. plreq ArtTile_ArtNem_Turtloid, ArtNem_Turtloid
  86255. plreq ArtTile_ArtNem_Nebula, ArtNem_Nebula
  86256. PlrList_Scz2_Dup_End
  86257. ;---------------------------------------------------------------------------------------
  86258. ; Pattern load queue (duplicate)
  86259. ; Sonic end of level results screen
  86260. ;---------------------------------------------------------------------------------------
  86261. PlrList_Results_Dup: plrlistheader
  86262. plreq ArtTile_ArtNem_TitleCard, ArtNem_TitleCard
  86263. plreq ArtTile_ArtNem_ResultsText, ArtNem_ResultsText
  86264. plreq ArtTile_ArtNem_MiniCharacter, ArtNem_MiniSonic
  86265. plreq ArtTile_ArtNem_Perfect, ArtNem_Perfect
  86266. PlrList_Results_Dup_End
  86267. ;---------------------------------------------------------------------------------------
  86268. ; Pattern load queue (duplicate)
  86269. ; End of level signpost
  86270. ;---------------------------------------------------------------------------------------
  86271. PlrList_Signpost_Dup: plrlistheader
  86272. plreq ArtTile_ArtNem_Signpost, ArtNem_Signpost
  86273. PlrList_Signpost_Dup_End
  86274. ;---------------------------------------------------------------------------------------
  86275. ; Pattern load queue (duplicate)
  86276. ; CPZ Boss
  86277. ;---------------------------------------------------------------------------------------
  86278. PlrList_CpzBoss_Dup: plrlistheader
  86279. plreq ArtTile_ArtNem_Eggpod_3, ArtNem_Eggpod
  86280. plreq ArtTile_ArtNem_CPZBoss, ArtNem_CPZBoss
  86281. plreq ArtTile_ArtNem_EggpodJets_1, ArtNem_EggpodJets
  86282. plreq ArtTile_ArtNem_BossSmoke_1, ArtNem_BossSmoke
  86283. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86284. PlrList_CpzBoss_Dup_End
  86285. ;---------------------------------------------------------------------------------------
  86286. ; Pattern load queue (duplicate)
  86287. ; EHZ Boss
  86288. ;---------------------------------------------------------------------------------------
  86289. PlrList_EhzBoss_Dup: plrlistheader
  86290. plreq ArtTile_ArtNem_Eggpod_1, ArtNem_Eggpod
  86291. plreq ArtTile_ArtNem_EHZBoss, ArtNem_EHZBoss
  86292. plreq ArtTile_ArtNem_EggChoppers, ArtNem_EggChoppers
  86293. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86294. PlrList_EhzBoss_Dup_End
  86295. ;---------------------------------------------------------------------------------------
  86296. ; Pattern load queue (duplicate)
  86297. ; HTZ Boss
  86298. ;---------------------------------------------------------------------------------------
  86299. PlrList_HtzBoss_Dup: plrlistheader
  86300. plreq ArtTile_ArtNem_Eggpod_2, ArtNem_Eggpod
  86301. plreq ArtTile_ArtNem_HTZBoss, ArtNem_HTZBoss
  86302. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86303. plreq ArtTile_ArtNem_BossSmoke_2, ArtNem_BossSmoke
  86304. PlrList_HtzBoss_Dup_End
  86305. ;---------------------------------------------------------------------------------------
  86306. ; Pattern load queue (duplicate)
  86307. ; ARZ Boss
  86308. ;---------------------------------------------------------------------------------------
  86309. PlrList_ArzBoss_Dup: plrlistheader
  86310. plreq ArtTile_ArtNem_Eggpod_4, ArtNem_Eggpod
  86311. plreq ArtTile_ArtNem_ARZBoss, ArtNem_ARZBoss
  86312. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86313. PlrList_ArzBoss_Dup_End
  86314. ;---------------------------------------------------------------------------------------
  86315. ; Pattern load queue (duplicate)
  86316. ; MCZ Boss
  86317. ;---------------------------------------------------------------------------------------
  86318. PlrList_MczBoss_Dup: plrlistheader
  86319. plreq ArtTile_ArtNem_Eggpod_4, ArtNem_Eggpod
  86320. plreq ArtTile_ArtNem_MCZBoss, ArtNem_MCZBoss
  86321. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86322. PlrList_MczBoss_Dup_End
  86323. ;---------------------------------------------------------------------------------------
  86324. ; Pattern load queue (duplicate)
  86325. ; CNZ Boss
  86326. ;---------------------------------------------------------------------------------------
  86327. PlrList_CnzBoss_Dup: plrlistheader
  86328. plreq ArtTile_ArtNem_Eggpod_4, ArtNem_Eggpod
  86329. plreq ArtTile_ArtNem_CNZBoss, ArtNem_CNZBoss
  86330. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86331. PlrList_CnzBoss_Dup_End
  86332. ;---------------------------------------------------------------------------------------
  86333. ; Pattern load queue (duplicate)
  86334. ; MTZ Boss
  86335. ;---------------------------------------------------------------------------------------
  86336. PlrList_MtzBoss_Dup: plrlistheader
  86337. plreq ArtTile_ArtNem_Eggpod_4, ArtNem_Eggpod
  86338. plreq ArtTile_ArtNem_MTZBoss, ArtNem_MTZBoss
  86339. plreq ArtTile_ArtNem_EggpodJets_2, ArtNem_EggpodJets
  86340. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86341. PlrList_MtzBoss_Dup_End
  86342. ;---------------------------------------------------------------------------------------
  86343. ; Pattern load queue (duplicate)
  86344. ; OOZ Boss
  86345. ;---------------------------------------------------------------------------------------
  86346. PlrList_OozBoss_Dup: plrlistheader
  86347. plreq ArtTile_ArtNem_OOZBoss, ArtNem_OOZBoss
  86348. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86349. PlrList_OozBoss_Dup_End
  86350. ;---------------------------------------------------------------------------------------
  86351. ; Pattern load queue (duplicate)
  86352. ; Fiery Explosion
  86353. ;---------------------------------------------------------------------------------------
  86354. PlrList_FieryExplosion_Dup: plrlistheader
  86355. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86356. PlrList_FieryExplosion_Dup_End
  86357. ;---------------------------------------------------------------------------------------
  86358. ; Pattern load queue (duplicate)
  86359. ; Death Egg
  86360. ;---------------------------------------------------------------------------------------
  86361. PlrList_DezBoss_Dup: plrlistheader
  86362. plreq ArtTile_ArtNem_DEZBoss, ArtNem_DEZBoss
  86363. PlrList_DezBoss_Dup_End
  86364. ;---------------------------------------------------------------------------------------
  86365. ; Pattern load queue (duplicate)
  86366. ; EHZ Animals
  86367. ;---------------------------------------------------------------------------------------
  86368. PlrList_EhzAnimals_Dup: plrlistheader
  86369. plreq ArtTile_ArtNem_Animal_1, ArtNem_Squirrel
  86370. plreq ArtTile_ArtNem_Animal_2, ArtNem_Bird
  86371. PlrList_EhzAnimals_Dup_End
  86372. ;---------------------------------------------------------------------------------------
  86373. ; Pattern load queue (duplicate)
  86374. ; MCZ Animals
  86375. ;---------------------------------------------------------------------------------------
  86376. PlrList_MczAnimals_Dup: plrlistheader
  86377. plreq ArtTile_ArtNem_Animal_1, ArtNem_Mouse
  86378. plreq ArtTile_ArtNem_Animal_2, ArtNem_Chicken
  86379. PlrList_MczAnimals_Dup_End
  86380. ;---------------------------------------------------------------------------------------
  86381. ; Pattern load queue (duplicate)
  86382. ; HTZ/MTZ/WFZ animals
  86383. ;---------------------------------------------------------------------------------------
  86384. PlrList_HtzAnimals_Dup:
  86385. PlrList_MtzAnimals_Dup:
  86386. PlrList_WfzAnimals_Dup: plrlistheader
  86387. plreq ArtTile_ArtNem_Animal_1, ArtNem_Beaver
  86388. plreq ArtTile_ArtNem_Animal_2, ArtNem_Eagle
  86389. PlrList_HtzAnimals_Dup_End
  86390. PlrList_MtzAnimals_Dup_End
  86391. PlrList_WfzAnimals_Dup_End
  86392. ;---------------------------------------------------------------------------------------
  86393. ; Pattern load queue (duplicate)
  86394. ; DEZ Animals
  86395. ;---------------------------------------------------------------------------------------
  86396. PlrList_DezAnimals_Dup: plrlistheader
  86397. plreq ArtTile_ArtNem_Animal_1, ArtNem_Pig
  86398. plreq ArtTile_ArtNem_Animal_2, ArtNem_Chicken
  86399. PlrList_DezAnimals_Dup_End
  86400. ;---------------------------------------------------------------------------------------
  86401. ; Pattern load queue (duplicate)
  86402. ; HPZ animals
  86403. ;---------------------------------------------------------------------------------------
  86404. PlrList_HpzAnimals_Dup: plrlistheader
  86405. plreq ArtTile_ArtNem_Animal_1, ArtNem_Mouse
  86406. plreq ArtTile_ArtNem_Animal_2, ArtNem_Seal
  86407. PlrList_HpzAnimals_Dup_End
  86408. ;---------------------------------------------------------------------------------------
  86409. ; Pattern load queue (duplicate)
  86410. ; OOZ Animals
  86411. ;---------------------------------------------------------------------------------------
  86412. PlrList_OozAnimals_Dup: plrlistheader
  86413. plreq ArtTile_ArtNem_Animal_1, ArtNem_Penguin
  86414. plreq ArtTile_ArtNem_Animal_2, ArtNem_Seal
  86415. PlrList_OozAnimals_Dup_End
  86416. ;---------------------------------------------------------------------------------------
  86417. ; Pattern load queue (duplicate)
  86418. ; SCZ Animals
  86419. ;---------------------------------------------------------------------------------------
  86420. PlrList_SczAnimals_Dup: plrlistheader
  86421. plreq ArtTile_ArtNem_Animal_1, ArtNem_Turtle
  86422. plreq ArtTile_ArtNem_Animal_2, ArtNem_Chicken
  86423. PlrList_SczAnimals_Dup_End
  86424. ;---------------------------------------------------------------------------------------
  86425. ; Pattern load queue (duplicate)
  86426. ; CNZ Animals
  86427. ;---------------------------------------------------------------------------------------
  86428. PlrList_CnzAnimals_Dup: plrlistheader
  86429. plreq ArtTile_ArtNem_Animal_1, ArtNem_Bear
  86430. plreq ArtTile_ArtNem_Animal_2, ArtNem_Bird
  86431. PlrList_CnzAnimals_Dup_End
  86432. ;---------------------------------------------------------------------------------------
  86433. ; Pattern load queue (duplicate)
  86434. ; CPZ Animals
  86435. ;---------------------------------------------------------------------------------------
  86436. PlrList_CpzAnimals_Dup: plrlistheader
  86437. plreq ArtTile_ArtNem_Animal_1, ArtNem_Rabbit
  86438. plreq ArtTile_ArtNem_Animal_2, ArtNem_Eagle
  86439. PlrList_CpzAnimals_Dup_End
  86440. ;---------------------------------------------------------------------------------------
  86441. ; Pattern load queue (duplicate)
  86442. ; ARZ Animals
  86443. ;---------------------------------------------------------------------------------------
  86444. PlrList_ArzAnimals_Dup: plrlistheader
  86445. plreq ArtTile_ArtNem_Animal_1, ArtNem_Penguin
  86446. plreq ArtTile_ArtNem_Animal_2, ArtNem_Bird
  86447. PlrList_ArzAnimals_Dup_End
  86448. ;---------------------------------------------------------------------------------------
  86449. ; Pattern load queue (duplicate)
  86450. ; Special Stage
  86451. ;---------------------------------------------------------------------------------------
  86452. PlrList_SpecialStage_Dup: plrlistheader
  86453. plreq ArtTile_ArtNem_SpecialEmerald, ArtNem_SpecialEmerald
  86454. plreq ArtTile_ArtNem_SpecialMessages, ArtNem_SpecialMessages
  86455. plreq ArtTile_ArtNem_SpecialHUD, ArtNem_SpecialHUD
  86456. plreq ArtTile_ArtNem_SpecialFlatShadow, ArtNem_SpecialFlatShadow
  86457. plreq ArtTile_ArtNem_SpecialDiagShadow, ArtNem_SpecialDiagShadow
  86458. plreq ArtTile_ArtNem_SpecialSideShadow, ArtNem_SpecialSideShadow
  86459. plreq ArtTile_ArtNem_SpecialExplosion, ArtNem_SpecialExplosion
  86460. plreq ArtTile_ArtNem_SpecialRings, ArtNem_SpecialRings
  86461. plreq ArtTile_ArtNem_SpecialStart, ArtNem_SpecialStart
  86462. plreq ArtTile_ArtNem_SpecialPlayerVSPlayer, ArtNem_SpecialPlayerVSPlayer
  86463. plreq ArtTile_ArtNem_SpecialBack, ArtNem_SpecialBack
  86464. plreq ArtTile_ArtNem_SpecialStars, ArtNem_SpecialStars
  86465. plreq ArtTile_ArtNem_SpecialTailsText, ArtNem_SpecialTailsText
  86466. PlrList_SpecialStage_Dup_End
  86467. ;---------------------------------------------------------------------------------------
  86468. ; Pattern load queue (duplicate)
  86469. ; Special Stage Bombs
  86470. ;---------------------------------------------------------------------------------------
  86471. PlrList_SpecStageBombs_Dup: plrlistheader
  86472. plreq ArtTile_ArtNem_SpecialBomb, ArtNem_SpecialBomb
  86473. PlrList_SpecStageBombs_Dup_End
  86474. ;---------------------------------------------------------------------------------------
  86475. ; Pattern load queue (duplicate)
  86476. ; WFZ Boss
  86477. ;---------------------------------------------------------------------------------------
  86478. PlrList_WfzBoss_Dup: plrlistheader
  86479. plreq ArtTile_ArtNem_WFZBoss, ArtNem_WFZBoss
  86480. plreq ArtTile_ArtNem_RobotnikRunning, ArtNem_RobotnikRunning
  86481. plreq ArtTile_ArtNem_RobotnikUpper, ArtNem_RobotnikUpper
  86482. plreq ArtTile_ArtNem_RobotnikLower, ArtNem_RobotnikLower
  86483. plreq ArtTile_ArtNem_FieryExplosion, ArtNem_FieryExplosion
  86484. PlrList_WfzBoss_Dup_End
  86485. ;---------------------------------------------------------------------------------------
  86486. ; Pattern load queue (duplicate)
  86487. ; Tornado
  86488. ;---------------------------------------------------------------------------------------
  86489. PlrList_Tornado_Dup: plrlistheader
  86490. plreq ArtTile_ArtNem_Tornado, ArtNem_Tornado
  86491. plreq ArtTile_ArtNem_TornadoThruster, ArtNem_TornadoThruster
  86492. plreq ArtTile_ArtNem_Clouds, ArtNem_Clouds
  86493. PlrList_Tornado_Dup_End
  86494. ;---------------------------------------------------------------------------------------
  86495. ; Pattern load queue (duplicate)
  86496. ; Capsule/Egg Prison
  86497. ;---------------------------------------------------------------------------------------
  86498. PlrList_Capsule_Dup: plrlistheader
  86499. plreq ArtTile_ArtNem_Capsule, ArtNem_Capsule
  86500. PlrList_Capsule_Dup_End
  86501. ;---------------------------------------------------------------------------------------
  86502. ; Pattern load queue (duplicate)
  86503. ; Normal explosion
  86504. ;---------------------------------------------------------------------------------------
  86505. PlrList_Explosion_Dup: plrlistheader
  86506. plreq ArtTile_ArtNem_Explosion, ArtNem_Explosion
  86507. PlrList_Explosion_Dup_End
  86508. ;---------------------------------------------------------------------------------------
  86509. ; Pattern load queue (duplicate)
  86510. ; Tails end of level results screen
  86511. ;---------------------------------------------------------------------------------------
  86512. PlrList_ResultsTails_Dup: plrlistheader
  86513. plreq ArtTile_ArtNem_TitleCard, ArtNem_TitleCard
  86514. plreq ArtTile_ArtNem_ResultsText, ArtNem_ResultsText
  86515. plreq ArtTile_ArtNem_MiniCharacter, ArtNem_MiniTails
  86516. plreq ArtTile_ArtNem_Perfect, ArtNem_Perfect
  86517. PlrList_ResultsTails_Dup_End
  86518. endif
  86519.  
  86520.  
  86521.  
  86522. ;---------------------------------------------------------------------------------------
  86523. ; Curve and resistance mapping
  86524. ;---------------------------------------------------------------------------------------
  86525. ColCurveMap: BINCLUDE "collision/Curve and resistance mapping.bin"
  86526. even
  86527. ;--------------------------------------------------------------------------------------
  86528. ; Collision arrays
  86529. ;--------------------------------------------------------------------------------------
  86530. ColArray: BINCLUDE "collision/Collision array 1.bin"
  86531. ColArray2: BINCLUDE "collision/Collision array 2.bin"
  86532. even
  86533. ;---------------------------------------------------------------------------------------
  86534. ; EHZ and HTZ primary 16x16 collision index (Kosinski compression)
  86535. ColP_EHZHTZ: BINCLUDE "collision/EHZ and HTZ primary 16x16 collision index.bin"
  86536. even
  86537. ;---------------------------------------------------------------------------------------
  86538. ; EHZ and HTZ secondary 16x16 collision index (Kosinski compression)
  86539. ColS_EHZHTZ: BINCLUDE "collision/EHZ and HTZ secondary 16x16 collision index.bin"
  86540. even
  86541. ;---------------------------------------------------------------------------------------
  86542. ; MTZ primary 16x16 collision index (Kosinski compression)
  86543. ColP_MTZ: BINCLUDE "collision/MTZ primary 16x16 collision index.bin"
  86544. even
  86545. ;---------------------------------------------------------------------------------------
  86546. ; HPZ primary 16x16 collision index (Kosinski compression)
  86547. ColP_HPZ: ;BINCLUDE "collision/HPZ primary 16x16 collision index.bin"
  86548. ;even
  86549. ;---------------------------------------------------------------------------------------
  86550. ; HPZ secondary 16x16 collision index (Kosinski compression)
  86551. ColS_HPZ: ;BINCLUDE "collision/HPZ secondary 16x16 collision index.bin"
  86552. ;even
  86553. ;---------------------------------------------------------------------------------------
  86554. ; OOZ primary 16x16 collision index (Kosinski compression)
  86555. ColP_OOZ: BINCLUDE "collision/OOZ primary 16x16 collision index.bin"
  86556. even
  86557. ;---------------------------------------------------------------------------------------
  86558. ; MCZ primary 16x16 collision index (Kosinski compression)
  86559. ColP_MCZ: BINCLUDE "collision/MCZ primary 16x16 collision index.bin"
  86560. even
  86561. ;---------------------------------------------------------------------------------------
  86562. ; CNZ primary 16x16 collision index (Kosinski compression)
  86563. ColP_CNZ: BINCLUDE "collision/CNZ primary 16x16 collision index.bin"
  86564. even
  86565. ;---------------------------------------------------------------------------------------
  86566. ; CNZ secondary 16x16 collision index (Kosinski compression)
  86567. ColS_CNZ: BINCLUDE "collision/CNZ secondary 16x16 collision index.bin"
  86568. even
  86569. ;---------------------------------------------------------------------------------------
  86570. ; CPZ and DEZ primary 16x16 collision index (Kosinski compression)
  86571. ColP_CPZDEZ: BINCLUDE "collision/CPZ and DEZ primary 16x16 collision index.bin"
  86572. even
  86573. ;---------------------------------------------------------------------------------------
  86574. ; CPZ and DEZ secondary 16x16 collision index (Kosinski compression)
  86575. ColS_CPZDEZ: BINCLUDE "collision/CPZ and DEZ secondary 16x16 collision index.bin"
  86576. even
  86577. ;---------------------------------------------------------------------------------------
  86578. ; ARZ primary 16x16 collision index (Kosinski compression)
  86579. ColP_ARZ: BINCLUDE "collision/ARZ primary 16x16 collision index.bin"
  86580. even
  86581. ;---------------------------------------------------------------------------------------
  86582. ; ARZ secondary 16x16 collision index (Kosinski compression)
  86583. ColS_ARZ: BINCLUDE "collision/ARZ secondary 16x16 collision index.bin"
  86584. even
  86585. ;---------------------------------------------------------------------------------------
  86586. ; WFZ/SCZ primary 16x16 collision index (Kosinski compression)
  86587. ColP_WFZSCZ: BINCLUDE "collision/WFZ and SCZ primary 16x16 collision index.bin"
  86588. even
  86589. ;---------------------------------------------------------------------------------------
  86590. ; WFZ/SCZ secondary 16x16 collision index (Kosinski compression)
  86591. ColS_WFZSCZ: BINCLUDE "collision/WFZ and SCZ secondary 16x16 collision index.bin"
  86592. even
  86593. ;---------------------------------------------------------------------------------------
  86594.  
  86595. ColP_Invalid:
  86596.  
  86597.  
  86598.  
  86599.  
  86600. ;---------------------------------------------------------------------------------------
  86601. ; Offset index of level layouts
  86602. ; Two entries per zone, pointing to the level layouts for acts 1 and 2 of each zone
  86603. ; respectively.
  86604. ;---------------------------------------------------------------------------------------
  86605. Off_Level: zoneOrderedOffsetTable 2,2
  86606. zoneOffsetTableEntry.w Level_EHZ1
  86607. zoneOffsetTableEntry.w Level_EHZ2 ; 1
  86608. zoneOffsetTableEntry.w Level_EHZ1 ; 2
  86609. zoneOffsetTableEntry.w Level_EHZ1 ; 3
  86610. zoneOffsetTableEntry.w Level_EHZ1 ; 4
  86611. zoneOffsetTableEntry.w Level_EHZ1 ; 5
  86612. zoneOffsetTableEntry.w Level_EHZ1 ; 6
  86613. zoneOffsetTableEntry.w Level_EHZ1 ; 7
  86614. zoneOffsetTableEntry.w Level_MTZ1 ; 8
  86615. zoneOffsetTableEntry.w Level_MTZ2 ; 9
  86616. zoneOffsetTableEntry.w Level_MTZ3 ; 10
  86617. zoneOffsetTableEntry.w Level_MTZ3 ; 11
  86618. zoneOffsetTableEntry.w Level_WFZ ; 12
  86619. zoneOffsetTableEntry.w Level_WFZ ; 13
  86620. zoneOffsetTableEntry.w Level_HTZ1 ; 14
  86621. zoneOffsetTableEntry.w Level_HTZ2 ; 15
  86622. zoneOffsetTableEntry.w Level_HPZ1 ; 16
  86623. zoneOffsetTableEntry.w Level_HPZ1 ; 17
  86624. zoneOffsetTableEntry.w Level_EHZ1 ; 18
  86625. zoneOffsetTableEntry.w Level_EHZ1 ; 19
  86626. zoneOffsetTableEntry.w Level_OOZ1 ; 20
  86627. zoneOffsetTableEntry.w Level_OOZ2 ; 21
  86628. zoneOffsetTableEntry.w Level_MCZ1 ; 22
  86629. zoneOffsetTableEntry.w Level_MCZ2 ; 23
  86630. zoneOffsetTableEntry.w Level_CNZ1 ; 24
  86631. zoneOffsetTableEntry.w Level_CNZ2 ; 25
  86632. zoneOffsetTableEntry.w Level_CPZ1 ; 26
  86633. zoneOffsetTableEntry.w Level_CPZ2 ; 27
  86634. zoneOffsetTableEntry.w Level_DEZ ; 28
  86635. zoneOffsetTableEntry.w Level_DEZ ; 29
  86636. zoneOffsetTableEntry.w Level_ARZ1 ; 30
  86637. zoneOffsetTableEntry.w Level_ARZ2 ; 31
  86638. zoneOffsetTableEntry.w Level_SCZ ; 32
  86639. zoneOffsetTableEntry.w Level_SCZ ; 33
  86640. zoneTableEnd
  86641. ;---------------------------------------------------------------------------------------
  86642. ; EHZ act 1 level layout (Kosinski compression)
  86643. Level_EHZ1: BINCLUDE "level/layout/EHZ_1.bin"
  86644. even
  86645. ;---------------------------------------------------------------------------------------
  86646. ; EHZ act 2 level layout (Kosinski compression)
  86647. Level_EHZ2: BINCLUDE "level/layout/EHZ_2.bin"
  86648. even
  86649. ;---------------------------------------------------------------------------------------
  86650. ; MTZ act 1 level layout (Kosinski compression)
  86651. Level_MTZ1: BINCLUDE "level/layout/MTZ_1.bin"
  86652. even
  86653. ;---------------------------------------------------------------------------------------
  86654. ; MTZ act 2 level layout (Kosinski compression)
  86655. Level_MTZ2: BINCLUDE "level/layout/MTZ_2.bin"
  86656. even
  86657. ;---------------------------------------------------------------------------------------
  86658. ; MTZ act 3 level layout (Kosinski compression)
  86659. Level_MTZ3: BINCLUDE "level/layout/MTZ_3.bin"
  86660. even
  86661. ;---------------------------------------------------------------------------------------
  86662. ; WFZ level layout (Kosinski compression)
  86663. Level_WFZ: BINCLUDE "level/layout/WFZ.bin"
  86664. even
  86665. ;---------------------------------------------------------------------------------------
  86666. ; HTZ act 1 level layout (Kosinski compression)
  86667. Level_HTZ1: BINCLUDE "level/layout/HTZ_1.bin"
  86668. even
  86669. ;---------------------------------------------------------------------------------------
  86670. ; HTZ act 2 level layout (Kosinski compression)
  86671. Level_HTZ2: BINCLUDE "level/layout/HTZ_2.bin"
  86672. even
  86673. ;---------------------------------------------------------------------------------------
  86674. ; HPZ act 1 level layout (Kosinski compression)
  86675. Level_HPZ1: ;BINCLUDE "level/layout/HPZ_1.bin"
  86676. ;even
  86677. ;---------------------------------------------------------------------------------------
  86678. ; OOZ act 1 level layout (Kosinski compression)
  86679. Level_OOZ1: BINCLUDE "level/layout/OOZ_1.bin"
  86680. even
  86681. ;---------------------------------------------------------------------------------------
  86682. ; OOZ act 2 level layout (Kosinski compression)
  86683. Level_OOZ2: BINCLUDE "level/layout/OOZ_2.bin"
  86684. even
  86685. ;---------------------------------------------------------------------------------------
  86686. ; MCZ act 1 level layout (Kosinski compression)
  86687. Level_MCZ1: BINCLUDE "level/layout/MCZ_1.bin"
  86688. even
  86689. ;---------------------------------------------------------------------------------------
  86690. ; MCZ act 2 level layout (Kosinski compression)
  86691. Level_MCZ2: BINCLUDE "level/layout/MCZ_2.bin"
  86692. even
  86693. ;---------------------------------------------------------------------------------------
  86694. ; CNZ act 1 level layout (Kosinski compression)
  86695. Level_CNZ1: BINCLUDE "level/layout/CNZ_1.bin"
  86696. even
  86697. ;---------------------------------------------------------------------------------------
  86698. ; CNZ act 2 level layout (Kosinski compression)
  86699. Level_CNZ2: BINCLUDE "level/layout/CNZ_2.bin"
  86700. even
  86701. ;---------------------------------------------------------------------------------------
  86702. ; CPZ act 1 level layout (Kosinski compression)
  86703. Level_CPZ1: BINCLUDE "level/layout/CPZ_1.bin"
  86704. even
  86705. ;---------------------------------------------------------------------------------------
  86706. ; CPZ act 2 level layout (Kosinski compression)
  86707. Level_CPZ2: BINCLUDE "level/layout/CPZ_2.bin"
  86708. even
  86709. ;---------------------------------------------------------------------------------------
  86710. ; DEZ level layout (Kosinski compression)
  86711. Level_DEZ: BINCLUDE "level/layout/DEZ.bin"
  86712. even
  86713. ;---------------------------------------------------------------------------------------
  86714. ; ARZ act 1 level layout (Kosinski compression)
  86715. Level_ARZ1: BINCLUDE "level/layout/ARZ_1.bin"
  86716. even
  86717.  
  86718. ;---------------------------------------------------------------------------------------
  86719. ; ARZ act 2 level layout (Kosinski compression)
  86720. Level_ARZ2: BINCLUDE "level/layout/ARZ_2.bin"
  86721. even
  86722. ;---------------------------------------------------------------------------------------
  86723. ; SCZ level layout (Kosinski compression)
  86724. Level_SCZ: BINCLUDE "level/layout/SCZ.bin"
  86725. even
  86726.  
  86727.  
  86728.  
  86729.  
  86730. ;---------------------------------------------------------------------------------------
  86731. ; Uncompressed art
  86732. ; Animated flowers in EHZ and HTZ ; ArtUnc_49714: ArtUnc_49794: ArtUnc_49814: ArtUnc_49894:
  86733. ;---------------------------------------------------------------------------------------
  86734. ArtUnc_Flowers1: BINCLUDE "art/uncompressed/EHZ and HTZ flowers - 1.bin"
  86735. ArtUnc_Flowers2: BINCLUDE "art/uncompressed/EHZ and HTZ flowers - 2.bin"
  86736. ArtUnc_Flowers3: BINCLUDE "art/uncompressed/EHZ and HTZ flowers - 3.bin"
  86737. ArtUnc_Flowers4: BINCLUDE "art/uncompressed/EHZ and HTZ flowers - 4.bin"
  86738. ;---------------------------------------------------------------------------------------
  86739. ; Uncompressed art
  86740. ; Pulsing thing against checkered backing from EHZ ; ArtUnc_49914:
  86741. ArtUnc_EHZPulseBall: BINCLUDE "art/uncompressed/Pulsing ball against checkered background (EHZ).bin"
  86742. ;---------------------------------------------------------------------------------------
  86743. ; Nemesis compressed art (192 blocks)
  86744. ; Dynamically reloaded cliffs in background from HTZ ; ArtNem_49A14: ArtUnc_HTZCliffs:
  86745. ArtNem_HTZCliffs: BINCLUDE "art/nemesis/Dynamically reloaded cliffs in HTZ background.bin"
  86746. ;---------------------------------------------------------------------------------------
  86747. ; Uncompressed art
  86748. ; Dynamically reloaded clouds in background from HTZ ; ArtUnc_4A33E:
  86749. ArtUnc_HTZClouds: BINCLUDE "art/uncompressed/Background clouds (HTZ).bin"
  86750. ;---------------------------------------------------------------------------------------
  86751. ; Uncompressed art
  86752. ; Spinning metal cylinder patterns in MTZ ; ArtUnc_4A73E:
  86753. ArtUnc_MTZCylinder: BINCLUDE "art/uncompressed/Spinning metal cylinder (MTZ).bin"
  86754. ;---------------------------------------------------------------------------------------
  86755. ; Uncompressed art
  86756. ; Lava patterns in MTZ and HTZ ; ArtUnc_4B73E:
  86757. ArtUnc_Lava: BINCLUDE "art/uncompressed/Lava.bin"
  86758. ;---------------------------------------------------------------------------------------
  86759. ; Uncompressed art
  86760. ; Animated section of MTZ background ; ArtUnc_4BD3E:
  86761. ArtUnc_MTZAnimBack: BINCLUDE "art/uncompressed/Animated section of MTZ background.bin"
  86762. ;---------------------------------------------------------------------------------------
  86763. ; Uncompressed art
  86764. ; Pulsing orb in HPZ
  86765. ArtUnc_HPZPulseOrb: ;BINCLUDE "art/uncompressed/Pulsing orb (HPZ).bin"
  86766. ;---------------------------------------------------------------------------------------
  86767. ; Uncompressed art
  86768. ; Pulsing ball in OOZ ; ArtUnc_4BF7E:
  86769. ArtUnc_OOZPulseBall: BINCLUDE "art/uncompressed/Pulsing ball (OOZ).bin"
  86770. ;---------------------------------------------------------------------------------------
  86771. ; Uncompressed art
  86772. ; Square rotating around ball in OOZ ; ArtUnc_4C0FE: ArtUnc_4C2FE:
  86773. ArtUnc_OOZSquareBall1: BINCLUDE "art/uncompressed/Square rotating around ball in OOZ - 1.bin"
  86774. ArtUnc_OOZSquareBall2: BINCLUDE "art/uncompressed/Square rotating around ball in OOZ - 2.bin"
  86775. ;---------------------------------------------------------------------------------------
  86776. ; Uncompressed art
  86777. ; Oil in OOZ ; ArtUnc_4C4FE: ArtUnc_4CCFE:
  86778. ArtUnc_Oil1: BINCLUDE "art/uncompressed/Oil - 1.bin"
  86779. ArtUnc_Oil2: BINCLUDE "art/uncompressed/Oil - 2.bin"
  86780. ;---------------------------------------------------------------------------------------
  86781. ; Uncompressed art
  86782. ; Flipping foreground section in CNZ ; ArtUnc_4D4FE:
  86783. ArtUnc_CNZFlipTiles: BINCLUDE "art/uncompressed/Flipping foreground section (CNZ).bin"
  86784. ;---------------------------------------------------------------------------------------
  86785. ; Uncompressed art
  86786. ; Bonus pictures for slots in CNZ ; ArtUnc_4EEFE:
  86787. ArtUnc_CNZSlotPics: BINCLUDE "art/uncompressed/Slot pictures.bin"
  86788. ;---------------------------------------------------------------------------------------
  86789. ; Uncompressed art
  86790. ; Animated background section in CPZ and DEZ ; ArtUnc_4FAFE:
  86791. ArtUnc_CPZAnimBack: BINCLUDE "art/uncompressed/Animated background section (CPZ and DEZ).bin"
  86792. ;---------------------------------------------------------------------------------------
  86793. ; Uncompressed art
  86794. ; Waterfall patterns from ARZ ; ArtUnc_4FCFE: ArtUnc_4FDFE: ArtUnc_4FEFE:
  86795. ArtUnc_Waterfall1: BINCLUDE "art/uncompressed/ARZ waterfall patterns - 1.bin"
  86796. ArtUnc_Waterfall2: BINCLUDE "art/uncompressed/ARZ waterfall patterns - 2.bin"
  86797. ArtUnc_Waterfall3: BINCLUDE "art/uncompressed/ARZ waterfall patterns - 3.bin"
  86798. ;---------------------------------------------------------------------------------------
  86799. ; Uncompressed art
  86800. ; Patterns for Sonic ; ArtUnc_50000:
  86801. ;---------------------------------------------------------------------------------------
  86802. align $20
  86803. ArtUnc_Sonic: BINCLUDE "art/uncompressed/Sonic's art.bin"
  86804. ;---------------------------------------------------------------------------------------
  86805. ; Uncompressed art
  86806. ; Patterns for Tails ; ArtUnc_64320:
  86807. ;---------------------------------------------------------------------------------------
  86808. align $20
  86809. ArtUnc_Tails: BINCLUDE "art/uncompressed/Tails's art.bin"
  86810. ;--------------------------------------------------------------------------------------
  86811. ; Sprite Mappings
  86812. ; Sonic ; MapUnc_6FBE0: SprTbl_Sonic:
  86813. ;--------------------------------------------------------------------------------------
  86814. Mapunc_Sonic: BINCLUDE "mappings/sprite/Sonic.bin"
  86815. ;--------------------------------------------------------------------------------------
  86816. ; Sprite Dynamic Pattern Reloading
  86817. ; Sonic DPLCs ; MapRUnc_714E0:
  86818. ;--------------------------------------------------------------------------------------
  86819. ; WARNING: the build script needs editing if you rename this label
  86820. ; or if you move Sonic's running frame to somewhere else than frame $2D
  86821. MapRUnc_Sonic: BINCLUDE "mappings/spriteDPLC/Sonic.bin"
  86822. ;--------------------------------------------------------------------------------------
  86823. ; Nemesis compressed art (32 blocks)
  86824. ; Shield ; ArtNem_71D8E:
  86825. ArtNem_Shield: BINCLUDE "art/nemesis/Shield.bin"
  86826. ;--------------------------------------------------------------------------------------
  86827. ; Nemesis compressed art (34 blocks)
  86828. ; Invincibility stars ; ArtNem_71F14:
  86829. ArtNem_Invincible_stars: BINCLUDE "art/nemesis/Invincibility stars.bin"
  86830. ;--------------------------------------------------------------------------------------
  86831. ; Uncompressed art
  86832. ; Splash in water ; ArtUnc_71FFC:
  86833. ArtUnc_Splash: BINCLUDE "art/uncompressed/Splash.bin"
  86834. ;--------------------------------------------------------------------------------------
  86835. ; Uncompressed art
  86836. ; Smoke from Skidding ; ArtUnc_7373C:
  86837. ArtUnc_SkidDust: BINCLUDE "art/uncompressed/Skid smoke.bin"
  86838. ;--------------------------------------------------------------------------------------
  86839. ; Nemesis compressed art (14 blocks)
  86840. ; Supersonic stars ; ArtNem_7393C:
  86841. ArtNem_SuperSonic_stars: BINCLUDE "art/nemesis/Super Sonic stars.bin"
  86842. ;--------------------------------------------------------------------------------------
  86843. ; Sprite Mappings
  86844. ; Tails ; MapUnc_739E2:
  86845. ;--------------------------------------------------------------------------------------
  86846. MapUnc_Tails: BINCLUDE "mappings/sprite/Tails.bin"
  86847. ;--------------------------------------------------------------------------------------
  86848. ; Sprite Dynamic Pattern Reloading
  86849. ; Tails DPLCs ; MapRUnc_7446C:
  86850. ;--------------------------------------------------------------------------------------
  86851. MapRUnc_Tails: BINCLUDE "mappings/spriteDPLC/Tails.bin"
  86852. ;-------------------------------------------------------------------------------------
  86853. ; Nemesis compressed art (127 blocks)
  86854. ; "SEGA" Patterns ; ArtNem_74876:
  86855. ArtNem_SEGA: BINCLUDE "art/nemesis/SEGA.bin"
  86856. ;-------------------------------------------------------------------------------------
  86857. ; Nemesis compressed art (9 blocks)
  86858. ; Shaded blocks from intro ; ArtNem_74CF6:
  86859. ArtNem_IntroTrails: BINCLUDE "art/nemesis/Shaded blocks from intro.bin"
  86860. ;---------------------------------------------------------------------------------------
  86861. ; Enigma compressed art mappings
  86862. ; "SEGA" mappings ; MapEng_74D0E:
  86863. MapEng_SEGA: BINCLUDE "mappings/misc/SEGA mappings.bin"
  86864. ;---------------------------------------------------------------------------------------
  86865. ; Enigma compressed art mappings
  86866. ; Mappings for title screen background ; ArtNem_74DC6:
  86867. MapEng_TitleScreen: BINCLUDE "mappings/misc/Mappings for title screen background.bin"
  86868. ;--------------------------------------------------------------------------------------
  86869. ; Enigma compressed art mappings
  86870. ; Mappings for title screen background (smaller part, water/horizon) ; MapEng_74E3A:
  86871. MapEng_TitleBack: BINCLUDE "mappings/misc/Mappings for title screen background 2.bin"
  86872. ;---------------------------------------------------------------------------------------
  86873. ; Enigma compressed art mappings
  86874. ; "Sonic the Hedgehog 2" title screen logo mappings ; MapEng_74E86:
  86875. MapEng_TitleLogo: BINCLUDE "mappings/misc/Sonic the Hedgehog 2 title screen logo mappings.bin"
  86876. ;---------------------------------------------------------------------------------------
  86877. ; Nemesis compressed art (336 blocks)
  86878. ; Main patterns from title screen ; ArtNem_74F6C:
  86879. even
  86880. ArtNem_Title: BINCLUDE "art/nemesis/Main patterns from title screen.bin"
  86881. ;---------------------------------------------------------------------------------------
  86882. ; Nemesis compressed art (674 blocks)
  86883. ; Sonic and tails from title screen ; ArtNem_7667A:
  86884. even
  86885. ArtNem_TitleSprites: BINCLUDE "art/nemesis/Sonic and Tails from title screen.bin"
  86886. ;---------------------------------------------------------------------------------------
  86887. ; Nemesis compressed art (10 blocks)
  86888. ; A few menu patterns ; ArtNem_78CBC:
  86889. even
  86890. ArtNem_MenuJunk: BINCLUDE "art/nemesis/A few menu blocks.bin"
  86891. ;---------------------------------------------------------------------------------------
  86892. ; Nemesis compressed art (16 blocks)
  86893. ; Button ArtNem_78DAC:
  86894. even
  86895. ArtNem_Button: BINCLUDE "art/nemesis/Button.bin"
  86896. ;---------------------------------------------------------------------------------------
  86897. ; Nemesis compressed art (20 blocks)
  86898. ; Vertical Spring ArtNem_78E84:
  86899. even
  86900. ArtNem_VrtclSprng: BINCLUDE "art/nemesis/Vertical spring.bin"
  86901. ;---------------------------------------------------------------------------------------
  86902. ; Nemesis compressed art (12 blocks)
  86903. ; Horizontal spring ArtNem_78FA0:
  86904. even
  86905. ArtNem_HrzntlSprng: BINCLUDE "art/nemesis/Horizontal spring.bin"
  86906. ;---------------------------------------------------------------------------------------
  86907. ; Nemesis compressed art (32 blocks)
  86908. ; Diagonal spring ArtNem_7906A:
  86909. even
  86910. ArtNem_DignlSprng: BINCLUDE "art/nemesis/Diagonal spring.bin"
  86911. ;---------------------------------------------------------------------------------------
  86912. ; Nemesis compressed art (24 blocks)
  86913. ; Score, Rings, Time patterns ArtNem_7923E:
  86914. even
  86915. ArtNem_HUD: BINCLUDE "art/nemesis/HUD.bin"
  86916. ;---------------------------------------------------------------------------------------
  86917. ; Nemesis compressed art (12 blocks)
  86918. ; Sonic lives counter ArtNem_79346:
  86919. even
  86920. ArtNem_Sonic_life_counter: BINCLUDE "art/nemesis/Sonic lives counter.bin"
  86921. ;---------------------------------------------------------------------------------------
  86922. ; Nemesis compressed art (14 blocks)
  86923. ; Ring ArtNem_7945C:
  86924. even
  86925. ArtNem_Ring: BINCLUDE "art/nemesis/Ring.bin"
  86926. ;---------------------------------------------------------------------------------------
  86927. ; Nemesis compressed art (60 blocks)
  86928. ; Monitors and contents ArtNem_79550:
  86929. even
  86930. ArtNem_Powerups: BINCLUDE "art/nemesis/Monitor and contents.bin"
  86931. ;---------------------------------------------------------------------------------------
  86932. ; Nemesis compressed art (8 blocks)
  86933. ; Spikes 7995C:
  86934. even
  86935. ArtNem_Spikes: BINCLUDE "art/nemesis/Spikes.bin"
  86936. ;---------------------------------------------------------------------------------------
  86937. ; Nemesis compressed art (18 blocks)
  86938. ; Numbers 799AC:
  86939. even
  86940. ArtNem_Numbers: BINCLUDE "art/nemesis/Numbers.bin"
  86941. ;---------------------------------------------------------------------------------------
  86942. ; Nemesis compressed art (16 blocks)
  86943. ; Star pole 79A86:
  86944. even
  86945. ArtNem_Checkpoint: BINCLUDE "art/nemesis/Star pole.bin"
  86946. ;---------------------------------------------------------------------------------------
  86947. ; Nemesis compressed art (78 blocks)
  86948. ; Signpost ; ArtNem_79BDE:
  86949. even
  86950. ArtNem_Signpost: BINCLUDE "art/nemesis/Signpost.bin"
  86951. ;---------------------------------------------------------------------------------------
  86952. ; Uncompressed art
  86953. ; Signpost ; ArtUnc_7A18A:
  86954. ; Yep, it's in the ROM twice: once compressed and once uncompressed
  86955. even
  86956. ArtUnc_Signpost: BINCLUDE "art/uncompressed/Signpost.bin"
  86957. ;---------------------------------------------------------------------------------------
  86958. ; Nemesis compressed art (28 blocks)
  86959. ; Lever spring ; ArtNem_7AB4A:
  86960. even
  86961. ArtNem_LeverSpring: BINCLUDE "art/nemesis/Lever spring.bin"
  86962. ;---------------------------------------------------------------------------------------
  86963. ; Nemesis compressed art (8 blocks)
  86964. ; Long horizontal spike ; ArtNem_7AC9A:
  86965. even
  86966. ArtNem_HorizSpike: BINCLUDE "art/nemesis/Long horizontal spike.bin"
  86967. ;---------------------------------------------------------------------------------------
  86968. ; Nemesis compressed art (24 blocks)
  86969. ; Bubble thing from underwater ; ArtNem_7AD16:
  86970. even
  86971. ArtNem_BigBubbles: BINCLUDE "art/nemesis/Bubble generator.bin"
  86972. ;---------------------------------------------------------------------------------------
  86973. ; Nemesis compressed art (10 blocks)
  86974. ; Bubbles from character 7AEE2:
  86975. even
  86976. ArtNem_Bubbles: BINCLUDE "art/nemesis/Bubbles.bin"
  86977. ;---------------------------------------------------------------------------------------
  86978. ; Uncompressed art
  86979. ; Countdown text for drowning ; ArtUnc_7AF80:
  86980. even
  86981. ArtUnc_Countdown: BINCLUDE "art/uncompressed/Numbers for drowning countdown.bin"
  86982. ;---------------------------------------------------------------------------------------
  86983. ; Nemesis compressed art (34 blocks)
  86984. ; Game/Time over text 7B400:
  86985. even
  86986. ArtNem_Game_Over: BINCLUDE "art/nemesis/Game and Time Over text.bin"
  86987. ;---------------------------------------------------------------------------------------
  86988. ; Nemesis compressed art (68 blocks)
  86989. ; Explosion 7B592:
  86990. even
  86991. ArtNem_Explosion: BINCLUDE "art/nemesis/Explosion.bin"
  86992. ;---------------------------------------------------------------------------------------
  86993. ; Nemesis compressed art (12 blocks)
  86994. ; Miles life counter ; ArtNem_7B946:
  86995. even
  86996. ArtUnc_MilesLife: BINCLUDE "art/nemesis/Miles life counter.bin"
  86997. ;---------------------------------------------------------------------------------------
  86998. ; Nemesis compressed art (49 blocks)
  86999. ; Egg prison ; ArtNem_7BA32:
  87000. even
  87001. ArtNem_Capsule: BINCLUDE "art/nemesis/Egg Prison.bin"
  87002. ;---------------------------------------------------------------------------------------
  87003. ; Nemesis compressed art (36 blocks)
  87004. ; Tails on the continue screen (nagging Sonic) ; ArtNem_7BDBE:
  87005. even
  87006. ArtNem_ContinueTails: BINCLUDE "art/nemesis/Tails on continue screen.bin"
  87007. ;---------------------------------------------------------------------------------------
  87008. ; Nemesis compressed art (12 blocks)
  87009. ; Sonic extra continue icon ; ArtNem_7C0AA:
  87010. even
  87011. ArtNem_MiniSonic: BINCLUDE "art/nemesis/Sonic continue.bin"
  87012. ;---------------------------------------------------------------------------------------
  87013. ; Nemesis compressed art (12 blocks)
  87014. ; Tails life counter ; ArtNem_7C20C:
  87015. even
  87016. ArtNem_TailsLife: BINCLUDE "art/nemesis/Tails life counter.bin"
  87017. ;---------------------------------------------------------------------------------------
  87018. ; Nemesis compressed art (12 blocks)
  87019. ; Tails extra continue icon ; ArtNem_7C2F2:
  87020. even
  87021. ArtNem_MiniTails: BINCLUDE "art/nemesis/Tails continue.bin"
  87022. ;---------------------------------------------------------------------------------------
  87023. ; Nemesis compressed art (88 blocks)
  87024. ; Standard font ; ArtNem_7C43A:
  87025. even
  87026. ArtNem_FontStuff: BINCLUDE "art/nemesis/Standard font.bin"
  87027. ;---------------------------------------------------------------------------------------
  87028. ; Nemesis compressed art (38 blocks)
  87029. ; 1P/2P wins text from 2P mode ; ArtNem_7C9AE:
  87030. even
  87031. ArtNem_1P2PWins: BINCLUDE "art/nemesis/1P and 2P wins text from 2P mode.bin"
  87032. ;---------------------------------------------------------------------------------------
  87033. ; Enigma compressed art mappings
  87034. ; Sonic/Miles animated background mappings ; MapEng_7CB80:
  87035. MapEng_MenuBack: BINCLUDE "mappings/misc/Sonic and Miles animated background.bin"
  87036. ;---------------------------------------------------------------------------------------
  87037. ; Uncompressed art
  87038. ; Sonic/Miles animated background patterns ; ArtUnc_7CD2C:
  87039. even
  87040. ArtUnc_MenuBack: BINCLUDE "art/uncompressed/Sonic and Miles animated background.bin"
  87041. ;---------------------------------------------------------------------------------------
  87042. ; Nemesis compressed art (94 blocks)
  87043. ; Title card patterns ; ArtNem_7D22C:
  87044. even
  87045. ArtNem_TitleCard: BINCLUDE "art/nemesis/Title card.bin"
  87046. ;--------------------------------------------------------------------------------------
  87047. ; Nemesis compressed art (92 blocks)
  87048. ; Alphabet for font using large broken letters ; ArtNem_7D58A:
  87049. even
  87050. ArtNem_TitleCard2: BINCLUDE "art/nemesis/Font using large broken letters.bin"
  87051. ;---------------------------------------------------------------------------------------
  87052. ; Nemesis compressed art (21 blocks)
  87053. ; A menu box with a shadow ; ArtNem_7D990:
  87054. even
  87055. ArtNem_MenuBox: BINCLUDE "art/nemesis/A menu box with a shadow.bin"
  87056. ;---------------------------------------------------------------------------------------
  87057. ; Nemesis compressed art (170 blocks)
  87058. ; Pictures in level preview box in level select ; ArtNem_7DA10:
  87059. even
  87060. ArtNem_LevelSelectPics: BINCLUDE "art/nemesis/Pictures in level preview box from level select.bin"
  87061. ;---------------------------------------------------------------------------------------
  87062. ; Nemesis compressed art (68 blocks)
  87063. ; Text for Sonic or Tails Got Through Act and Bonus/Perfect ; ArtNem_7E86A:
  87064. even
  87065. ArtNem_ResultsText: BINCLUDE "art/nemesis/End of level results text.bin"
  87066. ;---------------------------------------------------------------------------------------
  87067. ; Nemesis compressed art (72 blocks)
  87068. ; Text for end of special stage, along with patterns for 3 emeralds. ; ArtNem_7EB58:
  87069. even
  87070. ArtNem_SpecialStageResults: BINCLUDE "art/nemesis/Special stage results screen art and some emeralds.bin"
  87071. ;---------------------------------------------------------------------------------------
  87072. ; Nemesis compressed art (14 blocks)
  87073. ; "Perfect" text ; ArtNem_7EEBE:
  87074. even
  87075. ArtNem_Perfect: BINCLUDE "art/nemesis/Perfect text.bin"
  87076. ;---------------------------------------------------------------------------------------
  87077. ; Nemesis compressed art (16 blocks)
  87078. ; Flicky ; ArtNem_7EF60:
  87079. even
  87080. ArtNem_Bird: BINCLUDE "art/nemesis/Flicky.bin"
  87081. ;---------------------------------------------------------------------------------------
  87082. ; Nemesis compressed art (20 blocks)
  87083. ; Squirrel ; ArtNem_7F0A2:
  87084. even
  87085. ArtNem_Squirrel: BINCLUDE "art/nemesis/Squirrel.bin"
  87086. ;---------------------------------------------------------------------------------------
  87087. ; Nemesis compressed art (16 blocks)
  87088. ; Mouse ; ArtNem_7F206:
  87089. even
  87090. ArtNem_Mouse: BINCLUDE "art/nemesis/Mouse.bin"
  87091. ;---------------------------------------------------------------------------------------
  87092. ; Nemesis compressed art (16 blocks)
  87093. ; Chicken ; ArtNem_7F340:
  87094. even
  87095. ArtNem_Chicken: BINCLUDE "art/nemesis/Chicken.bin"
  87096. ;---------------------------------------------------------------------------------------
  87097. ; Nemesis compressed art (20 blocks)
  87098. ; Beaver ; ArtNem_7F4A2:
  87099. even
  87100. ArtNem_Beaver: BINCLUDE "art/nemesis/Beaver.bin"
  87101. ;---------------------------------------------------------------------------------------
  87102. ; Nemesis compressed art (16 blocks)
  87103. ; Some bird ; ArtNem_7F5E2:
  87104. even
  87105. ArtNem_Eagle: BINCLUDE "art/nemesis/Penguin.bin"
  87106. ;---------------------------------------------------------------------------------------
  87107. ; Nemesis compressed art (10 blocks)
  87108. ; Pig ; ArtNem_7F710:
  87109. even
  87110. ArtNem_Pig: BINCLUDE "art/nemesis/Pig.bin"
  87111. ;---------------------------------------------------------------------------------------
  87112. ; Nemesis compressed art (14 blocks)
  87113. ; Seal ; ArtNem_7F846:
  87114. even
  87115. ArtNem_Seal: BINCLUDE "art/nemesis/Seal.bin"
  87116. ;---------------------------------------------------------------------------------------
  87117. ; Nemesis compressed art (18 blocks)
  87118. ; Penguin ; ArtNem_7F962:
  87119. even
  87120. ArtNem_Penguin: BINCLUDE "art/nemesis/Penguin 2.bin"
  87121. ;---------------------------------------------------------------------------------------
  87122. ; Nemesis compressed art (20 blocks)
  87123. ; Turtle ; ArtNem_7FADE:
  87124. even
  87125. ArtNem_Turtle: BINCLUDE "art/nemesis/Turtle.bin"
  87126. ;---------------------------------------------------------------------------------------
  87127. ; Nemesis compressed art (20 blocks)
  87128. ; Bear ; ArtNem_7FC90:
  87129. even
  87130. ArtNem_Bear: BINCLUDE "art/nemesis/Bear.bin"
  87131. ;---------------------------------------------------------------------------------------
  87132. ; Nemesis compressed art (18 blocks)
  87133. ; Splats ; ArtNem_7FDD2:
  87134. even
  87135. ArtNem_Rabbit: BINCLUDE "art/nemesis/Rabbit.bin"
  87136. ;---------------------------------------------------------------------------------------
  87137. ; Nemesis compressed art (4 blocks)
  87138. ; Rivet thing that you bust to get inside ship at the end of WFZ ; ArtNem_7FF2A:
  87139. even
  87140. ArtNem_WfzSwitch: BINCLUDE "art/nemesis/WFZ boss chamber switch.bin"
  87141. ;--------------------------------------------------------------------------------------
  87142. ; Nemesis compressed art (15 blocks)
  87143. ; Breakaway panels in WFZ ; ArtNem_7FF98:
  87144. even
  87145. ArtNem_BreakPanels: BINCLUDE "art/nemesis/Breakaway panels from WFZ.bin"
  87146. ;--------------------------------------------------------------------------------------
  87147. ; Nemesis compressed art (32 blocks)
  87148. ; Spiked thing from OOZ ; ArtNem_8007C:
  87149. even
  87150. ArtNem_SpikyThing: BINCLUDE "art/nemesis/Spiked ball from OOZ.bin"
  87151. ;--------------------------------------------------------------------------------------
  87152. ; Nemesis compressed art (6 blocks)
  87153. ; Green platform over the burners in OOZ ; ArtNem_80274:
  87154. even
  87155. ArtNem_BurnerLid: BINCLUDE "art/nemesis/Burner Platform from OOZ.bin"
  87156. ;--------------------------------------------------------------------------------------
  87157. ; Nemesis compressed art (4 blocks)
  87158. ; Striped blocks from OOZ ; ArtNem_8030A:
  87159. even
  87160. ArtNem_StripedBlocksVert: BINCLUDE "art/nemesis/Striped blocks from CPZ.bin"
  87161. ;--------------------------------------------------------------------------------------
  87162. ; Nemesis compressed art (16 blocks)
  87163. ; Oil splashing into oil in OOZ ; ArtNem_80376:
  87164. even
  87165. ArtNem_Oilfall: BINCLUDE "art/nemesis/Cascading oil hitting oil from OOZ.bin"
  87166. ;--------------------------------------------------------------------------------------
  87167. ; Nemesis compressed art (13 blocks)
  87168. ; Cascading oil from OOZ ; ArtNem_804F2:
  87169. even
  87170. ArtNem_Oilfall2: BINCLUDE "art/nemesis/Cascading oil from OOZ.bin"
  87171. ;--------------------------------------------------------------------------------------
  87172. ; Nemesis compressed art (20 blocks)
  87173. ; Ball thing (unused?) from OOZ ; ArtNem_805C0:
  87174. even
  87175. ArtNem_BallThing: BINCLUDE "art/nemesis/Ball on spring from OOZ (beta holdovers).bin"
  87176. ;--------------------------------------------------------------------------------------
  87177. ; Nemesis compressed art (53 blocks)
  87178. ; Spinball from OOZ ; ArtNem_806E0:
  87179. even
  87180. ArtNem_LaunchBall: BINCLUDE "art/nemesis/Transporter ball from OOZ.bin"
  87181. ;--------------------------------------------------------------------------------------
  87182. ; Nemesis compressed art (40 blocks)
  87183. ; Collapsing platform from OOZ ; ArtNem_809D0:
  87184. even
  87185. ArtNem_OOZPlatform: BINCLUDE "art/nemesis/OOZ collapsing platform.bin"
  87186. ;--------------------------------------------------------------------------------------
  87187. ; Nemesis compressed art (30 blocks)
  87188. ; Diagonal and vertical weird spring from OOZ ; ArtNem_80C64:
  87189. even
  87190. ArtNem_PushSpring: BINCLUDE "art/nemesis/Push spring from OOZ.bin"
  87191. ;--------------------------------------------------------------------------------------
  87192. ; Nemesis compressed art (28 blocks)
  87193. ; Swinging platform from OOZ ; ArtNem_80E26:
  87194. even
  87195. ArtNem_OOZSwingPlat: BINCLUDE "art/nemesis/Swinging platform from OOZ.bin"
  87196. ;--------------------------------------------------------------------------------------
  87197. ; Nemesis compressed art (4 blocks)
  87198. ; 4 stripy blocks from OOZ ; ArtNem_81048:
  87199. even
  87200. ArtNem_StripedBlocksHoriz: BINCLUDE "art/nemesis/4 stripy blocks from OOZ.bin"
  87201. ;--------------------------------------------------------------------------------------
  87202. ; Nemesis compressed art (24 blocks)
  87203. ; Raising platform from OOZ ; ArtNem_810B8:
  87204. even
  87205. ArtNem_OOZElevator: BINCLUDE "art/nemesis/Rising platform from OOZ.bin"
  87206. ;--------------------------------------------------------------------------------------
  87207. ; Nemesis compressed art (30 blocks)
  87208. ; Fan in OOZ ; ArtNem_81254:
  87209. even
  87210. ArtNem_OOZFanHoriz: BINCLUDE "art/nemesis/Fan from OOZ.bin"
  87211. ;--------------------------------------------------------------------------------------
  87212. ; Nemesis compressed art (18 blocks)
  87213. ; Green flame thing that shoots platform up in OOZ ; ArtNem_81514:
  87214. even
  87215. ArtNem_OOZBurn: BINCLUDE "art/nemesis/Green flame from OOZ burners.bin"
  87216. ;--------------------------------------------------------------------------------------
  87217. ; Nemesis compressed art (4 blocks)
  87218. ; Patterns for appearing and disappearing string of platforms in CNZ ; ArtNem_81600:
  87219. even
  87220. ArtNem_CNZSnake: BINCLUDE "art/nemesis/Caterpiller platforms from CNZ.bin"
  87221. ;--------------------------------------------------------------------------------------
  87222. ; Nemesis compressed art (4 blocks)
  87223. ; Spikey ball from pokie in CNZ ; ArtNem_81668:
  87224. even
  87225. ArtNem_CNZBonusSpike: BINCLUDE "art/nemesis/Spikey ball from CNZ slots.bin"
  87226. ;--------------------------------------------------------------------------------------
  87227. ; Nemesis compressed art (16 blocks)
  87228. ; Moving cube from either CNZ or CPZ ; ArtNem_816C8:
  87229. even
  87230. ArtNem_BigMovingBlock: BINCLUDE "art/nemesis/Moving block from CNZ and CPZ.bin"
  87231. ;--------------------------------------------------------------------------------------
  87232. ; Nemesis compressed art (4 blocks)
  87233. ; Elevator in CNZ ; ArtNem_817B4:
  87234. even
  87235. ArtNem_CNZElevator: BINCLUDE "art/nemesis/CNZ elevator.bin"
  87236. ;--------------------------------------------------------------------------------------
  87237. ; Nemesis compressed art (12 blocks)
  87238. ; Bars from pokies in CNZ ; ArtNem_81826:
  87239. even
  87240. ArtNem_CNZCage: BINCLUDE "art/nemesis/CNZ slot machine bars.bin"
  87241. ;--------------------------------------------------------------------------------------
  87242. ; Nemesis compressed art (6 blocks)
  87243. ; Hexagonal bumper in CNZ ; ArtNem_81894:
  87244. even
  87245. ArtNem_CNZHexBumper: BINCLUDE "art/nemesis/Hexagonal bumper from CNZ.bin"
  87246. ;--------------------------------------------------------------------------------------
  87247. ; Nemesis compressed art (24 blocks)
  87248. ; Normal round bumper from CNZ ; ArtNem_8191E:
  87249. even
  87250. ArtNem_CNZRoundBumper: BINCLUDE "art/nemesis/Round bumper from CNZ.bin"
  87251. ;--------------------------------------------------------------------------------------
  87252. ; Nemesis compressed art (32 blocks)
  87253. ; Diagonal spring from CNZ that you charge up ; ArtNem_81AB0:
  87254. even
  87255. ArtNem_CNZDiagPlunger: BINCLUDE "art/nemesis/Diagonal impulse spring from CNZ.bin"
  87256. ;--------------------------------------------------------------------------------------
  87257. ; Nemesis compressed art (18 blocks)
  87258. ; Vertical red spring ; ArtNem_81C96:
  87259. even
  87260. ArtNem_CNZVertPlunger: BINCLUDE "art/nemesis/Vertical impulse spring.bin"
  87261. ;--------------------------------------------------------------------------------------
  87262. ; Nemesis compressed art (28 blocks)
  87263. ; Weird blocks from CNZ that you hit 3 times to get rid of ; ArtNem_81DCC:
  87264. even
  87265. ArtNem_CNZMiniBumper: BINCLUDE "art/nemesis/Drop target from CNZ.bin"
  87266. ;--------------------------------------------------------------------------------------
  87267. ; Nemesis compressed art (52 blocks)
  87268. ; Flippers from CNZ ; ArtNem_81EF2:
  87269. even
  87270. ArtNem_CNZFlipper: BINCLUDE "art/nemesis/Flippers.bin"
  87271. ;--------------------------------------------------------------------------------------
  87272. ; Nemesis compressed art (16 blocks)
  87273. ; Large moving platform from CPZ ; ArtNem_82216:
  87274. even
  87275. ArtNem_CPZElevator: BINCLUDE "art/nemesis/Large moving platform from CNZ.bin"
  87276. ;--------------------------------------------------------------------------------------
  87277. ; Nemesis compressed art (24 blocks)
  87278. ; Top of water in HPZ and CPZ ; ArtNem_82364:
  87279. even
  87280. ArtNem_WaterSurface: BINCLUDE "art/nemesis/Top of water in HPZ and CNZ.bin"
  87281. ;--------------------------------------------------------------------------------------
  87282. ; Nemesis compressed art (4 blocks)
  87283. ; Booster things in CPZ ; ArtNem_824D4:
  87284. even
  87285. ArtNem_CPZBooster: BINCLUDE "art/nemesis/Speed booster from CPZ.bin"
  87286. ;--------------------------------------------------------------------------------------
  87287. ; Nemesis compressed art (4 blocks)
  87288. ; CPZ droplet chain enemy ; ArtNem_8253C:
  87289. even
  87290. ArtNem_CPZDroplet: BINCLUDE "art/nemesis/CPZ worm enemy.bin"
  87291. ;--------------------------------------------------------------------------------------
  87292. ; Nemesis compressed art (33 blocks)
  87293. ; CPZ metal things (girder, cylinders) ; ArtNem_825AE:
  87294. even
  87295. ArtNem_CPZMetalThings: BINCLUDE "art/nemesis/CPZ metal things.bin"
  87296. ;--------------------------------------------------------------------------------------
  87297. ; Nemesis compressed art (4 blocks)
  87298. ; CPZ metal block ; ArtNem_827B8:
  87299. even
  87300. ArtNem_CPZMetalBlock: BINCLUDE "art/nemesis/CPZ large moving platform blocks.bin"
  87301. ;--------------------------------------------------------------------------------------
  87302. ; Nemesis compressed art (8 blocks)
  87303. ; Yellow and black stripy tiles from DEZ ; ArtNem_827F8:
  87304. even
  87305. ArtNem_ConstructionStripes: BINCLUDE "art/nemesis/Stripy blocks from CPZ.bin"
  87306. ;--------------------------------------------------------------------------------------
  87307. ; Nemesis compressed art (48 blocks)
  87308. ; Yellow flipping platforms and stuff CPZ ; ArtNem_82864:
  87309. even
  87310. ArtNem_CPZAnimatedBits: BINCLUDE "art/nemesis/Small yellow moving platform from CPZ.bin"
  87311. ;--------------------------------------------------------------------------------------
  87312. ; Nemesis compressed art (24 blocks)
  87313. ; Moving block from CPZ ; ArtNem_82A46:
  87314. even
  87315. ArtNem_CPZStairBlock: BINCLUDE "art/nemesis/Moving block from CPZ.bin"
  87316. ;--------------------------------------------------------------------------------------
  87317. ; Nemesis compressed art (32 blocks)
  87318. ; Spring that covers tube in CPZ ; ArtNem_82C06:
  87319. even
  87320. ArtNem_CPZTubeSpring: BINCLUDE "art/nemesis/CPZ spintube exit cover.bin"
  87321. ;--------------------------------------------------------------------------------------
  87322. ; Nemesis compressed art (16 blocks)
  87323. ; Top of water in ARZ ; ArtNem_82E02:
  87324. even
  87325. ArtNem_WaterSurface2: BINCLUDE "art/nemesis/Top of water in ARZ.bin"
  87326. ;--------------------------------------------------------------------------------------
  87327. ; Nemesis compressed art (7 blocks)
  87328. ; Leaves from ARZ ; ArtNem_82EE8:
  87329. even
  87330. ArtNem_Leaves: BINCLUDE "art/nemesis/Leaves in ARZ.bin"
  87331. ;--------------------------------------------------------------------------------------
  87332. ; Nemesis compressed art (17 blocks)
  87333. ; Arrow shooter and arrow from ARZ ; ArtNem_82F74:
  87334. even
  87335. ArtNem_ArrowAndShooter: BINCLUDE "art/nemesis/Arrow shooter and arrow from ARZ.bin"
  87336. ;--------------------------------------------------------------------------------------
  87337. ; Nemesis compressed art (8 blocks)
  87338. ; One way barrier from ARZ (unused?) ; ArtNem_830D2:
  87339. even
  87340. ArtNem_ARZBarrierThing: BINCLUDE "art/nemesis/One way barrier from ARZ.bin"
  87341. ;--------------------------------------------------------------------------------------
  87342. ; Nemesis compressed art (28 blocks)
  87343. ; Buzz bomber ; ArtNem_8316A:
  87344. even
  87345. ArtNem_Buzzer: BINCLUDE "art/nemesis/Buzzer enemy.bin"
  87346. ;--------------------------------------------------------------------------------------
  87347. ; Nemesis compressed art (58 blocks)
  87348. ; Octopus badnik from OOZ ; ArtNem_8336A:
  87349. even
  87350. ArtNem_Octus: BINCLUDE "art/nemesis/Octopus badnik from OOZ.bin"
  87351. ;--------------------------------------------------------------------------------------
  87352. ; Nemesis compressed art (56 blocks)
  87353. ; Flying badnik from OOZ ; ArtNem_8368A:
  87354. even
  87355. ArtNem_Aquis: BINCLUDE "art/nemesis/Seahorse from OOZ.bin"
  87356. ;--------------------------------------------------------------------------------------
  87357. ; Nemesis compressed art (22 blocks)
  87358. ; Fish badnik from EHZ ; ArtNem_839EA: ArtNem_Pirahna:
  87359. even
  87360. ArtNem_Masher: BINCLUDE "art/nemesis/EHZ Pirahna badnik.bin"
  87361. ;--------------------------------------------------------------------------------------
  87362. ; Nemesis compressed art (96 blocks)
  87363. ; Robotnik's main ship ; ArtNem_83BF6:
  87364. even
  87365. ArtNem_Eggpod: BINCLUDE "art/nemesis/Eggpod.bin"
  87366. ;--------------------------------------------------------------------------------------
  87367. ; Nemesis compressed art (111 blocks)
  87368. ; CPZ Boss ; ArtNem_84332:
  87369. even
  87370. ArtNem_CPZBoss: BINCLUDE "art/nemesis/CPZ boss.bin"
  87371. ;--------------------------------------------------------------------------------------
  87372. ; Nemesis compressed art (100 blocks)
  87373. ; Large explosion ; ArtNem_84890:
  87374. even
  87375. ArtNem_FieryExplosion: BINCLUDE "art/nemesis/Large explosion.bin"
  87376. ;--------------------------------------------------------------------------------------
  87377. ; Nemesis compressed art (8 blocks)
  87378. ; Horizontal jet ; ArtNem_84F18:
  87379. even
  87380. ArtNem_EggpodJets: BINCLUDE "art/nemesis/Horizontal jet.bin"
  87381. ;--------------------------------------------------------------------------------------
  87382. ; Nemesis compressed art (16 blocks)
  87383. ; Smoke trail from CPZ and HTZ bosses ; ArtNem_84F96:
  87384. even
  87385. ArtNem_BossSmoke: BINCLUDE "art/nemesis/Smoke trail from CPZ and HTZ bosses.bin"
  87386. ;--------------------------------------------------------------------------------------
  87387. ; Nemesis compressed art (128 blocks)
  87388. ; EHZ Boss ; ArtNem_8507C:
  87389. even
  87390. ArtNem_EHZBoss: BINCLUDE "art/nemesis/EHZ boss.bin"
  87391. ;--------------------------------------------------------------------------------------
  87392. ; Nemesis compressed art (20 blocks)
  87393. ; Helicopter blades for EHZ boss ; ArtNem_85868:
  87394. even
  87395. ArtNem_EggChoppers: BINCLUDE "art/nemesis/Chopper blades for EHZ boss.bin"
  87396. ;--------------------------------------------------------------------------------------
  87397. ; Nemesis compressed art (107 blocks)
  87398. ; HTZ boss ; ArtNem_8595C:
  87399. even
  87400. ArtNem_HTZBoss: BINCLUDE "art/nemesis/HTZ boss.bin"
  87401. ;--------------------------------------------------------------------------------------
  87402. ; Nemesis compressed art (166 blocks)
  87403. ; ARZ boss ; ArtNem_86128:
  87404. even
  87405. ArtNem_ARZBoss: BINCLUDE "art/nemesis/ARZ boss.bin"
  87406. ;--------------------------------------------------------------------------------------
  87407. ; Nemesis compressed art (204 blocks)
  87408. ; MCZ boss ; ArtNem_86B6E:
  87409. even
  87410. ArtNem_MCZBoss: BINCLUDE "art/nemesis/MCZ boss.bin"
  87411. ;--------------------------------------------------------------------------------------
  87412. ; Nemesis compressed art (133 blocks)
  87413. ; CNZ boss ; ArtNem_87AAC:
  87414. even
  87415. ArtNem_CNZBoss: BINCLUDE "art/nemesis/CNZ boss.bin"
  87416. ;--------------------------------------------------------------------------------------
  87417. ; Nemesis compressed art (181 blocks)
  87418. ; OOZ boss ; ArtNem_882D6:
  87419. even
  87420. ArtNem_OOZBoss: BINCLUDE "art/nemesis/OOZ boss.bin"
  87421. ;--------------------------------------------------------------------------------------
  87422. ; Nemesis compressed art (124 blocks)
  87423. ; MTZ boss ; ArtNem_88DA6:
  87424. even
  87425. ArtNem_MTZBoss: BINCLUDE "art/nemesis/MTZ boss.bin"
  87426. ;--------------------------------------------------------------------------------------
  87427. ; Uncompressed art (8 blocks)
  87428. ; Falling rocks and stalactites from MCZ ; ArtUnc_894E4:
  87429. even
  87430. ArtUnc_FallingRocks: BINCLUDE "art/uncompressed/Falling rocks and stalactites from MCZ.bin"
  87431. ;--------------------------------------------------------------------------------------
  87432. ; Nemesis compressed art (9 blocks)
  87433. ; Blowfly from ARZ ; ArtNem_895E4:
  87434. even
  87435. ArtNem_Whisp: BINCLUDE "art/nemesis/Blowfly from ARZ.bin"
  87436. ;--------------------------------------------------------------------------------------
  87437. ; Nemesis compressed art (50 blocks)
  87438. ; Grounder from ARZ ; ArtNem_8970E:
  87439. even
  87440. ArtNem_Grounder: BINCLUDE "art/nemesis/Grounder from ARZ.bin"
  87441. ;--------------------------------------------------------------------------------------
  87442. ; Nemesis compressed art (24 blocks)
  87443. ; Fish from ARZ ; ArtNem_89B9A:
  87444. even
  87445. ArtNem_ChopChop: BINCLUDE "art/nemesis/Shark from ARZ.bin"
  87446. ;--------------------------------------------------------------------------------------
  87447. ; Nemesis compressed art (19 blocks)
  87448. ; Lava snake from HTZ 89DEC: ArtNem_HtzRexxon:
  87449. even
  87450. ArtNem_Rexon: BINCLUDE "art/nemesis/Rexxon (lava snake) from HTZ.bin"
  87451. ;--------------------------------------------------------------------------------------
  87452. ; Nemesis compressed art (20 blocks)
  87453. ; Enemy with spike cone on top from HTZ 89FAA: ArtNem_HtzDriller:
  87454. even
  87455. ArtNem_Spiker: BINCLUDE "art/nemesis/Driller badnik from HTZ.bin"
  87456. ;--------------------------------------------------------------------------------------
  87457. ; Nemesis compressed art (28 blocks)
  87458. ; Bomber badnik from SCZ ; ArtNem_8A142:
  87459. even
  87460. ArtNem_Nebula: BINCLUDE "art/nemesis/Bomber badnik from SCZ.bin"
  87461. ;--------------------------------------------------------------------------------------
  87462. ; Nemesis compressed art (57 blocks)
  87463. ; Turtle badnik from SCZ ; ArtNem_8A362:
  87464. even
  87465. ArtNem_Turtloid: BINCLUDE "art/nemesis/Turtle badnik from SCZ.bin"
  87466. ;--------------------------------------------------------------------------------------
  87467. ; Nemesis compressed art (38 blocks)
  87468. ; Coconuts monkey badnik from EHZ
  87469. even
  87470. ArtNem_Coconuts: BINCLUDE "art/nemesis/Coconuts badnik from EHZ.bin"
  87471. ;--------------------------------------------------------------------------------------
  87472. ; Nemesis compressed art (10 blocks)
  87473. ; Snake badnik from MCZ ; ArtNem_8AB36:
  87474. even
  87475. ArtNem_Crawlton: BINCLUDE "art/nemesis/Snake badnik from MCZ.bin"
  87476. ;--------------------------------------------------------------------------------------
  87477. ; Nemesis compressed art (20 blocks)
  87478. ; Firefly from MCZ ; ArtNem_8AC5E:
  87479. even
  87480. ArtNem_Flasher: BINCLUDE "art/nemesis/Firefly from MCZ.bin"
  87481. ;--------------------------------------------------------------------------------------
  87482. ; Nemesis compressed art (32 blocks)
  87483. ; Praying mantis badnik from MTZ 8AD80:
  87484. even
  87485. ArtNem_MtzMantis: BINCLUDE "art/nemesis/Praying mantis badnik from MTZ.bin"
  87486. ;--------------------------------------------------------------------------------------
  87487. ; Nemesis compressed art (36 blocks)
  87488. ; Crab badnik from MCZ 8B058:
  87489. even
  87490. ArtNem_Crabmeat: BINCLUDE "art/nemesis/Crabmeat badnik from MCZ.bin"
  87491. ;--------------------------------------------------------------------------------------
  87492. ; Nemesis compressed art (15 blocks)
  87493. ; Exploding star badnik from MTZ 8B300:
  87494. even
  87495. ArtNem_MtzSupernova: BINCLUDE "art/nemesis/Exploding star badnik from MTZ.bin"
  87496. ;--------------------------------------------------------------------------------------
  87497. ; Nemesis compressed art (32 blocks)
  87498. ; Weird crawling badnik from CPZ ; ArtNem_8B430:
  87499. even
  87500. ArtNem_Spiny: BINCLUDE "art/nemesis/Weird crawling badnik from CPZ.bin"
  87501. ;--------------------------------------------------------------------------------------
  87502. ; Nemesis compressed art (45 blocks)
  87503. ; Spider badnik from CPZ ArtNem_8B6B4:
  87504. even
  87505. ArtNem_Grabber: BINCLUDE "art/nemesis/Spider badnik from CPZ.bin"
  87506. ;--------------------------------------------------------------------------------------
  87507. ; Nemesis compressed art (26 blocks)
  87508. ; Chicken badnik from WFZ 8B9DC:
  87509. even
  87510. ArtNem_WfzScratch: BINCLUDE "art/nemesis/Scratch from WFZ.bin"
  87511. ;--------------------------------------------------------------------------------------
  87512. ; Nemesis compressed art (25 blocks)
  87513. ; Jet like badnik from SCZ 8BC16:
  87514. even
  87515. ArtNem_Balkrie: BINCLUDE "art/nemesis/Balkrie (jet badnik) from SCZ.bin"
  87516. ;--------------------------------------------------------------------------------------
  87517. ; Nemesis compressed art (217 blocks)
  87518. ; Silver Sonic ; ArtNem_8BE12:
  87519. even
  87520. ArtNem_SilverSonic: BINCLUDE "art/nemesis/Silver Sonic.bin"
  87521. ;--------------------------------------------------------------------------------------
  87522. ; Nemesis compressed art (79 blocks)
  87523. ; The Tornado 8CC44:
  87524. even
  87525. ArtNem_Tornado: BINCLUDE "art/nemesis/The Tornado.bin"
  87526. ;--------------------------------------------------------------------------------------
  87527. ; Nemesis compressed art (24 blocks)
  87528. ; Wall turret from WFZ 8D1A0:
  87529. even
  87530. ArtNem_WfzWallTurret: BINCLUDE "art/nemesis/Wall turret from WFZ.bin"
  87531. ;--------------------------------------------------------------------------------------
  87532. ; Nemesis compressed art (20 blocks)
  87533. ; Hook on chain in WFZ 8D388:
  87534. even
  87535. ArtNem_WfzHook: BINCLUDE "art/nemesis/Hook on chain from WFZ.bin"
  87536. ;--------------------------------------------------------------------------------------
  87537. ; Nemesis compressed art (54 blocks)
  87538. ; Retracting platform from WFZ 8D540:
  87539. even
  87540. ArtNem_WfzGunPlatform: BINCLUDE "art/nemesis/Retracting platform from WFZ.bin"
  87541. ;--------------------------------------------------------------------------------------
  87542. ; Nemesis compressed art (16 blocks)
  87543. ; Wheel for belt in WFZ 8D7D8:
  87544. even
  87545. ArtNem_WfzConveyorBeltWheel: BINCLUDE "art/nemesis/Wheel for belt in WFZ.bin"
  87546. ;--------------------------------------------------------------------------------------
  87547. ; Nemesis compressed art (12 blocks)
  87548. ; Moving platform in WFZ 8D96E:
  87549. even
  87550. ArtNem_WfzFloatingPlatform: BINCLUDE "art/nemesis/Moving platform from WFZ.bin"
  87551. ;--------------------------------------------------------------------------------------
  87552. ; Nemesis compressed art (12 blocks)
  87553. ; Giant unused vertical red laser in WFZ 8DA6E:
  87554. even
  87555. ArtNem_WfzVrtclLazer: BINCLUDE "art/nemesis/Unused vertical laser in WFZ.bin"
  87556. ;--------------------------------------------------------------------------------------
  87557. ; Nemesis compressed art (18 blocks)
  87558. ; Clouds 8DAFC:
  87559. even
  87560. ArtNem_Clouds: BINCLUDE "art/nemesis/Clouds.bin"
  87561. ;--------------------------------------------------------------------------------------
  87562. ; Nemesis compressed art (10 blocks)
  87563. ; Red horizontal laser in WFZ 8DC42:
  87564. even
  87565. ArtNem_WfzHrzntlLazer: BINCLUDE "art/nemesis/Red horizontal laser from WFZ.bin"
  87566. ;--------------------------------------------------------------------------------------
  87567. ; Nemesis compressed art (5 blocks)
  87568. ; Catapult that shoots sonic across quickly in WFZ 8DCA2:
  87569. even
  87570. ArtNem_WfzLaunchCatapult: BINCLUDE "art/nemesis/Catapult that shoots Sonic to the side from WFZ.bin"
  87571. ;--------------------------------------------------------------------------------------
  87572. ; Nemesis compressed art (12 blocks)
  87573. ; Rising platforms on belt from WFZ 8DD0C:
  87574. even
  87575. ArtNem_WfzBeltPlatform: BINCLUDE "art/nemesis/Platform on belt in WFZ.bin"
  87576. ;--------------------------------------------------------------------------------------
  87577. ; Nemesis compressed art (12 blocks)
  87578. ; Unused badnik in WFZ 8DDF6:
  87579. even
  87580. ArtNem_WfzUnusedBadnik: BINCLUDE "art/nemesis/Unused badnik from WFZ.bin"
  87581. ;--------------------------------------------------------------------------------------
  87582. ; Nemesis compressed art (4 blocks)
  87583. ; Vertical spinning blades from WFZ 8DEB8:
  87584. even
  87585. ArtNem_WfzVrtclPrpllr: BINCLUDE "art/nemesis/Vertical spinning blades in WFZ.bin"
  87586. ;--------------------------------------------------------------------------------------
  87587. ; Nemesis compressed art (29 blocks)
  87588. ; Horizontal spinning blades from WFZ 8DEE8:
  87589. even
  87590. ArtNem_WfzHrzntlPrpllr: BINCLUDE "art/nemesis/Horizontal spinning blades in WFZ.bin"
  87591. ;--------------------------------------------------------------------------------------
  87592. ; Nemesis compressed art (12 blocks)
  87593. ; Platforms that tilt in WFZ 8E010:
  87594. even
  87595. ArtNem_WfzTiltPlatforms: BINCLUDE "art/nemesis/Tilting plaforms in WFZ.bin"
  87596. ;--------------------------------------------------------------------------------------
  87597. ; Nemesis compressed art (8 blocks)
  87598. ; Thrust from Robotnic's getaway ship in WFZ 8E0C4:
  87599. even
  87600. ArtNem_WfzThrust: BINCLUDE "art/nemesis/Thrust from Robotnik's getaway ship in WFZ.bin"
  87601. ;--------------------------------------------------------------------------------------
  87602. ; Nemesis compressed art (117 blocks)
  87603. ; Laser boss from WFZ ; ArtNem_8E138:
  87604. even
  87605. ArtNem_WFZBoss: BINCLUDE "art/nemesis/WFZ boss.bin"
  87606. ;--------------------------------------------------------------------------------------
  87607. ; Nemesis compressed art (24 blocks)
  87608. ; Robotnik's head ; ArtNem_8E886:
  87609. even
  87610. ArtNem_RobotnikUpper: BINCLUDE "art/nemesis/Robotnik's head.bin"
  87611. ;--------------------------------------------------------------------------------------
  87612. ; Nemesis compressed art (76 blocks)
  87613. ; Robotnik ; ArtNem_8EA5A:
  87614. even
  87615. ArtNem_RobotnikRunning: BINCLUDE "art/nemesis/Robotnik.bin"
  87616. ;--------------------------------------------------------------------------------------
  87617. ; Nemesis compressed art (28 blocks)
  87618. ; Robotnik's lower half ; ArtNem_8EE52:
  87619. even
  87620. ArtNem_RobotnikLower: BINCLUDE "art/nemesis/Robotnik's lover half.bin"
  87621. ;--------------------------------------------------------------------------------------
  87622. ; Nemesis compressed art (8 blocks)
  87623. ; Window in back that Robotnic looks through in DEZ ; ArtNem_8EF96:
  87624. even
  87625. ArtNem_DEZWindow: BINCLUDE "art/nemesis/Window in back that Robotnik looks through in DEZ.bin"
  87626. ;--------------------------------------------------------------------------------------
  87627. ; Nemesis compressed art (327 blocks)
  87628. ; Eggrobo ; ArtNem_8F024:
  87629. even
  87630. ArtNem_DEZBoss: BINCLUDE "art/nemesis/Eggrobo.bin"
  87631. ;--------------------------------------------------------------------------------------
  87632. ; Nemesis compressed art (42 blocks)
  87633. ; Bouncer badnik from CNZ ; ArtNem_901A4:
  87634. even
  87635. ArtNem_Crawl: BINCLUDE "art/nemesis/Bouncer badnik from CNZ.bin"
  87636. ;--------------------------------------------------------------------------------------
  87637. ; Nemesis compressed art (26 blocks)
  87638. ; Rocket thruster for Tornado ; ArtNem_90520:
  87639. even
  87640. ArtNem_TornadoThruster: BINCLUDE "art/nemesis/Rocket thruster for Tornado.bin"
  87641. ;--------------------------------------------------------------------------------------
  87642. ; Enigma compressed sprite mappings
  87643. ; Frame 1 of end of game sequence ; MapEng_906E0:
  87644. MapEng_Ending1: BINCLUDE "mappings/misc/End of game sequence frame 1.bin"
  87645. ;--------------------------------------------------------------------------------------
  87646. ; Enigma compressed sprite mappings
  87647. ; Frame 2 of end of game sequence ; MapEng_906F8:
  87648. MapEng_Ending2: BINCLUDE "mappings/misc/End of game sequence frame 2.bin"
  87649. ;--------------------------------------------------------------------------------------
  87650. ; Enigma compressed sprite mappings
  87651. ; Frame 3 of end of game sequence ; MapEng_90722:
  87652. MapEng_Ending3: BINCLUDE "mappings/misc/End of game sequence frame 3.bin"
  87653. ;--------------------------------------------------------------------------------------
  87654. ; Enigma compressed sprite mappings
  87655. ; Frame 4 of end of game sequence ; MapEng_9073C:
  87656. MapEng_Ending4: BINCLUDE "mappings/misc/End of game sequence frame 4.bin"
  87657. ;--------------------------------------------------------------------------------------
  87658. ; Enigma compressed sprite mappings
  87659. ; Closeup of Tails flying plane in ending sequence ; MapEng_9076E:
  87660. MapEng_EndingTailsPlane: BINCLUDE "mappings/misc/Closeup of Tails flying plane in ending sequence.bin"
  87661. ;--------------------------------------------------------------------------------------
  87662. ; Enigma compressed sprite mappings
  87663. ; Closeup of Sonic flying plane in ending sequence ; MapEng_907C0:
  87664. MapEng_EndingSonicPlane: BINCLUDE "mappings/misc/Closeup of Sonic flying plane in ending sequence.bin"
  87665. ;--------------------------------------------------------------------------------------
  87666. ; Enigma compressed sprite mappings
  87667. ; Strange unused mappings (duplicate of MapEng_EndGameLogo)
  87668. ; MapEng_9082A:
  87669. BINCLUDE "mappings/misc/Strange unused mappings 1 - 1.bin"
  87670. ;--------------------------------------------------------------------------------------
  87671. ; Enigma compressed sprite mappings
  87672. ; Strange unused mappings (same as above)
  87673. ; MapEng_90852:
  87674. BINCLUDE "mappings/misc/Strange unused mappings 1 - 2.bin"
  87675. ;--------------------------------------------------------------------------------------
  87676. ; Enigma compressed sprite mappings
  87677. ; Strange unused mappings (same as above)
  87678. ; MapEng_9087A:
  87679. BINCLUDE "mappings/misc/Strange unused mappings 1 - 3.bin"
  87680. ;--------------------------------------------------------------------------------------
  87681. ; Enigma compressed sprite mappings
  87682. ; Strange unused mappings (same as above)
  87683. ; MapEng_908A2:
  87684. BINCLUDE "mappings/misc/Strange unused mappings 1 - 4.bin"
  87685. ;--------------------------------------------------------------------------------------
  87686. ; Enigma compressed sprite mappings
  87687. ; Strange unused mappings (same as above)
  87688. ; MapEng_908CA:
  87689. BINCLUDE "mappings/misc/Strange unused mappings 1 - 5.bin"
  87690. ;--------------------------------------------------------------------------------------
  87691. ; Enigma compressed sprite mappings
  87692. ; Strange unused mappings (same as above)
  87693. ; MapEng_908F2:
  87694. BINCLUDE "mappings/misc/Strange unused mappings 1 - 6.bin"
  87695. ;--------------------------------------------------------------------------------------
  87696. ; Enigma compressed sprite mappings
  87697. ; Strange unused mappings (same as above)
  87698. ; MapEng_9091A:
  87699. BINCLUDE "mappings/misc/Strange unused mappings 1 - 7.bin"
  87700. ;--------------------------------------------------------------------------------------
  87701. ; Enigma compressed sprite mappings
  87702. ; Strange unused mappings (same as above)
  87703. ; MapEng_90942:
  87704. BINCLUDE "mappings/misc/Strange unused mappings 1 - 8.bin"
  87705. ;--------------------------------------------------------------------------------------
  87706. ; Enigma compressed sprite mappings
  87707. ; Strange unused mappings (same as above)
  87708. ; MapEng_9096A:
  87709. BINCLUDE "mappings/misc/Strange unused mappings 2.bin"
  87710. ;--------------------------------------------------------------------------------------
  87711. ; Nemesis compressed art (363 blocks)
  87712. ; Movie sequence at end of game ; ArtNem_90992:
  87713. even
  87714. ArtNem_EndingPics: BINCLUDE "art/nemesis/Movie sequence at end of game.bin"
  87715. ;--------------------------------------------------------------------------------------
  87716. ; Nemesis compressed art (127 blocks)
  87717. ; Final image of Tornado with it and Sonic facing screen ; ArtNem_91F3C:
  87718. even
  87719. ArtNem_EndingFinalTornado: BINCLUDE "art/nemesis/Final image of Tornado with it and Sonic facing screen.bin"
  87720. ;--------------------------------------------------------------------------------------
  87721. ; Nemesis compressed art (109 blocks)
  87722. ; Mini pictures of Tornado in final ending sequence ; ArtNem_927E0:
  87723. even
  87724. ArtNem_EndingMiniTornado: BINCLUDE "art/nemesis/Small pictures of Tornado in final ending sequence.bin"
  87725. ;--------------------------------------------------------------------------------------
  87726. ; Nemesis compressed art (135 blocks)
  87727. ; Mini pictures of Sonic and final image of Sonic
  87728. even
  87729. ArtNem_EndingSonic: BINCLUDE "art/nemesis/Small pictures of Sonic and final image of Sonic.bin"
  87730. ;--------------------------------------------------------------------------------------
  87731. ; Nemesis compressed art (117 blocks)
  87732. ; Mini pictures of Sonic and final image of Sonic in supersonic mode ; ArtNem_93848:
  87733. even
  87734. ArtNem_EndingSuperSonic: BINCLUDE "art/nemesis/Small pictures of Sonic and final image of Sonic in Super Sonic mode.bin"
  87735. ;--------------------------------------------------------------------------------------
  87736. ; Nemesis compressed art (181 blocks)
  87737. ; Final image of Tails ; ArtNem_93F3C:
  87738. even
  87739. ArtNem_EndingTails: BINCLUDE "art/nemesis/Final image of Tails.bin"
  87740. ;--------------------------------------------------------------------------------------
  87741. ; Nemesis compressed art (72 blocks)
  87742. ; Sonic the Hedgehog 2 image at end of credits ; ArtNem_94B28:
  87743. even
  87744. ArtNem_EndingTitle: BINCLUDE "art/nemesis/Sonic the Hedgehog 2 image at end of credits.bin"
  87745.  
  87746.  
  87747. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  87748. ; LEVEL ART AND BLOCK MAPPINGS (16x16 and 128x128)
  87749. ;
  87750. ; #define BLOCK_TBL_LEN // table length unknown
  87751. ; #define BIGBLOCK_TBL_LEN // table length unknown
  87752. ; typedef uint16_t uword
  87753. ;
  87754. ; struct blockMapElement {
  87755. ; uword unk : 5; // u
  87756. ; uword patternIndex : 11; }; // i
  87757. ; // uuuu uiii iiii iiii
  87758. ;
  87759. ; blockMapElement (*blockMapTable)[BLOCK_TBL_LEN][4] = 0xFFFF9000
  87760. ;
  87761. ; struct bigBlockMapElement {
  87762. ; uword : 4
  87763. ; uword blockMapIndex : 12; }; //I
  87764. ; // 0000 IIII IIII IIII
  87765. ;
  87766. ; bigBlockMapElement (*bigBlockMapTable)[BIGBLOCK_TBL_LEN][64] = 0xFFFF0000
  87767. ;
  87768. ; /*
  87769. ; This data determines how the level blocks will be constructed graphically. There are
  87770. ; two kinds of block mappings: 16x16 and 128x128.
  87771. ;
  87772. ; 16x16 blocks are made up of four cells arranged in a square (thus, 16x16 pixels).
  87773. ; Two bytes are used to define each cell, so the block is 8 bytes long. It can be
  87774. ; represented by the bitmap blockMapElement, of which the members are:
  87775. ;
  87776. ; unk
  87777. ; These bits have to do with pattern orientation. I do not know their exact
  87778. ; meaning.
  87779. ; patternIndex
  87780. ; The pattern's address divided by $20. Otherwise said: an index into the
  87781. ; pattern array.
  87782. ;
  87783. ; Each mapping can be expressed as an array of four blockMapElements, while the
  87784. ; whole table is expressed as a two-dimensional array of blockMapElements (blockMapTable).
  87785. ; The maps are read in left-to-right, top-to-bottom order.
  87786. ;
  87787. ; 128x128 maps are basically lists of indices into blockMapTable. The levels are built
  87788. ; out of these "big blocks", rather than the "small" 16x16 blocks. bigBlockMapTable is,
  87789. ; predictably, the table of big block mappings.
  87790. ; Each big block is 8 16x16 blocks, or 16 cells, square. This produces a total of 16
  87791. ; blocks or 64 cells.
  87792. ; As noted earlier, each element of the table provides 'i' for blockMapTable[i][j].
  87793. ; */
  87794.  
  87795. ;----------------------------------------------------------------------------------
  87796. ; EHZ 16x16 block mappings (Kosinski compression) ; was: (Kozinski compression)
  87797. BM16_EHZ: BINCLUDE "mappings/16x16/EHZ.bin"
  87798. ;-----------------------------------------------------------------------------------
  87799. ; EHZ/HTZ main level patterns (Kosinski compression)
  87800. ; ArtKoz_95C24:
  87801. ArtKos_EHZ: BINCLUDE "art/kosinski/EHZ_HTZ.bin"
  87802. ;-----------------------------------------------------------------------------------
  87803. ; HTZ 16x16 block mappings (Kosinski compression)
  87804. BM16_HTZ: BINCLUDE "mappings/16x16/HTZ.bin"
  87805. ;-----------------------------------------------------------------------------------
  87806. ; HTZ pattern suppliment to EHZ level patterns (Kosinski compression)
  87807. ; ArtKoz_98AB4:
  87808. ArtKos_HTZ: BINCLUDE "art/kosinski/HTZ_Supp.bin"
  87809. ;-----------------------------------------------------------------------------------
  87810. ; EHZ/HTZ 128x128 block mappings (Kosinski compression)
  87811. BM128_EHZ: BINCLUDE "mappings/128x128/EHZ_HTZ.bin"
  87812. ;-----------------------------------------------------------------------------------
  87813. ; MTZ 16x16 block mappings (Kosinski compression)
  87814. BM16_MTZ: BINCLUDE "mappings/16x16/MTZ.bin"
  87815. ;-----------------------------------------------------------------------------------
  87816. ; MTZ main level patterns (Kosinski compression)
  87817. ; ArtKoz_9DB64:
  87818. ArtKos_MTZ: BINCLUDE "art/kosinski/MTZ.bin"
  87819. ;-----------------------------------------------------------------------------------
  87820. ; MTZ 128x128 block mappings (Kosinski compression)
  87821. BM128_MTZ: BINCLUDE "mappings/128x128/MTZ.bin"
  87822. ;-----------------------------------------------------------------------------------
  87823. ; HPZ 16x16 block mappings (Kosinski compression)
  87824. BM16_HPZ: ;BINCLUDE "mappings/16x16/HPZ.bin"
  87825. ;-----------------------------------------------------------------------------------
  87826. ; HPZ main level patterns (Kosinski compression)
  87827. ArtKos_HPZ: ;BINCLUDE "art/kosinski/HPZ.bin"
  87828. ;-----------------------------------------------------------------------------------
  87829. ; HPZ 128x128 block mappings (Kosinski compression)
  87830. BM128_HPZ: ;BINCLUDE "mappings/128x128/HPZ.bin"
  87831. ;-----------------------------------------------------------------------------------
  87832. ; OOZ 16x16 block mappings (Kosinski compression)
  87833. BM16_OOZ: BINCLUDE "mappings/16x16/OOZ.bin"
  87834. ;-----------------------------------------------------------------------------------
  87835. ; OOZ main level patterns (Kosinski compression)
  87836. ; ArtKoz_A4204:
  87837. ArtKos_OOZ: BINCLUDE "art/kosinski/OOZ.bin"
  87838. ;-----------------------------------------------------------------------------------
  87839. ; OOZ 128x128 block mappings (Kosinski compression)
  87840. BM128_OOZ: BINCLUDE "mappings/128x128/OOZ.bin"
  87841. ;-----------------------------------------------------------------------------------
  87842. ; MCZ 16x16 block mappings (Kosinski compression)
  87843. BM16_MCZ: BINCLUDE "mappings/16x16/MCZ.bin"
  87844. ;-----------------------------------------------------------------------------------
  87845. ; MCZ main level patterns (Kosinski compression)
  87846. ; ArtKoz_A9D74:
  87847. ArtKos_MCZ: BINCLUDE "art/kosinski/MCZ.bin"
  87848. ;-----------------------------------------------------------------------------------
  87849. ; MCZ 128x128 block mappings (Kosinski compression)
  87850. BM128_MCZ: BINCLUDE "mappings/128x128/MCZ.bin"
  87851. ;-----------------------------------------------------------------------------------
  87852. ; CNZ 16x16 block mappings (Kosinski compression)
  87853. BM16_CNZ: BINCLUDE "mappings/16x16/CNZ.bin"
  87854. ;-----------------------------------------------------------------------------------
  87855. ; CNZ main level patterns (Kosinski compression)
  87856. ; ArtKoz_B0894:
  87857. ArtKos_CNZ: BINCLUDE "art/kosinski/CNZ.bin"
  87858. ;-----------------------------------------------------------------------------------
  87859. ; CNZ 128x128 block mappings (Kosinski compression)
  87860. BM128_CNZ: BINCLUDE "mappings/128x128/CNZ.bin"
  87861. ;-----------------------------------------------------------------------------------
  87862. ; CPZ/DEZ 16x16 block mappings (Kosinski compression)
  87863. BM16_CPZ: BINCLUDE "mappings/16x16/CPZ_DEZ.bin"
  87864. ;-----------------------------------------------------------------------------------
  87865. ; CPZ/DEZ main level patterns (Kosinski compression)
  87866. ; ArtKoz_B6174:
  87867. ArtKos_CPZ: BINCLUDE "art/kosinski/CPZ_DEZ.bin"
  87868. ;-----------------------------------------------------------------------------------
  87869. ; CPZ/DEZ 128x128 block mappings (Kosinski compression)
  87870. BM128_CPZ: BINCLUDE "mappings/128x128/CPZ_DEZ.bin"
  87871. ;-----------------------------------------------------------------------------------
  87872. ; ARZ 16x16 block mappings (Kosinski compression)
  87873. BM16_ARZ: BINCLUDE "mappings/16x16/ARZ.bin"
  87874. ;-----------------------------------------------------------------------------------
  87875. ; ARZ main level patterns (Kosinski compression)
  87876. ; ArtKoz_BCC24:
  87877. ArtKos_ARZ: BINCLUDE "art/kosinski/ARZ.bin"
  87878. ;-----------------------------------------------------------------------------------
  87879. ; ARZ 128x128 block mappings (Kosinski compression)
  87880. BM128_ARZ: BINCLUDE "mappings/128x128/ARZ.bin"
  87881. ;-----------------------------------------------------------------------------------
  87882. ; WFZ/SCZ 16x16 block mappings (Kosinski compression)
  87883. BM16_WFZ: BINCLUDE "mappings/16x16/WFZ_SCZ.bin"
  87884. ;-----------------------------------------------------------------------------------
  87885. ; WFZ/SCZ main level patterns (Kosinski compression)
  87886. ; ArtKoz_C5004:
  87887. ArtKos_SCZ: BINCLUDE "art/kosinski/WFZ_SCZ.bin"
  87888. ;-----------------------------------------------------------------------------------
  87889. ; WFZ pattern suppliment to SCZ tiles (Kosinski compression)
  87890. ; ArtKoz_C7EC4:
  87891. ArtKos_WFZ: BINCLUDE "art/kosinski/WFZ_Supp.bin"
  87892. ;-----------------------------------------------------------------------------------
  87893. ; WFZ/SCZ 128x128 block mappings (Kosinski compression)
  87894. BM128_WFZ: BINCLUDE "mappings/128x128/WFZ_SCZ.bin"
  87895.  
  87896. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  87897. ;-----------------------------------------------------------------------------------
  87898. ; Exit curve + slope up
  87899. ;-----------------------------------------------------------------------------------
  87900. ; Special stage tube mappings ; MapSpec_CA904:
  87901. MapSpec_Rise1: BINCLUDE "mappings/special stage/Slope up - Frame 1.bin"
  87902. ;-----------------------------------------------------------------------------------
  87903. ; Special stage tube mappings ; MapSpec_CADA8:
  87904. MapSpec_Rise2: BINCLUDE "mappings/special stage/Slope up - Frame 2.bin"
  87905. ;-----------------------------------------------------------------------------------
  87906. ; Special stage tube mappings ; MapSpec_CB376:
  87907. MapSpec_Rise3: BINCLUDE "mappings/special stage/Slope up - Frame 3.bin"
  87908. ;-----------------------------------------------------------------------------------
  87909. ; Special stage tube mappings ; MapSpec_CB92E:
  87910. MapSpec_Rise4: BINCLUDE "mappings/special stage/Slope up - Frame 4.bin"
  87911. ;-----------------------------------------------------------------------------------
  87912. ; Special stage tube mappings ; MapSpec_CBF92:
  87913. MapSpec_Rise5: BINCLUDE "mappings/special stage/Slope up - Frame 5.bin"
  87914. ;-----------------------------------------------------------------------------------
  87915. ; Special stage tube mappings ; MapSpec_CC5BE:
  87916. MapSpec_Rise6: BINCLUDE "mappings/special stage/Slope up - Frame 6.bin"
  87917. ;-----------------------------------------------------------------------------------
  87918. ; Special stage tube mappings ; MapSpec_CCC7A:
  87919. MapSpec_Rise7: BINCLUDE "mappings/special stage/Slope up - Frame 7.bin"
  87920. ;-----------------------------------------------------------------------------------
  87921. ; Special stage tube mappings ; MapSpec_CD282:
  87922. MapSpec_Rise8: BINCLUDE "mappings/special stage/Slope up - Frame 8.bin"
  87923. ;-----------------------------------------------------------------------------------
  87924. ; Special stage tube mappings ; MapSpec_CD7C0:
  87925. MapSpec_Rise9: BINCLUDE "mappings/special stage/Slope up - Frame 9.bin"
  87926. ;-----------------------------------------------------------------------------------
  87927. ; Special stage tube mappings ; MapSpec_CDD44:
  87928. MapSpec_Rise10: BINCLUDE "mappings/special stage/Slope up - Frame 10.bin"
  87929. ;-----------------------------------------------------------------------------------
  87930. ; Special stage tube mappings ; MapSpec_CE2BE:
  87931. MapSpec_Rise11: BINCLUDE "mappings/special stage/Slope up - Frame 11.bin"
  87932. ;-----------------------------------------------------------------------------------
  87933. ; Special stage tube mappings ; MapSpec_CE7DE:
  87934. MapSpec_Rise12: BINCLUDE "mappings/special stage/Slope up - Frame 12.bin"
  87935. ;-----------------------------------------------------------------------------------
  87936. ; Special stage tube mappings ; MapSpec_CEC52:
  87937. MapSpec_Rise13: BINCLUDE "mappings/special stage/Slope up - Frame 13.bin"
  87938. ;-----------------------------------------------------------------------------------
  87939. ; Special stage tube mappings ; MapSpec_CF0BC:
  87940. MapSpec_Rise14: BINCLUDE "mappings/special stage/Slope up - Frame 14.bin"
  87941. ;-----------------------------------------------------------------------------------
  87942. ; Special stage tube mappings ; MapSpec_CF580:
  87943. MapSpec_Rise15: BINCLUDE "mappings/special stage/Slope up - Frame 15.bin"
  87944. ;-----------------------------------------------------------------------------------
  87945. ; Special stage tube mappings ; MapSpec_CFA00:
  87946. MapSpec_Rise16: BINCLUDE "mappings/special stage/Slope up - Frame 16.bin"
  87947. ;-----------------------------------------------------------------------------------
  87948. ; Special stage tube mappings ; MapSpec_CFE4A:
  87949. MapSpec_Rise17: BINCLUDE "mappings/special stage/Slope up - Frame 17.bin"
  87950.  
  87951. ;-----------------------------------------------------------------------------------
  87952. ; Straight path
  87953. ;-----------------------------------------------------------------------------------
  87954. ; Special stage tube mappings ; MapSpec_D028C:
  87955. MapSpec_Straight1: BINCLUDE "mappings/special stage/Straight path - Frame 1.bin"
  87956. ;-----------------------------------------------------------------------------------
  87957. ; Special stage tube mappings ; MapSpec_D090A:
  87958. MapSpec_Straight2: BINCLUDE "mappings/special stage/Straight path - Frame 2.bin"
  87959. ;-----------------------------------------------------------------------------------
  87960. ; Special stage tube mappings ; MapSpec_D0EA6:
  87961. MapSpec_Straight3: BINCLUDE "mappings/special stage/Straight path - Frame 3.bin"
  87962. ;-----------------------------------------------------------------------------------
  87963. ; Special stage tube mappings ; MapSpec_D1400:
  87964. MapSpec_Straight4: BINCLUDE "mappings/special stage/Straight path - Frame 4.bin"
  87965.  
  87966. ;-----------------------------------------------------------------------------------
  87967. ; Exit curve + slope down
  87968. ;-----------------------------------------------------------------------------------
  87969. ; Special stage tube mappings ; MapSpec_D19FC:
  87970. MapSpec_Drop1: BINCLUDE "mappings/special stage/Slope down - Frame 1.bin"
  87971. ;-----------------------------------------------------------------------------------
  87972. ; Special stage tube mappings ; MapSpec_D1EAC:
  87973. MapSpec_Drop2: BINCLUDE "mappings/special stage/Slope down - Frame 2.bin"
  87974. ;-----------------------------------------------------------------------------------
  87975. ; Special stage tube mappings ; MapSpec_D23AE:
  87976. MapSpec_Drop3: BINCLUDE "mappings/special stage/Slope down - Frame 3.bin"
  87977. ;-----------------------------------------------------------------------------------
  87978. ; Special stage tube mappings ; MapSpec_D27C6:
  87979. MapSpec_Drop4: BINCLUDE "mappings/special stage/Slope down - Frame 4.bin"
  87980. ;-----------------------------------------------------------------------------------
  87981. ; Special stage tube mappings ; MapSpec_D2C14:
  87982. MapSpec_Drop5: BINCLUDE "mappings/special stage/Slope down - Frame 5.bin"
  87983. ;-----------------------------------------------------------------------------------
  87984. ; Special stage tube mappings ; MapSpec_D3092:
  87985. MapSpec_Drop6: BINCLUDE "mappings/special stage/Slope down - Frame 6.bin"
  87986. ;-----------------------------------------------------------------------------------
  87987. ; Special stage tube mappings ; MapSpec_D3522:
  87988. MapSpec_Drop7: BINCLUDE "mappings/special stage/Slope down - Frame 7.bin"
  87989. ;-----------------------------------------------------------------------------------
  87990. ; Special stage tube mappings ; MapSpec_D39EC:
  87991. MapSpec_Drop8: BINCLUDE "mappings/special stage/Slope down - Frame 8.bin"
  87992. ;-----------------------------------------------------------------------------------
  87993. ; Special stage tube mappings ; MapSpec_D3F78:
  87994. MapSpec_Drop9: BINCLUDE "mappings/special stage/Slope down - Frame 9.bin"
  87995. ;-----------------------------------------------------------------------------------
  87996. ; Special stage tube mappings ; MapSpec_D4660:
  87997. MapSpec_Drop10: BINCLUDE "mappings/special stage/Slope down - Frame 10.bin"
  87998. ;-----------------------------------------------------------------------------------
  87999. ; Special stage tube mappings ; MapSpec_D4DA6:
  88000. MapSpec_Drop11: BINCLUDE "mappings/special stage/Slope down - Frame 11.bin"
  88001. ;-----------------------------------------------------------------------------------
  88002. ; Special stage tube mappings ; MapSpec_D53FC:
  88003. MapSpec_Drop12: BINCLUDE "mappings/special stage/Slope down - Frame 12.bin"
  88004. ;-----------------------------------------------------------------------------------
  88005. ; Special stage tube mappings ; MapSpec_D5958:
  88006. MapSpec_Drop13: BINCLUDE "mappings/special stage/Slope down - Frame 13.bin"
  88007. ;-----------------------------------------------------------------------------------
  88008. ; Special stage tube mappings ; MapSpec_D5F02:
  88009. MapSpec_Drop14: BINCLUDE "mappings/special stage/Slope down - Frame 14.bin"
  88010. ;-----------------------------------------------------------------------------------
  88011. ; Special stage tube mappings ; MapSpec_D6596:
  88012. MapSpec_Drop15: BINCLUDE "mappings/special stage/Slope down - Frame 15.bin"
  88013. ;-----------------------------------------------------------------------------------
  88014. ; Special stage tube mappings ; MapSpec_D6BAA:
  88015. MapSpec_Drop16: BINCLUDE "mappings/special stage/Slope down - Frame 16.bin"
  88016. ;-----------------------------------------------------------------------------------
  88017. ; Special stage tube mappings ; MapSpec_D702E:
  88018. MapSpec_Drop17: BINCLUDE "mappings/special stage/Slope down - Frame 17.bin"
  88019.  
  88020. ;-----------------------------------------------------------------------------------
  88021. ; Curved path
  88022. ;-----------------------------------------------------------------------------------
  88023. ; Special stage tube mappings ; MapSpec_D749C:
  88024. MapSpec_Turning1: BINCLUDE "mappings/special stage/Curve right - Frame 1.bin"
  88025. ;-----------------------------------------------------------------------------------
  88026. ; Special stage tube mappings ; MapSpec_D7912:
  88027. MapSpec_Turning2: BINCLUDE "mappings/special stage/Curve right - Frame 2.bin"
  88028. ;-----------------------------------------------------------------------------------
  88029. ; Special stage tube mappings ; MapSpec_D7DAA:
  88030. MapSpec_Turning3: BINCLUDE "mappings/special stage/Curve right - Frame 3.bin"
  88031. ;-----------------------------------------------------------------------------------
  88032. ; Special stage tube mappings ; MapSpec_D8250:
  88033. MapSpec_Turning4: BINCLUDE "mappings/special stage/Curve right - Frame 4.bin"
  88034. ;-----------------------------------------------------------------------------------
  88035. ; Special stage tube mappings ; MapSpec_D85F8:
  88036. MapSpec_Turning5: BINCLUDE "mappings/special stage/Curve right - Frame 5.bin"
  88037. ;-----------------------------------------------------------------------------------
  88038. ; Special stage tube mappings ; MapSpec_D89EC:
  88039. MapSpec_Turning6: BINCLUDE "mappings/special stage/Curve right - Frame 6.bin"
  88040.  
  88041. ;-----------------------------------------------------------------------------------
  88042. ; Exit curve
  88043. ;-----------------------------------------------------------------------------------
  88044. ; Special stage tube mappings
  88045. ; Exit curve ; MapSpec_D8E24:
  88046. MapSpec_Unturn1: BINCLUDE "mappings/special stage/Curve right - Frame 7.bin"
  88047. ;-----------------------------------------------------------------------------------
  88048. ; Special stage tube mappings
  88049. ; Exit curve ; MapSpec_D92B6:
  88050. MapSpec_Unturn2: BINCLUDE "mappings/special stage/Curve right - Frame 8.bin"
  88051. ;-----------------------------------------------------------------------------------
  88052. ; Special stage tube mappings
  88053. ; Exit curve ; MapSpec_D9778:
  88054. MapSpec_Unturn3: BINCLUDE "mappings/special stage/Curve right - Frame 9.bin"
  88055. ;-----------------------------------------------------------------------------------
  88056. ; Special stage tube mappings
  88057. ; Exit curve ; MapSpec_D9B80:
  88058. MapSpec_Unturn4: BINCLUDE "mappings/special stage/Curve right - Frame 10.bin"
  88059. ;-----------------------------------------------------------------------------------
  88060. ; Special stage tube mappings
  88061. ; Exit curve ; MapSpec_DA016:
  88062. MapSpec_Unturn5: BINCLUDE "mappings/special stage/Curve right - Frame 11.bin"
  88063.  
  88064. ;-----------------------------------------------------------------------------------
  88065. ; Enter curve
  88066. ;-----------------------------------------------------------------------------------
  88067. ; Special stage tube mappings
  88068. ; Begin curve right ; MapSpec_DA4CE:
  88069. MapSpec_Turn1: BINCLUDE "mappings/special stage/Begin curve right - Frame 1.bin"
  88070. ;-----------------------------------------------------------------------------------
  88071. ; Special stage tube mappings
  88072. ; Begin curve right ; MapSpec_DAB20:
  88073. MapSpec_Turn2: BINCLUDE "mappings/special stage/Begin curve right - Frame 2.bin"
  88074. ;-----------------------------------------------------------------------------------
  88075. ; Special stage tube mappings
  88076. ; Begin curve right ; MapSpec_DB086:
  88077. MapSpec_Turn3: BINCLUDE "mappings/special stage/Begin curve right - Frame 3.bin"
  88078. ;-----------------------------------------------------------------------------------
  88079. ; Special stage tube mappings
  88080. ; Begin curve right ; MapSpec_DB5AE:
  88081. MapSpec_Turn4: BINCLUDE "mappings/special stage/Begin curve right - Frame 4.bin"
  88082. ;-----------------------------------------------------------------------------------
  88083. ; Special stage tube mappings
  88084. ; Begin curve right ; MapSpec_DBB62:
  88085. MapSpec_Turn5: BINCLUDE "mappings/special stage/Begin curve right - Frame 5.bin"
  88086. ;-----------------------------------------------------------------------------------
  88087. ; Special stage tube mappings
  88088. ; Begin curve right ; MapSpec_DC154:
  88089. MapSpec_Turn6: BINCLUDE "mappings/special stage/Begin curve right - Frame 6.bin"
  88090. ;-----------------------------------------------------------------------------------
  88091. ; Special stage tube mappings
  88092. ; Begin curve right ; MapSpec_DC5E8:
  88093. MapSpec_Turn7: BINCLUDE "mappings/special stage/Begin curve right - Frame 7.bin"
  88094.  
  88095. ;--------------------------------------------------------------------------------------
  88096. ; Kosinski compressed art
  88097. ; Special stage level patterns
  88098. ; Note: Only one line of each tile is stored in this archive. The other 7 lines are
  88099. ; the same as this one line, so to get the full tiles, each line needs to be
  88100. ; duplicated 7 times over. ; ArtKoz_DCA38:
  88101. ;--------------------------------------------------------------------------------------
  88102. ArtKos_Special: BINCLUDE "art/kosinski/SpecStag.bin"
  88103. ;--------------------------------------------------------------------------------------
  88104. ; Nemesis compressed art (127 blocks)
  88105. ; Background patterns for special stage ; ArtNem_DCD68:
  88106. even
  88107. ArtNem_SpecialBack: BINCLUDE "art/nemesis/Background art for special stage.bin"
  88108. ;--------------------------------------------------------------------------------------
  88109. ; Enigma compressed tile mappings
  88110. ; Main background mappings for special stage ; MapEng_DD1DE:
  88111. MapEng_SpecialBack: BINCLUDE "mappings/misc/Main background mappings for special stage.bin"
  88112. ;--------------------------------------------------------------------------------------
  88113. ; Enigma compressed tile mappings
  88114. ; Lower background mappings for special stage ; MapEng_DD30C:
  88115. MapEng_SpecialBackBottom: BINCLUDE "mappings/misc/Lower background mappings for special stage.bin"
  88116. ;--------------------------------------------------------------------------------------
  88117. ; Nemesis compressed art (62 blocks)
  88118. ; Sonic/Miles and number text from special stage ; ArtNem_DD48A:
  88119. even
  88120. ArtNem_SpecialHUD: BINCLUDE "art/nemesis/Sonic and Miles number text from special stage.bin"
  88121. ;--------------------------------------------------------------------------------------
  88122. ; Nemesis compressed art (48 blocks)
  88123. ; "Start" and checkered flag patterns in special stage ; ArtNem_DD790:
  88124. even
  88125. ArtNem_SpecialStart: BINCLUDE "art/nemesis/Start text from special stage.bin"
  88126. ;--------------------------------------------------------------------------------------
  88127. ; Nemesis compressed art (37 blocks)
  88128. ; Stars in special stage ; ArtNem_DD8CE:
  88129. even
  88130. ArtNem_SpecialStars: BINCLUDE "art/nemesis/Stars in special stage.bin"
  88131. ;--------------------------------------------------------------------------------------
  88132. ; Nemesis compressed art (13 blocks)
  88133. ; Text for most of the "Player VS Player" message in 2P special stage ; ArtNem_DD9C8:
  88134. even
  88135. ArtNem_SpecialPlayerVSPlayer: BINCLUDE "art/nemesis/Special stage Player VS Player text.bin"
  88136. ;--------------------------------------------------------------------------------------
  88137. ; Nemesis compressed art (104 blocks)
  88138. ; Ring patterns in special stage ; ArtNem_DDA7E:
  88139. even
  88140. ArtNem_SpecialRings: BINCLUDE "art/nemesis/Special stage ring art.bin"
  88141. ;--------------------------------------------------------------------------------------
  88142. ; Nemesis compressed art (38 blocks)
  88143. ; Horizontal shadow patterns in special stage ; ArtNem_DDFA4:
  88144. even
  88145. ArtNem_SpecialFlatShadow: BINCLUDE "art/nemesis/Horizontal shadow from special stage.bin"
  88146. ;--------------------------------------------------------------------------------------
  88147. ; Nemesis compressed art (58 blocks)
  88148. ; Diagonal shadow patterns in special stage ; ArtNem_DE05A:
  88149. even
  88150. ArtNem_SpecialDiagShadow: BINCLUDE "art/nemesis/Diagonal shadow from special stage.bin"
  88151. ;--------------------------------------------------------------------------------------
  88152. ; Nemesis compressed art (25 blocks)
  88153. ; Vertical shadow patterns in special stage ; ArtNem_DE120:
  88154. even
  88155. ArtNem_SpecialSideShadow: BINCLUDE "art/nemesis/Vertical shadow from special stage.bin"
  88156. ;--------------------------------------------------------------------------------------
  88157. ; Nemesis compressed art (48 blocks)
  88158. ; Explosion patterns in special stage ; ArtNem_DE188:
  88159. even
  88160. ArtNem_SpecialExplosion: BINCLUDE "art/nemesis/Explosion from special stage.bin"
  88161. ;--------------------------------------------------------------------------------------
  88162. ; Nemesis compressed art (80 blocks)
  88163. ; Bomb patterns in special stage ; ArtNem_DE4BC:
  88164. even
  88165. ArtNem_SpecialBomb: BINCLUDE "art/nemesis/Bomb from special stage.bin"
  88166. ;--------------------------------------------------------------------------------------
  88167. ; Nemesis compressed art (46 blocks)
  88168. ; Emerald patterns in special stage ; ArtNem_DE8AC:
  88169. even
  88170. ArtNem_SpecialEmerald: BINCLUDE "art/nemesis/Emerald from special stage.bin"
  88171. ;--------------------------------------------------------------------------------------
  88172. ; Nemesis compressed art (99 blocks)
  88173. ; Text for the messages and thumbs up/down icon in special stage ; ArtNem_DEAF4:
  88174. even
  88175. ArtNem_SpecialMessages: BINCLUDE "art/nemesis/Special stage messages and icons.bin"
  88176. ;--------------------------------------------------------------------------------------
  88177. ; Nemesis compressed art (851 blocks)
  88178. ; Sonic and Tails animation frames from special stage
  88179. ; Art for Obj09 and Obj10 and Obj88 ; ArtNem_DEEAE:
  88180. even
  88181. ArtNem_SpecialSonicAndTails: BINCLUDE "art/nemesis/Sonic and Tails animation frames in special stage.bin"
  88182. ;--------------------------------------------------------------------------------------
  88183. ; Nemesis compressed art (5 blocks)
  88184. ; "Tails" patterns from special stage ; ArtNem_E247E:
  88185. even
  88186. ArtNem_SpecialTailsText: BINCLUDE "art/nemesis/Tails text patterns from special stage.bin"
  88187.  
  88188. ;--------------------------------------------------------------------------------------
  88189. ; Special stage object perspective data (Kosinski compression) ; MiscKoz_E24FE:
  88190. ;--------------------------------------------------------------------------------------
  88191. MiscKoz_SpecialPerspective: BINCLUDE "misc/Special stage object perspective data (Kosinski compression).bin"
  88192. ;--------------------------------------------------------------------------------------
  88193. ; Special stage level layout (Nemesis compression) ; MiscNem_E34EE:
  88194. ;--------------------------------------------------------------------------------------
  88195. MiscKoz_SpecialLevelLayout: BINCLUDE "misc/Special stage level layouts (Nemesis compression).bin"
  88196. ;--------------------------------------------------------------------------------------
  88197. ; Special stage object location list (Kosinski compression) ; MiscKoz_E35F2:
  88198. ;--------------------------------------------------------------------------------------
  88199. MiscKoz_SpecialObjectLocations: BINCLUDE "misc/Special stage object location lists (Kosinski compression).bin"
  88200.  
  88201. ;--------------------------------------------------------------------------------------
  88202. ; Filler (free space) (unnecessary; could be replaced with "even")
  88203. ;--------------------------------------------------------------------------------------
  88204. align $100
  88205.  
  88206.  
  88207.  
  88208.  
  88209. ;--------------------------------------------------------------------------------------
  88210. ; Offset index of ring locations
  88211. ; The first commented number on each line is an array index; the second is the
  88212. ; associated zone.
  88213. ;--------------------------------------------------------------------------------------
  88214. Off_Rings: zoneOrderedOffsetTable 2,2
  88215. zoneOffsetTableEntry.w Rings_EHZ_1 ; 0 $00
  88216. zoneOffsetTableEntry.w Rings_EHZ_2 ; 1
  88217. zoneOffsetTableEntry.w Rings_Lev1_1 ; 2 $01
  88218. zoneOffsetTableEntry.w Rings_Lev1_2 ; 3
  88219. zoneOffsetTableEntry.w Rings_Lev2_1 ; 4 $02
  88220. zoneOffsetTableEntry.w Rings_Lev2_2 ; 5
  88221. zoneOffsetTableEntry.w Rings_Lev3_1 ; 6 $03
  88222. zoneOffsetTableEntry.w Rings_Lev3_2 ; 7
  88223. zoneOffsetTableEntry.w Rings_MTZ_1 ; 8 $04
  88224. zoneOffsetTableEntry.w Rings_MTZ_2 ; 9
  88225. zoneOffsetTableEntry.w Rings_MTZ_3 ; 10 $05
  88226. zoneOffsetTableEntry.w Rings_MTZ_4 ; 11
  88227. zoneOffsetTableEntry.w Rings_WFZ_1 ; 12 $06
  88228. zoneOffsetTableEntry.w Rings_WFZ_2 ; 13
  88229. zoneOffsetTableEntry.w Rings_HTZ_1 ; 14 $07
  88230. zoneOffsetTableEntry.w Rings_HTZ_2 ; 15
  88231. zoneOffsetTableEntry.w Rings_HPZ_1 ; 16 $08
  88232. zoneOffsetTableEntry.w Rings_HPZ_2 ; 17
  88233. zoneOffsetTableEntry.w Rings_Lev9_1 ; 18 $09
  88234. zoneOffsetTableEntry.w Rings_Lev9_2 ; 19
  88235. zoneOffsetTableEntry.w Rings_OOZ_1 ; 20 $0A
  88236. zoneOffsetTableEntry.w Rings_OOZ_2 ; 21
  88237. zoneOffsetTableEntry.w Rings_MCZ_1 ; 22 $0B
  88238. zoneOffsetTableEntry.w Rings_MCZ_2 ; 23
  88239. zoneOffsetTableEntry.w Rings_CNZ_1 ; 24 $0C
  88240. zoneOffsetTableEntry.w Rings_CNZ_2 ; 25
  88241. zoneOffsetTableEntry.w Rings_CPZ_1 ; 26 $0D
  88242. zoneOffsetTableEntry.w Rings_CPZ_2 ; 27
  88243. zoneOffsetTableEntry.w Rings_DEZ_1 ; 28 $0E
  88244. zoneOffsetTableEntry.w Rings_DEZ_2 ; 29
  88245. zoneOffsetTableEntry.w Rings_ARZ_1 ; 30 $0F
  88246. zoneOffsetTableEntry.w Rings_ARZ_2 ; 31
  88247. zoneOffsetTableEntry.w Rings_SCZ_1 ; 32 $10
  88248. zoneOffsetTableEntry.w Rings_SCZ_2 ; 33
  88249. zoneTableEnd
  88250.  
  88251. Rings_EHZ_1: BINCLUDE "level/rings/EHZ_1.bin"
  88252. Rings_EHZ_2: BINCLUDE "level/rings/EHZ_2.bin"
  88253. Rings_Lev1_1: BINCLUDE "level/rings/01_1.bin"
  88254. Rings_Lev1_2: BINCLUDE "level/rings/01_2.bin"
  88255. Rings_Lev2_1: BINCLUDE "level/rings/02_1.bin"
  88256. Rings_Lev2_2: BINCLUDE "level/rings/02_2.bin"
  88257. Rings_Lev3_1: BINCLUDE "level/rings/03_1.bin"
  88258. Rings_Lev3_2: BINCLUDE "level/rings/03_2.bin"
  88259. Rings_MTZ_1: BINCLUDE "level/rings/MTZ_1.bin"
  88260. Rings_MTZ_2: BINCLUDE "level/rings/MTZ_2.bin"
  88261. Rings_MTZ_3: BINCLUDE "level/rings/MTZ_3.bin"
  88262. Rings_MTZ_4: BINCLUDE "level/rings/MTZ_4.bin"
  88263. Rings_HTZ_1: BINCLUDE "level/rings/HTZ_1.bin"
  88264. Rings_HTZ_2: BINCLUDE "level/rings/HTZ_2.bin"
  88265. Rings_HPZ_1: BINCLUDE "level/rings/HPZ_1.bin"
  88266. Rings_HPZ_2: BINCLUDE "level/rings/HPZ_2.bin"
  88267. Rings_Lev9_1: BINCLUDE "level/rings/09_1.bin"
  88268. Rings_Lev9_2: BINCLUDE "level/rings/09_2.bin"
  88269. Rings_OOZ_1: BINCLUDE "level/rings/OOZ_1.bin"
  88270. Rings_OOZ_2: BINCLUDE "level/rings/OOZ_2.bin"
  88271. Rings_MCZ_1: BINCLUDE "level/rings/MCZ_1.bin"
  88272. Rings_MCZ_2: BINCLUDE "level/rings/MCZ_2.bin"
  88273. Rings_CNZ_1: BINCLUDE "level/rings/CNZ_1.bin"
  88274. Rings_CNZ_2: BINCLUDE "level/rings/CNZ_2.bin"
  88275. Rings_CPZ_1: BINCLUDE "level/rings/CPZ_1.bin"
  88276. Rings_CPZ_2: BINCLUDE "level/rings/CPZ_2.bin"
  88277. Rings_DEZ_1: BINCLUDE "level/rings/DEZ_1.bin"
  88278. Rings_DEZ_2: BINCLUDE "level/rings/DEZ_2.bin"
  88279. Rings_WFZ_1: BINCLUDE "level/rings/WFZ_1.bin"
  88280. Rings_WFZ_2: BINCLUDE "level/rings/WFZ_2.bin"
  88281. Rings_ARZ_1: BINCLUDE "level/rings/ARZ_1.bin"
  88282. Rings_ARZ_2: BINCLUDE "level/rings/ARZ_2.bin"
  88283. Rings_SCZ_1: BINCLUDE "level/rings/SCZ_1.bin"
  88284. Rings_SCZ_2: BINCLUDE "level/rings/SCZ_2.bin"
  88285.  
  88286. ; --------------------------------------------------------------------------------------
  88287. ; Filler (free space) (unnecessary; could be replaced with "even")
  88288. ; --------------------------------------------------------------------------------------
  88289. align $200
  88290.  
  88291. ; --------------------------------------------------------------------------------------
  88292. ; Offset index of object locations
  88293. ; --------------------------------------------------------------------------------------
  88294. Off_Objects: zoneOrderedOffsetTable 2,2
  88295. zoneOffsetTableEntry.w Objects_EHZ_1 ; 0 $00
  88296. zoneOffsetTableEntry.w Objects_EHZ_2 ; 1
  88297. zoneOffsetTableEntry.w Objects_Null3 ; 2 $01
  88298. zoneOffsetTableEntry.w Objects_Null3 ; 3
  88299. zoneOffsetTableEntry.w Objects_Null3 ; 4 $02
  88300. zoneOffsetTableEntry.w Objects_Null3 ; 5
  88301. zoneOffsetTableEntry.w Objects_Null3 ; 6 $03
  88302. zoneOffsetTableEntry.w Objects_Null3 ; 7
  88303. zoneOffsetTableEntry.w Objects_MTZ_1 ; 8 $04
  88304. zoneOffsetTableEntry.w Objects_MTZ_2 ; 9
  88305. zoneOffsetTableEntry.w Objects_MTZ_3 ; 10 $05
  88306. zoneOffsetTableEntry.w Objects_MTZ_3 ; 11
  88307. zoneOffsetTableEntry.w Objects_WFZ_1 ; 12 $06
  88308. zoneOffsetTableEntry.w Objects_WFZ_2 ; 13
  88309. zoneOffsetTableEntry.w Objects_HTZ_1 ; 14 $07
  88310. zoneOffsetTableEntry.w Objects_HTZ_2 ; 15
  88311. zoneOffsetTableEntry.w Objects_HPZ_1 ; 16 $08
  88312. zoneOffsetTableEntry.w Objects_HPZ_2 ; 17
  88313. zoneOffsetTableEntry.w Objects_Null3 ; 18 $09
  88314. zoneOffsetTableEntry.w Objects_Null3 ; 19
  88315. zoneOffsetTableEntry.w Objects_OOZ_1 ; 20 $0A
  88316. zoneOffsetTableEntry.w Objects_OOZ_2 ; 21
  88317. zoneOffsetTableEntry.w Objects_MCZ_1 ; 22 $0B
  88318. zoneOffsetTableEntry.w Objects_MCZ_2 ; 23
  88319. zoneOffsetTableEntry.w Objects_CNZ_1 ; 24 $0C
  88320. zoneOffsetTableEntry.w Objects_CNZ_2 ; 25
  88321. zoneOffsetTableEntry.w Objects_CPZ_1 ; 26 $0D
  88322. zoneOffsetTableEntry.w Objects_CPZ_2 ; 27
  88323. zoneOffsetTableEntry.w Objects_DEZ_1 ; 28 $0E
  88324. zoneOffsetTableEntry.w Objects_DEZ_2 ; 29
  88325. zoneOffsetTableEntry.w Objects_ARZ_1 ; 30 $0F
  88326. zoneOffsetTableEntry.w Objects_ARZ_2 ; 31
  88327. zoneOffsetTableEntry.w Objects_SCZ_1 ; 32 $10
  88328. zoneOffsetTableEntry.w Objects_SCZ_2 ; 33
  88329. zoneTableEnd
  88330.  
  88331. ;Objects_Null1: ; looks unused, but it's really not. there must be a null entry first or you will get crashes. (try going left from second screen of EHZ1)
  88332. BINCLUDE "level/objects/Null_1.bin"
  88333.  
  88334. Objects_EHZ_1: BINCLUDE "level/objects/EHZ_1.bin"
  88335.  
  88336. if gameRevision=0
  88337. Objects_EHZ_2: BINCLUDE "level/objects/EHZ_2 (REV00).bin"
  88338. else
  88339. ; a collision switcher was moved
  88340. Objects_EHZ_2: BINCLUDE "level/objects/EHZ_2.bin"
  88341. endif
  88342.  
  88343. Objects_MTZ_1: BINCLUDE "level/objects/MTZ_1.bin"
  88344. Objects_MTZ_2: BINCLUDE "level/objects/MTZ_2.bin"
  88345. Objects_MTZ_3: BINCLUDE "level/objects/MTZ_3.bin"
  88346.  
  88347. if gameRevision=0
  88348. Objects_WFZ_1: BINCLUDE "level/objects/WFZ_1 (REV00).bin"
  88349. else
  88350. ; lampposts' 'remember state' flags were set
  88351. Objects_WFZ_1: BINCLUDE "level/objects/WFZ_1.bin"
  88352. endif
  88353.  
  88354. Objects_WFZ_2: BINCLUDE "level/objects/WFZ_2.bin"
  88355. Objects_HTZ_1: BINCLUDE "level/objects/HTZ_1.bin"
  88356. Objects_HTZ_2: BINCLUDE "level/objects/HTZ_2.bin"
  88357. Objects_HPZ_1: BINCLUDE "level/objects/HPZ_1.bin"
  88358. Objects_HPZ_2: BINCLUDE "level/objects/HPZ_2.bin"
  88359.  
  88360. ;Objects_Null2: ; unused
  88361. BINCLUDE "level/objects/Null_2.bin"
  88362.  
  88363. Objects_OOZ_1: BINCLUDE "level/objects/OOZ_1.bin"
  88364. Objects_OOZ_2: BINCLUDE "level/objects/OOZ_2.bin"
  88365. Objects_MCZ_1: BINCLUDE "level/objects/MCZ_1.bin"
  88366. Objects_MCZ_2: BINCLUDE "level/objects/MCZ_2.bin"
  88367.  
  88368. if gameRevision=0
  88369. Objects_CNZ_1: BINCLUDE "level/objects/CNZ_1 (REV00).bin"
  88370. Objects_CNZ_2: BINCLUDE "level/objects/CNZ_2 (REV00).bin"
  88371. else
  88372. ; the signposts were moved up slightly so they weren't poking out the bottom of the ground
  88373. Objects_CNZ_1: BINCLUDE "level/objects/CNZ_1.bin"
  88374. Objects_CNZ_2: BINCLUDE "level/objects/CNZ_2.bin"
  88375. endif
  88376.  
  88377. Objects_CPZ_1: BINCLUDE "level/objects/CPZ_1.bin"
  88378. Objects_CPZ_2: BINCLUDE "level/objects/CPZ_2.bin"
  88379. Objects_DEZ_1: BINCLUDE "level/objects/DEZ_1.bin"
  88380. Objects_DEZ_2: BINCLUDE "level/objects/DEZ_2.bin"
  88381. Objects_ARZ_1: BINCLUDE "level/objects/ARZ_1.bin"
  88382. Objects_ARZ_2: BINCLUDE "level/objects/ARZ_2.bin"
  88383. Objects_SCZ_1: BINCLUDE "level/objects/SCZ_1.bin"
  88384. Objects_SCZ_2: BINCLUDE "level/objects/SCZ_2.bin"
  88385. Objects_Null3: BINCLUDE "level/objects/Null_3.bin"
  88386.  
  88387. ;Objects_Null4: ; unused
  88388. BINCLUDE "level/objects/Null_4.bin"
  88389. ;Objects_Null5: ; unused
  88390. BINCLUDE "level/objects/Null_5.bin"
  88391. ;Objects_Null6: ; unused
  88392. BINCLUDE "level/objects/Null_6.bin"
  88393.  
  88394. ; --------------------------------------------------------------------------------------
  88395. ; Filler (free space) (unnecessary; could be replaced with "even")
  88396. ; --------------------------------------------------------------------------------------
  88397. align $1000
  88398.  
  88399.  
  88400.  
  88401.  
  88402. ; ---------------------------------------------------------------------------
  88403. ; Subroutine to load the sound driver
  88404. ; ---------------------------------------------------------------------------
  88405. ; sub_EC000:
  88406. SoundDriverLoad:
  88407. move sr,-(sp)
  88408. movem.l d0-a6,-(sp)
  88409. move #$2700,sr
  88410. lea (Z80_Bus_Request).l,a3
  88411. lea (Z80_Reset).l,a2
  88412. moveq #0,d2
  88413. move.w #$100,d1
  88414. move.w d1,(a3) ; get Z80 bus
  88415. move.w d1,(a2) ; release Z80 reset (was held high by console on startup)
  88416. - btst d2,(a3)
  88417. bne.s - ; wait until the 68000 has the bus
  88418. jsr DecompressSoundDriver(pc)
  88419. btst #0,(VDP_control_port+1).l ; check video mode
  88420. sne (Z80_RAM+zPalModeByte).l ; set if PAL
  88421. move.w d2,(a2) ; hold Z80 reset
  88422. move.w d2,(a3) ; release Z80 bus
  88423. moveq #$E6,d0
  88424. - dbf d0,- ; wait for 2,314 cycles
  88425. move.w d1,(a2) ; release Z80 reset
  88426. movem.l (sp)+,d0-a6
  88427. move (sp)+,sr
  88428. rts
  88429.  
  88430. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  88431. ; slightly modified Saxman decompression of the sound driver
  88432. ; a4 == $A00000 (start of Z80 RAM)
  88433. ; a5 == current position in Z80 RAM?
  88434. ; a6 == current position in compressed sound driver?
  88435. ; d0 == data to decompress? (byte)
  88436. ; d4 == ???
  88437. ; d5 == ???
  88438. ; d6 == ???
  88439. ; d7 == bytes left to decompress
  88440. ; loc_EC04A:
  88441. DecompressSoundDriver:
  88442. lea Snd_Driver(pc),a6
  88443. ; WARNING: the build script needs editing if you rename this label
  88444. movewZ80CompSize: move.w #Snd_Driver_End-Snd_Driver,d7 ; patched (by fixpointer.exe) after compression since the exact size can't be known beforehand
  88445. moveq #0,d6
  88446. lea (Z80_RAM).l,a5
  88447. moveq #0,d5
  88448. lea (Z80_RAM).l,a4
  88449.  
  88450. loc_EC062:
  88451. lsr.w #1,d6
  88452. btst #8,d6
  88453. bne.s +
  88454. jsr sub_EC0DE(pc)
  88455. move.b d0,d6
  88456. ori.w #$FF00,d6
  88457. +
  88458. btst #0,d6
  88459. beq.s loc_EC086
  88460. jsr sub_EC0DE(pc)
  88461. move.b d0,(a5)+
  88462. addq.w #1,d5
  88463. bra.w loc_EC062
  88464. ; ---------------------------------------------------------------------------
  88465.  
  88466. loc_EC086:
  88467. jsr sub_EC0DE(pc)
  88468. moveq #0,d4
  88469. move.b d0,d4
  88470. jsr sub_EC0DE(pc)
  88471. move.b d0,d3
  88472. andi.w #$F,d3
  88473. addq.w #2,d3
  88474. andi.w #$F0,d0
  88475. lsl.w #4,d0
  88476. add.w d0,d4
  88477. addi.w #$12,d4
  88478. andi.w #$FFF,d4
  88479. move.w d5,d0
  88480. andi.w #$F000,d0
  88481. add.w d0,d4
  88482. cmp.w d4,d5
  88483. bhs.s loc_EC0CC
  88484. subi.w #$1000,d4
  88485. bcc.s loc_EC0CC
  88486. add.w d3,d5
  88487. addq.w #1,d5
  88488.  
  88489. - move.b #0,(a5)+
  88490. dbf d3,-
  88491.  
  88492. bra.w loc_EC062
  88493. ; ---------------------------------------------------------------------------
  88494.  
  88495. loc_EC0CC:
  88496. add.w d3,d5
  88497. addq.w #1,d5
  88498.  
  88499. - move.b (a4,d4.w),(a5)+
  88500. addq.w #1,d4
  88501. dbf d3,-
  88502.  
  88503. bra.w loc_EC062
  88504. ; End of function DecompressSoundDriver
  88505.  
  88506.  
  88507. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  88508.  
  88509.  
  88510. sub_EC0DE:
  88511. move.b (a6)+,d0
  88512. subq.w #1,d7
  88513. bne.s +
  88514. addq.w #4,sp
  88515. +
  88516. rts
  88517. ; End of function sub_EC0DE
  88518.  
  88519. ; ===========================================================================
  88520. ; ---------------------------------------------------------------------------
  88521. ; S2 sound driver (Sound driver compression (slightly modified Saxman))
  88522. ; ---------------------------------------------------------------------------
  88523. ; loc_EC0E8:
  88524. Snd_Driver:
  88525. save
  88526. include "s2.sounddriver.asm" ; CPU Z80
  88527. restore
  88528. padding off
  88529. !org (Snd_Driver+Size_of_Snd_driver_guess) ; don't worry; I know what I'm doing
  88530.  
  88531.  
  88532. ; loc_ED04C:
  88533. Snd_Driver_End:
  88534.  
  88535.  
  88536.  
  88537.  
  88538. ; ---------------------------------------------------------------------------
  88539. ; Filler (free space)
  88540. ; ---------------------------------------------------------------------------
  88541. ; the DAC data has to line up with the end of the bank.
  88542.  
  88543. ; actually it only has to fit within one bank, but we'll line it up to the end anyway
  88544. ; because the padding gives the sound driver some room to grow
  88545. cnop -Size_of_DAC_samples, $8000
  88546.  
  88547. ; ---------------------------------------------------------------------------
  88548. ; DAC samples
  88549. ; ---------------------------------------------------------------------------
  88550. ; loc_ED100:
  88551. SndDAC_Start:
  88552.  
  88553. SndDAC_Sample1:
  88554. BINCLUDE "sound/DAC/Sample 1.bin"
  88555. SndDAC_Sample1_End
  88556.  
  88557. SndDAC_Sample2:
  88558. BINCLUDE "sound/DAC/Sample 2.bin"
  88559. SndDAC_Sample2_End
  88560.  
  88561. SndDAC_Sample5:
  88562. BINCLUDE "sound/DAC/Sample 5.bin"
  88563. SndDAC_Sample5_End
  88564.  
  88565. SndDAC_Sample6:
  88566. BINCLUDE "sound/DAC/Sample 6.bin"
  88567. SndDAC_Sample6_End
  88568.  
  88569. SndDAC_Sample3:
  88570. BINCLUDE "sound/DAC/Sample 3.bin"
  88571. SndDAC_Sample3_End
  88572.  
  88573. SndDAC_Sample4:
  88574. BINCLUDE "sound/DAC/Sample 4.bin"
  88575. SndDAC_Sample4_End
  88576.  
  88577. SndDAC_Sample7:
  88578. BINCLUDE "sound/DAC/Sample 7.bin"
  88579. SndDAC_Sample7_End
  88580.  
  88581. SndDAC_End
  88582.  
  88583. if SndDAC_End - SndDAC_Start > $8000
  88584. fatal "DAC samples must fit within $8000 bytes, but you have $\{SndDAC_End-SndDAC_Start } bytes of DAC samples."
  88585. endif
  88586. if SndDAC_End - SndDAC_Start > Size_of_DAC_samples
  88587. fatal "Size_of_DAC_samples = $\{Size_of_DAC_samples}, but you have $\{SndDAC_End-SndDAC_Start} bytes of DAC samples."
  88588. endif
  88589.  
  88590. ; ---------------------------------------------------------------------------
  88591. ; Music pointers
  88592. ; ---------------------------------------------------------------------------
  88593. ; loc_F0000:
  88594. MusicPoint1: startBank
  88595. MusPtr_Continue: rom_ptr_z80 Mus_Continue
  88596.  
  88597.  
  88598. Mus_Continue: BINCLUDE "sound/music/Continue.bin"
  88599.  
  88600. finishBank
  88601.  
  88602. ; --------------------------------------------------------------------
  88603. ; Nemesis compressed art (20 blocks)
  88604. ; Buzzer's fireball
  88605. ArtNem_Buzzer_Fireball: BINCLUDE "art/nemesis/Fireball 1 (Buzzer).bin"
  88606. ; --------------------------------------------------------------------
  88607. ; Nemesis compressed art (24 blocks)
  88608. ; Waterfall tiles
  88609. ArtNem_Waterfall: BINCLUDE "art/nemesis/Waterfall tiles.bin"
  88610. ; --------------------------------------------------------------------
  88611. ; Nemesis compressed art (16 blocks)
  88612. ; Another fireball
  88613. ArtNem_HtzFireball: BINCLUDE "art/nemesis/Fireball 2.bin"
  88614. ; --------------------------------------------------------------------
  88615. ; Nemesis compressed art (8 blocks)
  88616. ; Bridge in EHZ
  88617. ArtNem_EHZ_Bridge: BINCLUDE "art/nemesis/EHZ bridge.bin"
  88618. ; --------------------------------------------------------------------
  88619. ; Nemesis compressed art (48 blocks)
  88620. ; Diagonally moving lift in HTZ
  88621. ArtNem_HtzZipline: BINCLUDE "art/nemesis/HTZ zip-line platform.bin"
  88622. ; --------------------------------------------------------------------
  88623. ; Nemesis compressed art (4 blocks)
  88624. ; One way barrier from HTZ
  88625. ArtNem_HtzValveBarrier: BINCLUDE "art/nemesis/One way barrier from HTZ.bin"
  88626. ; --------------------------------------------------------------------
  88627. ; Nemesis compressed art (24 blocks)
  88628. ; See-saw in HTZ
  88629. ArtNem_HtzSeeSaw: BINCLUDE "art/nemesis/See-saw in HTZ.bin"
  88630. ; --------------------------------------------------------------------
  88631. ; Nemesis compressed art (24 blocks)
  88632. ; Unused Fireball
  88633. ;ArtNem_F0B06:
  88634. BINCLUDE "art/nemesis/Fireball 3.bin"
  88635. ; --------------------------------------------------------------------
  88636. ; Nemesis compressed art (20 blocks)
  88637. ; Rock from HTZ
  88638. ArtNem_HtzRock: BINCLUDE "art/nemesis/Rock from HTZ.bin"
  88639. ; --------------------------------------------------------------------
  88640. ; Nemesis compressed art (4 blocks)
  88641. ; Orbit badnik from HTZ ; ArtNem_HtzSol:
  88642. ArtNem_Sol: BINCLUDE "art/nemesis/Sol badnik from HTZ.bin"
  88643. ; --------------------------------------------------------------------
  88644. ; Nemesis compressed art (120 blocks)
  88645. ; Large spinning wheel from MTZ
  88646. ArtNem_MtzWheel: BINCLUDE "art/nemesis/Large spinning wheel from MTZ.bin"
  88647. ; --------------------------------------------------------------------
  88648. ; Nemesis compressed art (9 blocks)
  88649. ; Indent in large spinning wheel from MTZ
  88650. ArtNem_MtzWheelIndent: BINCLUDE "art/nemesis/Large spinning wheel from MTZ - indent.bin"
  88651. ; --------------------------------------------------------------------
  88652. ; Nemesis compressed art (8 blocks)
  88653. ; Spike block from MTZ
  88654. ArtNem_MtzSpikeBlock: BINCLUDE "art/nemesis/MTZ spike block.bin"
  88655. ; --------------------------------------------------------------------
  88656. ; Nemesis compressed art (15 blocks)
  88657. ; Steam from MTZ
  88658. ArtNem_MtzSteam: BINCLUDE "art/nemesis/Steam from MTZ.bin"
  88659. ; --------------------------------------------------------------------
  88660. ; Nemesis compressed art (8 blocks)
  88661. ; Spike from MTZ
  88662. ArtNem_MtzSpike: BINCLUDE "art/nemesis/Spike from MTZ.bin"
  88663. ; --------------------------------------------------------------------
  88664. ; Nemesis compressed art (54 blocks)
  88665. ; Similarly shaded blocks from MTZ
  88666. ArtNem_MtzAsstBlocks: BINCLUDE "art/nemesis/Similarly shaded blocks from MTZ.bin"
  88667. ; --------------------------------------------------------------------
  88668. ; Nemesis compressed art (9 blocks)
  88669. ; Lava bubble from MTZ
  88670. ArtNem_MtzLavaBubble: BINCLUDE "art/nemesis/Lava bubble from MTZ.bin"
  88671. ; --------------------------------------------------------------------
  88672. ; Nemesis compressed art (4 blocks)
  88673. ; Lava cup
  88674. ArtNem_LavaCup: BINCLUDE "art/nemesis/Lava cup from MTZ.bin"
  88675. ; --------------------------------------------------------------------
  88676. ; Nemesis compressed art (8 blocks)
  88677. ; End of a bolt and rope from MTZ
  88678. ArtNem_BoltEnd_Rope: BINCLUDE "art/nemesis/Bolt end and rope from MTZ.bin"
  88679. ; --------------------------------------------------------------------
  88680. ; Nemesis compressed art (12 blocks)
  88681. ; Small cog from MTZ
  88682. ArtNem_MtzCog: BINCLUDE "art/nemesis/Small cog from MTZ.bin"
  88683. ; --------------------------------------------------------------------
  88684. ; Nemesis compressed art (4 blocks)
  88685. ; Flash inside spin tube from MTZ
  88686. ArtNem_MtzSpinTubeFlash: BINCLUDE "art/nemesis/Spin tube flash from MTZ.bin"
  88687. ; --------------------------------------------------------------------
  88688. ; Nemesis compressed art (32 blocks)
  88689. ; Large wooden box from MCZ ; ArtNem_F187C:
  88690. ArtNem_Crate: BINCLUDE "art/nemesis/Large wooden box from MCZ.bin"
  88691. ; --------------------------------------------------------------------
  88692. ; Nemesis compressed art (26 blocks)
  88693. ; Collapsing platform from MCZ ; ArtNem_F1ABA:
  88694. ArtNem_MCZCollapsePlat: BINCLUDE "art/nemesis/Collapsing platform from MCZ.bin"
  88695. ; --------------------------------------------------------------------
  88696. ; Nemesis compressed art (16 blocks)
  88697. ; Switch that you pull on from MCZ ; ArtNem_F1C64:
  88698. ArtNem_VineSwitch: BINCLUDE "art/nemesis/Pull switch from MCZ.bin"
  88699. ; --------------------------------------------------------------------
  88700. ; Nemesis compressed art (10 blocks)
  88701. ; Vine that lowers in MCZ ; ArtNem_F1D5C:
  88702. ArtNem_VinePulley: BINCLUDE "art/nemesis/Vine that lowers from MCZ.bin"
  88703. ; --------------------------------------------------------------------
  88704. ; Nemesis compressed art (20 blocks)
  88705. ; Log viewed from the end for folding gates in MCZ (start of MCZ2) ; ArtNem_F1E06:
  88706. ArtNem_MCZGateLog: BINCLUDE "art/nemesis/Drawbridge logs from MCZ.bin"
  88707.  
  88708. ; ----------------------------------------------------------------------------------
  88709. ; Filler (free space)
  88710. ; ----------------------------------------------------------------------------------
  88711. ; the PCM data has to line up with the end of the bank.
  88712. cnop -Size_of_SEGA_sound, $8000
  88713.  
  88714. ; -------------------------------------------------------------------------------
  88715. ; Sega Intro Sound
  88716. ; 8-bit unsigned raw audio at 16Khz
  88717. ; -------------------------------------------------------------------------------
  88718. ; loc_F1E8C:
  88719. Snd_Sega: BINCLUDE "sound/PCM/SEGA.bin"
  88720. Snd_Sega_End:
  88721.  
  88722. if Snd_Sega_End - Snd_Sega > $8000
  88723. fatal "Sega sound must fit within $8000 bytes, but you have a $\{Snd_Sega_End-Snd_Sega} byte Sega sound."
  88724. endif
  88725. if Snd_Sega_End - Snd_Sega > Size_of_SEGA_sound
  88726. fatal "Size_of_SEGA_sound = $\{Size_of_SEGA_sound}, but you have a $\{Snd_Sega_End-Snd_Sega} byte Sega sound."
  88727. endif
  88728.  
  88729. ; ------------------------------------------------------------------------------
  88730. ; Music pointers
  88731. ; ------------------------------------------------------------------------------
  88732. ; loc_F8000:
  88733. MusicPoint2: startBank
  88734. MusPtr_CNZ_2P: rom_ptr_z80 Mus_CNZ_2P
  88735. MusPtr_EHZ: rom_ptr_z80 Mus_EHZ
  88736. MusPtr_MTZ: rom_ptr_z80 Mus_MTZ
  88737. MusPtr_CNZ: rom_ptr_z80 Mus_CNZ
  88738. MusPtr_MCZ: rom_ptr_z80 Mus_MCZ
  88739. MusPtr_MCZ_2P: rom_ptr_z80 Mus_MCZ_2P
  88740. MusPtr_ARZ: rom_ptr_z80 Mus_ARZ
  88741. MusPtr_DEZ: rom_ptr_z80 Mus_DEZ
  88742. MusPtr_SpecStage: rom_ptr_z80 Mus_SpecStage
  88743. MusPtr_Options: rom_ptr_z80 Mus_Options
  88744. MusPtr_Ending: rom_ptr_z80 Mus_Ending
  88745. MusPtr_EndBoss: rom_ptr_z80 Mus_EndBoss
  88746. MusPtr_CPZ: rom_ptr_z80 Mus_CPZ
  88747. MusPtr_Boss: rom_ptr_z80 Mus_Boss
  88748. MusPtr_SCZ: rom_ptr_z80 Mus_SCZ
  88749. MusPtr_OOZ: rom_ptr_z80 Mus_OOZ
  88750. MusPtr_WFZ: rom_ptr_z80 Mus_WFZ
  88751. MusPtr_EHZ_2P: rom_ptr_z80 Mus_EHZ_2P
  88752. MusPtr_2PResult: rom_ptr_z80 Mus_2PResult
  88753. MusPtr_SuperSonic: rom_ptr_z80 Mus_SuperSonic
  88754. MusPtr_HTZ: rom_ptr_z80 Mus_HTZ
  88755. MusPtr_ExtraLife: rom_ptr_z80 Mus_ExtraLife
  88756. MusPtr_Title: rom_ptr_z80 Mus_Title
  88757. MusPtr_EndLevel: rom_ptr_z80 Mus_EndLevel
  88758. MusPtr_GameOver: rom_ptr_z80 Mus_GameOver
  88759. MusPtr_Invincible: rom_ptr_z80 Mus_Invincible
  88760. MusPtr_Emerald: rom_ptr_z80 Mus_Emerald
  88761. MusPtr_HPZ: rom_ptr_z80 Mus_HPZ
  88762. MusPtr_Drowning: rom_ptr_z80 Mus_Drowning
  88763. MusPtr_Credits: rom_ptr_z80 Mus_Credits
  88764.  
  88765. ; loc_F803C:
  88766. Mus_HPZ: BINCLUDE "sound/music/HPZ.bin"
  88767. Mus_Drowning: BINCLUDE "sound/music/Drowning.bin"
  88768. Mus_Invincible: BINCLUDE "sound/music/Invincible.bin"
  88769. Mus_CNZ_2P: BINCLUDE "sound/music/CNZ_2p.bin"
  88770. Mus_EHZ: BINCLUDE "sound/music/EHZ.bin"
  88771. Mus_MTZ: BINCLUDE "sound/music/MTZ.bin"
  88772. Mus_CNZ: BINCLUDE "sound/music/CNZ.bin"
  88773. Mus_MCZ: BINCLUDE "sound/music/MCZ.bin"
  88774. Mus_MCZ_2P: BINCLUDE "sound/music/MCZ_2p.bin"
  88775. Mus_ARZ: BINCLUDE "sound/music/ARZ.bin"
  88776. Mus_DEZ: BINCLUDE "sound/music/DEZ.bin"
  88777. Mus_SpecStage: BINCLUDE "sound/music/SpecStg.bin"
  88778. Mus_Options: BINCLUDE "sound/music/Options.bin"
  88779. Mus_Ending: BINCLUDE "sound/music/Ending.bin"
  88780. Mus_EndBoss: BINCLUDE "sound/music/End_Boss.bin"
  88781. Mus_CPZ: BINCLUDE "sound/music/CPZ.bin"
  88782. Mus_Boss: BINCLUDE "sound/music/Boss.bin"
  88783. Mus_SCZ: BINCLUDE "sound/music/SCZ.bin"
  88784. Mus_OOZ: BINCLUDE "sound/music/OOZ.bin"
  88785. Mus_WFZ: BINCLUDE "sound/music/WFZ.bin"
  88786. Mus_EHZ_2P: BINCLUDE "sound/music/EHZ_2p.bin"
  88787. Mus_2PResult: BINCLUDE "sound/music/2player results screen.bin"
  88788. Mus_SuperSonic: BINCLUDE "sound/music/Supersonic.bin"
  88789. Mus_HTZ: BINCLUDE "sound/music/HTZ.bin"
  88790. Mus_Title: BINCLUDE "sound/music/Title screen.bin"
  88791. Mus_EndLevel: BINCLUDE "sound/music/End of level.bin"
  88792.  
  88793. ; The following act mostly like sound effects
  88794. ; despite being listed with the music.
  88795. ; This means they're uncompressed format with absolute pointers
  88796. ; instead of compressed with relative pointers.
  88797. ; Because they have absolute pointers,
  88798. ; they have to be assembled rather than BINCLUDE'd.
  88799. ; See below (right before Sound20) for other notes
  88800. ; about the sound format that apply to these too.
  88801.  
  88802. ;Mus_ExtraLife: BINCLUDE "sound/music/Extra life.bin"
  88803. Mus_ExtraLife: dc.w z80_ptr(Mus_EL_Voices),$0603,$02CD
  88804. dc.w z80_ptr(Mus_EL_DAC),$0000
  88805. dc.w z80_ptr(Mus_EL_FM1),$E810
  88806. dc.w z80_ptr(Mus_EL_FM2),$E810
  88807. dc.w z80_ptr(Mus_EL_FM3),$E810
  88808. dc.w z80_ptr(Mus_EL_FM4),$E810
  88809. dc.w z80_ptr(Mus_EL_FM5),$E810
  88810. dc.w z80_ptr(Mus_EL_PSG1),$D008,$0005
  88811. dc.w z80_ptr(Mus_EL_PSG2),$DC08,$0005
  88812. dc.w z80_ptr(Mus_EL_PSG3),$DC00,$0004
  88813. Mus_EL_FM4: dc.b $E1,$03,$E0,$40,$F6
  88814. dc.w z80_ptr(+)
  88815. Mus_EL_FM1: dc.b $E0,$80
  88816. + dc.b $EF,$00,$E8,$06,$D9,$06,$03,$03,$06,$06
  88817. dc.b $E8,$00,$DB,$09,$D7,$D6,$06,$D9,$18,$F2
  88818. Mus_EL_FM2: dc.b $EF,$01,$E8,$06,$E2,$01,$D6,$06,$03,$03,$06,$06
  88819. dc.b $E8,$00,$D7,$09,$D4,$D2,$06,$D6,$18,$E2,$01,$F2
  88820. Mus_EL_FM5: dc.b $E1,$03,$E0,$40,$F6
  88821. dc.w z80_ptr(+)
  88822. Mus_EL_FM3: dc.b $E0,$80
  88823. + dc.b $EF,$02,$BA,$0C,$80,$06,$BA,$B8,$80,$03
  88824. dc.b $B8,$06,$80,$03,$B8,$06,$BA,$18,$F2
  88825. Mus_EL_PSG1: dc.b $E8,$06,$D6,$06,$03,$03,$06,$06,$E8,$00,$D7,$09
  88826. dc.b $D4,$D2,$06,$D6,$18
  88827. Mus_EL_PSG2:
  88828. Mus_EL_PSG3: dc.b $F2
  88829. Mus_EL_DAC: dc.b $88,$12,$06,$8B,$09,$09,$06,$88,$06,$8A,$88,$8A
  88830. dc.b $88,$0C,$E4
  88831. Mus_EL_Voices: dc.b $3A,$01,$01,$07,$01,$8E,$8D,$8E,$53,$0E,$0E,$0E
  88832. dc.b $03,$00,$00,$00,$00,$1F,$1F,$FF,$0F,$18,$16,$4E,$80
  88833. dc.b $3A,$01,$01,$07,$01,$8E,$8D,$8E,$53,$0E,$0E,$0E
  88834. dc.b $03,$00,$00,$00,$00,$1F,$1F,$FF,$0F,$18,$27,$28,$80
  88835. dc.b $3A,$01,$01,$07,$01,$8E,$8D,$8E,$53,$0E,$0E,$0E
  88836. dc.b $03,$00,$00,$00,$07,$1F,$1F,$FF,$0F,$18,$27,$28,$80
  88837.  
  88838.  
  88839. ;Mus_GameOver: BINCLUDE "sound/music/Game over.bin"
  88840. Mus_GameOver: dc.w z80_ptr(MusGO_Voices),$0603,$02F2
  88841. dc.w z80_ptr(MusGOver_DAC),$0000
  88842. dc.w z80_ptr(MusGOver_FM1),$E80A
  88843. dc.w z80_ptr(MusGOver_FM2),$F40F
  88844. dc.w z80_ptr(MusGOver_FM3),$F40F
  88845. dc.w z80_ptr(MusGOver_FM4),$F40D
  88846. dc.w z80_ptr(MusGOver_FM5),$DC16
  88847. dc.w z80_ptr(MusGOver_PSG),$D003,$0005
  88848. dc.w z80_ptr(MusGOver_PSG),$DC06,$0005
  88849. dc.w z80_ptr(MusGOver_PSG),$DC00,$0004
  88850. MusGOver_FM1: dc.b $EF,$00
  88851. dc.b $F0,$20,$01,$04,$05
  88852. dc.b $80,$0C,$CA,$12,$80,$06,$CA,$80,$CB,$12,$C8,$1E
  88853. dc.b $CA,$06,$80,$CA,$80,$CA,$80,$C6,$80,$C4,$12,$C8
  88854. dc.b $0C,$80,$12,$C9,$04,$80,$C9,$C8,$06,$80,$C7,$80
  88855. dc.b $C6,$80
  88856. dc.b $F0,$28,$01,$18,$05
  88857. dc.b $C5,$60,$F2
  88858. MusGOver_FM2: dc.b $EF,$01,$80,$01,$D9,$06,$80,$D9,$80,$D6,$80,$D6
  88859. dc.b $80,$D7,$15,$D7,$1B,$D9,$06,$80,$D9,$80,$D6,$80
  88860. dc.b $D6,$80,$DC,$15,$DC,$1B,$F2
  88861. MusGOver_FM3: dc.b $EF,$01,$D6,$0C,$D6,$D2,$D2,$D4,$15,$D4,$1B,$D6
  88862. dc.b $0C,$D6,$D2,$D2,$D7,$15,$D7,$1B,$F2
  88863. MusGOver_FM4: dc.b $EF,$02,$E2,$01,$AE,$06,$80,$AE,$80,$A9,$80,$A9
  88864. dc.b $80,$AC,$15,$AB,$0C,$AC,$03,$AB,$0C,$AE,$06,$80
  88865. dc.b $AE,$80,$A9,$80,$A9,$80,$B3,$15,$B2,$0C,$B3,$03
  88866. dc.b $B2,$0C,$AE,$04,$80,$AE,$AD,$06,$80,$AC,$80,$AB
  88867. dc.b $80,$AB,$60,$E2,$01,$F2
  88868. MusGOver_FM5: dc.b $EF,$03,$80,$30,$D7,$12,$80,$03,$D7,$1B,$80,$30
  88869. dc.b $DC,$12,$80,$03,$DC,$1B
  88870. MusGOver_PSG: dc.b $F2
  88871. MusGOver_DAC: dc.b $80,$18,$81
  88872. dc.b $F7,$00,$04
  88873. dc.w z80_ptr(MusGOver_DAC)
  88874. dc.b $F2
  88875. MusGO_Voices: dc.b $3A,$51,$51,$08,$02,$1E,$1E,$1E,$10,$1F,$1F,$1F
  88876. dc.b $0F,$00,$00,$00,$02,$0F,$0F,$0F,$1F,$18,$22,$24,$81
  88877. dc.b $3C,$33,$73,$30,$70,$94,$96,$9F,$9F,$12,$14,$00
  88878. dc.b $0F,$04,$04,$0A,$0D,$2F,$4F,$0F,$2F,$33,$1A,$80,$80
  88879. dc.b $3A,$01,$01,$07,$01,$8E,$8D,$8E,$53,$0E,$0E,$0E
  88880. dc.b $03,$00,$00,$00,$07,$1F,$1F,$FF,$0F,$1C,$27,$28,$80
  88881. dc.b $1F,$66,$53,$31,$22,$1C,$1F,$98,$1F,$12,$0F,$0F
  88882. dc.b $0F,$00,$00,$00,$00,$FF,$0F,$0F,$0F,$8C,$8A,$8D,$8B
  88883.  
  88884. ;Mus_Emerald: BINCLUDE "sound/music/Got an emerald.bin"
  88885. Mus_Emerald: dc.w z80_ptr(MusEmrldVoices),$0703,$01D5
  88886. dc.w z80_ptr(MusEmeraldDAC),$0000
  88887. dc.w z80_ptr(MusEmeraldFM1),$F408
  88888. dc.w z80_ptr(MusEmeraldFM2),$F408
  88889. dc.w z80_ptr(MusEmeraldFM3),$F407
  88890. dc.w z80_ptr(MusEmeraldFM4),$F416
  88891. dc.w z80_ptr(MusEmeraldFM5),$F416
  88892. dc.w z80_ptr(MusEmeraldFM6),$F416
  88893. dc.w z80_ptr(MusEmeraldPSG1),$F402,$0004
  88894. dc.w z80_ptr(MusEmeraldPSG2),$F402,$0005
  88895. dc.w z80_ptr(MusEmeraldPSG3),$F400,$0004
  88896. MusEmeraldFM3: dc.b $E1,$02
  88897. MusEmeraldFM1: dc.b $EF,$00,$C1,$06,$C4,$C9,$CD,$0C,$C9,$D0,$2A,$F2
  88898. MusEmeraldFM2: dc.b $EF,$00,$BD,$06,$C1,$C4,$C9,$0C,$C6,$CB,$2A,$F2
  88899. MusEmeraldFM4: dc.b $EF,$01,$C1,$0C,$C1,$06,$C4,$06,$80,$C4,$80,$C9
  88900. dc.b $2A,$F2
  88901. MusEmeraldFM5: dc.b $EF,$01,$C9,$0C,$C9,$06,$CD,$06,$80,$CD,$80,$D0
  88902. dc.b $2A,$F2
  88903. MusEmeraldFM6: dc.b $EF,$01,$C4,$0C,$C4,$06,$C9,$06,$80,$C9,$80,$CD
  88904. dc.b $2A,$F2
  88905. MusEmeraldPSG2: dc.b $80,$2D
  88906. - dc.b $C4,$06,$C2,$C1,$BF,$EC,$03
  88907. dc.b $F7,$00,$04
  88908. dc.w z80_ptr(-)
  88909. dc.b $F2
  88910. MusEmeraldPSG1: dc.b $E2,$01,$80,$02,$80,$2D
  88911. - dc.b $C4,$06,$C2,$C1,$BF,$EC,$03
  88912. dc.b $F7,$00,$04
  88913. dc.w z80_ptr(-)
  88914. MusEmeraldPSG3:
  88915. MusEmeraldDAC: dc.b $E2,$01,$F2
  88916. MusEmrldVoices: dc.b $04,$35,$54,$72,$46,$1F,$1F,$1F,$1F,$07,$07,$0A
  88917. dc.b $0D,$00,$00,$0B,$0B,$1F,$1F,$0F,$0F,$23,$1D,$14,$80
  88918. dc.b $3C,$31,$50,$52,$30,$52,$52,$53,$53,$08,$08,$00
  88919. dc.b $00,$04,$04,$00,$00,$10,$10,$07,$07,$1A,$16,$80,$80
  88920.  
  88921. ;Mus_Credits: BINCLUDE "sound/music/Credits.bin"
  88922. Mus_Credits: dc.w z80_ptr(MusCred_Voices),$0603,$01F0
  88923. dc.w z80_ptr(MusCred_DAC),$0000
  88924. dc.w z80_ptr(MusCred_FM1),$000E
  88925. dc.w z80_ptr(MusCred_FM2),$180A
  88926. dc.w z80_ptr(MusCred_FM3),$0014
  88927. dc.w z80_ptr(MusCred_FM4),$0016
  88928. dc.w z80_ptr(MusCred_FM5),$0C16
  88929. dc.w z80_ptr(MusCred_PSG1),$E806,$000B
  88930. dc.w z80_ptr(MusCred_PSG2),$DC07,$000B
  88931. dc.w z80_ptr(MusCred_PSG3),$0002,$0003
  88932. MusCred_FM1: dc.b $E9,$F4,$E6,$FE,$F8
  88933. dc.w z80_ptr(MusCreditsDB06)
  88934. dc.b $E9,$0C,$E6,$02
  88935. - dc.b $80,$30
  88936. dc.b $F7,$00,$08
  88937. dc.w z80_ptr(-)
  88938. dc.b $EF,$03,$F8
  88939. dc.w z80_ptr(MusCreditsD9D1)
  88940. dc.b $AE,$06,$A2,$F8
  88941. dc.w z80_ptr(MusCreditsD9D1)
  88942. dc.b $E6,$FD
  88943. - dc.b $EF,$00,$B7,$06,$BA,$F8
  88944. dc.w z80_ptr(MusCreditsDA13)
  88945. dc.b $F7,$00,$02
  88946. dc.w z80_ptr(-)
  88947. dc.b $80,$06,$80,$80,$30,$80,$EF,$0B,$E9,$18,$E6,$02
  88948. - dc.b $94,$0C,$8F,$92,$8F,$06,$94,$05,$94,$07,$06,$8F
  88949. dc.b $0C,$92,$8F
  88950. dc.b $F7,$00,$05
  88951. dc.w z80_ptr(-)
  88952. dc.b $80,$30,$80,$EF,$0E,$E6,$FF,$E9,$E8,$F8
  88953. dc.w z80_ptr(MusCreditsDAE5)
  88954. dc.b $80,$12,$91,$94,$06,$80,$18,$96,$12,$9A,$06,$80
  88955. dc.b $80,$12,$8F,$93,$08,$80,$16,$96,$06,$91,$92,$94
  88956. dc.b $96,$F8
  88957. dc.w z80_ptr(MusCreditsDAE5)
  88958. dc.b $80,$12,$9D,$9A,$08,$80,$16,$96,$12,$9D,$08,$80
  88959. dc.b $04,$EF,$12
  88960. dc.b $F0,$18,$01,$0A,$04
  88961. dc.b $80,$30,$80,$F8
  88962. dc.w z80_ptr(MusCreditsDA5F)
  88963. dc.b $E7,$24,$E7,$C5,$01,$E7,$C4,$E7,$C3,$E7,$C2,$E7
  88964. dc.b $C1,$E7,$C0,$E7,$BF,$E7,$BE,$E7,$BD,$E7,$BC,$E7
  88965. dc.b $BB,$E7,$BA,$80,$60,$EF,$01,$E9,$F4,$E6,$FA,$F4
  88966. dc.b $F8
  88967. dc.w z80_ptr(MusCreditsDA99)
  88968. dc.b $B1,$03,$F8
  88969. dc.w z80_ptr(MusCreditsDA99)
  88970. dc.b $80,$03,$80,$60,$E6,$04,$E1,$01,$EF,$1B,$E6,$06
  88971. dc.b $C1,$0C,$E8,$06,$BD,$06,$BA,$BD,$0C,$80,$80,$EF
  88972. dc.b $1C,$E6,$FA,$E8,$00,$BC,$0C,$12,$06,$EF,$1B,$E6
  88973. dc.b $06,$E8,$06,$C2,$06,$C2,$80,$C2,$80,$C2,$E8,$00
  88974. dc.b $C3,$0C,$C4,$80,$E8,$06,$C4,$06,$06,$C6,$C4,$E8
  88975. dc.b $00,$C1,$0C,$E8,$06,$BD,$06,$BA,$BD,$0C,$80,$80
  88976. dc.b $E8,$00,$EF,$1C,$E6,$FA,$C1,$C4,$C1,$EF,$1A,$E6
  88977. dc.b $06,$E8,$06,$C2,$06,$C2,$80,$C2,$80,$C2,$E8,$00
  88978. dc.b $C3,$0C,$C4,$06,$80,$80,$24,$80,$30,$80,$EF,$1F
  88979. dc.b $E9,$18,$E6,$F7,$E1,$00,$80,$06,$AC,$AE,$80,$B1
  88980. dc.b $80,$B3,$80,$B4,$80,$B3,$80,$B1,$B3,$80,$B1,$E9
  88981. dc.b $F4,$EF,$00,$80,$0C,$AC,$06,$AE,$B1,$80,$12,$AC
  88982. dc.b $06,$AE,$B1,$80,$B4,$B1,$80,$B1,$E9,$0C,$EF,$1F
  88983. dc.b $80,$06,$B8,$12,$B4,$06,$80,$B3,$80,$B4,$80,$B3
  88984. dc.b $80,$B1,$AE,$80,$B1,$E9,$F4,$EF,$00,$80,$06,$AF
  88985. dc.b $12,$AE,$06,$80,$12,$AF,$06,$80,$AE,$80,$AF,$B1
  88986. dc.b $80,$B1,$80,$30,$80,$EF,$21,$E9,$0C,$80,$30,$80
  88987. dc.b $08,$A0,$04,$9E,$0C,$9D,$9B,$99,$08,$04,$91,$0C
  88988. dc.b $92,$93,$94,$98,$99,$9B,$9D,$98,$95,$93,$91,$98
  88989. dc.b $9D,$91,$96,$98,$99,$98,$96,$99,$9D,$96,$95,$97
  88990. dc.b $99,$97,$95,$96,$97,$98,$99,$98,$99,$9B,$9D,$08
  88991. dc.b $04,$98,$0C,$91,$95,$96,$98,$99,$9D,$9E,$08,$96
  88992. dc.b $10,$97,$0C,$98,$F8
  88993. dc.w z80_ptr(MusCreditsDAFE)
  88994. dc.b $9E,$E6,$04,$F8
  88995. dc.w z80_ptr(MusCreditsDAFE)
  88996. dc.b $9E,$E6,$FC,$F8
  88997. dc.w z80_ptr(MusCreditsDAFE)
  88998. dc.b $9E,$08,$99,$04,$EF,$23,$E9,$E8,$E6,$07,$80,$60
  88999. dc.b $F8
  89000. dc.w z80_ptr(MusCreditsDABE)
  89001. dc.b $80,$60,$E6,$FB,$80,$0C,$CD,$06,$80,$D4,$CD,$06
  89002. dc.b $80,$0C,$CD,$06,$80,$D4,$CD,$06,$80,$18,$E6,$05
  89003. dc.b $80,$0C,$AE,$80,$AE,$80,$24,$E1,$02,$E6,$08,$A2
  89004. dc.b $6C,$F2
  89005. MusCreditsD9D1: dc.b $A5,$0C,$B1,$06,$80,$B1,$0C,$AC,$B3,$12,$B1,$0C
  89006. dc.b $AC,$06,$AE,$B1,$A7,$0C,$B3,$06,$80,$B3,$0C,$AE
  89007. dc.b $B5,$12,$B3,$06,$80,$AE,$B0,$B3,$A3,$0C,$AF,$06
  89008. dc.b $80,$AF,$0C,$AA,$B1,$12,$AF,$0C,$AA,$06,$AC,$AF
  89009. dc.b $A2,$0C,$AE,$06,$A2,$A4,$0C,$B0,$06,$A4,$A5,$0C
  89010. dc.b $B1,$06,$A5,$A2,$0C,$E3
  89011. MusCreditsDA13: dc.b $BE,$0C,$BC,$06,$BA,$BC,$BA,$04,$E7,$08,$BA,$04
  89012. dc.b $80,$0E,$EF,$07,$B7,$06,$B2,$B5,$B7,$EF,$00,$B7
  89013. dc.b $BA,$BE,$0C,$BC,$06,$BA,$BC,$BA,$0C,$BC,$04,$80
  89014. dc.b $08,$BA,$04,$80,$08,$BC,$04,$80,$08,$BE,$12,$BA
  89015. dc.b $06,$B7,$80,$B7,$80,$24,$EF,$07,$B7,$06,$B2,$B5
  89016. dc.b $B7,$80,$0C,$80,$30,$BE,$06,$BE,$BA,$04,$80,$08
  89017. dc.b $BC,$06,$BE,$E3
  89018. MusCreditsDA5F: dc.b $C3,$01,$E7,$C4,$E7,$C5,$E7,$C6,$2D,$E9,$02,$C3
  89019. dc.b $01,$E7,$C4,$E7,$C5,$E7,$C6,$2D,$E9,$01,$C3,$01
  89020. dc.b $E7,$C4,$E7,$C5,$E7,$C6,$2D,$E9,$FC,$C3,$01,$E7
  89021. dc.b $C4,$E7,$C5,$E7,$C6,$2D,$E9,$01,$C3,$01,$E7,$C4
  89022. dc.b $E7,$C5,$E7,$C6,$2D,$E7,$30,$E7,$30,$E3
  89023. MusCreditsDA99: dc.b $A7,$0C,$B3,$06,$80,$B1,$80,$B3,$0C,$A7,$03,$80
  89024. dc.b $06,$A7,$03,$B3,$0C,$B1,$B3,$09,$AE,$03,$AC,$06
  89025. dc.b $80,$AC,$0C,$AE,$06,$80,$AE,$0C,$AF,$06,$80,$27
  89026. dc.b $E3
  89027. MusCreditsDABE: dc.b $80,$0C,$CA,$15,$80,$03,$CA,$06,$80,$CB,$0F,$80
  89028. dc.b $03,$C8,$18,$80,$06,$CA,$80,$CA,$80,$CA,$80,$C6
  89029. dc.b $80,$C4,$0F,$80,$03,$C8,$18,$80,$06
  89030. dc.b $F7,$00,$02
  89031. dc.w z80_ptr(MusCreditsDABE)
  89032. dc.b $E3
  89033. MusCreditsDAE5: dc.b $80,$12,$94,$97,$06,$80,$18,$99,$12,$94,$06,$80
  89034. dc.b $80,$12,$92,$96,$06,$80,$18,$97,$12,$92,$06,$80
  89035. dc.b $E3
  89036. MusCreditsDAFE: dc.b $80,$99,$80,$99,$80,$9E,$80,$E3
  89037. MusCreditsDB06: dc.b $EF,$07,$80,$54,$C7,$04,$C8,$C9,$CA,$24,$CD,$D2
  89038. dc.b $18,$D0,$24,$CF,$CB,$18,$CB,$0C,$CA,$80,$CD,$60
  89039. dc.b $E7,$3C,$CA,$24,$CD,$D2,$18,$D4,$24,$D0,$D4,$18
  89040. dc.b $D4,$24,$D6,$60,$E7,$3C,$E3
  89041. MusCred_FM2: dc.b $80,$60,$EF,$01,$E8,$06,$F8
  89042. dc.w z80_ptr(MusCreditsDE2A)
  89043. dc.b $F8
  89044. dc.w z80_ptr(MusCreditsDE2A)
  89045. - dc.b $85,$0C
  89046. dc.b $F7,$00,$0C
  89047. dc.w z80_ptr(-)
  89048. dc.b $8A,$87,$88,$89,$F8
  89049. dc.w z80_ptr(MusCreditsDE2A)
  89050. - dc.b $88
  89051. dc.b $F7,$00,$0B
  89052. dc.w z80_ptr(-)
  89053. - dc.b $8A
  89054. dc.b $F7,$00,$0A
  89055. dc.w z80_ptr(-)
  89056. dc.b $E8,$00,$E6,$FC,$8A,$8B,$8C,$E6,$04,$E8,$09
  89057. - dc.b $8D,$0C
  89058. dc.b $F7,$00,$0C
  89059. dc.w z80_ptr(-)
  89060. dc.b $E8,$00,$8D,$8A,$8B,$8C,$E8,$09
  89061. - dc.b $8D,$0C
  89062. dc.b $F7,$00,$0C
  89063. dc.w z80_ptr(-)
  89064. dc.b $8D,$06,$99,$E8,$00,$8A,$0C,$8B,$8C,$E9,$E8,$E6
  89065. dc.b $0C,$EF,$04
  89066. - dc.b $F8
  89067. dc.w z80_ptr(MusCreditsDD59)
  89068. dc.b $F7,$00,$02
  89069. dc.w z80_ptr(-)
  89070. dc.b $E6,$F9,$EF,$08
  89071. MusCreditsDB93: dc.b $F8
  89072. dc.w z80_ptr(MusCreditsDD8D)
  89073. - dc.b $9F,$04,$80,$08,$9F,$0C
  89074. dc.b $F7,$00,$02
  89075. dc.w z80_ptr(-)
  89076. dc.b $06,$9C,$12,$9D,$0C,$9E,$F8
  89077. dc.w z80_ptr(MusCreditsDD8D)
  89078. - dc.b $9D,$04,$80,$08,$9D,$0C
  89079. dc.b $F7,$00,$02
  89080. dc.w z80_ptr(-)
  89081. - dc.b $9C,$04,$80,$08,$9C,$0C
  89082. dc.b $F7,$00,$02
  89083. dc.w z80_ptr(-)
  89084. dc.b $F7,$01,$02
  89085. dc.w z80_ptr(MusCreditsDB93)
  89086. dc.b $80,$60,$80,$48,$EF,$0C,$E6,$13,$F8
  89087. dc.w z80_ptr(MusCreditsDD9D)
  89088. dc.b $24,$80,$60,$EF,$0F,$E6,$F3
  89089. dc.b $F0,$04,$02,$03,$02
  89090. dc.b $F8
  89091. dc.w z80_ptr(MusCreditsDDB5)
  89092. dc.b $C4,$18,$C3,$30,$E7,$18,$80,$0C,$F8
  89093. dc.w z80_ptr(MusCreditsDDB5)
  89094. dc.b $BE,$EF,$13,$E6,$F5,$F4,$80,$60
  89095. - dc.b $F8
  89096. dc.w z80_ptr(MusCreditsDDEA)
  89097. dc.b $A8,$0C,$A9,$08,$A1,$10,$F8
  89098. dc.w z80_ptr(MusCreditsDDEA)
  89099. dc.b $A8,$08,$A9,$04,$80,$18
  89100. dc.b $F7,$00,$02
  89101. dc.w z80_ptr(-)
  89102. dc.b $80,$60,$EF,$17,$E1,$02,$E9,$F4,$E6,$0A,$F8
  89103. dc.w z80_ptr(MusCreditsDDD5)
  89104. dc.b $CE,$15,$CD,$03,$CB,$06,$80,$C9,$0C,$CD,$06,$80
  89105. dc.b $C9,$0C,$CB,$06,$80,$12,$80,$60,$EF,$1B,$E1,$00
  89106. dc.b $E8,$06,$80,$3C,$B8,$06,$06,$BA,$BD,$BD,$BA,$EF
  89107. dc.b $1D,$E6,$FA,$E8,$00,$F8
  89108. dc.w z80_ptr(MusCreditsDDF9)
  89109. dc.b $80,$F8
  89110. dc.w z80_ptr(MusCreditsDE09)
  89111. dc.b $F8
  89112. dc.w z80_ptr(MusCreditsDDF9)
  89113. dc.b $EF,$1C,$BD,$EF,$1D,$F8
  89114. dc.w z80_ptr(MusCreditsDE09)
  89115. dc.b $80,$30,$80,$EF,$01,$E9,$18,$E6,$F9
  89116. - dc.b $99,$0C,$A5,$06,$80,$96,$0C,$A2,$06,$80,$97,$0C
  89117. dc.b $A3,$06,$80,$98,$0C,$A8,$06,$A7,$99,$06,$99,$12
  89118. dc.b $96,$0C,$A2,$06,$80,$97,$0C,$A3,$06,$80,$98,$0C
  89119. dc.b $A4,$06,$80
  89120. dc.b $F7,$00,$02
  89121. dc.w z80_ptr(-)
  89122. dc.b $80,$60,$EF,$22,$E9,$E8,$E6,$03
  89123. dc.b $F0,$1C,$01,$06,$04
  89124. dc.b $80,$50,$AC,$04,$AE,$08,$B1,$04,$B5,$30,$80,$0C
  89125. dc.b $B5,$08,$80,$04,$B6,$08,$B5,$10,$B9,$08,$04,$80
  89126. dc.b $08,$B5,$34,$80,$0C,$B5,$BA,$08,$04,$80,$08,$B5
  89127. dc.b $04,$B1,$24,$80,$0C,$B1,$08,$80,$04,$B3,$08,$B1
  89128. dc.b $04,$B4,$0C,$B3,$08,$B1,$4C,$80,$0C,$B5,$08,$80
  89129. dc.b $04,$B6,$08,$80,$04,$B5,$08,$80,$04,$B9,$08,$04
  89130. dc.b $80,$08,$B5,$1C,$80,$0C,$BA,$18,$BC,$08,$BA,$04
  89131. dc.b $BD,$18,$80,$0C,$BA,$04,$80,$08,$B8,$18,$B5,$B1
  89132. dc.b $B3,$0C,$E6,$04,$F8
  89133. dc.w z80_ptr(MusCreditsDE17)
  89134. dc.b $B3,$0C,$E6,$FC,$F8
  89135. dc.w z80_ptr(MusCreditsDE17)
  89136. dc.b $B3,$14,$B1,$04,$E6,$FF,$EF,$24,$F4,$80,$60
  89137. - dc.b $F8
  89138. dc.w z80_ptr(MusCreditsDE20)
  89139. dc.b $AC,$12,$AB,$0C,$AC,$06,$AB,$0C,$F8
  89140. dc.w z80_ptr(MusCreditsDE20)
  89141. dc.b $B3,$12,$B2,$0C,$B3,$06,$B2,$0C
  89142. dc.b $F7,$00,$02
  89143. dc.w z80_ptr(-)
  89144. dc.b $AC,$06,$80,$A9,$80,$AA,$80,$AB,$80,$AC,$AC,$A9
  89145. dc.b $80,$AA,$80,$AC,$80,$A9,$80,$A9,$80,$AD,$80,$AD
  89146. dc.b $80,$B0,$80,$B0,$80,$B3,$80,$B3,$80,$80,$0C,$A2
  89147. dc.b $12,$80,$06,$A2,$12,$AD,$AE,$06,$80,$E6,$FD,$A2
  89148. dc.b $6C,$F2
  89149. MusCreditsDD59: dc.b $80,$0C,$C4,$06,$80,$C6,$80,$C4,$80,$C9,$80,$C9
  89150. dc.b $80,$CB,$CD,$80,$0C,$80,$CB,$18,$C6,$06,$80,$C9
  89151. dc.b $C9,$80,$CB,$0C,$80,$12,$80,$1E,$C7,$06,$C9,$C7
  89152. dc.b $CB,$80,$C9,$80,$C7,$C9,$80,$C6,$E7,$C6,$30,$E7
  89153. dc.b $18,$80,$18,$E3
  89154. MusCreditsDD8D: dc.b $9F,$04,$80,$08,$9F,$0C
  89155. dc.b $F7,$00,$03
  89156. dc.w z80_ptr(MusCreditsDD8D)
  89157. dc.b $06,$AB,$9F,$0C,$E3
  89158. MusCreditsDD9D: dc.b $B8,$08,$BA,$BC,$B6,$30,$E7,$30,$E7,$B6,$80,$18
  89159. dc.b $B8,$08,$BA,$BC,$B6,$30,$E7,$30,$E7,$30,$E7,$E3
  89160. MusCreditsDDB5: dc.b $BF,$06,$BD,$BF,$12,$C2,$BF,$0C,$C1,$80,$06,$12
  89161. dc.b $C4,$0C,$C2,$06,$80,$C9,$C6,$3C,$80,$06,$0C,$C7
  89162. dc.b $12,$C6,$C4,$06,$C2,$C1,$18,$E3
  89163. MusCreditsDDD5: dc.b $CE,$15,$CD,$03,$CB,$06,$80,$C9,$0C,$CD,$06,$80
  89164. dc.b $C9,$0C,$CB,$06,$80,$12,$80,$60,$E3
  89165. MusCreditsDDEA: dc.b $A2,$0C,$AE,$AC,$08,$AE,$04,$AC,$08,$A9,$04,$A7
  89166. dc.b $08,$04,$E3
  89167. MusCreditsDDF9: dc.b $80,$0C,$B1,$AE,$06,$06,$AC,$0C,$80,$B0,$AE,$06
  89168. dc.b $06,$AC,$0C,$E3
  89169. MusCreditsDE09: dc.b $AE,$AC,$06,$06,$AA,$0C,$80,$AC,$0C,$06,$06,$AE
  89170. dc.b $AC,$E3
  89171. MusCreditsDE17: dc.b $BA,$04,$80,$08,$B8,$18,$B5,$B1,$E3
  89172. MusCreditsDE20: dc.b $AE,$06,$80,$AE,$80,$A9,$80,$A9,$80,$E3
  89173. MusCreditsDE2A: dc.b $8A,$0C
  89174. dc.b $F7,$00,$08
  89175. dc.w z80_ptr(MusCreditsDE2A)
  89176. dc.b $E3
  89177. MusCred_FM3: dc.b $80,$60,$F8
  89178. dc.w z80_ptr(MusCreditsE065)
  89179. dc.b $E9,$18,$EF,$02,$F8
  89180. dc.w z80_ptr(MusCreditsE040)
  89181. dc.b $B8,$3C,$F8
  89182. dc.w z80_ptr(MusCreditsE040)
  89183. dc.b $BD,$3C,$E9,$E8,$E6,$02,$E1,$03,$EF,$04,$E0,$80
  89184. - dc.b $F8
  89185. dc.w z80_ptr(MusCreditsDD59)
  89186. dc.b $F7,$00,$02
  89187. dc.w z80_ptr(-)
  89188. dc.b $EF,$09,$E9,$0C,$E6,$FD,$E0,$40
  89189. dc.b $F0,$06,$01,$05,$04
  89190. dc.b $E1,$00
  89191. - dc.b $9F,$0C,$AB,$06,$80,$A9,$80,$AB,$9F,$80,$9F,$AB
  89192. dc.b $80,$A9,$80,$AB,$0C
  89193. dc.b $F7,$00,$03
  89194. dc.w z80_ptr(-)
  89195. dc.b $9D,$0C,$A9,$06,$80,$A8,$80,$A9,$9C,$80,$9C,$A8
  89196. dc.b $80,$A6,$80,$A8,$0C
  89197. dc.b $F7,$01,$02
  89198. dc.w z80_ptr(-)
  89199. dc.b $80,$60,$EF,$0D,$E6,$FB,$E0,$C0,$F4,$80,$60
  89200. - dc.b $F8
  89201. dc.w z80_ptr(MusCreditsDFF2)
  89202. dc.b $F7,$00,$02
  89203. dc.w z80_ptr(-)
  89204. dc.b $80,$60,$EF,$0F,$E0,$80,$E6,$0B,$F8
  89205. dc.w z80_ptr(MusCreditsDDB5)
  89206. dc.b $C4,$18,$C3,$48,$80,$0C,$F8
  89207. dc.w z80_ptr(MusCreditsDDB5)
  89208. dc.b $BE,$0C
  89209. dc.b $F0,$18,$01,$03,$04
  89210. dc.b $E6,$F3,$E0,$C0,$EF,$14,$A2,$14,$A4,$04,$A5,$04
  89211. dc.b $80,$08,$A9,$04,$80,$08,$A8,$04,$80,$08,$A9,$04
  89212. dc.b $80,$08,$AC,$08,$A9,$10
  89213. - dc.b $80,$30
  89214. dc.b $F7,$00,$0A
  89215. dc.w z80_ptr(-)
  89216. dc.b $EF,$18,$E9,$F4,$E6,$08,$F4,$E0,$40,$80,$60,$80
  89217. dc.b $30,$C6,$06,$80,$C2,$0C,$C4,$09,$C2,$03,$BF,$0C
  89218. dc.b $80,$60,$80,$3C,$80,$60,$EF,$1B,$E6,$FB,$E0,$C0
  89219. dc.b $E8,$06,$C4,$06,$06,$C6,$C9,$C9,$C6,$E8,$00,$CD
  89220. dc.b $0C,$E8,$06,$C9,$06,$C6,$C9,$0C,$80,$80,$12,$EF
  89221. dc.b $1C,$E8,$00,$BD,$BA,$0C,$E8,$06,$EF,$1B,$CE,$06
  89222. dc.b $CE,$80,$CE,$80,$CE,$E8,$00,$CF,$0C,$D0,$80,$E8
  89223. dc.b $06,$D0,$06,$06,$D2,$D0,$E8,$00,$CD,$0C,$E8,$06
  89224. dc.b $C9,$06,$C6,$C9,$0C,$E8,$00,$EF,$1C,$80,$1E,$C2
  89225. dc.b $0C,$C2,$BD,$06,$80,$60,$80,$60,$EF,$00,$E9,$18
  89226. dc.b $80,$60,$80,$0C,$AC,$06,$AE,$B1,$80,$12,$AC,$06
  89227. dc.b $AE,$B1,$80,$B4,$B1,$80,$B1,$80,$60,$80,$06,$AF
  89228. dc.b $12,$AE,$06,$80,$12,$AF,$06,$80,$AE,$80,$AF,$B1
  89229. dc.b $80,$B1,$80,$60,$EF,$22,$E9,$DC,$E6,$FF,$E0,$80
  89230. dc.b $80,$60,$F8
  89231. dc.w z80_ptr(MusCreditsE004)
  89232. dc.b $CD,$30,$CB,$18,$CD,$0C,$CB,$C9,$30,$CE,$F8
  89233. dc.w z80_ptr(MusCreditsE051)
  89234. dc.b $E6,$04,$F8
  89235. dc.w z80_ptr(MusCreditsE051)
  89236. dc.b $E6,$FC,$80,$C4,$80,$C4,$80,$C6,$18,$08,$C4,$04
  89237. dc.b $E9,$0C,$E6,$FF,$E0,$C0,$EF,$00,$80,$60
  89238. - dc.b $F8
  89239. dc.w z80_ptr(MusCreditsE05B)
  89240. dc.b $CB,$12,$CB,$1E,$F8
  89241. dc.w z80_ptr(MusCreditsE05B)
  89242. dc.b $D0,$12,$D0,$1E
  89243. dc.b $F7,$00,$02
  89244. dc.w z80_ptr(-)
  89245. dc.b $80,$0C,$CB,$12,$80,$06,$CB,$80,$CA,$12,$CB,$CA
  89246. dc.b $0C,$C5,$18,$C8,$CB,$D1,$80,$0C,$CD,$80,$CD,$12
  89247. dc.b $CC,$CD,$06,$80,$E6,$F8,$EF,$01,$E1,$03,$A2,$6C
  89248. dc.b $F2
  89249. MusCreditsDFF2: dc.b $80,$60,$BC,$06,$BD,$BC,$B8,$BA,$B6,$0C,$B8,$B3
  89250. dc.b $B3,$06,$B6,$0C,$B8,$E3
  89251. MusCreditsE004: dc.b $80,$0C,$CD,$04,$80,$10,$CD,$04,$80,$0C,$CD,$0C
  89252. dc.b $CE,$08,$CD,$04,$80,$18,$80,$0C,$CB,$04,$80,$10
  89253. dc.b $CB,$04,$80,$0C,$CB,$0C,$CD,$08,$CB,$04,$80,$18
  89254. - dc.b $80,$0C,$C9,$04,$80,$10,$C9,$04,$80,$0C,$C9,$0C
  89255. dc.b $CB,$08,$C9,$04,$80,$18
  89256. dc.b $F7,$00,$02
  89257. dc.w z80_ptr(-)
  89258. dc.b $E3
  89259. MusCreditsE040: dc.b $80,$18,$B8,$0B,$80,$0D,$BA,$0C,$0B,$80,$19,$BD
  89260. dc.b $0C,$0B,$80,$0D,$E3
  89261. MusCreditsE051: dc.b $80,$0C,$C4,$80,$C4,$80,$C6,$80,$C6,$E3
  89262. MusCreditsE05B: dc.b $CD,$06,$80,$CD,$80,$CA,$80,$CA,$80,$E3
  89263. MusCreditsE065: dc.b $EF,$05,$E9,$F4,$C6,$60,$CB,$CD,$E7,$CD,$C6,$60
  89264. dc.b $D0,$D0,$24,$D2,$60,$E7,$3C,$E3
  89265. MusCred_FM4: dc.b $80,$60,$E9,$FB,$E6,$FE,$F8
  89266. dc.w z80_ptr(MusCreditsE065)
  89267. dc.b $E9,$1D,$E6,$02,$EF,$02,$F8
  89268. dc.w z80_ptr(MusCreditsE2AE)
  89269. dc.b $B5,$3C,$F8
  89270. dc.w z80_ptr(MusCreditsE2AE)
  89271. dc.b $B8,$3C,$E6,$06,$EF,$05
  89272. dc.b $F0,$02,$01,$FE,$04
  89273. - dc.b $C1,$30,$E7,$30,$C3,$E7,$30,$BF,$E7,$30,$BD,$E7
  89274. dc.b $30
  89275. dc.b $F7,$00,$02
  89276. dc.w z80_ptr(-)
  89277. dc.b $EF,$0A,$E9,$F4,$E6,$F7
  89278. dc.b $F0,$0C,$01,$FB,$04
  89279. - dc.b $F8
  89280. dc.w z80_ptr(MusCreditsE2BF)
  89281. dc.b $80,$25,$C3,$06,$C3,$80,$0C,$C3,$06,$C3,$05,$80
  89282. dc.b $0D,$C3,$06,$C5,$30,$E7,$06,$F8
  89283. dc.w z80_ptr(MusCreditsE2BF)
  89284. dc.b $80,$31,$80,$60
  89285. dc.b $F7,$00,$02
  89286. dc.w z80_ptr(-)
  89287. dc.b $80,$60,$80,$48,$EF,$0C,$E6,$05,$F4,$E1,$02,$E0
  89288. dc.b $80,$F8
  89289. dc.w z80_ptr(MusCreditsDD9D)
  89290. dc.b $24,$80,$0C,$80,$60,$EF,$10,$E6,$F7,$E1,$00,$E0
  89291. dc.b $40,$F8
  89292. dc.w z80_ptr(MusCreditsE2D2)
  89293. dc.b $B3,$B7,$06,$AE,$0C,$B1,$B3,$B7,$06,$80,$B7,$AE
  89294. dc.b $0C,$B1,$F8
  89295. dc.w z80_ptr(MusCreditsE2D2)
  89296. dc.b $EF,$15,$E6,$01,$F8
  89297. dc.w z80_ptr(MusCreditsE22D)
  89298. - dc.b $EF,$14,$80,$4E,$E0,$40,$A1,$12,$A2,$06,$E0,$C0
  89299. dc.b $EF,$16,$80,$30,$80,$06,$BA,$08,$B9,$04,$B8,$08
  89300. dc.b $B7,$04,$B6,$08,$B5,$04
  89301. dc.b $F7,$00,$02
  89302. dc.w z80_ptr(-)
  89303. dc.b $80,$60,$EF,$17,$E9,$F4,$E6,$02,$E0,$C0
  89304. dc.b $F0,$01,$01,$03,$03
  89305. - dc.b $F8
  89306. dc.w z80_ptr(MusCreditsDDD5)
  89307. dc.b $F7,$00,$02
  89308. dc.w z80_ptr(-)
  89309. dc.b $80,$60,$EF,$1E,$E0,$40,$E6,$FE,$E9,$F4,$F4,$E8
  89310. dc.b $06,$80,$0C,$C1,$06,$12,$18,$C4,$06,$12,$0C,$EF
  89311. dc.b $1C,$E0,$C0,$E6,$FA,$E8,$00,$C6,$E8,$06,$E6,$06
  89312. dc.b $EF,$1E,$E0,$40,$C2,$06,$12,$18,$C4,$06,$12,$18
  89313. dc.b $C1,$06,$12,$18,$C4,$06,$12,$0C,$EF,$1A,$E0,$C0
  89314. dc.b $E9,$0C,$C6,$06,$C6,$80,$C6,$80,$C6,$E8,$00,$C7
  89315. dc.b $0C,$C8,$06,$EF,$1E,$E0,$40,$E9,$F4,$E8,$06,$80
  89316. dc.b $C4,$06,$12,$0C,$80,$60,$EF,$20,$E9,$18,$E6,$FA
  89317. dc.b $E0,$C0,$E8,$00,$B4,$03,$E7,$B6,$5D,$B3,$03,$E7
  89318. dc.b $B5,$5D,$B1,$03,$E7,$B3,$5D,$B3,$03,$E7,$B5,$5D
  89319. dc.b $80,$60,$EF,$22,$E0,$40,$E9,$E8,$E6,$04,$80,$30
  89320. dc.b $80,$F8
  89321. dc.w z80_ptr(MusCreditsE246)
  89322. dc.b $C9,$30,$C8,$18,$C9,$0C,$C8,$C6,$30,$C9,$80,$0C
  89323. dc.b $C1,$80,$C1,$80,$C2,$80,$C2,$E6,$04,$80,$C1,$80
  89324. dc.b $C1,$80,$C2,$80,$C2,$E6,$FC,$80,$C1,$80,$C1,$80
  89325. dc.b $C2,$18,$08,$C1,$04,$E9,$0C,$E6,$FF,$E0,$C0,$EF
  89326. dc.b $00,$80,$60
  89327. - dc.b $F8
  89328. dc.w z80_ptr(MusCreditsE2C8)
  89329. dc.b $C8,$12,$C8,$1E,$F8
  89330. dc.w z80_ptr(MusCreditsE2C8)
  89331. dc.b $CB,$12,$CB,$1E
  89332. dc.b $F7,$00,$02
  89333. dc.w z80_ptr(-)
  89334. dc.b $E1,$03,$E6,$08,$F8
  89335. dc.w z80_ptr(MusCreditsE28F)
  89336. dc.b $E6,$F0,$EF,$01
  89337. dc.b $F0,$00,$01,$06,$04
  89338. dc.b $A2,$6C,$F2
  89339. MusCreditsE22D: dc.b $A2,$14,$A4,$04,$A5,$04,$80,$08,$A9,$04,$80,$08
  89340. dc.b $A8,$04,$80,$08,$A9,$04,$80,$08,$AC,$08,$A9,$10
  89341. dc.b $E3
  89342. MusCreditsE246: dc.b $80,$0C
  89343. dc.b $C9,$04,$80,$10
  89344. dc.b $C9,$04,$80,$0C
  89345. dc.b $C9,$0C
  89346. dc.b $CB,$08
  89347. dc.b $C9,$04,$80,$18,$80,$0C
  89348. dc.b $C8,$04,$80,$10
  89349. dc.b $C8,$04,$80,$0C
  89350. dc.b $C8,$0C
  89351. dc.b $C9,$08
  89352. dc.b $C8,$04,$80,$18,$80,$0C
  89353.  
  89354. if 1==1
  89355. ; this part of the original credits music (CNZ PSG) sounds buggy (dissonant)
  89356. dc.b $C6,$04,$80,$10
  89357. dc.b $C6,$04,$80,$0C
  89358. dc.b $C6,$0C
  89359. dc.b $C8,$08
  89360. dc.b $C6,$04,$80,$18,$80,$0C
  89361. dc.b $C5,$04,$80,$10
  89362. dc.b $C5,$04,$80,$0C
  89363. dc.b $C5,$0C
  89364. dc.b $C7,$08
  89365. else
  89366. ; replace the above block of notes with this to fix it.
  89367. ; (I'm not sure why, but the notes $C6 and $C7 are broken here,
  89368. ; so I've replaced them with pitch-shifted $C8s)
  89369. dc.b $E1,-64
  89370. dc.b $C8,$04,$80,$10 ; $C6
  89371. dc.b $C8,$04,$80,$0C ; $C6
  89372. dc.b $C8,$0C ; $C6
  89373. dc.b $E1,0
  89374. dc.b $C8,$08
  89375. dc.b $E1,-64
  89376. dc.b $C8,$04,$80,$24 ; $C6
  89377. dc.b $E1,0
  89378. dc.b $C5,$04,$80,$10
  89379. dc.b $C5,$04,$80,$0C
  89380. dc.b $C5,$0C
  89381. dc.b $E1,-32
  89382. dc.b $C8,$08 ; $C7
  89383. dc.b $E1,0
  89384. endif
  89385.  
  89386. dc.b $C5,$04,$80,$18
  89387. dc.b $E3
  89388. MusCreditsE28F: dc.b $EF,$25,$80,$0C,$D0,$D4,$D7,$DB,$0C,$80,$06,$DB
  89389. dc.b $0C,$DC,$06,$DB,$0C,$DD,$60,$DE,$0C,$80,$DE,$80
  89390. dc.b $80,$06,$DD,$12,$DE,$0C,$E3
  89391. MusCreditsE2AE: dc.b $80,$18,$B5,$0B,$80,$0D,$B7,$0C,$0B,$80,$19,$BA
  89392. dc.b $0C,$0B,$80,$0D,$E3
  89393. MusCreditsE2BF: dc.b $C3,$05,$80,$13,$C3,$12,$C3,$05,$E3
  89394. MusCreditsE2C8: dc.b $CA,$06,$80,$CA,$80,$C6,$80,$C6,$80,$E3
  89395. MusCreditsE2D2: dc.b $AF,$0C,$B3,$06,$B6,$0C,$AF,$B1,$06,$80,$B1,$0C
  89396. dc.b $B5,$06,$B8,$0C,$B1,$06,$80,$B6,$0C,$BA,$06,$B1
  89397. dc.b $0C,$B5,$B6,$BA,$06,$80,$BA,$AF,$0C,$B3,$B5,$B8
  89398. dc.b $06,$B2,$0C,$B3,$B5,$B8,$06,$80,$B8,$B2,$0C,$B5
  89399. dc.b $E3
  89400. MusCred_FM5: dc.b $E9,$E8,$E6,$F8,$E1,$05,$F8
  89401. dc.w z80_ptr(MusCreditsDB06)
  89402. dc.b $E9,$18,$E6,$08,$E1,$00,$EF,$02
  89403. dc.b $F0,$0C,$01,$FC,$04
  89404. dc.b $F8
  89405. dc.w z80_ptr(MusCreditsE4E8)
  89406. dc.b $B1,$3C,$F8
  89407. dc.w z80_ptr(MusCreditsE4E8)
  89408. dc.b $B5,$3C,$E9,$F4,$E6,$07
  89409. dc.b $F0,$30,$01,$04,$04
  89410. dc.b $EF,$06
  89411. - dc.b $C4,$30,$E7,$30,$C6,$E7,$30,$C2,$E7,$30,$C1,$E7
  89412. dc.b $30
  89413. dc.b $F7,$00,$02
  89414. dc.w z80_ptr(-)
  89415. dc.b $EF,$0A,$E6,$F6
  89416. dc.b $F0,$0C,$01,$05,$04
  89417. dc.b $E0,$80
  89418. - dc.b $F8
  89419. dc.w z80_ptr(MusCreditsE4F9)
  89420. dc.b $80,$25,$C6,$06,$C6,$80,$0C,$C6,$06,$C6,$05,$80
  89421. dc.b $0D,$C6,$06,$C8,$30,$E7,$06,$F8
  89422. dc.w z80_ptr(MusCreditsE4F9)
  89423. dc.b $80,$31,$80,$60
  89424. dc.b $F7,$00,$02
  89425. dc.w z80_ptr(-)
  89426. dc.b $80,$60,$80,$48,$E6,$05,$F4,$80,$01,$EF,$0C,$E1
  89427. dc.b $FE,$E0,$40,$F8
  89428. dc.w z80_ptr(MusCreditsDD9D)
  89429. dc.b $23,$80,$0C,$80,$60,$EF,$11,$E9,$F4,$E6,$F4,$E1
  89430. dc.b $00,$E0,$C0
  89431. dc.b $F0,$06,$01,$06,$05
  89432. dc.b $80,$60,$80,$30,$C2,$06,$C2,$C9,$C6,$1E,$80,$60
  89433. dc.b $80,$06,$CB,$80,$CB,$C9,$80,$C9,$80,$C7,$80,$C7
  89434. dc.b $80,$C6,$03,$80,$C6,$80,$09,$80,$06,$80,$60,$80
  89435. dc.b $30,$C2,$06,$C2,$C9,$C6,$1E,$80,$60,$EF,$16,$E9
  89436. dc.b $0C,$E6,$04,$F4,$E0,$80,$80,$01,$F8
  89437. dc.w z80_ptr(MusCreditsE22D)
  89438. dc.b $80,$2F,$F8
  89439. dc.w z80_ptr(MusCreditsE4CD)
  89440. dc.b $80,$30,$F8
  89441. dc.w z80_ptr(MusCreditsE4CD)
  89442. dc.b $80,$60,$EF,$19,$E9,$F4,$E0,$C0,$F8
  89443. dc.w z80_ptr(MusCreditsE502)
  89444. dc.b $80,$27,$B1,$03,$F8
  89445. dc.w z80_ptr(MusCreditsE502)
  89446. dc.b $80,$2A,$80,$60,$EF,$1E,$E9,$F4,$E8,$06
  89447. - dc.b $80,$0C,$C4,$06,$12,$18,$C8,$06,$12,$0C,$80,$C6
  89448. dc.b $06,$12,$18,$C8,$06,$12,$0C
  89449. dc.b $F7,$00,$02
  89450. dc.w z80_ptr(-)
  89451. dc.b $80,$60,$EF,$20,$E8,$00,$E9,$18,$E6,$FA,$B8,$03
  89452. dc.b $E7,$BA,$5D,$B6,$03,$E7,$B8,$5D,$B4,$03,$E7,$B6
  89453. dc.b $5D,$B6,$03,$E7,$B8,$5D,$80,$60,$EF,$22,$E9,$F4
  89454. dc.b $E6,$05
  89455. dc.b $F0,$1C,$01,$06,$04
  89456. dc.b $80,$50,$A7,$04,$A9,$08,$AC,$04,$B1,$30,$80,$0C
  89457. dc.b $B1,$08,$80,$04,$B3,$08,$B1,$10,$B5,$08,$B5,$04
  89458. dc.b $80,$08,$B0,$34,$80,$0C,$B0,$B5,$08,$04,$80,$08
  89459. dc.b $B1,$04,$AE,$24,$80,$0C,$AE,$08,$80,$04,$B0,$08
  89460. dc.b $AE,$04,$B1,$0C,$AF,$08,$AD,$4C,$80,$0C,$B1,$08
  89461. dc.b $80,$04,$B3,$08,$80,$04,$B1,$08,$80,$04,$B5,$08
  89462. dc.b $B5,$04,$80,$08,$B0,$1C,$80,$0C,$B5,$18,$B8,$08
  89463. dc.b $B5,$04,$BA,$18,$80,$0C,$B6,$04,$80,$08,$B5,$18
  89464. dc.b $B1,$AE,$B0,$0C,$E6,$04,$B6,$04,$80,$08,$B5,$18
  89465. dc.b $B1,$AE,$B0,$0C,$E6,$F8,$B6,$04,$80,$08,$B5,$18
  89466. dc.b $B1,$AE,$AA,$14,$A9,$04,$E6,$0C,$EF,$23,$E1,$03
  89467. dc.b $E6,$F7,$80,$60,$F8
  89468. dc.w z80_ptr(MusCreditsDABE)
  89469. dc.b $E6,$09
  89470. dc.b $F0,$00,$01,$06,$04
  89471. dc.b $F8
  89472. dc.w z80_ptr(MusCreditsE28F)
  89473. dc.b $F2
  89474. MusCreditsE4CD: dc.b $80,$1E,$EF,$14,$A4,$12,$A5,$06,$EF,$16,$80,$30
  89475. dc.b $80,$06,$BD,$08,$BC,$04,$BB,$08,$BA,$04,$B9,$08
  89476. dc.b $B8,$04,$E3
  89477. MusCreditsE4E8: dc.b $80,$18,$B1,$0B,$80,$0D,$B3,$0C,$0B,$80,$19,$B6
  89478. dc.b $0C,$0B,$80,$0D,$E3
  89479. MusCreditsE4F9: dc.b $C6,$05,$80,$13,$C6,$12,$C6,$05,$E3
  89480. MusCreditsE502: dc.b $80,$60,$AC,$06,$80,$AC,$0C,$AE,$06,$80,$AE,$0C
  89481. dc.b $AF,$06,$E3
  89482. MusCred_PSG1: dc.b $80,$30
  89483. dc.b $F7,$00,$1A
  89484. dc.w z80_ptr(MusCred_PSG1)
  89485. - dc.b $C4,$30,$E7,$30,$C6,$E7,$30,$C2,$E7,$30,$C1,$E7
  89486. dc.b $30
  89487. dc.b $F7,$00,$02
  89488. dc.w z80_ptr(-)
  89489. - dc.b $80,$30
  89490. dc.b $F7,$00,$10
  89491. dc.w z80_ptr(-)
  89492. dc.b $80,$60
  89493. - dc.b $80,$30
  89494. dc.b $F7,$00,$0A
  89495. dc.w z80_ptr(-)
  89496. dc.b $80,$60,$E9,$F4,$E6,$FE,$F5,$01,$F8
  89497. dc.w z80_ptr(MusCreditsE635)
  89498. dc.b $AE,$B3,$06,$AC,$0C,$AE,$AE,$B3,$06,$80,$B3,$AB
  89499. dc.b $0C,$AE,$F8
  89500. dc.w z80_ptr(MusCreditsE635)
  89501. dc.b $F5,$0B,$80,$04,$80,$60,$F8
  89502. dc.w z80_ptr(MusCreditsDA5F)
  89503. dc.b $E7,$20,$E7,$C5,$01,$E7,$C4,$E7,$C3,$E7,$C2,$E7
  89504. dc.b $C1,$E7,$C0,$E7,$BF,$E7,$BE,$E7,$BD,$E7,$BC,$E7
  89505. dc.b $BB,$E7,$BA,$80,$60,$F5,$00,$E8,$06,$E9,$F4,$F8
  89506. dc.w z80_ptr(MusCreditsE62C)
  89507. dc.b $C2,$80,$C2,$F8
  89508. dc.w z80_ptr(MusCreditsE62C)
  89509. dc.b $C2,$04,$80,$C2,$80,$0C,$C2,$80,$60,$F5,$08,$E9
  89510. dc.b $04,$EC,$02,$E8,$06
  89511. - dc.b $F8
  89512. dc.w z80_ptr(MusCreditsE618)
  89513. dc.b $F7,$00,$02
  89514. dc.w z80_ptr(-)
  89515. - dc.b $80,$30
  89516. dc.b $F7,$00,$0A
  89517. dc.w z80_ptr(-)
  89518. dc.b $80,$60,$F5,$00,$E9,$F0,$EC,$FF,$80,$60
  89519. dc.b $F8
  89520. dc.w z80_ptr(MusCreditsE004)
  89521. dc.b $E9,$18,$EC,$02,$B5,$30,$B3,$18,$B5,$0C,$B3,$B1
  89522. dc.b $30,$B6,$EC,$FE,$80,$0C,$B8,$80,$B8,$80,$BA,$80
  89523. dc.b $BA,$EC,$03,$C4,$18,$C1,$BD,$BF,$0C,$80,$EC,$FC
  89524. dc.b $80,$B8,$80,$B8,$80,$BA,$18,$08,$B8,$04,$E9,$F4
  89525. dc.b $EC,$01,$F5,$05
  89526. - dc.b $80,$60
  89527. dc.b $F7,$00,$05
  89528. dc.w z80_ptr(-)
  89529. dc.b $80,$0C,$C8,$12,$80,$06,$C8,$80,$C6,$12,$C8,$C6
  89530. dc.b $0C,$C1,$18,$C5,$C8,$CB,$80,$0C,$CA,$80,$CA,$12
  89531. dc.b $C9,$CA,$06,$80,$09,$E9,$30,$EC,$FC,$F6
  89532. dc.w z80_ptr(MusCreditsE770)
  89533. dc.b $F2
  89534. MusCreditsE618: dc.b $80,$0C,$BD,$06,$12,$18,$C4,$06,$12,$0C,$80,$C2
  89535. dc.b $06,$12,$18,$C4,$06,$12,$0C,$E3
  89536. MusCreditsE62C: dc.b $80,$60,$80,$0C,$C2,$80,$C2,$80,$E3
  89537. MusCreditsE635: dc.b $AC,$0C,$AF,$06,$B3,$0C,$AC,$AC,$06,$80,$AC,$0C
  89538. dc.b $AF,$06,$B5,$0C,$AC,$06,$80,$06,$B1,$0C,$B6,$06
  89539. dc.b $AE,$0C,$B1,$B3,$B6,$06,$80,$B6,$AA,$0C,$AF,$AF
  89540. dc.b $B5,$06,$AC,$0C,$AF,$B2,$B5,$06,$80,$B5,$AE,$0C
  89541. dc.b $B2,$E3
  89542. MusCred_PSG2: dc.b $80,$30
  89543. dc.b $F7,$00,$1A
  89544. dc.w z80_ptr(MusCred_PSG2)
  89545. - dc.b $C1,$30,$E7,$30,$C3,$E7,$30,$BF,$E7,$30,$BD,$E7
  89546. dc.b $30
  89547. dc.b $F7,$00,$02
  89548. dc.w z80_ptr(-)
  89549. - dc.b $80,$30
  89550. dc.b $F7,$00,$10
  89551. dc.w z80_ptr(-)
  89552. dc.b $80,$60,$E9,$0C,$EC,$FD,$F5,$04,$80
  89553. - dc.b $F8
  89554. dc.w z80_ptr(MusCreditsDFF2)
  89555. dc.b $F7,$00,$02
  89556. dc.w z80_ptr(-)
  89557. dc.b $80,$60
  89558. dc.b $F0,$03,$02,$01,$05
  89559. dc.b $F5,$0A,$E9,$E8,$EC,$02,$80,$30,$80,$80,$BD,$06
  89560. dc.b $BF,$C6,$C2,$1E,$80,$60,$80,$06,$C6,$80,$C6,$C4
  89561. dc.b $80,$C4,$80,$C3,$80,$C3,$80,$BF,$03,$80,$BF,$80
  89562. dc.b $09,$80,$06,$80,$30,$80,$80,$BD,$06,$BF,$C6,$C2
  89563. dc.b $1E,$80,$60,$F4
  89564. - dc.b $80,$30
  89565. dc.b $F7,$00,$0C
  89566. dc.w z80_ptr(-)
  89567. dc.b $F5,$00,$EC,$FE,$E8,$06,$80,$60,$80,$0C,$BF,$80
  89568. dc.b $BF,$80,$BF,$80,$BF,$80,$60,$80,$0C,$BF,$80,$BF
  89569. dc.b $80,$BF,$04,$80,$BF,$80,$0C,$BF,$80,$60,$EC,$02
  89570. - dc.b $F8
  89571. dc.w z80_ptr(MusCreditsE618)
  89572. dc.b $F7,$00,$02
  89573. dc.w z80_ptr(-)
  89574. - dc.b $80,$30
  89575. dc.b $F7,$00,$0A
  89576. dc.w z80_ptr(-)
  89577. dc.b $80,$60,$F5,$00,$E9,$F4,$EC,$FF,$E9,$E8,$80,$60
  89578. dc.b $F8
  89579. dc.w z80_ptr(MusCreditsE246)
  89580. dc.b $E9,$18,$EC,$02,$B1,$30,$B0,$18,$B1,$0C,$B0,$AE
  89581. dc.b $30,$B1,$EC,$FE,$80,$0C,$B5,$80,$B5,$80,$B6,$80
  89582. dc.b $B6,$EC,$03,$80,$B1,$80,$B1,$80,$B1,$80,$B1,$EC
  89583. dc.b $FC,$80,$B1,$80,$B1,$80,$B1,$18,$08,$B1,$04,$EC
  89584. dc.b $01,$E9,$18,$F5,$05,$E1,$01,$80,$60,$80,$80,$80
  89585. dc.b $80,$80,$80,$0C,$CD,$06,$80,$D4,$CD,$80,$0C,$CD
  89586. dc.b $06,$80,$D4,$CD,$80,$18,$80,$54,$E9,$24,$EC,$FD
  89587. MusCreditsE770: dc.b $F5,$03,$80,$06
  89588. - dc.b $BF,$03,$C1,$C3,$EC,$01,$E9,$FF
  89589. dc.b $F7,$00,$05
  89590. dc.w z80_ptr(-)
  89591. - dc.b $BF,$03,$C1,$C3,$EC,$01,$E9,$01
  89592. dc.b $F7,$00,$07
  89593. dc.w z80_ptr(-)
  89594. dc.b $F2
  89595. MusCred_PSG3: dc.b $F3,$E7,$80,$60,$F5,$02
  89596. - dc.b $C6,$0C,$0C,$0C,$06,$06,$0C,$0C,$06,$06,$0C
  89597. dc.b $F7,$00,$08
  89598. dc.w z80_ptr(-)
  89599. - dc.b $80,$30
  89600. dc.b $F7,$00,$08
  89601. dc.w z80_ptr(-)
  89602. - dc.b $C6,$0C,$06,$06
  89603. dc.b $F7,$00,$1F
  89604. dc.w z80_ptr(-)
  89605. dc.b $0C,$F5,$03,$C6,$F5,$02
  89606. - dc.b $C6,$0C,$06,$06
  89607. dc.b $F7,$00,$07
  89608. dc.w z80_ptr(-)
  89609. dc.b $06,$06,$06,$06
  89610. dc.b $F7,$01,$04
  89611. dc.w z80_ptr(-)
  89612. - dc.b $80,$30
  89613. dc.b $F7,$00,$0C
  89614. dc.w z80_ptr(-)
  89615. dc.b $F5,$04,$EC,$02
  89616. - dc.b $E8,$03,$C6,$06,$06,$E8,$00,$0C
  89617. dc.b $F7,$00,$04
  89618. dc.w z80_ptr(-)
  89619. dc.b $F5,$02,$EC,$FD
  89620. - dc.b $80,$0C,$C6,$06,$80,$07,$C6,$06,$80,$11,$C6,$0C
  89621. dc.b $80,$06,$C6,$0C,$80,$06,$C6,$80
  89622. dc.b $F7,$00,$07
  89623. dc.w z80_ptr(-)
  89624. dc.b $EC,$02
  89625. - dc.b $C6,$0C,$08,$04
  89626. dc.b $F7,$00,$18
  89627. dc.w z80_ptr(-)
  89628. - dc.b $C6,$0C,$0C,$0C,$08,$04
  89629. dc.b $F7,$00,$08
  89630. dc.w z80_ptr(-)
  89631. dc.b $80,$60,$F5,$04,$EC,$02
  89632. - dc.b $C6,$06,$06,$0C
  89633. dc.b $F7,$00,$10
  89634. dc.w z80_ptr(-)
  89635. - dc.b $80,$30
  89636. dc.b $F7,$00,$0A
  89637. dc.w z80_ptr(-)
  89638. dc.b $80,$60,$EC,$FF
  89639. - dc.b $F5,$01,$C6,$0C,$F5,$02,$EC,$FF,$08,$F5,$01,$EC
  89640. dc.b $01,$04
  89641. dc.b $F7,$00,$27
  89642. dc.w z80_ptr(-)
  89643. dc.b $EC,$FF,$F5,$04
  89644. - dc.b $E8,$03,$C6,$0C,$E8,$0C,$0C
  89645. dc.b $F7,$00,$1E
  89646. dc.w z80_ptr(-)
  89647. dc.b $E8,$03,$C6,$06,$E8,$0E,$12,$E8,$03,$0C,$E8,$0F
  89648. dc.b $0C,$F2
  89649. MusCred_DAC: dc.b $82,$06,$82,$82,$82,$82,$0C,$06,$0C,$06,$0C,$0C
  89650. dc.b $0C
  89651. - dc.b $81,$18,$82
  89652. dc.b $F7,$00,$0E
  89653. dc.w z80_ptr(-)
  89654. dc.b $81,$0C
  89655. - dc.b $82
  89656. dc.b $F7,$00,$07
  89657. dc.w z80_ptr(-)
  89658. dc.b $EA,$EA,$F8
  89659. dc.w z80_ptr(MusCreditsEA6E)
  89660. dc.b $81,$0C,$8D,$82,$81,$81,$8E,$82,$84,$04,$06,$02
  89661. dc.b $81,$0C,$82,$06,$82,$82,$82,$81,$0C,$82,$06,$82
  89662. dc.b $81,$81,$82,$82,$82,$82
  89663. - dc.b $81,$18,$82,$81,$82
  89664. dc.b $F7,$00,$07
  89665. dc.w z80_ptr(-)
  89666. dc.b $81,$0C,$82,$82,$82,$82,$06,$82,$8C,$8C,$8D,$8D
  89667. dc.b $8E,$8E,$F8
  89668. dc.w z80_ptr(MusCreditsEA84)
  89669. dc.b $81,$18,$82,$0C,$81,$18,$82,$0C,$82,$82,$06,$82
  89670. dc.b $F8
  89671. dc.w z80_ptr(MusCreditsEA84)
  89672. dc.b $81,$0C,$82,$82,$82,$8D,$06,$8D,$8E,$8E,$82,$06
  89673. dc.b $82,$8D,$0C,$82,$0C,$82,$06,$82,$80,$82,$82,$0C
  89674. MusCreditsE8E5: dc.b $82,$0C,$82,$82,$06,$82,$8D,$8D
  89675. - dc.b $81,$0C,$8F,$06,$90,$82,$0C,$90,$06,$91,$81,$0C
  89676. dc.b $8F,$06,$91,$82,$0C,$8F,$06,$91
  89677. dc.b $F7,$00,$04
  89678. dc.w z80_ptr(-)
  89679. dc.b $81,$0C,$8F,$06,$91,$82,$0C,$8F,$06,$91,$8C,$06
  89680. dc.b $03,$03,$8D,$06,$8D,$8D,$8E,$8E,$8E,$81,$06,$0C
  89681. dc.b $82,$06,$80,$0C,$81,$82,$8E,$82,$06,$82,$82,$82
  89682. - dc.b $81,$0C,$82,$06,$81,$12,$81,$06,$81,$12,$8C,$06
  89683. dc.b $82,$0C,$83,$06,$81,$80
  89684. dc.b $F7,$00,$06
  89685. dc.w z80_ptr(-)
  89686. dc.b $81,$0C,$82,$06,$81,$12,$81,$06,$81,$06,$82,$06
  89687. dc.b $81,$0C,$06,$82,$0C,$08,$04,$EA,$CD,$82,$30,$82
  89688. dc.b $0C,$82,$82,$82,$08,$04,$F8
  89689. dc.w z80_ptr(MusCreditsEA9F)
  89690. dc.b $F8
  89691. dc.w z80_ptr(MusCreditsEA9F)
  89692. dc.b $81,$08,$0C,$04,$82,$0C,$81,$08,$04,$82,$08,$04
  89693. dc.b $08,$04,$04,$04,$04,$08,$04,$EA,$C5
  89694. - dc.b $81,$09,$81,$03,$0C,$82,$81,$81,$18,$82
  89695. dc.b $F7,$00,$03
  89696. dc.w z80_ptr(-)
  89697. dc.b $81,$09,$81,$03,$0C,$82,$81,$81,$18,$82,$0C,$06
  89698. dc.b $06,$81,$0C,$82,$06,$82,$82,$82,$8D,$0C,$82,$0C
  89699. dc.b $0C,$0C,$06,$06
  89700. - dc.b $81,$0C,$81,$82,$80,$81,$81,$82,$83
  89701. dc.b $F7,$00,$03
  89702. dc.w z80_ptr(-)
  89703. dc.b $81,$82,$82,$82,$82,$06,$06,$06,$06,$0C,$06,$06
  89704. dc.b $81,$06,$81,$82,$82,$81,$82,$81,$81,$82,$02,$82
  89705. dc.b $04,$81,$0C,$06,$82,$0C,$06,$06,$81,$18,$82,$0C
  89706. dc.b $81,$81,$18,$82,$81,$06,$81,$12,$82,$0C,$81,$81
  89707. dc.b $18,$82,$81,$18,$82,$0C,$81,$81,$18,$82,$81,$06
  89708. dc.b $81,$12,$82,$0C,$0C,$06,$06,$06,$06,$0C,$06,$06
  89709. dc.b $82,$02,$04,$81,$0C,$06,$0C,$82,$02,$04,$81,$0C
  89710. dc.b $06,$0C,$82,$06,$82,$82,$82,$EA,$C0,$81,$0C,$82
  89711. dc.b $81,$82,$81,$82,$81,$08,$82,$04,$0C
  89712. - dc.b $81,$0C,$82
  89713. dc.b $F7,$00,$0F
  89714. dc.w z80_ptr(-)
  89715. dc.b $81,$08,$82,$04,$0C
  89716. - dc.b $81,$0C,$82
  89717. dc.b $F7,$00,$13
  89718. dc.w z80_ptr(-)
  89719. dc.b $82,$08,$0C,$04,$81,$0C,$82,$81,$82,$81,$0C,$82
  89720. dc.b $81,$06,$80,$02,$82,$82,$82,$09,$82,$03
  89721. - dc.b $81,$0C,$82
  89722. dc.b $F7,$00,$06
  89723. dc.w z80_ptr(-)
  89724. dc.b $81,$0C,$82,$81,$06,$80,$02,$82,$82,$82,$09,$82
  89725. dc.b $03
  89726. dc.b $F7,$01,$03
  89727. dc.w z80_ptr(-)
  89728. dc.b $81,$0C,$82,$81,$82,$81,$06,$82,$12,$82,$0C,$81
  89729. dc.b $F2
  89730. MusCreditsEA6E: dc.b $81,$0C,$8D,$82,$81,$81,$8E,$82,$84,$04,$06,$02
  89731. dc.b $81,$0C,$8D,$82,$81,$81,$8E,$82,$83,$E3
  89732. MusCreditsEA84: dc.b $81,$18,$82,$0C,$81,$18,$0C,$82,$81,$81,$18,$82
  89733. dc.b $0C,$81,$12,$81,$82,$18,$81,$82,$0C,$81,$18,$0C
  89734. dc.b $82,$81,$E3
  89735. MusCreditsEA9F: dc.b $81,$08,$0C,$04,$82,$0C,$81,$08,$0C,$82,$04,$81
  89736. dc.b $0C,$82,$81,$81,$08,$0C,$04,$82,$0C,$81,$08,$0C
  89737. dc.b $82,$04,$81,$0C,$82,$82,$08,$04,$E3,$81,$06,$80
  89738. dc.b $03,$81,$81,$06,$82,$81,$06,$80,$03,$81,$81,$06
  89739. dc.b $82,$03,$82,$81,$06,$80,$03,$81,$81,$06,$82,$E3
  89740. MusCred_Voices: dc.b $3A,$01,$01,$07,$01,$8E,$8D,$8E,$53,$0E,$0E,$0E
  89741. dc.b $03,$00,$00,$00,$01,$1F,$1F,$FF,$0F,$17,$27,$28,$80
  89742. dc.b $08,$09,$30,$70,$00,$1F,$5F,$1F,$5F,$12,$0A,$0E
  89743. dc.b $0A,$00,$04,$04,$03,$2F,$2F,$2F,$2F,$25,$0E,$30,$84
  89744. dc.b $3C,$31,$50,$52,$30,$52,$52,$53,$53,$08,$08,$00
  89745. dc.b $00,$04,$04,$00,$00,$10,$10,$0B,$0D,$19,$0B,$80,$80
  89746. dc.b $08,$0A,$30,$70,$00,$1F,$5F,$1F,$5F,$12,$0A,$0E
  89747. dc.b $0A,$00,$04,$04,$03,$2F,$2F,$2F,$2F,$24,$13,$2D,$80
  89748. dc.b $3D,$01,$51,$21,$01,$12,$14,$14,$0F,$0A,$05,$05
  89749. dc.b $05,$00,$00,$00,$00,$2B,$2B,$2B,$1B,$19,$80,$80,$80
  89750. dc.b $04,$57,$70,$02,$50,$1F,$1F,$1F,$1F,$00,$00,$00
  89751. dc.b $00,$06,$00,$0A,$0A,$00,$00,$0F,$0F,$1A,$10,$80,$80
  89752. dc.b $35,$01,$13,$01,$00,$1F,$18,$1D,$19,$00,$06,$09
  89753. dc.b $0D,$00,$02,$00,$03,$00,$15,$06,$16,$1E,$83,$80,$80
  89754. dc.b $3C,$31,$50,$52,$30,$52,$52,$53,$53,$08,$08,$00
  89755. dc.b $00,$04,$04,$00,$00,$1F,$1F,$0F,$0F,$1A,$16,$88,$88
  89756. dc.b $20,$36,$30,$35,$31,$DF,$9F,$DF,$9F,$07,$09,$06
  89757. dc.b $06,$07,$06,$06,$08,$2F,$1F,$1F,$FF,$14,$0F,$37,$80
  89758. dc.b $3B,$0F,$01,$06,$02,$DF,$1F,$1F,$DF,$0C,$0A,$00
  89759. dc.b $03,$0F,$00,$00,$01,$F3,$55,$05,$5C,$22,$22,$20,$80
  89760. dc.b $3C,$31,$50,$52,$30,$52,$52,$53,$53,$08,$08,$00
  89761. dc.b $00,$04,$04,$00,$00,$1F,$1F,$0F,$0F,$1C,$14,$84,$80
  89762. dc.b $3A,$69,$50,$70,$60,$1C,$1A,$18,$18,$10,$02,$0C
  89763. dc.b $09,$08,$06,$06,$03,$F9,$06,$56,$06,$28,$14,$15,$00
  89764. dc.b $3D,$00,$02,$01,$01,$4C,$50,$0F,$12,$0C,$00,$02
  89765. dc.b $05,$01,$00,$00,$00,$28,$2A,$29,$19,$1A,$06,$00,$00
  89766. dc.b $2C,$71,$31,$71,$31,$1F,$1F,$16,$16,$00,$00,$0F
  89767. dc.b $0F,$00,$00,$0F,$0F,$00,$00,$FA,$FA,$15,$14,$00,$00
  89768. dc.b $18,$37,$31,$32,$31,$9E,$1C,$DC,$9C,$0D,$04,$06
  89769. dc.b $01,$08,$03,$0A,$05,$B6,$36,$B6,$28,$2C,$14,$22,$00
  89770. dc.b $3D,$01,$02,$02,$02,$10,$50,$50,$50,$07,$08,$08
  89771. dc.b $08,$01,$00,$00,$00,$24,$18,$18,$18,$1C,$82,$82,$82
  89772. dc.b $32,$71,$33,$0D,$01,$5F,$5F,$99,$94,$05,$05,$05
  89773. dc.b $07,$02,$02,$02,$02,$11,$11,$11,$72,$23,$26,$2D,$80
  89774. dc.b $3A,$32,$52,$01,$31,$1F,$1F,$1F,$18,$01,$00,$1F
  89775. dc.b $00,$00,$00,$0F,$00,$5A,$03,$0F,$1A,$3B,$4F,$30,$00
  89776. dc.b $3C,$42,$32,$41,$41,$12,$12,$12,$12,$00,$00,$00
  89777. dc.b $00,$00,$00,$00,$00,$06,$06,$08,$08,$24,$24,$08,$08
  89778. dc.b $31,$34,$30,$35,$31,$DF,$9F,$DF,$9F,$0C,$0C,$07
  89779. dc.b $09,$07,$07,$07,$08,$2F,$1F,$1F,$2F,$17,$14,$32,$80
  89780. dc.b $3D,$01,$01,$01,$01,$10,$50,$50,$50,$07,$08,$08
  89781. dc.b $08,$01,$00,$00,$00,$20,$1A,$1A,$1A,$19,$84,$84,$84
  89782. dc.b $24,$70,$30,$74,$38,$12,$1F,$1F,$1F,$05,$05,$03
  89783. dc.b $03,$05,$05,$03,$03,$36,$26,$2C,$2C,$0A,$06,$08,$08
  89784. dc.b $3A,$01,$01,$01,$02,$8D,$07,$07,$52,$09,$00,$00
  89785. dc.b $03,$01,$02,$02,$00,$5F,$0F,$0F,$2F,$18,$18,$22,$80
  89786. dc.b $3A,$01,$01,$07,$01,$8E,$8D,$8E,$53,$0E,$0E,$0E
  89787. dc.b $03,$00,$00,$00,$00,$1F,$1F,$FF,$0F,$18,$16,$4E,$80
  89788. dc.b $3A,$03,$03,$08,$01,$8E,$8D,$8E,$53,$0E,$0E,$0E
  89789. dc.b $03,$00,$00,$00,$00,$1F,$1F,$FF,$0F,$17,$20,$28,$80
  89790. dc.b $20,$7A,$00,$31,$00,$9F,$DC,$D8,$DF,$10,$04,$0A
  89791. dc.b $04,$0F,$08,$08,$08,$5F,$BF,$5F,$BF,$14,$17,$2B,$80
  89792. dc.b $3A,$61,$51,$08,$02,$5D,$5D,$5D,$50,$04,$1F,$0F
  89793. dc.b $1F,$00,$00,$00,$00,$1F,$0F,$5F,$0F,$22,$22,$1E,$80
  89794. dc.b $02,$01,$02,$55,$04,$92,$8E,$8D,$54,$0D,$00,$0C
  89795. dc.b $03,$00,$00,$00,$00,$FF,$0F,$2F,$5F,$16,$1D,$2A,$80
  89796. dc.b $02,$75,$73,$71,$31,$1F,$96,$58,$9F,$01,$03,$1B
  89797. dc.b $08,$01,$01,$04,$05,$FF,$3F,$2F,$2F,$24,$30,$29,$80
  89798. dc.b $20,$66,$60,$65,$60,$DF,$9F,$DF,$1F,$00,$09,$06
  89799. dc.b $0C,$07,$06,$06,$08,$2F,$1F,$1F,$FF,$1C,$16,$3A,$80
  89800. dc.b $0D,$32,$06,$08,$01,$1F,$19,$19,$19,$0A,$05,$05
  89801. dc.b $05,$00,$02,$02,$02,$3F,$2F,$2F,$2F,$28,$86,$80,$8D
  89802. dc.b $38,$3A,$11,$0A,$02,$D4,$50,$14,$0E,$05,$02,$08
  89803. dc.b $88,$00,$00,$00,$00,$99,$09,$09,$1A,$2D,$19,$2C,$86
  89804. dc.b $0D,$32,$02,$04,$01,$1F,$19,$19,$19,$0A,$05,$05
  89805. dc.b $05,$00,$02,$02,$02,$3F,$2F,$2F,$2F,$28,$8B,$86,$93
  89806. dc.b $3A,$20,$60,$23,$01,$1E,$1F,$1F,$1F,$0A,$0B,$0A
  89807. dc.b $0A,$05,$0A,$07,$08,$A4,$96,$85,$78,$21,$28,$25,$00
  89808. dc.b $3A,$32,$32,$56,$42,$8D,$15,$4F,$52,$06,$07,$08
  89809. dc.b $04,$02,$00,$00,$00,$18,$28,$18,$28,$19,$2A,$20,$00
  89810. dc.b $3A,$51,$51,$08,$02,$1E,$1E,$1E,$10,$1F,$1F,$1F
  89811. dc.b $0F,$00,$00,$00,$02,$0F,$0F,$0F,$1F,$18,$22,$24,$81
  89812. dc.b $20,$36,$30,$35,$31,$DF,$9F,$DF,$9F,$07,$09,$06
  89813. dc.b $06,$07,$06,$06,$08,$2F,$1F,$1F,$FF,$19,$13,$37,$80
  89814. dc.b $3D,$01,$02,$02,$02,$14,$8C,$0E,$0E,$08,$02,$05
  89815. dc.b $05,$00,$00,$00,$00,$1F,$1F,$1F,$1F,$1A,$80,$80,$80
  89816. ; end of Mus_Credits
  89817.  
  89818. ; ------------------------------------------------------------------------------------------
  89819. ; Sound effect pointers
  89820. ; ------------------------------------------------------------------------------------------
  89821. ; WARNING the sound driver treats certain sounds specially
  89822. ; going by the ID of the sound.
  89823. ; SndID_Ring, SndID_RingLeft, SndID_Gloop, SndID_SpindashRev
  89824. ; are referenced by the sound driver directly.
  89825. ; If needed you can change this in s2.sounddriver.asm
  89826.  
  89827.  
  89828. ; NOTE: the exact order of this list determines the priority of each sound, since it determines the sound's SndID.
  89829. ; a sound can get dropped if a higher-priority sound is already playing.
  89830. ; see zSFXPriority for the priority allocation itself.
  89831. ; loc_FEE91: SoundPoint:
  89832. SoundIndex:
  89833. SndPtr_Jump: rom_ptr_z80 Sound20 ; jumping sound
  89834. SndPtr_Checkpoint: rom_ptr_z80 Sound21 ; checkpoint ding-dong sound
  89835. SndPtr_SpikeSwitch: rom_ptr_z80 Sound22 ; spike switch sound
  89836. SndPtr_Hurt: rom_ptr_z80 Sound23 ; hurt sound
  89837. SndPtr_Skidding: rom_ptr_z80 Sound24 ; skidding sound
  89838. SndPtr_BlockPush: rom_ptr_z80 Sound25 ; block push sound
  89839. SndPtr_HurtBySpikes: rom_ptr_z80 Sound26 ; spiky impalement sound
  89840. SndPtr_Sparkle: rom_ptr_z80 Sound27 ; sparkling sound
  89841. SndPtr_Beep: rom_ptr_z80 Sound28 ; short beep
  89842. SndPtr_Bwoop: rom_ptr_z80 Sound29 ; bwoop (unused)
  89843. SndPtr_Splash: rom_ptr_z80 Sound2A ; splash sound
  89844. SndPtr_Swish: rom_ptr_z80 Sound2B ; swish
  89845. SndPtr_BossHit: rom_ptr_z80 Sound2C ; boss hit
  89846. SndPtr_InhalingBubble: rom_ptr_z80 Sound2D ; inhaling a bubble
  89847. SndPtr_ArrowFiring:
  89848. SndPtr_LavaBall: rom_ptr_z80 Sound2E ; arrow firing
  89849. SndPtr_Shield: rom_ptr_z80 Sound2F ; shield sound
  89850. SndPtr_LaserBeam: rom_ptr_z80 Sound30 ; laser beam
  89851. SndPtr_Zap: rom_ptr_z80 Sound31 ; zap (unused)
  89852. SndPtr_Drown: rom_ptr_z80 Sound32 ; drownage
  89853. SndPtr_FireBurn: rom_ptr_z80 Sound33 ; fire + burn
  89854. SndPtr_Bumper: rom_ptr_z80 Sound34 ; bumper bing
  89855. SndPtr_Ring:
  89856. SndPtr_RingRight: rom_ptr_z80 Sound35 ; ring sound
  89857. SndPtr_SpikesMove: rom_ptr_z80 Sound36
  89858. SndPtr_Rumbling: rom_ptr_z80 Sound37 ; rumbling
  89859. rom_ptr_z80 Sound38 ; (unused)
  89860. SndPtr_Smash: rom_ptr_z80 Sound39 ; smash/breaking
  89861. rom_ptr_z80 Sound3A ; nondescript ding (unused)
  89862. SndPtr_DoorSlam: rom_ptr_z80 Sound3B ; door slamming shut
  89863. SndPtr_SpindashRelease: rom_ptr_z80 Sound3C ; spindash unleashed
  89864. SndPtr_Hammer: rom_ptr_z80 Sound3D ; slide-thunk
  89865. SndPtr_Roll: rom_ptr_z80 Sound3E ; rolling sound
  89866. SndPtr_ContinueJingle: rom_ptr_z80 Sound3F ; got continue
  89867. SndPtr_CasinoBonus: rom_ptr_z80 Sound40 ; short bonus ding
  89868. SndPtr_Explosion: rom_ptr_z80 Sound41 ; badnik bust
  89869. SndPtr_WaterWarning: rom_ptr_z80 Sound42 ; warning ding-ding
  89870. SndPtr_EnterGiantRing: rom_ptr_z80 Sound43 ; special stage ring flash (mostly unused)
  89871. SndPtr_BossExplosion: rom_ptr_z80 Sound44 ; thunk
  89872. SndPtr_TallyEnd: rom_ptr_z80 Sound45 ; cha-ching
  89873. SndPtr_RingSpill: rom_ptr_z80 Sound46 ; losing rings
  89874. rom_ptr_z80 Sound47 ; chain pull chink-chink (unused)
  89875. SndPtr_Flamethrower: rom_ptr_z80 Sound48 ; flamethrower
  89876. SndPtr_Bonus: rom_ptr_z80 Sound49 ; bonus pwoieeew (mostly unused)
  89877. SndPtr_SpecStageEntry: rom_ptr_z80 Sound4A ; special stage entry
  89878. SndPtr_SlowSmash: rom_ptr_z80 Sound4B ; slower smash/crumble
  89879. SndPtr_Spring: rom_ptr_z80 Sound4C ; spring boing
  89880. SndPtr_Blip: rom_ptr_z80 Sound4D ; selection blip
  89881. SndPtr_RingLeft: rom_ptr_z80 Sound4E ; another ring sound (only plays in the left speaker?)
  89882. SndPtr_Signpost: rom_ptr_z80 Sound4F ; signpost spin sound
  89883. SndPtr_CNZBossZap: rom_ptr_z80 Sound50 ; mosquito zapper
  89884. rom_ptr_z80 Sound51 ; (unused)
  89885. rom_ptr_z80 Sound52 ; (unused)
  89886. SndPtr_Signpost2P: rom_ptr_z80 Sound53
  89887. SndPtr_OOZLidPop: rom_ptr_z80 Sound54 ; OOZ lid pop sound
  89888. SndPtr_SlidingSpike: rom_ptr_z80 Sound55
  89889. SndPtr_CNZElevator: rom_ptr_z80 Sound56
  89890. SndPtr_PlatformKnock: rom_ptr_z80 Sound57
  89891. SndPtr_BonusBumper: rom_ptr_z80 Sound58 ; CNZ bonusy bumper sound
  89892. SndPtr_LargeBumper: rom_ptr_z80 Sound59 ; CNZ baaang bumper sound
  89893. SndPtr_Gloop: rom_ptr_z80 Sound5A ; CNZ gloop / water droplet sound
  89894. SndPtr_PreArrowFiring: rom_ptr_z80 Sound5B
  89895. SndPtr_Fire: rom_ptr_z80 Sound5C
  89896. SndPtr_ArrowStick: rom_ptr_z80 Sound5D ; chain clink
  89897. SndPtr_Helicopter:
  89898. SndPtr_WingFortress: rom_ptr_z80 Sound5E ; helicopter
  89899. SndPtr_SuperTransform: rom_ptr_z80 Sound5F
  89900. SndPtr_SpindashRev: rom_ptr_z80 Sound60 ; spindash charge
  89901. SndPtr_Rumbling2: rom_ptr_z80 Sound61 ; rumbling
  89902. SndPtr_CNZLaunch: rom_ptr_z80 Sound62
  89903. SndPtr_Flipper: rom_ptr_z80 Sound63 ; CNZ blooing bumper
  89904. SndPtr_HTZLiftClick: rom_ptr_z80 Sound64 ; HTZ track click sound
  89905. SndPtr_Leaves: rom_ptr_z80 Sound65 ; kicking up leaves sound
  89906. SndPtr_MegaMackDrop: rom_ptr_z80 Sound66 ; leaf splash?
  89907. SndPtr_DrawbridgeMove: rom_ptr_z80 Sound67
  89908. SndPtr_QuickDoorSlam: rom_ptr_z80 Sound68 ; door slamming quickly (unused)
  89909. SndPtr_DrawbridgeDown: rom_ptr_z80 Sound69
  89910. SndPtr_LaserBurst: rom_ptr_z80 Sound6A ; robotic laser burst
  89911. SndPtr_Scatter:
  89912. SndPtr_LaserFloor: rom_ptr_z80 Sound6B ; scatter
  89913. SndPtr_Teleport: rom_ptr_z80 Sound6C
  89914. SndPtr_Error: rom_ptr_z80 Sound6D ; error sound
  89915. SndPtr_MechaSonicBuzz: rom_ptr_z80 Sound6E ; silver sonic buzz saw
  89916. SndPtr_LargeLaser: rom_ptr_z80 Sound6F
  89917. SndPtr_OilSlide: rom_ptr_z80 Sound70
  89918. SndPtr__End:
  89919.  
  89920. ; There are many non-relative pointers in these sound effects,
  89921. ; so the sounds shouldn't simply be BINCLUDE'd.
  89922. ; They could be included as separate .asm files using "include" instead of "binclude",
  89923. ; but I wanted to minimize the number of included asm files.
  89924.  
  89925. ; some comments on what the various script commands do (after the header):
  89926. ; 0x00-0x7F sets the note duration (of the previous note and following notes)
  89927. ; 0x81-0xDF plays a note (the valid range may be smaller for PSG or DAC)
  89928. ; 0x80 plays silence
  89929. ; 0xE0-0xFF does special things. I won't list them here... search for "Coordination flags" sonic 2.
  89930.  
  89931. ; the FM voices (poorly named "ssamp" or "samples" below)
  89932. ; are 25 bytes each and go directly to YM2612 registers.
  89933. ; they can be hard to edit (there's an art to it)
  89934. ; but search for sonic "Voice editing" for more info if you want to try.
  89935.  
  89936. ; jumping sound
  89937. Sound20: dc.w $0000,$0101
  89938. dc.w $8080,z80_ptr(+),$F400
  89939. + dc.b $F5,$00,$9E,$05,$F0,$02,$01,$F8,$65,$A3,$15,$F2
  89940.  
  89941. ; checkpoint ding-dong sound
  89942. Sound21: dc.w z80_ptr(ssamp21),$0101
  89943. dc.w $8005,z80_ptr(+),$0001
  89944. ssamp21: dc.b $3C,$05,$0A,$01,$01,$56,$5C,$5C,$5C,$0E,$11,$11
  89945. dc.b $11,$09,$06,$0A,$0A,$4F,$3F,$3F,$3F,$17,$20,$80,$80
  89946. + dc.b $EF,$00,$BD,$06,$BA,$16,$F2
  89947.  
  89948. ; spike switch sound
  89949. Sound22: dc.w $0000,$0101
  89950. dc.w $80C0,z80_ptr(+),$0000
  89951. + dc.b $F0,$01,$01,$F0,$08,$F3,$E7,$C0,$04,$CA,$04
  89952. - dc.b $C0,$01,$EC
  89953. dc.w $01F7,$0006,z80_ptr(-)
  89954. dc.b $F2
  89955.  
  89956. ; hurt sound
  89957. Sound23: dc.w z80_ptr(ssamp23),$0101
  89958. dc.w $8005,z80_ptr(+),$F400
  89959. + dc.b $EF,$00,$B0,$07,$E7,$AD
  89960. - dc.b $01,$E6
  89961. dc.w $01F7,$002F,z80_ptr(-)
  89962. dc.b $F2
  89963. ssamp23: dc.b $30,$30,$30,$30,$30,$9E,$DC,$D8,$DC,$0E,$04,$0A
  89964. dc.b $05,$08,$08,$08,$08,$BF,$BF,$BF,$BF,$14,$14,$3C,$80
  89965.  
  89966. ; skidding sound
  89967. Sound24: dc.w $0000,$0102 ; sound header... no sample and 2 script entries
  89968. dc.w $80A0,z80_ptr(+),$F400 ; entry 1 header
  89969. dc.w $80C0,z80_ptr(++),$F400 ; entry 2 header
  89970. + dc.b $F5,$00,$AF,$01,$80,$AF,$80,$03 ; script entry 1
  89971. - dc.b $AF,$01,$80
  89972. dc.w $01F7,$000B,z80_ptr(-) ; loopback
  89973. dc.b $F2 ; script 1 end
  89974. + dc.b $F5,$00,$80,$01,$AD,$80,$AD,$80,$03 ; script entry 2
  89975. - dc.b $AD,$01,$80
  89976. dc.w $01F7,$000B,z80_ptr(-) ; loopback
  89977. dc.b $F2 ; script 2 end
  89978.  
  89979. ; block push sound
  89980. Sound25: dc.w z80_ptr(ssamp25),$0101
  89981. dc.w $8005,z80_ptr(+),$0000
  89982. + dc.b $EF,$00,$80,$01,$8B,$0A,$80,$02,$F2
  89983. ssamp25: dc.b $FA,$21,$10,$30,$32,$2F,$2F,$1F,$2F,$05,$09,$08
  89984. dc.b $02,$06,$06,$0F,$02,$1F,$4F,$2F,$2F,$0F,$0E,$1A,$80
  89985.  
  89986. ; spiky impalement sound
  89987. Sound26: dc.w z80_ptr(ssamp26),$0101
  89988. dc.w $8005,z80_ptr(+),$F200
  89989. + dc.b $EF,$00,$F0,$01,$01,$10,$FF,$CF,$05,$D7,$25,$F2
  89990. ssamp26: dc.b $3B,$3C,$30,$39,$31,$DF,$1F,$1F,$DF,$04,$04,$05
  89991. dc.b $01,$04,$04,$04,$02,$FF,$1F,$0F,$AF,$29,$0F,$20,$80
  89992.  
  89993. ; sparkling sound
  89994. Sound27: dc.w z80_ptr(ssamp27),$0101
  89995. dc.w $8004,z80_ptr(+),$0C1C
  89996. + dc.b $EF,$00,$C1,$05,$C4,$05,$C9,$2B,$F2
  89997. ssamp27: dc.b $07,$73,$33,$33,$73,$0F,$19,$14,$1A,$0A,$0A,$0A
  89998. dc.b $0A,$0A,$0A,$0A,$0A,$57,$57,$57,$57,$00,$00,$00,$00
  89999.  
  90000. ; short beep
  90001. Sound28: dc.w $0000,$0101
  90002. dc.w $8080,z80_ptr(+),$E803
  90003. + dc.b $F5,$04,$CB,$04,$F2
  90004.  
  90005. ; bwoop (unused)
  90006. Sound29: dc.w $0000,$0101
  90007. dc.w $80A0,z80_ptr(+),$0000
  90008. + dc.b $F0,$01,$01,$E6,$35,$8E,$06,$F2
  90009.  
  90010. ; splash sound
  90011. Sound2A: dc.w z80_ptr(ssamp2A),$0102
  90012. dc.w $80C0,z80_ptr(+),$0000
  90013. dc.w $8005,z80_ptr(++),$0003
  90014. + dc.b $F5,$00,$F3,$E7,$C2,$05,$C6,$05,$E7
  90015. - dc.b $07,$EC,$01
  90016. dc.w $E7F7,$000F,z80_ptr(-)
  90017. dc.b $F2
  90018. + dc.b $EF,$00,$A6,$14,$F2
  90019. ssamp2A: dc.b $00,$00,$02,$03,$00,$D9,$1F,$DF,$1F,$12,$14,$11
  90020. dc.b $0F,$0A,$0A,$00,$0D,$FF,$FF,$FF,$FF,$22,$27,$07,$80
  90021.  
  90022. ; swish
  90023. Sound2B: dc.w $0000,$0101
  90024. dc.w $80C0,z80_ptr(+),$0000
  90025. + dc.b $F5,$00,$F3,$E7,$C6,$03,$80,$03,$C6,$01,$E7
  90026. - dc.b $01,$EC,$01
  90027. dc.w $E7F7,$0015,z80_ptr(-)
  90028. dc.b $F2
  90029.  
  90030. ; boss hit
  90031. Sound2C: dc.w z80_ptr(smashsamp),$0101
  90032. dc.w $8005,z80_ptr(+),$0000
  90033. + dc.b $EF,$00,$F0,$01,$01,$0C,$01
  90034. - dc.b $81,$0A,$E6
  90035. dc.w $10F7,$0004,z80_ptr(-)
  90036. dc.b $F2
  90037. smashsamp: dc.b $F9,$21,$10,$30,$32,$1F,$1F,$1F,$1F,$05,$09,$18
  90038. dc.b $02,$0B,$10,$1F,$05,$1F,$4F,$2F,$2F,$0E,$04,$07,$80
  90039.  
  90040. ; inhaling a bubble
  90041. Sound2D: dc.w z80_ptr(ssamp2D),$0101
  90042. dc.w $8005,z80_ptr(+),$0E00
  90043. + dc.b $EF,$00,$F0,$01,$01,$21,$6E,$A6,$07
  90044. dc.b $80,$06,$F0,$01,$01,$44,$1E,$AD,$08,$F2
  90045. ssamp2D: dc.b $35,$05,$08,$09,$07,$1E,$0D,$0D,$0E,$0C,$03,$15
  90046. dc.b $06,$16,$09,$0E,$10,$2F,$1F,$2F,$1F,$15,$12,$12,$80
  90047.  
  90048. ; arrow firing
  90049. Sound2E: dc.w z80_ptr(ssamp2E),$0102
  90050. dc.w $8005,z80_ptr(+),$0000
  90051. dc.w $80C0,z80_ptr(++),$0000
  90052. + dc.b $EF,$00,$80,$01,$F0,$01,$01,$40,$48,$83,$06,$85,$02,$F2
  90053. + dc.b $F5,$00,$80,$0B,$F3,$E7,$C6,$01,$E7
  90054. - dc.b $02,$EC,$01
  90055. dc.w $E7F7,$0010,z80_ptr(-)
  90056. dc.b $F2
  90057. ssamp2E: dc.b $FA,$02,$00,$03,$05,$12,$0F,$11,$13,$05,$09,$18
  90058. dc.b $02,$06,$06,$0F,$02,$1F,$4F,$2F,$2F,$2F,$0E,$1A,$80
  90059.  
  90060. ; shield sound
  90061. Sound2F: dc.w z80_ptr(ssamp2F),$0101
  90062. dc.w $8005,z80_ptr(+),$0C00
  90063. + dc.b $EF,$00,$80,$01,$A3,$05,$E7,$A4,$26,$F2
  90064. ssamp2F: dc.b $30,$30,$30,$30,$30,$9E,$AC,$A8,$DC,$0E,$04,$0A
  90065. dc.b $05,$08,$08,$08,$08,$BF,$BF,$BF,$BF,$04,$14,$2C,$80
  90066.  
  90067. ; laser beam
  90068. Sound30: dc.w z80_ptr(ssamp30),$0101 ; sound header... a voice and 1 script entry
  90069. dc.w $8005,z80_ptr(+),$FB05 ; script entry header
  90070. + dc.b $EF,$00,$DF,$7F ; script start
  90071. - dc.b $DF,$02,$E6 ; script continued
  90072. dc.w $01F7,$001B,z80_ptr(-) ; loopback
  90073. dc.b $F2 ; script end
  90074. ssamp30: dc.b $83,$1F,$1F,$15,$1F,$1F,$1F,$1F,$1F,$00,$00,$00 ; voice
  90075. dc.b $00,$02,$02,$02,$02,$2F,$FF,$2F,$3F,$0B,$01,$16,$82 ; (fixed length)
  90076.  
  90077. ; zap (unused)
  90078. Sound31: dc.w z80_ptr(ssamp31),$0101
  90079. dc.w $8005,z80_ptr(+),$FB02
  90080. + dc.b $EF,$00,$B3,$05,$80,$01,$B3,$09,$F2
  90081. ssamp31: dc.b $83,$12,$13,$10,$1E,$1F,$1F,$1F,$1F,$00,$00,$00
  90082. dc.b $00,$02,$02,$02,$02,$2F,$FF,$2F,$3F,$05,$34,$10,$87
  90083.  
  90084. ; drownage
  90085. Sound32: dc.w z80_ptr(ssamp32),$0102
  90086. dc.w $8004,z80_ptr(++),$0C04
  90087. dc.w $8005,z80_ptr(+),$0E02
  90088. + dc.b $EF,$00,$F0,$01,$01,$83,$0C
  90089. - dc.b $8A,$05,$05,$E6
  90090. dc.w $03F7,$000A,z80_ptr(-)
  90091. dc.b $F2
  90092. + dc.b $80,$06,$EF,$00,$F0,$01,$01,$6F,$0E
  90093. - dc.b $8D,$04,$05,$E6
  90094. dc.w $03F7,$000A,z80_ptr(-)
  90095. dc.b $F2
  90096. ssamp32: dc.b $35,$14,$04,$1A,$09,$0E,$11,$10,$0E,$0C,$03,$15
  90097. dc.b $06,$16,$09,$0E,$10,$2F,$4F,$2F,$4F,$2F,$12,$12,$80
  90098.  
  90099. ; fire + burn
  90100. Sound33: dc.w z80_ptr(ssamp2E),$0102
  90101. dc.w $8005,z80_ptr(+),$0000
  90102. dc.w $80C0,z80_ptr(++),$0000
  90103. + dc.b $EF,$00,$80,$01,$F0,$01,$01,$40,$48,$83,$06,$85,$02,$F2
  90104. + dc.b $F5,$00,$80,$0B,$F3,$E7,$A7,$25,$E7
  90105. - dc.b $02,$EC,$01
  90106. dc.w $E7F7,$0010,z80_ptr(-)
  90107. dc.b $F2
  90108.  
  90109. ; bumper bing
  90110. Sound34: dc.w z80_ptr(ssamp34),$0103
  90111. dc.w $8005,z80_ptr(+),$0000
  90112. dc.w $8004,z80_ptr(++),$0000
  90113. dc.w $8002,z80_ptr(+++),$0002
  90114. + dc.b $EF,$00,$F6
  90115. dc.w z80_ptr(Sound34_3)
  90116. + dc.b $EF,$00,$E1,$07,$80,$01
  90117. Sound34_3:
  90118. dc.b $BA,$20,$F2
  90119. + dc.b $EF,$01,$9A,$03,$F2
  90120. ssamp34: dc.b $3C,$05,$0A,$01,$01,$56,$5C,$5C,$5C,$0E,$11,$11
  90121. dc.b $11,$09,$06,$0A,$0A,$4F,$3F,$3F,$3F,$1F,$2B,$80,$80
  90122. dc.b $05,$00,$00,$00,$00,$1F,$1F,$1F,$1F,$12,$0C,$0C
  90123. dc.b $0C,$12,$08,$08,$08,$1F,$5F,$5F,$5F,$07,$80,$80,$80
  90124.  
  90125. ; ring sound
  90126. Sound35: dc.w z80_ptr(ringsamp),$0101
  90127. dc.w $8005,z80_ptr(+),$0005
  90128. + dc.b $EF,$00,$E0,$40,$C1,$05,$C4,$05,$C9,$1B,$F2
  90129.  
  90130.  
  90131. Sound36: dc.w $0000,$0101
  90132. dc.w $80C0,z80_ptr(+),$0000
  90133. + dc.b $F0,$01,$01,$F0,$08,$F3,$E7,$C1,$07
  90134. - dc.b $D0,$01,$EC
  90135. dc.w $01F7,$000C,z80_ptr(-)
  90136. dc.b $F2
  90137.  
  90138. ; rumbling
  90139. Sound37: dc.w z80_ptr(ssamp37),$0101
  90140. dc.w $8005,z80_ptr(+),$0000
  90141. + dc.b $EF,$00,$F0,$01,$01,$20,$08
  90142. - dc.b $8B
  90143. dc.w $0AF7,$0008,z80_ptr(-)
  90144. - dc.b $8B,$10,$E6
  90145. dc.w $03F7,$0009,z80_ptr(-)
  90146. dc.b $F2
  90147. ssamp37: dc.b $FA,$21,$10,$30,$32,$1F,$1F,$1F,$1F,$05,$09,$18
  90148. dc.b $02,$06,$06,$0F,$02,$1F,$4F,$2F,$2F,$0F,$0E,$1A,$80
  90149.  
  90150. ; (unused)
  90151. Sound38: dc.w $0000,$0101
  90152. dc.w $80C0,z80_ptr(+),$0000
  90153. + dc.b $F0,$01,$01,$F0,$08,$F3,$E7,$B4,$08
  90154. - dc.b $B0,$02,$EC
  90155. dc.w $01F7,$0003,z80_ptr(-)
  90156. dc.b $F2
  90157.  
  90158. ; smash/breaking
  90159. Sound39: dc.w z80_ptr(smashsamp),$0104
  90160. dc.w $8002,z80_ptr(+),$1000
  90161. dc.w $8004,z80_ptr(+++),$0000
  90162. dc.w $8005,z80_ptr(++),$1000
  90163. dc.w $80C0,z80_ptr(s39s4),$0000
  90164. + dc.b $E0,$40,$80,$02,$F6
  90165. dc.w z80_ptr(++)
  90166. + dc.b $E0,$80,$80,$01
  90167. + dc.b $EF,$00,$F0,$03,$01,$20,$04
  90168. - dc.b $81,$18,$E6
  90169. dc.w $0AF7,$0006,z80_ptr(-)
  90170. dc.b $F2
  90171. s39s4: dc.b $F0,$01,$01,$0F,$05,$F3,$E7
  90172. - dc.b $B0,$18,$E7,$EC
  90173. dc.w $03F7,$0005,z80_ptr(-)
  90174. dc.b $F2
  90175.  
  90176. ; nondescript ding (unused)
  90177. Sound3A: dc.w z80_ptr(ssamp3A),$0101
  90178. dc.w $8005,z80_ptr(+),$0007
  90179. + dc.b $EF,$00,$AE,$08,$F2
  90180. ssamp3A: dc.b $1C,$2E,$0F,$02,$02,$1F,$1F,$1F,$1F,$18,$14,$0F
  90181. dc.b $0E,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$20,$1B,$80,$80
  90182.  
  90183. ; door slamming shut
  90184. Sound3B: dc.w z80_ptr(ssamp3B),$0101
  90185. dc.w $8005,z80_ptr(+),$F400
  90186. + dc.b $EF,$00,$9B,$04,$80,$A0,$06,$F2
  90187. ssamp3B: dc.b $3C,$00,$00,$00,$00,$1F,$1F,$1F,$1F,$00,$0F,$16
  90188. dc.b $0F,$00,$00,$00,$00,$0F,$FF,$AF,$FF,$00,$0A,$80,$80
  90189.  
  90190. ; spindash unleashed
  90191. Sound3C: dc.w z80_ptr(ssamp3C),$0102
  90192. dc.w $8005,z80_ptr(+),$9000
  90193. dc.w $80C0,z80_ptr(++),$0000
  90194. + dc.b $EF,$00,$F0,$01,$01,$C5,$1A,$CD,$07,$F2
  90195. + dc.b $F5,$07,$80,$07,$F0,$01,$02,$05,$FF,$F3,$E7,$BB,$4F,$F2
  90196. ssamp3C: dc.b $FD,$09,$00,$03,$00,$1F,$1F,$1F,$1F,$10,$0C,$0C
  90197. dc.b $0C,$0B,$10,$1F,$05,$1F,$4F,$2F,$2F,$09,$92,$84,$8E
  90198.  
  90199. ; slide-thunk
  90200. Sound3D: dc.w z80_ptr(ssamp3D),$0102
  90201. dc.w $8005,z80_ptr(+),$100A
  90202. dc.w $8004,z80_ptr(++),$0000
  90203. + dc.b $EF,$00,$F0,$01,$01,$60,$01,$A7,$08,$F2
  90204. + dc.b $80,$08,$EF,$01,$84,$22,$F2
  90205. ssamp3D: dc.b $FA,$21,$19,$3A,$30,$1F,$1F,$1F,$1F,$05,$09,$18
  90206. dc.b $02,$0B,$10,$1F,$05,$1F,$4F,$2F,$2F,$0E,$04,$07,$80
  90207. dc.b $FA,$31,$10,$30,$32,$1F,$1F,$1F,$1F,$05,$05,$18
  90208. dc.b $10,$0B,$10,$1F,$10,$1F,$1F,$2F,$2F,$0D,$01,$00,$80
  90209.  
  90210. ; rolling sound
  90211. Sound3E: dc.w z80_ptr(ssamp3E),$0101
  90212. dc.w $8004,z80_ptr(+),$0C05
  90213. + dc.b $EF,$00,$80,$01,$F0,$03,$01,$09,$FF,$CA,$25,$F4
  90214. - dc.b $E7,$E6,$01,$D0
  90215. dc.w $02F7,$002A,z80_ptr(-)
  90216. dc.b $F2
  90217. ssamp3E: dc.b $3C,$00,$02,$44,$02,$1F,$1F,$1F,$15,$00,$00,$1F
  90218. dc.b $00,$00,$00,$00,$00,$0F,$0F,$0F,$0F,$0D,$28,$00,$00
  90219.  
  90220. ; got continue
  90221. Sound3F: dc.w z80_ptr(ssamp3F),$0103
  90222. dc.w $8002,z80_ptr(+),$F406
  90223. dc.w $8004,z80_ptr(++),$F406
  90224. dc.w $8005,z80_ptr(+++),$F406
  90225. + dc.b $EF,$00,$C9,$07,$CD,$D0,$CB,$CE,$D2,$CD,$D0,$D4,$CE,$D2,$D5
  90226. - dc.b $D0,$07,$D4,$D7,$E6
  90227. dc.w $05F7,$0008,z80_ptr(-)
  90228. dc.b $F2
  90229. + dc.b $EF,$00,$E1,$01,$80,$07,$CD,$15,$CE,$D0,$D2
  90230. - dc.b $D4,$15,$E6
  90231. dc.w $05F7,$0008,z80_ptr(-)
  90232. dc.b $F2
  90233. + dc.b $EF,$00,$E1,$01,$C9,$15,$CB,$CD,$CE
  90234. - dc.b $D0,$15,$E6
  90235. dc.w $05F7,$0008,z80_ptr(-)
  90236. dc.b $F2
  90237. ssamp3F: dc.b $14,$25,$36,$33,$11,$1F,$1F,$1F,$1F,$15,$1C,$18
  90238. dc.b $13,$0B,$0D,$08,$09,$0F,$8F,$9F,$0F,$24,$0A,$05,$80
  90239.  
  90240. ; short bonus ding
  90241. Sound40: dc.w z80_ptr(ssamp3F),$0102
  90242. dc.w $8005,z80_ptr(++),$0008
  90243. dc.w $8004,z80_ptr(+),$0008
  90244. + dc.b $E1,$03,$80,$02
  90245. + dc.b $EF,$00,$C4,$16,$F2
  90246.  
  90247. ; badnik bust
  90248. Sound41: dc.w z80_ptr(ssamp41),$0102
  90249. dc.w $8005,z80_ptr(+),$0000
  90250. dc.w $80C0,z80_ptr(++),$0002
  90251. + dc.b $F0,$03,$01,$72,$0B,$EF,$00,$BA,$16,$F2
  90252. + dc.b $F5,$01,$F3,$E7,$B0,$1B,$F2
  90253. ssamp41: dc.b $3C,$0F,$03,$01,$01,$1F,$1F,$1F,$1F,$19,$19,$12
  90254. dc.b $0E,$05,$00,$12,$0F,$0F,$FF,$7F,$FF,$00,$00,$80,$80
  90255.  
  90256. ; warning ding-ding
  90257. Sound42: dc.w z80_ptr(ssamp3F),$0101
  90258. dc.w $8005,z80_ptr(+),$0C08
  90259. + dc.b $EF,$00,$BA,$08,$BA,$25,$F2
  90260.  
  90261. ; special stage ring flash (mostly unused)
  90262. Sound43: dc.w z80_ptr(ssamp43),$0102
  90263. dc.w $8004,z80_ptr(+),$0C00
  90264. dc.w $8005,z80_ptr(++),$0013
  90265. + dc.b $EF,$01,$80,$01,$A2,$08,$EF,$00,$E7,$AD,$26,$F2
  90266. + dc.b $EF,$02,$F0,$06,$01,$03,$FF,$80,$0A
  90267. - dc.b $C3
  90268. dc.w $06F7,$0005,z80_ptr(-)
  90269. dc.b $C3,$17,$F2
  90270. ssamp43: dc.b $30,$30,$34,$5C,$30,$9E,$AC,$A8,$DC,$0E,$04,$0A
  90271. dc.b $05,$08,$08,$08,$08,$BF,$BF,$BF,$BF,$24,$04,$1C,$80
  90272. dc.b $30,$30,$34,$5C,$30,$9E,$AC,$A8,$DC,$0E,$04,$0A
  90273. dc.b $05,$08,$08,$08,$08,$BF,$BF,$BF,$BF,$24,$04,$2C,$80
  90274. dc.b $04,$37,$77,$72,$49,$1F,$1F,$1F,$1F,$07,$07,$0A
  90275. dc.b $0D,$00,$00,$0B,$0B,$1F,$1F,$0F,$0F,$13,$13,$81,$88
  90276.  
  90277. ; thunk
  90278. Sound44: dc.w z80_ptr(ssamp44),$0101
  90279. dc.w $8005,z80_ptr(+),$0000
  90280. + dc.b $EF,$00,$8A,$22,$F2
  90281. ssamp44: dc.b $FA,$21,$10,$30,$32,$1F,$1F,$1F,$1F,$05,$05,$18
  90282. dc.b $10,$0B,$10,$1F,$10,$1F,$4F,$2F,$2F,$0D,$04,$07,$80
  90283.  
  90284. ; cha-ching
  90285. Sound45: dc.w z80_ptr(ssamp45),$0103
  90286. dc.w $8005,z80_ptr(+),$0000
  90287. dc.w $8004,z80_ptr(++),$0000
  90288. dc.w $80C0,z80_ptr(+++),$0000
  90289. + dc.b $EF,$00,$8A,$08,$80,$02,$8A,$08,$F2
  90290. + dc.b $EF,$01,$80,$12,$C6,$55,$F2
  90291. + dc.b $F5,$02,$F3,$E7,$80,$02,$C2,$05,$C4,$04,$C2,$05,$C4,$04,$F2
  90292. ssamp45: dc.b $3B,$03,$02,$02,$06,$18,$1A,$1A,$96,$17,$0A,$0E
  90293. dc.b $10,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$00,$39,$28,$80
  90294. ringsamp: dc.b $04,$37,$77,$72,$49,$1F,$1F,$1F,$1F,$07,$07,$0A
  90295. dc.b $0D,$00,$00,$0B,$0B,$1F,$1F,$0F,$0F,$23,$23,$80,$80
  90296.  
  90297. ; losing rings (scatter)
  90298. Sound46: dc.w z80_ptr(ringsamp),$0102
  90299. dc.w $8004,z80_ptr(+),$0005
  90300. dc.w $8005,z80_ptr(++),$0008
  90301. + dc.b $EF,$00,$C6,$02,$05,$05,$05,$05,$05,$05,$3A,$F2
  90302. + dc.b $EF,$00,$80,$02,$C4,$02,$05,$15,$02,$05,$32,$F2
  90303.  
  90304. ; chain pull chink-chink (unused)
  90305. Sound47: dc.w z80_ptr(ssamp47),$0101
  90306. dc.w $8005,z80_ptr(+),$0000
  90307. + dc.b $EF,$00,$BE,$05,$80,$04,$BE,$04,$80,$04,$F2
  90308. ssamp47: dc.b $28,$2F,$37,$5F,$2B,$1F,$1F,$1F,$1F,$15,$15,$15
  90309. dc.b $13,$13,$0D,$0C,$10,$2F,$3F,$2F,$2F,$00,$1F,$10,$80
  90310.  
  90311. ; flamethrower
  90312. Sound48: dc.w $0000,$0101
  90313. dc.w $80C0,z80_ptr(+),$0000
  90314. + dc.b $F5,$00,$F3,$E7,$A7,$25,$F2
  90315.  
  90316. ; bonus pwoieeew (mostly unused)
  90317. Sound49: dc.w z80_ptr(ssamp49),$0101
  90318. dc.w $8005,z80_ptr(+),$0E00
  90319. + dc.b $EF,$00,$F0,$01,$01,$33,$18,$B9,$1A,$F2
  90320. ssamp49: dc.b $3B,$0A,$05,$31,$02,$5F,$5F,$5F,$5F,$04,$16,$14
  90321. dc.b $0C,$00,$00,$04,$00,$1F,$D8,$6F,$FF,$03,$00,$25,$80
  90322.  
  90323. ; special stage entry
  90324. Sound4A: dc.w z80_ptr(ssamp4A),$0101
  90325. dc.w $8005,z80_ptr(+),$0002
  90326. + dc.b $EF,$00,$F0,$01,$01,$5B,$02,$CC,$65,$F2
  90327. ssamp4A: dc.b $20,$36,$30,$35,$31,$41,$3B,$49,$4B,$09,$09,$06
  90328. dc.b $08,$01,$02,$03,$A9,$0F,$0F,$0F,$0F,$29,$23,$27,$80
  90329.  
  90330. ; slower smash/crumble
  90331. Sound4B: dc.w z80_ptr(smashsamp),$0102
  90332. dc.w $8005,z80_ptr(+),$0000
  90333. dc.w $80C0,z80_ptr(++),$0000
  90334. + dc.b $EF,$00,$F0,$03,$01,$20,$04
  90335. - dc.b $81,$18,$E6
  90336. dc.w $0AF7,$0006,z80_ptr(-)
  90337. dc.b $F2
  90338. + dc.b $F0,$01,$01,$0F,$05,$F3,$E7
  90339. - dc.b $B0,$18,$E7,$EC
  90340. dc.w $03F7,$0005,z80_ptr(-)
  90341. dc.b $F2
  90342.  
  90343. ; spring boing
  90344. Sound4C: dc.w z80_ptr(ssamp4C),$0101
  90345. dc.w $8004,z80_ptr(+),$0002
  90346. + dc.b $EF,$00,$80,$01,$F0,$03,$01,$5D,$0F,$B0,$0C,$F4
  90347. - dc.b $E7,$E6,$02,$BD
  90348. dc.w $02F7,$0019,z80_ptr(-)
  90349. dc.b $F2
  90350. ssamp4C: dc.b $20,$36,$30,$35,$31,$DF,$9F,$DF,$9F,$07,$09,$06
  90351. dc.b $06,$07,$06,$06,$08,$2F,$1F,$1F,$FF,$16,$13,$30,$80
  90352.  
  90353. ; selection blip
  90354. Sound4D: dc.w $0000,$0101
  90355. dc.w $80C0,z80_ptr(+),$0000
  90356. + dc.b $BB,$02,$F2
  90357.  
  90358. ; another ring sound (only plays in the left speaker?)
  90359. Sound4E: dc.w z80_ptr(ringsamp),$0101
  90360. dc.w $8004,z80_ptr(+),$0005
  90361. + dc.b $EF,$00,$E0,$80,$C1,$04,$C4,$05,$C9,$1B,$F2
  90362.  
  90363. ; signpost spin sound
  90364. Sound4F: dc.w z80_ptr(ssamp4F),$0102
  90365. dc.w $8004,z80_ptr(+),$2703
  90366. dc.w $8005,z80_ptr(++),$2700
  90367. + dc.b $80,$04
  90368. + dc.b $EF,$00
  90369. - dc.b $B4,$05,$E6
  90370. dc.w $02F7,$0015,z80_ptr(-)
  90371. dc.b $F2
  90372. ssamp4F: dc.b $F4,$06,$0F,$04,$0E,$1F,$1F,$1F,$1F,$00,$0B,$00
  90373. dc.b $0B,$00,$05,$00,$08,$0F,$FF,$0F,$FF,$0C,$03,$8B,$80
  90374.  
  90375. ; mosquito zapper
  90376. Sound50: dc.w z80_ptr(ssamp50),$0101
  90377. dc.w $8005,z80_ptr(+),$F400
  90378. + dc.b $EF,$00,$B3,$04,$80,$01
  90379. - dc.b $B4,$04,$80
  90380. dc.w $01F7,$0004,z80_ptr(-)
  90381. dc.b $F2
  90382. ssamp50: dc.b $83,$12,$13,$10,$1E,$1F,$1F,$1F,$1F,$00,$00,$00
  90383. dc.b $00,$02,$02,$02,$02,$2F,$FF,$2F,$3F,$06,$34,$10,$87
  90384.  
  90385. ; (unused)
  90386. Sound51: dc.w z80_ptr(ssamp51),$0102
  90387. dc.w $80C0,z80_ptr(+),$0001
  90388. dc.w $8005,z80_ptr(++),$000B
  90389. + dc.b $F5,$02,$F3,$E4,$B0,$04,$85,$02,$F2
  90390. + dc.b $EF,$00,$E8,$04,$A5,$06,$F2
  90391. ssamp51: dc.b $3C,$02,$01,$00,$01,$1F,$1F,$1F,$1F,$00,$19,$0E
  90392. dc.b $10,$00,$00,$0C,$0F,$0F,$FF,$EF,$FF,$05,$00,$80,$80
  90393.  
  90394. ; (unused)
  90395. Sound52: dc.w z80_ptr(ssamp52),$0101
  90396. dc.w $8005,z80_ptr(+),$0002
  90397. + dc.b $F0,$01,$01,$2A,$07,$EF,$00
  90398. - dc.b $A5,$03
  90399. dc.w $E7F7,$0013,z80_ptr(-)
  90400. - dc.b $A5,$03,$E7,$E6
  90401. dc.w $02F7,$0013,z80_ptr(-)
  90402. dc.b $F2
  90403. ssamp52: dc.b $28,$21,$21,$21,$30,$1F,$1F,$1F,$1F,$00,$00,$00
  90404. dc.b $00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$29,$20,$29,$80
  90405.  
  90406.  
  90407. Sound53: dc.w z80_ptr(ssamp53),$0101
  90408. dc.w $8005,z80_ptr(+),$F503
  90409. + dc.b $EF,$00,$F0,$01,$01,$46,$09,$A7,$14,$E7,$14,$E7,$E6,$04
  90410. dc.b $14,$E7,$E6,$04,$14,$E7,$E6,$04,$0A,$E7,$E6,$04,$0A,$F2
  90411. ssamp53: dc.b $07,$0A,$0C,$0C,$0C,$1F,$1F,$1F,$1F,$00,$00,$00
  90412. dc.b $00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$2A,$0F,$0F,$80
  90413.  
  90414. ; OOZ lid pop sound
  90415. Sound54: dc.w z80_ptr(ssamp54),$0102
  90416. dc.w $8005,z80_ptr(+),$0000
  90417. dc.w $80C0,z80_ptr(++),$0006
  90418. + dc.b $EF,$00,$B6,$15,$F2
  90419. + dc.b $F3,$E7,$F5,$04,$C6,$03,$E7,$C5,$E7
  90420. dc.b $C4,$E7,$C3,$E7,$C2,$E7,$C1,$E7,$C0,$F2
  90421. ssamp54: dc.b $07,$03,$02,$03,$00,$FF,$6F,$6F,$3F,$12,$14,$11
  90422. dc.b $0E,$1A,$0A,$03,$0D,$FF,$FF,$FF,$FF,$03,$07,$07,$80
  90423.  
  90424.  
  90425. Sound55: dc.w z80_ptr(ssamp55),$0101
  90426. dc.w $8005,z80_ptr(+),$0000
  90427. + dc.b $EF,$00,$AA,$07,$B6,$15,$F2
  90428. ssamp55: dc.b $42,$20,$0E,$0F,$0F,$1F,$1F,$1F,$1F,$1F,$1F,$1F
  90429. dc.b $1F,$0F,$0E,$0F,$0E,$0F,$0F,$0F,$0F,$2E,$80,$20,$80
  90430.  
  90431.  
  90432. Sound56: dc.w z80_ptr(ssamp56),$0101
  90433. dc.w $8005,z80_ptr(+),$100E
  90434. + dc.b $EF,$00,$F0,$01,$01,$1E,$FF,$8F,$1C,$F4
  90435. - dc.b $E7,$9A
  90436. dc.w $05F7,$0009,z80_ptr(-)
  90437. - dc.b $E7,$9A,$04,$E6,$02,$E7,$9A,$04,$E6
  90438. dc.w $02F7,$0008,z80_ptr(-)
  90439. dc.b $F2
  90440. ssamp56: dc.b $0D,$06,$00,$00,$E5,$1F,$1F,$1F,$1F,$00,$00,$00
  90441. dc.b $00,$00,$00,$00,$00,$0F,$0F,$0F,$0F,$27,$80,$80,$80
  90442.  
  90443.  
  90444. Sound57: dc.w z80_ptr(ssamp57),$0101
  90445. dc.w $8005,z80_ptr(+),$0000
  90446. + dc.b $EF,$00,$CA,$15,$F2
  90447. ssamp57: dc.b $04,$09,$70,$00,$30,$1C,$1F,$DF,$1F,$15,$12,$0B
  90448. dc.b $0F,$0C,$0D,$00,$0D,$07,$2F,$FA,$FA,$00,$29,$00,$00
  90449.  
  90450. ; CNZ bonusy bumper sound
  90451. Sound58: dc.w z80_ptr(ssamp58),$0101
  90452. dc.w $8005,z80_ptr(+),$0007
  90453. + dc.b $EF,$00,$B3,$06,$B3,$15,$F2
  90454. ssamp58: dc.b $3C,$05,$0A,$01,$01,$56,$5C,$5C,$5C,$0E,$11,$11
  90455. dc.b $11,$09,$06,$0A,$0A,$4F,$3F,$3F,$3F,$17,$20,$80,$80
  90456.  
  90457. ; CNZ baaang bumper sound
  90458. Sound59: dc.w z80_ptr(ssamp59),$0103
  90459. dc.w $8004,z80_ptr(+),$0000
  90460. dc.w $8002,z80_ptr(++),$0002
  90461. dc.w $8005,z80_ptr(+++),$0000
  90462. + dc.b $EF,$00,$E1,$0C,$B5,$14,$F2
  90463. + dc.b $EF,$01,$9A,$03,$F2
  90464. + dc.b $EF,$00,$B6,$14,$F2
  90465. ssamp59: dc.b $32,$30,$30,$40,$70,$1F,$1F,$1F,$1F,$12,$0A,$01
  90466. dc.b $0D,$00,$01,$01,$0C,$00,$23,$C3,$F6,$08,$07,$1C,$03
  90467. dc.b $05,$00,$00,$00,$00,$1F,$1F,$1F,$1F,$12,$0C,$0C
  90468. dc.b $0C,$12,$08,$08,$08,$1F,$5F,$5F,$5F,$07,$80,$80,$80
  90469.  
  90470. ; CNZ gloop / water droplet sound
  90471. Sound5A: dc.w z80_ptr(ssamp5A),$0101
  90472. dc.w $8005,z80_ptr(+),$0000
  90473. + dc.b $EF,$00,$F0,$01,$01,$7F,$F1,$AA,$0A,$F2
  90474. ssamp5A: dc.b $47,$03,$02,$02,$04,$5F,$5F,$5F,$5F,$0E,$1A,$11
  90475. dc.b $0A,$09,$0A,$0A,$0A,$4F,$3F,$3F,$3F,$7F,$80,$80,$A3
  90476.  
  90477.  
  90478. Sound5B: dc.w z80_ptr(ssamp5B),$0101
  90479. dc.w $8005,z80_ptr(+),$0000
  90480. + dc.b $EF,$00,$80,$02,$A5,$01,$E7
  90481. - dc.b $01,$E7,$E6
  90482. dc.w $02F7,$0005,z80_ptr(-)
  90483. dc.b $F2
  90484. ssamp5B: dc.b $38,$0F,$0F,$0F,$0F,$1F,$1F,$1F,$0E,$00,$00,$00
  90485. dc.b $00,$00,$00,$00,$00,$0F,$0F,$0F,$1F,$00,$00,$00,$80
  90486.  
  90487.  
  90488. Sound5C: dc.w z80_ptr(ssamp5C),$0102
  90489. dc.w $8004,z80_ptr(+),$000E
  90490. dc.w $80C0,z80_ptr(++),$0000
  90491. + dc.b $EF,$00,$85,$40
  90492. - dc.b $E7,$04,$E6
  90493. dc.w $04F7,$000A,z80_ptr(-)
  90494. dc.b $F2
  90495. + dc.b $F5,$00,$F3,$E7,$A7,$40
  90496. - dc.b $E7,$08,$E6
  90497. dc.w $01F7,$0005,z80_ptr(-)
  90498. dc.b $F2
  90499. ssamp5C: dc.b $FA,$12,$01,$01,$01,$1F,$1F,$1F,$1F,$00,$00,$00
  90500. dc.b $00,$00,$00,$00,$00,$0F,$0F,$0F,$0F,$81,$8E,$14,$80
  90501.  
  90502. ; chain clink
  90503. Sound5D: dc.w z80_ptr(ssamp5D),$0101
  90504. dc.w $8005,z80_ptr(+),$0000
  90505. + dc.b $EF,$00,$C0,$04,$F2
  90506. ssamp5D: dc.b $28,$2F,$37,$5F,$2B,$1F,$1F,$1F,$1F,$15,$15,$15
  90507. dc.b $13,$13,$0D,$0C,$10,$2F,$3F,$2F,$2F,$00,$1F,$10,$80
  90508.  
  90509. ; helicopter
  90510. Sound5E: dc.w z80_ptr(ssamp5E),$0101
  90511. dc.w $8002,z80_ptr(+),$1405
  90512. + dc.b $EF,$00
  90513. - dc.b $95,$02,$95
  90514. dc.w $01F7,$0013,z80_ptr(-)
  90515. - dc.b $95,$02,$95,$01,$E6
  90516. dc.w $01F7,$001B,z80_ptr(-)
  90517. dc.b $F2
  90518. ssamp5E: dc.b $35,$30,$44,$40,$51,$1F,$1F,$1F,$1F,$10,$00,$13
  90519. dc.b $15,$1F,$00,$1F,$1A,$7F,$0F,$7F,$5F,$02,$A8,$80,$80
  90520.  
  90521.  
  90522. Sound5F: dc.w z80_ptr(ssamp5F),$0103
  90523. dc.w $8005,z80_ptr(s5Fs1),$0000
  90524. dc.w $80C0,z80_ptr(s5Fs2),$0000
  90525. dc.w $80A0,z80_ptr(s5Fs3),$0000
  90526. s5Fs1 dc.b $EF,$00,$F0,$01,$01,$C5,$1A,$CD,$07,$E6,$0A,$80
  90527. dc.b $06,$EF,$01,$F0,$01,$01,$11,$FF,$A2,$28
  90528. - dc.b $E7,$03,$E6
  90529. dc.w $03F7,$0005,z80_ptr(-)
  90530. dc.b $F2
  90531. s5Fs2 dc.b $80,$07,$F0,$01,$02,$05,$FF,$F3,$E7,$BB,$1D
  90532. - dc.b $E7,$07,$EC
  90533. dc.w $01F7,$0010,z80_ptr(-)
  90534. dc.b $F2
  90535. s5Fs3 dc.b $80,$16,$F5,$03
  90536. - dc.b $BF,$04,$C1,$C3,$EC,$01,$E9
  90537. dc.w $FFF7,$0005,z80_ptr(-)
  90538. - dc.b $BF,$04,$C1,$C3,$EC,$01,$E9
  90539. dc.w $01F7,$0007,z80_ptr(-)
  90540. dc.b $F2
  90541. ssamp5F: dc.b $FD,$09,$00,$03,$00,$1F,$1F,$1F,$1F,$10,$0C,$0C
  90542. dc.b $0C,$0B,$10,$1F,$05,$1F,$4F,$2F,$2F,$09,$92,$84,$8E
  90543. dc.b $3A,$70,$30,$04,$01,$0F,$14,$19,$16,$08,$0A,$0B
  90544. dc.b $05,$03,$03,$03,$05,$1F,$6F,$8F,$5F,$1F,$22,$1F,$80
  90545.  
  90546. ; spindash charge
  90547. Sound60: dc.w z80_ptr(ssamp60),$0101
  90548. dc.w $8005,z80_ptr(+),$FE00
  90549. + dc.b $EF,$00,$F0,$00,$01,$20,$F6,$C4,$16,$E7,$F4,$D0,$18,$E7
  90550. - dc.b $04,$E7,$E6
  90551. dc.w $03F7,$0010,z80_ptr(-)
  90552. dc.b $F2
  90553. ssamp60: dc.b $34,$00,$03,$0C,$09,$9F,$8C,$8F,$95,$00,$00,$00
  90554. dc.b $00,$00,$00,$00,$00,$0F,$0F,$0F,$0F,$00,$1D,$00,$00
  90555.  
  90556. ; rumbling
  90557. Sound61: dc.w z80_ptr(ssamp61),$0101
  90558. dc.w $8004,z80_ptr(+),$0004
  90559. + dc.b $80,$01,$EF,$00,$F0,$00,$01,$70,$06,$82,$06,$85,$08,$83
  90560. dc.b $01,$82,$05,$86,$06,$89,$03,$82,$08,$88,$04,$82,$06,$E6
  90561. dc.b $02,$85,$08,$E6,$02,$83,$01,$E6,$02,$82,$05,$E6,$02,$86
  90562. dc.b $06,$E6,$02,$89,$03,$E6,$02,$82,$08,$E6,$02,$88,$04,$E6,$02,$F2
  90563. ssamp61: dc.b $32,$30,$30,$50,$30,$1F,$0E,$19,$0E,$07,$12,$15
  90564. dc.b $09,$0A,$09,$1D,$06,$E8,$03,$0A,$17,$07,$00,$00,$00
  90565.  
  90566.  
  90567. Sound62: dc.w z80_ptr(ssamp62),$0101
  90568. dc.w $8005,z80_ptr(+),$FF00
  90569. + dc.b $EF,$00,$A6,$05,$F0,$01,$01,$E7,$40
  90570. - dc.b $C4,$02,$E7,$E6
  90571. dc.w $01F7,$0012,z80_ptr(-)
  90572. dc.b $F2
  90573. ssamp62: dc.b $34,$0C,$10,$73,$0C,$AF,$AC,$FF,$D5,$06,$00,$02
  90574. dc.b $01,$02,$0A,$04,$08,$BF,$BF,$BF,$BF,$00,$08,$80,$80
  90575.  
  90576. ; CNZ blooing bumper
  90577. Sound63: dc.w z80_ptr(ssamp63),$0101
  90578. dc.w $8005,z80_ptr(+),$0907
  90579. + dc.b $EF,$00,$F0,$01,$01,$04,$56,$92,$03,$9A,$25,$F2
  90580. ssamp63: dc.b $3D,$12,$10,$77,$30,$5F,$5F,$5F,$5F,$0F,$0A,$00
  90581. dc.b $01,$0A,$0A,$0D,$0D,$4F,$0F,$0F,$0F,$13,$80,$80,$80
  90582.  
  90583. ; HTZ track click sound
  90584. Sound64: dc.w z80_ptr(ssamp64),$0101
  90585. dc.w $8005,z80_ptr(+),$1100
  90586. + dc.b $EF,$00,$C7,$02,$F2
  90587. ssamp64: dc.b $24,$2A,$02,$05,$01,$1A,$1F,$10,$1F,$0F,$1F,$1F
  90588. dc.b $1F,$0C,$0D,$11,$11,$0C,$09,$09,$0F,$0E,$04,$80,$80
  90589.  
  90590. ; kicking up leaves sound
  90591. Sound65: dc.w z80_ptr(ssamp65),$0101
  90592. dc.w $80C0,z80_ptr(+),$F800
  90593. + dc.b $F5,$03,$F3,$E7,$CE,$03,$F5,$06,$CE,$04,$EC
  90594. dc.b $02,$CE,$02,$F5,$03,$EC,$FE,$CE,$08,$CE,$18,$F2
  90595. ssamp65: ; uhm... apparently they forgot to null out the pointer to here.
  90596. ; luckily, sound 65 doesn't really use its sample
  90597.  
  90598. ; leaf splash?
  90599. Sound66: dc.w z80_ptr(ssamp66),$0102
  90600. dc.w $8005,z80_ptr(++),$EE08
  90601. dc.w $80C0,z80_ptr(+),$0000
  90602. + dc.b $F3,$E7,$F5,$09,$C6,$36,$F2
  90603. + dc.b $EF,$00,$80,$01,$92,$02,$02,$02,$30,$F2
  90604. ssamp66: dc.b $32,$33,$17,$34,$13,$0F,$0D,$1B,$17,$00,$04,$02
  90605. dc.b $0B,$08,$00,$08,$09,$6F,$5F,$4F,$6F,$05,$00,$00,$80
  90606.  
  90607.  
  90608. Sound67: dc.w z80_ptr(ssamp67),$0101
  90609. dc.w $80C0,z80_ptr(+),$0000
  90610. + dc.b $F5,$06,$F3,$E7,$90,$0A,$94,$0A,$98,$0A,$9C
  90611. dc.b $0A,$A0,$0A,$A4,$08,$A8,$08,$AC,$08,$B0,$08,$F2
  90612. ssamp67: ; another not-really-used sample (like Sound65)
  90613.  
  90614. ; door slamming quickly (unused)
  90615. Sound68: dc.w z80_ptr(ssamp68),$0101
  90616. dc.w $8005,z80_ptr(+),$F400
  90617. + dc.b $EF,$00,$9B,$04,$A5,$06,$F2
  90618. ssamp68: dc.b $3C,$00,$00,$00,$00,$1F,$1F,$1F,$1F,$00,$0F,$16
  90619. dc.b $0F,$00,$00,$00,$00,$0F,$FF,$AF,$FF,$00,$0A,$80,$80
  90620.  
  90621.  
  90622. Sound69: dc.w z80_ptr(ssamp69),$0102
  90623. dc.w $8005,z80_ptr(+),$F400
  90624. dc.w $80C0,z80_ptr(++),$0000
  90625. + dc.b $EF,$00,$9B,$03,$A8,$06,$9E,$08,$F2
  90626. + dc.b $F5,$04,$F3,$E7,$C6,$03,$C6,$06,$C6,$08,$F2
  90627. ssamp69: dc.b $3C,$00,$00,$00,$00,$1F,$1F,$1F,$1F,$00,$0F,$16
  90628. dc.b $0F,$00,$00,$00,$00,$0F,$FF,$AF,$FF,$00,$0A,$80,$80
  90629.  
  90630. ; robotic laser burst
  90631. Sound6A: dc.w z80_ptr(ssamp6A),$0101
  90632. dc.w $8005,z80_ptr(+),$0004
  90633. + dc.b $EF,$00,$DF,$14,$E6,$18,$06,$F2
  90634. ssamp6A: dc.b $3D,$09,$34,$34,$28,$1F,$16,$16,$16,$00,$00,$00
  90635. dc.b $04,$00,$00,$00,$00,$0F,$0F,$0F,$0F,$15,$02,$02,$00
  90636.  
  90637. ; scatter
  90638. Sound6B: dc.w z80_ptr(ssamp6B),$0101
  90639. dc.w $8004,z80_ptr(+),$0002
  90640. + dc.b $EF,$00,$81,$04,$80,$0C,$F2
  90641. ssamp6B: dc.b $3A,$30,$30,$40,$70,$1F,$1F,$1F,$1F,$12,$0A,$01
  90642. dc.b $07,$00,$01,$01,$03,$00,$23,$C3,$46,$08,$07,$1C,$03
  90643.  
  90644.  
  90645. Sound6C: dc.w z80_ptr(ssamp6C),$0104
  90646. dc.w $8005,z80_ptr(++),$0010
  90647. dc.w $8004,z80_ptr(+),$0010
  90648. dc.w $80C0,z80_ptr(s5Fs2),$0000
  90649. dc.w $80A0,z80_ptr(s5Fs3),$0000
  90650. + dc.b $E1,$10
  90651. + dc.b $EF,$01,$F0,$01,$01,$EC,$56,$C0,$24,$F4,$EF,$00,$E6,$F0
  90652. - dc.b $BB,$02,$E7,$E6,$02,$E9
  90653. dc.w $01F7,$0020,z80_ptr(-)
  90654. dc.b $F2
  90655. ssamp6C: dc.b $00,$53,$30,$03,$30,$1F,$1F,$1F,$1F,$00,$00,$00
  90656. dc.b $00,$00,$00,$00,$00,$00,$00,$00,$0F,$0F,$06,$23,$80
  90657. dc.b $3C,$72,$32,$32,$72,$14,$14,$0F,$0F,$00,$00,$00
  90658. dc.b $00,$00,$00,$00,$00,$02,$02,$08,$08,$35,$14,$00,$00
  90659.  
  90660. ; error sound
  90661. Sound6D: dc.w z80_ptr(ssamp6D),$0101
  90662. dc.w $8005,z80_ptr(+),$0004
  90663. + dc.b $EF,$00,$B0,$06,$80,$06,$B0,$18,$F2
  90664. ssamp6D: dc.b $38,$00,$00,$00,$00,$1F,$1F,$1F,$1F,$00,$00,$00
  90665. dc.b $00,$00,$00,$00,$00,$0F,$0F,$0F,$0F,$1F,$0C,$17,$00
  90666.  
  90667. ; silver sonic buzz saw
  90668. Sound6E: dc.w z80_ptr(ssamp6E),$0102
  90669. dc.w $8005,z80_ptr(+),$0000
  90670. dc.w $80C0,z80_ptr(++),$0000
  90671. + dc.b $EF,$00,$C6,$24,$E7
  90672. - dc.b $C6,$04,$E7,$E6
  90673. dc.w $04F7,$0008,z80_ptr(-)
  90674. dc.b $F2
  90675. + dc.b $F3,$E7,$C7,$44,$F2
  90676. ssamp6E: dc.b $33,$00,$10,$00,$31,$1F,$1D,$1E,$0E,$00,$0C,$1D
  90677. dc.b $00,$00,$00,$01,$00,$0F,$0F,$0F,$0F,$08,$06,$07,$80
  90678.  
  90679.  
  90680. Sound6F: dc.w z80_ptr(ssamp6A),$0103
  90681. dc.w $8005,z80_ptr(++),$000B
  90682. dc.w $8004,z80_ptr(+),$0012
  90683. dc.w $80C0,z80_ptr(+++),$0000
  90684. + dc.b $E1,$02,$80,$02
  90685. + dc.b $EF,$00,$E6,$0C,$DF,$06,$E7,$E6,$F4,$06,$E7
  90686. dc.b $E6,$F4,$12,$E7,$E6,$0C,$06,$E7,$E6,$0C,$06,$F2
  90687. + dc.b $F3,$E7,$C6,$04,$C0,$BA,$B4,$AE,$E6
  90688. dc.b $01,$AE,$E6,$01,$AE,$E6,$01,$AE,$F2
  90689.  
  90690.  
  90691. Sound70: dc.w $0000,$0101
  90692. dc.w $80C0,z80_ptr(+),$0000
  90693. + dc.b $F3,$E7,$C6,$18
  90694. - dc.b $E7,$03,$E6
  90695. dc.w $01F7,$0008,z80_ptr(-)
  90696. dc.b $F2
  90697.  
  90698.  
  90699. finishBank
  90700.  
  90701. ; end of 'ROM'
  90702. if padToPowerOfTwo && (*)&(*-1)
  90703. cnop -1,2<<lastbit(*-1)
  90704. dc.b 0
  90705. paddingSoFar := paddingSoFar+1
  90706. else
  90707. even
  90708. endif
  90709. if MOMPASS=2
  90710. ; "About" because it will be off by the same amount that Size_of_Snd_driver_guess is incorrect (if you changed it), and because I may have missed a small amount of internal padding somewhere
  90711. message "ROM size is $\{*} bytes (\{*/1024.0} kb). About $\{paddingSoFar} bytes are padding. "
  90712. endif
  90713. ; share these symbols externally (WARNING: don't rename, move or remove these labels!)
  90714. shared word_728C_user,Obj5F_MapUnc_7240,off_3A294,MapRUnc_Sonic,movewZ80CompSize
  90715. EndOfRom:
  90716. END
Add Comment
Please, Sign In to add comment