Commit graph

1821 commits

Author SHA1 Message Date
Simon McVittie
c61e2983fc sdl/input: Fix spelling and grammar in a log message
The misspelling of "controller" was detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@debian.org>
2018-06-12 12:17:35 +01:00
Yamagi Burmeister
8e1f8fc7c6 Deprecate SDL 1.2.
We're going to remove support for SDL 1.2 shortly after the next
release. Give the last remaining users a very clear warning about
it, error out at force them to edit the code.
2018-06-07 07:39:20 +02:00
Yamagi Burmeister
bb146a8384 Remove unused LIBGL define. 2018-06-07 07:19:02 +02:00
Denis Pauk
e5ef665e09 Use more short code in *EdgeSearch 2018-05-20 13:55:04 +03:00
Denis Pauk
466364589d Use constants for x/y/z shifts 2018-05-20 13:55:04 +03:00
Denis Pauk
2412363001 Add some comments from Fabien Sanglard article 2018-05-20 13:55:04 +03:00
Denis Pauk
1ea3fdc1a2 We have enough memory, skip Com_PageInMemory 2018-05-20 13:55:04 +03:00
Denis Pauk
b0b0265e4b Move Surf Search to separate functions 2018-05-20 13:55:04 +03:00
Denis Pauk
4fd37b73ca Define NUM_MIPS=4 instead hardcoded value 2018-05-20 13:55:04 +03:00
fabiensanglard
184ff91453 Added Unreal kernel filtering. 2018-05-20 13:55:04 +03:00
Denis Pauk
96a81f64f9 little speed up 2018-05-20 13:55:04 +03:00
Denis Pauk
56ea94978d [-pedantic] fix compilation waring about static array initialization
warning: string length ‘16384’ is greater than the length ‘4095’
ISO C99 compilers are required to support [-Woverlength-strings]
2018-05-20 13:55:04 +03:00
Denis Pauk
f48e3e5b4d Use real height/width instead warp dimensions 2018-05-20 13:55:04 +03:00
David Carlier
2f0c2f8981 - Fix addrinfo leaks. 2018-05-01 10:17:20 +00:00
Daniel Gibson
1e3135d4fc r_gunfov shouldn't be CVAR_USERINFO, only CVAR_ARCHIVE
this happens when you just copypaste and adapt r_lefthand

also did some minor changes to R_AliasDrawModel in the soft renderer
to make sure alias[xy]scale is reset properly in the early out cases
2018-04-27 23:42:27 +02:00
Daniel Gibson
12a8da7180 r_gunfov for the software renderer 2018-04-21 21:35:13 +02:00
Daniel Gibson
c59c1bfda1 Fix Rogue heatbeam rendering at high FOVs 2018-04-21 20:19:42 +02:00
Daniel Gibson
a5e97682a3 Weapon field of view independent of 'fov': r_gunfov cvar
At high 'fov' values the weapon looked quite distorted.
Now it's rendered with an independent FOV, which looks better.
Note that the 'fov' cvar sets fov_x, while this is based on fov_y
(which is calculated from fov_x), so it's indeed different values:
r_gunfov seems to correspond to fov 90.
We use r_gunfov 80 as default, because it looks better.
2018-04-21 18:23:32 +02:00
Denis Pauk
189a34e707 Add custom particle shape by sw_custom_particles.
0 - use rectangle (default shape)
 1 - use hexagon
2018-04-13 23:29:56 +03:00
Denis Pauk
23d25db601 Little different shape of particle 2018-04-10 23:24:53 +03:00
Denis Pauk
14c934762d use one function for any mip levels 2018-04-10 23:13:38 +03:00
Denis Pauk
cd6c686980 Use multiple for particle sizes 2018-04-10 23:09:36 +03:00
Denis Pauk
758ab07a38 look to height instead width 2018-04-10 23:06:54 +03:00
Denis Pauk
14af679b7e Add size checks for WAL load 2018-04-10 22:59:13 +03:00
Denis Pauk
511b73baf9 Particle fixes from q2dos and kmquake
Authors: maraakate <emoaddict15@gmail.com>
         Knightmare <knightmare66@yahoo.com>
2018-04-10 22:59:13 +03:00
maxice8
2365d4705f fix compilation on musl libc. 2018-03-29 10:29:30 -03:00
Yamagi Burmeister
c11149730c Bump version number to 7.21pre. 2018-03-10 18:26:07 +01:00
Yamagi Burmeister
c0291746b0 Bump version number to 7.20. 2018-03-10 18:24:21 +01:00
Daniel Gibson
3a641c8beb "/currentmap" command that prints the currently loaded map 2018-03-10 16:38:37 +01:00
Yamagi Burmeister
808a208de4 Disconnect when we're connected before starting an new game.
The old code was working only when the client was connected to a local
server. The 'newgame' executed by the menu expands to a 'map', loading
a map ends in SV_InitGame() which calls CL_Drop() on the local client.
That calls CL_Disconnect() and everything is okay.
When the client is already connected to a remote server and no local
server is running the 'map' command spawns a new local server. This
new server thinks "Hey, I'm a new local server and no one is connected
to me. Let's pull the client in!". So it pull the already connected
client onto a new server without disconnecting, smashing it's state.
And everything goes down in flames.

The correct way would be to execute a 'disconnect' right before the
'newgame'. But the 'disconnect' cmd calls CL_Disconnect_f that throws
an ERR_DROP. ERR_DROP is implememted through a longjump(), jumping
around puts the process internal state in ashes... So bite the bullet
and add another hack: Call CL_Disconnect() before executing 'newgame'.
2018-03-07 21:49:58 +01:00
Yamagi Burmeister
ed54fe2364 Fix '/connect $server' while connected to a server. 2018-02-27 19:17:45 +01:00
Yamagi Burmeister
8ff7109b9d Rename forgotten gl_modulate and gl_farsee cvars in the GL3 renderer. 2018-02-25 10:38:04 +01:00
Yamagi Burmeister
2db01319a1 Fix changing the game / mod through the 'game' console command.
The 'game' command was more or less functional after the last commit.
We just need to reset the initialGame (renamed to userGivenGame) so we
don't revert back to the old game at server disconnect.
2018-02-25 10:24:35 +01:00
Daniel Gibson
f0e21e2ab4 Fix writing/loading configs when changing game/mod
When connecting to a multiplayer game that runs a different mod
("game" cvar) than you are, it didn't load the corresponging configs
from the mod, but saved your changes to the config to the mod's config.
Which is doubly useless.
Now when the "game" cvar is changed, the configs are reloaded (from
the right directories for the mod), and when disconnecting the configs
are written, so the changes you did for a mod while playing MP are saved
before game is reset to the game you started with.
2018-02-24 21:00:35 +01:00
Yamagi
c68aade396
Merge pull request #275 from 0lvin/3dhaptic
Use  SDL_HAPTIC_CARTESIAN as effect direction.
2018-02-15 07:35:58 +01:00
Daniel Gibson
3acf5f0cba VID_WriteScreenshot() PNG compression level must be < 10
10 is no valid zlib compression level, so make sure it's not used

