Move Boss_gate_segs, Boss_teleport_segs to d_level_shared_boss_state
This commit is contained in:
parent
05244122bd
commit
d7e85e0cff
|
@ -41,6 +41,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
||||||
#include "countarray.h"
|
#include "countarray.h"
|
||||||
#include "aistruct.h"
|
#include "aistruct.h"
|
||||||
|
#include "valptridx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace dcx {
|
namespace dcx {
|
||||||
|
@ -90,12 +91,6 @@ extern const object *Ai_last_missile_camera;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace dcx {
|
|
||||||
struct boss_special_segment_array_t : public count_array_t<segnum_t, 100> {};
|
|
||||||
struct boss_teleport_segment_array_t : public boss_special_segment_array_t {};
|
|
||||||
struct boss_gate_segment_array_t : public boss_special_segment_array_t {};
|
|
||||||
extern boss_teleport_segment_array_t Boss_teleport_segs;
|
|
||||||
}
|
|
||||||
namespace dsx {
|
namespace dsx {
|
||||||
void create_awareness_event(vmobjptr_t objp, player_awareness_type_t type); // object *objp can create awareness of player, amount based on "type"
|
void create_awareness_event(vmobjptr_t objp, player_awareness_type_t type); // object *objp can create awareness of player, amount based on "type"
|
||||||
ai_mode ai_behavior_to_mode(ai_behavior behavior);
|
ai_mode ai_behavior_to_mode(ai_behavior behavior);
|
||||||
|
@ -104,6 +99,17 @@ void init_ai_object(vmobjptridx_t objp, ai_behavior initial_mode, imsegidx_t hid
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace dcx {
|
namespace dcx {
|
||||||
|
|
||||||
|
struct d_level_shared_boss_state
|
||||||
|
{
|
||||||
|
struct special_segment_array_t : public count_array_t<vcsegidx_t, 100> {};
|
||||||
|
struct gate_segment_array_t : public special_segment_array_t {};
|
||||||
|
struct teleport_segment_array_t : public special_segment_array_t {};
|
||||||
|
gate_segment_array_t Gate_segs;
|
||||||
|
teleport_segment_array_t Teleport_segs;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern d_level_shared_boss_state LevelSharedBossState;
|
||||||
extern fix64 Boss_cloak_start_time;
|
extern fix64 Boss_cloak_start_time;
|
||||||
extern fix64 Last_teleport_time;
|
extern fix64 Last_teleport_time;
|
||||||
constexpr fix Boss_cloak_duration = F1_0*7;
|
constexpr fix Boss_cloak_duration = F1_0*7;
|
||||||
|
|
|
@ -871,6 +871,7 @@ static void escort_create_path_to_goal(const vmobjptridx_t objp, const player_in
|
||||||
// Returns goal object.
|
// Returns goal object.
|
||||||
static escort_goal_t escort_set_goal_object(const player_flags pl_flags)
|
static escort_goal_t escort_set_goal_object(const player_flags pl_flags)
|
||||||
{
|
{
|
||||||
|
auto &Boss_teleport_segs = LevelSharedBossState.Teleport_segs;
|
||||||
if (Escort_special_goal != ESCORT_GOAL_UNSPECIFIED)
|
if (Escort_special_goal != ESCORT_GOAL_UNSPECIFIED)
|
||||||
return ESCORT_GOAL_UNSPECIFIED;
|
return ESCORT_GOAL_UNSPECIFIED;
|
||||||
if (!(pl_flags & PLAYER_FLAGS_BLUE_KEY) && exists_in_mine(ConsoleObject->segnum, OBJ_POWERUP, POW_KEY_BLUE, -1, pl_flags) != object_none)
|
if (!(pl_flags & PLAYER_FLAGS_BLUE_KEY) && exists_in_mine(ConsoleObject->segnum, OBJ_POWERUP, POW_KEY_BLUE, -1, pl_flags) != object_none)
|
||||||
|
|
|
@ -89,7 +89,7 @@ using std::min;
|
||||||
#define BABY_SPIDER_ID 14
|
#define BABY_SPIDER_ID 14
|
||||||
|
|
||||||
namespace dsx {
|
namespace dsx {
|
||||||
static void init_boss_segments(const segment_array &segments, const object &boss_objnum, boss_special_segment_array_t &imsegptr, int size_check, int one_wall_hack);
|
static void init_boss_segments(const segment_array &segments, const object &boss_objnum, d_level_shared_boss_state::special_segment_array_t &a, int size_check, int one_wall_hack);
|
||||||
static void ai_multi_send_robot_position(object &objnum, int force);
|
static void ai_multi_send_robot_position(object &objnum, int force);
|
||||||
|
|
||||||
#if defined(DXX_BUILD_DESCENT_I)
|
#if defined(DXX_BUILD_DESCENT_I)
|
||||||
|
@ -145,10 +145,6 @@ constexpr array<int8_t, 8> Mike_to_matt_xlate{{
|
||||||
// Amount of time since the current robot was last processed for things such as movement.
|
// Amount of time since the current robot was last processed for things such as movement.
|
||||||
// It is not valid to use FrameTime because robots do not get moved every frame.
|
// It is not valid to use FrameTime because robots do not get moved every frame.
|
||||||
|
|
||||||
boss_teleport_segment_array_t Boss_teleport_segs;
|
|
||||||
|
|
||||||
static boss_gate_segment_array_t Boss_gate_segs;
|
|
||||||
|
|
||||||
// ---------- John: These variables must be saved as part of gamesave. --------
|
// ---------- John: These variables must be saved as part of gamesave. --------
|
||||||
static int Overall_agitation;
|
static int Overall_agitation;
|
||||||
point_seg_array_t Point_segs;
|
point_seg_array_t Point_segs;
|
||||||
|
@ -477,6 +473,8 @@ void ai_init_boss_for_ship(void)
|
||||||
|
|
||||||
static void boss_init_all_segments(const segment_array &Segments, const object &boss_objnum)
|
static void boss_init_all_segments(const segment_array &Segments, const object &boss_objnum)
|
||||||
{
|
{
|
||||||
|
auto &Boss_gate_segs = LevelSharedBossState.Gate_segs;
|
||||||
|
auto &Boss_teleport_segs = LevelSharedBossState.Teleport_segs;
|
||||||
if (!Boss_teleport_segs.empty())
|
if (!Boss_teleport_segs.empty())
|
||||||
return; // already have boss segs
|
return; // already have boss segs
|
||||||
|
|
||||||
|
@ -580,6 +578,8 @@ void init_ai_object(vmobjptridx_t objp, ai_behavior behavior, const imsegidx_t h
|
||||||
// ---------------------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------------------
|
||||||
void init_ai_objects(void)
|
void init_ai_objects(void)
|
||||||
{
|
{
|
||||||
|
auto &Boss_gate_segs = LevelSharedBossState.Gate_segs;
|
||||||
|
auto &Boss_teleport_segs = LevelSharedBossState.Teleport_segs;
|
||||||
Point_segs_free_ptr = Point_segs.begin();
|
Point_segs_free_ptr = Point_segs.begin();
|
||||||
Boss_gate_segs.clear();
|
Boss_gate_segs.clear();
|
||||||
Boss_teleport_segs.clear();
|
Boss_teleport_segs.clear();
|
||||||
|
@ -1991,6 +1991,7 @@ imobjptridx_t gate_in_robot(int type, const vmsegptridx_t segnum)
|
||||||
|
|
||||||
static imobjptridx_t gate_in_robot(fvmsegptridx &vmsegptridx, int type)
|
static imobjptridx_t gate_in_robot(fvmsegptridx &vmsegptridx, int type)
|
||||||
{
|
{
|
||||||
|
auto &Boss_gate_segs = LevelSharedBossState.Gate_segs;
|
||||||
auto segnum = Boss_gate_segs[(d_rand() * Boss_gate_segs.size()) >> 15];
|
auto segnum = Boss_gate_segs[(d_rand() * Boss_gate_segs.size()) >> 15];
|
||||||
return gate_in_robot(type, vmsegptridx(segnum));
|
return gate_in_robot(type, vmsegptridx(segnum));
|
||||||
}
|
}
|
||||||
|
@ -2045,7 +2046,7 @@ void create_buddy_bot(void)
|
||||||
// he can reach from his initial position (calls find_connected_distance).
|
// he can reach from his initial position (calls find_connected_distance).
|
||||||
// If size_check is set, then only add segment if boss can fit in it, else any segment is legal.
|
// If size_check is set, then only add segment if boss can fit in it, else any segment is legal.
|
||||||
// one_wall_hack added by MK, 10/13/95: A mega-hack! Set to !0 to ignore the
|
// one_wall_hack added by MK, 10/13/95: A mega-hack! Set to !0 to ignore the
|
||||||
static void init_boss_segments(const segment_array &segments, const object &boss_objp, boss_special_segment_array_t &a, const int size_check, int one_wall_hack)
|
static void init_boss_segments(const segment_array &segments, const object &boss_objp, d_level_shared_boss_state::special_segment_array_t &a, const int size_check, int one_wall_hack)
|
||||||
{
|
{
|
||||||
constexpr unsigned QUEUE_SIZE = 256;
|
constexpr unsigned QUEUE_SIZE = 256;
|
||||||
auto &vcsegptridx = segments.vcptridx;
|
auto &vcsegptridx = segments.vcptridx;
|
||||||
|
@ -2142,6 +2143,7 @@ static void init_boss_segments(const segment_array &segments, const object &boss
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
static void teleport_boss(const d_vclip_array &Vclip, fvmsegptridx &vmsegptridx, const vmobjptridx_t objp, const vms_vector &target_pos)
|
static void teleport_boss(const d_vclip_array &Vclip, fvmsegptridx &vmsegptridx, const vmobjptridx_t objp, const vms_vector &target_pos)
|
||||||
{
|
{
|
||||||
|
auto &Boss_teleport_segs = LevelSharedBossState.Teleport_segs;
|
||||||
segnum_t rand_segnum;
|
segnum_t rand_segnum;
|
||||||
int rand_index;
|
int rand_index;
|
||||||
assert(!Boss_teleport_segs.empty());
|
assert(!Boss_teleport_segs.empty());
|
||||||
|
@ -4489,6 +4491,10 @@ namespace dsx {
|
||||||
|
|
||||||
int ai_save_state(PHYSFS_File *fp)
|
int ai_save_state(PHYSFS_File *fp)
|
||||||
{
|
{
|
||||||
|
#if defined(DXX_BUILD_DESCENT_II)
|
||||||
|
auto &Boss_gate_segs = LevelSharedBossState.Gate_segs;
|
||||||
|
auto &Boss_teleport_segs = LevelSharedBossState.Teleport_segs;
|
||||||
|
#endif
|
||||||
fix tmptime32 = 0;
|
fix tmptime32 = 0;
|
||||||
|
|
||||||
const int Ai_initialized = 0;
|
const int Ai_initialized = 0;
|
||||||
|
@ -4695,6 +4701,10 @@ static void ai_cloak_info_read_n_swap(ai_cloak_info *ci, int n, int swap, PHYSFS
|
||||||
|
|
||||||
int ai_restore_state(PHYSFS_File *fp, int version, int swap)
|
int ai_restore_state(PHYSFS_File *fp, int version, int swap)
|
||||||
{
|
{
|
||||||
|
#if defined(DXX_BUILD_DESCENT_II)
|
||||||
|
auto &Boss_gate_segs = LevelSharedBossState.Gate_segs;
|
||||||
|
auto &Boss_teleport_segs = LevelSharedBossState.Teleport_segs;
|
||||||
|
#endif
|
||||||
fix tmptime32 = 0;
|
fix tmptime32 = 0;
|
||||||
|
|
||||||
PHYSFSX_readSXE32(fp, swap);
|
PHYSFSX_readSXE32(fp, swap);
|
||||||
|
|
|
@ -41,6 +41,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#include "wall.h"
|
#include "wall.h"
|
||||||
|
|
||||||
namespace dcx {
|
namespace dcx {
|
||||||
|
d_level_shared_boss_state LevelSharedBossState;
|
||||||
d_level_shared_vertex_state LevelSharedVertexState;
|
d_level_shared_vertex_state LevelSharedVertexState;
|
||||||
d_level_unique_fuelcenter_state LevelUniqueFuelcenterState;
|
d_level_unique_fuelcenter_state LevelUniqueFuelcenterState;
|
||||||
d_level_unique_light_state LevelUniqueLightState;
|
d_level_unique_light_state LevelUniqueLightState;
|
||||||
|
|
Loading…
Reference in a new issue