Commit graph

2042 commits

Author SHA1 Message Date
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
d107d999da
LICENSE: Properly document stb_image(_write).h
It's not stb.h and the github project should probably be linked
And now the licensing is a bit more verbose (Dual-Licensed under Unlicense and MIT 
instead of custom Public Domain license).
2018-02-04 05:15:20 +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
Yamagi
b28546239e
Merge pull request #273 from 0lvin/cleanups
Soft render clean up.
2018-02-03 08:28:40 +01:00
Daniel Gibson
f76ce617e7
README: https:// instead of http:// links 2018-01-24 14:33:57 +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
Yamagi Burmeister
de30b75f94 CMakeLists.txt: quake2.exe => yquake2.exe, add wrapper quake2.exe 2018-01-21 17:02:05 +01:00
Daniel Gibson
5c4f2cc5b0 quake2.exe wrapper: add icon 2018-01-21 16:40:05 +01:00
Daniel Gibson
7f8390d5f7 Makefile: quake2.exe => yquake2.exe, add wrapper quake2.exe 2018-01-21 16:40:05 +01: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
6c99cef52d Rename gl_flashblend to gl1_flashblend. 2018-01-09 09:37:54 +01:00