shithub: duke3d

Download patch

ref: 070639d0341621328542c7c64a12a9d88da6bbcb
parent: 83636a68d4045a4c107d99dda1c81ab5f1bcd59f
author: Fabien Sanglard <fabien.sanglard@gmail.com>
date: Mon Dec 17 11:46:57 EST 2012

Replaced (unsigned) cast to (uint32_t) casts.

--- a/Engine/src/a.c
+++ b/Engine/src/a.c
@@ -228,7 +228,7 @@
 		
 
 
-	    temp = ((unsigned)vplce) >> mach3_al;
+	    temp = ((uint32_t)vplce) >> mach3_al;
         
 	    temp = ((uint8_t  *)bufplce)[temp];
       
@@ -368,7 +368,7 @@
 	// FIX_00087: 1024x768 mode being slow. Undone FIX_00070 and fixed font issue again
     for(;i3>=0;i3--)
     {
-		temp = ((unsigned)vplce) >> machmv;
+		temp = ((uint32_t)vplce) >> machmv;
 	    temp = ((uint8_t  *)bufplce)[temp];
 
 	    if (temp != 255) 
@@ -409,7 +409,7 @@
             for (i = 0; i < 4; i++)
             {
 				
-        	    temp = ((unsigned)vplce[i]) >> mach3_al;
+        	    temp = ((uint32_t)vplce[i]) >> mach3_al;
         	    temp = (((uint8_t *)(bufplce[i]))[temp]);
 				if (pixelsAllowed-- > 0)
         			dest[index+i] = ((uint8_t *)(palookupoffse[i]))[temp];
@@ -416,7 +416,7 @@
 	            vplce[i] += vince[i];
             }
             dest += fixchain;
-        } while (((unsigned)dest - fixchain) < ((unsigned)dest));
+        } while (((uint32_t)dest - fixchain) < ((uint32_t)dest));
     }
 } 
 
@@ -442,7 +442,7 @@
         for (i = 0; i < 4; i++)
         {
 			
-	      temp = ((unsigned)vplce[i]) >> machmv;
+	      temp = ((uint32_t)vplce[i]) >> machmv;
 	      temp = (((uint8_t *)(bufplce[i]))[temp]);
 	      if (temp != 255)
 		  {
@@ -453,7 +453,7 @@
         }
         dest += fixchain;
 
-    } while (((unsigned)dest - fixchain) < ((unsigned)dest));
+    } while (((uint32_t)dest - fixchain) < ((uint32_t)dest));
 } /* mvlineasm4 */
 
 
