[Scummvm-cvs-logs] SF.net SVN: scummvm:[53773] scummvm/trunk/engines/saga

h00ligan at users.sourceforge.net h00ligan at users.sourceforge.net
Sun Oct 24 22:22:21 CEST 2010


Revision: 53773
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53773&view=rev
Author:   h00ligan
Date:     2010-10-24 20:22:21 +0000 (Sun, 24 Oct 2010)

Log Message:
-----------
SAGA: replace Scene::_resourceList, Interface::_inventory malloc arrays with Common::Array

Modified Paths:
--------------
    scummvm/trunk/engines/saga/actor.cpp
    scummvm/trunk/engines/saga/events.cpp
    scummvm/trunk/engines/saga/interface.cpp
    scummvm/trunk/engines/saga/interface.h
    scummvm/trunk/engines/saga/introproc_ihnm.cpp
    scummvm/trunk/engines/saga/introproc_ite.cpp
    scummvm/trunk/engines/saga/scene.cpp
    scummvm/trunk/engines/saga/scene.h
    scummvm/trunk/engines/saga/sndres.cpp
    scummvm/trunk/engines/saga/sound.cpp
    scummvm/trunk/engines/saga/sound.h

Modified: scummvm/trunk/engines/saga/actor.cpp
===================================================================
--- scummvm/trunk/engines/saga/actor.cpp	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/actor.cpp	2010-10-24 20:22:21 UTC (rev 53773)
@@ -1146,12 +1146,13 @@
 	ActorData *actor;
 	int width, height;
 	int stringLength = strlen(_activeSpeech.strings[0]);
-	char *outputString = (char*)calloc(stringLength + 1, 1);
+	Common::Array<char> outputString;
+	outputString.resize(stringLength + 1);
 
 	if (_activeSpeech.speechFlags & kSpeakSlow)
-		strncpy(outputString, _activeSpeech.strings[0], _activeSpeech.slowModeCharIndex + 1);
+		strncpy(&outputString.front(), _activeSpeech.strings[0], _activeSpeech.slowModeCharIndex + 1);
 	else
