fix safe array operations to clamp and not wrap
fix safe array operations to clamp and not wrap

rampantpixels/foundation_lib,rampantpixels/foundation_lib,rampantpixels/foundation_lib,rampantpixels/foundation_lib