X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sv_move.c;h=ced05ac1b1ca03260b359dfb716b6cba8cd9e273;hb=refs%2Fheads%2FColdSpirit%2Fcvar_onchange_stable;hp=d93d1f8b2b6fbc948b30515f9776fac46e1fccc8;hpb=135f08ba52321984c05e36cdf42ad81420a4d2fd;p=xonotic%2Fdarkplaces.git diff --git a/sv_move.c b/sv_move.c index d93d1f8b..ced05ac1 100644 --- a/sv_move.c +++ b/sv_move.c @@ -35,6 +35,7 @@ int c_yes, c_no; qboolean SV_CheckBottom (prvm_edict_t *ent) { + prvm_prog_t *prog = SVVM_prog; vec3_t mins, maxs, start, stop; trace_t trace; int x, y; @@ -70,7 +71,7 @@ realcheck: start[0] = stop[0] = (mins[0] + maxs[0])*0.5; start[1] = stop[1] = (mins[1] + maxs[1])*0.5; stop[2] = start[2] - 2*sv_stepheight.value; - trace = SV_TraceLine(start, stop, MOVE_NOMONSTERS, ent, SV_GenericHitSuperContentsMask(ent)); + trace = SV_TraceLine(start, stop, MOVE_NOMONSTERS, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value); if (trace.fraction == 1.0) return false; @@ -83,7 +84,7 @@ realcheck: start[0] = stop[0] = x ? maxs[0] : mins[0]; start[1] = stop[1] = y ? maxs[1] : mins[1]; - trace = SV_TraceLine(start, stop, MOVE_NOMONSTERS, ent, SV_GenericHitSuperContentsMask(ent)); + trace = SV_TraceLine(start, stop, MOVE_NOMONSTERS, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value); if (trace.fraction != 1.0 && trace.endpos[2] > bottom) bottom = trace.endpos[2]; @@ -107,8 +108,9 @@ possible, no move is done and false is returned */ qboolean SV_movestep (prvm_edict_t *ent, vec3_t move, qboolean relink, qboolean noenemy, qboolean settrace) { + prvm_prog_t *prog = SVVM_prog; float dz; - vec3_t oldorg, neworg, end, traceendpos; + vec3_t oldorg, neworg, end, traceendpos, entorigin, entmins, entmaxs; trace_t trace; int i; prvm_edict_t *enemy; @@ -116,6 +118,8 @@ qboolean SV_movestep (prvm_edict_t *ent, vec3_t move, qboolean relink, qboolean // try the move VectorCopy (PRVM_serveredictvector(ent, origin), oldorg); VectorAdd (PRVM_serveredictvector(ent, origin), move, neworg); + VectorCopy(PRVM_serveredictvector(ent, mins), entmins); + VectorCopy(PRVM_serveredictvector(ent, maxs), entmaxs); // flying monsters don't step up if ( (int)PRVM_serveredictfloat(ent, flags) & (FL_SWIM | FL_FLY) ) @@ -138,7 +142,8 @@ qboolean SV_movestep (prvm_edict_t *ent, vec3_t move, qboolean relink, qboolean neworg[2] += 8; } } - trace = SV_TraceBox(PRVM_serveredictvector(ent, origin), PRVM_serveredictvector(ent, mins), PRVM_serveredictvector(ent, maxs), neworg, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent)); + VectorCopy(PRVM_serveredictvector(ent, origin), entorigin); + trace = SV_TraceBox(entorigin, entmins, entmaxs, neworg, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value); if (trace.fraction == 1) { @@ -167,12 +172,12 @@ qboolean SV_movestep (prvm_edict_t *ent, vec3_t move, qboolean relink, qboolean VectorCopy (neworg, end); end[2] -= sv_stepheight.value*2; - trace = SV_TraceBox(neworg, PRVM_serveredictvector(ent, mins), PRVM_serveredictvector(ent, maxs), end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent)); + trace = SV_TraceBox(neworg, entmins, entmaxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value); if (trace.startsolid) { neworg[2] -= sv_stepheight.value; - trace = SV_TraceBox(neworg, PRVM_serveredictvector(ent, mins), PRVM_serveredictvector(ent, maxs), end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent)); + trace = SV_TraceBox(neworg, entmins, entmaxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value); if (trace.startsolid) return false; } @@ -249,14 +254,14 @@ facing it. ====================== */ -void VM_changeyaw (void); -qboolean SV_StepDirection (prvm_edict_t *ent, float yaw, float dist) +static qboolean SV_StepDirection (prvm_edict_t *ent, float yaw, float dist) { + prvm_prog_t *prog = SVVM_prog; vec3_t move, oldorigin; float delta; PRVM_serveredictfloat(ent, ideal_yaw) = yaw; - VM_changeyaw(); + VM_changeyaw(prog); yaw = yaw*M_PI*2 / 360; move[0] = cos(yaw)*dist; @@ -287,8 +292,9 @@ SV_FixCheckBottom ====================== */ -void SV_FixCheckBottom (prvm_edict_t *ent) +static void SV_FixCheckBottom (prvm_edict_t *ent) { + prvm_prog_t *prog = SVVM_prog; PRVM_serveredictfloat(ent, flags) = (int)PRVM_serveredictfloat(ent, flags) | FL_PARTIALGROUND; } @@ -301,8 +307,9 @@ SV_NewChaseDir ================ */ #define DI_NODIR -1 -void SV_NewChaseDir (prvm_edict_t *actor, prvm_edict_t *enemy, float dist) +static void SV_NewChaseDir (prvm_edict_t *actor, prvm_edict_t *enemy, float dist) { + prvm_prog_t *prog = SVVM_prog; float deltax,deltay; float d[3]; float tdir, olddir, turnaround; @@ -390,7 +397,7 @@ SV_CloseEnough ====================== */ -qboolean SV_CloseEnough (prvm_edict_t *ent, prvm_edict_t *goal, float dist) +static qboolean SV_CloseEnough (prvm_edict_t *ent, prvm_edict_t *goal, float dist) { int i; @@ -410,7 +417,7 @@ SV_MoveToGoal ====================== */ -void SV_MoveToGoal (void) +void VM_SV_MoveToGoal(prvm_prog_t *prog) { prvm_edict_t *ent, *goal; float dist;