diff options
author | Paul Gilbert | 2012-11-17 15:13:52 +1100 |
---|---|---|
committer | Paul Gilbert | 2012-11-17 15:13:52 +1100 |
commit | 848dcbcf0993f7bb15d16db4d65daaa0d4ffaf82 (patch) | |
tree | 29e3ebd8d5ccf6991aa323031a7a0a90d46739e5 | |
parent | 60c46fe386ad5f927ceda75912af5bd8b5ed563c (diff) | |
download | scummvm-rg350-848dcbcf0993f7bb15d16db4d65daaa0d4ffaf82.tar.gz scummvm-rg350-848dcbcf0993f7bb15d16db4d65daaa0d4ffaf82.tar.bz2 scummvm-rg350-848dcbcf0993f7bb15d16db4d65daaa0d4ffaf82.zip |
HOPKINS: Properly implemented CONSTRUIT_FICHIER for animations.
The game has separate folders for selected animations at different resolutions.
-rw-r--r-- | engines/hopkins/files.cpp | 41 | ||||
-rw-r--r-- | engines/hopkins/files.h | 11 |
2 files changed, 44 insertions, 8 deletions
diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index aafa56691f..daa618d7c2 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -134,16 +134,43 @@ int FileManager::CONSTRUIT_SYSTEM(const Common::String &file) { return _vm->_globals.NFICHIER.size(); } -// Build File -void FileManager::CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file) { - // At this point, the original program did a big switch statement to determine - // whether to preprend the CD or installed directory path into REPJEU +void FileManager::CONSTRUIT_FICHIER(const Common::String &folder, const Common::String &file) { + Common::String folderToUse = folder; - if (hop[0] == 'A' && hop[1] == 'N' && hop[2] == 'N') { - error("TODO: CONSTRUIT_FICHIER"); + // A lot of the code in the original engine based on COPIE_SEQ was used to determine + // whether a file resided on the CD or hard disk. Since the ScummVM implementatoin + // requires all the files in the same location, we only need to do a somewhat simpler + // check for animations that don't exist in the ANM folder, but rather in special + // sub-folders depending on the physical screen resolution being used. + + if (folder == "ANM") { + switch (_vm->_globals.SVGA) { + case 1: + if (TEST_REP(folderToUse, file)) + folderToUse = "TSVGA"; + break; + case 2: + if (TEST_REP(folderToUse, file)) + folderToUse = "SVGA"; + break; + case 3: + if (TEST_REP(folderToUse, file)) + folderToUse = "VGA"; + break; + default: + break; + } } - _vm->_globals.NFICHIER = Common::String::format("%s/%s", hop.c_str(), file.c_str()); + _vm->_globals.NFICHIER = Common::String::format("%s/%s", folderToUse.c_str(), file.c_str()); +} + +bool FileManager::TEST_REP(const Common::String &folder, const Common::String &file) { + Common::String filename = folder.empty() ? file : + Common::String::format("%s/%s", folder.c_str(), file.c_str()); + + Common::File f; + return !f.exists(filename); } // Free File diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index d9df4341ca..e63e5370c8 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -33,6 +33,8 @@ namespace Hopkins { class HopkinsEngine; class FileManager { +private: + bool TEST_REP(const Common::String &folder, const Common::String &file); public: HopkinsEngine *_vm; public: @@ -48,7 +50,14 @@ public: int bload_it(Common::ReadStream &stream, void *buf, size_t nbytes); void F_Censure(); int CONSTRUIT_SYSTEM(const Common::String &file); - void CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file); + + /** + * Construct a filename based on a suggested folder and filename. + * @param folder Folder to use. May be overriden for animations. + * @param file Filename + */ + void CONSTRUIT_FICHIER(const Common::String &folder, const Common::String &file); + byte *LIBERE_FICHIER(byte *ptr); byte *RECHERCHE_CAT(const Common::String &file, int a2); Common::String CONSTRUIT_LINUX(const Common::String &file); |