mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
Kill off gl_view.c and sw_view.c. Renderer merge is more or less complete now. Software and gl renderers now calculate color shifts the same way, and sw looks a bit different now. Powerups don't shift enough in sw right now, IMO.
This commit is contained in:
parent
ac9dace768
commit
b868a09661
15 changed files with 275 additions and 651 deletions
|
@ -56,7 +56,8 @@ typedef struct {
|
|||
unsigned int height;
|
||||
float aspect; // width / height -- < 0 is taller than wide
|
||||
int numpages;
|
||||
int recalc_refdef; // if true, recalc vid-based stuff
|
||||
qboolean recalc_refdef; // if true, recalc vid-based stuff
|
||||
qboolean cshift_changed;
|
||||
pixel_t *conbuffer;
|
||||
int conrowbytes;
|
||||
unsigned int conwidth;
|
||||
|
|
|
@ -887,7 +887,7 @@ R_SetupFrame (void)
|
|||
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
|
||||
|
||||
V_SetContentsColor (r_viewleaf->contents);
|
||||
V_CalcBlend ();
|
||||
// V_CalcBlend ();
|
||||
|
||||
r_cache_thrash = false;
|
||||
|
||||
|
|
|
@ -909,8 +909,6 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
|||
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
|
||||
V_UpdatePalette ();
|
||||
|
||||
if (r_speeds->int_val) {
|
||||
// qfglFinish ();
|
||||
time2 = Sys_DoubleTime ();
|
||||
|
|
|
@ -354,6 +354,36 @@ SCR_CalcRefdef (void)
|
|||
}
|
||||
|
||||
|
||||
extern float v_blend[4];
|
||||
|
||||
void
|
||||
SCR_ApplyBlend (void) // Used to be V_UpdatePalette
|
||||
{
|
||||
int r, g, b, i;
|
||||
byte *basepal, *newpal;
|
||||
byte pal[768];
|
||||
basepal = vid_basepal;
|
||||
newpal = pal;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
r = basepal[0];
|
||||
g = basepal[1];
|
||||
b = basepal[2];
|
||||
basepal += 3;
|
||||
|
||||
r += ((int) (v_blend[3] * (v_blend[0] - r))) >> 8;
|
||||
g += ((int) (v_blend[3] * (v_blend[1] - g))) >> 8;
|
||||
b += ((int) (v_blend[3] * (v_blend[2] - b))) >> 8;
|
||||
|
||||
newpal[0] = gammatable[r];
|
||||
newpal[1] = gammatable[g];
|
||||
newpal[2] = gammatable[b];
|
||||
newpal += 3;
|
||||
}
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SCR_SizeUp_f
|
||||
|
||||
|
@ -911,7 +941,7 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
|||
D_UpdateRects (pconupdate);
|
||||
}
|
||||
|
||||
V_UpdatePalette ();
|
||||
SCR_ApplyBlend ();
|
||||
|
||||
//
|
||||
// update one of three areas
|
||||
|
|
|
@ -65,6 +65,12 @@ libQFsdl_la_SOURCES= $(in_common_SOURCE) in_sdl.c vid.c vid_common_sw.c vid_sdl.
|
|||
libQFsdl.la: $(libQFsdl_la_OBJECTS) $(libQFsdl_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libQFsdl_la_LDFLAGS) $(libQFsdl_la_OBJECTS) $(libQFsdl_la_LIBADD) $(LIBS)
|
||||
|
||||
# FIXME: waiting on *view.c merge --DESPAIR
|
||||
#libQFsdl32_la_LDFLAGS= -version-info 1:0:0
|
||||
#libQFsdl32_la_SOURCES= in_common.c in_sdl.c vid.c vid_common_sw.c vid_sdl32.c
|
||||
#libQFsdl32.la: $(libQFsdl32_la_OBJECTS) $(libQFsdl32_la_DEPENDENCIES)
|
||||
# $(LINK) -rpath $(libdir) $(libQFsdl32_la_LDFLAGS) $(libQFsdl32_la_OBJECTS) $(libQFsdl32_la_LIBADD) $(LIBS)
|
||||
|
||||
|
||||
libQFsgl_la_LDFLAGS= -version-info 1:0:0
|
||||
libQFsgl_la_SOURCES= $(in_common_SOURCE) in_sdl.c qfgl_ext.c vid.c vid_common_gl.c vid_sgl.c
|
||||
|
|
|
@ -77,9 +77,8 @@ client_LIBS= -L. libqfnet.la $(ASM) $(qf_client_LIBS) $(NET_LIBS)
|
|||
client_LIB_DEPS= libqfnet.la $(ASM) $(qf_client_LIBS)
|
||||
|
||||
client_SOURCES= cl_cam.c cl_cmd.c cl_demo.c cl_input.c cl_main.c cl_screen.c \
|
||||
cl_parse.c cl_tent.c \
|
||||
console.c keys.c sbar.c \
|
||||
r_view.c locs.c
|
||||
cl_parse.c cl_tent.c cl_view.c \
|
||||
console.c keys.c locs.c sbar.c
|
||||
|
||||
server_SOURCES= host.c host_cmd.c pr_cmds.c sv_cvar.c sv_main.c \
|
||||
sv_move.c sv_phys.c sv_progs.c sv_user.c
|
||||
|
@ -88,65 +87,60 @@ combined_SOURCES= $(common_SOURCES) $(client_SOURCES) $(server_SOURCES) \
|
|||
$(qfsys_SRC)
|
||||
|
||||
# Software-rendering targets
|
||||
#
|
||||
# ... Common stuff
|
||||
soft_SOURCES= sw_view.c
|
||||
|
||||
# ... Linux FBDev
|
||||
nq_fbdev_SOURCES= $(combined_SOURCES) $(soft_SOURCES)
|
||||
nq_fbdev_SOURCES= $(combined_SOURCES)
|
||||
nq_fbdev_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFfbdev.la $(client_LIBS)
|
||||
nq_fbdev_LDFLAGS= $(common_ldflags)
|
||||
nq_fbdev_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFfbdev.la $(client_LIB_DEPS)
|
||||
|
||||
# ... SciTech MGL
|
||||
nq_mgl_SOURCES= $(combined_SOURCES) $(soft_SOURCES)
|
||||
nq_mgl_SOURCES= $(combined_SOURCES)
|
||||
nq_mgl_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFmgl.la $(client_LIBS) $(MGL_LIBS)
|
||||
nq_mgl_LDFLAGS= $(common_ldflags)
|
||||
nq_mgl_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFmgl.la $(client_LIB_DEPS)
|
||||
|
||||
# ... Sam Lantinga's Simple DirectMedia Layer, version 1.0 and higher
|
||||
nq_sdl_SOURCES= $(combined_SOURCES) $(soft_SOURCES)
|
||||
nq_sdl_SOURCES= $(combined_SOURCES)
|
||||
nq_sdl_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFsdl.la $(client_LIBS) $(SDL_LIBS)
|
||||
nq_sgl_LDFLAGS= $(common_ldflags)
|
||||
nq_sdl_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFsdl.la $(client_LIB_DEPS)
|
||||
|
||||
# ... Linux SVGAlib
|
||||
nq_svga_SOURCES= $(combined_SOURCES) $(soft_SOURCES)
|
||||
nq_svga_SOURCES= $(combined_SOURCES)
|
||||
nq_svga_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFsvga.la $(client_LIBS) $(SVGA_LIBS)
|
||||
nq_svga_LDFLAGS= $(common_ldflags)
|
||||
nq_svga_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFsvga.la $(client_LIB_DEPS)
|
||||
|
||||
# ... X11
|
||||
nq_x11_SOURCES= $(combined_SOURCES) $(soft_SOURCES)
|
||||
nq_x11_SOURCES= $(combined_SOURCES)
|
||||
nq_x11_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFx11.la $(client_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) $(X_SHM_LIB)
|
||||
nq_x11_LDFLAGS= $(common_ldflags)
|
||||
nq_x11_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFx11.la $(client_LIB_DEPS)
|
||||
|
||||
|
||||
# OpenGL-using targets
|
||||
# ... Common stuff
|
||||
ogl_SOURCES= gl_view.c
|
||||
|
||||
# ... 3Dfx Voodoo 1 and 2 SVGAlib-based console GL
|
||||
nq_3dfx_SOURCES= $(combined_SOURCES) $(ogl_SOURCES)
|
||||
nq_3dfx_SOURCES= $(combined_SOURCES)
|
||||
nq_3dfx_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFtdfx.la $(client_LIBS) $(GLIDE_LIBS) $(SVGA_LIBS) $(DL_LIBS)
|
||||
nq_3dfx_LDFLAGS= $(common_ldflags)
|
||||
nq_3dfx_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFtdfx.la $(client_LIB_DEPS)
|
||||
|
||||
# ... OpenGL in X Window
|
||||
nq_glx_SOURCES= $(combined_SOURCES) $(ogl_SOURCES)
|
||||
nq_glx_SOURCES= $(combined_SOURCES)
|
||||
nq_glx_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) $(DL_LIBS)
|
||||
nq_glx_LDFLAGS= $(common_ldflags)
|
||||
nq_glx_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIB_DEPS)
|
||||
|
||||
# ... Simple Directmedia Layer, version 1.1 and higher, in GL mode
|
||||
nq_sgl_SOURCES= $(combined_SOURCES) $(ogl_SOURCES)
|
||||
nq_sgl_SOURCES= $(combined_SOURCES)
|
||||
nq_sgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIBS) $(X_LIBS) $(SDL_LIBS) $(DL_LIBS)
|
||||
nq_sgl_LDFLAGS= $(common_ldflags)
|
||||
nq_sgl_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIB_DEPS)
|
||||
|
||||
# ... SGI/Microsoft WGL (Windows OpenGL)
|
||||
nq_wgl_SOURCES= $(combined_SOURCES) $(ogl_SOURCES) conproc.c
|
||||
nq_wgl_SOURCES= $(combined_SOURCES) conproc.c
|
||||
nq_wgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIBS) -lgdi32 -lcomctl32 -lwinmm
|
||||
nq_wgl_LDFLAGS= $(common_ldflags)
|
||||
nq_wgl_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIB_DEPS)
|
||||
|
|
|
@ -75,8 +75,11 @@ static SCR_Func scr_funcs[] = {
|
|||
0
|
||||
};
|
||||
|
||||
extern void V_CalcBlend (void);
|
||||
|
||||
void
|
||||
CL_UpdateScreen (double realtime)
|
||||
{
|
||||
V_CalcBlend ();
|
||||
SCR_UpdateScreen (realtime, scr_funcs, cl_hudswap->int_val);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
extern cvar_t *cl_cshift_bonus;
|
||||
extern cvar_t *cl_cshift_contents;
|
||||
extern cvar_t *cl_cshift_damage;
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
|
||||
cvar_t *scr_ofsx;
|
||||
cvar_t *scr_ofsy;
|
||||
|
@ -83,6 +84,7 @@ cvar_t *v_kickroll;
|
|||
cvar_t *v_kickpitch;
|
||||
|
||||
float v_dmg_time, v_dmg_roll, v_dmg_pitch;
|
||||
float v_blend[4];
|
||||
|
||||
extern cvar_t *vid_gamma;
|
||||
|
||||
|
@ -336,31 +338,15 @@ V_SetContentsColor (int contents)
|
|||
|
||||
|
||||
void
|
||||
V_CalcItemCshift (void)
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
if (cl.stats[STAT_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.stats[STAT_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;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_CalcGlowCshift (void)
|
||||
{
|
||||
if (!cl.stats[STAT_ITEMS] & (IT_SUIT || IT_INVISIBILITY || IT_QUAD || IT_INVULNERABILITY))
|
||||
if (!cl.stats[STAT_ITEMS] & (IT_SUIT || IT_INVISIBILITY || IT_QUAD
|
||||
|| IT_INVULNERABILITY))
|
||||
{
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY &&
|
||||
cl.stats[STAT_ITEMS] & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
|
@ -377,11 +363,107 @@ V_CalcGlowCshift (void)
|
|||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.stats[STAT_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.stats[STAT_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 {
|
||||
V_CalcItemCshift ();
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_CalcBlend
|
||||
|
||||
LordHavoc made this a real, true alpha blend. Cleaned it up
|
||||
a bit, but otherwise this is his code. --KB
|
||||
*/
|
||||
void
|
||||
V_CalcBlend (void)
|
||||
{
|
||||
float r = 0, g = 0, b = 0, a = 0;
|
||||
float a2, a3;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
a2 = cl.cshifts[i].percent / 255.0;
|
||||
|
||||
if (!a2)
|
||||
continue;
|
||||
|
||||
a2 = min (a2, 1.0);
|
||||
r += (cl.cshifts[i].destcolor[0] - r) * a2;
|
||||
g += (cl.cshifts[i].destcolor[1] - g) * a2;
|
||||
b += (cl.cshifts[i].destcolor[2] - 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;
|
||||
}
|
||||
|
||||
v_blend[0] = min (r, 255.0) / 255.0;
|
||||
v_blend[1] = min (g, 255.0) / 255.0;
|
||||
v_blend[2] = min (b, 255.0) / 255.0;
|
||||
v_blend[3] = bound (0.0, a, 1.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_PrepBlend (void)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (cl_cshift_powerup->int_val)
|
||||
// || (atoi (Info_ValueForKey (cl.serverinfo, "cshifts"))
|
||||
// & INFO_CSHIFT_POWERUP))
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
vid.cshift_changed = false;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent) {
|
||||
vid.cshift_changed = 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]) {
|
||||
vid.cshift_changed = 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;
|
||||
|
||||
if (!vid.cshift_changed && !vid.recalc_refdef)
|
||||
return;
|
||||
|
||||
V_CalcBlend();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
VIEW RENDERING
|
||||
*/
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
gl_view.c
|
||||
|
||||
player eye positioning
|
||||
|
||||
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
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "compat.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/info.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "view.h"
|
||||
#include "r_cvar.h"
|
||||
|
||||
extern double host_frametime;
|
||||
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
|
||||
byte ramps[3][256];
|
||||
float v_blend[4];
|
||||
|
||||
|
||||
/*
|
||||
V_CalcBlend
|
||||
|
||||
LordHavoc made this a real, true alpha blend. Cleaned it up
|
||||
a bit, but otherwise this is his code. --KB
|
||||
*/
|
||||
void
|
||||
V_CalcBlend (void)
|
||||
{
|
||||
float r = 0, g = 0, b = 0, a = 0;
|
||||
float a2, a3;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
a2 = cl.cshifts[i].percent / 255.0;
|
||||
|
||||
if (!a2)
|
||||
continue;
|
||||
|
||||
a2 = min (a2, 1.0);
|
||||
r += (cl.cshifts[i].destcolor[0] - r) * a2;
|
||||
g += (cl.cshifts[i].destcolor[1] - g) * a2;
|
||||
b += (cl.cshifts[i].destcolor[2] - 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;
|
||||
}
|
||||
|
||||
v_blend[0] = min (r, 255.0) / 255.0;
|
||||
v_blend[1] = min (g, 255.0) / 255.0;
|
||||
v_blend[2] = min (b, 255.0) / 255.0;
|
||||
v_blend[3] = bound (0.0, a, 1.0);
|
||||
}
|
||||
|
||||
|
||||
extern void V_CalcGlowCshift (void);
|
||||
extern void V_CalcItemCshift (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)) {
|
||||
V_CalcGlowCshift ();
|
||||
} else {
|
||||
V_CalcItemCshift ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_UpdatePalette
|
||||
|
||||
In software, this function (duh) updates the palette. In GL, all it does is
|
||||
set up some values for shifting the screen color in a particular direction.
|
||||
*/
|
||||
void
|
||||
V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
qboolean new;
|
||||
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
if (!new && !vid.recalc_refdef)
|
||||
return;
|
||||
|
||||
V_CalcBlend ();
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
sw_view.c
|
||||
|
||||
player eye positioning
|
||||
|
||||
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 "compat.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/info.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "host.h"
|
||||
#include "r_local.h"
|
||||
#include "view.h"
|
||||
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
|
||||
extern byte gammatable[256];
|
||||
|
||||
|
||||
extern void V_CalcGlowCshift (void);
|
||||
|
||||
void
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
if (!cl_cshift_powerup->int_val)
|
||||
return;
|
||||
|
||||
V_CalcGlowCshift ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
qboolean new;
|
||||
byte *basepal, *newpal;
|
||||
byte pal[768];
|
||||
int r, g, b;
|
||||
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
if (!new && !vid.recalc_refdef)
|
||||
return;
|
||||
|
||||
basepal = vid_basepal;
|
||||
newpal = pal;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
r = basepal[0];
|
||||
g = basepal[1];
|
||||
b = basepal[2];
|
||||
basepal += 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;
|
||||
}
|
||||
|
||||
newpal[0] = gammatable[r];
|
||||
newpal[1] = gammatable[g];
|
||||
newpal[2] = gammatable[b];
|
||||
newpal += 3;
|
||||
}
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
|
@ -107,74 +107,66 @@ client_LIB_DEPS= libqfnet.la $(ASM) $(qf_client_LIBS)
|
|||
# libQFjs is seperate because it needs to be linked after when building statically
|
||||
|
||||
client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \
|
||||
cl_main.c cl_misc.c cl_ngraph.c cl_parse.c cl_screen.c cl_pred.c \
|
||||
cl_skin.c cl_slist.c cl_tent.c \
|
||||
console.c keys.c locs.c \
|
||||
r_view.c sbar.c skin.c teamplay.c \
|
||||
cl_main.c cl_misc.c cl_ngraph.c cl_parse.c cl_pred.c \
|
||||
cl_screen.c cl_skin.c cl_slist.c cl_tent.c cl_view.c \
|
||||
console.c keys.c locs.c sbar.c skin.c teamplay.c \
|
||||
$(syscl_SRC)
|
||||
|
||||
# Software-rendering clients
|
||||
#
|
||||
# ... Common stuff
|
||||
|
||||
soft_SOURCES= sw_view.c
|
||||
|
||||
# ... Linux FBDev
|
||||
qw_client_fbdev_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES)
|
||||
qw_client_fbdev_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_fbdev_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFfbdev.la $(client_LIBS)
|
||||
qw_client_fbdev_LDFLAGS= $(common_ldflags)
|
||||
qw_client_fbdev_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFfbdev.la $(client_LIB_DEPS)
|
||||
|
||||
# ... SciTech MGL
|
||||
qw_client_mgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES)
|
||||
qw_client_mgl_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_mgl_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFmgl.la $(client_LIBS) $(MGL_LIBS)
|
||||
qw_client_mgl_LDFLAGS= $(common_ldflags)
|
||||
qw_client_mgl_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFmgl.la $(client_LIB_DEPS)
|
||||
|
||||
# ... Simple DirectMedia Layer, version 1.0 and higher
|
||||
qw_client_sdl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES)
|
||||
qw_client_sdl_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_sdl_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFsdl.la $(client_LIBS) $(SDL_LIBS)
|
||||
qw_client_sdl_LDFLAGS= $(common_ldflags)
|
||||
qw_client_sdl_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFsdl.la $(client_LIB_DEPS)
|
||||
|
||||
# ... Linux SVGAlib
|
||||
qw_client_svga_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES)
|
||||
qw_client_svga_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_svga_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFsvga.la $(client_LIBS) $(SVGA_LIBS)
|
||||
qw_client_svga_LDFAGS= $(common_ldflags)
|
||||
qw_client_svga_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFsvga.la $(client_LIB_DEPS)
|
||||
|
||||
# ... X11
|
||||
qw_client_x11_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES)
|
||||
qw_client_x11_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_x11_LDADD= ../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFx11.la $(client_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) $(X_SHM_LIB)
|
||||
qw_client_x11_LDFLAGS= $(common_ldflags)
|
||||
qw_client_x11_DEPENDENCIES=../../libs/video/renderer/.libs/libQFrenderer_sw.a ../../libs/models/libQFmodels_sw.la ../../libs/video/targets/libQFx11.la $(client_LIB_DEPS)
|
||||
|
||||
|
||||
# OpenGL-using clients
|
||||
#
|
||||
# ... Common stuff
|
||||
ogl_SOURCES= gl_view.c
|
||||
|
||||
# ... 3Dfx Voodoo 1 and 2 SVGAlib-based console GL
|
||||
qw_client_3dfx_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES)
|
||||
qw_client_3dfx_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_3dfx_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFtdfx.la $(client_LIBS) $(GLIDE_LIBS) $(SVGA_LIBS) $(DL_LIBS)
|
||||
qw_client_3dfx_LDFLAGS= $(common_ldflags)
|
||||
qw_client_3dfx_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFtdfx.la $(client_LIB_DEPS)
|
||||
|
||||
# ... OpenGL in X Window
|
||||
qw_client_glx_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES)
|
||||
qw_client_glx_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_glx_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) $(DL_LIBS)
|
||||
qw_client_glx_LDFLAGS= $(common_ldflags)
|
||||
qw_client_glx_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFglx.la $(client_LIB_DEPS)
|
||||
|
||||
# ... Simple DirectMedia Layer, version 1.1 and higher, in GL mode
|
||||
qw_client_sgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES)
|
||||
qw_client_sgl_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_sgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIBS) $(SDL_LIBS) $(X_LIBS) $(DL_LIBS)
|
||||
qw_client_sgl_LDFLAGS= $(common_ldflags)
|
||||
qw_client_sgl_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFsgl.la $(client_LIB_DEPS)
|
||||
|
||||
# ... SGI/Microsoft WGL (Windows OpenGL)
|
||||
qw_client_wgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES)
|
||||
qw_client_wgl_SOURCES= $(common_SOURCES) $(client_SOURCES)
|
||||
qw_client_wgl_LDADD= ../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIBS) -lgdi32 -lwinmm
|
||||
qw_client_wgl_LDFLAGS= $(common_ldflags)
|
||||
qw_client_wgl_DEPENDENCIES=../../libs/video/renderer/libQFrenderer_gl.la ../../libs/models/libQFmodels_gl.la ../../libs/video/targets/libQFwgl.la $(client_LIB_DEPS)
|
||||
|
|
|
@ -78,9 +78,13 @@ static SCR_Func scr_funcs[] = {
|
|||
0
|
||||
};
|
||||
|
||||
|
||||
extern void V_CalcBlend (void);
|
||||
|
||||
void
|
||||
CL_UpdateScreen (double realtime)
|
||||
{
|
||||
V_CalcBlend ();
|
||||
SCR_UpdateScreen (realtime, scr_funcs, cl_hudswap->int_val);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
extern cvar_t *cl_cshift_bonus;
|
||||
extern cvar_t *cl_cshift_contents;
|
||||
extern cvar_t *cl_cshift_damage;
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
extern cvar_t *vid_gamma;
|
||||
|
||||
cvar_t *cl_rollspeed;
|
||||
|
@ -82,6 +83,7 @@ cvar_t *v_ipitch_level;
|
|||
cvar_t *v_idlescale;
|
||||
|
||||
float v_dmg_time, v_dmg_roll, v_dmg_pitch;
|
||||
float v_blend[4];
|
||||
|
||||
extern int in_forward, in_forward2, in_back;
|
||||
|
||||
|
@ -374,31 +376,15 @@ V_SetContentsColor (int contents)
|
|||
|
||||
|
||||
void
|
||||
V_CalcItemCshift (void)
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
if (cl.stats[STAT_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.stats[STAT_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;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_CalcGlowCshift (void)
|
||||
{
|
||||
if (!cl.stats[STAT_ITEMS] & (IT_SUIT || IT_INVISIBILITY || IT_QUAD || IT_INVULNERABILITY))
|
||||
if (!cl.stats[STAT_ITEMS] & (IT_SUIT || IT_INVISIBILITY || IT_QUAD
|
||||
|| IT_INVULNERABILITY))
|
||||
{
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY &&
|
||||
cl.stats[STAT_ITEMS] & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
|
@ -415,12 +401,107 @@ V_CalcGlowCshift (void)
|
|||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.stats[STAT_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.stats[STAT_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 {
|
||||
V_CalcItemCshift ();
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_CalcBlend
|
||||
|
||||
LordHavoc made this a real, true alpha blend. Cleaned it up
|
||||
a bit, but otherwise this is his code. --KB
|
||||
*/
|
||||
void
|
||||
V_CalcBlend (void)
|
||||
{
|
||||
float r = 0, g = 0, b = 0, a = 0;
|
||||
float a2, a3;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
a2 = cl.cshifts[i].percent / 255.0;
|
||||
|
||||
if (!a2)
|
||||
continue;
|
||||
|
||||
a2 = min (a2, 1.0);
|
||||
r += (cl.cshifts[i].destcolor[0] - r) * a2;
|
||||
g += (cl.cshifts[i].destcolor[1] - g) * a2;
|
||||
b += (cl.cshifts[i].destcolor[2] - 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;
|
||||
}
|
||||
|
||||
v_blend[0] = min (r, 255.0) / 255.0;
|
||||
v_blend[1] = min (g, 255.0) / 255.0;
|
||||
v_blend[2] = min (b, 255.0) / 255.0;
|
||||
v_blend[3] = bound (0.0, a, 1.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_PrepBlend (void)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (cl_cshift_powerup->int_val
|
||||
|| (atoi (Info_ValueForKey (cl.serverinfo, "cshifts"))
|
||||
& INFO_CSHIFT_POWERUP))
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
vid.cshift_changed = false;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent) {
|
||||
vid.cshift_changed = 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]) {
|
||||
vid.cshift_changed = 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;
|
||||
|
||||
if (!vid.cshift_changed && !vid.recalc_refdef)
|
||||
return;
|
||||
|
||||
V_CalcBlend();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
VIEW RENDERING
|
||||
*/
|
|
@ -1,164 +0,0 @@
|
|||
/*
|
||||
gl_view.c
|
||||
|
||||
player eye positioning
|
||||
|
||||
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
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "compat.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/info.h"
|
||||
|
||||
#include "bothdefs.h"
|
||||
#include "client.h"
|
||||
#include "view.h"
|
||||
#include "r_cvar.h"
|
||||
|
||||
extern double host_frametime;
|
||||
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
|
||||
byte ramps[3][256];
|
||||
float v_blend[4];
|
||||
|
||||
|
||||
/*
|
||||
V_CalcBlend
|
||||
|
||||
LordHavoc made this a real, true alpha blend. Cleaned it up
|
||||
a bit, but otherwise this is his code. --KB
|
||||
*/
|
||||
void
|
||||
V_CalcBlend (void)
|
||||
{
|
||||
float r = 0, g = 0, b = 0, a = 0;
|
||||
float a2, a3;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
a2 = cl.cshifts[i].percent / 255.0;
|
||||
|
||||
if (!a2)
|
||||
continue;
|
||||
|
||||
a2 = min (a2, 1.0);
|
||||
r += (cl.cshifts[i].destcolor[0] - r) * a2;
|
||||
g += (cl.cshifts[i].destcolor[1] - g) * a2;
|
||||
b += (cl.cshifts[i].destcolor[2] - 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;
|
||||
}
|
||||
|
||||
v_blend[0] = min (r, 255.0) / 255.0;
|
||||
v_blend[1] = min (g, 255.0) / 255.0;
|
||||
v_blend[2] = min (b, 255.0) / 255.0;
|
||||
v_blend[3] = bound (0.0, a, 1.0);
|
||||
}
|
||||
|
||||
|
||||
extern void V_CalcGlowCshift (void);
|
||||
extern void V_CalcItemCshift (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)) {
|
||||
V_CalcGlowCshift ();
|
||||
} else {
|
||||
V_CalcItemCshift ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_UpdatePalette
|
||||
|
||||
In software, this function (duh) updates the palette. In GL, all it does is
|
||||
set up some values for shifting the screen color in a particular direction.
|
||||
*/
|
||||
void
|
||||
V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
qboolean new;
|
||||
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
if (!new && !vid.recalc_refdef)
|
||||
return;
|
||||
|
||||
V_CalcBlend ();
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
sw_view.c
|
||||
|
||||
player eye positioning
|
||||
|
||||
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 "compat.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/info.h"
|
||||
|
||||
#include "bothdefs.h"
|
||||
#include "client.h"
|
||||
#include "host.h"
|
||||
#include "r_local.h"
|
||||
#include "view.h"
|
||||
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
|
||||
extern byte gammatable[256];
|
||||
|
||||
|
||||
extern void V_CalcGlowCshift (void);
|
||||
|
||||
void
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
if (!cl_cshift_powerup->int_val
|
||||
|| (atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) & INFO_CSHIFT_POWERUP))
|
||||
return;
|
||||
|
||||
V_CalcGlowCshift ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
qboolean new;
|
||||
byte *basepal, *newpal;
|
||||
byte pal[768];
|
||||
int r, g, b;
|
||||
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
if (!new && !vid.recalc_refdef)
|
||||
return;
|
||||
|
||||
basepal = vid_basepal;
|
||||
newpal = pal;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
r = basepal[0];
|
||||
g = basepal[1];
|
||||
b = basepal[2];
|
||||
basepal += 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;
|
||||
}
|
||||
|
||||
newpal[0] = gammatable[r];
|
||||
newpal[1] = gammatable[g];
|
||||
newpal[2] = gammatable[b];
|
||||
newpal += 3;
|
||||
}
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
Loading…
Reference in a new issue