Commit graph

3285 commits

Author SHA1 Message Date
Zack Middleton
14cc4cc6cb OpenGL2: Fix world VAO cache drawing when glIndex_t is unsigned short
OpenGL ES is only required to support unsigned short for element buffer
values.

R_DrawElements() firstIndex argument was glIndex_t which caused element
indexes to wrap around to 0 when glIndex_t is an unsigned short.
(glIndex_t is an index into the vertexes buffer, not element buffer.)
Change it to 'int' like tess.firstIndex which is passed to
R_DrawElements().

World VAO cache buffer size allowed storing more vertexes than unsigned
short glIndex_t could reference. This resulted in the vertex indexes in
the element buffer wrapping around to 0.
2018-07-20 23:40:31 -05:00
Zack Middleton
658165cfbb Don't check fixed function GL extensions when using shader pipeline
GL_TEXTURE_UNITS_ARB is not part of OpenGL ES 2 API and sets GL error.
It's not part of OpenGL 3.2 core profile either.
2018-07-20 23:40:26 -05:00
Zack Middleton
d861a4f427 Load OpenGL ES 2.0 function procs
Load functions procs supported by OpenGL ES 2.0, though there is not a
compatible renderer yet. Change argument for GLimp_Init from coreContext
to fixedFunction.
2018-07-20 23:40:21 -05:00
Zack Middleton
7391215bd4 Don't load non-core GL functions for OpenGL 3.2 core context
Also declare the GL functions in tr_local.h so there is compile error
for non-core GL functions instead of SEGFAULT from dereferencing a NULL
pointer.

Disable the non-functional stencil shadow code that hasn't been updated
to use OpenGL 3.2 core compatible drawing.
2018-07-20 23:40:17 -05:00
Zack Middleton
255c33b367 OpenGL1: Use RE_UploadCinematic() instead of duplicate code
Already done in opengl2 renderer.
2018-07-20 23:40:12 -05:00
Zack Middleton
476134f5a6 Don't upload 8 bit grayscale images as 16 bit luminance
Using more color bits than the source image provides shouldn't improve
the quality.
2018-07-20 23:40:07 -05:00
Zack Middleton
bead4aa8c7 Fix renderer not clearing some GL extension variables at vid_restart
If renderer is compiled into client (USE_RENDERER_DLOPEN=0) and after
start up set r_allowExtension to 0 and run vid_restart, some extension
were still used.
2018-07-20 23:40:02 -05:00
Zack Middleton
c74b9a4452 Remove unused renderer_buffer variable 2018-07-20 23:39:54 -05:00
Zack Middleton
809a7765b2 Make testgun command without argument disable test gun model 2018-06-24 22:22:25 -05:00
Simon McVittie
fb4b206709 Allow pkg-config binary to be overridden with PKG_CONFIG
This is one of the de facto standard interfaces used in Linux
distributions for cross-compilation (alongside overriding CC and
similar variables), and in particular is used in Debian and its
derivatives.

Signed-off-by: Simon McVittie <smcv@debian.org>
2018-06-12 11:27:42 +01:00
Zack Middleton
38a2f4d938 Fix in_restart causing fatal error while video is shutdown
Connecting to a server running a different fs_game and using a
autoexec.cfg containing in_restart would hit a fatal error in IN_Init().

    IN_Init called before SDL_Init( SDL_INIT_VIDEO )

Reported by smokey2k on the ioquake3 forum.
2018-06-10 15:13:10 -05:00
Zack Middleton
1b1d0c55f6 Fix Linux uninstaller redirecting stderr to stdout in preuninstall.sh
Last commit accidently made stderr redirect to stdout tty instead of
/dev/null.

Reported by @illwieckz.
2018-06-03 16:23:46 -05:00
Zack Middleton
466952b320 Fix Linux uninstaller requiring Bash
Linux loki-setup uninstaller is failing on distros that have /bin/sh
linked to Dash instead of Bash. Use standard shell method for
redirecting stdout and stderr instead of a Bash specific method.
2018-06-03 15:47:39 -05:00
Zack Middleton
ce1d5406d5 Require OpenGL 1.2 for GL_CLAMP_TO_EDGE 2018-05-28 17:20:27 -05:00
Zack Middleton
77de5019b9 Don't create multiple windows when GL context creation fails 2018-05-28 17:07:38 -05:00
Zack Middleton
4fa93fbfd4 Fix client kicked as unpure when missing the latest cgame/ui pk3s
In 2013 ioquake3 stopped referencing the pk3 file that qagame.qvm was
loaded from. This had the unintended side affect of causing
non-dedicated pure servers to no longer reference a pk3 that only
contains the three QVM files.

