diff options
| author | Tobia Tesan | 2017-06-19 12:22:20 +0200 | 
|---|---|---|
| committer | Eugene Sandulenko | 2017-07-05 08:35:33 +0200 | 
| commit | 963bc4a35121b6a9efacb5cf57194ee8e5ad23f8 (patch) | |
| tree | 7c94a7e195e6ce22bc047c8b464991a3846a660f | |
| parent | 5a9a1571fadac7711a177527db92d191d22290bf (diff) | |
| download | scummvm-rg350-963bc4a35121b6a9efacb5cf57194ee8e5ad23f8.tar.gz scummvm-rg350-963bc4a35121b6a9efacb5cf57194ee8e5ad23f8.tar.bz2 scummvm-rg350-963bc4a35121b6a9efacb5cf57194ee8e5ad23f8.zip  | |
DIRECTOR: Move kEventMouseUp/Down handling to processInputEvent
| -rw-r--r-- | engines/director/events.cpp | 20 | ||||
| -rw-r--r-- | engines/director/lingo/lingo-events.cpp | 23 | 
2 files changed, 25 insertions, 18 deletions
diff --git a/engines/director/events.cpp b/engines/director/events.cpp index f55a7c8991..81c80dcc1e 100644 --- a/engines/director/events.cpp +++ b/engines/director/events.cpp @@ -71,12 +71,7 @@ void DirectorEngine::processEvents() {  				sc->_currentMouseDownSpriteId = spriteId;  				debugC(3, kDebugEvents, "event: Button Down @(%d, %d), sprite id: %d", pos.x, pos.y, spriteId); - -				if (getVersion() > 3) { -					// TODO: check that this is the order of script execution! -					_lingo->processEvent(kEventMouseDown, kCastScript, currentFrame->_sprites[spriteId]->_castId); -					_lingo->processEvent(kEventMouseDown, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId); -				} +				_lingo->processEvent(kEventMouseDown);  				if (currentFrame->_sprites[spriteId]->_moveable) {  					warning("Moveable"); @@ -90,18 +85,7 @@ void DirectorEngine::processEvents() {  				debugC(3, kDebugEvents, "event: Button Up @(%d, %d), sprite id: %d", pos.x, pos.y, spriteId); -				if (getVersion() > 3) { -					// TODO: check that this is the order of script execution! -					_lingo->processEvent(kEventMouseUp, kCastScript, currentFrame->_sprites[spriteId]->_castId); -					_lingo->processEvent(kEventMouseUp, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId); -				} else { -					// Frame script overrides sprite script -					if (!currentFrame->_sprites[spriteId]->_scriptId) -						_lingo->processEvent(kEventNone, kSpriteScript, currentFrame->_sprites[spriteId]->_castId + 1024); -					else -						_lingo->processEvent(kEventNone, kFrameScript, currentFrame->_sprites[spriteId]->_scriptId); -				} - +				_lingo->processEvent(kEventMouseUp);  				sc->_currentMouseDownSpriteId = 0;  				break; diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp index 9e7f719e7f..573ee521d1 100644 --- a/engines/director/lingo/lingo-events.cpp +++ b/engines/director/lingo/lingo-events.cpp @@ -145,6 +145,29 @@ void Lingo::processInputEvent(LEvent event) {  	// Script of Cast Member  	// Score Script  	// Movie Script +	Score *score = _vm->getCurrentScore(); +	Frame *currentFrame = score->_frames[score->getCurrentFrame()]; +	assert(currentFrame != nullptr); +	uint16 spriteId = score->_currentMouseDownSpriteId; +	if (event == kEventMouseDown) { +		if (_vm->getVersion() > 3) { +			g_lingo->processEvent(kEventMouseDown, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId); +			g_lingo->processEvent(kEventMouseDown, kCastScript, currentFrame->_sprites[spriteId]->_castId); +		} +		// TODO: Unhandled in D<3? +	} else if (event == kEventMouseUp) { +		if (_vm->getVersion() > 3) { +			// TODO: check that this is the order of script execution! +			g_lingo->processEvent(kEventMouseUp, kCastScript, currentFrame->_sprites[spriteId]->_castId); +			g_lingo->processEvent(kEventMouseUp, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId); +		} else { +			// Frame script overrides sprite script +			if (!currentFrame->_sprites[spriteId]->_scriptId) +				g_lingo->processEvent(kEventNone, kSpriteScript, currentFrame->_sprites[spriteId]->_castId + 1024); +			else +				g_lingo->processEvent(kEventNone, kFrameScript, currentFrame->_sprites[spriteId]->_scriptId); +		} +	}  }  void Lingo::runMovieScript(LEvent event) {  | 
