Commit graph

238 commits

Author SHA1 Message Date
Kp 69404ebc6e Move Boss_cloak_start_time to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
Kp a2560cdfb5 Move Stolen_items into d_thief_unique_state 2019-07-16 04:00:50 +00:00
Kp 8f475021ca Move player::hostages_level to d_level_unique_object_state
The number of hostages on a level is a function of the level, not any
particular player.  Move it to d_level_unique_object_state and rename it
to total_hostages.
2019-07-16 04:00:50 +00:00
Kp a24de0c003 Move player::num_robots_level to d_level_unique_object_state
The number of robots accumulated on a level is a function of the level,
not any particular player.  Move it to d_level_unique_object_state and
rename it to accumulated_robots.
2019-07-16 04:00:50 +00:00
Kp 9df482a423 Move Last_gate_time to d_level_unique_boss_state 2019-07-13 22:28:57 +00:00
Kp bfeca84bb8 Change object::signature to be a generation counter
This removes the need to walk all objects when creating a new one, since
each object can have a private generation counter, unaware of other
objects.  For compatibility with demos, mix in the object's index when
writing the signature value.
2019-07-07 22:00:02 +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 bfcff2cefe Fix crash loading guidebot with unreachable goal
Remove use of object_guidebot_cannot_reach and instead track the
reachability of the object as a separate flag.  This allows the game to
remember when an object was found, but unreachable.  Previously, it
would store only that some unreachable object was found.  Now, it stores
the index of the unreachable object.  This extra information is not used
yet.

Reported-by: Dainslaif <https://github.com/dxx-rebirth/dxx-rebirth/issues/421>
Fixes: c3cead4319 ("Move Escort_goal_index to d_unique_buddy_state")
2019-05-26 00:44:37 +00:00
Kp 48527630dd Remove __attribute__((packed)) on shortpos for gcc-9 support
gcc-9 warns on taking the address of an unaligned member in a packed
structure.  This structure does not need to be packed.  Remove
__attribute__((packed)) and fix the code to implement I/O correctly
without packing.
2019-05-11 20:18:29 +00:00
Kp 4d8d244bb9 Move spreadfire,helix orientation to player_info 2019-05-04 18:27:36 +00:00
Kp 5dc630b58f Move Last_buddy_message_time to d_unique_buddy_state 2019-03-03 00:31:09 +00:00
Kp 5da35845d9 Move Buddy_last_player_path_created to d_unique_buddy_state 2019-03-03 00:31:09 +00:00
Kp 5b503c22a6 Move Escort_last_path_created to d_unique_buddy_state 2019-03-03 00:31:09 +00:00
Kp bc62ae694b Move Last_come_back_message_time to d_unique_buddy_state 2019-03-03 00:31:09 +00:00
Kp 7e61451792 Move Last_time_buddy_gave_hint to d_unique_buddy_state 2019-03-03 00:31:09 +00:00
Kp 7577a3e408 Move Escort_special_goal to d_unique_buddy_state 2019-03-03 00:31:09 +00:00
Kp d46fd99425 Move Buddy_last_missile_time to d_unique_buddy_state 2019-03-03 00:31:09 +00:00
Kp b1e19ac667 Move Buddy_last_seen_player to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp bd1cce0cc3 Move Buddy_sorry_time to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp ee584f1f37 Move Last_buddy_polish_path_tick to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp 9e3c5ec272 Move Last_buddy_key to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp b34e7bae24 Move Buddy_gave_hint_count to d_unique_buddy_state
Fix original bug that buddy was limited to 5 hints per program run, not
5 per boss as it probably should have been.

Due to savegame format limitations, this still is not right.  Reloading
the game should restore Buddy_gave_hint_count to its value at save time,
but will not.
2019-03-03 00:31:08 +00:00
Kp 58d59da9d2 Move Escort_goal_object to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp 926afe73d5 Move Looking_for_marker to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp ace3313dc3 Move Buddy_messages_suppressed to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp c3cead4319 Move Escort_goal_index to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp c02bee26d6 Move Buddy_allowed_to_talk to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp 420464549b Move Buddy_objnum to d_unique_buddy_state 2019-03-03 00:31:08 +00:00
Kp 1008ab397e Move Objects to d_level_unique_object_state 2019-03-03 00:31:08 +00:00
Kp ad6b857cf2 Move most laser_info fields to dcx 2019-02-02 18:36:39 +00:00
Kp 69c02efe1d Simplify g3s_codes 2018-12-30 00:43:58 +00:00
Kp 040de5b10e Rename ObjectState to LevelUniqueObjectState for consistency 2018-12-30 00:43:57 +00:00
Kp e1d1cbb0ed Pass context to set_powerup_id 2018-10-08 03:58:48 +00:00
Kp 9360a41816 Move Guided_missile into d_level_object_state 2018-10-08 03:58:48 +00:00
Kp e6ea981ab4 Generalize marker object number init 2018-09-09 01:00:39 +00:00
Kp f869a16e35 Move Debris_object_count into d_level_object_state 2018-04-02 03:39:51 +00:00
Kp 18af84a0ab Remove __attribute__((packed)) from quaternionpos
Packed structures cannot be passed by reference, may fail on
alignment-strict architectures, and are bad for performance even on
alignment-tolerant architectures.  Using them for anything other than an
abstract layout declaration is a mistake.  Remove
__attribute__((packed)).
2018-03-31 21:53:01 +00:00
Kp a6b169afcc Move free_obj_list into d_level_object_state 2018-03-12 03:43:46 +00:00
Kp b63633db51 Move num_objects into d_level_object_state 2018-03-12 03:43:46 +00:00
Kp 1c92b448c8 Add d_level_object_state to wrap Objects and related data 2018-03-12 03:43:46 +00:00
Kp 8d80300e0a Remove obsolete D1 hostage editor code
This code was part of a feature abandoned before retail.  It cannot be
usefully used in campaigns.  Remove it to reduce code size and simplify
later changes.
2017-10-14 17:10:31 +00:00
Kp 9421c31b5a Replace "compiler-type_traits.h" with <type_traits>
Delete stub "compiler-type_traits.h" header.  Redirect all uses to the
standard <type_traits> header.

git grep -wlz 'compiler-type_traits.h' -- '*.cpp' '*.h' | xargs -0 perl -p -i <<EOF
    BEGIN {
	    $i = 0;
    }
    if (($i == 1 && $_ eq "\n") || ($i < 2 && /^#include "/)) {
	    # First blank line or first user-include after a system-include.
	    # Print, then never again for this file.
	    print "#include <type_traits>\n";
	    $i = 2;
    } elsif ($i == 0) {
	    $i = 1 if (/^#include </);
    } elsif ($_ eq "#include \"compiler-type_traits.h\"\n") {
	    # Remove this line if found.
	    $_ = '';
    }
    # Reset state machine when moving to next file.
    $i = 0 if eof;
EOF
2017-06-25 20:46:03 +00:00
Kp 430f7832aa Move valptridx factories into array_managed_type 2017-06-10 03:31:03 +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 829e95b6f8 Separate hoard/proximity tracking 2017-03-18 18:07:36 +00:00
Kp 859b399d20 Use mask for Secondary_last_was_super 2017-02-19 19:33:45 +00:00
Kp 7c658fd8cd Use mask for Primary_last_was_super 2017-02-19 19:33:44 +00:00
Kp a815541ef5 Fix check_header_includes=1 poison.h 2017-02-19 19:33:36 +00:00
Kp 3594e7093f Switch last_hitobj to use array<objnum_t> instead of bitset
This reduces the number of objects that can be tracked concurrently, but
allows MAX_OBJECTS to rise without causing `laser_info` to grow.
2017-01-15 00:03:13 +00:00
Kp 6d3fb34268 Abstract out last_hitobj management 2017-01-15 00:03:13 +00:00
Kp 012238ba14 Fold segnum.h into fwd-segment.h 2016-12-24 18:12:17 +00:00
Kp fe0c97ebb9 Move Player_eggs_dropped to player_info 2016-12-10 17:51:09 +00:00
Kp c7634a1923 Move Auto_fire_fusion_cannon_time to player_info 2016-12-10 17:51:09 +00:00
Kp 51b06f6cdc Move Fusion_charge to player_info
This eliminates some ugly hacks regarding remotely generated fusion
shots.
2016-12-10 17:51:09 +00:00
Kp 0c219e596e Use enum for object movement type 2016-11-20 23:12:00 +00:00
Kp 4497812674 Use enum for object type 2016-11-20 23:12:00 +00:00
Kp 6838ffaa95 Move Omega_recharge_delay to player_info 2016-11-12 18:10:08 +00:00
Kp 61567eeed0 Move player::KillGoalCount to player_info 2016-11-12 18:10:07 +00:00
Kp 1060c8fabb Move player::net_kills_total to player_info 2016-11-12 18:10:07 +00:00
Kp 411b623aa7 Move player::net_killed_total to player_info 2016-11-12 18:10:07 +00:00
Kp 248dd5c309 Move player::hostages_rescued_total to player_info 2016-10-15 00:53:19 +00:00
Kp f21abc94cb Move player::hostages_on_board to player_info 2016-10-15 00:53:19 +00:00
Kp e721fc56da Move player::last_score to player_info 2016-10-15 00:53:19 +00:00
Kp ecb91955ae Move player::score to player_info 2016-10-15 00:53:19 +00:00
Kp 00ccd3f6f6 Move Delayed_secondary into Secondary_weapon 2016-10-02 00:34:43 +00:00
Kp 335f24ac31 Move Primary_weapon to player_info 2016-08-28 22:41:49 +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 8248438ffa Move Omega_charge to player_info 2016-08-28 22:41:47 +00:00
Kp c772385f81 Fix check_header_includes=1 Linux build 2016-08-06 19:55:24 +00:00
Kp ea65c74ba9 Move last_player_bump into player_info.Last_bumped_local_player 2016-07-25 03:48:08 +00:00
Kp 8a46462846 Move lavafall_hiss_playing into player_info 2016-07-24 04:04:25 +00:00
Kp f2ecb6401a Simplify do_powerup_frame tests 2016-07-16 16:52:04 +00:00
Kp 9128ff7c35 Move Next_laser_fire_time to player_info 2016-07-06 01:54:26 +00:00
Kp bd3db75108 Move Next_missile_fire_time to player_info 2016-07-06 01:54:26 +00:00
Kp a554d7e2c4 Move Next_flare_fire_time into player_info 2016-07-06 01:54:25 +00:00
Kp 6251848c5f Move Missile_gun into player_info 2016-07-06 01:54:25 +00:00
Kp 1551443eff Fix -Wshadow warnings in macro check_warn_object_type 2016-05-21 17:24:51 +00:00
Kp c2905bda23 Move check_warn_object_type to namespace dcx 2016-04-06 03:34:13 +00:00
Kp 608467161b Remove obsolete arguments from DEFINE_VALPTRIDX_SUBTYPE 2016-04-06 03:34:13 +00:00
Kp dd3cedff3d Add get_ghost_id for multi_do_reappear
Ghosts use the same ID space as players, so reuse function get_player_id
to fetch the ID after checking.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/182>
Fixes: 9f26e2211e ("Warn on invalid object ID access")
2016-03-20 20:38:54 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp 97219697a7 Make check_warn_object_type work without gcc ({}) extension 2016-03-05 17:26:24 +00:00
Kp 95ab6076a4 Move FakingInvul to player_info
Every player can fake invulnerability independently.  In preparation for
host tracking, store FakingInvul as a player property, not a static
global.
2016-02-27 19:02:21 +00:00
Kp 8e86a3586d Use #ifdef dsx to guard dsx namespace 2016-01-09 16:38:15 +00:00
Kp 0be0475309 Move valptridx array highest to base class 2016-01-09 16:38:14 +00:00
Kp f48eddeece Block direct changes to Highest_object_index
Route updates through helper functions.
2016-01-09 16:38:12 +00:00
Kp 5d4bcddd4f Move common object fields to dcx::object_base 2015-12-22 04:18:50 +00:00
Kp 26e948d5f1 Uninline namespace dsx 2015-12-13 18:00:49 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp e549f3451e Use inline namespace dsx for object.h 2015-12-05 22:57:25 +00:00
Kp b683b4cc68 Scope weapon type 2015-12-03 03:26:49 +00:00
Kp 31d538ebe2 Use helper for robot weapon type 2015-12-03 03:26:48 +00:00
Kp 0c75aecc45 Check most uses of object id 2015-11-27 03:56:13 +00:00
Kp 266a2aecdb Extend check_warn_object_type to report always-wrong cases 2015-11-27 03:56:12 +00:00
Kp bdbc129d14 Optimize out some object type warnings 2015-11-26 02:56:56 +00:00
Kp 9f26e2211e Warn on invalid object ID access 2015-11-26 02:56:56 +00:00
Kp 44753209d6 Move homing_object_dist to object.ctype.player_info 2015-11-14 18:17:22 +00:00
Kp 52051c427b Move invulnerable_time to object.ctype.player_info 2015-11-14 18:17:21 +00:00