aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-02-01 17:04:20 +0000
committerFilippos Karapetis2010-02-01 17:04:20 +0000
commit86408ae3bc08509634bde6c21d64f2dd95c502cd (patch)
tree6166ebf270a856fae42d67d54020b3e012bc0a32 /engines
parent16490ab64e68770860fb1607a36a01d966c7d128 (diff)
downloadscummvm-rg350-86408ae3bc08509634bde6c21d64f2dd95c502cd.tar.gz
scummvm-rg350-86408ae3bc08509634bde6c21d64f2dd95c502cd.tar.bz2
scummvm-rg350-86408ae3bc08509634bde6c21d64f2dd95c502cd.zip
Added an initial implementation of kGetHighPlanePri
svn-id: r47799
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kernel.cpp1
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/kernel32.cpp5
-rw-r--r--engines/sci/graphics/gui32.cpp16
-rw-r--r--engines/sci/graphics/gui32.h2
5 files changed, 23 insertions, 2 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 1229ba6d08..158be262ea 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -348,6 +348,7 @@ SciKernelFunction kfunct_mappers[] = {
DEFUN("DeletePlane", kDeletePlane, "o"),
DEFUN("UpdatePlane", kUpdatePlane, "o"),
DEFUN("RepaintPlane", kRepaintPlane, "o"),
+ DEFUN("GetHighPlanePri", kGetHighPlanePri, ""),
DEFUN("FrameOut", kFrameOut, ""),
DEFUN("ListEachElementDo", kListEachElementDo, "li.*"),
DEFUN("ListFirstTrue", kListFirstTrue, "li.*"),
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index bff7a7fe97..18288b55e9 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -413,6 +413,7 @@ reg_t kAddPlane(EngineState *s, int argc, reg_t *argv);
reg_t kDeletePlane(EngineState *s, int argc, reg_t *argv);
reg_t kUpdatePlane(EngineState *s, int argc, reg_t *argv);
reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv);
+reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv);
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv);
reg_t kListIndexOf(EngineState *s, int argc, reg_t *argv);
reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp
index 7a44a145bf..6aaed61cad 100644
--- a/engines/sci/engine/kernel32.cpp
+++ b/engines/sci/engine/kernel32.cpp
@@ -721,6 +721,11 @@ reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
+reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) {
+ warning("kGetHighPlanePri: %d", s->_gui32->getHighPlanePri());
+ return make_reg(0, s->_gui32->getHighPlanePri());
+}
+
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
// This kernel call likely seems to be doing the screen updates,
// as its called right after a view is updated
diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp
index 1f6e21d20e..eb44432da5 100644
--- a/engines/sci/graphics/gui32.cpp
+++ b/engines/sci/graphics/gui32.cpp
@@ -44,7 +44,7 @@
namespace Sci {
SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, Cursor *cursor)
- : _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor) {
+ : _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor), _highPlanePri(0) {
_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen);
}
@@ -231,6 +231,9 @@ void SciGui32::deleteScreenItem(reg_t object) {
void SciGui32::addPlane(reg_t object) {
_planes.push_back(object);
+ byte planePri = GET_SEL32V(_s->_segMan, object, priority) & 0xF;
+ if (planePri > _highPlanePri)
+ _highPlanePri = planePri;
}
void SciGui32::updatePlane(reg_t object) {
@@ -240,9 +243,18 @@ void SciGui32::deletePlane(reg_t object) {
for (uint32 planeNr = 0; planeNr < _planes.size(); planeNr++) {
if (_planes[planeNr] == object) {
_planes.remove_at(planeNr);
- return;
+ break;
}
}
+
+ // Recalculate highPlanePri
+ _highPlanePri = 0;
+
+ for (uint32 planeNr = 0; planeNr < _planes.size(); planeNr++) {
+ byte planePri = GET_SEL32V(_s->_segMan, _planes[planeNr], priority) & 0xF;
+ if (planePri > _highPlanePri)
+ _highPlanePri = planePri;
+ }
}
void SciGui32::frameOut() {
diff --git a/engines/sci/graphics/gui32.h b/engines/sci/graphics/gui32.h
index cdeb7d63e9..e57c972af7 100644
--- a/engines/sci/graphics/gui32.h
+++ b/engines/sci/graphics/gui32.h
@@ -69,6 +69,7 @@ public:
void addPlane(reg_t object);
void updatePlane(reg_t object);
void deletePlane(reg_t object);
+ byte getHighPlanePri() { return _highPlanePri; }
void frameOut();
void globalToLocal(int16 *x, int16 *y, reg_t planeObj);
void localToGlobal(int16 *x, int16 *y, reg_t planeObj);
@@ -91,6 +92,7 @@ protected:
private:
Common::Array<reg_t> _screenItems;
Common::Array<reg_t> _planes;
+ byte _highPlanePri;
};
} // End of namespace Sci