A new configurable joystick button binding is
introduced that opens the ingame menu, i.e. the
menu that appears when pressing the Escape key.
Fortunately, there was still enough space left
in the button binding maps for both games. The
configuration screen, however, needed to be
extended by a row to make room for the new
binding on d2x.
One known issue: When using an old player
configuration file, the menu button bindings
are initially set to J1 B1, because the unused
slots in DefaultKeySettings used to be
initialized that way. There's not much we can
do about that; the player needs to remove
these bogus assignments by hand. We can (and
do) prevent that from happening again, though,
by initializing new player files with correct
unmapped buttons.
In most menus, keyboard commands are synthesized
from controller buttons, leveraging the existing
axis-to-button translation.
Menu controls are currently fixed:
- button 0 (A) is confirm (Enter)
- button 1 (B) is cancel (Esc)
- button 2 (X) is switch (Space)
- button 3 (Y) is delete (Delete)
- axes 0 and 1 (main analog pad) maps to cursor keys
- all hats (D-pads) map to cursor keys
Title screens and credits can be confirmed
with any joystick button or axis motion too.
Similar to 09eff19a66, _g3_draw_poly can
store the control information on the stack to avoid an allocation, since
the total size is bounded and relatively small.
Similar to 09eff19a66, _g3_draw_tmap_2 can
store the control information on the stack to avoid an allocation, since
the total size is bounded and relatively small.
This was once a compatibility shim, but compiler support for std::begin
has been required since 5e434cbe95 and no
issues have been reported. Flatten the include tree by removing this
header and using the STL names directly.
A declaration is useful if it declares an external function. A static
inline declaration, if not followed by the definition later in the same
translation unit, will not be useful. Remove such declarations, and
rely on using the definition as a declaration for those files that
actually call partial_range() or similar functions.
This fixes PCX loading in the non-editor build. PCX loading broke in
3114874713 because it switched from PHYSFSX_openReadBuffered to a call
which did not handle the presence of the marker byte in the filename.
The from_hog_only flag has not been properly supported since the
introduction of PHYSFSX_openReadBuffered in
8b323e7214. Editor builds ignored it on
purpose, and non-editor builds pretended to respect it, only to then
ignore it down inside PHYSFSX_openReadBuffered. For consistency with
code paths that do not use PHYSFSX_openReadBuffered, disable the bypass
in PHYSFSX_openReadBuffered and remove the code in show_title_screen
that applied the flag.
Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/issues/510>
Fixes: 3114874713 ("Delegate PCX loading to SDL_image")
The automap code keeps a mostly-private secondary copy of control_info.
The change to reset control_info before the event loop reset the main
copy of control_info for the automap, not the copy that the automap
actually used. Fix this by passing the desired control_info to relevant
functions instead of always using the global variable Controls.
Fixes: c621a970c6 ("Reset kconfig counters once, before the event loop")
This field is used in the SDL build for rendering. In the GL build, its
only purpose is for the editor to write it to a PIG file. Change that
one use to compute the value as needed. Move all other references
behind a preprocessor test for !DXX_USE_OGL. This shrinks the size of
grs_bitmap by 1 pointer, since the compiler added padding after
avg_color up to the size of the next aligned pointer.
This adds a new dependency, but most systems likely already have
SDL_image installed. Use of SDL_image can be disabled, but this is
discouraged, because various in-game interfaces assume the use of the
original background.
The old implementation automatically corrected for filename case. The
new implementation expects that the supplied filename can be passed to
PYHSFS_openRead as-is. All known uses in-game have been corrected to
satisfy this requirement. If the new stricter match requirement becomes
a problem, a variant of PHYSFSRWOPS_openRead that adjusts filename case
could be created for use here.
- Update install instructions
- Update ebuild
- Update Arch PKGBUILD
gcc-10 warns that the game information text may be truncated, because it
overestimates the maximum possible length of some strings. Handle the
warning by changing the format string to explicitly truncate these
strings at their maximum legal lengths.
gcc-10 warns that if immediate_directories were very large, the sprintf
result would be truncated. This is true, but a user is extremely
unlikely to have enough directories to trigger this code path. Handle
the warning by explicitly returning an empty string if truncation would
otherwise occur. This is not strictly correct, but it can be handled
with very little code, eliminates the warning, and is unlikely to matter
in practice.
As reported in pull #507, the D1 implementation of the reduction was
incorrect and never reduced laser power. Therefore, when D2 emulates
D1, D2 should emulate the effect of the bug, by not reducing laser
power.
The code that provides the 0.75x multiplier to laser bolts when they're fired
using the quad laser is present in D1 as in D2, however it is incorrect and
results in it not being applied. As such, it is more accurate to exclude the
multiplier when compiling D1.
Thanks to SaladBadger for the tip.
Commit 2bcc7bb371 restricted
Laser_create_new to only create lasers for known weapon types. This
seemed like a good idea, but broke custom levels that use undocumented
laser types. It also replaced logic that coerced invalid weapon numbers
into a type 1 laser with logic that prevented firing such weapons at
all. This rendered robots with unknown or broken weapon data unable to
fire.
Commit 0c30fa7cf3 relaxed the logic to
prevent firing only in editor builds, but allow firing unknown or
invalid weapon types in release builds. Firing unknown weapon types may
work. Firing invalid weapon types may cause the game to crash when data
is accessed beyond the end of the defined weapon data. This caused the
crash reported in issue #506.
Revert to the 0.58.1 rule that invalid weapons are coerced to be a
player level 1 laser. Add a diagnostic when such a weapon is fired,
since the level author should have requested that weapon explicitly if
that was intended.
Reported-by: heftig <https://github.com/dxx-rebirth/dxx-rebirth/issues/506>
Fixes: 2bcc7bb371 ("Only create lasers for known weapon types")
newpath is a std::array and does not decay to char* automatically.
Use data() method to get char[], which does decay to char*.
This compile-time issue only affected Mac OS X.
The minimum supported compiler versions now provide a depth-efficient
implementation of std::make_index_sequence, which removes the last
reason to carry a private implementation. In the case of clang, it
appears to have a special compiler intrinsic used to implement its
std::make_index_sequence.
Switch to the compiler-provided version for both gcc and clang.
gcc-4.9 support is now difficult to test due to system libraries linking
to newer symbols. gcc-4.9 is unsupported upstream, as are gcc-5 and
gcc-6. Raise the minimum required gcc version to the minimum version
supported upstream.
Debian Jessie shipped gcc-4.9.2, and support for this target was the
primary motivator for retaining gcc-4.9 support. Jessie ended regular
support in June 2018, and will end Long Term Support in June 2020. It
seems unlikely that Jessie would receive a snapshot build of Rebirth in
the months it has left.
Debian Stretch shipped gcc-6, but is currently considered "oldstable"
and has been superseded by Debian Buster. Further, Debian Stretch
provides a package for gcc-7, so Stretch users can still build Rebirth
using only packages available from the package manager.
Commit d355ef4030 removed a seemingly unnecessary modification of the
global variable grd_curcanv->cv_font, after eliminating all local reads
of it. However, a non-local read, buried in listbox_mouse, depended on
grd_curcanv->cv_font being set to a MEDIUM font. After that commit,
grd_curcanv->cv_font retained its prior value, which is not a MEDIUM
font. This caused listbox_mouse to compute an incorrect height of the
lines in the listbox, which manifested as the game choosing the wrong
line when the mouse is clicked in the listbox.
Fix the problem by explicitly using MEDIUM3_FONT, since that was
usually the value left in grd_curcanv->cv_font prior to that commit. In
some cases, a different MEDIUM font would be left there, but all the
MEDIUM fonts have the same height, so they are interchangeable for this
purpose.
Reported-by: Q3BFG10K <https://github.com/dxx-rebirth/dxx-rebirth/issues/498>
Fixes: d355ef4030 ("Pass font to various drawing functions")
andrew-strong reported that using SDL2, with the window set to full
screen, but a windowed size less than full screen, caused letterbox
sequences, such as the player ship destroyed sequence, to render in a
subwindow sized to the dimensions game would have when unmaximized, even
if the game window is maximized at the time of the sequence.
tycho suggested a change that resolves this issue, and basic testing
showed no unwanted side effects.
Reported-by: andrew-strong <https://github.com/dxx-rebirth/dxx-rebirth/issues/399>
Suggested-by: tycho <https://github.com/dxx-rebirth/dxx-rebirth/issues/399#issuecomment-583688998>
ziplantil reported that in Descent 1, if a player has an empty Vulcan
cannon, and no energy, then attempting to fire a weapon would play the
SOUND_ALREADY_SELECTED clip every frame until the player ceased trying
to fire. The problem does not impact Descent 2 since Descent 2 does not
play this sound sample when trying to activate a weapon that is already
active.
If the current weapon is already LASER_INDEX, then
select_primary_weapon(LASER_INDEX) simplifies to:
```
// Pointless, player already using this weapon
newdemo_record_player_weapon(LASER_INDEX)
if (Primary_weapon != LASER_INDEX) {
// skipped, path is false
}
else
{
if (wait_for_rearm) // true for this path
// Bad, plays every frame
digi_play_sample(SOUND_ALREADY_SELECTED);
}
// Pointless, Primary_weapon already is LASER_INDEX
Primary_weapon = LASER_INDEX;
if (weapon_name)
{
// skipped, path is false
}
```
Skipping the call avoids two pointless statements, one bad statement,
and nothing useful. Therefore, the simplest fix for the problem is to
call select_primary_weapon(LASER_INDEX) only if the primary weapon is
not currently LASER_INDEX.
Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/499>
Read the entire buffer at once, then remove the carriage returns and set
a null terminator. This reduces the number of calls to PHYSFS_read from
len to 1.
It reads uninitialized values, so it was barely functional before
morph_data became a dynamic allocation, and it is broken now. Disable
it to avoid crashing the game. The demo code should have initialized
the morph_data structure properly, but does not.
Reported-by: tycho <https://github.com/dxx-rebirth/dxx-rebirth/issues/496>
Fixes: cac5f1da56 ("Move morph_data into dynamic allocations")
When building with AddressSanitizer, gcc warns that `i` may not fit,
because the compiler fails to adequately constrain the possible values
for `i`. Add a control-flow hint to inform gcc about valid values.
These variables are used, but optimized builds eliminate all reference
to their address, so the build normally succeeds. Unoptimized builds
retain references to the address, so a definition is required for them.
Reported-by: tycho <https://github.com/dxx-rebirth/dxx-rebirth/issues/496>
Fixes: 595c3ca086 ("Move Boss_cloak_interval to d_level_shared_boss_state")
Fixes: c61dee7e6a ("Move Boss_teleport_interval to d_level_shared_boss_state")
Returning from a secret level clears the player's `hostages_on_board` to
0 as part of initializing a "new" ship, but this is not desirable
behavior. Copy the counter out before and back afterward.
```
Thread 1 "d2x-rebirth-edi" hit Hardware watchpoint 1: -location d2x::LevelUniqueObjectState.Objects._M_elems[0].ctype.player_info.mission.hostages_on_board
Old value = 5 '\005'
New value = 0 '\000'
#0 d2x::init_player_stats_ship (GameTime64=<optimized out>, plrobj=...) at similar/main/gameseq.cpp:613
#1 d2x::init_player_stats_level (secret_flag=d2x::secret_restore::survived, plrobj=..., plr=...) at similar/main/gameseq.cpp:615
#2 d2x::StartNewLevelSub (level_num=level_num@entry=3, page_in_textures=page_in_textures@entry=1, secret_flag=secret_flag@entry=d2x::secret_restore::survived) at similar/main/gameseq.cpp:1901
#3 d2x::state_restore_all_sub (LevelSharedDestructibleLightState=..., secret=d2x::secret_restore::survived, filename=<optimized out>) at similar/main/state.cpp:1670
#4 d2x::state_restore_all (in_game=in_game@entry=1, secret=secret@entry=d2x::secret_restore::survived, filename_override=<optimized out>, blind=blind@entry=dcx::blind_save::no) at similar/main/state.cpp:1490
#5 d2x::ExitSecretLevel ()
```
Reported-by: teratorn <https://github.com/dxx-rebirth/dxx-rebirth/issues/495>
Commit d879fc7f6b changed the type of `newpath` and updated all uses
in common code. A Windows-only block was skipped. Update that now.
Fixes: d879fc7f6b ("Convert file selection to use array<char, N>, not char[N]")
When presented with an overlong string, throw std::runtime_error instead
of corrupting memory. Either way, the result is a crash, but this crash
is safe, deterministic, and probably easier to debug.
The historical savegame format cannot support finding a mission in a
subdirectory. Add a backwards-incompatible modification to store the
full path in the savegame, and store it in a way that old versions will
fail gracefully.[1] When loading demos, or legacy savegames, search for
the mission in all available directories. Demos are still written with
an unqualified path because the demo loading code would crash if given
an oversized path. Mission names sent over the network as part of
multiplayer use the guess logic now, so that guests do not need to have
the mission in the same path as the host.
[1] Versions affected by issue #486 may fail ungracefully.
Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/491>
- In D2X, do not accept Descent2-specific directives from Descent 1
`.msn` files.
- Set the descent_version field correctly in the `mle`. Previously,
`.msn` was set to descent1 and all `.mn2` were set to descent2,
regardless of whether the `.mn2` used `name`, `xname`, `zname`, or
`!name`.
- Avoid rewinding the file and rereading the same line while checking
the possible name types.
- Avoid recomputing end-of-string when it is already known.
- Avoid re-reading the mission file's version when the mission is
chosen. Instead, use the version that was recorded when the mission
was loaded into the mission list. This also fixes a bug where Descent
1 `.msn` files would be classified as descent_version_type::descent2
since both use `name =`, but that string has a different meaning
depending on whether the file is `.msn` or `.mn2`.
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.
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.
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.
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.
Historically, Descent ignored any trailing unconverted characters. The
logic in Descent 1 was tightened in 3368390f37, and then the logic in
Descent 2 was made to mirror Descent 1 in 19699037ce. Restore the lax
parsing logic in both games.
Reported-by: InsanityBringer <https://github.com/dxx-rebirth/dxx-rebirth/issues/464> (issue 5)
Fixes: 3368390f37 ("Check for valid SuperX number") (for Descent 1)
Fixes: 19699037ce ("Move d2x-rebirth/main/bmread.cpp -> similar/main/bmread.cpp") (for Descent 2)
In Descent 2, `type` is initialized at declaration time, then never
rewritten. At the end of the function, `Error` is called if `type` has
not been rewritten. Originally, `type` was hard reset to
`OL_CONTROL_CENTER`, but this reinitialization was removed when
`ObjType` and related data were removed from Descent 2.
Reported-by: InsanityBringer <https://github.com/dxx-rebirth/dxx-rebirth/issues/464> (issue 3)
Fixes: ea7ba7ae87 ("remove ObjType, ObjId, ObjStrength and OL_ constants; use "object" instead of "robot" in some places; draw and place reactors with correct modelnum")
Mission sorting is handled in a top-level function after the missions
have been found, so that the special case to promote built-in missions
is only applied at the top level. Unfortunately, this meant that
subdirectories were not sorted. Add an explicit sort in a path specific
to subdirectory handling.
Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/472>
If object creation fails, the counter is not decreased. This creates an
imbalance by over counting the number of robots in existence. Avoid
this imbalance by deferring the counter update until after the robot is
created.
When a robot drops a robot, the dropped robot is not added to the
level's running accumulated_robots counter, but when the player destroys
that robot, the destruction will be counted. This imbalance allows the
expression counting the number of not-yet-destroyed robots to underflow,
which then confuses the matcen logic into not creating new robots.
Fix this by incrementing the accumulated_robots count as each dropped
robot is created.
Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/466>
This change was proposed by an external user as a claimed fix for a
failure to build. This change has not been tested by the core team.
However, it is a simple change and at worst will break the build.
The change is based in part on advice from recurring contributor
@MaddTheSane. Neither @MaddTheSane nor @kreatordxx have commented on
the correctness of these changes, though the original author of the
commit, @Sottises, is listed as the origin of the most recent prebuilt
OS X package offered from
<https://www.dxx-rebirth.com/download-dxx-rebirth/>.
Reported-by: Sottises <https://github.com/dxx-rebirth/dxx-rebirth/issues/455>
If music is configured as built-in, and no secret songs are configured,
then BIMSecretSongs is set to a non-null pointer to a zero-element
array. This triggers a divide-by-zero when the array length is used in
a modulus operation.
Fix this by adding a special case that initializing from an empty vector
calls `reset()`, which causes the underlying unique_ptr to store
`nullptr` instead of `new bim_song_info[0]`.
Reported-by: Daniel-Leontiev <https://github.com/dxx-rebirth/dxx-rebirth/issues/465>
Fixes: c355e207fe ("Refactor song loading")
Descent 2 has a hack, present as far back as I can trace, that
suppresses starting sounds during level load. The original reason was
not recorded, but this hack has the useful side effect that it avoids
using uninitialized data when set_sound_sources tries to use a Viewer
that has not been reset for the objects of the new level.
Descent 1 lacks this hack, so an invalid Viewer is used, which may
trigger a valptridx trap if the undefined data has an invalid segment
number, and could cause memory corruption in builds which do not
validate the segment index. The valptridx trap:
```
terminate called after throwing an instance of 'valptridx<dcx::segment>::index_range_exception'
what(): similar/main/digiobj.cpp:389: invalid index used in array subscript: base=(nil) size=9000 index=65021
```
The backtrace leading to the trap:
```
d1x::digi_link_sound_common (viewer=..., so=..., pos=..., forever=<optimized out>, max_volume=<optimized out>, max_distance=..., soundnum=42, segnum=...) at similar/main/digiobj.cpp:389
0x00005555555a4e2d in d1x::digi_link_sound_to_pos2 (vcobjptr=..., max_distance=..., max_volume=32768, forever=1, pos=..., sidenum=4, segnum=..., org_soundnum=121) at similar/main/digiobj.cpp:483
d1x::digi_link_sound_to_pos (soundnum=soundnum@entry=121, segnum=..., sidenum=sidenum@entry=4, pos=..., forever=forever@entry=1, max_volume=32768) at similar/main/digiobj.cpp:490
0x00005555555c140d in d1x::set_sound_sources (vcsegptridx=..., vcvertptr=...) at similar/main/gameseq.cpp:817
d1x::LoadLevel (level_num=<optimized out>, page_in_textures=1) at similar/main/gameseq.cpp:1022
0x00005555555c2654 in d1x::StartNewLevelSub (level_num=-1, page_in_textures=<optimized out>) at similar/main/gameseq.cpp:1865
```
Backport this hack into Descent 1. Ultimately, the hack should go away
and data should be loaded in an order that does not access undefined
memory.
Reported-by: Spacecpp <https://github.com/dxx-rebirth/dxx-rebirth/issues/463>
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:10:9: fatal error:
'CoreGraphics/CGBase.h' file not found
#import <CoreGraphics/CGBase.h>
^~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:10:9: note: did not
find header 'CGBase.h' in framework 'CoreGraphics' (loaded from
'/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks')
similar/misc/physfsx.cpp:20:10: fatal error: 'HIServices/Processes.h' file not found
#include <HIServices/Processes.h>
Since this is an OS X problem, this has only been tested by the original
reporter.
Reported-by: Sottises <https://github.com/dxx-rebirth/dxx-rebirth/issues/455>
Suggested-by: MaddTheSane <https://github.com/dxx-rebirth/dxx-rebirth/issues/455#issuecomment-536164089> # SConstruct part
Commit 0df57f5b0f changed markers' movement type from MT_NONE to
MT_SPINNING, since retail code assigned a spin rate, suggesting markers
were meant to spin. However, in some anarchy games, markers are used as
player-positioned cameras. Spinning the cameras makes them hard to use.
Resolve this by preventing markers from spinning in such games.
Fixes: 0df57f5b0f ("Fix retail bug that prevented marker spinning")
Reported-by: flpduarte <https://github.com/dxx-rebirth/dxx-rebirth/issues/456>
Each axis can act as two buttons in both ways.
For example, a player might map slide left and slide right to J1 -A1 and J1 +A1 as button presses instead of the slide L/R axis.
This is mostly to fix XBox 360 Controller Left and Right triggers. But it can work on every axis if the player wishes to bind them.
Defer decreasing energy/vulcan until the object is confirmed to be
created. This avoids charging the player for a shot that cannot be
created due to object exhaustion.
Defer updating Next_laser_fire_time, so that a player can immediately
try firing again.
Defer decreasing energy (for flares) or secondary weapon count (for
secondaries) until the object is confirmed to be created. This avoids
charging the player for a shot that cannot be created due to object
exhaustion.
Otherwise, unless FrameTime exceeds Final_boss_countdown_time in a
single frame, the time never advances and the level never ends.
Fixes: 215252b8ca ("Fold Final_boss_is_dead into Final_boss_countdown_time")
The prior commit fixed the problem of a blank pilot name for new games,
but loading an existing save game uses a different path and still did
not set the player's callsign. Set it on load, too.
Fixes: 0c7de10512 ("Track chosen pilot name outside Players[]")
Single player games relied on the quirk that the pilot's name was always
kept in Players[], even outside a game. Commit 0c7de10512 removed
that quirk, which had the unintended consequence that single player
games are now played by the anonymous pilot. Set the player's callsign
during game setup so that the high score entry can be attributed
correctly.
Fixes: 0c7de10512 ("Track chosen pilot name outside Players[]")
Reported-by: Neurochild247 <https://github.com/dxx-rebirth/dxx-rebirth/issues/443>
Bisected-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/443#issuecomment-523827234>
Commit e6169f17f9 switched from searching `Data/` to searching
`data/`. For users on case-insensitive filesystems, this is a no-op and
the instructions that reference the `Data` directory continue to work.
For users on case-sensitive filesystems, the change broke accessing the
data directory, and caused the instructions to mislead. Given the age
of the commit, fixing the capitalization now will likely cause more
problems than it solves. Instead, fix the capitalization of the
instructions, so that users who follow the documentation get a working
setup.
Reported-by: krux02 <https://github.com/dxx-rebirth/dxx-rebirth/issues/447>
Fixes: e6169f17f9 ("Add 'Data' subdir as a searchpath, so D2X will find descent.pig and to simplify a lot of file opening/checking/closing code")
If the level was not the most recently played, a save is forced so that
it can be marked as most recently played. However, the logic to force
the save also forced an update of the highest-level field, even if that
reduced it.
- Rename the parameter to clarify its meaning.
- Add comments explaining the logic to force the save.
- Only update the highest-level field when the update would increase the saved value
If a guided missile is in flight, and its owning player dies, the
player's type is changed to OBJ_GHOST. The damage that killed the
player should have put the guided missile into autonomous mode, so for
this purpose, return that the missile is not actively guided.
Reported-by: Johnsondr80 <https://github.com/dxx-rebirth/dxx-rebirth/issues/437>
The subcanvas is positioned based on the dimensions of the containing
window, so it must be repositioned if the outer window is resized.
Reported-by: vLKp <https://github.com/dxx-rebirth/dxx-rebirth/issues/394>
Fixes: f491059ed7 ("Enable building with SDL2")
exit_segnum is set during load_endlevel_data, which currently runs too
early for this to depend on the exit used, and thus to be player-unique.
That data should be loaded at need, when the level ends, rather than
during level setup. This can be addressed later, when support for
multiple exits is improved.
transition_segnum is a function of how the player exited the mine, since
there could be multiple exit tunnels, although current code appears not
to handle that well in other places. Therefore, it needs to be
per-player data, not part of the level data, where it would not depend
on the player exiting.
This could be a shared variable instead, since it cannot be directly
influenced by gameplay. However, it is influenced by the game mode, and
keeping shared variables that are mode-specific would be more complexity
for very little savings.