2000-05-10 20:33:16 +00:00
|
|
|
/*
|
2000-05-22 06:58:14 +00:00
|
|
|
gl_view.c
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-22 06:58:14 +00:00
|
|
|
player eye positioning
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-22 06:58:14 +00:00
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-22 06:58:14 +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-05-10 20:33:16 +00:00
|
|
|
|
2000-05-22 06:58:14 +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-05-10 20:33:16 +00:00
|
|
|
|
2000-05-22 06:58:14 +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-05-10 20:33:16 +00:00
|
|
|
*/
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-17 10:03:19 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-12-08 06:51:37 +00:00
|
|
|
# include "config.h"
|
2000-05-17 10:03:19 +00:00
|
|
|
#endif
|
2000-12-30 02:16:36 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
2001-01-31 07:52:28 +00:00
|
|
|
# include <string.h>
|
2000-12-30 02:16:36 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
2001-01-31 07:52:28 +00:00
|
|
|
# include <strings.h>
|
2000-12-30 02:16:36 +00:00
|
|
|
#endif
|
2001-01-31 07:52:28 +00:00
|
|
|
|
2000-05-14 07:19:15 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2001-02-01 19:53:15 +00:00
|
|
|
#include "bothdefs.h"
|
2000-05-14 07:19:15 +00:00
|
|
|
#include "glquake.h"
|
2001-02-01 19:53:15 +00:00
|
|
|
#include "view.h"
|
|
|
|
|
2000-05-14 07:19:15 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
extern byte *host_basepal;
|
|
|
|
extern double host_frametime;
|
|
|
|
extern int onground;
|
|
|
|
extern byte gammatable[256];
|
2000-05-14 07:19:15 +00:00
|
|
|
|
2001-02-01 19:53:15 +00:00
|
|
|
extern cvar_t *cl_cshift_powerup;
|
2000-12-13 09:01:11 +00:00
|
|
|
extern cvar_t *contrast;
|
2000-05-14 07:19:15 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
byte ramps[3][256];
|
|
|
|
float v_blend[4];
|
2000-05-14 07:19:15 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
qboolean V_CheckGamma (void);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
/*
|
This is a NON-TRIVIAL update which took LordHavoc and I about 3 days to
make work properly:
Win32 thing.. If you don't free textures explicitly, you can cause a
problem with nVidia drivers.
Colored lighting is now RGB instead of RGBA. The alpha is kinda pointless
on a lightmap and the effect's not all that great. Plus people stuck with
16 bit OpenGL (any other 3dfx people out there?) will be quite pleased
with the improvement in image quality. This does include LordHavoc's
dynamic light optimization code which takes most of the pain out of having
gl_flashblend off.
All glColor*'s are now half of what they used to be, except where they
aren't. If that doesn't make sense, don't worry. If you see one that's
only half what you'd expect, don't worry---it probably is meant to be like
that.. (More below)
glDisable (GL_BLEND) is now a thing of the GL_PAST. As is GL_REPLACE.
Instead, we _always_ use GL_MODULATE and leave GL_BLEND turned on. This
seems at first like it might be a performance hit, but I swear it's much
more expensive to change blending modes and texture functions 20-30 times
every screen frame!
Win32 issue.. Even though we check for multitexture, we currently don't
use it. Reason is that I am planning to replace SGIS_multitexture with
the preferred ARB_multitexture extension which is supported in most GL 1.1
implementations and is a requirement for GL 1.2 anyway. I also wanted to
get rid of some duplicated code. Since Linux doesn't support multitexture
yet, I just commented out the code keeping me from compiling to get it to
work. Win32 should work without it until it's fixed, which shouldn't be
long since the differences between SGIS and ARB multitextures as far as
Quake is concerned is minimal AT BEST.
LordHavoc and I have been working tirelessly (well not quite, we both did
manage to sleep sometime during this ordeal) to fix the lighting in the GL
renderers! It looks DAMNED CLOSE to software's lighting now, including
the ability to overbright a color. You've gotta see this to know what I'm
talking about. That's why the glColor*'s are halved in most places. The
gamma table code and the general way it works is LordHavoc's design, but
over the course of re-implementing it in QF we did come up with a few more
small optimizations.
A lot of people have noticed that QF's fps count has gone to shit lately.
No promises that this undid whatever the problem was. That means there
could be a huge optimization lurking somewhere in the shadows, waiting for
us to fix it for a massive FPS boost. Even if there's not, the code in
this commit DOUBLED MY FPS COUNT. Granted I was getting pathetic FPS as
it was (around 30, which is pathetic even for a Voodoo3 in Linux) but
still---60 is a big improvement over 30!
Please be sure to "test" this code thuroughly.
2000-06-03 19:56:09 +00:00
|
|
|
V_CalcBlend
|
|
|
|
|
|
|
|
LordHavoc made this a real, (messy,) true alpha blend. Cleaned it up
|
|
|
|
a bit, but otherwise this is his code. --KB
|
2000-05-10 11:29:38 +00:00
|
|
|
*/
|
This is a NON-TRIVIAL update which took LordHavoc and I about 3 days to
make work properly:
Win32 thing.. If you don't free textures explicitly, you can cause a
problem with nVidia drivers.
Colored lighting is now RGB instead of RGBA. The alpha is kinda pointless
on a lightmap and the effect's not all that great. Plus people stuck with
16 bit OpenGL (any other 3dfx people out there?) will be quite pleased
with the improvement in image quality. This does include LordHavoc's
dynamic light optimization code which takes most of the pain out of having
gl_flashblend off.
All glColor*'s are now half of what they used to be, except where they
aren't. If that doesn't make sense, don't worry. If you see one that's
only half what you'd expect, don't worry---it probably is meant to be like
that.. (More below)
glDisable (GL_BLEND) is now a thing of the GL_PAST. As is GL_REPLACE.
Instead, we _always_ use GL_MODULATE and leave GL_BLEND turned on. This
seems at first like it might be a performance hit, but I swear it's much
more expensive to change blending modes and texture functions 20-30 times
every screen frame!
Win32 issue.. Even though we check for multitexture, we currently don't
use it. Reason is that I am planning to replace SGIS_multitexture with
the preferred ARB_multitexture extension which is supported in most GL 1.1
implementations and is a requirement for GL 1.2 anyway. I also wanted to
get rid of some duplicated code. Since Linux doesn't support multitexture
yet, I just commented out the code keeping me from compiling to get it to
work. Win32 should work without it until it's fixed, which shouldn't be
long since the differences between SGIS and ARB multitextures as far as
Quake is concerned is minimal AT BEST.
LordHavoc and I have been working tirelessly (well not quite, we both did
manage to sleep sometime during this ordeal) to fix the lighting in the GL
renderers! It looks DAMNED CLOSE to software's lighting now, including
the ability to overbright a color. You've gotta see this to know what I'm
talking about. That's why the glColor*'s are halved in most places. The
gamma table code and the general way it works is LordHavoc's design, but
over the course of re-implementing it in QF we did come up with a few more
small optimizations.
A lot of people have noticed that QF's fps count has gone to shit lately.
No promises that this undid whatever the problem was. That means there
could be a huge optimization lurking somewhere in the shadows, waiting for
us to fix it for a massive FPS boost. Even if there's not, the code in
this commit DOUBLED MY FPS COUNT. Granted I was getting pathetic FPS as
it was (around 30, which is pathetic even for a Voodoo3 in Linux) but
still---60 is a big improvement over 30!
Please be sure to "test" this code thuroughly.
2000-06-03 19:56:09 +00:00
|
|
|
void
|
|
|
|
V_CalcBlend (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
float r, g, b, a, a2, a3;
|
|
|
|
int j;
|
This is a NON-TRIVIAL update which took LordHavoc and I about 3 days to
make work properly:
Win32 thing.. If you don't free textures explicitly, you can cause a
problem with nVidia drivers.
Colored lighting is now RGB instead of RGBA. The alpha is kinda pointless
on a lightmap and the effect's not all that great. Plus people stuck with
16 bit OpenGL (any other 3dfx people out there?) will be quite pleased
with the improvement in image quality. This does include LordHavoc's
dynamic light optimization code which takes most of the pain out of having
gl_flashblend off.
All glColor*'s are now half of what they used to be, except where they
aren't. If that doesn't make sense, don't worry. If you see one that's
only half what you'd expect, don't worry---it probably is meant to be like
that.. (More below)
glDisable (GL_BLEND) is now a thing of the GL_PAST. As is GL_REPLACE.
Instead, we _always_ use GL_MODULATE and leave GL_BLEND turned on. This
seems at first like it might be a performance hit, but I swear it's much
more expensive to change blending modes and texture functions 20-30 times
every screen frame!
Win32 issue.. Even though we check for multitexture, we currently don't
use it. Reason is that I am planning to replace SGIS_multitexture with
the preferred ARB_multitexture extension which is supported in most GL 1.1
implementations and is a requirement for GL 1.2 anyway. I also wanted to
get rid of some duplicated code. Since Linux doesn't support multitexture
yet, I just commented out the code keeping me from compiling to get it to
work. Win32 should work without it until it's fixed, which shouldn't be
long since the differences between SGIS and ARB multitextures as far as
Quake is concerned is minimal AT BEST.
LordHavoc and I have been working tirelessly (well not quite, we both did
manage to sleep sometime during this ordeal) to fix the lighting in the GL
renderers! It looks DAMNED CLOSE to software's lighting now, including
the ability to overbright a color. You've gotta see this to know what I'm
talking about. That's why the glColor*'s are halved in most places. The
gamma table code and the general way it works is LordHavoc's design, but
over the course of re-implementing it in QF we did come up with a few more
small optimizations.
A lot of people have noticed that QF's fps count has gone to shit lately.
No promises that this undid whatever the problem was. That means there
could be a huge optimization lurking somewhere in the shadows, waiting for
us to fix it for a massive FPS boost. Even if there's not, the code in
this commit DOUBLED MY FPS COUNT. Granted I was getting pathetic FPS as
it was (around 30, which is pathetic even for a Voodoo3 in Linux) but
still---60 is a big improvement over 30!
Please be sure to "test" this code thuroughly.
2000-06-03 19:56:09 +00:00
|
|
|
|
|
|
|
r = 0;
|
|
|
|
g = 0;
|
|
|
|
b = 0;
|
|
|
|
a = 0;
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
for (j = 0; j < NUM_CSHIFTS; j++) {
|
2000-12-13 09:01:11 +00:00
|
|
|
a2 = cl.cshifts[j].percent / 255.0;
|
This is a NON-TRIVIAL update which took LordHavoc and I about 3 days to
make work properly:
Win32 thing.. If you don't free textures explicitly, you can cause a
problem with nVidia drivers.
Colored lighting is now RGB instead of RGBA. The alpha is kinda pointless
on a lightmap and the effect's not all that great. Plus people stuck with
16 bit OpenGL (any other 3dfx people out there?) will be quite pleased
with the improvement in image quality. This does include LordHavoc's
dynamic light optimization code which takes most of the pain out of having
gl_flashblend off.
All glColor*'s are now half of what they used to be, except where they
aren't. If that doesn't make sense, don't worry. If you see one that's
only half what you'd expect, don't worry---it probably is meant to be like
that.. (More below)
glDisable (GL_BLEND) is now a thing of the GL_PAST. As is GL_REPLACE.
Instead, we _always_ use GL_MODULATE and leave GL_BLEND turned on. This
seems at first like it might be a performance hit, but I swear it's much
more expensive to change blending modes and texture functions 20-30 times
every screen frame!
Win32 issue.. Even though we check for multitexture, we currently don't
use it. Reason is that I am planning to replace SGIS_multitexture with
the preferred ARB_multitexture extension which is supported in most GL 1.1
implementations and is a requirement for GL 1.2 anyway. I also wanted to
get rid of some duplicated code. Since Linux doesn't support multitexture
yet, I just commented out the code keeping me from compiling to get it to
work. Win32 should work without it until it's fixed, which shouldn't be
long since the differences between SGIS and ARB multitextures as far as
Quake is concerned is minimal AT BEST.
LordHavoc and I have been working tirelessly (well not quite, we both did
manage to sleep sometime during this ordeal) to fix the lighting in the GL
renderers! It looks DAMNED CLOSE to software's lighting now, including
the ability to overbright a color. You've gotta see this to know what I'm
talking about. That's why the glColor*'s are halved in most places. The
gamma table code and the general way it works is LordHavoc's design, but
over the course of re-implementing it in QF we did come up with a few more
small optimizations.
A lot of people have noticed that QF's fps count has gone to shit lately.
No promises that this undid whatever the problem was. That means there
could be a huge optimization lurking somewhere in the shadows, waiting for
us to fix it for a massive FPS boost. Even if there's not, the code in
this commit DOUBLED MY FPS COUNT. Granted I was getting pathetic FPS as
it was (around 30, which is pathetic even for a Voodoo3 in Linux) but
still---60 is a big improvement over 30!
Please be sure to "test" this code thuroughly.
2000-06-03 19:56:09 +00:00
|
|
|
|
|
|
|
if (!a2)
|
|
|
|
continue;
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
a2 = min (a2, 1.0);
|
|
|
|
r += (cl.cshifts[j].destcolor[0] - r) * a2;
|
|
|
|
g += (cl.cshifts[j].destcolor[1] - g) * a2;
|
|
|
|
b += (cl.cshifts[j].destcolor[2] - b) * a2;
|
|
|
|
|
This is a NON-TRIVIAL update which took LordHavoc and I about 3 days to
make work properly:
Win32 thing.. If you don't free textures explicitly, you can cause a
problem with nVidia drivers.
Colored lighting is now RGB instead of RGBA. The alpha is kinda pointless
on a lightmap and the effect's not all that great. Plus people stuck with
16 bit OpenGL (any other 3dfx people out there?) will be quite pleased
with the improvement in image quality. This does include LordHavoc's
dynamic light optimization code which takes most of the pain out of having
gl_flashblend off.
All glColor*'s are now half of what they used to be, except where they
aren't. If that doesn't make sense, don't worry. If you see one that's
only half what you'd expect, don't worry---it probably is meant to be like
that.. (More below)
glDisable (GL_BLEND) is now a thing of the GL_PAST. As is GL_REPLACE.
Instead, we _always_ use GL_MODULATE and leave GL_BLEND turned on. This
seems at first like it might be a performance hit, but I swear it's much
more expensive to change blending modes and texture functions 20-30 times
every screen frame!
Win32 issue.. Even though we check for multitexture, we currently don't
use it. Reason is that I am planning to replace SGIS_multitexture with
the preferred ARB_multitexture extension which is supported in most GL 1.1
implementations and is a requirement for GL 1.2 anyway. I also wanted to
get rid of some duplicated code. Since Linux doesn't support multitexture
yet, I just commented out the code keeping me from compiling to get it to
work. Win32 should work without it until it's fixed, which shouldn't be
long since the differences between SGIS and ARB multitextures as far as
Quake is concerned is minimal AT BEST.
LordHavoc and I have been working tirelessly (well not quite, we both did
manage to sleep sometime during this ordeal) to fix the lighting in the GL
renderers! It looks DAMNED CLOSE to software's lighting now, including
the ability to overbright a color. You've gotta see this to know what I'm
talking about. That's why the glColor*'s are halved in most places. The
gamma table code and the general way it works is LordHavoc's design, but
over the course of re-implementing it in QF we did come up with a few more
small optimizations.
A lot of people have noticed that QF's fps count has gone to shit lately.
No promises that this undid whatever the problem was. That means there
could be a huge optimization lurking somewhere in the shadows, waiting for
us to fix it for a massive FPS boost. Even if there's not, the code in
this commit DOUBLED MY FPS COUNT. Granted I was getting pathetic FPS as
it was (around 30, which is pathetic even for a Voodoo3 in Linux) but
still---60 is a big improvement over 30!
Please be sure to "test" this code thuroughly.
2000-06-03 19:56:09 +00:00
|
|
|
a3 = (1.0 - a) * (1.0 - a2);
|
|
|
|
a = 1.0 - a3;
|
|
|
|
}
|
|
|
|
|
2000-12-13 09:01:11 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2000-06-30 00:47:26 +00:00
|
|
|
// LordHavoc: saturate color
|
2000-12-08 06:51:37 +00:00
|
|
|
if (a) {
|
This is a NON-TRIVIAL update which took LordHavoc and I about 3 days to
make work properly:
Win32 thing.. If you don't free textures explicitly, you can cause a
problem with nVidia drivers.
Colored lighting is now RGB instead of RGBA. The alpha is kinda pointless
on a lightmap and the effect's not all that great. Plus people stuck with
16 bit OpenGL (any other 3dfx people out there?) will be quite pleased
with the improvement in image quality. This does include LordHavoc's
dynamic light optimization code which takes most of the pain out of having
gl_flashblend off.
All glColor*'s are now half of what they used to be, except where they
aren't. If that doesn't make sense, don't worry. If you see one that's
only half what you'd expect, don't worry---it probably is meant to be like
that.. (More below)
glDisable (GL_BLEND) is now a thing of the GL_PAST. As is GL_REPLACE.
Instead, we _always_ use GL_MODULATE and leave GL_BLEND turned on. This
seems at first like it might be a performance hit, but I swear it's much
more expensive to change blending modes and texture functions 20-30 times
every screen frame!
Win32 issue.. Even though we check for multitexture, we currently don't
use it. Reason is that I am planning to replace SGIS_multitexture with
the preferred ARB_multitexture extension which is supported in most GL 1.1
implementations and is a requirement for GL 1.2 anyway. I also wanted to
get rid of some duplicated code. Since Linux doesn't support multitexture
yet, I just commented out the code keeping me from compiling to get it to
work. Win32 should work without it until it's fixed, which shouldn't be
long since the differences between SGIS and ARB multitextures as far as
Quake is concerned is minimal AT BEST.
LordHavoc and I have been working tirelessly (well not quite, we both did
manage to sleep sometime during this ordeal) to fix the lighting in the GL
renderers! It looks DAMNED CLOSE to software's lighting now, including
the ability to overbright a color. You've gotta see this to know what I'm
talking about. That's why the glColor*'s are halved in most places. The
gamma table code and the general way it works is LordHavoc's design, but
over the course of re-implementing it in QF we did come up with a few more
small optimizations.
A lot of people have noticed that QF's fps count has gone to shit lately.
No promises that this undid whatever the problem was. That means there
could be a huge optimization lurking somewhere in the shadows, waiting for
us to fix it for a massive FPS boost. Even if there's not, the code in
this commit DOUBLED MY FPS COUNT. Granted I was getting pathetic FPS as
it was (around 30, which is pathetic even for a Voodoo3 in Linux) but
still---60 is a big improvement over 30!
Please be sure to "test" this code thuroughly.
2000-06-03 19:56:09 +00:00
|
|
|
a2 = 1.0 / a;
|
|
|
|
r *= a2;
|
|
|
|
g *= a2;
|
|
|
|
b *= a2;
|
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
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;
|
This is a NON-TRIVIAL update which took LordHavoc and I about 3 days to
make work properly:
Win32 thing.. If you don't free textures explicitly, you can cause a
problem with nVidia drivers.
Colored lighting is now RGB instead of RGBA. The alpha is kinda pointless
on a lightmap and the effect's not all that great. Plus people stuck with
16 bit OpenGL (any other 3dfx people out there?) will be quite pleased
with the improvement in image quality. This does include LordHavoc's
dynamic light optimization code which takes most of the pain out of having
gl_flashblend off.
All glColor*'s are now half of what they used to be, except where they
aren't. If that doesn't make sense, don't worry. If you see one that's
only half what you'd expect, don't worry---it probably is meant to be like
that.. (More below)
glDisable (GL_BLEND) is now a thing of the GL_PAST. As is GL_REPLACE.
Instead, we _always_ use GL_MODULATE and leave GL_BLEND turned on. This
seems at first like it might be a performance hit, but I swear it's much
more expensive to change blending modes and texture functions 20-30 times
every screen frame!
Win32 issue.. Even though we check for multitexture, we currently don't
use it. Reason is that I am planning to replace SGIS_multitexture with
the preferred ARB_multitexture extension which is supported in most GL 1.1
implementations and is a requirement for GL 1.2 anyway. I also wanted to
get rid of some duplicated code. Since Linux doesn't support multitexture
yet, I just commented out the code keeping me from compiling to get it to
work. Win32 should work without it until it's fixed, which shouldn't be
long since the differences between SGIS and ARB multitextures as far as
Quake is concerned is minimal AT BEST.
LordHavoc and I have been working tirelessly (well not quite, we both did
manage to sleep sometime during this ordeal) to fix the lighting in the GL
renderers! It looks DAMNED CLOSE to software's lighting now, including
the ability to overbright a color. You've gotta see this to know what I'm
talking about. That's why the glColor*'s are halved in most places. The
gamma table code and the general way it works is LordHavoc's design, but
over the course of re-implementing it in QF we did come up with a few more
small optimizations.
A lot of people have noticed that QF's fps count has gone to shit lately.
No promises that this undid whatever the problem was. That means there
could be a huge optimization lurking somewhere in the shadows, waiting for
us to fix it for a massive FPS boost. Even if there's not, the code in
this commit DOUBLED MY FPS COUNT. Granted I was getting pathetic FPS as
it was (around 30, which is pathetic even for a Voodoo3 in Linux) but
still---60 is a big improvement over 30!
Please be sure to "test" this code thuroughly.
2000-06-03 19:56:09 +00:00
|
|
|
v_blend[3] = bound (0.0, a, 1.0);
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2001-02-01 19:53:15 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
/*
|
|
|
|
=============
|
2001-02-01 19:53:15 +00:00
|
|
|
V_CalcPowerupCshift
|
2000-05-10 11:29:38 +00:00
|
|
|
=============
|
2001-02-01 19:53:15 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
V_CalcPowerupCshift (void)
|
|
|
|
{
|
|
|
|
if (!cl_cshift_powerup->int_val
|
|
|
|
|| (atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) & INFO_CSHIFT_POWERUP))
|
|
|
|
return;
|
|
|
|
|
2001-02-03 04:02:39 +00:00
|
|
|
if ((gl_dlight_polyblend->int_val ||
|
|
|
|
!(gl_dlight_lightmap->int_val && gl_dlight_polyblend->int_val)) &&
|
|
|
|
(cl.stats[STAT_ITEMS] & IT_INVULNERABILITY ||
|
|
|
|
cl.stats[STAT_ITEMS] & IT_QUAD))
|
|
|
|
{
|
|
|
|
if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY &&
|
|
|
|
cl.stats[STAT_ITEMS] & IT_QUAD) {
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
|
|
|
} else if (cl.stats[STAT_ITEMS] & IT_QUAD) {
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
|
|
|
} else if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) {
|
|
|
|
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
|
|
|
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) {
|
2001-02-01 19:53:15 +00:00
|
|
|
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;
|
|
|
|
}
|
2000-05-14 07:19:15 +00:00
|
|
|
|
2001-02-01 19:53:15 +00:00
|
|
|
/*
|
|
|
|
=============
|
|
|
|
V_UpdatePalette
|
|
|
|
=============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
V_UpdatePalette (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int i, j;
|
|
|
|
qboolean new;
|
|
|
|
qboolean force;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
V_CalcPowerupCshift ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
new = false;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-09-30 05:58:40 +00:00
|
|
|
for (i = 0; i < NUM_CSHIFTS; i++) {
|
|
|
|
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent) {
|
2000-05-10 11:29:38 +00:00
|
|
|
new = true;
|
|
|
|
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
|
|
|
|
}
|
2000-09-30 05:58:40 +00:00
|
|
|
for (j = 0; j < 3; j++) {
|
|
|
|
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j]) {
|
2000-05-10 11:29:38 +00:00
|
|
|
new = true;
|
|
|
|
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
|
|
|
|
}
|
2000-09-30 05:58:40 +00:00
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2000-09-30 05:58:40 +00:00
|
|
|
// drop the damage value
|
2000-12-08 06:51:37 +00:00
|
|
|
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime * 150;
|
2000-05-10 11:29:38 +00:00
|
|
|
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
|
|
|
|
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
|
|
|
|
|
2000-09-30 05:58:40 +00:00
|
|
|
// drop the bonus value
|
2000-12-08 06:51:37 +00:00
|
|
|
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime * 100;
|
2000-05-10 11:29:38 +00:00
|
|
|
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
|
|
|
|
cl.cshifts[CSHIFT_BONUS].percent = 0;
|
|
|
|
|
|
|
|
force = V_CheckGamma ();
|
|
|
|
if (!new && !force)
|
|
|
|
return;
|
|
|
|
|
|
|
|
V_CalcBlend ();
|
|
|
|
}
|
This is a NON-TRIVIAL update which took LordHavoc and I about 3 days to
make work properly:
Win32 thing.. If you don't free textures explicitly, you can cause a
problem with nVidia drivers.
Colored lighting is now RGB instead of RGBA. The alpha is kinda pointless
on a lightmap and the effect's not all that great. Plus people stuck with
16 bit OpenGL (any other 3dfx people out there?) will be quite pleased
with the improvement in image quality. This does include LordHavoc's
dynamic light optimization code which takes most of the pain out of having
gl_flashblend off.
All glColor*'s are now half of what they used to be, except where they
aren't. If that doesn't make sense, don't worry. If you see one that's
only half what you'd expect, don't worry---it probably is meant to be like
that.. (More below)
glDisable (GL_BLEND) is now a thing of the GL_PAST. As is GL_REPLACE.
Instead, we _always_ use GL_MODULATE and leave GL_BLEND turned on. This
seems at first like it might be a performance hit, but I swear it's much
more expensive to change blending modes and texture functions 20-30 times
every screen frame!
Win32 issue.. Even though we check for multitexture, we currently don't
use it. Reason is that I am planning to replace SGIS_multitexture with
the preferred ARB_multitexture extension which is supported in most GL 1.1
implementations and is a requirement for GL 1.2 anyway. I also wanted to
get rid of some duplicated code. Since Linux doesn't support multitexture
yet, I just commented out the code keeping me from compiling to get it to
work. Win32 should work without it until it's fixed, which shouldn't be
long since the differences between SGIS and ARB multitextures as far as
Quake is concerned is minimal AT BEST.
LordHavoc and I have been working tirelessly (well not quite, we both did
manage to sleep sometime during this ordeal) to fix the lighting in the GL
renderers! It looks DAMNED CLOSE to software's lighting now, including
the ability to overbright a color. You've gotta see this to know what I'm
talking about. That's why the glColor*'s are halved in most places. The
gamma table code and the general way it works is LordHavoc's design, but
over the course of re-implementing it in QF we did come up with a few more
small optimizations.
A lot of people have noticed that QF's fps count has gone to shit lately.
No promises that this undid whatever the problem was. That means there
could be a huge optimization lurking somewhere in the shadows, waiting for
us to fix it for a massive FPS boost. Even if there's not, the code in
this commit DOUBLED MY FPS COUNT. Granted I was getting pathetic FPS as
it was (around 30, which is pathetic even for a Voodoo3 in Linux) but
still---60 is a big improvement over 30!
Please be sure to "test" this code thuroughly.
2000-06-03 19:56:09 +00:00
|
|
|
|
2001-02-01 19:53:15 +00:00
|
|
|
|
2000-09-21 19:15:44 +00:00
|
|
|
/*
|
|
|
|
BuildGammaTable
|
|
|
|
|
|
|
|
In software mode, this function gets the palette ready for changing...in
|
|
|
|
in GL, it does very little as you can see.
|
2001-02-01 19:53:15 +00:00
|
|
|
*/
|
2000-09-21 19:15:44 +00:00
|
|
|
void
|
|
|
|
BuildGammaTable (float b, float c)
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int i;
|
2000-09-21 19:15:44 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
gammatable[i] = i;
|
|
|
|
return;
|
|
|
|
}
|