Commit graph

3680 commits

Author SHA1 Message Date
Kp e31d030caf Use zip for nm_messagebox_str 2020-09-11 03:08:02 +00:00
Kp 7de81a7293 Move Afterburner_charge to dsx 2020-09-11 03:08:02 +00:00
Kp 18282d5b66 Move some menu code into namespaces 2020-09-11 03:08:02 +00:00
Kp 0f2c1cdd45 Make game window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp b79eff0e5c Deduplicate fades[]
Two identical copies were defined in different places.  Use the global
one for both consumers.
2020-08-28 00:18:45 +00:00
Kp 955c7d9542 Make console window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp cdca112f0a Pass LevelUniqueAutomapState to automap_clear_visited 2020-08-28 00:18:45 +00:00
Kp ef8c0e7527 Make kmatrix window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Kp 1d3e546848 Inline window_get_canvas
The helper returns a reference to a mutable canvas, so there is no
isolation provided by using the helper.
2020-08-28 00:18:45 +00:00
Kp 0f89331924 Inline window_set_modal 2020-08-28 00:18:45 +00:00
Kp 97315725fa Move get_multi_endlevel_poll2 into dsx 2020-08-28 00:18:45 +00:00
Kp 53f75c3c72 Use enum class for kmatrix network flag 2020-08-28 00:18:45 +00:00
Kp 5b45fd3bae Add compile-time check that zip() will not exceed static sizes
This is necessarily incomplete since it can only check ranges that have
a compile-time static size.  However, it catches some simple mistakes,
and imposes no runtime cost, so it is still useful.
2020-08-28 00:18:45 +00:00
Kp 6d3dce4e16 Use enum class for tmap_num2
Define separate enum values for rotation data in both the high bits,
where it is usually kept, and the low bits, where it is sometimes used
for math or comparisons.

Define an enum value to represent the composite of the index and the
rotation, since the composite is not suitable for use as an array
subscript.  Add helper functions to extract the component pieces.
2020-08-24 01:31:28 +00:00
Kp da66b1d9b8 Move d1_tmap_num_unique to piggy.cpp
It is only used in one file.  Move it there and make it static.
2020-08-24 01:31:28 +00:00
Kp ab44115aa4 Move N_robot_joints to d_level_shared_robot_joint_state 2020-08-24 01:31:28 +00:00
Kp c96671f763 Move Pof_names to d_level_shared_polygon_model_state 2020-08-24 01:31:28 +00:00
Kp dca3c6cdca Move savegame POF names to stack
They are only used while loading a savegame file.  There is no need for
them to be global.
2020-08-24 01:31:28 +00:00
Kp 636978db4b Move Marker_model_num to d_level_shared_polygon_model_state 2020-08-24 01:31:28 +00:00
Kp 9c3fc7523c Make extra_bitmap_num static
Modify read_extra_bitmap_d1_pig to take the bitmap-to-write as a
parameter, instead of computing it from extra_bitmap_num.
2020-08-24 01:31:28 +00:00
Kp faf37e3c14 Always allocate D2-sized sound array
This makes other code simpler, and the extra elements will simply be
ignored in D1.
2020-08-24 01:31:28 +00:00
Kp 514c63efad Expose both MAX_SOUNDS in both games 2020-08-24 01:31:28 +00:00
Kp dd035a8f2f Move some piggy code into namespace dsx 2020-08-24 01:31:28 +00:00
Kp b29f19da51 Use enum class for GameBitmapOffset
Values in GameBitmapOffset are only intended for use indexing within the
game's PIG file.  Give them a specific type to reflect that.
2020-08-24 01:31:28 +00:00
Kp 8a1bc7f318 Move Exit_models_loaded into d_level_shared_polygon_model_state 2020-08-24 01:31:28 +00:00
Kp 0eaabdb2fb Move N_polygon_models into d_level_shared_polygon_model_state 2020-08-24 01:31:28 +00:00
Kp de4efc4f46 Qualify more uses of shared_segment members 2020-08-24 01:31:28 +00:00
Kp 2b8522f8ad Convert uses of vcsegptr_t to shared_segment& where possible 2020-08-24 01:31:28 +00:00
Kp 2e398c02c7 Convert uses of vmsegptr_t to shared_segment& where possible 2020-08-24 01:31:28 +00:00
Kp ce7c9946e8 Inherit base_bytebuffer_t constructor instead of delegating to it
This may encourage the compiler to generate better code, and should
never generate worse code.
2020-08-24 01:31:28 +00:00
Kp 8e81726ac5 Use enum class for laser_level
Remove stored_laser_level, which existed primarily to enforce type
separate.  `enum class` can do that without the need for a separate
class type.
2020-08-24 01:31:28 +00:00
Kp 038c6aef4d Move d_level_unique_object_state to a separate header
This is required to untangle the cross-inclusion of object.h and
morph.h.
2020-08-10 03:45:14 +00:00
Kp 8cf9ab8222 Access unique_segment::static_light directly
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment.  Eventually, segment will be
removed.  Adjust references to go through unique_segment to support this
change.
2020-08-10 03:45:13 +00:00
Kp 7ad8d8c28b Rename object::movement_type to movement_source
gcc and clang disagree about how to disambiguate when an identifier is
both a typename and a member.  Avoid the disagreement by renaming the
member.
2020-08-10 03:45:13 +00:00
Kp 5245b1c4a3 Rename object::control_type to control_source
gcc and clang disagree about how to disambiguate when an identifier is
both a typename and a member.  Avoid the disagreement by renaming the
member.

Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/532>
2020-08-10 03:45:13 +00:00
Kp 637efae03a Use enum class for gauges window indexing 2020-08-10 03:45:13 +00:00
Kp 1c42f69ff2 Use enum class for object_signature_t 2020-08-10 03:45:13 +00:00
Kp 38cddb0289 Use enum class for object movement_type 2020-08-10 03:45:13 +00:00
Kp 9e2543ecbf Use enum class for object control_type 2020-08-06 03:47:56 +00:00
Kp 4ef247e494 Use enum class for collision_result values 2020-08-06 03:47:56 +00:00
Kp 9b90a790f9 Add forward-declaration header for enumerated_array 2020-08-06 03:47:56 +00:00
Kp 111b655b09 Remove GM_GAME_OVER
Various sites assign GM_GAME_OVER to Game_mode, but no sites test for
it.  Its only value would be to clear out other flags, but that can be
done by clearing Game_mode.
2020-08-06 03:47:56 +00:00
Kreeblah 81a93441c0
Fixed macOS compilation 2020-08-02 16:03:19 -07:00
Kp 8d3f47d646 Fix hoard orb handling on player death
Descent tracked hoard orbs by borrowing the player's proximity bomb
slot.  Commit 829e95b6f8 moved proximity
bomb tracking to its own slot, but failed to update the player
death/deres logic accordingly.  This caused multiple inconsistencies
when a player was killed in hoard mode:

- The killed player saw the orb drop as expected.
- The killed player _also_ kept the orb in inventory after respawn,
  because the counter was not reset.
- Other players saw no orb drop.

Fix the inappropriate retention by resetting the orb count in
init_player_stats_new_ship.  Fix the inappropriate failure to drop by
adding a new unconditional field to the player death/deres message.  In
hoard games, use it to pass the orb count.  In other games, ignore it.

Fixes: 829e95b6f8 ("Separate hoard/proximity tracking")
Reported-by: snytek <https://github.com/dxx-rebirth/dxx-rebirth/issues/526>
2020-08-01 18:29:01 +00:00
Kp ec6a78c481 Use enum class for marker index types 2020-07-22 03:11:18 +00:00
Kp d738f6c21e Change enum side_type to enum class side_type 2020-07-16 02:31:04 +00:00
Kp 8d2ee6f14d Replace enumerate helper function with class template argument deduction 2020-07-16 02:31:04 +00:00
Kp daf06acfbe Replace zip helper function with class template argument deduction 2020-07-16 02:31:04 +00:00
Kp 48bfabee99 Use std::disjunction to simplify any_ephemeral_range 2020-07-16 02:31:04 +00:00
Kp 9081b2f071 Rename xrange_extent to xrange
This is handled separately to split out the churn of the renaming from
the logic changes that made this possible.
2020-07-16 02:31:04 +00:00
Kp 92ec624e47 Replace xrange helper function with class template argument deduction 2020-07-16 02:31:04 +00:00
Kp 250713d932 Use if constexpr to simplify xrange_extent::init_begin
Switch from tag-based overload dispatching to use `if constexpr`.
2020-07-16 02:31:04 +00:00
Kp 34a5d3797d Use enum class for gr_blend 2020-07-16 02:31:04 +00:00
Kp 6285878c4c Add color_palette_index type alias, to note palette-related uint8_t 2020-07-16 02:31:04 +00:00
Kp 8cc7be4986 Use std::bitset to track used colors
This reduces memory usage over using std::array<bool> for the same
number of bits.
2020-07-16 02:31:04 +00:00
Kp 6af56a27f2 Remove outdated joystick preprocessor guards
Testing for buttons||hats||axes is equivalent to testing for
joysticks!=0, since SConstruct forces joysticks=0 when
buttons == 0 && hats == 0 && axes == 0.  Remove tests of
buttons||hats||axes when those occur inside a test for joysticks!=0.
2020-07-16 02:31:04 +00:00
Kp 5735175999 Merge 'refs/pull/516/head' into master 2020-07-09 02:47:18 +00:00
Kp 738e4a740e Remove TRIGGER_FLAG::ON; it is write-only
The game clears it in various cases, but never tests for it.  Remove it.
2020-07-07 04:09:44 +00:00
Kp 569802e00f Convert kconfig array lookups to require correct enumerated type
This ensures that an array is indexed by the appropriate type.  Indexing
a mouse array with a joystick index is undefined behavior, and with this
change, such undefined behavior is now a compilation error.
2020-07-05 23:34:33 +00:00
Kp 9b9642dcac Only enable joystick axis->button bridge if both axes!=0 and buttons!=0
If axes!=0 and buttons==0 and hats==0, then the build fails because some
button-related functionality is missing.  Move the joystick axis->button
bridge into a conditional to exclude it in this case.

Fixes: 74ef8b02e6 ("Added axis buttons")
2020-07-05 23:34:33 +00:00
Kp 7e36beb30c Move polymodel alignment code to interp.cpp
This makes the alignment data structure `chunk` private to interp.cpp,
and allows most files to ignore whether DXX_WORDS_NEED_ALIGNMENT is
enabled, thus improving the ccache hit rate.
2020-07-05 23:34:33 +00:00
Kp 6e4b63e098 Use C++17 std::size instead of custom lengthof
lengthof was added to provide the size of C arrays.  C++17 std::size is
now available, and can serve the same purpose.  Remove the custom
lengthof.

The generated code is the same in both cases, other than the change in
line numbers caused by removal of the #include directives.
2020-07-05 23:34:32 +00:00
Kp bbcd5f5973 Use C++17 std::size instead of a custom equivalent
The custom version was used before C++17 was enabled.  Now that C++17
std::size is available, switch to it.
2020-07-05 23:34:32 +00:00
Kp 27724704d7 Use deduction guides to remove one layer of serial forwarding 2020-07-05 23:34:32 +00:00
Kp 0a1f2ad55e Tighten type for trigger action values 2020-07-05 23:34:32 +00:00
Kp 7a790f6068 Inline gr_set_fontcolor
It is a trivial function.
2020-07-05 23:34:32 +00:00
Kp b39c7c4ed2 Move ogl_swap_buffers_internal to dcx 2020-07-05 23:34:32 +00:00
Kp 90d7e39980 Move inclusion of platform-appropriate GL headers to a separate file
Some files may need to include platform GL headers, but not process all
the Rebirth-specific GL code.
2020-07-05 23:34:32 +00:00
Kp a98ddfbe9b Tighten type for trigger behavior flags
Use an enum class to prevent implicit conversion between trigger
behavior flags and other integers.  Fix up various resulting breaks,
which look like bugs:

- Descent 2 editor mode could modify trigger::flags, but used
  TRIGGER_FLAG_* values, which specify the actions for a Descent 1
  trigger when it executes, not the behavior properties for a trigger.
- Adding a trigger set its flags to 0, then cleared all flags except
  TRIGGER_ON.  Since the flags were just set to 0, the mask operation is
  useless.  Remove it.
- trigger_turn_all_ON cleared all flags except TRIGGER_ON.  This seems
  to be completely wrong.  Change it to remove
  trigger_behavior_flags::disabled.  Descent 1 has no (working) support
  for disabling triggers, so make trigger_turn_all_ON exclusive to
  Descent 2.
- wall_restore_all would enable TRIGGER_ON in both games.  Descent 1
  never reads TRIGGER_ON.  Descent 2 uses this field for trigger
  behavior flags, and TRIGGER_ON is not a behavior flag.
  - For Descent 1 builds, remove the modification of the field.
  - For Descent 2 builds, change it to clear
    trigger_behavior_flags::disabled.
2020-07-05 23:34:32 +00:00
Martin Fiedler aa972c2b93 improved joystick button to keyboard command mapping
Instead of parsing the button name string,
an explicit button-to-key mapping table
is now built and used.

Also fixes a few minor inconsistencies
that were introduced in c24864b1.
2020-06-30 21:18:49 +02:00
Martin Fiedler 853a0c41e1 added joystick binding for showing ingame menu
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.
2020-06-29 23:16:04 +02:00
Martin Fiedler c24864b180 make menus controllable with joystick
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.
2020-06-28 17:08:26 +02:00
Kp e5cae0f699 Remove unused g3_uninit_polygon_model 2020-06-22 00:36:45 +00:00
Kp e25ecbb10c Increase multiplayer protocol version number
Cross-play between development builds from different commits is never
guaranteed.  Increase the protocol version number to force everyone to
sync up.  Github user D2Lovin reported that mixing users from two
snapshot builds behaved poorly, but went silent when prompted for more
information.  This bump will force users to synchronize, which is a good
idea on principle.

Related: https://github.com/dxx-rebirth/dxx-rebirth/issues/509
2020-06-10 02:25:33 +00:00
Kp 46d72a29c0 Retire compiler-begin.h
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.
2020-06-10 02:25:32 +00:00
Kp 665713f315 Remove static inline declarations from fwd-partial_range.h
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.
2020-06-10 02:25:32 +00:00
Kp fa7d8e2dea Use enum sound_effect for hardcoded sound index numbers 2020-06-10 02:25:32 +00:00
Andreas Müller c8ad243ec3 clipper.cpp: Fix build with gcc10
| common/3d/clipper.cpp:29:14: error: 'out_of_range' is not a member of 'std'

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
2020-06-09 22:23:48 +02:00
Kp 68b47307b4 Remove useless SDL_RWops precision test in SDL2
SDL2 increased the range of the seek type, so truncation is no longer a
concern.
2020-05-31 23:04:25 +00:00
Kp 5c30b467bb Move jukebox_load, jukebox_hook_next to dcx 2020-05-31 23:04:25 +00:00
Kp 81119f0445 Use enum class for LevelMusicPlayOrder 2020-05-31 23:04:25 +00:00
Kp 2e1e142767 Factor out sound_function_table_t where possible
Move it to namespace dcx when this does not cause a dcx->dsx dependency.
2020-05-31 23:04:25 +00:00
Kp b08620292d Fix input handling in automap
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")
2020-05-28 03:21:22 +00:00
Kp 511a3d6b9c Pump SDL events in batches 2020-05-27 03:07:17 +00:00
Kp ff50824418 Pass SDL events as const T *, not T * 2020-05-27 03:07:17 +00:00
Kp c621a970c6 Reset kconfig counters once, before the event loop 2020-05-27 03:07:17 +00:00
Kp c4c09963ae Use constexpr uint8_t for TRANSPARENCY_COLOR
This encourages std::fill_n to become memset.  When TRANSPARENCY_COLOR
is `#define`'d to 255, it is an integer literal of type `int`.
2020-05-22 02:40:26 +00:00
Kp 7b52b1fe1d Move grs_bitmap::avg_color into #if !DXX_USE_OGL
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.
2020-05-22 02:40:26 +00:00
Kp c1181b7be5 Move texture_list out of global scope 2020-05-22 02:40:26 +00:00
Kp 3d3db16c6f Move Canvas_width,Canvas_height to local scope 2020-05-22 02:40:26 +00:00
Kp 0b35d8e2ce Factor out std::max in event dispatching 2020-05-22 02:40:26 +00:00
Kp 727bc4b663 Flush events in bulk 2020-05-22 02:40:26 +00:00
Kp fe792055d6 Simplify current_music_t
Inherit unique_ptr instead of embedding it, so that its members can be
exposed via a `using` directive.
2020-05-22 02:40:26 +00:00
Kp 5c88587c01 Encourage std::fill to become memset
gcc has a special case to devolve to memset if both the pointed-at data
and the value to fill are considered a byte.  All uses of
DXX_POISON_MEMORY pass a value that fits in a byte, so change the
signature to be a byte, to encourage gcc to activate the special case.
2020-05-17 23:35:26 +00:00
Kp f413017317 Delegate bald_guy_load PCX to SDL image 2020-05-17 23:35:26 +00:00
Kp 3114874713 Delegate PCX loading to SDL_image
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
2020-05-17 23:35:26 +00:00
Kp 699c9bc283 Fix check_header_includes=1 build 2020-05-17 23:35:25 +00:00
Kp df9a2bacf1 Handle gcc-10 truncation warnings in net_udp.cpp
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.
2020-05-17 23:35:25 +00:00
Kp a4f2edfaa9 Move LevelSharedVertexState into d_level_shared_segment_state 2020-05-17 23:35:25 +00:00
Kp f577788665 Use C++17 fold expressions to simplify serialization code 2020-05-17 23:35:25 +00:00
Kp 99a03b21ce Simplify serial:process_buffer self-selection filter
Use std::enable_if, so that the second argument becomes part of the
parameter pack instead of requiring explicit handling.
2020-05-17 23:35:25 +00:00
Kp 72c5221e0b Use if constexpr instead of std::enable_if
This reduces the size of the generated debug information, but produces
the same code.
2020-05-17 23:35:25 +00:00
Kp 6a4a8a62c9 Add unit tests for serialization code 2020-05-17 23:35:25 +00:00
Kp 399aee8d49 Use dedicated type for object render_type
Check conversions.  On invalid input, coerce to RT_NONE and print a
warning.
2020-05-02 21:18:43 +00:00
Kp fa0d57961d Use runtime check for instance_stack overrun
Replace assert with std::array<>::at(), so that an exception will be
thrown if the array bound is exceeded.
2020-05-02 21:18:43 +00:00
Kp 619ac0abff Use structured bindings for enumerate+zip 2020-05-02 21:18:43 +00:00
Kp 755186ada2 Remove use of deprecated std::iterator 2020-05-02 21:18:43 +00:00
Kp 3ce1f2b3ed Require support for C++11 addressof 2020-05-02 21:18:43 +00:00
Kp db7b4b3f88 Refer to <memory> directly, not through "compiler-make_unique.h" 2020-05-02 21:18:43 +00:00
Kp cc38cdf4b8 Qualify uses of std::make_unique 2020-05-02 21:18:42 +00:00
Kp 8839f538e0 Refer to <array> directly, not through "compiler-array.h" 2020-05-02 21:18:42 +00:00
Kp 3170b11997 Modernize typedefs for std::array types
Use `using x = y;` instead of `typedef y x;`.
2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 9cee93abb1 Require support for C++14 std::exchange 2020-05-02 21:18:42 +00:00
Kp ddc25b59b7 Explicitly zero-initialize object structure members
C++17 will require this in order for `object::object()` to be constexpr.
Add it here, before switching over.
2020-05-02 21:18:42 +00:00
Kp 333d619858 Update tool_bundle.py to parse correctly under Python3
mmontag reports that tool_bundle.py cannot be parsed under Python 3.
Fortunately, the errors are all straightforward, so non-OS X systems can
see the errors when the file is imported.  Normally, the file is only
imported when building for darwin, so non-OS X systems do not see the
problem.

- Add parentheses to print() calls.  This is not consistent with the
  rest of the Rebirth output scheme, but is simple to do.
- Adjust the syntax for raising exceptions.

Reported-by: mmontag <https://github.com/dxx-rebirth/dxx-rebirth/issues/503#issuecomment-619463994>
2020-04-26 17:26:23 +00:00
Kp df19889f61 Prefer NSDMI over simple default constructors
This protects against mistakes if more constructors are added, and makes
the code easier to read.
2020-04-26 17:26:23 +00:00
Kp a431f23817 Use enumerated constant for save slot indexes 2020-04-26 17:26:23 +00:00
Kp 0b070880a7 Use C++11 user-defined literals to dispatch valptridx error style
Switch valptridx error style dispatching from using macro pasting to
using C++11 user-defined literals.  This makes the code a bit easier to
read, and removes the need for a C99-conforming preprocessor here, which
should help anyone trying to port to Microsoft Visual Studio.

