summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_combat.c20
-rw-r--r--src/game/g_local.h4
-rw-r--r--src/game/g_main.c26
-rw-r--r--src/game/tremulous.h8
4 files changed, 28 insertions, 30 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 31c80bd1..74feaa2c 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -165,12 +165,19 @@ float G_RewardAttackers( gentity_t *self )
for( i = 0; i < MAX_CLIENTS; i++ )
{
gentity_t *player = g_entities + i;
+ short num = value * self->credits[ i ] / totalDamage;
if( !player->client || !self->credits[ i ] ||
player->client->ps.stats[ STAT_PTEAM ] == team )
continue;
- G_AddCreditToClient( player->client,
- value * self->credits[ i ] / totalDamage, qtrue );
+ G_AddCreditToClient( player->client, num, qtrue );
+
+ // add to stage counters
+ if( player->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
+ trap_Cvar_Set( "g_alienCredits", va( "%d", g_alienCredits.integer + num ) );
+ else if( player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
+ trap_Cvar_Set( "g_humanCredits", va( "%d", g_humanCredits.integer + num ) );
+
self->credits[ i ] = 0;
}
@@ -274,15 +281,6 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
// give credits for killing this player
totalDamage = G_RewardAttackers( self );
- // if players did more than DAMAGE_FRACTION_FOR_KILL increment the stage counters
- if( !OnSameTeam( self, attacker ) && totalDamage >= ( self->client->ps.stats[ STAT_MAX_HEALTH ] * DAMAGE_FRACTION_FOR_KILL ) )
- {
- if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- trap_Cvar_Set( "g_alienKills", va( "%d", g_alienKills.integer + 1 ) );
- else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- trap_Cvar_Set( "g_humanKills", va( "%d", g_humanKills.integer + 1 ) );
- }
-
ScoreboardMessage( self ); // show scores
// send updated scores to any clients that are following this one,
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 625baa71..8ca87f5a 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1149,12 +1149,12 @@ extern vmCvar_t g_singlePlayer;
extern vmCvar_t g_humanBuildPoints;
extern vmCvar_t g_alienBuildPoints;
extern vmCvar_t g_humanStage;
-extern vmCvar_t g_humanKills;
+extern vmCvar_t g_humanCredits;
extern vmCvar_t g_humanMaxStage;
extern vmCvar_t g_humanStage2Threshold;
extern vmCvar_t g_humanStage3Threshold;
extern vmCvar_t g_alienStage;
-extern vmCvar_t g_alienKills;
+extern vmCvar_t g_alienCredits;
extern vmCvar_t g_alienMaxStage;
extern vmCvar_t g_alienStage2Threshold;
extern vmCvar_t g_alienStage3Threshold;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 02edb561..9140dff8 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -91,12 +91,12 @@ vmCvar_t g_maxNameChanges;
vmCvar_t g_humanBuildPoints;
vmCvar_t g_alienBuildPoints;
vmCvar_t g_humanStage;
-vmCvar_t g_humanKills;
+vmCvar_t g_humanCredits;
vmCvar_t g_humanMaxStage;
vmCvar_t g_humanStage2Threshold;
vmCvar_t g_humanStage3Threshold;
vmCvar_t g_alienStage;
-vmCvar_t g_alienKills;
+vmCvar_t g_alienCredits;
vmCvar_t g_alienMaxStage;
vmCvar_t g_alienStage2Threshold;
vmCvar_t g_alienStage3Threshold;
@@ -211,12 +211,12 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_humanBuildPoints, "g_humanBuildPoints", DEFAULT_HUMAN_BUILDPOINTS, 0, 0, qfalse },
{ &g_alienBuildPoints, "g_alienBuildPoints", DEFAULT_ALIEN_BUILDPOINTS, 0, 0, qfalse },
{ &g_humanStage, "g_humanStage", "0", 0, 0, qfalse },
- { &g_humanKills, "g_humanKills", "0", 0, 0, qfalse },
+ { &g_humanCredits, "g_humanCredits", "0", 0, 0, qfalse },
{ &g_humanMaxStage, "g_humanMaxStage", DEFAULT_HUMAN_MAX_STAGE, 0, 0, qfalse },
{ &g_humanStage2Threshold, "g_humanStage2Threshold", DEFAULT_HUMAN_STAGE2_THRESH, 0, 0, qfalse },
{ &g_humanStage3Threshold, "g_humanStage3Threshold", DEFAULT_HUMAN_STAGE3_THRESH, 0, 0, qfalse },
{ &g_alienStage, "g_alienStage", "0", 0, 0, qfalse },
- { &g_alienKills, "g_alienKills", "0", 0, 0, qfalse },
+ { &g_alienCredits, "g_alienCredits", "0", 0, 0, qfalse },
{ &g_alienMaxStage, "g_alienMaxStage", DEFAULT_ALIEN_MAX_STAGE, 0, 0, qfalse },
{ &g_alienStage2Threshold, "g_alienStage2Threshold", DEFAULT_ALIEN_STAGE2_THRESH, 0, 0, qfalse },
{ &g_alienStage3Threshold, "g_alienStage3Threshold", DEFAULT_ALIEN_STAGE3_THRESH, 0, 0, qfalse },
@@ -630,8 +630,8 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
//reset stages
trap_Cvar_Set( "g_alienStage", va( "%d", S1 ) );
trap_Cvar_Set( "g_humanStage", va( "%d", S1 ) );
- trap_Cvar_Set( "g_alienKills", 0 );
- trap_Cvar_Set( "g_humanKills", 0 );
+ trap_Cvar_Set( "g_alienCredits", 0 );
+ trap_Cvar_Set( "g_humanCredits", 0 );
G_Printf( "-----------------------------------\n" );
@@ -1187,7 +1187,7 @@ void G_CalculateBuildPoints( void )
trap_SetConfigstring( CS_STAGES, va( "%d %d %d %d %d %d",
g_alienStage.integer, g_humanStage.integer,
- g_alienKills.integer, g_humanKills.integer,
+ g_alienCredits.integer, g_humanCredits.integer,
alienNextStageThreshold, humanNextStageThreshold ) );
}
}
@@ -1208,7 +1208,7 @@ void G_CalculateStages( void )
if( humanPlayerCountMod < 0.1f )
humanPlayerCountMod = 0.1f;
- if( g_alienKills.integer >=
+ if( g_alienCredits.integer >=
(int)( ceil( (float)g_alienStage2Threshold.integer * alienPlayerCountMod ) ) &&
g_alienStage.integer == S1 && g_alienMaxStage.integer > S1 )
{
@@ -1217,7 +1217,7 @@ void G_CalculateStages( void )
level.alienStage2Time = level.time;
}
- if( g_alienKills.integer >=
+ if( g_alienCredits.integer >=
(int)( ceil( (float)g_alienStage3Threshold.integer * alienPlayerCountMod ) ) &&
g_alienStage.integer == S2 && g_alienMaxStage.integer > S2 )
{
@@ -1226,7 +1226,7 @@ void G_CalculateStages( void )
level.alienStage3Time = level.time;
}
- if( g_humanKills.integer >=
+ if( g_humanCredits.integer >=
(int)( ceil( (float)g_humanStage2Threshold.integer * humanPlayerCountMod ) ) &&
g_humanStage.integer == S1 && g_humanMaxStage.integer > S1 )
{
@@ -1235,7 +1235,7 @@ void G_CalculateStages( void )
level.humanStage2Time = level.time;
}
- if( g_humanKills.integer >=
+ if( g_humanCredits.integer >=
(int)( ceil( (float)g_humanStage3Threshold.integer * humanPlayerCountMod ) ) &&
g_humanStage.integer == S2 && g_humanMaxStage.integer > S2 )
{
@@ -1260,13 +1260,13 @@ void G_CalculateAvgPlayers( void )
if( !level.numAlienClients )
{
level.numAlienSamples = 0;
- trap_Cvar_Set( "g_alienKills", "0" );
+ trap_Cvar_Set( "g_alienCredits", "0" );
}
if( !level.numHumanClients )
{
level.numHumanSamples = 0;
- trap_Cvar_Set( "g_humanKills", "0" );
+ trap_Cvar_Set( "g_humanCredits", "0" );
}
//calculate average number of clients for stats
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index af14e822..a29cc5db 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -656,12 +656,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define FREEKILL_HUMAN LEVEL0_VALUE
#define DEFAULT_ALIEN_BUILDPOINTS "100"
-#define DEFAULT_ALIEN_STAGE2_THRESH "20"
-#define DEFAULT_ALIEN_STAGE3_THRESH "40"
+#define DEFAULT_ALIEN_STAGE2_THRESH "8000"
+#define DEFAULT_ALIEN_STAGE3_THRESH "16000"
#define DEFAULT_ALIEN_MAX_STAGE "2"
#define DEFAULT_HUMAN_BUILDPOINTS "100"
-#define DEFAULT_HUMAN_STAGE2_THRESH "20"
-#define DEFAULT_HUMAN_STAGE3_THRESH "40"
+#define DEFAULT_HUMAN_STAGE2_THRESH "4000"
+#define DEFAULT_HUMAN_STAGE3_THRESH "8000"
#define DEFAULT_HUMAN_MAX_STAGE "2"
#define DAMAGE_FRACTION_FOR_KILL 0.5f //how much damage players (versus structures) need to