Some levels have robots with n_joints=0 and an invalid offset. If the
number of joints is zero, the offset is irrelevant. Reset it to 0, so
that a later call to partial_range will not trap.
Reported-by: kakhome1 <https://github.com/dxx-rebirth/dxx-rebirth/issues/485>
TORRaven reported an issue where `Descent: First Strike` level 4 in
cooperative games would cause the player 0 ship to be unable to move.
On investigation, this occurs when the host has enabled extra player
starts, and the resulting synthesis of new player start positions moves
the player 0 start out of its origin segment. The physics engine reacts
poorly to this situation, causing the object to be unable to move and to
report HIT_BAD_P0 in debug builds. Add a test to cancel the
displacement if get_seg_masks reports that the center point would move
outside the origin segment. More clever logic might be appropriate, but
since this is the first report of problems with the feature since its
introduction in 5a64ee5132, this commit just eliminates the
immediate problem. Possible future improvements if the existing
displacement causes collisions:
- Reduce the magnitude of the existing displacement, instead of
abandoning it entirely.
- Move the player start to the segment's center before displacing it.
- Add logic to move the player into a nearby logically connected
segment.
Reported-by: TORRaven <https://github.com/dxx-rebirth/dxx-rebirth/issues/483>
Fixes: 5a64ee5132 ("Add experimental support for larger cooperative games")
AlumiuN reported a crash when a save game is unable to load the
underlying mission. The crash is because the game proceeds to load the
savegame onto whatever level was loaded before this mission, which will
usually result in fatal inconsistencies in the data.
This commit does not fix the cause of the inability to load the mission,
but instead fixes the logic so that the user gets a reasonable error
message advising that the mission failed to load. This was
unintentionally broken in db80a88ad2 when the sense of the return
value was inverted, and the fallthrough case was not adjusted. This
impacts all uses of `load_mission_by_name`, though in practice restoring
from a savegame is the most obvious way to hit the problem.
Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/486> (indirectly)
Fixes: db80a88ad2 ("Improve error message on failure to load mission")
arch_close calls various library shutdown routines, some of which may
not be in good order after atexit hooks begin executing. Call it before
returning from main, so that the libraries are still fully initialized.
In exported archives, the commit will be
`archive-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` for some hexadecimal
characters `x`. `-` is not valid in a C identifier, but the commit
needs to be a valid C identifier. Change `-` to `_` so that it will be
valid.
Reported-by: andrew-strong <https://github.com/dxx-rebirth/dxx-rebirth/issues/484>
Fixes: fafa07a456 ("Instruct git-archive to insert a commit ID in SConstruct")
Python 2 byte sequences look best when not decoded. Python 3 byte
sequences look best when decoded. As Python 2 is near end of life and
most distributions have moved on to Python 3, switch to the style that
looks better in Python 3. The code still runs in Python 2, but produces
a u'' wrapper around the text because the type is `unicode` in Python 2,
but `str` in Python 3. This change eliminates the b'' wrapper around
the text in Python 3.
Extended identifiers have proved to cause more problems than they solve.
Switch to base32 which, while less commonly supported, is available in
Python and uses an alphabet that is almost a subset of the C identifier
alphabet. Padding characters are still a problem, but can be remapped
to a valid C identifier that is not a valid base32 character.
Rebirth handles this as best it can, but some prerequisites print paths
without quoting. Advise users to avoid the problem by avoiding paths
with embedded spaces.
endlevel wants to freeze the console player's last in-mine position.
Instead of copying the position out and back, refactor the flow to let
endlevel skip the update of the position.
Only the console player's last position needs to be remembered across
frames. Copy the console player's position out before processsing
object movement. For all other objects, retain a temporary for use by
the position recovery code.
Special macros are used to pass information to
`generate-kconfig-udlr.py`. Provide default definitions for these
macros in `kconfig.ui-table.cpp`, and override them in the one build
where they need to be special. This enables `kconfig.ui-table.cpp` to
build cleanly when invoked from the command line in the compilation
database.
Various functions need to access both `shared_segment` and
`unique_segment` data. Using `segment &` for this blocks eliminating
the `segment` type. Add `susegment` and type aliases to it.
`susegment` records a reference to a `shared_segment` and a
`unique_segment` together, so that users cannot accidentally mismatch
`shared_segment` #1 with `unique_segment` #2 when passing references
down to a function which needs both `shared_segment` and
`unique_segment`.
Inserting the compile command for vers_id.cpp into a compilation
database does not quote a string with embedded whitespace, although this
string is correctly quoted when used to invoke a shell. Remove
whitespace from the character whitelist, so that it is always escaped.
gcc considers strong_typedef to be POD both with and without the
explicit default. clang considers it to be POD only if the constructor
is explicitly defaulted.
For correctness, valptridx::ptridx instances must not be sliced down to
their component ::ptr or ::idx base classes. Previously, this was done
with a dummy template parameter to ensure that a bare ::idx had a
different type than the idx base of a ::ptridx. This extra distinction
complicates analysis of the code, and is not needed when the code is
already correct. Add the ability to build without slice checking.
obj_rw is a packed structure, so configurations where reset_hitobj takes
its parameter by reference (or where its parameter requires passing
through a constructor that takes its input by reference) fail because
gcc refuses to bind a reference to a member of a packed structure. Copy
the member variable into a local, which gcc will bind.
In some configurations, gcc (but not clang) instantiate
valptridx<segment>::array_managed_type too eagerly, then fail if the
sizeof(segment) is unknown. Include segment.h so that the size is
available.
Fix a bug where the ptridx converting move constructor delegated to the
ptr converting copy constructor, since the ptr copy constructor had
filename/line arguments, the ptr move constructor did not, and the
ptridx move constructor always passed filename/line.