aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/access/access.cpp5
-rw-r--r--engines/access/access.h2
-rw-r--r--engines/access/char.cpp41
-rw-r--r--engines/access/data.cpp5
-rw-r--r--engines/access/data.h21
-rw-r--r--engines/access/files.cpp16
-rw-r--r--engines/access/files.h18
-rw-r--r--engines/access/module.mk1
-rw-r--r--engines/access/room.cpp34
-rw-r--r--engines/access/scripts.cpp29
-rw-r--r--engines/access/scripts.h4
-rw-r--r--engines/access/sound.cpp2
-rw-r--r--engines/access/sound.h3
-rw-r--r--engines/access/video.cpp35
-rw-r--r--engines/access/video.h41
15 files changed, 188 insertions, 69 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 0718fd697e..4035870dad 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -44,6 +44,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_screen = nullptr;
_scripts = nullptr;
_sound = nullptr;
+ _video = nullptr;
_destIn = nullptr;
_current = nullptr;
@@ -116,6 +117,7 @@ AccessEngine::~AccessEngine() {
delete _screen;
delete _scripts;
delete _sound;
+ delete _video;
freeCells();
delete[] _inactive;
@@ -156,6 +158,7 @@ void AccessEngine::initialize() {
_player = new Player(this);
_screen = new Screen(this);
_sound = new SoundManager(this, _mixer);
+ _video = new VideoPlayer(this);
_buffer1.create(g_system->getWidth() + TILE_WIDTH, g_system->getHeight());
_buffer2.create(g_system->getWidth(), g_system->getHeight());
@@ -201,7 +204,7 @@ int AccessEngine::getRandomNumber(int maxNumber) {
void AccessEngine::loadCells(Common::Array<CellIdent> &cells) {
for (uint i = 0; i < cells.size(); ++i) {
- byte *spriteData = _files->loadFile(cells[i]._fileNum, cells[i]._subfile);
+ byte *spriteData = _files->loadFile(cells[i]);
_objectsTable[cells[i]._cell] = new SpriteResource(this,
spriteData, _files->_filesize, DisposeAfterUse::YES);
}
diff --git a/engines/access/access.h b/engines/access/access.h
index 2e2358f268..0d4ad19452 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -43,6 +43,7 @@
#include "access/screen.h"
#include "access/scripts.h"
#include "access/sound.h"
+#include "access/video.h"
/**
* This is the namespace of the Access engine.
@@ -119,6 +120,7 @@ public:
Screen *_screen;
Scripts *_scripts;
SoundManager *_sound;
+ VideoPlayer *_video;
ASurface *_destIn;
ASurface *_current;
diff --git a/engines/access/char.cpp b/engines/access/char.cpp
index 40f3bf376a..09335fc017 100644
--- a/engines/access/char.cpp
+++ b/engines/access/char.cpp
@@ -32,11 +32,8 @@ CharEntry::CharEntry(const byte *data) {
_charFlag = s.readByte();
_estabIndex = s.readSint16LE();
- _screenFile._fileNum = s.readSint16LE();
- _screenFile._subfile = s.readSint16LE();
-
- _paletteFile._fileNum = s.readSint16LE();
- _paletteFile._subfile = s.readUint16LE();
+ _screenFile.load(s);
+ _paletteFile.load(s);
_startColor = s.readUint16LE();
_numColors = s.readUint16LE();
@@ -44,23 +41,19 @@ CharEntry::CharEntry(const byte *data) {
for (byte cell = s.readByte(); cell != 0xff; cell = s.readByte()) {
CellIdent ci;
ci._cell = cell;
- ci._fileNum = s.readSint16LE();
- ci._subfile = s.readUint16LE();
+ ci.load(s);
_cells.push_back(ci);
}
- _animFile._fileNum = s.readSint16LE();
- _animFile._subfile = s.readUint16LE();
- _scriptFile._fileNum = s.readSint16LE();
- _scriptFile._subfile = s.readUint16LE();
+ _animFile.load(s);
+ _scriptFile.load(s);
for (int16 v = s.readSint16LE(); v != -1; v = s.readSint16LE()) {
ExtraCell ec;
- ec._vidTable = v;
- ec._vidTable1 = s.readSint16LE();
- ec._vidSTable = s.readSint16LE();
- ec._vidSTable1 = s.readSint16LE();
+ ec._vid._fileNum = v;
+ ec._vid._subfile = s.readSint16LE();
+ ec._vidSound.load(s);
_extraCells.push_back(ec);
}
@@ -128,14 +121,14 @@ void CharManager::loadChar(int charId) {
_vm->loadCells(ce._cells);
if (ce._animFile._fileNum != -1) {
- byte *data = _vm->_files->loadFile(ce._animFile._fileNum, ce._animFile._subfile);
+ byte *data = _vm->_files->loadFile(ce._animFile);
_vm->_animation->loadAnimations(data, _vm->_files->_filesize);
}
// Load script data
_vm->_scripts->freeScriptData();
if (ce._scriptFile._fileNum != -1) {
- const byte *data = _vm->_files->loadFile(ce._scriptFile._fileNum, ce._scriptFile._subfile);
+ const byte *data = _vm->_files->loadFile(ce._scriptFile);
_vm->_scripts->setScript(data, _vm->_files->_filesize);
}
@@ -146,7 +139,19 @@ void CharManager::loadChar(int charId) {
}
void CharManager::charMenu() {
- error("TODO: charMenu");
+ byte *iconData = _vm->_files->loadFile("ICONS.LZ");
+ SpriteResource *spr = new SpriteResource(_vm, iconData, _vm->_files->_filesize);
+ delete[] iconData;
+
+ Screen &screen = *_vm->_screen;
+ screen.saveScreen();
+ screen.setDisplayScan();
+
+ screen.plotImage(spr, 17, Common::Point(0, 176));
+ screen.plotImage(spr, 18, Common::Point(155, 176));
+
+ screen.restoreScreen();
+ delete spr;
}
} // End of namespace Access
diff --git a/engines/access/data.cpp b/engines/access/data.cpp
index 094272b05c..a13c6d9a67 100644
--- a/engines/access/data.cpp
+++ b/engines/access/data.cpp
@@ -21,9 +21,10 @@
*/
#include "common/algorithm.h"
-#include "access/data.h"
-#include "graphics/palette.h"
+#include "common/stream.h"
#include "common/system.h"
+#include "graphics/palette.h"
+#include "access/data.h"
namespace Access {
diff --git a/engines/access/data.h b/engines/access/data.h
index c10b2b7f17..3238dafa33 100644
--- a/engines/access/data.h
+++ b/engines/access/data.h
@@ -28,6 +28,7 @@
#include "common/rect.h"
#include "common/types.h"
#include "graphics/surface.h"
+#include "access/files.h"
namespace Access {
@@ -40,20 +41,6 @@ public:
Manager(AccessEngine *vm) : _vm(vm) {}
};
-struct FileIdent {
- int _fileNum;
- int _subfile;
-
- FileIdent() {
- _fileNum = -1;
- _subfile = 0;
- }
-};
-
-struct CellIdent : FileIdent {
- byte _cell;
-};
-
struct TimerEntry {
int _initTm;
int _timer;
@@ -91,10 +78,8 @@ public:
class ExtraCell {
public:
- int _vidTable;
- int _vidTable1;
- int _vidSTable;
- int _vidSTable1;
+ FileIdent _vid;
+ FileIdent _vidSound;
};
struct FontVal {
diff --git a/engines/access/files.cpp b/engines/access/files.cpp
index 970b0b9019..c805121d50 100644
--- a/engines/access/files.cpp
+++ b/engines/access/files.cpp
@@ -27,6 +27,18 @@
namespace Access {
+FileIdent::FileIdent() {
+ _fileNum = -1;
+ _subfile = 0;
+}
+
+void FileIdent::load(Common::SeekableReadStream &s) {
+ _fileNum = s.readSint16LE();
+ _subfile = s.readUint16LE();
+}
+
+/*------------------------------------------------------------------------*/
+
FileManager::FileManager(AccessEngine *vm): _vm(vm) {
switch (vm->getGameID()) {
case GType_Amazon:
@@ -55,6 +67,10 @@ byte *FileManager::loadFile(int fileNum, int subfile) {
return handleFile();
}
+byte *FileManager::loadFile(FileIdent &fileIdent) {
+ return loadFile(fileIdent._fileNum, fileIdent._subfile);
+}
+
byte *FileManager::loadFile(const Common::String &filename) {
// Open the file
openFile(filename);
diff --git a/engines/access/files.h b/engines/access/files.h
index 848ee0d2ca..38d9179195 100644
--- a/engines/access/files.h
+++ b/engines/access/files.h
@@ -32,6 +32,19 @@ namespace Access {
class AccessEngine;
+struct FileIdent {
+ int _fileNum;
+ int _subfile;
+
+ FileIdent();
+
+ void load(Common::SeekableReadStream &s);
+};
+
+struct CellIdent : FileIdent {
+ byte _cell;
+};
+
class FileManager {
private:
AccessEngine *_vm;
@@ -56,6 +69,11 @@ public:
byte *loadFile(int fileNum, int subfile);
/**
+ * Loads a resource specified by a file identifier
+ */
+ byte *loadFile(FileIdent &fileIdent);
+
+ /**
* Load a given file by name
*/
byte *loadFile(const Common::String &filename);
diff --git a/engines/access/module.mk b/engines/access/module.mk
index 31f0760491..e92c2cc564 100644
--- a/engines/access/module.mk
+++ b/engines/access/module.mk
@@ -19,6 +19,7 @@ MODULE_OBJS := \
screen.o \
scripts.o \
sound.o \
+ video.o \
amazon/amazon_game.o \
amazon/amazon_resources.o \
amazon/amazon_room.o \
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 3ff4d66337..90ef3470db 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -174,8 +174,7 @@ void Room::loadRoomData(const byte *roomData) {
_vm->_sound->freeMusic();
if (roomInfo._musicFile._fileNum != -1) {
- _vm->_sound->_music = _vm->_files->loadFile(roomInfo._musicFile._fileNum,
- roomInfo._musicFile._subfile);
+ _vm->_sound->_music = _vm->_files->loadFile(roomInfo._musicFile);
_vm->_sound->_midiSize = _vm->_files->_filesize;
_vm->_sound->midiPlay();
_vm->_sound->_musicRepeat = true;
@@ -200,16 +199,14 @@ void Room::loadRoomData(const byte *roomData) {
// Load script data
_vm->_scripts->freeScriptData();
if (roomInfo._scriptFile._fileNum != -1) {
- const byte *data = _vm->_files->loadFile(roomInfo._scriptFile._fileNum,
- roomInfo._scriptFile._subfile);
+ const byte *data = _vm->_files->loadFile(roomInfo._scriptFile);
_vm->_scripts->setScript(data, _vm->_files->_filesize);
}
// Load animation data
_vm->_animation->freeAnimationData();
if (roomInfo._animFile._fileNum != -1) {
- byte *data = _vm->_files->loadFile(roomInfo._animFile._fileNum,
- roomInfo._animFile._subfile);
+ byte *data = _vm->_files->loadFile(roomInfo._animFile);
_vm->_animation->loadAnimations(data, _vm->_files->_filesize);
}
@@ -726,31 +723,25 @@ RoomInfo::RoomInfo(const byte *data, int gameType) {
else
_estIndex = -1;
- _musicFile._fileNum = stream.readSint16LE();
- _musicFile._subfile = stream.readUint16LE();
+ _musicFile.load(stream);
_scaleH1 = stream.readByte();
_scaleH2 = stream.readByte();
_scaleN1 = stream.readByte();
- _playFieldFile._fileNum = stream.readSint16LE();
- _playFieldFile._subfile = stream.readUint16LE();
+ _playFieldFile.load(stream);
for (byte cell = stream.readByte(); cell != 0xff; cell = stream.readByte()) {
CellIdent ci;
ci._cell = cell;
- ci._fileNum = stream.readSint16LE();
- ci._subfile = stream.readUint16LE();
+ ci.load(stream);
_cells.push_back(ci);
}
- _scriptFile._fileNum = stream.readSint16LE();
- _scriptFile._subfile = stream.readUint16LE();
- _animFile._fileNum = stream.readSint16LE();
- _animFile._subfile = stream.readUint16LE();
+ _scriptFile.load(stream);
+ _animFile.load(stream);
_scaleI = stream.readByte();
_scrollThreshold = stream.readByte();
- _paletteFile._fileNum = stream.readSint16LE();
- _paletteFile._subfile = stream.readUint16LE();
+ _paletteFile.load(stream);
if (_paletteFile._fileNum == -1) {
_startColor = _numColors = 0;
} else {
@@ -760,10 +751,9 @@ RoomInfo::RoomInfo(const byte *data, int gameType) {
for (int16 v = stream.readSint16LE(); v != -1; v = stream.readSint16LE()) {
ExtraCell ec;
- ec._vidTable = v;
- ec._vidTable1 = stream.readSint16LE();
- ec._vidSTable = stream.readSint16LE();
- ec._vidSTable1 = stream.readSint16LE();
+ ec._vid._fileNum = v;
+ ec._vid._subfile = stream.readSint16LE();
+ ec._vidSound.load(stream);
_extraCells.push_back(ec);
}
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 985f5cba66..2a834f8855 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -104,7 +104,7 @@ void Scripts::executeCommand(int commandIndex) {
&Scripts::cmdRetNeg, &Scripts::cmdRetPos, &Scripts::cmdCheckLoc,
&Scripts::cmdSetAnim, &Scripts::cmdDispInv, &Scripts::cmdSetTimer,
&Scripts::cmdSetTimer, &Scripts::cmdCheckTimer, &Scripts::cmdSetTravel,
- &Scripts::cmdSetTravel, &Scripts::CMDSETVID, &Scripts::CMDPLAYVID,
+ &Scripts::cmdSetTravel, &Scripts::cmdSetVideo, &Scripts::CMDPLAYVID,
&Scripts::cmdPlotImage, &Scripts::cmdSetDisplay, &Scripts::cmdSetBuffer,
&Scripts::cmdSetScroll, &Scripts::CMDSAVERECT, &Scripts::CMDSAVERECT,
&Scripts::CMDSETBUFVID, &Scripts::CMDPLAYBUFVID, &Scripts::cmdRemoveLast,
@@ -113,7 +113,7 @@ void Scripts::executeCommand(int commandIndex) {
&Scripts::cmdTexSpeak, &Scripts::cmdTexChoice, &Scripts::CMDWAIT,
&Scripts::cmdSetConPos, &Scripts::CMDCHECKVFRAME, &Scripts::cmdJumpChoice,
&Scripts::cmdReturnChoice, &Scripts::cmdClearBlock, &Scripts::cmdLoadSound,
- &Scripts::CMDFREESOUND, &Scripts::CMDSETVIDSND, &Scripts::CMDPLAYVIDSND,
+ &Scripts::CMDFREESOUND, &Scripts::cmdSetVideoSound, &Scripts::CMDPLAYVIDSND,
&Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION,
&Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION, &Scripts::cmdPlayerOff,
&Scripts::cmdPlayerOn, &Scripts::CMDDEAD, &Scripts::cmdFadeOut,
@@ -417,7 +417,16 @@ void Scripts::cmdSetTravel() {
_data->skip(2);
}
-void Scripts::CMDSETVID() { error("TODO CMDSETVID"); }
+void Scripts::cmdSetVideo() {
+ FileIdent fi;
+ fi._fileNum = _data->readSint16LE();
+ fi._subfile = _data->readUint16LE();
+ int cellIndex = _data->readUint16LE();
+ int rate = _data->readUint16LE();
+
+ _vm->_video->setVideo(_vm->_extraCells[cellIndex]._vid, fi, rate);
+}
+
void Scripts::CMDPLAYVID() { error("TODO CMDPLAYVID"); }
void Scripts::cmdPlotImage() {
@@ -645,12 +654,22 @@ void Scripts::cmdClearBlock() {
void Scripts::cmdLoadSound() {
int idx = _data->readSint16LE();
- _vm->_sound->_soundTable[0]._data = _vm->_files->loadFile(_vm->_extraCells[idx]._vidSTable, _vm->_extraCells[idx]._vidSTable1);
+ _vm->_sound->_soundTable[0]._data = _vm->_files->loadFile(_vm->_extraCells[idx]._vidSound);
_vm->_sound->_soundPriority[0] = 1;
}
void Scripts::CMDFREESOUND() { error("TODO CMDFREESOUND"); }
-void Scripts::CMDSETVIDSND() { error("TODO CMDSETVIDSND"); }
+
+void Scripts::cmdSetVideoSound() {
+ _data->skip(4);
+ cmdLoadSound();
+ _data->skip(-6);
+ cmdSetVideo();
+
+ _vm->_sound->_soundFrame = _data->readUint16LE();
+ _vm->_sound->_soundFlag = false;
+}
+
void Scripts::CMDPLAYVIDSND() { error("TODO CMDPLAYVIDSND"); }
void Scripts::CMDPUSHLOCATION() { error("TODO CMDPUSHLOCATION"); }
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index ae4c7559e0..93cd495be6 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -90,7 +90,7 @@ protected:
void cmdSetTimer();
void cmdCheckTimer();
void cmdSetTravel();
- void CMDSETVID();
+ void cmdSetVideo();
void CMDPLAYVID();
void cmdPlotImage();
void cmdSetDisplay();
@@ -114,7 +114,7 @@ protected:
void cmdClearBlock();
void cmdLoadSound();
void CMDFREESOUND();
- void CMDSETVIDSND();
+ void cmdSetVideoSound();
void CMDPLAYVIDSND();
void CMDPUSHLOCATION();
void cmdPlayerOff();
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index c6897282fa..aebd76fe84 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -36,6 +36,8 @@ SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) :
_music = nullptr;
_midiSize = 0;
_musicRepeat = false;
+ _soundFrame = 0;
+ _soundFlag = false;
}
SoundManager::~SoundManager() {
diff --git a/engines/access/sound.h b/engines/access/sound.h
index dd94396fa9..cb73bae52c 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -51,7 +51,8 @@ public:
byte *_music;
int _midiSize;
bool _musicRepeat;
-
+ int _soundFrame;
+ bool _soundFlag;
public:
SoundManager(AccessEngine *vm, Audio::Mixer *mixer);
~SoundManager();
diff --git a/engines/access/video.cpp b/engines/access/video.cpp
new file mode 100644
index 0000000000..a025d31022
--- /dev/null
+++ b/engines/access/video.cpp
@@ -0,0 +1,35 @@
+/* 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/video.h"
+
+namespace Access {
+
+VideoPlayer::VideoPlayer(AccessEngine *vm) : Manager(vm) {
+
+}
+
+void VideoPlayer::setVideo(FileIdent &fi1, FileIdent &fi2, int rate) {
+ error("TODO: setVideo");
+}
+
+} // End of namespace Access
diff --git a/engines/access/video.h b/engines/access/video.h
new file mode 100644
index 0000000000..b21f006a97
--- /dev/null
+++ b/engines/access/video.h
@@ -0,0 +1,41 @@
+/* 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_VIDEO_H
+#define ACCESS_VIDEO_H
+
+#include "common/scummsys.h"
+#include "access/data.h"
+#include "access/files.h"
+
+namespace Access {
+
+class VideoPlayer: public Manager {
+public:
+ VideoPlayer(AccessEngine *vm);
+
+ void setVideo(FileIdent &fi1, FileIdent &fi2, int rate);
+};
+
+} // End of namespace Access
+
+#endif /* ACCESS_VIDEO_H */