Commit graph

1847 commits

Author SHA1 Message Date
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
Yamagi
e869223e7f Merge pull request #235 from 0lvin/ctb_image-update
update stb_image.h v2.02->v2.16
2017-09-05 20:54:05 +02:00
Denis Pauk
95e02d99cf update stb_image.h v2.02->v2.16 2017-09-05 21:30:37 +03: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
Daniel Gibson
50b0e97332 README: don't tell people to delete maps.lst 2017-08-26 22:55:07 +02: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
Daniel Gibson
f38d3475df Add documentation for package maintainers 2017-08-05 18:28:33 +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
0ba9843ffe Merge pull request #223 from fucknohtml/master
Fix opengl linking for the renderers.
2017-08-02 11:11:13 +02:00
Alexander
0be75560fb fix opengl linking
The variable yquake2RendererLinkerFlags is used to store the linker flags for opengl but  the empty variable yquake2OpenGLLinkerFlags is used when linking libraries to the renderer.

Also there's no need to link the opengl libs to the opengl3 renderer when the glad extension loader is being used.
2017-08-02 14:59:31 +08:00
Yamagi Burmeister
7ca4e2ea5d Revert "Pass -Wno-misleading-indentation to silence spurious warnings."
Clang 4.0 doesn't like this and I'm too lazy to implement per compiler
CFLAGS.
2017-08-01 18:39:42 +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
mulander
60bef10748 Don't use -Wl,--no-undefined on OpenBSD
Breaks the build since version 7.00
2017-07-20 17:47:56 +02:00
Yamagi Burmeister
6da4a31740 Pass -Wno-misleading-indentation to silence spurious warnings.
Recent GCC versions print a lot of missleading indentation" warnings
in third party code, making the build log more or less unreadable.
2017-06-30 14:12:57 +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
9236b61153 Clearify that we fixed the build on all platform without SSE. 2017-06-21 15:27:23 +02:00
Yamagi Burmeister
20abcf8e47 Update the CHANGELOG for 7.01. 2017-06-21 14:29:46 +02:00
Yamagi Burmeister
86649ebdac Mention crosshairscale in the cvarlast.md. 2017-06-21 10:22:29 +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
Yamagi
837f017016 Merge pull request #207 from smcv/system-openal
Only use /usr/local/opt/openal-soft on Darwin
2017-06-19 10:07:16 +02:00
Simon McVittie
992f453016 Only use /usr/local/opt/openal-soft on Darwin
Commit 883781c selected these paths for all OSs, but when linking to
a system copy of OpenAL for Linux distribution binaries we want the
normal OpenAL in /usr.

Signed-off-by: Simon McVittie <smcv@debian.org>
2017-06-18 15:33:51 +01:00