[Scummvm-cvs-logs] SF.net SVN: scummvm:[47968] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Sun Feb 7 18:12:52 CET 2010
Revision: 47968
http://scummvm.svn.sourceforge.net/scummvm/?rev=47968&view=rev
Author: megath
Date: 2010-02-07 17:12:52 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
pathfinding improvements, added async flag setting
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/scene.cpp
scummvm/trunk/engines/teenagent/scene.h
Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp 2010-02-07 16:12:31 UTC (rev 47967)
+++ scummvm/trunk/engines/teenagent/scene.cpp 2010-02-07 17:12:52 UTC (rev 47968)
@@ -95,6 +95,8 @@
w.rect.side(w1, w2, w.side_hint[3], p1);
debug(1, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
+ if (mask & 2)
+ p.insert(next, w2);
boxes.erase(wi);
break;
}
@@ -105,6 +107,8 @@
w.rect.side(w1, w2, w.side_hint[1], p1);
debug(1, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
+ if (mask & 8)
+ p.insert(next, w2);
boxes.erase(wi);
break;
}
@@ -117,6 +121,8 @@
w.rect.side(w1, w2, w.side_hint[0], p1);
debug(1, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
+ if (mask & 4)
+ p.insert(next, w2);
boxes.erase(wi);
break;
}
@@ -127,6 +133,8 @@
w.rect.side(w1, w2, w.side_hint[2], p1);
debug(1, "hint: %d,%d-%d,%d", w1.x, w1.y, w2.x, w2.y);
p.insert(next, w1);
+ if (mask & 1)
+ p.insert(next, w2);
boxes.erase(wi);
break;
}
@@ -144,29 +152,28 @@
debug(0, "moveTo(%d, %d, %u)", point.x, point.y, orient);
const Common::Array<Walkbox> &scene_walkboxes = walkboxes[_id - 1];
- if (validate) {
- for (byte i = 0; i < scene_walkboxes.size(); ++i) {
- const Walkbox &w = scene_walkboxes[i];
- if (w.rect.in(point)) {
- debug(0, "bumped into walkbox %u", i);
- w.dump();
- byte o = w.orientation;
- switch (o) {
- case 1:
- point.y = w.rect.top - 1;
- break;
- case 2:
- point.x = w.rect.right + 1;
- break;
- case 3:
- point.y = w.rect.bottom + 1;
- break;
- case 4:
- point.x = w.rect.left - 1;
- break;
- default:
+ for (byte i = 0; i < scene_walkboxes.size(); ++i) {
+ const Walkbox &w = scene_walkboxes[i];
+ if (w.rect.in(point)) {
+ debug(0, "bumped into walkbox %u", i);
+ w.dump();
+ byte o = w.orientation;
+ switch (o) {
+ case 1:
+ point.y = w.rect.top - 1;
+ break;
+ case 2:
+ point.x = w.rect.right + 1;
+ break;
+ case 3:
+ point.y = w.rect.bottom + 1;
+ break;
+ case 4:
+ point.x = w.rect.left - 1;
+ break;
+ default:
+ if (validate)
return;
- }
}
}
}
@@ -251,6 +258,12 @@
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;
+ }
//walkbox[i]->dump();
scene_walkboxes.push_back(w);
}
@@ -481,7 +494,7 @@
}
break;
}
-#if 0
+#if 1
case '1':
case '2':
case '3':
@@ -1093,6 +1106,12 @@
_engine->quitGame();
break;
+ case SceneEvent::kSetFlag:
+ debug(0, "async set_flag(%04x, %d)", current_event.callback, current_event.color);
+ Resources::instance()->dseg.set_byte(current_event.callback, current_event.color);
+ current_event.clear();
+ break;
+
default:
error("empty/unhandler event[%d]", (int)current_event.type);
}
Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h 2010-02-07 16:12:31 UTC (rev 47967)
+++ scummvm/trunk/engines/teenagent/scene.h 2010-02-07 17:12:52 UTC (rev 47968)
@@ -62,6 +62,7 @@
kEffect,
kFade,
kWait,
+ kSetFlag,
kQuit
} type;
@@ -133,7 +134,7 @@
void warp(const Common::Point &point, byte orientation = 0);
- void moveTo(const Common::Point &point, byte orientation = 0, bool validate = 0);
+ void moveTo(const Common::Point &point, byte orientation = 0, bool validate = false);
Common::Point getPosition() const { return position; }
void displayMessage(const Common::String &str, byte color = 0xd1, const Common::Point &pos = Common::Point());
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