[Scummvm-cvs-logs] SF.net SVN: scummvm:[47914] scummvm/trunk/engines/sci
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Fri Feb 5 22:09:36 CET 2010
Revision: 47914
http://scummvm.svn.sourceforge.net/scummvm/?rev=47914&view=rev
Author: m_kiewitz
Date: 2010-02-05 21:09:36 +0000 (Fri, 05 Feb 2010)
Log Message:
-----------
SCI: remaining cursor functions now also directly called
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kgraphics.cpp
scummvm/trunk/engines/sci/graphics/coordadjuster.cpp
scummvm/trunk/engines/sci/graphics/coordadjuster.h
scummvm/trunk/engines/sci/graphics/cursor.cpp
scummvm/trunk/engines/sci/graphics/cursor.h
scummvm/trunk/engines/sci/graphics/gui.cpp
scummvm/trunk/engines/sci/graphics/gui.h
scummvm/trunk/engines/sci/graphics/gui32.cpp
scummvm/trunk/engines/sci/graphics/gui32.h
Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp 2010-02-05 21:09:36 UTC (rev 47914)
@@ -101,7 +101,7 @@
if (argc >= 4) {
pos.y = argv[3].toSint16();
pos.x = argv[2].toSint16();
- s->_gui->setCursorPos(pos);
+ s->_gfxCursor->kernelSetPos(pos);
}
if ((argc >= 2) && (argv[1].toSint16() == 0)) {
@@ -136,12 +136,7 @@
pos.y = argv[1].toSint16();
pos.x = argv[0].toSint16();
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->setCursorPos(pos);
- else
-#endif
- s->_gui->setCursorPos(pos);
+ s->_gfxCursor->kernelSetPos(pos);
break;
case 4: {
int16 top = argv[0].toSint16();
@@ -151,12 +146,7 @@
if ((right >= left) && (bottom >= top)) {
Common::Rect rect = Common::Rect(left, top, right, bottom);
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->setCursorZone(rect);
- else
-#endif
- s->_gui->setCursorZone(rect);
+ s->_gfxCursor->kernelSetMoveZone(rect);
} else {
warning("kSetCursor: Ignoring invalid mouse zone (%i, %i)-(%i, %i)", left, top, right, bottom);
}
@@ -193,7 +183,7 @@
if (argc == 2) {
pos.y = argv[1].toSint16();
pos.x = argv[0].toSint16();
- s->_gui->setCursorPos(pos);
+ s->_gfxCursor->kernelSetPos(pos);
}
return s->r_acc;
}
Modified: scummvm/trunk/engines/sci/graphics/coordadjuster.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/coordadjuster.cpp 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/graphics/coordadjuster.cpp 2010-02-05 21:09:36 UTC (rev 47914)
@@ -65,6 +65,19 @@
return adjustedRect;
}
+void GfxCoordAdjuster16::setCursorPos(Common::Point &pos) {
+ pos.y += _ports->getPort()->top;
+ pos.x += _ports->getPort()->left;
+}
+
+void GfxCoordAdjuster16::moveCursor(Common::Point &pos) {
+ pos.y += _ports->_picWind->rect.top;
+ pos.x += _ports->_picWind->rect.left;
+
+ pos.y = CLIP<int16>(pos.y, _ports->_picWind->rect.top, _ports->_picWind->rect.bottom - 1);
+ pos.x = CLIP<int16>(pos.x, _ports->_picWind->rect.left, _ports->_picWind->rect.right - 1);
+}
+
#ifdef ENABLE_SCI32
GfxCoordAdjuster32::GfxCoordAdjuster32(SegManager *segMan)
: _segMan(segMan) {
Modified: scummvm/trunk/engines/sci/graphics/coordadjuster.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/coordadjuster.h 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/graphics/coordadjuster.h 2010-02-05 21:09:36 UTC (rev 47914)
@@ -47,7 +47,8 @@
virtual void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG) { };
virtual Common::Rect onControl(Common::Rect rect) { return rect; };
-
+ virtual void setCursorPos(Common::Point &pos) { };
+ virtual void moveCursor(Common::Point &pos) { };
private:
};
@@ -60,6 +61,8 @@
void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
Common::Rect onControl(Common::Rect rect);
+ void setCursorPos(Common::Point &pos);
+ void moveCursor(Common::Point &pos);
private:
GfxPorts *_ports;
Modified: scummvm/trunk/engines/sci/graphics/cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.cpp 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/graphics/cursor.cpp 2010-02-05 21:09:36 UTC (rev 47914)
@@ -28,9 +28,11 @@
#include "common/events.h"
#include "sci/sci.h"
+#include "sci/event.h"
#include "sci/engine/state.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/screen.h"
+#include "sci/graphics/coordadjuster.h"
#include "sci/graphics/view.h"
#include "sci/graphics/cursor.h"
@@ -42,7 +44,7 @@
_upscaledHires = _screen->getUpscaledHires();
// center mouse cursor
setPosition(Common::Point(_screen->getDisplayWidth() / 2, _screen->getDisplayHeight() / 2));
- setMoveZone(Common::Rect(0, 0, _screen->getDisplayWidth(), _screen->getDisplayHeight()));
+ kernelSetMoveZone(Common::Rect(0, 0, _screen->getDisplayWidth(), _screen->getDisplayHeight()));
_isVisible = true;
}
@@ -51,6 +53,11 @@
purgeCache();
}
+void GfxCursor::init(GfxCoordAdjuster *coordAdjuster, SciEvent *event) {
+ _coordAdjuster = coordAdjuster;
+ _event = event;
+}
+
void GfxCursor::kernelShow() {
CursorMan.showMouse(true);
_isVisible = true;
@@ -224,4 +231,27 @@
setPosition(mousePoint);
}
+void GfxCursor::kernelSetMoveZone(Common::Rect zone) {
+ _moveZone = zone;
+}
+
+void GfxCursor::kernelSetPos(Common::Point pos) {
+ _coordAdjuster->setCursorPos(pos);
+ kernelMoveCursor(pos);
+}
+
+void GfxCursor::kernelMoveCursor(Common::Point pos) {
+ _coordAdjuster->moveCursor(pos);
+ if (pos.x > _screen->getWidth() || pos.y > _screen->getHeight()) {
+ warning("attempt to place cursor at invalid coordinates (%d, %d)", pos.y, pos.x);
+ return;
+ }
+
+ setPosition(pos);
+
+ // Trigger event reading to make sure the mouse coordinates will
+ // actually have changed the next time we read them.
+ _event->get(SCI_EVENT_PEEK);
+}
+
} // End of namespace Sci
Modified: scummvm/trunk/engines/sci/graphics/cursor.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.h 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/graphics/cursor.h 2010-02-05 21:09:36 UTC (rev 47914)
@@ -45,6 +45,8 @@
GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen);
~GfxCursor();
+ void init(GfxCoordAdjuster *coordAdjuster, SciEvent *event);
+
void kernelShow();
void kernelHide();
bool isVisible();
@@ -59,14 +61,19 @@
*
* @param[in] rect The rectangle
*/
- void setMoveZone(Common::Rect zone) { _moveZone = zone; }
+ void kernelSetMoveZone(Common::Rect zone);
+ void kernelSetPos(Common::Point pos);
+ void kernelMoveCursor(Common::Point pos);
+
private:
void purgeCache();
ResourceManager *_resMan;
GfxScreen *_screen;
GfxPalette *_palette;
+ GfxCoordAdjuster *_coordAdjuster;
+ SciEvent *_event;
bool _upscaledHires;
Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp 2010-02-05 21:09:36 UTC (rev 47914)
@@ -56,6 +56,7 @@
_coordAdjuster = new GfxCoordAdjuster16(_ports);
_s->_gfxCoordAdjuster = _coordAdjuster;
+ _cursor->init(_coordAdjuster, _s->_event);
_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen, _coordAdjuster);
_s->_gfxCompare = _compare;
_transitions = new GfxTransitions(this, _screen, _palette, _s->resMan->isVGA());
@@ -269,35 +270,6 @@
}
}
-void SciGui::setCursorPos(Common::Point pos) {
- pos.y += _ports->getPort()->top;
- pos.x += _ports->getPort()->left;
- moveCursor(pos);
-}
-
-void SciGui::moveCursor(Common::Point pos) {
- pos.y += _ports->_picWind->rect.top;
- pos.x += _ports->_picWind->rect.left;
-
- pos.y = CLIP<int16>(pos.y, _ports->_picWind->rect.top, _ports->_picWind->rect.bottom - 1);
- pos.x = CLIP<int16>(pos.x, _ports->_picWind->rect.left, _ports->_picWind->rect.right - 1);
-
- if (pos.x > _screen->getWidth() || pos.y > _screen->getHeight()) {
- warning("attempt to place cursor at invalid coordinates (%d, %d)", pos.y, pos.x);
- return;
- }
-
- _cursor->setPosition(pos);
-
- // Trigger event reading to make sure the mouse coordinates will
- // actually have changed the next time we read them.
- _s->_event->get(SCI_EVENT_PEEK);
-}
-
-void SciGui::setCursorZone(Common::Rect zone) {
- _cursor->setMoveZone(zone);
-}
-
reg_t SciGui::portraitLoad(Common::String resourceName) {
//Portrait *myPortrait = new Portrait(_s->resMan, _screen, _palette, resourceName);
return NULL_REG;
Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/graphics/gui.h 2010-02-05 21:09:36 UTC (rev 47914)
@@ -76,10 +76,6 @@
virtual void shakeScreen(uint16 shakeCount, uint16 directions);
- virtual void setCursorPos(Common::Point pos);
- virtual void moveCursor(Common::Point pos);
- void setCursorZone(Common::Rect zone);
-
virtual reg_t portraitLoad(Common::String resourceName);
virtual void portraitShow(Common::String resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
virtual void portraitUnload(uint16 portraitId);
Modified: scummvm/trunk/engines/sci/graphics/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.cpp 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/graphics/gui32.cpp 2010-02-05 21:09:36 UTC (rev 47914)
@@ -51,6 +51,7 @@
_coordAdjuster = new GfxCoordAdjuster32(_s->_segMan);
_s->_gfxCoordAdjuster = _coordAdjuster;
+ _cursor->init(_coordAdjuster, _s->_event);
_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen, _coordAdjuster);
_s->_gfxCompare = _compare;
_paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _cache, _screen, _palette);
@@ -92,35 +93,6 @@
}
}
-void SciGui32::setCursorPos(Common::Point pos) {
- //pos.y += _gfx->GetPort()->top;
- //pos.x += _gfx->GetPort()->left;
- moveCursor(pos);
-}
-
-void SciGui32::moveCursor(Common::Point pos) {
- // pos.y += _windowMgr->_picWind->rect.top;
- // pos.x += _windowMgr->_picWind->rect.left;
-
- // pos.y = CLIP<int16>(pos.y, _windowMgr->_picWind->rect.top, _windowMgr->_picWind->rect.bottom - 1);
- // pos.x = CLIP<int16>(pos.x, _windowMgr->_picWind->rect.left, _windowMgr->_picWind->rect.right - 1);
-
- if (pos.x > _screen->getWidth() || pos.y > _screen->getHeight()) {
- warning("attempt to place cursor at invalid coordinates (%d, %d)", pos.y, pos.x);
- return;
- }
-
- _cursor->setPosition(pos);
-
- // Trigger event reading to make sure the mouse coordinates will
- // actually have changed the next time we read them.
- _s->_event->get(SCI_EVENT_PEEK);
-}
-
-void SciGui32::setCursorZone(Common::Rect zone) {
- _cursor->setMoveZone(zone);
-}
-
void SciGui32::drawRobot(GuiResourceId robotId) {
Robot *test = new Robot(_s->resMan, _screen, robotId);
test->draw();
Modified: scummvm/trunk/engines/sci/graphics/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.h 2010-02-05 20:48:06 UTC (rev 47913)
+++ scummvm/trunk/engines/sci/graphics/gui32.h 2010-02-05 21:09:36 UTC (rev 47914)
@@ -50,15 +50,6 @@
void shakeScreen(uint16 shakeCount, uint16 directions);
- void setNowSeen(reg_t objectReference);
- bool canBeHere(reg_t curObject, reg_t listReference);
- bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
- void baseSetter(reg_t object);
-
- void setCursorPos(Common::Point pos);
- void moveCursor(Common::Point pos);
- void setCursorZone(Common::Rect zone);
-
void drawRobot(GuiResourceId robotId);
// FIXME: Don't store EngineState
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list