mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 07:02:12 +00:00
Spawn decals on csqc's bmodels, not just engine-deltaed ents.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6089 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
442d23f226
commit
eb157e09b8
5 changed files with 139 additions and 73 deletions
|
@ -54,6 +54,9 @@ static int rand(void)
|
|||
#define R_PARTSET_BUILTINS
|
||||
#endif
|
||||
|
||||
#include "pr_common.h"
|
||||
extern world_t csqc_world;
|
||||
|
||||
struct
|
||||
{
|
||||
char *name;
|
||||
|
@ -122,7 +125,7 @@ typedef struct clippeddecal_s
|
|||
float die;
|
||||
|
||||
int entity; //>0 is a lerpentity, <0 is a csqc ent. 0 is world. woot.
|
||||
model_t *model; //just for paranoia
|
||||
// model_t *model; //just for paranoia
|
||||
|
||||
vec3_t vertex[3];
|
||||
vec2_t texcoords[3];
|
||||
|
@ -4610,7 +4613,7 @@ static void PScript_AddDecals(void *vctx, vec3_t *fte_restrict points, size_t nu
|
|||
points += 3;
|
||||
|
||||
d->entity = ctx->entity;
|
||||
d->model = ctx->model;
|
||||
// d->model = ctx->model;
|
||||
d->die = ptype->randdie*frandom();
|
||||
|
||||
if (ptype->die)
|
||||
|
@ -4788,7 +4791,10 @@ static int PScript_RunParticleEffectState (vec3_t org, vec3_t dir, float count,
|
|||
VectorMA(org, -16, dir, ctx.tangent1);
|
||||
CL_TraceLine(ctx.tangent2, ctx.tangent1, ctx.center, bestdir, &ctx.entity);
|
||||
}
|
||||
if (ctx.entity && (unsigned)ctx.entity < (unsigned)cl.maxlerpents)
|
||||
|
||||
if (ctx.entity)
|
||||
{
|
||||
if (ctx.entity>0 && (unsigned)ctx.entity < (unsigned)cl.maxlerpents)
|
||||
{
|
||||
lerpents_t *le = cl.lerpents+ctx.entity;
|
||||
ctx.model = cl.model_precache[le->entstate->modelindex];
|
||||
|
@ -4797,8 +4803,22 @@ static int PScript_RunParticleEffectState (vec3_t org, vec3_t dir, float count,
|
|||
else
|
||||
ctx.entity = 0;
|
||||
}
|
||||
else if (ctx.entity<0 && (unsigned)-ctx.entity < (unsigned)csqc_world.num_edicts)
|
||||
{
|
||||
wedict_t *e = WEDICT_NUM_UB(csqc_world.progs, -ctx.entity);
|
||||
if (e)
|
||||
{
|
||||
ctx.model = csqc_world.Get_CModel(&csqc_world, e->v->modelindex);
|
||||
if (!ctx.model)
|
||||
continue;
|
||||
VectorSubtract(ctx.center, e->v->origin, ctx.center);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
ctx.entity = 0;
|
||||
}
|
||||
|
||||
VectorNegate(dir, ctx.normal);
|
||||
VectorNormalize(ctx.normal);
|
||||
|
@ -6625,6 +6645,21 @@ static void R_AddClippedDecal(scenetris_t *t, clippeddecal_t *d, plooks_t *type)
|
|||
VectorAdd(d->vertex[1], le->origin, cl_strisvertv[cl_numstrisvert+1]);
|
||||
VectorAdd(d->vertex[2], le->origin, cl_strisvertv[cl_numstrisvert+2]);
|
||||
}
|
||||
else if (d->entity < 0)
|
||||
{
|
||||
wedict_t *e = WEDICT_NUM_UB(csqc_world.progs, -d->entity);
|
||||
if (!e)
|
||||
return;
|
||||
if (e->ereftype!=ER_ENTITY || //kill decals attached to removed ents.
|
||||
e->v->angles[0] || e->v->angles[1] || e->v->angles[2]) //FIXME: deal with rotated entities.
|
||||
{
|
||||
d->die = -1;
|
||||
return;
|
||||
}
|
||||
VectorAdd(d->vertex[0], e->v->origin, cl_strisvertv[cl_numstrisvert+0]);
|
||||
VectorAdd(d->vertex[1], e->v->origin, cl_strisvertv[cl_numstrisvert+1]);
|
||||
VectorAdd(d->vertex[2], e->v->origin, cl_strisvertv[cl_numstrisvert+2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy(d->vertex[0], cl_strisvertv[cl_numstrisvert+0]);
|
||||
|
|
|
@ -884,13 +884,34 @@ entity_t *TraceLineR (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal)
|
|||
return result;
|
||||
}
|
||||
|
||||
#include "pr_common.h"
|
||||
//traces against networked entities only.
|
||||
//0 says hit nothing.
|
||||
//1 says hit world
|
||||
//>1 says hit some entity
|
||||
float CL_TraceLine (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal, int *ent)
|
||||
{
|
||||
trace_t trace;
|
||||
#ifdef CSQC_DAT
|
||||
extern world_t csqc_world;
|
||||
if (csqc_world.progs)
|
||||
{
|
||||
trace = World_Move(&csqc_world, start, vec3_origin, vec3_origin, end, MOVE_NOMONSTERS, csqc_world.edicts);
|
||||
VectorCopy(trace.endpos, impact);
|
||||
if (normal)
|
||||
VectorCopy(trace.plane.normal, normal);
|
||||
if (ent)
|
||||
{
|
||||
if (trace.entnum) //ssqc numbers...
|
||||
*ent = trace.entnum; //aka: trace_networkentity
|
||||
else if (trace.ent) //csqc numbers are negative...
|
||||
*ent = -((wedict_t*)trace.ent)->entnum;
|
||||
//else makestatic, though those are assumed non-solid so won't be returned anyway.
|
||||
else
|
||||
*ent = 0;
|
||||
}
|
||||
return trace.fraction;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
float bestfrac=1;
|
||||
int i;
|
||||
vec3_t ts, te;
|
||||
|
@ -955,6 +976,7 @@ float CL_TraceLine (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal, int
|
|||
if (ent)
|
||||
*ent = result;
|
||||
return bestfrac;
|
||||
}
|
||||
}
|
||||
|
||||
//handy utility...
|
||||
|
|
|
@ -2067,6 +2067,7 @@ void R_DrawNameTags(void)
|
|||
vec3_t org;
|
||||
vec3_t screenspace;
|
||||
vec3_t diff;
|
||||
int scale=1;
|
||||
if (!cls.allow_cheats)
|
||||
{
|
||||
vec2_t scale = {8,8};
|
||||
|
@ -2086,6 +2087,7 @@ void R_DrawNameTags(void)
|
|||
#ifdef CSQC_DAT
|
||||
extern world_t csqc_world;
|
||||
w = &csqc_world;
|
||||
scale = -1;
|
||||
#endif
|
||||
}
|
||||
else if ((r_showfields.ival & 3) == 3)
|
||||
|
@ -2194,7 +2196,7 @@ void R_DrawNameTags(void)
|
|||
{
|
||||
int hitent;
|
||||
vec3_t imp;
|
||||
if (CL_TraceLine(r_refdef.vieworg, org, imp, NULL, &hitent)>=1 || hitent == i)
|
||||
if (CL_TraceLine(r_refdef.vieworg, org, imp, NULL, &hitent)>=1 || hitent*scale == i)
|
||||
{
|
||||
best = i;
|
||||
bestscore = score;
|
||||
|
|
|
@ -194,6 +194,13 @@ qboolean HTTP_ServerInit(int epfd, int port)
|
|||
setsockopt(httpserversocket, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&v6only, sizeof(v6only));
|
||||
}
|
||||
|
||||
#ifdef SO_REUSEADDR
|
||||
{ //bypass TIME_WAIT (this is supposed to still fail if another process still has it bound)
|
||||
int reuse = true;
|
||||
setsockopt(httpserversocket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ioctlsocket (httpserversocket, FIONBIO, &_true) == -1)
|
||||
{
|
||||
IWebPrintf ("HTTP_ServerInit: ioctl FIONBIO: %s\n", strerror(neterrno()));
|
||||
|
|
|
@ -2671,7 +2671,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
|
||||
memset ( &clip, 0, sizeof ( moveclip_t ) );
|
||||
|
||||
if (passedict && passedict->xv->hull && !(type & MOVE_IGNOREHULL))
|
||||
if (passedict->xv->hull && !(type & MOVE_IGNOREHULL))
|
||||
hullnum = passedict->xv->hull;
|
||||
#ifdef CLIENTONLY
|
||||
else
|
||||
|
@ -2800,7 +2800,7 @@ trace_t World_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t e
|
|||
clip.mins = mins;
|
||||
clip.maxs = maxs;
|
||||
clip.type = type;
|
||||
clip.passedict = passedict;
|
||||
clip.passedict = (passedict!=w->edicts)?passedict:NULL;
|
||||
clip.hullnum = 0;//hullnum; //BUG: hexen2's SV_ClipMoveToEntity's move_ent argument is set inconsistantly. This has the effect that the SOLID_BSP's .hull field is used instead of the SOLID_BBOX entity. We can't fix this because hexen2 depends upon it - this is the 'tibet5' bug.
|
||||
#ifdef Q2SERVER
|
||||
clip.q2passedict = NULL;
|
||||
|
|
Loading…
Reference in a new issue