mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-05-30 16:50:48 +00:00
gl_screen.c: Minor tweaks, contrast gets clamped to 0.1-1 instead of 0.2-1
view.h: Add brightness, contrast cvars as extern menu.c: Change brightness scroller to use the brightness cvar, add contrast scroller. r_view, sw_view.c: Add brightness/contrast cvars to software, and make them work.
This commit is contained in:
parent
3396ca6fde
commit
a3e19d5cc2
5 changed files with 163 additions and 179 deletions
106
source/sw_view.c
106
source/sw_view.c
|
@ -31,8 +31,10 @@
|
|||
#endif
|
||||
#include "quakedef.h"
|
||||
#include "r_local.h"
|
||||
#include "sys.h"
|
||||
|
||||
extern byte gammatable[256];
|
||||
extern byte gammatable[256];
|
||||
extern cvar_t *contrast;
|
||||
|
||||
void V_CalcPowerupCshift (void);
|
||||
qboolean V_CheckGamma (void);
|
||||
|
@ -44,67 +46,63 @@ V_UpdatePalette
|
|||
*/
|
||||
void V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
qboolean new;
|
||||
byte *basepal, *newpal;
|
||||
byte pal[768];
|
||||
int r,g,b;
|
||||
qboolean force;
|
||||
int i, j;
|
||||
qboolean new;
|
||||
byte *basepal, *newpal;
|
||||
byte pal[768];
|
||||
int r,g,b;
|
||||
qboolean force;
|
||||
|
||||
V_CalcPowerupCshift ();
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
new = false;
|
||||
new = false;
|
||||
|
||||
for (i=0 ; i<NUM_CSHIFTS ; i++)
|
||||
{
|
||||
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent)
|
||||
{
|
||||
new = true;
|
||||
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
|
||||
}
|
||||
for (j=0 ; j<3 ; j++)
|
||||
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
|
||||
{
|
||||
new = true;
|
||||
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
|
||||
}
|
||||
}
|
||||
for (i=0; i < NUM_CSHIFTS; i++) {
|
||||
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent) {
|
||||
new = true;
|
||||
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
|
||||
}
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j]) {
|
||||
new = true;
|
||||
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// drop the damage value
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime*150;
|
||||
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;
|
||||
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
|
||||
cl.cshifts[CSHIFT_BONUS].percent = 0;
|
||||
// drop the damage value
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime*150;
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
|
||||
|
||||
force = V_CheckGamma ();
|
||||
if (!new && !force)
|
||||
return;
|
||||
// drop the bonus value
|
||||
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime*100;
|
||||
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
|
||||
cl.cshifts[CSHIFT_BONUS].percent = 0;
|
||||
|
||||
basepal = host_basepal;
|
||||
newpal = pal;
|
||||
force = V_CheckGamma ();
|
||||
if (!new && !force)
|
||||
return;
|
||||
|
||||
for (i=0 ; i<256 ; i++)
|
||||
{
|
||||
r = basepal[0];
|
||||
g = basepal[1];
|
||||
b = basepal[2];
|
||||
basepal += 3;
|
||||
basepal = host_basepal;
|
||||
newpal = pal;
|
||||
|
||||
for (j=0 ; j<NUM_CSHIFTS ; j++)
|
||||
{
|
||||
r += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[0]-r))>>8;
|
||||
g += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[1]-g))>>8;
|
||||
b += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[2]-b))>>8;
|
||||
}
|
||||
for (i=0 ; i<256 ; i++) {
|
||||
r = basepal[0];
|
||||
g = basepal[1];
|
||||
b = basepal[2];
|
||||
basepal += 3;
|
||||
|
||||
newpal[0] = gammatable[r];
|
||||
newpal[1] = gammatable[g];
|
||||
newpal[2] = gammatable[b];
|
||||
newpal += 3;
|
||||
}
|
||||
for (j=0 ; j<NUM_CSHIFTS ; j++) {
|
||||
r += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[0]-r))>>8;
|
||||
g += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[1]-g))>>8;
|
||||
b += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[2]-b))>>8;
|
||||
}
|
||||
|
||||
VID_ShiftPalette (pal);
|
||||
newpal[0] = gammatable[r];
|
||||
newpal[1] = gammatable[g];
|
||||
newpal[2] = gammatable[b];
|
||||
newpal += 3;
|
||||
}
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue