[Scummvm-cvs-logs] CVS: scummvm/sky disk.cpp,1.25,1.26 disk.h,1.4,1.5 intro.cpp,1.22,1.23 logic.cpp,1.69,1.70 sky.cpp,1.46,1.47 sound.cpp,1.9,1.10 sound.h,1.5,1.6

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sat May 31 20:45:05 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv14854/sky

Modified Files:
	disk.cpp disk.h intro.cpp logic.cpp sky.cpp sound.cpp sound.h 
Log Message:
basic ingame speech support

Index: disk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- disk.cpp	30 May 2003 13:35:33 -0000	1.25
+++ disk.cpp	1 Jun 2003 03:44:07 -0000	1.26
@@ -64,17 +64,29 @@
 
 SkyDisk::~SkyDisk(void) {
 
-	PrefFile **fEntry = &_prefRoot;
-	while (*fEntry) {
-		free((*fEntry)->data);
-		PrefFile *fTemp = *fEntry;
-		fEntry = &((*fEntry)->next);
+	PrefFile *fEntry = _prefRoot;
+	while (fEntry) {
+		free(fEntry->data);
+		PrefFile *fTemp = fEntry;
+		fEntry = fEntry->next;
 		delete fTemp;
 	}
 	if (_dnrHandle->isOpen()) _dnrHandle->close();
 	if (_dataDiskHandle->isOpen()) _dataDiskHandle->close();
 	delete _dnrHandle;
 	delete _dataDiskHandle;
+}
+
+void SkyDisk::flushPrefetched(void) {
+
+	PrefFile *fEntry = _prefRoot;
+	while (fEntry) {
+		free(fEntry->data);
+		PrefFile *fTemp = fEntry;
+		fEntry = fEntry->next;
+		delete fTemp;
+	}
+	_prefRoot = NULL;
 }
 
 //load in file file_nr to address dest

Index: disk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- disk.h	30 May 2003 13:35:34 -0000	1.4
+++ disk.h	1 Jun 2003 03:44:07 -0000	1.5
@@ -40,6 +40,7 @@
 
 	uint8 *loadFile(uint16 fileNr, uint8 *dest);
 	void prefetchFile(uint16 fileNr);
+	void flushPrefetched(void);
 
 	uint32 determineGameVersion();
 
@@ -51,7 +52,6 @@
 	void fnFlushBuffers(void);
 
 protected:
-
 
 	PrefFile *_prefRoot;
 	uint8 *givePrefetched(uint16 fileNr, uint32 *fSize);

Index: intro.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/intro.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- intro.cpp	29 May 2003 23:15:36 -0000	1.22
+++ intro.cpp	1 Jun 2003 03:44:07 -0000	1.23
@@ -477,12 +477,16 @@
 
 void SkyState::introFx(uint32 *&cmdPtr) {
 
+	_mixer->stopAll();
 	_skySound->playSound((uint16)cmdPtr[2], (uint16)cmdPtr[3]);
 	cmdPtr += 4;
 }
 
 void SkyState::introVol(uint32 *&cmdPtr) {
 
+	// HACK: for some reason, the mixer will only stop playing 
+	// looping sounds if you do it using SoundMixer::stopAll();
+	_mixer->stopAll();
 	_skySound->playSound(1, (uint16)(cmdPtr[2] & 0x7F));
 	cmdPtr += 3;
 }

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- logic.cpp	1 Jun 2003 00:47:57 -0000	1.69
+++ logic.cpp	1 Jun 2003 03:44:07 -0000	1.70
@@ -2073,7 +2073,8 @@
 	target->grafixProg = animPtr;
 
 	if (SkyState::isCDVersion(_gameVersion))
-		warning("stdSpeak: speech not implemented yet");
+		_skySound->fnStartSpeech((uint16)textNum);
+//		warning("stdSpeak: speech not implemented yet");
 
 	//now form the text sprite
 	struct lowTextManager_t textInfo;

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- sky.cpp	29 May 2003 21:45:26 -0000	1.46
+++ sky.cpp	1 Jun 2003 03:44:07 -0000	1.47
@@ -140,10 +140,12 @@
 	if (!isDemo(_gameVersion) || isCDVersion(_gameVersion))
 		intro();
 
+	_skyDisk->flushPrefetched();
+
 	loadBase0();
 
 	while (1) {
-		delay(100);
+		delay(50);
 		_skyLogic->engine();
 		_skyScreen->recreate();
 		_skyScreen->spriteEngine();

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- sound.cpp	30 May 2003 13:08:13 -0000	1.9
+++ sound.cpp	1 Jun 2003 03:44:07 -0000	1.10
@@ -49,6 +49,17 @@
 #pragma END_PACK_STRUCTS
 #endif
 
+uint16 SkySound::_speechConvertTable[8] = {
+	0,									//;Text numbers to file numbers
+	600,								//; 553 lines in section 0
+	600+500,							//; 488 lines in section 1
+	600+500+1330,						//;1303 lines in section 2
+	600+500+1330+950,					//; 922 lines in section 3
+	600+500+1330+950+1150,				//;1140 lines in section 4
+	600+500+1330+950+1150+550,			//; 531 lines in section 5
+	600+500+1330+950+1150+550+150,		//; 150 lines in section 6
+};
+
 
 static Sfx fx_null = {
 	0,
@@ -1076,7 +1087,8 @@
 	if (dataSize == dataLoop)
 		flags |= SoundMixer::FLAG_LOOP;
 	
-	_mixer->stopAll();
+	//_mixer->stopAll();
+	if (_ingameSound > 0) _mixer->stop(_ingameSound - 1);
 	_mixer->setVolume(volume);
 	_mixer->playRaw(&_ingameSound, _soundData + dataOfs, dataSize, sampleRate, flags);
 }
@@ -1123,3 +1135,24 @@
 	return true;
 }
 
+void SkySound::fnStartSpeech(uint16 textNum) {
+    
+	uint16 speechFileNum = _speechConvertTable[textNum >> 12] + (textNum & 0xFFF);
+	
+	uint8 *speechData = _skyDisk->loadFile(speechFileNum + 50000, NULL);
+	if (!speechData) {
+		error("File %d (speechFile %d from section %d) wasn't found!\n", speechFileNum + 50000, textNum & 0xFFF, textNum >> 12);
+	}
+
+	uint32 speechSize = ((dataFileHeader*)speechData)->s_tot_size;
+	uint8 *playBuffer = (uint8*)malloc(speechSize);
+	memcpy(playBuffer, speechData + sizeof(dataFileHeader), speechSize);
+
+	free(speechData);
+	_skyDisk->flushPrefetched();
+
+    // TODO: implement pre_after_table_area to find and prefetch file for next speech
+	
+	_mixer->playRaw(&_ingameSpeech, playBuffer, speechSize - 64, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+    
+}
\ No newline at end of file

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sound.h	30 May 2003 11:07:30 -0000	1.5
+++ sound.h	1 Jun 2003 03:44:07 -0000	1.6
@@ -35,7 +35,7 @@
 	PlayingSoundHandle _voiceHandle;
 	PlayingSoundHandle _effectHandle;
 	PlayingSoundHandle _bgSoundHandle;
-	PlayingSoundHandle _ingameSound;
+	PlayingSoundHandle _ingameSound, _ingameSpeech;
 
 protected:
 
@@ -50,6 +50,7 @@
 	void loadSection(uint8 pSection);
 	void playSound(uint16 sound, uint16 volume);
 	bool fnStartFx(uint32 sound);
+	void fnStartSpeech(uint16 textNum);
 
 private:
 	SkyDisk *_skyDisk;
@@ -57,6 +58,8 @@
 	uint16 _sfxBaseOfs;
 	uint8 *_soundData;
 	uint8 *_sampleRates, *_sfxInfo;
+
+	static uint16 _speechConvertTable[8];
 };
 
 #endif





More information about the Scummvm-git-logs mailing list