Commit graph

6222 commits

Author SHA1 Message Date
Kp bfb7ed7efc Simplify pof_read_vecs
All callers pass a count of 1, so inline that and eliminate the loop.
2022-08-22 01:24:49 +00:00
Tylor 6fee36638d Feat: Pitch unlocker 2022-08-21 16:16:40 -05:00
Kp 0d045ae3da Fix Windows net_udp build
Convert the RAIIsocket to a simple SOCKET before passing it to FD_SET.
Otherwise, the build fails with:

```
similar/main/net_udp.cpp: In function 'int {anonymous}::udp_general_packet_ready(dcx::{anonymous}::RAIIsocket&)':
similar/main/net_udp.cpp:969:2: error: use of deleted function 'bool dcx::{anonymous}::RAIIsocket::operator==(T) const [with T = long long unsigned int]'
  969 |  FD_SET(sock, &set);
      |  ^~~~~~
similar/main/net_udp.cpp:493:29: note: declared here
  493 |  template <typename T> bool operator==(T) const = delete;
      |                             ^~~~~~~~
```
2022-08-16 03:15:04 +00:00
Kp fb75a7900c Pass std::span to multi_do_message 2022-07-30 17:42:59 +00:00
Kp 81ab68e0f6 Pass std::span to multi_do_player_inventory 2022-07-30 17:42:59 +00:00
Kp 31b8d98e22 Pass std::span to multi_do_kill_client 2022-07-30 17:42:59 +00:00
Kp e76cefd846 Pass std::span to multi_do_kill_host 2022-07-30 17:42:59 +00:00
Kp 43c86b94af Split multi_do_kill to multi_do_kill_host+multi_do_kill_client
The kill messages have different lengths and conditional processing
based on whether the message is MULTI_KILL_CLIENT or MULTI_KILL_HOST.
Split the two into separate functions to simplify the implementation of
each.
2022-07-30 17:42:59 +00:00
Kp 127a1f15e6 Pass std::span to multi_do_gmode_update 2022-07-30 17:42:59 +00:00
Kp b24d61cd0a Pass std::span to multi_do_msgsend_state 2022-07-30 17:42:59 +00:00
Kp c5eeaa48cd Pass std::span to multi_do_bounty 2022-07-30 17:42:59 +00:00
Kp da138757e6 Pass std::span to multi_do_kill_goal_counts 2022-07-30 17:42:59 +00:00
Kp 79683690bd Pass std::span to multi_do_heartbeat 2022-07-30 17:42:59 +00:00
Kp 4893196138 Pass std::span to multi_do_restore_game 2022-07-30 17:42:59 +00:00
Kp 4e42dacd23 Pass std::span to multi_do_save_game 2022-07-30 17:42:59 +00:00
Kp 96a260cea0 Pass std::span to multi_do_hostage_door_status 2022-07-30 17:42:59 +00:00
Kp 55bbc5f599 Pass std::span to multi_do_create_robot_powerups 2022-07-30 17:42:59 +00:00
Kp 4ce39a399e Pass std::span to multi_do_boss_create_robot 2022-07-30 17:42:59 +00:00
Kp c575283c5e Pass std::span to multi_do_boss_stop_gate 2022-07-30 17:42:59 +00:00
Kp b820098103 Pass std::span to multi_do_boss_start_gate 2022-07-30 17:42:59 +00:00
Kp 2b4dd444ca Pass std::span to multi_do_boss_cloak 2022-07-30 17:42:59 +00:00
Kp 6ab2068a82 Pass std::span to multi_do_boss_teleport 2022-07-30 17:42:59 +00:00
Kp 202e3309a7 Pass std::span to multi_recv_escort_goal 2022-07-30 17:42:59 +00:00
Kp cab6900f29 Pass std::span to multi_do_flags 2022-07-30 17:42:59 +00:00
Kp 53d5c296ff Pass std::span to multi_do_effect_blowup 2022-07-30 17:42:59 +00:00
Kp 2cb7de84b1 Pass std::span to multi_do_start_trigger 2022-07-30 17:42:59 +00:00
Kp 802b9bd37e Pass std::span to multi_do_trigger 2022-07-30 17:42:59 +00:00
Kp ff8e2090ab Pass std::span to multi_do_score 2022-07-30 17:42:59 +00:00
Kp 980b3080ce Pass std::span to multi_do_robot_fire 2022-07-30 17:42:59 +00:00
Kp fa0f7cef11 Pass std::span to multi_do_release_robot 2022-07-30 17:42:59 +00:00
Kp d4b047bb02 Pass std::span to multi_do_robot_position 2022-07-30 17:42:59 +00:00
Kp 0036b91084 Pass std::span to multi_do_claim_robot 2022-07-30 17:42:59 +00:00
Kp eb5880ac93 Pass std::span to multi_do_ranking 2022-07-30 17:42:59 +00:00
Kp 8cb20bb3ae Pass std::span to multi_do_finish_game 2022-07-30 17:42:59 +00:00
Kp 73361b9ae0 Pass std::span to multi_do_orb_bonus 2022-07-30 17:42:59 +00:00
Kp 575be1d1ee Pass std::span to multi_do_play_sound 2022-07-30 17:42:59 +00:00
Kp 47cb7d7801 Pass std::span to multi_do_create_powerup 2022-07-30 17:42:59 +00:00
Kp e5799fdabe Pass std::span to multi_do_controlcen_fire 2022-07-30 17:42:59 +00:00
Kp f0bae36bc7 Pass std::span to multi_do_door_open 2022-07-30 17:42:59 +00:00
Kp 7a8a2789e6 Pass std::span to multi_do_escape 2022-07-30 17:42:59 +00:00
Kp 81654ae8a9 Pass std::span to multi_do_light 2022-07-30 17:42:59 +00:00
Kp 784216d8ac Pass std::span to multi_do_seismic 2022-07-30 17:42:59 +00:00
Kp 1ea67e18e8 Pass std::span to multi_do_wall_status 2022-07-30 17:42:59 +00:00
Kp 3b43f040fd Pass std::span to multi_do_stolen_items 2022-07-30 17:42:59 +00:00
Kp dd374ef65e Pass std::span to multi_do_guided 2022-07-30 17:42:59 +00:00
Kp 74fd22a5a0 Pass std::span to multi_do_drop_flag 2022-07-30 17:42:59 +00:00
Kp a5c6a25cf2 Pass std::span to multi_do_drop_marker 2022-07-30 17:42:59 +00:00
Kp 652e3ceddd Pass std::span to multi_do_sound_function 2022-07-30 17:42:59 +00:00
Kp 84bb23e6d3 Pass std::span to multi_do_vulcan_weapon_ammo_adjust 2022-07-30 17:42:59 +00:00
Kp 4dd058d501 Pass std::span to multi_do_drop_weapon 2022-07-30 17:42:59 +00:00
Kp 5ac2a90121 Pass std::span to multi_do_controlcen_destroy 2022-07-30 17:42:59 +00:00
Kp 454bec9715 Pass std::span to multi_do_quit 2022-07-30 17:42:59 +00:00
Kp f923a5d710 Pass std::span to multi_do_player_deres 2022-07-30 17:42:59 +00:00
Kp aa95c6f804 Pass std::span to multi_do_remobj 2022-07-30 17:42:59 +00:00
Kp 7d464db18d Pass std::span to multi_do_reappear 2022-07-30 17:42:59 +00:00
Kp 74af38bba2 Pass std::span to multi_do_position 2022-07-30 17:42:59 +00:00
Kp 49f608010a Pass std::span to multi_do_robot_explode 2022-07-30 17:42:59 +00:00
Kp e1269dca35 Pass std::span to multi_do_create_robot 2022-07-30 17:42:59 +00:00
Kp 3bc110ec01 Fold robot kamikaze explode_object calls 2022-07-30 17:42:59 +00:00
Kp dc674eafe8 Replace various uses of std::enable_if with C++20 requires()
Compiler error messages are generally better when reporting a misuse
that fails a requires() versus reporting a misuse that fails a
std::enable_if.  In some cases, this also makes the code clearer, and
avoids the need for dummy template parameters as a place to invoke
std::enable_if.
2022-07-30 17:42:59 +00:00
Kp 58061b5f45 Use C++20 std::span for morph_data 2022-07-30 17:42:59 +00:00
Kp f92a978b4a Unify collide_player_and_materialization_center -> apply_damage_to_player
D2 changed the rule for the parameter `killer`.  Split that out to a
variable and combine the underlying call.  This does not change the game
semantics.
2022-07-23 20:58:10 +00:00
Kp d9d2bac092 Use enum class for apply_damage_to_player::possibly_friendly
Also, remove a redundant invulnerability check in one caller.
apply_damage_to_player already tests for invulnerability and returns if
appropriate.
2022-07-23 20:58:10 +00:00
Kp a44f80fd64 Flatten call chain to net_udp_send_data 2022-07-23 20:58:10 +00:00
Kp e6c510d467 Use vector read/write helpers in network messages 2022-07-23 20:58:10 +00:00
Kp 4141e04359 Pass thief stolen item storage to drop_stolen_items 2022-07-23 20:58:10 +00:00
Kp a3a2f7cc9a Pass context to drop_stolen_items
Pass the specific object fields needed, rather than the entire object.
2022-07-23 20:58:10 +00:00
Kp 801c76cbd2 Pass context to spit_powerup 2022-07-23 20:58:10 +00:00
Kp b61add4765 Pass context to drop_powerup 2022-07-23 20:58:10 +00:00
Kp 51219d3607 Use enum class for PlayMovie flag must_have 2022-07-23 20:58:10 +00:00
Kp 2536b6c1bc Pass player orientation matrix to multi_send_fire
The caller has the player object, and can provide the orientation matrix
from it.  Use that instead of letting multi_send_fire recompute the
object in order to get the matrix.
2022-07-23 20:58:10 +00:00
Kp c03b772ce7 Use caller supplied object for player_info in Flare_create
The caller supplies the local player, so use that instead of computing
it again.
2022-07-23 20:58:10 +00:00
Kp 68681d462c Fire flare from local player, not from ConsoleObject
The local player object was already computed above, and so is free to
reuse here.
2022-07-23 20:58:10 +00:00
Kp a0dc1b4283 Use union of multi_command<> for multi_send_fire message
Switch to a union of the possible multi_command<> types, and eliminate
the explicit length parameter passed to multi_send_data.
2022-07-23 20:58:10 +00:00
Kp 52aa9891b9 Simplify passing weapon to do_missile_firing
When the player fires a generic secondary, the choice of proximity bomb
versus super-mine is never read.  When the player specifically drops a
bomb, only that choice needs to be read.  Pass the chosen weapon as an
argument, and avoid computing the choice on the path where it is never
read.
2022-07-23 20:58:10 +00:00
Kp b4fcb9c305 Simplify do_missile_firing test for whether to autoselect
If `drop_bomb` is false, then `weapon == player_info.Secondary_weapon`.
If `drop_bomb` is true, then `weapon == bomb`.
2022-07-23 20:58:10 +00:00
Kp c0e12eee3f Push player object lookup from do_missile_firing to caller
The caller already needs the player object for other purposes, so let
the caller pass it down to do_missile_firing.
2022-07-23 20:58:10 +00:00
Kp 0dd5d6e0d5 Split guided missile release local/remote handling
Two paths are always local.  One path is always remote.  Split the
handler function to remove the locality test and rely on the caller's
knowledge of whether the affected player is local.
2022-07-23 20:58:10 +00:00
Kp 0cb0b5cdc0 Use playernum_t for guided missile player number 2022-07-23 20:58:10 +00:00
Kp 4886afdf93 Lift which_bomb from do_missile_firing to caller
Callers already have the player_info available, and will need the value
of bomb in a subsequent commit.  Lift it here.
2022-07-16 15:26:12 +00:00
Kp 3139445f02 Cache player object in do_missile_firing
Resolve the object to a vmobjptridx once, and use it as needed.  Replace
some uses of ConsoleObject with the local player, since those should be
the same, and local player is already computed.
2022-07-16 15:26:12 +00:00
Kp 1d65a83d73 Use primary_weapon_index_t for do_laser_firing weapon_id 2022-07-16 15:26:12 +00:00
Kp cbab79a56a Simplify multi_send_fire handling of is_bomb_objnum
Only one caller passes a value other than `object_none` for
`is_bomb_objnum`.  That one caller uses an equivalent predicate to the
one that `multi_send_fire` uses for deciding whether to use
`MULTI_FIRE_BOMB`.  Therefore, if `is_bomb_objnum != object_none` is
true, the weapon is guaranteed to be a proximity bomb or smart mine, and
`multi_send_fire` can use `MULTI_FIRE_BOMB` without retesting the object
id.
2022-07-16 15:26:12 +00:00
Kp f22b627949 Simplify do_missile_firing lookup of track_goal
Commit 81dd23b151 ("Only charge player for weapons that fire successfully")
added an early return when `objnum == object_none`, so if execution
reaches the call to `multi_send_fire`, then the object is guaranteed to
exist.  Access the track_goal without rechecking whether the object
exists.
2022-07-16 15:26:12 +00:00
Kp 9cf82a8eb5 Set multi_command code in constructor, not at send time
Rework multi_send_kill to handle the stricter construction requirements
this imposes.
2022-07-16 15:26:12 +00:00
Kp ea18bd074c Use multi_command for multi_send_message 2022-07-16 15:26:12 +00:00
Kp 2ea48475e3 Use multi_command for robot_fire_buf 2022-07-16 15:26:12 +00:00
Kp 2288f85d6a Use multi_command for multi_send_drop_marker 2022-07-16 15:26:12 +00:00
Kp efecd3507f Optimize removal of expired mdata records
Instead of sliding the entire queue down one element at a time, move the
non-expired elements in one step, and wipe all the trailing elements
in a single pass.
2022-07-16 15:26:12 +00:00
Kp 851edbbd3c Use enum class for player connected status 2022-07-16 15:26:12 +00:00
Kp 4cc1bc995b Pack player acknowledgement mask into a bitset
The only values for any given player are true/false, so use a bitset
instead of a byte per player.  Some implementations may use a uint64_t
internally, negating the space savings.  Even so, this version is
an improvement for requiring the use of playernum_t as an index.
2022-07-16 15:26:12 +00:00
Kp 1fa56d439c Skip dropping items when host quits
If the host quits, the game ends immediately afterward, so no dropped
items could be picked up.
2022-07-16 15:26:12 +00:00
Kp db4005fca6 Hold Network_laser_track const in multi_do_fire 2022-07-16 15:26:12 +00:00
Kp d3fdfd53b7 Update comment on do_laser_firing
Fixes: 5b29428643 ("Propagate nfires within do_laser_firing")
2022-07-16 15:26:12 +00:00
Kp 4cff6fd9d7 Simplify multi_send_robot_frame argument sent
The function had one caller, which always passed `0`.  Inline that.
Next, observe that `sent` is only ever modified `if (!(Game_mode &
GM_NETWORK))`.  As a multiplayer function, `multi_send_robot_frame`
should never be called in single-player, so this test should always be
false.  Delete it, and observe that `sent` is now `const`.

