[Scummvm-cvs-logs] SF.net SVN: scummvm:[47224] scummvm/trunk/engines/sci/graphics

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Jan 10 14:11:53 CET 2010


Revision: 47224
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47224&view=rev
Author:   m_kiewitz
Date:     2010-01-10 13:11:53 +0000 (Sun, 10 Jan 2010)

Log Message:
-----------
SCI: kPortrait - mouse click now aborts portrait

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/portrait.cpp
    scummvm/trunk/engines/sci/graphics/portrait.h

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-10 11:33:10 UTC (rev 47223)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-10 13:11:53 UTC (rev 47224)
@@ -843,7 +843,7 @@
 }
 
 void SciGui::portraitShow(Common::String resourceName, Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq) {
-	Portrait *myPortrait = new Portrait(_s->resMan, this, _screen, _palette, _audio, resourceName);
+	Portrait *myPortrait = new Portrait(_s->resMan, _s->_event, this, _screen, _palette, _audio, resourceName);
 	// TODO: cache portraits
 	// adjust given coordinates to curPort (but dont adjust coordinates on upscaledHires_Save_Box and give us hires coordinates
 	//  on kDrawCel, yeah this whole stuff makes sense)

Modified: scummvm/trunk/engines/sci/graphics/portrait.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.cpp	2010-01-10 11:33:10 UTC (rev 47223)
+++ scummvm/trunk/engines/sci/graphics/portrait.cpp	2010-01-10 13:11:53 UTC (rev 47224)
@@ -28,6 +28,7 @@
 #include "graphics/primitives.h"
 
 #include "sci/sci.h"
+#include "sci/event.h"
 #include "sci/engine/state.h"
 #include "sci/graphics/gui.h"
 #include "sci/graphics/screen.h"
@@ -37,8 +38,8 @@
 
 namespace Sci {
 
-Portrait::Portrait(ResourceManager *resMan, SciGui *gui, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName)
-	: _resMan(resMan), _gui(gui), _screen(screen), _palette(palette), _audio(audio), _resourceName(resourceName) {
+Portrait::Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName)
+	: _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio), _resourceName(resourceName) {
 	init();
 }
 
@@ -154,7 +155,10 @@
 	// TODO: This whole mess doesnt seem to be correct currently
 	uint16 syncCue;
 	int timerPosition, curPosition;
-	while (syncOffset < syncResource->size - 2) {
+	sciEvent curEvent;
+	bool userAbort = false;
+
+	while ((syncOffset < syncResource->size - 2) && (!userAbort)) {
 		timerPosition = (int16)READ_LE_UINT16(syncResource->data + syncOffset);
 		syncOffset += 2;
 		if (syncOffset < syncResource->size - 2) {
@@ -167,8 +171,9 @@
 		// Wait till syncTime passed, then show specific animation bitmap
 		do {
 			_gui->wait(1);
+			curEvent = _event->get(SCI_EVENT_ANY);
 			curPosition = _audio->getAudioPosition();
-		} while ((curPosition != -1) && (curPosition < timerPosition));
+		} while ((curPosition != -1) && (curPosition < timerPosition) && (curEvent.type == SCI_EVENT_NONE));
 
 		if (syncCue != 0xFFFF) {
 			// Display animation bitmap
@@ -181,8 +186,17 @@
 				warning("kPortrait: sync information tried to draw non-existant %d", syncCue);
 			}
 		}
+
+		switch (curEvent.type) {
+		case SCI_EVENT_MOUSE_RELEASE:
+		case SCI_EVENT_MOUSE_PRESS:
+			userAbort = true;
+		}
 	}
 
+	if (userAbort)
+		_audio->stopAudio();
+
 	_resMan->unlockResource(syncResource);
 }
 

Modified: scummvm/trunk/engines/sci/graphics/portrait.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.h	2010-01-10 11:33:10 UTC (rev 47223)
+++ scummvm/trunk/engines/sci/graphics/portrait.h	2010-01-10 13:11:53 UTC (rev 47224)
@@ -37,7 +37,7 @@
 
 class Portrait {
 public:
-	Portrait(ResourceManager *resMan, SciGui *gui, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName);
+	Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName);
 	~Portrait();
 
 	void setupAudio(uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
@@ -49,6 +49,7 @@
 	void bitsShow();
 
 	ResourceManager *_resMan;
+	SciEvent *_event;
 	SciGui *_gui;
 	Screen *_screen;
 	SciPalette *_palette;


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