Geekboy

Untitled

Feb 2nd, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ;=============================================================================
  3. ;==========================Nanami's Attacks===================================
  4. NanamiP1U:
  5.  ; This attack sends a single shot out in a arch with the shape of
  6.  ;                _----_
  7.  ;               |      |
  8.  ;                \    /
  9.  ;                 \  /
  10.  ;                  \/
  11.  ;                   X
  12.  ; where X is nanami
  13.  ; it follows this path unless 2nd is released in which it takes the most linear path back to nanmi from its current
  14.  ; position
  15.  ;
  16.  ; This attack also starts the arc in a different direction based on which direction you were traveling last
  17.  ;
  18.  ; This has a look up table at Nanami45LUT that is aligned on the LUT page
  19.  ; This LUT contains the offsets from the firing position of nanami that makes it have this proper arc
  20.  ; by doing it this way its much faster and causes less of a headache.
  21.  ; When second is released we will be having the bullet come back to nanami this will be done with a arctan look up.
  22.  ; going to see if i cant get away with reusing some of iambians enimy routines here have to lookinto the track function
  23.  ; - 5 minutes later -
  24.  ; we can use the call r.arctan to get the angle and return it in C
  25.  ;
  26.  ; TTl of bullet.
  27.  ; i have no clue how to do this other than doing blatant collision detection with your self ask iambian
  28.  
  29.  ; LUT is organized as such
  30.  ; 2 bytes per pair
  31.  ; a pair consists of a counbt and a angle/2
  32.  ; so
  33.  ; .db 20,45
  34.  ; would move the bullet at a 90D angle for 20 game cycles
  35.  ; angle/2 is because we can not fit more than 127 different angles in the counter var i am using
  36.  ; char weapon dat serve a few purposes.
  37.  ; bit 7 is our left/right indicator
  38.  ; and the lower 7 bits are angle ttl
  39.  ; it set move left if reset move right
  40.  ld hl,charweapondat
  41.  ld a,(keyread)      ; preset charweapondat with keydata
  42.  bit 1,a             ; this is now how i want this to work but for testing it will work
  43.  jp z,_
  44.  set 0,(hl)
  45.  jp ++_
  46. _:
  47.  res 0,(hl)
  48. _:
  49.  ld a,(firedelay) ; load with keycheck
  50.  or a
  51.  ret z ; if still held quit
  52.  ld a,(pbtfreebullet) ; load a temp variable for incase we have been mashing second
  53.  cp 1
  54.  ret z            ; if your just being a button masher quit
  55.  
  56.  ld a,0           ; load up teh cannon sire
  57.  LD d,1           ; Account for wind
  58.  ld e,1           ; AIM
  59.  call pbtcreate2  ; FIRE!!!!! BLAM BANG BANG BOOM
  60.  
  61.  
  62.  
  63. NanamiP1F:
  64.  
  65. NanamiP2U:
  66.  ; This attack sends 2 orbs shot out in a arch with the shape of roughly
  67.  ;                 ____
  68.  ;              _--    --_
  69.  ;             |  _----_  |
  70.  ;             \ |      | /
  71.  ;              \ \    / /
  72.  ;               - \  / -
  73.  ;                \ \/ /
  74.  ;                   X
  75.  ; where X is nanami
  76.  ; they travel at 40 and 50D respectively
  77.  ; it follows this path unless 2nd is released in which it takes the most linear path back to nanmi from its current
  78.  ; position
  79.  ;
  80.  ; This attack also starts the arc in a different direction based on which direction you were traveling last
  81.  ;
  82.  ; This has a look up table at Nanami40LUT and Nanami50LUT that is aligned on the LUT page
  83.  ; This LUT contains the offsets from the firing position of nanami that makes it have this proper arc
  84.  ; by doing it this way its much faster and causes less of a headache.
  85.  ; When second is released we will be having the bullet come back to nanami this will be done with a arctan look up.
  86.  ; going to see if i cant get away with reusing some of iambians enimy routines here have to lookinto the track function
  87.  ; - 5 minutes later -
  88.  ; we can use the call r.arctan to get the angle and return it in C
  89.  ;
  90.  ; TTl of bullet.
  91.  ; i have no clue how to do this other than doing blatant collision detection with your self ask iambian
  92.  
  93. NanamiP2F:
  94.  ld hl,charweapondat
  95.  ld a,(keyread)      ; preset charweapondat with keydata
  96.  bit 1,a             ; this is now how i want this to work but for testing it will work
  97.  jp z,_
  98.  set 7,(hl)
  99.  jp ++_
  100. _:
  101.  res 7,(hl)
  102. _:
  103.  ld a,(firedelay) ; load with keycheck
  104.  or a
  105.  ret z ; if still held quit
  106.  ld a,(pbtfreebullet) ; load a temp variable for incase we have been mashing second
  107.  cp 1
  108.  ret z            ; if your just being a button masher quit
  109.  
  110.  ld a,0           ; load up teh cannon sire
  111.  LD d,1           ; Account for wind
  112.  ld e,1           ; AIM
  113.  call pbtcreate2  ; FIRE!!!!! BLAM BANG BANG BOOM
  114.  
  115.  
  116. nanamiTest:
  117. ;1
  118. ; jp $
  119. ;Moves the bullet in the directoin given via an angle
  120. ; the angle is gotten from a lut and the lower bits of the counter are used for the lut table loc
  121. ; t = Ftttttt
  122. ; charweapondat holds the ttl for the angle
  123. ;E=Y D=X
  124.  ;inc e \ inc d           ;modify for collision routine
  125.  ;ld ix,PBMoveANGcont     ;return address for collision routine
  126.  ;jp SmallBulletCollision ;IN: DE=XY,
  127. ;PBMoveANGcont:
  128. ; dec e \ dec d     ;unmodify from collision routine
  129.  push de           ;move the stack back for something...
  130. ;********************************
  131. ;If you needed to modify the counter, you will need the following code.
  132. ;AND DON'T FORGET TO PRESERVE BIT 7 OF L SINCE THAT IS THE FOCUSED FLAG.
  133.  dec sp \ pop hl   ;ENTER CODE
  134.  ; Lut pos is in L
  135.  ld a,(charweapondat)
  136.  and %01111111
  137.  cp 1
  138.  jp c,_            ; if the counter is at 0 we destroy the bullet
  139.  jp z,INCLUT       ; if lut is 1 move to the next item on it
  140.  
  141.  push hl \ inc sp
  142.  ld a,l            ; put offset into a
  143.  and %01111111     ; clear focus bit
  144.  ld hl,nanamiLUT45 ; load hl with LUTptr
  145.  inc a             ; do this so we are looking at the second item at the pointer
  146.  add a,l           ; add l to a to make
  147.  ld l,a            ; LUT+ofs
  148.  ld a,(hl)         ; store the angle we get into a
  149.  jp +_
  150. _:
  151.  push hl \ inc sp
  152.  pop de
  153.  jp PBTDestroy
  154. INCLUT:            ; must inc lut value by 2
  155.  ld b,a
  156.  ld a,l
  157.  inc a \ inc a
  158.  Xor l
  159.  and %01111111
  160.  xor l
  161.  ld l,A        
  162.  push hl \ inc sp  ;EXIT CODE
  163.  ld hl,nanamiLUT45
  164.  add a,l
  165.  ld l,a
  166.  ld b,(hl)
  167.  ld a,(charweapondat)
  168.  and %10000000
  169.  add a,b
  170.  ld (charweapondat),a
  171.  jp nanamitest
  172. _:
  173.  jp $
  174.  pop hl             ;then advance SP so the bullet table handler can continue
  175.  and %01111111
  176.  add a,a            ;doubling the spread
  177. ; add a,192-16        ;get true angle spread
  178.  ld c,a
  179.  ld b,$82           ;and now complete the address thinger. in BC
  180.  rlc L \ rlc L      ;From %ss.yyyyyy to %yyyyyy.ss
  181.  ld a,(bc)          ;Get %AAAaaaaa. Let's use upper 3 bits
  182.  rlca \ rlca \ rlca ;Got %aaaaaAAA
  183.  and %00000111
  184.  neg                ;We had a positive number but we need movement in negative
  185.  add a,L
  186.  jp nc,PBTDestroy   ;Bullet went past top. Destroy it.
  187.  cp 240
  188.  jp nc,PBTDestroy    ; special case handling for top of screen shooting people
  189.  ld L,a
  190.  ld a,c
  191.  add a,64
  192.  ld c,a
  193.  ld a,(bc)          ;Getting X angle.
  194.  rlca \ rlca \ rlca ;like above
  195.  and %00000111
  196.  bit 7,c            ;zero-crossing?
  197.  jr z,_             ;jump if not negative.
  198.  neg
  199. _:
  200.  rlc h \ rlc h
  201.  add a,h
  202.  ld h,a
  203.  and %11111100
  204.  jp z,PBTDestroy
  205.  
  206.  rrc h \ rrc h
  207.  rrc L \ rrc L
  208.  push hl
  209.  pop hl
  210.  jp PBTMainMoveRet ;stack unavailable
  211.  
  212. ;2
Advertisement
Add Comment
Please, Sign In to add comment