Avoid blanking when opening and closing the sidebar

This commit is contained in:
LyokoAgents committed 2026-10-29 00:47:57 +00:00
1 parent 4bc31ea1fc
commit 1e1e753be1
4 files changed
+115 -6

No files matched your search

+26 -3
View File
@@ -2,6 +2,26 @@
struct SaveMenuState save_menu;
static int team_member, team_parent;
static u16 panel_underlay[SAVE_MENU_H][SAVE_MENU_W];
static void copy_panel_underlay(int restoring)
{
for (int y = 0; y < SAVE_MENU_H; ++y)
for (int x = 0; x < SAVE_MENU_W; ++x) {
int pixel = (SAVE_MENU_Y + y) * WIDTH + SAVE_MENU_X + x;
if (restoring) SCREEN[pixel] = panel_underlay[y][x];
else panel_underlay[y][x] = SCREEN[pixel];
}
if (restoring) mark_dirty(SAVE_MENU_X, SAVE_MENU_Y, SAVE_MENU_W, SAVE_MENU_H);
}
void draw_menu_panel(enum SaveMenuPhase before)
{
/* World stays paused; fullscreen returns recapture after rebuilding actors/HUD. */
if (before == SAVE_MENU_CLOSED) copy_panel_underlay(0);
if (save_menu.phase == SAVE_MENU_CLOSED) copy_panel_underlay(1);
else draw_save_menu();
}
int save_menu_input(unsigned keys, int can_open, const struct Location *location)
{
@@ -70,14 +90,17 @@ void draw_menu_scene(int x, int y)
else if (save_menu.phase == SAVE_MENU_BAG) draw_bag();
else {
draw_scene(x, y);
if (save_menu.phase != SAVE_MENU_CLOSED) draw_save_menu();
if (save_menu.phase != SAVE_MENU_CLOSED) {
copy_panel_underlay(0);
draw_save_menu();
}
}
}
int menu_redraw_is_panel(enum SaveMenuPhase before, enum SaveMenuPhase after)
{
return before >= SAVE_MENU_OPTIONS && before <= SAVE_MENU_FAILED &&
after >= SAVE_MENU_OPTIONS && after <= SAVE_MENU_FAILED;
return before <= SAVE_MENU_FAILED && after <= SAVE_MENU_FAILED &&
(before != SAVE_MENU_CLOSED || after != SAVE_MENU_CLOSED);
}
void draw_save_menu(void)