1
0
Fork 0
forked from fte/fteqw

Some image fixups.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5551 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-09-29 02:16:34 +00:00
parent 4134353778
commit be5466c9fd
7 changed files with 573 additions and 465 deletions

View file

@ -57,10 +57,13 @@ SET(FTE_BUILD_CONFIG ${CMAKE_HOME_DIRECTORY}/engine/common/config_fteqw.h CACHE
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};CONFIG_FILE_NAME=${FTE_BUILD_CONFIG})
FIND_PACKAGE(ZLIB)
IF(NOT ZLIB_FOUND)
IF(ZLIB_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};ZLIB_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${ZLIB_LIBRARIES})
SET(FTESV_LIBS ${FTESV_LIBS} ${ZLIB_LIBRARIES})
ELSE()
MESSAGE(WARNING "libz library NOT available. compressed pk3 will not be available.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_ZLIB)
SET(ZLIB_LIBRARY )
SET(ZLIB_LIBRARIES )
ENDIF()
@ -84,13 +87,19 @@ ELSE()
ENDIF()
FIND_PACKAGE(JPEG)
IF(NOT JPEG_FOUND)
IF(JPEG_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};LIBJPEG_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${JPEG_LIBRARIES})
ELSE()
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)
IF(PNG_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};LIBPNG_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${PNG_LIBRARIES})
ELSE()
MESSAGE(WARNING "libpng library NOT available. Good luck with screenshots.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_PNG)
ENDIF()
@ -98,6 +107,8 @@ ENDIF()
FIND_PACKAGE(Freetype)
IF(FREETYPE_FOUND)
INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} )
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};LIBFREETYPE_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${FREETYPE_LIBRARIES})
ELSE()
MESSAGE(WARNING "freetype library NOT available. I hope you're okay with ascii.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_FREETYPE)
@ -155,8 +166,8 @@ IF(${ANDROID})
# INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} )
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_DEFINES ${FTE_DEFINES};ANDROID;VKQUAKE;MULTITHREAD)
SET(FTE_LIBS ${FTE_LIBS} android log EGL m ${CMAKE_DL_LIBS})
SET(FTE_ARCH_FILES
engine/client/sys_droid.c
engine/common/sys_linux_threads.c
@ -170,8 +181,8 @@ ELSEIF(${WIN32})
# engine/server/sv_sys_win.c
SET(FTE_LIBS ${FTE_LIBS} ${ZLIB_LIBRARIES} ole32 gdi32 wsock32 winmm dxguid)
SET(FTE_DEFINES ${FTE_DEFINES};D3D9QUAKE;D3D11QUAKE;DYNAMIC_LIBPNG;DYNAMIC_LIBJPEG)
SET(FTE_LIBS ${FTE_LIBS} ole32 gdi32 wsock32 winmm dxguid)
SET(FTE_DEFINES ${FTE_DEFINES};D3D9QUAKE;D3D11QUAKE)
SET(FTE_ARCH_FILES
engine/client/winquake.rc
engine/common/sys_win_threads.c
@ -201,7 +212,7 @@ ELSEIF(${WIN32})
engine/d3d/vid_d3d8.c
)
SET(FTESV_LIBS ${FTESV_LIBS} ${ZLIB_LIBRARIES} wsock32 winmm)
SET(FTESV_LIBS ${FTESV_LIBS} wsock32 winmm)
SET(FTESV_ARCH_FILES
engine/client/winquake.rc
engine/common/sys_win_threads.c
@ -236,8 +247,8 @@ 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)
SET(FTE_LIBS ${FTE_LIBS} ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} pthread ${SDL2_LIBRARIES})
SET(FTE_DEFINES ${FTE_DEFINES};DYNAMIC_SDL;MULTITHREAD)
SET(FTE_LIBS ${FTE_LIBS} m ${CMAKE_DL_LIBS} pthread ${SDL2_LIBRARIES})
SET(FTE_ARCH_FILES
engine/client/sys_linux.c
engine/common/sys_linux_threads.c
@ -292,7 +303,7 @@ ELSEIF(${UNIX}) #linux(ish)
engine/common/net_ssl_gnutls.c
# engine/common/net_ssl_openssl.c
)
SET(FTESV_LIBS ${FTESV_LIBS} ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} pthread)
SET(FTESV_LIBS ${FTESV_LIBS} m ${CMAKE_DL_LIBS} pthread)
# SET(FTE_DEFINES ${FTE_DEFINES};HAVE_OPENSSL)
# SET(FTESV_DEFINES ${FTESV_DEFINES};HAVE_OPENSSL)
@ -310,8 +321,8 @@ 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)
SET(FTE_LIBS ${FTE_LIBS} ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES})
SET(FTE_DEFINES ${FTE_DEFINES};FTE_SDL)
SET(FTE_LIBS ${FTE_LIBS} m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES})
SET(FTE_ARCH_FILES
engine/client/sys_sdl.c
engine/client/snd_al.c
@ -322,7 +333,7 @@ ELSEIF(1) #SDL
)
SET(FTESV_DEFINES FTE_SDL)
SET(FTESV_LIBS ${FTESV_LIBS} ${ZLIB_LIBRARIES} m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES})
SET(FTESV_LIBS ${FTESV_LIBS} m ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES})
IF(WIN32)
SET(FTE_LIBS ${FTE_LIBS} wsock32 gdi32 ole32)
@ -756,6 +767,14 @@ ELSE()
SET_TARGET_PROPERTIES(iqmtool PROPERTIES COMPILE_DEFINITIONS "${FTE_REVISON}")
SET(INSTALLTARGS ${INSTALLTARGS} iqmtool)
# ADD_EXECUTABLE(imgtool
# engine/client/image.c
# imgtool.c
# )
# SET_TARGET_PROPERTIES(imgtool PROPERTIES COMPILE_DEFINITIONS "IMGTOOL;${FTE_LIB_DEFINES};${FTE_DEFINES};${FTE_REVISON}")
# TARGET_LINK_LIBRARIES(imgtool ${FTE_LIBS} )
# SET(INSTALLTARGS ${INSTALLTARGS} imgtool)
ADD_EXECUTABLE(qtv
fteqtv/netchan.c
fteqtv/parse.c
@ -776,7 +795,7 @@ ELSE()
)
SET_TARGET_PROPERTIES(qtv PROPERTIES COMPILE_DEFINITIONS "${FTE_REVISON}")
IF(WIN32)
TARGET_LINK_LIBRARIES(qtv ${ZLIB_LIBRARIES} ws2_32 winmm)
TARGET_LINK_LIBRARIES(qtv ws2_32 winmm)
ELSE()
TARGET_LINK_LIBRARIES(qtv m)
ENDIF()
@ -812,7 +831,7 @@ ELSE()
)
SET_TARGET_PROPERTIES(httpserver PROPERTIES COMPILE_DEFINITIONS "WEBSERVER;WEBSVONLY;${FTE_REVISON}")
IF(WIN32)
TARGET_LINK_LIBRARIES(httpserver ${ZLIB_LIBRARIES} ws2_32)
TARGET_LINK_LIBRARIES(httpserver ws2_32)
ENDIF()
#SET(INSTALLTARGS ${INSTALLTARGS} httpserver)

