ref: 1d8bd38ea323126549d48553b1a2b9ceca62954e
parent: 9c586ce4ea2a831d7f88c93ec8b38184a42abda4
author: Fabien Sanglard <[email protected]>
date: Sun Dec 16 21:33:42 EST 2012
Removed 200 warnings due to uint8_t -> replace conversion and also print parameter values.
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -2589,7 +2589,7 @@
//Return 1 if bunch firstBunchID is in from of bunch secondBunchID.
static int bunchfront(int32_t firstBunchID, int32_t secondBunchID)
{
- int32_t x1b1, x2b1, x1b2, x2b2, b2f;
+ int32_t x1b1, x2b1, x1b2, x2b2;
x1b1 = xb1[bunchfirst[firstBunchID]];
@@ -7573,7 +7573,7 @@
* other cause flicker, so I have this function here so the shadow can
* be drawn with _noupdate, and the actual string is draw with an update.
*/
-static void __printext256(int32_t xpos, int32_t ypos, short col, short backcol, uint8_t name[82], uint8_t fontsize, int should_update)
+static void __printext256(int32_t xpos, int32_t ypos, short col, short backcol, char name[82], uint8_t fontsize, int should_update)
{
int32_t stx, i, x, y, charxsiz;
uint8_t *fontptr, *letptr, *ptr;
--- a/Engine/src/sdl_driver.c
+++ b/Engine/src/sdl_driver.c
@@ -272,7 +272,7 @@
RENDERER_TOTAL
} sdl_renderer_type;
-const uint8_t *renderer_name[RENDERER_TOTAL];
+const char *renderer_name[RENDERER_TOTAL];
#define ENVRSTR_RENDERER_SOFTWARE "software"
#define ENVRSTR_RENDERER_OPENGL3D "opengl3d"
@@ -1110,7 +1110,7 @@
void _platform_init(int argc, char **argv, const char *title, const char *iconName)
{
int i;
- int32_t timeElapsed;
+ int64_t timeElapsed;
char dummyString[4096];
_argc = argc;
@@ -1352,7 +1352,7 @@
if (daxdim > MAXXDIM || daydim > MAXYDIM)
{
- printf("%ld x %ld is too big. Changed to %d x %d\n", daxdim, daydim, MAXXDIM,MAXYDIM);
+ printf("%d x %d is too big. Changed to %d x %d\n", daxdim, daydim, MAXXDIM,MAXYDIM);
daxdim = MAXXDIM;
daydim = MAXYDIM;
}
@@ -1368,7 +1368,7 @@
if(!validated)
{
- printf("%ld x %ld unsupported. Changed to 640 x 480\n", daxdim, daydim);
+ printf("%d x %d unsupported. Changed to 640 x 480\n", daxdim, daydim);
daxdim = 640;
daydim = 480;
}
@@ -1422,7 +1422,7 @@
{
int32_t w = DEFAULT_MAXRESWIDTH;
int32_t h = DEFAULT_MAXRESHEIGHT;
- const uint8_t *envr = getenv(BUILD_MAXSCREENRES);
+ const char *envr = getenv(BUILD_MAXSCREENRES);
if (envr != NULL)
{
@@ -1442,7 +1442,7 @@
} /* get_max_screen_res */
-static void add_vesa_mode(const uint8_t *typestr, int w, int h)
+static void add_vesa_mode(const char *typestr, int w, int h)
{
sdldebug("Adding %s resolution (%dx%d).", typestr, w, h);
validmode[validmodecnt] = validmodecnt;
--- a/Game/src/_rts.h
+++ b/Game/src/_rts.h
@@ -39,7 +39,7 @@
typedef struct
{
- uint8_t identification[4]; // should be IWAD
+ char identification[4]; // should be IWAD
int32 numlumps;
int32 infotableofs;
} wadinfo_t;
--- a/Game/src/actors.c
+++ b/Game/src/actors.c
@@ -5171,8 +5171,8 @@
if(s->owner == -1)
{
- sprintf((uint8_t *)tempbuf,"Could not find any locators for SE# 6 and 14 with a hitag of %ld.\n",t[3]);
- gameexit((uint8_t *)tempbuf);
+ sprintf((char *)tempbuf,"Could not find any locators for SE# 6 and 14 with a hitag of %d.\n",t[3]);
+ gameexit((char *)tempbuf);
}
j = ldist(&sprite[s->owner],s);
--- a/Game/src/audiolib/fx_man.c
+++ b/Game/src/audiolib/fx_man.c
@@ -326,10 +326,7 @@
Sets the function to call when a voice is done.
---------------------------------------------------------------------*/
-int FX_SetCallBack
- (
- void ( *function )( int32_t )
- )
+int FX_SetCallBack(void ( *function )( int32_t ))
{
int status;
@@ -857,8 +854,8 @@
(
char *ptr,
uint32_t length,
- uint8_t *loopstart,
- uint8_t *loopend,
+ char *loopstart,
+ char *loopend,
uint32_t rate,
int32_t pitchoffset,
int32_t vol,
--- a/Game/src/audiolib/fx_man.h
+++ b/Game/src/audiolib/fx_man.h
@@ -123,8 +123,8 @@
int FX_PlayRaw( char *ptr, uint32_t length, uint32_t rate,
int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority,
uint32_t callbackval );
-int FX_PlayLoopedRaw( char *ptr, uint32_t length, uint8_t *loopstart,
- uint8_t *loopend, uint32_t rate, int32_t pitchoffset, int32_t vol, int32_t left,
+int FX_PlayLoopedRaw( char *ptr, uint32_t length, char *loopstart,
+ char *loopend, uint32_t rate, int32_t pitchoffset, int32_t vol, int32_t left,
int32_t right, int32_t priority, uint32_t callbackval );
int32_t FX_Pan3D( int handle, int angle, int distance );
int32_t FX_SoundActive( int32_t handle );
--- a/Game/src/audiolib/multivoc.c
+++ b/Game/src/audiolib/multivoc.c
@@ -449,7 +449,6 @@
{
VoiceNode *voice;
VoiceNode *next;
- char *buffer;
// Toggle which buffer we'll mix next
@@ -2667,35 +2666,8 @@
level.
---------------------------------------------------------------------*/
-void MV_CalcVolume
- (
- int MaxVolume
- )
-
+void MV_CalcVolume(int MaxVolume)
{
- int volume;
-
-#if 0
- for( volume = 0; volume < 128; volume++ )
- {
- MV_HarshClipTable[ volume ] = 0;
- MV_HarshClipTable[ volume + 384 ] = 255;
- }
- for( volume = 0; volume < 256; volume++ )
- {
- MV_HarshClipTable[ volume + 128 ] = volume;
- }
-#endif
-
- // For each volume level, create a translation table with the
- // appropriate volume calculated.
- // this is ugly
-#if 0
- for( volume = 0; volume <= MV_MaxVolume; volume++ )
- {
- MV_CreateVolumeTable( volume, volume, MaxVolume );
- }
-#endif
}
--- a/Game/src/audiolib/music.h
+++ b/Game/src/audiolib/music.h
@@ -94,5 +94,6 @@
void MUSIC_StopFade( void );
void MUSIC_RerouteMidiChannel( int channel, int cdecl ( *function )( int event, int c1, int c2 ) );
void MUSIC_RegisterTimbreBank( unsigned char *timbres );
-
+void PlayMusic(char* filename);
+
#endif
--- a/Game/src/config.c
+++ b/Game/src/config.c
@@ -698,7 +698,7 @@
for(dummy=0;dummy<10;dummy++)
{
- sprintf(buf,"WeaponChoice%ld",dummy);
+ sprintf(buf,"WeaponChoice%d",dummy);
SCRIPT_GetNumber( scripthandle, "Misc", buf, &ud.mywchoice[dummy]);
}
}
--- a/Game/src/cvar_defs.c
+++ b/Game/src/cvar_defs.c
@@ -17,6 +17,8 @@
#include "joystick.h"
+#include "audiolib/music.h"
+
// Bind our Cvars at startup. You can still add bindings after this call, but
// it is recommanded that you bind your default CVars here.
void CVARDEFS_Init()
@@ -211,7 +213,7 @@
{
if (i != myconnectindex)
//Send it to everyone
- sendpacket(i,&tempbuf[0],length);
+ sendpacket(i,(uint8_t*)tempbuf,length);
}
}
}
--- a/Game/src/duke3d.h
+++ b/Game/src/duke3d.h
@@ -632,7 +632,8 @@
extern short buttonstat;
extern int32_t cachecount;
-extern char boardfilename[128],waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768];
+extern uint8_t waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768];
+extern char boardfilename[128];
extern uint8_t betaname[80];
extern uint8_t cachedebug,earthquaketime;
extern uint8_t networkmode;
--- a/Game/src/funct.h
+++ b/Game/src/funct.h
@@ -131,7 +131,7 @@
//#line "rts.c" 141
extern int32 RTS_SoundLength(int32 lump);
//#line "rts.c" 157
-extern uint8_t *RTS_GetSoundName(int32 i);
+extern char *RTS_GetSoundName(int32 i);
//#line "rts.c" 174
extern void RTS_ReadLump(int32 lump,void *dest);
//#line "rts.c" 194
@@ -286,7 +286,7 @@
//#line "gamedef.c" 1227
extern void passone(int readfromGRP);
//#line "gamedef.c" 1239
-extern void loadefs(char *fn,uint8_t *mptr, int readfromGRP);
+extern void loadefs(char *fn,char *mptr, int readfromGRP);
//#line "gamedef.c" 1342
extern uint8_t dodge(spritetype *s);
//#line "gamedef.c" 1374
@@ -376,7 +376,7 @@
//#line "game.c" 1705
extern void gameexit(char *t);
//#line "game.c" 1752
-extern short strget(short x,short y,uint8_t *t,short dalen,short c);
+extern short strget(short x,short y,char *t,short dalen,short c);
//#line "game.c" 1819
extern void displayrest(int32_t smoothratio);
//#line "game.c" 2047
@@ -402,7 +402,7 @@
//#line "game.c" 5303
extern void nonsharedkeys(void );
//#line "game.c" 5863
-extern void comlinehelp(uint8_t **argv);
+extern void comlinehelp(char **argv);
//#line "game.c" 5889
extern void checkcommandline(int argc,char **argv);
//#line "game.c" 6078
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -54,6 +54,7 @@
#include <sys/stat.h>
+
// this is So lame
#include "cache1d.h"
@@ -91,7 +92,7 @@
char confilename[128] = {"GAME.CON"};
char boardfilename[128] = {0};
-char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768];
+uint8_t waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768];
char firstdemofile[80] = { '\0' };
#define patchstatusbar(x1,y1,x2,y2) \
@@ -393,7 +394,7 @@
#define MAXUSERQUOTES 4
int32_t quotebot, quotebotgoal;
short user_quote_time[MAXUSERQUOTES];
-uint8_t user_quote[MAXUSERQUOTES][128];
+char user_quote[MAXUSERQUOTES][128];
// uint8_t typebuflen,typebuf[41];
static void adduserquote(char *daquote)
@@ -410,9 +411,9 @@
pub = NUMPAGES;
}
-uint8_t *grpVersion2char_from_crc(unsigned int crc32_grp_to_identify)
+char *grpVersion2char_from_crc(unsigned int crc32_grp_to_identify)
{
- uint8_t *id;
+ char *id;
int i=0;
id = crc32lookup[MAX_KNOWN_GRP].name; // unknown version
@@ -426,7 +427,7 @@
return(id);
}
-uint8_t *grpVersion2char(uint8_t grp_to_identify)
+char *grpVersion2char(uint8_t grp_to_identify)
{
char *id;
@@ -594,7 +595,7 @@
break;
case 4: // message talk T
- strcpy(recbuf,packbuf+1);
+ strcpy(recbuf,(char*)packbuf+1);
recbuf[packbufleng-1] = 0;
adduserquote(recbuf);
@@ -729,7 +730,7 @@
if (j > packbufleng)
{
- printf("INVALID GAME PACKET!!! (%ld too many bytes) (j= %d, packbuflen= %d, type: %d)\n",j-packbufleng, j, packbufleng, packbuf[0]);
+ printf("INVALID GAME PACKET!!! (%d too many bytes) (j= %d, packbuflen= %d, type: %d)\n",j-packbufleng, j, packbufleng, packbuf[0]);
}
while (j != packbufleng)
@@ -781,7 +782,7 @@
void faketimerhandler()
{
- int32_t i, j, k, l;
+ int32_t i, j, k;
// short who;
input *osyn, *nsyn;
@@ -1101,7 +1102,7 @@
for(i=0;i<cacnum;i++)
if ((*cac[i].lock) >= 200)
{
- sprintf(tempbuf,"Locked- %ld: Leng:%ld, Lock:%ld",i,cac[i].leng,*cac[i].lock);
+ sprintf(tempbuf,"Locked- %d: Leng:%d, Lock:%d",i,cac[i].leng,*cac[i].lock);
printext256(0L,k,31,-1,tempbuf,1); k += 6;
}
@@ -1110,7 +1111,7 @@
for(i=1;i<11;i++)
if (lumplockbyte[i] >= 200)
{
- sprintf(tempbuf,"RTS Locked %ld:",i);
+ sprintf(tempbuf,"RTS Locked %hd:",i);
printext256(0L,k,31,-1,tempbuf,1); k += 6;
}
@@ -1151,7 +1152,7 @@
void checksync(void)
{
- int32_t i, k;
+ int32_t i;
for(i=connecthead;i>=0;i=connectpoint2[i])
if (syncvalhead[i] == syncvaltottail) break;
@@ -1452,7 +1453,7 @@
void weaponnum(short ind,int32_t x,int32_t y,int32_t num1, int32_t num2,uint8_t ha)
{
- uint8_t dabuf[80] = {0};
+ char dabuf[80] = {0};
rotatesprite((x-7)<<16,y<<16,65536L,0,THREEBYFIVE+ind+1,ha-10,7,10+128,0,0,xdim-1,ydim-1);
rotatesprite((x-3)<<16,y<<16,65536L,0,THREEBYFIVE+10,ha,0,10+128,0,0,xdim-1,ydim-1);
@@ -1461,7 +1462,7 @@
if(num1 > 99) num1 = 99;
if(num2 > 99) num2 = 99;
- sprintf(dabuf,"%ld",num1);
+ sprintf(dabuf,"%d",num1);
if(num1 > 9)
{
rotatesprite((x)<<16,y<<16,65536L,0,THREEBYFIVE+dabuf[0]-'0',ha,0,10+128,0,0,xdim-1,ydim-1);
@@ -1469,7 +1470,7 @@
}
else rotatesprite((x+4)<<16,y<<16,65536L,0,THREEBYFIVE+dabuf[0]-'0',ha,0,10+128,0,0,xdim-1,ydim-1);
- sprintf(dabuf,"%ld",num2);
+ sprintf(dabuf,"%d",num2);
if(num2 > 9)
{
rotatesprite((x+13)<<16,y<<16,65536L,0,THREEBYFIVE+dabuf[0]-'0',ha,0,10+128,0,0,xdim-1,ydim-1);
@@ -1480,13 +1481,13 @@
void weaponnum999(uint8_t ind,int32_t x,int32_t y,int32_t num1, int32_t num2,uint8_t ha)
{
- uint8_t dabuf[80] = {0};
+ char dabuf[80] = {0};
rotatesprite((x-7)<<16,y<<16,65536L,0,THREEBYFIVE+ind+1,ha-10,7,10+128,0,0,xdim-1,ydim-1);
rotatesprite((x-4)<<16,y<<16,65536L,0,THREEBYFIVE+10,ha,0,10+128,0,0,xdim-1,ydim-1);
rotatesprite((x+13)<<16,y<<16,65536L,0,THREEBYFIVE+11,ha,0,10+128,0,0,xdim-1,ydim-1);
- sprintf(dabuf,"%ld",num1);
+ sprintf(dabuf,"%d",num1);
if(num1 > 99)
{
rotatesprite((x)<<16,y<<16,65536L,0,THREEBYFIVE+dabuf[0]-'0',ha,0,10+128,0,0,xdim-1,ydim-1);
@@ -1500,7 +1501,7 @@
}
else rotatesprite((x+8)<<16,y<<16,65536L,0,THREEBYFIVE+dabuf[0]-'0',ha,0,10+128,0,0,xdim-1,ydim-1);
- sprintf(dabuf,"%ld",num2);
+ sprintf(dabuf,"%d",num2);
if(num2 > 99)
{
rotatesprite((x+17)<<16,y<<16,65536L,0,THREEBYFIVE+dabuf[0]-'0',ha,0,10+128,0,0,xdim-1,ydim-1);
@@ -1648,7 +1649,7 @@
void digitalnumber(int32_t x,int32_t y,int32_t n,uint8_t s,uint8_t cs)
{
short i, j, k, p, c;
- uint8_t b[10];
+ char b[10];
//
// uint8_t * ltoa(int32_t l, uint8_t * buffer, int radix);
@@ -1655,7 +1656,7 @@
// is NON-STANDARD and equivalent to STANDARD
// (void) sprintf(buffer, "%ld", l);
//ltoa(n,b,10);
- sprintf(b,"%ld",n);
+ sprintf(b,"%d",n);
i = strlen(b);
j = 0;
@@ -2227,27 +2228,27 @@
y = 16;
}
- sprintf(tempbuf,"X= %ld",ps[snum].posx);
+ sprintf(tempbuf,"X= %d",ps[snum].posx);
printext256(x,y,31,-1,tempbuf,1);
- sprintf(tempbuf,"Y= %ld",ps[snum].posy);
+ sprintf(tempbuf,"Y= %d",ps[snum].posy);
printext256(x,y+7L,31,-1,tempbuf,1);
- sprintf(tempbuf,"Z= %ld",ps[snum].posz);
+ sprintf(tempbuf,"Z= %d",ps[snum].posz);
printext256(x,y+14L,31,-1,tempbuf,1);
- sprintf(tempbuf,"A= %ld",ps[snum].ang);
+ sprintf(tempbuf,"A= %d",ps[snum].ang);
printext256(x,y+21L,31,-1,tempbuf,1);
- sprintf(tempbuf,"ZV= %ld",ps[snum].poszv);
+ sprintf(tempbuf,"ZV= %d",ps[snum].poszv);
printext256(x,y+28L,31,-1,tempbuf,1);
- sprintf(tempbuf,"OG= %ld",ps[snum].on_ground);
+ sprintf(tempbuf,"OG= %d",ps[snum].on_ground);
printext256(x,y+35L,31,-1,tempbuf,1);
- sprintf(tempbuf,"AM= %ld",ps[snum].ammo_amount[GROW_WEAPON]);
+ sprintf(tempbuf,"AM= %d",ps[snum].ammo_amount[GROW_WEAPON]);
printext256(x,y+43L,31,-1,tempbuf,1);
- sprintf(tempbuf,"LFW= %ld",ps[snum].last_full_weapon);
+ sprintf(tempbuf,"LFW= %d",ps[snum].last_full_weapon);
printext256(x,y+50L,31,-1,tempbuf,1);
- sprintf(tempbuf,"SECTL= %ld",sector[ps[snum].cursectnum].lotag);
+ sprintf(tempbuf,"SECTL= %d",sector[ps[snum].cursectnum].lotag);
printext256(x,y+57L,31,-1,tempbuf,1);
- sprintf(tempbuf,"SEED= %ld",randomseed);
+ sprintf(tempbuf,"SEED= %d",randomseed);
printext256(x,y+64L,31,-1,tempbuf,1);
- sprintf(tempbuf,"THOLD= %ld",ps[snum].transporter_hold);
+ sprintf(tempbuf,"THOLD= %d",ps[snum].transporter_hold);
printext256(x,y+64L+7,31,-1,tempbuf,1);
}
@@ -2384,8 +2385,7 @@
void gameexit(char *msg)
{
- short i;
- uint8_t t[256];
+ char t[256];
strncpy(t,msg,256); t[255] = 0;
@@ -2467,7 +2467,7 @@
short inputloc = 0;
-short strget(short x,short y,uint8_t *t,short dalen,short c)
+short strget(short x,short y,char *t,short dalen,short c)
{
short ch,sc;
@@ -2521,7 +2521,7 @@
if( c == 999 ) return(0);
if( c == 998 )
{
- uint8_t b[41],ii;
+ char b[41],ii;
for(ii=0;ii<inputloc;ii++)
b[ii] = '*';
b[ii] = 0;
@@ -2560,7 +2560,7 @@
{
for(ch=connecthead;ch >= 0;ch=connectpoint2[ch])
if (ch != myconnectindex)
- sendpacket(ch,tempbuf,j+1);
+ sendpacket(ch,(uint8_t*)tempbuf,j+1);
adduserquote(recbuf);
quotebot += 8;
@@ -2567,7 +2567,7 @@
quotebotgoal = quotebot;
}
else if(sendmessagecommand >= 0)
- sendpacket(sendmessagecommand,tempbuf,j+1);
+ sendpacket(sendmessagecommand,(uint8_t*)tempbuf,j+1);
sendmessagecommand = -1;
ps[myconnectindex].gm &= ~(MODE_TYPE|MODE_SENDTOWHOM);
@@ -2586,7 +2586,7 @@
}
else
{
- sprintf(buf," %ld - %s",i+1,ud.user_name[i]);
+ sprintf(buf," %d - %s",i+1,ud.user_name[i]);
minitextshade((320>>1)-40-6+1,j+1,buf,26,0,2+8+16);
minitext((320>>1)-40-6,j,buf,0,2+8+16); j += 7;
}
@@ -5156,7 +5156,7 @@
}
if(j == MAXSPRITES)
{
- sprintf(tempbuf,"Found lonely Sector Effector (lotag 0) at (%ld,%ld)\n",sp->x,sp->y);
+ sprintf(tempbuf,"Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y);
gameexit(tempbuf);
}
sp->owner = j;
@@ -5173,7 +5173,7 @@
tempwallptr++;
if(tempwallptr > 2047)
{
- sprintf(tempbuf,"Too many moving sectors at (%ld,%ld).\n",wall[s].x,wall[s].y);
+ sprintf(tempbuf,"Too many moving sectors at (%d,%d).\n",wall[s].x,wall[s].y);
gameexit(tempbuf);
}
}
@@ -5205,7 +5205,7 @@
if(j == 0)
{
- sprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%ld,%ld).\n",sp->x,sp->y);
+ sprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y);
gameexit(tempbuf);
}
@@ -6128,7 +6128,7 @@
uint8_t cheatbuf[10],cheatbuflen;
void cheats(void)
{
- short ch, i, j, k, keystate, weapon;
+ short ch, i, j, k, weapon;
if( (ps[myconnectindex].gm&MODE_TYPE) || (ps[myconnectindex].gm&MODE_MENU))
return;
@@ -6330,7 +6330,7 @@
tempbuf[10] = ud.m_ffire;
for(i=connecthead;i>=0;i=connectpoint2[i])
- sendpacket(i,tempbuf,11);
+ sendpacket(i,(uint8_t*)tempbuf,11);
}
else ps[myconnectindex].gm |= MODE_RESTART;
@@ -6576,7 +6576,7 @@
int32_t nonsharedtimer;
void nonsharedkeys(void)
{
- short i,ch, weapon;
+ short i,ch;
int32_t j;
if(ud.recstat == 2)
@@ -6736,7 +6736,7 @@
if(ud.multimode > 1)
for(ch=connecthead;ch>=0;ch=connectpoint2[ch])
if (ch != myconnectindex)
- sendpacket(ch,tempbuf,i);
+ sendpacket(ch,(uint8_t*)tempbuf,i);
pus = NUMPAGES;
pub = NUMPAGES;
@@ -6762,7 +6762,7 @@
for(ch=connecthead;ch>=0;ch=connectpoint2[ch])
if(ch != myconnectindex)
- sendpacket(ch,tempbuf,2);
+ sendpacket(ch,(uint8_t*)tempbuf,2);
}
pus = NUMPAGES;
@@ -7056,7 +7056,7 @@
-void comlinehelp(uint8_t **argv)
+void comlinehelp(char **argv)
{
printf("Command line help. %s [/flags...]\n",argv[0]);
puts(" ?, /? This help message");
@@ -7088,8 +7088,8 @@
void checkcommandline(int argc,char **argv)
{
short i, j;
- uint8_t *c;
- uint8_t kbdKey;
+ char *c;
+ char kbdKey;
ud.fta_on = 1;
ud.god = 0;
@@ -7219,7 +7219,7 @@
c++;
if(*c)
{
- uint8_t fullpathgrpfile[16]; // 16 not enough
+ char fullpathgrpfile[16]; // 16 not enough
memset(fullpathgrpfile, 0, 16);
if( strchr(c,'.') == 0)
@@ -7815,13 +7815,13 @@
for(i=connecthead;i>=0;i=connectpoint2[i])
if( i != myconnectindex )
- sendpacket(i,&buf[0],l);
+ sendpacket(i,(uint8_t*)buf,l);
if(nHostForceDisableAutoaim==2) // user doesn't want AA off.
for(i=connecthead;i>=0;i=connectpoint2[i])
{
buf[0] = 133; // request to stop the game.
- sendpacket(i,&buf[0],l);
+ sendpacket(i,(uint8_t*)buf,l);
}
@@ -7856,7 +7856,7 @@
for(i=connecthead;i>=0;i=connectpoint2[i])
if(i != myconnectindex)
- sendpacket(i,&buf[0],11);
+ sendpacket(i,(uint8_t*)&buf[0],11);
buf[0] = 134; // GRP CRC + CON SIZE + conCRC + exeCRC
memcpy(buf+1, groupefil_crc32, sizeof(groupefil_crc32));
@@ -7866,7 +7866,7 @@
for(i=connecthead;i>=0;i=connectpoint2[i])
if( i != myconnectindex )
- sendpacket(i,buf,1+sizeof(groupefil_crc32)+sizeof(ud.conSize[0])+sizeof(ud.conCRC[0])+
+ sendpacket(i,(uint8_t*)buf,1+sizeof(groupefil_crc32)+sizeof(ud.conSize[0])+sizeof(ud.conCRC[0])+
sizeof(ud.exeCRC[0]));
// getpackets();
@@ -7877,7 +7877,7 @@
for(i=connecthead;i>=0;i=connectpoint2[i])
if(i != myconnectindex)
- sendpacket(i,buf,2);
+ sendpacket(i,(uint8_t*)buf,2);
// getpackets();
@@ -7887,7 +7887,7 @@
for(i=connecthead;i>=0;i=connectpoint2[i])
if(i != myconnectindex)
- sendpacket(i,buf,1);
+ sendpacket(i,(uint8_t*)buf,1);
}
// getpackets();
@@ -8081,7 +8081,6 @@
int main(int argc,char **argv)
{
int32_t i, j;
- int32 iScriptHandle;
int32_t filehandle;
@@ -8230,12 +8229,12 @@
puts("You don't have enough free memory to run Duke Nukem 3D.");
puts("The DOS \"mem\" command should report 6,800K (or 6.8 megs)");
puts("of \"total memory free\".\n");
- printf("Duke Nukem 3D requires %ld more bytes to run.\n",3162000-350000-totalmemory);
+ printf("Duke Nukem 3D requires %d more bytes to run.\n",3162000-350000-totalmemory);
Error(EXIT_SUCCESS, "");
}
}
else
- printf("Using %ld bytes for heap.\n",totalmemory);
+ printf("Using %d bytes for heap.\n",totalmemory);
RegisterShutdownFunction( ShutDown );
@@ -8550,8 +8549,8 @@
uint8_t opendemoread(uint8_t which_demo) // 0 = mine
{
- uint8_t d[] = "demo_.dmo";
- uint8_t *fname = d;
+ char d[] = "demo_.dmo";
+ char *fname = d;
uint8_t ver;
short i,j;
@@ -8675,11 +8674,11 @@
void opendemowrite(void)
{
- uint8_t d[] = "demo1.dmo";
+ char d[] = "demo1.dmo";
int32_t dummylong = 0;
uint8_t ver;
short i;
- uint8_t fullpathdemofilename[16];
+ char fullpathdemofilename[16];
if(ud.recstat == 2) kclose(recfilep);
@@ -10003,7 +10002,7 @@
minitext(23,80," NAME KILLS",8,2+8+16+128);
for(i=0;i<playerswhenstarted;i++)
{
- sprintf(tempbuf,"%-4ld",i+1);
+ sprintf(tempbuf,"%-4d",i+1);
minitext(92+(i*23),80,tempbuf,3,2+8+16+128);
}
@@ -10010,7 +10009,7 @@
for(i=0;i<playerswhenstarted;i++)
{
xfragtotal = 0;
- sprintf(tempbuf,"%ld",i+1);
+ sprintf(tempbuf,"%d",i+1);
minitext(30,90+t,tempbuf,0,2+8+16+128);
minitext(38,90+t,ud.user_name[i],ps[i].palookup,2+8+16+128);
@@ -10019,13 +10018,13 @@
{
if(i == y)
{
- sprintf(tempbuf,"%-4ld",ps[y].fraggedself);
+ sprintf(tempbuf,"%-4d",ps[y].fraggedself);
minitext(92+(y*23),90+t,tempbuf,2,2+8+16+128);
xfragtotal -= ps[y].fraggedself;
}
else
{
- sprintf(tempbuf,"%-4ld",frags[i][y]);
+ sprintf(tempbuf,"%-4d",frags[i][y]);
minitext(92+(y*23),90+t,tempbuf,0,2+8+16+128);
xfragtotal += frags[i][y];
}
@@ -10032,12 +10031,12 @@
if(myconnectindex == connecthead)
{
- sprintf(tempbuf,"stats %ld killed %ld %ld\n",i+1,y+1,frags[i][y]);
+ sprintf(tempbuf,"stats %d killed %d %d\n",i+1,y+1,frags[i][y]);
sendscore(tempbuf);
}
}
- sprintf(tempbuf,"%-4ld",xfragtotal);
+ sprintf(tempbuf,"%-4d",xfragtotal);
minitext(101+(8*23),90+t,tempbuf,2,2+8+16+128);
t += 7;
@@ -10052,7 +10051,7 @@
yfragtotal += ps[i].fraggedself;
yfragtotal += frags[i][y];
}
- sprintf(tempbuf,"%-4ld",yfragtotal);
+ sprintf(tempbuf,"%-4d",yfragtotal);
minitext(92+(y*23),96+(8*7),tempbuf,2,2+8+16+128);
}
@@ -10182,17 +10181,17 @@
bonuscnt++;
sound(PIPEBOMB_EXPLODE);
}
- sprintf(tempbuf,"%02ld:%02ld",
+ sprintf(tempbuf,"%02d:%02d",
(ps[myconnectindex].player_par/(26*60))%60,
(ps[myconnectindex].player_par/26)%60);
gametext((320>>2)+71,60+9,tempbuf,0,2+8+16);
- sprintf(tempbuf,"%02ld:%02ld",
+ sprintf(tempbuf,"%02d:%02d",
(partime[ud.volume_number*11+ud.last_level-1]/(26*60))%60,
(partime[ud.volume_number*11+ud.last_level-1]/26)%60);
gametext((320>>2)+71,69+9,tempbuf,0,2+8+16);
- sprintf(tempbuf,"%02ld:%02ld",
+ sprintf(tempbuf,"%02d:%02d",
(designertime[ud.volume_number*11+ud.last_level-1]/(26*60))%60,
(designertime[ud.volume_number*11+ud.last_level-1]/26)%60);
gametext((320>>2)+71,78+9,tempbuf,0,2+8+16);
@@ -10217,7 +10216,7 @@
bonuscnt++;
sound(PIPEBOMB_EXPLODE);
}
- sprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed);
+ sprintf(tempbuf,"%-3hhd",ps[myconnectindex].actors_killed);
gametext((320>>2)+70,93+9,tempbuf,0,2+8+16);
if(ud.player_skill > 3 )
{
@@ -10227,8 +10226,8 @@
else
{
if( (ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed) < 0 )
- sprintf(tempbuf,"%-3ld",0);
- else sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed);
+ sprintf(tempbuf,"%-3d",0);
+ else sprintf(tempbuf,"%-3d",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed);
gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16);
}
}
@@ -10246,11 +10245,11 @@
bonuscnt++;
sound(PIPEBOMB_EXPLODE);
}
- sprintf(tempbuf,"%-3ld",ps[myconnectindex].secret_rooms);
+ sprintf(tempbuf,"%-3d",ps[myconnectindex].secret_rooms);
gametext((320>>2)+70,120+9,tempbuf,0,2+8+16);
if( ps[myconnectindex].secret_rooms > 0 )
- sprintf(tempbuf,"%-3ld",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms));
- sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms);
+ sprintf(tempbuf,"%-3d",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms));
+ sprintf(tempbuf,"%-3d",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms);
gametext((320>>2)+70,130+9,tempbuf,0,2+8+16);
}
}
@@ -10588,7 +10587,7 @@
{
char szFilename[256];
int i;
- uint8_t score[20];
+ char score[20];
time_t time4file;
struct tm *tmHMS;
@@ -10609,7 +10608,7 @@
if(ud.multimode>1) // if more than 1 player, we add name. Then add score if DM
{
- strcat((uint8_t *)tempbuf, " [");
+ strcat((char *)tempbuf, " [");
for(i=connecthead;i>=0;i=connectpoint2[i])
{
if(!ud.user_name[i][0])
@@ -10620,7 +10619,7 @@
if(ud.m_coop==0 || ud.m_coop==2) // if DM or DM No spawn. Add Score as well
{
strcat(tempbuf, "(");
- snprintf(ps[i].frag-ps[i].fraggedself, sizeof(ps[i].frag-ps[i].fraggedself), "%d", score);
+ snprintf(ps[i].frag-ps[i].fraggedself, sizeof(ps[i].frag-ps[i].fraggedself), "%s", score);
strcat(tempbuf, ps[i].frag-ps[i].fraggedself);
strcat(tempbuf, ") vs ");
}
--- a/Game/src/gamedef.c
+++ b/Game/src/gamedef.c
@@ -312,7 +312,7 @@
int32_t keyword(void)
{
int32_t i;
- uint8_t *temptextptr;
+ char *temptextptr;
temptextptr = textptr;
@@ -360,7 +360,7 @@
for(i=0;i<NUMKEYWORDS;i++)
{
- if( strcmp( (const uint8_t *)tempbuf,keyw[i]) == 0 )
+ if( strcmp( (const char *)tempbuf,keyw[i]) == 0 )
{
*scriptptr = i;
textptr += l;
@@ -1539,7 +1539,7 @@
}
}
-void loadefs(char *filenam, uint8_t *mptr, int readfromGRP)
+void loadefs(char *filenam, char *mptr, int readfromGRP)
{
int32_t fs,fp;
uint8_t kbdKey;
@@ -1559,7 +1559,7 @@
fs = kfilelength(fp);
- last_used_text = textptr = (uint8_t *) mptr;
+ last_used_text = textptr = (char *) mptr;
last_used_size = fs;
kread(fp,(uint8_t *)textptr,fs);
@@ -1597,7 +1597,7 @@
else
{
total_lines += line_number;
- printf("Code Size:%ld bytes(%ld labels).\n",(long)((scriptptr-script)<<2)-4,labelcnt);
+ printf("Code Size:%ld bytes(%d labels).\n",(long)((scriptptr-script)<<2)-4,labelcnt);
ud.conSize[0] = (long)(scriptptr-script)-1;
// FIX_00062: Better support and identification for GRP and CON files for 1.3/1.3d/1.4/1.5
@@ -2496,7 +2496,7 @@
break;
case 68:
insptr++;
- printf("%ld\n",*insptr);
+ printf("%d\n",*insptr);
insptr++;
break;
case 69:
--- a/Game/src/global.c
+++ b/Game/src/global.c
@@ -205,7 +205,7 @@
int32_t myhorizbak[MOVEFIFOSIZ],dukefriction = 0xcc00, show_shareware;
short myangbak[MOVEFIFOSIZ];
-char myname[2048] = {"XDUKE"};
+char myname[2048] = "XDUKE";
uint8_t camerashitable,freezerhurtowner=0,lasermode;
// CTW - MODIFICATION
// uint8_t networkmode = 255, movesperpacket = 1,gamequit = 0,playonten = 0,everyothertime;
--- a/Game/src/joystick.h
+++ b/Game/src/joystick.h
@@ -5,6 +5,7 @@
#endif
void JOYSTICK_UpdateHats( void );
+ void _joystick_init(void);
void _joystick_deinit(void);
int _joystick_update(void);
int _joystick_axis(int axis);
--- a/Game/src/menues.c
+++ b/Game/src/menues.c
@@ -30,6 +30,7 @@
#include "control.h"
#include "cache1d.h"
#include "SDL.h"
+#include "premap.h"
extern SDL_Surface *surface;
extern short inputloc;
@@ -217,9 +218,9 @@
int loadplayer(int8_t spot)
{
short k,music_changed;
- uint8_t fn[] = "game0.sav";
- uint8_t mpfn[] = "gameA_00.sav";
- uint8_t *fnptr, scriptptrs[MAXSCRIPTSIZE];
+ char fn[] = "game0.sav";
+ char mpfn[] = "gameA_00.sav";
+ char *fnptr, scriptptrs[MAXSCRIPTSIZE];
int32_t fil, bv, i, j, x;
int32 nump;
@@ -1752,7 +1753,7 @@
tempbuf[1] = lastsavedpos;
for(x=connecthead;x>=0;x=connectpoint2[x])
if(x != myconnectindex)
- sendpacket(x,tempbuf,2);
+ sendpacket(x,(uint8_t)tempbuf,2);
getpackets();
@@ -2526,7 +2527,7 @@
c = (320>>1)-120;
rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(320>>1,24,0,0,"SETUP SOUNDS");
- onbar = ( (probey == 2)&&SoundToggle || (probey == 3)&&MusicToggle );
+ onbar = ((probey == 2)&&SoundToggle) || ((probey == 3)&&MusicToggle) ;
x = probe(c+6,43,16,8);
@@ -3733,7 +3734,7 @@
for(c=connecthead;c>=0;c=connectpoint2[c])
if(c != myconnectindex)
- sendpacket(c,tempbuf,x+10);
+ sendpacket(c,(uint8_t*)tempbuf,x+10);
newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill+1);
enterlevel(MODE_GAME);
@@ -4039,7 +4040,7 @@
resetinventory(c);
if(c != myconnectindex)
- sendpacket(c,tempbuf,11);
+ sendpacket(c,(uint8_t*)tempbuf,11);
}
newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill+1);
@@ -4076,7 +4077,7 @@
resetinventory(c);
if(c != myconnectindex)
- sendpacket(c,tempbuf,11);
+ sendpacket(c,(uint8_t*)tempbuf,11);
}
newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill+1);
@@ -4664,7 +4665,7 @@
tempbuf[j+3] = 0;
}
- VBE_setPalette(0L,256L,tempbuf);
+ VBE_setPalette(0L,256L,(uint8_t*)tempbuf);
ototalclock = totalclock + 10;
--- a/Game/src/premap.c
+++ b/Game/src/premap.c
@@ -26,6 +26,7 @@
#include "duke3d.h"
#include "cache1d.h"
+#include "game.h"
extern uint8_t everyothertime;
short which_palookup = 9;
@@ -1299,7 +1300,7 @@
{
kread(fp,(int8_t *)&look_pos,1);
kread(fp,tempbuf,256);
- makepalookup((long)look_pos,tempbuf,0,0,0,1);
+ makepalookup((long)look_pos,(uint8_t*)tempbuf,0,0,0,1);
}
kread(fp,&waterpal[0],768);
@@ -1647,7 +1648,7 @@
for(i=connecthead;i>=0;i=connectpoint2[i])
if( i != myconnectindex )
- sendpacket(i,&buf[0],3);
+ sendpacket(i,(uint8_t*)buf,3);
}
ud.mapCRC[myconnectindex] = mapCRC;
--- /dev/null
+++ b/Game/src/premap.h
@@ -1,0 +1,17 @@
+//
+// premap.h
+// Duke3D
+//
+// Created by fabien sanglard on 12-12-17.
+// Copyright (c) 2012 fabien sanglard. All rights reserved.
+//
+
+#ifndef Duke3D_premap_h
+#define Duke3D_premap_h
+
+
+void resetmys(void);
+void docacheit(void);
+void clearfifo(void);
+
+#endif
--- a/Game/src/rts.c
+++ b/Game/src/rts.c
@@ -178,7 +178,7 @@
====================
*/
-uint8_t * RTS_GetSoundName (int32 i)
+char * RTS_GetSoundName (int32 i)
{
i++;
if (i>=numlumps)
--- a/Game/src/rts.h
+++ b/Game/src/rts.h
@@ -72,7 +72,7 @@
====================
*/
-uint8_t * RTS_GetSoundName (int32 i);
+char * RTS_GetSoundName (int32 i);
/*
====================
=
--- a/Game/src/scriplib.c
+++ b/Game/src/scriplib.c
@@ -570,7 +570,7 @@
{
scriptnode_t *node = NULL;
int32 entrynum = 0;
- uint8_t * val = NULL;
+ char * val = NULL;
if(scripthandle >= MAX_SCRIPTS || scripthandle < 0)
return "";
--- a/Game/src/util_lib.h
+++ b/Game/src/util_lib.h
@@ -38,16 +38,15 @@
#ifndef _util_lib_public
#define _util_lib_public
+
+
#ifdef __cplusplus
-extern "C" {
+ extern "C" {
#endif
-#if (defined(__MSDOS__) && !defined(__FLAT__))
-extern int16 _argc;
-#else
+
extern int32 _argc;
-#endif
-extern uint8_t ** _argv;
+extern char ** _argv;
void RegisterShutdownFunction( void (* shutdown) (void) );
void Error (int errorType, char *error, ...);
@@ -70,4 +69,6 @@
#ifdef __cplusplus
};
#endif
+
+
#endif
--- a/xcode/Duke3D.xcodeproj/project.pbxproj
+++ b/xcode/Duke3D.xcodeproj/project.pbxproj
@@ -70,6 +70,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 2D2A07B8167EFA4900064107 /* music.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = music.h; path = ../../Game/src/audiolib/music.h; sourceTree = "<group>"; };
+ 2D2A07BA167EFB5500064107 /* premap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = premap.h; path = ../../Game/src/premap.h; sourceTree = "<group>"; };
2D4FB6FE167D430F00915887 /* sdl_midi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sdl_midi.c; sourceTree = "<group>"; };
2D7B61DE167886FB00E35E54 /* Duke3D */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Duke3D; sourceTree = BUILT_PRODUCTS_DIR; };
2D7B61F11678885A00E35E54 /* a.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = a.c; path = ../../Engine/src/a.c; sourceTree = "<group>"; };
@@ -338,6 +340,7 @@
2D7B626D16788F9B00E35E54 /* util_lib.h */,
2D7B62FD167905C400E35E54 /* dukeunix.h */,
2D7B62FE16790E8000E35E54 /* dummy_audiolib.c */,
+ 2D2A07BA167EFB5500064107 /* premap.h */,
);
name = Game;
sourceTree = "<group>";
@@ -354,6 +357,7 @@
2D7C17CC167AD65800E1BBA1 /* Audiolib */ = {
isa = PBXGroup;
children = (
+ 2D2A07B8167EFA4900064107 /* music.h */,
2D7C17DF167ADE1F00E1BBA1 /* pitch.c */,
2D7C17CD167AD6A500E1BBA1 /* assert.h */,
2D7C17CE167AD6A500E1BBA1 /* dsl.c */,
--- a/xcode/Duke3D/SDLMain.m
+++ b/xcode/Duke3D/SDLMain.m
@@ -37,7 +37,7 @@
#endif /* SDL_USE_CPS */
static int gArgc;
-static uint8_t **gArgv;
+static char **gArgv;
static BOOL gFinderLaunch;
static BOOL gCalledAppMainline = FALSE;
@@ -86,7 +86,7 @@
{
if (shouldChdir)
{
- uint8_t parentdir[MAXPATHLEN];
+ char parentdir[MAXPATHLEN];
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) {
@@ -252,10 +252,10 @@
*/
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
- const uint8_t *temparg;
+ const char *temparg;
size_t arglen;
uint8_t *arg;
- uint8_t **newargv;
+ char **newargv;
if (!gFinderLaunch) /* MacOS is passing command line args. */
return FALSE;
@@ -359,7 +359,7 @@
/* Copy the arguments into a global variable */
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
- gArgv = (uint8_t **) SDL_malloc(sizeof (uint8_t *) * 2);
+ gArgv = (char **) SDL_malloc(sizeof (uint8_t *) * 2);
gArgv[0] = argv[0];
gArgv[1] = NULL;
gArgc = 1;
@@ -367,7 +367,7 @@
} else {
int i;
gArgc = argc;
- gArgv = (uint8_t **) SDL_malloc(sizeof (uint8_t *) * (argc+1));
+ gArgv = (char **) SDL_malloc(sizeof (uint8_t *) * (argc+1));
for (i = 0; i <= argc; i++)
gArgv[i] = argv[i];
gFinderLaunch = NO;