2000-01-22 12:54:51 +00:00
|
|
|
/*
|
2000-03-24 14:43:43 +00:00
|
|
|
sw_view.c
|
2000-01-22 12:54:51 +00:00
|
|
|
|
2000-03-24 14:43:43 +00:00
|
|
|
software renderer player eye positioning
|
2000-01-22 12:54:51 +00:00
|
|
|
|
2000-03-24 14:43:43 +00:00
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
|
|
|
Please see the file "AUTHORS" for a list of contributors
|
2000-01-22 12:54:51 +00:00
|
|
|
|
2000-03-24 14:43:43 +00:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
2000-01-22 12:54:51 +00:00
|
|
|
|
2000-03-24 14:43:43 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2000-01-22 12:54:51 +00:00
|
|
|
|
2000-03-24 14:43:43 +00:00
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
2000-01-22 12:54:51 +00:00
|
|
|
*/
|
|
|
|
|
2000-03-24 14:43:43 +00:00
|
|
|
#include <quakedef.h>
|
|
|
|
#include <r_local.h>
|
2000-01-27 17:06:02 +00:00
|
|
|
#include <view.h>
|
|
|
|
#include <mathlib.h>
|
2000-01-22 12:54:51 +00:00
|
|
|
|
|
|
|
extern int onground;
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
V_UpdatePalette
|
|
|
|
=============
|
|
|
|
*/
|
|
|
|
void V_UpdatePalette (void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
qboolean new;
|
|
|
|
byte *basepal, *newpal;
|
|
|
|
byte pal[768];
|
|
|
|
int r,g,b;
|
|
|
|
qboolean force;
|
|
|
|
|
|
|
|
V_CalcPowerupCshift ();
|
2000-03-19 15:59:51 +00:00
|
|
|
|
2000-01-22 12:54:51 +00:00
|
|
|
new = false;
|
2000-03-19 15:59:51 +00:00
|
|
|
|
2000-01-22 12:54:51 +00:00
|
|
|
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];
|
|
|
|
}
|
|
|
|
}
|
2000-03-19 15:59:51 +00:00
|
|
|
|
2000-01-22 12:54:51 +00:00
|
|
|
// 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;
|
|
|
|
|
|
|
|
force = V_CheckGamma ();
|
|
|
|
if (!new && !force)
|
|
|
|
return;
|
2000-03-19 15:59:51 +00:00
|
|
|
|
2000-01-22 12:54:51 +00:00
|
|
|
basepal = host_basepal;
|
|
|
|
newpal = pal;
|
2000-03-19 15:59:51 +00:00
|
|
|
|
2000-01-22 12:54:51 +00:00
|
|
|
for (i=0 ; i<256 ; i++)
|
|
|
|
{
|
|
|
|
r = basepal[0];
|
|
|
|
g = basepal[1];
|
|
|
|
b = basepal[2];
|
|
|
|
basepal += 3;
|
2000-03-19 15:59:51 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<NUM_CSHIFTS ; j++)
|
2000-01-22 12:54:51 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2000-03-19 15:59:51 +00:00
|
|
|
|
2000-01-22 12:54:51 +00:00
|
|
|
newpal[0] = gammatable[r];
|
|
|
|
newpal[1] = gammatable[g];
|
|
|
|
newpal[2] = gammatable[b];
|
|
|
|
newpal += 3;
|
|
|
|
}
|
|
|
|
|
2000-03-19 15:59:51 +00:00
|
|
|
VID_ShiftPalette (pal);
|
2000-01-22 12:54:51 +00:00
|
|
|
}
|
|
|
|
|