aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-02-05 14:48:51 +0000
committerMartin Kiewitz2010-02-05 14:48:51 +0000
commitf8f490c565809c93ca35928210a740b6579fba19 (patch)
tree94c07530aa26dc845eb7d1731a18f8f8c0aeaa0d /engines/sci
parent6c204cc890ed769f4d9268e80c6814c2eb95eb02 (diff)
downloadscummvm-rg350-f8f490c565809c93ca35928210a740b6579fba19.tar.gz
scummvm-rg350-f8f490c565809c93ca35928210a740b6579fba19.tar.bz2
scummvm-rg350-f8f490c565809c93ca35928210a740b6579fba19.zip
SCI: calling most of the cursor functions directly via _gfxCursor instead of SciGui/32
svn-id: r47903
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/console.cpp4
-rw-r--r--engines/sci/engine/kevent.cpp7
-rw-r--r--engines/sci/engine/kgraphics.cpp49
-rw-r--r--engines/sci/engine/state.h2
-rw-r--r--engines/sci/graphics/animate.cpp4
-rw-r--r--engines/sci/graphics/cursor.cpp16
-rw-r--r--engines/sci/graphics/cursor.h8
-rw-r--r--engines/sci/graphics/gui.cpp24
-rw-r--r--engines/sci/graphics/gui.h6
-rw-r--r--engines/sci/graphics/gui32.cpp24
-rw-r--r--engines/sci/graphics/gui32.h6
-rw-r--r--engines/sci/graphics/menu.cpp4
-rw-r--r--engines/sci/sci.cpp1
13 files changed, 31 insertions, 124 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 15e290a07a..a2c94b5878 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -219,7 +219,7 @@ void Console::postEnter() {
_engine->_gamestate->_soundCmd->pauseAll(false);
if (!_videoFile.empty()) {
- _engine->_gamestate->_gui->hideCursor();
+ _engine->_gamestate->_gfxCursor->kernelHide();
if (_videoFile.hasSuffix(".seq")) {
SeqDecoder *seqDecoder = new SeqDecoder();
@@ -255,7 +255,7 @@ void Console::postEnter() {
#endif
}
- _engine->_gamestate->_gui->showCursor();
+ _engine->_gamestate->_gfxCursor->kernelShow();
_videoFile.clear();
_videoFrameDelay = 0;
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 40ea736a8c..0224ecae90 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -47,12 +47,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
SegManager *segMan = s->_segMan;
Common::Point mousePos;
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- mousePos = s->_gui32->getCursorPos();
- else
-#endif
- mousePos = s->_gui->getCursorPos();
+ mousePos = s->_gfxCursor->getPosition();
// If there's a simkey pending, and the game wants a keyboard event, use the
// simkey instead of a normal event
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 7f8ee9de31..b9d898c102 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -107,7 +107,7 @@ static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) {
cursorId = -1;
}
- s->_gui->setCursorShape(cursorId);
+ s->_gfxCursor->kernelSetShape(cursorId);
return s->r_acc;
}
@@ -119,12 +119,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
case 1:
switch (argv[0].toSint16()) {
case 0:
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->hideCursor();
- else
-#endif
- s->_gui->hideCursor();
+ s->_gfxCursor->kernelHide();
break;
case -1:
// TODO: Special case at least in kq6, check disassembly
@@ -133,12 +128,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
// TODO: Special case at least in kq6, check disassembly
break;
default:
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->showCursor();
- else
-#endif
- s->_gui->showCursor();
+ s->_gfxCursor->kernelShow();
break;
}
case 2:
@@ -176,12 +166,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
hotspot = new Common::Point(argv[3].toSint16(), argv[4].toSint16());
// Fallthrough
case 3:
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
- else
-#endif
- s->_gui->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
+ s->_gfxCursor->kernelSetView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
break;
default :
warning("kSetCursor: Unhandled case: %d arguments given", argc);
@@ -1139,19 +1124,9 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
// previously visible.
bool reshowCursor;
-#ifdef ENABLE_SCI32
- if (s->_gui32) {
- reshowCursor = s->_gui32->isCursorVisible();
- if (reshowCursor)
- s->_gui32->hideCursor();
- } else {
-#endif
- reshowCursor = s->_gui->isCursorVisible();
- if (reshowCursor)
- s->_gui->hideCursor();
-#ifdef ENABLE_SCI32
- }
-#endif
+ reshowCursor = s->_gfxCursor->isVisible();
+ if (reshowCursor)
+ s->_gfxCursor->kernelHide();
// The Windows and DOS versions use different video format as well
// as a different argument set.
@@ -1218,14 +1193,8 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
s->_gfxScreen->kernelSyncWithFramebuffer();
}
- if (reshowCursor) {
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->showCursor();
- else
-#endif
- s->_gui->showCursor();
- }
+ if (reshowCursor)
+ s->_gfxCursor->kernelShow();
return s->r_acc;
}
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index abf8af4970..a11ba50855 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -54,6 +54,7 @@ class SciEvent;
class GfxAnimate;
class GfxCache;
class GfxControls;
+class GfxCursor;
class GfxMenu;
class GfxPaint;
class GfxPaint16;
@@ -153,6 +154,7 @@ public:
GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
GfxCache *_gfxCache;
GfxControls *_gfxControls; // Controls for 16-bit gfx
+ GfxCursor *_gfxCursor;
GfxMenu *_gfxMenu; // Menu for 16-bit gfx
GfxPalette *_gfxPalette;
GfxPaint *_gfxPaint;
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index 5cd6346100..fb790159ca 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -591,12 +591,12 @@ void GfxAnimate::animateShowPic() {
bool previousCursorState = _cursor->isVisible();
if (previousCursorState)
- _cursor->hide();
+ _cursor->kernelHide();
// Adjust picRect to become relative to screen
picRect.translate(picPort->left, picPort->top);
_transitions->doit(picRect);
if (previousCursorState)
- _cursor->show();
+ _cursor->kernelShow();
// We set SCI1.1 priority band information here
_ports->priorityBandsRecall();
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index ff681922ad..5de0166c98 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -51,12 +51,12 @@ GfxCursor::~GfxCursor() {
purgeCache();
}
-void GfxCursor::show() {
+void GfxCursor::kernelShow() {
CursorMan.showMouse(true);
_isVisible = true;
}
-void GfxCursor::hide() {
+void GfxCursor::kernelHide() {
CursorMan.showMouse(false);
_isVisible = false;
}
@@ -74,7 +74,7 @@ void GfxCursor::purgeCache() {
_cachedCursors.clear();
}
-void GfxCursor::setShape(GuiResourceId resourceId) {
+void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
Resource *resource;
byte *resourceData;
Common::Point hotspot = Common::Point(0, 0);
@@ -87,7 +87,7 @@ void GfxCursor::setShape(GuiResourceId resourceId) {
if (resourceId == -1) {
// no resourceId given, so we actually hide the cursor
- hide();
+ kernelHide();
delete[] rawBitmap;
return;
}
@@ -128,12 +128,12 @@ void GfxCursor::setShape(GuiResourceId resourceId) {
}
CursorMan.replaceCursor(rawBitmap, SCI_CURSOR_SCI0_HEIGHTWIDTH, SCI_CURSOR_SCI0_HEIGHTWIDTH, hotspot.x, hotspot.y, SCI_CURSOR_SCI0_TRANSPARENCYCOLOR);
- show();
+ kernelShow();
delete[] rawBitmap;
}
-void GfxCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot) {
+void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot) {
if (_cachedCursors.size() >= MAX_CACHED_CURSORS)
purgeCache();
@@ -153,7 +153,7 @@ void GfxCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::
// Eco Quest 1 uses a 1x1 transparent cursor to hide the cursor from the user. Some scalers don't seem to support this
if (width < 2 || height < 2) {
- hide();
+ kernelHide();
delete cursorHotspot;
return;
}
@@ -175,7 +175,7 @@ void GfxCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::
if (_upscaledHires)
delete[] cursorBitmap;
- show();
+ kernelShow();
delete cursorHotspot;
}
diff --git a/engines/sci/graphics/cursor.h b/engines/sci/graphics/cursor.h
index 311a0ef876..3de6621ead 100644
--- a/engines/sci/graphics/cursor.h
+++ b/engines/sci/graphics/cursor.h
@@ -45,11 +45,11 @@ public:
GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen);
~GfxCursor();
- void show();
- void hide();
+ void kernelShow();
+ void kernelHide();
bool isVisible();
- void setShape(GuiResourceId resourceId);
- void setView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot);
+ void kernelSetShape(GuiResourceId resourceId);
+ void kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot);
void setPosition(Common::Point pos);
Common::Point getPosition();
void refreshPosition();
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index 2c22619b6b..741b5d7e82 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -391,36 +391,12 @@ void SciGui::baseSetter(reg_t object) {
}
}
-void SciGui::hideCursor() {
- _cursor->hide();
-}
-
-void SciGui::showCursor() {
- _cursor->show();
-}
-
-bool SciGui::isCursorVisible() {
- return _cursor->isVisible();
-}
-
-void SciGui::setCursorShape(GuiResourceId cursorId) {
- _cursor->setShape(cursorId);
-}
-
-void SciGui::setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot) {
- _cursor->setView(viewNum, loopNum, cellNum, hotspot);
-}
-
void SciGui::setCursorPos(Common::Point pos) {
pos.y += _ports->getPort()->top;
pos.x += _ports->getPort()->left;
moveCursor(pos);
}
-Common::Point SciGui::getCursorPos() {
- return _cursor->getPosition();
-}
-
void SciGui::moveCursor(Common::Point pos) {
pos.y += _ports->_picWind->rect.top;
pos.x += _ports->_picWind->rect.left;
diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h
index f2904d5ff2..569cc323e3 100644
--- a/engines/sci/graphics/gui.h
+++ b/engines/sci/graphics/gui.h
@@ -87,13 +87,7 @@ public:
virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
virtual void baseSetter(reg_t object);
- void hideCursor();
- void showCursor();
- bool isCursorVisible();
- void setCursorShape(GuiResourceId cursorId);
- void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
virtual void setCursorPos(Common::Point pos);
- Common::Point getCursorPos();
virtual void moveCursor(Common::Point pos);
void setCursorZone(Common::Rect zone);
diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp
index 170acd07d5..0191504b55 100644
--- a/engines/sci/graphics/gui32.cpp
+++ b/engines/sci/graphics/gui32.cpp
@@ -176,36 +176,12 @@ void SciGui32::baseSetter(reg_t object) {
}
}
-void SciGui32::hideCursor() {
- _cursor->hide();
-}
-
-void SciGui32::showCursor() {
- _cursor->show();
-}
-
-bool SciGui32::isCursorVisible() {
- return _cursor->isVisible();
-}
-
-void SciGui32::setCursorShape(GuiResourceId cursorId) {
- _cursor->setShape(cursorId);
-}
-
-void SciGui32::setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot) {
- _cursor->setView(viewNum, loopNum, cellNum, hotspot);
-}
-
void SciGui32::setCursorPos(Common::Point pos) {
//pos.y += _gfx->GetPort()->top;
//pos.x += _gfx->GetPort()->left;
moveCursor(pos);
}
-Common::Point SciGui32::getCursorPos() {
- return _cursor->getPosition();
-}
-
void SciGui32::moveCursor(Common::Point pos) {
// pos.y += _windowMgr->_picWind->rect.top;
// pos.x += _windowMgr->_picWind->rect.left;
diff --git a/engines/sci/graphics/gui32.h b/engines/sci/graphics/gui32.h
index e8d909292c..28e15fecba 100644
--- a/engines/sci/graphics/gui32.h
+++ b/engines/sci/graphics/gui32.h
@@ -55,13 +55,7 @@ public:
bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
void baseSetter(reg_t object);
- void hideCursor();
- void showCursor();
- bool isCursorVisible();
- void setCursorShape(GuiResourceId cursorId);
- void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
void setCursorPos(Common::Point pos);
- Common::Point getCursorPos();
void moveCursor(Common::Point pos);
void setCursorZone(Common::Rect zone);
diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index d2545c5e47..78f5899b32 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -591,12 +591,12 @@ void GfxMenu::invertMenuSelection(uint16 itemId) {
void GfxMenu::interactiveShowMouse() {
_mouseOldState = _cursor->isVisible();
- _cursor->show();
+ _cursor->kernelShow();
}
void GfxMenu::interactiveRestoreMouse() {
if (!_mouseOldState)
- _cursor->hide();
+ _cursor->kernelHide();
}
uint16 GfxMenu::mouseFindMenuSelection(Common::Point mousePosition) {
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index e36614f5c0..3b6d0f8230 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -196,6 +196,7 @@ Common::Error SciEngine::run() {
_gamestate->_gfxPalette = palette;
_gamestate->_gfxScreen = screen;
_gamestate->_gfxCache = cache;
+ _gamestate->_gfxCursor = cursor;
if (game_init(_gamestate)) { /* Initialize */
warning("Game initialization failed: Aborting...");