HUGO: Migrate engine to Path

This commit is contained in:
Le Philousophe 2023-10-31 22:44:17 +01:00 committed by Eugene Sandulenko
parent 69665f6803
commit a1a5407c64
4 changed files with 15 additions and 14 deletions

View File

@ -165,12 +165,12 @@ void FileManager::readImage(const int objNum, Object *objPtr) {
_objectsArchive.seek(objBlock.objOffset, SEEK_SET); _objectsArchive.seek(objBlock.objOffset, SEEK_SET);
} else { } else {
Common::String buf; Common::Path buf;
buf = _vm->_picDir + Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX"; buf = _vm->_picDir.appendComponent(Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX");
if (!_objectsArchive.open(buf)) { if (!_objectsArchive.open(buf)) {
buf = Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX"; buf = Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX";
if (!_objectsArchive.open(buf)) if (!_objectsArchive.open(buf))
error("File not found: %s", buf.c_str()); error("File not found: %s", buf.toString().c_str());
} }
} }

View File

@ -58,16 +58,17 @@ void FileManager_v1d::readOverlay(const int screenNum, ImagePtr image, const Ovl
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum); debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
const char *ovlExt[] = {".b", ".o", ".ob"}; const char *ovlExt[] = {".b", ".o", ".ob"};
Common::String buf = Common::String(_vm->_text->getScreenNames(screenNum)) + Common::String(ovlExt[overlayType]); Common::Path buf(_vm->_text->getScreenNames(screenNum));
buf.appendInPlace(ovlExt[overlayType]);
if (!Common::File::exists(buf)) { if (!Common::File::exists(buf)) {
memset(image, 0, kOvlSize); memset(image, 0, kOvlSize);
warning("File not found: %s", buf.c_str()); warning("File not found: %s", buf.toString().c_str());
return; return;
} }
if (!_sceneryArchive1.open(buf)) if (!_sceneryArchive1.open(buf))
error("File not found: %s", buf.c_str()); error("File not found: %s", buf.toString().c_str());
ImagePtr tmpImage = image; // temp ptr to overlay file ImagePtr tmpImage = image; // temp ptr to overlay file
@ -81,10 +82,10 @@ void FileManager_v1d::readOverlay(const int screenNum, ImagePtr image, const Ovl
void FileManager_v1d::readBackground(const int screenIndex) { void FileManager_v1d::readBackground(const int screenIndex) {
debugC(1, kDebugFile, "readBackground(%d)", screenIndex); debugC(1, kDebugFile, "readBackground(%d)", screenIndex);
Common::String buf; Common::Path buf(_vm->_text->getScreenNames(screenIndex));
buf = Common::String(_vm->_text->getScreenNames(screenIndex)) + ".ART"; buf.appendInPlace(".ART");
if (!_sceneryArchive1.open(buf)) if (!_sceneryArchive1.open(buf))
error("File not found: %s", buf.c_str()); error("File not found: %s", buf.toString().c_str());
// Read the image into dummy seq and static dib_a // Read the image into dummy seq and static dib_a
Seq *dummySeq; // Image sequence structure for Read_pcx Seq *dummySeq; // Image sequence structure for Read_pcx
dummySeq = readPCX(_sceneryArchive1, nullptr, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex)); dummySeq = readPCX(_sceneryArchive1, nullptr, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex));

View File

@ -219,7 +219,7 @@ public:
Common::RandomSource *_rnd; Common::RandomSource *_rnd;
const char *_episode; const char *_episode;
Common::String _picDir; Common::Path _picDir;
Command _statusLine; Command _statusLine;
Command _scoreLine; Command _scoreLine;

View File

@ -178,10 +178,10 @@ void Scheduler::newScreen(const int screenIndex) {
// Make sure the background file exists! // Make sure the background file exists!
if (!_vm->isPacked()) { if (!_vm->isPacked()) {
Common::String filename = Common::String(_vm->_text->getScreenNames(screenIndex)); Common::Path filename = _vm->_picDir.appendComponent(Common::String(_vm->_text->getScreenNames(screenIndex)));
if (!Common::File::exists(_vm->_picDir + filename + ".PCX") && if (!Common::File::exists(filename.append(".PCX")) &&
!Common::File::exists(filename + ".ART")) { !Common::File::exists(filename.append(".ART"))) {
error("Unable to find background file for %s", filename.c_str()); error("Unable to find background file for %s", filename.toString().c_str());
return; return;
} }
} }