@@ -643,7 +643,7 @@
     while (counter >= 0)
     {
 	    ebx = i2 >> mshift_al;
-	    ebx = shld (ebx, (unsigned)i5, mshift_bl);
+	    ebx = shld (ebx, (uint32_t)i5, mshift_bl);
 	    i1 = ((uint8_t  *)mmach_eax)[ebx];
 
 		if (pixelsAllowed-- > 0)
@@ -691,7 +691,7 @@
     while (counter >= 0)
     {
 	    ebx = i2 >> tshift_al;
-	    ebx = shld (ebx, (unsigned)i5, tshift_bl);
+	    ebx = shld (ebx, (uint32_t)i5, tshift_bl);
 	    i1 = ((uint8_t  *)tmach_eax)[ebx];
 	    if ((i1&0xff) != 0xff)
 	    {
--- a/Engine/src/cache1d.c
+++ b/Engine/src/cache1d.c
@@ -85,9 +85,9 @@
 {
 	int32_t i, z, zz, bestz=0, daval, bestval, besto=0, o1, o2, sucklen, suckz;
 
-	newbytes = ((newbytes+15)&0xfffffff0);
+	newbytes = newbytes+15;
 
-	if ((unsigned)newbytes > (unsigned)cachesize)
+	if ((uint32_t)newbytes > (uint32_t)cachesize)
 	{
 		printf("Cachesize: %d\n",cachesize);
 		printf("*Newhandle: 0x%x, Newbytes: %d, *Newlock: %d\n",(unsigned int)newhandle,newbytes,*newlockptr);
--- a/Engine/src/enet/api.txt
+++ b/Engine/src/enet/api.txt
@@ -109,16 +109,16 @@
 The peers field contains an array of the peers that have been allocated for this host. The 
 peerCount field specifies the number of peers that have been allocated for this host.
 
-unsigned ENET_HOST_TO_NET_8 (unsigned);
-unsigned ENET_HOST_TO_NET_16 (unsigned);
-unsigned ENET_HOST_TO_NET_32 (unsigned);
+unsigned ENET_HOST_TO_NET_8 (uint32_t);
+unsigned ENET_HOST_TO_NET_16 (uint32_t);
+unsigned ENET_HOST_TO_NET_32 (uint32_t);
 
   Macros that convert from host byte-order to network byte-order (big
 endian) for unsigned integers of 8 bits, 16 bits, and 32 bits repectively. 
 
-unsigned ENET_NET_TO_HOST_8 (unsigned);
-unsigned ENET_NET_TO_HOST_16 (unsigned);
-unsigned ENET_NET_TO_HOST_32 (unsigned);
+unsigned ENET_NET_TO_HOST_8 (uint32_t);
+unsigned ENET_NET_TO_HOST_16 (uint32_t);
+unsigned ENET_NET_TO_HOST_32 (uint32_t);
 
   Macros that convert from network byte-order (big endian) to host 
 byte-order for unsigned integers of 8 bits, 16 bits, and 32 bits repectively.
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -411,7 +411,7 @@
                     // Using cross product, determine if the portal is facing us or not.
                     // If it is: Add it to the stack and bump the stack counter.
                     // This line is equivalent to tempint < 0x40000
-                    if (((unsigned)tempint+262144) < 524288) // ??? What is this test ?? How acute the angle is ?
+                    if (((uint32_t)tempint+262144) < 524288) // ??? What is this test ?? How acute the angle is ?
                     {
                         //(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1) is the squared length of the wall
                         // ??? What is this test ?? How acute the angle is ?
@@ -722,7 +722,7 @@
     globalzd = sec->ceilingz-globalposz;
     if (globalzd > 0) return;
     globalpicnum = sec->ceilingpicnum;
-    if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+    if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
     setgotpic(globalpicnum);
     if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return;
     if (picanm[globalpicnum]&192) globalpicnum += animateoffs((short)globalpicnum,(short)sectnum);
@@ -925,7 +925,7 @@
     if (globalzd > 0)
         return;
     globalpicnum = sec->floorpicnum;
-    if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+    if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
     setgotpic(globalpicnum);
     
     if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0))
@@ -1489,7 +1489,7 @@
         botptr = dmost;
     }
 
-    if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+    if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
     if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)sectnum);
     globalshiftval = (picsiz[globalpicnum]>>4);
     if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
@@ -2193,7 +2193,7 @@
 
                     globalorientation = (int32_t)wal->cstat;
                     globalpicnum = wal->picnum;
-                    if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+                    if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
                     globalxpanning = (int32_t)wal->xpanning;
                     globalypanning = (int32_t)wal->ypanning;
                     globalshiftval = (picsiz[globalpicnum]>>4);
@@ -2291,7 +2291,7 @@
                         wal = &wall[wallnum];
                         globalorientation = (int32_t)wal->cstat;
                         globalpicnum = wal->picnum;
-                        if ((uint32_t)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+                        if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
                         globalxpanning = (int32_t)wal->xpanning;
                         globalypanning = (int32_t)wal->ypanning;
                         if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(wallnum+16384));
@@ -2304,7 +2304,7 @@
                     {
                         globalorientation = (int32_t)wal->cstat;
                         globalpicnum = wal->picnum;
-                        if ((uint32_t)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+                        if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
                         globalxpanning = (int32_t)wal->xpanning;
                         globalypanning = (int32_t)wal->ypanning;
                         if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(wallnum+16384));
@@ -2402,7 +2402,7 @@
             globalorientation = (int32_t)wal->cstat;
             if (nextsectnum < 0) globalpicnum = wal->picnum;
             else globalpicnum = wal->overpicnum;
-            if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+            if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
             globalxpanning = (int32_t)wal->xpanning;
             globalypanning = (int32_t)wal->ypanning;
             if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(wallnum+16384));
@@ -4135,7 +4135,7 @@
     uint8_t  *ptr;
     int32_t i, dasiz;
 
-    if ((unsigned)tilenume >= (unsigned)MAXTILES) return;
+    if ((uint32_t)tilenume >= (uint32_t)MAXTILES) return;
     dasiz = tilesizx[tilenume]*tilesizy[tilenume];
     if (dasiz <= 0) return;
 
@@ -4179,7 +4179,7 @@
 {
     int32_t j, dasiz;
 
-    if ((xsiz <= 0) || (ysiz <= 0) || ((unsigned)tilenume >= (unsigned)MAXTILES))
+    if ((xsiz <= 0) || (ysiz <= 0) || ((uint32_t)tilenume >= (uint32_t)MAXTILES))
         return(0);
 
     dasiz = xsiz*ysiz;
@@ -4604,7 +4604,7 @@
 
     globalorientation = (int32_t)wal->cstat;
     globalpicnum = wal->overpicnum;
-    if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+    if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
     globalxpanning = (int32_t)wal->xpanning;
     globalypanning = (int32_t)wal->ypanning;
     if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)(thewall[z]+16384));
