remove rest std:: and some cleanup
This commit is contained in:
parent
04fc75f19a
commit
994816a1f7
15 changed files with 92 additions and 126 deletions
|
@ -504,7 +504,7 @@ void Actor::update() {
|
|||
// have the actor turn all the way to the destination yaw.
|
||||
// Without this some actors will lock the interface on changing
|
||||
// scenes, this affects the Bone Wagon in particular.
|
||||
if (turnAmt == 0 || turnAmt >= std::abs(dyaw)) {
|
||||
if (turnAmt == 0 || turnAmt >= abs(dyaw)) {
|
||||
setYaw(_destYaw);
|
||||
_turning = false;
|
||||
}
|
||||
|
|
|
@ -158,8 +158,8 @@ public:
|
|||
void setHead( int joint1, int joint2, int joint3, float maxRoll, float maxPitch, float maxYaw);
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
std::string _setName; // The actual current set
|
||||
Common::String _name;
|
||||
Common::String _setName; // The actual current set
|
||||
Color _talkColor;
|
||||
Vector3d _pos;
|
||||
float _pitch, _yaw, _roll;
|
||||
|
|
|
@ -26,18 +26,17 @@
|
|||
#ifndef COLORMAP_H
|
||||
#define COLORMAP_H
|
||||
|
||||
#include "engine/resource.h"
|
||||
#include "common/endian.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "engine/resource.h"
|
||||
|
||||
class CMap : public Resource {
|
||||
public:
|
||||
// Load a colormap from the given data.
|
||||
CMap(const char *filename, const char *data, int len) :
|
||||
Resource(filename) {
|
||||
if (len < 4 || std::memcmp(data, "CMP ", 4) != 0)
|
||||
CMap(const char *filename, const char *data, int len) : Resource(filename) {
|
||||
if (len < 4 || READ_BE_UINT32(data) != MKID_BE('CMP '))
|
||||
error("Invalid magic loading colormap");
|
||||
std::memcpy(_colors, data + 64, sizeof(_colors));
|
||||
memcpy(_colors, data + 64, sizeof(_colors));
|
||||
}
|
||||
|
||||
// The color data, in RGB format
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
void setKey(int val);
|
||||
|
||||
private:
|
||||
std::string _filename;
|
||||
Common::String _filename;
|
||||
};
|
||||
|
||||
class ColormapComponent : public Costume::Component {
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
void draw();
|
||||
|
||||
protected:
|
||||
std::string _filename;
|
||||
Common::String _filename;
|
||||
ResPtr<Model> _obj;
|
||||
Model::HierNode *_hier;
|
||||
Matrix4 _matrix;
|
||||
|
@ -164,7 +164,7 @@ public:
|
|||
Model::HierNode *node() { return _node; }
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
Common::String _name;
|
||||
int _num;
|
||||
Model::HierNode *_node;
|
||||
Matrix4 _matrix;
|
||||
|
@ -206,14 +206,14 @@ void BitmapComponent::setKey(int val) {
|
|||
ModelComponent::ModelComponent(Costume::Component *parent, int parentID, const char *filename, Costume::Component *prevComponent, tag32 tag) :
|
||||
Costume::Component(parent, parentID, tag), _filename(filename),
|
||||
_obj(NULL), _hier(NULL) {
|
||||
const char *comma = std::strchr(filename, ',');
|
||||
const char *comma = strchr(filename, ',');
|
||||
|
||||
// Can be called with a comma and a numeric parameter afterward, but
|
||||
// the use for this parameter is currently unknown
|
||||
// Example: At the "scrimshaw parlor" in Rubacava the object
|
||||
// "manny_cafe.3do,1" is requested
|
||||
if (comma) {
|
||||
_filename = std::string(filename, comma);
|
||||
_filename = Common::String(filename, comma);
|
||||
warning("Comma in model components not supported: %s", filename);
|
||||
} else {
|
||||
_filename = filename;
|
||||
|
@ -375,7 +375,7 @@ public:
|
|||
|
||||
private:
|
||||
ResPtr<Material> _mat;
|
||||
std::string _filename;
|
||||
Common::String _filename;
|
||||
int _num;
|
||||
};
|
||||
|
||||
|
@ -412,11 +412,11 @@ private:
|
|||
|
||||
KeyframeComponent::KeyframeComponent(Costume::Component *parent, int parentID, const char *filename, tag32 tag) :
|
||||
Costume::Component(parent, parentID, tag), _priority1(1), _priority2(5), _hier(NULL), _active(false) {
|
||||
const char *comma = std::strchr(filename, ',');
|
||||
const char *comma = strchr(filename, ',');
|
||||
if (comma) {
|
||||
std::string realName(filename, comma);
|
||||
Common::String realName(filename, comma);
|
||||
_keyf = g_resourceloader->loadKeyframe(realName.c_str());
|
||||
std::sscanf(comma + 1, "%d,%d", &_priority1, &_priority2);
|
||||
sscanf(comma + 1, "%d,%d", &_priority1, &_priority2);
|
||||
} else
|
||||
_keyf = g_resourceloader->loadKeyframe(filename);
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ void KeyframeComponent::init() {
|
|||
|
||||
MeshComponent::MeshComponent(Costume::Component *parent, int parentID, const char *name, tag32 tag) :
|
||||
Costume::Component(parent, parentID, tag), _name(name), _node(NULL) {
|
||||
if (std::sscanf(name, "mesh %d", &_num) < 1)
|
||||
if (sscanf(name, "mesh %d", &_num) < 1)
|
||||
error("Couldn't parse mesh name %s", name);
|
||||
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ public:
|
|||
~LuaVarComponent() { }
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
Common::String _name;
|
||||
};
|
||||
|
||||
LuaVarComponent::LuaVarComponent(Costume::Component *parent, int parentID, const char *name, tag32 tag) :
|
||||
|
@ -584,14 +584,14 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
std::string _soundName;
|
||||
Common::String _soundName;
|
||||
};
|
||||
|
||||
SoundComponent::SoundComponent(Costume::Component *parent, int parentID, const char *filename, tag32 tag) :
|
||||
Costume::Component(parent, parentID, tag) {
|
||||
const char *comma = std::strchr(filename, ',');
|
||||
const char *comma = strchr(filename, ',');
|
||||
if (comma) {
|
||||
_soundName = std::string(filename, comma);
|
||||
_soundName = Common::String(filename, comma);
|
||||
} else {
|
||||
_soundName = filename;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ Costume::Costume(const char *filename, const char *data, int len, Costume *prevC
|
|||
// Force characters to upper case
|
||||
for (int j = 0; j < 4; j++)
|
||||
t[j] = toupper(t[j]);
|
||||
std::memcpy(&tags[which], t, sizeof(tag32));
|
||||
memcpy(&tags[which], t, sizeof(tag32));
|
||||
}
|
||||
|
||||
ts.expectString("section components");
|
||||
|
@ -655,7 +655,7 @@ Costume::Costume(const char *filename, const char *data, int len, Costume *prevC
|
|||
const char *line = ts.currentLine();
|
||||
Component *prevComponent = NULL;
|
||||
|
||||
if (std::sscanf(line, " %d %d %d %d %n", &id, &tagID, &hash, &parentID, &namePos) < 4)
|
||||
if (sscanf(line, " %d %d %d %d %n", &id, &tagID, &hash, &parentID, &namePos) < 4)
|
||||
error("Bad component specification line: `%s'", line);
|
||||
ts.nextLine();
|
||||
|
||||
|
@ -699,7 +699,7 @@ Costume::Costume(const char *filename, const char *data, int len, Costume *prevC
|
|||
ts.scanString(" %d %d %d %32s", 4, &id, &length, &tracks, name);
|
||||
_chores[id]._length = length;
|
||||
_chores[id]._numTracks = tracks;
|
||||
std::memcpy(_chores[id]._name, name, 32);
|
||||
memcpy(_chores[id]._name, name, 32);
|
||||
if(debugLevel == DEBUG_ALL || debugLevel == DEBUG_CHORES)
|
||||
printf("Loaded chore: %s\n", name);
|
||||
}
|
||||
|
@ -908,7 +908,7 @@ Costume::Component *Costume::loadComponent (tag32 tag, Costume::Component *paren
|
|||
return NULL;// new SpriteComponent(parent, parentID, name);
|
||||
|
||||
char t[4];
|
||||
std::memcpy(t, &tag, sizeof(tag32));
|
||||
memcpy(t, &tag, sizeof(tag32));
|
||||
error("loadComponent: Unknown tag '%c%c%c%c', name '%s'", t[0], t[1], t[2], t[3], name);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
|
||||
private:
|
||||
Component *loadComponent(tag32 tag, Component *parent, int parentID, const char *name, Component *prevComponent);
|
||||
std::string _fname;
|
||||
Common::String _fname;
|
||||
|
||||
int _numComponents;
|
||||
Component **_components;
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
const char *sceneName() const { return _currScene->name(); }
|
||||
|
||||
// Scene registration
|
||||
typedef std::list<Scene *> SceneListType;
|
||||
typedef Common::List<Scene *> SceneListType;
|
||||
SceneListType::const_iterator scenesBegin() const {
|
||||
return _scenes.begin();
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
}
|
||||
|
||||
// Actor registration
|
||||
typedef std::list<Actor *> ActorListType;
|
||||
typedef Common::List<Actor *> ActorListType;
|
||||
ActorListType::const_iterator actorsBegin() const {
|
||||
return _actors.begin();
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
Actor *selectedActor() { return _selectedActor; }
|
||||
|
||||
// Text Object Registration
|
||||
typedef std::list<TextObject *> TextListType;
|
||||
typedef Common::List<TextObject *> TextListType;
|
||||
TextListType::const_iterator textsBegin() const {
|
||||
return _textObjects.begin();
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
}
|
||||
|
||||
// Primitives Object Registration
|
||||
typedef std::list<PrimitiveObject *> PrimitiveListType;
|
||||
typedef Common::List<PrimitiveObject *> PrimitiveListType;
|
||||
PrimitiveListType::const_iterator primitivesBegin() const {
|
||||
return _primitiveObjects.begin();
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
#include "engine/imuse/imuse_sndmgr.h"
|
||||
#include "engine/imuse/imuse_mcmp_mgr.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
ImuseSndMgr::ImuseSndMgr() {
|
||||
for (int l = 0; l < MAX_IMUSE_SOUNDS; l++) {
|
||||
memset(&_sounds[l], 0, sizeof(SoundDesc));
|
||||
|
@ -158,7 +156,7 @@ ImuseSndMgr::SoundDesc *ImuseSndMgr::allocSlot() {
|
|||
}
|
||||
|
||||
ImuseSndMgr::SoundDesc *ImuseSndMgr::openSound(const char *soundName, int volGroupId) {
|
||||
const char *extension = soundName + std::strlen(soundName) - 3;
|
||||
const char *extension = soundName + strlen(soundName) - 3;
|
||||
byte *ptr = NULL;
|
||||
int headerSize = 0;
|
||||
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
#include "engine/keyframe.h"
|
||||
#include "engine/textsplit.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
KeyframeAnim::KeyframeAnim(const char *filename, const char *data, int len) :
|
||||
Resource(filename) {
|
||||
|
||||
if (len >= 4 && std::memcmp(data, "FYEK", 4) == 0)
|
||||
if (len >= 4 && READ_BE_UINT32(data) == MKID_BE('FYEK'))
|
||||
loadBinary(data, len);
|
||||
else {
|
||||
TextSplitter ts(data, len);
|
||||
|
@ -110,7 +108,7 @@ void KeyframeAnim::loadText(TextSplitter &ts) {
|
|||
ts.scanString("fps %f", 1, &_fps);
|
||||
ts.scanString("joints %d", 1, &_numJoints);
|
||||
|
||||
if (std::strcmp(ts.currentLine(), "section: markers") == 0) {
|
||||
if (strcasecmp(ts.currentLine(), "section: markers") == 0) {
|
||||
ts.nextLine();
|
||||
ts.scanString("markers %d", 1, &_numMarkers);
|
||||
_markers = new Marker[_numMarkers];
|
||||
|
@ -171,9 +169,9 @@ void KeyframeAnim::KeyframeNode::loadBinary(const char *&data) {
|
|||
// If the name handle is entirely null (like ma_rest.key)
|
||||
// then we shouldn't try to set the name
|
||||
if (READ_LE_UINT32(data) == 0)
|
||||
std::memcpy(_meshName, "(null)", 32);
|
||||
memcpy(_meshName, "(null)", 32);
|
||||
else
|
||||
std::memcpy(_meshName, data, 32);
|
||||
memcpy(_meshName, data, 32);
|
||||
_numEntries = READ_LE_UINT32(data + 36);
|
||||
data += 44;
|
||||
_entries = new KeyframeEntry[_numEntries];
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
#include "engine/lipsync.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
// A new define that'll be around when theres a configure script :)
|
||||
#undef DEBUG_VERBOSE
|
||||
|
||||
|
@ -37,7 +35,7 @@ LipSync::LipSync(const char *filename, const char *data, int len) :
|
|||
uint16 readPhoneme;
|
||||
int j;
|
||||
|
||||
if (std::memcmp(data, "LIP!", 4) != 0) {
|
||||
if (READ_BE_UINT32(data) != MKID_BE('LIP!')) {
|
||||
error("Invalid file format in %s", filename);
|
||||
} else {
|
||||
_numEntries = (len - 8) / 4;
|
||||
|
|
|
@ -38,12 +38,6 @@
|
|||
#include "engine/lua/lauxlib.h"
|
||||
#include "engine/imuse/imuse.h"
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#include <zlib\zlib.h>
|
||||
#else
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
extern Imuse *g_imuse;
|
||||
|
||||
Common::StringList g_listfiles;
|
||||
|
@ -219,32 +213,27 @@ static void new_dofile() {
|
|||
static void PrintDebug() {
|
||||
DEBUG_FUNCTION();
|
||||
if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL) {
|
||||
std::string msg = luaL_check_string(1);
|
||||
|
||||
msg.insert(0, "Debug: ");
|
||||
msg.append("\n");
|
||||
std::fputs(msg.c_str(), stderr);
|
||||
Common::String msg("Debug: ");
|
||||
msg += Common::String(luaL_check_string(1)) + "\n";
|
||||
printf(msg.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
static void PrintError() {
|
||||
DEBUG_FUNCTION();
|
||||
if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL) {
|
||||
std::string msg = luaL_check_string(1);
|
||||
|
||||
msg.insert(0, "Error: ");
|
||||
// don't do 'error()' so we can stay alive if possible
|
||||
std::fputs(msg.c_str(), stderr);
|
||||
Common::String msg("Error: ");
|
||||
msg += Common::String(luaL_check_string(1)) + "\n";
|
||||
printf(msg.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
static void PrintWarning() {
|
||||
DEBUG_FUNCTION();
|
||||
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL) {
|
||||
std::string msg = luaL_check_string(1);
|
||||
|
||||
msg.insert(0, "Warning: ");
|
||||
warning(msg.c_str());
|
||||
Common::String msg("Warning: ");
|
||||
msg += Common::String(luaL_check_string(1)) + "\n";
|
||||
printf(msg.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2421,7 +2410,7 @@ static void MakeTextObject() {
|
|||
|
||||
DEBUG_FUNCTION();
|
||||
line = lua_getstring(lua_getparam(1));
|
||||
std::string text = line;
|
||||
Common::String text = line;
|
||||
tableObj = lua_getparam(2);
|
||||
textObject->setDefaults(&blastTextDefaults);
|
||||
|
||||
|
@ -2479,7 +2468,7 @@ static void BlastText() {
|
|||
|
||||
DEBUG_FUNCTION();
|
||||
line = lua_getstring(lua_getparam(1));
|
||||
std::string text = line;
|
||||
Common::String text = line;
|
||||
tableObj = lua_getparam(2);
|
||||
textObject->setDefaults(&blastTextDefaults);
|
||||
|
||||
|
@ -3829,7 +3818,7 @@ int bundle_dofile(const char *filename) {
|
|||
delete b;
|
||||
// Don't print warnings on Scripts\foo.lua,
|
||||
// d:\grimFandango\Scripts\foo.lua
|
||||
if (!std::strstr(filename, "Scripts\\") && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL))
|
||||
if (!strstr(filename, "Scripts\\") && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL))
|
||||
warning("Cannot find script %s", filename);
|
||||
|
||||
return 2;
|
||||
|
|
|
@ -31,12 +31,10 @@
|
|||
#include "engine/textsplit.h"
|
||||
#include "engine/gfx_base.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
Model::Model(const char *filename, const char *data, int len, const CMap &cmap) :
|
||||
Resource(filename), _numMaterials(0), _numGeosets(0) {
|
||||
|
||||
if (len >= 4 && std::memcmp(data, "LDOM", 4) == 0)
|
||||
if (len >= 4 && READ_BE_UINT32(data) == MKID_BE('LDOM'))
|
||||
loadBinary(data, cmap);
|
||||
else {
|
||||
TextSplitter ts(data, len);
|
||||
|
@ -248,7 +246,7 @@ void Model::draw() const {
|
|||
|
||||
Model::HierNode *Model::copyHierarchy() {
|
||||
HierNode *result = new HierNode[_numHierNodes];
|
||||
std::memcpy(result, _rootHierNode, _numHierNodes * sizeof(HierNode));
|
||||
memcpy(result, _rootHierNode, _numHierNodes * sizeof(HierNode));
|
||||
// Now adjust pointers
|
||||
for (int i = 0; i < _numHierNodes; i++) {
|
||||
if (result[i]._parent)
|
||||
|
@ -361,7 +359,7 @@ void Model::Mesh::loadText(TextSplitter &ts, ResPtr<Material> *materials) {
|
|||
ts.scanString("radius %f", 1, &_radius);
|
||||
|
||||
// In data001/rope_scale.3do, the shadow line is missing
|
||||
if (std::sscanf(ts.currentLine(), "shadow %d", &_shadow) < 1) {
|
||||
if (sscanf(ts.currentLine(), "shadow %d", &_shadow) < 1) {
|
||||
_shadow = 0;
|
||||
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
|
||||
warning("Missing shadow directive in model");
|
||||
|
@ -417,7 +415,7 @@ void Model::Mesh::loadText(TextSplitter &ts, ResPtr<Material> *materials) {
|
|||
if (ts.eof())
|
||||
error("Expected face data, got EOF");
|
||||
|
||||
if (std::sscanf(ts.currentLine(), " %d: %d %i %d %d %d %f %d%n", &num, &materialid, &type, &geo, &light, &tex, &extralight, &verts, &readlen) < 8)
|
||||
if (sscanf(ts.currentLine(), " %d: %d %i %d %d %d %f %d%n", &num, &materialid, &type, &geo, &light, &tex, &extralight, &verts, &readlen) < 8)
|
||||
error("Expected face data, got '%s'", ts.currentLine());
|
||||
|
||||
_materialid[num] = materialid;
|
||||
|
@ -433,7 +431,7 @@ void Model::Mesh::loadText(TextSplitter &ts, ResPtr<Material> *materials) {
|
|||
for (int j = 0; j < verts; j++) {
|
||||
int readlen2;
|
||||
|
||||
if (std::sscanf(ts.currentLine() + readlen, " %d, %d%n", _faces[num]._vertices + j, _faces[num]._texVertices + j, &readlen2) < 2)
|
||||
if (sscanf(ts.currentLine() + readlen, " %d, %d%n", _faces[num]._vertices + j, _faces[num]._texVertices + j, &readlen2) < 2)
|
||||
error("Could not read vertex indices in line '%s'",
|
||||
|
||||
ts.currentLine());
|
||||
|
|
|
@ -31,12 +31,6 @@
|
|||
#include "engine/engine.h"
|
||||
#include "engine/lipsync.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
static void makeLower(std::string& s) {
|
||||
std::transform(s.begin(), s.end(), s.begin(), tolower);
|
||||
}
|
||||
|
||||
ResourceLoader *g_resourceloader = NULL;
|
||||
|
||||
ResourceLoader::ResourceLoader() {
|
||||
|
@ -134,9 +128,9 @@ int ResourceLoader::fileLength(const char *filename) const {
|
|||
}
|
||||
|
||||
Bitmap *ResourceLoader::loadBitmap(const char *filename) {
|
||||
std::string fname = filename;
|
||||
makeLower(fname);
|
||||
CacheType::iterator i = _cache.find(fname);
|
||||
Common::String fname = filename;
|
||||
fname.toLowercase();
|
||||
CacheType::iterator i = _cache.find(fname.c_str());
|
||||
if (i != _cache.end()) {
|
||||
return dynamic_cast<Bitmap *>(i->second);
|
||||
}
|
||||
|
@ -150,14 +144,14 @@ Bitmap *ResourceLoader::loadBitmap(const char *filename) {
|
|||
|
||||
Bitmap *result = new Bitmap(filename, b->data(), b->len());
|
||||
delete b;
|
||||
_cache[fname] = result;
|
||||
_cache[fname.c_str()] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
CMap *ResourceLoader::loadColormap(const char *filename) {
|
||||
std::string fname = filename;
|
||||
makeLower(fname);
|
||||
CacheType::iterator i = _cache.find(fname);
|
||||
Common::String fname = filename;
|
||||
fname.toLowercase();
|
||||
CacheType::iterator i = _cache.find(fname.c_str());
|
||||
|
||||
if (i != _cache.end()) {
|
||||
return dynamic_cast<CMap *>(i->second);
|
||||
|
@ -168,13 +162,13 @@ CMap *ResourceLoader::loadColormap(const char *filename) {
|
|||
error("Could not find colormap %s", filename);
|
||||
CMap *result = new CMap(filename, b->data(), b->len());
|
||||
delete b;
|
||||
_cache[fname] = result;
|
||||
_cache[fname.c_str()] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
Costume *ResourceLoader::loadCostume(const char *filename, Costume *prevCost) {
|
||||
std::string fname = filename;
|
||||
makeLower(fname);
|
||||
Common::String fname = filename;
|
||||
fname.toLowercase();
|
||||
Block *b = getFileBlock(filename);
|
||||
if (!b)
|
||||
error("Could not find costume %s", filename);
|
||||
|
@ -184,9 +178,9 @@ Costume *ResourceLoader::loadCostume(const char *filename, Costume *prevCost) {
|
|||
}
|
||||
|
||||
Font *ResourceLoader::loadFont(const char *filename) {
|
||||
std::string fname = filename;
|
||||
makeLower(fname);
|
||||
CacheType::iterator i = _cache.find(fname);
|
||||
Common::String fname = filename;
|
||||
fname.toLowercase();
|
||||
CacheType::iterator i = _cache.find(fname.c_str());
|
||||
if (i != _cache.end()) {
|
||||
return dynamic_cast<Font *>(i->second);
|
||||
}
|
||||
|
@ -196,14 +190,14 @@ Font *ResourceLoader::loadFont(const char *filename) {
|
|||
error("Could not find font file %s", filename);
|
||||
Font *result = new Font(filename, b->data(), b->len());
|
||||
delete b;
|
||||
_cache[fname] = result;
|
||||
_cache[fname.c_str()] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
KeyframeAnim *ResourceLoader::loadKeyframe(const char *filename) {
|
||||
std::string fname = filename;
|
||||
makeLower(fname);
|
||||
CacheType::iterator i = _cache.find(fname);
|
||||
Common::String fname = filename;
|
||||
fname.toLowercase();
|
||||
CacheType::iterator i = _cache.find(fname.c_str());
|
||||
if (i != _cache.end()) {
|
||||
return dynamic_cast<KeyframeAnim *>(i->second);
|
||||
}
|
||||
|
@ -213,16 +207,16 @@ KeyframeAnim *ResourceLoader::loadKeyframe(const char *filename) {
|
|||
error("Could not find keyframe file %s", filename);
|
||||
KeyframeAnim *result = new KeyframeAnim(filename, b->data(), b->len());
|
||||
delete b;
|
||||
_cache[fname] = result;
|
||||
_cache[fname.c_str()] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
LipSync *ResourceLoader::loadLipSync(const char *filename) {
|
||||
std::string fname = filename;
|
||||
Common::String fname = filename;
|
||||
fname.toLowercase();
|
||||
LipSync *result;
|
||||
|
||||
makeLower(fname);
|
||||
CacheType::iterator i = _cache.find(fname);
|
||||
CacheType::iterator i = _cache.find(fname.c_str());
|
||||
if (i != _cache.end()) {
|
||||
return dynamic_cast<LipSync *>(i->second);
|
||||
}
|
||||
|
@ -238,7 +232,7 @@ LipSync *ResourceLoader::loadLipSync(const char *filename) {
|
|||
// Some lipsync files have no data
|
||||
if (result->isValid()) {
|
||||
delete b;
|
||||
_cache[fname] = result;
|
||||
_cache[fname.c_str()] = result;
|
||||
} else {
|
||||
delete result;
|
||||
result = NULL;
|
||||
|
@ -249,9 +243,9 @@ LipSync *ResourceLoader::loadLipSync(const char *filename) {
|
|||
}
|
||||
|
||||
Material *ResourceLoader::loadMaterial(const char *filename, const CMap &c) {
|
||||
std::string fname = std::string(filename) + "@" + c.filename();
|
||||
makeLower(fname);
|
||||
CacheType::iterator i = _cache.find(fname);
|
||||
Common::String fname = Common::String(filename) + "@" + c.filename();
|
||||
fname.toLowercase();
|
||||
CacheType::iterator i = _cache.find(fname.c_str());
|
||||
if (i != _cache.end()) {
|
||||
return dynamic_cast<Material *>(i->second);
|
||||
}
|
||||
|
@ -261,14 +255,14 @@ Material *ResourceLoader::loadMaterial(const char *filename, const CMap &c) {
|
|||
error("Could not find material %s", filename);
|
||||
Material *result = new Material(fname.c_str(), b->data(), b->len(), c);
|
||||
delete b;
|
||||
_cache[fname] = result;
|
||||
_cache[fname.c_str()] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
Model *ResourceLoader::loadModel(const char *filename, const CMap &c) {
|
||||
std::string fname = filename;
|
||||
makeLower(fname);
|
||||
CacheType::iterator i = _cache.find(fname);
|
||||
Common::String fname = filename;
|
||||
fname.toLowercase();
|
||||
CacheType::iterator i = _cache.find(fname.c_str());
|
||||
if (i != _cache.end()) {
|
||||
return dynamic_cast<Model *>(i->second);
|
||||
}
|
||||
|
@ -278,7 +272,7 @@ Model *ResourceLoader::loadModel(const char *filename, const CMap &c) {
|
|||
error("Could not find model %s", filename);
|
||||
Model *result = new Model(filename, b->data(), b->len(), c);
|
||||
delete b;
|
||||
_cache[fname] = result;
|
||||
_cache[fname.c_str()] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -295,9 +289,9 @@ bool ResourceLoader::exportResource(const char *filename) {
|
|||
}
|
||||
|
||||
void ResourceLoader::uncache(const char *filename) {
|
||||
std::string fname = filename;
|
||||
makeLower(fname);
|
||||
CacheType::iterator i = _cache.find(fname);
|
||||
Common::String fname = filename;
|
||||
fname.toLowercase();
|
||||
CacheType::iterator i = _cache.find(fname.c_str());
|
||||
if (i != _cache.end())
|
||||
_cache.erase(i);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "engine/lab.h"
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class Bitmap;
|
||||
|
@ -57,7 +55,7 @@ public:
|
|||
void luaGc() { if (_luaRef) { _luaRef = false; deref(); } }
|
||||
|
||||
private:
|
||||
std::string _fname;
|
||||
Common::String _fname;
|
||||
int _ref;
|
||||
bool _luaRef;
|
||||
};
|
||||
|
@ -119,10 +117,10 @@ public:
|
|||
const Lab *findFile(const char *filename) const;
|
||||
private:
|
||||
|
||||
typedef std::list<Lab *> LabList;
|
||||
typedef Common::List<Lab *> LabList;
|
||||
LabList _labs;
|
||||
|
||||
typedef std::map<std::string, Resource *> CacheType;
|
||||
typedef std::map<Common::String, Resource *> CacheType;
|
||||
CacheType _cache;
|
||||
|
||||
Common::SearchSet _files;
|
||||
|
|
|
@ -26,12 +26,6 @@
|
|||
#ifndef SAVEGAME_H
|
||||
#define SAVEGAME_H
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#include <zlib\zlib.h>
|
||||
#else
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "common/savefile.h"
|
||||
|
||||
extern Common::SaveFileManager *g_saveFileMan;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef ENGINE_VECTOR3D_H
|
||||
#define ENGINE_VECTOR3D_H
|
||||
|
||||
#include <common/sys.h>
|
||||
#include "common/sys.h"
|
||||
|
||||
class Vector3d {
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue