Open source remastering of the Freespace 2 engine
player.h File Reference
#include "globalincs/globals.h"
#include "hud/hudtarget.h"
#include "io/keycontrol.h"
#include "localization/localize.h"
#include "network/multi_options.h"
#include "parse/sexp.h"
#include "physics/physics.h"
#include "stats/scoring.h"

Go to the source code of this file.


struct  campaign_stats
class  player


#define PLAYER_PILOT_PIC_W   160
#define PLAYER_PILOT_PIC_H   120
#define PLAYER_SQUAD_PIC_W   128
#define PLAYER_SQUAD_PIC_H   128
#define PLAYER_FLAGS_MSG_MODE   (1<<1)
#define PLAYER_FLAGS_PROMOTED   (1<<5)
#define PLAYER_FLAGS_IS_MULTI   (1<<6)
#define PCM_NORMAL   0
#define PCM_WARPOUT_STAGE1   1
#define PCM_WARPOUT_STAGE2   2
#define PCM_WARPOUT_STAGE3   3
#define PCM_SUPERNOVA   4
#define LGC_NORMAL   (1<<0)
#define LGC_STEERING   (1<<1)
#define LGC_FULL   (1<<2)
#define LGC_B_NORMAL   (1<<3)
#define LGC_B_OVERRIDE   (1<<4)
#define LGC_B_ADDITIVE   (1<<5)
#define LGC_B_POLL_ALL   (1<<6)
#define PLAYER_WARPOUT_SPEED   40.0f


typedef struct campaign_stats campaign_stats


void player_init ()
void player_level_init ()
void player_controls_init ()
void player_match_target_speed (char *no_target_text=NULL, char *match_off_text=NULL, char *match_on_text=NULL)
void player_clear_speed_matching ()
void player_set_pilot_defaults (player *p)
int player_process_pending_praise ()
 See if there is a praise message to deliver to the player. We want to delay the praise messages a bit, to make them more realistic. More...
float player_farthest_weapon_range ()
void player_save_target_and_weapon_link_prefs ()
void player_restore_target_and_weapon_link_prefs ()
void player_stop_looped_sounds ()
void player_maybe_start_repair_sound ()
void player_stop_repair_sound ()
void player_stop_cargo_scan_sound ()
void player_maybe_start_cargo_scan_sound ()
void player_set_squad_bitmap (player *p, char *fnamem, bool ismulti)
void player_set_squad (player *p, char *squad_name)
int player_inspect_cargo (float frametime, char *outstr)
void toggle_player_object ()
void read_player_controls (object *obj, float frametime)
void player_control_reset_ci (control_info *ci)
void player_generate_death_message (player *player_p)
void player_show_death_message ()
void player_maybe_fire_turret (object *objp)
void player_maybe_play_all_alone_msg ()
void player_set_next_all_alone_msg_timestamp ()
void player_get_padlock_orient (matrix *eye_orient)
void player_display_padlock_view ()
camid player_get_cam ()


player Players [MAX_PLAYERS]
int Player_num
int Player_use_ai
int view_centering
angles chase_slew_angles
int lua_game_control
int use_descent
float Warpout_time
int Warpout_forced

Macro Definition Documentation

#define LGC_B_ADDITIVE   (1<<5)

Definition at line 71 of file player.h.

#define LGC_B_NORMAL   (1<<3)

Definition at line 69 of file player.h.

#define LGC_B_OVERRIDE   (1<<4)

Definition at line 70 of file player.h.

#define LGC_B_POLL_ALL   (1<<6)

Definition at line 73 of file player.h.

#define LGC_FULL   (1<<2)

Definition at line 67 of file player.h.

#define LGC_NORMAL   (1<<0)

Definition at line 65 of file player.h.

#define LGC_STEERING   (1<<1)

Definition at line 66 of file player.h.


Definition at line 26 of file player.h.


Definition at line 281 of file player.h.

#define PCM_NORMAL   0

Definition at line 58 of file player.h.

#define PCM_SUPERNOVA   4

Definition at line 62 of file player.h.

#define PCM_WARPOUT_STAGE1   1

Definition at line 59 of file player.h.

#define PCM_WARPOUT_STAGE2   2

Definition at line 60 of file player.h.

#define PCM_WARPOUT_STAGE3   3

Definition at line 61 of file player.h.


Definition at line 39 of file player.h.


Definition at line 38 of file player.h.


Definition at line 50 of file player.h.


Definition at line 43 of file player.h.


Definition at line 44 of file player.h.


Definition at line 49 of file player.h.

#define PLAYER_FLAGS_IS_MULTI   (1<<6)

Definition at line 42 of file player.h.


Definition at line 51 of file player.h.


Definition at line 48 of file player.h.


Definition at line 53 of file player.h.


Definition at line 54 of file player.h.


Definition at line 52 of file player.h.


Definition at line 45 of file player.h.


Definition at line 46 of file player.h.


Definition at line 36 of file player.h.

#define PLAYER_FLAGS_MSG_MODE   (1<<1)

Definition at line 37 of file player.h.


Definition at line 47 of file player.h.

#define PLAYER_FLAGS_PROMOTED   (1<<5)

Definition at line 41 of file player.h.


Definition at line 40 of file player.h.

Definition at line 56 of file player.h.


Definition at line 77 of file player.h.

#define PLAYER_PILOT_PIC_H   120

Definition at line 30 of file player.h.

#define PLAYER_PILOT_PIC_W   160

Definition at line 29 of file player.h.

#define PLAYER_SQUAD_PIC_H   128

Definition at line 33 of file player.h.

