Fix endgame slideshow issues

See #3
Closes #215
This commit is contained in:
Alexander Batalov 2023-01-02 14:34:42 +03:00
parent 812079004c
commit 03145e4fcd
1 changed files with 27 additions and 0 deletions

View File

@ -83,6 +83,7 @@ static void _endgame_movie_bk_process();
static int endgameEndingInit(); static int endgameEndingInit();
static void endgameEndingFree(); static void endgameEndingFree();
static int endgameDeathEndingValidate(int* percentage); static int endgameDeathEndingValidate(int* percentage);
static void endgameEndingUpdateOverlay();
// The number of lines in current subtitles file. // The number of lines in current subtitles file.
// //
@ -204,6 +205,8 @@ static unsigned char* gEndgameEndingSlideshowWindowBuffer;
// 0x570BF4 // 0x570BF4
static int gEndgameEndingSlideshowWindow; static int gEndgameEndingSlideshowWindow;
static int gEndgameEndingOverlay;
// 0x43F788 // 0x43F788
void endgamePlaySlideshow() void endgamePlaySlideshow()
{ {
@ -321,6 +324,9 @@ static void endgameEndingRenderPanningScene(int direction, const char* narratorF
bufferFill(gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, _colorTable[0]); bufferFill(gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, _colorTable[0]);
endgameEndingLoadPalette(6, 327); endgameEndingLoadPalette(6, 327);
// CE: Update overlay.
endgameEndingUpdateOverlay();
unsigned char palette[768]; unsigned char palette[768];
memcpy(palette, _cmap, 768); memcpy(palette, _cmap, 768);
@ -454,6 +460,9 @@ static void endgameEndingRenderStaticScene(int fid, const char* narratorFileName
endgameEndingLoadPalette(FID_TYPE(fid), fid & 0xFFF); endgameEndingLoadPalette(FID_TYPE(fid), fid & 0xFFF);
// CE: Update overlay.
endgameEndingUpdateOverlay();
endgameEndingVoiceOverInit(narratorFileName); endgameEndingVoiceOverInit(narratorFileName);
unsigned int delay; unsigned int delay;
@ -555,6 +564,13 @@ static int endgameEndingSlideshowWindowInit()
paletteFadeTo(gPaletteBlack); paletteFadeTo(gPaletteBlack);
// CE: Every slide has a separate color palette which is incompatible with
// main color palette. Setup overlay to hide everything.
gEndgameEndingOverlay = windowCreate(0, 0, screenGetWidth(), screenGetHeight(), _colorTable[0], WINDOW_MOVE_ON_TOP);
if (gEndgameEndingOverlay == -1) {
return -1;
}
int windowEndgameEndingX = (screenGetWidth() - ENDGAME_ENDING_WINDOW_WIDTH) / 2; int windowEndgameEndingX = (screenGetWidth() - ENDGAME_ENDING_WINDOW_WIDTH) / 2;
int windowEndgameEndingY = (screenGetHeight() - ENDGAME_ENDING_WINDOW_HEIGHT) / 2; int windowEndgameEndingY = (screenGetHeight() - ENDGAME_ENDING_WINDOW_HEIGHT) / 2;
gEndgameEndingSlideshowWindow = windowCreate(windowEndgameEndingX, gEndgameEndingSlideshowWindow = windowCreate(windowEndgameEndingX,
@ -623,6 +639,7 @@ static void endgameEndingSlideshowWindowFree()
speechSetEndCallback(NULL); speechSetEndCallback(NULL);
windowDestroy(gEndgameEndingSlideshowWindow); windowDestroy(gEndgameEndingSlideshowWindow);
windowDestroy(gEndgameEndingOverlay);
if (!_endgame_mouse_state) { if (!_endgame_mouse_state) {
mouseHideCursor(); mouseHideCursor();
@ -1212,4 +1229,14 @@ char* endgameDeathEndingGetFileName()
return gEndgameDeathEndingFileName; return gEndgameDeathEndingFileName;
} }
void endgameEndingUpdateOverlay()
{
bufferFill(windowGetBuffer(gEndgameEndingOverlay),
windowGetWidth(gEndgameEndingOverlay),
windowGetHeight(gEndgameEndingOverlay),
windowGetWidth(gEndgameEndingOverlay),
intensityColorTable[_colorTable[0]][0]);
windowRefresh(gEndgameEndingOverlay);
}
} // namespace fallout } // namespace fallout