diff options
| author | Travis Howell | 2006-09-29 00:50:22 +0000 | 
|---|---|---|
| committer | Travis Howell | 2006-09-29 00:50:22 +0000 | 
| commit | 11c9537e290fbab5d604037609fb40c70149b283 (patch) | |
| tree | 40fd9654e690a2e690ca786f8a407224ca7a706a | |
| parent | 1c6cd9d2498e7d905aed1930ad2cde006a4b1f20 (diff) | |
| download | scummvm-rg350-11c9537e290fbab5d604037609fb40c70149b283.tar.gz scummvm-rg350-11c9537e290fbab5d604037609fb40c70149b283.tar.bz2 scummvm-rg350-11c9537e290fbab5d604037609fb40c70149b283.zip | |
Add speech support for PP and cleanup
svn-id: r23995
| -rw-r--r-- | engines/simon/items.cpp | 49 | ||||
| -rw-r--r-- | engines/simon/simon.cpp | 27 | ||||
| -rw-r--r-- | engines/simon/simon.h | 8 | ||||
| -rw-r--r-- | engines/simon/sound.cpp | 11 | ||||
| -rw-r--r-- | engines/simon/string.cpp | 2 | ||||
| -rw-r--r-- | engines/simon/vga.cpp | 4 | 
6 files changed, 58 insertions, 43 deletions
| diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp index e5ff31c5ee..07d4479790 100644 --- a/engines/simon/items.cpp +++ b/engines/simon/items.cpp @@ -453,6 +453,14 @@ void SimonEngine::setupOpcodes() {  		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; @@ -468,10 +476,8 @@ void SimonEngine::setupOpcodes() {  		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 @@ void SimonEngine::setupOpcodes() {  		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_let() {  void SimonEngine::o_add() {  	// 43: add -	uint var = getVarOrByte(); +	uint var = getVarWrapper();  	writeVariable(var, readVariable(var) + getVarOrWord());  } @@ -761,13 +764,7 @@ void SimonEngine::o_random() {  	// 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 @@ void SimonEngine::o_setShortText() {  	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 @@ void SimonEngine::o_setLongText() {  	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 @@ void SimonEngine::o_screenTextMsg() {  		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 @@ void SimonEngine::o_scnTxtLongText() {  	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::oww_ifDoorOpen() {  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::o1_specialFade() {  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 @@ void SimonEngine::o2_isShortText() {  	// 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_addTextBox() {  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);  } diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index 85a3bf5349..b41218325d 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -66,6 +66,11 @@ static const GameSpecificSettings feeblefiles_settings = {  	"",                                     // effects_filename  	"VOICES",                               // speech_filename  }; + +static const GameSpecificSettings puzzlepack_settings = { +	"",                                     // effects_filename +	"MUSIC",                               // speech_filename +};  #endif  SimonEngine::SimonEngine(OSystem *syst) @@ -309,9 +314,11 @@ SimonEngine::SimonEngine(OSystem *syst)  	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 @@ int SimonEngine::init() {  	_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 @@ int SimonEngine::init() {  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 @@ void SimonEngine::setup_cond_c_helper() {  				else  					id = _lastHitArea->flags / 256;  			} -			_variableArray[60] = id; +			if (getGameType() == GType_PP) +				_variableArray[199] = id; +			else +				_variableArray[60] = id;  			break;  		}  	} @@ -1176,7 +1186,10 @@ startOver:  					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; diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 01265404c8..dac1f8f046 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -404,9 +404,11 @@ protected:  	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]; diff --git a/engines/simon/sound.cpp b/engines/simon/sound.cpp index 894bbce2e0..36766da685 100644 --- a/engines/simon/sound.cpp +++ b/engines/simon/sound.cpp @@ -288,8 +288,7 @@ Sound::~Sound() {  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 @@ void Sound::loadVoiceFile(const GameSpecificSettings *gss) {  		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 @@ void Sound::playVoice(uint sound) {  		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); diff --git a/engines/simon/string.cpp b/engines/simon/string.cpp index 6975ea53d3..ba959759da 100644 --- a/engines/simon/string.cpp +++ b/engines/simon/string.cpp @@ -231,7 +231,7 @@ bool SimonEngine::printTextOf(uint a, uint x, uint y) {  		return false; -	stringPtr = getStringPtrByID(_stringIdArray2[a]); +	stringPtr = getStringPtrByID(_shortText[a]);  	if (getGameType() == GType_FF) {  		getPixelLength((const char *)stringPtr, 400, pixels);  		w = pixels + 1; diff --git a/engines/simon/vga.cpp b/engines/simon/vga.cpp index bcb9d9f341..6b0ef9a704 100644 --- a/engines/simon/vga.cpp +++ b/engines/simon/vga.cpp @@ -226,12 +226,12 @@ uint SimonEngine::vcReadNextByte() {  }  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;  } | 
