Commit graph

2586 commits

Author SHA1 Message Date
Daniel Gibson
f1a81a5611 SV_Frame(int _usec_) instead of msec
it's microseconds, not milliseconds.
2020-04-08 15:28:59 +02:00
Daniel Gibson
bbde4e2a81 Support scancodes as fallback for unknown keyboard keys
If we can't map a SDL_KEYDOWN/KEYUP events SDL_Keycode to a known
Quake2 K_* keycode, we try to map the SDL_Scancode to one of the new
K_SC_* YQ2 scancodes instead.
The scancode name corresponds to the key at that position on US-QWERTY
keyboards *not* the one in the local layout, for example the German 'Ö'
key is K_SC_SEMICOLON.

This way (hopefully!) all keys on common keyboards can be bound,
regardless of their layout. The key name won't be immediately obvious
to the user, but it's only a fallback and better than nothing.

fixes #543
2020-04-08 04:43:25 +02:00
Daniel Gibson
3015995d04 Reorder (and complete) K_* related listings to match the enum
this way it's easier to tell if a key constant is not handled.

Also, there was a half-finished workaround to allow binding a ';' key
(which apparently in configs would otherwise be interpreted as
 command separator), now that should actually work (=> special case
 it in Key_KeynumToString())
2020-04-08 04:43:25 +02:00
Daniel Gibson
e86ea9f86e Remove unused K_AUX*
no idea what this was exactly, but we never generate those so they
can't be used anyway
2020-04-08 04:43:25 +02:00
Daniel Gibson
c67d82dd53 Use K_LAST instead of 256 in some loops
It's not 256 anymore, hasn't been in a long time..
2020-04-08 04:43:25 +02:00
Daniel Gibson
ff9f9accd3 client/refresh/files/stb.c: don't include header from gl1/
instead use ref_shared.h, like the other source files in that directory
2020-02-22 20:27:32 +01:00
Yamagi
bb0fc01e38 Another try to fix the problem of spurious aborts of cinematics.
Until this commit a cinematic was aborted as soon as any key were
marked down when finishing the user command and sending it to the
server. The whole logic to detect if a key is down is broken, for
example `vid_restart` may leave keys marked down that are in fact
up. And there's the possibility to inject fake key events from
nearly everywhere. I'm not really sure but I suspect that even the
server may be able to inject key events.

Therefore untangle the cinematic abort code from the user command
processing, it should depend only on real key strokes:

1. Introduce a new global variable `abort_cinamatic` and set it to
   `cls.realtime` as soon as a key down event is detected. The only
   exceptions are Escape and Shift, because opening the menu and
   toggeling the console should never abort a cinematic.
2. When starting a cinematic `abort_cinamatic` is set to INT_MAX,
   because it needs to be higher than the current `cls.realtime`.
3. When a cinematic is running, `cls.key_dest` is set to `key_game`
   (`key_menu` and `key_console` are ignored, keys send to the menu
   or the console should never abort a cinematic; `key_message`
   can / should never happen while a cinematic is running) and
   `abort_cinamatic` is less than `cls.realtime` the cinematic is
   aborted.

`abort_cinamatic` less than `cls.realtime` is necessary because the
client needs one frame to pop up the menu or toggle the console and set
the `cls.key_dest` accordingly. `abort_cinamatic == cls.realtime - 1`
is not possible because not every frame finishes a user command.

This closes #502.
2020-02-22 18:48:47 +01:00
Yamagi
9160af75d9 Recognize q2pro .pkz files.
Submitted by @Calinou in #520, closes #520.
2020-02-22 16:17:13 +01:00
Yamagi
50d442c1e8 Add sw_gunzposition to alter the guns Z offset.
An option like this was often requested since I fixed the gun field of
view in e466554. Since the software renderer is missing the ability to
alter the persepective matrix (e.g. something like glFrustrum()) this
fix fakes the offset by manipulating the guns transformation marix.
That's not perfect, the gun distorts if `sw_gunzposition` is set to
anything but `0`. Values up to `8` are more or less okay. Defaults
to `8` which matches the GL renderer default.
2020-02-22 15:43:46 +01:00
Yamagi
340b32827f Limit the fix against black debris (1f1a45a) to gibs, debris, monsters.
Pushing all entities slightly away from non-horizontal may let items to
slide to unreachable locations, or let monsters getting stuck.