Thanks to @maraakate for pointing this out!
2018-02-15 00:39:43 +01:00
Denis Pauk
80616a418e Reuse SWimp_Init from refresh.c 2018-02-14 23:07:20 +02:00
Denis Pauk
b376c7e0d2 correctly exit if have not found console fonts 2018-02-14 23:07:20 +02:00
Denis Pauk
24b7cb3529 Remove unused K_WORLD_* from Q_KEYS 2018-02-14 23:07:20 +02:00
Denis Pauk
c68fd0be5b Add 3d haptic/SDL_HAPTIC_CARTESIAN with distance and orientation 2018-02-14 23:07:20 +02:00
Yamagi Burmeister
ec1733fb97 Rename 'intensity' to 'gl1_intensity', 2018-02-14 09:35:54 +01:00
Yamagi Burmeister
278ff83ad4 Always initialize the busywait cvar. 2018-02-13 21:37:50 +01:00
Yamagi Burmeister
dd43f88450 Take time used to process render and packetframes into account.
Until now we did an easy calculation to determine the frame timing:
1000000 microseconds (== 1 second) / targetframerate == delay between
frames. This works if the CPU and GPU are fast enough since the time
process to process the frame is negligible. But if one of them is too
slow or the GPU driver takes too long (see issue #277 for an example)
we render too few frames.

Work around this by calculating the average time used to process the
last 60 render oder packet frames and take that into account when
determining the delay between the frames. With this change even my
rotten AMD Radeon and it's broken Windows GL driver is able to hold
the displays famerate (enforced by vsync) just fine.

While here add a 5% security margin to our target packet frame rate if
the vsync is enabled. Just to be sure that we never process more render
than packet frames.
2018-02-13 17:36:15 +01:00
Yamagi Burmeister
b80ff7f40c Implement a 'busywait' cvar to force the client and server to busy wait.
Sleeping with Sys_Nanosleep() is fair enough but has the problem that we
may get scheduled away and the hosts power management inteferes with our
interal timings. While this wasn't a big issue on FreeBSD and Linux it
let to serious timing issues in Windows.

There're several reports in the net, apperently everything below 5ms is
very inaccurate on Windows:
* https://stackoverflow.com/questions/7827062/ \
   is-there-a-windows-equivalent-of-nanosleep/7827446#7827446
* https://lists.gnu.org/archive/html/bug-gnulib/2010-04/msg00045.html
2018-02-13 17:36:15 +01:00
Yamagi Burmeister
832f3f6497 Implement vid_displayrefreshrate to override the displays refresh rate.
Modern LCD displays often haven't itegral refresh rates like 60hz but
fractional ones  like 59.95hz. SDL communicates the refresh rate as
integer. On X11 the rate is rounded up or down with round(), but on
Windows it's (at least on my system with an AMD Radeon) truncated...
So on an 59.95hz display it's just 59hz, Quake II renders 0.95 frames
too few and the user sees microstutters.

And return the actual / requested display frame rate increased by one
to work around inaccuracies in Quake IIs internal timing. It should be
a problem if we're running a little bit too fast.

This is belived to fix at least a part of issue #277.

Refreshrate 2
2018-02-13 17:36:15 +01:00
Yamagi
f0240af308
Merge pull request #278 from DanielGibson/remember-addressbook
Don't forget entries of Multiplayer "Address Book"
2018-02-13 17:35:59 +01:00
Daniel Gibson
c2061e8c83 Use const char* instead of char* in NET_StringToAdr() 2018-02-12 13:37:58 +01:00
Daniel Gibson
1c7b02cc85 Make sure Q2 doesn't "forget" contents of server "address book"
The problem was that the cvars were only initialized (with CVar_Get())
if you opened the address book menu.
So if you start (and possibly run) and quit the game /without/ opening
that menu (or at least the "join network server" menu), the game will
not save those cvars to the config when it next writes it.

To prevent this, *always* initialize the cvars in M_Init().
2018-02-12 01:03:06 +01:00
Yamagi Burmeister
a1aac4e56d Fix stupid bug in e30f824. :(
It's VectorCopy(src, dest) and not the other way round. Clion noticed
that, but neither clang nor gcc complained that tmp was used
unitialized.
2018-02-07 19:02:13 +01:00
Yamagi Burmeister
17a5106492 Unicode compatibility for zlib on Windows.
There were two ways to implement this. One was to go with the stuff
already included in minizip and one to implement our own wrapper around
fopen(). This is the second options since @DanielGibson convinced me
that it would be safer.
2018-02-06 18:44:44 +01:00
Yamagi Burmeister
716d72a295 Update minizip to version 1.2.11. 2018-02-06 15:11:36 +01:00
Yamagi Burmeister
495b7c5d6b Save some CPU cycles and apply the cvar replacements only once. 2018-02-05 18:30:45 +01:00
Yamagi Burmeister
582c1062cb Fix an "Unused variable" warning. 2018-02-05 18:29:29 +01:00
Yamagi Burmeister
ba4f91f619 Fix a compiler warning on 32 bit.
Hopefully we'll never allocate more than 2^32 bytes of memory for
surfaces. :)
2018-02-05 18:27:34 +01:00
Yamagi Burmeister
1e6f790d51 Make the stdout and stderr redirects unicode aware. 2018-02-05 18:20:41 +01:00
Yamagi Burmeister
3b810ba51e Convert stb_image_write.h to Q_fopen() to be able to create screenshots. 2018-02-05 18:10:22 +01:00
Yamagi Burmeister
6b13d77c36 Change the current working directory before writing save games.
We can't rely on the game.dll being unicode conformant. Work around
that by changing the current working directory before calling into
the game.dll, pass a non unicode string to it and chang back after
we return.
2018-02-05 18:00:28 +01:00
Yamagi Burmeister
3634ed7013 Implement -datadir, deprecate the basedir cvar.
To be able to pass UTF-8 encoded pathes through cvars both the cvar
subsystem and the command parser would need a fair amount of UTF-8
understanding. And I'm not the poor soul that's going to implement
that. Therefor pass the datadir trough a global variable.
2018-02-05 16:19:02 +01:00
Yamagi Burmeister
efcaf17f69 Make SetExecutablePath() on Windows unicode compatible. 2018-02-05 10:01:21 +01:00
Yamagi Burmeister
a87e34906c Implement Q_fopen() for Windows.
This is done in shared.c so that's available for both the client /
server / renderer and the game. A work around for older game DLL will
be added at a later time.
2018-02-05 09:36:33 +01:00
Yamagi Burmeister
37ea3e1d58 Introduce a wrapper Q_fopen() and replace fopen() with it.
On Unix platforms unicode is implemented through UTF-8 which is
transparent for applications. But on Windows a UTF-16 dialect is
used which needs alteration at application side. This wrapper is
another step to unicode support on Windows, now we can replace
fopen() by a function that converts our internal UTF-8 pathes to
Windows UTF-16 dialect.

This is a noop for Unix platforms. The Windows build is broken,
the compiler errors out in shared.h. This will be fixed in a
later commit.

Caveats:
* fopen() calls in 3rd party code (std_* and unzip) are not replaced.
  This may become a problem. We need to check that.
* In the Unix specific code fopen() isn't replaced since it's not
  necessayry.
2018-02-05 07:43:26 +01:00
Yamagi Burmeister
bcb7364507 Convert library loading to widechars. 2018-02-04 17:06:49 +01:00
Yamagi Burmeister
a1ba33e6d9 Declare is_portable only once in frame.c and not in each backend. 2018-02-04 16:48:40 +01:00
Yamagi Burmeister
b3562015b0 Remove Sys_SendKeyEvents().
That function did nothing, we can just call IN_Update() directly...
2018-02-04 16:45:32 +01:00
Yamagi Burmeister
54ab3f75db Don't use a DOS path for the home directory, but a UTF-8 path.
With this commit YQ2 is able to start and run on ReFS volumes. :) At
least as long as neither the binary path, the game data path nor the
path to the users home directory contain anything but ASCII characters.

