Pass player_info to allowed_to_fire_laser

This commit is contained in:
Kp 2017-02-08 23:34:41 +00:00
parent c8f51c7184
commit 82d10b910c
3 changed files with 9 additions and 10 deletions

View file

@ -32,6 +32,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <cstdint>
#include "pack.h"
#include "fwd-object.h"
#include "fwd-player.h"
#include "fwd-segment.h"
#include "fwd-window.h"
@ -347,11 +348,11 @@ void move_player_2_segment(vsegptridx_t seg, int side);
window *game_setup();
window_event_result game_handler(window *wind,const d_event &event, const unused_window_userdata_t *);
window_event_result ReadControls(const d_event &event);
bool allowed_to_fire_laser(const player_info &);
}
#endif
int cheats_enabled();
void game_disable_cheats();
int allowed_to_fire_laser(void);
void check_rear_view(void);
int create_special_path(void);
window_event_result ReadControls(const d_event &event);

View file

@ -837,10 +837,9 @@ void palette_restore(void)
Time_flash_last_played = 0;
#endif
}
}
// --------------------------------------------------------------------------------------------------
int allowed_to_fire_laser(void)
bool allowed_to_fire_laser(const player_info &player_info)
{
if (Player_dead_state != player_dead_state::no)
{
@ -848,8 +847,7 @@ int allowed_to_fire_laser(void)
return 0;
}
auto &plrobj = get_local_plrobj();
auto &Next_laser_fire_time = plrobj.ctype.player_info.Next_laser_fire_time;
auto &Next_laser_fire_time = player_info.Next_laser_fire_time;
// Make sure enough time has elapsed to fire laser
if (Next_laser_fire_time > GameTime64)
return 0;
@ -857,7 +855,6 @@ int allowed_to_fire_laser(void)
return 1;
}
namespace dsx {
int allowed_to_fire_flare(player_info &player_info)
{
auto &Next_flare_fire_time = player_info.Next_flare_fire_time;
@ -1392,8 +1389,9 @@ namespace dsx {
window_event_result GameProcessFrame()
{
auto &player_info = get_local_plrobj().ctype.player_info;
auto &local_player_shields_ref = get_local_plrobj().shields;
auto &plrobj = get_local_plrobj();
auto &player_info = plrobj.ctype.player_info;
auto &local_player_shields_ref = plrobj.shields;
fix player_shields = local_player_shields_ref;
const auto player_was_dead = Player_dead_state;
auto result = window_event_result::ignored;
@ -1507,7 +1505,7 @@ window_event_result GameProcessFrame()
do_ai_frame_all();
if (allowed_to_fire_laser())
if (allowed_to_fire_laser(player_info))
FireLaser(); // Fire Laser!
auto laser_firing_count = Global_laser_firing_count;

View file

@ -2727,7 +2727,7 @@ void show_reticle(const player_info &player_info, int reticle_type, int secondar
y = grd_curcanv->cv_bitmap.bm_h/2;
size = (grd_curcanv->cv_bitmap.bm_h / (32-(PlayerCfg.ReticleSize*4)));
laser_ready = allowed_to_fire_laser();
laser_ready = allowed_to_fire_laser(player_info);
missile_ready = allowed_to_fire_missile(player_info);
auto &Primary_weapon = player_info.Primary_weapon;