Commit graph

2165 commits

Author SHA1 Message Date
Yamagi
d5dcf3a772 Fix several inconsistencies and typos in console output. 2020-10-08 12:38:29 +02:00
Yamagi
e3aefbff2c Add some more build time options to the startup output.
* cURL
* Systemwide installation
2020-10-08 12:08:20 +02:00
Denis Pauk
db20a6ce18 Add ioquake3 vstr/nextdemo support 2020-10-06 23:38:12 +03:00
Yamagi
0a159eefb2 Limit the work around against wrong resolutions to fullscreen.
When Q2 runs in windowed mode, SDL can never switch to the wrong the
resolution. The resolution isn't switched, of course. The work around
prevented Q2 from creating Windows larger than the resolution of the
primary display. For example a primary display of 1280x1024 prevented
a window size of 1680x1050 on the much bigger secondary display.
2020-10-06 17:52:14 +02:00
Yamagi
dfaf33e478 Force stdout and standerr on Windows to unbuffered mode.
Normally stdout and stderr are buffered. In case of a crash the last
lines aren't written to the stdout.txt, making post mortem debugging
difficult. Forcing both FDs to unbuffered mode ensures that everything
gets written. The performance impact is negliable.
2020-10-06 17:22:50 +02:00
Yamagi
741ffcdb1c
Merge pull request #604 from devnexen/last_bit_for_haiku
Last bit for proper Haiku support.
2020-10-06 16:55:41 +02:00
David Carlier
800cdf9617 Last bit for proper Haiku support.
Even tough it is a multi user os, due to BeOs heritage and being backwards
compatible with, the desktop runs as root, thus its dog get eaten after all...
2020-10-02 14:36:57 +00:00
David Carlier
6bb23c908f Little simplification for NetBSD, sysctl works just fine too. 2020-09-30 22:56:19 +01:00
Yamagi
41931d7a06
Merge pull request #599 from earth-metal/master
Create "mods" submenu to allow changing "game" cvar via UI
2020-09-12 16:11:26 +02:00
Yamagi
213a338d03
Merge pull request #598 from JoBergeron/map-autocomplete
map name autocompletion
2020-09-12 16:02:44 +02:00
earth-metal
a4de026eb3 Create "mods" submenu to allow changing "game" cvar via UI
Combs all Raw search paths to find game dirs containing PAK/PK2/PK3
files.  If multiple uniquely-named directories exist, then show a "mods"
option on the "Game" menu and allow selection of desired mod on new
eponymous submenu.  Includes fix for memory leak of mapnames (read from
"maps.lst") when changing games.
2020-09-06 16:43:36 -04:00
JBerg
a843ef416f map name autocompletion 2020-09-05 22:32:13 -04:00
David Carlier
e4fac541a9 Haiku support, code simplification.
using more straightforward approach to get the current binary path.
Actual approach more fit to get other infos (e.g. address mappings and so on).
2020-09-01 11:27:26 +00:00
David Carlier
5e89f96067 Hunk: FreeBSD set the map permission to max read and write
which cannot be made executable afterwards.
2020-08-24 23:45:54 +01:00
Yamagi
2bb6fdf4a8
Merge pull request #592 from earth-metal/master
Start Server Menu: reload "maps.lst" after "game" dir is changed
2020-08-23 20:33:19 +02:00
earth-metal
c31926ec90 Reset map list in "start network server" menu when "game" cvar changes
When the "game" directory is changed, clear the current list of maps in
the "start network server" menu so that it will be re-initialized the
next time the menu is accessed.
2020-08-23 14:06:01 -04:00
Daniel Gibson
37a5ca8a8d Make "wait" in scripts wait for >= 17ms, fix #591
so it waits for about the time of one frame at 60fps, but independently
of the actual framerate.
Without this fix, wait is broken unless vsync is on, because
CBuf_Execute() is called about 1000 times per second by Qcommon_Frame(),
even if no render- or packet-frame is executed.
(vsync "fixes" this because then we have a real wait at the end of each
 renderframe)
2020-08-23 17:21:20 +02:00
Yamagi
634748a5b5 Add missing return type for SV_ListMaps_f() 2020-08-23 10:34:52 +02:00
Daniel Gibson
93d1dfe60d Fix typo in Qcommon_Mainloop() that reduced performance, refs #591
We busy-looped for 5000 microseconds, i.e. 5 milliseconds, which reduces
the framerate to < 200fps
I guess the value was copypasted from Sys_Nanosleep() below, but
that was nanoseconds of course..
Anyway, busy-looping for 5 *micro*seconds instead fixes it.
2020-08-20 17:27:09 +02:00
Yamagi
0fdc3750e0
Merge pull request #589 from JoBergeron/listmap-cmd
added listmaps command
2020-08-20 07:19:27 +02:00
JBerg
b746f4520d added listmaps command 2020-08-18 23:18:22 -04:00
Yamagi
1f3f796322 Add cl_anglekick, when set to 0 angle kicks are ignored.
Angle kicks are used for weapon recoil, damage kicks and the like.
Setting the `cl_anglekicks` to `0` ignored them, they're read from
the network but not displayed. The cvar is cheat protected, it's
reset to `1` on server connect.

Rquested by Martin via mail.
2020-08-17 14:18:51 +02:00
Daniel Gibson
fd0c058b2e Implemented coop_elevator_delay cvar (for func_plat)
In coop it's often hard to get on the same elevator together, because
they're immediately triggered once the first player steps on it.
This cvar sets a delay (1 second by default) for the elevator to wait
before moving, so other players have some time to get on it.
If you like elevators/platforms that suck, just set it to `0` :-P

Currently only used in func_plat, if it turns out that other entities
are used for automatically triggered platforms, we'll have to adapt
those as well (I guess wait_and_change() is generally useful for that).

We're not bumping the savegame version because they should only break in
an uncommon corner case: *Coop* savegames created with clients including
this change will not work on older clients - SP savegames are not
affected and old savegames on new clients also still work.
2020-08-10 14:27:35 +02:00
Yamagi
1a6dea5a0b Add coop_pickup_weapons, allow a weapon to be taken several times.
In coop a weapon can be picked up only once. That's annoying, because in
coop ammunition is sparse and not getting the ammunition that comes with
a weapons make things worse. When `coop_pickup_weapons` is set to `1` a
weapon may be picked up if:

1) The player doesn't have the weapon in their inventory.
2) No other player has already picked it up.
2020-08-10 13:52:33 +02:00
David Carlier
0200434187 backtrace support rework proposal.
Linux/Solaris supports it in the libc however, BSD in general, Haiku
relies on an external library.
2020-08-03 10:19:41 +00:00
Yamagi
9136c8705a Fix lithium2 crashing at startup.
This is one these constructs which makes you wonder how it could ever
work. When querying a cvar by calling Cvar_Get(), the default value
(given in `var_value`) is copied into `cvar_t->default_string`. If a
NULL pointer is given in `var_value`, the NULL pointer is passed to
CopyString() and dereferenced. The game crashes. There's already a NULL
pointer check in the 'cvar wasn't found' branch, but none in the 'cvar
was found' branch... Moving the check to the beginning of the function
isn't an option, because at least lithium2 doesn't implement a NULL
pointer check either. We would just move the crash from the server into
the game.dll. Therefore copy an empty string into
cvar_t->default_string` when a NULL pointer was passed in `cvar_value`
and the cvar was found. Pass the empty string trough `CopyString()` to
get an Z_MAlloc() allocation for it, otherwise we would call `Z_Free()`
on an unallocated object further down below.

Reported by Chris Stewart.
2020-07-11 09:32:11 +02:00
Yamagi
2ab4e5553a Prevent music from playing even if ogg_enabled is 0.
ogg_enabled doesn't prevent music from playing, it just toggles if the
ogg backend should be enabled or not. If the user does something like
`ogg_enable=0; snd_restart` everything is okay. If they just set
`ogg_enable=0` strange things happen because the backend stays
initialized and will play tracks as requested. Work around the by
shutting the backend down if `ogg_enable == 0 && ogg_started == true`.

Closes #583.
2020-06-30 14:46:48 +02:00
Yamagi
06436d0d30 Bump the buffers used by the config file parser to 32k.
This allows really bug configuration files up to 32k. It would be better
to switch the global buffer to something allocated at runtime, but thats
non-trivial... This change should be save, since the buffers are global
(allocated in the BSS) and not included in savegames nor send over the
network.

Closes #582.
2020-06-30 14:13:14 +02:00
Yamagi
7439bdd45c
Merge pull request #581 from devnexen/haiku_port
Haiku porting proposal.
2020-06-26 16:12:34 +02:00
Yamagi
0491b54284 Force the dedicated server to use nanosleep() based waits.
It's an often reported, that the q2ded dedicated server consumes huges
amounts of CPU time. That's because users don't know that `busywait`
must be set to `0`. Since there's no point in using busywaits in the
dedicated server (the network jitter is always bigger than the
jitter caused by nanosleep() and equivalents), just force q2ded to
use nanosleep().
2020-06-26 12:46:40 +02:00
David Carlier
6c4187a6e3 using custom sting copy fn instead 2020-06-21 11:00:20 +00:00
David Carlier
a2b274d1a5 Haiku porting proposal. 2020-06-20 19:05:55 +00:00
Yamagi
ea0c0c04a2 Fix crash with some projectiles generating sound targets.
Some projectiles like grenades or rockets are classified as enemies.
Their explosion spawn a sound entity, monsters should move to that. But
the projectile is destroyed when exploding, it's entity struct is set to
NULL. Therefor the self->enemy pointer is also NULL. The self->enemy
check was removed in bc5f5698. Work around this by pretending that the
enemy is already there.

This was reported by @Soldy, closes yquake2/xatrix#56.
2020-06-04 08:12:36 +02:00
Yamagi
57f7ce86e8 Make ffe8f89 somewhat more readable and add a comment. 2020-06-02 08:31:02 +02:00
Yamagi
ffe8f893ed Abort downloads if a server hasn't a file over UDP.
This is a special case, the bug was already present in Vanilla Q2: If a
server is offering assets for download but is missing some files the
USP download code runs in an endless loop. CL_ParseDownload() detects
that something is wrong and calls CL_RequestNextDownload() which tries
to download the same file again... Work around this by skippig over that
file.

This closes #552.
2020-06-02 08:03:06 +02:00
Yamagi
7f339952cb
Merge pull request #575 from kondrak/master
Fixed the Jorg skin bug present since the original Quake 2 release.
2020-05-11 12:59:06 +02:00
Yamagi
3c681210ba
Merge pull request #574 from 0lvin/for_review
fix tearing with fix palette change(explosion near without move)
2020-05-11 12:30:47 +02:00
Yamagi
93c0302d79
Merge pull request #572 from BjossiAlfreds/gunner-idle
Fix for gunner AI freeze bug
2020-05-11 11:42:40 +02:00
Krzysztof Kondrak
6d9930fd75 Fixed the Jorg skin bug present since the original Quake 2 release. 2020-05-10 15:00:34 +02:00
Denis Pauk
ef841ce98c fix tearing with fix palette change(explosion near without move) 2020-05-09 14:11:12 +03:00
BjossiAlfreds
8de243a42f Fix for gunner AI freeze bug 2020-05-08 22:10:34 +00:00
Boris I. Bendovsky
0ae9f55089
Move liquid transformations into fragment shader 2020-05-04 22:42:08 +03:00
Yamagi
3492dff774
Merge pull request #564 from bibendovsky/fix/558_silenced_muzzle_flash
Don't play silenced muzzle flash sounds
2020-05-04 18:19:28 +02:00
Yamagi
33591ceb6e Update stb_vorbis to 37b9b20fdec06c75a0493e0bb59e2d0f288bfb51.
This fixes the crash reported in #568 for me.
2020-05-04 18:17:41 +02:00
Boris I. Bendovsky
93a0473244
Add cvar to control sorting of play sounds 2020-05-04 18:44:58 +03:00
Boris I. Bendovsky
1887072cc9
Merge remote-tracking branch 'upstream/master' into fix/558_silenced_muzzle_flash 2020-05-04 17:41:36 +03:00
Yamagi
8f2542e05f Limit the new order of the pending sound lists to baseq2 and the addons.
The new ordering was introduced in 16ee007, fixing some problems with
the wrong sound getting played when an entity triggers several sound at
the same timestamp. This broke the behavior of the mods, in #558 dday
was mentioned, muzzle flashe sound prevent the firing sound from getting
played.

Since we don't control the source of all mods, add a simple band aid
fix: Use the new ordering for baseq2, xatrix and rouge. Use the old
ordering for everything else.

An alternative approach is being discussed in #564.
2020-05-04 09:51:53 +02:00
Linux User
c4e43f0403 musl libc and uclibc do not have backtrace() 2020-04-25 20:30:55 -07:00
Boris I. Bendovsky
4646859535
Don't play silenced muzzle flash sounds 2020-04-22 17:53:41 +03:00
Yamagi
563ef16ee3 Exec autoexec.cfg everytime game changes.
I don't remember why we restricted it to client startup. The original
code executed it everytime when `game` changed... Revert to that
behavior. Look here if some problems come up. ;)

Closes #544.
2020-04-21 14:06:16 +02:00
Yamagi
5455ffa96f s_doppler should default to 0.
The doppler effect is a game play change. And it's rather badly
implemented. Discussed in yquake2/xatrix#51.

Closes yquake2/xatrix#51.
2020-04-21 13:58:58 +02:00
Yamagi
73d0812d9f
Merge pull request #561 from mjr4077au/Client_AimFixWithCVAR
Implement accurate-aiming CVAR in baseq2 game code.
2020-04-21 12:54:32 +02:00
Mitchell Richters
85fb607010 Implement accurate-aiming CVAR in baseq2 game code. 2020-04-21 06:17:40 +10:00
Yamagi
19214d6049 Implement adaptive vsync.
Adaptive vsync is a often requested feauture and easy to implement. Set
`r_vsync` to `2` to enable. This is untested because my system doesn't
support it.
2020-04-20 12:31:25 +02:00
Yamagi
fc99e5456f Make the gun fov optional.
Set r_gunfov to force the gun fov to be the same as the global fov.
While here finally commit somes missed parts of 50d442c.
2020-04-20 11:57:27 +02:00
Yamagi
1299a807ed
Merge pull request #557 from BjossiAlfreds/insta-powerups
Fix for some items playing wrong sound when instantly used
2020-04-20 09:00:13 +02:00
Yamagi
d1a53bdeec
Merge pull request #551 from DanielGibson/scancode-input
Scancodes for Input and other keyboard input improvements
2020-04-20 08:59:55 +02:00
Daniel Gibson
d675254e4e (More) special cases for key names in configs
There already was one (that I only recently fixed) for semicolon, but
the same problem can happen with quotes or $ (which is used in macros)
(single-quote ' is probably not affected, added it just to be sure)
2020-04-12 00:40:30 +02:00
BjossiAlfreds
ef5c0adf0c Fix for some items playing wrong sound when instantly used 2020-04-11 01:50:57 +00:00
Daniel Gibson
d6cdcc3e52 Make sure K_CONSOLE up events are ignored
otherwise we might get an error about an unbound key for up (!down)
events.
2020-04-11 03:04:54 +02:00
Denis Pauk
3e039d1cbd dynamically allocate buffer for PAK 2020-04-10 23:35:26 +03:00
Daniel Gibson
a44225c625 Introduce K_CONSOLE, generated by the keyboard's "console key"
regardless of keyboard layout, with a special exemption for layouts
where that key generates a quote character (like the Brazilian one)
because you may wanna type a quote into the console.
(It's SDL_SCANCODE_GRAVE, that key between Esc, 1 and Tab)

The old hack of matching for ^, ~ and ` in Char_Event() didn't work very
well for layouts we didn't anticipate, which is especially relevant with
the recent Scancode fallback, which for example allows binding the ^ key
on Belgian keyboards (which is on SDL_SCANCODE_LEFTBRACKET, far away
from the "console key"), but in that case would *also* open the console.

This is mostly straight-forward, except for a small hack to prevent the
key from generating text input (on German layouts you otherwise get
"^" in the console when closing+opening it), which requires the
"console key" to be pressed without any modifiers like Shift or AltGr.
Yes, it's ugly, but it works and all the uglyness is contained in
IN_Update() and on the other hand Char_Event() becomes less ugly :)
2020-04-10 06:21:10 +02:00
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
Denis Pauk
841076f2a9 Fix game shutting down on error 2020-04-06 23:11:07 +03:00
Yamagi
5b327c0417 Don't use yield opcode if unsupported.
This is an enhancement to the previous `yield` work:

* Don't enforce `-march=armv8-a` for aarch64 builds, because it is the
  initial ARMv8 revision and compilers will either use that or something
  newer.
* Refine preprocessor guards around `asm("yield");` so the code isn't
  compiled in if unsupported by the current `-march='.

Submitted by @smcv in #535.
2020-04-03 08:30:41 +02:00
Denis Pauk
9e5ba15eac MacOS softrender fixes #541.
On MacOS texture is cleaned up after render and code have to copy a whole
screen to texture, other platforms save previous texture content and can
be copied only changed parts.
2020-04-02 23:26:55 +03:00
David Carlier
e50fb5dbe4 macos also support backtrace api. 2020-03-27 19:01:36 +00:00
Yamagi
9acb99ed08 Determine the qport in a more random way.
YQ2 has a much more precise Sys_Milliseconds() than Vanilla Quake II and
it always start at 0, not some other semirandom value. If the client is
started by `./quake2 +connect example.com" or all user just walk their
way to the menu there's a very high propability that two ore more
clients end up with the same qport... We can't use rand(), because we're
always starting with the same seed, so all clients generate more or less
the same random numbers and we end up in the same situation.

So just call time(). It's portable and more or less in line what the
original code did for Windows. It may be necessary to implement some
kind of fallback logic just in case that still two clients end up with
the same qport, but that's a task for another day.

Closes #537.
2020-03-24 13:38:06 +01:00
Yamagi
16ea835aa1 Fix partial broken connection to IPv6 / q2ded listening on IPv6 addrs.
This was introduced in 220f0a9 as fix. The submitter, @DanielGibson and
myself missunderstood the code:

* If net_interface is NULL (which in the current code can never happen),
  an empty string (the user sets the `ip` cvar to an empty string) or
  "localhost" (the default) we want to set `Host` to the unspecified
  address. getaddrinfo() will return in6addr_any fot it and we'll bind
  to any available address.

* "0.0.0.0" isn't the IPv4 any address, it's the unspecified address.
  Thats correct and the code was working fine for IPv4. But at least
  the submitter and me confused it with the any address (which is
  0.0.0.0/0). So setting `Host` in the IPv6 to `::/128` (the lowest IPv6
  address) or `::/0` (any IPv6) is wrong, it must be `::` (unspecified
  IPv6 address)!

Have a look at RFC 3493 for the details.

I'm doing the change only for the Unix code path, not for Windows. For
some reason everything besides `::/128` or `::1` doesn't really work on
Windows and I don't know why. Even more scary is that changes to the
IPv6 case also break IPv4 sockets. Since the whole network.c for Windows
is confuse and rather hard to understand (there's still IPX support in
it) I'm leaving things as they are.
2020-03-24 13:38:06 +01:00
Simon McVittie
6f6e27644e Add a separate noreturn macro for function pointers
C11 _Noreturn is only accepted on function declarations, not on function
pointers, so we can't use it on callbacks like game_import_t.error and
refimport_t.Sys_Error. Use a separate macro for those.

The problematic situation doesn't currently happen because the Makefile
hard-codes -std=gnu99, which disables C11 features; but removing
-std=gnu99 (resulting in the compiler's default, currently gnu11) causes
compilation failures with at least gcc 9.x.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-03-21 18:32:15 +00:00
David Carlier
558ee70b3e Issue 'yield' in main loop to give CPU time to cool down.
This is functional equvalent to the 'pause' instruction on x86.
2020-03-18 15:50:45 +01:00
Yamagi
a5eb0b16da Fix build on Windows after last commit. 2020-03-16 16:02:03 +01:00
Yamagi
b2f0430c9f Hack a simple way to specify the CFGDIR at command line.
Until now CFGDIR was hardcoded to YamagiQ2 on Windows and .yq2 on
everything else. Sometimes it's desireable to have a separate dir
for some tasks, for example  whentesting things that introduce new
cvars. Add -cfgdir to override CFGDIR.
2020-03-16 15:49:04 +01:00
Yamagi
fd1874ff0f Mark all remaining m_* cvar as CVAR_ARCHIVE.
This is another fix for 60a4bd3. Closes #529.
2020-03-16 15:49:04 +01:00
Yamagi
904f14f2ff Bump MAX_STRING_CHARS to 2048 and MAX_TOKEN_CHARS to 1024.
This allows for longer arguments passed to cvars, gl_nolerp_list is a
good example for a case were a token length of 128 is too short. Keep
the mapname[] buffer in the server struct at 128 bytes to preserve
savegame compatibility.

Closes #526.
2020-03-14 17:15:40 +01:00
Yamagi
6b7af81cd2 Change show_hostile from int to float and remove unnecessary casts.
In the vanilla code show_hostile was a qboolean what's clearly wrong.
For wome reasons I don't remember I changed it to an integer and added
the casts. This is problematic because show_hostile is derived from
level.time which is a float. The loss in precision broke some corner
cases like monsters becoming activated when they shouldn't.

Found, analyzed and reported by @BjossiAlfreds #525. Closes #525.
2020-03-10 10:24:44 +01:00
Yamagi
373ecdf429
Merge pull request #521 from 0lvin/for_review
Small cleanup
2020-02-27 18:50:36 +01:00
Yamagi
6d93077f43 Include limits.h in cl_cin.c; it's apparently needed.
I wonder ehy neither me nor @DanielGubson run into this; on Arch Linux
on some kind of Ubuntu, on FreeBSD or Windows... Closes #522.
2020-02-26 17:47:51 +01:00
Yamagi
e0ed5b7599 Bump the version to 7.44pre. 2020-02-24 17:16:27 +01:00
Yamagi
d08cf04d2d Bump the version the 7.43. 2020-02-24 17:15:39 +01:00
Yamagi
0a08d8bfb1 Add back CVAR_ARCHIVE, lost in 60a4bd3.
I hate this code. 60a4bd3 removed unnecessary Cvar_Get() calls,
unfortunately they were the ones defining CVAR_ARCHIVE. The
remaining ones did not...
2020-02-23 18:46:35 +01:00
Denis Pauk
b3c23dee5b make cppcheck happy and use same version messages as other renders 2020-02-23 08:19:02 +02:00
Denis Pauk
aaade648b9 Replace *_ResampleTexture to ResizeSTB 2020-02-23 08:15:06 +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
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