mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-24 21:01:17 +00:00
This SHOULD allow Mega2K to work whenever it gets released. View offsets
are done (sorry if this steps on your toes with the view.c merge Deek) and I'm almost positive flymode will now work. Even though view offset is done, it won't. The reason for this is that cl.stats[STAT_FLYMODE] is pretty much going to ALWAYS be 0 on a standard server. Since 0 tells us that we're not flying, this is fine. cl.stats[STAT_VIEWHEIGHT] is also going to be 0, but it should be 22 for normal views. I could always assume this value is an offset from 22, but that just seems lame to me. I'll either do it anyway or we'll have to find a good opportunity in the connect cycle to set the cl.qfserver qboolean to true. I'm thinking about using an info key value for this, but we'd be better served I think by coordinating with QSG to up the protocol version across all engines.
This commit is contained in:
parent
2cfc6ee445
commit
e818226c34
7 changed files with 104 additions and 135 deletions
|
@ -100,6 +100,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define STAT_MONSTERS 14 // bumped by svc_killedmonster
|
||||
#define STAT_ITEMS 15
|
||||
#define STAT_VIEWHEIGHT 16
|
||||
#define STAT_FLYMODE 17
|
||||
|
||||
|
||||
//
|
||||
|
|
|
@ -293,6 +293,7 @@ typedef struct
|
|||
|
||||
// QW specific!
|
||||
// all player information
|
||||
qboolean qfserver;
|
||||
player_info_t players[MAX_CLIENTS];
|
||||
int servercount; // server identification for prespawns
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
pmove.h
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
@ -23,10 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef __PMOVE_H
|
||||
#define __PMOVE_H
|
||||
|
||||
#include "pmove_simple.h"
|
||||
#include "model.h"
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
#include <pmove_simple.h>
|
||||
#include <model.h>
|
||||
#include <net.h>
|
||||
#include <protocol.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -48,6 +49,7 @@ typedef struct
|
|||
int oldbuttons;
|
||||
float waterjumptime;
|
||||
qboolean dead;
|
||||
qboolean flying;
|
||||
int spectator;
|
||||
|
||||
// world state
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
cl_pred.c
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Portions Copyright (C) 1999,2000 Nelson Rush.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
|
@ -20,36 +21,34 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
#include "qtypes.h"
|
||||
#include "quakedef.h"
|
||||
#include "winquake.h"
|
||||
#include "cvar.h"
|
||||
#include "client.h"
|
||||
#include "console.h"
|
||||
#include "mathlib.h"
|
||||
#include <qtypes.h>
|
||||
#include <quakedef.h>
|
||||
#include <winquake.h>
|
||||
#include <cvar.h>
|
||||
#include <client.h>
|
||||
#include <console.h>
|
||||
#include <mathlib.h>
|
||||
|
||||
//cvar_t cl_nopred = {"cl_nopred","0"};
|
||||
cvar_t *cl_nopred;
|
||||
//cvar_t cl_pushlatency = {"pushlatency","-999"};
|
||||
cvar_t *cl_pushlatency;
|
||||
|
||||
extern frame_t *view_frame;
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_NudgePosition
|
||||
|
||||
If pmove.origin is in a solid position,
|
||||
try nudging slightly on all axis to
|
||||
allow for the cut precision of the net coordinates
|
||||
=================
|
||||
*/
|
||||
void CL_NudgePosition (void)
|
||||
void
|
||||
CL_NudgePosition (void)
|
||||
{
|
||||
vec3_t base;
|
||||
int x, y;
|
||||
|
||||
if (PM_HullPointContents (&cl.model_precache[1]->hulls[1], 0, pmove.origin) == CONTENTS_EMPTY)
|
||||
if (PM_HullPointContents (&cl.model_precache[1]->hulls[1], 0,
|
||||
pmove.origin) == CONTENTS_EMPTY)
|
||||
return;
|
||||
|
||||
VectorCopy (pmove.origin, base);
|
||||
|
@ -66,12 +65,13 @@ void CL_NudgePosition (void)
|
|||
Con_DPrintf ("CL_NudgePosition: stuck\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_PredictUsercmd
|
||||
==============
|
||||
*/
|
||||
void CL_PredictUsercmd (player_state_t *from, player_state_t *to, usercmd_t *u, qboolean spectator)
|
||||
void
|
||||
CL_PredictUsercmd (player_state_t *from, player_state_t *to, usercmd_t *u,
|
||||
qboolean spectator)
|
||||
{
|
||||
// split up very long moves
|
||||
if (u->msec > 50)
|
||||
|
@ -97,6 +97,7 @@ void CL_PredictUsercmd (player_state_t *from, player_state_t *to, usercmd_t *u,
|
|||
pmove.dead = cl.stats[STAT_HEALTH] <= 0;
|
||||
pmove.spectator = spectator;
|
||||
|
||||
pmove.flying = cl.stats[STAT_FLYMODE];
|
||||
pmove.cmd = *u;
|
||||
|
||||
PlayerMove ();
|
||||
|
@ -115,11 +116,10 @@ void CL_PredictUsercmd (player_state_t *from, player_state_t *to, usercmd_t *u,
|
|||
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_PredictMove
|
||||
==============
|
||||
*/
|
||||
void CL_PredictMove (void)
|
||||
void
|
||||
CL_PredictMove (void)
|
||||
{
|
||||
int i;
|
||||
float f;
|
||||
|
@ -178,9 +178,11 @@ void 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.spectator);
|
||||
to = &cl.frames[(cls.netchan.incoming_sequence+i)
|
||||
& UPDATE_MASK];
|
||||
CL_PredictUsercmd (&from->playerstate[cl.playernum],
|
||||
&to->playerstate[cl.playernum], &to->cmd,
|
||||
cl.spectator);
|
||||
if (to->senttime >= cl.time)
|
||||
break;
|
||||
from = to;
|
||||
|
@ -196,42 +198,43 @@ void CL_PredictMove (void)
|
|||
f = 0;
|
||||
else
|
||||
{
|
||||
f = (cl.time - from->senttime) / (to->senttime - from->senttime);
|
||||
f = (cl.time - from->senttime) / (to->senttime
|
||||
- from->senttime);
|
||||
|
||||
if (f < 0)
|
||||
f = 0;
|
||||
if (f > 1)
|
||||
f = 1;
|
||||
f = max(0, min(f, 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);
|
||||
VectorCopy (to->playerstate[cl.playernum].velocity,
|
||||
cl.simvel);
|
||||
VectorCopy (to->playerstate[cl.playernum].origin,
|
||||
cl.simorg);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
cl.simorg[i] = from->playerstate[cl.playernum].origin[i]
|
||||
+ f*(to->playerstate[cl.playernum].origin[i] - from->playerstate[cl.playernum].origin[i]);
|
||||
+ f*(to->playerstate[cl.playernum].origin[i]
|
||||
- from->playerstate[cl.playernum].origin[i]);
|
||||
cl.simvel[i] = from->playerstate[cl.playernum].velocity[i]
|
||||
+ f*(to->playerstate[cl.playernum].velocity[i] - from->playerstate[cl.playernum].velocity[i]);
|
||||
+ f*(to->playerstate[cl.playernum].velocity[i]
|
||||
- from->playerstate[cl.playernum].velocity[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_InitPrediction
|
||||
==============
|
||||
*/
|
||||
void CL_InitPrediction (void)
|
||||
void
|
||||
CL_InitPrediction (void)
|
||||
{
|
||||
// Cvar_RegisterVariable (&cl_pushlatency);
|
||||
cl_pushlatency = Cvar_Get ("cl_pushlatency","0",0,"None");
|
||||
// Cvar_RegisterVariable (&cl_nopred);
|
||||
cl_nopred = Cvar_Get ("cl_nopred","0",0,"None");
|
||||
cl_pushlatency = Cvar_Get ("cl_pushlatency","0",CVAR_NONE,"None");
|
||||
cl_nopred = Cvar_Get ("cl_nopred","0",CVAR_NONE,"None");
|
||||
}
|
||||
|
||||
|
|
|
@ -80,10 +80,7 @@ frame_t *view_frame;
|
|||
player_state_t *view_message;
|
||||
|
||||
/*
|
||||
===============
|
||||
V_CalcRoll
|
||||
|
||||
===============
|
||||
*/
|
||||
float V_CalcRoll (vec3_t angles, vec3_t velocity)
|
||||
{
|
||||
|
@ -110,10 +107,7 @@ float V_CalcRoll (vec3_t angles, vec3_t velocity)
|
|||
|
||||
|
||||
/*
|
||||
===============
|
||||
V_CalcBob
|
||||
|
||||
===============
|
||||
*/
|
||||
float V_CalcBob (void)
|
||||
{
|
||||
|
@ -180,17 +174,17 @@ void V_StopPitchDrift (void)
|
|||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
V_DriftPitch
|
||||
|
||||
Moves the client pitch angle towards cl.idealpitch sent by the server.
|
||||
Moves the client pitch angle towards cl.idealpitch sent by the
|
||||
server.
|
||||
|
||||
If the user is adjusting pitch manually, either with lookup/lookdown,
|
||||
mlook and mouse, or klook and keyboard, pitch drifting is constantly stopped.
|
||||
mlook and mouse, or klook and keyboard, pitch drifting is constantly
|
||||
stopped.
|
||||
|
||||
Drifting is enabled when the center view key is hit, mlook is released and
|
||||
lookspring is non 0, or when
|
||||
===============
|
||||
Drifting is enabled when the center view key is hit, mlook is
|
||||
released and lookspring is non 0, or when
|
||||
*/
|
||||
void V_DriftPitch (void)
|
||||
{
|
||||
|
@ -257,9 +251,7 @@ void V_DriftPitch (void)
|
|||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
PALETTE FLASHES
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
@ -300,9 +292,7 @@ void BuildGammaTable (float g)
|
|||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
V_CheckGamma
|
||||
=================
|
||||
*/
|
||||
qboolean V_CheckGamma (void)
|
||||
{
|
||||
|
@ -321,9 +311,7 @@ qboolean V_CheckGamma (void)
|
|||
|
||||
|
||||
/*
|
||||
===============
|
||||
V_ParseDamage
|
||||
===============
|
||||
*/
|
||||
void V_ParseDamage (void)
|
||||
{
|
||||
|
@ -389,9 +377,7 @@ void V_ParseDamage (void)
|
|||
|
||||
|
||||
/*
|
||||
==================
|
||||
V_cshift_f
|
||||
==================
|
||||
*/
|
||||
void V_cshift_f (void)
|
||||
{
|
||||
|
@ -403,11 +389,9 @@ void V_cshift_f (void)
|
|||
|
||||
|
||||
/*
|
||||
==================
|
||||
V_BonusFlash_f
|
||||
|
||||
When you run over an item, the server sends this command
|
||||
==================
|
||||
*/
|
||||
void V_BonusFlash_f (void)
|
||||
{
|
||||
|
@ -418,11 +402,9 @@ void V_BonusFlash_f (void)
|
|||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
V_SetContentsColor
|
||||
|
||||
Underwater, lava, etc each has a color shift
|
||||
=============
|
||||
*/
|
||||
void V_SetContentsColor (int contents)
|
||||
{
|
||||
|
@ -449,9 +431,7 @@ void V_SetContentsColor (int contents)
|
|||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
V_CalcPowerupCshift
|
||||
=============
|
||||
*/
|
||||
void V_CalcPowerupCshift (void)
|
||||
{
|
||||
|
@ -489,9 +469,7 @@ void V_CalcPowerupCshift (void)
|
|||
|
||||
|
||||
/*
|
||||
=============
|
||||
V_CalcBlend
|
||||
=============
|
||||
*/
|
||||
void V_CalcBlend (void)
|
||||
{
|
||||
|
@ -533,9 +511,7 @@ void V_CalcBlend (void)
|
|||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
VIEW RENDERING
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
@ -548,9 +524,7 @@ float angledelta (float a)
|
|||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CalcGunAngle
|
||||
==================
|
||||
*/
|
||||
void CalcGunAngle (void)
|
||||
{
|
||||
|
@ -602,9 +576,7 @@ void CalcGunAngle (void)
|
|||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
V_BoundOffsets
|
||||
==============
|
||||
*/
|
||||
void V_BoundOffsets (void)
|
||||
{
|
||||
|
@ -626,11 +598,9 @@ void V_BoundOffsets (void)
|
|||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
V_AddIdle
|
||||
|
||||
Idle swaying
|
||||
==============
|
||||
*/
|
||||
void V_AddIdle (void)
|
||||
{
|
||||
|
@ -645,11 +615,9 @@ void V_AddIdle (void)
|
|||
|
||||
|
||||
/*
|
||||
==============
|
||||
V_CalcViewRoll
|
||||
|
||||
Roll is induced by movement and damage
|
||||
==============
|
||||
*/
|
||||
void V_CalcViewRoll (void)
|
||||
{
|
||||
|
@ -669,10 +637,7 @@ void V_CalcViewRoll (void)
|
|||
|
||||
|
||||
/*
|
||||
==================
|
||||
V_CalcIntermissionRefdef
|
||||
|
||||
==================
|
||||
*/
|
||||
void V_CalcIntermissionRefdef (void)
|
||||
{
|
||||
|
@ -694,19 +659,18 @@ void V_CalcIntermissionRefdef (void)
|
|||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
V_CalcRefdef
|
||||
|
||||
==================
|
||||
*/
|
||||
void V_CalcRefdef (void)
|
||||
{
|
||||
entity_t *view;
|
||||
int i;
|
||||
int h, i;
|
||||
vec3_t forward, right, up;
|
||||
float bob;
|
||||
static float oldz = 0;
|
||||
|
||||
h = cl.qfserver ? cl.stats[STAT_VIEWHEIGHT] : 22;
|
||||
|
||||
V_DriftPitch ();
|
||||
|
||||
// view is the weapon model (only visible from inside body)
|
||||
|
@ -735,9 +699,9 @@ void V_CalcRefdef (void)
|
|||
else if (view_message->flags & PF_DEAD)
|
||||
r_refdef.vieworg[2] -= 16; // corpse view height
|
||||
else
|
||||
r_refdef.vieworg[2] += 22; // view height
|
||||
r_refdef.vieworg[2] += h; // view height
|
||||
|
||||
if (view_message->flags & PF_DEAD) // PF_GIB will also set PF_DEAD
|
||||
if (view_message->flags & PF_DEAD) // PF_GIB also sets PF_DEAD
|
||||
r_refdef.viewangles[ROLL] = 80; // dead view angle
|
||||
|
||||
|
||||
|
@ -750,7 +714,7 @@ void V_CalcRefdef (void)
|
|||
CalcGunAngle ();
|
||||
|
||||
VectorCopy (cl.simorg, view->origin);
|
||||
view->origin[2] += 22;
|
||||
view->origin[2] += h;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
|
@ -801,9 +765,7 @@ void V_CalcRefdef (void)
|
|||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
DropPunchAngle
|
||||
=============
|
||||
*/
|
||||
void DropPunchAngle (void)
|
||||
{
|
||||
|
@ -813,12 +775,10 @@ void DropPunchAngle (void)
|
|||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
V_RenderView
|
||||
|
||||
The player's clipping box goes from (-16 -16 -24) to (16 16 32) from
|
||||
the entity origin, so any view position inside that will be valid
|
||||
==================
|
||||
*/
|
||||
extern vrect_t scr_vrect;
|
||||
|
||||
|
@ -854,9 +814,7 @@ cl.simangles[ROLL] = 0; // FIXME @@@
|
|||
//============================================================================
|
||||
|
||||
/*
|
||||
=============
|
||||
V_Init
|
||||
=============
|
||||
*/
|
||||
void V_Init (void)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
sv_send.c
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
@ -19,7 +20,6 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// sv_main.c -- server main program
|
||||
|
||||
#include <ctype.h>
|
||||
#include <quakedef.h>
|
||||
|
@ -555,6 +555,10 @@ void SV_UpdateClientStats (client_t *client)
|
|||
// stuff the sigil bits into the high bits of items for sbar
|
||||
stats[STAT_ITEMS] = (int)ent->v.items | ((int)pr_global_struct->serverflags << 28);
|
||||
|
||||
// Extensions to the QW 2.40 protocol for MegaTF
|
||||
stats[STAT_VIEWHEIGHT] = (int)ent->v.view_ofs[2];
|
||||
stats[STAT_FLYMODE] = (ent->v.movetype == MOVETYPE_FLY);
|
||||
|
||||
for (i=0 ; i<MAX_CL_STATS ; i++)
|
||||
if (stats[i] != client->stats[i])
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include <quakedef.h>
|
||||
#include <r_local.h>
|
||||
#include <draw.h> /* For Draw_Crosshair() */
|
||||
#include <draw.h>
|
||||
#include <mathlib.h>
|
||||
#include <qtypes.h>
|
||||
#include <qstructs.h>
|
||||
|
|
Loading…
Reference in a new issue