shithub: duke3d

Download patch

ref: b844bf5d93d962c5db583fe342c3c1f80130fe44
parent: 0e3d9e43d0f3e6cdc0021beb560fac4da585dca5
author: Tanguy Fautre <[email protected]>
date: Sat Feb 22 11:07:14 EST 2020

Fix const pointers.
Fix loads more MSVC warnings.

--- a/Engine/src/draw.c
+++ b/Engine/src/draw.c
@@ -30,8 +30,8 @@
 
 static uint8_t machxbits_al;
 static uint8_t bitsSetup;
-static uint8_t * textureSetup;
-void sethlinesizes(int32_t i1, int32_t _bits, uint8_t * textureAddress)
+static const uint8_t * textureSetup;
+void sethlinesizes(int32_t i1, int32_t _bits, const uint8_t * textureAddress)
 {
     machxbits_al = i1;
     bitsSetup = _bits;
@@ -45,7 +45,7 @@
     int32_t shifter = ((256-machxbits_al) & 0x1f);
     uint32_t source;
     
-    uint8_t * texture = textureSetup;
+    const uint8_t * texture = textureSetup;
     uint8_t bits = bitsSetup;
     
     shade = shade & 0xffffff00;
@@ -78,10 +78,10 @@
 static int32_t rmach_eax;
 static int32_t rmach_ebx;
 static int32_t rmach_ecx;
-static uint8_t* rmach_edx;
+static const uint8_t* rmach_edx;
 static int32_t rmach_esi;
 
-void setuprhlineasm4(int32_t i1, int32_t i2, int32_t i3, uint8_t* i4, int32_t i5, int32_t i6)
+void setuprhlineasm4(int32_t i1, int32_t i2, int32_t i3, const uint8_t* i4, int32_t i5, int32_t i6)
 {
     rmach_eax = i1;
     rmach_ebx = i2;
@@ -91,7 +91,7 @@
 } 
 
 
-void rhlineasm4(int32_t i1, uint8_t* texture, int32_t i3, uint32_t i4, uint32_t i5, uint8_t* dest)
+void rhlineasm4(int32_t i1, const uint8_t* texture, int32_t i3, uint32_t i4, uint32_t i5, uint8_t* dest)
 {
     uint32_t ebp = 0;
     int32_t numPixels;
@@ -127,9 +127,9 @@
 static int32_t rmmach_eax;
 static int32_t rmmach_ebx;
 static int32_t rmmach_ecx;
-static uint8_t* rmmach_edx;
+static const uint8_t* rmmach_edx;
 static int32_t setupTileHeight;
-void setuprmhlineasm4(int32_t i1, int32_t i2, int32_t i3, uint8_t* i4, int32_t tileHeight, int32_t i6)
+void setuprmhlineasm4(int32_t i1, int32_t i2, int32_t i3, const uint8_t* i4, int32_t tileHeight, int32_t i6)
 {
     rmmach_eax = i1;
     rmmach_ebx = i2;
@@ -140,7 +140,7 @@
 
 
 //FCS: ????
-void rmhlineasm4(int32_t i1, uint8_t* shade, int32_t colorIndex, int32_t i4, int32_t i5, uint8_t* dest)
+void rmhlineasm4(int32_t i1, const uint8_t* shade, int32_t colorIndex, int32_t i4, int32_t i5, uint8_t* dest)
 {
     uint32_t ebp = 0;
     int32_t numPixels;
@@ -194,7 +194,7 @@
 static uint8_t  mach3_al;
 
 //FCS:  RENDER TOP AND BOTTOM COLUMN
-int32_t prevlineasm1(int32_t i1, uint8_t* palette, int32_t i3, int32_t i4, uint8_t  *source, uint8_t  *dest)
+int32_t prevlineasm1(int32_t i1, const uint8_t* palette, int32_t i3, int32_t i4, const uint8_t  *source, uint8_t  *dest)
 {
     if (i3 == 0)
     {
@@ -218,7 +218,7 @@
 
 
 //FCS: This is used to draw wall border vertical lines
-int32_t vlineasm1(int32_t vince, uint8_t* palookupoffse, int32_t numPixels, int32_t vplce, uint8_t* texture, uint8_t* dest)
+int32_t vlineasm1(int32_t vince, const uint8_t* palookupoffse, int32_t numPixels, int32_t vplce, const uint8_t* texture, uint8_t* dest)
 {
     uint32_t temp;
 
@@ -245,7 +245,7 @@
 } 
 
 
-int32_t tvlineasm1(int32_t i1, uint8_t  * texture, int32_t numPixels, int32_t i4, uint8_t  *source, uint8_t  *dest)
+int32_t tvlineasm1(int32_t i1, const uint8_t *texture, int32_t numPixels, int32_t i4, const uint8_t  *source, uint8_t  *dest)
 {
     uint8_t shiftValue = (globalshiftval & 0x1f);
     
@@ -284,9 +284,9 @@
 
 
 static uint8_t  tran2shr;
-static uint8_t* tran2pal_ebx;
-static uint8_t* tran2pal_ecx;
-void setuptvlineasm2(int32_t i1, uint8_t* i2, uint8_t* i3)
+static const uint8_t* tran2pal_ebx;
+static const uint8_t* tran2pal_ecx;
+void setuptvlineasm2(int32_t i1, const uint8_t* i2, const uint8_t* i3)
 {
 	tran2shr = (i1&0x1f);
 	tran2pal_ebx = i2;
@@ -369,7 +369,7 @@
 
 
 static uint8_t  machmv;
-int32_t mvlineasm1(int32_t vince, uint8_t* palookupoffse, int32_t i3, int32_t vplce, uint8_t* texture, uint8_t  *dest)
+int32_t mvlineasm1(int32_t vince, const uint8_t* palookupoffse, int32_t i3, int32_t vplce, const uint8_t* texture, uint8_t  *dest)
 {
     uint32_t temp;
 
@@ -470,12 +470,12 @@
 
 /* ---------------  SPRITE RENDERING METHOD (USED TO BE HIGHLY OPTIMIZED ASSEMBLY) ----------------------------*/
 
-uint8_t * tspal;
+const uint8_t * tspal;
 uint32_t tsmach_eax1;
 uint32_t adder;
 uint32_t tsmach_eax3;
 uint32_t tsmach_ecx;
-void tsetupspritevline(uint8_t * palette, int32_t i2, int32_t i3, int32_t i4, int32_t i5)
+void tsetupspritevline(const uint8_t * palette, int32_t i2, int32_t i3, int32_t i4, int32_t i5)
 {
 	tspal = palette;
 	tsmach_eax1 = i5 << 16;
@@ -487,7 +487,7 @@
 /*
  FCS: Draw a sprite vertical line of pixels.
  */
-void DrawSpriteVerticalLine(int32_t i2, int32_t numPixels, uint32_t i4, uint8_t  * texture, uint8_t  * dest)
+void DrawSpriteVerticalLine(int32_t i2, int32_t numPixels, uint32_t i4, const uint8_t  * texture, uint8_t  * dest)
 {
     uint8_t colorIndex;
     
--- a/Engine/src/draw.h
+++ b/Engine/src/draw.h
@@ -25,31 +25,30 @@
 extern intptr_t bufplce[4];
 extern uint8_t* palookupoffse[4];
         
-void sethlinesizes(int32_t,int32_t,uint8_t *);
+void sethlinesizes(int32_t,int32_t,const uint8_t *);
 
-
 void hlineasm4(int32_t,int32_t,uint32_t,uint32_t,uint8_t*);
-void setuprhlineasm4(int32_t,int32_t,int32_t,uint8_t*,int32_t,int32_t);
-void rhlineasm4(int32_t,uint8_t*,int32_t,uint32_t,uint32_t,uint8_t*);
-void setuprmhlineasm4(int32_t,int32_t,int32_t, uint8_t*,int32_t,int32_t);
-void rmhlineasm4(int32_t, uint8_t*,int32_t,int32_t,int32_t, uint8_t*);
+void setuprhlineasm4(int32_t,int32_t,int32_t,const uint8_t*,int32_t,int32_t);
+void rhlineasm4(int32_t,const uint8_t*,int32_t,uint32_t,uint32_t,uint8_t*);
+void setuprmhlineasm4(int32_t,int32_t,int32_t, const uint8_t*,int32_t,int32_t);
+void rmhlineasm4(int32_t, const uint8_t*,int32_t,int32_t,int32_t, uint8_t*);
 
 
 void setBytesPerLine(int32_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 prevlineasm1(int32_t,const uint8_t* palette ,int32_t,int32_t,const uint8_t  *,uint8_t  *);
+int32_t vlineasm1(int32_t,const uint8_t*,int32_t,int32_t, const uint8_t  *,uint8_t*);
 
-int32_t tvlineasm1(int32_t,uint8_t  *,int32_t,int32_t,uint8_t  *,uint8_t  * dest);
-void setuptvlineasm2(int32_t, uint8_t*, uint8_t*);
+int32_t tvlineasm1(int32_t,const uint8_t  *,int32_t,int32_t,const uint8_t  *,uint8_t  * dest);
+void setuptvlineasm2(int32_t, const uint8_t*, const uint8_t*);
 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);
+int32_t mvlineasm1(int32_t,const uint8_t*,int32_t,int32_t,const uint8_t* texture,uint8_t* dest);
 void setupvlineasm(int32_t);
 void vlineasm4(int32_t,uint8_t*);
 void setupmvlineasm(int32_t);
 void mvlineasm4(int32_t,uint8_t*);
-void tsetupspritevline(uint8_t *,int32_t,int32_t,int32_t,int32_t);
-void DrawSpriteVerticalLine(int32_t,int32_t,uint32_t,uint8_t* ,uint8_t*);
+void tsetupspritevline(const uint8_t *,int32_t,int32_t,int32_t,int32_t);
+void DrawSpriteVerticalLine(int32_t,int32_t,uint32_t,const uint8_t* ,uint8_t*);
 void mhline(uint8_t  *,int32_t,int32_t,int32_t,int32_t,uint8_t*);
 void mhlineskipmodify(uint32_t,int32_t,int32_t,uint8_t*);
 void msethlineshift(int32_t,int32_t);
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -1531,25 +1531,25 @@
 
         if ((bad > 0) || (u4 >= d4))
         {
-            if (!(bad&1)) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0);
-            if (!(bad&2)) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1);
-            if (!(bad&4)) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2);
-            if (!(bad&8)) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3);
+            if (!(bad&1)) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],(const uint8_t*)bufplce[0],ylookup[y1ve[0]]+p+0);
+            if (!(bad&2)) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],(const uint8_t*)bufplce[1],ylookup[y1ve[1]]+p+1);
+            if (!(bad&4)) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],(const uint8_t*)bufplce[2],ylookup[y1ve[2]]+p+2);
+            if (!(bad&8)) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],(const uint8_t*)bufplce[3],ylookup[y1ve[3]]+p+3);
             continue;
         }
 
