mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-21 19:41:14 +00:00
Try to switch some types in preparation for potentially switching to 64bit types (so qc timer can use doubles for longer map uptime).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5718 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
ee55057f8d
commit
856cad09cc
30 changed files with 384 additions and 406 deletions
|
@ -184,7 +184,7 @@ static void bonemat_fromidentity(float *out)
|
|||
out[10] = 1;
|
||||
out[11] = 0;
|
||||
}
|
||||
static void bonemat_fromqcvectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
|
||||
static void bonemat_fromqcvectors(float *out, const pvec_t vx[3], const pvec_t vy[3], const pvec_t vz[3], const pvec_t t[3])
|
||||
{
|
||||
out[0] = vx[0];
|
||||
out[1] = -vy[0];
|
||||
|
@ -227,7 +227,7 @@ static void bonemat_fromentity(world_t *w, wedict_t *ed, float *trans)
|
|||
AngleVectors(a, d[0], d[1], d[2]);
|
||||
bonemat_fromqcvectors(trans, d[0], d[1], d[2], ed->v->origin);
|
||||
}
|
||||
static void bonemat_toqcvectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3])
|
||||
static void bonemat_toqcvectors(const float *in, pvec_t vx[3], pvec_t vy[3], pvec_t vz[3], pvec_t t[3])
|
||||
{
|
||||
vx[0] = in[0];
|
||||
vx[1] = in[4];
|
||||
|
@ -1680,7 +1680,7 @@ void QCBUILTIN PF_skel_ragedit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
doll_t *doll;
|
||||
float emat[12];
|
||||
|
||||
vec3_t d[3], a;
|
||||
pvec3_t d[3], a;
|
||||
//fixme: respond to renderflags&USEAXIS? scale?
|
||||
a[0] = wed->v->angles[0] * r_meshpitch.value; /*mod_alias bug*/
|
||||
a[1] = wed->v->angles[1];
|
||||
|
@ -2327,7 +2327,7 @@ void QCBUILTIN PF_skel_set_bone_world (pubprogfuncs_t *prinst, struct globalvars
|
|||
world_t *w = prinst->parms->user;
|
||||
wedict_t *ent = G_WEDICT(prinst, OFS_PARM0);
|
||||
unsigned int boneidx = G_FLOAT(OFS_PARM1)-1;
|
||||
float *matrix[3];
|
||||
pvec_t *matrix[3];
|
||||
skelobject_t *skelobj;
|
||||
float *bone;
|
||||
float childworld[12], parentinv[12];
|
||||
|
@ -2335,7 +2335,7 @@ void QCBUILTIN PF_skel_set_bone_world (pubprogfuncs_t *prinst, struct globalvars
|
|||
/*sort out the parameters*/
|
||||
if (prinst->callargc == 4)
|
||||
{
|
||||
vec3_t d[3], a;
|
||||
pvec3_t d[3], a;
|
||||
a[0] = G_VECTOR(OFS_PARM3)[0] * r_meshpitch.value; /*mod_alias bug*/
|
||||
a[1] = G_VECTOR(OFS_PARM3)[1];
|
||||
a[2] = G_VECTOR(OFS_PARM3)[2];
|
||||
|
|
|
@ -936,7 +936,7 @@ void MSG_WriteString (sizebuf_t *sb, const char *s)
|
|||
SZ_Write (sb, s, Q_strlen(s)+1);
|
||||
}
|
||||
|
||||
float MSG_FromCoord(coorddata c, int type)
|
||||
vec_t MSG_FromCoord(coorddata c, int type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#define VMUTF8 utf8_enable.ival
|
||||
#define VMUTF8MARKUP false
|
||||
|
||||
|
||||
static char *cvargroup_progs = "Progs variables";
|
||||
|
||||
cvar_t utf8_enable = CVARD("utf8_enable", "0", "When 1, changes the qc builtins to act upon codepoints instead of bytes. Do not use unless com_parseutf8 is also set.");
|
||||
|
@ -812,7 +811,7 @@ void QCBUILTIN PF_getsurfacetexture(pubprogfuncs_t *prinst, struct globalvars_s
|
|||
(n)[1] = ((a)[2] - (b)[2]) * ((c)[0] - (b)[0]) - ((a)[0] - (b)[0]) * ((c)[2] - (b)[2]), \
|
||||
(n)[2] = ((a)[0] - (b)[0]) * ((c)[1] - (b)[1]) - ((a)[1] - (b)[1]) * ((c)[0] - (b)[0]) \
|
||||
)
|
||||
static float getsurface_clippointpoly(model_t *model, msurface_t *surf, vec3_t point, vec3_t bestcpoint, float bestdist)
|
||||
static float getsurface_clippointpoly(model_t *model, msurface_t *surf, pvec3_t point, pvec3_t bestcpoint, float bestdist)
|
||||
{
|
||||
int e, edge;
|
||||
vec3_t edgedir, edgenormal, cpoint, temp;
|
||||
|
@ -861,7 +860,7 @@ static float getsurface_clippointpoly(model_t *model, msurface_t *surf, vec3_t p
|
|||
}
|
||||
return bestdist;
|
||||
}
|
||||
static float getsurface_clippointtri(model_t *model, msurface_t *surf, vec3_t point, vec3_t bestcpoint, float bestdist)
|
||||
static float getsurface_clippointtri(model_t *model, msurface_t *surf, pvec3_t point, pvec3_t bestcpoint, float bestdist)
|
||||
{
|
||||
int j;
|
||||
mesh_t *mesh = surf->mesh;
|
||||
|
@ -916,12 +915,12 @@ static float getsurface_clippointtri(model_t *model, msurface_t *surf, vec3_t po
|
|||
}
|
||||
return bestdist;
|
||||
}
|
||||
msurface_t *Mod_GetSurfaceNearPoint(model_t *model, vec3_t point)
|
||||
msurface_t *Mod_GetSurfaceNearPoint(model_t *model, pvec3_t point)
|
||||
{
|
||||
msurface_t *surf;
|
||||
int i;
|
||||
|
||||
vec3_t cpoint = {0,0,0};
|
||||
pvec3_t cpoint = {0,0,0};
|
||||
float bestdist = 0x7fffffff, dist;
|
||||
msurface_t *bestsurf = NULL;
|
||||
|
||||
|
@ -959,7 +958,7 @@ msurface_t *Mod_GetSurfaceNearPoint(model_t *model, vec3_t point)
|
|||
void QCBUILTIN PF_getsurfacenearpoint(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
wedict_t *ent = G_WEDICT(prinst, OFS_PARM0);
|
||||
float *point = G_VECTOR(OFS_PARM1);
|
||||
pvec_t *point = G_VECTOR(OFS_PARM1);
|
||||
|
||||
world_t *w = prinst->parms->user;
|
||||
model_t *model = w->Get_CModel(w, ent->v->modelindex);
|
||||
|
@ -984,7 +983,7 @@ void QCBUILTIN PF_getsurfaceclippedpoint(pubprogfuncs_t *prinst, struct globalva
|
|||
unsigned int surfnum;
|
||||
|
||||
world_t *w = prinst->parms->user;
|
||||
float *result = G_VECTOR(OFS_RETURN);
|
||||
pvec_t *result = G_VECTOR(OFS_RETURN);
|
||||
|
||||
ent = G_WEDICT(prinst, OFS_PARM0);
|
||||
surfnum = G_FLOAT(OFS_PARM1);
|
||||
|
@ -1145,7 +1144,7 @@ void QCBUILTIN PF_checkpvs(pubprogfuncs_t *prinst, struct globalvars_s *pr_globa
|
|||
{
|
||||
world_t *world = prinst->parms->user;
|
||||
model_t *worldmodel = world->worldmodel;
|
||||
float *viewpos = G_VECTOR(OFS_PARM0);
|
||||
VM_VECTORARG(viewpos, OFS_PARM0);
|
||||
wedict_t *ent = G_WEDICT(prinst, OFS_PARM1);
|
||||
int cluster;
|
||||
int qcpvsarea[2];
|
||||
|
@ -1227,7 +1226,7 @@ void QCBUILTIN PF_touchtriggers(pubprogfuncs_t *prinst, struct globalvars_s *pr_
|
|||
//Finding
|
||||
|
||||
//entity(string field, float match) findchainflags = #450
|
||||
//chained search for float, int, and entity reference fields
|
||||
//chained search for float reference fields
|
||||
void QCBUILTIN PF_findchainflags (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
int i, ff, cf;
|
||||
|
@ -1241,17 +1240,17 @@ void QCBUILTIN PF_findchainflags (pubprogfuncs_t *prinst, struct globalvars_s *p
|
|||
if (prinst->callargc > 2)
|
||||
cf = G_INT(OFS_PARM2)+prinst->fieldadjust;
|
||||
else
|
||||
cf = &((comentvars_t*)NULL)->chain - (int*)NULL;
|
||||
cf = &((comentvars_t*)NULL)->chain - (pint_t*)NULL;
|
||||
|
||||
for (i = 1; i < *prinst->parms->num_edicts; i++)
|
||||
{
|
||||
ent = WEDICT_NUM_PB(prinst, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
if (!((int)((float *)ent->v)[ff] & s))
|
||||
if (!((int)((pvec_t *)ent->v)[ff] & s))
|
||||
continue;
|
||||
|
||||
((int*)ent->v)[cf] = EDICT_TO_PROG(prinst, chain);
|
||||
((pint_t*)ent->v)[cf] = EDICT_TO_PROG(prinst, chain);
|
||||
chain = ent;
|
||||
}
|
||||
|
||||
|
@ -1259,6 +1258,7 @@ void QCBUILTIN PF_findchainflags (pubprogfuncs_t *prinst, struct globalvars_s *p
|
|||
}
|
||||
|
||||
//entity(string field, float match) findchainfloat = #403
|
||||
//chained search for float, int, and entity reference fields
|
||||
void QCBUILTIN PF_findchainfloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
int i, ff, cf;
|
||||
|
@ -1272,17 +1272,17 @@ void QCBUILTIN PF_findchainfloat (pubprogfuncs_t *prinst, struct globalvars_s *p
|
|||
if (prinst->callargc > 2)
|
||||
cf = G_INT(OFS_PARM2)+prinst->fieldadjust;
|
||||
else
|
||||
cf = &((comentvars_t*)NULL)->chain - (int*)NULL;
|
||||
cf = &((comentvars_t*)NULL)->chain - (pint_t*)NULL;
|
||||
|
||||
for (i = 1; i < *prinst->parms->num_edicts; i++)
|
||||
{
|
||||
ent = WEDICT_NUM_PB(prinst, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
if (((float *)ent->v)[ff] != s)
|
||||
if (((pvec_t *)ent->v)[ff] != s)
|
||||
continue;
|
||||
|
||||
((int*)ent->v)[cf] = EDICT_TO_PROG(prinst, chain);
|
||||
((pint_t*)ent->v)[cf] = EDICT_TO_PROG(prinst, chain);
|
||||
chain = ent;
|
||||
}
|
||||
|
||||
|
@ -3330,8 +3330,8 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
extern cvar_t dpcompat_findradiusarealinks;
|
||||
wedict_t *ent, *chain;
|
||||
float rad;
|
||||
float *org;
|
||||
vec3_t eorg;
|
||||
pvec_t *org;
|
||||
pvec3_t eorg;
|
||||
int i, j;
|
||||
int f;
|
||||
|
||||
|
@ -3343,14 +3343,13 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
if (prinst->callargc > 2)
|
||||
f = G_INT(OFS_PARM2)+prinst->fieldadjust;
|
||||
else
|
||||
f = &((comentvars_t*)NULL)->chain - (int*)NULL;
|
||||
f = &((comentvars_t*)NULL)->chain - (pint_t*)NULL;
|
||||
|
||||
if (dpcompat_findradiusarealinks.ival)
|
||||
{
|
||||
static wedict_t *nearent[32768];
|
||||
vec3_t mins, maxs;
|
||||
int numents;
|
||||
extern int World_AreaEdicts (world_t *w, vec3_t mins, vec3_t maxs, wedict_t **list, int maxcount, int areatype);
|
||||
|
||||
mins[0] = org[0] - rad;
|
||||
mins[1] = org[1] - rad;
|
||||
|
@ -3364,7 +3363,7 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
for (i=0 ; i<numents ; i++)
|
||||
{
|
||||
ent = nearent[i];
|
||||
if (ent->v->solid == SOLID_NOT && (!((int)ent->v->flags & FL_FINDABLE_NONSOLID)) && !sv_gameplayfix_blowupfallenzombies.ival)
|
||||
if (ent->v->solid == SOLID_NOT && (!((pint_t)ent->v->flags & FL_FINDABLE_NONSOLID)) && !sv_gameplayfix_blowupfallenzombies.ival)
|
||||
continue;
|
||||
if (sv_gameplayfix_findradiusdistancetobox.ival)
|
||||
{
|
||||
|
@ -3382,7 +3381,7 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
if (DotProduct(eorg,eorg) > rad)
|
||||
continue;
|
||||
|
||||
((int*)ent->v)[f] = EDICT_TO_PROG(prinst, chain);
|
||||
((pint_t*)ent->v)[f] = EDICT_TO_PROG(prinst, chain);
|
||||
chain = ent;
|
||||
}
|
||||
}
|
||||
|
@ -3394,7 +3393,7 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
ent = WEDICT_NUM_PB(prinst, i);
|
||||
if (ED_ISFREE(ent))
|
||||
continue;
|
||||
if (ent->v->solid == SOLID_NOT && (!((int)ent->v->flags & FL_FINDABLE_NONSOLID)) && !sv_gameplayfix_blowupfallenzombies.value)
|
||||
if (ent->v->solid == SOLID_NOT && (!((pint_t)ent->v->flags & FL_FINDABLE_NONSOLID)) && !sv_gameplayfix_blowupfallenzombies.value)
|
||||
continue;
|
||||
if (sv_gameplayfix_findradiusdistancetobox.ival)
|
||||
{
|
||||
|
@ -3412,7 +3411,7 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
if (DotProduct(eorg,eorg) > rad)
|
||||
continue;
|
||||
|
||||
((int*)ent->v)[f] = EDICT_TO_PROG(prinst, chain);
|
||||
((pint_t*)ent->v)[f] = EDICT_TO_PROG(prinst, chain);
|
||||
chain = ent;
|
||||
}
|
||||
}
|
||||
|
@ -5754,7 +5753,9 @@ void QCBUILTIN PF_vectorvectors (pubprogfuncs_t *prinst, struct globalvars_s *pr
|
|||
|
||||
void QCBUILTIN PF_crossproduct (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
CrossProduct(G_VECTOR(OFS_PARM0), G_VECTOR(OFS_PARM1), G_VECTOR(OFS_RETURN));
|
||||
VM_VECTORARG(v0, OFS_PARM0);
|
||||
VM_VECTORARG(v1, OFS_PARM1);
|
||||
CrossProduct(v0, v1, G_VECTOR(OFS_RETURN));
|
||||
}
|
||||
|
||||
//Maths functions
|
||||
|
@ -5809,7 +5810,7 @@ void QCBUILTIN PF_droptofloor (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
vec3_t end;
|
||||
vec3_t start;
|
||||
trace_t trace;
|
||||
const float *gravitydir;
|
||||
const pvec_t *gravitydir;
|
||||
|
||||
ent = PROG_TO_WEDICT(prinst, *world->g.self);
|
||||
|
||||
|
@ -6753,7 +6754,7 @@ void QCBUILTIN PF_getentityfieldstring (pubprogfuncs_t *prinst, struct globalvar
|
|||
#if !defined(CLIENTONLY) && defined(HAVE_LEGACY)
|
||||
qboolean isserver = (prinst == sv.world.progs);
|
||||
#endif
|
||||
eval = (eval_t *)&((float *)ent->v)[fdef[fidx].ofs];
|
||||
eval = (eval_t *)&((pvec_t *)ent->v)[fdef[fidx].ofs];
|
||||
#ifdef HAVE_LEGACY //extra code to be lazy so that xonotic doesn't go crazy and spam the fuck out of e
|
||||
if ((fdef->type & 0xff) == ev_vector)
|
||||
{
|
||||
|
@ -6762,17 +6763,17 @@ void QCBUILTIN PF_getentityfieldstring (pubprogfuncs_t *prinst, struct globalvar
|
|||
}
|
||||
#ifndef CLIENTONLY
|
||||
#ifdef HEXEN2
|
||||
else if (isserver && (float*)eval == &((edict_t*)ent)->xv->drawflags && eval->_float == 96)
|
||||
else if (isserver && (pvec_t*)eval == &((edict_t*)ent)->xv->drawflags && eval->_float == 96)
|
||||
return;
|
||||
#endif
|
||||
else if (isserver && (float*)eval == &((edict_t*)ent)->xv->uniquespawnid)
|
||||
else if (isserver && (pvec_t*)eval == &((edict_t*)ent)->xv->uniquespawnid)
|
||||
return;
|
||||
#endif
|
||||
else if (((float*)eval == &ent->xv->dimension_solid ||
|
||||
(float*)eval == &ent->xv->dimension_hit
|
||||
else if (((pvec_t*)eval == &ent->xv->dimension_solid ||
|
||||
(pvec_t*)eval == &ent->xv->dimension_hit
|
||||
#ifndef CLIENTONLY
|
||||
|| (isserver && ((float*)eval == &((edict_t*)ent)->xv->dimension_see
|
||||
|| (float*)eval == &((edict_t*)ent)->xv->dimension_seen))
|
||||
|| (isserver && ((pvec_t*)eval == &((edict_t*)ent)->xv->dimension_see
|
||||
|| (pvec_t*)eval == &((edict_t*)ent)->xv->dimension_seen))
|
||||
#endif
|
||||
) && eval->_float == 255)
|
||||
return;
|
||||
|
|
|
@ -65,6 +65,12 @@ void PF_InitTempStrings(pubprogfuncs_t *prinst);
|
|||
string_t PR_TempString(pubprogfuncs_t *prinst, const char *str); //returns a tempstring containing str
|
||||
char *PF_TempStr(pubprogfuncs_t *prinst); //returns a tempstring which can be filled in with whatever junk you want.
|
||||
|
||||
#ifdef QCVM_64
|
||||
#define VM_VECTORARG(name, ofs) vec3_t name = {G_FLOAT(ofs+0),G_FLOAT(ofs+1),G_FLOAT(ofs+2)}
|
||||
#else
|
||||
#define VM_VECTORARG(name, ofs) pvec_t *name = G_VECTOR(ofs)
|
||||
#endif
|
||||
|
||||
#define RETURN_SSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it.
|
||||
#define RETURN_TSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_TempString(prinst, s)) //temp (static but cycle buffers)
|
||||
extern cvar_t pr_tempstringsize;
|
||||
|
|
|
@ -244,21 +244,21 @@ struct world_s
|
|||
|
||||
/*qc globals*/
|
||||
struct {
|
||||
int *self;
|
||||
int *other;
|
||||
int *newmis;
|
||||
float *time;
|
||||
float *frametime;
|
||||
float *force_retouch;
|
||||
float *physics_mode;
|
||||
float *v_forward;
|
||||
float *v_right;
|
||||
float *v_up;
|
||||
float *defaultgravitydir;
|
||||
pint_t *self;
|
||||
pint_t *other;
|
||||
pint_t *newmis;
|
||||
pvec_t *time;
|
||||
pvec_t *frametime;
|
||||
pvec_t *force_retouch;
|
||||
pvec_t *physics_mode;
|
||||
pvec_t *v_forward;
|
||||
pvec_t *v_right;
|
||||
pvec_t *v_up;
|
||||
pvec_t *defaultgravitydir;
|
||||
|
||||
//used by menu+csqc.
|
||||
float *drawfont;
|
||||
float *drawfontscale;
|
||||
pvec_t *drawfont;
|
||||
pvec_t *drawfontscale;
|
||||
} g;
|
||||
|
||||
#ifdef USERBE
|
||||
|
|
|
@ -1178,7 +1178,7 @@ void DecompileCalcProfiles(void)
|
|||
}
|
||||
strcat(fname, ") ");
|
||||
line[0] = '\0';
|
||||
QC_snprintfz(line, sizeof(line), strings + functions[i].s_name);
|
||||
QC_snprintfz(line, sizeof(line), "%s", strings + functions[i].s_name);
|
||||
strcat(fname, line);
|
||||
|
||||
}
|
||||
|
@ -3090,7 +3090,7 @@ pbool TrySynthName(const char *first)
|
|||
{
|
||||
if (!strcmp(filenames[i], first))
|
||||
{
|
||||
QC_snprintfz(synth_name, sizeof(synth_name), filenames[i + 1]);
|
||||
QC_snprintfz(synth_name, sizeof(synth_name), "%s", filenames[i + 1]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3131,7 +3131,7 @@ void DecompileDecompileFunctions(const char *origcopyright)
|
|||
if (lastglob != 1)
|
||||
{
|
||||
QC_snprintfz(synth_name, sizeof(synth_name), "sysdefs.qc");
|
||||
QC_snprintfz(fname, sizeof(fname), synth_name);
|
||||
QC_snprintfz(fname, sizeof(fname), "%s", synth_name);
|
||||
if (!DecompileAlreadySeen(fname, &f))
|
||||
{
|
||||
printf("decompiling %s\n", fname);
|
||||
|
@ -3190,7 +3190,7 @@ void DecompileDecompileFunctions(const char *origcopyright)
|
|||
if(!TrySynthName(qcva("%s", strings + d->s_name)) && !synth_name[0])
|
||||
QC_snprintfz(synth_name, sizeof(synth_name), "frik%i.qc", fake_name++);
|
||||
|
||||
QC_snprintfz(fname, sizeof(fname), synth_name);
|
||||
QC_snprintfz(fname, sizeof(fname), "%s", synth_name);
|
||||
}
|
||||
else
|
||||
synth_name[0] = 0;
|
||||
|
|
|
@ -402,9 +402,9 @@ reeval:
|
|||
break;
|
||||
case OP_STOREP_V:
|
||||
i = OPB->_int + (OPC->_int*sizeof(ptr->_int));
|
||||
errorif (QCPOINTERWRITEFAIL(i, sizeof(vec3_t)))
|
||||
errorif (QCPOINTERWRITEFAIL(i, sizeof(pvec3_t)))
|
||||
{
|
||||
if (!(ptr=PR_GetWriteTempStringPtr(progfuncs, OPB->_int, OPC->_int*sizeof(ptr->_int), sizeof(vec3_t))))
|
||||
if (!(ptr=PR_GetWriteTempStringPtr(progfuncs, OPB->_int, OPC->_int*sizeof(ptr->_int), sizeof(pvec3_t))))
|
||||
{
|
||||
if (i == -1)
|
||||
break;
|
||||
|
@ -1010,9 +1010,9 @@ reeval:
|
|||
|
||||
case OP_LOADP_V:
|
||||
i = OPA->_int + OPB->_int*4; //NOTE: inconsistant, but a bit more practical for the qcc when structs etc are involved
|
||||
errorif (QCPOINTERREADFAIL(i, sizeof(vec3_t)))
|
||||
errorif (QCPOINTERREADFAIL(i, sizeof(pvec3_t)))
|
||||
{
|
||||
if (!(ptr=PR_GetReadTempStringPtr(progfuncs, OPA->_int, OPB->_int*4, sizeof(vec3_t))))
|
||||
if (!(ptr=PR_GetReadTempStringPtr(progfuncs, OPA->_int, OPB->_int*4, sizeof(pvec3_t))))
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
|
|
|
@ -609,7 +609,7 @@ static struct entvars_s *PDECL PR_entvars (pubprogfuncs_t *ppf, struct edict_s *
|
|||
return (struct entvars_s *)edvars(ed);
|
||||
}
|
||||
|
||||
static pbool PDECL PR_GetFunctionInfo(pubprogfuncs_t *ppf, func_t func, int *args, qbyte **argsizes, int *builtinnum, char *funcname, size_t funcnamesize)
|
||||
static pbool PDECL PR_GetFunctionInfo(pubprogfuncs_t *ppf, func_t func, int *args, pbyte **argsizes, int *builtinnum, char *funcname, size_t funcnamesize)
|
||||
{
|
||||
progfuncs_t *progfuncs = (progfuncs_t*)ppf;
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ const char *ASMCALL PR_StringToNative (pubprogfuncs_t *ppf, string_t str)
|
|||
|
||||
eval_t *PR_GetReadTempStringPtr(progfuncs_t *progfuncs, string_t str, size_t offset, size_t datasize)
|
||||
{
|
||||
static vec3_t dummy; //don't resize anything when reading.
|
||||
static pvec3_t dummy; //don't resize anything when reading.
|
||||
if (((unsigned int)str & STRING_SPECMASK) == STRING_TEMP)
|
||||
{
|
||||
unsigned int i = str & ~STRING_SPECMASK;
|
||||
|
|
|
@ -6,6 +6,7 @@ Setting them should be fine.
|
|||
*/
|
||||
#ifndef __PR_COMP_H__
|
||||
#define __PR_COMP_H__
|
||||
#include "progtype.h"
|
||||
|
||||
/*
|
||||
#ifdef USE_MSVCRT_DEBUG
|
||||
|
@ -559,7 +560,7 @@ typedef struct
|
|||
string_t s_file; // source file defined in
|
||||
|
||||
int numparms;
|
||||
qbyte parm_size[MAX_PARMS];
|
||||
pbyte parm_size[MAX_PARMS];
|
||||
} dfunction_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -576,7 +577,7 @@ typedef struct
|
|||
string_t s_file; // source file defined in
|
||||
|
||||
int numparms;
|
||||
qbyte parm_size[MAX_PARMS];
|
||||
pbyte parm_size[MAX_PARMS];
|
||||
} mfunction_t;
|
||||
|
||||
#define PROG_QTESTVERSION 3
|
||||
|
|
|
@ -496,7 +496,7 @@ mfunction_t *ED_FindFunction (progfuncs_t *progfuncs, const char *name, progsnum
|
|||
|
||||
if ((unsigned)pnum > (unsigned)prinst.maxprogs)
|
||||
{
|
||||
externs->Printf("Progsnum %i out of bounds\n", pnum);
|
||||
externs->Printf("Progsnum %"pPRIi" out of bounds\n", pnum);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -592,15 +592,15 @@ char *PR_ValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val, pbool v
|
|||
else
|
||||
{
|
||||
if ((val->function & 0xff000000)>>24 >= prinst.maxprogs || !pr_progstate[(val->function & 0xff000000)>>24].functions)
|
||||
QC_snprintfz (line, sizeof(line), "Bad function %i:%i", (val->function & 0xff000000)>>24, val->function & ~0xff000000);
|
||||
QC_snprintfz (line, sizeof(line), "Bad function %"pPRIi":%"pPRIi"", (val->function & 0xff000000)>>24, val->function & ~0xff000000);
|
||||
else
|
||||
{
|
||||
if ((val->function &~0xff000000) >= pr_progs->numfunctions)
|
||||
QC_snprintfz (line, sizeof(line), "bad function %i:%i\n", (val->function & 0xff000000)>>24, val->function & ~0xff000000);
|
||||
QC_snprintfz (line, sizeof(line), "bad function %"pPRIi":%"pPRIi"\n", (val->function & 0xff000000)>>24, val->function & ~0xff000000);
|
||||
else
|
||||
{
|
||||
f = pr_progstate[(val->function & 0xff000000)>>24].functions + (val->function & ~0xff000000);
|
||||
QC_snprintfz (line, sizeof(line), "%i:%s()", (val->function & 0xff000000)>>24, f->s_name+progfuncs->funcs.stringtable);
|
||||
QC_snprintfz (line, sizeof(line), "%"pPRIi":%s()", (val->function & 0xff000000)>>24, f->s_name+progfuncs->funcs.stringtable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ char *PDECL PR_UglyValueString (pubprogfuncs_t *ppf, etype_t type, eval_t *val)
|
|||
case ev_function:
|
||||
i = (val->function & 0xff000000)>>24; //progs number
|
||||
if ((unsigned)i >= prinst.maxprogs || !pr_progstate[(unsigned)i].progs)
|
||||
sprintf (line, "BAD FUNCTION INDEX: %i", val->function);
|
||||
sprintf (line, "BAD FUNCTION INDEX: %#"pPRIx"", val->function);
|
||||
else
|
||||
{
|
||||
j = (val->function & ~0xff000000); //function number
|
||||
|
@ -1178,6 +1178,7 @@ pbool PDECL ED_ParseEval (pubprogfuncs_t *ppf, eval_t *eval, int type, const cha
|
|||
{
|
||||
progfuncs_t *progfuncs = (progfuncs_t*)ppf;
|
||||
int i;
|
||||
progsnum_t module;
|
||||
char string[128];
|
||||
fdef_t *def;
|
||||
char *v, *w;
|
||||
|
@ -1248,13 +1249,13 @@ pbool PDECL ED_ParseEval (pubprogfuncs_t *ppf, eval_t *eval, int type, const cha
|
|||
eval->function = 0;
|
||||
return true;
|
||||
}
|
||||
func = ED_FindFunction (progfuncs, s, &i, -1);
|
||||
func = ED_FindFunction (progfuncs, s, &module, -1);
|
||||
if (!func)
|
||||
{
|
||||
externs->Printf ("Can't find function %s\n", s);
|
||||
return false;
|
||||
}
|
||||
eval->function = (func - pr_progstate[i].functions) | (i<<24);
|
||||
eval->function = (func - pr_progstate[module].functions) | (module<<24);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1266,6 +1267,7 @@ pbool PDECL ED_ParseEval (pubprogfuncs_t *ppf, eval_t *eval, int type, const cha
|
|||
pbool ED_ParseEpair (progfuncs_t *progfuncs, size_t qcptr, unsigned int fldofs, int fldtype, char *s)
|
||||
{
|
||||
int i;
|
||||
progsnum_t module;
|
||||
fdef_t *def;
|
||||
string_t st;
|
||||
mfunction_t *func;
|
||||
|
@ -1337,13 +1339,13 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, size_t qcptr, unsigned int fldofs,
|
|||
*(func_t *)(progfuncs->funcs.stringtable + qcptr) = 0;
|
||||
return true;
|
||||
}
|
||||
func = ED_FindFunction (progfuncs, s, &i, -1);
|
||||
func = ED_FindFunction (progfuncs, s, &module, -1);
|
||||
if (!func)
|
||||
{
|
||||
externs->Printf ("Can't find function %s\n", s);
|
||||
return false;
|
||||
}
|
||||
*(func_t *)(progfuncs->funcs.stringtable + qcptr) = (func - pr_progstate[i].functions) | (i<<24);
|
||||
*(func_t *)(progfuncs->funcs.stringtable + qcptr) = (func - pr_progstate[module].functions) | (module<<24);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2605,7 +2607,7 @@ unsigned char *PDECL PR_GetHeapBuffer (void *ctx, size_t bufsize)
|
|||
PR_LoadProgs
|
||||
===============
|
||||
*/
|
||||
int PR_ReallyLoadProgs (progfuncs_t *progfuncs, const char *filename, progstate_t *progstate, pbool complain)
|
||||
pbool PR_ReallyLoadProgs (progfuncs_t *progfuncs, const char *filename, progstate_t *progstate, pbool complain)
|
||||
{
|
||||
unsigned int i, j, type;
|
||||
// float fl;
|
||||
|
@ -2777,13 +2779,13 @@ retry:
|
|||
return false;
|
||||
}
|
||||
|
||||
fnc = (dfunction_t *)((qbyte *)pr_progs + pr_progs->ofs_functions);
|
||||
fnc = (dfunction_t *)((pbyte *)pr_progs + pr_progs->ofs_functions);
|
||||
pr_strings = ((char *)pr_progs + pr_progs->ofs_strings);
|
||||
current_progstate->globaldefs = *(void**)&gd16 = (void *)((qbyte *)pr_progs + pr_progs->ofs_globaldefs);
|
||||
current_progstate->fielddefs = *(void**)&fld16 = (void *)((qbyte *)pr_progs + pr_progs->ofs_fielddefs);
|
||||
current_progstate->statements = (void *)((qbyte *)pr_progs + pr_progs->ofs_statements);
|
||||
current_progstate->globaldefs = *(void**)&gd16 = (void *)((pbyte *)pr_progs + pr_progs->ofs_globaldefs);
|
||||
current_progstate->fielddefs = *(void**)&fld16 = (void *)((pbyte *)pr_progs + pr_progs->ofs_fielddefs);
|
||||
current_progstate->statements = (void *)((pbyte *)pr_progs + pr_progs->ofs_statements);
|
||||
|
||||
glob = pr_globals = (void *)((qbyte *)pr_progs + pr_progs->ofs_globals);
|
||||
glob = pr_globals = (void *)((pbyte *)pr_progs + pr_progs->ofs_globals);
|
||||
current_progstate->globals_bytes = pr_progs->numglobals*sizeof(*pr_globals);
|
||||
|
||||
pr_linenums=NULL;
|
||||
|
@ -2791,9 +2793,9 @@ retry:
|
|||
if (pr_progs->version == PROG_EXTENDEDVERSION)
|
||||
{
|
||||
if (pr_progs->ofslinenums)
|
||||
pr_linenums = (int *)((qbyte *)pr_progs + pr_progs->ofslinenums);
|
||||
pr_linenums = (int *)((pbyte *)pr_progs + pr_progs->ofslinenums);
|
||||
if (pr_progs->ofs_types)
|
||||
pr_types = (typeinfo_t *)((qbyte *)pr_progs + pr_progs->ofs_types);
|
||||
pr_types = (typeinfo_t *)((pbyte *)pr_progs + pr_progs->ofs_types);
|
||||
|
||||
//start decompressing stuff...
|
||||
if (pr_progs->blockscompressed & 1) //statements
|
||||
|
@ -2940,8 +2942,8 @@ retry:
|
|||
|
||||
pr_cp_functions = NULL;
|
||||
// pr_strings = ((char *)pr_progs + pr_progs->ofs_strings);
|
||||
gd16 = *(ddef16_t**)¤t_progstate->globaldefs = (ddef16_t *)((qbyte *)pr_progs + pr_progs->ofs_globaldefs);
|
||||
fld16 = (ddef16_t *)((qbyte *)pr_progs + pr_progs->ofs_fielddefs);
|
||||
gd16 = *(ddef16_t**)¤t_progstate->globaldefs = (ddef16_t *)((pbyte *)pr_progs + pr_progs->ofs_globaldefs);
|
||||
fld16 = (ddef16_t *)((pbyte *)pr_progs + pr_progs->ofs_fielddefs);
|
||||
// pr_statements16 = (dstatement16_t *)((qbyte *)pr_progs + pr_progs->ofs_statements);
|
||||
pr_globals = glob;
|
||||
st16 = pr_statements16;
|
||||
|
|
|
@ -1038,8 +1038,8 @@ char *PDECL PR_EvaluateDebugString(pubprogfuncs_t *ppf, const char *key)
|
|||
case ev_function:
|
||||
{
|
||||
mfunction_t *func;
|
||||
int i;
|
||||
int progsnum = -1;
|
||||
progsnum_t i;
|
||||
progsnum_t progsnum = -1;
|
||||
if (str[0] && str[1] == ':')
|
||||
{
|
||||
progsnum = atoi(str);
|
||||
|
@ -1813,7 +1813,7 @@ void PDECL PR_ExecuteProgram (pubprogfuncs_t *ppf, func_t fnum)
|
|||
{
|
||||
if (newprogs >= prinst.maxprogs || !pr_progstate[newprogs].globals) //can happen with hexen2...
|
||||
{
|
||||
externs->Printf("PR_ExecuteProgram: tried branching into invalid progs (%#x)\n", fnum);
|
||||
externs->Printf("PR_ExecuteProgram: tried branching into invalid progs (%#"pPRIx")\n", fnum);
|
||||
return;
|
||||
}
|
||||
PR_SwitchProgsParms(progfuncs, newprogs);
|
||||
|
|
|
@ -27,7 +27,7 @@ pbool PR_SwitchProgs(progfuncs_t *progfuncs, progsnum_t type)
|
|||
current_progstate = NULL;
|
||||
return true;
|
||||
}
|
||||
PR_RunError(&progfuncs->funcs, "QCLIB: Bad prog type - %i", type);
|
||||
PR_RunError(&progfuncs->funcs, "QCLIB: Bad prog type - %"pPRIi, type);
|
||||
// Sys_Error("Bad prog type - %i", type);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ pbool PR_SwitchProgsParms(progfuncs_t *progfuncs, progsnum_t newpr) //from 2 to
|
|||
unsigned int a;
|
||||
progstate_t *np;
|
||||
progstate_t *op;
|
||||
int oldpr = prinst.pr_typecurrent;
|
||||
progsnum_t oldpr = prinst.pr_typecurrent;
|
||||
|
||||
if (newpr == oldpr)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ pbool PR_SwitchProgsParms(progfuncs_t *progfuncs, progsnum_t newpr) //from 2 to
|
|||
|
||||
if ((unsigned)newpr >= prinst.maxprogs || !np->globals)
|
||||
{
|
||||
externs->Printf("QCLIB: Bad prog type - %i", newpr);
|
||||
externs->Printf("QCLIB: Bad prog type - %"pPRIi, newpr);
|
||||
return false;
|
||||
}
|
||||
if ((unsigned)oldpr >= prinst.maxprogs || !op->globals) //startup?
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#endif
|
||||
//#define _inline inline
|
||||
#endif
|
||||
typedef unsigned char qbyte;
|
||||
typedef unsigned char pbyte;
|
||||
#include <stdio.h>
|
||||
|
||||
#define DLL_PROG
|
||||
|
@ -215,10 +215,11 @@ typedef struct
|
|||
//ASSIGNS_IC
|
||||
} QCC_opcode_t;
|
||||
extern QCC_opcode_t pr_opcodes[]; // sized by initialization
|
||||
#define OPF_STD 0x1 //reads a+b, writes c.
|
||||
#define OPF_STORE 0x2 //b+=a or just b=a
|
||||
#define OPF_STOREPTR 0x4 //the form of c=(*b+=a)
|
||||
#define OPF_LOADPTR 0x8
|
||||
#define OPF_VALID 0x01 //we're allowed to use this opcode in the current target.
|
||||
#define OPF_STD 0x10 //reads a+b, writes c.
|
||||
#define OPF_STORE 0x20 //b+=a or just b=a
|
||||
#define OPF_STOREPTR 0x40 //the form of c=(*b+=a)
|
||||
#define OPF_LOADPTR 0x80
|
||||
//FIXME: add jumps
|
||||
|
||||
|
||||
|
@ -394,8 +395,8 @@ void PR_Init (void);
|
|||
pbool PR_RunWarning (pubprogfuncs_t *progfuncs, char *error, ...);
|
||||
|
||||
void PDECL PR_ExecuteProgram (pubprogfuncs_t *progfuncs, func_t fnum);
|
||||
int PDECL PR_LoadProgs(pubprogfuncs_t *progfncs, const char *s);
|
||||
int PR_ReallyLoadProgs (progfuncs_t *progfuncs, const char *filename, progstate_t *progstate, pbool complain);
|
||||
progsnum_t PDECL PR_LoadProgs(pubprogfuncs_t *progfncs, const char *s);
|
||||
pbool PR_ReallyLoadProgs (progfuncs_t *progfuncs, const char *filename, progstate_t *progstate, pbool complain);
|
||||
|
||||
void *PRHunkAlloc(progfuncs_t *progfuncs, int ammount, const char *name);
|
||||
|
||||
|
@ -503,7 +504,7 @@ prclocks_t Sys_GetClockRate(void);
|
|||
|
||||
//pr_multi.c
|
||||
|
||||
extern vec3_t vec3_origin;
|
||||
extern pvec3_t pvec3_origin;
|
||||
|
||||
struct qcthread_s *PDECL PR_ForkStack (pubprogfuncs_t *progfuncs);
|
||||
void PDECL PR_ResumeThread (pubprogfuncs_t *progfuncs, struct qcthread_s *thread);
|
||||
|
|
|
@ -327,18 +327,18 @@ typedef union eval_s
|
|||
#define PR_SetString(pf, s) (*pf->StringToProgs) (pf, s)
|
||||
|
||||
#define NEXT_EDICT(pf,o) EDICT_NUM(pf, NUM_FOR_EDICT(pf, o)+1)
|
||||
#define RETURN_EDICT(pf, e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(pf, e))
|
||||
#define RETURN_EDICT(pf, e) (((pint_t *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(pf, e))
|
||||
|
||||
|
||||
//builtin funcs (which operate on globals)
|
||||
//To use these outside of builtins, you will likly have to use the 'globals' method.
|
||||
#define G_FLOAT(o) (((float *)pr_globals)[o])
|
||||
#define G_FLOAT2(o) (((float *)pr_globals)[OFS_PARM0 + o*3])
|
||||
#define G_INT(o) (((int *)pr_globals)[o])
|
||||
#define G_FLOAT(o) (((pvec_t *)pr_globals)[o])
|
||||
#define G_FLOAT2(o) (((pvec_t *)pr_globals)[OFS_PARM0 + o*3])
|
||||
#define G_INT(o) (((pint_t *)pr_globals)[o])
|
||||
#define G_EDICT(pf, o) PROG_TO_EDICT(pf, G_INT(o)) //((edict_t *)((char *) sv.edicts+ *(int *)&((float *)pr_globals)[o]))
|
||||
#define G_EDICTNUM(pf, o) NUM_FOR_EDICT(pf, G_EDICT(pf, o))
|
||||
#define G_VECTOR(o) (&((float *)pr_globals)[o])
|
||||
#define G_FUNCTION(o) (*(func_t *)&((float *)pr_globals)[o])
|
||||
#define G_VECTOR(o) (&((pvec_t *)pr_globals)[o])
|
||||
#define G_FUNCTION(o) (*(func_t *)&((pvec_t *)pr_globals)[o])
|
||||
|
||||
/*
|
||||
#define PR_GetString(p,s) (s?s + p->stringtable:"")
|
||||
|
@ -356,7 +356,7 @@ typedef union eval_s
|
|||
|
||||
#define ev_prog ev_integer
|
||||
|
||||
#define E_STRING(o) (char *)(((int *)((char *)ed) + progparms.edictsize)[o])
|
||||
#define E_STRING(o) (char *)(((pint_t *)((char *)ed) + progparms.edictsize)[o])
|
||||
|
||||
//#define pr_global_struct pr_globals
|
||||
|
||||
|
|
|
@ -1,23 +1,42 @@
|
|||
#ifndef QCLIB_PROGTYPE_H
|
||||
#define QCLIB_PROGTYPE_H
|
||||
|
||||
#ifndef DLL_PROG
|
||||
#if 0
|
||||
//64bit primitives allows for:
|
||||
// greater precision timers (so maps can last longer without getting restarted)
|
||||
// planet-sized maps (with the engine's vec_t types changed too, and with some sort of magic for the gpu's precision).
|
||||
//TODO: for this to work, someone'll have to go through the code to somehow deal with the vec_t/pvec_t/float differences.
|
||||
#warning FTE isnt ready for this.
|
||||
#include <stdint.h>
|
||||
typedef double pvec_t;
|
||||
typedef int64_t pint_t;
|
||||
typedef uint64_t puint_t;
|
||||
|
||||
#include <inttypes.h>
|
||||
#define pPRId PRId64
|
||||
#define pPRIi PRIi64
|
||||
#define pPRIu PRIu64
|
||||
#define pPRIx PRIx64
|
||||
#define QCVM_64
|
||||
#else
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec3_t[3];
|
||||
//use 32bit types, for sanity.
|
||||
typedef float pvec_t;
|
||||
typedef int pint_t;
|
||||
typedef unsigned int puint_t;
|
||||
#define pPRId "d"
|
||||
#define pPRIi "i"
|
||||
#define pPRIu "u"
|
||||
#define pPRIx "x"
|
||||
#define QCVM_32
|
||||
#endif
|
||||
|
||||
#ifndef t_bool
|
||||
#define t_bool
|
||||
typedef unsigned int pbool;
|
||||
typedef pvec_t pvec3_t[3];
|
||||
typedef pint_t progsnum_t;
|
||||
typedef puint_t func_t;
|
||||
typedef puint_t string_t;
|
||||
|
||||
#else
|
||||
#define t_bool
|
||||
#endif
|
||||
typedef int progsnum_t;
|
||||
typedef int func_t;
|
||||
typedef int string_t;
|
||||
extern pvec3_t pvec3_origin;
|
||||
|
||||
#endif /* QCLIB_PROGTYPE_H */
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ extern int MAX_CONSTANTS;
|
|||
|
||||
typedef enum {QCF_STANDARD, QCF_HEXEN2, QCF_DARKPLACES, QCF_FTE, QCF_FTEDEBUG, QCF_FTEH2, QCF_KK7, QCF_QTEST} qcc_targetformat_t;
|
||||
extern qcc_targetformat_t qcc_targetformat;
|
||||
void QCC_OPCodeSetTarget(qcc_targetformat_t targfmt);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -317,14 +318,14 @@ typedef struct QCC_function_s QCC_function_t;
|
|||
typedef union QCC_eval_s
|
||||
{
|
||||
QCC_string_t string;
|
||||
float _float;
|
||||
pvec_t _float;
|
||||
#ifdef __GNUC__
|
||||
float vector[0]; //gnuc extension. I'm using it to mute clang warnings.
|
||||
pvec_t vector[0]; //gnuc extension. I'm using it to mute clang warnings.
|
||||
#else
|
||||
float vector[1]; //should be 3, except that then eval_t would be too big.
|
||||
pvec_t vector[1]; //should be 3, except that then eval_t would be too big.
|
||||
#endif
|
||||
func_t function;
|
||||
int _int;
|
||||
pint_t _int;
|
||||
// union QCC_eval_s *ptr;
|
||||
} QCC_eval_t;
|
||||
|
||||
|
@ -332,10 +333,10 @@ typedef union QCC_eval_s
|
|||
typedef union QCC_evalstorage_s
|
||||
{
|
||||
QCC_string_t string;
|
||||
float _float;
|
||||
float vector[3];
|
||||
pvec_t _float;
|
||||
pvec_t vector[3];
|
||||
func_t function;
|
||||
int _int;
|
||||
pint_t _int;
|
||||
// union QCC_eval_s *ptr;
|
||||
} QCC_evalstorage_t;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ float (*PRLittleFloat) (float l);
|
|||
|
||||
static short QCC_SwapShort (short l)
|
||||
{
|
||||
qbyte b1,b2;
|
||||
pbyte b1,b2;
|
||||
|
||||
b1 = l&255;
|
||||
b2 = (l>>8)&255;
|
||||
|
@ -84,12 +84,12 @@ static short QCC_Short (short l)
|
|||
|
||||
static int QCC_SwapLong (int l)
|
||||
{
|
||||
qbyte b1,b2,b3,b4;
|
||||
pbyte b1,b2,b3,b4;
|
||||
|
||||
b1 = (qbyte)l;
|
||||
b2 = (qbyte)(l>>8);
|
||||
b3 = (qbyte)(l>>16);
|
||||
b4 = (qbyte)(l>>24);
|
||||
b1 = (pbyte)l;
|
||||
b2 = (pbyte)(l>>8);
|
||||
b3 = (pbyte)(l>>16);
|
||||
b4 = (pbyte)(l>>24);
|
||||
|
||||
return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ static int QCC_Long (int l)
|
|||
|
||||
static float QCC_SwapFloat (float l)
|
||||
{
|
||||
union {qbyte b[4]; float f;} in, out;
|
||||
union {pbyte b[4]; float f;} in, out;
|
||||
|
||||
in.f = l;
|
||||
out.b[0] = in.b[3];
|
||||
|
@ -120,7 +120,7 @@ static float QCC_Float (float l)
|
|||
|
||||
void SetEndian(void)
|
||||
{
|
||||
union {qbyte b[2]; unsigned short s;} ed;
|
||||
union {pbyte b[2]; unsigned short s;} ed;
|
||||
ed.s = 255;
|
||||
if (ed.b[0] == 255)
|
||||
{
|
||||
|
|
|
@ -244,10 +244,10 @@ QCC_sref_t QCC_PR_GenerateFunctionCall2 (QCC_sref_t newself, QCC_sref_t func, QC
|
|||
QCC_sref_t QCC_MakeTranslateStringConst(const char *value);
|
||||
QCC_sref_t QCC_MakeStringConst(const char *value);
|
||||
QCC_sref_t QCC_MakeStringConstLength(const char *value, int length);
|
||||
QCC_sref_t QCC_MakeFloatConst(float value);
|
||||
QCC_sref_t QCC_MakeFloatConst(pvec_t value);
|
||||
QCC_sref_t QCC_MakeFloatConstFromInt(longlong llvalue);
|
||||
QCC_sref_t QCC_MakeIntConst(longlong llvalue);
|
||||
QCC_sref_t QCC_MakeVectorConst(float a, float b, float c);
|
||||
QCC_sref_t QCC_MakeVectorConst(pvec_t a, pvec_t b, pvec_t c);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -2121,20 +2121,20 @@ const char *QCC_VarAtOffset(QCC_sref_t ref)
|
|||
if (val->_int>0 && val->_int < numfunctions && *functions[val->_int].name)
|
||||
QC_snprintfz(message, sizeof(message), "%s", functions[val->_int].name);
|
||||
else
|
||||
QC_snprintfz(message, sizeof(message), "%ii", val->_int);
|
||||
QC_snprintfz(message, sizeof(message), "%"pPRIi"i", val->_int);
|
||||
return message;
|
||||
case ev_field:
|
||||
case ev_integer:
|
||||
QC_snprintfz(message, sizeof(message), "%ii", val->_int);
|
||||
QC_snprintfz(message, sizeof(message), "%"pPRIi"i", val->_int);
|
||||
return message;
|
||||
case ev_entity:
|
||||
QC_snprintfz(message, sizeof(message), "%ie", val->_int);
|
||||
QC_snprintfz(message, sizeof(message), "%"pPRIi"e", val->_int);
|
||||
return message;
|
||||
case ev_float:
|
||||
if (!val->_float || val->_int & 0x7f800000)
|
||||
QC_snprintfz(message, sizeof(message), "%gf", val->_float);
|
||||
else
|
||||
QC_snprintfz(message, sizeof(message), "%%%i", val->_int);
|
||||
QC_snprintfz(message, sizeof(message), "%%%"pPRIi, val->_int);
|
||||
return message;
|
||||
case ev_vector:
|
||||
QC_snprintfz(message, sizeof(message), "'%g %g %g'", val->vector[0], val->vector[1], val->vector[2]);
|
||||
|
@ -6826,7 +6826,7 @@ QCC_sref_t QCC_MakeIntConst(longlong llvalue)
|
|||
}*/
|
||||
|
||||
// allocate a new one
|
||||
cn = (void *)qccHunkAlloc (sizeof(QCC_def_t) + sizeof(int));
|
||||
cn = (void *)qccHunkAlloc (sizeof(QCC_def_t) + sizeof(pint_t));
|
||||
cn->next = NULL;
|
||||
pr.def_tail->next = cn;
|
||||
pr.def_tail = cn;
|
||||
|
@ -6856,7 +6856,7 @@ static QCC_sref_t QCC_MakeUniqueConst(QCC_type_t *type, void *data)
|
|||
QCC_def_t *cn;
|
||||
|
||||
// allocate a new one
|
||||
cn = (void *)qccHunkAlloc (sizeof(QCC_def_t) + sizeof(int) * type->size);
|
||||
cn = (void *)qccHunkAlloc (sizeof(QCC_def_t) + sizeof(pint_t) * type->size);
|
||||
cn->next = NULL;
|
||||
pr.def_tail->next = cn;
|
||||
pr.def_tail = cn;
|
||||
|
@ -6873,14 +6873,14 @@ static QCC_sref_t QCC_MakeUniqueConst(QCC_type_t *type, void *data)
|
|||
cn->symbolsize = cn->type->size;
|
||||
cn->symboldata = (QCC_eval_t*)(cn+1);
|
||||
|
||||
memcpy(cn->symboldata, data, sizeof(int) * type->size);
|
||||
memcpy(cn->symboldata, data, sizeof(pint_t) * type->size);
|
||||
|
||||
return QCC_MakeSRefForce(cn, 0, type);
|
||||
}
|
||||
|
||||
|
||||
QCC_sref_t QCC_PR_GenerateVector(QCC_sref_t x, QCC_sref_t y, QCC_sref_t z);
|
||||
QCC_sref_t QCC_MakeVectorConst(float a, float b, float c)
|
||||
QCC_sref_t QCC_MakeVectorConst(pvec_t a, pvec_t b, pvec_t c)
|
||||
{
|
||||
QCC_def_t *cn;
|
||||
|
||||
|
@ -6921,7 +6921,7 @@ QCC_sref_t QCC_MakeVectorConst(float a, float b, float c)
|
|||
*/
|
||||
|
||||
// allocate a new one
|
||||
cn = (void *)qccHunkAlloc (sizeof(QCC_def_t)+sizeof(float)*3);
|
||||
cn = (void *)qccHunkAlloc (sizeof(QCC_def_t)+sizeof(pvec_t)*3);
|
||||
cn->next = NULL;
|
||||
pr.def_tail->next = cn;
|
||||
pr.def_tail = cn;
|
||||
|
@ -6947,13 +6947,13 @@ QCC_sref_t QCC_MakeVectorConst(float a, float b, float c)
|
|||
}
|
||||
|
||||
extern hashtable_t floatconstdefstable;
|
||||
QCC_sref_t QCC_MakeFloatConst(float value)
|
||||
QCC_sref_t QCC_MakeFloatConst(pvec_t value)
|
||||
{
|
||||
QCC_def_t *cn;
|
||||
|
||||
union {
|
||||
float f;
|
||||
int i;
|
||||
pvec_t f;
|
||||
pint_t i;
|
||||
} fi;
|
||||
|
||||
fi.f = value;
|
||||
|
@ -6963,7 +6963,7 @@ QCC_sref_t QCC_MakeFloatConst(float value)
|
|||
return QCC_MakeSRefForce(cn, 0, type_float);
|
||||
|
||||
// allocate a new one
|
||||
cn = (void *)qccHunkAlloc (sizeof(QCC_def_t) + sizeof(float));
|
||||
cn = (void *)qccHunkAlloc (sizeof(QCC_def_t) + sizeof(pvec_t));
|
||||
cn->next = NULL;
|
||||
pr.def_tail->next = cn;
|
||||
pr.def_tail = cn;
|
||||
|
|
|
@ -1357,7 +1357,7 @@ static pbool QCC_PR_Precompiler(void)
|
|||
QCC_PR_ParseWarning(WARN_BADTARGET, "Cannot switch to hexen2 target \'%s\' after the first statement. Ignored.", msg);
|
||||
}
|
||||
|
||||
qcc_targetformat = newtype;
|
||||
QCC_OPCodeSetTarget(newtype);
|
||||
}
|
||||
else if (!QC_strcasecmp(qcc_token, "PROGS_SRC"))
|
||||
{ //doesn't make sence, but silenced if you are switching between using a certain precompiler app used with CuTF.
|
||||
|
|
|
@ -698,7 +698,7 @@ static void QCC_PrintAutoCvars (void)
|
|||
externs->Printf ("set %s\t\"%g %g %g\"%s%s\n", n, val->vector[0], val->vector[1], val->vector[2], desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
case ev_integer:
|
||||
externs->Printf ("set %s\t%i%s%s\n", n, val->_int, desc?"\t//":"", desc?desc:"");
|
||||
externs->Printf ("set %s\t%"pPRIi"%s%s\n", n, val->_int, desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
case ev_string:
|
||||
externs->Printf ("set %s\t\"%s\"%s%s\n", n, strings + val->_int, desc?"\t//":"", desc?desc:"");
|
||||
|
@ -3336,7 +3336,7 @@ static void QCC_CRC_Init(unsigned short *crcvalue)
|
|||
*crcvalue = CRC_INIT_VALUE;
|
||||
}
|
||||
|
||||
static void QCC_CRC_ProcessByte(unsigned short *crcvalue, qbyte data)
|
||||
static void QCC_CRC_ProcessByte(unsigned short *crcvalue, pbyte data)
|
||||
{
|
||||
*crcvalue = ((*crcvalue << 8) ^ QCC_crctable[(*crcvalue >> 8) ^ data]) & 0xffff;
|
||||
}
|
||||
|
@ -3692,7 +3692,7 @@ static void QCC_PackFile (char *src, char *name)
|
|||
#endif
|
||||
|
||||
|
||||
if ( (qbyte *)pf - (qbyte *)pfiles > sizeof(pfiles) )
|
||||
if ( (pbyte *)pf - (pbyte *)pfiles > sizeof(pfiles) )
|
||||
QCC_Error (ERR_TOOMANYPAKFILES, "Too many files in pak file");
|
||||
|
||||
#if 1
|
||||
|
@ -3878,7 +3878,7 @@ static void _QCC_CopyFiles (int blocknum, int copytype, char *srcdir, char *dest
|
|||
header.id[1] = 'A';
|
||||
header.id[2] = 'C';
|
||||
header.id[3] = 'K';
|
||||
dirlen = (qbyte *)pf - (qbyte *)pfiles;
|
||||
dirlen = (pbyte *)pf - (pbyte *)pfiles;
|
||||
header.dirofs = PRLittleLong(SafeSeek (packhandle, 0, SEEK_CUR));
|
||||
header.dirlen = PRLittleLong(dirlen);
|
||||
|
||||
|
@ -3891,7 +3891,7 @@ static void _QCC_CopyFiles (int blocknum, int copytype, char *srcdir, char *dest
|
|||
// do a crc of the file
|
||||
QCC_CRC_Init (&crc);
|
||||
for (i=0 ; i<dirlen ; i++)
|
||||
QCC_CRC_ProcessByte (&crc, ((qbyte *)pfiles)[i]);
|
||||
QCC_CRC_ProcessByte (&crc, ((pbyte *)pfiles)[i]);
|
||||
|
||||
i = pf - pfiles;
|
||||
externs->Printf ("%i files packed in %i bytes (%i crc)\n",i, packbytes, crc);
|
||||
|
|
|
@ -885,31 +885,31 @@ void PR_Deinit(void)
|
|||
|
||||
void PR_LoadGlabalStruct(qboolean muted)
|
||||
{
|
||||
static float svphysicsmode = 2;
|
||||
static float writeonly;
|
||||
static int writeonly_int;
|
||||
static int endcontentsi, surfaceflagsi;
|
||||
static pvec_t svphysicsmode = 2;
|
||||
static pvec_t writeonly;
|
||||
static pint_t writeonly_int;
|
||||
static pint_t endcontentsi, surfaceflagsi;
|
||||
#ifdef HAVE_LEGACY
|
||||
static float endcontentsf, surfaceflagsf;
|
||||
static pvec_t endcontentsf, surfaceflagsf;
|
||||
#endif
|
||||
static float dimension_send_default;
|
||||
static float dimension_default = 255;
|
||||
static float zero_default;
|
||||
static float input_buttons_default;
|
||||
static float input_timelength_default;
|
||||
static float input_impulse_default;
|
||||
static vec3_t input_angles_default;
|
||||
static vec3_t input_movevalues_default;
|
||||
static vec3_t global_gravitydir_default = {0,0,-1};
|
||||
static pvec_t dimension_send_default;
|
||||
static pvec_t dimension_default = 255;
|
||||
static pvec_t zero_default;
|
||||
static pvec_t input_buttons_default;
|
||||
static pvec_t input_timelength_default;
|
||||
static pvec_t input_impulse_default;
|
||||
static pvec3_t input_angles_default;
|
||||
static pvec3_t input_movevalues_default;
|
||||
static pvec3_t global_gravitydir_default = {0,0,-1};
|
||||
int i;
|
||||
int *v;
|
||||
pint_t *v;
|
||||
globalptrs_t *pr_globals = pr_global_ptrs;
|
||||
memset(pr_global_ptrs, 0, sizeof(*pr_global_ptrs));
|
||||
|
||||
#define globalfloat(need,name) (pr_globals)->name = (float *)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (need && !(pr_globals)->name) {static float fallback##name; (pr_globals)->name = &fallback##name; if (!muted) Con_DPrintf("Could not find \""#name"\" export in progs\n");}
|
||||
#define globalint(need,name) (pr_globals)->name = (int *)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (need && !(pr_globals)->name) {static int fallback##name; (pr_globals)->name = &fallback##name; if (!muted) Con_DPrintf("Could not find \""#name"\" export in progs\n");}
|
||||
#define globalstring(need,name) (pr_globals)->name = (int *)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (need && !(pr_globals)->name) {static string_t fallback##name; (pr_globals)->name = &fallback##name; if (!muted) Con_DPrintf("Could not find \""#name"\" export in progs\n");}
|
||||
#define globalvec(need,name) (pr_globals)->name = (vec3_t *)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (need && !(pr_globals)->name) {static vec3_t fallback##name; (pr_globals)->name = &fallback##name; if (!muted) Con_DPrintf("Could not find \""#name"\" export in progs\n");}
|
||||
#define globalfloat(need,name) (pr_globals)->name = (pvec_t *)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (need && !(pr_globals)->name) {static pvec_t fallback##name; (pr_globals)->name = &fallback##name; if (!muted) Con_DPrintf("Could not find \""#name"\" export in progs\n");}
|
||||
#define globalint(need,name) (pr_globals)->name = (pint_t *)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (need && !(pr_globals)->name) {static pint_t fallback##name; (pr_globals)->name = &fallback##name; if (!muted) Con_DPrintf("Could not find \""#name"\" export in progs\n");}
|
||||
#define globalstring(need,name) (pr_globals)->name = (string_t*)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (need && !(pr_globals)->name) {static string_t fallback##name; (pr_globals)->name = &fallback##name; if (!muted) Con_DPrintf("Could not find \""#name"\" export in progs\n");}
|
||||
#define globalvec(need,name) (pr_globals)->name = (pvec3_t *)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (need && !(pr_globals)->name) {static pvec3_t fallback##name; (pr_globals)->name = &fallback##name; if (!muted) Con_DPrintf("Could not find \""#name"\" export in progs\n");}
|
||||
#define globalfunc(need,name) (pr_globals)->name = (func_t *)PR_FindGlobal(svprogfuncs, #name, 0, NULL); if (!(pr_globals)->name) {static func_t stripped##name; stripped##name = PR_FindFunction(svprogfuncs, #name, 0); if (stripped##name) (pr_globals)->name = &stripped##name; else if (need && !muted) Con_DPrintf("Could not find function \""#name"\" in progs\n"); }
|
||||
// globalint(pad);
|
||||
globalint (true, self); //we need the qw ones, but any in standard quake and not quakeworld, we don't really care about.
|
||||
|
@ -993,7 +993,7 @@ void PR_LoadGlabalStruct(qboolean muted)
|
|||
if (pr_global_ptrs->serverid)
|
||||
*pr_global_ptrs->serverid = svs.clusterserverid;
|
||||
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||
pr_global_ptrs->spawnparamglobals[i] = (float *)PR_FindGlobal(svprogfuncs, va("parm%i", i+1), 0, NULL);
|
||||
pr_global_ptrs->spawnparamglobals[i] = (pvec_t *)PR_FindGlobal(svprogfuncs, va("parm%i", i+1), 0, NULL);
|
||||
|
||||
#define ensureglobal(name,var) if (!(pr_globals)->name) (pr_globals)->name = &var;
|
||||
|
||||
|
@ -1008,18 +1008,18 @@ void PR_LoadGlabalStruct(qboolean muted)
|
|||
etype_t etype;
|
||||
eval_t *v = PR_FindGlobal(svprogfuncs, "trace_surfaceflags", 0, &etype);
|
||||
if (etype == ev_float)
|
||||
(pr_globals)->trace_surfaceflagsf = (float*)v;
|
||||
(pr_globals)->trace_surfaceflagsf = (pvec_t*)v;
|
||||
else if (etype == ev_integer)
|
||||
(pr_globals)->trace_surfaceflagsi = (int*)v;
|
||||
(pr_globals)->trace_surfaceflagsi = (pint_t*)v;
|
||||
}
|
||||
if (!(pr_globals)->trace_endcontentsf && !(pr_globals)->trace_endcontentsi)
|
||||
{
|
||||
etype_t etype;
|
||||
eval_t *v = PR_FindGlobal(svprogfuncs, "trace_endcontents", 0, &etype);
|
||||
if (etype == ev_float)
|
||||
(pr_globals)->trace_endcontentsf = (float*)v;
|
||||
(pr_globals)->trace_endcontentsf = (pvec_t*)v;
|
||||
else if (etype == ev_integer)
|
||||
(pr_globals)->trace_endcontentsi = (int*)v;
|
||||
(pr_globals)->trace_endcontentsi = (pint_t*)v;
|
||||
}
|
||||
ensureglobal(trace_endcontentsf, endcontentsf);
|
||||
ensureglobal(trace_surfaceflagsf, surfaceflagsf);
|
||||
|
@ -1046,10 +1046,10 @@ void PR_LoadGlabalStruct(qboolean muted)
|
|||
// qtest renames and missing variables
|
||||
if (!(pr_globals)->trace_plane_normal)
|
||||
{
|
||||
(pr_globals)->trace_plane_normal = (vec3_t *)PR_FindGlobal(svprogfuncs, "trace_normal", 0, NULL);
|
||||
(pr_globals)->trace_plane_normal = (pvec3_t *)PR_FindGlobal(svprogfuncs, "trace_normal", 0, NULL);
|
||||
if (!(pr_globals)->trace_plane_normal)
|
||||
{
|
||||
static vec3_t fallback_trace_plane_normal;
|
||||
static pvec3_t fallback_trace_plane_normal;
|
||||
(pr_globals)->trace_plane_normal = &fallback_trace_plane_normal;
|
||||
if (!muted)
|
||||
Con_DPrintf("Could not find trace_plane_normal export in progs\n");
|
||||
|
@ -1057,10 +1057,10 @@ void PR_LoadGlabalStruct(qboolean muted)
|
|||
}
|
||||
if (!(pr_globals)->trace_endpos)
|
||||
{
|
||||
(pr_globals)->trace_endpos = (vec3_t *)PR_FindGlobal(svprogfuncs, "trace_impact", 0, NULL);
|
||||
(pr_globals)->trace_endpos = (pvec3_t *)PR_FindGlobal(svprogfuncs, "trace_impact", 0, NULL);
|
||||
if (!(pr_globals)->trace_endpos)
|
||||
{
|
||||
static vec3_t fallback_trace_endpos;
|
||||
static pvec3_t fallback_trace_endpos;
|
||||
(pr_globals)->trace_endpos = &fallback_trace_endpos;
|
||||
if (!muted)
|
||||
Con_DPrintf("Could not find trace_endpos export in progs\n");
|
||||
|
@ -1068,10 +1068,10 @@ void PR_LoadGlabalStruct(qboolean muted)
|
|||
}
|
||||
if (!(pr_globals)->trace_fraction)
|
||||
{
|
||||
(pr_globals)->trace_fraction = (float *)PR_FindGlobal(svprogfuncs, "trace_frac", 0, NULL);
|
||||
(pr_globals)->trace_fraction = (pvec_t *)PR_FindGlobal(svprogfuncs, "trace_frac", 0, NULL);
|
||||
if (!(pr_globals)->trace_fraction)
|
||||
{
|
||||
static float fallback_trace_fraction;
|
||||
static pvec_t fallback_trace_fraction;
|
||||
(pr_globals)->trace_fraction = &fallback_trace_fraction;
|
||||
if (!muted)
|
||||
Con_DPrintf("Could not find trace_fraction export in progs\n");
|
||||
|
@ -1131,10 +1131,10 @@ void PR_LoadGlabalStruct(qboolean muted)
|
|||
SV_PlayerPhysicsQC = PR_FindFunction(svprogfuncs, "SV_PlayerPhysics", PR_ANY);
|
||||
EndFrameQC = PR_FindFunction (svprogfuncs, "EndFrame", PR_ANY);
|
||||
|
||||
v = (int *)PR_globals(svprogfuncs, PR_CURRENT);
|
||||
svprogfuncs->AddSharedVar(svprogfuncs, (int *)(pr_global_ptrs)->self-v, 1);
|
||||
svprogfuncs->AddSharedVar(svprogfuncs, (int *)(pr_global_ptrs)->other-v, 1);
|
||||
svprogfuncs->AddSharedVar(svprogfuncs, (int *)(pr_global_ptrs)->time-v, 1);
|
||||
v = (pint_t *)PR_globals(svprogfuncs, PR_CURRENT);
|
||||
svprogfuncs->AddSharedVar(svprogfuncs, (pint_t *)(pr_global_ptrs)->self-v, 1);
|
||||
svprogfuncs->AddSharedVar(svprogfuncs, (pint_t *)(pr_global_ptrs)->other-v, 1);
|
||||
svprogfuncs->AddSharedVar(svprogfuncs, (pint_t *)(pr_global_ptrs)->time-v, 1);
|
||||
|
||||
//test the global rather than the field - fte internally always has the field.
|
||||
sv.haveitems2 = !!PR_FindGlobal(svprogfuncs, "items2", 0, NULL);
|
||||
|
@ -2855,7 +2855,7 @@ setorigin (entity, origin)
|
|||
static void QCBUILTIN PF_setorigin (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
edict_t *e;
|
||||
float *org;
|
||||
pvec_t *org;
|
||||
|
||||
e = G_EDICT(prinst, OFS_PARM0);
|
||||
if (e->readonly)
|
||||
|
@ -2881,7 +2881,7 @@ setsize (entity, minvector, maxvector)
|
|||
static void QCBUILTIN PF_setsize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
edict_t *e;
|
||||
float *min, *max;
|
||||
pvec_t *min, *max;
|
||||
|
||||
e = G_EDICT(prinst, OFS_PARM0);
|
||||
if (ED_ISFREE(e))
|
||||
|
@ -3327,15 +3327,12 @@ particle(origin, color, count)
|
|||
*/
|
||||
void QCBUILTIN PF_particle (pubprogfuncs_t *prinst, globalvars_t *pr_globals) //I said it was for compatability only.
|
||||
{
|
||||
float *org, *dir;
|
||||
int color;
|
||||
int count;
|
||||
int i, v;
|
||||
|
||||
org = G_VECTOR(OFS_PARM0);
|
||||
dir = G_VECTOR(OFS_PARM1);
|
||||
color = G_FLOAT(OFS_PARM2);
|
||||
count = G_FLOAT(OFS_PARM3);
|
||||
VM_VECTORARG(org, OFS_PARM0);
|
||||
VM_VECTORARG(dir, OFS_PARM1);
|
||||
int color = G_FLOAT(OFS_PARM2);
|
||||
int count = G_FLOAT(OFS_PARM3);
|
||||
|
||||
count = bound(0, count, 255);
|
||||
color &= 0xff;
|
||||
|
@ -3413,14 +3410,12 @@ void QCBUILTIN PF_particle (pubprogfuncs_t *prinst, globalvars_t *pr_globals) //
|
|||
|
||||
static void QCBUILTIN PF_te_blooddp (pubprogfuncs_t *prinst, globalvars_t *pr_globals)
|
||||
{
|
||||
float count;
|
||||
float *org, *dir;
|
||||
#ifdef NQPROT
|
||||
int i, v;
|
||||
#endif
|
||||
org = G_VECTOR(OFS_PARM0);
|
||||
dir = G_VECTOR(OFS_PARM1);
|
||||
count = G_FLOAT(OFS_PARM2);
|
||||
VM_VECTORARG(org, OFS_PARM0);
|
||||
VM_VECTORARG(dir, OFS_PARM1);
|
||||
int count = G_FLOAT(OFS_PARM2);
|
||||
|
||||
#ifdef NQPROT
|
||||
MSG_WriteByte (&sv.nqmulticast, svc_particle);
|
||||
|
@ -3443,7 +3438,7 @@ static void QCBUILTIN PF_te_blooddp (pubprogfuncs_t *prinst, globalvars_t *pr_gl
|
|||
(void)dir; //FIXME: sould be sending TEDP_BLOOD
|
||||
MSG_WriteByte (&sv.multicast, svc_temp_entity);
|
||||
MSG_WriteByte (&sv.multicast, TEQW_QWBLOOD);
|
||||
MSG_WriteByte (&sv.multicast, count<10?1:(count+10)/20);
|
||||
MSG_WriteByte (&sv.multicast, (count>0&&count<10)?1:(count+10)/20);
|
||||
MSG_WriteCoord (&sv.multicast, org[0]);
|
||||
MSG_WriteCoord (&sv.multicast, org[1]);
|
||||
MSG_WriteCoord (&sv.multicast, org[2]);
|
||||
|
@ -3460,17 +3455,12 @@ particle(origin, dmin, dmax, color, effect, count)
|
|||
*/
|
||||
static void QCBUILTIN PF_particle2 (pubprogfuncs_t *prinst, globalvars_t *pr_globals)
|
||||
{
|
||||
float *org, *dmin, *dmax;
|
||||
float color;
|
||||
float count;
|
||||
float effect;
|
||||
|
||||
org = G_VECTOR(OFS_PARM0);
|
||||
dmin = G_VECTOR(OFS_PARM1);
|
||||
dmax = G_VECTOR(OFS_PARM2);
|
||||
color = G_FLOAT(OFS_PARM3);
|
||||
effect = G_FLOAT(OFS_PARM4);
|
||||
count = G_FLOAT(OFS_PARM5);
|
||||
VM_VECTORARG(org, OFS_PARM0);
|
||||
VM_VECTORARG(dmin, OFS_PARM1);
|
||||
VM_VECTORARG(dmax, OFS_PARM2);
|
||||
float color = G_FLOAT(OFS_PARM3);
|
||||
float effect = G_FLOAT(OFS_PARM4);
|
||||
float count = G_FLOAT(OFS_PARM5);
|
||||
|
||||
MSG_WriteByte (&sv.multicast, svcfte_particle2);
|
||||
MSG_WriteCoord (&sv.multicast, org[0]);
|
||||
|
@ -3500,16 +3490,11 @@ particle(origin, box, color, effect, count)
|
|||
*/
|
||||
static void QCBUILTIN PF_particle3 (pubprogfuncs_t *prinst, globalvars_t *pr_globals)
|
||||
{
|
||||
float *org, *box;
|
||||
float color;
|
||||
float count;
|
||||
float effect;
|
||||
|
||||
org = G_VECTOR(OFS_PARM0);
|
||||
box = G_VECTOR(OFS_PARM1);
|
||||
color = G_FLOAT(OFS_PARM2);
|
||||
effect = G_FLOAT(OFS_PARM3);
|
||||
count = G_FLOAT(OFS_PARM4);
|
||||
VM_VECTORARG(org, OFS_PARM0);
|
||||
VM_VECTORARG(box, OFS_PARM1);
|
||||
float color = G_FLOAT(OFS_PARM2);
|
||||
float effect = G_FLOAT(OFS_PARM3);
|
||||
float count = G_FLOAT(OFS_PARM4);
|
||||
|
||||
MSG_WriteByte (&sv.multicast, svcfte_particle3);
|
||||
MSG_WriteCoord (&sv.multicast, org[0]);
|
||||
|
@ -3535,17 +3520,11 @@ particle(origin, radius, color, effect, count)
|
|||
*/
|
||||
static void QCBUILTIN PF_particle4 (pubprogfuncs_t *prinst, globalvars_t *pr_globals)
|
||||
{
|
||||
float *org;
|
||||
float radius;
|
||||
float color;
|
||||
float count;
|
||||
float effect;
|
||||
|
||||
org = G_VECTOR(OFS_PARM0);
|
||||
radius = G_FLOAT(OFS_PARM1);
|
||||
color = G_FLOAT(OFS_PARM2);
|
||||
effect = G_FLOAT(OFS_PARM3);
|
||||
count = G_FLOAT(OFS_PARM4);
|
||||
VM_VECTORARG(org, OFS_PARM0);
|
||||
int radius = G_FLOAT(OFS_PARM1);
|
||||
int color = G_FLOAT(OFS_PARM2);
|
||||
int effect = G_FLOAT(OFS_PARM3);
|
||||
int count = G_FLOAT(OFS_PARM4);
|
||||
|
||||
MSG_WriteByte (&sv.multicast, svcfte_particle4);
|
||||
MSG_WriteCoord (&sv.multicast, org[0]);
|
||||
|
@ -3563,13 +3542,11 @@ static void QCBUILTIN PF_particle4 (pubprogfuncs_t *prinst, globalvars_t *pr_glo
|
|||
static void QCBUILTIN PF_h2particleexplosion(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
//used by the (regular) ice staff, and multiple other things.
|
||||
float *org;
|
||||
int color,radius,count, effect;
|
||||
org = G_VECTOR(OFS_PARM0);
|
||||
radius = G_FLOAT(OFS_PARM1);
|
||||
color = G_FLOAT(OFS_PARM2);
|
||||
effect = 255; //special explosion thing
|
||||
count = G_FLOAT(OFS_PARM3);
|
||||
VM_VECTORARG(org, OFS_PARM0);
|
||||
int radius = G_FLOAT(OFS_PARM1);
|
||||
int color = G_FLOAT(OFS_PARM2);
|
||||
int effect = 255; //special explosion thing
|
||||
int count = G_FLOAT(OFS_PARM3);
|
||||
|
||||
MSG_WriteByte (&sv.multicast, svcfte_particle4);
|
||||
MSG_WriteCoord (&sv.multicast, org[0]);
|
||||
|
@ -3624,14 +3601,10 @@ void PF_ambientsound_Internal (float *pos, const char *samp, float vol, float at
|
|||
|
||||
static void QCBUILTIN PF_ambientsound (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
const char *samp;
|
||||
float *pos;
|
||||
float vol, attenuation;
|
||||
|
||||
pos = G_VECTOR (OFS_PARM0);
|
||||
samp = PR_GetStringOfs(prinst, OFS_PARM1);
|
||||
vol = G_FLOAT(OFS_PARM2);
|
||||
attenuation = G_FLOAT(OFS_PARM3);
|
||||
VM_VECTORARG(pos, OFS_PARM0);
|
||||
const char *samp = PR_GetStringOfs(prinst, OFS_PARM1);
|
||||
float vol = G_FLOAT(OFS_PARM2);
|
||||
float attenuation = G_FLOAT(OFS_PARM3);
|
||||
|
||||
PF_ambientsound_Internal(pos, samp, vol, attenuation);
|
||||
}
|
||||
|
@ -3698,20 +3671,11 @@ static void QCBUILTIN PF_sound (pubprogfuncs_t *prinst, struct globalvars_s *pr_
|
|||
|
||||
static void QCBUILTIN PF_pointsound(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
const char *sample;
|
||||
float *origin;
|
||||
float volume;
|
||||
float attenuation;
|
||||
float pitchpct;
|
||||
|
||||
origin = G_VECTOR(OFS_PARM0);
|
||||
sample = PR_GetStringOfs(prinst, OFS_PARM1);
|
||||
volume = G_FLOAT(OFS_PARM2);
|
||||
attenuation = G_FLOAT(OFS_PARM3);
|
||||
if (prinst->callargc >= 5)
|
||||
pitchpct = G_FLOAT(OFS_PARM4)*0.01;
|
||||
else
|
||||
pitchpct = 0;
|
||||
VM_VECTORARG(origin, OFS_PARM0);
|
||||
const char *sample = PR_GetStringOfs(prinst, OFS_PARM1);
|
||||
float volume = G_FLOAT(OFS_PARM2);
|
||||
float attenuation = G_FLOAT(OFS_PARM3);
|
||||
float pitchpct = (prinst->callargc > 4)?G_FLOAT(OFS_PARM4)*0.01:0;
|
||||
|
||||
SVQ1_StartSound (origin, sv.world.edicts, 0, sample, volume, attenuation, pitchpct, 0, 0);
|
||||
}
|
||||
|
@ -3723,8 +3687,8 @@ static void QCBUILTIN PF_ss_LocalSound(pubprogfuncs_t *prinst, struct globalvars
|
|||
sfx_t *sfx;
|
||||
|
||||
const char * s = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
float chan = (prinst->callargc>=1)?G_FLOAT(OFS_PARM1):0;
|
||||
float vol = (prinst->callargc>=2)?G_FLOAT(OFS_PARM2):1;
|
||||
float chan = (prinst->callargc>1)?G_FLOAT(OFS_PARM1):0;
|
||||
float vol = (prinst->callargc>2)?G_FLOAT(OFS_PARM2):1;
|
||||
|
||||
if (!isDedicated)
|
||||
{
|
||||
|
@ -3796,7 +3760,7 @@ traceline (vector1, vector2, tryents)
|
|||
*/
|
||||
void QCBUILTIN PF_svtraceline (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
float *v1, *v2, *mins, *maxs;
|
||||
vec_t *v1, *v2, *mins, *maxs;
|
||||
trace_t trace;
|
||||
int nomonsters;
|
||||
edict_t *ent;
|
||||
|
@ -3831,42 +3795,30 @@ void QCBUILTIN PF_svtraceline (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
#ifdef HEXEN2
|
||||
static void QCBUILTIN PF_traceboxh2 (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
float *v1, *v2, *mins, *maxs;
|
||||
trace_t trace;
|
||||
int nomonsters;
|
||||
edict_t *ent;
|
||||
|
||||
v1 = G_VECTOR(OFS_PARM0);
|
||||
v2 = G_VECTOR(OFS_PARM1);
|
||||
mins = G_VECTOR(OFS_PARM2);
|
||||
maxs = G_VECTOR(OFS_PARM3);
|
||||
nomonsters = G_FLOAT(OFS_PARM4);
|
||||
ent = G_EDICT(prinst, OFS_PARM5);
|
||||
|
||||
trace = World_Move (&sv.world, v1, mins, maxs, v2, nomonsters|MOVE_IGNOREHULL, (wedict_t*)ent);
|
||||
VM_VECTORARG(v1, OFS_PARM0);
|
||||
VM_VECTORARG(v2, OFS_PARM1);
|
||||
VM_VECTORARG(mins, OFS_PARM2);
|
||||
VM_VECTORARG(maxs, OFS_PARM3);
|
||||
int nomonsters = G_FLOAT(OFS_PARM4);
|
||||
edict_t *ent = G_EDICT(prinst, OFS_PARM5);
|
||||
|
||||
trace_t trace = World_Move (&sv.world, v1, mins, maxs, v2, nomonsters|MOVE_IGNOREHULL, (wedict_t*)ent);
|
||||
set_trace_globals(prinst, &trace);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void QCBUILTIN PF_traceboxdp (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
float *v1, *v2, *mins, *maxs;
|
||||
trace_t trace;
|
||||
int nomonsters;
|
||||
edict_t *ent;
|
||||
|
||||
v1 = G_VECTOR(OFS_PARM0);
|
||||
mins = G_VECTOR(OFS_PARM1);
|
||||
maxs = G_VECTOR(OFS_PARM2);
|
||||
v2 = G_VECTOR(OFS_PARM3);
|
||||
nomonsters = G_FLOAT(OFS_PARM4);
|
||||
ent = G_EDICT(prinst, OFS_PARM5);
|
||||
VM_VECTORARG(v1, OFS_PARM0);
|
||||
VM_VECTORARG(mins, OFS_PARM1);
|
||||
VM_VECTORARG(maxs, OFS_PARM2);
|
||||
VM_VECTORARG(v2, OFS_PARM3);
|
||||
int nomonsters = G_FLOAT(OFS_PARM4);
|
||||
edict_t *ent = G_EDICT(prinst, OFS_PARM5);
|
||||
|
||||
// PR_StackTrace(prinst, 2);
|
||||
|
||||
trace = World_Move (&sv.world, v1, mins, maxs, v2, nomonsters|MOVE_IGNOREHULL, (wedict_t*)ent);
|
||||
|
||||
trace_t trace = World_Move (&sv.world, v1, mins, maxs, v2, nomonsters|MOVE_IGNOREHULL, (wedict_t*)ent);
|
||||
set_trace_globals(prinst, &trace);
|
||||
}
|
||||
|
||||
|
@ -4902,10 +4854,9 @@ static void QCBUILTIN PF_pointcontents (pubprogfuncs_t *prinst, struct globalvar
|
|||
{
|
||||
world_t *w = prinst->parms->user;
|
||||
|
||||
float *v;
|
||||
int cont;
|
||||
|
||||
v = G_VECTOR(OFS_PARM0);
|
||||
VM_VECTORARG(v, OFS_PARM0);
|
||||
|
||||
cont = World_PointContentsWorldOnly(w, v);
|
||||
if (cont & FTECONTENTS_SOLID)
|
||||
|
@ -6454,11 +6405,8 @@ void(vector where, float set) multicast
|
|||
*/
|
||||
void QCBUILTIN PF_multicast (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
float *o;
|
||||
int to;
|
||||
|
||||
o = G_VECTOR(OFS_PARM0);
|
||||
to = G_FLOAT(OFS_PARM1);
|
||||
VM_VECTORARG(o, OFS_PARM0);
|
||||
int to = G_FLOAT(OFS_PARM1);
|
||||
|
||||
#ifdef NETPREPARSE
|
||||
NPP_Flush();
|
||||
|
@ -7954,11 +7902,11 @@ static void QCBUILTIN PF_h2v_factor(pubprogfuncs_t *prinst, struct globalvars_s
|
|||
static void QCBUILTIN PF_h2v_factorrange(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
// returns (v_right * factor_x) + (v_forward * factor_y) + (v_up * factor_z)
|
||||
{
|
||||
float num,*minv,*maxv;
|
||||
float num;
|
||||
vec3_t result,r2;
|
||||
|
||||
minv = G_VECTOR(OFS_PARM0);
|
||||
maxv = G_VECTOR(OFS_PARM1);
|
||||
VM_VECTORARG(minv, OFS_PARM0);
|
||||
VM_VECTORARG(maxv, OFS_PARM1);
|
||||
|
||||
num = (rand ()&0x7fff) / ((float)0x7fff);
|
||||
result[0] = ((maxv[0]-minv[0]) * num) + minv[0];
|
||||
|
|
|
@ -560,7 +560,7 @@ static eval_t *QDECL Q1QVMPF_FindGlobal (pubprogfuncs_t *prinst, const char *na
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static globalvars_t *QDECL Q1QVMPF_Globals(pubprogfuncs_t *prinst, int prnum)
|
||||
static globalvars_t *QDECL Q1QVMPF_Globals(pubprogfuncs_t *prinst, progsnum_t prnum)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -985,8 +985,8 @@ static qintptr_t QVM_WalkMove (void *offset, quintptr_t mask, const qintptr_t *a
|
|||
static qintptr_t QVM_DropToFloor (void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
edict_t *ent;
|
||||
vec3_t end;
|
||||
vec3_t start;
|
||||
pvec3_t end;
|
||||
pvec3_t start;
|
||||
trace_t trace;
|
||||
extern cvar_t pr_droptofloorunits;
|
||||
|
||||
|
@ -2161,12 +2161,12 @@ static qboolean QDECL Q1QVM_Event_ContentsTransition(world_t *w, wedict_t *ent,
|
|||
|
||||
qboolean PR_LoadQ1QVM(void)
|
||||
{
|
||||
static int writable_int;
|
||||
static float writable;
|
||||
static float dimensionsend = 255;
|
||||
static float dimensiondefault = 255;
|
||||
static float physics_mode = 2;
|
||||
static vec3_t defaultgravity = {0,0,-1};
|
||||
static pint_t writable_int;
|
||||
static pvec_t writable;
|
||||
static pvec_t dimensionsend = 255;
|
||||
static pvec_t dimensiondefault = 255;
|
||||
static pvec_t physics_mode = 2;
|
||||
static pvec3_t defaultgravity = {0,0,-1};
|
||||
int i;
|
||||
gameDataPrivate_t gd;
|
||||
gameDataN_t *gdn;
|
||||
|
|
|
@ -22,71 +22,71 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
typedef struct globalvars_s
|
||||
{
|
||||
int null;
|
||||
pint_t null;
|
||||
union {
|
||||
vec3_t vec;
|
||||
float f;
|
||||
int i;
|
||||
pvec3_t vec;
|
||||
pvec_t f;
|
||||
pint_t i;
|
||||
} ret;
|
||||
union {
|
||||
vec3_t vec;
|
||||
float f;
|
||||
int i;
|
||||
pvec3_t vec;
|
||||
pvec_t f;
|
||||
pint_t i;
|
||||
} param[8];
|
||||
} globalvars_t;
|
||||
|
||||
#define NUM_SPAWN_PARMS 64
|
||||
typedef struct nqglobalvars_s
|
||||
{
|
||||
int *self;
|
||||
int *other;
|
||||
int *world;
|
||||
float *time;
|
||||
float *frametime;
|
||||
int *newmis;
|
||||
float *force_retouch;
|
||||
pint_t *self;
|
||||
pint_t *other;
|
||||
pint_t *world;
|
||||
pvec_t *time;
|
||||
pvec_t *frametime;
|
||||
pint_t *newmis;
|
||||
pvec_t *force_retouch;
|
||||
string_t *mapname;
|
||||
float *deathmatch;
|
||||
float *coop;
|
||||
float *teamplay;
|
||||
float *serverflags;
|
||||
float *total_secrets;
|
||||
float *total_monsters;
|
||||
float *found_secrets;
|
||||
float *killed_monsters;
|
||||
vec3_t *v_forward;
|
||||
vec3_t *v_up;
|
||||
vec3_t *v_right;
|
||||
float *trace_allsolid;
|
||||
float *trace_startsolid;
|
||||
float *trace_fraction;
|
||||
pvec_t *deathmatch;
|
||||
pvec_t *coop;
|
||||
pvec_t *teamplay;
|
||||
pvec_t *serverflags;
|
||||
pvec_t *total_secrets;
|
||||
pvec_t *total_monsters;
|
||||
pvec_t *found_secrets;
|
||||
pvec_t *killed_monsters;
|
||||
pvec3_t *v_forward;
|
||||
pvec3_t *v_up;
|
||||
pvec3_t *v_right;
|
||||
pvec_t *trace_allsolid;
|
||||
pvec_t *trace_startsolid;
|
||||
pvec_t *trace_fraction;
|
||||
#ifdef HAVE_LEGACY
|
||||
float *trace_surfaceflagsf;
|
||||
pvec_t *trace_surfaceflagsf;
|
||||
#endif
|
||||
int *trace_surfaceflagsi;
|
||||
pint_t *trace_surfaceflagsi;
|
||||
string_t*trace_surfacename;
|
||||
#ifdef HAVE_LEGACY
|
||||
float *trace_endcontentsf;
|
||||
pvec_t *trace_endcontentsf;
|
||||
#endif
|
||||
int *trace_endcontentsi;
|
||||
int *trace_brush_id;
|
||||
int *trace_brush_faceid;
|
||||
int *trace_surface_id;
|
||||
int *trace_bone_id;
|
||||
int *trace_triangle_id;
|
||||
vec3_t *trace_endpos;
|
||||
vec3_t *trace_plane_normal;
|
||||
float *trace_plane_dist;
|
||||
int *trace_ent;
|
||||
float *trace_inopen;
|
||||
float *trace_inwater;
|
||||
pint_t *trace_endcontentsi;
|
||||
pint_t *trace_brush_id;
|
||||
pint_t *trace_brush_faceid;
|
||||
pint_t *trace_surface_id;
|
||||
pint_t *trace_bone_id;
|
||||
pint_t *trace_triangle_id;
|
||||
pvec3_t *trace_endpos;
|
||||
pvec3_t *trace_plane_normal;
|
||||
pvec_t *trace_plane_dist;
|
||||
pint_t *trace_ent;
|
||||
pvec_t *trace_inopen;
|
||||
pvec_t *trace_inwater;
|
||||
#ifdef HAVE_LEGACY
|
||||
string_t*trace_dphittexturename;
|
||||
float *trace_dpstartcontents;
|
||||
float *trace_dphitcontents;
|
||||
float *trace_dphitq3surfaceflags;
|
||||
pvec_t *trace_dpstartcontents;
|
||||
pvec_t *trace_dphitcontents;
|
||||
pvec_t *trace_dphitq3surfaceflags;
|
||||
#endif
|
||||
int *msg_entity;
|
||||
pint_t *msg_entity;
|
||||
func_t *main;
|
||||
func_t *StartFrame;
|
||||
func_t *PlayerPreThink;
|
||||
|
@ -97,21 +97,21 @@ typedef struct nqglobalvars_s
|
|||
func_t *ClientDisconnect;
|
||||
func_t *SetNewParms;
|
||||
func_t *SetChangeParms;
|
||||
float *cycle_wrapped;
|
||||
float *dimension_send;
|
||||
float *dimension_default;
|
||||
pvec_t *cycle_wrapped;
|
||||
pvec_t *dimension_send;
|
||||
pvec_t *dimension_default;
|
||||
|
||||
float *physics_mode;
|
||||
float *clientcommandframe;
|
||||
float *input_timelength;
|
||||
float *input_impulse;
|
||||
vec3_t *input_angles;
|
||||
vec3_t *input_movevalues;
|
||||
float *input_buttons;
|
||||
vec3_t *global_gravitydir;
|
||||
float *spawnparamglobals[NUM_SPAWN_PARMS];
|
||||
pvec_t *physics_mode;
|
||||
pvec_t *clientcommandframe;
|
||||
pvec_t *input_timelength;
|
||||
pvec_t *input_impulse;
|
||||
pvec3_t *input_angles;
|
||||
pvec3_t *input_movevalues;
|
||||
pvec_t *input_buttons;
|
||||
pvec3_t *global_gravitydir;
|
||||
pvec_t *spawnparamglobals[NUM_SPAWN_PARMS];
|
||||
string_t *parm_string;
|
||||
int *serverid;
|
||||
pint_t *serverid;
|
||||
} globalptrs_t;
|
||||
|
||||
#define P_VEC(v) (pr_global_struct->v)
|
||||
|
@ -371,9 +371,9 @@ and the extension fields are added on the end and can have extra vm-specific stu
|
|||
|
||||
typedef struct stdentvars_s //standard = standard for qw
|
||||
{
|
||||
#define comfieldfloat(sharedname,desc) float sharedname;
|
||||
#define comfieldvector(sharedname,desc) vec3_t sharedname;
|
||||
#define comfieldentity(sharedname,desc) int sharedname;
|
||||
#define comfieldfloat(sharedname,desc) pvec_t sharedname;
|
||||
#define comfieldvector(sharedname,desc) pvec3_t sharedname;
|
||||
#define comfieldentity(sharedname,desc) pint_t sharedname;
|
||||
#define comfieldstring(sharedname,desc) string_t sharedname;
|
||||
#define comfieldfunction(sharedname, typestr,desc) func_t sharedname;
|
||||
comqcfields
|
||||
|
@ -388,10 +388,10 @@ comqcfields
|
|||
typedef struct extentvars_s
|
||||
{
|
||||
#endif
|
||||
#define comfieldfloat(name,desc) float name;
|
||||
#define comfieldint(name,desc) int name;
|
||||
#define comfieldvector(name,desc) vec3_t name;
|
||||
#define comfieldentity(name,desc) int name;
|
||||
#define comfieldfloat(name,desc) pvec_t name;
|
||||
#define comfieldint(name,desc) pint_t name;
|
||||
#define comfieldvector(name,desc) pvec3_t name;
|
||||
#define comfieldentity(name,desc) pint_t name;
|
||||
#define comfieldstring(name,desc) string_t name;
|
||||
#define comfieldfunction(name, typestr,desc) func_t name;
|
||||
comextqcfields
|
||||
|
@ -410,9 +410,9 @@ svextqcfields
|
|||
#endif
|
||||
|
||||
typedef struct {
|
||||
#define comfieldfloat(sharedname,desc) float sharedname;
|
||||
#define comfieldvector(sharedname,desc) vec3_t sharedname;
|
||||
#define comfieldentity(sharedname,desc) int sharedname;
|
||||
#define comfieldfloat(sharedname,desc) pvec_t sharedname;
|
||||
#define comfieldvector(sharedname,desc) pvec3_t sharedname;
|
||||
#define comfieldentity(sharedname,desc) pint_t sharedname;
|
||||
#define comfieldstring(sharedname,desc) string_t sharedname;
|
||||
#define comfieldfunction(sharedname, typestr,desc) func_t sharedname;
|
||||
comqcfields
|
||||
|
@ -427,10 +427,10 @@ comqcfields
|
|||
typedef struct {
|
||||
#endif
|
||||
|
||||
#define comfieldfloat(name,desc) float name;
|
||||
#define comfieldint(name,desc) int name;
|
||||
#define comfieldvector(name,desc) vec3_t name;
|
||||
#define comfieldentity(name,desc) int name;
|
||||
#define comfieldfloat(name,desc) pvec_t name;
|
||||
#define comfieldint(name,desc) pint_t name;
|
||||
#define comfieldvector(name,desc) pvec3_t name;
|
||||
#define comfieldentity(name,desc) pint_t name;
|
||||
#define comfieldstring(name,desc) string_t name;
|
||||
#define comfieldfunction(name, typestr,desc) func_t name;
|
||||
comextqcfields
|
||||
|
|
|
@ -174,7 +174,7 @@ typedef struct
|
|||
qbyte h2cdtrack;
|
||||
#endif
|
||||
|
||||
vec3_t skyroom_pos; //parsed from world._skyroom
|
||||
pvec3_t skyroom_pos; //parsed from world._skyroom
|
||||
qboolean skyroom_pos_known;
|
||||
|
||||
int allocated_client_slots; //number of slots available. (used mostly to stop single player saved games cacking up)
|
||||
|
@ -1318,7 +1318,7 @@ void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int
|
|||
void SV_MulticastCB(vec3_t origin, multicast_t to, const char *reliableinfokey, int dimension_mask, void (*callback)(client_t *cl, sizebuf_t *msg, void *ctx), void *ctx);
|
||||
|
||||
void SV_StartSound (int ent, vec3_t origin, float *velocity, int seenmask, int channel, const char *sample, int volume, float attenuation, float pitchadj, float timeofs, unsigned int flags);
|
||||
void QDECL SVQ1_StartSound (float *origin, wedict_t *entity, int channel, const char *sample, int volume, float attenuation, float pitchadj, float timeofs, unsigned int chflags);
|
||||
void QDECL SVQ1_StartSound (vec_t *origin, wedict_t *entity, int channel, const char *sample, int volume, float attenuation, float pitchadj, float timeofs, unsigned int chflags);
|
||||
void SV_PrintToClient(client_t *cl, int level, const char *string);
|
||||
void SV_TPrintToClient(client_t *cl, int level, const char *string);
|
||||
void SV_StuffcmdToClient(client_t *cl, const char *string);
|
||||
|
|
|
@ -3909,7 +3909,7 @@ void SV_Snapshot_BuildQ1(client_t *client, packet_entities_t *pack, pvscamera_t
|
|||
}
|
||||
}
|
||||
|
||||
void SV_AddCameraEntity(pvscamera_t *cameras, edict_t *ent, vec3_t viewofs)
|
||||
void SV_AddCameraEntity(pvscamera_t *cameras, edict_t *ent, pvec3_t viewofs)
|
||||
{
|
||||
int i;
|
||||
vec3_t org;
|
||||
|
|
|
@ -628,7 +628,7 @@ qboolean World_MoveToGoal (world_t *world, wedict_t *ent, float dist)
|
|||
|
||||
|
||||
#ifdef ENGINE_ROUTING
|
||||
#ifndef SERVERONLY
|
||||
#ifdef HAVE_CLIENT
|
||||
static cvar_t route_shownodes = CVAR("route_shownodes", "0");
|
||||
#endif
|
||||
|
||||
|
@ -737,7 +737,7 @@ static struct waypointnetwork_s *WayNet_Begin(void **ctxptr, model_t *worldmodel
|
|||
net->waypoints[net->numwaypoints].org[0] = atof(Cmd_Argv(0));
|
||||
net->waypoints[net->numwaypoints].org[1] = atof(Cmd_Argv(1));
|
||||
net->waypoints[net->numwaypoints].org[2] = atof(Cmd_Argv(2));
|
||||
net->waypoints[net->numwaypoints].radius = 64;//atof(Cmd_Argv(3));
|
||||
net->waypoints[net->numwaypoints].radius = atof(Cmd_Argv(3));
|
||||
numlinks = bound(0, atoi(Cmd_Argv(4)), maxlinks);
|
||||
|
||||
//make sure the links are valid, and clamp to avoid problems (even if we're then going to mis-parse.
|
||||
|
@ -1127,7 +1127,7 @@ void QCBUILTIN PF_route_calculate (pubprogfuncs_t *prinst, struct globalvars_s *
|
|||
|
||||
COM_AddWork(WG_LOADER, Route_Calculate, NULL, route, 0, 0);
|
||||
}
|
||||
#ifndef SERVERONLY
|
||||
#ifdef HAVE_CLIENT
|
||||
static void Route_Visualise_f(void)
|
||||
{
|
||||
extern world_t csqc_world;
|
||||
|
@ -1252,17 +1252,17 @@ void PR_Route_Shutdown (world_t *world)
|
|||
|
||||
static void Route_Reload_f(void)
|
||||
{
|
||||
#if !defined(SERVERONLY) && defined(CSQC_DAT)
|
||||
#if defined(HAVE_CLIENT) && defined(CSQC_DAT)
|
||||
extern world_t csqc_world;
|
||||
PR_Route_Shutdown(&csqc_world);
|
||||
#endif
|
||||
#ifndef CLIENTONLY
|
||||
#ifdef HAVE_SERVER
|
||||
PR_Route_Shutdown(&sv.world);
|
||||
#endif
|
||||
}
|
||||
void PR_Route_Init (void)
|
||||
{
|
||||
#if !defined(SERVERONLY) && defined(CSQC_DAT)
|
||||
#if defined(HAVE_CLIENT) && defined(CSQC_DAT)
|
||||
Cvar_Register(&route_shownodes, NULL);
|
||||
Cmd_AddCommand("route_visualise", Route_Visualise_f);
|
||||
#endif
|
||||
|
|
|
@ -1458,8 +1458,7 @@ void QDECL SVQ1_StartSound (float *origin, wedict_t *wentity, int channel, const
|
|||
{
|
||||
edict_t *entity = (edict_t*)wentity;
|
||||
int i, solid;
|
||||
vec3_t originbuf;
|
||||
float *velocity = NULL;
|
||||
vec3_t originbuf, velocity={0,0,0};
|
||||
if (!origin)
|
||||
{
|
||||
origin = originbuf;
|
||||
|
@ -1487,7 +1486,7 @@ void QDECL SVQ1_StartSound (float *origin, wedict_t *wentity, int channel, const
|
|||
}
|
||||
|
||||
if (chflags & CF_SV_SENDVELOCITY)
|
||||
velocity = entity->v->velocity;
|
||||
VectorCopy(entity->v->velocity, velocity);
|
||||
}
|
||||
|
||||
SV_StartSound(NUM_FOR_EDICT(svprogfuncs, entity), origin, velocity, entity->xv->dimension_seen, channel, sample, volume, attenuation, pitchadj, timeofs, chflags);
|
||||
|
@ -1629,7 +1628,7 @@ void SV_SendFixAngle(client_t *client, sizebuf_t *msg, int fixtype, qboolean rol
|
|||
unsigned i;
|
||||
client_t *controller = client->controller?client->controller:client;
|
||||
edict_t *ent = client->edict;
|
||||
float *ang;
|
||||
pvec_t *ang;
|
||||
if (!ent || client->protocol == SCP_QUAKE2)
|
||||
return;
|
||||
ang = ent->v->fixangle?ent->v->angles:ent->v->v_angle; //angles is just WEIRD for mdls, but then quake sucks.
|
||||
|
|
|
@ -8847,8 +8847,7 @@ void SV_UserInit (void)
|
|||
|
||||
|
||||
static vec3_t forward, right, up, wishdir;
|
||||
static float *origin, *velocity, *angles;
|
||||
static float wishspeed;
|
||||
static pvec_t *origin, *velocity, *angles;
|
||||
extern cvar_t sv_accelerate, sv_friction;
|
||||
static qboolean onground;
|
||||
|
||||
|
@ -8904,7 +8903,7 @@ static void SV_UserFriction (void)
|
|||
vel[2] = vel[2] * newspeed;
|
||||
}
|
||||
|
||||
static void SV_Accelerate (void)
|
||||
static void SV_Accelerate (float wishspeed)
|
||||
{
|
||||
int i;
|
||||
float addspeed, accelspeed, currentspeed;
|
||||
|
@ -8921,7 +8920,7 @@ static void SV_Accelerate (void)
|
|||
velocity[i] += accelspeed*wishdir[i];
|
||||
}
|
||||
|
||||
static void SV_AirAccelerate (vec3_t wishveloc)
|
||||
static void SV_AirAccelerate (vec3_t wishveloc, float wishspeed)
|
||||
{
|
||||
int i;
|
||||
float addspeed, wishspd, accelspeed, currentspeed;
|
||||
|
@ -8954,6 +8953,7 @@ static void SV_AirMove (void)
|
|||
vec3_t wishvel;
|
||||
float fmove, smove;
|
||||
float scale, maxspeed;
|
||||
float wishspeed;
|
||||
|
||||
AngleVectors (sv_player->v->angles, forward, right, up);
|
||||
|
||||
|
@ -8999,11 +8999,11 @@ static void SV_AirMove (void)
|
|||
else if ( onground )
|
||||
{
|
||||
SV_UserFriction ();
|
||||
SV_Accelerate ();
|
||||
SV_Accelerate (wishspeed);
|
||||
}
|
||||
else
|
||||
{ // not on ground, so little effect on velocity
|
||||
SV_AirAccelerate (wishvel);
|
||||
SV_AirAccelerate (wishvel, wishspeed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9234,7 +9234,7 @@ void SV_ClientThink (void)
|
|||
VectorCopy (sv_player->v->v_angle, v_angle);
|
||||
// VectorAdd (sv_player->v->v_angle, sv_player->v->punchangle, v_angle);
|
||||
//FIXME: gravitydir stuff, the roll value gets destroyed for intents
|
||||
angles[ROLL] = V_CalcRoll (sv_player->v->angles, sv_player->v->velocity)*4;
|
||||
angles[ROLL] = V_CalcRoll (angles, velocity)*4;
|
||||
if (!sv_player->v->fixangle)
|
||||
{
|
||||
angles[PITCH] = -v_angle[PITCH]/3;
|
||||
|
|
|
@ -511,8 +511,8 @@ SV_LinkEdict
|
|||
*/
|
||||
void QDECL World_LinkEdict (world_t *w, wedict_t *ent, qboolean touch_triggers)
|
||||
{
|
||||
vec_t *mins;
|
||||
vec_t *maxs;
|
||||
pvec_t *mins;
|
||||
pvec_t *maxs;
|
||||
int solid;
|
||||
|
||||
#ifdef USEAREAGRID
|
||||
|
|
|
@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//#define vec3_origin vec3_origin_
|
||||
//static vec3_t vec3_origin;
|
||||
#define VectorCompare VectorCompare_
|
||||
static int VectorCompare (const vec3_t v1, const vec3_t v2)
|
||||
static int VectorCompare (const pvec3_t v1, const pvec3_t v2)
|
||||
{
|
||||
int i;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
|
@ -216,7 +216,7 @@ static btTransform transformFromQuake(world_t *world, wedict_t *ent)
|
|||
vec3_t forward, left, up;
|
||||
if (NegativeMeshPitch(world, ent))
|
||||
{
|
||||
vec3_t iangles = {-ent->v->angles[0], ent->v->angles[1], ent->v->angles[2]};
|
||||
pvec3_t iangles = {-ent->v->angles[0], ent->v->angles[1], ent->v->angles[2]};
|
||||
rbefuncs->AngleVectors(iangles, forward, left, up);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue