Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nanamiTest:
- ;Moves the bullet in the directoin given via an angle
- ;Stored in the LSB of the counter
- ;Doing: F.ttt.aaaa, where F=focused(donotmod),t=time,a=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
- push de ;move the stack back for something...
- ;********************************
- ;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
- ld a,(gametimer1)
- and 1 ;ticking the timer every other game cycle
- ld a,L
- jr z,_
- and %01110000
- sub %00010000
- jr nz,_
- push hl \ inc sp ;EXIT CODE
- pop de ;back to the way it was...
- jp PBTDestroy ;and get rid of the bullet.
- _:
- xor L
- and %01110000
- xor L
- ld L,a
- push hl \ inc sp ;EXIT CODE
- ld a,L
- pop hl ;then advance SP so the bullet table handler can continue
- and %00001111
- add a,a ;doubling the spread
- add a,192-16 ;get true angle 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
- 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
- bit 7,c ;zero-crossing?
- jr z,_ ;jump if not negative.
- neg
- _:
- rlc h \ rlc h
- add a,h
- ld h,a
- and %11111100
- jp z,PBTDestroy
- rrc h \ rrc h
- rrc L \ rrc L
- push hl
- pop hl
- jp PBTMainMoveRet ;stack unavailable
Advertisement
Add Comment
Please, Sign In to add comment