-        if (u4 > y1ve[0]) vplce[0] = mvlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0);
-        if (u4 > y1ve[1]) vplce[1] = mvlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1);
-        if (u4 > y1ve[2]) vplce[2] = mvlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2);
-        if (u4 > y1ve[3]) vplce[3] = mvlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3);
+        if (u4 > y1ve[0]) vplce[0] = mvlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],(const uint8_t*)bufplce[0],ylookup[y1ve[0]]+p+0);
+        if (u4 > y1ve[1]) vplce[1] = mvlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],(const uint8_t*)bufplce[1],ylookup[y1ve[1]]+p+1);
+        if (u4 > y1ve[2]) vplce[2] = mvlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],(const uint8_t*)bufplce[2],ylookup[y1ve[2]]+p+2);
+        if (u4 > y1ve[3]) vplce[3] = mvlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],(const uint8_t*)bufplce[3],ylookup[y1ve[3]]+p+3);
 
         if (d4 >= u4) mvlineasm4(d4-u4+1,ylookup[u4]+p);
 
         i = p+ylookup[d4+1];
-        if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0);
-        if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1);
-        if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2);
-        if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3);
+        if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],(const uint8_t*)bufplce[0],(uint8_t*)i+0);
+        if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],(const uint8_t*)bufplce[1],(uint8_t*)i+1);
+        if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],(const uint8_t*)bufplce[2],(uint8_t*)i+2);
+        if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],(const uint8_t*)bufplce[3],(uint8_t*)i+3);
     }
     for(; x<=x2; x++,p++)
     {
@@ -3137,9 +3137,9 @@
     if (y1ve[0] != y1ve[1])
     {
         if (y1ve[0] < y1)
-            vplce[0] = tvlineasm1(vince[0],palookupoffse[0],y1-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+i);
+            vplce[0] = tvlineasm1(vince[0],palookupoffse[0],y1-y1ve[0]-1,vplce[0],(const uint8_t*)bufplce[0],(uint8_t*)ylookup[y1ve[0]]+i);
         else
-            vplce[1] = tvlineasm1(vince[1],palookupoffse[1],y1-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+i+1);
+            vplce[1] = tvlineasm1(vince[1],palookupoffse[1],y1-y1ve[1]-1,vplce[1],(const uint8_t*)bufplce[1],(uint8_t*)ylookup[y1ve[1]]+i+1);
     }
 
     if (y2 > y1)
@@ -3156,9 +3156,9 @@
     }
 
     if (y2ve[0] > y2ve[1])
