Added support for escaping things with \, may require some config

changes..

Cleaned up the ifdefs in gl_rpart.c
Added support for mouse buttons 4 and 5 in in_x11..
This commit is contained in:
Zephaniah E. Hull 2000-02-27 03:31:16 +00:00
parent adcb14a22d
commit 20077b7b4f
3 changed files with 24 additions and 14 deletions

View File

@ -153,10 +153,11 @@ Cbuf_Execute
*/
void Cbuf_Execute (void)
{
int i;
int i, li;
char *text;
char line[1024];
int quotes;
char line[1024] = {0};
int quotes;
qboolean escape;
while (cmd_text.cursize)
{
@ -164,19 +165,31 @@ void Cbuf_Execute (void)
text = (char *)cmd_text.data;
quotes = 0;
escape = false;
li = 0;
for (i=0 ; i< cmd_text.cursize ; i++)
{
if (text[i] == '"')
if (escape) {
escape = false;
line[li] = text[i];
li++;
} else if (text[i] == '\\') {
escape = true;
} else if (text[i] == '"') {
quotes++;
if ( !(quotes&1) && text[i] == ';')
line[li] = text[li];
li++;
} else if ( !(quotes&1) && text[i] == ';')
break; // don't break if inside a quoted string
if (text[i] == '\n')
else if (text[i] == '\n' || text[i] == '\r')
break;
else {
line[i] = text[i];
li++;
}
}
memcpy (line, text, i);
line[i] = 0;
line[li] = '\0';
// delete the text from the command buffer and move remaining commands down
// this is necessary because commands (exec, alias) can insert data at the

View File

@ -187,17 +187,12 @@ void R_DrawParticles (void)
p->vel[i] -= p->vel[i]*dvel;
p->vel[2] -= grav;
break;
#ifdef UQUAKE
case pt_grav:
#ifdef QUAKE2
p->vel[2] -= grav * 20;
break;
#endif
#endif
case pt_slowgrav:
#ifdef QUAKEWORLD
case pt_grav:
#endif
p->vel[2] -= grav;
break;
}

View File

@ -232,6 +232,8 @@ static void event_button(XEvent *event)
case 1:
case 2:
case 3:
case 4:
case 5:
Key_Event(K_MOUSE1 + but - 1, event->type == ButtonPress);
}
}