From befabb2425738561090a985524f5b0969e9c22b9 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sun, 12 Apr 2020 19:59:21 +0200 Subject: g_debugRewards --- src/game/g_combat.c | 35 ++++++++++++++++++++++++++++++++--- src/game/g_local.h | 1 + src/game/g_main.c | 2 ++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 91c4b31..1c57f60 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -496,8 +496,13 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int { //nice simple happy bouncy human land float classValue = BG_FindValueOfClass( self->client->ps.stats[ STAT_PCLASS ] ); + float factor = G_RewardFactor( self, attacker ); - classValue *= G_RewardFactor( self, attacker ); + if( g_debugRewards.integer ) + Com_Printf( "DebugRewards: %d x %.2f = ", (int)classValue, factor ); + classValue *= factor; + if( g_debugRewards.integer ) + Com_Printf( "%d", (int)classValue ); for( i = 0; i < MAX_CLIENTS; i++ ) { @@ -525,16 +530,28 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int amount = classValue * percentDamage; G_AddCreditToClient( player->client, amount, qtrue ); player->client->pers.statscounters.earned += amount; + + if( g_debugRewards.integer ) + Com_Printf( ", %d credit(s) to #%d for %.1f%% of damage", amount, + (int)( player - g_entities ), 100 * percentDamage ); } + + if( g_debugRewards.integer ) + Com_Printf( "\n" ); } else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { //horribly complex nasty alien land - float humanValue = BG_GetValueOfHuman( &self->client->ps ); + float humanValue = BG_GetValueOfHuman( &self->client->ps ), factor; int frags; int unclaimedFrags = (int)humanValue; - humanValue *= G_RewardFactor( self, attacker ); + factor = G_RewardFactor( self, attacker ); + if( g_debugRewards.integer ) + Com_Printf( "DebugRewards: %d x %.2f = ", (int)humanValue, factor ); + humanValue *= factor; + if( g_debugRewards.integer ) + Com_Printf( "%d", (int)humanValue ); for( i = 0; i < MAX_CLIENTS; i++ ) { @@ -569,6 +586,11 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int G_AddCreditToClient( player->client, frags, qtrue ); player->client->pers.statscounters.earned += frags; + if( g_debugRewards.integer ) + Com_Printf( ", %d/%d evo(s) to #%d for %.1f%% of damage", frags, + (int)EVO_TO_CREDS_RATE, (int)( player - g_entities ), + 100 * percentDamage ); + //can't revist this account later self->credits[ i ] = 0; @@ -611,11 +633,18 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int G_AddCreditToClient( player->client, 1, qtrue ); player->client->pers.statscounters.earned += 1; + if( g_debugRewards.integer ) + Com_Printf( ", 1/%d to #%d (unclaimed)", (int)EVO_TO_CREDS_RATE, + (int)( player - g_entities ) ); + //can't revist this account again self->credits[ topClient ] = 0; } } } + + if( g_debugRewards.integer ) + Com_Printf( "\n" ); } } diff --git a/src/game/g_local.h b/src/game/g_local.h index 8e2ee43..635ceb1 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1513,6 +1513,7 @@ extern vmCvar_t g_specNoclip; extern vmCvar_t g_practise; extern vmCvar_t g_tyrantNerf; +extern vmCvar_t g_debugRewards; extern vmCvar_t g_sdDefenderPenalty; extern vmCvar_t g_sdDestructionBonus; diff --git a/src/game/g_main.c b/src/game/g_main.c index 489f2a8..8cdf049 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -249,6 +249,7 @@ vmCvar_t g_specNoclip; vmCvar_t g_practise; vmCvar_t g_tyrantNerf; +vmCvar_t g_debugRewards; vmCvar_t g_sdDefenderPenalty; vmCvar_t g_sdDestructionBonus; @@ -480,6 +481,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_practise, "g_practise", "0", CVAR_ARCHIVE, 0, qfalse }, { &g_tyrantNerf, "g_tyrantNerf", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_debugRewards, "g_debugRewards", "0", CVAR_ARCHIVE, 0, qfalse }, { &g_sdDefenderPenalty, "g_sdDefenderPenalty", "0", CVAR_ARCHIVE, 0, qtrue }, { &g_sdDestructionBonus, "g_sdDestructionBonus", "0", CVAR_ARCHIVE, 0, qtrue }, }; -- cgit