Commit graph

297 commits

Author SHA1 Message Date
Kp 9c08b233a5 Move collision functions into namespaces 2021-06-28 03:37:51 +00:00
Kp 40b0b6c8fb Adjust indent to silence clang -Wmisleading-indentation
gcc treats the intervening lines since the last `if` as sufficient to
recognize this as not misleading.  clang does not.  Change the indent to
calm clang.
2021-06-28 03:37:51 +00:00
Kp 414c59c6ba Enable backtick-based segment reporting in D1
This is a developer feature that is useful in D2.  Backport it to D1.
2021-04-04 22:01:25 +00:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp 1843d375f2 Use enumerated_array for Secondary_weapon_to_powerup 2021-01-17 22:23:22 +00:00
Kp e9f590eeb1 Use enumerated_array for Primary_weapon_to_powerup 2021-01-17 22:23:22 +00:00
Kp fc63029833 Move more symbols into namespaces 2020-12-26 21:17:29 +00:00
Kp e261ca2884 Use enum class for weapon_info::matter 2020-12-20 20:39:07 +00:00
Kp b1b2300c7d Use enum class for wall_key 2020-12-19 16:13:26 +00:00
Kp 47c33cbd55 Use enum class for WALL_IS_DOORWAY_FLAG
This reduces the size of the debug information substantially.
2020-12-19 16:13:26 +00:00
Kp 61f186bc18 Use enum class for texture1_value 2020-09-11 03:08:02 +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 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 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 38cddb0289 Use enum class for object movement_type 2020-08-10 03:45:13 +00:00
Kp 4ef247e494 Use enum class for collision_result values 2020-08-06 03:47:56 +00:00
Kp ec6a78c481 Use enum class for marker index types 2020-07-22 03:11:18 +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 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 a4f2edfaa9 Move LevelSharedVertexState into d_level_shared_segment_state 2020-05-17 23:35:25 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +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 c9b1b5b1ec Use susegment for WALL_IS_DOORWAY 2019-12-27 02:02:23 +00:00
Kp 5dfd62c4f6 Use susegment for references introduced by valptridx conversion 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
Christian Beckhäuser dafdcb8596 Rework of the Descent 2 final boss fade-to-black effect introduced in 5b18219aac4dd535e2803de9310ba26dfa7acc28: In the original game the silent 2 second countdown would lapse before the screen faded to black. In restoration, it would fade to black as the countdown started. This rework fixes this discrepancy. 2019-09-17 21:49:18 +02:00
Christian Beckhäuser 5b18219aac Restored fade to black after defeating the final Descent 2 boss which was lost along with software rendering screen fade effects. New implementation is done in similar way as the fade to white after regular countown reaches 0 while trying to restore the original effect as faithfully as possible (except that it doesn't pause the game during the effect). 2019-09-12 14:54:55 +02:00
Kp 275c4297fe Write back Final_boss_countdown_time on every update
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")
2019-09-01 00:20:28 +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 519edb9e16 Move Control_center_destroyed to d_level_unique_control_center_state 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 ef0e64d421 Move awareness events to d_level_unique_robot_awareness_state 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 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 d2da218f94 Remove apply_damage_to_robot swapping of Stolen_items
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.
2019-07-16 04:00:50 +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 7bd861e374 Only death-spew armed proximity bombs in multiplayer
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")
2019-07-12 02:01:53 +00:00
Kp bfeca84bb8 Change object::signature to be a generation counter
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.
2019-07-07 22:00:02 +00:00
Kp 1eaaff3016 Move Difficulty_level to GameUniqueState 2019-06-27 03:26:20 +00:00
Kp a4f06f1f51 Backport MK's mega/lava fix to D1 2019-06-27 03:26:20 +00:00
Kp cfb481c74a Add experimental support for guidebot in multiplayer
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>
2019-06-27 03:26:20 +00:00
Kp f79f6ab1cc Make switches invulnerable to blast_nearby_glass
`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>
2019-05-11 20:18:29 +00:00
Kp 8764cad457 Use unsigned in more prototypes 2019-03-03 00:31:09 +00:00
Kp 699030606e Move Effects to d_level_unique_effects_clip_state 2019-03-03 00:31:09 +00:00