Non-dedicated pure servers did not reference the pk3 containing the
latest cgame.qvm so if client did not have the pk3 file they were kicked
as unpure instead of the client trying to download the pk3 file.

Also make server touch ui.qvm since it's required to pass pure check and
may be separate from cgame.qvm.
2018-05-22 14:43:11 -05:00
SmileTheory
c0c45d325d OpenGL2: Readd r_deluxeSpecular.
https://github.com/ioquake/ioq3/issues/369
2018-05-14 18:30:59 -07:00
Zack Middleton
60a3112e45 Fix console offset while Team Arena voiceMenu is open
Fix console text being on top of the Tema Arena voice chat head in
screen resolutions higher than 640x480.
2018-05-14 00:22:58 -05:00
Zack Middleton
f4db711024 Use SDL 2.0.1 headers for macOS ppc64
The libSDL2-2.0.0.dylib in repo doesn't support ppc64 though.

Based on patch by MAN-AT-ARMS.
2018-05-12 13:41:35 -05:00
Zack Middleton
ffd9ce1902 Limit -maltivec to specific source files on OpenBSD too (untested) 2018-05-12 13:30:40 -05:00
Simon McVittie
5909b9a1cf Isolate the Altivec code so non-Altivec PPC targets can use the same binary.
Moved all the code using Altivec intrinsics to separate files. This 
means we can optionally use GCC's -maltivec on just these files, which
are chosen at runtime if the CPU supports Altivec, and compile the rest
without it, making a single binary that has Altivec optimizations but
can still work on G3.

Unlike SSE and similar extensions on x86, there does not seem to be
a way to enable conditional, targeted use of Altivec based on runtime
detection (which is what ioquake3 wants to do) without also giving the
compiler permission to use Altivec in code generation; so to not crash
on CPUs that do not implement Altivec, we'll have to turn it off
altogether, except in translation units that are only entered when
runtime Altivec detection is successful.

This has been tested on Linux PPC (on an Altivec-enabled CPU),
but we may need further work after testing trickles out to other
PowerPC devices and ancient Mac OS X builds.

I did a little work on this patch, but the majority of the effort belongs 
to Simon McVittie (thanks!).
2018-05-12 14:14:47 -04:00
Zack Middleton
2326a060b9 Don't allow SDL audio capture using pulseaudio
When you start recording using SDL pulseaudio driver the client sends
all audio captured while not recording. 240 milliseconds of audio is
sent each frame until the capture buffer is empty. This is a problem for
privacy and causes confusing to debug VoIP playback issues on other
clients connected to server and when playing back demos.
2018-05-12 04:20:58 -05:00
Zack Middleton
42d2fb908c OpenGL2: Fix parsing specularScale in shaders
Fix specularScale <metallic> <smoothness> with r_pbr 1 which has been
broken since r_pbr was implemented in 2016.

Fix specularScale <r> <g> <b> <gloss> setting b to gloss and leaving
gloss as 0 since it was implemented in 2014.
2018-05-11 23:18:39 -05:00
Zack Middleton
10abac8fa0 Fix duplicate bots displayed in Team Arena ingame add bot menu
The key handler allowed going 2 beyond the end of the bot list and the
display function clamped to 0 causing the first bot to be shown 3 times.

