aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorD G Turner2012-09-24 02:51:26 +0100
committerD G Turner2012-09-24 02:51:26 +0100
commitc9185c9b11bff71c49ab07d4fbf1d2c7a801b9b8 (patch)
treef455f970d6b661553e5d8f3d0e4d084092bb1ce9 /engines
parent86475a0b0687e4a90f8d9601f5ed7a40177b8491 (diff)
downloadscummvm-rg350-c9185c9b11bff71c49ab07d4fbf1d2c7a801b9b8.tar.gz
scummvm-rg350-c9185c9b11bff71c49ab07d4fbf1d2c7a801b9b8.tar.bz2
scummvm-rg350-c9185c9b11bff71c49ab07d4fbf1d2c7a801b9b8.zip
TEENAGENT: Cleanup Object classes.
This removes the underscores in various variables as per project coding standard.
Diffstat (limited to 'engines')
-rw-r--r--engines/teenagent/callbacks.cpp56
-rw-r--r--engines/teenagent/objects.cpp41
-rw-r--r--engines/teenagent/objects.h17
-rw-r--r--engines/teenagent/scene.cpp34
-rw-r--r--engines/teenagent/teenagent.cpp24
5 files changed, 85 insertions, 87 deletions
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp
index 9247dfde7b..bb51204ed3 100644
--- a/engines/teenagent/callbacks.cpp
+++ b/engines/teenagent/callbacks.cpp
@@ -3517,15 +3517,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(dsAddr_byeMsg); // "Bye."
{
Object *obj = scene->getObject(7);
- obj->actor_rect.left = obj->actor_rect.right = 228;
- obj->actor_rect.top = obj->actor_rect.bottom = 171;
- obj->actor_rect.save();
+ obj->actorRect.left = obj->actorRect.right = 228;
+ obj->actorRect.top = obj->actorRect.bottom = 171;
+ obj->actorRect.save();
}
{
Object *obj = scene->getObject(8);
- obj->actor_rect.left = obj->actor_rect.right = 290;
- obj->actor_rect.top = obj->actor_rect.bottom = 171;
- obj->actor_rect.save();
+ obj->actorRect.left = obj->actorRect.right = 290;
+ obj->actorRect.top = obj->actorRect.bottom = 171;
+ obj->actorRect.save();
}
}
break;
@@ -3675,16 +3675,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(dsAddr_dogHasBoneFlag, 1);
{
Object *o = scene->getObject(7);
- o->actor_rect.left = o->actor_rect.right = 297;
- o->actor_rect.top = o->actor_rect.bottom = 181;
- o->actor_orientation = 1;
+ o->actorRect.left = o->actorRect.right = 297;
+ o->actorRect.top = o->actorRect.bottom = 181;
+ o->actorOrientation = 1;
o->save();
}
{
Object *o = scene->getObject(9);
- o->actor_rect.left = o->actor_rect.right = 297;
- o->actor_rect.top = o->actor_rect.bottom = 181;
- o->actor_orientation = 1;
+ o->actorRect.left = o->actorRect.right = 297;
+ o->actorRect.top = o->actorRect.bottom = 181;
+ o->actorOrientation = 1;
o->save();
}
{
@@ -3729,7 +3729,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(dsAddr_caveThornsCutDownFlag, 1);
inventory->remove(invItemSickleSharp);
disableObject(2);
- scene->getObject(3)->actor_rect.right = 156;
+ scene->getObject(3)->actorRect.right = 156;
scene->getObject(3)->save();
break;
@@ -4494,23 +4494,23 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
disableObject(1);
{
Object *obj = scene->getObject(2);
- obj->actor_rect.left = obj->actor_rect.right = 81;
- obj->actor_rect.top = obj->actor_rect.bottom = 160;
- obj->actor_orientation = 4;
+ obj->actorRect.left = obj->actorRect.right = 81;
+ obj->actorRect.top = obj->actorRect.bottom = 160;
+ obj->actorOrientation = 4;
obj->save();
}
{
Object *obj = scene->getObject(3);
- obj->actor_rect.left = obj->actor_rect.right = 64;
- obj->actor_rect.top = obj->actor_rect.bottom = 168;
- obj->actor_orientation = 4;
+ obj->actorRect.left = obj->actorRect.right = 64;
+ obj->actorRect.top = obj->actorRect.bottom = 168;
+ obj->actorOrientation = 4;
obj->save();
}
{
Object *obj = scene->getObject(10);
- obj->actor_rect.left = obj->actor_rect.right = 105;
- obj->actor_rect.top = obj->actor_rect.bottom = 160;
- obj->actor_orientation = 1;
+ obj->actorRect.left = obj->actorRect.right = 105;
+ obj->actorRect.top = obj->actorRect.bottom = 160;
+ obj->actorOrientation = 1;
obj->save();
}
SET_FLAG(dsAddr_MansionCookGoneFlag, 1);
@@ -4890,15 +4890,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
dialog->showMark(130, scene);
Object *obj = scene->getObject(1);
- obj->actor_rect.left = obj->actor_rect.right = 270;
- obj->actor_rect.top = obj->actor_rect.bottom = 193;
- obj->actor_orientation = 2;
+ obj->actorRect.left = obj->actorRect.right = 270;
+ obj->actorRect.top = obj->actorRect.bottom = 193;
+ obj->actorOrientation = 2;
obj->save();
obj = scene->getObject(3);
- obj->actor_rect.left = obj->actor_rect.right = 254;
- obj->actor_rect.top = obj->actor_rect.bottom = 193;
- obj->actor_orientation = 1;
+ obj->actorRect.left = obj->actorRect.right = 254;
+ obj->actorRect.top = obj->actorRect.bottom = 193;
+ obj->actorOrientation = 1;
obj->save();
SET_FLAG(dsAddr_MansionThruFanByTimePillFlag, 1);
diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp
index 171d991114..5dad9ab99d 100644
--- a/engines/teenagent/objects.cpp
+++ b/engines/teenagent/objects.cpp
@@ -53,7 +53,6 @@ void Rect::render(Graphics::Surface *surface, uint8 color) const {
surface->vLine(right, bottom, top, color);
}
-
void Object::load(byte *src) {
_base = src;
@@ -61,39 +60,39 @@ void Object::load(byte *src) {
rect.load(src);
src += 8;
- actor_rect.load(src);
+ actorRect.load(src);
src += 8;
- actor_orientation = *src++;
+ actorOrientation = *src++;
enabled = *src++;
name = (const char *)src;
- description = parse_description((const char *)src);
+ description = parseDescription((const char *)src);
}
void Object::save() const {
assert(_base != NULL);
rect.save();
- actor_rect.save();
- _base[17] = actor_orientation;
+ actorRect.save();
+ _base[17] = actorOrientation;
_base[18] = enabled;
}
-void Object::setName(const Common::String &new_name) {
+void Object::setName(const Common::String &newName) {
assert(_base != 0);
- strcpy((char *)(_base + 19), new_name.c_str());
- name = new_name;
+ strcpy((char *)(_base + 19), newName.c_str());
+ name = newName;
}
void Object::dump(int level) const {
debugC(level, kDebugObject, "object: %u %u [%u,%u,%u,%u], actor: [%u,%u,%u,%u], orientation: %u, name: %s", id, enabled,
rect.left, rect.top, rect.right, rect.bottom,
- actor_rect.left, actor_rect.top, actor_rect.right, actor_rect.bottom,
- actor_orientation, name.c_str()
+ actorRect.left, actorRect.top, actorRect.right, actorRect.bottom,
+ actorOrientation, name.c_str()
);
}
-Common::String Object::parse_description(const char *name) {
+Common::String Object::parseDescription(const char *name) {
const char *desc = name + strlen(name) + 1;
if (*desc == 0)
return Common::String();
@@ -126,23 +125,23 @@ void InventoryObject::load(byte *src) {
id = *src++;
animated = *src++;
name = (const char *)src;
- description = Object::parse_description((const char *)src);
+ description = Object::parseDescription((const char *)src);
}
void UseHotspot::load(byte *src) {
Common::MemoryReadStream in(src, 9);
- inventory_id = in.readByte();
- object_id = in.readByte();
+ inventoryId = in.readByte();
+ objectId = in.readByte();
orientation = in.readByte();
- actor_x = in.readUint16LE();
- actor_y = in.readUint16LE();
+ actorX = in.readUint16LE();
+ actorY = in.readUint16LE();
callback = in.readUint16LE();
}
void UseHotspot::dump(int level) const {
debugC(level, kDebugObject,
- "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x",
- inventory_id, object_id, orientation, actor_x, actor_y, callback
+ "hotspot: invId: %02x, objId: %02x, orientation: %02x, actor position: (%d,%d), callback: %04x",
+ inventoryId, objectId, orientation, actorX, actorY, callback
);
}
@@ -150,7 +149,7 @@ void Walkbox::dump(int level) const {
debugC(level, kDebugObject, "walkbox %02x %02x [%d, %d, %d, %d] top: %u, right: %u, bottom: %u, left: %u",
type, orientation,
rect.left, rect.top, rect.right, rect.bottom,
- side_hint[0], side_hint[1], side_hint[2], side_hint[3]);
+ sideHint[0], sideHint[1], sideHint[2], sideHint[3]);
}
void Walkbox::load(byte *src) {
@@ -161,7 +160,7 @@ void Walkbox::load(byte *src) {
rect.load(src);
src += 8;
for (byte i = 0; i < 4; ++i)
- side_hint[i] = *src++;
+ sideHint[i] = *src++;
}
void Walkbox::save() const {
diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h
index a0211dee83..ff061eccb7 100644
--- a/engines/teenagent/objects.h
+++ b/engines/teenagent/objects.h
@@ -156,22 +156,21 @@ protected:
};
struct Object {
-
byte id; //0
Rect rect; //1
- Rect actor_rect; //9
- byte actor_orientation; //17
+ Rect actorRect; //9
+ byte actorOrientation; //17
byte enabled; //18
//19
Common::String name, description;
Object(): _base(NULL) {}
void dump(int level = 0) const;
- void setName(const Common::String &name);
+ void setName(const Common::String &newName);
void load(byte *addr);
void save() const;
- static Common::String parse_description(const char *name);
+ static Common::String parseDescription(const char *name);
protected:
byte *_base;
@@ -190,10 +189,10 @@ protected:
};
struct UseHotspot {
- byte inventory_id;
- byte object_id;
+ byte inventoryId;
+ byte objectId;
byte orientation;
- uint16 actor_x, actor_y;
+ uint16 actorX, actorY;
uint16 callback;
void load(byte *src);
void dump(int level = 0) const;
@@ -203,7 +202,7 @@ struct Walkbox {
byte type;
byte orientation;
Rect rect;
- byte side_hint[4];
+ byte sideHint[4];
Walkbox() : _base(NULL) {}
void dump(int level = 0) const;
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index f2a8a8d012..bcb93cd65a 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -127,10 +127,10 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
debugC(1, kDebugScene, "%u: intersection mask 0x%04x, searching hints", *wi, mask);
int dx = p2.x - p1.x, dy = p2.y - p1.y;
if (dx >= 0) {
- if ((mask & 8) != 0 && w.side_hint[3] != 0) {
- debugC(1, kDebugScene, "hint left: %u", w.side_hint[3]);
+ if ((mask & 8) != 0 && w.sideHint[3] != 0) {
+ debugC(1, kDebugScene, "hint left: %u", w.sideHint[3]);
Common::Point w1, w2;
- w.rect.side(w1, w2, w.side_hint[3], p1);
+ w.rect.side(w1, w2, w.sideHint[3], p1);
debugC(1, kDebugScene, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
if (mask & 2)
@@ -139,10 +139,10 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
break;
}
} else {
- if ((mask & 2) != 0 && w.side_hint[1] != 0) {
- debugC(1, kDebugScene, "hint right: %u", w.side_hint[1]);
+ if ((mask & 2) != 0 && w.sideHint[1] != 0) {
+ debugC(1, kDebugScene, "hint right: %u", w.sideHint[1]);
Common::Point w1, w2;
- w.rect.side(w1, w2, w.side_hint[1], p1);
+ w.rect.side(w1, w2, w.sideHint[1], p1);
debugC(1, kDebugScene, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
if (mask & 8)
@@ -153,10 +153,10 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
}
if (dy >= 0) {
- if ((mask & 1) != 0 && w.side_hint[0] != 0) {
- debugC(1, kDebugScene, "hint top: %u", w.side_hint[0]);
+ if ((mask & 1) != 0 && w.sideHint[0] != 0) {
+ debugC(1, kDebugScene, "hint top: %u", w.sideHint[0]);
Common::Point w1, w2;
- w.rect.side(w1, w2, w.side_hint[0], p1);
+ w.rect.side(w1, w2, w.sideHint[0], p1);
debugC(1, kDebugScene, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
if (mask & 4)
@@ -165,10 +165,10 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
break;
}
} else {
- if ((mask & 4) != 0 && w.side_hint[2] != 0) {
- debugC(1, kDebugScene, "hint bottom: %u", w.side_hint[2]);
+ if ((mask & 4) != 0 && w.sideHint[2] != 0) {
+ debugC(1, kDebugScene, "hint bottom: %u", w.sideHint[2]);
Common::Point w1, w2;
- w.rect.side(w1, w2, w.side_hint[2], p1);
+ w.rect.side(w1, w2, w.sideHint[2], p1);
debugC(1, kDebugScene, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
if (mask & 1)
@@ -265,11 +265,11 @@ void Scene::loadObjectData() {
for (byte j = 0; j < walkboxes_n; ++j) {
Walkbox w;
w.load(walkboxes_base + 14 * j);
- if ((w.side_hint[0] | w.side_hint[1] | w.side_hint[2] | w.side_hint[3]) == 0) {
- w.side_hint[0] = 2;
- w.side_hint[1] = 3;
- w.side_hint[2] = 4;
- w.side_hint[3] = 1;
+ if ((w.sideHint[0] | w.sideHint[1] | w.sideHint[2] | w.sideHint[3]) == 0) {
+ w.sideHint[0] = 2;
+ w.sideHint[1] = 3;
+ w.sideHint[2] = 4;
+ w.sideHint[3] = 1;
}
//walkbox[i]->dump();
scene_walkboxes.push_back(w);
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index db3b02e8fb..a914c84f12 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -110,11 +110,11 @@ bool TeenAgentEngine::trySelectedObject() {
const Common::Array<UseHotspot> &hotspots = _useHotspots[scene->getId() - 1];
for (uint i = 0; i < hotspots.size(); ++i) {
const UseHotspot &spot = hotspots[i];
- if (spot.inventory_id == inv->id && _dstObject->id == spot.object_id) {
+ if (spot.inventoryId == inv->id && _dstObject->id == spot.objectId) {
debugC(0, kDebugObject, "use object on hotspot!");
spot.dump();
- if (spot.actor_x != 0xffff && spot.actor_y != 0xffff)
- moveTo(spot.actor_x, spot.actor_y, spot.orientation);
+ if (spot.actorX != 0xffff && spot.actorY != 0xffff)
+ moveTo(spot.actorX, spot.actorY, spot.orientation);
if (!processCallback(spot.callback))
debugC(0, kDebugObject, "FIXME: display proper description");
inventory->resetSelectedObject();
@@ -169,13 +169,13 @@ void TeenAgentEngine::use(Object *object) {
_dstObject = object;
object->rect.dump();
- object->actor_rect.dump();
+ object->actorRect.dump();
_action = kActionUse;
- if (object->actor_rect.valid())
- scene->moveTo(Common::Point(object->actor_rect.right, object->actor_rect.bottom), object->actor_orientation);
- else if (object->actor_orientation > 0)
- scene->setOrientation(object->actor_orientation);
+ if (object->actorRect.valid())
+ scene->moveTo(Common::Point(object->actorRect.right, object->actorRect.bottom), object->actorOrientation);
+ else if (object->actorOrientation > 0)
+ scene->setOrientation(object->actorOrientation);
}
void TeenAgentEngine::examine(const Common::Point &point, Object *object) {
@@ -183,11 +183,11 @@ void TeenAgentEngine::examine(const Common::Point &point, Object *object) {
return;
if (object != NULL) {
- Common::Point dst = object->actor_rect.center();
+ Common::Point dst = object->actorRect.center();
debugC(0, kDebugObject, "click %d, %d, object %d, %d", point.x, point.y, dst.x, dst.y);
_action = kActionExamine;
- if (object->actor_rect.valid())
- scene->moveTo(dst, object->actor_orientation, true); // validate examine message. Original engine does not let you into walkboxes
+ if (object->actorRect.valid())
+ scene->moveTo(dst, object->actorOrientation, true); // validate examine message. Original engine does not let you into walkboxes
_dstObject = object;
} else if (!_sceneBusy) {
// do not reset anything while scene is busy, but allow interrupts while walking.
@@ -827,7 +827,7 @@ void TeenAgentEngine::moveTo(const Common::Point &dst, byte o, bool warp) {
}
void TeenAgentEngine::moveTo(Object *obj) {
- moveTo(obj->actor_rect.right, obj->actor_rect.bottom, obj->actor_orientation);
+ moveTo(obj->actorRect.right, obj->actorRect.bottom, obj->actorOrientation);
}
void TeenAgentEngine::moveTo(uint16 x, uint16 y, byte o, bool warp) {