Remove unused return value of `multi_send_robot_frame`.
2022-07-16 15:26:12 +00:00
Kp 8af8124839 Lift multi_send_robot_position_sub priority parameter to callers
Instead of passing a truth value and letting
multi_send_robot_position_sub pick which of two priority values to use,
let the callers pass the priority directly.  There were two callers.
One used a fixed truth value, and the other can easily use a ternary.
2022-07-16 15:26:12 +00:00
Kp 450154452d Use enum class for multi_send_robot_position_priority
Increment all values by 1, to eliminate the increment inside
multi_send_robot_position.
2022-07-16 15:26:12 +00:00
Kp 47f622dbc4 Use std::bitset for robot_fired
This only ever tracks true/false, so use bitset to save space.
2022-07-16 15:26:12 +00:00
Kp dccebd9783 Flatten call chain to net_udp_send_mdata_direct 2022-07-16 15:26:12 +00:00
Kp 61d1ef9904 Remove obsolete and unused multi_send_data_direct
All callers now use the multi_command<C> form, so there is no need for
the form that allows a free pointer and length.
2022-07-16 15:26:12 +00:00
Kp b737524415 Use enum class for next_level_request_secret_flag
Instead of passing a bare `int` named `secret_flag`, define it as an
`enum class : uint8_t` to name the two special values.

