set the colour channels of fully transparent pixels on 32-bit textures to
the average of their non-transparent neighbours, to avoid artifacts when
blending (or creating mipmaps, etc.)
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Created the gl_extensions.c file to pull some of the common stuff into
where appropriate. Non-power of two textures will be allowed by default,
with the option to go back to old behaviour by setting command line option
"-nonpot" or cvar 'gl_npot 0'. The cvar is a bit of a hack, as existing
textures won't be reloaded at this stage.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
New mipmap code handles odd textures sizes so that we can start using NPoT
textures where the hardware supports it. We've also removed some texture
size limitations - the new code is only limited by the available space on
the hunk.
We're still unconditionally stretching to power of two, so this doesn't do
anything noticable yet. One thing this fixes is generating the lowest
level mipmaps where the texture is only one-pixel wide or tall - the old
code didn't handle this special case properly.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Mainly because taking the address of the data pointer and casting to
byte * is something easily confused.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Since we now keep the pixel data for all alias model skins around,
remove the hacks for both NQ and QW where we saved the player skins
separate to any other data.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
To simplify things a bit, we will save the 8-bit texture data for all
alias models in the cache. Wastes a little bit of memory, but we can
remove some hacks for saving the player skins and doing color
translations. Also, this will simplify reloading gl textures when the
context has to be re-created for vid mode changes.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
As part of this, decouple de-allocation of the 'cache_system_t' from
the free of the cache_user_t so that Cache_Move can be cleanly
implemented (without invoking the destructor).
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Set up the tail recursion ourselves for the early test, let the compiler
do it (if it can) for the back side - since we set start/end as const.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
foreach_surf_lightstyle macro got promoted to the model.h header, various
local variable renames, etc.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Attempt to tidy things up a bit using similar techniques to those in the
video menu (vid_mode.c).
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
A lot of the churn is just re-ordering functions in the NQ file so that
the NQ specific menus are grouped together at the end of the file.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Mostly this is just being pedantic, but there were also some -1 vs.
K_UNKNOWN issues in the key bindings menu.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
A bit lazy to have lumped all this together, but here are is a collection
of fixes for int vs. knum_t (use K_UNKNOWN instead of -1) and when looping
over all keys, go to K_LAST instead of 256.
Various private variables/functions made static.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Reduce the size of the XLookupString return buffer, since we only care
about the first char anyway. Pass NULL instead of 0 for the
XComposeStatus argument.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Couldn't find a neat way to make the container_of macro const agnostic, so
just have a const and non-const version. Silences a bunch of -Wcast-qual
warnings so that real problems are easier to spot.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
The text buffer is actually modified inside, so be honest and just remove
the constness from the argument.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>