// displays (renders) the training objectives list void training_obj_display() { char buf[256], *second_line; int i, t, x, y, z, height, end, offset, bx, by, y_count; color *c; if (!Training_obj_num_lines){ return; } if ( !hud_gauge_active(HUD_DIRECTIVES_VIEW) ) { // Always draw the directives display if this is a training mission if ( !(The_mission.game_type & MISSION_TYPE_TRAINING) ) { return; } } // don't ever display directives display in multiplayer missions // if ( Game_mode & GM_MULTIPLAYER ){ // return; // } height = gr_get_font_height(); offset = 0; end = Training_obj_num_lines; if (end > TRAINING_OBJ_DISPLAY_LINES) { end = TRAINING_OBJ_DISPLAY_LINES; offset = Training_obj_num_lines - end; } // draw top of objective display // hud_set_default_color(); hud_set_gauge_color(HUD_DIRECTIVES_VIEW); GR_AABITMAP(Directive_gauge[0].first_frame, Directive_coords[gr_screen.res][DIRECTIVE_COORDS_TOP][0]+fl2i(HUD_offset_x), Directive_coords[gr_screen.res][DIRECTIVE_COORDS_TOP][1]+fl2i(HUD_offset_y)); // gr_set_bitmap(Directive_gauge[0].first_frame); // gr_aabitmap(Directive_coords[DIRECTIVE_COORDS_TOP][0]+fl2i(HUD_offset_x), Directive_coords[DIRECTIVE_COORDS_TOP][1]+fl2i(HUD_offset_y)); // print out title emp_hud_printf(Directive_coords[gr_screen.res][DIRECTIVE_COORDS_TITLE][0]+fl2i(HUD_offset_x), Directive_coords[gr_screen.res][DIRECTIVE_COORDS_TITLE][1]+fl2i(HUD_offset_y), EG_OBJ_TITLE, XSTR( "Directives", 422)); // gr_printf(Directive_coords[DIRECTIVE_COORDS_TITLE][0]+fl2i(HUD_offset_x), Directive_coords[DIRECTIVE_COORDS_TITLE][1]+fl2i(HUD_offset_y), XSTR( "directives", 422)); bx = DIRECTIVE_X+fl2i(HUD_offset_x); by = Directive_coords[gr_screen.res][DIRECTIVE_COORDS_MIDDLE][1]+fl2i(HUD_offset_y); y_count = 0; for (i=0; i<end; i++) { x = DIRECTIVE_X + 5 + fl2i(HUD_offset_x); y = Training_obj_window_coords[gr_screen.res][1] + fl2i(HUD_offset_y) + y_count * height + height / 2 + 1; z = TRAINING_OBJ_LINES_MASK(i + offset); c = &Color_normal; if (Training_obj_lines[i + offset] & TRAINING_OBJ_LINES_KEY) { message_translate_tokens(buf, Mission_events[z].objective_key_text); // remap keys // gr_set_color_fast(&Color_normal); c = &Color_bright_green; } else { strcpy(buf, Mission_events[z].objective_text); if (Mission_events[z].count){ sprintf(buf + strlen(buf), NOX(" [%d]"), Mission_events[z].count); } #ifndef NO_NETWORK // if this is a multiplayer tvt game, and this is event is not for my team, don't display it if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM) && (Net_player != NULL)){ if((Mission_events[z].team != -1) && (Net_player->p_info.team != Mission_events[z].team)){ continue; } } #endif switch (mission_get_event_status(z)) { case EVENT_CURRENT: // gr_set_color_fast(&Color_bright_white); c = &Color_bright_white; break; case EVENT_FAILED: // gr_set_color_fast(&Color_bright_red); c = &Color_bright_red; break; case EVENT_SATISFIED: // gr_set_color_fast(&Color_bright_blue); t = Mission_events[z].satisfied_time; if (t + i2f(2) > Missiontime) { if (Missiontime % fl2f(.4f) < fl2f(.2f)){ c = &Color_bright_blue; } else { c = &Color_bright_white; } } else { c = &Color_bright_blue; } break; } } // maybe split the directives line second_line = split_str_once(buf, 167); // blit the background frames // hud_set_default_color(); hud_set_gauge_color(HUD_DIRECTIVES_VIEW); GR_AABITMAP(Directive_gauge[1].first_frame, bx, by); // gr_set_bitmap(Directive_gauge[1].first_frame); // gr_aabitmap(bx, by); by += DIRECTIVE_H; if ( second_line ) { GR_AABITMAP(Directive_gauge[1].first_frame, bx, by); // gr_set_bitmap(Directive_gauge[1].first_frame); // gr_aabitmap(bx, by); by += DIRECTIVE_H; } // blit the text gr_set_color_fast(c); emp_hud_string(x, y, EG_OBJ1 + i, buf); // gr_printf(x, y, buf); y_count++; if ( second_line ) { y = Training_obj_window_coords[gr_screen.res][1] + fl2i(HUD_offset_y) + y_count * height + height / 2 + 1; emp_hud_string(x+12, y, EG_OBJ1 + i + 1, second_line); // gr_printf(x+12, y, second_line); y_count++; } } // draw the bottom of objective display // hud_set_default_color(); hud_set_gauge_color(HUD_DIRECTIVES_VIEW); GR_AABITMAP(Directive_gauge[2].first_frame, bx, by); // gr_set_bitmap(Directive_gauge[2].first_frame); // gr_aabitmap(bx, by); }
// Draw the miniature shield icon that is drawn near the reticle // this function is only used by multi_ingame_join_display_ship() in multi_ingame.cpp as of the new HudGauge implementation (Swifty) void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_offset, int y_hull_offset) { float max_shield; int hud_color_index, range, frame_offset; int sx, sy, i; if ( objp->type != OBJ_SHIP ) { return; } hud_set_gauge_color(HUD_TARGET_MINI_ICON); if (!Shield_mini_loaded) return; sx = (x_force == -1) ? Shield_mini_coords[gr_screen.res][0]+fl2i(HUD_offset_x) : x_force; sy = (y_force == -1) ? Shield_mini_coords[gr_screen.res][1]+fl2i(HUD_offset_y) : y_force; // draw the ship first hud_shield_maybe_flash(HUD_TARGET_MINI_ICON, SHIELD_HIT_TARGET, Shield_hit_data[SHIELD_HIT_TARGET].hull_hit_index); hud_show_mini_ship_integrity(objp, x_force + x_hull_offset,y_force + y_hull_offset); // draw the four quadrants // Draw shield quadrants at one of NUM_SHIELD_LEVELS max_shield = get_max_shield_quad(objp); for ( i = 0; i < objp->n_quadrants; i++ ) { if ( objp->flags[Object::Object_Flags::No_shields] || i >= DEFAULT_SHIELD_SECTIONS) { break; } if (objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f ) { continue; } if ( hud_shield_maybe_flash(HUD_TARGET_MINI_ICON, SHIELD_HIT_TARGET, i) ) { frame_offset = i+objp->n_quadrants; } else { frame_offset = i; } range = HUD_color_alpha; hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range + 0.5); Assert(hud_color_index >= 0 && hud_color_index <= range); if ( hud_color_index < 0 ) { hud_color_index = 0; } if ( hud_color_index >= HUD_NUM_COLOR_LEVELS ) { hud_color_index = HUD_NUM_COLOR_LEVELS - 1; } if ( hud_gauge_maybe_flash(HUD_TARGET_MINI_ICON) == 1) { // hud_set_bright_color(); hud_set_gauge_color(HUD_TARGET_MINI_ICON, HUD_C_BRIGHT); } else { // gr_set_color_fast(&HUD_color_defaults[hud_color_index]); hud_set_gauge_color(HUD_TARGET_MINI_ICON, hud_color_index); } GR_AABITMAP(Shield_mini_gauge.first_frame + frame_offset, sx + HUD_nose_x, sy + HUD_nose_y); } // hud_set_default_color(); }
// ------------------------------------------------------------------ // hud_shield_show() // // Show the players shield strength and integrity // void hud_shield_show(object *objp) { float max_shield; int hud_color_index, range; int sx, sy, i; ship *sp; ship_info *sip; hud_frames *sgp; if ( objp->type != OBJ_SHIP ) return; sp = &Ships[objp->instance]; sip = &Ship_info[sp->ship_info_index]; if ( sip->shield_icon_index == 255 ) { return; } if (objp == Player_obj) { hud_set_gauge_color(HUD_PLAYER_SHIELD_ICON); } else { hud_set_gauge_color(HUD_TARGET_SHIELD_ICON); } // load in shield frames if not already loaded Assert(sip->shield_icon_index >= 0 && sip->shield_icon_index < Hud_shield_filename_count); sgp = &Shield_gauges[sip->shield_icon_index]; if ( sgp->first_frame == -1 ) { sgp->first_frame = bm_load_animation(Hud_shield_filenames[sip->shield_icon_index], &sgp->num_frames); if ( sgp->first_frame == -1 ) { Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", Hud_shield_filenames[sip->shield_icon_index]); return; } } if ( objp == Player_obj ) { sx = Player_shield_coords[gr_screen.res][0]; sy = Player_shield_coords[gr_screen.res][1]; } else { sx = Target_shield_coords[gr_screen.res][0]; sy = Target_shield_coords[gr_screen.res][1]; } sx += fl2i(HUD_offset_x); sy += fl2i(HUD_offset_y); // draw the ship first if ( objp == Player_obj ) { hud_shield_maybe_flash(HUD_PLAYER_SHIELD_ICON, SHIELD_HIT_PLAYER, HULL_HIT_OFFSET); } else { hud_shield_maybe_flash(HUD_TARGET_SHIELD_ICON, SHIELD_HIT_TARGET, HULL_HIT_OFFSET); } GR_AABITMAP(sgp->first_frame, sx, sy); // draw the four quadrants // // Draw shield quadrants at one of NUM_SHIELD_LEVELS max_shield = sip->shields/4.0f; for ( i = 0; i < 4; i++ ) { if ( objp->flags & OF_NO_SHIELDS ) { break; } if ( objp->shields[Quadrant_xlate[i]] < 0.1f ) { continue; } range = max(HUD_COLOR_ALPHA_MAX, HUD_color_alpha + 4); hud_color_index = fl2i( (objp->shields[Quadrant_xlate[i]] / max_shield) * range + 0.5); Assert(hud_color_index >= 0 && hud_color_index <= range); if ( hud_color_index < 0 ) { hud_color_index = 0; } if ( hud_color_index >= HUD_NUM_COLOR_LEVELS ) { hud_color_index = HUD_NUM_COLOR_LEVELS - 1; } int flash=0; if ( objp == Player_obj ) { flash = hud_shield_maybe_flash(HUD_PLAYER_SHIELD_ICON, SHIELD_HIT_PLAYER, i); } else { flash = hud_shield_maybe_flash(HUD_TARGET_SHIELD_ICON, SHIELD_HIT_TARGET, i); } if ( !flash ) { // gr_set_color_fast(&HUD_color_defaults[hud_color_index]); if ( objp == Player_obj ) { hud_set_gauge_color(HUD_PLAYER_SHIELD_ICON, hud_color_index); } else { hud_set_gauge_color(HUD_TARGET_SHIELD_ICON, hud_color_index); } GR_AABITMAP(sgp->first_frame+i+1, sx, sy); } } // hud_set_default_color(); }
// Draw the miniature shield icon that is drawn near the reticle void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_offset, int y_hull_offset) { float max_shield; int hud_color_index, range, frame_offset; int sx, sy, i; ship *sp; ship_info *sip; shield_hit_info *shi; shi = &Shield_hit_data[SHIELD_HIT_TARGET]; if ( objp->type != OBJ_SHIP ) { return; } sp = &Ships[objp->instance]; sip = &Ship_info[sp->ship_info_index]; hud_set_gauge_color(HUD_TARGET_MINI_ICON); if (!Shield_mini_loaded) return; sx = (x_force == -1) ? Shield_mini_coords[gr_screen.res][0]+fl2i(HUD_offset_x) : x_force; sy = (y_force == -1) ? Shield_mini_coords[gr_screen.res][1]+fl2i(HUD_offset_y) : y_force; // draw the ship first hud_shield_maybe_flash(HUD_TARGET_MINI_ICON, SHIELD_HIT_TARGET, HULL_HIT_OFFSET); hud_show_mini_ship_integrity(objp,x_force + x_hull_offset,y_force + y_hull_offset); // draw the four quadrants // Draw shield quadrants at one of NUM_SHIELD_LEVELS max_shield = sip->shields/4.0f; for ( i = 0; i < 4; i++ ) { if ( objp->flags & OF_NO_SHIELDS ) { break; } if ( objp->shields[Quadrant_xlate[i]] < 0.1f ) { continue; } if ( hud_shield_maybe_flash(HUD_TARGET_MINI_ICON, SHIELD_HIT_TARGET, i) ) { frame_offset = i+4; } else { frame_offset = i; } range = HUD_color_alpha; hud_color_index = fl2i( (objp->shields[Quadrant_xlate[i]] / max_shield) * range + 0.5); Assert(hud_color_index >= 0 && hud_color_index <= range); if ( hud_color_index < 0 ) { hud_color_index = 0; } if ( hud_color_index >= HUD_NUM_COLOR_LEVELS ) { hud_color_index = HUD_NUM_COLOR_LEVELS - 1; } if ( hud_gauge_maybe_flash(HUD_TARGET_MINI_ICON) == 1) { // hud_set_bright_color(); hud_set_gauge_color(HUD_TARGET_MINI_ICON, HUD_C_BRIGHT); } else { // gr_set_color_fast(&HUD_color_defaults[hud_color_index]); hud_set_gauge_color(HUD_TARGET_MINI_ICON, hud_color_index); } GR_AABITMAP(Shield_mini_gauge.first_frame + frame_offset, sx, sy); } // hud_set_default_color(); }
// ---------------------------------------------------------------------- // hud_display_escort() // // Display the data on ships in the escort list void hud_display_escort() { #ifndef NEW_HUD int i = 0; if ( !Show_escort_view ) { return; } if ( !Num_escort_ships ) { return; } // hud_set_default_color(); hud_set_gauge_color(HUD_ESCORT_VIEW); // draw the top of the escort view GR_AABITMAP(Escort_gauges[0].first_frame, current_hud->Escort_coords[0], current_hud->Escort_coords[1]); gr_string(current_hud->Escort_htext_coords[0], current_hud->Escort_htext_coords[1], current_hud->Escort_htext); int x = current_hud->Escort_coords[0] + current_hud->Escort_list[0]; int y = current_hud->Escort_coords[1] + current_hud->Escort_list[1]; //This is temporary Num_escort_ships--; i=0; if(Num_escort_ships) { for(; i < Num_escort_ships; i++) { if(i != 0) { x += current_hud->Escort_entry[0]; y += current_hud->Escort_entry[1]; } GR_AABITMAP(Escort_gauges[1].first_frame, x, y); //Now we just show the ships info hud_escort_show_icon(x, y, i); } //Increment for last entry x += current_hud->Escort_entry_last[0]; y += current_hud->Escort_entry_last[1]; } //Back to right # Num_escort_ships++; //Show the last escort entry GR_AABITMAP(Escort_gauges[2].first_frame, x, y); hud_escort_show_icon(x, y, i); /* if ( Num_escort_ships >= 2 ) { GR_AABITMAP(Escort_gauges[1].first_frame, Escort_coords[gr_screen.res][1][0], Escort_coords[gr_screen.res][1][1]); } if ( Num_escort_ships >= 3 ) { GR_AABITMAP(Escort_gauges[1].first_frame, Escort_coords[gr_screen.res][2][0], Escort_coords[gr_screen.res][2][1]); } // draw bottom of box GR_AABITMAP(Escort_gauges[2].first_frame, Escort_coords[gr_screen.res][3][0], Escort_coords[gr_screen.res][Num_escort_ships][1]); // multiplayer dogfight if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){ // draw the escort ship data for ( i = 0; i < Num_escort_ships; i++ ) { // oops. only show top 3 if(i > 2){ break; } // draw hud_escort_show_icon_dogfight(i); } } // everything else else { // draw the escort ship data for ( i = 0; i < Num_escort_ships; i++ ) { objp = &Objects[Escort_ships[i].objnum]; hud_escort_show_icon(i, objp); } }*/ #endif }