mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
minor bugfixes.
changed qw portal collision to match bboxes more closely. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4695 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
9ad0d24f54
commit
9ec5f0007b
5 changed files with 36 additions and 27 deletions
|
@ -623,12 +623,12 @@ void CL_ClampPitch (int pnum)
|
|||
}
|
||||
if (pv->pmovetype == PM_6DOF)
|
||||
{
|
||||
vec3_t impact;
|
||||
vec3_t norm;
|
||||
// vec3_t impact;
|
||||
// vec3_t norm;
|
||||
float mat2[16];
|
||||
vec3_t cross;
|
||||
// vec3_t cross;
|
||||
vec3_t view[4];
|
||||
float dot;
|
||||
// float dot;
|
||||
AngleVectors(pv->viewangles, view[0], view[1], view[2]);
|
||||
Matrix4x4_RM_FromVectors(mat, view[0], view[1], view[2], vec3_origin);
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ static qboolean PM_TransformedHullCheck (model_t *model, vec3_t start, vec3_t en
|
|||
//a portal is flush with a world surface behind it.
|
||||
//this causes problems. namely that we can't pass through the portal plane if the bsp behind it prevents out origin from getting through.
|
||||
//so if the trace was clipped and ended infront of the portal, continue the trace to the edges of the portal cutout instead.
|
||||
void PM_PortalCSG(physent_t *portal, float trminz, float trmaxz, vec3_t start, vec3_t end, trace_t *trace)
|
||||
void PM_PortalCSG(physent_t *portal, float *trmin, float *trmax, vec3_t start, vec3_t end, trace_t *trace)
|
||||
{
|
||||
vec4_t planes[6]; //far, near, right, left, up, down
|
||||
int plane;
|
||||
|
@ -286,19 +286,26 @@ void PM_PortalCSG(physent_t *portal, float trminz, float trmaxz, vec3_t start, v
|
|||
VectorNegate(planes[3], planes[2]);
|
||||
VectorNegate(planes[5], planes[4]);
|
||||
|
||||
trminz = fabs(trminz);
|
||||
portalradius/=2;
|
||||
planes[0][3] = DotProduct(portal->origin, planes[0]) - (trminz+fabs(trmaxz)+16);
|
||||
planes[1][3] = DotProduct(portal->origin, planes[1]) - (64.0/32); //an epsilon beyond the portal
|
||||
planes[2][3] = DotProduct(portal->origin, planes[2]) - portalradius+trminz;
|
||||
planes[3][3] = DotProduct(portal->origin, planes[3]) - portalradius+trminz;
|
||||
planes[4][3] = DotProduct(portal->origin, planes[4]) - portalradius+trminz;
|
||||
planes[5][3] = DotProduct(portal->origin, planes[5]) - portalradius+trminz;
|
||||
planes[0][3] = DotProduct(portal->origin, planes[0]) - (1.1/32);
|
||||
planes[1][3] = DotProduct(portal->origin, planes[1]) - (1.1/32); //an epsilon beyond the portal
|
||||
planes[2][3] = DotProduct(portal->origin, planes[2]) - portalradius;
|
||||
planes[3][3] = DotProduct(portal->origin, planes[3]) - portalradius;
|
||||
planes[4][3] = DotProduct(portal->origin, planes[4]) - portalradius;
|
||||
planes[5][3] = DotProduct(portal->origin, planes[5]) - portalradius;
|
||||
|
||||
//if we're actually inside the csg region
|
||||
for (plane = 0; plane < 6; plane++)
|
||||
{
|
||||
vec3_t nearest;
|
||||
float d = DotProduct(worldpos, planes[plane]);
|
||||
int k;
|
||||
for (k = 0; k < 3; k++)
|
||||
nearest[k] = (planes[plane][k]>=0)?trmax[k]:trmin[k];
|
||||
if (!plane) //front plane gets further away with side
|
||||
planes[plane][3] -= DotProduct(nearest, planes[plane]);
|
||||
else if (plane>1) //side planes get nearer with size
|
||||
planes[plane][3] += DotProduct(nearest, planes[plane]);
|
||||
if (d - planes[plane][3] >= 0)
|
||||
continue; //endpos is inside
|
||||
else
|
||||
|
@ -370,7 +377,7 @@ qboolean PM_TestPlayerPosition (vec3_t pos)
|
|||
{
|
||||
pe = &pmove.physents[j];
|
||||
if (pe->isportal)
|
||||
PM_PortalCSG(pe, pmove.player_mins[2], pmove.player_maxs[2], pos, pos, &trace);
|
||||
PM_PortalCSG(pe, pmove.player_mins, pmove.player_maxs, pos, pos, &trace);
|
||||
}
|
||||
if (trace.allsolid)
|
||||
return false;
|
||||
|
@ -434,7 +441,7 @@ trace_t PM_PlayerTrace (vec3_t start, vec3_t end, unsigned int solidmask)
|
|||
else if (pe->isportal)
|
||||
{
|
||||
//make sure we don't hit the world if we're inside the portal
|
||||
PM_PortalCSG(pe, pmove.player_mins[2], pmove.player_maxs[2], start, end, &total);
|
||||
PM_PortalCSG(pe, pmove.player_mins, pmove.player_maxs, start, end, &total);
|
||||
|
||||
// trace a line through the apropriate clipping hull
|
||||
if (!PM_TransformedHullCheck (pe->model, start, end, vec3_origin, vec3_origin, &trace, pe->origin, pe->angles))
|
||||
|
@ -452,7 +459,7 @@ trace_t PM_PlayerTrace (vec3_t start, vec3_t end, unsigned int solidmask)
|
|||
{
|
||||
pe = &pmove.physents[j];
|
||||
if (pe->isportal)
|
||||
PM_PortalCSG(pe, pmove.player_mins[2], pmove.player_maxs[2], start, end, &trace);
|
||||
PM_PortalCSG(pe, pmove.player_mins, pmove.player_maxs, start, end, &trace);
|
||||
}
|
||||
pe = &pmove.physents[i];
|
||||
}
|
||||
|
|
|
@ -843,7 +843,7 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist[2],
|
|||
}
|
||||
else
|
||||
{
|
||||
vec3_t point, vel;
|
||||
vec3_t point;
|
||||
VectorCopy(plane.normal, oplane.normal);
|
||||
//rotate the surface normal around its entity's matrix
|
||||
plane.normal[0] = oplane.normal[0]*batch->ent->axis[0][0] + oplane.normal[1]*batch->ent->axis[1][0] + oplane.normal[2]*batch->ent->axis[2][0];
|
||||
|
|
|
@ -4357,9 +4357,10 @@ extern sizebuf_t csqcmsgbuffer;
|
|||
void QCBUILTIN PF_WriteByte (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
int dest = G_FLOAT(OFS_PARM0);
|
||||
qbyte val = (qbyte)G_FLOAT(OFS_PARM1);
|
||||
if (dest == MSG_CSQC)
|
||||
{ //csqc buffers are always written.
|
||||
MSG_WriteByte(&csqcmsgbuffer, G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteByte(&csqcmsgbuffer, val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4373,13 +4374,13 @@ void QCBUILTIN PF_WriteByte (pubprogfuncs_t *prinst, struct globalvars_s *pr_glo
|
|||
|
||||
if (progstype == PROG_NQ || progstype == PROG_H2)
|
||||
{
|
||||
NPP_NQWriteByte(dest, (qbyte)G_FLOAT(OFS_PARM1));
|
||||
NPP_NQWriteByte(dest, val);
|
||||
return;
|
||||
}
|
||||
#ifdef NQPROT
|
||||
else
|
||||
{
|
||||
NPP_QWWriteByte(dest, (qbyte)G_FLOAT(OFS_PARM1));
|
||||
NPP_QWWriteByte(dest, val);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -4389,19 +4390,20 @@ void QCBUILTIN PF_WriteByte (pubprogfuncs_t *prinst, struct globalvars_s *pr_glo
|
|||
if (!cl)
|
||||
return;
|
||||
ClientReliableCheckBlock(cl, 1);
|
||||
ClientReliableWrite_Byte(cl, G_FLOAT(OFS_PARM1));
|
||||
ClientReliableWrite_Byte(cl, val);
|
||||
}
|
||||
else
|
||||
MSG_WriteByte (QWWriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteByte (QWWriteDest(dest), val);
|
||||
#endif
|
||||
}
|
||||
|
||||
void QCBUILTIN PF_WriteChar (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
int dest = G_FLOAT(OFS_PARM0);
|
||||
char val = (char)G_FLOAT(OFS_PARM1);
|
||||
if (dest == MSG_CSQC)
|
||||
{ //csqc buffers are always written.
|
||||
MSG_WriteChar(&csqcmsgbuffer, G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteChar(&csqcmsgbuffer, val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4414,13 +4416,13 @@ void QCBUILTIN PF_WriteChar (pubprogfuncs_t *prinst, struct globalvars_s *pr_glo
|
|||
|
||||
if (progstype == PROG_NQ || progstype == PROG_H2)
|
||||
{
|
||||
NPP_NQWriteChar(dest, (char)G_FLOAT(OFS_PARM1));
|
||||
NPP_NQWriteChar(dest, val);
|
||||
return;
|
||||
}
|
||||
#ifdef NQPROT
|
||||
else
|
||||
{
|
||||
NPP_QWWriteChar(dest, (char)G_FLOAT(OFS_PARM1));
|
||||
NPP_QWWriteChar(dest, val);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -4430,10 +4432,10 @@ void QCBUILTIN PF_WriteChar (pubprogfuncs_t *prinst, struct globalvars_s *pr_glo
|
|||
if (!cl)
|
||||
return;
|
||||
ClientReliableCheckBlock(cl, 1);
|
||||
ClientReliableWrite_Char(cl, G_FLOAT(OFS_PARM1));
|
||||
ClientReliableWrite_Char(cl, val);
|
||||
}
|
||||
else
|
||||
MSG_WriteChar (QWWriteDest(dest), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteChar (QWWriteDest(dest), val);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -5899,7 +5899,7 @@ void SV_ExecInitialConfigs(char *defaultexec)
|
|||
if (COM_FileSize("server.cfg") != -1)
|
||||
Cbuf_InsertText ("exec server.cfg\nexec ftesrv.cfg\n", RESTRICT_LOCAL, false);
|
||||
else
|
||||
Cbuf_InsertText ("cl_warncmd 0\nexec quake.rc\nexec ftesrv.cfg\ncl_warncmd 1\n", RESTRICT_LOCAL, false);
|
||||
Cbuf_InsertText ("cl_warncmd 0\nexec quake.rc\ncl_warncmd 1\nexec ftesrv.cfg\n", RESTRICT_LOCAL, false);
|
||||
|
||||
// process command line arguments
|
||||
Cbuf_Execute ();
|
||||
|
|
Loading…
Reference in a new issue