+
+ if (maxDisplacement == minDisplacement) {
+ printf("Warning: grise normalmap fucked up\n");
+ return;
+ }
+
+ /* Second pass - subtract half maximum displacement to displace in both directions */
+ for (scanline = 0; scanline < REFLECTION_HEIGHT; scanline++) {
+ for (i = 0; i < backgroundW; i++) {
+ /* Remember that MIN_SCROLL is the padding around the screen, so ti's the maximum displacement we can get (positive & negative) */
+ *dst2 = 2 * MIN_SCROLL * (*dst2 - minDisplacement) / (maxDisplacement - minDisplacement) - MIN_SCROLL;
+ dst2++;
+ }
+ }