summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c23
-rw-r--r--src/cgame/cg_local.h4
-rw-r--r--src/cgame/cg_servercmds.c4
-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
7 files changed, 45 insertions, 44 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index b75c1ff5..d03933ba 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1466,7 +1466,6 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y,
{
char s[ MAX_TOKEN_CHARS ];
float tx, ty;
- int kills;
if( cg.intermissionStarted )
return;
@@ -1476,29 +1475,33 @@ static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y,
if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
- kills = cgs.alienNextStageThreshold - cgs.alienKills;
+ int kills = ceil( (float)(cgs.alienNextStageThreshold - cgs.alienCredits) / ALIEN_CREDITS_PER_FRAG );
+ if( kills < 0 )
+ kills = 0;
if( cgs.alienNextStageThreshold < 0 )
Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d", cgs.alienStage + 1 );
else if( kills == 1 )
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kill for next stage",
- cgs.alienStage + 1, kills );
+ Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, 1 kill for next stage",
+ cgs.alienStage + 1 );
else
Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for next stage",
cgs.alienStage + 1, kills );
}
else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
- kills = cgs.humanNextStageThreshold - cgs.humanKills;
+ int credits = cgs.humanNextStageThreshold - cgs.humanCredits;
+ if( credits < 0 )
+ credits = 0;
if( cgs.humanNextStageThreshold < 0 )
Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d", cgs.humanStage + 1 );
- else if( kills == 1 )
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kill for next stage",
- cgs.humanStage + 1, kills );
+ else if( credits == 1 )
+ Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, 1 credit for next stage",
+ cgs.humanStage + 1 );
else
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for next stage",
- cgs.humanStage + 1, kills );
+ Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d credits for next stage",
+ cgs.humanStage + 1, credits );
}
CG_AlignText( rect, s, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty );
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 470069c1..71804880 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1369,8 +1369,8 @@ typedef struct
int alienStage;
int humanStage;
- int alienKills;
- int humanKills;
+ int alienCredits;
+ int humanCredits;
int alienNextStageThreshold;
int humanNextStageThreshold;
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index 9cdfed8d..8f860072 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -157,7 +157,7 @@ void CG_SetConfigValues( void )
&cgs.humanBuildPointsPowered );
sscanf( CG_ConfigString( CS_STAGES ), "%d %d %d %d %d %d", &cgs.alienStage, &cgs.humanStage,
- &cgs.alienKills, &cgs.humanKills, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold );
+ &cgs.alienCredits, &cgs.humanCredits, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold );
cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) );
cg.warmup = atoi( CG_ConfigString( CS_WARMUP ) );
@@ -282,7 +282,7 @@ static void CG_ConfigStringModified( void )
sscanf( str, "%d %d %d %d %d %d",
&cgs.alienStage, &cgs.humanStage,
- &cgs.alienKills, &cgs.humanKills,
+ &cgs.alienCredits, &cgs.humanCredits,
&cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold );
if( cgs.alienStage != oldAlienStage )
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