Geekboy

Untitled

Feb 5th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.67 KB | None | 0 0
  1. ;Player bullet handlers
  2. ;
  3. ;PBT located at $8D00
  4. ;First 64 bytes is PBT's FBT, all are filled with values indicating player
  5. ;bullet's LSB base location (multiples of 3 starting at $8D40
  6. ;Last 64*3 bytes is PBT's actual bullet data entries, described below, but
  7. ;is up to called routine's interpretation.
  8. ;
  9. ;FBT's location is in (pbtfreebullet). If bit 6 is ever set, then the FBT
  10. ;is full.
  11. ;
  12. ;Important note: Character's X and Y positions are not stored as normal. There
  13. ;are two bits of accuracy at the start so you're going to have to right-shift
  14. ;twice to get the actual X,Y positions.
  15. ;
  16. ;Y = YYYY YYSS , where S is subpixel data
  17. ;X = XXXX XXSS , where S is subpixel data
  18. ;
  19.  
  20. ;Player bullet structure (3 bytes)
  21. ;+0 : YTTTTTTT, T=Timer 0-127, Y=1 if focused shot
  22. ;+1 : Y position if applicable
  23. ;+2 : X position if applicable
  24.  
  25. ;The routine that is being called must be able to distinguish between
  26. ;unfocused and focused modes, since there won't be seperation at
  27. ;this stage of the routine call.
  28. ;
  29. ;Several things to edit.
  30. ;(1) PBTPlayerRoutineTables : How bullets are created. Below it are links.
  31. ;(2) PBTPlayerTypeTables : Types of bullets and how they move
  32. ;
  33. ;You can make creative use of the game timers to tell bullets apart
  34. ;(gametimer1) by creating only certain ones on certain slices of masked time.
  35. ;A good mask might be like %00000111 so you get 8 different time slices on
  36. ;each processing. Also pay attention to firing delays or you might not ever
  37. ;get a single bullet out.
  38. ;
  39. ;Other than that, good luck. You're gonna need it.
  40.  
  41.  
  42. #DEFINE PBTSHOT(xofs,yofs,count) call PBTCreate \ .db xofs,yofs,count
  43.  
  44.  
  45.  
  46. PlayerShoot:
  47. ld a,(characterID)
  48. add a,a
  49. ld e,a
  50. ld d,0
  51. ld hl,PBTPlayerRoutineTables
  52. add hl,de
  53. ld e,(hl)
  54. inc hl
  55. ld d,(hl)
  56. ld hl,charweapon1
  57. bit isfocused,(iy+danmakuflags)
  58. jr z,_
  59. inc hl
  60. inc de
  61. inc de ;if focused, charweapon2, and inc pointer to a focused standpoint
  62. _:
  63. ld a,(hl)
  64. add a,a
  65. add a,a ;x4 for weapon power thing
  66. ld L,a
  67. ld h,0
  68. add hl,de
  69. ld a,(hl)
  70. inc hl
  71. ld h,(hl)
  72. ld L,a
  73. jp (hl)
  74.  
  75. PBTMainDraw:
  76. xor a
  77. call PBTFillBulletDetails
  78. ld (itemp1),sp
  79. ld sp,$8D40
  80. ld a,64
  81. PBTMainDrawLoop:
  82. ex af,af'
  83. dec sp
  84. pop af
  85. pop de
  86. cp $FF
  87. jp z,PBTMainDrawRet
  88. ld hl,(itemp2) ;unfocused
  89. bit 7,a
  90. jr z,_
  91. ld hl,(itemp3) ;focused
  92. _:
  93. jp (hl) ;routine being jumped to MUST keep B intact
  94. PBTMainDrawRet:
  95. ex af,af'
  96. dec a
  97. jr nz,PBTMainDrawLoop
  98. ld sp,(itemp1)
  99. ret
  100.  
  101. PBTMainMove:
  102. ld a,4
  103. call PBTFillBulletDetails
  104. ld (itemp1),sp
  105. ld sp,$8D40
  106. ld a,64
  107. PBTMainMoveLoop:
  108. ex af,af'
  109. dec sp
  110. pop af ;A=tCCCCCCC, where t=type, C=counter
  111. pop de ;E=Ypos ; D=Xpos (no accuracy bits, negative values may be used)
  112. cp $FF
  113. jp z,PBTMainMoveRet
  114. ld hl,(itemp2) ;unfocused
  115. bit 7,a
  116. jr z,_
  117. ld hl,(itemp3) ;focused
  118. _:
  119. jp (hl) ;routine being jumped to MUST keep B intact
  120. PBTMainMoveRet:
  121. ex af,af'
  122. dec a
  123. jr nz,PBTMainMoveLoop
  124. ld sp,(itemp1)
  125. ret
  126. PBTNoCreate:
  127. pop hl
  128. inc hl
  129. inc hl
  130. inc hl
  131. jp (hl)
  132. PBTCreate: ;in: macro'd. Xofs,Yofs,Count
  133. ld hl,pbtfreebullet
  134. bit 6,(hl)
  135. jp nz,PBTNoCreate ;stop routine if over 64 bullets
  136. ld a,(hl) ;1.read
  137. inc (hl) ;2.increment
  138. ld L,a
  139. ld h,$8D
  140. ld L,(hl) ;got bullet position
  141. push hl
  142. pop ix
  143. ld de,(chary)
  144. srl e \ srl e ;y
  145. srl d \ srl d ;x
  146. pop hl
  147. ld a,d
  148. add a,(hl)
  149. inc hl
  150. ld (ix+2),a
  151. ld a,e
  152. add a,(hl)
  153. inc hl
  154. ld (ix+1),a
  155. ld a,(mdanmaku) ;isfocused == bit 1. Need to shift to bit 7.
  156. rrca
  157. rrca
  158. and $80
  159. or (hl) ;combining new counter with focused mask
  160. inc hl
  161. ld (ix+0),a
  162. jp (hl)
  163.  
  164. PBTCreate2: ;D=Xofs,E=Yofs,A=Count
  165. push af
  166. ld hl,pbtfreebullet
  167. bit 6,(hl)
  168. jr z,_ ;stop routine if over 64 bullets. Jump past if no stop.
  169. pop af
  170. ret
  171. _:
  172. ld a,(hl) ;1.read
  173. inc (hl) ;2.increment
  174. ld L,a
  175. ld h,$8D
  176. ld L,(hl) ;got bullet position
  177. push hl
  178. pop ix
  179. ld a,(charx)
  180. srl a \ srl a
  181. add a,d
  182. ld (ix+2),a
  183. ld a,(chary)
  184. srl a \ srl a
  185. add a,e
  186. ld (ix+1),a
  187. ld a,(mdanmaku)
  188. rrca
  189. rrca
  190. and $80
  191. pop bc
  192. or b ;combining masks for b7=focused, b0-b6=counter
  193. ld (ix+0),a
  194. ret
  195.  
  196.  
  197.  
  198. PBTDestroy: ;must be called in MOVE routine b4 SP is changed to save values
  199. ld hl,-3
  200. add hl,sp
  201. ld (hl),$FF
  202. ex de,hl
  203. ld hl,pbtfreebullet
  204. dec (hl) ;1.decrement
  205. ld L,(hl) ;2.write
  206. ld h,$8D
  207. ld (hl),e
  208. jp PBTMainMoveRet
  209.  
  210. PBTFillBulletDetails:
  211. ld c,a
  212. ld b,0 ;offset (0 if render cycle, 4 if move/collide cycle)
  213. ld a,(characterID)
  214. add a,a
  215. ld hl,PBTPlayerTypeTables
  216. add a,L
  217. ld L,a
  218. jr nc,$+3
  219. inc h
  220. ld e,(hl)
  221. inc hl
  222. ld d,(hl) ;got address to character's bullet table in DE
  223. ld a,(charweapon1) ;unfocused weapon type
  224. add a,a ;x2
  225. add a,a ;x4
  226. add a,a ;x8 ;weapon power type now available.
  227. add a,e
  228. ld L,a
  229. ld h,d
  230. jr nc,_
  231. inc h
  232. _:
  233. add hl,bc
  234. ld a,(hl)
  235. inc hl
  236. ld h,(hl)
  237. ld L,a
  238. ld (itemp2),hl ;unfocused weapon type in itemp2 variable
  239. ld a,(charweapon2) ;focused weapon type
  240. add a,a ;x2
  241. add a,a ;x4
  242. add a,a ;x8
  243. add a,2 ;+more offset for focused type
  244. add a,e
  245. ld L,a
  246. ld h,d
  247. jr nc,_
  248. inc h
  249. _:
  250. add hl,bc
  251. ld a,(hl)
  252. inc hl
  253. ld h,(hl)
  254. ld L,a
  255. ld (itemp3),hl ;focused weapon type in itemp3 variable
  256. ret
  257.  
  258. ;-----------------------------------------------------------------------------
  259. ;PLAYER BULLET CREATION TABLES
  260. ;
  261.  
  262.  
  263. PBTPlayerRoutineTables:
  264. .dw PBTPRT00 ;Devblock (ChID0) DO NOT CHANGE THESE ENTRIES
  265. .dw PBTPRT01 ;Iambian (ChID1)
  266. .dw PBTPRT02 ;Netham45 (ChID2)
  267. .dw PBTPRT03 ;??? (ChID3)
  268. .dw PBTPRT04 ;??? (ChID4)
  269. .dw PBTPRT05 ;??? (ChID5)
  270. .dw PBTPRT06 ;Netham45L (ChID6)
  271. .dw PBTPRT07 ;??? (ChID7)
  272.  
  273. PBTPRT00: ;Devblock (ChID0)
  274. .dw DevBlockUnfPwr1 ;direct links to the routines that is about to be used
  275. .dw DevBlockFocPwr1
  276. .dw DevBlockUnfPwr2 ;direct links to the routines that is about to be used
  277. .dw DevBlockFocPwr2
  278. PBTPRT01: ;Iambian (ChID1)
  279. .dw IambianClaw ; Unfocused attack pwr1
  280. .dw IambianFire ; Focused attack pwr1
  281. .dw IambianClaw ; pwr2
  282. .dw IambianFire ; pwr2
  283. PBTPRT02: ;Netham45 (ChID2)
  284. .dw TestRoutineUnFocPwr1
  285. .dw TestRoutineFocusPwr1
  286. .dw TestRoutineUnFocPwr2
  287. .dw TestRoutineFocusPwr2
  288. PBTPRT03: ;??? (ChID3)
  289. .dw TestRoutineUnFocPwr1
  290. .dw TestRoutineFocusPwr1
  291. .dw TestRoutineUnFocPwr2
  292. .dw TestRoutineFocusPwr2
  293. PBTPRT04: ;??? (ChID4)
  294. .dw TestRoutineUnFocPwr1
  295. .dw TestRoutineFocusPwr1
  296. .dw TestRoutineUnFocPwr2
  297. .dw TestRoutineFocusPwr2
  298. PBTPRT05: ;Nanami (ChID5)
  299. .dw NanamiP1U
  300. .dw NanamiP1F
  301. .dw NanamiP2U
  302. .dw NanamiP2F
  303. PBTPRT06: ;Netham45L (ChID6)
  304. .dw ShotHyperdrive
  305. .dw TestRoutineFocusPwr1
  306. .dw TestRoutineUnFocPwr2
  307. .dw TestRoutineFocusPwr2
  308. PBTPRT07: ;??? (ChID7)
  309. .dw TestRoutineUnFocPwr1
  310. .dw TestRoutineFocusPwr1
  311. .dw TestRoutineUnFocPwr2
  312. .dw TestRoutineFocusPwr2
  313.  
  314.  
  315. ;-----------------------------------------------------------------------------
  316. ;PLAYER BULLET RENDER/MOVE/COLLISION TABLES
  317. ;
  318.  
  319. PBTPlayerTypeTables:
  320. .dw PBTPTT00 ;Devblock (ChID0) DO NOT CHANGE THESE ENTRIES
  321. .dw PBTPTT01 ;Iambian (ChID1)
  322. .dw PBTPTT02 ;Netham45 (ChID2)
  323. .dw PBTPTT03 ;??? (ChID3)
  324. .dw PBTPTT04 ;??? (ChID4)
  325. .dw PBTPTT05 ;Nanami (ChID5)
  326. .dw PBTPTT06 ;Netham45L (ChID6)
  327. .dw PBTPTT07 ;??? (ChID7)
  328.  
  329. ;SO FAR EVERY ENTRY IN THIS TABLE IS DUMMY ENTRIES. FILL IN WITH ACTUAL
  330. ;DATA CONNECTED TO ASSEMBLY ROUTINES WHENEVER YOU ARE READY TO CODE THIS
  331. ;HORRIBLE MESS.
  332. PBTPTT00: ;Devblock (ChID0)
  333. .dw PBTShot00Draw ;-Unfocused shot power 1 render
  334. .dw PBTShot00Draw ;-Focused shot power 1 render
  335. .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
  336. .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
  337. .dw PBTShot00Draw ;-Unfocused shot power 2 render
  338. .dw PBTShot00Draw ;-Focused shot power 2 render
  339. .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
  340. .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
  341. PBTPTT01: ;Iambian (ChID1)
  342. .dw PBTShot01DrawIam ;-Unfocused shot power 1 render
  343. .dw PBTShot00DrawIam ;-Focused shot power 1 render
  344. .dw PBTCLAWMove ;-Unfocused shot power 1 move/collide/remove
  345. .dw PBMoveANG ;-Focused shot power 1 move/collide/remove
  346. .dw PBTShot01DrawIam ;-Unfocused shot power 2 render
  347. .dw PBTShot00DrawIam ;-Focused shot power 2 render
  348. .dw PBTCLAWMove ;-Unfocused shot power 2 move/collide/remove
  349. .dw PBMoveANG;-Focused shot power 2 move/collide/remove
  350. PBTPTT02: ;Netham45 (ChID2)
  351. .dw PBTShot00Draw ;-Unfocused shot power 1 render
  352. .dw PBTShot00Draw ;-Focused shot power 1 render
  353. .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
  354. .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
  355. .dw PBTShot00Draw ;-Unfocused shot power 2 render
  356. .dw PBTShot00Draw ;-Focused shot power 2 render
  357. .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
  358. .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
  359. PBTPTT03: ;??? (ChID3)
  360. .dw PBTShot00Draw ;-Unfocused shot power 1 render
  361. .dw PBTShot00Draw ;-Focused shot power 1 render
  362. .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
  363. .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
  364. .dw PBTShot00Draw ;-Unfocused shot power 2 render
  365. .dw PBTShot00Draw ;-Focused shot power 2 render
  366. .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
  367. .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
  368. PBTPTT04: ;??? (ChID4)
  369. .dw PBTShot00Draw ;-Unfocused shot power 1 render
  370. .dw PBTShot00Draw ;-Focused shot power 1 render
  371. .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
  372. .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
  373. .dw PBTShot00Draw ;-Unfocused shot power 2 render
  374. .dw PBTShot00Draw ;-Focused shot power 2 render
  375. .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
  376. .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
  377. PBTPTT05: ;Nanami (ChID5)PB00MoveCollide: ;dummy routine
  378. .dw PBTShot00Drawiam ;-Unfocused shot power 1 render
  379. .dw PBTShot00Drawiam ;-Focused shot power 1 render
  380. .dw nanamiTest ;-Unfocused shot power 1 move/collide/remove
  381. .dw nanamitest ;-Focused shot power 1 move/collide/remove
  382. .dw PBTShot00Drawiam ;-Unfocused shot power 2 render
  383. .dw PBTShot00Drawiam ;-Focused shot power 2 render
  384. .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
  385. .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
  386. PBTPTT06: ;Netham45L (ChID6)
  387. .dw PBTShot00Draw ;-Unfocused shot power 1 render
  388. .dw PBTShot00Draw ;-Focused shot power 1 render
  389. .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
  390. .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
  391. .dw PBTShot00Draw ;-Unfocused shot power 2 render
  392. .dw PBTShot00Draw ;-Focused shot power 2 render
  393. .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
  394. .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
  395. PBTPTT07: ;??? (ChID7)PB00Draw ;dummy routine
  396. .dw PBTShot00Draw ;-Unfocused shot power 1 render
  397. .dw PBTShot00Draw ;-Focused shot power 1 render
  398. .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
  399. .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
  400. .dw PBTShot00Draw ;-Unfocused shot power 2 render
  401. .dw PBTShot00Draw ;-Focused shot power 2 render
  402. .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
  403. .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
  404.  
  405. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  406. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  407. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  408. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  409.  
  410. ;=============================================================================
  411. ;CHARACTER FIRING CODE (what happens when you push the fire button)
  412. ;
  413.  
  414. DevBlockUnfPwr1: ;These routines pretty much all do the same thing
  415. TestRoutineUnFocPwr1:
  416. TestRoutineUnFocPwr2:
  417. DevBlockUnfPwr2:
  418. ;This routine fires a single centered shot on even cycles and
  419. ;two side shots on odd cycles, every other game cycle
  420. ld hl,firedelay
  421. dec (hl)
  422. ret nz
  423. ld (hl),2 ;FIRE DELAY FOR STANDARD SHOT IS TWO
  424. ld hl,charweapondat
  425. inc (hl)
  426. bit 0,(hl) ;check to see if even or odd. Using it to alternate bullet sets
  427. ld hl,(chary)
  428. jp z,_ ;jump to two side bullets thing
  429. PBTSHOT(3,-1,126) ;xofs,yofs,cnt. centered bullet
  430. ret
  431. _:
  432. PBTSHOT(0,-1,126) ;left side
  433. PBTSHOT(6,-1,126) ;right side
  434. ret
  435.  
  436. DevBlockFocPwr1: ;Again, these routines all pretty much do the same thing
  437. DevBlockFocPwr2:
  438. TestRoutineFocusPwr1:
  439. TestRoutineFocusPwr2:
  440. ;This routine fires two centered shots every game cycle
  441. ;
  442. ld hl,firedelay
  443. dec (hl)
  444. ret nz
  445. ld (hl),1 ;ONE GAME CYCLE. THIS CYCLING PROBABLY ISN'T NEEDED THO.
  446. PBTSHOT(2,-1,126) ;left center
  447. PBTSHOT(4,-1,126) ;right center
  448. ret
  449.  
  450.  
  451. ShotHyperdrive:
  452. PBTSHOT(3,-1,126)
  453. PBTSHOT(3,-1,126)
  454. PBTSHOT(3,-1,126)
  455. PBTSHOT(3,-1,126)
  456. PBTSHOT(3,-1,126)
  457. PBTSHOT(3,-1,126)
  458. PBTSHOT(3,-1,126)
  459. PBTSHOT(3,-1,126)
  460.  
  461. ret
  462.  
  463. ;==========================================================
  464. ;============Dragons attacks===============================
  465.  
  466. IambianClaw:
  467. ;Fires a 2 waves straight forward
  468. ;Pwr 2 attack fires 6 waves spaced out in a 15degree arc
  469. ld a,(firedelay) ;load a with fire delay
  470. ; 1 Good we can fire again
  471. ; 0 nope already shot a bullet wait till next keypress
  472. or a ;if z quit because we have already shot a bullet and not let go of the key
  473. ret z ; ^
  474. xor a ; zero a
  475. ld (firedelay),a ; and load it back into fire delay so that we do not shoot again
  476. ld a,(pbtfreebullet) ; load a with amount of bullets on the PBT
  477. cp 3 ; if greater than 3 QUIT
  478. ret nc ; ^
  479. ;PBTSHOT(xofs,yofs,count)
  480. ;PBTSHOT(1,1,126)
  481. ld a,120 ;load up teh cannon sire
  482. LD d,1 ; Account for wind
  483. ld e,1 ; AIM
  484. call pbtcreate2 ; FIRE!!!!! BLAM BANG BANG BOOM
  485.  
  486. ret ; Till the next fight good sir *tips hat*
  487.  
  488.  
  489. IambianFire:
  490.  
  491. ld hl,firedelay
  492. dec (hl)
  493. ret nz
  494. ld (hl),1 ;FIRE DELAY FOR STANDARD SHOT IS TWO
  495.  
  496. call FormatDragonFire
  497. and %01111110
  498. CALL PBTCREATE2
  499.  
  500. call FormatDragonFire
  501. and %01101111
  502. CALL PBTCREATE2
  503.  
  504. call FormatDragonFire
  505. and %01011111
  506. CALL PBTCREATE2
  507.  
  508. call FormatDragonFire
  509. and %01101111
  510. CALL PBTCREATE2
  511.  
  512.  
  513.  
  514. ret
  515.  
  516. FormatDragonFire:
  517. LD D,3
  518. LD E,-1
  519. ld hl,lfsrseed1
  520. ld a,(hl)
  521. rrca
  522. ld (hl),a
  523. jp nc,+_
  524. xor %00111000
  525. ld (hl),a
  526. _:
  527. set 6,a
  528. ret
  529. ;=======================end dragons attacks===================================
  530. ;=============================================================================
  531.  
  532.  
  533. ;=============================================================================
  534. ;==========================Nanami's Attacks===================================
  535. NanamiP1U:
  536. ; This attack sends a single shot out in a arch with the shape of
  537. ; _----_
  538. ; | |
  539. ; \ /
  540. ; \ /
  541. ; \/
  542. ; X
  543. ; where X is nanami
  544. ; it follows this path unless 2nd is released in which it takes the most linear path back to nanmi from its current
  545. ; position
  546. ;
  547. ; This attack also starts the arc in a different direction based on which direction you were traveling last
  548. ;
  549. ; This has a look up table at Nanami45LUT that is aligned on the LUT page
  550. ; This LUT contains the offsets from the firing position of nanami that makes it have this proper arc
  551. ; by doing it this way its much faster and causes less of a headache.
  552. ; When second is released we will be having the bullet come back to nanami this will be done with a arctan look up.
  553. ; going to see if i cant get away with reusing some of iambians enimy routines here have to lookinto the track function
  554. ; - 5 minutes later -
  555. ; we can use the call r.arctan to get the angle and return it in C
  556. ;
  557. ; TTl of bullet.
  558. ; i have no clue how to do this other than doing blatant collision detection with your self ask iambian
  559.  
  560. ; LUT is organized as such
  561. ; 2 bytes per pair
  562. ; a pair consists of a counbt and a angle/2
  563. ; so
  564. ; .db 20,45
  565. ; would move the bullet at a 90D angle for 20 game cycles
  566. ; angle/2 is because we can not fit more than 127 different angles in the counter var i am using
  567. ; char weapon dat serve a few purposes.
  568. ; bit 7 is our left/right indicator
  569. ; and the lower 7 bits are angle ttl
  570. ; it set move left if reset move right
  571. ; [22:50:17] <+Iambian> If we really want this thing to be like fukken amazing, I suggest a particle trail :)
  572. ; [22:50:32] <+Iambian> A particle trail made of bullets
  573. ; [22:50:32] <@geekbozu> or a rotating thing
  574. ; [;22:50:35] <@geekbozu> and done
  575. ; [22:50:36] <@geekbozu> totally done
  576. ; [22:50:49] <@geekbozu> have to think of how to do that tho...
  577. ; [22:50:52] <@geekbozu> eh not to hard
  578. ; [22:50:54] <+Iambian> Bullets that can so totally damage the enemy
  579. ; [22:51:25] <@geekbozu> uhm consequences of calling the pbtbullet create routien while in bullet movement code?
  580. ; [22:51:47] <+Iambian> Without preserving SP? Epic fail.
  581. ; [22:51:59] <@geekbozu> well yeah presering sp obviously
  582. ; [22:52:12] <@geekbozu> (same trick as used to call the sprite routien)
  583. ; [22:52:25] <+Iambian> Yeah, well that should work.
  584. ; [22:52:37] <+Iambian> For creating the trail...
  585. ; [22:52:43] * @geekbozu adds some comments to his noteblock
  586. ; [22:53:22] <@geekbozu> also i intend to just create bullets at semi random intervals with semi random velocities that are slower than the orb
  587. ; [22:53:26] <@geekbozu> and it should make a nice effect
  588. ; [22:53:37] <+Iambian> I suggest getting the current angle that the thing is heading in, negating that so it goes in the opposite direction, then adding an angle that is plus or minus some amount. Probably similar to how the dragonfire is done, except the revised full-range code should be used
  589. ; [22:53:55] <@geekbozu> yeah more or less what i am thinking
  590. ; [22:54:07] <@geekbozu> but thats at a later date
  591. ;; [22:54:13] * @geekbozu copies irc logs into npp
  592. ld hl,charweapondat
  593. ld a,(keyread) ; preset charweapondat with keydata
  594. bit 1,a ; this is now how i want this to work but for testing it will work
  595. jp z,_
  596. set 7,(hl)
  597. jp ++_
  598. _:
  599. res 7,(hl)
  600. _:
  601. ld a,(firedelay) ; load with keycheck
  602. or a
  603. ret z ; if still held quit
  604. ld a,(pbtfreebullet) ; load a temp variable for incase we have been mashing second
  605.  
  606. cp 1
  607. ret z ; if your just being a button masher quit
  608. set 0,(hl) ; make sure charweapon dat is at least 1
  609. ld a,0 ; load up teh cannon sire
  610. LD d,1 ; Account for wind
  611. ld e,1 ; AIM
  612. call pbtcreate2 ; FIRE!!!!! BLAM BANG BANG BOOM
  613.  
  614.  
  615.  
  616. NanamiP1F:
  617.  
  618. NanamiP2U:
  619. ; This attack sends 2 orbs shot out in a arch with the shape of roughly
  620. ; ____
  621. ; _-- --_
  622. ; | _----_ |
  623. ; \ | | /
  624. ; \ \ / /
  625. ; - \ / -
  626. ; \ \/ /
  627. ; X
  628. ; where X is nanami
  629. ; they travel at 40 and 50D respectively
  630. ; it follows this path unless 2nd is released in which it takes the most linear path back to nanmi from its current
  631. ; position
  632. ;
  633. ; This attack also starts the arc in a different direction based on which direction you were traveling last
  634. ;
  635. ; This has a look up table at Nanami40LUT and Nanami50LUT that is aligned on the LUT page
  636. ; This LUT contains the offsets from the firing position of nanami that makes it have this proper arc
  637. ; by doing it this way its much faster and causes less of a headache.
  638. ; When second is released we will be having the bullet come back to nanami this will be done with a arctan look up.
  639. ; going to see if i cant get away with reusing some of iambians enimy routines here have to lookinto the track function
  640. ; - 5 minutes later -
  641. ; we can use the call r.arctan to get the angle and return it in C
  642. ;
  643. ; TTl of bullet.
  644. ; i have no clue how to do this other than doing blatant collision detection with your self ask iambian
  645.  
  646. NanamiP2F:
  647. ;jp $
  648. ;ld hl,charweapondat ; load hl with direction pointer and angle counter
  649. ; ld a,(keyread) ; preset charweapondat with keydata
  650. ;bit 1,a ; this is not how i want this to work but for testing it will work
  651. ;jp z,_ ; if z set that way
  652. ;set 7,(hl) ; else this way
  653. ;jp Checkb
  654. ;_:
  655. ; res 7,(hl)
  656. ;Checkb:
  657. ld a,(firedelay) ; load with keycheck
  658. or a
  659. ret z ; if still held quit
  660. ld a,(pbtfreebullet) ; load a temp variable for incase we have been mashing second
  661. cp 1
  662. ret z ; if your just being a button masher quit
  663.  
  664. ld a,0 ; load up teh cannon sire
  665. LD d,5 ; Account for wind
  666. ld e,1 ; AIM
  667. call pbtcreate2 ; FIRE!!!!! BLAM BANG BANG BOOM
  668.  
  669.  
  670.  
  671. ;=============================================================================
  672. ;==========================End Nanami's Attacks===============================
  673. ;=============================================================================
  674.  
  675. ;=============================================================================
  676. ;BULLET RENDERING CODE (cycle 2)
  677. ;1
  678.  
  679. PBTShot00Draw: ;standard 2x3 bullet
  680. ;E=Y D=X normalized (00yy yyyy,00xx xxxx)
  681. ld c,d ;keeping a backup of C for later screen merriment :)
  682. ex de,hl ;HL=00xxxxxx 00yyyyyy
  683. sla h
  684. sla h ;HL=xxxxxx00 00yyyyyy
  685. xor a
  686. add hl,hl
  687. rla
  688. add hl,hl
  689. rla
  690. add hl,hl ;HL=xxx0000y yyyyy000 A=00000xxx (after next instruction)
  691. rla
  692. or L
  693. ld L,a
  694. ld a,h
  695. and %00000001
  696. or %10000000
  697. ld h,a ;HL=address get. 99ccs. Not the best but filters out bad coord
  698. ld a,c ;saved X
  699. ld b,7
  700. and b
  701. xor b ;checking to see if xxx=7 (straddling bullet)
  702. jr z,_ ;skip to special case bullets straddling the 8 bit boundary
  703. xor b
  704. add a,$20 ;bullet2x2 table, except we're drawing 2x3's
  705. ld d,$40
  706. ld e,a
  707. ld a,(de)
  708. ld c,a
  709. ld de,8
  710. ld a,(hl)
  711. or c
  712. ld (hl),a
  713. add hl,de
  714. ld a,(hl)
  715. or c
  716. ld (hl),a
  717. add hl,de
  718. ld a,(hl)
  719. or c
  720. ld (hl),a
  721. jp PBTMainDrawRet ;go back to main loop
  722. _:
  723. ld de,7
  724. set 0,(hl) \ inc hl \ set 7,(hl) \ add hl,de
  725. set 0,(hl) \ inc hl \ set 7,(hl) \ add hl,de
  726. set 0,(hl) \ inc hl \ set 7,(hl)
  727. jp PBTMainDrawRet
  728.  
  729. PBTShot00DrawIam: ;standard 2x3 bullet
  730. ;E=Y D=X normalized (00yy yyyy,00xx xxxx)
  731. ld c,d ;keeping a backup of C for later screen merriment :)
  732. ex de,hl ;HL=00xxxxxx 00yyyyyy
  733. ld a,h
  734. and %00111111
  735.  
  736. ld h,a
  737. ld a,l
  738. and %00111111
  739. ld l,a
  740. cp 63
  741. jp z,PBTMainDrawRet
  742. sla h
  743. sla h ;HL=xxxxxx00 00yyyyyy
  744. xor a
  745. add hl,hl
  746. rla
  747. add hl,hl
  748. rla
  749. add hl,hl ;HL=xxx0000y yyyyy000 A=00000xxx (after next instruction)
  750. rla
  751. or L
  752. ld L,a
  753. ld a,h
  754. and %00000001
  755. or %10000000
  756. ld h,a ;HL=address get. 99ccs. Not the best but filters out bad coord
  757. ld a,c ;saved X
  758. ld b,7
  759. and b
  760. xor b ;checking to see if xxx=7 (straddling bullet)
  761. jr z,_ ;skip to special case bullets straddling the 8 bit boundary
  762. xor b
  763. add a,$20 ;bullet2x2 table, except we're drawing 2x3's
  764. ld d,$40
  765. ld e,a
  766. ld a,(de)
  767. ld c,a
  768. ld de,8
  769. ld a,(hl)
  770. or c
  771. ld (hl),a
  772. add hl,de
  773. ld a,(hl)
  774. or c
  775. ld (hl),a
  776. add hl,de
  777. ld a,(hl)
  778. or c
  779. ld (hl),a
  780. jp PBTMainDrawRet ;go back to main loop
  781. _:
  782. ld a,c
  783. cp 63
  784. jp nc,PBTMainDrawREt
  785. ld de,7
  786. set 0,(hl) \ inc hl \ set 7,(hl) \ add hl,de
  787. set 0,(hl) \ inc hl \ set 7,(hl) \ add hl,de
  788. set 0,(hl) \ inc hl \ set 7,(hl)
  789. jp PBTMainDrawRet
  790.  
  791.  
  792. PBTShot01DrawIam:
  793. ;Draws a 8x16 arc
  794. ;fires on of 3 sprites based off of the angle in the counter
  795. ;E=Y D=X normalized (00yy yyyy,00xx xxxx)
  796. ;IX=spritelocation
  797. ; Is this a piercing attack? i dont think it is. ask teh dragon later
  798. ld hl,0
  799. add hl,sp ; save the current stack pointer into hl
  800. ld sp,(itemp1) ; restores the stack so we can use it
  801. push hl ; push it onto the stack for safe keeping
  802. ex af,af' ; exchange and save flags
  803. push af ; why i have no bloody clue
  804. ;ex af,af'
  805. ld a,d ; ld a with X
  806. add a,6 ; Increase a with 6 ; we do this so that the 8x16 sprite is over the center of
  807. ld d,a ; load it back into D ; the dragon not the far left
  808. push de ; save to stack
  809. sub 8 ; move it over so that the main point is at the top of the arc but we draw it from the side like
  810. ; the sprite is oriented
  811. ld d,a ; load the modified x back into a
  812. ld ix,WaveGfxDat ; load ix with sprite pointer...
  813. call DrawClippedSpriteGeneral ;do shit that is in teh lable
  814. pop de ; restore x and y (even though y is unmodified)
  815. ld ix,wavegfxdat+8 ; load ix with second half of wave sprite
  816. call drawclippedspritegeneral ;.. do i really need to spell this out for you
  817. ;ex af,af'
  818. pop af ;restore af
  819. ex af,af' ; ^
  820.  
  821. pop hl
  822. ld sp,hl ; restore previous stack
  823.  
  824. jp PBTMainDrawRet
  825. ;2
  826.  
  827. ;=============================================================================
  828. ;BULLET MOVEMENT/COLLISION CODE (cycle 5)
  829. ;1
  830.  
  831. PBTShot00Move: ;standard move by however manieth.
  832. ;E=Y D=X
  833. inc e \ inc d ;modify for collision routine
  834. ld ix,PBTShot00MoveCont ;return address for collision routine
  835. jp SmallBulletCollision ;IN: DE=XY,
  836. PBTShot00MoveCont:
  837. dec e \ dec d ;unmodify from collision routine
  838. ld a,-3 ;Move the Y direction up by 3 pixels
  839. add a,e ;
  840. bit 7,a ;
  841. jp nz,PBTDestroy ;But if it went above the top (carry), then kill the bullet
  842. ld e,a ;Else store the result back to E and wait for the push
  843. push de ;save result of movement
  844.  
  845.  
  846.  
  847. ;********************************
  848. ;If you needed to modify the counter, you will need the following code.
  849. ;AND DON'T FORGET TO PRESERVE BIT 7 OF L SINCE THAT IS THE FOCUSED FLAG.
  850. dec sp \ pop hl ;ENTER CODE
  851. DEC L
  852. ;cp 10
  853. jr nz,_
  854. push hl \ inc sp ;EXIT CODE
  855. pop de ;back to the way it was...
  856. jp PBTDestroy ;and get rid of the bullet.
  857. _:
  858. push hl \ inc sp ;EXIT CODE
  859. ;********************************
  860. pop de ;then advance SP so the bullet table handler can continue
  861. jp PBTMainMoveRet ;stack unavailable
  862.  
  863. PBTCLAWMove: ;standard move by however manieth.
  864. ;E=Y D=X
  865.  
  866. inc e \ inc d ;modify for collision routine
  867. ld ix,PBTShot00MoveCont2 ;return address for collision routine
  868. jp SmallBulletCollision ;IN: DE=XY,
  869. PBTShot00MoveCont2:
  870. dec e \ dec d ;unmodify from collision routine
  871. ld a,-3 ;Move the Y direction up by 3 pixels
  872. add a,e ;
  873. bit 7,a ;
  874. jp nz,PBTDestroy ;But if it went above the top (carry), then kill the bullet
  875. ld e,a ;Else store the result back to E and wait for the push
  876. push de ;save result of movement
  877. pop de
  878. jp pbtmainmoveret
  879. ;********************************
  880. ;If you needed to modify the counter, you will need the following code.
  881. ;AND DON'T FORGET TO PRESERVE BIT 7 OF L SINCE THAT IS THE FOCUSED FLAG.
  882. ;dec sp \ pop hl ;ENTER CODE
  883. ;DEC L
  884. ;;cp 10
  885. ;jr nz,_
  886. ;push hl \ inc sp ;EXIT CODE
  887. ;pop de ;back to the way it was...
  888. ;jp PBTDestroy ;and get rid of the bullet.
  889. ;_:
  890. ; push hl \ inc sp ;EXIT CODE
  891. ;********************************
  892. ; pop de ;then advance SP so the bullet table handler can continue
  893. ; jp PBTMainMoveRet ;stack unavailable
  894.  
  895. SmallBulletCollision: ;E=Y D=X (bullet)
  896. ld hl,$8E01 ;starting off with byte needed to see if anything is there
  897. ld bc,$0A08 ;ten enemies, using C as a constant for adjustments
  898. SmallBulletCollisionLoop:
  899. xor a
  900. cp (hl)
  901. jr z,SmallBulletCollisionSkip
  902. inc L
  903. inc L
  904. inc L ;position Y
  905. ld a,(hl)
  906. sub e ;bY-eY. 10-12. Carry means no collide
  907. jr nc,SmallBulletCollisionSkipY
  908. add a,c
  909. jr nc,SmallBulletCollisionSkipY
  910. inc L
  911. ld a,(hl) ;position X
  912. sub d ;same deal as above. Skipping comments.
  913. jr nc,SmallBulletCollisionSkipX
  914. add a,c ;
  915. jr nc,SmallBulletCollisionSkipX
  916. ;Collision happened. We may trash this bullet entry now via calling.
  917. ld c,1 ;BASE WEAPON POWER
  918. call DamageEnemy
  919. jp PBTDestroy
  920. SmallBulletCollisionSkip:
  921. ld a,20
  922. jp _
  923. SmallBulletCollisionSkipY:
  924. ld a,17
  925. jp _
  926. SmallBulletCollisionSkipX:
  927. ld a,16
  928. _:
  929. add a,L
  930. ld L,a
  931. djnz SmallBulletCollisionLoop
  932. SmallBulletCollisionBossCheck:
  933.  
  934. xor a
  935. cp (hl)
  936. jp z,SmallBulletCollideReturn
  937. inc L
  938. inc L
  939. inc L ;position Y
  940. ld a,(hl)
  941. sub e ;bY-eY. 10-12. Carry means no collide
  942. jp nc,SmallBulletCollideReturn
  943. add a,c ;(bY-eY)-8. (22-20)-8. Carry means CAN collide, else no collide
  944. jp nc,SmallBulletCollideReturn
  945. inc L
  946. ld a,(hl) ;position X
  947. sub d ;same deal as above. Skipping comments.
  948. jp nc,SmallBulletCollideReturn
  949. add a,c ;
  950. jp nc,SmallBulletCollideReturn
  951. ld c,1 ;BASE POWER
  952. call DamageBoss
  953. jp PBTDestroy
  954. SmallBulletCollideReturn;
  955. jp (ix)
  956. ;2
  957. PBMoveANG:
  958. ;1
  959. ;Moves the bullet in the directoin given via an angle
  960. ;Stored in the LSB of the counter
  961. ;Doing: F.ttt.aaaa, where F=focused(donotmod),t=time,a=angle
  962. ;E=Y D=X
  963. inc e \ inc d ;modify for collision routine
  964. ld ix,PBMoveANGcont ;return address for collision routine
  965. jp SmallBulletCollision ;IN: DE=XY,
  966. PBMoveANGcont:
  967. dec e \ dec d ;unmodify from collision routine
  968. push de ;move the stack back for something...
  969. ;********************************
  970. ;If you needed to modify the counter, you will need the following code.
  971. ;AND DON'T FORGET TO PRESERVE BIT 7 OF L SINCE THAT IS THE FOCUSED FLAG.
  972. dec sp \ pop hl ;ENTER CODE
  973. ld a,(gametimer1)
  974. and 1 ;ticking the timer every other game cycle
  975. ld a,L
  976. jr z,_
  977. and %01110000
  978. sub %00010000
  979. jr nz,_
  980. push hl \ inc sp ;EXIT CODE
  981. pop de ;back to the way it was...
  982. jp PBTDestroy ;and get rid of the bullet.
  983. _:
  984. xor L
  985. and %01110000
  986. xor L
  987. ld L,a
  988. push hl \ inc sp ;EXIT CODE
  989. ld a,L
  990. pop hl ;then advance SP so the bullet table handler can continue
  991. and %00001111
  992. add a,a ;doubling the spread
  993. add a,192-16 ;get true angle spread
  994. ld c,a
  995. ld b,$82 ;and now complete the address thinger. in BC
  996. rlc L \ rlc L ;From %ss.yyyyyy to %yyyyyy.ss
  997. ld a,(bc) ;Get %AAAaaaaa. Let's use upper 3 bits
  998. rlca \ rlca \ rlca ;Got %aaaaaAAA
  999. and %00000111
  1000. neg ;We had a positive number but we need movement in negative
  1001. add a,L
  1002. jp nc,PBTDestroy ;Bullet went past top. Destroy it.
  1003. cp 240
  1004. jp nc,PBTDestroy ; special case handling for top of screen shooting people
  1005. ld L,a
  1006. ld a,c
  1007. add a,64
  1008. ld c,a
  1009. ld a,(bc) ;Getting X angle.
  1010. rlca \ rlca \ rlca ;like above
  1011. and %00000111
  1012. bit 7,c ;zero-crossing?
  1013. jr z,_ ;jump if not negative.
  1014. neg
  1015. _:
  1016. rlc h \ rlc h
  1017. add a,h
  1018. ld h,a
  1019. and %11111100
  1020. jp z,PBTDestroy
  1021.  
  1022. rrc h \ rrc h
  1023. rrc L \ rrc L
  1024. push hl
  1025. pop hl
  1026. jp PBTMainMoveRet ;stack unavailable
  1027. ;2
  1028.  
  1029. nanamiTest:
  1030.  
  1031. ;1
  1032. ; jp $
  1033. ;Moves the bullet in the directoin given via an angle
  1034. ; the angle is gotten from a lut and the lower bits of the counter are used for the lut table loc
  1035. ; t = Ftttttt
  1036. ; charweapondat holds the ttl for the angle
  1037. ;E=Y D=X
  1038. ;inc e \ inc d ;modify for collision routine
  1039. ;ld ix,PBMoveANGcont ;return address for collision routine
  1040. ;jp SmallBulletCollision ;IN: DE=XY,
  1041. ;PBMoveANGcont:
  1042. ; dec e \ dec d ;unmodify from collision routine
  1043.  
  1044. ; jp $
  1045. push de ;move the stack back for something...
  1046. ;********************************
  1047. ;If you needed to modify the counter, you will need the following code.
  1048. ;AND DON'T FORGET TO PRESERVE BIT 7 OF L SINCE THAT IS THE FOCUSED FLAG.
  1049. dec sp \ pop hl ;ENTER CODE
  1050. ; Lut pos is in L
  1051. ld a,(charweapondat) ; load DTTTTTTT into a
  1052. and %01111111 ; clear d
  1053. cp 1
  1054. jp z,INCLUT ; if lut is 1 move to the next item on it
  1055. jp c,_ ; if the counter is at 0 go back to the player
  1056. ; dec angle timer
  1057. push hl \ inc sp
  1058. dec a
  1059. ld (charweapondat),a
  1060. ld a,l ; put offset into a
  1061. and %01111111 ; clear focus bit
  1062. ld hl,nanamiLUT45 ; load hl with LUTptr
  1063. inc a ; do this so we are looking at the second item at the pointer
  1064. add a,l ; add l to a to make
  1065. ld l,a ; LUT+ofs
  1066. ld a,(hl) ; store the angle we get into a
  1067. and %01111111
  1068. add a,a
  1069. jp moveang
  1070. _:
  1071. Follow_player: ; gets a angle via the arctan function and sends the attack torwards the player
  1072. push hl \ inc sp ; move the stack back to proper positions as we
  1073. ld hl,0 ; are moving it into temp storage
  1074. add hl,sp
  1075. ld sp,(itemp1) ; old stack value was stored here
  1076. push hl ; we have a stack now lets use it
  1077. ex af,af' ; needed this last time dont ask me why
  1078. push af ; save the shadow aff for some bloody reason
  1079. ld a,d
  1080. and %00111111
  1081. ld h,a
  1082. ld a,e
  1083. and %00111111
  1084. ld l,a
  1085. ld de,(chary) ; de = your pos
  1086. ;ex de,hl
  1087. call r.arctan ; returns angle in c and a
  1088. ld (curscore+1),a ; we leave it there so we can restore the stack
  1089. pop af
  1090. ex af,af'
  1091. pop hl
  1092. ld sp,hl
  1093.  
  1094. ld a,c ; put angle in a
  1095. ;add a,128
  1096. pop de
  1097. push de ; restore xy
  1098. jp moveang
  1099. ; we can do my own shit now stack is inited and old one is saved
  1100.  
  1101. _:
  1102. ;jp $
  1103. ld a,(charweapondat) ; load dttttttt into a
  1104. and %10000000 ; preserve d
  1105. inc a ; make t = 1
  1106. ld (charweapondat),a ; save
  1107. ld a,l
  1108. and %10000000
  1109. ld l,a
  1110. push hl \ inc sp ; quit
  1111. pop de ; ^
  1112. jp PBTDestroy ; ...
  1113. INCLUT: ; must inc lut value by 2
  1114. ;ld b,a ; save Dttttttt into b
  1115. ;jp $
  1116. ld a,l ; load a with FLLLLLLL
  1117. inc a \ inc a ; inc a twice we do not monitor F we should never have 127 entries
  1118. Xor l ;
  1119. and %01111111
  1120. xor l ; merge bit 7 of L with bits 0-6 of a
  1121. ld l,A
  1122. push hl \ inc sp ; EXIT CODE for modifying the timer
  1123. ld hl,nanamiLUT45 ; load hl with pointer to the lut
  1124. and %01111111 ; and out F ===! this is new forgot this !===
  1125. add a,l ; merge with lut addy to make pointer
  1126. ld l,a ; ^
  1127. ld b,(hl) ; load b with the angle count off hte lut
  1128. ld a,(charweapondat) ; load a with charweapondat
  1129. and %10000000 ; clear T
  1130. add a,b ; merge
  1131. ld (charweapondat),a ; save back
  1132. pop de ; important shit
  1133. jp nanamitest ; start over so we actually do something
  1134. moveang:
  1135. pop hl ;then advance SP so the bullet table handler can continue
  1136. ;doubling the spread
  1137.  
  1138. ld c,a
  1139. ld b,$82 ;and now complete the address thinger. in BC
  1140. rlc L \ rlc L ;From %ss.yyyyyy to %yyyyyy.ss
  1141. ld a,(bc) ;Get %AAAaaaaa. Let's use upper 3 bits
  1142. rlca \ rlca \ rlca ;Got %aaaaaAAA
  1143. and %00000111
  1144. bit 7,c
  1145. jp z,_
  1146. neg ;We had a positive number but we need movement in negative
  1147. _:
  1148. add a,L
  1149. ;jp nc,PBTDestroy ;Bullet went past top. Destroy it.
  1150. ;cp 240
  1151. ;jp nc,PBTDestroy ; special case handling for top of screen shooting people
  1152. ld L,a
  1153. ld a,c
  1154. add a,-64
  1155. ld c,a
  1156. ld a,(bc) ;Getting X angle.
  1157. rlca \ rlca \ rlca ;like above
  1158. and %00000111
  1159. ld b,a
  1160. ld a,c
  1161. and %11000000
  1162. ld a,b
  1163. ; *phew*. Almost looks like I know what I'm doing :P
  1164. jp pe,_
  1165. neg
  1166. _:
  1167. rlc h \ rlc h
  1168. add a,h
  1169. ld h,a
  1170. and %11111100
  1171. ;jp z,PBTDestroy
  1172.  
  1173. rrc h \ rrc h
  1174. rrc L \ rrc L
  1175. push hl
  1176. pop hl
  1177. jp PBTMainMoveRet ;stack unavailable
  1178.  
  1179. ;2
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186. Add100ToScore:
  1187. ld a,8
  1188. ld (scoretime),a ;resetting score timer
  1189. ld de,100
  1190. ld hl,(tempscore)
  1191. add hl,de
  1192. ld (tempscore),hl
  1193. ld e,0
  1194. ld hl,(tempscore+2)
  1195. adc hl,de
  1196. ld (tempscore+2),hl
  1197. ret
  1198.  
  1199. DamageBoss:
  1200. ld a,(charpower)
  1201. add a,c ;base power
  1202. ld hl,bossArmor
  1203. sub (hl)
  1204. jr nc,_
  1205. xor a ;cannot pierce that armor.
  1206. _:
  1207. ld c,a
  1208. ld b,0
  1209. ld hl,(bossHP)
  1210. sbc hl,bc
  1211. jr nc,_
  1212. ld hl,0 ;boss HP never go below 0. Check when script system is invoked
  1213. _:
  1214. ld (bossHP),hl
  1215. jp Add100ToScore
  1216.  
  1217. DamageEnemy:
  1218. inc L
  1219. ld a,(hl) ;enemyHP
  1220. or a
  1221. jp z,Add100ToScore ;skip trying to kill enemy. Enemy is invincible.
  1222. ld a,(charpower)
  1223. add a,c
  1224. ld c,a
  1225. ld a,(hl) ;curhp-dmg
  1226. sub c
  1227. ld (hl),a
  1228. jr z,$+4
  1229. jp nc,Add100ToScore ;enemy still alive. Don't destruct
  1230. ld a,-5
  1231. add a,L
  1232. ld L,a
  1233. xor a
  1234. ld (hl),a ;remove enemy. Might want to make a fancy explosion. Not now.
  1235. dec hl
  1236. dec a
  1237. ld (hl),a ;set primary counter to 0 (up to 8) for explosiony stuffs
  1238. jp Add100ToScore
  1239.  
  1240.  
  1241. WaveGfxDat:
  1242. .option bm_min_w = 8
  1243. #include "GfxDat\Attacks\Wave.bmp"
  1244.  
  1245.  
  1246.  
  1247. NanamiLUT45: ;$4030
  1248. .db 1,0 ; dummy entry to get the variables initialized
  1249. .db 20,32 ;4
  1250. .db 20,64 ;6
  1251. .db 20,98 ;8
  1252. .db 20,127
  1253. .db 00,00 ;12
Advertisement
Add Comment
Please, Sign In to add comment