Commit Graph

2696 Commits

Author SHA1 Message Date
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
Yamagi 1eca56a4a3
Merge pull request #566 from echoline/master
musl libc and uclibc do not have backtrace()
2020-04-27 12:52:45 +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 00e6eb6303 Remove unnecessary OSX_ARCH setting, replace it with YQ2_ARCH. 2020-04-21 13:57:09 +02:00
Yamagi beadebbdec Document `aimfix`. 2020-04-21 13:00:00 +02:00
Yamagi f043db2a56
Merge pull request #562 from BjossiAlfreds/disruptor-doc
Added doc entry for g_disruptor cvar in GroundZero
2020-04-21 12:55:10 +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
BjossiAlfreds 975298b3f2 Added doc entry for g_disruptor cvar in GroundZero 2020-04-21 00:28:51 +00: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
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