Commit graph

2611 commits

Author SHA1 Message Date
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
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
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