diff options
author | Tremulous Test Server <tremtest@d1stkfactory> | 2015-07-05 08:59:48 +0000 |
---|---|---|
committer | Tremulous Test Server <tremtest@d1stkfactory> | 2015-07-05 08:59:48 +0000 |
commit | 81eee170fd08b98d4f6cd469a42ac9a6295fbb4d (patch) | |
tree | 4c83a6bc79847d84262e8457d76a885ec701d214 /src/game | |
parent | 0918eb3bcdefd0d6ee4bd573b761454c99f032f6 (diff) |
Changed the way reward scaling works and reintroduced team,player reward factors.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_combat.c | 16 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_main.c | 10 |
3 files changed, 18 insertions, 10 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 397bde0..f703d83 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -191,30 +191,32 @@ float G_CamperRewardBonus( gentity_t *self ) return 1.0f; } +#define REWARDPOWER(x) pow((float)(x),g_RewardFactorPower.value) +#define REWARDSCALE(a,b) (((a) > 0.0f && (b) > 0.0f) ? (a)/(b) : 1.0f) +#define REWARDFACTOR(a,b) MIN(MAX(REWARDSCALE(REWARDPOWER(a),REWARDPOWER(b)),g_MinRewardFactor.value),g_MaxRewardFactor.value) float G_RewardScaleFactor( gentity_t *self, gentity_t *target ) { float targetScore; if( level.humanRewardScore <= 0.0f || level.alienRewardScore <= 0.0f ) return 1.0f; switch( self->client->ps.stats[ STAT_TEAM ] ) { case TEAM_ALIENS: - targetScore = level.humanRewardScore/level.alienRewardScore; + targetScore = g_TeamRewardFactor.value*REWARDFACTOR(level.humanRewardScore,level.alienRewardScore); break; case TEAM_HUMANS: - targetScore = level.alienRewardScore/level.humanRewardScore; + targetScore = g_TeamRewardFactor.value*REWARDFACTOR(level.alienRewardScore,level.humanRewardScore); break; default: return 0.0f; } if ( target->client != NULL ) { - if( self->client->ps.persistant[ PERS_SCORE ] > 0 && target->client->ps.persistant[ PERS_SCORE ] > 0) - targetScore *= pow(target->client->ps.persistant[ PERS_SCORE ],g_RewardFactorPower.value)/pow(self->client->ps.persistant[ PERS_SCORE ],g_RewardFactorPower.value); + targetScore += g_PlayerRewardFactor.value*REWARDFACTOR(target->client->ps.persistant[ PERS_SCORE ],self->client->ps.persistant[ PERS_SCORE ]); } - targetScore *= 1.0f-g_ConstantRewardFactor.value; targetScore += g_ConstantRewardFactor.value; - if (targetScore < g_MinRewardFactor.value) targetScore = g_MinRewardFactor.value; - else if (targetScore > g_MaxRewardFactor.value) targetScore = g_MaxRewardFactor.value; return targetScore; } +#undef REWARDFACTOR +#undef REWARDSCALE +#undef REWARDPOWER /* Instantly reward the current attacker */ float G_InstantRewardAttacker( gentity_t *self, gentity_t *target, float damage ) diff --git a/src/game/g_local.h b/src/game/g_local.h index c968642..961bb15 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1350,6 +1350,8 @@ extern vmCvar_t g_InstantRewardMultiplierH; extern vmCvar_t g_KillRewardMultiplierA; extern vmCvar_t g_KillRewardMultiplierH; extern vmCvar_t g_ConstantRewardFactor; +extern vmCvar_t g_TeamRewardFactor; +extern vmCvar_t g_PlayerRewardFactor; extern vmCvar_t g_MinRewardFactor; extern vmCvar_t g_MaxRewardFactor; extern vmCvar_t g_RewardFactorPower; diff --git a/src/game/g_main.c b/src/game/g_main.c index 1efc039..a07347e 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -187,6 +187,8 @@ vmCvar_t g_InstantRewardMultiplierH; vmCvar_t g_KillRewardMultiplierA; vmCvar_t g_KillRewardMultiplierH; vmCvar_t g_ConstantRewardFactor; +vmCvar_t g_TeamRewardFactor; +vmCvar_t g_PlayerRewardFactor; vmCvar_t g_MinRewardFactor; vmCvar_t g_MaxRewardFactor; vmCvar_t g_RewardFactorPower; @@ -362,9 +364,11 @@ static cvarTable_t gameCvarTable[ ] = { &g_InstantRewardMultiplierH, "g_InstantRewardMultiplierH", "1", CVAR_ARCHIVE, 0, qfalse }, { &g_KillRewardMultiplierA, "g_KillRewardMultiplierA", "1", CVAR_ARCHIVE, 0, qfalse }, { &g_KillRewardMultiplierH, "g_KillRewardMultiplierH", "1", CVAR_ARCHIVE, 0, qfalse }, - { &g_ConstantRewardFactor, "g_ConstantRewardFactor", "0", CVAR_ARCHIVE, 0, qfalse }, - { &g_MinRewardFactor, "g_MinRewardFactor", "0.2", CVAR_ARCHIVE, 0, qfalse }, - { &g_MaxRewardFactor, "g_MaxRewardFactor", "5.0", CVAR_ARCHIVE, 0, qfalse }, + { &g_ConstantRewardFactor, "g_ConstantRewardFactor", "0.2", CVAR_ARCHIVE, 0, qfalse }, + { &g_TeamRewardFactor, "g_TeamRewardFactor", "0.6", CVAR_ARCHIVE, 0, qfalse }, + { &g_PlayerRewardFactor, "g_PlayerRewardFactor", "0.2", CVAR_ARCHIVE, 0, qfalse }, + { &g_MinRewardFactor, "g_MinRewardFactor", "0.33", CVAR_ARCHIVE, 0, qfalse }, + { &g_MaxRewardFactor, "g_MaxRewardFactor", "3.0", CVAR_ARCHIVE, 0, qfalse }, { &g_RewardFactorPower, "g_RewardFactorPower", "0.3025", CVAR_ARCHIVE, 0, qfalse }, { &g_TimerPeriod, "g_TimerPeriod", "0", CVAR_ARCHIVE, 0, qfalse }, { &g_TimerCommand, "g_TimerCommand", "", CVAR_ARCHIVE, 0, qfalse }, |