From de65ab8245e11ed7f6c8a26a488bacb4f7d283c4 Mon Sep 17 00:00:00 2001 From: Emile Belanger Date: Sun, 5 Jan 2020 21:27:33 +0000 Subject: [PATCH] Fix various warnings and bugs (?) --- src/HashTable.c | 2 +- src/WinRott.h | 1 + src/dosutil.c | 2 +- src/dukemusc.c | 4 ++-- src/modexlib.h | 3 +++ src/music.h | 4 ++-- src/rt_actor.h | 1 + src/rt_cfg.c | 1 + src/rt_com.c | 2 +- src/rt_dmand.c | 2 +- src/rt_door.c | 2 +- src/rt_draw.c | 8 ++++---- src/rt_game.c | 2 +- src/rt_in.c | 1 + src/rt_main.c | 19 ++++++++++--------- src/rt_menu.c | 10 +++++----- src/rt_net.c | 2 +- src/rt_playr.h | 1 + src/rt_sound.c | 6 +++--- src/rt_str.c | 32 ++++++++++++++++---------------- src/rt_ted.c | 2 +- src/rt_util.c | 2 +- 22 files changed, 59 insertions(+), 50 deletions(-) diff --git a/src/HashTable.c b/src/HashTable.c index ce9941a..6dc2ac8 100644 --- a/src/HashTable.c +++ b/src/HashTable.c @@ -64,7 +64,7 @@ void Delete(HashTable * hashTable, int key) void ClearHashTable (HashTable * hashTable) { int x = 0; - for (x; x < ARRAY_SIZE(hashTable->table); x++) + for (x = 0; x < ARRAY_SIZE(hashTable->table); x++) { if (hashTable->table[x] != NULL) { diff --git a/src/WinRott.h b/src/WinRott.h index 551b656..6941c8f 100644 --- a/src/WinRott.h +++ b/src/WinRott.h @@ -28,6 +28,7 @@ extern double dGLOBAL_FPFOCALWIDTH; void EnableScreenStretch(void); void DisableScreenStretch(void); void WriteNewResolution(void); +void RecalculateFocalWidth(void); /* double dYZANGLELIMIT; diff --git a/src/dosutil.c b/src/dosutil.c index 0dcc030..9d4a01c 100644 --- a/src/dosutil.c +++ b/src/dosutil.c @@ -232,7 +232,7 @@ void DisplayTextSplash(byte *text, int l) printf ("\033[m"); } -#if !defined(__CYGWIN__) && !defined(__MINGW32__) +#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__ANDROID__) #include void print_stack (int level) diff --git a/src/dukemusc.c b/src/dukemusc.c index 286436e..d60fc5e 100644 --- a/src/dukemusc.c +++ b/src/dukemusc.c @@ -286,7 +286,7 @@ int MUSIC_StopSong(void) } // MUSIC_StopSong -int MUSIC_PlaySong(unsigned char *song, int loopflag) +int MUSIC_PlaySong(char *song, int loopflag) { //SDL_RWops *rw; @@ -381,7 +381,7 @@ void PlayMusic(char *_filename) #ifdef ROTT // ROTT Special - SBF -int MUSIC_PlaySongROTT(unsigned char *song, int size, int loopflag) +int MUSIC_PlaySongROTT(char *song, int size, int loopflag) { char filename[MAX_PATH]; int handle; diff --git a/src/modexlib.h b/src/modexlib.h index 15c2823..096ed7b 100644 --- a/src/modexlib.h +++ b/src/modexlib.h @@ -77,5 +77,8 @@ void XFlipPage ( void ); void DoScreenRotateScale(int w, int h, SDL_Texture * tex, float angle, float scale); void WaitVBL( void ); void TurnOffTextCursor ( void ); +void EnableHudStretch(void); +void DisableHudStretch(void); +void sdl_handle_window_events(void); #endif diff --git a/src/music.h b/src/music.h index 9ffe89d..2cae61a 100644 --- a/src/music.h +++ b/src/music.h @@ -73,10 +73,10 @@ int MUSIC_SongPlaying( void ); void MUSIC_Continue( void ); void MUSIC_Pause( void ); int MUSIC_StopSong( void ); -int MUSIC_PlaySong( unsigned char *song, int loopflag ); +int MUSIC_PlaySong( char *song, int loopflag ); // ROTT Special - SBF -int MUSIC_PlaySongROTT(unsigned char *song, int size, int loopflag); +int MUSIC_PlaySongROTT( char *song, int size, int loopflag); void MUSIC_SetContext( int context ); int MUSIC_GetContext( void ); diff --git a/src/rt_actor.h b/src/rt_actor.h index b7cca98..044fea2 100644 --- a/src/rt_actor.h +++ b/src/rt_actor.h @@ -418,6 +418,7 @@ void RayShoot (objtype * shooter, int damage, int accuracy); void FindEmptyTile(int *stilex, int *stiley); void T_Wind( objtype *ob ); void StopWind( void ); +void SetReverseDeathState(objtype * actor); void ResurrectEnemies(); diff --git a/src/rt_cfg.c b/src/rt_cfg.c index 2091bce..b3a17f8 100644 --- a/src/rt_cfg.c +++ b/src/rt_cfg.c @@ -87,6 +87,7 @@ boolean autoAimMissileWeps = 0; boolean autoAim = 1; boolean enableExtraPistolDrops = 0; boolean allowMovementWithMouseYAxis = 1; +boolean enableZomROTT = 0; int FocalWidthOffset = 0; int ScreenHeightToWriteToCfg = 0; diff --git a/src/rt_com.c b/src/rt_com.c index 5cd3582..9670063 100644 --- a/src/rt_com.c +++ b/src/rt_com.c @@ -210,7 +210,7 @@ boolean ReadPacket (void) if (rottcom->remotenode!=-1) { // calculate crc on packet - crc=CalculateCRC (&rottcom->data[0], rottcom->datalength-sizeof(word)); + crc=CalculateCRC ((byte*)&rottcom->data[0], rottcom->datalength-sizeof(word)); // get crc inside packet sentcrc=*((word *)(&rottcom->data[rottcom->datalength-sizeof(word)])); diff --git a/src/rt_dmand.c b/src/rt_dmand.c index cdcfdb3..1be730d 100644 --- a/src/rt_dmand.c +++ b/src/rt_dmand.c @@ -78,7 +78,7 @@ void SD_UpdatePlaybackSound ( char ** ptr, unsigned long * length ) return; } - *ptr=&PlaybackBuffer[PlayingPointer]; + *ptr=(char*)&PlaybackBuffer[PlayingPointer]; PlayingPointer = (PlayingPointer + *length) & (PLAYBACKBUFFERSIZE - 1); diff --git a/src/rt_door.c b/src/rt_door.c index 901429b..0daf211 100644 --- a/src/rt_door.c +++ b/src/rt_door.c @@ -3165,7 +3165,7 @@ void SpawnPushWall (int tilex, int tiley, int lock, int texture, int dir, int ty lastpwallobj->flags=PW_DAMAGE; lastpwallobj->texture = texture; - if (!texture&0x1000) + if (!(texture&0x1000)) PreCacheLump(texture,PU_CACHEWALLS,cache_pic_t); lastpwallobj->areanumber = GetAreaNumber(tilex,tiley,lastpwallobj->dir); diff --git a/src/rt_draw.c b/src/rt_draw.c index 98cd579..500d8d1 100644 --- a/src/rt_draw.c +++ b/src/rt_draw.c @@ -1726,7 +1726,7 @@ void DrawWallPost ( wallcast_t * post, byte * buf) void DrawWalls (void) { - char * buf; + byte * buf; int plane; wallcast_t * post; @@ -1737,7 +1737,7 @@ void DrawWalls (void) if (doublestep>1) { { - buf=(byte *)(bufferofs); + buf=bufferofs; for (post=&posts[plane]; post<&posts[viewwidth]; post+=2,buf+=2) { SetWallLightLevel(post); @@ -1751,7 +1751,7 @@ void DrawWalls (void) else { { - buf=(byte *)(bufferofs); + buf=bufferofs; for (post=&posts[plane]; post<&posts[viewwidth]; post++,buf++) { SetWallLightLevel(post); @@ -5687,7 +5687,7 @@ void DrawSkyPost (byte * buf, byte * src, int height) { { int i = 0; - const byte *orig_src = src; + byte *orig_src = src; // org code while (height--) { *buf = shadingtable[*src]; diff --git a/src/rt_game.c b/src/rt_game.c index 41a9f2e..b70f9b0 100644 --- a/src/rt_game.c +++ b/src/rt_game.c @@ -4107,7 +4107,7 @@ void BattleLevelCompleted ( int localplayer ) { ReadAnyControl (&ci); } - while( ci.dir == (dirtype)key ); + while( ci.dir == (Direction)key ); } LastScreen = Screen; diff --git a/src/rt_in.c b/src/rt_in.c index e67ea96..da7955d 100644 --- a/src/rt_in.c +++ b/src/rt_in.c @@ -41,6 +41,7 @@ along with this program. If not, see . #include "rt_cfg.h" #include "keyb.h" #include "HashTable.h" +#include "modexlib.h" #define MAXMESSAGELENGTH (COM_MAXTEXTSTRINGLENGTH-1) diff --git a/src/rt_main.c b/src/rt_main.c index a5bfd8e..4238d18 100644 --- a/src/rt_main.c +++ b/src/rt_main.c @@ -792,10 +792,11 @@ void SetupWads( void ) FILE *f; char *buf = malloc(32); if (_argv[arg+1] != 0) { //are there a filename included - tempstr = realloc(tempstr, 129 + strlen(_argv[arg+1])); + int templen = 129 + strlen(_argv[arg+1]); + tempstr = realloc(tempstr, templen); - snprintf(tempstr, "%s", _argv[arg+1], strlen(_argv[arg+1])); + snprintf(tempstr, templen,"%s", _argv[arg+1]); //strncpy (tempstr,_argv[arg+1], strlen(_argv[arg+1]));//copy it to tempstr if (strlen (tempstr) < MAX_PATH) { if (access (tempstr, 0) != 0) { //try open @@ -823,7 +824,7 @@ void SetupWads( void ) GameLevels.avail++; buf = realloc(buf, 32 + strlen(tempstr)); strncpy (buf,"Adding ", 7); - strncat (buf,tempstr, strlen(&tempstr) + 32); + strncat (buf,tempstr, strlen(tempstr) + 32); printf("%s \n", buf); } fclose(f); @@ -843,8 +844,9 @@ void SetupWads( void ) char *buf = malloc(32); if (_argv[arg+1] != 0) { //are there a filename included - tempstr = realloc(tempstr, 129 + strlen(_argv[arg+1])); - snprintf(tempstr, "%s", _argv[arg+1], strlen(_argv[arg+1])); + int templen = 129 + strlen(_argv[arg+1]); + tempstr = realloc(tempstr, templen); + snprintf(tempstr, templen, "%s", _argv[arg+1]); //strncpy (tempstr,_argv[arg+1], sizeof(&_argv[arg+1]));//copy it to tempstr if (strlen (tempstr) < MAX_PATH) { if (access (tempstr, 0) != 0) { //try open @@ -1128,7 +1130,7 @@ void GameLoop (void) byte *tempbuf; MenuFadeOut(); ClearGraphicsScreen(); - SetPalette(&dimpal[0]); + SetPalette((char*)&dimpal[0]); PlayMovie ("shartitl", true); if ( ( LastScan ) || ( IN_GetMouseButtons() ) ) { @@ -1414,7 +1416,7 @@ void GameLoop (void) lbm_t * LBM; byte *s; patch_t *p; - char * str = '\0'; + char * str = NULL; int width, height; LBM = (lbm_t *) W_CacheLumpName( "deadboss", PU_CACHE, Cvt_lbm_t, 1); @@ -1588,8 +1590,7 @@ boolean CheckForQuickLoad (void ) void ShutDown ( void ) { - if ( ( standalone == false ) - ) + if (standalone == false) { WriteConfig (); } diff --git a/src/rt_menu.c b/src/rt_menu.c index a1c1714..0ce156b 100644 --- a/src/rt_menu.c +++ b/src/rt_menu.c @@ -4922,11 +4922,11 @@ byte * IN_GetScanName (ScanCode scan) byte **p; ScanCode *s; - for (s = ExtScanCodes, p = ExtScanNames; *s; p++, s++) + for (s = ExtScanCodes, p = (byte**)ExtScanNames; *s; p++, s++) if (*s == scan) return (*p); - return(ScanNames[scan]); + return((byte*)ScanNames[scan]); } @@ -5032,7 +5032,7 @@ void DrawCustomKeyboard (void) for( i = 0; i < NormalKeyItems.amount; i++ ) { strcpy( &NormalKeyNames[ i ][ KEYNAMEINDEX ], - IN_GetScanName( buttonscan[ (unsigned int)order[ i ] ] ) ); + (char*)IN_GetScanName( buttonscan[ (unsigned int)order[ i ] ] ) ); } MN_GetCursorLocation( &NormalKeyItems, &NormalKeyMenu[ 0 ] ); @@ -5753,7 +5753,7 @@ void DrawExtOptionsButtons (void) } extern boolean allowBlitzMoreMissileWeps; extern boolean enableAmmoPickups; -extern boolean enableZomROTT = 0; +extern boolean enableZomROTT; extern boolean enableExtraPistolDrops; static char *ExtGameOptionsDesc[ sizeof(ExtGameOptionsItems)] = { @@ -5834,7 +5834,7 @@ void DrawExtGameMenu (void) ClearMenuBuf(); SetMenuTitle ("Extended Game Options"); - MN_GetCursorLocation( &ExtGameOptionsItems, &ExtGameOptionsNames[0]); + MN_GetCursorLocation( &ExtGameOptionsItems, &ExtGameMenu[0]); DrawMenu(&ExtGameOptionsItems, &ExtGameMenu[0]); diff --git a/src/rt_net.c b/src/rt_net.c index c55409a..4709efe 100644 --- a/src/rt_net.c +++ b/src/rt_net.c @@ -190,7 +190,7 @@ void InitializeGameCommands( void ) GameCommandsStarted=true; - if ((modemgame==true)) + if (modemgame==true) controldivisor=rottcom->ticstep; standalone=false; diff --git a/src/rt_playr.h b/src/rt_playr.h index c59324f..02b0c83 100644 --- a/src/rt_playr.h +++ b/src/rt_playr.h @@ -234,6 +234,7 @@ boolean InRange (objtype *p, objtype *victim, int distance); void CheckUnPause ( void ); void UpdatePlayers ( void ); void UnTargetActor ( objtype * target ); +void AutoTargetHorizon(objtype *ob); enum diff --git a/src/rt_sound.c b/src/rt_sound.c index 2fb0df4..d948a89 100644 --- a/src/rt_sound.c +++ b/src/rt_sound.c @@ -307,12 +307,12 @@ int SD_PlayIt ( int sndnum, int angle, int distance, int pitch ) if ( *snd == 'C' ) { - voice = FX_PlayVOC3D( snd, pitch, angle, distance, + voice = FX_PlayVOC3D( (char*)snd, pitch, angle, distance, sounds[sndnum].priority, (unsigned long) sndnum ); } else { - voice = FX_PlayWAV3D( snd, pitch, angle, distance, + voice = FX_PlayWAV3D( (char*)snd, pitch, angle, distance, sounds[sndnum].priority, (unsigned long) sndnum ); } @@ -797,7 +797,7 @@ static song_t rottsongs[MAXSONGS] = { }; #endif -static byte * currentsong; +static char * currentsong; static int MU_Started=false; static int lastsongnumber=-1; int storedposition=0; diff --git a/src/rt_str.c b/src/rt_str.c index 581f8c6..b1f25a2 100644 --- a/src/rt_str.c +++ b/src/rt_str.c @@ -1743,36 +1743,36 @@ void TextFrame } if ( type == SINGLE_FRAME ) { - DrawRottText( x1, y1, '�', foreground, background ); - DrawRottText( x2, y1, '�', foreground, background ); - DrawRottText( x1, y2, '�', foreground, background ); - DrawRottText( x2, y2, '�', foreground, background ); + DrawRottText( x1, y1, '\xDA', foreground, background ); + DrawRottText( x2, y1, '\xBF', foreground, background ); + DrawRottText( x1, y2, '\xC0', foreground, background ); + DrawRottText( x2, y2, '\xD9', foreground, background ); for( x = x1 + 1; x < x2; x++ ) { - DrawRottText( x, y1, '�', foreground, background ); - DrawRottText( x, y2, '�', foreground, background ); + DrawRottText( x, y1, '\xC4', foreground, background ); + DrawRottText( x, y2, '\xC4', foreground, background ); } for( y = y1 + 1; y < y2; y++ ) { - DrawRottText( x1, y, '�', foreground, background ); - DrawRottText( x2, y, '�', foreground, background ); + DrawRottText( x1, y, '\xB3', foreground, background ); + DrawRottText( x2, y, '\xB3', foreground, background ); } } if ( type == DOUBLE_FRAME ) { - DrawRottText( x1, y1, '�', foreground, background ); - DrawRottText( x2, y1, '�', foreground, background ); - DrawRottText( x1, y2, '�', foreground, background ); - DrawRottText( x2, y2, '�', foreground, background ); + DrawRottText( x1, y1, '\xC9', foreground, background ); + DrawRottText( x2, y1, '\xBB', foreground, background ); + DrawRottText( x1, y2, '\xC8', foreground, background ); + DrawRottText( x2, y2, '\xBC', foreground, background ); for( x = x1 + 1; x < x2; x++ ) { - DrawRottText( x, y1, '�', foreground, background ); - DrawRottText( x, y2, '�', foreground, background ); + DrawRottText( x, y1, '\xCD', foreground, background ); + DrawRottText( x, y2, '\xCD', foreground, background ); } for( y = y1 + 1; y < y2; y++ ) { - DrawRottText( x1, y, '�', foreground, background ); - DrawRottText( x2, y, '�', foreground, background ); + DrawRottText( x1, y, '\xBA', foreground, background ); + DrawRottText( x2, y, '\xBA', foreground, background ); } } } diff --git a/src/rt_ted.c b/src/rt_ted.c index d472fdd..a167c48 100644 --- a/src/rt_ted.c +++ b/src/rt_ted.c @@ -1343,7 +1343,7 @@ void CheckRTLVersion // Check the version number // SafeRead( filehandle, &RTLVersion, sizeof( RTLVersion ) ); - SwapIntelLong(&RTLVersion); + SwapIntelLong((int*)&RTLVersion); if ( RTLVersion > RTL_VERSION ) { Error( diff --git a/src/rt_util.c b/src/rt_util.c index 8bacda3..073dcd0 100644 --- a/src/rt_util.c +++ b/src/rt_util.c @@ -1194,7 +1194,7 @@ void GetPalette(char * palette) void SetPalette ( char * pal ) { - VL_SetPalette (pal); + VL_SetPalette ((byte*)pal); }