From: havoc Date: Thu, 5 Sep 2002 10:24:32 +0000 (+0000) Subject: added getsurfaceclippedpoint builtin X-Git-Tag: RELEASE_0_2_0_RC1~275 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=0831e52048c0e9db0d5694384d5ed994acbfca27 added getsurfaceclippedpoint builtin git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2329 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/pr_cmds.c b/pr_cmds.c index 2c1c8ce6..bfba985b 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -2563,7 +2563,7 @@ void PF_getsurfacetexture(void) return; G_INT(OFS_RETURN) = surf->texinfo->texture->name - pr_strings; } -//PF_getsurfacenearpoint, // #438 void(entity e, vector p) getsurfacenearpoint = #438; +//PF_getsurfacenearpoint, // #438 float(entity e, vector p) getsurfacenearpoint = #438; void PF_getsurfacenearpoint(void) { int surfnum, best, modelindex; @@ -2609,6 +2609,24 @@ void PF_getsurfacenearpoint(void) } G_FLOAT(OFS_RETURN) = best; } +//PF_getsurfaceclippedpoint, // #439 vector(entity e, float s, vector p) getsurfaceclippedpoint = #439; +void PF_getsurfaceclippedpoint(void) +{ + edict_t *ed; + msurface_t *surf; + vec3_t p, out; + VectorClear(G_VECTOR(OFS_RETURN)); + ed = G_EDICT(OFS_PARM0); + if (!ed || ed->free) + return; + if (!(surf = getsurface(ed, G_FLOAT(OFS_PARM1)))) + return; + // FIXME: implement rotation/scaling + VectorSubtract(G_VECTOR(OFS_PARM2), ed->v.origin, p); + clippointtosurface(surf, p, out); + // FIXME: implement rotation/scaling + VectorAdd(out, ed->v.origin, G_VECTOR(OFS_RETURN)); +} void PF_Fixme (void) { @@ -2773,6 +2791,7 @@ PF_getsurfacepoint, // #435 vector(entity e, float s, float n) getsurfacepoi PF_getsurfacenormal, // #436 vector(entity e, float s) getsurfacenormal = #436; PF_getsurfacetexture, // #437 string(entity e, float s) getsurfacetexture = #437; PF_getsurfacenearpoint, // #438 float(entity e, vector p) getsurfacenearpoint = #438; +PF_getsurfaceclippedpoint,// #439 vector(entity e, float s, vector p) getsurfaceclippedpoint = #439; }; builtin_t *pr_builtins = pr_builtin;