mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
LordHavoc's VectorIsNull changes from 0.3 but as VectorIsZero (no such thing
as a `null' vector) plus a couple of other bits from his patch.
This commit is contained in:
parent
1a27ded797
commit
def8bb3cd5
5 changed files with 19 additions and 26 deletions
|
@ -51,6 +51,7 @@ extern int nanmask;
|
|||
#define VectorScale(a,b,c) {(c)[0]=(a)[0]*(b);(c)[1]=(a)[1]*(b);(c)[2]=(a)[2]*(b);}
|
||||
#define VectorCompare(x, y) (((x)[0] == (y)[0]) && ((x)[1] == (y)[1]) && ((x)[2] == (y)[2]))
|
||||
|
||||
#define VectorIsZero(a) ((a)[0] == 0 && (a)[1] == 0 && (a)[2] == 0)
|
||||
#define VectorZero(a) ((a)[2] = (a)[1] = (a)[0] = 0);
|
||||
|
||||
/*
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/zone.h"
|
||||
|
@ -389,8 +390,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
OPC.integer_var = !OPA.float_var;
|
||||
break;
|
||||
case OP_NOT_V:
|
||||
OPC.integer_var = !OPA.vector_var[0] && !OPA.vector_var[1]
|
||||
&& !OPA.vector_var[2];
|
||||
OPC.integer_var = VectorIsZero (OPA.vector_var);
|
||||
break;
|
||||
case OP_NOT_S:
|
||||
OPC.integer_var = !OPA.string_var ||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "QF/keys.h"
|
||||
|
||||
#include "bothdefs.h"
|
||||
#include "compat.h"
|
||||
#include "cl_ents.h"
|
||||
#include "client.h"
|
||||
#include "pmove.h"
|
||||
|
@ -53,8 +54,7 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
|
|||
qboolean spectator)
|
||||
{
|
||||
// Dabb: if there is no movement to start with, don't predict...
|
||||
if(cl_nostatpred->int_val && !from->velocity[0] &&
|
||||
!from->velocity[1] && !from->velocity[2]) {
|
||||
if(cl_nostatpred->int_val && VectorIsZero (from->velocity)) {
|
||||
VectorCopy (from->origin, to->origin);
|
||||
VectorCopy (u->angles, to->viewangles);
|
||||
VectorCopy (from->velocity, to->velocity);
|
||||
|
@ -113,7 +113,8 @@ CL_PredictMove (void)
|
|||
if (cl.paused)
|
||||
return;
|
||||
|
||||
cl.onground = 0; // assume on ground unless prediction says different
|
||||
// assume on ground unless prediction says different
|
||||
cl.onground = 0;
|
||||
|
||||
cl.time = realtime - cls.latency - cl_pushlatency->value * 0.001;
|
||||
if (cl.time > realtime)
|
||||
|
@ -135,8 +136,8 @@ CL_PredictMove (void)
|
|||
from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
||||
|
||||
// we can now render a frame
|
||||
if (cls.state == ca_onserver) { // first update is the final signon
|
||||
// stage
|
||||
if (cls.state == ca_onserver) {
|
||||
// first update is the final signon stage
|
||||
VID_SetCaption (cls.servername);
|
||||
CL_SetState (ca_active);
|
||||
}
|
||||
|
@ -148,9 +149,8 @@ CL_PredictMove (void)
|
|||
}
|
||||
|
||||
// Dabb: if there is no movement to start with, don't predict...
|
||||
if(cl_nostatpred->int_val && !from->playerstate[cl.playernum].velocity[0]
|
||||
&& !from->playerstate[cl.playernum].velocity[1]
|
||||
&& !from->playerstate[cl.playernum].velocity[2]) {
|
||||
if (cl_nostatpred->int_val
|
||||
&& VectorIsZero (from->playerstate[cl.playernum].velocity)) {
|
||||
VectorCopy (from->playerstate[cl.playernum].velocity, cl.simvel);
|
||||
VectorCopy (from->playerstate[cl.playernum].origin, cl.simorg);
|
||||
return;
|
||||
|
@ -165,8 +165,8 @@ CL_PredictMove (void)
|
|||
for (i = 1; i < UPDATE_BACKUP - 1 && cls.netchan.incoming_sequence + i <
|
||||
cls.netchan.outgoing_sequence; i++) {
|
||||
to = &cl.frames[(cls.netchan.incoming_sequence + i) & UPDATE_MASK];
|
||||
CL_PredictUsercmd (&from->playerstate[cl.playernum]
|
||||
, &to->playerstate[cl.playernum], &to->cmd,
|
||||
CL_PredictUsercmd (&from->playerstate[cl.playernum],
|
||||
&to->playerstate[cl.playernum], &to->cmd,
|
||||
cl.spectator);
|
||||
cl.onground = onground;
|
||||
if (to->senttime >= cl.time)
|
||||
|
@ -183,19 +183,12 @@ CL_PredictMove (void)
|
|||
// now interpolate some fraction of the final frame
|
||||
if (to->senttime == from->senttime)
|
||||
f = 0;
|
||||
else {
|
||||
f = (cl.time - from->senttime) / (to->senttime - from->senttime);
|
||||
|
||||
if (f < 0)
|
||||
f = 0;
|
||||
if (f > 1)
|
||||
f = 1;
|
||||
}
|
||||
else
|
||||
f = bound(0, (cl.time - from->senttime) / (to->senttime - from->senttime), 1);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (fabs
|
||||
(from->playerstate[cl.playernum].origin[i] -
|
||||
to->playerstate[cl.playernum].origin[i]) > 128) {
|
||||
if (fabs (from->playerstate[cl.playernum].origin[i] -
|
||||
to->playerstate[cl.playernum].origin[i]) > 128) {
|
||||
// teleported, so don't lerp
|
||||
VectorCopy (to->playerstate[cl.playernum].velocity, cl.simvel);
|
||||
VectorCopy (to->playerstate[cl.playernum].origin, cl.simorg);
|
||||
|
|
|
@ -267,7 +267,7 @@ PM_GroundMove (void)
|
|||
vec3_t original, originalvel, down, up, downvel;
|
||||
|
||||
pmove.velocity[2] = 0;
|
||||
if (!pmove.velocity[0] && !pmove.velocity[1] && !pmove.velocity[2])
|
||||
if (VectorIsZero (pmove.velocity))
|
||||
return;
|
||||
|
||||
// first try just moving to the destination
|
||||
|
|
|
@ -503,8 +503,7 @@ SV_PushMove (edict_t *pusher, float movetime)
|
|||
int i;
|
||||
vec3_t move;
|
||||
|
||||
if (!SVvector (pusher, velocity)[0] && !SVvector (pusher, velocity)[1]
|
||||
&& !SVvector (pusher, velocity)[2]) {
|
||||
if (VectorIsZero (SVvector (pusher, velocity))) {
|
||||
SVfloat (pusher, ltime) += movetime;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue