From bcbd9ac17fa4b0466fc6c8d5a377ca1c6687404f Mon Sep 17 00:00:00 2001 From: Tyler Young Date: Mon, 2 Jan 2023 12:02:57 -0500 Subject: [PATCH] Fixed zombies getting stuck inside eachother on Vita and NX. Also fixes some misc pathfinding bugs apparently :P --- source/cl_main.c | 5 +---- source/pr_cmds.c | 21 ++++++++++++++++++++- source/server.h | 1 + source/sv_move.c | 6 +++--- source/sv_phys.c | 23 ++++++++++++++--------- 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/source/cl_main.c b/source/cl_main.c index 5ca9909..8e812a5 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -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 diff --git a/source/pr_cmds.c b/source/pr_cmds.c index 3a45b8b..28118cd 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -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 diff --git a/source/server.h b/source/server.h index 67560b7..8e65386 100644 --- a/source/server.h +++ b/source/server.h @@ -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 diff --git a/source/sv_move.c b/source/sv_move.c index fd19084..d55d89f 100644 --- a/source/sv_move.c +++ b/source/sv_move.c @@ -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; } diff --git a/source/sv_phys.c b/source/sv_phys.c index 9aa2020..4719f90 100644 --- a/source/sv_phys.c +++ b/source/sv_phys.c @@ -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,31 +1102,36 @@ 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; other_ent = NEXT_EDICT(sv.edicts); for (i=1 ; ifree) - 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;