Commit graph

72 commits

Author SHA1 Message Date
Kp 801c76cbd2 Pass context to spit_powerup 2022-07-23 20:58:10 +00:00
Kp 6215ef8e06 Pass LevelSharedRobotInfoState to various functions that need 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 cf51ac4ee0 Fix BUG on show-path cheat
Players are not robots, but the show-path cheat tried to pretend they
are, and triggered a BUG warning[1] when looking up robot information
from the player object.  Fix this by passing in the robot_info when the
caller is providing a robot, and a named `nullptr` value (as
`create_path_unused_robot_info`) when the caller is providing a
non-robot object.

[1] As below, but repeated many times
```
similar/main/ai.cpp:1905: BUG: object 0x555555858550 has type 4, expected 2
similar/main/ai.cpp:1974: BUG: object 0x555555858550 has type 4, expected 2
```
2022-05-21 19:51:18 +00:00
Kp bdff6f7a00 Remove unused return value of attempt_to_steal_item 2022-05-05 02:59:11 +00:00
Kp a610a7b32d Pass bare object & to thief stealing routines
Use `object &` instead of `vmobjptr_t`.  This should generate equivalent
code, but produce smaller debug information and may require less
inlining by the compiler.
2022-04-24 20:42:01 +00:00
Kp 6b8a0a74c6 Fix some check_header_includes=1 failures 2022-02-12 18:57:12 +00:00
Kp 504cbcc012 Split powerup.h to fwd-powerup.h 2022-02-12 18:57:12 +00:00
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