Commit graph

1649 commits

Author SHA1 Message Date
Yamagi Burmeister
87f9084df1 Clamp overbright bits in warping surfaces to 1.
They oversaturate otherwise.
2016-08-17 21:12:52 +02:00
Yamagi Burmeister
1bbd8c04ff I think that steps between 94 and 98 are wrong, remove them.
Predicting these steps leads to a heavily stuttering elevator in
hangar1. I think that steps between 94 and 98 can't appear on stairs, so
just remove them. If I'm wrong we need a hack to the hack ontop of the
hack... ^^
2016-08-17 21:03:36 +02:00
Yamagi Burmeister
6ff41e6b2f Remove unused and broken functions for writing files. 2016-08-16 20:14:41 +02:00
Yamagi Burmeister
9af1af55a5 Allow reading player models from pak / pk2 / pk3 / zip files.
This fixes #119. As always I've chosen the least invasive way to solve
this problem. Trying to open players/$model/trix.md2 is hack, but solves
the problem without changes to filesystem.c and it's API.
2016-08-16 19:58:22 +02:00
Yamagi Burmeister
fb7c79c93b Be a tough boy and set cl_async to 1 2016-08-15 21:37:09 +02:00
Yamagi Burmeister
58d1fa02bc Switch overbright bits off by default to get the classic look 2016-08-15 21:36:33 +02:00
Yamagi Burmeister
88244bd4a4 Unbreak SDL 1.2 build. 2016-08-14 16:46:07 +02:00
Yamagi Burmeister
4d9d555d8e When vsync is enabled, cap the desired rfps.
With vsync enabled the render times of consecutive frames can diverge.
The first frame arrives right at the next display frame and is rendered
without waiting time. The next frame has to wait 20ms. The leads to some
problems with the move prediction if the client is asynchronous. Fix
this by capping the desired frame rate at the display refresh rate. Also
make sure that the network framerate is never higher then the renderer
framerate.

With the commit the timing is always correct:
* With no limit as much frames as possible are rendered. In this case
  rfps > nfps and everything's good.
* With vsync enabled rfps > nfps or rfps == nfps is given. Also rfps
  will never exceed the display refresh rate.
* On slow hardware either rfps > nfps or an implicit rfpc == nfps is
  given.
2016-08-14 16:35:48 +02:00
Yamagi Burmeister
0ba7614739 Use nanosleep() instead of a busy wait loop.
This cuts the cpu time requirements in half. Windows has no equivalent
for nanosleep(), so keep the busy loop.
2016-08-14 12:50:27 +02:00
Yamagi Burmeister
98683cbc31 Render the first frame right after the start.
Otherwise we would wait several client frames. This is a cosmetic change
without any visable effect.
2016-08-14 12:50:21 +02:00
Yamagi Burmeister
93e9633382 Port step smoothing code from r1q2.
While the bugfix in a6f4a3b made the steping prediction working for
stairs, elevators are still stuttering. r1q2s code solves this problem
and is a little bit faster. Use it instead.
2016-08-14 12:45:16 +02:00
Yamagi Burmeister
f16928f2cf Implement a better hack for warping surfaces regarding lightning.
The old hack was sufficient for classic rendering, but break with
gl_overbrightbits enabled. See the inline comment for details.
2016-08-13 12:18:31 +02:00
Yamagi Burmeister
d6136cbba5 Bump cl_maxfps to 60.
Yesterday I chose setting cl_async to 0 since I saw some movement
changed with the async client enabled. Especially when clipping against
bevels the game started to stutter and there were small rendering
problems. After some debugging I realized that it is caused by slight
inaccuracies in the move prediction. When cl_maxfps is too low, the
movement error between two render frames becomes to big, leading to
misspositions. There're two ways to solve this problem:

* Processing more client frames. Most async clients I've looked on
  process 60 or even 90 render frames. I chose to stay at 60 since
  I was unable to see differences with higher rates.

* Changed to pmove.c and the pmove_t struct. Some multiplayer focused
  clients go that way. But there's a very high of breaking singleplayer
  movement and pmove_t is part of the server <-> game API. Additionally
  the network code must / should be altered. So this is unsuitable for
  YQ2.

