mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +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 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 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);
|
#define VectorZero(a) ((a)[2] = (a)[1] = (a)[0] = 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "QF/console.h"
|
#include "QF/console.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
|
#include "QF/mathlib.h"
|
||||||
#include "QF/progs.h"
|
#include "QF/progs.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/zone.h"
|
#include "QF/zone.h"
|
||||||
|
@ -389,8 +390,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
||||||
OPC.integer_var = !OPA.float_var;
|
OPC.integer_var = !OPA.float_var;
|
||||||
break;
|
break;
|
||||||
case OP_NOT_V:
|
case OP_NOT_V:
|
||||||
OPC.integer_var = !OPA.vector_var[0] && !OPA.vector_var[1]
|
OPC.integer_var = VectorIsZero (OPA.vector_var);
|
||||||
&& !OPA.vector_var[2];
|
|
||||||
break;
|
break;
|
||||||
case OP_NOT_S:
|
case OP_NOT_S:
|
||||||
OPC.integer_var = !OPA.string_var ||
|
OPC.integer_var = !OPA.string_var ||
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
|
|
||||||
#include "bothdefs.h"
|
#include "bothdefs.h"
|
||||||
|
#include "compat.h"
|
||||||
#include "cl_ents.h"
|
#include "cl_ents.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
|
@ -53,8 +54,7 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
|
||||||
qboolean spectator)
|
qboolean spectator)
|
||||||
{
|
{
|
||||||
// Dabb: if there is no movement to start with, don't predict...
|
// Dabb: if there is no movement to start with, don't predict...
|
||||||
if(cl_nostatpred->int_val && !from->velocity[0] &&
|
if(cl_nostatpred->int_val && VectorIsZero (from->velocity)) {
|
||||||
!from->velocity[1] && !from->velocity[2]) {
|
|
||||||
VectorCopy (from->origin, to->origin);
|
VectorCopy (from->origin, to->origin);
|
||||||
VectorCopy (u->angles, to->viewangles);
|
VectorCopy (u->angles, to->viewangles);
|
||||||
VectorCopy (from->velocity, to->velocity);
|
VectorCopy (from->velocity, to->velocity);
|
||||||
|
@ -113,7 +113,8 @@ CL_PredictMove (void)
|
||||||
if (cl.paused)
|
if (cl.paused)
|
||||||
return;
|
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;
|
cl.time = realtime - cls.latency - cl_pushlatency->value * 0.001;
|
||||||
if (cl.time > realtime)
|
if (cl.time > realtime)
|
||||||
|
@ -135,8 +136,8 @@ CL_PredictMove (void)
|
||||||
from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
||||||
|
|
||||||
// we can now render a frame
|
// we can now render a frame
|
||||||
if (cls.state == ca_onserver) { // first update is the final signon
|
if (cls.state == ca_onserver) {
|
||||||
// stage
|
// first update is the final signon stage
|
||||||
VID_SetCaption (cls.servername);
|
VID_SetCaption (cls.servername);
|
||||||
CL_SetState (ca_active);
|
CL_SetState (ca_active);
|
||||||
}
|
}
|
||||||
|
@ -148,9 +149,8 @@ CL_PredictMove (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dabb: if there is no movement to start with, don't predict...
|
// Dabb: if there is no movement to start with, don't predict...
|
||||||
if(cl_nostatpred->int_val && !from->playerstate[cl.playernum].velocity[0]
|
if (cl_nostatpred->int_val
|
||||||
&& !from->playerstate[cl.playernum].velocity[1]
|
&& VectorIsZero (from->playerstate[cl.playernum].velocity)) {
|
||||||
&& !from->playerstate[cl.playernum].velocity[2]) {
|
|
||||||
VectorCopy (from->playerstate[cl.playernum].velocity, cl.simvel);
|
VectorCopy (from->playerstate[cl.playernum].velocity, cl.simvel);
|
||||||
VectorCopy (from->playerstate[cl.playernum].origin, cl.simorg);
|
VectorCopy (from->playerstate[cl.playernum].origin, cl.simorg);
|
||||||
return;
|
return;
|
||||||
|
@ -165,8 +165,8 @@ CL_PredictMove (void)
|
||||||
for (i = 1; i < UPDATE_BACKUP - 1 && cls.netchan.incoming_sequence + i <
|
for (i = 1; i < UPDATE_BACKUP - 1 && cls.netchan.incoming_sequence + i <
|
||||||
cls.netchan.outgoing_sequence; i++) {
|
cls.netchan.outgoing_sequence; i++) {
|
||||||
to = &cl.frames[(cls.netchan.incoming_sequence + i) & UPDATE_MASK];
|
to = &cl.frames[(cls.netchan.incoming_sequence + i) & UPDATE_MASK];
|
||||||
CL_PredictUsercmd (&from->playerstate[cl.playernum]
|
CL_PredictUsercmd (&from->playerstate[cl.playernum],
|
||||||
, &to->playerstate[cl.playernum], &to->cmd,
|
&to->playerstate[cl.playernum], &to->cmd,
|
||||||
cl.spectator);
|
cl.spectator);
|
||||||
cl.onground = onground;
|
cl.onground = onground;
|
||||||
if (to->senttime >= cl.time)
|
if (to->senttime >= cl.time)
|
||||||
|
@ -183,18 +183,11 @@ CL_PredictMove (void)
|
||||||
// now interpolate some fraction of the final frame
|
// now interpolate some fraction of the final frame
|
||||||
if (to->senttime == from->senttime)
|
if (to->senttime == from->senttime)
|
||||||
f = 0;
|
f = 0;
|
||||||
else {
|
else
|
||||||
f = (cl.time - from->senttime) / (to->senttime - from->senttime);
|
f = bound(0, (cl.time - from->senttime) / (to->senttime - from->senttime), 1);
|
||||||
|
|
||||||
if (f < 0)
|
|
||||||
f = 0;
|
|
||||||
if (f > 1)
|
|
||||||
f = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (fabs
|
if (fabs (from->playerstate[cl.playernum].origin[i] -
|
||||||
(from->playerstate[cl.playernum].origin[i] -
|
|
||||||
to->playerstate[cl.playernum].origin[i]) > 128) {
|
to->playerstate[cl.playernum].origin[i]) > 128) {
|
||||||
// teleported, so don't lerp
|
// teleported, so don't lerp
|
||||||
VectorCopy (to->playerstate[cl.playernum].velocity, cl.simvel);
|
VectorCopy (to->playerstate[cl.playernum].velocity, cl.simvel);
|
||||||
|
|
|
@ -267,7 +267,7 @@ PM_GroundMove (void)
|
||||||
vec3_t original, originalvel, down, up, downvel;
|
vec3_t original, originalvel, down, up, downvel;
|
||||||
|
|
||||||
pmove.velocity[2] = 0;
|
pmove.velocity[2] = 0;
|
||||||
if (!pmove.velocity[0] && !pmove.velocity[1] && !pmove.velocity[2])
|
if (VectorIsZero (pmove.velocity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// first try just moving to the destination
|
// first try just moving to the destination
|
||||||
|
|
|
@ -503,8 +503,7 @@ SV_PushMove (edict_t *pusher, float movetime)
|
||||||
int i;
|
int i;
|
||||||
vec3_t move;
|
vec3_t move;
|
||||||
|
|
||||||
if (!SVvector (pusher, velocity)[0] && !SVvector (pusher, velocity)[1]
|
if (VectorIsZero (SVvector (pusher, velocity))) {
|
||||||
&& !SVvector (pusher, velocity)[2]) {
|
|
||||||
SVfloat (pusher, ltime) += movetime;
|
SVfloat (pusher, ltime) += movetime;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue