mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-31 04:30:38 +00:00
Two things.
1: make qclib's qcc more consistant, by passing in a '-src src' instead of hardcoding it inside qclib. 2: fixes the 'vote kick'/op_load bug in cutf. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2150 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4bf50eb704
commit
45a50b2e8e
4 changed files with 171 additions and 18 deletions
|
@ -757,8 +757,49 @@ pbool QCC_PR_Precompiler(void)
|
|||
else if (!QC_strcasecmp(qcc_token, "PROGS_DAT"))
|
||||
{ //doesn't make sence, but silenced if you are switching between using a certain precompiler app used with CuTF.
|
||||
extern char destfile[1024];
|
||||
#ifndef QCCONLY
|
||||
extern char qccmfilename[1024];
|
||||
int p;
|
||||
char *s, *s2;
|
||||
#endif
|
||||
QCC_COM_Parse(msg);
|
||||
|
||||
#ifndef QCCONLY
|
||||
p=0;
|
||||
s2 = qcc_token;
|
||||
if (!strncmp(s2, "./", 2))
|
||||
s2+=2;
|
||||
else
|
||||
{
|
||||
while(!strncmp(s2, "../", 3))
|
||||
{
|
||||
s2+=3;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
strcpy(qccmfilename, qccmsourcedir);
|
||||
for (s=qccmfilename+strlen(qccmfilename);p && s>=qccmfilename; s--)
|
||||
{
|
||||
if (*s == '/' || *s == '\\')
|
||||
{
|
||||
*(s+1) = '\0';
|
||||
p--;
|
||||
}
|
||||
}
|
||||
sprintf(destfile, "%s", s2);
|
||||
|
||||
while (p>0)
|
||||
{
|
||||
memmove(destfile+3, destfile, strlen(destfile)+1);
|
||||
destfile[0] = '.';
|
||||
destfile[1] = '.';
|
||||
destfile[2] = '/';
|
||||
p--;
|
||||
}
|
||||
#else
|
||||
|
||||
strcpy(destfile, qcc_token);
|
||||
#endif
|
||||
printf("Outputfile: %s\n", destfile);
|
||||
}
|
||||
else if (!QC_strcasecmp(qcc_token, "keyword") || !QC_strcasecmp(qcc_token, "flag"))
|
||||
|
|
|
@ -2824,14 +2824,7 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
|
|||
printf ("Source directory: %s\n", qccmsourcedir);
|
||||
}
|
||||
else
|
||||
#ifndef QCCONLY
|
||||
if (!*qcc_gamedir)
|
||||
sprintf (qccmsourcedir, "src/");
|
||||
else
|
||||
sprintf (qccmsourcedir, "%s/src/", qcc_gamedir);
|
||||
#else
|
||||
*qccmsourcedir = '\0';
|
||||
#endif
|
||||
|
||||
QCC_InitData ();
|
||||
|
||||
|
@ -2940,6 +2933,15 @@ newstyle:
|
|||
sprintf(destfile, "%s%s", qccmfilename, s2);
|
||||
else
|
||||
sprintf(destfile, "%s", s2);
|
||||
|
||||
while (p>0)
|
||||
{
|
||||
memmove(destfile+3, destfile, strlen(destfile)+1);
|
||||
destfile[0] = '.';
|
||||
destfile[1] = '.';
|
||||
destfile[2] = '/';
|
||||
p--;
|
||||
}
|
||||
#endif
|
||||
|
||||
printf ("outputfile: %s\n", destfile);
|
||||
|
|
|
@ -758,10 +758,10 @@ void PR_Compile_f(void)
|
|||
{
|
||||
int argc=3;
|
||||
double time = Sys_DoubleTime();
|
||||
char *argv[64] = {"", "-srcfile", "qwprogs.src"};
|
||||
char *argv[64] = {"", "-src", "src", "-srcfile", "qwprogs.src"};
|
||||
|
||||
if (Cmd_Argc() == 2)
|
||||
argv[2] = Cmd_Argv(1);
|
||||
argv[4] = Cmd_Argv(1);
|
||||
else if (Cmd_Argc()>2)
|
||||
{
|
||||
for (argc = 0; argc < Cmd_Argc(); argc++)
|
||||
|
@ -9055,7 +9055,7 @@ void PF_getsurfacenumpoints(progfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
else
|
||||
model = NULL;
|
||||
|
||||
if (!model || surfnum >= model->numsurfaces)
|
||||
if (!model || model->type != mod_brush || surfnum >= model->numsurfaces)
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
else
|
||||
G_FLOAT(OFS_RETURN) = model->surfaces[surfnum].mesh->numvertexes;
|
||||
|
@ -9078,7 +9078,7 @@ void PF_getsurfacepoint(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
else
|
||||
model = NULL;
|
||||
|
||||
if (!model || surfnum >= model->numsurfaces)
|
||||
if (!model || model->type != mod_brush || surfnum >= model->numsurfaces)
|
||||
{
|
||||
G_FLOAT(OFS_RETURN+0) = 0;
|
||||
G_FLOAT(OFS_RETURN+1) = 0;
|
||||
|
@ -9094,7 +9094,7 @@ void PF_getsurfacepoint(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
// #436 vector(entity e, float s) getsurfacenormal (DP_QC_GETSURFACE)
|
||||
void PF_getsurfacenormal(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
unsigned int surfnum, pointnum;
|
||||
unsigned int surfnum, pointnum;
|
||||
model_t *model;
|
||||
int modelindex;
|
||||
edict_t *ent;
|
||||
|
@ -9109,7 +9109,7 @@ void PF_getsurfacenormal(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
else
|
||||
model = NULL;
|
||||
|
||||
if (!model || surfnum >= model->numsurfaces)
|
||||
if (!model || model->type != mod_brush || surfnum >= model->numsurfaces)
|
||||
{
|
||||
G_FLOAT(OFS_RETURN+0) = 0;
|
||||
G_FLOAT(OFS_RETURN+1) = 0;
|
||||
|
@ -9127,10 +9127,112 @@ void PF_getsurfacenormal(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
// #437 string(entity e, float s) getsurfacetexture (DP_QC_GETSURFACE)
|
||||
void PF_getsurfacetexture(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
model_t *model;
|
||||
edict_t *ent;
|
||||
msurface_t *surf;
|
||||
int modelindex;
|
||||
int surfnum;
|
||||
|
||||
ent = G_EDICT(prinst, OFS_PARM0);
|
||||
surfnum = G_FLOAT(OFS_PARM1);
|
||||
|
||||
modelindex = ent->v->modelindex;
|
||||
if (modelindex > 0 && modelindex < MAX_MODELS)
|
||||
model = sv.models[(int)ent->v->modelindex];
|
||||
else
|
||||
model = NULL;
|
||||
|
||||
G_INT(OFS_RETURN) = 0;
|
||||
if (!model || model->type != mod_brush)
|
||||
return;
|
||||
|
||||
if (surfnum < 0 || surfnum > model->numsurfaces)
|
||||
return;
|
||||
|
||||
surf = &model->surfaces[surfnum];
|
||||
G_INT(OFS_RETURN) = PR_TempString(prinst, surf->texinfo->texture->name);
|
||||
}
|
||||
// #438 float(entity e, vector p) getsurfacenearpoint (DP_QC_GETSURFACE)
|
||||
void PF_getsurfacenearpoint(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
model_t *model;
|
||||
edict_t *ent;
|
||||
msurface_t *surf;
|
||||
int i;
|
||||
float planedist;
|
||||
float *point;
|
||||
int modelindex;
|
||||
|
||||
vec3_t edgedir;
|
||||
vec3_t edgenormal;
|
||||
mvertex_t *v1, *v2;
|
||||
int edge;
|
||||
int e;
|
||||
|
||||
ent = G_EDICT(prinst, OFS_PARM0);
|
||||
point = G_VECTOR(OFS_PARM1);
|
||||
|
||||
G_FLOAT(OFS_RETURN) = -1;
|
||||
|
||||
modelindex = ent->v->modelindex;
|
||||
if (modelindex > 0 && modelindex < MAX_MODELS)
|
||||
model = sv.models[(int)ent->v->modelindex];
|
||||
else
|
||||
model = NULL;
|
||||
|
||||
if (!model || model->type != mod_brush)
|
||||
return;
|
||||
|
||||
if (model->fromgame != fg_quake)
|
||||
return;
|
||||
|
||||
|
||||
surf = model->surfaces;
|
||||
for (i = model->numsurfaces; i; i--, surf = surf++)
|
||||
{
|
||||
if (surf->flags & SURF_PLANEBACK)
|
||||
planedist = -DotProduct(point, surf->plane->normal);
|
||||
else
|
||||
planedist = DotProduct(point, surf->plane->normal);
|
||||
|
||||
if (planedist*planedist < 8*8)
|
||||
{ //within a specific range
|
||||
//make sure it's within the poly
|
||||
for (e = surf->firstedge+surf->numedges, edge = model->surfedges[surf->firstedge]; e > surf->firstedge; e--, edge++)
|
||||
{
|
||||
if (edge < 0)
|
||||
{
|
||||
v1 = &model->vertexes[model->edges[-edge].v[0]];
|
||||
v2 = &model->vertexes[model->edges[-edge].v[1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
v2 = &model->vertexes[model->edges[edge].v[0]];
|
||||
v1 = &model->vertexes[model->edges[edge].v[1]];
|
||||
}
|
||||
|
||||
if (surf->flags & SURF_PLANEBACK)
|
||||
{
|
||||
VectorSubtract(v1->position, v2->position, edgedir)
|
||||
CrossProduct(edgedir, surf->plane->normal, edgenormal);
|
||||
if (DotProduct(edgenormal, v1->position) > DotProduct(edgenormal, point))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract(v1->position, v2->position, edgedir)
|
||||
CrossProduct(edgedir, surf->plane->normal, edgenormal);
|
||||
if (DotProduct(edgenormal, v1->position) < DotProduct(edgenormal, point))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (e == surf->firstedge)
|
||||
{
|
||||
G_FLOAT(OFS_RETURN) = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// #439 vector(entity e, float s, vector p) getsurfaceclippedpoint (DP_QC_GETSURFACE)
|
||||
void PF_getsurfaceclippedpoint(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
|
@ -9161,8 +9263,14 @@ void PF_matchclient(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
|
||||
if (*prinst->callargc < 2)
|
||||
{
|
||||
SV_GetClientForString(name, &clnum);
|
||||
G_INT(OFS_RETURN) = clnum;
|
||||
cl = SV_GetClientForString(name, &clnum);
|
||||
if (!cl)
|
||||
G_INT(OFS_RETURN) = 0;
|
||||
else
|
||||
G_INT(OFS_RETURN) = (cl - svs.clients) + 1;
|
||||
|
||||
if (cl = SV_GetClientForString(name, &clnum))
|
||||
G_INT(OFS_RETURN) = 0; //prevent multiple matches.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9170,7 +9278,7 @@ void PF_matchclient(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
{
|
||||
if (!matchnum)
|
||||
{ //this is the one that matches
|
||||
G_INT(OFS_RETURN) = clnum;
|
||||
G_INT(OFS_RETURN) = (cl - svs.clients) + 1;
|
||||
return;
|
||||
}
|
||||
matchnum--;
|
||||
|
|
|
@ -82,7 +82,8 @@ client_t *SV_GetClientForString(char *name, int *id)
|
|||
continue;
|
||||
if (cl->userid == uid)
|
||||
{
|
||||
*id=sv.allocated_client_slots;
|
||||
if (id)
|
||||
*id=sv.allocated_client_slots;
|
||||
return cl;
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +122,8 @@ client_t *SV_GetClientForString(char *name, int *id)
|
|||
|
||||
if (strstr(nicename, name))
|
||||
{
|
||||
*id=i+1;
|
||||
if (id)
|
||||
*id=i+1;
|
||||
return cl;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue