Materialization centers ("Matcens") have a governor to prevent
overrunning the level in robots. However, due to a logic ordering
error, multiplayer games failed to record how many robots had been
destroyed, so for the purpose of detecting whether there were currently
"too many" robots in play, the game pretended that no robots had ever
been destroyed. Therefore, once enough robots had been created to reach
the "too many" threshold, matcens stopped generating robots, regardless
of how efficiently the player(s) had been destroying robots.
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/132>
Reported-by: Sirius-TR <https://github.com/dxx-rebirth/dxx-rebirth/issues/386>
If no character matches the typed character, the loop should exit when
`lb->citem == cc`, which should happen after every entry is visited
once. However, if no item is selected, `lb->citem == -1`, and `cc` is
never `-1`, so the exit path never triggers. Rewrite the loop to be
bounded by number of steps, rather than bounded by returning to a
particular offset. This also protects against undefined behavior if the
menu had zero elements.
[Kp: as discussed in pull #377
<https://github.com/dxx-rebirth/dxx-rebirth/pull/377>, the previous
implementation requested a parameter combination not permitted by
OpenGL. At best, this error was silently ignored. Fix the error by
falling through to a switch case statement that sets valid parameters.]
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>.]
Global `Viewer` was copied to local `viewer`, and the local should have
been used in this block. Instead, the global was incorrectly used.
gcc-5 warns for this unused variable. gcc-6 and gcc-7 incorrectly do
not warn.
Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/issues/375>
Fixes: 131c1b9f4d ("Add support for PNG screenshots")
Mako88 requests, as have others in the Rebirth forum, that the FPS
indicator be placed on the right side. Moving to the right side was
quick. Moving it low, handling all the different rendering combinations
(cockpit, statusbar, fullscreen; standard vs alternate; single player vs
multiplayer), and not overlapping anything in any of them was time
consuming.
If anyone wants more changes in this area, the existing modes ought to
be revisited and unified. As is, there are pointless inconsistencies
among the modes, which makes it unnecessarily difficult to position an
element correctly.
Requested-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/122>
Commit d580328 eliminated junk whitespace in the individual line items
for joinable games. Unfortunately, this whitespace was not junk. It
was an undocumented workaround (possibly even unknowing workaround) for
a bug that undercounts the space required to show the header. Restore
the "junk" padding to force the window back to its old width.
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/374>
Fixes: d580328698 ("Combine direct_join allocations")
Mako88 reports incorrect images captured when using a screen resolution
of 1366x768. 1366 is not a multiple of 4. Debugging also shows memory
corruption at this resolution, as Mesa writes off the end of the
allocated buffer. Padding the buffer to tolerate these writes is
insufficient, as libpng then crashes with an alignment fault trying to
read unaligned data from the buffer. All these problems are eliminated
by rounding the width and height to the next multiple of 4.
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/373>
Fixes: 131c1b9f4d ("Add support for PNG screenshots")
Ambient sound effects have always been buggy in certain topologies,
since `ambient_mark_bfs` refuses to cross its own path. Consider a
corridor:
L _ _ _ _ _ _ _ _ _ _
_ _
_ L
Where L is a lavafall emitting sound, whitespace is insignificant, _ is
a segment, * is a tagged segment, and / is a segment that should be
tagged, but is not. Let the leftmost L be a lower number segment than
the lower L. Sound propagation after the first step is:
L * * * * * _ _ _ _ _
* _
* L
After the second step, it should be:
L * * * * * * * * _ _
* *
* L
However, `ambient_mark_bfs` will stop when it hits the intersection, so
instead the result is:
L * * * * * / / / _ _
* *
* L
To further confuse the issue, emitter segments are processed in memory
order, so if the leftmost L is a higher index segment than the lower L,
the lower L will be processed first and the steps will be:
L _ * * * * * * * _ _
_ *
_ L
L * * * * * * * * _ _
/ *
/ L
Rewrite the propagation to record the travel depth remaining at each
node, and permit it to cross a segment with a lower depth remaining than
the current step. This still stops early when traversal attempts to
backtrack over itself, but permits it to visit, tag, and cross segments
that were previously visited by a different emitter.
clang rightly warns for `if (!var&1)`, which parses as `if (!(var &
1))`, which is probably not what the original author intended.
Unfortunately, the author never commented what *was* intended. The
author might have meant to reject any row with an even length (`if
(!(var & 1))`, but that seems strange in this context. Remove the `&
1`, which retains the sense of what the code has always done.
clang warns for taking the address of unaligned data, but not for taking
a reference to it. It should warn for both. The data should be fixed
not to be unaligned, but for now, this change will quiet the warning.
OS X clang warns when a variable is captured but not used. Linux gcc
does not. Remove the unused variable.
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/368>
Fixes: 7da64d3782 ("Add new autoselect-while-firing mode: "when firing stops"")
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)).
Many predicate functions only need to return zero/nonzero, and the
callers do not care about the particular value of nonzero. Use this to
eliminate loads of explicit `1`, instead returning a nonzero value
generated by the test.
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