Skip to content

Commit 1dfd0ec

Browse files
game: Now machine gun weapon acts like finger blast attack. Apply radius collision to rocket and beam projectiles, beam projectile can collide other entities. Add Weapon_BFPBeamTrace to detect the beam collisions. Tweak Bullet_Fire, ShotgunPellet and Weapon_LightningFire. Refactor divideBallKiCharged to kiChargePoints. Remove s_quadFactor on G_DivideProjectile_Fire and unused NUM_NAILSHOTS macro from Q3TA
1 parent 8016894 commit 1dfd0ec

4 files changed

Lines changed: 127 additions & 134 deletions

File tree

source/game/g_active.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,8 @@ void ClientThink_real( gentity_t *ent ) {
10721072
// BFP - Short-Range Teleport (Zanzoken)
10731073
ZanzokenHandling( ent, ucmd );
10741074

1075-
// BFP - Charged points for ki dividing ball
1076-
client->divideBallKiCharged = client->ps.stats[STAT_KI_ATTACK_CHARGE];
1075+
// BFP - Charged points for beam and ki dividing ball
1076+
client->kiChargePoints = client->ps.stats[STAT_KI_ATTACK_CHARGE];
10771077

10781078
// BFP - Hit stun melee delay time
10791079
if ( client->hitStunMeleeDelayTime > 0

source/game/g_local.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ struct gclient_s {
353353
int zanzokenDelay;
354354
int zanzokenLastUsed;
355355

356-
// BFP - Charged points for ki dividing ball
357-
int divideBallKiCharged;
356+
// BFP - Ki charge points from STAT_KI_ATTACK_CHARGE
357+
int kiChargePoints;
358358

359359
char *areabits;
360360
};

source/game/g_missile.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,8 @@ G_DivideProjectile_Fire
3131
*/
3232
static void G_DivideProjectile_Fire( gentity_t *ent, vec3_t start, vec3_t dir ) {
3333
gentity_t *m;
34-
float s_quadFactor = 1;
35-
36-
if ( ent->client->ps.powerups[PW_QUAD] ) {
37-
s_quadFactor = g_quadfactor.value;
38-
}
3934

4035
m = fire_plasma( ent, start, dir );
41-
m->damage *= s_quadFactor;
42-
m->splashDamage *= s_quadFactor;
4336
m->enabledivide = qtrue; // handle divided ki ball, otherwise crashes (in DLL/SO)
4437

4538
// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
@@ -53,7 +46,7 @@ G_HandleDivideKiBall
5346
static void G_HandleDivideKiBall( gentity_t *ent, gclient_t *client ) { // BFP - WP_PLASMAGUN would be that dividing ball, when pressing the attack key again, divides by the number of balls depending on the ki attack charge points had
5447
vec3_t dir, angles;
5548
int i;
56-
int chargePoints = client->divideBallKiCharged;
49+
int chargePoints = client->kiChargePoints;
5750
int projectiles_to_spawn = 0;
5851
int yawAdjustments[6] = {
5952
// if charge attack is 2:
@@ -533,16 +526,18 @@ void G_RunMissile( gentity_t *ent ) {
533526
// if just died, then stop
534527
if ( client->ps.pm_type == PM_DEAD ) {
535528
G_BFPBeamStop( ent );
529+
return;
536530
}
537531

538532
if ( tr.surfaceFlags & SURF_NOIMPACT ) {
539533
G_BFPBeamStop( ent );
534+
return;
540535
}
541536

542537
if ( tr.fraction != 1 ) {
543538
G_BFPBeamStop( ent );
539+
return;
544540
}
545-
return;
546541
}
547542

548543
if ( tr.fraction != 1 ) {
@@ -711,6 +706,8 @@ fire_rocket
711706
*/
712707
gentity_t *fire_rocket (gentity_t *self, vec3_t start, vec3_t dir) {
713708
gentity_t *bolt;
709+
// BFP - Projectile radius
710+
float radius = 20;
714711

715712
VectorNormalize (dir);
716713

@@ -738,6 +735,10 @@ gentity_t *fire_rocket (gentity_t *self, vec3_t start, vec3_t dir) {
738735
SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
739736
VectorCopy (start, bolt->r.currentOrigin);
740737

738+
// BFP - Collision radius
739+
VectorSet( bolt->r.mins, -radius, -radius, -radius );
740+
VectorSet( bolt->r.maxs, radius, radius, radius );
741+
741742
return bolt;
742743
}
743744
// BFP - no hook
@@ -786,6 +787,8 @@ fire_bfpbeam
786787
*/
787788
gentity_t *fire_bfpbeam (gentity_t *self, vec3_t start, vec3_t dir) {
788789
gentity_t *beam;
790+
// BFP - Projectile radius
791+
float radius = 30;
789792

790793
VectorNormalize( dir );
791794

@@ -798,7 +801,8 @@ gentity_t *fire_bfpbeam (gentity_t *self, vec3_t start, vec3_t dir) {
798801
beam->s.weapon = WP_GRAPPLING_HOOK;
799802
beam->r.ownerNum = self->s.number;
800803
beam->methodOfDeath = MOD_KI_ATTACK;
801-
beam->clipmask = MASK_SHOT;
804+
// BFP - Beams should collide with other entities including other beams
805+
beam->clipmask = MASK_SHOT | CONTENTS_BODY;
802806
beam->parent = self;
803807
beam->target_ent = NULL;
804808

@@ -807,13 +811,19 @@ gentity_t *fire_bfpbeam (gentity_t *self, vec3_t start, vec3_t dir) {
807811
beam->splashRadius = 120;
808812
beam->splashMethodOfDeath = MOD_KI_ATTACK;
809813

814+
beam->speed = 2000;
815+
810816
beam->s.pos.trType = TR_LINEAR;
811817
beam->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame
812818
beam->s.otherEntityNum = self->s.number; // use to match beam in client
813819
VectorCopy( start, beam->s.pos.trBase );
814-
VectorScale( dir, 800, beam->s.pos.trDelta );
820+
VectorScale( dir, beam->speed, beam->s.pos.trDelta ); // speed
815821
SnapVector( beam->s.pos.trDelta ); // save net bandwidth
816822
VectorCopy( start, beam->r.currentOrigin );
817823

824+
// BFP - Collision radius
825+
VectorSet( beam->r.mins, -radius, -radius, -radius );
826+
VectorSet( beam->r.maxs, radius, radius, radius );
827+
818828
return beam;
819829
}

0 commit comments

Comments
 (0)