shithub: duke3d

Download patch

ref: 90f44c4e23edd65d0e455541fa1c9b18d60d69dd
parent: 8ae4761a1c50da9951c8af2ff96048e43e71c642
author: Fabien Sanglard <[email protected]>
date: Wed Dec 19 18:27:07 EST 2012

Converted more int32 to pointer.

--- a/Engine/src/draw.c
+++ b/Engine/src/draw.c
@@ -212,7 +212,7 @@
 static uint8_t  mach3_al;
 
 //FCS:  RENDER TOP AND BOTTOM COLUMN
-int32_t prevlineasm1(int32_t i1, int32_t i2, int32_t i3, int32_t i4, uint8_t  *source, uint8_t  *dest)
+int32_t prevlineasm1(int32_t i1, uint8_t* palette, int32_t i3, int32_t i4, uint8_t  *source, uint8_t  *dest)
 {
 
 
@@ -228,19 +228,19 @@
 	    i4 = (i4&0xffffff00) | (source[i4]&0xff);
 
 		if (pixelsAllowed-- > 0)
-			*dest = ((uint8_t *)i2)[i4];
+			*dest = palette[i4];
 
 		
 
 	    return i1;
     } else {
-	    return vlineasm1(i1,i2,i3,i4,source,dest);
+	    return vlineasm1(i1,palette,i3,i4,source,dest);
     }
 }
 
 
 //FCS: This is used to draw wall border vertical lines
-int32_t vlineasm1(int32_t vince, int32_t palookupoffse, int32_t numPixels, int32_t vplce, uint8_t* texture, uint8_t  * frameBufferDestination)
+int32_t vlineasm1(int32_t vince, uint8_t* palookupoffse, int32_t numPixels, int32_t vplce, uint8_t* texture, uint8_t  * frameBufferDestination)
 {
     uint32_t temp;
     uint8_t  *dest = (uint8_t  *)frameBufferDestination;
@@ -259,7 +259,7 @@
 	    temp = texture[temp];
       
 		if (pixelsAllowed-- > 0)
-			*dest = ((uint8_t *)palookupoffse)[temp];
+			*dest = palookupoffse[temp];
 	    
 		vplce += vince;
 	    dest += bytesperline;
@@ -386,7 +386,7 @@
 
 
 static uint8_t  machmv;
-int32_t mvlineasm1(int32_t vince, int32_t palookupoffse, int32_t i3, int32_t vplce, uint8_t* texture, uint8_t  *dest)
+int32_t mvlineasm1(int32_t vince, uint8_t* palookupoffse, int32_t i3, int32_t vplce, uint8_t* texture, uint8_t  *dest)
 {
     uint32_t temp;
 
@@ -398,7 +398,7 @@
 	    if (temp != 255) 
 		{
 			if (pixelsAllowed-- > 0)
-			*dest = ((uint8_t *)palookupoffse)[temp];
+			*dest = palookupoffse[temp];
 		}
 
 	    vplce += vince;
@@ -437,7 +437,7 @@
         	    temp = (((uint8_t *)(bufplce[i]))[temp]);
                 
 				if (pixelsAllowed-- > 0)
-        			dest[index+i] = ((uint8_t *)(palookupoffse[i]))[temp];
+        			dest[index+i] = palookupoffse [i] [temp];
                 
 	            vplce[i] += vince[i];
             }
@@ -474,7 +474,7 @@
 	      if (temp != 255)
 		  {
 			  if (pixelsAllowed-- > 0)
-				dest[index+i] = ((uint8_t *)(palookupoffse[i]))[temp];
+				dest[index+i] = palookupoffse[i][temp];
 		  }
 	      vplce[i] += vince[i];
         }
--- a/Engine/src/draw.h
+++ b/Engine/src/draw.h
@@ -26,8 +26,9 @@
         
 extern uint8_t  *globalpalwritten;
 extern int16_t  globalshiftval;
-extern int32_t vplce[4], vince[4], palookupoffse[4], bufplce[4];
-    
+extern int32_t vplce[4], vince[4], bufplce[4];
+extern uint8_t* palookupoffse[4];
+        
 void sethlinesizes(int32_t,int32_t,uint8_t *);
 
 
@@ -40,13 +41,13 @@
 
 void setBytesPerLine(int32_t);
 void fixtransluscence(uint8_t*);
-int32_t prevlineasm1(int32_t,int32_t,int32_t,int32_t,uint8_t  *,uint8_t  *);
-int32_t vlineasm1(int32_t,int32_t,int32_t,int32_t,uint8_t  *,uint8_t*);
+int32_t prevlineasm1(int32_t,uint8_t* palette ,int32_t,int32_t,uint8_t  *,uint8_t  *);
+int32_t vlineasm1(int32_t,uint8_t*,int32_t,int32_t,uint8_t  *,uint8_t*);
 
 int32_t tvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
 void setuptvlineasm2(int32_t,int32_t,int32_t);
 void tvlineasm2(uint32_t,uint32_t,uint32_t,uint32_t,uint32_t,uint32_t);
-int32_t mvlineasm1(int32_t,int32_t,int32_t,int32_t,uint8_t* texture,uint8_t* dest);
+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,int32_t);
 void setupmvlineasm(int32_t);
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -205,7 +205,10 @@
 int32_t xyaspect, viewingrangerecip;
 
 int32_t asm1, asm2, asm3, asm4;
-int32_t vplce[4], vince[4], palookupoffse[4], bufplce[4];
+int32_t vplce[4], vince[4], bufplce[4];
+
+uint8_t*  palookupoffse[4];
+
 uint8_t  globalxshift, globalyshift;
 int32_t globalxpanning, globalypanning, globalshade;
 int16_t globalpicnum, globalshiftval;