Commit graph

3171 commits

Author SHA1 Message Date
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
David Carlier
3e63226bad Translate changes to the Makefile build too 2020-06-26 12:43:06 +00: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
486441eb0e
Merge pull request #576 from pettyalex/macos-relative-linker-path
Enable rpath with Mac OS linker
2020-06-02 08:29:18 +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
Alex Petty
a2d6cc9cdc Mac OS uses @executable_path not for rpath 2020-05-20 19:39:09 -05:00
Alex Petty
895c7bc850 Enable rpath with Mac OS linker 2020-05-20 19:30:52 -05: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
Yamagi
94caa85a64
Merge pull request #569 from bibendovsky/fix/508_liquid_shader
Move liquid transformations into fragment shader
2020-05-11 11:31:41 +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
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