diff options
author | Neeraj Kumar | 2010-06-08 17:24:29 +0000 |
---|---|---|
committer | Neeraj Kumar | 2010-06-08 17:24:29 +0000 |
commit | 207a5e0779de9f0002b0b1984bde90ce6597e1f2 (patch) | |
tree | 98883ef89261afd4288f6dadbffe436d5d966dfc /engines/sci/engine/kpathing.cpp | |
parent | e00e94ae18aeb1ed460476f822e20b5bdfe171a4 (diff) | |
parent | 356728dab7f2c4cedf73684d7fe3b968be7396fd (diff) | |
download | scummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.tar.gz scummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.tar.bz2 scummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.zip |
updated my outdate copy of trunk, added couple of more tests in gfxtests
svn-id: r49510
Diffstat (limited to 'engines/sci/engine/kpathing.cpp')
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 66 |
1 files changed, 50 insertions, 16 deletions
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 25d967c247..857ccc2a08 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -337,15 +337,15 @@ static void draw_point(EngineState *s, Common::Point p, int start, int width, in static void draw_polygon(EngineState *s, reg_t polygon, int width, int height) { SegManager *segMan = s->_segMan; - reg_t points = GET_SEL32(segMan, polygon, SELECTOR(points)); + reg_t points = readSelector(segMan, polygon, SELECTOR(points)); #ifdef ENABLE_SCI32 if (segMan->isHeapObject(points)) - points = GET_SEL32(segMan, points, SELECTOR(data)); + points = readSelector(segMan, points, SELECTOR(data)); #endif - int size = GET_SEL32V(segMan, polygon, SELECTOR(size)); - int type = GET_SEL32V(segMan, polygon, SELECTOR(type)); + int size = readSelectorValue(segMan, polygon, SELECTOR(size)); + int type = readSelectorValue(segMan, polygon, SELECTOR(type)); Common::Point first, prev; int i; @@ -386,15 +386,15 @@ static void draw_input(EngineState *s, reg_t poly_list, Common::Point start, Com } static void print_polygon(SegManager *segMan, reg_t polygon) { - reg_t points = GET_SEL32(segMan, polygon, SELECTOR(points)); + reg_t points = readSelector(segMan, polygon, SELECTOR(points)); #ifdef ENABLE_SCI32 if (segMan->isHeapObject(points)) - points = GET_SEL32(segMan, points, SELECTOR(data)); + points = readSelector(segMan, points, SELECTOR(data)); #endif - int size = GET_SEL32V(segMan, polygon, SELECTOR(size)); - int type = GET_SEL32V(segMan, polygon, SELECTOR(type)); + int size = readSelectorValue(segMan, polygon, SELECTOR(size)); + int type = readSelectorValue(segMan, polygon, SELECTOR(type)); int i; Common::Point point; @@ -1036,13 +1036,13 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) { // Returns : (Polygon *) The converted polygon, or NULL on error SegManager *segMan = s->_segMan; int i; - reg_t points = GET_SEL32(segMan, polygon, SELECTOR(points)); - int size = GET_SEL32V(segMan, polygon, SELECTOR(size)); + reg_t points = readSelector(segMan, polygon, SELECTOR(points)); + int size = readSelectorValue(segMan, polygon, SELECTOR(size)); #ifdef ENABLE_SCI32 // SCI32 stores the actual points in the data property of points (in a new array) if (segMan->isHeapObject(points)) - points = GET_SEL32(segMan, points, SELECTOR(data)); + points = readSelector(segMan, points, SELECTOR(data)); #endif if (size == 0) { @@ -1050,13 +1050,13 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) { return NULL; } - Polygon *poly = new Polygon(GET_SEL32V(segMan, polygon, SELECTOR(type))); + Polygon *poly = new Polygon(readSelectorValue(segMan, polygon, SELECTOR(type))); int skip = 0; // WORKAROUND: broken polygon in lsl1sci, room 350, after opening elevator // Polygon has 17 points but size is set to 19 - if ((size == 19) && (s->_gameId == "lsl1sci")) { + if ((size == 19) && !strcmp(g_sci->getGameID(), "lsl1sci")) { if ((s->currentRoomNumber() == 350) && (read_point(segMan, points, 18) == Common::Point(108, 137))) { debug(1, "Applying fix for broken polygon in lsl1sci, room 350"); @@ -1121,7 +1121,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co if (polygon) { pf_s->polygons.push_back(polygon); - count += GET_SEL32V(segMan, node->value, SELECTOR(size)); + count += readSelectorValue(segMan, node->value, SELECTOR(size)); } node = s->_segMan->lookupNode(node->succ); @@ -1174,7 +1174,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co // WORKAROUND LSL5 room 660. Priority glitch due to us choosing a different path // than SSCI. Happens when Patti walks to the control room. - if ((s->_gameId == "lsl5") && (s->currentRoomNumber() == 660) && (Common::Point(67, 131) == *new_start) && (Common::Point(229, 101) == *new_end)) { + if (!strcmp(g_sci->getGameID(), "lsl5") && (s->currentRoomNumber() == 660) && (Common::Point(67, 131) == *new_start) && (Common::Point(229, 101) == *new_end)) { debug(1, "[avoidpath] Applying fix for priority problem in LSL5, room 660"); pf_s->_prependPoint = new_start; new_start = new Common::Point(77, 107); @@ -1394,7 +1394,7 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) { if (argc < 7) error("[avoidpath] Not enough arguments"); - poly_list = (!argv[4].isNull() ? GET_SEL32(s->_segMan, argv[4], SELECTOR(elements)) : NULL_REG); + poly_list = (!argv[4].isNull() ? readSelector(s->_segMan, argv[4], SELECTOR(elements)) : NULL_REG); width = argv[5].toUint16(); height = argv[6].toUint16(); if (argc > 7) @@ -1694,4 +1694,38 @@ reg_t kIntersections(EngineState *s, int argc, reg_t *argv) { } } +// This is a quite rare kernel function. An example of when it's called +// is in QFG1VGA, after killing any monster. +reg_t kMergePoly(EngineState *s, int argc, reg_t *argv) { + // 3 parameters: raw polygon data, polygon list, list size + reg_t polygonData = argv[0]; + + // TODO: actually merge the polygon + // In QFG1VGA, there are no immediately visible side-effects + // of this being a stub. + +#if 0 + List *list = s->_segMan->lookupList(argv[1]); + Node *node = s->_segMan->lookupNode(list->first); + // List size is not needed + + Polygon *polygon; + int count = 0; + + while (node) { + polygon = convert_polygon(s, node->value); + + if (polygon) { + count += readSelectorValue(s->_segMan, node->value, SELECTOR(size)); + } + + node = s->_segMan->lookupNode(node->succ); + } +#endif + + warning("Stub: kMergePoly"); + + return polygonData; +} + } // End of namespace Sci |