aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-07-03 23:37:08 +0000
committerFilippos Karapetis2009-07-03 23:37:08 +0000
commitdf9570cb3265f4d81ac41d66d949355491e2df7e (patch)
tree66e0f740882acc879c7beaecf070a6e8f6673475 /engines/sci/engine
parent9a96b20cd0c30dd8b1788637ae8b8b4bb4e5ca38 (diff)
downloadscummvm-rg350-df9570cb3265f4d81ac41d66d949355491e2df7e.tar.gz
scummvm-rg350-df9570cb3265f4d81ac41d66d949355491e2df7e.tar.bz2
scummvm-rg350-df9570cb3265f4d81ac41d66d949355491e2df7e.zip
SCI0 games using older graphics functions are automatically detected now, from the presence of the "TimesSin" and "SinMult" kernel functions. Removed the GF_SCI0_OLDGFXFUNCS game flag
svn-id: r42081
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp2
-rw-r--r--engines/sci/engine/kernel.cpp4
-rw-r--r--engines/sci/engine/kernel.h9
-rw-r--r--engines/sci/engine/kgraphics.cpp12
4 files changed, 20 insertions, 7 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index bbb29ada3b..a1e2c24955 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -89,7 +89,7 @@ int _reset_graphics_input(EngineState *s) {
s->priority_first = 42; // Priority zone 0 ends here
- if (s->_flags & GF_SCI0_OLDGFXFUNCS)
+ if (s->_kernel->usesOldGfxFunctions())
s->priority_last = 200;
else
s->priority_last = 190;
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 8acce8dd6a..b03a073d8f 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -369,6 +369,10 @@ Kernel::Kernel(ResourceManager *resmgr, bool isOldSci0) : _resmgr(resmgr) {
// Map a few special selectors for later use
mapSelectors();
+
+ // SCI0 games using old graphics functions (before version 0.000.502) have the TimesSin
+ // kernel function, whereas newer games have the SinMult kernel function in its place
+ _oldGfxFunctions = !hasKernelFunction("SinMult");
}
Kernel::~Kernel() {
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 46913a5b39..e3ecddca26 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -83,6 +83,14 @@ public:
*/
bool hasKernelFunction(const char *functionName) const;
+ /* Applies to all versions before 0.000.502
+ ** Old SCI versions used to interpret the third DrawPic() parameter inversely,
+ ** with the opposite default value (obviously).
+ ** Also, they used 15 priority zones from 42 to 200 instead of 14 priority
+ ** zones from 42 to 190.
+ */
+ bool usesOldGfxFunctions() const { return _oldGfxFunctions; }
+
// Script dissection/dumping functions
void dissectScript(int scriptNumber, Vocabulary *vocab);
void dumpScriptObject(char *data, int seeker, int objsize);
@@ -126,6 +134,7 @@ private:
bool loadOpcodes();
ResourceManager *_resmgr;
+ bool _oldGfxFunctions;
// Kernel-related lists
/**
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index c2777d9b0e..6e737597d6 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -164,7 +164,7 @@ int _find_view_priority(EngineState *s, int y) {
return j;
return 14; // Maximum
} else {
- if (!(s->_flags & GF_SCI0_OLDGFXFUNCS))
+ if (!s->_kernel->usesOldGfxFunctions())
return SCI0_VIEW_PRIORITY_14_ZONES(y);
else
return SCI0_VIEW_PRIORITY(y) == 15 ? 14 : SCI0_VIEW_PRIORITY(y);
@@ -172,7 +172,7 @@ int _find_view_priority(EngineState *s, int y) {
}
int _find_priority_band(EngineState *s, int nr) {
- if (!(s->_flags & GF_SCI0_OLDGFXFUNCS) && (nr < 0 || nr > 14)) {
+ if (!s->_kernel->usesOldGfxFunctions() && (nr < 0 || nr > 14)) {
if (nr == 15)
return 0xffff;
else {
@@ -181,7 +181,7 @@ int _find_priority_band(EngineState *s, int nr) {
return 0;
}
- if ((s->_flags & GF_SCI0_OLDGFXFUNCS) && (nr < 0 || nr > 15)) {
+ if (s->_kernel->usesOldGfxFunctions() && (nr < 0 || nr > 15)) {
warning("Attempt to get priority band %d", nr);
return 0;
}
@@ -191,7 +191,7 @@ int _find_priority_band(EngineState *s, int nr) {
else {
int retval;
- if (!(s->_flags & GF_SCI0_OLDGFXFUNCS))
+ if (!s->_kernel->usesOldGfxFunctions())
retval = SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr);
else
retval = SCI0_PRIORITY_BAND_FIRST(nr);
@@ -998,7 +998,7 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
gfx_color_t transparent = s->wm_port->_bgcolor;
int picFlags = DRAWPIC01_FLAG_FILL_NORMALLY;
- if (s->_flags & GF_SCI0_OLDGFXFUNCS)
+ if (s->_kernel->usesOldGfxFunctions())
add_to_pic = (argc > 2) ? argv[2].toSint16() : false;
dp.nr = argv[0].toSint16();
@@ -1052,7 +1052,7 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->priority_first = 42;
- if (s->_flags & GF_SCI0_OLDGFXFUNCS)
+ if (s->_kernel->usesOldGfxFunctions())
s->priority_last = 200;
else
s->priority_last = 190;