diff options
| -rw-r--r-- | engines/access/access.cpp | 11 | ||||
| -rw-r--r-- | engines/access/access.h | 5 | ||||
| -rw-r--r-- | engines/access/amazon/amazon_game.cpp | 158 | ||||
| -rw-r--r-- | engines/access/amazon/amazon_game.h | 6 | ||||
| -rw-r--r-- | engines/access/amazon/amazon_resources.cpp | 38 | ||||
| -rw-r--r-- | engines/access/amazon/amazon_resources.h | 6 | ||||
| -rw-r--r-- | engines/access/amazon/amazon_scripts.cpp | 7 | ||||
| -rw-r--r-- | engines/access/amazon/amazon_scripts.h | 2 | ||||
| -rw-r--r-- | engines/access/files.cpp | 2 | ||||
| -rw-r--r-- | engines/access/files.h | 3 | ||||
| -rw-r--r-- | engines/access/scripts.h | 3 | ||||
| -rw-r--r-- | engines/access/video.cpp | 2 | ||||
| -rw-r--r-- | engines/access/video.h | 2 | 
13 files changed, 235 insertions, 10 deletions
| diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 051884c704..1e3e3a7754 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -432,6 +432,17 @@ void AccessEngine::copyBF2Vid() {  	}  } +void AccessEngine::playVideo(int fileNum, const Common::Point &pt) { +	_video->setVideo(_screen, pt, FileIdent(fileNum, 96), 10); + +	while (!shouldQuit() && !_video->_videoEnd) { +		_video->playVideo(); + +		g_system->delayMillis(10); +		_events->pollEvents(); +	} +} +  void AccessEngine::doLoadSave() {  	error("TODO: doLoadSave");  } diff --git a/engines/access/access.h b/engines/access/access.h index bec1dacb4c..a12a63212d 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -119,6 +119,11 @@ protected:  	*/  	Common::String AccessEngine::generateSaveName(int slot); +	/** +	 * Play back an entire video +	 */ +	void playVideo(int fileNum, const Common::Point &pt); +  	// Engine APIs  	virtual Common::Error run();  	virtual bool hasFeature(EngineFeature f) const; diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 187b38c497..3af07edaf3 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -55,11 +55,13 @@ AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc)  	_rawInactiveY = 0;  	_inactiveYOff = 0;  	_tilePos = Common::Point(0, 0); +	_hintLevel = 0;  	Common::fill(&_esTabTable[0], &_esTabTable[100], 0);  	memset(_tileData, 0, sizeof(_tileData)); +	 +	_chapterCells.push_back(CellIdent(0, 96, 17)); -	_hintLevel = 0;  }  AmazonEngine::~AmazonEngine() { @@ -380,6 +382,160 @@ void AmazonEngine::drawHelp() {  	error("TODO: drawHelp");  } +void AmazonEngine::startChapter(int chapter) { +	_chapter = chapter; +	assert(_chapter <= 14); + +	if (chapter != 1) { +		_room->clearRoom(); +		freeChar(); +		 +		_sound->newMusic(32, 0); +		playVideo(0, Common::Point()); +		if (shouldQuit()) +			return; + +		_events->debounceLeft(); +		_events->zeroKeys(); +		playVideo(_chapter, Common::Point(4, 113)); +		if (shouldQuit()) +			return; + +		_timers[20]._timer = 500; +		_timers[20]._initTm = 500; +		_timers[20]._flag++; + +		_sound->_soundTable[0] = _sound->loadSound(115, 0); +		_sound->_soundPriority[0] = 1; +		_sound->playSound(0); +		_sound->freeSounds(); + +		_sound->_soundTable[0] = _sound->loadSound(115, 1); +		_sound->_soundPriority[0] = 1; +		_sound->playSound(0); +		_sound->freeSounds(); + +		// Wait loop +		while (!shouldQuit() && !_events->_leftButton && !_events->_rightButton +				&& _events->_keypresses.size() == 0 && _timers[20]._flag) { +			_events->pollEvents(); +			g_system->delayMillis(10); +		} +	} + +	_screen->forceFadeOut(); +	_events->debounceLeft(); +	_events->zeroKeys(); +	_screen->clearScreen(); + +	_screen->setPanel(3); +	 +	// Set up cells for the chapter display +	Common::Array<CellIdent> chapterCells; +	chapterCells.push_back(CellIdent(0, 96, 17)); +	const int *chapCell = &CHAPTER_CELLS[_chapter - 1][0]; +	chapterCells.push_back(CellIdent(chapCell[0], chapCell[1], chapCell[2])); +	loadCells(chapterCells); + +	// Show chapter screen +	_files->loadScreen(96, 15); +	_buffer2.copyFrom(*_screen); + +	const int *chapImg = &CHAPTER_TABLE[_chapter - 1][0]; +	_screen->plotImage(_objectsTable[0], _chapter - 1,  +		Common::Point(chapImg[1], chapImg[2])); +	_screen->plotImage(_objectsTable[_chapter - 1], 0, +		Common::Point(chapImg[3], chapImg[4])); +	if (chapter == 14) +		_screen->plotImage(_objectsTable[_chapter - 1], 1, Common::Point(169, 76)); + +	_sound->newMusic(chapImg[4], 1); +	_sound->newMusic(33, 0); +	_screen->forceFadeIn(); + +	_timers[20]._timer = 950; +	_timers[20]._initTm = 950; +	_timers[20]._flag++; + +	// Wait loop +	while (!shouldQuit() && !_events->_leftButton && !_events->_rightButton +		&& _events->_keypresses.size() == 0 && _timers[20]._flag) { +		_events->pollEvents(); +		g_system->delayMillis(10); +	} +	if (shouldQuit()) +		return; + +	_screen->forceFadeOut(); +	_events->debounceLeft(); +	_events->zeroKeys(); +	 +	_screen->clearBuffer(); +	_files->loadScreen(96, 16); +	_buffer2.copyFrom(*_screen); +	_screen->plotImage(_objectsTable[0], chapImg[0], Common::Point(90, 7)); + +	_sound->newMusic(7, 1); +	_sound->newMusic(34, 0); + +	_screen->forceFadeIn(); +	_buffer2.copyFrom(*_screen); + +	_fonts._charSet._lo = 1; +	_fonts._charSet._hi = 10; +	_fonts._charFor._lo = 55; +	_fonts._charFor._hi = 0xFF; +	_screen->_printOrg = Common::Point(31, 77); +	_screen->_printStart = Common::Point(31, 77); + +	_establishGroup = 1; +	loadEstablish(0x40 + _chapter); +	uint16 msgOffset = READ_LE_UINT16(_eseg->data() + (_chapter * 2) + 2); +	_printEnd = 170; + +	_printEnd = 155; +	Common::String msg((const char *)_eseg->data() + msgOffset); + +	if (_txtPages == 0) { +		printText(_screen, msg); +	} else { +		speakText(_screen, msg); +	} +	if (shouldQuit()) +		return; + +	_screen->forceFadeOut(); +	_screen->clearBuffer(); +	freeCells(); +	 +	_sound->newMusic(_chapter * 2, 1); + +	if (chapter != 1 && chapter != 14) { +		_room->init4Quads(); +	} + +	if (chapter == 14) { +		_conversation = 31; +		_char->loadChar(_conversation); +		_events->setCursor(CURSOR_ARROW); + +		_images.clear(); +		_oldRects.clear(); +		_scripts->_sequence = 0; +		_scripts->searchForSequence(); + +		if (_screen->_vesaMode) { +			_converseMode = 1; +		} +	} else if (chapter != 1) { +		_player->_roomNumber = CHAPTER_JUMP[_chapter - 1]; +		_room->_function = 1; +		_converseMode = 0; + +		_scripts->cmdRetPos(); +	} +} +  void AmazonEngine::synchronize(Common::Serializer &s) {  	AccessEngine::synchronize(s); diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h index 0275ceec17..2dc0c058fb 100644 --- a/engines/access/amazon/amazon_game.h +++ b/engines/access/amazon/amazon_game.h @@ -70,6 +70,7 @@ private:  	// Other fields  	Common::Point _tilePos;  	byte _tileData[1455]; +	Common::Array<CellIdent> _chapterCells;  	/**  	 * Do the game introduction @@ -161,6 +162,11 @@ public:  	void tileScreen();  	void updateSummary(int chap); + +	/** +	 * Show the start of a chapter +	 */ +	void startChapter(int chapter);  };  } // End of namespace Amazon diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp index a51457522e..05af0c116b 100644 --- a/engines/access/amazon/amazon_resources.cpp +++ b/engines/access/amazon/amazon_resources.cpp @@ -1314,6 +1314,44 @@ const int DEATH_CELLS[12][3] = {  	{ 0, 94, 14 }  }; +const int CHAPTER_CELLS[17][3] = { +	{ 1, 96, 18 }, +	{ 2, 96, 19 }, +	{ 3, 96, 20 }, +	{ 4, 96, 21 }, +	{ 5, 96, 22 }, +	{ 6, 96, 23 }, +	{ 7, 96, 24 }, +	{ 8, 96, 25 }, +	{ 9, 96, 26 }, +	{ 10, 96, 27 }, +	{ 11, 96, 28 }, +	{ 12, 96, 29 }, +	{ 13, 96, 30 }, +	{ 14, 96, 31 } +}; + +const int CHAPTER_TABLE[14][5] = { +	{ 18, 136, 27, 76, 49 }, +	{ 16, 134, 27, 53, 74 }, +	{ 16, 136, 27, 52, 56 }, +	{ 16, 135, 26, 46, 75 }, +	{ 16, 135, 27, 54, 66 }, +	{ 16, 137, 27, 67, 79 }, +	{ 14, 136, 27, 82, 52 }, +	{ 15, 136, 26, 65, 73 }, +	{ 15, 137, 26, 48, 75 }, +	{ 17, 135, 27, 52, 66 }, +	{ 15, 135, 27, 62, 65 }, +	{ 16, 135, 28, 45, 66 }, +	{ 16, 135, 28, 36, 67 }, +	{ 15, 135, 27, 34, 63 } +}; + +const int CHAPTER_JUMP[14] = { +	0, 12, 10, 15, 19, 25, 31, 36, 45, 46, 29, 55, 61, 0 +}; +  } // End of namespace Amazon  } // End of namespace Access diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h index 17cca2a0b4..d8d37b5a5f 100644 --- a/engines/access/amazon/amazon_resources.h +++ b/engines/access/amazon/amazon_resources.h @@ -58,6 +58,12 @@ extern const char *const DEATH_TEXT[58];  extern const int DEATH_CELLS[12][3]; +extern const int CHAPTER_CELLS[17][3]; + +extern const int CHAPTER_TABLE[14][5]; + +extern const int CHAPTER_JUMP[14]; +  } // End of namespace Amazon  } // End of namespace Access diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index a932dad216..7ad68bd5bc 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -414,7 +414,7 @@ typedef void(AmazonScripts::*AmazonScriptMethodPtr)();  void AmazonScripts::executeCommand(int commandIndex) {  	static const AmazonScriptMethodPtr COMMAND_LIST[] = {  		&AmazonScripts::cmdHelp, &AmazonScripts::CMDCYCLEBACK, -		&AmazonScripts::CMDCHAPTER, &AmazonScripts::cmdSetHelp, +		&AmazonScripts::cmdChapter, &AmazonScripts::cmdSetHelp,  		&AmazonScripts::cmdCenterPanel, &AmazonScripts::cmdMainPanel,  		&AmazonScripts::CMDRETFLASH  	}; @@ -452,8 +452,9 @@ void AmazonScripts::cmdHelp() {  void AmazonScripts::CMDCYCLEBACK() {   	error("TODO CMDCYCLEBACK");   } -void AmazonScripts::CMDCHAPTER() {  -	error("TODO CMDCHAPTER");  +void AmazonScripts::cmdChapter() { +	int chapter = _data->readByte(); +	_game->startChapter(chapter);  }  void AmazonScripts::cmdSetHelp() { diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h index 50bd2ac9b1..edb8843da3 100644 --- a/engines/access/amazon/amazon_scripts.h +++ b/engines/access/amazon/amazon_scripts.h @@ -53,7 +53,7 @@ protected:  	void cmdHelp();  	void CMDCYCLEBACK(); -	void CMDCHAPTER(); +	void cmdChapter();  	void cmdSetHelp();  	void cmdCenterPanel();  	void cmdMainPanel(); diff --git a/engines/access/files.cpp b/engines/access/files.cpp index d8823c0510..a4ec16ad61 100644 --- a/engines/access/files.cpp +++ b/engines/access/files.cpp @@ -101,7 +101,7 @@ Resource *FileManager::loadFile(int fileNum, int subfile) {  	return res;  } -Resource *FileManager::loadFile(FileIdent &fileIdent) { +Resource *FileManager::loadFile(const FileIdent &fileIdent) {  	return loadFile(fileIdent._fileNum, fileIdent._subfile);  } diff --git a/engines/access/files.h b/engines/access/files.h index a32ebbf88c..720d4fb2ba 100644 --- a/engines/access/files.h +++ b/engines/access/files.h @@ -38,6 +38,7 @@ struct FileIdent {  	int _subfile;  	FileIdent(); +	FileIdent(int fileNum, int subfile) { _fileNum = fileNum; _subfile = subfile; }  	void load(Common::SeekableReadStream &s);  }; @@ -112,7 +113,7 @@ public:  	/**  	 * Loads a resource specified by a file identifier  	 */ -	Resource *loadFile(FileIdent &fileIdent); +	Resource *loadFile(const FileIdent &fileIdent);  	/**  	 * Load a given file by name diff --git a/engines/access/scripts.h b/engines/access/scripts.h index 003f441234..e6faa46dde 100644 --- a/engines/access/scripts.h +++ b/engines/access/scripts.h @@ -66,7 +66,6 @@ protected:  	void cmdJumpTalk();  	void cmdNull();  	void cmdPrint(); -	void cmdRetPos();  	void cmdAnim();  	void cmdSetFlag();  	void cmdCheckFlag(); @@ -145,7 +144,9 @@ public:  	void findNull(); +	// Script commands that need to be public  	void cmdFreeSound(); +	void cmdRetPos();  };  } // End of namespace Access diff --git a/engines/access/video.cpp b/engines/access/video.cpp index 4b9a875931..b46bdf240f 100644 --- a/engines/access/video.cpp +++ b/engines/access/video.cpp @@ -38,7 +38,7 @@ VideoPlayer::~VideoPlayer() {  } -void VideoPlayer::setVideo(ASurface *vidSurface, const Common::Point &pt, FileIdent &videoFile, int rate) { +void VideoPlayer::setVideo(ASurface *vidSurface, const Common::Point &pt, const FileIdent &videoFile, int rate) {  	_vidSurface = vidSurface;  	vidSurface->_orgX1 = pt.x;  	vidSurface->_orgY1 = pt.y; diff --git a/engines/access/video.h b/engines/access/video.h index bb9656b296..b49c876a07 100644 --- a/engines/access/video.h +++ b/engines/access/video.h @@ -62,7 +62,7 @@ public:  	/**  	 * Start up a video  	 */ -	void setVideo(ASurface *vidSurface, const Common::Point &pt, FileIdent &videoFile, int rate); +	void setVideo(ASurface *vidSurface, const Common::Point &pt, const FileIdent &videoFile, int rate);  	/**  	 * Decodes a frame of the video | 
