shithub: rott

Download patch

ref: de65ab8245e11ed7f6c8a26a488bacb4f7d283c4
parent: 2b7c975f23cdafb982f2c958cd2c533f2c6db986
author: Emile Belanger <emile.belanger@gmail.com>
date: Sun Jan 5 16:27:33 EST 2020

Fix various warnings and bugs (?)

--- a/src/HashTable.c
+++ b/src/HashTable.c
@@ -64,7 +64,7 @@
 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)
         {
--- a/src/WinRott.h
+++ b/src/WinRott.h
@@ -28,6 +28,7 @@
 void EnableScreenStretch(void);
 void DisableScreenStretch(void);
 void WriteNewResolution(void);
+void RecalculateFocalWidth(void);
 /*
 double dYZANGLELIMIT;
 
--- a/src/dosutil.c
+++ b/src/dosutil.c
@@ -232,7 +232,7 @@
     printf ("\033[m");
 }
 
-#if !defined(__CYGWIN__) && !defined(__MINGW32__)
+#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__ANDROID__)
 #include <execinfo.h>
 
 void print_stack (int level)
--- a/src/dukemusc.c
+++ b/src/dukemusc.c
@@ -286,7 +286,7 @@
 } // MUSIC_StopSong
 
 
-int MUSIC_PlaySong(unsigned char *song, int loopflag)
+int MUSIC_PlaySong(char *song, int loopflag)
 {
     //SDL_RWops *rw;
 
@@ -381,7 +381,7 @@
 
 #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;
--- a/src/modexlib.h
+++ b/src/modexlib.h
@@ -77,5 +77,8 @@
 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
--- a/src/music.h
+++ b/src/music.h
@@ -73,10 +73,10 @@
 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 );
--- a/src/rt_actor.h
+++ b/src/rt_actor.h
@@ -418,6 +418,7 @@
 void FindEmptyTile(int *stilex, int *stiley);
 void T_Wind( objtype *ob );
 void StopWind( void );
+void SetReverseDeathState(objtype * actor);
 
 void ResurrectEnemies();
 
--- a/src/rt_cfg.c
+++ b/src/rt_cfg.c
@@ -87,6 +87,7 @@
 boolean autoAim = 1;
 boolean enableExtraPistolDrops = 0;
 boolean allowMovementWithMouseYAxis = 1;
+boolean enableZomROTT = 0;
 int FocalWidthOffset = 0;
 int ScreenHeightToWriteToCfg = 0;
 
--- a/src/rt_com.c
+++ b/src/rt_com.c
@@ -210,7 +210,7 @@
     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)]));
--- a/src/rt_dmand.c
+++ b/src/rt_dmand.c
@@ -78,7 +78,7 @@
         return;
     }
 
-    *ptr=&PlaybackBuffer[PlayingPointer];
+    *ptr=(char*)&PlaybackBuffer[PlayingPointer];
 
     PlayingPointer = (PlayingPointer + *length) &
                      (PLAYBACKBUFFERSIZE - 1);
--- a/src/rt_door.c
+++ b/src/rt_door.c
@@ -3165,7 +3165,7 @@
         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);
 
--- a/src/rt_draw.c
+++ b/src/rt_draw.c
@@ -1726,7 +1726,7 @@
 
 void   DrawWalls (void)
 {
-    char * buf;
+    byte * buf;
     int plane;
     wallcast_t * post;
 
@@ -1737,7 +1737,7 @@
     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 @@
     else
     {
         {
-            buf=(byte *)(bufferofs);
+            buf=bufferofs;
             for (post=&posts[plane]; post<&posts[viewwidth]; post++,buf++)
             {
                 SetWallLightLevel(post);
@@ -5687,7 +5687,7 @@
 {
     {
         int i = 0;
-        const byte *orig_src = src;
+        byte *orig_src = src;
         // org code
         while (height--) {
             *buf = shadingtable[*src];
--- a/src/rt_game.c
+++ b/src/rt_game.c
@@ -4107,7 +4107,7 @@
             {
                 ReadAnyControl (&ci);
             }
-            while( ci.dir == (dirtype)key );
+            while( ci.dir == (Direction)key );
         }
 
         LastScreen = Screen;
--- a/src/rt_in.c
+++ b/src/rt_in.c
@@ -41,6 +41,7 @@
 #include "rt_cfg.h"
 #include "keyb.h"
 #include "HashTable.h"
+#include "modexlib.h"
 
 #define MAXMESSAGELENGTH      (COM_MAXTEXTSTRINGLENGTH-1)
 
--- a/src/rt_main.c
+++ b/src/rt_main.c
@@ -792,10 +792,11 @@
         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 @@
                         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 @@
         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 @@
                     byte *tempbuf;
                     MenuFadeOut();
                     ClearGraphicsScreen();
-                    SetPalette(&dimpal[0]);
+                    SetPalette((char*)&dimpal[0]);
                     PlayMovie ("shartitl", true);
                     if ( ( LastScan ) || ( IN_GetMouseButtons() ) )
                     {
@@ -1414,7 +1416,7 @@
                 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 @@
 
 void ShutDown ( void )
 {
-    if ( ( standalone == false )
-       )
+    if (standalone == false)
     {
         WriteConfig ();
     }
--- a/src/rt_menu.c
+++ b/src/rt_menu.c
@@ -4922,11 +4922,11 @@
     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 @@
     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 @@
 }
 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 @@
     ClearMenuBuf();
     SetMenuTitle ("Extended Game Options");
 
-    MN_GetCursorLocation( &ExtGameOptionsItems, &ExtGameOptionsNames[0]);
+    MN_GetCursorLocation( &ExtGameOptionsItems, &ExtGameMenu[0]);
 
     DrawMenu(&ExtGameOptionsItems, &ExtGameMenu[0]);
 
--- a/src/rt_net.c
+++ b/src/rt_net.c
@@ -190,7 +190,7 @@
 
     GameCommandsStarted=true;
 
-    if ((modemgame==true))
+    if (modemgame==true)
         controldivisor=rottcom->ticstep;
 
     standalone=false;
--- a/src/rt_playr.h
+++ b/src/rt_playr.h
@@ -234,6 +234,7 @@
 void     CheckUnPause ( void );
 void     UpdatePlayers ( void );
 void UnTargetActor ( objtype * target );
+void AutoTargetHorizon(objtype *ob);
 
 
 enum
--- a/src/rt_sound.c
+++ b/src/rt_sound.c
@@ -307,12 +307,12 @@
 
     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 @@
 };
 #endif
 
-static byte * currentsong;
+static char * currentsong;
 static int MU_Started=false;
 static int lastsongnumber=-1;
 int storedposition=0;
--- a/src/rt_str.c
+++ b/src/rt_str.c
@@ -1743,36 +1743,36 @@
     }
     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 );
         }
     }
 }
--- a/src/rt_ted.c
+++ b/src/rt_ted.c
@@ -1343,7 +1343,7 @@
     // Check the version number
     //
     SafeRead( filehandle, &RTLVersion, sizeof( RTLVersion ) );
-    SwapIntelLong(&RTLVersion);
+    SwapIntelLong((int*)&RTLVersion);
     if ( RTLVersion > RTL_VERSION )
     {
         Error(
--- a/src/rt_util.c
+++ b/src/rt_util.c
@@ -1194,7 +1194,7 @@
 
 void SetPalette ( char * pal )
 {
-    VL_SetPalette (pal);
+    VL_SetPalette ((byte*)pal);
 }