#define PLAYER_SQUAD_PIC_W   128

Definition at line 32 of file player.h.

#define PLAYER_WARPOUT_SPEED   40.0f

Definition at line 279 of file player.h.


Definition at line 280 of file player.h.

Typedef Documentation

Function Documentation

void player_clear_speed_matching ( )

Clear current speed matching and auto-speed matching flags

Definition at line 998 of file playercontrol.cpp.

void player_control_reset_ci ( control_info ci)

Called by single and multiplayer modes to reset information inside of control info structure

Definition at line 351 of file playercontrol.cpp.

void player_controls_init ( )

Definition at line 979 of file playercontrol.cpp.

void player_display_padlock_view ( )

Definition at line 1933 of file playercontrol.cpp.

float player_farthest_weapon_range ( )

Get the maximum weapon range for the player (of both primary and secondary)

Maximum weapon range

Definition at line 1634 of file playercontrol.cpp.

void player_generate_death_message ( player player_p)

Generates the message for death of a player given the information stored in the player object.

Definition at line 1675 of file playercontrol.cpp.

camid player_get_cam ( )

Get the player's eye position and orient

Definition at line 1976 of file playercontrol.cpp.

void player_get_padlock_orient ( matrix eye_orient)

Definition at line 1909 of file playercontrol.cpp.

void player_init ( )

Initializes global variables once a game – needed because of mallocing that goes on in structures in the player file

Definition at line 1286 of file playercontrol.cpp.

int player_inspect_cargo ( float  frametime,
char *  outstr 

See if the player should be inspecting cargo, and update progress.

frametimeTime since last frame in seconds
outstr(output parm) holds string that HUD should display
1 if player should display outstr on HUD; 0if don't display cargo on HUD

Definition at line 1410 of file playercontrol.cpp.

void player_level_init ( )

Initialise player statistics on a per mission basis

Don't use memset(0) approach to setting up Player->ci

Definition at line 1201 of file playercontrol.cpp.

void player_match_target_speed ( char *  no_target_text,
char *  match_off_text,
char *  match_on_text 

Computes the forward_thrust_time needed for the player ship to match velocities with the currently selected target

no_target_textDefault parm (NULL), used to override HUD output when no target exists
match_off_textDefault parm (NULL), used to overide HUD output when matching toggled off
match_on_textDefault parm (NULL), used to overide HUD output when matching toggled on

Definition at line 1016 of file playercontrol.cpp.

void player_maybe_fire_turret ( object objp)
void player_maybe_play_all_alone_msg ( )

Maybe play message from Terran Command 'You're all alone now, pilot'

Definition at line 1810 of file playercontrol.cpp.

void player_maybe_start_cargo_scan_sound ( )

Start the cargo scanning sound if it hasn't already been started

Definition at line 1338 of file playercontrol.cpp.

void player_maybe_start_repair_sound ( )

Start the repair sound if it hasn't already been started. Called when a player ship is being repaired by a support ship

Definition at line 1315 of file playercontrol.cpp.

int player_process_pending_praise ( )

See if there is a praise message to deliver to the player. We want to delay the praise messages a bit, to make them more realistic.

1 if a praise message was delivered to the player, or a praise is pending; 0 if no praise is pending

Definition at line 1364 of file playercontrol.cpp.

void player_restore_target_and_weapon_link_prefs ( )

Store some player preferences to Player->save_flags

Definition at line 1175 of file playercontrol.cpp.

void player_save_target_and_weapon_link_prefs ( )

Store some player preferences to Player->save_flags

Definition at line 1141 of file playercontrol.cpp.

void player_set_next_all_alone_msg_timestamp ( )

Definition at line 1802 of file playercontrol.cpp.

void player_set_pilot_defaults ( player p)

Called when a new pilot is created

Definition at line 1129 of file playercontrol.cpp.

void player_set_squad ( player p,
char *  squad_name 

Definition at line 383 of file managepilot.cpp.

void player_set_squad_bitmap ( player p,
char *  fnamem,
bool  ismulti 

Definition at line 345 of file managepilot.cpp.

void player_show_death_message ( )

Display what/who killed the player

Definition at line 1765 of file playercontrol.cpp.

void player_stop_cargo_scan_sound ( )

Stop the player repair sound if it is already playing

Definition at line 1349 of file playercontrol.cpp.

void player_stop_looped_sounds ( )

Stop any looping sounds associated with the Player, called from game_stop_looped_sounds().

Definition at line 1298 of file playercontrol.cpp.

void player_stop_repair_sound ( )

Stop the player repair sound if it is already playing

Definition at line 1326 of file playercontrol.cpp.

void read_player_controls ( object obj,
float  frametime 

Definition at line 847 of file playercontrol.cpp.

void toggle_player_object ( )

Definition at line 1084 of file playercontrol.cpp.

Variable Documentation

angles chase_slew_angles

Definition at line 60 of file playercontrol.cpp.

int lua_game_control

Definition at line 56 of file playercontrol.cpp.

player* Player

Definition at line 51 of file playercontrol.cpp.

int Player_num

Definition at line 50 of file playercontrol.cpp.

int Player_use_ai

Definition at line 54 of file playercontrol.cpp.

player Players[MAX_PLAYERS]

Definition at line 48 of file playercontrol.cpp.

int use_descent

Definition at line 1081 of file playercontrol.cpp.

int view_centering

Definition at line 61 of file playercontrol.cpp.

int Warpout_forced

Definition at line 176 of file fredstubs.cpp.

float Warpout_time

Definition at line 177 of file fredstubs.cpp.