-        tvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y2-1,asm1,bufplce[0],ylookup[y2+1]+i);
+        tvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y2-1,asm1,(const uint8_t*)bufplce[0],(uint8_t*)ylookup[y2+1]+i);
     else if (y2ve[0] < y2ve[1])
-        tvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y2-1,asm2,bufplce[1],ylookup[y2+1]+i+1);
+        tvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y2-1,asm2,(const uint8_t*)bufplce[1],(uint8_t*)ylookup[y2+1]+i+1);
 
     faketimerhandler();
 }
@@ -4038,60 +4038,60 @@
                     if ((bad != 0) || (u4 >= d4))
                     {
                         if (!(bad&1)) 
-                            prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0);
+                            prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],(const uint8_t*)bufplce[0],ylookup[y1ve[0]]+p+0);
                         if (!(bad&2)) 
-                            prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1);
+                            prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],(const uint8_t*)bufplce[1],ylookup[y1ve[1]]+p+1);
                         if (!(bad&4)) 
-                            prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2);
+                            prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],(const uint8_t*)bufplce[2],ylookup[y1ve[2]]+p+2);
                         if (!(bad&8)) 
-                            prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3);
+                            prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],(const uint8_t*)bufplce[3],ylookup[y1ve[3]]+p+3);
                         continue;
                     }
 
                     if (u4 > y1ve[0]) 
