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