2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the included (GNU.txt) GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
/* ZOID
|
|
|
|
*
|
|
|
|
* Player camera tracking in Spectator mode
|
|
|
|
*
|
|
|
|
* This takes over player controls for spectator automatic camera.
|
|
|
|
* Player moves as a spectator, but the camera tracks and enemy player
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "quakedef.h"
|
|
|
|
#include "winquake.h"
|
|
|
|
|
|
|
|
#define PM_SPECTATORMAXSPEED 500
|
|
|
|
#define PM_STOPSPEED 100
|
|
|
|
#define PM_MAXSPEED 320
|
|
|
|
#define BUTTON_JUMP 2
|
|
|
|
#define BUTTON_ATTACK 1
|
|
|
|
#define MAX_ANGLE_TURN 10
|
|
|
|
|
|
|
|
char cl_spectatorgroup[] = "Spectator Tracking";
|
|
|
|
|
|
|
|
// track high fragger
|
2006-02-11 02:09:43 +00:00
|
|
|
cvar_t cl_hightrack = SCVAR("cl_hightrack", "0");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2006-02-11 02:09:43 +00:00
|
|
|
cvar_t cl_chasecam = SCVAR("cl_chasecam", "1");
|
2006-09-17 00:59:22 +00:00
|
|
|
cvar_t cl_selfcam = SCVAR("cl_selfcam", "1");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
//cvar_t cl_camera_maxpitch = {"cl_camera_maxpitch", "10" };
|
|
|
|
//cvar_t cl_camera_maxyaw = {"cl_camera_maxyaw", "30" };
|
|
|
|
|
|
|
|
|
2006-09-17 00:59:22 +00:00
|
|
|
int selfcam=1;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
static float vlen(vec3_t v)
|
|
|
|
{
|
|
|
|
return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// returns true if weapon model should be drawn in camera mode
|
2013-06-23 02:17:02 +00:00
|
|
|
qboolean Cam_DrawViewModel(playerview_t *pv)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2006-09-17 00:59:22 +00:00
|
|
|
if (cl.spectator)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (pv->cam_auto && pv->cam_locked && cl_chasecam.ival)
|
2006-09-17 00:59:22 +00:00
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-07-11 02:22:39 +00:00
|
|
|
if (selfcam == 1 && !r_refdef.externalview)
|
2006-09-17 00:59:22 +00:00
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// returns true if we should draw this player, we don't if we are chase camming
|
2013-06-23 02:17:02 +00:00
|
|
|
qboolean Cam_DrawEntity(playerview_t *pv, int entitykey)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
// if (!entitykey)
|
|
|
|
return true;
|
2004-10-19 16:10:14 +00:00
|
|
|
// if (playernum == cl.playernum[pnum])
|
|
|
|
// return false;
|
2006-09-17 00:59:22 +00:00
|
|
|
if (cl.spectator)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (pv->cam_auto && pv->cam_locked && (cl_chasecam.value||scr_chatmode==2) &&
|
|
|
|
pv->cam_spec_track+1 == entitykey && r_secondaryview != 2)
|
2006-09-17 00:59:22 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-07-11 02:22:39 +00:00
|
|
|
if (selfcam == 1 && !r_refdef.externalview)
|
2013-06-23 02:17:02 +00:00
|
|
|
if (entitykey == pv->viewentity)
|
2006-09-17 00:59:22 +00:00
|
|
|
return false;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
int Cam_TrackNum(playerview_t *pv)
|
2004-12-29 03:06:27 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_auto)
|
2004-12-29 03:06:27 +00:00
|
|
|
return -1;
|
2013-06-23 02:17:02 +00:00
|
|
|
return pv->cam_spec_track;
|
2004-12-29 03:06:27 +00:00
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
void Cam_Unlock(playerview_t *pv)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (pv->cam_auto)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-03-23 22:14:08 +00:00
|
|
|
CL_SendClientCommand(true, "ptrack");
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_auto = CAM_NONE;
|
|
|
|
pv->cam_locked = false;
|
|
|
|
pv->viewentity = (cls.demoplayback)?0:(pv->playernum+1); //free floating
|
2004-08-23 00:15:46 +00:00
|
|
|
Sbar_Changed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
void Cam_Lock(playerview_t *pv, int playernum)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-06-14 04:52:10 +00:00
|
|
|
int i;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_lastviewtime = -1000;
|
2004-12-08 04:14:52 +00:00
|
|
|
|
2005-03-23 22:14:08 +00:00
|
|
|
CL_SendClientCommand(true, "ptrack %i", playernum);
|
2005-02-28 07:16:19 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_spec_track = playernum;
|
|
|
|
pv->cam_locked = false;
|
|
|
|
pv->viewentity = (cls.demoplayback)?0:(pv->playernum+1); //free floating
|
|
|
|
|
2005-01-23 17:37:35 +00:00
|
|
|
|
|
|
|
Skin_FlushPlayers();
|
2004-12-08 04:14:52 +00:00
|
|
|
|
2008-01-09 00:52:31 +00:00
|
|
|
if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
|
2004-12-08 04:14:52 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
memcpy(&pv->stats, cl.players[playernum].stats, sizeof(pv->stats));
|
|
|
|
pv->cam_locked = true; //instantly lock if the player is valid.
|
|
|
|
pv->viewentity = playernum+1;
|
2004-12-08 04:14:52 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
Sbar_Changed();
|
2005-06-14 04:52:10 +00:00
|
|
|
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++)
|
|
|
|
CL_NewTranslation(i);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trace_t Cam_DoTrace(vec3_t vec1, vec3_t vec2)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
memset(&pmove, 0, sizeof(pmove));
|
|
|
|
|
|
|
|
pmove.numphysent = 1;
|
2009-03-03 01:52:30 +00:00
|
|
|
memset(&pmove.physents[0], 0, sizeof(physent_t));
|
2006-05-29 04:50:24 +00:00
|
|
|
VectorClear (pmove.physents[0].origin);
|
2004-08-23 00:15:46 +00:00
|
|
|
pmove.physents[0].model = cl.worldmodel;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
VectorCopy (vec1, pmove.origin);
|
|
|
|
return PM_PlayerTrace(pmove.origin, vec2);
|
|
|
|
}
|
2004-11-17 18:10:06 +00:00
|
|
|
|
|
|
|
extern vec3_t player_mins;
|
|
|
|
extern vec3_t player_maxs;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// Returns distance or 9999 if invalid for some reason
|
2006-09-17 00:59:22 +00:00
|
|
|
static float Cam_TryFlyby(vec3_t selforigin, vec3_t playerorigin, vec3_t vec, qboolean checkvis)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
vec3_t v;
|
|
|
|
trace_t trace;
|
|
|
|
float len;
|
|
|
|
|
2004-11-17 18:10:06 +00:00
|
|
|
player_mins[0] = player_mins[1] = -16;
|
|
|
|
player_mins[2] = -24;
|
|
|
|
player_maxs[0] = player_maxs[1] = 16;
|
|
|
|
player_maxs[2] = 32;
|
|
|
|
|
2011-10-27 15:46:36 +00:00
|
|
|
VectorAngles(vec, NULL, v);
|
2004-08-23 00:15:46 +00:00
|
|
|
// v[0] = -v[0];
|
|
|
|
VectorCopy (v, pmove.angles);
|
|
|
|
VectorNormalize(vec);
|
2006-09-17 00:59:22 +00:00
|
|
|
VectorMA(playerorigin, 800, vec, v);
|
2004-08-23 00:15:46 +00:00
|
|
|
// v is endpos
|
|
|
|
// fake a player move
|
2006-09-17 00:59:22 +00:00
|
|
|
trace = Cam_DoTrace(playerorigin, v);
|
2004-08-23 00:15:46 +00:00
|
|
|
if (/*trace.inopen ||*/ trace.inwater)
|
|
|
|
return 9999;
|
|
|
|
VectorCopy(trace.endpos, vec);
|
2006-09-17 00:59:22 +00:00
|
|
|
VectorSubtract(trace.endpos, playerorigin, v);
|
2004-08-23 00:15:46 +00:00
|
|
|
len = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
|
|
|
if (len < 32 || len > 800)
|
|
|
|
return 9999;
|
|
|
|
if (checkvis)
|
|
|
|
{
|
2006-09-17 00:59:22 +00:00
|
|
|
VectorSubtract(trace.endpos, selforigin, v);
|
2004-08-23 00:15:46 +00:00
|
|
|
len = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
|
|
|
|
2006-09-17 00:59:22 +00:00
|
|
|
trace = Cam_DoTrace(selforigin, vec);
|
2004-08-23 00:15:46 +00:00
|
|
|
if (trace.fraction != 1 || trace.inwater)
|
|
|
|
return 9999;
|
|
|
|
}
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Is player visible?
|
2006-09-17 00:59:22 +00:00
|
|
|
static qboolean Cam_IsVisible(vec3_t playerorigin, vec3_t vec)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
trace_t trace;
|
|
|
|
vec3_t v;
|
|
|
|
float d;
|
|
|
|
|
2006-09-17 00:59:22 +00:00
|
|
|
trace = Cam_DoTrace(playerorigin, vec);
|
2004-08-23 00:15:46 +00:00
|
|
|
if (trace.fraction != 1 || /*trace.inopen ||*/ trace.inwater)
|
|
|
|
return false;
|
|
|
|
// check distance, don't let the player get too far away or too close
|
2006-09-17 00:59:22 +00:00
|
|
|
VectorSubtract(playerorigin, vec, v);
|
2004-08-23 00:15:46 +00:00
|
|
|
d = vlen(v);
|
|
|
|
if (d < 16)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
static qboolean InitFlyby(playerview_t *pv, vec3_t selforigin, vec3_t playerorigin, vec3_t playerviewangles, int checkvis)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
float f, max;
|
|
|
|
vec3_t vec, vec2;
|
|
|
|
vec3_t forward, right, up;
|
|
|
|
|
2006-09-17 00:59:22 +00:00
|
|
|
VectorCopy(playerviewangles, vec);
|
2004-08-23 00:15:46 +00:00
|
|
|
vec[0] = 0;
|
|
|
|
AngleVectors (vec, forward, right, up);
|
|
|
|
// for (i = 0; i < 3; i++)
|
|
|
|
// forward[i] *= 3;
|
|
|
|
|
|
|
|
max = 1000;
|
|
|
|
VectorAdd(forward, up, vec2);
|
|
|
|
VectorAdd(vec2, right, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorAdd(forward, up, vec2);
|
|
|
|
VectorSubtract(vec2, right, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorAdd(forward, right, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorSubtract(forward, right, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorAdd(forward, up, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorSubtract(forward, up, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorAdd(up, right, vec2);
|
|
|
|
VectorSubtract(vec2, forward, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorSubtract(up, right, vec2);
|
|
|
|
VectorSubtract(vec2, forward, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
// invert
|
2006-05-29 04:50:24 +00:00
|
|
|
VectorNegate(forward, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorCopy(forward, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
// invert
|
2006-05-29 04:50:24 +00:00
|
|
|
VectorNegate(right, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
VectorCopy(right, vec2);
|
2006-09-17 00:59:22 +00:00
|
|
|
if ((f = Cam_TryFlyby(selforigin, playerorigin, vec2, checkvis)) < max)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
max = f;
|
|
|
|
VectorCopy(vec2, vec);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ack, can't find him
|
|
|
|
if (max >= 1000)
|
|
|
|
{
|
|
|
|
// Cam_Unlock();
|
|
|
|
return false;
|
|
|
|
}
|
2004-10-04 07:25:47 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_locked = true;
|
|
|
|
VectorCopy(vec, pv->cam_desired_position);
|
2004-08-23 00:15:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
static void Cam_CheckHighTarget(playerview_t *pv)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
int i, j, max;
|
|
|
|
player_info_t *s;
|
2013-06-23 02:17:02 +00:00
|
|
|
playerview_t *spv;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
j = -1;
|
|
|
|
for (i = 0, max = -9999; i < MAX_CLIENTS; i++)
|
|
|
|
{
|
|
|
|
s = &cl.players[i];
|
|
|
|
if (s->name[0] && !s->spectator && s->frags > max)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
//skip it if an earlier seat is watching it already
|
|
|
|
for (spv = pv-1; spv >= cl.playerview && spv < &cl.playerview[cl.splitclients]; spv--)
|
2009-05-24 10:11:17 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (Cam_TrackNum(spv) == i)
|
2009-05-24 10:11:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!(spv >= cl.playerview && spv < &cl.playerview[cl.splitclients]))
|
2009-05-24 10:11:17 +00:00
|
|
|
{
|
|
|
|
max = s->frags;
|
|
|
|
j = i;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (j >= 0)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_locked || cl.players[j].frags > cl.players[pv->cam_spec_track].frags)
|
2009-05-24 10:11:17 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_Lock(pv, j);
|
|
|
|
//un-lock any higher seats watching our new target. this keeps things ordered.
|
|
|
|
for (spv = pv+1; spv >= cl.playerview && spv < &cl.playerview[cl.splitclients]; spv++)
|
2009-05-24 10:11:17 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (Cam_TrackNum(spv) == j)
|
|
|
|
spv->cam_locked = false;
|
2009-05-24 10:11:17 +00:00
|
|
|
}
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
else
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_Unlock(pv);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2005-04-16 16:21:27 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
void Cam_SelfTrack(playerview_t *pv)
|
2006-09-17 00:59:22 +00:00
|
|
|
{
|
|
|
|
vec3_t vec;
|
|
|
|
if (!cl.worldmodel || cl.worldmodel->needload)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (selfcam == 1)
|
|
|
|
{ //view-from-eyes
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (selfcam == 2)
|
|
|
|
{ //fixme:
|
|
|
|
vec3_t forward, right, up;
|
|
|
|
trace_t tr;
|
|
|
|
AngleVectors(r_refdef.viewangles, forward, right, up);
|
2013-06-23 02:17:02 +00:00
|
|
|
VectorMA(pv->simorg, -128, forward, pv->cam_desired_position);
|
|
|
|
tr = Cam_DoTrace(pv->simorg, pv->cam_desired_position);
|
|
|
|
VectorCopy(tr.endpos, pv->cam_desired_position);
|
2006-09-17 00:59:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ //view from a random wall
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_locked || !Cam_IsVisible(pv->simorg, pv->cam_desired_position))
|
2006-09-17 00:59:22 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_locked || realtime - pv->cam_lastviewtime > 0.1)
|
2006-09-17 00:59:22 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!InitFlyby(pv, pv->cam_desired_position, pv->simorg, pv->simangles, true))
|
|
|
|
InitFlyby(pv, pv->cam_desired_position, pv->simorg, pv->simangles, false);
|
|
|
|
pv->cam_lastviewtime = realtime;
|
2006-09-17 00:59:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_lastviewtime = realtime;
|
2006-09-17 00:59:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//tracking failed.
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_locked)
|
2006-09-17 00:59:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// move there locally immediately
|
2013-06-23 02:17:02 +00:00
|
|
|
VectorCopy(pv->cam_desired_position, r_refdef.vieworg);
|
2006-09-17 00:59:22 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
VectorSubtract(pv->simorg, pv->cam_desired_position, vec);
|
2011-10-27 15:46:36 +00:00
|
|
|
VectorAngles(vec, NULL, r_refdef.viewangles);
|
2006-09-17 00:59:22 +00:00
|
|
|
r_refdef.viewangles[0] = -r_refdef.viewangles[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// ZOID
|
|
|
|
//
|
|
|
|
// Take over the user controls and track a player.
|
|
|
|
// We find a nice position to watch the player and move there
|
2013-06-23 02:17:02 +00:00
|
|
|
void Cam_Track(playerview_t *pv, usercmd_t *cmd)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
player_state_t *player, *self;
|
2013-03-12 22:53:23 +00:00
|
|
|
inframe_t *frame;
|
2004-08-23 00:15:46 +00:00
|
|
|
vec3_t vec;
|
|
|
|
float len;
|
|
|
|
|
2004-12-08 04:14:52 +00:00
|
|
|
if (!cl.spectator || !cl.worldmodel) //can happen when the server changes level
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (cl_hightrack.value && !pv->cam_locked)
|
|
|
|
Cam_CheckHighTarget(pv);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_auto || cls.state != ca_active)
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (pv->cam_locked && (!cl.players[pv->cam_spec_track].name[0] || cl.players[pv->cam_spec_track].spectator))
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_locked = false;
|
2004-08-23 00:15:46 +00:00
|
|
|
if (cl_hightrack.value)
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_CheckHighTarget(pv);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_Unlock(pv);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-12 22:53:23 +00:00
|
|
|
frame = &cl.inframes[cl.validsequence & UPDATE_MASK];
|
2013-06-23 02:17:02 +00:00
|
|
|
player = frame->playerstate + pv->cam_spec_track;
|
|
|
|
self = frame->playerstate + pv->playernum;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_locked || !Cam_IsVisible(player->origin, pv->cam_desired_position))
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_locked || realtime - pv->cam_lastviewtime > 0.1)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!InitFlyby(pv, self->origin, player->origin, player->viewangles, true))
|
|
|
|
InitFlyby(pv, self->origin, player->origin, player->viewangles, false);
|
|
|
|
pv->cam_lastviewtime = realtime;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2005-04-16 16:21:27 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_lastviewtime = realtime;
|
2005-04-16 16:21:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//tracking failed.
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!pv->cam_locked || !pv->cam_auto)
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
|
|
|
|
if (cl_chasecam.value || scr_chatmode == 2)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-04-16 16:21:27 +00:00
|
|
|
if (scr_chatmode != 2)
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_lastviewtime = realtime;
|
2005-04-16 16:21:27 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
VectorCopy(player->viewangles, pv->viewangles);
|
2005-04-16 16:21:27 +00:00
|
|
|
if (memcmp(player->origin, &self->origin, sizeof(player->origin)) != 0)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2007-07-23 12:04:26 +00:00
|
|
|
if (!cls.demoplayback)
|
|
|
|
{
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_tmove);
|
|
|
|
MSG_WriteCoord (&cls.netchan.message, player->origin[0]);
|
|
|
|
MSG_WriteCoord (&cls.netchan.message, player->origin[1]);
|
|
|
|
MSG_WriteCoord (&cls.netchan.message, player->origin[2]);
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
// move there locally immediately
|
2005-04-16 16:21:27 +00:00
|
|
|
VectorCopy(player->origin, self->origin);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
self->weaponframe = player->weaponframe;
|
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ok, move to our desired position and set our angles to view
|
|
|
|
// the player
|
2013-06-23 02:17:02 +00:00
|
|
|
VectorSubtract(pv->cam_desired_position, self->origin, vec);
|
2005-04-16 16:21:27 +00:00
|
|
|
len = vlen(vec);
|
|
|
|
cmd->forwardmove = cmd->sidemove = cmd->upmove = 0;
|
|
|
|
if (len > 16)
|
|
|
|
{ // close enough?
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_tmove);
|
2013-06-23 02:17:02 +00:00
|
|
|
MSG_WriteCoord (&cls.netchan.message, pv->cam_desired_position[0]);
|
|
|
|
MSG_WriteCoord (&cls.netchan.message, pv->cam_desired_position[1]);
|
|
|
|
MSG_WriteCoord (&cls.netchan.message, pv->cam_desired_position[2]);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
// move there locally immediately
|
2013-06-23 02:17:02 +00:00
|
|
|
VectorCopy(pv->cam_desired_position, self->origin);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
VectorSubtract(player->origin, pv->cam_desired_position, vec);
|
|
|
|
VectorAngles(vec, NULL, pv->viewangles);
|
|
|
|
pv->viewangles[0] = -pv->viewangles[0];
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2008-01-30 02:32:00 +00:00
|
|
|
void Cam_SetAutoTrack(int userid)
|
|
|
|
{ //this is a hint from the server about who to track
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
void Cam_TrackCrosshairedPlayer(playerview_t *pv)
|
2005-03-28 00:11:59 +00:00
|
|
|
{
|
2013-03-12 22:53:23 +00:00
|
|
|
inframe_t *frame;
|
2005-03-28 00:11:59 +00:00
|
|
|
player_state_t *player;
|
|
|
|
int i;
|
2005-04-16 16:21:27 +00:00
|
|
|
float dot = 0.1, bestdot=0;
|
2005-03-28 00:11:59 +00:00
|
|
|
int best = -1;
|
|
|
|
vec3_t selforg;
|
|
|
|
vec3_t dir;
|
|
|
|
|
2013-03-12 22:53:23 +00:00
|
|
|
frame = &cl.inframes[cl.validsequence & UPDATE_MASK];
|
2013-06-23 02:17:02 +00:00
|
|
|
player = frame->playerstate + pv->playernum;
|
2005-03-28 00:11:59 +00:00
|
|
|
VectorCopy(player->origin, selforg);
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++)
|
|
|
|
{
|
|
|
|
player = frame->playerstate + i;
|
|
|
|
VectorSubtract(player->origin, selforg, dir);
|
|
|
|
VectorNormalize(dir);
|
|
|
|
dot = DotProduct(vpn, dir);
|
|
|
|
if (dot > bestdot)
|
|
|
|
{
|
|
|
|
bestdot = dot;
|
|
|
|
best = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Con_Printf("Track %i? %f\n", best, bestdot);
|
|
|
|
if (best != -1) //did we actually get someone?
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_auto++;
|
|
|
|
Cam_Lock(pv, best);
|
2005-03-28 00:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
void Cam_FinishMove(playerview_t *pv, usercmd_t *cmd)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
player_info_t *s;
|
|
|
|
int end;
|
2013-03-12 22:13:26 +00:00
|
|
|
extern cvar_t cl_demospeed, cl_splitscreen;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
if (cls.state != ca_active)
|
|
|
|
return;
|
|
|
|
|
2008-01-09 00:52:31 +00:00
|
|
|
if (!cl.spectator && (cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV)) // only in spectator mode
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
|
2013-03-12 22:13:26 +00:00
|
|
|
if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
|
|
|
|
{
|
|
|
|
int nb;
|
|
|
|
nb = (cmd->sidemove<0)?4:0;
|
|
|
|
nb |= (cmd->sidemove>0)?8:0;
|
|
|
|
nb |= (cmd->forwardmove<0)?16:0;
|
|
|
|
nb |= (cmd->forwardmove>0)?32:0;
|
|
|
|
nb |= (cmd->upmove<0)?64:0;
|
|
|
|
nb |= (cmd->upmove>0)?128:0;
|
2013-06-23 02:17:02 +00:00
|
|
|
if (Cam_TrackNum(pv) >= 0)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (nb & (nb ^ pv->cam_oldbuttons) & 4)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
Cvar_SetValue(&cl_demospeed, max(cl_demospeed.value - 0.1, 0));
|
2013-06-23 02:17:02 +00:00
|
|
|
if (nb & (nb ^ pv->cam_oldbuttons) & 8)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
Cvar_SetValue(&cl_demospeed, min(cl_demospeed.value + 0.1, 10));
|
2013-06-23 02:17:02 +00:00
|
|
|
if (nb & (nb ^ pv->cam_oldbuttons) & (4|8))
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
Con_Printf("playback speed: %g%%\n", cl_demospeed.value*100);
|
2013-06-23 02:17:02 +00:00
|
|
|
if (nb & (nb ^ pv->cam_oldbuttons) & 16)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
Cbuf_AddText("demo_jump +10", RESTRICT_LOCAL);
|
2013-06-23 02:17:02 +00:00
|
|
|
if (nb & (nb ^ pv->cam_oldbuttons) & 32)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
Cbuf_AddText("demo_jump -10", RESTRICT_LOCAL);
|
2013-06-23 02:17:02 +00:00
|
|
|
if (nb & (nb ^ pv->cam_oldbuttons) & (4|8))
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
Con_Printf("playback speed: %g%%\n", cl_demospeed.value*100);
|
2013-06-23 02:17:02 +00:00
|
|
|
if (nb & (nb ^ pv->cam_oldbuttons) & 64)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
Cvar_SetValue(&cl_splitscreen, max(cl_splitscreen.ival - 1, 0));
|
2013-06-23 02:17:02 +00:00
|
|
|
if (nb & (nb ^ pv->cam_oldbuttons) & 128)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
Cvar_SetValue(&cl_splitscreen, min(cl_splitscreen.ival + 1, MAX_SPLITS-1));
|
|
|
|
}
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_oldbuttons = (pv->cam_oldbuttons & 3) | (nb & ~3);
|
2013-03-12 22:13:26 +00:00
|
|
|
if (cmd->impulse)
|
|
|
|
{
|
|
|
|
int pl = cmd->impulse;
|
|
|
|
for (i = 0; ; i++)
|
|
|
|
{
|
|
|
|
if (i == MAX_CLIENTS)
|
|
|
|
{
|
|
|
|
if (pl == cmd->impulse)
|
|
|
|
break;
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
s = &cl.players[i];
|
|
|
|
if (s->name[0] && !s->spectator)
|
|
|
|
{
|
|
|
|
pl--;
|
|
|
|
if (!pl)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_Lock(pv, i);
|
|
|
|
if (pv >= &cl.playerview[0] && pv < &cl.playerview[cl.splitclients])
|
|
|
|
{
|
2013-03-12 22:13:26 +00:00
|
|
|
pl = 1;
|
2013-06-23 02:17:02 +00:00
|
|
|
pv++;
|
|
|
|
}
|
2013-03-12 22:13:26 +00:00
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
if (cmd->buttons & BUTTON_ATTACK)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if (!(pv->cam_oldbuttons & BUTTON_ATTACK))
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_oldbuttons |= BUTTON_ATTACK;
|
|
|
|
pv->cam_auto++;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (pv->cam_auto > CAM_TRACK)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_Unlock(pv);
|
|
|
|
VectorCopy(pv->viewangles, cmd->angles);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_oldbuttons &= ~BUTTON_ATTACK;
|
|
|
|
if (!pv->cam_auto)
|
2005-03-28 00:11:59 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if ((cmd->buttons & BUTTON_JUMP) && !(pv->cam_oldbuttons & BUTTON_JUMP))
|
|
|
|
Cam_TrackCrosshairedPlayer(pv);
|
|
|
|
pv->cam_oldbuttons = (pv->cam_oldbuttons&~BUTTON_JUMP) | (cmd->buttons & BUTTON_JUMP);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
2005-03-28 00:11:59 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (pv->cam_auto && cl_hightrack.ival)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_CheckHighTarget(pv);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (pv->cam_locked)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
if ((cmd->buttons & BUTTON_JUMP) && (pv->cam_oldbuttons & BUTTON_JUMP))
|
2004-08-23 00:15:46 +00:00
|
|
|
return; // don't pogo stick
|
|
|
|
|
|
|
|
if (!(cmd->buttons & BUTTON_JUMP))
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_oldbuttons &= ~BUTTON_JUMP;
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_oldbuttons |= BUTTON_JUMP; // don't jump again until released
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Con_Printf("Selecting track target...\n");
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (pv->cam_locked && pv->cam_auto)
|
|
|
|
end = (pv->cam_spec_track + 1) % MAX_CLIENTS;
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2013-06-23 02:17:02 +00:00
|
|
|
end = pv->cam_spec_track;
|
2004-08-23 00:15:46 +00:00
|
|
|
i = end;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
s = &cl.players[i];
|
|
|
|
if (s->name[0] && !s->spectator)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_Lock(pv, i);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
i = (i + 1) % MAX_CLIENTS;
|
|
|
|
} while (i != end);
|
|
|
|
// stay on same guy?
|
2013-06-23 02:17:02 +00:00
|
|
|
i = pv->cam_spec_track;
|
2004-08-23 00:15:46 +00:00
|
|
|
s = &cl.players[i];
|
|
|
|
if (s->name[0] && !s->spectator)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_Lock(pv, i);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
Con_Printf("No target found ...\n");
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_auto = pv->cam_locked = false;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Cam_Reset(void)
|
|
|
|
{
|
|
|
|
int pnum;
|
|
|
|
for (pnum = 0; pnum < MAX_SPLITS; pnum++)
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
playerview_t *pv = &cl.playerview[pnum];
|
|
|
|
pv->cam_auto = CAM_NONE;
|
|
|
|
pv->cam_spec_track = 0;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
void Cam_TrackPlayer(int seat, char *cmdname, char *plrarg)
|
2006-05-18 00:48:43 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
playerview_t *pv = &cl.playerview[seat];
|
2006-05-18 00:48:43 +00:00
|
|
|
int slot;
|
|
|
|
player_info_t *s;
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
if (seat >= MAX_SPLITS)
|
2006-05-18 01:19:19 +00:00
|
|
|
return;
|
|
|
|
|
2006-05-18 00:48:43 +00:00
|
|
|
if (cls.state <= ca_connected)
|
|
|
|
{
|
|
|
|
Con_Printf("Not connected.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!cl.spectator)
|
|
|
|
{
|
|
|
|
Con_Printf("Not spectating.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Q_strcasecmp(plrarg, "off"))
|
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
Cam_Unlock(pv);
|
2006-05-18 00:48:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// search nicks first
|
|
|
|
for (slot = 0; slot < MAX_CLIENTS; slot++)
|
|
|
|
{
|
|
|
|
s = &cl.players[slot];
|
|
|
|
if (s->name[0] && !s->spectator && !Q_strcasecmp(s->name, plrarg))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (slot == MAX_CLIENTS)
|
|
|
|
{
|
|
|
|
// didn't find nick, so search userids
|
|
|
|
int userid;
|
|
|
|
char *c;
|
|
|
|
|
|
|
|
// check if given arg is in fact a number
|
|
|
|
c = plrarg;
|
|
|
|
while (*c)
|
|
|
|
{
|
2012-11-27 03:23:19 +00:00
|
|
|
if (*c < '0' || *c > '9')
|
2006-05-18 00:48:43 +00:00
|
|
|
{
|
|
|
|
Con_Printf("Couldn't find nick %s\n", plrarg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
|
|
|
|
userid = atoi(plrarg);
|
|
|
|
|
|
|
|
for (slot = 0; slot < MAX_CLIENTS; slot++)
|
|
|
|
{
|
|
|
|
s = &cl.players[slot];
|
|
|
|
if (s->name[0] && !s->spectator && s->userid == userid)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (slot == MAX_CLIENTS)
|
|
|
|
{
|
|
|
|
Con_Printf("Couldn't find userid %i\n", userid);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 02:17:02 +00:00
|
|
|
pv->cam_auto = CAM_TRACK;
|
|
|
|
Cam_Lock(pv, slot);
|
|
|
|
pv->cam_locked = true;
|
2006-05-18 00:48:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Cam_Track_f(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
if (Cmd_Argc() < 2)
|
|
|
|
{
|
|
|
|
Con_Printf("Usage: %s userid|nick|off\n", Cmd_Argv(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
j = Cmd_Argc() - 1;
|
|
|
|
if (j > MAX_SPLITS)
|
|
|
|
j = MAX_SPLITS;
|
|
|
|
|
|
|
|
while (j > 0)
|
|
|
|
{
|
|
|
|
Cam_TrackPlayer(i - 1, Cmd_Argv(0), Cmd_Argv(i));
|
|
|
|
i++;
|
|
|
|
j--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Cam_Track1_f(void)
|
|
|
|
{
|
|
|
|
if (Cmd_Argc() < 2)
|
|
|
|
{
|
|
|
|
Con_Printf("Usage: %s userid|nick|off\n", Cmd_Argv(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cam_TrackPlayer(0, Cmd_Argv(0), Cmd_Argv(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Cam_Track2_f(void)
|
|
|
|
{
|
|
|
|
if (Cmd_Argc() < 2)
|
|
|
|
{
|
|
|
|
Con_Printf("Usage: %s userid|nick|off\n", Cmd_Argv(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cam_TrackPlayer(1, Cmd_Argv(0), Cmd_Argv(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Cam_Track3_f(void)
|
|
|
|
{
|
|
|
|
if (Cmd_Argc() < 2)
|
|
|
|
{
|
|
|
|
Con_Printf("Usage: %s userid|nick|off\n", Cmd_Argv(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cam_TrackPlayer(2, Cmd_Argv(0), Cmd_Argv(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Cam_Track4_f(void)
|
|
|
|
{
|
|
|
|
if (Cmd_Argc() < 2)
|
|
|
|
{
|
|
|
|
Con_Printf("Usage: %s userid|nick|off\n", Cmd_Argv(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cam_TrackPlayer(3, Cmd_Argv(0), Cmd_Argv(1));
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
void CL_InitCam(void)
|
|
|
|
{
|
|
|
|
Cvar_Register (&cl_hightrack, cl_spectatorgroup);
|
|
|
|
Cvar_Register (&cl_chasecam, cl_spectatorgroup);
|
|
|
|
// Cvar_Register (&cl_camera_maxpitch, cl_spectatorgroup);
|
|
|
|
// Cvar_Register (&cl_camera_maxyaw, cl_spectatorgroup);
|
2006-09-17 00:59:22 +00:00
|
|
|
// Cvar_Register (&cl_selfcam, cl_spectatorgroup);
|
2006-05-18 00:48:43 +00:00
|
|
|
|
|
|
|
Cmd_AddCommand("track", Cam_Track_f);
|
|
|
|
Cmd_AddCommand("track1", Cam_Track1_f);
|
|
|
|
Cmd_AddCommand("track2", Cam_Track2_f);
|
|
|
|
Cmd_AddCommand("track3", Cam_Track3_f);
|
|
|
|
Cmd_AddCommand("track4", Cam_Track4_f);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|