Open source remastering of the Freespace 2 engine
freespace.cpp File Reference
#include <unistd.h>
#include <sys/stat.h>
#include "anim/animplay.h"
#include "asteroid/asteroid.h"
#include "autopilot/autopilot.h"
#include "bmpman/bmpman.h"
#include "cfile/cfile.h"
#include "cmdline/cmdline.h"
#include "cmeasure/cmeasure.h"
#include "cutscene/cutscenes.h"
#include "cutscene/movie.h"
#include "debris/debris.h"
#include "debugconsole/console.h"
#include "exceptionhandler/exceptionhandler.h"
#include "external_dll/trackirpublic.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "freespace2/freespaceresource.h"
#include "freespace2/levelpaging.h"
#include "fs2netd/fs2netd_client.h"
#include "gamehelp/contexthelp.h"
#include "gamehelp/gameplayhelp.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/eventmusic.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
#include "globalincs/mspdb_callstack.h"
#include "globalincs/version.h"
#include "graphics/font.h"
#include "graphics/shadows.h"
#include "hud/hud.h"
#include "hud/hudconfig.h"
#include "hud/hudescort.h"
#include "hud/hudlock.h"
#include "hud/hudmessage.h"
#include "hud/hudparse.h"
#include "hud/hudshield.h"
#include "hud/hudsquadmsg.h"
#include "hud/hudtargetbox.h"
#include "iff_defs/iff_defs.h"
#include "io/joy.h"
#include "io/joy_ff.h"
#include "io/key.h"
#include "io/mouse.h"
#include "io/timer.h"
#include "jumpnode/jumpnode.h"
#include "lab/lab.h"
#include "lab/wmcgui.h"
#include "lighting/lighting.h"
#include "localization/localize.h"
#include "math/staticrand.h"
#include "menuui/barracks.h"
#include "menuui/credits.h"
#include "menuui/mainhallmenu.h"
#include "menuui/optionsmenu.h"
#include "menuui/playermenu.h"
#include "menuui/readyroom.h"
#include "menuui/snazzyui.h"
#include "menuui/techmenu.h"
#include "menuui/trainingmenu.h"
#include "mission/missionbriefcommon.h"
#include "mission/missioncampaign.h"
#include "mission/missiongoals.h"
#include "mission/missionhotkey.h"
#include "mission/missionload.h"
#include "mission/missionlog.h"
#include "mission/missionmessage.h"
#include "mission/missionparse.h"
#include "mission/missiontraining.h"
#include "missionui/fictionviewer.h"
#include "missionui/missionbrief.h"
#include "missionui/missioncmdbrief.h"
#include "missionui/missiondebrief.h"
#include "missionui/missionloopbrief.h"
#include "missionui/missionpause.h"
#include "missionui/missionscreencommon.h"
#include "missionui/missionshipchoice.h"
#include "missionui/missionweaponchoice.h"
#include "missionui/redalert.h"
#include "mod_table/mod_table.h"
#include "nebula/neb.h"
#include "nebula/neblightning.h"
#include "network/multi.h"
#include "network/multi_dogfight.h"
#include "network/multi_endgame.h"
#include "network/multi_ingame.h"
#include "network/multi_log.h"
#include "network/multi_pause.h"
#include "network/multi_pxo.h"
#include "network/multi_rate.h"
#include "network/multi_respawn.h"
#include "network/multi_voice.h"
#include "network/multimsgs.h"
#include "network/multiteamselect.h"
#include "network/multiui.h"
#include "network/multiutil.h"
#include "network/stand_gui.h"
#include "object/objcollide.h"
#include "object/objectsnd.h"
#include "object/waypoint.h"
#include "observer/observer.h"
#include "osapi/osapi.h"
#include "osapi/osregistry.h"
#include "parse/encrypt.h"
#include "parse/generic_log.h"
#include "parse/lua.h"
#include "parse/parselo.h"
#include "parse/scripting.h"
#include "parse/sexp.h"
#include "particle/particle.h"
#include "pilotfile/pilotfile.h"
#include "playerman/managepilot.h"
#include "playerman/player.h"
#include "popup/popup.h"
#include "popup/popupdead.h"
#include "radar/radar.h"
#include "radar/radarsetup.h"
#include "render/3d.h"
#include "ship/afterburner.h"
#include "ship/awacs.h"
#include "ship/ship.h"
#include "ship/shipcontrails.h"
#include "ship/shipfx.h"
#include "ship/shiphit.h"
#include "sound/audiostr.h"
#include "sound/ds.h"
#include "sound/fsspeech.h"
#include "sound/sound.h"
#include "sound/voicerec.h"
#include "starfield/starfield.h"
#include "starfield/supernova.h"
#include "stats/medals.h"
#include "stats/stats.h"
#include "weapon/beam.h"
#include "weapon/emp.h"
#include "weapon/flak.h"
#include "weapon/muzzleflash.h"
#include "weapon/shockwave.h"
#include "weapon/weapon.h"
#include <stdexcept>

Go to the source code of this file.


struct  big_expl_flash
struct  animating_obj


#define FRAME_FILTER   16
#define EXE_FNAME   ("fs2.exe")
#define LAUNCHER_FNAME   ("Launcher.exe")
#define EXPIRE_BAD_TIME   2
#define DIMINISH_RATE   0.75f
#define SUN_DIMINISH_RATE   6.00f
#define TIME_UP   1500
#define TIME_DOWN   2500
#define COUNT_ESTIMATE   425
#define NUM_FRAMES_TEST   300
#define NUM_MIXED_SOUNDS   16
#define MIN_DIST_TO_DEAD_CAMERA   50.0f
#define FF_SCALE   10000
#define DEBUG_GET_TIME(x)   { x = timer_get_fixed_seconds(); }
#define MAX_FRAMETIME   (F1_0/4)
#define BAIL()   do { int _idx; for(_idx=0; _idx<num_files; _idx++){ if(pof_list[_idx] != NULL){vm_free(pof_list[_idx]); pof_list[_idx] = NULL;}} return;} while(0);
#define EVENT_DEBUG_MAX   5000
#define EVENT_DEBUG_EVENT   0x8000
#define CD_SIZE_72_MINUTE_MAX   (697000000)


typedef struct big_expl_flash big_expl_flash
typedef struct animating_obj animating_obj


void multi_spew_pxo_checksums (int max_files, const char *outfile)
void fs2netd_spew_table_checksums (char *outfile)
void game_reset_view_clip ()
void game_reset_shade_frame ()
void game_post_level_init ()
void game_do_frame ()
void game_update_missiontime ()
void game_reset_time ()
void game_show_framerate ()
void model_page_in_start ()
int detect_lang ()
void ssm_init ()
void ssm_level_init ()
void ssm_process ()
void game_maybe_draw_mouse (float frametime)
void init_animating_pointer ()
void load_animating_pointer (char *filename)
void unload_animating_pointer ()
void game_do_training_checks ()
void game_shutdown (void)
void game_show_event_debug (float frametime)
void game_event_debug_init ()
void game_frame (bool paused=false)
void game_start_subspace_ambient_sound ()
void game_stop_subspace_ambient_sound ()
void verify_ships_tbl ()
void verify_weapons_tbl ()
void game_title_screen_display ()
void game_title_screen_close ()
int init_cdrom ()
fs_builtin_missiongame_find_builtin_mission (char *filename)
int game_get_default_skill_level ()
void game_flash_reset ()
void game_framerate_check_init ()
void game_framerate_check ()
void game_flash (float r, float g, float b)
void big_explosion_flash (float flash)
bool stars_sun_has_glare (int index)
void game_sunspot_process (float frametime)
void game_flash_diminish (float frametime)
void game_level_close ()
void game_level_init ()
void freespace_stop_mission ()
void game_do_networking ()
void game_loading_callback (int count)
void game_loading_callback_init ()
void game_loading_callback_close ()
void game_maybe_update_sound_environment ()
void game_assign_sound_environment ()
void freespace_mission_load_stuff ()
int game_start_mission ()
 DCF (warp,"Tests warpin effect")
 DCF (show_mem,"Toggles showing mem usage")
 DCF (show_cpu,"Toggles showing cpu usage")
 DCF (use_joy_mouse,"Makes joystick move mouse cursor")
 DCF_BOOL (palette_flash, Use_palette_flash)
 DCF (low_mem,"Uses low memory settings regardless of RAM")
 DCF (force_fullscreen,"Forces game to startup in fullscreen mode")
 DCF (gamma,"Sets and saves Gamma Factor")
void game_init ()
void game_get_framerate ()
void game_show_eye_pos (camid cid)
void game_show_standalone_framerate ()
void game_show_time_left ()
 DCF (ai_pause,"Pauses ai")
 DCF (single_step,"Enables single step mode.")
void game_training_pause_do ()
void game_increase_skill_level ()
 DCF (view,"Sets the percent of the 3d view to render.")
void game_set_view_clip (float frametime)
void show_debug_stuff ()
void game_tst_frame_pre ()
void game_tst_frame ()
void game_tst_mark (object *objp, ship *shipp)
void render_shields ()
void player_repair_frame (float frametime)
void do_timing_test (float frame_time)
 DCF (dcf_fov,"Change the field of view of the main camera")
 DCF (framerate_cap,"Sets the framerate cap")
void say_view_target ()
void game_whack_reset ()
void game_whack_apply (float x, float y)
void game_shudder_apply (int time, float intensity)
float get_shake (float intensity, int decay_time, int max_decay_time)
void apply_view_shake (matrix *eye_orient)
void render_environment (int i, vec3d *eye_pos, matrix *new_orient, float new_zoom)
void setup_environment_mapping (camid cid)
void game_environment_map_gen ()
camid chase_get_camera ()
camid game_render_frame_setup ()
void ai_debug_render_stuff ()
void clip_frame_view ()
void game_render_frame (camid cid)
void game_flip_page_and_time_it ()
void game_simulation_frame ()
void game_maybe_do_dead_popup (float frametime)
int game_actually_playing ()
void game_render_hud (camid cid)
void game_shade_frame (float frametime)
void bars_do_frame (float frametime)
void game_render_post_frame ()
void game_stop_time ()
void game_start_time ()
void lock_time_compression (bool is_locked)
void change_time_compression (float multiplier)
void set_time_compression (float multiplier, float change_time)
void game_set_frametime (int state)
fix game_get_overall_frametime ()
void multi_maybe_do_frame ()
void game_flush ()
void game_do_dc_networking ()
int game_check_key ()
int game_poll ()
void os_close ()
void game_process_event (int current_state, int event)
void game_leave_state (int old_state, int new_state)
void game_enter_state (int old_state, int new_state)
void game_do_state_common (int state, int no_networking)
void game_do_state (int state)
void game_spew_pof_info_sub (int model_num, polymodel *pm, int sm, CFILE *out, int *out_total, int *out_destroyed_total)
void game_spew_pof_info ()
 DCF (pofspew,"Spews POF info without shutting down the game")
int game_main (char *cmdline)
int main (int argc, char *argv[])
void game_stop_looped_sounds ()
void game_render_mouse (float frametime)
void game_add_event_debug_index (int n, int indent)
void game_add_event_debug_sexp (int n, int indent)
void Time_model (int modelnum)
void Do_model_timings_test ()
void game_feature_disabled_popup ()
void game_format_time (fix m_time, char *time_str)
void get_version_string (char *str, int max_size)
void get_version_string_short (char *str)
uint game_get_cd_used_space (char *path)
int find_freespace_cd (char *volume_name)
int set_cdrom_path (int drive_num)
int game_cd_changed ()
int game_do_cd_check (char *volume_name)
int game_do_cd_check_specific (char *volume_name, int cdnum)
 DCF (shipspew,"display the checksum for the current ships.tbl")
 DCF (wepspew,"display the checksum for the current weapons.tbl")
int game_hacked_data ()
bool game_using_low_mem ()
void game_pause ()
void game_unpause ()


int Om_tracker_flag
bool frame_rate_display
bool Env_cubemap_drawn = false
int Game_no_clear = 0
int Game_skill_level = DEFAULT_SKILL_LEVEL
float Warpout_time = 0.0f
int Warpout_forced = 0
int Warpout_sound = -1
int Use_joy_mouse = 0
int Use_palette_flash = 1
int Use_fullscreen_at_startup = 0
int Show_area_effect = 0
objectLast_view_target = NULL
int dogfight_blown = 0
int frame_int = -1
float frametimes [FRAME_FILTER]
float frametotal = 0.0f
float flRealframetime
float flFrametime
fix FrametimeOverall = 0
int Show_framerate = 1
int Show_mem = 1
int Framerate_cap = 120
int Networking_disabled = 0
int Show_cpu = 0
int Show_target_debug_info = 0
int Show_target_weapons = 0
int Game_font = -1
int Debug_octant = -1
fix Game_time_compression = F1_0
fix Desired_time_compression = Game_time_compression
fix Time_compression_change_rate = 0
bool Time_compression_locked = false
uint Weapon_tbl_checksum = 0
uint Ships_tbl_checksum = 0
int Game_ships_tbl_valid = 0
int Game_weapons_tbl_valid = 0
int Test_begin = 0
int Player_attacking_enabled
int Show_net_stats
int Pre_player_entry
int Fred_running = 0
char Fred_alt_names [MAX_SHIPS][NAME_LENGTH+1]
char Fred_callsigns [MAX_SHIPS][NAME_LENGTH+1]
char Game_current_mission_filename [MAX_FILENAME_LEN]
int game_single_step = 0
int last_single_step =0
int game_zbuffer = 1
int Debug_dump_frames = 0
int Debug_dump_trigger = 0
int Debug_dump_frame_count
int Debug_dump_frame_num = 0
int Player_died_popup_wait = -1
int Multi_ping_timestamp = -1
int Default_env_map = -1
int Game_builtin_mission_count = 92
fs_builtin_mission Game_builtin_mission_list [MAX_BUILTIN_MISSIONS]
char Game_CDROM_dir [MAX_PATH_LEN]
uint FreeSpace_total_ram = 0
float Game_flash_red = 0.0f
float Game_flash_green = 0.0f
float Game_flash_blue = 0.0f
float Sun_spot = 0.0f
big_expl_flash Big_expl_flash = {0.0f, 0.0f, 0}
int Game_shudder_time = -1
int Game_shudder_total = 0
float Game_shudder_intensity = 0.0f
sound_env Game_sound_env
sound_env Game_default_sound_env = { EAX_ENVIRONMENT_BATHROOM, 0.2f, 0.2f, 1.0f }
int Game_sound_env_update_timestamp
float Gf_critical = -1.0f
float Gf_critical_time = 0.0f
float Framerate = 0.0f
int Sun_drew = 0
float sn_glare_scale = 1.7f
float Supernova_last_glare = 0.0f
bool ls_on
bool ls_force_off
uint load_gl_init
uint load_mission_load
uint load_post_level_init
int Game_loading_callback_inited = 0
int Game_loading_background = -1
generic_anim Game_loading_ani
char Processing_filename [MAX_PATH_LEN]
shader busy_shader
int Interface_framerate = 0
int Training_message_method
int Use_low_mem = 0
int Framerate_delay = 0
float FreeSpace_gamma = 1.0f
char transfer_text [128]
float Start_time = 0.0f
float Timing_total = 0.0f
float Timing_render2 = 0.0f
float Timing_render3 = 0.0f
float Timing_flip = 0.0f
float Timing_clear = 0.0f
uint Mem_starttime_phys
uint Mem_starttime_pagefile
uint Mem_starttime_virtual
debug_command dc_s ("s","shortcut for single_step", dcf_single_step)
debug_command dc_p ("p","shortcut for physics_pause", dcf_physics_pause)
debug_command dc_r ("r","shortcut for ai_rendering", dcf_ai_rendering)
debug_command dc_f ("f","shortcut for ai_firing", dcf_ai_firing)
debug_command dc_a ("a","shortcut for ai_pause", dcf_ai_pause)
int Player_died_time
int View_percent = 100
int Tool_enabled
int tst = 0
int tst_time = 0
int tst_big = 0
vec3d tst_pos
int tst_bitmap = -1
float tst_x
float tst_y
float tst_offset
float tst_offset_total
int tst_mode
int tst_stamp
int Show_viewing_from_self = 0
float Game_hit_x = 0.0f
float Game_hit_y = 0.0f
int Wash_on
float sn_shudder
vec3d Dead_player_last_vel = { { { 1.0f, 1.0f, 1.0f } } }
float View_zoom
int Scripting_didnt_draw_hud = 1
vec3d Dead_camera_pos
int Game_subspace_effect = 0
SCP_vector< object * > effect_ships
SCP_vector< object * > transparent_objects
int Player_dead_state
fix Last_time = 0
fix Last_delta_time = 0
int saved_timestamp_ticker = -1
int Joymouse_button_status = 0
int Main_hall_netgame_started = 0
int Game_do_state_should_skip = 0
int Event_debug_index [EVENT_DEBUG_MAX]
int ED_count
FILE * Time_fp
FILE * Texture_fp
int Tmap_npixels =0
int Tmap_num_too_big = 0
int Num_models_needing_splitting = 0
int Time_models = 0
int Last_cd_label_found = 0
char Last_cd_label [256]
int Game_ships_tbl_checksums [NUM_SHIPS_TBL_CHECKSUMS]
int Game_weapons_tbl_checksums [NUM_WEAPONS_TBL_CHECKSUMS]

Macro Definition Documentation

#define BAIL ( )    do { int _idx; for(_idx=0; _idx<num_files; _idx++){ if(pof_list[_idx] != NULL){vm_free(pof_list[_idx]); pof_list[_idx] = NULL;}} return;} while(0);

