diff --git a/components/doom/prboom/r_main.c b/components/doom/prboom/r_main.c index 97d0207b..2485c3a2 100644 --- a/components/doom/prboom/r_main.c +++ b/components/doom/prboom/r_main.c @@ -367,6 +367,18 @@ void R_SetViewSize(int blocks) setblocks = blocks; } +// Force a full screen redraw on the next D_Display, reusing the current view +// size. D_Display's setsizeneeded path sets oldgamestate = -1, which triggers +// R_FillBackScreen + a border redraw and (in status-bar mode) ST_doRefresh -- +// a FULL status bar repaint instead of the usual ST_diffDraw. Call this after +// something external overwrites the framebuffer (e.g. returning from the +// emulator's pause/state menu); otherwise the diff-optimized status bar stays +// garbage until an individual widget value (ammo/health) happens to change. +void R_ForceRedraw(void) +{ + setsizeneeded = true; +} + // // R_ExecuteSetViewSize // diff --git a/components/doom/prboom/r_main.h b/components/doom/prboom/r_main.h index 0845cdb7..5d330a1f 100644 --- a/components/doom/prboom/r_main.h +++ b/components/doom/prboom/r_main.h @@ -116,6 +116,7 @@ void R_RenderPlayerView(player_t *player); // Called by G_Drawer. void R_Init(void); // Called by startup code. void R_SetViewSize(int blocks); // Called by M_Responder. void R_ExecuteSetViewSize(void); // cph - called by D_Display to complete a view resize +void R_ForceRedraw(void); // force a full redraw next D_Display (e.g. after an external menu) // // HAPTICS - functions to call for various events that should trigger haptics diff --git a/components/doom/src/doom.cpp b/components/doom/src/doom.cpp index da3f75a8..646747d1 100644 --- a/components/doom/src/doom.cpp +++ b/components/doom/src/doom.cpp @@ -69,6 +69,7 @@ extern "C" { #include #include #include +#include #include #include #include @@ -614,6 +615,12 @@ void pause_doom_tasks() { void resume_doom_tasks() { snd_MusicVolume = DEFAULT_AUDIO_VOLUME; snd_SfxVolume = DEFAULT_AUDIO_VOLUME; + // The pause/state menu (and clear_screen) overwrote the shared framebuffer, + // including the status bar region. Doom's status bar uses an incremental + // (diff) draw that assumes that region persists, so without a forced full + // redraw the HUD stays garbage until an individual widget value changes. + // Force a full redraw (background + border + ST_doRefresh) on the next frame. + R_ForceRedraw(); } void load_doom(std::string_view save_path, int save_slot) {