Reading from Players[] while not in a game is not well-defined. Get the
local player's callsign from InterfaceUniqueState instead.
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/435>
Fixes: bea95ce1df ("Reset definedness of per-game globals on new game")
It is reinitialized if the segment is a special segment, but not
reinitialized if the segment is a normal segment. Most segments are
normal segments. The absence of this initialization permitted players
to keep the value from a prior level. For normal segments, this would
normally not be a problem, because the value is only meaningful for
special segments. However, the netgame synchronization code always
mixes in the value of every station_idx, regardless of whether the
segment is a special segment. As a result, late-joining guests who
started directly onto the current level could disagree with the host
about the value, causing a synchronization mismatch. The host would be
wrong, but the guests would be blocked from joining. For this purpose,
late-joining includes both people who joined the campaign late and
people who left the game and restarted the program, even if they had
previously been in the game.
Reported-by: OldSaltyGamer <https://forum.dxx-rebirth.com/showthread.php?tid=1098&pid=12630#pid12630>
[ Possibly also previously reported by LightWolf, but that report never
had enough information to proceed. The report from OldSaltyGamer solved
this. ]
Fixes: 596ecbb38d ("Rename segment::value to segment::station_idx")
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")