Rework the passing of this value, to deal with some confusing
inconsistencies when reading the code.

Before this change:
In D1:
- Multiplayer will always go to the secret level, regardless of which
  exit door the player used.
In D2:
- Flying through a D1 secret exit in multiplayer shows the on-HUD error
  "Secret Level Teleporter disabled in multiplayer!", and does not exit
  the level.  This is at best confusing, and at worst dangerous, since
  D1 secret exits are only available during the countdown, so the player
  has little time to realize that the normal exit must be used instead.
- Like D1, multiplayer will request to go to the secret level regardless
  of the exit used.  Unlike D1, the caller ignores the flag and always
  advances to the next regular level.

After this change:
- No observable differences for the player in-game.  The questionable D2
  secret exit handling for D1 is retained.
- The code makes clearer that secret exits do not work in D2
  multiplayer, by way of `#if defined(DXX_BUILD_DESCENT_I)` guarding the
  existence of the parameter and all updates to it.
2022-07-16 15:26:12 +00:00
Kp f3d31a6d27 Use enum class for Difficulty_level_type 2022-07-16 15:26:12 +00:00
Kp 2eafb4a361 Simplify calling net_udp_request_game_info
All callers except one want the `lite` version of the request.  Switch
from a boolean that is selected inside the function to a reference that
is defaulted to `lite`.  Override that argument to the heavy version in
the one caller that needs it.
2022-07-09 13:39:29 +00:00
Kp 066b172963 Use enum class for Network_status 2022-07-09 13:39:29 +00:00
Kp 1cd9d18127 Compute game version rejection buffer at compile time
All the fields are constant.  Compute them at compile time.  Move the
sending function to dcx, since it is not game-specific.
2022-07-09 13:39:29 +00:00
Kp c354f9a606 Short-circuit network version mismatch tests
Once one component is known not to match, there is no reason to read the
other components from memory.
2022-07-09 13:39:29 +00:00
Kp 9af7159592 Compute game info request buffer at compile time
Its contents depend only on compile-time constants, so compute it once
and store it as a read-only variable to be sent as needed.
2022-07-09 13:39:29 +00:00
Kp a0c95c21a8 Flatten the indirection around udp socket functions
This reduces the noise from diagnostics when the function is misused,
and shrinks the code some.
2022-07-09 13:39:29 +00:00
Kp 5aaa095c14 Move Active_udp_games into netgame_list_game_menu 2022-07-09 13:39:29 +00:00
Kp c7bbc415f5 Remove obsolete MULTI_FIRE field nfires
As of 8f8989e049, this field is always
sent as `1`.  Remove it, and update position offsets.
2022-07-09 13:39:29 +00:00
Kp 6275353d97 Split UDP_sequence_packet into per-message types
Using `netplayer_info` in `UDP_sequence_packet` defined many unused
fields.  Replace this with per-message types that carry only the
required fields.  Make these fields `const` where possible.
2022-07-09 13:39:29 +00:00
Kp 2135328dab Use enum class for multiplayer_data_priority 2022-07-09 13:39:29 +00:00
Kp dd260f234b Use auto type for Viewer in more places 2022-07-09 13:39:29 +00:00
Kp a70188e7a5 Move various static functions into anonymous namespace 2022-07-09 13:39:29 +00:00
Kp 6215ef8e06 Pass LevelSharedRobotInfoState to various functions that need it 2022-07-09 13:39:29 +00:00
Kp 37132ab887 Pass LevelSharedRobotInfoState in fvi_query 2022-07-09 13:39:29 +00:00
Kp fac016c104 Split object_create_explosion_sub for with/without damage cases
Some callers create an explosion with damage forced to zero.  Others
create an explosion with damage non-zero.  Only the non-zero case needs
to examine nearby objects.  Split object_create_explosion_sub so that
the zero-damage case can skip that logic, and the arguments required to
implement it.
2022-07-09 13:39:29 +00:00
Kp d6c43f56af Use enum class for gun_num_t 2022-07-09 13:39:29 +00:00
Kp 0dfd462c64 Change fvi_query to pass LevelUniqueObjectState if checking objects
Remove the definition of FQ_CHECK_OBJS and all uses of it.  Add a new
fvi_query member d_level_unique_object_state *LevelUniqueObjectState.
If object checking is enabled, pass &LevelUniqueObjectState in that
member.  If object checking is disabled, pass nullptr in that member.

