It has always been here, but appears to serve no purpose.
`multi_explode_robot_sub` clears `Stolen_items`, so at first look, this
swap seems to be preserving the prior values. However,
`multi_send_robot_explode` does not use `Stolen_items`, and after
`multi_send_robot_explode` completes, `Stolen_items` is explicitly wiped
again. Thus, removing the whole block will let the wipe performed by
`multi_explode_robot_sub` stand, producing the same result with less
code.
The number of hostages in a game is a function of the the game's levels,
not any particular player. Move it to d_game_unique_state and rename it
to total_hostages.
The number of hostages on a level is a function of the level, not any
particular player. Move it to d_level_unique_object_state and rename it
to total_hostages.
The number of robots accumulated in a game is a function of the the
game's levels, not any particular player. Move it to
d_game_unique_state and rename it to accumulated_robots.
The number of robots accumulated on a level is a function of the level,
not any particular player. Move it to d_level_unique_object_state and
rename it to accumulated_robots.
In Descent 1, up until commit 8291391, boss robots teleported without
regard to whether the player was visible or active. Commit 8291391
changed that in an attempt to make the D2 emulation of D1 boss robots
behave well in levels that relied on the D2 quirk of spawning the boss
in a confined segment, then letting it teleport freely once the player
releases it. However, that change applied even in D1 missions and in
the D1 engine, where maps were designed with the expectation that boss
robots teleported routinely. Restrict the new rule to the D2 engine
playing D2 levels. This enables boss robots to teleport freely on D1
missions, regardless of which engine is used. It would be better if
there were a level flag explaining whether the author wanted the boss to
teleport freely, but there is no such flag, so this heuristic must
suffice.
Reported-by: TheMiracleMatter <https://github.com/dxx-rebirth/dxx-rebirth/issues/434>
Fixes: 8291391b7f ("Fix D2 emulation of D1 boss teleport handling")
Commit 829e95b6 meant to remove the restriction that the game not be
hoard mode, but incorrectly also removed the restriction that the game
be multiplayer. Restore the multiplayer restriction.
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/433>
Fixes: 829e95b6f8 ("Separate hoard/proximity tracking")
This removes the need to walk all objects when creating a new one, since
each object can have a private generation counter, unaware of other
objects. For compatibility with demos, mix in the object's index when
writing the signature value.
`init_new_page` calls `load_briefing_screen` with the a pointer to
`br->background_name`, which causes a strncpy of the form
```
strncpy(X, X, N);
```
Valgrind warns for this overlap. The copy is useless in that case, so
skip it.
A prior change switched to using the greater, rather than the lesser, of
`16` or `Countdown_seconds_left`, which increased the rotation from the
ship rocking effect. Switch back to use the lesser value.
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/431>
Fixes: 644d6fa513 ("Simplify do_countdown_frame ship rocking effect")
This was requested by a user in early 2018. However, the proposed
prototype was susceptible to various forms of desynchronization, and was
unsuitable for merging. No further revisions were proposed, and the
feature languished. This commit enables the guidebot in cooperative
games and addresses the known synchronization problems, as well as some
other bugs that were uncovered during light testing. This is classified
as an experimental feature because it has not been heavily tested in
complicated games.
Requested-by: cfeuersaenger <https://github.com/dxx-rebirth/dxx-rebirth/issues/364>
`make_nearby_robot_snipe` computed the `robot_info` of every `object` in the
area before checking whether those `object`s were of type `OBJ_ROBOT`. This
is wrong, but usually harmless since it checked the type before using
the resulting `robot_info`. Starting in commit 9f26e2211, this triggered
a warning whenever `make_nearby_robot_snipe` checked nearby non-robot
`object`s.
Rewrite the tests to check for type `OBJ_ROBOT` before reading the
`object`'s id.
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/429>
Fixes: 9f26e2211e ("Warn on invalid object ID access")
Commit 9898d13 fixed a crash on long filenames, but also tried to
optimize the Destination Saturn hack. However, this optimization was
implemented incorrectly, and caused the game to read only the
Destination Saturn highest_level entry when playing the First Strike
campaign, rather than using the greater level of Destination Saturn or
First Strike.
Restore the old logic, but restrict it to D1X. D2X never used an empty
string for the First Strike campaign, so this logic could not trigger
there, which is also how the bug was missed in initial testing.
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/428>
Fixes: 9898d136f1 ("Fix fortification crash loading missions with long filenames")
In multiplayer, the host sends a destroy message for both sides of the
wall. `do_exploding_wall_frame` processes both, but
`num_exploding_walls` is only decreased by 1, causing an assertion
failure at the end. Remove the assertion, since the wall does not
explode instantly on join, despite being marked as WALL_EXPLODING.
PhysFS 3.0 tests whether archive members are directories, but treats a
symbolic link that points to a directory as distinct from the underlying
directory, even when symlink following is enabled. As a result, if
$D2X_REBIRTH_HOME/missions is a symlink to a directory, then it is
ignored and no missions are available. In PhysFS 2.0, the link was
followed and the missions were available.
Add a trailing dot to the path, which already has a trailing slash, to
force PhysFS to consider the underlying directory, not the link.
In one path, load_briefing_screen is called with `br->background_name`
as an input. This caused a call to `snprintf(a, sizeof(a), "%s", a);`,
which is undefined behavior. Switch back to the prior style of
unconditionally declaring a local array, performing filename
manipulation in that array, and copying the array back to
`br->background_name` afterward.
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/420>
Remove use of object_guidebot_cannot_reach and instead track the
reachability of the object as a separate flag. This allows the game to
remember when an object was found, but unreachable. Previously, it
would store only that some unreachable object was found. Now, it stores
the index of the unreachable object. This extra information is not used
yet.
Reported-by: Dainslaif <https://github.com/dxx-rebirth/dxx-rebirth/issues/421>
Fixes: c3cead4319 ("Move Escort_goal_index to d_unique_buddy_state")
`blast_nearby_glass` calls `check_effect_blowup`, but ignores the result.
If `check_effect_blowup` executes a blow-up effect, and the blown object
is a switch, the return value will instruct the caller to execute the
associated trigger. Since `blast_nearby_glass` ignores the return
value, it never executes a trigger. This was originally masked by a bug
that passed undefined data from `blast_nearby_glass` to
`check_effect_blowup`, which usually confused `check_effect_blowup` into
treating the explosion as not originating from the player. This
confusion then forced an early return when a switch was hit, effectively
accidentally making switches invulnerable to `blast_nearby_glass`.
Commit f6352e7 fixed the data confusion, allowing `check_effect_blowup`
to recognize that the explosion came from a player's weapon. However,
it did not add handling for the trigger, so now `blast_nearby_glass` can
destroy the switch without activating the trigger. This is at the least
annoying, and in some levels may make progress impossible. There are
two ways to resolve this:
- Fix the logic to always execute the switch when the switch is
destroyed, whether by direct hit or by `blast_nearby_glass`.
- Restore the quirk that switches are invulnerable to
`blast_nearby_glass`.
Conveniently, the `force_blowup_flag` is set by `blast_nearby_glass` and
clear for all other callers, so it can be used to recognize that the
caller will not handle the switch. Use this to implement choice 2.
Even with this change, a direct hit by a missile can still destroy a
switch and activate its trigger, since that is handled through
`collide_weapon_and_wall`. Thus, players can still use the technique of
using a guided missile to activate an otherwise impossible switch.
Fixes: f6352e7957 ("Pass correct object to check_effect_blowup")
Reported-by: wm4 <https://github.com/dxx-rebirth/dxx-rebirth/issues/419>
gcc-9 warns on taking the address of an unaligned member in a packed
structure. This structure does not need to be packed. Remove
__attribute__((packed)) and fix the code to implement I/O correctly
without packing.
Utility xrange, inspired by the Python2 feature of the same name,
provides an object that returns successive values from [start, end). It
is useful when the end index is known in advance, and is particularly
helpful when that index is expensive to recompute.
Descent 1 mangles colors during `g3_init_polygon_model`, so this must
not be called on polygons not designed for mangling. Rearrange the
logic to allow Descent 1 to verify that polygon models are well-formed
without using the functions that mangle the colors.
Fixes: 42a2e3ab0b ("Avoid crash loading polymodels with invalid subcalls")
Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/416>
Windows std::ptrdiff_t is `int` instead of `long` as it should be.
Expand the values out to `long` (which is the same size as `int` on
Win32!) before printing them. This fixes format string warnings.
Reported-by: Ninjared <https://forum.dxx-rebirth.com/showthread.php?tid=857&pid=12555#pid12555>
Fixes: 42a2e3ab0b ("Avoid crash loading polymodels with invalid subcalls")
The highest-level tracking code assumed filenames would always fit in a
char[9]. This was true on DOS, but has not been true in Rebirth for
many years. Builds without fortification caused silent memory
corruption in this case.
Refuse to create highest-level entries if they would cause corruption.
Log a diagnostic telling the user that this happened.
Fix original bug that buddy was limited to 5 hints per program run, not
5 per boss as it probably should have been.
Due to savegame format limitations, this still is not right. Reloading
the game should restore Buddy_gave_hint_count to its value at save time,
but will not.
Bitmaps based on grs_main_bitmap own their data. Bitmaps based on
grs_bitmap do not. Adjust prototypes to prevent initializing a
grs_main_bitmap with data it will not own.
Release builds should never have an object in CT_SLEW state. If they
do, they abort the program. This is an extreme reaction. Change the
logic to report the problem, then coerce the type to CT_NONE and try to
resume operation.
Processing sharepath in SConf is incorrect, because targets can share a
build directory (and therefore an SConf run), but not share a sharepath.
Move sharepath handling out of SConf. Move DXX_USE_SHAREPATH handling
from CGameArg to GameArg, since one game can be built with a sharepath
while the other is built without.
clang warns for using an uninitialized array during the
member-initialization-list, before the union constructor would have done
nothing. clang permits using the still-uninitialized array in the
constructor body, after the union constructor has done nothing.
The same code is generated both before and after this commit, but the
old code produces a warning and the new code is silent.
```
similar/main/physics.cpp:282:5: error: field 'a' is uninitialized when used here [-Werror,-Wuninitialized]
e(a.begin())
```
gcc-4.9 rejects defining a class with a reference member and no
constructor, even though the use of the class uses a
brace-initialization expression to set the reference at construction
time.
Fixes: fa654324ad ("Pass context to wall.cpp:cwframe, cw_removal_predicate")