From 12cbfe262c4493b1f546632322df5e3d41020f69 Mon Sep 17 00:00:00 2001 From: k3tamina Date: Tue, 7 Jun 2022 23:14:52 +0200 Subject: [PATCH] Fix save game preview (#33) --- src/loadsave.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/loadsave.cc b/src/loadsave.cc index f336201..12eabd8 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -626,9 +626,10 @@ int _QuickSnapShot() } // For preview take 640x380 area in the center of isometric window. - unsigned char* isoWindowBuffer = windowGetBuffer(gIsoWindow) - + (screenGetWidth() - ORIGINAL_ISO_WINDOW_WIDTH) / 2 * (screenGetHeight() - ORIGINAL_ISO_WINDOW_HEIGHT) / 2 - + (screenGetWidth() - ORIGINAL_ISO_WINDOW_WIDTH) / 2; + Window* window = windowGetWindow(gIsoWindow); + unsigned char* isoWindowBuffer = window->buffer + + window->width * (window->height - ORIGINAL_ISO_WINDOW_HEIGHT) / 2 + + (window->width - ORIGINAL_ISO_WINDOW_WIDTH) / 2; blitBufferToBufferStretch(isoWindowBuffer, ORIGINAL_ISO_WINDOW_WIDTH, ORIGINAL_ISO_WINDOW_HEIGHT, @@ -1107,9 +1108,10 @@ int lsgWindowInit(int windowType) } // For preview take 640x380 area in the center of isometric window. - unsigned char* isoWindowBuffer = windowGetBuffer(gIsoWindow) - + (screenGetWidth() - ORIGINAL_ISO_WINDOW_WIDTH) / 2 * (screenGetHeight() - ORIGINAL_ISO_WINDOW_HEIGHT) / 2 - + (screenGetWidth() - ORIGINAL_ISO_WINDOW_WIDTH) / 2; + Window* window = windowGetWindow(gIsoWindow); + unsigned char* isoWindowBuffer = window->buffer + + window->width * (window->height - ORIGINAL_ISO_WINDOW_HEIGHT) / 2 + + (window->width - ORIGINAL_ISO_WINDOW_WIDTH) / 2; blitBufferToBufferStretch(isoWindowBuffer, ORIGINAL_ISO_WINDOW_WIDTH, ORIGINAL_ISO_WINDOW_HEIGHT,