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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Jan 11 11:59:55 CET 2010


Revision: 47247
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47247&view=rev
Author:   thebluegr
Date:     2010-01-11 10:59:52 +0000 (Mon, 11 Jan 2010)

Log Message:
-----------
- Set the palette inside doit() again
- Removed a now obsolete TODO
- Portrait animations are now stopped when the Esc key is pressed, or when the engine should quit

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

Modified: scummvm/trunk/engines/sci/graphics/portrait.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.cpp	2010-01-11 10:37:32 UTC (rev 47246)
+++ scummvm/trunk/engines/sci/graphics/portrait.cpp	2010-01-11 10:59:52 UTC (rev 47247)
@@ -39,8 +39,8 @@
 namespace Sci {
 
 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), _audio(audio) {
-	init(resourceName, palette);
+	: _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio) {
+	init(resourceName);
 }
 
 Portrait::~Portrait() {
@@ -48,7 +48,7 @@
 	delete _fileData;
 }
 
-void Portrait::init(Common::String resourceName, SciPalette *palette) {
+void Portrait::init(Common::String resourceName) {
 	// .BIN files are loaded from actors directory and from .\ directory
 	// header:
 	// 3 bytes "WIN"
@@ -128,9 +128,6 @@
 		data += 14;
 		curBitmap++;
 	}
-
-	// Set the portrait palette
-	palette->set(&_portraitPalette, 1);
 }
 
 void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq) {
@@ -145,6 +142,9 @@
 	if (!syncResource)
 		error("kPortrait: Could not open sync resource %d %X", resourceId, audioNumber);
 
+	// Set the portrait palette
+	_palette->set(&_portraitPalette, 1);
+
 	// Draw base bitmap
 	drawBitmap(0);
 	bitsShow();
@@ -154,7 +154,6 @@
 	_audio->startAudio(resourceId, audioNumber);
 
 	// Do animation depending on sync resource till audio is done playing
-	// TODO: This whole mess doesnt seem to be correct currently
 	uint16 syncCue;
 	int timerPosition, curPosition;
 	sciEvent curEvent;
@@ -174,7 +173,9 @@
 		do {
 			_gui->wait(1);
 			curEvent = _event->get(SCI_EVENT_ANY);
-			if (curEvent.type == SCI_EVENT_MOUSE_PRESS)
+			if (curEvent.type == SCI_EVENT_MOUSE_PRESS ||
+				(curEvent.type == SCI_EVENT_KEYBOARD && curEvent.data == SCI_KEY_ESC) ||
+				g_engine->shouldQuit())
 				userAbort = true;
 			curPosition = _audio->getAudioPosition();
 		} while ((curPosition != -1) && (curPosition < timerPosition) && (!userAbort));

Modified: scummvm/trunk/engines/sci/graphics/portrait.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.h	2010-01-11 10:37:32 UTC (rev 47246)
+++ scummvm/trunk/engines/sci/graphics/portrait.h	2010-01-11 10:59:52 UTC (rev 47247)
@@ -44,13 +44,14 @@
 	void doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
 
 private:
-	void init(Common::String resourceName, SciPalette *palette);
+	void init(Common::String resourceName);
 	void drawBitmap(uint16 bitmapNr);
 	void bitsShow();
 
 	ResourceManager *_resMan;
 	SciEvent *_event;
 	SciGui *_gui;
+	SciPalette *_palette;
 	Screen *_screen;
 	AudioPlayer *_audio;
 


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