aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-06 22:45:08 +0000
committerFilippos Karapetis2009-10-06 22:45:08 +0000
commitf72c4d21c7d158345546dd9db95c2ae9a1924f79 (patch)
treecbbaa053b068202648e73d42c6aff93ac8061ffa /engines/sci
parentffc769ca537faa9bea3d640af436c0eab89e6feb (diff)
downloadscummvm-rg350-f72c4d21c7d158345546dd9db95c2ae9a1924f79.tar.gz
scummvm-rg350-f72c4d21c7d158345546dd9db95c2ae9a1924f79.tar.bz2
scummvm-rg350-f72c4d21c7d158345546dd9db95c2ae9a1924f79.zip
More work on the view wrapper code
svn-id: r44723
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/gfx/gfx_resmgr.cpp17
-rw-r--r--engines/sci/gui/gui_view.h1
2 files changed, 15 insertions, 3 deletions
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp
index e0b6abdb23..87e232c052 100644
--- a/engines/sci/gfx/gfx_resmgr.cpp
+++ b/engines/sci/gfx/gfx_resmgr.cpp
@@ -500,6 +500,7 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
IntResMap &resMap = _resourceMaps[GFX_RESOURCE_TYPE_VIEW];
gfx_resource_t *res = resMap.contains(nr) ? resMap[nr] : NULL;
int hash = palette;
+ ViewType viewType = _resMan->getViewType();
gfxr_view_t *view = NULL;
gfxr_loop_t *loop_data = NULL;
@@ -515,8 +516,19 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
SciGuiView *guiView = new SciGuiView(_resMan, _screen, _palette, nr);
+ // Translate view palette
+ view->palette = NULL;
+
+ if (guiView->getPalette()) {
+ GuiPalette viewPalette = guiView->getPalette()->_sysPalette;
+ int colorCount = (viewType == kViewVga) ? 256 : 16;
+ view->palette = new Palette(colorCount);
+
+ for (int c = 0; c < colorCount; c++)
+ view->palette->setColor(c, viewPalette.colors[c].r, viewPalette.colors[c].g, viewPalette.colors[c].b);
+ }
+
view->loops_nr = guiView->getLoopCount();
- view->palette = _staticPalette->getref(); // TODO: this only works in non-VGA games
view->loops = (gfxr_loop_t*)malloc(sizeof(gfxr_loop_t) * ((view->loops_nr) ? view->loops_nr : 1)); /* Alloc 1 if no loop */
for (int i = 0; i < view->loops_nr; i++) {
@@ -534,12 +546,12 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
curCel->height = celInfo->height;
curCel->index_width = celInfo->width;
curCel->index_height = celInfo->height;
- curCel->palette = _staticPalette->getref(); // TODO: this only works in non-VGA games
curCel->palette_revision = 0;
curCel->xoffset = celInfo->displaceX;
curCel->yoffset = celInfo->displaceY;
curCel->alpha_map = 0; // will be allocated by gfx_xlate_pixmap()
curCel->data = 0; // will be allocated by gfx_xlate_pixmap()
+ curCel->palette = view->palette->getref();
}
}
@@ -552,7 +564,6 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
return NULL;
int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr);
- ViewType viewType = _resMan->getViewType();
if (viewType == kViewEga) {
int pal = (getSciVersion() <= SCI_VERSION_01) ? -1 : palette;
diff --git a/engines/sci/gui/gui_view.h b/engines/sci/gui/gui_view.h
index 289edb268a..b52cf585d7 100644
--- a/engines/sci/gui/gui_view.h
+++ b/engines/sci/gui/gui_view.h
@@ -59,6 +59,7 @@ public:
byte *getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo);
void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 paletteNo);
uint16 getLoopCount() const { return _loopCount; }
+ SciGuiPalette *getPalette() const { return _palette; }
private:
void initData(GuiResourceId resourceId);