[openjk] 03/05: Imported Upstream version 0~20150323+ds1

Simon McVittie smcv at debian.org
Mon Mar 23 22:39:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository openjk.

commit f546f9490b3718ab55c1f4fbd1b54ae9df9c92b2
Author: Simon McVittie <smcv at debian.org>
Date:   Mon Mar 23 21:32:40 2015 +0000

    Imported Upstream version 0~20150323+ds1
---
 CMakeModules/FindJPEG.cmake       |  72 +++++++++++++++
 CMakeModules/FindPNG.cmake        |  91 +++++++++++++++++++
 CMakeModules/FindSDL2.cmake       |  34 +++++--
 CMakeModules/InstallZIP.cmake     |  38 ++++++--
 CMakeModules/LICENSE_1_0.txt      |  26 ++++++
 code/macosx/OpenJK.icns           | Bin 0 -> 246869 bytes
 code/qcommon/tri_coll_test.cpp    |  18 ++++
 code/rd-common/tr_public.h        |   4 +-
 code/rd-vanilla/tr_bsp.cpp        |   4 +-
 code/rd-vanilla/tr_init.cpp       |   3 +-
 codeJK2/macosx/OpenJK.icns        | Bin 0 -> 246869 bytes
 codemp/CMakeLists.txt             |  22 +++--
 codemp/cgame/CMakeLists.txt       |  22 +++++
 codemp/game/CMakeLists.txt        |  22 +++++
 codemp/game/tri_coll_test.c       |  18 ++++
 codemp/macosx/OpenJK.icns         | Bin 0 -> 246869 bytes
 codemp/rd-common/tr_public.h      |   4 +-
 codemp/rd-vanilla/tr_bsp.cpp      |   4 +-
 codemp/rd-vanilla/tr_init.cpp     |   3 +-
 codemp/ui/CMakeLists.txt          |  22 +++++
 shared/icons/OpenJK_IconPSD.psd   | Bin 0 -> 1672382 bytes
 shared/icons/OpenJK_Icon_1024.png | Bin 0 -> 298812 bytes
 shared/icons/OpenJK_Icon_128.png  | Bin 0 -> 15714 bytes
 shared/icons/OpenJK_Icon_16.png   | Bin 0 -> 1514 bytes
 shared/icons/OpenJK_Icon_32.png   | Bin 0 -> 2678 bytes
 shared/icons/OpenJK_Icon_64.png   | Bin 0 -> 6056 bytes
 shared/icons/icon.ico             | Bin 0 -> 3262 bytes
 shared/icons/license.txt          |  28 ++++++
 shared/icons/ocgDGfu.png          | Bin 0 -> 7788 bytes
 shared/sdl/sdl_icon.h             | 186 ++++++++++++++++++++++++++++++++++++++
 shared/sdl/sdl_window.cpp         |  53 +++++++++--
 shared/sys/sys_public.h           |  31 +++++--
 32 files changed, 652 insertions(+), 53 deletions(-)