The new implementation also fixes a limitation of the previous
implementation.  Before, an override that referenced an invalid name
could be silently ignored.  Now, incorrect overrides cause an attempt to
use an undefined instantiation, which fails with a compilation error.
2020-04-26 17:26:23 +00:00
Kp b396445efa Require support for std::index_sequence, std::make_index_sequence
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.
2020-04-26 17:26:23 +00:00
Kp 5fa8c06914 Add experimental support for autosaves
Set autosave interval to 10 minutes, unless specified in the player's
configuration file.  Players can change the autosave to 0 minutes to
disable it.
2020-04-19 20:47:07 +00:00
Kp a1b3a86cba Use std::chrono::duration for ThisLevelTime, PlayTimeAllowed
Store PlayTimeAllowed in ticks since it is frequently accessed for logic
tests, but only rarely accessed for display.
2020-04-19 20:47:07 +00:00
Kp d197ba42c3 Fix mouse-selection in listboxes
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")
2020-04-04 19:30:23 +00:00
Kp 23ebf27554 Move digi functions to dcx; use bitset for channels 2020-04-04 19:30:22 +00:00
Kp 714c13b3c1 Move WallAnims into d_game_shared_state 2020-04-04 19:30:22 +00:00
Kp a645fd2eba Allocate morph_data vectors dynamically
This greatly reduces the size of morph_data for most uses.
2020-02-26 05:07:34 +00:00
Kp 85a9034137 Move morph_data::morph_deltas into a trailing allocation
Initially, this just makes the code more complicated.  In the end, it
will allow choosing the array size dynamically.
2020-02-26 05:07:34 +00:00
Kp 73612f6667 Move morph_data::morph_vecs into a trailing allocation
Initially, this just makes the code more complicated.  In the end, it
will allow choosing the array size dynamically.
2020-02-26 05:07:34 +00:00
Kp 74f8fd0d4d Move morph_data::morph_times into a trailing allocation
Initially, this just makes the code more complicated.  In the end, it
will allow choosing the array size dynamically.
2020-02-26 05:07:34 +00:00
Kp 00df407381 Use a custom allocation for morph_data
This will enable shrinking the morph arrays to allocate only what is
needed.
2020-02-26 05:07:34 +00:00
Kp 27a96d0337 Simplify partial_range check for unsigned offset/length 2020-02-26 05:07:34 +00:00
Kp d4c48d80b5 Fix some failures in check_header_includes=1 builds 2020-02-26 05:07:34 +00:00
Kp 707df7b9de Move some newdemo functions into namespace dsx 2020-02-26 05:07:34 +00:00
Kp fd134851d1 Pass context to morph_start 2020-02-26 05:07:34 +00:00
Kp aaaf212dca Add unit test for zip iterator 2020-02-26 05:07:34 +00:00
Kp 94401b4085 Pass LevelUniqueMorphObjectState to find_morph_data 2020-02-26 05:07:34 +00:00
Kp 40726aa580 Mark xrange as returning unowned storage
It returns integers by value, not by reference.
2020-02-26 05:07:34 +00:00
Kp c088f15384 Use std::fill to overwrite poisoned ranges
gcc can replace std::fill with memset when the code would be a loop
writing byte values.
2020-02-11 04:48:14 +00:00
Kp 3f7149a346 Simplify text decoding 2020-02-11 04:48:14 +00:00
Kp 88087fbbab Move Text_string to dsx 2020-02-11 04:48:14 +00:00
Kp 669c341147 Move d_level_unique_morph_object_state to d_level_unique_object_state 2020-02-01 22:33:31 +00:00
Kp cac5f1da56 Move morph_data into dynamic allocations
This improves poison detection, and eliminates some large static
allocations (MAX_VECS * ((2 * vms_vector) + fix)).
2020-02-01 22:33:31 +00:00
Kp c55c7d1bd6 Move morph_data to dcx
Only one member was part of dsx, and it could be dcx instead.
2020-02-01 22:33:31 +00:00
Kp b6e782d128 Add unit tests for xrange 2020-02-01 22:33:31 +00:00
Kp 0aaa263adf Use enum class for morph_data submodel_state
Name the state members, instead of using magic constants.  Also, switch
from `int` to `uint8_t`, since there are only 3 valid values.
2020-02-01 22:33:31 +00:00
Kp 003fb2697b Use uint8_t for morph_data::n_submodels_active
The array it controls is only 10 elements long.  uint8_t can easily
represent all valid indices.
2020-02-01 22:33:31 +00:00
Kp 5653124a43 Move MAX_VECS into morph_data 2020-02-01 22:33:31 +00:00
Kp 03b6e604eb Fix valptridx build break in <gcc-7
gcc before gcc-7 failed to build valptridx:

```
common/include/valptridx.h: In instantiation of 'valptridx<managed_type>::ptridx<policy>::ptridx(const valptridx<managed_type>::ptridx<rpolicy>&) [with rpolicy =
 valptridx<dcx::segment>::vm; typename std::enable_if<(policy:: allow_nullptr || (! rpolicy:: allow_nullptr)), int>::type <anonymous> = 0; policy = valptridx<dcx::segment>::vc; managed_type = dcx::segment]':
similar/main/endlevel.cpp:586:105:   required from here
common/include/valptridx.h:686:14: error: 'using vptr_type = class valptridx<dcx::segment>::ptr<valptridx<dcx::segment>::vm>' is protected within this context
    vptr_type(static_cast<const typename ptridx<rpolicy>::vptr_type &>(rhs)),
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/valptridx.h:666:31: note: declared protected here
  using vptr_type = ptr<policy>;
```

This cannot be fixed in the obvious way because the error message is
wrong:

```
   664		using containing_type = valptridx<managed_type>;
   665	public:
   666		using vptr_type = ptr<policy>;
   667		using vidx_type = idx<policy>;
   668		using typename vidx_type::array_managed_type;
```

The type declarations _already are_ *public*, not *protected* as the
message states.  Relaxing the protection on the containing class
resolves the error.  This looks bad from an encapsulation perspective,
but does not make the code incorrect.
2020-01-24 03:49:32 +00:00
Kp 1a2cfa35ba Fix saving/loading games for missions in subdirectories
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>
2020-01-18 21:57:39 +00:00
Kp 3e2d47f879 Track mission type correctly when loading mission list
- 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`.
2020-01-18 21:57:39 +00:00
Kp 3d09f4544b Remove macro Current_mission_filename 2020-01-18 21:57:39 +00:00
Kp 99356e0cdb Use enum for include/exclude anarchy mode 2020-01-18 21:57:39 +00:00
Kp 59b94a4dcb Call arch_close before atexit hooks begin
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.
2020-01-06 01:25:35 +00:00
Kp 05a54ef7c1 Merge pull #479 into master 2019-12-27 02:08:58 +00:00
Kp c9b1b5b1ec Use susegment for WALL_IS_DOORWAY 2019-12-27 02:02:23 +00:00
ziplantil 398d9013ef Merge remote-tracking branch 'upstream/master' into vertigo-exit-fix 2019-12-24 01:49:11 +02:00
Kp dfae1c7203 Split object_move_all for game/endlevel
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.
2019-12-22 05:34:08 +00:00
Kp 5dfd62c4f6 Use susegment for references introduced by valptridx conversion 2019-12-22 05:34:08 +00:00
Kp c93e7f44c3 Move object::last_pos to LevelUniqueObjectState
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.
2019-12-22 05:34:08 +00:00
Kp 30091902af Simplify valptridx types where possible
Switch valptridx::ptr to a reference type.
Switch valptridx::ptridx to a reference type or to ::ptr.

Fix up uses of operator-> accordingly.
2019-12-22 05:34:08 +00:00
Kp 3eedd9234e Add susegment to pair references to shared_segment/unique_segment
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`.
2019-12-22 05:34:08 +00:00
ziplantil 0a21784aa7 some changes as per comments in #479 2019-12-18 13:44:43 +02:00
Kp b037cd556f Explicitly default valptridx<T>::strong_typedef
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.
2019-12-17 05:01:38 +00:00
Kp 0d9b488be4 Support building valptridx without slice checking
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.
2019-12-16 01:57:00 +00:00
Kp 219a3fcd11 Move laser_info::get_last_hitobj out of line
It is only used in two places, neither of which are hot paths.  Move it
out of line so that other files do not need to parse it.
2019-12-16 01:56:59 +00:00
Kp 148fe47d82 Split checked/unchecked valptridx converting constructor logic
This allows the caller to omit filename/line information for calls that
will never need it.
2019-12-16 01:56:59 +00:00
Kp 5950485a6c Fix ptridx move constructor delegating to ptr copy constructor
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.
2019-12-16 01:56:59 +00:00
ziplantil cb2b844af3 do not free extra models when loading exit stuff on D2 2019-12-12 17:25:11 +02:00
Kp 075b14373a Change Difficulty_level_type from unsigned to signed
Difficulty_level_type is used in arithmetic expressions.  If
Difficulty_level_type is unsigned, then those expressions use unsigned
terms, but some of the expressions were designed to use signed terms and
produce incorrect results when used with unsigned terms.  There is no
strong reason to make Difficulty_level_type unsigned, so switch it to
signed instead of trying to fix every site that uses it.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/471>
Fixes: 1eaaff3016 ("Move Difficulty_level to GameUniqueState")
2019-11-17 23:27:13 +00:00
Kp f43665917e Merge branch ziplantil/win32-sdl2-cdaudio-sync into master 2019-10-28 00:45:34 +00:00
ziplantil b38f99d7ce modify SConstruct to handle target platform; fix track finish detect code 2019-10-27 14:53:48 +02:00
ziplantil 24fc28c8bd indent fixes, improve comments, other code fixes 2019-10-27 03:11:15 +03:00
ziplantil e664d93ea4 add hack for MCI or CD driver bug (?) 2019-10-27 02:48:20 +03:00
ziplantil 2c5ab8e739 initial version of this, trying to catch MCI events 2019-10-27 02:47:45 +03:00
Kp d2640462cb Backport D2's Dont_start_sound_objects to D1
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>
2019-10-26 23:13:14 +00:00
Kp d056611989 Fix mglobal.cpp build in clang-9
clang-9 reports:

