// draw the shield icon and integrity for the escort ship void hud_escort_show_icon(int x, int y, int index) { #ifndef NEW_HUD if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT) && index <= 2) { hud_escort_show_icon_dogfight(x, y, index); return; } float shields, integrity; int screen_integrity, offset; char buf[255]; object *objp = &Objects[Escort_ships[index].objnum]; ship *sp = &Ships[objp->instance]; // determine if its "friendly" or not // Goober5000 - changed in favor of just passing the team hud_escort_set_gauge_color(index, sp->team); /* if(Player_ship != NULL){ hud_escort_set_gauge_color(index, (sp->team == Player_ship->team) ? 1 : 0); } else { hud_escort_set_gauge_color(index, 1); } */ // draw a 'D' if a ship is disabled if ( (sp->flags & SF_DISABLED) || (ship_subsys_disrupted(sp, SUBSYSTEM_ENGINE)) ) { emp_hud_string( x + current_hud->Escort_status[0], y + current_hud->Escort_status[1], EG_NULL, XSTR( "D", 284)); } // print out ship name strcpy(buf, sp->ship_name); gr_force_fit_string(buf, 255, 100); emp_hud_string( x + current_hud->Escort_name[0], y + current_hud->Escort_name[1], EG_ESCORT1 + index, buf); // show ship integrity hud_get_target_strength(objp, &shields, &integrity); screen_integrity = fl2i(integrity*100 + 0.5f); offset = 0; if ( screen_integrity < 100 ) { offset = 2; if ( screen_integrity == 0 ) { if ( integrity > 0 ) { screen_integrity = 1; } } } emp_hud_printf( x+current_hud->Escort_integrity[0] + offset, y+current_hud->Escort_integrity[1], EG_NULL, "%d", screen_integrity); //Let's be nice. hud_set_gauge_color(HUD_ESCORT_VIEW); #endif }
// draw the shield icon and integrity for the escort ship void HudGaugeEscort::renderIcon(int x, int y, int index) { if(MULTI_DOGFIGHT && index <= 2) { renderIconDogfight(x, y, index); return; } float shields, integrity; int screen_integrity, offset; char buf[255]; object *objp = &Objects[Escort_ships[index].objnum]; ship *sp = &Ships[objp->instance]; // determine if its "friendly" or not // Goober5000 - changed in favor of just passing the team setGaugeColorEscort(index, sp->team); /* if(Player_ship != NULL){ hud_escort_set_gauge_color(index, (sp->team == Player_ship->team) ? 1 : 0); } else { hud_escort_set_gauge_color(index, 1); } */ // draw a 'D' if a ship is disabled if ( (sp->flags & SF_DISABLED) || (ship_subsys_disrupted(sp, SUBSYSTEM_ENGINE)) ) { renderString( x + ship_status_offsets[0], y + ship_status_offsets[1], EG_NULL, XSTR( "D", 284)); } // print out ship name strcpy_s(buf, sp->ship_name); gr_force_fit_string(buf, 255, ship_name_max_width); end_string_at_first_hash_symbol(buf); renderString( x + ship_name_offsets[0], y + ship_name_offsets[1], EG_ESCORT1 + index, buf); // show ship integrity hud_get_target_strength(objp, &shields, &integrity); screen_integrity = fl2i(integrity*100 + 0.5f); offset = 0; if ( screen_integrity < 100 ) { offset = 2; if ( screen_integrity == 0 ) { if ( integrity > 0 ) { screen_integrity = 1; } } } renderPrintf( x+ship_integrity_offsets[0] + offset, y+ship_integrity_offsets[1], EG_NULL, "%d", screen_integrity); //Let's be nice. setGaugeColor(); }
void radar_frame_render(float frametime) { float sensors_str; int ok_to_blit_radar; ok_to_blit_radar = 1; sensors_str = ship_get_subsystem_strength( Player_ship, SUBSYSTEM_SENSORS ); if ( ship_subsys_disrupted(Player_ship, SUBSYSTEM_SENSORS) ) { sensors_str = MIN_SENSOR_STR_TO_RADAR-1; } // note that on lowest skill level, there is no radar effects due to sensors damage if ( (Game_skill_level == 0) || (sensors_str > SENSOR_STR_RADAR_NO_EFFECTS) ) { Radar_static_playing = 0; Radar_static_next = 0; Radar_death_timer = 0; Radar_avail_prev_frame = 1; } else if ( sensors_str < MIN_SENSOR_STR_TO_RADAR ) { if ( Radar_avail_prev_frame ) { Radar_death_timer = timestamp(2000); Radar_static_next = 1; } Radar_avail_prev_frame = 0; } else { Radar_death_timer = 0; if ( Radar_static_next == 0 ) Radar_static_next = 1; } if ( timestamp_elapsed(Radar_death_timer) ) { ok_to_blit_radar = 0; } hud_set_gauge_color(HUD_RADAR); radar_blit_gauge(); radar_draw_range(); if ( timestamp_elapsed(Radar_static_next) ) { Radar_static_playing ^= 1; Radar_static_next = timestamp_rand(50, 750); } // if the emp effect is active, always draw the radar wackily if(emp_active_local()){ Radar_static_playing = 1; } if ( ok_to_blit_radar ) { if ( Radar_static_playing ) { radar_draw_blips_sorted(1); // passing 1 means to draw distorted if ( Radar_static_looping == -1 ) { Radar_static_looping = snd_play_looping(&Snds[SND_STATIC]); } } else { radar_draw_blips_sorted(); if ( Radar_static_looping != -1 ) { snd_stop(Radar_static_looping); Radar_static_looping = -1; } } } else { if ( Radar_static_looping != -1 ) { snd_stop(Radar_static_looping); Radar_static_looping = -1; } } }
void HudGaugeRadarDradis::render(float frametime) { float sensors_str; int ok_to_blit_radar; ok_to_blit_radar = 1; sensors_str = ship_get_subsystem_strength(Player_ship, SUBSYSTEM_SENSORS); if (ship_subsys_disrupted(Player_ship, SUBSYSTEM_SENSORS)) sensors_str = MIN_SENSOR_STR_TO_RADAR - 1; // note that on lowest skill level, there is no radar effects due to sensors damage if ((Game_skill_level == 0) || (sensors_str > SENSOR_STR_RADAR_NO_EFFECTS)) { Radar_static_playing = 0; Radar_static_next = 0; Radar_death_timer = 0; Radar_avail_prev_frame = 1; } else if (sensors_str < MIN_SENSOR_STR_TO_RADAR) { if (Radar_avail_prev_frame) { Radar_death_timer = timestamp(2000); Radar_static_next = 1; } Radar_avail_prev_frame = 0; } else { Radar_death_timer = 0; if (Radar_static_next == 0) Radar_static_next = 1; } if (timestamp_elapsed(Radar_death_timer)) ok_to_blit_radar = 0; setupViewHtl(); //WMC - This strikes me as a bit hackish bool g3_yourself = !g3_in_frame(); if(g3_yourself) g3_start_frame(1); drawSweeps(); if (timestamp_elapsed(Radar_static_next)) { Radar_static_playing ^= 1; Radar_static_next = timestamp_rand(50, 750); } // if the emp effect is active, always draw the radar wackily if (emp_active_local()) Radar_static_playing = 1; if (ok_to_blit_radar) { if (Radar_static_playing) { drawBlipsSorted(1); // passing 1 means to draw distorted if (Radar_static_looping == -1) Radar_static_looping = snd_play_looping(&Snds[SND_STATIC]); } else { drawBlipsSorted(0); if (Radar_static_looping != -1) { snd_stop(Radar_static_looping); Radar_static_looping = -1; } } } else { if (Radar_static_looping != -1) { snd_stop(Radar_static_looping); Radar_static_looping = -1; } } if(g3_yourself) g3_end_frame(); doneDrawingHtl(); }