Fix up SOLID_CORPSE a little.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5952 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-07-06 00:12:12 +00:00
parent f4ec928c2d
commit 18c0e79c47
6 changed files with 67 additions and 59 deletions

View file

@ -181,6 +181,7 @@ enum q1contents_e
Q1CONTENTS_LADDER = -16, /*player can climb up/down*/
Q1CONTENTS_MONSTERCLIP = -17, /*solid to monster movement*/
Q1CONTENTS_PLAYERCLIP = -18, /*solid to player movement*/
Q1CONTENTS_CORPSE = -19, /*solid to tracelines*/
};
// !!! if this is changed, it must be changed in asm_i386.h too !!!

View file

@ -1348,6 +1348,7 @@ static unsigned int Q1BSP_TranslateContents(enum q1contents_e contents)
case Q1CONTENTS_TRANS: return FTECONTENTS_SOLID;
case Q1CONTENTS_MONSTERCLIP: return FTECONTENTS_MONSTERCLIP;
case Q1CONTENTS_PLAYERCLIP: return FTECONTENTS_PLAYERCLIP;
case Q1CONTENTS_CORPSE: return FTECONTENTS_CORPSE;
safedefault:
Con_Printf("Q1BSP_TranslateContents: Unknown contents type - %i", contents);

View file

@ -10298,7 +10298,7 @@ void SV_SetEntityButtons(edict_t *ent, unsigned int buttonbits)
}
}
static void SV_SetSSQCInputs(usercmd_t *ucmd)
void SV_SetSSQCInputs(usercmd_t *ucmd)
{
if (pr_global_ptrs->input_timelength)
pr_global_struct->input_timelength = ucmd->msec/1000.0f * sv.gamespeed;

View file

@ -1358,6 +1358,7 @@ void SV_VoiceInitClient(client_t *client);
void SV_VoiceSendPacket(client_t *client, sizebuf_t *buf);
#endif
void SV_SetSSQCInputs(usercmd_t *ucmd);
void SV_ClientThink (void);
void SV_Begin_Core(client_t *split); //sets up the player's gamecode state
void SV_DespawnClient(client_t *cl); //shuts down the gamecode state.

View file

@ -32,7 +32,7 @@ hull_t *SV_HullForEntity (edict_t *ent, int hullnum, vec3_t mins, vec3_t maxs, v
edict_t *sv_player;
usercmd_t cmd;
static usercmd_t cmd;
void QDECL SV_NQPhysicsUpdate(cvar_t *var, char *oldvalue)
{
@ -6703,6 +6703,8 @@ static qboolean AddEntityToPmove(world_t *w, wedict_t *player, wedict_t *check)
q1contents = (int)check->v->skin;
if (solid == SOLID_LADDER)
q1contents = Q1CONTENTS_LADDER; //legacy crap
else if (solid == SOLID_CORPSE)
q1contents = Q1CONTENTS_CORPSE; //legacy crap
safeswitch(q1contents)
{
case Q1CONTENTS_EMPTY: pe->nonsolid = true; pe->forcecontentsmask = FTECONTENTS_EMPTY; break;
@ -6722,6 +6724,7 @@ static qboolean AddEntityToPmove(world_t *w, wedict_t *player, wedict_t *check)
case Q1CONTENTS_LADDER: pe->nonsolid = true; pe->forcecontentsmask = FTECONTENTS_LADDER; break;
case Q1CONTENTS_MONSTERCLIP: pe->nonsolid = true; pe->forcecontentsmask = FTECONTENTS_MONSTERCLIP; break;
case Q1CONTENTS_PLAYERCLIP: pe->nonsolid = false; pe->forcecontentsmask = FTECONTENTS_PLAYERCLIP; break;
case Q1CONTENTS_CORPSE: pe->nonsolid = true; pe->forcecontentsmask = FTECONTENTS_CORPSE; break;
safedefault:
pe->forcecontentsmask = 0;
break;
@ -9341,6 +9344,8 @@ void SV_ClientThink (void)
sv_player->xv->movement[2] = cmd.upmove;
}
SV_SetSSQCInputs(&cmd);
if (SV_PlayerPhysicsQC && !host_client->spectator)
{
pr_global_struct->time = sv.world.physicstime;

View file

@ -1227,7 +1227,15 @@ qboolean World_TransformedTrace (struct model_s *model, int hulloverride, frames
if (angles[0] || angles[1] || angles[2])
{
AngleVectors (angles, axis[0], axis[1], axis[2]);
if (model->type == mod_alias)
{
axis[2][0] = angles[0] * r_meshpitch.value;
axis[2][1] = angles[1];
axis[2][2] = angles[2] * r_meshroll.value;
AngleVectors (axis[2], axis[0], axis[1], axis[2]);
}
else
AngleVectors (angles, axis[0], axis[1], axis[2]);
VectorNegate(axis[1], axis[1]);
result = model->funcs.NativeTrace (model, hulloverride, framestate, axis, start_l, end_l, mins, maxs, capsule, hitcontentsmask, trace);
}
@ -1270,9 +1278,10 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
model_t *model;
int mdlidx = ent->v->modelindex;
framestate_t framestate;
int solid = ent->v->solid;
// get the clipping hull
if ((ent->v->solid == SOLID_BSP || ent->v->solid == SOLID_BSPTRIGGER || ent->v->solid == SOLID_PORTAL) && mdlidx)
if ((solid == SOLID_BSP || solid == SOLID_BSPTRIGGER || solid == SOLID_PORTAL) && mdlidx)
{
model = w->Get_CModel(w, mdlidx);
if (!model || !model->funcs.PointContents)
@ -1291,11 +1300,6 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
VectorSubtract (ent->v->mins, maxs, boxmins);
VectorSubtract (ent->v->maxs, mins, boxmaxs);
if (hitcontentsmask & ((ent->v->solid == SOLID_CORPSE && w->usesolidcorpse)?FTECONTENTS_CORPSE:FTECONTENTS_BODY))
hitcontentsmask = FTECONTENTS_CORPSE|FTECONTENTS_BODY;
else
hitcontentsmask = 0;
// if (ent->xv->geomtype == GEOMTYPE_CAPSULE && !hitmodel)
// model = World_CapsuleForBox(boxmins, boxmaxs);
// else
@ -1305,7 +1309,7 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
w->Get_FrameState(w, ent, &framestate);
// trace a line through the apropriate clipping hull
if (ent->v->solid == SOLID_PORTAL)
if (solid == SOLID_PORTAL)
{
//solid_portal cares only about origins and as such has no mins/max
World_TransformedTrace(model, 0, &framestate, start, end, vec3_origin, vec3_origin, capsule, &trace, eorg, eang, hitcontentsmask);
@ -1313,58 +1317,52 @@ static trace_t World_ClipMoveToEntity (world_t *w, wedict_t *ent, vec3_t eorg, v
trace.startsolid = false;
hitmodel = false;
}
else if (ent->v->solid != SOLID_BSP && ent->v->solid != SOLID_BSPTRIGGER)
{
eang[0]*=r_meshpitch.value; //carmack made bsp models rotate wrongly.
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, hitcontentsmask);
eang[0]*=r_meshpitch.value;
}
else
{
if (ent->v->skin < 0)
{ //if forcedcontents is set, then ALL brushes in this model are forced to the specified contents value.
//we achive this by tracing against ALL then forcing it after.
int forcedcontents;
safeswitch((enum q1contents_e)(int)ent->v->skin)
{
case Q1CONTENTS_EMPTY: forcedcontents = FTECONTENTS_EMPTY; break;
case Q1CONTENTS_SOLID: forcedcontents = FTECONTENTS_SOLID; break;
case Q1CONTENTS_WATER: forcedcontents = FTECONTENTS_WATER; break;
case Q1CONTENTS_SLIME: forcedcontents = FTECONTENTS_SLIME; break;
case Q1CONTENTS_LAVA: forcedcontents = FTECONTENTS_LAVA; break;
case Q1CONTENTS_SKY: forcedcontents = FTECONTENTS_SKY; break;
case Q1CONTENTS_LADDER: forcedcontents = FTECONTENTS_LADDER; break;
case Q1CONTENTS_CLIP: forcedcontents = FTECONTENTS_PLAYERCLIP|FTECONTENTS_MONSTERCLIP;break;
case Q1CONTENTS_CURRENT_0: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_0; break;
case Q1CONTENTS_CURRENT_90: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_90; break;
case Q1CONTENTS_CURRENT_180: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_180; break;
case Q1CONTENTS_CURRENT_270: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_270; break;
case Q1CONTENTS_CURRENT_UP: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_UP; break;
case Q1CONTENTS_CURRENT_DOWN: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_DOWN; break;
case Q1CONTENTS_TRANS: forcedcontents = FTECONTENTS_SOLID; break;
case Q1CONTENTS_MONSTERCLIP: forcedcontents = FTECONTENTS_MONSTERCLIP; break;
case Q1CONTENTS_PLAYERCLIP: forcedcontents = FTECONTENTS_PLAYERCLIP; break;
safedefault: forcedcontents = 0; break;
}
if (hitcontentsmask & forcedcontents)
{
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, ~0u);
if (trace.contents)
trace.contents = forcedcontents;
}
else
{
memset (&trace, 0, sizeof(trace_t));
trace.fraction = trace.truefraction = 1;
trace.allsolid = false;
trace.startsolid = false;
trace.inopen = true; //probably wrong...
VectorCopy (end, trace.endpos);
}
else if (solid == SOLID_CORPSE)
goto scorpse;
else if (ent->v->skin < 0)
{ //if forcedcontents is set, then ALL brushes in this model are forced to the specified contents value.
//we achive this by tracing against ALL then forcing it after.
int forcedcontents;
safeswitch((enum q1contents_e)(int)ent->v->skin)
{
case Q1CONTENTS_EMPTY: forcedcontents = FTECONTENTS_EMPTY; break;
case Q1CONTENTS_SOLID: forcedcontents = FTECONTENTS_SOLID; break;
case Q1CONTENTS_WATER: forcedcontents = FTECONTENTS_WATER; break;
case Q1CONTENTS_SLIME: forcedcontents = FTECONTENTS_SLIME; break;
case Q1CONTENTS_LAVA: forcedcontents = FTECONTENTS_LAVA; break;
case Q1CONTENTS_SKY: forcedcontents = FTECONTENTS_SKY; break;
case Q1CONTENTS_LADDER: forcedcontents = FTECONTENTS_LADDER; break;
case Q1CONTENTS_CLIP: forcedcontents = FTECONTENTS_PLAYERCLIP|FTECONTENTS_MONSTERCLIP;break;
case Q1CONTENTS_CURRENT_0: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_0; break;
case Q1CONTENTS_CURRENT_90: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_90; break;
case Q1CONTENTS_CURRENT_180: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_180; break;
case Q1CONTENTS_CURRENT_270: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_270; break;
case Q1CONTENTS_CURRENT_UP: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_UP; break;
case Q1CONTENTS_CURRENT_DOWN: forcedcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_DOWN; break;
case Q1CONTENTS_TRANS: forcedcontents = FTECONTENTS_SOLID; break;
case Q1CONTENTS_MONSTERCLIP: forcedcontents = FTECONTENTS_MONSTERCLIP; break;
case Q1CONTENTS_PLAYERCLIP: forcedcontents = FTECONTENTS_PLAYERCLIP; break;
case Q1CONTENTS_CORPSE:scorpse: forcedcontents = FTECONTENTS_CORPSE; break;
safedefault: forcedcontents = 0; break;
}
if (hitcontentsmask & forcedcontents)
{
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, ~0u);
if (trace.contents)
trace.contents = forcedcontents;
}
else
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, hitcontentsmask);
{
memset (&trace, 0, sizeof(trace_t));
trace.fraction = trace.truefraction = 1;
trace.allsolid = false;
trace.startsolid = false;
trace.inopen = true; //probably wrong...
VectorCopy (end, trace.endpos);
}
}
else
World_TransformedTrace(model, hullnum, &framestate, start, end, mins, maxs, capsule, &trace, eorg, eang, hitcontentsmask);
// if using hitmodel, we know it hit the bounding box, so try a proper trace now.
if (hitmodel && (trace.fraction != 1 || trace.startsolid) && !model)
@ -2196,6 +2194,7 @@ static unsigned int World_ContentsOfLinks (world_t *w, areagridlink_t *node, vec
case Q1CONTENTS_LADDER: forcedcontents = FTECONTENTS_LADDER; break;
case Q1CONTENTS_MONSTERCLIP: forcedcontents = FTECONTENTS_MONSTERCLIP; break;
case Q1CONTENTS_PLAYERCLIP: forcedcontents = FTECONTENTS_PLAYERCLIP; break;
case Q1CONTENTS_CORPSE: forcedcontents = FTECONTENTS_CORPSE; break;
safedefault: forcedcontents = 0; break;
}
c = forcedcontents;
@ -2487,6 +2486,7 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
case Q1CONTENTS_CURRENT_270: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_270; break;
case Q1CONTENTS_CURRENT_UP: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_UP; break;
case Q1CONTENTS_CURRENT_DOWN: touchcontents = FTECONTENTS_WATER|Q2CONTENTS_CURRENT_DOWN; break;
case Q1CONTENTS_CORPSE: touchcontents = FTECONTENTS_CORPSE; break;
safedefault: touchcontents = ~0; break; //could be anything... :(
}
}