Skip to content

Commit

Permalink
Merge branch 'master' into msvc6
Browse files Browse the repository at this point in the history
  • Loading branch information
mittorn committed Dec 9, 2015
2 parents fd65658 + 41730e4 commit 782f4b1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions engine/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ convar_t *cl_interp;
convar_t *cl_allow_fragment;
convar_t *cl_lw;
convar_t *cl_trace_events;
convar_t *cl_charset;
convar_t *hud_scale;

//
Expand Down Expand Up @@ -1627,6 +1628,7 @@ void CL_InitLocal( void )
//Cvar_Get( "ex_maxerrordistance", "0", 0, "" );
cl_allow_fragment = Cvar_Get( "cl_allow_fragment", "0", CVAR_ARCHIVE, "allow downloading files directly from game server" );
cl_timeout = Cvar_Get( "cl_timeout", "60", 0, "connect timeout (in seconds)" );
cl_charset = Cvar_Get( "cl_charset", "cp1251", CVAR_ARCHIVE, "1-byte charset to use (iconv style)" );

rcon_client_password = Cvar_Get( "rcon_password", "", 0, "remote control client password" );
rcon_address = Cvar_Get( "rcon_address", "", 0, "remote control address" );
Expand Down
1 change: 1 addition & 0 deletions engine/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ extern convar_t *cl_showfps;
extern convar_t *cl_showpos;
extern convar_t *cl_envshot_size;
extern convar_t *cl_timeout;
extern convar_t *cl_charset;
extern convar_t *cl_nodelta;
extern convar_t *cl_interp;
extern convar_t *cl_crosshair;
Expand Down
26 changes: 22 additions & 4 deletions engine/common/sdl/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,31 @@ void SDLash_WheelEvent(SDL_MouseWheelEvent wheel)

void SDLash_InputEvent(SDL_TextInputEvent input)
{
int i;
int i, f, t;

// Try convert to selected charset
unsigned char buf[32];

const char *in = input.text;
char *out = buf;
SDL_iconv_t cd;
Q_memset( &buf, 0, sizeof( buf ) );
cd = SDL_iconv_open( cl_charset->string, "utf-8" );
if( cd != (SDL_iconv_t)-1 )
{
f = strlen( input.text );
t = 32;
t = SDL_iconv( cd, &in, &f, &out, &t );
}
if( ( t < 0 ) || ( cd == (SDL_iconv_t)-1 ) )
Q_strncpy( buf, input.text, 32 );

// Pass characters one by one to Con_CharEvent
for(i = 0; input.text[i]; ++i)
for(i = 0; buf[i]; ++i)
{
Con_CharEvent( (int)input.text[i] );
Con_CharEvent( (uint)buf[i] );
if( cls.key_dest == key_menu )
UI_CharEvent ( (int)input.text[i] );
UI_CharEvent ( (uint)buf[i] );
}
}

Expand Down

0 comments on commit 782f4b1

Please sign in to comment.