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 ; load hl with flag
- ld b,(hl) ; load a with flags
- ld a,b ; save it in b for later.
- and %11111100 ; check for a Count of 0
- jr nz,NOTFRESH ; if not zero we are processing something move on
- ;B has flags hl points to flags
- ld a,(ix) ; load ix with count.
- add a,a
- add a,a ; chift to left
- or b ; merge with flags
- ld (hl),a ; save
- dec hl ; point hl to user
- ld a,(ix) ; load user into a
- and %01111111
- ld (hl),a ; not sure on value you here just plain overwrite
- NOTFRESH:
- LutHandlerStart:
- ; hl,-3
- ; %ccccccff c = Count F = flags
- ;The Flow
- ;first Decrement timer
- ;Check for z or c
- ;If Count = 2 move to next
- ;if Count = 1 move to follow player
- ;If count = HCF
- ;Else increment based on LUT parameters
- ;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
- and %00000011 ; clear count for later
- ld d,a ; save for later
- ld a,b ; restore
- and %11111100 ; clear for math
- rrca \ rrca ;div4 / move count to front of byte
- ld e,a ; save Count
- dec a ; shift dec
- add a,a \ add a,a ; shift back
- or d ; merge back
- ld (hl),a ; save back into flagsk with new values
- ld a,e ; Restore count
- cp 2 ; check values
- jp c,FollowP ; if 1 move to followP
- jr z,IncLut ; if 2 move to next position on lut
- 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
- and %11000000
- jr z,++_ ; if 0 skip it
- rlca \ rlca ; save incdec in %00000011
- 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
- ld (hl),0 ;zero so its a fresh init
- jp lutinit
- FollowP:
- ; this is a stub have to get player xy and bullet xy and call r.arctan. followed by moveang
- jp $
Advertisement
Add Comment
Please, Sign In to add comment