[Scummvm-cvs-logs] SF.net SVN: scummvm:[47903] scummvm/trunk/engines/sci

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Feb 5 15:48:51 CET 2010


Revision: 47903
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47903&view=rev
Author:   m_kiewitz
Date:     2010-02-05 14:48:51 +0000 (Fri, 05 Feb 2010)

Log Message:
-----------
SCI: calling most of the cursor functions directly via _gfxCursor instead of SciGui/32

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/graphics/animate.cpp
    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
    scummvm/trunk/engines/sci/graphics/menu.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/console.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -219,7 +219,7 @@
 		_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 @@
 #endif
 		}
 
-		_engine->_gamestate->_gui->showCursor();
+		_engine->_gamestate->_gfxCursor->kernelShow();
 
 		_videoFile.clear();
 		_videoFrameDelay = 0;

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -47,12 +47,7 @@
 	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

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -107,7 +107,7 @@
 		cursorId = -1;
 	}
 
-	s->_gui->setCursorShape(cursorId);
+	s->_gfxCursor->kernelSetShape(cursorId);
 	return s->r_acc;
 }
 
@@ -119,12 +119,7 @@
 	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 @@
 			// 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 @@
 		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 @@
 	// 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 @@
 		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;
 }

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-02-05 14:48:51 UTC (rev 47903)
@@ -54,6 +54,7 @@
 class GfxAnimate;
 class GfxCache;
 class GfxControls;
+class GfxCursor;
 class GfxMenu;
 class GfxPaint;
 class GfxPaint16;
@@ -153,6 +154,7 @@
 	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;

Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -591,12 +591,12 @@
 	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();

Modified: scummvm/trunk/engines/sci/graphics/cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/graphics/cursor.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -51,12 +51,12 @@
 	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 @@
 	_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 @@
 
 	if (resourceId == -1) {
 		// no resourceId given, so we actually hide the cursor
-		hide();
+		kernelHide();
 		delete[] rawBitmap;
 		return;
 	}
@@ -128,12 +128,12 @@
 	}
 
 	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 @@
 
 	// 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 @@
 	if (_upscaledHires)
 		delete[] cursorBitmap;
 
-	show();
+	kernelShow();
 
 	delete cursorHotspot;
 }

Modified: scummvm/trunk/engines/sci/graphics/cursor.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.h	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/graphics/cursor.h	2010-02-05 14:48:51 UTC (rev 47903)
@@ -45,11 +45,11 @@
 	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();

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -391,36 +391,12 @@
 	}
 }
 
-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;

Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/graphics/gui.h	2010-02-05 14:48:51 UTC (rev 47903)
@@ -87,13 +87,7 @@
 	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);
 

Modified: scummvm/trunk/engines/sci/graphics/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -176,36 +176,12 @@
 	}
 }
 
-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;

Modified: scummvm/trunk/engines/sci/graphics/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.h	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/graphics/gui32.h	2010-02-05 14:48:51 UTC (rev 47903)
@@ -55,13 +55,7 @@
 	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);
 

Modified: scummvm/trunk/engines/sci/graphics/menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/graphics/menu.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -591,12 +591,12 @@
 
 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) {

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-02-05 13:05:26 UTC (rev 47902)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-02-05 14:48:51 UTC (rev 47903)
@@ -196,6 +196,7 @@
 	_gamestate->_gfxPalette = palette;
 	_gamestate->_gfxScreen = screen;
 	_gamestate->_gfxCache = cache;
+	_gamestate->_gfxCursor = cursor;
 
 	if (game_init(_gamestate)) { /* Initialize */
 		warning("Game initialization failed: Aborting...");


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