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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Jan 11 10:30:41 CET 2010


Revision: 47241
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47241&view=rev
Author:   thebluegr
Date:     2010-01-11 09:30:41 +0000 (Mon, 11 Jan 2010)

Log Message:
-----------
- Don't set the palette per portrait frame - setting the whole screen palette is a very expensive operation, and shouldn't be done on each frame, especially when all of the frames use the same palette
- Cleanup

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

Modified: scummvm/trunk/engines/sci/graphics/portrait.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.cpp	2010-01-11 09:28:00 UTC (rev 47240)
+++ scummvm/trunk/engines/sci/graphics/portrait.cpp	2010-01-11 09:30:41 UTC (rev 47241)
@@ -39,15 +39,15 @@
 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), _resourceName(resourceName) {
-	init();
+	: _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio) {
+	init(resourceName);
 }
 
 Portrait::~Portrait() {
 	delete[] _bitmaps;
 }
 
-void Portrait::init() {
+void Portrait::init(Common::String resourceName) {
 	// .BIN files are loaded from actors directory and from .\ directory
 	// header:
 	// 3 bytes "WIN"
@@ -66,14 +66,12 @@
 	//  -> 6 bytes unknown
 	// height * width bitmap data
 	// another animation count times bitmap header and data
-	Common::SeekableReadStream *file = 0;
-	_fileName = "actors/" + _resourceName + ".bin";
-	file = SearchMan.createReadStreamForMember(_fileName);
+	Common::SeekableReadStream *file = 
+		SearchMan.createReadStreamForMember("actors/" + resourceName + ".bin");
 	if (!file) {
-		_fileName = _resourceName + ".bin";
-		file = SearchMan.createReadStreamForMember(_fileName);
+		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,19 +79,19 @@
 	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);
 	_bitmapCount = READ_LE_UINT16(_fileData + 7);
 	_bitmaps = new PortraitBitmap[_bitmapCount];
 
-	_portraitPaletteSize = READ_LE_UINT16(_fileData + 13);
+	uint16 portraitPaletteSize = READ_LE_UINT16(_fileData + 13);
 	byte *data = _fileData + 17;
 	// Read palette
 	memset(&_portraitPalette, 0, sizeof(Palette));
 	uint16 palSize = 0, palNr = 0;
-	while (palSize < _portraitPaletteSize) {
+	while (palSize < portraitPaletteSize) {
 		_portraitPalette.colors[palNr].b = *data++;
 		_portraitPalette.colors[palNr].g = *data++;
 		_portraitPalette.colors[palNr].r = *data++;
@@ -128,6 +126,9 @@
 		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) {
@@ -143,7 +144,6 @@
 		error("kPortrait: Could not open sync resource %d %X", resourceId, audioNumber);
 
 	// Draw base bitmap
-	_palette->set(&_portraitPalette, 1);
 	drawBitmap(0);
 	bitsShow();
 

Modified: scummvm/trunk/engines/sci/graphics/portrait.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.h	2010-01-11 09:28:00 UTC (rev 47240)
+++ scummvm/trunk/engines/sci/graphics/portrait.h	2010-01-11 09:30:41 UTC (rev 47241)
@@ -44,7 +44,7 @@
 	void doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
 
 private:
-	void init();
+	void init(Common::String resourceName);
 	void drawBitmap(uint16 bitmapNr);
 	void bitsShow();
 
@@ -55,14 +55,11 @@
 	SciPalette *_palette;
 	AudioPlayer *_audio;
 
-	Common::String _resourceName;
-	Common::String _fileName;
 	byte *_fileData;
 	int32 _fileSize;
 
 	uint16 _height;
 	uint16 _width;
-	uint16 _portraitPaletteSize;
 	Palette _portraitPalette;
 
 	uint16 _bitmapCount;

Modified: scummvm/trunk/engines/sci/sound/softseq/adlib.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/softseq/adlib.cpp	2010-01-11 09:28:00 UTC (rev 47240)
+++ scummvm/trunk/engines/sci/sound/softseq/adlib.cpp	2010-01-11 09:30:41 UTC (rev 47241)
@@ -827,8 +827,4 @@
 	return new MidiPlayer_Adlib();
 }
 
-MidiDriver *MidiDriver_Adlib_create() {
-	return new MidiDriver_Adlib(g_system->getMixer());
-}
-
 } // End of namespace Sci


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