diff --git a/CMakeLists.txt b/CMakeLists.txt index dc511c7e41c647a202b04a0e0819cced1a95c04a..808cdca3e58f1d44dfeef4e46e1ac5f3437065c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.0) project(SRB2 - VERSION 2.1.14) + VERSION 2.1.14 + LANGUAGES C) # Set up CMAKE path set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") @@ -41,9 +42,8 @@ else() set(SRB2_SYSTEM_BITS 32) endif() -# DO NOT ALLOW MSVC! if(MSVC) - message(FATAL_ERROR "MSVC is not supported!") + message(WARNING "!! MSVC BUILDS OF SRB2 CANNOT PLAY MULTIPLAYER !! You're more than welcome to try and fix this!") endif() # OS macros diff --git a/cmake/Modules/FindSDL2.cmake b/cmake/Modules/FindSDL2.cmake index faa556a883aae61ac482c304f32200a996b982de..7939b7d5284e5b20ef692d87f8003237613532c1 100644 --- a/cmake/Modules/FindSDL2.cmake +++ b/cmake/Modules/FindSDL2.cmake @@ -27,8 +27,19 @@ find_library(SDL2_LIBRARY "/usr/local/lib" ) +find_library(SDL2_MAIN_LIBRARY + NAMES SDL2_main + PATHS + ${SDL2_PKGCONF_LIBRARY_DIRS} + /usr/lib + /usr/local/lib +) + # set include dir variables set(SDL2_PROCESS_INCLUDES SDL2_INCLUDE_DIR) set(SDL2_PROCESS_LIBS SDL2_LIBRARY) +set(SDL2_MAIN_PROCESS_INCLUDES SDL2_INCLUDE_DIR) +set(SDL2_MAIN_PROCESS_LIBS SDL2_MAIN_LIBRARY) libfind_process(SDL2) +libfind_process(SDL2_MAIN) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2772ba8a92c8660241549b8f56b57444c2bb31f4..6915071e523c7d5eb952cd1b617d7017aad58bc8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -354,7 +354,7 @@ endif() # Compatibility flag with later versions of GCC # We should really fix our code to not need this -if(NOT CLANG) +if(NOT CLANG AND NOT MSVC) add_compile_options(-mno-ms-bitfields) endif() diff --git a/src/doomdef.h b/src/doomdef.h index d14cd5ddbb452465964d6f9ecb8a16f52a4d6458..4a6d6e5764bc48198d034f2e2e98ce8c5ac9ab26 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -146,6 +146,7 @@ extern FILE *logstream; #define VERSION 201 // Game version #define SUBVERSION 14 // more precise version number #define VERSIONSTRING "v2.1.14" +#define VERSIONSTRINGW L"v2.1.14" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif diff --git a/src/f_wipe.c b/src/f_wipe.c index 69e956216225003bdaaaf94920a28e43d5c5354e..69c9808804fcda7d61c2405a71e114356ffea6ab 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -210,8 +210,8 @@ static void F_DoWipe(fademask_t *fademask) UINT32 draw_linestogo, draw_rowstogo; // rectangle coordinates, etc. - UINT16 scrxpos[fademask->width + 1]; - UINT16 scrypos[fademask->height + 1]; + UINT16* scrxpos = (UINT16*)malloc(fademask->width + 1); //[fademask->width + 1]; + UINT16* scrypos = (UINT16*)malloc(fademask->height + 1);// [fademask->height + 1]; UINT16 maskx, masky; UINT32 relativepos; @@ -263,6 +263,9 @@ static void F_DoWipe(fademask_t *fademask) if (++maskx >= fademask->width) ++masky, maskx = 0; } while (++mask < maskend); + + free(scrxpos); + free(scrypos); } } #endif diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 9996922fdc866a4aa184d613feb448c52db14e66..9c8b03132f9d33c22bec5e37ff2f2e395438f6e0 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -129,6 +129,19 @@ if(${SDL2_FOUND}) ) endif() + if(MSVC) + target_link_libraries(${SRB2_SDL2_EXE_NAME} PRIVATE + ${SDL2_MAIN_LIBRARIES} + ) + target_compile_options(${SRB2_SDL2_EXE_NAME} 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(${SRB2_SDL2_EXE_NAME} PRIVATE ${SDL2_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS} diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 8675301e826a347eb989ee2e3015ca70ffc8f7f5..19b6262b39fd39c91a698c09e44be53939549491 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1661,7 +1661,7 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener) return; if(mumble->uiVersion != 2) { - wcsncpy(mumble->name, L"SRB2 "VERSIONSTRING, 256); + wcsncpy(mumble->name, L"SRB2 "VERSIONSTRINGW, 256); wcsncpy(mumble->description, L"Sonic Robo Blast 2 with integrated Mumble Link support.", 2048); mumble->uiVersion = 2; } diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index af4e48f750c0533c8db014720cba663ce68665a3..7ac32f4b3bf0268be5aaada164426a207195d790 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -25,7 +25,11 @@ extern SDL_bool framebuffer; #include "../m_fixed.h" // SDL2 stub macro -#define SDL2STUB(name) CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__) +#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 /** \brief The JoyInfo_s struct