Skip to content

Commit

Permalink
Fix endgame slideshow issues
Browse files Browse the repository at this point in the history
See #3
Closes #215
  • Loading branch information
alexbatalov committed Jan 2, 2023
1 parent 8120790 commit 03145e4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/endgame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ static void _endgame_movie_bk_process();
static int endgameEndingInit();
static void endgameEndingFree();
static int endgameDeathEndingValidate(int* percentage);
static void endgameEndingUpdateOverlay();

// The number of lines in current subtitles file.
//
Expand Down Expand Up @@ -204,6 +205,8 @@ static unsigned char* gEndgameEndingSlideshowWindowBuffer;
// 0x570BF4
static int gEndgameEndingSlideshowWindow;

static int gEndgameEndingOverlay;

// 0x43F788
void endgamePlaySlideshow()
{
Expand Down Expand Up @@ -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]);
endgameEndingLoadPalette(6, 327);

// CE: Update overlay.
endgameEndingUpdateOverlay();

unsigned char palette[768];
memcpy(palette, _cmap, 768);

Expand Down Expand Up @@ -454,6 +460,9 @@ static void endgameEndingRenderStaticScene(int fid, const char* narratorFileName

endgameEndingLoadPalette(FID_TYPE(fid), fid & 0xFFF);

// CE: Update overlay.
endgameEndingUpdateOverlay();

endgameEndingVoiceOverInit(narratorFileName);

unsigned int delay;
Expand Down Expand Up @@ -555,6 +564,13 @@ static int endgameEndingSlideshowWindowInit()

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 windowEndgameEndingY = (screenGetHeight() - ENDGAME_ENDING_WINDOW_HEIGHT) / 2;
gEndgameEndingSlideshowWindow = windowCreate(windowEndgameEndingX,
Expand Down Expand Up @@ -623,6 +639,7 @@ static void endgameEndingSlideshowWindowFree()

speechSetEndCallback(NULL);
windowDestroy(gEndgameEndingSlideshowWindow);
windowDestroy(gEndgameEndingOverlay);

if (!_endgame_mouse_state) {
mouseHideCursor();
Expand Down Expand Up @@ -1212,4 +1229,14 @@ char* endgameDeathEndingGetFileName()
return gEndgameDeathEndingFileName;
}

void endgameEndingUpdateOverlay()
{
bufferFill(windowGetBuffer(gEndgameEndingOverlay),
windowGetWidth(gEndgameEndingOverlay),
windowGetHeight(gEndgameEndingOverlay),
windowGetWidth(gEndgameEndingOverlay),
intensityColorTable[_colorTable[0]][0]);
windowRefresh(gEndgameEndingOverlay);
}

} // namespace fallout

0 comments on commit 03145e4

Please sign in to comment.