improve handling of writing to world entity.

split left and right alt. binds+gamecode still use left-alt exclusively. alt-for-red-chars only works with left alt. right alt is alt-gr, so text input now works fine.
fixed support for keypad and text entry.
sdl2 clipboard support, if we're compiled with sdl2.
fixed issues with sdl sound. shouldn't be so terrible now.
soundinfo command now more verbose.
support for interpolated ramps.
removed input line length limitations, although some limitations still remain.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4315 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-04-13 08:15:18 +00:00
parent 19c2e051a6
commit 577419de37
26 changed files with 393 additions and 323 deletions

View File

@ -5258,6 +5258,7 @@ void CLQW_ParseServerMessage (void)
int i, j;
int destsplit;
float f;
qboolean csqcpacket = false;
received_framecount = host_framecount;
cl.last_servermessage = realtime;
@ -5316,7 +5317,7 @@ void CLQW_ParseServerMessage (void)
{
default:
CL_DumpPacket();
Host_EndGame ("CL_ParseServerMessage: Illegible server message (%i@%i)", cmd, msg_readcount-1);
Host_EndGame ("CLQW_ParseServerMessage: Illegible server message (%i@%i)%s", cmd, msg_readcount-1, (!cl.csqcdebug && csqcpacket)?"\n'sv_csqcdebug 1' might aid in debugging this.":"" );
return;
case svc_time:
@ -5747,6 +5748,7 @@ void CLQW_ParseServerMessage (void)
#ifdef PEXT_CSQC
case svcfte_csqcentities:
csqcpacket = true;
CSQC_ParseEntities();
break;
#endif
@ -5765,6 +5767,7 @@ void CLQW_ParseServerMessage (void)
break;
case svcfte_cgamepacket:
csqcpacket = true;
#ifdef HLCLIENT
if (CLHL_ParseGamePacket())
break;

View File

@ -358,17 +358,21 @@ void Con_QTerm_f(void)
void Key_ClearTyping (void)
{
key_lines[edit_line] = BZ_Realloc(key_lines[edit_line], 2);
key_lines[edit_line][0] = ']';
key_lines[edit_line][1] = 0; // clear any typing
key_linepos = 1;
}
void Con_History_Load(void)
{
char line[8192];
unsigned char *cr;
vfsfile_t *file = FS_OpenVFS("conhistory.txt", "rb", FS_ROOT);
for (edit_line=0 ; edit_line<=CON_EDIT_LINES_MASK ; edit_line++)
{
key_lines[edit_line] = BZ_Realloc(key_lines[edit_line], 2);
key_lines[edit_line][0] = ']';
key_lines[edit_line][1] = 0;
}
@ -377,12 +381,15 @@ void Con_History_Load(void)
if (file)
{
while (VFS_GETS(file, key_lines[edit_line]+1, sizeof(key_lines[edit_line])-1))
line[0] = ']';
while (VFS_GETS(file, line+1, sizeof(line)-1))
{
//strip a trailing \r if its from windows.
cr = key_lines[edit_line] + strlen(key_lines[edit_line]);
if (cr > key_lines[edit_line] && cr[-1] == '\r')
cr = line + strlen(line);
if (cr > line && cr[-1] == '\r')
cr[-1] = '\0';
key_lines[edit_line] = BZ_Realloc(key_lines[edit_line], strlen(line)+1);
strcpy(key_lines[edit_line], line);
edit_line = (edit_line + 1) & CON_EDIT_LINES_MASK;
}
VFS_CLOSE(file);
@ -593,8 +600,15 @@ void Con_Init (void)
void Con_Shutdown(void)
{
int i;
Con_History_Save();
for (i = 0; i <= CON_EDIT_LINES_MASK; i++)
{
BZ_Free(key_lines[i]);
}
while(con_main.next)
{
Con_Destroy(con_main.next);
@ -954,6 +968,8 @@ int Con_DrawInput (int left, int right, int y, qboolean selactive, int selsx, in
endmtext = COM_ParseFunString(CON_WHITEMASK, text, maskedtext, sizeof(maskedtext) - sizeof(maskedtext[0]), PFS_KEEPMARKUP | PFS_FORCEUTF8);
// endmtext = COM_ParseFunString(CON_WHITEMASK, text+key_linepos, cursor, ((char*)maskedtext)+sizeof(maskedtext) - (char*)(cursor+1), PFS_KEEPMARKUP | PFS_FORCEUTF8);
if ((char*)endmtext == (char*)(maskedtext-2) + sizeof(maskedtext))
endmtext[-1] = CON_WHITEMASK | '+' | CON_NONCLEARBG;
endmtext[1] = 0;
i = 0;
@ -974,13 +990,14 @@ int Con_DrawInput (int left, int right, int y, qboolean selactive, int selsx, in
int cmdstart;
cmdstart = text[1] == '/'?2:1;
fname = Cmd_CompleteCommand(text+cmdstart, true, true, con_commandmatch, NULL);
if (fname) //we can compleate it to:
if (fname && strlen(fname) < 256) //we can compleate it to:
{
for (p = min(strlen(fname), key_linepos-cmdstart); fname[p]>' '; p++)
maskedtext[p+cmdstart] = (unsigned int)fname[p] | (COLOR_GREEN<<CON_FGSHIFT);
if (p < key_linepos-cmdstart)
p = key_linepos-cmdstart;
maskedtext[p+cmdstart] = 0;
maskedtext[p+cmdstart+1] = 0;
}
}
}

View File

@ -195,8 +195,8 @@ static unsigned int tbl_sdltoquake[] =
K_SHIFT, //SDLK_LSHIFT = 304,
K_CTRL, //SDLK_RCTRL = 305,
K_CTRL, //SDLK_LCTRL = 306,
K_ALT, //SDLK_RALT = 307,
K_ALT, //SDLK_LALT = 308,
K_RALT, //SDLK_RALT = 307,
K_LALT, //SDLK_LALT = 308,
0, //SDLK_RMETA = 309,
0, //SDLK_LMETA = 310,
0, //SDLK_LSUPER = 311, /* Left "Windows" key */

View File

@ -61,7 +61,7 @@ static cvar_t in_simulatemultitouch = CVAR("in_simulatemultitouch", "0");
static cvar_t m_accel_noforce = CVAR("m_accel_noforce", "0");
static cvar_t m_threshold_noforce = CVAR("m_threshold_noforce", "0");
static cvar_t cl_keypad = CVAR("cl_keypad", "0");
static cvar_t cl_keypad = CVAR("cl_keypad", "1");
extern cvar_t cl_forcesplitclient;
extern float multicursor_x[8], multicursor_y[8];
@ -1990,7 +1990,7 @@ static qbyte scantokey[128] =
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
'\'', '`', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2
'b', 'n', 'm', ',', '.', '/', K_SHIFT, '*',
K_ALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5, // 3
K_LALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5, // 3
K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCRLCK, K_HOME,
K_UPARROW, K_PGUP, '-', K_LEFTARROW,'5', K_RIGHTARROW,'+', K_END, // 4
K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11,
@ -2036,6 +2036,8 @@ static int MapKey (int vkey)
int key;
key = (vkey>>16)&255;
if (((vkey>>16)&511) == (0x138))
return K_RALT;
if (cl_keypad.value)
{
switch (key)

View File

@ -27,10 +27,11 @@ key up events are sent even if in console mode
*/
void Editor_Key(int key, int unicode);
void Key_ConsoleInsert(char *instext);
void Key_ClearTyping (void);
#define KEY_MODIFIERSTATES 8
#define MAXCMDLINE 256
unsigned char key_lines[CON_EDIT_LINES_MASK+1][MAXCMDLINE];
unsigned char *key_lines[CON_EDIT_LINES_MASK+1];
int key_linepos;
int shift_down=false;
int key_lastpress;
@ -92,7 +93,9 @@ keyname_t keynames[] =
{"LEFTARROW", K_LEFTARROW},
{"RIGHTARROW", K_RIGHTARROW},
{"ALT", K_ALT},
{"LALT", K_LALT},
{"RALT", K_RALT},
{"ALT", K_LALT}, //depricated name
{"CTRL", K_CTRL},
{"SHIFT", K_SHIFT},
@ -262,11 +265,9 @@ int PaddedPrint (char *s, int x)
return x;
}
int con_commandmatch;
void CompleteCommand (qboolean force)
{
int i;
char *cmd, *s;
char *desc;
@ -283,24 +284,19 @@ void CompleteCommand (qboolean force)
cmd = Cmd_CompleteCommand (s, true, true, con_commandmatch, &desc);
if (cmd)
{
key_lines[edit_line][1] = '/';
Q_strcpy (key_lines[edit_line]+2, cmd);
key_linepos = Q_strlen(cmd)+2;
//complete to that (maybe partial) cmd.
Key_ClearTyping();
Key_ConsoleInsert("/");
Key_ConsoleInsert(cmd);
s = key_lines[edit_line]+2;
s = key_lines[edit_line]+1; //readjust to cope with the insertion of a /
if (*s == '\\' || *s == '/')
s++;
// if (strlen(cmd)>strlen(s))
//if its the only match, add a space ready for arguments.
cmd = Cmd_CompleteCommand (s, true, true, 0, NULL);
if (cmd && !strcmp(s, cmd))
{
cmd = Cmd_CompleteCommand (s, true, true, 0, NULL);
if (cmd && !strcmp(s, cmd)) //also a compleate var
{
key_lines[edit_line][key_linepos] = ' ';
key_linepos++;
}
Key_ConsoleInsert(" ");
}
key_lines[edit_line][key_linepos] = 0;
if (!con_commandmatch)
con_commandmatch = 1;
@ -309,12 +305,12 @@ void CompleteCommand (qboolean force)
return;
}
}
cmd = Cmd_CompleteCommand (s, false, true, 0, &desc);
/* cmd = Cmd_CompleteCommand (s, false, true, 0, &desc);
if (cmd)
{
i = key_lines[edit_line][1] == '/'?2:1;
int i = key_lines[edit_line][1] == '/'?2:1;
if (i != 2 || strcmp(key_lines[edit_line]+i, cmd))
{ //if changed, compleate it
{ //if changed, complete it
key_lines[edit_line][1] = '/';
Q_strcpy (key_lines[edit_line]+2, cmd);
key_linepos = Q_strlen(cmd)+2;
@ -334,7 +330,7 @@ void CompleteCommand (qboolean force)
return; //don't alter con_commandmatch if we compleated a tiny bit more
}
}
*/
con_commandmatch++;
if (Cmd_CompleteCommand(s, true, true, con_commandmatch, &desc))
{
@ -352,7 +348,7 @@ void CompleteCommand (qboolean force)
void Con_ExecuteLine(console_t *con, char *line)
{
qboolean waschat = false;
char deutf8[1024];
char deutf8[8192];
extern cvar_t com_parseutf8;
if (com_parseutf8.ival <= 0)
{
@ -384,6 +380,8 @@ void Con_ExecuteLine(console_t *con, char *line)
else
waschat = false;
}
while (*line == ' ')
line++;
if (waschat)
Cbuf_AddText (line, RESTRICT_LOCAL);
else
@ -465,24 +463,27 @@ qboolean Key_GetConsoleSelectionBox(int *sx, int *sy, int *ex, int *ey)
void Key_ConsoleInsert(char *instext)
{
int i;
int len;
int len, olen;
char *old;
if (!*instext)
return;
old = key_lines[edit_line];
len = strlen(instext);
if (len + strlen(key_lines[edit_line]) > MAXCMDLINE - 1)
len = MAXCMDLINE - 1 - strlen(key_lines[edit_line]);
if (len > 0)
{ // insert the string
memmove (key_lines[edit_line] + key_linepos + len,
key_lines[edit_line] + key_linepos, strlen(key_lines[edit_line]) - key_linepos + 1);
memcpy (key_lines[edit_line] + key_linepos, instext, len);
for (i = 0; i < len; i++)
{
if (key_lines[edit_line][key_linepos+i] == '\r')
key_lines[edit_line][key_linepos+i] = ' ';
else if (key_lines[edit_line][key_linepos+i] == '\n')
key_lines[edit_line][key_linepos+i] = ';';
}
key_linepos += len;
olen = strlen(old);
key_lines[edit_line] = BZ_Malloc(olen + len + 1);
memcpy(key_lines[edit_line], old, key_linepos);
memcpy(key_lines[edit_line]+key_linepos, instext, len);
memcpy(key_lines[edit_line]+key_linepos+len, old+key_linepos, olen - key_linepos+1);
Z_Free(old);
for (i = key_linepos; i < key_linepos+len; i++)
{
if (key_lines[edit_line][i] == '\r')
key_lines[edit_line][i] = ' ';
else if (key_lines[edit_line][i] == '\n')
key_lines[edit_line][i] = ';';
}
key_linepos += len;
}
void Key_DefaultLinkClicked(char *text, char *info)
@ -677,7 +678,10 @@ void Key_DefaultLinkClicked(char *text, char *info)
}
if (!*info && *text == '/')
{
Q_strncpyz(key_lines[edit_line]+1, text, sizeof(key_lines[edit_line])-1);
Z_Free(key_lines[edit_line]);
key_lines[edit_line] = BZ_Malloc(strlen(text) + 2);
key_lines[edit_line][0] = ']';
strcpy(key_lines[edit_line]+1, text);
key_linepos = strlen(key_lines[edit_line]);
return;
}
@ -884,6 +888,10 @@ void Key_Console (unsigned int unicode, int key)
char *clipText;
char utf8[8];
//weirdness for the keypad.
if ((unicode >= '0' && unicode <= '9') || unicode == '.')
key = 0;
if (con_current->redirect)
{
if (key == K_TAB)
@ -934,11 +942,13 @@ void Key_Console (unsigned int unicode, int key)
return;
}
if (key == K_ENTER)
if (key == K_ENTER || key == K_KP_ENTER)
{ // backslash text are commands, else chat
int oldl = edit_line;
edit_line = (edit_line + 1) & (CON_EDIT_LINES_MASK);
history_line = edit_line;
Z_Free(key_lines[edit_line]);
key_lines[edit_line] = BZ_Malloc(2);
key_lines[edit_line][0] = ']';
key_lines[edit_line][1] = '\0';
key_linepos = 1;
@ -977,12 +987,12 @@ void Key_Console (unsigned int unicode, int key)
if (key != K_CTRL && key != K_SHIFT && con_commandmatch)
con_commandmatch=1;
if (key == K_LEFTARROW)
if (key == K_LEFTARROW || key == K_KP_LEFTARROW)
{
key_linepos = utf_left(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
return;
}
if (key == K_RIGHTARROW)
if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW)
{
if (key_lines[edit_line][key_linepos])
{
@ -993,7 +1003,7 @@ void Key_Console (unsigned int unicode, int key)
key = ' ';
}
if (key == K_DEL)
if (key == K_DEL || key == K_KP_DEL)
{
if (key_lines[edit_line][key_linepos])
{
@ -1018,7 +1028,7 @@ void Key_Console (unsigned int unicode, int key)
return;
}
if (key == K_UPARROW)
if (key == K_UPARROW || key == K_KP_UPARROW)
{
do
{
@ -1027,6 +1037,7 @@ void Key_Console (unsigned int unicode, int key)
&& !key_lines[history_line][1]);
if (history_line == edit_line)
history_line = (edit_line+1)&CON_EDIT_LINES_MASK;
key_lines[edit_line] = BZ_Realloc(key_lines[edit_line], strlen(key_lines[history_line])+1);
Q_strcpy(key_lines[edit_line], key_lines[history_line]);
key_linepos = Q_strlen(key_lines[edit_line]);
@ -1036,7 +1047,7 @@ void Key_Console (unsigned int unicode, int key)
return;
}
if (key == K_DOWNARROW)
if (key == K_DOWNARROW || key == K_KP_DOWNARROW)
{
if (history_line == edit_line)
{
@ -1060,13 +1071,14 @@ void Key_Console (unsigned int unicode, int key)
}
else
{
key_lines[edit_line] = BZ_Realloc(key_lines[edit_line], strlen(key_lines[history_line])+1);
Q_strcpy(key_lines[edit_line], key_lines[history_line]);
key_linepos = Q_strlen(key_lines[edit_line]);
}
return;
}
if (key == K_PGUP || key==K_MWHEELUP)
if (key == K_PGUP || key == K_KP_PGUP || key==K_MWHEELUP)
{
int i = 2;
if (keydown[K_CTRL])
@ -1083,7 +1095,7 @@ void Key_Console (unsigned int unicode, int key)
}
return;
}
if (key == K_PGDN || key==K_MWHEELDOWN)
if (key == K_PGDN || key == K_KP_PGDN || key==K_MWHEELDOWN)
{
int i = 2;
if (keydown[K_CTRL])
@ -1101,7 +1113,7 @@ void Key_Console (unsigned int unicode, int key)
return;
}
if (key == K_HOME)
if (key == K_HOME || key == K_KP_HOME)
{
if (keydown[K_CTRL])
con_current->display = con_current->oldest;
@ -1110,7 +1122,7 @@ void Key_Console (unsigned int unicode, int key)
return;
}
if (key == K_END)
if (key == K_END || key == K_KP_END)
{
if (keydown[K_CTRL])
con_current->display = con_current->current;
@ -1138,11 +1150,37 @@ void Key_Console (unsigned int unicode, int key)
}
if (unicode < ' ')
return;
if (com_parseutf8.ival >= 0) //don't do this for iso8859-1. the major user of that is hexen2 which doesn't have these chars.
{
if (keydown[K_CTRL])
//if the user is entering control codes, then the ctrl+foo mechanism is probably unsupported by the unicode input stuff, so give best-effort replacements.
switch(unicode)
{
case 27/*'['*/: unicode = 0xe010; break;
case 29/*']'*/: unicode = 0xe011; break;
case 7/*'g'*/: unicode = 0xe086; break;
case 18/*'r'*/: unicode = 0xe087; break;
case 25/*'y'*/: unicode = 0xe088; break;
case 2/*'b'*/: unicode = 0xe089; break;
case 19/*'s'*/: unicode = 0xe080; break;
case 4/*'d'*/: unicode = 0xe081; break;
case 6/*'f'*/: unicode = 0xe082; break;
case 1/*'a'*/: unicode = 0xe083; break;
case 21/*'u'*/: unicode = 0xe01d; break;
case 9/*'i'*/: unicode = 0xe01e; break;
case 15/*'o'*/: unicode = 0xe01f; break;
case 10/*'j'*/: unicode = 0xe01c; break;
case 16/*'p'*/: unicode = 0xe09c; break;
case 13/*'m'*/: unicode = 0xe08b; break;
case 11/*'k'*/: unicode = 0xe08d; break;
case 14/*'n'*/: unicode = '\r'; break;
default:
// if (unicode)
// Con_Printf("escape code %i\n", unicode);
return;
}
}
else if (com_parseutf8.ival >= 0) //don't do this for iso8859-1. the major user of that is hexen2 which doesn't have these chars.
{
if (keydown[K_CTRL] && !keydown[K_RALT])
{
if (unicode >= '0' && unicode <= '9')
unicode = unicode - '0' + 0xe012; // yellow number
@ -1169,7 +1207,7 @@ void Key_Console (unsigned int unicode, int key)
}
}
if (keydown[K_ALT] && unicode > 32 && unicode < 128)
if (keydown[K_LALT] && unicode > 32 && unicode < 128)
unicode |= 0xe080; // red char
}
@ -1591,8 +1629,8 @@ void Key_Init (void)
for (i=0 ; i<=CON_EDIT_LINES_MASK ; i++)
{
key_lines[i] = Z_Malloc(2);
key_lines[i][0] = ']';
key_lines[i][1] = 0;
}
key_linepos = 1;
@ -1607,17 +1645,27 @@ void Key_Init (void)
consolekeys[K_RIGHTARROW] = true;
consolekeys[K_UPARROW] = true;
consolekeys[K_DOWNARROW] = true;
consolekeys[K_KP_LEFTARROW] = true;
consolekeys[K_KP_RIGHTARROW] = true;
consolekeys[K_KP_UPARROW] = true;
consolekeys[K_KP_DOWNARROW] = true;
consolekeys[K_BACKSPACE] = true;
consolekeys[K_DEL] = true;
consolekeys[K_KP_DEL] = true;
consolekeys[K_HOME] = true;
consolekeys[K_KP_HOME] = true;
consolekeys[K_END] = true;
consolekeys[K_KP_END] = true;
consolekeys[K_PGUP] = true;
consolekeys[K_KP_PGUP] = true;
consolekeys[K_PGDN] = true;
consolekeys[K_KP_PGDN] = true;
consolekeys[K_SHIFT] = true;
consolekeys[K_MWHEELUP] = true;
consolekeys[K_MWHEELDOWN] = true;
consolekeys[K_CTRL] = true;
consolekeys[K_ALT] = true;
consolekeys[K_LALT] = true;
consolekeys[K_RALT] = true;
consolekeys['`'] = false;
consolekeys['~'] = false;
@ -1719,23 +1767,24 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
char p[16];
char cmd[1024];
int keystate, oldstate;
int conkey = consolekeys[key] || (unicode && (key != '`' || key_linepos>1)); //if the input line is empty, allow ` to toggle the console, otherwise enter it as actual text.
// Con_Printf ("%i : %i : %i\n", key, unicode, down); //@@@
oldstate = KeyModifier(keydown[K_SHIFT], keydown[K_ALT], keydown[K_CTRL]);
oldstate = KeyModifier(keydown[K_SHIFT], keydown[K_LALT]|keydown[K_RALT], keydown[K_CTRL]);
keydown[key] = down;
if (key == K_SHIFT || key == K_ALT || key == K_CTRL)
if (key == K_SHIFT || key == K_LALT || key == K_RALT || key == K_CTRL)
{
int k;
keystate = KeyModifier(keydown[K_SHIFT], keydown[K_ALT], keydown[K_CTRL]);
keystate = KeyModifier(keydown[K_SHIFT], keydown[K_LALT]|keydown[K_RALT], keydown[K_CTRL]);
for (k = 0; k < K_MAX; k++)
{ //go through the old state removing all depressed keys. they are all up now.
if (k == K_SHIFT || k == K_ALT || k == K_CTRL)
if (k == K_SHIFT || k == K_LALT || key == K_RALT || k == K_CTRL)
continue;
if (deltaused[k][oldstate])
@ -1831,7 +1880,7 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
}
//yes, csqc is allowed to steal the escape key.
if (key != '`' && key != '~')
if (key != '`' && (!down || key != K_ESCAPE || (key_dest == key_game && !shift_down)))
if (key_dest == key_game && !Media_PlayingFullScreen())
{
#ifdef CSQC_DAT
@ -1890,7 +1939,10 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
break;
}
case key_console:
M_ToggleMenu_f ();
if (cls.state)
key_dest = key_game;
else
M_ToggleMenu_f ();
break;
default:
Sys_Error ("Bad key_dest");
@ -1956,7 +2008,7 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
//
// during demo playback, most keys bring up the main menu
//
if (cls.demoplayback && cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV && down && consolekeys[key] && key != K_TAB && key_dest == key_game)
if (cls.demoplayback && cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV && down && conkey && key != K_TAB && key_dest == key_game)
{
M_ToggleMenu_f ();
return;
@ -1975,8 +2027,8 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
#endif
if (key && ((key_dest == key_menu && menubound[key])
|| (key_dest == key_console && !consolekeys[key])
|| (key_dest == key_game && ( cls.state == ca_active || !consolekeys[key] ) ) ))
|| (key_dest == key_console && !conkey)
|| (key_dest == key_game && ( cls.state == ca_active || (!conkey) ) ) ))
{
/*don't auto-repeat binds as it breaks too many scripts*/
if (key_repeats[key] > 1)
@ -1989,6 +2041,9 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
else
*p = 0;
if (key == K_RALT) //simulate a singular alt for binds. really though, this code should translate to csqc/menu keycodes and back to resolve the weirdness instead.
key = K_ALT;
kb = keybindings[key][keystate];
if (kb)
{

View File

@ -45,7 +45,7 @@ K_DOWNARROW,
K_LEFTARROW,
K_RIGHTARROW,
K_ALT,
K_LALT,
K_CTRL,
K_SHIFT,
K_INS,
@ -158,6 +158,7 @@ K_APP = 241,
K_SEARCH = 242,
K_VOLUP = 243,
K_VOLDOWN = 244,
K_RALT = 245,
K_MAX = 256
};
@ -166,8 +167,7 @@ K_MAX = 256
#define K_RSHIFT K_SHIFT
#define K_RCTRL K_CTRL
#define K_LCTRL K_CTRL
#define K_RALT K_CTRL
#define K_LALT K_CTRL
#define K_ALT K_LALT
typedef enum {key_game, key_console, key_message, key_menu, key_editor} keydest_t;

View File

@ -1908,7 +1908,8 @@ void Media_Gecko_KeyPress (struct cin_s *cin, int code, int unicode, int event)
case K_CTRL:
code = OSGKKey_Control;
break;
case K_ALT:
case K_LALT:
case K_RALT:
code = OSGKKey_Alt;
break;
case K_CAPSLOCK:

View File

@ -198,7 +198,11 @@ void M_ToggleMenu_f (void)
#ifdef CSQC_DAT
if (CSQC_ConsoleCommand("togglemenu"))
{
if (key_dest == key_console)
key_dest = key_game;
return;
}
#endif
#ifdef MENU_DAT
if (MP_Toggle())

View File

@ -264,7 +264,7 @@ typedef struct part_type_s {
vec3_t stain_rgb;
float stain_radius;
enum {RAMP_NONE, RAMP_DELTA, RAMP_ABSOLUTE} rampmode;
enum {RAMP_NONE, RAMP_DELTA, RAMP_NEAREST, RAMP_LERP} rampmode;
int rampindexes;
ramp_t *ramp;
@ -1310,7 +1310,14 @@ static void P_ParticleEffect_f(void)
if (!strcmp(value, "none"))
ptype->rampmode = RAMP_NONE;
else if (!strcmp(value, "absolute"))
ptype->rampmode = RAMP_ABSOLUTE;
{
Con_DPrintf("'rampmode absolute' is deprechiated, use 'rampmode nearest'\n");
ptype->rampmode = RAMP_NEAREST;
}
else if (!strcmp(value, "nearest"))
ptype->rampmode = RAMP_NEAREST;
else if (!strcmp(value, "lerp")) //don't use the name 'linear'. ramps are there to avoid linear...
ptype->rampmode = RAMP_LERP;
else //if (!strcmp(value, "delta"))
ptype->rampmode = RAMP_DELTA;
}
@ -5104,7 +5111,7 @@ static void PScript_DrawParticleTypes (void)
switch (type->rampmode)
{
case RAMP_ABSOLUTE:
case RAMP_NEAREST:
rampind = (int)(type->rampindexes * (type->die - (d->die - particletime)) / type->die);
if (rampind >= type->rampindexes)
rampind = type->rampindexes - 1;
@ -5112,6 +5119,17 @@ static void PScript_DrawParticleTypes (void)
VectorCopy(ramp->rgb, d->rgba);
d->rgba[3] = ramp->alpha;
break;
case RAMP_LERP:
{
float frac = (type->rampindexes * (type->die - (d->die - particletime)) / type->die);
int s1, s2;
s1 = min(type->rampindexes-1, frac);
s2 = min(type->rampindexes-1, s1+1);
frac -= s1;
VectorInterpolate(type->ramp[s1].rgb, frac, type->ramp[s2].rgb, d->rgba);
FloatInterpolate(type->ramp[s1].alpha, frac, type->ramp[s2].alpha, d->rgba[3]);
}
break;
case RAMP_DELTA: //particle ramps
ramp = type->ramp + (int)(type->rampindexes * (type->die - (d->die - particletime)) / type->die);
VectorMA(d->rgba, pframetime, ramp->rgb, d->rgba);
@ -5373,7 +5391,7 @@ static void PScript_DrawParticleTypes (void)
switch (type->rampmode)
{
case RAMP_ABSOLUTE:
case RAMP_NEAREST:
rampind = (int)(type->rampindexes * (type->die - (p->die - particletime)) / type->die);
if (rampind >= type->rampindexes)
rampind = type->rampindexes - 1;
@ -5382,6 +5400,18 @@ static void PScript_DrawParticleTypes (void)
p->rgba[3] = ramp->alpha;
p->scale = ramp->scale;
break;
case RAMP_LERP:
{
float frac = (type->rampindexes * (type->die - (p->die - particletime)) / type->die);
int s1, s2;
s1 = min(type->rampindexes-1, frac);
s2 = min(type->rampindexes-1, s1+1);
frac -= s1;
VectorInterpolate(type->ramp[s1].rgb, frac, type->ramp[s2].rgb, p->rgba);
FloatInterpolate(type->ramp[s1].alpha, frac, type->ramp[s2].alpha, p->rgba[3]);
FloatInterpolate(type->ramp[s1].scale, frac, type->ramp[s2].scale, p->scale);
}
break;
case RAMP_DELTA: //particle ramps
rampind = (int)(type->rampindexes * (type->die - (p->die - particletime)) / type->die);
if (rampind >= type->rampindexes)

View File

@ -21,7 +21,8 @@ int MP_TranslateFTEtoDPCodes(int code)
case K_DOWNARROW: return 129;
case K_LEFTARROW: return 130;
case K_RIGHTARROW: return 131;
case K_ALT: return 132;
case K_LALT: return 132;
case K_RALT: return 132;
case K_CTRL: return 133;
case K_SHIFT: return 134;
case K_F1: return 135;
@ -123,7 +124,7 @@ int MP_TranslateDPtoFTECodes(int code)
case 129: return K_DOWNARROW;
case 130: return K_LEFTARROW;
case 131: return K_RIGHTARROW;
case 132: return K_ALT;
case 132: return K_LALT;
case 133: return K_CTRL;
case 134: return K_SHIFT;
case 135: return K_F1;

View File

@ -105,6 +105,7 @@ extern sfx_t *cl_sfx_r_exp3;
globalfunction(parse_stuffcmd, "CSQC_Parse_StuffCmd"); \
globalfunction(parse_centerprint, "CSQC_Parse_CenterPrint"); \
globalfunction(parse_print, "CSQC_Parse_Print"); \
globalfunction(parse_event, "CSQC_Parse_Event"); \
globalfunction(input_event, "CSQC_InputEvent"); \
globalfunction(input_frame, "CSQC_Input_Frame");/*EXT_CSQC_1*/ \
globalfunction(console_command, "CSQC_ConsoleCommand"); \
@ -5668,23 +5669,35 @@ qboolean CSQC_ParseTempEntity(unsigned char firstbyte)
qboolean CSQC_ParseGamePacket(void)
{
int len = (unsigned short)MSG_ReadShort();
int start = msg_readcount;
int parsefnc = csqcg.parse_event?csqcg.parse_event:csqcg.parse_tempentity;
void *pr_globals;
if (!csqcprogs || !csqcg.parse_tempentity)
if (cl.csqcdebug)
{
MSG_ReadSkip(len);
return false;
int len = (unsigned short)MSG_ReadShort();
int start = msg_readcount;
if (!csqcprogs || !parsefnc)
{
MSG_ReadSkip(len);
return false;
}
PR_ExecuteProgram (csqcprogs, parsefnc);
if (msg_readcount != start + len)
{
Con_Printf("Gamecode misread a gamecode packet (%i bytes too much)\n", msg_readcount - (start+len));
msg_readcount = start + len;
}
}
pr_globals = PR_globals(csqcprogs, PR_CURRENT);
PR_ExecuteProgram (csqcprogs, csqcg.parse_tempentity);
if (msg_readcount != start + len)
else
{
Con_Printf("Gamecode misread a gamecode packet (%i bytes too much)\n", msg_readcount - (start+len));
msg_readcount = start + len;
if (!csqcprogs || !parsefnc)
{
Host_EndGame("CSQC not running or is unable to parse events.\n");
return false;
}
PR_ExecuteProgram (csqcprogs, parsefnc);
}
return true;
}

View File

@ -628,8 +628,7 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, int cardnum)
pDirectSoundEnumerate(&DSEnumCallback, sc);
if (!snd_usemultipledevices.ival) //if only one device, ALWAYS use the default.
dsndguid=NULL;
if (!dsndguid && sc->audio_fd != 0) //no more...
else if (!dsndguid) //no more...
return SND_NOMORE;
sc->handle = Z_Malloc(sizeof(dshandle_t));

View File

@ -168,6 +168,8 @@ qboolean S_HaveOutput(void)
void S_SoundInfo_f(void)
{
int i, j;
int active, known;
soundcardinfo_t *sc;
if (!sound_started)
{
@ -182,12 +184,33 @@ void S_SoundInfo_f(void)
}
for (sc = sndcardinfo; sc; sc = sc->next)
{
Con_Printf("%5d stereo\n", sc->sn.numchannels - 1);
Con_Printf("%5d samples\n", sc->sn.samples);
Con_Printf("%5d samplepos\n", sc->sn.samplepos);
Con_Printf("%5d samplebits\n", sc->sn.samplebits);
Con_Printf("%5d speed\n", sc->sn.speed);
Con_Printf("%5d total_channels\n", sc->total_chans);
Con_Printf("Audio Device: %s\n", sc->name);
Con_Printf(" %d channels, %gkhz, %d bit audio%s\n", sc->sn.numchannels, sc->sn.speed/1000.0, sc->sn.samplebits, sc->selfpainting?", threaded":"");
Con_Printf(" %d samples in buffer\n", sc->sn.samples);
for (i = 0, active = 0, known = 0; i < sc->total_chans; i++)
{
if (sc->channel[i].sfx)
{
known++;
for (j = 0; j < MAXSOUNDCHANNELS; j++)
{
if (sc->channel[i].vol[j])
{
active++;
break;
}
}
if (j<MAXSOUNDCHANNELS)
Con_Printf(" %s (%i %i, %g %g %g, active)\n", sc->channel[i].sfx->name, sc->channel[i].entnum, sc->channel[i].entchannel, sc->channel[i].origin[0], sc->channel[i].origin[1], sc->channel[i].origin[2]);
else
Con_DPrintf(" %s (%i %i, %g %g %g, inactive)\n", sc->channel[i].sfx->name, sc->channel[i].entnum, sc->channel[i].entchannel, sc->channel[i].origin[0], sc->channel[i].origin[1], sc->channel[i].origin[2]);
}
}
Con_Printf(" %d/%d/%d/%d active/known/highest/max\n", active, known, sc->total_chans, MAX_CHANNELS);
for (i = 0; i < sc->sn.numchannels; i++)
{
Con_Printf(" chan %i: fwd:%-4g rt:%-4g up:%-4g dist:%-4g\n", i, sc->speakerdir[i][0], sc->speakerdir[i][1], sc->speakerdir[i][2], sc->dist[i]);
}
}
}

View File

@ -2,7 +2,8 @@
#include "winquake.h"
#include <SDL.h>
#pragma comment(lib, MSVCLIBSPATH "sdl.lib")
#define SELFPAINT
//SDL calls a callback each time it needs to repaint the 'hardware' buffers
//This results in extra latency.
@ -16,10 +17,12 @@
static void SSDL_Shutdown(soundcardinfo_t *sc)
{
Con_Printf("Shutdown SDL sound\n");
Con_DPrintf("Shutdown SDL sound\n");
SDL_CloseAudio();
#ifndef SELFPAINT
if (sc->sn.buffer)
free(sc->sn.buffer);
#endif
sc->sn.buffer = NULL;
}
static unsigned int SSDL_GetDMAPos(soundcardinfo_t *sc)
@ -35,6 +38,13 @@ static void VARGS SSDL_Paint(void *userdata, qbyte *stream, int len)
soundcardinfo_t *sc = userdata;
int buffersize = sc->sn.samples*(sc->sn.samplebits/8);
#ifdef SELFPAINT
sc->sn.buffer = stream;
sc->sn.samples = len / (sc->sn.samplebits/8);
sc->samplequeue = sc->sn.samples;
S_MixerThread(sc);
sc->snd_sent += len;
#else
if (len > buffersize)
{
len = buffersize; //whoa nellie!
@ -51,6 +61,7 @@ static void VARGS SSDL_Paint(void *userdata, qbyte *stream, int len)
} //and finish from the start
memcpy(stream, (char*)sc->sn.buffer + (sc->snd_sent%buffersize), len);
sc->snd_sent += len;
#endif
}
static void *SSDL_LockBuffer(soundcardinfo_t *sc, unsigned int *sampidx)
@ -96,7 +107,7 @@ static int SDL_InitCard(soundcardinfo_t *sc, int cardnum)
desired.freq = sc->sn.speed;
desired.channels = sc->sn.numchannels; //fixme!
desired.samples = 0x0100;
desired.samples = 0x0200; //'Good values seem to range between 512 and 8192 inclusive, depending on the application and CPU speed.'
desired.format = AUDIO_S16SYS;
desired.callback = (void*)SSDL_Paint;
desired.userdata = sc;
@ -121,13 +132,19 @@ static int SDL_InitCard(soundcardinfo_t *sc, int cardnum)
sc->sn.samplebits = obtained.format&0xff;
sc->sn.samples = 32768;//*sc->sn.numchannels; //doesn't really matter, so long as it's higher than obtained.samples
#ifdef SELFPAINT
sc->selfpainting = true;
#endif
Con_DPrintf("channels: %i\n", sc->sn.numchannels);
Con_DPrintf("Speed: %i\n", sc->sn.speed);
Con_DPrintf("Samplebits: %i\n", sc->sn.samplebits);
Con_DPrintf("SDLSamples: %i (low for latency)\n", obtained.samples);
Con_DPrintf("FakeSamples: %i\n", sc->sn.samples);
#ifndef SELFPAINT
sc->sn.buffer = malloc(sc->sn.samples*sc->sn.samplebits/8);
#endif
Con_DPrintf("Got sound %i-%i\n", obtained.freq, obtained.format);
sc->Lock = SSDL_LockBuffer;

View File

@ -354,6 +354,7 @@ int WAV_InitCard (soundcardinfo_t *sc, int cardnum)
sc->sn.samples = wh->gSndBufSize/(sc->sn.samplebits/8);
sc->sn.samplepos = 0;
sc->sn.buffer = (unsigned char *) wh->lpData;
Q_strncpyz(sc->name, "wav out", sizeof(sc->name));
sc->Lock = WAV_Lock;

View File

@ -611,7 +611,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
argv = malloc(argc * sizeof(char*));
for (i = 0; i < argc; i++)
{
for(l = 0, c = 0; argvw[l]; l++)
for(l = 0, c = 0; argvw[i][l]; l++)
c += utf8_encode(utf8arg+c, argvw[i][l], sizeof(utf8arg) - c-1);
utf8arg[c] = 0;
argv[i] = strdup(utf8arg);
@ -627,17 +627,37 @@ qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refres
#if SDL_MAJOR_VERSION >= 2 //probably could inclued 1.3
#include <SDL_clipboard.h>
char *Sys_GetClipboard(void)
{
return NULL;
return SDL_GetClipboardText();
}
void Sys_CloseClipboard(char *bf)
{
SDL_Free(bf);
}
void Sys_SaveClipboard(char *text)
{
SDL_SetClipboardText(text);
}
#else
static char *clipboard_buffer;
char *Sys_GetClipboard(void)
{
return clipboard_buffer;
}
void Sys_CloseClipboard(char *bf)
{
}
void Sys_SaveClipboard(char *text)
{
free(clipboard_buffer);
clipboard_buffer = strdup(text);
}
#endif
#ifdef MULTITHREAD
/* Thread creation calls */

View File

@ -502,7 +502,8 @@ void Editor_Key(int key, int unicode)
{
case K_SHIFT:
break;
case K_ALT:
case K_LALT:
case K_RALT:
break;
case K_CTRL:
break;
@ -979,7 +980,7 @@ static void Draw_Line(int vy, fileblock_t *b, int cursorx)
{
if (d == c)
{
int e = Font_DrawChar(nx, y, (int)11 | (CON_WHITEMASK|CON_BLINKTEXT));
int e = Font_DrawChar(nx, y, (int)0xe00b | (CON_WHITEMASK|CON_BLINKTEXT));
if (e >= vid.pixelwidth)
viewportx += e - vid.pixelwidth;
if (nx < 0)
@ -1000,7 +1001,7 @@ static void Draw_Line(int vy, fileblock_t *b, int cursorx)
if (d == c)
{
int e = Font_DrawChar(nx, y, (int)11 | (CON_WHITEMASK|CON_BLINKTEXT));
int e = Font_DrawChar(nx, y, (int)0xe00b | (CON_WHITEMASK|CON_BLINKTEXT));
if (e >= vid.pixelwidth)
viewportx += e - vid.pixelwidth;
if (nx < 0)
@ -1018,7 +1019,7 @@ static void Draw_Line(int vy, fileblock_t *b, int cursorx)
/*we didn't do the cursor! stick it at the end*/
if (c && c >= d)
{
int e = Font_DrawChar(nx, y, (int)11 | (CON_WHITEMASK|CON_BLINKTEXT));
int e = Font_DrawChar(nx, y, (int)0xe00b | (CON_WHITEMASK|CON_BLINKTEXT));
if (e >= vid.pixelwidth)
viewportx += e - vid.pixelwidth;
if (nx < 0)

View File

@ -1971,7 +1971,7 @@ void Cmd_ExecuteString (char *text, int level)
#ifndef SERVERONLY //an emergency escape mechansim, to avoid infinatly recursing aliases.
extern qboolean keydown[];
if (keydown[K_SHIFT] && keydown[K_CTRL] && keydown[K_ALT])
if (keydown[K_SHIFT] && keydown[K_CTRL] && (keydown[K_LALT]||keydown[K_RALT]))
return;
#endif

View File

@ -140,9 +140,9 @@ extern console_t *con_chat;
//shared between console and keys.
//really the console input should be in console.c instead of keys.c I suppose.
#define MAXCMDLINE 256
#define MAXCMDLINE 8192
#define CON_EDIT_LINES_MASK ((1<<6)-1)
extern unsigned char key_lines[CON_EDIT_LINES_MASK+1][MAXCMDLINE];
extern unsigned char *key_lines[CON_EDIT_LINES_MASK+1];
extern int edit_line;
extern int key_linepos;
extern int history_line;

View File

@ -274,7 +274,7 @@ static LRESULT WINAPI D3D11_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
if (keydown[K_ALT] && wParam == '\r')
if (keydown[K_LALT] && wParam == '\r')
{
if (modestate == MS_FULLSCREEN)
modestate = MS_WINDOWED;

View File

@ -15279,7 +15279,6 @@
</FileConfiguration>
<FileConfiguration
Name="GLDebug_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -16170,6 +16169,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\client\snd_sdl.c"
>
</File>
<File
RelativePath="..\client\snd_win.c"
>
@ -26587,170 +26590,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\client\snd_sdl.c"
>
<FileConfiguration
Name="MinGLDebug_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLDebug_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DDebug_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DDebug_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLRelease_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLRelease_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLDebug_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLDebug_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release Dedicated Server_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release Dedicated Server_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MRelease_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MRelease_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug Dedicated Server_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug Dedicated Server_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MDebug_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MDebug_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLRelease_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLRelease_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DRelease_SDL|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DRelease_SDL|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\server\sv_sys_unix.c"
>

View File

@ -491,14 +491,13 @@ reeval:
case OP_ADDRESS:
if ((unsigned)OPA->edict >= (unsigned)maxedicts)
{
#ifndef DEBUGABLE
progfuncs->funcs.pr_trace++;
printf("OP_ADDRESS references invalid entity in %s", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name));
st--;
goto cont;
#else
PR_RunError (&progfuncs->funcs, "OP_ADDRESS references invalid entity in %s", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name));
#endif
pr_xstatement = st-pr_statements;
if (PR_RunWarning (&progfuncs->funcs, "OP_ADDRESS references invalid entity in %s", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
{
st--;
goto cont;
}
break;
}
ed = PROG_TO_EDICT(progfuncs, OPA->edict);
#ifdef PARANOID
@ -506,22 +505,20 @@ reeval:
#endif
if (!ed || ed->readonly)
{
pr_xstatement = st-pr_statements;
#ifndef DEBUGABLE
//boot it over to the debugger
progfuncs->funcs.pr_trace++;
printf("assignment to read-only entity in %s\n", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name));
st--;
goto cont;
#else
{
ddef16_t *d16;
fdef_t *f;
d16 = ED_GlobalAtOfs16(progfuncs, st->a);
f = ED_FieldAtOfs(progfuncs, OPB->_int + progfuncs->funcs.fieldadjust);
printf ("assignment to read-only entity in %s (%s.%s)\n", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name), d16?PR_StringToNative(&progfuncs->funcs, d16->s_name):NULL, f?f->name:NULL);
pr_xstatement = st-pr_statements;
if (PR_RunWarning(&progfuncs->funcs, "assignment to read-only entity in %s (%s.%s)", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name), d16?PR_StringToNative(&progfuncs->funcs, d16->s_name):NULL, f?f->name:NULL))
{
st--;
goto cont;
}
}
#endif
}
//Whilst the next block would technically be correct, we don't use it as it breaks too many quake mods.

View File

@ -393,6 +393,23 @@ void VARGS PR_RunError (pubprogfuncs_t *progfuncs, char *error, ...)
progfuncs->parms->Abort ("%s", string);
}
pbool PR_RunWarning (pubprogfuncs_t *progfuncs, char *error, ...)
{
va_list argptr;
char string[1024];
va_start (argptr,error);
Q_vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr);
progfuncs->parms->Printf ("%s, %s\n", string, ((progfuncs->pr_trace)?"ignoring":"enabling trace"));
PR_StackTrace (progfuncs);
if (progfuncs->pr_trace++ == 0)
return true;
return false;
}
/*
============================================================================
PR_ExecuteProgram
@ -1091,10 +1108,10 @@ static char *lastfile = 0;
lastfile = f->s_file+progfuncs->funcs.stringtable;
lastline = externs->useeditor(&progfuncs->funcs, lastfile, lastline, statement, 0, NULL);
if (lastline < 0)
return -lastline;
if (!pr_progstate[pn].linenums)
return statement;
if (lastline < 0)
return -lastline;
if (pr_progstate[pn].linenums[statement] != lastline)
{

View File

@ -741,6 +741,19 @@ void NPP_NQFlush(void)
bufferlen+=2;
break;
case svcfte_cgamepacket:
if (sv.csqcdebug)
{
/*shift the data up by two bytes*/
memmove(buffer+3, buffer+1, bufferlen-1);
/*add a length in the 2nd/3rd bytes*/
buffer[1] = (bufferlen-1);
buffer[2] = (bufferlen-1) >> 8;
bufferlen += 2;
}
break;
case svc_temp_entity:
switch (buffer[1])
{
@ -904,8 +917,8 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
{
case svcdp_showlmp:
case svcdp_hidelmp:
break;
case svc_sound:
break;
case svc_temp_entity:
te_515sevilhackworkaround = false;
break;
@ -919,17 +932,20 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
nullterms = 1;
break;
case svc_setfrags:
protocollen = 4; //or this
protocollen = 4;
break;
case svc_updatecolors:
protocollen = 3; //or even this
protocollen = 3;
break;
case svc_print:
protocollen = 3;
nullterms = 1;
break;
case svc_cdtrack:
protocollen = sizeof(qbyte)*3;
if (progstype == PROG_QW)
protocollen = 2;
else
protocollen = 3;
break;
case svc_killedmonster:
protocollen = 1;
@ -1525,6 +1541,19 @@ void NPP_QWFlush(void)
}
}
break;
case svcfte_cgamepacket:
if (sv.csqcdebug)
{
/*shift the data up by two bytes*/
memmove(buffer+3, buffer+1, bufferlen-1);
/*add a length in the 2nd/3rd bytes*/
buffer[1] = (bufferlen-1);
buffer[2] = (bufferlen-1) >> 8;
bufferlen += 2;
}
break;
case svc_temp_entity:
switch(minortype)
@ -1532,17 +1561,19 @@ void NPP_QWFlush(void)
default:
if (te_515sevilhackworkaround)
{
/*shift the data up by two bytes*/
memmove(buffer+3, buffer+1, bufferlen-1);
if (sv.csqcdebug)
{
/*shift the data up by two bytes*/
memmove(buffer+3, buffer+1, bufferlen-1);
/*add a length in the 2nd/3rd bytes*/
buffer[1] = (bufferlen-1);
buffer[2] = (bufferlen-1) >> 8;
bufferlen += 2;
}
/*replace the svc itself*/
buffer[0] = svcfte_cgamepacket;
/*add a length in the 2nd/3rd bytes*/
buffer[1] = (bufferlen-1);
buffer[2] = (bufferlen-1) >> 8;
bufferlen += 2;
}
break;
case TEQW_LIGHTNINGBLOOD:

View File

@ -463,10 +463,8 @@ int QDECL QCEditor (pubprogfuncs_t *prinst, char *filename, int line, int statem
char *r;
vfsfile_t *f;
SV_EndRedirect();
if (line == -1)
return -1;
return line;
SV_EndRedirect();
if (developer.value)
{
@ -9215,7 +9213,8 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"infokey", PF_infokey, 0, 80, 0, 80, "string(entity e, string key)"}, //80
{"stof", PF_stof, 0, 81, 0, 81, "float(string)"}, //81
{"multicast", PF_multicast, 0, 82, 0, 82, "void(vector where, float set)"}, //82
{"multicast", PF_multicast, 0, 82, 0, 82, "#define unicast(pl,reli) do{msg_entity = pl; multicast('0 0 0', reli?MULITCAST_ONE_R:MULTICAST_ONE);}while(0)\n"
"void(vector where, float set)"}, //82

View File

@ -4140,7 +4140,7 @@ extern void Log_Init (void);
void SV_InitLocal (void)
{
int i, p;
int i;
extern cvar_t pr_allowbutton1;
extern cvar_t sv_aim;