Merges and cleanups...

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-05-13 22:57:27 +00:00
parent 87894c0d39
commit 048a80ce23
22 changed files with 334 additions and 481 deletions

View file

@ -58,10 +58,14 @@ cvar_t *cl_color;
cvar_t *cl_shownet; cvar_t *cl_shownet;
cvar_t *cl_nolerp; cvar_t *cl_nolerp;
cvar_t *cl_sbar; cvar_t *cl_sbar;
cvar_t *cl_hudswap; 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 *lookspring;
cvar_t *m_pitch; cvar_t *m_pitch;
@ -100,47 +104,55 @@ CL_InitCvars (void)
"display realtime frames per second"); "display realtime frames per second");
show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL, show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL,
"display the current time"); "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, 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, cl_name = Cvar_Get ("_cl_name", "player", CVAR_ARCHIVE, NULL,
"Player name"); "Player name");
cl_color = Cvar_Get ("_cl_color", "0", CVAR_ARCHIVE, NULL, cl_color = Cvar_Get ("_cl_color", "0", CVAR_ARCHIVE, NULL,
"Player color"); "Player color");
cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL, cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL,
"swim/fly up/down speed"); "swim/fly up/down speed");
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL,
NULL, "forward speed"); "forward speed");
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL, cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
"backward speed"); "backward speed");
cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, NULL, 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, 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, cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL,
"turning speed"); "turning speed");
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL, 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, 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, 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, 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, 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, cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
"new HUD on left side?"); "new HUD on left side?");
lookspring = lookspring =
Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL, 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, 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, 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, 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, m_side = Cvar_Get ("m_side", "0.8", CVAR_ARCHIVE, NULL,
"mouse strafe speed"); "mouse strafe speed");
} }

View file

