Move Level_shake_duration to d_level_shared_seismic_state

This commit is contained in:
Kp 2019-08-06 02:59:41 +00:00
parent b8fa75c8cb
commit 42778ff7fa
4 changed files with 5 additions and 6 deletions

View file

@ -179,6 +179,7 @@ struct d_game_unique_state : ::dcx::d_game_unique_state
struct d_level_shared_seismic_state
{
fix Level_shake_frequency;
fix Level_shake_duration;
};
struct d_level_unique_seismic_state

View file

@ -148,7 +148,6 @@ int load_mine_data_compiled(PHYSFS_File *LoadFile, const char *Gamesave_current_
#if defined(DXX_BUILD_DESCENT_II)
namespace dsx {
extern int d1_pig_present;
extern fix Level_shake_duration;
extern segnum_t Secret_return_segment;
extern vms_matrix Secret_return_orient;

View file

@ -85,7 +85,6 @@ static void segment2_read(shared_segment &s2, unique_segment &u2, PHYSFS_File *f
#if defined(DXX_BUILD_DESCENT_I)
#elif defined(DXX_BUILD_DESCENT_II)
fix Level_shake_duration = 0;
segnum_t Secret_return_segment;
vms_matrix Secret_return_orient;
@ -493,12 +492,12 @@ int load_mine_data(PHYSFS_File *LoadFile)
#if defined(DXX_BUILD_DESCENT_II)
if (mine_top_fileinfo.fileinfo_version < 18) {
LevelSharedSeismicState.Level_shake_frequency = 0;
Level_shake_duration = 0;
LevelSharedSeismicState.Level_shake_duration = 0;
Secret_return_segment = segment_first;
Secret_return_orient = vmd_identity_matrix;
} else {
LevelSharedSeismicState.Level_shake_frequency = mine_fileinfo.level_shake_frequency << 12;
Level_shake_duration = mine_fileinfo.level_shake_duration << 12;
LevelSharedSeismicState.Level_shake_duration = mine_fileinfo.level_shake_duration << 12;
Secret_return_segment = mine_fileinfo.secret_return_segment;
Secret_return_orient = mine_fileinfo.secret_return_orient;
}

View file

@ -1131,7 +1131,7 @@ void init_seismic_disturbances()
// Return true if time to start a seismic disturbance.
static bool seismic_disturbance_active()
{
const auto level_shake_duration = Level_shake_duration;
const auto level_shake_duration = LevelSharedSeismicState.Level_shake_duration;
if (level_shake_duration < 1)
return false;
@ -1158,7 +1158,7 @@ static void seismic_disturbance_frame(void)
if (seismic_disturbance_active()) {
int fc, rx, rz;
fix delta_time = static_cast<fix>(GameTime64 - LevelUniqueSeismicState.Seismic_disturbance_end_time);
fc = abs(delta_time - Level_shake_duration / 2);
fc = abs(delta_time - LevelSharedSeismicState.Level_shake_duration / 2);
fc /= F1_0/16;
if (fc > 16)
fc = 16;