Add support for SOLID_BSPTRIGGER.

This commit is contained in:
Shpoike 2021-09-08 02:44:57 +01:00
parent a950892aab
commit fb0f83ca00
5 changed files with 21 additions and 11 deletions

View file

@ -809,7 +809,7 @@ void R_ShowBoundingBoxes (void)
else
{
//box entity
if (ed->v.solid == SOLID_BSP && (ed->v.angles[0]||ed->v.angles[1]||ed->v.angles[2]) && pr_checkextension.value)
if ((ed->v.solid == SOLID_BSP || ed->v.solid == SOLID_EXT_BSPTRIGGER) && (ed->v.angles[0]||ed->v.angles[1]||ed->v.angles[2]) && pr_checkextension.value)
R_EmitWireBox (ed->v.absmin, ed->v.absmax);
else
{

View file

@ -7570,6 +7570,7 @@ static struct
{"FTE_QC_INFOKEY"},
{"FTE_QC_INTCONV"},
{"FTE_QC_MULTICAST"},
{"FTE_SOLID_BSPTRIGGER"},
{"FTE_STRINGS"},
#ifdef PSET_SCRIPT
{"FTE_SV_POINTPARTICLES", PR_Can_Particles},
@ -8265,6 +8266,7 @@ void PR_DumpPlatform_f(void)
fprintf(f, "const float SOLID_NOT = %i;\n", SOLID_NOT);
fprintf(f, "const float SOLID_SLIDEBOX = %i;\n", SOLID_SLIDEBOX);
fprintf(f, "const float SOLID_TRIGGER = %i;\n", SOLID_TRIGGER);
fprintf(f, "const float SOLID_BSPTRIGGER = %i; /*requires FTE_SOLID_BSPTRIGGER*/\n", SOLID_EXT_BSPTRIGGER);
fprintf(f, "const float MOVETYPE_NONE = %i;\n", MOVETYPE_NONE);
fprintf(f, "const float MOVETYPE_WALK = %i;\n", MOVETYPE_WALK);

View file

@ -249,6 +249,7 @@ typedef struct client_s
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
#define SOLID_EXT_CORPSE 5 // passes through slidebox+other corpses, but not bsp/bbox/triggers
#define SOLID_EXT_BSPTRIGGER 22
// edict->deadflag values
#define DEAD_NO 0

View file

@ -444,7 +444,7 @@ trace_t SV_PushEntity (edict_t *ent, vec3_t push)
if (ent->v.movetype == MOVETYPE_FLYMISSILE)
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_MISSILE, ent);
else if (ent->v.solid == SOLID_TRIGGER || ent->v.solid == SOLID_NOT)
else if (ent->v.solid == SOLID_TRIGGER || ent->v.solid == SOLID_EXT_BSPTRIGGER || ent->v.solid == SOLID_NOT)
// only clip against bmodels
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent);
else
@ -633,7 +633,7 @@ static qboolean SV_PushMoveAngles (edict_t *pusher, float movetime)
if (pusher->v.skin < 0)
continue;
if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER)
if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER || check->v.solid == SOLID_EXT_BSPTRIGGER)
{ // corpse
check->v.mins[0] = check->v.mins[1] = 0;
VectorCopy (check->v.mins, check->v.maxs);
@ -792,7 +792,7 @@ void SV_PushMove (edict_t *pusher, float movetime)
{ // fail the move
if (check->v.mins[0] == check->v.maxs[0])
continue;
if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER)
if (check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER || check->v.solid == SOLID_EXT_BSPTRIGGER)
{ // corpse
check->v.mins[0] = check->v.mins[1] = 0;
VectorCopy (check->v.mins, check->v.maxs);

View file

@ -138,7 +138,7 @@ hull_t *SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
hull_t *hull;
// decide which clipping hull to use, based on the size
if (ent->v.solid == SOLID_BSP)
if (ent->v.solid == SOLID_BSP || ent->v.solid == SOLID_EXT_BSPTRIGGER)
{ // explicit hulls in the BSP model
if (ent->v.movetype != MOVETYPE_PUSH && !pr_checkextension.value)
Con_Warning ("SOLID_BSP without MOVETYPE_PUSH (%s at %f %f %f)\n",
@ -284,7 +284,7 @@ SV_AreaTriggerEdicts ( edict_t *ent, areanode_t *node, edict_t **list, int *list
touch = EDICT_FROM_AREA(l);
if (touch == ent)
continue;
if (!touch->v.touch || touch->v.solid != SOLID_TRIGGER)
if (!touch->v.touch || (touch->v.solid != SOLID_TRIGGER && touch->v.solid != SOLID_EXT_BSPTRIGGER))
continue;
if (ent->v.absmin[0] > touch->v.absmax[0]
|| ent->v.absmin[1] > touch->v.absmax[1]
@ -342,7 +342,7 @@ void SV_TouchLinks (edict_t *ent)
// edicts later in the list no longer touch
if (touch == ent)
continue;
if (!touch->v.touch || touch->v.solid != SOLID_TRIGGER)
if (!touch->v.touch || (touch->v.solid != SOLID_TRIGGER && touch->v.solid != SOLID_EXT_BSPTRIGGER))
continue;
if (ent->v.absmin[0] > touch->v.absmax[0]
|| ent->v.absmin[1] > touch->v.absmax[1]
@ -351,6 +351,13 @@ void SV_TouchLinks (edict_t *ent)
|| ent->v.absmax[1] < touch->v.absmin[1]
|| ent->v.absmax[2] < touch->v.absmin[2] )
continue;
if (touch->v.solid == SOLID_EXT_BSPTRIGGER)
{
if (!SV_ClipMoveToEntity(touch, ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, CONTENTMASK_ANYSOLID).startsolid)
continue;
}
old_self = pr_global_struct->self;
old_other = pr_global_struct->other;
@ -432,7 +439,7 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
return;
// set the abs box
if (ent->v.solid == SOLID_BSP && (ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2]) && pr_checkextension.value)
if ((ent->v.solid == SOLID_BSP||ent->v.solid == SOLID_EXT_BSPTRIGGER) && (ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2]) && pr_checkextension.value)
{ // expand for rotation the lame way. hopefully there's an origin brush in there.
int i;
float v1,v2;
@ -503,7 +510,7 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
// link it in
if (ent->v.solid == SOLID_TRIGGER)
if (ent->v.solid == SOLID_TRIGGER || ent->v.solid == SOLID_EXT_BSPTRIGGER)
InsertLinkBefore (&ent->area, &node->trigger_edicts);
else
InsertLinkBefore (&ent->area, &node->solid_edicts);
@ -832,7 +839,7 @@ trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t max
VectorSubtract (end, offset, end_l);
// trace a line through the apropriate clipping hull
if (ent->v.solid == SOLID_BSP && (ent->v.angles[0]||ent->v.angles[1]||ent->v.angles[2]) && pr_checkextension.value && qcvm->edicts != ent) //don't rotate the world entity's collisions (its not networked, and some maps are buggy, resulting in screwed collisions)
if ((ent->v.solid == SOLID_BSP || ent->v.solid == SOLID_EXT_BSPTRIGGER) && (ent->v.angles[0]||ent->v.angles[1]||ent->v.angles[2]) && pr_checkextension.value && qcvm->edicts != ent) //don't rotate the world entity's collisions (its not networked, and some maps are buggy, resulting in screwed collisions)
{
#define DotProductTranspose(v,m,a) ((v)[0]*(m)[0][a] + (v)[1]*(m)[1][a] + (v)[2]*(m)[2][a])
vec3_t axis[3], start_r, end_r, tmp;
@ -892,7 +899,7 @@ static void SV_ClipToLinks ( areanode_t *node, moveclip_t *clip )
continue;
if (touch == clip->passedict)
continue;
if (touch->v.solid == SOLID_TRIGGER)
if (touch->v.solid == SOLID_TRIGGER || touch->v.solid == SOLID_EXT_BSPTRIGGER)
Sys_Error ("Trigger in clipping list");
if (clip->type == MOVE_NOMONSTERS && touch->v.solid != SOLID_BSP)