This is part of yquake2/xatrix#50
2020-02-19 18:49:54 +01:00
Yamagi
bc9ffec5ac Update the CHANGELOG for 7.43. 2020-02-12 17:54:10 +01:00
Yamagi
e0067e90a8 Missing PVS Studio fixes for soft renderer.
Mod of the problems were already done by @0lvin in 129da805.
2020-02-10 18:21:29 +01:00
Daniel Gibson
b3f61f20d4 PVS Studio fixes for GL3 renderer 2020-02-10 17:55:41 +01:00
Daniel Gibson
00127cc912 PVS Studio fixes for GL1 renderer 2020-02-10 17:55:41 +01:00
Daniel Gibson
9f22f3d298 PVS Studio: Misc. fixes and FIXMEs 2020-02-10 17:55:41 +01:00
Daniel Gibson
95a3e46bdd PVS Studio fixes for game/ 2020-02-10 17:55:41 +01:00
Daniel Gibson
ae3723c900 YQ2_ATTR_NORETURN for functions that don't return (Sys_Error() etc)
must be used in front of functions, not behind (the GCC __attribute__
allows both, but MSVC and C11 don't!)
2020-02-10 17:55:41 +01:00
Daniel Gibson
0ad5c73239 move YQ2_ALIGNAS_* to shared.h
so it's also available in game/
2020-02-10 17:55:41 +01:00
Yamagi
b3bb114ae4
Merge pull request #517 from puleglot/gcc-fno-common
Fix build with -fno-common
2020-02-10 17:53:30 +01:00
Yamagi
95216a3c7e
Merge pull request #515 from devnexen/hunk_alloc_rework_fbsd
Hunk API, using FreeBSD super page for large requests.
2020-02-10 17:44:48 +01:00
Alexander Tsoy
60a4bd3306
Fix build with -fno-common
GCC 10 defaults to -fno-common.

Closes #516
2020-02-10 17:05:48 +03:00
David Carlier
0c1afcdfc1 Hunk API, using FreeBSD super page for large requests. 2020-02-08 20:55:50 +00:00
Yamagi
32b4e6f4a8
Merge pull request #511 from 0lvin/fixes
Small fixes
2020-02-03 16:06:49 +01:00
Denis Pauk
6e80924050 Fix segfault on device without available sound cards
In such case sound system left uninitialized and without cvars.
----
Thread 1 "quake2" received signal SIGSEGV, Segmentation fault.
0x00005555555956a1 in OGG_PlayTrack (trackNo=7) at src/client/sound/ogg.c:351
351 if((trackNo == 0) || ogg_shuffle->value)
(gdb) bt
#0  0x00005555555956a1 in OGG_PlayTrack (trackNo=7) at
src/client/sound/ogg.c:351
#1  0x000055555557bded in CL_PrepRefresh () at src/client/cl_view.c:367
#2  0x000055555556e1a0 in CL_Precache_f () at src/client/cl_main.c:472
#3  0x00005555555a40dc in Cbuf_Execute () at src/common/cmdparser.c:229
#4  0x000055555556f0f9 in CL_Frame (packetdelta=<optimized out>,
renderdelta=<optimized out>, timedelta=<optimized out>,
packetframe=packetframe@entry=true,
    renderframe=renderframe@entry=false) at src/client/cl_main.c:803
#5  0x00005555555aa0c5 in Qcommon_Frame (usec=5) at src/common/frame.c:626
#6  0x00005555555aa48e in Qcommon_Mainloop () at src/common/frame.c:163
#7  0x00005555555aaae6 in Qcommon_Init (argc=1, argv=0x7fffffffdfa8)
at src/common/frame.c:377
#8  0x000055555555e564 in main (argc=1, argv=0x7fffffffdfa8) at
src/backends/unix/main.c:123
----
2020-01-30 22:45:01 +02:00
Denis Pauk
dec8125e07 update stb_* codes
wget https://raw.githubusercontent.com/nothings/stb/master/stb_image_resize.h -O src/client/refresh/files/stb_image_resize.h
wget https://raw.githubusercontent.com/nothings/stb/master/stb_image.h -O src/client/refresh/files/stb_image.h
wget https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h -O src/client/vid/header/stb_image_write.h
wget https://raw.githubusercontent.com/nothings/stb/master/stb_vorbis.c -O src/client/sound/header/stb_vorbis.h
2020-01-30 22:29:05 +02:00
Denis Pauk
9f2f249aaa use snprintf in unix/system 2020-01-30 22:28:52 +02:00
Denis Pauk
fae078745f Use simular logic in ref_sw:setMode as in ref_gl 2020-01-30 22:28:36 +02:00
Denis Pauk
b1d3ddebbc use vsnprint in Com_Printf functions 2020-01-30 22:28:13 +02:00
Yamagi
3354252161
Merge pull request #509 from devnexen/network_unix_chg_proposals
unix network little change proposals/few possible leaks fixes
2020-01-28 15:33:31 +01:00
Yamagi
83c9358105
Merge pull request #503 from NeonKnightOA/skilllevel
Easier handling of skill levels by using defines instead of numbers.
2020-01-28 15:28:14 +01:00
David Carlier
28b65d11f8 unix network little change proposals/few possible leaks fixes 2020-01-26 11:43:22 +00:00
NeonKnightOA
6047c64e36 Easier handling of skill levels by using defines instead of numbers 2020-01-22 12:57:37 -03:00
Yamagi
aa8dc2f9b4 Add a Dockerfile, submitted by @Opvolger in #498.
If I understand this right it only builds the dedicated server. I think
that Dockerfiles need to be at the project root. Nevertheless I put it
under stuff/, the root dir is already cluttered enough.

