mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 00:30:57 +00:00
Merges and cleanups...
This commit is contained in:
parent
87894c0d39
commit
048a80ce23
22 changed files with 334 additions and 481 deletions
|
@ -58,10 +58,14 @@ cvar_t *cl_color;
|
|||
|
||||
cvar_t *cl_shownet;
|
||||
cvar_t *cl_nolerp;
|
||||
|
||||
cvar_t *cl_sbar;
|
||||
cvar_t *cl_hudswap;
|
||||
|
||||
cvar_t *cl_cshift_bonus;
|
||||
cvar_t *cl_cshift_contents;
|
||||
cvar_t *cl_cshift_damage;
|
||||
cvar_t *cl_cshift_powerup;
|
||||
|
||||
cvar_t *lookspring;
|
||||
|
||||
cvar_t *m_pitch;
|
||||
|
@ -100,47 +104,55 @@ CL_InitCvars (void)
|
|||
"display realtime frames per second");
|
||||
show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL,
|
||||
"display the current time");
|
||||
// Misty: Turn on or off screen filling colors for powerups among other things.
|
||||
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, NULL,
|
||||
"Show bonus flash on item pickup");
|
||||
cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE, NULL,
|
||||
"Shift view colors for contents (water, slime, etc)");
|
||||
cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE, NULL,
|
||||
"Shift view colors on damage");
|
||||
cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE, NULL, "Shift view colors for powerups");
|
||||
cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE, NULL,
|
||||
"inform when execing a command");
|
||||
"inform when execing a command");
|
||||
cl_name = Cvar_Get ("_cl_name", "player", CVAR_ARCHIVE, NULL,
|
||||
"Player name");
|
||||
"Player name");
|
||||
cl_color = Cvar_Get ("_cl_color", "0", CVAR_ARCHIVE, NULL,
|
||||
"Player color");
|
||||
"Player color");
|
||||
cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL,
|
||||
"swim/fly up/down speed");
|
||||
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE,
|
||||
NULL, "forward speed");
|
||||
"swim/fly up/down speed");
|
||||
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
"forward speed");
|
||||
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
"backward speed");
|
||||
"backward speed");
|
||||
cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, NULL,
|
||||
"strafe speed");
|
||||
"strafe speed");
|
||||
cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL,
|
||||
"move `run' speed multiplier");
|
||||
"move `run' speed multiplier");
|
||||
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL,
|
||||
"turning speed");
|
||||
"turning speed");
|
||||
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL,
|
||||
"look up/down speed");
|
||||
"look up/down speed");
|
||||
cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE,
|
||||
NULL, "turn `run' speed multiplier");
|
||||
NULL, "turn `run' speed multiplier");
|
||||
cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL,
|
||||
"show network packets. 0=off, 1=basic, 2=verbose");
|
||||
"show network packets. 0=off, 1=basic, 2=verbose");
|
||||
cl_nolerp = Cvar_Get ("cl_nolerp", "0", CVAR_NONE, NULL,
|
||||
"linear motion interpolation");
|
||||
"linear motion interpolation");
|
||||
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL,
|
||||
"status bar mode");
|
||||
"status bar mode");
|
||||
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
|
||||
"new HUD on left side?");
|
||||
"new HUD on left side?");
|
||||
lookspring =
|
||||
Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL,
|
||||
"Snap view to center when moving and no mlook/klook");
|
||||
"Snap view to center when moving and no mlook/klook");
|
||||
m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, NULL,
|
||||
"mouse pitch (up/down) multipier");
|
||||
"mouse pitch (up/down) multipier");
|
||||
m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_ARCHIVE, NULL,
|
||||
"mouse yaw (left/right) multipiler");
|
||||
"mouse yaw (left/right) multipiler");
|
||||
m_forward = Cvar_Get ("m_forward", "1", CVAR_ARCHIVE, NULL,
|
||||
"mouse forward/back speed");
|
||||
"mouse forward/back speed");
|
||||
m_side = Cvar_Get ("m_side", "0.8", CVAR_ARCHIVE, NULL,
|
||||
"mouse strafe speed");
|
||||
"mouse strafe speed");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -298,6 +298,7 @@ R_RunGunshotEffect (vec3_t org, int count)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
static void
|
||||
R_BloodPuff (vec3_t org, int count)
|
||||
|
|
|
@ -47,6 +47,7 @@ int part_tex_spark;
|
|||
int part_tex_smoke[8];
|
||||
int part_tex_smoke_ring[8];
|
||||
|
||||
|
||||
void
|
||||
GDT_Init (void)
|
||||
{
|
||||
|
@ -56,6 +57,7 @@ GDT_Init (void)
|
|||
GDT_InitSmokeRingParticleTexture ();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
GDT_InitDotParticleTexture (void)
|
||||
{
|
||||
|
@ -156,6 +158,7 @@ GDT_InitSmokeParticleTexture (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
GDT_InitSmokeRingParticleTexture (void)
|
||||
{
|
||||
|
|
|
@ -106,7 +106,6 @@ extern cvar_t *scr_fov;
|
|||
|
||||
extern byte gammatable[256];
|
||||
extern qboolean lighthalf;
|
||||
static float vid_gamma = 1.0;
|
||||
|
||||
|
||||
// LordHavoc: place for gl_rmain setup code
|
||||
|
@ -116,46 +115,6 @@ glrmain_init ()
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
GL_CheckGamma
|
||||
|
||||
More or less redesigned by LordHavoc
|
||||
*/
|
||||
void
|
||||
GL_CheckGamma (unsigned char *pal)
|
||||
{
|
||||
float inf;
|
||||
int i;
|
||||
|
||||
if ((i = COM_CheckParm ("-gamma")) == 0) {
|
||||
if ((gl_renderer && strstr (gl_renderer, "Voodoo")) ||
|
||||
(gl_vendor && strstr (gl_vendor, "3Dfx")))
|
||||
vid_gamma = 1;
|
||||
else
|
||||
vid_gamma = 0.7; // default to 0.7 on non-3dfx
|
||||
// hardware
|
||||
} else
|
||||
vid_gamma = atof (com_argv[i + 1]);
|
||||
|
||||
// build the gamma table
|
||||
if (vid_gamma == 1) {
|
||||
// screw the math
|
||||
for (i = 0; i < 256; i++)
|
||||
gammatable[i] = i;
|
||||
} else {
|
||||
for (i = 0; i < 256; i++) {
|
||||
inf = pow ((i + 1) / 256.0, vid_gamma) * 255 + 0.5;
|
||||
inf = bound (0, inf, 255);
|
||||
gammatable[i] = inf;
|
||||
}
|
||||
}
|
||||
|
||||
// correct the palette
|
||||
for (i = 0; i < 768; i++)
|
||||
pal[i] = gammatable[pal[i]];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_RotateForEntity (entity_t *e)
|
||||
{
|
||||
|
|
|
@ -243,9 +243,6 @@ SCR_CheckDrawCenterString (void)
|
|||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
float
|
||||
CalcFov (float fov_x, float width, float height)
|
||||
{
|
||||
|
@ -284,8 +281,6 @@ SCR_CalcRefdef (void)
|
|||
// force the status bar to redraw
|
||||
Sbar_Changed ();
|
||||
|
||||
//========================================
|
||||
|
||||
// bound viewsize
|
||||
Cvar_SetValue (scr_viewsize, bound (30, scr_viewsize->int_val, 120));
|
||||
|
||||
|
@ -372,9 +367,6 @@ SCR_SizeDown_f (void)
|
|||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
||||
void
|
||||
SCR_Init (void)
|
||||
{
|
||||
|
@ -537,9 +529,6 @@ SCR_DrawPause (void)
|
|||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
void
|
||||
SCR_SetUpToDrawConsole (void)
|
||||
{
|
||||
|
@ -697,6 +686,7 @@ SCR_DrawStringToSnap (const char *s, byte * buf, int x, int y, int width)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SCR_RSShot_f (void)
|
||||
{
|
||||
|
@ -807,8 +797,6 @@ SCR_RSShot_f (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
char *scr_notifystring;
|
||||
|
||||
|
@ -845,9 +833,6 @@ SCR_DrawNotifyString (void)
|
|||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
void
|
||||
SCR_TileClear (void)
|
||||
{
|
||||
|
|
|
@ -59,9 +59,7 @@ float speedscale; // for top sky and bottom sky
|
|||
// Set to true if a valid skybox is loaded --KB
|
||||
qboolean skyloaded = false;
|
||||
|
||||
/*
|
||||
R_LoadSkys
|
||||
*/
|
||||
|
||||
char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
|
||||
void
|
||||
R_LoadSkys (const char *skyname)
|
||||
|
@ -101,6 +99,7 @@ R_LoadSkys (const char *skyname)
|
|||
Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_SkyBoxPolyVec (vec5_t v)
|
||||
{
|
||||
|
@ -112,8 +111,8 @@ R_SkyBoxPolyVec (vec5_t v)
|
|||
r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]);
|
||||
}
|
||||
|
||||
#define ftc(x) (x * (254.0/256.0) + (1.0/256.0))
|
||||
|
||||
#define ftc(x) (x * (254.0/256.0) + (1.0/256.0))
|
||||
vec5_t skyvec[6][4] = {
|
||||
{
|
||||
// right +y
|
||||
|
@ -158,9 +157,9 @@ vec5_t skyvec[6][4] = {
|
|||
{ftc (0), ftc (0), -1024, 1024, -1024}
|
||||
}
|
||||
};
|
||||
|
||||
#undef ftc
|
||||
|
||||
|
||||
void
|
||||
R_DrawSkyBox (void)
|
||||
{
|
||||
|
@ -182,6 +181,7 @@ R_DrawSkyBox (void)
|
|||
|
||||
|
||||
vec3_t domescale;
|
||||
|
||||
void
|
||||
R_DrawSkyLayer (float s)
|
||||
{
|
||||
|
@ -260,6 +260,7 @@ R_DrawSkyDome (void)
|
|||
glDepthRange (gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_DrawSky (void)
|
||||
{
|
||||
|
@ -276,8 +277,6 @@ R_DrawSky (void)
|
|||
}
|
||||
|
||||
|
||||
//===============================================================
|
||||
|
||||
/*
|
||||
R_InitSky
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
gl_view.c
|
||||
|
||||
OpenGL-specific view management functions
|
||||
player eye positioning
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -37,24 +37,25 @@
|
|||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/compat.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "glquake.h"
|
||||
#include "host.h"
|
||||
#include "view.h"
|
||||
|
||||
extern double host_frametime;
|
||||
|
||||
extern byte gammatable[256];
|
||||
|
||||
extern qboolean V_CheckGamma (void);
|
||||
|
||||
extern void V_CalcIntermissionRefdef (void);
|
||||
extern void V_CalcPowerupCshift (void);
|
||||
extern void V_CalcRefdef (void);
|
||||
|
||||
extern cvar_t *crosshair;
|
||||
extern cvar_t *gl_cshiftpercent;
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
|
||||
extern cvar_t *scr_ofsx;
|
||||
extern cvar_t *scr_ofsy;
|
||||
extern cvar_t *scr_ofsz;
|
||||
|
@ -72,11 +73,7 @@ float v_blend[4]; // rgba 0.0 - 1.0
|
|||
void
|
||||
V_CalcBlend (void)
|
||||
{
|
||||
float r = 0;
|
||||
float g = 0;
|
||||
float b = 0;
|
||||
float a = 0;
|
||||
|
||||
float r = 0, g = 0, b = 0, a = 0;
|
||||
float a2, a3;
|
||||
int i;
|
||||
|
||||
|
@ -84,8 +81,7 @@ V_CalcBlend (void)
|
|||
if (!gl_cshiftpercent->value)
|
||||
continue;
|
||||
|
||||
a2 =
|
||||
((cl.cshifts[i].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
|
||||
a2 = ((cl.cshifts[i].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
|
||||
|
||||
if (!a2)
|
||||
continue;
|
||||
|
@ -99,14 +95,22 @@ V_CalcBlend (void)
|
|||
a = 1.0 - a3;
|
||||
}
|
||||
|
||||
// LordHavoc: saturate color
|
||||
if (a) {
|
||||
a2 = 1.0 / a;
|
||||
r *= a2;
|
||||
g *= a2;
|
||||
b *= a2;
|
||||
// don't clamp alpha here, we do it below
|
||||
}
|
||||
if ((a2 = 1 - bound (0.0, contrast->value, 1.0)) < 0.999) { // add contrast
|
||||
r += (128 - r) * a2;
|
||||
g += (128 - g) * a2;
|
||||
b += (128 - b) * a2;
|
||||
|
||||
a3 = (1.0 - a) * (1.0 - a2);
|
||||
a = 1.0 - a3;
|
||||
}
|
||||
|
||||
// LordHavoc: saturate color
|
||||
if (a) {
|
||||
a2 = 1.0 / a;
|
||||
r *= a2;
|
||||
g *= a2;
|
||||
b *= a2;
|
||||
}
|
||||
|
||||
v_blend[0] = min (r, 255.0) / 255.0;
|
||||
v_blend[1] = min (g, 255.0) / 255.0;
|
||||
|
@ -115,6 +119,50 @@ V_CalcBlend (void)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
if (!cl_cshift_powerup->int_val)
|
||||
// || (atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) & INFO_CSHIFT_POWERUP))
|
||||
return;
|
||||
|
||||
if ((gl_dlight_polyblend->int_val ||
|
||||
!(gl_dlight_lightmap->int_val && gl_dlight_polyblend->int_val)) &&
|
||||
(cl.items & IT_INVULNERABILITY ||
|
||||
cl.items & IT_QUAD))
|
||||
{
|
||||
if (cl.items & IT_INVULNERABILITY &&
|
||||
cl.items & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.items & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.items & IT_INVULNERABILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
}
|
||||
} else if (cl.items & IT_SUIT) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 20;
|
||||
} else if (cl.items & IT_INVISIBILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 100;
|
||||
} else
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_UpdatePalette
|
||||
|
||||
|
@ -147,13 +195,13 @@ V_UpdatePalette (void)
|
|||
|
||||
// drop the damage value
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime * 150;
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent =
|
||||
max (cl.cshifts[CSHIFT_DAMAGE].percent, 0);
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
|
||||
|
||||
// drop the bonus value
|
||||
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime * 100;
|
||||
cl.cshifts[CSHIFT_BONUS].percent =
|
||||
max (cl.cshifts[CSHIFT_BONUS].percent, 0);
|
||||
if (cl.cshifts[CSHIFT_BONUS].percent < 0)
|
||||
cl.cshifts[CSHIFT_BONUS].percent = 0;
|
||||
|
||||
force = V_CheckGamma ();
|
||||
if (!new && !force)
|
||||
|
@ -161,55 +209,3 @@ V_UpdatePalette (void)
|
|||
|
||||
V_CalcBlend ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
|
||||
void
|
||||
V_RenderView (void)
|
||||
{
|
||||
if (!cl.worldmodel || cls.signon != SIGNONS)
|
||||
return;
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
if (cl.maxclients > 1) {
|
||||
Cvar_Set (scr_ofsx, "0");
|
||||
Cvar_Set (scr_ofsy, "0");
|
||||
Cvar_Set (scr_ofsz, "0");
|
||||
}
|
||||
|
||||
if (cl.intermission) { // intermission / finale rendering
|
||||
V_CalcIntermissionRefdef ();
|
||||
} else {
|
||||
if (!cl.paused /* && (sv.maxclients > 1 || key_dest
|
||||
== key_game) */ )
|
||||
V_CalcRefdef ();
|
||||
}
|
||||
|
||||
R_PushDlights (vec3_origin);
|
||||
|
||||
R_RenderView ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
BuildGammaTable
|
||||
|
||||
In software mode, this function gets the palette ready for changing...
|
||||
in GL, it does very little as you can see.
|
||||
*/
|
||||
void
|
||||
BuildGammaTable (float b, float c)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
gammatable[i] = i;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -184,15 +184,12 @@ GL_SubdivideSurface (msurface_t *fa)
|
|||
SubdividePolygon (numverts, verts[0]);
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
||||
|
||||
// speed up sin calculations - Ed
|
||||
float turbsin[] = {
|
||||
# include "gl_warp_sin.h"
|
||||
};
|
||||
|
||||
|
||||
#define TURBSCALE (256.0 / (2 * M_PI))
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
view.c
|
||||
r_view.c
|
||||
|
||||
@description@
|
||||
player eye positioning
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -42,7 +42,6 @@
|
|||
#include "r_local.h"
|
||||
#include "view.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
The view is allowed to move slightly from it's true position for bobbing,
|
||||
|
@ -63,9 +62,10 @@ cvar_t *cl_bob;
|
|||
cvar_t *cl_bobcycle;
|
||||
cvar_t *cl_bobup;
|
||||
|
||||
cvar_t *v_kicktime;
|
||||
cvar_t *v_kickroll;
|
||||
cvar_t *v_kickpitch;
|
||||
cvar_t *v_centermove;
|
||||
cvar_t *v_centerspeed;
|
||||
|
||||
cvar_t *v_gamma;
|
||||
|
||||
cvar_t *v_iyaw_cycle;
|
||||
cvar_t *v_iroll_cycle;
|
||||
|
@ -76,6 +76,10 @@ cvar_t *v_ipitch_level;
|
|||
|
||||
cvar_t *v_idlescale;
|
||||
|
||||
cvar_t *v_kicktime;
|
||||
cvar_t *v_kickroll;
|
||||
cvar_t *v_kickpitch;
|
||||
|
||||
cvar_t *crosshair;
|
||||
cvar_t *crosshaircolor;
|
||||
cvar_t *cl_crossx;
|
||||
|
@ -86,11 +90,13 @@ cvar_t *gl_cshiftpercent;
|
|||
cvar_t *brightness;
|
||||
cvar_t *contrast;
|
||||
|
||||
byte gammatable[256]; // palette is sent through this
|
||||
|
||||
float v_dmg_time, v_dmg_roll, v_dmg_pitch;
|
||||
|
||||
extern int in_forward, in_forward2, in_back;
|
||||
extern cvar_t *vid_gamma;
|
||||
|
||||
void BuildGammaTable (float, float);
|
||||
extern int in_forward, in_forward2, in_back;
|
||||
|
||||
|
||||
float
|
||||
|
@ -113,7 +119,7 @@ V_CalcBob (void)
|
|||
bob =
|
||||
sqrt (cl.velocity[0] * cl.velocity[0] +
|
||||
cl.velocity[1] * cl.velocity[1]) * cl_bob->value;
|
||||
//Con_Printf ("speed: %5.1f\n", Length(cl.velocity));
|
||||
// Con_Printf ("speed: %5.1f\n", Length(cl.velocity));
|
||||
bob = bob * 0.3 + bob * 0.7 * sin (cycle);
|
||||
if (bob > 4)
|
||||
bob = 4;
|
||||
|
@ -124,22 +130,16 @@ V_CalcBob (void)
|
|||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
cvar_t *v_centermove;
|
||||
cvar_t *v_centerspeed;
|
||||
|
||||
|
||||
void
|
||||
V_StartPitchDrift (void)
|
||||
{
|
||||
#if 1
|
||||
if (cl.laststop == cl.time) {
|
||||
return; // something else is keeping it from
|
||||
// drifting
|
||||
// drifting
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cl.nodrift || !cl.pitchvel) {
|
||||
cl.pitchvel = v_centerspeed->value;
|
||||
cl.nodrift = false;
|
||||
|
@ -147,6 +147,7 @@ V_StartPitchDrift (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_StopPitchDrift (void)
|
||||
{
|
||||
|
@ -177,7 +178,8 @@ V_DriftPitch (void)
|
|||
cl.pitchvel = 0;
|
||||
return;
|
||||
}
|
||||
// don't count small mouse motion
|
||||
|
||||
// don't count small mouse motion
|
||||
if (cl.nodrift) {
|
||||
if (fabs (cl.cmd.forwardmove) < cl_forwardspeed->value)
|
||||
cl.driftmove = 0;
|
||||
|
@ -200,7 +202,7 @@ V_DriftPitch (void)
|
|||
move = host_frametime * cl.pitchvel;
|
||||
cl.pitchvel += host_frametime * v_centerspeed->value;
|
||||
|
||||
//Con_Printf ("move: %f (%f)\n", move, host_frametime);
|
||||
// Con_Printf ("move: %f (%f)\n", move, host_frametime);
|
||||
|
||||
if (delta > 0) {
|
||||
if (move > delta) {
|
||||
|
@ -218,45 +220,42 @@ V_DriftPitch (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
PALETTE FLASHES
|
||||
*/
|
||||
|
||||
|
||||
cshift_t cshift_empty = { {130, 80, 50}
|
||||
, 0
|
||||
, 0
|
||||
};
|
||||
|
||||
cshift_t cshift_water = { {130, 80, 50}
|
||||
, 128
|
||||
, 128
|
||||
};
|
||||
|
||||
cshift_t cshift_slime = { {0, 25, 5}
|
||||
, 150
|
||||
, 150
|
||||
};
|
||||
|
||||
cshift_t cshift_lava = { {255, 80, 0}
|
||||
, 150
|
||||
, 150
|
||||
};
|
||||
|
||||
cvar_t *v_gamma;
|
||||
|
||||
byte gammatable[256]; // palette is sent through this
|
||||
|
||||
|
||||
qboolean
|
||||
V_CheckGamma (void)
|
||||
{
|
||||
static float oldbrightness;
|
||||
static float oldcontrast;
|
||||
static float oldgamma;
|
||||
|
||||
if ((brightness->value == oldbrightness) && contrast->value == oldcontrast)
|
||||
return false;
|
||||
oldbrightness = brightness->value;
|
||||
oldcontrast = contrast->value;
|
||||
if (vid_gamma) { // might get called before vid_gamma gets set
|
||||
if (oldgamma == vid_gamma->value)
|
||||
return false;
|
||||
|
||||
BuildGammaTable (brightness->value, contrast->value);
|
||||
vid.recalc_refdef = 1; // force a surface cache flush
|
||||
oldgamma = vid_gamma->value;
|
||||
}
|
||||
|
||||
|
||||
vid.recalc_refdef = 1; // force a surface cache flush
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -304,9 +303,8 @@ V_ParseDamage (void)
|
|||
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// calculate view angle kicks
|
||||
//
|
||||
// calculate view angle kicks
|
||||
|
||||
ent = &cl_entities[cl.viewentity];
|
||||
|
||||
VectorSubtract (from, ent->origin, from);
|
||||
|
@ -374,38 +372,11 @@ V_SetContentsColor (int contents)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
if (cl.items & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.items & IT_SUIT) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 20;
|
||||
} else if (cl.items & IT_INVISIBILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 100;
|
||||
} else if (cl.items & IT_INVULNERABILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
VIEW RENDERING
|
||||
*/
|
||||
|
||||
|
||||
float
|
||||
angledelta (float a)
|
||||
{
|
||||
|
@ -495,6 +466,7 @@ V_BoundOffsets (void)
|
|||
r_refdef.vieworg[2] = ent->origin[2] + 30;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_AddIdle
|
||||
|
||||
|
@ -550,16 +522,17 @@ V_CalcIntermissionRefdef (void)
|
|||
entity_t *ent, *view;
|
||||
float old;
|
||||
|
||||
// ent is the player model (visible when out of body)
|
||||
// ent is the player model (visible when out of body)
|
||||
ent = &cl_entities[cl.viewentity];
|
||||
// view is the weapon model (only visible from inside body)
|
||||
|
||||
// view is the weapon model (only visible from inside body)
|
||||
view = &cl.viewent;
|
||||
|
||||
VectorCopy (ent->origin, r_refdef.vieworg);
|
||||
VectorCopy (ent->angles, r_refdef.viewangles);
|
||||
view->model = NULL;
|
||||
|
||||
// always idle in intermission
|
||||
// always idle in intermission
|
||||
old = v_idlescale->value;
|
||||
Cvar_SetValue (v_idlescale, 1);
|
||||
V_AddIdle ();
|
||||
|
@ -579,9 +552,9 @@ V_CalcRefdef (void)
|
|||
|
||||
V_DriftPitch ();
|
||||
|
||||
// ent is the player model (visible when out of body)
|
||||
// ent is the player model (visible when out of body)
|
||||
ent = &cl_entities[cl.viewentity];
|
||||
// view is the weapon model (only visible from inside body)
|
||||
// view is the weapon model (only visible from inside body)
|
||||
view = &cl.viewent;
|
||||
|
||||
|
||||
|
@ -595,7 +568,7 @@ V_CalcRefdef (void)
|
|||
|
||||
bob = V_CalcBob ();
|
||||
|
||||
// refresh position
|
||||
// refresh position
|
||||
VectorCopy (ent->origin, r_refdef.vieworg);
|
||||
r_refdef.vieworg[2] += cl.viewheight + bob;
|
||||
|
||||
|
@ -610,23 +583,23 @@ V_CalcRefdef (void)
|
|||
V_CalcViewRoll ();
|
||||
V_AddIdle ();
|
||||
|
||||
// offsets
|
||||
// offsets
|
||||
angles[PITCH] = -ent->angles[PITCH]; // because entity pitches are
|
||||
// actually backward
|
||||
// actually backward
|
||||
angles[YAW] = ent->angles[YAW];
|
||||
angles[ROLL] = ent->angles[ROLL];
|
||||
|
||||
AngleVectors (angles, forward, right, up);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
r_refdef.vieworg[i] += scr_ofsx->value * forward[i]
|
||||
+ scr_ofsy->value * right[i]
|
||||
+ scr_ofsz->value * up[i];
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
r_refdef.vieworg[i] += scr_ofsx->value * forward[i] +
|
||||
scr_ofsy->value * right[i] +
|
||||
scr_ofsz->value * up[i];
|
||||
}
|
||||
|
||||
V_BoundOffsets ();
|
||||
|
||||
// set up gun position
|
||||
// set up gun position
|
||||
VectorCopy (cl.viewangles, view->angles);
|
||||
|
||||
CalcGunAngle ();
|
||||
|
@ -645,9 +618,9 @@ V_CalcRefdef (void)
|
|||
// roughly equal with different FOV
|
||||
|
||||
#if 0
|
||||
if (cl.model_precache[cl.stats[STAT_WEAPON]]
|
||||
&& strcmp (cl.model_precache[cl.stats[STAT_WEAPON]]->name,
|
||||
"progs/v_shot2.mdl"))
|
||||
if (cl.model_precache[cl.stats[STAT_WEAPON]] &&
|
||||
strcmp (cl.model_precache[cl.stats[STAT_WEAPON]]->name,
|
||||
"progs/v_shot2.mdl"))
|
||||
#endif
|
||||
if (cl_sbar->int_val == 0 && scr_viewsize->int_val >= 100);
|
||||
else if (scr_viewsize->int_val == 110)
|
||||
|
@ -663,10 +636,10 @@ V_CalcRefdef (void)
|
|||
view->frame = cl.stats[STAT_WEAPONFRAME];
|
||||
view->colormap = vid.colormap;
|
||||
|
||||
// set up the refresh position
|
||||
// set up the refresh position
|
||||
VectorAdd (r_refdef.viewangles, cl.punchangle, r_refdef.viewangles);
|
||||
|
||||
// smooth out stair step ups
|
||||
// smooth out stair step ups
|
||||
if (cl.onground && ent->origin[2] - oldz > 0) {
|
||||
float steptime;
|
||||
|
||||
|
@ -696,7 +669,32 @@ V_CalcRefdef (void)
|
|||
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;
|
||||
void
|
||||
V_RenderView (void)
|
||||
{
|
||||
if (!cl.worldmodel || cls.signon != SIGNONS)
|
||||
return;
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
if (cl.maxclients > 1) {
|
||||
Cvar_Set (scr_ofsx, "0");
|
||||
Cvar_Set (scr_ofsy, "0");
|
||||
Cvar_Set (scr_ofsz, "0");
|
||||
}
|
||||
|
||||
if (cl.intermission) { // intermission / finale rendering
|
||||
V_CalcIntermissionRefdef ();
|
||||
} else {
|
||||
if (!cl.paused /* && (sv.maxclients > 1 || key_dest
|
||||
== key_game) */ )
|
||||
V_CalcRefdef ();
|
||||
}
|
||||
|
||||
// nq thinks dlights should be here
|
||||
R_PushDlights (vec3_origin);
|
||||
|
||||
R_RenderView ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
@ -739,8 +737,6 @@ V_Init (void)
|
|||
v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, NULL, "None");
|
||||
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL, "None");
|
||||
|
||||
BuildGammaTable (1.0, 1.0); // no gamma yet
|
||||
brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, NULL, "None");
|
||||
contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "None");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
view.c
|
||||
sw_view.c
|
||||
|
||||
@description@
|
||||
player eye positioning
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -44,15 +44,52 @@ extern byte gammatable[256];
|
|||
extern qboolean V_CheckGamma (void);
|
||||
|
||||
extern void V_CalcIntermissionRefdef (void);
|
||||
extern void V_CalcPowerupCshift (void);
|
||||
extern void V_CalcRefdef (void);
|
||||
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
extern cvar_t *crosshair;
|
||||
extern cvar_t *scr_ofsx;
|
||||
extern cvar_t *scr_ofsy;
|
||||
extern cvar_t *scr_ofsz;
|
||||
|
||||
|
||||
void
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
if (!cl_cshift_powerup->int_val)
|
||||
return;
|
||||
|
||||
if (cl.items & IT_QUAD
|
||||
&& cl.items & IT_INVULNERABILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.items & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.items & IT_SUIT) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 20;
|
||||
} else if (cl.items & IT_INVISIBILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 100;
|
||||
} else if (cl.items & IT_INVULNERABILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_UpdatePalette (void)
|
||||
{
|
||||
|
@ -79,14 +116,14 @@ V_UpdatePalette (void)
|
|||
}
|
||||
}
|
||||
|
||||
// drop the damage value
|
||||
// drop the damage value
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime * 150;
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
|
||||
|
||||
// drop the bonus value
|
||||
// drop the bonus value
|
||||
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime * 100;
|
||||
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
|
||||
if (cl.cshifts[CSHIFT_BONUS].percent < 0)
|
||||
cl.cshifts[CSHIFT_BONUS].percent = 0;
|
||||
|
||||
force = V_CheckGamma ();
|
||||
|
@ -119,71 +156,3 @@ V_UpdatePalette (void)
|
|||
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
|
||||
void
|
||||
V_RenderView (void)
|
||||
{
|
||||
if (!cl.worldmodel || cls.signon != SIGNONS)
|
||||
return;
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
if (cl.maxclients > 1) {
|
||||
Cvar_Set (scr_ofsx, "0");
|
||||
Cvar_Set (scr_ofsy, "0");
|
||||
Cvar_Set (scr_ofsz, "0");
|
||||
}
|
||||
|
||||
if (cl.intermission) { // intermission / finale rendering
|
||||
V_CalcIntermissionRefdef ();
|
||||
} else {
|
||||
if (!cl.paused /* && (sv.maxclients > 1 || key_dest
|
||||
== key_game) */ )
|
||||
V_CalcRefdef ();
|
||||
}
|
||||
|
||||
R_PushDlights (vec3_origin);
|
||||
|
||||
R_RenderView ();
|
||||
|
||||
if (crosshair->int_val)
|
||||
Draw_Crosshair ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BuildGammaTable (float b, float c)
|
||||
{
|
||||
int i, j;
|
||||
int inf = 0;
|
||||
|
||||
if ((b == 1.0) && (c == 1.0)) {
|
||||
for (i = 0; i < 256; i++)
|
||||
gammatable[i] = i;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (!(i == 128)) {
|
||||
if (i < 128) {
|
||||
j = i + (int) ((128 - i) * (1 - c));
|
||||
} else {
|
||||
j = i + (int) ((i - 128) * (1 - c));
|
||||
}
|
||||
} else {
|
||||
j = i;
|
||||
}
|
||||
inf = (j * b); // gamma is brightness now, and
|
||||
// positive
|
||||
inf = bound (0, inf, 255);
|
||||
gammatable[i] = inf;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue