Commit Graph

2632 Commits

Author SHA1 Message Date
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
Yamagi 642c2259aa
Merge pull request #549 from 0lvin/fix_big_pak
Dynamically allocate memory on PAK directory read
2020-04-20 08:58:47 +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
Yamagi 98cbb17bb4
Merge pull request #545 from 0lvin/apple_texture
MacOS softrender fixes #541.
2020-04-03 08:16:31 +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
Yamagi 0785996786
Merge pull request #538 from devnexen/fix_build_apple_backtrace_support
macos also support backtrace api.
2020-03-28 11:27:41 +01: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
Yamagi 9f7c5c205b Enforce the YQ2_OSTYPE override for mingw. 2020-03-24 13:37:31 +01:00
Yamagi fdef98ffc0
Merge pull request #534 from smcv/c11-funcptr-noreturn
Add a separate noreturn macro for function pointers
2020-03-23 18:12:13 +01:00
Yamagi 142690e164 Enforce a minimum architecture for ARM.
This was added in 558ee7 to master.
2020-03-23 16:48:56 +01:00
Yamagi c904880dc9 Another round of small Makefile fixes:
* ZIPCFLAGS was never defined, just appended to.
* Make INCLUDE overrideable.
2020-03-23 16:47:34 +01:00
Yamagi 11cb64ede2 Mark global additions to CFLAGS and LDFLAGS as `override`.
This prevents them from being overriden by command line variables, e.g.
something like `make CFLAGS=-0`. Requested by @smcv in #523.
2020-03-23 16:47:34 +01:00
Yamagi b48cc47465 Make setting the RPATH optional.
When WITH_RPATH is set to no, the default RPATH to $ORIGIN/lib isn't
set.

This was requested in #523.
2020-03-23 16:47:34 +01:00
Yamagi aa36dcad6c Make YQ2_OSTYPE and the hardcoded CC define for Windows overrideable. 2020-03-23 16:47:34 +01:00
Yamagi a26666d805 Mention CURL in the header and the build config. 2020-03-23 16:47:34 +01:00
Yamagi 36f77aa318 Make LDFLAGS overrideable. 2020-03-23 16:47:34 +01:00
Yamagi 09aad64202 Make the base CFLAGS overridable.
This was requested several times, the last time in pull request #523.
Only the optimization level, warning level and debug stuff may be
overridden. All other options are enforces because they're required.

While here add a new variable to force a debug build: `make DEBUG=1`.
2020-03-23 16:47:34 +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
Yamagi 466e689695
Merge pull request #532 from 0lvin/arm64
fix march armv8
2020-03-20 08:38:02 +01:00
Denis Pauk eeff4dae43 fix march armv8 2020-03-20 08:01:36 +02: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 3107c1a617
Merge pull request #531 from ConHuevosGuey/master
Document async configuration correction.
2020-03-18 15:46:23 +01:00
Con Huevos Guey df54d89fae
Document aynsc configuration correction.
Document stated setting 'async 1' disabled asynchronization.  This has been corrected.
2020-03-18 06:42:35 -05: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 16b657af89 Mention the gun Z offset in the CHANGELOG. 2020-02-24 17:15:09 +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