Commit graph

239 commits

Author SHA1 Message Date
Kp 7015e3e93c Move REMOTE_SLOT_NUM out of ai_static::flags
Some flags merit a type other than int8_t.  Begin moving flags out to
distinct variables with their own type.

Add static_assert checks that the ABI relevant structures do not change.
2022-01-08 17:48:09 +00:00
Kp 12a0f8e8e0 Use enum class for wall_state 2021-11-01 03:37:19 +00:00
Kp 76e2f2c6d9 Use enum class for wall_flags 2021-11-01 03:37:19 +00:00
Kp a6f2db2502 Use enum class for player ranking 2021-11-01 03:37:19 +00:00
Kp 8ddfbd17e0 Use enum class for show_kill_list_mode 2021-11-01 03:37:19 +00:00
Kp d22632ac48 Use enum class for msgsend_state 2021-11-01 03:37:19 +00:00
Kp 7cb34fda0c Use enum class for network_game_type 2021-11-01 03:37:19 +00:00
Kp 1a44112907 Remove objnum_local_to_remote wrapper
Always use the form that returns both fields.
2021-11-01 03:37:19 +00:00
Kp 7fc8c736b3 Pass Powerup_info to multi_prep_level_objects, filter_objects_from_level 2021-09-19 10:53:48 +00:00
Kp 983ad86e4b Use enum class for trigger number 2021-09-04 12:17:14 +00:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp 1afd0eeae2 Move NETFLAG_DOPOWERUP to netgame_info and clarify name 2021-01-25 00:45:07 +00:00
Kp 49944a3fbf Use enum, not integral_constant, for netflag/netgrant constants 2021-01-25 00:45:07 +00:00
Kp 115c38cd77 Remove kmatrix_poll2
After the previous commit, its only purpose is to automatically dismiss
the window after 3 seconds.  Users may be surprised by this, and the
automatic dismissal has limited value.  Remove it and let the user
remain at the cancel dialog until a decision is made.
2020-12-27 22:03:09 +00:00
Kp 834f009dd7 Use enum class for wallnum_t 2020-12-26 21:17:29 +00:00
Kp fc63029833 Move more symbols into namespaces 2020-12-26 21:17:29 +00:00
Kp 1c2fcf86e0 Convert multi_leave_game to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp e2c95058db Convert multi_endlevel to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp a3eb82cefd Move multi code into namespaces 2020-12-20 20:39:07 +00:00
Kp 5e4047ce2a Convert disconnect_player to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp 955ce55661 Convert kick_player to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp 2007257064 Convert get_multi_endlevel_poll2 to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp 407678dfdf Convert multi_send_endlevel_packet to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp ea6504e60b Convert multi_level_sync to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp 2f90d7a208 Convert multi_do_protocol_frame to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp d070377e6b Convert multi_objnum_is_past to dispatch through a vtable
This reduces the call depth by one, and eliminates a load of a global
variable that always has the value MULTI_PROTO_UDP.  It adds a load of
the address of the empty dispatch object.  Overall, this should be an
improvement.
2020-12-20 20:39:07 +00:00
Kp c68dddd372 Move various definitions into namespaces 2020-12-19 16:13:26 +00:00
Kp 53566b7673 Move struct newmenu to newmenu.h 2020-12-19 16:13:26 +00:00
Kp e7cd8bedec Remove obsolete embed_window_pointer_t 2020-10-22 02:26:16 +00:00
Kp ffb653c0b8 Pass control_info & to various functions
Switch from a direct global reference to passing control_info& as a
parameter.
2020-10-12 03:28:26 +00:00
Kp 3ee3ac7b7a Delete multi_do_death
It is not needed.  Deathmatch players never lose their keys, so there is
no need to reapply them.
2020-09-11 03:08:02 +00:00
Kp 6a9444e5d6 Move some multiplayer functions into namespaces 2020-09-11 03:08:02 +00:00
Kp 97315725fa Move get_multi_endlevel_poll2 into dsx 2020-08-28 00:18:45 +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 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 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 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 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 8839f538e0 Refer to <array> directly, not through "compiler-array.h" 2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp a431f23817 Use enumerated constant for save slot indexes 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 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 7d803cf63e Move some save/restore functions to dcx/dsx as appropriate 2019-08-06 02:59:40 +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 8764cad457 Use unsigned in more prototypes 2019-03-03 00:31:09 +00:00
Kp 5a64ee5132 Add experimental support for larger cooperative games
- Raise the player limit to 8.
- Remove the logic that forces player counts up/down when switching
  between cooperative and deathmatch game modes.
- Add heuristics to add start positions for the extra players, since
  standard maps will not have the required number of starts.
2018-12-03 04:25:11 +00:00
Kp a0ed5cb283 Pass Vclip as context 2018-10-21 00:24:07 +00:00