Advertisement
wolfboyft

; NEW STUFF HERE <-- search for that

Jun 26th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.58 KB | None | 0 0
  1.  
  2. _AnimateTileset:: ; fc000
  3. ; Iterate over a given pointer array of
  4. ; animation functions (one per frame).
  5.  
  6. ; Typically in wra1, vra0
  7.  
  8. ld a, [TilesetAnim]
  9. ld e, a
  10. ld a, [TilesetAnim + 1]
  11. ld d, a
  12.  
  13. ld a, [hTileAnimFrame]
  14. ld l, a
  15. inc a
  16. ld [hTileAnimFrame], a
  17.  
  18. ld h, 0
  19. rept 2
  20. add hl, hl
  21. endr
  22. add hl, de
  23.  
  24. ; 2-byte parameter
  25. ; All functions take input de.
  26. ld e, [hl]
  27. inc hl
  28. ld d, [hl]
  29. inc hl
  30.  
  31. ; Function address
  32. ld a, [hli]
  33. ld h, [hl]
  34. ld l, a
  35.  
  36. jp [hl]
  37. ; fc01b
  38.  
  39. Tileset00Anim: ; 0xfc01b
  40. Tileset02Anim: ; 0xfc01b
  41. Tileset03Anim: ; 0xfc01b
  42. dw VTiles2 tile $14, AnimateWaterTile
  43. dw NULL, WaitTileAnimation
  44. dw NULL, WaitTileAnimation
  45. dw NULL, WaitTileAnimation
  46. dw NULL, TileAnimationPalette
  47. dw NULL, WaitTileAnimation
  48. dw NULL, AnimateFlowerTile
  49. dw NULL, WaitTileAnimation
  50. dw NULL, WaitTileAnimation
  51. dw NULL, StandingTileFrame8
  52. dw NULL, DoneTileAnimation
  53. ; 0xfc047
  54.  
  55. Tileset25Anim: ; 0xfc047
  56. dw VTiles2 tile $14, AnimateWaterTile
  57. dw NULL, WaitTileAnimation
  58. dw VTiles2 tile $5f, AnimateFountain
  59. dw NULL, WaitTileAnimation
  60. dw NULL, TileAnimationPalette
  61. dw NULL, WaitTileAnimation
  62. dw NULL, AnimateFlowerTile
  63. dw NULL, WaitTileAnimation
  64. dw NULL, WaitTileAnimation
  65. dw NULL, StandingTileFrame8
  66. dw NULL, DoneTileAnimation
  67. ; 0xfc073
  68.  
  69. Tileset31Anim: ; 0xfc073
  70. dw NULL, ForestTreeLeftAnimation
  71. dw NULL, ForestTreeRightAnimation
  72. dw NULL, WaitTileAnimation
  73. dw NULL, WaitTileAnimation
  74. dw NULL, WaitTileAnimation
  75. dw NULL, ForestTreeLeftAnimation2
  76. dw NULL, ForestTreeRightAnimation2
  77. dw NULL, AnimateFlowerTile
  78. dw VTiles2 tile $14, AnimateWaterTile
  79. dw NULL, TileAnimationPalette
  80. dw NULL, StandingTileFrame8
  81. dw NULL, DoneTileAnimation
  82. ; 0xfc0a3
  83.  
  84. Tileset01Anim: ; 0xfc0a3
  85. dw VTiles2 tile $14, AnimateWaterTile
  86. dw NULL, WaitTileAnimation
  87. dw NULL, WaitTileAnimation
  88. dw NULL, TileAnimationPalette
  89. dw NULL, WaitTileAnimation
  90. dw NULL, AnimateFlowerTile
  91. dw WhirlpoolFrames1, AnimateWhirlpoolTile
  92. dw WhirlpoolFrames2, AnimateWhirlpoolTile
  93. dw WhirlpoolFrames3, AnimateWhirlpoolTile
  94. dw WhirlpoolFrames4, AnimateWhirlpoolTile
  95. dw NULL, WaitTileAnimation
  96. dw NULL, StandingTileFrame8
  97. dw NULL, DoneTileAnimation
  98. ; 0xfc0d7
  99.  
  100. TilesetAnimfc0d7: ; 0xfc0d7
  101. dw VTiles2 tile $03, WriteTileToBuffer
  102. dw wTileAnimBuffer, ScrollTileRightLeft
  103. dw VTiles2 tile $03, WriteTileFromBuffer
  104. dw NULL, WaitTileAnimation
  105. dw NULL, WaitTileAnimation
  106. dw NULL, WaitTileAnimation
  107. dw NULL, AnimateFlowerTile
  108. dw NULL, WaitTileAnimation
  109. dw NULL, WaitTileAnimation
  110. dw NULL, WaitTileAnimation
  111. dw NULL, DoneTileAnimation
  112. ; 0xfc103
  113.  
  114. TilesetAnimfc103: ; 0xfc103
  115. dw VTiles2 tile $14, WriteTileToBuffer
  116. dw wTileAnimBuffer, ScrollTileRightLeft
  117. dw VTiles2 tile $14, WriteTileFromBuffer
  118. dw NULL, WaitTileAnimation
  119. dw NULL, WaitTileAnimation
  120. dw NULL, WaitTileAnimation
  121. dw NULL, WaitTileAnimation
  122. dw NULL, WaitTileAnimation
  123. dw NULL, WaitTileAnimation
  124. dw NULL, WaitTileAnimation
  125. dw NULL, DoneTileAnimation
  126. ; 0xfc12f
  127.  
  128. Tileset09Anim: ; 0xfc12f
  129. dw VTiles2 tile $14, AnimateWaterTile
  130. dw NULL, WaitTileAnimation
  131. dw NULL, WaitTileAnimation
  132. dw NULL, WaitTileAnimation
  133. dw NULL, WaitTileAnimation
  134. dw NULL, TileAnimationPalette
  135. dw NULL, WaitTileAnimation
  136. dw NULL, WaitTileAnimation
  137. dw NULL, WaitTileAnimation
  138. dw NULL, WaitTileAnimation
  139. dw NULL, StandingTileFrame8
  140. dw NULL, DoneTileAnimation
  141. ; 0xfc15f
  142.  
  143. Tileset15Anim: ; 0xfc15f
  144. dw NULL, SafariFountainAnim2
  145. dw NULL, WaitTileAnimation
  146. dw NULL, WaitTileAnimation
  147. dw NULL, WaitTileAnimation
  148. dw NULL, SafariFountainAnim1
  149. dw NULL, WaitTileAnimation
  150. dw NULL, StandingTileFrame8
  151. dw NULL, DoneTileAnimation
  152. ; 0xfc17f
  153.  
  154. TilesetAnimfc17f: ; 0xfc17f
  155. dw VTiles2 tile $53, WriteTileToBuffer
  156. dw wTileAnimBuffer, ScrollTileDown
  157. dw wTileAnimBuffer, ScrollTileDown
  158. dw VTiles2 tile $53, WriteTileFromBuffer
  159. dw VTiles2 tile $03, WriteTileToBuffer
  160. dw wTileAnimBuffer, ScrollTileRightLeft
  161. dw VTiles2 tile $03, WriteTileFromBuffer
  162. dw VTiles2 tile $53, WriteTileToBuffer
  163. dw wTileAnimBuffer, ScrollTileDown
  164. dw wTileAnimBuffer, ScrollTileDown
  165. dw VTiles2 tile $53, WriteTileFromBuffer
  166. dw NULL, DoneTileAnimation
  167. ; 0xfc1af
  168.  
  169. TilesetAnimfc1af: ; 0xfc1af
  170. dw VTiles2 tile $54, WriteTileToBuffer
  171. dw wTileAnimBuffer, ScrollTileDown
  172. dw wTileAnimBuffer, ScrollTileDown
  173. dw VTiles2 tile $54, WriteTileFromBuffer
  174. dw NULL, WaitTileAnimation
  175. dw VTiles2 tile $03, WriteTileToBuffer
  176. dw wTileAnimBuffer, ScrollTileRightLeft
  177. dw VTiles2 tile $03, WriteTileFromBuffer
  178. dw NULL, WaitTileAnimation
  179. dw VTiles2 tile $54, WriteTileToBuffer
  180. dw wTileAnimBuffer, ScrollTileDown
  181. dw wTileAnimBuffer, ScrollTileDown
  182. dw VTiles2 tile $54, WriteTileFromBuffer
  183. dw NULL, DoneTileAnimation
  184. ; 0xfc1e7
  185.  
  186. Tileset24Anim: ; 0xfc1e7
  187. Tileset30Anim: ; 0xfc1e7
  188. dw VTiles2 tile $14, WriteTileToBuffer
  189. dw NULL, FlickeringCaveEntrancePalette
  190. dw wTileAnimBuffer, ScrollTileRightLeft
  191. dw NULL, FlickeringCaveEntrancePalette
  192. dw VTiles2 tile $14, WriteTileFromBuffer
  193. dw NULL, FlickeringCaveEntrancePalette
  194. dw NULL, TileAnimationPalette
  195. dw NULL, FlickeringCaveEntrancePalette
  196. dw VTiles2 tile $40, WriteTileToBuffer
  197. dw NULL, FlickeringCaveEntrancePalette
  198. dw wTileAnimBuffer, ScrollTileDown
  199. dw NULL, FlickeringCaveEntrancePalette
  200. dw wTileAnimBuffer, ScrollTileDown
  201. dw NULL, FlickeringCaveEntrancePalette
  202. dw wTileAnimBuffer, ScrollTileDown
  203. dw NULL, FlickeringCaveEntrancePalette
  204. dw VTiles2 tile $40, WriteTileFromBuffer
  205. dw NULL, FlickeringCaveEntrancePalette
  206. dw NULL, DoneTileAnimation
  207. ; 0xfc233
  208.  
  209. Tileset29Anim: ; 0xfc233
  210. dw VTiles2 tile $35, WriteTileToBuffer
  211. dw NULL, FlickeringCaveEntrancePalette
  212. dw wTileAnimBuffer, ScrollTileRightLeft
  213. dw NULL, FlickeringCaveEntrancePalette
  214. dw VTiles2 tile $35, WriteTileFromBuffer
  215. dw NULL, FlickeringCaveEntrancePalette
  216. dw NULL, TileAnimationPalette
  217. dw NULL, FlickeringCaveEntrancePalette
  218. dw VTiles2 tile $31, WriteTileToBuffer
  219. dw NULL, FlickeringCaveEntrancePalette
  220. dw wTileAnimBuffer, ScrollTileDown
  221. dw NULL, FlickeringCaveEntrancePalette
  222. dw wTileAnimBuffer, ScrollTileDown
  223. dw NULL, FlickeringCaveEntrancePalette
  224. dw wTileAnimBuffer, ScrollTileDown
  225. dw NULL, FlickeringCaveEntrancePalette
  226. dw VTiles2 tile $31, WriteTileFromBuffer
  227. dw NULL, FlickeringCaveEntrancePalette
  228. dw NULL, DoneTileAnimation
  229. ; 0xfc27f
  230.  
  231. Tileset23Anim: ; 0xfc27f
  232. dw SproutPillarTilePointer9, AnimateSproutPillarTile
  233. dw SproutPillarTilePointer10, AnimateSproutPillarTile
  234. dw SproutPillarTilePointer7, AnimateSproutPillarTile
  235. dw SproutPillarTilePointer8, AnimateSproutPillarTile
  236. dw SproutPillarTilePointer5, AnimateSproutPillarTile
  237. dw SproutPillarTilePointer6, AnimateSproutPillarTile
  238. dw SproutPillarTilePointer3, AnimateSproutPillarTile
  239. dw SproutPillarTilePointer4, AnimateSproutPillarTile
  240. dw SproutPillarTilePointer1, AnimateSproutPillarTile
  241. dw SproutPillarTilePointer2, AnimateSproutPillarTile
  242. dw NULL, StandingTileFrame
  243. dw NULL, WaitTileAnimation
  244. dw NULL, WaitTileAnimation
  245. dw NULL, WaitTileAnimation
  246. dw NULL, WaitTileAnimation
  247. dw NULL, DoneTileAnimation
  248. ; 0xfc2bf
  249.  
  250. TilesetAnimfc2bf: ; 0xfc2bf
  251. dw VTiles2 tile $4f, WriteTileToBuffer
  252. dw wTileAnimBuffer, ScrollTileRightLeft
  253. dw VTiles2 tile $4f, WriteTileFromBuffer
  254. dw NULL, WaitTileAnimation
  255. dw NULL, WaitTileAnimation
  256. dw NULL, WaitTileAnimation
  257. dw NULL, WaitTileAnimation
  258. dw NULL, WaitTileAnimation
  259. dw NULL, WaitTileAnimation
  260. dw NULL, DoneTileAnimation
  261. ; 0xfc2e7
  262.  
  263. Tileset04Anim: ; 0xfc2e7
  264. Tileset05Anim: ; 0xfc2e7
  265. Tileset06Anim: ; 0xfc2e7
  266. Tileset07Anim: ; 0xfc2e7
  267. Tileset08Anim: ; 0xfc2e7
  268. Tileset10Anim: ; 0xfc2e7
  269. Tileset11Anim: ; 0xfc2e7
  270. Tileset12Anim: ; 0xfc2e7
  271. Tileset13Anim: ; 0xfc2e7
  272. Tileset14Anim: ; 0xfc2e7
  273. Tileset16Anim: ; 0xfc2e7
  274. Tileset17Anim: ; 0xfc2e7
  275. Tileset18Anim: ; 0xfc2e7
  276. Tileset19Anim: ; 0xfc2e7
  277. Tileset20Anim: ; 0xfc2e7
  278. Tileset21Anim: ; 0xfc2e7
  279. Tileset22Anim: ; 0xfc2e7
  280. Tileset26Anim: ; 0xfc2e7
  281. Tileset27Anim: ; 0xfc2e7
  282. Tileset28Anim: ; 0xfc2e7
  283. Tileset32Anim: ; 0xfc2e7
  284. Tileset33Anim: ; 0xfc2e7
  285. Tileset34Anim: ; 0xfc2e7
  286. Tileset35Anim: ; 0xfc2e7
  287. Tileset36Anim: ; 0xfc2e7 ; NEW STUFF HERE
  288. dw NULL, SafariFountainAnim2b
  289. dw NULL, WaitTileAnimation
  290. dw NULL, WaitTileAnimation
  291. dw NULL, WaitTileAnimation
  292. dw NULL, SafariFountainAnim1b
  293. dw NULL, WaitTileAnimation
  294. dw NULL, StandingTileFrame
  295. dw NULL, DoneTileAnimation
  296. ; 0xfc2fb
  297.  
  298. DoneTileAnimation: ; fc2fb
  299. ; Reset the animation command loop.
  300. xor a
  301. ld [hTileAnimFrame], a
  302.  
  303. WaitTileAnimation: ; fc2fe
  304. ; Do nothing this frame.
  305. ret
  306. ; fc2ff
  307.  
  308. StandingTileFrame8: ; fc2ff
  309. ld a, [TileAnimationTimer]
  310. inc a
  311. and a, 7
  312. ld [TileAnimationTimer], a
  313. ret
  314. ; fc309
  315.  
  316.  
  317. ScrollTileRightLeft: ; fc309
  318. ; Scroll right for 4 ticks, then left for 4 ticks.
  319. ld a, [TileAnimationTimer]
  320. inc a
  321. and 7
  322. ld [TileAnimationTimer], a
  323. and 4
  324. jr nz, ScrollTileLeft
  325. jr ScrollTileRight
  326. ; fc318
  327.  
  328. ScrollTileUpDown: ; fc318
  329. ; Scroll up for 4 ticks, then down for 4 ticks.
  330. ld a, [TileAnimationTimer]
  331. inc a
  332. and 7
  333. ld [TileAnimationTimer], a
  334. and 4
  335. jr nz, ScrollTileDown
  336. jr ScrollTileUp
  337. ; fc327
  338.  
  339. ScrollTileLeft: ; fc327
  340. ld h, d
  341. ld l, e
  342. ld c, 4
  343. .loop
  344. rept 4
  345. ld a, [hl]
  346. rlca
  347. ld [hli], a
  348. endr
  349. dec c
  350. jr nz, .loop
  351. ret
  352. ; fc33b
  353.  
  354. ScrollTileRight: ; fc33b
  355. ld h, d
  356. ld l, e
  357. ld c, 4
  358. .loop
  359. rept 4
  360. ld a, [hl]
  361. rrca
  362. ld [hli], a
  363. endr
  364. dec c
  365. jr nz, .loop
  366. ret
  367. ; fc34f
  368.  
  369. ScrollTileUp: ; fc34f
  370. ld h, d
  371. ld l, e
  372. ld d, [hl]
  373. inc hl
  374. ld e, [hl]
  375. ld bc, $e
  376. add hl, bc
  377. ld a, 4
  378. .loop
  379. ld c, [hl]
  380. ld [hl], e
  381. dec hl
  382. ld b, [hl]
  383. ld [hl], d
  384. dec hl
  385. ld e, [hl]
  386. ld [hl], c
  387. dec hl
  388. ld d, [hl]
  389. ld [hl], b
  390. dec hl
  391. dec a
  392. jr nz, .loop
  393. ret
  394. ; fc36a
  395.  
  396. ScrollTileDown: ; fc36a
  397. ld h, d
  398. ld l, e
  399. ld de, $e
  400. push hl
  401. add hl, de
  402. ld d, [hl]
  403. inc hl
  404. ld e, [hl]
  405. pop hl
  406. ld a, 4
  407. .loop
  408. ld b, [hl]
  409. ld [hl], d
  410. inc hl
  411. ld c, [hl]
  412. ld [hl], e
  413. inc hl
  414. ld d, [hl]
  415. ld [hl], b
  416. inc hl
  417. ld e, [hl]
  418. ld [hl], c
  419. inc hl
  420. dec a
  421. jr nz, .loop
  422. ret
  423. ; fc387
  424.  
  425.  
  426. AnimateFountain: ; fc387
  427. ld hl, [sp+0]
  428. ld b, h
  429. ld c, l
  430. ld hl, .frames
  431. ld a, [TileAnimationTimer]
  432. and 7
  433. add a
  434. add l
  435. ld l, a
  436. jr nc, .okay
  437. inc h
  438. .okay
  439. ld a, [hli]
  440. ld h, [hl]
  441. ld l, a
  442. ld sp, hl
  443. ld l, e
  444. ld h, d
  445. jp WriteTile
  446.  
  447. .frames
  448. dw .frame1
  449. dw .frame2
  450. dw .frame3
  451. dw .frame4
  452. dw .frame3
  453. dw .frame4
  454. dw .frame5
  455. dw .frame1
  456.  
  457. .frame1 INCBIN "gfx/tilesets/fountain/1.2bpp"
  458. .frame2 INCBIN "gfx/tilesets/fountain/2.2bpp"
  459. .frame3 INCBIN "gfx/tilesets/fountain/3.2bpp"
  460. .frame4 INCBIN "gfx/tilesets/fountain/4.2bpp"
  461. .frame5 INCBIN "gfx/tilesets/fountain/5.2bpp"
  462. ; fc402
  463.  
  464.  
  465. AnimateWaterTile: ; fc402
  466. ; Draw a water tile for the current frame in VRAM tile at de.
  467.  
  468. ; Save sp in bc (see WriteTile).
  469. ld hl, [sp+0]
  470. ld b, h
  471. ld c, l
  472.  
  473. ld a, [TileAnimationTimer]
  474.  
  475. ; 4 tile graphics, updated every other frame.
  476. and 3 << 1
  477.  
  478. ; 2 x 8 = 16 bytes per tile
  479. rept 3
  480. add a
  481. endr
  482.  
  483. add WaterTileFrames % $100
  484. ld l, a
  485. ld a, 0
  486. adc WaterTileFrames / $100
  487. ld h, a
  488.  
  489. ; Stack now points to the start of the tile for this frame.
  490. ld sp, hl
  491.  
  492. ld l, e
  493. ld h, d
  494.  
  495. jp WriteTile
  496. ; fc41c
  497.  
  498. WaterTileFrames: ; fc41c
  499. INCBIN "gfx/tilesets/water.2bpp"
  500. ; fc45c
  501.  
  502.  
  503. ForestTreeLeftAnimation: ; fc45c
  504. ld hl, [sp+0]
  505. ld b, h
  506. ld c, l
  507.  
  508. ; Only during the Celebi event.
  509. ld a, [wCelebiEvent]
  510. bit 2, a
  511. jr nz, .asm_fc46c
  512. ld hl, ForestTreeLeftFrames
  513. jr .asm_fc47d
  514.  
  515. .asm_fc46c
  516. ld a, [TileAnimationTimer]
  517. call GetForestTreeFrame
  518. rept 3
  519. add a
  520. endr
  521. add ForestTreeLeftFrames % $100
  522. ld l, a
  523. ld a, 0
  524. adc ForestTreeLeftFrames / $100
  525. ld h, a
  526.  
  527. .asm_fc47d
  528. ld sp, hl
  529. ld hl, VTiles2 tile $0c
  530. jp WriteTile
  531. ; fc484
  532.  
  533.  
  534. ForestTreeLeftFrames: ; fc484
  535. INCBIN "gfx/tilesets/forest-tree/1.2bpp"
  536. INCBIN "gfx/tilesets/forest-tree/2.2bpp"
  537. ; fc4a4
  538.  
  539. ForestTreeRightFrames: ; fc4a4
  540. INCBIN "gfx/tilesets/forest-tree/3.2bpp"
  541. INCBIN "gfx/tilesets/forest-tree/4.2bpp"
  542. ; fc4c4
  543.  
  544.  
  545. ForestTreeRightAnimation: ; fc4c4
  546. ld hl, [sp+0]
  547. ld b, h
  548. ld c, l
  549.  
  550. ; Only during the Celebi event.
  551. ld a, [wCelebiEvent]
  552. bit 2, a
  553. jr nz, .asm_fc4d4
  554. ld hl, ForestTreeRightFrames
  555. jr .asm_fc4eb
  556.  
  557. .asm_fc4d4
  558. ld a, [TileAnimationTimer]
  559. call GetForestTreeFrame
  560. rept 3
  561. add a
  562. endr
  563. add ForestTreeLeftFrames % $100
  564. ld l, a
  565. ld a, 0
  566. adc ForestTreeLeftFrames / $100
  567. ld h, a
  568. push bc
  569. ld bc, ForestTreeRightFrames - ForestTreeLeftFrames
  570. add hl, bc
  571. pop bc
  572.  
  573. .asm_fc4eb
  574. ld sp, hl
  575. ld hl, VTiles2 tile $0f
  576. jp WriteTile
  577. ; fc4f2
  578.  
  579.  
  580. ForestTreeLeftAnimation2: ; fc4f2
  581. ld hl, [sp+0]
  582. ld b, h
  583. ld c, l
  584.  
  585. ; Only during the Celebi event.
  586. ld a, [wCelebiEvent]
  587. bit 2, a
  588. jr nz, .asm_fc502
  589. ld hl, ForestTreeLeftFrames
  590. jr .asm_fc515
  591.  
  592. .asm_fc502
  593. ld a, [TileAnimationTimer]
  594. call GetForestTreeFrame
  595. xor 2
  596. rept 3
  597. add a
  598. endr
  599. add ForestTreeLeftFrames % $100
  600. ld l, a
  601. ld a, 0
  602. adc ForestTreeLeftFrames / $100
  603. ld h, a
  604.  
  605. .asm_fc515
  606. ld sp, hl
  607. ld hl, VTiles2 tile $0c
  608. jp WriteTile
  609. ; fc51c
  610.  
  611.  
  612. ForestTreeRightAnimation2: ; fc51c
  613. ld hl, [sp+0]
  614. ld b, h
  615. ld c, l
  616.  
  617. ; Only during the Celebi event.
  618. ld a, [wCelebiEvent]
  619. bit 2, a
  620. jr nz, .asm_fc52c
  621. ld hl, ForestTreeRightFrames
  622. jr .asm_fc545
  623.  
  624. .asm_fc52c
  625. ld a, [TileAnimationTimer]
  626. call GetForestTreeFrame
  627. xor 2
  628. rept 3
  629. add a
  630. endr
  631. add ForestTreeLeftFrames % $100
  632. ld l, a
  633. ld a, 0
  634. adc ForestTreeLeftFrames / $100
  635. ld h, a
  636. push bc
  637. ld bc, ForestTreeRightFrames - ForestTreeLeftFrames
  638. add hl, bc
  639. pop bc
  640.  
  641. .asm_fc545
  642. ld sp, hl
  643. ld hl, VTiles2 tile $0f
  644. jp WriteTile
  645. ; fc54c
  646.  
  647.  
  648. GetForestTreeFrame: ; fc54c
  649. ; Return 0 if a is even, or 2 if odd.
  650. and a
  651. jr z, .even
  652. cp 1
  653. jr z, .odd
  654. cp 2
  655. jr z, .even
  656. cp 3
  657. jr z, .odd
  658. cp 4
  659. jr z, .even
  660. cp 5
  661. jr z, .odd
  662. cp 6
  663. jr z, .even
  664. .odd
  665. ld a, 2
  666. scf
  667. ret
  668. .even
  669. xor a
  670. ret
  671. ; fc56d
  672.  
  673.  
  674. AnimateFlowerTile: ; fc56d
  675. ; No parameters.
  676.  
  677. ; Save sp in bc (see WriteTile).
  678. ld hl, [sp+0]
  679. ld b, h
  680. ld c, l
  681.  
  682. ; Alternate tile graphic every other frame
  683. ld a, [TileAnimationTimer]
  684. and 1 << 1
  685. ld e, a
  686.  
  687. ; CGB has different color mappings for flowers.
  688. ld a, [hCGB]
  689. and 1
  690.  
  691. add e
  692. swap a ; << 4 (16 bytes)
  693. ld e, a
  694. ld d, 0
  695. ld hl, FlowerTileFrames
  696. add hl, de
  697. ld sp, hl
  698.  
  699. ld hl, VTiles2 + $30 ; tile 4
  700.  
  701. jp WriteTile
  702. ; fc58c
  703.  
  704. FlowerTileFrames: ; fc58c
  705. INCBIN "gfx/tilesets/flower/dmg_1.2bpp"
  706. INCBIN "gfx/tilesets/flower/cgb_1.2bpp"
  707. INCBIN "gfx/tilesets/flower/dmg_2.2bpp"
  708. INCBIN "gfx/tilesets/flower/cgb_2.2bpp"
  709. ; fc5cc
  710.  
  711.  
  712. SafariFountainAnim1: ; fc5cc
  713. ; Splash in the bottom-right corner of the fountain.
  714. ld hl, [sp+0]
  715. ld b, h
  716. ld c, l
  717. ld a, [TileAnimationTimer]
  718. and 6
  719. srl a
  720. rept 2
  721. inc a
  722. endr
  723. and 3
  724. swap a
  725. ld e, a
  726. ld d, 0
  727. ld hl, SafariFountainFrames
  728. add hl, de
  729. ld sp, hl
  730. ld hl, VTiles2 tile $5b
  731. jp WriteTile
  732. ; fc5eb
  733.  
  734.  
  735. SafariFountainAnim2: ; fc5eb
  736. ; Splash in the top-left corner of the fountain.
  737. ld hl, [sp+0]
  738. ld b, h
  739. ld c, l
  740. ld a, [TileAnimationTimer]
  741. and 6
  742. rept 3
  743. add a
  744. endr
  745. ld e, a
  746. ld d, 0
  747. ld hl, SafariFountainFrames
  748. add hl, de
  749. ld sp, hl
  750. ld hl, VTiles2 tile $38
  751. jp WriteTile
  752. ; fc605
  753.  
  754. SafariFountainAnim1b: ; fc5cc
  755. ; Splash in the bottom-right corner of the fountain.
  756. ld hl, [sp+0]
  757. ld b, h
  758. ld c, l
  759. ld a, [TileAnimationTimer]
  760. and 6
  761. srl a
  762. rept 2
  763. inc a
  764. endr
  765. and 3
  766. swap a
  767. ld e, a
  768. ld d, 0
  769. ld hl, SafariFountainFrames
  770. add hl, de
  771. ld sp, hl
  772. ld hl, VTiles2 tile $6
  773. jp WriteTile
  774. ; fc5eb
  775.  
  776.  
  777. SafariFountainAnim2b: ; fc5eb ; NEW STUFF HERE
  778. ; Splash in the top-left corner of the fountain.
  779. ld hl, [sp+0]
  780. ld b, h
  781. ld c, l
  782. ld a, [TileAnimationTimer]
  783. and 6
  784. rept 3
  785. add a
  786. endr
  787. ld e, a
  788. ld d, 0
  789. ld hl, SafariFountainFrames
  790. add hl, de
  791. ld sp, hl
  792. ld hl, VTiles2 tile $38
  793. jp WriteTile
  794.  
  795. SafariFountainFrames: ; fc605
  796. INCBIN "gfx/tilesets/safari/1.2bpp"
  797. INCBIN "gfx/tilesets/safari/2.2bpp"
  798. INCBIN "gfx/tilesets/safari/3.2bpp"
  799. INCBIN "gfx/tilesets/safari/4.2bpp"
  800. ; fc645
  801.  
  802.  
  803. AnimateSproutPillarTile: ; fc645
  804. ; Read from struct at de:
  805. ; Destination (VRAM)
  806. ; Address of the first tile in the frame array
  807.  
  808. ld hl, [sp+0]
  809. ld b, h
  810. ld c, l
  811.  
  812. ld a, [TileAnimationTimer]
  813. and 7
  814.  
  815. ; Get frame index a
  816. ld hl, .frames
  817. add l
  818. ld l, a
  819. ld a, 0
  820. adc h
  821. ld h, a
  822. ld a, [hl]
  823.  
  824. ; Destination
  825. ld l, e
  826. ld h, d
  827. ld e, [hl]
  828. inc hl
  829. ld d, [hl]
  830. inc hl
  831.  
  832. ; Add the frame index to the starting address
  833. add [hl]
  834. inc hl
  835. ld h, [hl]
  836. ld l, a
  837. ld a, 0
  838. adc h
  839. ld h, a
  840.  
  841. ld sp, hl
  842. ld l, e
  843. ld h, d
  844. jr WriteTile
  845.  
  846. .frames
  847. db $00, $10, $20, $30, $40, $30, $20, $10
  848. ; fc673
  849.  
  850.  
  851. StandingTileFrame: ; fc673
  852. ld hl, TileAnimationTimer
  853. inc [hl]
  854. ret
  855. ; fc678
  856.  
  857.  
  858. AnimateWhirlpoolTile: ; fc678
  859. ; Update whirlpool tile using struct at de.
  860.  
  861. ; Struct:
  862. ; VRAM address
  863. ; Address of the first tile
  864.  
  865. ; Only does one of 4 tiles at a time.
  866.  
  867. ; Save sp in bc (see WriteTile).
  868. ld hl, [sp+0]
  869. ld b, h
  870. ld c, l
  871.  
  872. ; de = VRAM address
  873. ld l, e
  874. ld h, d
  875. ld e, [hl]
  876. inc hl
  877. ld d, [hl]
  878. inc hl
  879. ; Tile address is now at hl.
  880.  
  881. ; Get the tile for this frame.
  882. ld a, [TileAnimationTimer]
  883. and %11 ; 4 frames x2
  884. swap a ; * 16 bytes per tile
  885.  
  886. add [hl]
  887. inc hl
  888. ld h, [hl]
  889. ld l, a
  890. ld a, 0
  891. adc h
  892. ld h, a
  893.  
  894. ; Stack now points to the desired frame.
  895. ld sp, hl
  896.  
  897. ld l, e
  898. ld h, d
  899.  
  900. jr WriteTile
  901. ; fc696
  902.  
  903.  
  904. WriteTileFromBuffer: ; fc696
  905. ; Write tiledata at wTileAnimBuffer to de.
  906. ; wTileAnimBuffer is loaded to sp for WriteTile.
  907.  
  908. ld hl, [sp+0]
  909. ld b, h
  910. ld c, l
  911.  
  912. ld hl, wTileAnimBuffer
  913. ld sp, hl
  914.  
  915. ld h, d
  916. ld l, e
  917. jr WriteTile
  918. ; fc6a2
  919.  
  920.  
  921. WriteTileToBuffer: ; fc6a2
  922. ; Write tiledata de to wTileAnimBuffer.
  923. ; de is loaded to sp for WriteTile.
  924.  
  925. ld hl, [sp+0]
  926. ld b, h
  927. ld c, l
  928.  
  929. ld h, d
  930. ld l, e
  931. ld sp, hl
  932.  
  933. ld hl, wTileAnimBuffer
  934.  
  935. ; fallthrough
  936.  
  937. WriteTile: ; fc6ac
  938. ; Write one 8x8 tile ($10 bytes) from sp to hl.
  939.  
  940. ; Warning: sp is saved in bc so we can abuse pop.
  941. ; sp is restored to address bc. Save sp in bc before calling.
  942.  
  943. pop de
  944. ld [hl], e
  945. inc hl
  946. ld [hl], d
  947.  
  948. rept 7
  949. pop de
  950. inc hl
  951. ld [hl], e
  952. inc hl
  953. ld [hl], d
  954. endr
  955.  
  956. ; restore sp
  957. ld h, b
  958. ld l, c
  959. ld sp, hl
  960. ret
  961. ; fc6d7
  962.  
  963.  
  964. TileAnimationPalette: ; fc6d7
  965. ; Transition between color values 0-2 for color 0 in palette 3.
  966.  
  967. ; No palette changes on DMG.
  968. ld a, [hCGB]
  969. and a
  970. ret z
  971.  
  972. ; We don't want to mess with non-standard palettes.
  973. ld a, [rBGP] ; BGP
  974. cp %11100100
  975. ret nz
  976.  
  977. ; Only update on even frames.
  978. ld a, [TileAnimationTimer]
  979. ld l, a
  980. and 1 ; odd
  981. ret nz
  982.  
  983. ; Ready for BGPD input...
  984. ld a, %10011000 ; auto increment, index $18 (pal 3 color 0)
  985. ld [rBGPI], a
  986.  
  987. ld a, [rSVBK]
  988. push af
  989. ld a, 5 ; wra5: gfx
  990. ld [rSVBK], a
  991.  
  992. ; Update color 0 in order 0 1 2 1
  993.  
  994. ld a, l
  995. and %110 ; frames 0 2 4 6
  996.  
  997. jr z, .color0
  998.  
  999. cp 4
  1000. jr z, .color2
  1001.  
  1002. .color1
  1003. ld hl, UnknBGPals + $1a ; pal 3 color 1
  1004. ld a, [hli]
  1005. ld [rBGPD], a
  1006. ld a, [hli]
  1007. ld [rBGPD], a
  1008. jr .end
  1009.  
  1010. .color0
  1011. ld hl, UnknBGPals + $18 ; pal 3 color 0
  1012. ld a, [hli]
  1013. ld [rBGPD], a
  1014. ld a, [hli]
  1015. ld [rBGPD], a
  1016. jr .end
  1017.  
  1018. .color2
  1019. ld hl, UnknBGPals + $1c ; pal 3 color 2
  1020. ld a, [hli]
  1021. ld [rBGPD], a
  1022. ld a, [hli]
  1023. ld [rBGPD], a
  1024.  
  1025. .end
  1026. pop af
  1027. ld [rSVBK], a
  1028. ret
  1029. ; fc71e
  1030.  
  1031.  
  1032. FlickeringCaveEntrancePalette: ; fc71e
  1033. ; No palette changes on DMG.
  1034. ld a, [hCGB]
  1035. and a
  1036. ret z
  1037. ; We don't want to mess with non-standard palettes.
  1038. ld a, [rBGP]
  1039. cp %11100100
  1040. ret nz
  1041. ; We only want to be here if we're in a dark cave.
  1042. ld a, [wTimeOfDayPalset]
  1043. cp $ff ; 3,3,3,3
  1044. ret nz
  1045.  
  1046. ld a, [rSVBK]
  1047. push af
  1048. ld a, 5 ; wra5: gfx
  1049. ld [rSVBK], a
  1050. ; Ready for BGPD input...
  1051. ld a, %10100000 ; auto-increment, index $20 (pal 4 color 0)
  1052. ld [rBGPI], a
  1053. ld a, [hVBlankCounter]
  1054. and %00000010
  1055. jr nz, .bit1set
  1056. ld hl, UnknBGPals + $20 ; pal 4 color 0
  1057. jr .okay
  1058.  
  1059. .bit1set
  1060. ld hl, UnknBGPals + $22 ; pal 4 color 2
  1061.  
  1062. .okay
  1063. ld a, [hli]
  1064. ld [rBGPD], a
  1065. ld a, [hli]
  1066. ld [rBGPD], a
  1067.  
  1068. pop af
  1069. ld [rSVBK], a
  1070. ret
  1071. ; fc750
  1072.  
  1073.  
  1074. SproutPillarTilePointer1: dw VTiles2 tile $2d, SproutPillarTile1
  1075. SproutPillarTilePointer2: dw VTiles2 tile $2f, SproutPillarTile2
  1076. SproutPillarTilePointer3: dw VTiles2 tile $3d, SproutPillarTile3
  1077. SproutPillarTilePointer4: dw VTiles2 tile $3f, SproutPillarTile4
  1078. SproutPillarTilePointer5: dw VTiles2 tile $3c, SproutPillarTile5
  1079. SproutPillarTilePointer6: dw VTiles2 tile $2c, SproutPillarTile6
  1080. SproutPillarTilePointer7: dw VTiles2 tile $4d, SproutPillarTile7
  1081. SproutPillarTilePointer8: dw VTiles2 tile $4f, SproutPillarTile8
  1082. SproutPillarTilePointer9: dw VTiles2 tile $5d, SproutPillarTile9
  1083. SproutPillarTilePointer10: dw VTiles2 tile $5f, SproutPillarTile10
  1084.  
  1085. SproutPillarTile1: INCBIN "gfx/tilesets/sprout-pillar/1.2bpp"
  1086. SproutPillarTile2: INCBIN "gfx/tilesets/sprout-pillar/2.2bpp"
  1087. SproutPillarTile3: INCBIN "gfx/tilesets/sprout-pillar/3.2bpp"
  1088. SproutPillarTile4: INCBIN "gfx/tilesets/sprout-pillar/4.2bpp"
  1089. SproutPillarTile5: INCBIN "gfx/tilesets/sprout-pillar/5.2bpp"
  1090. SproutPillarTile6: INCBIN "gfx/tilesets/sprout-pillar/6.2bpp"
  1091. SproutPillarTile7: INCBIN "gfx/tilesets/sprout-pillar/7.2bpp"
  1092. SproutPillarTile8: INCBIN "gfx/tilesets/sprout-pillar/8.2bpp"
  1093. SproutPillarTile9: INCBIN "gfx/tilesets/sprout-pillar/9.2bpp"
  1094. SproutPillarTile10: INCBIN "gfx/tilesets/sprout-pillar/10.2bpp"
  1095. ; fca98
  1096.  
  1097.  
  1098. WhirlpoolFrames1: dw VTiles2 tile $32, WhirlpoolTiles1
  1099. WhirlpoolFrames2: dw VTiles2 tile $33, WhirlpoolTiles2
  1100. WhirlpoolFrames3: dw VTiles2 tile $42, WhirlpoolTiles3
  1101. WhirlpoolFrames4: dw VTiles2 tile $43, WhirlpoolTiles4
  1102. ; fcaa8
  1103.  
  1104. WhirlpoolTiles1: INCBIN "gfx/tilesets/whirlpool/1.2bpp"
  1105. WhirlpoolTiles2: INCBIN "gfx/tilesets/whirlpool/2.2bpp"
  1106. WhirlpoolTiles3: INCBIN "gfx/tilesets/whirlpool/3.2bpp"
  1107. WhirlpoolTiles4: INCBIN "gfx/tilesets/whirlpool/4.2bpp"
  1108. ; fcba8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement