[Scummvm-cvs-logs] SF.net SVN: scummvm:[40383] scummvm/trunk/engines/sci/engine/kpathing.cpp
waltervn at users.sourceforge.net
waltervn at users.sourceforge.net
Fri May 8 14:39:40 CEST 2009
Revision: 40383
http://scummvm.svn.sourceforge.net/scummvm/?rev=40383&view=rev
Author: waltervn
Date: 2009-05-08 12:39:37 +0000 (Fri, 08 May 2009)
Log Message:
-----------
SCI: AvoidPath: Fixed a regression caused by previous commit, and added a
workaround for ECO room 300.
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kpathing.cpp
Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp 2009-05-08 12:37:28 UTC (rev 40382)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp 2009-05-08 12:39:37 UTC (rev 40383)
@@ -927,8 +927,8 @@
FloatPoint new_point;
uint32 new_dist;
- // Ignore edges on the screen border
- if (edge_on_screen_border(p1, p2))
+ // Ignore edges on the screen border, except for contained access polygons
+ if ((polygon->type != POLY_CONTAINED_ACCESS) && (edge_on_screen_border(p1, p2)))
continue;
// Compute near point
@@ -1142,7 +1142,7 @@
case POLY_CONTAINED_ACCESS:
case POLY_BARRED_ACCESS:
case POLY_NEAREST_ACCESS:
- if (cont == CONT_INSIDE) {
+ if (cont != CONT_OUTSIDE) {
if (s->_appendPoint != NULL) {
// We shouldn't get here twice
warning("AvoidPath: end point is contained in multiple polygons");
@@ -1230,15 +1230,24 @@
// WORKAROUND: broken polygon in LSL1VGA, room 350, after opening elevator
// Polygon has 17 points but size is set to 19
- if (s->_gameName == "LSL1") {
+ if ((size == 19) && (s->_gameName == "LSL1")) {
// FIXME: implement function to get current room number
if ((KP_UINT(s->script_000->locals_block->locals[13]) == 350)
- && (size == 19) && (read_point(list, is_reg_t, 18) == Common::Point(108, 137))) {
- debug(1, "Applying fix for broken polygon in LSL1, room 350");
+ && (read_point(list, is_reg_t, 18) == Common::Point(108, 137))) {
+ debug(1, "Applying fix for broken polygon in LSL1VGA, room 350");
size = 17;
}
}
+ // WORKAROUND: self-intersecting polygon in ECO, room 300, remove last point
+ if ((size == 11) && (s->_gameName == "eco")) {
+ if ((KP_UINT(s->script_000->locals_block->locals[13]) == 300)
+ && (read_point(list, is_reg_t, 10) == Common::Point(221, 0))) {
+ debug(1, "Applying fix for self-intersecting polygon in ECO, room 300");
+ size = 10;
+ }
+ }
+
for (i = 0; i < size; i++) {
Vertex *vertex = new Vertex(read_point(list, is_reg_t, i));
poly->vertices.insertHead(vertex);
@@ -1662,6 +1671,12 @@
p = convert_polygon_set(s, poly_list, start, end, opt);
+ if (p && intersecting_polygons(p)) {
+ sciprintf("[avoidpath] Error: input set contains (self-)intersecting polygons\n");
+ delete p;
+ p = NULL;
+ }
+
if (!p) {
byte *oref;
sciprintf("[avoidpath] Error: pathfinding failed for following input:\n");
@@ -1677,12 +1692,6 @@
return output;
}
- if (intersecting_polygons(p)) {
- sciprintf("[avoidpath] Error: input set contains (self-)intersecting polygons\n");
- delete p;
- p = NULL;
- }
-
dijkstra(p);
output = output_path(p, s);
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