1
0
Fork 0
forked from fte/fteqw

Compile fixes (mostly focused on windows)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5533 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-09-04 23:39:39 +00:00
parent 200ec8c246
commit 5fa6e12d56
11 changed files with 142 additions and 116 deletions

View file

@ -155,7 +155,7 @@ IF(${ANDROID})
# INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} )
SET(FTE_DEFINES ${FTE_DEFINES};ANDROID;VKQUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;MULTITHREAD;stricmp=strcasecmp;strnicmp=strncasecmp)
SET(FTE_DEFINES ${FTE_DEFINES};ANDROID;VKQUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;MULTITHREAD)
SET(FTE_LIBS ${FTE_LIBS} android log EGL ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS})
SET(FTE_ARCH_FILES
engine/client/sys_droid.c
@ -236,7 +236,7 @@ ELSEIF(${UNIX}) #linux(ish)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_X11)
ENDIF()
SET(FTE_DEFINES ${FTE_DEFINES};DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;DYNAMIC_SDL;MULTITHREAD;stricmp=strcasecmp;strnicmp=strncasecmp)
SET(FTE_DEFINES ${FTE_DEFINES};DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;DYNAMIC_SDL;MULTITHREAD)
SET(FTE_LIBS ${FTE_LIBS} ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} pthread ${SDL2_LIBRARIES})
SET(FTE_ARCH_FILES
engine/client/sys_linux.c
@ -285,7 +285,7 @@ ELSEIF(${UNIX}) #linux(ish)
ENDIF()
ENDIF()
SET(FTESV_DEFINES MULTITHREAD;stricmp=strcasecmp;strnicmp=strncasecmp)
SET(FTESV_DEFINES MULTITHREAD)
SET(FTESV_ARCH_FILES
engine/server/sv_sys_unix.c
engine/common/sys_linux_threads.c
@ -310,7 +310,7 @@ ELSEIF(1) #SDL
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS})
#SDL2.0.7 supports vulkan, so lets use it.
SET(FTE_DEFINES ${FTE_DEFINES};FTE_SDL;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG;stricmp=strcasecmp;strnicmp=strncasecmp)
SET(FTE_DEFINES ${FTE_DEFINES};FTE_SDL;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG)
SET(FTE_LIBS ${FTE_LIBS} ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES})
SET(FTE_ARCH_FILES
engine/client/sys_sdl.c
@ -321,7 +321,7 @@ ELSEIF(1) #SDL
engine/gl/gl_vidsdl.c
)
SET(FTESV_DEFINES FTE_SDL;stricmp=strcasecmp;strnicmp=strncasecmp)
SET(FTESV_DEFINES FTE_SDL)
SET(FTESV_LIBS ${FTESV_LIBS} ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES})
IF(WIN32)
@ -774,7 +774,7 @@ ELSE()
fteqtv/libqtvc/glibc_sucks.c
engine/common/sha1.c
)
SET_TARGET_PROPERTIES(qtv PROPERTIES COMPILE_DEFINITIONS "${FTE_REVISON};stricmp=strcasecmp;strnicmp=strncasecmp")
SET_TARGET_PROPERTIES(qtv PROPERTIES COMPILE_DEFINITIONS "${FTE_REVISON}")
IF(WIN32)
TARGET_LINK_LIBRARIES(qtv ${ZLIB_LIBRARIES} ws2_32 winmm)
ELSE()
@ -810,7 +810,7 @@ ELSE()
engine/http/iwebiface.c
engine/http/ftpserver.c
)
SET_TARGET_PROPERTIES(httpserver PROPERTIES COMPILE_DEFINITIONS "WEBSERVER;WEBSVONLY;${FTE_REVISON};stricmp=strcasecmp;strnicmp=strncasecmp")
SET_TARGET_PROPERTIES(httpserver PROPERTIES COMPILE_DEFINITIONS "WEBSERVER;WEBSVONLY;${FTE_REVISON}")
IF(WIN32)
TARGET_LINK_LIBRARIES(httpserver ${ZLIB_LIBRARIES} ws2_32)
ENDIF()

