Skip to content

Engine: Fix many cases in which cansee() would fail with TROR

Dino Bollinger requested to merge dibollinger/eduke32:cansee_failsafe into master

This commit adds a failsafe which corrects the given origin and destination sectnums of the "cansee()" function, by checking if the corresponding (x,y,z) coordinates are actually contained within the given sectors.

The problem with TROR in particular was that the calculation done to determine the point of intersection on the TROR layer requires the coordinates to be within the given sectnums. Else, cansee() would simply return 0, even if there was a clear line of sight.

This should also implicitly fix any other cases where the coordinates of the cansee() call do not exactly match up with the given sectnums.

Test case:tror_pigpool.map

Without the change, the pigcops will refuse to shoot you while crouching in the pool.

With the change, they can do so properly.

Edited by Dino Bollinger

Merge request reports