From 47619a2e8c41ae8fadd0cbec44c43fb7ad9cdf2b Mon Sep 17 00:00:00 2001 From: wootguy Date: Sun, 10 May 2020 14:49:43 -0700 Subject: [PATCH] fix linux build --- CMakeLists.txt | 2 +- src/Bsp.h | 1 + src/Wad.cpp | 5 ++++- src/Wad.h | 18 ------------------ src/util.cpp | 5 +++-- src/util.h | 1 + 6 files changed, 10 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4451a639..0692c067 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ if(MSVC) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT bspguy) else() - set(CMAKE_CXX_FLAGS "-Wall") + set(CMAKE_CXX_FLAGS "-Wall -std=c++11") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") set(CMAKE_CXX_FLAGS_RELEASE "-Os -fno-exceptions -w -Wfatal-errors") endif() diff --git a/src/Bsp.h b/src/Bsp.h index 681bff91..f207626b 100644 --- a/src/Bsp.h +++ b/src/Bsp.h @@ -4,6 +4,7 @@ #include "Entity.h" #include "bsplimits.h" #include "rad.h" +#include #define BSP_MODEL_BYTES 64 // size of a BSP model in bytes diff --git a/src/Wad.cpp b/src/Wad.cpp index 9a5cc928..9323c8df 100644 --- a/src/Wad.cpp +++ b/src/Wad.cpp @@ -2,8 +2,11 @@ #include "util.h" #include #include +#include -#define strcasecmp _stricmp +#ifdef WIN32 + #define strcasecmp _stricmp +#endif Wad::Wad(void) { diff --git a/src/Wad.h b/src/Wad.h index 67588c12..dabd5158 100644 --- a/src/Wad.h +++ b/src/Wad.h @@ -13,24 +13,6 @@ typedef unsigned int uint; struct COLOR3 { unsigned char r, g, b; - - COLOR3 lerp(COLOR3& other, float frac) { - COLOR3 ret; - - int r = round((float)this->r + ((float)other.r - (float)this->r) * frac); - int g = round((float)this->g + ((float)other.g - (float)this->g) * frac); - int b = round((float)this->b + ((float)other.b - (float)this->b) * frac); - - CLAMP(r, 0, 255); - CLAMP(g, 0, 255); - CLAMP(b, 0, 255); - - ret.r = r; - ret.g = g; - ret.b = b; - - return ret; - } }; struct WADHEADER diff --git a/src/util.cpp b/src/util.cpp index d35acfc4..4131a1c0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -4,6 +4,7 @@ #include #include #include +#include bool fileExists(const string& fileName) { @@ -119,8 +120,8 @@ void print_color(int colors) printf("\x1B[0m"); return; } - char* mode = colors & PRINT_BRIGHT ? "1" : "0"; - char* color = "37"; + const char* mode = colors & PRINT_BRIGHT ? "1" : "0"; + const char* color = "37"; switch (colors & ~PRINT_BRIGHT) { case PRINT_RED: color = "31"; break; diff --git a/src/util.h b/src/util.h index 1cefd506..ee8d637f 100644 --- a/src/util.h +++ b/src/util.h @@ -4,6 +4,7 @@ #include #include #include +#include #define PRINT_BLUE 1 #define PRINT_GREEN 2