mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-13 17:46:22 +00:00
Changed const char * to const Common::String &.
This commit is contained in:
parent
830e9ca765
commit
733b34febc
@ -43,7 +43,7 @@ namespace Grim {
|
|||||||
|
|
||||||
int g_winX1, g_winY1, g_winX2, g_winY2;
|
int g_winX1, g_winY1, g_winX2, g_winY2;
|
||||||
|
|
||||||
Actor::Actor(const char *actorName) :
|
Actor::Actor(const Common::String &actorName) :
|
||||||
Object(), _name(actorName), _setName(""), _talkColor(g_grim->getColor(2)), _pos(0, 0, 0),
|
Object(), _name(actorName), _setName(""), _talkColor(g_grim->getColor(2)), _pos(0, 0, 0),
|
||||||
// Some actors don't set walk and turn rates, so we default the
|
// Some actors don't set walk and turn rates, so we default the
|
||||||
// _turnRate so Doug at the cat races can turn and we set the
|
// _turnRate so Doug at the cat races can turn and we set the
|
||||||
@ -148,7 +148,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
|||||||
|
|
||||||
if (_lipSync) {
|
if (_lipSync) {
|
||||||
savedState->writeLEUint32(1);
|
savedState->writeLEUint32(1);
|
||||||
savedState->writeCharString(_lipSync->getFilename());
|
savedState->writeString(_lipSync->getFilename());
|
||||||
} else {
|
} else {
|
||||||
savedState->writeLEUint32(0);
|
savedState->writeLEUint32(0);
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
|||||||
savedState->writeLESint32(_costumeStack.size());
|
savedState->writeLESint32(_costumeStack.size());
|
||||||
for (Common::List<Costume *>::const_iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
|
for (Common::List<Costume *>::const_iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
|
||||||
Costume *c = *i;
|
Costume *c = *i;
|
||||||
savedState->writeCharString(c->getFilename());
|
savedState->writeString(c->getFilename());
|
||||||
Costume *pc = c->getPreviousCostume();
|
Costume *pc = c->getPreviousCostume();
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
while (pc) {
|
while (pc) {
|
||||||
@ -166,7 +166,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
|||||||
savedState->writeLEUint32(depth);
|
savedState->writeLEUint32(depth);
|
||||||
pc = c->getPreviousCostume();
|
pc = c->getPreviousCostume();
|
||||||
for (int j = 0; j < depth; ++j) { //save the previousCostume hierarchy
|
for (int j = 0; j < depth; ++j) { //save the previousCostume hierarchy
|
||||||
savedState->writeCharString(pc->getFilename());
|
savedState->writeString(pc->getFilename());
|
||||||
pc = pc->getPreviousCostume();
|
pc = pc->getPreviousCostume();
|
||||||
}
|
}
|
||||||
c->saveState(savedState);
|
c->saveState(savedState);
|
||||||
@ -180,7 +180,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
|||||||
|
|
||||||
if (_restCostume) {
|
if (_restCostume) {
|
||||||
savedState->writeLEUint32(1);
|
savedState->writeLEUint32(1);
|
||||||
savedState->writeCharString(_restCostume->getFilename());
|
savedState->writeString(_restCostume->getFilename());
|
||||||
} else {
|
} else {
|
||||||
savedState->writeLEUint32(0);
|
savedState->writeLEUint32(0);
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
|||||||
|
|
||||||
if (_walkCostume) {
|
if (_walkCostume) {
|
||||||
savedState->writeLEUint32(1);
|
savedState->writeLEUint32(1);
|
||||||
savedState->writeCharString(_walkCostume->getFilename());
|
savedState->writeString(_walkCostume->getFilename());
|
||||||
} else {
|
} else {
|
||||||
savedState->writeLEUint32(0);
|
savedState->writeLEUint32(0);
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
|||||||
|
|
||||||
if (_turnCostume) {
|
if (_turnCostume) {
|
||||||
savedState->writeLEUint32(1);
|
savedState->writeLEUint32(1);
|
||||||
savedState->writeCharString(_turnCostume->getFilename());
|
savedState->writeString(_turnCostume->getFilename());
|
||||||
} else {
|
} else {
|
||||||
savedState->writeLEUint32(0);
|
savedState->writeLEUint32(0);
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
|||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
if (_talkCostume[i]) {
|
if (_talkCostume[i]) {
|
||||||
savedState->writeLEUint32(1);
|
savedState->writeLEUint32(1);
|
||||||
savedState->writeCharString(_talkCostume[i]->getFilename());
|
savedState->writeString(_talkCostume[i]->getFilename());
|
||||||
} else {
|
} else {
|
||||||
savedState->writeLEUint32(0);
|
savedState->writeLEUint32(0);
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
|||||||
|
|
||||||
if (_mumbleCostume) {
|
if (_mumbleCostume) {
|
||||||
savedState->writeLEUint32(1);
|
savedState->writeLEUint32(1);
|
||||||
savedState->writeCharString(_mumbleCostume->getFilename());
|
savedState->writeString(_mumbleCostume->getFilename());
|
||||||
} else {
|
} else {
|
||||||
savedState->writeLEUint32(0);
|
savedState->writeLEUint32(0);
|
||||||
}
|
}
|
||||||
@ -1032,7 +1032,7 @@ void Actor::setScale(float scale) {
|
|||||||
|
|
||||||
Costume *Actor::findCostume(const char *n) {
|
Costume *Actor::findCostume(const char *n) {
|
||||||
for (Common::List<Costume *>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
|
for (Common::List<Costume *>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
|
||||||
if (scumm_stricmp((*i)->getFilename(), n) == 0)
|
if ((*i)->getFilename().compareToIgnoreCase(n) == 0)
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1358,7 +1358,7 @@ void Actor::putInSet(const char *setName) {
|
|||||||
_setName = setName;
|
_setName = setName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Actor::isInSet(const char *setName) const {
|
bool Actor::isInSet(const Common::String &setName) const {
|
||||||
return _setName == setName;
|
return _setName == setName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,14 +51,14 @@ struct Shadow {
|
|||||||
|
|
||||||
class Actor : public Object {
|
class Actor : public Object {
|
||||||
public:
|
public:
|
||||||
Actor(const char *name);
|
Actor(const Common::String &name);
|
||||||
Actor();
|
Actor();
|
||||||
~Actor();
|
~Actor();
|
||||||
|
|
||||||
void saveState(SaveGame *savedState) const;
|
void saveState(SaveGame *savedState) const;
|
||||||
bool restoreState(SaveGame *savedState);
|
bool restoreState(SaveGame *savedState);
|
||||||
|
|
||||||
const char *getName() const { return _name.c_str(); }
|
const Common::String &getName() const { return _name; }
|
||||||
|
|
||||||
void setTalkColor(Color *c) { _talkColor = c; }
|
void setTalkColor(Color *c) { _talkColor = c; }
|
||||||
Color *getTalkColor() const { return _talkColor; }
|
Color *getTalkColor() const { return _talkColor; }
|
||||||
@ -88,7 +88,7 @@ public:
|
|||||||
float getAngleTo(const Actor &a) const;
|
float getAngleTo(const Actor &a) const;
|
||||||
float getYawTo(Graphics::Vector3d p) const;
|
float getYawTo(Graphics::Vector3d p) const;
|
||||||
|
|
||||||
bool isInSet(const char *setName) const;
|
bool isInSet(const Common::String &setName) const;
|
||||||
void walkForward();
|
void walkForward();
|
||||||
void setRunning(bool running);
|
void setRunning(bool running);
|
||||||
void setReflection(float angle) { _reflectionAngle = angle; }
|
void setReflection(float angle) { _reflectionAngle = angle; }
|
||||||
|
@ -89,7 +89,7 @@ char *makeBitmapFromTile(char **bits, int width, int height, int bpp) {
|
|||||||
return fullImage;
|
return fullImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapData *BitmapData::getBitmapData(const char *fname, const char *data, int len) {
|
BitmapData *BitmapData::getBitmapData(const Common::String &fname, const char *data, int len) {
|
||||||
Common::String str(fname);
|
Common::String str(fname);
|
||||||
if (_bitmaps && _bitmaps->contains(str)) {
|
if (_bitmaps && _bitmaps->contains(str)) {
|
||||||
BitmapData *b = (*_bitmaps)[str];
|
BitmapData *b = (*_bitmaps)[str];
|
||||||
@ -105,11 +105,11 @@ BitmapData *BitmapData::getBitmapData(const char *fname, const char *data, int l
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapData::BitmapData(const char *fname, const char *data, int len) {
|
BitmapData::BitmapData(const Common::String &fname, const char *data, int len) {
|
||||||
_fname = fname;
|
_fname = fname;
|
||||||
_refCount = 1;
|
_refCount = 1;
|
||||||
if (len > 4 && memcmp(data, "\x1f\x8b\x08\0", 4) == 0) {
|
if (len > 4 && memcmp(data, "\x1f\x8b\x08\0", 4) == 0) {
|
||||||
loadTile(fname, data, len);
|
loadTile(data, len);
|
||||||
return;
|
return;
|
||||||
} else if (len < 8 || memcmp(data, "BM F\0\0\0", 8) != 0) {
|
} else if (len < 8 || memcmp(data, "BM F\0\0\0", 8) != 0) {
|
||||||
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
|
||||||
@ -208,7 +208,7 @@ BitmapData::~BitmapData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BitmapData::loadTile(const char *filename, const char *data, int len) {
|
bool BitmapData::loadTile(const char *data, int len) {
|
||||||
_x = 0;
|
_x = 0;
|
||||||
_y = 0;
|
_y = 0;
|
||||||
_format = 1;
|
_format = 1;
|
||||||
@ -269,7 +269,7 @@ char *BitmapData::getImageData(int num) const {
|
|||||||
|
|
||||||
// Bitmap
|
// Bitmap
|
||||||
|
|
||||||
Bitmap::Bitmap(const char *fname, const char *data, int len) :
|
Bitmap::Bitmap(const Common::String &fname, const char *data, int len) :
|
||||||
Object() {
|
Object() {
|
||||||
_data = BitmapData::getBitmapData(fname, data, len);
|
_data = BitmapData::getBitmapData(fname, data, len);
|
||||||
_x = _data->_x;
|
_x = _data->_x;
|
||||||
|
@ -34,13 +34,13 @@ namespace Grim {
|
|||||||
// They are automatically deleted if they are not used by any bitmap anymore.
|
// They are automatically deleted if they are not used by any bitmap anymore.
|
||||||
class BitmapData {
|
class BitmapData {
|
||||||
public:
|
public:
|
||||||
BitmapData(const char *fname, const char *data, int len);
|
BitmapData(const Common::String &fname, const char *data, int len);
|
||||||
BitmapData(const char *data, int w, int h, int bpp, const char *fname);
|
BitmapData(const char *data, int w, int h, int bpp, const char *fname);
|
||||||
BitmapData();
|
BitmapData();
|
||||||
~BitmapData();
|
~BitmapData();
|
||||||
bool loadTile(const char *filename, const char *data, int len);
|
bool loadTile(const char *data, int len);
|
||||||
|
|
||||||
static BitmapData *getBitmapData(const char *fname, const char *data, int len);
|
static BitmapData *getBitmapData(const Common::String &fname, const char *data, int len);
|
||||||
static Common::HashMap<Common::String, BitmapData *> *_bitmaps;
|
static Common::HashMap<Common::String, BitmapData *> *_bitmaps;
|
||||||
|
|
||||||
char *getImageData(int num) const;
|
char *getImageData(int num) const;
|
||||||
@ -66,11 +66,11 @@ private:
|
|||||||
class Bitmap : public Object {
|
class Bitmap : public Object {
|
||||||
public:
|
public:
|
||||||
// Construct a bitmap from the given data.
|
// Construct a bitmap from the given data.
|
||||||
Bitmap(const char *filename, const char *data, int len);
|
Bitmap(const Common::String &filename, const char *data, int len);
|
||||||
Bitmap(const char *data, int width, int height, int bpp, const char *filename);
|
Bitmap(const char *data, int width, int height, int bpp, const char *filename);
|
||||||
Bitmap();
|
Bitmap();
|
||||||
|
|
||||||
const char *getFilename() const { return _data->_fname.c_str(); }
|
const Common::String &getFilename() const { return _data->_fname; }
|
||||||
|
|
||||||
void draw() const;
|
void draw() const;
|
||||||
|
|
||||||
|
@ -26,9 +26,8 @@
|
|||||||
namespace Grim {
|
namespace Grim {
|
||||||
|
|
||||||
// Load a colormap from the given data.
|
// Load a colormap from the given data.
|
||||||
CMap::CMap(const char *fileName, const char *data, int len) :
|
CMap::CMap(const Common::String &fileName, const char *data, int len) :
|
||||||
Object() {
|
Object(), _fname(fileName) {
|
||||||
_fname = fileName;
|
|
||||||
if (len < 4 || READ_BE_UINT32(data) != MKTAG('C','M','P',' '))
|
if (len < 4 || READ_BE_UINT32(data) != MKTAG('C','M','P',' '))
|
||||||
error("Invalid magic loading colormap");
|
error("Invalid magic loading colormap");
|
||||||
memcpy(_colors, data + 64, sizeof(_colors));
|
memcpy(_colors, data + 64, sizeof(_colors));
|
||||||
|
@ -30,10 +30,10 @@ namespace Grim {
|
|||||||
class CMap : public Object {
|
class CMap : public Object {
|
||||||
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 Common::String &fileName, const char *data, int len);
|
||||||
CMap();
|
CMap();
|
||||||
~CMap();
|
~CMap();
|
||||||
const char *getFilename() const { return _fname.c_str(); }
|
const Common::String &getFilename() const { return _fname; }
|
||||||
|
|
||||||
// The color data, in RGB format
|
// The color data, in RGB format
|
||||||
char _colors[256 * 3];
|
char _colors[256 * 3];
|
||||||
|
@ -522,7 +522,7 @@ ColormapComponent::~ColormapComponent() {
|
|||||||
void ColormapComponent::init() {
|
void ColormapComponent::init() {
|
||||||
if (!_parent)
|
if (!_parent)
|
||||||
warning("No parent to apply colormap object on. CMap: %s, Costume: %s",
|
warning("No parent to apply colormap object on. CMap: %s, Costume: %s",
|
||||||
_cmap->getFilename(),_cost->getFilename());
|
_cmap->getFilename().c_str(), _cost->getFilename().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
class KeyframeComponent : public Costume::Component {
|
class KeyframeComponent : public Costume::Component {
|
||||||
@ -577,7 +577,7 @@ void KeyframeComponent::setKey(int val) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("Unknown key %d for keyframe %s", val, _keyf->getFilename());
|
warning("Unknown key %d for keyframe %s", val, _keyf->getFilename().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,7 +612,7 @@ void KeyframeComponent::update() {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("Unknown repeat mode %d for keyframe %s", _repeatMode, _keyf->getFilename());
|
warning("Unknown repeat mode %d for keyframe %s", _repeatMode, _keyf->getFilename().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +625,7 @@ void KeyframeComponent::init() {
|
|||||||
_hier = mc->getHierarchy();
|
_hier = mc->getHierarchy();
|
||||||
else {
|
else {
|
||||||
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("Parent of %s was not a model", _keyf->getFilename());
|
warning("Parent of %s was not a model", _keyf->getFilename().c_str());
|
||||||
_hier = NULL;
|
_hier = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -695,13 +695,13 @@ void MaterialComponent::init() {
|
|||||||
ModelComponent *p = static_cast<ModelComponent *>(_parent);
|
ModelComponent *p = static_cast<ModelComponent *>(_parent);
|
||||||
Model *model = p->getModel();
|
Model *model = p->getModel();
|
||||||
for (int i = 0; i < model->_numMaterials; ++i) {
|
for (int i = 0; i < model->_numMaterials; ++i) {
|
||||||
if (scumm_stricmp(model->_materials[i]->getFilename(), _filename.c_str()) == 0) {
|
if (_filename.compareToIgnoreCase(model->_materials[i]->getFilename()) == 0) {
|
||||||
_mat = model->_materials[i].object();
|
_mat = model->_materials[i].object();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warning("Parent of a MaterialComponent not a ModelComponent. %s %s", _filename.c_str(),_cost->getFilename());
|
warning("Parent of a MaterialComponent not a ModelComponent. %s %s", _filename.c_str(), _cost->getFilename().c_str());
|
||||||
_mat = NULL;
|
_mat = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -802,7 +802,7 @@ void SoundComponent::reset() {
|
|||||||
g_imuse->stopSound(_soundName.c_str());
|
g_imuse->stopSound(_soundName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Costume::Costume(const char *fname, const char *data, int len, Costume *prevCost) :
|
Costume::Costume(const Common::String &fname, const char *data, int len, Costume *prevCost) :
|
||||||
Object() {
|
Object() {
|
||||||
|
|
||||||
_fname = fname;
|
_fname = fname;
|
||||||
@ -1549,7 +1549,7 @@ Costume *Costume::getPreviousCostume() const {
|
|||||||
void Costume::saveState(SaveGame *state) const {
|
void Costume::saveState(SaveGame *state) const {
|
||||||
if (_cmap) {
|
if (_cmap) {
|
||||||
state->writeLEUint32(1);
|
state->writeLEUint32(1);
|
||||||
state->writeCharString(_cmap->getFilename());
|
state->writeString(_cmap->getFilename());
|
||||||
} else {
|
} else {
|
||||||
state->writeLEUint32(0);
|
state->writeLEUint32(0);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class TextSplitter;
|
|||||||
|
|
||||||
class Costume : public Object {
|
class Costume : public Object {
|
||||||
public:
|
public:
|
||||||
Costume(const char *filename, const char *data, int len, Costume *prevCost);
|
Costume(const Common::String &filename, const char *data, int len, Costume *prevCost);
|
||||||
Costume() : Object() { _chores = 0; }
|
Costume() : Object() { _chores = 0; }
|
||||||
|
|
||||||
void loadGRIM(TextSplitter &ts, Costume *prevCost);
|
void loadGRIM(TextSplitter &ts, Costume *prevCost);
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
virtual ~Costume();
|
virtual ~Costume();
|
||||||
|
|
||||||
const char *getFilename() const { return _fname.c_str(); }
|
const Common::String &getFilename() const { return _fname; }
|
||||||
void playChore(const char *name);
|
void playChore(const char *name);
|
||||||
void playChore(int num);
|
void playChore(int num);
|
||||||
void playChoreLooping(int num);
|
void playChoreLooping(int num);
|
||||||
|
@ -31,9 +31,7 @@
|
|||||||
|
|
||||||
namespace Grim {
|
namespace Grim {
|
||||||
|
|
||||||
Font::Font(const char *filename, const char *data, int len) : Object() {
|
Font::Font(const Common::String &filename, const char *data, int len) : Object() {
|
||||||
_fname = filename;
|
|
||||||
|
|
||||||
_filename = filename;
|
_filename = filename;
|
||||||
_numChars = READ_LE_UINT32(data);
|
_numChars = READ_LE_UINT32(data);
|
||||||
_dataSize = READ_LE_UINT32(data + 4);
|
_dataSize = READ_LE_UINT32(data + 4);
|
||||||
@ -48,7 +46,7 @@ Font::Font(const char *filename, const char *data, int len) : Object() {
|
|||||||
// Read character indexes - are the key/value reversed?
|
// Read character indexes - are the key/value reversed?
|
||||||
_charIndex = new uint16[_numChars];
|
_charIndex = new uint16[_numChars];
|
||||||
if (!_charIndex)
|
if (!_charIndex)
|
||||||
error("Could not load font %s. Out of memory", filename);
|
error("Could not load font %s. Out of memory", _filename.c_str());
|
||||||
for (uint i = 0; i < _numChars; ++i) {
|
for (uint i = 0; i < _numChars; ++i) {
|
||||||
_charIndex[i] = READ_LE_UINT16(data + 2 * i);
|
_charIndex[i] = READ_LE_UINT16(data + 2 * i);
|
||||||
}
|
}
|
||||||
@ -58,7 +56,7 @@ Font::Font(const char *filename, const char *data, int len) : Object() {
|
|||||||
// Read character headers
|
// Read character headers
|
||||||
_charHeaders = new CharHeader[_numChars];
|
_charHeaders = new CharHeader[_numChars];
|
||||||
if (!_charHeaders)
|
if (!_charHeaders)
|
||||||
error("Could not load font %s. Out of memory", filename);
|
error("Could not load font %s. Out of memory", _filename.c_str());
|
||||||
for (uint i = 0; i < _numChars; ++i) {
|
for (uint i = 0; i < _numChars; ++i) {
|
||||||
_charHeaders[i].offset = READ_LE_UINT32(data);
|
_charHeaders[i].offset = READ_LE_UINT32(data);
|
||||||
_charHeaders[i].width = *(int8 *)(data + 4);
|
_charHeaders[i].width = *(int8 *)(data + 4);
|
||||||
@ -68,7 +66,7 @@ Font::Font(const char *filename, const char *data, int len) : Object() {
|
|||||||
_charHeaders[i].dataHeight = READ_LE_UINT32(data + 12);
|
_charHeaders[i].dataHeight = READ_LE_UINT32(data + 12);
|
||||||
int8 overflow = (_charHeaders[i].dataHeight + _charHeaders[i].startingLine) - available_height;
|
int8 overflow = (_charHeaders[i].dataHeight + _charHeaders[i].startingLine) - available_height;
|
||||||
if (overflow > 0) {
|
if (overflow > 0) {
|
||||||
warning("Font %s, char 0x%02x exceeds font height by %d, increasing font height", filename, i, overflow);
|
warning("Font %s, char 0x%02x exceeds font height by %d, increasing font height", _filename.c_str(), i, overflow);
|
||||||
available_height += overflow;
|
available_height += overflow;
|
||||||
_height += overflow;
|
_height += overflow;
|
||||||
}
|
}
|
||||||
@ -77,7 +75,7 @@ Font::Font(const char *filename, const char *data, int len) : Object() {
|
|||||||
// Read font data
|
// Read font data
|
||||||
_fontData = new byte[_dataSize];
|
_fontData = new byte[_dataSize];
|
||||||
if (!_fontData)
|
if (!_fontData)
|
||||||
error("Could not load font %s. Out of memory", filename);
|
error("Could not load font %s. Out of memory", _filename.c_str());
|
||||||
|
|
||||||
memcpy(_fontData, data, _dataSize);
|
memcpy(_fontData, data, _dataSize);
|
||||||
}
|
}
|
||||||
|
@ -31,11 +31,11 @@ class SaveGame;
|
|||||||
|
|
||||||
class Font : public Object {
|
class Font : public Object {
|
||||||
public:
|
public:
|
||||||
Font(const char *filename, const char *data, int len);
|
Font(const Common::String &filename, const char *data, int len);
|
||||||
Font();
|
Font();
|
||||||
~Font();
|
~Font();
|
||||||
|
|
||||||
Common::String getFilename() const { return _filename; }
|
const Common::String &getFilename() const { return _filename; }
|
||||||
int32 getHeight() { return _height; }
|
int32 getHeight() { return _height; }
|
||||||
int32 getBaseOffsetY() { return _baseOffsetY; }
|
int32 getBaseOffsetY() { return _baseOffsetY; }
|
||||||
int32 getCharDataWidth(unsigned char c) { return _charHeaders[getCharIndex(c)].dataWidth; }
|
int32 getCharDataWidth(unsigned char c) { return _charHeaders[getCharIndex(c)].dataWidth; }
|
||||||
@ -66,7 +66,6 @@ private:
|
|||||||
CharHeader *_charHeaders;
|
CharHeader *_charHeaders;
|
||||||
byte *_fontData;
|
byte *_fontData;
|
||||||
Common::String _filename;
|
Common::String _filename;
|
||||||
Common::String _fname;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Grim
|
} // end of namespace Grim
|
||||||
|
@ -1561,7 +1561,7 @@ void GrimEngine::saveBitmaps(SaveGame *state) {
|
|||||||
for (BitmapListType::iterator i = _bitmaps.begin(); i != _bitmaps.end(); ++i) {
|
for (BitmapListType::iterator i = _bitmaps.begin(); i != _bitmaps.end(); ++i) {
|
||||||
state->writeLEUint32(i->_key);
|
state->writeLEUint32(i->_key);
|
||||||
Bitmap *b = i->_value;
|
Bitmap *b = i->_value;
|
||||||
state->writeCharString(b->getFilename());
|
state->writeString(b->getFilename());
|
||||||
|
|
||||||
state->writeLESint32(b->getCurrentImage());
|
state->writeLESint32(b->getCurrentImage());
|
||||||
state->writeLESint32(b->getX());
|
state->writeLESint32(b->getX());
|
||||||
@ -1629,7 +1629,7 @@ void GrimEngine::savegameCallback() {
|
|||||||
Scene *GrimEngine::findScene(const char *name) {
|
Scene *GrimEngine::findScene(const char *name) {
|
||||||
// Find scene object
|
// Find scene object
|
||||||
for (SceneListType::const_iterator i = scenesBegin(); i != scenesEnd(); ++i) {
|
for (SceneListType::const_iterator i = scenesBegin(); i != scenesEnd(); ++i) {
|
||||||
if (!strcmp(i->_value->getName(), name))
|
if (i->_value->getName() == name)
|
||||||
return i->_value;
|
return i->_value;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -140,7 +140,7 @@ public:
|
|||||||
void setScene(const char *name);
|
void setScene(const char *name);
|
||||||
void setScene(Scene *scene);
|
void setScene(Scene *scene);
|
||||||
Scene *getCurrScene() { return _currScene; }
|
Scene *getCurrScene() { return _currScene; }
|
||||||
const char *getSceneName() const { return _currScene->getName(); }
|
const Common::String &getSceneName() const { return _currScene->getName(); }
|
||||||
void makeCurrentSetup(int num);
|
void makeCurrentSetup(int num);
|
||||||
|
|
||||||
// Scene registration
|
// Scene registration
|
||||||
|
@ -32,9 +32,8 @@
|
|||||||
|
|
||||||
namespace Grim {
|
namespace Grim {
|
||||||
|
|
||||||
KeyframeAnim::KeyframeAnim(const char *fname, const char *data, int len) :
|
KeyframeAnim::KeyframeAnim(const Common::String &fname, const char *data, int len) :
|
||||||
Object() {
|
Object(), _fname(fname) {
|
||||||
_fname = fname;
|
|
||||||
|
|
||||||
if (len >= 4 && READ_BE_UINT32(data) == MKTAG('F','Y','E','K'))
|
if (len >= 4 && READ_BE_UINT32(data) == MKTAG('F','Y','E','K'))
|
||||||
loadBinary(data, len);
|
loadBinary(data, len);
|
||||||
|
@ -29,7 +29,7 @@ namespace Grim {
|
|||||||
|
|
||||||
class KeyframeAnim : public Object {
|
class KeyframeAnim : public Object {
|
||||||
public:
|
public:
|
||||||
KeyframeAnim(const char *filename, const char *data, int len);
|
KeyframeAnim(const Common::String &filename, const char *data, int len);
|
||||||
~KeyframeAnim();
|
~KeyframeAnim();
|
||||||
|
|
||||||
void loadBinary(const char *data, int len);
|
void loadBinary(const char *data, int len);
|
||||||
@ -37,7 +37,7 @@ public:
|
|||||||
void animate(Model::HierNode *nodes, float time, int priority1 = 1, int priority2 = 5, float fade = 1) const;
|
void animate(Model::HierNode *nodes, float time, int priority1 = 1, int priority2 = 5, float fade = 1) const;
|
||||||
|
|
||||||
float getLength() const { return _numFrames / _fps; }
|
float getLength() const { return _numFrames / _fps; }
|
||||||
const char *getFilename() const { return _fname.c_str(); }
|
const Common::String &getFilename() const { return _fname; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Common::String _fname;
|
Common::String _fname;
|
||||||
|
@ -32,14 +32,14 @@ template class ObjectPtr<LipSync>;
|
|||||||
// 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
|
||||||
|
|
||||||
LipSync::LipSync(const char *filename, const char *data, int len) :
|
LipSync::LipSync(const Common::String &filename, const char *data, int len) :
|
||||||
Object() {
|
Object() {
|
||||||
_fname = filename;
|
_fname = filename;
|
||||||
uint16 readPhoneme;
|
uint16 readPhoneme;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if (READ_BE_UINT32(data) != MKTAG('L','I','P','!')) {
|
if (READ_BE_UINT32(data) != MKTAG('L','I','P','!')) {
|
||||||
error("Invalid file format in %s", filename);
|
error("Invalid file format in %s", _fname.c_str());
|
||||||
} else {
|
} else {
|
||||||
_numEntries = (len - 8) / 4;
|
_numEntries = (len - 8) / 4;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ LipSync::LipSync(const char *filename, const char *data, int len) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (j >= _animTableSize) {
|
if (j >= _animTableSize) {
|
||||||
warning("Unknown phoneme: 0x%X in file %s", readPhoneme, filename);
|
warning("Unknown phoneme: 0x%X in file %s", readPhoneme, _fname.c_str());
|
||||||
_entries[i].anim = 1;
|
_entries[i].anim = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,10 +106,6 @@ int LipSync::getAnim(int pos) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *LipSync::getFilename() const {
|
|
||||||
return _fname.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
const LipSync::PhonemeAnim LipSync::_animTable[] = {
|
const LipSync::PhonemeAnim LipSync::_animTable[] = {
|
||||||
{0x005F, 0}, {0x0251, 1}, {0x0061, 1}, {0x00E6, 1}, {0x028C, 8},
|
{0x005F, 0}, {0x0251, 1}, {0x0061, 1}, {0x00E6, 1}, {0x028C, 8},
|
||||||
{0x0254, 1}, {0x0259, 1}, {0x0062, 6}, {0x02A7, 2}, {0x0064, 2},
|
{0x0254, 1}, {0x0259, 1}, {0x0062, 6}, {0x02A7, 2}, {0x0064, 2},
|
||||||
|
@ -29,7 +29,7 @@ namespace Grim {
|
|||||||
|
|
||||||
class LipSync : public Object {
|
class LipSync : public Object {
|
||||||
public:
|
public:
|
||||||
LipSync(const char *filename, const char *data, int len);
|
LipSync(const Common::String &filename, const char *data, int len);
|
||||||
~LipSync();
|
~LipSync();
|
||||||
|
|
||||||
struct LipEntry {
|
struct LipEntry {
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
int getAnim(int pos);
|
int getAnim(int pos);
|
||||||
bool isValid() { return _numEntries > 0; }
|
bool isValid() { return _numEntries > 0; }
|
||||||
const char *getFilename() const;
|
const Common::String &getFilename() const { return _fname; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LipEntry *_entries;
|
LipEntry *_entries;
|
||||||
|
@ -161,7 +161,7 @@ void callHook(lua_Function func, const char *filename, int32 line) {
|
|||||||
else if (lua_isuserdata(lua_getparam(i))) {
|
else if (lua_isuserdata(lua_getparam(i))) {
|
||||||
if (lua_tag(lua_getparam(i)) == MKTAG('A','C','T','R')) {
|
if (lua_tag(lua_getparam(i)) == MKTAG('A','C','T','R')) {
|
||||||
Actor *a = g_grim->getActor(lua_getuserdata(lua_getparam(i)));
|
Actor *a = g_grim->getActor(lua_getuserdata(lua_getparam(i)));
|
||||||
fprintf(output, "<actor \"%s\">", a->getName());
|
fprintf(output, "<actor \"%s\">", a->getName().c_str());
|
||||||
} else if (lua_tag(lua_getparam(i)) == MKTAG('C','O','L','R')) {
|
} else if (lua_tag(lua_getparam(i)) == MKTAG('C','O','L','R')) {
|
||||||
Color *c = g_grim->getColor(lua_getuserdata(lua_getparam(i)));
|
Color *c = g_grim->getColor(lua_getuserdata(lua_getparam(i)));
|
||||||
fprintf(output, "<color #%02x%02x%02x>", c->getRed(), c->getGreen(), c->getBlue());
|
fprintf(output, "<color #%02x%02x%02x>", c->getRed(), c->getGreen(), c->getBlue());
|
||||||
|
@ -734,7 +734,7 @@ void L1_GetActorCostume() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (costume)
|
if (costume)
|
||||||
lua_pushstring(const_cast<char *>(costume->getFilename()));
|
lua_pushstring(costume->getFilename().c_str());
|
||||||
else
|
else
|
||||||
lua_pushnil();
|
lua_pushnil();
|
||||||
}
|
}
|
||||||
@ -746,7 +746,7 @@ void L1_PopActorCostume() {
|
|||||||
|
|
||||||
Actor *actor = getactor(actorObj);
|
Actor *actor = getactor(actorObj);
|
||||||
if (actor->getCurrentCostume()) {
|
if (actor->getCurrentCostume()) {
|
||||||
lua_pushstring(const_cast<char *>(actor->getCurrentCostume()->getFilename()));
|
lua_pushstring(actor->getCurrentCostume()->getFilename().c_str());
|
||||||
actor->popCostume();
|
actor->popCostume();
|
||||||
} else
|
} else
|
||||||
lua_pushnil();
|
lua_pushnil();
|
||||||
|
@ -63,7 +63,7 @@ void L2_DimScreen() {
|
|||||||
dim = lua_getnumber(dimObj);
|
dim = lua_getnumber(dimObj);
|
||||||
|
|
||||||
// FIXME func(dim);
|
// FIXME func(dim);
|
||||||
warning("L2_DimScreen: dim: %d", dim);
|
warning("L2_DimScreen: dim: %f", dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
void L2_MakeCurrentSetup() {
|
void L2_MakeCurrentSetup() {
|
||||||
@ -89,7 +89,7 @@ void L2_SetActorGlobalAlpha() {
|
|||||||
if (!actor)
|
if (!actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
warning("L2_SetActorGlobalAlpha: actor: %s", actor->getName());
|
warning("L2_SetActorGlobalAlpha: actor: %s", actor->getName().c_str());
|
||||||
|
|
||||||
/* Only when actor has primitives
|
/* Only when actor has primitives
|
||||||
if (!actor->primities)
|
if (!actor->primities)
|
||||||
@ -127,7 +127,7 @@ void L2_RemoveActorFromOverworld() {
|
|||||||
if (!actor)
|
if (!actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
warning("L2_RemoveActorFromOverworld: actor: %s", actor->getName());
|
warning("L2_RemoveActorFromOverworld: actor: %s", actor->getName().c_str());
|
||||||
// FIXME actor->func();
|
// FIXME actor->func();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ void L2_UnloadActor() {
|
|||||||
if (!actor)
|
if (!actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
warning("L2_UnloadActor: actor: %s", actor->getName());
|
warning("L2_UnloadActor: actor: %s", actor->getName().c_str());
|
||||||
// FIXME actor->func();
|
// FIXME actor->func();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ void L2_SetActorSortOrder() {
|
|||||||
|
|
||||||
Actor *actor = getactor(actorObj);
|
Actor *actor = getactor(actorObj);
|
||||||
int mode = (int)lua_getnumber(modeObj);
|
int mode = (int)lua_getnumber(modeObj);
|
||||||
warning("L2_SetActorSortOrder, actor: %s, mode: %d", actor->getName(), mode);
|
warning("L2_SetActorSortOrder, actor: %s, mode: %d", actor->getName().c_str(), mode);
|
||||||
// FIXME: actor->func(mode);
|
// FIXME: actor->func(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ void L2_ActorActivateShadow() {
|
|||||||
const char *plane = "NULL";
|
const char *plane = "NULL";
|
||||||
if (lua_isstring(planeObj))
|
if (lua_isstring(planeObj))
|
||||||
plane = lua_getstring(planeObj);
|
plane = lua_getstring(planeObj);
|
||||||
warning("L2_ActorActivateShadow, actor: %s, aquality: %d, plane: %s", actor->getName(), quality, plane);
|
warning("L2_ActorActivateShadow, actor: %s, aquality: %d, plane: %s", actor->getName().c_str(), quality, plane);
|
||||||
// FIXME: implement missing rest part of code
|
// FIXME: implement missing rest part of code
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ void L2_ActorStopMoving() {
|
|||||||
|
|
||||||
Actor *actor = getactor(actorObj);
|
Actor *actor = getactor(actorObj);
|
||||||
|
|
||||||
warning("L2_ActorStopMoving, actor: %s", actor->getName());
|
warning("L2_ActorStopMoving, actor: %s", actor->getName().c_str());
|
||||||
// FIXME: implement missing rest part of code
|
// FIXME: implement missing rest part of code
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ void L2_PutActorInOverworld() {
|
|||||||
|
|
||||||
Actor *actor = getactor(actorObj);
|
Actor *actor = getactor(actorObj);
|
||||||
|
|
||||||
warning("L2_PutActorInOverworld, actor: %s", actor->getName());
|
warning("L2_PutActorInOverworld, actor: %s", actor->getName().c_str());
|
||||||
// FIXME: implement missing func
|
// FIXME: implement missing func
|
||||||
//actor->func();
|
//actor->func();
|
||||||
}
|
}
|
||||||
@ -450,7 +450,7 @@ void L2_PlayActorChore() {
|
|||||||
const char *costumeName = lua_getstring(costumeObj);
|
const char *costumeName = lua_getstring(costumeObj);
|
||||||
|
|
||||||
warning("L2_PlayActorChore: implement opcode actor: %s, chore: %s, costume: %s, mode bool: %d, param: %f",
|
warning("L2_PlayActorChore: implement opcode actor: %s, chore: %s, costume: %s, mode bool: %d, param: %f",
|
||||||
actor->getName(), choreName, costumeName, (int)mode, param);
|
actor->getName().c_str(), choreName, costumeName, (int)mode, param);
|
||||||
// FIXME. code below is a hack, need proper implementation
|
// FIXME. code below is a hack, need proper implementation
|
||||||
actor->setCostume(costumeName);
|
actor->setCostume(costumeName);
|
||||||
Costume *costume = actor->getCurrentCostume();
|
Costume *costume = actor->getCurrentCostume();
|
||||||
@ -472,7 +472,7 @@ static void L2_StopActorChores() {
|
|||||||
bool p = lua_isnil(paramObj) != 0;
|
bool p = lua_isnil(paramObj) != 0;
|
||||||
// I'm not fully sure about bool logic here
|
// I'm not fully sure about bool logic here
|
||||||
//actor->func(p);
|
//actor->func(p);
|
||||||
warning("L2_StopActorChores: implement opcode... bool param: %d, actor: %s", (int)p, actor->getName());
|
warning("L2_StopActorChores: implement opcode... bool param: %d, actor: %s", (int)p, actor->getName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void L2_SetActorLighting() {
|
static void L2_SetActorLighting() {
|
||||||
@ -493,17 +493,17 @@ static void L2_SetActorLighting() {
|
|||||||
if (lightMode != 0) {
|
if (lightMode != 0) {
|
||||||
if (lightMode == 1) {
|
if (lightMode == 1) {
|
||||||
//FIXME actor->
|
//FIXME actor->
|
||||||
warning("L2_SetActorLighting: case param 1(LIGHT_FASTDYN), actor: %s", actor->getName());
|
warning("L2_SetActorLighting: case param 1(LIGHT_FASTDYN), actor: %s", actor->getName().c_str());
|
||||||
} else if (lightMode == 2) {
|
} else if (lightMode == 2) {
|
||||||
//FIXME actor->
|
//FIXME actor->
|
||||||
warning("L2_SetActorLighting: case param 2(LIGHT_NORMDYN), actor: %s", actor->getName());
|
warning("L2_SetActorLighting: case param 2(LIGHT_NORMDYN), actor: %s", actor->getName().c_str());
|
||||||
} else {
|
} else {
|
||||||
//FIXME actor->
|
//FIXME actor->
|
||||||
warning("L2_SetActorLighting: case param %d(LIGHT_NONE), actor: %s", lightMode, actor->getName());
|
warning("L2_SetActorLighting: case param %d(LIGHT_NONE), actor: %s", lightMode, actor->getName().c_str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//FIXME actor->
|
//FIXME actor->
|
||||||
warning("L2_SetActorLighting: case param 0(LIGHT_STATIC), actor: %s", actor->getName());
|
warning("L2_SetActorLighting: case param 0(LIGHT_STATIC), actor: %s", actor->getName().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
namespace Grim {
|
namespace Grim {
|
||||||
|
|
||||||
Material::Material(const char *filename, const char *data, int len, CMap *cmap) :
|
Material::Material(const Common::String &filename, const char *data, int len, CMap *cmap) :
|
||||||
Object(), _fname(filename), _cmap(cmap) {
|
Object(), _fname(filename), _cmap(cmap) {
|
||||||
if (len < 4 || memcmp(data, "MAT ", 4) != 0)
|
if (len < 4 || memcmp(data, "MAT ", 4) != 0)
|
||||||
error("invalid magic loading texture");
|
error("invalid magic loading texture");
|
||||||
@ -50,7 +50,7 @@ Material::Material(const char *filename, const char *data, int len, CMap *cmap)
|
|||||||
|
|
||||||
if (_width == 0 || _height == 0) {
|
if (_width == 0 || _height == 0) {
|
||||||
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("skip load texture: bad texture size (%dx%d) for texture %s", _width, _height, filename);
|
warning("skip load texture: bad texture size (%dx%d) for texture %s", _width, _height, _fname.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class Material : public Object {
|
|||||||
public:
|
public:
|
||||||
Material() { _width = 0; }
|
Material() { _width = 0; }
|
||||||
// Load a texture from the given data.
|
// Load a texture from the given data.
|
||||||
Material(const char *filename, const char *data, int len, CMap *cmap);
|
Material(const Common::String &filename, const char *data, int len, CMap *cmap);
|
||||||
|
|
||||||
// Load this texture into the GL context
|
// Load this texture into the GL context
|
||||||
void select() const;
|
void select() const;
|
||||||
@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
int getNumImages() const { return _numImages; }
|
int getNumImages() const { return _numImages; }
|
||||||
int getCurrentImage() const { return _currImage; }
|
int getCurrentImage() const { return _currImage; }
|
||||||
const char *getFilename() { return _fname.c_str(); }
|
const Common::String &getFilename() { return _fname; }
|
||||||
|
|
||||||
~Material();
|
~Material();
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ void Sprite::draw() const {
|
|||||||
g_driver->drawSprite(this);
|
g_driver->drawSprite(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Model::Model(const char *filename, const char *data, int len, CMap *cmap) :
|
Model::Model(const Common::String &filename, const char *data, int len, CMap *cmap) :
|
||||||
Object(), _numMaterials(0), _numGeosets(0), _cmap(cmap) {
|
Object(), _numMaterials(0), _numGeosets(0), _cmap(cmap) {
|
||||||
_fname = filename;
|
_fname = filename;
|
||||||
_headNode = NULL;
|
_headNode = NULL;
|
||||||
|
@ -47,7 +47,7 @@ struct Sprite {
|
|||||||
class Model : public Object {
|
class Model : public Object {
|
||||||
public:
|
public:
|
||||||
// Construct a 3D model from the given data.
|
// Construct a 3D model from the given data.
|
||||||
Model(const char *filename, const char *data, int len, CMap *cmap);
|
Model(const Common::String &filename, const char *data, int len, CMap *cmap);
|
||||||
void loadBinary(const char *&data, CMap *cmap);
|
void loadBinary(const char *&data, CMap *cmap);
|
||||||
void loadText(TextSplitter *ts, CMap *cmap);
|
void loadText(TextSplitter *ts, CMap *cmap);
|
||||||
void loadEMI(Common::MemoryReadStream &ms);
|
void loadEMI(Common::MemoryReadStream &ms);
|
||||||
|
@ -54,7 +54,7 @@ ObjectState::~ObjectState() {
|
|||||||
delete _zbitmap;
|
delete _zbitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *ObjectState::getBitmapFilename() const {
|
const Common::String &ObjectState::getBitmapFilename() const {
|
||||||
return _bitmap->getFilename();
|
return _bitmap->getFilename();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
Position getPos() const { return _pos; }
|
Position getPos() const { return _pos; }
|
||||||
void setPos(Position position) { _pos = position; }
|
void setPos(Position position) { _pos = position; }
|
||||||
|
|
||||||
const char *getBitmapFilename() const;
|
const Common::String &getBitmapFilename() const;
|
||||||
|
|
||||||
void setNumber(int val);
|
void setNumber(int val);
|
||||||
void draw();
|
void draw();
|
||||||
|
@ -449,7 +449,7 @@ KeyframeAnimPtr ResourceLoader::getKeyframe(const char *fname) {
|
|||||||
filename.toLowercase();
|
filename.toLowercase();
|
||||||
for (Common::List<KeyframeAnim *>::const_iterator i = _keyframeAnims.begin(); i != _keyframeAnims.end(); ++i) {
|
for (Common::List<KeyframeAnim *>::const_iterator i = _keyframeAnims.begin(); i != _keyframeAnims.end(); ++i) {
|
||||||
KeyframeAnim *k = *i;
|
KeyframeAnim *k = *i;
|
||||||
if (strcmp(filename.c_str(), k->getFilename()) == 0) {
|
if (filename == k->getFilename()) {
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@ LipSyncPtr ResourceLoader::getLipSync(const char *fname) {
|
|||||||
filename.toLowercase();
|
filename.toLowercase();
|
||||||
for (Common::List<LipSync *>::const_iterator i = _lipsyncs.begin(); i != _lipsyncs.end(); ++i) {
|
for (Common::List<LipSync *>::const_iterator i = _lipsyncs.begin(); i != _lipsyncs.end(); ++i) {
|
||||||
LipSync *l = *i;
|
LipSync *l = *i;
|
||||||
if (strcmp(filename.c_str(), l->getFilename()) == 0) {
|
if (filename.c_str() == l->getFilename()) {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace Grim {
|
|||||||
int SaveGame::SAVEGAME_VERSION = 14;
|
int SaveGame::SAVEGAME_VERSION = 14;
|
||||||
|
|
||||||
// Constructor. Should create/open a saved game
|
// Constructor. Should create/open a saved game
|
||||||
SaveGame::SaveGame(const char *filename, bool saving) :
|
SaveGame::SaveGame(const Common::String &filename, bool saving) :
|
||||||
_saving(saving), _currentSection(0) {
|
_saving(saving), _currentSection(0) {
|
||||||
if (_saving) {
|
if (_saving) {
|
||||||
_outSaveFile = g_system->getSavefileManager()->openForSaving(filename);
|
_outSaveFile = g_system->getSavefileManager()->openForSaving(filename);
|
||||||
@ -303,7 +303,9 @@ void SaveGame::writeCharString(const char *string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SaveGame::writeString(const Common::String &string) {
|
void SaveGame::writeString(const Common::String &string) {
|
||||||
writeCharString(string.c_str());
|
int32 len = string.size();
|
||||||
|
writeLESint32(len);
|
||||||
|
write(string.c_str(), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics::Vector3d SaveGame::readVector3d() {
|
Graphics::Vector3d SaveGame::readVector3d() {
|
||||||
@ -350,9 +352,9 @@ const char *SaveGame::readCharString() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Common::String SaveGame::readString() {
|
Common::String SaveGame::readString() {
|
||||||
const char *str = readCharString();
|
int32 len = readLESint32();
|
||||||
Common::String s = str;
|
Common::String s((const char *)&_sectionBuffer[_sectionPtr], len);
|
||||||
delete[] str;
|
_sectionPtr += len;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class Color;
|
|||||||
|
|
||||||
class SaveGame {
|
class SaveGame {
|
||||||
public:
|
public:
|
||||||
SaveGame(const char *filename, bool saving);
|
SaveGame(const Common::String &filename, bool saving);
|
||||||
~SaveGame();
|
~SaveGame();
|
||||||
|
|
||||||
static int SAVEGAME_VERSION;
|
static int SAVEGAME_VERSION;
|
||||||
|
@ -39,7 +39,7 @@ namespace Grim {
|
|||||||
|
|
||||||
int Scene::s_id = 0;
|
int Scene::s_id = 0;
|
||||||
|
|
||||||
Scene::Scene(const char *sceneName, const char *buf, int len) :
|
Scene::Scene(const Common::String &sceneName, const char *buf, int len) :
|
||||||
_locked(false), _name(sceneName), _enableLights(false) {
|
_locked(false), _name(sceneName), _enableLights(false) {
|
||||||
|
|
||||||
++s_id;
|
++s_id;
|
||||||
@ -193,7 +193,7 @@ void Scene::saveState(SaveGame *savedState) const {
|
|||||||
savedState->writeString(_name);
|
savedState->writeString(_name);
|
||||||
savedState->writeLESint32(_numCmaps);
|
savedState->writeLESint32(_numCmaps);
|
||||||
for (int i = 0; i < _numCmaps; ++i) {
|
for (int i = 0; i < _numCmaps; ++i) {
|
||||||
savedState->writeCharString(_cmaps[i]->getFilename());
|
savedState->writeString(_cmaps[i]->getFilename());
|
||||||
}
|
}
|
||||||
savedState->writeLEUint32(_currSetup - _setups); // current setup id
|
savedState->writeLEUint32(_currSetup - _setups); // current setup id
|
||||||
savedState->writeLEUint32(_locked);
|
savedState->writeLEUint32(_locked);
|
||||||
@ -537,13 +537,13 @@ void Scene::findClosestSector(Graphics::Vector3d p, Sector **sect, Graphics::Vec
|
|||||||
ObjectState *Scene::findState(const char *filename) {
|
ObjectState *Scene::findState(const char *filename) {
|
||||||
// Check the different state objects for the bitmap
|
// Check the different state objects for the bitmap
|
||||||
for (StateList::iterator i = _states.begin(); i != _states.end(); ++i) {
|
for (StateList::iterator i = _states.begin(); i != _states.end(); ++i) {
|
||||||
const char *file = (*i)->getBitmapFilename();
|
const Common::String &file = (*i)->getBitmapFilename();
|
||||||
|
|
||||||
if (strcmp(file, filename) == 0)
|
if (file == filename)
|
||||||
return *i;
|
return *i;
|
||||||
if (scumm_stricmp(file, filename) == 0) {
|
if (file.compareToIgnoreCase(filename) == 0) {
|
||||||
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("State object request '%s' matches object '%s' but is the wrong case", filename, file);
|
warning("State object request '%s' matches object '%s' but is the wrong case", filename, file.c_str());
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class CMap;
|
|||||||
|
|
||||||
class Scene {
|
class Scene {
|
||||||
public:
|
public:
|
||||||
Scene(const char *name, const char *buf, int len);
|
Scene(const Common::String &name, const char *buf, int len);
|
||||||
Scene();
|
Scene();
|
||||||
~Scene();
|
~Scene();
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
void setSoundParameters(int minVolume, int maxVolume);
|
void setSoundParameters(int minVolume, int maxVolume);
|
||||||
void getSoundParameters(int *minVolume, int *maxVolume);
|
void getSoundParameters(int *minVolume, int *maxVolume);
|
||||||
|
|
||||||
const char *getName() const { return _name.c_str(); }
|
const Common::String &getName() const { return _name; }
|
||||||
|
|
||||||
void setLightEnableState(bool state) {
|
void setLightEnableState(bool state) {
|
||||||
_enableLights = state;
|
_enableLights = state;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user