diff --git a/code/hud/hud.cpp b/code/hud/hud.cpp index 20b7640df5b..c07964d182b 100644 --- a/code/hud/hud.cpp +++ b/code/hud/hud.cpp @@ -480,68 +480,100 @@ void HudGauge::setFont() font::set_font(font_num); } -void HudGauge::setGaugeColor(int bright_index) +void HudGauge::setGaugeColor(int bright_index, bool config) { int alpha; - // if we're drawing it as bright - if(bright_index != HUD_C_NONE){ - switch(bright_index){ - case HUD_C_DIM: - alpha = HUD_high_contrast ? HUD_NEW_ALPHA_DIM_HI : HUD_NEW_ALPHA_DIM; - gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); - break; - - case HUD_C_NORMAL: - alpha = HUD_high_contrast ? HUD_NEW_ALPHA_NORMAL_HI : HUD_NEW_ALPHA_NORMAL; - gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); - break; - - case HUD_C_BRIGHT: - alpha = HUD_high_contrast ? HUD_NEW_ALPHA_BRIGHT_HI : HUD_NEW_ALPHA_BRIGHT; - gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); - break; - - // intensity - default: - Assert((bright_index >= 0) && (bright_index < HUD_NUM_COLOR_LEVELS)); - if(bright_index < 0){ - bright_index = 0; - } - if(bright_index >= HUD_NUM_COLOR_LEVELS){ - bright_index = HUD_NUM_COLOR_LEVELS - 1; + if (config) { + color* use_color; + use_color = &HUD_config.clr[gauge_config]; + + if (hud_config_show_flag_is_set(gauge_config)) { + // Eventually we should allow custom gauges to use IFF colors maybe? Then we can unhardcode this + // and rely on the gauge data itself. But for now only specific gauges use iff and that's hard coded here + if (HC_gauge_regions[gr_screen.res][gauge_config].use_iff) { + // Ditto for target tagging color + if (HC_gauge_regions[gr_screen.res][gauge_config].color == 1) { + use_color = iff_get_color(IFF_COLOR_TAGGED, 0); + } else { + use_color = &Color_bright_red; + } } - // alpha = 255 - (255 / (bright_index + 1)); - // alpha = (int)((float)alpha * 1.5f); - int level = 255 / (HUD_NUM_COLOR_LEVELS); - alpha = level * bright_index; - if(alpha > 255){ + if ((HC_gauge_selected == gauge_config) || HC_select_all) { alpha = 255; + } else if (HC_gauge_hot == gauge_config) { + alpha = 200; + } else { + alpha = 150; } - if(alpha < 0){ - alpha = 0; - } - gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); - break; + gr_init_alphacolor(use_color, use_color->red, use_color->green, use_color->blue, alpha); + gr_set_color_fast(use_color); + } else { + // if its off, make it dark gray + gr_init_alphacolor(use_color, 127, 127, 127, 64); + gr_set_color_fast(use_color); } } else { - switch(maybeFlashSexp()) { - case 0: - alpha = HUD_high_contrast ? HUD_NEW_ALPHA_DIM_HI : HUD_NEW_ALPHA_DIM; - gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); - break; - case 1: - alpha = HUD_high_contrast ? HUD_NEW_ALPHA_BRIGHT_HI : HUD_NEW_ALPHA_BRIGHT; - gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); - break; - default: - alpha = HUD_high_contrast ? HUD_NEW_ALPHA_NORMAL_HI : HUD_NEW_ALPHA_NORMAL; - gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); + // if we're drawing it as bright + if (bright_index != HUD_C_NONE) { + switch (bright_index) { + case HUD_C_DIM: + alpha = HUD_high_contrast ? HUD_NEW_ALPHA_DIM_HI : HUD_NEW_ALPHA_DIM; + gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); + break; + + case HUD_C_NORMAL: + alpha = HUD_high_contrast ? HUD_NEW_ALPHA_NORMAL_HI : HUD_NEW_ALPHA_NORMAL; + gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); + break; + + case HUD_C_BRIGHT: + alpha = HUD_high_contrast ? HUD_NEW_ALPHA_BRIGHT_HI : HUD_NEW_ALPHA_BRIGHT; + gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); + break; + + // intensity + default: + Assert((bright_index >= 0) && (bright_index < HUD_NUM_COLOR_LEVELS)); + if (bright_index < 0) { + bright_index = 0; + } + if (bright_index >= HUD_NUM_COLOR_LEVELS) { + bright_index = HUD_NUM_COLOR_LEVELS - 1; + } + + // alpha = 255 - (255 / (bright_index + 1)); + // alpha = (int)((float)alpha * 1.5f); + int level = 255 / (HUD_NUM_COLOR_LEVELS); + alpha = level * bright_index; + if (alpha > 255) { + alpha = 255; + } + if (alpha < 0) { + alpha = 0; + } + gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); + break; + } + } else { + switch (maybeFlashSexp()) { + case 0: + alpha = HUD_high_contrast ? HUD_NEW_ALPHA_DIM_HI : HUD_NEW_ALPHA_DIM; + gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); + break; + case 1: + alpha = HUD_high_contrast ? HUD_NEW_ALPHA_BRIGHT_HI : HUD_NEW_ALPHA_BRIGHT; + gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); + break; + default: + alpha = HUD_high_contrast ? HUD_NEW_ALPHA_NORMAL_HI : HUD_NEW_ALPHA_NORMAL; + gr_init_alphacolor(&gauge_color, gauge_color.red, gauge_color.green, gauge_color.blue, alpha); + } } - } - gr_set_color_fast(&gauge_color); + gr_set_color_fast(&gauge_color); + } } bool HudGauge::isCustom() const @@ -716,7 +748,7 @@ void HudGauge::onFrame(float /*frametime*/) } -void HudGauge::render(float /*frametime*/) +void HudGauge::render(float /*frametime*/, bool /*config*/) { if(!custom_gauge) { return; @@ -739,83 +771,93 @@ void HudGauge::render(float /*frametime*/) } } -void HudGauge::renderString(int x, int y, const char *str) +void HudGauge::renderString(int x, int y, const char *str, float scale, bool config) { int nx = 0, ny = 0; + int resize = GR_RESIZE_FULL; - if ( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if ( reticle_follow ) { - nx = HUD_nose_x; - ny = HUD_nose_y; - - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } if (HUD_shadows) { gr_set_color_fast(&Color_black); - gr_string(x + nx + 1, y + ny + 1, str); + gr_string(x + nx + 1, y + ny + 1, str, resize, scale); gr_set_color_fast(&gauge_color); } - gr_string(x + nx, y + ny, str); + gr_string(x + nx, y + ny, str, resize, scale); gr_reset_screen_scale(); } -void HudGauge::renderString(int x, int y, int gauge_id, const char *str) +void HudGauge::renderString(int x, int y, int gauge_id, const char *str, float scale, bool config) { int nx = 0, ny = 0; + int resize = GR_RESIZE_FULL; - if ( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if ( reticle_follow ) { - nx = HUD_nose_x; - ny = HUD_nose_y; - - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } if ( gauge_id > -2 ) { if (HUD_shadows) { gr_set_color_fast(&Color_black); - emp_hud_string(x + nx + 1, y + ny + 1, gauge_id, str, GR_RESIZE_FULL); + emp_hud_string(x + nx + 1, y + ny + 1, gauge_id, str, resize, scale); gr_set_color_fast(&gauge_color); } - emp_hud_string(x + nx, y + ny, gauge_id, str, GR_RESIZE_FULL); + emp_hud_string(x + nx, y + ny, gauge_id, str, resize, scale); } else { if (HUD_shadows) { gr_set_color_fast(&Color_black); - gr_string(x + nx + 1, y + ny + 1, str); + gr_string(x + nx + 1, y + ny + 1, str, resize, scale); gr_set_color_fast(&gauge_color); } - gr_string(x + nx, y + ny, str); + gr_string(x + nx, y + ny, str, resize, scale); } gr_reset_screen_scale(); } -void HudGauge::renderStringAlignCenter(int x, int y, int area_width, const char *s) +void HudGauge::renderStringAlignCenter(int x, int y, int area_width, const char *s, float scale, bool config) { int w, h; - gr_get_string_size(&w, &h, s); - renderString(x + ((area_width - w) / 2), y, s); + gr_get_string_size(&w, &h, s, scale); + renderString(x + ((area_width - w) / 2), y, s, scale, config); } -void HudGauge::renderPrintf(int x, int y, const char* format, ...) +void HudGauge::renderPrintf(int x, int y, float scale, bool config, const char* format, ...) { char tmp[256] = ""; va_list args; @@ -826,10 +868,10 @@ void HudGauge::renderPrintf(int x, int y, const char* format, ...) va_end(args); tmp[sizeof(tmp)-1] = '\0'; - renderString(x, y, tmp); + renderString(x, y, tmp, scale, config); } -void HudGauge::renderPrintf(int x, int y, int gauge_id, const char* format, ...) +void HudGauge::renderPrintfWithGauge(int x, int y, int gauge_id, float scale, bool config, const char* format, ...) { char tmp[256] = ""; va_list args; @@ -840,10 +882,10 @@ void HudGauge::renderPrintf(int x, int y, int gauge_id, const char* format, ...) va_end(args); tmp[sizeof(tmp)-1] = '\0'; - renderString(x, y, gauge_id, tmp); + renderString(x, y, gauge_id, tmp, scale, config); } -void HudGauge::renderBitmapColor(int frame, int x, int y) +void HudGauge::renderBitmapColor(int frame, int x, int y, float scale, bool config) const { int nx = 0, ny = 0; @@ -853,27 +895,33 @@ void HudGauge::renderBitmapColor(int frame, int x, int y) emp_hud_jitter(&x, &y); - if ( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if ( reticle_follow ) { - nx = HUD_nose_x; - ny = HUD_nose_y; + int resize = GR_RESIZE_FULL; - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } gr_set_bitmap(frame); - gr_bitmap(x + nx, y + ny); + gr_bitmap(x + nx, y + ny, resize, false, scale); gr_reset_screen_scale(); } -void HudGauge::renderBitmap(int x, int y) +void HudGauge::renderBitmap(int x, int y, float scale, bool config) const { int nx = 0, ny = 0; @@ -882,34 +930,41 @@ void HudGauge::renderBitmap(int x, int y) } emp_hud_jitter(&x, &y); + + int resize = GR_RESIZE_FULL; - if ( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if ( reticle_follow ) { - nx = HUD_nose_x; - ny = HUD_nose_y; - - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } - gr_aabitmap(x + nx, y + ny); + gr_aabitmap(x + nx, y + ny, resize, false, scale); gr_reset_screen_scale(); } -void HudGauge::renderBitmap(int frame, int x, int y) +void HudGauge::renderBitmap(int frame, int x, int y, float scale, bool config) const { gr_set_bitmap(frame); - renderBitmap(x, y); + renderBitmap(x, y, scale, config); } -void HudGauge::renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int sy) +// Note that w, h, sx, and sy whould be unscaled values! +void HudGauge::renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int sy, float scale, bool config) const { int nx = 0, ny = 0; @@ -919,119 +974,150 @@ void HudGauge::renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int emp_hud_jitter(&x, &y); - gr_set_bitmap(frame); + int resize = GR_RESIZE_FULL; - if( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if ( reticle_follow ) { - nx = HUD_nose_x; - ny = HUD_nose_y; + gr_set_bitmap(frame); - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } - gr_aabitmap_ex(x + nx, y + ny, w, h, sx, sy); + gr_aabitmap_ex(x + nx, y + ny, w, h, sx, sy, resize, false, scale); gr_reset_screen_scale(); } -void HudGauge::renderLine(int x1, int y1, int x2, int y2) +void HudGauge::renderLine(int x1, int y1, int x2, int y2, bool config) const { int nx = 0, ny = 0; - if ( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if ( reticle_follow ) { - nx = HUD_nose_x; - ny = HUD_nose_y; + int resize = GR_RESIZE_FULL; - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } - gr_line(x1+nx, y1+ny, x2+nx, y2+ny); + gr_line(x1 + nx, y1 + ny, x2 + nx, y2 + ny, resize); gr_reset_screen_scale(); } -void HudGauge::renderGradientLine(int x1, int y1, int x2, int y2) +void HudGauge::renderGradientLine(int x1, int y1, int x2, int y2, bool config) const { int nx = 0, ny = 0; - if ( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if(reticle_follow) { - nx = HUD_nose_x; - ny = HUD_nose_y; + int resize = GR_RESIZE_FULL; - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } - gr_gradient(x1+nx, y1+ny, x2+nx, y2+ny); + gr_gradient(x1 + nx, y1 + ny, x2 + nx, y2 + ny, resize); gr_reset_screen_scale(); } -void HudGauge::renderRect(int x, int y, int w, int h) + void HudGauge::renderRect(int x, int y, int w, int h, bool config) const { int nx = 0, ny = 0; - if ( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if ( reticle_follow ) { - nx = HUD_nose_x; - ny = HUD_nose_y; + int resize = GR_RESIZE_FULL; - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } - gr_rect(x+nx, y+ny, w, h); + gr_rect(x + nx, y + ny, w, h, resize); gr_reset_screen_scale(); } -void HudGauge::renderCircle(int x, int y, int diameter, bool filled) +void HudGauge::renderCircle(int x, int y, int diameter, bool filled, bool config) const { int nx = 0, ny = 0; - if ( gr_screen.rendering_to_texture != -1 ) { - gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); - } else { - if ( reticle_follow ) { - nx = HUD_nose_x; - ny = HUD_nose_y; - - gr_resize_screen_pos(&nx, &ny); - gr_set_screen_scale(base_w, base_h); - gr_unsize_screen_pos(&nx, &ny); + int resize = GR_RESIZE_FULL; + + if (!config) { + if (gr_screen.rendering_to_texture != -1) { + gr_set_screen_scale(canvas_w, canvas_h, -1, -1, target_w, target_h, target_w, target_h, true); } else { - gr_set_screen_scale(base_w, base_h); + if (reticle_follow) { + nx = HUD_nose_x; + ny = HUD_nose_y; + + gr_resize_screen_pos(&nx, &ny); + gr_set_screen_scale(base_w, base_h); + gr_unsize_screen_pos(&nx, &ny); + } else { + gr_set_screen_scale(base_w, base_h); + } } + } else { + resize = HC_resize_mode; } + if (filled) { - gr_circle(x + nx, y + ny, diameter); + gr_circle(x + nx, y + ny, diameter, resize); } else { - gr_unfilled_circle(x + nx, y + ny, diameter); + gr_unfilled_circle(x + nx, y + ny, diameter, resize); } gr_reset_screen_scale(); @@ -1780,7 +1866,7 @@ void HudGaugeMissionTime::pageIn() bm_page_in_aabitmap(time_gauge.first_frame, time_gauge.num_frames ); } -void HudGaugeMissionTime::render(float /*frametime*/) +void HudGaugeMissionTime::render(float /*frametime*/, bool /*config*/) { float mission_time, time_comp; int minutes=0; @@ -1799,14 +1885,14 @@ void HudGaugeMissionTime::render(float /*frametime*/) } // print out mission time in MM:SS format - renderPrintf(position[0] + time_text_offsets[0], position[1] + time_text_offsets[1], NOX("%02d:%02d"), minutes, seconds); + renderPrintf(position[0] + time_text_offsets[0], position[1] + time_text_offsets[1], 1.0f, false, NOX("%02d:%02d"), minutes, seconds); // display time compression as xN time_comp = f2fl(Game_time_compression); if ( time_comp < 1 ) { - renderPrintf(position[0] + time_val_offsets[0], position[1] + time_val_offsets[1], /*XSTR( "x%.1f", 215), time_comp)*/ NOX("%.2f"), time_comp); + renderPrintf(position[0] + time_val_offsets[0], position[1] + time_val_offsets[1], 1.0f, false, /*XSTR( "x%.1f", 215), time_comp)*/ NOX("%.2f"), time_comp); } else { - renderPrintf(position[0] + time_val_offsets[0], position[1] + time_val_offsets[1], XSTR( "x%.0f", 216), time_comp); + renderPrintf(position[0] + time_val_offsets[0], position[1] + time_val_offsets[1], 1.0f, false, XSTR( "x%.0f", 216), time_comp); } } @@ -2124,7 +2210,7 @@ void HudGaugeDamage::pageIn() bm_page_in_aabitmap(damage_bottom.first_frame, damage_bottom.num_frames); } -void HudGaugeDamage::render(float /*frametime*/) +void HudGaugeDamage::render(float /*frametime*/, bool /*config*/) { model_subsystem *psub; ship_subsys *pss; @@ -2543,7 +2629,7 @@ int HudGaugeTextWarnings::maybeTextFlash() return flash_flags; } -void HudGaugeTextWarnings::render(float /*frametime*/) +void HudGaugeTextWarnings::render(float /*frametime*/, bool /*config*/) { // note: Hud_text_flash globally allocated, address can't be NULL if ( timestamp_elapsed(Hud_text_flash_timer) || Hud_text_flash[0] == '\0' ) { @@ -2601,7 +2687,7 @@ void HudGaugeKills::pageIn() /** * @brief Display the kills gauge on the HUD */ -void HudGaugeKills::render(float /*frametime*/) +void HudGaugeKills::render(float /*frametime*/, bool /*config*/) { if ( Kills_gauge.first_frame < 0 ) { return; @@ -2675,7 +2761,7 @@ bool HudGaugeLag::maybeFlashLag(bool flash_fast) return draw_bright; } -void HudGaugeLag::render(float /*frametime*/) +void HudGaugeLag::render(float /*frametime*/, bool /*config*/) { int lag_status; @@ -2966,7 +3052,7 @@ void HudGaugeSupport::pageIn() bm_page_in_aabitmap( background.first_frame, background.num_frames); } -void HudGaugeSupport::render(float /*frametime*/) +void HudGaugeSupport::render(float /*frametime*/, bool /*config*/) { int show_time, w, h; char outstr[64]; @@ -3109,7 +3195,7 @@ void HudGaugeSupport::render(float /*frametime*/) minutes = 99; seconds = 99; } - renderPrintf(position[0] + text_dock_val_offset_x, position[1] + text_val_offset_y, NOX("%02d:%02d"), minutes, seconds); + renderPrintf(position[0] + text_dock_val_offset_x, position[1] + text_val_offset_y, 1.0f, false, NOX("%02d:%02d"), minutes, seconds); } } @@ -3550,7 +3636,7 @@ bool HudGaugeObjectiveNotify::maybeFlashNotify(bool flash_fast) return draw_bright; } -void HudGaugeObjectiveNotify::render(float /*frametime*/) +void HudGaugeObjectiveNotify::render(float /*frametime*/, bool /*config*/) { renderSubspace(); renderRedAlert(); @@ -3998,7 +4084,7 @@ bool HudGaugeMultiMsg::canRender() const /** * @brief Render multiplayer text message currently being entered, if any */ -void HudGaugeMultiMsg::render(float /*frametime*/) +void HudGaugeMultiMsg::render(float /*frametime*/, bool /*config*/) { char txt[MULTI_MSG_MAX_TEXT_LEN+20]; @@ -4017,7 +4103,7 @@ HudGauge(HUD_OBJECT_VOICE_STATUS, HUD_MESSAGE_LINES, false, true, VM_EXTERNAL | { } -void HudGaugeVoiceStatus::render(float /*frametime*/) +void HudGaugeVoiceStatus::render(float /*frametime*/, bool /*config*/) { if(!(Game_mode & GM_MULTIPLAYER)){ return; @@ -4057,7 +4143,7 @@ HudGauge(HUD_OBJECT_PING, HUD_LAG_GAUGE, false, false, 0, 255, 255, 255) /** * @brief Render multiplayer ping time to the server, if appropriate */ -void HudGaugePing::render(float /*frametime*/) +void HudGaugePing::render(float /*frametime*/, bool /*config*/) { // If we shouldn't be displaying a ping time, return here if(!multi_show_ingame_ping()){ @@ -4090,7 +4176,7 @@ HudGauge(HUD_OBJECT_SUPERNOVA, HUD_DIRECTIVES_VIEW, false, false, 0, 255, 255, 2 { } -void HudGaugeSupernova::render(float /*frametime*/) +void HudGaugeSupernova::render(float /*frametime*/, bool /*config*/) { if (!supernova_active()) { return; @@ -4100,9 +4186,9 @@ void HudGaugeSupernova::render(float /*frametime*/) gr_set_color_fast(&Color_bright_red); if (Lcl_pl) { - renderPrintf(position[0], position[1], "Wybuch supernowej: %.2f s", time_left); + renderPrintf(position[0], position[1], 1.0f, false, "Wybuch supernowej: %.2f s", time_left); } else { - renderPrintf(position[0], position[1], XSTR( "Supernova Warning: %.2f s", 1639), time_left); + renderPrintf(position[0], position[1], 1.0f, false, XSTR("Supernova Warning: %.2f s", 1639), time_left); } } @@ -4126,7 +4212,7 @@ void HudGaugeFlightPath::initHalfSize(int w, int h) Marker_half[1] = h; } -void HudGaugeFlightPath::render(float /*frametime*/) +void HudGaugeFlightPath::render(float /*frametime*/, bool /*config*/) { object *obj; vec3d p0,v; diff --git a/code/hud/hud.h b/code/hud/hud.h index 9fb8a7d3de6..81213683e20 100644 --- a/code/hud/hud.h +++ b/code/hud/hud.h @@ -326,7 +326,7 @@ class HudGauge int popUpActive() const; virtual void preprocess(); - virtual void render(float frametime); + virtual void render(float frametime, bool config = false); virtual bool canRender() const; virtual void pageIn(); virtual void initialize(); @@ -337,25 +337,24 @@ class HudGauge void resetCockpitTarget(); void setFont(); - void setGaugeColor(int bright_index = HUD_C_NONE); + void setGaugeColor(int bright_index = HUD_C_NONE, bool config = false); void setGaugeCoords(int _x, int _y); void setGaugeFrame(int frame_offset); // rendering functions - void renderBitmap(int x, int y); - void renderBitmap(int frame, int x, int y); - void renderBitmapColor(int frame, int x, int y); - void renderBitmapUv(int frame, int x, int y, int w, int h, float u0, float v0, float u1, float v1); - void renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int sy); - void renderString(int x, int y, const char *str); - void renderString(int x, int y, int gauge_id, const char *str); - void renderStringAlignCenter(int x, int y, int area_width, const char *s); - void renderPrintf(int x, int y, SCP_FORMAT_STRING const char* format, ...) SCP_FORMAT_STRING_ARGS(4, 5); - void renderPrintf(int x, int y, int gauge_id, SCP_FORMAT_STRING const char* format, ...) SCP_FORMAT_STRING_ARGS(5, 6); - void renderLine(int x1, int y1, int x2, int y2); - void renderGradientLine(int x1, int y1, int x2, int y2); - void renderRect(int x, int y, int w, int h); - void renderCircle(int x, int y, int diameter, bool filled = true); + void renderBitmap(int x, int y, float scale = 1.0f, bool config = false) const; + void renderBitmap(int frame, int x, int y, float scale = 1.0f, bool config = false) const; + void renderBitmapColor(int frame, int x, int y, float scale = 1.0f, bool config = false) const; + void renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int sy, float scale = 1.0f, bool config = false) const; + void renderString(int x, int y, const char *str, float scale = 1.0f, bool config = false); + void renderString(int x, int y, int gauge_id, const char *str, float scale = 1.0f, bool config = false); + void renderStringAlignCenter(int x, int y, int area_width, const char *s, float scale = 1.0f, bool config = false); + void renderPrintf(int x, int y, float scale, bool config, SCP_FORMAT_STRING const char* format, ...) SCP_FORMAT_STRING_ARGS(6, 7); + void renderPrintfWithGauge(int x, int y, int gauge_id, float scale, bool config, SCP_FORMAT_STRING const char* format, ...) SCP_FORMAT_STRING_ARGS(7, 8); + void renderLine(int x1, int y1, int x2, int y2, bool config = false) const; + void renderGradientLine(int x1, int y1, int x2, int y2, bool config = false) const; + void renderRect(int x, int y, int w, int h, bool config = false) const; + void renderCircle(int x, int y, int diameter, bool filled = true, bool config = false) const; void unsize(int *x, int *y); void unsize(float *x, float *y); @@ -391,7 +390,7 @@ class HudGaugeMissionTime: public HudGauge // HUD_MISSION_TIME void initBitmaps(const char *fname); void initTextOffsets(int x, int y); void initValueOffsets(int x, int y); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -401,7 +400,7 @@ class HudGaugeTextWarnings: public HudGauge // HUD_TEXT_FLASH bool flash_flags; public: HudGaugeTextWarnings(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initialize() override; int maybeTextFlash(); }; @@ -417,7 +416,7 @@ class HudGaugeKills: public HudGauge void initBitmaps(const char *fname); void initTextOffsets(int x, int y); void initTextValueOffsets(int x, int y); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -430,7 +429,7 @@ class HudGaugeLag: public HudGauge public: HudGaugeLag(); void initBitmaps(const char *fname); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; void startFlashLag(int duration = 1400); @@ -461,7 +460,7 @@ class HudGaugeObjectiveNotify: public HudGauge void initRedAlertTextOffsetY(int y); void initRedAlertValueOffsetY(int y); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void startFlashNotify(int duration = 1400); bool maybeFlashNotify(bool flash_fast = false); void renderObjective(); @@ -525,7 +524,7 @@ class HudGaugeDamage: public HudGauge void initBottomBgOffset(int offset); void initLineHeight(int h); void initDisplayValue(bool value); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; void initialize() override; }; @@ -548,7 +547,7 @@ class HudGaugeSupport: public HudGauge void initTextDockOffsetX(int x); void initTextDockValueOffsetX(int x); void initRearmTimer(bool choice); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -558,7 +557,7 @@ class HudGaugeMultiMsg: public HudGauge public: HudGaugeMultiMsg(); bool canRender() const override; - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeVoiceStatus: public HudGauge @@ -566,7 +565,7 @@ class HudGaugeVoiceStatus: public HudGauge protected: public: HudGaugeVoiceStatus(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugePing: public HudGauge @@ -574,14 +573,14 @@ class HudGaugePing: public HudGauge protected: public: HudGaugePing(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeSupernova: public HudGauge { public: HudGaugeSupernova(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeFlightPath: public HudGauge3DAnchor @@ -593,7 +592,7 @@ class HudGaugeFlightPath: public HudGauge3DAnchor HudGaugeFlightPath(); void initBitmap(const char *fname); void initHalfSize(int w, int h); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; HudGauge *hud_get_custom_gauge(const char *name, bool check_all_gauges = false); diff --git a/code/hud/hudbrackets.cpp b/code/hud/hudbrackets.cpp index 94c14c11fd7..8f1d12b80e1 100644 --- a/code/hud/hudbrackets.cpp +++ b/code/hud/hudbrackets.cpp @@ -355,8 +355,13 @@ void HudGaugeBrackets::initBitmaps(char *fname) } } -void HudGaugeBrackets::render(float /*frametime*/) +void HudGaugeBrackets::render(float /*frametime*/, bool config) { + // Brackets are do not support config settings + if (config) { + return; + } + // don't display brackets if we're warping out. if ( Player->control_mode != PCM_NORMAL ) { return; diff --git a/code/hud/hudbrackets.h b/code/hud/hudbrackets.h index a280bf3ad4c..ccdcd1f4c32 100644 --- a/code/hud/hudbrackets.h +++ b/code/hud/hudbrackets.h @@ -41,7 +41,7 @@ class HudGaugeBrackets: public HudGauge3DAnchor void initMinTargetBoxSizes(int w, int h); void initMinSubTargetBoxSizes(int w, int h); void initBitmaps(char *fname); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void renderObjectBrackets(object *targetp, color *clr, int w_correction, int h_correction, int flags); void renderNavBrackets(vec3d* nav_pos, vertex* nav_point, color* clr, char* string); void renderBoundingBrackets(int x1, int y1, int x2, int y2, int w_correction, int h_correction, float distance, int target_objnum, int flags); diff --git a/code/hud/hudconfig.cpp b/code/hud/hudconfig.cpp index b08a1390aca..71644811579 100644 --- a/code/hud/hudconfig.cpp +++ b/code/hud/hudconfig.cpp @@ -310,6 +310,7 @@ int HC_gauge_description_coords[GR_NUM_RESOLUTIONS][3] = { } }; +int HC_resize_mode = GR_RESIZE_MENU; const char *HC_gauge_descriptions(int n) { switch(n) { @@ -512,6 +513,8 @@ static UI_WINDOW HC_ui_window; int HC_gauge_hot; // mouse is over this gauge int HC_gauge_selected; // gauge is selected float HC_gauge_scale; // scale used for drawing the hud gauges +int HC_gauge_coordinates[6]; // x1, x2, y1, y1, w, h of the example HUD render area. Used for calculating new gauge coordinates +BoundingBox HC_gauge_mouse_coords[NUM_HUD_GAUGES]; // HUD colors typedef struct hc_col { @@ -606,6 +609,11 @@ void hud_config_init_ui(bool API_Access, int x, int y, int w) HC_gauge_coords.clear(); HC_gauge_coords.resize(NUM_HUD_GAUGES); + // Clear the mouse coords array + for (auto& coord : HC_gauge_mouse_coords) { + coord = {-1, -1, -1, -1}; + } + if (w < 0) { HC_gauge_scale = 1.0f; } else { @@ -851,6 +859,44 @@ void hud_config_popup_flag_clear(int i) } } +void hud_config_set_mouse_coords(int gauge_config, int x1, int x2, int y1, int y2) { + HC_gauge_mouse_coords[gauge_config] = {x1, x2, y1, y2}; +} + +void hud_config_convert_coords(int x, int y, float scale, int& outX, int& outY) +{ + outX = HC_gauge_coordinates[0] + static_cast(x * scale); + outY = HC_gauge_coordinates[2] + static_cast(y * scale); +} + +void hud_config_convert_coords(float x, float y, float scale, float& outX, float& outY) +{ + outX = HC_gauge_coordinates[0] + x * scale; + outY = HC_gauge_coordinates[2] + y * scale; +} + +void hud_config_get_scale(int baseW, int baseH, float& outScale) +{ + // Determine the scaling factor + float scaleX = static_cast(HC_gauge_coordinates[4]) / baseW; + float scaleY = static_cast(HC_gauge_coordinates[5]) / baseH; + + // Use the smallest scale factor + outScale = std::min(scaleX, scaleY); +} + +void hud_config_convert_coord_sys(int x, int y, int baseW, int baseH, int& outX, int& outY, float& outScale) +{ + hud_config_get_scale(baseW, baseH, outScale); + hud_config_convert_coords(x, y, outScale, outX, outY); +} + +void hud_config_convert_coord_sys(float x, float y, int baseW, int baseH, float& outX, float& outY, float& outScale) +{ + hud_config_get_scale(baseW, baseH, outScale); + hud_config_convert_coords(x, y, outScale, outX, outY); +} + /*! * @brief render all the hud config gauges * diff --git a/code/hud/hudconfig.h b/code/hud/hudconfig.h index 37219712b38..965f4dd6788 100644 --- a/code/hud/hudconfig.h +++ b/code/hud/hudconfig.h @@ -53,6 +53,9 @@ extern int HUD_default_popup_mask2; extern int HUD_config_default_flags; extern int HUD_config_default_flags2; +extern const int HC_gauge_config_coords[GR_NUM_RESOLUTIONS][4]; +extern int HC_resize_mode; + /** * @brief Contains core HUD configuration data * @note Is not default init'd. Assumes new player, PLR, or CSG reads will correctly set data. @@ -92,6 +95,45 @@ struct HC_gauge_region HC_gauge_region(const char *name, int x1, int y1, int h, int iff, int cp, int b, int nf, int cl) : filename(name), x(x1), y(y1), hotspot(h), use_iff(iff), can_popup(cp), bitmap(b), nframes(nf), color(cl){} }; +class BoundingBox { + public: + int x1, x2, y1, y2; + + // Default constructor (initializes to invalid state) + BoundingBox() : x1(-1), x2(-1), y1(-1), y2(-1) {} + + // Constructor + BoundingBox(int nx1, int nx2, int ny1, int ny2) : x1(nx1), x2(nx2), y1(ny1), y2(ny2) {} + + bool isOverlapping(const BoundingBox& other) const + { + return (x2 >= other.x1 && // Not completely to the left + x1 <= other.x2 && // Not completely to the right + y2 >= other.y1 && // Not completely above + y1 <= other.y2); // Not completely below + } + + // Check if the bounding box is valid (no negative coordinates) + bool isValid() const + { + return x1 >= 0 && x2 >= 0 && y1 >= 0 && y2 >= 0; + } + + // Static function to check if any bounding box in an array overlaps with a new one + static bool isOverlappingAny(const BoundingBox mouse_coords[NUM_HUD_GAUGES], const BoundingBox& newBox, int self_index) + { + for (int i = 0; i < NUM_HUD_GAUGES; i++) { + if (i == self_index) { + continue; + } + if (mouse_coords[i].isValid() && mouse_coords[i].isOverlapping(newBox)) { + return true; + } + } + return false; + } +}; + /*! * @brief Array of hud gauges to be displayed in the hud config ui and configured by the player * @note main definition in hudconfig.cpp @@ -102,6 +144,8 @@ extern int HC_gauge_hot; extern int HC_gauge_selected; extern int HC_select_all; extern float HC_gauge_scale; +extern int HC_gauge_coordinates[6]; // x1, x2, y1, y2, w, h for gauge rendering +extern BoundingBox HC_gauge_mouse_coords[NUM_HUD_GAUGES]; const char* HC_gauge_descriptions(int n); @@ -203,5 +247,37 @@ void hud_config_color_load(const char *name); */ void hud_config_color_save(const char* name); +/*! + * @brief same as hud_config_covert_coords but only returns the scale and doesn't convert any coords + */ +void hud_config_get_scale(int baseW, int baseH, float& outScale); + +/*! + * @brief converts a set of coordinates to HUD Config's rendering coordinates + */ +void hud_config_convert_coords(int x, int y, float scale, int& outX, int& outY); + +/*! + * @brief converts a set of coordinates to HUD Config's rendering coordinates + */ +void hud_config_convert_coords(float x, float y, float scale, float& outX, float& outY); + +/*! +* @brief convert the given HUD gauge position coordinates to a set more appropriate for the HUD Config UI and return the smaller scale value used +* so that other offsets and positions can be multiplied in turn +*/ +void hud_config_convert_coord_sys(int x, int y, int baseW, int baseH, int& outX, int& outY, float& outScale); + +/*! + * @brief convert the given HUD gauge position coordinates to a set more appropriate for the HUD Config UI and return + * the smaller scale value used so that other offsets and positions can be multiplied in turn + */ +void hud_config_convert_coord_sys(float x, float y, int baseW, int baseH, float& outX, float& outY, float& outScale); + +/*! + * @brief save gauge coords during rendering time so hud config can check if the mouse is hovering over the gauge + */ +void hud_config_set_mouse_coords(int gauge_config, int x1, int x2, int y1, int y2); + #endif diff --git a/code/hud/hudescort.cpp b/code/hud/hudescort.cpp index 24f859e607e..2277174c99b 100644 --- a/code/hud/hudescort.cpp +++ b/code/hud/hudescort.cpp @@ -234,7 +234,7 @@ int HudGaugeEscort::setGaugeColorEscort(int index, int team) return is_flashing; } -void HudGaugeEscort::render(float /*frametime*/) +void HudGaugeEscort::render(float /*frametime*/, bool /*config*/) { int i = 0; @@ -398,7 +398,7 @@ void HudGaugeEscort::renderIcon(int x, int y, int index) } } } - renderPrintf( x+ship_integrity_offsets[0] + offset, y+ship_integrity_offsets[1], EG_NULL, "%d", screen_integrity); + renderPrintfWithGauge( x+ship_integrity_offsets[0] + offset, y+ship_integrity_offsets[1], EG_NULL, 1.0f, false, "%d", screen_integrity); //Let's be nice. setGaugeColor(); @@ -453,9 +453,9 @@ void HudGaugeEscort::renderIconDogfight(int x, int y, int index) // show ship integrity if(objp == NULL){ - renderPrintf( x+ship_integrity_offsets[0] - stat_shift, y+ship_integrity_offsets[1], EG_NULL, "%d", Net_players[np_index].m_player->stats.m_kill_count_ok); + renderPrintfWithGauge( x+ship_integrity_offsets[0] - stat_shift, y+ship_integrity_offsets[1], EG_NULL, 1.0f, false, "%d", Net_players[np_index].m_player->stats.m_kill_count_ok); } else { - renderPrintf( x+ship_integrity_offsets[0] - stat_shift, y+ship_integrity_offsets[1], EG_NULL, "(%d%%) %d", hull_integrity, Net_players[np_index].m_player->stats.m_kill_count_ok); + renderPrintfWithGauge( x+ship_integrity_offsets[0] - stat_shift, y+ship_integrity_offsets[1], EG_NULL, 1.0f, false, "(%d%%) %d", hull_integrity, Net_players[np_index].m_player->stats.m_kill_count_ok); } } diff --git a/code/hud/hudescort.h b/code/hud/hudescort.h index 243fc0af88b..9172927f18e 100644 --- a/code/hud/hudescort.h +++ b/code/hud/hudescort.h @@ -68,7 +68,7 @@ class HudGaugeEscort: public HudGauge void initShipNameMaxWidth(int w); void initRightAlignNames(bool align); int setGaugeColorEscort(int index, int team); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; void renderIcon(int x, int y, int index); void renderIconDogfight(int x, int y, int index); diff --git a/code/hud/hudets.cpp b/code/hud/hudets.cpp index 5172a9a679d..f2e5a92a9ce 100644 --- a/code/hud/hudets.cpp +++ b/code/hud/hudets.cpp @@ -887,7 +887,7 @@ void HudGaugeEts::initBitmaps(char *fname) } } -void HudGaugeEts::render(float /*frametime*/) +void HudGaugeEts::render(float /*frametime*/, bool /*config*/) { } @@ -989,7 +989,7 @@ HudGaugeEts(HUD_OBJECT_ETS_RETAIL, 0) /** * Render the ETS retail gauge to the screen (weapon+shield+engine) */ -void HudGaugeEtsRetail::render(float /*frametime*/) +void HudGaugeEtsRetail::render(float /*frametime*/, bool /*config*/) { int i; int initial_position; @@ -1015,17 +1015,17 @@ void HudGaugeEtsRetail::render(float /*frametime*/) if (ship_has_energy_weapons(ship_p)) { Letter = Letters[0]; position[0] = Gauge_positions[initial_position++]; - renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], 1.0f, false, NOX("%c"), Letter); } if (!(Player_obj->flags[Object::Object_Flags::No_shields])) { Letter = Letters[1]; position[0] = Gauge_positions[initial_position++]; - renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], 1.0f, false, NOX("%c"), Letter); } if (ship_has_engine_power(ship_p)) { Letter = Letters[2]; position[0] = Gauge_positions[initial_position++]; - renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], 1.0f, false, NOX("%c"), Letter); } // draw gauges, skipping any gauge that is missing @@ -1073,7 +1073,7 @@ HudGaugeEts(HUD_OBJECT_ETS_WEAPONS, (int)WEAPONS) { } -void HudGaugeEtsWeapons::render(float /*frametime*/) +void HudGaugeEtsWeapons::render(float /*frametime*/, bool /*config*/) { int i; @@ -1099,7 +1099,7 @@ void HudGaugeEtsWeapons::render(float /*frametime*/) setGaugeColor(); // draw the letters for the gauge first, before any clipping occurs - renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], 1.0f, false, NOX("%c"), Letter); // draw the gauges for the weapon system blitGauge(ship_p->weapon_recharge_index); @@ -1110,7 +1110,7 @@ HudGaugeEts(HUD_OBJECT_ETS_SHIELDS, (int)SHIELDS) { } -void HudGaugeEtsShields::render(float /*frametime*/) +void HudGaugeEtsShields::render(float /*frametime*/, bool /*config*/) { int i; @@ -1135,7 +1135,7 @@ void HudGaugeEtsShields::render(float /*frametime*/) setGaugeColor(); // draw the letters for the gauge first, before any clipping occurs - renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], 1.0f, false, NOX("%c"), Letter); // draw the gauge for the shield system blitGauge(ship_p->shield_recharge_index); @@ -1146,7 +1146,7 @@ HudGaugeEts(HUD_OBJECT_ETS_ENGINES, (int)ENGINES) { } -void HudGaugeEtsEngines::render(float /*frametime*/) +void HudGaugeEtsEngines::render(float /*frametime*/, bool /*config*/) { int i; @@ -1171,7 +1171,7 @@ void HudGaugeEtsEngines::render(float /*frametime*/) setGaugeColor(); // draw the letters for the gauge first, before any clipping occurs - renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], 1.0f, false, NOX("%c"), Letter); // draw the gauge for the engine system blitGauge(ship_p->engine_recharge_index); diff --git a/code/hud/hudets.h b/code/hud/hudets.h index 7a12ab93409..be29657321f 100644 --- a/code/hud/hudets.h +++ b/code/hud/hudets.h @@ -80,7 +80,7 @@ class HudGaugeEts: public HudGauge // HUD_ETS_GAUGE void initBarHeight(int _ets_bar_h); void initBitmaps(char *fname); void blitGauge(int index); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -88,21 +88,21 @@ class HudGaugeEtsWeapons: public HudGaugeEts { public: HudGaugeEtsWeapons(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeEtsShields: public HudGaugeEts { public: HudGaugeEtsShields(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeEtsEngines: public HudGaugeEts { public: HudGaugeEtsEngines(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeEtsRetail: public HudGaugeEts @@ -112,7 +112,7 @@ class HudGaugeEtsRetail: public HudGaugeEts int Gauge_positions[num_retail_ets_gauges]; public: HudGaugeEtsRetail(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initLetters(char *_letters); void initGaugePositions(int *_gauge_positions); }; diff --git a/code/hud/hudlock.cpp b/code/hud/hudlock.cpp index d4e47b647f2..d74a060446f 100644 --- a/code/hud/hudlock.cpp +++ b/code/hud/hudlock.cpp @@ -279,7 +279,7 @@ void HudGaugeLock::renderOld(float frametime) // lock_point_pos should be the world coordinates of the target being locked. Assuming all the // necessary locking calculations are done for this frame, this function will compute // where the indicator should be relative to the player's viewpoint and will render accordingly. -void HudGaugeLock::render(float frametime) +void HudGaugeLock::render(float frametime, bool /*config*/) { size_t i; lock_info *current_lock; diff --git a/code/hud/hudlock.h b/code/hud/hudlock.h index d87afcfad7d..9be7f7dde10 100644 --- a/code/hud/hudlock.h +++ b/code/hud/hudlock.h @@ -58,7 +58,7 @@ class HudGaugeLock: public HudGauge3DAnchor void initLoopLockedAnim(bool loop); void initBlinkLockedAnim(bool blink); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void renderOld(float frametime); void renderLockTriangles(int center_x, int center_y, float frametime); void renderLockTrianglesNew(int center_x, int center_y, float frametime, lock_info *slot); diff --git a/code/hud/hudmessage.cpp b/code/hud/hudmessage.cpp index 136e75000e7..07d117240da 100644 --- a/code/hud/hudmessage.cpp +++ b/code/hud/hudmessage.cpp @@ -437,7 +437,7 @@ void HudGaugeMessages::preprocess() * HudGaugeMessages::render() will display the active HUD messages on the HUD. It will scroll * the messages up when a new message arrives. */ -void HudGaugeMessages::render(float /*frametime*/) +void HudGaugeMessages::render(float /*frametime*/, bool /*config*/) { hud_set_default_color(); @@ -459,7 +459,7 @@ void HudGaugeMessages::render(float /*frametime*/) } // print the message out - renderPrintf(m->msg.x, m->y, "%s", m->msg.text.c_str()); + renderPrintf(m->msg.x, m->y, 1.0f, false, "%s", m->msg.text.c_str()); } } } @@ -1176,7 +1176,7 @@ void HudGaugeTalkingHead::initBitmaps(const char *fname) * Renders everything for a head animation * Also checks for when new head ani's need to start playing */ -void HudGaugeTalkingHead::render(float frametime) +void HudGaugeTalkingHead::render(float frametime, bool /*config*/) { if ( Head_frame.first_frame == -1 ){ return; @@ -1336,7 +1336,7 @@ void HudGaugeFixedMessages::initCenterText(bool center) { center_text = center; } -void HudGaugeFixedMessages::render(float /*frametime*/) { +void HudGaugeFixedMessages::render(float /*frametime*/, bool /*config*/) { HUD_ft *hp; hp = &HUD_fixed_text[0]; diff --git a/code/hud/hudmessage.h b/code/hud/hudmessage.h index 81dfbbcfbe0..4599cf3a045 100644 --- a/code/hud/hudmessage.h +++ b/code/hud/hudmessage.h @@ -112,7 +112,7 @@ class HudGaugeMessages: public HudGauge // HUD_MESSAGE_LINES void addPending(const char *text, int source, int x = 0); void scrollMessages(); void preprocess() override; - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initialize() override; void pageIn() override; }; @@ -135,7 +135,7 @@ class HudGaugeTalkingHead: public HudGauge // HUD_TALKING_HEAD void initAnimOffsets(int x, int y); void initAnimSizes(int w, int h); void pageIn() override; - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initialize() override; bool canRender() const override; }; @@ -146,7 +146,7 @@ class HudGaugeFixedMessages: public HudGauge public: HudGaugeFixedMessages(); void initCenterText(bool center); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; diff --git a/code/hud/hudreticle.cpp b/code/hud/hudreticle.cpp index 798f05b9332..1466414b62b 100644 --- a/code/hud/hudreticle.cpp +++ b/code/hud/hudreticle.cpp @@ -11,6 +11,7 @@ #include "gamesnd/gamesnd.h" +#include "hud/hudconfig.h" #include "hud/hudreticle.h" #include "hud/hudtargetbox.h" #include "io/timer.h" @@ -249,7 +250,7 @@ void HudGaugeReticle::initFirepointDisplay(bool firepoint, int scaleX, int scale firepoint_size = size; } -void HudGaugeReticle::render(float /*frametime*/) +void HudGaugeReticle::render(float /*frametime*/, bool /*config*/) { if (crosshair.first_frame < 0) { return; @@ -631,7 +632,7 @@ void HudGaugeThrottle::pageIn() bm_page_in_aabitmap( throttle_frames.first_frame, throttle_frames.num_frames); } -void HudGaugeThrottle::render(float /*frametime*/) +void HudGaugeThrottle::render(float /*frametime*/, bool /*config*/) { if (throttle_frames.first_frame < 0) { return; @@ -736,11 +737,11 @@ void HudGaugeThrottle::render(float /*frametime*/) renderThrottleForeground(y_end); if ( Show_max_speed ) { - renderPrintf(position[0] + Max_speed_offsets[0], position[1] + Max_speed_offsets[1], "%d", (int)std::lround(max_displayed_speed)); + renderPrintf(position[0] + Max_speed_offsets[0], position[1] + Max_speed_offsets[1], 1.0f, false, "%d", (int)std::lround(max_displayed_speed)); } if ( Show_min_speed ) { - renderPrintf(position[0] + Zero_speed_offsets[0], position[1] + Zero_speed_offsets[1], "%s", XSTR( "0", 292)); + renderPrintf(position[0] + Zero_speed_offsets[0], position[1] + Zero_speed_offsets[1], 1.0f, false, "%s", XSTR( "0", 292)); } } @@ -769,7 +770,7 @@ void HudGaugeThrottle::renderThrottleSpeed(float current_speed, int y_end) sy = position[1] + Orbit_center_offsets[1]; } - renderPrintf(sx, sy, "%s", buf); + renderPrintf(sx, sy, 1.0f, false, "%s", buf); if ( object_get_gliding(Player_obj) ) { auto glide_str = XSTR("GLIDE", 1668); @@ -850,13 +851,13 @@ void HudGaugeThrottle::renderMatchSpeedIcon(int x, int y) renderRect(x, y, Match_speed_icon_width + 2, gr_get_font_height() + 2); gr_set_color_fast(&Color_black); - renderPrintf(x + 1, y + 1, "%c", Match_speed_icon); + renderPrintf(x + 1, y + 1, 1.0f, false, "%c", Match_speed_icon); setGaugeColor(); } else { - renderPrintf(x, y, "%c", Match_speed_icon); + renderPrintf(x, y, 1.0f, false, "%c", Match_speed_icon); } } @@ -913,7 +914,7 @@ void HudGaugeThreatIndicator::pageIn() bm_page_in_aabitmap(lock_warn.first_frame, lock_warn.num_frames); } -void HudGaugeThreatIndicator::render(float /*frametime*/) +void HudGaugeThreatIndicator::render(float /*frametime*/, bool /*config*/) { setGaugeColor(); @@ -1067,7 +1068,7 @@ void HudGaugeWeaponLinking::pageIn() } } -void HudGaugeWeaponLinking::render(float /*frametime*/) +void HudGaugeWeaponLinking::render(float /*frametime*/, bool /*config*/) { int gauge_index=0, frame_offset=0; ship_weapon *swp; diff --git a/code/hud/hudreticle.h b/code/hud/hudreticle.h index f6424b092c5..031599ae170 100644 --- a/code/hud/hudreticle.h +++ b/code/hud/hudreticle.h @@ -47,7 +47,7 @@ class HudGaugeReticle: public HudGauge int flight_cursor_frame_offset; public: HudGaugeReticle(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initBitmaps(char *fname); void pageIn() override; void initFirepointDisplay(bool firepoint, int scaleX, int scaleY, int size); @@ -106,12 +106,12 @@ class HudGaugeThrottle: public HudGauge void showBackground(bool show); void initBitmaps(char *fname); - void render(float frametime) override; void renderThrottleSpeed(float current_speed, int y_end); void renderThrottleLine(int y); void renderThrottleForeground(int y_end); void renderThrottleBackground(int y_end); void renderMatchSpeedIcon(int x, int y); + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -137,7 +137,7 @@ class HudGaugeThreatIndicator: public HudGauge void initBitmaps(char *fname_arc, char *fname_laser, char *fname_lock); void initLaserWarnOffsets(int x, int y); void initLockWarnOffsets(int x, int y); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initialize() override; void pageIn() override; void renderLaserThreat(); @@ -164,7 +164,7 @@ class HudGaugeWeaponLinking: public HudGauge char *fname_secondary_link_1, char *fname_secondary_link_2, char *fname_secondary_link_3); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; diff --git a/code/hud/hudscripting.cpp b/code/hud/hudscripting.cpp index f5fef707c7f..8bb78e9de9f 100644 --- a/code/hud/hudscripting.cpp +++ b/code/hud/hudscripting.cpp @@ -18,7 +18,7 @@ HudGaugeScripting::HudGaugeScripting() : 255) { } -void HudGaugeScripting::render(float /*frametime*/) { +void HudGaugeScripting::render(float /*frametime*/, bool /*config*/) { using namespace scripting::api; if (!_renderFunction.isValid()) { diff --git a/code/hud/hudscripting.h b/code/hud/hudscripting.h index f5d83341497..e3be3240892 100644 --- a/code/hud/hudscripting.h +++ b/code/hud/hudscripting.h @@ -9,7 +9,7 @@ class HudGaugeScripting: public HudGauge { public: HudGaugeScripting(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initName(SCP_string name); diff --git a/code/hud/hudshield.cpp b/code/hud/hudshield.cpp index 8e8462ad16f..92bba856fb9 100644 --- a/code/hud/hudshield.cpp +++ b/code/hud/hudshield.cpp @@ -546,7 +546,7 @@ HudGauge(_gauge_object, _gauge_config, false, false, (VM_EXTERNAL | VM_DEAD_VIEW { } -void HudGaugeShield::render(float /*frametime*/) +void HudGaugeShield::render(float /*frametime*/, bool /*config*/) { } @@ -872,7 +872,7 @@ HudGaugeShield(HUD_OBJECT_PLAYER_SHIELD, HUD_PLAYER_SHIELD_ICON) { } -void HudGaugeShieldPlayer::render(float /*frametime*/) +void HudGaugeShieldPlayer::render(float /*frametime*/, bool /*config*/) { showShields(Player_obj, SHIELD_HIT_PLAYER); } @@ -883,7 +883,7 @@ HudGaugeShield(HUD_OBJECT_TARGET_SHIELD, HUD_TARGET_SHIELD_ICON) } -void HudGaugeShieldTarget::render(float /*frametime*/) +void HudGaugeShieldTarget::render(float /*frametime*/, bool /*config*/) { if (Player_ai->target_objnum == -1) return; @@ -932,7 +932,7 @@ void HudGaugeShieldMini::initBitmaps(const char *fname) } } -void HudGaugeShieldMini::render(float /*frametime*/) +void HudGaugeShieldMini::render(float /*frametime*/, bool /*config*/) { if (Player_ai->target_objnum == -1) return; diff --git a/code/hud/hudshield.h b/code/hud/hudshield.h index c3adefb7945..2105422df8f 100644 --- a/code/hud/hudshield.h +++ b/code/hud/hudshield.h @@ -57,8 +57,8 @@ class HudGaugeShield: public HudGauge public: HudGaugeShield(); HudGaugeShield(int _gauge_object, int _gauge_config); - void render(float frametime) override; void showShields(const object *objp, int mode); + void render(float frametime, bool config = false) override; int maybeFlashShield(int target_index, int shield_offset); void renderShieldIcon(coord2d coords[6]); }; @@ -68,7 +68,7 @@ class HudGaugeShieldPlayer: public HudGaugeShield protected: public: HudGaugeShieldPlayer(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeShieldTarget: public HudGaugeShield @@ -76,7 +76,7 @@ class HudGaugeShieldTarget: public HudGaugeShield protected: public: HudGaugeShieldTarget(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeShieldMini: public HudGauge @@ -96,7 +96,7 @@ class HudGaugeShieldMini: public HudGauge int maybeFlashShield(int target_index, int shield_offset); void showMiniShields(const object *objp); void showIntegrity(float p_target_integrity); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; #endif /* __FREESPACE_HUDSHIELDBOX_H__ */ diff --git a/code/hud/hudsquadmsg.cpp b/code/hud/hudsquadmsg.cpp index b6a9a981c08..f328bf5995a 100644 --- a/code/hud/hudsquadmsg.cpp +++ b/code/hud/hudsquadmsg.cpp @@ -2662,7 +2662,7 @@ bool HudGaugeSquadMessage::canRender() const return true; } -void HudGaugeSquadMessage::render(float /*frametime*/) +void HudGaugeSquadMessage::render(float /*frametime*/, bool /*config*/) { char *title; int bx, by, sx, sy, i, nitems, none_valid, messaging_allowed; @@ -2740,7 +2740,7 @@ void HudGaugeSquadMessage::render(float /*frametime*/) // first do the number item_num = (i+1) % MAX_MENU_DISPLAY; - renderPrintf(sx, sy, EG_SQ1 + i, NOX("%1d."), item_num); + renderPrintfWithGauge(sx, sy, EG_SQ1 + i, 1.0f, false, NOX("%1d."), item_num); // then the text renderString(sx + Item_offset_x, sy, EG_SQ1 + i, text); @@ -2777,22 +2777,22 @@ void HudGaugeSquadMessage::render(float /*frametime*/) startFlashPageScroll(); maybeFlashPageScroll(); if ( First_menu_item > 0 ) { - renderPrintf(position[0] + Pgup_offsets[0], position[1] + Pgup_offsets[1], "%s", XSTR( "[pgup]", 312) ); + renderPrintf(position[0] + Pgup_offsets[0], position[1] + Pgup_offsets[1], 1.0f, false, "%s", XSTR( "[pgup]", 312) ); } if ( (First_menu_item + nitems) < Num_menu_items ) { - renderPrintf(position[0] + Pgdn_offsets[0], position[1] + Pgdn_offsets[1], "%s", XSTR( "[pgdn]", 313)); + renderPrintf(position[0] + Pgdn_offsets[0], position[1] + Pgdn_offsets[1], 1.0f, false, "%s", XSTR( "[pgdn]", 313)); } if ( messaging_allowed ) { if ( none_valid ){ - renderPrintf( sx, by - Item_h + 2, "%s", XSTR( "No valid items", 314)); + renderPrintf(sx, by - Item_h + 2, 1.0f, false, "%s", XSTR("No valid items", 314)); } else if (Msg_shortcut_command != -1){ - renderPrintf( sx, by - Item_h + 2, "%s", comm_order_get_text(Msg_shortcut_command)); + renderPrintf(sx, by - Item_h + 2, 1.0f, false, "%s", comm_order_get_text(Msg_shortcut_command)); } } else { // if this player is not allowed to message, then display message saying so - renderPrintf( sx, by - Item_h + 2, "%s", XSTR( "Not allowed to message", 315)); + renderPrintf(sx, by - Item_h + 2, 1.0f, false, "%s", XSTR("Not allowed to message", 315)); } } diff --git a/code/hud/hudsquadmsg.h b/code/hud/hudsquadmsg.h index f87bfeffca3..0f2c36c6caf 100644 --- a/code/hud/hudsquadmsg.h +++ b/code/hud/hudsquadmsg.h @@ -212,7 +212,7 @@ class HudGaugeSquadMessage: public HudGauge void initPgUpOffsets(int x, int y); void initPgDnOffsets(int x, int y); - void render(float frametime) override; + void render(float frametime, bool config = false) override; bool canRender() const override; void pageIn() override; void initialize() override; diff --git a/code/hud/hudtarget.cpp b/code/hud/hudtarget.cpp index b04cce8c34a..05aab902b41 100644 --- a/code/hud/hudtarget.cpp +++ b/code/hud/hudtarget.cpp @@ -2909,8 +2909,7 @@ void HudGaugeReticleTriangle::initTriHeight(float h) Target_triangle_height = h; } -void HudGaugeReticleTriangle::render(float /*frametime*/) -{ +void HudGaugeReticleTriangle::render(float /*frametime*/, bool /*config*/) { } // Render a missile warning triangle that has a tail on it to indicate distance @@ -3162,7 +3161,7 @@ HudGaugeReticleTriangle(HUD_OBJECT_MISSILE_TRI, HUD_MISSILE_WARNING_ARROW) { } -void HudGaugeMissileTriangles::render(float /*frametime*/) +void HudGaugeMissileTriangles::render(float /*frametime*/, bool /*config*/) { object *A; missile_obj *mo; @@ -3211,7 +3210,7 @@ void HudGaugeOrientationTee::pageIn() // outer reticle ring. If the T is at 12 o'clock, the target is facing the player, if the T // is at 6 o'clock the target is facing away from the player. If the T is at 3 or 9 o'clock // the target is facing 90 away from the player. -void HudGaugeOrientationTee::render(float /*frametime*/) +void HudGaugeOrientationTee::render(float /*frametime*/, bool /*config*/) { object* targetp; @@ -3674,7 +3673,7 @@ HudGaugeReticleTriangle(HUD_OBJECT_HOSTILE_TRI, HUD_HOSTILE_TRIANGLE) { } -void HudGaugeHostileTriangle::render(float /*frametime*/) +void HudGaugeHostileTriangle::render(float /*frametime*/, bool /*config*/) { if (hostile_obj && maybeFlashSexp() != 1) { bool in_frame = g3_in_frame() > 0; @@ -3899,7 +3898,7 @@ int HudGaugeLeadIndicator::pickFrame(float prange, float srange, float dist_to_t return frame_offset; } -void HudGaugeLeadIndicator::render(float /*frametime*/) +void HudGaugeLeadIndicator::render(float /*frametime*/, bool /*config*/) { if(Player->target_is_dying) { return; @@ -4323,7 +4322,7 @@ void HudGaugeLeadSight::pageIn() bm_page_in_aabitmap(Lead_sight.first_frame, Lead_sight.num_frames); } -void HudGaugeLeadSight::render(float /*frametime*/) +void HudGaugeLeadSight::render(float /*frametime*/, bool /*config*/) { vec3d target_pos; vec3d source_pos; @@ -4651,7 +4650,7 @@ HudGaugeReticleTriangle(HUD_OBJECT_TARGET_TRI, HUD_TARGET_TRIANGLE) { } -void HudGaugeTargetTriangle::render(float /*frametime*/) +void HudGaugeTargetTriangle::render(float /*frametime*/, bool /*config*/) { if ( Player_ai->target_objnum == -1) return; @@ -4872,7 +4871,7 @@ void HudGaugeAutoTarget::initOffColor(int r, int g, int b, int a) gr_init_alphacolor(&Off_color, r, g, b, a); } -void HudGaugeAutoTarget::render(float /*frametime*/) +void HudGaugeAutoTarget::render(float /*frametime*/, bool /*config*/) { if (Player_ship->flags[Ship::Ship_Flags::Primitive_sensors]) return; @@ -4959,7 +4958,7 @@ void HudGaugeAutoSpeed::initOffColor(int r, int g, int b, int a) gr_init_alphacolor(&Off_color, r, g, b, a); } -void HudGaugeAutoSpeed::render(float /*frametime*/) +void HudGaugeAutoSpeed::render(float /*frametime*/, bool /*config*/) { if (Player_ship->flags[Ship::Ship_Flags::Primitive_sensors]) return; @@ -5562,7 +5561,7 @@ void HudGaugeCmeasures::pageIn() bm_page_in_aabitmap(Cmeasure_gauge.first_frame, Cmeasure_gauge.num_frames); } -void HudGaugeCmeasures::render(float /*frametime*/) +void HudGaugeCmeasures::render(float /*frametime*/, bool /*config*/) { if ( Cmeasure_gauge.first_frame < 0) { return; // failed to load coutermeasure gauge background @@ -5585,7 +5584,7 @@ void HudGaugeCmeasures::render(float /*frametime*/) Int3(); // player ship doesn't exist? return; } - renderPrintf(position[0] + Cm_text_val_offsets[0], position[1] + Cm_text_val_offsets[1], NOX("%02d"), Player_ship->cmeasure_count); + renderPrintf(position[0] + Cm_text_val_offsets[0], position[1] + Cm_text_val_offsets[1], 1.0f, false, NOX("%02d"), Player_ship->cmeasure_count); } HudGaugeAfterburner::HudGaugeAfterburner(): @@ -5608,7 +5607,7 @@ void HudGaugeAfterburner::initBitmaps(char *fname) } // Render the HUD afterburner energy gauge -void HudGaugeAfterburner::render(float /*frametime*/) +void HudGaugeAfterburner::render(float /*frametime*/, bool /*config*/) { float percent_left; int clip_h,w,h; @@ -5717,7 +5716,7 @@ void HudGaugeWeaponEnergy::pageIn() bm_page_in_aabitmap( Energy_bar.first_frame, Energy_bar.num_frames); } -void HudGaugeWeaponEnergy::render(float /*frametime*/) +void HudGaugeWeaponEnergy::render(float /*frametime*/, bool /*config*/) { int x; bool use_new_gauge = false; @@ -6169,7 +6168,7 @@ void HudGaugeWeapons::pageIn() } } -void HudGaugeWeapons::render(float /*frametime*/) +void HudGaugeWeapons::render(float /*frametime*/, bool /*config*/) { ship_weapon *sw; int np, ns; // np == num primary, ns == num secondary @@ -6229,14 +6228,14 @@ void HudGaugeWeapons::render(float /*frametime*/) // indicate if this is linked or currently armed if ( ((sw->current_primary_bank == i) && !(Player_ship->flags[Ship::Ship_Flags::Primary_linked])) || ((Player_ship->flags[Ship::Ship_Flags::Primary_linked]) && !(Weapon_info[sw->primary_bank_weapons[i]].wi_flags[Weapon::Info_Flags::Nolink]))) { - renderPrintf(position[0] + Weapon_plink_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon); + renderPrintfWithGauge(position[0] + Weapon_plink_offset_x, name_y, EG_NULL, 1.0f, false, "%c", Weapon_link_icon); } // either render this primary's image or its name if(Weapon_info[sw->primary_bank_weapons[0]].hud_image_index != -1) { renderBitmap(Weapon_info[sw->primary_bank_weapons[i]].hud_image_index, position[0] + Weapon_pname_offset_x, name_y); } else { - renderPrintf(position[0] + Weapon_pname_offset_x, name_y, EG_WEAPON_P2, "%s", weapon_name); + renderPrintfWithGauge(position[0] + Weapon_pname_offset_x, name_y, EG_WEAPON_P2, 1.0f, false, "%s", weapon_name); } // if this is a ballistic primary with ammo, render the ammo count @@ -6292,14 +6291,14 @@ void HudGaugeWeapons::render(float /*frametime*/) if ( sw->current_secondary_bank == i ) { // show that this is the current secondary armed - renderPrintf(position[0] + Weapon_sunlinked_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon); + renderPrintfWithGauge(position[0] + Weapon_sunlinked_offset_x, name_y, EG_NULL, 1.0f, false, "%c", Weapon_link_icon); // indicate if this is linked // don't draw the link indicator if the fire can't be fired link. // the link flag is ignored rather than cleared so the player can cycle past a no-doublefire weapon without the setting being cleared if ( Player_ship->flags[Ship::Ship_Flags::Secondary_dual_fire] && !wip->wi_flags[Weapon::Info_Flags::No_doublefire] && !The_mission.ai_profile->flags[AI::Profile_Flags::Disable_player_secondary_doublefire] ) { - renderPrintf(position[0] + Weapon_slinked_offset_x, name_y, EG_NULL, "%c", Weapon_link_icon); + renderPrintfWithGauge(position[0] + Weapon_slinked_offset_x, name_y, EG_NULL, 1.0f, false, "%c", Weapon_link_icon); } // show secondary weapon's image or print its name @@ -6313,7 +6312,7 @@ void HudGaugeWeapons::render(float /*frametime*/) if ((sw->current_secondary_bank >= 0) && ship_secondary_has_ammo(sw, i)) { int ms_till_fire = timestamp_until(sw->next_secondary_fire_stamp[sw->current_secondary_bank]); if ( (ms_till_fire >= 500) && ((wip->fire_wait >= 1 ) || (ms_till_fire > wip->fire_wait*1000)) ) { - renderPrintf(position[0] + Weapon_sreload_offset_x, name_y, EG_NULL, "%d", (int)std::lround(ms_till_fire/1000.0f)); + renderPrintfWithGauge(position[0] + Weapon_sreload_offset_x, name_y, EG_NULL, 1.0f, false, "%d", (int)std::lround(ms_till_fire/1000.0f)); } } } else { @@ -6453,7 +6452,7 @@ void HudGaugeOffscreen::pageIn() { } -void HudGaugeOffscreen::render(float /*frametime*/) +void HudGaugeOffscreen::render(float /*frametime*/, bool /*config*/) { // don't show offscreen indicator if we're warping out. if ( Player->control_mode != PCM_NORMAL ) { @@ -6829,7 +6828,7 @@ void HudGaugeWarheadCount::pageIn() bm_page_in_aabitmap(Warhead.first_frame, Warhead.num_frames); } -void HudGaugeWarheadCount::render(float /*frametime*/) +void HudGaugeWarheadCount::render(float /*frametime*/, bool /*config*/) { if(Player_obj->type == OBJ_OBSERVER) { return; @@ -7031,8 +7030,7 @@ void HudGaugeWeaponList::maybeFlashWeapon(int index) } } -void HudGaugeWeaponList::render(float /*frametime*/) -{ +void HudGaugeWeaponList::render(float /*frametime*/, bool /*config*/) { } @@ -7057,7 +7055,7 @@ void HudGaugePrimaryWeapons::initPrimaryAmmoOffsetX(int x) _pammo_offset_x = x; } -void HudGaugePrimaryWeapons::render(float /*frametime*/) +void HudGaugePrimaryWeapons::render(float /*frametime*/, bool /*config*/) { ship_weapon *sw; @@ -7102,14 +7100,14 @@ void HudGaugePrimaryWeapons::render(float /*frametime*/) // indicate if this is linked or currently armed if ( (sw->current_primary_bank == i) || (Player_ship->flags[Ship::Ship_Flags::Primary_linked]) ) { - renderPrintf(position[0] + _plink_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon); + renderPrintfWithGauge(position[0] + _plink_offset_x, position[1] + text_y_offset, EG_NULL, 1.0f, false, "%c", Weapon_link_icon); } // either render this primary's image or its name if(Weapon_info[sw->primary_bank_weapons[0]].hud_image_index != -1) { renderBitmap(Weapon_info[sw->primary_bank_weapons[i]].hud_image_index, position[0] + _pname_offset_x, text_y_offset); } else { - renderPrintf(position[0] + _pname_offset_x, position[1] + text_y_offset, EG_WEAPON_P2, "%s", weapon_name); + renderPrintfWithGauge(position[0] + _pname_offset_x, position[1] + text_y_offset, EG_WEAPON_P2, 1.0f, false, "%s", weapon_name); } // if this is a ballistic primary with ammo, render the ammo count @@ -7170,7 +7168,7 @@ void HudGaugeSecondaryWeapons::initSecondaryUnlinkedOffsetX(int x) _sunlinked_offset_x = x; } -void HudGaugeSecondaryWeapons::render(float /*frametime*/) +void HudGaugeSecondaryWeapons::render(float /*frametime*/, bool /*config*/) { ship_weapon *sw; @@ -7209,14 +7207,14 @@ void HudGaugeSecondaryWeapons::render(float /*frametime*/) if ( sw->current_secondary_bank == i ) { // show that this is the current secondary armed - renderPrintf(position[0] + _sunlinked_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon); + renderPrintfWithGauge(position[0] + _sunlinked_offset_x, position[1] + text_y_offset, EG_NULL, 1.0f, false, "%c", Weapon_link_icon); // indicate if this is linked // don't draw the link indicator if the fire can't be fired link. // the link flag is ignored rather than cleared so the player can cycle past a no-doublefire weapon without the setting being cleared if ( Player_ship->flags[Ship::Ship_Flags::Secondary_dual_fire] && !wip->wi_flags[Weapon::Info_Flags::No_doublefire] && !The_mission.ai_profile->flags[AI::Profile_Flags::Disable_player_secondary_doublefire] ) { - renderPrintf(position[0] + _slinked_offset_x, position[1] + text_y_offset, EG_NULL, "%c", Weapon_link_icon); + renderPrintfWithGauge(position[0] + _slinked_offset_x, position[1] + text_y_offset, EG_NULL, 1.0f, false, "%c", Weapon_link_icon); } // show secondary weapon's image or print its name @@ -7230,7 +7228,7 @@ void HudGaugeSecondaryWeapons::render(float /*frametime*/) if ((sw->current_secondary_bank >= 0) && ship_secondary_has_ammo(sw, i)) { int ms_till_fire = timestamp_until(sw->next_secondary_fire_stamp[sw->current_secondary_bank]); if ( (ms_till_fire >= 500) && ((wip->fire_wait >= 1 ) || (ms_till_fire > wip->fire_wait*1000)) ) { - renderPrintf(position[0] + _sreload_offset_x, position[1] + text_y_offset, EG_NULL, "%d", (int)std::lround(ms_till_fire/1000.0f)); + renderPrintfWithGauge(position[0] + _sreload_offset_x, position[1] + text_y_offset, EG_NULL, 1.0f, false, "%d", (int)std::lround(ms_till_fire/1000.0f)); } } } else { @@ -7291,7 +7289,7 @@ void HudGaugeHardpoints::initDrawOptions(bool primary_models, bool secondary_mod draw_secondary_models = secondary_models; } -void HudGaugeHardpoints::render(float /*frametime*/) +void HudGaugeHardpoints::render(float /*frametime*/, bool /*config*/) { int sx, sy; ship *sp; diff --git a/code/hud/hudtarget.h b/code/hud/hudtarget.h index 657937f6d25..d5658452843 100644 --- a/code/hud/hudtarget.h +++ b/code/hud/hudtarget.h @@ -222,7 +222,7 @@ class HudGaugeAutoTarget: public HudGauge void initBitmaps(char *fname); void initOnColor(int r, int g, int b, int a); void initOffColor(int r, int g, int b, int a); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -245,7 +245,7 @@ class HudGaugeAutoSpeed: public HudGauge void initBitmaps(char *fname); void initOnColor(int r, int g, int b, int a); void initOffColor(int r, int g, int b, int a); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -261,7 +261,7 @@ class HudGaugeCmeasures: public HudGauge void initBitmaps(char *fname); void initCountTextOffsets(int x, int y); void initCountValueOffsets(int x, int y); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -275,7 +275,7 @@ class HudGaugeAfterburner: public HudGauge HudGaugeAfterburner(); void initEnergyHeight(int h); void initBitmaps(char *fname); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -306,7 +306,7 @@ class HudGaugeWeaponEnergy: public HudGauge void initShowBallistics(bool show_ballistics); void initAlignments(HudAlignment text_align, HudAlignment armed_align); void initArmedOffsets(int x, int y, int h, bool show); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -366,7 +366,7 @@ class HudGaugeWeapons: public HudGauge void initSecondaryHeights(int top_h, int text_h); void initLinkIcon(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; void maybeFlashWeapon(int index); }; @@ -407,7 +407,7 @@ class HudGaugeWeaponList: public HudGauge void initEntryHeight(int h); void initLinkIcon(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; void maybeFlashWeapon(int index); }; @@ -424,7 +424,7 @@ class HudGaugePrimaryWeapons: public HudGaugeWeaponList void initPrimaryNameOffsetX(int x); void initPrimaryAmmoOffsetX(int x); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeSecondaryWeapons: public HudGaugeWeaponList @@ -443,7 +443,7 @@ class HudGaugeSecondaryWeapons: public HudGaugeWeaponList void initSecondaryLinkedOffsetX(int x); void initSecondaryUnlinkedOffsetX(int x); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeHardpoints: public HudGauge @@ -463,7 +463,7 @@ class HudGaugeHardpoints: public HudGauge void initDrawOptions(bool primary_models, bool secondary_models); HudGaugeHardpoints(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeWarheadCount: public HudGauge @@ -486,7 +486,7 @@ class HudGaugeWarheadCount: public HudGauge void initMaxSymbols(int count); void initMaxColumns(int count); void initTextAlign(HudAlignment align); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -497,8 +497,8 @@ class HudGaugeOrientationTee: public HudGauge public: HudGaugeOrientationTee(); void initRadius(int length); - void render(float frametime) override; void renderOrientation(object *from_objp, object *to_objp, matrix *from_orientp); + void render(float frametime, bool config = false) override; void pageIn() override; }; @@ -514,9 +514,9 @@ class HudGaugeReticleTriangle: public HudGauge void initRadius(int length); void initTriBase(float length); void initTriHeight(float h); - void render(float frametime) override; void renderTriangle(vec3d *hostile_pos, int aspect_flag, int show_interior, int split_tri); void renderTriangleMissileTail(float ang, float xpos, float ypos, float cur_dist, int draw_solid, int draw_inside); + void render(float frametime, bool config = false) override; }; class HudGaugeHostileTriangle: public HudGaugeReticleTriangle @@ -524,7 +524,7 @@ class HudGaugeHostileTriangle: public HudGaugeReticleTriangle protected: public: HudGaugeHostileTriangle(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeTargetTriangle: public HudGaugeReticleTriangle @@ -532,7 +532,7 @@ class HudGaugeTargetTriangle: public HudGaugeReticleTriangle protected: public: HudGaugeTargetTriangle(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeMissileTriangles: public HudGaugeReticleTriangle @@ -540,7 +540,7 @@ class HudGaugeMissileTriangles: public HudGaugeReticleTriangle protected: public: HudGaugeMissileTriangles(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; }; class HudGaugeOffscreen: public HudGauge3DAnchor @@ -556,7 +556,7 @@ class HudGaugeOffscreen: public HudGauge3DAnchor void initMaxFrontSeperation(float length); void initTriBase(float length); void initTriHeight(float length); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void calculatePosition(vertex* target_point, vec3d *tpos, vec2d *outcoords, int *dir, float *half_triangle_sep); void renderOffscreenIndicator(vec2d *coords, int dir, float distance, float half_triangle_sep, bool draw_solid = true); void pageIn() override; @@ -571,10 +571,10 @@ class HudGaugeLeadIndicator: public HudGauge3DAnchor HudGaugeLeadIndicator(); void initHalfSize(float w, float h); void initBitmaps(char *fname); - void render(float frametime) override; void renderIndicator(int frame_offset, object *targetp, vec3d *lead_target_pos); void renderLeadCurrentTarget(); void renderLeadQuick(vec3d *target_pos, object *targetp); + void render(float frametime, bool config = false) override; int pickFrame(float prange, float srange, float dist_to_target); void pageIn() override; }; @@ -587,7 +587,7 @@ class HudGaugeLeadSight: public HudGauge public: HudGaugeLeadSight(); void initBitmaps(char *fname); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void renderSight(int indicator_frame, vec3d *target_pos, vec3d *lead_target_pos); void pageIn() override; }; diff --git a/code/hud/hudtargetbox.cpp b/code/hud/hudtargetbox.cpp index 7201fa6ec0d..6971ffa1f94 100644 --- a/code/hud/hudtargetbox.cpp +++ b/code/hud/hudtargetbox.cpp @@ -380,7 +380,7 @@ void HudGaugeTargetBox::initFlashTimer(int index) flash_flags &= ~(1<= 0.0f ) { - renderPrintf(position[0] + Class_offsets[0], position[1] + Class_offsets[1], EG_TBOX_CLASS, XSTR("impact: %.1f sec", 1596), time_to_impact); + renderPrintfWithGauge(position[0] + Class_offsets[0], position[1] + Class_offsets[1], EG_TBOX_CLASS, 1.0f, false, XSTR("impact: %.1f sec", 1596), time_to_impact); } } @@ -1341,7 +1341,7 @@ void HudGaugeTargetBox::renderTargetJumpNode(object *target_objp) hud_num_make_mono(outstr, font_num); gr_get_string_size(&w,&h,outstr); - renderPrintf(position[0] + Dist_offsets[0]+hx, position[1] + Dist_offsets[1]+hy, EG_TBOX_DIST, "%s", outstr); + renderPrintfWithGauge(position[0] + Dist_offsets[0]+hx, position[1] + Dist_offsets[1]+hy, EG_TBOX_DIST, 1.0f, false, "%s", outstr); } } @@ -1495,7 +1495,7 @@ void HudGaugeExtraTargetData::pageIn() /** * @note Formerly hud_targetbox_show_extra_ship_info(target_shipp, target_objp) (Swifty) */ -void HudGaugeExtraTargetData::render(float /*frametime*/) +void HudGaugeExtraTargetData::render(float /*frametime*/, bool /*config*/) { char tmpbuf[256]; int has_orders = 0; @@ -1713,7 +1713,7 @@ void HudGaugeTargetBox::renderTargetShipInfo(object *target_objp) maybeFlashElement(TBOX_FLASH_HULL); } - renderPrintf(position[0] + Hull_offsets[0]-w, position[1] + Hull_offsets[1], EG_TBOX_HULL, "%s", outstr); + renderPrintfWithGauge(position[0] + Hull_offsets[0]-w, position[1] + Hull_offsets[1], EG_TBOX_HULL, 1.0f, false, "%s", outstr); setGaugeColor(); // print out the targeted sub-system and % integrity @@ -1761,13 +1761,13 @@ void HudGaugeTargetBox::renderTargetShipInfo(object *target_objp) if (n_linebreaks) { p_line = strtok(outstr,linebreak); while (p_line != NULL) { - renderPrintf(subsys_name_pos_x, subsys_name_pos_y-h-((h+1)*n_linebreaks), "%s", p_line); + renderPrintf(subsys_name_pos_x, subsys_name_pos_y-h-((h+1)*n_linebreaks), 1.0f, false, "%s", p_line); p_line = strtok(NULL,linebreak); n_linebreaks--; } } else { hud_targetbox_truncate_subsys_name(outstr); - renderPrintf(subsys_name_pos_x, subsys_name_pos_y-h, "%s", outstr); + renderPrintf(subsys_name_pos_x, subsys_name_pos_y-h, 1.0f, false, "%s", outstr); } int subsys_integrity_pos_x; @@ -1789,7 +1789,7 @@ void HudGaugeTargetBox::renderTargetShipInfo(object *target_objp) { sprintf(outstr,XSTR( "%d%%", 341),screen_integrity); gr_get_string_size(&w,&h,outstr); - renderPrintf(subsys_integrity_pos_x - w, subsys_integrity_pos_y - h, "%s", outstr); + renderPrintf(subsys_integrity_pos_x - w, subsys_integrity_pos_y - h, 1.0f, false, "%s", outstr); } setGaugeColor(); @@ -1815,7 +1815,7 @@ void HudGaugeTargetBox::renderTargetShipInfo(object *target_objp) disabled_status_pos_y = position[1] + Viewport_offsets[1] + Viewport_h - 2*h; } - renderPrintf(disabled_status_pos_x, disabled_status_pos_y, "%s", outstr); + renderPrintf(disabled_status_pos_x, disabled_status_pos_y, 1.0f, false, "%s", outstr); } } diff --git a/code/hud/hudtargetbox.h b/code/hud/hudtargetbox.h index c41da77f854..065e7e15802 100644 --- a/code/hud/hudtargetbox.h +++ b/code/hud/hudtargetbox.h @@ -122,8 +122,8 @@ class HudGaugeTargetBox: public HudGauge // HUD_TARGET_MONITOR void initialize() override; void pageIn() override; - void render(float frametime) override; void renderTargetShip(object *target_objp); + void render(float frametime, bool config = false) override; void renderTargetWeapon(object *target_objp); void renderTargetDebris(object *target_objp); void renderTargetAsteroid(object *target_objp); @@ -161,7 +161,7 @@ class HudGaugeExtraTargetData: public HudGauge // HUD_TARGET_MONITOR_EXTRA_DATA void initTimeOffsets(int x, int y); void initOrderOffsets(int x, int y); void initOrderMaxWidth(int width); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initialize() override; void initDockFlashTimer(); void startFlashDock(int duration=TBOX_FLASH_DURATION); diff --git a/code/hud/hudwingmanstatus.cpp b/code/hud/hudwingmanstatus.cpp index 12feae1d803..abbcba18ce6 100644 --- a/code/hud/hudwingmanstatus.cpp +++ b/code/hud/hudwingmanstatus.cpp @@ -11,6 +11,7 @@ #include "globalincs/alphacolors.h" #include "globalincs/linklist.h" +#include "hud/hudconfig.h" #include "hud/hudtargetbox.h" #include "hud/hudwingmanstatus.h" #include "iff_defs/iff_defs.h" @@ -554,7 +555,7 @@ int hud_wingman_status_wingmen_exist(int num_wings_to_draw) return 0; } -void HudGaugeWingmanStatus::render(float /*frametime*/) +void HudGaugeWingmanStatus::render(float /*frametime*/, bool /*config*/) { int i, count, num_wings_to_draw = 0; diff --git a/code/hud/hudwingmanstatus.h b/code/hud/hudwingmanstatus.h index 9f301be34cf..c814cccd0dc 100644 --- a/code/hud/hudwingmanstatus.h +++ b/code/hud/hudwingmanstatus.h @@ -81,9 +81,9 @@ class HudGaugeWingmanStatus: public HudGauge void initUseExpandedColors(bool useexpandedcolors); void pageIn() override; void initialize() override; - void render(float frametime) override; void renderBackground(int num_wings_to_draw); void renderDots(int wing_index, int screen_index, int num_wings_to_draw); + void render(float frametime, bool config = false) override; void initFlash(); bool maybeFlashStatus(int wing_index, int wing_pos); }; diff --git a/code/mission/missiontraining.cpp b/code/mission/missiontraining.cpp index adf5594f510..5bda669bed0 100644 --- a/code/mission/missiontraining.cpp +++ b/code/mission/missiontraining.cpp @@ -235,7 +235,7 @@ void HudGaugeDirectives::pageIn() bm_page_in_aabitmap(directives_bottom.first_frame, directives_bottom.num_frames); } -void HudGaugeDirectives::render(float /*frametime*/) +void HudGaugeDirectives::render(float /*frametime*/, bool /*config*/) { char buf[256], *second_line; int i, x, y, z, end, offset, bx, by; @@ -262,7 +262,7 @@ void HudGaugeDirectives::render(float /*frametime*/) renderBitmap(directives_top.first_frame, position[0], position[1]); // print out title - renderPrintf(position[0] + header_offsets[0], position[1] + header_offsets[1], EG_OBJ_TITLE, "%s", XSTR( "directives", 422)); + renderPrintfWithGauge(position[0] + header_offsets[0], position[1] + header_offsets[1], EG_OBJ_TITLE, 1.0f, false, "%s", XSTR( "directives", 422)); bx = position[0]; by = position[1] + middle_frame_offset_y; @@ -1093,7 +1093,7 @@ void HudGaugeTrainingMessages::pageIn() /** * Displays (renders) the training message to the screen */ -void HudGaugeTrainingMessages::render(float /*frametime*/) +void HudGaugeTrainingMessages::render(float /*frametime*/, bool /*config*/) { const char *str; char buf[256]; @@ -1142,7 +1142,7 @@ void HudGaugeTrainingMessages::render(float /*frametime*/) while ((str - Training_lines[i]) < Training_line_lengths[i]) { // loop through each character of each line if ((count < MAX_TRAINING_MESSAGE_MODS) && (static_cast(str - Training_lines[i]) == Training_message_mods[count].pos)) { buf[z] = 0; - renderPrintf(x, y, "%s", buf); + renderPrintf(x, y, 1.0f, false, "%s", buf); gr_get_string_size(&z, NULL, buf); x += z; z = 0; @@ -1164,7 +1164,7 @@ void HudGaugeTrainingMessages::render(float /*frametime*/) if (z) { buf[z] = 0; - renderPrintf(x, y, "%s", buf); + renderPrintf(x, y, 1.0f, false, "%s", buf); } } } diff --git a/code/mission/missiontraining.h b/code/mission/missiontraining.h index 9a662c40b49..6e929bdd0e8 100644 --- a/code/mission/missiontraining.h +++ b/code/mission/missiontraining.h @@ -69,7 +69,7 @@ class HudGaugeDirectives: public HudGauge void initTextHeight(int h); void initMaxLineWidth(int w); void initKeyLineXOffset(int offset); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; bool canRender() const override; }; @@ -79,7 +79,7 @@ class HudGaugeTrainingMessages: public HudGauge protected: public: HudGaugeTrainingMessages(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; bool canRender() const override; }; diff --git a/code/radar/radar.cpp b/code/radar/radar.cpp index 344260c1230..326085c6459 100644 --- a/code/radar/radar.cpp +++ b/code/radar/radar.cpp @@ -279,7 +279,7 @@ void HudGaugeRadarStd::drawContactImage( int x, int y, int rad, int idx, int clr gr_screen.clip_right_unscaled = old_right_unscaled; } -void HudGaugeRadarStd::render(float /*frametime*/) +void HudGaugeRadarStd::render(float /*frametime*/, bool /*config*/) { //WMC - This strikes me as a bit hackish bool g3_yourself = !g3_in_frame(); diff --git a/code/radar/radar.h b/code/radar/radar.h index bafb81cd308..ad2ceec589b 100644 --- a/code/radar/radar.h +++ b/code/radar/radar.h @@ -64,7 +64,7 @@ class HudGaugeRadarStd: public HudGaugeRadar void drawContactCircle( int x, int y, int rad ); void drawContactImage( int x, int y, int rad, int idx, int clr_idx, int size ); void drawCrosshairs(int x, int y); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; void plotBlip(blip *b, int *x, int *y); void plotObject( object *objp ); diff --git a/code/radar/radardradis.cpp b/code/radar/radardradis.cpp index 18a6964e5bc..b48962fdd18 100644 --- a/code/radar/radardradis.cpp +++ b/code/radar/radardradis.cpp @@ -452,7 +452,7 @@ void HudGaugeRadarDradis::drawBlipsSorted(int distort) } -void HudGaugeRadarDradis::render(float /*frametime*/) +void HudGaugeRadarDradis::render(float /*frametime*/, bool /*config*/) { float sensors_str; int ok_to_blit_radar; diff --git a/code/radar/radardradis.h b/code/radar/radardradis.h index 113e4fe8ab4..8924366955c 100644 --- a/code/radar/radardradis.h +++ b/code/radar/radardradis.h @@ -11,6 +11,7 @@ #include "globalincs/pstypes.h" #include "radar/radarsetup.h" +#include "gamesnd/gamesnd.h" class object; struct blip; @@ -79,7 +80,7 @@ class HudGaugeRadarDradis: public HudGaugeRadar void doneDrawingHtl(); void drawOutlinesHtl(); void setupViewHtl(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; void plotBlip(blip* b, vec3d *pos, float *alpha); diff --git a/code/radar/radarorb.cpp b/code/radar/radarorb.cpp index ec708ad6b94..c2afbc1234a 100644 --- a/code/radar/radarorb.cpp +++ b/code/radar/radarorb.cpp @@ -380,7 +380,7 @@ void HudGaugeRadarOrb::drawOutlinesHtl() g3_done_instance(true); } -void HudGaugeRadarOrb::render(float /*frametime*/) +void HudGaugeRadarOrb::render(float /*frametime*/, bool /*config*/) { float sensors_str; int ok_to_blit_radar; diff --git a/code/radar/radarorb.h b/code/radar/radarorb.h index 0e88b745b01..b34593803d8 100644 --- a/code/radar/radarorb.h +++ b/code/radar/radarorb.h @@ -55,7 +55,7 @@ class HudGaugeRadarOrb: public HudGaugeRadar void drawOutlinesHtl(); void setupViewHtl(); int calcAlpha(vec3d* pt); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void pageIn() override; void plotBlip(blip *b, vec3d *scaled_pos); }; diff --git a/code/radar/radarsetup.cpp b/code/radar/radarsetup.cpp index bdc7f58fa89..fd122317105 100644 --- a/code/radar/radarsetup.cpp +++ b/code/radar/radarsetup.cpp @@ -437,7 +437,7 @@ void HudGaugeRadar::initDistanceInfinityOffsets(int x, int y) Radar_dist_offsets[RR_INFINITY][1] = y; } -void HudGaugeRadar::render(float /*frametime*/) +void HudGaugeRadar::render(float /*frametime*/, bool /*config*/) { } @@ -471,19 +471,19 @@ void HudGaugeRadar::drawRange() switch ( HUD_config.rp_dist ) { case RR_SHORT: - renderPrintf(position[0] + Radar_dist_offsets[RR_SHORT][0], position[1] + Radar_dist_offsets[RR_SHORT][1], "%s", XSTR( "2k", 467)); + renderPrintf(position[0] + Radar_dist_offsets[RR_SHORT][0], position[1] + Radar_dist_offsets[RR_SHORT][1], 1.0f, false, "%s", XSTR( "2k", 467)); break; case RR_LONG: - renderPrintf(position[0] + Radar_dist_offsets[RR_LONG][0], position[1] + Radar_dist_offsets[RR_LONG][1], "%s", XSTR( "10k", 468)); + renderPrintf(position[0] + Radar_dist_offsets[RR_LONG][0], position[1] + Radar_dist_offsets[RR_LONG][1], 1.0f, false, "%s", XSTR( "10k", 468)); break; case RR_INFINITY: if (Unicode_text_mode) { // This escape sequence is the UTF-8 encoding of the infinity symbol. We can't use u8 yet since VS2013 doesn't support it - renderPrintf(position[0] + Radar_dist_offsets[RR_INFINITY][0], position[1] + Radar_dist_offsets[RR_INFINITY][1], "\xE2\x88\x9E"); + renderPrintf(position[0] + Radar_dist_offsets[RR_INFINITY][0], position[1] + Radar_dist_offsets[RR_INFINITY][1], 1.0f, false, "\xE2\x88\x9E"); } else { - renderPrintf(position[0] + Radar_dist_offsets[RR_INFINITY][0], position[1] + Radar_dist_offsets[RR_INFINITY][1], "%c", Radar_infinity_icon); + renderPrintf(position[0] + Radar_dist_offsets[RR_INFINITY][0], position[1] + Radar_dist_offsets[RR_INFINITY][1], 1.0f, false, "%c", Radar_infinity_icon); } break; diff --git a/code/radar/radarsetup.h b/code/radar/radarsetup.h index 542527be024..a1b7a639e74 100644 --- a/code/radar/radarsetup.h +++ b/code/radar/radarsetup.h @@ -126,7 +126,7 @@ class HudGaugeRadar: public HudGauge void initInfinityIcon(); void drawRange(); - void render(float frametime) override; + void render(float frametime, bool config = false) override; void initialize() override; void pageIn() override; }; diff --git a/code/weapon/emp.cpp b/code/weapon/emp.cpp index c9831e15af0..4c72b35b3ee 100644 --- a/code/weapon/emp.cpp +++ b/code/weapon/emp.cpp @@ -487,7 +487,7 @@ int emp_should_blit_gauge() } // emp hud string -void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode) +void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode, float scale) { char tmp[256] = ""; @@ -507,7 +507,7 @@ void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode } // print the string out - gr_string(x, y, tmp, resize_mode); + gr_string(x, y, tmp, resize_mode, scale); } // maybe reformat a string diff --git a/code/weapon/emp.h b/code/weapon/emp.h index e66b0ae0e54..71c48d44d0d 100644 --- a/code/weapon/emp.h +++ b/code/weapon/emp.h @@ -103,7 +103,7 @@ void emp_process_local(); int emp_should_blit_gauge(); // emp hud string -void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode); +void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode, float scale = 1.0f); // throw some jitter into HUD x and y coords void emp_hud_jitter(int *x, int *y);