summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2010-09-29 18:04:22 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:41 +0000
commit3e5b31af20cb275d777eb2d006b9d525e4f08c7e (patch)
tree4a4273cf565c501a9520a9fc285873c689fe9e3c /src
parent3161697c566765dbc4b3200d159b98c4e233d213 (diff)
* Fix /me in teamsay menu
Diffstat (limited to 'src')
-rw-r--r--src/game/g_cmds.c17
-rw-r--r--src/ui/ui_atoms.c43
2 files changed, 43 insertions, 17 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 01bb8c71..390c6a5b 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -732,22 +732,6 @@ void G_Say( gentity_t *ent, saymode_t mode, const char *chatText )
/*
==================
-Cmd_ActionMessage_f
-
-This is just a wrapper for convenience when speaking from the console
-==================
-*/
-static void Cmd_ActionMessage_f( gentity_t *ent )
-{
- char text[ MAX_SAY_TEXT ];
-
- Com_sprintf( text, sizeof( text ), "/me %s", ConcatArgs( 1 ) );
-
- G_Say( ent, SAY_ALL, text );
-}
-
-/*
-==================
Cmd_SayArea_f
==================
*/
@@ -2871,7 +2855,6 @@ commands_t cmds[ ] = {
{ "levelshot", CMD_CHEAT, Cmd_LevelShot_f },
{ "listmaps", CMD_MESSAGE|CMD_INTERMISSION, Cmd_ListMaps_f },
{ "m", CMD_MESSAGE|CMD_INTERMISSION, Cmd_PrivateMessage_f },
- { "me", CMD_MESSAGE|CMD_INTERMISSION, Cmd_ActionMessage_f },
{ "mt", CMD_MESSAGE|CMD_INTERMISSION, Cmd_PrivateMessage_f },
{ "noclip", CMD_CHEAT_TEAM, Cmd_Noclip_f },
{ "notarget", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Notarget_f },
diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c
index 9c98f867..0d50e286 100644
--- a/src/ui/ui_atoms.c
+++ b/src/ui/ui_atoms.c
@@ -88,6 +88,34 @@ char *UI_Argv( int arg )
return buffer;
}
+char *UI_ConcatArgs( int arg, char *buf, int len )
+{
+ char *p;
+ int c;
+
+ if( len <= 0 )
+ return buf;
+
+ p = buf;
+ c = trap_Argc();
+
+ for( ; arg < c; arg++ )
+ {
+ char *argp = UI_Argv( arg );
+
+ while( *argp && p < &buf[ len - 1 ] )
+ *p++ = *argp++;
+
+ if( p < &buf[ len - 2 ] )
+ *p++ = ' ';
+ else
+ break;
+ }
+
+ *p = '\0';
+
+ return buf;
+}
char *UI_Cvar_VariableString( const char *var_name )
{
@@ -153,12 +181,27 @@ static void UI_MessageMode_f( void )
Menus_ActivateByName( "say" );
}
+static void UI_Me_f( void )
+{
+ char buf[ MAX_SAY_TEXT - 4 ], *cmd;
+
+ UI_ConcatArgs( 1, buf, sizeof( buf ) );
+
+ if( uiInfo.chatTeam )
+ cmd = "say_team";
+ else
+ cmd = "say";
+
+ trap_Cmd_ExecuteText( EXEC_APPEND, va( "%s \"/me %s\"", cmd, buf ) );
+}
+
struct uicmd
{
char *cmd;
void ( *function )( void );
} commands[ ] = {
{ "closemenus", UI_CloseMenus_f },
+ { "me", UI_Me_f },
{ "menu", UI_Menu_f },
{ "messagemode", UI_MessageMode_f },
{ "messagemode2", UI_MessageMode_f },