[Scummvm-cvs-logs] SF.net SVN: scummvm:[33165] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Jul 21 11:26:00 CEST 2008


Revision: 33165
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33165&view=rev
Author:   peres001
Date:     2008-07-21 09:25:40 +0000 (Mon, 21 Jul 2008)

Log Message:
-----------
Some refactoring for tracking of floating labels.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/input.cpp
    scummvm/trunk/engines/parallaction/input.h
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-07-21 09:19:57 UTC (rev 33164)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-07-21 09:25:40 UTC (rev 33165)
@@ -208,6 +208,29 @@
 	return &_inputData;
 }
 
+void Input::trackMouse(ZonePtr z) {
+	if ((z != _hoverZone) && (_hoverZone)) {
+		stopHovering();
+		return;
+	}
+
+	if (!z) {
+		return;
+	}
+
+	if ((!_hoverZone) && ((z->_flags & kFlagsNoName) == 0)) {
+		_hoverZone = z;
+		_vm->_gfx->showFloatingLabel(_hoverZone->_label);
+		return;
+	}
+}
+
+void Input::stopHovering() {
+	_hoverZone = nullZonePtr;
+	_vm->_gfx->hideFloatingLabel();
+}
+
+
 bool Input::translateGameInput() {
 
 	if ((_engineFlags & kEnginePauseJobs) || (_engineFlags & kEngineInventory)) {
@@ -242,24 +265,11 @@
 		return true;
 	}
 
-	if ((z != _hoverZone) && (_hoverZone)) {
-		_hoverZone = nullZonePtr;
-		_inputData._event = kEvExitZone;
-		return true;
-	}
+	trackMouse(z);
+ 	if (!z) {
+ 		return true;
+ 	}
 
-	if (!z) {
-		_inputData._event = kEvNone;
-		return true;
-	}
-
-	if ((!_hoverZone) && ((z->_flags & kFlagsNoName) == 0)) {
-		_hoverZone = z;
-		_inputData._event = kEvEnterZone;
-		_inputData._label = z->_label;
-		return true;
-	}
-
 	if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || ((z->_type & 0xFFFF) == kZoneCommand))) {
 
 		_inputData._zone = z;

Modified: scummvm/trunk/engines/parallaction/input.h
===================================================================
--- scummvm/trunk/engines/parallaction/input.h	2008-07-21 09:19:57 UTC (rev 33164)
+++ scummvm/trunk/engines/parallaction/input.h	2008-07-21 09:25:40 UTC (rev 33165)
@@ -101,15 +101,13 @@
 
 	uint16	readInput();
 	InputData* 	updateInput();
+	void	trackMouse(ZonePtr z);
 	void 	waitUntilLeftClick();
 	void	waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1);
 	uint32	getLastButtonEvent() { return _mouseButtons; }
 	bool  	getLastKeyDown(uint16 &ascii);
 
-	void stopHovering() {
-		_hoverZone = nullZonePtr;
-	}
-
+	void stopHovering();
 };
 
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-21 09:19:57 UTC (rev 33164)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-21 09:25:40 UTC (rev 33165)
@@ -299,16 +299,6 @@
 void Parallaction::processInput(InputData *data) {
 
 	switch (data->_event) {
-	case kEvEnterZone:
-		debugC(2, kDebugInput, "processInput: kEvEnterZone");
-		_gfx->showFloatingLabel(data->_label);
-		break;
-
-	case kEvExitZone:
-		debugC(2, kDebugInput, "processInput: kEvExitZone");
-		_gfx->hideFloatingLabel();
-		break;
-
 	case kEvAction:
 		debugC(2, kDebugInput, "processInput: kEvAction");
 		_input->stopHovering();
@@ -319,7 +309,6 @@
 
 	case kEvOpenInventory:
 		_input->stopHovering();
-		_gfx->hideFloatingLabel();
 		if (hitZone(kZoneYou, data->_mousePos.x, data->_mousePos.y) == 0) {
 			setArrowCursor();
 		}

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-07-21 09:19:57 UTC (rev 33164)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-07-21 09:25:40 UTC (rev 33165)
@@ -114,8 +114,6 @@
 
 enum {
 	kEvNone			= 0,
-	kEvEnterZone		= 1,
-	kEvExitZone		= 2,
 	kEvAction		= 3,
 	kEvOpenInventory	= 4,
 	kEvCloseInventory	= 5,

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-21 09:19:57 UTC (rev 33164)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-21 09:25:40 UTC (rev 33165)
@@ -191,7 +191,7 @@
 	debugC(1, kDebugInput, "setting mouse cursor to arrow");
 
 	// this stuff is needed to avoid artifacts with labels and selected items when switching cursors
-	_gfx->hideFloatingLabel();
+	_input->stopHovering();
 	_input->_activeItem._id = 0;
 
 	_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
@@ -302,12 +302,11 @@
 
 	_soundMan->playLocationMusic(location);
 
-	_gfx->hideFloatingLabel();
+	_input->stopHovering();
 	_gfx->freeLabels();
 
 	_zoneTrap = nullZonePtr;
 
-	_input->stopHovering();
 	if (_engineFlags & kEngineBlockInput) {
 		setArrowCursor();
 	}


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