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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Jan 11 15:12:53 CET 2010


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

Log Message:
-----------
Some portrait-related changes, to be used when portrait loading/unloading is done. Also, added a comment on where the class is used

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

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-11 12:23:04 UTC (rev 47250)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-11 14:12:52 UTC (rev 47251)
@@ -648,7 +648,7 @@
 	case 0: { // load
 		if (argc == 2) {
 			Common::String resourceName = s->_segMan->getString(argv[1]);
-			return s->_gui->portraitLoad(resourceName);
+			s->r_acc = s->_gui->portraitLoad(resourceName);
 		} else {
 			warning("kPortrait(loadResource) called with unsupported argc %d", argc);
 		}

Modified: scummvm/trunk/engines/sci/graphics/portrait.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.cpp	2010-01-11 12:23:04 UTC (rev 47250)
+++ scummvm/trunk/engines/sci/graphics/portrait.cpp	2010-01-11 14:12:52 UTC (rev 47251)
@@ -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), _palette(palette), _audio(audio) {
-	init(resourceName);
+	: _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio), _resourceName(resourceName) {
+	init();
 }
 
 Portrait::~Portrait() {
@@ -48,7 +48,7 @@
 	delete _fileData;
 }
 
-void Portrait::init(Common::String resourceName) {
+void Portrait::init() {
 	// .BIN files are loaded from actors directory and from .\ directory
 	// header:
 	// 3 bytes "WIN"
@@ -69,11 +69,11 @@
 	// another animation count times bitmap header and data
 	int32 fileSize = 0;
 	Common::SeekableReadStream *file = 
-		SearchMan.createReadStreamForMember("actors/" + resourceName + ".bin");
+		SearchMan.createReadStreamForMember("actors/" + _resourceName + ".bin");
 	if (!file) {
-		file = SearchMan.createReadStreamForMember(resourceName + ".bin");
+		file = SearchMan.createReadStreamForMember(_resourceName + ".bin");
 		if (!file)
-			error("portrait %s.bin not found", resourceName.c_str());
+			error("portrait %s.bin not found", _resourceName.c_str());
 	}
 	fileSize = file->size();
 	_fileData = new byte[fileSize];
@@ -81,7 +81,7 @@
 	delete file;
 
 	if (strncmp((char *)_fileData, "WIN", 3)) {
-		error("portrait %s doesn't have valid header", resourceName.c_str());
+		error("portrait %s doesn't have valid header", _resourceName.c_str());
 	}
 	_width = READ_LE_UINT16(_fileData + 3);
 	_height = READ_LE_UINT16(_fileData + 5);

Modified: scummvm/trunk/engines/sci/graphics/portrait.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.h	2010-01-11 12:23:04 UTC (rev 47250)
+++ scummvm/trunk/engines/sci/graphics/portrait.h	2010-01-11 14:12:52 UTC (rev 47251)
@@ -35,6 +35,11 @@
 	byte *rawBitmap;
 };
 
+/**
+ * This class is used to handle all the hi-res portraits used in the Windows
+ * release of KQ6. These are all in external data files, and handled separately
+ * from the rest of the engine (originally, inside rave.dll)
+ */
 class Portrait {
 public:
 	Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName);
@@ -43,8 +48,10 @@
 	void setupAudio(uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
 	void doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
 
+	Common::String getResourceName() { return _resourceName; }
+
 private:
-	void init(Common::String resourceName);
+	void init();
 	void drawBitmap(uint16 bitmapNr);
 	void bitsShow();
 
@@ -62,6 +69,8 @@
 	uint16 _bitmapCount;
 	PortraitBitmap *_bitmaps;
 
+	Common::String _resourceName;
+
 	byte *_fileData;
 
 	Common::Point _position;


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