Skip to content

Commit

Permalink
Merge pull request #18 from emileb/fix_warnings
Browse files Browse the repository at this point in the history
Fix various warnings and bugs (?)
  • Loading branch information
LTCHIPS authored Jul 17, 2020
2 parents 2b7c975 + de65ab8 commit d73ad90
Show file tree
Hide file tree
Showing 22 changed files with 59 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/HashTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions src/WinRott.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ extern double dGLOBAL_FPFOCALWIDTH;
void EnableScreenStretch(void);
void DisableScreenStretch(void);
void WriteNewResolution(void);
void RecalculateFocalWidth(void);
/*
double dYZANGLELIMIT;
Expand Down
2 changes: 1 addition & 1 deletion src/dosutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <execinfo.h>

void print_stack (int level)
Expand Down
4 changes: 2 additions & 2 deletions src/dukemusc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/modexlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/music.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
1 change: 1 addition & 0 deletions src/rt_actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
1 change: 1 addition & 0 deletions src/rt_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/rt_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)]));
Expand Down
2 changes: 1 addition & 1 deletion src/rt_dmand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/rt_door.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions src/rt_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ void DrawWallPost ( wallcast_t * post, byte * buf)

void DrawWalls (void)
{
char * buf;
byte * buf;
int plane;
wallcast_t * post;

Expand All @@ -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);
Expand All @@ -1751,7 +1751,7 @@ void DrawWalls (void)
else
{
{
buf=(byte *)(bufferofs);
buf=bufferofs;
for (post=&posts[plane]; post<&posts[viewwidth]; post++,buf++)
{
SetWallLightLevel(post);
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/rt_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -4107,7 +4107,7 @@ void BattleLevelCompleted ( int localplayer )
{
ReadAnyControl (&ci);
}
while( ci.dir == (dirtype)key );
while( ci.dir == (Direction)key );
}

LastScreen = Screen;
Expand Down
1 change: 1 addition & 0 deletions src/rt_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "rt_cfg.h"
#include "keyb.h"
#include "HashTable.h"
#include "modexlib.h"

#define MAXMESSAGELENGTH (COM_MAXTEXTSTRINGLENGTH-1)

Expand Down
19 changes: 10 additions & 9 deletions src/rt_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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() ) )
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1588,8 +1590,7 @@ boolean CheckForQuickLoad (void )

void ShutDown ( void )
{
if ( ( standalone == false )
)
if (standalone == false)
{
WriteConfig ();
}
Expand Down
10 changes: 5 additions & 5 deletions src/rt_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}


Expand Down Expand Up @@ -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 ] );
Expand Down Expand Up @@ -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)] =
{
Expand Down Expand Up @@ -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]);

Expand Down
2 changes: 1 addition & 1 deletion src/rt_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void InitializeGameCommands( void )

GameCommandsStarted=true;

if ((modemgame==true))
if (modemgame==true)
controldivisor=rottcom->ticstep;

standalone=false;
Expand Down
1 change: 1 addition & 0 deletions src/rt_playr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/rt_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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;
Expand Down
32 changes: 16 additions & 16 deletions src/rt_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/rt_ted.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/rt_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ void GetPalette(char * palette)

void SetPalette ( char * pal )
{
VL_SetPalette (pal);
VL_SetPalette ((byte*)pal);
}


Expand Down

0 comments on commit d73ad90

Please sign in to comment.