scummvm/engines/nancy/resource.h

92 lines
2.8 KiB
C
Raw Normal View History

2012-10-07 17:25:52 +02:00
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef NANCY_RESOURCE_H
#define NANCY_RESOURCE_H
2021-01-04 23:16:23 +02:00
#include "common/array.h"
2012-10-07 17:25:52 +02:00
namespace Graphics {
struct Surface;
class ManagedSurface;
2012-10-07 17:25:52 +02:00
}
namespace Nancy {
class NancyEngine;
2012-10-07 23:19:37 +02:00
class CifTree;
2012-10-11 21:24:50 +02:00
class Decompressor;
2012-10-07 17:25:52 +02:00
class ResourceManager {
public:
2012-10-07 19:42:17 +02:00
enum ResType {
kResTypeAny,
2012-10-09 14:16:32 +02:00
// Type 1 seems to be obsolete
2012-10-07 19:42:17 +02:00
kResTypeImage = 2,
2012-10-13 13:39:08 +02:00
kResTypeScript
2012-10-07 19:42:17 +02:00
};
enum ResCompression {
kResCompressionNone = 1,
kResCompression
};
2012-10-07 23:19:37 +02:00
struct CifInfo {
Common::String name;
byte type; // ResType
byte comp; // ResCompression
uint16 width, pitch, height;
byte depth; // Bit depth
2012-10-09 14:16:32 +02:00
uint32 compressedSize, size;
2012-10-07 23:19:37 +02:00
};
ResourceManager();
2012-10-07 17:25:52 +02:00
~ResourceManager();
void initialize();
bool loadCifTree(const Common::String &name, const Common::String &ext);
bool loadImage(const Common::String &name, Graphics::Surface &surf);
bool loadImage(const Common::String &name, Graphics::ManagedSurface &surf);
2015-07-06 09:32:40 +02:00
void freeImage(Graphics::Surface &surf);
byte *loadData(const Common::String &name, uint &size);
2012-10-07 17:25:52 +02:00
// Debugger functions
void list(const Common::String &treeName, Common::Array<Common::String> &nameList, uint type) const;
byte *loadCif(const Common::String &treeName, const Common::String &name, uint &size);
2012-10-13 13:15:00 +02:00
bool exportCif(const Common::String &treeName, const Common::String &name);
Common::String getCifDescription(const Common::String &treeName, const Common::String &name) const;
2012-10-07 17:25:52 +02:00
private:
byte *getCifData(const Common::String &name, CifInfo &info, uint *size = nullptr) const;
byte *getCifData(const Common::String &treeName, const Common::String &name, CifInfo &info, uint *size = nullptr) const;
bool getCifInfo(const Common::String &name, CifInfo &info) const;
bool getCifInfo(const Common::String &treeName, const Common::String &name, CifInfo &info) const;
const CifTree *findCifTree(const Common::String &name) const;
Common::Array<const CifTree *> _cifTrees;
Decompressor *_dec;
2012-10-07 17:25:52 +02:00
};
} // End of namespace Nancy
#endif // NANCY_RESOURCE_H