VOYEUR: Migrate engine to Path

This commit is contained in:
Le Philousophe 2023-11-01 11:26:32 +01:00 committed by Eugene Sandulenko
parent 1968695f6e
commit 17ceed4eb3
10 changed files with 27 additions and 27 deletions

View File

@ -47,12 +47,12 @@ RL2Decoder::~RL2Decoder() {
}
bool RL2Decoder::loadVideo(int videoId) {
Common::String filename = Common::String::format("%s.rl2",
::Voyeur::SZ_FILENAMES[videoId * 2]);
Common::Path filename(Common::String::format("%s.rl2",
::Voyeur::SZ_FILENAMES[videoId * 2]));
return loadRL2File(filename, false);
}
bool RL2Decoder::loadRL2File(const Common::String &file, bool palFlag) {
bool RL2Decoder::loadRL2File(const Common::Path &file, bool palFlag) {
bool result = VideoDecoder::loadFile(file);
_paletteStart = palFlag ? 0 : 128;
return result;

View File

@ -173,7 +173,7 @@ public:
void close() override;
bool loadStream(Common::SeekableReadStream *stream) override;
bool loadRL2File(const Common::String &file, bool palFlag);
bool loadRL2File(const Common::Path &file, bool palFlag);
bool loadVideo(int videoId);
int getPaletteCount() const { return _header._colorCount; }

View File

@ -180,16 +180,16 @@ FilesManager::~FilesManager() {
delete _boltFilesState;
}
bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFile) {
bool FilesManager::openBoltLib(const char *filename, BoltFile *&boltFile) {
if (boltFile != nullptr) {
_boltFilesState->_curLibPtr = boltFile;
return true;
}
// Create the bolt file interface object and load the index
if (filename == "bvoy.blt")
if (strcmp(filename, "bvoy.blt") == 0)
boltFile = _boltFilesState->_curLibPtr = new BVoyBoltFile(*_boltFilesState);
else if (filename == "stampblt.blt")
else if (strcmp(filename, "stampblt.blt") == 0)
boltFile = _boltFilesState->_curLibPtr = new StampBoltFile(*_boltFilesState);
else
error("Unknown bolt file specified");
@ -197,7 +197,7 @@ bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFi
return true;
}
byte *FilesManager::fload(const Common::String &filename, int *size) {
byte *FilesManager::fload(const char *filename, int *size) {
Common::File f;
int filesize;
byte *data = nullptr;
@ -218,9 +218,9 @@ byte *FilesManager::fload(const Common::String &filename, int *size) {
/*------------------------------------------------------------------------*/
BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _state(state) {
BoltFile::BoltFile(const char *filename, BoltFilesState &state): _state(state) {
if (!_file.open(filename))
error("Could not open %s", filename.c_str());
error("Could not open %s", filename);
// Read in the file header
byte header[16];

View File

@ -102,7 +102,7 @@ private:
public:
Common::File _file;
BoltFile(const Common::String &filename, BoltFilesState &state);
BoltFile(const char *filename, BoltFilesState &state);
virtual ~BoltFile();
BoltGroup *getBoltGroup(uint16 id);
@ -209,8 +209,8 @@ public:
FilesManager(VoyeurEngine *vm);
~FilesManager();
bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
byte *fload(const Common::String &filename, int *size);
bool openBoltLib(const char *filename, BoltFile *&boltFile);
byte *fload(const char *filename, int *size);
};
class RectEntry: public Common::Rect {

View File

@ -471,7 +471,7 @@ void ThreadResource::parsePlayCommands() {
_vm->_bVoy->freeBoltMember(_vm->_playStampGroupId + i * 2 + 1);
}
Common::String file = Common::String::format("news%d.voc", i + 1);
Common::Path file(Common::String::format("news%d.voc", i + 1));
_vm->_soundManager->startVOCPlay(file);
while (!_vm->shouldQuit() && !_vm->_eventsManager->_mouseClicked &&
@ -1343,7 +1343,7 @@ int ThreadResource::doInterface() {
_vm->_currentVocId = 151 - _vm->getRandomNumber(5);
_vm->_voy->_vocSecondsOffset = _vm->getRandomNumber(29);
Common::String fname = _vm->_soundManager->getVOCFileName(_vm->_currentVocId);
Common::Path fname = _vm->_soundManager->getVOCFileName(_vm->_currentVocId);
_vm->_soundManager->startVOCPlay(fname);
_vm->_eventsManager->getMouseInfo();

View File

@ -54,15 +54,15 @@ void SoundManager::setVOCOffset(int offset) {
_vocOffset = offset;
}
Common::String SoundManager::getVOCFileName(int idx) {
Common::Path SoundManager::getVOCFileName(int idx) {
assert(idx >= 0);
return Common::String::format("%s.voc", SZ_FILENAMES[idx]);
return Common::Path(Common::String::format("%s.voc", SZ_FILENAMES[idx]));
}
void SoundManager::startVOCPlay(const Common::String &filename) {
void SoundManager::startVOCPlay(const Common::Path &filename) {
Common::File f;
if (!f.open(filename))
error("Could not find voc file - %s", filename.c_str());
error("Could not find voc file - %s", filename.toString().c_str());
Audio::SeekableAudioStream *audioStream = Audio::makeVOCStream(f.readStream(f.size()),
Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);

View File

@ -23,7 +23,7 @@
#define VOYEUR_SOUND_H
#include "common/scummsys.h"
#include "common/str.h"
#include "common/path.h"
#include "audio/mixer.h"
namespace Voyeur {
@ -40,8 +40,8 @@ public:
void stopVOCPlay();
void abortVOCMap();
void setVOCOffset(int offset);
Common::String getVOCFileName(int idx);
void startVOCPlay(const Common::String &filename);
Common::Path getVOCFileName(int idx);
void startVOCPlay(const Common::Path &filename);
void startVOCPlay(int soundId);
int getVOCStatus();
uint32 getVOCFrame();

View File

@ -528,7 +528,7 @@ void VoyeurEngine::doOpening() {
_bVoy->freeBoltGroup(0x200);
}
void VoyeurEngine::playRL2Video(const Common::String &filename) {
void VoyeurEngine::playRL2Video(const Common::Path &filename) {
RL2Decoder decoder;
decoder.loadRL2File(filename, false);
decoder.start();
@ -625,7 +625,7 @@ void VoyeurEngine::playAudio(int audioId) {
_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED;
_soundManager->setVOCOffset(_voy->_vocSecondsOffset);
Common::String filename = _soundManager->getVOCFileName(
Common::Path filename = _soundManager->getVOCFileName(
audioId + 159);
_soundManager->startVOCPlay(filename);
_voy->_eventFlags |= EVTFLAG_RECORDING;
@ -726,7 +726,7 @@ void VoyeurEngine::showEndingNews() {
_bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2);
_bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2 + 1);
Common::String fname = Common::String::format("news%d.voc", idx);
Common::Path fname(Common::String::format("news%d.voc", idx));
_soundManager->startVOCPlay(fname);
_eventsManager->getMouseInfo();

View File

@ -210,7 +210,7 @@ public:
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
void loadGame(int slot);
void playRL2Video(const Common::String &filename);
void playRL2Video(const Common::Path &filename);
void doTransitionCard(const Common::String &time, const Common::String &location);
/**

View File

@ -695,7 +695,7 @@ void VoyeurEngine::reviewTape() {
// Play sound for the given duration
_soundManager->setVOCOffset(_voy->_vocSecondsOffset);
Common::String filename = _soundManager->getVOCFileName(
Common::Path filename = _soundManager->getVOCFileName(
_audioVideoId + 159);
_soundManager->startVOCPlay(filename);