X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fbump.c;h=dc53337418b8b1abc67844c2ce181465cfe84003;hp=228e1414d92f8cdc815f042d6baa3bd5e81c5c24;hb=d00f30ccdcfe52d50a08b15748734b3503fae734;hpb=6e7bf38e62a7e9f7eef3791830f193786e51fc23 diff --git a/src/bump.c b/src/bump.c index 228e141..dc53337 100644 --- a/src/bump.c +++ b/src/bump.c @@ -91,8 +91,8 @@ static int init(void) const float offsetPower = 2.0f; int dx, dy, xp, yp; - dx = (int)((heightmap[i] - heightmap[i + 1]) * offsetPower); - dy = (int)((heightmap[i] - heightmap[i + fb_width]) * offsetPower); + dx = i < fb_size - 1 ? (int)((heightmap[i] - heightmap[i + 1]) * offsetPower) : 0; + dy = i < fb_size - fb_width ? (int)((heightmap[i] - heightmap[i + fb_width]) * offsetPower) : 0; xp = x + dx; if (xp < 0) xp = 0;