[Scummvm-cvs-logs] scummvm master -> d2f0dc56b257a506913c2cb8be76dd9a86a12504

dreammaster dreammaster at scummvm.org
Sun Aug 18 21:12:14 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d2f0dc56b2 TSAGE: Fixes for displaying landing bay control panel


Commit: d2f0dc56b257a506913c2cb8be76dd9a86a12504
    https://github.com/scummvm/scummvm/commit/d2f0dc56b257a506913c2cb8be76dd9a86a12504
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-08-18T12:11:10-07:00

Commit Message:
TSAGE: Fixes for displaying landing bay control panel

Changed paths:
    engines/tsage/core.cpp
    engines/tsage/globals.cpp
    engines/tsage/globals.h
    engines/tsage/ringworld2/ringworld2_logic.cpp
    engines/tsage/ringworld2/ringworld2_scenes0.cpp
    engines/tsage/ringworld2/ringworld2_scenes0.h



diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 6b4e296..b5ec0ed 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -4242,9 +4242,10 @@ void SceneHandler::process(Event &event) {
 			// Scan the item list to find one the mouse is within
 			SynchronizedList<SceneItem *>::iterator i;
 			for (i = g_globals->_sceneItems.begin(); i != g_globals->_sceneItems.end(); ++i) {
-				if ((*i)->contains(event.mousePos)) {
+				SceneItem *item = *i;				
+				if (item->contains(event.mousePos)) {
 					// Pass the action to the item
-					bool handled = (*i)->startAction(g_globals->_events.getCursor(), event);
+					bool handled = item->startAction(g_globals->_events.getCursor(), event);
 					if (!handled)
 						// Item wasn't handled, keep scanning
 						continue;
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index e3019b1..598aed4 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -449,7 +449,7 @@ void Ringworld2Globals::reset() {
 	_v56613[(17 * 4) + 1] = 1;
 
 	_v566A6 = 3800;
-	_v566A3 = 2;
+	_landerSuitNumber = 2;
 	_v566A4 = 1;
 	_v566A5 = 0;
 	_v566A8 = 5;
@@ -523,7 +523,7 @@ void Ringworld2Globals::synchronize(Serializer &s) {
 	s.syncAsSint16LE(_v565F6);
 	s.syncAsSint16LE(_v565F8);
 	s.syncAsSint16LE(_v565FA);
-	s.syncAsSint16LE(_v566A3);
+	s.syncAsSint16LE(_landerSuitNumber);
 	s.syncAsSint16LE(_v566A6);
 	s.syncAsSint16LE(_v56A93);
 	s.syncAsSint16LE(_scene1925CurrLevel); // _v56A9C
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index eaf2a6d..e91a74b 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -280,7 +280,7 @@ public:
 	byte _v566A4;
 	byte _v566A5;
 	int _v566A6;
-	byte _v566A3;
+	byte _landerSuitNumber;
 	byte _v566A8;
 	byte _v566A9;
 	byte _v566AA;
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 2a8e50b..6414268 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -1438,19 +1438,22 @@ void SceneAreaObject::process(Event &event) {
 	if (_insetCount == R2_GLOBALS._insetUp) {
 		CursorType cursor = R2_GLOBALS._events.getCursor();
 
-		if (_bounds.contains(event.mousePos)) {
+		if (_object1._bounds.contains(event.mousePos)) {
 			// Cursor moving in bounded area
 			if (cursor == _cursorNum) {
 				R2_GLOBALS._events.setCursor(_savedCursorNum);
 			}
 		} else if (event.mousePos.y < 168) {
-			if (_cursorNum != cursor)
+			if (_cursorNum != cursor) {
 				// Cursor moved outside bounded area
-				R2_GLOBALS._events.setCursor(_savedCursorNum);
-
+				_savedCursorNum = R2_GLOBALS._events.getCursor();
+				R2_GLOBALS._events.setCursor(CURSOR_INVALID);
+			}
+				
 			if (event.eventType == EVENT_BUTTON_DOWN) {
-				R2_GLOBALS._events.setCursor(_savedCursorNum);
 				event.handled = true;
+				R2_GLOBALS._events.setCursor(_savedCursorNum);
+				remove();
 			}
 		}
 	}
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
index 4eeed8b..7f711c3 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -5054,7 +5054,36 @@ bool Scene500::Locker2::startAction(CursorType action, Event &event) {
 	}
 }
 
-bool Scene500::Object::startAction(CursorType action, Event &event) {
+/*--------------------------------------------------------------------------*/
+
+void Scene500::PanelDialog::setDetails(int visage, int strip, int frameNumber, 
+		const Common::Point &pt) {
+	SceneAreaObject::setDetails(visage, strip, frameNumber, pt);
+	SceneAreaObject::setDetails(500, 43, 32, 45);
+
+	_button1.setupButton(1);
+	_button2.setupButton(2);
+	_button3.setupButton(3);
+}
+
+void Scene500::PanelDialog::remove() {
+	Scene500 *scene = (Scene500 *)BF_GLOBALS._sceneManager._scene;
+	scene->_sceneAreas.remove(&_button1);
+	scene->_sceneAreas.remove(&_button2);
+	scene->_sceneAreas.remove(&_button3);
+
+	_button1.remove();
+	_button2.remove();
+	_button3.remove();
+
+	SceneAreaObject::remove();
+
+	R2_GLOBALS._player.disableControl();
+	scene->_sceneMode = 511;
+	scene->setAction(&scene->_sequenceManager1, scene, 511, &R2_GLOBALS._player, NULL);
+}
+
+bool Scene500::PanelDialog::Button::startAction(CursorType action, Event &event) {
 	if (action == CURSOR_USE) {
 		return false;
 	} else {
@@ -5062,6 +5091,119 @@ bool Scene500::Object::startAction(CursorType action, Event &event) {
 	}
 }
 
+void Scene500::PanelDialog::Button::setupButton(int buttonId) {
+	_buttonId = buttonId;
+	_buttonDown = false;
+	SceneActor::postInit();
+	setup(500, 7, 1);
+	fixPriority(251);
+
+	switch (_buttonId) {
+	case 1:
+		setPosition(Common::Point(139, 78));
+		break;
+	case 2:
+		setPosition(Common::Point(139, 96));
+		break;
+	case 3:
+		setPosition(Common::Point(139, 114));
+		break;
+	default:
+		break;
+	}
+
+	Scene500 *scene = (Scene500 *)BF_GLOBALS._sceneManager._scene;
+	scene->_sceneAreas.push_front(this);
+}
+
+void Scene500::PanelDialog::Button::synchronize(Serializer &s) {
+	SceneActor::synchronize(s);
+
+	s.syncAsSint16LE(_buttonId);
+	s.syncAsSint16LE(_buttonDown);
+}
+
+void Scene500::PanelDialog::Button::process(Event &event) {
+	if ((event.eventType == EVENT_BUTTON_DOWN) && 
+			(R2_GLOBALS._events.getCursor() == CURSOR_USE) &&
+			_bounds.contains(event.mousePos) && !_buttonDown) {
+		_buttonDown = true;
+		event.handled = true;
+		setFrame(2);
+	}
+
+	if ((event.eventType == EVENT_BUTTON_UP) && _buttonDown) {
+		setFrame(1);
+		_buttonDown = false;
+		event.handled = true;
+
+		doButtonPress();
+	}
+}
+
+void Scene500::PanelDialog::Button::doButtonPress() {
+	Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+	if (R2_GLOBALS.getFlag(28)) {
+		SceneItem::display2(500, 48);
+	} else {
+		R2_GLOBALS._player.disableControl();
+		scene->_sceneMode = _buttonId;
+
+		switch (_buttonId) {
+		case 1:
+			if (--R2_GLOBALS._landerSuitNumber == 0)
+				R2_GLOBALS._landerSuitNumber = 3;
+
+			if (R2_GLOBALS.getFlag(35)) {
+				scene->_sceneMode = 5;
+				scene->setAction(&scene->_sequenceManager1, scene, 509, &scene->_object1,
+					&scene->_object3, &scene->_object8, NULL);
+			} else {
+				scene->_sound1.play(127);
+				scene->_object1.animate(ANIM_MODE_6, scene);
+			}
+			break;
+
+		case 2:
+			if (++R2_GLOBALS._landerSuitNumber == 4)
+				R2_GLOBALS._v566A4 = 1;
+
+			if (R2_GLOBALS.getFlag(35)) {
+				scene->_sceneMode = 6;
+				scene->setAction(&scene->_sequenceManager1, scene, 509, &scene->_object1,
+					&scene->_object3, &scene->_object8, NULL);
+			} else {
+				scene->_sound1.play(127);
+				scene->_object1.animate(ANIM_MODE_6, scene);
+			}
+			break;
+		
+		case 3:
+			if (R2_GLOBALS.getFlag(35)) {
+				scene->_sceneMode = 509;
+				scene->setAction(&scene->_sequenceManager1, scene, 509, &scene->_object1,
+					&scene->_object3, &scene->_object8, NULL);
+			} else {
+				scene->_object3.postInit();
+				scene->_object3.hide();
+				scene->_object3._effect = 1;
+				scene->_object3.setDetails(500, -1, -1, -1, 2, NULL);
+				scene->_object3.setup(502, R2_GLOBALS._landerSuitNumber + 2, 1);
+
+				scene->setAction(&scene->_sequenceManager1, scene, 508,
+					&R2_GLOBALS._player, &scene->_object1, &scene->_object3, 
+					&scene->_object8, NULL);
+				R2_GLOBALS.setFlag(35);
+			}
+			break;
+
+		default:
+			break;
+		}
+	}
+}
+
 /*--------------------------------------------------------------------------*/
 
 void Scene500::postInit(SceneObjectList *OwnerList) {
@@ -5185,7 +5327,7 @@ void Scene500::postInit(SceneObjectList *OwnerList) {
 			if (R2_GLOBALS.getFlag(28))
 				_object3.setup(502, 7, 2);
 			else
-				_object3.setup(502, R2_GLOBALS._v566A3 + 2, 7);
+				_object3.setup(502, R2_GLOBALS._landerSuitNumber + 2, 7);
 		}
 	}
 
@@ -5301,7 +5443,7 @@ void Scene500::signal() {
 		break;
 	case 510:
 		R2_GLOBALS._player.enableControl();
-		_area1.setDetails(500, 6, 1, Common::Point(160, 120));
+		_panelDialog.setDetails(500, 6, 1, Common::Point(160, 120));
 		R2_GLOBALS._player.enableControl();
 		break;
 	case 513:
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h
index 50f244f..e03732d 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.h
@@ -524,6 +524,30 @@ public:
 };
 
 class Scene500: public SceneExt {
+	/* Dialogs */
+	class PanelDialog: public SceneAreaObject {
+		class Button: public SceneActor {
+		private:
+			int _buttonId;
+			bool _buttonDown;
+
+			void doButtonPress();		
+		public:
+			virtual Common::String getClassName() { return "Scene500_Button"; }
+			virtual void process(Event &event);
+			virtual bool startAction(CursorType action, Event &event);
+			virtual void synchronize(Serializer &s);
+
+			void setupButton(int buttonId);
+		};
+	public:
+		Button _button1, _button2, _button3;
+
+		virtual Common::String getClassName() { return "Scene500_PanelWindow"; }
+		virtual void remove();
+		void setDetails(int visage, int strip, int frameNumber, const Common::Point &pt);
+	};
+
 	/* Items */
 	class ControlPanel: public SceneHotspot {
 	public:
@@ -570,10 +594,6 @@ class Scene500: public SceneExt {
 	public:
 		virtual bool startAction(CursorType action, Event &event);
 	};
-	class Object: public SceneActor {
-	public:
-		virtual bool startAction(CursorType action, Event &event);
-	};
 public:
 	int _stripNumber;
 	byte _buffer[2710];
@@ -592,8 +612,7 @@ public:
 	SonicStunner _sonicStunner;
 	Locker1 _locker1;
 	Locker2 _locker2;
-	SceneAreaObject _area1;
-	Object _obj1, _obj2, _obj3;
+	PanelDialog _panelDialog;
 	ASoundExt _sound1;
 	SequenceManager _sequenceManager1, _sequenceManager2;
 public:






More information about the Scummvm-git-logs mailing list