@@ -4957,7 +4957,7 @@
 
         globalorientation = 0;
         globalpicnum = tilenum;
-        if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+        if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
         globalxpanning = 0L;
         globalypanning = 0L;
         globvis = globalvisibility;
@@ -5109,7 +5109,7 @@
 
         globalorientation = 0;
         globalpicnum = tilenum;
-        if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+        if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
         globalxpanning = 0L;
         globalypanning = 0L;
         globvis = globalvisibility;
@@ -5568,7 +5568,7 @@
 
         globalorientation = cstat;
         globalpicnum = tilenum;
-        if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+        if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
         /* if (picanm[globalpicnum]&192) globalpicnum += animateoffs((short)globalpicnum,spritenum+32768); */
 
         if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
@@ -6034,9 +6034,9 @@
             bot = y21*x34-x21*y34;
             if (bot <= 0) continue;
             t = y21*x31-x21*y31;
-            if ((unsigned)t >= (unsigned)bot) continue;
+            if ((uint32_t)t >= (uint32_t)bot) continue;
             t = y31*x34-x31*y34;
-            if ((unsigned)t >= (unsigned)bot) continue;
+            if ((uint32_t)t >= (uint32_t)bot) continue;
 
             nexts = wal->nextsector;
             if ((nexts < 0) || (wal->cstat&32)) return(0);
@@ -8669,7 +8669,7 @@
                 setpalookupaddress(globalpalwritten);
             }
             globalpicnum = sec->floorpicnum;
-            if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+            if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
             setgotpic(globalpicnum);
             if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue;
             if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((short)globalpicnum,s);
@@ -8838,7 +8838,7 @@
             }
 
             globalpicnum = spr->picnum;
-            if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
+            if ((uint32_t)globalpicnum >= (uint32_t)MAXTILES) globalpicnum = 0;
             setgotpic(globalpicnum);
             if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue;
             if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((short)globalpicnum,s);
--- a/Game/src/actors.c
+++ b/Game/src/actors.c
@@ -1364,7 +1364,7 @@
                         T1 = 0;
                     }
                 }
-                else if(s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz)
+                else if(s->lotag < 999 && (uint32_t)sector[s->sectnum].lotag < 9 && AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz)
                 {
                     if( (soundm[s->lotag]&2) )
                     {
@@ -1400,7 +1400,7 @@
                         else for(p=connecthead;p>=0;p=connectpoint2[p])
                             if( p == myconnectindex && ps[p].cursectnum == s->sectnum )
                         {
-                            j = s->lotag+((unsigned)global_random%(s->hitag+1));
+                            j = s->lotag+((uint32_t)global_random%(s->hitag+1));
                             sound(j);
                             T5 =  26*40 + (global_random%(26*40));
                         }
@@ -6738,7 +6738,7 @@
                     {
                         if(cansee(s->x,s->y,s->z,SECT,ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum))
                         {
-                            if(x < (unsigned)sh)
+                            if(x < (uint32_t)sh)
                             {
                                 ud.camerasprite = i;
                                 t[0] = 999;
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -9501,7 +9501,7 @@
     {
         multiflag = 2;
         multiwhat = (sync[i].bits>>18)&1;
-        multipos = (unsigned) (sync[i].bits>>19)&15;
+        multipos = (uint32_t) (sync[i].bits>>19)&15;
         multiwho = i;
 
         if( multiwhat )