```
similar/main/mglobal.cpp:210:44: error: 'report_error_uses_exception' is a protected member of 'valptridx_specialized_type_parameters<unsigned char, 90, valptridx_untyped_utilities::report_error_style::exception, valptridx_untyped_utilities::report_error_style::exception>'
template <typename T, bool = valptridx<T>::report_error_uses_exception::value>
                                           ^
similar/main/mglobal.cpp:229:16: note: in instantiation of default argument for 'instantiation_guard<dcx::active_door>' required here
template class instantiation_guard<dcx::active_door>::type::index_range_exception;
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/fwd-valptridx.h:42:2: note: constrained by protected inheritance here
    protected valptridx_specialized_types<managed_type>::type
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/cpp-valptridx.h:175:8: note: member is declared here
    using report_error_uses_exception = std::integral_constant<bool,
```

Add a `using` statement to switch `report_error_uses_exception` to
`public` access.  Nothing else uses it, and there is no design purpose
served by keeping it `protected`.
2019-10-23 02:58:41 +00:00
Kp 781a7366a9 Whitelist Vertigo smelter's phoenix cannon
Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/458>
Fixes: 2bcc7bb371 ("Only create lasers for known weapon types")
2019-10-21 03:45:29 +00:00
daivuk 74ef8b02e6 Added axis buttons
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.
2019-09-01 13:11:14 -04:00
Kp c355e207fe Refactor song loading
Use an RAII object to manage allocations and keep the length and pointer
together.
2019-08-25 16:43:17 +00:00
Kp 2b2ca67de5 Add enumerated_iterator::operator==
Defining _GLIBCXX_DEBUG introduces a dependency on this method.
Implement it so that _GLIBCXX_DEBUG can be used.
2019-08-24 18:14:16 +00:00
Kp dd0f639176 Avoid reducing player's highest-level when replaying a non-MRU level
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
2019-08-24 04:32:24 +00:00
Kp 6d0cd8513e Recompute automap subcanvas on window size change
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")
2019-08-18 20:37:29 +00:00
Kp ade6ee4195 Move exit_segnum to d_player_unique_endlevel_state
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.
2019-08-15 01:34:22 +00:00
Kp 2daf788b34 Move transition_segnum to d_player_unique_endlevel_state
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.
2019-08-15 01:34:22 +00:00
Kp 9bafdc9078 Move Death_sequence_aborted to d_game_view_unique_state 2019-08-15 01:34:22 +00:00
Kp 6f9657cf9b Move controlcen_death_silence to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp 9f0b455f6d Move Reactor_strength to d_level_shared_control_center_state 2019-08-15 01:34:22 +00:00
Kp 9689a7f7d2 Move Base_control_center_explosion_time to d_level_shared_control_center_state 2019-08-15 01:34:22 +00:00
Kp f2eebca6c3 Move Last_time_cc_vis_check to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp d9d536afda Move Control_center_player_been_seen to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp 0826881fa0 Move Dead_controlcen_object_num to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp d0a9d8db98 Move Control_center_present to d_level_unique_control_center_state
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.
2019-08-15 01:34:22 +00:00
Kp 11278eb153 Rename Control_center_next_fire_time to Frametime_until_next_fire
Clarify the type of the value.
2019-08-15 01:34:22 +00:00
Kp 195f5e7d9f Move Control_center_next_fire_time to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp 885296b136 Move Control_center_been_hit to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp f988948eef Move Countdown_timer to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp 21c927584b Move Total_countdown_time to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp 707b3c5b0d Move Countdown_seconds_left to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp 519edb9e16 Move Control_center_destroyed to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
Kp 0d9e032c60 Factor out some multi net_destroy_controlcen usage 2019-08-15 01:34:22 +00:00
Kp 8997f622bd is_proximity_bomb_or_smart_mine*: s/smart/player_smart/g
As documented in zico's commit 38fabd7c49, robot smart mines have a
different ID number than player smart mines.  Rename the test functions
to clarify that they only recognize player smart mines, but not robot
smart mines.

