From 3be2f0bd879a384d8dd863e4588706e2b9757972 Mon Sep 17 00:00:00 2001 From: Christopher Schwarz Date: Sat, 3 Oct 2009 12:30:36 +0000 Subject: * Scoreboard revamp as per issue 31 - Builder credits are still to-do, but we decided to see how the rest of the numbers work before adding that into the mix --- src/game/g_combat.c | 47 +++++++++++++++++++++++++++++++++++------------ src/game/tremulous.h | 9 ++++++--- ui/teamscore.menu | 4 ++-- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/src/game/g_combat.c b/src/game/g_combat.c index aeba6544..bce3d659 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -33,7 +33,7 @@ int g_numArmourRegions[ UP_NUM_UPGRADES ]; ============ AddScore -Adds score to both the client and his team +Adds score to the client ============ */ void AddScore( gentity_t *ent, int score ) @@ -45,6 +45,15 @@ void AddScore( gentity_t *ent, int score ) if( level.warmupTime ) return; + // make alien and human scores equivalent + if ( ent->client->pers.teamSelection == TEAM_ALIENS ) + { + score = rint( (double)score / 2.0 ); + } + + // scale values down to fit the scoreboard better + score = rint( (double)score / 10.0 ); + ent->client->ps.persistant[ PERS_SCORE ] += score; CalculateRanks( ); } @@ -177,13 +186,20 @@ float G_RewardAttackers( gentity_t *self ) if( !player->client || !self->credits[ i ] || player->client->ps.stats[ STAT_TEAM ] == team ) continue; - G_AddCreditToClient( player->client, num, qtrue ); - // add to stage counters - if( player->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) - trap_Cvar_Set( "g_alienCredits", va( "%d", g_alienCredits.integer + stageValue ) ); - else if( player->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) - trap_Cvar_Set( "g_humanCredits", va( "%d", g_humanCredits.integer + stageValue ) ); + AddScore( player, num ); + + // killing buildables earns score, but not credits + if( self->s.eType != ET_BUILDABLE ) + { + G_AddCreditToClient( player->client, num, qtrue ); + + // add to stage counters + if( player->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + trap_Cvar_Set( "g_alienCredits", va( "%d", g_alienCredits.integer + stageValue ) ); + else if( player->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + trap_Cvar_Set( "g_humanCredits", va( "%d", g_humanCredits.integer + stageValue ) ); + } self->credits[ i ] = 0; } @@ -267,23 +283,30 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int if( attacker == self || OnSameTeam( self, attacker ) ) { - AddScore( attacker, -1 ); - //punish team kills and suicides if( attacker->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + { G_AddCreditToClient( attacker->client, -ALIEN_TK_SUICIDE_PENALTY, qtrue ); + AddScore( attacker, -ALIEN_TK_SUICIDE_PENALTY ); + } else if( attacker->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + { G_AddCreditToClient( attacker->client, -HUMAN_TK_SUICIDE_PENALTY, qtrue ); + AddScore( attacker, -HUMAN_TK_SUICIDE_PENALTY ); + } } else { - AddScore( attacker, 1 ); - attacker->client->lastKillTime = level.time; } } else if( attacker->s.eType != ET_BUILDABLE ) - AddScore( self, -1 ); + { + if( self->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + AddScore( self, -ALIEN_TK_SUICIDE_PENALTY ); + else if( self->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + AddScore( self, -HUMAN_TK_SUICIDE_PENALTY ); + } // give credits for killing this player totalDamage = G_RewardAttackers( self ); diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 6d04d548..912ef018 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -221,8 +221,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define ALIEN_BHLTH_MODIFIER 1.0f #define ABHM(h) ((int)((float)h*ALIEN_BHLTH_MODIFIER)) -#define ALIEN_BVALUE_MODIFIER 0.0f -#define ABVM(h) ((int)((float)h*ALIEN_BVALUE_MODIFIER)) +#define ALIEN_BVALUE_MODIFIER 30.0f +#define ABVM(h) ((int)((float)h*ALIEN_BVALUE_MODIFIER)) #define CREEP_BASESIZE 700 #define CREEP_TIMEOUT 1000 @@ -530,7 +530,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define HUMAN_BHLTH_MODIFIER 1.0f #define HBHM(h) ((int)((float)h*HUMAN_BHLTH_MODIFIER)) -#define HUMAN_BVALUE_MODIFIER 0.0f +#define HUMAN_BVALUE_MODIFIER 80.0f #define HBVM(h) ((int)((float)h*(float)HUMAN_BVALUE_MODIFIER)) // remember these are measured in credits not frags (c.f. ALIEN_CREDITS_PER_FRAG) #define REACTOR_BASESIZE 1000 @@ -644,6 +644,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define HUMAN_MAX_CREDITS 2000 #define HUMAN_TK_SUICIDE_PENALTY 150 +#define HUMAN_BUILDER_SCOREINC AVM( LEVEL0_VALUE ); +#define ALIEN_BUILDER_SCOREINC HVM( ALIEN_CREDITS_PER_FRAG ); + /* * Misc */ diff --git a/ui/teamscore.menu b/ui/teamscore.menu index a2c76236..eac8f1f5 100644 --- a/ui/teamscore.menu +++ b/ui/teamscore.menu @@ -145,7 +145,7 @@ itemDef { - text "Kills" + text "Score" textscale .33 style WINDOW_STYLE_EMPTY rect (LLIST_R-95) (BAR_H+BORDER) 1 BAR_H @@ -215,7 +215,7 @@ itemDef { - text "Kills" + text "Score" textscale .33 style WINDOW_STYLE_EMPTY rect (RLIST_R-95) (BAR_H+BORDER) 1 BAR_H -- cgit