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);
} else {
Common::String buf;
buf = _vm->_picDir + Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX";
Common::Path buf;
buf = _vm->_picDir.appendComponent(Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX");
if (!_objectsArchive.open(buf)) {
buf = Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX";
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);
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)) {
memset(image, 0, kOvlSize);
warning("File not found: %s", buf.c_str());
warning("File not found: %s", buf.toString().c_str());
return;
}
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
@ -81,10 +82,10 @@ void FileManager_v1d::readOverlay(const int screenNum, ImagePtr image, const Ovl
void FileManager_v1d::readBackground(const int screenIndex) {
debugC(1, kDebugFile, "readBackground(%d)", screenIndex);
Common::String buf;
buf = Common::String(_vm->_text->getScreenNames(screenIndex)) + ".ART";
Common::Path buf(_vm->_text->getScreenNames(screenIndex));
buf.appendInPlace(".ART");
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
Seq *dummySeq; // Image sequence structure for Read_pcx
dummySeq = readPCX(_sceneryArchive1, nullptr, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex));

View File

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

View File

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