Please note that there's still a change in movement. Before 4ae8706 and
when cl_async is set to 0 movement is dependend on the render framerate.
At low framerate bevel clipping isn't working too good, at high
framerates prediction causes physics changes like the famous 125hz bug.
With cl_async set to 1 the network framerate is stable, leading to a
more consistant behahiour.
2016-08-13 12:17:31 +02:00
Yamagi Burmeister
070d94ec77 Add a cvar cl_async, off by default.
Most (all?) clients implement the synchronous and the asynchronous
client by seperate code pathes. Instead of doing that we force the
asynchronous path to process one network frame for each render frame.
2016-08-11 19:36:42 +02:00
Yamagi Burmeister
a6f4a3b309 Don't predict one frame too far.
We're missusing the current frame to pass data from the input subsystem
to the movement prediction without a server frame. While we can use the
current frame for the movements itself, it's not finished and thus
unsuitable for stair step prediction. Also oldframe is determined
wrongly. As a result the player "jumps" over stairs.
2016-08-11 19:11:33 +02:00
Yamagi Burmeister
a9853ae44e Remove more dead cvars. 2016-08-11 19:07:08 +02:00
Yamagi Burmeister
02725785dd Apply gl_overbrightbits to dynamic lightmaps.
Without this the dynamic lightning is too dark in contrast du the rest
of the world when gl_overbrightbits is 2 or even 4.
2016-08-08 21:06:59 +02:00
Yamagi Burmeister
347cdb7f81 Some more fixes to gl_overbrightbits in non multitexturing case.
- Apply overbright bits only to static lightmaps and not dynamic ones.
- Apply overbright bits to alias models.
2016-08-07 10:39:22 +02:00
Yamagi Burmeister
f8ac496b69 Bump version number to 6.00pre 2016-08-07 10:14:07 +02:00
Yamagi Burmeister
a6d77401ba Remove now unused variable 2016-08-07 10:12:56 +02:00
Yamagi Burmeister
5f4d4e533f Apply gl_overbrightbits only to full lightmap chains.
I think / guess / *fingers crossed* that this fixes the different
brightness levels between normal and multitexturing mode reported
in #147.
2016-08-06 19:21:34 +02:00
Yamagi Burmeister
f064c76eb2 Remove dead cvars and support code 2016-08-06 18:41:57 +02:00
Yamagi Burmeister
cd61504af8 gl_config.mtexcomb should depend on gl_config.multitexture 2016-08-06 18:28:02 +02:00
Yamagi Burmeister
dd36eee0f1 Apply gl_overbrightbits only at lightmaps, not normal textures. 2016-08-06 18:11:10 +02:00
Yamagi Burmeister
38a72e018a Implement gl_overbrightbits in non multitexturing mode
This is still slighty broken, looks the overbright bits are applied in
both R_DrawGLPoly() and R_DrawGLPolyChain(). Fix to come.
2016-08-06 17:06:37 +02:00
Yamagi Burmeister
a2400bc145 Clamp gl_overbrightbits to 0, 1, 2 or 4.
Most (all?) GPUs / OpenGL implementation doen't support more
2016-08-06 15:39:46 +02:00
Yamagi Burmeister
698e2a26ba Switch GL_ARB_texture_env_combine to our new probing logic 2016-08-06 15:32:08 +02:00
Yamagi Burmeister
5840bd570b Use vertex arrays in R_RenderLightmappedPoly.
This is done for normal surfaces only. To change SURF_FLOWING surfes I
need to find such a surface somewhere in the game...
2016-08-06 15:25:54 +02:00
Yamagi Burmeister
bcde80834f Probe GL_ARB_multitexture with our new proping logic
And rename gl_ext_multitexture to gl_multitexture.
2016-08-06 15:15:18 +02:00
Yamagi Burmeister
dafc41f509 Switch GL_ARB_texture_non_power_of_two to our new probing logic.
While at it rename R_Upload32Old to R_Upload32Soft.
2016-08-06 10:37:24 +02:00
Yamagi Burmeister
2e7166b157 Probe GL_EXT_texture_filter_anisotropic with our new logic 2016-08-06 10:18:58 +02:00
Yamagi Burmeister
43c9970772 Switch GL_EXT_paletted_texture to the new probing logic 2016-08-06 10:08:17 +02:00
Yamagi Burmeister
9f0b5d067b Use GL_ARB_point_parameters instead of GL_EXT_point_parameters.
While here switch GL_ARB_point_parameters to a new probing logic and
rename the Cvar to gl_pointparameters.
2016-08-06 09:50:16 +02:00
Yamagi Burmeister
4057376993 GL_EXT_compiled_vertex_array is unused. Remove it.
At can be added back, if it's ever needed.
2016-08-06 09:35:08 +02:00
Yamagi Burmeister
0967f051d8 Require OpenGL 1.4 2016-08-06 09:32:20 +02:00
Yamagi Burmeister
e4751e8c44 Use OpenGL multitexturing extensions to implement multitexturing...
This is a slighty revised version of id Software original code. Icculus
code may have some advantages on broken drivers or underpowered GPUs.
Today it's just a performance hook. This is a first step in fixing #147.
2016-08-05 18:38:48 +02:00
Yamagi Burmeister
2baf97bdf6 Throttle the client to 1000 FPS.
This is more than enough for everyone and prevents wasting CPU time.
Without this change as many client frames as possible are rendered,
Quake II uses a complete core.
2016-08-05 07:49:47 +02:00
Yamagi Burmeister
7ea4db4ace Remove now unused function CL_SendCommand(). 2016-08-04 21:29:30 +02:00
Yamagi Burmeister
d15f5d5b97 Make sure CL_UpdateWindowedMouse() is called.
Without this the automatic mouse grab is not working.
2016-08-04 21:28:17 +02:00
Yamagi Burmeister
a70cc2d923 Switch the refresher to vertex arrays
This is based on work submitted by Scott "pickle" Smith. It's said that
vertex arrays are somewhat faster and more compatible than the old way.
This may remove support of some very, very old GPUs like the Riva128.
2016-08-04 21:11:31 +02:00
Yamagi Burmeister
4dcdb0dc17 Force GL_LIGHTMAP_FORMAT instead of gl_tex_solid_format.
This is more less cosmetics since gl_tex_solid_format == GL_RGB and
GL_LIGHTMAP_FORMAT == GL_RGBA. No measurable FPS change on Nvidia and
Intel. Based upon the OpenGL ES patch by Scott "pickle" Smith.
2016-08-04 21:11:31 +02:00
Yamagi Burmeister
275271c647 Always specify the alpha channel.
This is based upon the original OpenGL ES patch by Scott "pickle"
Smith. This change gives about the same frame rate on an 750TI but
about 3% more frames on an Ivy Bridge IGP with Mesa3D...
2016-08-04 21:11:31 +02:00
Yamagi Burmeister
4ae8706d22 Make the client asynchronous, e.g. decouble net and refresh frames.
This is largely based upon the cl_async 1 mode from KMQuake2, which in
turn is based upon r1q2. The origins of this code may be even older...
Different to KMQuake2 the asynchonous mode is not optional, the client
is always asynchonous. Since we're mainly integrating this rather
fundamental change to simplify the complex internal timing between
client, server and refresh, there's no point in keeping it optional.

