[Scummvm-cvs-logs] SF.net SVN: scummvm: [23995] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Fri Sep 29 02:50:30 CEST 2006


Revision: 23995
          http://svn.sourceforge.net/scummvm/?rev=23995&view=rev
Author:   kirben
Date:     2006-09-28 17:50:22 -0700 (Thu, 28 Sep 2006)

Log Message:
-----------
Add speech support for PP and cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/sound.cpp
    scummvm/trunk/engines/simon/string.cpp
    scummvm/trunk/engines/simon/vga.cpp

Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-09-28 23:22:07 UTC (rev 23994)
+++ scummvm/trunk/engines/simon/items.cpp	2006-09-29 00:50:22 UTC (rev 23995)
@@ -453,7 +453,15 @@
 		opcode_table[38] = &SimonEngine::o4_opcode38;
 		opcode_table[105] = &SimonEngine::o4_loadHiScores;
 		opcode_table[106] = &SimonEngine::o4_checkHiScores;
+		opcode_table[166] = NULL;
+		opcode_table[167] = NULL;
+		opcode_table[168] = NULL;
+		opcode_table[169] = NULL;
 
+		// Code difference, check if triggered
+		opcode_table[132] = &SimonEngine::o3_saveUserGame,
+		opcode_table[187] = NULL;
+
 		// To check
 		opcode_table[23] = &SimonEngine::o3_chance;
 		opcode_table[37] = &SimonEngine::o3_jumpOut;
@@ -468,10 +476,8 @@
 		opcode_table[124] = &SimonEngine::o3_ifTime;
 		opcode_table[127] = &SimonEngine::o3_playTune;
 		opcode_table[131] = &SimonEngine::o3_setTime;
-		opcode_table[132] = &SimonEngine::o3_saveUserGame,
 		opcode_table[133] = &SimonEngine::o3_loadUserGame;
 		opcode_table[134] = &SimonEngine::o3_listSaveGames;
-		opcode_table[135] = &SimonEngine::o3_checkCD;
 		opcode_table[161] = &SimonEngine::o3_screenTextBox;
 		opcode_table[165] = &SimonEngine::o3_isAdjNoun;
 		opcode_table[171] = &SimonEngine::o3_hyperLinkOn;
@@ -479,9 +485,6 @@
 		opcode_table[173] = &SimonEngine::o3_checkPaths;
 		opcode_table[177] = &SimonEngine::o3_screenTextPObj;
 		opcode_table[181] = &SimonEngine::o3_mouseOff;
-		opcode_table[182] = &SimonEngine::o3_loadVideo;
-		opcode_table[183] = &SimonEngine::o3_playVideo;
-		opcode_table[187] = &SimonEngine::o3_centreScroll;
 		opcode_table[188] = &SimonEngine::o2_isShortText;
 		opcode_table[189] = &SimonEngine::o2_clearMarks;
 		opcode_table[190] = &SimonEngine::o2_waitMark;
@@ -687,7 +690,7 @@
 
 void SimonEngine::o_add() {
 	// 43: add
-	uint var = getVarOrByte();
+	uint var = getVarWrapper();
 	writeVariable(var, readVariable(var) + getVarOrWord());
 }
 
@@ -761,13 +764,7 @@
 	// 53: random
 	uint var = getVarWrapper();
 	uint value = (uint16)getVarOrWord();
-
-	// Disable random in simon1amiga for now
-	// Since copy protection screen is currently unreadable
-	if (getPlatform() == Common::kPlatformAmiga)
-		writeVariable(var, 4);
-	else
-		writeVariable(var, _rnd.getRandomNumber(value - 1));
+	writeVariable(var, _rnd.getRandomNumber(value - 1));
 }
 
 void SimonEngine::o_goto() {
@@ -859,10 +856,10 @@
 	uint var = getVarOrByte();
 	uint stringId = getNextStringID();
 	if (var < _numTextBoxes) {
-		_stringIdArray2[var] = stringId;
+		_shortText[var] = stringId;
 		if (getGameType() == GType_PP) {
-			getVarOrWord();
-			getVarOrWord();
+			_shortTextX[var] = getVarOrWord();
+			_shortTextY[var] = getVarOrWord();
 		}
 	}
 }
@@ -874,12 +871,12 @@
 	if (getFeatures() & GF_TALKIE) {
 		uint speechId = getNextWord();
 		if (var < _numTextBoxes) {
-			_stringIdArray3[var] = stringId;
-			_speechIdArray4[var] = speechId;
+			_longText[var] = stringId;
+			_longSound[var] = speechId;
 		}
 	} else {
 		if (var < _numTextBoxes) {
-			_stringIdArray3[var] = stringId;
+			_longText[var] = stringId;
 		}
 	}
 }
