Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;=============================================================================
- ;Bullet move/collide routines and all shared routines that associates with it
- ; nostack
- ; count = 1 for start everythign else is 0
- ; this is so we load the first set of values into the table
- ; ld hl,-X ; where X is offset 4 = user 1 = Y
- ; add hl,sp
- ; to make hl = entry on bullet table
- InitLut:
- ;Moves a bullet based on a LUT
- ;Pre read decriment start by checking counter accomplished by checking state of what it was before hand
- ; Counter of 2 means next LUT entry
- ; Count of 1 means return to player via arctan
- ; 0 means first run
- ld ix,(pTemp1)
- ld hl,-3
- add hl,sp
- ld a,(hl)
- and %11111100
- jr nz,NOTFRESH
- ld b,a
- ld a,(ix)
- add a,a \ add a,a
- add a,b
- ;wheni get back to this i need to reimplement below. so far its failing
- ld ix,(pTemp1) ; current LUT address. yay static adressing
- ld hl,-4 ; ld hl with the start of the bullet table enntry
- add hl,sp ;
- ld a,(ix)
- and %01111111 ; put angle into USER
- ld (hl),a
- inc hl ; point hl to flags
- ld a,(ix+1) ;
- add a,a ;shifts over and clears the lower bits via magic
- add a,a ; curtosy of calc84maniac
- ld b,a
- ld a,(hl) ; put flags in a
- or b ; merge into a
- ld (hl),a ; put back into flags
- NOTFRESH
- LutHandlerStart:
- ;Flow
- ;Decrement timer
- ;Check for z or c
- ;If z move to next
- ;if c move to follow player
- ;else increment based on type
- ; assume nothing is loaded as we may jump back here. later. can be removed if needed tho
- ld hl,-3
- add hl,sp
- ld a,(hl) ; ld a with flags
- ld b,a save in b
- rla \ rla
- dec a ; shift dec
- add a,a \ add a,a ; shift back
- or b
- jr C,FollowPlayer
- jr z,IncLut
- ld (hl),a ; save back into flags
- MoveBulletBasedOnLutAngle:
- ;Increase the bullet based on the lut angle.
- ; pre increment/saving executes with old
- ; First load angle
- ; Check for inc val
- ; if val get mult and mult
- ; save back and execute
- ld e,(hl) ; flags in E
- dec hl ; point hl to user
- ld c,(hl) ; put angle into C
- ld a,(ix) ; ld a with incdec
- rlca \ rlca \ and %00000011 ; save incdec in %00000011
- jr z,_ ; if its zero skip the crap
- add a,a ; mult by 2
- bit 0,E ; if set to mult by 4 mult by 4
- jr z,_ ; else skip it
- add a,a
- _:
- add a,c ; if its zero just add it anyway
- ld (hl),a ; save back
- jp moveang ;inputs may vary juggle for that later. for now assuming c
- IncLut:
- ld a,(pTemp1)
- inc a
- inc a
- ld (pTtemp1),a ; inc to next slot
- dec hl
- xor a
- ld (hl),a ;zero so its a fresh init
- jp lutinit
Advertisement
Add Comment
Please, Sign In to add comment