Fix dialog display centering

This commit is contained in:
Alexander Batalov 2022-06-07 23:41:24 +03:00
parent f67841d3b9
commit 2c05b8683d
1 changed files with 10 additions and 2 deletions

View File

@ -4402,11 +4402,19 @@ void gameDialogRenderTalkingHead(Art* headFrm, int frame)
}
unsigned char* src = windowGetBuffer(gIsoWindow);
// Usually rendering functions use `screenGetWidth`/`screenGetHeight` to
// determine rendering position. However in this case `windowGetHeight`
// is a must because isometric window's height can either include
// interface bar or not. Offset is updated accordingly (332 -> 232, the
// missing 100 is interface bar height, which is already accounted for
// when we're using `windowGetHeight`). `windowGetWidth` is used for
// consistency.
blitBufferToBuffer(
src + ((GAME_DIALOG_WINDOW_WIDTH - 332) / 2) * (GAME_DIALOG_WINDOW_WIDTH) + (GAME_DIALOG_WINDOW_WIDTH - 388) / 2,
src + ((windowGetHeight(gIsoWindow) - 232) / 2) * windowGetWidth(gIsoWindow) + (windowGetWidth(gIsoWindow) - 388) / 2,
388,
200,
screenGetWidth(),
windowGetWidth(gIsoWindow),
gGameDialogDisplayBuffer,
GAME_DIALOG_WINDOW_WIDTH);
}