Attempting to add the bot in gametypes < GT_TEAM would fallback to
Sarge in UI_GetBotNameByNumber() (who isn't the first bot) and gametypes
>= GT_TEAM would access characterList past known values (typically NULL
but if teaminfo.txt contained 63 characters it would access out of
bounds memory).
2018-05-06 01:47:49 -05:00
Zack Middleton
da861ff3a2 Fix not closing description.txt and fix path seperator
0 length description.txt files were not closed.
2018-05-03 16:13:19 -05:00
Zack Middleton
51743bbb01 Improvements for dedicated camera followers (team follow1/2)
Switching to dedicated camera follower with no possible players to
follow would spawn at the intermission point and display "connection
interrupted" HUD message. Pmove() was not run for the client so
ps.commandTime was too far behind. I made it so that dedicated camera
followers and scoreboard run Pmove() but cannot move (PM_FREEZE).

When all players possible to follow leave, the dedicated camera follower
would continue to display the old player state of the player they were
following (along with "connection interrupted" HUD message). Unlike the
regular case of a spectator following a specific player, dedicated
camera followers did not reset their player state to the intermission
point after the followed player was no longer valid.

Now a client can be set as 'team follow1' to automatically switch
between displaying the intermission point and following a player when
possible.
2018-05-01 21:25:14 -05:00
Zack Middleton
f3f29e9670 Make s_useOpenAL be CVAR_LATCH
After changing s_useOpenAL the sound needs to be restarted (snd_restart)
for it to take affect.
2018-05-01 16:18:44 -05:00
Zack Middleton
45f8512f8e Fix clearing keys for control in Team Arena UI
When a control is selected for binding a key, pressing backspace would
clear the displayed keys in the menu but not actually unbind the keys.
2018-04-26 11:47:11 -05:00
Zack Middleton
1caf1fb875 Fix compiling Makefile (broke in macOS frameworks commit) 2018-04-26 11:47:11 -05:00
IR4T4
9b2df26024 Fix array index in CanDamage() function - discovered by MARTY
The wrong array element was accessed. However the correct element is the
same value so fixing it does not affect gameplay.
2018-04-26 11:31:07 -05:00
Zack Middleton
3bc3fa1b3b Fix compiling against macOS system OpenAL and SDL2 frameworks 2018-04-26 11:23:47 -05:00
Zack Middleton
7ad05ccf2d Make UI_DrawProportionalString handle NULL string
This makes the function consistent with UI_DrawString.
2018-04-26 11:22:55 -05:00
Zack Middleton
05758d52f4 Remove unnecessary NULL pointer check in Cmd_RemoveCommand 2018-04-26 11:22:55 -05:00
Zack Middleton
a82a99f68d Fix uninitialized bot_goal_t fields 2018-04-26 11:22:55 -05:00
Zack Middleton
e9e11f1605 Fix possible bot goal state NULL pointer dereference 2018-04-26 11:22:55 -05:00
Zack Middleton
9a0ee67e04 Make macOS Universal Bundle target 10.6 for x86 and x86_64
SDL 2.0.5 dropped support for macOS 10.5 so target 10.6 instead. The
PPC build uses SDL 2.0.1 so it still targets 10.5. macOS 10.5 (x86,
x86_64) should automatically run the PPC build using Rosetta.

Revert MAN-AT-ARMS' change to SDL 2.0.8 SDL_platform.h that allowed
targeting macOS 10.5 for the sake of PPC. It also incorrectly allowed
x86 and x86_64 to target 10.5 as well. (Also macOS PPC uses separate
headers now.)
2018-04-26 11:21:36 -05:00
Zack Middleton
92935df37b Enable SDL audio capture for SDL 2.0.5 and newer
The version check is required for supporting macOS PPC with SDL 2.0.1
and Travis-CI (Ubuntu Trusty) with SDL 2.0.2.

The client now requires SDL 2.0.5 runtime if compiled against SDL 2.0.5
or newer.
2018-04-26 11:21:36 -05:00
Zack Middleton
45af2594a0 Add SDL 2.0.1 headers for macOS PPC
code/libs/macosx/libSDL2-2.0.0.dylib has 2.0.8 for x86 and x86_64 and
2.0.1 for PPC. Add 2.0.1 headers for PPC with modifed SDL_platform.h to
allow compiling using macOS 10.5 SDK. Using separate headers allows the
engine to check the SDL version for enabling newer SDL features.
2018-04-26 11:21:36 -05:00
MAN-AT-ARMS
5bf60a9504 Update SDL2 to 2.0.8 2018-04-26 11:21:36 -05:00
Ryan C. Gordon
8bd2c79109 Disable SDL audio capture until prebuilt SDL libraries are updated to 2.0.8. 2018-04-14 00:56:36 -04:00
Ryan C. Gordon
78c70d0afc Use the SDL2 audio device interface instead of the legacy 1.2 API.
This is a little bit of future-proofing, but also gives us a little more
flexibility in general; now we can add in the cvars to open a specific
device, etc, that the OpenAL codepath does.
2018-04-13 22:47:29 -04:00
Ryan C. Gordon
69f92daf08 Added audio capture support to SDL backend.
This lets you speak through VoIP when not using OpenAL. Previously you could
listen but not speak.
2018-04-13 22:38:17 -04:00
Ryan C. Gordon
2f62394174 There's no need to SDL_PauseAudio(1) before calling SDL_CloseAudio(). 2018-04-13 21:32:51 -04:00
Ryan C. Gordon
62acfb3348 sdl_snd.c should just initialize SDL audio without checking SDL_WasInit().
In SDL2, the initialized subsystems are referenced counted, so it's safe to
initialize them twice, and it makes the SDL_QuitSubSystem during our shutdown
correctly decrement the count. Before (as a probably-harmless bug), it would
not increment the refcount if the subsystem was already initialized, causing
problems when it decremented it later.
2018-04-13 21:30:26 -04:00
Ryan C. Gordon
4f8c7c2f2f Support SDL audio devices that require float32 samples.
Fixes missing audio when playing on Windows with SDL 2.0.7, which started
using WASAPI, which demands floating point audio.
2018-04-13 14:05:12 -04:00
Zack Middleton
3377f9981a Fix map list in Team Arena start server menu after entering SP menu
In September 2017 I moved loading arenas.txt/*.arena files from entering
start server menu to at startup to fix running out of memory in Team Arena
UI after opening the start server menu several times.

However, Team Arena completely replaces the uiInfo.mapList array when
switching between single player and start server menus. So after my
change, entering single player and then entering start server would only
display single player maps. It caused SP endofgame menu to use MP map
list for replay/next map since arenas were loaded after gameinfo.txt.

Continue loading arena info at start up to avoid reallocating arena info
but move setting up uiInfo.mapList to when entering the start server
menu.
2018-04-12 01:04:54 -05:00
Zack Middleton
dfb49e78b5 Make setting r_stencilbits more consistent in Team Arena UI
I changed Color Depth options 'Default' to reset r_stencilbits instead
of 0 and '32 bit' to use r_stencilbits 8 instead of not changing the
value. (This matches my q3_ui changes in the previous commit.)

Set r_stencilbits when changing graphics presets like when changing
Color Depth.
2018-04-11 02:07:27 -05:00
Zack Middleton
61404e25c4 Restore setting r_colorbits in q3_ui
In 2007 in ioquake3 unified-sdl branch (revision 1144) setting
r_colorbits in q3_ui was removed but the Color Depth menu option was
still kept. Setting r_colorbits was not removed from the Team Arena UI.

In 2011 I removed the Color Depth menu option from q3_ui as it did not
change any cvars. Yesterday I restored the option not realizing this
and thinking that requesting 16-bit color depth worked.

Add setting r_colorbits back to q3_ui so Color Depth menu option works
again. I changed Color Depth options 'Default' to reset r_stencilbits
instead of 0 and '32 bit' to use r_stencilbits 8 instead of not changing
the value.

However I discovered r_colorbits 16 does not actually work on my system
(Debian Jessie x86_64 nvidia). ioquake3 was reporting the requested
value instead of the actual obtained value. Fixed in my previous commit.
2018-04-11 02:05:55 -05:00
Zack Middleton
7e9b92de12 Fix displayed color/depth/stencil bits values
The values passed to SDL are just the minimum required. Get actually
values of colorbits, depthbits, and stencilbits from SDL instead of
assuming that the engine got exactly what it asked for.
2018-04-11 01:26:00 -05:00
Zack Middleton
43602a7eb8 Revert "Removed "Color Depth" from q3_ui system settings, it didn't control anything."
The r_colorbits cvar still exists and gfxinfo reports it works on
Debian Jessie in both git master and building the commit where I
removed r_colorbits from q3_ui. So it does indeed control something.
Maybe I expected 16-bit color to look different? I don't know.

This reverts my commit 8e689739f4
from August 11 2011.
2018-04-09 16:31:32 -05:00