aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/graphics/palette.cpp20
-rw-r--r--engines/sci/graphics/view.cpp2
2 files changed, 17 insertions, 5 deletions
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 339cac8e15..b0969ceb74 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -30,9 +30,11 @@
#include "sci/sci.h"
#include "sci/engine/state.h"
+#include "sci/graphics/cache.h"
#include "sci/graphics/maciconbar.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/screen.h"
+#include "sci/graphics/view.h"
namespace Sci {
@@ -216,15 +218,16 @@ void GfxPalette::set(Palette *newPalette, bool force, bool forceRealMerge) {
_sysPaletteChanged |= merge(newPalette, force, forceRealMerge);
newPalette->timestamp = _sysPalette.timestamp;
+ bool updatePalette = _sysPaletteChanged && _screen->_picNotValid == 0;
+
if (_palVaryResourceId != -1) {
// Pal-vary currently active, we don't set at any time, but also insert into origin palette
insert(newPalette, &_palVaryOriginPalette);
+ palVaryProcess(0, updatePalette);
return;
}
- if (_sysPaletteChanged && _screen->_picNotValid == 0) { // && systime != _sysPalette.timestamp) {
- // Removed timestamp checking, because this shouldnt be needed anymore. I'm leaving it commented just in
- // case this causes regressions
+ if (updatePalette) {
setOnScreen();
_sysPaletteChanged = false;
}
@@ -467,7 +470,16 @@ void GfxPalette::kernelAnimateSet() {
}
void GfxPalette::kernelAssertPalette(GuiResourceId resourceId) {
- warning("kAssertPalette %d", resourceId);
+ // Sometimes invalid viewIds are asked for, ignore those (e.g. qfg1vga)
+ if (!_resMan->testResource(ResourceId(kResourceTypeView, resourceId)))
+ return;
+
+ GfxView *view = g_sci->_gfxCache->getView(resourceId);
+ Palette *viewPalette = view->getPalette();
+ if (viewPalette) {
+ // merge/insert this palette
+ set(viewPalette, true);
+ }
}
// palVary
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 7c33f87a14..40e2a4fb30 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -653,7 +653,7 @@ uint16 GfxView::getCelCount(int16 loopNo) {
}
Palette *GfxView::getPalette() {
- return _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
+ return _embeddedPal ? &_viewPalette : NULL;
}
} // End of namespace Sci