X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=pr_cmds.c;h=f49b2d205729fee951b4daaddcc9142507575fb8;hb=12626bd3d5e411a4f6b92187541962ab401d783b;hp=8acdec77240eba646f95210407c7c3b2cbbb56e1;hpb=10a3d2138d31b27eba1e779190f5b578404a01a6;p=xonotic%2Fdarkplaces.git diff --git a/pr_cmds.c b/pr_cmds.c index 8acdec77..f49b2d20 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -41,26 +41,21 @@ char pr_varstring_temp[MAX_VARSTRING]; */ -char *PF_VarString (int first) +char *PF_VarString (int first) { - int i, j, end; - char *s; + int i; + const char *s; + char *out, *outend; - end = 0; - for (i = first;i < pr_argc;i++) + out = pr_varstring_temp; + outend = pr_varstring_temp + sizeof(pr_varstring_temp) - 1; + for (i = first;i < pr_argc && out < outend;i++) { - // LordHavoc: FIXME: this is just a strlcat inlined s = G_STRING((OFS_PARM0+i*3)); - j = strlen(s); - if (j > MAX_VARSTRING - 1 - end) - j = MAX_VARSTRING - 1 - end; - if (j > 0) - { - memcpy(pr_varstring_temp + end, s, j); - end += j; - } + while (out < outend && *s) + *out++ = *s++; } - pr_varstring_temp[end] = 0; + *out++ = 0; return pr_varstring_temp; } @@ -82,7 +77,9 @@ char *ENGINE_EXTENSIONS = "DP_ENT_VIEWMODEL " "DP_GFX_FOG " "DP_GFX_SKYBOX " +"DP_GFX_EXTERNALTEXTURES " "DP_HALFLIFE_MAP " +"DP_HALFLIFE_MAP_CVAR " "DP_INPUTBUTTONS " "DP_MONSTERWALK " "DP_MOVETYPEBOUNCEMISSILE " @@ -865,7 +862,7 @@ int PF_newcheckclient (int check) // get the PVS for the entity VectorAdd (ent->v->origin, ent->v->view_ofs, org); - memcpy (checkpvs, sv.worldmodel->LeafPVS(sv.worldmodel, sv.worldmodel->PointInLeaf(sv.worldmodel, org)), (sv.worldmodel->numleafs+7)>>3 ); + memcpy (checkpvs, sv.worldmodel->brushq1.LeafPVS(sv.worldmodel, sv.worldmodel->brushq1.PointInLeaf(sv.worldmodel, org)), (sv.worldmodel->brushq1.numleafs+7)>>3 ); return i; } @@ -911,10 +908,10 @@ void PF_checkclient (void) // if current entity can't possibly see the check entity, return 0 self = PROG_TO_EDICT(pr_global_struct->self); VectorAdd (self->v->origin, self->v->view_ofs, view); - leaf = sv.worldmodel->PointInLeaf(sv.worldmodel, view); + leaf = sv.worldmodel->brushq1.PointInLeaf(sv.worldmodel, view); if (leaf) { - l = (leaf - sv.worldmodel->leafs) - 1; + l = (leaf - sv.worldmodel->brushq1.leafs) - 1; if ( (l<0) || !(checkpvs[l>>3] & (1<<(l&7)) ) ) { c_notvis++; @@ -1314,7 +1311,7 @@ void PF_precache_model (void) Host_Error ("PF_Precache_*: Precache can only be done in spawn functions"); s = G_STRING(OFS_PARM0); - if (sv.worldmodel->ishlbsp && ((!s) || (!s[0]))) + if (sv.worldmodel->brushq1.ishlbsp && ((!s) || (!s[0]))) return; G_INT(OFS_RETURN) = G_INT(OFS_PARM0); PR_CheckEmptyString (s); @@ -1500,7 +1497,7 @@ PF_pointcontents */ void PF_pointcontents (void) { - G_FLOAT(OFS_RETURN) = sv.worldmodel->PointContents(sv.worldmodel, G_VECTOR(OFS_PARM0)); + G_FLOAT(OFS_RETURN) = SV_PointContents(G_VECTOR(OFS_PARM0)); } /* @@ -2558,9 +2555,9 @@ static msurface_t *getsurface(edict_t *ed, int surfnum) model = sv.models[modelindex]; if (model->type != mod_brush) return NULL; - if (surfnum < 0 || surfnum >= model->nummodelsurfaces) + if (surfnum < 0 || surfnum >= model->brushq1.nummodelsurfaces) return NULL; - return model->surfaces + surfnum + model->firstmodelsurface; + return model->brushq1.surfaces + surfnum + model->brushq1.firstmodelsurface; } @@ -2644,9 +2641,9 @@ void PF_getsurfacenearpoint(void) VectorSubtract(point, ed->v->origin, p); best = -1; bestdist = 1000000000; - for (surfnum = 0;surfnum < model->nummodelsurfaces;surfnum++) + for (surfnum = 0;surfnum < model->brushq1.nummodelsurfaces;surfnum++) { - surf = model->surfaces + surfnum + model->firstmodelsurface; + surf = model->brushq1.surfaces + surfnum + model->brushq1.firstmodelsurface; dist = PlaneDiff(p, surf->plane); dist = dist * dist; if (dist < bestdist)