shithub: duke3d

Download patch

ref: 9e77c6995cae212a482c784fbe2529e0f7b2b636
parent: 070639d0341621328542c7c64a12a9d88da6bbcb
author: Fabien Sanglard <[email protected]>
date: Mon Dec 17 12:00:46 EST 2012

Removed even more basic type in favor of stdint.h types.

--- a/Engine/src/a.c
+++ b/Engine/src/a.c
@@ -266,7 +266,7 @@
 	
 		if (temp != 255)
 		{
-			unsigned short val;
+			uint16_t val;
 			val = ((uint8_t  *)i2)[temp];
 			val |= ((*dest)<<8);
 			if (transrev) 
@@ -315,7 +315,7 @@
 		i4 = ((uint8_t  *)tran2bufb)[i2];
 		if (i3 == 255) { // skipdraw1
 			if (i4 != 255) { // skipdraw3
-				unsigned short val;
+				uint16_t val;
 				val = ((uint8_t  *)tran2pal_ecx)[i4];
 				val |= (((uint8_t  *)i6)[tran2edi1]<<8);
 
@@ -326,7 +326,7 @@
 					((uint8_t  *)i6)[tran2edi1] = ((uint8_t  *)tmach)[val];
 			}
 		} else if (i4 == 255) { // skipdraw2
-			unsigned short val;
+			uint16_t val;
 			val = ((uint8_t  *)tran2pal_ebx)[i3];
 			val |= (((uint8_t  *)i6)[tran2edi]<<8);
 
@@ -336,8 +336,8 @@
 			if (pixelsAllowed-- > 0)
 				((uint8_t  *)i6)[tran2edi] = ((uint8_t  *)tmach)[val];
 		} else {
-			unsigned short l = ((uint8_t  *)i6)[tran2edi]<<8;
-			unsigned short r = ((uint8_t  *)i6)[tran2edi1]<<8;
+			uint16_t l = ((uint8_t  *)i6)[tran2edi]<<8;
+			uint16_t r = ((uint8_t  *)i6)[tran2edi1]<<8;
 			l |= ((uint8_t  *)tran2pal_ebx)[i3];
 			r |= ((uint8_t  *)tran2pal_ecx)[i4];
 			if (transrev) {
@@ -599,7 +599,7 @@
 			// tstartsvline
 			if (i1 != 0xff)
 			{
-				unsigned short val;
+				uint16_t val;
 				val = ((uint8_t *)tspal)[i1];
 				val |= ((*((uint8_t  *)i6))<<8);
 
@@ -695,7 +695,7 @@
 	    i1 = ((uint8_t  *)tmach_eax)[ebx];
 	    if ((i1&0xff) != 0xff)
 	    {
-		    unsigned short val = (((uint8_t *)tmach_asm3)[i1]);
+		    uint16_t val = (((uint8_t *)tmach_asm3)[i1]);
 		    val |= (*((uint8_t  *)i6)<<8);
 
 		    if (transrev) 
--- a/Engine/src/build.h
+++ b/Engine/src/build.h
@@ -149,7 +149,7 @@
 EXTERN walltype wall[MAXWALLS];
 EXTERN spritetype sprite[MAXSPRITES];
 
-EXTERN unsigned short mapCRC;
+EXTERN uint16_t mapCRC;
 
 EXTERN int32_t spritesortcnt;
 EXTERN spritetype tsprite[MAXSPRITESONSCREEN];
--- a/Engine/src/cache1d.c
+++ b/Engine/src/cache1d.c
@@ -415,7 +415,7 @@
 
 #define POLY 0x8408   /* 1021H bit reversed */
 
-unsigned short crc16(uint8_t  *data_p, unsigned short length)
+uint16_t crc16(uint8_t  *data_p, uint16_t length)
 {
       uint8_t  i;
       unsigned int data;
--- a/Engine/src/cache1d.h
+++ b/Engine/src/cache1d.h
@@ -27,7 +27,7 @@
 void reportandexit(char  *errormessage);
 int32_t initgroupfile(const char  *filename);
 void uninitgroupfile(void);
-unsigned short crc16(uint8_t  *data_p, unsigned short length);
+uint16_t crc16(uint8_t  *data_p, uint16_t length);
 unsigned int crc32_update(uint8_t  *buf, unsigned int length, unsigned int crc_to_update);
 int32_t kopen4load(const char  *filename, int readfromGRP);
 int32_t kread(int32_t handle, void *buffer, int32_t leng);
--- a/Engine/src/enet/include/types.h
+++ b/Engine/src/enet/include/types.h
@@ -12,7 +12,7 @@
 #endif
 
 typedef uint8_t enet_uint8;       /**< unsigned 8-bit type  */
-typedef unsigned short enet_uint16;     /**< unsigned 16-bit type */
+typedef uint16_t enet_uint16;     /**< unsigned 16-bit type */
 typedef unsigned int enet_uint32;      /**< unsigned 32-bit type */
 
 #endif /* __ENET_TYPES_H__ */
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -84,7 +84,7 @@
 int32_t artsize = 0, cachesize = 0;
 
 static short radarang[1280], radarang2[MAXXDIM+1];
-static unsigned short sqrtable[4096], shlookup[4096+256];
+static uint16_t sqrtable[4096], shlookup[4096+256];
 uint8_t  pow2char[8] = {1,2,4,8,16,32,64,-128};
 int32_t pow2long[32] =
 {
@@ -268,15 +268,15 @@
 
 int32_t totalclocklock;
 
-unsigned short mapCRC;
+uint16_t mapCRC;
 
 #include "a.h"
 
 static __inline int32_t nsqrtasm(uint32_t  param)
 {
-    unsigned short *shlookup_a = (unsigned short*)shlookup;
-    unsigned short *sqrtable_a = (unsigned short*)sqrtable;
-    unsigned short cx;
+    uint16_t *shlookup_a = (uint16_t*)shlookup;
+    uint16_t *sqrtable_a = (uint16_t*)sqrtable;
+    uint16_t cx;
 
     if (param & 0xff000000)
         cx = shlookup_a[(param>>24)+4096];
@@ -319,7 +319,7 @@
     return(krecipasm(num));
 }
 
-unsigned short _swap16(unsigned short D)
+uint16_t _swap16(uint16_t D)
 {
     return((D<<8)|(D>>8));
 }
@@ -3330,7 +3330,7 @@
             j <<= 2;
             k++;
         }
-        sqrtable[i] = (unsigned short)(msqrtasm((i<<18)+131072)<<1);
+        sqrtable[i] = (uint16_t)(msqrtasm((i<<18)+131072)<<1);
         shlookup[i] = (k<<1)+((10-k)<<8);
         if (i < 256) shlookup[i+4096] = ((k+6)<<1)+((10-(k+6))<<8);
     }
--- a/Engine/src/engine_protos.h
+++ b/Engine/src/engine_protos.h
@@ -66,7 +66,7 @@
 extern void _nextpage(void);
 extern uint8_t  readpixel(int32_t offset);
 extern void drawpixel(int32_t offset, uint8_t  pixel);
-extern void drawpixels(int32_t offset, unsigned short pixels);
+extern void drawpixels(int32_t offset, uint16_t pixels);
 extern void drawpixelses(int32_t offset, unsigned int pixelses);
 extern void setcolor16(int col);
 extern void drawpixel16(int32_t offset);
--- a/Engine/src/platform.h
+++ b/Engine/src/platform.h
@@ -21,7 +21,7 @@
 #define snprintf _snprintf
 #endif
 
-unsigned short _swap16(unsigned short D);
+uint16_t _swap16(uint16_t D);
 unsigned int _swap32(unsigned int D);
 #if defined(PLATFORM_MACOSX) && defined(__ppc__)
 #define PLATFORM_BIGENDIAN 1
--- a/Engine/src/sdl_driver.c
+++ b/Engine/src/sdl_driver.c
@@ -1816,7 +1816,7 @@
 
 
 /* !!! These are incorrect. */
-void drawpixels(int32_t offset, unsigned short pixels)
+void drawpixels(int32_t offset, uint16_t pixels)
 {
     Uint8 *surface_end;
     Uint16 *pos;
@@ -1892,7 +1892,7 @@
         offset = 0;
 
     if (wanted_end > surface_end)
-        blocksize = ((unsigned long) surface_end) - ((unsigned long) pixels + offset);
+        blocksize = ((uint32_t) surface_end) - ((uint32_t) pixels + offset);
 
     memset(pixels + offset, (int) color, blocksize);
 
--- a/Game/src/actors.c
+++ b/Game/src/actors.c
@@ -3141,7 +3141,7 @@
     int32_t x, m, l, *t;
     short a, i, j, nexti, nextj, sect, p;
     spritetype *s;
-    unsigned short k;
+    uint16_t k;
 
     i = headspritestat[1];
     while(i >= 0)
--- a/Game/src/audiolib/dpmi.h
+++ b/Game/src/audiolib/dpmi.h
@@ -31,6 +31,12 @@
 #ifndef __DPMI_H
 #define __DPMI_H
 
+#ifdef _WIN32
+#include "../../../Engine/src/windows/inttypes.h"
+#else
+#include <inttypes.h>
+#endif
+
 enum DPMI_Errors
    {
    DPMI_Warning = -2,
@@ -40,27 +46,27 @@
 
 typedef struct
    {
-   unsigned long  EDI;
-   unsigned long  ESI;
-   unsigned long  EBP;
-   unsigned long  Reserved;
-   unsigned long  EBX;
-   unsigned long  EDX;
-   unsigned long  ECX;
-   unsigned long  EAX;
-   unsigned short Flags;
-   unsigned short ES;
-   unsigned short DS;
-   unsigned short FS;
-   unsigned short GS;
-   unsigned short IP;
-   unsigned short CS;
-   unsigned short SP;
-   unsigned short SS;
+   uint32_t  EDI;
+   uint32_t  ESI;
+   uint32_t  EBP;
+   uint32_t  Reserved;
+   uint32_t  EBX;
+   uint32_t  EDX;
+   uint32_t  ECX;
+   uint32_t  EAX;
+   uint32_t Flags;
+   uint32_t ES;
+   uint32_t DS;
+   uint32_t FS;
+   uint32_t GS;
+   uint32_t IP;
+   uint16_t CS;
+   uint16_t SP;
+   uint16_t SS;
    } dpmi_regs;
 
-unsigned long DPMI_GetRealModeVector( int num );
-void DPMI_SetRealModeVector( int num, unsigned long vector );
+uint32_t DPMI_GetRealModeVector( int num );
+
 int  DPMI_CallRealModeFunction( dpmi_regs *callregs );
 int  DPMI_GetDOSMemory( void **ptr, int *descriptor, unsigned length );
 int  DPMI_FreeDOSMemory( int descriptor );
@@ -74,29 +80,5 @@
 
 #define DPMI_Unlock( variable ) \
    ( DPMI_UnlockMemory( &( variable ), sizeof( variable ) ) )
-
-#ifdef PLAT_DOS
-#pragma aux DPMI_GetDOSMemory = \
-   "mov    eax, 0100h",         \
-   "add    ebx, 15",            \
-   "shr    ebx, 4",             \
-   "int    31h",                \
-   "jc     DPMI_Exit",          \
-   "movzx  eax, ax",            \
-   "shl    eax, 4",             \
-   "mov    [ esi ], eax",       \
-   "mov    [ edi ], edx",       \
-   "sub    eax, eax",           \
-   "DPMI_Exit:",                \
-   parm [ esi ] [ edi ] [ ebx ] modify exact [ eax ebx edx ];
-
-#pragma aux DPMI_FreeDOSMemory = \
-   "mov    eax, 0101h",          \
-   "int    31h",                 \
-   "jc     DPMI_Exit",           \
-   "sub    eax, eax",            \
-   "DPMI_Exit:",                 \
-   parm [ edx ] modify exact [ eax ];
-#endif
 
 #endif
--- a/Game/src/audiolib/dsl.c
+++ b/Game/src/audiolib/dsl.c
@@ -221,11 +221,11 @@
 	return _SampleRate;
 }
 
-unsigned long DisableInterrupts( void )
+uint32_t DisableInterrupts( void )
 {
 	return 0;
 }
 
-void RestoreInterrupts( unsigned long flags )
+void RestoreInterrupts( uint32_t flags )
 {
 }
--- a/Game/src/audiolib/multivoc.c
+++ b/Game/src/audiolib/multivoc.c
@@ -673,7 +673,7 @@
             // Repeat begin
             if ( voice->LoopEnd == NULL )
                {
-               voice->LoopCount = *( unsigned short * )ptr;
+               voice->LoopCount = *( uint16_t * )ptr;
                voice->LoopStart = ptr + blocklength;
                }
             ptr += blocklength;
@@ -706,7 +706,7 @@
          case 8 :
             // Extended block
             voice->bits  = 8;
-            tc = *( unsigned short * )ptr;
+            tc = *( uint16_t * )ptr;
             packtype = *( ptr + 2 );
             voicemode = *( ptr + 3 );
             ptr += blocklength;
@@ -718,7 +718,7 @@
             samplespeed = *( unsigned long * )ptr;
             BitsPerSample = ( unsigned )*( ptr + 4 );
             Channels = ( unsigned )*( ptr + 5 );
-            Format = ( unsigned )*( unsigned short * )( ptr + 6 );
+            Format = ( unsigned )*( uint16_t * )( ptr + 6 );
 
             if ( ( BitsPerSample == 8 ) && ( Channels == 1 ) &&
                ( Format == VOC_8BIT ) )
@@ -2567,7 +2567,7 @@
    voice->wavetype    = VOC;
    voice->bits        = 8;
    voice->GetSound    = MV_GetNextVOCBlock;
-   voice->NextBlock   = ptr + *( unsigned short int * )( ptr + 0x14 );
+   voice->NextBlock   = ptr + *( uint16_t  * )( ptr + 0x14 );
    voice->DemandFeed  = NULL;
    voice->LoopStart   = NULL;
    voice->LoopCount   = 0;
--- a/Game/src/audiolib/music.h
+++ b/Game/src/audiolib/music.h
@@ -58,8 +58,8 @@
 
 typedef struct
    {
-   unsigned long tickposition;
-   unsigned long milliseconds;
+   uint32_t tickposition;
+   uint32_t milliseconds;
    unsigned int  measure;
    unsigned int  beat;
    unsigned int  tick;
--- a/Game/src/audiolib/mv_mix.c
+++ b/Game/src/audiolib/mv_mix.c
@@ -1,7 +1,7 @@
 #include "multivoc.h"
 
 extern char  *MV_MixDestination;
-extern unsigned long MV_MixPosition;
+extern uint32_t MV_MixPosition;
 extern int *MV_GLast, *MV_GPos, *MV_GVal;
 
 extern int MV_LeftVolume;
@@ -113,8 +113,8 @@
 	return do_cubic ? (MV_cubic(position) >> 8) + 0x80 : (gval(3) >> 8) + 0x80;
 }
 
-void MV_Mix8BitMono( unsigned long position, unsigned long rate,
-   const char *start, unsigned long length )
+void MV_Mix8BitMono( uint32_t position, uint32_t rate,
+   const char *start, uint32_t length )
 {
 	const unsigned char *src;
 	unsigned char *dest;
@@ -141,8 +141,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_Mix8BitStereo( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_Mix8BitStereo( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const unsigned char *src;
 	unsigned char *dest;
@@ -175,8 +175,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_Mix16BitMono( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_Mix16BitMono( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const unsigned char *src;
 	short *dest;
@@ -203,8 +203,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_Mix16BitStereo( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_Mix16BitStereo( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const unsigned char *src;
 	short *dest;
@@ -237,8 +237,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_Mix8BitMono16( unsigned long position, unsigned long rate,
-   const char *start, unsigned long length )
+void MV_Mix8BitMono16( uint32_t position, uint32_t rate,
+   const char *start, uint32_t length )
 {
 	const short *src;
 	unsigned char *dest;
@@ -265,8 +265,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_Mix8BitStereo16( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_Mix8BitStereo16( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const short *src;
 	unsigned char *dest;
@@ -299,8 +299,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_Mix16BitMono16( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_Mix16BitMono16( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const short *src;
 	short *dest;
@@ -327,8 +327,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_Mix16BitStereo16( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_Mix16BitStereo16( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const short *src;
 	short *dest;
@@ -361,8 +361,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_MixFPMono8( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_MixFPMono8( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const unsigned char *src;
 	double *dest;
@@ -387,8 +387,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_MixFPStereo8( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_MixFPStereo8( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const unsigned char *src;
 	double *dest;
@@ -417,8 +417,8 @@
 
 }
 
-void MV_MixFPMono16( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_MixFPMono16( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const short *src;
 	double *dest;
@@ -443,8 +443,8 @@
 	MV_MixDestination = (char *)dest;
 }
 
-void MV_MixFPStereo16( unsigned long position,
-   unsigned long rate, const char *start, unsigned long length )
+void MV_MixFPStereo16( uint32_t position,
+   uint32_t rate, const char *start, uint32_t length )
 {
 	const short *src;
 	double *dest;
--- a/Game/src/audiolib/nodpmi.c
+++ b/Game/src/audiolib/nodpmi.c
@@ -41,7 +41,7 @@
    Returns the vector of a real mode interrupt.
 ---------------------------------------------------------------------*/
 
-unsigned long DPMI_GetRealModeVector
+uint32_t DPMI_GetRealModeVector
    (
    int num
    )
@@ -51,20 +51,7 @@
    }
 
 
-/*---------------------------------------------------------------------
-   Function: DPMI_SetRealModeVector
 
-   Sets the vector of a real mode interrupt.
----------------------------------------------------------------------*/
-
-void DPMI_SetRealModeVector
-   (
-   int num,
-   unsigned long vector
-   )
-
-   {
-   }
 
 
 /*---------------------------------------------------------------------
--- a/Game/src/audiolib/pitch.c
+++ b/Game/src/audiolib/pitch.c
@@ -36,7 +36,7 @@
 
 #define MAXDETUNE 25
 
-static unsigned long PitchTable[ 12 ][ MAXDETUNE ] =
+static uint32_t PitchTable[ 12 ][ MAXDETUNE ] =
    {
       { 0x10000, 0x10097, 0x1012f, 0x101c7, 0x10260, 0x102f9, 0x10392, 0x1042c,
       0x104c6, 0x10561, 0x105fb, 0x10696, 0x10732, 0x107ce, 0x1086a, 0x10907,
@@ -139,13 +139,13 @@
    Returns a fixed-point value to scale number the specified amount.
 ---------------------------------------------------------------------*/
 
-unsigned long PITCH_GetScale
+uint32_t PITCH_GetScale
    (
    int pitchoffset
    )
 
    {
-   unsigned long scale;
+   uint32_t scale;
    int octaveshift;
    int noteshift;
    int note;
--- a/Game/src/audiolib/pitch.h
+++ b/Game/src/audiolib/pitch.h
@@ -31,6 +31,8 @@
 #ifndef __PITCH_H
 #define __PITCH_H
 
+#include "../duke3d.h"
+
 enum PITCH_ERRORS
    {
    PITCH_Warning = -2,
@@ -39,7 +41,7 @@
    };
 
 //void          PITCH_Init( void );
-unsigned long PITCH_GetScale( int pitchoffset );
+uint32_t PITCH_GetScale( int pitchoffset );
 void          PITCH_UnlockMemory( void );
 int           PITCH_LockMemory( void );
 #endif
--- a/Game/src/audiolib/usrhooks.h
+++ b/Game/src/audiolib/usrhooks.h
@@ -33,6 +33,8 @@
 #ifndef __USRHOOKS_H
 #define __USRHOOKS_H
 
+#include "../duke3d.h"
+
 /*---------------------------------------------------------------------
    Error definitions
 ---------------------------------------------------------------------*/
@@ -49,7 +51,7 @@
    Function Prototypes
 ---------------------------------------------------------------------*/
 
-int USRHOOKS_GetMem( void **ptr, unsigned long size );
+int USRHOOKS_GetMem( void **ptr, uint32_t size );
 int USRHOOKS_FreeMem( void *ptr );
 
 #endif
--- a/Game/src/duke3d.h
+++ b/Game/src/duke3d.h
@@ -331,6 +331,10 @@
     int voice;
 } SOUNDOWNER;
 
+#include "audiolib/usrhooks.h"
+/*
+
+
 #define __USRHOOKS_H
 
 enum USRHOOKS_Errors
@@ -339,6 +343,7 @@
    USRHOOKS_Error   = -1,
    USRHOOKS_Ok      = 0
    };
+*/
 
 #pragma pack(push)
 #pragma pack(1)
@@ -418,7 +423,7 @@
 	uint8_t  playing_demo_rev;
 
 	uint32_t groupefil_crc32[MAXPLAYERS][MAXGROUPFILES];
-	unsigned short conSize[MAXPLAYERS];
+	uint16_t conSize[MAXPLAYERS];
 
 #ifdef CHECK_XDUKE_REV
 	uint8_t  rev[MAXPLAYERS][10];
--- a/Game/src/funct.h
+++ b/Game/src/funct.h
@@ -39,21 +39,21 @@
 //#line "sounds.c" 166
 extern void MusicShutdown(void );
 //#line "sounds.c" 181
-extern int USRHOOKS_GetMem(uint8_t  **ptr,uint32_t size);
+extern int USRHOOKS_GetMem(void  **ptr,uint32_t size);
 //#line "sounds.c" 192
-extern int USRHOOKS_FreeMem(uint8_t  *ptr);
+extern int USRHOOKS_FreeMem(void  *ptr);
 //#line "sounds.c" 200
 extern void intomenusounds(void );
 //#line "sounds.c" 227
 extern void playmusic(char  *fn);
 //#line "sounds.c" 251
-extern uint8_t  loadsound(unsigned short num);
+extern uint8_t  loadsound(uint16_t num);
 //#line "sounds.c" 277
 extern int xyzsound(short num,short i,int32_t x,int32_t y,int32_t z);
 //#line "sounds.c" 407
 extern void sound(short num);
 //#line "sounds.c" 463
-extern int spritesound(unsigned short num,short i);
+extern int spritesound(uint16_t num,short i);
 //#line "sounds.c" 469
 extern void stopsound(short num);
 //#line "sounds.c" 478
@@ -172,7 +172,7 @@
 //#line "premap.c" 1131
 extern uint8_t  checksum(int32_t sum);
 //#line "premap.c" 1163
-extern uint8_t  getsound(unsigned short num);
+extern uint8_t  getsound(uint16_t num);
 //#line "premap.c" 1189
 extern void precachenecessarysounds(void );
 //#line "premap.c" 1201
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -89,7 +89,7 @@
 int32 CommandMusicToggleOff = 0;
 
 // For addfaz's stun server. use /stun to activate
-unsigned short g_bStun = 0;
+uint16_t g_bStun = 0;
 
 char confilename[128] = {"GAME.CON"};
 char boardfilename[128] = {0};
@@ -754,7 +754,7 @@
 #endif
 
 			case 132: // get map CRC of opponents (to debug out of synch) 
-				ud.mapCRC[other] = (unsigned short)packbuf[1] + (unsigned short)(packbuf[2]<<8);
+				ud.mapCRC[other] = (uint16_t)packbuf[1] + (uint16_t)(packbuf[2]<<8);
 				break;
 
 			case 133: // client refused to disable the autoaim by host
--- a/Game/src/gamedef.c
+++ b/Game/src/gamedef.c
@@ -1597,7 +1597,7 @@
     else
     {
         total_lines += line_number;
-        printf("Code Size:%ld bytes(%d labels).\n",(int32_t)((scriptptr-script)<<2)-4,labelcnt);
+        printf("Code Size:%d bytes(%d labels).\n",(int32_t)((scriptptr-script)<<2)-4,labelcnt);
 		ud.conSize[0] = (int32_t)(scriptptr-script)-1;
 
 		// FIX_00062: Better support and identification for GRP and CON files for 1.3/1.3d/1.4/1.5
--- a/Game/src/premap.c
+++ b/Game/src/premap.c
@@ -231,7 +231,7 @@
             tloadtile(i);
 }
 
-uint8_t  getsound(unsigned short num)
+uint8_t  getsound(uint16_t num)
 {
     short fp;
     int32_t   l;
--- a/Game/src/sounds.c
+++ b/Game/src/sounds.c
@@ -208,7 +208,8 @@
       }
    }
 
-int USRHOOKS_GetMem(uint8_t  **ptr, uint32_t size )
+
+int USRHOOKS_GetMem(void  **ptr, uint32_t size )
 {
    *ptr = malloc(size);
 
@@ -219,7 +220,7 @@
 
 }
 
-int USRHOOKS_FreeMem(uint8_t  *ptr)
+int USRHOOKS_FreeMem(void  *ptr)
 {
    free(ptr);
    return( USRHOOKS_Ok);
@@ -262,7 +263,7 @@
     PlayMusic(fn);
 }
 
-uint8_t  loadsound(unsigned short num)
+uint8_t  loadsound(uint16_t num)
 {
     int32_t   fp, l;
 
@@ -400,11 +401,11 @@
 
     if( soundm[num]&1 )
     {
-        unsigned short start;
+        uint16_t start;
 
         if(Sound[num].num > 0) return -1;
 
-        start = *(unsigned short *)(Sound[num].ptr + 0x14);
+        start = *(uint16_t *)(Sound[num].ptr + 0x14);
 
         if(*Sound[num].ptr == 'C')
             voice = FX_PlayLoopedVOC( Sound[num].ptr, start, start + soundsiz[num],
@@ -466,13 +467,13 @@
     {
         if(*Sound[num].ptr == 'C')
         {
-            start = (int32_t)*(unsigned short *)(Sound[num].ptr + 0x14);
+            start = (int32_t)*(uint16_t *)(Sound[num].ptr + 0x14);
             voice = FX_PlayLoopedVOC( Sound[num].ptr, start, start + soundsiz[num],
                     pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,soundpr[num],num);
         }
         else
         {
-            start = (int32_t)*(unsigned short *)(Sound[num].ptr + 0x14);
+            start = (int32_t)*(uint16_t *)(Sound[num].ptr + 0x14);
             voice = FX_PlayLoopedWAV( Sound[num].ptr, start, start + soundsiz[num],
                     pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,soundpr[num],num);
         }
@@ -489,7 +490,7 @@
     Sound[num].lock--;
 }
 
-int spritesound(unsigned short num, short i)
+int spritesound(uint16_t num, short i)
 {
     if(num >= NUM_SOUNDS) return -1;
     return xyzsound(num,i,SX,SY,SZ);
--- a/Game/src/types.h
+++ b/Game/src/types.h
@@ -48,7 +48,7 @@
 typedef uint8                   byte;
 typedef int8_t             int8;
 
-typedef unsigned short int      uint16;
+typedef uint16_t            uint16;
 typedef uint16                  word;
 typedef short int               int16;
 
@@ -57,7 +57,7 @@
 typedef uint32                  dword;
 
 typedef int32                   fixed;
-typedef uint8_t                     boolean;
+#define boolean uint8_t
 typedef float                   float32;
 typedef double                  float64;
 typedef int64_t                 float128;