View file

@ -107,9 +107,14 @@ ifeq (,$(findstring DNO_VORBISFILE,$(FTE_CONFIG_EXTRA)))
endif
ifneq (,$(findstring DLINK_FREETYPE,$(FTE_CONFIG_EXTRA)))
LINK_FREETYPE=1
LINK_ZLIB=1
LINK_PNG=1
endif
ifneq (,$(findstring DLINK_JPEG,$(FTE_CONFIG_EXTRA)))
LINK_JPEG=1
endif
ifneq (,$(findstring DLINK_PNG,$(FTE_CONFIG_EXTRA)))
LINK_ZLIB=1
LINK_PNG=1
endif
ifneq (,$(findstring -Os,$(FTE_CONFIG_EXTRA)))
@ -555,14 +560,14 @@ BASELDFLAGS ?= -lm -ldl -lpthread
ifeq (win,$(findstring cyg,$(FTE_TARGET))$(findstring win,$(FTE_TARGET)))
BASELDFLAGS=-lm
MINGW_LIBS_DIR=$(LIBS_DIR)/mingw-libs
# MINGW_LIBS_DIR=$(LIBS_DIR)/mingw-libs
ifeq ($(shell echo $(FTE_TARGET)|grep -v win64),)
MINGW_LIBS_DIR=$(LIBS_DIR)/mingw64-libs
endif
# ifeq ($(shell echo $(FTE_TARGET)|grep -v win64),)
# MINGW_LIBS_DIR=$(LIBS_DIR)/mingw64-libs
# endif
IMAGELDFLAGS=$(MINGW_LIBS_DIR)/libpng.a $(MINGW_LIBS_DIR)/libz.a $(MINGW_LIBS_DIR)/libjpeg.a
OGGVORBISLDFLAGS=$(MINGW_LIBS_DIR)/libvorbisfile.a $(MINGW_LIBS_DIR)/libvorbis.a $(MINGW_LIBS_DIR)/libogg.a
# IMAGELDFLAGS=$(MINGW_LIBS_DIR)/libpng.a $(MINGW_LIBS_DIR)/libz.a $(MINGW_LIBS_DIR)/libjpeg.a
# OGGVORBISLDFLAGS=$(MINGW_LIBS_DIR)/libvorbisfile.a $(MINGW_LIBS_DIR)/libvorbis.a $(MINGW_LIBS_DIR)/libogg.a
endif
#try to statically link
@ -572,7 +577,6 @@ ifeq ($(COMPILE_SYS),Darwin)
OGGVORBISLDFLAGS = $(shell pkg-config vorbisfile --variable=libdir)/libvorbisfile.a $(shell pkg-config vorbis --variable=libdir)/libvorbis.a $(shell pkg-config ogg --variable=libdir)/libogg.a
endif
endif
IMAGELDFLAGS ?= -lpng -ljpeg
OGGVORBISLDFLAGS ?= -lvorbisfile -lvorbis -logg
VISIBILITY_FLAGS?=
@ -923,9 +927,17 @@ ifeq (1,$(LINK_FREETYPE))
CLIENTLDDEPS+=-lfreetype
endif
ifeq (1,$(LINK_PNG))
CLIENTLIBFLAGS+=-DAVAIL_PNG
CLIENTLIBFLAGS+=-DLIBPNG_STATIC
CLIENTLDDEPS+=-lpng
endif
ifeq (1,$(LINK_JPEG))
CLIENTLIBFLAGS+=-DLIBJPEG_STATIC
CLIENTLDDEPS+=-ljpeg
endif
ifeq (1,$(LINK_ZLIB))
CLIENTLIBFLAGS+=-DZLIB_STATIC
CLIENTLDDEPS+=-lz
endif
ifeq (1,$(strip $(INTERNAL_BULLET)))
COMMON_OBJS+=com_phys_bullet.o
ALL_CFLAGS+=-I/usr/include/bullet -I$(ARCHLIBS)/bullet3-$(BULLETVER)/src
@ -1270,7 +1282,6 @@ ifeq (win,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
BITS=64
endif
QCC_DIR=winqcc$(BITS)
QCC_LDFLAGS=$(MINGW_LIBS_DIR)/libz.a
BASELDFLAGS=
@ -1287,7 +1298,7 @@ ifeq (win,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
LIBS_DIR = $(BASE_DIR)/libs
SV_EXE_NAME=../$(EXE_NAME)sv$(BITS)$(EXEPOSTFIX)
SV_LDFLAGS=$(MINGW_LIBS_DIR)/libz.a -lws2_32 -lwinmm
SV_LDFLAGS=-lws2_32 -lwinmm
SV_DIR=sv_mingw$(BITS)
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) $(BOTLIB_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) $(W32_CFLAGS)
@ -1334,6 +1345,13 @@ ifeq (win,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
MINGL_EXE_NAME=../fteminglqw$(BITS)$(EXEPOSTFIX)
MINGL_DIR=mingl_mgw$(BITS)
ifeq (,$(findstring NO_ZLIB,$(CFLAGS)))
SV_LDFLAGS+=-lz
GL_LDFLAGS+=-lz
VK_LDFLAGS+=-lz
M_LDFLAGS+=-lz
QCC_LDFLAGS+=-L$(ARCHLIBS) -lz
endif
ifeq ($(NOCOMPAT),1)
SV_EXE_NAME=../engine-sv$(BITS)$(EXEPOSTFIX)
GL_EXE_NAME=../engine-gl$(BITS)$(EXEPOSTFIX)
@ -1487,7 +1505,7 @@ ifneq ($(shell echo $(FTE_TARGET)|grep macosx),)
GL_CFLAGS=$(GLCFLAGS) -D__MACOSX__ -L/sw/lib -I/sw/include -L/opt/local/lib -I/opt/local/include -I$(LIBS_DIR)
endif
GL_LDFLAGS=-framework AGL -framework OpenGL -framework Cocoa -framework AudioUnit -lz -lpng -ljpeg
GL_LDFLAGS=-framework AGL -framework OpenGL -framework Cocoa -framework AudioUnit
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidcocoa.mo gl_vidmacos.o sys_linux.o cd_null.o snd_macos.o sys_linux_threads.o
GL_EXE_NAME=../$(EXE_NAME)-macosx-gl$(EXTENSION)$(BITS)

View file

@ -1066,33 +1066,8 @@ void SCR_DrawCursor(void)
FS_FreeFile(filedata);
if (rgbadata)
{ //image loaded properly, yay
if ((format==PTI_RGBX8 || format==PTI_LLLX8) && !strchr(bestname, ':'))
{ //people seem to insist on using jpgs, which don't have alpha.
//so screw over the alpha channel if needed.
unsigned int alpha_width, alpha_height, p;
char aname[MAX_QPATH];
unsigned char *alphadata;
char *alph;
size_t alphsize;
char ext[8];
COM_StripExtension(bestname, aname, sizeof(aname));
COM_FileExtension(bestname, ext, sizeof(ext));
Q_strncatz(aname, "_alpha.", sizeof(aname));
Q_strncatz(aname, ext, sizeof(aname));
alphsize = FS_LoadFile(aname, (void**)&alph);
if (alph)
{
if ((alphadata = ReadRawImageFile(alph, alphsize, &alpha_width, &alpha_height, &format, true, aname)))
{
if (alpha_width == width && alpha_height == height)
for (p = 0; p < alpha_width*alpha_height; p++)
rgbadata[(p<<2) + 3] = (alphadata[(p<<2) + 0] + alphadata[(p<<2) + 1] + alphadata[(p<<2) + 2])/3;
BZ_Free(alphadata);
}
FS_FreeFile(alph);
}
format = (format==PTI_LLLX8)?PTI_LLLA8:PTI_RGBA8;
}
if ((format==PTI_BGRX8 || format==PTI_RGBX8 || format==PTI_LLLX8) && !strchr(bestname, ':'))
Image_ReadExternalAlpha(rgbadata, width, height, bestname, &format);
kcurs->handle = rf->VID_CreateCursor(rgbadata, width, height, format, kcurs->hotspot[0], kcurs->hotspot[1], kcurs->scale); //try the fallback
BZ_Free(rgbadata);

File diff suppressed because it is too large Load diff

View file

@ -473,8 +473,8 @@ qboolean Image_WriteKTXFile(const char *filename, enum fs_relative fsroot, struc
qboolean Image_WriteDDSFile(const char *filename, enum fs_relative fsroot, struct pendingtextureinfo *mips);
void Image_BlockSizeForEncoding(uploadfmt_t encoding, unsigned int *blockbytes, unsigned int *blockwidth, unsigned int *blockheight);
const char *Image_FormatName(uploadfmt_t encoding);
image_t *Image_LoadTexture (const char *identifier, int width, int height, uploadfmt_t fmt, void *data, unsigned int flags);
struct pendingtextureinfo *Image_LoadMipsFromMemory(int flags, const char *iname, const char *fname, qbyte *filedata, int filesize);
#ifdef D3D8QUAKE
void D3D8_Set2D (void);
@ -500,8 +500,6 @@ texid_tf R_LoadHiResTexture(const char *name, const char *subpath, unsigned int
texid_tf R_LoadBumpmapTexture(const char *name, const char *subpath);
void R_LoadNumberedLightTexture(struct dlight_s *dl, int cubetexnum);
qbyte *ReadRawImageFile(qbyte *buf, int len, int *width, int *height, uploadfmt_t *format, qboolean force_rgba8, const char *fname);
extern texid_t particletexture;
extern texid_t particlecqtexture;
extern texid_t explosiontexture;
@ -599,11 +597,12 @@ void RQ_Shutdown(void);
void WritePCXfile (const char *filename, enum fs_relative fsroot, qbyte *data, int width, int height, int rowbytes, qbyte *palette, qboolean upload); //data is 8bit.
qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height);
void *ReadTargaFile(qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean greyonly, uploadfmt_t forceformat);
qbyte *ReadJPEGFile(qbyte *infile, int length, int *width, int *height);
qbyte *ReadPNGFile(const char *fname, qbyte *buf, int length, int *width, int *height, uploadfmt_t *format);
qbyte *ReadPCXPalette(qbyte *buf, int len, qbyte *out);
void *Image_ResampleTexture (uploadfmt_t format, const void *in, int inwidth, int inheight, void *out, int outwidth, int outheight);
qbyte *ReadRawImageFile(qbyte *buf, int len, int *width, int *height, uploadfmt_t *format, qboolean force_rgba8, const char *fname);
void *Image_ResampleTexture (uploadfmt_t format, const void *in, int inwidth, int inheight, void *out, int outwidth, int outheight);
void Image_ReadExternalAlpha(qbyte *rgbadata, size_t imgwidth, size_t imgheight, const char *fname, uploadfmt_t *format);
void BoostGamma(qbyte *rgba, int width, int height, uploadfmt_t fmt);
void SaturateR8G8B8(qbyte *data, int size, float sat);
void AddOcranaLEDsIndexed (qbyte *image, int h, int w);

View file

@ -282,7 +282,7 @@ cvar_t vid_bpp = CVARFD ("vid_bpp", "0",
CVAR_ARCHIVE | CVAR_VIDEOLATCH, "The number of colour bits to request from the renedering context");
cvar_t vid_desktopsettings = CVARFD ("vid_desktopsettings", "0",
CVAR_ARCHIVE | CVAR_VIDEOLATCH, "Ignore the values of vid_width and vid_height, and just use the same settings that are used for the desktop.");
cvar_t vid_fullscreen = CVARF ("vid_fullscreen", "1",
cvar_t vid_fullscreen = CVARF ("vid_fullscreen", "2",
CVAR_ARCHIVE|CVAR_VIDEOLATCH);
cvar_t vid_height = CVARFD ("vid_height", "0",
CVAR_ARCHIVE | CVAR_VIDEOLATCH, "The screen height to attempt to use, in physical pixels. 0 means use desktop resolution.");

View file

@ -113,7 +113,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#endif
#ifdef MASTERONLY
#ifdef IMGTOOL
#undef WEBCLIENT
#undef LOADERTHREAD
#elif defined(MASTERONLY)
#define SV_MASTER
#undef SUBSERVERS
#undef PLUGINS
@ -415,7 +418,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SQL
#endif
#if defined(AVAIL_GZDEC) && (!defined(AVAIL_ZLIB) || defined(NPFTE))
#if defined(AVAIL_GZDEC) && (!defined(AVAIL_ZLIB) || defined(NPFTE) || defined(NO_ZLIB))
//gzip needs zlib to work (pk3s can still contain non-compressed files)
#undef AVAIL_GZDEC
#endif