diff --git a/README.md b/README.md index 1c0ee936d..2e7e6a19d 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ Check the LUASTUFF file for more information on all the lua things Saturn has. ## Compiling See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2. +Visual C++ (MSVC) is unsupported ## Disclaimer Kart Krew is in no way affiliated with SEGA or Sonic Team. We do not claim ownership of any of SEGA's intellectual property used in SRB2. diff --git a/src/apng.h b/src/apng.h index 0f22dca6d..8be4708a8 100644 --- a/src/apng.h +++ b/src/apng.h @@ -23,11 +23,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef APNG_H #define APNG_H -#ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE diff --git a/src/blua/ldo.c b/src/blua/ldo.c index ad8a32694..c573dab17 100644 --- a/src/blua/ldo.c +++ b/src/blua/ldo.c @@ -46,10 +46,6 @@ ** ======================================================= */ -#ifdef _MSC_VER -#pragma warning(disable : 4324) -#endif - /* chain list of long jump buffers */ struct lua_longjmp { struct lua_longjmp *previous; @@ -57,10 +53,6 @@ struct lua_longjmp { volatile int status; /* error code */ }; -#ifdef _MSC_VER -#pragma warning(default : 4324) -#endif - void luaD_seterrorobj (lua_State *L, int lerrcode, StkId oldtop) { switch (lerrcode) { case LUA_ERRMEM: { diff --git a/src/blua/ldo.h b/src/blua/ldo.h index baaa1301c..f85058bba 100644 --- a/src/blua/ldo.h +++ b/src/blua/ldo.h @@ -48,12 +48,6 @@ LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); LUAI_FUNC void luaD_growstack (lua_State *L, int n); -#ifdef _MSC_VER - #ifndef ATTRNORETURN - #define ATTRNORETURN __declspec(noreturn) - #endif -#endif - #ifndef ATTRNORETURN #define ATTRNORETURN #endif diff --git a/src/blua/luaconf.h b/src/blua/luaconf.h index 2596838bb..76a798751 100644 --- a/src/blua/luaconf.h +++ b/src/blua/luaconf.h @@ -11,12 +11,8 @@ #include #include -#ifdef _MSC_VER -#define INT32 __int32 -#else #include #define INT32 int32_t -#endif #ifndef __cplusplus #ifndef min // Double-Check with WATTCP-32's cdefs.h @@ -570,9 +566,6 @@ #define luai_numshl(a,b) ((unsigned)(a)<<(unsigned)(b)) #define luai_numshr(a,b) ((unsigned)(a)>>(unsigned)(b)) #define luai_numnot(a) (~((unsigned)(a))) -#ifdef _MSC_VER -#pragma warning(disable : 4244) -#endif #endif @@ -589,24 +582,11 @@ #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ (defined(__i386) || defined (_M_IX86) || defined(__i386__)) -/* On a Microsoft compiler, use assembler */ -#if defined(_MSC_VER) - -#define lua_number2int(i,d) __asm fld d __asm fistp i -#define lua_number2integer(i,n) lua_number2int(i, n) - -/* the next trick should work on any Pentium, but sometimes clashes - with a DirectX idiosyncrasy */ -#else - union luai_Cast { double l_d; long l_l; }; #define lua_number2int(i,d) \ { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } #define lua_number2integer(i,n) lua_number2int(i, n) -#endif - - /* this option always works, but may be slow */ #else #define lua_number2int(i,d) ((i)=(int)(d)) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 7582fdc2c..6c1bf7bd2 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -133,10 +133,6 @@ void Command_Droprate(void); void Command_Numnodes(void); #endif -#if defined(_MSC_VER) -#pragma pack(1) -#endif - // Client to server packet typedef struct { @@ -176,10 +172,6 @@ typedef struct ticcmd_t cmd, cmd2, cmd3, cmd4; } ATTRPACK client4cmd_pak; -#ifdef _MSC_VER -#pragma warning(disable : 4200) -#endif - // Server to client packet // this packet is too large typedef struct @@ -372,10 +364,6 @@ typedef struct { UINT8 data[0]; // Size is variable using hardware_MAXPACKETLENGTH } ATTRPACK filetx_pak; -#ifdef _MSC_VER -#pragma warning(default : 4200) -#endif - #define MAXAPPLICATION 16 typedef struct @@ -519,10 +507,6 @@ typedef struct } u; // This is needed to pack diff packet types data together } ATTRPACK doomdata_t; -#if defined(_MSC_VER) -#pragma pack() -#endif - #define MAXSERVERLIST (MAXNETNODES-1) typedef struct { diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 969431101..b231396ae 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4679,7 +4679,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum) return; } - ncs = findfile(filename,md5sum,true); + ncs = findfile(filename, md5sum, true); if (ncs != FS_FOUND || !P_AddWadFile(filename, false)) { diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 098de925e..52f777e2b 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -266,14 +266,6 @@ typedef enum extern const char *netxcmdnames[MAXNETXCMD - 1]; -#if defined(_MSC_VER) -#pragma pack(1) -#endif - -#ifdef _MSC_VER -#pragma warning(disable : 4214) -#endif - //Packet composition for Command_TeamChange_f() ServerTeamChange, etc. //bitwise structs make packing bits a little easier, but byte alignment harder? //todo: decide whether to make the other netcommands conform, or just get rid of this experiment. @@ -285,10 +277,6 @@ typedef struct { UINT32 scrambled : 1; // value 0 to 1 } ATTRPACK changeteam_packet_t; -#ifdef _MSC_VER -#pragma warning(default : 4214) -#endif - typedef struct { UINT16 l; // liitle endian UINT16 b; // big enian @@ -302,10 +290,6 @@ typedef union { changeteam_value_t value; } ATTRPACK changeteam_union; -#if defined(_MSC_VER) -#pragma pack() -#endif - // add game commands, needs cleanup void D_RegisterServerCommands(void); void D_RegisterClientCommands(void); diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h index dab758f8d..98e4891e3 100644 --- a/src/d_ticcmd.h +++ b/src/d_ticcmd.h @@ -50,10 +50,6 @@ typedef enum #define TICCMD_RECEIVED 1 #define TICCMD_XY 2 -#if defined(_MSC_VER) -#pragma pack(1) -#endif - typedef struct { SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50) @@ -65,8 +61,4 @@ typedef struct UINT8 latency; // Netgames: how many tics ago was this ticcmd generated from this player's end? } ATTRPACK ticcmd_t; -#if defined(_MSC_VER) -#pragma pack() -#endif - #endif diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 016359772..c35dc0346 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -54,8 +54,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #ifdef __GNUC__ #include -#elif defined (_MSC_VER) -#include #endif #if defined (__unix__) || defined (UNIXCOMMON) #include @@ -66,10 +64,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #endif -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif - #if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) #include #if defined (__linux__) @@ -874,10 +868,6 @@ void I_OutputMsg(const char *fmt, ...) DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt); #endif -#if defined (_WIN32) && defined (_MSC_VER) - OutputDebugStringA(txt); -#endif - len = strlen(txt); #ifdef LOGMESSAGES diff --git a/src/doomdata.h b/src/doomdata.h index 6319238b7..a646686f1 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -57,10 +57,6 @@ enum // Do not use bit five or after, as they are used for object z-offsets. -#if defined(_MSC_VER) -#pragma pack(1) -#endif - // A single Vertex. typedef struct { @@ -188,10 +184,6 @@ typedef struct UINT16 children[2]; } ATTRPACK mapnode_t; -#if defined(_MSC_VER) -#pragma pack() -#endif - // Thing definition, position, orientation and type, // plus visibility flags and attributes. typedef struct diff --git a/src/doomdef.h b/src/doomdef.h index a1b5df0ea..a67b3d7cd 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -47,17 +47,6 @@ #define ASMCALL #endif -#ifdef _MSC_VER -#pragma warning(disable : 4127 4152 4213 4514) -#ifdef _WIN64 -#pragma warning(disable : 4306) -#endif -#endif -// warning level 4 -// warning C4127: conditional expression is constant -// warning C4152: nonstandard extension, function/data pointer conversion in expression -// warning C4213: nonstandard extension used : cast on l-value - #ifdef __cplusplus extern "C" { #endif @@ -560,7 +549,7 @@ UINT32 quickncasehash (const char *p, size_t n) #endif #ifdef __cplusplus -#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) +#if defined(__GNUC__) || defined(__clang__) #define restrict __restrict #else #define restrict diff --git a/src/doomtype.h b/src/doomtype.h index 6ad95c94e..81c09c007 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -28,31 +28,6 @@ extern "C" { #endif /* 7.18.1.1 Exact-width integer types */ -#ifdef _MSC_VER -#define UINT8 unsigned __int8 -#define SINT8 signed __int8 - -#define UINT16 unsigned __int16 -#define INT16 __int16 - -#define INT32 __int32 -#define UINT32 unsigned __int32 - -#define INT64 __int64 -#define UINT64 unsigned __int64 - -typedef long ssize_t; - -/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -#if (_MSC_VER <= 1200) - #ifndef DWORD_PTR - #define DWORD_PTR DWORD - #endif - #ifndef PDWORD_PTR - #define PDWORD_PTR PDWORD - #endif -#endif -#else #define __STDC_LIMIT_MACROS #include @@ -66,7 +41,6 @@ typedef long ssize_t; #define UINT32 uint32_t #define INT64 int64_t #define UINT64 uint64_t -#endif #ifdef __APPLE_CC__ #define DIRECTFULLSCREEN 1 @@ -76,16 +50,7 @@ typedef long ssize_t; /* Strings and some misc platform specific stuff */ -#if defined (_MSC_VER) || defined (__OS2__) - // Microsoft VisualC++ -#ifdef _MSC_VER -#if (_MSC_VER <= 1800) // MSVC 2013 and back - #define snprintf _snprintf -#if (_MSC_VER <= 1200) // MSVC 6.0 and back - #define vsnprintf _vsnprintf -#endif -#endif -#endif +#if defined (__OS2__) #define strncasecmp strnicmp #define strcasecmp stricmp #define inline __inline @@ -270,13 +235,6 @@ typedef int32_t boolean; #endif #define ATTRUNUSED __attribute__((unused)) - -#elif defined (_MSC_VER) - #define ATTRNORETURN __declspec(noreturn) - #define ATTRINLINE __forceinline - #if _MSC_VER > 1200 // >= MSVC 6.0 - #define ATTRNOINLINE __declspec(noinline) - #endif #endif #ifndef FUNCPRINTF @@ -368,7 +326,7 @@ typedef UINT8 bitarray_t; static inline int in_bit_array (const bitarray_t * const array, const int value) { - return (array[value >> 3] & (1<<(value & 7))); + return(array[value >> 3] & (1<<(value & 7))); } static inline void diff --git a/src/filesrch.c b/src/filesrch.c index b7f1a141f..0b112556c 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -30,286 +30,7 @@ #include "z_zone.h" #include "m_menu.h" // Addons_option_Onchange -#if defined (_WIN32) && defined (_MSC_VER) - -#include -#include -#include - -#define SUFFIX "*" -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) - -#ifndef INVALID_FILE_ATTRIBUTES -#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) -#endif - -struct dirent -{ - long d_ino; /* Always zero. */ - unsigned short d_reclen; /* Always zero. */ - unsigned short d_namlen; /* Length of name in d_name. */ - char d_name[FILENAME_MAX]; /* File name. */ -}; - -/* - * This is an internal data structure. Good programmers will not use it - * except as an argument to one of the functions below. - * dd_stat field is now int (was short in older versions). - */ -typedef struct -{ - /* disk transfer area for this dir */ - struct _finddata_t dd_dta; - - /* dirent struct to return from dir (NOTE: this makes this thread - * safe as long as only one thread uses a particular DIR struct at - * a time) */ - struct dirent dd_dir; - - /* _findnext handle */ -#if _MSC_VER > 1200 - intptr_t dd_handle; -#else - long dd_handle; -#endif - - /* - * Status of search: - * 0 = not started yet (next entry to read is first entry) - * -1 = off the end - * positive = 0 based index of next entry - */ - int dd_stat; - - /* given path for dir with search pattern (struct is extended) */ - CHAR dd_name[1]; -} DIR; - -/* - * opendir - * - * Returns a pointer to a DIR structure appropriately filled in to begin - * searching a directory. - */ - -DIR * -opendir (const CHAR *szPath) -{ - DIR *nd; - DWORD rc; - CHAR szFullPath[MAX_PATH]; - - errno = 0; - - if (!szPath) - { - errno = EFAULT; - return (DIR *) 0; - } - - if (szPath[0] == '\0') - { - errno = ENOTDIR; - return (DIR *) 0; - } - - /* Attempt to determine if the given path really is a directory. */ - rc = GetFileAttributesA(szPath); - if (rc == INVALID_FILE_ATTRIBUTES) - { - /* call GetLastError for more error info */ - errno = ENOENT; - return (DIR *) 0; - } - if (!(rc & FILE_ATTRIBUTE_DIRECTORY)) - { - /* Error, entry exists but not a directory. */ - errno = ENOTDIR; - return (DIR *) 0; - } - - /* Make an absolute pathname. */ - _fullpath (szFullPath, szPath, MAX_PATH); - - /* Allocate enough space to store DIR structure and the complete - * directory path given. */ - nd = (DIR *) malloc (sizeof (DIR) + (strlen(szFullPath) + strlen (SLASH) + - strlen(PATHSEP) + 1) * sizeof (CHAR)); - - if (!nd) - { - /* Error, out of memory. */ - errno = ENOMEM; - return (DIR *) 0; - } - - /* Create the search expression. */ - strcpy (nd->dd_name, szFullPath); - - /* Add on a slash if the path does not end with one. */ - if (nd->dd_name[0] != '\0' && - nd->dd_name[strlen (nd->dd_name) - 1] != PATHSEP[0]) - { - strcat (nd->dd_name, PATHSEP); - } - - /* Add on the search pattern */ - strcat (nd->dd_name, SUFFIX); - - /* Initialize handle to -1 so that a premature closedir doesn't try - * to call _findclose on it. */ - nd->dd_handle = -1; - - /* Initialize the status. */ - nd->dd_stat = 0; - - /* Initialize the dirent structure. ino and reclen are invalid under - * Win32, and name simply points at the appropriate part of the - * findfirst_t structure. */ - nd->dd_dir.d_ino = 0; - nd->dd_dir.d_reclen = 0; - nd->dd_dir.d_namlen = 0; - ZeroMemory(nd->dd_dir.d_name, FILENAME_MAX); - - return nd; -} - -/* - * readdir - * - * Return a pointer to a dirent structure filled with the information on the - * next entry in the directory. - */ -struct dirent * -readdir (DIR * dirp) -{ - errno = 0; - - /* Check for valid DIR struct. */ - if (!dirp) - { - errno = EFAULT; - return (struct dirent *) 0; - } - - if (dirp->dd_stat < 0) - { - /* We have already returned all files in the directory - * (or the structure has an invalid dd_stat). */ - return (struct dirent *) 0; - } - else if (dirp->dd_stat == 0) - { - /* We haven't started the search yet. */ - /* Start the search */ - dirp->dd_handle = _findfirst (dirp->dd_name, &(dirp->dd_dta)); - - if (dirp->dd_handle == -1) - { - /* Whoops! Seems there are no files in that - * directory. */ - dirp->dd_stat = -1; - } - else - { - dirp->dd_stat = 1; - } - } - else - { - /* Get the next search entry. */ - if (_findnext (dirp->dd_handle, &(dirp->dd_dta))) - { - /* We are off the end or otherwise error. - _findnext sets errno to ENOENT if no more file - Undo this. */ - DWORD winerr = GetLastError(); - if (winerr == ERROR_NO_MORE_FILES) - errno = 0; - _findclose (dirp->dd_handle); - dirp->dd_handle = -1; - dirp->dd_stat = -1; - } - else - { - /* Update the status to indicate the correct - * number. */ - dirp->dd_stat++; - } - } - - if (dirp->dd_stat > 0) - { - /* Successfully got an entry. Everything about the file is - * already appropriately filled in except the length of the - * file name. */ - dirp->dd_dir.d_namlen = (unsigned short)strlen (dirp->dd_dta.name); - strcpy (dirp->dd_dir.d_name, dirp->dd_dta.name); - return &dirp->dd_dir; - } - - return (struct dirent *) 0; -} - -/* - * rewinddir - * - * Makes the next readdir start from the beginning. - */ -int -rewinddir (DIR * dirp) -{ - errno = 0; - - /* Check for valid DIR struct. */ - if (!dirp) - { - errno = EFAULT; - return -1; - } - - dirp->dd_stat = 0; - - return 0; -} - -/* - * closedir - * - * Frees up resources allocated by opendir. - */ -int -closedir (DIR * dirp) -{ - int rc; - - errno = 0; - rc = 0; - - if (!dirp) - { - errno = EFAULT; - return -1; - } - - if (dirp->dd_handle != -1) - { - rc = _findclose (dirp->dd_handle); - } - - /* Delete the dir structure. */ - free (dirp); - - return rc; -} -#endif - -static CV_PossibleValue_t addons_cons_t[] = {{0, "Default"}, -#if 1 - {1, "HOME"}, {2, "SRB2"}, -#endif - {3, "CUSTOM"}, {0, NULL}}; - +static CV_PossibleValue_t addons_cons_t[] = {{0, "Default"}, {1, "HOME"}, {2, "SRB2"}, {3, "CUSTOM"}, {0, NULL}}; consvar_t cv_addons_option = {"addons_option", "Default", CV_SAVE|CV_CALL, addons_cons_t, Addons_option_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_addons_folder = {"addons_folder", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 80333ce57..0639c989c 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -99,10 +99,6 @@ typedef struct fixed_t x2, y2, z2; } polyvertex_t; -#ifdef _MSC_VER -#pragma warning(disable : 4200) -#endif - // a convex 'plane' polygon, clockwise order typedef struct { @@ -110,10 +106,6 @@ typedef struct polyvertex_t pts[0]; } poly_t; -#ifdef _MSC_VER -#pragma warning(default : 4200) -#endif - // holds extra info for 3D render, for each subsector in subsectors[] typedef struct { diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 79ed92c15..0817f3b6e 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -38,9 +38,6 @@ #define O_BINARY 0 #endif -#if defined(_MSC_VER) -#pragma pack(1) -#endif typedef struct { UINT8 id_field_length ; // 1 @@ -54,9 +51,6 @@ typedef struct UINT8 image_pix_size ; //17 UINT8 image_descriptor; //18 } ATTRPACK TGAHeader; // sizeof is 18 -#if defined(_MSC_VER) -#pragma pack() -#endif static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255}; static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255}; @@ -1158,11 +1152,9 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) #ifdef HAVE_PNG -#ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 94b24b25e..364c0e417 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -47,11 +47,9 @@ #include "../v_video.h" #ifdef HAVE_PNG -#ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index 014638f56..62de1f35e 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -22,10 +22,6 @@ extern "C" { #include "hw_glob.h" #include "hw_model.h" -#if defined(_MSC_VER) -#pragma pack() -#endif - typedef struct { char filename[32]; diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h index 3e73afbaa..6c397486c 100644 --- a/src/hardware/r_opengl/r_opengl.h +++ b/src/hardware/r_opengl/r_opengl.h @@ -27,16 +27,8 @@ extern "C" { #ifdef HAVE_SDL #define _MATH_DEFINES_DEFINED -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif - #include "SDL_opengl.h" //Alam_GBC: Simple, yes? -#ifdef _MSC_VER -#pragma warning(default : 4214 4244) -#endif - #else #include diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c index 53421953f..f9d860bd1 100644 --- a/src/i_addrinfo.c +++ b/src/i_addrinfo.c @@ -43,11 +43,7 @@ #ifndef I_getaddrinfo -#if !defined (_MSC_VER) || (_MSC_VER >= 1800) // MSVC 2013 and forward #include -#else -typedef char bool; -#endif #ifdef _WIN32 // it seems windows doesn't define that... maybe some other OS? OS/2 diff --git a/src/i_net.h b/src/i_net.h index bdbad182e..e811908f2 100644 --- a/src/i_net.h +++ b/src/i_net.h @@ -39,10 +39,6 @@ extern "C" { extern INT16 hardware_MAXPACKETLENGTH; -#if defined(_MSC_VER) -#pragma pack(1) -#endif - typedef struct { /// Supposed to be DOOMCOM_ID @@ -95,10 +91,6 @@ typedef struct #define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data #endif -#if defined(_MSC_VER) -#pragma pack() -#endif - extern doomcom_t *doomcom; /** \brief return packet in doomcom struct diff --git a/src/m_dllist.h b/src/m_dllist.h index 18f351144..84e25fb9d 100644 --- a/src/m_dllist.h +++ b/src/m_dllist.h @@ -25,10 +25,6 @@ #ifndef M_DLLIST_H__ #define M_DLLIST_H__ -#ifdef _MSC_VER -#pragma warning(disable : 4706) -#endif - typedef struct mdllistitem_s { struct mdllistitem_s *next; diff --git a/src/m_fixed.c b/src/m_fixed.c index 0eeab810f..bdb9506c2 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -11,14 +11,6 @@ /// \file m_fixed.c /// \brief Fixed point implementation -#if 0 //#ifndef NO_M -#include -#define HAVE_SQRT - #if 0 //#ifndef _WIN32 // MSVCRT does not have *f() functions - #define HAVE_SQRTF - #endif -#endif - #include "doomdef.h" #include "m_fixed.h" #include "tables.h" // ANGLETOFINESHIFT diff --git a/src/m_misc.c b/src/m_misc.c index 0ae536f4f..d43a7bb5c 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -79,11 +79,9 @@ typedef off_t off64_t; #ifdef HAVE_PNG -#ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE diff --git a/src/md5.c b/src/md5.c index 234de8f26..17b5ca52f 100644 --- a/src/md5.c +++ b/src/md5.c @@ -20,9 +20,6 @@ #include #include -#ifdef _MSC_VER -#pragma warning(disable : 4127) -#endif #if defined (STDC_HEADERS) || defined (_LIBC) #include diff --git a/src/mserv.h b/src/mserv.h index 0b4e09bb8..a8de2152f 100644 --- a/src/mserv.h +++ b/src/mserv.h @@ -16,10 +16,6 @@ #include "i_threads.h" -#if defined(_MSC_VER) -#pragma pack(1) -#endif - typedef union { char buffer[16]; // information such as password @@ -50,13 +46,9 @@ typedef struct INT32 hostonly; } ATTRPACK msg_ban_t; -#if defined(_MSC_VER) -#pragma pack() -#endif - // ================================ GLOBALS =============================== #ifdef MASTERSERVER -extern consvar_t cv_masterserver; +extern consvar_t cv_masterserver; #endif extern consvar_t cv_servername; extern consvar_t cv_server_contact; diff --git a/src/p_spec.c b/src/p_spec.c index a68bf04e3..53342acb9 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -52,10 +52,6 @@ mobj_t *skyboxmo[2]; // This must be updated whenever we up the max flat size - quicker to assume rather than figuring out the sqrt of the specific flat's filesize. #define MAXFLATSIZE (2048< // alloca(sizeof) #endif -#if defined(_MSC_VER) -#pragma pack(1) -#endif - // Not sure if this is necessary, but it was in w_wad.c, so I'm putting it here too -Shadow Hog #include @@ -71,11 +67,6 @@ typedef struct mappatch_t patches[1]; } ATTRPACK maptexture_t; -#if defined(_MSC_VER) -#pragma pack() -#endif - - // Store lists of lumps for F_START/F_END etc. typedef struct { diff --git a/src/r_defs.h b/src/r_defs.h index 4b3121d75..3d49b70a8 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -576,10 +576,6 @@ typedef struct UINT16 children[2]; } node_t; -#if defined(_MSC_VER) -#pragma pack(1) -#endif - // posts are runs of non masked source pixels typedef struct { @@ -587,10 +583,6 @@ typedef struct UINT8 length; // length data bytes follows } ATTRPACK post_t; -#if defined(_MSC_VER) -#pragma pack() -#endif - // column_t is a list of 0 or more post_t, (UINT8)-1 terminated typedef post_t column_t; @@ -669,10 +661,6 @@ typedef struct #endif } patch_t; -#if defined(_MSC_VER) -#pragma pack(1) -#endif - typedef struct { INT16 width; // bounding box size @@ -683,10 +671,6 @@ typedef struct // the [0] is &columnofs[width] } ATTRPACK softwarepatch_t; -#if defined(_MSC_VER) -#pragma pack() -#endif - // Possible alpha types for a patch. enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY}; diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index c767530d9..e4b0d4f37 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -92,7 +92,7 @@ if(${SDL2_FOUND}) source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES}) source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS}) source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS}) - + if(${SRB2_CONFIG_HWRENDER}) set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} @@ -110,16 +110,6 @@ if(${SDL2_FOUND}) set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} ${SRB2_NASM_SOURCES} ) - if(MSVC) - set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} - ${SRB2_NASM_OBJECTS} - ) - set_source_files_properties(${SRB2_NASM_OBJECTS} PROPERTIES GENERATED ON) - else() - list(APPEND SRB2_SDL2_TOTAL_SOURCES ${SRB2_ASM_SOURCES}) - set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES LANGUAGE C) - set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp") - endif() endif() if(${CMAKE_SYSTEM} MATCHES Windows) @@ -204,18 +194,6 @@ if(${SDL2_FOUND}) set(ASM_ASSEMBLER_OBJFORMAT ${CMAKE_ASM_NASM_OBJECT_FORMAT}) set_source_files_properties(${SRB2_NASM_SOURCES} LANGUAGE ASM_NASM) endif() - - if(MSVC) - # using assembler with msvc doesn't work, must do it manually - foreach(ASMFILE ${SRB2_NASM_SOURCES}) - get_filename_component(ASMFILE_NAME ${ASMFILE} NAME_WE) - set(ASMFILE_NAME ${ASMFILE_NAME}.obj) - add_custom_command(TARGET SRB2SDL2 PRE_LINK - COMMAND ${ASM_ASSEMBLER_TEMP} ARGS -f ${ASM_ASSEMBLER_OBJFORMAT} -o ${CMAKE_CURRENT_BINARY_DIR}/${ASMFILE_NAME} ${ASMFILE} - COMMENT "assemble ${ASMFILE_NAME}." - ) - endforeach() - endif() endif() if(${CMAKE_SYSTEM} MATCHES Windows) @@ -227,31 +205,6 @@ if(${SDL2_FOUND}) ) endif() - if(MSVC) - if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) - set(SDL2_MAIN_FOUND ON) - if(${SRB2_SYSTEM_BITS} EQUAL 64) - set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/include/SDL2) - set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/lib -lSDL2main") - else() # 32-bit - set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2) - set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2main") - endif() - else() - find_package(SDL2_MAIN REQUIRED) - endif() - target_link_libraries(SRB2SDL2 PRIVATE - ${SDL2_MAIN_LIBRARIES} - ) - target_compile_options(SRB2SDL2 PRIVATE - /Umain - /D_CRT_SECURE_NO_WARNINGS # something about string functions. - /D_CRT_NONSTDC_NO_DEPRECATE - /DSDLMAIN - /D_WINSOCK_DEPRECATED_NO_WARNINGS # Don't care - ) - endif() - target_include_directories(SRB2SDL2 PRIVATE ${SDL2_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS} diff --git a/src/sdl/SDL_main/SDL_windows_main.c b/src/sdl/SDL_main/SDL_windows_main.c index f73ef30fc..8b81269ec 100644 --- a/src/sdl/SDL_main/SDL_windows_main.c +++ b/src/sdl/SDL_main/SDL_windows_main.c @@ -107,14 +107,6 @@ OutOfMemory(void) return FALSE; } -#if defined(_MSC_VER) -/* The VC++ compiler needs main/wmain defined */ -# define console_ansi_main main -# if UNICODE -# define console_wmain wmain -# endif -#endif - /* WinMain, main, and wmain eventually call into here. */ static int main_utf8(int argc, char *argv[]) diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c index 4b1988c6f..a528796eb 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -25,18 +25,10 @@ #include "hwsym_sdl.h" #include "../doomdef.h" -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif - #ifdef HAVE_SDL #include "SDL.h" -#ifdef _MSC_VER -#pragma warning(default : 4214 4244) -#endif - #ifndef NOLOADSO #include "SDL_loadso.h" #endif diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 1ad5d856d..095d856c4 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -55,8 +55,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #ifdef __GNUC__ #include -#elif defined (_MSC_VER) -#include #endif #if defined (__unix__) || defined (UNIXCOMMON) #include @@ -67,10 +65,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #endif -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif - #ifdef HAVE_SDL #define _MATH_DEFINES_DEFINED #include "SDL.h" @@ -79,10 +73,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include "i_ttf.h" #endif -#ifdef _MSC_VER -#pragma warning(default : 4214 4244) -#endif - #include "SDL_cpuinfo.h" #define HAVE_SDLCPUINFO @@ -975,10 +965,6 @@ void I_OutputMsg(const char *fmt, ...) DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt); #endif -#if defined (_WIN32) && defined (_MSC_VER) - OutputDebugStringA(txt); -#endif - len = strlen(txt); #ifdef LOGMESSAGES diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 5c7eaf683..cbbaca6bb 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -24,19 +24,10 @@ #include -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif - #ifdef HAVE_SDL #define _MATH_DEFINES_DEFINED #include "SDL.h" -#ifdef _MSC_VER -#include -#pragma warning(default : 4214 4244) -#endif - #ifdef HAVE_TTF #include "i_ttf.h" #endif diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index c2453a2d6..02ad4642a 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -11,11 +11,9 @@ #ifdef HAVE_LIBGME #ifdef HAVE_ZLIB -#ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE @@ -46,14 +44,7 @@ write netcode into the sound code, OKAY? #include "../z_zone.h" #include "../byteptr.h" -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif #include "SDL.h" -#ifdef _MSC_VER -#pragma warning(default : 4214 4244) -#endif - #include "SDL_mixer.h" /* This is the version number macro for the current SDL_mixer version: */ diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index be43a80ad..2c627397f 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -17,10 +17,6 @@ /// \file /// \brief SDL specific part of the OpenGL API for SRB2 -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif - #ifdef HAVE_SDL #define _MATH_DEFINES_DEFINED @@ -28,10 +24,6 @@ #include "sdlmain.h" -#ifdef _MSC_VER -#pragma warning(default : 4214 4244) -#endif - #include "../doomdef.h" #include "../d_main.h" diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 4afd26a04..c986b9b54 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -16,21 +16,14 @@ /// \file /// \brief SDL interface for sound -#include #include "../doomdef.h" -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif +#if defined(HAVE_SDL) && SOUND == SOUND_SDL -#if defined(HAVE_SDL) && SOUND==SOUND_SDL +#include #include "SDL.h" -#ifdef _MSC_VER -#pragma warning(default : 4214 4244) -#endif - #ifdef HAVE_MIXER #include /* This is the version number macro for the current SDL_mixer version: */ @@ -220,11 +213,6 @@ static inline Uint16 Snd_LowerRate(Uint16 sr) return sr*2; // just keep it just above the output sample rate } -#ifdef _MSC_VER -#pragma warning(disable : 4200) -#pragma pack(1) -#endif - typedef struct { Uint16 header; // 3? @@ -234,11 +222,6 @@ typedef struct Uint8 data[0]; // data; } ATTRPACK dssfx_t; -#ifdef _MSC_VER -#pragma pack() -#pragma warning(default : 4200) -#endif - // // This function loads the sound data from the WAD lump, // for single sound. @@ -1418,4 +1401,5 @@ static boolean I_StartGMESong(const char *musicname, boolean looping) } #endif +#endif #endif //HAVE_SDL diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index 3d1c4bf9c..0fe93953a 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -29,11 +29,7 @@ extern SDL_bool framebuffer; #include "../m_fixed.h" // SDL2 stub macro -#ifdef _MSC_VER -#define SDL2STUB() CONS_Printf("SDL2: stubbed: %s:%d\n", __FUNCTION__, __LINE__) -#else #define SDL2STUB() CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__) -#endif // So m_menu knows whether to store cv_usejoystick value or string #define JOYSTICK_HOTPLUG diff --git a/src/w_wad.c b/src/w_wad.c index 1cd318368..bbb61db07 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -12,11 +12,9 @@ /// \brief Handles WAD file header, directory, lump I/O #ifdef HAVE_ZLIB -#ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE @@ -577,10 +575,6 @@ static boolean ResFindSignature(FILE* handle, const char endPat[], UINT32 startp return false; } - -#if defined(_MSC_VER) -#pragma pack(1) -#endif typedef struct zend_s { char signature[4]; @@ -628,9 +622,6 @@ typedef struct zlentry_s UINT16 namelen; UINT16 xtralen; } ATTRPACK zlentry_t; -#if defined(_MSC_VER) -#pragma pack() -#endif /** Create a lumpinfo_t array for a PKZip file. */ diff --git a/src/w_wad.h b/src/w_wad.h index e0faedab5..3e0b9e0dc 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -32,19 +32,12 @@ extern "C" { // a raw entry of the wad directory // NOTE: This sits here and not in w_wad.c because p_setup.c makes use of it to load map WADs inside PK3s. -#if defined(_MSC_VER) -#pragma pack(1) -#endif typedef struct { UINT32 filepos; // file offset of the resource UINT32 size; // size of the resource char name[8]; // name of the resource } ATTRPACK filelump_t; -#if defined(_MSC_VER) -#pragma pack() -#endif - // ============================================================== // WAD FILE STRUCTURE DEFINITIONS diff --git a/src/win32/win_dbg.c b/src/win32/win_dbg.c index 4230e962f..abcace792 100644 --- a/src/win32/win_dbg.c +++ b/src/win32/win_dbg.c @@ -602,24 +602,10 @@ LONG WINAPI RecordExceptionInfo(PEXCEPTION_POINTERS data/*, LPCSTR Message, LPST #ifdef _X86_ #ifdef __GNUC__ __asm__("movl %%fs : 4, %%eax": "=a"(pStackTop)); -#elif defined (_MSC_VER) - __asm - { - mov eax, fs:[4] - mov pStackTop, eax - } #endif #elif defined (_AMD64_) #ifdef __GNUC__ __asm__("mov %%gs : 4, %%rax": "=a"(pStackTop)); -#elif defined (_MSC_VER) -/* - __asm - { - mov rax, fs:[4] - mov pStackTop, rax - } -*/ #endif #endif if (pStackTop == NULL)