Please note: This make break some corner cases with hore directories
containting unicode characters. They worked until now by pure luck.
A better solution providing full unicode support will be committed
in the next few days.
2018-02-04 13:22:27 +01:00
Yamagi Burmeister
4ca38f92fa Convert Sys_Mkdir from DOS to WinAPI.
With this we're able to create directorys with Unicode characters
anywhere in the path.
2018-02-04 13:04:31 +01:00
Yamagi Burmeister
e8c3686e4c Use MAX_OSPATH instead of MAX_QPATH.
Those are external pathes, not internal ones. MAX_QPATH with only 64
characters is much to small for them.
2018-02-04 12:59:10 +01:00
Yamagi Burmeister
0eca30cb96 Convert the Sys_Find*() functions from the old DOS interface to WinAPI.
This brings at least two big advantages:

* No more 8.3 filename fuckups. Until know base0.pak and base0.pak_bak
  was the same file for Quake II because only the first 3 characters of
  the file extension were taken into account.
* Search pathes can contain any Unicode character.
2018-02-04 12:53:50 +01:00
Yamagi Burmeister
e9615608a8 Remove CompareAtributes().
There's no need to exclude directories from search by flags. In fact
the Unix backend has worked nicely for years without it... Sadly we
can't remove the now superfluous 'canhave' and 'musthave' attributes
from Sys_FindFirst() and Sys_FindNext() since they're defined in
shared.h and may be used from custom game DLLs.
2018-02-04 11:49:03 +01:00
Yamagi Burmeister
a65401d1af Rename mem.c to hunk.c.
hunk.c better describes the purpose of the code and matches the unix
backend.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister
2096d57eb8 Cleanup the system specific code.
* Remove a bunch of unnecessary functions.
* Reorder functions into logical groups. The orderig is now the same
  on Unix and Windows.

While at it add several TODOs to the code. There's not need for special
library loading functions for the game, the Windows backend still uses
a lot of old and fishy DOS functions, etc. All this will be done at a
later time.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister
acb50c6907 Move the platform independent stuff from main() into Qcommon_*().
There's no need to duplicate machine independent parts of the client
initialization and the main loop for every platform.

While at it remove the nearly empty unix.h header and move Windows
main() into an own file. Not both platform have the same basic layout.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister
bed6439d19 Convert the quake2.exe wrapper to a Windows GUI application.
While building the wrapper as a console application is completely fine
there're some advantages by creating a "real" Windows GUI Application:

* Console applications always spawn an annoying console window.
* Windows GUI applications seem to have a much lower chance to trigger
  my new best friend, the Windows Defender. As a console application
  quake.exe triggered every time I started it, as Windows GUI
  application not only once.

Use WinMain() instead of wWinMain() because MinGW doesn't know about
the later and it doesn't matter anyways.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister
7ee34acae8 Remove winquake.h
The only thing that header did was to include windows.h.
2018-02-04 11:35:10 +01:00
Yamagi Burmeister
cfddff132b Switch the windows backend SDLmain.
libSDLmain.a has to be linked and must run anyways. So there's no need
for us to reinvent the wheel, just rely on SDLs process setup, argument
parsing, message handling and so on. As a nice side effect this may fix
some strange bugs related to message handling and argument parsing...
2018-02-04 11:35:10 +01:00
Daniel Gibson
833738b7e7 Update stb_image_write.h to latest release (1.08)
My modifications (jpeg writing and supplying zlib compressor for better
PNG compression) have been merged upstream, so from now on updates
should be easy and painless.

(Sean renamed my stbi_png_level to stbi_write_png_compression_level)
2018-02-04 00:03:51 +01:00
Yamagi Burmeister
601a06f728 Introduce in_grab 3, always ungrap the mouse in console, menu, etc.
Until now we had 3 modes:
 0 -> never grab the mouse.
 1 -> always grab the mouse
 2 -> ungrab the mouse if the game is windowed and the console or the
      menu is opened or a cinematic is playing.

The 3rd mode is the same as the 2nd one, but without the "game is
windowed" constrained. Please note that release the mouse grab in
fullscreen may have side effects like the game loosing focus and being
unable to regain it. Especially under X11.

This was requested by @prg318 in issue #271.
2018-02-03 09:20:58 +01:00
Yamagi Burmeister
a496ad8d62 Update HandmadeMath.h to it's latest version. 2018-02-03 08:41:46 +01:00
Yamagi Burmeister
5763784c20 Update stb_image.h to it's latest version. 2018-02-03 08:38:32 +01:00
Yamagi Burmeister
20f49f515b Don't compare a qboolean against an integer.
That only works by accident.
2018-02-03 08:36:07 +01:00
Yamagi Burmeister
21fcb48565 Fullscreen has been an integer for some time now.
At least since we introduced support for mod changing and for scaling
fullscreen.
2018-02-03 08:33:16 +01:00
Denis Pauk
d3f93e6786 Clean up unused code 2018-01-21 22:39:02 +02:00
Denis Pauk
9d9dd6b02a Fix typo 7ace8c9116 2018-01-21 22:39:02 +02:00
Denis Pauk
bf19c8b50c fix -O3 warning. Fix indexes in vtx.
Loop 'for ( i = 0; i < 3; i++ )' sets values to vtx[0..2]. So next index must be 3(instead 4) and
loop 'for ( i = 16; i >= 0; i-- )' will set vtx[3..(18*3-1)].

=====
src/client/refresh/gl/r_light.c: In function ‘R_RenderDlight’:
src/client/refresh/gl/r_light.c:76:21: warning: iteration 16 invokes undefined behavior [-Waggressive-loop-optimizations]
    vtx[index_vtx++] = light->origin [ j ] + vright [ j ] * cos( a ) * rad
    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + vup [ j ] * sin( a ) * rad;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/client/refresh/gl/r_light.c:65:2: note: within this loop
  for ( i = 16; i >= 0; i-- )
  ^~~
