Commit graph

64 commits

Author SHA1 Message Date
Kp 5d0d9dcc1a Use primary_weapon_index_t for pick_up_primary 2021-01-25 00:45:07 +00:00
Kp 2196f6add5 Use enumerated_array for Secondary_ammo_max 2021-01-25 00:45:07 +00:00
Kp 6c63e11caa Use enumerated_array for Secondary_weapon_to_weapon_info 2021-01-25 00:45:07 +00:00
Kp b20fa0d77d Use enumerated_array for Primary_weapon_to_weapon_info 2021-01-25 00:45:07 +00:00
Kp 9abf81c77a Factor out logic for toggling between base/super weapons 2021-01-25 00:45:07 +00: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 c68dddd372 Move various definitions into namespaces 2020-12-19 16:13:26 +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 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 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 184337e6e1 Move Seismic_disturbance_end_time to d_level_unique_seismic_state 2019-08-06 02:59:40 +00:00
Kp a0ed5cb283 Pass Vclip as context 2018-10-21 00:24:07 +00:00
Kp 30a83eec41 Eliminate some uses of valptridx::operator-> 2018-06-24 05:06:15 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp 599ac9dee0 Always qualify valptridx type/factory
Previously, valptridx used PREFIX for allow-invalid+mutable, c#PREFIX
for allow-invalid+const, v#PREFIX for require-valid+mutable, vc#PREFIX
for require-valid+const.  Convert the types, factories, and all usage
sites to specify a qualifier for all four combinations:

	im#PREFIX -> allow-invalid+mutable
	ic#PREFIX -> allow-invalid+const
	vm#PREFIX -> require-valid+mutable
	vc#PREFIX -> require-valid+const

Changes to common/include/valptridx.h and common/include/fwd-valptridx.h
are manual.  All other changes are generated by:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\(v\?\)\(\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/\1m\2/g'

for the 'm' prefix and:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\([cm]\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/i&/g'

for the 'i' prefix.
2017-06-10 03:31:02 +00:00
Kp 59bad96d5f Add back homing weapons cheat for D2
Kreator proposed restoring the Descent 2 cheat that grants homing
capability to all weapons.  This commit implements that proposition,
with some changes to the implementation details.

Based-on-patch-by: Chris Taylor <chris@icculus.org>
Requested-by: Chris Taylor <https://github.com/dxx-rebirth/dxx-rebirth/pull/318>
2017-01-29 21:02:48 +00:00
Kp 879070f814 Fix uninitialized value usage during init_player_stats_new_ship
init_player_stats_new_ship used select_primary_weapon and
select_secondary_weapon to assign the player's weapons.  However, those
functions read the current weapon and jumped according to its value.  A
new ship has no defined value for current weapons, so the jump triggered
an uninitialized value warning from Valgrind.

Add new functions set_primary_weapon, set_secondary_weapon that work
like the previous select_* functions, but always take the path used
for weapons not equal, without checking.  This prevents the warnings
from Valgrind, as well as a theoretical risk of initializing the ship
improperly.
2016-12-25 00:33:25 +00:00
Kp 19528a85d0 Fix various check_header_includes=1 failures 2016-12-05 00:26:11 +00:00
Kp 968746c0e8 Pass secondary_weapon_index_t to player_has_secondary_weapon 2016-10-02 00:34:49 +00:00
Kp 603159ec4b Pass secondary_weapon_index_t to do_secondary_weapon_select 2016-10-02 00:34:49 +00:00
Kp 3f27b6daac Pass player_info to CyclePrimary 2016-10-02 00:34:46 +00:00
Kp 2c37514235 Pass player_info to CycleSecondary 2016-10-02 00:34:46 +00:00
Kp 36213d9b50 Pass player_info to select_secondary_weapon 2016-10-02 00:34:46 +00:00
Kp e3c3e39045 Pass player_info to do_primary_weapon_select 2016-10-02 00:34:46 +00:00
Kp 8219df8db9 Pass player_info to pick_up_secondary 2016-10-02 00:34:45 +00:00
Kp c94cec40d0 Pass player_info to pick_up_primary 2016-10-02 00:34:45 +00:00
Kp 2bd5b80451 Pass player_info to check_to_use_primary_super_laser 2016-10-02 00:34:45 +00:00
Kp 86a4942883 Pass player_info to do_secondary_weapon_select 2016-10-02 00:34:45 +00:00
Kp 9800f856e7 Pass player_info to select_primary_weapon 2016-10-02 00:34:45 +00:00
Kp 11551abe5c Pass player_info to non-static pick_up_vulcan_ammo 2016-10-02 00:34:44 +00:00
Kp 96651095e3 Pass player_info to DropCurrentWeapon, DropSecondaryWeapon 2016-10-02 00:34:44 +00:00
Kp b78474edc6 Pass player_info to player_has_secondary_weapon 2016-10-02 00:34:44 +00:00
Kp 83dd51d79b Pass player_info to player_has_primary_weapon 2016-10-02 00:34:43 +00:00
Kp ab89513454 Pass player_info to auto_select_primary_weapon 2016-10-02 00:34:43 +00:00
Kp 1be7344d56 Pass player_info to auto_select_secondary_weapon 2016-10-02 00:34:43 +00:00
Kp a88153c7d9 Add prohibit_void_ptr to player_selected_weapon 2016-10-02 00:34:38 +00:00
Kp 335f24ac31 Move Primary_weapon to player_info 2016-08-28 22:41:49 +00:00
Kp 10ff2b9ea2 Change Primary_weapon_to_weapon_info key to weapon_id_type
Fix incorrect ID in D1 Primary_weapon_to_weapon_info.  Testing suggests
that both the correct and incorrect ID produce the same results.
2016-08-28 22:41:48 +00:00
Kp b7a5f65d5b Move Secondary_weapon to player_info 2016-08-28 22:41:48 +00:00
Kp e7b881e5e6 Move Secondary_last_was_super into player_info 2016-08-28 22:41:48 +00:00
Kp adf5e57b47 Move Primary_last_was_super into player_info 2016-08-28 22:41:47 +00:00
Kp ee1003f29f Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +00:00
Kp 1774676571 Use class to wrap Primary_weapon+Delayed_primary 2016-08-06 19:55:23 +00:00
Kp 99bbd0cf26 Mark global constants as constexpr
s/^const \([^*]*=.*;\)/constexpr \1/
2016-07-23 04:10:42 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp c3003fbb22 Fix vulcan ammo display
Do not abuse `f2i` to shift an unsigned quantity.  `f2i` is defined to
work on `fix`, which is `int`.
2016-02-20 17:28:11 +00:00
Kp dd877f52c2 Remove unused weapon defines 2016-01-09 16:38:15 +00:00