diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 61 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 27 | ||||
-rw-r--r-- | src/game/bg_public.h | 5 | ||||
-rw-r--r-- | src/game/g_active.c | 4 | ||||
-rw-r--r-- | src/game/g_client.c | 8 | ||||
-rw-r--r-- | src/game/g_combat.c | 3 | ||||
-rw-r--r-- | src/game/g_missile.c | 205 | ||||
-rw-r--r-- | src/game/g_weapon.c | 381 |
8 files changed, 81 insertions, 613 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 96a46f0e..a7c21ba7 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1941,6 +1941,7 @@ weaponAttributes_t bg_weapons[ ] = 3, //int maxClips; qfalse, //int infiniteAmmo; 100, //int repeatRate; + 2000, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; @@ -1960,6 +1961,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qfalse, //int infiniteAmmo; 40, //int repeatRate; + 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; @@ -1979,6 +1981,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qfalse, //int infiniteAmmo; 50, //int repeatRate; + 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; @@ -1998,6 +2001,7 @@ weaponAttributes_t bg_weapons[ ] = 3, //int maxClips; qfalse, //int infiniteAmmo; 1000, //int repeatRate; + 2000, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; @@ -2017,6 +2021,7 @@ weaponAttributes_t bg_weapons[ ] = 3, //int maxClips; qfalse, //int infiniteAmmo; 50, //int repeatRate; + 2000, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; @@ -2036,6 +2041,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 1000, //int repeatRate; + 0, //int reloadTime; qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; @@ -2055,6 +2061,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 1000, //int repeatRate; + 0, //int reloadTime; qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qtrue, //qboolean purchasable; @@ -2074,6 +2081,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 1000, //int repeatRate; + 0, //int reloadTime; qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; @@ -2093,6 +2101,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 1000, //int repeatRate; + 0, //int reloadTime; qtrue, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; @@ -2112,18 +2121,19 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 500, //int repeatRate; + 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; WUT_ALIENS //WUTeam_t team; }, { - WP_GRABANDCSAW, //int weaponNum; + WP_GRAB_CLAW, //int weaponNum; 100, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; - "grabandcsaw", //char *weaponName; - "Circular Saw", //char *weaponHumanName; + "grabandclaw", //char *weaponName; + "Claws", //char *weaponHumanName; { "models/weapons2/gauntlet/gauntlet.md3", 0, 0, 0 }, "icons/iconw_gauntlet", 0, //int quan; @@ -2131,12 +2141,33 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 500, //int repeatRate; + 0, //int reloadTime; qtrue, //qboolean hasAltMode; qtrue, //qboolean synced; qfalse, //qboolean purchasable; WUT_ALIENS //WUTeam_t team; }, { + WP_AREA_ZAP, //int weaponNum; + 100, //int price; + ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages + SLOT_WEAPON, //int slots; + "areazap", //char *weaponName; + "Area Zap", //char *weaponHumanName; + { "models/weapons2/gauntlet/gauntlet.md3", 0, 0, 0 }, + "icons/iconw_gauntlet", + 0, //int quan; + 0, //int clips; + 0, //int maxClips; + qtrue, //int infiniteAmmo; + 500, //int repeatRate; + 0, //int reloadTime; + qfalse, //qboolean hasAltMode; + qfalse, //qboolean synced; + qfalse, //qboolean purchasable; + WUT_ALIENS //WUTeam_t team; + }, + { WP_POUNCE, //int weaponNum; 100, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -2150,6 +2181,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 750, //int repeatRate; + 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; @@ -2169,6 +2201,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 500, //int repeatRate; + 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; @@ -2188,6 +2221,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 500, //int repeatRate; + 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; @@ -2207,6 +2241,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; 500, //int repeatRate; + 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; qfalse, //qboolean purchasable; @@ -2442,6 +2477,26 @@ int BG_FindRepeatRateForWeapon( int weapon ) /* ============== +BG_FindReloadTimeForWeapon +============== +*/ +int BG_FindReloadTimeForWeapon( int weapon ) +{ + int i; + + for( i = 0; i < bg_numWeapons; i++ ) + { + if( bg_weapons[ i ].weaponNum == weapon ) + { + return bg_weapons[ i ].reloadTime; + } + } + + return 1000; +} + +/* +============== BG_WeaponHasAltMode ============== */ diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index da3809fc..c0ba5e82 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2169,17 +2169,10 @@ static void PM_Weapon( void ) //done reloading so give em some ammo if( pm->ps->weaponstate == WEAPON_RELOADING ) { - switch( pm->ps->weapon ) + if( maxclips > 0 ) { - case WP_MACHINEGUN: - case WP_MASS_DRIVER: - case WP_PULSE_RIFLE: - clips--; - BG_FindAmmoForWeapon( pm->ps->weapon, &ammo, NULL, NULL ); - break; - - default: - break; + clips--; + BG_FindAmmoForWeapon( pm->ps->weapon, &ammo, NULL, NULL ); } BG_packAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); @@ -2190,17 +2183,7 @@ static void PM_Weapon( void ) { pm->ps->weaponstate = WEAPON_RELOADING; - switch( pm->ps->weapon ) - { - case WP_MACHINEGUN: - case WP_MASS_DRIVER: - case WP_PULSE_RIFLE: - addTime = 2000; - break; - - default: - break; - } + addTime = BG_FindReloadTimeForWeapon( pm->ps->weapon ); pm->ps->weaponTime += addTime; return; @@ -2234,7 +2217,7 @@ static void PM_Weapon( void ) } break; - case WP_GRABANDCSAW: + case WP_GRAB_CLAW: attack1 = pm->cmd.buttons & BUTTON_ATTACK; //secondary attack is only permitted if target is in range diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 8c68c80b..dbeb7e43 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -335,8 +335,9 @@ typedef enum WP_FLAMER, WP_PLASMAGUN, WP_VENOM, - WP_GRABANDCSAW, + WP_GRAB_CLAW, WP_POUNCE, + WP_AREA_ZAP, WP_MASS_DRIVER, WP_PULSE_RIFLE, @@ -933,6 +934,7 @@ typedef struct qboolean infiniteAmmo; int repeatRate; + int reloadTime; qboolean hasAltMode; qboolean synced; @@ -1022,6 +1024,7 @@ char *BG_FindIconForWeapon( int weapon ); void BG_FindAmmoForWeapon( int weapon, int *quan, int *clips, int *maxClips ); qboolean BG_FindInfinteAmmoForWeapon( int weapon ); int BG_FindRepeatRateForWeapon( int weapon ); +int BG_FindReloadTimeForWeapon( int weapon ); qboolean BG_WeaponHasAltMode( int weapon ); qboolean BG_WeaponModesAreSynced( int weapon ); qboolean BG_FindPurchasableForWeapon( int weapon ); diff --git a/src/game/g_active.c b/src/game/g_active.c index 8885a87e..871db488 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -942,8 +942,8 @@ void ClientThink_real( gentity_t *ent ) { pm.autoWeaponHit[ WP_VENOM ] = CheckVenomAttack( ent ); break; - case WP_GRABANDCSAW: - pm.autoWeaponHit[ WP_GRABANDCSAW ] = CheckGrabAttack( ent ); + case WP_GRAB_CLAW: + pm.autoWeaponHit[ WP_GRAB_CLAW ] = CheckGrabAttack( ent ); break; case WP_POUNCE: diff --git a/src/game/g_client.c b/src/game/g_client.c index a61fb653..806af002 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1467,13 +1467,13 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) break; case PCL_A_O_LEV1: - BG_packWeapon( WP_GRABANDCSAW, client->ps.stats ); - BG_packAmmoArray( WP_GRABANDCSAW, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); + BG_packWeapon( WP_GRAB_CLAW, client->ps.stats ); + BG_packAmmoArray( WP_GRAB_CLAW, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); break; case PCL_A_O_LEV1_UPG: - BG_packWeapon( WP_GRABANDCSAW, client->ps.stats ); - BG_packAmmoArray( WP_GRABANDCSAW, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); + BG_packWeapon( WP_GRAB_CLAW, client->ps.stats ); + BG_packAmmoArray( WP_GRAB_CLAW, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); break; case PCL_A_O_LEV2: diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 2d7fafce..e0f0e0ea 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -360,9 +360,6 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int // check for a player that almost brought in cubes //CheckAlmostScored( self, attacker ); - if (self->client && self->client->hook) - Weapon_HookFree(self->client->hook); - self->client->ps.pm_type = PM_DEAD; if ( attacker ) { diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 84a64741..03478674 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -129,52 +129,6 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) { } } - if( !strcmp( ent->classname, "hook" ) ) - { - gentity_t *nent; - vec3_t v; - - nent = G_Spawn(); - if ( other->takedamage && other->client ) { - - G_AddEvent( nent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) ); - nent->s.otherEntityNum = other->s.number; - - ent->enemy = other; - - v[0] = other->r.currentOrigin[0] + (other->r.mins[0] + other->r.maxs[0]) * 0.5; - v[1] = other->r.currentOrigin[1] + (other->r.mins[1] + other->r.maxs[1]) * 0.5; - v[2] = other->r.currentOrigin[2] + (other->r.mins[2] + other->r.maxs[2]) * 0.5; - - SnapVectorTowards( v, ent->s.pos.trBase ); // save net bandwidth - } else { - VectorCopy(trace->endpos, v); - G_AddEvent( nent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) ); - ent->enemy = NULL; - } - - SnapVectorTowards( v, ent->s.pos.trBase ); // save net bandwidth - - nent->freeAfterEvent = qtrue; - // change over to a normal entity right at the point of impact - nent->s.eType = ET_GENERAL; - ent->s.eType = ET_GRAPPLE; - - G_SetOrigin( ent, v ); - G_SetOrigin( nent, v ); - - ent->think = Weapon_HookThink; - ent->nextthink = level.time + FRAMETIME; - - ent->parent->client->ps.pm_flags |= PMF_GRAPPLE_PULL; - VectorCopy( ent->r.currentOrigin, ent->parent->client->ps.grapplePoint); - - trap_LinkEntity( ent ); - trap_LinkEntity( nent ); - - return; - } - if( !strcmp( ent->classname, "lockblob" ) ) { if( other->client && other->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) @@ -369,7 +323,7 @@ gentity_t *fire_plasma( gentity_t *self, vec3_t start, vec3_t dir ) /* ================= -fire_plasma +fire_pulseRifle ================= */ @@ -411,125 +365,6 @@ gentity_t *fire_pulseRifle( gentity_t *self, vec3_t start, vec3_t dir ) /* ================= -fire_grenade -================= -*/ -gentity_t *fire_grenade (gentity_t *self, vec3_t start, vec3_t dir) { - gentity_t *bolt; - - VectorNormalize (dir); - - bolt = G_Spawn(); - bolt->classname = "grenade"; - bolt->nextthink = level.time + 2500; - bolt->think = G_ExplodeMissile; - bolt->s.eType = ET_MISSILE; - bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; - /*bolt->s.weapon = WP_GRENADE_LAUNCHER;*/ - bolt->s.eFlags = EF_BOUNCE_HALF; - bolt->r.ownerNum = self->s.number; - bolt->parent = self; - bolt->damage = 100; - bolt->splashDamage = 100; - bolt->splashRadius = 150; - bolt->methodOfDeath = MOD_GRENADE; - bolt->splashMethodOfDeath = MOD_GRENADE_SPLASH; - bolt->clipmask = MASK_SHOT; - bolt->target_ent = NULL; - - bolt->s.pos.trType = TR_GRAVITY; - bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame - VectorCopy( start, bolt->s.pos.trBase ); - VectorScale( dir, 700, bolt->s.pos.trDelta ); - SnapVector( bolt->s.pos.trDelta ); // save net bandwidth - - VectorCopy (start, bolt->r.currentOrigin); - - return bolt; -} - -//============================================================================= - - -/* -================= -fire_bfg -================= -*/ -gentity_t *fire_bfg (gentity_t *self, vec3_t start, vec3_t dir) { - gentity_t *bolt; - - VectorNormalize (dir); - - bolt = G_Spawn(); - bolt->classname = "bfg"; - bolt->nextthink = level.time + 10000; - bolt->think = G_ExplodeMissile; - bolt->s.eType = ET_MISSILE; - bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; - /*bolt->s.weapon = WP_BFG;*/ - bolt->r.ownerNum = self->s.number; - bolt->parent = self; - bolt->damage = 100; - bolt->splashDamage = 100; - bolt->splashRadius = 120; - bolt->methodOfDeath = MOD_BFG; - bolt->splashMethodOfDeath = MOD_BFG_SPLASH; - bolt->clipmask = MASK_SHOT; - bolt->target_ent = NULL; - - bolt->s.pos.trType = TR_LINEAR; - bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame - VectorCopy( start, bolt->s.pos.trBase ); - VectorScale( dir, 2000, bolt->s.pos.trDelta ); - SnapVector( bolt->s.pos.trDelta ); // save net bandwidth - VectorCopy (start, bolt->r.currentOrigin); - - return bolt; -} - -//============================================================================= - - -/* -================= -fire_rocket -================= -*/ -gentity_t *fire_rocket (gentity_t *self, vec3_t start, vec3_t dir) { - gentity_t *bolt; - - VectorNormalize (dir); - - bolt = G_Spawn(); - bolt->classname = "rocket"; - bolt->nextthink = level.time + 15000; - bolt->think = G_ExplodeMissile; - bolt->s.eType = ET_MISSILE; - bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; - /*bolt->s.weapon = WP_ROCKET_LAUNCHER;*/ - bolt->r.ownerNum = self->s.number; - bolt->parent = self; - bolt->damage = 100; - bolt->splashDamage = 100; - bolt->splashRadius = 120; - bolt->methodOfDeath = MOD_ROCKET; - bolt->splashMethodOfDeath = MOD_ROCKET_SPLASH; - bolt->clipmask = MASK_SHOT; - bolt->target_ent = NULL; - - bolt->s.pos.trType = TR_LINEAR; - bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame - VectorCopy( start, bolt->s.pos.trBase ); - VectorScale( dir, 900, bolt->s.pos.trDelta ); - SnapVector( bolt->s.pos.trDelta ); // save net bandwidth - VectorCopy (start, bolt->r.currentOrigin); - - return bolt; -} - -/* -================= fire_lockblob ================= */ @@ -566,41 +401,3 @@ gentity_t *fire_lockblob( gentity_t *self, vec3_t start, vec3_t dir ) return bolt; } -/* -================= -fire_grapple -================= -*/ -gentity_t *fire_grapple (gentity_t *self, vec3_t start, vec3_t dir) { - gentity_t *hook; - - VectorNormalize (dir); - - hook = G_Spawn(); - hook->classname = "hook"; - hook->nextthink = level.time + 10000; - hook->think = Weapon_HookFree; - hook->s.eType = ET_MISSILE; - hook->r.svFlags = SVF_USE_CURRENT_ORIGIN; - /*hook->s.weapon = WP_GRAPPLING_HOOK;*/ - hook->r.ownerNum = self->s.number; - hook->methodOfDeath = MOD_GRAPPLE; - hook->clipmask = MASK_SHOT; - hook->parent = self; - hook->target_ent = NULL; - - hook->s.pos.trType = TR_LINEAR; - hook->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame - hook->s.otherEntityNum = self->s.number; // use to match beam in client - VectorCopy( start, hook->s.pos.trBase ); - VectorScale( dir, 800, hook->s.pos.trDelta ); - SnapVector( hook->s.pos.trDelta ); // save net bandwidth - VectorCopy (start, hook->r.currentOrigin); - - self->client->hook = hook; - - return hook; -} - - - diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 00e07234..e0dec309 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -43,64 +43,6 @@ void G_BounceProjectile( vec3_t start, vec3_t impact, vec3_t dir, vec3_t endout /* ====================================================================== -GAUNTLET - -====================================================================== -*/ - -void Weapon_Gauntlet( gentity_t *ent ) { - -} - -/* -=============== -CheckGauntletAttack -=============== -*/ -qboolean CheckGauntletAttack( gentity_t *ent ) { - trace_t tr; - vec3_t end; - gentity_t *tent; - gentity_t *traceEnt; - int damage; - - // set aiming directions - AngleVectors (ent->client->ps.viewangles, forward, right, up); - - CalcMuzzlePoint( ent, forward, right, up, muzzle ); - - VectorMA (muzzle, 32, forward, end); - - trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT); - if ( tr.surfaceFlags & SURF_NOIMPACT ) { - return qfalse; - } - - traceEnt = &g_entities[ tr.entityNum ]; - - // send blood impact - if ( traceEnt->takedamage && traceEnt->client ) { - tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); - tent->s.otherEntityNum = traceEnt->s.number; - tent->s.eventParm = DirToByte( tr.plane.normal ); - tent->s.weapon = ent->s.weapon; - } - - if ( !traceEnt->takedamage) { - return qfalse; - } - - damage = 50; - G_Damage( traceEnt, ent, ent, forward, tr.endpos, - damage, 0, MOD_GAUNTLET ); - - return qtrue; -} - - -/* -====================================================================== - MACHINEGUN ====================================================================== @@ -222,148 +164,7 @@ void massDriverFire( gentity_t *ent ) /* ====================================================================== -BFG - -====================================================================== -*/ - -void BFG_Fire ( gentity_t *ent ) { - gentity_t *m; - - m = fire_bfg (ent, muzzle, forward); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics -} - - -/* -====================================================================== - -SHOTGUN - -====================================================================== -*/ - -// DEFAULT_SHOTGUN_SPREAD and DEFAULT_SHOTGUN_COUNT are in bg_public.h, because -// client predicts same spreads -#define DEFAULT_SHOTGUN_DAMAGE 10 - -qboolean ShotgunPellet( vec3_t start, vec3_t end, gentity_t *ent ) { - trace_t tr; - int damage, i, passent; - gentity_t *traceEnt; - vec3_t tr_start, tr_end; - - passent = ent->s.number; - VectorCopy( start, tr_start ); - VectorCopy( end, tr_end ); - for (i = 0; i < 10; i++) { - trap_Trace (&tr, tr_start, NULL, NULL, tr_end, passent, MASK_SHOT); - traceEnt = &g_entities[ tr.entityNum ]; - - // send bullet impact - if ( tr.surfaceFlags & SURF_NOIMPACT ) { - return qfalse; - } - - if ( traceEnt->takedamage) { - damage = DEFAULT_SHOTGUN_DAMAGE; - G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, 0, MOD_SHOTGUN); - if( LogAccuracyHit( traceEnt, ent ) ) { - return qtrue; - } - } - return qfalse; - } - return qfalse; -} - -// this should match CG_ShotgunPattern -void ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, gentity_t *ent ) { - int i; - float r, u; - vec3_t end; - vec3_t forward, right, up; - int oldScore; - qboolean hitClient = qfalse; - - // derive the right and up vectors from the forward vector, because - // the client won't have any other information - VectorNormalize2( origin2, forward ); - PerpendicularVector( right, forward ); - CrossProduct( forward, right, up ); - - oldScore = ent->client->ps.persistant[PERS_SCORE]; - - // generate the "random" spread pattern - for ( i = 0 ; i < DEFAULT_SHOTGUN_COUNT ; i++ ) { - r = Q_crandom( &seed ) * DEFAULT_SHOTGUN_SPREAD * 16; - u = Q_crandom( &seed ) * DEFAULT_SHOTGUN_SPREAD * 16; - VectorMA( origin, 8192 * 16, forward, end); - VectorMA (end, r, right, end); - VectorMA (end, u, up, end); - if( ShotgunPellet( origin, end, ent ) && !hitClient ) { - hitClient = qtrue; - ent->client->accuracy_hits++; - } - } -} - - -void weapon_supershotgun_fire (gentity_t *ent) { - gentity_t *tent; - - // send shotgun blast - tent = G_TempEntity( muzzle, EV_SHOTGUN ); - VectorScale( forward, 4096, tent->s.origin2 ); - SnapVector( tent->s.origin2 ); - tent->s.eventParm = rand() & 255; // seed for spread pattern - tent->s.otherEntityNum = ent->s.number; - - ShotgunPattern( tent->s.pos.trBase, tent->s.origin2, tent->s.eventParm, ent ); -} - - -/* -====================================================================== - -GRENADE LAUNCHER - -====================================================================== -*/ - -void weapon_grenadelauncher_fire (gentity_t *ent) { - gentity_t *m; - - // extra vertical velocity - forward[2] += 0.2f; - VectorNormalize( forward ); - - m = fire_grenade (ent, muzzle, forward); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics -} - -/* -====================================================================== - -ROCKET - -====================================================================== -*/ - -void Weapon_RocketLauncher_Fire (gentity_t *ent) { - gentity_t *m; - - m = fire_rocket (ent, muzzle, forward); - -// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics -} - -/* -====================================================================== - -SAWBLADE +LOCKBLOB ====================================================================== */ @@ -429,132 +230,6 @@ void Weapon_Flamer_Fire (gentity_t *ent) { /* ====================================================================== -RAILGUN - -====================================================================== -*/ - - -/* -================= -weapon_railgun_fire -================= -*/ -#define MAX_RAIL_HITS 4 -void weapon_railgun_fire( gentity_t *ent ) -{ - vec3_t end; - trace_t trace; - gentity_t *tent; - gentity_t *traceEnt; - int damage; - int i; - int hits; - int unlinked; - int passent; - gentity_t *unlinkedEntities[MAX_RAIL_HITS]; - - damage = 100; - - VectorMA (muzzle, 8192, forward, end); - - // trace only against the solids, so the railgun will go through people - unlinked = 0; - hits = 0; - passent = ent->s.number; - - do - { - trap_Trace (&trace, muzzle, NULL, NULL, end, passent, MASK_SHOT ); - if ( trace.entityNum >= ENTITYNUM_MAX_NORMAL ) - break; - - traceEnt = &g_entities[ trace.entityNum ]; - if ( traceEnt->takedamage ) - G_Damage( traceEnt, ent, ent, forward, trace.endpos, damage, 0, MOD_RAILGUN ); - - if ( trace.contents & CONTENTS_SOLID ) - break; // we hit something solid enough to stop the beam - - // unlink this entity, so the next trace will go past it - trap_UnlinkEntity( traceEnt ); - unlinkedEntities[unlinked] = traceEnt; - unlinked++; - } - while ( unlinked < MAX_RAIL_HITS ); - - // link back in any entities we unlinked - for ( i = 0 ; i < unlinked ; i++ ) - trap_LinkEntity( unlinkedEntities[i] ); - - // the final trace endpos will be the terminal point of the rail trail - - // snap the endpos to integers to save net bandwidth, but nudged towards the line - SnapVectorTowards( trace.endpos, muzzle ); - - // send railgun beam effect - tent = G_TempEntity( trace.endpos, EV_RAILTRAIL ); - - // set player number for custom colors on the railtrail - tent->s.clientNum = ent->s.clientNum; - - VectorCopy( muzzle, tent->s.origin2 ); - // move origin a bit to come closer to the drawn gun muzzle - VectorMA( tent->s.origin2, 16, up, tent->s.origin2 ); - - // no explosion at end if SURF_NOIMPACT, but still make the trail - if ( trace.surfaceFlags & SURF_NOIMPACT ) - tent->s.eventParm = 255; // don't make the explosion at the end - else - tent->s.eventParm = DirToByte( trace.plane.normal ); - - tent->s.clientNum = ent->s.clientNum; -} - - -/* -====================================================================== - -GRAPPLING HOOK - -====================================================================== -*/ - -void Weapon_GrapplingHook_Fire (gentity_t *ent) -{ - if (!ent->client->fireHeld && !ent->client->hook) - fire_grapple (ent, muzzle, forward); - - ent->client->fireHeld = qtrue; -} - -void Weapon_HookFree (gentity_t *ent) -{ - ent->parent->client->hook = NULL; - ent->parent->client->ps.pm_flags &= ~PMF_GRAPPLE_PULL; - G_FreeEntity( ent ); -} - -void Weapon_HookThink (gentity_t *ent) -{ - if (ent->enemy) { - vec3_t v, oldorigin; - - VectorCopy(ent->r.currentOrigin, oldorigin); - v[0] = ent->enemy->r.currentOrigin[0] + (ent->enemy->r.mins[0] + ent->enemy->r.maxs[0]) * 0.5; - v[1] = ent->enemy->r.currentOrigin[1] + (ent->enemy->r.mins[1] + ent->enemy->r.maxs[1]) * 0.5; - v[2] = ent->enemy->r.currentOrigin[2] + (ent->enemy->r.mins[2] + ent->enemy->r.maxs[2]) * 0.5; - SnapVectorTowards( v, oldorigin ); // save net bandwidth - - G_SetOrigin( ent, v ); - } - - VectorCopy( ent->r.currentOrigin, ent->parent->client->ps.grapplePoint); -} - -/* -====================================================================== - TESLA GENERATOR ====================================================================== @@ -720,17 +395,17 @@ void Weapon_Venom_Fire( gentity_t *ent ) /* ====================================================================== -CIRCULAR SAW +GRAB AND CLAW ====================================================================== */ /* =============== -Weapon_Csaw_Fire +Weapon_GClaw_Fire =============== */ -void Weapon_CSaw_Fire( gentity_t *ent ) +void Weapon_GClaw_Fire( gentity_t *ent ) { trace_t tr; vec3_t end; @@ -1022,27 +697,15 @@ void FireWeapon2( gentity_t *ent ) // fire the specific weapon switch( ent->s.weapon ) { -/* case WP_GAUNTLET: - Weapon_Gauntlet( ent ); - break;*/ case WP_TESLAGEN: Weapon_TeslaFire( ent ); break; -/* case WP_SHOTGUN: - weapon_supershotgun_fire( ent ); - break;*/ case WP_MACHINEGUN: Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); break; case WP_CHAINGUN: Bullet_Fire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN ); break; -/* case WP_GRENADE_LAUNCHER: - weapon_grenadelauncher_fire( ent ); - break;*/ -/* case WP_ROCKET_LAUNCHER: - Weapon_RocketLauncher_Fire( ent ); - break;*/ case WP_FLAMER: Weapon_Flamer_Fire( ent ); break; @@ -1052,24 +715,15 @@ void FireWeapon2( gentity_t *ent ) case WP_PULSE_RIFLE: Weapon_PulseRifle_Fire( ent ); break; -/* case WP_RAILGUN: - weapon_railgun_fire( ent ); - break;*/ case WP_MASS_DRIVER: massDriverFire( ent ); break; case WP_LOCKBLOB_LAUNCHER: break; -/* case WP_BFG: - BFG_Fire( ent ); - break;*/ -/* case WP_GRAPPLING_HOOK: - Weapon_GrapplingHook_Fire( ent ); - break;*/ case WP_VENOM: Weapon_Venom_Fire( ent ); break; - case WP_GRABANDCSAW: + case WP_GRAB_CLAW: Weapon_Grab_Fire( ent ); break; case WP_POUNCE: @@ -1115,27 +769,15 @@ void FireWeapon( gentity_t *ent ) // fire the specific weapon switch( ent->s.weapon ) { -/* case WP_GAUNTLET: - Weapon_Gauntlet( ent ); - break;*/ case WP_TESLAGEN: Weapon_TeslaFire( ent ); break; -/* case WP_SHOTGUN: - weapon_supershotgun_fire( ent ); - break;*/ case WP_MACHINEGUN: Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); break; case WP_CHAINGUN: Bullet_Fire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN ); break; -/* case WP_GRENADE_LAUNCHER: - weapon_grenadelauncher_fire( ent ); - break;*/ -/* case WP_ROCKET_LAUNCHER: - Weapon_RocketLauncher_Fire( ent ); - break;*/ case WP_FLAMER: Weapon_Flamer_Fire( ent ); break; @@ -1145,26 +787,17 @@ void FireWeapon( gentity_t *ent ) case WP_PULSE_RIFLE: Weapon_PulseRifle_Fire( ent ); break; -/* case WP_RAILGUN: - weapon_railgun_fire( ent ); - break;*/ case WP_MASS_DRIVER: massDriverFire( ent ); break; case WP_LOCKBLOB_LAUNCHER: Weapon_LockBlobLauncher_Fire( ent ); break; -/* case WP_BFG: - BFG_Fire( ent ); - break;*/ -/* case WP_GRAPPLING_HOOK: - Weapon_GrapplingHook_Fire( ent ); - break;*/ case WP_VENOM: Weapon_Venom_Fire( ent ); break; - case WP_GRABANDCSAW: - Weapon_CSaw_Fire( ent ); + case WP_GRAB_CLAW: + Weapon_GClaw_Fire( ent ); break; case WP_POUNCE: Weapon_Claw_Fire( ent ); |