=====
2018-01-21 22:39:02 +02:00
Daniel Gibson
54861bf4b7 quake2.exe wrapper
Apparently something (possibly nvidia's driver) on some windows
installations has some stupid application profile for quake2.exe that
breaks mouse input if the console has been opened..

Our workaround is to rename quake2.exe to yquake2.exe and provide a wrapper
quake2.exe that just calls the real one for backwards compatibility.
This is the source of that wrapper.
2018-01-21 16:40:05 +01:00
Yamagi Burmeister
472f55c5bf Move the softrenderer constants into out constants/ dir. 2018-01-11 11:15:11 +01:00
Yamagi Burmeister
5592da9206 Rename all soft renderer files from r_* to sw_*. 2018-01-11 11:09:00 +01:00
Yamagi Burmeister
0e8b58952a Rename the gl/ directory to gl1/.
This is not strictly necessary but since we're calling it GL1 let's
stay consistent between the name and the directory structure.
2018-01-11 10:58:32 +01:00
Yamagi Burmeister
d21fbeb932 Rename all GL1 files from r_* to gl1_*. 2018-01-11 10:49:08 +01:00
Yamagi Burmeister
17f289c761 There's no need for the softrenderer to be build conditionally.
We want to build the softrenderer each time and on all platforms.
Building it only at user request will lead to code rot.
2018-01-10 10:33:24 +01:00
Yamagi Burmeister
1ed7762edd Implement custom modes in the software renderer.
This is mostly the same approach as in GL1. I'm not quite sure if the
software rasterizer can work with all aspects and the like but I wasn't
able to crash it by trying several random resultions.
2018-01-09 19:38:00 +01:00
Yamagi Burmeister
cf03e755d3 Implement r_vsync for the softrenderer.
Whenever the r_vsync cvar is changed recreated the SDL renderer with the
appropriate flags.
2018-01-09 18:44:55 +01:00
Yamagi Burmeister
3df860983f Implement r_modulate in the software renderer.
This is the same implementation as in GL1. In fact the code was
basically there, only the cvar itself was missing. Maybe for performance
reasons?
2018-01-09 18:23:29 +01:00
Yamagi Burmeister
e01e9a0b94 Rename gl_ztrick to gl1_ztrick. 2018-01-09 15:58:05 +01:00
Yamagi Burmeister
24b014715f Rename gl_texture*mode to gl1_texture*mode. 2018-01-09 15:54:27 +01:00
Yamagi Burmeister
b87465886e Rename gl_swapinterval to r_vsync. 2018-01-09 15:01:06 +01:00
Yamagi Burmeister
74ac58eb5a Rename gl_stereo* to gl1_stereo*. 2018-01-09 14:51:59 +01:00
Yamagi Burmeister
70ca5b2ade Rename gl_saturatelightning to gl1_saturatelightning. 2018-01-09 14:39:42 +01:00
Yamagi Burmeister
aa6c1826db Rename gl_round_down to gl1_round_down. 2018-01-09 14:36:51 +01:00
Yamagi Burmeister
6c880bcf1f Rename gl_polyblend to gl1_polyblend. 2018-01-09 14:34:27 +01:00
Yamagi Burmeister
bbe4fe0b68 Rename gl_pointparameters to gl1_pointparameters. 2018-01-09 14:31:45 +01:00
Yamagi Burmeister
be94b5612f Rename gl_picmip to gl1_picmip. 2018-01-09 14:29:02 +01:00
Yamagi Burmeister
171e592693 Rename gl_particle* to gl1_particle*. 2018-01-09 14:26:11 +01:00
Yamagi Burmeister
4061e85cd7 Rename gl_palettedtexture to gl1_palettedtexture. 2018-01-09 14:19:00 +01:00
Yamagi Burmeister
f0c4b4fd14 Rename gl_overbrightbits to gl1_overbrightbits. 2018-01-09 14:16:13 +01:00
Yamagi Burmeister
526904ca03 Rename gl_modulate to r_modulate. 2018-01-09 14:09:34 +01:00
Yamagi Burmeister
11ad28b711 Unify gl_mode and sw_mode in r_mode. 2018-01-09 14:03:45 +01:00
Yamagi Burmeister
e6b0e19cff Rename gl_maxfps to vid_maxfps. 2018-01-09 09:47:03 +01:00
Yamagi Burmeister
78ff99dd86 Rename gl_polyblend to gl1_polyblend and unite *_lockpvs to r_lockpvs. 2018-01-09 09:44:06 +01:00
Yamagi Burmeister
3a4496c239 Rename gl_farsee to r_farsee. 2018-01-09 09:32:07 +01:00
Yamagi Burmeister
d2b3030cfe Rename gl_dynamic to gl1_dynamic and remove it from GL3. 2018-01-09 09:29:33 +01:00
Yamagi Burmeister
03098715ee Rename gl_custom* to r_custom*. 2018-01-09 09:25:29 +01:00
Yamagi Burmeister
ae9d7e397f Rename gl_*scale to r_*scale. 2018-01-09 09:19:39 +01:00
Yamagi Burmeister
49fae3c25c Rename gl_clear to r_clear. 2018-01-09 09:09:52 +01:00
Yamagi Burmeister
be569dcaba Rename gl_speeds to r_speeds. 2018-01-06 18:42:40 +01:00
Yamagi Burmeister
679e556b4f Rename gl_speeds to r_speeds. 2018-01-06 18:40:50 +01:00
Yamagi Burmeister
214c473de0 Rename gl_novis no r_novis. 2018-01-06 18:38:30 +01:00
Yamagi Burmeister
b453ec5372 Rename gl_norefresh to r_norefresh. 2018-01-06 18:35:03 +01:00
Yamagi Burmeister
f8c71af0cf Rename gl_lightlevel to r_lightlevel. 2018-01-06 18:31:06 +01:00
Yamagi Burmeister
8a83c92044 Rename gl_lerpmodels to r_lerpmodels. 2018-01-06 18:25:53 +01:00
Yamagi Burmeister
55889e4abb Rename gl_fullbright to r_fullbright. 2018-01-06 17:03:59 +01:00
Yamagi Burmeister
773147524b Rename gl_drawworld to r_drawworld. 2018-01-06 16:59:47 +01:00
Yamagi Burmeister
aa4d92e8dd Rename gl_drawentities to r_drawentities. 2018-01-06 16:53:45 +01:00
Yamagi Burmeister
54fc79e6b1 Remove unused function Cvar_CompleteVariable(). 2018-01-06 16:36:28 +01:00
Yamagi Burmeister
226e5922b9 Rename cl_drawfps to cl_showfps, to be consistent with other cvar.
And ensure that a nice message is printed to the console if anyone
enters the old cvar.
2018-01-06 16:26:28 +01:00
Yamagi Burmeister
7ae9b38da1 Fix video background color if the gl1 or gl3 renderer is used.
Both use truecolor and not paletted colors.
2018-01-03 21:11:08 +01:00
David Carlier
da5d36a7fd bus error fix when quitting. spotted on openbsd while
working ok on Linux and others.
2018-01-01 02:29:36 +01:00
Yamagi Burmeister
4d1b4fa88c Move the soft renderer header files into a subdirectory header/.
This matches the rest of YQ2s source tree.
2017-12-26 09:33:10 +01:00
Denis Pauk
5a24b969bc Merge commit '041d1c6cb6e1eff8d84ce883ff42c3c7f1c5f67e' into soft_render 2017-12-18 22:54:07 +02:00
Denis Pauk
4f68f0e9f1 Fix link issues 2017-12-17 23:18:56 +02:00
Yamagi Burmeister
2c149eda99 Call te soft renderer just "Software" and not "SDL Soft". 2017-12-17 09:59:37 +01:00
Yamagi Burmeister
6129e902b0 Add missing SDL2.h header. 2017-12-17 08:34:42 +01:00
Yamagi Burmeister
041d1c6cb6 Remove unused WinError() function. 2017-12-16 16:55:30 +01:00
Yamagi Burmeister
00bf016576 Rewrite all cvars, not just the ones loaded from config.cfg.
And print a nice message thate the cvar is deprecated.
2017-12-16 16:42:24 +01:00
Yamagi Burmeister
b433ee10fd Add a way to rewrite cvars loaded from config.cfg.
With this renamed cvars can be rewritten when config.cfg is first
loaded. Please note that once this was done older YQ2 versions can't
parse that config.cfg anymore.
2017-12-14 19:48:44 +01:00
Denis Pauk
60b444834e Set VSYNC 2017-12-11 23:48:12 +02:00
Denis Pauk
4f9833153f Fix background under cinematic and gamma values 2017-12-11 23:33:19 +02:00
sezero
51200b3e6b replace several long casts with intptr_t and include stdint.h for it. 2017-12-11 23:33:19 +02:00
Denis Pauk
c43e944a3d Rebase soft render from https://icculus.org/quake2/
* deleted asm code
* added support 2k+ resolutions
* SDL2 support
2017-12-11 23:33:19 +02:00
Yamagi Burmeister
430e21eab0 Bump version number to 7.11pre now that 7.10 is done. 2017-12-11 17:12:05 +01:00
Yamagi Burmeister
0e51204908 Bump version number to 7.10. 2017-12-08 10:22:59 +01:00
Yamagi Burmeister
9b82cad2c6 Bump version number to 2.10pre.
The next version will be 2.10 and not 2.03. This is done in preparation
of some Windows test builds.
2017-12-04 17:35:40 +01:00
Daniel Gibson
c3d3e9fc76 Make viewing with joystick framerate-independent
otherwise looking around is faster with higher framerates, that sucks,
especially with unstable framerates (on RPi)
2017-12-02 18:54:31 +01:00
Yamagi Burmeister
e429356bd3 Merge branch 'openal_volume' 2017-12-02 16:41:39 +01:00
Yamagi
44da2aca3b
Merge pull request #262 from DanielGibson/fix-win-msaa-crash
Fix crash on Windows if MSAA is set to a value the driver doesn't support
2017-12-02 16:38:26 +01:00
Daniel Gibson
c105117d41 cap cl_maxfps and gl_maxfps to sane values
gl_maxfps > 1000 breaks things, and cl_maxfps starts to behave weird
at >90, and while up to 125 or so you get the bugfeature of higher
jumping, beyond that things just get even buggier, at some point causing
bugs like #261
2017-12-02 16:36:50 +01:00
Yamagi Burmeister
e3e5bd1bdd Fix drop in volume when shooting into a Brains power screen.
If too many of these sounds are started in one frame (for example if the
player shoots with the super shotgun into the power screen of a Brain)
things get too loud and OpenAL is forced to scale the volume of several
other sounds and the background music down. That leads to a noticable
and annoying drop in the overall volume.

Work around that by limiting the number of sounds started. 16 was
choosen by empirical testing.
2017-11-30 08:26:39 +01:00
Yamagi Burmeister
e30f824944 Don't cast the array itself but it's content.
This was so broken... Casting the type of an array to silence a
warning... It worked on x86, of course. But gave a SIGBUS on ARM.
Do it right, cast / copy the content of the array into another
array of the correct type. Yeah.

This fixes issue #231.
2017-11-14 17:24:41 +00:00
Yamagi
82616d0992
Merge pull request #253 from 0lvin/sdl_build_fix
Fix build with SDL1.2
2017-11-07 10:32:52 +01:00
Yamagi Burmeister
1396741904 Fix possible Vorbis buffer underruns.
There're two possible problems with the calculation of the number of
sound buffers for Vorbis if OpenAL is in use:

* We assume that the (more or less) maximum number buffers is allocated
  during map load. This is not correct if in a multiplayer game a lot of
  custom models with custom sound connect at a later time.
* 64 buffers (about 3 seconds worth of music) may be too low in some
  situations.

Work around this by recalculating the number of buffers if necessary.
We're now reserving about 256 (== 12 seconds) buffers.

This may fix issue #252.
2017-11-04 18:22:53 +01:00
Denis Pauk
9495fe4da9 Show real place of error and fix build with SDL1.2 2017-11-01 22:57:54 +02:00
Yamagi
7b6340ddff Merge pull request #245 from 0lvin/back_button_as_escape
Add support for use controller back button as ESC
2017-10-22 18:19:56 +02:00
Yamagi Burmeister
185e89722a Don't unqueue OpenAL raw samples if OpenAL isn't initialized.
This fixes a crash at menu entry if a cinematic is playing when the
game is build with OpenAL support, but s_openal is set to 0.
2017-10-22 17:58:31 +02:00
Thomas Green
f46c46864a Fix a potential OGG issue when OpenAL library is not found. 2017-10-22 17:54:59 +02:00
Daniel Gibson
de5bd4c2c8 OSX: Fix usage of clock_get_time in Sys_Microseconds()
turns out clock_get_time() uses mach_timespec_t which is very similar
to POSIX timespec_t so we're back to just one Sys_Microseconds() function
with an #ifdef __APPLE__ for the (relatively small) differences
2017-10-22 17:54:19 +02:00
Yamagi Burmeister
3d459be4c1 Fix build on OS X that might not have clock_gettime().
Older versions of OS X don't implement clock_gettime() and no(?) version
seems to implement CLOCK_MONOTONIC. Work around this by implementing an
OS X specific variant of Sys_Microseconds() that relies on Mach APIs
provided by all OS X versions...

While at it alter the generic variant so that CLOCK_MONOTONIC is used
only if it's available. CLOCK_REALTIME as a fallback should be good
enough in most cases.

This is believed to fix issue #239.
2017-10-22 17:52:02 +02:00
Denis Pauk
a08374c8cd Add more strict checks for read/write spaces in pcx decode logic 2017-10-21 01:01:41 +03:00
Denis Pauk
61da3dffd1 Add support for use back button as ESC, as example first button in SDL_GAMECONTROLLERCONFIG 2017-10-14 18:58:19 +03:00
Yamagi Burmeister
4bfd1cb9d4 Calculate the correct offset for the cl_drawfps 1 framecounter.
We need to take in account that scaling the characters makes them
bigger, thus they need need to be places depending on the scale and not
at a precaclulated position. This should fix issue #247.
2017-10-11 19:15:11 +02:00
Yamagi Burmeister
8bfcfa7e70 Fix Sys_*seconds() on legacy Windows versions.
Returning 'microseconds / 1000ll' at the first call is wrong, the game
would thing that the first frame too way too much time. For some reason
this wirks in (my) Win10, but breaks on (my) Win7...
2017-10-02 20:48:47 +02:00
David Carlier
54f9798fc8 name field is not a pointer. 2017-10-01 17:47:06 +01:00
Yamagi
b1e3c90a51 Merge pull request #215 from 0lvin/joystick
Add joystick support
2017-09-25 19:41:15 +02:00
Yamagi Burmeister
f9c7d57180 Bump version number to 7.03pre. 2017-09-25 19:39:46 +02:00
Yamagi Burmeister
a8aad9a38a Bump version number to 7.02. 2017-09-25 19:21:04 +02:00
Yamagi Burmeister
ce2c3292c6 Force the x87 FPU to double precision mode.
The original client used single precision mode on Windows and the
default mode on all other platforms. Most platform (at least OS X,
FreeBSD, NetBSD up to 6.0, OpenBSD and Solaris) set double precision
as default, Linux sets extended double precision... When playing a
network game there're several possibilities:

* Same precision on both sides: This one is okay, of course.
* single precision <-> double precision: This one is okay, too. I guess
  this is because the code allows a small deviation between client and
  server to work around imprecisions introduced be the network protocol.
* double precision <-> extended double precision: This one is okay,
  likely for the same reasons given above.
* single precision <-> extended double precision: This one gives a lot
  of misspredictions at client side.

All of these are more or less academic these days. Yamagi Quake II used
the platforms default mode for ages. And both gcc and clang default to
SSE2 math (with double precision as default on all platforms) when
compiling for amd64. So the only reasonable case is Linux/i386 on one
side and the original client or another source port on Windows/i386 at
the other side.

Work around this by forcing the x87 to double precision mode.
2017-09-20 21:55:43 +02:00
Denis Pauk
e7199f5c41 Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.

By default axis is mapped in such way:
 * Left X(joy_axis_leftx): sidemove
 * Left Y(joy_axis_lefty): forwardmove
 * Right X(joy_axis_rightx): yaw
 * Right Y(joy_axis_righty): pitch
 * Trigger Left(joy_axis_triggerleft): triggerleft
 * Trigger Right(joy_axis_triggerright): triggerright

Joystick sensitivity varibales:
 * joy_yawsensitivity,
 * joy_pitchsensitivity,
 * joy_forwardsensitivity,
 * joy_sidesensitivity,
 * joy_upsensitivity.

For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'

Add menu navigation by dpad and thresholds:
 * Add threshold for axis (based on ioquake3), 0.15 by defaults.
 * Navigate in menus by dpad (up/down, left/right, any joystick button for enter).

Defaults:
 * in_joystick "0.0"
 * joy_haptic_magnitude "0.0"
 * joy_axis_leftx "sidemove"
 * joy_axis_leftx_threshold "0.15"
 * joy_axis_lefty "forwardmove"
 * joy_axis_lefty_threshold "0.15"
 * joy_axis_rightx "yaw"
 * joy_axis_rightx_threshold "0.15"
 * joy_axis_righty "pitch"
 * joy_axis_righty_threshold "0.15"
 * joy_axis_triggerleft "triggerleft"
 * joy_axis_triggerleft_threshold "0.15"
 * joy_axis_triggerright "triggerright"
 * joy_axis_triggerright_threshold "0.15"
 * joy_forwardsensitivity "1.0"
 * joy_pitchsensitivity "1.0"
 * joy_sidesensitivity "1.0"
 * joy_upsensitivity "1.0"
 * joy_yawsensitivity "1.0"
2017-09-16 14:23:12 +03:00
Yamagi Burmeister
e1ec177dbe Remove miscframe altogether.
Miscframes are coupled to renderframes and are just checking for
renderer changes (very cheap) and advancing CD audio if implemented.
There's no reason not to that at every frame.
2017-09-09 09:39:56 +02:00
Yamagi Burmeister
eb4fdb56de Miscframes must be synchronized with renderframes.
Otherwise vid_restart triggers only if misc- and renderframes match by
luck.
2017-09-08 19:43:54 +02:00
Yamagi Burmeister
b88b3cb85d Add back function call to Cvar_Fini() removed by git in branch merge.
Don't know why git removed it.
2017-09-07 18:31:49 +02:00
Yamagi Burmeister
a0db877031 Merge remote-tracking branch 'memleak/small_mem_leak_fixes' 2017-09-07 18:30:03 +02:00
Yamagi Burmeister
6c7039af80 Revert "Remove empty function Qcommon_shutdown()."
This reverts commit ec428bb752. Looks like
the function is usefull for pull request #232.
2017-09-07 18:19:45 +02:00
Yamagi Burmeister
f3df541b79 Fix a potential crash in ai_run_melee() and ai_run_missile().
This was found and fixed by Maraakate.
2017-09-07 18:13:01 +02:00
Yamagi Burmeister
f107a77edb Fix an undefined function warning on Windows.
shared.h is needed on all platforms so include it unconditionally.
2017-09-07 18:02:31 +02:00
Yamagi Burmeister
42dfd3dbdd Refactor curtime to be set at one defined point.
Until now the curtime variable was set at every call Sys_*seconds().
That's a little bit unfortunate because calls to that functions are
scattered around the code. Instead set it once every frame in
Qcommon_Frame().
2017-09-07 17:12:58 +02:00
Yamagi Burmeister
5fa6fa9175 Sleep 850 microseconds between dedicated server frames.
The dedicated server runs at cl_maxfps frames per second. Een with very
large values one server frame can never be shorter than 1 milliseconds.
And the timing doesn't need to be very precise since the network
latency adds a lot of more jitter.
2017-09-07 14:53:00 +02:00
Yamagi Burmeister
950e581103 Untangle global variables between dedicated only and normal build. 2017-09-07 14:37:51 +02:00
Yamagi Burmeister
70f678fb80 Implement distinct versions of Qcommon_Frame() for both build types.
Yes, this duplicates some code. But it's at least 100 times more
readable to have two distinct functions for distinct purposes instead
of about 25 #ifdef.
2017-09-07 14:24:09 +02:00
Yamagi Burmeister
85890da3bb Cleanup Qcommon_Init(). 2017-09-07 13:51:52 +02:00
Yamagi Burmeister
1fc565a33b Remove unused "error" command.
"error" was a debug command to test emergency shutdowns. It's not needed
any more. Since users may complain that "error" crashes their game
remove it.
2017-09-07 13:36:17 +02:00
Yamagi Burmeister
6ab2b3227a Rename common/misc.c to common/frame.c.
Now that we moved the CRC stuff to crc.c only the frame handling is
left in this files.
2017-09-07 13:31:52 +02:00
Yamagi Burmeister
801695cf35 Move several CRC function from misc.c to crc.c.
While here remove several unused functions and variables.
2017-09-07 13:22:36 +02:00
Yamagi Burmeister
629683ab40 Also print errors when build with DEDICATED_ONLY. 2017-09-07 13:17:02 +02:00
Yamagi Burmeister
ec428bb752 Remove empty function Qcommon_shutdown(). 2017-09-07 13:05:49 +02:00
Yamagi Burmeister
d0cb89ff52 Change Windows mainloop to microseconds.
While at it have another look at it's Sys_*seconds() implementations.
Also add a Sys_Nanosleep() and use it to throttle the game a litte bit.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
0c3c2976cf Fix timedemos. 2017-09-06 18:36:51 +02:00
Yamagi Burmeister
5ece000c18 Insert 5 microseconds sleep time each frame.
This shouldn't have any noteable impact on timing (besides the machine
is way too slow for Quake II) and saves a lot of CPU cycles. 100% load
vs. 17% load on my desktop.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
a3ce70d2e3 Fix dedicated server build. 2017-09-06 18:36:51 +02:00
Yamagi Burmeister
465963a1a5 Reconnect the server to the global timing.
Having the server in an own timing zone seems to simplify things but
introduces slight timing discrepancies. The most visible effect is that
the game runs a little bit too fast, especially in the first cl_maxfps
frames.