Change fvi_sub to use this member to decide whether to perform object
checking.
2022-07-09 13:39:29 +00:00
Kp 4bc901b0a9 fvi_sub: validate object once at start of FQ_CHECK_OBJS
If FQ_CHECK_OBJS is used, a valid object is required.  Copy the
icobjptridx_t from fvi_query into a local vcobjptridx_t to force a
validation, then use that validated copy for later work.
2022-07-09 13:39:29 +00:00
Kp 5d62df856d Pass fvi_query to fvi_sub
Many of the input parameters are available in fvi_query, so pass a
reference to that instead of copying the parameters to the stack
individually.
2022-07-09 13:39:29 +00:00
Kp 4ab619b7c2 Restructure use of fvi_query
- Make all members constant, and pass an anonymous temporary fvi_query
  to find_vector_intersection.
- Change `p0`/`p1` to `const vms_vector &`, since the positions are
  mandatory.  Callers can no longer pass `nullptr` or an uninitialized
  value here.
- Change `thisobjnum` to `icobjptridx_t`.  Calls to fvi_sub built an
  objptridx at need, so moving it to the caller allows it to be
  constructed once per find_vector_intersection call.
- Move `flags` and `rad` out of fvi_query, since calls to fvi_sub may
  use other values than the ones in fvi_query.  This prepares for
  passing fvi_query to fvi_sub.
