shithub: duke3d

Download patch

ref: 9a478707124f862346bd566dc09b66b0480296e6
parent: e11e7cb42d1762154194fc58eb200dd0fe1c47bd
author: Fabien Sanglard <[email protected]>
date: Thu Dec 13 11:53:46 EST 2012

Removed 100+ Warning, mostly due to implicit type conversion.

--- a/Engine/src/build.h
+++ b/Engine/src/build.h
@@ -324,6 +324,10 @@
 #endif
 //END VISUALIZE RENDERER
 
+//Global.c
+void Error (int errorType, char *error, ...);
+int FindDistance2D(int ix, int iy);
+
 #endif  /* defined _INCLUDE_BUILD_H_ */
 
 /* end of build.h ... */
--- a/Engine/src/cache1d.c
+++ b/Engine/src/cache1d.c
@@ -22,6 +22,8 @@
 
 #include "../../Game/src/cvar_defs.h"
 
+#include "types.h"
+#include "file_lib.H"
 
 #if (defined USE_PHYSICSFS)
 #include "physfs.h"
@@ -372,9 +374,9 @@
 
 	i = 1000000; // FIX_00086: grp loaded by smaller sucessive chunks to avoid overloading low ram computers
 	groupfil_memory[numgroupfiles] = malloc(i);
-	while(j=read(groupfil[numgroupfiles], groupfil_memory[numgroupfiles], i))
+	while((j=read(groupfil[numgroupfiles], groupfil_memory[numgroupfiles], i)))
 	{
-		groupefil_crc32[numgroupfiles] = crc32_update(groupfil_memory[numgroupfiles], j, groupefil_crc32[numgroupfiles]);	
+		groupefil_crc32[numgroupfiles] = crc32_update((unsigned char*)groupfil_memory[numgroupfiles], j, groupefil_crc32[numgroupfiles]);
 	}
 
 	free(groupfil_memory[numgroupfiles]);  
@@ -713,7 +715,7 @@
 
 	groupnum = filegrp[handle];
 
-	if (groupnum == 255) return(lseek(filehan[handle],offset,whence));
+	if (groupnum == 255) return((long)lseek(filehan[handle],offset,whence));
 	if (groupfil[groupnum] != -1)
 	{
 		switch(whence)
@@ -735,7 +737,7 @@
 {
     struct stat stats;
     fstat(fd, &stats);
-    return stats.st_size;
+    return (long)stats.st_size;
 }
 #endif
 
@@ -1018,7 +1020,7 @@
 
 	if(g_CV_DebugFileAccess != 0)
 	{
-		printf("FILE ACCESS: [read] File: (%s) Result: %d, clock: %d\n", fullfilename, result, totalclock);
+		printf("FILE ACCESS: [read] File: (%s) Result: %ld, clock: %ld\n", fullfilename, result, totalclock);
 	}
 
 	return result;
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -2571,7 +2571,7 @@
               long *daposz, short *daang, short *dacursectnum)
 {
     int x;
-	short fil, i, j, numsprites;
+	short fil, i, numsprites;
     sectortype *sect;
     spritetype *s;
     walltype *w;
@@ -2619,18 +2619,18 @@
 		kread16(fil,&sect->floorstat);
 		kread16(fil,&sect->ceilingpicnum);
 		kread16(fil,&sect->ceilingheinum);
-		 kread8(fil,&sect->ceilingshade);
-		 kread8(fil,&sect->ceilingpal);
-		 kread8(fil,&sect->ceilingxpanning);
-		 kread8(fil,&sect->ceilingypanning);
+        kread8(fil,(char*)&sect->ceilingshade);
+        kread8(fil,(char*)&sect->ceilingpal);
+        kread8(fil,(char*)&sect->ceilingxpanning);
+        kread8(fil,(char*)&sect->ceilingypanning);
 		kread16(fil,&sect->floorpicnum);
 		kread16(fil,&sect->floorheinum);
-		 kread8(fil,&sect->floorshade);
-		 kread8(fil,&sect->floorpal);
-		 kread8(fil,&sect->floorxpanning);
-		 kread8(fil,&sect->floorypanning);
-		 kread8(fil,&sect->visibility);
-		 kread8(fil,&sect->filler);
+        kread8(fil,(char*)&sect->floorshade);
+        kread8(fil,(char*)&sect->floorpal);
+        kread8(fil,(char*)&sect->floorxpanning);
+        kread8(fil,(char*)&sect->floorypanning);
+        kread8(fil,(char*)&sect->visibility);
+        kread8(fil,(char*)&sect->filler);
 		kread16(fil,&sect->lotag);
 		kread16(fil,&sect->hitag);
 		kread16(fil,&sect->extra);
@@ -2647,7 +2647,7 @@
 		kread16(fil,&w->cstat);
 		kread16(fil,&w->picnum);
 		kread16(fil,&w->overpicnum);
-		 kread8(fil,&w->shade);
+		 kread8(fil,(char*)&w->shade);
 		 kread8(fil,&w->pal);
 		 kread8(fil,&w->xrepeat);
 		 kread8(fil,&w->yrepeat);
@@ -2666,14 +2666,14 @@
 		kread32(fil,&s->z);
 		kread16(fil,&s->cstat);
 		kread16(fil,&s->picnum);
-		 kread8(fil,&s->shade);
-		 kread8(fil,&s->pal);
- 		 kread8(fil,&s->clipdist);
-		 kread8(fil,&s->filler);
-		 kread8(fil,&s->xrepeat);
-		 kread8(fil,&s->yrepeat);
-		 kread8(fil,&s->xoffset);
-		 kread8(fil,&s->yoffset);
+		 kread8(fil,(char*)&s->shade);
+		 kread8(fil,(char*)&s->pal);
+ 		 kread8(fil,(char*)&s->clipdist);
+		 kread8(fil,(char*)&s->filler);
+		 kread8(fil,(char*)&s->xrepeat);
+		 kread8(fil,(char*)&s->yrepeat);
+		 kread8(fil,(char*)&s->xoffset);
+		 kread8(fil,(char*)&s->yoffset);
 		kread16(fil,&s->sectnum);
 		kread16(fil,&s->statnum);
 		kread16(fil,&s->ang);
--- a/Engine/src/pragmas.c
+++ b/Engine/src/pragmas.c
@@ -45,13 +45,13 @@
 	while((c--) > 0) *(q++) = *(p--);
 }
 
-void qinterpolatedown16(long bufptr, long num, long val, long add)
+void qinterpolatedown16(long* bufptr, long num, long val, long add)
 { // gee, I wonder who could have provided this...
-    long i, *lptr = (long *)bufptr;
+    long i, *lptr = bufptr;
     for(i=0;i<num;i++) { lptr[i] = (val>>16); val += add; }
 }
 
-void qinterpolatedown16short(long bufptr, long num, long val, long add)
+void qinterpolatedown16short(long* bufptr, long num, long val, long add)
 { // ...maybe the same person who provided this too?
     long i; short *sptr = (short *)bufptr;
     for(i=0;i<num;i++) { sptr[i] = (short)(val>>16); val += add; }
--- a/Engine/src/pragmas.h
+++ b/Engine/src/pragmas.h
@@ -48,32 +48,32 @@
 
 void vlin16first (long i1, long i2);
 
-static __inline int sqr (int input1) { return input1*input1; }
+static inline int sqr (int input1) { return input1*input1; }
 
 /* internal use:32x32 = 64bit */
-static __inline __int64 mul32_64(int i1,int i2)
+static inline int64_t mul32_64(int i1,int i2)
 {
 	return (__int64)i1*i2;
 }
-static __inline int scale (int input1, int input2, int input3)
+static inline int scale (int input1, int input2, int input3)
 {
-	return mul32_64(input1,input2)/input3;
+	return (int)(mul32_64(input1,input2)/(int64_t)input3);
 }
-static __inline int mulscale (int input1, int input2, int input3)
+static inline int mulscale (int input1, int input2, int input3)
 {
-	return mul32_64(input1,input2)>>input3;
+	return (int)(mul32_64(input1,input2)>>input3);
 }
-static __inline int dmulscale  (int input1, int input2, int input3,int input4,int input5)
+static inline int dmulscale  (int input1, int input2, int input3,int input4,int input5)
 {
-	return (mul32_64(input1,input2) + mul32_64(input3,input4))>>input5;
+	return (int)((mul32_64(input1,input2) + mul32_64(input3,input4))>>input5);
 }
-static __inline int tmulscale(int i1, int i2, int i3, int i4, int i5, int i6,int shift)
+static inline int tmulscale(int i1, int i2, int i3, int i4, int i5, int i6,int shift)
 {
-	return (mul32_64(i1,i2) + mul32_64(i3,i4) + mul32_64(i5,i6))>>shift;
+	return (int)((mul32_64(i1,i2) + mul32_64(i3,i4) + mul32_64(i5,i6))>>shift);
 }
-static __inline int divscale(int i1, int i2, int i3)
+static inline int divscale(int i1, int i2, int i3)
 {
-	return ((__int64)i1<<i3)/i2;
+	return (int)(((int64_t)i1<<i3)/i2);
 }
 
 #define DEFFUNCS \
@@ -157,8 +157,8 @@
 void clearbufbyte(void *D, long c, long a);
 void copybufbyte(void *S, void *D, long c);
 
-void qinterpolatedown16 (long bufptr, long num, long val, long add);
-void qinterpolatedown16short (long bufptr, long num, long val, long add);
+void qinterpolatedown16 (long* bufptr, long num, long val, long add);
+void qinterpolatedown16short (long* bufptr, long num, long val, long add);
 
 #endif /* !defined _INCLUDE_PRAGMAS_H_ */
 
--- a/Engine/src/sdl_driver.c
+++ b/Engine/src/sdl_driver.c
@@ -82,7 +82,7 @@
 
 int nNetMode = 0;
 
-#pragma message ( "[Fix this horrible networking mess. Function pointers not happy]" )
+//TODO ( "[Fix this horrible networking mess. Function pointers not happy]" )
 // I do not like this one bit.
 // Figure out what was causing the problems with the function pointers.
 // This mess is a direct result of my lack of time.. bleh
@@ -343,7 +343,6 @@
 static long mouse_relative_y = 0;
 static short mouse_buttons = 0;
 static unsigned int lastkey = 0;
-static SDL_TimerID primary_timer = NULL;
 /* so we can make use of setcolor16()... - DDOI */
 static unsigned char drawpixel_color=0;
 
@@ -537,7 +536,7 @@
     xdim = xres = surface->w;
     ydim = yres = surface->h;
 
-	printf("init_new_res_vars %d %d\n",xdim,ydim);
+	printf("init_new_res_vars %ld %ld\n",xdim,ydim);
 
     bytesperline = surface->w;
     vesachecked = 1;
@@ -682,8 +681,6 @@
 
 static int sdl_mouse_motion_filter(SDL_Event const *event)
 {
-	static int i = 0;
-
     if (surface == NULL)
 		return(0);
 
@@ -1093,7 +1090,7 @@
 void set_sdl_renderer(void)
 {
     const char *envr = getenv(BUILD_RENDERER);
-    char buffer[256];
+
 #ifdef USE_OPENGL
     int need_opengl_lib = 0;
 #endif
@@ -1216,7 +1213,7 @@
             {
                 //fullscreen = 1;
 				//TODO:
-#pragma message ( "[Todo: handle -netmode <int>]" )
+//TODO ( "[Todo: handle -netmode <int>]" )
 				Setup_StableNetworking();
 					
             }
@@ -1444,7 +1441,7 @@
 
     if (daxdim > MAXXDIM || daydim > MAXYDIM)
     {
-		printf("%d x %d is too big. Changed to %d x %d\n", daxdim, daydim, MAXXDIM,MAXYDIM);
+		printf("%ld x %ld is too big. Changed to %d x %d\n", daxdim, daydim, MAXXDIM,MAXYDIM);
 	    daxdim = MAXXDIM;
 	    daydim = MAXYDIM;
     } 
@@ -1460,7 +1457,7 @@
 
 	if(!validated)
     {
-		printf("%d x %d unsupported. Changed to 640 x 480\n", daxdim, daydim);
+		printf("%ld x %ld unsupported. Changed to 640 x 480\n", daxdim, daydim);
 	    daxdim = 640;
 	    daydim = 480;
     }
--- a/Game/src/_functio.h
+++ b/Game/src/_functio.h
@@ -164,93 +164,6 @@
 };
 
 
-static char * mousedefaults[] =
-   {
-   "Fire",
-   "Strafe",
-   "Move_Forward",
-   };
-
-
-static char * mouseclickeddefaults[] =
-   {
-   "",
-   "Open",
-   "",
-   };
-
-
-static char * joystickdefaults[] =
-   {
-   "Fire",
-   "Strafe",
-   "Run",
-   "Open",
-   "Aim_Down",
-   "Look_Right",
-   "Aim_Up",
-   "Look_Left",
-   };
-
-
-static char * joystickclickeddefaults[] =
-   {
-   "",
-   "Inventory",
-   "Jump",
-   "Crouch",
-   "",
-   "",
-   "",
-   "",
-   };
-
-
-static char * mouseanalogdefaults[] =
-   {
-   "analog_turning",
-   "analog_moving",
-   };
-
-
-static char * mousedigitaldefaults[] =
-   {
-   "",
-   "",
-   "",
-   "",
-   };
-
-
-static char * gamepaddigitaldefaults[] =
-   {
-   "Turn_Left",
-   "Turn_Right",
-   "Move_Forward",
-   "Move_Backward",
-   };
-
-
-static char * joystickanalogdefaults[] =
-   {
-   "analog_turning",
-   "analog_moving",
-   "analog_strafing",
-   "",
-   };
-
-
-static char * joystickdigitaldefaults[] =
-   {
-   "",
-   "",
-   "",
-   "",
-   "",
-   "",
-   "Run",
-   "",
-   };
 
 #ifdef __cplusplus
 };
--- a/Game/src/actors.c
+++ b/Game/src/actors.c
@@ -623,10 +623,10 @@
 }
 
 
-movesprite(short spritenum, long xchange, long ychange, long zchange, unsigned long cliptype)
+int movesprite(short spritenum, long xchange, long ychange, long zchange, unsigned long cliptype)
 {
     long daz,h, oldx, oldy;
-    short retval, dasectnum, a, cd;
+    short retval, dasectnum, cd;
     char bg;
 
     bg = badguy(&sprite[spritenum]);
@@ -1012,7 +1012,7 @@
 
 short ifhitbyweapon(short sn)
 {
-    short j, k, p;
+    short j, p;
     spritetype *npc;
 
     if( hittype[sn].extra >= 0 )
@@ -1515,8 +1515,8 @@
 
 void movestandables(void)
 {
-    short i, j, k, m, nexti, nextj, nextk, p, q, sect;
-    long l=0, x, *t, x1, y1;
+    short i, j, k, m, nexti, nextj, p, sect;
+    long l=0, x, *t;
     spritetype *s;
 
     i = headspritestat[6];
@@ -2451,8 +2451,8 @@
      
 void moveweapons(void)
 {
-    short i, j, k, nexti, p, q, tempsect;
-    long dax,day,daz, x, l, ll, x1, y1;
+    short i, j, k, nexti, p, q;
+    long dax,day,daz, x, ll;
     unsigned long qq;
     spritetype *s;
 
@@ -2797,7 +2797,7 @@
 void movetransports(void)
 {
     char warpspriteto;
-    short i, j, k, l, p, sect, sectlotag, nexti, nextj, nextk;
+    short i, j, k, l, p, sect, sectlotag, nexti, nextj;
     long ll,onfloorz,q;
 
     i = headspritestat[9]; //Transporters
@@ -4394,7 +4394,7 @@
 
 void moveexplosions(void)  // STATNUM 5
 {
-    short i, j, k, nexti, sect, p;
+    short i, j, nexti, sect, p;
     long l, x, *t;
     spritetype *s;
 
@@ -5171,8 +5171,8 @@
 
                 if(s->owner == -1)
                 {
-                    sprintf(tempbuf,"Could not find any locators for SE# 6 and 14 with a hitag of %ld.\n",t[3]);
-                    gameexit(tempbuf);
+                    sprintf((char*)tempbuf,"Could not find any locators for SE# 6 and 14 with a hitag of %ld.\n",t[3]);
+                    gameexit((char*)tempbuf);
                 }
 
                 j = ldist(&sprite[s->owner],s);
--- a/Game/src/animlib.c
+++ b/Game/src/animlib.c
@@ -118,7 +118,7 @@
 //
 //****************************************************************************
 
-void CPlayRunSkipDump (char *srcP, char *dstP)
+void CPlayRunSkipDump (byte *srcP, byte *dstP)
    {
    signed char cnt;
    uint16 wordCnt;
@@ -249,7 +249,7 @@
 //
 //****************************************************************************
 
-void ANIM_LoadAnim (char * buffer)
+void ANIM_LoadAnim (byte * buffer)
    {
    uint16 i;
    int32 size;
--- a/Game/src/animlib.h
+++ b/Game/src/animlib.h
@@ -106,7 +106,7 @@
 //
 //****************************************************************************
 
-void ANIM_LoadAnim (char * buffer);
+void ANIM_LoadAnim (byte * buffer);
 
 //****************************************************************************
 //
--- a/Game/src/config.c
+++ b/Game/src/config.c
@@ -94,11 +94,6 @@
 #define MAXSETUPFILES 20
 void CONFIG_GetSetupFilename( void )
    {
-   struct find_t fblock;
-   char extension[10];
-   char * src;
-   char * filenames[MAXSETUPFILES];
-   int32 numfiles;
    int32 i;
 
 
@@ -387,7 +382,7 @@
       function = CONFIG_AnalogNameToNum(temp);
       if (function != -1)
          {
-#pragma message( "Fix the Analog mouse axis issue. Just make a new function for registering them." )      
+         //TODO Fix the Analog mouse axis issue. Just make a new function for registering them.
          //CONTROL_MapAnalogAxis(i,function);
          }
       sprintf(str,"MouseDigitalAxes%ld_0",i);
@@ -402,7 +397,7 @@
       CONTROL_MapDigitalAxis( i, function, 1 );
       sprintf(str,"MouseAnalogScale%ld",i);
       SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
-#pragma message( "Fix the Analog mouse scale issue. Just make a new function for registering them." )      
+      //TODO: Fix the Analog mouse scale issue. Just make a new function for registering them.
 	  //CONTROL_SetAnalogAxisScale( i, scale );
       }
 
@@ -552,7 +547,7 @@
    SCRIPT_GetNumber( scripthandle, "Controls","JoystickPort",&function);
    CONTROL_JoystickPort = function;
    // read in rudder state
-   SCRIPT_GetNumber( scripthandle, "Controls","EnableRudder",&CONTROL_RudderEnabled);
+   SCRIPT_GetNumber( scripthandle, "Controls","EnableRudder",(int32_t*)&CONTROL_RudderEnabled);
 }
 
 void readsavenames(void)
@@ -862,15 +857,15 @@
 	// FIX_00016: Build in Keyboard/mouse setup. Mouse now faster.
 	for(i=0; i<MAXMOUSEBUTTONS; i++)
 	{
-		sprintf(tempbuf, "MouseButton%d", i);
-		SCRIPT_PutString(scripthandle, "Controls", tempbuf, 
+		sprintf((char*)tempbuf, "MouseButton%ld", i);
+		SCRIPT_PutString(scripthandle, "Controls", (char*)tempbuf, 
 			(MouseMapping[i]!=-1)?CONFIG_FunctionNumToName(MouseMapping[i]):"");
 	}
 
 	for (i=0;i<MAXMOUSEAXES*2;i++)
 	{
-		sprintf(tempbuf, "MouseDigitalAxes%d_%d", i>>1, i&1);
-		SCRIPT_PutString(scripthandle, "Controls", tempbuf, 
+		sprintf((char*)tempbuf, "MouseDigitalAxes%ld_%ld", i>>1, i&1);
+		SCRIPT_PutString(scripthandle, "Controls", (char*)tempbuf, 
 			(MouseDigitalAxeMapping[i>>1][i&1]!=-1)?CONFIG_FunctionNumToName(MouseDigitalAxeMapping[i>>1][i&1]):"");
 	}
 
--- a/Game/src/console.c
+++ b/Game/src/console.c
@@ -48,6 +48,7 @@
 // Toggle for the console state
 int nConsole_Active = 0;
 
+void CVAR_RegisterDefaultCvarBindings(void);
 // Initialize the console
 void CONSOLE_Init()
 {
@@ -559,7 +560,6 @@
 
 void CONSOLE_Printf(const char *newmsg, ...)
 {
-    int tmp;
     CONSOLEELEMENT *pElement;
     va_list		argptr;
     char		msg[512];//[MAX_CONSOLE_STRING_LENGTH];
--- a/Game/src/control.c
+++ b/Game/src/control.c
@@ -84,6 +84,15 @@
 static float JoyAnalogScale[MAXJOYAXES];
 static int32 JoyAnalogDeadzone[MAXJOYAXES];
 
+//Extern functions from SDLDriver.c:
+int _joystick_hat(int hat);
+void _joystick_deinit(void);
+void _joystick_init(void);
+int _joystick_button(int button);
+int _joystick_axis(int axis);
+int _joystick_update(void);
+//End of SDLDriver declaration
+
 int ACTION(int i)
 {
 
--- a/Game/src/cvar_defs.c
+++ b/Game/src/cvar_defs.c
@@ -102,13 +102,13 @@
         char buf[128];
         minitext(2, 2, "Debug Sound", 17,10+16);
 
-		sprintf(buf, "Active sounds: %d", sounddebugActiveSounds);
+		sprintf(buf, "Active sounds: %lu", sounddebugActiveSounds);
 		minitext(2, 10, buf, 23,10+16);
 		
-		sprintf(buf, "Allocate Calls: %d", sounddebugAllocateSoundCalls);
+		sprintf(buf, "Allocate Calls: %lu", sounddebugAllocateSoundCalls);
 		minitext(2, 18, buf, 23,10+16);
 
-		sprintf(buf, "Deallocate Calls: %d", sounddebugDeallocateSoundCalls);
+		sprintf(buf, "Deallocate Calls: %ld", sounddebugDeallocateSoundCalls);
 		minitext(2, 26, buf, 23,10+16);
 	}
 
@@ -120,7 +120,6 @@
 void CVARDEFS_DefaultFunction(void* var)
 {
     int argc;
-    char* argv;
     cvar_binding* binding = (cvar_binding*)var;
 
     argc = CONSOLE_GetArgc();
@@ -144,7 +143,6 @@
   {
 	if(ps[myconnectindex].gm&MODE_GAME)
 	{
-		char quittimer = totalclock+1;
 		gamequit = 1;
 		CONSOLE_SetActive(0);
     }
@@ -299,7 +297,7 @@
 
             for(i=connecthead;i>=0;i=connectpoint2[i])
             {
-                sendpacket(i,tempbuf,11); //And send the packet to everyone
+                sendpacket(i,(char*)tempbuf,11); //And send the packet to everyone
             }
         }
 		else ps[myconnectindex].gm |= MODE_RESTART; //Otherwise just restart the game
--- a/Game/src/cvars.c
+++ b/Game/src/cvars.c
@@ -2,9 +2,10 @@
 #include "cvar_defs.h"
 #include <stdlib.h>
 
+#include <strings.h>
+
 #define MAX_CVARS 32
 
-#pragma message ( "We probably want this to be some sort of dynamic list at some point" )
 cvar_binding cvar_binding_list[MAX_CVARS];
 int num_cvar_bindings = 0;
 
@@ -40,12 +41,12 @@
 }
 
 // Bind all standard CVars here
-void CVAR_RegisterDefaultCvarBindings()
+void CVAR_RegisterDefaultCvarBindings(void)
 {
     CVARDEFS_Init();
 }
 
-void CVAR_Render()
+void CVAR_Render(void)
 {
     CVARDEFS_Render();
 }
--- a/Game/src/duke3d.h
+++ b/Game/src/duke3d.h
@@ -356,7 +356,7 @@
 typedef struct
 {
     char *ptr;
-    volatile char lock;
+    char lock;
     int  length, num;
 } SAMPLE;
 
--- a/Game/src/dummy_audiolib.c
+++ b/Game/src/dummy_audiolib.c
@@ -26,7 +26,7 @@
 int   FX_GetReverseStereo( void ){return 1;}
 void  FX_SetReverb( int reverb ){}
 void  FX_SetFastReverb( int reverb ){}
-int   FX_GetMaxReverbDelay( void ){}
+int   FX_GetMaxReverbDelay( void ){return 0;}
 int   FX_GetReverbDelay( void ){return 1;}
 void  FX_SetReverbDelay( int delay ){}
 
--- a/Game/src/funct.h
+++ b/Game/src/funct.h
@@ -61,7 +61,7 @@
 //#line "sounds.c" 494
 extern void pan3dsound(void );
 //#line "sounds.c" 571
-extern void TestCallBack(unsigned long num);
+extern void TestCallBack(long num);
 //#line "sector.c" 9
 extern short callsound(short sn,short whatsprite);
 //#line "sector.c" 56
@@ -503,13 +503,13 @@
 //#line "animlib.c" 71
 extern void loadpage(uint16 pagenumber,uint16 *pagepointer);
 //#line "animlib.c" 97
-extern void CPlayRunSkipDump(char *srcP,char *dstP);
+extern void CPlayRunSkipDump(byte *srcP,byte *dstP);
 //#line "animlib.c" 177
 extern void renderframe(uint16 framenumber,uint16 *pagepointer);
 //#line "animlib.c" 214
 extern void drawframe(uint16 framenumber);
 //#line "animlib.c" 228
-extern void ANIM_LoadAnim(char *buffer);
+extern void ANIM_LoadAnim(byte *buffer);
 //#line "animlib.c" 260
 extern void ANIM_FreeAnim(void );
 //#line "animlib.c" 275
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -54,7 +54,7 @@
 #include <sys/stat.h>
 
 
-#pragma message("game.c this is So lame")
+// this is So lame
 #include "cache1d.h"
 
 #define MINITEXT_BLUE	0
@@ -454,7 +454,6 @@
 void getpackets(void)
 {
     long i, j, k, l;
-    FILE *fp;
     short other, packbufleng;
     input *osyn, *nsyn;
 
@@ -1876,7 +1875,7 @@
 {
     struct player_struct *p;
     long i, j, o, ss, u;
-    char c, permbit;
+    char permbit;
 	short offx = 3, offy = 3, stepx=60, stepy=6;
 
     p = &ps[snum];
@@ -2918,7 +2917,7 @@
 void view(struct player_struct *pp, long *vx, long *vy,long *vz,short *vsectnum, short ang, short horiz)
 {
      spritetype *sp;
-     long i, nx, ny, nz, hx, hy, hz, hitx, hity, hitz;
+     long i, nx, ny, nz, hx, hy, hitx, hity, hitz;
      short bakcstat, hitsect, hitwall, hitsprite, daang;
 
      nx = (sintable[(ang+1536)&2047]>>4);
@@ -2977,7 +2976,7 @@
 void drawbackground(void)
 {
      short dapicnum;
-     long x,y,x1,y1,x2,y2,topy;
+     long x,y,x1,y1,x2,y2;
 
      flushperms();
 
@@ -3202,10 +3201,10 @@
 
 void displayrooms(short snum,long smoothratio)
 {
-    long cposx,cposy,cposz,dst,j,fz,cz,hz,lz;
-    short sect, cang, k, choriz,tsect;
+    long cposx,cposy,cposz,dst,j,fz,cz;
+    short sect, cang, k, choriz;
     struct player_struct *p;
-    long tposx,tposy,tposz,dx,dy,thoriz,i;
+    long tposx,tposy,i;
     short tang;
 
     p = &ps[snum];
@@ -7482,7 +7481,7 @@
 
 void Logo(void)
 {
-    short i,j,soundanm;
+    short i,soundanm;
 
     soundanm = 0;
 
@@ -8131,7 +8130,6 @@
 	// FIX_00032: Added multi base GRP manager. Use duke3d*.grp to handle multiple grp.
     
 	char groupfilefullpath[512];
-	int i = 0;
 
 	char *baseDir="duke3d*.grp";
 	//char *baseDir="DUKE3D.GRP";
@@ -8146,11 +8144,11 @@
 
 int main(int argc,char **argv)
 {
-    long i, j, k, l;
+    long i, j;
 	int32 iScriptHandle;
 	long filehandle;
 
-	char HEAD[2048], HEAD2[2048], HEADA[2048], HEAD2A[2048];
+	char HEAD[2048], HEAD2[2048], HEADA[2048];
 	char kbdKey;
 	char *exe;
 
@@ -8611,7 +8609,7 @@
         if( ud.recstat == 2 || ud.multimode > 1 || ( ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU ) )
             if( ps[myconnectindex].gm&MODE_GAME )
 			{
-#pragma message (" It's stuck here ")
+                // (" It's stuck here ")
 				//printf("ps[myconnectindex].gm&MODE_GAME\n");
 				if( moveloop() ) 
 				{
@@ -8946,7 +8944,6 @@
 long playback(void)
 {
     long i,j,k,l,t;
-    short p;
     char foundemo;
 #ifdef DBGRECORD
 	FILE * pFile;
@@ -9888,7 +9885,7 @@
 
 void dobonus(char bonusonly)
 {
-    short t, r, tinc,gfx_offset;
+    short t, tinc,gfx_offset;
     long i, y,xfragtotal,yfragtotal;
     short bonuscnt;
 
@@ -10766,7 +10763,7 @@
 
 	if(ud.multimode>1) // if more than 1 player, we add name. Then add score if DM
 	{
-		strcat(tempbuf, " [");
+		strcat((char*)tempbuf, " [");
 		for(i=connecthead;i>=0;i=connectpoint2[i])
 		{
 			if(!ud.user_name[i][0])
--- a/Game/src/gamedef.c
+++ b/Game/src/gamedef.c
@@ -41,6 +41,13 @@
 
 #define NUMKEYWORDS     112
 
+//From global.c
+void FixFilePath(char *filename);
+
+//From actors.c
+void lotsofmail(spritetype *s, short n);
+void lotsofpaper(spritetype *s, short n);
+
 char *keyw[NUMKEYWORDS] =
 {
     "definelevelname",  // 0
@@ -324,7 +331,7 @@
     tempbuf[i] = 0;
 
     for(i=0;i<NUMKEYWORDS;i++)
-        if( strcmp( tempbuf,keyw[i]) == 0 )
+        if( strcmp( (const char*)tempbuf,keyw[i]) == 0 )
             return i;
 
     return -1;
@@ -352,7 +359,7 @@
 
     for(i=0;i<NUMKEYWORDS;i++)
     {
-        if( strcmp( tempbuf,keyw[i]) == 0 )
+        if( strcmp( (const char*)tempbuf,keyw[i]) == 0 )
         {
             *scriptptr = i;
             textptr += l;
@@ -364,16 +371,16 @@
     textptr += l;
 
     if( tempbuf[0] == '{' && tempbuf[1] != 0)
-        printf("  * ERROR!(L%ld) Expecting a SPACE or CR between '{' and '%s'.\n",line_number,tempbuf+1);
+        printf("  * ERROR!(L%hd) Expecting a SPACE or CR between '{' and '%s'.\n",line_number,tempbuf+1);
     else if( tempbuf[0] == '}' && tempbuf[1] != 0)
-        printf("  * ERROR!(L%ld) Expecting a SPACE or CR between '}' and '%s'.\n",line_number,tempbuf+1);
+        printf("  * ERROR!(L%hd) Expecting a SPACE or CR between '}' and '%s'.\n",line_number,tempbuf+1);
     else if( tempbuf[0] == '/' && tempbuf[1] == '/' && tempbuf[2] != 0 )
-        printf("  * ERROR!(L%ld) Expecting a SPACE between '//' and '%s'.\n",line_number,tempbuf+2);
+        printf("  * ERROR!(L%hd) Expecting a SPACE between '//' and '%s'.\n",line_number,tempbuf+2);
     else if( tempbuf[0] == '/' && tempbuf[1] == '*' && tempbuf[2] != 0 )
-        printf("  * ERROR!(L%ld) Expecting a SPACE between '/*' and '%s'.\n",line_number,tempbuf+2);
+        printf("  * ERROR!(L%hd) Expecting a SPACE between '/*' and '%s'.\n",line_number,tempbuf+2);
     else if( tempbuf[0] == '*' && tempbuf[1] == '/' && tempbuf[2] != 0 )
-        printf("  * ERROR!(L%ld) Expecting a SPACE between '*/' and '%s'.\n",line_number,tempbuf+2);
-    else printf("  * ERROR!(L%ld) Expecting key word, but found '%s'.\n",line_number,tempbuf);
+        printf("  * ERROR!(L%hd) Expecting a SPACE between '*/' and '%s'.\n",line_number,tempbuf+2);
+    else printf("  * ERROR!(L%hd) Expecting key word, but found '%s'.\n",line_number,tempbuf);
 
     error++;
     return -1;
@@ -404,7 +411,7 @@
         if( strcmp( label+(labelcnt<<6),keyw[i]) == 0 )
     {
         error++;
-        printf("  * ERROR!(L%ld) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
+        printf("  * ERROR!(L%hd) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
         textptr+=l;
     }
 
@@ -411,7 +418,7 @@
 
     for(i=0;i<labelcnt;i++)
     {
-        if( strcmp(tempbuf,label+(i<<6)) == 0 )
+        if( strcmp((const char*)tempbuf,label+(i<<6)) == 0 )
         {
             *scriptptr = labelcode[i];
             scriptptr++;
@@ -422,7 +429,7 @@
 
     if( isdigit(*textptr) == 0 && *textptr != '-')
     {
-        printf("  * ERROR!(L%ld) Parameter '%s' is undefined.\n",line_number,tempbuf);
+        printf("  * ERROR!(L%hd) Parameter '%s' is undefined.\n",line_number,tempbuf);
         error++;
         textptr+=l;
         return;
@@ -460,7 +467,7 @@
                 if(*textptr == 0x0a) line_number++;
                 if( *textptr == 0 )
                 {
-                    printf("  * ERROR!(L%ld) Found '/*' with no '*/'.\n",j,label+(labelcnt<<6));
+                    printf("  * ERROR!(L%ld) Found '/*' with no '*/'.\n",j);
                     error++;
                     return 0;
                 }
@@ -487,7 +494,7 @@
                 if( strcmp( label+(labelcnt<<6),keyw[i]) == 0 )
                 {
                     error++;
-                    printf("  * ERROR!(L%ld) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
+                    printf("  * ERROR!(L%hd) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
                     return 0;
                 }
 
@@ -502,7 +509,7 @@
 
             if(j==labelcnt)
             {
-                printf("  * ERROR!(L%ld) State '%s' not found.\n",line_number,label+(labelcnt<<6));
+                printf("  * ERROR!(L%hd) State '%s' not found.\n",line_number,label+(labelcnt<<6));
                 error++;
             }
             scriptptr++;
@@ -519,7 +526,7 @@
         case 18:
             if( parsing_state == 0 )
             {
-                printf("  * ERROR!(L%ld) Found 'ends' with no 'state'.\n",line_number);
+                printf("  * ERROR!(L%hd) Found 'ends' with no 'state'.\n",line_number);
                 error++;
             }
 //            else
@@ -526,12 +533,12 @@
             {
                 if( num_squigilly_brackets > 0 )
                 {
-                    printf("  * ERROR!(L%ld) Found more '{' than '}' before 'ends'.\n",line_number);
+                    printf("  * ERROR!(L%hd) Found more '{' than '}' before 'ends'.\n",line_number);
                     error++;
                 }
                 if( num_squigilly_brackets < 0 )
                 {
-                    printf("  * ERROR!(L%ld) Found more '}' than '{' before 'ends'.\n",line_number);
+                    printf("  * ERROR!(L%hd) Found more '}' than '{' before 'ends'.\n",line_number);
                     error++;
                 }
                 parsing_state = 0;
@@ -545,7 +552,7 @@
                 if( strcmp( label+(labelcnt<<6),keyw[i]) == 0 )
                 {
                     error++;
-                    printf("  * ERROR!(L%ld) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
+                    printf("  * ERROR!(L%hd) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
                     return 0;
                 }
 
@@ -554,7 +561,7 @@
                 if( strcmp(label+(labelcnt<<6),label+(i<<6)) == 0 )
                 {
                     warning++;
-                    printf("  * WARNING.(L%ld) Duplicate definition '%s' ignored.\n",line_number,label+(labelcnt<<6));
+                    printf("  * WARNING.(L%hd) Duplicate definition '%s' ignored.\n",line_number,label+(labelcnt<<6));
                     break;
                 }
             }
@@ -606,7 +613,7 @@
                     if( strcmp( label+(labelcnt<<6),keyw[i]) == 0 )
                 {
                     error++;
-                    printf("  * ERROR!(L%ld) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
+                    printf("  * ERROR!(L%hd) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
                     return 0;
                 }
 
@@ -614,7 +621,7 @@
                     if( strcmp(label+(labelcnt<<6),label+(i<<6)) == 0 )
                     {
                         warning++;
-                        printf("  * WARNING.(L%ld) Duplicate move '%s' ignored.\n",line_number,label+(labelcnt<<6));
+                        printf("  * WARNING.(L%hd) Duplicate move '%s' ignored.\n",line_number,label+(labelcnt<<6));
                         break;
                     }
                 if(i == labelcnt)
@@ -708,7 +715,7 @@
 				tempbuf[j] = '\0';
 
 				// fix path for unix. (doesn't really matter...)			
-				FixFilePath(tempbuf);
+				FixFilePath((char*)tempbuf);
 /*
 				// Are we loading a TC?
 				if(game_dir[0] != '\0')
@@ -728,7 +735,7 @@
 				if(fp <= 0)
 				{
 					error++;
-					printf("  * ERROR!(ln%ld) Could not find '%s'.\n",line_number,label+(labelcnt<<6));
+					printf("  * ERROR!(ln%hd) Could not find '%s'.\n",line_number,label+(labelcnt<<6));
 
 					printf("ERROR: could not open (%s)\n", includedconfile);
 					gameexit("");
@@ -750,7 +757,7 @@
 
 				kread(fp,(char *)textptr,j);
 				kclose(fp);
-				ud.conCRC[0] = crc32_update((char *)textptr, j, ud.conCRC[0]);
+				ud.conCRC[0] = crc32_update((unsigned char *)textptr, j, ud.conCRC[0]);
 
 				do
 					done = parsecommand(readfromGRP);
@@ -775,7 +782,7 @@
                     if( strcmp( label+(labelcnt<<6),keyw[i]) == 0 )
                     {
                         error++;
-                        printf("  * ERROR!(L%ld) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
+                        printf("  * ERROR!(L%hd) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
                         return 0;
                     }
 
@@ -783,7 +790,7 @@
                     if( strcmp(label+(labelcnt<<6),label+(i<<6)) == 0 )
                     {
                         warning++;
-                        printf("  * WARNING.(L%ld) Duplicate ai '%s' ignored.\n",line_number,label+(labelcnt<<6));
+                        printf("  * WARNING.(L%hd) Duplicate ai '%s' ignored.\n",line_number,label+(labelcnt<<6));
                         break;
                     }
 
@@ -829,7 +836,7 @@
                     if( strcmp( label+(labelcnt<<6),keyw[i]) == 0 )
                     {
                         error++;
-                        printf("  * ERROR!(L%ld) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
+                        printf("  * ERROR!(L%hd) Symbol '%s' is a key word.\n",line_number,label+(labelcnt<<6));
                         return 0;
                     }
 
@@ -837,7 +844,7 @@
                     if( strcmp(label+(labelcnt<<6),label+(i<<6)) == 0 )
                     {
                         warning++;
-                        printf("  * WARNING.(L%ld) Duplicate action '%s' ignored.\n",line_number,label+(labelcnt<<6));
+                        printf("  * WARNING.(L%hd) Duplicate action '%s' ignored.\n",line_number,label+(labelcnt<<6));
                         break;
                     }
 
@@ -860,13 +867,13 @@
         case 1:
             if( parsing_state )
             {
-                printf("  * ERROR!(L%ld) Found 'actor' within 'state'.\n",line_number);
+                printf("  * ERROR!(L%hd) Found 'actor' within 'state'.\n",line_number);
                 error++;
             }
 
             if( parsing_actor )
             {
-                printf("  * ERROR!(L%ld) Found 'actor' within 'actor'.\n",line_number);
+                printf("  * ERROR!(L%hd) Found 'actor' within 'actor'.\n",line_number);
                 error++;
             }
 
@@ -915,13 +922,13 @@
 
             if( parsing_state )
             {
-                printf("  * ERROR!(L%ld) Found 'useritem' within 'state'.\n",line_number);
+                printf("  * ERROR!(L%hd) Found 'useritem' within 'state'.\n",line_number);
                 error++;
             }
 
             if( parsing_actor )
             {
-                printf("  * ERROR!(L%ld) Found 'useritem' within 'actor'.\n",line_number);
+                printf("  * ERROR!(L%hd) Found 'useritem' within 'actor'.\n",line_number);
                 error++;
             }
 
@@ -1025,7 +1032,7 @@
             {
                 scriptptr--;
                 error++;
-                printf("  * ERROR!(L%ld) Found 'else' with no 'if'.\n",line_number);
+                printf("  * ERROR!(L%hd) Found 'else' with no 'if'.\n",line_number);
             }
 
             return 0;
@@ -1114,7 +1121,7 @@
             num_squigilly_brackets--;
             if( num_squigilly_brackets < 0 )
             {
-                printf("  * ERROR!(L%ld) Found more '}' than '{'.\n",line_number);
+                printf("  * ERROR!(L%hd) Found more '}' than '{'.\n",line_number);
                 error++;
             }
             return 1;
@@ -1151,7 +1158,7 @@
                 textptr++,i++;
                 if(i >= 32)
                 {
-                    printf("  * ERROR!(L%ld) Volume name exceeds character size limit of 32.\n",line_number);
+                    printf("  * ERROR!(L%hd) Volume name exceeds character size limit of 32.\n",line_number);
                     error++;
                     while( *textptr != 0x0a ) textptr++;
                     break;
@@ -1178,7 +1185,7 @@
                 textptr++,i++;
                 if(i >= 32)
                 {
-                    printf("  * ERROR!(L%ld) Skill name exceeds character size limit of 32.\n",line_number);
+                    printf("  * ERROR!(L%hd) Skill name exceeds character size limit of 32.\n",line_number);
                     error++;
                     while( *textptr != 0x0a ) textptr++;
                     break;
@@ -1208,7 +1215,7 @@
                 textptr++,i++;
                 if(i > 127)
                 {
-                    printf("  * ERROR!(L%ld) Level file name exceeds character size limit of 128.\n",line_number);
+                    printf("  * ERROR!(L%hd) Level file name exceeds character size limit of 128.\n",line_number);
                     error++;
                     while( *textptr != ' ') textptr++;
                     break;
@@ -1244,7 +1251,7 @@
                 textptr++,i++;
                 if(i >= 32)
                 {
-                    printf("  * ERROR!(L%ld) Level name exceeds character size limit of 32.\n",line_number);
+                    printf("  * ERROR!(L%hd) Level name exceeds character size limit of 32.\n",line_number);
                     error++;
                     while( *textptr != 0x0a ) textptr++;
                     break;
@@ -1263,7 +1270,7 @@
             k = *(scriptptr-1);
             if(k >= NUMOFFIRSTTIMEACTIVE)
             {
-                printf("  * ERROR!(L%ld) Quote amount exceeds limit of %ld characters.\n",line_number,NUMOFFIRSTTIMEACTIVE);
+                printf("  * ERROR!(L%hd) Quote amount exceeds limit of %d characters.\n",line_number,NUMOFFIRSTTIMEACTIVE);
                 error++;
             }
             scriptptr--;
@@ -1277,7 +1284,7 @@
                 textptr++,i++;
                 if(i >= 64)
                 {
-                    printf("  * ERROR!(L%ld) Quote exceeds character size limit of 64.\n",line_number);
+                    printf("  * ERROR!(L%hd) Quote exceeds character size limit of 64.\n",line_number);
                     error++;
                     while( *textptr != 0x0a ) textptr++;
                     break;
@@ -1291,7 +1298,7 @@
             k = *(scriptptr-1);
             if(k >= NUM_SOUNDS)
             {
-                printf("  * ERROR!(L%ld) Exceeded sound limit of %ld.\n",line_number,NUM_SOUNDS);
+                printf("  * ERROR!(L%hd) Exceeded sound limit of %d.\n",line_number,NUM_SOUNDS);
                 error++;
             }
             scriptptr--;
@@ -1306,7 +1313,7 @@
                 if(i >= 13)
                 {
                     puts(sounds[k]);
-                    printf("  * ERROR!(L%ld) Sound filename exceeded limit of 13 characters.\n",line_number);
+                    printf("  * ERROR!(L%hd) Sound filename exceeded limit of 13 characters.\n",line_number);
                     error++;
                     while( *textptr != ' ' ) textptr++;
                     break;
@@ -1334,7 +1341,7 @@
         case 4:
             if( parsing_actor == 0 )
             {
-                printf("  * ERROR!(L%ld) Found 'enda' without defining 'actor'.\n",line_number);
+                printf("  * ERROR!(L%hd) Found 'enda' without defining 'actor'.\n",line_number);
                 error++;
             }
 //            else
@@ -1341,7 +1348,7 @@
             {
                 if( num_squigilly_brackets > 0 )
                 {
-                    printf("  * ERROR!(L%ld) Found more '{' than '}' before 'enda'.\n",line_number);
+                    printf("  * ERROR!(L%hd) Found more '{' than '}' before 'enda'.\n",line_number);
                     error++;
                 }
                 parsing_actor = 0;
@@ -1543,7 +1550,6 @@
 
 void loadefs(char *filenam, char *mptr, int readfromGRP)
 {
-    int i;
     long fs,fp;
 	char kbdKey;
 
@@ -1568,7 +1574,7 @@
         kread(fp,(char *)textptr,fs);
         kclose(fp);
 		ud.conCRC[0]=0;
-		ud.conCRC[0] = crc32_update((char *)textptr, fs, ud.conCRC[0]);
+		ud.conCRC[0] = crc32_update((unsigned char *)textptr, fs, ud.conCRC[0]);
     }
 
 #ifdef PLATFORM_UNIX
@@ -1591,7 +1597,7 @@
     *script = (long) scriptptr;
 
     if(warning|error)
-        printf("Found %ld warning(s), %ld error(s).\n",warning,error);
+        printf("Found %hhd warning(s), %c error(s).\n",warning,error);
 
     if(error)
     {
@@ -1730,7 +1736,7 @@
 
 short furthestcanseepoint(short i,spritetype *ts,long *dax,long *day)
 {
-    short j, hitsect,hitwall,hitspr, angincs, tempang;
+    short j, hitsect,hitwall,hitspr, angincs;
     long hx, hy, hz, d, da;//, d, cd, ca,tempx,tempy,cx,cy;
     spritetype *s = &sprite[i];
 
@@ -1835,7 +1841,7 @@
 void move()
 {
     long l, *moveptr;
-    short j, a, goalang, angdif;
+    short a, goalang, angdif;
     long daxvel;
 
     a = g_sp->hitag;
@@ -2132,7 +2138,6 @@
         case 5:
         {
             spritetype *s;
-            short sect;
 
             if(ps[g_p].holoduke_on >= 0)
             {
--- a/Game/src/global.c
+++ b/Game/src/global.c
@@ -493,7 +493,7 @@
 
    return (ix - (ix>>4) + (t>>2) + (t>>3));
 }
-
+#include "SDL.h"
 void Error (int errorType, char *error, ...)
 {
    va_list argptr;
--- a/Game/src/keyboard.c
+++ b/Game/src/keyboard.c
@@ -35,8 +35,8 @@
 =============================================================================
 */
 
-volatile byte  KB_KeyDown[ MAXKEYBOARDSCAN ];   // Keyboard state array
-volatile kb_scancode KB_LastScan;
+byte  KB_KeyDown[ MAXKEYBOARDSCAN ];   // Keyboard state array
+kb_scancode KB_LastScan;
 
 static volatile boolean keyIsWaiting = 0;
 
@@ -112,7 +112,6 @@
 
 char KB_Getch( void )
 {
-    int shifted;
 
     while (!keyIsWaiting) { _idle(); /* pull the pud. */ }
 	keyIsWaiting = false;
--- a/Game/src/keyboard.h
+++ b/Game/src/keyboard.h
@@ -173,8 +173,8 @@
 =============================================================================
 */
 
-extern volatile byte  KB_KeyDown[ MAXKEYBOARDSCAN ];   // Keyboard state array
-extern volatile kb_scancode KB_LastScan;
+extern byte  KB_KeyDown[ MAXKEYBOARDSCAN ];   // Keyboard state array
+extern kb_scancode KB_LastScan;
 
 
 /*
--- a/Game/src/menues.c
+++ b/Game/src/menues.c
@@ -38,7 +38,7 @@
 short probey=0,lastprobey=0,last_menu,globalskillsound=-1;
 short sh,onbar,buttonstat,deletespot;
 short last_zero,last_fifty,last_threehundred = 0;
-static char fileselect = 1, menunamecnt, menuname[256][17], curpath[80], menupath[80];
+static char fileselect = 1, menunamecnt, menuname[256][17];
 
 // File tree info
 //
@@ -178,10 +178,9 @@
 int loadpheader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *nump)
 {
 
-     long i;
-         char fn[] = "game0.sav";
-         long fil;
-     long bv;
+    char fn[] = "game0.sav";
+    long fil;
+    long bv;
 
          fn[4] = spot+'0';
 
@@ -784,7 +783,6 @@
 int probeXduke(int x,int y,int i,int n, long spriteSize)
 {
     short centre;
-	long mouseY;
 	int32 mouseSens;
 
 	static long delay_counter_up = 0, delay_counter_down = 0, delay_up = 50, delay_down = 50;
@@ -2295,7 +2293,7 @@
 					{
 						//CONSOLE_Printf("MENU_USER_MAP");
 						//
-#pragma message ("[Todo: generate file list starting from .\\maps]")
+                    //[Todo: generate file list starting from .\\maps]")
 
 						cmenu(MENU_USER_MAP); // cmenu(101)
 						break;
@@ -2359,8 +2357,7 @@
 
 				// Draw USER MAP background
 				{
-					int x1, x2, y, y1, y2; 
-					long sx, sy;
+					int y, x1;
 					long xPos, xPos2;
 					long yPos, yPos2;
 
--- a/Game/src/midi/xmidi.cpp
+++ b/Game/src/midi/xmidi.cpp
@@ -815,8 +815,8 @@
 	}
 
 	void printx() {
-		if (high) printf ("%X%08X", high, low);
-		else printf ("%X", low);
+		if (high) printf ("%lX%08lX", high, low);
+		else printf ("%lX", low);
 	}
 };
 #endif
--- a/Game/src/player.c
+++ b/Game/src/player.c
@@ -52,7 +52,6 @@
 void incur_damage( struct player_struct *p )
 {
     long  damage = 0L, shield_damage = 0L;
-    short i, damage_source;
 
     sprite[p->i].extra -= p->extra_extra8>>8;
 
@@ -1219,7 +1218,7 @@
 
 void displaymasks(short snum)
 {
-    short i, p;
+    short p;
 
     if(sprite[ps[snum].i].pal == 1)
         p = 1;
@@ -1297,7 +1296,7 @@
 void displayweapon(short snum)
 {
     long gun_pos, looking_arc, cw;
-    long weapon_xoffset, i, j, x1, y1, x2;
+    long weapon_xoffset, i, j;
     char o,pal;
     signed char gs;
     struct player_struct *p;
@@ -2129,7 +2128,7 @@
 
 char doincrements(struct player_struct *p)
 {
-    long /*j,*/i,snum;
+    long snum;
 
     snum = sprite[p->i].yvel;
 //    j = sync[snum].avel;
@@ -2319,7 +2318,7 @@
 
 void checkweapons(struct player_struct *p)
 {
-    short j,cw;
+    short cw;
 
     cw = p->curr_weapon;
 
@@ -2725,7 +2724,7 @@
 		ud.playing_demo_rev == BYTEVERSION_28 || 
 		ud.playing_demo_rev == BYTEVERSION_116 || 
 		ud.playing_demo_rev == BYTEVERSION_117) &&
-		sb_snum&(1<<6) || 
+		sb_snum&(1<<6) ||
 		ACTION(gamefunc_Look_Left) && (p->gm&MODE_GAME) && 
 		!(p->gm&MODE_MENU) && !(p->gm&MODE_TYPE) && !(ud.pause_on) && (ud.recstat != 2))
 	{
@@ -2739,8 +2738,11 @@
 		ud.playing_demo_rev == BYTEVERSION_116 || 
 		ud.playing_demo_rev == BYTEVERSION_117) &&
 		sb_snum&(1<<7) || 
-		ACTION(gamefunc_Look_Right) && (p->gm&MODE_GAME) && 
-		!(p->gm&MODE_MENU) && !(p->gm&MODE_TYPE) && !(ud.pause_on) && (ud.recstat != 2))
+		(
+         ACTION(gamefunc_Look_Right) && (p->gm&MODE_GAME) &&
+		!(p->gm&MODE_MENU) && !(p->gm&MODE_TYPE) && !(ud.pause_on) && (ud.recstat != 2)
+         )
+         )
 	{
 		p->look_ang += 152;
 		p->rotscrnang -= 24;
@@ -3248,6 +3250,7 @@
         k = sintable[p->bobcounter&2047]>>12;
 
         if(truefdist < PHEIGHT+(8<<8) )
+        {
             if( k == 1 || k == 3 )
         {
             if(p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
@@ -3277,9 +3280,14 @@
                 }
             }
         }
-        else if(p->walking_snd_toggle > 0)
-            p->walking_snd_toggle --;
-
+        else{
+            if(p->walking_snd_toggle > 0)
+            {
+              p->walking_snd_toggle --;
+            }
+        }
+        }
+        
         if(p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
             doubvel <<= 1;
 
--- a/Game/src/premap.c
+++ b/Game/src/premap.c
@@ -419,7 +419,6 @@
 void resetplayerstats(short snum)
 {
     struct player_struct *p;
-    short i;
 
     p = &ps[snum];
 
@@ -1358,7 +1357,7 @@
 
 void dofrontscreens(void)
 {
-    long tincs,i,j;
+    long i,j;
 
     if(ud.recstat != 2)
     {
@@ -1443,7 +1442,7 @@
 
 void enterlevel(char g)
 {
-    short i,j;
+    short i;
     long l;
     char levname[256];
 	char fulllevelfilename[512];
--- a/Game/src/sector.c
+++ b/Game/src/sector.c
@@ -207,6 +207,9 @@
     return(FindDistance2D(vx,vy) + 1);
 }
 
+// Declaration here just to shut down compiler warning:
+// The linker was able to find it :/ regardless !
+int FindDistance3D(int ix, int iy, int iz);
 long dist(spritetype *s1,spritetype *s2)
 {
     long vx,vy,vz;
@@ -879,7 +882,7 @@
                 i = nextspritestat[i];
             }
 			
-#pragma message ( "Why would this ever be -1?" )
+            //Why would this ever be -1?
 			if(i < 0)
 			{
 				return;
@@ -1015,7 +1018,7 @@
 
 void operateactivators(short low,short snum)
 {
-    short i, j, k, *p, nexti;
+    short i, j, k, *p;
     walltype *wal;
 
     for(i=numcyclers-1;i>=0;i--)
@@ -1477,7 +1480,7 @@
                 x = headspritestat[3];
                 while(x >= 0)
                 {
-                   if( ((sprite[x].hitag) == lotag) )
+                   if( (sprite[x].hitag) == lotag )
                    {
                        switch(sprite[x].lotag)
                        {
@@ -1564,10 +1567,8 @@
 void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith)
 {
     short j, i, sn = -1, darkestwall;
-    signed char nfloors,nceilings;
-    short nextj;
     walltype *wal;
-    spritetype *s;
+   
 
     wal = &wall[dawallnum];
 
@@ -1870,10 +1871,10 @@
 
 char checkhitceiling(short sn)
 {
-    short i, j, q, darkestwall, darkestceiling;
-    signed char nfloors,nceilings;
-    walltype *wal;
+    short i, j;
 
+  
+
     switch(sector[sn].ceilingpicnum)
     {
         case WALLLIGHT1:
@@ -1945,7 +1946,7 @@
 
 void checkhitsprite(short i,short sn)
 {
-    short j, k, l, nextj, p;
+    short j, k, p;
     spritetype *s;
 
     i &= (MAXSPRITES-1);
--- a/Game/src/sounds.c
+++ b/Game/src/sounds.c
@@ -228,7 +228,6 @@
 
 void intomenusounds(void)
 {
-    short i;
     static const short menusnds[] =
     {
         LASERTRIP_EXPLODE,
@@ -626,7 +625,7 @@
     }
 }
 
-void TestCallBack(unsigned long num)
+void TestCallBack(long num)
 {
     short tempi,tempj,tempk;
 
--- a/Game/src/types.h
+++ b/Game/src/types.h
@@ -45,8 +45,8 @@
 typedef uint16                  word;
 typedef short int               int16;
 
-typedef unsigned long           uint32;
-typedef long                    int32;
+typedef unsigned int           uint32;
+typedef int                    int32;
 typedef uint32                  dword;
 
 typedef int32                   fixed;