Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nanamiTest:
- ;1
- ; jp $
- ;Moves the bullet in the directoin given via an angle
- ; the angle is gotten from a lut and the lower bits of the counter are used for the lut table loc
- ; t = Ftttttt
- ; charweapondat holds the ttl for the angle
- ;E=Y D=X
- ;inc e \ inc d ;modify for collision routine
- ;ld ix,PBMoveANGcont ;return address for collision routine
- ;jp SmallBulletCollision ;IN: DE=XY,
- ;PBMoveANGcont:
- ; dec e \ dec d ;unmodify from collision routine
- ; jp $
- push de ;move the stack back for something...
- ld a,d
- ;********************************
- ;If you needed to modify the counter, you will need the following code.
- ;AND DON'T FORGET TO PRESERVE BIT 7 OF L SINCE THAT IS THE FOCUSED FLAG.
- dec sp \ pop hl ;ENTER CODE
- ; Lut pos is in L
- ld a,(charweapondat) ; load DTTTTTTT into a
- and %01111111 ; clear d
- cp 1
- jp z,INCLUT ; if lut is 1 move to the next item on it
- jp c,_ ; if the counter is at 0 go back to the player
- ; dec angle timer
- push hl \ inc sp
- dec a
- ld (charweapondat),a
- ld a,l ; put offset into a
- and %01111111 ; clear focus bit
- ld hl,nanamiLUT45 ; load hl with LUTptr
- inc a ; do this so we are looking at the second item at the pointer
- add a,l ; add l to a to make
- ld l,a ; LUT+ofs
- ld a,(hl) ; store the angle we get into a
- and %01111111
- add a,a
- jp moveang
- _:
- Follow_player: ; gets a angle via the arctan function and sends the attack torwards the player
- push hl \ inc sp ; move the stack back to proper positions as we
- ld hl,0 ; are moving it into temp storage
- add hl,sp
- ld sp,(itemp1) ; old stack value was stored here
- push hl ; we have a stack now lets use it
- ex af,af' ; needed this last time dont ask me why
- push af ; save the shadow aff for some bloody reason
- ld a,d
- and %00111111
- ld h,a
- ld a,e
- and %00111111
- ld l,a
- ld de,(chary) ; de = your pos
- srl e \ srl d
- srl e \ srl d
- ; ex de,hl
- call r.arctan ; returns angle in c and a
- ; we leave it there so we can restore the stack
- pop af
- ex af,af'
- pop hl
- ld sp,hl
- ld a,c ; put angle in a
- pop de
- push de ; restore xy
- jp moveang
- ; we can do my own shit now stack is inited and old one is saved
- _:
- ;jp $
- ld a,(charweapondat) ; load dttttttt into a
- and %10000000 ; preserve d
- inc a ; make t = 1
- ld (charweapondat),a ; save
- ld a,l
- and %10000000
- ld l,a
- push hl \ inc sp ; quit
- pop de ; ^
- jp PBTDestroy ; ...
- INCLUT: ; must inc lut value by 2
- ;ld b,a ; save Dttttttt into b
- ;jp $
- ld a,l ; load a with FLLLLLLL
- inc a \ inc a ; inc a twice we do not monitor F we should never have 127 entries
- Xor l ;
- and %01111111
- xor l ; merge bit 7 of L with bits 0-6 of a
- ld l,A
- push hl \ inc sp ; EXIT CODE for modifying the timer
- ld hl,nanamiLUT45 ; load hl with pointer to the lut
- and %01111111 ; and out F ===! this is new forgot this !===
- add a,l ; merge with lut addy to make pointer
- ld l,a ; ^
- ld b,(hl) ; load b with the angle count off hte lut
- ld a,(charweapondat) ; load a with charweapondat
- and %10000000 ; clear T
- add a,b ; merge
- ld (charweapondat),a ; save back
- pop de ; important shit
- jp nanamitest ; start over so we actually do something
- moveang:
- ;jp $
- ; assumes x,y are in on teh table in the form of ss.^^^^^^
- inc sp
- pop hl ;then advance SP so the bullet table handler can continue
- ;doubling the spread
- ld c,a
- ld b,$82 ;and now complete the address thinger. in BC
- rlc L \ rlc L ;From %ss.yyyyyy to %yyyyyy.ss
- ld a,(bc) ;Get %AAAaaaaa. Let's use upper 3 bits
- rlca \ rlca \ rlca ;Got %aaaaaAAA
- and %00000111
- bit 7,c
- jp z,_
- neg ;We had a positive number but we need movement in negative
- _:
- add a,L
- ;jp nc,PBTDestroy ;Bullet went past top. Destroy it.
- ;cp 240
- ;jp nc,PBTDestroy ; special case handling for top of screen shooting people
- ld L,a
- ld a,c
- add a,64
- ld c,a
- ld a,(bc) ;Getting X angle.
- rlca \ rlca \ rlca ;like above
- and %00000111
- ld b,a
- ld a,c
- and %11000000
- ld a,b
- ; *phew*. Almost looks like I know what I'm doing :P
- jp po,_
- neg
- _:
- rlc h \ rlc h ;rotate x to xxxxxx.ss
- add a,h ;add our value to the X pos
- ld h,a ; save back
- and %11111100 ; and for collision
- ;jp z,PBTDestroy
- rrc h \ rrc h ; rever
- rrc L \ rrc L
- push hl
- pop hl
- jp PBTMainMoveRet ;stack unavailable
Advertisement
Add Comment
Please, Sign In to add comment