2020-10-09 17:04:07 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2008-06-13 14:57:47 +00:00
|
|
|
*
|
2020-10-09 17:04:07 +00:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
2021-12-26 20:19:38 +00:00
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
2008-06-13 14:57:47 +00:00
|
|
|
* file distributed with this source distribution.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
2021-12-26 17:47:58 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-04-05 16:18:42 +00:00
|
|
|
*
|
2012-12-19 22:15:43 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2006-04-02 14:20:45 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-12-19 22:15:43 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-04-05 16:18:42 +00:00
|
|
|
*
|
2012-12-19 22:15:43 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 17:47:58 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
|
|
|
*/
|
2003-08-15 18:00:22 +00:00
|
|
|
|
2012-08-08 16:13:46 +00:00
|
|
|
#include "gui/error.h"
|
|
|
|
|
2009-05-24 19:13:58 +00:00
|
|
|
#include "engines/grim/resource.h"
|
|
|
|
#include "engines/grim/colormap.h"
|
|
|
|
#include "engines/grim/costume.h"
|
|
|
|
#include "engines/grim/keyframe.h"
|
|
|
|
#include "engines/grim/material.h"
|
|
|
|
#include "engines/grim/grim.h"
|
|
|
|
#include "engines/grim/lipsync.h"
|
2011-03-20 21:16:27 +00:00
|
|
|
#include "engines/grim/savegame.h"
|
2011-05-14 00:55:14 +00:00
|
|
|
#include "engines/grim/lab.h"
|
|
|
|
#include "engines/grim/bitmap.h"
|
|
|
|
#include "engines/grim/font.h"
|
2011-07-22 20:40:49 +00:00
|
|
|
#include "engines/grim/model.h"
|
2013-07-08 00:18:30 +00:00
|
|
|
#include "engines/grim/sprite.h"
|
2011-11-19 16:30:43 +00:00
|
|
|
#include "engines/grim/inputdialog.h"
|
|
|
|
#include "engines/grim/debug.h"
|
2012-01-30 21:24:09 +00:00
|
|
|
#include "engines/grim/emi/animationemi.h"
|
2012-02-01 01:12:59 +00:00
|
|
|
#include "engines/grim/emi/costumeemi.h"
|
2012-01-29 15:14:36 +00:00
|
|
|
#include "engines/grim/emi/modelemi.h"
|
|
|
|
#include "engines/grim/emi/skeleton.h"
|
2015-01-29 04:44:27 +00:00
|
|
|
#include "engines/grim/remastered/overlay.h"
|
2011-12-30 17:59:03 +00:00
|
|
|
#include "engines/grim/patchr.h"
|
2013-02-05 14:45:40 +00:00
|
|
|
#include "engines/grim/md5check.h"
|
2012-01-04 15:37:40 +00:00
|
|
|
#include "engines/grim/update/update.h"
|
2013-02-05 14:45:40 +00:00
|
|
|
|
2011-12-21 16:37:04 +00:00
|
|
|
#include "common/algorithm.h"
|
2023-07-30 17:13:58 +00:00
|
|
|
#include "common/compression/deflate.h"
|
2012-03-27 03:12:00 +00:00
|
|
|
#include "common/memstream.h"
|
|
|
|
#include "common/file.h"
|
2012-04-11 21:34:16 +00:00
|
|
|
#include "common/config-manager.h"
|
2015-08-26 18:42:31 +00:00
|
|
|
#include "common/translation.h"
|
2005-01-01 12:27:57 +00:00
|
|
|
|
2009-05-25 06:49:57 +00:00
|
|
|
namespace Grim {
|
|
|
|
|
2014-05-29 22:35:46 +00:00
|
|
|
ResourceLoader *g_resourceloader = nullptr;
|
2003-08-15 18:00:22 +00:00
|
|
|
|
2011-12-21 16:37:04 +00:00
|
|
|
class LabListComperator {
|
|
|
|
const Common::String _labName;
|
|
|
|
public:
|
|
|
|
LabListComperator() {}
|
|
|
|
LabListComperator(const Common::String &ln) : _labName(ln) {}
|
|
|
|
|
|
|
|
bool operator()(const Common::ArchiveMemberPtr &l) {
|
|
|
|
return _labName.compareToIgnoreCase(l->getName()) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator()(const Common::ArchiveMemberPtr &l, const Common::ArchiveMemberPtr &r) {
|
|
|
|
return (l->getName().compareToIgnoreCase(r->getName()) > 0);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2003-08-15 18:00:22 +00:00
|
|
|
ResourceLoader::ResourceLoader() {
|
2009-05-12 14:31:48 +00:00
|
|
|
_cacheDirty = false;
|
2009-06-27 06:08:44 +00:00
|
|
|
_cacheMemorySize = 0;
|
2009-05-12 14:31:48 +00:00
|
|
|
|
2009-04-05 14:48:54 +00:00
|
|
|
Lab *l;
|
2012-01-04 15:37:40 +00:00
|
|
|
Common::ArchiveMemberList files, updFiles;
|
2008-08-01 18:27:11 +00:00
|
|
|
|
2022-06-07 23:12:00 +00:00
|
|
|
// Load the update from the executable, if needed
|
2020-10-07 17:50:27 +00:00
|
|
|
const char *updateFilename = nullptr;
|
2022-04-15 13:21:59 +00:00
|
|
|
if ((g_grim->getGameType() == GType_GRIM && !g_grim->isRemastered())
|
|
|
|
|| g_grim->getGameType() == GType_MONKEY4) {
|
2020-10-07 17:50:27 +00:00
|
|
|
updateFilename = g_grim->getUpdateFilename();
|
|
|
|
}
|
2013-08-29 11:22:52 +00:00
|
|
|
if (updateFilename) {
|
|
|
|
Common::File *updStream = new Common::File();
|
|
|
|
if (updStream && updStream->open(updateFilename)) {
|
|
|
|
Common::Archive *update = loadUpdateArchive(updStream);
|
|
|
|
if (update)
|
|
|
|
SearchMan.add("update", update, 1);
|
|
|
|
} else
|
|
|
|
delete updStream;
|
|
|
|
|
|
|
|
// Check if the update has been correctly loaded
|
|
|
|
if (!SearchMan.hasArchive("update")) {
|
2020-09-03 00:01:03 +00:00
|
|
|
Common::U32String errorMessage;
|
2022-08-21 11:07:01 +00:00
|
|
|
Common::String urlForPatchDownload = Common::String::format("https://downloads.scummvm.org/frs/extras/patches/%s",
|
|
|
|
(g_grim->getGameType() == GType_GRIM)? "gfupd101.exe" : "");
|
2013-08-29 11:22:52 +00:00
|
|
|
if (g_grim->getGameType() == GType_GRIM) {
|
2022-08-21 11:07:01 +00:00
|
|
|
errorMessage = Common::U32String::format(_("The original patch of Grim Fandango\n"
|
2013-08-29 11:22:52 +00:00
|
|
|
"is missing. Please download it from\n"
|
2022-08-21 11:07:01 +00:00
|
|
|
"%s\n"
|
|
|
|
"and put it in the game data files directory"), urlForPatchDownload.c_str());
|
2013-08-29 11:22:52 +00:00
|
|
|
} else if (g_grim->getGameType() == GType_MONKEY4) {
|
2022-08-21 11:07:01 +00:00
|
|
|
errorMessage = Common::U32String::format(_("The original patch of Escape from Monkey Island is missing. \n"
|
|
|
|
"Please download it from %s\n"
|
2013-08-29 11:22:52 +00:00
|
|
|
"and put it in the game data files directory.\n"
|
2022-08-21 11:07:01 +00:00
|
|
|
"Pay attention to download the correct version according to the game's language!"), urlForPatchDownload.c_str());
|
2013-08-29 11:22:52 +00:00
|
|
|
}
|
|
|
|
|
2022-08-21 11:07:01 +00:00
|
|
|
GUIErrorMessageWithURL(errorMessage, urlForPatchDownload.c_str());
|
2013-08-29 11:22:52 +00:00
|
|
|
error("%s not found", updateFilename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-21 16:37:04 +00:00
|
|
|
if (g_grim->getGameType() == GType_GRIM) {
|
|
|
|
if (g_grim->getGameFlags() & ADGF_DEMO) {
|
|
|
|
SearchMan.listMatchingMembers(files, "gfdemo01.lab");
|
2015-01-18 14:49:42 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "gdemo001.lab"); // For the english demo with video.
|
2011-12-21 16:37:04 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "grimdemo.mus");
|
|
|
|
SearchMan.listMatchingMembers(files, "sound001.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "voice001.lab");
|
|
|
|
} else {
|
2020-11-01 13:10:09 +00:00
|
|
|
if (!SearchMan.hasFile("grim-patch.lab"))
|
|
|
|
error("%s", "grim-patch.lab not found");
|
2012-01-06 23:49:20 +00:00
|
|
|
|
2020-11-01 13:10:09 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "grim-patch.lab");
|
2012-03-19 09:35:13 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "data005.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "data004.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "data003.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "data002.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "data001.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "data000.lab");
|
2011-12-21 16:37:04 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "movie??.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "vox????.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "year?mus.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "local.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "credits.lab");
|
2023-03-06 04:23:50 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "rus_font.lab");
|
2011-12-21 16:37:04 +00:00
|
|
|
|
2021-11-02 09:06:12 +00:00
|
|
|
if (g_grim->isRemastered()) {
|
2015-02-04 15:48:09 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "commentary.lab");
|
2015-02-05 04:53:33 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "images.lab");
|
2015-02-04 15:48:09 +00:00
|
|
|
}
|
2022-06-07 23:12:00 +00:00
|
|
|
// Sort the archives in order to ensure that they are loaded with the correct order
|
2011-12-21 16:37:04 +00:00
|
|
|
Common::sort(files.begin(), files.end(), LabListComperator());
|
|
|
|
|
2022-06-07 23:12:00 +00:00
|
|
|
// Check the presence of datausr.lab and if the user wants to load it.
|
|
|
|
// In this case put it in the top of the list
|
2012-08-01 14:30:15 +00:00
|
|
|
const char *datausr_name = "datausr.lab";
|
|
|
|
if (SearchMan.hasFile(datausr_name) && ConfMan.getBool("datausr_load")) {
|
2020-10-09 17:04:07 +00:00
|
|
|
warning("%s", "Loading datausr.lab. Please note that the ScummVM team doesn't provide support for using such patches");
|
2012-08-01 14:30:15 +00:00
|
|
|
files.push_front(SearchMan.getMember(datausr_name));
|
2011-11-19 16:30:43 +00:00
|
|
|
}
|
2003-08-24 09:34:19 +00:00
|
|
|
}
|
2012-01-18 04:45:35 +00:00
|
|
|
} else if (g_grim->getGameType() == GType_MONKEY4) {
|
2020-11-01 13:10:09 +00:00
|
|
|
const char *emi_patches_filename = "monkey4-patch.m4b";
|
2013-08-26 08:20:01 +00:00
|
|
|
if (!SearchMan.hasFile(emi_patches_filename))
|
2020-09-03 00:01:03 +00:00
|
|
|
error("%s not found", emi_patches_filename);
|
2013-08-26 08:20:01 +00:00
|
|
|
|
|
|
|
SearchMan.listMatchingMembers(files, emi_patches_filename);
|
|
|
|
|
2012-08-08 16:27:44 +00:00
|
|
|
if (g_grim->getGameFlags() & ADGF_DEMO) {
|
2012-01-18 04:45:35 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "lip.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "MagDemo.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "tile.lab");
|
|
|
|
SearchMan.listMatchingMembers(files, "voice.lab");
|
|
|
|
} else {
|
2022-06-07 23:12:00 +00:00
|
|
|
// Keep i9n.m4b before patch.m4b for a better efficiency
|
|
|
|
// in decompressing from Monkey Update.exe
|
2012-01-04 15:37:40 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "i9n.m4b");
|
2013-08-26 07:52:10 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "patch.m4b");
|
2012-01-18 04:45:35 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "art???.m4b");
|
|
|
|
SearchMan.listMatchingMembers(files, "lip.m4b");
|
|
|
|
SearchMan.listMatchingMembers(files, "local.m4b");
|
|
|
|
SearchMan.listMatchingMembers(files, "sfx.m4b");
|
|
|
|
SearchMan.listMatchingMembers(files, "voice???.m4b");
|
2012-01-22 18:51:57 +00:00
|
|
|
SearchMan.listMatchingMembers(files, "music?.m4b");
|
2012-07-22 16:57:27 +00:00
|
|
|
|
|
|
|
if (g_grim->getGamePlatform() == Common::kPlatformPS2) {
|
|
|
|
SearchMan.listMatchingMembers(files, "???.m4b");
|
|
|
|
}
|
2013-06-29 10:18:29 +00:00
|
|
|
|
2022-06-07 23:12:00 +00:00
|
|
|
// Check the presence of datausr.m4b and if the user wants to load it.
|
|
|
|
// In this case put it in the top of the list
|
2013-06-29 10:18:29 +00:00
|
|
|
const char *datausr_name = "datausr.m4b";
|
|
|
|
if (SearchMan.hasFile(datausr_name) && ConfMan.getBool("datausr_load")) {
|
2020-10-09 17:04:07 +00:00
|
|
|
warning("%s", "Loading datausr.m4b. Please note that the ScummVM team doesn't provide support for using such patches");
|
2013-06-29 10:18:29 +00:00
|
|
|
files.push_front(SearchMan.getMember(datausr_name));
|
|
|
|
}
|
2012-01-18 04:45:35 +00:00
|
|
|
}
|
2008-08-01 18:27:11 +00:00
|
|
|
}
|
|
|
|
|
2011-12-21 16:37:04 +00:00
|
|
|
if (files.empty())
|
2020-09-03 00:01:03 +00:00
|
|
|
error("%s", "Cannot find game data - check configuration file");
|
2009-04-05 14:48:54 +00:00
|
|
|
|
2022-06-07 23:12:00 +00:00
|
|
|
// Load labs
|
2023-05-01 21:08:02 +00:00
|
|
|
int priority = -1;
|
2011-12-21 16:37:04 +00:00
|
|
|
for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
|
|
|
|
Common::String filename = (*x)->getName();
|
|
|
|
filename.toLowercase();
|
2011-03-24 14:45:26 +00:00
|
|
|
|
2022-06-07 23:12:00 +00:00
|
|
|
// Avoid duplicates
|
2012-04-11 11:50:39 +00:00
|
|
|
if (SearchMan.hasArchive(filename))
|
2012-01-04 15:37:40 +00:00
|
|
|
continue;
|
|
|
|
|
2011-12-21 16:37:04 +00:00
|
|
|
l = new Lab();
|
2015-01-09 21:11:33 +00:00
|
|
|
// Caching "local.m4b" to speed up the launch of the mac version,
|
|
|
|
// we _COULD_ protect this with a platform check, but the file isn't
|
|
|
|
// really big anyhow...
|
|
|
|
bool useCache = (filename == "local.m4b");
|
|
|
|
if (l->open(filename, useCache))
|
2012-04-11 11:50:39 +00:00
|
|
|
SearchMan.add(filename, l, priority--, true);
|
2011-12-21 16:37:04 +00:00
|
|
|
else
|
|
|
|
delete l;
|
2003-08-24 09:34:19 +00:00
|
|
|
}
|
2011-12-21 16:37:04 +00:00
|
|
|
|
|
|
|
files.clear();
|
2003-08-15 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2011-05-06 05:01:39 +00:00
|
|
|
template<typename T>
|
|
|
|
void clearList(Common::List<T> &list) {
|
|
|
|
while (!list.empty()) {
|
|
|
|
T p = list.front();
|
|
|
|
list.erase(list.begin());
|
|
|
|
delete p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-05 13:49:32 +00:00
|
|
|
ResourceLoader::~ResourceLoader() {
|
2011-05-04 19:23:55 +00:00
|
|
|
for (Common::Array<ResourceCache>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
|
|
|
|
ResourceCache &r = *i;
|
|
|
|
delete[] r.fname;
|
2011-12-21 10:00:08 +00:00
|
|
|
delete[] r.resPtr;
|
2011-05-04 19:23:55 +00:00
|
|
|
}
|
2011-05-06 05:01:39 +00:00
|
|
|
clearList(_models);
|
|
|
|
clearList(_colormaps);
|
|
|
|
clearList(_keyframeAnims);
|
|
|
|
clearList(_lipsyncs);
|
2013-02-05 14:45:40 +00:00
|
|
|
MD5Check::clear();
|
2006-02-26 18:38:35 +00:00
|
|
|
}
|
|
|
|
|
2009-05-12 14:31:48 +00:00
|
|
|
static int sortCallback(const void *entry1, const void *entry2) {
|
2012-04-03 23:58:04 +00:00
|
|
|
return scumm_stricmp(((const ResourceLoader::ResourceCache *)entry1)->fname, ((const ResourceLoader::ResourceCache *)entry2)->fname);
|
2009-05-12 14:31:48 +00:00
|
|
|
}
|
|
|
|
|
2012-04-11 12:23:08 +00:00
|
|
|
Common::SeekableReadStream *ResourceLoader::getFileFromCache(const Common::String &filename) const {
|
2009-05-12 14:31:48 +00:00
|
|
|
ResourceLoader::ResourceCache *entry = getEntryFromCache(filename);
|
2011-12-21 10:00:08 +00:00
|
|
|
if (!entry)
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2011-12-21 10:00:08 +00:00
|
|
|
|
|
|
|
return new Common::MemoryReadStream(entry->resPtr, entry->len);
|
2009-05-12 14:31:48 +00:00
|
|
|
}
|
|
|
|
|
2012-04-11 12:23:08 +00:00
|
|
|
ResourceLoader::ResourceCache *ResourceLoader::getEntryFromCache(const Common::String &filename) const {
|
2010-05-17 20:46:57 +00:00
|
|
|
if (_cache.empty())
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2011-03-20 21:16:27 +00:00
|
|
|
|
2009-05-12 14:31:48 +00:00
|
|
|
if (_cacheDirty) {
|
|
|
|
qsort(_cache.begin(), _cache.size(), sizeof(ResourceCache), sortCallback);
|
|
|
|
_cacheDirty = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ResourceCache key;
|
2011-05-22 23:40:56 +00:00
|
|
|
key.fname = const_cast<char *>(filename.c_str());
|
2009-05-12 14:31:48 +00:00
|
|
|
|
|
|
|
return (ResourceLoader::ResourceCache *)bsearch(&key, _cache.begin(), _cache.size(), sizeof(ResourceCache), sortCallback);
|
|
|
|
}
|
|
|
|
|
2012-04-11 12:23:08 +00:00
|
|
|
Common::SeekableReadStream *ResourceLoader::loadFile(const Common::String &filename) const {
|
2014-05-29 22:35:46 +00:00
|
|
|
Common::SeekableReadStream *rs = nullptr;
|
2015-01-09 21:11:33 +00:00
|
|
|
if (SearchMan.hasFile(filename))
|
2011-12-30 17:59:03 +00:00
|
|
|
rs = SearchMan.createReadStreamForMember(filename);
|
2004-02-24 22:43:32 +00:00
|
|
|
else
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2011-12-30 17:59:03 +00:00
|
|
|
|
2012-04-10 15:14:27 +00:00
|
|
|
rs = wrapPatchedFile(rs, filename);
|
2011-12-30 17:59:03 +00:00
|
|
|
return rs;
|
2011-08-13 08:17:17 +00:00
|
|
|
}
|
|
|
|
|
2012-04-11 12:23:08 +00:00
|
|
|
Common::SeekableReadStream *ResourceLoader::openNewStreamFile(Common::String fname, bool cache) const {
|
2011-12-21 10:00:08 +00:00
|
|
|
Common::SeekableReadStream *s;
|
2013-07-09 19:12:55 +00:00
|
|
|
fname.toLowercase();
|
2011-12-21 10:00:08 +00:00
|
|
|
|
|
|
|
if (cache) {
|
|
|
|
s = getFileFromCache(fname);
|
|
|
|
if (!s) {
|
|
|
|
s = loadFile(fname);
|
|
|
|
if (!s)
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2011-12-21 10:00:08 +00:00
|
|
|
|
|
|
|
uint32 size = s->size();
|
|
|
|
byte *buf = new byte[size];
|
|
|
|
s->read(buf, size);
|
|
|
|
putIntoCache(fname, buf, size);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete s;
|
2012-01-10 03:24:00 +00:00
|
|
|
s = new Common::MemoryReadStream(buf, size);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
s = loadFile(fname);
|
2011-12-21 10:00:08 +00:00
|
|
|
}
|
2012-01-10 03:24:00 +00:00
|
|
|
// This will only have an effect if the stream is actually compressed.
|
|
|
|
return Common::wrapCompressedReadStream(s);
|
2003-08-15 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2012-04-11 12:23:08 +00:00
|
|
|
void ResourceLoader::putIntoCache(const Common::String &fname, byte *res, uint32 len) const {
|
2009-05-12 18:45:14 +00:00
|
|
|
ResourceCache entry;
|
|
|
|
entry.resPtr = res;
|
2011-12-21 10:00:08 +00:00
|
|
|
entry.len = len;
|
2009-05-12 18:45:14 +00:00
|
|
|
entry.fname = new char[fname.size() + 1];
|
2022-09-25 09:34:23 +00:00
|
|
|
Common::strcpy_s(entry.fname, fname.size() + 1, fname.c_str());
|
2011-12-21 10:00:08 +00:00
|
|
|
_cacheMemorySize += len;
|
2009-05-12 18:45:14 +00:00
|
|
|
_cache.push_back(entry);
|
|
|
|
_cacheDirty = true;
|
|
|
|
}
|
|
|
|
|
2011-05-22 23:40:56 +00:00
|
|
|
CMap *ResourceLoader::loadColormap(const Common::String &filename) {
|
2011-12-17 17:41:38 +00:00
|
|
|
Common::SeekableReadStream *stream = openNewStreamFile(filename.c_str());
|
|
|
|
if (!stream) {
|
|
|
|
error("Could not find colormap %s", filename.c_str());
|
2009-06-27 06:47:18 +00:00
|
|
|
}
|
2003-08-15 18:00:22 +00:00
|
|
|
|
2011-12-17 17:41:38 +00:00
|
|
|
CMap *result = new CMap(filename, stream);
|
2011-03-20 21:16:27 +00:00
|
|
|
_colormaps.push_back(result);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2009-05-12 14:31:48 +00:00
|
|
|
|
2004-02-24 22:43:32 +00:00
|
|
|
return result;
|
2003-08-15 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2012-08-12 16:00:23 +00:00
|
|
|
Common::String ResourceLoader::fixFilename(const Common::String &filename, bool append) {
|
2011-05-14 03:25:23 +00:00
|
|
|
Common::String fname(filename);
|
2011-05-09 08:00:01 +00:00
|
|
|
if (g_grim->getGameType() == GType_MONKEY4) {
|
2011-05-14 03:25:23 +00:00
|
|
|
int len = fname.size();
|
2011-05-09 08:00:01 +00:00
|
|
|
for (int i = 0; i < len; i++) {
|
2011-05-14 03:25:23 +00:00
|
|
|
if (fname[i] == '\\') {
|
|
|
|
fname.setChar('/', i);
|
|
|
|
}
|
2011-05-09 08:00:01 +00:00
|
|
|
}
|
|
|
|
// Append b to end of filename for EMI
|
2011-06-02 18:19:23 +00:00
|
|
|
if (append)
|
|
|
|
fname += "b";
|
2011-05-09 08:00:01 +00:00
|
|
|
}
|
|
|
|
return fname;
|
|
|
|
}
|
|
|
|
|
2014-06-09 15:41:01 +00:00
|
|
|
Costume *ResourceLoader::loadCostume(const Common::String &filename, Actor *owner, Costume *prevCost) {
|
2011-05-09 08:00:01 +00:00
|
|
|
Common::String fname = fixFilename(filename);
|
2011-05-14 18:24:53 +00:00
|
|
|
fname.toLowercase();
|
2011-12-18 20:47:49 +00:00
|
|
|
|
2011-12-21 10:00:08 +00:00
|
|
|
Common::SeekableReadStream *stream = openNewStreamFile(fname.c_str(), true);
|
2011-12-18 20:47:49 +00:00
|
|
|
if (!stream) {
|
|
|
|
error("Could not find costume \"%s\"", filename.c_str());
|
2009-06-27 06:47:18 +00:00
|
|
|
}
|
2012-02-01 01:12:59 +00:00
|
|
|
Costume *result;
|
|
|
|
if (g_grim->getGameType() == GType_MONKEY4) {
|
2014-06-09 15:41:01 +00:00
|
|
|
result = new EMICostume(filename, owner, prevCost);
|
2012-02-01 01:12:59 +00:00
|
|
|
} else {
|
2014-06-09 15:41:01 +00:00
|
|
|
result = new Costume(filename, owner, prevCost);
|
2012-02-01 01:12:59 +00:00
|
|
|
}
|
|
|
|
result->load(stream);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2013-07-09 19:12:55 +00:00
|
|
|
|
2004-02-24 22:43:32 +00:00
|
|
|
return result;
|
2003-08-15 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2011-05-22 23:40:56 +00:00
|
|
|
Font *ResourceLoader::loadFont(const Common::String &filename) {
|
2011-12-19 18:02:55 +00:00
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
2023-05-01 21:59:10 +00:00
|
|
|
if (g_grim->_overrideFont)
|
|
|
|
return g_grim->_overrideFont;
|
|
|
|
|
2021-11-02 09:06:12 +00:00
|
|
|
if (g_grim->getGameType() == GType_GRIM && g_grim->isRemastered()) {
|
2020-10-07 17:50:27 +00:00
|
|
|
Common::String name = "FontsHD/" + filename + ".txt";
|
|
|
|
stream = openNewStreamFile(name, true);
|
|
|
|
if (stream) {
|
|
|
|
Common::String line = stream->readLine();
|
|
|
|
Common::String font;
|
|
|
|
Common::String size;
|
2021-03-18 06:05:59 +00:00
|
|
|
for (uint i = 0; i < line.size(); ++i) {
|
2020-10-07 17:50:27 +00:00
|
|
|
if (line[i] == ' ') {
|
|
|
|
font = "FontsHD/" + Common::String(line.c_str(), i);
|
|
|
|
size = Common::String(line.c_str() + i + 1, line.size() - i - 2);
|
|
|
|
}
|
2015-02-01 23:36:56 +00:00
|
|
|
}
|
|
|
|
|
2020-10-07 17:50:27 +00:00
|
|
|
int s = atoi(size.c_str());
|
|
|
|
delete stream;
|
|
|
|
stream = openNewStreamFile(font.c_str(), true);
|
|
|
|
FontTTF *result = new FontTTF();
|
|
|
|
result->loadTTF(font, stream, s);
|
|
|
|
return result;
|
|
|
|
}
|
2015-02-01 23:36:56 +00:00
|
|
|
}
|
|
|
|
|
2011-12-21 10:00:08 +00:00
|
|
|
stream = openNewStreamFile(filename.c_str(), true);
|
2013-07-09 19:12:55 +00:00
|
|
|
if (!stream)
|
2011-12-19 18:02:55 +00:00
|
|
|
error("Could not find font file %s", filename.c_str());
|
2005-03-18 19:54:40 +00:00
|
|
|
|
2023-03-04 01:41:08 +00:00
|
|
|
BitmapFont *result = new BitmapFont();
|
2013-10-26 20:13:07 +00:00
|
|
|
result->load(filename, stream);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2009-05-12 14:31:48 +00:00
|
|
|
|
2005-03-18 19:54:40 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-05-22 23:40:56 +00:00
|
|
|
KeyframeAnim *ResourceLoader::loadKeyframe(const Common::String &filename) {
|
2011-12-18 23:17:31 +00:00
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
|
|
|
stream = openNewStreamFile(filename.c_str());
|
2013-07-09 19:12:55 +00:00
|
|
|
if (!stream)
|
2011-12-18 23:17:31 +00:00
|
|
|
error("Could not find keyframe file %s", filename.c_str());
|
2003-08-15 18:00:22 +00:00
|
|
|
|
2011-12-18 23:17:31 +00:00
|
|
|
KeyframeAnim *result = new KeyframeAnim(filename, stream);
|
2011-03-20 21:16:27 +00:00
|
|
|
_keyframeAnims.push_back(result);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2009-05-12 14:31:48 +00:00
|
|
|
|
2004-02-24 22:43:32 +00:00
|
|
|
return result;
|
2003-08-15 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2011-05-22 23:40:56 +00:00
|
|
|
LipSync *ResourceLoader::loadLipSync(const Common::String &filename) {
|
2009-04-21 18:04:24 +00:00
|
|
|
LipSync *result;
|
2011-12-15 21:54:39 +00:00
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
|
|
|
stream = openNewStreamFile(filename.c_str());
|
2013-07-09 19:12:55 +00:00
|
|
|
if (!stream)
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2009-05-09 17:47:28 +00:00
|
|
|
|
2011-12-15 21:54:39 +00:00
|
|
|
result = new LipSync(filename, stream);
|
2009-06-27 06:47:18 +00:00
|
|
|
|
|
|
|
// Some lipsync files have no data
|
2011-12-15 21:54:39 +00:00
|
|
|
if (result->isValid())
|
2011-03-20 21:16:27 +00:00
|
|
|
_lipsyncs.push_back(result);
|
2011-12-15 21:54:39 +00:00
|
|
|
else {
|
2009-06-27 06:47:18 +00:00
|
|
|
delete result;
|
2014-05-29 22:35:46 +00:00
|
|
|
result = nullptr;
|
2009-05-09 17:47:28 +00:00
|
|
|
}
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2004-09-11 14:09:43 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2014-06-18 01:58:21 +00:00
|
|
|
Material *ResourceLoader::loadMaterial(const Common::String &filename, CMap *c, bool clamp) {
|
2011-06-02 18:19:23 +00:00
|
|
|
Common::String fname = fixFilename(filename, false);
|
2011-05-16 16:28:03 +00:00
|
|
|
fname.toLowercase();
|
2011-12-19 13:49:31 +00:00
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
2011-12-21 10:00:08 +00:00
|
|
|
stream = openNewStreamFile(fname.c_str(), true);
|
2014-06-30 20:46:50 +00:00
|
|
|
if (!stream && !filename.hasPrefix("specialty")) {
|
2012-09-09 13:39:28 +00:00
|
|
|
// FIXME: EMI demo references files that aren't included. Return a known material.
|
|
|
|
// This should be fixed in the data files instead.
|
|
|
|
if (g_grim->getGameType() == GType_MONKEY4 && g_grim->getGameFlags() & ADGF_DEMO) {
|
|
|
|
const Common::String replacement("fx/candle.sprb");
|
|
|
|
warning("Could not find material %s, using %s instead", filename.c_str(), replacement.c_str());
|
2014-06-18 01:58:21 +00:00
|
|
|
return loadMaterial(replacement, nullptr, clamp);
|
2013-12-08 19:37:59 +00:00
|
|
|
} else {
|
|
|
|
error("Could not find material %s", filename.c_str());
|
2012-09-09 13:39:28 +00:00
|
|
|
}
|
2012-08-13 22:05:33 +00:00
|
|
|
}
|
2022-10-16 20:43:20 +00:00
|
|
|
if (!stream) {
|
|
|
|
// Specialty materials are not loaded from files.
|
|
|
|
if (!filename.hasPrefix("specialty")) {
|
|
|
|
error("Couldn't open %s", fname.c_str());
|
|
|
|
}
|
|
|
|
}
|
2003-08-15 18:00:22 +00:00
|
|
|
|
2014-06-18 01:58:21 +00:00
|
|
|
Material *result = new Material(fname, stream, c, clamp);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2011-05-16 17:07:34 +00:00
|
|
|
|
2004-02-24 22:43:32 +00:00
|
|
|
return result;
|
2003-08-15 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2011-07-18 21:43:01 +00:00
|
|
|
Model *ResourceLoader::loadModel(const Common::String &filename, CMap *c, Model *parent) {
|
2011-05-09 08:00:01 +00:00
|
|
|
Common::String fname = fixFilename(filename);
|
2011-12-19 17:26:48 +00:00
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
|
|
|
stream = openNewStreamFile(fname.c_str());
|
2013-07-09 19:12:55 +00:00
|
|
|
if (!stream)
|
2011-12-19 17:26:48 +00:00
|
|
|
error("Could not find model %s", filename.c_str());
|
2003-08-15 18:00:22 +00:00
|
|
|
|
2011-12-19 17:26:48 +00:00
|
|
|
Model *result = new Model(filename, stream, c, parent);
|
2011-03-20 21:16:27 +00:00
|
|
|
_models.push_back(result);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2011-05-16 17:07:34 +00:00
|
|
|
|
2009-05-12 14:31:48 +00:00
|
|
|
return result;
|
2005-07-17 23:40:22 +00:00
|
|
|
}
|
2011-12-30 15:41:52 +00:00
|
|
|
|
2013-12-22 20:29:58 +00:00
|
|
|
EMIModel *ResourceLoader::loadModelEMI(const Common::String &filename, EMICostume *costume) {
|
2011-12-30 11:39:45 +00:00
|
|
|
Common::String fname = fixFilename(filename);
|
2011-12-30 15:41:52 +00:00
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
|
|
|
stream = openNewStreamFile(fname.c_str());
|
2013-07-09 19:12:55 +00:00
|
|
|
if (!stream) {
|
2011-12-30 15:41:52 +00:00
|
|
|
warning("Could not find model %s", filename.c_str());
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2011-12-30 11:39:45 +00:00
|
|
|
}
|
2011-12-30 15:41:52 +00:00
|
|
|
|
2013-12-22 20:29:58 +00:00
|
|
|
EMIModel *result = new EMIModel(filename, stream, costume);
|
2011-12-30 11:39:45 +00:00
|
|
|
_emiModels.push_back(result);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2011-12-30 15:41:52 +00:00
|
|
|
|
2011-12-30 11:39:45 +00:00
|
|
|
return result;
|
|
|
|
}
|
2005-07-17 23:40:22 +00:00
|
|
|
|
2011-12-30 14:10:32 +00:00
|
|
|
Skeleton *ResourceLoader::loadSkeleton(const Common::String &filename) {
|
|
|
|
Common::String fname = fixFilename(filename);
|
2011-12-30 15:41:52 +00:00
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
2011-12-21 10:00:08 +00:00
|
|
|
stream = openNewStreamFile(fname.c_str(), true);
|
2013-07-09 19:12:55 +00:00
|
|
|
if (!stream) {
|
2011-12-30 15:41:52 +00:00
|
|
|
warning("Could not find skeleton %s", filename.c_str());
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2011-12-30 14:10:32 +00:00
|
|
|
}
|
2011-12-30 15:41:52 +00:00
|
|
|
|
|
|
|
Skeleton *result = new Skeleton(filename, stream);
|
2012-01-20 20:06:01 +00:00
|
|
|
delete stream;
|
2011-12-30 15:41:52 +00:00
|
|
|
|
2011-12-30 14:10:32 +00:00
|
|
|
return result;
|
|
|
|
}
|
2011-12-30 15:41:52 +00:00
|
|
|
|
2013-07-08 00:23:27 +00:00
|
|
|
Sprite *ResourceLoader::loadSprite(const Common::String &filename, EMICostume *costume) {
|
2012-11-21 21:56:27 +00:00
|
|
|
assert(g_grim->getGameType() == GType_MONKEY4);
|
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
|
|
|
const Common::String fname = fixFilename(filename, true);
|
|
|
|
|
|
|
|
stream = openNewStreamFile(fname.c_str(), true);
|
2013-07-09 19:12:55 +00:00
|
|
|
if (!stream) {
|
2012-11-21 21:56:27 +00:00
|
|
|
warning("Could not find sprite %s", fname.c_str());
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2012-11-21 21:56:27 +00:00
|
|
|
}
|
|
|
|
|
2013-07-08 00:23:27 +00:00
|
|
|
Sprite *result = new Sprite();
|
|
|
|
result->loadBinary(stream, costume);
|
2012-11-21 21:56:27 +00:00
|
|
|
delete stream;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2012-01-30 21:24:09 +00:00
|
|
|
AnimationEmi *ResourceLoader::loadAnimationEmi(const Common::String &filename) {
|
|
|
|
Common::String fname = fixFilename(filename);
|
|
|
|
Common::SeekableReadStream *stream;
|
2013-07-09 19:12:55 +00:00
|
|
|
|
2012-01-30 21:24:09 +00:00
|
|
|
stream = openNewStreamFile(fname.c_str(), true);
|
2013-07-09 19:12:55 +00:00
|
|
|
if (!stream) {
|
2012-01-30 23:57:35 +00:00
|
|
|
warning("Could not find animation %s", filename.c_str());
|
2014-05-29 22:35:46 +00:00
|
|
|
return nullptr;
|
2012-01-30 21:24:09 +00:00
|
|
|
}
|
2013-07-09 19:12:55 +00:00
|
|
|
|
2012-01-30 21:24:09 +00:00
|
|
|
AnimationEmi *result = new AnimationEmi(filename, stream);
|
2014-05-28 11:49:11 +00:00
|
|
|
_emiAnims.push_back(result);
|
2012-01-30 21:24:09 +00:00
|
|
|
delete stream;
|
2012-02-01 01:12:59 +00:00
|
|
|
|
2012-01-30 21:24:09 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2015-01-29 04:44:27 +00:00
|
|
|
Overlay *ResourceLoader::loadOverlay(const Common::String &filename) {
|
|
|
|
Common::String fname = fixFilename(filename);
|
|
|
|
Common::SeekableReadStream *stream;
|
|
|
|
|
|
|
|
stream = openNewStreamFile(fname.c_str(), true);
|
|
|
|
if (!stream) {
|
|
|
|
warning("Could not find overlay %s", filename.c_str());
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
Overlay *result = new Overlay(filename, stream);
|
|
|
|
delete stream;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2012-04-11 12:23:08 +00:00
|
|
|
void ResourceLoader::uncache(const char *filename) const {
|
2009-05-10 16:43:41 +00:00
|
|
|
Common::String fname = filename;
|
|
|
|
fname.toLowercase();
|
2009-05-12 14:31:48 +00:00
|
|
|
|
2009-05-12 18:47:34 +00:00
|
|
|
if (_cacheDirty) {
|
2009-05-12 14:31:48 +00:00
|
|
|
qsort(_cache.begin(), _cache.size(), sizeof(ResourceCache), sortCallback);
|
2009-05-12 18:47:34 +00:00
|
|
|
_cacheDirty = false;
|
|
|
|
}
|
2009-05-12 14:31:48 +00:00
|
|
|
|
|
|
|
for (unsigned int i = 0; i < _cache.size(); i++) {
|
|
|
|
if (fname.compareTo(_cache[i].fname) == 0) {
|
|
|
|
delete[] _cache[i].fname;
|
2011-12-21 10:00:08 +00:00
|
|
|
_cacheMemorySize -= _cache[i].len;
|
|
|
|
delete[] _cache[i].resPtr;
|
2009-05-12 14:31:48 +00:00
|
|
|
_cache.remove_at(i);
|
|
|
|
_cacheDirty = true;
|
|
|
|
}
|
|
|
|
}
|
2003-08-15 18:00:22 +00:00
|
|
|
}
|
2009-05-25 06:49:57 +00:00
|
|
|
|
2011-03-20 21:16:27 +00:00
|
|
|
void ResourceLoader::uncacheModel(Model *m) {
|
|
|
|
_models.remove(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourceLoader::uncacheColormap(CMap *c) {
|
|
|
|
_colormaps.remove(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourceLoader::uncacheKeyframe(KeyframeAnim *k) {
|
|
|
|
_keyframeAnims.remove(k);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourceLoader::uncacheLipSync(LipSync *s) {
|
|
|
|
_lipsyncs.remove(s);
|
|
|
|
}
|
|
|
|
|
2014-05-28 11:49:11 +00:00
|
|
|
void ResourceLoader::uncacheAnimationEmi(AnimationEmi *a) {
|
|
|
|
_emiAnims.remove(a);
|
|
|
|
}
|
|
|
|
|
2011-05-22 23:40:56 +00:00
|
|
|
ModelPtr ResourceLoader::getModel(const Common::String &fname, CMap *c) {
|
2011-05-14 18:24:53 +00:00
|
|
|
Common::String filename = fname;
|
|
|
|
filename.toLowercase();
|
2011-03-20 21:16:27 +00:00
|
|
|
for (Common::List<Model *>::const_iterator i = _models.begin(); i != _models.end(); ++i) {
|
|
|
|
Model *m = *i;
|
2012-04-25 00:21:18 +00:00
|
|
|
if (filename == m->getFilename() && *m->getCMap() == *c) {
|
2011-03-20 21:16:27 +00:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return loadModel(fname, c);
|
|
|
|
}
|
|
|
|
|
2011-05-22 23:40:56 +00:00
|
|
|
CMapPtr ResourceLoader::getColormap(const Common::String &fname) {
|
2011-05-14 18:24:53 +00:00
|
|
|
Common::String filename = fname;
|
|
|
|
filename.toLowercase();
|
2011-03-20 21:16:27 +00:00
|
|
|
for (Common::List<CMap *>::const_iterator i = _colormaps.begin(); i != _colormaps.end(); ++i) {
|
|
|
|
CMap *c = *i;
|
2011-05-14 18:24:53 +00:00
|
|
|
if (filename.equals(c->_fname)) {
|
2011-03-20 21:16:27 +00:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return loadColormap(fname);
|
|
|
|
}
|
|
|
|
|
2011-05-22 23:40:56 +00:00
|
|
|
KeyframeAnimPtr ResourceLoader::getKeyframe(const Common::String &fname) {
|
2011-05-14 18:24:53 +00:00
|
|
|
Common::String filename = fname;
|
|
|
|
filename.toLowercase();
|
2011-03-20 21:16:27 +00:00
|
|
|
for (Common::List<KeyframeAnim *>::const_iterator i = _keyframeAnims.begin(); i != _keyframeAnims.end(); ++i) {
|
|
|
|
KeyframeAnim *k = *i;
|
2011-05-22 04:02:20 +00:00
|
|
|
if (filename == k->getFilename()) {
|
2011-03-20 21:16:27 +00:00
|
|
|
return k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return loadKeyframe(fname);
|
|
|
|
}
|
|
|
|
|
2011-05-22 23:40:56 +00:00
|
|
|
LipSyncPtr ResourceLoader::getLipSync(const Common::String &fname) {
|
2011-05-14 18:24:53 +00:00
|
|
|
Common::String filename = fname;
|
|
|
|
filename.toLowercase();
|
2011-03-20 21:16:27 +00:00
|
|
|
for (Common::List<LipSync *>::const_iterator i = _lipsyncs.begin(); i != _lipsyncs.end(); ++i) {
|
|
|
|
LipSync *l = *i;
|
2011-05-22 23:40:56 +00:00
|
|
|
if (filename == l->getFilename()) {
|
2011-03-20 21:16:27 +00:00
|
|
|
return l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return loadLipSync(fname);
|
|
|
|
}
|
|
|
|
|
2014-05-28 11:49:11 +00:00
|
|
|
AnimationEmiPtr ResourceLoader::getAnimationEmi(const Common::String &fname) {
|
|
|
|
Common::String filename = fname;
|
|
|
|
filename.toLowercase();
|
|
|
|
for (Common::List<AnimationEmi *>::const_iterator i = _emiAnims.begin(); i != _emiAnims.end(); ++i) {
|
|
|
|
AnimationEmi *a = *i;
|
|
|
|
if (filename == a->getFilename()) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return loadAnimationEmi(fname);
|
|
|
|
}
|
|
|
|
|
2009-05-25 06:49:57 +00:00
|
|
|
} // end of namespace Grim
|