aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-25 20:46:14 +0000
committerMartin Kiewitz2009-10-25 20:46:14 +0000
commit0315264328af6b34a4c9e1028bba07a636da5df8 (patch)
tree2f675adcb97a3c9863f3bb77ed05eae658ec85bf /engines/sci
parentfa627f4233e56f3ecf8d66d52cb598070a84f9ac (diff)
downloadscummvm-rg350-0315264328af6b34a4c9e1028bba07a636da5df8.tar.gz
scummvm-rg350-0315264328af6b34a4c9e1028bba07a636da5df8.tar.bz2
scummvm-rg350-0315264328af6b34a4c9e1028bba07a636da5df8.zip
SCI/newgui: SciGuiView is now able to detect "straight" EGA mappings and will then ignore the mapping. This will result in undithering working for those views. All EGA-mapping views in qfg2 seem to be special fx related so they dont need undithering at all
svn-id: r45377
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/gui/gui_view.cpp23
-rw-r--r--engines/sci/gui/gui_view.h3
2 files changed, 22 insertions, 4 deletions
diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp
index 788034871c..91d8067c3c 100644
--- a/engines/sci/gui/gui_view.cpp
+++ b/engines/sci/gui/gui_view.cpp
@@ -52,6 +52,10 @@ SciGuiView::~SciGuiView() {
_resMan->unlockResource(_resource);
}
+static const byte EGAmappingStraight[SCI_VIEW_EGAMAPPING_SIZE] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+};
+
void SciGuiView::initData(GuiResourceId resourceId) {
_resource = _resMan->findResource(ResourceId(kResourceTypeView, resourceId), true);
if (!_resource) {
@@ -67,7 +71,7 @@ void SciGuiView::initData(GuiResourceId resourceId) {
uint16 palOffset = 0;
uint16 headerSize = 0;
uint16 loopSize = 0, celSize = 0;
- int loopNo, celNo;
+ int loopNo, celNo, EGAmapNr;
byte seekEntry;
bool IsEGA = false;
@@ -97,8 +101,19 @@ void SciGuiView::initData(GuiResourceId resourceId) {
_embeddedPal = true;
} else {
// Only use the EGA-mapping, when being SCI1
- if (getSciVersion() >= SCI_VERSION_1_EGA)
+ if (getSciVersion() >= SCI_VERSION_1_EGA) {
_EGAmapping = &_resourceData[palOffset];
+ for (EGAmapNr = 0; EGAmapNr < SCI_VIEW_EGAMAPPING_COUNT; EGAmapNr++) {
+ if (memcmp(_EGAmapping, EGAmappingStraight, SCI_VIEW_EGAMAPPING_SIZE)!=0)
+ break;
+ _EGAmapping += SCI_VIEW_EGAMAPPING_SIZE;
+ }
+ // If all mappings are "straight", then we actually ignore the mapping
+ if (EGAmapNr == SCI_VIEW_EGAMAPPING_COUNT)
+ _EGAmapping = NULL;
+ else
+ _EGAmapping = &_resourceData[palOffset];
+ }
}
}
@@ -373,7 +388,7 @@ void SciGuiView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte
// Makes no sense to process bitmaps that are 3 pixels wide or less
if (width <= 3) return;
- // TODO: Implement ability to undither bitmaps when EGAmappings are set (qfg2)
+ // If EGA mapping is used for this view, dont do undithering as well
if (_EGAmapping)
return;
@@ -466,7 +481,7 @@ void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect cli
}
}
} else {
- byte *EGAmapping = _EGAmapping + (EGAmappingNr * 16);
+ byte *EGAmapping = _EGAmapping + (EGAmappingNr * SCI_VIEW_EGAMAPPING_SIZE);
for (y = clipRectTranslated.top; y < clipRectTranslated.top + height; y++, bitmap += celWidth) {
for (x = 0; x < width; x++) {
color = EGAmapping[bitmap[x]];
diff --git a/engines/sci/gui/gui_view.h b/engines/sci/gui/gui_view.h
index 485f738da9..09b7b69aa2 100644
--- a/engines/sci/gui/gui_view.h
+++ b/engines/sci/gui/gui_view.h
@@ -45,6 +45,9 @@ struct sciViewLoopInfo {
sciViewCelInfo *cel;
};
+#define SCI_VIEW_EGAMAPPING_SIZE 16
+#define SCI_VIEW_EGAMAPPING_COUNT 8
+
class SciGuiView {
public:
SciGuiView(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette, GuiResourceId resourceId);