Removed Fusion_last_sound_time and made Fusion_next_sound_time static inside FireLaser() with it's own fallback function for bogus timer values - should make this code insusceptible against errors - last but not least: minus two globals
This commit is contained in:
parent
78bbd77b35
commit
2b069acab4
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
|||
20100904
|
||||
--------
|
||||
main/titles.c: In briefing_init() init robot angles properly because in show_spinning_robot_frame() robot_angles.h is incremented only but not initialized
|
||||
main/game.c, main/game.h, main/gameseq.c, main/state.c: Removed Fusion_last_sound_time and made Fusion_next_sound_time static inside FireLaser() with it's own fallback function for bogus timer values - should make this code insusceptible against errors - last but not least: minus two globals
|
||||
|
||||
20100903
|
||||
--------
|
||||
|
|
|
@ -139,8 +139,6 @@ char faded_in;
|
|||
int Game_suspended=0; //if non-zero, nothing moves but player
|
||||
fix Auto_fire_fusion_cannon_time = 0;
|
||||
fix Fusion_charge = 0;
|
||||
fix Fusion_next_sound_time = 0;
|
||||
fix Fusion_last_sound_time = 0;
|
||||
int Game_turbo_mode = 0;
|
||||
int Game_mode = GM_GAME_OVER;
|
||||
int Global_laser_firing_count = 0;
|
||||
|
@ -1266,6 +1264,8 @@ void FireLaser()
|
|||
if ((Players[Player_num].energy < F1_0*2) && (Auto_fire_fusion_cannon_time == 0)) {
|
||||
Global_laser_firing_count = 0;
|
||||
} else {
|
||||
static int Fusion_next_sound_time = 0;
|
||||
|
||||
if (Fusion_charge == 0)
|
||||
Players[Player_num].energy -= F1_0*2;
|
||||
|
||||
|
@ -1283,8 +1283,8 @@ void FireLaser()
|
|||
else
|
||||
PALETTE_FLASH_ADD(Fusion_charge >> 11, Fusion_charge >> 11, 0);
|
||||
|
||||
if (GameTime < Fusion_last_sound_time) //gametime has wrapped
|
||||
Fusion_next_sound_time = Fusion_last_sound_time = GameTime;
|
||||
if (Fusion_next_sound_time > GameTime + F1_0/8 + D_RAND_MAX/4) //gametime has wrapped or something is screwed
|
||||
Fusion_next_sound_time = GameTime - 1;
|
||||
|
||||
if (Fusion_next_sound_time < GameTime) {
|
||||
if (Fusion_charge > F1_0*2) {
|
||||
|
@ -1302,7 +1302,6 @@ void FireLaser()
|
|||
multi_send_play_sound(SOUND_FUSION_WARMUP, F1_0);
|
||||
#endif
|
||||
}
|
||||
Fusion_last_sound_time = GameTime;
|
||||
Fusion_next_sound_time = GameTime + F1_0/8 + d_rand()/4;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ extern fix Last_laser_fired_time;
|
|||
extern fix Next_missile_fire_time; // Time at which player can next fire his selected missile.
|
||||
extern fix Next_flare_fire_time;
|
||||
extern fix Laser_delay_time; // Delay between laser fires.
|
||||
extern fix Fusion_next_sound_time;
|
||||
extern int Cheats_enabled;
|
||||
|
||||
// bits for FixedStep
|
||||
|
|
|
@ -339,7 +339,7 @@ void init_player_stats_level()
|
|||
Players[Player_num].homing_object_dist = -F1_0; // Added by RH
|
||||
|
||||
// properly init these cursed globals
|
||||
Fusion_next_sound_time = Next_flare_fire_time = Last_laser_fired_time = Next_laser_fire_time = Next_missile_fire_time = GameTime;
|
||||
Next_flare_fire_time = Last_laser_fired_time = Next_laser_fire_time = Next_missile_fire_time = GameTime;
|
||||
|
||||
init_gauges();
|
||||
}
|
||||
|
|
|
@ -869,7 +869,6 @@ RetryObjectLoading:
|
|||
PHYSFS_read(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS);
|
||||
|
||||
// Restore hacked up weapon system stuff.
|
||||
Fusion_next_sound_time = GameTime;
|
||||
Auto_fire_fusion_cannon_time = 0;
|
||||
Next_laser_fire_time = GameTime;
|
||||
Next_missile_fire_time = GameTime;
|
||||
|
|
Loading…
Reference in a new issue