git grep -l is_proximity_bomb_or_smart_mine | xargs sed -i -e 's/is_proximity_bomb_or_smart_mine/is_proximity_bomb_or_player_smart_mine/g'
2019-08-15 01:34:22 +00:00
Kp 2ceb0168f2 Split is_proximity_bomb_or_smart_mine* to d1x/d2x 2019-08-15 01:34:22 +00:00
Kp b8cb819bb4 Make read_sndfile static for D1
Currently, only D2 can reread sounds.  Restore static for D1
read_sndfile.
2019-08-15 01:34:22 +00:00
Kp aa9bea4b92 Remove redundant declaration of Piggy_hamfile_version 2019-08-15 01:34:22 +00:00
ziplantil d9c113c315 load .s11,.s22 when loading D2 mission to allow custom sounds 2019-08-13 22:47:22 +03:00
Christian Beckhäuser 38fabd7c49 Fixed two issues with game's transparency effects feature (which I introduced when implementing it): First, Superprox mines dropped by enemies were made undesirably transparent since they have their own ID not considered by is_proximity_bomb_or_smart_mine(). Second, only some force field textures in D2X had transparency effects since the game has two different textures for force fields - eclip num 78 and 93 - but only the former was defined and used in is_alphablend_eclip() 2019-08-08 11:57:52 +02:00
Kp 334da8e8e6 Move some SDL-only symbols into !DXX_USE_OGL 2019-08-06 02:59:41 +00:00
Kp f0faac66d4 Move Seismic_tremor_magnitude to d_level_unique_seismic_state 2019-08-06 02:59:41 +00:00
Kp 4b0f797d7e Move Secret_return_orient to d_level_shared_segment_state 2019-08-06 02:59:41 +00:00
Kp ad16d90dd5 Move Secret_return_segment to d_level_shared_segment_state 2019-08-06 02:59:41 +00:00
Kp 625d863c55 Move Smega_detonate_times to d_level_unique_seismic_state::Earthshaker_detonate_times 2019-08-06 02:59:41 +00:00
Kp 140711cb35 Move Next_seismic_sound_time to d_level_unique_seismic_state 2019-08-06 02:59:41 +00:00
Kp 8fd231e501 Move Seismic_tremor_volume to d_level_unique_seismic_state 2019-08-06 02:59:41 +00:00
Kp 42778ff7fa Move Level_shake_duration to d_level_shared_seismic_state 2019-08-06 02:59:41 +00:00
Kp b8fa75c8cb Move Level_shake_frequency to d_level_shared_seismic_state 2019-08-06 02:59:41 +00:00
Kp 184337e6e1 Move Seismic_disturbance_end_time to d_level_unique_seismic_state 2019-08-06 02:59:40 +00:00
Kp ef0e64d421 Move awareness events to d_level_unique_robot_awareness_state 2019-08-06 02:59:40 +00:00
Kp 03214c0e6f Fix original game bug that meant to reset camera flag, but did not 2019-08-06 02:59:40 +00:00
Kp 215252b8ca Fold Final_boss_is_dead into Final_boss_countdown_time 2019-08-06 02:59:40 +00:00
Kp 5455a65d33 Move Final_boss_countdown_time to d_game_unique_state 2019-08-06 02:59:40 +00:00
Kp 3d8c02fefa Move Final_boss_is_dead to d_game_unique_state 2019-08-06 02:59:40 +00:00
Kp 7d803cf63e Move some save/restore functions to dcx/dsx as appropriate 2019-08-06 02:59:40 +00:00
Kp be84013494 Move Boss_hit_time to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
Kp 0a74eb6989 Move Boss_hit_this_frame to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
Kp 75440153a0 Move Boss_dying_sound_playing to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
Kp a0c242c46f Move Boss_dying_start_time to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
Kp 63d869fa0c Move Boss_dying to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
Kp 4ec96337b6 Move Last_teleport_time to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
Kp 69404ebc6e Move Boss_cloak_start_time to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
Kp 184be218b7 Emulate D1 bosses more accurately
Use D1 timing for gating, cloaking, and teleporting
2019-08-06 02:59:40 +00:00
Kp 49fd1f358e Eliminate unnecessary Gamesave_current_filename
It is only read in contexts where the initializing filename is still
available, so pass the filename down instead of copying it to a global.
2019-08-06 02:59:40 +00:00
Kp de77d2412b Move Automap_visited to d_level_unique_automap_state 2019-08-06 02:59:40 +00:00
Kp 635ae0b595 Use typedef for savegame description 2019-07-28 21:09:07 +00:00
Kp f43141f738 Use typedef for savegame file path 2019-07-28 21:09:07 +00:00
Kp 65555b6eba Require only object_base for object_to_object_visibility 2019-07-27 17:48:03 +00:00
Kp dd8cfa763f Expand gcc memcpy workaround
Add link to upstream bug report.
2019-07-22 00:51:01 +00:00
Kp 347d1ba05f Shrink struct vclip
`flags` only needs to be 1 bit wide, so switch from `int` to `uint8_t`.
Shrinking to a single bit would not save more space, but would
complicate the code.
2019-07-20 18:24:24 +00:00
Kp 41f4e84261 Move Stolen_item_index into d_thief_unique_state 2019-07-16 04:00:50 +00:00
Kp a2560cdfb5 Move Stolen_items into d_thief_unique_state 2019-07-16 04:00:50 +00:00
Kp 91bb7e533c Move player::hostages_total to d_game_unique_state
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.
2019-07-16 04:00:50 +00:00
Kp 8f475021ca Move player::hostages_level to d_level_unique_object_state
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.
2019-07-16 04:00:50 +00:00
Kp 2ca2de6ee7 Move player::num_robots_total to d_game_unique_state
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.
2019-07-16 04:00:50 +00:00
Kp a24de0c003 Move player::num_robots_level to d_level_unique_object_state
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.
2019-07-16 04:00:50 +00:00
Kp e33aaa7537 Make init_player_stats_level static 2019-07-16 04:00:50 +00:00
Kp c61dee7e6a Move Boss_teleport_interval to d_level_shared_boss_state 2019-07-13 22:28:57 +00:00
Kp 595c3ca086 Move Boss_cloak_interval to d_level_shared_boss_state 2019-07-13 22:28:57 +00:00
Kp b47f84ffd4 Move Gate_interval to d_game_unique_state 2019-07-13 22:28:57 +00:00
Kp 9df482a423 Move Last_gate_time to d_level_unique_boss_state 2019-07-13 22:28:57 +00:00
Kp 867223556c Fix fallthrough warning in ntmap.cpp [SDL only] 2019-07-07 22:00:02 +00:00
Kp 8d349dd0c1 Include pilot name in window caption 2019-07-07 22:00:02 +00:00