Fix save game preview

See #3
This commit is contained in:
Alexander Batalov 2022-05-23 11:16:04 +03:00
parent 1f8a62f2b6
commit 99ddcd3d0e
2 changed files with 27 additions and 4 deletions

View File

@ -623,8 +623,18 @@ int _QuickSnapShot()
gameMouseObjectsShow(); gameMouseObjectsShow();
} }
unsigned char* windowBuffer = windowGetBuffer(gIsoWindow); // For preview take 640x380 area in the center of isometric window.
blitBufferToBufferStretch(windowBuffer, 640, 380, 640, _snapshot, LS_PREVIEW_WIDTH, LS_PREVIEW_HEIGHT, LS_PREVIEW_WIDTH); unsigned char* isoWindowBuffer = windowGetBuffer(gIsoWindow)
+ (screenGetWidth() - ORIGINAL_ISO_WINDOW_WIDTH) / 2 * (screenGetHeight() - ORIGINAL_ISO_WINDOW_HEIGHT) / 2
+ (screenGetWidth() - ORIGINAL_ISO_WINDOW_WIDTH) / 2;
blitBufferToBufferStretch(isoWindowBuffer,
ORIGINAL_ISO_WINDOW_WIDTH,
ORIGINAL_ISO_WINDOW_HEIGHT,
windowGetWidth(gIsoWindow),
_snapshot,
LS_PREVIEW_WIDTH,
LS_PREVIEW_HEIGHT,
LS_PREVIEW_WIDTH);
_snapshotBuf = _snapshot; _snapshotBuf = _snapshot;
@ -1094,8 +1104,18 @@ int lsgWindowInit(int windowType)
gameMouseObjectsShow(); gameMouseObjectsShow();
} }
unsigned char* windowBuf = windowGetBuffer(gIsoWindow); // For preview take 640x380 area in the center of isometric window.
blitBufferToBufferStretch(windowBuf, 640, 380, 640, _snapshotBuf, LS_PREVIEW_WIDTH, LS_PREVIEW_HEIGHT, LS_PREVIEW_WIDTH); unsigned char* isoWindowBuffer = windowGetBuffer(gIsoWindow)
+ (screenGetWidth() - ORIGINAL_ISO_WINDOW_WIDTH) / 2 * (screenGetHeight() - ORIGINAL_ISO_WINDOW_HEIGHT) / 2
+ (screenGetWidth() - ORIGINAL_ISO_WINDOW_WIDTH) / 2;
blitBufferToBufferStretch(isoWindowBuffer,
ORIGINAL_ISO_WINDOW_WIDTH,
ORIGINAL_ISO_WINDOW_HEIGHT,
windowGetWidth(gIsoWindow),
_snapshotBuf,
LS_PREVIEW_WIDTH,
LS_PREVIEW_HEIGHT,
LS_PREVIEW_WIDTH);
} }
for (int index = 0; index < LOAD_SAVE_FRM_COUNT; index++) { for (int index = 0; index < LOAD_SAVE_FRM_COUNT; index++) {

View File

@ -12,6 +12,9 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#define ORIGINAL_ISO_WINDOW_WIDTH 640
#define ORIGINAL_ISO_WINDOW_HEIGHT 380
// TODO: Probably not needed -> replace with array? // TODO: Probably not needed -> replace with array?
typedef struct TileData { typedef struct TileData {
int field_0[SQUARE_GRID_SIZE]; int field_0[SQUARE_GRID_SIZE];