aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2008-09-14 16:29:14 +0000
committerJohannes Schickel2008-09-14 16:29:14 +0000
commiteddae0e105d8ba323523bccf5c78327e15f6f6c7 (patch)
tree17d53d4a3b37cca78fd15333041837a0916c9b11 /engines/kyra
parent8316aba03d24ca6bb91ea5547ee74701800c00a0 (diff)
downloadscummvm-rg350-eddae0e105d8ba323523bccf5c78327e15f6f6c7.tar.gz
scummvm-rg350-eddae0e105d8ba323523bccf5c78327e15f6f6c7.tar.bz2
scummvm-rg350-eddae0e105d8ba323523bccf5c78327e15f6f6c7.zip
Fixed thumbnail creation / loading in kyra.
svn-id: r34527
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui_hof.cpp4
-rw-r--r--engines/kyra/gui_lok.cpp5
-rw-r--r--engines/kyra/gui_mr.cpp4
-rw-r--r--engines/kyra/saveload.cpp1
-rw-r--r--engines/kyra/screen.cpp19
-rw-r--r--engines/kyra/screen.h2
6 files changed, 32 insertions, 3 deletions
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index 0d7b4d973d..a1391320f4 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -796,7 +796,9 @@ int GUI_HoF::optionsButton(Button *button) {
#pragma mark -
void GUI_HoF::createScreenThumbnail(Graphics::Surface &dst) {
- ::createThumbnail(&dst, _vm->_screenBuffer, Screen::SCREEN_W, Screen::SCREEN_H, _screen->getPalette(1));
+ uint8 screenPal[768];
+ _screen->getRealPalette(1, screenPal);
+ ::createThumbnail(&dst, _vm->_screenBuffer, Screen::SCREEN_W, Screen::SCREEN_H, screenPal);
}
void GUI_HoF::setupPalette() {
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index 4d13512751..4efffb0eda 100644
--- a/engines/kyra/gui_lok.cpp
+++ b/engines/kyra/gui_lok.cpp
@@ -204,7 +204,10 @@ void GUI_LoK::createScreenThumbnail(Graphics::Surface &dst) {
uint8 *screen = new uint8[Screen::SCREEN_W*Screen::SCREEN_H];
if (screen) {
_screen->queryPageFromDisk("SEENPAGE.TMP", 0, screen);
- ::createThumbnail(&dst, screen, Screen::SCREEN_W, Screen::SCREEN_H, _screen->getPalette(2));
+
+ uint8 screenPal[768];
+ _screen->getRealPalette(2, screenPal);
+ ::createThumbnail(&dst, screen, Screen::SCREEN_W, Screen::SCREEN_H, screenPal);
}
delete[] screen;
}
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index 11e6f6f1f4..72f214f001 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -1141,7 +1141,9 @@ GUI_MR::GUI_MR(KyraEngine_MR *vm) : GUI_v2(vm), _vm(vm), _screen(vm->_screen) {
}
void GUI_MR::createScreenThumbnail(Graphics::Surface &dst) {
- ::createThumbnail(&dst, _vm->_screenBuffer, Screen::SCREEN_W, Screen::SCREEN_H, _screen->getPalette(0));
+ uint8 screenPal[768];
+ _screen->getRealPalette(0, screenPal);
+ ::createThumbnail(&dst, _vm->_screenBuffer, Screen::SCREEN_W, Screen::SCREEN_H, screenPal);
}
void GUI_MR::flagButtonEnable(Button *button) {
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index da0fd731da..82e896007a 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -43,6 +43,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
header.originalSave = false;
header.oldHeader = false;
header.flags = 0;
+ header.thumbnail = 0;
if (type == MKID_BE('KYRA') || type == MKID_BE('ARYK')) { // old Kyra1 header ID
header.gameID = GI_KYRA1;
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 32fef01083..77512771f7 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -476,6 +476,25 @@ void Screen::setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue) {
setScreenPalette(_currentPalette);
}
+void Screen::getRealPalette(int num, uint8 *dst) {
+ debugC(9, kDebugLevelScreen, "Screen::setRealPalette(%d, %p)", num, (const void *)dst);
+ const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256);
+ const uint8 *palData = getPalette(num);
+
+ if (!palData) {
+ memset(dst, 0, colors * 3);
+ return;
+ }
+
+ for (int i = 0; i < colors; ++i) {
+ dst[0] = (palData[0] << 2) | (palData[0] & 3);
+ dst[1] = (palData[1] << 2) | (palData[1] & 3);
+ dst[2] = (palData[2] << 2) | (palData[2] & 3);
+ dst += 3;
+ palData += 3;
+ }
+}
+
void Screen::setScreenPalette(const uint8 *palData) {
debugC(9, kDebugLevelScreen, "Screen::setScreenPalette(%p)", (const void *)palData);
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 8623856878..58744a9d2a 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -152,6 +152,8 @@ public:
void setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue);
void setScreenPalette(const uint8 *palData);
const uint8 *getScreenPalette() const { return _screenPalette; }
+
+ void getRealPalette(int num, uint8 *dst);
uint8 *getPalette(int num);
// gui specific (processing on _curPage)