06 Nov 2007
This commit is contained in:
parent
0bed22f0be
commit
a7ee473473
|
@ -6,10 +6,6 @@
|
|||
Разработать концепцию языка VirtualC\VirtualC++ (базируется на QuakeC)
|
||||
представить func_t как структуру(возвращаемые значения и аргументы)
|
||||
|
||||
1. Перенести сетевой протокол из ку3 (huffman compressed)
|
||||
2. подключить roqlib
|
||||
3. переписать cvar-систему и cmd систему
|
||||
|
||||
Quake1 Quake2
|
||||
SV_MoveBounds SV_TraceBounds
|
||||
SV_Move SV_Trace
|
||||
|
@ -21,6 +17,19 @@ SV_ClipToLinks SV_ClipMoveToEntities
|
|||
studioframeadvance
|
||||
studiorewindframe
|
||||
|
||||
length = maxchars
|
||||
|
||||
widthInChars = visible_length
|
||||
maxchars = length
|
||||
scroll = visible_offset
|
||||
|
||||
Полная имплементация и подгонка уже существующих систем:
|
||||
1. Исправить работу cmd для командной строки OK
|
||||
2. Исправить работу кнопок для меню OK
|
||||
3. удалить поддержку джойстика OK
|
||||
4. переписать Field_Key для поддержки новых возможностей OK
|
||||
5. дописать проигрывание roq файлов
|
||||
|
||||
//==================================================
|
||||
// то, что уже готово
|
||||
//==================================================
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,10 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "client.h"
|
||||
|
||||
cvar_t *con_notifytime;
|
||||
cvar_t *con_notifytime;
|
||||
cvar_t *con_speed;
|
||||
|
||||
vec4_t console_color = {1.0, 1.0, 1.0, 1.0};
|
||||
extern cvar_t *scr_conspeed;
|
||||
int g_console_field_width = 78;
|
||||
|
||||
#define NUM_CON_TIMES 4
|
||||
|
@ -44,7 +44,7 @@ typedef struct
|
|||
|
||||
float xadjust; // for wide aspect screens
|
||||
|
||||
float displayFrac; // aproaches finalFrac at scr_conspeed
|
||||
float displayFrac; // aproaches finalFrac at con_speed
|
||||
float finalFrac; // 0.0 to 1.0 lines of console to display
|
||||
|
||||
int vislines; // in scanlines
|
||||
|
@ -339,6 +339,7 @@ void Con_Init (void)
|
|||
|
||||
// register our commands
|
||||
con_notifytime = Cvar_Get ("con_notifytime", "3", 0);
|
||||
con_speed = Cvar_Get ("con_speed", "3", 0);
|
||||
|
||||
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
|
||||
Cmd_AddCommand ("togglechat", Con_ToggleChat_f);
|
||||
|
@ -646,32 +647,24 @@ void Con_DrawConsole( void )
|
|||
Con_CheckResize ();
|
||||
|
||||
// if disconnected, render console full screen
|
||||
if ( cls.state == ca_disconnected || cls.state == ca_connecting)
|
||||
if( cls.state == ca_connecting)
|
||||
{
|
||||
Con_DrawSolidConsole( 1.0 );
|
||||
Con_DrawSolidConsole( 0.5 );
|
||||
SCR_FillRect( 0, SCREEN_HEIGHT/2, SCREEN_WIDTH, SCREEN_HEIGHT, g_color_table[0] );
|
||||
}
|
||||
|
||||
if (cls.state != ca_active || !cl.refresh_prepped)
|
||||
{
|
||||
// connected, but can't render
|
||||
if(cl.cinematictime > 0) SCR_DrawCinematic();
|
||||
else SCR_FillRect( 0, SCREEN_HEIGHT/2, SCREEN_WIDTH, SCREEN_HEIGHT/2, COLOR_0 );
|
||||
Con_DrawSolidConsole (0.5);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( con.displayFrac )
|
||||
// if disconnected, render console full screen
|
||||
if ( cls.state == ca_disconnected )
|
||||
{
|
||||
Con_DrawSolidConsole( con.displayFrac );
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw notify lines
|
||||
if ( cls.state == ca_active )
|
||||
if(cls.key_dest != key_menu && cls.key_dest != key_game)
|
||||
{
|
||||
Con_DrawNotify ();
|
||||
Con_DrawSolidConsole( 1.0 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( con.displayFrac ) Con_DrawSolidConsole( con.displayFrac );
|
||||
else if ( cls.state == ca_active ) Con_DrawNotify(); // draw notify lines
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -690,13 +683,13 @@ void Con_RunConsole( void )
|
|||
|
||||
if (con.finalFrac < con.displayFrac)
|
||||
{
|
||||
con.displayFrac -= scr_conspeed->value*cls.frametime;
|
||||
con.displayFrac -= con_speed->value*cls.frametime;
|
||||
if (con.finalFrac > con.displayFrac)
|
||||
con.displayFrac = con.finalFrac;
|
||||
}
|
||||
else if (con.finalFrac > con.displayFrac)
|
||||
{
|
||||
con.displayFrac += scr_conspeed->value*cls.frametime;
|
||||
con.displayFrac += con_speed->value*cls.frametime;
|
||||
if (con.finalFrac < con.displayFrac)
|
||||
con.displayFrac = con.finalFrac;
|
||||
}
|
||||
|
|
|
@ -496,8 +496,9 @@ void CL_SendCmd (void)
|
|||
MSG_WriteString (&cls.netchan.message, Cvar_Userinfo() );
|
||||
}
|
||||
|
||||
if (cmd->buttons && cl.cinematictime > 0 && !cl.attractloop && cls.realtime - cl.cinematictime > 1.0f)
|
||||
{ // skip the rest of the cinematic
|
||||
if (cmd->buttons && cls.state == ca_cinematic && !cl.attractloop)
|
||||
{
|
||||
// skip the rest of the cinematic
|
||||
SCR_FinishCinematic ();
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ void CL_DrawInventory (void)
|
|||
bind = "";
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
if(keys[j].binding && !strcasecmp(keys[j].binding, binding))
|
||||
if(Key_IsBind(j) && !strcasecmp(Key_IsBind(j), binding))
|
||||
{
|
||||
bind = Key_KeynumToString(j);
|
||||
break;
|
||||
|
|
|
@ -1,173 +1,107 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// cl_keys.c - client key events
|
||||
//=======================================================================
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
#include "client.h"
|
||||
|
||||
/*
|
||||
typedef struct key_s
|
||||
{
|
||||
bool down;
|
||||
int repeats; // if > 1, it is autorepeating
|
||||
char *binding;
|
||||
} key_t;
|
||||
|
||||
key up events are sent even if in console mode
|
||||
|
||||
*/
|
||||
bool key_overstrikeMode;
|
||||
bool anykeydown;
|
||||
key_t keys[256];
|
||||
field_t chatField;
|
||||
field_t g_consoleField;
|
||||
static field_t *completionField;
|
||||
field_t historyEditLines[COMMAND_HISTORY];
|
||||
static const char *completionString;
|
||||
static char shortestMatch[MAX_TOKEN_CHARS];
|
||||
|
||||
static int matchCount;
|
||||
int nextHistoryLine;// the last line in the history buffer, not masked
|
||||
int historyLine; // the line being displayed from history buffer will be <= nextHistoryLine
|
||||
|
||||
typedef struct
|
||||
typedef struct keyname_s
|
||||
{
|
||||
char *name;
|
||||
int keynum;
|
||||
int keynum;
|
||||
} keyname_t;
|
||||
|
||||
field_t historyEditLines[COMMAND_HISTORY];
|
||||
field_t g_consoleField;
|
||||
field_t chatField;
|
||||
key_t keys[256];
|
||||
|
||||
int nextHistoryLine;// the last line in the history buffer, not masked
|
||||
int historyLine; // the line being displayed from history buffer will be <= nextHistoryLine
|
||||
bool key_overstrikeMode;
|
||||
bool anykeydown;
|
||||
bool chat_team;
|
||||
|
||||
// auto-complete stuff
|
||||
static field_t *completionField;
|
||||
static const char *completionString;
|
||||
static char shortestMatch[MAX_TOKEN_CHARS];
|
||||
static int matchCount;
|
||||
|
||||
keyname_t keynames[] =
|
||||
{
|
||||
{"TAB", K_TAB},
|
||||
{"ENTER", K_ENTER},
|
||||
{"ESCAPE", K_ESCAPE},
|
||||
{"SPACE", K_SPACE},
|
||||
{"BACKSPACE", K_BACKSPACE},
|
||||
{"UPARROW", K_UPARROW},
|
||||
{"DOWNARROW", K_DOWNARROW},
|
||||
{"LEFTARROW", K_LEFTARROW},
|
||||
{"RIGHTARROW", K_RIGHTARROW},
|
||||
|
||||
{"ALT", K_ALT},
|
||||
{"CTRL", K_CTRL},
|
||||
{"SHIFT", K_SHIFT},
|
||||
|
||||
{"COMMAND", K_COMMAND},
|
||||
|
||||
{"CAPSLOCK", K_CAPSLOCK},
|
||||
|
||||
|
||||
{"F1", K_F1},
|
||||
{"F2", K_F2},
|
||||
{"F3", K_F3},
|
||||
{"F4", K_F4},
|
||||
{"F5", K_F5},
|
||||
{"F6", K_F6},
|
||||
{"F7", K_F7},
|
||||
{"F8", K_F8},
|
||||
{"F9", K_F9},
|
||||
{"F10", K_F10},
|
||||
{"F11", K_F11},
|
||||
{"F12", K_F12},
|
||||
|
||||
{"INS", K_INS},
|
||||
{"DEL", K_DEL},
|
||||
{"PGDN", K_PGDN},
|
||||
{"PGUP", K_PGUP},
|
||||
{"HOME", K_HOME},
|
||||
{"END", K_END},
|
||||
|
||||
{"MOUSE1", K_MOUSE1},
|
||||
{"MOUSE2", K_MOUSE2},
|
||||
{"MOUSE3", K_MOUSE3},
|
||||
{"MOUSE4", K_MOUSE4},
|
||||
{"MOUSE5", K_MOUSE5},
|
||||
{"TAB", K_TAB},
|
||||
{"ENTER", K_ENTER},
|
||||
{"ESCAPE", K_ESCAPE},
|
||||
{"SPACE", K_SPACE},
|
||||
{"BACKSPACE", K_BACKSPACE},
|
||||
{"UPARROW", K_UPARROW},
|
||||
{"DOWNARROW", K_DOWNARROW},
|
||||
{"LEFTARROW", K_LEFTARROW},
|
||||
{"RIGHTARROW", K_RIGHTARROW},
|
||||
{"ALT", K_ALT},
|
||||
{"CTRL", K_CTRL},
|
||||
{"SHIFT", K_SHIFT},
|
||||
{"COMMAND", K_COMMAND},
|
||||
{"CAPSLOCK", K_CAPSLOCK},
|
||||
{"F1", K_F1},
|
||||
{"F2", K_F2},
|
||||
{"F3", K_F3},
|
||||
{"F4", K_F4},
|
||||
{"F5", K_F5},
|
||||
{"F6", K_F6},
|
||||
{"F7", K_F7},
|
||||
{"F8", K_F8},
|
||||
{"F9", K_F9},
|
||||
{"F10", K_F10},
|
||||
{"F11", K_F11},
|
||||
{"F12", K_F12},
|
||||
{"INS", K_INS},
|
||||
{"DEL", K_DEL},
|
||||
{"PGDN", K_PGDN},
|
||||
{"PGUP", K_PGUP},
|
||||
{"HOME", K_HOME},
|
||||
{"END", K_END},
|
||||
|
||||
// mouse buttouns
|
||||
{"MOUSE1", K_MOUSE1},
|
||||
{"MOUSE2", K_MOUSE2},
|
||||
{"MOUSE3", K_MOUSE3},
|
||||
{"MOUSE4", K_MOUSE4},
|
||||
{"MOUSE5", K_MOUSE5},
|
||||
{"MWHEELUP", K_MWHEELUP },
|
||||
{"MWHEELDOWN", K_MWHEELDOWN },
|
||||
|
||||
{"JOY1", K_JOY1},
|
||||
{"JOY2", K_JOY2},
|
||||
{"JOY3", K_JOY3},
|
||||
{"JOY4", K_JOY4},
|
||||
{"JOY5", K_JOY5},
|
||||
{"JOY6", K_JOY6},
|
||||
{"JOY7", K_JOY7},
|
||||
{"JOY8", K_JOY8},
|
||||
{"JOY9", K_JOY9},
|
||||
{"JOY10", K_JOY10},
|
||||
{"JOY11", K_JOY11},
|
||||
{"JOY12", K_JOY12},
|
||||
{"JOY13", K_JOY13},
|
||||
{"JOY14", K_JOY14},
|
||||
{"JOY15", K_JOY15},
|
||||
{"JOY16", K_JOY16},
|
||||
{"JOY17", K_JOY17},
|
||||
{"JOY18", K_JOY18},
|
||||
{"JOY19", K_JOY19},
|
||||
{"JOY20", K_JOY20},
|
||||
{"JOY21", K_JOY21},
|
||||
{"JOY22", K_JOY22},
|
||||
{"JOY23", K_JOY23},
|
||||
{"JOY24", K_JOY24},
|
||||
{"JOY25", K_JOY25},
|
||||
{"JOY26", K_JOY26},
|
||||
{"JOY27", K_JOY27},
|
||||
{"JOY28", K_JOY28},
|
||||
{"JOY29", K_JOY29},
|
||||
{"JOY30", K_JOY30},
|
||||
{"JOY31", K_JOY31},
|
||||
{"JOY32", K_JOY32},
|
||||
|
||||
{"AUX1", K_AUX1},
|
||||
{"AUX2", K_AUX2},
|
||||
{"AUX3", K_AUX3},
|
||||
{"AUX4", K_AUX4},
|
||||
{"AUX5", K_AUX5},
|
||||
{"AUX6", K_AUX6},
|
||||
{"AUX7", K_AUX7},
|
||||
{"AUX8", K_AUX8},
|
||||
{"AUX9", K_AUX9},
|
||||
{"AUX10", K_AUX10},
|
||||
{"AUX11", K_AUX11},
|
||||
{"AUX12", K_AUX12},
|
||||
{"AUX13", K_AUX13},
|
||||
{"AUX14", K_AUX14},
|
||||
{"AUX15", K_AUX15},
|
||||
{"AUX16", K_AUX16},
|
||||
|
||||
{"KP_HOME", K_KP_HOME },
|
||||
{"KP_UPARROW", K_KP_UPARROW },
|
||||
{"KP_PGUP", K_KP_PGUP },
|
||||
{"KP_HOME", K_KP_HOME },
|
||||
{"KP_UPARROW", K_KP_UPARROW },
|
||||
{"KP_PGUP", K_KP_PGUP },
|
||||
{"KP_LEFTARROW", K_KP_LEFTARROW },
|
||||
{"KP_5", K_KP_5 },
|
||||
{"KP_5", K_KP_5 },
|
||||
{"KP_RIGHTARROW", K_KP_RIGHTARROW },
|
||||
{"KP_END", K_KP_END },
|
||||
{"KP_END", K_KP_END },
|
||||
{"KP_DOWNARROW", K_KP_DOWNARROW },
|
||||
{"KP_PGDN", K_KP_PGDN },
|
||||
{"KP_ENTER", K_KP_ENTER },
|
||||
{"KP_INS", K_KP_INS },
|
||||
{"KP_DEL", K_KP_DEL },
|
||||
{"KP_SLASH", K_KP_SLASH },
|
||||
{"KP_MINUS", K_KP_MINUS },
|
||||
{"KP_PLUS", K_KP_PLUS },
|
||||
{"KP_NUMLOCK", K_KP_NUMLOCK },
|
||||
{"KP_STAR", K_KP_STAR },
|
||||
{"KP_EQUALS", K_KP_EQUALS },
|
||||
{"KP_PGDN", K_KP_PGDN },
|
||||
{"KP_ENTER", K_KP_ENTER },
|
||||
{"KP_INS", K_KP_INS },
|
||||
{"KP_DEL", K_KP_DEL },
|
||||
{"KP_SLASH", K_KP_SLASH },
|
||||
{"KP_MINUS", K_KP_MINUS },
|
||||
{"KP_PLUS", K_KP_PLUS },
|
||||
{"KP_NUMLOCK", K_KP_NUMLOCK },
|
||||
{"KP_STAR", K_KP_STAR },
|
||||
{"KP_EQUALS", K_KP_EQUALS },
|
||||
{"PAUSE", K_PAUSE},
|
||||
|
||||
{"PAUSE", K_PAUSE},
|
||||
|
||||
{"SEMICOLON", ';'}, // because a raw semicolon seperates commands
|
||||
|
||||
{NULL,0}
|
||||
// raw semicolon seperates commands
|
||||
{"SEMICOLON", ';'},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -223,7 +157,7 @@ static void PrintMatches( const char *s, const char *m )
|
|||
{
|
||||
if(!strnicmp( s, shortestMatch, strlen( shortestMatch )))
|
||||
if(m && *m) Msg( " %s ^3\"%s\"\n", s, m );
|
||||
else Msg( " %s\n", s );
|
||||
else Msg( " %s\n", s ); // variable or command without description
|
||||
}
|
||||
|
||||
static void keyConcatArgs( void )
|
||||
|
@ -428,6 +362,8 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
|||
{
|
||||
int len;
|
||||
|
||||
Msg("Field_KeyDownEvent %s, key %d\n", Key_KeynumToString(key), key );
|
||||
|
||||
// shift-insert is paste
|
||||
if((( key == K_INS ) || ( key == K_KP_INS )) && keys[K_SHIFT].down )
|
||||
{
|
||||
|
@ -435,6 +371,13 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
|||
return;
|
||||
}
|
||||
|
||||
// ctrl+v is paste
|
||||
if( key == 'v' && keys[K_CTRL].down )
|
||||
{
|
||||
Field_Paste( edit );
|
||||
return;
|
||||
}
|
||||
|
||||
len = strlen( edit->buffer );
|
||||
|
||||
if ( key == K_DEL )
|
||||
|
@ -445,44 +388,39 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
|||
}
|
||||
return;
|
||||
}
|
||||
if ( key == K_RIGHTARROW )
|
||||
{
|
||||
if ( edit->cursor < len )
|
||||
{
|
||||
edit->cursor++;
|
||||
}
|
||||
if ( edit->cursor >= edit->scroll + edit->widthInChars && edit->cursor <= len )
|
||||
{
|
||||
edit->scroll++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( key == K_LEFTARROW )
|
||||
if ( key == K_BACKSPACE )
|
||||
{
|
||||
if ( edit->cursor > 0 )
|
||||
{
|
||||
memmove( edit->buffer + edit->cursor - 1, edit->buffer + edit->cursor, len - edit->cursor + 1 );
|
||||
edit->cursor--;
|
||||
}
|
||||
if ( edit->cursor < edit->scroll )
|
||||
{
|
||||
edit->scroll--;
|
||||
if ( edit->scroll ) edit->scroll--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( key == K_RIGHTARROW )
|
||||
{
|
||||
if ( edit->cursor < len ) edit->cursor++;
|
||||
if ( edit->cursor >= edit->scroll + edit->widthInChars && edit->cursor <= len )
|
||||
edit->scroll++;
|
||||
return;
|
||||
}
|
||||
if ( key == K_LEFTARROW )
|
||||
{
|
||||
if ( edit->cursor > 0 ) edit->cursor--;
|
||||
if ( edit->cursor < edit->scroll ) edit->scroll--;
|
||||
return;
|
||||
}
|
||||
if ( key == K_HOME || ( tolower(key) == 'a' && keys[K_CTRL].down ))
|
||||
{
|
||||
edit->cursor = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( key == K_END || ( tolower(key) == 'e' && keys[K_CTRL].down ))
|
||||
{
|
||||
edit->cursor = len;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( key == K_INS )
|
||||
{
|
||||
key_overstrikeMode = !key_overstrikeMode;
|
||||
|
@ -499,19 +437,20 @@ void Field_CharEvent( field_t *edit, int ch )
|
|||
{
|
||||
int len;
|
||||
|
||||
Msg("Field_CharEvent %s, key %d\n", Key_KeynumToString(ch), ch );
|
||||
|
||||
if ( ch == 'v' - 'a' + 1 )
|
||||
{
|
||||
// ctrl-v is paste
|
||||
Field_Paste( edit );
|
||||
return;
|
||||
}
|
||||
if ( ch == 'c' - 'a' + 1 )
|
||||
if ( ch == 'c' - 'a' + 1)
|
||||
{
|
||||
// ctrl-c clears the field
|
||||
Field_Clear( edit );
|
||||
return;
|
||||
}
|
||||
|
||||
len = strlen( edit->buffer );
|
||||
|
||||
if ( ch == 'h' - 'a' + 1 )
|
||||
|
@ -521,10 +460,7 @@ void Field_CharEvent( field_t *edit, int ch )
|
|||
{
|
||||
memmove( edit->buffer + edit->cursor - 1, edit->buffer + edit->cursor, len + 1 - edit->cursor );
|
||||
edit->cursor--;
|
||||
if ( edit->cursor < edit->scroll )
|
||||
{
|
||||
edit->scroll--;
|
||||
}
|
||||
if( edit->cursor < edit->scroll ) edit->scroll--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -560,15 +496,8 @@ void Field_CharEvent( field_t *edit, int ch )
|
|||
edit->buffer[edit->cursor] = ch;
|
||||
edit->cursor++;
|
||||
}
|
||||
|
||||
if ( edit->cursor >= edit->widthInChars )
|
||||
{
|
||||
edit->scroll++;
|
||||
}
|
||||
if ( edit->cursor == len + 1)
|
||||
{
|
||||
edit->buffer[edit->cursor] = 0;
|
||||
}
|
||||
if( edit->cursor >= edit->widthInChars ) edit->scroll++;
|
||||
if( edit->cursor == len + 1) edit->buffer[edit->cursor] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -608,29 +537,12 @@ void Key_Console(int key)
|
|||
g_consoleField.cursor++;
|
||||
}
|
||||
|
||||
Msg( ">%s\n", g_consoleField.buffer );
|
||||
|
||||
// leading slash is an explicit command
|
||||
if ( g_consoleField.buffer[0] == '\\' || g_consoleField.buffer[0] == '/' )
|
||||
{
|
||||
Cbuf_AddText( g_consoleField.buffer+1 ); // valid command
|
||||
Cbuf_AddText ("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// other text will be chat messages
|
||||
if ( !g_consoleField.buffer[0] )
|
||||
{
|
||||
// empty lines just scroll the console without adding to history
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cbuf_AddText ("cmd say ");
|
||||
Cbuf_AddText( g_consoleField.buffer );
|
||||
Cbuf_AddText ("\n");
|
||||
}
|
||||
}
|
||||
// backslash text are commands, else chat
|
||||
if( g_consoleField.buffer[0] == '\\' || g_consoleField.buffer[0] == '/' )
|
||||
Cbuf_AddText( g_consoleField.buffer + 1 ); // skip backslash
|
||||
else Cbuf_AddText (g_consoleField.buffer); // valid command
|
||||
Cbuf_AddText ("\n");
|
||||
Msg( ">%s\n", g_consoleField.buffer ); // echo to console
|
||||
|
||||
// copy line to history buffer
|
||||
historyEditLines[nextHistoryLine % COMMAND_HISTORY] = g_consoleField;
|
||||
|
@ -638,7 +550,6 @@ void Key_Console(int key)
|
|||
historyLine = nextHistoryLine;
|
||||
|
||||
Field_Clear( &g_consoleField );
|
||||
|
||||
g_consoleField.widthInChars = g_console_field_width;
|
||||
|
||||
if( cls.state == ca_disconnected )
|
||||
|
@ -723,8 +634,17 @@ void Key_Console(int key)
|
|||
return;
|
||||
}
|
||||
|
||||
#if 1
|
||||
if( key < 127 && !Key_IsDown(K_CTRL))
|
||||
{
|
||||
// pass to the normal editline routine
|
||||
Field_CharEvent( &g_consoleField, key );
|
||||
}
|
||||
else Field_KeyDownEvent( &g_consoleField, key );
|
||||
#else
|
||||
// pass to the normal editline routine
|
||||
Field_KeyDownEvent( &g_consoleField, key );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -751,8 +671,8 @@ void Key_Message( int key )
|
|||
if (chat_team) sprintf( buffer, "say_team \"%s\"\n", chatField.buffer );
|
||||
else sprintf( buffer, "say \"%s\"\n", chatField.buffer );
|
||||
|
||||
Cbuf_AddText(buffer);
|
||||
Cbuf_AddText("\"\n"); //exec
|
||||
Cbuf_AddText( buffer );
|
||||
Cbuf_AddText("\"\n");//exec
|
||||
}
|
||||
cls.key_dest = key_game;
|
||||
Field_Clear( &chatField );
|
||||
|
@ -761,17 +681,6 @@ void Key_Message( int key )
|
|||
Field_KeyDownEvent( &chatField, key );
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
bool Key_GetOverstrikeMode( void )
|
||||
{
|
||||
return key_overstrikeMode;
|
||||
}
|
||||
|
||||
void Key_SetOverstrikeMode( bool state )
|
||||
{
|
||||
key_overstrikeMode = state;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_IsDown
|
||||
|
@ -784,6 +693,17 @@ bool Key_IsDown( int keynum )
|
|||
return keys[keynum].down;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_GetBind
|
||||
===================
|
||||
*/
|
||||
char *Key_IsBind( int keynum )
|
||||
{
|
||||
if( keynum == -1 || !keys[keynum].binding)
|
||||
return NULL;
|
||||
return keys[keynum].binding;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
|
@ -858,15 +778,8 @@ char *Key_KeynumToString( int keynum )
|
|||
static char tinystr[5];
|
||||
int i, j;
|
||||
|
||||
if ( keynum == -1 )
|
||||
{
|
||||
return "<KEY NOT FOUND>";
|
||||
}
|
||||
|
||||
if ( keynum < 0 || keynum > 255 )
|
||||
{
|
||||
return "<OUT OF RANGE>";
|
||||
}
|
||||
if ( keynum == -1 ) return "<KEY NOT FOUND>";
|
||||
if ( keynum < 0 || keynum > 255 ) return "<OUT OF RANGE>";
|
||||
|
||||
// check for printable ascii (don't use quote)
|
||||
if ( keynum > 32 && keynum < 127 && keynum != '"' && keynum != ';' )
|
||||
|
@ -880,9 +793,7 @@ char *Key_KeynumToString( int keynum )
|
|||
for ( kn = keynames; kn->name; kn++ )
|
||||
{
|
||||
if (keynum == kn->keynum)
|
||||
{
|
||||
return kn->name;
|
||||
}
|
||||
}
|
||||
|
||||
// make a hex string
|
||||
|
@ -905,12 +816,13 @@ Key_SetBinding
|
|||
*/
|
||||
void Key_SetBinding( int keynum, char *binding )
|
||||
{
|
||||
if ( keynum == -1 ) return;
|
||||
if( keynum == -1 ) return;
|
||||
|
||||
// free old bindings
|
||||
if ( keys[ keynum ].binding )
|
||||
if( keys[ keynum ].binding )
|
||||
{
|
||||
Z_Free( keys[ keynum ].binding );
|
||||
Z_Free( keys[keynum].binding );
|
||||
keys[keynum].binding = NULL;
|
||||
}
|
||||
|
||||
// allocate memory for new binding
|
||||
|
@ -926,9 +838,7 @@ Key_GetBinding
|
|||
char *Key_GetBinding( int keynum )
|
||||
{
|
||||
if ( keynum == -1 )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return keys[ keynum ].binding;
|
||||
}
|
||||
|
||||
|
@ -937,21 +847,18 @@ char *Key_GetBinding( int keynum )
|
|||
Key_GetKey
|
||||
===================
|
||||
*/
|
||||
|
||||
int Key_GetKey(char *binding)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (binding)
|
||||
if(!binding) return -1;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
if (keys[i].binding && !stricmp(binding, keys[i].binding))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
if (keys[i].binding && !stricmp(binding, keys[i].binding))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1082,10 +989,6 @@ void Key_Bindlist_f( void )
|
|||
|
||||
==============================================================================
|
||||
*/
|
||||
bool chat_team;
|
||||
char chat_buffer[256];
|
||||
int chat_bufferlen = 0;
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_Init
|
||||
|
@ -1142,7 +1045,7 @@ void Key_AddKeyUpCommands( int key, char *kb )
|
|||
while((kb[i] <= ' ' || kb[i] == ';') && kb[i] != 0 ) i++;
|
||||
}
|
||||
*buttonPtr++ = kb[i];
|
||||
if ( !kb[i] ) break;
|
||||
if( !kb[i] ) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1164,8 +1067,7 @@ void Key_Event(int key, bool down, uint time)
|
|||
if (down)
|
||||
{
|
||||
keys[key].repeats++;
|
||||
if ( keys[key].repeats == 1)
|
||||
anykeydown++;
|
||||
if( keys[key].repeats == 1) anykeydown++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1178,13 +1080,13 @@ void Key_Event(int key, bool down, uint time)
|
|||
if (key == '`' || key == '~')
|
||||
{
|
||||
if (!down) return;
|
||||
Con_ToggleConsole_f ();
|
||||
Con_ToggleConsole_f();
|
||||
return;
|
||||
}
|
||||
|
||||
// any key during the attract mode will bring up the menu
|
||||
if (cl.attractloop && cls.key_dest != key_menu && !(key >= K_F1 && key <= K_F12))
|
||||
key = K_ESCAPE;
|
||||
//if (cl.attractloop && cls.key_dest != key_menu && !(key >= K_F1 && key <= K_F12))
|
||||
// key = K_ESCAPE;
|
||||
|
||||
// escape is always handled special
|
||||
if ( key == K_ESCAPE && down )
|
||||
|
@ -1200,13 +1102,13 @@ void Key_Event(int key, bool down, uint time)
|
|||
case key_message:
|
||||
Key_Message(key);
|
||||
break;
|
||||
case key_menu:
|
||||
M_Keydown(key);
|
||||
break;
|
||||
case key_game:
|
||||
case key_console:
|
||||
M_Menu_Main_f();
|
||||
break;
|
||||
case key_menu:
|
||||
M_Keydown(key);
|
||||
break;
|
||||
default:
|
||||
MsgWarn("Key_Event: bad cls.key_dest\n");
|
||||
break;
|
||||
|
@ -1226,6 +1128,7 @@ void Key_Event(int key, bool down, uint time)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!down) return; // other systems only care about key down events
|
||||
|
||||
// distribute the key down event to the apropriate handler
|
||||
if(cls.key_dest == key_message)
|
||||
|
@ -1234,7 +1137,7 @@ void Key_Event(int key, bool down, uint time)
|
|||
}
|
||||
else if(cls.key_dest == key_menu)
|
||||
{
|
||||
M_Keydown (key);
|
||||
M_Keydown(key);
|
||||
}
|
||||
else if(cls.key_dest == key_game || cls.key_dest == key_console)
|
||||
{
|
||||
|
@ -1266,13 +1169,13 @@ void Key_Event(int key, bool down, uint time)
|
|||
// button commands add keynum and time as parms so that multiple
|
||||
// sources can be discriminated and subframe corrected
|
||||
sprintf(cmd, "%s %i %i\n", button, key, time);
|
||||
Cbuf_AddText (cmd);
|
||||
Cbuf_AddText(cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// down-only command
|
||||
Cbuf_AddText (button);
|
||||
Cbuf_AddText ("\n");
|
||||
Cbuf_AddText(button);
|
||||
Cbuf_AddText("\n");
|
||||
}
|
||||
buttonPtr = button;
|
||||
while ( (kb[i] <= ' ' || kb[i] == ';') && kb[i] != 0 ) i++;
|
||||
|
@ -1304,22 +1207,14 @@ void CL_CharEvent( int key )
|
|||
if ( key == '`' || key == '~' ) return;
|
||||
|
||||
// distribute the key down event to the apropriate handler
|
||||
if ( cls.key_dest == key_console )
|
||||
if( cls.key_dest == key_console || cls.state == ca_disconnected )
|
||||
{
|
||||
Field_CharEvent( &g_consoleField, key );
|
||||
}
|
||||
else if ( cls.key_dest == key_menu )
|
||||
{
|
||||
M_Keydown( key );
|
||||
}
|
||||
else if(cls.key_dest == key_message)
|
||||
{
|
||||
Field_CharEvent( &chatField, key );
|
||||
}
|
||||
else if ( cls.state == ca_disconnected )
|
||||
{
|
||||
Field_CharEvent( &g_consoleField, key );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,9 +34,6 @@ cvar_t *adr6;
|
|||
cvar_t *adr7;
|
||||
cvar_t *adr8;
|
||||
|
||||
cvar_t *cl_stereo_separation;
|
||||
cvar_t *cl_stereo;
|
||||
|
||||
cvar_t *rcon_client_password;
|
||||
cvar_t *rcon_address;
|
||||
|
||||
|
@ -1397,12 +1394,7 @@ void CL_InitLocal (void)
|
|||
adr7 = Cvar_Get( "adr7", "", CVAR_ARCHIVE );
|
||||
adr8 = Cvar_Get( "adr8", "", CVAR_ARCHIVE );
|
||||
|
||||
//
|
||||
// register our variables
|
||||
//
|
||||
cl_stereo_separation = Cvar_Get( "cl_stereo_separation", "0.4", CVAR_ARCHIVE );
|
||||
cl_stereo = Cvar_Get( "cl_stereo", "0", 0 );
|
||||
|
||||
// register our variables
|
||||
cl_add_blend = Cvar_Get ("cl_blend", "1", 0);
|
||||
cl_add_lights = Cvar_Get ("cl_lights", "1", 0);
|
||||
cl_add_particles = Cvar_Get ("cl_particles", "1", 0);
|
||||
|
@ -1636,9 +1628,6 @@ void CL_SendCommand (void)
|
|||
// get new key events
|
||||
Sys_SendKeyEvents ();
|
||||
|
||||
// allow mice or other external controllers to add commands
|
||||
IN_Commands ();
|
||||
|
||||
// process console commands
|
||||
Cbuf_Execute ();
|
||||
|
||||
|
@ -1652,7 +1641,6 @@ void CL_SendCommand (void)
|
|||
CL_CheckForResend ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_Frame
|
||||
|
@ -1683,7 +1671,6 @@ void CL_Frame (float time)
|
|||
cls.frametime = extratime;
|
||||
cl.time += extratime;
|
||||
cls.realtime = host.realtime;
|
||||
|
||||
extratime = 0;
|
||||
|
||||
// if in the debugger last frame, don't timeout
|
||||
|
@ -1715,6 +1702,7 @@ void CL_Frame (float time)
|
|||
// advance local effects for next frame
|
||||
CL_RunDLights ();
|
||||
CL_RunLightStyles ();
|
||||
|
||||
SCR_RunCinematic ();
|
||||
Con_RunConsole ();
|
||||
|
||||
|
|
|
@ -730,12 +730,8 @@ void CL_ParseServerMessage (void)
|
|||
}
|
||||
}
|
||||
|
||||
CL_AddNetgraph ();
|
||||
|
||||
//
|
||||
// we don't know if it is ok to save a demo message until
|
||||
// after we have parsed the frame
|
||||
//
|
||||
if (cls.demorecording && !cls.demowaiting)
|
||||
CL_WriteDemoMessage ();
|
||||
|
||||
|
|
|
@ -51,13 +51,6 @@ cvar_t *scr_showturtle;
|
|||
cvar_t *scr_showpause;
|
||||
cvar_t *scr_printspeed;
|
||||
|
||||
cvar_t *scr_netgraph;
|
||||
cvar_t *scr_timegraph;
|
||||
cvar_t *scr_debuggraph;
|
||||
cvar_t *scr_graphheight;
|
||||
cvar_t *scr_graphscale;
|
||||
cvar_t *scr_graphshift;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
|
@ -71,99 +64,6 @@ int crosshair_width, crosshair_height;
|
|||
void SCR_TimeRefresh_f (void);
|
||||
void SCR_Loading_f (void);
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
BAR GRAPHS
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_AddNetgraph
|
||||
|
||||
A new packet was just parsed
|
||||
==============
|
||||
*/
|
||||
void CL_AddNetgraph (void)
|
||||
{
|
||||
int i;
|
||||
int in;
|
||||
int ping;
|
||||
|
||||
// if using the debuggraph for something else, don't
|
||||
// add the net lines
|
||||
if (scr_debuggraph->value || scr_timegraph->value)
|
||||
return;
|
||||
|
||||
for (i = 0; i < cls.netchan.dropped; i++)
|
||||
SCR_DebugGraph (30, COLOR_64);
|
||||
|
||||
for (i = 0; i < cl.surpressCount; i++)
|
||||
SCR_DebugGraph (30, COLOR_223);
|
||||
|
||||
// see what the latency was on this packet
|
||||
in = cls.netchan.incoming_acknowledged & (CMD_BACKUP-1);
|
||||
ping = cls.realtime - cl.cmd_time[in];
|
||||
ping /= 30;
|
||||
if (ping > 30) ping = 30;
|
||||
SCR_DebugGraph (ping, COLOR_208);
|
||||
}
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float value;
|
||||
vec4_t color;
|
||||
} graphsamp_t;
|
||||
|
||||
static int current;
|
||||
static graphsamp_t values[1024];
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DebugGraph
|
||||
==============
|
||||
*/
|
||||
void SCR_DebugGraph (float value, vec4_t color)
|
||||
{
|
||||
values[current & 1023].value = value;
|
||||
Vector4Copy(color, values[current & 1023].color);
|
||||
current++;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawDebugGraph
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawDebugGraph (void)
|
||||
{
|
||||
int a, x, y, w, i, h;
|
||||
float v;
|
||||
|
||||
// draw the graph
|
||||
w = scr_vrect.width;
|
||||
|
||||
x = scr_vrect.x;
|
||||
y = scr_vrect.y+scr_vrect.height;
|
||||
|
||||
SCR_FillRect( x, y-scr_graphheight->value, w, scr_graphheight->value, COLOR_8);
|
||||
|
||||
for (a = 0; a < w; a++)
|
||||
{
|
||||
i = (current - 1 - a + 1024) & 1023;
|
||||
v = values[i].value;
|
||||
v = v * scr_graphscale->value + scr_graphshift->value;
|
||||
|
||||
if (v < 0) v += scr_graphheight->value * (1+(int)(-v/scr_graphheight->value));
|
||||
h = (int)v % (int)scr_graphheight->value;
|
||||
SCR_FillRect( x+w-1-a, y - h, 1, h, values[i].color );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
@ -406,12 +306,6 @@ void SCR_Init (void)
|
|||
scr_showpause = Cvar_Get ("scr_showpause", "1", 0);
|
||||
scr_centertime = Cvar_Get ("scr_centertime", "2.5", 0);
|
||||
scr_printspeed = Cvar_Get ("scr_printspeed", "8", 0);
|
||||
scr_netgraph = Cvar_Get ("netgraph", "0", 0);
|
||||
scr_timegraph = Cvar_Get ("timegraph", "0", 0);
|
||||
scr_debuggraph = Cvar_Get ("debuggraph", "0", 0);
|
||||
scr_graphheight = Cvar_Get ("graphheight", "32", 0);
|
||||
scr_graphscale = Cvar_Get ("graphscale", "1", 0);
|
||||
scr_graphshift = Cvar_Get ("graphshift", "0", 0);
|
||||
|
||||
// register our commands
|
||||
Cmd_AddCommand ("timerefresh",SCR_TimeRefresh_f);
|
||||
|
@ -497,13 +391,15 @@ void SCR_BeginLoadingPlaque (void)
|
|||
{
|
||||
S_StopAllSounds ();
|
||||
cl.sound_prepped = false; // don't play ambients
|
||||
if (cls.disable_screen) return;
|
||||
|
||||
/*if (cls.disable_screen) return;
|
||||
if (host.developer) return;
|
||||
if (cls.state == ca_disconnected) return; // if at console, don't bring up the plaque
|
||||
if (cls.key_dest == key_console) return;
|
||||
if (cl.cinematictime > 0) scr_draw_loading = 2; // clear to black first
|
||||
if (cls.state == ca_cinematic) scr_draw_loading = 2; // clear to black first
|
||||
else scr_draw_loading = 1;
|
||||
|
||||
*/
|
||||
|
||||
SCR_UpdateScreen ();
|
||||
cls.disable_screen = Sys_DoubleTime();
|
||||
cls.disable_servercount = cl.servercount;
|
||||
|
@ -516,6 +412,8 @@ SCR_EndLoadingPlaque
|
|||
*/
|
||||
void SCR_EndLoadingPlaque (void)
|
||||
{
|
||||
return;
|
||||
|
||||
cls.disable_screen = 0;
|
||||
Con_ClearNotify ();
|
||||
}
|
||||
|
@ -563,7 +461,7 @@ void SCR_TimeRefresh_f (void)
|
|||
|
||||
if (Cmd_Argc() == 2)
|
||||
{ // run without page flipping
|
||||
re->BeginFrame( 0 );
|
||||
re->BeginFrame();
|
||||
for (i=0 ; i<128 ; i++)
|
||||
{
|
||||
cl.refdef.viewangles[1] = i/128.0*360.0;
|
||||
|
@ -577,7 +475,7 @@ void SCR_TimeRefresh_f (void)
|
|||
{
|
||||
cl.refdef.viewangles[1] = i/128.0*360.0;
|
||||
|
||||
re->BeginFrame( 0 );
|
||||
re->BeginFrame();
|
||||
re->RenderFrame (&cl.refdef);
|
||||
re->EndFrame();
|
||||
}
|
||||
|
@ -855,8 +753,7 @@ void SCR_TileClear (void)
|
|||
return; // full screen console
|
||||
if (scr_viewsize->value == 100)
|
||||
return; // full screen rendering
|
||||
if (cl.cinematictime > 0)
|
||||
return; // full screen cinematic
|
||||
if(cls.state == ca_cinematic) return; // full screen cinematic
|
||||
|
||||
// erase rect will be the union of the past three frames
|
||||
// so tripple buffering works properly
|
||||
|
@ -1399,6 +1296,65 @@ void SCR_DrawLayout (void)
|
|||
|
||||
//=======================================================
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_DrawScreenField
|
||||
|
||||
This will be called twice if rendering in stereo mode
|
||||
==================
|
||||
*/
|
||||
void SCR_DrawScreenField( void )
|
||||
{
|
||||
re->BeginFrame();
|
||||
|
||||
// wide aspect ratio screens need to have the sides cleared
|
||||
// unless they are displaying game renderings
|
||||
if ( cls.state != ca_active )
|
||||
{
|
||||
if( viddef.width * 480 > viddef.height * 640 )
|
||||
{
|
||||
re->SetColor( g_color_table[0] );
|
||||
re->DrawStretchPic( 0, 0, viddef.width, viddef.height, 0, 0, 1, 1, "backtile" );
|
||||
re->SetColor( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
switch( cls.state )
|
||||
{
|
||||
case ca_cinematic:
|
||||
SCR_DrawCinematic();
|
||||
break;
|
||||
case ca_disconnected:
|
||||
M_Draw();
|
||||
break;
|
||||
case ca_connecting:
|
||||
case ca_connected:
|
||||
SCR_TileClear();
|
||||
SCR_DrawLoading();
|
||||
break;
|
||||
case ca_active:
|
||||
SCR_CalcVrect();
|
||||
V_RenderView();
|
||||
SCR_DrawStats();
|
||||
if(cl.frame.playerstate.stats[STAT_LAYOUTS] & 1) SCR_DrawLayout();
|
||||
if(cl.frame.playerstate.stats[STAT_LAYOUTS] & 2) CL_DrawInventory();
|
||||
break;
|
||||
case ca_uninitialized:
|
||||
return;
|
||||
default:
|
||||
Host_Error("SCR_DrawScreenField: bad cls.state" );
|
||||
break;
|
||||
}
|
||||
|
||||
SCR_DrawNet();
|
||||
SCR_CheckDrawCenterString();
|
||||
SCR_DrawPause();
|
||||
|
||||
SCR_DrawCinematic();
|
||||
M_Draw();
|
||||
Con_DrawConsole();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_UpdateScreen
|
||||
|
@ -1409,104 +1365,9 @@ text to the screen.
|
|||
*/
|
||||
void SCR_UpdateScreen (void)
|
||||
{
|
||||
int numframes;
|
||||
int i;
|
||||
float separation[2] = { 0, 0 };
|
||||
|
||||
// if the screen is disabled (loading plaque is up, or vid mode changing)
|
||||
// do nothing at all
|
||||
if (cls.disable_screen)
|
||||
{
|
||||
if (Sys_DoubleTime() - cls.disable_screen > 120.0f)
|
||||
{
|
||||
cls.disable_screen = 0;
|
||||
Msg ("Loading plaque timed out.\n");
|
||||
}
|
||||
if (!scr_initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!scr_initialized) return; // not initialized yet
|
||||
|
||||
/*
|
||||
** range check cl_camera_separation so we don't inadvertently fry someone's
|
||||
** brain
|
||||
*/
|
||||
if ( cl_stereo_separation->value > 1.0 )
|
||||
Cvar_SetValue( "cl_stereo_separation", 1.0 );
|
||||
else if ( cl_stereo_separation->value < 0 )
|
||||
Cvar_SetValue( "cl_stereo_separation", 0.0 );
|
||||
|
||||
if ( cl_stereo->value )
|
||||
{
|
||||
numframes = 2;
|
||||
separation[0] = -cl_stereo_separation->value / 2;
|
||||
separation[1] = cl_stereo_separation->value / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
separation[0] = 0;
|
||||
separation[1] = 0;
|
||||
numframes = 1;
|
||||
}
|
||||
|
||||
for ( i = 0; i < numframes; i++ )
|
||||
{
|
||||
re->BeginFrame( separation[i] );
|
||||
|
||||
if (scr_draw_loading == 2)
|
||||
{
|
||||
// loading plaque over black screen
|
||||
re->CinematicSetPalette(NULL);
|
||||
scr_draw_loading = false;
|
||||
SCR_DrawString( "loading" );
|
||||
}
|
||||
// if a cinematic is supposed to be running, handle menus
|
||||
// and console specially
|
||||
else if (cl.cinematictime > 0)
|
||||
{
|
||||
if (cls.key_dest == key_menu)
|
||||
{
|
||||
M_Draw ();
|
||||
}
|
||||
else if (cls.key_dest == key_console)
|
||||
{
|
||||
Con_DrawConsole ();
|
||||
}
|
||||
else SCR_DrawCinematic();
|
||||
}
|
||||
else
|
||||
{
|
||||
// do 3D refresh drawing, and then update the screen
|
||||
SCR_CalcVrect ();
|
||||
|
||||
// clear any dirty part of the background
|
||||
SCR_TileClear ();
|
||||
|
||||
V_RenderView ( separation[i] );
|
||||
|
||||
SCR_DrawStats ();
|
||||
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 1)
|
||||
SCR_DrawLayout ();
|
||||
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 2)
|
||||
CL_DrawInventory ();
|
||||
|
||||
SCR_DrawNet ();
|
||||
SCR_CheckDrawCenterString ();
|
||||
|
||||
if (scr_timegraph->value)
|
||||
SCR_DebugGraph (cls.frametime*300, COLOR_0);
|
||||
|
||||
if (scr_debuggraph->value || scr_timegraph->value || scr_netgraph->value)
|
||||
SCR_DrawDebugGraph ();
|
||||
|
||||
SCR_DrawPause ();
|
||||
|
||||
Con_DrawConsole ();
|
||||
|
||||
M_Draw ();
|
||||
|
||||
SCR_DrawLoading ();
|
||||
}
|
||||
}
|
||||
SCR_DrawScreenField();
|
||||
re->EndFrame();
|
||||
}
|
||||
|
|
|
@ -433,7 +433,7 @@ V_RenderView
|
|||
|
||||
==================
|
||||
*/
|
||||
void V_RenderView( float stereo_separation )
|
||||
void V_RenderView( void )
|
||||
{
|
||||
extern int entitycmpfnc( const entity_t *, const entity_t * );
|
||||
|
||||
|
@ -477,15 +477,6 @@ void V_RenderView( float stereo_separation )
|
|||
cl.refdef.blend[3] = 0.5;
|
||||
}
|
||||
|
||||
// offset vieworg appropriately if we're doing stereo separation
|
||||
if ( stereo_separation != 0 )
|
||||
{
|
||||
vec3_t tmp;
|
||||
|
||||
VectorScale( cl.v_right, stereo_separation, tmp );
|
||||
VectorAdd( cl.refdef.vieworg, tmp, cl.refdef.vieworg );
|
||||
}
|
||||
|
||||
// never let it sit exactly on a node line, because a water plane can
|
||||
// dissapear when viewed with the eye exactly on it.
|
||||
// the server protocol only specifies to 1/8 pixel, so add 1/16 in each axis
|
||||
|
|
|
@ -27,7 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "screen.h"
|
||||
#include "sound.h"
|
||||
#include "input.h"
|
||||
#include "keys.h"
|
||||
#include "keycodes.h"
|
||||
|
||||
|
||||
#define MAX_EDIT_LINE 256
|
||||
#define COMMAND_HISTORY 32
|
||||
|
||||
//=============================================================================
|
||||
typedef struct
|
||||
|
@ -42,6 +46,16 @@ typedef struct
|
|||
int parse_entities; // non-masked index into cl_parse_entities array
|
||||
} frame_t;
|
||||
|
||||
// console stuff
|
||||
typedef struct field_s
|
||||
{
|
||||
int cursor;
|
||||
int scroll;
|
||||
int widthInChars;
|
||||
char buffer[MAX_EDIT_LINE];
|
||||
int maxchars; // menu stuff
|
||||
} field_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
entity_state_t baseline; // delta from this if not from a previous frame
|
||||
|
@ -116,7 +130,6 @@ typedef struct
|
|||
|
||||
float time; // this is the time value that the client
|
||||
// is rendering at. always <= cls.realtime
|
||||
float cinematictime; // cinematic time
|
||||
float lerpfrac; // between oldframe and frame
|
||||
|
||||
refdef_t refdef;
|
||||
|
@ -229,9 +242,6 @@ extern client_static_t cls;
|
|||
//
|
||||
// cvars
|
||||
//
|
||||
extern cvar_t *cl_stereo_separation;
|
||||
extern cvar_t *cl_stereo;
|
||||
|
||||
extern cvar_t *cl_gun;
|
||||
extern cvar_t *cl_add_blend;
|
||||
extern cvar_t *cl_add_lights;
|
||||
|
@ -482,7 +492,7 @@ extern int gun_frame;
|
|||
extern model_t *gun_model;
|
||||
|
||||
void V_Init (void);
|
||||
void V_RenderView( float stereo_separation );
|
||||
void V_RenderView( void );
|
||||
void V_AddEntity (entity_t *ent);
|
||||
void V_AddParticle (vec3_t org, int color, float alpha);
|
||||
void V_AddLight (vec3_t org, float intensity, float r, float g, float b);
|
||||
|
@ -559,6 +569,31 @@ void Con_Top( void );
|
|||
void Con_Bottom( void );
|
||||
void Con_Close( void );
|
||||
|
||||
extern bool chat_team;
|
||||
extern bool anykeydown;
|
||||
extern int g_console_field_width;
|
||||
extern field_t historyEditLines[COMMAND_HISTORY];
|
||||
extern field_t g_consoleField;
|
||||
extern field_t chatField;
|
||||
|
||||
//
|
||||
// cl_keys.c
|
||||
//
|
||||
void Field_Clear( field_t *edit );
|
||||
void Field_CharEvent( field_t *edit, int ch );
|
||||
void Field_KeyDownEvent( field_t *edit, int key );
|
||||
void Field_Draw( field_t *edit, int x, int y, int width, bool showCursor );
|
||||
void Field_BigDraw( field_t *edit, int x, int y, int width, bool showCursor );
|
||||
|
||||
bool Key_IsDown( int keynum );
|
||||
char *Key_IsBind( int keynum );
|
||||
void Key_Event (int key, bool down, uint time);
|
||||
void Key_Init (void);
|
||||
void Key_WriteBindings (file_t *f);
|
||||
void Key_SetBinding (int keynum, char *binding);
|
||||
void Key_ClearStates (void);
|
||||
char *Key_KeynumToString (int keynum);
|
||||
int Key_StringToKeynum (char *str);
|
||||
int Key_GetKey( char *binding );
|
||||
|
||||
#endif//CLIENT_H
|
|
@ -1,189 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#define MAX_EDIT_LINE 256
|
||||
#define COMMAND_HISTORY 32
|
||||
|
||||
// these are the key numbers that should be passed to Key_Event
|
||||
typedef enum
|
||||
{
|
||||
K_TAB = 9,
|
||||
K_ENTER = 13,
|
||||
K_ESCAPE = 27,
|
||||
K_SPACE = 32,
|
||||
|
||||
K_BACKSPACE = 127,
|
||||
|
||||
K_COMMAND = 128,
|
||||
K_CAPSLOCK,
|
||||
K_POWER,
|
||||
K_PAUSE,
|
||||
|
||||
K_UPARROW,
|
||||
K_DOWNARROW,
|
||||
K_LEFTARROW,
|
||||
K_RIGHTARROW,
|
||||
|
||||
K_ALT,
|
||||
K_CTRL,
|
||||
K_SHIFT,
|
||||
K_INS,
|
||||
K_DEL,
|
||||
K_PGDN,
|
||||
K_PGUP,
|
||||
K_HOME,
|
||||
K_END,
|
||||
|
||||
K_F1,
|
||||
K_F2,
|
||||
K_F3,
|
||||
K_F4,
|
||||
K_F5,
|
||||
K_F6,
|
||||
K_F7,
|
||||
K_F8,
|
||||
K_F9,
|
||||
K_F10,
|
||||
K_F11,
|
||||
K_F12,
|
||||
K_F13,
|
||||
K_F14,
|
||||
K_F15,
|
||||
|
||||
K_KP_HOME,
|
||||
K_KP_UPARROW,
|
||||
K_KP_PGUP,
|
||||
K_KP_LEFTARROW,
|
||||
K_KP_5,
|
||||
K_KP_RIGHTARROW,
|
||||
K_KP_END,
|
||||
K_KP_DOWNARROW,
|
||||
K_KP_PGDN,
|
||||
K_KP_ENTER,
|
||||
K_KP_INS,
|
||||
K_KP_DEL,
|
||||
K_KP_SLASH,
|
||||
K_KP_MINUS,
|
||||
K_KP_PLUS,
|
||||
K_KP_NUMLOCK,
|
||||
K_KP_STAR,
|
||||
K_KP_EQUALS,
|
||||
|
||||
K_MOUSE1,
|
||||
K_MOUSE2,
|
||||
K_MOUSE3,
|
||||
K_MOUSE4,
|
||||
K_MOUSE5,
|
||||
|
||||
K_MWHEELDOWN,
|
||||
K_MWHEELUP,
|
||||
|
||||
K_JOY1,
|
||||
K_JOY2,
|
||||
K_JOY3,
|
||||
K_JOY4,
|
||||
K_JOY5,
|
||||
K_JOY6,
|
||||
K_JOY7,
|
||||
K_JOY8,
|
||||
K_JOY9,
|
||||
K_JOY10,
|
||||
K_JOY11,
|
||||
K_JOY12,
|
||||
K_JOY13,
|
||||
K_JOY14,
|
||||
K_JOY15,
|
||||
K_JOY16,
|
||||
K_JOY17,
|
||||
K_JOY18,
|
||||
K_JOY19,
|
||||
K_JOY20,
|
||||
K_JOY21,
|
||||
K_JOY22,
|
||||
K_JOY23,
|
||||
K_JOY24,
|
||||
K_JOY25,
|
||||
K_JOY26,
|
||||
K_JOY27,
|
||||
K_JOY28,
|
||||
K_JOY29,
|
||||
K_JOY30,
|
||||
K_JOY31,
|
||||
K_JOY32,
|
||||
|
||||
K_AUX1,
|
||||
K_AUX2,
|
||||
K_AUX3,
|
||||
K_AUX4,
|
||||
K_AUX5,
|
||||
K_AUX6,
|
||||
K_AUX7,
|
||||
K_AUX8,
|
||||
K_AUX9,
|
||||
K_AUX10,
|
||||
K_AUX11,
|
||||
K_AUX12,
|
||||
K_AUX13,
|
||||
K_AUX14,
|
||||
K_AUX15,
|
||||
K_AUX16,
|
||||
|
||||
K_LAST_KEY // this had better be <256!
|
||||
} keyNum_t;
|
||||
|
||||
typedef struct field_s
|
||||
{
|
||||
int cursor;
|
||||
int scroll;
|
||||
int widthInChars;
|
||||
char buffer[MAX_EDIT_LINE];
|
||||
|
||||
} field_t;
|
||||
|
||||
typedef struct key_s
|
||||
{
|
||||
bool down;
|
||||
int repeats; // if > 1, it is autorepeating
|
||||
char *binding;
|
||||
} key_t;
|
||||
|
||||
extern char chat_buffer[];
|
||||
extern int chat_bufferlen;
|
||||
extern bool chat_team;
|
||||
extern field_t historyEditLines[COMMAND_HISTORY];
|
||||
extern field_t g_consoleField;
|
||||
extern field_t chatField;
|
||||
extern bool anykeydown;
|
||||
extern key_t keys[];
|
||||
|
||||
void Field_Clear( field_t *edit );
|
||||
void Field_CharEvent( field_t *edit, int ch );
|
||||
void Field_Draw( field_t *edit, int x, int y, int width, bool showCursor );
|
||||
void Field_BigDraw( field_t *edit, int x, int y, int width, bool showCursor );
|
||||
|
||||
void Key_Event (int key, bool down, unsigned time);
|
||||
void Key_Init (void);
|
||||
void Key_WriteBindings (file_t *f);
|
||||
void Key_SetBinding (int keynum, char *binding);
|
||||
void Key_ClearStates (void);
|
||||
char *Key_KeynumToString (int keynum);
|
||||
int Key_StringToKeynum (char *str);
|
||||
int Key_GetKey( char *binding );
|
||||
|
|
@ -362,8 +362,6 @@ then searches for a command or variable that matches the first token.
|
|||
typedef void (*xcommand_t) (void);
|
||||
|
||||
void Cmd_Init( int argc, char **argv );
|
||||
bool Cmd_AddStartupCommands( void );
|
||||
|
||||
#define Cmd_AddCommand(name, func) _Cmd_AddCommand(name, func, "no description" )
|
||||
void _Cmd_AddCommand(const char *cmd_name, xcommand_t function, const char *cmd_desc);
|
||||
// called by the init functions of other parts of the program to
|
||||
|
@ -645,10 +643,6 @@ extern float time_after_ref;
|
|||
#define NUMVERTEXNORMALS 162
|
||||
extern vec3_t bytedirs[NUMVERTEXNORMALS];
|
||||
|
||||
// this is in the client code, but can be used for debugging from server
|
||||
void SCR_DebugGraph (float value, vec4_t color);
|
||||
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ typedef struct
|
|||
int cmd_wait;
|
||||
cmd_t cmd_text;
|
||||
byte cmd_text_buf[MAX_CMD_BUFFER];
|
||||
char **fs_argv;
|
||||
int fs_argc;
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
@ -65,12 +67,10 @@ Cbuf_AddText
|
|||
Adds command text at the end of the buffer
|
||||
============
|
||||
*/
|
||||
void Cbuf_AddText (const char *text)
|
||||
void Cbuf_AddText(const char *text)
|
||||
{
|
||||
int l;
|
||||
|
||||
Msg("add %s\n", text );
|
||||
|
||||
l = strlen (text);
|
||||
if (cmd_text.cursize + l >= cmd_text.maxsize)
|
||||
{
|
||||
|
@ -93,8 +93,7 @@ FIXME: actually change the command buffer to do less copying
|
|||
*/
|
||||
void Cbuf_InsertText (const char *text)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
int i, len;
|
||||
|
||||
len = strlen( text ) + 1;
|
||||
if ( len + cmd_text.cursize > cmd_text.maxsize )
|
||||
|
@ -202,6 +201,64 @@ void Cbuf_Execute (void)
|
|||
|
||||
==============================================================================
|
||||
*/
|
||||
/*
|
||||
===============
|
||||
Cmd_StuffCmds_f
|
||||
|
||||
Adds command line parameters as script statements
|
||||
Commands lead with a +, and continue until a - or another +
|
||||
quake +prog jctest.qp +cmd amlev1
|
||||
quake -nosound +cmd amlev1
|
||||
===============
|
||||
*/
|
||||
void Cmd_StuffCmds_f( void )
|
||||
{
|
||||
int i, j, l = 0;
|
||||
char build[MAX_INPUTLINE]; // this is for all commandline options combined (and is bounds checked)
|
||||
|
||||
if(Cmd_Argc() != 1)
|
||||
{
|
||||
Msg("stuffcmds : execute command line parameters\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// no reason to run the commandline arguments twice
|
||||
if(host.stuffcmdsrun) return;
|
||||
|
||||
host.stuffcmdsrun = true;
|
||||
build[0] = 0;
|
||||
|
||||
for (i = 0; i < fs_argc; i++)
|
||||
{
|
||||
if (fs_argv[i] && fs_argv[i][0] == '+' && (fs_argv[i][1] < '0' || fs_argv[i][1] > '9') && l + strlen(fs_argv[i]) - 1 <= sizeof(build) - 1)
|
||||
{
|
||||
j = 1;
|
||||
while (fs_argv[i][j]) build[l++] = fs_argv[i][j++];
|
||||
|
||||
i++;
|
||||
for ( ; i < fs_argc; i++)
|
||||
{
|
||||
if (!fs_argv[i]) continue;
|
||||
if ((fs_argv[i][0] == '+' || fs_argv[i][0] == '-') && (fs_argv[i][1] < '0' || fs_argv[i][1] > '9'))
|
||||
break;
|
||||
if (l + strlen(fs_argv[i]) + 4 > sizeof(build) - 1)
|
||||
break;
|
||||
build[l++] = ' ';
|
||||
if (strchr(fs_argv[i], ' ')) build[l++] = '\"';
|
||||
for (j = 0; fs_argv[i][j]; j++) build[l++] = fs_argv[i][j];
|
||||
if (strchr(fs_argv[i], ' ')) build[l++] = '\"';
|
||||
}
|
||||
build[l++] = '\n';
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
// now terminate the combined string and prepend it to the command buffer
|
||||
// we already reserved space for the terminator
|
||||
build[l++] = 0;
|
||||
Cbuf_InsertText(build);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_Wait_f
|
||||
|
@ -253,27 +310,6 @@ void Cmd_Exec_f (void)
|
|||
Z_Free (f);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Cmd_Vstr_f
|
||||
|
||||
Inserts the current value of a variable as command text
|
||||
===============
|
||||
*/
|
||||
void Cmd_Vstr_f( void )
|
||||
{
|
||||
char *v;
|
||||
|
||||
if (Cmd_Argc () != 2)
|
||||
{
|
||||
Msg("vstr <variablename> : execute a variable command\n");
|
||||
return;
|
||||
}
|
||||
|
||||
v = Cvar_VariableString(Cmd_Argv(1));
|
||||
Cbuf_InsertText( va("%s\n", v ) );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Cmd_Echo_f
|
||||
|
@ -310,8 +346,6 @@ static int cmd_argc;
|
|||
static char *cmd_argv[MAX_STRING_TOKENS];
|
||||
static char cmd_tokenized[MAX_INPUTLINE+MAX_STRING_TOKENS]; // will have 0 bytes inserted
|
||||
static cmd_function_t *cmd_functions; // possible commands to execute
|
||||
char **fs_argv;
|
||||
int fs_argc;
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -359,79 +393,6 @@ char *Cmd_Args (void)
|
|||
return cmd_args;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
======================
|
||||
Cmd_MacroExpandString
|
||||
======================
|
||||
*/
|
||||
char *Cmd_MacroExpandString (const char *text)
|
||||
{
|
||||
int i, j, count, len;
|
||||
bool inquote;
|
||||
char *scan;
|
||||
static char expanded[MAX_STRING_CHARS];
|
||||
char temporary[MAX_STRING_CHARS];
|
||||
char *token, *start;
|
||||
|
||||
inquote = false;
|
||||
scan = (char *)text;
|
||||
|
||||
len = strlen (scan);
|
||||
if (len >= MAX_STRING_CHARS)
|
||||
{
|
||||
Msg ("Line exceeded %i chars, discarded.\n", MAX_STRING_CHARS);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (scan[i] == '"') inquote ^= 1;
|
||||
if (inquote) continue; // don't expand inside quotes
|
||||
if (scan[i] != '$') continue;
|
||||
|
||||
// scan out the complete macro
|
||||
start = scan + i + 1;
|
||||
token = COM_Parse(&start);
|
||||
if (!start) continue;
|
||||
|
||||
token = Cvar_VariableString(token);
|
||||
|
||||
j = strlen(token);
|
||||
len += j;
|
||||
if (len >= MAX_STRING_CHARS)
|
||||
{
|
||||
Msg ("Expanded line exceeded %i chars, discarded.\n", MAX_STRING_CHARS);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strncpy (temporary, scan, i);
|
||||
strcpy (temporary+i, token);
|
||||
strcpy (temporary+i+j, start);
|
||||
|
||||
strcpy (expanded, temporary);
|
||||
scan = expanded;
|
||||
i--;
|
||||
|
||||
if (++count == 100)
|
||||
{
|
||||
Msg ("Macro expansion loop, discarded.\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (inquote)
|
||||
{
|
||||
Msg ("Line has unmatched quote, discarded.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return scan;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_TokenizeString
|
||||
|
@ -638,53 +599,6 @@ void Cmd_ExecuteString( const char *text )
|
|||
Cmd_ForwardToServer();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Cmd_AddStartupCommands
|
||||
|
||||
Adds command line parameters as script statements
|
||||
Commands are seperated by + signs
|
||||
|
||||
Returns qtrue if any late commands were added, which
|
||||
will keep the demoloop from immediately starting
|
||||
=================
|
||||
*/
|
||||
bool Cmd_AddStartupCommands( void )
|
||||
{
|
||||
int i;
|
||||
bool added;
|
||||
char *temp;
|
||||
|
||||
added = false;
|
||||
|
||||
// quote every token, so args with semicolons can work
|
||||
for (i = 2; i < fs_argc; i++)
|
||||
{
|
||||
if(!fs_argv[i] || !fs_argv[i][0])
|
||||
continue;
|
||||
|
||||
Msg("scan for %s\n", fs_argv[i] );
|
||||
|
||||
if(fs_argv[i][0] == '+')
|
||||
{
|
||||
temp = fs_argv[i];
|
||||
temp++;
|
||||
Cbuf_AddText( va("%s %s", temp, fs_argv[i+1]));
|
||||
added = true;
|
||||
i++;
|
||||
}
|
||||
else if(strnicmp(fs_argv[i], "set", 3 ))
|
||||
{
|
||||
Cbuf_AddText( va("%s %s %s", fs_argv[i], fs_argv[i+1], fs_argv[i+2]));
|
||||
added = true;
|
||||
i+=2;
|
||||
}
|
||||
Cbuf_AddText( "\n" );
|
||||
}
|
||||
return added;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_List_f
|
||||
|
@ -719,13 +633,13 @@ void Cmd_Init( int argc, char **argv )
|
|||
Cbuf_Init();
|
||||
|
||||
// register our commands
|
||||
Cmd_AddCommand ("cmdlist", Cmd_List_f);
|
||||
Cmd_AddCommand ("exec", Cmd_Exec_f);
|
||||
Cmd_AddCommand ("echo", Cmd_Echo_f);
|
||||
Cmd_AddCommand ("vstr", Cmd_Vstr_f);
|
||||
Cmd_AddCommand ("wait", Cmd_Wait_f);
|
||||
Cmd_AddCommand ("cmdlist", Cmd_List_f);
|
||||
Cmd_AddCommand ("stuffcmds", Cmd_StuffCmds_f );
|
||||
|
||||
// get pointers
|
||||
// save pointers
|
||||
fs_argc = argc;
|
||||
fs_argv = argv;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// keyboard
|
||||
K_TAB = 9,
|
||||
K_ENTER = 13,
|
||||
K_ESCAPE = 27,
|
||||
K_SPACE = 32,
|
||||
K_BACKSPACE = 127,
|
||||
K_COMMAND = 128,
|
||||
K_CAPSLOCK,
|
||||
K_POWER,
|
||||
K_PAUSE,
|
||||
K_UPARROW,
|
||||
K_DOWNARROW,
|
||||
K_LEFTARROW,
|
||||
K_RIGHTARROW,
|
||||
K_ALT,
|
||||
K_CTRL,
|
||||
K_SHIFT,
|
||||
K_INS,
|
||||
K_DEL,
|
||||
K_PGDN,
|
||||
K_PGUP,
|
||||
K_HOME,
|
||||
K_END,
|
||||
K_F1,
|
||||
K_F2,
|
||||
K_F3,
|
||||
K_F4,
|
||||
K_F5,
|
||||
K_F6,
|
||||
K_F7,
|
||||
K_F8,
|
||||
K_F9,
|
||||
K_F10,
|
||||
K_F11,
|
||||
K_F12,
|
||||
K_F13,
|
||||
K_F14,
|
||||
K_F15,
|
||||
K_KP_HOME,
|
||||
K_KP_UPARROW,
|
||||
K_KP_PGUP,
|
||||
K_KP_LEFTARROW,
|
||||
K_KP_5,
|
||||
K_KP_RIGHTARROW,
|
||||
K_KP_END,
|
||||
K_KP_DOWNARROW,
|
||||
K_KP_PGDN,
|
||||
K_KP_ENTER,
|
||||
K_KP_INS,
|
||||
K_KP_DEL,
|
||||
K_KP_SLASH,
|
||||
K_KP_MINUS,
|
||||
K_KP_PLUS,
|
||||
K_KP_NUMLOCK,
|
||||
K_KP_STAR,
|
||||
K_KP_EQUALS,
|
||||
|
||||
// mouse
|
||||
K_MOUSE1,
|
||||
K_MOUSE2,
|
||||
K_MOUSE3,
|
||||
K_MOUSE4,
|
||||
K_MOUSE5,
|
||||
K_MWHEELDOWN,
|
||||
K_MWHEELUP,
|
||||
|
||||
K_LAST_KEY // this had better be < 256!
|
||||
} keyNum_t;
|
|
@ -121,7 +121,7 @@ void M_ForceMenuOff (void)
|
|||
m_keyfunc = 0;
|
||||
cls.key_dest = key_game;
|
||||
m_menudepth = 0;
|
||||
Key_ClearStates ();
|
||||
Key_ClearStates();
|
||||
Cvar_Set ("paused", "0");
|
||||
}
|
||||
|
||||
|
@ -147,19 +147,21 @@ const char *Default_MenuKey( menuframework_s *m, int key )
|
|||
const char *sound = NULL;
|
||||
menucommon_s *item;
|
||||
|
||||
Msg("default menu key called %s, key %d\n", Key_KeynumToString(key), key);
|
||||
|
||||
if ( m )
|
||||
{
|
||||
if ( ( item = Menu_ItemAtCursor( m ) ) != 0 )
|
||||
if (( item = Menu_ItemAtCursor( m )) != 0 )
|
||||
{
|
||||
if ( item->type == MTYPE_FIELD )
|
||||
if( item->type == MTYPE_FIELD )
|
||||
{
|
||||
if ( Field_Key( ( menufield_s * ) item, key ) )
|
||||
if( Field_Key((menufield_s * )item, key ))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ( key )
|
||||
switch( key )
|
||||
{
|
||||
case K_ESCAPE:
|
||||
M_PopMenu();
|
||||
|
@ -210,26 +212,8 @@ const char *Default_MenuKey( menuframework_s *m, int key )
|
|||
case K_MOUSE1:
|
||||
case K_MOUSE2:
|
||||
case K_MOUSE3:
|
||||
case K_JOY1:
|
||||
case K_JOY2:
|
||||
case K_JOY3:
|
||||
case K_JOY4:
|
||||
case K_AUX1:
|
||||
case K_AUX2:
|
||||
case K_AUX3:
|
||||
case K_AUX4:
|
||||
case K_AUX5:
|
||||
case K_AUX6:
|
||||
case K_AUX7:
|
||||
case K_AUX8:
|
||||
case K_AUX9:
|
||||
case K_AUX10:
|
||||
case K_AUX11:
|
||||
case K_AUX12:
|
||||
case K_AUX13:
|
||||
case K_AUX14:
|
||||
case K_AUX15:
|
||||
case K_AUX16:
|
||||
case K_MOUSE4:
|
||||
case K_MOUSE5:
|
||||
case K_KP_ENTER:
|
||||
case K_ENTER:
|
||||
if ( m )
|
||||
|
@ -417,14 +401,14 @@ void M_Main_Draw (void)
|
|||
}
|
||||
|
||||
|
||||
const char *M_Main_Key (int key)
|
||||
const char *M_Main_Key(int key)
|
||||
{
|
||||
const char *sound = menu_move_sound;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case K_ESCAPE:
|
||||
M_PopMenu ();
|
||||
M_PopMenu();
|
||||
break;
|
||||
|
||||
case K_KP_DOWNARROW:
|
||||
|
@ -633,7 +617,7 @@ static void M_UnbindCommand (char *command)
|
|||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
b = keys[j].binding;
|
||||
b = Key_IsBind(j);
|
||||
if (!b) continue;
|
||||
if (!strncmp (b, command, l) )
|
||||
Key_SetBinding (j, "");
|
||||
|
@ -653,7 +637,7 @@ static void M_FindKeysForCommand (char *command, int *twokeys)
|
|||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
b = keys[j].binding;
|
||||
b = Key_IsBind(j);
|
||||
if (!b) continue;
|
||||
if (!strncmp (b, command, l) )
|
||||
{
|
||||
|
@ -995,8 +979,6 @@ CONTROLS MENU
|
|||
|
||||
=======================================================================
|
||||
*/
|
||||
extern cvar_t *in_joystick;
|
||||
|
||||
static menuframework_s s_options_menu;
|
||||
static menuaction_s s_options_defaults_action;
|
||||
static menuaction_s s_options_customize_options_action;
|
||||
|
@ -1009,7 +991,6 @@ static menulist_s s_options_lookstrafe_box;
|
|||
static menulist_s s_options_crosshair_box;
|
||||
static menuslider_s s_options_sfxvolume_slider;
|
||||
static menuslider_s s_options_musicvolume_slider;
|
||||
static menulist_s s_options_joystick_box;
|
||||
static menulist_s s_options_quality_list;
|
||||
static menulist_s s_options_console_action;
|
||||
|
||||
|
@ -1018,11 +999,6 @@ static void CrosshairFunc( void *unused )
|
|||
Cvar_SetValue( "crosshair", s_options_crosshair_box.curvalue );
|
||||
}
|
||||
|
||||
static void JoystickFunc( void *unused )
|
||||
{
|
||||
Cvar_SetValue( "in_joystick", s_options_joystick_box.curvalue );
|
||||
}
|
||||
|
||||
static void CustomizeControlsFunc( void *unused )
|
||||
{
|
||||
M_Menu_Keys_f();
|
||||
|
@ -1073,9 +1049,6 @@ static void ControlsSetMenuItemValues( void )
|
|||
|
||||
Cvar_SetValue( "crosshair", ClampCvar( 0, 3, crosshair->value ) );
|
||||
s_options_crosshair_box.curvalue = crosshair->value;
|
||||
|
||||
Cvar_SetValue( "in_joystick", ClampCvar( 0, 1, in_joystick->value ) );
|
||||
s_options_joystick_box.curvalue = in_joystick->value;
|
||||
}
|
||||
|
||||
static void ControlsResetDefaultsFunc( void *unused )
|
||||
|
@ -1250,28 +1223,21 @@ void Options_MenuInit( void )
|
|||
s_options_crosshair_box.generic.callback = CrosshairFunc;
|
||||
s_options_crosshair_box.itemnames = crosshair_names;
|
||||
|
||||
s_options_joystick_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_joystick_box.generic.x = 0;
|
||||
s_options_joystick_box.generic.y = 110;
|
||||
s_options_joystick_box.generic.name = "use joystick";
|
||||
s_options_joystick_box.generic.callback = JoystickFunc;
|
||||
s_options_joystick_box.itemnames = yesno_names;
|
||||
|
||||
s_options_customize_options_action.generic.type = MTYPE_ACTION;
|
||||
s_options_customize_options_action.generic.x = 0;
|
||||
s_options_customize_options_action.generic.y = 140;
|
||||
s_options_customize_options_action.generic.y = 130;
|
||||
s_options_customize_options_action.generic.name = "customize controls";
|
||||
s_options_customize_options_action.generic.callback = CustomizeControlsFunc;
|
||||
|
||||
s_options_defaults_action.generic.type = MTYPE_ACTION;
|
||||
s_options_defaults_action.generic.x = 0;
|
||||
s_options_defaults_action.generic.y = 150;
|
||||
s_options_defaults_action.generic.y = 140;
|
||||
s_options_defaults_action.generic.name = "reset defaults";
|
||||
s_options_defaults_action.generic.callback = ControlsResetDefaultsFunc;
|
||||
|
||||
s_options_console_action.generic.type = MTYPE_ACTION;
|
||||
s_options_console_action.generic.x = 0;
|
||||
s_options_console_action.generic.y = 160;
|
||||
s_options_console_action.generic.y = 150;
|
||||
s_options_console_action.generic.name = "go to console";
|
||||
s_options_console_action.generic.callback = ConsoleFunc;
|
||||
|
||||
|
@ -1287,7 +1253,6 @@ void Options_MenuInit( void )
|
|||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_lookstrafe_box );
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_freelook_box );
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_crosshair_box );
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_joystick_box );
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_customize_options_action );
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_defaults_action );
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_console_action );
|
||||
|
@ -2042,8 +2007,8 @@ void RulesChangeFunc ( void *self )
|
|||
else if(s_rules_box.curvalue == 1) // coop // PGM
|
||||
{
|
||||
s_maxclients_field.generic.statusbar = "4 maximum for cooperative";
|
||||
if (atoi(s_maxclients_field.buffer) > 4)
|
||||
strcpy( s_maxclients_field.buffer, "4" );
|
||||
if (atoi(s_maxclients_field.field.buffer) > 4)
|
||||
strcpy( s_maxclients_field.field.buffer, "4" );
|
||||
s_startserver_dmoptions_action.generic.statusbar = "N/A for cooperative";
|
||||
}
|
||||
}
|
||||
|
@ -2058,14 +2023,14 @@ void StartServerActionFunc( void *self )
|
|||
|
||||
strcpy( startmap, strchr( mapnames[s_startmap_list.curvalue], '\n' ) + 1 );
|
||||
|
||||
maxclients = atoi( s_maxclients_field.buffer );
|
||||
timelimit = atoi( s_timelimit_field.buffer );
|
||||
fraglimit = atoi( s_fraglimit_field.buffer );
|
||||
maxclients = atoi( s_maxclients_field.field.buffer );
|
||||
timelimit = atoi( s_timelimit_field.field.buffer );
|
||||
fraglimit = atoi( s_fraglimit_field.field.buffer );
|
||||
|
||||
Cvar_SetValue( "maxclients", ClampCvar( 0, maxclients, maxclients ) );
|
||||
Cvar_SetValue ("timelimit", ClampCvar( 0, timelimit, timelimit ) );
|
||||
Cvar_SetValue ("fraglimit", ClampCvar( 0, fraglimit, fraglimit ) );
|
||||
Cvar_Set("hostname", s_hostname_field.buffer );
|
||||
Cvar_Set("hostname", s_hostname_field.field.buffer );
|
||||
Cvar_SetValue ("deathmatch", !s_rules_box.curvalue );
|
||||
Cvar_SetValue ("coop", s_rules_box.curvalue );
|
||||
|
||||
|
@ -2292,9 +2257,9 @@ void StartServer_MenuInit( void )
|
|||
s_timelimit_field.generic.x = 0;
|
||||
s_timelimit_field.generic.y = 36;
|
||||
s_timelimit_field.generic.statusbar = "0 = no limit";
|
||||
s_timelimit_field.length = 3;
|
||||
s_timelimit_field.visible_length = 3;
|
||||
strcpy( s_timelimit_field.buffer, Cvar_VariableString("timelimit") );
|
||||
s_timelimit_field.field.maxchars = 3;
|
||||
s_timelimit_field.field.widthInChars = 3;
|
||||
strcpy( s_timelimit_field.field.buffer, Cvar_VariableString("timelimit") );
|
||||
|
||||
s_fraglimit_field.generic.type = MTYPE_FIELD;
|
||||
s_fraglimit_field.generic.name = "frag limit";
|
||||
|
@ -2302,9 +2267,9 @@ void StartServer_MenuInit( void )
|
|||
s_fraglimit_field.generic.x = 0;
|
||||
s_fraglimit_field.generic.y = 54;
|
||||
s_fraglimit_field.generic.statusbar = "0 = no limit";
|
||||
s_fraglimit_field.length = 3;
|
||||
s_fraglimit_field.visible_length = 3;
|
||||
strcpy( s_fraglimit_field.buffer, Cvar_VariableString("fraglimit") );
|
||||
s_fraglimit_field.field.maxchars = 3;
|
||||
s_fraglimit_field.field.widthInChars = 3;
|
||||
strcpy( s_fraglimit_field.field.buffer, Cvar_VariableString("fraglimit") );
|
||||
|
||||
/*
|
||||
** maxclients determines the maximum number of players that can join
|
||||
|
@ -2318,12 +2283,12 @@ void StartServer_MenuInit( void )
|
|||
s_maxclients_field.generic.x = 0;
|
||||
s_maxclients_field.generic.y = 72;
|
||||
s_maxclients_field.generic.statusbar = NULL;
|
||||
s_maxclients_field.length = 3;
|
||||
s_maxclients_field.visible_length = 3;
|
||||
s_maxclients_field.field.maxchars = 3;
|
||||
s_maxclients_field.field.widthInChars = 3;
|
||||
if ( Cvar_VariableValue( "maxclients" ) == 1 )
|
||||
strcpy( s_maxclients_field.buffer, "8" );
|
||||
strcpy( s_maxclients_field.field.buffer, "8" );
|
||||
else
|
||||
strcpy( s_maxclients_field.buffer, Cvar_VariableString("maxclients") );
|
||||
strcpy( s_maxclients_field.field.buffer, Cvar_VariableString("maxclients") );
|
||||
|
||||
s_hostname_field.generic.type = MTYPE_FIELD;
|
||||
s_hostname_field.generic.name = "hostname";
|
||||
|
@ -2331,9 +2296,9 @@ void StartServer_MenuInit( void )
|
|||
s_hostname_field.generic.x = 0;
|
||||
s_hostname_field.generic.y = 90;
|
||||
s_hostname_field.generic.statusbar = NULL;
|
||||
s_hostname_field.length = 12;
|
||||
s_hostname_field.visible_length = 12;
|
||||
strcpy( s_hostname_field.buffer, Cvar_VariableString("hostname") );
|
||||
s_hostname_field.field.maxchars = 12;
|
||||
s_hostname_field.field.widthInChars = 12;
|
||||
strcpy( s_hostname_field.field.buffer, Cvar_VariableString("hostname") );
|
||||
|
||||
s_startserver_dmoptions_action.generic.type = MTYPE_ACTION;
|
||||
s_startserver_dmoptions_action.generic.name = " deathmatch flags";
|
||||
|
@ -2881,11 +2846,11 @@ void AddressBook_MenuInit( void )
|
|||
s_addressbook_fields[i].generic.x = 0;
|
||||
s_addressbook_fields[i].generic.y = i * 18 + 0;
|
||||
s_addressbook_fields[i].generic.localdata[0] = i;
|
||||
s_addressbook_fields[i].cursor = 0;
|
||||
s_addressbook_fields[i].length = 60;
|
||||
s_addressbook_fields[i].visible_length = 30;
|
||||
s_addressbook_fields[i].field.cursor = 0;
|
||||
s_addressbook_fields[i].field.maxchars = 60;
|
||||
s_addressbook_fields[i].field.widthInChars = 30;
|
||||
|
||||
strcpy( s_addressbook_fields[i].buffer, adr->string );
|
||||
strcpy( s_addressbook_fields[i].field.buffer, adr->string );
|
||||
|
||||
Menu_AddItem( &s_addressbook_menu, &s_addressbook_fields[i] );
|
||||
}
|
||||
|
@ -2901,7 +2866,7 @@ const char *AddressBook_MenuKey( int key )
|
|||
for ( index = 0; index < NUM_ADDRESSBOOK_ENTRIES; index++ )
|
||||
{
|
||||
sprintf( buffer, "adr%d", index );
|
||||
Cvar_Set( buffer, s_addressbook_fields[index].buffer );
|
||||
Cvar_Set( buffer, s_addressbook_fields[index].field.buffer );
|
||||
}
|
||||
}
|
||||
return Default_MenuKey( &s_addressbook_menu, key );
|
||||
|
@ -3110,10 +3075,10 @@ bool PlayerConfig_MenuInit( void )
|
|||
s_player_name_field.generic.callback = 0;
|
||||
s_player_name_field.generic.x = 0;
|
||||
s_player_name_field.generic.y = 0;
|
||||
s_player_name_field.length = 20;
|
||||
s_player_name_field.visible_length = 20;
|
||||
strcpy( s_player_name_field.buffer, name->string );
|
||||
s_player_name_field.cursor = strlen( name->string );
|
||||
s_player_name_field.field.maxchars = 20;
|
||||
s_player_name_field.field.widthInChars = 20;
|
||||
strcpy( s_player_name_field.field.buffer, name->string );
|
||||
s_player_name_field.field.cursor = strlen( name->string );
|
||||
|
||||
s_player_model_title.generic.type = MTYPE_SEPARATOR;
|
||||
s_player_model_title.generic.name = "model";
|
||||
|
@ -3243,7 +3208,7 @@ const char *PlayerConfig_MenuKey (int key)
|
|||
{
|
||||
if ( key == K_ESCAPE )
|
||||
{
|
||||
Cvar_Set( "name", s_player_name_field.buffer );
|
||||
Cvar_Set( "name", s_player_name_field.field.buffer );
|
||||
}
|
||||
return Default_MenuKey( &s_player_config_menu, key );
|
||||
}
|
||||
|
@ -3362,17 +3327,9 @@ M_Draw
|
|||
*/
|
||||
void M_Draw (void)
|
||||
{
|
||||
if (cls.key_dest != key_menu)
|
||||
return;
|
||||
if (cls.key_dest != key_menu) return;
|
||||
|
||||
// repaint everything next frame
|
||||
SCR_DirtyScreen ();
|
||||
|
||||
// dim everything behind it down
|
||||
if (cl.cinematictime > 0) SCR_DrawCinematic();
|
||||
else re->DrawFadeScreen ();
|
||||
|
||||
m_drawfunc ();
|
||||
m_drawfunc();
|
||||
|
||||
// delay playing the enter sound until after the
|
||||
// menu has been drawn, to avoid delay while
|
||||
|
@ -3395,8 +3352,10 @@ void M_Keydown (int key)
|
|||
const char *s;
|
||||
|
||||
if (m_keyfunc)
|
||||
if ( ( s = m_keyfunc( key ) ) != 0 )
|
||||
S_StartLocalSound( ( char * ) s );
|
||||
{
|
||||
if(( s = m_keyfunc( key )) != 0 )
|
||||
S_StartLocalSound(( char * )s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -91,15 +91,15 @@ void QField_Draw( menufield_s *f )
|
|||
if ( f->generic.name )
|
||||
Menu_DrawStringR2LDark( f->generic.x + f->generic.parent->x + LCOLUMN_OFFSET, f->generic.y + f->generic.parent->y, f->generic.name );
|
||||
|
||||
strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length );
|
||||
strncpy( tempbuffer, f->field.buffer + f->field.scroll, f->field.widthInChars );
|
||||
|
||||
Draw_Char( f->generic.x + f->generic.parent->x + 16, f->generic.y + f->generic.parent->y - 4, 18 );
|
||||
Draw_Char( f->generic.x + f->generic.parent->x + 16, f->generic.y + f->generic.parent->y + 4, 24 );
|
||||
|
||||
Draw_Char( f->generic.x + f->generic.parent->x + 24 + f->visible_length * 8, f->generic.y + f->generic.parent->y - 4, 20 );
|
||||
Draw_Char( f->generic.x + f->generic.parent->x + 24 + f->visible_length * 8, f->generic.y + f->generic.parent->y + 4, 26 );
|
||||
Draw_Char( f->generic.x + f->generic.parent->x + 24 + f->field.widthInChars * 8, f->generic.y + f->generic.parent->y - 4, 20 );
|
||||
Draw_Char( f->generic.x + f->generic.parent->x + 24 + f->field.widthInChars * 8, f->generic.y + f->generic.parent->y + 4, 26 );
|
||||
|
||||
for ( i = 0; i < f->visible_length; i++ )
|
||||
for ( i = 0; i < f->field.widthInChars; i++ )
|
||||
{
|
||||
Draw_Char( f->generic.x + f->generic.parent->x + 24 + i * 8, f->generic.y + f->generic.parent->y - 4, 19 );
|
||||
Draw_Char( f->generic.x + f->generic.parent->x + 24 + i * 8, f->generic.y + f->generic.parent->y + 4, 25 );
|
||||
|
@ -111,10 +111,10 @@ void QField_Draw( menufield_s *f )
|
|||
{
|
||||
int offset;
|
||||
|
||||
if ( f->visible_offset )
|
||||
offset = f->visible_length;
|
||||
if ( f->field.scroll )
|
||||
offset = f->field.widthInChars;
|
||||
else
|
||||
offset = f->cursor;
|
||||
offset = f->field.cursor;
|
||||
|
||||
if ( ( ( int ) ( cls.realtime * 4.0f ) ) & 1 )
|
||||
{
|
||||
|
@ -133,130 +133,29 @@ void QField_Draw( menufield_s *f )
|
|||
|
||||
bool Field_Key( menufield_s *f, int key )
|
||||
{
|
||||
extern int keydown[];
|
||||
|
||||
// ignore these keys
|
||||
switch ( key )
|
||||
{
|
||||
case K_KP_SLASH:
|
||||
key = '/';
|
||||
break;
|
||||
case K_KP_MINUS:
|
||||
key = '-';
|
||||
break;
|
||||
case K_KP_PLUS:
|
||||
key = '+';
|
||||
break;
|
||||
case K_KP_HOME:
|
||||
key = '7';
|
||||
break;
|
||||
case K_KP_UPARROW:
|
||||
key = '8';
|
||||
break;
|
||||
case K_KP_PGUP:
|
||||
key = '9';
|
||||
break;
|
||||
case K_KP_LEFTARROW:
|
||||
key = '4';
|
||||
break;
|
||||
case K_KP_5:
|
||||
key = '5';
|
||||
break;
|
||||
case K_KP_RIGHTARROW:
|
||||
key = '6';
|
||||
break;
|
||||
case K_KP_END:
|
||||
key = '1';
|
||||
break;
|
||||
case K_KP_DOWNARROW:
|
||||
key = '2';
|
||||
break;
|
||||
case K_KP_PGDN:
|
||||
key = '3';
|
||||
break;
|
||||
case K_KP_INS:
|
||||
key = '0';
|
||||
break;
|
||||
case K_KP_DEL:
|
||||
key = '.';
|
||||
break;
|
||||
}
|
||||
|
||||
if ( key > 127 )
|
||||
{
|
||||
switch ( key )
|
||||
{
|
||||
case K_DEL:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** support pasting from the clipboard
|
||||
*/
|
||||
if ( ( toupper( key ) == 'V' && keys[K_CTRL].down ) || ((( key == K_INS ) || ( key == K_KP_INS )) && keys[K_SHIFT].down ))
|
||||
{
|
||||
char *cbd;
|
||||
|
||||
if ( ( cbd = Sys_GetClipboardData() ) != 0 )
|
||||
{
|
||||
strtok( cbd, "\n\r\b" );
|
||||
|
||||
strncpy( f->buffer, cbd, f->length - 1 );
|
||||
f->cursor = strlen( f->buffer );
|
||||
f->visible_offset = f->cursor - f->visible_length;
|
||||
if ( f->visible_offset < 0 ) f->visible_offset = 0;
|
||||
|
||||
Z_Free( cbd );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
switch ( key )
|
||||
{
|
||||
case K_KP_LEFTARROW:
|
||||
case K_LEFTARROW:
|
||||
case K_BACKSPACE:
|
||||
if ( f->cursor > 0 )
|
||||
{
|
||||
memmove( &f->buffer[f->cursor-1], &f->buffer[f->cursor], strlen( &f->buffer[f->cursor] ) + 1 );
|
||||
f->cursor--;
|
||||
|
||||
if ( f->visible_offset )
|
||||
{
|
||||
f->visible_offset--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case K_KP_DEL:
|
||||
case K_DEL:
|
||||
memmove( &f->buffer[f->cursor], &f->buffer[f->cursor+1], strlen( &f->buffer[f->cursor+1] ) + 1 );
|
||||
break;
|
||||
|
||||
case K_DOWNARROW:
|
||||
case K_KP_UPARROW:
|
||||
case K_UPARROW:
|
||||
case K_KP_ENTER:
|
||||
case K_ENTER:
|
||||
case K_ESCAPE:
|
||||
case K_TAB:
|
||||
return false;
|
||||
|
||||
case K_SPACE:
|
||||
default:
|
||||
if ( !isdigit( key ) && ( f->generic.flags & QMF_NUMBERSONLY ) )
|
||||
return false;
|
||||
|
||||
if ( f->cursor < f->length )
|
||||
{
|
||||
f->buffer[f->cursor++] = key;
|
||||
f->buffer[f->cursor] = 0;
|
||||
|
||||
if ( f->cursor > f->visible_length )
|
||||
{
|
||||
f->visible_offset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( key < 127 && !Key_IsDown(K_CTRL))
|
||||
{
|
||||
// pass to the normal editline routine
|
||||
if(!isdigit( key ) && ( f->generic.flags & QMF_NUMBERSONLY ))
|
||||
return false; // numbers only
|
||||
else Field_CharEvent( &f->field, key );
|
||||
}
|
||||
else Field_KeyDownEvent( &f->field, key ); // system symbols
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,19 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define MTYPE_SEPARATOR 4
|
||||
#define MTYPE_FIELD 5
|
||||
|
||||
#define K_TAB 9
|
||||
#define K_ENTER 13
|
||||
#define K_ESCAPE 27
|
||||
#define K_SPACE 32
|
||||
|
||||
#include "keycodes.h"
|
||||
// normal keys should be passed as lowercased ascii
|
||||
|
||||
#define K_BACKSPACE 127
|
||||
#define K_UPARROW 128
|
||||
#define K_DOWNARROW 129
|
||||
#define K_LEFTARROW 130
|
||||
#define K_RIGHTARROW 131
|
||||
|
||||
#define QMF_LEFT_JUSTIFY 0x00000001
|
||||
#define QMF_GRAYED 0x00000002
|
||||
#define QMF_NUMBERSONLY 0x00000004
|
||||
|
@ -81,13 +71,8 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
menucommon_s generic;
|
||||
|
||||
char buffer[80];
|
||||
int cursor;
|
||||
int length;
|
||||
int visible_length;
|
||||
int visible_offset;
|
||||
menucommon_s generic;
|
||||
field_t field;
|
||||
} menufield_s;
|
||||
|
||||
typedef struct
|
||||
|
@ -127,10 +112,10 @@ void Menu_AdjustCursor( menuframework_s *menu, int dir );
|
|||
void Menu_Center( menuframework_s *menu );
|
||||
void Menu_Draw( menuframework_s *menu );
|
||||
void *Menu_ItemAtCursor( menuframework_s *m );
|
||||
bool Menu_SelectItem( menuframework_s *s );
|
||||
bool Menu_SelectItem( menuframework_s *s );
|
||||
void Menu_SetStatusBar( menuframework_s *s, const char *string );
|
||||
void Menu_SlideItem( menuframework_s *s, int dir );
|
||||
int Menu_TallySlots( menuframework_s *menu );
|
||||
int Menu_TallySlots( menuframework_s *menu );
|
||||
|
||||
void Menu_DrawString( int, int, const char * );
|
||||
void Menu_DrawStringDark( int, int, const char * );
|
||||
|
|
|
@ -73,8 +73,6 @@ void SCR_CenterPrint (char *str);
|
|||
void SCR_BeginLoadingPlaque (void);
|
||||
void SCR_EndLoadingPlaque (void);
|
||||
|
||||
void SCR_DebugGraph (float value, vec4_t color);
|
||||
|
||||
void SCR_TouchPics (void);
|
||||
|
||||
void SCR_RunConsole (void);
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef enum
|
|||
HOST_SHUTDOWN, // shutdown operations
|
||||
HOST_ERROR, // host stopped by error
|
||||
HOST_SLEEP, // sleeped by different reason, e.g. minimize window
|
||||
HOST_NOFOCUS, // same as HOST_FRAME, but disable mouse and joy
|
||||
HOST_NOFOCUS, // same as HOST_FRAME, but disable mouse
|
||||
|
||||
} host_state;
|
||||
|
||||
|
@ -67,6 +67,7 @@ typedef struct host_parm_s
|
|||
int developer; // show all developer's message
|
||||
|
||||
bool paused; // freeze server
|
||||
bool stuffcmdsrun; // sturtup script
|
||||
|
||||
jmp_buf abortframe; // abort current frame
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ void Host_Init (char *funcname, int argc, char **argv)
|
|||
Key_Init();
|
||||
PRVM_Init();
|
||||
|
||||
Cbuf_AddText("exec base.rc\n");
|
||||
// get default configuration
|
||||
Cbuf_AddText("exec keys.rc\n");
|
||||
Cbuf_AddText("exec vars.rc\n");
|
||||
Cbuf_Execute();
|
||||
|
@ -175,19 +175,13 @@ void Host_Init (char *funcname, int argc, char **argv)
|
|||
SV_Init();
|
||||
CL_Init();
|
||||
|
||||
// add + commands from command line
|
||||
if(!Cmd_AddStartupCommands())
|
||||
{
|
||||
// if the user didn't give any commands, run default action
|
||||
if ( host.type != HOST_DEDICATED )
|
||||
Cbuf_AddText ("demomap idlogo.roq\n");
|
||||
else Cbuf_AddText ("map dm_qstyle\n");
|
||||
}
|
||||
else
|
||||
{ // the user asked for something explicit
|
||||
// so drop the loading plaque
|
||||
SCR_EndLoadingPlaque ();
|
||||
}
|
||||
Cbuf_AddText("exec init.rc\n");
|
||||
Cbuf_Execute();
|
||||
|
||||
// if stuffcmds wasn't run, then init.rc is probably missing, use default
|
||||
if(!host.stuffcmdsrun) Cbuf_ExecuteText( EXEC_NOW, "stuffcmds\n" );
|
||||
|
||||
SCR_EndLoadingPlaque ();
|
||||
Sys_DoubleTime(); // initialize timer
|
||||
}
|
||||
|
||||
|
|
550
engine/in_win.c
550
engine/in_win.c
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// in_win.c -- windows 95 mouse and joystick code
|
||||
// in_win.c -- windows 95 mouse code
|
||||
// 02/21/97 JCB Added extended DirectInput code to support external controllers.
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -27,76 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
extern HWND cl_hwnd;
|
||||
extern bool ActiveApp, Minimized;
|
||||
|
||||
// joystick defines and variables
|
||||
// where should defines be moved?
|
||||
#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick
|
||||
#define JOY_RELATIVE_AXIS 0x00000010 // control like a mouse, spinner, trackball
|
||||
#define JOY_MAX_AXES 6 // X, Y, Z, R, U, V
|
||||
#define JOY_AXIS_X 0
|
||||
#define JOY_AXIS_Y 1
|
||||
#define JOY_AXIS_Z 2
|
||||
#define JOY_AXIS_R 3
|
||||
#define JOY_AXIS_U 4
|
||||
#define JOY_AXIS_V 5
|
||||
|
||||
enum _ControlList
|
||||
{
|
||||
AxisNada = 0, AxisForward, AxisLook, AxisSide, AxisTurn, AxisUp
|
||||
};
|
||||
|
||||
DWORD dwAxisFlags[JOY_MAX_AXES] =
|
||||
{
|
||||
JOY_RETURNX, JOY_RETURNY, JOY_RETURNZ, JOY_RETURNR, JOY_RETURNU, JOY_RETURNV
|
||||
};
|
||||
|
||||
DWORD dwAxisMap[JOY_MAX_AXES];
|
||||
DWORD dwControlMap[JOY_MAX_AXES];
|
||||
PDWORD pdwRawValue[JOY_MAX_AXES];
|
||||
|
||||
cvar_t *in_mouse;
|
||||
cvar_t *in_joystick;
|
||||
|
||||
|
||||
// none of these cvars are saved over a session
|
||||
// this means that advanced controller configuration needs to be executed
|
||||
// each time. this avoids any problems with getting back to a default usage
|
||||
// or when changing from one controller to another. this way at least something
|
||||
// works.
|
||||
cvar_t *joy_name;
|
||||
cvar_t *joy_advanced;
|
||||
cvar_t *joy_advaxisx;
|
||||
cvar_t *joy_advaxisy;
|
||||
cvar_t *joy_advaxisz;
|
||||
cvar_t *joy_advaxisr;
|
||||
cvar_t *joy_advaxisu;
|
||||
cvar_t *joy_advaxisv;
|
||||
cvar_t *joy_forwardthreshold;
|
||||
cvar_t *joy_sidethreshold;
|
||||
cvar_t *joy_pitchthreshold;
|
||||
cvar_t *joy_yawthreshold;
|
||||
cvar_t *joy_forwardsensitivity;
|
||||
cvar_t *joy_sidesensitivity;
|
||||
cvar_t *joy_pitchsensitivity;
|
||||
cvar_t *joy_yawsensitivity;
|
||||
cvar_t *joy_upthreshold;
|
||||
cvar_t *joy_upsensitivity;
|
||||
|
||||
bool joy_avail, joy_advancedinit, joy_haspov;
|
||||
DWORD joy_oldbuttonstate, joy_oldpovstate;
|
||||
|
||||
int joy_id;
|
||||
DWORD joy_flags;
|
||||
DWORD joy_numbuttons;
|
||||
|
||||
static JOYINFOEX ji;
|
||||
|
||||
bool in_appactive;
|
||||
|
||||
// forward-referenced functions
|
||||
void IN_StartupJoystick (void);
|
||||
void Joy_AdvancedUpdate_f (void);
|
||||
void IN_JoyMove (usercmd_t *cmd);
|
||||
|
||||
/*
|
||||
============================================================
|
||||
|
||||
|
@ -110,29 +44,34 @@ cvar_t *m_filter;
|
|||
|
||||
bool mlooking;
|
||||
|
||||
void IN_MLookDown (void) { mlooking = true; }
|
||||
void IN_MLookUp (void) {
|
||||
mlooking = false;
|
||||
if (!freelook->value && lookspring->value)
|
||||
void IN_MLookDown (void)
|
||||
{
|
||||
mlooking = true;
|
||||
}
|
||||
|
||||
void IN_MLookUp (void)
|
||||
{
|
||||
mlooking = false;
|
||||
if (!freelook->value && lookspring->value)
|
||||
IN_CenterView ();
|
||||
}
|
||||
|
||||
int mouse_buttons;
|
||||
int mouse_oldbuttonstate;
|
||||
POINT current_pos;
|
||||
int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum;
|
||||
int mouse_buttons;
|
||||
int mouse_oldbuttonstate;
|
||||
POINT current_pos;
|
||||
int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum;
|
||||
|
||||
int old_x, old_y;
|
||||
int old_x, old_y;
|
||||
|
||||
bool mouseactive; // false when not focus app
|
||||
|
||||
bool restore_spi;
|
||||
bool mouseinitialized;
|
||||
int originalmouseparms[3], newmouseparms[3] = {0, 0, 1};
|
||||
int originalmouseparms[3], newmouseparms[3] = {0, 0, 1};
|
||||
bool mouseparmsvalid;
|
||||
|
||||
int window_center_x, window_center_y;
|
||||
RECT window_rect;
|
||||
int window_center_x, window_center_y;
|
||||
RECT window_rect;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -347,28 +286,7 @@ void IN_Init (void)
|
|||
{
|
||||
// mouse variables
|
||||
m_filter = Cvar_Get ("m_filter", "0", 0);
|
||||
in_mouse = Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
|
||||
|
||||
// joystick variables
|
||||
in_joystick = Cvar_Get ("in_joystick", "0", CVAR_ARCHIVE);
|
||||
joy_name = Cvar_Get ("joy_name", "joystick", 0);
|
||||
joy_advanced = Cvar_Get ("joy_advanced", "0", 0);
|
||||
joy_advaxisx = Cvar_Get ("joy_advaxisx", "0", 0);
|
||||
joy_advaxisy = Cvar_Get ("joy_advaxisy", "0", 0);
|
||||
joy_advaxisz = Cvar_Get ("joy_advaxisz", "0", 0);
|
||||
joy_advaxisr = Cvar_Get ("joy_advaxisr", "0", 0);
|
||||
joy_advaxisu = Cvar_Get ("joy_advaxisu", "0", 0);
|
||||
joy_advaxisv = Cvar_Get ("joy_advaxisv", "0", 0);
|
||||
joy_forwardthreshold = Cvar_Get ("joy_forwardthreshold", "0.15", 0);
|
||||
joy_sidethreshold = Cvar_Get ("joy_sidethreshold", "0.15", 0);
|
||||
joy_upthreshold = Cvar_Get ("joy_upthreshold", "0.15", 0);
|
||||
joy_pitchthreshold = Cvar_Get ("joy_pitchthreshold", "0.15", 0);
|
||||
joy_yawthreshold = Cvar_Get ("joy_yawthreshold", "0.15", 0);
|
||||
joy_forwardsensitivity = Cvar_Get ("joy_forwardsensitivity", "-1", 0);
|
||||
joy_sidesensitivity = Cvar_Get ("joy_sidesensitivity", "-1", 0);
|
||||
joy_upsensitivity = Cvar_Get ("joy_upsensitivity", "-1", 0);
|
||||
joy_pitchsensitivity = Cvar_Get ("joy_pitchsensitivity", "1", 0);
|
||||
joy_yawsensitivity = Cvar_Get ("joy_yawsensitivity", "-1", 0);
|
||||
in_mouse = Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
|
||||
|
||||
// centering
|
||||
v_centermove = Cvar_Get ("v_centermove", "0.15", 0);
|
||||
|
@ -377,10 +295,7 @@ void IN_Init (void)
|
|||
Cmd_AddCommand ("+mlook", IN_MLookDown);
|
||||
Cmd_AddCommand ("-mlook", IN_MLookUp);
|
||||
|
||||
Cmd_AddCommand ("joy_advancedupdate", Joy_AdvancedUpdate_f);
|
||||
|
||||
IN_StartupMouse ();
|
||||
IN_StartupJoystick ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -406,7 +321,7 @@ between a deactivate and an activate.
|
|||
void IN_Activate (bool active)
|
||||
{
|
||||
in_appactive = active;
|
||||
mouseactive = !active; // force a new window check or turn off
|
||||
mouseactive = !active; // force a new window check or turn off
|
||||
}
|
||||
|
||||
|
||||
|
@ -449,9 +364,6 @@ IN_Move
|
|||
void IN_Move (usercmd_t *cmd)
|
||||
{
|
||||
IN_MouseMove (cmd);
|
||||
|
||||
if (ActiveApp)
|
||||
IN_JoyMove (cmd);
|
||||
}
|
||||
|
||||
|
||||
|
@ -465,424 +377,4 @@ void IN_ClearStates (void)
|
|||
mx_accum = 0;
|
||||
my_accum = 0;
|
||||
mouse_oldbuttonstate = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=========================================================================
|
||||
|
||||
JOYSTICK
|
||||
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
===============
|
||||
IN_StartupJoystick
|
||||
===============
|
||||
*/
|
||||
void IN_StartupJoystick (void)
|
||||
{
|
||||
int numdevs;
|
||||
JOYCAPS jc;
|
||||
MMRESULT mmr;
|
||||
cvar_t *cv;
|
||||
|
||||
// assume no joystick
|
||||
joy_avail = false;
|
||||
|
||||
// abort startup if user requests no joystick
|
||||
cv = Cvar_Get ("in_initjoy", "1", CVAR_INIT);
|
||||
if ( !cv->value )
|
||||
return;
|
||||
|
||||
// verify joystick driver is present
|
||||
if ((numdevs = joyGetNumDevs ()) == 0)
|
||||
{
|
||||
// Msg ("\njoystick not found -- driver not present\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// cycle through the joystick ids for the first valid one
|
||||
for (joy_id=0 ; joy_id<numdevs ; joy_id++)
|
||||
{
|
||||
memset (&ji, 0, sizeof(ji));
|
||||
ji.dwSize = sizeof(ji);
|
||||
ji.dwFlags = JOY_RETURNCENTERED;
|
||||
|
||||
if ((mmr = joyGetPosEx (joy_id, &ji)) == JOYERR_NOERROR)
|
||||
break;
|
||||
}
|
||||
|
||||
// abort startup if we didn't find a valid joystick
|
||||
if (mmr != JOYERR_NOERROR)
|
||||
{
|
||||
Msg ("\njoystick not found -- no valid joysticks (%x)\n\n", mmr);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the capabilities of the selected joystick
|
||||
// abort startup if command fails
|
||||
memset (&jc, 0, sizeof(jc));
|
||||
if ((mmr = joyGetDevCaps (joy_id, &jc, sizeof(jc))) != JOYERR_NOERROR)
|
||||
{
|
||||
Msg ("\njoystick not found -- invalid joystick capabilities (%x)\n\n", mmr);
|
||||
return;
|
||||
}
|
||||
|
||||
// save the joystick's number of buttons and POV status
|
||||
joy_numbuttons = jc.wNumButtons;
|
||||
joy_haspov = jc.wCaps & JOYCAPS_HASPOV;
|
||||
|
||||
// old button and POV states default to no buttons pressed
|
||||
joy_oldbuttonstate = joy_oldpovstate = 0;
|
||||
|
||||
// mark the joystick as available and advanced initialization not completed
|
||||
// this is needed as cvars are not available during initialization
|
||||
|
||||
joy_avail = true;
|
||||
joy_advancedinit = false;
|
||||
|
||||
Msg ("\njoystick detected\n\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
RawValuePointer
|
||||
===========
|
||||
*/
|
||||
PDWORD RawValuePointer (int axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case JOY_AXIS_X:
|
||||
return &ji.dwXpos;
|
||||
case JOY_AXIS_Y:
|
||||
return &ji.dwYpos;
|
||||
case JOY_AXIS_Z:
|
||||
return &ji.dwZpos;
|
||||
case JOY_AXIS_R:
|
||||
return &ji.dwRpos;
|
||||
case JOY_AXIS_U:
|
||||
return &ji.dwUpos;
|
||||
case JOY_AXIS_V:
|
||||
return &ji.dwVpos;
|
||||
}
|
||||
return NULL; // just in case
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
Joy_AdvancedUpdate_f
|
||||
===========
|
||||
*/
|
||||
void Joy_AdvancedUpdate_f (void)
|
||||
{
|
||||
|
||||
// called once by IN_ReadJoystick and by user whenever an update is needed
|
||||
// cvars are now available
|
||||
int i;
|
||||
DWORD dwTemp;
|
||||
|
||||
// initialize all the maps
|
||||
for (i = 0; i < JOY_MAX_AXES; i++)
|
||||
{
|
||||
dwAxisMap[i] = AxisNada;
|
||||
dwControlMap[i] = JOY_ABSOLUTE_AXIS;
|
||||
pdwRawValue[i] = RawValuePointer(i);
|
||||
}
|
||||
|
||||
if( joy_advanced->value == 0.0)
|
||||
{
|
||||
// default joystick initialization
|
||||
// 2 axes only with joystick control
|
||||
dwAxisMap[JOY_AXIS_X] = AxisTurn;
|
||||
// dwControlMap[JOY_AXIS_X] = JOY_ABSOLUTE_AXIS;
|
||||
dwAxisMap[JOY_AXIS_Y] = AxisForward;
|
||||
// dwControlMap[JOY_AXIS_Y] = JOY_ABSOLUTE_AXIS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (joy_name->string, "joystick") != 0)
|
||||
{
|
||||
// notify user of advanced controller
|
||||
Msg ("\n%s configured\n\n", joy_name->string);
|
||||
}
|
||||
|
||||
// advanced initialization here
|
||||
// data supplied by user via joy_axisn cvars
|
||||
dwTemp = (DWORD) joy_advaxisx->value;
|
||||
dwAxisMap[JOY_AXIS_X] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_X] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD) joy_advaxisy->value;
|
||||
dwAxisMap[JOY_AXIS_Y] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_Y] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD) joy_advaxisz->value;
|
||||
dwAxisMap[JOY_AXIS_Z] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_Z] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD) joy_advaxisr->value;
|
||||
dwAxisMap[JOY_AXIS_R] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_R] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD) joy_advaxisu->value;
|
||||
dwAxisMap[JOY_AXIS_U] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_U] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD) joy_advaxisv->value;
|
||||
dwAxisMap[JOY_AXIS_V] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
}
|
||||
|
||||
// compute the axes to collect from DirectInput
|
||||
joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV;
|
||||
for (i = 0; i < JOY_MAX_AXES; i++)
|
||||
{
|
||||
if (dwAxisMap[i] != AxisNada)
|
||||
{
|
||||
joy_flags |= dwAxisFlags[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Commands
|
||||
===========
|
||||
*/
|
||||
void IN_Commands (void)
|
||||
{
|
||||
int i, key_index;
|
||||
DWORD buttonstate, povstate;
|
||||
|
||||
if (!joy_avail)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// loop through the joystick buttons
|
||||
// key a joystick event or auxillary event for higher number buttons for each state change
|
||||
buttonstate = ji.dwButtons;
|
||||
for (i=0 ; i < joy_numbuttons ; i++)
|
||||
{
|
||||
if ( (buttonstate & (1<<i)) && !(joy_oldbuttonstate & (1<<i)) )
|
||||
{
|
||||
key_index = (i < 4) ? K_JOY1 : K_AUX1;
|
||||
Key_Event (key_index + i, true, 0);
|
||||
}
|
||||
|
||||
if ( !(buttonstate & (1<<i)) && (joy_oldbuttonstate & (1<<i)) )
|
||||
{
|
||||
key_index = (i < 4) ? K_JOY1 : K_AUX1;
|
||||
Key_Event (key_index + i, false, 0);
|
||||
}
|
||||
}
|
||||
joy_oldbuttonstate = buttonstate;
|
||||
|
||||
if (joy_haspov)
|
||||
{
|
||||
// convert POV information into 4 bits of state information
|
||||
// this avoids any potential problems related to moving from one
|
||||
// direction to another without going through the center position
|
||||
povstate = 0;
|
||||
if(ji.dwPOV != JOY_POVCENTERED)
|
||||
{
|
||||
if (ji.dwPOV == JOY_POVFORWARD)
|
||||
povstate |= 0x01;
|
||||
if (ji.dwPOV == JOY_POVRIGHT)
|
||||
povstate |= 0x02;
|
||||
if (ji.dwPOV == JOY_POVBACKWARD)
|
||||
povstate |= 0x04;
|
||||
if (ji.dwPOV == JOY_POVLEFT)
|
||||
povstate |= 0x08;
|
||||
}
|
||||
// determine which bits have changed and key an auxillary event for each change
|
||||
for (i=0 ; i < 4 ; i++)
|
||||
{
|
||||
if ( (povstate & (1<<i)) && !(joy_oldpovstate & (1<<i)) )
|
||||
{
|
||||
Key_Event (K_AUX16 + i, true, 0);
|
||||
}
|
||||
|
||||
if ( !(povstate & (1<<i)) && (joy_oldpovstate & (1<<i)) )
|
||||
{
|
||||
Key_Event (K_AUX16 + i, false, 0);
|
||||
}
|
||||
}
|
||||
joy_oldpovstate = povstate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
IN_ReadJoystick
|
||||
===============
|
||||
*/
|
||||
bool IN_ReadJoystick (void)
|
||||
{
|
||||
|
||||
memset (&ji, 0, sizeof(ji));
|
||||
ji.dwSize = sizeof(ji);
|
||||
ji.dwFlags = joy_flags;
|
||||
|
||||
if (joyGetPosEx (joy_id, &ji) == JOYERR_NOERROR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// read error occurred
|
||||
// turning off the joystick seems too harsh for 1 read error,\
|
||||
// but what should be done?
|
||||
// Msg ("IN_ReadJoystick: no response\n");
|
||||
// joy_avail = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_JoyMove
|
||||
===========
|
||||
*/
|
||||
void IN_JoyMove (usercmd_t *cmd)
|
||||
{
|
||||
float speed, aspeed;
|
||||
float fAxisValue;
|
||||
int i;
|
||||
|
||||
// complete initialization if first time in
|
||||
// this is needed as cvars are not available at initialization time
|
||||
if( joy_advancedinit != true )
|
||||
{
|
||||
Joy_AdvancedUpdate_f();
|
||||
joy_advancedinit = true;
|
||||
}
|
||||
|
||||
// verify joystick is available and that the user wants to use it
|
||||
if (!joy_avail || !in_joystick->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// collect the joystick data, if possible
|
||||
if (IN_ReadJoystick () != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (in_speed.state & 1) ^ (int)cl_run->value)
|
||||
speed = 2;
|
||||
else
|
||||
speed = 1;
|
||||
aspeed = speed * cls.frametime;
|
||||
|
||||
// loop through the axes
|
||||
for (i = 0; i < JOY_MAX_AXES; i++)
|
||||
{
|
||||
// get the floating point zero-centered, potentially-inverted data for the current axis
|
||||
fAxisValue = (float) *pdwRawValue[i];
|
||||
// move centerpoint to zero
|
||||
fAxisValue -= 32768.0;
|
||||
|
||||
// convert range from -32768..32767 to -1..1
|
||||
fAxisValue /= 32768.0;
|
||||
|
||||
switch (dwAxisMap[i])
|
||||
{
|
||||
case AxisForward:
|
||||
if ((joy_advanced->value == 0.0) && mlooking)
|
||||
{
|
||||
// user wants forward control to become look control
|
||||
if (fabs(fAxisValue) > joy_pitchthreshold->value)
|
||||
{
|
||||
// if mouse invert is on, invert the joystick pitch value
|
||||
// only absolute control support here (joy_advanced is false)
|
||||
if (m_pitch->value < 0.0)
|
||||
{
|
||||
cl.viewangles[PITCH] -= (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
cl.viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// user wants forward control to be forward control
|
||||
if (fabs(fAxisValue) > joy_forwardthreshold->value)
|
||||
{
|
||||
cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AxisSide:
|
||||
if (fabs(fAxisValue) > joy_sidethreshold->value)
|
||||
{
|
||||
cmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value;
|
||||
}
|
||||
break;
|
||||
|
||||
case AxisUp:
|
||||
if (fabs(fAxisValue) > joy_upthreshold->value)
|
||||
{
|
||||
cmd->upmove += (fAxisValue * joy_upsensitivity->value) * speed * cl_upspeed->value;
|
||||
}
|
||||
break;
|
||||
|
||||
case AxisTurn:
|
||||
if ((in_strafe.state & 1) || (lookstrafe->value && mlooking))
|
||||
{
|
||||
// user wants turn control to become side control
|
||||
if (fabs(fAxisValue) > joy_sidethreshold->value)
|
||||
{
|
||||
cmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// user wants turn control to be turn control
|
||||
if (fabs(fAxisValue) > joy_yawthreshold->value)
|
||||
{
|
||||
if(dwControlMap[i] == JOY_ABSOLUTE_AXIS)
|
||||
{
|
||||
cl.viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * aspeed * cl_yawspeed->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
cl.viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * speed * 180.0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AxisLook:
|
||||
if (mlooking)
|
||||
{
|
||||
if (fabs(fAxisValue) > joy_pitchthreshold->value)
|
||||
{
|
||||
// pitch movement detected and pitch movement desired by user
|
||||
if(dwControlMap[i] == JOY_ABSOLUTE_AXIS)
|
||||
{
|
||||
cl.viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
cl.viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * speed * 180.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -337,9 +337,6 @@ LONG WINAPI MainWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_KEYUP:
|
||||
Key_Event( MapKey( lParam ), false, host.sv_timer);
|
||||
break;
|
||||
case WM_CHAR:
|
||||
CL_CharEvent( wParam );
|
||||
break;
|
||||
default: // pass all unhandled messages to DefWindowProc
|
||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ const char *VID_MenuKey( int key )
|
|||
break;
|
||||
case K_KP_ENTER:
|
||||
case K_ENTER:
|
||||
if ( !Menu_SelectItem( m ) )
|
||||
if( !Menu_SelectItem( m ))
|
||||
ApplyChanges( NULL );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1061,8 +1061,8 @@ typedef struct render_exp_s
|
|||
|
||||
// video mode and refresh state management entry points
|
||||
void (*CinematicSetPalette)( const byte *palette); // NULL = game palette
|
||||
void (*BeginFrame)( float camera_separation );
|
||||
void (*EndFrame) (void);
|
||||
void (*BeginFrame)( void );
|
||||
void (*EndFrame)( void );
|
||||
} render_exp_t;
|
||||
|
||||
typedef struct render_imp_s
|
||||
|
|
|
@ -425,7 +425,7 @@ void Draw_Fill(float x, float y, float w, float h );
|
|||
void Draw_FadeScreen (void);
|
||||
void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data, bool dirty );
|
||||
|
||||
void R_BeginFrame( float camera_separation );
|
||||
void R_BeginFrame( void );
|
||||
void R_SwapBuffers( int );
|
||||
void R_SetPalette ( const unsigned char *palette);
|
||||
void R_GetPalette (void);
|
||||
|
@ -492,9 +492,6 @@ typedef struct
|
|||
int currenttextures[2];
|
||||
int currenttmu;
|
||||
|
||||
float camera_separation;
|
||||
bool stereo_enabled;
|
||||
|
||||
bool alpha_test;
|
||||
bool blend;
|
||||
bool texgen;
|
||||
|
@ -567,7 +564,7 @@ IMPLEMENTATION SPECIFIC FUNCTIONS
|
|||
====================================================================
|
||||
*/
|
||||
|
||||
void GLimp_BeginFrame( float camera_separation );
|
||||
void GLimp_BeginFrame( void );
|
||||
void GLimp_EndFrame( void );
|
||||
int GLimp_Init( void *hinstance, void *hWnd );
|
||||
void GLimp_Shutdown( void );
|
||||
|
|
|
@ -61,7 +61,6 @@ float v_blend[4]; // final blending color
|
|||
|
||||
void GL_Strings_f( void );
|
||||
byte *r_framebuffer; // pause frame buffer
|
||||
byte *r_finalframebuffer; // final pause frame buffer
|
||||
float r_pause_alpha;
|
||||
|
||||
//
|
||||
|
@ -604,9 +603,6 @@ void R_SetupGL (void)
|
|||
qglRotatef (-r_newrefdef.viewangles[1], 0, 0, 1);
|
||||
qglTranslatef (-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]);
|
||||
|
||||
// if ( gl_state.camera_separation != 0 && gl_state.stereo_enabled )
|
||||
// qglTranslatef ( gl_state.camera_separation, 0, 0 );
|
||||
|
||||
qglGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
|
||||
|
||||
//
|
||||
|
@ -869,45 +865,6 @@ void R_SetGL2D (void)
|
|||
|
||||
}
|
||||
|
||||
static void GL_DrawColoredStereoLinePair( float r, float g, float b, float y )
|
||||
{
|
||||
qglColor3f( r, g, b );
|
||||
qglVertex2f( 0, y );
|
||||
qglVertex2f( vid.width, y );
|
||||
qglColor3f( 0, 0, 0 );
|
||||
qglVertex2f( 0, y + 1 );
|
||||
qglVertex2f( vid.width, y + 1 );
|
||||
}
|
||||
|
||||
static void GL_DrawStereoPattern( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( !gl_state.stereo_enabled )
|
||||
return;
|
||||
|
||||
R_SetGL2D();
|
||||
|
||||
qglDrawBuffer( GL_BACK_LEFT );
|
||||
|
||||
for ( i = 0; i < 20; i++ )
|
||||
{
|
||||
qglBegin( GL_LINES );
|
||||
GL_DrawColoredStereoLinePair( 1, 0, 0, 0 );
|
||||
GL_DrawColoredStereoLinePair( 1, 0, 0, 2 );
|
||||
GL_DrawColoredStereoLinePair( 1, 0, 0, 4 );
|
||||
GL_DrawColoredStereoLinePair( 1, 0, 0, 6 );
|
||||
GL_DrawColoredStereoLinePair( 0, 1, 0, 8 );
|
||||
GL_DrawColoredStereoLinePair( 1, 1, 0, 10);
|
||||
GL_DrawColoredStereoLinePair( 1, 1, 0, 12);
|
||||
GL_DrawColoredStereoLinePair( 0, 1, 0, 14);
|
||||
qglEnd();
|
||||
|
||||
GLimp_EndFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
R_SetLightLevel
|
||||
|
@ -1299,9 +1256,6 @@ int R_Init( void *hinstance, void *hWnd )
|
|||
|
||||
GL_SetDefaultState();
|
||||
|
||||
// draw our stereo patterns
|
||||
GL_DrawStereoPattern();
|
||||
|
||||
R_InitTextures();
|
||||
Mod_Init ();
|
||||
R_InitParticleTexture ();
|
||||
|
@ -1309,7 +1263,6 @@ int R_Init( void *hinstance, void *hWnd )
|
|||
R_StudioInit();
|
||||
|
||||
if(!r_framebuffer) r_framebuffer = Z_Malloc(vid.width*vid.height*3);
|
||||
if(!r_finalframebuffer) r_finalframebuffer = Z_Malloc(vid.width*vid.height*3);
|
||||
|
||||
err = qglGetError();
|
||||
if ( err != GL_NO_ERROR ) MsgWarn("glGetError = 0x%x\n", err);
|
||||
|
@ -1330,7 +1283,6 @@ void R_Shutdown (void)
|
|||
ri.Cmd_RemoveCommand ("gl_strings");
|
||||
|
||||
if(r_framebuffer) Z_Free(r_framebuffer);
|
||||
if(r_finalframebuffer) Z_Free(r_finalframebuffer);
|
||||
|
||||
Mod_FreeAll ();
|
||||
R_StudioShutdown();
|
||||
|
@ -1354,11 +1306,8 @@ void R_Shutdown (void)
|
|||
R_BeginFrame
|
||||
@@@@@@@@@@@@@@@@@@@@@
|
||||
*/
|
||||
void R_BeginFrame( float camera_separation )
|
||||
void R_BeginFrame( void )
|
||||
{
|
||||
|
||||
gl_state.camera_separation = camera_separation;
|
||||
|
||||
if ( gl_log->modified )
|
||||
{
|
||||
GLimp_EnableLogging( gl_log->value );
|
||||
|
@ -1376,7 +1325,7 @@ void R_BeginFrame( float camera_separation )
|
|||
//put here update gamma
|
||||
}
|
||||
|
||||
GLimp_BeginFrame( camera_separation );
|
||||
GLimp_BeginFrame();
|
||||
|
||||
/*
|
||||
** go into 2D mode
|
||||
|
@ -1399,14 +1348,6 @@ void R_BeginFrame( float camera_separation )
|
|||
if ( gl_drawbuffer->modified )
|
||||
{
|
||||
gl_drawbuffer->modified = false;
|
||||
|
||||
if ( gl_state.camera_separation == 0 || !gl_state.stereo_enabled )
|
||||
{
|
||||
if ( strcasecmp( gl_drawbuffer->string, "GL_FRONT" ) == 0 )
|
||||
qglDrawBuffer( GL_FRONT );
|
||||
else
|
||||
qglDrawBuffer( GL_BACK );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -411,25 +411,8 @@ bool GLimp_InitGL (void)
|
|||
0, // reserved
|
||||
0, 0, 0 // layer masks ignored
|
||||
};
|
||||
int pixelformat;
|
||||
cvar_t *stereo;
|
||||
int pixelformat;
|
||||
|
||||
stereo = ri.Cvar_Get( "cl_stereo", "0", 0 );
|
||||
|
||||
/*
|
||||
** set PFD_STEREO if necessary
|
||||
*/
|
||||
if ( stereo->value != 0 )
|
||||
{
|
||||
Msg("...attempting to use stereo\n" );
|
||||
pfd.dwFlags |= PFD_STEREO;
|
||||
gl_state.stereo_enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_state.stereo_enabled = false;
|
||||
}
|
||||
|
||||
glw_state.minidriver = false;
|
||||
/*
|
||||
** Get a DC for the specified window
|
||||
|
@ -486,16 +469,6 @@ bool GLimp_InitGL (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** report if stereo is desired but unavailable
|
||||
*/
|
||||
if ( !( pfd.dwFlags & PFD_STEREO ) && ( stereo->value != 0 ) )
|
||||
{
|
||||
Msg("...failed to select stereo pixel format\n" );
|
||||
ri.Cvar_SetValue( "cl_stereo", 0 );
|
||||
gl_state.stereo_enabled = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** startup the OpenGL subsystem by creating a context and making
|
||||
** it current
|
||||
|
@ -548,7 +521,7 @@ fail:
|
|||
/*
|
||||
** GLimp_BeginFrame
|
||||
*/
|
||||
void GLimp_BeginFrame( float camera_separation )
|
||||
void GLimp_BeginFrame( void )
|
||||
{
|
||||
if ( gl_bitdepth->modified )
|
||||
{
|
||||
|
@ -559,19 +532,7 @@ void GLimp_BeginFrame( float camera_separation )
|
|||
}
|
||||
gl_bitdepth->modified = false;
|
||||
}
|
||||
|
||||
if ( camera_separation < 0 && gl_state.stereo_enabled )
|
||||
{
|
||||
qglDrawBuffer( GL_BACK_LEFT );
|
||||
}
|
||||
else if ( camera_separation > 0 && gl_state.stereo_enabled )
|
||||
{
|
||||
qglDrawBuffer( GL_BACK_RIGHT );
|
||||
}
|
||||
else
|
||||
{
|
||||
qglDrawBuffer( GL_BACK );
|
||||
}
|
||||
qglDrawBuffer( GL_BACK );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -482,11 +482,8 @@ void GL_UpdateSwapInterval( void )
|
|||
{
|
||||
gl_swapinterval->modified = false;
|
||||
|
||||
if ( !gl_state.stereo_enabled )
|
||||
{
|
||||
if ( qwglSwapIntervalEXT )
|
||||
qwglSwapIntervalEXT( gl_swapinterval->value );
|
||||
}
|
||||
if ( qwglSwapIntervalEXT )
|
||||
qwglSwapIntervalEXT( gl_swapinterval->value );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,8 +496,8 @@ void qglPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zF
|
|||
xmin = ymin * aspect;
|
||||
xmax = ymax * aspect;
|
||||
|
||||
xmin += -( 2 * gl_state.camera_separation ) / zNear;
|
||||
xmax += -( 2 * gl_state.camera_separation ) / zNear;
|
||||
xmin += -2.0f / zNear;
|
||||
xmax += -2.0f / zNear;
|
||||
|
||||
qglFrustum( xmin, xmax, ymin, ymax, zNear, zFar );
|
||||
}
|
||||
|
|
Reference in New Issue