dxx-rebirth/common/main/d_levelstate.h
Kp 0c34a48418 Move Last_level_path_created to LevelUniqueObjectState.Level_path_created
Change it from the level number on which the path was created to a
true/false flag.  The previous logic only tested whether the number was
equal to the current level number.

This also fixes a bug where the action was not available on the first
secret level, since that level is `-1`, and the value was set to `-1` to
indicate that it should be enabled.
2021-11-01 03:37:19 +00:00

61 lines
1.5 KiB
C++

/*
* This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
#pragma once
#include "dxxsconf.h"
#include "object.h"
#include "morph.h"
namespace dcx {
struct d_level_unique_morph_object_state
{
std::array<morph_data::ptr, 5> morph_objects;
~d_level_unique_morph_object_state();
};
}
namespace dsx {
struct d_level_unique_object_state
{
unsigned num_objects = 0;
/* `accumulated_robots` counts robots present at level entry and
* robots added later via materialization centers / boss gating. It
* never decreases, so it is not a shortcut for counting the number
* of currently live objects with type OBJ_ROBOT.
*/
unsigned accumulated_robots;
unsigned total_hostages;
unsigned Debris_object_count = 0;
#if defined(DXX_BUILD_DESCENT_II)
d_unique_buddy_state BuddyState;
d_thief_unique_state ThiefState;
d_guided_missile_indices Guided_missile;
#endif
object_number_array<imobjidx_t, MAX_OBJECTS> free_obj_list;
object_array Objects;
d_level_unique_boss_state BossState;
d_level_unique_control_center_state ControlCenterState;
vms_vector last_console_player_position;
d_level_unique_morph_object_state MorphObjectState;
uint8_t Level_path_created = 0;
auto &get_objects()
{
return Objects;
}
const auto &get_objects() const
{
return Objects;
}
};
extern d_level_unique_object_state LevelUniqueObjectState;
}