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

h00ligan at users.sourceforge.net h00ligan at users.sourceforge.net
Fri Mar 24 10:17:01 CET 2006


Revision: 21439
Author:   h00ligan
Date:     2006-03-24 10:15:57 -0800 (Fri, 24 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21439&view=rev

Log Message:
-----------
fix ITE SUNSPOT music loop

Modified Paths:
--------------
    scummvm/trunk/engines/saga/music.cpp
    scummvm/trunk/engines/saga/resnames.h
Modified: scummvm/trunk/engines/saga/music.cpp
===================================================================
--- scummvm/trunk/engines/saga/music.cpp	2006-03-24 18:10:41 UTC (rev 21438)
+++ scummvm/trunk/engines/saga/music.cpp	2006-03-24 18:15:57 UTC (rev 21439)
@@ -24,6 +24,7 @@
 #include "saga/saga.h"
 
 #include "saga/rscfile.h"
+#include "saga/resnames.h"
 #include "saga/music.h"
 #include "saga/stream.h"
 #include "sound/audiostream.h"
@@ -82,7 +83,7 @@
 	}
 
 public:
-	RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping);
+	RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping, uint32 loopStart);
 
 	int readBuffer(int16 *buffer, const int numSamples);
 
@@ -91,7 +92,7 @@
 	int getRate() const	{ return _musicInfo->frequency; }
 };
 
-RAWInputStream::RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping)
+RAWInputStream::RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping, uint32 loopStart)
 	: _context(context), _finished(false), _looping(looping), _bufferEnd(_buf + BUFFER_SIZE) {
 
 	ResourceData * resourceData;
@@ -105,9 +106,11 @@
 	}
 
 	// Determine the end position
-	_startPos = resourceData->offset;
-	_endPos = _startPos + resourceData->size;
-	_filePos = _startPos;
+	_filePos = resourceData->offset;
+	_endPos = _filePos + resourceData->size;
+	_startPos = _filePos + loopStart;
+	if (_startPos >= _endPos)
+		_startPos = _filePos;
 
 	// Read in initial data
 	refill();
@@ -375,7 +378,8 @@
 	MidiParser *parser;
 	ResourceContext *context;
 	byte *resourceData;
-	size_t resourceSize;
+	size_t resourceSize;	
+	uint32 loopStart;
 
 	debug(2, "Music::play %d, %d", resourceId, flags);
 
@@ -420,7 +424,13 @@
 		if (resourceId >= 9 && resourceId <= 34) {
 			if (_musicContext != NULL) {
 				//TODO: check resource size
-				audioStream = new RAWInputStream(_vm, _musicContext, resourceId - 9, flags == MUSIC_LOOP);
+				loopStart = 0;
+				// fix ITE sunstatm score
+				if ((_vm->getGameType() == GType_ITE) && (resourceId == MUSIC_SUNSPOT)) {
+					loopStart = 4 * 18727;
+				}
+
+				audioStream = new RAWInputStream(_vm, _musicContext, resourceId - 9, flags == MUSIC_LOOP, loopStart);
 			}
 		}
 	}

Modified: scummvm/trunk/engines/saga/resnames.h
===================================================================
--- scummvm/trunk/engines/saga/resnames.h	2006-03-24 18:10:41 UTC (rev 21438)
+++ scummvm/trunk/engines/saga/resnames.h	2006-03-24 18:15:57 UTC (rev 21439)
@@ -178,6 +178,7 @@
 // MUSIC
 #define MUSIC_1 9
 #define MUSIC_2 10
+#define MUSIC_SUNSPOT 26
 
 // TODO: If the sound effects are numbered sequentially, we don't really need
 //       these constants. But for now they might be useful for debugging.


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