From de84ce114a39f35d6aa75497f66749769139ce0b Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Sat, 3 Sep 2016 01:50:49 +0300 Subject: [PATCH] fixed build on watcom --- Makefile | 2 +- src/mike.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index a78b496..a86ec5b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ baseobj = main.obj -demoobj = demo.obj screen.obj tunnel.obj fract.obj gfxutil.obj +demoobj = demo.obj screen.obj tunnel.obj fract.obj gfxutil.obj mike.obj sysobj = gfx.obj vbe.obj dpmi.obj timer.obj keyb.obj mouse.obj logger.obj obj = $(baseobj) $(demoobj) $(sysobj) bin = demo.exe diff --git a/src/mike.c b/src/mike.c index 4f92011..93b3f21 100644 --- a/src/mike.c +++ b/src/mike.c @@ -140,23 +140,25 @@ static void convert32To16(unsigned int *src32, unsigned short *dst16, unsigned i /* Scale normal with depth and unpack R component (horizontal component) */ static void processNormal() { int scanline; - unsigned int *normalmap = (unsigned int*)background; - normalmap += NORMALMAP_SCANLINE * backgroundW; - unsigned short *dst = normalmap; - displacementMap = (short*)dst; - short *dst2 = displacementMap; float scale; int i; int x; short maxDisplacement = 0; short minDisplacement = 256; + unsigned short *dst; + short *dst2; + unsigned int *normalmap = (unsigned int*)background; + normalmap += NORMALMAP_SCANLINE * backgroundW; + dst = (unsigned short*)normalmap; + displacementMap = (short*)dst; + dst2 = displacementMap; for (scanline = 0; scanline < REFLECTION_HEIGHT; scanline++) { scale = 2.0f - (float)scanline / ((float)REFLECTION_HEIGHT - 1); scrollModTable[scanline] = (int) (backgroundW / scale + 0.5f); for (i = 0; i < backgroundW; i++) { x = (int)(i * scale + 0.5f); - if (x < background) { + if (x < backgroundW) { *dst = (unsigned short)normalmap[x] & 0xFF; if ((short)*dst > maxDisplacement) maxDisplacement = (short)(*dst); if ((short)*dst < minDisplacement) minDisplacement = (short)(*dst); @@ -202,4 +204,4 @@ static void updateScrollTables(float dt) { scrollTable[i] += scrollSpeedTable[i] * dt; scrollTableRounded[i] = (int)(scrollTable[i] + 0.5f) % scrollModTable[i]; } -} \ No newline at end of file +} -- 1.7.10.4