mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-31 12:40:43 +00:00
This seems to stop the server from crashing horribly with origional q3 mods. You still need to get the latest q3 patch if you want to use fte+q3.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1490 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
c407b987ee
commit
a5d7e99940
1 changed files with 20 additions and 17 deletions
|
@ -278,6 +278,7 @@ char *mapentspointer;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
link_t area;
|
link_t area;
|
||||||
|
qboolean linked;
|
||||||
int areanum;
|
int areanum;
|
||||||
int areanum2;
|
int areanum2;
|
||||||
int headnode;
|
int headnode;
|
||||||
|
@ -286,24 +287,31 @@ typedef struct {
|
||||||
} q3serverEntity_t;
|
} q3serverEntity_t;
|
||||||
q3serverEntity_t *q3_sentities;
|
q3serverEntity_t *q3_sentities;
|
||||||
|
|
||||||
|
|
||||||
void Q3G_UnlinkEntity(q3sharedEntity_t *ent)
|
void Q3G_UnlinkEntity(q3sharedEntity_t *ent)
|
||||||
{
|
{
|
||||||
q3serverEntity_t *sent;
|
q3serverEntity_t *sent;
|
||||||
|
|
||||||
if(!ent->r.linked)
|
ent->r.linked = false;
|
||||||
return; // not linked in anywhere
|
|
||||||
|
|
||||||
sent = SENTITY_FOR_GENTITY(ent);
|
sent = SENTITY_FOR_GENTITY(ent);
|
||||||
if (sent->area.next)
|
|
||||||
RemoveLink(&sent->area);
|
if(!sent->linked)
|
||||||
|
{
|
||||||
|
return; // not linked in anywhere
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sent->area.prev == NULL || sent->area.next == NULL)
|
||||||
|
SV_Error("Null entity links in linked entity\n");
|
||||||
|
|
||||||
|
RemoveLink(&sent->area);
|
||||||
sent->area.prev = sent->area.next = NULL;
|
sent->area.prev = sent->area.next = NULL;
|
||||||
|
|
||||||
ent->r.linked = false;
|
sent->linked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_TOTAL_ENT_LEAFS 256
|
#define MAX_TOTAL_ENT_LEAFS 256
|
||||||
|
|
||||||
|
|
||||||
void Q3G_LinkEntity(q3sharedEntity_t *ent)
|
void Q3G_LinkEntity(q3sharedEntity_t *ent)
|
||||||
{
|
{
|
||||||
areanode_t *node;
|
areanode_t *node;
|
||||||
|
@ -317,14 +325,14 @@ void Q3G_LinkEntity(q3sharedEntity_t *ent)
|
||||||
const float *origin;
|
const float *origin;
|
||||||
const float *angles;
|
const float *angles;
|
||||||
|
|
||||||
if(ent->r.linked)
|
sent = SENTITY_FOR_GENTITY(ent);
|
||||||
|
|
||||||
|
if(sent->linked)
|
||||||
Q3G_UnlinkEntity(ent); // unlink from old position
|
Q3G_UnlinkEntity(ent); // unlink from old position
|
||||||
|
|
||||||
// encode the size into the entity_state for client prediction
|
// encode the size into the entity_state for client prediction
|
||||||
if(ent->r.bmodel)
|
if(ent->r.bmodel)
|
||||||
{
|
|
||||||
ent->s.solid = Q3SOLID_BMODEL;
|
ent->s.solid = Q3SOLID_BMODEL;
|
||||||
}
|
|
||||||
else if(ent->r.contents & (Q3CONTENTS_BODY|Q3CONTENTS_SOLID))
|
else if(ent->r.contents & (Q3CONTENTS_BODY|Q3CONTENTS_SOLID))
|
||||||
{
|
{
|
||||||
// assume that x/y are equal and symetric
|
// assume that x/y are equal and symetric
|
||||||
|
@ -344,10 +352,7 @@ void Q3G_LinkEntity(q3sharedEntity_t *ent)
|
||||||
else
|
else
|
||||||
ent->s.solid = 0;
|
ent->s.solid = 0;
|
||||||
|
|
||||||
//origin = (ent->r.svFlags & SVF_USE_CURRENT_ORIGIN) ? ent->r.currentOrigin : ent->s.origin;
|
// always use currentOrigin
|
||||||
//angles = (ent->r.svFlags & SVF_USE_CURRENT_ORIGIN) ? ent->r.currentAngles : ent->s.angles;
|
|
||||||
|
|
||||||
// FIXME - always use currentOrigin?
|
|
||||||
origin = ent->r.currentOrigin;
|
origin = ent->r.currentOrigin;
|
||||||
angles = ent->r.currentAngles;
|
angles = ent->r.currentAngles;
|
||||||
|
|
||||||
|
@ -390,8 +395,6 @@ void Q3G_LinkEntity(q3sharedEntity_t *ent)
|
||||||
ent->r.absmax[1] += 1;
|
ent->r.absmax[1] += 1;
|
||||||
ent->r.absmax[2] += 1;
|
ent->r.absmax[2] += 1;
|
||||||
|
|
||||||
sent = SENTITY_FOR_GENTITY(ent);
|
|
||||||
|
|
||||||
// link to PVS leafs
|
// link to PVS leafs
|
||||||
sent->num_clusters = 0;
|
sent->num_clusters = 0;
|
||||||
sent->areanum = -1;
|
sent->areanum = -1;
|
||||||
|
@ -461,6 +464,7 @@ void Q3G_LinkEntity(q3sharedEntity_t *ent)
|
||||||
|
|
||||||
ent->r.linkcount++;
|
ent->r.linkcount++;
|
||||||
ent->r.linked = true;
|
ent->r.linked = true;
|
||||||
|
sent->linked = true;
|
||||||
|
|
||||||
// find the first node that the ent's box crosses
|
// find the first node that the ent's box crosses
|
||||||
node = sv_areanodes;
|
node = sv_areanodes;
|
||||||
|
@ -477,10 +481,9 @@ void Q3G_LinkEntity(q3sharedEntity_t *ent)
|
||||||
break; // crosses the node
|
break; // crosses the node
|
||||||
}
|
}
|
||||||
// link it in
|
// link it in
|
||||||
InsertLinkBefore((link_t *)sent, &node->solid_edicts);
|
InsertLinkBefore((link_t *)&sent->area, &node->solid_edicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SVQ3_EntitiesInBoxNode(areanode_t *node, vec3_t mins, vec3_t maxs, int *list, int maxcount)
|
int SVQ3_EntitiesInBoxNode(areanode_t *node, vec3_t mins, vec3_t maxs, int *list, int maxcount)
|
||||||
{
|
{
|
||||||
link_t *l, *next;
|
link_t *l, *next;
|
||||||
|
|
Loading…
Reference in a new issue