Skip to content

Commit

Permalink
Merge branch 'master' into sdl2
Browse files Browse the repository at this point in the history
Conflicts:
	Makefile
	code/renderergl2/tr_image.c
  • Loading branch information
Tim Angus committed Aug 25, 2014
2 parents 7d02617 + ca9eebb commit 2a33684
Show file tree
Hide file tree
Showing 24 changed files with 435 additions and 231 deletions.
152 changes: 86 additions & 66 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,32 +187,36 @@ ifndef USE_FREETYPE
USE_FREETYPE=0
endif

ifndef USE_INTERNAL_LIBS
USE_INTERNAL_LIBS=1
endif

ifndef USE_INTERNAL_SPEEX
USE_INTERNAL_SPEEX=1
USE_INTERNAL_SPEEX=$(USE_INTERNAL_LIBS)
endif

ifndef USE_INTERNAL_OGG
USE_INTERNAL_OGG=1
USE_INTERNAL_OGG=$(USE_INTERNAL_LIBS)
endif

ifndef USE_INTERNAL_VORBIS
USE_INTERNAL_VORBIS=1
USE_INTERNAL_VORBIS=$(USE_INTERNAL_LIBS)
endif

ifndef USE_INTERNAL_OPUS
USE_INTERNAL_OPUS=1
USE_INTERNAL_OPUS=$(USE_INTERNAL_LIBS)
endif

ifndef USE_INTERNAL_ZLIB
USE_INTERNAL_ZLIB=1
USE_INTERNAL_ZLIB=$(USE_INTERNAL_LIBS)
endif

ifndef USE_INTERNAL_JPEG
USE_INTERNAL_JPEG=1
USE_INTERNAL_JPEG=$(USE_INTERNAL_LIBS)
endif

ifndef USE_LOCAL_HEADERS
USE_LOCAL_HEADERS=1
USE_LOCAL_HEADERS=$(USE_INTERNAL_LIBS)
endif

ifndef USE_RENDERER_DLOPEN
Expand Down Expand Up @@ -266,19 +270,23 @@ ifneq ($(BUILD_CLIENT),0)
# set PKG_CONFIG_PATH to influence this, e.g.
# PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig
ifneq ($(call bin_path, pkg-config),)
CURL_CFLAGS=$(shell pkg-config --silence-errors --cflags libcurl)
CURL_LIBS=$(shell pkg-config --silence-errors --libs libcurl)
OPENAL_CFLAGS=$(shell pkg-config --silence-errors --cflags openal)
OPENAL_LIBS=$(shell pkg-config --silence-errors --libs openal)
SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//')
SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl2)
FREETYPE_CFLAGS=$(shell pkg-config --silence-errors --cflags freetype2)
endif
# Use sdl-config if all else fails
CURL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags libcurl)
CURL_LIBS ?= $(shell pkg-config --silence-errors --libs libcurl)
OPENAL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags openal)
OPENAL_LIBS ?= $(shell pkg-config --silence-errors --libs openal)
SDL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//')
SDL_LIBS ?= $(shell pkg-config --silence-errors --libs sdl2)
FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2)
else
# assume they're in the system default paths (no -I or -L needed)
CURL_LIBS ?= -lcurl
OPENAL_LIBS ?= -lopenal
endif
# Use sdl2-config if all else fails
ifeq ($(SDL_CFLAGS),)
ifneq ($(call bin_path, sdl2-config),)
SDL_CFLAGS=$(shell sdl2-config --cflags)
SDL_LIBS=$(shell sdl2-config --libs)
SDL_CFLAGS ?= $(shell sdl2-config --cflags)
SDL_LIBS ?= $(shell sdl2-config --libs)
endif
endif
endif
Expand Down Expand Up @@ -370,24 +378,21 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))

ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += -lopenal
CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
endif
endif

ifeq ($(USE_CURL),1)
CLIENT_CFLAGS += $(CURL_CFLAGS)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
CLIENT_LIBS += $(CURL_LIBS)
endif
endif

ifeq ($(USE_MUMBLE),1)
CLIENT_LIBS += -lrt
endif

ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += $(FREETYPE_CFLAGS)
endif

ifeq ($(ARCH),x86)
# linux32 make ...
BASE_CFLAGS += -m32
Expand Down Expand Up @@ -460,15 +465,12 @@ ifeq ($(PLATFORM),darwin)
endif

ifeq ($(USE_CURL),1)
CLIENT_CFLAGS += $(CURL_CFLAGS)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
CLIENT_LIBS += $(CURL_LIBS)
endif
endif

ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += $(FREETYPE_CFLAGS)
endif

BASE_CFLAGS += -D_THREAD_SAFE=1

ifeq ($(USE_LOCAL_HEADERS),1)
Expand Down Expand Up @@ -558,7 +560,7 @@ ifeq ($(PLATFORM),mingw32)
ifeq ($(ARCH),x86_64)
OPTIMIZEVM = -O3 -fno-omit-frame-pointer \
-funroll-loops -falign-functions=2 -fstrength-reduce
OPTIMIZE = $(OPTIMIZEVM) --fast-math
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED = true
endif
ifeq ($(ARCH),x86)
Expand All @@ -579,12 +581,15 @@ ifeq ($(PLATFORM),mingw32)
endif

LIBS= -lws2_32 -lwinmm -lpsapi
CLIENT_LDFLAGS += -mwindows
# clang 3.4 doesn't support this
ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
CLIENT_LDFLAGS += -mwindows
endif
CLIENT_LIBS = -lgdi32 -lole32
RENDERER_LIBS = -lgdi32 -lole32 -lopengl32

ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -Ifreetype2
FREETYPE_CFLAGS = -Ifreetype2
endif

ifeq ($(USE_CURL),1)
Expand Down Expand Up @@ -670,13 +675,14 @@ ifeq ($(PLATFORM),freebsd)
# optional features/libraries
ifeq ($(USE_OPENAL),1)
ifeq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += $(THREAD_LIBS) -lopenal
CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
endif
endif

ifeq ($(USE_CURL),1)
CLIENT_CFLAGS += $(CURL_CFLAGS)
ifeq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
CLIENT_LIBS += $(CURL_LIBS)
endif
endif

Expand Down Expand Up @@ -761,13 +767,13 @@ ifeq ($(PLATFORM),openbsd)

ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += $(THREAD_LIBS) -lopenal
CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
endif
endif

ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
CLIENT_LIBS += $(CURL_LIBS)
endif
endif
else # ifeq openbsd
Expand Down Expand Up @@ -910,10 +916,6 @@ endif

TARGETS =

ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -DBUILD_FREETYPE
endif

ifndef FULLBINEXT
FULLBINEXT=.$(ARCH)$(BINEXT)
endif
Expand Down Expand Up @@ -984,40 +986,43 @@ ifeq ($(USE_CURL),1)
endif
endif

ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
NEED_OGG=1
endif

ifeq ($(USE_CODEC_OPUS),1)
CLIENT_CFLAGS += -DUSE_CODEC_OPUS
ifeq ($(USE_INTERNAL_OPUS),1)
CLIENT_CFLAGS += -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DUSE_ALLOCA \
OPUS_CFLAGS = -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DUSE_ALLOCA \
-I$(OPUSDIR)/include -I$(OPUSDIR)/celt -I$(OPUSDIR)/silk \
-I$(OPUSDIR)/silk/float

CLIENT_CFLAGS += -I$(OPUSFILEDIR)/include
-I$(OPUSDIR)/silk/float -I$(OPUSFILEDIR)/include
else
CLIENT_LIBS += -lopusfile -lopus
OPUS_CFLAGS ?= $(shell pkg-config --silence-errors --cflags opusfile opus || true)
OPUS_LIBS ?= $(shell pkg-config --silence-errors --libs opusfile opus || echo -lopusfile -lopus)
endif
CLIENT_CFLAGS += $(OPUS_CFLAGS)
CLIENT_LIBS += $(OPUS_LIBS)
NEED_OGG=1
endif

ifeq ($(NEED_OGG),1)
ifeq ($(USE_INTERNAL_OGG),1)
CLIENT_CFLAGS += -I$(OGGDIR)/include
else
CLIENT_LIBS += -logg
endif
endif

ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
ifeq ($(USE_INTERNAL_VORBIS),1)
CLIENT_CFLAGS += -I$(VORBISDIR)/include -I$(VORBISDIR)/lib
else
VORBIS_CFLAGS ?= $(shell pkg-config --silence-errors --cflags vorbisfile vorbis || true)
VORBIS_LIBS ?= $(shell pkg-config --silence-errors --libs vorbisfile vorbis || echo -lvorbisfile -lvorbis)
endif
CLIENT_CFLAGS += $(VORBIS_CFLAGS)
CLIENT_LIBS += $(VORBIS_LIBS)
NEED_OGG=1
endif

ifeq ($(NEED_OGG),1)
ifeq ($(USE_INTERNAL_OGG),1)
OGG_CFLAGS = -I$(OGGDIR)/include
else
CLIENT_LIBS += -lvorbisfile -lvorbis
OGG_CFLAGS ?= $(shell pkg-config --silence-errors --cflags ogg || true)
OGG_LIBS ?= $(shell pkg-config --silence-errors --libs ogg || echo -logg)
endif
CLIENT_CFLAGS += $(OGG_CFLAGS)
CLIENT_LIBS += $(OGG_LIBS)
endif

