ASYLUM: add a workaround to handle action areas intersection

This commit is contained in:
alxpnv 2021-02-12 15:45:51 +03:00 committed by Eugene Sandulenko
parent 19712bac19
commit c08da99266
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -2166,6 +2166,8 @@ int32 Scene::findActionArea(ActionAreaType type, const Common::Point &pt, bool h
if (!_polygons)
error("[Scene::findActionArea] Polygons not initialized properly!");
Common::Array<int32> areaIds;
switch (type) {
default:
return type - 2;
@ -2204,7 +2206,7 @@ int32 Scene::findActionArea(ActionAreaType type, const Common::Point &pt, bool h
}
if (!found && _polygons->get(area->polygonIndex).contains(pt))
return i;
areaIds.push_back(i);
}
break;
@ -2235,12 +2237,21 @@ int32 Scene::findActionArea(ActionAreaType type, const Common::Point &pt, bool h
}
if (!found && _polygons->get(area->polygonIndex).contains(pt))
return i;
areaIds.push_back(i);
}
break;
}
return -1;
if (areaIds.empty()) {
return -1;
} else {
int32 i;
for (i = 0; i < areaIds.size(); i++)
if (_ws->actions[i]->flags)
break;
return (i == areaIds.size()) ? areaIds[0] : areaIds[i];
}
}
void Scene::changePlayer(ActorIndex index) {