1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

large filesystem update. Filesysytem is now fully functional, everything should work.

- completely replaced CLodHandler, removed bitmaph and spriteh
- replaced CLodStream in favour of CCompressedStream (2 new files)
- renamed CResourceLoaderFactory and ResourceIndetifier to shorter names
NOTES:
- campaign loading is currently broken. Will fix.
- I am going to remove several unused files in several days (e.g. LodHandler)
This commit is contained in:
Ivan Savenko
2012-08-01 12:02:54 +00:00
parent 17a513c01b
commit b3c17d2788
55 changed files with 1319 additions and 767 deletions

View File

@ -1,6 +1,7 @@
#include "StdInc.h"
#include <SDL_image.h>
#include "../lib/Filesystem/CResourceLoader.h"
#include "../lib/CLodHandler.h"
#include "../lib/JsonNode.h"
#include "../lib/vcmi_endian.h"
@ -21,9 +22,6 @@
*
*/
extern DLL_LINKAGE CLodHandler *spriteh;
extern DLL_LINKAGE CLodHandler *bitmaph;
typedef std::map <size_t, std::vector <JsonNode> > source_map;
typedef std::map<size_t, IImage* > image_map;
typedef std::map<size_t, image_map > group_map;
@ -90,8 +88,9 @@ CDefFile::CDefFile(std::string Name):
{ 0, 0, 0, 128},// 50% - shadow body below selection
{ 0, 0, 0, 192} // 75% - shadow border below selection
};
data = CResourceHandler::get()->loadData(
ResourceID(std::string("SPRITES/") + Name, EResType::ANIMATION)).first.release();
data = spriteh->giveFile(Name, FILE_ANIMATION);
palette = new SDL_Color[256];
int it = 0;
@ -936,13 +935,13 @@ void CAnimation::init(CDefFile * file)
source[mapIt->first].resize(mapIt->second);
}
if (spriteh->haveFile(name, FILE_TEXT))
{
int size = 0;
ui8 * configFile = spriteh->giveFile(name, FILE_TEXT, &size);
ResourceID identifier(std::string("SPRITES/") + name, EResType::TEXT);
const JsonNode config((char*)configFile, size);
delete[] configFile;
if (CResourceHandler::get()->existsResource(identifier))
{
auto configFile = CResourceHandler::get()->loadData(identifier);
const JsonNode config((char*)configFile.first.get(), configFile.second);
std::string basepath;
basepath = config["basepath"].String();
@ -977,7 +976,9 @@ void CAnimation::init(CDefFile * file)
CDefFile * CAnimation::getFile() const
{
if (spriteh->haveFile(name, FILE_ANIMATION))
ResourceID identifier(std::string("SPRITES/") + name, EResType::ANIMATION);
if (CResourceHandler::get()->existsResource(identifier))
return new CDefFile(name);
return NULL;
}