Cleanings. Mostly indent fixes.
This commit is contained in:
parent
f1420f4704
commit
cff70f9fad
15 changed files with 57 additions and 64 deletions
|
@ -805,7 +805,7 @@ Costume *Actor::findCostume(const char *n) {
|
||||||
for (Common::List<CostumePtr>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
|
for (Common::List<CostumePtr>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
|
||||||
if (strcasecmp((*i)->filename(), n) == 0)
|
if (strcasecmp((*i)->filename(), n) == 0)
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ void Actor::update() {
|
||||||
// _turning = false;
|
// _turning = false;
|
||||||
} else {
|
} else {
|
||||||
_pos += dir * walkAmt;
|
_pos += dir * walkAmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
_walkedCur = true;
|
_walkedCur = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,11 @@ Bitmap::Bitmap(const char *data, int w, int h, const char *fname) : Object() {
|
||||||
g_driver->createBitmap(this);
|
g_driver->createBitmap(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bitmap::Bitmap() :
|
||||||
|
Object() {
|
||||||
|
_data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void Bitmap::draw() const {
|
void Bitmap::draw() const {
|
||||||
if (_currImage == 0)
|
if (_currImage == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,7 +37,7 @@ 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 char *filename, const char *data, int len);
|
||||||
Bitmap(const char *data, int width, int height, const char *filename);
|
Bitmap(const char *data, int width, int height, const char *filename);
|
||||||
Bitmap() : Object() { _data = 0; }
|
Bitmap();
|
||||||
|
|
||||||
const char *filename() const { return _fname.c_str(); }
|
const char *filename() const { return _fname.c_str(); }
|
||||||
|
|
||||||
|
|
|
@ -589,9 +589,9 @@ public:
|
||||||
void setKey(int val);
|
void setKey(int val);
|
||||||
void reset();
|
void reset();
|
||||||
~SoundComponent() {
|
~SoundComponent() {
|
||||||
// Stop the sound if it's in progress
|
// Stop the sound if it's in progress
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Common::String _soundName;
|
Common::String _soundName;
|
||||||
|
@ -637,9 +637,9 @@ void SoundComponent::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Costume::Costume(const char *fname, const char *data, int len, Costume *prevCost) :
|
Costume::Costume(const char *fname, const char *data, int len, Costume *prevCost) :
|
||||||
Object() {
|
Object() {
|
||||||
|
|
||||||
load(fname, data, len, prevCost);
|
load(fname, data, len, prevCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Costume::load(const char *filename, const char *data, int len, Costume *prevCost) {
|
void Costume::load(const char *filename, const char *data, int len, Costume *prevCost) {
|
||||||
|
@ -651,7 +651,7 @@ void Costume::load(const char *filename, const char *data, int len, Costume *pre
|
||||||
_headPitch = 0;
|
_headPitch = 0;
|
||||||
_lastTime = 0;
|
_lastTime = 0;
|
||||||
_headZ = 0;
|
_headZ = 0;
|
||||||
_prevCostume = prevCost;
|
_prevCostume = prevCost;
|
||||||
|
|
||||||
TextSplitter ts(data, len);
|
TextSplitter ts(data, len);
|
||||||
|
|
||||||
|
@ -1113,7 +1113,7 @@ void Costume::moveHead() {
|
||||||
if (v.isZero()) {
|
if (v.isZero()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// cout<<_lookAt.x()<<" "<<_lookAt.y()<<" "<<_lookAt.z()<<" "<<v.x()<<" "<<v.y()<<" "<<v.z()<<endl;
|
|
||||||
float magnitude = sqrt(v.x() * v.x() + v.y() * v.y());
|
float magnitude = sqrt(v.x() * v.x() + v.y() * v.y());
|
||||||
float a = v.x() / magnitude;
|
float a = v.x() / magnitude;
|
||||||
float b = v.y() / magnitude;
|
float b = v.y() / magnitude;
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
Costume(const char *filename, const char *data, int len, Costume *prevCost);
|
Costume(const char *filename, const char *data, int len, Costume *prevCost);
|
||||||
Costume() : Object() { _chores = 0; }
|
Costume() : Object() { _chores = 0; }
|
||||||
|
|
||||||
void load(const char *filename, const char *data, int len, Costume *prevCost);
|
void load(const char *filename, const char *data, int len, Costume *prevCost);
|
||||||
|
|
||||||
virtual ~Costume();
|
virtual ~Costume();
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ 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);
|
||||||
void moveHead();
|
void moveHead();
|
||||||
|
|
||||||
Common::String _fname;
|
Common::String _fname;
|
||||||
CostumePtr _prevCostume;
|
CostumePtr _prevCostume;
|
||||||
|
|
||||||
int _numComponents;
|
int _numComponents;
|
||||||
Component **_components;
|
Component **_components;
|
||||||
|
|
|
@ -177,9 +177,9 @@ public:
|
||||||
|
|
||||||
void setSelectedActor(Actor *a) { _selectedActor = a; }
|
void setSelectedActor(Actor *a) { _selectedActor = a; }
|
||||||
Actor *selectedActor() { return _selectedActor; }
|
Actor *selectedActor() { return _selectedActor; }
|
||||||
void killActors();
|
void killActors();
|
||||||
|
|
||||||
// Text Object Registration
|
// Text Object Registration
|
||||||
typedef Common::HashMap<int, TextObject *> TextListType;
|
typedef Common::HashMap<int, TextObject *> TextListType;
|
||||||
TextListType::const_iterator textsBegin() const {
|
TextListType::const_iterator textsBegin() const {
|
||||||
return _textObjects.begin();
|
return _textObjects.begin();
|
||||||
|
|
|
@ -44,11 +44,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
ObjectState(int setupID, ObjectState::Position pos, const char *bitmap, const char *zbitmap, bool visible);
|
ObjectState(int setupID, ObjectState::Position pos, const char *bitmap, const char *zbitmap, bool visible);
|
||||||
ObjectState();
|
ObjectState();
|
||||||
~ObjectState();
|
~ObjectState();
|
||||||
|
|
||||||
void saveState(SaveGame *savedState) const;
|
void saveState(SaveGame *savedState) const;
|
||||||
bool restoreState(SaveGame *savedState);
|
bool restoreState(SaveGame *savedState);
|
||||||
|
|
||||||
int setupID() const { return _setupID; }
|
int setupID() const { return _setupID; }
|
||||||
Position pos() const { return _pos; }
|
Position pos() const { return _pos; }
|
||||||
|
|
|
@ -232,19 +232,19 @@ void SaveGame::writeByte(byte data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGame::writeVector3d(const Graphics::Vector3d &vec) {
|
void SaveGame::writeVector3d(const Graphics::Vector3d &vec) {
|
||||||
writeFloat(vec.x());
|
writeFloat(vec.x());
|
||||||
writeFloat(vec.y());
|
writeFloat(vec.y());
|
||||||
writeFloat(vec.z());
|
writeFloat(vec.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGame::writeColor(const Grim::Color &color) {
|
void SaveGame::writeColor(const Grim::Color &color) {
|
||||||
writeByte(color.red());
|
writeByte(color.red());
|
||||||
writeByte(color.green());
|
writeByte(color.green());
|
||||||
writeByte(color.blue());
|
writeByte(color.blue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGame::writeFloat(float data) {
|
void SaveGame::writeFloat(float data) {
|
||||||
write(reinterpret_cast<void *>(&data), sizeof(float));
|
write(reinterpret_cast<void *>(&data), sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGame::writeCharString(const char *string) {
|
void SaveGame::writeCharString(const char *string) {
|
||||||
|
@ -258,25 +258,25 @@ void SaveGame::writeString(const Common::String &string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics::Vector3d SaveGame::readVector3d() {
|
Graphics::Vector3d SaveGame::readVector3d() {
|
||||||
float x = readFloat();
|
float x = readFloat();
|
||||||
float y = readFloat();
|
float y = readFloat();
|
||||||
float z = readFloat();
|
float z = readFloat();
|
||||||
return Graphics::Vector3d(x, y, z);
|
return Graphics::Vector3d(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
Grim::Color SaveGame::readColor() {
|
Grim::Color SaveGame::readColor() {
|
||||||
Color color;
|
Color color;
|
||||||
color.red() = readByte();
|
color.red() = readByte();
|
||||||
color.green() = readByte();
|
color.green() = readByte();
|
||||||
color.blue() = readByte();
|
color.blue() = readByte();
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
float SaveGame::readFloat() {
|
float SaveGame::readFloat() {
|
||||||
float f;
|
float f;
|
||||||
read(reinterpret_cast<void *>(&f), sizeof(float));
|
read(reinterpret_cast<void *>(&f), sizeof(float));
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *SaveGame::readCharString() {
|
const char *SaveGame::readCharString() {
|
||||||
|
|
|
@ -57,12 +57,12 @@ public:
|
||||||
void writeCharString(const char *string);
|
void writeCharString(const char *string);
|
||||||
void writeString(const Common::String &string);
|
void writeString(const Common::String &string);
|
||||||
|
|
||||||
void writeVector3d(const Graphics::Vector3d &vec);
|
void writeVector3d(const Graphics::Vector3d &vec);
|
||||||
void writeColor(const Grim::Color &color);
|
void writeColor(const Grim::Color &color);
|
||||||
void writeFloat(float data);
|
void writeFloat(float data);
|
||||||
Graphics::Vector3d readVector3d();
|
Graphics::Vector3d readVector3d();
|
||||||
Grim::Color readColor();
|
Grim::Color readColor();
|
||||||
float readFloat();
|
float readFloat();
|
||||||
const char *readCharString();
|
const char *readCharString();
|
||||||
Common::String readString();
|
Common::String readString();
|
||||||
|
|
||||||
|
|
|
@ -107,9 +107,9 @@ Scene::Scene(const char *sceneName, const char *buf, int len) :
|
||||||
for (int i = 0; i < _numSectors; i++) {
|
for (int i = 0; i < _numSectors; i++) {
|
||||||
_sectors[i] = new Sector();
|
_sectors[i] = new Sector();
|
||||||
_sectors[i]->load(ts);
|
_sectors[i]->load(ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
++s_id;
|
++s_id;
|
||||||
_id = s_id;
|
_id = s_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
~Scene();
|
~Scene();
|
||||||
|
|
||||||
void saveState(SaveGame *savedState) const;
|
void saveState(SaveGame *savedState) const;
|
||||||
bool restoreState(SaveGame *savedState);
|
bool restoreState(SaveGame *savedState);
|
||||||
|
|
||||||
int _minVolume;
|
int _minVolume;
|
||||||
int _maxVolume;
|
int _maxVolume;
|
||||||
|
|
|
@ -75,8 +75,6 @@ TextObject::~TextObject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextObject::saveState(SaveGame *state) const {
|
void TextObject::saveState(SaveGame *state) const {
|
||||||
// state->writeLESint32(_created);
|
|
||||||
|
|
||||||
state->writeColor(_fgColor);
|
state->writeColor(_fgColor);
|
||||||
|
|
||||||
state->writeLESint32(_x);
|
state->writeLESint32(_x);
|
||||||
|
@ -96,8 +94,6 @@ void TextObject::saveState(SaveGame *state) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextObject::restoreState(SaveGame *state) {
|
bool TextObject::restoreState(SaveGame *state) {
|
||||||
// _created = state->readLESint32();
|
|
||||||
|
|
||||||
_fgColor = state->readColor();
|
_fgColor = state->readColor();
|
||||||
|
|
||||||
_x = state->readLESint32();
|
_x = state->readLESint32();
|
||||||
|
|
|
@ -85,8 +85,8 @@ public:
|
||||||
const char *name() const { return _textID; }
|
const char *name() const { return _textID; }
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void saveState(SaveGame *state) const;
|
void saveState(SaveGame *state) const;
|
||||||
bool restoreState(SaveGame *state);
|
bool restoreState(SaveGame *state);
|
||||||
|
|
||||||
enum Justify {
|
enum Justify {
|
||||||
NONE,
|
NONE,
|
||||||
|
|
|
@ -39,10 +39,7 @@ void Sector::saveState(SaveGame *savedState) const {
|
||||||
savedState->writeLESint32(_visible);
|
savedState->writeLESint32(_visible);
|
||||||
savedState->writeFloat(_height);
|
savedState->writeFloat(_height);
|
||||||
|
|
||||||
const char *str = _name.c_str();
|
savedState->writeString(_name);
|
||||||
int32 size = strlen(str);
|
|
||||||
savedState->writeLESint32(size);
|
|
||||||
savedState->write(str, size);
|
|
||||||
|
|
||||||
for (int i = 0; i < _numVertices + 1; ++i) {
|
for (int i = 0; i < _numVertices + 1; ++i) {
|
||||||
savedState->writeVector3d(_vertices[i]);
|
savedState->writeVector3d(_vertices[i]);
|
||||||
|
@ -58,12 +55,7 @@ bool Sector::restoreState(SaveGame *savedState) {
|
||||||
_visible = savedState->readLESint32();
|
_visible = savedState->readLESint32();
|
||||||
_height = savedState->readFloat();
|
_height = savedState->readFloat();
|
||||||
|
|
||||||
int32 size = savedState->readLESint32();
|
_name = savedState->readString();
|
||||||
char *str = new char[size+1];
|
|
||||||
savedState->read(str, size);
|
|
||||||
str[size]='\0';
|
|
||||||
_name = str;
|
|
||||||
delete[] str;
|
|
||||||
|
|
||||||
_vertices = new Graphics::Vector3d[_numVertices + 1];
|
_vertices = new Graphics::Vector3d[_numVertices + 1];
|
||||||
for (int i = 0; i < _numVertices + 1; ++i) {
|
for (int i = 0; i < _numVertices + 1; ++i) {
|
||||||
|
|
|
@ -40,8 +40,8 @@ public:
|
||||||
Sector() : _vertices(NULL) {}
|
Sector() : _vertices(NULL) {}
|
||||||
virtual ~Sector() { if (_vertices) delete[] _vertices; }
|
virtual ~Sector() { if (_vertices) delete[] _vertices; }
|
||||||
|
|
||||||
void saveState(SaveGame *savedState) const;
|
void saveState(SaveGame *savedState) const;
|
||||||
bool restoreState(SaveGame *savedState);
|
bool restoreState(SaveGame *savedState);
|
||||||
|
|
||||||
void load(TextSplitter &ts);
|
void load(TextSplitter &ts);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue