88 size_t getNext(
size_t n,
size_t current);
99 void resize(
size_t size);
107 static bool isNaturalNumberFactor(
size_t factor,
size_t n);
119 Assertion(n >= 1,
"factor_table::getNext() called with " SIZE_T_ARG ", when only natural numbers make sense; get a coder!\n", n);
122 if (n > _lookup.size())
126 for (
size_t i = 0;
i < _lookup[
index].size(); ++
i)
128 if (_lookup[index][
i] == current)
130 if (_lookup[index].
size() ==
i + 1)
138 return _lookup[
index][
i + 1];
143 Assertion(
false,
"For some reason, factor_table::getNext() was unable to locate the current factor. This should never happen; get a coder!\n");
147 void factor_table::resize(
size_t size)
149 size_t oldSize = _lookup.size();
150 _lookup.resize(size);
153 for (
size_t i = oldSize;
i <
size; ++
i)
155 for (
size_t j = 1; j <=
i + 1; ++j)
157 if (isNaturalNumberFactor(j,
i + 1))
159 _lookup[
i].push_back(j);
165 bool factor_table::isNaturalNumberFactor(
size_t factor,
size_t n)
167 return ((
float)n / (
float)factor) == n /
factor;
180 #define MAX_TIME_MULTIPLIER 64
181 #define MAX_TIME_DIVIDER 4
183 #define CHEAT_BUFFER_LEN 17
201 static struct Cheat cheatsTable[] = {
210 #define CHEATS_TABLE_LEN 6
493 if ( si_index >= static_cast<int>(
Ship_info.size()) ){
497 si_index =
static_cast<int>(
Ship_info.size() - 1);
506 if ( sanity >= static_cast<int>(
Ship_info.size()) ){
523 int si_index, species;
541 if ( si_index >= static_cast<int>(
Ship_info.size()) )
544 si_index =
static_cast<int>(
Ship_info.size() - 1);
552 if ( strstr(name,
NOX(
"test")) != NULL )
560 if ( sanity >= static_cast<int>(
Ship_info.size()) )
598 float capacity,
size;
636 new_index = (Num_weapon_types + current_weapon -
i) % Num_weapon_types;
644 return current_weapon;
653 new_index = (current_weapon +
i) % Num_weapon_types;
661 return current_weapon;
685 if(wacky_scheme == 3){
693 Framerate_delay += 10;
694 HUD_printf(
XSTR(
"Framerate delay increased to %i milliseconds per frame.", 4), Framerate_delay);
698 Framerate_delay -= 10;
699 if (Framerate_delay < 0)
702 HUD_printf(
XSTR(
"Framerate delay decreased to %i milliseconds per frame.", 5), Framerate_delay);
724 HUD_printf(
XSTR(
"Countermeasure firing: %s", 6), Countermeasures_enabled ?
XSTR(
"ENABLED", 7) :
XSTR(
"DISABLED", 8));
768 switch (objp->
type) {
790 if(Num_messages_playing){
798 Message_debug_index++;
803 if (
Messages[Message_debug_index].avi_info.index == -1) {
804 HUD_printf(
"No anim set for message \"%s\"; None will play!",
Messages[Message_debug_index].name);
813 if(Num_messages_playing){
821 Message_debug_index--;
826 if (
Messages[Message_debug_index].avi_info.index == -1) {
827 HUD_printf(
"No avi associated with this message; None will play!");
835 HUD_printf(
"Resetting to first mission message");
878 float shield, integrity;
919 if(Debug_octant == 7){
924 nprintf((
"General",
"Debug_octant == %d\n", Debug_octant));
945 if (k & KEY_SHIFTED) {
1098 if ( Test_begin == 1 )
1123 OO_update_index = -1;
1126 if(OO_update_index < 0){
1129 OO_update_index = -1;
1322 mprintf((
"Adding to set %d\n", hotkey_set+1));
1372 for (i=0; i<
count; i++)
1431 int pf_flags, choice;
1443 quit_mission_popup_shown =
true;
1446 choice =
popup(pf_flags, 3,
POPUP_NO,
XSTR(
"&Yes, Quit", 28),
XSTR(
"Yes, &Restart", 29),
XSTR(
"Do you really want to end the mission?", 30));
1460 quit_mission_popup_shown =
false;
1502 CheatBuffer[
i]=CheatBuffer[i+1];
1505 CheatBuffer[CHEAT_BUFFER_LEN - 1] = (char)
key_to_ascii(k);
1510 Cheat cheat = cheatsTable[
i];
1512 if(!strncmp(cheat.
data, CheatBuffer, CHEAT_BUFFER_LEN)){
1513 detectedCheatCode = cheat.
code;
1553 int ship_idx, ship_class;
1568 int objnum =
ship_create(&orient, &pos, ship_class);
1580 sprintf(name,
NOX(
"Volition Bravos %d"), ship_idx);
1759 objp = &
Objects[
p->m_player->objnum];
2078 if(!Perspective_locked)
2091 if (!Perspective_locked) {
2105 if(!Perspective_locked)
2119 if(!Perspective_locked)
2226 if (Ignored_keys[n]) {
2227 if (Ignored_keys[n] > 0) {
2345 int keyHasBeenUsed =
TRUE;
2427 HUD_printf(
XSTR(
"** WARNING ** Collision danger. Subspace drive not activated.", 39));
2430 HUD_printf(
XSTR(
"Engine failure. Cannot engage subspace drive.", 40));
2433 HUD_printf(
XSTR(
"Navigation failure. Cannot engage subspace drive.", 1596));
2436 HUD_printf(
XSTR(
"Cannot engage subspace drive while gliding.", 1597));
2525 keyHasBeenUsed =
FALSE;
2532 if (keyHasBeenUsed) {
2542 keyHasBeenUsed =
TRUE;
2618 keyHasBeenUsed =
FALSE;
2621 if (keyHasBeenUsed) {
2633 keyHasBeenUsed =
TRUE;
2785 HUD_printf(
XSTR(
"** WARNING ** Collision danger. Subspace drive not activated.", 39));
2788 HUD_printf(
XSTR(
"Engine failure. Cannot engage subspace drive.", 40));
2791 HUD_printf(
XSTR(
"Navigation failure. Cannot engage subspace drive.", 1572));
2794 HUD_printf(
XSTR(
"Cannot engage subspace drive while gliding.", 1573));
2816 keyHasBeenUsed =
FALSE;
2819 if (keyHasBeenUsed) {
2826 mprintf((
"Unknown key %d at %s:%u\n", n, __FILE__, __LINE__));
2840 int keyHasBeenUsed =
FALSE;
2842 if( !keyHasBeenUsed ) {
2846 if( !keyHasBeenUsed ) {
2850 if( keyHasBeenUsed ) {
2863 int field_num, bit_num;
2868 bi->
status[field_num] |= (1 << bit_num);
2876 int field_num, bit_num;
2881 bi->
status[field_num] &= ~(1 << bit_num);
2886 return bi->
status[n / 32] & (1 << (n % 32));
void hud_get_target_strength(object *objp, float *shields, float *integrity)
void hud_shield_equalize(object *objp, player *pl)
target your target's target
int Critical_key_set_size
int timestamp(int delta_ms)
#define PLAYER_FLAGS_MATCH_TARGET
#define CYCLE_PRIMARY_PREV
#define MULTIPLAYER_CLIENT
int ship_info_lookup(const char *token)
#define MY_NET_PLAYER_NUM
void obj_set_flags(object *obj, uint new_flags)
void pause_set_type(int type)
model_subsystem * system_info
weapon Weapons[MAX_WEAPONS]
int primary_bank_weapons[MAX_SHIP_PRIMARY_BANKS]
void hud_gauge_popup_start(int gauge_index, int time)
Start a gauge to pop-up.
#define MAX_SHIP_PRIMARY_BANKS
void decrease_recharge_rate(object *obj, SYSTEM_TYPE ship_system)
toggle the squadmate messaging menu
increase energy to engines
void hud_target_prev(int team_mask)
int ship_engine_ok_to_warp(ship *sp)
void multi_msg_key_down(int mode)
#define PCM_WARPOUT_STAGE1
int iff_get_attacker_mask(int attackee_team)
void mission_log_add_entry(int type, char *pname, char *sname, int info_index)
void debug_cycle_player_ship(int delta)
#define PROTECT_TARGET_ITEM
void vm_vec_scale_add(vec3d *dest, const vec3d *src1, const vec3d *src2, float k)
void hud_squadmsg_rearm_shortcut()
float frand_range(float min, float max)
Return a floating point number in the range min..max.
#define MULTI_MSG_FRIENDLY
polymodel * model_get(int model_num)
int obj_team(object *objp)
weapon_info Weapon_info[MAX_WEAPON_TYPES]
void hud_target_subsystem_in_reticle()
TARGET_LAST_TRANMISSION_SENDER.
SCP_vector< game_snd > Snds
VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK.
void button_info_set(button_info *bi, int n)
decrease shield recharge rate
void send_self_destruct_packet()
#define SF2_NO_SUBSPACE_DRIVE
int collide_predict_large_ship(object *objp, float distance)
#define NUM_COMM_ORDER_ITEMS
int next_primary_fire_stamp[MAX_SHIP_PRIMARY_BANKS]
void prevent_spawning_collision(object *new_obj)
void increase_recharge_rate(object *obj, SYSTEM_TYPE ship_system)
int next_secondary_fire_stamp[MAX_SHIP_SECONDARY_BANKS]
int gameseq_get_state(void)
wingman message: attack current target
#define NETINFO_FLAG_OBSERVER
cycle num primaries to fire at once
int button_function_demo_valid(int n)
int event_music_next_soundtrack(int delta)
target the closest ship attacking current target
general failure sound for any event
void event_music_enable()
int Multi_display_netinfo
toggle auto-match target speed
struct vec3d::@225::@227 xyz
#define SIF2_DYN_PRIMARY_LINKING
void transfer_energy_to_weapons(object *obj)
int button_info_query(button_info *bi, int n)
void process_debug_keys(int k)
#define CAPTURE_TARGET_ITEM
void hud_cease_targeting()
#define Assertion(expr, msg,...)
#define END_OF_LIST(head)
void event_music_get_info(char *outbuf)
void set_default_recharge_rates(object *obj)
ship_subsys * targeted_subsys
int hud_sensors_ok(ship *sp, int show_msg)
Check if targeting is possible based on sensors strength.
int ship_find_exited_ship_by_name(char *name)
void multi_obs_zoom_to_target()
#define PLAYER_FLAGS_AUTO_TARGETING
int turret_next_fire_stamp
#define VM_EXTERNAL_CAMERA_LOCKED
void set_fov(float in_fov, float in_fov_time=0.0f, float in_fov_acceleration_time=0.0f, float in_deceleration_time=0.0f)
target closest ship that is attacking player
int ship_navigation_ok_to_warp(ship *sp)
int current_secondary_bank
void debug_change_song(int delta)
void hud_target_hotkey_select(int k)
void HUD_sourced_printf(int source, const char *format,...)
int key_to_ascii(int keycode)
GLenum GLuint GLenum GLsizei const GLchar * buf
ship_subsys_info subsys_info[SUBSYSTEM_MAX]
SCP_vector< message_extra > Message_waves
const char * Radar_range_text(int n)
char callsign[CALLSIGN_LEN+1]
factor_table(size_t size=6)
#define PLAYER_FLAGS_AUTO_MATCH_SPEED
void hud_target_hotkey_clear(int k)
#define HUD_COLOR_ALPHA_USER_MAX
void game_increase_skill_level()
config_item Control_config[]
Stores the keyboard configuration.
void multi_handle_end_mission_request()
int iff_get_attackee_mask(int attacker_team)
transfer shield energy to right
void hud_target_hotkey_add_remove(int k, object *ctarget, int how_to_add)
int Countermeasures_enabled
char CheatBuffer[CHEAT_BUFFER_LEN+1]
stop targeting subsystems on ship
void process_player_ship_keys(int k)
player Players[MAX_PLAYERS]
#define DISARM_TARGET_ITEM
#define IGNORE_TARGET_ITEM
SCP_vector< MMessage > Messages
void button_info_unset(button_info *bi, int n)
#define MAX_SHIP_SECONDARY_BANKS
bool Time_compression_locked
#define ATTACK_TARGET_ITEM
#define MISSION_FLAG_DEACTIVATE_AP
struct matrix::@228::@230 vec
#define NETINFO_FLAG_AM_MASTER
#define HUD_COLOR_ALPHA_USER_MIN
#define ENGAGE_ENEMY_ITEM
#define LOG_SHIP_DISABLED
float ship_max_hull_strength
message targeted ship (if player)
#define HOTKEY_USER_ADDED
void event_music_get_soundtrack_name(char *outbuf)
int Ignored_keys[CCFG_MAX]
wingman message: cover me
int primary_bank_ammo[MAX_SHIP_PRIMARY_BANKS]
void snd_stop_any_sound()
toggle between high and low HUD contrast
void g3_set_view_matrix(const vec3d *view_pos, const matrix *view_matrix, float zoom)
increase shield recharge rate
void message_kill_all(int kill_all)
bool object_get_gliding(object *objp)
int ship_get_sound(object *objp, GameSoundsIndex id)
Returns a ship-specific sound index.
#define NUM_BUTTON_FIELDS
void process_set_of_keys(int key, int count, int *list)
int Non_critical_key_set[]
void hud_target_targets_target()
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
void toggle_player_object()
int Cmdline_autopilot_interruptable
decrease energy to engines
int hud_target_closest(int team_mask, int attacked_objnum, int play_fail_snd, int filter, int get_closest_turret_attacking_player)
Sets the Players[Player_num].current_target to the closest ship to the player that matches the team p...
#define HUD_SOURCE_HIDDEN
wingman message: disarm current target
void hud_target_last_transmit()
int snd_play(game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg)
int secondary_bank_weapons[MAX_SHIP_SECONDARY_BANKS]
void button_info_clear(button_info *bi)
void game_stop_looped_sounds()
#define DISABLE_TARGET_ITEM
float aggregate_current_hits
wingman message: form on my wing
void debug_max_secondary_weapons(object *objp)
target next subsystem on current target
int secondary_bank_ammo_capacity[MAX_SHIP_SECONDARY_BANKS]
cycle number of missiles fired from secondary bank
#define SIF_BALLISTIC_PRIMARIES
void control_used(int id)
void hud_target_uninspected_object(int next_flag)
#define NETPLAYER_IS_DEAD(player)
void hud_target_live_turret(int next_flag, int auto_advance, int only_player_target)
int secondary_bank_ammo[MAX_SHIP_SECONDARY_BANKS]
int primary_bank_ammo_capacity[MAX_SHIP_PRIMARY_BANKS]
void hud_target_next_list(int hostile, int next_flag, int team_mask, int attacked_objnum, int play_fail_snd, int filter, int get_closest_turret_attacking_player)
cycle to previous primary weapon
target ship closest to center of reticle
target the closest friendly ship
void debug_max_primary_weapons(object *objp)
int button_function(int n)
int ship_select_next_primary(object *objp, int direction)
int main_hall_is_vasudan()
object Objects[MAX_OBJECTS]
void shipfx_warpin_start(object *objp)
transfer energy to shield from weapons
cycle to next secondary weapon
int ship_create(matrix *orient, vec3d *pos, int ship_type, char *ship_name)
const char * XSTR(const char *str, int index)
target fail sound (i.e. press targeting key, but nothing happens)
user_click (mouse selects a control)
void hud_target_newest_ship()
#define MULTI_MSG_HOSTILE
int ship_guardian_threshold
target the closest repair ship
int is_support_allowed(object *objp, bool do_simple_check)
void vm_vec_copy_scale(vec3d *dest, const vec3d *src, float s)
int mission_hotkey_get_set_num(int k)
int hud_squadmsg_read_key(int k)
wingman message: engage enemy
#define MAX_TIME_MULTIPLIER
void hud_target_in_reticle_new()
void vm_vec_rand_vec_quick(vec3d *rvec)
void hud_squadmsg_shortcut(int command)
if i'm an observer, zoom to my targeted object
GLuint const GLchar * name
int hud_target_closest_repair_ship(int goal_objnum)
void hud_target_asteroid()
void multi_server_update_player_weapons(net_player *pl, ship *shipp)
void button_info_do(button_info *bi)
#define CYCLE_PRIMARY_NEXT
void game_process_pause_key()
transfer energy to weapons from shield
void supernova_start(int seconds)
int multi_quit_game(int prompt, int notify_code, int err_code, int wsa_error)
wingman message: protect current target
#define MESSAGE_PRIORITY_HIGH
equalize shield energy to all quadrants
void player_match_target_speed(char *no_target_text=NULL, char *match_off_text=NULL, char *match_on_text=NULL)
void hud_target_prev_subobject()
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
void weapons_page_in_cheats()
int ai_issue_rearm_request(object *requester_objp)
int Non_critical_key_set_size
HUD_TARGETBOX_TOGGLE_WIREFRAME.
object * asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroid_subtype)
void transfer_energy_to_shields(object *obj)
#define SF_SECONDARY_DUAL_FIRE
target ships subsystem in reticle
#define MULTI_CONNECTED(np)
bool quit_mission_popup_shown
void hud_target_next(int team_mask)
int last_fired_point[MAX_SHIP_PRIMARY_BANKS]
#define HUD_WEAPONS_GAUGE
class camera * getCamera()
int hud_squadmsg_hotkey_select(int k)
void mission_goal_mark_all_true(int type)
void main_hall_vasudan_funny()
cycle to next primary weapon
void hud_escort_target_next()
long Game_time_compression
int get_prev_weapon_looped(int current_weapon, int subtype)
#define MULTIPLAYER_MASTER
HUD_CONFIG_TYPE HUD_config
void message_send_unique_to_player(char *id, void *data, int m_source, int priority, int group, int delay)
ubyte keyd_pressed[NUM_KEYS]
void hud_augment_shield_quadrant(object *objp, int direction)
SCP_vector< ship_info > Ship_info
void debug_cycle_targeted_ship(int delta)
decrease weapon recharge rate
const char * Skill_level_names(int skill_level, int translate=1)
The total number of defined control actions (or last define + 1)
void ship_apply_local_damage(object *ship_objp, object *other_obj, vec3d *hitpos, float damage, int quadrant, bool create_spark, int submodel_num, vec3d *hit_normal)
void gamesnd_play_error_beep()
#define timestamp_elapsed(stamp)
SCP_vector< species_info > Species_info
MINUS_5_PERCENT_THROTTLE.
void hud_target_toggle_hidden_from_sensors()
vec3d * get_subsystem_world_pos(object *parent_obj, ship_subsys *subsys, vec3d *world_pos)
show the mission goals screen
void button_strip_noncritical_keys(button_info *bi)
#define MISSION_FLAG_2D_MISSION
transfer shield energy to left
int check_control(int id, int key)
target the next friendly ship
wingman message: capture current target
void change_ship_type(int n, int ship_type, int by_sexp)
target the previous closest hostile
TARGET_PREV_UNINSPECTED_CARGO.
wingman message: disable current target
void hud_target_next_subobject()
bool key_is_targeting(int n)
float do_subobj_hit_stuff(object *ship_obj, object *other_obj, vec3d *hitpos, int submodel_num, float damage, bool *hull_should_apply_armor)
void main_hall_campaign_cheat()
void ship_self_destruct(object *objp)
self destruct (multiplayer only)
wingman message: warp out
void hud_target_missile(object *source_obj, int next_flag)
void hud_escort_clear_all(bool clear_flags)
cycle to next radar range
int event_music_return_current_pattern()
void HUD_printf(const char *format,...)
#define SF2_PRIMITIVE_SENSORS
asteroid_field Asteroid_field
#define DISABLE_SUBSYSTEM_ITEM
int ship_name_lookup(const char *name, int inc_players)
int get_next_weapon_looped(int current_weapon, int subtype)
void gamesnd_play_iface(int n)
int ship_select_next_secondary(object *objp)
#define MESSAGE_SOURCE_SPECIAL
void hud_targetbox_switch_wireframe_mode()
size_t getNext(size_t n, size_t current)
void hud_cease_subsystem_targeting(int print_message)
void game_do_end_mission_popup()
wingman message: disable current target
shield quadrant transfer successful
void event_music_change_pattern(int new_pattern)
int button_function_critical(int n, net_player *p=NULL)
increase weapon recharge rate
net_player Net_players[MAX_PLAYERS]
void gameseq_post_event(int event)
TARGET_NEXT_UNINSPECTED_CARGO.
#define PLAYER_FLAGS_MSG_MODE
transfer shield energy to rear
void hud_add_remove_ship_escort(int objnum, int supress_feedback)
int primary_bank_slot_count[MAX_SHIP_PRIMARY_BANKS]
void hud_squadmsg_toggle()
void change_time_compression(float multiplier)
#define LOG_SHIP_DISARMED
target the next hostile target
char ship_name[NAME_LENGTH]
void game_process_cheats(int k)
transfer shield energy to front
void event_music_disable()
void multi_pause_request(int pause)
#define SW_FLAG_BEAM_FREE
void hud_toggle_contrast()