Gauges aligned to the left side of the screen try to move up in
multiplayer, and move farther in large multiplayer games. However, the
logic for this was inconsistent, and could draw shields and afterburner
state on the same line. Fix this by computing the starting point once,
and passing it down to the functions that need it.
Reported-by: snytek <https://github.com/dxx-rebirth/dxx-rebirth/issues/521>
Testing for buttons||hats||axes is equivalent to testing for
joysticks!=0, since SConstruct forces joysticks=0 when
buttons == 0 && hats == 0 && axes == 0. Remove tests of
buttons||hats||axes when those occur inside a test for joysticks!=0.
This block previously was used to clear TRIGGER_ON, but that change was
removed because TRIGGER_ON was a write-only flag. This block is now
useless, so remove it. This should also fix an obscure crash reported
by AlumiuN.
AlumiuN proposed adding a test that seg->children[side] is still valid,
but since the logic to execute would be useless even when the test
succeeds, it is simpler to remove this code entirely.
Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/515>
Suggested-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/pull/518#issue-443277182>
This reverts commit 60edaa7dce.
This commit was brought in through a merge to obtain a different change,
and was supposed to be suppressed in preference to the change from
dfcb0fcdc. Revert it here, since reloading the variable suffices to fix
the problem, and this commit forces a reload on all platforms, rather
than only reloading on platforms that need it.
This ensures that an array is indexed by the appropriate type. Indexing
a mouse array with a joystick index is undefined behavior, and with this
change, such undefined behavior is now a compilation error.
If axes!=0 and buttons==0 and hats==0, then the build fails because some
button-related functionality is missing. Move the joystick axis->button
bridge into a conditional to exclude it in this case.
Fixes: 74ef8b02e6 ("Added axis buttons")
PHYSFSX_fsize opens the file, reads its length, and closes it. Calling
PHYSFSX_fsize in a loop is wasteful, since the file size should not
change while the game is playing.
This makes the alignment data structure `chunk` private to interp.cpp,
and allows most files to ignore whether DXX_WORDS_NEED_ALIGNMENT is
enabled, thus improving the ccache hit rate.
kajott reports that on Raspberry Pi systems, "Medium Hulk and Heavy Hulk
models were missing their heads". This impacts all systems with
words_need_alignment=1, and was introduced by logic that tried to
truncate invalid polygon models, which was added because such models
often crashed the game. The validation logic used the original size of
the polygon model data, which is correct on systems with
words_need_alignment=0, but can be too small on systems with
words_need_alignment=1 if the polygon model was enlarged as part of
aligning it. Such systems would refuse to read past the original,
shorter, length, and then declare the model to be broken and truncate
it. Fix this by reloading the length from the polymodel structure after
the alignment logic is applied.
Reported-by: kajott <https://github.com/dxx-rebirth/dxx-rebirth/pull/519>
Fixes: 42a2e3ab0b ("Avoid crash loading polymodels with invalid subcalls")
lengthof was added to provide the size of C arrays. C++17 std::size is
now available, and can serve the same purpose. Remove the custom
lengthof.
The generated code is the same in both cases, other than the change in
line numbers caused by removal of the #include directives.
Use an enum class to prevent implicit conversion between trigger
behavior flags and other integers. Fix up various resulting breaks,
which look like bugs:
- Descent 2 editor mode could modify trigger::flags, but used
TRIGGER_FLAG_* values, which specify the actions for a Descent 1
trigger when it executes, not the behavior properties for a trigger.
- Adding a trigger set its flags to 0, then cleared all flags except
TRIGGER_ON. Since the flags were just set to 0, the mask operation is
useless. Remove it.
- trigger_turn_all_ON cleared all flags except TRIGGER_ON. This seems
to be completely wrong. Change it to remove
trigger_behavior_flags::disabled. Descent 1 has no (working) support
for disabling triggers, so make trigger_turn_all_ON exclusive to
Descent 2.
- wall_restore_all would enable TRIGGER_ON in both games. Descent 1
never reads TRIGGER_ON. Descent 2 uses this field for trigger
behavior flags, and TRIGGER_ON is not a behavior flag.
- For Descent 1 builds, remove the modification of the field.
- For Descent 2 builds, change it to clear
trigger_behavior_flags::disabled.
Normally, this shouldn't matter, and on almost all
OpenGL drivers out there, it really doesn't, but
the Raspberry Pi 4's "V3D" Mesa driver behaves
differently: It simply won't draw any lines as long
as GL_CULL_FACE is enabled, so we need to disable
it.
If compiled with words_need_alignment=1, the
model data was correctly converted and expanded,
but the old size was still used for validating
and initializing the model.
This caused funky effects on affected platforms,
e.g. some robots missing their heads on Raspberry Pi.
It's possible to enter empty savegame descriptions,
which is no problem itself, but it looks quite
confusing in the save/load menus: you can't see
the currently selected item, for instance.
This commit replaces an empty description with a
placeholder text ("no title") upon saving.
This is particularly useful when controlling
the game only with a joystick, where entering
a proper description isn't possible.
Instead of parsing the button name string,
an explicit button-to-key mapping table
is now built and used.
Also fixes a few minor inconsistencies
that were introduced in c24864b1.