@ -298,6 +298,7 @@ R_RunGunshotEffect (vec3_t org, int count)
return; return;
} }
/* /*
static void static void
R_BloodPuff (vec3_t org, int count) R_BloodPuff (vec3_t org, int count)

View file

@ -47,6 +47,7 @@ int part_tex_spark;
int part_tex_smoke[8]; int part_tex_smoke[8];
int part_tex_smoke_ring[8]; int part_tex_smoke_ring[8];
void void
GDT_Init (void) GDT_Init (void)
{ {
@ -56,6 +57,7 @@ GDT_Init (void)
GDT_InitSmokeRingParticleTexture (); GDT_InitSmokeRingParticleTexture ();
} }
static void static void
GDT_InitDotParticleTexture (void) GDT_InitDotParticleTexture (void)
{ {
@ -156,6 +158,7 @@ GDT_InitSmokeParticleTexture (void)
} }
} }
static void static void
GDT_InitSmokeRingParticleTexture (void) GDT_InitSmokeRingParticleTexture (void)
{ {

View file

@ -106,7 +106,6 @@ extern cvar_t *scr_fov;
extern byte gammatable[256]; extern byte gammatable[256];
extern qboolean lighthalf; extern qboolean lighthalf;
static float vid_gamma = 1.0;
// LordHavoc: place for gl_rmain setup code // 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 void
R_RotateForEntity (entity_t *e) R_RotateForEntity (entity_t *e)
{ {

View file

@ -243,9 +243,6 @@ SCR_CheckDrawCenterString (void)
} }
//=============================================================================
float float
CalcFov (float fov_x, float width, float height) CalcFov (float fov_x, float width, float height)
{ {
@ -284,8 +281,6 @@ SCR_CalcRefdef (void)
// force the status bar to redraw // force the status bar to redraw
Sbar_Changed (); Sbar_Changed ();
//========================================
// bound viewsize // bound viewsize
Cvar_SetValue (scr_viewsize, bound (30, scr_viewsize->int_val, 120)); Cvar_SetValue (scr_viewsize, bound (30, scr_viewsize->int_val, 120));
@ -372,9 +367,6 @@ SCR_SizeDown_f (void)
} }
//============================================================================
void void
SCR_Init (void) SCR_Init (void)
{ {
@ -537,9 +529,6 @@ SCR_DrawPause (void)
} }
//=============================================================================
void void
SCR_SetUpToDrawConsole (void) SCR_SetUpToDrawConsole (void)
{ {
@ -697,6 +686,7 @@ SCR_DrawStringToSnap (const char *s, byte * buf, int x, int y, int width)
} }
} }
void void
SCR_RSShot_f (void) SCR_RSShot_f (void)
{ {
@ -807,8 +797,6 @@ SCR_RSShot_f (void)
#endif #endif
} }
//=============================================================================
char *scr_notifystring; char *scr_notifystring;
@ -845,9 +833,6 @@ SCR_DrawNotifyString (void)
} }
//=============================================================================
void void
SCR_TileClear (void) SCR_TileClear (void)
{ {

View file

@ -59,9 +59,7 @@ float speedscale; // for top sky and bottom sky
// Set to true if a valid skybox is loaded --KB // Set to true if a valid skybox is loaded --KB
qboolean skyloaded = false; qboolean skyloaded = false;
/*
R_LoadSkys
*/
char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" }; char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
void void
R_LoadSkys (const char *skyname) 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); Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
} }
void void
R_SkyBoxPolyVec (vec5_t v) 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]); 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] = { vec5_t skyvec[6][4] = {
{ {
// right +y // right +y
@ -158,9 +157,9 @@ vec5_t skyvec[6][4] = {
{ftc (0), ftc (0), -1024, 1024, -1024} {ftc (0), ftc (0), -1024, 1024, -1024}
} }
}; };
#undef ftc #undef ftc
void void
R_DrawSkyBox (void) R_DrawSkyBox (void)
{ {
@ -182,6 +181,7 @@ R_DrawSkyBox (void)
vec3_t domescale; vec3_t domescale;
void void
R_DrawSkyLayer (float s) R_DrawSkyLayer (float s)
{ {
@ -260,6 +260,7 @@ R_DrawSkyDome (void)
glDepthRange (gldepthmin, gldepthmax); glDepthRange (gldepthmin, gldepthmax);
} }
void void
R_DrawSky (void) R_DrawSky (void)
{ {
@ -276,8 +277,6 @@ R_DrawSky (void)
} }
//===============================================================
/* /*
R_InitSky R_InitSky

View file

@ -2,7 +2,7 @@
/* /*
gl_view.c gl_view.c
OpenGL-specific view management functions player eye positioning
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1996-1997 Id Software, Inc.
@ -37,24 +37,25 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "QF/console.h"
#include "QF/compat.h" #include "QF/compat.h"
#include "client.h" #include "client.h"
#include "glquake.h" #include "glquake.h"
#include "host.h"
#include "view.h" #include "view.h"
extern double host_frametime;
extern byte gammatable[256]; extern byte gammatable[256];
extern qboolean V_CheckGamma (void); extern qboolean V_CheckGamma (void);
extern void V_CalcIntermissionRefdef (void); extern void V_CalcIntermissionRefdef (void);
extern void V_CalcPowerupCshift (void);
extern void V_CalcRefdef (void); extern void V_CalcRefdef (void);
extern cvar_t *crosshair; extern cvar_t *crosshair;
extern cvar_t *gl_cshiftpercent; extern cvar_t *gl_cshiftpercent;
extern cvar_t *cl_cshift_powerup;
extern cvar_t *scr_ofsx; extern cvar_t *scr_ofsx;
extern cvar_t *scr_ofsy; extern cvar_t *scr_ofsy;
extern cvar_t *scr_ofsz; extern cvar_t *scr_ofsz;
@ -72,11 +73,7 @@ float v_blend[4]; // rgba 0.0 - 1.0
void void
V_CalcBlend (void) V_CalcBlend (void)
{ {
float r = 0; float r = 0, g = 0, b = 0, a = 0;
float g = 0;
float b = 0;
float a = 0;
float a2, a3; float a2, a3;
int i; int i;
@ -84,8 +81,7 @@ V_CalcBlend (void)
if (!gl_cshiftpercent->value) if (!gl_cshiftpercent->value)
continue; continue;
a2 = a2 = ((cl.cshifts[i].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
((cl.cshifts[i].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
if (!a2) if (!a2)
continue; continue;
@ -99,14 +95,22 @@ V_CalcBlend (void)
a = 1.0 - a3; a = 1.0 - a3;
} }
// LordHavoc: saturate color if ((a2 = 1 - bound (0.0, contrast->value, 1.0)) < 0.999) { // add contrast
if (a) { r += (128 - r) * a2;
a2 = 1.0 / a; g += (128 - g) * a2;
r *= a2; b += (128 - b) * a2;
g *= a2;
b *= a2; a3 = (1.0 - a) * (1.0 - a2);
// don't clamp alpha here, we do it below 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[0] = min (r, 255.0) / 255.0;
v_blend[1] = min (g, 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 V_UpdatePalette
@ -147,13 +195,13 @@ V_UpdatePalette (void)
// drop the damage value // drop the damage value
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime * 150; cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime * 150;
cl.cshifts[CSHIFT_DAMAGE].percent = if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
max (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; cl.cshifts[CSHIFT_BONUS].percent -= host_frametime * 100;
cl.cshifts[CSHIFT_BONUS].percent = if (cl.cshifts[CSHIFT_BONUS].percent < 0)
max (cl.cshifts[CSHIFT_BONUS].percent, 0); cl.cshifts[CSHIFT_BONUS].percent = 0;
force = V_CheckGamma (); force = V_CheckGamma ();
if (!new && !force) if (!new && !force)
@ -161,55 +209,3 @@ V_UpdatePalette (void)
V_CalcBlend (); 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;
}

View file

@ -184,15 +184,12 @@ GL_SubdivideSurface (msurface_t *fa)
SubdividePolygon (numverts, verts[0]); SubdividePolygon (numverts, verts[0]);
} }
//=========================================================
// speed up sin calculations - Ed // speed up sin calculations - Ed
float turbsin[] = { float turbsin[] = {
# include "gl_warp_sin.h" # include "gl_warp_sin.h"
}; };
#define TURBSCALE (256.0 / (2 * M_PI)) #define TURBSCALE (256.0 / (2 * M_PI))
/* /*

View file

@ -1,7 +1,7 @@
/* /*
view.c r_view.c
@description@ player eye positioning
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1996-1997 Id Software, Inc.
@ -42,7 +42,6 @@
#include "r_local.h" #include "r_local.h"
#include "view.h" #include "view.h"
/* /*
The view is allowed to move slightly from it's true position for bobbing, 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_bobcycle;
cvar_t *cl_bobup; cvar_t *cl_bobup;
cvar_t *v_kicktime; cvar_t *v_centermove;
cvar_t *v_kickroll; cvar_t *v_centerspeed;
cvar_t *v_kickpitch;
cvar_t *v_gamma;
cvar_t *v_iyaw_cycle; cvar_t *v_iyaw_cycle;
cvar_t *v_iroll_cycle; cvar_t *v_iroll_cycle;
@ -76,6 +76,10 @@ cvar_t *v_ipitch_level;
cvar_t *v_idlescale; cvar_t *v_idlescale;
cvar_t *v_kicktime;
cvar_t *v_kickroll;
cvar_t *v_kickpitch;
cvar_t *crosshair; cvar_t *crosshair;
cvar_t *crosshaircolor; cvar_t *crosshaircolor;
cvar_t *cl_crossx; cvar_t *cl_crossx;
@ -86,11 +90,13 @@ cvar_t *gl_cshiftpercent;
cvar_t *brightness; cvar_t *brightness;
cvar_t *contrast; cvar_t *contrast;
byte gammatable[256]; // palette is sent through this
float v_dmg_time, v_dmg_roll, v_dmg_pitch; 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 float
@ -113,7 +119,7 @@ V_CalcBob (void)
bob = bob =
sqrt (cl.velocity[0] * cl.velocity[0] + sqrt (cl.velocity[0] * cl.velocity[0] +
cl.velocity[1] * cl.velocity[1]) * cl_bob->value; 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); bob = bob * 0.3 + bob * 0.7 * sin (cycle);
if (bob > 4) if (bob > 4)
bob = 4; bob = 4;
@ -124,22 +130,16 @@ V_CalcBob (void)
} }
//=============================================================================
cvar_t *v_centermove;
cvar_t *v_centerspeed;
void void
V_StartPitchDrift (void) V_StartPitchDrift (void)
{ {
#if 1 #if 1
if (cl.laststop == cl.time) { if (cl.laststop == cl.time) {
return; // something else is keeping it from return; // something else is keeping it from
// drifting // drifting
} }
#endif #endif
if (cl.nodrift || !cl.pitchvel) { if (cl.nodrift || !cl.pitchvel) {
cl.pitchvel = v_centerspeed->value; cl.pitchvel = v_centerspeed->value;
cl.nodrift = false; cl.nodrift = false;
@ -147,6 +147,7 @@ V_StartPitchDrift (void)
} }
} }
void void
V_StopPitchDrift (void) V_StopPitchDrift (void)
{ {
@ -177,7 +178,8 @@ V_DriftPitch (void)
cl.pitchvel = 0; cl.pitchvel = 0;
return; return;
} }
// don't count small mouse motion
// don't count small mouse motion
if (cl.nodrift) { if (cl.nodrift) {
if (fabs (cl.cmd.forwardmove) < cl_forwardspeed->value) if (fabs (cl.cmd.forwardmove) < cl_forwardspeed->value)
cl.driftmove = 0; cl.driftmove = 0;
@ -200,7 +202,7 @@ V_DriftPitch (void)
move = host_frametime * cl.pitchvel; move = host_frametime * cl.pitchvel;
cl.pitchvel += host_frametime * v_centerspeed->value; 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 (delta > 0) {
if (move > delta) { if (move > delta) {
@ -218,45 +220,42 @@ V_DriftPitch (void)
} }
/* /*
PALETTE FLASHES PALETTE FLASHES
*/ */
cshift_t cshift_empty = { {130, 80, 50} cshift_t cshift_empty = { {130, 80, 50}
, 0 , 0
}; };
cshift_t cshift_water = { {130, 80, 50} cshift_t cshift_water = { {130, 80, 50}
, 128 , 128
}; };
cshift_t cshift_slime = { {0, 25, 5} cshift_t cshift_slime = { {0, 25, 5}
, 150 , 150
}; };
cshift_t cshift_lava = { {255, 80, 0} cshift_t cshift_lava = { {255, 80, 0}
, 150 , 150
}; };
cvar_t *v_gamma;
byte gammatable[256]; // palette is sent through this
qboolean qboolean
V_CheckGamma (void) V_CheckGamma (void)
{ {
static float oldbrightness; static float oldgamma;
static float oldcontrast;
if ((brightness->value == oldbrightness) && contrast->value == oldcontrast) if (vid_gamma) { // might get called before vid_gamma gets set
return false; if (oldgamma == vid_gamma->value)
oldbrightness = brightness->value; return false;
oldcontrast = contrast->value;
BuildGammaTable (brightness->value, contrast->value); oldgamma = vid_gamma->value;
vid.recalc_refdef = 1; // force a surface cache flush }
vid.recalc_refdef = 1; // force a surface cache flush
return true; return true;
} }
@ -304,9 +303,8 @@ V_ParseDamage (void)
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0; cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
} }
// // calculate view angle kicks
// calculate view angle kicks
//
ent = &cl_entities[cl.viewentity]; ent = &cl_entities[cl.viewentity];
VectorSubtract (from, ent->origin, from); 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 VIEW RENDERING
*/ */
float float
angledelta (float a) angledelta (float a)
{ {
@ -495,6 +466,7 @@ V_BoundOffsets (void)
r_refdef.vieworg[2] = ent->origin[2] + 30; r_refdef.vieworg[2] = ent->origin[2] + 30;
} }
/* /*
V_AddIdle V_AddIdle
@ -550,16 +522,17 @@ V_CalcIntermissionRefdef (void)
entity_t *ent, *view; entity_t *ent, *view;
float old; 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]; 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; view = &cl.viewent;
VectorCopy (ent->origin, r_refdef.vieworg); VectorCopy (ent->origin, r_refdef.vieworg);
VectorCopy (ent->angles, r_refdef.viewangles); VectorCopy (ent->angles, r_refdef.viewangles);
view->model = NULL; view->model = NULL;
// always idle in intermission // always idle in intermission
old = v_idlescale->value; old = v_idlescale->value;
Cvar_SetValue (v_idlescale, 1); Cvar_SetValue (v_idlescale, 1);
V_AddIdle (); V_AddIdle ();
@ -579,9 +552,9 @@ V_CalcRefdef (void)
V_DriftPitch (); 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]; 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; view = &cl.viewent;
@ -595,7 +568,7 @@ V_CalcRefdef (void)
bob = V_CalcBob (); bob = V_CalcBob ();
// refresh position // refresh position
VectorCopy (ent->origin, r_refdef.vieworg); VectorCopy (ent->origin, r_refdef.vieworg);
r_refdef.vieworg[2] += cl.viewheight + bob; r_refdef.vieworg[2] += cl.viewheight + bob;
@ -610,23 +583,23 @@ V_CalcRefdef (void)
V_CalcViewRoll (); V_CalcViewRoll ();
V_AddIdle (); V_AddIdle ();
// offsets // offsets
angles[PITCH] = -ent->angles[PITCH]; // because entity pitches are angles[PITCH] = -ent->angles[PITCH]; // because entity pitches are
// actually backward // actually backward
angles[YAW] = ent->angles[YAW]; angles[YAW] = ent->angles[YAW];
angles[ROLL] = ent->angles[ROLL]; angles[ROLL] = ent->angles[ROLL];
AngleVectors (angles, forward, right, up); AngleVectors (angles, forward, right, up);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++) {
r_refdef.vieworg[i] += scr_ofsx->value * forward[i] r_refdef.vieworg[i] += scr_ofsx->value * forward[i] +
+ scr_ofsy->value * right[i] scr_ofsy->value * right[i] +
+ scr_ofsz->value * up[i]; scr_ofsz->value * up[i];
}
V_BoundOffsets (); V_BoundOffsets ();
// set up gun position // set up gun position
VectorCopy (cl.viewangles, view->angles); VectorCopy (cl.viewangles, view->angles);
CalcGunAngle (); CalcGunAngle ();
@ -645,9 +618,9 @@ V_CalcRefdef (void)
// roughly equal with different FOV // roughly equal with different FOV
#if 0 #if 0
if (cl.model_precache[cl.stats[STAT_WEAPON]] if (cl.model_precache[cl.stats[STAT_WEAPON]] &&
&& strcmp (cl.model_precache[cl.stats[STAT_WEAPON]]->name, strcmp (cl.model_precache[cl.stats[STAT_WEAPON]]->name,
"progs/v_shot2.mdl")) "progs/v_shot2.mdl"))
#endif #endif
if (cl_sbar->int_val == 0 && scr_viewsize->int_val >= 100); if (cl_sbar->int_val == 0 && scr_viewsize->int_val >= 100);
else if (scr_viewsize->int_val == 110) else if (scr_viewsize->int_val == 110)
@ -663,10 +636,10 @@ V_CalcRefdef (void)
view->frame = cl.stats[STAT_WEAPONFRAME]; view->frame = cl.stats[STAT_WEAPONFRAME];
view->colormap = vid.colormap; view->colormap = vid.colormap;
// set up the refresh position // set up the refresh position
VectorAdd (r_refdef.viewangles, cl.punchangle, r_refdef.viewangles); 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) { if (cl.onground && ent->origin[2] - oldz > 0) {
float steptime; 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 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 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 void
@ -739,8 +737,6 @@ V_Init (void)
v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, NULL, "None"); v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, NULL, "None");
v_kickpitch = Cvar_Get ("v_kickpitch", "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"); brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, NULL, "None");
contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "None"); contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "None");
} }

View file

@ -1,7 +1,7 @@
/* /*
view.c sw_view.c
@description@ player eye positioning
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1996-1997 Id Software, Inc.
@ -44,15 +44,52 @@ extern byte gammatable[256];
extern qboolean V_CheckGamma (void); extern qboolean V_CheckGamma (void);
extern void V_CalcIntermissionRefdef (void); extern void V_CalcIntermissionRefdef (void);
extern void V_CalcPowerupCshift (void);
extern void V_CalcRefdef (void); extern void V_CalcRefdef (void);
extern cvar_t *cl_cshift_powerup;
extern cvar_t *crosshair; extern cvar_t *crosshair;
extern cvar_t *scr_ofsx; extern cvar_t *scr_ofsx;
extern cvar_t *scr_ofsy; extern cvar_t *scr_ofsy;
extern cvar_t *scr_ofsz; 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 void
V_UpdatePalette (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; 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; cl.cshifts[CSHIFT_DAMAGE].percent = 0;
// drop the bonus value // drop the bonus value
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime * 100; 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; cl.cshifts[CSHIFT_BONUS].percent = 0;
force = V_CheckGamma (); force = V_CheckGamma ();
@ -119,71 +156,3 @@ V_UpdatePalette (void)
VID_ShiftPalette (pal); 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;
}
}

View file

@ -38,9 +38,10 @@
#include <stdlib.h> #include <stdlib.h>
#include "cl_main.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/console.h" #include "QF/console.h"
#include "cl_main.h"
#include "glquake.h" #include "glquake.h"
#define MAX_FIRES 128 // rocket flames #define MAX_FIRES 128 // rocket flames
@ -49,13 +50,13 @@ static fire_t r_fires[MAX_FIRES];
extern cvar_t *gl_fires; extern cvar_t *gl_fires;
extern cvar_t *r_firecolor; extern cvar_t *r_firecolor;
/* /*
R_AddFire R_AddFire
Nifty ball of fire GL effect. Kinda a meshing of the dlight and Nifty ball of fire GL effect. Kinda a meshing of the dlight and
particle engine code. particle engine code.
*/ */
void void
R_AddFire (vec3_t start, vec3_t end, entity_t *ent) R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
{ {
@ -82,6 +83,7 @@ R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
} }
} }
/* /*
R_AllocFire R_AllocFire
@ -120,6 +122,7 @@ R_AllocFire (int key)
return f; return f;
} }
/* /*
R_DrawFire R_DrawFire
@ -173,6 +176,7 @@ R_DrawFire (fire_t *f)
glColor3ubv (lighthalf_v); glColor3ubv (lighthalf_v);
} }
/* /*
R_UpdateFires R_UpdateFires

View file

@ -65,6 +65,7 @@ extern int part_tex_smoke_ring[8];
int ramp[8] = { 0x6d, 0x6b, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 }; int ramp[8] = { 0x6d, 0x6b, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
inline particle_t * inline particle_t *
particle_new (ptype_t type, int texnum, vec3_t org, float scale, vec3_t vel, particle_new (ptype_t type, int texnum, vec3_t org, float scale, vec3_t vel,
float die, byte color, byte alpha, vec3_t up, vec3_t right) float die, byte color, byte alpha, vec3_t up, vec3_t right)
@ -93,6 +94,7 @@ particle_new (ptype_t type, int texnum, vec3_t org, float scale, vec3_t vel,
return part; return part;
} }
inline particle_t * inline particle_t *
particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz, particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
float scale, int vel_fuzz, float die, byte color, float scale, int vel_fuzz, float die, byte color,
@ -110,6 +112,7 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
return particle_new (type, texnum, porg, scale, pvel, die, color, alpha, vec3_origin, vec3_origin); return particle_new (type, texnum, porg, scale, pvel, die, color, alpha, vec3_origin, vec3_origin);
} }
/* /*
R_MaxParticlesCheck R_MaxParticlesCheck
@ -117,7 +120,6 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
Thanks to a LOT of help from Taniwha, Deek, Mercury, Lordhavoc, and Thanks to a LOT of help from Taniwha, Deek, Mercury, Lordhavoc, and
lots of others. lots of others.
*/ */
void void
R_MaxParticlesCheck (cvar_t *var) R_MaxParticlesCheck (cvar_t *var)
{ {
@ -146,9 +148,6 @@ R_MaxParticlesCheck (cvar_t *var)
R_ClearParticles(); R_ClearParticles();
} }
/*
R_Particles_Init_Cvars
*/
void void
R_Particles_Init_Cvars (void) R_Particles_Init_Cvars (void)
@ -160,15 +159,14 @@ R_Particles_Init_Cvars (void)
"Maximum amount of particles to display. No maximum, minimum is 0, although it's best to use r_particles 0 instead."); "Maximum amount of particles to display. No maximum, minimum is 0, although it's best to use r_particles 0 instead.");
} }
/*
R_ClearParticles
*/
void void
R_ClearParticles (void) R_ClearParticles (void)
{ {
numparticles = 0; numparticles = 0;
} }
void void
R_ReadPointFile_f (void) R_ReadPointFile_f (void)
{ {
@ -217,9 +215,7 @@ R_ReadPointFile_f (void)
Con_Printf ("%i points read\n", c); Con_Printf ("%i points read\n", c);
} }
/*
R_ParticleExplosion
*/
void void
R_ParticleExplosion (vec3_t org) R_ParticleExplosion (vec3_t org)
{ {
@ -231,9 +227,7 @@ R_ParticleExplosion (vec3_t org)
128 + (rand () & 63)); 128 + (rand () & 63));
} }
/*
R_BlobExplosion
*/
void void
R_BlobExplosion (vec3_t org) R_BlobExplosion (vec3_t org)
{ {
@ -254,6 +248,7 @@ R_BlobExplosion (vec3_t org)
} }
} }
static void static void
R_RunSparkEffect (vec3_t org, int count, int ofuzz) R_RunSparkEffect (vec3_t org, int count, int ofuzz)
{ {
@ -269,6 +264,7 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz)
lhrandom (0, 255)); lhrandom (0, 255));
} }
static void static void
R_RunGunshotEffect (vec3_t org, int count) R_RunGunshotEffect (vec3_t org, int count)
{ {
@ -286,6 +282,7 @@ R_RunGunshotEffect (vec3_t org, int count)
return; return;
} }
static void static void
R_BloodPuff (vec3_t org, int count) R_BloodPuff (vec3_t org, int count)
{ {
@ -297,9 +294,7 @@ R_BloodPuff (vec3_t org, int count)
vec3_origin, vec3_origin); vec3_origin, vec3_origin);
} }
/*
R_RunPuffEffect
*/
void void
R_RunPuffEffect (vec3_t org, byte type, byte count) R_RunPuffEffect (vec3_t org, byte type, byte count)
{ {
@ -319,9 +314,7 @@ R_RunPuffEffect (vec3_t org, byte type, byte count)
} }
} }
/*
R_RunParticleEffect
*/
void void
R_RunParticleEffect (vec3_t org, int color, int count) R_RunParticleEffect (vec3_t org, int color, int count)
{ {
@ -348,6 +341,7 @@ R_RunParticleEffect (vec3_t org, int color, int count)
} }
} }
void void
R_RunSpikeEffect (vec3_t org, byte type) R_RunSpikeEffect (vec3_t org, byte type)
{ {
@ -367,9 +361,7 @@ R_RunSpikeEffect (vec3_t org, byte type)
} }
} }
/*
R_LavaSplash
*/
void void
R_LavaSplash (vec3_t org) R_LavaSplash (vec3_t org)
{ {
@ -400,9 +392,7 @@ R_LavaSplash (vec3_t org)
} }
} }
/*
R_TeleportSplash
*/
void void
R_TeleportSplash (vec3_t org) R_TeleportSplash (vec3_t org)
{ {
@ -433,6 +423,7 @@ R_TeleportSplash (vec3_t org)
} }
} }
void void
R_RocketTrail (int type, entity_t *ent) R_RocketTrail (int type, entity_t *ent)
{ {
@ -547,9 +538,6 @@ R_RocketTrail (int type, entity_t *ent)
} }
/*
R_DrawParticles
*/
void void
R_DrawParticles (void) R_DrawParticles (void)
{ {

View file

@ -47,6 +47,7 @@ int part_tex_spark;
int part_tex_smoke[8]; int part_tex_smoke[8];
int part_tex_smoke_ring[8]; int part_tex_smoke_ring[8];
void void
GDT_Init (void) GDT_Init (void)
{ {
@ -56,6 +57,7 @@ GDT_Init (void)
GDT_InitSmokeRingParticleTexture (); GDT_InitSmokeRingParticleTexture ();
} }
static void static void
GDT_InitDotParticleTexture (void) GDT_InitDotParticleTexture (void)
{ {
@ -156,6 +158,7 @@ GDT_InitSmokeParticleTexture (void)
} }
} }
static void static void
GDT_InitSmokeRingParticleTexture (void) GDT_InitSmokeRingParticleTexture (void)
{ {

View file

@ -49,7 +49,6 @@ R_AnimateLight (void)
{ {
int i, j, k; int i, j, k;
// light animations // light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright // 'm' is normal light, 'a' is no light, 'z' is double bright
i = (int) (cl.time * 10); i = (int) (cl.time * 10);

View file

@ -240,7 +240,6 @@ float r_avertexnormal_dots[SHADEDOT_QUANT][256] =
; ;
float *shadedots = r_avertexnormal_dots[0]; float *shadedots = r_avertexnormal_dots[0];
int lastposenum, lastposenum0; int lastposenum, lastposenum0;
@ -304,6 +303,7 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
glColor3ubv (lighthalf_v); glColor3ubv (lighthalf_v);
} }
/* /*
GL_DrawAliasBlendedFrame GL_DrawAliasBlendedFrame

View file

@ -279,6 +279,7 @@ R_TimeRefresh_f (void)
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
} }
void void
D_FlushCaches (void) D_FlushCaches (void)
{ {

View file

@ -243,9 +243,6 @@ SCR_CheckDrawCenterString (void)
} }
//=============================================================================
float float
CalcFov (float fov_x, float width, float height) CalcFov (float fov_x, float width, float height)
{ {
@ -284,8 +281,6 @@ SCR_CalcRefdef (void)
// force the status bar to redraw // force the status bar to redraw
Sbar_Changed (); Sbar_Changed ();
//========================================
// bound viewsize // bound viewsize
Cvar_SetValue (scr_viewsize, bound (30, scr_viewsize->int_val, 120)); Cvar_SetValue (scr_viewsize, bound (30, scr_viewsize->int_val, 120));
@ -372,9 +367,6 @@ SCR_SizeDown_f (void)
} }
//============================================================================
void void
SCR_Init (void) SCR_Init (void)
{ {
@ -536,9 +528,6 @@ SCR_DrawPause (void)
} }
//=============================================================================
void void
SCR_SetUpToDrawConsole (void) SCR_SetUpToDrawConsole (void)
{ {
@ -806,9 +795,6 @@ SCR_RSShot_f (void)
} }
//=============================================================================
char *scr_notifystring; char *scr_notifystring;
void void
@ -844,9 +830,6 @@ SCR_DrawNotifyString (void)
} }
//=============================================================================
void void
SCR_TileClear (void) SCR_TileClear (void)
{ {

View file

@ -59,9 +59,7 @@ float speedscale; // for top sky and bottom sky
// Set to true if a valid skybox is loaded --KB // Set to true if a valid skybox is loaded --KB
qboolean skyloaded = false; qboolean skyloaded = false;
/*
R_LoadSkys
*/
char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" }; char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
void void
R_LoadSkys (const char *skyname) 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); Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
} }
void void
R_SkyBoxPolyVec (vec5_t v) 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]); 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] = { vec5_t skyvec[6][4] = {
{ {
// right +y // right +y
@ -158,9 +157,9 @@ vec5_t skyvec[6][4] = {
{ftc (0), ftc (0), -1024, 1024, -1024} {ftc (0), ftc (0), -1024, 1024, -1024}
} }
}; };
#undef ftc #undef ftc
void void
R_DrawSkyBox (void) R_DrawSkyBox (void)
{ {
@ -182,6 +181,7 @@ R_DrawSkyBox (void)
vec3_t domescale; vec3_t domescale;
void void
R_DrawSkyLayer (float s) R_DrawSkyLayer (float s)
{ {
@ -260,6 +260,7 @@ R_DrawSkyDome (void)
glDepthRange (gldepthmin, gldepthmax); glDepthRange (gldepthmin, gldepthmax);
} }
void void
R_DrawSky (void) R_DrawSky (void)
{ {
@ -276,8 +277,6 @@ R_DrawSky (void)
} }
//===============================================================
/* /*
R_InitSky R_InitSky

View file

@ -45,19 +45,18 @@
#include "glquake.h" #include "glquake.h"
#include "view.h" #include "view.h"
extern double host_frametime;
extern byte *vid_basepal; extern byte gammatable[256];
extern double host_frametime;
extern int onground; extern qboolean V_CheckGamma (void);
extern byte gammatable[256];
extern cvar_t *cl_cshift_powerup; extern cvar_t *cl_cshift_powerup;
extern cvar_t *contrast; extern cvar_t *contrast;
byte ramps[3][256]; byte ramps[3][256];
float v_blend[4]; float v_blend[4];
qboolean V_CheckGamma (void);
/* /*
@ -69,24 +68,20 @@ qboolean V_CheckGamma (void);
void void
V_CalcBlend (void) V_CalcBlend (void)
{ {
float r, g, b, a, a2, a3; float r = 0, g = 0, b = 0, a = 0;
int j; float a2, a3;
int i;
r = 0; for (i = 0; i < NUM_CSHIFTS; i++) {
g = 0; a2 = cl.cshifts[i].percent / 255.0;
b = 0;
a = 0;
for (j = 0; j < NUM_CSHIFTS; j++) {
a2 = cl.cshifts[j].percent / 255.0;
if (!a2) if (!a2)
continue; continue;
a2 = min (a2, 1.0); a2 = min (a2, 1.0);
r += (cl.cshifts[j].destcolor[0] - r) * a2; r += (cl.cshifts[i].destcolor[0] - r) * a2;
g += (cl.cshifts[j].destcolor[1] - g) * a2; g += (cl.cshifts[i].destcolor[1] - g) * a2;
b += (cl.cshifts[j].destcolor[2] - b) * a2; b += (cl.cshifts[i].destcolor[2] - b) * a2;
a3 = (1.0 - a) * (1.0 - a2); a3 = (1.0 - a) * (1.0 - a2);
a = 1.0 - a3; a = 1.0 - a3;
@ -186,12 +181,12 @@ V_UpdatePalette (void)
// drop the damage value // drop the damage value
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime * 150; 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; cl.cshifts[CSHIFT_DAMAGE].percent = 0;
// drop the bonus value // drop the bonus value
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime * 100; 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; cl.cshifts[CSHIFT_BONUS].percent = 0;
force = V_CheckGamma (); force = V_CheckGamma ();

View file

@ -184,15 +184,12 @@ GL_SubdivideSurface (msurface_t *fa)
SubdividePolygon (numverts, verts[0]); SubdividePolygon (numverts, verts[0]);
} }
//=========================================================
// speed up sin calculations - Ed // speed up sin calculations - Ed
float turbsin[] = { float turbsin[] = {
# include "gl_warp_sin.h" # include "gl_warp_sin.h"
}; };
#define TURBSCALE (256.0 / (2 * M_PI)) #define TURBSCALE (256.0 / (2 * M_PI))
/* /*

View file

@ -33,16 +33,17 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "bothdefs.h"
#include "client.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/compat.h" #include "QF/compat.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "host.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "pmove.h"
#include "QF/screen.h" #include "QF/screen.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "bothdefs.h"
#include "client.h"
#include "host.h"
#include "pmove.h"
#include "view.h" #include "view.h"
/* /*
@ -81,11 +82,9 @@ extern int in_forward, in_forward2, in_back;
frame_t *view_frame; frame_t *view_frame;
player_state_t *view_message; player_state_t *view_message;
void BuildGammaTable (float, float); // void BuildGammaTable (float, float);
/*
V_CalcRoll
*/
float float
V_CalcRoll (vec3_t angles, vec3_t velocity) V_CalcRoll (vec3_t angles, vec3_t velocity)
{ {
@ -111,9 +110,6 @@ V_CalcRoll (vec3_t angles, vec3_t velocity)
} }
/*
V_CalcBob
*/
float float
V_CalcBob (void) V_CalcBob (void)
{ {
@ -152,9 +148,6 @@ V_CalcBob (void)
} }
//=============================================================================
cvar_t *v_centermove; cvar_t *v_centermove;
cvar_t *v_centerspeed; cvar_t *v_centerspeed;
@ -175,6 +168,7 @@ V_StartPitchDrift (void)
} }
} }
void void
V_StopPitchDrift (void) V_StopPitchDrift (void)
{ {
@ -183,6 +177,7 @@ V_StopPitchDrift (void)
cl.pitchvel = 0; cl.pitchvel = 0;
} }
/* /*
V_DriftPitch V_DriftPitch
@ -205,7 +200,8 @@ V_DriftPitch (void)
cl.pitchvel = 0; cl.pitchvel = 0;
return; return;
} }
// don't count small mouse motion
// don't count small mouse motion
if (cl.nodrift) { if (cl.nodrift) {
if (fabs if (fabs
(cl.frames[(cls.netchan.outgoing_sequence - 1) & UPDATE_MASK].cmd. (cl.frames[(cls.netchan.outgoing_sequence - 1) & UPDATE_MASK].cmd.
@ -230,7 +226,7 @@ V_DriftPitch (void)
move = host_frametime * cl.pitchvel; move = host_frametime * cl.pitchvel;
cl.pitchvel += host_frametime * v_centerspeed->value; 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 (delta > 0) {
if (move > delta) { if (move > delta) {
@ -247,6 +243,7 @@ V_DriftPitch (void)
} }
} }
/* /*
PALETTE FLASHES PALETTE FLASHES
*/ */
@ -254,7 +251,6 @@ V_DriftPitch (void)
extern cvar_t *cl_cshift_bonus; extern cvar_t *cl_cshift_bonus;
extern cvar_t *cl_cshift_contents; extern cvar_t *cl_cshift_contents;
extern cvar_t *cl_cshift_damage; extern cvar_t *cl_cshift_damage;
// extern cvar_t *cl_cshift_powerup;
cshift_t cshift_empty = { {130, 80, 50}, 0 }; cshift_t cshift_empty = { {130, 80, 50}, 0 };
cshift_t cshift_water = { {130, 80, 50}, 128 }; cshift_t cshift_water = { {130, 80, 50}, 128 };
@ -264,9 +260,7 @@ cshift_t cshift_lava = { {255, 80, 0}, 150 };
extern byte gammatable[256]; // palette is sent through this extern byte gammatable[256]; // palette is sent through this
extern cvar_t *vid_gamma; extern cvar_t *vid_gamma;
/*
V_CheckGamma
*/
qboolean qboolean
V_CheckGamma (void) V_CheckGamma (void)
{ {
@ -284,9 +278,7 @@ V_CheckGamma (void)
return true; return true;
} }
/*
V_ParseDamage
*/
void void
V_ParseDamage (void) V_ParseDamage (void)
{ {
@ -329,10 +321,9 @@ V_ParseDamage (void)
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0; cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
} }
} }
// // calculate view angle kicks
// calculate view angle kicks
//
VectorSubtract (from, cl.simorg, from); VectorSubtract (from, cl.simorg, from);
VectorNormalize (from); VectorNormalize (from);
@ -348,9 +339,6 @@ V_ParseDamage (void)
} }
/*
V_cshift_f
*/
void void
V_cshift_f (void) V_cshift_f (void)
{ {
@ -379,12 +367,12 @@ V_BonusFlash_f (void)
cl.cshifts[CSHIFT_BONUS].percent = 50; cl.cshifts[CSHIFT_BONUS].percent = 50;
} }
/* /*
V_SetContentsColor V_SetContentsColor
Underwater, lava, etc each has a color shift Underwater, lava, etc each has a color shift
*/ */
void void
V_SetContentsColor (int contents) V_SetContentsColor (int contents)
{ {
@ -416,6 +404,7 @@ V_SetContentsColor (int contents)
VIEW RENDERING VIEW RENDERING
*/ */
float float
angledelta (float a) angledelta (float a)
{ {
@ -425,9 +414,7 @@ angledelta (float a)
return a; return a;
} }
/*
CalcGunAngle
*/
void void
CalcGunAngle (void) CalcGunAngle (void)
{ {
@ -467,9 +454,7 @@ CalcGunAngle (void)
cl.viewent.angles[PITCH] = -(r_refdef.viewangles[PITCH] + pitch); cl.viewent.angles[PITCH] = -(r_refdef.viewangles[PITCH] + pitch);
} }
/*
V_BoundOffsets
*/
void void
V_BoundOffsets (void) V_BoundOffsets (void)
{ {
@ -490,6 +475,7 @@ V_BoundOffsets (void)
r_refdef.vieworg[2] = cl.simorg[2] + 30; r_refdef.vieworg[2] = cl.simorg[2] + 30;
} }
/* /*
V_AddIdle V_AddIdle
@ -544,32 +530,27 @@ V_CalcViewRoll (void)
} }
/*
V_CalcIntermissionRefdef
*/
void void
V_CalcIntermissionRefdef (void) V_CalcIntermissionRefdef (void)
{ {
entity_t *view; entity_t *view;
float old; float old;
// view is the weapon model // view is the weapon model
view = &cl.viewent; view = &cl.viewent;
VectorCopy (cl.simorg, r_refdef.vieworg); VectorCopy (cl.simorg, r_refdef.vieworg);
VectorCopy (cl.simangles, r_refdef.viewangles); VectorCopy (cl.simangles, r_refdef.viewangles);
view->model = NULL; view->model = NULL;
// always idle in intermission // always idle in intermission
old = v_idlescale->value; old = v_idlescale->value;
Cvar_SetValue (v_idlescale, 1); Cvar_SetValue (v_idlescale, 1);
V_AddIdle (); V_AddIdle ();
Cvar_SetValue (v_idlescale, old); Cvar_SetValue (v_idlescale, old);
} }
/*
V_CalcRefdef
*/
void void
V_CalcRefdef (void) V_CalcRefdef (void)
{ {
@ -585,12 +566,12 @@ V_CalcRefdef (void)
V_DriftPitch (); V_DriftPitch ();
// view is the weapon model (only visible from inside body) // view is the weapon model (only visible from inside body)
view = &cl.viewent; view = &cl.viewent;
bob = V_CalcBob (); bob = V_CalcBob ();
// refresh position from simulated origin // refresh position from simulated origin
VectorCopy (cl.simorg, r_refdef.vieworg); VectorCopy (cl.simorg, r_refdef.vieworg);
r_refdef.vieworg[2] += bob; r_refdef.vieworg[2] += bob;
@ -616,11 +597,10 @@ V_CalcRefdef (void)
if (view_message->flags & PF_DEAD) // PF_GIB will also set PF_DEAD if (view_message->flags & PF_DEAD) // PF_GIB will also set PF_DEAD
r_refdef.viewangles[ROLL] = 80; // dead view angle r_refdef.viewangles[ROLL] = 80; // dead view angle
// offsets
// offsets
AngleVectors (cl.simangles, forward, right, up); AngleVectors (cl.simangles, forward, right, up);
// set up gun position // set up gun position
VectorCopy (cl.simangles, view->angles); VectorCopy (cl.simangles, view->angles);
CalcGunAngle (); CalcGunAngle ();
@ -658,10 +638,10 @@ V_CalcRefdef (void)
view->alpha = 1; view->alpha = 1;
view->colormod[0] = view->colormod[1] = view->colormod[2] = 1; view->colormod[0] = view->colormod[1] = view->colormod[2] = 1;
// set up the refresh position // set up the refresh position
r_refdef.viewangles[PITCH] += cl.punchangle; r_refdef.viewangles[PITCH] += cl.punchangle;
// smooth out stair step ups // smooth out stair step ups
if ((cl.onground != -1) && (cl.simorg[2] - oldz > 0)) { if ((cl.onground != -1) && (cl.simorg[2] - oldz > 0)) {
float steptime; float steptime;
@ -678,9 +658,7 @@ V_CalcRefdef (void)
oldz = cl.simorg[2]; oldz = cl.simorg[2];
} }
/*
DropPunchAngle
*/
void void
DropPunchAngle (void) DropPunchAngle (void)
{ {
@ -689,20 +667,19 @@ DropPunchAngle (void)
cl.punchangle = 0; cl.punchangle = 0;
} }
/* /*
V_RenderView V_RenderView
The player's clipping box goes from (-16 -16 -24) to (16 16 32) from 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 the entity origin, so any view position inside that will be valid
*/ */
extern vrect_t scr_vrect;
void void
V_RenderView (void) V_RenderView (void)
{ {
// if (cl.simangles[ROLL]) // if (cl.simangles[ROLL])
// Sys_Error ("cl.simangles[ROLL]"); // DEBUG // Sys_Error ("cl.simangles[ROLL]"); // DEBUG
cl.simangles[ROLL] = 0; // FIXME @@@ cl.simangles[ROLL] = 0; // FIXME @@@
if (cls.state != ca_active) if (cls.state != ca_active)
return; return;
@ -720,11 +697,7 @@ V_RenderView (void)
R_RenderView (); R_RenderView ();
} }
//============================================================================
/*
V_Init
*/
void void
V_Init (void) V_Init (void)
{ {
@ -736,6 +709,7 @@ V_Init (void)
"Will not work while mlook is active or freelook is 1."); "Will not work while mlook is active or freelook is 1.");
} }
void void
V_Init_Cvars (void) V_Init_Cvars (void)
{ {

View file

@ -44,9 +44,6 @@ extern byte gammatable[256];
qboolean V_CheckGamma (void); qboolean V_CheckGamma (void);
/*
V_CalcPowerupCshift
*/
void void
V_CalcPowerupCshift (void) V_CalcPowerupCshift (void)
{ {
@ -85,10 +82,6 @@ V_CalcPowerupCshift (void)
} }
/*
V_UpdatePalette
*/
void void
V_UpdatePalette (void) V_UpdatePalette (void)
{ {