Fixed zombies getting stuck inside eachother on Vita and NX.

Also fixes some misc pathfinding bugs apparently :P
This commit is contained in:
Tyler Young 2023-01-02 12:02:57 -05:00
parent 770fb49e68
commit bcbd9ac17f
5 changed files with 39 additions and 17 deletions

View file

@ -483,11 +483,8 @@ void CL_RelinkEntities (void)
for (j=0 ; j<3 ; j++)
{
delta[j] = ent->msg_origins[0][j] - ent->msg_origins[1][j];
if (delta[j] > 100 || delta[j] < -100)
{
if (delta[j] > 100 || delta[j] < -100)//blubs check here for interpolating zombies
f = 1; // assume a teleportation, not a motion
ent->lerpflags |= LERP_RESETMOVE; //johnfitz -- don't lerp teleports
}
}
//johnfitz -- don't cl_lerp entities that will be r_lerped

View file

@ -874,6 +874,25 @@ int TraceMove(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edic
return 0;
}
void PF_tracemove(void)//progs side
{
float *start, *end, *mins, *maxs;
int nomonsters;
edict_t *ent;
start = G_VECTOR(OFS_PARM0);
mins = G_VECTOR(OFS_PARM1);
maxs = G_VECTOR(OFS_PARM2);
end = G_VECTOR(OFS_PARM3);
nomonsters = G_FLOAT(OFS_PARM4);
ent = G_EDICT(OFS_PARM5);
Con_DPrintf ("TraceMove start, ");
G_INT(OFS_RETURN) = TraceMove(start, mins, maxs, end,nomonsters,ent);
Con_DPrintf ("TM end\n");
return;
}
/*
=================
PF_checkpos
@ -3171,7 +3190,7 @@ static builtin_t pr_builtin[] =
NULL, // #96
NULL, // #97
PF_FindFloat, // #98
NULL, // #99
PF_tracemove, // #99 sB reenabled
NULL, // #100
NULL, // #101
NULL, // #102

View file

@ -139,6 +139,7 @@ typedef struct client_s
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
#define SOLID_CORPSE 5 // bsp clip, touch on edge, block
// edict->deadflag values
#define DEAD_NO 0

View file

@ -137,7 +137,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
if (dz < 30)
neworg[2] += 8;
}
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, false, ent);
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, MOVE_NOMONSTERS, ent); //sB fixing zombies, was FALSE thanks blubs
if (trace.fraction == 1)
{
@ -162,7 +162,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
VectorCopy (neworg, end);
end[2] -= STEPSIZE*2;
trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent); //sB see above
if (trace.allsolid)
return false;
@ -170,7 +170,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
if (trace.startsolid)
{
neworg[2] -= STEPSIZE;
trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent); //sB
if (trace.allsolid || trace.startsolid)
return false;
}

View file

@ -272,7 +272,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
for (i=0 ; i<3 ; i++)
end[i] = ent->v.origin[i] + time_left * ent->v.velocity[i];
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, false, ent);
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent);//Editted by blubs, we do want to ignore monsters in the trace
if (trace.allsolid)
{ // entity is trapped in another solid
@ -1102,7 +1102,7 @@ void SV_CheckStuck_IgnoreMonsters (edict_t *ent)
void SV_PushAwayZombies(edict_t *ent)
{
edict_t *other_ent;
float rad = 23;//approx. length of bbox corner
float rad = 64;//approx. length of bbox corner
float *org = ent->v.origin;
vec3_t eorg;
int i, j;
@ -1110,24 +1110,29 @@ void SV_PushAwayZombies(edict_t *ent)
other_ent = NEXT_EDICT(sv.edicts);
for (i=1 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(other_ent))
{
if (other_ent->free)
continue;
//if (other_ent->free)
//continue;
//if (ent->v.solid == SOLID_NOT)
// continue;
if( other_ent->v.solid != SOLID_SLIDEBOX)
if( other_ent->v.solid != SOLID_CORPSE)
continue;
if( other_ent->v.movetype != MOVETYPE_WALK)
continue;
for (j=0 ; j<3 ; j++)
eorg[j] = org[j] - (other_ent->v.origin[j] + (other_ent->v.mins[j] + other_ent->v.maxs[j])*0.5);
if (Length(eorg) > rad)
{
Con_Printf ("Length Greater than bbox corner. \n");
continue;
}
//Process nearby zombie
for(j = 0; j < 2; j++)//only x & y
other_ent->v.velocity[j] += (other_ent->v.origin[j] - ent->v.origin[j]) * 0.001;//push away other zombie
{
Con_Printf ("Pushing Zombie \n");
other_ent->v.velocity[j] += (other_ent->v.origin[j] - ent->v.origin[j]) * 0.01;//push away other zombie was 0.001
//ent->v.velocity[j] += (ent->v.origin[j] - other_ent->v.origin[j]) * 0.01;//push away self
}
}
}
//=============================
@ -1147,7 +1152,7 @@ void SV_Physics_Walk(edict_t *ent)
VectorCopy(ent->v.mins,old_mins);
VectorCopy(ent->v.maxs,old_maxs);
//'-16,-16,-32', '16,16,40'
//'-16,-16,-32', '16,16,40' sB reenabled PushAwayZombies
ent->v.mins[0] = -16; ent->v.mins[1] = -16; ent->v.mins[2] = -32;
ent->v.maxs[0] = 16; ent->v.maxs[1] = 16; ent->v.maxs[2] = 40;