diff --git a/CMakeModules/FindJPEG.cmake b/CMakeModules/FindJPEG.cmake
new file mode 100644
index 0000000..6b69cff
--- /dev/null
+++ b/CMakeModules/FindJPEG.cmake
@@ -0,0 +1,72 @@
+# - Find JPEG
+# Find the native JPEG includes and library
+# This module defines
+#  JPEG_INCLUDE_DIR, where to find jpeglib.h, etc.
+#  JPEG_LIBRARIES, the libraries needed to use JPEG.
+#  JPEG_FOUND, If false, do not try to use JPEG.
+# also defined, but not for general use are
+#  JPEG_LIBRARY, where to find the JPEG library.
+
+#=============================================================================
+# License
+#
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium, nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written  permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PR [...]
+
+FIND_PATH(JPEG_INCLUDE_DIR NAMES jpeglib.h
+	HINTS
+		$ENV{JPEG_ROOT}
+	PATH_SUFFIXES
+		include
+	PATHS
+		~/Library/Frameworks
+		/Library/Frameworks
+		/sw # Fink
+		/opt/local # DarwinPorts
+		/opt/csw # Blastwave
+		/opt
+	)
+
+SET(JPEG_NAMES ${JPEG_NAMES} jpeg)
+FIND_LIBRARY(JPEG_LIBRARY
+	NAMES
+		${JPEG_NAMES}
+	HINTS
+		$ENV{JPEG_ROOT}
+	PATH_SUFFIXES
+		lib64
+		lib
+	PATHS
+		/sw
+		/opt/local
+		/opt/csw
+		/opt
+	)
+
+# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
+
+IF(JPEG_FOUND)
+	SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
+ENDIF(JPEG_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
+IF(JPEG_LIBRARY)
+	GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
+ENDIF(JPEG_LIBRARY)
+
+MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR )
diff --git a/CMakeModules/FindPNG.cmake b/CMakeModules/FindPNG.cmake
new file mode 100644
index 0000000..dc63103
--- /dev/null
+++ b/CMakeModules/FindPNG.cmake
@@ -0,0 +1,91 @@
+# - Find the native PNG includes and library
+#
+# This module defines
+#  PNG_INCLUDE_DIR, where to find png.h, etc.
+#  PNG_LIBRARIES, the libraries to link against to use PNG.
+#  PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
+#  PNG_FOUND, If false, do not try to use PNG.
+# also defined, but not for general use are
+#  PNG_LIBRARY, where to find the PNG library.
+# None of the above will be defined unless zlib can be found.
+# PNG depends on Zlib
+
+#=============================================================================
+# License
+#
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium, nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written  permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PR [...]
+
+if(PNG_FIND_QUIETLY)
+  set(_FIND_ZLIB_ARG QUIET)
+endif(PNG_FIND_QUIETLY)
+find_package(ZLIB ${_FIND_ZLIB_ARG})
+
+if(ZLIB_FOUND)
+	find_path(PNG_PNG_INCLUDE_DIR png.h
+	HINTS
+		$ENV{PNG_ROOT}
+	PATH_SUFFIXES
+		include
+		libpng
+		include/libpng
+	PATHS
+		/usr/local # OpenBSD
+		~/Library/Frameworks
+		/Library/Frameworks
+		/sw # Fink
+		/opt/local # DarwinPorts
+		/opt/csw # Blastwave
+		/opt
+	)
+
+set(PNG_NAMES ${PNG_NAMES} png libpng png16 libpng16 png16d libpng16d png15 libpng15 png15d libpng15d png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d)
+find_library(PNG_LIBRARY
+	NAMES
+		${PNG_NAMES}
+	HINTS
+		$ENV{PNG_ROOT}
+	PATH_SUFFIXES
+		lib64
+		lib
+	PATHS
+		/sw
+		/opt/local
+		/opt/csw
+		/opt
+	)
+
+	if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
+		# png.h includes zlib.h. Sigh.
+		SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+		SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
+
+		if (CYGWIN)
+			if(BUILD_SHARED_LIBS)
+				# No need to define PNG_USE_DLL here, because it's default for Cygwin.
+			else(BUILD_SHARED_LIBS)
+				SET (PNG_DEFINITIONS PNG_STATIC)
+			endif(BUILD_SHARED_LIBS)
+		endif (CYGWIN)
+
+	endif (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
+
+endif(ZLIB_FOUND)
+
+# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PNG  DEFAULT_MSG  PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
+
+mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
diff --git a/CMakeModules/FindSDL2.cmake b/CMakeModules/FindSDL2.cmake
index 34ea8db..5be23d6 100644
--- a/CMakeModules/FindSDL2.cmake
+++ b/CMakeModules/FindSDL2.cmake
@@ -55,15 +55,33 @@
 #=============================================================================
 # Copyright 2003-2009 Kitware, Inc.
 #
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
 #
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-#  License text for the above reference.)
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 SET(SDL2_SEARCH_PATHS
 	~/Library/Frameworks
diff --git a/CMakeModules/InstallZIP.cmake b/CMakeModules/InstallZIP.cmake
index f816496..6befc46 100644
--- a/CMakeModules/InstallZIP.cmake
+++ b/CMakeModules/InstallZIP.cmake
@@ -1,16 +1,34 @@
 #=============================================================================
 # Copyright 2007-2009 Kitware, Inc.
-# 
+# Copyright 2015 OpenJK contributors
 #
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
 #
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-#  License text for the above reference.)
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 include(CMakeParseArguments)
 
@@ -61,4 +79,4 @@ function(add_zip_command output)
   add_custom_command(OUTPUT ${output}
     COMMAND ${ZipCommand}
     DEPENDS ${ARGS_DEPENDS})
-endfunction(add_zip_command)
\ No newline at end of file
+endfunction(add_zip_command)
diff --git a/CMakeModules/LICENSE_1_0.txt b/CMakeModules/LICENSE_1_0.txt
new file mode 100644
index 0000000..d928544
--- /dev/null
+++ b/CMakeModules/LICENSE_1_0.txt
@@ -0,0 +1,26 @@
+This license applies to files in this directory that refer to
+the Boost Software License, version 1.0 by name:
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/code/macosx/OpenJK.icns b/code/macosx/OpenJK.icns
new file mode 100644
index 0000000..9bb472b
Binary files /dev/null and b/code/macosx/OpenJK.icns differ
diff --git a/code/qcommon/tri_coll_test.cpp b/code/qcommon/tri_coll_test.cpp
index 2e9d308..760c85b 100644
--- a/code/qcommon/tri_coll_test.cpp
+++ b/code/qcommon/tri_coll_test.cpp
@@ -3,6 +3,24 @@
  * See article "A Fast Triangle-Triangle Intersection Test",
  * Journal of Graphics Tools, 2(2), 1997
  *
+ *
+ * Copyright (C) 1997 Tomas Möller
+ * Copyright (C) 2000-2013 Raven Software, Inc.
+ * Copyright (C) 2001-2013 Activision, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ *
  * int tri_tri_intersect(float V0[3],float V1[3],float V2[3],
  *                         float U0[3],float U1[3],float U2[3])
  *
diff --git a/code/rd-common/tr_public.h b/code/rd-common/tr_public.h
index ce43c99..567fc21 100644
--- a/code/rd-common/tr_public.h
+++ b/code/rd-common/tr_public.h
@@ -30,7 +30,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
 #include "../ghoul2/G2.h"
 #include "../ghoul2/ghoul2_gore.h"
 
-#define	REF_API_VERSION		14
+#define	REF_API_VERSION		15
 
 typedef struct {
 	void				(QDECL *Printf)						( int printLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
@@ -93,7 +93,7 @@ typedef struct {
 	void				(*CIN_UploadCinematic)				( int handle );
 
 	// window handling
-	window_t		(*WIN_Init)                         ( graphicsApi_t graphicsApi, glconfig_t *glConfig );
+	window_t		(*WIN_Init)                         ( const windowDesc_t *desc, glconfig_t *glConfig );
 	void			(*WIN_SetGamma)						( glconfig_t *glConfig, byte red[256], byte green[256], byte blue[256] );
 	void			(*WIN_Present)						( window_t *window );
 	void            (*WIN_Shutdown)                     ( void );
diff --git a/code/rd-vanilla/tr_bsp.cpp b/code/rd-vanilla/tr_bsp.cpp
index 78caa78..10babac 100644
--- a/code/rd-vanilla/tr_bsp.cpp
+++ b/code/rd-vanilla/tr_bsp.cpp
@@ -106,7 +106,7 @@ void R_ColorShiftLightingBytes( byte in[4], byte out[4] ) {
 	int shift, r, g, b;
 
 	// shift the color data based on overbright range
-	shift = r_mapOverBrightBits->integer - tr.overbrightBits;
+	shift = Q_max( 0, r_mapOverBrightBits->integer - tr.overbrightBits );
 
 	// shift the data based on overbright range
 	r = in[0] << shift;
@@ -140,7 +140,7 @@ void R_ColorShiftLightingBytes( byte in[3] ) {
 	int shift, r, g, b;
 
 	// shift the color data based on overbright range
-	shift = r_mapOverBrightBits->integer - tr.overbrightBits;
+	shift = Q_max( 0, r_mapOverBrightBits->integer - tr.overbrightBits );
 
 	// shift the data based on overbright range
 	r = in[0] << shift;
diff --git a/code/rd-vanilla/tr_init.cpp b/code/rd-vanilla/tr_init.cpp
index 2535e5e..f3144f3 100644
--- a/code/rd-vanilla/tr_init.cpp
+++ b/code/rd-vanilla/tr_init.cpp
@@ -704,9 +704,10 @@ static void InitOpenGL( void )
 
 	if ( glConfig.vidWidth == 0 )
 	{
+		windowDesc_t windowDesc = { GRAPHICS_API_OPENGL };
 		memset(&glConfig, 0, sizeof(glConfig));
 
-		window = ri.WIN_Init(GRAPHICS_API_OPENGL, &glConfig);
+		window = ri.WIN_Init(&windowDesc, &glConfig);
 
 		// get our config strings
 		glConfig.vendor_string = (const char *)qglGetString (GL_VENDOR);
diff --git a/codeJK2/macosx/OpenJK.icns b/codeJK2/macosx/OpenJK.icns
new file mode 100644
index 0000000..9bb472b
Binary files /dev/null and b/codeJK2/macosx/OpenJK.icns differ
diff --git a/codemp/CMakeLists.txt b/codemp/CMakeLists.txt
index 4082f93..7ad9352 100644
--- a/codemp/CMakeLists.txt
+++ b/codemp/CMakeLists.txt
@@ -706,13 +706,15 @@ foreach(GameLib ${GameLibsBuilt})
 		${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${GameLib}${CMAKE_SHARED_LIBRARY_SUFFIX})
 endforeach(GameLib)
 
-include(InstallZIP)
-add_zip_command(openjk.pk3
-	FILES ${GameLibFullPaths}
-	DEPENDS "${GameLibsBuilt}")
-add_custom_target(Assets
-	ALL
-	DEPENDS openjk.pk3)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/openjk.pk3
-	DESTINATION "OpenJK"
-	COMPONENT ${JKAMPCoreComponent})
\ No newline at end of file
+if(WIN32)
+	include(InstallZIP)
+	add_zip_command(openjk.pk3
+		FILES ${GameLibFullPaths}
+		DEPENDS "${GameLibsBuilt}")
+	add_custom_target(Assets
+		ALL
+		DEPENDS openjk.pk3)
+	install(FILES ${CMAKE_CURRENT_BINARY_DIR}/openjk.pk3
+		DESTINATION "OpenJK"
+		COMPONENT ${JKAMPCoreComponent})
+endif()
diff --git a/codemp/cgame/CMakeLists.txt b/codemp/cgame/CMakeLists.txt
index 85abfc7..65d3454 100644
--- a/codemp/cgame/CMakeLists.txt
+++ b/codemp/cgame/CMakeLists.txt
@@ -129,6 +129,28 @@ if(MakeApplicationBundles AND BuildMPEngine)
 		LIBRARY
 		DESTINATION "${MPEngine}.app/Contents/MacOS/base"
 		COMPONENT ${JKAMPCoreComponent})
+elseif(WIN32)
+	install(TARGETS ${MPCGame}
+		RUNTIME
+		DESTINATION "OpenJK"
+		COMPONENT ${JKAMPCoreComponent})
+	if (WIN64)
+		# Don't do this on 32-bit Windows to avoid overwriting
+		# vanilla JKA's DLLs
+		install(TARGETS ${MPCGame}
+			RUNTIME
+			DESTINATION "base"
+			COMPONENT ${JKAMPCoreComponent})
+	endif()
+else()
+	install(TARGETS ${MPCGame}
+		LIBRARY
+		DESTINATION "OpenJK"
+		COMPONENT ${JKAMPCoreComponent})
+	install(TARGETS ${MPCGame}
+		LIBRARY
+		DESTINATION "base"
+		COMPONENT ${JKAMPCoreComponent})
 endif()
 
 set_target_properties(${MPCGame} PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "${MPCGameDefines};${ReleaseDefines}")
diff --git a/codemp/game/CMakeLists.txt b/codemp/game/CMakeLists.txt
index c852687..7e335db 100644
--- a/codemp/game/CMakeLists.txt
+++ b/codemp/game/CMakeLists.txt
@@ -197,6 +197,28 @@ if(MakeApplicationBundles AND BuildMPEngine)
 		LIBRARY
 		DESTINATION "${MPEngine}.app/Contents/MacOS/base"
 		COMPONENT ${JKAMPCoreComponent})
+elseif(WIN32)
+	install(TARGETS ${MPGame}
+		RUNTIME
+		DESTINATION "OpenJK"
+		COMPONENT ${JKAMPCoreComponent})
+	if (WIN64)
+		# Don't do this on 32-bit Windows to avoid overwriting
+		# vanilla JKA's DLLs
+		install(TARGETS ${MPGame}
+			RUNTIME
+			DESTINATION "base"
+			COMPONENT ${JKAMPCoreComponent})
+	endif()
+else()
+	install(TARGETS ${MPGame}
+		LIBRARY
+		DESTINATION "OpenJK"
+		COMPONENT ${JKAMPCoreComponent})
+	install(TARGETS ${MPGame}
+		LIBRARY
+		DESTINATION "base"
+		COMPONENT ${JKAMPCoreComponent})
 endif()
 
 set_target_properties(${MPGame} PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "${MPGameDefines};${ReleaseDefines}")
diff --git a/codemp/game/tri_coll_test.c b/codemp/game/tri_coll_test.c
index fa7a9bb..dc63373 100644
--- a/codemp/game/tri_coll_test.c
+++ b/codemp/game/tri_coll_test.c
@@ -3,6 +3,24 @@
  * See article "A Fast Triangle-Triangle Intersection Test",
  * Journal of Graphics Tools, 2(2), 1997
  *
+ *
+ * Copyright (C) 1997 Tomas Möller
+ * Copyright (C) 2000-2013 Raven Software, Inc.
+ * Copyright (C) 2001-2013 Activision, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ *
  * int tri_tri_intersect(float V0[3],float V1[3],float V2[3],
  *                         float U0[3],float U1[3],float U2[3])
  *
diff --git a/codemp/macosx/OpenJK.icns b/codemp/macosx/OpenJK.icns
new file mode 100644
index 0000000..9bb472b
Binary files /dev/null and b/codemp/macosx/OpenJK.icns differ
diff --git a/codemp/rd-common/tr_public.h b/codemp/rd-common/tr_public.h
index 3ebd1e4..ac62599 100644
--- a/codemp/rd-common/tr_public.h
+++ b/codemp/rd-common/tr_public.h
@@ -30,7 +30,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
 #include "../qcommon/qcommon.h"
 #include "../ghoul2/ghoul2_shared.h"
 
-#define	REF_API_VERSION 6
+#define	REF_API_VERSION 7
 
 //
 // these are the functions exported by the refresh module
@@ -318,7 +318,7 @@ typedef struct refimport_s {
 	int				(*CGVM_RagCallback)					( int callType );
 
 	// window handling
-	window_t		(*WIN_Init)                         ( graphicsApi_t graphicsApi, glconfig_t *glConfig );
+	window_t		(*WIN_Init)                         ( const windowDesc_t *desc, glconfig_t *glConfig );
 	void			(*WIN_SetGamma)						( glconfig_t *glConfig, byte red[256], byte green[256], byte blue[256] );
 	void			(*WIN_Present)						( window_t *window );
 	void            (*WIN_Shutdown)                     ( void );
diff --git a/codemp/rd-vanilla/tr_bsp.cpp b/codemp/rd-vanilla/tr_bsp.cpp
index ffb34a4..24ae1b3 100644
--- a/codemp/rd-vanilla/tr_bsp.cpp
+++ b/codemp/rd-vanilla/tr_bsp.cpp
@@ -102,7 +102,7 @@ void R_ColorShiftLightingBytes( byte in[4], byte out[4] ) {
 	int shift, r, g, b;
 
 	// shift the color data based on overbright range
-	shift = r_mapOverBrightBits->integer - tr.overbrightBits;
+	shift = Q_max( 0, r_mapOverBrightBits->integer - tr.overbrightBits );
 
 	// shift the data based on overbright range
 	r = in[0] << shift;
@@ -136,7 +136,7 @@ void R_ColorShiftLightingBytes( byte in[3] ) {
 	int shift, r, g, b;
 
 	// shift the color data based on overbright range
-	shift = r_mapOverBrightBits->integer - tr.overbrightBits;
+	shift = Q_max( 0, r_mapOverBrightBits->integer - tr.overbrightBits );
 
 	// shift the data based on overbright range
 	r = in[0] << shift;
diff --git a/codemp/rd-vanilla/tr_init.cpp b/codemp/rd-vanilla/tr_init.cpp
index 6133c9b..e213b1b 100644
--- a/codemp/rd-vanilla/tr_init.cpp
+++ b/codemp/rd-vanilla/tr_init.cpp
@@ -766,9 +766,10 @@ static void InitOpenGL( void )
 
 	if ( glConfig.vidWidth == 0 )
 	{
+		windowDesc_t windowDesc = { GRAPHICS_API_OPENGL };
 		memset(&glConfig, 0, sizeof(glConfig));
 
-		window = ri->WIN_Init(GRAPHICS_API_OPENGL, &glConfig);
+		window = ri->WIN_Init(&windowDesc, &glConfig);
 
 		Com_Printf( "GL_RENDERER: %s\n", (char *)qglGetString (GL_RENDERER) );
 
diff --git a/codemp/ui/CMakeLists.txt b/codemp/ui/CMakeLists.txt
index 00a1909..5d00bf4 100644
--- a/codemp/ui/CMakeLists.txt
+++ b/codemp/ui/CMakeLists.txt
@@ -82,6 +82,28 @@ if(MakeApplicationBundles AND BuildMPEngine)
 		LIBRARY
 		DESTINATION "${MPEngine}.app/Contents/MacOS/base"
 		COMPONENT ${JKAMPCoreComponent})
+elseif(WIN32)
+	install(TARGETS ${MPUI}
+		RUNTIME
+		DESTINATION "OpenJK"
+		COMPONENT ${JKAMPCoreComponent})
+	if (WIN64)
+		# Don't do this on 32-bit Windows to avoid overwriting
+		# vanilla JKA's DLLs
+		install(TARGETS ${MPUI}
+			RUNTIME
+			DESTINATION "base"
+			COMPONENT ${JKAMPCoreComponent})
+	endif()
+else()
+	install(TARGETS ${MPUI}
+		LIBRARY
+		DESTINATION "OpenJK"
+		COMPONENT ${JKAMPCoreComponent})
+	install(TARGETS ${MPUI}
+		LIBRARY
+		DESTINATION "base"
+		COMPONENT ${JKAMPCoreComponent})
 endif()
 
 set_target_properties(${MPUI} PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "${MPUIDefines};${ReleaseDefines}")
diff --git a/shared/icons/OpenJK_IconPSD.psd b/shared/icons/OpenJK_IconPSD.psd
new file mode 100644
index 0000000..2dddc1b
Binary files /dev/null and b/shared/icons/OpenJK_IconPSD.psd differ
diff --git a/shared/icons/OpenJK_Icon_1024.png b/shared/icons/OpenJK_Icon_1024.png
new file mode 100644
index 0000000..7113df0
Binary files /dev/null and b/shared/icons/OpenJK_Icon_1024.png differ
diff --git a/shared/icons/OpenJK_Icon_128.png b/shared/icons/OpenJK_Icon_128.png
new file mode 100644
index 0000000..31664f6
Binary files /dev/null and b/shared/icons/OpenJK_Icon_128.png differ
diff --git a/shared/icons/OpenJK_Icon_16.png b/shared/icons/OpenJK_Icon_16.png
new file mode 100644
index 0000000..f8295d9
Binary files /dev/null and b/shared/icons/OpenJK_Icon_16.png differ
diff --git a/shared/icons/OpenJK_Icon_32.png b/shared/icons/OpenJK_Icon_32.png
new file mode 100644
index 0000000..526dbd2
Binary files /dev/null and b/shared/icons/OpenJK_Icon_32.png differ
diff --git a/shared/icons/OpenJK_Icon_64.png b/shared/icons/OpenJK_Icon_64.png
new file mode 100644
index 0000000..6d6fd08
Binary files /dev/null and b/shared/icons/OpenJK_Icon_64.png differ
diff --git a/shared/icons/icon.ico b/shared/icons/icon.ico
new file mode 100644
index 0000000..1978a75
Binary files /dev/null and b/shared/icons/icon.ico differ
diff --git a/shared/icons/license.txt b/shared/icons/license.txt
new file mode 100644
index 0000000..a74ecb9
--- /dev/null
+++ b/shared/icons/license.txt
@@ -0,0 +1,28 @@
+The OpenJK icon was made by Antonio Aiello and is released under
+the MIT/X11 license, as quoted here.
+
+code*/macosx/OpenJK.icns, code/win32/starwars.ico,
+codemp/win32/icon.ico and shared/sdl/sdl_icon.h are derived works
+under the same terms.
+
+----
+
+Copyright (c) 2013 Antonio Aiello <http://tristamus.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/shared/icons/ocgDGfu.png b/shared/icons/ocgDGfu.png
new file mode 100644
index 0000000..f07e047
Binary files /dev/null and b/shared/icons/ocgDGfu.png differ
diff --git a/shared/sdl/sdl_icon.h b/shared/sdl/sdl_icon.h
new file mode 100644
index 0000000..e9d2fdd
--- /dev/null
+++ b/shared/sdl/sdl_icon.h
@@ -0,0 +1,186 @@
+/*
+===========================================================================
+Copyright (C) 2013 - 2015, OpenJK contributors
+
+This file is part of the OpenJK source code.
+
+OpenJK is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as
+published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, see <http://www.gnu.org/licenses/>.
+===========================================================================
+*/
+
+/* GIMP RGBA C-Source image dump (sdl_icon.c) */
+
+static const struct {
+  uint32_t  	 width;
+  uint32_t  	 height;
+  uint32_t  	 bytes_per_pixel; /* 3:RGB, 4:RGBA */ 
+  uint8_t 		 pixel_data[32 * 32 * 4 + 1];
+} CLIENT_WINDOW_ICON = {
+  32, 32, 4,
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\1\1\377\1\2"
+  "\3\377\1\3\4\377\1\3\4\377\1\2\3\377\0\1\2\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\1\1\377\3\7\12\377\7\16\23\377\7\21\31\377\10\22\32\377\6\16\25"
+  "\377\3\10\12\377\0\2\2\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\2\4\5\377\10\22\33\377;"
+  "HS\377EVc\3770DT\377P\\e\377\10\24\35\377\2\5\7\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\3\7\12\377\16!0\377\214\227\240\377Zu\212\377Gg\200\377\250\260\266\377"
+  "\15\"3\377\4\12\15\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\1\377\2\3\5\377\3\10\13\377\11\24\34\377\27""3J\377"
+  "\215\234\251\377]\201\235\377Ku\226\377\253\264\274\377\25""5O\377\12\26"
+  "\37\377\3\7\12\377\1\3\4\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\1\3\4\377"
+  "\4\11\15\377\10\23\32\377\11\30$\377\25'6\377[o~\377\247\260\267\377\213"
+  "\236\255\377\203\230\251\377\273\302\307\377au\205\377\23(7\377\11\27!\377"
+  "\7\20\27\377\3\10\13\377\1\2\3\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\1\5\6\377\7\17\26\377\15\36,\377!"
+  "4D\377\200\211\217\377q~\210\377.Oi\377\213\234\252\377]\202\240\377My\233"
+  "\377\255\267\276\377'Mk\377s\177\211\377~\207\215\377\25(8\377\14\34'\377"
+  "\6\15\23\377\2\3\5\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\2\5\7\377\10\23\33\377\15%7\377ev\202\377\232\242\251\377\32/@\377"
+  "\16\40""0\377\30""8P\377\216\235\251\377^\201\233\377Nv\225\377\266\275\304"
+  "\377\26""9U\377\17#3\377\35""1@\377\261\267\273\377Tes\377\15#3\377\7\20"
+  "\27\377\2\4\5\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\1\3\4\377\10\22\32"
+  "\377\16)>\377\211\227\240\377\216\232\244\377\22-A\377\12\27\40\377\12\25"
+  "\36\377\27""4K\377\203\224\241\377^\201\234\377Mt\223\377\271\277\304\377"
+  "\22/G\377\12\25\36\377\12\26\40\377\21+?\377\267\276\303\377w\206\223\377"
+  "\16':\377\6\17\26\377\1\2\3\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\1\1\377\6\14\21\377\22"
+  "*<\377q\204\222\377\256\267\275\377\30""8Q\377\13\30#\377\3\6\11\377\11\23"
+  "\33\377\32""7O\377\343\344\346\377b\206\243\377Ow\226\377\274\302\307\377"
+  "\21.E\377\7\17\25\377\3\6\11\377\14\32$\377\31""8Q\377\325\332\334\377aw"
+  "\207\377\21&7\377\5\12\16\377\0\0\1\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\2\5\7\377\15\35*\3773Rj\377"
+  "\324\327\331\377 at _w\377\20$4\377\4\10\13\377\0\2\2\377\12\26\40\377\35?Y"
+  "\377\337\341\343\377c\212\250\377Ox\230\377\300\305\311\377\21/F\377\7\16"
+  "\24\377\0\1\1\377\4\11\15\377\21&5\377Ql\202\377\350\352\352\377%E^\377\14"
+  "\32%\377\2\3\6\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\6\15\22\377\24""2J\377\236\253\264\377\250\263"
+  "\273\377\27:W\377\11\22\32\377\0\1\2\377\0\1\1\377\13\30\"\377\36B]\377\337"
+  "\341\343\377d\213\252\377Py\231\377\303\310\314\377\23""4N\377\12\26\37\377"
+  "\3\6\10\377\1\4\6\377\11\24\34\377\25:W\377\273\302\310\377\240\256\271\377"
+  "\23/E\377\5\13\20\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\1\3\3\377\14\31$\377.Pk\377\320\324\327\377t\215\240\377"
+  "\24-A\377\4\10\14\377\0\0\0\377\0\1\1\377\13\30\"\377\36B^\377\337\341\343"
+  "\377d\214\252\377Pz\233\377\307\313\315\377\34Il\377!8K\377\13\26\37\377"
+  "\3\10\13\377\4\11\15\377\25/C\377\202\227\251\377\335\337\341\377#Fb\377"
+  "\13\27!\377\1\2\3\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\3\5\7\377\22'8\377v\216\240\377\310\314\320\377Jk\206\377\20!0\377"
+  "\2\3\5\377\0\0\0\377\0\1\1\377\13\30\"\377\36B^\377\337\341\343\377d\214"
+  "\252\377R|\236\377\312\315\317\3771i\224\377\320\325\331\377\13\37""0\377"
+  "\6\15\22\377\2\4\6\377\20#2\377Qq\212\377\314\321\325\377u\215\240\377\21"
+  "%5\377\2\5\7\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\4\11\15\377\24""2H\377\236\255\270\377\324\327\332\377(On\377\15\33"
+  "&\377\1\2\2\377\0\0\0\377\0\1\1\377\13\30\"\377\36B^\377\337\341\343\377"
+  "d\213\253\377R\177\242\377\276\303\307\377\243\260\272\377\273\301\306\377"
+  "\20(:\377\5\14\20\377\1\2\3\377\15\34'\377,Sp\377\323\327\332\377\241\257"
+  "\273\377\24""0F\377\4\10\14\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\5\14\21\377\25""6R\377\263\273\303\377\330\332\334\377"
+  "\35Ef\377\13\30\"\377\0\1\1\377\0\0\0\377\1\3\4\377\15\34)\377!Hf\377\340"
+  "\341\343\377d\213\252\377S\201\244\377\272\277\303\377\217\236\251\377-U"
+  "s\377\16\37,\377\3\6\11\377\0\1\1\377\13\30\"\377\35Fe\377\330\332\334\377"
+  "\265\276\305\377\24""6Q\377\5\14\20\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\6\14\22\377\25""8S\377\265\275\303\377\332\334"
+  "\335\377\35Ff\377\13\30\"\377\0\1\1\377\1\2\2\377\6\15\22\377\26""1F\377"
+  "=f\205\377\321\324\327\377e\213\250\377S\177\242\377\303\307\312\377Y~\232"
+  "\377\36Ik\377\15\35)\377\3\6\10\377\0\1\2\377\13\30\"\377\35Ef\377\327\331"
+  "\333\377\267\276\305\377\25""8T\377\6\14\22\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\5\12\16\377\25""4L\377\246\263\275\377"
+  "\326\330\333\377.Tr\377\15\34'\377\2\4\6\377\6\15\23\377\22*<\377;^z\377"
+  "\300\306\312\377\244\260\271\377?o\225\377Q|\236\377\300\304\310\377\254"
+  "\265\273\377\202\227\250\377\23""3L\377\11\25\36\377\3\6\11\377\15\33&\377"
+  "*Qo\377\323\326\331\377\246\263\274\377\25""4N\377\5\13\17\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\3\7\11\377\23+=\377\202"
+  "\231\252\377\312\317\323\377Uu\216\377\21$4\377\7\21\30\377\22*<\377 at _x\377"
+  "\303\311\314\377\236\253\265\377\226\251\267\377f\212\246\377Q|\235\377\314"
+  "\316\317\377\177\232\260\377\330\332\335\377\217\240\256\377\20""0I\377\12"
+  "\26\40\377\21$4\377Mn\210\377\306\313\317\377\204\231\252\377\24-@\377\3"
+  "\7\12\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\1\3"
+  "\4\377\15\34(\3777Zv\377\324\326\331\377\212\240\257\377\27""5L\377\21&7"
+  "\377F`t\377\306\312\316\377\233\252\265\377/i\225\377\341\341\342\377c\211"
+  "\247\377Q|\236\377\337\336\335\377#d\226\377\212\242\265\377\325\330\333"
+  "\377\231\246\260\377\20*>\377\30""6M\377y\221\243\377\311\316\321\377Cd}"
+  "\377\16\36+\377\1\3\5\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\1\1\377\6\17\25\377\25""5N\377\251\265\277\377\312\317\323\377"
+  "\27 at a\377\21""3N\377\304\307\313\377\217\235\247\377&Uy\377(X~\377\337\341"
+  "\342\377d\214\252\377R}\240\377\341\341\341\377\33In\377\36Ii\377{\217\236"
+  "\377\331\332\333\377\20""3M\377\31Cd\377\262\272\301\377\251\263\273\377"
+  "\26""9T\377\10\20\27\377\0\1\1\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\2\5\7\377\15\35*\377/Pj\377\336\337\341\377"
+  "g\202\227\377\30>]\377z\204\214\377\24/D\377\26""1E\377\37Ge\377\337\341"
+  "\343\377d\214\253\377S~\240\377\343\343\344\377\25;X\377\22):\377\16&8\377"
+  "`mx\377\27;V\377Mm\206\377\315\321\324\377=]u\377\17!/\377\3\6\11\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\1\1\377\5\13\20\377\20&7\377Un\201\377\343\344\345\377%Hb\377\24."
+  "B\377\13\30!\377\16\37,\377\35A]\377\337\341\343\377d\214\253\377S~\241\377"
+  "\344\345\345\377\26""9T\377\15\33&\377\10\22\32\377\21&7\377\32>Y\377\274"
+  "\303\307\377ez\212\377\21*>\377\6\15\23\377\0\1\2\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\1"
+  "\2\3\377\6\16\24\377\17%6\377Qfw\377\314\317\322\377\33""4F\377\15\34)\377"
+  "\20$4\377\37Eb\377\337\341\343\377e\215\254\377S\200\243\377\346\346\347"
+  "\377\31>[\377\17!/\377\13\30#\377\17(;\377\242\252\261\377ew\205\377\20)"
+  "=\377\7\21\30\377\1\3\4\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\1\3\4\377"
+  "\6\15\23\377\14\36*\377'<L\377\243\251\256\377Q^i\377\15)@\377#Oq\377\340"
+  "\341\343\377e\215\255\377T\203\247\377\345\346\347\377!Kk\377\21,B\377,="
+  "J\377\230\237\245\377=P_\377\15!0\377\7\20\27\377\2\4\6\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\1\2\3\377\4\11\14\377\11\24"
+  "\34\377\7\30&\377<IT\377|\207\220\377u\212\231\377\316\322\325\377\177\235"
+  "\264\377i\214\247\377\332\334\336\377^x\215\377x\203\215\377[fp\377\16\40"
+  "/\377\12\27!\377\5\13\20\377\1\3\4\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\1\377\2\4\6\377\5\12\15"
+  "\377\7\21\30\377\20'9\377\37Lo\377\335\340\341\377s\222\253\377r\224\256"
+  "\377\330\333\334\3779_}\377\15';\377\11\24\34\377\5\14\21\377\2\6\10\377"
+  "\0\1\2\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\1\1\377\2\3\5\377\15\33"
+  "'\377\36C`\377\337\341\343\377e\215\255\377T\202\246\377\341\342\343\377"
+  "+Nj\377\16\37,\377\2\5\7\377\0\2\2\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\1\377\10\22\32\377\27""3I\377\342\345"
+  "\347\377`\201\233\377Ns\221\377\341\343\345\377*DX\377\11\24\35\377\0\1\1"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\5\13\20\377\20#2\377\203\216\227\377F]o\377>Vi\377\202\216"
+  "\227\377\26)8\377\6\15\21\377\0\0\1\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\2\3\5\377\6\16\22\377"
+  "\10\24\36\377\11\27!\377\12\27!\377\10\24\35\377\6\16\24\377\2\4\6\377\0"
+  "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+  "\0\0\0\377\0\0\0\377\0\0\0\377\1\2\3\377\1\3\4\377\2\4\6\377\2\4\6\377\1"
+  "\3\5\377\1\2\3\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+  "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0"
+  "\377",
+};
+
diff --git a/shared/sdl/sdl_window.cpp b/shared/sdl/sdl_window.cpp
index cd3b3f0..baa15e9 100644
--- a/shared/sdl/sdl_window.cpp
+++ b/shared/sdl/sdl_window.cpp
@@ -263,7 +263,7 @@ static bool GLimp_DetectAvailableModes(void)
 GLimp_SetMode
 ===============
 */
-static rserr_t GLimp_SetMode(glconfig_t *glConfig, graphicsApi_t graphicsApi, const char *windowTitle, int mode, qboolean fullscreen, qboolean noborder)
+static rserr_t GLimp_SetMode(glconfig_t *glConfig, const windowDesc_t *windowDesc, const char *windowTitle, int mode, qboolean fullscreen, qboolean noborder)
 {
 	int perChannelColorBits;
 	int colorBits, depthBits, stencilBits;
@@ -275,7 +275,7 @@ static rserr_t GLimp_SetMode(glconfig_t *glConfig, graphicsApi_t graphicsApi, co
 	int display = 0;
 	int x = SDL_WINDOWPOS_UNDEFINED, y = SDL_WINDOWPOS_UNDEFINED;
 
-	if ( graphicsApi == GRAPHICS_API_OPENGL )
+	if ( windowDesc->api == GRAPHICS_API_OPENGL )
 	{
 		flags |= SDL_WINDOW_OPENGL;
 	}
@@ -386,7 +386,7 @@ static rserr_t GLimp_SetMode(glconfig_t *glConfig, graphicsApi_t graphicsApi, co
 	stencilBits = r_stencilbits->integer;
 	samples = r_ext_multisample->integer;
 
-	if ( graphicsApi == GRAPHICS_API_OPENGL )
+	if ( windowDesc->api == GRAPHICS_API_OPENGL )
 	{
 		for (i = 0; i < 16; i++)
 		{
@@ -460,6 +460,41 @@ static rserr_t GLimp_SetMode(glconfig_t *glConfig, graphicsApi_t graphicsApi, co
 			SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, samples ? 1 : 0 );
 			SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, samples );
 
+			if ( windowDesc->gl.majorVersion )
+			{
+				int compactVersion = windowDesc->gl.majorVersion * 100 + windowDesc->gl.minorVersion * 10;
+
+				SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, windowDesc->gl.majorVersion );
+				SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, windowDesc->gl.minorVersion );
+
+				if ( windowDesc->gl.profile == GLPROFILE_ES || compactVersion >= 320 )
+				{
+					int profile;
+					switch ( windowDesc->gl.profile )
+					{
+					default:
+					case GLPROFILE_COMPATIBILITY:
+						profile = SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
+						break;
+
+					case GLPROFILE_CORE:
+						profile = SDL_GL_CONTEXT_PROFILE_CORE;
+						break;
+
+					case GLPROFILE_ES:
+						profile = SDL_GL_CONTEXT_PROFILE_ES;
+						break;
+					}
+
+					SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, profile );
+				}
+			}
+
+			if ( windowDesc->gl.contextFlags & GLCONTEXT_DEBUG )
+			{
+				SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG );
+			}
+
 			if(r_stereo->integer)
 			{
 				glConfig->stereoEnabled = qtrue;
@@ -559,7 +594,7 @@ static rserr_t GLimp_SetMode(glconfig_t *glConfig, graphicsApi_t graphicsApi, co
 GLimp_StartDriverAndSetMode
 ===============
 */
-static qboolean GLimp_StartDriverAndSetMode(glconfig_t *glConfig, graphicsApi_t graphicsApi, int mode, qboolean fullscreen, qboolean noborder)
+static qboolean GLimp_StartDriverAndSetMode(glconfig_t *glConfig, const windowDesc_t *windowDesc, int mode, qboolean fullscreen, qboolean noborder)
 {
 	rserr_t err;
 
@@ -598,7 +633,7 @@ static qboolean GLimp_StartDriverAndSetMode(glconfig_t *glConfig, graphicsApi_t
 		fullscreen = qfalse;
 	}
 
-	err = GLimp_SetMode(glConfig, graphicsApi, CLIENT_WINDOW_TITLE, mode, fullscreen, noborder);
+	err = GLimp_SetMode(glConfig, windowDesc, CLIENT_WINDOW_TITLE, mode, fullscreen, noborder);
 
 	switch ( err )
 	{
@@ -618,7 +653,7 @@ static qboolean GLimp_StartDriverAndSetMode(glconfig_t *glConfig, graphicsApi_t
 	return qtrue;
 }
 
-window_t WIN_Init( graphicsApi_t api, glconfig_t *glConfig )
+window_t WIN_Init( const windowDesc_t *windowDesc, glconfig_t *glConfig )
 {
 	Cmd_AddCommand("modelist", R_ModeList_f);
 	Cmd_AddCommand("minimize", GLimp_Minimize);
@@ -645,14 +680,14 @@ window_t WIN_Init( graphicsApi_t api, glconfig_t *glConfig )
 	r_ext_multisample	= Cvar_Get( "r_ext_multisample",	"0",		CVAR_ARCHIVE|CVAR_LATCH );
 
 	// Create the window and set up the context
-	if(!GLimp_StartDriverAndSetMode( glConfig, api, r_mode->integer,
+	if(!GLimp_StartDriverAndSetMode( glConfig, windowDesc, r_mode->integer,
 										(qboolean)r_fullscreen->integer, (qboolean)r_noborder->integer ))
 	{
 		if( r_mode->integer != R_MODE_FALLBACK )
 		{
 			Com_Printf( "Setting r_mode %d failed, falling back on r_mode %d\n", r_mode->integer, R_MODE_FALLBACK );
 
-			if (!GLimp_StartDriverAndSetMode( glConfig, api, R_MODE_FALLBACK, qfalse, qfalse ))
+			if (!GLimp_StartDriverAndSetMode( glConfig, windowDesc, R_MODE_FALLBACK, qfalse, qfalse ))
 			{
 				// Nothing worked, give up
 				Com_Error( ERR_FATAL, "GLimp_Init() - could not load OpenGL subsystem" );
@@ -671,7 +706,7 @@ window_t WIN_Init( graphicsApi_t api, glconfig_t *glConfig )
 	// window_t is only really useful for Windows if the renderer wants to create a D3D context.
 	window_t window = {};
 
-	window.api = api;
+	window.api = windowDesc->api;
 
 #if defined(_WIN32)
 	SDL_SysWMinfo info;
diff --git a/shared/sys/sys_public.h b/shared/sys/sys_public.h
index baf2c4c..e88dede 100644
--- a/shared/sys/sys_public.h
+++ b/shared/sys/sys_public.h
@@ -168,15 +168,34 @@ typedef struct window_s
 	graphicsApi_t api;
 } window_t;
 
-typedef struct windowCreateOptions_s
+typedef enum glProfile_e
 {
-	int openglMajorVersion;
-	int openglMinorVersion;
-	bool openglCoreContext;
-} windowCreateOptions_t;
+	GLPROFILE_COMPATIBILITY,
+	GLPROFILE_CORE,
+	GLPROFILE_ES,
+} glProfile_t;
+
+typedef enum glContextFlag_e
+{
+	GLCONTEXT_DEBUG = (1 << 1),
+} glContextFlag_t;
+
+typedef struct windowDesc_s
+{
+	graphicsApi_t api;
+
+	// Only used if api == GRAPHICS_API_OPENGL
+	struct gl_
+	{
+		int majorVersion;
+		int minorVersion;
+		glProfile_t profile;
+		uint32_t contextFlags;
+	} gl;
+} windowDesc_t;
 
 typedef struct glconfig_s glconfig_t;
-window_t	WIN_Init( graphicsApi_t api, glconfig_t *glConfig );
+window_t	WIN_Init( const windowDesc_t *desc, glconfig_t *glConfig );
 void		WIN_Present( window_t *window );
 void		WIN_SetGamma( glconfig_t *glConfig, byte red[256], byte green[256], byte blue[256] );
 void		WIN_Shutdown( void );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git



More information about the Pkg-games-commits mailing list