-		strncpy(outputString, _activeSpeech.strings[0], stringLength);
+		strncpy(&outputString.front(), _activeSpeech.strings[0], stringLength);
 
 	if (_activeSpeech.actorsCount > 1) {
 		height = _vm->_font->getHeight(kKnownFontScript);
@@ -1168,15 +1169,13 @@
 			else if (_vm->getGameId() == GID_IHNM)
 				textPoint.y = 10; // CLIP(actor->_screenPosition.y - 160, 10, _vm->_scene->getHeight(true) - 10 - height);
 
-			_vm->_font->textDraw(kKnownFontScript, outputString, textPoint,
+			_vm->_font->textDraw(kKnownFontScript, &outputString.front(), textPoint,
 				_activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], _activeSpeech.getFontFlags(i));
 		}
 	} else {
-		_vm->_font->textDrawRect(kKnownFontScript, outputString, _activeSpeech.drawRect, _activeSpeech.speechColor[0],
+		_vm->_font->textDrawRect(kKnownFontScript, &outputString.front(), _activeSpeech.drawRect, _activeSpeech.speechColor[0],
 			_activeSpeech.outlineColor[0], _activeSpeech.getFontFlags(0));
 	}
-
-	free(outputString);
 }
 
 void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount, int sampleResourceId, int speechFlags) {

Modified: scummvm/trunk/engines/saga/events.cpp
===================================================================
--- scummvm/trunk/engines/saga/events.cpp	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/events.cpp	2010-10-24 20:22:21 UTC (rev 53773)
@@ -49,7 +49,6 @@
 
 Events::~Events() {
 	debug(8, "Shutting down event subsystem...");
-	freeList();
 }
 
 // Function to process event list once per frame.

Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/interface.cpp	2010-10-24 20:22:21 UTC (rev 53773)
@@ -317,16 +317,12 @@
 	_inventoryStart = 0;
 	_inventoryEnd = 0;
 	_inventoryBox = 0;
-	_inventorySize = ITE_INVENTORY_SIZE;
 	_saveReminderState = 0;
 
 	_optionSaveFileTop = 0;
 	_optionSaveFileTitleNumber = 0;
 
-	_inventory = (uint16 *)calloc(_inventorySize, sizeof(uint16));
-	if (_inventory == NULL) {
-		error("Interface::Interface(): not enough memory");
-	}
+	_inventory.resize(ITE_INVENTORY_SIZE);
 
 	_textInput = false;
 	_statusTextInput = false;
@@ -339,7 +335,6 @@
 }
 
 Interface::~Interface() {
-	free(_inventory);
 }
 
 void Interface::saveReminderCallback(void *refCon) {
@@ -2040,7 +2035,7 @@
 }
 
 void Interface::addToInventory(int objectId) {
-	if (_inventoryCount >= _inventorySize) {
+	if (uint(_inventoryCount) >= _inventory.size()) {
 		return;
 	}
 

Modified: scummvm/trunk/engines/saga/interface.h
===================================================================
--- scummvm/trunk/engines/saga/interface.h	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/interface.h	2010-10-24 20:22:21 UTC (rev 53773)
@@ -427,8 +427,7 @@
 
 	Point _lastMousePoint;
 
-	uint16 *_inventory;
-	int _inventorySize;
+	Common::Array<uint16> _inventory;
 	int _inventoryStart;
 	int _inventoryEnd;
 	int _inventoryPos;

Modified: scummvm/trunk/engines/saga/introproc_ihnm.cpp
===================================================================
--- scummvm/trunk/engines/saga/introproc_ihnm.cpp	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/introproc_ihnm.cpp	2010-10-24 20:22:21 UTC (rev 53773)
@@ -88,14 +88,13 @@
 	// Queue first scene
 	firstScene.loadFlag = kLoadBySceneNumber;
 	firstScene.sceneDescriptor = -1;
-	firstScene.sceneDescription = NULL;
 	firstScene.sceneSkipTarget = false;
 	firstScene.sceneProc = NULL;
 	firstScene.transitionType = kTransitionFade;
 	firstScene.actorsEntrance = 0;
 	firstScene.chapter = -1;
 
-	_vm->_scene->queueScene(&firstScene);
+	_vm->_scene->queueScene(firstScene);
 
 	return SUCCESS;
 }

Modified: scummvm/trunk/engines/saga/introproc_ite.cpp
===================================================================
--- scummvm/trunk/engines/saga/introproc_ite.cpp	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/introproc_ite.cpp	2010-10-24 20:22:21 UTC (rev 53773)
@@ -61,15 +61,15 @@
 #define MUSIC_2 10
 
 LoadSceneParams ITE_IntroList[] = {
-	{RID_ITE_INTRO_ANIM_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroAnimProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
-	{RID_ITE_CAVE_SCENE_1, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave1Proc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
-	{RID_ITE_CAVE_SCENE_2, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave2Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
-	{RID_ITE_CAVE_SCENE_3, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave3Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
-	{RID_ITE_CAVE_SCENE_4, kLoadByResourceId, NULL, Scene::SC_ITEIntroCave4Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
-	{RID_ITE_VALLEY_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroValleyProc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
-	{RID_ITE_TREEHOUSE_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroTreeHouseProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
-	{RID_ITE_FAIREPATH_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroFairePathProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
-	{RID_ITE_FAIRETENT_SCENE, kLoadByResourceId, NULL, Scene::SC_ITEIntroFaireTentProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE}
+	{RID_ITE_INTRO_ANIM_SCENE, kLoadByResourceId, Scene::SC_ITEIntroAnimProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_CAVE_SCENE_1, kLoadByResourceId, Scene::SC_ITEIntroCave1Proc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_CAVE_SCENE_2, kLoadByResourceId, Scene::SC_ITEIntroCave2Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_CAVE_SCENE_3, kLoadByResourceId, Scene::SC_ITEIntroCave3Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_CAVE_SCENE_4, kLoadByResourceId, Scene::SC_ITEIntroCave4Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_VALLEY_SCENE, kLoadByResourceId, Scene::SC_ITEIntroValleyProc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_TREEHOUSE_SCENE, kLoadByResourceId, Scene::SC_ITEIntroTreeHouseProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_FAIREPATH_SCENE, kLoadByResourceId, Scene::SC_ITEIntroFairePathProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
+	{RID_ITE_FAIRETENT_SCENE, kLoadByResourceId, Scene::SC_ITEIntroFaireTentProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE}
 };
 
 int Scene::ITEStartProc() {
@@ -84,20 +84,19 @@
 	for (i = 0; i < scenesCount; i++) {
 		tempScene = ITE_IntroList[i];
 		tempScene.sceneDescriptor = _vm->_resource->convertResourceId(tempScene.sceneDescriptor);
-		_vm->_scene->queueScene(&tempScene);
+		_vm->_scene->queueScene(tempScene);
 	}
 
 
 	firstScene.loadFlag = kLoadBySceneNumber;
 	firstScene.sceneDescriptor = _vm->getStartSceneNumber();
-	firstScene.sceneDescription = NULL;
 	firstScene.sceneSkipTarget = true;
 	firstScene.sceneProc = NULL;
 	firstScene.transitionType = kTransitionFade;
 	firstScene.actorsEntrance = 0;
 	firstScene.chapter = -1;
 
-	_vm->_scene->queueScene(&firstScene);
+	_vm->_scene->queueScene(firstScene);
 
 	return SUCCESS;
 }

Modified: scummvm/trunk/engines/saga/scene.cpp
===================================================================
--- scummvm/trunk/engines/saga/scene.cpp	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/scene.cpp	2010-10-24 20:22:21 UTC (rev 53773)
@@ -213,10 +213,7 @@
 	_chapterNumber = 0;
 	_sceneResourceId = 0;
 	_inGame = false;
-	_loadDescription = false;
-	memset(&_sceneDescription, 0, sizeof(_sceneDescription));
-	_resourceListCount = 0;
-	_resourceList = NULL;
+	_sceneDescription.reset();
 	_sceneProc = NULL;
 	_objectMap = new ObjectMap(_vm);
 	_actionMap = new ObjectMap(_vm);
@@ -588,7 +585,6 @@
 }
 
 void Scene::loadScene(LoadSceneParams &loadSceneParams) {
-	size_t i;
 	Event event;
 	EventColumns *eventColumns;
 	static PalEntry current_pal[PAL_ENTRIES];
@@ -650,8 +646,6 @@
 		error("Scene::loadScene(): Error, a scene is already loaded");
 	}
 
-	_loadDescription = true;
-
 #ifdef ENABLE_IHNM
 	if (_vm->getGameId() == GID_IHNM) {
 		if (loadSceneParams.loadFlag == kLoadBySceneNumber) // When will we get rid of it?
@@ -669,16 +663,6 @@
 		_sceneNumber = loadSceneParams.sceneDescriptor;
 		_sceneResourceId = getSceneResourceId(_sceneNumber);
 		break;
-	case kLoadByDescription:
-		_sceneNumber = -1;
-		_sceneResourceId = -1;
-		assert(loadSceneParams.sceneDescription != NULL);
-		assert(loadSceneParams.sceneDescription->resourceList != NULL);
-		_loadDescription = false;
-		_sceneDescription = *loadSceneParams.sceneDescription;
-		_resourceList = loadSceneParams.sceneDescription->resourceList;
-		_resourceListCount = loadSceneParams.sceneDescription->resourceListCount;
-		break;
 	}
 
 	debug(3, "Loading scene number %d:", _sceneNumber);
@@ -693,27 +677,22 @@
 	}
 
 	// Load scene descriptor and resource list resources
-	if (_loadDescription) {
-		debug(3, "Loading scene resource %i", _sceneResourceId);
+	debug(3, "Loading scene resource %i", _sceneResourceId);
 
-		loadSceneDescriptor(_sceneResourceId);
+	loadSceneDescriptor(_sceneResourceId);
 
-		loadSceneResourceList(_sceneDescription.resourceListResourceId);
-	} else {
-		debug(3, "Loading memory scene resource");
-	}
+	loadSceneResourceList(_sceneDescription.resourceListResourceId);
 
 	// Load resources from scene resource list
-	for (i = 0; i < _resourceListCount; i++) {
-		if (!_resourceList[i].invalid) {
-			_vm->_resource->loadResource(_sceneContext, _resourceList[i].resourceId,
-				_resourceList[i].buffer, _resourceList[i].size);
+	for (SceneResourceDataArray::iterator resource = _resourceList.begin(); resource != _resourceList.end(); ++resource) {
+		if (!resource->invalid) {
+			_vm->_resource->loadResource(_sceneContext, resource->resourceId, resource->buffer, resource->size);
 
 
-			if (_resourceList[i].size >= 6) {
-				if (!memcmp(_resourceList[i].buffer, "DUMMY!", 6)) {
-					_resourceList[i].invalid = true;
-					warning("DUMMY resource %i", _resourceList[i].resourceId);
+			if (resource->size >= 6) {
+				if (!memcmp(resource->buffer, "DUMMY!", 6)) {
+					resource->invalid = true;
+					warning("DUMMY resource %i", resource->resourceId);
 				}
 			}
 		}
@@ -911,7 +890,7 @@
 	byte *sceneDescriptorData;
 	size_t sceneDescriptorDataLength;
 
-	memset(&_sceneDescription, 0, sizeof(_sceneDescription));
+	_sceneDescription.reset();
 
 	if (resourceId == 0) {
 		return;
@@ -938,10 +917,8 @@
 void Scene::loadSceneResourceList(uint32 resourceId) {
 	byte *resourceListData;
 	size_t resourceListDataLength;
-	size_t i;
 
-	_resourceListCount = 0;
-	_resourceList = NULL;
+	_resourceList.clear();
 
 	if (resourceId == 0) {
 		return;
@@ -954,19 +931,18 @@
 		MemoryReadStreamEndian readS(resourceListData, resourceListDataLength, _sceneContext->isBigEndian());
 
 		// Allocate memory for scene resource list
-		_resourceListCount = resourceListDataLength / SAGA_RESLIST_ENTRY_LEN;
-		debug(3, "Scene resource list contains %i entries", (int)_resourceListCount);
-		_resourceList = (SceneResourceData *)calloc(_resourceListCount, sizeof(*_resourceList));
+		_resourceList.resize(resourceListDataLength / SAGA_RESLIST_ENTRY_LEN);
+		debug(3, "Scene resource list contains %i entries", (int)_resourceList.size());
 
 		// Load scene resource list from raw scene
 		// resource table
 		debug(3, "Loading scene resource list");
 
-		for (i = 0; i < _resourceListCount; i++) {
-			_resourceList[i].resourceId = readS.readUint16();
-			_resourceList[i].resourceType = readS.readUint16();
+		for (SceneResourceDataArray::iterator resource = _resourceList.begin(); resource != _resourceList.end(); ++resource) {
+			resource->resourceId = readS.readUint16();
+			resource->resourceType = readS.readUint16();
 			// demo version may contain invalid resourceId
-			_resourceList[i].invalid = !_sceneContext->validResourceId(_resourceList[i].resourceId);
+			resource->invalid = !_sceneContext->validResourceId(resource->resourceId);
 		}
 
 	}
@@ -977,7 +953,6 @@
 	byte *resourceData;
 	size_t resourceDataLength;
 	const byte *palPointer;
-	size_t i;
 	SAGAResourceTypes *types = 0;
 	int typesCount = 0;
 	SAGAResourceTypes resType;
@@ -985,22 +960,22 @@
 	getResourceTypes(types, typesCount);
 
 	// Process the scene resource list
-	for (i = 0; i < _resourceListCount; i++) {
-		if (_resourceList[i].invalid) {
+	for (SceneResourceDataArray::iterator resource = _resourceList.begin(); resource != _resourceList.end(); ++resource) {
+		if (resource->invalid) {
 			continue;
 		}
-		resourceData = _resourceList[i].buffer;
-		resourceDataLength = _resourceList[i].size;
+		resourceData = resource->buffer;
+		resourceDataLength = resource->size;
 
-		if (_resourceList[i].resourceType >= typesCount) {
-			error("Scene::processSceneResources() wrong resource type %i", _resourceList[i].resourceType);
+		if (resource->resourceType >= typesCount) {
+			error("Scene::processSceneResources() wrong resource type %i", resource->resourceType);
 		}
 
-		resType = types[_resourceList[i].resourceType];
+		resType = types[resource->resourceType];
 
 		switch (resType) {
 		case SAGA_UNKNOWN:
-			warning("UNKNOWN resourceType %i", _resourceList[i].resourceType);
+			warning("UNKNOWN resourceType %i", resource->resourceType);
 			break;
 		case SAGA_ACTOR:
 			//for (a = actorsInScene; a; a = a->nextInScene)
@@ -1027,7 +1002,7 @@
 				_bg.buffer,
 				&_bg.w,
 				&_bg.h)) {
-				error("Scene::processSceneResources() Error loading background resource %i", _resourceList[i].resourceId);
+				error("Scene::processSceneResources() Error loading background resource %i", resource->resourceId);
 			}
 
 			palPointer = _vm->getImagePal(_bg.res_buf, _bg.res_len);
@@ -1100,7 +1075,7 @@
 			break;
 		case SAGA_ANIM:
 			{
-				uint16 animId = _resourceList[i].resourceType - 14;
+				uint16 animId = resource->resourceType - 14;
 
 				debug(3, "Loading animation resource animId=%i", animId);
 
@@ -1126,7 +1101,7 @@
 			break;
 		case SAGA_FACES:
 			if (_vm->getGameId() == GID_ITE)
-				_vm->_interface->loadScenePortraits(_resourceList[i].resourceId);
+				_vm->_interface->loadScenePortraits(resource->resourceId);
 			break;
 		case SAGA_PALETTE:
 			{
@@ -1145,7 +1120,7 @@
 			}
 			break;
 		default:
-			error("Scene::ProcessSceneResources() Encountered unknown resource type %i", _resourceList[i].resourceType);
+			error("Scene::ProcessSceneResources() Encountered unknown resource type %i", resource->resourceType);
 			break;
 		}
 	}
@@ -1222,13 +1197,11 @@
 	}
 
 	// Free scene resource list
-	for (i = 0; i < _resourceListCount; i++) {
+	for (i = 0; i < _resourceList.size(); i++) { //!!!!!!!!!!!!!!!!!!!
 		free(_resourceList[i].buffer);
 	}
 
-	if (_loadDescription) {
-		free(_resourceList);
-	}
+	_resourceList.clear();
 
 	// Free animation info list
 	_vm->_anim->reset();

Modified: scummvm/trunk/engines/saga/scene.h
===================================================================
--- scummvm/trunk/engines/saga/scene.h	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/scene.h	2010-10-24 20:22:21 UTC (rev 53773)
@@ -113,8 +113,13 @@
 	byte *buffer;
 	size_t size;
 	bool invalid;
+
+	SceneResourceData() : resourceId(0), resourceType(0), buffer(NULL), size(0), invalid(false) {
+	}
 };
 
+typedef Common::Array<SceneResourceData> SceneResourceDataArray;
+
 #define SAGA_SCENE_DESC_LEN 16
 
 struct SceneDescription {
@@ -126,8 +131,10 @@
 	uint16 sceneScriptEntrypointNumber;
 	uint16 startScriptEntrypointNumber;
 	int16 musicResourceId;
-	SceneResourceData *resourceList;
-	size_t resourceListCount;
+	
+	void reset()  {
+		flags = resourceListResourceId = endSlope = beginSlope = scriptModuleNumber = sceneScriptEntrypointNumber = startScriptEntrypointNumber = musicResourceId = 0;
+	}
 };
 
 struct SceneEntry {
@@ -161,14 +168,12 @@
 
 enum SceneLoadFlags {
 	kLoadByResourceId,
-	kLoadBySceneNumber,
-	kLoadByDescription
+	kLoadBySceneNumber
 };
 
 struct LoadSceneParams {
 	int32 sceneDescriptor;
 	SceneLoadFlags loadFlag;
-	SceneDescription* sceneDescription;
 	SceneProc *sceneProc;
 	bool sceneSkipTarget;
 	SceneTransitionType transitionType;
@@ -230,8 +235,8 @@
 	void skipScene();
 	void endScene();
 	void restoreScene();
-	void queueScene(LoadSceneParams *sceneQueue) {
-		_sceneQueue.push_back(*sceneQueue);
+	void queueScene(const LoadSceneParams &sceneQueue) {
+		_sceneQueue.push_back(sceneQueue);
 	}
 
 	void draw();
@@ -379,10 +384,8 @@
 	int _currentMusicRepeat;
 	bool _chapterPointsChanged;
 	bool _inGame;
-	bool _loadDescription;
 	SceneDescription _sceneDescription;
-	size_t _resourceListCount;
-	SceneResourceData *_resourceList;
+	SceneResourceDataArray _resourceList;
 	SceneProc *_sceneProc;
 	SceneImage _bg;
 	SceneImage _bgMask;

Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/sndres.cpp	2010-10-24 20:22:21 UTC (rev 53773)
@@ -321,7 +321,7 @@
 #endif
 		} else if (resourceType == kSoundVOC) {
 			data = Audio::loadVOCFromStream(readS, size, rate);
-			result = (data != 0);
+			result = (data != NULL);
 			if (onlyHeader)
 				free(data);
 			buffer.flags |= Audio::FLAG_UNSIGNED;
@@ -333,11 +333,13 @@
 			buffer.frequency = rate;
 			buffer.size = size;
 
-			if (!onlyHeader && resourceType != kSoundVOC) {
-				buffer.buffer = (byte *)malloc(size);
-				readS.read(buffer.buffer, size);
-			} else if (!onlyHeader && resourceType == kSoundVOC) {
-				buffer.buffer = data;
+			if (!onlyHeader) {
+				if (resourceType == kSoundVOC) {
+					buffer.buffer = data;
+				} else {
+					buffer.buffer = (byte *)malloc(size);
+					readS.read(buffer.buffer, size);
+				}
 			}
 		}
 		break;

Modified: scummvm/trunk/engines/saga/sound.cpp
===================================================================
--- scummvm/trunk/engines/saga/sound.cpp	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/sound.cpp	2010-10-24 20:22:21 UTC (rev 53773)
@@ -36,7 +36,7 @@
 namespace Saga {
 
 Sound::Sound(SagaEngine *vm, Audio::Mixer *mixer) :
-	_vm(vm), _mixer(mixer), _voxStream(0) {
+	_vm(vm), _mixer(mixer) {
 
 	for (int i = 0; i < SOUND_HANDLES; i++)
 		_handles[i].type = kFreeHandle;
@@ -45,7 +45,6 @@
 }
 
 Sound::~Sound() {
-	delete _voxStream;
 }
 
 SndHandle *Sound::getHandle() {

Modified: scummvm/trunk/engines/saga/sound.h
===================================================================
--- scummvm/trunk/engines/saga/sound.h	2010-10-24 20:20:48 UTC (rev 53772)
+++ scummvm/trunk/engines/saga/sound.h	2010-10-24 20:22:21 UTC (rev 53773)
@@ -95,7 +95,6 @@
 
 	SagaEngine *_vm;
 	Audio::Mixer *_mixer;
-	MemoryReadStream *_voxStream;
 
 	SndHandle _handles[SOUND_HANDLES];
 };


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