summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/edge_version.h3
-rw-r--r--src/game/g_admin.c315
-rw-r--r--src/game/g_admin.h4
-rw-r--r--src/game/g_buildable.c19
-rw-r--r--src/game/g_cmds.c277
-rw-r--r--src/game/g_combat.c54
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_main.c16
-rw-r--r--src/game/g_svcmds.c3
-rw-r--r--src/game/newedge_version.h3
10 files changed, 382 insertions, 313 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_admin.c b/src/game/g_admin.c
index 6c04029..0fbac12 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -164,6 +164,16 @@ g_admin_cmd_t g_admin_cmds[ ] =
"[^7a|h^7]"
},
+ {"m", G_admin_m, qfalse, "say",
+ "send a private message",
+ "[^7name|slot#^7] [^7message^7]"
+ },
+
+ {"mt", G_admin_m, qfalse, "say_team",
+ "send a team-only private message",
+ "[^7name|slot#^7] [^7message^7]"
+ },
+
{"mute", G_admin_mute, qfalse, "mute",
"mute a player",
"[^7name|slot#^7]"
@@ -220,6 +230,21 @@ g_admin_cmd_t g_admin_cmds[ ] =
"[^7id^7]"
},
+ {"say", G_admin_say, qfalse, "say",
+ "say in the public chat",
+ "[^7message^7]"
+ },
+
+ {"say_area", G_admin_say_area, qfalse, "say_area",
+ "say to nearby players",
+ "[^7message^7]"
+ },
+
+ {"say_team", G_admin_say, qfalse, "say_team",
+ "say in the team chat",
+ "[^7message^7]"
+ },
+
{"score_info", G_admin_score_info, qtrue, "score_info",
"display information about player's accumulated score",
"(^7name|slot#^7) [^7newscore^7]"
@@ -278,12 +303,28 @@ g_admin_cmd_t g_admin_cmds[ ] =
"[^7name|slot#^7]"
},
+
+ {"vsay", G_admin_vsay, qfalse, "say",
+ "n/a",
+ "n/a"
+ },
+
+ {"vsay_local", G_admin_vsay, qfalse, "say_team",
+ "n/a",
+ "n/a"
+ },
+
+ {"vsay_team", G_admin_vsay, qfalse, "say_team",
+ "n/a",
+ "n/a"
+ },
+
{
"warn", G_admin_warn, qfalse, "warn",
"warn a player to correct their current activity",
"[^7name|slot#^7] [^7reason^7]"
}
- };
+};
static size_t adminNumCmds = sizeof( g_admin_cmds ) / sizeof( g_admin_cmds[ 0 ] );
@@ -825,8 +866,8 @@ static void admin_log_abort( void )
static void admin_log_end( const qboolean ok )
{
- if( adminLog[ 0 ] )
- G_LogPrintf( "AdminExec: %s: %s\n", ok ? "ok" : "fail", adminLog );
+ if( adminLog[ 0 ] && !ok )
+ G_LogPrintf( "AdminExec: fail: %s\n", adminLog );
admin_log_abort( );
}
@@ -4544,3 +4585,271 @@ void G_admin_writeconfig( void )
{
if ( g_admin_levels ) admin_writeconfig( );
}
+
+/*
+==================
+G_admin_say_area
+==================
+*/
+qboolean G_admin_say_area( gentity_t *ent )
+{
+ int entityList[ MAX_GENTITIES ];
+ int num, i;
+ vec3_t range = { 1000.0f, 1000.0f, 1000.0f };
+ vec3_t mins, maxs;
+ char *msg;
+
+ if( trap_Argc( ) < 2 )
+ {
+ ADMP( "usage: say_area [message]\n" );
+ return qfalse;
+ }
+
+ msg = ConcatArgs( 1 );
+
+ for(i = 0; i < 3; i++ )
+ range[ i ] = g_sayAreaRange.value;
+
+ G_LogPrintf( "SayArea: %d \"%s" S_COLOR_WHITE "\": " S_COLOR_BLUE "%s\n",
+ ent - g_entities, ent->client->pers.netname, msg );
+
+ VectorAdd( ent->s.origin, range, maxs );
+ VectorSubtract( ent->s.origin, range, mins );
+
+ num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
+ for( i = 0; i < num; i++ )
+ G_SayTo( ent, &g_entities[ entityList[ i ] ], SAY_AREA, msg );
+
+ //Send to ADMF_SPEC_ALLCHAT candidates
+ for( i = 0; i < level.maxclients; i++ )
+ {
+ if( g_entities[ i ].client->pers.teamSelection == TEAM_NONE &&
+ G_admin_permission( &g_entities[ i ], ADMF_SPEC_ALLCHAT ) )
+ {
+ G_SayTo( ent, &g_entities[ i ], SAY_AREA, msg );
+ }
+ }
+
+ return qtrue;
+}
+
+
+/*
+==================
+G_admin_say
+==================
+*/
+qboolean G_admin_say( gentity_t *ent )
+{
+ char *p;
+ char cmd[ MAX_TOKEN_CHARS ];
+ saymode_t mode = SAY_ALL;
+
+ if( trap_Argc( ) < 2 )
+ return qfalse;
+
+ trap_Argv( 0, cmd, sizeof( cmd ) );
+ if( Q_stricmp( cmd, "say_team" ) == 0 )
+ mode = SAY_TEAM;
+
+ p = ConcatArgs( 1 );
+
+ G_Say( ent, mode, p );
+ return qtrue;
+}
+
+/*
+==================
+G_admin_vsay
+==================
+*/
+qboolean G_admin_vsay( gentity_t *ent )
+{
+ char arg[MAX_TOKEN_CHARS];
+ char text[ MAX_TOKEN_CHARS ];
+ voiceChannel_t vchan;
+ voice_t *voice;
+ voiceCmd_t *cmd;
+ voiceTrack_t *track;
+ int cmdNum = 0;
+ int trackNum = 0;
+ char voiceName[ MAX_VOICE_NAME_LEN ] = {"default"};
+ char voiceCmd[ MAX_VOICE_CMD_LEN ] = {""};
+ char vsay[ 12 ] = {""};
+ weapon_t weapon;
+
+ if( !ent || !ent->client )
+ return qfalse;
+
+ trap_Argv( 0, arg, sizeof( arg ) );
+ if( trap_Argc( ) < 2 )
+ {
+ trap_SendServerCommand( ent-g_entities, va(
+ "print \"usage: %s command [text] \n\"", arg ) );
+ return qfalse;
+ }
+ if( !level.voices )
+ {
+ trap_SendServerCommand( ent-g_entities, va(
+ "print \"%s: voice system is not installed on this server\n\"", arg ) );
+ return qfalse;
+ }
+ if( !g_voiceChats.integer )
+ {
+ trap_SendServerCommand( ent-g_entities, va(
+ "print \"%s: voice system administratively disabled on this server\n\"",
+ arg ) );
+ return qfalse;
+ }
+ if( !Q_stricmp( arg, "vsay" ) )
+ vchan = VOICE_CHAN_ALL;
+ else if( !Q_stricmp( arg, "vsay_team" ) )
+ vchan = VOICE_CHAN_TEAM;
+ else if( !Q_stricmp( arg, "vsay_local" ) )
+ vchan = VOICE_CHAN_LOCAL;
+ else
+ return qfalse;
+ Q_strncpyz( vsay, arg, sizeof( vsay ) );
+
+ if( ent->client->pers.voice[ 0 ] )
+ Q_strncpyz( voiceName, ent->client->pers.voice, sizeof( voiceName ) );
+ voice = BG_VoiceByName( level.voices, voiceName );
+ if( !voice )
+ {
+ trap_SendServerCommand( ent-g_entities, va(
+ "print \"%s: voice '%s' not found\n\"", vsay, voiceName ) );
+ return qfalse;
+ }
+
+ trap_Argv( 1, voiceCmd, sizeof( voiceCmd ) ) ;
+ cmd = BG_VoiceCmdFind( voice->cmds, voiceCmd, &cmdNum );
+ if( !cmd )
+ {
+ trap_SendServerCommand( ent-g_entities, va(
+ "print \"%s: command '%s' not found in voice '%s'\n\"",
+ vsay, voiceCmd, voiceName ) );
+ return qfalse;
+ }
+
+ // filter non-spec humans by their primary weapon as well
+ weapon = WP_NONE;
+ if( ent->client->sess.spectatorState == SPECTATOR_NOT )
+ {
+ weapon = BG_PrimaryWeapon( ent->client->ps.stats );
+ }
+
+ track = BG_VoiceTrackFind( cmd->tracks, ent->client->pers.teamSelection,
+ ent->client->pers.classSelection, weapon, (int)ent->client->voiceEnthusiasm,
+ &trackNum );
+ if( !track )
+ {
+ trap_SendServerCommand( ent-g_entities, va(
+ "print \"%s: no available track for command '%s', team %d, "
+ "class %d, weapon %d, and enthusiasm %d in voice '%s'\n\"",
+ vsay, voiceCmd, ent->client->pers.teamSelection,
+ ent->client->pers.classSelection, weapon,
+ (int)ent->client->voiceEnthusiasm, voiceName ) );
+ return qfalse;
+ }
+
+ if( !Q_stricmp( ent->client->lastVoiceCmd, cmd->cmd ) )
+ ent->client->voiceEnthusiasm++;
+
+ Q_strncpyz( ent->client->lastVoiceCmd, cmd->cmd,
+ sizeof( ent->client->lastVoiceCmd ) );
+
+ // optional user supplied text
+ trap_Argv( 2, arg, sizeof( arg ) );
+ G_CensorString( text, arg, sizeof( text ), ent );
+
+ switch( vchan )
+ {
+ case VOICE_CHAN_ALL:
+ case VOICE_CHAN_LOCAL:
+ trap_SendServerCommand( -1, va(
+ "voice %d %d %d %d \"%s\"\n",
+ (int)(ent-g_entities), vchan, cmdNum, trackNum, text ) );
+ break;
+ case VOICE_CHAN_TEAM:
+ G_TeamCommand( ent->client->pers.teamSelection, va(
+ "voice %d %d %d %d \"%s\"\n",
+ (int)(ent-g_entities), vchan, cmdNum, trackNum, text ) );
+ break;
+ default:
+ break;
+ }
+
+ return qtrue;
+}
+
+qboolean G_admin_m( gentity_t *ent )
+{
+ int pids[ MAX_CLIENTS ];
+ char name[ MAX_NAME_LENGTH ];
+ char cmd[ 12 ];
+ char text[ MAX_STRING_CHARS ];
+ char *msg;
+ char color;
+ int i, pcount;
+ int count = 0;
+ qboolean teamonly = qfalse;
+ char recipients[ MAX_STRING_CHARS ] = "";
+
+ if( !g_privateMessages.integer && ent )
+ {
+ ADMP( "Sorry, but private messages have been disabled\n" );
+ return qfalse;
+ }
+
+ trap_Argv( 0, cmd, sizeof( cmd ) );
+ if( trap_Argc( ) < 3 )
+ {
+ ADMP( va( "usage: %s [name|slot#] [message]\n", cmd ) );
+ return qfalse;
+ }
+
+ if( !Q_stricmp( cmd, "mt" ) )
+ teamonly = qtrue;
+
+ trap_Argv( 1, name, sizeof( name ) );
+ msg = ConcatArgs( 2 );
+ pcount = G_ClientNumbersFromString( name, pids, MAX_CLIENTS );
+
+ G_CensorString( text, msg, sizeof( text ), ent );
+
+ // send the message
+ for( i = 0; i < pcount; i++ )
+ {
+ if( G_SayTo( ent, &g_entities[ pids[ i ] ],
+ teamonly ? SAY_TPRIVMSG : SAY_PRIVMSG, text ) )
+ {
+ count++;
+ Q_strcat( recipients, sizeof( recipients ), va( "%s" S_COLOR_WHITE ", ",
+ level.clients[ pids[ i ] ].pers.netname ) );
+ }
+ }
+
+ // report the results
+ color = teamonly ? COLOR_CYAN : COLOR_YELLOW;
+
+ if( !count )
+ ADMP( va( "^3No player matching ^7\'%s^7\' ^3to send message to.\n",
+ name ) );
+ else
+ {
+ ADMP( va( "^%cPrivate message: ^7%s\n", color, text ) );
+ // remove trailing ", "
+ recipients[ strlen( recipients ) - 2 ] = '\0';
+ ADMP( va( "^%csent to %i player%s: " S_COLOR_WHITE "%s\n", color, count,
+ count == 1 ? "" : "s", recipients ) );
+
+ G_LogPrintf( "%s: %d \"%s" S_COLOR_WHITE "\" \"%s\": ^%c%s\n",
+ ( teamonly ) ? "TPrivMsg" : "PrivMsg",
+ ( ent ) ? ent - g_entities : -1,
+ ( ent ) ? ent->client->pers.netname : "console",
+ name, color, msg );
+ }
+
+ return qtrue;
+}
+
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index 8132607..6f8cc0b 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -207,6 +207,10 @@ qboolean G_admin_flaglist( gentity_t *ent );
qboolean G_admin_flag( gentity_t *ent );
qboolean G_admin_slap( gentity_t *ent );
qboolean G_admin_stats( gentity_t *ent );
+qboolean G_admin_say_area( gentity_t *ent );
+qboolean G_admin_say( gentity_t *ent );
+qboolean G_admin_vsay( gentity_t *ent );
+qboolean G_admin_m( gentity_t *ent );
g_admin_level_t *G_admin_find_level_for_score( int score );
void G_admin_add_score( gentity_t *ent, int score );
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 19e7199..6d42335 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
@@ -4189,6 +4189,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 );
@@ -4256,7 +4257,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 )
@@ -4304,7 +4311,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_cmds.c b/src/game/g_cmds.c
index eab8631..f3cada7 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -935,11 +935,15 @@ static qboolean G_SayTo( gentity_t *ent, gentity_t *other, saymode_t mode, const
return qfalse;
if( !other->client )
- return qfalse;
+ return qfalse;
if( other->client->pers.connected != CON_CONNECTED )
return qfalse;
+ // ignore messages from people in /ignore list
+ if( Com_ClientListContains( &other->client->sess.ignoreList, (int)( ent - g_entities ) ) )
+ return qfalse;
+
if( ( ent && !OnSameTeam( ent, other ) ) &&
( mode == SAY_TEAM || mode == SAY_AREA || mode == SAY_TPRIVMSG ) )
{
@@ -1007,198 +1011,6 @@ void G_Say( gentity_t *ent, saymode_t mode, const char *chatText )
G_SayTo( ent, other, mode, text );
}
}
-
-/*
-==================
-Cmd_SayArea_f
-==================
-*/
-static void Cmd_SayArea_f( gentity_t *ent )
-{
- int entityList[ MAX_GENTITIES ];
- int num, i;
- vec3_t range = { 1000.0f, 1000.0f, 1000.0f };
- vec3_t mins, maxs;
- char *msg;
-
- if( trap_Argc( ) < 2 )
- {
- ADMP( "usage: say_area [message]\n" );
- return;
- }
-
- msg = ConcatArgs( 1 );
-
- for(i = 0; i < 3; i++ )
- range[ i ] = g_sayAreaRange.value;
-
- G_LogPrintf( "SayArea: %d \"%s" S_COLOR_WHITE "\": " S_COLOR_BLUE "%s\n",
- ent - g_entities, ent->client->pers.netname, msg );
-
- VectorAdd( ent->s.origin, range, maxs );
- VectorSubtract( ent->s.origin, range, mins );
-
- num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
- for( i = 0; i < num; i++ )
- G_SayTo( ent, &g_entities[ entityList[ i ] ], SAY_AREA, msg );
-
- //Send to ADMF_SPEC_ALLCHAT candidates
- for( i = 0; i < level.maxclients; i++ )
- {
- if( g_entities[ i ].client->pers.teamSelection == TEAM_NONE &&
- G_admin_permission( &g_entities[ i ], ADMF_SPEC_ALLCHAT ) )
- {
- G_SayTo( ent, &g_entities[ i ], SAY_AREA, msg );
- }
- }
-}
-
-
-/*
-==================
-Cmd_Say_f
-==================
-*/
-static void Cmd_Say_f( gentity_t *ent )
-{
- char *p;
- char cmd[ MAX_TOKEN_CHARS ];
- saymode_t mode = SAY_ALL;
-
- if( trap_Argc( ) < 2 )
- return;
-
- trap_Argv( 0, cmd, sizeof( cmd ) );
- if( Q_stricmp( cmd, "say_team" ) == 0 )
- mode = SAY_TEAM;
-
- p = ConcatArgs( 1 );
-
- G_Say( ent, mode, p );
-}
-
-/*
-==================
-Cmd_VSay_f
-==================
-*/
-void Cmd_VSay_f( gentity_t *ent )
-{
- char arg[MAX_TOKEN_CHARS];
- char text[ MAX_TOKEN_CHARS ];
- voiceChannel_t vchan;
- voice_t *voice;
- voiceCmd_t *cmd;
- voiceTrack_t *track;
- int cmdNum = 0;
- int trackNum = 0;
- char voiceName[ MAX_VOICE_NAME_LEN ] = {"default"};
- char voiceCmd[ MAX_VOICE_CMD_LEN ] = {""};
- char vsay[ 12 ] = {""};
- weapon_t weapon;
-
- if( !ent || !ent->client )
- Com_Error( ERR_FATAL, "Cmd_VSay_f() called by non-client entity\n" );
-
- trap_Argv( 0, arg, sizeof( arg ) );
- if( trap_Argc( ) < 2 )
- {
- trap_SendServerCommand( ent-g_entities, va(
- "print \"usage: %s command [text] \n\"", arg ) );
- return;
- }
- if( !level.voices )
- {
- trap_SendServerCommand( ent-g_entities, va(
- "print \"%s: voice system is not installed on this server\n\"", arg ) );
- return;
- }
- if( !g_voiceChats.integer )
- {
- trap_SendServerCommand( ent-g_entities, va(
- "print \"%s: voice system administratively disabled on this server\n\"",
- arg ) );
- return;
- }
- if( !Q_stricmp( arg, "vsay" ) )
- vchan = VOICE_CHAN_ALL;
- else if( !Q_stricmp( arg, "vsay_team" ) )
- vchan = VOICE_CHAN_TEAM;
- else if( !Q_stricmp( arg, "vsay_local" ) )
- vchan = VOICE_CHAN_LOCAL;
- else
- return;
- Q_strncpyz( vsay, arg, sizeof( vsay ) );
-
- if( ent->client->pers.voice[ 0 ] )
- Q_strncpyz( voiceName, ent->client->pers.voice, sizeof( voiceName ) );
- voice = BG_VoiceByName( level.voices, voiceName );
- if( !voice )
- {
- trap_SendServerCommand( ent-g_entities, va(
- "print \"%s: voice '%s' not found\n\"", vsay, voiceName ) );
- return;
- }
-
- trap_Argv( 1, voiceCmd, sizeof( voiceCmd ) ) ;
- cmd = BG_VoiceCmdFind( voice->cmds, voiceCmd, &cmdNum );
- if( !cmd )
- {
- trap_SendServerCommand( ent-g_entities, va(
- "print \"%s: command '%s' not found in voice '%s'\n\"",
- vsay, voiceCmd, voiceName ) );
- return;
- }
-
- // filter non-spec humans by their primary weapon as well
- weapon = WP_NONE;
- if( ent->client->sess.spectatorState == SPECTATOR_NOT )
- {
- weapon = BG_PrimaryWeapon( ent->client->ps.stats );
- }
-
- track = BG_VoiceTrackFind( cmd->tracks, ent->client->pers.teamSelection,
- ent->client->pers.classSelection, weapon, (int)ent->client->voiceEnthusiasm,
- &trackNum );
- if( !track )
- {
- trap_SendServerCommand( ent-g_entities, va(
- "print \"%s: no available track for command '%s', team %d, "
- "class %d, weapon %d, and enthusiasm %d in voice '%s'\n\"",
- vsay, voiceCmd, ent->client->pers.teamSelection,
- ent->client->pers.classSelection, weapon,
- (int)ent->client->voiceEnthusiasm, voiceName ) );
- return;
- }
-
- if( !Q_stricmp( ent->client->lastVoiceCmd, cmd->cmd ) )
- ent->client->voiceEnthusiasm++;
-
- Q_strncpyz( ent->client->lastVoiceCmd, cmd->cmd,
- sizeof( ent->client->lastVoiceCmd ) );
-
- // optional user supplied text
- trap_Argv( 2, arg, sizeof( arg ) );
- G_CensorString( text, arg, sizeof( text ), ent );
-
- switch( vchan )
- {
- case VOICE_CHAN_ALL:
- case VOICE_CHAN_LOCAL:
- trap_SendServerCommand( -1, va(
- "voice %d %d %d %d \"%s\"\n",
- (int)(ent-g_entities), vchan, cmdNum, trackNum, text ) );
- break;
- case VOICE_CHAN_TEAM:
- G_TeamCommand( ent->client->pers.teamSelection, va(
- "voice %d %d %d %d \"%s\"\n",
- (int)(ent-g_entities), vchan, cmdNum, trackNum, text ) );
- break;
- default:
- break;
- }
-}
-
/*
==================
Cmd_Where_f
@@ -3637,19 +3449,14 @@ commands_t cmds[ ] = {
{ "itemtoggle", CMD_HUMAN|CMD_LIVING, Cmd_ToggleItem_f },
{ "kill", CMD_TEAM|CMD_LIVING, Cmd_Kill_f },
{ "levelshot", CMD_CHEAT, Cmd_LevelShot_f },
- { "listmaps", CMD_MESSAGE|CMD_INTERMISSION, Cmd_ListMaps_f },
{ "listemoticons", CMD_MESSAGE|CMD_INTERMISSION, Cmd_ListEmoticons_f },
- { "m", CMD_MESSAGE|CMD_INTERMISSION, Cmd_PrivateMessage_f },
+ { "listmaps", CMD_MESSAGE|CMD_INTERMISSION, Cmd_ListMaps_f },
{ "maplog", CMD_MESSAGE|CMD_INTERMISSION, Cmd_MapLog_f },
- { "mt", CMD_MESSAGE|CMD_INTERMISSION, Cmd_PrivateMessage_f },
{ "myscore", 0, Cmd_MyScore_f },
{ "noclip", CMD_CHEAT_TEAM, Cmd_Noclip_f },
{ "notarget", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Notarget_f },
{ "reload", CMD_HUMAN|CMD_LIVING, Cmd_Reload_f },
{ "rotation", CMD_MESSAGE|CMD_INTERMISSION, Cmd_MapRotation_f },
- { "say", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f },
- { "say_area", CMD_MESSAGE|CMD_TEAM|CMD_LIVING, Cmd_SayArea_f },
- { "say_team", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f },
{ "score", CMD_INTERMISSION, ScoreboardMessage },
{ "sell", CMD_HUMAN|CMD_LIVING, Cmd_Sell_f },
{ "setviewpos", CMD_CHEAT_TEAM, Cmd_SetViewpos_f },
@@ -3658,9 +3465,6 @@ commands_t cmds[ ] = {
{ "test", CMD_CHEAT, Cmd_Test_f },
{ "unignore", 0, Cmd_Ignore_f },
{ "vote", 0, Cmd_Vote_f },
- { "vsay", CMD_MESSAGE|CMD_INTERMISSION, Cmd_VSay_f },
- { "vsay_local", CMD_MESSAGE|CMD_INTERMISSION, Cmd_VSay_f },
- { "vsay_team", CMD_MESSAGE|CMD_INTERMISSION, Cmd_VSay_f },
{ "where", 0, Cmd_Where_f }
};
static size_t numCmds = sizeof( cmds ) / sizeof( cmds[ 0 ] );
@@ -3835,75 +3639,6 @@ void Cmd_MyScore_f( gentity_t *ent )
}
}
-void Cmd_PrivateMessage_f( gentity_t *ent )
-{
- int pids[ MAX_CLIENTS ];
- char name[ MAX_NAME_LENGTH ];
- char cmd[ 12 ];
- char text[ MAX_STRING_CHARS ];
- char *msg;
- char color;
- int i, pcount;
- int count = 0;
- qboolean teamonly = qfalse;
- char recipients[ MAX_STRING_CHARS ] = "";
-
- if( !g_privateMessages.integer && ent )
- {
- ADMP( "Sorry, but private messages have been disabled\n" );
- return;
- }
-
- trap_Argv( 0, cmd, sizeof( cmd ) );
- if( trap_Argc( ) < 3 )
- {
- ADMP( va( "usage: %s [name|slot#] [message]\n", cmd ) );
- return;
- }
-
- if( !Q_stricmp( cmd, "mt" ) )
- teamonly = qtrue;
-
- trap_Argv( 1, name, sizeof( name ) );
- msg = ConcatArgs( 2 );
- pcount = G_ClientNumbersFromString( name, pids, MAX_CLIENTS );
-
- G_CensorString( text, msg, sizeof( text ), ent );
-
- // send the message
- for( i = 0; i < pcount; i++ )
- {
- if( G_SayTo( ent, &g_entities[ pids[ i ] ],
- teamonly ? SAY_TPRIVMSG : SAY_PRIVMSG, text ) )
- {
- count++;
- Q_strcat( recipients, sizeof( recipients ), va( "%s" S_COLOR_WHITE ", ",
- level.clients[ pids[ i ] ].pers.netname ) );
- }
- }
-
- // report the results
- color = teamonly ? COLOR_CYAN : COLOR_YELLOW;
-
- if( !count )
- ADMP( va( "^3No player matching ^7\'%s^7\' ^3to send message to.\n",
- name ) );
- else
- {
- ADMP( va( "^%cPrivate message: ^7%s\n", color, text ) );
- // remove trailing ", "
- recipients[ strlen( recipients ) - 2 ] = '\0';
- ADMP( va( "^%csent to %i player%s: " S_COLOR_WHITE "%s\n", color, count,
- count == 1 ? "" : "s", recipients ) );
-
- G_LogPrintf( "%s: %d \"%s" S_COLOR_WHITE "\" \"%s\": ^%c%s\n",
- ( teamonly ) ? "TPrivMsg" : "PrivMsg",
- ( ent ) ? ent - g_entities : -1,
- ( ent ) ? ent->client->pers.netname : "console",
- name, color, msg );
- }
-}
-
/*
=================
Cmd_AdminMessage_f
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/g_svcmds.c b/src/game/g_svcmds.c
index a54a9ad..c9dd825 100644
--- a/src/game/g_svcmds.c
+++ b/src/game/g_svcmds.c
@@ -515,8 +515,6 @@ static void Svcmd_MessageWrapper( void )
if( !Q_stricmp( cmd, "a" ) )
Cmd_AdminMessage_f( NULL );
- else if( !Q_stricmp( cmd, "m" ) )
- Cmd_PrivateMessage_f( NULL );
else if( !Q_stricmp( cmd, "say" ) )
G_Say( NULL, SAY_ALL, ConcatArgs( 1 ) );
else if( !Q_stricmp( cmd, "chat" ) )
@@ -649,7 +647,6 @@ struct svcmd
{ "listmaps", qtrue, Svcmd_ListMapsWrapper },
{ "listemoticons", qtrue, Svcmd_ListEmoticonsWrapper },
{ "loadcensors", qfalse, G_LoadCensors },
- { "m", qtrue, Svcmd_MessageWrapper },
{ "maplog", qtrue, Svcmd_MapLogWrapper },
{ "mapRotation", qfalse, Svcmd_MapRotation_f },
{ "pr", qfalse, Svcmd_Pr_f },
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