-                        vplce[0] = prevlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0);
+                        vplce[0] = prevlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],(const uint8_t*)bufplce[0],ylookup[y1ve[0]]+p+0);
                     if (u4 > y1ve[1]) 
-                        vplce[1] = prevlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1);
+                        vplce[1] = prevlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],(const uint8_t*)bufplce[1],ylookup[y1ve[1]]+p+1);
                     if (u4 > y1ve[2]) 
-                        vplce[2] = prevlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2);
+                        vplce[2] = prevlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],(const uint8_t*)bufplce[2],ylookup[y1ve[2]]+p+2);
                     if (u4 > y1ve[3]) 
-                        vplce[3] = prevlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3);
+                        vplce[3] = prevlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],(const uint8_t*)bufplce[3],ylookup[y1ve[3]]+p+3);
 
                     if (d4 >= u4) vlineasm4(d4-u4+1,ylookup[u4]+p);
 
                     i = p+ylookup[d4+1];
                     if (y2ve[0] > d4) 
-                        prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0);
+                        prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],(const uint8_t*)bufplce[0],(uint8_t*)i+0);
                     if (y2ve[1] > d4) 
-                        prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1);
+                        prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],(const uint8_t*)bufplce[1],(uint8_t*)i+1);
                     if (y2ve[2] > d4) 
