//-------- Begin of function Sys::detect_button --------// // void Sys::detect_button() { //--------- detect menu button -------// if( button_menu.detect() ) { // ##### begin Gilbert 5/11 #######// // game.in_game_menu(); in_game_menu.enter(!remote.is_enable()); // ##### end Gilbert 5/11 #######// return; } //------- detect view mode buttons -----// #define VIEW_MODE_BUTTON_WIDTH 58 #define VIEW_MODE_BUTTON_HEIGHT 16 #define VIEW_MODE_BUTTON_X_SPACE 5 int i, x=6, y=8; static char viewModeArray[] = { MODE_NATION, MODE_TOWN, MODE_ECONOMY, MODE_TRADE, MODE_MILITARY, MODE_TECH, MODE_SPY, MODE_RANK }; for( i=0 ; i<8 ; i++, x+=VIEW_MODE_BUTTON_WIDTH+VIEW_MODE_BUTTON_X_SPACE ) { if( i==4 ) // the second row { x=12; y=29; } if( nation_array.player_recno==0 && i<7 ) // when the player has lost the game, the only report available is ranking report only continue; if( mouse.single_click( x, y, x+VIEW_MODE_BUTTON_WIDTH-1, y+VIEW_MODE_BUTTON_HEIGHT-1 ) ) { int newMode = viewModeArray[i]; if( view_mode == newMode ) // when click on the same mode again, go to the normal mode set_view_mode(MODE_NORMAL); else set_view_mode(newMode); break; } } }
// ---------------------------- init ---------------------------------- void CRacing::Enter (void) { CControl *ctrl = Players.GetCtrl (g_game.player_id); if (param.view_mode < 0 || param.view_mode >= NUM_VIEW_MODES) { param.view_mode = ABOVE; } set_view_mode (ctrl, (TViewMode)param.view_mode); left_turn = right_turn = trick_modifier = false; ctrl->turn_fact = 0.0; ctrl->turn_animation = 0.0; ctrl->is_braking = false; ctrl->is_paddling = false; ctrl->jumping = false; ctrl->jump_charging = false; lastsound = -1; newsound = -1; if (State::manager.PreviousState() != &Paused) ctrl->Init (); g_game.raceaborted = false; SetSoundVolumes (); Music.PlayTheme (g_game.theme_id, MUS_RACING); g_game.finish = false; }
// ---------------------------- init ---------------------------------- void racing_init (void) { CControl *ctrl = Players.GetCtrl (g_game.player_id); if (param.view_mode < 0 || param.view_mode >= NUM_VIEW_MODES) { param.view_mode = ABOVE; } set_view_mode (ctrl, (TViewMode)param.view_mode); left_turn = right_turn = trick_modifier = false; ctrl->turn_fact = 0.0; ctrl->turn_animation = 0.0; ctrl->is_braking = false; ctrl->is_paddling = false; ctrl->jumping = false; ctrl->jump_charging = false; lastsound = -1; newsound = -1; if (g_game.prev_mode != PAUSED) ctrl->Init (); g_game.raceaborted = false; SetSoundVolumes (); Music.PlayTheme (g_game.theme_id, MUS_RACING); g_game.fps = 0; g_game.timesteps = 0; g_game.finish = false; }
bool select_card_by_name(const char *device_name) { int err; bool opened; char *msg; close_hctl(); unplugged = FALSE; opened = FALSE; if (device_name) { err = snd_mixer_attach(mixer, device_name); if (err >= 0) opened = TRUE; else { msg = casprintf(_("Cannot open mixer device '%s'."), device_name); show_alsa_error(msg, err); free(msg); } } if (opened) { mixer_device_name = cstrdup(device_name); err = snd_mixer_load(mixer); if (err < 0) fatal_alsa_error(_("cannot load mixer controls"), err); } display_card_info(); set_view_mode(view_mode); return opened; }
END_KEYBOARD_CB START_KEYBOARD_CB( follow_view_cb ) { if ( release ) return; set_view_mode( plyr, FOLLOW ); setparam_view_mode( FOLLOW ); }
END_KEYBOARD_CB START_KEYBOARD_CB( behind_view_cb ) { if ( release ) return; set_view_mode( plyr, BEHIND ); setparam_view_mode( BEHIND ); }
void close_mixer_device(void) { check_unplugged(); close_hctl(); display_card_info(); set_view_mode(view_mode); }
END_KEYBOARD_CB START_KEYBOARD_CB( above_view_cb ) { if ( release ) return; set_view_mode( plyr, ABOVE ); setparam_view_mode( ABOVE ); }
void RacingKeys (unsigned int key, bool special, bool release, int x, int y) { switch (key) { // steering flipflops case 273: key_paddling = !release; break; case 274: key_braking = !release; break; case 276: left_turn = !release; break; case 275: right_turn = !release; break; case 32: key_charging = !release; break; case SDLK_t: trick_modifier = !release; break; // mode changing and other actions case 27: if (!release) { g_game.raceaborted = true; g_game.race_result = -1; Winsys.SetMode (GAME_OVER); } break; case SDLK_p: if (!release) Winsys.SetMode (PAUSED); break; case SDLK_r: if (!release) Winsys.SetMode (RESET); break; case SDLK_s: if (!release) ScreenshotN (); break; // view changing case SDLK_1: if (!release) { set_view_mode (Players.GetCtrl (g_game.player_id), ABOVE); param.view_mode = ABOVE; } break; case SDLK_2: if (!release) { set_view_mode (Players.GetCtrl (g_game.player_id), FOLLOW); param.view_mode = FOLLOW; } break; case SDLK_3: if (!release) { set_view_mode (Players.GetCtrl (g_game.player_id), BEHIND); param.view_mode = BEHIND; } break; // toggle case SDLK_h: if (!release) param.show_hud = !param.show_hud; break; case SDLK_f: if (!release) param.display_fps = !param.display_fps; break; case SDLK_F5: if (!release) sky = !sky; break; case SDLK_F6: if (!release) fog = !fog; break; case SDLK_F7: if (!release) terr = !terr; break; case SDLK_F8: if (!release) trees = !trees; break; } }
void racing_init(void) { player_data_t *plyr = get_player_data( local_player() ); winsys_set_display_func( main_loop ); winsys_set_idle_func( main_loop ); winsys_set_reshape_func( reshape ); winsys_set_mouse_func( NULL ); winsys_set_motion_func( NULL ); winsys_set_passive_motion_func( NULL ); winsys_set_mouse_func( NULL ); /* Initialize view */ if ( getparam_view_mode() < 0 || getparam_view_mode() >= NUM_VIEW_MODES ) { setparam_view_mode( ABOVE ); } set_view_mode( plyr, (view_mode_t)getparam_view_mode() ); /* We need to reset controls here since callbacks won't have been called in paused mode. This results in duplication between this code and init_physical_simulation. Oh well. */ left_turn = right_turn = paddling = False; trick_modifier = False; charging = False; plyr->control.turn_fact = 0.0; plyr->control.turn_animation = 0.0; plyr->control.is_braking = False; plyr->control.is_paddling = False; plyr->control.jumping = False; plyr->control.jump_charging = False; #ifdef __APPLE__ plyr->control.is_flying=False; plyr->control.fly_total_time=0; #endif /* Set last_terrain to a value not used below */ last_terrain = 0; if ( g_game.prev_mode != PAUSED ) { init_physical_simulation(); } last_terrain = 0; g_game.race_aborted = False; #ifdef __APPLE__ g_game.race_time_over = False; #endif play_music( "racing" ); /* play_sound( "start_race", 0 ); */ }
void CRacing::Keyb (unsigned int key, bool special, bool release, int x, int y) { switch (key) { // steering flipflops case SDLK_UP: key_paddling = !release; break; case SDLK_DOWN: key_braking = !release; break; case SDLK_LEFT: left_turn = !release; break; case SDLK_RIGHT: right_turn = !release; break; case SDLK_SPACE: key_charging = !release; break; case SDLK_t: trick_modifier = !release; break; // mode changing and other actions case SDLK_ESCAPE: if (!release) { g_game.raceaborted = true; g_game.race_result = -1; State::manager.RequestEnterState (GameOver); } break; case SDLK_p: if (!release) State::manager.RequestEnterState (Paused); break; case SDLK_r: if (!release) State::manager.RequestEnterState (Reset); break; case SDLK_s: if (!release) ScreenshotN (); break; // view changing case SDLK_1: if (!release) { set_view_mode (Players.GetCtrl (g_game.player_id), ABOVE); param.view_mode = ABOVE; } break; case SDLK_2: if (!release) { set_view_mode (Players.GetCtrl (g_game.player_id), FOLLOW); param.view_mode = FOLLOW; } break; case SDLK_3: if (!release) { set_view_mode (Players.GetCtrl (g_game.player_id), BEHIND); param.view_mode = BEHIND; } break; // toggle case SDLK_h: if (!release) param.show_hud = !param.show_hud; break; case SDLK_f: if (!release) param.display_fps = !param.display_fps; break; case SDLK_F5: if (!release) sky = !sky; break; case SDLK_F6: if (!release) fog = !fog; break; case SDLK_F7: if (!release) terr = !terr; break; case SDLK_F8: if (!release) trees = !trees; break; } }
bool Racing::keyPressEvent(SDLKey key) { switch(key){ case 'q': gameMgr->abortRace(); set_game_mode( GAME_OVER ); return true; case SDLK_ESCAPE: set_game_mode( PAUSED ); return true; case '1': set_view_mode( players[0], ABOVE ); setparam_view_mode( ABOVE ); return true; case '2': set_view_mode( players[0], FOLLOW ); setparam_view_mode( FOLLOW ); return true; case '3': set_view_mode( players[0], BEHIND ); setparam_view_mode( BEHIND ); return true; case 's': screenshot(); return true; case 'p': set_game_mode( PAUSED ); return true; default: if(key==getparam_reset_key()){ set_game_mode( RESET ); return true; } } return false; }
static void create(void) { static const char title[] = " AlsaMixer v" SND_UTIL_VERSION_STR " "; widget_init(&mixer_widget, screen_lines, screen_cols, 0, 0, attr_mixer_frame, WIDGET_BORDER); if (screen_cols >= (sizeof(title) - 1) + 2) { wattrset(mixer_widget.window, attr_mixer_active); mvwaddstr(mixer_widget.window, 0, (screen_cols - (sizeof(title) - 1)) / 2, title); } init_mixer_layout(); display_card_info(); set_view_mode(view_mode); }
END_KEYBOARD_CB START_KEYBOARD_CB( switch_view_cb ) { if ( release ) return; int current_view = getparam_view_mode(); if (current_view == TUXEYE) current_view = ABOVE; else current_view = TUXEYE; set_view_mode( plyr, current_view ); setparam_view_mode( current_view ); saveparamViewMode( current_view ); }
void toggle_viper_lock_target (void) { switch (target_acquisition_system) { //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_OFF: //////////////////////////////////////// { break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_FLIR: case TARGET_ACQUISITION_SYSTEM_DTV: //////////////////////////////////////// { toggle_eo_lock(); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_HIDSS: //////////////////////////////////////// { hms_target_locked ^= 1; if (hms_target_locked) { if (in_cockpit && !query_TIR_active()) { set_view_mode (VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET); } else set_eo_lock(TRUE); } else { if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET) { select_padlock_view_event (PADLOCK_MODE_NONE); } } break; } } }
static void virtual_cockpit_track_target_event (event *ev) { ASSERT (ev); if ((ev->key == DIK_1) || (get_view_mode () != VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET)) { if (set_view_mode (VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET)) { set_havoc_lock_target (TRUE); } } else { if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET) { select_padlock_view_event (PADLOCK_MODE_NONE); } } }
Racing::Racing() { m_rightTurn = false; m_leftTurn = false; m_trickModifier = false; m_paddling = false; m_charging = false; m_braking = false; // Initialize view if ( getparam_view_mode() < 0 || getparam_view_mode() >= NUM_VIEW_MODES ) { setparam_view_mode( ABOVE ); } set_view_mode( players[0], (view_mode_t)getparam_view_mode() ); // We need to reset controls here since callbacks won't have been // called in paused mode. This results in duplication between this // code and init_physical_simulation. Oh well. players[0].control.turn_fact = 0.0; players[0].control.turn_animation = 0.0; players[0].control.is_braking = false; players[0].control.is_paddling = false; players[0].control.jumping = false; players[0].control.jump_charging = false; players[0].max_speed = 0; // Set last_terrain to a value not used below m_lastTerrain = 0; if ( GameMode::prevmode != PAUSED ) { init_physical_simulation(); } gameMgr->abortRace(false); init_snow(players[0].view.pos); play_music( "racing" ); }
static void deselect_hokum_target_acquisition_system (target_acquisition_systems system) { switch (system) { //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_OFF: //////////////////////////////////////// { // laser is on in all modes but OFF in automatic mode if (!command_line_manual_laser_radar) set_laser_is_active(TRUE); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_GROUND_RADAR: //////////////////////////////////////// { if (!command_line_manual_laser_radar) deactivate_common_ground_radar (); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_AIR_RADAR: //////////////////////////////////////// { if (!command_line_manual_laser_radar) deactivate_common_air_radar (); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_FLIR: //////////////////////////////////////// { deactivate_common_eo (); copy_eo_zoom(&hokum_flir, &hokum_llltv); copy_eo_zoom(&hokum_flir, &hokum_periscope); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_LLLTV: //////////////////////////////////////// { deactivate_common_eo (); copy_eo_zoom(&hokum_llltv, &hokum_flir); copy_eo_zoom(&hokum_llltv, &hokum_periscope); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_PERISCOPE: //////////////////////////////////////// { deactivate_common_eo (); copy_eo_zoom(&hokum_periscope, &hokum_flir); copy_eo_zoom(&hokum_periscope, &hokum_llltv); if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_PERISCOPE) { // start autoreturn to pilot by GCsDriver 08-12-2007 if(command_line_autoreturn_to_pilot_after_periscope){ set_pilot_seat_position (); } // end autoreturn to pilot by GCsDriver 08-12-2007 set_view_mode (VIEW_MODE_VIRTUAL_COCKPIT); } break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_HMS: //////////////////////////////////////// { deactivate_common_hms (); break; } //////////////////////////////////////// default: //////////////////////////////////////// { debug_fatal ("Invalid target acquisition system = %d", system); break; } } }
void toggle_hokum_lock_target (void) { switch (target_acquisition_system) { //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_OFF: //////////////////////////////////////// { break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_GROUND_RADAR: //////////////////////////////////////// { ground_radar.target_locked ^= 1; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_AIR_RADAR: //////////////////////////////////////// { air_radar.target_locked ^= 1; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_FLIR: case TARGET_ACQUISITION_SYSTEM_LLLTV: case TARGET_ACQUISITION_SYSTEM_PERISCOPE: //////////////////////////////////////// { toggle_eo_lock(); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_HMS: //////////////////////////////////////// { hms_target_locked ^= 1; if (hms_target_locked) { if (in_cockpit && !query_TIR_active()) { set_view_mode (VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET); } } else { if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET) { select_padlock_view_event (PADLOCK_MODE_NONE); } } break; } } }
static void on_handle_key(int key) { switch (key) { case 27: case KEY_CANCEL: case KEY_F(10): mixer_widget.close(); break; case KEY_F(1): case KEY_HELP: case 'H': case 'h': case '?': show_help(); break; case KEY_F(2): case '/': create_proc_files_list(); break; case KEY_F(3): set_view_mode(VIEW_MODE_PLAYBACK); break; case KEY_F(4): set_view_mode(VIEW_MODE_CAPTURE); break; case KEY_F(5): set_view_mode(VIEW_MODE_ALL); break; case '\t': set_view_mode((enum view_mode)((view_mode + 1) % VIEW_MODE_COUNT)); break; case KEY_F(6): case 'S': case 's': create_card_select_list(); break; case KEY_REFRESH: case 12: case 'L': case 'l': clearok(mixer_widget.window, TRUE); display_controls(); break; case KEY_LEFT: case 'P': case 'p': if (focus_control_index > 0) { --focus_control_index; refocus_control(); } break; case KEY_RIGHT: case 'N': case 'n': if (focus_control_index < controls_count - 1) { ++focus_control_index; refocus_control(); } break; case KEY_PPAGE: change_control_relative(5, LEFT | RIGHT); break; case KEY_NPAGE: change_control_relative(-5, LEFT | RIGHT); break; #if 0 case KEY_BEG: case KEY_HOME: change_control_to_percent(100, LEFT | RIGHT); break; #endif case KEY_LL: case KEY_END: change_control_to_percent(0, LEFT | RIGHT); break; case KEY_UP: case '+': case 'K': case 'k': case 'W': case 'w': change_control_relative(1, LEFT | RIGHT); break; case KEY_DOWN: case '-': case 'J': case 'j': case 'X': case 'x': change_control_relative(-1, LEFT | RIGHT); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': change_control_to_percent((key - '0') * 10, LEFT | RIGHT); break; case 'Q': case 'q': change_control_relative(1, LEFT); break; case 'Y': case 'y': case 'Z': case 'z': change_control_relative(-1, LEFT); break; case 'E': case 'e': change_control_relative(1, RIGHT); break; case 'C': case 'c': change_control_relative(-1, RIGHT); break; case 'M': case 'm': toggle_mute(LEFT | RIGHT); break; case 'B': case 'b': case '=': balance_volumes(); break; case '<': case ',': toggle_mute(LEFT); break; case '>': case '.': toggle_mute(RIGHT); break; case ' ': toggle_capture(LEFT | RIGHT); break; case KEY_IC: case ';': toggle_capture(LEFT); break; case KEY_DC: case '\'': toggle_capture(RIGHT); break; } }
static void deselect_hokum_target_acquisition_system (target_acquisition_systems system) { switch (system) { //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_OFF: //////////////////////////////////////// { break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_GROUND_RADAR: //////////////////////////////////////// { deactivate_common_ground_radar (); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_AIR_RADAR: //////////////////////////////////////// { deactivate_common_air_radar (); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_FLIR: //////////////////////////////////////// { deactivate_common_eo (); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_LLLTV: //////////////////////////////////////// { deactivate_common_eo (); break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_PERISCOPE: //////////////////////////////////////// { deactivate_common_eo (); if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_PERISCOPE) { set_view_mode (VIEW_MODE_VIRTUAL_COCKPIT); } break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_HMS: //////////////////////////////////////// { deactivate_common_hms (); break; } //////////////////////////////////////// default: //////////////////////////////////////// { debug_fatal ("Invalid target acquisition system = %d", system); break; } } }
void select_hokum_target_acquisition_system (target_acquisition_systems system) { target_acquisition_systems new_system, old_system; int damaged; new_system = system; old_system = target_acquisition_system; damaged = FALSE; reset_common_target_acquisition_system_keys (); deselect_hokum_target_acquisition_system (target_acquisition_system); switch (system) { //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_OFF: //////////////////////////////////////// { target_acquisition_system = system; set_gunship_target (NULL); #if 0 hud_mode = HUD_MODE_NAVIGATION; #endif break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_GROUND_RADAR: //////////////////////////////////////// { if (!hokum_damage.radar) { target_acquisition_system = system; activate_common_ground_radar (); select_hokum_ground_radar_mfd (); hud_mode = HUD_MODE_WEAPON; } damaged = hokum_damage.radar; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_AIR_RADAR: //////////////////////////////////////// { if (!hokum_damage.radar) { target_acquisition_system = system; activate_common_air_radar (); select_hokum_air_radar_mfd (); hud_mode = HUD_MODE_WEAPON; } damaged = hokum_damage.radar; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_FLIR: //////////////////////////////////////// { if (!hokum_damage.flir) { target_acquisition_system = system; activate_common_eo (); select_hokum_eo_mfd (); hud_mode = HUD_MODE_WEAPON; } damaged = hokum_damage.flir; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_LLLTV: //////////////////////////////////////// { if (!hokum_damage.llltv) { target_acquisition_system = system; activate_common_eo (); select_hokum_eo_mfd (); hud_mode = HUD_MODE_WEAPON; } damaged = hokum_damage.llltv; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_PERISCOPE: //////////////////////////////////////// { if (!hokum_damage.periscope) { target_acquisition_system = system; activate_common_eo (); if (get_crew_role () == CREW_ROLE_PILOT) { set_co_pilot_seat_position (); } if (get_crew_role () == CREW_ROLE_CO_PILOT) { set_view_mode (VIEW_MODE_VIRTUAL_COCKPIT_PERISCOPE); } select_hokum_eo_mfd (); hud_mode = HUD_MODE_WEAPON; } damaged = hokum_damage.periscope; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_HMS: //////////////////////////////////////// { if (!hokum_damage.helmet_mounted_sight) { target_acquisition_system = system; activate_common_hms (); hud_mode = HUD_MODE_WEAPON; } damaged = hokum_damage.helmet_mounted_sight; break; } //////////////////////////////////////// default: //////////////////////////////////////// { debug_fatal ("Invalid target acquisition system = %d", system); break; } } play_common_cpg_target_acquisition_system_speech (new_system, old_system, damaged); }
entity *free_flight_auto_assign_gunship (void) { vec3d *pos; entity *force, *new_task, *group, *member, **gunship_list, *en; entity_sub_types sub_type; int c, index, count; // // Auto assign a helicopter for free flight // ASSERT (get_comms_model () == COMMS_MODEL_SERVER); ASSERT (get_game_type () == GAME_TYPE_FREE_FLIGHT); ASSERT (get_pilot_entity ()); if (get_gunship_entity ()) { return NULL; } force = get_local_entity_parent (get_pilot_entity (), LIST_TYPE_PILOT); ASSERT (force); // // Count up candidates // count = 0; en = get_local_entity_first_child (force, LIST_TYPE_AIR_REGISTRY); while (en) { if (get_local_entity_int_value (en, INT_TYPE_GROUP_MODE) == GROUP_MODE_IDLE) { member = get_local_entity_first_child (en, LIST_TYPE_MEMBER); while (member) { sub_type = get_local_entity_int_value (member, INT_TYPE_ENTITY_SUB_TYPE); if ((sub_type == ENTITY_SUB_TYPE_AIRCRAFT_RAH66_COMANCHE) || (sub_type == ENTITY_SUB_TYPE_AIRCRAFT_KA52_HOKUM_B)) { if (get_local_entity_suitable_for_player (member, get_pilot_entity ())) { count ++; } } member = get_local_entity_child_succ (member, LIST_TYPE_MEMBER); } } en = get_local_entity_child_succ (en, LIST_TYPE_AIR_REGISTRY); } if (count == 0) { return NULL; } // // Create list of candidates // gunship_list = safe_malloc (sizeof (entity *) * count); count = 0; en = get_local_entity_first_child (force, LIST_TYPE_AIR_REGISTRY); while (en) { if (get_local_entity_int_value (en, INT_TYPE_GROUP_MODE) == GROUP_MODE_IDLE) { member = get_local_entity_first_child (en, LIST_TYPE_MEMBER); while (member) { sub_type = get_local_entity_int_value (member, INT_TYPE_ENTITY_SUB_TYPE); if ((sub_type == ENTITY_SUB_TYPE_AIRCRAFT_RAH66_COMANCHE) || (sub_type == ENTITY_SUB_TYPE_AIRCRAFT_KA52_HOKUM_B)) { if (get_local_entity_suitable_for_player (member, get_pilot_entity ())) { gunship_list [count] = member; count ++; } } member = get_local_entity_child_succ (member, LIST_TYPE_MEMBER); } } en = get_local_entity_child_succ (en, LIST_TYPE_AIR_REGISTRY); } // // Pick one... // ASSERT (count > 0); index = rand16 () % count; for (c = 0; c < count; c ++) { en = gunship_list [index]; group = get_local_entity_parent (en, LIST_TYPE_MEMBER); pos = get_local_entity_vec3d_ptr (en, VEC3D_TYPE_POSITION); new_task = create_user_task (en, ENTITY_SUB_TYPE_TASK_FREE_FLIGHT, pos, NULL, NULL); set_assign_create_waypoint_route (FALSE); if (assign_primary_task_to_group (group, new_task)) { set_gunship_entity (en); set_view_mode (VIEW_MODE_COCKPIT_PANEL_LEVEL_AHEAD); safe_free (gunship_list); initialise_free_flight_screen_map_page_objects (); return en; } else { debug_log ("FLIGHT: can't assign user to Created task"); destroy_client_server_entity (new_task); } set_assign_create_waypoint_route (TRUE); index ++; if (index == count) { index = 0; } } safe_free (gunship_list); return NULL; }
int init (int argc, char *argv[]) { char *p; int rc = 0, oldmode; url_t u; int x0=-1, y0=-1, r=-1, c=-1; struct hostent *remote; char buffer[MAX_PATH]; if (action == ACTION_TESTONLY) exit (0); if (action == ACTION_BADAGS) { usage (); exit (1); } if (options.keep_winsize) { r = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "rows"); c = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "cols"); if (r == 0 && c == 0) r = -1, c = -1; } if (options.keep_winpos) { x0 = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "x0"); y0 = cfg_get_integer (CONFIG_NFTP, fl_opt.platform_nick, "y0"); if (x0 == 0 || y0 == 0) x0 = -1, y0 = -1; } p = cfg_get_string (CONFIG_NFTP, fl_opt.platform_nick, "font"); if (p[0] == '\0') p = NULL; fly_init (x0, y0, r, c, p); if (options.show_hw_cursor) video_cursor_state (1); fly_mouse (options.mouse); wintitle = get_window_name (); if (fl_opt.platform == PLATFORM_OS2_VIO) { strcpy (buffer, paths.system_libpath); str_cats (buffer, "nftp.ico"); if (access (buffer, R_OK) == 0) set_icon (buffer); } if (main_menu != NULL) { menu_activate (main_menu); adjust_menu_status (); } display.dir_mode = options.defaultdirmode; display.view_mode = VIEW_CONTROL; display.rshift = 0; display.lshift = 0; display.tabsize = 8; if (options.slowlink) set_view_mode (VIEW_REMOTE); else set_view_mode (VIEW_CONTROL); site.maxndir = 1024; site.dir = malloc (sizeof(directory)*site.maxndir); // ignore "broken PIPE" signals signal (SIGPIPE, SIG_IGN); set_window_name ("NFTP%s(C) Copyright Sergey Ayukov", NFTP_VERSION); local.dir.files = NULL; local.sortmode = abs (options.default_localsort); if (options.default_localsort >= 0) local.sortdirection = 1; else local.sortdirection = -1; build_local_filelist (NULL); site.batch_mode = FALSE; site.chunks = NULL; PutLineIntoResp2 ("NFTP Version%s(%s, %s) -- %s", NFTP_VERSION, __DATE__, __TIME__, fl_opt.platform_name); PutLineIntoResp1 ("Copyright (C) 1994-2003 Sergey Ayukov <*****@*****.**>"); PutLineIntoResp1 ("Portions Copyright (C) Eric Young <*****@*****.**>"); //PutLineIntoResp1 ("Portions Copyright (C) Martin Nicolay <*****@*****.**>"); status.usage_interval = 0; if (!fl_opt.has_osmenu) PutLineIntoResp1 (M("Press F9 or Ctrl-F for menu")); update (1); if (options.firewall_type != 0) { if (options.fire_server[0] == '\0') { fly_ask_ok (ASK_WARN, M("Firewall proxy host isn't specified in NFTP.INI")); options.firewall_type = 0; } else { if (strspn (options.fire_server, " .0123456789") == strlen (options.fire_server)) { firewall.fwip = inet_addr (options.fire_server); } else { PutLineIntoResp2 (M("Looking up '%s'"), options.fire_server); remote = gethostbyname (options.fire_server); if (remote == NULL) { PutLineIntoResp2 (M("Cannot find '%s'"), options.fire_server); options.firewall_type = 0; } else { firewall.fwip = *((unsigned long *)(remote->h_addr)); PutLineIntoResp2 (M("Found '%s'"), remote->h_name); } } } } // read password cache psw_read (); // analyze arguments switch (action) { case 0: if (options.download_path != NULL) { set_local_path (options.download_path); } else { p = cfg_get_string (CONFIG_NFTP, "", "local-directory"); if (p[0] != '\0') set_local_path (p); } build_local_filelist (NULL); switch (options.start_prompt) { case 1: return FMSG_BASE_MENU + KEY_GEN_LOGIN; case 2: return FMSG_BASE_MENU + KEY_GEN_BOOKMARKS; case 3: return FMSG_BASE_MENU + KEY_GEN_HISTORY; case 5: return FMSG_BASE_MENU + KEY_MENU; } return 0; case ACTION_DOWNLOAD: case ACTION_UPLOAD: oldmode = site.batch_mode; site.batch_mode = TRUE; if (action == ACTION_DOWNLOAD) rc = do_get (optarg1); if (action == ACTION_UPLOAD) rc = do_put (optarg1); //set_view_mode (VIEW_CONTROL); //update (1); if (rc && !cmdline.batchmode) fly_ask_ok (0, M("Transfer of '%s' has failed"), optarg1); if ((disc_after && rc == 0) || cmdline.batchmode) { Logoff (); terminate (); exit (0); } site.batch_mode = oldmode; return 0; case ACTION_CMDLIST: rc = runscript (optarg1); return 0; case ACTION_NICK_BOOK: case ACTION_NICK_HIST: if (action == ACTION_NICK_BOOK && bookmark_nickname (optarg1, &u) == 0) return 0; if (action == ACTION_NICK_HIST && history_nickname (optarg1, &u) == 0) return 0; rc = Login (&u); if (rc) return 0; if (options.login_bell) Bell (3); return 0; case ACTION_OPEN_BOOKMARKS: return FMSG_BASE_MENU + KEY_GEN_BOOKMARKS; case ACTION_OPEN_HISTORY: return FMSG_BASE_MENU + KEY_GEN_HISTORY; case ACTION_LOGIN: // if download_path was specified in nftp.ini, set it now if (options.download_path != NULL) set_local_path (options.download_path); build_local_filelist (NULL); parse_url (optarg1, &u); rc = Login (&u); // attempt to download file if chdir failed /*if (site.set_up && strcmp (site.u.pathname, RCURDIR.name) != 0) { rc = do_get (optarg1); } if (rc) return 0; */ if (options.login_bell) Bell (3); return 0; case ACTION_TESTONLY: terminate (); exit (0); } fly_error ("internal error in init()"); return 0; }
void toggle_comanche_lock_target (void) { switch (target_acquisition_system) { //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_OFF: //////////////////////////////////////// { break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_GROUND_RADAR: //////////////////////////////////////// { ground_radar.target_locked ^= 1; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_AIR_RADAR: //////////////////////////////////////// { air_radar.target_locked ^= 1; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_FLIR: //////////////////////////////////////// { eo_target_locked ^= 1; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_DTV: //////////////////////////////////////// { eo_target_locked ^= 1; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_DVO: //////////////////////////////////////// { eo_target_locked ^= 1; break; } //////////////////////////////////////// case TARGET_ACQUISITION_SYSTEM_HIDSS: //////////////////////////////////////// { hms_target_locked ^= 1; if (hms_target_locked) { if (in_cockpit) { set_view_mode (VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET); } } else { if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_TRACK_TARGET) { select_padlock_view_event (PADLOCK_MODE_NONE); } } break; } } }