From 6224af6178ca9ab51350e0ff31dfd3d8dcd95fcc Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Mon, 2 Jan 2023 11:13:32 +0300 Subject: [PATCH] Fix help screen issues Closes #179 --- src/game.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/game.cc b/src/game.cc index 1e25c96..60099ac 100644 --- a/src/game.cc +++ b/src/game.cc @@ -1161,6 +1161,10 @@ static void showHelp() bool colorCycleWasEnabled = colorCycleEnabled(); colorCycleDisable(); + // CE: Help screen uses separate color palette which is incompatible with + // colors in other windows. Setup overlay to hide everything. + int overlay = windowCreate(0, 0, screenGetWidth(), screenGetHeight(), 0, WINDOW_HIDDEN | WINDOW_MOVE_ON_TOP); + int helpWindowX = (screenGetWidth() - HELP_SCREEN_WIDTH) / 2; int helpWindowY = (screenGetHeight() - HELP_SCREEN_HEIGHT) / 2; int win = windowCreate(helpWindowX, helpWindowY, HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, 0, WINDOW_HIDDEN | WINDOW_MOVE_ON_TOP); @@ -1172,10 +1176,21 @@ static void showHelp() if (backgroundFrmImage.lock(backgroundFid)) { paletteSetEntries(gPaletteBlack); blitBufferToBuffer(backgroundFrmImage.getData(), HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, HELP_SCREEN_WIDTH, windowBuffer, HELP_SCREEN_WIDTH); - windowShow(win); + colorPaletteLoad("art\\intrface\\helpscrn.pal"); paletteSetEntries(_cmap); + // CE: Fill overlay with darkest color in the palette. It might + // not be completely black, but at least it's uniform. + bufferFill(windowGetBuffer(overlay), + screenGetWidth(), + screenGetHeight(), + screenGetWidth(), + intensityColorTable[_colorTable[0]][0]); + + windowShow(overlay); + windowShow(win); + while (inputGetInput() == -1 && _game_user_wants_to_quit == 0) { sharedFpsLimiter.mark(); renderPresent(); @@ -1195,6 +1210,7 @@ static void showHelp() } } + windowDestroy(overlay); windowDestroy(win); colorPaletteLoad("color.pal"); paletteSetEntries(_cmap);