diff --git a/CMakeLists.txt b/CMakeLists.txt index 47efee278..b8839c6bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,11 +3,7 @@ #It uses system libraries, so it will have dependancy issues with public releases where those dependancies are distro/version-specific. #Public builds are still built using the (overcomplicated) traditional (g)makefile. -IF(${ANDROID}) - CMAKE_MINIMUM_REQUIRED(VERSION 3.6) #special dispensation for android crap. -ELSE() - CMAKE_MINIMUM_REQUIRED(VERSION 3.9) -ENDIF() +CMAKE_MINIMUM_REQUIRED(VERSION 3.0) PROJECT(fteqw) INCLUDE_DIRECTORIES( @@ -37,19 +33,81 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_C_VISIBILITY_PRESET hidden) IF(${CMAKE_VERSION} VERSION_LESS "3.9.0") - #android studio sucks and insists on using an outdated version of cmake instead of the system version. ELSE() - IF(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug") - #use LTO where possible. reportedly requires cmake 3.9 to actually work - INCLUDE(CheckIPOSupported) - check_ipo_supported(RESULT result) - IF(result) - SET(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) - ENDIF() - ENDIF() + IF(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug") + #use LTO where possible. reportedly requires cmake 3.9 to actually work + INCLUDE(CheckIPOSupported) + check_ipo_supported(RESULT result) + IF(result) + SET(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + ENDIF() + ENDIF() ENDIF() -if (CMAKE_C_COMPILER_ID MATCHES "Clang") +FIND_PACKAGE(ZLIB) +IF(NOT ZLIB_FOUND) + MESSAGE(WARNING "libz library NOT available. compressed pk3 will not be available.") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_ZLIB) + SET(ZLIB_LIBRARY m) + SET(ZLIB_LIBRARIES m) +ENDIF() + +FIND_PACKAGE(GnuTLS) +IF(NOT GNUTLS_FOUND) + MESSAGE(WARNING "gnutls library NOT available. HTTPS/DTLS will not be available.") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_GNUTLS) +ENDIF() + +FIND_PACKAGE(ALSA) +IF(NOT ALSA_FOUND) + MESSAGE(WARNING "asound (alsa) library NOT available.") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_ALSA) +ENDIF() + +FIND_PACKAGE(X11) +IF(X11_FOUND) + IF (NOT X11_Xcursor_FOUND) + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_X11_CURSOR) + MESSAGE(WARNING "Xcursor library NOT available.") + ENDIF() +ELSE() + MESSAGE(WARNING "x11 library NOT available.") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_X11) +ENDIF() + +FIND_PACKAGE(OpenGL) +IF(NOT OpenGL_FOUND) + MESSAGE(WARNING "opengl library NOT available. Will depend upon vulkan.") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_OPENGL) +ENDIF() + +FIND_PACKAGE(JPEG) +IF(NOT JPEG_FOUND) + MESSAGE(WARNING "libjpeg library NOT available. Who cares?") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_JPEG) +ENDIF() + +FIND_PACKAGE(PNG) +IF(NOT PNG_FOUND) + MESSAGE(WARNING "libpng library NOT available. Good luck with screenshots.") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_PNG) +ENDIF() + +FIND_PACKAGE(Freetype) +IF(FREETYPE_FOUND) + INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} ) +ELSE() + MESSAGE(WARNING "freetype library NOT available. I hope you're okay with ascii.") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_FREETYPE) +ENDIF() + +FIND_LIBRARY(VORBISFILE_LIBRARY NAMES vorbisfile) +IF(NOT VORBISFILE_LIBRARY) + MESSAGE(WARNING "libvorbisfile library NOT available. Who listens to the bgm anyway?") + SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_OGG) +ENDIF() + +IF(CMAKE_C_COMPILER_ID MATCHES "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-sign") endif() @@ -58,8 +116,8 @@ IF(${ANDROID}) # INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} ) - SET(FTE_DEFINES ANDROID;GLQUAKE;VKQUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;MULTITHREAD;stricmp=strcasecmp;strnicmp=strncasecmp) - SET(FTE_LIBS android log EGL z m ${CMAKE_DL_LIBS}) + SET(FTE_DEFINES ${FTE_DEFINES};ANDROID;GLQUAKE;VKQUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;MULTITHREAD;stricmp=strcasecmp;strnicmp=strncasecmp) + SET(FTE_LIBS android log EGL ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS}) SET(FTE_ARCH_FILES engine/client/sys_droid.c engine/common/sys_linux_threads.c @@ -73,8 +131,8 @@ ELSEIF(${WIN32}) # engine/server/sv_sys_win.c - SET(FTE_LIBS z ole32 gdi32 wsock32 winmm) - SET(FTE_DEFINES GLQUAKE;VKQUAKE;D3D9QUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG) #D3D11QUAKE not included. + SET(FTE_LIBS ${ZLIB_LIBRARIES} ole32 gdi32 wsock32 winmm) + SET(FTE_DEFINES ${FTE_DEFINES};GLQUAKE;VKQUAKE;D3D9QUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG) #D3D11QUAKE not included. SET(FTE_ARCH_FILES engine/client/winquake.rc engine/common/sys_win_threads.c @@ -104,7 +162,7 @@ ELSEIF(${WIN32}) engine/d3d/vid_d3d8.c ) - SET(FTESV_LIBS z wsock32 winmm) + SET(FTESV_LIBS ${ZLIB_LIBRARIES} wsock32 winmm) SET(FTESV_ARCH_FILES engine/client/winquake.rc engine/common/sys_win_threads.c @@ -114,12 +172,8 @@ ELSEIF(${WIN32}) ) ELSEIF(${UNIX}) #linux(ish) #openbsd will have issues with snd_linux.c - FIND_PACKAGE(Freetype REQUIRED) - - INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} ) - - SET(FTE_DEFINES GLQUAKE;VKQUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;DYNAMIC_SDL;MULTITHREAD;stricmp=strcasecmp;strnicmp=strncasecmp) - SET(FTE_LIBS z m ${CMAKE_DL_LIBS} pthread ${SDL2_LIBRARIES}) + SET(FTE_DEFINES ${FTE_DEFINES};GLQUAKE;VKQUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;DYNAMIC_SDL;MULTITHREAD;stricmp=strcasecmp;strnicmp=strncasecmp) + SET(FTE_LIBS ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} pthread ${SDL2_LIBRARIES}) SET(FTE_ARCH_FILES engine/client/sys_linux.c engine/common/sys_linux_threads.c @@ -141,7 +195,7 @@ ELSEIF(${UNIX}) #linux(ish) #openbsd uses a libossaudio library for all the oss stuff, use that to ensure that we still get sound FIND_LIBRARY( OSSAUDIO_LIBRARY - NAMES ossaudio + NAMES ossaudio ) IF(OSSAUDIO_LIBRARY) SET(FTE_LIBS ${FTE_LIBS} ${OSSAUDIO_LIBRARY}) @@ -157,6 +211,12 @@ ELSEIF(${UNIX}) #linux(ish) SET(FTE_ARCH_FILES ${FTE_ARCH_FILES} engine/gl/gl_vidwayland.c ) + ELSE() + MESSAGE(WARNING "Wayland library NOT available") + IF(NOT X11_FOUND) + MESSAGE(WARNING "No renderers supported!") + SET(FTE_NO_RENDERERS 1) + ENDIF() ENDIF() SET(FTESV_DEFINES MULTITHREAD;stricmp=strcasecmp;strnicmp=strncasecmp) @@ -165,9 +225,9 @@ ELSEIF(${UNIX}) #linux(ish) engine/common/sys_linux_threads.c engine/common/net_ssl_gnutls.c ) - SET(FTESV_LIBS z m ${CMAKE_DL_LIBS} pthread) + SET(FTESV_LIBS ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} pthread) ELSEIF(1) #SDL - FIND_PACKAGE(Freetype REQUIRED) +# FIND_PACKAGE(Freetype REQUIRED) # INCLUDE_DIRECTORIES(engine/libs engine/libs/freetype2/include) FIND_PACKAGE(PkgConfig REQUIRED) @@ -178,8 +238,8 @@ ELSEIF(1) #SDL INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS}) #SDL2.0.7 supports vulkan, so lets use it. - SET(FTE_DEFINES GLQUAKE;VKQUAKE;FTE_SDL;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;stricmp=strcasecmp;strnicmp=strncasecmp) - SET(FTE_LIBS z m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES}) + SET(FTE_DEFINES ${FTE_DEFINES};GLQUAKE;VKQUAKE;FTE_SDL;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;stricmp=strcasecmp;strnicmp=strncasecmp) + SET(FTE_LIBS ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES}) SET(FTE_ARCH_FILES engine/client/sys_sdl.c engine/client/snd_al.c @@ -190,7 +250,7 @@ ELSEIF(1) #SDL ) SET(FTESV_DEFINES FTE_SDL;stricmp=strcasecmp;strnicmp=strncasecmp) - SET(FTESV_LIBS z m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES}) + SET(FTESV_LIBS ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES}) IF(WIN32) SET(FTE_LIBS ${FTE_LIBS} wsock32 gdi32 ole32) @@ -420,7 +480,7 @@ SET(FTE_CLIENT_FILES engine/gl/gl_warp.c engine/gl/ltface.c -#These are GL-specific +#These are GL-specific, but can be left even if no gl is supported. engine/gl/gl_backend.c engine/gl/gl_bloom.c engine/gl/gl_draw.c @@ -430,70 +490,69 @@ SET(FTE_CLIENT_FILES engine/gl/gl_screen.c engine/gl/gl_vidcommon.c engine/gl/glmod_doom.c - + engine/vk/vk_backend.c engine/vk/vk_init.c ) IF(${ANDROID}) - #android sucks. everything is a library. so we build the engine as a shared library and completely ignore dedicated servers+tools - - ADD_LIBRARY(ftedroid MODULE - ${FTE_ARCH_FILES} - ${FTE_COMMON_FILES} - ${FTE_CLIENT_FILES} - ) - SET_TARGET_PROPERTIES(ftedroid PROPERTIES COMPILE_DEFINITIONS "${FTE_DEFINES};${FTE_REVISON}") - TARGET_LINK_LIBRARIES(ftedroid ${FTE_LIBS} ) - + #android sucks. everything is a library. so we build the engine as a shared library and completely ignore dedicated servers+tools + ADD_LIBRARY(ftedroid MODULE + ${FTE_ARCH_FILES} + ${FTE_COMMON_FILES} + ${FTE_CLIENT_FILES} + ) + SET_TARGET_PROPERTIES(ftedroid PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_DEFINES};${FTE_REVISON}") + TARGET_LINK_LIBRARIES(ftedroid ${FTE_LIBS} ) ELSE() - #systems that actually have executables... - ADD_EXECUTABLE(fteqw WIN32 - ${FTE_ARCH_FILES} - ${FTE_COMMON_FILES} - ${FTE_CLIENT_FILES} - ) + #systems that actually have executables... + ADD_EXECUTABLE(fteqw WIN32 + ${FTE_ARCH_FILES} + ${FTE_COMMON_FILES} + ${FTE_CLIENT_FILES} + ) + SET_TARGET_PROPERTIES(fteqw PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_DEFINES};${FTE_REVISON}") + TARGET_LINK_LIBRARIES(fteqw ${FTE_LIBS} ) - SET_TARGET_PROPERTIES(fteqw PROPERTIES COMPILE_DEFINITIONS "${FTE_DEFINES};${FTE_REVISON}") - TARGET_LINK_LIBRARIES(fteqw ${FTE_LIBS} ) - - ADD_EXECUTABLE(fteqw-sv - ${FTESV_ARCH_FILES} - ${FTE_COMMON_FILES} - ) - SET_TARGET_PROPERTIES(fteqw-sv PROPERTIES COMPILE_DEFINITIONS "SERVERONLY;${FTESV_DEFINES};${FTE_REVISON}") - TARGET_LINK_LIBRARIES(fteqw-sv ${FTESV_LIBS}) + ADD_EXECUTABLE(fteqw-sv + ${FTESV_ARCH_FILES} + ${FTE_COMMON_FILES} + ) + SET_TARGET_PROPERTIES(fteqw-sv PROPERTIES COMPILE_DEFINITIONS "SERVERONLY;${FTE_LIB_DEFINES};${FTESV_DEFINES};${FTE_REVISON}") + TARGET_LINK_LIBRARIES(fteqw-sv ${FTESV_LIBS}) - ADD_EXECUTABLE(fteqcc - engine/qclib/qcctui.c - engine/qclib/comprout.c - engine/qclib/hash.c - engine/qclib/qcc_cmdlib.c - engine/qclib/qcc_pr_comp.c - engine/qclib/qcc_pr_lex.c - engine/qclib/qccmain.c - engine/qclib/qcd_main.c - ) - TARGET_LINK_LIBRARIES(fteqcc z m) + ADD_EXECUTABLE(fteqcc + engine/qclib/qcctui.c + engine/qclib/comprout.c + engine/qclib/hash.c + engine/qclib/qcc_cmdlib.c + engine/qclib/qcc_pr_comp.c + engine/qclib/qcc_pr_lex.c + engine/qclib/qccmain.c + engine/qclib/qcd_main.c + ) + SET_TARGET_PROPERTIES(fteqcc PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_REVISON}") + TARGET_LINK_LIBRARIES(fteqcc ${ZLIB_LIBRARIES} m) - IF(${WIN32}) - ADD_EXECUTABLE(fteqccgui WIN32 - engine/qclib/qccgui.c - engine/qclib/qccguistuff.c - engine/qclib/comprout.c - engine/qclib/hash.c - engine/qclib/qcc_cmdlib.c - engine/qclib/qcc_pr_comp.c - engine/qclib/qcc_pr_lex.c - engine/qclib/qccmain.c - engine/qclib/decomp.c - engine/qclib/packager.c - engine/qclib/qcd_main.c - ) - TARGET_LINK_LIBRARIES(fteqccgui z shlwapi ole32 comctl32 comdlg32) - ENDIF() + IF(${WIN32}) + ADD_EXECUTABLE(fteqccgui WIN32 + engine/qclib/qccgui.c + engine/qclib/qccguistuff.c + engine/qclib/comprout.c + engine/qclib/hash.c + engine/qclib/qcc_cmdlib.c + engine/qclib/qcc_pr_comp.c + engine/qclib/qcc_pr_lex.c + engine/qclib/qccmain.c + engine/qclib/decomp.c + engine/qclib/packager.c + engine/qclib/qcd_main.c + ) + SET_TARGET_PROPERTIES(fteqccgui PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_REVISON}") + TARGET_LINK_LIBRARIES(fteqccgui ${ZLIB_LIBRARIES} shlwapi ole32 comctl32 comdlg32) + ENDIF() ENDIF() @@ -505,11 +564,11 @@ ADD_LIBRARY(qi MODULE plugins/emailnot/md5.c plugins/jabber/xml.c ) -SET_TARGET_PROPERTIES(qi PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN") +SET_TARGET_PROPERTIES(qi PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}") SET_TARGET_PROPERTIES(qi PROPERTIES PREFIX "fteplug_") #Bullet Physics library plugin -FIND_PACKAGE(Bullet) +#FIND_PACKAGE(Bullet) IF (${BULLET_FOUND}) ADD_LIBRARY(bullet MODULE plugins/qvm_api.c @@ -521,16 +580,18 @@ IF (${BULLET_FOUND}) SET_TARGET_PROPERTIES(bullet PROPERTIES PREFIX "fteplug_") ENDIF() -#Bullet Physics library plugin -#FIND_PACKAGE(ode REQUIRED) -ADD_LIBRARY(ode MODULE - plugins/qvm_api.c - plugins/plugin.c - engine/common/com_phys_ode.c -) -TARGET_INCLUDE_DIRECTORIES(ode PUBLIC ${BULLET_INCLUDE_DIRS}) -SET_TARGET_PROPERTIES(ode PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;ODE_STATIC") -SET_TARGET_PROPERTIES(ode PROPERTIES PREFIX "fteplug_") +#ODE Physics library plugin +FIND_PACKAGE(ode) +IF (${ODE_FOUND}) + ADD_LIBRARY(ode MODULE + plugins/qvm_api.c + plugins/plugin.c + engine/common/com_phys_ode.c + ) + TARGET_INCLUDE_DIRECTORIES(ode PUBLIC ${ODE_INCLUDE_DIRS}) + SET_TARGET_PROPERTIES(ode PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;ODE_STATIC") + SET_TARGET_PROPERTIES(ode PROPERTIES PREFIX "fteplug_") +ENDIF() #EzQuake Hud port plugin ADD_LIBRARY(ezhud MODULE @@ -541,7 +602,7 @@ ADD_LIBRARY(ezhud MODULE plugins/ezhud/hud_common.c plugins/ezhud/hud_editor.c ) -SET_TARGET_PROPERTIES(ezhud PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN") +SET_TARGET_PROPERTIES(ezhud PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}") SET_TARGET_PROPERTIES(ezhud PROPERTIES PREFIX "fteplug_") #IRC client plugin @@ -550,23 +611,23 @@ ADD_LIBRARY(irc MODULE plugins/plugin.c plugins/irc/ircclient.c ) -SET_TARGET_PROPERTIES(irc PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN") +SET_TARGET_PROPERTIES(irc PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}") SET_TARGET_PROPERTIES(irc PROPERTIES PREFIX "fteplug_") IF(NOT ${ANDROID}) - #XMPP/jabber client plugin - ADD_LIBRARY(xmpp MODULE - plugins/qvm_api.c - plugins/plugin.c - plugins/jabber/jabberclient.c - plugins/jabber/xml.c - plugins/jabber/jingle.c - plugins/jabber/sift.c - engine/common/sha1.c - plugins/emailnot/md5.c - ) - SET_TARGET_PROPERTIES(xmpp PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN") - SET_TARGET_PROPERTIES(xmpp PROPERTIES PREFIX "fteplug_") + #XMPP/jabber client plugin + ADD_LIBRARY(xmpp MODULE + plugins/qvm_api.c + plugins/plugin.c + plugins/jabber/jabberclient.c + plugins/jabber/xml.c + plugins/jabber/jingle.c + plugins/jabber/sift.c + engine/common/sha1.c + plugins/emailnot/md5.c + ) + SET_TARGET_PROPERTIES(xmpp PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}") + SET_TARGET_PROPERTIES(xmpp PROPERTIES PREFIX "fteplug_") ENDIF() #ffmpeg plugin diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 026b4d649..bf2c308bb 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -1454,7 +1454,22 @@ qboolean R_ApplyRenderer_Load (rendererstate_t *newr) if (newr->fullscreen == 2) Con_TPrintf("Setting fullscreen windowed %s%s\n", newr->srgb?"SRGB ":"", newr->renderer->description); else if (newr->fullscreen) - Con_TPrintf("Setting mode %i*%i %ibpp %ihz %s%s\n", newr->width, newr->height, newr->bpp, newr->rate, newr->srgb?"SRGB ":"", newr->renderer->description); + { + if (newr->rate) + { + if (newr->width || newr->height) + Con_TPrintf("Setting mode %i*%i %ibpp %ihz %s%s\n", newr->width, newr->height, newr->bpp, newr->rate, newr->srgb?"SRGB ":"", newr->renderer->description); + else + Con_TPrintf("Setting mode auto %ibpp %ihz %s%s\n", newr->bpp, newr->rate, newr->srgb?"SRGB ":"", newr->renderer->description); + } + else + { + if (newr->width || newr->height) + Con_TPrintf("Setting mode %i*%i %ibpp %s%s\n", newr->width, newr->height, newr->bpp, newr->srgb?"SRGB ":"", newr->renderer->description); + else + Con_TPrintf("Setting mode auto %ibpp %s%s\n", newr->bpp, newr->srgb?"SRGB ":"", newr->renderer->description); + } + } else Con_TPrintf("Setting windowed mode %i*%i %s%s\n", newr->width, newr->height, newr->srgb?"SRGB ":"", newr->renderer->description); } @@ -2090,19 +2105,19 @@ void R_RestartRenderer (rendererstate_t *newr) if (failed && newr->fullscreen == 1) { - Con_Printf(CON_NOTICE "Trying fullscreen windowed\n"); + Con_Printf(CON_NOTICE "Trying fullscreen windowed"CON_DEFAULT"\n"); newr->fullscreen = 2; failed = !R_ApplyRenderer(newr); } if (failed && newr->rate != 0) { - Con_Printf(CON_NOTICE "Trying default refresh rate\n"); + Con_Printf(CON_NOTICE "Trying default refresh rate"CON_DEFAULT"\n"); newr->rate = 0; failed = !R_ApplyRenderer(newr); } if (failed && newr->width != DEFAULT_WIDTH && newr->height != DEFAULT_HEIGHT) { - Con_Printf(CON_NOTICE "Trying %i*%i\n", DEFAULT_WIDTH, DEFAULT_HEIGHT); + Con_Printf(CON_NOTICE "Trying %i*%i"CON_DEFAULT"\n", DEFAULT_WIDTH, DEFAULT_HEIGHT); if (newr->fullscreen == 2) newr->fullscreen = 1; newr->width = DEFAULT_WIDTH; @@ -2111,7 +2126,7 @@ void R_RestartRenderer (rendererstate_t *newr) } if (failed && newr->fullscreen) { - Con_Printf(CON_NOTICE "Trying windowed\n"); + Con_Printf(CON_NOTICE "Trying windowed"CON_DEFAULT"\n"); newr->fullscreen = 0; failed = !R_ApplyRenderer(newr); } @@ -2122,7 +2137,7 @@ void R_RestartRenderer (rendererstate_t *newr) newr->renderer = rendererinfo[i]; if (newr->renderer && newr->renderer != skip && newr->renderer->rtype != QR_HEADLESS) { - Con_Printf(CON_NOTICE "Trying %s\n", newr->renderer->description); + Con_Printf(CON_NOTICE "Trying %s"CON_DEFAULT"\n", newr->renderer->description); failed = !R_ApplyRenderer(newr); } } diff --git a/engine/client/snd_alsa.c b/engine/client/snd_alsa.c index adae19e1d..ed046a185 100755 --- a/engine/client/snd_alsa.c +++ b/engine/client/snd_alsa.c @@ -29,7 +29,7 @@ //I guess noone can be arsed to write it themselves. :/ // //This file is otherwise known as 'will the linux jokers please stop fucking over the open sound system please' - +#ifndef NO_ALSA #include #include "quakedef.h" @@ -588,3 +588,5 @@ sounddriver_t ALSA_Output = ALSA_InitCard, ALSA_Enumerate }; +#endif + diff --git a/engine/client/sys_linux.c b/engine/client/sys_linux.c index f2986e822..3190fdca4 100644 --- a/engine/client/sys_linux.c +++ b/engine/client/sys_linux.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //well, linux or cygwin (windows with posix emulation layer), anyway... #ifndef _GNU_SOURCE -#define _GNU_SOURCE +# define _GNU_SOURCE #endif #include #include @@ -37,8 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #if !defined(__CYGWIN__) && !defined(__DJGPP__) -#include -#include +# include +# include #endif #include #include @@ -46,11 +46,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#if !defined(__MACOSX__) && !defined(__DJGPP__) -#include +#ifndef NO_X11 +# if !defined(__MACOSX__) && !defined(__DJGPP__) && !defined(NO_X11) +# include +# else +# define NO_X11 +# endif #endif #ifdef MULTITHREAD -#include +# include #endif #ifdef __CYGWIN__ @@ -1046,7 +1050,7 @@ void Sys_ServerActivity(void) //from the OS. This will cause problems with framebuffer-only setups. qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate) { -#if defined(__MACOSX__) || defined(__DJGPP__) +#if defined(NO_X11) //this about sums up the problem with this function return false; #else diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index c8a9a0bc0..4cac1a4f3 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -606,6 +606,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef AVAIL_XZDEC #undef AVAIL_GZDEC #endif +#ifdef NO_GNUTLS + #undef HAVE_GNUTLS +#endif +#ifdef NO_OPENGL + #undef GLQUAKE + #undef USE_EGL +#endif #if defined(HAVE_WINSSPI) || defined(HAVE_GNUTLS) #define HAVE_SSL diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 87acc1cef..943200dc6 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -2555,28 +2555,6 @@ static qboolean CModQ3_LoadFogs (model_t *mod, qbyte *mod_base, lump_t *l) return true; } -image_t *Mod_CubemapForOrigin(model_t *wmodel, vec3_t org) -{ - int i; - menvmap_t *e; - float bestdist = FLT_MAX, dist; - image_t *ret = NULL; - vec3_t move; - if (!wmodel || wmodel->loadstate != MLS_LOADED) - return NULL; - for ( i=0 , e=wmodel->envmaps ; inumenvmaps ; i++, e++) - { - VectorSubtract(org, e->origin, move); - dist = DotProduct(move,move); - if (bestdist > dist) - { - bestdist = dist; - ret = e->image; - } - } - return ret; -} - mfog_t *Mod_FogForOrigin(model_t *wmodel, vec3_t org) { int i, j; diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 3ed5cbec7..f76fcc8ff 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -2813,4 +2813,27 @@ void Mod_BSPX_Strip_f(void) Mod_BSPXRW_Free(&ctx); } } + +image_t *Mod_CubemapForOrigin(model_t *wmodel, vec3_t org) +{ + int i; + menvmap_t *e; + float bestdist = FLT_MAX, dist; + image_t *ret = NULL; + vec3_t move; + if (!wmodel || wmodel->loadstate != MLS_LOADED) + return NULL; + for ( i=0 , e=wmodel->envmaps ; inumenvmaps ; i++, e++) + { + VectorSubtract(org, e->origin, move); + dist = DotProduct(move,move); + if (bestdist > dist) + { + bestdist = dist; + ret = e->image; + } + } + return ret; +} + #endif diff --git a/engine/gl/gl_vidlinuxglx.c b/engine/gl/gl_vidlinuxglx.c index 7225ae9c1..1c54fd61b 100644 --- a/engine/gl/gl_vidlinuxglx.c +++ b/engine/gl/gl_vidlinuxglx.c @@ -54,6 +54,9 @@ none of these issues will be fixed by a compositing window manager, because ther #include #include "quakedef.h" + +#ifndef NO_X11 + #include #include #include @@ -2627,6 +2630,7 @@ static Cursor CreateNullCursor(Display *display, Window root) return cursor; } +#ifndef NO_X11_CURSOR #include static struct { @@ -2805,7 +2809,11 @@ static qboolean XCursor_Init(void) Con_Printf("Hardware cursors unsupported.\n"); return false; } - +#else +static qboolean XCursor_Init(void) +{ +} +#endif qboolean GLVID_ApplyGammaRamps(unsigned int rampcount, unsigned short *ramps) { @@ -3191,7 +3199,7 @@ qboolean X11VID_Init (rendererstate_t *info, unsigned char *palette, int psl) { if (!Sys_LoadLibrary("libvulkan.so", func)) { - Con_Printf("Couldn't intialise libvulkan.so\nvulkan loader is not installed\n"); + Con_Printf(CON_ERROR"Couldn't load libvulkan.so\nvulkan loader is not installed\n"); return false; } } @@ -3474,164 +3482,6 @@ static qboolean VKVID_Init (rendererstate_t *info, unsigned char *palette) } #endif -void Sys_SendKeyEvents(void) -{ -#ifndef CLIENTONLY - //this is stupid - SV_GetConsoleCommands(); -#endif - if (sys_gracefulexit) - { - Cbuf_AddText("\nquit\n", RESTRICT_LOCAL); - sys_gracefulexit = false; - } - if (vid_dpy && vid_window) - { - while (x11.pXPending(vid_dpy)) - GetEvent(); - - if (modeswitchpending && modeswitchtime < Sys_Milliseconds()) - { - UpdateGrabs(); - if (modeswitchpending > 0 && !(fullscreenflags & FULLSCREEN_ACTIVE)) - { - //entering fullscreen mode -#ifdef USE_VMODE - if (fullscreenflags & FULLSCREEN_VMODE) - { - if (!(fullscreenflags & FULLSCREEN_VMODEACTIVE)) - { - // change to the mode - vm.pXF86VidModeSwitchToMode(vid_dpy, scrnum, vm.modes[vm.usemode]); - fullscreenflags |= FULLSCREEN_VMODEACTIVE; - // Move the viewport to top left - } - vm.pXF86VidModeSetViewPort(vid_dpy, scrnum, 0, 0); - } -#endif -#ifdef USE_XRANDR - if (fullscreenflags & FULLSCREEN_XRANDR) - XRandR_ApplyMode(); -#endif - Cvar_ForceCallback(&v_gamma); - - /*release the mouse now, because we're paranoid about clip regions*/ - if (fullscreenflags & FULLSCREEN_WM) - X_GoFullscreen(); - if (fullscreenflags & FULLSCREEN_LEGACY) - { - x11.pXReparentWindow(vid_dpy, vid_window, vid_root, fullscreenx, fullscreeny); - // if (vid_decoywindow) - // x11.pXMoveWindow(vid_dpy, vid_decoywindow, fullscreenx, fullscreeny); - //x11.pXUnmapWindow(vid_dpy, vid_decoywindow); - //make sure we have it - x11.pXSetInputFocus(vid_dpy, vid_window, RevertToParent, CurrentTime); - x11.pXRaiseWindow(vid_dpy, vid_window); - x11.pXMoveResizeWindow(vid_dpy, vid_window, fullscreenx, fullscreeny, fullscreenwidth, fullscreenheight); - } - if (fullscreenflags) - fullscreenflags |= FULLSCREEN_ACTIVE; - } - if (modeswitchpending < 0) - { - //leave fullscreen mode - if (!COM_CheckParm("-stayactive")) - { //a parameter that leaves the program fullscreen if you taskswitch. - //sounds pointless, works great with two moniters. :D -#ifdef USE_VMODE - if (fullscreenflags & FULLSCREEN_VMODE) - { - if (vm.originalapplied) - vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, vm.originalrampsize, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]); - if (fullscreenflags & FULLSCREEN_VMODEACTIVE) - { - vm.pXF86VidModeSwitchToMode(vid_dpy, scrnum, vm.modes[0]); - fullscreenflags &= ~FULLSCREEN_VMODEACTIVE; - } - } -#endif -#ifdef USE_XRANDR - if (fullscreenflags & FULLSCREEN_XRANDR) - XRandR_RevertMode(); -#endif - if (fullscreenflags & FULLSCREEN_WM) - X_GoWindowed(); - if (fullscreenflags & FULLSCREEN_LEGACY) - { - x11.pXReparentWindow(vid_dpy, vid_window, vid_decoywindow, 0, 0); -// x11.pXMoveResizeWindow(vid_dpy, vid_decoywindow, fullscreenx + (fullscreenwidth-640)/2, fullscreeny + (fullscreenheight-480)/2, 640, 480); - x11.pXMapWindow(vid_dpy, vid_decoywindow); - } - fullscreenflags &= ~FULLSCREEN_ACTIVE; - } - } - modeswitchpending = 0; - } - - if (modeswitchpending) - return; - - UpdateGrabs(); - } -} - -void Force_CenterView_f (void) -{ - cl.playerview[0].viewangles[PITCH] = 0; -} - - -//these are done from the x11 event handler. we don't support evdev. -void INS_Move(void) -{ -} -void INS_Commands(void) -{ -} -void INS_Init(void) -{ -} -void INS_ReInit(void) -{ -} -void INS_Shutdown(void) -{ -} -void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, unsigned int *qdevid)) -{ - callback(ctx, "keyboard", "x11", NULL); - switch(x11_input_method) - { - case XIM_ORIG: - callback(ctx, "mouse", "x11", &x11_mouseqdev); - break; - case XIM_DGA: - callback(ctx, "mouse", "dga", &x11_mouseqdev); - break; - case XIM_XI2: - { - int i, devs; - XIDeviceInfo *dev = xi2.pXIQueryDevice(vid_dpy, xi2.devicegroup, &devs); - for (i = 0; i < devs; i++) - { - if (!dev[i].enabled) - continue; - if (/*dev[i].use == XIMasterPointer ||*/ dev[i].use == XISlavePointer) - { - struct xidevinfo *devi = XI2_GetDeviceInfo(dev[i].deviceid); - callback(ctx, devi->abs?"tablet":"mouse", dev[i].name, &devi->qdev); - } -// else if (dev[i].use == XIMasterKeyboard || dev[i].use == XISlaveKeyboard) -// { -// int qdev = dev[i].deviceid; -// callback(ctx, "xi2kb", dev[i].name, &qdev); -// } - } - xi2.pXIFreeDeviceInfo(dev); - } - break; - } -} void GLVID_SetCaption(const char *text) { @@ -3868,4 +3718,172 @@ qboolean X11_GetDesktopParameters(int *width, int *height, int *bpp, int *refres return true; } +#endif + + + + +void Sys_SendKeyEvents(void) +{ +#ifndef CLIENTONLY + //this is stupid + SV_GetConsoleCommands(); +#endif + +#ifndef NO_X11 + if (sys_gracefulexit) + { + Cbuf_AddText("\nquit\n", RESTRICT_LOCAL); + sys_gracefulexit = false; + } + if (vid_dpy && vid_window) + { + while (x11.pXPending(vid_dpy)) + GetEvent(); + + if (modeswitchpending && modeswitchtime < Sys_Milliseconds()) + { + UpdateGrabs(); + if (modeswitchpending > 0 && !(fullscreenflags & FULLSCREEN_ACTIVE)) + { + //entering fullscreen mode +#ifdef USE_VMODE + if (fullscreenflags & FULLSCREEN_VMODE) + { + if (!(fullscreenflags & FULLSCREEN_VMODEACTIVE)) + { + // change to the mode + vm.pXF86VidModeSwitchToMode(vid_dpy, scrnum, vm.modes[vm.usemode]); + fullscreenflags |= FULLSCREEN_VMODEACTIVE; + // Move the viewport to top left + } + vm.pXF86VidModeSetViewPort(vid_dpy, scrnum, 0, 0); + } +#endif +#ifdef USE_XRANDR + if (fullscreenflags & FULLSCREEN_XRANDR) + XRandR_ApplyMode(); +#endif + Cvar_ForceCallback(&v_gamma); + + /*release the mouse now, because we're paranoid about clip regions*/ + if (fullscreenflags & FULLSCREEN_WM) + X_GoFullscreen(); + if (fullscreenflags & FULLSCREEN_LEGACY) + { + x11.pXReparentWindow(vid_dpy, vid_window, vid_root, fullscreenx, fullscreeny); + // if (vid_decoywindow) + // x11.pXMoveWindow(vid_dpy, vid_decoywindow, fullscreenx, fullscreeny); + //x11.pXUnmapWindow(vid_dpy, vid_decoywindow); + //make sure we have it + x11.pXSetInputFocus(vid_dpy, vid_window, RevertToParent, CurrentTime); + x11.pXRaiseWindow(vid_dpy, vid_window); + x11.pXMoveResizeWindow(vid_dpy, vid_window, fullscreenx, fullscreeny, fullscreenwidth, fullscreenheight); + } + if (fullscreenflags) + fullscreenflags |= FULLSCREEN_ACTIVE; + } + if (modeswitchpending < 0) + { + //leave fullscreen mode + if (!COM_CheckParm("-stayactive")) + { //a parameter that leaves the program fullscreen if you taskswitch. + //sounds pointless, works great with two moniters. :D +#ifdef USE_VMODE + if (fullscreenflags & FULLSCREEN_VMODE) + { + if (vm.originalapplied) + vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, vm.originalrampsize, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]); + if (fullscreenflags & FULLSCREEN_VMODEACTIVE) + { + vm.pXF86VidModeSwitchToMode(vid_dpy, scrnum, vm.modes[0]); + fullscreenflags &= ~FULLSCREEN_VMODEACTIVE; + } + } +#endif +#ifdef USE_XRANDR + if (fullscreenflags & FULLSCREEN_XRANDR) + XRandR_RevertMode(); +#endif + if (fullscreenflags & FULLSCREEN_WM) + X_GoWindowed(); + if (fullscreenflags & FULLSCREEN_LEGACY) + { + x11.pXReparentWindow(vid_dpy, vid_window, vid_decoywindow, 0, 0); +// x11.pXMoveResizeWindow(vid_dpy, vid_decoywindow, fullscreenx + (fullscreenwidth-640)/2, fullscreeny + (fullscreenheight-480)/2, 640, 480); + x11.pXMapWindow(vid_dpy, vid_decoywindow); + } + fullscreenflags &= ~FULLSCREEN_ACTIVE; + } + } + modeswitchpending = 0; + } + + if (modeswitchpending) + return; + + UpdateGrabs(); + } +#endif +} + +void Force_CenterView_f (void) +{ + cl.playerview[0].viewangles[PITCH] = 0; +} + + +//these are done from the x11 event handler. we don't support evdev. +void INS_Move(void) +{ +} +void INS_Commands(void) +{ +} +void INS_Init(void) +{ +} +void INS_ReInit(void) +{ +} +void INS_Shutdown(void) +{ +} +void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, unsigned int *qdevid)) +{ +#ifndef NO_X11 + callback(ctx, "keyboard", "x11", NULL); + switch(x11_input_method) + { + case XIM_ORIG: + callback(ctx, "mouse", "x11", &x11_mouseqdev); + break; + case XIM_DGA: + callback(ctx, "mouse", "dga", &x11_mouseqdev); + break; + case XIM_XI2: + { + int i, devs; + XIDeviceInfo *dev = xi2.pXIQueryDevice(vid_dpy, xi2.devicegroup, &devs); + for (i = 0; i < devs; i++) + { + if (!dev[i].enabled) + continue; + if (/*dev[i].use == XIMasterPointer ||*/ dev[i].use == XISlavePointer) + { + struct xidevinfo *devi = XI2_GetDeviceInfo(dev[i].deviceid); + callback(ctx, devi->abs?"tablet":"mouse", dev[i].name, &devi->qdev); + } +// else if (dev[i].use == XIMasterKeyboard || dev[i].use == XISlaveKeyboard) +// { +// int qdev = dev[i].deviceid; +// callback(ctx, "xi2kb", dev[i].name, &qdev); +// } + } + xi2.pXIFreeDeviceInfo(dev); + } + break; + } +#endif +} diff --git a/engine/qclib/qcd_main.c b/engine/qclib/qcd_main.c index 9f18cc39b..b3e4b149d 100644 --- a/engine/qclib/qcd_main.c +++ b/engine/qclib/qcd_main.c @@ -1,12 +1,16 @@ #include "progsint.h" #include "qcc.h" -#if !defined(NO_ZLIB) && !defined(FTE_TARGET_WEB) && !defined(NACL) && !defined(_XBOX) +#if !defined(FTE_TARGET_WEB) && !defined(NACL) && !defined(_XBOX) #ifndef AVAIL_ZLIB #define AVAIL_ZLIB #endif #endif +#ifdef NO_ZLIB +#undef AVAIL_ZLIB +#endif + #ifdef AVAIL_ZLIB #ifdef _WIN32 #define ZEXPORT VARGS diff --git a/engine/vk/vkrenderer.h b/engine/vk/vkrenderer.h index bccc09964..823a4a9d1 100644 --- a/engine/vk/vkrenderer.h +++ b/engine/vk/vkrenderer.h @@ -8,14 +8,17 @@ #define VK_USE_PLATFORM_ANDROID_KHR #define VKInstXLibFuncs VKFunc(CreateAndroidSurfaceKHR) #elif defined(__linux__) - #define VK_USE_PLATFORM_XLIB_KHR - #define VKInstXLibFuncs VKFunc(CreateXlibSurfaceKHR) + #ifndef NO_X11 + #define VK_USE_PLATFORM_XLIB_KHR + #define VKInstXLibFuncs VKFunc(CreateXlibSurfaceKHR) - #define VK_USE_PLATFORM_XCB_KHR - #define VKInstXCBFuncs VKFunc(CreateXcbSurfaceKHR) - - #define VK_USE_PLATFORM_WAYLAND_KHR - #define VKInstWaylandFuncs VKFunc(CreateWaylandSurfaceKHR) + #define VK_USE_PLATFORM_XCB_KHR + #define VKInstXCBFuncs VKFunc(CreateXcbSurfaceKHR) + #endif + #ifdef WAYLANDQUAKE + #define VK_USE_PLATFORM_WAYLAND_KHR + #define VKInstWaylandFuncs VKFunc(CreateWaylandSurfaceKHR) + #endif #elif defined(__FreeBSD__) || defined(__OpenBSD__) #define VK_USE_PLATFORM_XLIB_KHR #define VKInstXLibFuncs VKFunc(CreateXlibSurfaceKHR)