diff options
author | Tim Angus <tim@ngus.net> | 2001-06-30 03:00:37 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-06-30 03:00:37 +0000 |
commit | 5420c537abb7aa5c27b168a234a956cf6afec47d (patch) | |
tree | 7efea8f5736feb9859f619c729e98cb10636b9c3 /src/game | |
parent | 7cdc992e6cb562b43c0ae55dd1b39f26d98b5dea (diff) |
Fiddled WP_VENOM to auto attack
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_pmove.c | 64 | ||||
-rw-r--r-- | src/game/bg_public.h | 2 | ||||
-rw-r--r-- | src/game/g_active.c | 20 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_weapon.c | 54 |
5 files changed, 97 insertions, 45 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 091a5032..50791ad4 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -71,7 +71,7 @@ static void PM_AddSmoothOp( vec3_t rotAxis, float rotAngle ) //this happens often because groundtrace is called twice a frame for( i = 0; i < MAXSMOOTHS; i++ ) { - if( wcl[ pm->ps->clientNum ].sList[ i ].time >= pm->cmd.serverTime - 10 ) + if( wcl[ pm->ps->clientNum ].sList[ i ].time >= pm->cmd.serverTime - 50 ) return; /*if( VectorCompare( sList[ i ].rotAxis, rotAxis ) ) @@ -2121,15 +2121,10 @@ PM_TorsoAnimation ============== */ -static void PM_TorsoAnimation( void ) { - if ( pm->ps->weaponstate == WEAPON_READY ) { - if ( pm->ps->weapon == WP_GAUNTLET ) { - PM_ContinueTorsoAnim( TORSO_STAND2 ); - } else { - PM_ContinueTorsoAnim( TORSO_STAND ); - } - return; - } +static void PM_TorsoAnimation( void ) +{ + if ( pm->ps->weaponstate == WEAPON_READY ) + PM_ContinueTorsoAnim( TORSO_STAND ); } @@ -2241,38 +2236,41 @@ static void PM_Weapon( void ) { return; } - if ( pm->ps->weaponstate == WEAPON_RAISING ) { + if ( pm->ps->weaponstate == WEAPON_RAISING ) + { pm->ps->weaponstate = WEAPON_READY; - if ( pm->ps->weapon == WP_GAUNTLET ) { - PM_StartTorsoAnim( TORSO_STAND2 ); - } else { - PM_StartTorsoAnim( TORSO_STAND ); - } + PM_StartTorsoAnim( TORSO_STAND ); return; } if( pm->ps->weapon == WP_SCANNER ) return; //doesn't actually do anything - // check for fire - if ( ! (pm->cmd.buttons & BUTTON_ATTACK) ) { - pm->ps->weaponTime = 0; - pm->ps->weaponstate = WEAPON_READY; - return; - } - // start the animation even if out of ammo - if ( pm->ps->weapon == WP_GAUNTLET ) { - // the guantlet only "fires" when it actually hits something - if ( !pm->gauntletHit ) { - pm->ps->weaponTime = 0; - pm->ps->weaponstate = WEAPON_READY; - return; - } - PM_StartTorsoAnim( TORSO_ATTACK2 ); - } else { - PM_StartTorsoAnim( TORSO_ATTACK ); + + switch( pm->ps->weapon ) + { + case WP_VENOM: + if( !pm->autoWeaponHit[ WP_VENOM ] ) + { + pm->ps->weaponTime = 0; + pm->ps->weaponstate = WEAPON_READY; + return; + } + break; + + default: + // check for fire + if ( !( pm->cmd.buttons & BUTTON_ATTACK ) ) + { + pm->ps->weaponTime = 0; + pm->ps->weaponstate = WEAPON_READY; + return; + } + break; } + + PM_StartTorsoAnim( TORSO_ATTACK ); BG_unpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 1e9ab8b5..a4b16110 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -194,7 +194,7 @@ typedef struct { int tracemask; // collide against these types of surfaces int debugLevel; // if set, diagnostic output will be printed qboolean noFootsteps; // if the game is setup for no footsteps by the server - qboolean gauntletHit; // true if a gauntlet attack would actually hit something + qboolean autoWeaponHit[ 32 ]; //FIXME: TA: remind myself later this might be a problem int framecount; diff --git a/src/game/g_active.c b/src/game/g_active.c index 246c68fb..66c9c279 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -822,14 +822,18 @@ void ClientThink_real( gentity_t *ent ) { memset (&pm, 0, sizeof(pm)); - //TA: gauntlet is a NULL weapon to be given to builder classes - // check for the hit-scan gauntlet, don't let the action - // go through as an attack unless it actually hits something - /*if ( client->ps.weapon == WP_GAUNTLET && !( ucmd->buttons & BUTTON_TALK ) && - ( ucmd->buttons & BUTTON_ATTACK ) && client->ps.weaponTime <= 0 ) { - pm.gauntletHit = CheckGauntletAttack( ent ); - }*/ - pm.gauntletHit = qfalse; + if( !( ucmd->buttons & BUTTON_TALK ) && client->ps.weaponTime <= 0 ) + { + switch( client->ps.weapon ) + { + case WP_VENOM: + pm.autoWeaponHit[ WP_VENOM ] = CheckVenomAttack( ent ); + break; + + default: + break; + } + } if ( ent->flags & FL_FORCE_GESTURE ) { ent->flags &= ~FL_FORCE_GESTURE; diff --git a/src/game/g_local.h b/src/game/g_local.h index f0087b26..34d7bbfd 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -620,7 +620,7 @@ void ShineTorch( gentity_t *self ); qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker ); void CalcMuzzlePoint( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint ); void SnapVectorTowards( vec3_t v, vec3_t to ); -qboolean CheckGauntletAttack( gentity_t *ent ); +qboolean CheckVenomAttack( gentity_t *ent ); void Weapon_HookFree (gentity_t *ent); void Weapon_HookThink (gentity_t *ent); diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index ad637897..98f39453 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -604,13 +604,63 @@ void Weapon_Hbuild_Fire( gentity_t *ent ) } ///////build weapons +//===== +//VENOM +//===== + +/* +=============== +CheckVenomAttack +=============== +*/ +qboolean CheckVenomAttack( 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; + if( traceEnt->biteam == PTE_DROIDS ) + return qfalse; + if( traceEnt->client && traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS ) + return qfalse; + + G_Damage( traceEnt, ent, ent, forward, tr.endpos, 50, 0, MOD_VENOM ); + + return qtrue; +} + /* =============== Weapon_Venom_Fire =============== */ void Weapon_Venom_Fire( gentity_t *ent ) { - trace_t tr; +/* trace_t tr; vec3_t end; gentity_t *tent; gentity_t *traceEnt; @@ -640,7 +690,7 @@ void Weapon_Venom_Fire( gentity_t *ent ) { if ( traceEnt->takedamage) { G_Damage( traceEnt, ent, ent, forward, tr.endpos, 50, 0, MOD_VENOM ); } - +*/ } //====================================================================== |