Set secondary weapon flags to appropriate values when saving game, so that if it's loaded with 0.58.1 or earlier the player can actually select all secondary weapons they have at least one of (while not causing side effects with demo data). Fixes issue referred to in comment https://github.com/dxx-rebirth/dxx-rebirth/issues/291#issuecomment-282528356
init_boss_segments no longer needs to save and restore the boss position
and size. Remove that, and switch the pointer to `const object &` to
enforce it.
Expose sphere_intersects_wall and call it directly from
boss_fits_in_seg, so that boss_fits_in_seg does not need to modify the
position and segment of the boss during the test.
If boss has teleported before, even before a loaded state was saved, play the boss looping sound immediately when loading the saved game (if near the boss). Resolves issue #326.
clang becomes confused trying to determine which vm_distance_squared
constructor to use for a literal input of 0x7fffffffffffffff, even
though the size of the input requires it to be `long` and only one
constructor can take a `long`. Switch from an explicit
0x7fffffffffffffff to the symbolic constant INT64_MAX, which has the
same value, but a platform-appropriate suffix to force the compiler to
pick the right type.
For general clarity, switch some other instances of integer maximum
literals to symbolic constants of the same value.
This commit has no effect on the generated code (except for changes to
line numbers).
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/pull/324>
Fixes: 17208cca79 ("Disallow int for vm_distance_squared")
After getting game over, playing a demo would result in the 'Game Over' banner being shown. When loading a saved game, it would fail an assert when trying to obj_delete a NULL Dead_player_camera in dead_player_end().
When objp is nullptr, ai_door_is_openable assumes Buddy_objnum is a
valid object number, but this assumption is not guaranteed to be true.
When it is false, the game crashes. This crash can be triggered by a
brain robot trying to make nearby robots snipe.
Fix the crash by passing the robot of interest.
Reported-by: Yarn <http://www.dxx-rebirth.com/frm/index.php/topic,2165.0.html>