2022-07-09 13:39:29 +00:00
Kp 4ef75b2aed Pass state to do_endlevel_flythrough 2022-07-09 13:39:29 +00:00
Kp a690374916 Pass state to place_object 2022-07-09 13:39:29 +00:00
Kp 8ba1390947 Pass state to explode_object 2022-07-09 13:39:29 +00:00
Kp 192c5de4f1 Add compile-time option to disable ship wiggling
Ship wiggle is normally enabled for compatibility with the original
game.  However, during development, it can become a nuisance, so add an
option to allow disabling it.
2022-07-02 18:10:45 +00:00
Kp e80c6fb05f Rename font underline to draw_full_width_as_fg_color
This started out as underline, but one of the special drawing modes uses
it to draw an underline-width block across the entire vertical height of
the character.
2022-07-02 18:10:45 +00:00
Kp 55af651200 Pass d_level_unique_object_state context to create_omega_blobs 2022-07-02 18:10:45 +00:00
Kp a40ab08bd0 Remove write-only field fcd_data::csd
This value was written when cache entries were created, but is never
read back.
2022-07-02 18:10:45 +00:00
Kp 3230b23bb9 Rework find_connected_distance cache
- Inline MAX_FCD_CACHE into the definition of Fcd_cache, then rely on
  Fcd_cache.size() later.
