Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;=============================================================================
- ;==========================Nanami's Attacks===================================
- NanamiP1U:
- ; This attack sends a single shot out in a arch with the shape of
- ; _----_
- ; | |
- ; \ /
- ; \ /
- ; \/
- ; X
- ; where X is nanami
- ; it follows this path unless 2nd is released in which it takes the most linear path back to nanmi from its current
- ; position
- ;
- ; This attack also starts the arc in a different direction based on which direction you were traveling last
- ;
- ; This has a look up table at Nanami45LUT that is aligned on the LUT page
- ; This LUT contains the offsets from the firing position of nanami that makes it have this proper arc
- ; by doing it this way its much faster and causes less of a headache.
- ; When second is released we will be having the bullet come back to nanami this will be done with a arctan look up.
- ; going to see if i cant get away with reusing some of iambians enimy routines here have to lookinto the track function
- ; - 5 minutes later -
- ; we can use the call r.arctan to get the angle and return it in C
- ;
- ; TTl of bullet.
- ; i have no clue how to do this other than doing blatant collision detection with your self ask iambian
- ; LUT is organized as such
- ; 2 bytes per pair
- ; a pair consists of a counbt and a angle/2
- ; so
- ; .db 20,45
- ; would move the bullet at a 90D angle for 20 game cycles
- ; angle/2 is because we can not fit more than 127 different angles in the counter var i am using
- ; char weapon dat serve a few purposes.
- ; bit 7 is our left/right indicator
- ; and the lower 7 bits are angle ttl
- ; it set move left if reset move right
- ld hl,charweapondat
- ld a,(keyread) ; preset charweapondat with keydata
- bit 1,a ; this is now how i want this to work but for testing it will work
- jp z,_
- set 0,(hl)
- jp ++_
- _:
- res 0,(hl)
- _:
- ld a,(firedelay) ; load with keycheck
- or a
- ret z ; if still held quit
- ld a,(pbtfreebullet) ; load a temp variable for incase we have been mashing second
- cp 1
- ret z ; if your just being a button masher quit
- ld a,0 ; load up teh cannon sire
- LD d,1 ; Account for wind
- ld e,1 ; AIM
- call pbtcreate2 ; FIRE!!!!! BLAM BANG BANG BOOM
- NanamiP1F:
- NanamiP2U:
- ; This attack sends 2 orbs shot out in a arch with the shape of roughly
- ; ____
- ; _-- --_
- ; | _----_ |
- ; \ | | /
- ; \ \ / /
- ; - \ / -
- ; \ \/ /
- ; X
- ; where X is nanami
- ; they travel at 40 and 50D respectively
- ; it follows this path unless 2nd is released in which it takes the most linear path back to nanmi from its current
- ; position
- ;
- ; This attack also starts the arc in a different direction based on which direction you were traveling last
- ;
- ; This has a look up table at Nanami40LUT and Nanami50LUT that is aligned on the LUT page
- ; This LUT contains the offsets from the firing position of nanami that makes it have this proper arc
- ; by doing it this way its much faster and causes less of a headache.
- ; When second is released we will be having the bullet come back to nanami this will be done with a arctan look up.
- ; going to see if i cant get away with reusing some of iambians enimy routines here have to lookinto the track function
- ; - 5 minutes later -
- ; we can use the call r.arctan to get the angle and return it in C
- ;
- ; TTl of bullet.
- ; i have no clue how to do this other than doing blatant collision detection with your self ask iambian
- NanamiP2F:
- ld hl,charweapondat
- ld a,(keyread) ; preset charweapondat with keydata
- bit 1,a ; this is now how i want this to work but for testing it will work
- jp z,_
- set 7,(hl)
- jp ++_
- _:
- res 7,(hl)
- _:
- ld a,(firedelay) ; load with keycheck
- or a
- ret z ; if still held quit
- ld a,(pbtfreebullet) ; load a temp variable for incase we have been mashing second
- cp 1
- ret z ; if your just being a button masher quit
- ld a,0 ; load up teh cannon sire
- LD d,1 ; Account for wind
- ld e,1 ; AIM
- call pbtcreate2 ; FIRE!!!!! BLAM BANG BANG BOOM
- 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
- 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
- ; Lut pos is in L
- ld a,(charweapondat)
- and %01111111
- cp 1
- jp c,_ ; if the counter is at 0 we destroy the bullet
- jp z,INCLUT ; if lut is 1 move to the next item on it
- push hl \ inc sp
- 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
- jp +_
- _:
- push hl \ inc sp
- pop de
- jp PBTDestroy
- INCLUT: ; must inc lut value by 2
- ld b,a
- ld a,l
- inc a \ inc a
- Xor l
- and %01111111
- xor l
- ld l,A
- push hl \ inc sp ;EXIT CODE
- ld hl,nanamiLUT45
- add a,l
- ld l,a
- ld b,(hl)
- ld a,(charweapondat)
- and %10000000
- add a,b
- ld (charweapondat),a
- jp nanamitest
- _:
- jp $
- pop hl ;then advance SP so the bullet table handler can continue
- and %01111111
- 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
- ;2
Advertisement
Add Comment
Please, Sign In to add comment