View file

@ -5158,7 +5158,7 @@ void Media_Init(void)
Cvar_Register(&tts_mode, "Gimmicks");
#endif
#ifdef AVAIL_MP3_ACM
S_RegisterSoundInputPlugin(S_LoadMP3Sound);
S_RegisterSoundInputPlugin(NULL, S_LoadMP3Sound);
#endif

View file

@ -783,6 +783,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FTE_UNREACHABLE Sys_Error("Unreachable reached: %s %i\n", __FILE__, __LINE__)
#endif
#ifdef _WIN32
//Windows-specific...
#define stricmp _stricmp
#define strnicmp _strnicmp
#else
//Posix
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
#define CACHE_SIZE 32 // used to align key data structures

View file

@ -322,33 +322,47 @@ qboolean D3D11_LoadTextureMips(image_t *tex, const struct pendingtextureinfo *mi
case PTI_EAC_R11_SNORM:
case PTI_EAC_RG11:
case PTI_EAC_RG11_SNORM:
case PTI_ASTC_4X4: //not invented here...
case PTI_ASTC_4X4_LDR: //not invented here...
case PTI_ASTC_5X4_LDR:
case PTI_ASTC_5X5_LDR:
case PTI_ASTC_6X5_LDR:
case PTI_ASTC_6X6_LDR:
case PTI_ASTC_8X5_LDR:
case PTI_ASTC_8X6_LDR:
case PTI_ASTC_10X5_LDR:
case PTI_ASTC_10X6_LDR:
case PTI_ASTC_8X8_LDR:
case PTI_ASTC_10X8_LDR:
case PTI_ASTC_10X10_LDR:
case PTI_ASTC_12X10_LDR:
case PTI_ASTC_12X12_LDR:
case PTI_ASTC_4X4_HDR:
case PTI_ASTC_5X4_HDR:
case PTI_ASTC_5X5_HDR:
case PTI_ASTC_6X5_HDR:
case PTI_ASTC_6X6_HDR:
case PTI_ASTC_8X5_HDR:
case PTI_ASTC_8X6_HDR:
case PTI_ASTC_10X5_HDR:
case PTI_ASTC_10X6_HDR:
case PTI_ASTC_8X8_HDR:
case PTI_ASTC_10X8_HDR:
case PTI_ASTC_10X10_HDR:
case PTI_ASTC_12X10_HDR:
case PTI_ASTC_12X12_HDR:
case PTI_ASTC_4X4_SRGB:
case PTI_ASTC_5X4:
case PTI_ASTC_5X4_SRGB:
case PTI_ASTC_5X5:
case PTI_ASTC_5X5_SRGB:
case PTI_ASTC_6X5:
case PTI_ASTC_6X5_SRGB:
case PTI_ASTC_6X6:
case PTI_ASTC_6X6_SRGB:
case PTI_ASTC_8X5:
case PTI_ASTC_8X5_SRGB:
case PTI_ASTC_8X6:
case PTI_ASTC_8X6_SRGB:
case PTI_ASTC_10X5:
case PTI_ASTC_10X5_SRGB:
case PTI_ASTC_10X6:
case PTI_ASTC_10X6_SRGB:
case PTI_ASTC_8X8:
case PTI_ASTC_8X8_SRGB:
case PTI_ASTC_10X8:
case PTI_ASTC_10X8_SRGB:
case PTI_ASTC_10X10:
case PTI_ASTC_10X10_SRGB:
case PTI_ASTC_12X10:
case PTI_ASTC_12X10_SRGB:
case PTI_ASTC_12X12:
case PTI_ASTC_12X12_SRGB:
#ifdef FTE_TARGET_WEB
case PTI_WHOLEFILE: //basically webgl only...

View file

@ -970,7 +970,6 @@ static qboolean (D3D9_SCR_UpdateScreen) (void)
{
//extern int keydown[];
//extern cvar_t vid_conheight;
int uimenu;
#ifdef TEXTEDITOR
//extern qboolean editormodal;
#endif
@ -1065,12 +1064,6 @@ static qboolean (D3D9_SCR_UpdateScreen) (void)
Shader_DoReload();
#ifdef VM_UI
uimenu = UI_MenuState();
#else
uimenu = 0;
#endif
d3d9error(IDirect3DDevice9_BeginScene(pD3DDev9));
/*
#ifdef TEXTEDITOR
@ -1093,19 +1086,6 @@ static qboolean (D3D9_SCR_UpdateScreen) (void)
D3D9_Set2D();
if (Media_ShowFilm())
{
M_Draw(0);
// V_UpdatePalette (false);
Media_RecordFrame();
// R2D_BrightenScreen();
if (R2D_Flush)
R2D_Flush();
IDirect3DDevice9_EndScene(pD3DDev9);
D3D9_VID_SwapBuffers();
return true;
}
//
// do 3D refresh drawing, and then update the screen
//
@ -1114,25 +1094,20 @@ static qboolean (D3D9_SCR_UpdateScreen) (void)
noworld = false;
nohud = false;
#ifdef VM_CG
if (CG_Refresh())
if (topmenu && topmenu->isopaque)
nohud = true;
#ifdef VM_CG
else if (CG_Refresh())
nohud = true;
else
#endif
#ifdef CSQC_DAT
if (CSQC_DrawView())
else if (CSQC_DrawView())
nohud = true;
else
#endif
if (uimenu != 1)
{
if (r_worldentity.model && cls.state == ca_active)
V_RenderView (nohud);
else
{
noworld = true;
}
}
else if (r_worldentity.model && cls.state == ca_active)
V_RenderView (nohud);
else
noworld = true;
R2D_BrightenScreen();
@ -1147,7 +1122,7 @@ static qboolean (D3D9_SCR_UpdateScreen) (void)
nohud = true;
}
SCR_DrawTwoDimensional(uimenu, nohud);
SCR_DrawTwoDimensional(nohud);
V_UpdatePalette (false);
Media_RecordFrame();

View file

@ -1316,7 +1316,6 @@ static qboolean (D3D11_SCR_UpdateScreen) (void)
{
//extern int keydown[];
//extern cvar_t vid_conheight;
int uimenu;
#ifdef TEXTEDITOR
//extern qboolean editormodal;
#endif
@ -1369,12 +1368,6 @@ static qboolean (D3D11_SCR_UpdateScreen) (void)
Shader_DoReload();
#ifdef VM_UI
uimenu = UI_MenuState();
#else
uimenu = 0;
#endif
// d3d11error(IDirect3DDevice9_BeginScene(pD3DDev9));
/*
#ifdef TEXTEDITOR
@ -1394,16 +1387,6 @@ static qboolean (D3D11_SCR_UpdateScreen) (void)
}
#endif
*/
if (Media_ShowFilm())
{
M_Draw(0);
// V_UpdatePalette (false);
Media_RecordFrame();
// R2D_BrightenScreen();
// IDirect3DDevice9_EndScene(pD3DDev9);
D3D11_PresentOrCrash();
return true;
}
//
// do 3D refresh drawing, and then update the screen
@ -1413,25 +1396,20 @@ static qboolean (D3D11_SCR_UpdateScreen) (void)
noworld = false;
nohud = false;
#ifdef VM_CG
if (CG_Refresh())
if (topmenu && topmenu->isopaque)
nohud = true;
#ifdef VM_CG
else if (CG_Refresh())
nohud = true;
else
#endif
#ifdef CSQC_DAT
if (CSQC_DrawView())
else if (CSQC_DrawView())
nohud = true;
else
#endif
if (uimenu != 1)
{
if (r_worldentity.model && cls.state == ca_active)
V_RenderView (nohud);
else
{
noworld = true;
}
}
else if (r_worldentity.model && cls.state == ca_active)
V_RenderView (nohud);
else
noworld = true;
D3D11_Set2D();
@ -1454,7 +1432,7 @@ static qboolean (D3D11_SCR_UpdateScreen) (void)
nohud = true;
}
SCR_DrawTwoDimensional(uimenu, nohud);
SCR_DrawTwoDimensional(nohud);
V_UpdatePalette (false);

View file

@ -1128,16 +1128,6 @@ static qboolean (D3D8_SCR_UpdateScreen) (void)
}
#endif
*/
if (Media_ShowFilm())
{
M_Draw(0);
// V_UpdatePalette (false);
Media_RecordFrame();
// R2D_BrightenScreen();
IDirect3DDevice8_EndScene(pD3DDev8);
IDirect3DDevice8_Present(pD3DDev8, NULL, NULL, NULL, NULL);
return true;
}
//
// do 3D refresh drawing, and then update the screen
@ -1149,25 +1139,23 @@ static qboolean (D3D8_SCR_UpdateScreen) (void)
D3D8_Set2D();
#ifdef VM_CG
if (CG_Refresh())
if (topmenu && topmenu->isopaque)
nohud = true;
#ifdef VM_CG
else if (CG_Refresh())
nohud = true;
else
#endif
#ifdef CSQC_DAT
if (CSQC_DrawView())
else if (CSQC_DrawView())
nohud = true;
else
#endif
if (uimenu != 1)
{
if (r_worldentity.model && cls.state == ca_active)
V_RenderView (nohud);
else
{
noworld = true;
}
}
else if (uimenu != 1)
{
if (r_worldentity.model && cls.state == ca_active)
V_RenderView (nohud);
else
noworld = true;
}
R2D_BrightenScreen();

