The new tracker automatically exposes LAN games to the Internet. This
surprised one user rather badly, prompting him to think he had been
hacked. Add a first-host warning explaining the feature and asking the
user to choose whether to enable NAT hole punch.
Reported-by: Tourmeister <https://forum.dxx-rebirth.com/showthread.php?tid=943&pid=12179#pid12179>
References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/372>
Fixes: 730879d733 ("... Added support for handling ACKs from tracker and Hole punching between game clients via tracker. ...")
Per comment from kreator, some Apple systems now ship without a working
print screen key. It makes no sense to provide print screen support
bound to a key which does not exist. Add `screenshot=none` and activate
it on OS X to remove the unreachable screenshot support.
GCC std::remove_if overwrites removed elements using:
*dstiter = move(*srciter);
This is fine for normal containers, but produces incorrect results when
*dstiter returns a proxy object instead of a reference. In that case,
the proxy object is move-assigned from the source, then goes out of
scope. If the move assignment did not write to underlying storage, as
valptridx proxy objects do not, then incorrect results occur. This
broke ActiveDoor handling (fixed in 4a01fab66d98[1]) and has been a trap
waiting to recur. Apply reference-qualifiers to valptridx objects so
that move-assignment requires an lvalue for the left-hand side. This
permits normal use of move-assignment, but forces a compile error if
std::remove_if or similar are used on valptridx proxy objects.
[1]: 4a01fab66d
digi_play_sample_once is supposed to cancel prior instances of the
sound, but that functionality was lost in
21082c6db2. As a result, the sound can be
stacked up to the limit of the engine. Even when the functionality
existed, its implementation was wrong.
- Change these sounds to be attached to the player generating them.
- Pass the cancellation flag to other players when sending a sound.
- Send the full value of `volume`, rather than truncating it.
- Implement cancellation by killing and restarting the earlier version of a cancelled sound.
- Delete an ugly hack that prevented the patched logic from ever running.
- Fix an ancient quirk in digi_mixer that caused it to report all sounds as not playing, which then caused digi_sync_sounds to instantly cancel the new sound.
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/88>
Reported-by: ryusei117 <https://github.com/dxx-rebirth/dxx-rebirth/issues/88#issuecomment-269597361>
Fixes: 21082c6db2 ("Added own channel management to SDL_mixer sound interface since the builtin channel management of this lib cannot handle our needs; Little code cleanup")
Future work is simpler without this, and the stringified name is only
visible in debug output, which is in turn rarely used due to its
verbosity and lack of filtering controls.
Per C99, this code was always wrong. The results of `snprintf` are
undefined if the target string array and one of the supplied input
arguments refer to the same buffer. In practice, this particular usage
happened to work by wastefully copying a string onto itself, then adding
more content at the end. Switch to appending properly, which also fixes
the gcc-8 -Wrestrict warning.
References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/388>
Various files included compiler-static_assert.h to use the compatibility
macros for compilers that lacked a working C++11 static_assert.
However, some source files used static_assert without this inclusion,
and no one ever reported problems. From this, assume that no one uses a
compiler which lacks C++11 static_assert. Remove the inclusions that
were only for the compatibility macro. Keep the inclusions that use the
assert_equal helper.
- Remove the one test that clang-5 still fails.
- Require all remaining tests to pass using only C++11 native
static_assert.
- Remove preprocessor-based alternative static_assert implementations.
gcc-8 adds calls to static_assert with a comma inside its first
argument in the implementation of std::vector. This is legal within the
standard, but conflicts with Rebirth's use of static_assert as a
two argument preprocessor macro. The macro is not substantially useful,
and was only present to compensate for the clang limitation removed in
the previous commit. Remove the macro.
References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/388>
valptridx contains `static_assert` statements of the form:
static_assert(var.m, "");
where `var` is a non-`constexpr` reference and `m` is a `static
constexpr` member of a base type of `var`. gcc recognizes that a
`static constexpr` member is a constant expression and permits this.
clang rejects this, presumably because `var` is not a `constexpr`
variable. In the almost 3 years since this was added, clang has not
improved to permit this usage. Rather than continuing to suppress
static_assert in clang, rewrite this expression to be less clear, but be
compatible with clang.
gcc-8 has special cases in its std::advance that require the target to
support `operator++` and `operator--`. These are easy to support, so
add them.
References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/388>
gcc-8 warns that static_cast<dt &>(d) is useless. In general, it is
useless. It is present to force a compile error in cases when `d` is
not convertible to `dt &`. Switch to a compound statement that declares
a local reference to `d` of type `dt &`. This achieves the same
checking effect, but does not provoke the -Wuseless-cast warning.
References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/388>
Users with disabled VSync might not expect any forced waiting on the GPU,
and the GL sync methods were intented to fix issues with VSync only,
so the new heuristic for SYNC_GL_AUTO is to enable GL sync only if
VSync is enabled, too.
Users can still request to use a specific GL sync method via the
-gl_syncmethod switch, independent of the VSync setting.
[Kp: folded `else { if () }` into `else if ()` to avoid moving
`ogl_have_ARB_sync` lines. Original change visible at
<https://github.com/dxx-rebirth/dxx-rebirth/pull/381>.]
This mirrors the logic from calc_frame_time(). When VSync is enabled,
waiting for the previous frame to complete might induce long wait periods,
up to the complete frame time, so we should also handle multiplayer there.
For the other sync modes, the GL calls will simply block, so we can't do
anything about that (except going multithreaded, but that's a totally
different can of worms). Note that even without sync, the SwapBuffers()
call in gr_flip() may also block if VSync is on (and enough frames are
queued up), so the issue is not the GL sync code itself.
SYNC_GL_FENCE_SLEEP is now probably the nicest mode for multiplayer
with VSsync, as it is the only one which has the potential to continue
handling multiplayer packets during the wait for VBlank time.
Packed structures cannot be passed by reference, may fail on
alignment-strict architectures, and are bad for performance even on
alignment-tolerant architectures. Using them for anything other than an
abstract layout declaration is a mistake. Remove
__attribute__((packed)).
gcc-5 rejects `constexpr bool DefiningMarkerMessage() const` because
`d_marker_state` is not literal. Later versions of gcc accept this, but
the `constexpr` is not useful here since one term is a runtime variable.
Remove `constexpr`.
Also, modify the definition of `marker_message_text_t` and
`d_marker_state` to encourage the compiler to initialize `MarkerState`
at compile time instead of load time.
Fixes: 49a4ac1c0e ("Move more marker state to d_marker_state")
User roncli reports[1] an original game bug that prevents boss
teleportation from operating correctly if the program is not restarted
between each campaign. This is another case of a global variable being
used improperly. Reset the relevant variables when the boss is
initialized.
[1] https://github.com/dxx-rebirth/dxx-rebirth/issues/366#issuecomment-373199624