diff options
| -rw-r--r-- | engines/mohawk/myst.cpp | 5 | ||||
| -rw-r--r-- | engines/mohawk/myst.h | 3 | ||||
| -rw-r--r-- | engines/mohawk/myst_areas.cpp | 22 | ||||
| -rw-r--r-- | engines/mohawk/myst_areas.h | 6 | ||||
| -rw-r--r-- | engines/mohawk/myst_scripts.h | 1 | 
5 files changed, 17 insertions, 20 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 558dc2d79d..e9b390ba45 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -310,8 +310,9 @@ Common::Error MohawkEngine_Myst::run() {  			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 @@ Common::Error MohawkEngine_Myst::run() {  				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 @@ Common::Error MohawkEngine_Myst::run() {  				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); diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index 31a743cea6..2d0ea830cb 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -157,6 +157,7 @@ public:  	uint16 getCurStack() { return _curStack; }  	void setMainCursor(uint16 cursor);  	uint16 getMainCursor() { return _mainCursor; } +	void checkCursorHints();  	MystVar *_varStore; @@ -171,6 +172,7 @@ public:  	MystScriptParser *_scriptParser;  	Common::Array<MystResource*> _resources;  	MystResource *_dragResource; +	Common::Point _mouse;  	bool _showResourceRects;  	MystResource *loadResource(Common::SeekableReadStream *rlstStream, MystResource *parent); @@ -220,7 +222,6 @@ private:  	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) diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp index fddf46e371..217fca8472 100644 --- a/engines/mohawk/myst_areas.cpp +++ b/engines/mohawk/myst_areas.cpp @@ -687,18 +687,21 @@ MystResourceType11::~MystResourceType11() {  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,27 +757,16 @@ MystResourceType12::MystResourceType12(MohawkEngine_Myst *vm, Common::SeekableRe  	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::handleMouseUp(const Common::Point &mouse) { -	// HACK/TODO: Trigger Animation on Mouse Click. Probably not final version. Variable/Type 11 Controlled? -	_currentFrame = _firstFrame; -	_doAnimation = true; +void MystResourceType12::drawFrame(uint16 frame) { +	_currentFrame = _firstFrame + frame; +	_vm->_gfx->copyImageToScreen(_currentFrame, _frameRect); +	_vm->_gfx->updateScreen();  }  MystResourceType13::MystResourceType13(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResource(vm, rlstStream, parent) { diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h index 89ce4e18d4..f9aeb8d721 100644 --- a/engines/mohawk/myst_areas.h +++ b/engines/mohawk/myst_areas.h @@ -171,6 +171,8 @@ public:  	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 @@ class MystResourceType12 : public MystResourceType11 {  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 @@ protected:  	Common::Rect _frameRect;  private: -	bool _doAnimation;  	uint16 _currentFrame;  }; diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h index c0e1bf2e66..11d8a80a78 100644 --- a/engines/mohawk/myst_scripts.h +++ b/engines/mohawk/myst_scripts.h @@ -68,6 +68,7 @@ public:  	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;  | 
