Skip to content

Commit d41cb49

Browse files
authored
make sure drop shadows don't polute the color context (scp-fs2open#6689)
1 parent 524d363 commit d41cb49

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

code/hud/hud.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,9 +915,10 @@ void HudGauge::renderString(int x, int y, const char *str, float scale, bool con
915915
}
916916

917917
if (HUD_shadows) {
918+
color cur = gr_screen.current_color;
918919
gr_set_color_fast(&Color_black);
919920
gr_string(x + nx + 1, y + ny + 1, str, resize, scale);
920-
gr_set_color_fast(&gauge_color);
921+
gr_set_color_fast(&cur);
921922
}
922923

923924
gr_string(x + nx, y + ny, str, resize, scale);
@@ -951,16 +952,18 @@ void HudGauge::renderString(int x, int y, int gauge_id, const char *str, float s
951952

952953
if ( gauge_id > -2 ) {
953954
if (HUD_shadows) {
955+
color cur = gr_screen.current_color;
954956
gr_set_color_fast(&Color_black);
955957
emp_hud_string(x + nx + 1, y + ny + 1, gauge_id, str, resize, scale);
956-
gr_set_color_fast(&gauge_color);
958+
gr_set_color_fast(&cur);
957959
}
958960
emp_hud_string(x + nx, y + ny, gauge_id, str, resize, scale);
959961
} else {
960962
if (HUD_shadows) {
963+
color cur = gr_screen.current_color;
961964
gr_set_color_fast(&Color_black);
962965
gr_string(x + nx + 1, y + ny + 1, str, resize, scale);
963-
gr_set_color_fast(&gauge_color);
966+
gr_set_color_fast(&cur);
964967
}
965968
gr_string(x + nx, y + ny, str, resize, scale);
966969
}

code/hud/hudets.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ void HudGaugeEts::blitGauge(int index, int ix, int iy, float scale, bool config)
914914

915915
int x, y;
916916
if (HUD_shadows) {
917+
color cur = gr_screen.current_color;
917918
// These act more as a backing black layer.
918919

919920
gr_set_color_fast(&Color_black);
@@ -930,7 +931,7 @@ void HudGaugeEts::blitGauge(int index, int ix, int iy, float scale, bool config)
930931
renderBitmapEx(Ets_bar.first_frame, x, y, w, y + ETS_bar_h, 0, 0, scale, config);
931932

932933
if (!config) {
933-
gr_set_color_fast(&gauge_color);
934+
gr_set_color_fast(&cur);
934935
} else {
935936
setGaugeColor(HUD_C_NONE, config);
936937
}

code/hud/hudreticle.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,13 @@ void HudGaugeReticle::render(float /*frametime*/, bool config)
329329

330330
if (fixed_reticle >= 0) {
331331
if (HUD_shadows) {
332+
color cur = gr_screen.current_color;
332333
gr_set_color_fast(&Color_black);
333334

334335
// Render the shadow twice to increase visibility
335336
renderBitmap(fixed_reticle, x + 1, y + 1, scale, config);
336337
renderBitmap(fixed_reticle, x + 1, y + 1, scale, config);
337-
gr_set_color_fast(&gauge_color);
338+
gr_set_color_fast(&cur);
338339
}
339340

340341
renderBitmap(fixed_reticle, x, y, scale, config);

0 commit comments

Comments
 (0)