[Scummvm-cvs-logs] SF.net SVN: scummvm:[54740] scummvm/trunk/engines/mohawk

bgk at users.sourceforge.net bgk at users.sourceforge.net
Thu Dec 2 22:15:48 CET 2010


Revision: 54740
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54740&view=rev
Author:   bgk
Date:     2010-12-02 21:15:47 +0000 (Thu, 02 Dec 2010)

Log Message:
-----------
MOHAWK: Fix resource type 12

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/myst.cpp
    scummvm/trunk/engines/mohawk/myst.h
    scummvm/trunk/engines/mohawk/myst_areas.cpp
    scummvm/trunk/engines/mohawk/myst_areas.h
    scummvm/trunk/engines/mohawk/myst_scripts.h

Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp	2010-12-02 20:51:59 UTC (rev 54739)
+++ scummvm/trunk/engines/mohawk/myst.cpp	2010-12-02 21:15:47 UTC (rev 54740)
@@ -310,8 +310,9 @@
 			switch (event.type) {
 			case Common::EVENT_MOUSEMOVE:
 				_needsUpdate = true;
+				_mouse = event.mouse;
 				// Keep the same resource when dragging
-				if (!_dragResource) {
+				if (!_mouseClicked) {
 					checkCurrentResource();
 				}
 				if (_curResource >= 0 && _resources[_curResource]->isEnabled() && _mouseClicked) {
@@ -321,6 +322,7 @@
 				break;
 			case Common::EVENT_LBUTTONUP:
 				_mouseClicked = false;
+				_mouse = event.mouse;
 				if (_curResource >= 0 && _resources[_curResource]->isEnabled()) {
 					debug(2, "Sending mouse up event to resource %d", _curResource);
 					_resources[_curResource]->handleMouseUp(event.mouse);
@@ -328,6 +330,7 @@
 				break;
 			case Common::EVENT_LBUTTONDOWN:
 				_mouseClicked = true;
+				_mouse = event.mouse;
 				if (_curResource >= 0 && _resources[_curResource]->isEnabled()) {
 					debug(2, "Sending mouse up event to resource %d", _curResource);
 					_resources[_curResource]->handleMouseDown(event.mouse);

Modified: scummvm/trunk/engines/mohawk/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst.h	2010-12-02 20:51:59 UTC (rev 54739)
+++ scummvm/trunk/engines/mohawk/myst.h	2010-12-02 21:15:47 UTC (rev 54740)
@@ -157,6 +157,7 @@
 	uint16 getCurStack() { return _curStack; }
 	void setMainCursor(uint16 cursor);
 	uint16 getMainCursor() { return _mainCursor; }
+	void checkCursorHints();
 
 	MystVar *_varStore;
 
@@ -171,6 +172,7 @@
 	MystScriptParser *_scriptParser;
 	Common::Array<MystResource*> _resources;
 	MystResource *_dragResource;
+	Common::Point _mouse;
 
 	bool _showResourceRects;
 	MystResource *loadResource(Common::SeekableReadStream *rlstStream, MystResource *parent);
@@ -220,7 +222,6 @@
 	uint16 _cursorHintCount;
 	MystCursorHint *_cursorHints;
 	void loadCursorHints();
-	void checkCursorHints();
 	bool _mouseClicked;
 	uint16 _currentCursor;
 	uint16 _mainCursor; // Also defines the current page being held (white, blue, red, or none)

Modified: scummvm/trunk/engines/mohawk/myst_areas.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.cpp	2010-12-02 20:51:59 UTC (rev 54739)
+++ scummvm/trunk/engines/mohawk/myst_areas.cpp	2010-12-02 21:15:47 UTC (rev 54740)
@@ -687,18 +687,21 @@
 void MystResourceType11::handleMouseDown(const Common::Point &mouse) {
 	setPositionClipping(mouse, _pos);
 
+	_vm->_scriptParser->setInvokingResource(this);
 	_vm->_scriptParser->runOpcode(_mouseDownOpcode, _var8);
 }
 
 void MystResourceType11::handleMouseUp(const Common::Point &mouse) {
 	setPositionClipping(mouse, _pos);
 
+	_vm->_scriptParser->setInvokingResource(this);
 	_vm->_scriptParser->runOpcode(_mouseUpOpcode, _var8);
 }
 
 void MystResourceType11::handleMouseDrag(const Common::Point &mouse) {
 	setPositionClipping(mouse, _pos);
 
+	_vm->_scriptParser->setInvokingResource(this);
 	_vm->_scriptParser->runOpcode(_mouseDragOpcode, _var8);
 }
 
@@ -754,29 +757,18 @@
 	debugC(kDebugResource, "\t_frameRect.top: %d", _frameRect.top);
 	debugC(kDebugResource, "\t_frameRect.right: %d", _frameRect.right);
 	debugC(kDebugResource, "\t_frameRect.bottom: %d", _frameRect.bottom);
-
-	_doAnimation = false;
 }
 
 MystResourceType12::~MystResourceType12() {
 
 }
 
-void MystResourceType12::handleAnimation() {
-	// TODO: Probably not final version. Variable/Type 11 Controlled?
-	if (_doAnimation) {
-		_vm->_gfx->copyImageToScreen(_currentFrame++, _frameRect);
-		if ((_currentFrame - _firstFrame) >= _numFrames)
-			_doAnimation = false;
-	}
+void MystResourceType12::drawFrame(uint16 frame) {
+	_currentFrame = _firstFrame + frame;
+	_vm->_gfx->copyImageToScreen(_currentFrame, _frameRect);
+	_vm->_gfx->updateScreen();
 }
 
-void MystResourceType12::handleMouseUp(const Common::Point &mouse) {
-	// HACK/TODO: Trigger Animation on Mouse Click. Probably not final version. Variable/Type 11 Controlled?
-	_currentFrame = _firstFrame;
-	_doAnimation = true;
-}
-
 MystResourceType13::MystResourceType13(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResource(vm, rlstStream, parent) {
 	_enterOpcode = rlstStream->readUint16LE();
 	_leaveOpcode = rlstStream->readUint16LE();

Modified: scummvm/trunk/engines/mohawk/myst_areas.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.h	2010-12-02 20:51:59 UTC (rev 54739)
+++ scummvm/trunk/engines/mohawk/myst_areas.h	2010-12-02 21:15:47 UTC (rev 54740)
@@ -171,6 +171,8 @@
 	uint16 getList2(uint16 index);
 	uint16 getList3(uint16 index);
 
+	uint16 getStepsV() { return _stepsV; }
+
 	Common::Point _pos;
 protected:
 	void setPositionClipping(const Common::Point &mouse, Common::Point &dest);
@@ -219,8 +221,7 @@
 public:
 	MystResourceType12(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent);
 	virtual ~MystResourceType12();
-	void handleAnimation();
-	void handleMouseUp(const Common::Point &mouse);
+	void drawFrame(uint16 frame);
 
 protected:
 	uint16 _numFrames;
@@ -228,7 +229,6 @@
 	Common::Rect _frameRect;
 
 private:
-	bool _doAnimation;
 	uint16 _currentFrame;
 };
 

Modified: scummvm/trunk/engines/mohawk/myst_scripts.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts.h	2010-12-02 20:51:59 UTC (rev 54739)
+++ scummvm/trunk/engines/mohawk/myst_scripts.h	2010-12-02 21:15:47 UTC (rev 54740)
@@ -68,6 +68,7 @@
 	void runOpcode(uint16 op, uint16 var = 0, uint16 argc = 0, uint16 *argv = NULL);
 	const char *getOpcodeDesc(uint16 op);
 	MystScript readScript(Common::SeekableReadStream *stream, MystScriptType type);
+	void setInvokingResource(MystResource *resource) { _invokingResource = resource; }
 
 	virtual void disablePersistentScripts() = 0;
 	virtual void runPersistentScripts() = 0;


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