Commit graph

5045 commits

Author SHA1 Message Date
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