aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-02-05 22:20:46 +0000
committerMartin Kiewitz2010-02-05 22:20:46 +0000
commit71fb77a5aa9b3e64f535ff06d58f1a31f6778d49 (patch)
tree5d2cd40697cbb650ed182b43441fc228cac9b4fe /engines
parent9b5363c0e4ea8b37c4c94c1a2fa2e28d23858d1f (diff)
downloadscummvm-rg350-71fb77a5aa9b3e64f535ff06d58f1a31f6778d49.tar.gz
scummvm-rg350-71fb77a5aa9b3e64f535ff06d58f1a31f6778d49.tar.bz2
scummvm-rg350-71fb77a5aa9b3e64f535ff06d58f1a31f6778d49.zip
SCI: priority band specific stuff now gets called directly w/o SciGui
svn-id: r47916
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kgraphics.cpp8
-rw-r--r--engines/sci/graphics/animate.cpp10
-rw-r--r--engines/sci/graphics/gui.cpp32
-rw-r--r--engines/sci/graphics/gui.h6
-rw-r--r--engines/sci/graphics/ports.cpp28
-rw-r--r--engines/sci/graphics/ports.h11
6 files changed, 43 insertions, 52 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index e48abd0cc6..4e250a46ed 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -296,7 +296,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
case K_GRAPH_ADJUST_PRIORITY:
// Seems to be only implemented for SCI0/SCI01 games
debugC(2, kDebugLevelGraphics, "adjust_priority(%d, %d)", argv[1].toUint16(), argv[2].toUint16());
- s->_gui->graphAdjustPriority(argv[1].toUint16(), argv[2].toUint16());
+ s->_gfxPorts->kernelGraphAdjustPriority(argv[1].toUint16(), argv[2].toUint16());
break;
case K_GRAPH_SAVE_UPSCALEDHIRES_BOX:
@@ -372,17 +372,17 @@ reg_t kCoordPri(EngineState *s, int argc, reg_t *argv) {
int16 y = argv[0].toSint16();
if ((argc < 2) || (y != 1)) {
- return make_reg(0, s->_gui->coordinateToPriority(y));
+ return make_reg(0, s->_gfxPorts->kernelCoordinateToPriority(y));
} else {
int16 priority = argv[1].toSint16();
- return make_reg(0, s->_gui->priorityToCoordinate(priority));
+ return make_reg(0, s->_gfxPorts->kernelPriorityToCoordinate(priority));
}
}
reg_t kPriCoord(EngineState *s, int argc, reg_t *argv) {
int16 priority = argv[0].toSint16();
- return make_reg(0, s->_gui->priorityToCoordinate(priority));
+ return make_reg(0, s->_gfxPorts->kernelPriorityToCoordinate(priority));
}
reg_t kDirLoop(EngineState *s, int argc, reg_t *argv) {
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index fb790159ca..abf386d934 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -241,7 +241,7 @@ void GfxAnimate::fill(byte &old_picNotValid) {
// Calculate current priority according to y-coordinate
if (!(signal & kSignalFixedPriority)) {
- listEntry->priority = _ports->coordinateToPriority(listEntry->y);
+ listEntry->priority = _ports->kernelCoordinateToPriority(listEntry->y);
PUT_SEL32V(_s->_segMan, curObject, priority, listEntry->priority);
}
@@ -315,7 +315,7 @@ void GfxAnimate::update() {
signal &= 0xFFFF ^ (kSignalStopUpdate | kSignalViewUpdated | kSignalNoUpdate | kSignalForceUpdate);
if ((signal & kSignalIgnoreActor) == 0) {
rect = listEntry->celRect;
- rect.top = CLIP<int16>(_ports->priorityToCoordinate(listEntry->priority) - 1, rect.top, rect.bottom - 1);
+ rect.top = CLIP<int16>(_ports->kernelPriorityToCoordinate(listEntry->priority) - 1, rect.top, rect.bottom - 1);
_paint16->fillRect(rect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15);
}
listEntry->signal = signal;
@@ -360,7 +360,7 @@ void GfxAnimate::update() {
if ((signal & kSignalIgnoreActor) == 0) {
rect = listEntry->celRect;
- rect.top = CLIP<int16>(_ports->priorityToCoordinate(listEntry->priority) - 1, rect.top, rect.bottom - 1);
+ rect.top = CLIP<int16>(_ports->kernelPriorityToCoordinate(listEntry->priority) - 1, rect.top, rect.bottom - 1);
_paint16->fillRect(rect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15);
}
}
@@ -556,7 +556,7 @@ void GfxAnimate::addToPicDrawCels() {
curObject = listEntry->object;
if (listEntry->priority == -1)
- listEntry->priority = _ports->coordinateToPriority(listEntry->y);
+ listEntry->priority = _ports->kernelCoordinateToPriority(listEntry->y);
// Get the corresponding view
view = _cache->getView(listEntry->viewId);
@@ -567,7 +567,7 @@ void GfxAnimate::addToPicDrawCels() {
// draw corresponding cel
_paint16->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo);
if ((listEntry->signal & kSignalIgnoreActor) == 0) {
- listEntry->celRect.top = CLIP<int16>(_ports->priorityToCoordinate(listEntry->priority) - 1, listEntry->celRect.top, listEntry->celRect.bottom - 1);
+ listEntry->celRect.top = CLIP<int16>(_ports->kernelPriorityToCoordinate(listEntry->priority) - 1, listEntry->celRect.top, listEntry->celRect.bottom - 1);
_paint16->fillRect(listEntry->celRect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15);
}
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index a2f41bf746..44bf96eba6 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -89,22 +89,8 @@ void SciGui::resetEngineState(EngineState *s) {
}
void SciGui::init(bool usesOldGfxFunctions) {
- _usesOldGfxFunctions = usesOldGfxFunctions;
-
- _ports->init(this, _paint16, _text16, _s->_gameId);
+ _ports->init(usesOldGfxFunctions, this, _paint16, _text16, _s->_gameId);
_paint16->init(_animate, _text16);
- initPriorityBands();
-}
-
-void SciGui::initPriorityBands() {
- if (_usesOldGfxFunctions) {
- _ports->priorityBandsInit(15, 42, 200);
- } else {
- if (getSciVersion() >= SCI_VERSION_1_1)
- _ports->priorityBandsInit(14, 0, 190);
- else
- _ports->priorityBandsInit(14, 42, 190);
- }
}
void SciGui::wait(int16 ticks) {
@@ -118,14 +104,6 @@ void SciGui::wait(int16 ticks) {
kernel_sleep(_s->_event, ticks * 1000 / 60);
}
-int16 SciGui::coordinateToPriority(int16 y) {
- return _ports->coordinateToPriority(y);
-}
-
-int16 SciGui::priorityToCoordinate(int16 priority) {
- return _ports->priorityToCoordinate(priority);
-}
-
#define SCI_DISPLAY_MOVEPEN 100
#define SCI_DISPLAY_SETALIGNMENT 101
#define SCI_DISPLAY_SETPENCOLOR 102
@@ -248,14 +226,6 @@ void SciGui::textColors(int argc, reg_t *argv) {
_text16->CodeSetColors(argc, argv);
}
-void SciGui::graphAdjustPriority(int top, int bottom) {
- if (_usesOldGfxFunctions) {
- _ports->priorityBandsInit(15, top, bottom);
- } else {
- _ports->priorityBandsInit(14, top, bottom);
- }
-}
-
void SciGui::shakeScreen(uint16 shakeCount, uint16 directions) {
while (shakeCount--) {
if (directions & SCI_SHAKE_DIRECTION_VERTICAL)
diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h
index b37c87ac4d..5c03b201f3 100644
--- a/engines/sci/graphics/gui.h
+++ b/engines/sci/graphics/gui.h
@@ -52,8 +52,6 @@ public:
virtual void init(bool usesOldGfxFunctions);
virtual void wait(int16 ticks);
- virtual int16 coordinateToPriority(int16 y);
- virtual int16 priorityToCoordinate(int16 priority);
virtual void display(const char *text, int argc, reg_t *argv);
@@ -61,8 +59,6 @@ public:
virtual void textFonts(int argc, reg_t *argv);
virtual void textColors(int argc, reg_t *argv);
- virtual void graphAdjustPriority(int top, int bottom);
-
virtual void shakeScreen(uint16 shakeCount, uint16 directions);
virtual reg_t portraitLoad(Common::String resourceName);
@@ -86,8 +82,6 @@ protected:
GfxPaint16 *_paint16;
private:
- virtual void initPriorityBands();
-
AudioPlayer *_audio;
GfxAnimate *_animate;
GfxControls *_controls;
diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp
index 6457b46f7d..aed867b604 100644
--- a/engines/sci/graphics/ports.cpp
+++ b/engines/sci/graphics/ports.cpp
@@ -54,9 +54,10 @@ GfxPorts::~GfxPorts() {
delete _menuPort;
}
-void GfxPorts::init(SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16, Common::String gameId) {
+void GfxPorts::init(bool usesOldGfxFunctions, SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16, Common::String gameId) {
int16 offTop = 10;
+ _usesOldGfxFunctions = usesOldGfxFunctions;
_gui = gui;
_paint16 = paint16;
_text16 = text16;
@@ -103,6 +104,8 @@ void GfxPorts::init(SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16, Common:
_picWind = newWindow(Common::Rect(0, offTop, _screen->getWidth(), _screen->getHeight()), 0, 0, SCI_WINDOWMGR_STYLE_TRANSPARENT | SCI_WINDOWMGR_STYLE_NOFRAME, 0, true);
priorityBandsMemoryActive = false;
+
+ kernelInitPriorityBands();
}
void GfxPorts::kernelSetActive(uint16 portId) {
@@ -510,7 +513,26 @@ void GfxPorts::priorityBandsRecall() {
}
}
-byte GfxPorts::coordinateToPriority(int16 y) {
+void GfxPorts::kernelInitPriorityBands() {
+ if (_usesOldGfxFunctions) {
+ priorityBandsInit(15, 42, 200);
+ } else {
+ if (getSciVersion() >= SCI_VERSION_1_1)
+ priorityBandsInit(14, 0, 190);
+ else
+ priorityBandsInit(14, 42, 190);
+ }
+}
+
+void GfxPorts::kernelGraphAdjustPriority(int top, int bottom) {
+ if (_usesOldGfxFunctions) {
+ priorityBandsInit(15, top, bottom);
+ } else {
+ priorityBandsInit(14, top, bottom);
+ }
+}
+
+byte GfxPorts::kernelCoordinateToPriority(int16 y) {
if (y < _priorityTop)
return _priorityBands[_priorityTop];
if (y > _priorityBottom)
@@ -518,7 +540,7 @@ byte GfxPorts::coordinateToPriority(int16 y) {
return _priorityBands[y];
}
-int16 GfxPorts::priorityToCoordinate(byte priority) {
+int16 GfxPorts::kernelPriorityToCoordinate(byte priority) {
int16 y;
if (priority <= _priorityBandCount) {
for (y = 0; y <= _priorityBottom; y++)
diff --git a/engines/sci/graphics/ports.h b/engines/sci/graphics/ports.h
index 2b2449bbef..a4fb93e38b 100644
--- a/engines/sci/graphics/ports.h
+++ b/engines/sci/graphics/ports.h
@@ -45,7 +45,7 @@ public:
GfxPorts(SegManager *segMan, GfxScreen *screen);
~GfxPorts();
- void init(SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16, Common::String gameId);
+ void init(bool usesOldGfxFunctions, SciGui *gui, GfxPaint16 *paint16, GfxText16 *text16, Common::String gameId);
void kernelSetActive(uint16 portId);
Common::Rect kernelGetPicWindow(int16 &picTop, int16 &picLeft);
@@ -83,8 +83,11 @@ public:
void priorityBandsInit(byte *data);
void priorityBandsRemember(byte *data);
void priorityBandsRecall();
- byte coordinateToPriority(int16 y);
- int16 priorityToCoordinate(byte priority);
+
+ void kernelInitPriorityBands();
+ void kernelGraphAdjustPriority(int top, int bottom);
+ byte kernelCoordinateToPriority(int16 y);
+ int16 kernelPriorityToCoordinate(byte priority);
Port *_wmgrPort;
Window *_picWind;
@@ -104,6 +107,8 @@ private:
GfxScreen *_screen;
GfxText16 *_text16;
+ bool _usesOldGfxFunctions;
+
/** The list of open 'windows' (and ports), in visual order. */
PortList _windowList;