Therefor: Remove timeframes, they're unnecessary. Track the time since
the last (client|server) frame instead and pass it to the client and
server when it's called.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
0a3c6f3786 Fix timing debug cvars and don't run the terminal console too often. 2017-09-06 18:36:51 +02:00
Yamagi Burmeister
4ac97f8a2b Remove the brake from the mainloop.
It's longer necessary now that we've refactored the global timing.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
c32f4b0e4a Move timing from CL_Frame() to Qcommon_Frame().
This allows us to implement the global timing without an artificial
brake slowing the game unnecessary down. This is only partial working,
more changes and fixes are coming.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
a0aa1c87c7 Change the global timing in main() from milli- to microseconds.
This is a no-op for now. We need this to get a much higher precision
when calculating the frame times. This changes the fixedtime cvar from
milli- to microseconds.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
f16242e923 Determine svs.realtime from curtime and not the global timing.
This is the same as the client does for it's realtime. It looks at least
somewhat more correct since it pevents rounding errors. And things are
simplified a litte bit since the server timing is now independent of the
global timing.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
79f73da62b Implement a much better / more accurate framecounter.
The old framecounter had two problems:

* It measured only the time of the current render frame, not the total
  time spend between the last and the current render frame. Therefor the
  calculated value was too high.
* It was based upon milliseconds and rather inaccurate.

