Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Player bullet handlers
- ;
- ;PBT located at $8D00
- ;First 64 bytes is PBT's FBT, all are filled with values indicating player
- ;bullet's LSB base location (multiples of 3 starting at $8D40
- ;Last 64*3 bytes is PBT's actual bullet data entries, described below, but
- ;is up to called routine's interpretation.
- ;
- ;FBT's location is in (pbtfreebullet). If bit 6 is ever set, then the FBT
- ;is full.
- ;
- ;Important note: Character's X and Y positions are not stored as normal. There
- ;are two bits of accuracy at the start so you're going to have to right-shift
- ;twice to get the actual X,Y positions.
- ;
- ;Y = YYYY YYSS , where S is subpixel data
- ;X = XXXX XXSS , where S is subpixel data
- ;
- ;Player bullet structure (3 bytes)
- ;+0 : YTTTTTTT, T=Timer 0-127, Y=1 if focused shot
- ;+1 : Y position if applicable
- ;+2 : X position if applicable
- ;The routine that is being called must be able to distinguish between
- ;unfocused and focused modes, since there won't be seperation at
- ;this stage of the routine call.
- ;
- ;Several things to edit.
- ;(1) PBTPlayerRoutineTables : How bullets are created. Below it are links.
- ;(2) PBTPlayerTypeTables : Types of bullets and how they move
- ;
- ;You can make creative use of the game timers to tell bullets apart
- ;(gametimer1) by creating only certain ones on certain slices of masked time.
- ;A good mask might be like %00000111 so you get 8 different time slices on
- ;each processing. Also pay attention to firing delays or you might not ever
- ;get a single bullet out.
- ;
- ;Other than that, good luck. You're gonna need it.
- #DEFINE PBTSHOT(xofs,yofs,count) call PBTCreate \ .db xofs,yofs,count
- PlayerShoot:
- ld a,(characterID)
- add a,a
- ld e,a
- ld d,0
- ld hl,PBTPlayerRoutineTables
- add hl,de
- ld e,(hl)
- inc hl
- ld d,(hl)
- ld hl,charweapon1
- bit isfocused,(iy+danmakuflags)
- jr z,_
- inc hl
- inc de
- inc de ;if focused, charweapon2, and inc pointer to a focused standpoint
- _:
- ld a,(hl)
- add a,a
- add a,a ;x4 for weapon power thing
- ld L,a
- ld h,0
- add hl,de
- ld a,(hl)
- inc hl
- ld h,(hl)
- ld L,a
- jp (hl)
- PBTMainDraw:
- xor a
- call PBTFillBulletDetails
- ld (itemp1),sp
- ld sp,$8D40
- ld a,64
- PBTMainDrawLoop:
- ex af,af'
- dec sp
- pop af
- pop de
- cp $FF
- jp z,PBTMainDrawRet
- ld hl,(itemp2) ;unfocused
- bit 7,a
- jr z,_
- ld hl,(itemp3) ;focused
- _:
- jp (hl) ;routine being jumped to MUST keep B intact
- PBTMainDrawRet:
- ex af,af'
- dec a
- jr nz,PBTMainDrawLoop
- ld sp,(itemp1)
- ret
- PBTMainMove:
- ld a,4
- call PBTFillBulletDetails
- ld (itemp1),sp
- ld sp,$8D40
- ld a,64
- PBTMainMoveLoop:
- ex af,af'
- dec sp
- pop af ;A=tCCCCCCC, where t=type, C=counter
- pop de ;E=Ypos ; D=Xpos (no accuracy bits, negative values may be used)
- cp $FF
- jp z,PBTMainMoveRet
- ld hl,(itemp2) ;unfocused
- bit 7,a
- jr z,_
- ld hl,(itemp3) ;focused
- _:
- jp (hl) ;routine being jumped to MUST keep B intact
- PBTMainMoveRet:
- ex af,af'
- dec a
- jr nz,PBTMainMoveLoop
- ld sp,(itemp1)
- ret
- PBTNoCreate:
- pop hl
- inc hl
- inc hl
- inc hl
- jp (hl)
- PBTCreate: ;in: macro'd. Xofs,Yofs,Count
- ld hl,pbtfreebullet
- bit 6,(hl)
- jp nz,PBTNoCreate ;stop routine if over 64 bullets
- ld a,(hl) ;1.read
- inc (hl) ;2.increment
- ld L,a
- ld h,$8D
- ld L,(hl) ;got bullet position
- push hl
- pop ix
- ld de,(chary)
- srl e \ srl e ;y
- srl d \ srl d ;x
- pop hl
- ld a,d
- add a,(hl)
- inc hl
- ld (ix+2),a
- ld a,e
- add a,(hl)
- inc hl
- ld (ix+1),a
- ld a,(mdanmaku) ;isfocused == bit 1. Need to shift to bit 7.
- rrca
- rrca
- and $80
- or (hl) ;combining new counter with focused mask
- inc hl
- ld (ix+0),a
- jp (hl)
- PBTCreate2: ;D=Xofs,E=Yofs,A=Count
- push af
- ld hl,pbtfreebullet
- bit 6,(hl)
- jr z,_ ;stop routine if over 64 bullets. Jump past if no stop.
- pop af
- ret
- _:
- ld a,(hl) ;1.read
- inc (hl) ;2.increment
- ld L,a
- ld h,$8D
- ld L,(hl) ;got bullet position
- push hl
- pop ix
- ld a,(charx)
- srl a \ srl a
- add a,d
- ld (ix+2),a
- ld a,(chary)
- srl a \ srl a
- add a,e
- ld (ix+1),a
- ld a,(mdanmaku)
- rrca
- rrca
- and $80
- pop bc
- or b ;combining masks for b7=focused, b0-b6=counter
- ld (ix+0),a
- ret
- PBTDestroy: ;must be called in MOVE routine b4 SP is changed to save values
- ld hl,-3
- add hl,sp
- ld (hl),$FF
- ex de,hl
- ld hl,pbtfreebullet
- dec (hl) ;1.decrement
- ld L,(hl) ;2.write
- ld h,$8D
- ld (hl),e
- jp PBTMainMoveRet
- PBTFillBulletDetails:
- ld c,a
- ld b,0 ;offset (0 if render cycle, 4 if move/collide cycle)
- ld a,(characterID)
- add a,a
- ld hl,PBTPlayerTypeTables
- add a,L
- ld L,a
- jr nc,$+3
- inc h
- ld e,(hl)
- inc hl
- ld d,(hl) ;got address to character's bullet table in DE
- ld a,(charweapon1) ;unfocused weapon type
- add a,a ;x2
- add a,a ;x4
- add a,a ;x8 ;weapon power type now available.
- add a,e
- ld L,a
- ld h,d
- jr nc,_
- inc h
- _:
- add hl,bc
- ld a,(hl)
- inc hl
- ld h,(hl)
- ld L,a
- ld (itemp2),hl ;unfocused weapon type in itemp2 variable
- ld a,(charweapon2) ;focused weapon type
- add a,a ;x2
- add a,a ;x4
- add a,a ;x8
- add a,2 ;+more offset for focused type
- add a,e
- ld L,a
- ld h,d
- jr nc,_
- inc h
- _:
- add hl,bc
- ld a,(hl)
- inc hl
- ld h,(hl)
- ld L,a
- ld (itemp3),hl ;focused weapon type in itemp3 variable
- ret
- ;-----------------------------------------------------------------------------
- ;PLAYER BULLET CREATION TABLES
- ;
- PBTPlayerRoutineTables:
- .dw PBTPRT00 ;Devblock (ChID0) DO NOT CHANGE THESE ENTRIES
- .dw PBTPRT01 ;Iambian (ChID1)
- .dw PBTPRT02 ;Netham45 (ChID2)
- .dw PBTPRT03 ;??? (ChID3)
- .dw PBTPRT04 ;??? (ChID4)
- .dw PBTPRT05 ;??? (ChID5)
- .dw PBTPRT06 ;Netham45L (ChID6)
- .dw PBTPRT07 ;??? (ChID7)
- PBTPRT00: ;Devblock (ChID0)
- .dw DevBlockUnfPwr1 ;direct links to the routines that is about to be used
- .dw DevBlockFocPwr1
- .dw DevBlockUnfPwr2 ;direct links to the routines that is about to be used
- .dw DevBlockFocPwr2
- PBTPRT01: ;Iambian (ChID1)
- .dw IambianClaw ; Unfocused attack pwr1
- .dw IambianFire ; Focused attack pwr1
- .dw IambianClaw ; pwr2
- .dw IambianFire ; pwr2
- PBTPRT02: ;Netham45 (ChID2)
- .dw TestRoutineUnFocPwr1
- .dw TestRoutineFocusPwr1
- .dw TestRoutineUnFocPwr2
- .dw TestRoutineFocusPwr2
- PBTPRT03: ;??? (ChID3)
- .dw TestRoutineUnFocPwr1
- .dw TestRoutineFocusPwr1
- .dw TestRoutineUnFocPwr2
- .dw TestRoutineFocusPwr2
- PBTPRT04: ;??? (ChID4)
- .dw TestRoutineUnFocPwr1
- .dw TestRoutineFocusPwr1
- .dw TestRoutineUnFocPwr2
- .dw TestRoutineFocusPwr2
- PBTPRT05: ;Nanami (ChID5)
- .dw NanamiP1U
- .dw NanamiP1F
- .dw NanamiP2U
- .dw NanamiP2F
- PBTPRT06: ;Netham45L (ChID6)
- .dw ShotHyperdrive
- .dw TestRoutineFocusPwr1
- .dw TestRoutineUnFocPwr2
- .dw TestRoutineFocusPwr2
- PBTPRT07: ;??? (ChID7)
- .dw TestRoutineUnFocPwr1
- .dw TestRoutineFocusPwr1
- .dw TestRoutineUnFocPwr2
- .dw TestRoutineFocusPwr2
- ;-----------------------------------------------------------------------------
- ;PLAYER BULLET RENDER/MOVE/COLLISION TABLES
- ;
- PBTPlayerTypeTables:
- .dw PBTPTT00 ;Devblock (ChID0) DO NOT CHANGE THESE ENTRIES
- .dw PBTPTT01 ;Iambian (ChID1)
- .dw PBTPTT02 ;Netham45 (ChID2)
- .dw PBTPTT03 ;??? (ChID3)
- .dw PBTPTT04 ;??? (ChID4)
- .dw PBTPTT05 ;Nanami (ChID5)
- .dw PBTPTT06 ;Netham45L (ChID6)
- .dw PBTPTT07 ;??? (ChID7)
- ;SO FAR EVERY ENTRY IN THIS TABLE IS DUMMY ENTRIES. FILL IN WITH ACTUAL
- ;DATA CONNECTED TO ASSEMBLY ROUTINES WHENEVER YOU ARE READY TO CODE THIS
- ;HORRIBLE MESS.
- PBTPTT00: ;Devblock (ChID0)
- .dw PBTShot00Draw ;-Unfocused shot power 1 render
- .dw PBTShot00Draw ;-Focused shot power 1 render
- .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
- .dw PBTShot00Draw ;-Unfocused shot power 2 render
- .dw PBTShot00Draw ;-Focused shot power 2 render
- .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
- PBTPTT01: ;Iambian (ChID1)
- .dw PBTShot01DrawIam ;-Unfocused shot power 1 render
- .dw PBTShot00DrawIam ;-Focused shot power 1 render
- .dw PBTCLAWMove ;-Unfocused shot power 1 move/collide/remove
- .dw PBMoveANG ;-Focused shot power 1 move/collide/remove
- .dw PBTShot01DrawIam ;-Unfocused shot power 2 render
- .dw PBTShot00DrawIam ;-Focused shot power 2 render
- .dw PBTCLAWMove ;-Unfocused shot power 2 move/collide/remove
- .dw PBMoveANG;-Focused shot power 2 move/collide/remove
- PBTPTT02: ;Netham45 (ChID2)
- .dw PBTShot00Draw ;-Unfocused shot power 1 render
- .dw PBTShot00Draw ;-Focused shot power 1 render
- .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
- .dw PBTShot00Draw ;-Unfocused shot power 2 render
- .dw PBTShot00Draw ;-Focused shot power 2 render
- .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
- PBTPTT03: ;??? (ChID3)
- .dw PBTShot00Draw ;-Unfocused shot power 1 render
- .dw PBTShot00Draw ;-Focused shot power 1 render
- .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
- .dw PBTShot00Draw ;-Unfocused shot power 2 render
- .dw PBTShot00Draw ;-Focused shot power 2 render
- .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
- PBTPTT04: ;??? (ChID4)
- .dw PBTShot00Draw ;-Unfocused shot power 1 render
- .dw PBTShot00Draw ;-Focused shot power 1 render
- .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
- .dw PBTShot00Draw ;-Unfocused shot power 2 render
- .dw PBTShot00Draw ;-Focused shot power 2 render
- .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
- PBTPTT05: ;Nanami (ChID5)PB00MoveCollide: ;dummy routine
- .dw PBTShot00Drawiam ;-Unfocused shot power 1 render
- .dw PBTShot00Drawiam ;-Focused shot power 1 render
- .dw nanamiTest ;-Unfocused shot power 1 move/collide/remove
- .dw nanamitest ;-Focused shot power 1 move/collide/remove
- .dw PBTShot00Drawiam ;-Unfocused shot power 2 render
- .dw PBTShot00Drawiam ;-Focused shot power 2 render
- .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
- PBTPTT06: ;Netham45L (ChID6)
- .dw PBTShot00Draw ;-Unfocused shot power 1 render
- .dw PBTShot00Draw ;-Focused shot power 1 render
- .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
- .dw PBTShot00Draw ;-Unfocused shot power 2 render
- .dw PBTShot00Draw ;-Focused shot power 2 render
- .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
- PBTPTT07: ;??? (ChID7)PB00Draw ;dummy routine
- .dw PBTShot00Draw ;-Unfocused shot power 1 render
- .dw PBTShot00Draw ;-Focused shot power 1 render
- .dw PBTShot00Move ;-Unfocused shot power 1 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 1 move/collide/remove
- .dw PBTShot00Draw ;-Unfocused shot power 2 render
- .dw PBTShot00Draw ;-Focused shot power 2 render
- .dw PBTShot00Move ;-Unfocused shot power 2 move/collide/remove
- .dw PBTShot00Move ;-Focused shot power 2 move/collide/remove
- ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;=============================================================================
- ;CHARACTER FIRING CODE (what happens when you push the fire button)
- ;
- DevBlockUnfPwr1: ;These routines pretty much all do the same thing
- TestRoutineUnFocPwr1:
- TestRoutineUnFocPwr2:
- DevBlockUnfPwr2:
- ;This routine fires a single centered shot on even cycles and
- ;two side shots on odd cycles, every other game cycle
- ld hl,firedelay
- dec (hl)
- ret nz
- ld (hl),2 ;FIRE DELAY FOR STANDARD SHOT IS TWO
- ld hl,charweapondat
- inc (hl)
- bit 0,(hl) ;check to see if even or odd. Using it to alternate bullet sets
- ld hl,(chary)
- jp z,_ ;jump to two side bullets thing
- PBTSHOT(3,-1,126) ;xofs,yofs,cnt. centered bullet
- ret
- _:
- PBTSHOT(0,-1,126) ;left side
- PBTSHOT(6,-1,126) ;right side
- ret
- DevBlockFocPwr1: ;Again, these routines all pretty much do the same thing
- DevBlockFocPwr2:
- TestRoutineFocusPwr1:
- TestRoutineFocusPwr2:
- ;This routine fires two centered shots every game cycle
- ;
- ld hl,firedelay
- dec (hl)
- ret nz
- ld (hl),1 ;ONE GAME CYCLE. THIS CYCLING PROBABLY ISN'T NEEDED THO.
- PBTSHOT(2,-1,126) ;left center
- PBTSHOT(4,-1,126) ;right center
- ret
- ShotHyperdrive:
- PBTSHOT(3,-1,126)
- PBTSHOT(3,-1,126)
- PBTSHOT(3,-1,126)
- PBTSHOT(3,-1,126)
- PBTSHOT(3,-1,126)
- PBTSHOT(3,-1,126)
- PBTSHOT(3,-1,126)
- PBTSHOT(3,-1,126)
- ret
- ;==========================================================
- ;============Dragons attacks===============================
- IambianClaw:
- ;Fires a 2 waves straight forward
- ;Pwr 2 attack fires 6 waves spaced out in a 15degree arc
- ld a,(firedelay) ;load a with fire delay
- ; 1 Good we can fire again
- ; 0 nope already shot a bullet wait till next keypress
- or a ;if z quit because we have already shot a bullet and not let go of the key
- ret z ; ^
- xor a ; zero a
- ld (firedelay),a ; and load it back into fire delay so that we do not shoot again
- ld a,(pbtfreebullet) ; load a with amount of bullets on the PBT
- cp 3 ; if greater than 3 QUIT
- ret nc ; ^
- ;PBTSHOT(xofs,yofs,count)
- ;PBTSHOT(1,1,126)
- ld a,120 ;load up teh cannon sire
- LD d,1 ; Account for wind
- ld e,1 ; AIM
- call pbtcreate2 ; FIRE!!!!! BLAM BANG BANG BOOM
- ret ; Till the next fight good sir *tips hat*
- IambianFire:
- ld hl,firedelay
- dec (hl)
- ret nz
- ld (hl),1 ;FIRE DELAY FOR STANDARD SHOT IS TWO
- call FormatDragonFire
- and %01111110
- CALL PBTCREATE2
- call FormatDragonFire
- and %01101111
- CALL PBTCREATE2
- call FormatDragonFire
- and %01011111
- CALL PBTCREATE2
- call FormatDragonFire
- and %01101111
- CALL PBTCREATE2
- ret
- FormatDragonFire:
- LD D,3
- LD E,-1
- ld hl,lfsrseed1
- ld a,(hl)
- rrca
- ld (hl),a
- jp nc,+_
- xor %00111000
- ld (hl),a
- _:
- set 6,a
- ret
- ;=======================end dragons attacks===================================
- ;=============================================================================
- ;=============================================================================
- ;==========================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
- ; [22:50:17] <+Iambian> If we really want this thing to be like fukken amazing, I suggest a particle trail :)
- ; [22:50:32] <+Iambian> A particle trail made of bullets
- ; [22:50:32] <@geekbozu> or a rotating thing
- ; [;22:50:35] <@geekbozu> and done
- ; [22:50:36] <@geekbozu> totally done
- ; [22:50:49] <@geekbozu> have to think of how to do that tho...
- ; [22:50:52] <@geekbozu> eh not to hard
- ; [22:50:54] <+Iambian> Bullets that can so totally damage the enemy
- ; [22:51:25] <@geekbozu> uhm consequences of calling the pbtbullet create routien while in bullet movement code?
- ; [22:51:47] <+Iambian> Without preserving SP? Epic fail.
- ; [22:51:59] <@geekbozu> well yeah presering sp obviously
- ; [22:52:12] <@geekbozu> (same trick as used to call the sprite routien)
- ; [22:52:25] <+Iambian> Yeah, well that should work.
- ; [22:52:37] <+Iambian> For creating the trail...
- ; [22:52:43] * @geekbozu adds some comments to his noteblock
- ; [22:53:22] <@geekbozu> also i intend to just create bullets at semi random intervals with semi random velocities that are slower than the orb
- ; [22:53:26] <@geekbozu> and it should make a nice effect
- ; [22:53:37] <+Iambian> I suggest getting the current angle that the thing is heading in, negating that so it goes in the opposite direction, then adding an angle that is plus or minus some amount. Probably similar to how the dragonfire is done, except the revised full-range code should be used
- ; [22:53:55] <@geekbozu> yeah more or less what i am thinking
- ; [22:54:07] <@geekbozu> but thats at a later date
Advertisement
Add Comment
Please, Sign In to add comment