maybe...
First, get the array with the zigzag path (shortest path). Then, starting from the start point, test line-of-sight (only cardinal or diagonal) to every point - but in reverse order. If line-of-sight to a point works, add that point to the "finalPath" and repeat the process from this new point until you reach the endpoint.