This new frame counter solves both problems. The total time spend
between two render frames is measured and the measurement done in
microseconds.

There're three modes:

* cl_drawfps 1 displayes the average frame rate calculated over the last
  60 frames.
* cl_drawfps 2 displays a nice string with minimal framerate, maximum
  framerate and average framerate. All three values are calculated over
  the last 60 frames.
* cl_drawfps 3 is the same as number 2 but with a second line showing the
  raw values.

TODO:

* Discuss if cl_drawfps should be renamed to cl_showfps. All other
  status displays are named cl_show*.

While at it remove several unsused drawing functions.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
0fafaf735f Implement a Sys_Microsecond().
This is the same as the well known Sys_Milliseconds() but like the name
suggests with microsecond precision. To be used in the upcoming new
framecounter.
2017-09-06 18:36:51 +02:00
Yamagi Burmeister
406857f57a Make the Linux / Unix backend year 2038 compliant. 2017-09-06 18:36:51 +02:00
Denis Pauk
95e02d99cf update stb_image.h v2.02->v2.16 2017-09-05 21:30:37 +03:00
Daniel Gibson
0051c6b8d2 If renderer init fails and MSAA is on, disable it and try again
For some fucking reason, if you set an unsupported
SDL_GL_MULTISAMPLESAMPLES value on Windows (at least Win10 with Intel GPU
drivers, there 16 is unsupported), creating the Window and OpenGL context
will succeed, but you'll get Microsofts stupid GDI OpenGL software
implementation that only supports OpenGL 1.1.
Before these fixes, the GL3 renderer would just crash and the GL1 renderer
would fail to load, which caused the game to run in the background:
No Window, no Input, but sound was playing..