The old cl_maxfps cvar controls the network frames. 30 frames should be
enough, even Q3A hasn't more. The new gl_maxfps cvar controls the render
frames. It's set to 95 fps by default to avoid possible remnant of the
famous 125hz bug.
2016-08-04 17:36:42 +02:00
Yamagi Burmeister
fa4eacc976 At OpenAL shutdown don't do not stop only the stream chan but all chans.
I'm not quite sure if this really makes a difference. But it's the only
idea I have regarding several "Quake II hangs at shutdown when OpenAL is
run with Pulseaudio backend" bugs.
2016-08-04 09:21:33 +02:00
Yamagi Burmeister
978eec1a8d Add an explicit fflush() when writing the config.
Yes, fclose() flushes the stream and yes, this is unnecessary. But I've
seen at least two times partial written configs on Win 10. :(
2016-08-04 09:07:47 +02:00
Yamagi Burmeister
f291693c59 Quit the game if a SDL_QUIT event is received. 2016-07-18 10:11:54 +02:00
Yamagi
7cb455459a Merge pull request #144 from smcv/source-date-epoch
savegame: ensure that BUILD_DATE is defined
2016-07-05 19:37:56 +02:00
Simon McVittie
38ff49e480 savegame: ensure that BUILD_DATE is defined
The game code does not include common.h, so it needs to redo this
part for builds without SOURCE_DATE_EPOCH, where BUILD_DATE will
not have been passed in from the outside.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-07-05 18:29:54 +01:00
Yamagi Burmeister
6d7d15af30 Fix Windows build. On Windows OpenAL32.dll must be opened at runtime. 2016-07-05 19:17:06 +02:00
Yamagi
5323873476 Merge pull request #143 from smcv/link-libopenal
Optionally link libopenal at compile time
2016-07-05 19:13:57 +02:00