summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/g_active.c53
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/g_main.c3
3 files changed, 58 insertions, 0 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index a496c226..76efa5f1 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -191,6 +191,56 @@ void G_SetClientSound( gentity_t *ent )
//==============================================================
+static void G_ClientShove( gentity_t *ent, gentity_t *victim )
+{
+ vec3_t dir, push;
+ int entMass = 200, vicMass = 200;
+
+ // shoving enemies changes gameplay too much
+ if( !OnSameTeam( ent, victim ) )
+ return;
+
+ // alien mass is directly related to their health points
+ // human mass is 200, double for bsuit
+ if( ent->client->pers.teamSelection == PTE_ALIENS )
+ {
+ entMass = BG_FindHealthForClass( ent->client->pers.classSelection );
+ }
+ else if( ent->client->pers.teamSelection == PTE_HUMANS )
+ {
+ if( BG_InventoryContainsUpgrade( UP_BATTLESUIT, ent->client->ps.stats ) )
+ entMass *= 2;
+ }
+ else
+ return;
+
+ if( victim->client->pers.teamSelection == PTE_ALIENS )
+ {
+ vicMass = BG_FindHealthForClass( victim->client->pers.classSelection );
+ }
+ else if( BG_InventoryContainsUpgrade( UP_BATTLESUIT,
+ victim->client->ps.stats ) )
+ {
+ vicMass *= 2;
+ }
+
+ if( vicMass <= 0 || entMass <= 0 )
+ return;
+
+ VectorSubtract( victim->r.currentOrigin, ent->r.currentOrigin, dir );
+ VectorNormalizeFast( dir );
+
+ // don't break the dretch elevator
+ if( abs( dir[ 2 ] ) > abs( dir[ 0 ] ) && abs( dir[ 2 ] ) > abs( dir[ 1 ] ) )
+ return;
+
+ VectorScale( dir,
+ ( g_shove.value * ( ( float )entMass / ( float )vicMass ) ), push );
+ VectorAdd( victim->client->ps.velocity, push,
+ victim->client->ps.velocity );
+
+}
+
/*
==============
ClientImpacts
@@ -223,6 +273,9 @@ void ClientImpacts( gentity_t *ent, pmove_t *pm )
ent->client->charging )
ChargeAttack( ent, other );
+ if( ent->client && other->client )
+ G_ClientShove( ent, other );
+
if( !other->touch )
continue;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 0347d65e..578baf91 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1109,6 +1109,8 @@ extern vmCvar_t g_currentMap;
extern vmCvar_t g_initialMapRotation;
extern vmCvar_t g_chatTeamPrefix;
+extern vmCvar_t g_shove;
+
extern vmCvar_t g_mapConfigs;
extern vmCvar_t g_admin;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index ee000e8b..6a8c4b11 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -112,6 +112,8 @@ vmCvar_t g_currentMapRotation;
vmCvar_t g_currentMap;
vmCvar_t g_initialMapRotation;
+vmCvar_t g_shove;
+
vmCvar_t g_mapConfigs;
vmCvar_t g_chatTeamPrefix;
@@ -219,6 +221,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_currentMapRotation, "g_currentMapRotation", "-1", 0, 0, qfalse }, // -1 = NOT_ROTATING
{ &g_currentMap, "g_currentMap", "0", 0, 0, qfalse },
{ &g_initialMapRotation, "g_initialMapRotation", "", CVAR_ARCHIVE, 0, qfalse },
+ { &g_shove, "g_shove", "0.0", CVAR_ARCHIVE, 0, qfalse },
{ &g_mapConfigs, "g_mapConfigs", "", CVAR_ARCHIVE, 0, qfalse },
{ NULL, "g_mapConfigsLoaded", "0", CVAR_ROM, 0, qfalse },