summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_consolecmds.c1
-rw-r--r--src/game/bg_misc.c45
-rw-r--r--src/game/bg_pmove.c25
-rw-r--r--src/game/bg_public.h2
-rw-r--r--src/game/g_active.c7
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/g_weapon.c194
7 files changed, 131 insertions, 145 deletions
diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c
index 63e095df..c53ee166 100644
--- a/src/cgame/cg_consolecmds.c
+++ b/src/cgame/cg_consolecmds.c
@@ -329,6 +329,7 @@ void CG_InitConsoleCommands( void ) {
trap_AddCommand ("itemdeact");
trap_AddCommand ("itemtoggle");
trap_AddCommand ("destroy");
+ trap_AddCommand ("deconstruct");
trap_AddCommand ("torch");
trap_AddCommand ("menu");
trap_AddCommand ("ui_menu");
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 3ff59a77..1946712f 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -2077,6 +2077,7 @@ weaponAttributes_t bg_weapons[ ] =
100, //int repeatRate;
2000, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
0, //int buildDelay;
@@ -2099,6 +2100,7 @@ weaponAttributes_t bg_weapons[ ] =
150, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
0, //int buildDelay;
@@ -2121,6 +2123,7 @@ weaponAttributes_t bg_weapons[ ] =
50, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
0, //int buildDelay;
@@ -2143,6 +2146,7 @@ weaponAttributes_t bg_weapons[ ] =
1000, //int repeatRate;
2000, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
0, //int buildDelay;
@@ -2165,6 +2169,7 @@ weaponAttributes_t bg_weapons[ ] =
50, //int repeatRate;
2000, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
0, //int buildDelay;
@@ -2187,6 +2192,7 @@ weaponAttributes_t bg_weapons[ ] =
500, //int repeatRate;
2000, //int reloadTime;
qtrue, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
0, //int buildDelay;
@@ -2209,6 +2215,7 @@ weaponAttributes_t bg_weapons[ ] =
100, //int repeatRate;
2000, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
0, //int buildDelay;
@@ -2231,6 +2238,7 @@ weaponAttributes_t bg_weapons[ ] =
75, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
0, //int buildDelay;
@@ -2253,6 +2261,7 @@ weaponAttributes_t bg_weapons[ ] =
1000, //int repeatRate;
0, //int reloadTime;
qtrue, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
10000, //int buildDelay;
@@ -2275,6 +2284,7 @@ weaponAttributes_t bg_weapons[ ] =
1000, //int repeatRate;
0, //int reloadTime;
qtrue, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qtrue, //qboolean purchasable;
5000, //int buildDelay;
@@ -2297,6 +2307,7 @@ weaponAttributes_t bg_weapons[ ] =
1000, //int repeatRate;
0, //int reloadTime;
qtrue, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
10000, //int buildDelay;
@@ -2319,6 +2330,7 @@ weaponAttributes_t bg_weapons[ ] =
1000, //int repeatRate;
0, //int reloadTime;
qtrue, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
5000, //int buildDelay;
@@ -2341,6 +2353,7 @@ weaponAttributes_t bg_weapons[ ] =
500, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
@@ -2362,8 +2375,9 @@ weaponAttributes_t bg_weapons[ ] =
qfalse, //int usesEnergy;
500, //int repeatRate;
0, //int reloadTime;
- qtrue, //qboolean hasAltMode;
- qtrue, //qboolean synced;
+ qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
+ qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
WUT_ALIENS //WUTeam_t team;
@@ -2385,6 +2399,7 @@ weaponAttributes_t bg_weapons[ ] =
1500, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
@@ -2407,6 +2422,7 @@ weaponAttributes_t bg_weapons[ ] =
1500, //int repeatRate;
0, //int reloadTime;
qtrue, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
@@ -2429,6 +2445,7 @@ weaponAttributes_t bg_weapons[ ] =
750, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
@@ -2451,6 +2468,7 @@ weaponAttributes_t bg_weapons[ ] =
750, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qtrue, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
@@ -2473,6 +2491,7 @@ weaponAttributes_t bg_weapons[ ] =
500, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
@@ -2495,6 +2514,7 @@ weaponAttributes_t bg_weapons[ ] =
500, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
@@ -2517,6 +2537,7 @@ weaponAttributes_t bg_weapons[ ] =
500, //int repeatRate;
0, //int reloadTime;
qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
qfalse, //qboolean synced;
qfalse, //qboolean purchasable;
0, //int buildDelay;
@@ -2812,6 +2833,26 @@ qboolean BG_WeaponHasAltMode( int weapon )
/*
==============
+BG_WeaponHasThirdMode
+==============
+*/
+qboolean BG_WeaponHasThirdMode( int weapon )
+{
+ int i;
+
+ for( i = 0; i < bg_numWeapons; i++ )
+ {
+ if( bg_weapons[ i ].weaponNum == weapon )
+ {
+ return bg_weapons[ i ].hasThirdMode;
+ }
+ }
+
+ return qfalse;
+}
+
+/*
+==============
BG_WeaponModesAreSynced
==============
*/
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 642f2129..2a472cdc 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -2264,7 +2264,7 @@ static void PM_Weapon( void )
{
case WP_VENOM:
//venom is only autohit
- attack1 = attack2 = qfalse;
+ attack1 = attack2 = attack3 = qfalse;
if( !pm->autoWeaponHit[ pm->ps->weapon ] )
{
@@ -2279,9 +2279,7 @@ static void PM_Weapon( void )
//pouncing has primary secondary AND autohit procedures
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
-
- if( pm->ps->weapon == WP_POUNCE_UPG )
- attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE;
+ attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE;
if( !pm->autoWeaponHit[ pm->ps->weapon ] && !attack1 && !attack2 && !attack3 )
{
@@ -2294,8 +2292,9 @@ static void PM_Weapon( void )
case WP_LUCIFER_CANON:
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
+ attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE;
- if( ( attack1 || pm->ps->stats[ STAT_MISC ] == 0 ) && !attack2 )
+ if( ( attack1 || pm->ps->stats[ STAT_MISC ] == 0 ) && !attack2 && !attack3 )
{
pm->ps->weaponTime = 0;
pm->ps->weaponstate = WEAPON_READY;
@@ -2311,8 +2310,9 @@ static void PM_Weapon( void )
//by default primary and secondary attacks are allowed
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
+ attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE;
- if( !attack1 && !attack2 )
+ if( !attack1 && !attack2 && !attack3 )
{
pm->ps->weaponTime = 0;
pm->ps->weaponstate = WEAPON_READY;
@@ -2323,8 +2323,17 @@ static void PM_Weapon( void )
//TA: fire events for non auto weapons
if( attack3 )
- PM_AddEvent( EV_FIRE_WEAPON3 );
- if( attack2 )
+ {
+ if( BG_WeaponHasThirdMode( pm->ps->weapon ) )
+ PM_AddEvent( EV_FIRE_WEAPON3 );
+ else
+ {
+ pm->ps->weaponTime = 0;
+ pm->ps->weaponstate = WEAPON_READY;
+ return;
+ }
+ }
+ else if( attack2 )
{
if( BG_WeaponHasAltMode( pm->ps->weapon ) )
{
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index bd1953ff..ec6282d3 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -970,6 +970,7 @@ typedef struct
int reloadTime;
qboolean hasAltMode;
+ qboolean hasThirdMode;
qboolean synced;
qboolean purchasable;
@@ -1082,6 +1083,7 @@ qboolean BG_FindUsesEnergyForWeapon( int weapon );
int BG_FindRepeatRateForWeapon( int weapon );
int BG_FindReloadTimeForWeapon( int weapon );
qboolean BG_WeaponHasAltMode( int weapon );
+qboolean BG_WeaponHasThirdMode( int weapon );
qboolean BG_WeaponModesAreSynced( int weapon );
qboolean BG_FindPurchasableForWeapon( int weapon );
int BG_FindBuildDelayForWeapon( int weapon );
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 2276962a..f6a76c70 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -871,7 +871,7 @@ void ClientThink_real( gentity_t *ent ) {
client->ps.pm_type = PM_NORMAL;
if( client->ps.stats[ STAT_STATE ] & SS_GRABBED &&
- client->lastGrabTime + BG_FindRepeatRateForWeapon( WP_GRAB_CLAW ) + 100 < level.time )
+ client->lastGrabTime + 1000 < level.time )
client->ps.stats[ STAT_STATE ] &= ~SS_GRABBED;
if( client->ps.stats[ STAT_STATE ] & SS_BLOBLOCKED &&
@@ -988,6 +988,11 @@ void ClientThink_real( gentity_t *ent ) {
pm.autoWeaponHit[ client->ps.weapon ] = CheckVenomAttack( ent );
break;
+ case WP_GRAB_CLAW:
+ /*if( client->ps.weaponTime <= 0 )*/ //FIXME: correct decision?
+ CheckGrabAttack( ent );
+ break;
+
case WP_POUNCE:
case WP_POUNCE_UPG:
if( client->ps.weaponTime <= 0 )
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 7f52515a..e414e608 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -662,7 +662,7 @@ 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 CheckVenomAttack( gentity_t *ent );
-qboolean CheckGrabAttack( gentity_t *ent );
+void CheckGrabAttack( gentity_t *ent );
qboolean CheckPounceAttack( 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 12509b90..6ffe8f2a 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -65,6 +65,44 @@ void SnapVectorTowards( vec3_t v, vec3_t to )
}
/*
+===============
+meleeAttack
+===============
+*/
+void meleeAttack( gentity_t *ent, float range, int damage )
+{
+ trace_t tr;
+ vec3_t end;
+ gentity_t *tent;
+ gentity_t *traceEnt;
+
+ // set aiming directions
+ AngleVectors (ent->client->ps.viewangles, forward, right, up);
+
+ CalcMuzzlePoint( ent, forward, right, up, muzzle );
+
+ VectorMA( muzzle, range, forward, end );
+
+ trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
+ if ( tr.surfaceFlags & SURF_NOIMPACT )
+ return;
+
+ 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 )
+ G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, MOD_VENOM );
+}
+
+/*
======================================================================
MACHINEGUN
@@ -396,8 +434,6 @@ void teslaFire( gentity_t *ent )
}
-//======================================================================
-
/*
======================================================================
@@ -448,6 +484,8 @@ void cancelBuildFire( gentity_t *ent )
traceEnt->health = bHealth;
}
}
+ else if( ent->client->ps.weapon == WP_ABUILD2 )
+ meleeAttack( ent, 32.0f, 25 ); //melee attack for alien builder
}
void buildFire( gentity_t *ent, dynMenu_t menu )
@@ -541,82 +579,44 @@ GRAB AND CLAW
======================================================================
*/
-void gClawFire( gentity_t *ent )
-{
- trace_t tr;
- vec3_t end;
- gentity_t *tent;
- gentity_t *traceEnt;
-
- // 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;
-
- 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 )
- G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, DAMAGE_NO_KNOCKBACK, MOD_VENOM );
-}
-
-void lockBlobFire( gentity_t *ent )
-{
- gentity_t *m;
-
- m = fire_paraLockBlob( ent, muzzle, forward );
-
-// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
-}
-
/*
===============
CheckGrabAttack
===============
*/
-qboolean CheckGrabAttack( gentity_t *ent )
+void CheckGrabAttack( 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);
+ AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
- VectorMA (muzzle, 32, forward, end);
+ VectorMA( muzzle, 32, forward, end );
- trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT);
- if ( tr.surfaceFlags & SURF_NOIMPACT )
- return qfalse;
+ trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
+ if( tr.surfaceFlags & SURF_NOIMPACT )
+ return;
traceEnt = &g_entities[ tr.entityNum ];
if( !traceEnt->takedamage)
- return qfalse;
+ return;
if( !traceEnt->client )
- return qfalse;
+ return;
if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- return qfalse;
+ return;
- return qtrue;
+ if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) )
+ VectorCopy( traceEnt->client->ps.viewangles, traceEnt->client->ps.grapplePoint );
+
+ traceEnt->client->ps.stats[ STAT_STATE ] |= SS_GRABBED;
+ traceEnt->client->lastLockTime = level.time;
+
+ //FIXME: event for some client side grab effect?
}
/*
@@ -629,44 +629,6 @@ CLAW AND POUNCE
/*
===============
-clawFire
-===============
-*/
-void clawFire( gentity_t *ent )
-{
- trace_t tr;
- vec3_t end;
- gentity_t *tent;
- gentity_t *traceEnt;
-
- // 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;
-
- 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 )
- G_Damage( traceEnt, ent, ent, forward, tr.endpos, 50, DAMAGE_NO_KNOCKBACK, MOD_VENOM );
-}
-
-/*
-===============
CheckPounceAttack
===============
*/
@@ -950,47 +912,17 @@ void FireWeapon2( gentity_t *ent )
// fire the specific weapon
switch( ent->s.weapon )
{
- case WP_TESLAGEN:
- teslaFire( ent );
- break;
- case WP_MACHINEGUN:
- bulletFire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN );
- break;
- case WP_CHAINGUN:
- bulletFire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN );
- break;
- case WP_FLAMER:
- flamerFire( ent );
- break;
- case WP_PLASMAGUN:
- plasmaFire( ent );
- break;
- case WP_PULSE_RIFLE:
- pulseRifleFire( ent );
- break;
- case WP_MASS_DRIVER:
- massDriverFire( ent );
- break;
- case WP_LOCKBLOB_LAUNCHER:
- break;
- case WP_GRAB_CLAW:
- lockBlobFire( ent );
+ case WP_POUNCE:
+ case WP_POUNCE_UPG:
+ meleeAttack( ent, 32.0f, 150 );
break;
case WP_AREA_ZAP:
case WP_DIRECT_ZAP:
areaZapFire( ent );
break;
- case WP_VENOM:
- case WP_POUNCE:
- case WP_POUNCE_UPG:
- break;
case WP_LUCIFER_CANON:
LCChargeFire( ent, qtrue );
break;
- case WP_LAS_GUN:
- break;
- case WP_PAIN_SAW:
- break;
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
@@ -998,7 +930,6 @@ void FireWeapon2( gentity_t *ent )
cancelBuildFire( ent );
break;
default:
- // FIXME G_Error( "Bad ent->s.weapon" );
break;
}
}
@@ -1049,14 +980,12 @@ void FireWeapon( gentity_t *ent )
case WP_LOCKBLOB_LAUNCHER:
lockBlobLauncherFire( ent );
break;
- case WP_VENOM:
- break;
case WP_GRAB_CLAW:
- gClawFire( ent );
+ meleeAttack( ent, 32.0f, 5 );
break;
case WP_POUNCE:
case WP_POUNCE_UPG:
- clawFire( ent );
+ meleeAttack( ent, 32.0f, 50 );
break;
case WP_AREA_ZAP:
areaZapFire( ent );
@@ -1086,7 +1015,6 @@ void FireWeapon( gentity_t *ent )
buildFire( ent, MN_H_BUILD );
break;
default:
- // FIXME G_Error( "Bad ent->s.weapon" );
break;
}
}