Geekboy

Untitled

Apr 10th, 2013
95
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 2 means next LUT entry
  13. ; Count of 1 means return to player via arctan
  14. ; 0 means first run
  15.  ld ix,(pTemp1)
  16.  ld hl,-3
  17.  add hl,sp
  18.  ld a,(hl)
  19.  and %11111100
  20.  jr nz,NOTFRESH
  21.  ld b,a
  22.  ld a,(ix)
  23.  add a,a \ add a,a
  24.  add a,b
  25.  ;wheni get back to this i need to reimplement below. so far its failing
  26.  
  27.  ld ix,(pTemp1)    ; current LUT address. yay static adressing
  28.  ld hl,-4         ; ld hl with the start of the bullet table enntry
  29.  add hl,sp         ;
  30.  ld a,(ix)
  31.  and %01111111     ; put angle into USER
  32.  ld (hl),a
  33.  inc hl            ; point hl to flags
  34.  ld a,(ix+1)       ;
  35.  add a,a           ;shifts over and clears the lower bits via magic
  36.  add a,a           ; curtosy of calc84maniac
  37.  ld b,a
  38.  ld a,(hl)         ; put flags in a
  39.  or b              ; merge into a
  40.  ld (hl),a         ; put back into flags
  41. NOTFRESH
  42. LutHandlerStart:
  43. ;Flow
  44. ;Decrement timer
  45. ;Check for z or c
  46. ;If z move to next
  47. ;if c move to follow player
  48. ;else increment based on type
  49. ; assume nothing is loaded as we may jump back here. later. can be removed if needed tho
  50.   ld hl,-3
  51.   add hl,sp
  52.   ld a,(hl)  ; ld a with flags
  53.   ld b,a save in b
  54.   rla \ rla
  55.   dec a             ; shift dec
  56.   add a,a \ add a,a ; shift back
  57.   or b
  58.   jr C,FollowPlayer
  59.   jr z,IncLut
  60.   ld (hl),a         ; save back into flags
  61. MoveBulletBasedOnLutAngle:
  62.  ;Increase the bullet based on the lut angle.
  63.  ; pre increment/saving executes with old
  64.  ; First load angle
  65.  ; Check for inc val
  66.  ; if val get mult and mult
  67.  ; save back and execute
  68.   ld e,(hl)   ; flags in E
  69.  dec hl      ; point hl to user
  70.  ld c,(hl)   ; put angle into C
  71.  ld a,(ix)   ; ld a with incdec
  72.  rlca \ rlca \ and %00000011    ; save incdec in %00000011
  73.  jr z,_       ; if its zero skip the crap
  74.  add a,a        ; mult by 2
  75.  bit 0,E        ; if set to mult by 4 mult by 4
  76.  jr z,_         ; else skip it
  77.  add a,a
  78. _:
  79.  add a,c        ; if its zero just add it anyway
  80.  ld (hl),a      ; save back
  81.  jp moveang    ;inputs may vary juggle for that later. for now assuming c
  82.  
  83. IncLut:
  84.  ld a,(pTemp1)
  85.  inc a
  86.  inc a
  87.  ld (pTtemp1),a  ; inc to next slot
  88.  dec hl
  89.  xor a
  90.  ld (hl),a      ;zero so its a fresh init
  91.  jp lutinit
Advertisement
Add Comment
Please, Sign In to add comment