Closes #498.
2020-01-21 17:26:29 +01:00
Yamagi
8383aea813 Fix small typo in GOG.com track mappings.
This closes #504.
2020-01-21 17:08:12 +01:00
Yamagi
29d607c550 Add work around for lost OpenAL output devices.
The Intel display driver for Windows 10 destroys the DisplayPort audio
device when the resolution changes. It's recreated at an unspecified
later time. This is a work around to recover from that:

* Check every frame if OpenAL is still connected.
* If not, wait for 2.5 seconds, after that inject a 'snd_restart'
  into the command buffer.

Samples send to the OpenAL backend while disconnected are skipped.
This fixes #483.
2020-01-15 14:16:44 +01:00
Yamagi
9f00655e8e
Merge pull request #501 from BjossiAlfreds/monsterframes
Monster frame handling improvements
2020-01-12 11:35:10 +01:00
Yamagi
dd529e80b3 Remove the link from the old to te new cvar list.
The new cvar list was added over a year ago and the link was broken for
several month, but no one complained. It's time to say goodbye.
2020-01-12 11:10:03 +01:00
Yamagi
8114748018 Document gl1_particle_square. 2020-01-12 11:05:15 +01:00
Yamagi
1cc2c94276 Don't call the software renderer experimental.
It's been over two years since we merged it into the master. @0lvin has
done a wonderfull job in maintaining it, he fixed a lot of bugs, did a
fair amount of enhancement, etc. There weren't any bug reports for the
last 6 month, it looks like that it's more or less stable right now. So
don't scare the users by calling it experimental.
2020-01-12 10:55:01 +01:00
BjossiAlfreds
18d38c46e0 Monster frame handling improvements 2020-01-11 22:38:14 +00:00
Yamagi
578256e53b Removed dead code missed in 43fa3a1. 2020-01-08 18:27:58 +01:00
Yamagi
2247f2ef35
Merge pull request #496 from BjossiAlfreds/timeout-fix
Fix for insane marines not firing deathtarget right away
2020-01-05 10:10:01 +01:00
BjossiAlfreds
115c5cf619 Fix for insane marines not firing deathtarget right away 2020-01-02 23:27:45 +00:00
Yamagi
43fa3a1be7 Fix cea7095, so that particles aren't renderes as some kind of dust.
This also simplifies the code a little bit by removing unnecessary (and
broken) pointer magic.
2020-01-02 15:17:31 +01:00
Mason UnixBeard
1c28f34cee Moved the point parameter enabling/disabling logic 2020-01-02 15:17:31 +01:00
Mason UnixBeard
6a9f0c46d7 Add case for when gl point parameters are not supported 2020-01-02 15:17:31 +01:00
DenisBelmondo
af45aa56f1 Added gl1 square particles CVar 2020-01-02 15:17:31 +01:00
Yamagi
e23010c9f9
Merge pull request #494 from DanielGibson/fix-gl_texturemode
Use gl_texturemode for UI and skies as well, fixes #489 and #491
2020-01-02 14:37:33 +01:00
Daniel Gibson
9f5ee77c77 Use gl_texturemode for videos, fixes #491
.. and whatever else uses Draw_StretchRaw()
2019-12-21 05:11:15 +01:00
Daniel Gibson
1077b7525f Use gl_texturemode for UI and skies as well, fixes #489 and #491
and make sure that after vid_restart (or starting the game) it's used
correctly in GL3.

While at it, made sure that it's *not* applied to textures from
gl_nolerp_list, because they're supposed to always use GL_NEAREST
independent of this setting (used so console font and crosshairs don't
look blurry)
2019-12-08 22:09:28 +01:00