shithub: duke3d

Download patch

ref: 547732d759e9a1f555dc9163c246f1903b58af0d
parent: 5260668388110f1de7c36c41eacc0fb99d477e58
author: Tanguy Fautre <[email protected]>
date: Fri Feb 21 19:18:20 EST 2020

Fixed a couple of warnings and made a couple of draw methods easier to understand.

--- a/Engine/src/draw.c
+++ b/Engine/src/draw.c
@@ -399,40 +399,32 @@
 }
 
 //FCS This is used to fill the inside of a wall (so it draws VERTICAL column, always).
-void vlineasm4(int32_t columnIndex, intptr_t framebuffer)
+void vlineasm4(int32_t columnIndex, uint8_t* framebuffer)
 {
-
 	if (!RENDER_DRAW_WALL_INSIDE)
-		return ;
+		return;
 
-    {
-        int i;
-        uint32_t temp;
-        
-        uintptr_t index = (framebuffer + ylookup[columnIndex]);
-        uint8_t  *dest= (uint8_t *)(-ylookup[columnIndex]);
-//        uint8_t  *dest= (uint8_t *)framebuffer;
-//        uint32_t index = 0;
-//        uint32_t length = ylookup[columnIndex];
+	int i;
+	uint32_t temp;
+    uint32_t index = 0;
+    uint32_t length = ylookup[columnIndex];
 
-        do {
-            for (i = 0; i < 4; i++)
-            {
-				
-        	    temp = ((uint32_t)vplce[i]) >> mach3_al;
-        	    temp = (((uint8_t *)(bufplce[i]))[temp]);
+	do {
+		for (i = 0; i < 4; i++)
+		{
+			temp = ((uint32_t)vplce[i]) >> mach3_al;
+			temp = (((uint8_t*)(bufplce[i]))[temp]);
 
 #if RENDER_LIMIT_PIXELS
-				if (pixelsAllowed-- > 0)
+			if (pixelsAllowed-- > 0)
 #endif
-        			dest[index+i] = palookupoffse [i] [temp];
-                
-	            vplce[i] += vince[i];
-            }
-            dest += bytesperline;
-        } while (((uint32_t)dest - bytesperline) < ((uint32_t)dest));
-    }
-} 
+				framebuffer[index + i] = palookupoffse[i][temp];
+
+			vplce[i] += vince[i];
+		}
+		index += bytesperline;
+	} while (index < length);
+}
 
 
 void setupmvlineasm(int32_t i1)
@@ -439,16 +431,18 @@
 {
     //Only keep 5 first bits
     machmv = (i1&0x1f);
-} 
+}
 
-
-void mvlineasm4(int32_t column, intptr_t framebufferOffset)
+void mvlineasm4(int32_t columnIndex, uint8_t* framebuffer)
 {
     int i;
     uint32_t temp;
-    uintptr_t index = (framebufferOffset + ylookup[column]);
-    uint8_t  *dest = (uint8_t *)(-ylookup[column]);
+    //uintptr_t index = (framebufferOffset + ylookup[column]);
+    //uint8_t  *dest = (uint8_t *)(-ylookup[columnIndex]);
 
+	uint32_t index = 0;
+	uint32_t length = ylookup[columnIndex];
+
     do {
 
 #if RENDER_LIMIT_PIXELS
@@ -466,42 +460,15 @@
 #if RENDER_LIMIT_PIXELS
 			  if (pixelsAllowed-- > 0)
 #endif
-				dest[index+i] = palookupoffse[i][temp];
+				  framebuffer[index+i] = palookupoffse[i][temp];
 		  }
 	      vplce[i] += vince[i];
         }
-        dest += bytesperline;
+        index += bytesperline;
 
-    } while (((uint32_t)dest - bytesperline) < ((uint32_t)dest));
+    } while (index < length);
 } 
 /* END ---------------  WALLS RENDERING METHOD (USED TO BE HIGHLY OPTIMIZED ASSEMBLY) ----------------------------*/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
 /* ---------------  SPRITE RENDERING METHOD (USED TO BE HIGHLY OPTIMIZED ASSEMBLY) ----------------------------*/
--- a/Engine/src/draw.h
+++ b/Engine/src/draw.h
@@ -45,9 +45,9 @@
 void tvlineasm2(uint32_t,uint32_t,uintptr_t,uintptr_t,uint32_t,uintptr_t);
 int32_t mvlineasm1(int32_t,uint8_t*,int32_t,int32_t,uint8_t* texture,uint8_t* dest);
 void setupvlineasm(int32_t);
-void vlineasm4(int32_t,intptr_t);
+void vlineasm4(int32_t,uint8_t*);
 void setupmvlineasm(int32_t);
-void mvlineasm4(int32_t,intptr_t);
+void mvlineasm4(int32_t,uint8_t*);
 void setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
 void spritevline(int32_t,uint32_t,int32_t,uint32_t,uint8_t*,uint8_t*);
 void msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@
 **Windows (Visual Studio 2019 x64 solution)** [![Windows CI Status](https://github.com/GPSnoopy/BelgianChocolateDuke3D/workflows/Windows%20CI/badge.svg)](https://github.com/GPSnoopy/BelgianChocolateDuke3D/actions?query=workflow%3A%22Windows+CI%22)
 ```
 > vcpkg_windows.bat
-> build_windows.bat
+> build_windows_x64.bat
 ```
 
 **Linux (GCC Makefile)** [![Linux CI Status](https://github.com/GPSnoopy/BelgianChocolateDuke3D/workflows/Linux%20CI/badge.svg)](https://github.com/GPSnoopy/BelgianChocolateDuke3D/actions?query=workflow%3A%22Linux+CI%22)
--- a/build_windows.bat
+++ /dev/null
@@ -1,2 +1,0 @@
-build_windows_x86.bat || goto :error
-build_windows_x64.bat || goto :error
\ No newline at end of file