Make CSQC's cliptonetwork stuff skip according to entnum, so deltalisten ents (or weird hacks) can pass through the ssqc ents they're supposed to represent.

This commit is contained in:
Shpoike 2023-11-28 02:55:07 +00:00
parent 5334ca5d4c
commit 5474a5a5c8
3 changed files with 87 additions and 84 deletions

View file

@ -354,86 +354,6 @@ static void CSQC_FindGlobals(qboolean nofuncs)
*csqcg.maxclients = cl.allocated_client_slots; *csqcg.maxclients = cl.allocated_client_slots;
} }
//note: doesn't even have to match the clprogs.dat :)
typedef struct {
#define comfieldfloat(csqcname,desc) float csqcname;
#define comfieldvector(csqcname,desc) vec3_t csqcname;
#define comfieldentity(csqcname,desc) int csqcname;
#define comfieldstring(csqcname,desc) string_t csqcname;
#define comfieldfunction(csqcname, typestr,desc) func_t csqcname;
comqcfields
#undef comfieldfloat
#undef comfieldvector
#undef comfieldentity
#undef comfieldstring
#undef comfieldfunction
#ifdef VM_Q1
} csqcentvars_t;
typedef struct {
#endif
#define comfieldfloat(name,desc) float name;
#define comfieldint(name,desc) int name;
#define comfieldvector(name,desc) vec3_t name;
#define comfieldentity(name,desc) int name;
#define comfieldstring(name,desc) string_t name;
#define comfieldfunction(name, typestr,desc) func_t name;
comextqcfields
csqcextfields
#undef comfieldfloat
#undef comfieldint
#undef comfieldvector
#undef comfieldentity
#undef comfieldstring
#undef comfieldfunction
#ifdef VM_Q1
} csqcextentvars_t;
#else
} csqcentvars_t;
#endif
typedef struct csqcedict_s
{
enum ereftype_e ereftype;
float freetime; // sv.time when the object was freed
int entnum;
unsigned int fieldsize;
pbool readonly; //world
#ifdef VM_Q1
csqcentvars_t *v;
csqcextentvars_t *xv;
#else
union {
csqcentvars_t *v;
csqcentvars_t *xv;
};
#endif
/*the above is shared with qclib*/
#ifdef USEAREAGRID
areagridlink_t gridareas[AREAGRIDPERENT]; //on overflow, use the inefficient overflow list.
size_t gridareasequence; //used to avoid iterrating the same ent twice.
#else
link_t area;
#endif
pvscache_t pvsinfo;
int lastruntime;
int solidsize;
#ifdef USERBE
entityrbe_t rbe;
#endif
/*the above is shared with ssqc*/
//add whatever you wish here
trailkey_t trailstate;
int skinobject;
} csqcedict_t;
static void CSQC_InitFields(void) static void CSQC_InitFields(void)
{ //CHANGING THIS FUNCTION REQUIRES CHANGES TO csqcentvars_t { //CHANGING THIS FUNCTION REQUIRES CHANGES TO csqcentvars_t
#define comfieldfloat(name,desc) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (size_t)&((csqcentvars_t*)0)->name, -1); #define comfieldfloat(name,desc) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (size_t)&((csqcentvars_t*)0)->name, -1);

View file

@ -1176,6 +1176,84 @@ enum
ENDLIST ENDLIST
//note: doesn't even have to match the clprogs.dat :)
typedef struct {
#define comfieldfloat(csqcname,desc) float csqcname;
#define comfieldvector(csqcname,desc) vec3_t csqcname;
#define comfieldentity(csqcname,desc) int csqcname;
#define comfieldstring(csqcname,desc) string_t csqcname;
#define comfieldfunction(csqcname, typestr,desc) func_t csqcname;
comqcfields
#undef comfieldfloat
#undef comfieldvector
#undef comfieldentity
#undef comfieldstring
#undef comfieldfunction
#ifdef VM_Q1
} csqcentvars_t;
typedef struct {
#endif
#define comfieldfloat(name,desc) float name;
#define comfieldint(name,desc) int name;
#define comfieldvector(name,desc) vec3_t name;
#define comfieldentity(name,desc) int name;
#define comfieldstring(name,desc) string_t name;
#define comfieldfunction(name, typestr,desc) func_t name;
comextqcfields
csqcextfields
#undef comfieldfloat
#undef comfieldint
#undef comfieldvector
#undef comfieldentity
#undef comfieldstring
#undef comfieldfunction
#ifdef VM_Q1
} csqcextentvars_t;
#else
} csqcentvars_t;
#endif
typedef struct csqcedict_s
{
enum ereftype_e ereftype;
float freetime; // sv.time when the object was freed
int entnum;
unsigned int fieldsize;
pbool readonly; //world
#ifdef VM_Q1
csqcentvars_t *v;
csqcextentvars_t *xv;
#else
union {
csqcentvars_t *v;
csqcentvars_t *xv;
};
#endif
/*the above is shared with qclib*/
#ifdef USEAREAGRID
areagridlink_t gridareas[AREAGRIDPERENT]; //on overflow, use the inefficient overflow list.
size_t gridareasequence; //used to avoid iterrating the same ent twice.
#else
link_t area;
#endif
pvscache_t pvsinfo;
int lastruntime;
int solidsize;
#ifdef USERBE
entityrbe_t rbe;
#endif
/*the above is shared with ssqc*/
//add whatever you wish here
trailkey_t trailstate;
int skinobject;
} csqcedict_t;
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif

View file

@ -2137,13 +2137,22 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
float *ang; float *ang;
trace_t trace; trace_t trace;
static framestate_t framestate; //meh static framestate_t framestate; //meh
int skip;
if ((clip->type & MOVE_ENTCHAIN) || !pe) if ((clip->type & MOVE_ENTCHAIN) || !pe)
return; return;
skip = ((csqcedict_t*)clip->passedict)->xv->entnum;
//lets say that ssqc ents are in dimension 0x1, as far as the csqc can see.
if (clip->passedict && !((int)clip->passedict->xv->dimension_hit & 1))
return;
for (i = 0; i < pe->num_entities; i++) for (i = 0; i < pe->num_entities; i++)
{ {
touch = &pe->entities[i]; touch = &pe->entities[i];
if (touch->number == skip)
continue; //can happen with deltalisten or certain evil hacks.
if (touch->solidsize == ES_SOLID_BSP) if (touch->solidsize == ES_SOLID_BSP)
{ {
@ -2225,10 +2234,6 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
|| clip->boxmaxs[2] < touch->origin[2]+bmins[2] ) || clip->boxmaxs[2] < touch->origin[2]+bmins[2] )
continue; continue;
//lets say that ssqc ents are in dimension 0x1, as far as the csqc can see.
if (clip->passedict && !((int)clip->passedict->xv->dimension_hit & 1))
continue;
framestate.g[FS_REG].frame[0] = touch->frame; framestate.g[FS_REG].frame[0] = touch->frame;
framestate.g[FS_REG].lerpweight[0] = 1; framestate.g[FS_REG].lerpweight[0] = 1;