/* view.c @description@ Copyright (C) 1996-1997 Id Software, Inc. 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. 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. 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$ */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "view.h" #include "vid.h" #include "console.h" #include "host.h" #include "client.h" #include "draw.h" /* 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 (); new = false; for (i=0 ; i>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; } newpal[0] = gammatable[r]; newpal[1] = gammatable[g]; newpal[2] = gammatable[b]; newpal += 3; } 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 (con_forcedup) 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); if (lcd_x->value) { // // render two interleaved views // int i; vid.rowbytes <<= 1; vid.aspect *= 0.5; r_refdef.viewangles[YAW] -= lcd_yaw->value; for (i=0 ; i<3 ; i++) r_refdef.vieworg[i] -= right[i]*lcd_x->value; R_RenderView (); vid.buffer += vid.rowbytes>>1; R_PushDlights (vec3_origin); r_refdef.viewangles[YAW] += lcd_yaw->value*2; for (i=0 ; i<3 ; i++) r_refdef.vieworg[i] += 2*right[i]*lcd_x->value; R_RenderView (); vid.buffer -= vid.rowbytes>>1; r_refdef.vrect.height <<= 1; vid.rowbytes >>= 1; vid.aspect *= 2; } else { R_RenderView (); } if (crosshair->value) Draw_Character8 (scr_vrect.x + scr_vrect.width/2 + cl_crossx->value, scr_vrect.y + scr_vrect.height/2 + cl_crossy->value, '+'); }