View file

@ -175,9 +175,7 @@ qboolean GLSCR_UpdateScreen (void)
if (r_worldentity.model && cls.state == ca_active)
V_RenderView (nohud);
else
{
noworld = true;
}
}
GL_Set2D (false);

View file

@ -58,6 +58,18 @@ typedef unsigned char qbyte;
#pragma warning(disable : 4267)
#endif
#ifndef stricmp
#ifdef _WIN32
//Windows-specific...
#define stricmp _stricmp
#define strnicmp _strnicmp
#else
//Posix
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif
#endif
//extern progfuncs_t *progfuncs;
typedef struct sharedvar_s
{

View file

@ -138,6 +138,57 @@ char *va(const char *format, ...) //Identical in function to the one in Quake, t
return string;
}
#ifdef _WIN32
// don't use these functions in MSVC8
#if (_MSC_VER < 1400)
int QDECL linuxlike_snprintf(char *buffer, int size, const char *format, ...)
{
#undef _vsnprintf
int ret;
va_list argptr;
if (size <= 0)
return 0;
size--;
va_start (argptr, format);
ret = _vsnprintf (buffer,size, format,argptr);
va_end (argptr);
buffer[size] = '\0';
return ret;
}
int QDECL linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr)
{
#undef _vsnprintf
int ret;
if (size <= 0)
return 0;
size--;
ret = _vsnprintf (buffer,size, format,argptr);
buffer[size] = '\0';
return ret;
}
#else
int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...)
{
int ret;
va_list argptr;
va_start (argptr, format);
ret = vsnprintf_s (buffer,size, _TRUNCATE, format,argptr);
va_end (argptr);
return ret;
}
#endif
#endif
void Con_Printf(const char *format, ...)
{
va_list argptr;

View file

@ -176,7 +176,7 @@ typedef struct {
struct wstats_s;
#define F(t, n, args) t (QDECL *n) args;
#define F(t, n, args) t (QDECL *n) args
typedef struct //core stuff
{