various small bugfixes, mvd+voip should work again, qcjit changes, towards usability.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3700 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2010-12-18 17:02:47 +00:00
parent 610e66b431
commit 4505f7321b
34 changed files with 1102 additions and 1097 deletions

View file

@ -1769,8 +1769,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
}
#ifdef PEXT2_VOICECHAT
if (cls.fteprotocolextensions2 & PEXT2_VOICECHAT)
S_Voip_Transmit(clc_voicechat, &buf);
S_Voip_Transmit(clc_voicechat, &buf);
#endif
//

View file

@ -3380,7 +3380,7 @@ float Host_Frame (double time)
if (!spare)
return 1;
//realtime -= spare/1000; //don't use it all!
realtime -= spare/1000; //don't use it all!
}
}
else

View file

@ -354,13 +354,6 @@ void P_LoadedModel(model_t *mod)
mod->particleeffect = P_INVALID;
mod->particletrail = P_INVALID;
mod->engineflags &= ~(MDLF_NODEFAULTTRAIL | MDLF_ENGULPHS);
if (mod->type == mod_brush)
{
if (*mod->name != '*')
for (j = 0; j < mod->numtextures; j++)
mod->textures[j]->parttype = P_FindParticleType(va("tex_%s", mod->textures[j]->name));
}
for(ae = associatedeffect; ae; ae = ae->next)
{
if (!strcmp(ae->mname, mod->name))

View file

@ -175,7 +175,7 @@ static void PClassic_ParticleTrailIndex (vec3_t start, vec3_t end, int color, in
}
//this function is called to tell the particle system about surfaces that might emit particles at map startup.
static void PClassic_EmitSkyEffectTris(model_t *mod, msurface_t *fa)
static void PClassic_EmitSkyEffectTris(model_t *mod, msurface_t *fa, int ptype)
{
}
@ -228,6 +228,7 @@ static qboolean PClassic_InitParticles (void)
static void PClassic_ShutdownParticles(void)
{
BZ_Free(particles);
particles = NULL;
}
//called when an entity is removed from the world, taking its trailstate with it.

View file

@ -29,7 +29,7 @@ static void PNULL_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int eff
static void PNULL_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count){}
static void PNULL_ParticleTrailIndex (vec3_t start, vec3_t end, int color, int crnd, trailstate_t **tsk){}
static void PNULL_EmitSkyEffectTris(model_t *mod, msurface_t *fa){}
static void PNULL_EmitSkyEffectTris(model_t *mod, msurface_t *fa, int ptype){}
static qboolean PNULL_InitParticles (void)
{

View file

@ -2130,7 +2130,7 @@ static void P_AddRainParticles(void)
}
}
static void R_Part_SkyTri(float *v1, float *v2, float *v3, msurface_t *surf)
static void R_Part_SkyTri(float *v1, float *v2, float *v3, msurface_t *surf, int ptype)
{
float dot;
float xm;
@ -2142,7 +2142,7 @@ static void R_Part_SkyTri(float *v1, float *v2, float *v3, msurface_t *surf)
skytris_t *st;
st = Hunk_Alloc(sizeof(skytris_t));
st->next = part_type[surf->texinfo->texture->parttype].skytris;
st->next = part_type[ptype].skytris;
VectorCopy(v1, st->org);
VectorSubtract(v2, st->org, st->x);
VectorSubtract(v3, st->org, st->y);
@ -2165,12 +2165,12 @@ static void R_Part_SkyTri(float *v1, float *v2, float *v3, msurface_t *surf)
if (st->area<=0)
return;//bummer.
part_type[surf->texinfo->texture->parttype].skytris = st;
part_type[ptype].skytris = st;
}
static void PScript_EmitSkyEffectTris(model_t *mod, msurface_t *fa)
static void PScript_EmitSkyEffectTris(model_t *mod, msurface_t *fa, int ptype)
{
vec3_t verts[64];
int v1;
@ -2180,6 +2180,9 @@ static void PScript_EmitSkyEffectTris(model_t *mod, msurface_t *fa)
int i, lindex;
float *vec;
if (ptype < 0 || ptype >= numparticletypes)
return;
//
// convert edges back to a normal polygon
//
@ -2206,7 +2209,7 @@ static void PScript_EmitSkyEffectTris(model_t *mod, msurface_t *fa)
v2 = 1;
for (v3 = 2; v3 < numverts; v3++)
{
R_Part_SkyTri(verts[v1], verts[v2], verts[v3], fa);
R_Part_SkyTri(verts[v1], verts[v2], verts[v3], fa, ptype);
v2 = v3;
}
@ -4210,7 +4213,7 @@ static void PScript_DrawParticleTypes (void (*texturedparticles)(int count, part
b = b->next;
}
continue;
goto endtype;
}
//kill off early ones.
@ -4463,8 +4466,8 @@ static void PScript_DrawParticleTypes (void (*texturedparticles)(int count, part
}
}
// if (b->p->die < particletime)
// b->flags |= BS_DEAD;
if (b->p->die < particletime)
b->flags |= BS_DEAD;
}
}
else
@ -4482,6 +4485,8 @@ static void PScript_DrawParticleTypes (void (*texturedparticles)(int count, part
}
}
endtype:
// delete from run list if necessary
if (!type->particles && !type->beams && !type->clippeddecals)
{

File diff suppressed because it is too large Load diff

View file

@ -215,7 +215,7 @@ int MP_TranslateDPtoFTECodes(int code)
}
//string findkeysforcommand(string command) = #610;
void PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *cmdname = PR_GetStringOfs(prinst, OFS_PARM0);
int keynums[2];
@ -231,13 +231,13 @@ void PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_s *pr_glob
RETURN_TSTRING(keyname);
}
void PF_cl_getkeybind (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_getkeybind (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *binding = Key_GetBinding(G_FLOAT(OFS_PARM0));
RETURN_TSTRING(binding);
}
void PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
int modifier;
@ -255,7 +255,7 @@ void PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//string keynumtostring(float keynum) = #609;
void PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int code = G_FLOAT(OFS_PARM0);
@ -272,7 +272,7 @@ void PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
void PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
float *size = G_VECTOR(OFS_PARM1);
@ -285,7 +285,7 @@ void PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 1;
}
//void drawsetcliparea(float x, float y, float width, float height) = #458;
void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float x = G_FLOAT(OFS_PARM0), y = G_FLOAT(OFS_PARM1), w = G_FLOAT(OFS_PARM2), h = G_FLOAT(OFS_PARM3);
@ -315,7 +315,7 @@ void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals
G_FLOAT(OFS_RETURN) = 0;
}
//void drawresetcliparea(void) = #459;
void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
@ -328,7 +328,7 @@ void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globa
G_FLOAT(OFS_RETURN) = 0;
}
void PF_CL_DrawTextField (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_DrawTextField (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
float *size = G_VECTOR(OFS_PARM1);
@ -338,7 +338,7 @@ void PF_CL_DrawTextField (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float drawstring(vector position, string text, vector scale, float alpha, float flag) = #455;
void PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
char *text = PR_GetStringOfs(prinst, OFS_PARM1);
@ -368,7 +368,7 @@ void PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_s *pr_glob
Font_EndString(font_conchar);
}
void PF_CL_stringwidth(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_stringwidth(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *text = PR_GetStringOfs(prinst, OFS_PARM0);
qboolean usecolours = G_FLOAT(OFS_PARM1);
@ -406,7 +406,7 @@ static void PF_SelectDPDrawFlag(int flag)
}
//float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
char *picname = PR_GetStringOfs(prinst, OFS_PARM1);
@ -429,7 +429,7 @@ void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 1;
}
void PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
float *size = G_VECTOR(OFS_PARM1);
@ -459,7 +459,7 @@ void PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;
@ -471,7 +471,7 @@ void PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 1;
}
void PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;
mpic_t *pic;
@ -503,7 +503,7 @@ void PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_INT(OFS_RETURN) = 0;
}
void PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;
@ -514,7 +514,7 @@ void PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
void PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
int chara = G_FLOAT(OFS_PARM1);
@ -540,7 +540,7 @@ void PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 1;
}
//float drawrawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
void PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
char *text = PR_GetStringOfs(prinst, OFS_PARM1);
@ -569,7 +569,7 @@ void PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//void (float width, vector rgb, float alpha, float flags, vector pos1, ...) drawline;
void PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *rgb = G_VECTOR(OFS_PARM1);
float alpha = G_FLOAT(OFS_PARM2);
@ -594,7 +594,7 @@ void PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//vector drawgetimagesize(string pic) = #460;
void PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *picname = PR_GetStringOfs(prinst, OFS_PARM0);
mpic_t *p = Draw_SafeCachePic(picname);
@ -652,14 +652,14 @@ cvar_t pr_menuqc_coreonerror = SCVAR("pr_menuqc_coreonerror", "1");
//new generic functions.
//float isfunction(string function_name) = #607;
void PF_isfunction (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_isfunction (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *name = PR_GetStringOfs(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = !!PR_FindFunction(prinst, name, PR_CURRENT);
}
//void callfunction(...) = #605;
void PF_callfunction (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_callfunction (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *name;
func_t f;
@ -672,7 +672,7 @@ void PF_callfunction (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//void loadfromfile(string file) = #69;
void PF_loadfromfile (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_loadfromfile (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *filename = PR_GetStringOfs(prinst, OFS_PARM0);
char *file = COM_LoadTempFile(filename);
@ -693,7 +693,7 @@ void PF_loadfromfile (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 0;
}
void PF_loadfromdata (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_loadfromdata (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *file = PR_GetStringOfs(prinst, OFS_PARM0);
@ -713,7 +713,7 @@ void PF_loadfromdata (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 0;
}
void PF_parseentitydata(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_parseentitydata(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
void *ed = G_EDICT(prinst, OFS_PARM0);
char *file = PR_GetStringOfs(prinst, OFS_PARM1);
@ -740,7 +740,7 @@ void PF_parseentitydata(progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 0;
}
void PF_mod (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_mod (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = (float)(((int)G_FLOAT(OFS_PARM0))%((int)G_FLOAT(OFS_PARM1)));
}
@ -770,7 +770,7 @@ char *RemapCvarNameFromDPToFTE(char *name)
return name;
}
static void PF_menu_cvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_menu_cvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
cvar_t *var;
char *str;
@ -787,7 +787,7 @@ static void PF_menu_cvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
else
G_FLOAT(OFS_RETURN) = 0;
}
static void PF_menu_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_menu_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *var_name, *val;
cvar_t *var;
@ -799,7 +799,7 @@ static void PF_menu_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globa
var = Cvar_Get(var_name, val, 0, "QC variables");
Cvar_Set (var, val);
}
static void PF_menu_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_menu_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PR_GetStringOfs(prinst, OFS_PARM0);
cvar_t *cv = Cvar_Get(RemapCvarNameFromDPToFTE(str), "", 0, "QC variables");
@ -808,7 +808,7 @@ static void PF_menu_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_gl
qboolean M_Vid_GetMode(int num, int *w, int *h);
//a bit pointless really
void PF_cl_getresolution (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_getresolution (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float mode = G_FLOAT(OFS_PARM0);
float *ret = G_VECTOR(OFS_RETURN);
@ -825,7 +825,7 @@ void PF_cl_getresolution (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_nonfatalobjerror (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_nonfatalobjerror (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
struct edict_s *ed;
@ -860,7 +860,7 @@ void PF_nonfatalobjerror (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//float isserver(void) = #60;
void PF_isserver (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_isserver (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef CLIENTONLY
G_FLOAT(OFS_RETURN) = false;
@ -870,13 +870,13 @@ void PF_isserver (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float clientstate(void) = #62;
void PF_clientstate (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_clientstate (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = cls.state >= ca_connected ? 2 : 1; //fit in with netquake (we never run a menu.dat dedicated)
}
//too specific to the prinst's builtins.
static void PF_Fixme (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_Fixme (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Con_Printf("\n");
@ -886,7 +886,7 @@ static void PF_Fixme (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_CL_precache_sound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_precache_sound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;
@ -899,7 +899,7 @@ void PF_CL_precache_sound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//void setkeydest(float dest) = #601;
void PF_cl_setkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_setkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
switch((int)G_FLOAT(OFS_PARM0))
{
@ -922,7 +922,7 @@ void PF_cl_setkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
}
//float getkeydest(void) = #602;
void PF_cl_getkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_getkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
switch(key_dest)
{
@ -945,7 +945,7 @@ void PF_cl_getkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//void setmousetarget(float trg) = #603;
void PF_cl_setmousetarget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_setmousetarget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
extern int mouseusedforgui;
switch ((int)G_FLOAT(OFS_PARM0))
@ -962,14 +962,14 @@ void PF_cl_setmousetarget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float getmousetarget(void) = #604;
void PF_cl_getmousetarget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_getmousetarget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
extern int mouseusedforgui;
G_FLOAT(OFS_RETURN) = mouseusedforgui?1:2;
}
//vector getmousepos(void) = #66;
void PF_cl_getmousepos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN QCBUILTIN PF_cl_getmousepos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *ret = G_VECTOR(OFS_RETURN);
extern int mousemove_x, mousemove_y;
@ -987,7 +987,7 @@ void PF_cl_getmousepos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
static void PF_Remove_ (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_Remove_ (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
menuedict_t *ed;
@ -1002,7 +1002,7 @@ static void PF_Remove_ (progfuncs_t *prinst, struct globalvars_s *pr_globals)
ED_Free (prinst, (void*)ed);
}
static void PF_CopyEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_CopyEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
menuedict_t *in, *out;
@ -1026,7 +1026,7 @@ typedef enum{
SLIST_SORTDESCENDING
} hostcacheglobal_t;
void PF_M_gethostcachevalue (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_gethostcachevalue (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
hostcacheglobal_t hcg = G_FLOAT(OFS_PARM0);
G_FLOAT(OFS_RETURN) = 0;
@ -1062,12 +1062,12 @@ void PF_M_gethostcachevalue (progfuncs_t *prinst, struct globalvars_s *pr_global
}
//void resethostcachemasks(void) = #615;
void PF_M_resethostcachemasks(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_resethostcachemasks(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Master_ClearMasks();
}
//void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
void PF_M_sethostcachemaskstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_sethostcachemaskstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int mask = G_FLOAT(OFS_PARM0);
int field = G_FLOAT(OFS_PARM1);
@ -1077,7 +1077,7 @@ void PF_M_sethostcachemaskstring(progfuncs_t *prinst, struct globalvars_s *pr_gl
Master_SetMaskString(mask, field, str, op);
}
//void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
void PF_M_sethostcachemasknumber(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_sethostcachemasknumber(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int mask = G_FLOAT(OFS_PARM0);
int field = G_FLOAT(OFS_PARM1);
@ -1087,22 +1087,22 @@ void PF_M_sethostcachemasknumber(progfuncs_t *prinst, struct globalvars_s *pr_gl
Master_SetMaskInteger(mask, field, str, op);
}
//void resorthostcache(void) = #618;
void PF_M_resorthostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_resorthostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Master_SortServers();
}
//void sethostcachesort(float fld, float descending) = #619;
void PF_M_sethostcachesort(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_sethostcachesort(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Master_SetSortField(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1));
}
//void refreshhostcache(void) = #620;
void PF_M_refreshhostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_refreshhostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
MasterInfo_Begin();
}
//float gethostcachenumber(float fld, float hostnr) = #621;
void PF_M_gethostcachenumber(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_gethostcachenumber(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float ret = 0;
int keynum = G_FLOAT(OFS_PARM0);
@ -1114,7 +1114,7 @@ void PF_M_gethostcachenumber(progfuncs_t *prinst, struct globalvars_s *pr_global
G_FLOAT(OFS_RETURN) = ret;
}
void PF_M_gethostcachestring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_gethostcachestring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *ret;
int keynum = G_FLOAT(OFS_PARM0);
@ -1128,25 +1128,25 @@ void PF_M_gethostcachestring (progfuncs_t *prinst, struct globalvars_s *pr_globa
}
//float gethostcacheindexforkey(string key) = #622;
void PF_M_gethostcacheindexforkey(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_gethostcacheindexforkey(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *keyname = PR_GetStringOfs(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = Master_KeyForName(keyname);
}
//void addwantedhostcachekey(string key) = #623;
void PF_M_addwantedhostcachekey(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_addwantedhostcachekey(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
PF_M_gethostcacheindexforkey(prinst, pr_globals);
}
void PF_M_getextresponse(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_getextresponse(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//this does something weird
G_INT(OFS_RETURN) = 0;
}
void PF_netaddress_resolve(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_netaddress_resolve(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *address = PR_GetStringOfs(prinst, OFS_PARM0);
netadr_t adr;
@ -1181,7 +1181,7 @@ void PF_M_addwantedhostcachekey(progfuncs_t *prinst, struct globalvars_s *pr_glo
#endif
void PF_localsound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_localsound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *soundname = PR_GetStringOfs(prinst, OFS_PARM0);
S_LocalSound (soundname);
@ -1193,24 +1193,24 @@ void PF_localsound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
#define skip50 skip10 skip10 skip10 skip10 skip10
#define skip100 skip50 skip50
void PF_menu_checkextension (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_menu_checkextension (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//yeah, this is a stub... not sure what form extex
G_FLOAT(OFS_RETURN) = 0;
}
void PF_gettime (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_gettime (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = *prinst->parms->gametime;
}
void PF_CL_precache_file (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_precache_file (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
}
//entity findchainstring(.string _field, string match) = #26;
void PF_menu_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_menu_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
char *s;
@ -1243,7 +1243,7 @@ void PF_menu_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
RETURN_EDICT(prinst, (void*)chain);
}
//entity findchainfloat(.float _field, float match) = #27;
void PF_menu_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_menu_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
float s;
@ -1272,18 +1272,18 @@ void PF_menu_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_global
RETURN_EDICT(prinst, (void*)chain);
}
void PF_etof(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_etof(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = G_EDICTNUM(prinst, OFS_PARM0);
}
void PF_ftoe(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_ftoe(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int entnum = G_FLOAT(OFS_PARM0);
RETURN_EDICT(prinst, EDICT_NUM(prinst, entnum));
}
void PF_IsNotNull(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_IsNotNull(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int str = G_INT(OFS_PARM0);
G_FLOAT(OFS_RETURN) = !!str;
@ -1291,7 +1291,7 @@ void PF_IsNotNull(progfuncs_t *prinst, struct globalvars_s *pr_globals)
//float altstr_count(string str) = #82;
//returns number of single quoted strings in the string.
void PF_altstr_count(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_altstr_count(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
int count = 0;
@ -1309,7 +1309,7 @@ void PF_altstr_count(progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = count/2;
}
//string altstr_prepare(string str) = #83;
void PF_altstr_prepare(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_altstr_prepare(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char outstr[8192], *out;
char *instr, *in;
@ -1336,7 +1336,7 @@ void PF_altstr_prepare(progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_INT( OFS_RETURN ) = (int)PR_TempString( prinst, outstr );
}
//string altstr_get(string str, float num) = #84;
void PF_altstr_get(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_altstr_get(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *altstr, *pos, outstr[8192], *out;
int count, size;
@ -1382,7 +1382,7 @@ void PF_altstr_get(progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_INT( OFS_RETURN ) = (int)PR_SetString( prinst, outstr );
}
//string altstr_set(string str, float num, string set) = #85
void PF_altstr_set(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_altstr_set(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int num;
char *altstr, *str;

View file

@ -14,7 +14,7 @@ shader_t *shader_polyblend;
static mesh_t draw_mesh;
static vecV_t draw_mesh_xyz[4];
static vec2_t draw_mesh_st[4];
vec2_t draw_mesh_st[4];
static avec4_t draw_mesh_colors[4];
index_t r_quad_indexes[6] = {0, 1, 2, 2, 3, 0};

View file

@ -2522,6 +2522,7 @@ void Surf_BuildLightmaps (void)
batch_t *batch, *bstop;
vec3_t sn;
int sortid;
int ptype;
r_framecount = 1; // no dlightcache
@ -2581,6 +2582,10 @@ void Surf_BuildLightmaps (void)
for (t = m->numtextures-1; t >= 0; t--)
{
if (m == cl.worldmodel)
ptype = P_FindParticleType(va("tex_%s", m->textures[t]->name));
else
ptype = P_INVALID;
m->textures[t]->wtexno = t;
sortid = m->textures[t]->shader->sort;
@ -2591,7 +2596,7 @@ void Surf_BuildLightmaps (void)
surf = m->surfaces + i;
if (surf->texinfo->texture == m->textures[t])
{
P_EmitSkyEffectTris(m, surf);
P_EmitSkyEffectTris(m, surf, ptype);
Surf_CreateSurfaceLightmap (surf, shift);
/*the excessive logic is to give portals separate batches for separate planes*/

View file

@ -1249,6 +1249,10 @@ void NPQTV_Sys_Shutdown(void)
Host_Shutdown();
}
void Sys_RecentServer(char *command, char *target, char *title, char *desc)
{
}
#else
/*

View file

@ -724,11 +724,13 @@ static const char *FS_GetCleanPath(const char *pattern, char *outbuf, int outlen
if (strstr(pattern, "//"))
{
//amiga uses // as equivelent to /../
//so strip those out
//any other system ignores the extras
Q_strncpyz(outbuf, pattern, outlen);
pattern = outbuf;
Con_Printf("Warning: // characters in filename %s\n", pattern);
Con_DPrintf("Warning: // characters in filename %s\n", pattern);
while ((s=strstr(pattern, "//")))
{
s++;
@ -739,11 +741,15 @@ static const char *FS_GetCleanPath(const char *pattern, char *outbuf, int outlen
}
}
}
if (*pattern == '/')
{
/*'fix up' and ignore, compat with q3*/
Con_DPrintf("Error: absolute path in filename %s\n", pattern);
pattern++;
}
if (strstr(pattern, ".."))
Con_Printf("Error: '..' characters in filename %s\n", pattern);
else if (pattern[0] == '/')
Con_Printf("Error: absolute path in filename %s\n", pattern);
else if (strstr(pattern, ":")) //win32 drive seperator (or mac path seperator, but / works there and they're used to it) (or amiga device separator)
Con_Printf("Error: absolute path in filename %s\n", pattern);
else

View file

@ -2583,29 +2583,38 @@ qboolean CModQ3_LoadRFaces (lump_t *l)
else
{
//flare
// int r, g, b;
int r, g, b;
extern index_t r_quad_indexes[6];
static vec2_t st[4] = {0,0,0,1,1,1,1,0};
mesh = out->mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
mesh->xyz_array = (vecV_t *)Hunk_Alloc ( sizeof(vecV_t));
mesh->numvertexes = 1;
mesh = out->mesh = (mesh_t *)Hunk_Alloc(sizeof(mesh_t));
mesh->xyz_array = (vecV_t *)Hunk_Alloc(sizeof(vecV_t)*4);
mesh->colors4b_array = (byte_vec4_t *)Hunk_Alloc(sizeof(byte_vec4_t)*4);
mesh->numvertexes = 4;
mesh->indexes = r_quad_indexes;
mesh->st_array = st;
mesh->numindexes = 6;
VectorCopy ( in->lightmap_origin, mesh->xyz_array[0] );
VectorCopy (in->lightmap_origin, mesh->xyz_array[0]);
VectorCopy (in->lightmap_origin, mesh->xyz_array[1]);
VectorCopy (in->lightmap_origin, mesh->xyz_array[2]);
VectorCopy (in->lightmap_origin, mesh->xyz_array[3]);
/* r = LittleFloat ( in->lightmapVecs[0][0] ) * 255.0f;
r = bound ( 0, r, 255 );
r = LittleFloat(in->lightmap_vecs[0][0]) * 255.0f;
r = bound (0, r, 255);
g = LittleFloat(in->lightmap_vecs[0][1]) * 255.0f;
g = bound (0, g, 255);
b = LittleFloat(in->lightmap_vecs[0][2]) * 255.0f;
b = bound (0, b, 255);
g = LittleFloat ( in->lightmapVecs[0][1] ) * 255.0f;
g = bound ( 0, g, 255 );
b = LittleFloat ( in->lightmapVecs[0][2] ) * 255.0f;
b = bound ( 0, b, 255 );
out->dlightbits = (unsigned int)COLOR_RGB ( r, g, b );
*/ }
mesh->colors4b_array[0][0] = r;
mesh->colors4b_array[0][1] = g;
mesh->colors4b_array[0][2] = b;
mesh->colors4b_array[0][3] = 255;
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[1]);
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[2]);
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[3]);
}
}
Mod_NormaliseTextureVectors(map_normals_array, map_svector_array, map_tvector_array, numvertexes);
@ -2732,11 +2741,13 @@ qboolean CModRBSP_LoadRFaces (lump_t *l)
{
// int r, g, b;
extern index_t r_quad_indexes[6];
static vec2_t st[4] = {0,0,0,1,1,1,1,0};
mesh = out->mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
mesh->xyz_array = (vecV_t *)Hunk_Alloc ( sizeof(vecV_t));
mesh->numvertexes = 1;
mesh->indexes = r_quad_indexes;
mesh->st_array = st;
mesh->numindexes = 6;
// VectorCopy ( out->origin, mesh->xyz_array[0] );

View file

@ -137,7 +137,7 @@ typedef struct {
void (*RunParticleEffect4) (vec3_t org, float radius, int color, int effect, int count);
void (*ParticleTrailIndex) (vec3_t start, vec3_t end, int color, int crnd, trailstate_t **tsk);
void (*EmitSkyEffectTris) (struct model_s *mod, struct msurface_s *fa);
void (*EmitSkyEffectTris) (struct model_s *mod, struct msurface_s *fa, int ptype);
qboolean (*InitParticles) (void);
void (*ShutdownParticles) (void);
void (*DelinkTrailstate) (trailstate_t **tsk);

View file

@ -272,7 +272,7 @@ void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//EXTENSION: DP_QC_FINDFLAGS
//entity(entity start, float fld, float match) findflags = #449
void PF_FindFlags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_FindFlags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int e, f;
int s;
@ -298,7 +298,7 @@ void PF_FindFlags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//entity(entity start, float fld, float match) findfloat = #98
void PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int e, f;
int s;
@ -330,7 +330,7 @@ void PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
// entity (entity start, .string field, string match) find = #5;
void PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int e;
int f;
@ -370,7 +370,7 @@ void PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//Cvars
//string(string cvarname) cvar_string
void PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PR_GetStringOfs(prinst, OFS_PARM0);
cvar_t *cv = Cvar_Get(str, "", 0, "QC variables");
@ -378,7 +378,7 @@ void PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//string(string cvarname) cvar_defstring
void PF_cvar_defstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cvar_defstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PR_GetStringOfs(prinst, OFS_PARM0);
cvar_t *cv = Cvar_Get(str, "", 0, "QC variables");
@ -386,7 +386,7 @@ void PF_cvar_defstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//string(string cvarname) cvar_description
void PF_cvar_description (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cvar_description (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PR_GetStringOfs(prinst, OFS_PARM0);
cvar_t *cv = Cvar_Get(str, "", 0, "QC variables");
@ -394,7 +394,7 @@ void PF_cvar_description (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float(string name) cvar_type
void PF_cvar_type (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cvar_type (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PR_GetStringOfs(prinst, OFS_PARM0);
int ret = 0;
@ -418,7 +418,7 @@ void PF_cvar_type (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//void(string cvarname, string newvalue) cvar
void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *var_name, *val;
cvar_t *var;
@ -432,7 +432,7 @@ void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
Cvar_Set (var, val);
}
void PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *var_name;
float val;
@ -449,7 +449,7 @@ void PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float(string name, string value) registercvar
void PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *name, *value;
value = PR_GetStringOfs(prinst, OFS_PARM0);
@ -492,7 +492,7 @@ typedef struct {
} pf_fopen_files_t;
pf_fopen_files_t pf_fopen_files[MAX_QC_FILES];
void PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *name = PR_GetStringOfs(prinst, OFS_PARM0);
int fmode = G_FLOAT(OFS_PARM1);
@ -606,7 +606,7 @@ void PF_fclose_i (int fnum)
pf_fopen_files[fnum].prinst = NULL;
}
void PF_fclose (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_fclose (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int fnum = G_FLOAT(OFS_PARM0)-FIRST_QC_FILE_INDEX;
@ -625,7 +625,7 @@ void PF_fclose (progfuncs_t *prinst, struct globalvars_s *pr_globals)
PF_fclose_i(fnum);
}
void PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char c, *s, *o, *max, *eof;
int fnum = G_FLOAT(OFS_PARM0) - FIRST_QC_FILE_INDEX;
@ -678,7 +678,7 @@ void PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals)
RETURN_TSTRING(pr_string_temp);
}
void PF_fputs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_fputs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int fnum = G_FLOAT(OFS_PARM0) - FIRST_QC_FILE_INDEX;
char *msg = PF_VarString(prinst, 1, pr_globals);
@ -739,7 +739,7 @@ void PF_fcloseall (progfuncs_t *prinst)
//DP_QC_WHICHPACK
void PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *srcname = PR_GetStringOfs(prinst, OFS_PARM0);
flocation_t loc;
@ -863,7 +863,7 @@ int search_enumerate(const char *name, int fsize, void *parm)
}
//float search_begin(string pattern, float caseinsensitive, float quiet) = #74;
void PF_search_begin (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_search_begin (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ //< 0 for error, > 0 for handle.
char *pattern = PR_GetStringOfs(prinst, OFS_PARM0);
// qboolean caseinsensative = G_FLOAT(OFS_PARM1);
@ -887,13 +887,13 @@ void PF_search_begin (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = s->handle;
}
//void search_end(float handle) = #75;
void PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int handle = G_FLOAT(OFS_PARM0);
search_close(prinst, handle);
}
//float search_getsize(float handle) = #76;
void PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int handle = G_FLOAT(OFS_PARM0);
prvmsearch_t *s;
@ -914,7 +914,7 @@ void PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
}
//string search_getfilename(float handle, float num) = #77;
void PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int handle = G_FLOAT(OFS_PARM0);
int num = G_FLOAT(OFS_PARM1);
@ -952,21 +952,21 @@ void PR_fclose_progs (progfuncs_t *prinst)
////////////////////////////////////////////////////
//Entities
void PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *ent;
ent = (edict_t*)G_EDICT(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = ent->isfree;
}
void PF_num_for_edict (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_num_for_edict (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *ent;
ent = (edict_t*)G_EDICT(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = ent->entnum;
}
void PF_edict_for_num(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_edict_for_num(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *ent;
ent = (edict_t*)EDICT_NUM(prinst, G_FLOAT(OFS_PARM0));
@ -975,7 +975,7 @@ void PF_edict_for_num(progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//entity nextent(entity)
void PF_nextent (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_nextent (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
edict_t *ent;
@ -999,7 +999,7 @@ void PF_nextent (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//entity() spawn
void PF_Spawn (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_Spawn (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
struct edict_s *ed;
ed = ED_Alloc(prinst);
@ -1011,20 +1011,20 @@ void PF_Spawn (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//String functions
//PF_dprint
void PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Con_DPrintf ("%s",PF_VarString(prinst, 0, pr_globals));
}
//PF_print
void PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Con_Printf ("%s",PF_VarString(prinst, 0, pr_globals));
}
//FTE_STRINGS
//C style strncasecmp (compare first n characters - case insensative)
void PF_strncasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strncasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *a = PR_GetStringOfs(prinst, OFS_PARM0);
char *b = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1035,7 +1035,7 @@ void PF_strncasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//FTE_STRINGS
//C style strcasecmp (case insensative string compare)
void PF_strcasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strcasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *a = PR_GetStringOfs(prinst, OFS_PARM0);
char *b = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1045,7 +1045,7 @@ void PF_strcasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//FTE_STRINGS
//C style strncmp (compare first n characters - case sensative. Note that there is no strcmp provided)
void PF_strncmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strncmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *a = PR_GetStringOfs(prinst, OFS_PARM0);
char *b = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1055,7 +1055,7 @@ void PF_strncmp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//uses qw style \key\value strings
void PF_infoget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_infoget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *info = PR_GetStringOfs(prinst, OFS_PARM0);
char *key = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1066,7 +1066,7 @@ void PF_infoget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//uses qw style \key\value strings
void PF_infoadd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_infoadd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *info = PR_GetStringOfs(prinst, OFS_PARM0);
char *key = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1081,7 +1081,7 @@ void PF_infoadd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//string(float pad, string str1, ...) strpad
void PF_strpad (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strpad (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char destbuf[4096];
char *dest = destbuf;
@ -1206,7 +1206,7 @@ static int chrchar_alpha(int i, int basec, int baset, int convc, int convt, int
}
//FTE_STRINGS
//bulk convert a string. change case or colouring.
void PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int ccase = G_FLOAT(OFS_PARM0); //0 same, 1 lower, 2 upper
int redalpha = G_FLOAT(OFS_PARM1); //0 same, 1 white, 2 red, 5 alternate, 6 alternate-alternate
@ -1254,7 +1254,7 @@ void PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//FTE_STRINGS
//returns a string containing one character per parameter (up to the qc max params of 8).
void PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
@ -1267,7 +1267,7 @@ void PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//FTE_STRINGS
//returns character at position X
void PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *instr = PR_GetStringOfs(prinst, OFS_PARM0);
int ofs = (*prinst->callargc>1)?G_FLOAT(OFS_PARM1):0;
@ -1283,7 +1283,7 @@ void PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//FTE_STRINGS
//strstr, without generating a new string. Use in conjunction with FRIK_FILE's substring for more similar strstr.
void PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *instr = PR_GetStringOfs(prinst, OFS_PARM0);
char *match = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1304,7 +1304,7 @@ void PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float(string input) stof
void PF_stof (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_stof (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
@ -1314,7 +1314,7 @@ void PF_stof (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//tstring(float input) ftos
void PF_ftos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_ftos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float v;
char pr_string_temp[64];
@ -1330,7 +1330,7 @@ void PF_ftos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//tstring(integer input) itos
void PF_itos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_itos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int v;
char pr_string_temp[64];
@ -1341,7 +1341,7 @@ void PF_itos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//int(string input) stoi
void PF_stoi (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_stoi (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *input = PR_GetStringOfs(prinst, OFS_PARM0);
@ -1349,7 +1349,7 @@ void PF_stoi (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//tstring(integer input) htos
void PF_htos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_htos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
unsigned int v;
char pr_string_temp[64];
@ -1360,7 +1360,7 @@ void PF_htos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//int(string input) stoh
void PF_stoh (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_stoh (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *input = PR_GetStringOfs(prinst, OFS_PARM0);
@ -1369,7 +1369,7 @@ void PF_stoh (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//vector(string s) stov = #117
//returns vector value from a string
void PF_stov (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_stov (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
char *s;
@ -1397,7 +1397,7 @@ void PF_stov (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//tstring(vector input) vtos
void PF_vtos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_vtos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char pr_string_temp[64];
//sprintf (pr_string_temp, "'%5.1f %5.1f %5.1f'", G_VECTOR(OFS_PARM0)[0], G_VECTOR(OFS_PARM0)[1], G_VECTOR(OFS_PARM0)[2]);
@ -1405,7 +1405,7 @@ void PF_vtos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
RETURN_TSTRING(pr_string_temp);
}
void PF_forgetstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_forgetstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s=PR_RemoveProgsString(prinst, G_INT(OFS_PARM0));
if (!s)
@ -1429,7 +1429,7 @@ void PF_forgetstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
void PF_dupstring(progfuncs_t *prinst, struct globalvars_s *pr_globals) //frik_file
void QCBUILTIN PF_dupstring(progfuncs_t *prinst, struct globalvars_s *pr_globals) //frik_file
{
char *s, *in;
int len;
@ -1443,7 +1443,7 @@ void PF_dupstring(progfuncs_t *prinst, struct globalvars_s *pr_globals) //frik_f
}
//returns a section of a string as a tempstring
void PF_substring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_substring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, start, length;
char *s;
@ -1483,7 +1483,7 @@ void PF_substring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//string(string str1, string str2) strcat
void PF_strcat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strcat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char dest[4096];
char *src = PF_VarString(prinst, 0, pr_globals);
@ -1491,13 +1491,13 @@ void PF_strcat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
RETURN_TSTRING(dest);
}
void PF_strlen(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strlen(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = strlen(PR_GetStringOfs(prinst, OFS_PARM0));
}
//float(string input, string token) instr
void PF_instr (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_instr (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *sub;
char *s1;
@ -1520,7 +1520,7 @@ void PF_instr (progfuncs_t *prinst, struct globalvars_s *pr_globals)
RETURN_SSTRING(sub); //last as long as the original string
}
void PF_strreplace (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strreplace (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char resultbuf[4096];
char *result = resultbuf;
@ -1549,7 +1549,7 @@ void PF_strreplace (progfuncs_t *prinst, struct globalvars_s *pr_globals)
else
RETURN_TSTRING(subject);
}
void PF_strireplace (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strireplace (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char resultbuf[4096];
char *result = resultbuf;
@ -1580,7 +1580,7 @@ void PF_strireplace (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//string(entity ent) etos = #65
void PF_etos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_etos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char s[64];
snprintf (s, sizeof(s), "entity %i", G_EDICTNUM(prinst, OFS_PARM0));
@ -1589,7 +1589,7 @@ void PF_etos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//DP_QC_STRINGCOLORFUNCTIONS
// #476 float(string s) strlennocol - returns how many characters are in a string, minus color codes
void PF_strlennocol (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strlennocol (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *in = PR_GetStringOfs(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = COM_FunStringLength(in);
@ -1597,7 +1597,7 @@ void PF_strlennocol (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//DP_QC_STRINGCOLORFUNCTIONS
// string (string s) strdecolorize - returns the passed in string with color codes stripped
void PF_strdecolorize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strdecolorize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *in = PR_GetStringOfs(prinst, OFS_PARM0);
char result[8192];
@ -1609,7 +1609,7 @@ void PF_strdecolorize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//DP_QC_STRING_CASE_FUNCTIONS
void PF_strtolower (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strtolower (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *in = PR_GetStringOfs(prinst, OFS_PARM0);
char result[8192];
@ -1621,7 +1621,7 @@ void PF_strtolower (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//DP_QC_STRING_CASE_FUNCTIONS
void PF_strtoupper (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strtoupper (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *in = PR_GetStringOfs(prinst, OFS_PARM0);
char result[8192];
@ -1633,7 +1633,7 @@ void PF_strtoupper (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//DP_QC_STRFTIME
void PF_strftime (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strftime (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *in = PF_VarString(prinst, 1, pr_globals);
char result[8192];
@ -1669,7 +1669,7 @@ struct strbuf {
struct strbuf strbuflist[NUMSTRINGBUFS];
// #440 float() buf_create (DP_QC_STRINGBUFFERS)
void PF_buf_create (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_buf_create (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
@ -1689,7 +1689,7 @@ void PF_buf_create (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 0;
}
// #441 void(float bufhandle) buf_del (DP_QC_STRINGBUFFERS)
void PF_buf_del (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_buf_del (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
int bufno = G_FLOAT(OFS_PARM0)-1;
@ -1710,7 +1710,7 @@ void PF_buf_del (progfuncs_t *prinst, struct globalvars_s *pr_globals)
strbuflist[bufno].prinst = NULL;
}
// #442 float(float bufhandle) buf_getsize (DP_QC_STRINGBUFFERS)
void PF_buf_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_buf_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bufno = G_FLOAT(OFS_PARM0)-1;
@ -1722,7 +1722,7 @@ void PF_buf_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = strbuflist[bufno].used;
}
// #443 void(float bufhandle_from, float bufhandle_to) buf_copy (DP_QC_STRINGBUFFERS)
void PF_buf_copy (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_buf_copy (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int buffrom = G_FLOAT(OFS_PARM0)-1;
int bufto = G_FLOAT(OFS_PARM1)-1;
@ -1740,7 +1740,7 @@ void PF_buf_copy (progfuncs_t *prinst, struct globalvars_s *pr_globals)
Con_Printf("PF_buf_copy: stub\n");
}
// #444 void(float bufhandle, float sortpower, float backward) buf_sort (DP_QC_STRINGBUFFERS)
void PF_buf_sort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_buf_sort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bufno = G_FLOAT(OFS_PARM0)-1;
//int sortpower = G_FLOAT(OFS_PARM1);
@ -1754,7 +1754,7 @@ void PF_buf_sort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
Con_Printf("PF_buf_sort: stub\n");
}
// #445 string(float bufhandle, string glue) buf_implode (DP_QC_STRINGBUFFERS)
void PF_buf_implode (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_buf_implode (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bufno = G_FLOAT(OFS_PARM0)-1;
//char *glue = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1769,7 +1769,7 @@ void PF_buf_implode (progfuncs_t *prinst, struct globalvars_s *pr_globals)
RETURN_TSTRING("");
}
// #446 string(float bufhandle, float string_index) bufstr_get (DP_QC_STRINGBUFFERS)
void PF_bufstr_get (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_bufstr_get (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bufno = G_FLOAT(OFS_PARM0)-1;
int index = G_FLOAT(OFS_PARM1);
@ -1794,7 +1794,7 @@ void PF_bufstr_get (progfuncs_t *prinst, struct globalvars_s *pr_globals)
RETURN_TSTRING(strbuflist[bufno].strings[index]);
}
// #447 void(float bufhandle, float string_index, string str) bufstr_set (DP_QC_STRINGBUFFERS)
void PF_bufstr_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_bufstr_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bufno = G_FLOAT(OFS_PARM0)-1;
int index = G_FLOAT(OFS_PARM1);
@ -1820,7 +1820,7 @@ void PF_bufstr_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
strbuflist[bufno].used = index+1;
}
// #448 float(float bufhandle, string str, float order) bufstr_add (DP_QC_STRINGBUFFERS)
void PF_bufstr_add (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_bufstr_add (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bufno = G_FLOAT(OFS_PARM0)-1;
//char *string = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1836,7 +1836,7 @@ void PF_bufstr_add (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = 0;
}
// #449 void(float bufhandle, float string_index) bufstr_free (DP_QC_STRINGBUFFERS)
void PF_bufstr_free (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_bufstr_free (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bufno = G_FLOAT(OFS_PARM0)-1;
//int index = G_FLOAT(OFS_PARM1);
@ -1849,7 +1849,7 @@ void PF_bufstr_free (progfuncs_t *prinst, struct globalvars_s *pr_globals)
Con_Printf("PF_bufstr_free: stub\n");
}
void PF_buf_cvarlist (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_buf_cvarlist (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bufno = G_FLOAT(OFS_PARM0)-1;
//char *pattern = PR_GetStringOfs(prinst, OFS_PARM1);
@ -1867,7 +1867,7 @@ void PF_buf_cvarlist (progfuncs_t *prinst, struct globalvars_s *pr_globals)
////////////////////////////////////////////////////
//float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16)
void PF_crc16 (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_crc16 (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int insens = G_FLOAT(OFS_PARM0);
char *str = PF_VarString(prinst, 1, pr_globals);
@ -1880,7 +1880,7 @@ void PF_crc16 (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
// #510 string(string in) uri_escape = #510;
void PF_uri_escape (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_uri_escape (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
static const char *hex = "0123456789ABCDEF";
@ -1906,7 +1906,7 @@ void PF_uri_escape (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
// #511 string(string in) uri_unescape = #511;
void PF_uri_unescape (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_uri_unescape (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
unsigned char *s = (unsigned char*)PR_GetStringOfs(prinst, OFS_PARM0);
unsigned char resultbuf[8192];
@ -1962,7 +1962,7 @@ static struct {
} qctoken[MAXQCTOKENS];
unsigned int qctoken_count;
void PF_ArgC (progfuncs_t *prinst, struct globalvars_s *pr_globals) //85 //float() argc;
void QCBUILTIN PF_ArgC (progfuncs_t *prinst, struct globalvars_s *pr_globals) //85 //float() argc;
{
G_FLOAT(OFS_RETURN) = qctoken_count;
}
@ -1999,17 +1999,17 @@ int tokenizeqc(char *str, qboolean dpfuckage)
}
/*KRIMZON_SV_PARSECLIENTCOMMAND added these two - note that for compatibility with DP, this tokenize builtin is veeery vauge and doesn't match the console*/
void PF_Tokenize (progfuncs_t *prinst, struct globalvars_s *pr_globals) //84 //void(string str) tokanize;
void QCBUILTIN PF_Tokenize (progfuncs_t *prinst, struct globalvars_s *pr_globals) //84 //void(string str) tokanize;
{
G_FLOAT(OFS_RETURN) = tokenizeqc(PR_GetStringOfs(prinst, OFS_PARM0), true);
}
void PF_tokenize_console (progfuncs_t *prinst, struct globalvars_s *pr_globals) //84 //void(string str) tokanize;
void QCBUILTIN PF_tokenize_console (progfuncs_t *prinst, struct globalvars_s *pr_globals) //84 //void(string str) tokanize;
{
G_FLOAT(OFS_RETURN) = tokenizeqc(PR_GetStringOfs(prinst, OFS_PARM0), false);
}
void PF_tokenizebyseparator (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_tokenizebyseparator (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PR_GetStringOfs(prinst, OFS_PARM0);
char *sep[7];
@ -2078,7 +2078,7 @@ void PF_tokenizebyseparator (progfuncs_t *prinst, struct globalvars_s *pr_globa
G_FLOAT(OFS_RETURN) = qctoken_count;
}
void PF_argv_start_index (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_argv_start_index (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int idx = G_FLOAT(OFS_PARM0);
@ -2092,7 +2092,7 @@ void PF_argv_start_index (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = qctoken[idx].start;
}
void PF_argv_end_index (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_argv_end_index (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int idx = G_FLOAT(OFS_PARM0);
@ -2106,7 +2106,7 @@ void PF_argv_end_index (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = qctoken[idx].end;
}
void PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals) //86 //string(float num) argv;
void QCBUILTIN PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals) //86 //string(float num) argv;
{
int idx = G_FLOAT(OFS_PARM0);
@ -2124,7 +2124,7 @@ void PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals) //86 /
////////////////////////////////////////////////////
//Maths functions
void PF_random (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_random (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float num;
@ -2134,7 +2134,7 @@ void PF_random (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float(float number, float quantity) bitshift = #218;
void PF_bitshift(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_bitshift(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int bitmask;
int shift;
@ -2151,7 +2151,7 @@ void PF_bitshift(progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float(float a, floats) min = #94
void PF_min (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_min (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
float f;
@ -2175,7 +2175,7 @@ void PF_min (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float(float a, floats) max = #95
void PF_max (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_max (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
float f;
@ -2200,7 +2200,7 @@ void PF_max (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float(float minimum, float val, float maximum) bound = #96
void PF_bound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_bound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
if (G_FLOAT(OFS_PARM1) > G_FLOAT(OFS_PARM2))
G_FLOAT(OFS_RETURN) = G_FLOAT(OFS_PARM2);
@ -2210,51 +2210,51 @@ void PF_bound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = G_FLOAT(OFS_PARM1);
}
void PF_Sin (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_Sin (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = sin(G_FLOAT(OFS_PARM0));
}
void PF_Cos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_Cos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = cos(G_FLOAT(OFS_PARM0));
}
void PF_Sqrt (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_Sqrt (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = sqrt(G_FLOAT(OFS_PARM0));
}
void PF_pow (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_pow (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = pow(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1));
}
void PF_asin (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_asin (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = asin(G_FLOAT(OFS_PARM0));
}
void PF_acos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_acos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = acos(G_FLOAT(OFS_PARM0));
}
void PF_atan (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_atan (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = atan(G_FLOAT(OFS_PARM0));
}
void PF_atan2 (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_atan2 (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = atan2(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1));
}
void PF_tan (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_tan (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = tan(G_FLOAT(OFS_PARM0));
}
void PF_fabs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_fabs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float v;
v = G_FLOAT(OFS_PARM0);
G_FLOAT(OFS_RETURN) = fabs(v);
}
void PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float f;
f = G_FLOAT(OFS_PARM0);
@ -2264,12 +2264,12 @@ void PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = (int)(f - 0.5);
}
void PF_floor (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_floor (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = floor(G_FLOAT(OFS_PARM0));
}
void PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = ceil(G_FLOAT(OFS_PARM0));
}
@ -2279,7 +2279,7 @@ void PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//Vector functions
//vector() randomvec = #91
void PF_randomvector (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_randomvector (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
vec3_t temp;
do
@ -2292,7 +2292,7 @@ void PF_randomvector (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float vectoyaw(vector)
void PF_vectoyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_vectoyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *value1;
float yaw;
@ -2312,7 +2312,7 @@ void PF_vectoyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//float(vector) vlen
void PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *value1;
float newv;
@ -2326,7 +2326,7 @@ void PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//vector vectoangles(vector)
void PF_vectoangles (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_vectoangles (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *value1, *up;
float yaw, pitch, roll;
@ -2390,7 +2390,7 @@ void PF_vectoangles (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
//vector normalize(vector)
void PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *value1;
vec3_t newvalue;
@ -2418,7 +2418,7 @@ void PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
////////////////////////////////////////////////////
//Progs internals
void PF_Abort(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_Abort(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
prinst->AbortStack(prinst);
}
@ -2426,7 +2426,7 @@ void PF_Abort(progfuncs_t *prinst, struct globalvars_s *pr_globals)
//this func calls a function in annother progs
//it works in the same way as the above func, except that it calls by reference to a function, as opposed to by it's name
//used for entity function variables - not actually needed anymore
void PF_externrefcall (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_externrefcall (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int progsnum;
func_t f;
@ -2437,7 +2437,7 @@ void PF_externrefcall (progfuncs_t *prinst, struct globalvars_s *pr_globals)
PR_ExecuteProgram(prinst, f);
}
void PF_externset (progfuncs_t *prinst, struct globalvars_s *pr_globals) //set a value in annother progs
void QCBUILTIN PF_externset (progfuncs_t *prinst, struct globalvars_s *pr_globals) //set a value in annother progs
{
int n = G_PROG(OFS_PARM0);
int v = G_INT(OFS_PARM1);
@ -2450,7 +2450,7 @@ void PF_externset (progfuncs_t *prinst, struct globalvars_s *pr_globals) //set a
var->_int = v;
}
void PF_externvalue (progfuncs_t *prinst, struct globalvars_s *pr_globals) //return a value in annother progs
void QCBUILTIN PF_externvalue (progfuncs_t *prinst, struct globalvars_s *pr_globals) //return a value in annother progs
{
int n = G_PROG(OFS_PARM0);
char *varname = PF_VarString(prinst, 1, pr_globals);
@ -2468,7 +2468,7 @@ void PF_externvalue (progfuncs_t *prinst, struct globalvars_s *pr_globals) //ret
G_INT(OFS_RETURN) = 0;
}
void PF_externcall (progfuncs_t *prinst, struct globalvars_s *pr_globals) //this func calls a function in annother progs (by name)
void QCBUILTIN PF_externcall (progfuncs_t *prinst, struct globalvars_s *pr_globals) //this func calls a function in annother progs (by name)
{
int progsnum;
char *funcname;
@ -2506,19 +2506,16 @@ void PF_externcall (progfuncs_t *prinst, struct globalvars_s *pr_globals) //this
}
}
/*
pr_csqc.obj : error LNK2001: unresolved external symbol _ PR_BIError
*/
void PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
(*prinst->pr_trace) = true;
}
void PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
(*prinst->pr_trace) = false;
}
void PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int size = 1024*1024*8;
char *buffer = BZ_Malloc(size);
@ -2526,7 +2523,7 @@ void PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals)
COM_WriteFile("core.txt", buffer, size);
BZ_Free(buffer);
}
void PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int size = 1024*1024;
char *buffer = BZ_Malloc(size);
@ -2536,7 +2533,7 @@ void PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
BZ_Free(buffer);
}
void PF_break (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_break (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef SERVERONLY //new break code
char *s;
@ -2570,7 +2567,7 @@ Con_Printf ("break statement\n");
#endif
}
void PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
@ -2602,7 +2599,7 @@ void PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//System
//Sends text over to the client's execution buffer
void PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;

View file

@ -100,80 +100,76 @@ int MP_TranslateDPtoFTECodes(int code);
//pr_cmds.c builtins that need to be moved to a common.
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...) LIKEPRINTF(2);
void PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_floor (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Tokenize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_tokenizebyseparator (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_tokenize_console (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_argv_start_index (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_argv_end_index (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_nextent (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_randomvector (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Sin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Cos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Sqrt (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bound (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strlen(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strcat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ftos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fabs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_vtos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_etos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_stof (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_mod (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_substring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_stov (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_dupstring(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_forgetstring(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Spawn (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_min (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_max (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_pow (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_asin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_acos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_atan (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_atan2 (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_tan (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_random (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fclose (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fputs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_vectoyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_vectoangles (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_floor (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Tokenize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tokenizebyseparator (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tokenize_console (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_argv_start_index (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_argv_end_index (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_nextent (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Sin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Cos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Sqrt (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bound (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strlen(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strcat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ftos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fabs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vtos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_etos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stof (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_mod (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_substring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stov (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_dupstring(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_forgetstring(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Spawn (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_min (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_max (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_pow (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_asin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_acos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_atan (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_atan2 (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tan (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_random (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fclose (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fputs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vectoyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vectoangles (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void search_close_progs(progfuncs_t *prinst, qboolean complain);
void PF_search_begin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_break (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_crc16 (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_type (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_uri_escape (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_uri_unescape (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_itos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_stoi (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_stoh (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_htos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_begin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_break (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_crc16 (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_type (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_uri_escape (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_uri_unescape (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_itos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stoi (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stoh (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_htos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PR_fclose_progs (progfuncs_t *prinst);
char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals);
@ -186,137 +182,89 @@ char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_glob
//pr_cmds.c builtins that need to be moved to a common.
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...) LIKEPRINTF(2);
void PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_floor (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Tokenize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ArgC (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_nextent (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ArgC (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_randomvec (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Sin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Cos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Sqrt (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bound (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strlen(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strcat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ftos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fabs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_vtos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_etos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_stof (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_mod (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_substring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strreplace (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strireplace (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_stov (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_dupstring(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_forgetstring(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Spawn (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_min (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_max (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_pow (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_random (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_randomvector (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fclose (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fputs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_vectoyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_vectoangles (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_FindFlags (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strreplace (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strireplace (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_randomvector (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindFlags (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainflags (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bitshift(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bitshift(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_Abort(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_externcall (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_externrefcall (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_externvalue (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_externset (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_instr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Abort(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externcall (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externrefcall (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externvalue (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externset (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_instr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strlennocol (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strdecolorize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strtolower (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strtoupper (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strftime (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strlennocol (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strdecolorize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strtolower (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strtoupper (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strftime (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_infoadd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_infoget (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strncmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strcasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strncasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strpad (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_infoadd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_infoget (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strncmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strcasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strncasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strpad (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_edict_for_num (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_num_for_edict (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_defstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_description (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_edict_for_num (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_num_for_edict (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_defstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_description (progfuncs_t *prinst, struct globalvars_s *pr_globals);
//these functions are from pr_menu.dat
void PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_stringwidth (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_stringwidth (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cl_getkeybind (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_getkeybind (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void search_close_progs(progfuncs_t *prinst, qboolean complain);
void PF_search_begin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_create (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_del (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_copy (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_sort (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_implode (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bufstr_get (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bufstr_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bufstr_add (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_bufstr_free (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_buf_cvarlist (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_create (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_del (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_copy (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_sort (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_implode (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_get (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_add (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_free (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_cvarlist (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fclose_progs (progfuncs_t *prinst);
char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals);
@ -331,29 +279,25 @@ void PF_Common_RegisterCvars(void);
#ifdef VM_Q1
model_t *SVPR_GetCModel(world_t *w, int modelindex);
void SVPR_Event_Touch(world_t *w, wedict_t *s, wedict_t *o);
void PF_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_multicast (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_svtraceline (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_changelevel (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_applylightstyle(int style, char *val, int col);
void QCBUILTIN PF_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_multicast (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_svtraceline (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_changelevel (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_applylightstyle(int style, char *val, int col);
void PF_ambientsound_Internal (float *pos, char *samp, float vol, float attenuation);
void PF_makestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_logfrag (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ExecuteCommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_setspawnparms (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ForceInfoKey(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_precache_vwep_model(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_makestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_logfrag (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ExecuteCommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_setspawnparms (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ForceInfoKey(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_precache_vwep_model(progfuncs_t *prinst, struct globalvars_s *pr_globals);
int PF_checkclient_Internal (progfuncs_t *prinst);
void PF_precache_sound_Internal (progfuncs_t *prinst, char *s);
int PF_precache_model_Internal (progfuncs_t *prinst, char *s);

View file

@ -1692,7 +1692,7 @@
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="2"
EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="quakedef.h"

View file

@ -2583,11 +2583,13 @@ void BE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_t
shaderstate.sourcevbo = &shaderstate.dummyvbo;
shaderstate.curshader = shader;
if (shaderstate.curentity != &r_worldentity)
{
BE_SelectEntity(&r_worldentity);
shaderstate.curtime = shaderstate.updatetime - shaderstate.curentity->shaderTime;
}
shaderstate.curtexnums = texnums;
shaderstate.curlightmap = r_nulltex;
shaderstate.curdeluxmap = r_nulltex;
shaderstate.curtime = shaderstate.updatetime - shaderstate.curentity->shaderTime;
while (nummeshes--)
{
@ -2611,11 +2613,13 @@ void BE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_t
shaderstate.sourcevbo = vbo;
shaderstate.curshader = shader;
if (shaderstate.curentity != &r_worldentity)
{
BE_SelectEntity(&r_worldentity);
shaderstate.curtime = shaderstate.updatetime - shaderstate.curentity->shaderTime;
}
shaderstate.curtexnums = texnums;
shaderstate.curlightmap = r_nulltex;
shaderstate.curdeluxmap = r_nulltex;
shaderstate.curtime = realtime;
shaderstate.meshcount = nummeshes;
shaderstate.meshes = meshlist;
@ -2687,9 +2691,11 @@ void BE_SubmitBatch(batch_t *batch)
shaderstate.curshader = batch->shader;
if (shaderstate.curentity != batch->ent)
{
BE_SelectEntity(batch->ent);
shaderstate.curtime = r_refdef.time - shaderstate.curentity->shaderTime;
}
shaderstate.flags = batch->flags;
shaderstate.curtime = realtime;
if (batch->skin)
shaderstate.curtexnums = batch->skin;
else

View file

@ -1042,7 +1042,6 @@ TRACE(("dbg: RMod_LoadTextures: inittexturedescs\n"));
{
tx = Hunk_AllocName (sizeof(texture_t), loadname );
memcpy(tx, r_notexture_mip, sizeof(texture_t));
tx->parttype = -1;
sprintf(tx->name, "unnamed%i", i);
loadmodel->textures[i] = tx;
continue;
@ -1074,8 +1073,6 @@ TRACE(("dbg: RMod_LoadTextures: inittexturedescs\n"));
tx->width = mt->width;
tx->height = mt->height;
tx->parttype = P_INVALID;
if (!mt->offsets[0]) //this is a hl external style texture, load it a little later (from a wad)
{
continue;

View file

@ -245,8 +245,6 @@ typedef struct texture_s
qbyte pixbytes;
qbyte alphaed; //gl_blend needed on this surface.
int parttype;
struct shader_s *shader;
int wtexno;

View file

@ -968,10 +968,10 @@ TRACE(("dbg: GLR_NewMap: clear particles\n"));
P_ClearParticles ();
TRACE(("dbg: GLR_NewMap: wiping them stains (getting the cloth out)\n"));
Surf_WipeStains();
CL_RegisterParticles();
TRACE(("dbg: GLR_NewMap: building lightmaps\n"));
Surf_BuildLightmaps ();
CL_RegisterParticles();
TRACE(("dbg: GLR_NewMap: ui\n"));
#ifdef VM_UI

View file

@ -461,10 +461,11 @@ static void R_DrawSkyMesh(batch_t *batch, mesh_t *m, shader_t *shader)
batch_t b;
float time = cl.gametime+realtime-cl.gametimemark;
float skydist = gl_maxdist.value;
float skydist = gl_skyboxdist.value;
if (skydist<1)
skydist=gl_skyboxdist.value;
skydist/=16;
skydist=gl_maxdist.value * 0.577;
if (skydist<1)
skydist = 10000000;
VectorCopy(r_refdef.vieworg, skyent.origin);
skyent.axis[0][0] = skydist;
@ -486,6 +487,7 @@ static void R_DrawSkyMesh(batch_t *batch, mesh_t *m, shader_t *shader)
b.ent = &skyent;
b.shader = shader;
b.skin = &shader->defaulttextures;
b.texture = NULL;
BE_SubmitBatch(&b);
}

View file

@ -463,7 +463,7 @@ char *PR_RemoveProgsString (progfuncs_t *progfuncs, string_t str)
return NULL;
}
char *PR_StringToNative (progfuncs_t *progfuncs, string_t str)
char *ASMCALL PR_StringToNative (progfuncs_t *progfuncs, string_t str)
{
if ((unsigned int)str & 0xc0000000)
{

View file

@ -255,7 +255,7 @@ Returns the new program statement counter
====================
*/
void PR_AbortStack (progfuncs_t *progfuncs);
int PR_EnterFunction (progfuncs_t *progfuncs, dfunction_t *f, int progsnum)
int ASMCALL PR_EnterFunction (progfuncs_t *progfuncs, dfunction_t *f, int progsnum)
{
int i, j, c, o;
@ -312,7 +312,7 @@ int PR_EnterFunction (progfuncs_t *progfuncs, dfunction_t *f, int progsnum)
PR_LeaveFunction
====================
*/
int PR_LeaveFunction (progfuncs_t *progfuncs)
int ASMCALL PR_LeaveFunction (progfuncs_t *progfuncs)
{
int i, c;

View file

@ -14,9 +14,9 @@ optimisations:
ebx - prinst->edicttable
ecx - tmp
edx - tmp
esi -
esi -
edi - tmp (because its preserved by subfunctions
ebp -
ebp -
to use gas to provide binary opcodes:
vim -N blob.s && as blob.s && objdump.exe -d a.out
@ -81,6 +81,74 @@ void Emit4ByteJump(int statementnum, int offset)
codesize += 4;
}
enum
{
REG_EAX,
REG_ECX,
REG_EDX,
REG_EBX,
REG_ESP,
REG_EBP,
REG_ESI,
REG_EDI
};
#define XOR(sr,dr) EmitByte(0x31);EmitByte(0xc0 | (sr<<3) | dr);
#define CLEARREG(reg) XOR(reg,reg)
#define LOADREG(addr, reg) if (reg == REG_EAX) {EmitByte(0xa1);} else {EmitByte(0x8b); EmitByte((reg<<3) | 0x05);} EmitAdr(addr);
#define STOREREG(reg, addr) if (reg == REG_EAX) {EmitByte(0xa3);} else {EmitByte(0x89); EmitByte((reg<<3) | 0x05);} EmitAdr(addr);
#define STOREF(f, addr) EmitByte(0xc7);EmitByte(0x05); EmitAdr(addr);EmitFloat(f);
#define STOREI(f, addr) EmitByte(0xc7);EmitByte(0x05); EmitAdr(addr);EmitFloat(f);
#define SETREGI(val,reg) EmitByte(0xbe);EmitByte(val);EmitByte(val>>8);EmitByte(val>>16);EmitByte(val>>24);
void *LocalLoc(void)
{
return &code[codesize];
}
void *LocalJmp(int cond)
{
if (cond == OP_GOTO)
EmitByte(0xeb); //jmp
else if (cond == OP_LE)
EmitByte(0x7e); //jle
else if (cond == OP_GE)
EmitByte(0x7d); //jge
else if (cond == OP_LT)
EmitByte(0x7c); //jl
else if (cond == OP_GT)
EmitByte(0x7f); //jg
else if ((cond >= OP_NE_F && cond <= OP_NE_FNC) || cond == OP_NE_I)
EmitByte(0x75); //jne
else if ((cond >= OP_EQ_F && cond <= OP_EQ_FNC) || cond == OP_EQ_I)
EmitByte(0x74); //je
#if defined(DEBUG) && defined(_WIN32)
else
{
OutputDebugString("oh noes!\n");
return NULL;
}
#endif
EmitByte(0);
return LocalLoc();
}
void LocalJmpLoc(void *jmp, void *loc)
{
int offs;
unsigned char *a = jmp;
offs = (char *)loc - (char *)jmp;
#if defined(DEBUG) && defined(_WIN32)
if (offs > 127 || offs <= -128)
{
OutputDebugStringA("bad jump\n");
a[-2] = 0xcd;
a[-1] = 0xcc;
return;
}
#endif
a[-1] = offs;
}
void FixupJumps(void)
{
unsigned int j;
@ -108,11 +176,14 @@ void FixupJumps(void)
}
}
int PR_LeaveFunction (progfuncs_t *progfuncs);
int PR_EnterFunction (progfuncs_t *progfuncs, dfunction_t *f, int progsnum);
int ASMCALL PR_LeaveFunction (progfuncs_t *progfuncs);
int ASMCALL PR_EnterFunction (progfuncs_t *progfuncs, dfunction_t *f, int progsnum);
pbool PR_GenerateJit(progfuncs_t *progfuncs)
{
void *j0, *l0;
void *j1, *l1;
void *j2, *l2;
unsigned int i;
dstatement16_t *op = (dstatement16_t*)current_progstate->statements;
unsigned int numstatements = current_progstate->progs->numstatements;
@ -135,6 +206,8 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
for (i = 0; i < numstatements; i++)
{
statementoffsets[i] = &code[codesize];
SETREGI(op[i].op, REG_ESI);
switch(op[i].op)
{
//jumps
@ -173,25 +246,19 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
{
//assumption: anything that returns address 0 is a void or zero return.
//thus clear eax and copy that to the return vector.
EmitByte(0x31);EmitByte(0xc0);
EmitByte(0xa3);EmitAdr(glob + OFS_RETURN+0);
EmitByte(0xa3);EmitAdr(glob + OFS_RETURN+1);
EmitByte(0xa3);EmitAdr(glob + OFS_RETURN+2);
CLEARREG(REG_EAX);
STOREREG(REG_EAX, glob + OFS_RETURN+0);
STOREREG(REG_EAX, glob + OFS_RETURN+1);
STOREREG(REG_EAX, glob + OFS_RETURN+2);
}
else
{
//movl glob[A+0],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a+0);
//movl glob[A+0],edx
EmitByte(0x8b);EmitByte(0x0d);EmitAdr(glob + op[i].a+1);
//movl glob[A+0],ecx
EmitByte(0x8b);EmitByte(0x15);EmitAdr(glob + op[i].a+2);
//movl eax, glob[OFS_RET+0]
EmitByte(0xa3);EmitAdr(glob + OFS_RETURN+0);
//movl edx, glob[OFS_RET+0]
EmitByte(0x89);EmitByte(0x15);EmitAdr(glob + OFS_RETURN+1);
//movl ecx, glob[OFS_RET+0]
EmitByte(0x89);EmitByte(0x15);EmitAdr(glob + OFS_RETURN+2);
LOADREG(glob + op[i].a+0, REG_EAX);
LOADREG(glob + op[i].a+1, REG_EDX);
LOADREG(glob + op[i].a+2, REG_ECX);
STOREREG(REG_EAX, glob + OFS_RETURN+0);
STOREREG(REG_EDX, glob + OFS_RETURN+1);
STOREREG(REG_ECX, glob + OFS_RETURN+2);
}
//call leavefunction to get the return address
@ -207,14 +274,17 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
// cmp prinst->exitdepth,%edx
EmitByte(0x3b);EmitByte(0x15);EmitAdr(&prinst->exitdepth);
// je returntoc
EmitByte(0x74);EmitByte(0x09);
// mov statementoffsets[%eax*4],%eax
EmitByte(0x8b);EmitByte(0x04);EmitByte(0x85);EmitAdr(statementoffsets+1);
// jmp eax
EmitByte(0xff);EmitByte(0xe0);
j1 = LocalJmp(OP_EQ_E);
// mov statementoffsets[%eax*4],%eax
EmitByte(0x8b);EmitByte(0x04);EmitByte(0x85);EmitAdr(statementoffsets+1);
// jmp *eax
EmitByte(0xff);EmitByte(0xe0);
// returntoc:
l1 = LocalLoc();
// ret
EmitByte(0xc3);
LocalJmpLoc(j1,l1);
break;
//function calls
@ -235,7 +305,7 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
//figure out who we're calling, and what that involves
//%eax = glob[A]
EmitByte(0xa1); EmitAdr(glob + op[i].a);
LOADREG(glob + op[i].a, REG_EAX);
//eax is now the func num
//mov %eax,%ecx
@ -247,7 +317,7 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
//cmp %ecx,pr_typecurrent
EmitByte(0x39); EmitByte(0x0d); EmitAdr(&pr_typecurrent);
//je sameprogs
EmitByte(0x74); EmitByte(0x3);
j1 = LocalJmp(OP_EQ_I);
{
//can't handle switching progs
@ -266,6 +336,8 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
EmitByte(0xc3);
}
//sameprogs:
l1 = LocalLoc();
LocalJmpLoc(j1,l1);
//andl $0x00ffffff, %eax
EmitByte(0x25);Emit4Byte(0x00ffffff);
@ -286,8 +358,7 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
//cmp $0,%edx
EmitByte(0x83);EmitByte(0xfa);EmitByte(0x00);
//jl isabuiltin
EmitByte(0x7c);EmitByte(22);
j1 = LocalJmp(OP_LE);
{
//push %ecx
EmitByte(0x51);
@ -305,7 +376,8 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
EmitByte(0xff);EmitByte(0x24);EmitByte(0x85);EmitAdr(statementoffsets+1);
}
//isabuiltin:
l1 = LocalLoc();
LocalJmpLoc(j1,l1);
//push current_progstate->globals
EmitByte(0x68);EmitAdr(current_progstate->globals);
@ -321,23 +393,21 @@ pbool PR_GenerateJit(progfuncs_t *progfuncs)
//but that builtin might have been Abort()
//mov prinst->continuestatement,%eax
EmitByte(0xa1);EmitAdr(&prinst->continuestatement);
//eax is now prinst->continuestatement
LOADREG(&prinst->continuestatement, REG_EAX);
//cmp $-1,%eax
EmitByte(0x83);EmitByte(0xf8);EmitByte(0xff);
//je donebuiltincall
EmitByte(0x74);EmitByte(10+8);
j1 = LocalJmp(OP_EQ_I);
{
EmitByte(0xcc);
//jmp statementoffsets[%eax*4]
EmitByte(0xff);EmitByte(0x24);EmitByte(0x85);EmitAdr(statementoffsets+1);
//mov $-1,prinst->continuestatement
EmitByte(0xc7);EmitByte(0x05);EmitAdr(&prinst->continuestatement+1);Emit4Byte((unsigned int)-1);
EmitByte(0xc7);EmitByte(0x05);EmitAdr(&prinst->continuestatement);Emit4Byte((unsigned int)-1);
//jmp statementoffsets[%eax*4]
EmitByte(0xff);EmitByte(0x24);EmitByte(0x85);EmitAdr(statementoffsets);
}
//donebuiltincall:
l1 = LocalLoc();
LocalJmpLoc(j1,l1);
break;
case OP_MUL_F:
@ -382,16 +452,21 @@ EmitByte(0xcc);
EmitByte(0xdf);EmitByte(0xe0);
//testb 0x40,%ah
EmitByte(0xf6);EmitByte(0xc4);EmitByte(0x40);
//je noteq
EmitByte(0x74);EmitByte(0x0c);
//movl 1.0f,glob[C]
EmitByte(0xc7);EmitByte(0x05);EmitAdr(glob + op[i].c);EmitFloat(0.0f);
//jmp end
EmitByte(0xeb);EmitByte(0x0a);
//noteq:
//movl 0.0f,glob[C]
EmitByte(0xc7);EmitByte(0x05);EmitAdr(glob + op[i].c);EmitFloat(1.0f);
j1 = LocalJmp(OP_NE_F);
{
STOREF(1.0f, glob + op[i].c);
j2 = LocalJmp(OP_GOTO);
}
{
//noteq:
l1 = LocalLoc();
STOREF(0.0f, glob + op[i].c);
}
//end:
l2 = LocalLoc();
LocalJmpLoc(j1,l1);
LocalJmpLoc(j2,l2);
break;
case OP_STORE_F:
@ -399,26 +474,17 @@ EmitByte(0xcc);
case OP_STORE_ENT:
case OP_STORE_FLD:
case OP_STORE_FNC:
//movl glob[A],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a);
//movl eax,glob[B]
EmitByte(0xa3);EmitAdr(glob + op[i].b);
LOADREG(glob + op[i].a, REG_EAX);
STOREREG(REG_EAX, glob + op[i].b);
break;
case OP_STORE_V:
//movl glob[A+0],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a+0);
//movl glob[A+1],edx
EmitByte(0x8b);EmitByte(0x0d);EmitAdr(glob + op[i].a+1);
//movl glob[A+2],ecx
EmitByte(0x8b);EmitByte(0x15);EmitAdr(glob + op[i].a+2);
//movl eax, glob[B+0]
EmitByte(0xa3);EmitAdr(glob + op[i].b+0);
//movl edx, glob[B+1]
EmitByte(0x89);EmitByte(0x15);EmitAdr(glob + op[i].b+1);
//movl ecx, glob[B+2]
EmitByte(0x89);EmitByte(0x15);EmitAdr(glob + op[i].b+2);
LOADREG(glob + op[i].a+0, REG_EAX);
LOADREG(glob + op[i].a+1, REG_EDX);
LOADREG(glob + op[i].a+2, REG_ECX);
STOREREG(REG_EAX, glob + op[i].b+0);
STOREREG(REG_EDX, glob + op[i].b+1);
STOREREG(REG_ECX, glob + op[i].b+2);
break;
case OP_LOAD_F:
@ -430,10 +496,9 @@ EmitByte(0xcc);
//a is the ent number, b is the field
//c is the dest
//movl glob[A+0],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a);
//mov glob[B],ecx
EmitByte(0x8b); EmitByte(0x0d);EmitAdr(glob + op[i].b);
LOADREG(glob + op[i].a, REG_EAX);
LOADREG(glob + op[i].b, REG_ECX);
//FIXME: bound eax (ent number)
//FIXME: bound ecx (field index)
//mov (ebx,eax,4).%eax
@ -445,20 +510,18 @@ EmitByte(0xcc);
//mov fieldajust(%edx,%ecx,4),%eax //offset = progfuncs->fieldadjust
EmitByte(0x8b); EmitByte(0x84); EmitByte(0x8a); Emit4Byte(progfuncs->fieldadjust*4);
//mov edx,glob[C]
EmitByte(0xa3);EmitAdr(glob + op[i].c);
STOREREG(REG_EAX, glob + op[i].c)
if (op[i].op == OP_LOAD_V)
{
//mov fieldajust+4(%edx,%ecx,4),%eax //offset = progfuncs->fieldadjust
EmitByte(0x8b); EmitByte(0x84); EmitByte(0x8a); Emit4Byte(4+progfuncs->fieldadjust*4);
//mov edx,glob[C+1]
EmitByte(0xa3);EmitAdr(glob + op[i].c+1);
STOREREG(REG_EAX, glob + op[i].c+1)
//mov fieldajust+8(%edx,%ecx,4),%eax //offset = progfuncs->fieldadjust
EmitByte(0x8b); EmitByte(0x84); EmitByte(0x8a); Emit4Byte(4+progfuncs->fieldadjust*4);
//mov edx,glob[C+1]
EmitByte(0xa3);EmitAdr(glob + op[i].c+2);
EmitByte(0x8b); EmitByte(0x84); EmitByte(0x8a); Emit4Byte(8+progfuncs->fieldadjust*4);
STOREREG(REG_EAX, glob + op[i].c+2)
}
break;
@ -466,10 +529,9 @@ EmitByte(0xcc);
//a is the ent number, b is the field
//c is the dest
//movl glob[A+0],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a);
//mov glob[B],ecx
EmitByte(0x8b); EmitByte(0x0d);EmitAdr(glob + op[i].b);
LOADREG(glob + op[i].a, REG_EAX);
LOADREG(glob + op[i].b, REG_ECX);
//FIXME: bound eax (ent number)
//FIXME: bound ecx (field index)
//mov (ebx,eax,4).%eax
@ -481,8 +543,7 @@ EmitByte(0xcc);
//mov fieldajust(%edx,%ecx,4),%eax //offset = progfuncs->fieldadjust
//EmitByte(0x8d); EmitByte(0x84); EmitByte(0x8a); EmitByte(progfuncs->fieldadjust*4);
EmitByte(0x8d); EmitByte(0x84); EmitByte(0x8a); Emit4Byte(progfuncs->fieldadjust*4);
//mov edx,glob[C]
EmitByte(0xa3);EmitAdr(glob + op[i].c);
STOREREG(REG_EAX, glob + op[i].c);
break;
case OP_STOREP_F:
@ -490,77 +551,70 @@ EmitByte(0xcc);
case OP_STOREP_ENT:
case OP_STOREP_FLD:
case OP_STOREP_FNC:
//movl glob[A],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a);
//mov glob[B],ecx
EmitByte(0x8b); EmitByte(0x0d);EmitAdr(glob + op[i].b);
LOADREG(glob + op[i].a, REG_EAX);
LOADREG(glob + op[i].b, REG_ECX);
//mov %eax,(%ecx)
EmitByte(0x89);EmitByte(0x01);
break;
case OP_STOREP_V:
//mov glob[B],ecx
EmitByte(0x8b); EmitByte(0x0d);EmitAdr(glob + op[i].b);
//movl glob[A],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a+0);
LOADREG(glob + op[i].b, REG_ECX);
LOADREG(glob + op[i].a+0, REG_EAX);
//mov %eax,0(%ecx)
EmitByte(0x89);EmitByte(0x01);
//movl glob[A],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a+0);
LOADREG(glob + op[i].a+1, REG_EAX);
//mov %eax,4(%ecx)
EmitByte(0x89);EmitByte(0x41);EmitByte(0x04);
//movl glob[A],eax
EmitByte(0xa1);EmitAdr(glob + op[i].a+0);
LOADREG(glob + op[i].a+2, REG_EAX);
//mov %eax,8(%ecx)
EmitByte(0x89);EmitByte(0x41);EmitByte(0x08);
break;
case OP_NE_I:
case OP_NE_E:
case OP_NE_FNC:
case OP_EQ_I:
case OP_EQ_E:
case OP_EQ_FNC:
//integer equality
//movl glob[A],%eax
EmitByte(0xa1);EmitAdr(glob + op[i].a);
LOADREG(glob + op[i].a, REG_EAX);
//cmp glob[B],%eax
EmitByte(0x3b); EmitByte(0x0f); EmitAdr(glob + op[i].b);
//je 12
EmitByte(0x74);EmitByte(0x0c);
//mov 0.0f,glob[C]
EmitByte(0xc7);EmitByte(0x05); EmitAdr(glob + op[i].a);EmitFloat(0.0f);
//jmp 10
EmitByte(0xeb);EmitByte(0x0a);
//mov 1.0f,glob[C]
EmitByte(0xc7);EmitByte(0x05); EmitAdr(glob + op[i].a);EmitFloat(1.0f);
break;
case OP_NE_E:
case OP_NE_FNC:
//integer equality
//movl glob[A],%eax
EmitByte(0xa1);EmitAdr(glob + op[i].a);
//cmp glob[B],%eax
EmitByte(0x3b); EmitByte(0x0f); EmitAdr(glob + op[i].b);
//je 12
EmitByte(0x74);EmitByte(0x0c);
//mov 0.0f,glob[C]
EmitByte(0xc7);EmitByte(0x05); EmitAdr(glob + op[i].a);EmitFloat(1.0f);
//jmp 10
EmitByte(0xeb);EmitByte(0x0a);
//mov 1.0f,glob[C]
EmitByte(0xc7);EmitByte(0x05); EmitAdr(glob + op[i].a);EmitFloat(0.0f);
EmitByte(0x3b); EmitByte(0x04); EmitByte(0x25); EmitAdr(glob + op[i].b);
j1 = LocalJmp(op[i].op);
{
STOREF(1.0f, glob + op[i].c);
j2 = LocalJmp(OP_GOTO);
}
{
l1 = LocalLoc();
STOREF(0.0f, glob + op[i].c);
}
l2 = LocalLoc();
LocalJmpLoc(j1,l1);
LocalJmpLoc(j2,l2);
break;
case OP_NOT_I:
case OP_NOT_ENT:
case OP_NOT_FNC:
//cmp glob[B],%eax
EmitByte(0x8c); EmitByte(0x3d); EmitAdr(glob + op[i].a);EmitByte(0x00);
//je 12
EmitByte(0x74);EmitByte(0x0c);
//mov 0.0f,glob[C]
EmitByte(0xc7);EmitByte(0x05); EmitAdr(glob + op[i].a);EmitFloat(0.0f);
//jmp 10
EmitByte(0xeb);EmitByte(0x0a);
//mov 1.0f,glob[C]
EmitByte(0xc7);EmitByte(0x05); EmitAdr(glob + op[i].c);EmitFloat(1.0f);
//cmp glob[B],$0
EmitByte(0x83); EmitByte(0x3d); EmitAdr(glob + op[i].a); EmitByte(0x00);
j1 = LocalJmp(OP_NE_I);
{
STOREF(1.0f, glob + op[i].c);
j2 = LocalJmp(OP_GOTO);
}
{
l1 = LocalLoc();
STOREF(0.0f, glob + op[i].c);
}
l2 = LocalLoc();
LocalJmpLoc(j1,l1);
LocalJmpLoc(j2,l2);
break;
case OP_BITOR: //floats...
@ -572,10 +626,10 @@ EmitByte(0xcc);
EmitByte(0xdf); EmitByte(0x1d);EmitAdr(&tb);
//fistp ta
EmitByte(0xdf); EmitByte(0x1d);EmitAdr(&ta);
//mov ta,%eax
EmitByte(0xa1); EmitAdr(&ta);
//and tb,%eax
LOADREG(&ta, REG_EAX)
//or tb,%eax
EmitByte(0x09); EmitByte(0x05);EmitAdr(&tb);
STOREREG(REG_EAX, &tb)
//fild tb
EmitByte(0xdf); EmitByte(0x05);EmitAdr(&tb);
//fstps glob[C]
@ -591,10 +645,12 @@ EmitByte(0xcc);
EmitByte(0xdf); EmitByte(0x1d);EmitAdr(&tb);
//fistp ta
EmitByte(0xdf); EmitByte(0x1d);EmitAdr(&ta);
//mov ta,%eax
EmitByte(0xa1); EmitAdr(&ta);
/*two args are now at ta and tb*/
LOADREG(&ta, REG_EAX)
//and tb,%eax
EmitByte(0x21); EmitByte(0x05);EmitAdr(&tb);
STOREREG(REG_EAX, &tb)
/*we just wrote the int value to tb, convert that to a float and store it at c*/
//fild tb
EmitByte(0xdf); EmitByte(0x05);EmitAdr(&tb);
//fstps glob[C]
@ -674,18 +730,17 @@ EmitByte(0xcc);
case OP_EQ_S:
case OP_NE_S:
{
void *j0b, *j1b, *j1c;
//put a in ecx
LOADREG(glob + op[i].a, REG_ECX);
//put b in edi
//mov a,%ecx
EmitByte(0x8b); EmitByte(0x0d); EmitAdr(glob + op[i].a);
//mov b,%edi
EmitByte(0x8b); EmitByte(0x3d); EmitAdr(glob + op[i].b);
LOADREG(glob + op[i].b, REG_EDI);
/*
//early out if they're equal
//cmp %ecx,%edi
EmitByte(0x39); EmitByte(0xd1);
//je _true
EmitByte(0x74); EmitByte(0x68);
EmitByte(0x39); EmitByte(0xc0 | (REG_EDI<<3) | REG_ECX);
j1c = LocalJmp(OP_EQ_S);
//if a is 0, check if b is ""
//jecxz ais0
@ -707,31 +762,30 @@ EmitByte(0xcc);
EmitByte(0x83); EmitByte(0xc4); EmitByte(0x08);
//cmpb $0,(%eax)
EmitByte(0x80); EmitByte(0x38); EmitByte(0x00);
//je _true
EmitByte(0x74); EmitByte(0x4b);
//jmp _false
EmitByte(0xeb); EmitByte(0x3d);
j1b = LocalJmp(OP_EQ_S);
j0b = LocalJmp(OP_GOTO);
}
//ais0:
{
//push edi
EmitByte(0x57);
//push progfuncs
EmitByte(0x68); EmitAdr(progfuncs);
//call PR_StringToNative
EmitByte(0xe8); EmitFOffset(PR_StringToNative,4);
//add $8,%esp
EmitByte(0x83); EmitByte(0xc4); EmitByte(0x08);
//cmpb $0,(%eax)
EmitByte(0x80); EmitByte(0x38); EmitByte(0x00);
//je _true
EmitByte(0x74); EmitByte(0x36);
//jmp _false
EmitByte(0xeb); EmitByte(0x28);
}
//ais0:
{
//push edi
EmitByte(0x57);
//push progfuncs
EmitByte(0x68); EmitAdr(progfuncs);
//call PR_StringToNative
EmitByte(0xe8); EmitFOffset(PR_StringToNative,4);
//add $8,%esp
EmitByte(0x83); EmitByte(0xc4); EmitByte(0x08);
//cmpb $0,(%eax)
EmitByte(0x80); EmitByte(0x38); EmitByte(0x00);
//je _true
EmitByte(0x74); EmitByte(0x36);
//jmp _false
EmitByte(0xeb); EmitByte(0x28);
}
//bnot0:
*/
LOADREG(glob + op[i].a, REG_ECX);
//push ecx
EmitByte(0x51);
//push progfuncs
@ -741,6 +795,7 @@ EmitByte(0xcc);
//push %eax
EmitByte(0x50);
LOADREG(glob + op[i].b, REG_EDI);
//push %edi
EmitByte(0x57);
//push progfuncs
@ -757,28 +812,35 @@ EmitByte(0xcc);
EmitByte(0xe8); EmitFOffset(strcmp,4);
//add $16,%esp
EmitByte(0x83); EmitByte(0xc4); EmitByte(0x10);
//cmp $0,%eax
EmitByte(0x83); EmitByte(0xf8); EmitByte(0x00);
//je _true
EmitByte(0x74); EmitByte(0x0c);
//_false:
//mov 0.0f,c
EmitByte(0xc7); EmitByte(0x05); EmitAdr(glob + op[i].c); EmitFloat((op[i].op == OP_NE_S)?1.0f:0.0f);
//jmp done
EmitByte(0xeb); EmitByte(0x0a);
//_true:
//mov 1.0f,c
EmitByte(0xc7); EmitByte(0x05); EmitAdr(glob + op[i].c); EmitFloat((op[i].op == OP_NE_S)?0.0f:1.0f);
//_done:
j1 = LocalJmp(OP_EQ_S);
{
l0 = LocalLoc();
STOREF((op[i].op == OP_NE_S)?1.0f:0.0f, glob + op[i].c);
j2 = LocalJmp(OP_GOTO);
}
{
l1 = LocalLoc();
STOREF((op[i].op == OP_NE_S)?0.0f:1.0f, glob + op[i].c);
}
l2 = LocalLoc();
// LocalJmpLoc(j0b, l0);
LocalJmpLoc(j1, l1);
// LocalJmpLoc(j1b, l1);
LocalJmpLoc(j2, l2);
}
break;
case OP_NOT_S:
//mov A,%eax
EmitByte(0xa1);EmitAdr(glob + op[i].a);
LOADREG(glob + op[i].a, REG_EAX)
//cmp $0,%eax
EmitByte(0x83); EmitByte(0xf8); EmitByte(0x00);
//je _true
EmitByte(0x74); EmitByte(0x1f);
j2 = LocalJmp(OP_EQ_S);
//push %eax
EmitByte(0x50);
//push progfuncs
@ -787,19 +849,22 @@ EmitByte(0xcc);
EmitByte(0xe8); EmitFOffset(PR_StringToNative,4);
//add $8,%esp
EmitByte(0x83); EmitByte(0xc4); EmitByte(0x08);
//cmpb $0,(%eax)
EmitByte(0x80); EmitByte(0x38); EmitByte(0x00);
//je _true
EmitByte(0x74); EmitByte(0x0c);
//_false:
//mov 0.0f,c
EmitByte(0xc7); EmitByte(0x05); EmitAdr(glob + op[i].c); EmitFloat(0.0f);
//jmp done
EmitByte(0xeb); EmitByte(0x0a);
//_true:
//mov 1.0f,c
EmitByte(0xc7); EmitByte(0x05); EmitAdr(glob + op[i].c); EmitFloat(1.0f);
//_done:
j1 = LocalJmp(OP_EQ_S);
{
STOREF(0.0f, glob + op[i].c);
j0 = LocalJmp(OP_GOTO);
}
{
l1 = LocalLoc();
STOREF(1.0f, glob + op[i].c);
}
l2 = LocalLoc();
LocalJmpLoc(j2, l1);
LocalJmpLoc(j1, l1);
LocalJmpLoc(j0, l2);
break;
case OP_ADD_V:
@ -888,29 +953,18 @@ EmitByte(0xcc);
//fstp %st(0) (aka: pop)
EmitByte(0xdd);EmitByte(0xd8);
//jcc _true
if (op[i].op == OP_LE)
EmitByte(0x7e); //jle
else if (op[i].op == OP_GE)
EmitByte(0x7d); //jge
else if (op[i].op == OP_LT)
EmitByte(0x7c); //jl
else if (op[i].op == OP_GT)
EmitByte(0x7f); //jg
else if (op[i].op == OP_NE_F)
EmitByte(0x75); //jne
else
EmitByte(0x74); //je
EmitByte(0x0c);
//_false:
//mov 0.0f,c
EmitByte(0xc7); EmitByte(0x05); EmitAdr(glob + op[i].c); EmitFloat(0.0f);
//jmp done
EmitByte(0xeb); EmitByte(0x0a);
//_true:
//mov 1.0f,c
EmitByte(0xc7); EmitByte(0x05); EmitAdr(glob + op[i].c); EmitFloat(1.0f);
//_done:
j1 = LocalJmp(op[i].op);
{
STOREF(0.0f, glob + op[i].c);
j2 = LocalJmp(OP_GOTO);
}
{
l1 = LocalLoc();
STOREF(1.0f, glob + op[i].c);
}
l2 = LocalLoc();
LocalJmpLoc(j1,l1);
LocalJmpLoc(j2,l2);
break;
case OP_MUL_FV:
@ -972,8 +1026,8 @@ EmitByte(0xcc);
//add $12,%esp
EmitByte(0x83); EmitByte(0xc4); EmitByte(0x0c);
break;
#if 0
case OP_NOT_V:
#if 1
/* case OP_NOT_V:
//flds 0
//flds glob[A+0]
//fcomip %st(1),%st
@ -990,7 +1044,8 @@ EmitByte(0xcc);
//mov 0,C
//done:
break;
*/
case OP_NE_V:
case OP_EQ_V:
//flds glob[A]
EmitByte(0xd9);EmitByte(0x05);EmitAdr(glob + op[i].a+0);
@ -1020,17 +1075,6 @@ EmitByte(0xcc);
//_done:
break;
case OP_EQ_V:
EmitByte(0xcd);EmitByte(op[i].op);
printf("QCJIT: instruction %i is not implemented\n", op[i].op);
break;
case OP_NE_V:
EmitByte(0xcd);EmitByte(op[i].op);
printf("QCJIT: instruction %i is not implemented\n", op[i].op);
break;
case OP_NOT_V:
EmitByte(0xcd);EmitByte(op[i].op);
printf("QCJIT: instruction %i is not implemented\n", op[i].op);

View file

@ -29,10 +29,6 @@
typedef unsigned char qbyte;
#include <stdio.h>
#if defined(_M_IX86) || defined(__i386__)
//#define QCJIT
#endif
#define DLL_PROG
#ifndef PROGSUSED
#define PROGSUSED
@ -464,7 +460,7 @@ ddef32_t *ED_FindGlobal32 (progfuncs_t *progfuncs, char *name);
ddef32_t *ED_GlobalAtOfs32 (progfuncs_t *progfuncs, unsigned int ofs);
string_t PR_StringToProgs (progfuncs_t *inst, char *str);
char *PR_StringToNative (progfuncs_t *inst, string_t str);
char *ASMCALL PR_StringToNative (progfuncs_t *inst, string_t str);
void PR_FreeTemps (progfuncs_t *progfuncs, int depth);

View file

@ -14,13 +14,24 @@
#define VARGS
#endif
#if defined(_M_IX86) || defined(__i386__)
//#define QCJIT
#endif
#ifdef QCJIT
#define ASMCALL VARGS
#else
#define ASMCALL
#endif
#define QCBUILTIN ASMCALL
struct edict_s;
struct entvars_s;
struct globalvars_s;
struct qcthread_s;
typedef struct progfuncs_s progfuncs_t;
typedef void (*builtin_t) (progfuncs_t *prinst, struct globalvars_s *gvars);
typedef void (ASMCALL *builtin_t) (progfuncs_t *prinst, struct globalvars_s *gvars);
//used by progs engine. All nulls is reset.
typedef struct {
@ -120,7 +131,7 @@ struct progfuncs_s {
string_t (*TempString) (progfuncs_t *prinst, char *str);
string_t (*StringToProgs) (progfuncs_t *prinst, char *str);
char *(*StringToNative) (progfuncs_t *prinst, string_t str);
char *(ASMCALL *StringToNative) (progfuncs_t *prinst, string_t str);
int stringtablesize;
int (*QueryField) (progfuncs_t *prinst, unsigned int fieldoffset, etype_t *type, char **name, evalc_t *fieldcache); //find info on a field definition at an offset
@ -141,10 +152,10 @@ typedef struct progexterns_s {
void (*entspawn) (struct edict_s *ent, int loading); //ent has been spawned, but may not have all the extra variables (that may need to be set) set
pbool (*entcanfree) (struct edict_s *ent); //return true to stop ent from being freed
void (*stateop) (progfuncs_t *prinst, float var, func_t func); //what to do on qc's state opcode.
void (*cstateop) (progfuncs_t *prinst, float vara, float varb, func_t currentfunc); //a hexen2 opcode.
void (*cwstateop) (progfuncs_t *prinst, float vara, float varb, func_t currentfunc); //a hexen2 opcode.
void (*thinktimeop) (progfuncs_t *prinst, struct edict_s *ent, float varb); //a hexen2 opcode.
void (ASMCALL *stateop) (progfuncs_t *prinst, float var, func_t func); //what to do on qc's state opcode.
void (ASMCALL *cstateop) (progfuncs_t *prinst, float vara, float varb, func_t currentfunc); //a hexen2 opcode.
void (ASMCALL *cwstateop) (progfuncs_t *prinst, float vara, float varb, func_t currentfunc); //a hexen2 opcode.
void (ASMCALL *thinktimeop) (progfuncs_t *prinst, struct edict_s *ent, float varb); //a hexen2 opcode.
//used when loading a game

File diff suppressed because it is too large Load diff

View file

@ -478,7 +478,7 @@ static string_t Q1QVMPF_StringToProgs(progfuncs_t *prinst, char *str)
return (string_t)(str - (char*)VM_MemoryBase(q1qvm));
}
static char *Q1QVMPF_StringToNative(progfuncs_t *prinst, string_t str)
static char *ASMCALL Q1QVMPF_StringToNative(progfuncs_t *prinst, string_t str)
{
return (char*)VM_MemoryBase(q1qvm) + str;
}

View file

@ -41,7 +41,7 @@ qboolean PR_KrimzonParseCommand(char *s);
qboolean PR_UserCmd(char *cmd);
qboolean PR_ConsoleCmd(void);
void PR_RunThreads(void);
void PRSV_RunThreads(void);
#define PR_MAINPROGS 0 //this is a constant that should really be phased out. But seeing as QCLIB requires some sort of master progs due to extern funcs...

View file

@ -1802,7 +1802,7 @@ client_t *SVC_DirectConnect(void)
break;
case PROTOCOL_VERSION_FTE2:
protextsupported2 = Q_atoi(Cmd_Argv(1));
Con_DPrintf("Client supports 0x%x fte2 extensions\n", protextsupported);
Con_DPrintf("Client supports 0x%x fte2 extensions\n", protextsupported2);
break;
case PROTOCOL_VERSION_HUFFMAN:
huffcrc = Q_atoi(Cmd_Argv(1));
@ -3684,6 +3684,7 @@ void SV_InitLocal (void)
extern cvar_t sv_wateraccelerate;
extern cvar_t sv_friction;
extern cvar_t sv_waterfriction;
extern cvar_t sv_sound_watersplash;
extern cvar_t pr_allowbutton1;
extern cvar_t pm_bunnyspeedcap;
@ -3754,6 +3755,7 @@ void SV_InitLocal (void)
Cvar_Register (&sv_wateraccelerate, cvargroup_serverphysics);
Cvar_Register (&sv_friction, cvargroup_serverphysics);
Cvar_Register (&sv_waterfriction, cvargroup_serverphysics);
Cvar_Register (&sv_sound_watersplash, cvargroup_serverphysics);
Cvar_Register (&sv_bigcoords, cvargroup_serverphysics);

View file

@ -152,7 +152,7 @@ qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, qboolean re
if (trace.fraction == 1)
{
if ( ((int)ent->v->flags & FL_SWIM) && !(World_PointContents(world, trace.endpos) & FTECONTENTS_FLUID))
return false; // swim monster left water
continue; // swim monster left water
VectorCopy (trace.endpos, ent->v->origin);
if (relink)

View file

@ -57,6 +57,7 @@ cvar_t sv_wateraccelerate = SCVAR( "sv_wateraccelerate", "10");
cvar_t sv_friction = SCVAR( "sv_friction", "4");
cvar_t sv_waterfriction = SCVAR( "sv_waterfriction", "4");
cvar_t sv_gameplayfix_noairborncorpse = SCVAR( "sv_gameplayfix_noairborncorpse", "0");
cvar_t sv_sound_watersplash = CVAR( "sv_sound_watersplash", "misc/h2ohit1.wav");
cvar_t pm_ktjump = SCVARF("pm_ktjump", "0", CVAR_SERVERINFO);
cvar_t pm_bunnyspeedcap = SCVARF("pm_bunnyspeedcap", "0", CVAR_SERVERINFO);
@ -1041,18 +1042,18 @@ static void SV_CheckWaterTransition (edict_t *ent)
if (cont <= Q1CONTENTS_WATER)
{
if (ent->v->watertype == Q1CONTENTS_EMPTY)
if (ent->v->watertype == Q1CONTENTS_EMPTY && *sv_sound_watersplash.string)
{ // just crossed into water
SVQ1_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1, 0);
SVQ1_StartSound (ent, 0, sv_sound_watersplash.string, 255, 1, 0);
}
ent->v->watertype = cont;
ent->v->waterlevel = 1;
}
else
{
if (ent->v->watertype != Q1CONTENTS_EMPTY)
if (ent->v->watertype != Q1CONTENTS_EMPTY && *sv_sound_watersplash.string)
{ // just crossed into open
SVQ1_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1, 0);
SVQ1_StartSound (ent, 0, sv_sound_watersplash.string, 255, 1, 0);
}
ent->v->watertype = Q1CONTENTS_EMPTY;
ent->v->waterlevel = cont;
@ -1195,7 +1196,7 @@ static void SV_Physics_Step (edict_t *ent)
else
freefall = true;
if (fl & FL_SWIM)
freefall = ent->v->waterlevel > 0;
freefall = ent->v->waterlevel <= 0;
if (freefall)
{
hitsound = ent->v->velocity[2] < movevars.gravity*-0.1;
@ -2142,7 +2143,7 @@ qboolean SV_Physics (void)
World_Physics_Frame(&sv.world, host_frametime, sv_gravity.value);
#endif
PR_RunThreads();
PRSV_RunThreads();
retouch = (pr_nqglobal_struct->force_retouch && *pr_nqglobal_struct->force_retouch);

View file

@ -96,7 +96,7 @@ cvar_t sv_realip_timeout = SCVAR("sv_realip_timeout", "10");
#ifdef VOICECHAT
cvar_t sv_voip = CVARD("sv_voip", "1", "Enable reception of voice packets.");
cvar_t sv_voip_record = CVARD("sv_voip_record", "0", "Record voicechat into mvds. Requires player support.");
cvar_t sv_voip_record = CVARD("sv_voip_record", "0", "Record voicechat into mvds. Requires player support. 0=noone, 1=everyone, 2=spectators only");
cvar_t sv_voip_echo = CVARD("sv_voip_echo", "0", "Echo voice packets back to their sender, a debug/test setting.");
#endif
@ -2094,6 +2094,16 @@ void SV_NextUpload (void)
}
#ifdef VOICECHAT
/*
Pivicy issues:
By sending voice chat to a server, you are unsure who might be listening.
Voice can be recorded to an mvd, potentially including voice.
Spectators tracvking you are able to hear team chat of your team.
You're never quite sure if anyone might join the server and your team before you finish saying a sentance.
You run the risk of sounds around you being recorded by quake, including but not limited to: TV channels, loved ones, phones, YouTube videos featuring certain moans.
Default on non-team games is to broadcast.
*/
#define VOICE_RING_SIZE 512 /*POT*/
struct
{
@ -2145,9 +2155,6 @@ void SV_VoiceReadPacket(void)
ring->receiver[j] = 0;
for (j = 0, cl = svs.clients; j < sv.allocated_client_slots; j++, cl++)
{
if (cl == host_client && !sv_voip_echo.ival)
continue;
if (cl->state != cs_spawned && cl->state != cs_connected)
continue;
/*spectators may only talk to spectators*/
@ -2189,7 +2196,7 @@ void SV_VoiceReadPacket(void)
ring->receiver[cln>>3] |= 1<<(cln&3);
}
if (sv.mvdrecording && sv_voip_record.ival)
if (sv.mvdrecording && sv_voip_record.ival && !(sv_voip_record.ival == 2 && !host_client->spectator))
{
// non-team messages should be seen always, even if not tracking any player
if (vt == VT_ALL && (!host_client->spectator || sv_spectalk.ival))
@ -2244,14 +2251,23 @@ void SV_VoiceSendPacket(client_t *client, sizebuf_t *buf)
ring = &voice.ring[(client->voice_read) & (VOICE_RING_SIZE-1)];
/*figure out if it was for us*/
send = false;
if (ring->receiver[clno>>3] & (1<<(clno&3)))
send = true;
else
send = false;
{
/*if you're spectating, you can hear whatever your tracked player can hear*/
if (host_client->spectator && host_client->spec_track)
if (ring->receiver[(host_client->spec_track-1)>>3] & (1<<((host_client->spec_track-1)&3)))
send = true;
}
if (client->voice_mute[ring->sender>>3] & (1<<(ring->sender&3)))
send = false;
if (ring->sender == clno && !sv_voip_echo.ival)
send = false;
/*additional ways to block voice*/
if (client->download)
send = false;
@ -6474,6 +6490,7 @@ void SV_UserInit (void)
#ifdef VOICECHAT
Cvar_Register (&sv_voip, cvargroup_serverpermissions);
Cvar_Register (&sv_voip_echo, cvargroup_serverpermissions);
Cvar_Register (&sv_voip_record, cvargroup_serverpermissions);
#endif
#ifdef SERVERONLY
Cvar_Register (&cl_rollspeed, "Prediction stuff");