Fix help and end game window positions (#21)

This commit is contained in:
Jan Šimek 2022-05-28 05:57:53 +02:00 committed by GitHub
parent ad1fb7765b
commit 49f0d833ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -33,6 +33,9 @@
// The maximum number of subtitle lines per slide. // The maximum number of subtitle lines per slide.
#define ENDGAME_ENDING_MAX_SUBTITLES (50) #define ENDGAME_ENDING_MAX_SUBTITLES (50)
#define ENDGAME_ENDING_WINDOW_WIDTH 640
#define ENDGAME_ENDING_WINDOW_HEIGHT 480
// 0x50B00C // 0x50B00C
char _aEnglish_2[] = ENGLISH; char _aEnglish_2[] = ENGLISH;
@ -270,7 +273,7 @@ void endgameEndingRenderPanningScene(int direction, const char* narratorFileName
int width = artGetWidth(background, 0, 0); int width = artGetWidth(background, 0, 0);
int height = artGetHeight(background, 0, 0); int height = artGetHeight(background, 0, 0);
unsigned char* backgroundData = artGetFrameData(background, 0, 0); unsigned char* backgroundData = artGetFrameData(background, 0, 0);
bufferFill(gEndgameEndingSlideshowWindowBuffer, 640, 480, 640, _colorTable[0]); bufferFill(gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, _colorTable[0]);
endgameEndingLoadPalette(6, 327); endgameEndingLoadPalette(6, 327);
unsigned char palette[768]; unsigned char palette[768];
@ -312,7 +315,7 @@ void endgameEndingRenderPanningScene(int direction, const char* narratorFileName
// TODO: Complex math, setup scene in debugger. // TODO: Complex math, setup scene in debugger.
if (getTicksSince(since) >= v9) { if (getTicksSince(since) >= v9) {
blitBufferToBuffer(backgroundData + start, 640, 480, width, gEndgameEndingSlideshowWindowBuffer, 640); blitBufferToBuffer(backgroundData + start, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, width, gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH);
if (subtitlesLoaded) { if (subtitlesLoaded) {
endgameEndingRefreshSubtitles(); endgameEndingRefreshSubtitles();
@ -371,7 +374,7 @@ void endgameEndingRenderPanningScene(int direction, const char* narratorFileName
artUnlock(backgroundHandle); artUnlock(backgroundHandle);
paletteFadeTo(gPaletteBlack); paletteFadeTo(gPaletteBlack);
bufferFill(gEndgameEndingSlideshowWindowBuffer, 640, 480, 640, _colorTable[0]); bufferFill(gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, _colorTable[0]);
windowRefresh(gEndgameEndingSlideshowWindow); windowRefresh(gEndgameEndingSlideshowWindow);
} }
@ -391,7 +394,7 @@ void endgameEndingRenderStaticScene(int fid, const char* narratorFileName)
unsigned char* backgroundData = artGetFrameData(background, 0, 0); unsigned char* backgroundData = artGetFrameData(background, 0, 0);
if (backgroundData != NULL) { if (backgroundData != NULL) {
blitBufferToBuffer(backgroundData, 640, 480, 640, gEndgameEndingSlideshowWindowBuffer, 640); blitBufferToBuffer(backgroundData, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH);
windowRefresh(gEndgameEndingSlideshowWindow); windowRefresh(gEndgameEndingSlideshowWindow);
endgameEndingLoadPalette((fid & 0xF000000) >> 24, fid & 0xFFF); endgameEndingLoadPalette((fid & 0xF000000) >> 24, fid & 0xFFF);
@ -434,7 +437,7 @@ void endgameEndingRenderStaticScene(int fid, const char* narratorFileName)
break; break;
} }
blitBufferToBuffer(backgroundData, 640, 480, 640, gEndgameEndingSlideshowWindowBuffer, 640); blitBufferToBuffer(backgroundData, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH);
endgameEndingRefreshSubtitles(); endgameEndingRefreshSubtitles();
windowRefresh(gEndgameEndingSlideshowWindow); windowRefresh(gEndgameEndingSlideshowWindow);
soundContinueAll(); soundContinueAll();
@ -487,7 +490,9 @@ int endgameEndingSlideshowWindowInit()
paletteFadeTo(gPaletteBlack); paletteFadeTo(gPaletteBlack);
gEndgameEndingSlideshowWindow = windowCreate(0, 0, 640, 480, _colorTable[0], 4); int windowEndgameEndingX = (screenGetWidth() - ENDGAME_ENDING_WINDOW_WIDTH) / 2;
int windowEndgameEndingY = (screenGetHeight() - ENDGAME_ENDING_WINDOW_HEIGHT) / 2;
gEndgameEndingSlideshowWindow = windowCreate(windowEndgameEndingX, windowEndgameEndingY, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, _colorTable[0], 4);
if (gEndgameEndingSlideshowWindow == -1) { if (gEndgameEndingSlideshowWindow == -1) {
return -1; return -1;
} }

View File

@ -1055,7 +1055,9 @@ void showHelp()
bool colorCycleWasEnabled = colorCycleEnabled(); bool colorCycleWasEnabled = colorCycleEnabled();
colorCycleDisable(); colorCycleDisable();
int win = windowCreate(0, 0, HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, 0, WINDOW_HIDDEN | WINDOW_FLAG_0x04); 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_FLAG_0x04);
if (win != -1) { if (win != -1) {
unsigned char* windowBuffer = windowGetBuffer(win); unsigned char* windowBuffer = windowGetBuffer(win);
if (windowBuffer != NULL) { if (windowBuffer != NULL) {