Definition at line 6846 of file freespace.cpp.

#define CD_SIZE_72_MINUTE_MAX   (697000000)

Definition at line 8063 of file freespace.cpp.

#define COUNT_ESTIMATE   425

Definition at line 1105 of file freespace.cpp.

#define DEBUG_GET_TIME (   x)    { x = timer_get_fixed_seconds(); }

Definition at line 4322 of file freespace.cpp.


Definition at line 222 of file freespace.cpp.

#define DIMINISH_RATE   0.75f

Definition at line 665 of file freespace.cpp.


Definition at line 332 of file freespace.cpp.

#define EVENT_DEBUG_EVENT   0x8000

Definition at line 7595 of file freespace.cpp.

#define EVENT_DEBUG_MAX   5000

Definition at line 7594 of file freespace.cpp.

#define EXE_FNAME   ("fs2.exe")

Definition at line 225 of file freespace.cpp.


Definition at line 314 of file freespace.cpp.

#define EXPIRE_BAD_TIME   2

Definition at line 315 of file freespace.cpp.

#define FF_SCALE   10000

Definition at line 3099 of file freespace.cpp.

#define FRAME_FILTER   16

Definition at line 220 of file freespace.cpp.

#define LAUNCHER_FNAME   ("Launcher.exe")

Definition at line 227 of file freespace.cpp.

#define MAX_FRAMETIME   (F1_0/4)

Definition at line 4545 of file freespace.cpp.

#define MIN_DIST_TO_DEAD_CAMERA   50.0f

Definition at line 2982 of file freespace.cpp.

#define NUM_FRAMES_TEST   300

Definition at line 2857 of file freespace.cpp.

#define NUM_MIXED_SOUNDS   16

Definition at line 2858 of file freespace.cpp.


Definition at line 8484 of file freespace.cpp.


Definition at line 8546 of file freespace.cpp.


Definition at line 336 of file freespace.cpp.

#define SUN_DIMINISH_RATE   6.00f

Definition at line 666 of file freespace.cpp.

#define TIME_DOWN   2500
#define TIME_UP   1500

Typedef Documentation

typedef struct animating_obj animating_obj

Function Documentation

void ai_debug_render_stuff ( )

Definition at line 11081 of file aicode.cpp.

void apply_view_shake ( matrix eye_orient)

Definition at line 3102 of file freespace.cpp.

void bars_do_frame ( float  frametime)

Definition at line 4240 of file freespace.cpp.

void big_explosion_flash ( float  flash)

Adds a flash for Big Ship explosions

flashflash intensity. Range capped from 0 to 1.

Definition at line 655 of file freespace.cpp.

void change_time_compression ( float  multiplier)

Definition at line 4639 of file freespace.cpp.

camid chase_get_camera ( )

Definition at line 3334 of file freespace.cpp.

void clip_frame_view ( )

Definition at line 4290 of file freespace.cpp.