@@ -1447,7 +1444,7 @@
 		string_ptr = getStringPtrByID(stringId);
 
 	if (getFeatures() & GF_TALKIE) {
-		if (getGameType() == GType_FF)
+		if (getGameType() == GType_FF || getGameType() == GType_PP)
 			speechId = (uint16)getVarOrWord();
 		else
 			speechId = (uint16)getNextWord();
@@ -1607,9 +1604,9 @@
 	uint speechId = 0;
 	TextLocation *tl;
 
-	const char *string_ptr = (const char *)getStringPtrByID(_stringIdArray3[stringId]);
+	const char *string_ptr = (const char *)getStringPtrByID(_longText[stringId]);
 	if (getFeatures() & GF_TALKIE)
-		speechId = _speechIdArray4[stringId];
+		speechId = _longSound[stringId];
 
 	if (getGameType() == GType_FF)
 		vgaSpriteId = 1;
@@ -1685,7 +1682,7 @@
 
 void SimonEngine::o1_printLongText() {
 	// 70: show string from array
-	const char *str = (const char *)getStringPtrByID(_stringIdArray3[getVarOrByte()]);
+	const char *str = (const char *)getStringPtrByID(_longText[getVarOrByte()]);
 	showMessageFormat("%s\n", str);
 }
 
@@ -1834,7 +1831,7 @@
 
 void SimonEngine::o2_printLongText() {
 	// 70: show string from array
-	const char *str = (const char *)getStringPtrByID(_stringIdArray3[getVarOrByte()]);
+	const char *str = (const char *)getStringPtrByID(_longText[getVarOrByte()]);
 	writeVariable(51, strlen(str) / 53 * 8 + 8);
 	showMessageFormat("%s\n", str);
 }
@@ -1988,7 +1985,7 @@
 	// 188: string2 is
 	uint i = getVarOrByte();
 	uint str = getNextStringID();
-	setScriptCondition(str < _numTextBoxes && _stringIdArray2[i] == str);
+	setScriptCondition(str < _numTextBoxes && _shortText[i] == str);
 }
 
 void SimonEngine::o2_clearMarks() {
@@ -2057,7 +2054,7 @@
 void SimonEngine::o3_printLongText() {
 	// 70: show string from array
 	int num = getVarOrByte();
-	const char *str = (const char *)getStringPtrByID(_stringIdArray3[num]);
+	const char *str = (const char *)getStringPtrByID(_longText[num]);
 	sendInteractText(num, "%d. %s\n", num, str);
 }
 

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-09-28 23:22:07 UTC (rev 23994)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-09-29 00:50:22 UTC (rev 23995)
@@ -66,6 +66,11 @@
 	"",                                     // effects_filename
 	"VOICES",                               // speech_filename
 };
+
+static const GameSpecificSettings puzzlepack_settings = {
+	"",                                     // effects_filename
+	"MUSIC",                               // speech_filename
+};
 #endif
 
 SimonEngine::SimonEngine(OSystem *syst)
@@ -309,9 +314,11 @@
 	memset(_objectArray, 0, sizeof(_objectArray));
 	memset(_itemStore, 0, sizeof(_itemStore));
 
-	memset(_stringIdArray2, 0, sizeof(_stringIdArray2));
-	memset(_stringIdArray3, 0, sizeof(_stringIdArray3));
-	memset(_speechIdArray4, 0, sizeof(_speechIdArray4));
+	memset(_shortText, 0, sizeof(_shortText));
+	memset(_shortTextX, 0, sizeof(_shortText));
+	memset(_shortTextY, 0, sizeof(_shortText));
+	memset(_longText, 0, sizeof(_longText));
+	memset(_longSound, 0, sizeof(_longSound));
 
 	memset(_bitArray, 0, sizeof(_bitArray));
 	memset(_bitArrayTwo, 0, sizeof(_bitArrayTwo));
@@ -483,7 +490,7 @@
 	_language = Common::parseLanguage(ConfMan.get("language"));
 
 	if (getGameType() == GType_PP) {
-		_speech = false;
+		_speech = true;
 		_subtitles = false;
 	} else if (getFeatures() & GF_TALKIE) {
 		_speech = !ConfMan.getBool("speech_mute");
@@ -521,7 +528,7 @@
 
 void SimonEngine::setupGame() {
 	if (getGameType() == GType_PP) {
-		gss = PTR(feeblefiles_settings);
+		gss = PTR(puzzlepack_settings);
 		_numTextBoxes = 40;
 		_numVideoOpcodes = 85;
 #ifndef PALMOS_68K
@@ -1083,7 +1090,10 @@
 				else
 					id = _lastHitArea->flags / 256;
 			}
-			_variableArray[60] = id;
+			if (getGameType() == GType_PP)
+				_variableArray[199] = id;
+			else
+				_variableArray[60] = id;
 			break;
 		}
 	}
