HOPKINS: Properly implemented CONSTRUIT_FICHIER for animations.

The game has separate folders for selected animations at different resolutions.
This commit is contained in:
Paul Gilbert 2012-11-17 15:13:52 +11:00
parent 60c46fe386
commit 848dcbcf09
2 changed files with 44 additions and 8 deletions

View file

@ -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

View file

@ -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);