Now this problem should be handled properly and if initialization fails,
the rendering backend will be considered not working, and it will
try the gl1 backend next, and if that also fails it'll give up and exit
the game.
2017-09-04 00:21:10 +02:00
Daniel Gibson
36ef1e6bb8 Exit game if loading renderer fails
it's no fun without a  window, even if sound works you don't have input..
2017-09-04 00:18:13 +02:00
Yamagi Burmeister
aa5f63e0dc Since mkdir() isn't recursive we need to create .yq2/$moddir. 2017-08-31 17:26:32 +02:00
Yamagi Burmeister
503ab368a2 Decouple horplus and fov in the video menu.
Until now the video menu enforced:

* fov set to 90 and horplus set to 1
* fov set to something other than 90 and horplus to 0

If the user hat configured another configuration through the console the
menu would reset it, even if only unrelated changes are applied. With
this change horplus is ignored by the menu and only fov is altered. The
rationale behind this is that most users want horplus enabled and all
others can disable it through the console.

This is believed to fix issue #225.
2017-08-30 15:05:02 +02:00
David Carlier
9f71d55258 fixing couple of small memory leaks 2017-08-27 01:00:57 +01:00
Yamagi Burmeister
7f46d808d2 Second part of Developer_searchpath() removal.
This was forgotten in the first commit. :(
2017-08-07 18:10:32 +02:00
Daniel Gibson
11b3a0515a Merge branch 'searchpath' 2017-08-05 18:40:44 +02:00
Yamagi Burmeister
db2cde0325 Remove disgusting and broken Developer_searchpath() function.
It's mush better and safer to query the "game" cvar instead. It's always
set to the mods name and get's the baseq2 special case right.
2017-08-04 09:20:44 +02:00
Yamagi Burmeister
ff7772f11d Don't let baseq2/pak0.pak/maps.lst shadow baseq2/maps.lst.
While here reimplement the same hack for baseq2/players, lost somewhere
on the way. This is just another searchpath f*ckup. For some reasons
paks have a higher priority than plain directories. We do not want that
for the maps.lst and players/ since id Software decided to put updated
versions of them directly into baseq2/...

This closes issue #217.
2017-08-02 20:08:05 +02:00
Yamagi Burmeister
86fd714788 Allow to choose the fullscreen mode through the menu.
There're 3 possible values:
* no -> vid_fullsceen == 0
* keep resolution -> vid_fullscreen == 1
* switch_resolution -> vid_fullscreen == 2
2017-08-01 18:32:44 +02:00
Yamagi Burmeister
911d225496 Pass an integer to SetMode_impl() instead of a qboolean.
The functions signature was changed several commits ago.
2017-08-01 18:20:30 +02:00
Yamagi Burmeister
3f8be88e84 Fix fullscreen switch through alt-enter. 2017-08-01 18:16:24 +02:00
Daniel Gibson
6d39da37ca Print system SDL version on startup 2017-08-01 18:14:31 +02:00
Yamagi Burmeister
5e61c23fd8 Only set SDL 1.2 fullscreen if it's requested. 2017-08-01 18:11:46 +02:00
Yamagi Burmeister
908fd30148 Switch from SDL_WINDOW_FULLSCREEN to SDL_WINDOW_FULLSCREEN_DESKTOP.
SDL_WINDOW_FULLSCREEN changes the display resolution if the requested
resolution is different to the actual resultion. SDL_WINDOW_FULLSCREEN_
DESKTOP doesn't do that, it places a smaller or bigger render area
somewhere inside the fullscreen area. This is somewhat nicer with modern
high resolution flatscreens.

This commit changes vid_fullscreen 1 from SDL_WINDOW_FULLSCREEN to
SDL_WINDOW_FULLSCREEN_DESKTOP. Additional vid_fullscreen 2 is
implemented, it uses SDL_WINDOW_FULLSCREEN to create the fullscreen
area.

TL;DR: Use vid_fullscreen 1 to keep the current resolution or use
vid_fullscreen 2 to switch the resolution.

Implementation details: The whole fullscreen stuff is a horrible mess.
Like generations of hackers before me I'm not desperated enough to clean
it up. GLimp_InitGraphics() is modified to take the fullscreen mode as
an integer and not as a boolean. That's a change to the renderer API.
In GLimp_InitGraphics() the needed SDL fullscreen mode flag is
determined once at the top and just used further down below. That saves
dome SDL1 <-> SDL2 compatibility cruft. IsFullscreen() was modified to
return the actual fullscreen mode and not just if fullscreen is enabled.
2017-08-01 10:08:24 +02:00
Yamagi Burmeister
f1a8c565f1 Implement a generic case in Sys_GetBinaryDir().
Several platforms - OpenBSD being a prominent example - don't provide a
way to get the executable path. Don't abort, just return the current
dir ./ executable dir. This is just a work around, of course. The user
needs to supply a script that calls ./quake2 in the correct directory.
2017-08-01 07:12:50 +02:00
Yamagi Burmeister
e71f267de6 Just create the screenshot directory in fs_gamepath.
While here set the fs_gamedir to the last directory of the generic
search path in case that the game is reset to baseq2.
2017-07-25 09:19:17 +02:00
Yamagi Burmeister
f311308713 Remove the portable cvar, use is_portable instead.
Having a command line option and a cvar is confusing, especially since
the cvar doesn't make the game really portable.
2017-07-24 18:45:42 +02:00
Yamagi Burmeister
383f667c46 Write stdout.txt into the same dir as the config when running portable. 2017-07-24 18:38:59 +02:00
Yamagi Burmeister
7d08906bca Reimplement the portable binaries stuff.
The big problem with the old implementation was that stdout.txt and
stderr.txt on Windows became available when nearly all the low level
initialization was already done. Regardless if the client was in
normal or in portable mode.

Solve this by scanning the command line for the string '-portable'. If
it's not found, stdout and stderr are redirected as early as possible.
If found the global variable (*sigh*) is_portable is set to true. It's
evaluated later on to set the cvar 'portable', which in turn is used
be the filesystem to decide if the home directory should be added to
the search path.

Maybe we should remove the cvar and stick to the global variable.

While at it change the maximum path length for qconsole.log from
MAX_QPATH to MAX_OSPATH. At least on my Linux laptop MAX_QPATH is
too short.

This commit is still untested on Windows!
2017-07-24 11:15:00 +02:00
Yamagi Burmeister
97f7625e49 This is C, not Python... :/
!binarydir[0] == '\0' works by accident, but let's do things right...
2017-07-24 10:23:00 +02:00
Yamagi Burmeister
3ba9729946 Build a raw search path at startup. Use it to build the actual paths.
A new linked list fs_rawPath with nodes of type fsRawPath_t is added.
The new function FS_BuildRawPath() fills it at filesystem initialization
with the raw search path directories. Later FS_BuildGenericSearchPath()
and FS_BuildGameSpecificSearchPath() use it to derive the actual search
directories.
2017-07-23 09:52:32 +02:00
Yamagi Burmeister
e4b9f6884f Fix problems pointed out by @DanielGibson.
* Check pointers against NULL instead of 0.
* Checks pathes for \\ (Windows) and / (everything else).
2017-07-23 08:55:07 +02:00
Yamagi Burmeister
9efd831312 Refactoring the search path magic, step 3: Remove now used code.
Remove all functions that are no longer used:

* FS_AddGameDirectory()
* FS_SetGameDir()
* FS_AddHomeAsGameDirectory()
* FS_AddBinaryDirAsGameDirectory()

While at it try remove as much global variables from filesystem.c as
possible. Also fix a small, longstandig bug: The download code should
treat .zip and .pk3 files as pak files and not as normal directories.
2017-07-23 08:47:41 +02:00
Yamagi Burmeister
0c8e65bb68 Refactoring the search path magic, step 2: Game specific search path.
Refactor FS_SetGamedir() into FS_BuildGameSpecificSearchPath(). The new
function removes the specialized part of the search path if necessary
and create a new specialized part based upon the given directory. It
uses the FS_AddDirToSearchpath() function added in the last commit.
2017-07-23 08:47:30 +02:00
Yamagi Burmeister
9f04bc0218 Refactoring the search path magic, step 1: Generic search path.
This moves the code used to add a directory and it's paks to the search
path into one well defined function FS_AddDirToSearchPath(). Also create
a new function FS_BuildGenericSearchPath() that builds the generic part
of the global search path. This obsoletes several other, specialized
functions. They'll be removed in a later commit.
2017-07-23 08:46:38 +02:00
Yamagi Burmeister
4f803aedd2 Correct some missindentions pointed out by recent GCC versions. 2017-06-30 13:52:09 +02:00
Yamagi Burmeister
e134ae578f Reset vod_renderer to gl1 if the requested lib couldn't be loaded.
This was reported in issue #209.
2017-06-30 13:43:37 +02:00
Yamagi Burmeister
815bc34646 Bump version to 7.02pre. 2017-06-24 08:49:11 +02:00
Yamagi Burmeister
e1aadc5796 Bump version to 7.01. 2017-06-23 15:46:41 +02:00
Yamagi Burmeister
dd41ff3601 Tell Windows that we're HighDPI aware.
This prevents Windows from scaling our (fullscreen) window to crap if
the whole desktop is scaled and we're rendering more than 1080p. This is
believed to fix #208.
2017-06-21 10:17:16 +02:00
Daniel Gibson
23ea2ea034 GL3: Square particles with cvar gl3_particle_square
if that cvar is set to 1, particles aren't rendered as nice circles, but
as squares, like in the software renderer or in Quake1.

Also documented it in cvarlist.md and fixed some typos there
2017-06-20 18:31:32 +02:00
Daniel Gibson
1da7ff5594 Fix Jennell Jaquays' name in credits and quit screen
the latter is done by identifying the baseq2 pics/quit.pcx in LoadPCX()
and changing some pixels
2017-06-12 18:32:56 +02:00
Daniel Gibson
36c880e105 GL3: Update HandMadeMath.h to include my non-SSE patch
from https://github.com/StrangeZak/Handmade-Math/pull/60

Hopefully fixes #204 (broken build on ARM)
2017-06-09 12:30:44 +02:00
Yamagi Burmeister
8fa861d8e9 Bump version to 7.01pre.
While here remove missleading comment.
2017-06-08 18:12:55 +02:00
Yamagi Burmeister
95b0c6a38b Bump the version number to 7.00. 2017-06-08 17:29:51 +02:00
Yamagi Burmeister
f6e3f1f4bc Hide OpenALs doppler effect behind s_doppler.
This allows it to disable the doppler effect by setting s_doppler to 0.
The default value 1 == enabled.
2017-05-25 09:11:47 +02:00
xorw
ff54b3ac1f use correct velocity scaling for openal audio sources 2017-05-20 07:23:24 +02:00
Daniel Gibson
865e97514d GL3: Render Model shadows last, reduce global variables in gl3_mesh.c
The model shadows are rendered after all entities are rendered.
This fixes them making entity brushes below them translucent (#194)

The model rendering code used lots of global variables, many of them
totally superfluous (esp. currententity, currentmodel).
I refactored the code to use less global variables (this was at least
partly needed to render the shadows later).
So this looks like lots of changes, but many of them are just using
"entity" instead of "currententity" or "model" instead of "currentmodel"
2017-05-15 12:34:38 +02:00
Yamagi Burmeister
6119591c6a Fix build with WITH_OPENAL disabled.
This closes issue #192.
2017-05-13 16:53:20 +02:00
xorw
29d109f8ef Finished doppler shift support (added listener's velocity update) 2017-05-10 12:21:56 +02:00
Yamagi
e6d46eb452 Merge pull request #193 from xorw/master
Add partial doppler shift support for 3D audio sources.
2017-05-09 21:38:30 +02:00
xorw
da5aea4929 Add partial doppler shift support for 3D audio sources.
In game noticeable when dodging blaster projectiles or missiles :)

See: https://en.wikipedia.org/wiki/Doppler_shift
2017-05-07 06:14:10 +02:00
Daniel Gibson
9751caac85 GL3: Optimize shadow rendering
now DrawAliasShadow() only uses one draw call per model, pretty much
like DrawAliasFrameLerp()
2017-05-02 06:25:04 +02:00
Daniel Gibson
b45a6d8ef9 GL3: Simple Stencil-Shadows
Like GL1 gl_shadows + gl_stencilshadows: no shadow volumes, but looks
ok apart from standing over edges

The gl_stencilshadows cvar isn't used in GL3, it always uses the stencil
buffer if available (and if gl_shadows != 0)

This still needs performance optimizations: Like the GL1 impl it takes
lots of draw calls per model, it could be done with one per model like
when rendering the actual model.
2017-05-02 06:25:04 +02:00
Yamagi Burmeister
a31c309f68 Scale entity alpha values by 0.666f.
This makes the black hole generator (the rotating circles) in command
looking great again. :)
2017-04-27 17:33:40 +02:00
Daniel Gibson
79e9c8c3d0 GL3: gl3_intensity_2D cvar for HUD, menu, console, video intensity
there have been complaints that those things look too bright, so let
people configure their intensity independently of the general intensity
used for levels, monsters etc.

fixes #189
2017-04-25 15:02:22 +02:00
Daniel Gibson
ff6e7ede26 GL3: Apply scroll offset to x also for transparent scroll surfs
no idea where this is used, but it should be correct this way
2017-04-24 15:22:02 +02:00
Yamagi Burmeister
dd007f340a Apply scroll offset the x coordinate and not to y.
When applied to y SURF_FLOWING textures are scrolled into the wrong
direction. I guess that in GL1 the offset is also applied to x.

This fixes issue #186.
2017-04-24 14:50:00 +02:00
Yamagi Burmeister
df85228ba4 Unqueue raw samples if Vorbis playback is paused.
Without this some samples will loop forever.
2017-04-23 21:55:27 +02:00
Yamagi Burmeister
98276aeb91 Empty SDLs event queue when starting cinematic playback.
Sometimes cinematics are skipped after the first frame even if the
player didn't press any key. I'm unable to reliable reproduce that,
so my educated guess is that one or more events are still waiting in
SDLs event queue.

For example, during intermission IN_Update() is not called for 5
seconds, key presses by impatient players are just added to the queue
and not processed. The first event is used to skip leave the
intermission, the second event skips the cinematic...

Fix this by implementing a new function IN_FlushQueue() to flush SDLs
event queue and calling it when starting cinematic playback. Yes, this
is just another layer violation. :(
2017-04-22 10:29:25 +02:00
Yamagi Burmeister
c0b768278f Fix build with SDL 1.2 2017-04-22 10:24:12 +02:00
Yamagi Burmeister
eb2a11f0b2 Unqueue raw samples when the menu is entered during cinematic playback
When the client is paused (either explicit or by entering the menu or
console) the cinematic is paused, too. Therefor no more sound samples
are generated and added to the playback queue, the existing samples are
played over and over again. Until now these samples weren't hearable,
because OpenAL marked them as processed and AL_StreamUpdate() removed
them from OpenALs playback queues. This changed in the previous commit,
now the stay in OpenALs queue and are hearable.

Fix this by calling AL_UnqueueRawSamples() when the menu or console is
entered during cinematic playback.
2017-04-22 09:50:52 +02:00