mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-21 19:51:18 +00:00
Overhaul of parts of the polyblend system. Contrast in GL no longer uses
another alpha blend, it's set up exactly as another factor in determining the final blend. This should help speed up framerates a little. New cvars: cl_cshift_bonus: Set to 0 to disable bonus flashes. cl_cshift_contents: Set to 0 to disable content blends. cl_cshift_damage: Set to 0 to disable damage blends. cl_cshift_powerup: Set to 0 to disable powerup (quad, pent, etc) blends. All of these cvars work for both GL and software, and all of them check the value of the "cshifts" serverinfo. cshifts is a bit field, with the following bits defined: bonus: 1 contents: 2 damage: 4 powerup: 8 An admin can force any of these to be respected by choosing the numbers of the cshifts to be enforced, and adding them up. examples: serverinfo cshifts 15 turns them all on. serverinfo cshifts 10 turns on powerup and contents shifts. also, the gl_cshiftpercent Cvar no longer does anything. I'll remove it entirely soon.
This commit is contained in:
parent
bf066ac5e6
commit
de55871d32
5 changed files with 84 additions and 56 deletions
|
@ -27,8 +27,8 @@
|
|||
*/
|
||||
// view.h
|
||||
|
||||
#ifndef _VIEW_H
|
||||
#define _VIEW_H
|
||||
#ifndef __view_h_
|
||||
#define __view_h_
|
||||
|
||||
#include "mathlib.h"
|
||||
#include "cvar.h"
|
||||
|
@ -36,6 +36,11 @@
|
|||
extern cvar_t *brightness;
|
||||
extern cvar_t *contrast;
|
||||
|
||||
#define INFO_CSHIFT_BONUS (1 << 0)
|
||||
#define INFO_CSHIFT_CONTENTS (1 << 1)
|
||||
#define INFO_CSHIFT_DAMAGE (1 << 2)
|
||||
#define INFO_CSHIFT_POWERUP (1 << 3)
|
||||
|
||||
void V_Init (void);
|
||||
void V_Init_Cvars (void);
|
||||
void V_RenderView (void);
|
||||
|
@ -51,4 +56,4 @@ void V_ParseDamage (void);
|
|||
void V_SetContentsColor (int contents);
|
||||
void V_CalcBlend (void);
|
||||
|
||||
#endif // _VIEW_H
|
||||
#endif // __view_h_
|
||||
|
|
|
@ -115,6 +115,11 @@ cvar_t *cl_sbar_separator;
|
|||
cvar_t *cl_hudswap;
|
||||
cvar_t *cl_maxfps;
|
||||
|
||||
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 *lookstrafe;
|
||||
cvar_t *sensitivity;
|
||||
|
@ -1257,6 +1262,16 @@ CL_Init_Cvars (void)
|
|||
developer = Cvar_Get ("developer", "0", CVAR_NONE,
|
||||
"show info interesting to developers");
|
||||
|
||||
// Misty: Turn on or off screen filling colors for powerups among other things.
|
||||
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE,
|
||||
"Show bonus flash on item pickup");
|
||||
cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE,
|
||||
"Shift view colors for contents (water, slime, etc)");
|
||||
cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE,
|
||||
"Shift view colors on damage");
|
||||
cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE,
|
||||
"Shift view colors for powerups");
|
||||
|
||||
cl_autoexec = Cvar_Get ("cl_autoexec", "0", CVAR_ROM,
|
||||
"exec autoexec.cfg on gamedir change");
|
||||
cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE,
|
||||
|
|
|
@ -904,7 +904,7 @@ int oldviewsize = 0;
|
|||
extern void R_ForceLightUpdate ();
|
||||
qboolean lighthalf;
|
||||
unsigned char lighthalf_v[3];
|
||||
extern cvar_t *gl_lightmode, *brightness, *contrast;
|
||||
extern cvar_t *gl_lightmode, *brightness;
|
||||
|
||||
/*
|
||||
SCR_UpdateScreen
|
||||
|
@ -1041,24 +1041,16 @@ SCR_UpdateScreen (void)
|
|||
glColor3ubv (lighthalf_v);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
Cvar_SetValue (contrast, bound (0.0, contrast->value, 1.0));
|
||||
if (v_blend[3] || (contrast->value < 0.999)) { // precision
|
||||
glBegin (GL_QUADS);
|
||||
if (contrast->value < 0.999) { // precision
|
||||
glColor4f (0.5, 0.5, 0.5, (1 - contrast->value));
|
||||
glVertex2f (0, 0);
|
||||
glVertex2f (vid.width, 0);
|
||||
glVertex2f (vid.width, vid.height);
|
||||
glVertex2f (0, vid.height);
|
||||
}
|
||||
|
||||
if (v_blend[3]) {
|
||||
glBegin (GL_QUADS);
|
||||
|
||||
glColor4fv (v_blend);
|
||||
glVertex2f (0, 0);
|
||||
glVertex2f (vid.width, 0);
|
||||
glVertex2f (vid.width, vid.height);
|
||||
glVertex2f (0, vid.height);
|
||||
}
|
||||
|
||||
glEnd ();
|
||||
glColor3ubv (lighthalf_v);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ extern double host_frametime;
|
|||
extern int onground;
|
||||
extern byte gammatable[256];
|
||||
|
||||
extern cvar_t *gl_cshiftpercent;
|
||||
extern cvar_t *contrast;
|
||||
|
||||
byte ramps[3][256];
|
||||
float v_blend[4];
|
||||
|
@ -86,11 +86,7 @@ V_CalcBlend (void)
|
|||
a = 0;
|
||||
|
||||
for (j = 0; j < NUM_CSHIFTS; j++) {
|
||||
if (!gl_cshiftpercent->value)
|
||||
continue;
|
||||
|
||||
a2 =
|
||||
((cl.cshifts[j].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
|
||||
a2 = cl.cshifts[j].percent / 255.0;
|
||||
|
||||
if (!a2)
|
||||
continue;
|
||||
|
@ -104,14 +100,21 @@ V_CalcBlend (void)
|
|||
a = 1.0 - a3;
|
||||
}
|
||||
|
||||
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;
|
||||
if (a > 1) // clamp alpha blend too
|
||||
a = 1;
|
||||
}
|
||||
|
||||
v_blend[0] = min (r, 255.0) / 255.0;
|
||||
|
|
|
@ -71,8 +71,6 @@ cvar_t *v_ipitch_level;
|
|||
|
||||
cvar_t *v_idlescale;
|
||||
|
||||
cvar_t *v_contentblend;
|
||||
|
||||
float v_dmg_time, v_dmg_roll, v_dmg_pitch;
|
||||
|
||||
extern int in_forward, in_forward2, in_back;
|
||||
|
@ -263,6 +261,11 @@ V_DriftPitch (void)
|
|||
|
||||
cvar_t *gl_cshiftpercent;
|
||||
|
||||
extern cvar_t *cl_cshift_bonus;
|
||||
extern cvar_t *cl_cshift_contents;
|
||||
extern cvar_t *cl_cshift_damage;
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
|
||||
cshift_t cshift_empty = { {130, 80, 50}, 0 };
|
||||
cshift_t cshift_water = { {130, 80, 50}, 128 };
|
||||
cshift_t cshift_slime = { {0, 25, 5}, 150 };
|
||||
|
@ -295,8 +298,6 @@ V_CheckGamma (void)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
V_ParseDamage
|
||||
|
@ -305,6 +306,7 @@ V_ParseDamage
|
|||
void
|
||||
V_ParseDamage (void)
|
||||
{
|
||||
|
||||
int armor, blood;
|
||||
vec3_t from;
|
||||
int i;
|
||||
|
@ -323,11 +325,11 @@ V_ParseDamage (void)
|
|||
|
||||
cl.faceanimtime = cl.time + 0.2; // but sbar face into pain frame
|
||||
|
||||
if (cl_cshift_damage->int_val
|
||||
|| (atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) & INFO_CSHIFT_DAMAGE)) {
|
||||
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent += 3 * count;
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = 150;
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = bound (0, cl.cshifts[CSHIFT_DAMAGE].percent, 150);
|
||||
|
||||
if (armor > blood) {
|
||||
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 200;
|
||||
|
@ -342,6 +344,7 @@ V_ParseDamage (void)
|
|||
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// calculate view angle kicks
|
||||
|
@ -386,6 +389,10 @@ When you run over an item, the server sends this command
|
|||
void
|
||||
V_BonusFlash_f (void)
|
||||
{
|
||||
if (!cl_cshift_bonus->int_val
|
||||
&& !(atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) & INFO_CSHIFT_BONUS))
|
||||
return;
|
||||
|
||||
cl.cshifts[CSHIFT_BONUS].destcolor[0] = 215;
|
||||
cl.cshifts[CSHIFT_BONUS].destcolor[1] = 186;
|
||||
cl.cshifts[CSHIFT_BONUS].destcolor[2] = 69;
|
||||
|
@ -399,10 +406,13 @@ V_SetContentsColor
|
|||
Underwater, lava, etc each has a color shift
|
||||
=============
|
||||
*/
|
||||
|
||||
void
|
||||
V_SetContentsColor (int contents)
|
||||
{
|
||||
if (!v_contentblend->int_val) {
|
||||
|
||||
if (!cl_cshift_contents->int_val
|
||||
&& !(atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) & INFO_CSHIFT_CONTENTS)) {
|
||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
||||
return;
|
||||
}
|
||||
|
@ -428,9 +438,14 @@ V_SetContentsColor (int contents)
|
|||
V_CalcPowerupCshift
|
||||
=============
|
||||
*/
|
||||
|
||||
void
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
if (!cl_cshift_powerup->int_val
|
||||
|| (atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) & INFO_CSHIFT_POWERUP))
|
||||
return;
|
||||
|
||||
if (cl.stats[STAT_ITEMS] & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
||||
|
@ -815,8 +830,6 @@ V_Init_Cvars (void)
|
|||
v_iroll_level = Cvar_Get ("v_iroll_level", "0.1", CVAR_NONE, "None");
|
||||
v_ipitch_level = Cvar_Get ("v_ipitch_level", "0.3", CVAR_NONE, "None");
|
||||
|
||||
v_contentblend = Cvar_Get ("v_contentblend", "1", CVAR_NONE, "None");
|
||||
|
||||
v_idlescale = Cvar_Get ("v_idlescale", "0", CVAR_NONE, "None");
|
||||
|
||||
cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, "None");
|
||||
|
|
Loading…
Reference in a new issue