bye bye quirky behaviour
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@507 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
deafeba37a
commit
789e38265b
5 changed files with 47 additions and 37 deletions
|
@ -76,12 +76,6 @@ struct edict_s *ED_Alloc (progfuncs_t *progfuncs)
|
|||
int i;
|
||||
edictrun_t *e;
|
||||
|
||||
static int lastmax;
|
||||
|
||||
if (lastmax + 2 < sv_num_edicts)
|
||||
lastmax = lastmax;
|
||||
lastmax = sv_num_edicts;
|
||||
|
||||
for ( i=0 ; i<sv_num_edicts ; i++)
|
||||
{
|
||||
e = (edictrun_t*)EDICT_NUM(progfuncs, i);
|
||||
|
@ -612,7 +606,6 @@ char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
|||
else
|
||||
sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
sprintf (line, "bad type %i", type);
|
||||
break;
|
||||
|
@ -1998,6 +1991,9 @@ struct edict_s *RestoreEnt (progfuncs_t *progfuncs, char *buf, int *size, struct
|
|||
char *start = buf;
|
||||
|
||||
buf = QCC_COM_Parse(buf); //read the key
|
||||
if (!buf || !*qcc_token)
|
||||
return NULL;
|
||||
|
||||
if (strcmp(qcc_token, "{"))
|
||||
Sys_Error("Restore Ent with no opening brace");
|
||||
|
||||
|
@ -2336,7 +2332,8 @@ retry:
|
|||
char lnoname[128];
|
||||
ohm = PRHunkMark(progfuncs);
|
||||
|
||||
COM_StripExtension(filename, lnoname);
|
||||
strcpy(lnoname, filename);
|
||||
StripExtension(lnoname);
|
||||
strcat(lnoname, ".lno");
|
||||
if ((len=externs->FileSize(lnoname))>0)
|
||||
{
|
||||
|
@ -2524,15 +2521,16 @@ retry:
|
|||
case 16:
|
||||
for (i=0 ; i<pr_progs->numstatements ; i++)
|
||||
{
|
||||
ddef16_t *gd;
|
||||
#ifndef NOENDIAN
|
||||
st16[i].op = LittleShort(st16[i].op);
|
||||
st16[i].a = LittleShort(st16[i].a);
|
||||
st16[i].b = LittleShort(st16[i].b);
|
||||
st16[i].c = LittleShort(st16[i].c);
|
||||
#endif
|
||||
/*
|
||||
if (st16[i].op == OP_IF || st16[i].op == OP_IFNOT) //strings are dodgy. if("") can evaluate to true
|
||||
{
|
||||
ddef16_t *gd;
|
||||
gd = ED_GlobalAtOfs16(progfuncs, st16[i].a);
|
||||
if (!gd)
|
||||
continue;
|
||||
|
@ -2551,7 +2549,9 @@ retry:
|
|||
st16[i].op = OP_IFNOTS;
|
||||
}
|
||||
}
|
||||
else if (st16[i].op >= OP_CALL1 && st16[i].op <= OP_CALL8)
|
||||
else
|
||||
*/
|
||||
if (st16[i].op >= OP_CALL1 && st16[i].op <= OP_CALL8)
|
||||
{
|
||||
if (st16[i].b)
|
||||
hexencalling = true;
|
||||
|
@ -2572,16 +2572,16 @@ retry:
|
|||
case 24: //24 sucks. Guess why.
|
||||
for (i=0 ; i<pr_progs->numstatements ; i++)
|
||||
{
|
||||
ddef16_t *gd;
|
||||
#ifndef NOENDIAN
|
||||
pr_statements32[i].op = LittleLong(pr_statements32[i].op);
|
||||
pr_statements32[i].a = LittleLong(pr_statements32[i].a);
|
||||
pr_statements32[i].b = LittleLong(pr_statements32[i].b);
|
||||
pr_statements32[i].c = LittleLong(pr_statements32[i].c);
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (pr_statements32[i].op == OP_IF || pr_statements32[i].op == OP_IFNOT) //strings are dodgy. if("") can evaluate to true
|
||||
{
|
||||
ddef16_t *gd;
|
||||
gd = ED_GlobalAtOfs16(progfuncs, pr_statements32[i].a);
|
||||
if (!gd)
|
||||
continue;
|
||||
|
@ -2597,7 +2597,9 @@ retry:
|
|||
pr_statements32[i].op = pr_statements32[i].op - OP_IF + OP_IFS;
|
||||
}
|
||||
}
|
||||
else if (pr_statements32[i].op >= OP_CALL1 && pr_statements32[i].op <= OP_CALL8)
|
||||
else
|
||||
*/
|
||||
if (pr_statements32[i].op >= OP_CALL1 && pr_statements32[i].op <= OP_CALL8)
|
||||
{
|
||||
if (pr_statements32[i].b)
|
||||
hexencalling = true;
|
||||
|
@ -2613,7 +2615,6 @@ retry:
|
|||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 32:
|
||||
#ifndef NOENDIAN
|
||||
for (i=0 ; i<pr_progs->numstatements ; i++)
|
||||
|
|
|
@ -227,6 +227,7 @@ PR_EnterFunction
|
|||
Returns the new program statement counter
|
||||
====================
|
||||
*/
|
||||
void PR_AbortStack (progfuncs_t *progfuncs);
|
||||
int PR_EnterFunction (progfuncs_t *progfuncs, dfunction_t *f, int progsnum)
|
||||
{
|
||||
int i, j, c, o;
|
||||
|
@ -240,6 +241,7 @@ int PR_EnterFunction (progfuncs_t *progfuncs, dfunction_t *f, int progsnum)
|
|||
printf ("stack overflow on call to %s", f->s_name);
|
||||
pr_depth--;
|
||||
PR_StackTrace (progfuncs);
|
||||
PR_AbortStack(progfuncs);
|
||||
return pr_xstatement;
|
||||
}
|
||||
|
||||
|
@ -703,7 +705,7 @@ static char *lastfile = NULL;
|
|||
int i;
|
||||
dfunction_t *f = pr_xfunction;
|
||||
|
||||
if (f && pr_progstate[pn].linenums)
|
||||
if (f && pr_progstate[pn].linenums && externs->useeditor)
|
||||
{
|
||||
if (lastline == pr_progstate[pn].linenums[statement] && lastfile == f->s_file)
|
||||
return statement; //no info/same line as last time
|
||||
|
@ -730,6 +732,7 @@ static char *lastfile = NULL;
|
|||
}
|
||||
else if (f) //annoying.
|
||||
{
|
||||
if (externs->useeditor)
|
||||
externs->useeditor(f->s_file, -1, 0, &f->s_name);
|
||||
return statement;
|
||||
}
|
||||
|
@ -765,7 +768,7 @@ void PR_ExecuteCode (progfuncs_t *progfuncs, int s)
|
|||
|
||||
int fnum = pr_xfunction - pr_functions;
|
||||
|
||||
runaway = 100000;
|
||||
runaway = 1000000;
|
||||
|
||||
prinst->continuestatement = -1;
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ void QC_AddSharedFieldVar(progfuncs_t *progfuncs, int num);
|
|||
int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, int requestedpos, int origionalofs);
|
||||
pbool Decompile(progfuncs_t *progfuncs, char *fname);
|
||||
int PR_ToggleBreakpoint(progfuncs_t *progfuncs, char *filename, int linenum, int flag);
|
||||
void StripExtension (char *path);
|
||||
|
||||
|
||||
#define edvars(ed) (((char *)ed)+externs->edictsize) //pointer to the field vars, given an edict
|
||||
|
|
|
@ -228,9 +228,6 @@ typedef union eval_s
|
|||
#define PROG_TO_EDICT(pf, ed) (*pf->ProgsToEdict) (pf, ed)
|
||||
#define EDICT_TO_PROG(pf, ed) (*pf->EdictToProgs) (pf, ed)
|
||||
|
||||
#define PR_RunError (*progfuncs->PR_RunError)
|
||||
#define PR_PrintEdict (*progfuncs->PR_PrintEdict)
|
||||
|
||||
#define PR_RegisterBuiltin(pf, name, func) (*pf->RegisterBuiltin) (pf, name, func)
|
||||
|
||||
#define NEXT_EDICT(pf,o) EDICT_NUM(pf, NUM_FOR_EDICT(pf, o)+1)
|
||||
|
|
|
@ -130,6 +130,15 @@ skipwhite:
|
|||
goto skipwhite;
|
||||
}
|
||||
|
||||
// skip /* comments
|
||||
if (c=='/' && data[1] == '*')
|
||||
{
|
||||
while (data[1] && (data[0] != '*' || data[1] != '/'))
|
||||
data++;
|
||||
data+=2;
|
||||
goto skipwhite;
|
||||
}
|
||||
|
||||
|
||||
// handle quoted strings specially
|
||||
if (c == '\"')
|
||||
|
@ -491,22 +500,6 @@ void StripFilename (char *path)
|
|||
path[length] = 0;
|
||||
}
|
||||
|
||||
void StripExtension (char *path)
|
||||
{
|
||||
int length;
|
||||
|
||||
length = strlen(path)-1;
|
||||
while (length > 0 && path[length] != '.')
|
||||
{
|
||||
length--;
|
||||
if (path[length] == '/')
|
||||
return; // no extension
|
||||
}
|
||||
if (length)
|
||||
path[length] = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
Extract file parts
|
||||
|
@ -912,3 +905,18 @@ void FS_CloseFromMem(void *mem)
|
|||
|
||||
|
||||
#endif
|
||||
|
||||
void StripExtension (char *path)
|
||||
{
|
||||
int length;
|
||||
|
||||
length = strlen(path)-1;
|
||||
while (length > 0 && path[length] != '.')
|
||||
{
|
||||
length--;
|
||||
if (path[length] == '/')
|
||||
return; // no extension
|
||||
}
|
||||
if (length)
|
||||
path[length] = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue