[Scummvm-cvs-logs] SF.net SVN: scummvm:[45715] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Sat Nov 7 09:35:24 CET 2009
Revision: 45715
http://scummvm.svn.sourceforge.net/scummvm/?rev=45715&view=rev
Author: megath
Date: 2009-11-07 08:35:24 +0000 (Sat, 07 Nov 2009)
Log Message:
-----------
"constify" dump and save methods, added intersects_hline/intersects_vline
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/objects.cpp
scummvm/trunk/engines/teenagent/objects.h
Modified: scummvm/trunk/engines/teenagent/objects.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/objects.cpp 2009-11-07 04:56:28 UTC (rev 45714)
+++ scummvm/trunk/engines/teenagent/objects.cpp 2009-11-07 08:35:24 UTC (rev 45715)
@@ -38,7 +38,7 @@
bottom = ins.readUint16LE();
}
-void Rect::save() {
+void Rect::save() const {
assert(_base != NULL);
Common::MemoryWriteStream outs(_base, 8);
outs.writeUint16LE(left);
@@ -71,7 +71,7 @@
description = parse_description((const char *)src);
}
-void Object::save() {
+void Object::save() const {
assert(_base != NULL);
rect.save();
@@ -86,7 +86,7 @@
name = new_name;
}
-void Object::dump() {
+void Object::dump() const {
debug(0, "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,
@@ -140,9 +140,9 @@
callback = in.readUint16LE();
}
-void Walkbox::dump() {
+void Walkbox::dump() const {
debug(0, "walkbox %02x %02x [%d, %d, %d, %d] %02x %02x %02x %02x ",
- unk00, orientation,
+ type, orientation,
rect.left, rect.right, rect.top, rect.bottom,
unk0a, unk0b, unk0c, unk0d);
}
@@ -150,7 +150,7 @@
void Walkbox::load(byte *src) {
_base = src;
- unk00 = *src++;
+ type = *src++;
orientation = *src++;
rect.load(src);
src += 8;
@@ -160,8 +160,9 @@
unk0d = *src++;
}
-void Walkbox::save() {
+void Walkbox::save() const {
assert(_base != NULL);
+ _base[0] = type;
_base[1] = orientation;
rect.save();
}
Modified: scummvm/trunk/engines/teenagent/objects.h
===================================================================
--- scummvm/trunk/engines/teenagent/objects.h 2009-11-07 04:56:28 UTC (rev 45714)
+++ scummvm/trunk/engines/teenagent/objects.h 2009-11-07 08:35:24 UTC (rev 45715)
@@ -61,8 +61,16 @@
}
void load(byte *src); //8 bytes
- void save();
+ void save() const;
+
+ inline bool intersects_hline(int x1, int x2, int y) const {
+ return x1 < right && x2 > left && y >= top && y < bottom;
+ }
+ inline bool intersects_vline(int x, int y1, int y2) const {
+ return y1 < bottom && y2 > top && x >= left && x < right;
+ }
+
protected:
byte * _base;
};
@@ -79,10 +87,10 @@
Common::String name, description;
Object(): _base(NULL) {}
- void dump();
+ void dump() const;
void setName(const Common::String &name);
void load(byte *addr);
- void save();
+ void save() const;
static Common::String parse_description(const char *name);
@@ -112,7 +120,7 @@
};
struct Walkbox {
- byte unk00;
+ byte type;
byte orientation;
Rect rect;
byte unk0a;
@@ -121,9 +129,9 @@
byte unk0d;
Walkbox() : _base(NULL) {}
- void dump();
+ void dump() const;
void load(byte *src);
- void save();
+ void save() const;
protected:
byte * _base;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list