- Make Fcd_index unsigned.  As an index, a negative number is invalid.
- Change flush_fcd_cache to update Last_fcd_flush_time, rather than
  requiring callers to do it.  Most callers did not update this.
- Change add_to_fcd_cache to validate and reset Fcd_index before use,
  rather than resetting after increment.  This allows Fcd_index to
  become invalid after a write, but it will be reset to a valid value
  before it is used again.
- Fix original game bug in add_to_fcd_cache that caused the cache
  expiration path to clear the wrong cache entry.
2022-07-02 18:10:45 +00:00
Kp e25b476de7 Use enum for segnum_t
Add checked conversions for sites which load from external integers.
2022-07-02 18:10:45 +00:00
Kp fca59adb53 Split out creating OBJ_WEAPON objects 2022-07-02 18:10:45 +00:00
Kp e2509fc840 Move d_robot_info_array out of d_level_shared_robot_info_state
Embedding it in d_level_shared_robot_info_state is reasonable from a
relational perspective, but interferes with referencing
d_robot_info_array when only a forward declaration of
d_level_shared_robot_info_state is available.
2022-07-02 18:10:45 +00:00
Kp e51c11587b Change multi_do_kill to skip copying MULTI_KILL_CLIENT opcode
The opcode will be set to MULTI_KILL_HOST before sending, so do not set
it to MULTI_KILL_CLIENT initially.
2022-07-02 18:10:45 +00:00
Kp bdeca5687e Remove unused copy_diminish_palette
Fixes: f413017317 ("Delegate bald_guy_load PCX to SDL image")
2022-07-02 18:10:45 +00:00
Kp e45ff2da5e Use named enum types for netflag and netgrant 2022-07-02 18:10:45 +00:00
Kp d586fe91e4 Parenthesize gauge_key comma expression
C++20 deprecates `array_name[A,B]`.  For this use case, `A` is needed
for its side effects, but is not intended as an index operation.  Add
parentheses to satisfy the deprecation warning, without changing the
meaning of the code.
2022-07-02 18:10:45 +00:00
Kp 78fd6550ea Avoid unnecessary allocation in jukebox_play
If the song originates in an m3u playlist, no temporary buffer is
needed.  Avoid allocating and initializing one, and instead pass the
pointer directly from the CMLevelMusicPath field.
2022-07-02 18:10:45 +00:00
Kp 173d5559d7 Tighten TGA generation code
- Skip reading unused alpha channel in TGA screenshot path.  The alpha
  channel is discarded, so skip even retrieving it from OpenGL.
- Perform the red/blue swap in place, instead of copying into an
  additional buffer.
2022-07-02 18:10:45 +00:00
Kp d1ed53ebd9 Initialize IPv4/IPv6 broadcast addresses statically
These were computed by passing hardcoded inputs to a lookup function.
Initialize the structure at compile time instead.
2022-06-19 23:35:18 +00:00
Kp d1968fce82 Move num_active_udp_changed into netgame_list_game_menu 2022-06-19 23:35:18 +00:00
Kp 27f18be3ca Move num_active_udp_games into netgame_list_game_menu 2022-06-19 23:35:18 +00:00
Kp a1bdd81d41 Exclude unused code from D2 non-editor build
gamedata_read_tbl is only called if (D1 || (D2 && EDITOR)).  Exclude
defining it for (D2 && !EDITOR).  From there, also exclude defining or
reading the alias list, which is only written by a function
called by gamedata_read_tbl.

Reported-by: heftig <https://github.com/dxx-rebirth/dxx-rebirth/issues/642>
2022-06-11 15:00:02 +00:00
Kp 522c696af0 Remove unnecessary members in splitpath_t
splitpath_t is designed for MS-DOS paths, even though Rebirth now runs
on many platforms that never used DOS conventions.  Most of the members
of splitpath_t are unused on all platforms.  Remove them, and switch to
returning an initialized version of the structure.
2022-06-11 15:00:02 +00:00
Arne de Bruijn 0a5ecd77c6 Fix exit briefing animation speed
Undo change in e973dc0 which set the change animation direction delay
for every frame.
2022-06-06 10:15:27 +02:00
Kp 5545b32fee Do not reset_rear_view if dead when crossing exit trigger
Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/637>
Fixes: 8faed77f5f ("Properly record the event of reset_rear_view() while switching levels to make it work right when rewinding as well; Properly record Countdown seconds for each newdemo frame instead of second change to get display showing up right while playback and still preserving backwards compability; Suspend Game_wind when playing endlevel movie while demo playback")
2022-06-05 17:44:53 +00:00
Kp 346906ae9f Simplify UPID_QUIT_JOINING
The host only needs to check the source address.  Remove the check on
the callsign, and shrink the message accordingly.
2022-06-05 17:44:53 +00:00
Kp 68453cd86f Remove redundant net_udp_welcome_player checks
This loop is run once before the `if()` test, then again at the top of
both the true and false branches of the `if`.  Remove the runs inside
the conditional, since they should produce the same result as the run
that occurs before the conditional.
2022-06-05 17:44:53 +00:00
Kp 9816475706 Pass Object array to object_goto_next_viewer 2022-06-05 17:44:53 +00:00
Kp c5de47b51e Add const qualifiers to some net_udp functions 2022-06-05 17:44:53 +00:00