-                        prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2);
+                        prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],(const uint8_t*)bufplce[2],(uint8_t*)i+2);
                     if (y2ve[3] > d4) 
-                        prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3);
+                        prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],(const uint8_t*)bufplce[3],(uint8_t*)i+3);
                 }
                 else
                 {
                     if ((bad != 0) || (u4 >= d4))
                     {
-                        if (!(bad&1)) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0);
-                        if (!(bad&2)) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1);
-                        if (!(bad&4)) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2);
-                        if (!(bad&8)) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3);
+                        if (!(bad&1)) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],(const uint8_t*)bufplce[0],ylookup[y1ve[0]]+p+0);
+                        if (!(bad&2)) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],(const uint8_t*)bufplce[1],ylookup[y1ve[1]]+p+1);
+                        if (!(bad&4)) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],(const uint8_t*)bufplce[2],ylookup[y1ve[2]]+p+2);
+                        if (!(bad&8)) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],(const uint8_t*)bufplce[3],ylookup[y1ve[3]]+p+3);
                         continue;
                     }
 
-                    if (u4 > y1ve[0]) vplce[0] = mvlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0);
-                    if (u4 > y1ve[1]) vplce[1] = mvlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1);
-                    if (u4 > y1ve[2]) vplce[2] = mvlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2);
-                    if (u4 > y1ve[3]) vplce[3] = mvlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3);
+                    if (u4 > y1ve[0]) vplce[0] = mvlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],(const uint8_t*)bufplce[0],ylookup[y1ve[0]]+p+0);
+                    if (u4 > y1ve[1]) vplce[1] = mvlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],(const uint8_t*)bufplce[1],ylookup[y1ve[1]]+p+1);
+                    if (u4 > y1ve[2]) vplce[2] = mvlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],(const uint8_t*)bufplce[2],ylookup[y1ve[2]]+p+2);
+                    if (u4 > y1ve[3]) vplce[3] = mvlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],(const uint8_t*)bufplce[3],ylookup[y1ve[3]]+p+3);
 
                     if (d4 >= u4) mvlineasm4(d4-u4+1,ylookup[u4]+p);
 
                     i = p+ylookup[d4+1];
-                    if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0);
-                    if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1);
-                    if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2);
-                    if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3);
+                    if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],(const uint8_t*)bufplce[0],(uint8_t*)i+0);
+                    if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],(const uint8_t*)bufplce[1],(uint8_t*)i+1);
+                    if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],(const uint8_t*)bufplce[2],(uint8_t*)i+2);
+                    if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],(const uint8_t*)bufplce[3],(uint8_t*)i+3);
                 }
 
                 faketimerhandler();
--- a/Game/src/audiolib/multivoc.c
+++ b/Game/src/audiolib/multivoc.c
@@ -1952,8 +1952,8 @@
    voice->GVal[2]     = 0;
    voice->GVal[3]     = 0;
    voice->callbackval = callbackval;
-   voice->LoopStart   = ( char * )loopstart;
-   voice->LoopEnd     = ( char * )loopend;
+   voice->LoopStart   = ( uint8_t* )loopstart;
+   voice->LoopEnd     = ( uint8_t* )loopend;
    voice->LoopSize    = loopend - loopstart + 1;
 
    if ( loopstart < 0 )