ifeq ($(USE_RENDERER_DLOPEN),1)
Expand All @@ -1032,28 +1037,43 @@ ifeq ($(USE_VOIP),1)
CLIENT_CFLAGS += -DUSE_VOIP
SERVER_CFLAGS += -DUSE_VOIP
ifeq ($(USE_INTERNAL_SPEEX),1)
CLIENT_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include
SPEEX_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include
else
CLIENT_LIBS += -lspeex -lspeexdsp
SPEEX_CFLAGS ?= $(shell pkg-config --silence-errors --cflags speex speexdsp || true)
SPEEX_LIBS ?= $(shell pkg-config --silence-errors --libs speex speexdsp || echo -lspeex -lspeexdsp)
endif
CLIENT_CFLAGS += $(SPEEX_CFLAGS)
CLIENT_LIBS += $(SPEEX_LIBS)
endif

ifeq ($(USE_INTERNAL_ZLIB),1)
BASE_CFLAGS += -DNO_GZIP
BASE_CFLAGS += -I$(ZDIR)
ZLIB_CFLAGS = -DNO_GZIP -I$(ZDIR)
else
LIBS += -lz
ZLIB_CFLAGS ?= $(shell pkg-config --silence-errors --cflags zlib || true)
ZLIB_LIBS ?= $(shell pkg-config --silence-errors --libs zlib || echo -lz)
endif
BASE_CFLAGS += $(ZLIB_CFLAGS)
LIBS += $(ZLIB_LIBS)

ifeq ($(USE_INTERNAL_JPEG),1)
BASE_CFLAGS += -DUSE_INTERNAL_JPEG
BASE_CFLAGS += -I$(JPDIR)
else
RENDERER_LIBS += -ljpeg
# libjpeg doesn't have pkg-config yet, but let users override with
# "make JPEG_CFLAGS=-I/opt/jpeg/include JPEG_LIBS='-L/opt/jpeg/lib -ljpeg'"
# if they need to
JPEG_CFLAGS ?=
JPEG_LIBS ?= -ljpeg
BASE_CFLAGS += $(JPEG_CFLAGS)
RENDERER_LIBS += $(JPEG_LIBS)
endif

ifeq ($(USE_FREETYPE),1)
RENDERER_LIBS += -lfreetype
FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2 || true)
FREETYPE_LIBS ?= $(shell pkg-config --silence-errors --libs freetype2 || echo -lfreetype)

BASE_CFLAGS += -DBUILD_FREETYPE $(FREETYPE_CFLAGS)
RENDERER_LIBS += $(FREETYPE_LIBS)
endif

ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ Makefile.local:
USE_CODEC_OPUS - enable Ogg Opus support
USE_MUMBLE - enable Mumble support
USE_VOIP - enable built-in VoIP support
USE_INTERNAL_LIBS - build internal libraries instead of dynamically
linking against system libraries; this just sets
the default for USE_INTERNAL_SPEEX etc.
and USE_LOCAL_HEADERS
USE_INTERNAL_SPEEX - build internal speex library instead of dynamically
linking against system libspeex
USE_FREETYPE - enable FreeType support for rendering fonts
Expand Down
2 changes: 1 addition & 1 deletion code/client/cl_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ void Con_DrawSolidConsole( float frac ) {

// draw the text
con.vislines = lines;
rows = (lines-SMALLCHAR_WIDTH)/SMALLCHAR_WIDTH; // rows of text to draw
rows = (lines-SMALLCHAR_HEIGHT)/SMALLCHAR_HEIGHT; // rows of text to draw

y = lines - (SMALLCHAR_HEIGHT*3);

Expand Down
2 changes: 1 addition & 1 deletion code/q3_ui/ui_mfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void MField_CharEvent( mfield_t *edit, int ch ) {
return;
}

if ( !trap_Key_GetOverstrikeMode() ) {
if ( trap_Key_GetOverstrikeMode() ) {
if ((edit->cursor == MAX_EDIT_LINE - 1) || (edit->maxchars && edit->cursor >= edit->maxchars))
return;
} else {
Expand Down
4 changes: 4 additions & 0 deletions code/qcommon/q_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,10 @@ void SkipRestOfLine ( char **data ) {
int c;

p = *data;

if ( !*p )
return;

while ( (c = *p++) != 0 ) {
if ( c == '\n' ) {
com_lines++;
Expand Down
3 changes: 2 additions & 1 deletion code/qcommon/vm_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,9 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)

// ensure that the optimisation pass knows about all the jump
// table targets
pc = -1; // a bogus value to be printed in out-of-bounds error messages
for( i = 0; i < vm->numJumpTableTargets; i++ ) {
jused[ *(int *)(vm->jumpTableTargets + ( i * sizeof( int ) ) ) ] = 1;
JUSED( *(int *)(vm->jumpTableTargets + ( i * sizeof( int ) ) ) );
}

// Start buffer with x86-VM specific procedures
Expand Down
Loading

0 comments on commit 2a33684

Please sign in to comment.