diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 87a0499b6d088b5bb51cf36658de9238397b3402..88ab1cdcb4f97704d75548d66ad7647787f09c20 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -604,6 +604,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 	set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
 endif()
 
+set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-trigraphs)
+
 add_definitions(-DCMAKECONFIG)
 
 #add_library(SRB2Core STATIC
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index 075cd2d3a8defa3fd7d11feb431d2ad9cc67a704..90dce0073beb806165cf1bd2064170ab7fa36b51 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -61,10 +61,10 @@ ifeq   (,$(filter GCC% CLEANONLY,$(.VARIABLES)))
 
   # If this version is not in the list, default to the latest supported
   ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS)))
-	define line =
+    define line =
 	Your compiler version, GCC $(version), is not supported by the Makefile.
 	The Makefile will assume GCC $(LATEST_GCC_VERSION).))
-	endef
+    endef
    $(call print,$(line))
    GCC$(subst .,,$(LATEST_GCC_VERSION))=1
   else
@@ -209,7 +209,7 @@ endif
 
 OLDWFLAGS:=$(WFLAGS)
 # -W -Wno-unused
-WFLAGS=-Wall
+WFLAGS=-Wall -Wno-trigraphs
 ifndef GCC295
 #WFLAGS+=-Wno-packed
 endif
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index e94c637e46ca7fb1f6e99463042e00d760944745..dd633d6fc428aa3f2b96fafa0721f294ea23b64e 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -5715,7 +5715,7 @@ static void HWR_DrawSkyBackground(player_t *player)
 
 		dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->width/256.0f);
 
-		v[0].s = v[3].s = (-1.0f * angle) / ((ANGLE_90-1)*dimensionmultiply); // left
+		v[0].s = v[3].s = (-1.0f * angle) / (((float)ANGLE_90-1.0f)*dimensionmultiply); // left
 		v[2].s = v[1].s = v[0].s + (1.0f/dimensionmultiply); // right (or left + 1.0f)
 		// use +angle and -1.0f above instead if you wanted old backwards behavior
 
diff --git a/src/m_random.c b/src/m_random.c
index 6b281fc24896c99bc42825e4a55bfa211d6ab6b9..2e6213e1277ce027fc04cd6e7435dbaa8e49963d 100644
--- a/src/m_random.c
+++ b/src/m_random.c
@@ -60,7 +60,7 @@ UINT8 M_RandomByte(void)
   */
 INT32 M_RandomKey(INT32 a)
 {
-	return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*a);
+	return (INT32)((rand()/((float)RAND_MAX+1.0f))*a);
 }
 
 /** Provides a random integer in a given range.
@@ -73,7 +73,7 @@ INT32 M_RandomKey(INT32 a)
   */
 INT32 M_RandomRange(INT32 a, INT32 b)
 {
-	return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*(b-a+1))+a;
+	return (INT32)((rand()/((float)RAND_MAX+1.0f))*(b-a+1))+a;
 }