Commit Graph

1592 Commits

Author SHA1 Message Date
Kevin Shanahan
6dd9c848e9 textures: remove old sky alpha blending hack
Use the proper edge alpha fix now built into the 8to32 function.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-05 21:29:24 +09:30
Kevin Shanahan
ed7ba0501e textures: implement blending fix for alpha mask textures
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>
2013-05-05 21:27:50 +09:30
Kevin Shanahan
daafa9200b textures: check for npot extension and use if available
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>
2013-05-05 20:12:41 +09:30
Kevin Shanahan
c723ebda22 textures: introduce new mipmap code
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>
2013-05-05 17:39:13 +09:30
Kevin Shanahan
63ad422df3 zone: add missing include for use of size_t
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-05 17:36:57 +09:30
Kevin Shanahan
e21f7269bc draw: separate on-disk dpic_t type from in-memory qpic_t
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>
2013-05-03 07:06:07 +09:30
Kevin Shanahan
864a032c3b common: fix const_container_of macro for older gcc
Fixes warnings with Apple's gcc 4.0.1 on OS X 10.5.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-02 20:09:32 +09:30
Kevin Shanahan
14644d0cea sprite: save the sprite pixel data on the hunk for glquake
To simplify the initial implementation of texture reloading on mode
change.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-30 12:15:53 +09:30
Kevin Shanahan
0d6788ba02 model: remove player model skin caching hacks
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>
2013-04-30 09:47:50 +09:30
Kevin Shanahan
eed09e6278 model: save alias skin pixel data into the cache
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>
2013-04-30 08:06:16 +09:30
Kevin Shanahan
739600b058 model: print model name with invalid skin frame warning
Rename some local variables to make the software/GL paths more alike.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-29 16:07:57 +09:30
Kevin Shanahan
62a20b1574 skin: rename local variables sc -> player
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-29 16:07:57 +09:30
Kevin Shanahan
034da76617 skin: make the skin cache private to skin.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-29 16:07:57 +09:30
Kevin Shanahan
51274d9464 model: hook up a cache destructor for alias models
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-29 14:18:49 +09:30
Kevin Shanahan
c960a3b94c zone: add a cache destructor callback
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>
2013-04-29 14:17:21 +09:30
Kevin Shanahan
e449e43f36 model: fix saving alias frame intervals
Save the interval before we increment numposes.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-28 19:07:13 +09:30
Kevin Shanahan
f41d286162 trivial: typos, allways->always, allready->already
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-28 19:07:13 +09:30
Kevin Shanahan
d042d19ddb trival: comment cleanup in Mod_LoadTextures
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-27 10:18:12 +09:30
Kevin Shanahan
6b33e31240 sbar: random cleanups to Sbar_MiniDeathmatchOverlay
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-27 10:06:31 +09:30
Kevin Shanahan
46e4a265ab sbar: use Draw_Pic() instead of M_DrawPic()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-26 19:08:00 +09:30
Kevin Shanahan
d84532b60f render: small tail recursion optimization in RecursiveLightPoint
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>
2013-04-26 12:57:32 +09:30
Kevin Shanahan
f82786bc80 render: lift surface lightmap checks out of RecursiveLightPoint
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-26 08:43:40 +09:30
Kevin Shanahan
590a5b4cae render: some cleanups in R_LightPoint
foreach_surf_lightstyle macro got promoted to the model.h header, various
local variable renames, etc.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-26 08:21:15 +09:30
Kevin Shanahan
af3aa95712 render: remove gl_rlight.c and use r_light.c instead
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 20:33:56 +09:30
Kevin Shanahan
31c5b7197c render: prepare r_light.c and gl_rlight.c for merging
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 20:30:14 +09:30
Kevin Shanahan
df46c0c55f model: make the non-lerped and lerped code more consistent
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 19:32:12 +09:30
Kevin Shanahan
98e24f6b72 model: fix light vertex for lerped alias model case
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 19:25:56 +09:30
Kevin Shanahan
63fa4cdc99 gl: remove never-read variable lightplane
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 19:10:01 +09:30
Kevin Shanahan
8c71de3609 menu: re-work quit menu
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 18:17:53 +09:30
Kevin Shanahan
bd2a1b4ff5 menu: re-work the key bindings menu
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 17:21:37 +09:30
Kevin Shanahan
51ffddd279 menu: re-work the options menu
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 16:01:13 +09:30
Kevin Shanahan
25d8614945 menu: re-work the main menu functions
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>
2013-04-25 13:11:34 +09:30
Kevin Shanahan
748b2183b0 menu: move some NQ specific bits next to the NQ only menus
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 12:23:37 +09:30
Kevin Shanahan
7f61754841 menu: move menu.c to the common directory 2013-04-25 12:06:03 +09:30
Kevin Shanahan
5466fde4ca menu: prepare menu files for merging
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>
2013-04-25 12:04:16 +09:30
Kevin Shanahan
00bae5b830 menu: move header to shared include directory
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 10:43:52 +09:30
Kevin Shanahan
4f5e9d2faf menu: prepare header for merging
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 10:43:25 +09:30
Kevin Shanahan
4e4ff70ef6 menu: more knum_t vs. int changes
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>
2013-04-24 22:24:31 +09:30
Kevin Shanahan
29a7552f3c keys: misc int vs. knum_t fixes
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>
2013-04-24 21:04:20 +09:30
Kevin Shanahan
62819026b5 keys: try to consistently use knum_t for keynums
Make sure to use K_UNKNOWN instead of -1 to indicate an invalid key.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 20:41:58 +09:30
Kevin Shanahan
e15480ba4b draw: const_container_of fixes for gl_draw.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 20:24:54 +09:30
Kevin Shanahan
6b209d316c world: use const_container_of to check physents
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 20:23:21 +09:30
Kevin Shanahan
8e40dedafd vid: send the key up events for all keys in ClearAllStates
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 20:21:33 +09:30
Kevin Shanahan
19522ccf5f vid: make the X11 keyboard translation functions consistent
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>
2013-04-24 20:07:18 +09:30
Kevin Shanahan
f9a1271e81 Merge branch 'master' of git://disenchant.net/tyrquake 2013-04-24 16:53:29 +09:30
Kevin Shanahan
580204e255 model: fix const correctness of ConstBrushModel internals
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>
2013-04-24 16:19:04 +09:30
Kevin Shanahan
979342e2de draw: const correctness setting up draw pics
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 16:18:23 +09:30
Kevin Shanahan
1ff81be11c conproc: fix WriteText const correctness
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>
2013-04-24 16:17:19 +09:30
Kevin Shanahan
1ca3fa743d model: pedantic const-correctness fixes
Fix various warnings produced by -Wcast-qual.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 16:15:37 +09:30
svdijk
2df385225a screen: prepare SCR_ModalMessage for use when not connected
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 13:03:14 +09:30