From 0c303422591c91556f46c7bc33d53f09abd10f15 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 31 Mar 2019 17:16:33 +0200 Subject: [PATCH] Small changes, mostly cosmetics --- Sources/Engine/CurrentVersion.h | 0 Sources/Engine/Graphics/Color.cpp | 8 ++++---- Sources/Engine/Light/LayerMixer.cpp | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) mode change 100644 => 100755 Sources/Engine/CurrentVersion.h mode change 100644 => 100755 Sources/Engine/Graphics/Color.cpp diff --git a/Sources/Engine/CurrentVersion.h b/Sources/Engine/CurrentVersion.h old mode 100644 new mode 100755 diff --git a/Sources/Engine/Graphics/Color.cpp b/Sources/Engine/Graphics/Color.cpp old mode 100644 new mode 100755 index 6a6519c..9316f6a --- a/Sources/Engine/Graphics/Color.cpp +++ b/Sources/Engine/Graphics/Color.cpp @@ -425,10 +425,10 @@ COLOR MulColors( COLOR col1, COLOR col2) conv1.col = col1; conv2.col = col2; - conv1.bytes[0] = (UBYTE) ((((DWORD) conv1.bytes[0]) * ((DWORD) conv2.bytes[0])) / 255); - conv1.bytes[1] = (UBYTE) ((((DWORD) conv1.bytes[1]) * ((DWORD) conv2.bytes[1])) / 255); - conv1.bytes[2] = (UBYTE) ((((DWORD) conv1.bytes[2]) * ((DWORD) conv2.bytes[2])) / 255); - conv1.bytes[3] = (UBYTE) ((((DWORD) conv1.bytes[3]) * ((DWORD) conv2.bytes[3])) / 255); + conv1.bytes[0] = (UBYTE) ((((DWORD) conv1.bytes[0]) * ((DWORD) conv2.bytes[0])) >> 8); + conv1.bytes[1] = (UBYTE) ((((DWORD) conv1.bytes[1]) * ((DWORD) conv2.bytes[1])) >> 8); + conv1.bytes[2] = (UBYTE) ((((DWORD) conv1.bytes[2]) * ((DWORD) conv2.bytes[2])) >> 8); + conv1.bytes[3] = (UBYTE) ((((DWORD) conv1.bytes[3]) * ((DWORD) conv2.bytes[3])) >> 8); return(conv1.col); #endif diff --git a/Sources/Engine/Light/LayerMixer.cpp b/Sources/Engine/Light/LayerMixer.cpp index 9b9992d..8fcf6be 100755 --- a/Sources/Engine/Light/LayerMixer.cpp +++ b/Sources/Engine/Light/LayerMixer.cpp @@ -125,7 +125,8 @@ public: // increment a byte without overflowing it static inline void IncrementByteWithClip( UBYTE &ub, SLONG slAdd) { - ub = pubClipByte[(SLONG)ub+slAdd]; + SLONG t = (SLONG)ub+slAdd; + ub = (t<0)?0:pubClipByte[t]; } #if 0 // DG: unused. @@ -867,7 +868,7 @@ skipPixel: sl1oL = auw1oSqrt[sl1oL]; SLONG slIntensity = _slLightMax; if( sl1oL<256) slIntensity = 0; - else if( sl1oL>16*/; + else if( sl1oL>16*/; + else if( sl1oLlm_pixCanvasSizeU * this->lm_pixCanvasSizeV; + ULONG count = this->lm_pixCanvasSizeU * this->lm_pixCanvasSizeV; #if PLATFORM_LITTLEENDIAN // Forces C fallback; BYTESWAP itself is a no-op on little endian. - register ULONG swapped = BYTESWAP32_unsigned(colAmbient); + ULONG swapped = BYTESWAP32_unsigned(colAmbient); #else STUBBED("actually need byteswap?"); // (uses inline asm on MacOS PowerPC) - register ULONG swapped = colAmbient; + ULONG swapped = colAmbient; BYTESWAP(swapped); #endif