DCF ( warp  ,
"Tests warpin effect"   

Definition at line 1505 of file freespace.cpp.

DCF ( show_mem  ,
"Toggles showing mem usage  

Definition at line 1543 of file freespace.cpp.

DCF ( show_cpu  ,
"Toggles showing cpu usage  

Definition at line 1574 of file freespace.cpp.

DCF ( use_joy_mouse  ,
"Makes joystick move mouse cursor"   

Definition at line 1607 of file freespace.cpp.

DCF ( low_mem  ,
"Uses low memory settings regardless of RAM"   

Definition at line 1637 of file freespace.cpp.

DCF ( force_fullscreen  ,
"Forces game to startup in fullscreen mode  

Definition at line 1666 of file freespace.cpp.

DCF ( gamma  ,
"Sets and saves Gamma Factor"   

Definition at line 1696 of file freespace.cpp.

DCF ( ai_pause  ,
"Pauses ai"   

Definition at line 2455 of file freespace.cpp.

DCF ( single_step  ,
"Enables single step mode."   

Definition at line 2482 of file freespace.cpp.

DCF ( view  ,
"Sets the percent of the 3d view to render."   

Definition at line 2549 of file freespace.cpp.

DCF ( dcf_fov  ,
"Change the field of view of the main camera  

Definition at line 2896 of file freespace.cpp.

DCF ( framerate_cap  ,
"Sets the framerate cap  

Definition at line 2941 of file freespace.cpp.

DCF ( pofspew  ,
"Spews POF info without shutting down the game"   

Definition at line 6935 of file freespace.cpp.

DCF ( shipspew  ,
"display the checksum for the current ships.tbl"   

Definition at line 8528 of file freespace.cpp.

DCF ( wepspew  ,
"display the checksum for the current weapons.tbl"   

Definition at line 8590 of file freespace.cpp.

DCF_BOOL ( palette_flash  ,
int detect_lang ( )

Definition at line 8434 of file freespace.cpp.

void Do_model_timings_test ( )

Definition at line 7877 of file freespace.cpp.

void do_timing_test ( float  frame_time)

Definition at line 2859 of file freespace.cpp.

int find_freespace_cd ( char *  volume_name)

Definition at line 8118 of file freespace.cpp.

void freespace_mission_load_stuff ( )

Function which gets called before actually entering the mission.

Definition at line 1306 of file freespace.cpp.

void freespace_stop_mission ( )

Called when a mission is over – does server specific stuff.

Definition at line 1069 of file freespace.cpp.

void fs2netd_spew_table_checksums ( char *  outfile)

Definition at line 1662 of file fs2netd_client.cpp.

int game_actually_playing ( )

Definition at line 4156 of file freespace.cpp.

void game_add_event_debug_index ( int  n,
int  indent 

Definition at line 7600 of file freespace.cpp.

void game_add_event_debug_sexp ( int  n,
int  indent 

Definition at line 7606 of file freespace.cpp.

void game_assign_sound_environment ( )

Assign the sound environment for the game, based on the current mission

Definition at line 1290 of file freespace.cpp.

int game_cd_changed ( void  )

Definition at line 8269 of file freespace.cpp.

int game_check_key ( )

Definition at line 4854 of file freespace.cpp.

int game_do_cd_check ( char *  volume_name)

Definition at line 8326 of file freespace.cpp.

int game_do_cd_check_specific ( char *  volume_name,
int  cdnum 

Definition at line 8377 of file freespace.cpp.

void game_do_dc_networking ( )

Definition at line 4846 of file freespace.cpp.

void game_do_frame ( )

Definition at line 4791 of file freespace.cpp.

void game_do_networking ( )

Called at frame interval to process networking stuff

Definition at line 1078 of file freespace.cpp.

void game_do_state ( int  state)

Definition at line 6446 of file freespace.cpp.

void game_do_state_common ( int  state,
int  no_networking 

Definition at line 6409 of file freespace.cpp.

void game_do_training_checks ( )

Definition at line 7533 of file freespace.cpp.

void game_enter_state ( int  old_state,
int  new_state 

Definition at line 5891 of file freespace.cpp.

void game_environment_map_gen ( )

Definition at line 3302 of file freespace.cpp.

void game_event_debug_init ( )

Definition at line 7624 of file freespace.cpp.

void game_feature_disabled_popup ( )

Definition at line 7927 of file freespace.cpp.

fs_builtin_mission* game_find_builtin_mission ( char *  filename)

Definition at line 528 of file freespace.cpp.

void game_flash ( float  r,
float  g,
float  b 

Adds a flash effect.

These can be positive or negative. The range will get capped at around -1 to 1, so stick with a range like that.

rred colour value
ggreen colour value
bblue colour value

Definition at line 625 of file freespace.cpp.

void game_flash_diminish ( float  frametime)

Call once a frame to diminish the flash effect to 0.

frametimePeriod over which to dimish at DIMINISH_RATE

Definition at line 795 of file freespace.cpp.

void game_flash_reset ( )

Definition at line 549 of file freespace.cpp.

void game_flip_page_and_time_it ( )

Definition at line 3889 of file freespace.cpp.

void game_flush ( )

Definition at line 4832 of file freespace.cpp.

void game_format_time ( fix  m_time,
char *  time_str 

Definition at line 7933 of file freespace.cpp.

void game_frame ( bool  paused = false)

Definition at line 4327 of file freespace.cpp.

void game_framerate_check ( )

Definition at line 577 of file freespace.cpp.

void game_framerate_check_init ( )

Definition at line 563 of file freespace.cpp.

uint game_get_cd_used_space ( char *  path)

Definition at line 8065 of file freespace.cpp.

int game_get_default_skill_level ( )

Definition at line 543 of file freespace.cpp.

void game_get_framerate ( )

Definition at line 2102 of file freespace.cpp.

fix game_get_overall_frametime ( )

Definition at line 4777 of file freespace.cpp.

int game_hacked_data ( )

Definition at line 8607 of file freespace.cpp.

void game_increase_skill_level ( )

Definition at line 2536 of file freespace.cpp.

void game_init ( )

Game initialisation

Definition at line 1732 of file freespace.cpp.

void game_leave_state ( int  old_state,
int  new_state 

Definition at line 5473 of file freespace.cpp.

void game_level_close ( )

Definition at line 876 of file freespace.cpp.

void game_level_init ( )

Intializes game stuff.

0 on failure, 1 on success

Definition at line 950 of file freespace.cpp.

void game_loading_callback ( int  count)

This gets called 10x per second and count is the number of times game_busy() has been called since the current callback function was set.

Definition at line 1131 of file freespace.cpp.

void game_loading_callback_close ( )

Definition at line 1249 of file freespace.cpp.

void game_loading_callback_init ( )

Definition at line 1228 of file freespace.cpp.

int game_main ( char *  cmdline)

Definition at line 6943 of file freespace.cpp.

void game_maybe_do_dead_popup ( float  frametime)

Definition at line 4086 of file freespace.cpp.

void game_maybe_draw_mouse ( float  frametime)

Definition at line 7504 of file freespace.cpp.

void game_maybe_update_sound_environment ( )

Update the sound environment (ie change EAX settings based on proximity to large ships)

Definition at line 1282 of file freespace.cpp.

void game_pause ( )

Definition at line 8765 of file freespace.cpp.

int game_poll ( )

Definition at line 4871 of file freespace.cpp.

void game_post_level_init ( )

Called after mission is loaded.

Because player isn't created until after mission loads, some things must get initted after the level loads

Definition at line 1363 of file freespace.cpp.

void game_process_event ( int  current_state,
int  event 

Definition at line 5087 of file freespace.cpp.

void game_render_frame ( camid  cid)

Definition at line 3673 of file freespace.cpp.

camid game_render_frame_setup ( )

Definition at line 3348 of file freespace.cpp.

void game_render_hud ( camid  cid)

Definition at line 4167 of file freespace.cpp.

void game_render_mouse ( float  frametime)

Definition at line 7475 of file freespace.cpp.

void game_render_post_frame ( )

Definition at line 4308 of file freespace.cpp.

void game_reset_shade_frame ( )

Definition at line 4188 of file freespace.cpp.

void game_reset_time ( )

Definition at line 4558 of file freespace.cpp.

void game_reset_view_clip ( )

Set the clip region for the 3d rendering window

Definition at line 2580 of file freespace.cpp.

void game_set_frametime ( int  state)

Definition at line 4660 of file freespace.cpp.

void game_set_view_clip ( float  frametime)

Definition at line 2587 of file freespace.cpp.

void game_shade_frame ( float  frametime)

Definition at line 4194 of file freespace.cpp.

void game_show_event_debug ( float  frametime)

Definition at line 7635 of file freespace.cpp.

void game_show_eye_pos ( camid  cid)

Definition at line 2368 of file freespace.cpp.

void game_show_framerate ( )

Show FPS within game

Definition at line 2130 of file freespace.cpp.

void game_show_standalone_framerate ( )

Definition at line 2399 of file freespace.cpp.

void game_show_time_left ( )

Show the time remaining in a mission. Used only when the end-mission sexpression is used

mission_end_time is a global from missionparse.cpp that contains the mission time at which the mission should end (in fixed seconds). There is code in missionparse.cpp which actually handles checking how much time is left.

Definition at line 2433 of file freespace.cpp.

void game_shudder_apply ( int  time,
float  intensity 

Definition at line 3078 of file freespace.cpp.

void game_shutdown ( void  )

Definition at line 7275 of file freespace.cpp.

void game_simulation_frame ( )

Definition at line 3901 of file freespace.cpp.

void game_spew_pof_info ( )

Definition at line 6847 of file freespace.cpp.

void game_spew_pof_info_sub ( int  model_num,
polymodel pm,
int  sm,
CFILE out,
int out_total,
int out_destroyed_total 

Definition at line 6819 of file freespace.cpp.

int game_start_mission ( )

Tells the server to load the mission and initialize structures

Definition at line 1416 of file freespace.cpp.

void game_start_subspace_ambient_sound ( )

Definition at line 8026 of file freespace.cpp.

void game_start_time ( )

Definition at line 4601 of file freespace.cpp.

void game_stop_looped_sounds ( )

Definition at line 7375 of file freespace.cpp.

void game_stop_subspace_ambient_sound ( )

Definition at line 8037 of file freespace.cpp.

void game_stop_time ( )

Definition at line 4570 of file freespace.cpp.

void game_sunspot_process ( float  frametime)

Definition at line 680 of file freespace.cpp.

void game_title_screen_close ( )

Definition at line 8740 of file freespace.cpp.

void game_title_screen_display ( )

Definition at line 8639 of file freespace.cpp.

void game_training_pause_do ( )

Definition at line 2523 of file freespace.cpp.

void game_tst_frame ( )

Definition at line 2695 of file freespace.cpp.

void game_tst_frame_pre ( )

Definition at line 2658 of file freespace.cpp.

void game_tst_mark ( object objp,
ship shipp 

Definition at line 2805 of file freespace.cpp.

void game_unpause ( )

Definition at line 8832 of file freespace.cpp.

void game_update_missiontime ( )

Definition at line 4783 of file freespace.cpp.

bool game_using_low_mem ( )

Definition at line 8754 of file freespace.cpp.

void game_whack_apply ( float  x,
float  y 

Definition at line 3065 of file freespace.cpp.

void game_whack_reset ( )

Definition at line 3058 of file freespace.cpp.

float get_shake ( float  intensity,
int  decay_time,
int  max_decay_time 

Definition at line 3085 of file freespace.cpp.

void get_version_string ( char *  str,
int  max_size 

Definition at line 7977 of file freespace.cpp.

void get_version_string_short ( char *  str)

Definition at line 8011 of file freespace.cpp.

void init_animating_pointer ( )

Definition at line 7414 of file freespace.cpp.

int init_cdrom ( )

Definition at line 8254 of file freespace.cpp.

void load_animating_pointer ( char *  filename)

Definition at line 7430 of file freespace.cpp.

void lock_time_compression ( bool  is_locked)

Definition at line 4634 of file freespace.cpp.

int main ( int  argc,
char *  argv[] 

Definition at line 7169 of file freespace.cpp.

void model_page_in_start ( )

Definition at line 373 of file modelread.cpp.

void multi_maybe_do_frame ( )

Definition at line 4822 of file freespace.cpp.

void multi_spew_pxo_checksums ( int  max_files,
const char *  outfile 
void os_close ( )

Definition at line 5080 of file freespace.cpp.

void player_repair_frame ( float  frametime)

Definition at line 2833 of file freespace.cpp.

void render_environment ( int  i,
vec3d eye_pos,
matrix new_orient,
float  new_zoom 

Definition at line 3169 of file freespace.cpp.

void render_shields ( )

Render all the shield hits in the global array Shield_hits[]

This is a temporary function. Shield hit rendering will at least have to occur with the ship, perhaps even internal to the ship.

Definition at line 486 of file shield.cpp.

void say_view_target ( )

Definition at line 2985 of file freespace.cpp.

int set_cdrom_path ( int  drive_num)

Definition at line 8234 of file freespace.cpp.

void set_time_compression ( float  multiplier,
float  change_time 

Definition at line 4647 of file freespace.cpp.

void setup_environment_mapping ( camid  cid)

Definition at line 3190 of file freespace.cpp.

void show_debug_stuff ( )

Definition at line 2630 of file freespace.cpp.

void ssm_init ( )

Definition at line 195 of file hudartillery.cpp.

void ssm_level_init ( )

Definition at line 246 of file hudartillery.cpp.

void ssm_process ( )

Definition at line 348 of file hudartillery.cpp.

bool stars_sun_has_glare ( int  index)

Definition at line 2448 of file starfield.cpp.

void Time_model ( int  modelnum)

Definition at line 7751 of file freespace.cpp.

void unload_animating_pointer ( )

Definition at line 7452 of file freespace.cpp.

void verify_ships_tbl ( )

Definition at line 8491 of file freespace.cpp.

void verify_weapons_tbl ( )

Definition at line 8553 of file freespace.cpp.

Variable Documentation

big_expl_flash Big_expl_flash = {0.0f, 0.0f, 0}

Definition at line 515 of file freespace.cpp.

shader busy_shader

Definition at line 1123 of file freespace.cpp.

debug_command dc_a("a","shortcut for ai_pause", dcf_ai_pause)
debug_command dc_f("f","shortcut for ai_firing", dcf_ai_firing)
debug_command dc_p("p","shortcut for physics_pause", dcf_physics_pause)
debug_command dc_r("r","shortcut for ai_rendering", dcf_ai_rendering)
debug_command dc_s("s","shortcut for single_step", dcf_single_step)
vec3d Dead_camera_pos

Definition at line 67 of file shiphit.cpp.

vec3d Dead_player_last_vel = { { { 1.0f, 1.0f, 1.0f } } }

Definition at line 3166 of file freespace.cpp.

int Debug_dump_frame_count

Definition at line 330 of file freespace.cpp.

int Debug_dump_frame_num = 0

Definition at line 331 of file freespace.cpp.

int Debug_dump_frames = 0

Definition at line 328 of file freespace.cpp.

int Debug_dump_trigger = 0

Definition at line 329 of file freespace.cpp.

int Debug_octant = -1

Definition at line 275 of file freespace.cpp.

int Default_env_map = -1

Definition at line 341 of file freespace.cpp.

fix Desired_time_compression = Game_time_compression

Definition at line 278 of file freespace.cpp.

int dogfight_blown = 0

Definition at line 242 of file freespace.cpp.

int ED_count

Definition at line 7598 of file freespace.cpp.

SCP_vector<object*> effect_ships

Definition at line 107 of file objectsort.cpp.

bool Env_cubemap_drawn = false

Definition at line 202 of file freespace.cpp.

int Event_debug_index[EVENT_DEBUG_MAX]

Definition at line 7597 of file freespace.cpp.

float flFrametime

Definition at line 248 of file freespace.cpp.

float flRealframetime

Definition at line 247 of file freespace.cpp.

int frame_int = -1

Definition at line 244 of file freespace.cpp.

bool frame_rate_display
float Framerate = 0.0f

Definition at line 2081 of file freespace.cpp.

int Framerate_cap = 120

Definition at line 259 of file freespace.cpp.

int Framerate_delay = 0

Definition at line 1692 of file freespace.cpp.

fix FrametimeOverall = 0

Definition at line 249 of file freespace.cpp.

float frametimes[FRAME_FILTER]

Definition at line 245 of file freespace.cpp.

float frametotal = 0.0f

Definition at line 246 of file freespace.cpp.

char Fred_alt_names[MAX_SHIPS][NAME_LENGTH+1]

Definition at line 304 of file freespace.cpp.

char Fred_callsigns[MAX_SHIPS][NAME_LENGTH+1]

Definition at line 305 of file freespace.cpp.

int Fred_running = 0

Definition at line 301 of file freespace.cpp.

float FreeSpace_gamma = 1.0f

Definition at line 1694 of file freespace.cpp.

uint FreeSpace_total_ram = 0

Definition at line 508 of file freespace.cpp.

int Game_builtin_mission_count = 92

Definition at line 344 of file freespace.cpp.

fs_builtin_mission Game_builtin_mission_list[MAX_BUILTIN_MISSIONS]

Definition at line 345 of file freespace.cpp.

char Game_CDROM_dir[MAX_PATH_LEN]

Definition at line 504 of file freespace.cpp.

char Game_current_mission_filename[MAX_FILENAME_LEN]

Definition at line 307 of file freespace.cpp.

sound_env Game_default_sound_env = { EAX_ENVIRONMENT_BATHROOM, 0.2f, 0.2f, 1.0f }

Definition at line 524 of file freespace.cpp.

int Game_do_state_should_skip = 0

Definition at line 6445 of file freespace.cpp.

float Game_flash_blue = 0.0f

Definition at line 513 of file freespace.cpp.

float Game_flash_green = 0.0f

Definition at line 512 of file freespace.cpp.

float Game_flash_red = 0.0f

Definition at line 511 of file freespace.cpp.

int Game_font = -1

Definition at line 270 of file freespace.cpp.

float Game_hit_x = 0.0f

Definition at line 3054 of file freespace.cpp.

float Game_hit_y = 0.0f

Definition at line 3055 of file freespace.cpp.

generic_anim Game_loading_ani

Definition at line 1109 of file freespace.cpp.

int Game_loading_background = -1

Definition at line 1108 of file freespace.cpp.

int Game_loading_callback_inited = 0

Definition at line 1107 of file freespace.cpp.

int Game_no_clear = 0

Definition at line 212 of file freespace.cpp.

int Game_ships_tbl_checksums[NUM_SHIPS_TBL_CHECKSUMS]
Initial value:
= {

Definition at line 8486 of file freespace.cpp.

int Game_ships_tbl_valid = 0

Definition at line 290 of file freespace.cpp.

float Game_shudder_intensity = 0.0f

Definition at line 520 of file freespace.cpp.

int Game_shudder_time = -1

Definition at line 518 of file freespace.cpp.

int Game_shudder_total = 0

Definition at line 519 of file freespace.cpp.

int game_single_step = 0

Definition at line 308 of file freespace.cpp.

int Game_skill_level = DEFAULT_SKILL_LEVEL

Definition at line 223 of file freespace.cpp.

sound_env Game_sound_env

Definition at line 523 of file freespace.cpp.

int Game_sound_env_update_timestamp

Definition at line 525 of file freespace.cpp.

int Game_subspace_effect = 0

Definition at line 3665 of file freespace.cpp.

fix Game_time_compression = F1_0

Definition at line 277 of file freespace.cpp.

int Game_weapons_tbl_checksums[NUM_WEAPONS_TBL_CHECKSUMS]
Initial value:
= {

Definition at line 8548 of file freespace.cpp.

int Game_weapons_tbl_valid = 0

Definition at line 293 of file freespace.cpp.

int game_zbuffer = 1

Definition at line 311 of file freespace.cpp.

float Gf_critical = -1.0f

Definition at line 560 of file freespace.cpp.

float Gf_critical_time = 0.0f

Definition at line 561 of file freespace.cpp.

int Interface_framerate = 0

Definition at line 1484 of file freespace.cpp.

int Joymouse_button_status = 0

Definition at line 4829 of file freespace.cpp.

char Last_cd_label[256]

Definition at line 8267 of file freespace.cpp.

int Last_cd_label_found = 0

Definition at line 8266 of file freespace.cpp.

fix Last_delta_time = 0

Definition at line 4550 of file freespace.cpp.

int last_single_step =0

Definition at line 309 of file freespace.cpp.

fix Last_time = 0

Definition at line 4549 of file freespace.cpp.

object* Last_view_target = NULL

Definition at line 240 of file freespace.cpp.

uint load_gl_init

Definition at line 941 of file freespace.cpp.

uint load_mission_load

Definition at line 942 of file freespace.cpp.

uint load_post_level_init

Definition at line 943 of file freespace.cpp.

bool ls_force_off

Definition at line 31 of file gropenglpostprocessing.cpp.

bool ls_on

Definition at line 30 of file gropenglpostprocessing.cpp.

int Main_hall_netgame_started = 0

Definition at line 5882 of file freespace.cpp.

uint Mem_starttime_pagefile

Definition at line 2099 of file freespace.cpp.

uint Mem_starttime_phys

Definition at line 2098 of file freespace.cpp.

uint Mem_starttime_virtual

Definition at line 2100 of file freespace.cpp.

int Multi_ping_timestamp = -1

Definition at line 339 of file freespace.cpp.

int Networking_disabled = 0

Definition at line 262 of file freespace.cpp.

int Num_models_needing_splitting = 0

Definition at line 7749 of file freespace.cpp.

int Om_tracker_flag

Definition at line 247 of file optionsmenumulti.cpp.

int Player_attacking_enabled

Definition at line 1638 of file aicode.cpp.

int Player_dead_state
int Player_died_popup_wait = -1

Definition at line 337 of file freespace.cpp.

int Player_died_time

Definition at line 2544 of file freespace.cpp.

int Pre_player_entry

Definition at line 299 of file freespace.cpp.

char Processing_filename[MAX_PATH_LEN]

Definition at line 66 of file systemvars.cpp.

int saved_timestamp_ticker = -1

Definition at line 4556 of file freespace.cpp.

int Scripting_didnt_draw_hud = 1

Definition at line 3332 of file freespace.cpp.

uint Ships_tbl_checksum = 0

Definition at line 287 of file freespace.cpp.

int Show_area_effect = 0

Definition at line 239 of file freespace.cpp.

int Show_cpu = 0

Definition at line 267 of file freespace.cpp.

int Show_framerate = 1

Definition at line 252 of file freespace.cpp.

int Show_mem = 1

Definition at line 253 of file freespace.cpp.

int Show_net_stats

Definition at line 297 of file freespace.cpp.

int Show_target_debug_info = 0

Definition at line 268 of file freespace.cpp.

int Show_target_weapons = 0

Definition at line 269 of file freespace.cpp.

int Show_viewing_from_self = 0

Definition at line 2983 of file freespace.cpp.

float sn_glare_scale = 1.7f

Definition at line 670 of file freespace.cpp.

float sn_shudder

Definition at line 181 of file supernova.cpp.

float Start_time = 0.0f

Definition at line 2079 of file freespace.cpp.

int Sun_drew = 0

Definition at line 668 of file freespace.cpp.

float Sun_spot = 0.0f

Definition at line 514 of file freespace.cpp.

float Supernova_last_glare = 0.0f

Definition at line 676 of file freespace.cpp.

int Test_begin = 0

Definition at line 295 of file freespace.cpp.

FILE* Texture_fp

Definition at line 7745 of file freespace.cpp.

fix Time_compression_change_rate = 0

Definition at line 279 of file freespace.cpp.

bool Time_compression_locked = false

Definition at line 280 of file freespace.cpp.

FILE* Time_fp

Definition at line 7744 of file freespace.cpp.

int Time_models = 0

Definition at line 7874 of file freespace.cpp.

float Timing_clear = 0.0f

Definition at line 2088 of file freespace.cpp.

float Timing_flip = 0.0f

Definition at line 2087 of file freespace.cpp.

float Timing_render2 = 0.0f

Definition at line 2085 of file freespace.cpp.

float Timing_render3 = 0.0f

Definition at line 2086 of file freespace.cpp.

float Timing_total = 0.0f

Definition at line 2084 of file freespace.cpp.

int Tmap_npixels =0

Definition at line 7747 of file freespace.cpp.

int Tmap_num_too_big = 0

Definition at line 7748 of file freespace.cpp.

int Tool_enabled

Definition at line 212 of file keycontrol.cpp.

int Training_message_method

Definition at line 76 of file missiontraining.cpp.

char transfer_text[128]

Definition at line 2077 of file freespace.cpp.

SCP_vector<object*> transparent_objects

Definition at line 108 of file objectsort.cpp.

int tst = 0

Definition at line 2649 of file freespace.cpp.

int tst_big = 0

Definition at line 2651 of file freespace.cpp.

int tst_bitmap = -1

Definition at line 2653 of file freespace.cpp.

int tst_mode

Definition at line 2656 of file freespace.cpp.

float tst_offset

Definition at line 2655 of file freespace.cpp.

float tst_offset_total

Definition at line 2655 of file freespace.cpp.

vec3d tst_pos

Definition at line 2652 of file freespace.cpp.

int tst_stamp

Definition at line 2657 of file freespace.cpp.

int tst_time = 0

Definition at line 2650 of file freespace.cpp.

float tst_x

Definition at line 2654 of file freespace.cpp.

float tst_y

Definition at line 2654 of file freespace.cpp.

int Use_fullscreen_at_startup = 0

Definition at line 237 of file freespace.cpp.

int Use_joy_mouse = 0

Definition at line 234 of file freespace.cpp.

int Use_low_mem = 0

Definition at line 1635 of file freespace.cpp.

int Use_palette_flash = 1

Definition at line 235 of file freespace.cpp.

int View_percent = 100

Definition at line 2546 of file freespace.cpp.

float View_zoom

Definition at line 30 of file 3dsetup.cpp.

int Warpout_forced = 0

Definition at line 232 of file freespace.cpp.

int Warpout_sound = -1

Definition at line 233 of file freespace.cpp.

float Warpout_time = 0.0f

Definition at line 231 of file freespace.cpp.

int Wash_on

Definition at line 2864 of file shipfx.cpp.

uint Weapon_tbl_checksum = 0

Definition at line 286 of file freespace.cpp.