Should fix the Nexuiz menu crash reported by TimeServ
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1457 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
fc770f310d
commit
2fa6c2b103
2 changed files with 118 additions and 112 deletions
|
@ -108,7 +108,7 @@ struct edict_s *ED_Alloc (progfuncs_t *progfuncs)
|
||||||
return (struct edict_s *)e;
|
return (struct edict_s *)e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= maxedicts-1) //try again, but use timed out ents.
|
if (i >= maxedicts-1) //try again, but use timed out ents.
|
||||||
{
|
{
|
||||||
for ( i=0 ; i<sv_num_edicts ; i++)
|
for ( i=0 ; i<sv_num_edicts ; i++)
|
||||||
|
@ -142,7 +142,7 @@ struct edict_s *ED_Alloc (progfuncs_t *progfuncs)
|
||||||
Sys_Error ("ED_Alloc: no free edicts");
|
Sys_Error ("ED_Alloc: no free edicts");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sv_num_edicts++;
|
sv_num_edicts++;
|
||||||
e = (edictrun_t*)EDICT_NUM(progfuncs, i);
|
e = (edictrun_t*)EDICT_NUM(progfuncs, i);
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ void ED_Free (progfuncs_t *progfuncs, struct edict_s *ed)
|
||||||
VectorCopy (vec3_origin, ed->v.angles);
|
VectorCopy (vec3_origin, ed->v.angles);
|
||||||
ed->v.nextthink = -1;
|
ed->v.nextthink = -1;
|
||||||
ed->v.solid = 0;
|
ed->v.solid = 0;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -216,7 +216,7 @@ ddef16_t *ED_GlobalAtOfs16 (progfuncs_t *progfuncs, int ofs)
|
||||||
{
|
{
|
||||||
ddef16_t *def;
|
ddef16_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def = &pr_globaldefs16[i];
|
def = &pr_globaldefs16[i];
|
||||||
|
@ -229,7 +229,7 @@ ddef32_t *ED_GlobalAtOfs32 (progfuncs_t *progfuncs, unsigned int ofs)
|
||||||
{
|
{
|
||||||
ddef32_t *def;
|
ddef32_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def = &pr_globaldefs32[i];
|
def = &pr_globaldefs32[i];
|
||||||
|
@ -248,7 +248,7 @@ fdef_t *ED_FieldAtOfs (progfuncs_t *progfuncs, unsigned int ofs)
|
||||||
{
|
{
|
||||||
// ddef_t *def;
|
// ddef_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0 ; i<numfields ; i++)
|
for (i=0 ; i<numfields ; i++)
|
||||||
{
|
{
|
||||||
if (field[i].ofs == ofs)
|
if (field[i].ofs == ofs)
|
||||||
|
@ -264,9 +264,9 @@ ED_FindField
|
||||||
fdef_t *ED_FindField (progfuncs_t *progfuncs, char *name)
|
fdef_t *ED_FindField (progfuncs_t *progfuncs, char *name)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0 ; i<numfields ; i++)
|
for (i=0 ; i<numfields ; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp(field[i].name, name) )
|
if (!strcmp(field[i].name, name) )
|
||||||
return &field[i];
|
return &field[i];
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ ddef16_t *ED_FindGlobal16 (progfuncs_t *progfuncs, char *name)
|
||||||
{
|
{
|
||||||
ddef16_t *def;
|
ddef16_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=1 ; i<pr_progs->numglobaldefs ; i++)
|
for (i=1 ; i<pr_progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def = &pr_globaldefs16[i];
|
def = &pr_globaldefs16[i];
|
||||||
|
@ -296,7 +296,7 @@ ddef32_t *ED_FindGlobal32 (progfuncs_t *progfuncs, char *name)
|
||||||
{
|
{
|
||||||
ddef32_t *def;
|
ddef32_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=1 ; i<pr_progs->numglobaldefs ; i++)
|
for (i=1 ; i<pr_progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def = &pr_globaldefs32[i];
|
def = &pr_globaldefs32[i];
|
||||||
|
@ -328,7 +328,7 @@ ddef16_t *ED_FindGlobalFromProgs16 (progfuncs_t *progfuncs, char *name, progsnum
|
||||||
{
|
{
|
||||||
ddef16_t *def;
|
ddef16_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=1 ; i<pr_progstate[prnum].progs->numglobaldefs ; i++)
|
for (i=1 ; i<pr_progstate[prnum].progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def = &pr_progstate[prnum].globaldefs16[i];
|
def = &pr_progstate[prnum].globaldefs16[i];
|
||||||
|
@ -341,7 +341,7 @@ ddef32_t *ED_FindGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, progsnum
|
||||||
{
|
{
|
||||||
ddef32_t *def;
|
ddef32_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=1 ; i<pr_progstate[prnum].progs->numglobaldefs ; i++)
|
for (i=1 ; i<pr_progstate[prnum].progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def = &pr_progstate[prnum].globaldefs32[i];
|
def = &pr_progstate[prnum].globaldefs32[i];
|
||||||
|
@ -355,7 +355,7 @@ ddef16_t *ED_FindTypeGlobalFromProgs16 (progfuncs_t *progfuncs, char *name, prog
|
||||||
{
|
{
|
||||||
ddef16_t *def;
|
ddef16_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=1 ; i<pr_progstate[prnum].progs->numglobaldefs ; i++)
|
for (i=1 ; i<pr_progstate[prnum].progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def = &pr_progstate[prnum].globaldefs16[i];
|
def = &pr_progstate[prnum].globaldefs16[i];
|
||||||
|
@ -379,7 +379,7 @@ ddef32_t *ED_FindTypeGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, prog
|
||||||
{
|
{
|
||||||
ddef32_t *def;
|
ddef32_t *def;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=1 ; i<pr_progstate[prnum].progs->numglobaldefs ; i++)
|
for (i=1 ; i<pr_progstate[prnum].progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def = &pr_progstate[prnum].globaldefs32[i];
|
def = &pr_progstate[prnum].globaldefs32[i];
|
||||||
|
@ -416,7 +416,7 @@ unsigned int *ED_FindGlobalOfsFromProgs (progfuncs_t *progfuncs, char *name, pro
|
||||||
def32 = ED_FindTypeGlobalFromProgs32(progfuncs, name, prnum, type);
|
def32 = ED_FindTypeGlobalFromProgs32(progfuncs, name, prnum, type);
|
||||||
if (!def32)
|
if (!def32)
|
||||||
return NULL;
|
return NULL;
|
||||||
return &def32->ofs;
|
return &def32->ofs;
|
||||||
}
|
}
|
||||||
Sys_Error("ED_FindGlobalOfsFromProgs - bad intsize");
|
Sys_Error("ED_FindGlobalOfsFromProgs - bad intsize");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -427,13 +427,13 @@ unsigned int *ED_FindGlobalOfsFromProgs (progfuncs_t *progfuncs, char *name, pro
|
||||||
ED_FindFunction
|
ED_FindFunction
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *prnum, unsigned int fromprogs)
|
dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *prnum, progsnum_t fromprogs)
|
||||||
{
|
{
|
||||||
dfunction_t *func;
|
dfunction_t *func;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char *sep;
|
char *sep;
|
||||||
|
|
||||||
int pnum;
|
progsnum_t pnum;
|
||||||
|
|
||||||
if (prnum)
|
if (prnum)
|
||||||
{
|
{
|
||||||
|
@ -455,9 +455,15 @@ dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *pr
|
||||||
else
|
else
|
||||||
pnum = pr_typecurrent;
|
pnum = pr_typecurrent;
|
||||||
|
|
||||||
|
if ((unsigned)pnum > (unsigned)maxprogs)
|
||||||
|
{
|
||||||
|
printf("Progsnum %i out of bounds\n", pnum);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!pr_progstate[pnum].progs)
|
if (!pr_progstate[pnum].progs)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i=1 ; i<pr_progstate[pnum].progs->numfunctions ; i++)
|
for (i=1 ; i<pr_progstate[pnum].progs->numfunctions ; i++)
|
||||||
{
|
{
|
||||||
func = &pr_progstate[pnum].functions[i];
|
func = &pr_progstate[pnum].functions[i];
|
||||||
|
@ -479,7 +485,7 @@ char *PR_ValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
static char line[256];
|
static char line[256];
|
||||||
fdef_t *fielddef;
|
fdef_t *fielddef;
|
||||||
dfunction_t *f;
|
dfunction_t *f;
|
||||||
|
|
||||||
#ifdef DEF_SAVEGLOBAL
|
#ifdef DEF_SAVEGLOBAL
|
||||||
type &= ~DEF_SAVEGLOBAL;
|
type &= ~DEF_SAVEGLOBAL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -498,7 +504,7 @@ char *PR_ValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
case ev_string:
|
case ev_string:
|
||||||
sprintf (line, "%s", val->string+progfuncs->stringtable);
|
sprintf (line, "%s", val->string+progfuncs->stringtable);
|
||||||
break;
|
break;
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
sprintf (line, "entity %i", NUM_FOR_EDICT(progfuncs, (struct edict_s *)PROG_TO_EDICT(progfuncs, val->edict)) );
|
sprintf (line, "entity %i", NUM_FOR_EDICT(progfuncs, (struct edict_s *)PROG_TO_EDICT(progfuncs, val->edict)) );
|
||||||
break;
|
break;
|
||||||
case ev_function:
|
case ev_function:
|
||||||
|
@ -556,7 +562,7 @@ char *PR_ValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
sprintf (line, "bad type %i", type);
|
sprintf (line, "bad type %i", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,10 +577,10 @@ Easier to parse than PR_ValueString
|
||||||
char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
{
|
{
|
||||||
static char line[256];
|
static char line[256];
|
||||||
fdef_t *fielddef;
|
fdef_t *fielddef;
|
||||||
dfunction_t *f;
|
dfunction_t *f;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
#ifdef DEF_SAVEGLOBAL
|
#ifdef DEF_SAVEGLOBAL
|
||||||
type &= ~DEF_SAVEGLOBAL;
|
type &= ~DEF_SAVEGLOBAL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -586,7 +592,7 @@ char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
{
|
{
|
||||||
case ev_struct:
|
case ev_struct:
|
||||||
sprintf (line, "structures cannot yet be saved");
|
sprintf (line, "structures cannot yet be saved");
|
||||||
break;
|
break;
|
||||||
case ev_union:
|
case ev_union:
|
||||||
sprintf (line, "unions cannot yet be saved");
|
sprintf (line, "unions cannot yet be saved");
|
||||||
break;
|
break;
|
||||||
|
@ -596,7 +602,7 @@ char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
else
|
else
|
||||||
_snprintf (line, sizeof(line), "%s", val->string+progfuncs->stringtable);
|
_snprintf (line, sizeof(line), "%s", val->string+progfuncs->stringtable);
|
||||||
break;
|
break;
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
sprintf (line, "%i", val->_int);
|
sprintf (line, "%i", val->_int);
|
||||||
break;
|
break;
|
||||||
case ev_function:
|
case ev_function:
|
||||||
|
@ -635,13 +641,13 @@ char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
if (val->vector[0] == (int)val->vector[0] && val->vector[1] == (int)val->vector[1] && val->vector[2] == (int)val->vector[2])
|
if (val->vector[0] == (int)val->vector[0] && val->vector[1] == (int)val->vector[1] && val->vector[2] == (int)val->vector[2])
|
||||||
sprintf (line, "%i %i %i", (int)val->vector[0], (int)val->vector[1], (int)val->vector[2]);
|
sprintf (line, "%i %i %i", (int)val->vector[0], (int)val->vector[1], (int)val->vector[2]);
|
||||||
else
|
else
|
||||||
sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
|
sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf (line, "bad type %i", type);
|
sprintf (line, "bad type %i", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,9 +655,9 @@ char *PR_UglyValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
char *PR_UglyOldValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
char *PR_UglyOldValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
{
|
{
|
||||||
static char line[256];
|
static char line[256];
|
||||||
fdef_t *fielddef;
|
fdef_t *fielddef;
|
||||||
dfunction_t *f;
|
dfunction_t *f;
|
||||||
|
|
||||||
#ifdef DEF_SAVEGLOBAL
|
#ifdef DEF_SAVEGLOBAL
|
||||||
type &= ~DEF_SAVEGLOBAL;
|
type &= ~DEF_SAVEGLOBAL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -663,14 +669,14 @@ char *PR_UglyOldValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
{
|
{
|
||||||
case ev_struct:
|
case ev_struct:
|
||||||
sprintf (line, "structures cannot yet be saved");
|
sprintf (line, "structures cannot yet be saved");
|
||||||
break;
|
break;
|
||||||
case ev_union:
|
case ev_union:
|
||||||
sprintf (line, "unions cannot yet be saved");
|
sprintf (line, "unions cannot yet be saved");
|
||||||
break;
|
break;
|
||||||
case ev_string:
|
case ev_string:
|
||||||
sprintf (line, "%s", val->string+progfuncs->stringtable);
|
sprintf (line, "%s", val->string+progfuncs->stringtable);
|
||||||
break;
|
break;
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
sprintf (line, "%i", NUM_FOR_EDICT(progfuncs, (struct edict_s *)PROG_TO_EDICT(progfuncs, val->edict)));
|
sprintf (line, "%i", NUM_FOR_EDICT(progfuncs, (struct edict_s *)PROG_TO_EDICT(progfuncs, val->edict)));
|
||||||
break;
|
break;
|
||||||
case ev_function:
|
case ev_function:
|
||||||
|
@ -698,13 +704,13 @@ char *PR_UglyOldValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
|
||||||
sprintf (line, "%i %i %i", (int)val->vector[0], (int)val->vector[1], (int)val->vector[2]);
|
sprintf (line, "%i %i %i", (int)val->vector[0], (int)val->vector[1], (int)val->vector[2]);
|
||||||
else
|
else
|
||||||
sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
|
sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf (line, "bad type %i", type);
|
sprintf (line, "bad type %i", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,12 +726,12 @@ char *PR_TypeString(progfuncs_t *progfuncs, etype_t type)
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ev_struct:
|
case ev_struct:
|
||||||
return "struct";
|
return "struct";
|
||||||
case ev_union:
|
case ev_union:
|
||||||
return "union";
|
return "union";
|
||||||
case ev_string:
|
case ev_string:
|
||||||
return "string";
|
return "string";
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
return "entity";
|
return "entity";
|
||||||
case ev_function:
|
case ev_function:
|
||||||
return "function";
|
return "function";
|
||||||
|
@ -741,7 +747,7 @@ char *PR_TypeString(progfuncs_t *progfuncs, etype_t type)
|
||||||
return "integer";
|
return "integer";
|
||||||
default:
|
default:
|
||||||
return "BAD TYPE";
|
return "BAD TYPE";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -774,7 +780,7 @@ char *PR_GlobalString (progfuncs_t *progfuncs, int ofs)
|
||||||
s = PR_ValueString (progfuncs, def16->type, val);
|
s = PR_ValueString (progfuncs, def16->type, val);
|
||||||
sprintf (line,"%i(%s)%s", ofs, def16->s_name+progfuncs->stringtable, s);
|
sprintf (line,"%i(%s)%s", ofs, def16->s_name+progfuncs->stringtable, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = strlen(line);
|
i = strlen(line);
|
||||||
for ( ; i<20 ; i++)
|
for ( ; i<20 ; i++)
|
||||||
strcat (line," ");
|
strcat (line," ");
|
||||||
|
@ -790,7 +796,7 @@ char *PR_GlobalString (progfuncs_t *progfuncs, int ofs)
|
||||||
s = PR_ValueString (progfuncs, def32->type, val);
|
s = PR_ValueString (progfuncs, def32->type, val);
|
||||||
sprintf (line,"%i(%s)%s", ofs, def32->s_name+progfuncs->stringtable, s);
|
sprintf (line,"%i(%s)%s", ofs, def32->s_name+progfuncs->stringtable, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = strlen(line);
|
i = strlen(line);
|
||||||
for ( ; i<20 ; i++)
|
for ( ; i<20 ; i++)
|
||||||
strcat (line," ");
|
strcat (line," ");
|
||||||
|
@ -828,12 +834,12 @@ char *PR_GlobalStringNoContents (progfuncs_t *progfuncs, int ofs)
|
||||||
default:
|
default:
|
||||||
Sys_Error("Bad offset size in PR_GlobalStringNoContents");
|
Sys_Error("Bad offset size in PR_GlobalStringNoContents");
|
||||||
}
|
}
|
||||||
|
|
||||||
i = strlen(line);
|
i = strlen(line);
|
||||||
for ( ; i<20 ; i++)
|
for ( ; i<20 ; i++)
|
||||||
strcat (line," ");
|
strcat (line," ");
|
||||||
strcat (line," ");
|
strcat (line," ");
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,7 +874,7 @@ void ED_Print (progfuncs_t *progfuncs, struct edict_s *ed)
|
||||||
l = strlen(name);
|
l = strlen(name);
|
||||||
if (l >= 2 && name[l-2] == '_')
|
if (l >= 2 && name[l-2] == '_')
|
||||||
continue; // skip _x, _y, _z vars
|
continue; // skip _x, _y, _z vars
|
||||||
|
|
||||||
v = (int *)((char *)edvars(ed) + d->ofs*4);
|
v = (int *)((char *)edvars(ed) + d->ofs*4);
|
||||||
|
|
||||||
// if the value is still all 0, skip the field
|
// if the value is still all 0, skip the field
|
||||||
|
@ -877,19 +883,19 @@ void ED_Print (progfuncs_t *progfuncs, struct edict_s *ed)
|
||||||
#else
|
#else
|
||||||
type = d->type;
|
type = d->type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (j=0 ; j<type_size[type] ; j++)
|
for (j=0 ; j<type_size[type] ; j++)
|
||||||
if (v[j])
|
if (v[j])
|
||||||
break;
|
break;
|
||||||
if (j == type_size[type])
|
if (j == type_size[type])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf ("%s",name);
|
printf ("%s",name);
|
||||||
l = strlen (name);
|
l = strlen (name);
|
||||||
while (l++ < 15)
|
while (l++ < 15)
|
||||||
printf (" ");
|
printf (" ");
|
||||||
|
|
||||||
printf ("%s\n", PR_ValueString(progfuncs, d->type, (eval_t *)v));
|
printf ("%s\n", PR_ValueString(progfuncs, d->type, (eval_t *)v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -908,7 +914,7 @@ For debugging, prints all the entities in the current server
|
||||||
void ED_PrintEdicts (progfuncs_t *progfuncs)
|
void ED_PrintEdicts (progfuncs_t *progfuncs)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
printf ("%i entities\n", sv_num_edicts);
|
printf ("%i entities\n", sv_num_edicts);
|
||||||
for (i=0 ; i<sv_num_edicts ; i++)
|
for (i=0 ; i<sv_num_edicts ; i++)
|
||||||
ED_PrintNum (progfuncs, i);
|
ED_PrintNum (progfuncs, i);
|
||||||
|
@ -966,7 +972,7 @@ char *ED_NewString (progfuncs_t *progfuncs, char *string, int minlength)
|
||||||
int i,l;
|
int i,l;
|
||||||
|
|
||||||
minlength++;
|
minlength++;
|
||||||
|
|
||||||
l = strlen(string) + 1;
|
l = strlen(string) + 1;
|
||||||
|
|
||||||
new = PRAddressableAlloc (progfuncs, l<minlength?minlength:l);
|
new = PRAddressableAlloc (progfuncs, l<minlength?minlength:l);
|
||||||
|
@ -985,7 +991,7 @@ char *ED_NewString (progfuncs_t *progfuncs, char *string, int minlength)
|
||||||
else
|
else
|
||||||
*new_p++ = string[i];
|
*new_p++ = string[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,7 +1015,7 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, void *base, ddefXX_t *key, char *s,
|
||||||
dfunction_t *func;
|
dfunction_t *func;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
switch(bits)
|
switch(bits)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
|
@ -1032,14 +1038,14 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, void *base, ddefXX_t *key, char *s,
|
||||||
Sys_Error("Bad bits in ED_ParseEpair");
|
Sys_Error("Bad bits in ED_ParseEpair");
|
||||||
d = 0;
|
d = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ev_string:
|
case ev_string:
|
||||||
st = ED_NewString (progfuncs, s, 0)-progfuncs->stringtable;
|
st = ED_NewString (progfuncs, s, 0)-progfuncs->stringtable;
|
||||||
*(string_t *)d = st;
|
*(string_t *)d = st;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ev_float:
|
case ev_float:
|
||||||
*(float *)d = (float)atof (s);
|
*(float *)d = (float)atof (s);
|
||||||
break;
|
break;
|
||||||
|
@ -1047,7 +1053,7 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, void *base, ddefXX_t *key, char *s,
|
||||||
case ev_integer:
|
case ev_integer:
|
||||||
*(int *)d = atoi (s);
|
*(int *)d = atoi (s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ev_vector:
|
case ev_vector:
|
||||||
strcpy (string, s);
|
strcpy (string, s);
|
||||||
v = string;
|
v = string;
|
||||||
|
@ -1061,7 +1067,7 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, void *base, ddefXX_t *key, char *s,
|
||||||
w = v = v+1;
|
w = v = v+1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
*(int *)d = atoi (s);
|
*(int *)d = atoi (s);
|
||||||
break;
|
break;
|
||||||
|
@ -1090,7 +1096,7 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, void *base, ddefXX_t *key, char *s,
|
||||||
}
|
}
|
||||||
*(func_t *)d = (func - pr_progstate[i].functions) | (i<<24);
|
*(func_t *)d = (func - pr_progstate[i].functions) | (i<<24);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1124,14 +1130,14 @@ char *ED_ParseEdict (progfuncs_t *progfuncs, char *data, edictrun_t *ent)
|
||||||
|
|
||||||
// go through all the dictionary pairs
|
// go through all the dictionary pairs
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
// parse key
|
// parse key
|
||||||
data = QCC_COM_Parse (data);
|
data = QCC_COM_Parse (data);
|
||||||
if (qcc_token[0] == '}')
|
if (qcc_token[0] == '}')
|
||||||
break;
|
break;
|
||||||
if (!data)
|
if (!data)
|
||||||
Sys_Error ("ED_ParseEntity: EOF without closing brace");
|
Sys_Error ("ED_ParseEntity: EOF without closing brace");
|
||||||
|
|
||||||
strcpy (keyname, qcc_token);
|
strcpy (keyname, qcc_token);
|
||||||
|
|
||||||
// another hack to fix heynames with trailing spaces
|
// another hack to fix heynames with trailing spaces
|
||||||
|
@ -1142,7 +1148,7 @@ char *ED_ParseEdict (progfuncs_t *progfuncs, char *data, edictrun_t *ent)
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse value
|
// parse value
|
||||||
data = QCC_COM_Parse (data);
|
data = QCC_COM_Parse (data);
|
||||||
if (!data)
|
if (!data)
|
||||||
Sys_Error ("ED_ParseEntity: EOF without closing brace");
|
Sys_Error ("ED_ParseEntity: EOF without closing brace");
|
||||||
|
@ -1150,14 +1156,14 @@ char *ED_ParseEdict (progfuncs_t *progfuncs, char *data, edictrun_t *ent)
|
||||||
if (qcc_token[0] == '}')
|
if (qcc_token[0] == '}')
|
||||||
Sys_Error ("ED_ParseEntity: closing brace without data");
|
Sys_Error ("ED_ParseEntity: closing brace without data");
|
||||||
|
|
||||||
init = true;
|
init = true;
|
||||||
|
|
||||||
// keynames with a leading underscore are used for utility comments,
|
// keynames with a leading underscore are used for utility comments,
|
||||||
// and are immediately discarded by quake
|
// and are immediately discarded by quake
|
||||||
if (keyname[0] == '_')
|
if (keyname[0] == '_')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
key = ED_FindField (progfuncs, keyname);
|
key = ED_FindField (progfuncs, keyname);
|
||||||
if (!key)
|
if (!key)
|
||||||
{
|
{
|
||||||
if (!strcmp(keyname, "angle")) //Quake anglehack - we've got to leave it in cos it doesn't work for quake otherwise, and this is a QuakeC lib!
|
if (!strcmp(keyname, "angle")) //Quake anglehack - we've got to leave it in cos it doesn't work for quake otherwise, and this is a QuakeC lib!
|
||||||
|
@ -1210,7 +1216,7 @@ char *ED_WriteGlobals(progfuncs_t *progfuncs, char *buffer) //switch first.
|
||||||
ddef32_t *def32;
|
ddef32_t *def32;
|
||||||
ddef16_t *def16;
|
ddef16_t *def16;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int j;
|
int j;
|
||||||
char *name;
|
char *name;
|
||||||
int type;
|
int type;
|
||||||
int curprogs = pr_typecurrent;
|
int curprogs = pr_typecurrent;
|
||||||
|
@ -1221,7 +1227,7 @@ char *ED_WriteGlobals(progfuncs_t *progfuncs, char *buffer) //switch first.
|
||||||
case 24:
|
case 24:
|
||||||
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def16 = &pr_globaldefs16[i];
|
def16 = &pr_globaldefs16[i];
|
||||||
name = def16->s_name + progfuncs->stringtable;
|
name = def16->s_name + progfuncs->stringtable;
|
||||||
len = strlen(name);
|
len = strlen(name);
|
||||||
if (!*name)
|
if (!*name)
|
||||||
|
@ -1286,7 +1292,7 @@ char *ED_WriteGlobals(progfuncs_t *progfuncs, char *buffer) //switch first.
|
||||||
case 32:
|
case 32:
|
||||||
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
||||||
{
|
{
|
||||||
def32 = &pr_globaldefs32[i];
|
def32 = &pr_globaldefs32[i];
|
||||||
name = def32->s_name + progfuncs->stringtable;
|
name = def32->s_name + progfuncs->stringtable;
|
||||||
if (name[strlen(name)-2] == '_')
|
if (name[strlen(name)-2] == '_')
|
||||||
continue; // skip _x, _y, _z vars (vector componants, which are saved as one vector not 3 floats)
|
continue; // skip _x, _y, _z vars (vector componants, which are saved as one vector not 3 floats)
|
||||||
|
@ -1305,7 +1311,7 @@ char *ED_WriteGlobals(progfuncs_t *progfuncs, char *buffer) //switch first.
|
||||||
v = (int *)¤t_progstate->globals[def32->ofs];
|
v = (int *)¤t_progstate->globals[def32->ofs];
|
||||||
if ((v[0]&0xff000000)>>24 == (unsigned)curprogs) //same progs
|
if ((v[0]&0xff000000)>>24 == (unsigned)curprogs) //same progs
|
||||||
if (!strcmp(current_progstate->functions[v[0]&0x00ffffff].s_name+ progfuncs->stringtable, name)) //names match. Assume function is at initial value.
|
if (!strcmp(current_progstate->functions[v[0]&0x00ffffff].s_name+ progfuncs->stringtable, name)) //names match. Assume function is at initial value.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (curprogs!=0)
|
if (curprogs!=0)
|
||||||
if ((v[0]&0xff000000)>>24 == 0)
|
if ((v[0]&0xff000000)>>24 == 0)
|
||||||
|
@ -1360,7 +1366,7 @@ char *ED_WriteEdict(progfuncs_t *progfuncs, edictrun_t *ed, char *buffer, pbool
|
||||||
len = strlen(name);
|
len = strlen(name);
|
||||||
if (len>4 && (name[len-2] == '_' && (name[len-1] == 'x' || name[len-1] == 'y' || name[len-1] == 'z')))
|
if (len>4 && (name[len-2] == '_' && (name[len-1] == 'x' || name[len-1] == 'y' || name[len-1] == 'z')))
|
||||||
continue; // skip _x, _y, _z vars
|
continue; // skip _x, _y, _z vars
|
||||||
|
|
||||||
v = (int *)((char*)ed->fields + d->ofs*4);
|
v = (int *)((char*)ed->fields + d->ofs*4);
|
||||||
|
|
||||||
// if the value is still all 0, skip the field
|
// if the value is still all 0, skip the field
|
||||||
|
@ -1369,13 +1375,13 @@ char *ED_WriteEdict(progfuncs_t *progfuncs, edictrun_t *ed, char *buffer, pbool
|
||||||
#else
|
#else
|
||||||
type = d->type;
|
type = d->type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (j=0 ; j<type_size[type] ; j++)
|
for (j=0 ; j<type_size[type] ; j++)
|
||||||
if (v[j])
|
if (v[j])
|
||||||
break;
|
break;
|
||||||
if (j == type_size[type])
|
if (j == type_size[type])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//add it to the file
|
//add it to the file
|
||||||
AddS (qcva("\"%s\" ",name));
|
AddS (qcva("\"%s\" ",name));
|
||||||
AddS (qcva("\"%s\"\n", (q1compatable?PR_UglyOldValueString:PR_UglyValueString)(progfuncs, d->type, (eval_t *)v)));
|
AddS (qcva("\"%s\"\n", (q1compatable?PR_UglyOldValueString:PR_UglyValueString)(progfuncs, d->type, (eval_t *)v)));
|
||||||
|
@ -1410,7 +1416,7 @@ char *SaveCallStack (progfuncs_t *progfuncs, char *s)
|
||||||
for (i=pr_depth ; i>0 ; i--)
|
for (i=pr_depth ; i>0 ; i--)
|
||||||
{
|
{
|
||||||
f = pr_stack[i].f;
|
f = pr_stack[i].f;
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
AddS ("<NO FUNCTION>\n");
|
AddS ("<NO FUNCTION>\n");
|
||||||
|
@ -1472,7 +1478,7 @@ char *SaveEnts(progfuncs_t *progfuncs, char *mem, int *len, int alldata)
|
||||||
char *s, *os;
|
char *s, *os;
|
||||||
unsigned int a;
|
unsigned int a;
|
||||||
int oldprogs;
|
int oldprogs;
|
||||||
|
|
||||||
if (mem)
|
if (mem)
|
||||||
{
|
{
|
||||||
os = s = mem;
|
os = s = mem;
|
||||||
|
@ -1535,7 +1541,7 @@ char *SaveEnts(progfuncs_t *progfuncs, char *mem, int *len, int alldata)
|
||||||
// AddS(qcva("\"crc\" \"%i\"\n", header_crc));
|
// AddS(qcva("\"crc\" \"%i\"\n", header_crc));
|
||||||
AddS(qcva("\"numentities\" \"%i\"\n", sv_num_edicts));
|
AddS(qcva("\"numentities\" \"%i\"\n", sv_num_edicts));
|
||||||
AddS("}\n");
|
AddS("}\n");
|
||||||
|
|
||||||
oldprogs = pr_typecurrent;
|
oldprogs = pr_typecurrent;
|
||||||
|
|
||||||
for (a = 0; a < maxprogs; a++)
|
for (a = 0; a < maxprogs; a++)
|
||||||
|
@ -1602,12 +1608,12 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
{
|
{
|
||||||
eval_t *fulldata; //this is part of FTE_FULLSPAWNDATA
|
eval_t *fulldata; //this is part of FTE_FULLSPAWNDATA
|
||||||
char *datastart;
|
char *datastart;
|
||||||
|
|
||||||
eval_t *var;
|
eval_t *var;
|
||||||
|
|
||||||
char filename[128];
|
char filename[128];
|
||||||
int num;
|
int num;
|
||||||
int numbuiltins;
|
int numbuiltins;
|
||||||
edictrun_t *ed=NULL;
|
edictrun_t *ed=NULL;
|
||||||
ddef16_t *d16;
|
ddef16_t *d16;
|
||||||
ddef32_t *d32;
|
ddef32_t *d32;
|
||||||
|
@ -1724,13 +1730,13 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
{
|
{
|
||||||
file = QCC_COM_Parse(file);
|
file = QCC_COM_Parse(file);
|
||||||
num = atoi(qcc_token);
|
num = atoi(qcc_token);
|
||||||
file = QCC_COM_Parse(file);
|
file = QCC_COM_Parse(file);
|
||||||
if (qcc_token[0] != '{')
|
if (qcc_token[0] != '{')
|
||||||
Sys_Error("Progs loading found %s, not '{'", qcc_token);
|
Sys_Error("Progs loading found %s, not '{'", qcc_token);
|
||||||
|
|
||||||
|
|
||||||
filename[0] = '\0';
|
filename[0] = '\0';
|
||||||
header_crc = 0;
|
header_crc = 0;
|
||||||
numbuiltins = 0;
|
numbuiltins = 0;
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
|
@ -1792,10 +1798,10 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
file = QCC_COM_Parse(file);
|
file = QCC_COM_Parse(file);
|
||||||
if (qcc_token[0] != '{')
|
if (qcc_token[0] != '{')
|
||||||
Sys_Error("Globals loading found \'%s\', not '{'", qcc_token);
|
Sys_Error("Globals loading found \'%s\', not '{'", qcc_token);
|
||||||
|
|
||||||
PR_SwitchProgs(progfuncs, num);
|
PR_SwitchProgs(progfuncs, num);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
file = QCC_COM_Parse(file);
|
file = QCC_COM_Parse(file);
|
||||||
if (qcc_token[0] == '}')
|
if (qcc_token[0] == '}')
|
||||||
break;
|
break;
|
||||||
|
@ -1836,8 +1842,8 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
|
|
||||||
// file = QCC_COM_Parse(file);
|
// file = QCC_COM_Parse(file);
|
||||||
// if (com_token[0] != '}')
|
// if (com_token[0] != '}')
|
||||||
// Sys_Error("Progs loading found %s, not '}'", qcc_token);
|
// Sys_Error("Progs loading found %s, not '}'", qcc_token);
|
||||||
}
|
}
|
||||||
else if (!strcmp(qcc_token, "general"))
|
else if (!strcmp(qcc_token, "general"))
|
||||||
{
|
{
|
||||||
QC_StartShares(progfuncs);
|
QC_StartShares(progfuncs);
|
||||||
|
@ -1870,7 +1876,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
else
|
else
|
||||||
Sys_Error("Bad key \"%s\" in general block", qcc_token);
|
Sys_Error("Bad key \"%s\" in general block", qcc_token);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRAddressableFlush(progfuncs, -1);
|
PRAddressableFlush(progfuncs, -1);
|
||||||
resethunk=true;
|
resethunk=true;
|
||||||
|
|
||||||
|
@ -1885,7 +1891,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
sv_num_edicts = numents; //should be fine
|
sv_num_edicts = numents; //should be fine
|
||||||
|
|
||||||
// PR_Configure(crc, NULL, memsize, maxedicts, maxprogs);
|
// PR_Configure(crc, NULL, memsize, maxedicts, maxprogs);
|
||||||
}
|
}
|
||||||
else if (!strcmp(qcc_token, "{"))
|
else if (!strcmp(qcc_token, "{"))
|
||||||
{
|
{
|
||||||
if (isloadgame)
|
if (isloadgame)
|
||||||
|
@ -1893,7 +1899,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
if (numents == -1) //globals
|
if (numents == -1) //globals
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
file = QCC_COM_Parse(file);
|
file = QCC_COM_Parse(file);
|
||||||
if (qcc_token[0] == '}')
|
if (qcc_token[0] == '}')
|
||||||
break;
|
break;
|
||||||
|
@ -1994,7 +2000,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resethunk)
|
if (!resethunk)
|
||||||
{
|
{
|
||||||
func_t f;
|
func_t f;
|
||||||
if (!CheckSpawn)
|
if (!CheckSpawn)
|
||||||
CheckSpawn = PR_FindFunc(progfuncs, "CheckSpawn", -2);
|
CheckSpawn = PR_FindFunc(progfuncs, "CheckSpawn", -2);
|
||||||
|
@ -2012,7 +2018,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
//added by request of Mercury.
|
//added by request of Mercury.
|
||||||
if (fulldata) //this is a vital part of HL map support!!!
|
if (fulldata) //this is a vital part of HL map support!!!
|
||||||
{ //essentually, it passes the ent's spawn info to the ent.
|
{ //essentually, it passes the ent's spawn info to the ent.
|
||||||
char *nl; //otherwise it sees only the named fields of
|
char *nl; //otherwise it sees only the named fields of
|
||||||
char *spawndata;//a standard quake ent.
|
char *spawndata;//a standard quake ent.
|
||||||
spawndata = PRHunkAlloc(progfuncs, file - datastart +1);
|
spawndata = PRHunkAlloc(progfuncs, file - datastart +1);
|
||||||
strncpy(spawndata, datastart, file - datastart);
|
strncpy(spawndata, datastart, file - datastart);
|
||||||
|
@ -2057,7 +2063,7 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
||||||
}
|
}
|
||||||
if (resethunk)
|
if (resethunk)
|
||||||
{
|
{
|
||||||
header_crc = crc;
|
header_crc = crc;
|
||||||
if (externs->loadcompleate)
|
if (externs->loadcompleate)
|
||||||
externs->loadcompleate(entsize);
|
externs->loadcompleate(entsize);
|
||||||
|
|
||||||
|
@ -2080,7 +2086,7 @@ char *SaveEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed)
|
||||||
int *v;
|
int *v;
|
||||||
unsigned int i;int j;
|
unsigned int i;int j;
|
||||||
char *name;
|
char *name;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
char *s = buf;
|
char *s = buf;
|
||||||
|
|
||||||
|
@ -2096,7 +2102,7 @@ char *SaveEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed)
|
||||||
name = d->name;
|
name = d->name;
|
||||||
if (name[strlen(name)-2] == '_')
|
if (name[strlen(name)-2] == '_')
|
||||||
continue; // skip _x, _y, _z vars
|
continue; // skip _x, _y, _z vars
|
||||||
|
|
||||||
v = (int*)((edictrun_t*)ed)->fields + d->ofs;
|
v = (int*)((edictrun_t*)ed)->fields + d->ofs;
|
||||||
|
|
||||||
// if the value is still all 0, skip the field
|
// if the value is still all 0, skip the field
|
||||||
|
@ -2106,7 +2112,7 @@ char *SaveEnt (progfuncs_t *progfuncs, char *buf, int *size, struct edict_s *ed)
|
||||||
break;
|
break;
|
||||||
if (j == type_size[type])
|
if (j == type_size[type])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//add it to the file
|
//add it to the file
|
||||||
AddS (qcva("\"%s\" ",name));
|
AddS (qcva("\"%s\" ",name));
|
||||||
AddS (qcva("\"%s\"\n", PR_UglyValueString(progfuncs, d->type, (eval_t *)v)));
|
AddS (qcva("\"%s\"\n", PR_UglyValueString(progfuncs, d->type, (eval_t *)v)));
|
||||||
|
@ -2153,9 +2159,9 @@ pbool PR_TestRecompile(progfuncs_t *progfuncs)
|
||||||
includeddatafile_t *s;
|
includeddatafile_t *s;
|
||||||
if (!pr_progs->ofsfiles)
|
if (!pr_progs->ofsfiles)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
num = *(int*)((char *)pr_progs + pr_progs->ofsfiles);
|
num = *(int*)((char *)pr_progs + pr_progs->ofsfiles);
|
||||||
s = (includeddatafile_t *)((char *)pr_progs + pr_progs->ofsfiles+4);
|
s = (includeddatafile_t *)((char *)pr_progs + pr_progs->ofsfiles+4);
|
||||||
while(num>0)
|
while(num>0)
|
||||||
{
|
{
|
||||||
newsize = externs->FileSize(s->filename);
|
newsize = externs->FileSize(s->filename);
|
||||||
|
@ -2224,7 +2230,7 @@ int PR_ReallyLoadProgs (progfuncs_t *progfuncs, char *filename, int headercrc, p
|
||||||
int len;
|
int len;
|
||||||
// int num;
|
// int num;
|
||||||
// dfunction_t *f, *f2;
|
// dfunction_t *f, *f2;
|
||||||
ddef16_t *d16;
|
ddef16_t *d16;
|
||||||
ddef32_t *d32;
|
ddef32_t *d32;
|
||||||
int *d2;
|
int *d2;
|
||||||
eval_t *eval;
|
eval_t *eval;
|
||||||
|
@ -2245,10 +2251,10 @@ int PR_ReallyLoadProgs (progfuncs_t *progfuncs, char *filename, int headercrc, p
|
||||||
|
|
||||||
int stringadjust;
|
int stringadjust;
|
||||||
|
|
||||||
current_progstate = progstate;
|
current_progstate = progstate;
|
||||||
|
|
||||||
strcpy(current_progstate->filename, filename);
|
strcpy(current_progstate->filename, filename);
|
||||||
|
|
||||||
|
|
||||||
// flush the non-C variable lookup cache
|
// flush the non-C variable lookup cache
|
||||||
// for (i=0 ; i<GEFV_CACHESIZE ; i++)
|
// for (i=0 ; i<GEFV_CACHESIZE ; i++)
|
||||||
|
@ -2424,7 +2430,7 @@ retry:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Sys_Error("Bad intsize");
|
Sys_Error("Bad intsize");
|
||||||
}
|
}
|
||||||
s = PRHunkAlloc(progfuncs, len);
|
s = PRHunkAlloc(progfuncs, len);
|
||||||
QC_decode(progfuncs, PRLittleLong(*(int *)pr_globaldefs16), len, 2, (char *)(((int *)pr_globaldefs16)+1), s);
|
QC_decode(progfuncs, PRLittleLong(*(int *)pr_globaldefs16), len, 2, (char *)(((int *)pr_globaldefs16)+1), s);
|
||||||
|
|
||||||
|
@ -2442,7 +2448,7 @@ retry:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Sys_Error("Bad intsize");
|
Sys_Error("Bad intsize");
|
||||||
}
|
}
|
||||||
s = PRHunkAlloc(progfuncs, len);
|
s = PRHunkAlloc(progfuncs, len);
|
||||||
QC_decode(progfuncs, PRLittleLong(*(int *)pr_fielddefs16), len, 2, (char *)(((int *)pr_fielddefs16)+1), s);
|
QC_decode(progfuncs, PRLittleLong(*(int *)pr_fielddefs16), len, 2, (char *)(((int *)pr_fielddefs16)+1), s);
|
||||||
|
|
||||||
|
@ -2478,10 +2484,10 @@ retry:
|
||||||
s = PRHunkAlloc(progfuncs, len);
|
s = PRHunkAlloc(progfuncs, len);
|
||||||
QC_decode(progfuncs, PRLittleLong(*(int *)pr_linenums), len, 2, (char *)(((int *)pr_linenums)+1), s);
|
QC_decode(progfuncs, PRLittleLong(*(int *)pr_linenums), len, 2, (char *)(((int *)pr_linenums)+1), s);
|
||||||
|
|
||||||
pr_linenums = (int *)s;
|
pr_linenums = (int *)s;
|
||||||
}
|
}
|
||||||
if (pr_types && pr_progs->blockscompressed & 128) //types
|
if (pr_types && pr_progs->blockscompressed & 128) //types
|
||||||
{
|
{
|
||||||
len=sizeof(typeinfo_t)*pr_progs->numtypes;
|
len=sizeof(typeinfo_t)*pr_progs->numtypes;
|
||||||
s = PRHunkAlloc(progfuncs, len);
|
s = PRHunkAlloc(progfuncs, len);
|
||||||
QC_decode(progfuncs, PRLittleLong(*(int *)pr_types), len, 2, (char *)(((int *)pr_types)+1), s);
|
QC_decode(progfuncs, PRLittleLong(*(int *)pr_types), len, 2, (char *)(((int *)pr_types)+1), s);
|
||||||
|
@ -2590,17 +2596,17 @@ retry:
|
||||||
fnc[i].s_name += stringadjust;
|
fnc[i].s_name += stringadjust;
|
||||||
fnc[i].s_file += stringadjust;
|
fnc[i].s_file += stringadjust;
|
||||||
}
|
}
|
||||||
|
|
||||||
//actual global values
|
//actual global values
|
||||||
#ifndef NOENDIAN
|
#ifndef NOENDIAN
|
||||||
for (i=0 ; i<pr_progs->numglobals ; i++)
|
for (i=0 ; i<pr_progs->numglobals ; i++)
|
||||||
((int *)glob)[i] = PRLittleLong (((int *)glob)[i]);
|
((int *)glob)[i] = PRLittleLong (((int *)glob)[i]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pr_types)
|
if (pr_types)
|
||||||
{
|
{
|
||||||
for (i=0 ; i<pr_progs->numtypes ; i++)
|
for (i=0 ; i<pr_progs->numtypes ; i++)
|
||||||
{
|
{
|
||||||
#ifndef NOENDIAN
|
#ifndef NOENDIAN
|
||||||
pr_types[i].type = PRLittleLong(current_progstate->types[i].type);
|
pr_types[i].type = PRLittleLong(current_progstate->types[i].type);
|
||||||
pr_types[i].next = PRLittleLong(current_progstate->types[i].next);
|
pr_types[i].next = PRLittleLong(current_progstate->types[i].next);
|
||||||
|
@ -2689,13 +2695,13 @@ retry:
|
||||||
QC_RegisterFieldVar(progfuncs, type, pr_fielddefs32[i].s_name+pr_strings, -1, -1);
|
QC_RegisterFieldVar(progfuncs, type, pr_fielddefs32[i].s_name+pr_strings, -1, -1);
|
||||||
}
|
}
|
||||||
pr_fielddefs32[i].s_name += stringadjust;
|
pr_fielddefs32[i].s_name += stringadjust;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Sys_Error("Bad int size");
|
Sys_Error("Bad int size");
|
||||||
}
|
}
|
||||||
|
|
||||||
//ifstring fixes arn't performed anymore.
|
//ifstring fixes arn't performed anymore.
|
||||||
//the following switch just fixes endian and hexen2 calling conventions (by using different opcodes).
|
//the following switch just fixes endian and hexen2 calling conventions (by using different opcodes).
|
||||||
switch(current_progstate->intsize)
|
switch(current_progstate->intsize)
|
||||||
{
|
{
|
||||||
|
@ -2724,7 +2730,7 @@ retry:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 24: //24 sucks. Guess why.
|
case 24: //24 sucks. Guess why.
|
||||||
for (i=0 ; i<pr_progs->numstatements ; i++)
|
for (i=0 ; i<pr_progs->numstatements ; i++)
|
||||||
{
|
{
|
||||||
|
@ -2911,7 +2917,7 @@ retry:
|
||||||
if (!progfuncs->stringtable)
|
if (!progfuncs->stringtable)
|
||||||
progfuncs->stringtable = pr_strings;
|
progfuncs->stringtable = pr_strings;
|
||||||
|
|
||||||
eval = PR_FindGlobal(progfuncs, "thisprogs", progstype);
|
eval = PR_FindGlobal(progfuncs, "thisprogs", progstype);
|
||||||
if (eval)
|
if (eval)
|
||||||
eval->prog = progstype;
|
eval->prog = progstype;
|
||||||
|
|
||||||
|
|
|
@ -130,8 +130,8 @@ typedef union eval_s
|
||||||
typedef struct edictrun_s
|
typedef struct edictrun_s
|
||||||
{
|
{
|
||||||
pbool isfree;
|
pbool isfree;
|
||||||
|
|
||||||
float freetime; // realtime when the object was freed
|
float freetime; // realtime when the object was freed
|
||||||
unsigned int entnum;
|
unsigned int entnum;
|
||||||
pbool readonly; //causes error when QC tries writing to it. (quake's world entity)
|
pbool readonly; //causes error when QC tries writing to it. (quake's world entity)
|
||||||
void *fields;
|
void *fields;
|
||||||
|
@ -169,7 +169,7 @@ typedef struct progstate_s
|
||||||
ddefXX_t *fielddefs;
|
ddefXX_t *fielddefs;
|
||||||
ddef16_t *fielddefs16;
|
ddef16_t *fielddefs16;
|
||||||
ddef32_t *fielddefs32;
|
ddef32_t *fielddefs32;
|
||||||
};
|
};
|
||||||
void *statements;
|
void *statements;
|
||||||
// void *global_struct;
|
// void *global_struct;
|
||||||
float *globals; // same as pr_global_struct
|
float *globals; // same as pr_global_struct
|
||||||
|
@ -198,7 +198,7 @@ typedef struct extensionbuiltin_s {
|
||||||
|
|
||||||
|
|
||||||
#define pr_progs current_progstate->progs
|
#define pr_progs current_progstate->progs
|
||||||
#define pr_functions current_progstate->functions
|
#define pr_functions current_progstate->functions
|
||||||
#define pr_strings current_progstate->strings
|
#define pr_strings current_progstate->strings
|
||||||
#define pr_globaldefs16 ((ddef16_t*)current_progstate->globaldefs)
|
#define pr_globaldefs16 ((ddef16_t*)current_progstate->globaldefs)
|
||||||
#define pr_globaldefs32 ((ddef32_t*)current_progstate->globaldefs)
|
#define pr_globaldefs32 ((ddef32_t*)current_progstate->globaldefs)
|
||||||
|
@ -426,7 +426,7 @@ ddef32_t *ED_FindTypeGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, prog
|
||||||
ddef16_t *ED_FindGlobalFromProgs16 (progfuncs_t *progfuncs, char *name, progsnum_t prnum);
|
ddef16_t *ED_FindGlobalFromProgs16 (progfuncs_t *progfuncs, char *name, progsnum_t prnum);
|
||||||
ddef32_t *ED_FindGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, progsnum_t prnum);
|
ddef32_t *ED_FindGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, progsnum_t prnum);
|
||||||
fdef_t *ED_FindField (progfuncs_t *progfuncs, char *name);
|
fdef_t *ED_FindField (progfuncs_t *progfuncs, char *name);
|
||||||
dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *pnum, unsigned int fromprogs);
|
dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *pnum, progsnum_t fromprogs);
|
||||||
func_t PR_FindFunc(progfuncs_t *progfncs, char *funcname, progsnum_t pnum);
|
func_t PR_FindFunc(progfuncs_t *progfncs, char *funcname, progsnum_t pnum);
|
||||||
void PR_Configure (progfuncs_t *progfncs, int addressable_size, int max_progs);
|
void PR_Configure (progfuncs_t *progfncs, int addressable_size, int max_progs);
|
||||||
int PR_InitEnts(progfuncs_t *progfncs, int maxents);
|
int PR_InitEnts(progfuncs_t *progfncs, int maxents);
|
||||||
|
|
Loading…
Reference in a new issue