bool HudGaugeTalkingHead::canRender() { if (sexp_override) { return false; } if (hud_disabled() && !hud_disabled_except_messages()) { return false; } if(!active) return false; if ( !(Game_detail_flags & DETAIL_FLAG_HUD) ) { return false; } if ((Viewer_mode & disabled_views)) { return false; } if(pop_up) { if(!popUpActive()) { return false; } } return true; }
bool HudGaugeRadarDradis::shouldDoSounds() { if (hud_disabled()) return false; if (Viewer_mode & (VM_EXTERNAL | VM_CHASE | VM_DEAD_VIEW | VM_OTHER_SHIP)) return false; return true; }
void message_training_update_frame() { int z; if ((Viewer_mode & (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY ))) { return; } if ( hud_disabled() && !hud_disabled_except_messages()) { return; } Training_message_visible = 0; message_training_queue_check(); if (Training_failure){ return; } if (timestamp_elapsed(Training_message_timestamp) || !strlen(Training_buf)){ return; } // the code that preps the training message and counts the number of lines // has been moved to message_training_setup() if (Training_num_lines <= 0){ return; } Training_message_visible = 1; if ((Training_voice >= 0) && (Training_num_lines > 0) && !(Training_message_timestamp)) { if (Training_voice_type) z = audiostream_is_playing(Training_voice_handle); else z = snd_is_playing(Training_voice_handle); if (!z) Training_message_timestamp = timestamp(2000); // 2 second delay } Training_message_method = 0; }
bool HudGaugeDirectives::canRender() { if (sexp_override) { return false; } if(hud_disabled_except_messages()) { return false; } if (hud_disabled() && !hud_disabled_except_messages()) { return false; } // force the directives list to display in training missions even if this gauge isn't active. if(!active && !(The_mission.game_type & MISSION_TYPE_TRAINING)) return false; if ( !(Game_detail_flags & DETAIL_FLAG_HUD) ) { return false; } if ((Viewer_mode & disabled_views)) { return false; } if(pop_up) { if(!popUpActive()) { return false; } } if (gauge_config == HUD_ETS_GAUGE) { if (Ships[Player_obj->instance].flags2 & SF2_NO_ETS) { return false; } } return true; }
bool HudGaugeTrainingMessages::canRender() { if (hud_disabled() && !hud_disabled_except_messages()) { return false; } if ( !(Game_detail_flags & DETAIL_FLAG_HUD) ) { return false; } if ((Viewer_mode & disabled_views)) { return false; } if(pop_up) { if(!popUpActive()) { return false; } } return true; }
// pause do frame - will handle running multiplayer operations if necessary void pause_do() { int k; const char *pause_str = XSTR("Paused", 767); int str_w, str_h; // next two are for view resetting static int previous_Viewer_mode = -1; static int previous_hud_state = -1; Assert( !(Game_mode & GM_MULTIPLAYER) ); // RENDER A GAME FRAME HERE AS THE BACKGROUND (if normal pause) if(Pause_type == PAUSE_TYPE_NORMAL) { // Fall back to viewer just incase saved screen is invalid if(Pause_saved_screen == -1){ Pause_type = PAUSE_TYPE_VIEWER; } else if(Pause_type == PAUSE_TYPE_NORMAL) { gr_restore_screen(Pause_saved_screen); } } if(Pause_type == PAUSE_TYPE_NORMAL){ if (Pause_background_bitmap >= 0) { gr_set_bitmap(Pause_background_bitmap); // draw the bitmap gr_bitmap(Please_wait_coords[gr_screen.res][0], Please_wait_coords[gr_screen.res][1], GR_RESIZE_MENU); // draw "Paused" on it gr_set_color_fast(&Color_normal); gr_set_font(FONT2); gr_get_string_size(&str_w, &str_h, pause_str); gr_string((gr_screen.max_w_unscaled - str_w) / 2, (gr_screen.max_h_unscaled - str_h) / 2, pause_str, GR_RESIZE_MENU); gr_set_font(FONT1); } } if (Pause_type == PAUSE_TYPE_VIEWER) { if (previous_Viewer_mode < 0) previous_Viewer_mode = Viewer_mode; if (previous_hud_state < 0) previous_hud_state = hud_disabled(); } // process the ui window here k = Pause_win.process() & ~KEY_DEBUGGED; switch (k) { case KEY_TAB: hud_toggle_draw(); break; // view from outside of the ship case KEY_ENTER: if (Pause_type == PAUSE_TYPE_VIEWER) { button_function_demo_valid(VIEW_EXTERNAL); } break; // view from target case KEY_PADDIVIDE: if (Pause_type == PAUSE_TYPE_VIEWER) { button_function_demo_valid(VIEW_OTHER_SHIP); } break; // change target case KEY_PADMULTIPLY: if (Pause_type == PAUSE_TYPE_VIEWER) { button_function(TARGET_NEXT); } break; case KEY_ESC: case KEY_ALTED + KEY_PAUSE: case KEY_PAUSE: // reset previous view if we happened to be playing around with it during pause if (Pause_type == PAUSE_TYPE_VIEWER) { if (previous_Viewer_mode >= 0) { Viewer_mode = previous_Viewer_mode; } // NOTE remember that hud state is reversed here (0 == on, 1 == off) if ( (previous_hud_state >= 0) && (hud_disabled() != previous_hud_state) ) { hud_set_draw( !previous_hud_state ); } } gameseq_post_event(GS_EVENT_PREVIOUS_STATE); break; } // end switch // draw the background window Pause_win.draw(); // a very unique case where we shouldn't be doing the page flip because we're inside of popup code if(!popup_active()){ if(Pause_type == PAUSE_TYPE_NORMAL) { gr_flip(); } } else { // this should only be happening in a very unique multiplayer case Int3(); } }
void mission_eval_goals() { int i, result; // before checking whether or not we should evaluate goals, we should run through the events and // process any whose timestamp is valid and has expired. This would catch repeating events only for (i=0; i<Num_mission_events; i++) { if (Mission_events[i].formula != -1) { if ( !timestamp_valid(Mission_events[i].timestamp) || !timestamp_elapsed(Mission_events[i].timestamp) ){ continue; } // if we get here, then the timestamp on the event has popped -- we should reevaluate PROFILE("Repeating events", mission_process_event(i)); } } if ( !timestamp_elapsed(Mission_goal_timestamp) ){ return; } // first evaluate the players goals for (i=0; i<Num_goals; i++) { // don't evaluate invalid goals if (Mission_goals[i].type & INVALID_GOAL){ continue; } if (Mission_goals[i].satisfied == GOAL_INCOMPLETE) { result = eval_sexp(Mission_goals[i].formula); if ( Sexp_nodes[Mission_goals[i].formula].value == SEXP_KNOWN_FALSE ) { mission_goal_status_change( i, GOAL_FAILED ); } else if (result) { mission_goal_status_change(i, GOAL_COMPLETE ); } // end if result } // end if goals[i].satsified != GOAL_COMPLETE } // end for // now evaluate any mission events for (i=0; i<Num_mission_events; i++) { if ( Mission_events[i].formula != -1 ) { // only evaluate this event if the timestamp is not valid. We do this since // we will evaluate repeatable events at the top of the file so we can get // the exact interval that the designer asked for. if ( !timestamp_valid( Mission_events[i].timestamp) ){ PROFILE("Nonrepeating events", mission_process_event( i )); } } } // send and remaining sexp data to the clients if (MULTIPLAYER_MASTER) { multi_sexp_flush_packet(); } if (The_mission.game_type & MISSION_TYPE_TRAINING){ Mission_goal_timestamp = timestamp(GOAL_TIMESTAMP_TRAINING); } else { Mission_goal_timestamp = timestamp(GOAL_TIMESTAMP); } if ( !hud_disabled() && hud_gauge_active(HUD_DIRECTIVES_VIEW) ) { mission_maybe_play_directive_success_sound(); } // update goal status if playing on a multiplayer standalone server if (Game_mode & GM_STANDALONE_SERVER){ std_multi_update_goals(); } Snapshot_all_events = false; }
void mission_eval_goals() { int i, result, goal_changed = 0; // before checking whether or not we should evaluate goals, we should run through the events and // process any whose timestamp is valid and has expired. This would catch repeating events only for (i=0; i<Num_mission_events; i++) { if (Mission_events[i].formula != -1) { if ( !timestamp_valid(Mission_events[i].timestamp) || !timestamp_elapsed(Mission_events[i].timestamp) ){ continue; } // if we get here, then the timestamp on the event has popped -- we should reevaluate mission_process_event(i); } } if ( !timestamp_elapsed(Mission_goal_timestamp) ){ return; } // first evaluate the players goals for (i=0; i<Num_goals; i++) { // don't evaluate invalid goals if (Mission_goals[i].type & INVALID_GOAL){ continue; } if (Mission_goals[i].satisfied == GOAL_INCOMPLETE) { result = eval_sexp(Mission_goals[i].formula); if ( Sexp_nodes[Mission_goals[i].formula].value == SEXP_KNOWN_FALSE ) { goal_changed = 1; mission_goal_status_change( i, GOAL_FAILED ); } else if (result) { goal_changed = 1; mission_goal_status_change(i, GOAL_COMPLETE ); } // end if result // tell the player how to end the mission //if ( goal_changed && mission_evaluate_primary_goals() != PRIMARY_GOALS_INCOMPLETE ) { // HUD_sourced_printf(HUD_SOURCE_IMPORTANT, "Press %s to end mission and return to base", textify_scancode(Control_config[END_MISSION].key_id) ); //} } // end if goals[i].satsified != GOAL_COMPLETE } // end for // now evaluate any mission events for (i=0; i<Num_mission_events; i++) { if ( Mission_events[i].formula != -1 ) { // only evaluate this event if the timestamp is not valid. We do this since // we will evaluate repeatable events at the top of the file so we can get // the exact interval that the designer asked for. if ( !timestamp_valid( Mission_events[i].timestamp) ){ mission_process_event( i ); } } } if (The_mission.game_type & MISSION_TYPE_TRAINING){ Mission_goal_timestamp = timestamp(GOAL_TIMESTAMP_TRAINING); } else { Mission_goal_timestamp = timestamp(GOAL_TIMESTAMP); } if ( !hud_disabled() && hud_gauge_active(HUD_DIRECTIVES_VIEW) ) { mission_maybe_play_directive_success_sound(); } // update goal status if playing on a multiplayer standalone server if (Game_mode & GM_STANDALONE_SERVER){ std_multi_update_goals(); } }