diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/edge_version.h | 3 | ||||
| -rw-r--r-- | src/game/g_buildable.c | 19 | ||||
| -rw-r--r-- | src/game/g_combat.c | 54 | ||||
| -rw-r--r-- | src/game/g_local.h | 1 | ||||
| -rw-r--r-- | src/game/g_main.c | 16 | ||||
| -rw-r--r-- | src/game/newedge_version.h | 3 | 
6 files changed, 60 insertions, 36 deletions
diff --git a/src/game/edge_version.h b/src/game/edge_version.h deleted file mode 100644 index 6cf5772..0000000 --- a/src/game/edge_version.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef EDGE_MOD_VERSION -#define EDGE_MOD_VERSION "7.7b" -#endif diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index dbe1f1d..22e8376 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -322,7 +322,7 @@ buildable_t G_IsPowered( vec3_t origin )      return BA_NONE;  } - /* +/*  ================  G_IsGathered @@ -4190,6 +4190,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance    qboolean          invert;    int               contents;    playerState_t     *ps = &ent->client->ps; +  float             d;    // Stop all buildables from interacting with traces    //G_SetBuildableLinkState( qfalse ); @@ -4257,7 +4258,13 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance  	break;        case 2: // Creeps/colonies block building for enemy team  	if( G_IsGathered( TEAM_HUMANS, entity_origin, qfalse, ent ) ) -          reason = IBE_BLOCKEDBYENEMY; +	{ +	  tempent = G_Overmind( ); +	  if( tempent != NULL ) { +	    d = Distance( tempent->s.origin, entity_origin ); +	    if ( d > CREEP_BASESIZE ) reason = IBE_BLOCKEDBYENEMY; +	  } else reason = IBE_BLOCKEDBYENEMY; +	}  	break;        default:          if( G_IsPowered( entity_origin ) != BA_NONE ) @@ -4305,7 +4312,13 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance            reason = IBE_BLOCKEDBYENEMY;        case 2: // Creeps/colonies block building for enemy team  	if( G_IsGathered( TEAM_ALIENS, entity_origin, qfalse, ent ) ) -	reason = IBE_BLOCKEDBYENEMY; +	{ +	  tempent = G_Reactor( ); +	  if( tempent != NULL ) { +	    d = Distance( tempent->s.origin, entity_origin ); +	    if ( d > REACTOR_BASESIZE ) reason = IBE_BLOCKEDBYENEMY; +	  } else reason = IBE_BLOCKEDBYENEMY; +        }  	break;        default:  	if( G_IsCreepHere( entity_origin ) ) diff --git a/src/game/g_combat.c b/src/game/g_combat.c index b0e33e4..966e595 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -194,20 +194,21 @@ float G_CamperRewardBonus(  gentity_t *self )  float G_RewardScaleFactor( gentity_t *self, gentity_t *target )  {    float targetScore; -  if( !target->client ) return 1.0f;    if( level.humanRewardScore <= 0.0f || level.alienRewardScore <= 0.0f ) return 1.0f; -  if( self->client->ps.persistant[ PERS_SCORE ] <= 0 || target->client->ps.persistant[ PERS_SCORE ] <= 0) return 1.0f; -  targetScore = target->client->ps.persistant[ PERS_SCORE ]/self->client->ps.persistant[ PERS_SCORE ]; -  switch( target->client->ps.stats[ STAT_TEAM ] ) { +  switch( self->client->ps.stats[ STAT_TEAM ] ) {    case TEAM_ALIENS: -    targetScore *= level.alienRewardScore/level.humanRewardScore; +    targetScore = level.humanRewardScore/level.alienRewardScore;      break;    case TEAM_HUMANS: -    targetScore *= level.humanRewardScore/level.alienRewardScore; +    targetScore = level.alienRewardScore/level.humanRewardScore;      break;    default:      return 0;    } +  if ( target->client != NULL ) { +    if( self->client->ps.persistant[ PERS_SCORE ] <= 0 || target->client->ps.persistant[ PERS_SCORE ] <= 0) return targetScore; +    targetScore *= 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; @@ -219,31 +220,40 @@ float G_RewardScaleFactor( gentity_t *self, gentity_t *target )  float G_InstantRewardAttacker( gentity_t *self, gentity_t *target, float damage )  {    float value; -  int maxHealth; +  int maxHealth,targetTeam;    if( damage <= 0.f ) return 0.0f;    if( !self->client ) return 0.0f; -  if( !target->client ) return 0.0f; -  if( OnSameTeam( self, target ) ) return 0.0f; -  if( target->s.eType == ET_BUILDABLE ) return 0.0f; -  maxHealth = target->client->ps.stats[ STAT_MAX_HEALTH ]; +  if( target->client != NULL ) { +    maxHealth = target->client->ps.stats[ STAT_MAX_HEALTH ]; +    targetTeam = target->client->ps.stats[ STAT_TEAM ]; +  } else { +    maxHealth = BG_Buildable( target->s.modelindex )->health; +    targetTeam = target->buildableTeam; +  } +  if( targetTeam == self->client->ps.stats[ STAT_TEAM ] ) return 0.0f; -  // Only give credits for attacking players for now    value = damage / maxHealth;    if (value > 1.0f) value = 1.0f; -  value *= G_CamperRewardBonus( target ); -  value *= BG_GetValueOfPlayer( &target->client->ps ); -  if( target->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS) { +  if( target->client != NULL ) { +    value *= G_CamperRewardBonus( target ); +    value *= BG_GetValueOfPlayer( &target->client->ps ); +  } else { +    value *= BG_Buildable( target->s.modelindex )->value; +    value *= g_BuildingCreditsFactor.value; +  } + +  if( targetTeam == TEAM_ALIENS) {      value *= g_InstantRewardMultiplierA.value; -  } else if( target->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) { +  } else if( targetTeam == TEAM_HUMANS ) {      value *= g_InstantRewardMultiplierH.value; -  } else value = 0; +  } else value = 0.f;    value *= G_RewardScaleFactor( self, target ); -  if( value > 0 ) { +  if( value > 0.f ) {      G_AddCreditToClient( self->client, value, qtrue );      if( self->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) {        trap_Cvar_Set( "g_alienCredits", @@ -334,12 +344,12 @@ float G_RewardAttackers( gentity_t *self )        AddScore( player, stageValue ); -      // killing buildables earns score, but not credits -      if( self->s.eType != ET_BUILDABLE ) -      { +      // killing buildables earns score, but not credits unless g_BuildingCreditsFactor > 0 +      if( self->s.eType == ET_BUILDABLE ) stageValue *= g_BuildingCreditsFactor.value; +      if( stageValue > 0 ) {  	// Com_Printf(S_COLOR_YELLOW "Killer: kills = %f deaths = %f percent_of_damage = %f -> factor = %f\n",player->client->pers.kills,player->client->pers.deaths,killValue,G_RewardScaleFactor( player, self, teamFactor) );  	stageValue *= G_RewardScaleFactor( player, self ); -	player->client->pers.kills += killValue; +	player->client->pers.kills += killValue; // NOTE: Building kills will increase this too if g_BuildingCreditsFactor > 0          // add to stage counters          if( player->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) {  	  G_AddCreditToClient( player->client, g_KillRewardMultiplierH.value*stageValue, qtrue ); diff --git a/src/game/g_local.h b/src/game/g_local.h index a8b2323..9cc0ff2 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1380,6 +1380,7 @@ extern  vmCvar_t  g_MinAlienExtraBuildPoints;  extern  vmCvar_t  g_MaxAlienExtraBuildPoints;  extern  vmCvar_t  g_MinHumanExtraBuildPoints;  extern  vmCvar_t  g_MaxHumanExtraBuildPoints; +extern  vmCvar_t  g_BuildingCreditsFactor;  void      trap_Print( const char *fmt );  void      trap_Error( const char *fmt ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 0466d01..2d0c788 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -26,12 +26,9 @@ TREMULOUS EDGE MOD SRC FILE  ===========================================================================  */  #include "g_local.h" -#include "edge_version.h" +#include "newedge_version.h"  #define G_MOD_VERSION "Aardvark 0.5x" SVN_VERSION -#ifndef EDGE_MOD_VERSION -#define EDGE_MOD_VERSION "7.5.x" -#endif  level_locals_t  level;  typedef struct @@ -209,6 +206,8 @@ vmCvar_t  g_MinAlienExtraBuildPoints;  vmCvar_t  g_MaxAlienExtraBuildPoints;  vmCvar_t  g_MinHumanExtraBuildPoints;  vmCvar_t  g_MaxHumanExtraBuildPoints; +vmCvar_t  g_BuildingCreditsFactor; +  // copy cvars that can be set in worldspawn so they can be restored later  static char cv_gravity[ MAX_CVAR_VALUE_STRING ]; @@ -224,7 +223,7 @@ static cvarTable_t   gameCvarTable[ ] =    { NULL, "gamename", GAME_VERSION , CVAR_SERVERINFO | CVAR_ROM, 0, qfalse  },    { NULL, "gamedate", __DATE__ , CVAR_ROM, 0, qfalse  },    { NULL, "g_version", G_MOD_VERSION , CVAR_SERVERINFO | CVAR_ROM, 0, qfalse  }, -  { NULL, "edge_version", EDGE_MOD_VERSION , CVAR_SERVERINFO | CVAR_ROM, 0, qfalse  }, +  { NULL, "newedge_version", NEWEDGE_MOD_VERSION , CVAR_SERVERINFO | CVAR_ROM, 0, qfalse  },    { &g_restarted, "g_restarted", "0", CVAR_ROM, 0, qfalse  },    { &g_lockTeamsAtStart, "g_lockTeamsAtStart", "0", CVAR_ROM, 0, qfalse  },    { NULL, "sv_mapname", "", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse  }, @@ -384,7 +383,8 @@ static cvarTable_t   gameCvarTable[ ] =    { &g_MinAlienExtraBuildPoints, "g_MinAlienExtraBuildPoints", "-800", CVAR_ARCHIVE, 0, qfalse },    { &g_MaxAlienExtraBuildPoints, "g_MaxAlienExtraBuildPoints", "800", CVAR_ARCHIVE, 0, qfalse },    { &g_MinHumanExtraBuildPoints, "g_MinHumanExtraBuildPoints", "-800", CVAR_ARCHIVE, 0, qfalse }, -  { &g_MaxHumanExtraBuildPoints, "g_MaxHumanExtraBuildPoints", "800", CVAR_ARCHIVE, 0, qfalse } +  { &g_MaxHumanExtraBuildPoints, "g_MaxHumanExtraBuildPoints", "800", CVAR_ARCHIVE, 0, qfalse }, +  { &g_BuildingCreditsFactor, "g_BuildingCreditsFactor", "0.25", CVAR_ARCHIVE, 0, qfalse }  };  static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] ); @@ -651,7 +651,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart )    G_Printf( "------- Game Initialization -------\n" );    G_Printf( "gamename: %s\n", GAME_VERSION );    G_Printf( "gamedate: %s\n", __DATE__ ); -  G_Printf( "EDGE VERSION: %s\n", EDGE_MOD_VERSION ); +  G_Printf( "New EDGE version: %s\n", NEWEDGE_MOD_VERSION );    BG_InitMemory( );    // set some level globals @@ -664,7 +664,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart )    level.humanRewardScore = level.alienRewardScore = 0.0f;    level.alienNoBPFlashTime = level.humanNoBPFlashTime = -1;    trap_Cvar_Set( "g_version", G_MOD_VERSION ); -  trap_Cvar_Set( "edge_version", EDGE_MOD_VERSION ); +  trap_Cvar_Set( "newedge_version", NEWEDGE_MOD_VERSION );    if( g_logFile.string[ 0 ] )    {      if( g_logFileSync.integer ) diff --git a/src/game/newedge_version.h b/src/game/newedge_version.h new file mode 100644 index 0000000..39ca7bc --- /dev/null +++ b/src/game/newedge_version.h @@ -0,0 +1,3 @@ +#ifndef NEWEDGE_MOD_VERSION +#define NEWEDGE_MOD_VERSION "7.7b" +#endif  | 
