diff options
author | Andrey Nazarov <skuller@skuller.net> | 2008-06-29 12:32:32 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2008-06-29 12:32:32 +0000 |
commit | e826e5f176f21cd18b3bbc22887a266835ada57c (patch) | |
tree | d25a84a84f9168b16a77fe4ed8b169c9611bbb02 /source/q_field.c | |
parent | 491f1c100e860c45a5d2aa358d58f777cd1cf895 (diff) |
Added client and server side support for 32-bit solids.
New R1Q2 and Q2PRO minor protocol versions, 1905 and 1014.
Use environment variables for game and server features negotiation.
Relax restrictions on quake paths when searching inside pak files.
Made OSS subsystem cvar names consistent with core sound system conventions.
Misc latched cvar handling changes.
Diffstat (limited to 'source/q_field.c')
-rw-r--r-- | source/q_field.c | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/source/q_field.c b/source/q_field.c index 3e8105e..5f9554c 100644 --- a/source/q_field.c +++ b/source/q_field.c @@ -22,9 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // field.c // -#include <config.h> -#include "q_shared.h" -#include "com_public.h" +#include "com_local.h" #include "key_public.h" #include "ref_public.h" #include "q_field.h" @@ -36,13 +34,9 @@ IF_Init */ void IF_Init( inputField_t *field, size_t visibleChars, size_t maxChars, const char *text ) { memset( field, 0, sizeof( *field ) ); - - clamp( maxChars, 1, sizeof( field->text ) ); - clamp( visibleChars, 1, maxChars ); - - field->maxChars = maxChars; - field->visibleChars = visibleChars; + field->maxChars = clamp( maxChars, 1, sizeof( field->text ) ); + field->visibleChars = clamp( visibleChars, 1, maxChars ); if( text ) { field->cursorPos = Q_strncpyz( field->text, text, maxChars ); } @@ -69,7 +63,6 @@ void IF_Replace( inputField_t *field, const char *text ) { #ifndef DEDICATED_ONLY - /* ================ IF_KeyEvent @@ -125,7 +118,7 @@ qboolean IF_KeyEvent( inputField_t *field, int key ) { } if( key == 'c' && Key_IsDown( K_CTRL ) ) { - sys.SetClipboardData( field->text ); + VID_SetClipboardData( field->text ); return qtrue; } @@ -224,41 +217,34 @@ The input line scrolls horizontally if typing goes beyond the right edge. Returns x offset of the rightmost character drawn. ================ */ -int IF_Draw( inputField_t *field, int x, int y, int flags, qhandle_t hFont ) { - char *text; - size_t cursorPos, offset; +int IF_Draw( inputField_t *field, int x, int y, int flags, qhandle_t font ) { + char *text = field->text; + size_t cursorPos = field->cursorPos; + size_t offset = 0; int ret; - if( field->cursorPos > sizeof( field->text ) - 1 ) { + if( cursorPos >= sizeof( field->text ) ) { Com_Error( ERR_FATAL, "IF_Draw: bad field->cursorPos" ); } - text = field->text; - cursorPos = field->cursorPos; - offset = 0; - - /* scroll horizontally */ + // scroll horizontally if( cursorPos > field->visibleChars - 1 ) { cursorPos = field->visibleChars - 1; offset = field->cursorPos - cursorPos; } - - if( !( flags & UI_DRAWCURSOR ) ) { - /* just draw text and return */ - ret = ref.DrawString( x, y, flags, field->visibleChars, - text + offset, hFont ); - return ret; - } - /* draw text */ + // draw text ret = ref.DrawString( x, y, flags, field->visibleChars, - text + offset, hFont ); + text + offset, font ); - /* draw blinking cursor */ - if( ( sys.Milliseconds() >> 8 ) & 1 ) { - int c = Key_GetOverstrikeMode() ? 11 : '_'; - ref.DrawChar( x + cursorPos * CHAR_WIDTH, y, flags, c, hFont ); + if( flags & UI_DRAWCURSOR ) { + // draw blinking cursor + if( ( com_localTime >> 8 ) & 1 ) { + int c = Key_GetOverstrikeMode() ? 11 : '_'; + ref.DrawChar( x + cursorPos * CHAR_WIDTH, y, flags, c, font ); + } } + return ret; } |