EXT_DIMENSION_PHYSICS

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@124 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-09-04 17:51:20 +00:00
parent eefc867262
commit 123eb55418

View file

@ -358,13 +358,11 @@ SV_TouchLinks
#define MAX_NODELINKS 256 //all this means is that any more than this will not touch. #define MAX_NODELINKS 256 //all this means is that any more than this will not touch.
edict_t *nodelinks[MAX_NODELINKS]; edict_t *nodelinks[MAX_NODELINKS];
void SV_TouchLinks ( edict_t *ent, areanode_t *node ) void SV_TouchLinks ( edict_t *ent, areanode_t *node )
{ { //Spike: rewritten this function to cope with killtargets used on a few maps.
link_t *l, *next; link_t *l, *next;
edict_t *touch; edict_t *touch;
int old_self, old_other; int old_self, old_other;
#if 1
int linkcount = 0, ln; int linkcount = 0, ln;
//work out who they are first. //work out who they are first.
@ -386,7 +384,7 @@ void SV_TouchLinks ( edict_t *ent, areanode_t *node )
|| ent->v.absmax[2] < touch->v.absmin[2] ) || ent->v.absmax[2] < touch->v.absmin[2] )
continue; continue;
if (!((int)ent->v.dimension_physics & (int)touch->v.dimension_physics)) if (!((int)ent->v.dimension_solid & (int)touch->v.dimension_hit))
continue; continue;
nodelinks[linkcount++] = touch; nodelinks[linkcount++] = touch;
@ -413,54 +411,23 @@ void SV_TouchLinks ( edict_t *ent, areanode_t *node )
|| ent->v.absmax[2] < touch->v.absmin[2] ) || ent->v.absmax[2] < touch->v.absmin[2] )
continue; continue;
if (!((int)ent->v.dimension_physics & (int)touch->v.dimension_physics)) if (!((int)ent->v.dimension_solid & (int)touch->v.dimension_hit)) //didn't change did it?...
continue; continue;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, touch); pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, touch);
pr_global_struct->other = EDICT_TO_PROG(svprogfuncs, ent); pr_global_struct->other = EDICT_TO_PROG(svprogfuncs, ent);
pr_global_struct->time = sv.time; pr_global_struct->time = sv.time;
PR_ExecuteProgram (svprogfuncs, touch->v.touch); PR_ExecuteProgram (svprogfuncs, touch->v.touch);
if (ent->isfree)
break;
} }
pr_global_struct->self = old_self; pr_global_struct->self = old_self;
pr_global_struct->other = old_other; pr_global_struct->other = old_other;
#else
// touch linked edicts
for (l = node->trigger_edicts.next ; l != &node->trigger_edicts ; l = next)
{
if (!l) //this is potentially wrong, but simpler than building a list of all ents to touch.
break;
next = l->next;
touch = EDICT_FROM_AREA(l);
if (touch == ent)
continue;
if (!touch->v.touch || touch->v.solid != SOLID_TRIGGER)
continue;
if (ent->v.absmin[0] > touch->v.absmax[0]
|| ent->v.absmin[1] > touch->v.absmax[1]
|| ent->v.absmin[2] > touch->v.absmax[2]
|| ent->v.absmax[0] < touch->v.absmin[0]
|| ent->v.absmax[1] < touch->v.absmin[1]
|| ent->v.absmax[2] < touch->v.absmin[2] )
continue;
if (!((int)ent->v.dimension_physics & (int)touch->dimension_physics))
continue;
old_self = pr_global_struct->self;
old_other = pr_global_struct->other;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, touch);
pr_global_struct->other = EDICT_TO_PROG(svprogfuncs, ent);
pr_global_struct->time = sv.time;
PR_ExecuteProgram (svprogfuncs, touch->v.touch);
pr_global_struct->self = old_self;
pr_global_struct->other = old_other;
}
#endif
// recurse down both sides // recurse down both sides
if (node->axis == -1) if (node->axis == -1 || ent->isfree)
return; return;
if ( ent->v.absmax[node->axis] > node->dist ) if ( ent->v.absmax[node->axis] > node->dist )
@ -1461,7 +1428,7 @@ void SV_ClipMoveToEntities ( moveclip_t *clip )
if (clip->type & MOVE_NOMONSTERS && touch->v.solid != SOLID_BSP) if (clip->type & MOVE_NOMONSTERS && touch->v.solid != SOLID_BSP)
continue; continue;
if (!((int)clip->passedict->v.dimension_physics & (int)touch->v.dimension_physics)) if (!((int)clip->passedict->v.dimension_hit & (int)touch->v.dimension_solid))
continue; continue;
// if ( !(clip->contentmask & CONTENTS_DEADMONSTER) // if ( !(clip->contentmask & CONTENTS_DEADMONSTER)
@ -1609,7 +1576,7 @@ void SV_ClipToLinks ( areanode_t *node, moveclip_t *clip )
if (clip->passedict && clip->passedict->v.size[0] && !touch->v.size[0]) if (clip->passedict && clip->passedict->v.size[0] && !touch->v.size[0])
continue; // points never interact continue; // points never interact
if (!((int)clip->passedict->v.dimension_physics & (int)touch->v.dimension_physics)) if (!((int)clip->passedict->v.dimension_hit & (int)touch->v.dimension_solid))
continue; continue;
// might intersect, so do an exact clip // might intersect, so do an exact clip