Geekboy

Untitled

Feb 1st, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. nanamiTest:
  2. ;Moves the bullet in the directoin given via an angle
  3. ;Stored in the LSB of the counter
  4. ;Doing: F.ttt.aaaa, where F=focused(donotmod),t=time,a=angle
  5. ;E=Y D=X
  6.  inc e \ inc d           ;modify for collision routine
  7.  ld ix,PBMoveANGcont     ;return address for collision routine
  8.  jp SmallBulletCollision ;IN: DE=XY,
  9. PBMoveANGcont:
  10.  dec e \ dec d     ;unmodify from collision routine
  11.  push de           ;move the stack back for something...
  12. ;********************************
  13. ;If you needed to modify the counter, you will need the following code.
  14. ;AND DON'T FORGET TO PRESERVE BIT 7 OF L SINCE THAT IS THE FOCUSED FLAG.
  15.  dec sp \ pop hl   ;ENTER CODE
  16.  ld a,(gametimer1)
  17.  and 1   ;ticking the timer every other game cycle
  18.  ld a,L
  19.  jr z,_
  20.  and   %01110000
  21.  sub   %00010000
  22.  jr nz,_
  23.  push hl \ inc sp  ;EXIT CODE
  24.  pop de             ;back to the way it was...
  25.  jp PBTDestroy      ;and get rid of the bullet.
  26. _:
  27.  xor L
  28.  and %01110000
  29.  xor L
  30.  ld L,a
  31.  push hl \ inc sp   ;EXIT CODE
  32.  ld a,L
  33.  pop hl             ;then advance SP so the bullet table handler can continue
  34.  and %00001111
  35.  add a,a            ;doubling the spread
  36.  add a,192-16        ;get true angle spread
  37.  ld c,a
  38.  ld b,$82           ;and now complete the address thinger. in BC
  39.  rlc L \ rlc L      ;From %ss.yyyyyy to %yyyyyy.ss
  40.  ld a,(bc)          ;Get %AAAaaaaa. Let's use upper 3 bits
  41.  rlca \ rlca \ rlca ;Got %aaaaaAAA
  42.  and %00000111
  43.  neg                ;We had a positive number but we need movement in negative
  44.  add a,L
  45.  jp nc,PBTDestroy   ;Bullet went past top. Destroy it.
  46.  cp 240
  47.  jp nc,PBTDestroy    ; special case handling for top of screen shooting people
  48.  ld L,a
  49.  ld a,c
  50.  add a,64
  51.  ld c,a
  52.  ld a,(bc)          ;Getting X angle.
  53.  rlca \ rlca \ rlca ;like above
  54.  and %00000111
  55.  bit 7,c            ;zero-crossing?
  56.  jr z,_             ;jump if not negative.
  57.  neg
  58. _:
  59.  rlc h \ rlc h
  60.  add a,h
  61.  ld h,a
  62.  and %11111100
  63.  jp z,PBTDestroy
  64.  
  65.  rrc h \ rrc h
  66.  rrc L \ rrc L
  67.  push hl
  68.  pop hl
  69.  jp PBTMainMoveRet ;stack unavailable
Advertisement
Add Comment
Please, Sign In to add comment