Geekboy

Untitled

Apr 9th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ========================
  2. ;Bullet move/collide routines and all shared routines that associates with it
  3. ; nostack
  4. ; count = 1 for start everythign else is 0
  5. ; this is so we load the first set of values into the table
  6. ; ld hl,-X  ; where X is offset 4 = user 1 = Y
  7. ; add hl,sp
  8. ; to make hl = entry on bullet table
  9. InitLut:
  10. ;Moves a bullet based on a LUT
  11. ;Pre read decriment start by checking counter accomplished by checking state of what it was before hand
  12. ; Counter of 1 means next LUT entry
  13. ; Count of 0 means return to player via arctan
  14.  ld ix,(pTemp1)    ; current LUT address. yay static adressing
  15.  ld hl,-4          ; ld hl with the start of the bullet table enntry
  16.  add hl,sp         ;
  17.  ld
  18.  ld a,(ix)
  19.  and %01111111     ; put angle into USER
  20.  ld (hl),a
  21.  inc hl            ; point hl to flags
  22.  ld a,(ix+1)       ;
  23.  add a,a           ;shifts over and clears the lower bits via magic
  24.  add a,a           ; curtosy of calc84maniac
  25.  ld b,a
  26.  ld a,(hl)         ; put flags in a
  27.  or b              ; merge into a
  28.  ld (hl),a         ; put back into flags
  29. LutHandlerStart:
  30. ;Flow
  31. ;Decrement timer
  32. ;Check for z or c
  33. ;If z move to next
  34. ;if c move to follow player
  35. ;else increment based on type
  36. ; assume nothing is loaded as we may jump back here. later.
  37.  ld hl,-3
  38.  add hl,sp
  39.  ld a,(hl)  ; ld a with flags
  40.  ld b,a save in b
  41.  rla \ rla
  42.  dec a             ; shift dec
  43.  add a.a \ add a,a ; shift back
  44.  or b
  45.  jr C,FollowPlayer
  46.  jr z,IncLut
  47.  ld (hl),a         ; save back into flags
  48. MoveBulletBasedOnLutAngle:
  49.  ;Increase the bullet based on the lut angle.
  50.  ; pre increment/saving executes with old
  51.  ; First load angle
  52.  ; Check for inc val
  53.  ; if val get mult and mult
  54.  ; save back and execute
  55.  dec hl      ; point hl to user
  56.  ld c,(hl)   ; put angle into C
  57.  ld a,(ix)
  58.  rlca \ rlca \ and %00000011
  59.  jr z,_
  60.  add a,a
  61.  inc hl      ; point hl to flags
  62.  bit 0,(hl)
  63.  jr z,_
  64.  add a,a
  65. _:
  66.  ld b,c
  67.  add a,c
  68.  dec hl
  69.  ld (hl),a
  70.  jp moveang    ;inputs may vary juggle for that later.
Advertisement
Add Comment
Please, Sign In to add comment