diff options
| -rw-r--r-- | engines/access/access.cpp | 6 | ||||
| -rw-r--r-- | engines/access/access.h | 9 | ||||
| -rw-r--r-- | engines/access/amazon/amazon_game.cpp | 2 | ||||
| -rw-r--r-- | engines/access/detection_tables.h | 5 | ||||
| -rw-r--r-- | engines/access/files.cpp | 111 | ||||
| -rw-r--r-- | engines/access/files.h | 76 | ||||
| -rw-r--r-- | engines/access/module.mk | 2 | ||||
| -rw-r--r-- | engines/access/resources.cpp | 25 | ||||
| -rw-r--r-- | engines/access/resources.h | 2 | ||||
| -rw-r--r-- | engines/access/sound.cpp | 29 | ||||
| -rw-r--r-- | engines/access/sound.h | 43 | 
11 files changed, 305 insertions, 5 deletions
| diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 3acd4c530a..25d9fcc99e 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -33,15 +33,19 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)  		_gameDescription(gameDesc), Engine(syst), _randomSource("Access") {  	_debugger = nullptr;  	_events = nullptr; +	_files = nullptr;  	_graphics = nullptr;  	_screen = nullptr; +	_sound = nullptr;  }  AccessEngine::~AccessEngine() {  	delete _debugger;  	delete _events; +	delete _files;  	delete _graphics;  	delete _screen; +	delete _sound;  }  void AccessEngine::initialize() { @@ -52,8 +56,10 @@ void AccessEngine::initialize() {  	_debugger = new Debugger(this);  	_events = new EventsManager(this); +	_files = new FileManager(this);  	_graphics = new GraphicsManager(this);  	_screen = new Screen(this); +	_sound = new SoundManager(this);  }  Common::Error AccessEngine::run() { diff --git a/engines/access/access.h b/engines/access/access.h index 4676d73d1d..3386cd9e11 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -32,8 +32,10 @@  #include "graphics/surface.h"  #include "access/debugger.h"  #include "access/events.h" +#include "access/files.h"  #include "access/graphics.h"  #include "access/screen.h" +#include "access/sound.h"  /**   * This is the namespace of the Access engine. @@ -49,6 +51,11 @@ namespace Access {  #define DEBUG_INTERMEDIATE 2  #define DEBUG_DETAILED 3 +enum { +	GType_Amazon = 1, +	GType_MeanStreets = 2 +}; +  enum AccessDebugChannels {  	kDebugPath      = 1 << 0,  	kDebugScripts	= 1 << 1, @@ -86,8 +93,10 @@ protected:  public:  	Debugger *_debugger;  	EventsManager *_events; +	FileManager *_files;  	GraphicsManager *_graphics;  	Screen *_screen; +	SoundManager *_sound;  public:  	AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc);  	virtual ~AccessEngine(); diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 37441411d6..53ddde9f68 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -35,6 +35,8 @@ void AmazonEngine::doTitle() {  	_screen->forceFadeOut();  	_events->hideCursor(); +	_sound->loadSound(98, 30); +  }  } // End of namespace Amazon diff --git a/engines/access/detection_tables.h b/engines/access/detection_tables.h index 90304290f1..cbef1d3b63 100644 --- a/engines/access/detection_tables.h +++ b/engines/access/detection_tables.h @@ -22,11 +22,6 @@  namespace Access { -enum { -	GType_Amazon = 1, -	GType_MeanStreets = 2 -}; -  static const AccessGameDescription gameDescriptions[] = {  	{  		// Amazon Guadians of Eden - Floppy English diff --git a/engines/access/files.cpp b/engines/access/files.cpp new file mode 100644 index 0000000000..7da7574df2 --- /dev/null +++ b/engines/access/files.cpp @@ -0,0 +1,111 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, 0xwhose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, 0xor (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, 0xwrite to the Free Software + * Foundation, 0xInc., 0x51 Franklin Street, 0xFifth Floor, 0xBoston, 0xMA 02110-1301, 0xUSA. + * + */ + +#include "access/files.h" +#include "access/resources.h" +#include "access/access.h" + +namespace Access { + +FileManager::FileManager(AccessEngine *vm): _vm(vm) { +	switch (vm->getGameID()) { +	case GType_Amazon: +		_filenames = &Amazon::FILENAMES[0]; +		break; +	default: +		error("Unknown game"); +	} + +	_fileNumber = -1; +	_stream = nullptr; +} + +FileManager::~FileManager() { +	delete _stream; +	_file.close(); +} + +void FileManager::loadFile(int fileNum, int subfile) { +	setAppended(fileNum); +	gotoAppended(subfile); + +	handleFile(); +} + +void FileManager::loadFile(const Common::String &filename) { +	// Open up the file +	_fileNumber = -1; +	_file.close(); +	if (_file.open(filename)) +		error("Could not open file - %s", filename.c_str()); + +	// Get a stream for the entire file +	delete _stream; +	_stream = _file.readStream(_file.size()); + +	handleFile(); +} + +void FileManager::handleFile() { +	char header[3]; +	_stream->read(&header[0], 3); + +	if (!strncmp(header, "BDE", 3)) +		// Decompress the resource +		decompressFile(); +	else +		// Not compressed, so move back to start of data +		_stream->seek(0); +} + +void FileManager::decompressFile() { +	// TODO +} + +void FileManager::setAppended(int fileNum) { +	if (_fileNumber != fileNum) { +		_fileNumber = fileNum; + +		_file.close(); +		if (!_file.open(_filenames[fileNum])) +			error("Could not open file %s", _filenames[fileNum]); + +		// Read in the file index +		_fileIndex.resize(50); +		for (int i = 0; i < 50; ++i) { +			_fileIndex[i]._offset = _file.readUint32LE(); +			_fileIndex[i]._nextOffset = _file.readUint32LE(); +		} +	} +} + +void FileManager::gotoAppended(int subfile) { +	uint32 offset = _fileIndex[subfile]._offset; +	uint32 size = _fileIndex[subfile]._nextOffset - offset; + +	_file.seek(offset); +	delete _stream; +	_stream = _file.readStream(size); +} + + +} // End of namespace Access diff --git a/engines/access/files.h b/engines/access/files.h new file mode 100644 index 0000000000..fcd24808a3 --- /dev/null +++ b/engines/access/files.h @@ -0,0 +1,76 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef ACCESS_FILES_H +#define ACCESS_FILES_H + +#include "common/scummsys.h" +#include "common/file.h" + +namespace Access { + +class AccessEngine; + +struct FileEntry { +	uint32 _offset; +	uint32 _nextOffset; +}; + +class FileManager { +private: +	AccessEngine *_vm; +	const char * const *_filenames; + +	void handleFile(); + +	void decompressFile(); + +public: +	int _fileNumber; +	Common::File _file; +	Common::SeekableReadStream *_stream; +	Common::Array<FileEntry> _fileIndex; +	uint32 _entryOffset; +	uint32 _nextOffset; +public: +	FileManager(AccessEngine *vm); +	~FileManager(); + +	void loadFile(int fileNum, int subfile); + +	void loadFile(const Common::String &filename); + +	/** +	 * Open up a sub-file container file +	 */ +	void setAppended(int fileNum); + + +	/** +	 * Open up a sub-file resource within an alrady opened container file. +	 */ +	void gotoAppended(int subfile); +}; + +} // End of namespace Access + +#endif /* ACCESS_FILES_H */ diff --git a/engines/access/module.mk b/engines/access/module.mk index a4fb8646ba..7e23ede512 100644 --- a/engines/access/module.mk +++ b/engines/access/module.mk @@ -5,9 +5,11 @@ MODULE_OBJS := \  	debugger.o \  	detection.o \  	events.o \ +	files.o \  	graphics.o \  	resources.o \  	screen.o \ +	sound.o \  	amazon\amazon_game.o  # This module can be built as a plugin diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp index cf8b491900..a47abf2b06 100644 --- a/engines/access/resources.cpp +++ b/engines/access/resources.cpp @@ -21,6 +21,7 @@   */  #include "access/resources.h" +#include "access/access.h"  namespace Access { @@ -47,6 +48,30 @@ const byte INITIAL_PALETTE[18 * 3] = {  namespace Amazon { +const char *const FILENAMES[] = { +	"S00.AP", "S01.AP", "S02.AP", "R03.AP", "S04.AP", "S05.AP", +	"S06.AP", "S07.AP", "S08.AP", "S09.AP", "S10.AP", "S11.AP", +	"S12.AP", "S13.AP", "S14.AP", "S15.AP", "S16.AP", "S17.AP", +	"S18.AP", "S19.AP", "S20.AP", "S21.AP", "S22.AP", "S23.AP", +	"S24.AP", "S25.AP", "S26.AP", "S27.AP", "S28.AP", "S29.AP", +	"S30.AP", "S31.AP", "S32.AP", "S33.AP", "S34.AP", "R35.AP", +	"S36.AP", "S37.AP", "S38.AP", "S39.AP", "S40.AP", "C26.AP", +	"S42.AP", "S01.AP", "S44.AP", "S45.AP", "S46.AP", "S47.AP", +	"C36.AP", nullptr,  "S50.AP", nullptr,  nullptr,  "S53.AP", +	"S54.AP", "S55.AP", "C35.AP", "S57.AP", "S58.AP", nullptr, +	nullptr,  "S61.AP", nullptr,  nullptr,  "S64.AP", "C00.AP", +	"C01.AP", "C06.AP", "C07.AP", "C08.AP", "C05.AP", "C09.AP", +	"C12.AP", "C03.AP", "C13.AP", "C15.AP", "C14.AP", "C16.AP", +	"C17.AP", "C19.AP", "C20.AP", "C21.AP", "C22.AP", "C23.AP", +	"C24.AP", "C25.AP", "C29.AP", "C30.AP", "C32.AP", "C33.AP", +	"C34.AP", "CREDITS.AP", "MIDIDRV.AP", "SUMMARY.AP", "DEAD.AP", +	"EST.AP", "CHAPTER.AP", "MIDI.AP", "SOUND.AP", "INV.AP", +	"NARATE01.AP", "NARATE02.AP", "NARATE03.AP", "NARATE04.AP", +	"NARATE05.AP", "NARATE06.AP", "NARATE07.AP", "NARATE08.AP", +	"NARATE09.AP", "NARATE10.AP", "NARATE11.AP", "NARATE12.AP", +	"NARATE13.AP", "NARATE14.AP" +}; +  const byte *CURSORS[10] = {  	MOUSE0, MOUSE1, MOUSE2, MOUSE3, CURSEYE, CURSHAND, CURSGET, CURSCLIMB, CURSTALK, CURSHELP  }; diff --git a/engines/access/resources.h b/engines/access/resources.h index 7bd2354c06..ba335cd0ec 100644 --- a/engines/access/resources.h +++ b/engines/access/resources.h @@ -31,6 +31,8 @@ extern const byte INITIAL_PALETTE[18 * 3];  namespace Amazon { +extern const char *const FILENAMES[]; +  extern const byte MOUSE0[];  extern const byte MOUSE1[];  extern const byte MOUSE2[]; diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp new file mode 100644 index 0000000000..d04d915cc9 --- /dev/null +++ b/engines/access/sound.cpp @@ -0,0 +1,29 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "access/sound.h" + +namespace Access { + +SoundManager::SoundManager(AccessEngine *vm) : _vm(vm) {} + +} // End of namespace Access diff --git a/engines/access/sound.h b/engines/access/sound.h new file mode 100644 index 0000000000..e35e64795d --- /dev/null +++ b/engines/access/sound.h @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef ACCESS_SOUND_H +#define ACCESS_SOUND_H + +namespace Access { + +class AccessEngine; + +class SoundManager { +private: +	AccessEngine *_vm; +public: +	int _soundPriority; +public: +	SoundManager(AccessEngine *vm); + +	void loadSound(int fileNum, int subfile) {} +}; + +} // End of namespace Access + +#endif /* ACCESS_SOUND_H*/ | 
