diff options
| author | Paweł Redman <pawel.redman@gmail.com> | 2020-04-08 11:59:46 +0200 | 
|---|---|---|
| committer | Paweł Redman <pawel.redman@gmail.com> | 2020-04-08 11:59:46 +0200 | 
| commit | b1d935932689ac3b71036288a015f76dddba753d (patch) | |
| tree | a156dfb84f9a40677a58dc2caaff91d48186cfad /src/game | |
| parent | 8847ac53638653fd1dbe4d18c5d90e66db434047 (diff) | |
SD reward penalities and bonuses
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/g_active.c | 15 | ||||
| -rw-r--r-- | src/game/g_buildable.c | 52 | ||||
| -rw-r--r-- | src/game/g_combat.c | 29 | ||||
| -rw-r--r-- | src/game/g_local.h | 8 | ||||
| -rw-r--r-- | src/game/g_main.c | 6 | ||||
| -rw-r--r-- | src/game/tremulous.h | 4 | 
6 files changed, 97 insertions, 17 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index b4fc9ee..c857e57 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -888,6 +888,7 @@ void ClientTimerActions( gentity_t *ent, int msec )          ent->health = client->ps.stats[ STAT_MAX_HEALTH ];      } +    ent->client->nearBase = qfalse;      if( ent->client->ps.stats[ STAT_HEALTH ] > 0 && ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )      { @@ -897,16 +898,19 @@ void ClientTimerActions( gentity_t *ent, int msec )        {          ent->client->pers.statscounters.timeinbase++;          level.alienStatsCounters.timeinbase++; +        ent->client->nearBase = qtrue;        }        if( BG_ClassHasAbility( ent->client->ps.stats[ STAT_PCLASS ], SCA_WALLCLIMBER )  )        {          ent->client->pers.statscounters.dretchbasytime++;          level.alienStatsCounters.dretchbasytime++; -    if( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING  || ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING)  -    { -      ent->client->pers.statscounters.jetpackusewallwalkusetime++; -      level.alienStatsCounters.jetpackusewallwalkusetime++; -    } + +        if( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING +            || ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )  +        { +          ent->client->pers.statscounters.jetpackusewallwalkusetime++; +          level.alienStatsCounters.jetpackusewallwalkusetime++; +        }        }      }      else if( ent->client->ps.stats[ STAT_HEALTH ] > 0 && ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) @@ -917,6 +921,7 @@ void ClientTimerActions( gentity_t *ent, int msec )        {          ent->client->pers.statscounters.timeinbase++;          level.humanStatsCounters.timeinbase++; +        ent->client->nearBase = qtrue;        }        if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) )        { diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index de3c800..4e87681 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -671,16 +671,24 @@ void ASpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int    {      if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )      { +      int reward; +        if( self->s.modelindex == BA_A_OVERMIND )        { -        G_AddCreditToClient( attacker->client, OVERMIND_VALUE, qtrue ); -        attacker->client->pers.statscounters.earned += OVERMIND_VALUE; +        reward = OVERMIND_VALUE;        }        else if( self->s.modelindex == BA_A_SPAWN )        { -        G_AddCreditToClient( attacker->client, ASPAWN_VALUE, qtrue ); -        attacker->client->pers.statscounters.earned += ASPAWN_VALUE; +        reward = ASPAWN_VALUE;        } +      else +      { +        reward = ALIEN_BUILDING_VALUE; +      } + +      reward *= G_RewardFactor( self, attacker ); +      G_AddCreditToClient( attacker->client, reward, qtrue ); +      attacker->client->pers.statscounters.earned += reward;      }      else      { @@ -1066,7 +1074,15 @@ void AGeneric_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, i    if( attacker && attacker->client )    { -    if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) +    if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) +    { +      int reward; + +      reward = ALIEN_BUILDING_VALUE * G_RewardFactor( self, attacker ); +      G_AddCreditToClient( attacker->client, reward, qtrue ); +      attacker->client->pers.statscounters.earned += reward; +    } +    else if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )      {        G_TeamCommand( PTE_ALIENS,          va( "print \"%s ^3DESTROYED^7 by teammate %s^7\n\"", @@ -1593,7 +1609,15 @@ void AHovel_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int    if( attacker && attacker->client )    { -    if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) +    if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) +    { +      int reward; + +      reward = ALIEN_BUILDING_VALUE * G_RewardFactor( self, attacker ); +      G_AddCreditToClient( attacker->client, reward, qtrue ); +      attacker->client->pers.statscounters.earned += reward; +    } +    else if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )      {        G_TeamCommand( PTE_ALIENS,          va( "print \"%s ^3DESTROYED^7 by teammate %s^7\n\"", @@ -2696,16 +2720,24 @@ void HSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int    {      if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )      { +      int reward; +        if( self->s.modelindex == BA_H_REACTOR )        { -        G_AddCreditToClient( attacker->client, REACTOR_VALUE, qtrue ); -        attacker->client->pers.statscounters.earned += REACTOR_VALUE; +        reward = REACTOR_VALUE;        }        else if( self->s.modelindex == BA_H_SPAWN )        { -        G_AddCreditToClient( attacker->client, HSPAWN_VALUE, qtrue ); -        attacker->client->pers.statscounters.earned += HSPAWN_VALUE; +        reward = HSPAWN_VALUE;        } +      else +      { +        reward = HUMAN_BUILDING_VALUE; +      } + +      reward *= G_RewardFactor( self, attacker ); +      G_AddCreditToClient( attacker->client, reward, qtrue ); +      attacker->client->pers.statscounters.earned += reward;      }      else      { diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 9fb920f..91c4b31 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -67,6 +67,30 @@ void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker )    self->client->ps.stats[ STAT_VIEWLOCK ] = vectoyaw( dir );  } +/* +============ +G_RewardFactor + +The multiplier for kill and destruction rewards +============ +*/ +float G_RewardFactor( gentity_t *self, gentity_t *attacker ) +{ +  if( !attacker->client ) +    return 1.0f; + +  if( G_TimeTilSuddenDeath( ) > 0 ) +    return 1.0f; + +  if( attacker->client->nearBase ) +    return 1.0f - g_sdDefenderPenalty.value / 100.0f; + +  if( self->s.eType == ET_BUILDABLE ) +    return 1.0f + g_sdDestructionBonus.value / 100.0f; + +  return 1.0f; +} +  // these are just for logging, the client prints its own messages  char *modNames[ ] =  { @@ -126,6 +150,7 @@ char *modNames[ ] =  player_die  ==================  */ +  void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath )  {    gentity_t *ent; @@ -472,6 +497,8 @@ 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 ] ); +      classValue *= G_RewardFactor( self, attacker ); +        for( i = 0; i < MAX_CLIENTS; i++ )        {          int amount; @@ -507,6 +534,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int        int   frags;        int   unclaimedFrags = (int)humanValue; +      humanValue *= G_RewardFactor( self, attacker ); +        for( i = 0; i < MAX_CLIENTS; i++ )        {          player = g_entities + i; diff --git a/src/game/g_local.h b/src/game/g_local.h index 315e95e..8e2ee43 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -574,6 +574,7 @@ struct gclient_s    adminRangeBoosts_t newRange; +  qboolean            nearBase;  }; @@ -1018,7 +1019,8 @@ qboolean  G_SelectiveRadiusDamage( vec3_t origin, gentity_t *attacker, float dam  void      G_Knockback( gentity_t *targ, vec3_t dir, int knockback );  void      body_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath );  void      AddScore( gentity_t *ent, int score ); - +float     G_RewardFactor( gentity_t *self, gentity_t *attacker ); +void      player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod );  void      G_InitDamageLocations( void );  // damage flags @@ -1110,7 +1112,6 @@ void      SpawnCorpse( gentity_t *ent );  void      respawn( gentity_t *ent );  void      BeginIntermission( void );  void      ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles ); -void      player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod );  qboolean  SpotWouldTelefrag( gentity_t *spot );  char     *G_NextNewbieName( gentity_t *ent );  void      G_LogAutobahn( gentity_t *ent, const char *userinfo, int rating, qboolean onConnect ); @@ -1512,6 +1513,9 @@ extern  vmCvar_t  g_specNoclip;  extern  vmCvar_t  g_practise;  extern  vmCvar_t  g_tyrantNerf; +extern  vmCvar_t  g_sdDefenderPenalty; +extern  vmCvar_t  g_sdDestructionBonus; +  void      trap_Printf( const char *fmt );  void      trap_Error( const char *fmt );  int       trap_Milliseconds( void ); diff --git a/src/game/g_main.c b/src/game/g_main.c index adcd6fb..489f2a8 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -249,6 +249,9 @@ vmCvar_t  g_specNoclip;  vmCvar_t  g_practise;  vmCvar_t  g_tyrantNerf; +vmCvar_t  g_sdDefenderPenalty; +vmCvar_t  g_sdDestructionBonus; +  static cvarTable_t   gameCvarTable[ ] =  {    // don't override the cheat state set by the system @@ -476,6 +479,9 @@ static cvarTable_t   gameCvarTable[ ] =    { &g_specNoclip, "g_specNoclip", "0", CVAR_ARCHIVE, 0, qtrue },    { &g_practise, "g_practise", "0", CVAR_ARCHIVE, 0, qfalse },    { &g_tyrantNerf, "g_tyrantNerf", "0", CVAR_ARCHIVE, 0, qfalse }, + +  { &g_sdDefenderPenalty, "g_sdDefenderPenalty", "0", CVAR_ARCHIVE, 0, qtrue }, +  { &g_sdDestructionBonus, "g_sdDestructionBonus", "0", CVAR_ARCHIVE, 0, qtrue },  };  static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] ); diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 2bd267e..4bb12cc 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -619,6 +619,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  #define FREEKILL_ALIEN              EVOS(1)  #define FREEKILL_HUMAN              LEVEL0_VALUE +// Default values for buildings other than Reactors, Overminds and spawns. +#define ALIEN_BUILDING_VALUE        55 +#define HUMAN_BUILDING_VALUE        EVOS(0.25f) +  #define DEFAULT_ALIEN_BUILDPOINTS   "130"  #define DEFAULT_ALIEN_STAGE2_THRESH "20"  #define DEFAULT_ALIEN_STAGE3_THRESH "40"  | 
