diff options
Diffstat (limited to 'sword1')
| -rw-r--r-- | sword1/control.cpp | 2 | ||||
| -rw-r--r-- | sword1/logic.cpp | 9 | ||||
| -rw-r--r-- | sword1/sound.cpp | 6 | ||||
| -rw-r--r-- | sword1/sword1.cpp | 1 | 
4 files changed, 17 insertions, 1 deletions
diff --git a/sword1/control.cpp b/sword1/control.cpp index eddb799e2f..5d71435f1b 100644 --- a/sword1/control.cpp +++ b/sword1/control.cpp @@ -981,6 +981,8 @@ void Control::doRestore(void) {  	Logic::_scriptVars[CHANGE_STANCE] = STAND;  	Logic::_scriptVars[CHANGE_PLACE] = cpt->o_place;  	SwordEngine::_systemVars.justRestoredGame = 1; +	if (SwordEngine::_systemVars.isDemo) +		Logic::_scriptVars[PLAYINGDEMO] = 1;  }  void Control::delay(uint32 msecs) { diff --git a/sword1/logic.cpp b/sword1/logic.cpp index 8c4095b215..e536986ff6 100644 --- a/sword1/logic.cpp +++ b/sword1/logic.cpp @@ -37,6 +37,8 @@  #include "sword1/debug.h" +#include "gui/message.h" +  namespace Sword1 {  #define MAX_STACK_SIZE 10 @@ -1630,7 +1632,12 @@ int Logic::fnRestartGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32  }  int Logic::fnQuitGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) { -	error("fnQuitGame() called"); +	if (SwordEngine::_systemVars.isDemo) { +		GUI::MessageDialog dialog("This is the end of the Broken Sword 1 Demo", "OK", NULL); +		dialog.runModal(); +		SwordEngine::_systemVars.engineQuit = true; +	} else +		error("fnQuitGame() called");  	return SCRIPT_STOP;  } diff --git a/sword1/sound.cpp b/sword1/sound.cpp index fde2a402cc..565ba9cc8f 100644 --- a/sword1/sound.cpp +++ b/sword1/sound.cpp @@ -61,6 +61,10 @@ int Sound::addToQueue(int32 fxNo) {  			warning("Sound queue overflow");  			return 0;  		} +		if ((fxNo == 168) && (SwordEngine::_systemVars.isDemo)) { +			// this sound doesn't exist in demo +			return 0; +		}  		_resMan->resOpen(_fxList[fxNo].sampleId);  		_fxQueue[_endOfQueue].id = fxNo;  		if (_fxList[fxNo].type == FX_SPOT) @@ -140,6 +144,8 @@ void Sound::quitScreen(void) {  }  void Sound::playSample(QueueElement *elem) { +	//if (((elem->id == 11) || (elem->id == 12) || (elem->id == 224)) && SwordEngine::_systemVars.isDemo) +	//	return;  	uint8 *sampleData = (uint8*)_resMan->fetchRes(_fxList[elem->id].sampleId);  	for (uint16 cnt = 0; cnt < MAX_ROOMS_PER_FX; cnt++) {  		if (_fxList[elem->id].roomVolList[cnt].roomNo) { diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp index f9cbb2115d..0b67ba75be 100644 --- a/sword1/sword1.cpp +++ b/sword1/sword1.cpp @@ -1116,6 +1116,7 @@ void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or  	} else { // speech1 & speech2 not present. are we running from cd?  		if (test.open("cows.mad")) {  			_systemVars.isDemo = true; +			Logic::_scriptVars[PLAYINGDEMO] = 1;  			test.close();  		}  		if (test.open("cd1.id")) {  | 