@@ -1176,7 +1186,10 @@
 					else
 						id = ha->flags / 256;
 				}
-				_variableArray[60] = id;
+				if (getGameType() == GType_PP)
+					_variableArray[199] = id;
+				else
+					_variableArray[60] = id;
 				displayName(ha);
 				if (_verbHitArea != 0)
 					break;

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-09-28 23:22:07 UTC (rev 23994)
+++ scummvm/trunk/engines/simon/simon.h	2006-09-29 00:50:22 UTC (rev 23995)
@@ -404,9 +404,11 @@
 	Item *_objectArray[20];
 	Item *_itemStore[20];
 
-	uint16 _stringIdArray2[40];
-	uint16 _stringIdArray3[40];
-	uint16 _speechIdArray4[40];
+	uint16 _shortText[40];
+	uint16 _shortTextX[40];
+	uint16 _shortTextY[40];
+	uint16 _longText[40];
+	uint16 _longSound[40];
 
 	uint16 _bitArray[128];
 	uint16 _bitArrayTwo[16];

Modified: scummvm/trunk/engines/simon/sound.cpp
===================================================================
--- scummvm/trunk/engines/simon/sound.cpp	2006-09-28 23:22:07 UTC (rev 23994)
+++ scummvm/trunk/engines/simon/sound.cpp	2006-09-29 00:50:22 UTC (rev 23995)
@@ -288,8 +288,7 @@
 
 void Sound::loadVoiceFile(const GameSpecificSettings *gss) {
 	// Game versions which use separate voice files
-	if (_vm->getGameType() == GType_FF || _vm->getGameType() == GType_PP ||
-		_vm->getGameId() == GID_SIMON1CD32)
+	if (_vm->getGameType() == GType_FF || _vm->getGameId() == GID_SIMON1CD32)
 		return;
 
 	char filename[16];
@@ -361,7 +360,10 @@
 		file->open(filename);
 		if (file->isOpen()) {
 			_hasVoiceFile = true;
-			_voice = new VocSound(_mixer, file);
+			if (_vm->getGameType() == GType_PP)
+				_voice = new WavSound(_mixer, file);
+			else
+				_voice = new VocSound(_mixer, file);
 		}
 	}
 }
@@ -482,7 +484,8 @@
 		return;
 
 	_mixer->stopHandle(_voiceHandle);
-	if (_vm->getGameType() == GType_FF || _vm->getGameId() == GID_SIMON1CD32) {
+	if (_vm->getGameType() == GType_FF || _vm->getGameType() == GType_PP ||
+		_vm->getGameId() == GID_SIMON1CD32) {
 		_voice->playSound(sound, &_voiceHandle, 0);
 	} else {
 		_voice->playSound(sound, &_voiceHandle, Audio::Mixer::FLAG_UNSIGNED);

Modified: scummvm/trunk/engines/simon/string.cpp
===================================================================
--- scummvm/trunk/engines/simon/string.cpp	2006-09-28 23:22:07 UTC (rev 23994)
+++ scummvm/trunk/engines/simon/string.cpp	2006-09-29 00:50:22 UTC (rev 23995)
@@ -231,7 +231,7 @@
 		return false;
 
 
-	stringPtr = getStringPtrByID(_stringIdArray2[a]);
+	stringPtr = getStringPtrByID(_shortText[a]);
 	if (getGameType() == GType_FF) {
 		getPixelLength((const char *)stringPtr, 400, pixels);
 		w = pixels + 1;

Modified: scummvm/trunk/engines/simon/vga.cpp
===================================================================
--- scummvm/trunk/engines/simon/vga.cpp	2006-09-28 23:22:07 UTC (rev 23994)
+++ scummvm/trunk/engines/simon/vga.cpp	2006-09-29 00:50:22 UTC (rev 23995)
@@ -226,12 +226,12 @@
 }
 
 uint SimonEngine::vcReadVar(uint var) {
-	assert(var < 255);
+	assert(var < _numVars);
 	return (uint16)_variableArrayPtr[var];
 }
 
 void SimonEngine::vcWriteVar(uint var, int16 value) {
-	assert(var < 255);
+	assert(var < _numVars);
 	_variableArrayPtr[var] = value;
 }
 


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