diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-03 12:23:37 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:54 +0000 |
commit | 2fc4a2f3c7ffb6bdc2b089d39db36faf0b9fddee (patch) | |
tree | ea838b3086080811d205e919246c0267be285cad /src/game | |
parent | eb8d5fd1bb8e1b6faf512606b45287a4bd607374 (diff) |
* Add Undeference's say_area command
* For now, the range of this is adjustable with g_sayAreaRange. This is temporary to help us to choose a range for Undeference to use when he commits this to Tremulous trunk
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_cmds.c | 45 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_main.c | 2 |
3 files changed, 48 insertions, 0 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 8863f2a2..d920b955 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -770,6 +770,50 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) } } +static void Cmd_SayArea_f( gentity_t *ent ) +{ + int entityList[ MAX_GENTITIES ]; + int num, i; + int color = COLOR_BLUE; + const char *prefix; + vec3_t range = { 1000.0f, 1000.0f, 1000.0f }; + vec3_t mins, maxs; + char *msg = ConcatArgs( 1 ); + char name[ 64 ]; + + for(i = 0; i < 3; i++ ) + range[ i ] = g_sayAreaRange.value; + + if( g_chatTeamPrefix.integer ) + { + prefix = BG_TeamName( ent->client->pers.teamSelection ); + prefix = va( "[%c] ", toupper( *prefix ) ); + } + else + prefix = ""; + + G_LogPrintf( "sayarea: %s%s^7: %s\n", prefix, ent->client->pers.netname, msg ); + Com_sprintf( name, sizeof( name ), "%s<%s%c%c> ", + prefix, ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE ); + + 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_TEAM, color, name, 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_TEAM, color, name, msg ); + } + } +} + /* ================== @@ -3023,6 +3067,7 @@ commands_t cmds[ ] = { { "tell", CMD_MESSAGE, Cmd_Tell_f }, { "callvote", CMD_MESSAGE, Cmd_CallVote_f }, { "callteamvote", CMD_MESSAGE|CMD_TEAM, Cmd_CallTeamVote_f }, + { "say_area", CMD_MESSAGE|CMD_TEAM, Cmd_SayArea_f }, // can be used even during intermission { "say", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, { "say_team", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, diff --git a/src/game/g_local.h b/src/game/g_local.h index c6f0e876..58fbb485 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1157,6 +1157,7 @@ extern vmCvar_t g_currentMapRotation; extern vmCvar_t g_currentMap; extern vmCvar_t g_initialMapRotation; extern vmCvar_t g_chatTeamPrefix; +extern vmCvar_t g_sayAreaRange; extern vmCvar_t g_debugVoices; extern vmCvar_t g_voiceChats; diff --git a/src/game/g_main.c b/src/game/g_main.c index 51899e0d..1f284ea1 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -125,6 +125,7 @@ vmCvar_t g_shove; vmCvar_t g_mapConfigs; vmCvar_t g_chatTeamPrefix; +vmCvar_t g_sayAreaRange; vmCvar_t g_floodMaxDemerits; vmCvar_t g_floodMinTime; @@ -246,6 +247,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_disabledBuildables, "g_disabledBuildables", "", CVAR_ROM, 0, qfalse }, { &g_chatTeamPrefix, "g_chatTeamPrefix", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_sayAreaRange, "g_sayAreaRange", "1000", CVAR_ARCHIVE, 0, qtrue }, { &g_floodMaxDemerits, "g_floodMaxDemerits", "5000", CVAR_ARCHIVE, 0, qfalse }, { &g_floodMinTime, "g_floodMinTime", "2000", CVAR_ARCHIVE, 0, qfalse }, |