diff --git a/engine/ChangeLog b/engine/ChangeLog index e9c0d955..ab963fe3 100644 --- a/engine/ChangeLog +++ b/engine/ChangeLog @@ -279,7 +279,7 @@ added Wheel support to the DirectInput code IN_DIMouse (in_mouse 1) tweaked the Wheel mouse reading for in_mouse -1 (old win32 input code) handle correctly when zDelta is > 120 - provide a in_logitechbug cvar to handle buggy Logitech MouseWare driver sending wheel events twice + provide an in_logitechbug cvar to handle buggy Logitech MouseWare driver sending wheel events twice 2002-9-26 Timothee Besset + ATVI Quake 3 1.32 Patch #38 diff --git a/engine/Makefile b/engine/Makefile index 56faad4a..8469eef2 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -60,7 +60,7 @@ ifndef BUILD_DEFINES endif # ioquake3 svn version that this is based on -IOQ3_REVISION = 2210 +IOQ3_REVISION = 2317 ############################################################################# # @@ -184,6 +184,10 @@ ifndef USE_VOIP USE_VOIP=1 endif +ifndef USE_FREETYPE +USE_FREETYPE=0 +endif + ifndef USE_INTERNAL_SPEEX USE_INTERNAL_SPEEX=1 endif @@ -255,6 +259,7 @@ ifneq ($(BUILD_CLIENT),0) OPENAL_LIBS=$(shell pkg-config --silence-errors --libs openal) SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl|sed 's/-Dmain=SDL_main//') SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl) + FREETYPE_CFLAGS=$(shell pkg-config --silence-errors --cflags freetype2) endif # Use sdl-config if all else fails ifeq ($(SDL_CFLAGS),) @@ -385,8 +390,8 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu")) CLIENT_LIBS += -lrt endif - ifeq ($(USE_LOCAL_HEADERS),1) - CLIENT_CFLAGS += -I$(SDLHDIR)/include + ifeq ($(USE_FREETYPE),1) + BASE_CFLAGS += $(FREETYPE_CFLAGS) endif ifeq ($(ARCH),i386) @@ -405,7 +410,7 @@ else # ifeq Linux ifeq ($(PLATFORM),darwin) HAVE_VM_COMPILED=true - LIBS = -framework Cocoa + LIBS = -framework Cocoa -framework SDL CLIENT_LIBS= RENDERER_LIBS= OPTIMIZEVM= @@ -443,6 +448,10 @@ ifeq ($(PLATFORM),darwin) endif endif + ifeq ($(USE_FREETYPE),1) + BASE_CFLAGS += $(FREETYPE_CFLAGS) + endif + ifeq ($(USE_CODEC_VORBIS),1) CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif @@ -458,8 +467,8 @@ ifeq ($(PLATFORM),darwin) LIBSDLMAIN=$(B)/libSDLmain.a LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a CLIENT_LIBS += -framework IOKit \ - $(LIBSDIR)/macosx/libSDL-1.2.0.dylib - RENDERER_LIBS += -framework OpenGL $(LIBSDIR)/macosx/libSDL-1.2.0.dylib + -framework SDL + RENDERER_LIBS += -framework OpenGL -framework SDL OPTIMIZEVM += -falign-loops=16 OPTIMIZE = $(OPTIMIZEVM) -ffast-math @@ -532,6 +541,10 @@ ifeq ($(PLATFORM),mingw32) CLIENT_LIBS = -lgdi32 -lole32 RENDERER_LIBS = -lgdi32 -lole32 -lopengl32 + ifeq ($(USE_FREETYPE),1) + BASE_CFLAGS += -Ifreetype2 + endif + ifeq ($(USE_CURL),1) CLIENT_CFLAGS += $(CURL_CFLAGS) ifneq ($(USE_CURL_DLOPEN),1) @@ -570,16 +583,19 @@ ifeq ($(PLATFORM),mingw32) $(LIBSDIR)/win32/libSDL.dll.a RENDERER_LIBS += $(LIBSDIR)/win32/libSDLmain.a \ $(LIBSDIR)/win32/libSDL.dll.a + SDLDLL=SDL.dll else CLIENT_LIBS += $(LIBSDIR)/win64/libSDLmain.a \ $(LIBSDIR)/win64/libSDL64.dll.a RENDERER_LIBS += $(LIBSDIR)/win64/libSDLmain.a \ $(LIBSDIR)/win64/libSDL64.dll.a + SDLDLL=SDL64.dll endif else CLIENT_CFLAGS += $(SDL_CFLAGS) CLIENT_LIBS += $(SDL_LIBS) RENDERER_LIBS += $(SDL_LIBS) + SDLDLL=SDL.dll endif BUILD_CLIENT_SMP = 0 @@ -836,6 +852,10 @@ endif TARGETS = +ifeq ($(USE_FREETYPE),1) + BASE_CFLAGS += -DBUILD_FREETYPE +endif + ifndef FULLBINEXT # Leave .x86 off win32 binaries ifeq ($(ARCH),x86) @@ -949,6 +969,10 @@ else RENDERER_LIBS += -ljpeg endif +ifeq ($(USE_FREETYPE),1) + RENDERER_LIBS += -lfreetype +endif + ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++")) BASE_CFLAGS += -Qunused-arguments endif @@ -1462,10 +1486,17 @@ Q3OBJ = \ $(B)/client/sdl_input.o \ $(B)/client/sdl_snd.o \ \ - $(B)/client/con_passive.o \ $(B)/client/con_log.o \ $(B)/client/sys_main.o +ifeq ($(PLATFORM),mingw32) + Q3OBJ += \ + $(B)/client/con_passive.o +else + Q3OBJ += \ + $(B)/client/con_tty.o +endif + Q3ROBJ = \ $(B)/renderer/tr_animation.o \ $(B)/renderer/tr_backend.o \ @@ -2446,7 +2477,7 @@ TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ) copyfiles: release - @if [ ! -d $(COPYDIR)/$(BASENAME) ]; then echo "You need to set COPYDIR to where your Quake3 data is!"; fi + @if [ ! -d $(COPYDIR)/$(BASEGAME) ]; then echo "You need to set COPYDIR to where your Quake3 data is!"; fi ifneq ($(BUILD_GAME_SO),0) ifneq ($(BUILD_BASEGAME),0) -$(MKDIR) -p -m 0755 $(COPYDIR)/$(BASEGAME) @@ -2536,6 +2567,7 @@ distclean: clean toolsclean installer: release ifeq ($(PLATFORM),mingw32) @$(MAKE) VERSION=$(VERSION) -C $(NSISDIR) V=$(V) \ + SDLDLL=$(SDLDLL) \ USE_RENDERER_DLOPEN=$(USE_RENDERER_DLOPEN) \ USE_OPENAL_DLOPEN=$(USE_OPENAL_DLOPEN) \ USE_CURL_DLOPEN=$(USE_CURL_DLOPEN) \ diff --git a/engine/README b/engine/README index 326367be..4b4260c1 100644 --- a/engine/README +++ b/engine/README @@ -103,6 +103,7 @@ Makefile.local: USE_VOIP - enable built-in VoIP support USE_INTERNAL_SPEEX - build internal speex library instead of dynamically linking against system libspeex + USE_FREETYPE - enable FreeType support for rendering fonts USE_OLD_VM64 - use Ludwig Nussel's old JIT compiler implementation for x86_64 USE_INTERNAL_ZLIB - build and link against internal zlib @@ -136,6 +137,7 @@ New cvars for forward movement speed/direction. j_side - Joystick analogue to m_side, for side movement speed/direction. + j_up - Joystick up movement speed/direction. j_pitch - Joystick analogue to m_pitch, for pitch rotation speed/direction. j_yaw - Joystick analogue to m_yaw, @@ -144,6 +146,8 @@ New cvars controls forward/back. j_side_axis - Selects which joystick axis controls left/right. + j_up_axis - Selects which joystick axis + controls up/down. j_pitch_axis - Selects which joystick axis controls pitch. j_yaw_axis - Selects which joystick axis @@ -269,6 +273,8 @@ New cvars captured using screenshotJPEG r_aviMotionJpegQuality - Controls quality of video capture when cl_aviMotionJpeg is enabled + r_mode -2 - This new video mode automatically uses the + desktop resolution. New commands video [filename] - start video capture (use with demo command) @@ -294,6 +300,16 @@ New commands which - print out the path on disk to a loaded item + execq - quiet exec command, doesn't print "execing file.cfg" + + kicknum - kick a client by number, same as clientkick command + kickall - kick all clients, similar to "kick all" (but kicks + everyone even if someone is named "all") + kickbots - kick all bots, similar to "kick allbots" (but kicks + all bots even if someone is named "allbots") + + tell - send message to a single client (new to server) + --------------------------------------------------------- README for Users ----- @@ -657,9 +673,9 @@ Building with MinGW for pre Windows XP ------------------------------------------------------------- Contributing ----- Please send all patches to bugzilla (https://bugzilla.icculus.org), or join the -mailing list (quake3-subscribe@icculus.org) and submit your patch there. The -best case scenario is that you submit your patch to bugzilla, and then post the -URL to the mailing list. +mailing list (http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org) and +submit your patch there. The best case scenario is that you submit your patch +to bugzilla, and then post the URL to the mailing list. The focus for ioq3 is to develop a stable base suitable for further development and provide players with the same Quake 3 experience they've had for years. As diff --git a/engine/code/SDL12/include/SDL.h b/engine/code/SDL12/include/SDL.h index 119ed7ff..6087b7cd 100644 --- a/engine/code/SDL12/include/SDL.h +++ b/engine/code/SDL12/include/SDL.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_active.h b/engine/code/SDL12/include/SDL_active.h index 0ae92f2d..cd854e89 100644 --- a/engine/code/SDL12/include/SDL_active.h +++ b/engine/code/SDL12/include/SDL_active.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_audio.h b/engine/code/SDL12/include/SDL_audio.h index 3a8e7fa8..e879c989 100644 --- a/engine/code/SDL12/include/SDL_audio.h +++ b/engine/code/SDL12/include/SDL_audio.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_byteorder.h b/engine/code/SDL12/include/SDL_byteorder.h index 9b93cd69..47332c3d 100644 --- a/engine/code/SDL12/include/SDL_byteorder.h +++ b/engine/code/SDL12/include/SDL_byteorder.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_cdrom.h b/engine/code/SDL12/include/SDL_cdrom.h index fff5cfa1..febb19dc 100644 --- a/engine/code/SDL12/include/SDL_cdrom.h +++ b/engine/code/SDL12/include/SDL_cdrom.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_config_dreamcast.h b/engine/code/SDL12/include/SDL_config_dreamcast.h index 07c2f081..fb03098e 100644 --- a/engine/code/SDL12/include/SDL_config_dreamcast.h +++ b/engine/code/SDL12/include/SDL_config_dreamcast.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_config_macos.h b/engine/code/SDL12/include/SDL_config_macos.h index 4ba5c22c..4fe1715a 100644 --- a/engine/code/SDL12/include/SDL_config_macos.h +++ b/engine/code/SDL12/include/SDL_config_macos.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_config_macosx.h b/engine/code/SDL12/include/SDL_config_macosx.h index 295b8724..84be6177 100644 --- a/engine/code/SDL12/include/SDL_config_macosx.h +++ b/engine/code/SDL12/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_config_minimal.h b/engine/code/SDL12/include/SDL_config_minimal.h index 002c56ea..a08e190e 100644 --- a/engine/code/SDL12/include/SDL_config_minimal.h +++ b/engine/code/SDL12/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -27,8 +27,11 @@ /* This is the minimal configuration that can be used to build SDL */ +#include +#include #include +#if 0 typedef signed char int8_t; typedef unsigned char uint8_t; typedef signed short int16_t; @@ -37,6 +40,7 @@ typedef signed int int32_t; typedef unsigned int uint32_t; typedef unsigned int size_t; typedef unsigned long uintptr_t; +#endif /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ #define SDL_AUDIO_DRIVER_DUMMY 1 diff --git a/engine/code/SDL12/include/SDL_config_nds.h b/engine/code/SDL12/include/SDL_config_nds.h index 4ac60a50..cb4d61f6 100644 --- a/engine/code/SDL12/include/SDL_config_nds.h +++ b/engine/code/SDL12/include/SDL_config_nds.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_config_os2.h b/engine/code/SDL12/include/SDL_config_os2.h index bb40df00..42edd20e 100644 --- a/engine/code/SDL12/include/SDL_config_os2.h +++ b/engine/code/SDL12/include/SDL_config_os2.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_config_symbian.h b/engine/code/SDL12/include/SDL_config_symbian.h index 53527b23..e917ac6e 100644 --- a/engine/code/SDL12/include/SDL_config_symbian.h +++ b/engine/code/SDL12/include/SDL_config_symbian.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_config_win32.h b/engine/code/SDL12/include/SDL_config_win32.h index 6d019a8d..da2c15dd 100644 --- a/engine/code/SDL12/include/SDL_config_win32.h +++ b/engine/code/SDL12/include/SDL_config_win32.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_copying.h b/engine/code/SDL12/include/SDL_copying.h index 1bd6b84c..b5b64f29 100644 --- a/engine/code/SDL12/include/SDL_copying.h +++ b/engine/code/SDL12/include/SDL_copying.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_cpuinfo.h b/engine/code/SDL12/include/SDL_cpuinfo.h index f4be8e03..4200d6d1 100644 --- a/engine/code/SDL12/include/SDL_cpuinfo.h +++ b/engine/code/SDL12/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_endian.h b/engine/code/SDL12/include/SDL_endian.h index f7a2e2f8..068da918 100644 --- a/engine/code/SDL12/include/SDL_endian.h +++ b/engine/code/SDL12/include/SDL_endian.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -39,6 +39,10 @@ /*@}*/ #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ +#ifdef __linux__ +#include +#define SDL_BYTEORDER __BYTE_ORDER +#else /* __linux __ */ #if defined(__hppa__) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ (defined(__MIPS__) && defined(__MISPEB__)) || \ @@ -48,6 +52,7 @@ #else #define SDL_BYTEORDER SDL_LIL_ENDIAN #endif +#endif /* __linux __ */ #endif /* !SDL_BYTEORDER */ @@ -81,12 +86,12 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x) #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) static __inline__ Uint16 SDL_Swap16(Uint16 x) { - Uint16 result; + int result; __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x)); - return result; + return (Uint16)result; } -#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) +#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__)) static __inline__ Uint16 SDL_Swap16(Uint16 x) { __asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc"); @@ -94,7 +99,7 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x) } #else static __inline__ Uint16 SDL_Swap16(Uint16 x) { - return((x<<8)|(x>>8)); + return SDL_static_cast(Uint16, ((x<<8)|(x>>8))); } #endif @@ -121,7 +126,7 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x) __asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x)); return result; } -#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) +#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__)) static __inline__ Uint32 SDL_Swap32(Uint32 x) { __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc"); @@ -129,7 +134,7 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x) } #else static __inline__ Uint32 SDL_Swap32(Uint32 x) { - return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24)); + return SDL_static_cast(Uint32, ((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24))); } #endif @@ -166,7 +171,7 @@ static __inline__ Uint64 SDL_Swap64(Uint64 x) x = SDL_Swap32(lo); x <<= 32; x |= SDL_Swap32(hi); - return(x); + return (x); } #endif #else diff --git a/engine/code/SDL12/include/SDL_error.h b/engine/code/SDL12/include/SDL_error.h index b103703a..4e1cce3b 100644 --- a/engine/code/SDL12/include/SDL_error.h +++ b/engine/code/SDL12/include/SDL_error.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_events.h b/engine/code/SDL12/include/SDL_events.h index c94a30c9..94b42025 100644 --- a/engine/code/SDL12/include/SDL_events.h +++ b/engine/code/SDL12/include/SDL_events.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_getenv.h b/engine/code/SDL12/include/SDL_getenv.h index 253ad88c..bea63007 100644 --- a/engine/code/SDL12/include/SDL_getenv.h +++ b/engine/code/SDL12/include/SDL_getenv.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_joystick.h b/engine/code/SDL12/include/SDL_joystick.h index d5135c3d..708d1a9f 100644 --- a/engine/code/SDL12/include/SDL_joystick.h +++ b/engine/code/SDL12/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_keyboard.h b/engine/code/SDL12/include/SDL_keyboard.h index 7b59d24e..9d7129c5 100644 --- a/engine/code/SDL12/include/SDL_keyboard.h +++ b/engine/code/SDL12/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_keysym.h b/engine/code/SDL12/include/SDL_keysym.h index 90101286..f2ad12b8 100644 --- a/engine/code/SDL12/include/SDL_keysym.h +++ b/engine/code/SDL12/include/SDL_keysym.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_loadso.h b/engine/code/SDL12/include/SDL_loadso.h index 45a17f9f..0c5e5362 100644 --- a/engine/code/SDL12/include/SDL_loadso.h +++ b/engine/code/SDL12/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_main.h b/engine/code/SDL12/include/SDL_main.h index b7f6b2c8..ab50ef1e 100644 --- a/engine/code/SDL12/include/SDL_main.h +++ b/engine/code/SDL12/include/SDL_main.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_mouse.h b/engine/code/SDL12/include/SDL_mouse.h index a573f04e..7c563b94 100644 --- a/engine/code/SDL12/include/SDL_mouse.h +++ b/engine/code/SDL12/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_mutex.h b/engine/code/SDL12/include/SDL_mutex.h index 920971df..c8da9b1a 100644 --- a/engine/code/SDL12/include/SDL_mutex.h +++ b/engine/code/SDL12/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_opengl.h b/engine/code/SDL12/include/SDL_opengl.h index c479a3a4..3d791d69 100644 --- a/engine/code/SDL12/include/SDL_opengl.h +++ b/engine/code/SDL12/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -3108,21 +3108,35 @@ typedef char GLchar; /* native character */ #ifndef GL_VERSION_1_5 /* GL types for handling large vertex buffer objects */ +#ifdef __APPLE__ +typedef long GLintptr; +typedef long GLsizeiptr; +#else typedef ptrdiff_t GLintptr; typedef ptrdiff_t GLsizeiptr; #endif +#endif #ifndef GL_ARB_vertex_buffer_object /* GL types for handling large vertex buffer objects */ +#ifdef __APPLE__ +typedef long GLintptrARB; +typedef long GLsizeiptrARB; +#else typedef ptrdiff_t GLintptrARB; typedef ptrdiff_t GLsizeiptrARB; #endif +#endif #ifndef GL_ARB_shader_objects /* GL types for handling shader object handles and program/shader text */ typedef char GLcharARB; /* native character */ +#if defined(__APPLE__) +typedef void *GLhandleARB; /* shader object handle */ +#else typedef unsigned int GLhandleARB; /* shader object handle */ #endif +#endif /* GL types for "half" precision (s10e5) float data in host memory */ #ifndef GL_ARB_half_float_pixel diff --git a/engine/code/SDL12/include/SDL_platform.h b/engine/code/SDL12/include/SDL_platform.h index 11d86736..48540a85 100644 --- a/engine/code/SDL12/include/SDL_platform.h +++ b/engine/code/SDL12/include/SDL_platform.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_quit.h b/engine/code/SDL12/include/SDL_quit.h index 6d82e7e0..abd2ec6c 100644 --- a/engine/code/SDL12/include/SDL_quit.h +++ b/engine/code/SDL12/include/SDL_quit.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_rwops.h b/engine/code/SDL12/include/SDL_rwops.h index a450119f..98361d7e 100644 --- a/engine/code/SDL12/include/SDL_rwops.h +++ b/engine/code/SDL12/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_stdinc.h b/engine/code/SDL12/include/SDL_stdinc.h index e1f85fb7..35a4fdde 100644 --- a/engine/code/SDL12/include/SDL_stdinc.h +++ b/engine/code/SDL12/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_syswm.h b/engine/code/SDL12/include/SDL_syswm.h index 716dddcb..78433c6a 100644 --- a/engine/code/SDL12/include/SDL_syswm.h +++ b/engine/code/SDL12/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -203,12 +203,13 @@ typedef struct SDL_SysWMinfo { /** * This function gives you custom hooks into the window manager information. * It fills the structure pointed to by 'info' with custom information and - * returns 1 if the function is implemented. If it's not implemented, or - * the version member of the 'info' structure is invalid, it returns 0. + * returns 0 if the function is not implemented, 1 if the function is + * implemented and no error occurred, and -1 if the version member of + * the 'info' structure is not filled in or not supported. * * You typically use this function like this: * @code - * SDL_SysWMInfo info; + * SDL_SysWMinfo info; * SDL_VERSION(&info.version); * if ( SDL_GetWMInfo(&info) ) { ... } * @endcode diff --git a/engine/code/SDL12/include/SDL_thread.h b/engine/code/SDL12/include/SDL_thread.h index 1ca9a1bc..9ebe00ed 100644 --- a/engine/code/SDL12/include/SDL_thread.h +++ b/engine/code/SDL12/include/SDL_thread.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -68,11 +68,6 @@ typedef struct SDL_Thread SDL_Thread; #ifdef __OS2__ typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg); typedef void (*pfnSDL_CurrentEndThread)(void); -#elif __GNUC__ -typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, - unsigned (__stdcall *func)(void *), void *arg, - unsigned, unsigned *threadID); -typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); #else typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall *func)(void *), void *arg, diff --git a/engine/code/SDL12/include/SDL_timer.h b/engine/code/SDL12/include/SDL_timer.h index d7cd0246..d764d5f3 100644 --- a/engine/code/SDL12/include/SDL_timer.h +++ b/engine/code/SDL12/include/SDL_timer.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_types.h b/engine/code/SDL12/include/SDL_types.h index cfa35236..79d8b28d 100644 --- a/engine/code/SDL12/include/SDL_types.h +++ b/engine/code/SDL12/include/SDL_types.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/SDL_version.h b/engine/code/SDL12/include/SDL_version.h index fa02c3f6..fdc17c64 100644 --- a/engine/code/SDL12/include/SDL_version.h +++ b/engine/code/SDL12/include/SDL_version.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ extern "C" { /*@{*/ #define SDL_MAJOR_VERSION 1 #define SDL_MINOR_VERSION 2 -#define SDL_PATCHLEVEL 14 +#define SDL_PATCHLEVEL 15 /*@}*/ typedef struct SDL_version { diff --git a/engine/code/SDL12/include/SDL_video.h b/engine/code/SDL12/include/SDL_video.h index 8f7f3052..f9c4e070 100644 --- a/engine/code/SDL12/include/SDL_video.h +++ b/engine/code/SDL12/include/SDL_video.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/engine/code/SDL12/include/begin_code.h b/engine/code/SDL12/include/begin_code.h index 22748090..27e2f7bc 100644 --- a/engine/code/SDL12/include/begin_code.h +++ b/engine/code/SDL12/include/begin_code.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -43,7 +43,7 @@ #ifndef DECLSPEC # if defined(__BEOS__) || defined(__HAIKU__) # if defined(__GNUC__) -# define DECLSPEC __declspec(dllexport) +# define DECLSPEC # else # define DECLSPEC __declspec(export) # endif @@ -132,7 +132,12 @@ #ifdef __BORLANDC__ #pragma nopackwarning #endif +#ifdef _M_X64 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ +#pragma pack(push,8) +#else #pragma pack(push,4) +#endif #elif (defined(__MWERKS__) && defined(__MACOS__)) #pragma options align=mac68k4byte #pragma enumsalwaysint on diff --git a/engine/code/SDL12/include/close_code.h b/engine/code/SDL12/include/close_code.h index 46a07208..19a00246 100644 --- a/engine/code/SDL12/include/close_code.h +++ b/engine/code/SDL12/include/close_code.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public diff --git a/engine/code/asm/vm_x86_64.asm b/engine/code/asm/vm_x86_64.asm index 030b6987..87e04f4d 100644 --- a/engine/code/asm/vm_x86_64.asm +++ b/engine/code/asm/vm_x86_64.asm @@ -23,26 +23,8 @@ ; ; assumes __fastcall calling convention -DoSyscall PROTO - .code -; Call to static void DoSyscall(int syscallNum, int programStack, int *opStackBase, uint8_t opStackOfs, intptr_t arg) - -qsyscall64 PROC - sub rsp, 28h ; after this esp will be aligned to 16 byte boundary - mov qword ptr [rsp + 20h], rcx ; 5th parameter "arg" is passed on stack - mov r9b, bl ; opStackOfs - mov r8, rdi ; opStackBase - mov edx, esi ; programStack - mov ecx, eax ; syscallNum - mov rax, DoSyscall ; store call address of DoSyscall in rax - call rax - add rsp, 28h - ret -qsyscall64 ENDP - - ; Call to compiled code after setting up the register environment for the VM ; prototype: ; uint8_t qvmcall64(int *programStack, int *opStack, intptr_t *instructionPointers, byte *dataBase); diff --git a/engine/code/botlib/be_aas_bspq3.c b/engine/code/botlib/be_aas_bspq3.c index 9bfc824f..a6b6edb0 100644 --- a/engine/code/botlib/be_aas_bspq3.c +++ b/engine/code/botlib/be_aas_bspq3.c @@ -392,7 +392,7 @@ void AAS_ParseBSPEntities(void) { if (strcmp(token.string, "{")) { - ScriptError(script, "invalid %s\n", token.string); + ScriptError(script, "invalid %s", token.string); AAS_FreeBSPEntities(); FreeScript(script); return; @@ -413,7 +413,7 @@ void AAS_ParseBSPEntities(void) ent->epairs = epair; if (token.type != TT_STRING) { - ScriptError(script, "invalid %s\n", token.string); + ScriptError(script, "invalid %s", token.string); AAS_FreeBSPEntities(); FreeScript(script); return; @@ -433,7 +433,7 @@ void AAS_ParseBSPEntities(void) } //end while if (strcmp(token.string, "}")) { - ScriptError(script, "missing }\n"); + ScriptError(script, "missing }"); AAS_FreeBSPEntities(); FreeScript(script); return; @@ -469,7 +469,7 @@ void AAS_DumpBSPData(void) Com_Memset( &bspworld, 0, sizeof(bspworld) ); } //end of the function AAS_DumpBSPData //=========================================================================== -// load an bsp file +// load a .bsp file // // Parameter: - // Returns: - diff --git a/engine/code/botlib/be_aas_cluster.c b/engine/code/botlib/be_aas_cluster.c index 6c029eeb..013e8066 100644 --- a/engine/code/botlib/be_aas_cluster.c +++ b/engine/code/botlib/be_aas_cluster.c @@ -130,7 +130,7 @@ int AAS_UpdatePortal(int areanum, int clusternum) // if (portalnum == aasworld.numportals) { - AAS_Error("no portal of area %d", areanum); + AAS_Error("no portal of area %d\n", areanum); return qtrue; } //end if // @@ -157,7 +157,7 @@ int AAS_UpdatePortal(int areanum, int clusternum) } //end else if (aasworld.portalindexsize >= AAS_MAX_PORTALINDEXSIZE) { - AAS_Error("AAS_MAX_PORTALINDEXSIZE"); + AAS_Error("AAS_MAX_PORTALINDEXSIZE\n"); return qtrue; } //end if //set the area cluster number to the negative portal number @@ -184,7 +184,7 @@ int AAS_FloodClusterAreas_r(int areanum, int clusternum) // if (areanum <= 0 || areanum >= aasworld.numareas) { - AAS_Error("AAS_FloodClusterAreas_r: areanum out of range"); + AAS_Error("AAS_FloodClusterAreas_r: areanum out of range\n"); return qfalse; } //end if //if the area is already part of a cluster @@ -194,7 +194,7 @@ int AAS_FloodClusterAreas_r(int areanum, int clusternum) // //there's a reachability going from one cluster to another only in one direction // - AAS_Error("cluster %d touched cluster %d at area %d\r\n", + AAS_Error("cluster %d touched cluster %d at area %d\n", clusternum, aasworld.areasettings[areanum].cluster, areanum); return qfalse; } //end if @@ -410,7 +410,7 @@ int AAS_FindClusters(void) continue; if (aasworld.numclusters >= AAS_MAX_CLUSTERS) { - AAS_Error("AAS_MAX_CLUSTERS"); + AAS_Error("AAS_MAX_CLUSTERS\n"); return qfalse; } //end if cluster = &aasworld.clusters[aasworld.numclusters]; @@ -449,7 +449,7 @@ void AAS_CreatePortals(void) { if (aasworld.numportals >= AAS_MAX_PORTALS) { - AAS_Error("AAS_MAX_PORTALS"); + AAS_Error("AAS_MAX_PORTALS\n"); return; } //end if portal = &aasworld.portals[aasworld.numportals]; @@ -776,7 +776,7 @@ int AAS_GetAdjacentAreasWithLessPresenceTypes_r(int *areanums, int numareas, int { if (numareas >= MAX_PORTALAREAS) { - AAS_Error("MAX_PORTALAREAS"); + AAS_Error("MAX_PORTALAREAS\n"); return numareas; } //end if numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, numareas, otherareanum); diff --git a/engine/code/botlib/be_aas_file.c b/engine/code/botlib/be_aas_file.c index 9395b1d3..f74f5318 100644 --- a/engine/code/botlib/be_aas_file.c +++ b/engine/code/botlib/be_aas_file.c @@ -281,7 +281,7 @@ void AAS_FileInfo(void) } //end of the function AAS_FileInfo #endif //AASFILEDEBUG //=========================================================================== -// allocate memory and read a lump of a AAS file +// allocate memory and read a lump of an AAS file // // Parameter: - // Returns: - diff --git a/engine/code/botlib/be_aas_main.c b/engine/code/botlib/be_aas_main.c index 0dab57c8..7a9f7017 100644 --- a/engine/code/botlib/be_aas_main.c +++ b/engine/code/botlib/be_aas_main.c @@ -423,7 +423,7 @@ void AAS_Shutdown(void) //aas has not been initialized aasworld.initialized = qfalse; //NOTE: as soon as a new .bsp file is loaded the .bsp file memory is - // freed an reallocated, so there's no need to free that memory here + // freed and reallocated, so there's no need to free that memory here //print shutdown botimport.Print(PRT_MESSAGE, "AAS shutdown.\n"); } //end of the function AAS_Shutdown diff --git a/engine/code/botlib/be_aas_reach.c b/engine/code/botlib/be_aas_reach.c index 6c457958..3a4564ca 100644 --- a/engine/code/botlib/be_aas_reach.c +++ b/engine/code/botlib/be_aas_reach.c @@ -412,7 +412,7 @@ int AAS_BestReachableArea(vec3_t origin, vec3_t mins, vec3_t maxs, vec3_t goalor else { //it can very well happen that the AAS_PointAreaNum function tells that - //a point is in an area and that starting a AAS_TraceClientBBox from that + //a point is in an area and that starting an AAS_TraceClientBBox from that //point will return trace.startsolid qtrue #if 0 if (AAS_PointAreaNum(start)) @@ -490,7 +490,7 @@ aas_lreachability_t *AAS_AllocReachability(void) if (!nextreachability) return NULL; //make sure the error message only shows up once - if (!nextreachability->next) AAS_Error("AAS_MAX_REACHABILITYSIZE"); + if (!nextreachability->next) AAS_Error("AAS_MAX_REACHABILITYSIZE\n"); // r = nextreachability; nextreachability = nextreachability->next; @@ -523,7 +523,7 @@ int AAS_AreaReachability(int areanum) { if (areanum < 0 || areanum >= aasworld.numareas) { - AAS_Error("AAS_AreaReachability: areanum %d out of range", areanum); + AAS_Error("AAS_AreaReachability: areanum %d out of range\n", areanum); return 0; } //end if return aasworld.areasettings[areanum].numreachableareas; @@ -848,7 +848,7 @@ int AAS_Reachability_Swim(int area1num, int area2num) area1 = &aasworld.areas[area1num]; area2 = &aasworld.areas[area2num]; - //if the areas are not near anough + //if the areas are not near enough for (i = 0; i < 3; i++) { if (area1->mins[i] > area2->maxs[i] + 10) return qfalse; @@ -923,7 +923,7 @@ int AAS_Reachability_EqualFloorHeight(int area1num, int area2num) area1 = &aasworld.areas[area1num]; area2 = &aasworld.areas[area2num]; - //if the areas are not near anough in the x-y direction + //if the areas are not near enough in the x-y direction for (i = 0; i < 2; i++) { if (area1->mins[i] > area2->maxs[i] + 10) return qfalse; @@ -1085,7 +1085,7 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2 area2 = &aasworld.areas[area2num]; //if the first area contains a liquid area1swim = AAS_AreaSwim(area1num); - //if the areas are not near anough in the x-y direction + //if the areas are not near enough in the x-y direction for (i = 0; i < 2; i++) { if (area1->mins[i] > area2->maxs[i] + 10) return qfalse; @@ -2131,7 +2131,7 @@ int AAS_Reachability_Jump(int area1num, int area2num) //maximum height a player can jump with the given initial z velocity maxjumpheight = AAS_MaxJumpHeight(phys_jumpvel); - //if the areas are not near anough in the x-y direction + //if the areas are not near enough in the x-y direction for (i = 0; i < 2; i++) { if (area1->mins[i] > area2->maxs[i] + maxjumpdistance) return qfalse; diff --git a/engine/code/botlib/be_aas_route.c b/engine/code/botlib/be_aas_route.c index 1d57b530..5e365973 100644 --- a/engine/code/botlib/be_aas_route.c +++ b/engine/code/botlib/be_aas_route.c @@ -106,7 +106,7 @@ void AAS_RoutingInfo(void) // Returns: - // Changes Globals: - //=========================================================================== -ID_INLINE int AAS_ClusterAreaNum(int cluster, int areanum) +static ID_INLINE int AAS_ClusterAreaNum(int cluster, int areanum) { int side, areacluster; @@ -166,7 +166,7 @@ void AAS_InitTravelFlagFromType(void) // Returns: - // Changes Globals: - //=========================================================================== -ID_INLINE int AAS_TravelFlagForType_inline(int traveltype) +static ID_INLINE int AAS_TravelFlagForType_inline(int traveltype) { int tfl; @@ -339,7 +339,7 @@ int AAS_EnableRoutingArea(int areanum, int enable) // Returns: - // Changes Globals: - //=========================================================================== -ID_INLINE float AAS_RoutingTime(void) +static ID_INLINE float AAS_RoutingTime(void) { return AAS_Time(); } //end of the function AAS_RoutingTime @@ -379,7 +379,7 @@ int AAS_GetAreaContentsTravelFlags(int areanum) // Returns: - // Changes Globals: - //=========================================================================== -ID_INLINE int AAS_AreaContentsTravelFlags_inline(int areanum) +static ID_INLINE int AAS_AreaContentsTravelFlags_inline(int areanum) { return aasworld.areacontentstravelflags[areanum]; } //end of the function AAS_AreaContentsTravelFlags @@ -1074,7 +1074,7 @@ int AAS_ReadRouteCache(void) } //end if if (routecacheheader.version != RCVERSION) { - AAS_Error("route cache dump has wrong version %d, should be %d", routecacheheader.version, RCVERSION); + AAS_Error("route cache dump has wrong version %d, should be %d\n", routecacheheader.version, RCVERSION); return qfalse; } //end if if (routecacheheader.numareas != aasworld.numareas) diff --git a/engine/code/botlib/be_ai_char.c b/engine/code/botlib/be_ai_char.c index b5d044ce..b94c4e9a 100644 --- a/engine/code/botlib/be_ai_char.c +++ b/engine/code/botlib/be_ai_char.c @@ -256,7 +256,7 @@ bot_character_t *BotLoadCharacterFromFile(char *charfile, int skill) if (!strcmp(token.string, "}")) break; if (token.type != TT_NUMBER || !(token.subtype & TT_INTEGER)) { - SourceError(source, "expected integer index, found %s\n", token.string); + SourceError(source, "expected integer index, found %s", token.string); FreeSource(source); BotFreeCharacterStrings(ch); FreeMemory(ch); @@ -265,7 +265,7 @@ bot_character_t *BotLoadCharacterFromFile(char *charfile, int skill) index = token.intvalue; if (index < 0 || index > MAX_CHARACTERISTICS) { - SourceError(source, "characteristic index out of range [0, %d]\n", MAX_CHARACTERISTICS); + SourceError(source, "characteristic index out of range [0, %d]", MAX_CHARACTERISTICS); FreeSource(source); BotFreeCharacterStrings(ch); FreeMemory(ch); @@ -273,7 +273,7 @@ bot_character_t *BotLoadCharacterFromFile(char *charfile, int skill) } //end if if (ch->c[index].type) { - SourceError(source, "characteristic %d already initialized\n", index); + SourceError(source, "characteristic %d already initialized", index); FreeSource(source); BotFreeCharacterStrings(ch); FreeMemory(ch); @@ -308,7 +308,7 @@ bot_character_t *BotLoadCharacterFromFile(char *charfile, int skill) } //end else if else { - SourceError(source, "expected integer, float or string, found %s\n", token.string); + SourceError(source, "expected integer, float or string, found %s", token.string); FreeSource(source); BotFreeCharacterStrings(ch); FreeMemory(ch); @@ -336,7 +336,7 @@ bot_character_t *BotLoadCharacterFromFile(char *charfile, int skill) } //end if else { - SourceError(source, "unknown definition %s\n", token.string); + SourceError(source, "unknown definition %s", token.string); FreeSource(source); BotFreeCharacterStrings(ch); FreeMemory(ch); @@ -713,7 +713,7 @@ int Characteristic_Integer(int character, int index) } //end else if else { - botimport.Print(PRT_ERROR, "characteristic %d is not a integer\n", index); + botimport.Print(PRT_ERROR, "characteristic %d is not an integer\n", index); return 0; } //end else if // return 0; diff --git a/engine/code/botlib/be_ai_chat.c b/engine/code/botlib/be_ai_chat.c index cc489d55..867e4391 100644 --- a/engine/code/botlib/be_ai_chat.c +++ b/engine/code/botlib/be_ai_chat.c @@ -739,7 +739,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename) } //end while if (numsynonyms < 2) { - SourceError(source, "synonym must have at least two entries\n"); + SourceError(source, "synonym must have at least two entries"); FreeSource(source); return NULL; } //end if @@ -891,7 +891,7 @@ int BotLoadChatMessage(source_t *source, char *chatmessagestring) StripDoubleQuotes(token.string); if (strlen(ptr) + strlen(token.string) + 1 > MAX_MESSAGE_SIZE) { - SourceError(source, "chat message too long\n"); + SourceError(source, "chat message too long"); return qfalse; } //end if strcat(ptr, token.string); @@ -901,7 +901,7 @@ int BotLoadChatMessage(source_t *source, char *chatmessagestring) { if (strlen(ptr) + 7 > MAX_MESSAGE_SIZE) { - SourceError(source, "chat message too long\n"); + SourceError(source, "chat message too long"); return qfalse; } //end if sprintf(&ptr[strlen(ptr)], "%cv%ld%c", ESCAPE_CHAR, token.intvalue, ESCAPE_CHAR); @@ -911,14 +911,14 @@ int BotLoadChatMessage(source_t *source, char *chatmessagestring) { if (strlen(ptr) + 7 > MAX_MESSAGE_SIZE) { - SourceError(source, "chat message too long\n"); + SourceError(source, "chat message too long"); return qfalse; } //end if sprintf(&ptr[strlen(ptr)], "%cr%s%c", ESCAPE_CHAR, token.string, ESCAPE_CHAR); } //end else if else { - SourceError(source, "unknown message component %s\n", token.string); + SourceError(source, "unknown message component %s", token.string); return qfalse; } //end else if (PC_CheckTokenString(source, ";")) break; @@ -1175,14 +1175,14 @@ bot_matchpiece_t *BotLoadMatchPieces(source_t *source, char *endtoken) { if (token.intvalue >= MAX_MATCHVARIABLES) { - SourceError(source, "can't have more than %d match variables\n", MAX_MATCHVARIABLES); + SourceError(source, "can't have more than %d match variables", MAX_MATCHVARIABLES); FreeSource(source); BotFreeMatchPieces(firstpiece); return NULL; } //end if if (lastwasvariable) { - SourceError(source, "not allowed to have adjacent variables\n"); + SourceError(source, "not allowed to have adjacent variables"); FreeSource(source); BotFreeMatchPieces(firstpiece); return NULL; @@ -1238,7 +1238,7 @@ bot_matchpiece_t *BotLoadMatchPieces(source_t *source, char *endtoken) } //end if else { - SourceError(source, "invalid token %s\n", token.string); + SourceError(source, "invalid token %s", token.string); FreeSource(source); BotFreeMatchPieces(firstpiece); return NULL; @@ -1298,7 +1298,7 @@ bot_matchtemplate_t *BotLoadMatchTemplates(char *matchfile) { if (token.type != TT_NUMBER || !(token.subtype & TT_INTEGER)) { - SourceError(source, "expected integer, found %s\n", token.string); + SourceError(source, "expected integer, found %s", token.string); BotFreeMatchTemplates(matches); FreeSource(source); return NULL; @@ -2080,7 +2080,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname) return NULL; } //end if StripDoubleQuotes(token.string); - //after the chat name we expect a opening brace + //after the chat name we expect an opening brace if (!PC_ExpectTokenString(source, "{")) { FreeSource(source); @@ -2101,7 +2101,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname) if (!strcmp(token.string, "}")) break; if (strcmp(token.string, "type")) { - SourceError(source, "expected type found %s\n", token.string); + SourceError(source, "expected type found %s", token.string); FreeSource(source); return NULL; } //end if @@ -2172,7 +2172,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname) } //end if else { - SourceError(source, "unknown definition %s\n", token.string); + SourceError(source, "unknown definition %s", token.string); FreeSource(source); return NULL; } //end else diff --git a/engine/code/botlib/be_ai_goal.c b/engine/code/botlib/be_ai_goal.c index 538a82e0..9feeeab5 100644 --- a/engine/code/botlib/be_ai_goal.c +++ b/engine/code/botlib/be_ai_goal.c @@ -300,7 +300,7 @@ itemconfig_t *LoadItemConfig(char *filename) { if (ic->numiteminfo >= max_iteminfo) { - SourceError(source, "more than %d item info defined\n", max_iteminfo); + SourceError(source, "more than %d item info defined", max_iteminfo); FreeMemory(ic); FreeSource(source); return NULL; @@ -326,7 +326,7 @@ itemconfig_t *LoadItemConfig(char *filename) } //end if else { - SourceError(source, "unknown definition %s\n", token.string); + SourceError(source, "unknown definition %s", token.string); FreeMemory(ic); FreeSource(source); return NULL; @@ -1018,7 +1018,7 @@ void BotUpdateEntityItems(void) for (li = levelitems; li; li = nextli) { nextli = li->next; - //if it is a item that will time out + //if it is an item that will time out if (li->timeout) { //timeout the item diff --git a/engine/code/botlib/be_ai_move.c b/engine/code/botlib/be_ai_move.c index e633ebcc..c808dbc6 100644 --- a/engine/code/botlib/be_ai_move.c +++ b/engine/code/botlib/be_ai_move.c @@ -742,7 +742,7 @@ void BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type) int BotGetReachabilityToGoal(vec3_t origin, int areanum, int lastgoalareanum, int lastareanum, int *avoidreach, float *avoidreachtimes, int *avoidreachtries, - bot_goal_t *goal, int travelflags, int movetravelflags, + bot_goal_t *goal, int travelflags, struct bot_avoidspot_s *avoidspots, int numavoidspots, int *flags) { int i, t, besttime, bestreachnum, reachnum; @@ -754,7 +754,6 @@ int BotGetReachabilityToGoal(vec3_t origin, int areanum, if (AAS_AreaDoNotEnter(areanum) || AAS_AreaDoNotEnter(goal->areanum)) { travelflags |= TFL_DONOTENTER; - movetravelflags |= TFL_DONOTENTER; } //end if //use the routing to find the next area to go to besttime = 0; @@ -764,7 +763,7 @@ int BotGetReachabilityToGoal(vec3_t origin, int areanum, reachnum = AAS_NextAreaReachability(areanum, reachnum)) { #ifdef AVOIDREACH - //check if it isn't an reachability to avoid + //check if it isn't a reachability to avoid for (i = 0; i < MAX_AVOIDREACH; i++) { if (avoidreach[i] == reachnum && avoidreachtimes[i] >= AAS_Time()) break; @@ -787,7 +786,7 @@ int BotGetReachabilityToGoal(vec3_t origin, int areanum, if (lastgoalareanum == goal->areanum && reach.areanum == lastareanum) continue; //if (AAS_AreaContentsTravelFlags(reach.areanum) & ~travelflags) continue; //if the travel isn't valid - if (!BotValidTravel(origin, &reach, movetravelflags)) continue; + if (!BotValidTravel(origin, &reach, travelflags)) continue; //get the travel time t = AAS_AreaTravelTimeToGoalArea(reach.areanum, reach.end, goal->areanum, travelflags); //if the goal area isn't reachable from the reachable area @@ -874,7 +873,7 @@ int BotMovementViewTarget(int movestate, bot_goal_t *goal, int travelflags, floa reachnum = BotGetReachabilityToGoal(reach.end, reach.areanum, ms->lastgoalareanum, lastareanum, ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries, - goal, travelflags, travelflags, NULL, 0, NULL); + goal, travelflags, NULL, 0, NULL); VectorCopy(reach.end, end); lastareanum = reach.areanum; if (lastareanum == goal->areanum) @@ -933,7 +932,7 @@ int BotPredictVisiblePosition(vec3_t origin, int areanum, bot_goal_t *goal, int reachnum = BotGetReachabilityToGoal(end, areanum, lastgoalareanum, lastareanum, avoidreach, avoidreachtimes, avoidreachtries, - goal, travelflags, travelflags, NULL, 0, NULL); + goal, travelflags, NULL, 0, NULL); if (!reachnum) return qfalse; AAS_ReachabilityFromNum(reachnum, &reach); // @@ -1988,7 +1987,7 @@ bot_moveresult_t BotTravel_Ladder(bot_movestate_t *ms, aas_reachability_t *reach { //botimport.Print(PRT_MESSAGE, "moving towards ladder\n"); VectorSubtract(reach->end, ms->origin, dir); - //make sure the horizontal movement is large anough + //make sure the horizontal movement is large enough VectorCopy(dir, hordir); hordir[2] = 0; dist = VectorNormalize(hordir); @@ -3246,7 +3245,7 @@ void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, in reachnum = BotGetReachabilityToGoal(ms->origin, ms->areanum, ms->lastgoalareanum, ms->lastareanum, ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries, - goal, travelflags, travelflags, + goal, travelflags, ms->avoidspots, ms->numavoidspots, &resultflags); //the area number the reachability starts in ms->reachareanum = ms->areanum; @@ -3369,7 +3368,7 @@ void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, in lastreachnum = BotGetReachabilityToGoal(end, areas[i], ms->lastgoalareanum, ms->lastareanum, ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries, - goal, travelflags, TFL_JUMPPAD, ms->avoidspots, ms->numavoidspots, NULL); + goal, TFL_JUMPPAD, ms->avoidspots, ms->numavoidspots, NULL); if (lastreachnum) { ms->lastreachnum = lastreachnum; @@ -3389,7 +3388,6 @@ void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, in ms->lastreachnum = lastreachnum; ms->lastareanum = areas[i]; //botimport.Print(PRT_MESSAGE, "found jumppad reachability hard!!\n"); - break; } //end if } //end for if (lastreachnum) break; diff --git a/engine/code/botlib/be_ai_weight.c b/engine/code/botlib/be_ai_weight.c index 17216aba..9f3d0f74 100644 --- a/engine/code/botlib/be_ai_weight.c +++ b/engine/code/botlib/be_ai_weight.c @@ -63,18 +63,18 @@ int ReadValue(source_t *source, float *value) if (!PC_ExpectAnyToken(source, &token)) return qfalse; if (!strcmp(token.string, "-")) { - SourceWarning(source, "negative value set to zero\n"); + SourceWarning(source, "negative value set to zero"); if(!PC_ExpectAnyToken(source, &token)) { - SourceError(source, "Missing return value\n"); + SourceError(source, "Missing return value"); return qfalse; } } if (token.type != TT_NUMBER) { - SourceError(source, "invalid return value %s\n", token.string); + SourceError(source, "invalid return value %s", token.string); return qfalse; } @@ -186,7 +186,7 @@ fuzzyseperator_t *ReadFuzzySeperators_r(source_t *source) { if (founddefault) { - SourceError(source, "switch already has a default\n"); + SourceError(source, "switch already has a default"); FreeFuzzySeperators_r(firstfs); return NULL; } //end if @@ -236,7 +236,7 @@ fuzzyseperator_t *ReadFuzzySeperators_r(source_t *source) } //end else if else { - SourceError(source, "invalid name %s\n", token.string); + SourceError(source, "invalid name %s", token.string); return NULL; } //end else if (newindent) @@ -251,7 +251,7 @@ fuzzyseperator_t *ReadFuzzySeperators_r(source_t *source) else { FreeFuzzySeperators_r(firstfs); - SourceError(source, "invalid name %s\n", token.string); + SourceError(source, "invalid name %s", token.string); return NULL; } //end else if (!PC_ExpectAnyToken(source, &token)) @@ -263,7 +263,7 @@ fuzzyseperator_t *ReadFuzzySeperators_r(source_t *source) // if (!founddefault) { - SourceWarning(source, "switch without default\n"); + SourceWarning(source, "switch without default"); fs = (fuzzyseperator_t *) GetClearedMemory(sizeof(fuzzyseperator_t)); fs->index = index; fs->value = MAX_INVENTORYVALUE; @@ -342,7 +342,7 @@ weightconfig_t *ReadWeightConfig(char *filename) { if (config->numweights >= MAX_WEIGHTS) { - SourceWarning(source, "too many fuzzy weights\n"); + SourceWarning(source, "too many fuzzy weights"); break; } //end if if (!PC_ExpectTokenType(source, TT_STRING, 0, &token)) @@ -400,7 +400,7 @@ weightconfig_t *ReadWeightConfig(char *filename) } //end else if else { - SourceError(source, "invalid name %s\n", token.string); + SourceError(source, "invalid name %s", token.string); FreeWeightConfig(config); FreeSource(source); return NULL; @@ -418,7 +418,7 @@ weightconfig_t *ReadWeightConfig(char *filename) } //end if else { - SourceError(source, "invalid name %s\n", token.string); + SourceError(source, "invalid name %s", token.string); FreeWeightConfig(config); FreeSource(source); return NULL; diff --git a/engine/code/botlib/be_interface.c b/engine/code/botlib/be_interface.c index 4c982082..394a7643 100644 --- a/engine/code/botlib/be_interface.c +++ b/engine/code/botlib/be_interface.c @@ -323,7 +323,7 @@ void ElevatorBottomCenter(aas_reachability_t *reach, vec3_t bottomcenter); int BotGetReachabilityToGoal(vec3_t origin, int areanum, int lastgoalareanum, int lastareanum, int *avoidreach, float *avoidreachtimes, int *avoidreachtries, - bot_goal_t *goal, int travelflags, int movetravelflags, + bot_goal_t *goal, int travelflags, struct bot_avoidspot_s *avoidspots, int numavoidspots, int *flags); int AAS_PointLight(vec3_t origin, int *red, int *green, int *blue); diff --git a/engine/code/botlib/botlib.h b/engine/code/botlib/botlib.h index f225d5fa..36721028 100644 --- a/engine/code/botlib/botlib.h +++ b/engine/code/botlib/botlib.h @@ -103,7 +103,7 @@ struct weaponinfo_s; #define ACTION_FOLLOWME 0x08000000 #define ACTION_JUMPEDLASTFRAME 0x10000000 -//the bot input, will be converted to an usercmd_t +//the bot input, will be converted to a usercmd_t typedef struct bot_input_s { float thinktime; //time since last output (in seconds) diff --git a/engine/code/botlib/l_precomp.c b/engine/code/botlib/l_precomp.c index af9e068d..e427d8a2 100644 --- a/engine/code/botlib/l_precomp.c +++ b/engine/code/botlib/l_precomp.c @@ -269,7 +269,7 @@ token_t *PC_CopyToken(token_t *token) if (!t) { #ifdef BSPC - Error("out of token space\n"); + Error("out of token space"); #else Com_Error(ERR_FATAL, "out of token space"); #endif @@ -1666,7 +1666,7 @@ int PC_OperatorPriority(int op) #define MAX_OPERATORS 64 #define AllocValue(val) \ if (numvalues >= MAX_VALUES) { \ - SourceError(source, "out of value space\n"); \ + SourceError(source, "out of value space"); \ error = 1; \ break; \ } \ @@ -1676,7 +1676,7 @@ int PC_OperatorPriority(int op) // #define AllocOperator(op) \ if (numoperators >= MAX_OPERATORS) { \ - SourceError(source, "out of operator space\n"); \ + SourceError(source, "out of operator space"); \ error = 1; \ break; \ } \ @@ -1838,7 +1838,7 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval t->subtype == P_BIN_AND || t->subtype == P_BIN_OR || t->subtype == P_BIN_XOR) { - SourceError(source, "illigal operator %s on floating point operands\n", t->string); + SourceError(source, "illigal operator %s on floating point operands", t->string); error = 1; break; } //end if @@ -2005,7 +2005,7 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval v1->floatvalue *= v2->floatvalue; break; case P_DIV: if (!v2->intvalue || !v2->floatvalue) { - SourceError(source, "divide by zero in #if/#elif\n"); + SourceError(source, "divide by zero in #if/#elif"); error = 1; break; } @@ -2013,7 +2013,7 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval v1->floatvalue /= v2->floatvalue; break; case P_MOD: if (!v2->intvalue) { - SourceError(source, "divide by zero in #if/#elif\n"); + SourceError(source, "divide by zero in #if/#elif"); error = 1; break; } @@ -2750,7 +2750,7 @@ int PC_ReadToken(source_t *source, token_t *token) token->string[strlen(token->string)-1] = '\0'; if (strlen(token->string) + strlen(newtoken.string+1) + 1 >= MAX_TOKEN) { - SourceError(source, "string longer than MAX_TOKEN %d\n", MAX_TOKEN); + SourceError(source, "string longer than MAX_TOKEN %d", MAX_TOKEN); return qfalse; } strcat(token->string, newtoken.string+1); diff --git a/engine/code/botlib/l_precomp.h b/engine/code/botlib/l_precomp.h index ca1d9640..bdf8e9c9 100644 --- a/engine/code/botlib/l_precomp.h +++ b/engine/code/botlib/l_precomp.h @@ -117,7 +117,7 @@ int PC_ExpectTokenType(source_t *source, int type, int subtype, token_t *token); int PC_ExpectAnyToken(source_t *source, token_t *token); //returns true when the token is available int PC_CheckTokenString(source_t *source, char *string); -//returns true an reads the token when a token with the given type is available +//returns true and reads the token when a token with the given type is available int PC_CheckTokenType(source_t *source, int type, int subtype, token_t *token); //skip tokens until the given token string is read int PC_SkipUntilString(source_t *source, char *string); diff --git a/engine/code/botlib/l_script.c b/engine/code/botlib/l_script.c index 1e1f1f12..cc74404a 100644 --- a/engine/code/botlib/l_script.c +++ b/engine/code/botlib/l_script.c @@ -879,7 +879,7 @@ int PS_ReadToken(script_t *script, token_t *token) { if (!PS_ReadString(script, token, '\"')) return 0; } //end if - //if an literal + //if a literal else if (*script->script_p == '\'') { //if (!PS_ReadLiteral(script, token)) return 0; @@ -1158,7 +1158,7 @@ float ReadSignedFloat(script_t *script) { if(!PS_ExpectAnyToken(script, &token)) { - ScriptError(script, "Missing float value\n"); + ScriptError(script, "Missing float value"); return 0; } @@ -1167,7 +1167,7 @@ float ReadSignedFloat(script_t *script) if (token.type != TT_NUMBER) { - ScriptError(script, "expected float value, found %s\n", token.string); + ScriptError(script, "expected float value, found %s", token.string); return 0; } @@ -1189,7 +1189,7 @@ signed long int ReadSignedInt(script_t *script) { if(!PS_ExpectAnyToken(script, &token)) { - ScriptError(script, "Missing integer value\n"); + ScriptError(script, "Missing integer value"); return 0; } @@ -1198,7 +1198,7 @@ signed long int ReadSignedInt(script_t *script) if (token.type != TT_NUMBER || token.subtype == TT_FLOAT) { - ScriptError(script, "expected integer value, found %s\n", token.string); + ScriptError(script, "expected integer value, found %s", token.string); return 0; } diff --git a/engine/code/botlib/l_script.h b/engine/code/botlib/l_script.h index ce701cb3..f8b7483a 100644 --- a/engine/code/botlib/l_script.h +++ b/engine/code/botlib/l_script.h @@ -201,7 +201,7 @@ int PS_ExpectTokenType(script_t *script, int type, int subtype, token_t *token); int PS_ExpectAnyToken(script_t *script, token_t *token); //returns true when the token is available int PS_CheckTokenString(script_t *script, char *string); -//returns true an reads the token when a token with the given type is available +//returns true and reads the token when a token with the given type is available int PS_CheckTokenType(script_t *script, int type, int subtype, token_t *token); //skip tokens until the given token string is read int PS_SkipUntilString(script_t *script, char *string); diff --git a/engine/code/cgame/cg_consolecmds.c b/engine/code/cgame/cg_consolecmds.c index 6dacda7a..8f7b97e6 100644 --- a/engine/code/cgame/cg_consolecmds.c +++ b/engine/code/cgame/cg_consolecmds.c @@ -25,8 +25,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // executed by a key binding #include "cg_local.h" -#include "../ui/ui_shared.h" #ifdef MISSIONPACK +#include "../ui/ui_shared.h" extern menuDef_t *menuScoreboard; #endif @@ -211,6 +211,7 @@ static void CG_TellAttacker_f( void ) { trap_SendClientCommand( command ); } +#ifdef MISSIONPACK static void CG_VoiceTellTarget_f( void ) { int clientNum; char command[128]; @@ -241,7 +242,6 @@ static void CG_VoiceTellAttacker_f( void ) { trap_SendClientCommand( command ); } -#ifdef MISSIONPACK static void CG_NextTeamMember_f( void ) { CG_SelectNextPlayer(); } @@ -613,12 +613,12 @@ static consoleCommand_t commands[] = { { "weapnext", CG_NextWeapon_f }, { "weapprev", CG_PrevWeapon_f }, { "weapon", CG_Weapon_f }, + { "tcmd", CG_TargetCommand_f }, { "tell_target", CG_TellTarget_f }, { "tell_attacker", CG_TellAttacker_f }, +#ifdef MISSIONPACK { "vtell_target", CG_VoiceTellTarget_f }, { "vtell_attacker", CG_VoiceTellAttacker_f }, - { "tcmd", CG_TargetCommand_f }, -#ifdef MISSIONPACK { "loadhud", CG_LoadHud_f }, { "nextTeamMember", CG_NextTeamMember_f }, { "prevTeamMember", CG_PrevTeamMember_f }, @@ -709,6 +709,7 @@ void CG_InitConsoleCommands( void ) { trap_AddCommand ("say"); trap_AddCommand ("say_team"); trap_AddCommand ("tell"); +#ifdef MISSIONPACK trap_AddCommand ("vsay"); trap_AddCommand ("vsay_team"); trap_AddCommand ("vtell"); @@ -716,12 +717,16 @@ void CG_InitConsoleCommands( void ) { trap_AddCommand ("vosay"); trap_AddCommand ("vosay_team"); trap_AddCommand ("votell"); +#endif trap_AddCommand ("give"); trap_AddCommand ("god"); trap_AddCommand ("notarget"); trap_AddCommand ("noclip"); + trap_AddCommand ("where"); trap_AddCommand ("team"); trap_AddCommand ("follow"); + trap_AddCommand ("follownext"); + trap_AddCommand ("followprev"); trap_AddCommand ("levelshot"); trap_AddCommand ("addbot"); trap_AddCommand ("setviewpos"); diff --git a/engine/code/cgame/cg_draw.c b/engine/code/cgame/cg_draw.c index 8dceda8c..46b6d09f 100644 --- a/engine/code/cgame/cg_draw.c +++ b/engine/code/cgame/cg_draw.c @@ -2349,7 +2349,7 @@ static void CG_DrawLagometer( void ) { trap_R_SetColor( NULL ); if ( cg_nopredict.integer || cg_synchronousClients.integer ) { - CG_DrawBigString( ax, ay, "snc", 1.0 ); + CG_DrawBigString( x, y, "snc", 1.0 ); } CG_DrawDisconnect(); diff --git a/engine/code/cgame/cg_ents.c b/engine/code/cgame/cg_ents.c index fc0878ea..46274736 100644 --- a/engine/code/cgame/cg_ents.c +++ b/engine/code/cgame/cg_ents.c @@ -849,20 +849,21 @@ CG_AdjustPositionForMover Also called by client movement prediction code ========================= */ -void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out ) { +void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out, vec3_t angles_in, vec3_t angles_out) { centity_t *cent; vec3_t oldOrigin, origin, deltaOrigin; - vec3_t oldAngles, angles; - //vec3_t deltaAngles; + vec3_t oldAngles, angles, deltaAngles; if ( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL ) { VectorCopy( in, out ); + VectorCopy(angles_in, angles_out); return; } cent = &cg_entities[ moverNum ]; if ( cent->currentState.eType != ET_MOVER ) { VectorCopy( in, out ); + VectorCopy(angles_in, angles_out); return; } @@ -873,10 +874,10 @@ void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int BG_EvaluateTrajectory( ¢->currentState.apos, toTime, angles ); VectorSubtract( origin, oldOrigin, deltaOrigin ); - //VectorSubtract( angles, oldAngles, deltaAngles ); + VectorSubtract( angles, oldAngles, deltaAngles ); VectorAdd( in, deltaOrigin, out ); - + VectorAdd( angles_in, deltaAngles, angles_out ); // FIXME: origin change when on a rotating object } @@ -969,7 +970,7 @@ static void CG_CalcEntityLerpPositions( centity_t *cent ) { // player state if ( cent != &cg.predictedPlayerEntity ) { CG_AdjustPositionForMover( cent->lerpOrigin, cent->currentState.groundEntityNum, - cg.snap->serverTime, cg.time, cent->lerpOrigin ); + cg.snap->serverTime, cg.time, cent->lerpOrigin, cent->lerpAngles, cent->lerpAngles); } } @@ -1149,7 +1150,7 @@ void CG_AddCEntity( centity_t *cent ) { switch ( cent->currentState.eType ) { default: - CG_Error( "Bad entity type: %i\n", cent->currentState.eType ); + CG_Error( "Bad entity type: %i", cent->currentState.eType ); break; // Q3Rally Code Start case ET_CHECKPOINT: diff --git a/engine/code/cgame/cg_event.c b/engine/code/cgame/cg_event.c index 1713f349..9812a402 100644 --- a/engine/code/cgame/cg_event.c +++ b/engine/code/cgame/cg_event.c @@ -1235,13 +1235,13 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { if (cg.snap->ps.powerups[PW_BLUEFLAG] || cg.snap->ps.powerups[PW_NEUTRALFLAG]) { } else { - if (cgs.clientinfo[cg.clientNum].team == TEAM_BLUE) { + if (cgs.clientinfo[cg.clientNum].team == TEAM_BLUE) { #ifdef MISSIONPACK if (cgs.gametype == GT_1FCTF) CG_AddBufferedSound( cgs.media.yourTeamTookTheFlagSound ); else #endif - CG_AddBufferedSound( cgs.media.enemyTookYourFlagSound ); + CG_AddBufferedSound( cgs.media.enemyTookYourFlagSound ); } else if (cgs.clientinfo[cg.clientNum].team == TEAM_RED) { #ifdef MISSIONPACK @@ -1276,6 +1276,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { } } break; +#ifdef MISSIONPACK case GTS_REDOBELISK_ATTACKED: // Overload: red obelisk is being attacked if (cgs.clientinfo[cg.clientNum].team == TEAM_RED) { CG_AddBufferedSound( cgs.media.yourBaseIsUnderAttackSound ); @@ -1286,6 +1287,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { CG_AddBufferedSound( cgs.media.yourBaseIsUnderAttackSound ); } break; +#endif case GTS_REDTEAM_SCORED: CG_AddBufferedSound(cgs.media.redScoredSound); diff --git a/engine/code/cgame/cg_local.h b/engine/code/cgame/cg_local.h index 2cf88456..1458a107 100644 --- a/engine/code/cgame/cg_local.h +++ b/engine/code/cgame/cg_local.h @@ -744,10 +744,12 @@ typedef struct { int soundTime; qhandle_t soundBuffer[MAX_SOUNDBUFFER]; +#ifdef MISSIONPACK // for voice chat buffer int voiceChatTime; int voiceChatBufferIn; int voiceChatBufferOut; +#endif // warmup countdown int warmup; @@ -1026,8 +1028,10 @@ typedef struct { qhandle_t battleWeaponShader; qhandle_t hastePuffShader; +#ifdef MISSIONPACK qhandle_t redKamikazeShader; qhandle_t blueKamikazeShader; +#endif // Q3Rally Code Start qhandle_t SMAsphaltShader; @@ -1074,12 +1078,13 @@ typedef struct { qhandle_t medkitUsageModel; qhandle_t dustPuffShader; qhandle_t heartShader; + qhandle_t invulnerabilityPowerupModel; // Q3Rally Code Start #endif qhandle_t dustPuffShader; //#endif // Q3Rally Code END - qhandle_t invulnerabilityPowerupModel; + // scoreboard headers qhandle_t scoreboardName; @@ -1200,7 +1205,9 @@ typedef struct { sfxHandle_t flightSound; sfxHandle_t medkitSound; +#ifdef MISSIONPACK sfxHandle_t weaponHoverSound; +#endif // teamplay sounds sfxHandle_t captureAwardSound; @@ -1219,13 +1226,17 @@ typedef struct { sfxHandle_t redFlagReturnedSound; sfxHandle_t blueFlagReturnedSound; +#ifdef MISSIONPACK sfxHandle_t neutralFlagReturnedSound; +#endif sfxHandle_t enemyTookYourFlagSound; - sfxHandle_t enemyTookTheFlagSound; sfxHandle_t yourTeamTookEnemyFlagSound; - sfxHandle_t yourTeamTookTheFlagSound; sfxHandle_t youHaveFlagSound; +#ifdef MISSIONPACK + sfxHandle_t enemyTookTheFlagSound; + sfxHandle_t yourTeamTookTheFlagSound; sfxHandle_t yourBaseIsUnderAttackSound; +#endif sfxHandle_t holyShitSound; // tournament sounds @@ -1252,10 +1263,11 @@ typedef struct { sfxHandle_t doublerSound; sfxHandle_t guardSound; sfxHandle_t scoutSound; -#endif + qhandle_t cursor; qhandle_t selectCursor; qhandle_t sizeCursor; +#endif sfxHandle_t regenSound; sfxHandle_t protectSound; @@ -1462,8 +1474,10 @@ extern vmCvar_t cg_predictItems; extern vmCvar_t cg_deferPlayers; extern vmCvar_t cg_drawFriend; extern vmCvar_t cg_teamChatsOnly; +#ifdef MISSIONPACK extern vmCvar_t cg_noVoiceChats; extern vmCvar_t cg_noVoiceText; +#endif extern vmCvar_t cg_scorePlum; extern vmCvar_t cg_smoothClients; extern vmCvar_t pmove_fixed; @@ -1688,7 +1702,7 @@ void CG_AddCEntity( centity_t *cent ); void CG_SetEntitySoundPosition( centity_t *cent ); void CG_AddPacketEntities( void ); void CG_Beam( centity_t *cent ); -void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out ); +void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out, vec3_t angles_in, vec3_t angles_out); // Q3Rally Code Start qboolean CG_TagExists( qhandle_t parentModel, char *tagName ); @@ -1839,10 +1853,12 @@ void CG_InitConsoleCommands( void ); void CG_ExecuteNewServerCommands( int latestSequence ); void CG_ParseServerinfo( void ); void CG_SetConfigValues( void ); -void CG_LoadVoiceChats( void ); void CG_ShaderStateChanged(void); +#ifdef MISSIONPACK +void CG_LoadVoiceChats( void ); void CG_VoiceChatLocal( int mode, qboolean voiceOnly, int clientNum, int color, const char *cmd ); void CG_PlayBufferedVoiceChats( void ); +#endif // // cg_playerstate.c diff --git a/engine/code/cgame/cg_main.c b/engine/code/cgame/cg_main.c index 39dc139a..b955a018 100644 --- a/engine/code/cgame/cg_main.c +++ b/engine/code/cgame/cg_main.c @@ -195,8 +195,10 @@ vmCvar_t cg_drawTeamOverlay; vmCvar_t cg_teamOverlayUserinfo; vmCvar_t cg_drawFriend; vmCvar_t cg_teamChatsOnly; +#ifdef MISSIONPACK vmCvar_t cg_noVoiceChats; vmCvar_t cg_noVoiceText; +#endif vmCvar_t cg_hudFiles; vmCvar_t cg_scorePlum; vmCvar_t cg_smoothClients; @@ -382,8 +384,10 @@ static cvarTable_t cvarTable[] = { { &cg_stats, "cg_stats", "0", 0 }, { &cg_drawFriend, "cg_drawFriend", "1", CVAR_ARCHIVE }, { &cg_teamChatsOnly, "cg_teamChatsOnly", "0", CVAR_ARCHIVE }, +#ifdef MISSIONPACK { &cg_noVoiceChats, "cg_noVoiceChats", "0", CVAR_ARCHIVE }, { &cg_noVoiceText, "cg_noVoiceText", "0", CVAR_ARCHIVE }, +#endif // the following variables are created in other parts of the system, // but we also reference them here { &cg_buildScript, "com_buildScript", "0", 0 }, // force loading of all possible data amd error on failures @@ -562,7 +566,7 @@ void QDECL Com_Error( int level, const char *error, ... ) { Q_vsnprintf (text, sizeof(text), error, argptr); va_end (argptr); - CG_Error( "%s", text); + trap_Error( text ); } void QDECL Com_Printf( const char *msg, ... ) { @@ -573,7 +577,7 @@ void QDECL Com_Printf( const char *msg, ... ) { Q_vsnprintf (text, sizeof(text), msg, argptr); va_end (argptr); - CG_Printf ("%s", text); + trap_Print( text ); } #endif @@ -752,9 +756,6 @@ static void CG_RegisterSounds( void ) { #else cgs.media.youHaveFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_you_flag.wav", qtrue ); cgs.media.holyShitSound = trap_S_RegisterSound("sound/feedback/voc_holyshit.wav", qtrue); - cgs.media.neutralFlagReturnedSound = trap_S_RegisterSound( "sound/teamplay/flagreturn_opponent.wav", qtrue ); - cgs.media.yourTeamTookTheFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_team_1flag.wav", qtrue ); - cgs.media.enemyTookTheFlagSound = trap_S_RegisterSound( "sound/teamplay/voc_enemy_1flag.wav", qtrue ); #endif } @@ -1273,10 +1274,9 @@ static void CG_RegisterGraphics( void ) { cgs.media.invulnerabilityJuicedModel = trap_R_RegisterModel( "models/powerups/shield/juicer.md3" ); cgs.media.medkitUsageModel = trap_R_RegisterModel( "models/powerups/regen.md3" ); cgs.media.heartShader = trap_R_RegisterShaderNoMip( "ui/assets/statusbar/selectedhealth.tga" ); - + cgs.media.invulnerabilityPowerupModel = trap_R_RegisterModel( "models/powerups/shield/shield.md3" ); #endif - cgs.media.invulnerabilityPowerupModel = trap_R_RegisterModel( "models/powerups/shield/shield.md3" ); cgs.media.medalImpressive = trap_R_RegisterShaderNoMip( "medal_impressive" ); cgs.media.medalExcellent = trap_R_RegisterShaderNoMip( "medal_excellent" ); cgs.media.medalGauntlet = trap_R_RegisterShaderNoMip( "medal_gauntlet" ); @@ -1728,13 +1728,13 @@ void CG_LoadMenus(const char *menuFile) { Com_Printf( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ); len = trap_FS_FOpenFile( "ui/hud.txt", &f, FS_READ ); if (!f) { - trap_Error( va( S_COLOR_RED "default menu file not found: ui/hud.txt, unable to continue!\n") ); + CG_Error( S_COLOR_RED "default menu file not found: ui/hud.txt, unable to continue!" ); } } if ( len >= MAX_MENUDEFFILE ) { - trap_Error( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i\n", menuFile, len, MAX_MENUDEFFILE ) ); trap_FS_FCloseFile( f ); + CG_Error( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", menuFile, len, MAX_MENUDEFFILE ); return; } diff --git a/engine/code/cgame/cg_particles.c b/engine/code/cgame/cg_particles.c index 63280695..c2f61a5d 100644 --- a/engine/code/cgame/cg_particles.c +++ b/engine/code/cgame/cg_particles.c @@ -1275,7 +1275,7 @@ void CG_ParticleExplosion (char *animStr, vec3_t origin, vec3_t vel, int duratio break; } if (!shaderAnimNames[anim]) { - CG_Error("CG_ParticleExplosion: unknown animation string: %s\n", animStr); + CG_Error("CG_ParticleExplosion: unknown animation string: %s", animStr); return; } diff --git a/engine/code/cgame/cg_players.c b/engine/code/cgame/cg_players.c index e00bac4f..244080b3 100644 --- a/engine/code/cgame/cg_players.c +++ b/engine/code/cgame/cg_players.c @@ -2130,7 +2130,7 @@ static void CG_PlayerFlag( centity_t *cent, qhandle_t hSkin, refEntity_t *torso dir[2] += 100; VectorNormalize( dir ); d = DotProduct(pole.axis[2], dir); - // if there is anough movement orthogonal to the flag pole + // if there is enough movement orthogonal to the flag pole if (fabs(d) < 0.9) { // d = DotProduct(pole.axis[0], dir); @@ -4035,7 +4035,7 @@ void CG_ResetPlayerEntity( centity_t *cent ) { cent->pe.legs.pitchAngle = 0; cent->pe.legs.pitching = qfalse; - memset( ¢->pe.torso, 0, sizeof( cent->pe.legs ) ); + memset( ¢->pe.torso, 0, sizeof( cent->pe.torso ) ); cent->pe.torso.yawAngle = cent->rawAngles[YAW]; cent->pe.torso.yawing = qfalse; cent->pe.torso.pitchAngle = cent->rawAngles[PITCH]; diff --git a/engine/code/cgame/cg_playerstate.c b/engine/code/cgame/cg_playerstate.c index 3ac2cb56..b4ad61ca 100644 --- a/engine/code/cgame/cg_playerstate.c +++ b/engine/code/cgame/cg_playerstate.c @@ -384,7 +384,7 @@ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) { } if (ps->persistant[PERS_GAUNTLET_FRAG_COUNT] != ops->persistant[PERS_GAUNTLET_FRAG_COUNT]) { #ifdef MISSIONPACK - if (ops->persistant[PERS_GAUNTLET_FRAG_COUNT] == 1) { + if (ps->persistant[PERS_GAUNTLET_FRAG_COUNT] == 1) { sfx = cgs.media.firstHumiliationSound; } else { sfx = cgs.media.humiliationSound; diff --git a/engine/code/cgame/cg_predict.c b/engine/code/cgame/cg_predict.c index aff26118..413bb268 100644 --- a/engine/code/cgame/cg_predict.c +++ b/engine/code/cgame/cg_predict.c @@ -1028,9 +1028,9 @@ void CG_PredictPlayerState( void ) { } cg.thisFrameTeleport = qfalse; } else { - vec3_t adjusted; + vec3_t adjusted, new_angles; CG_AdjustPositionForMover( cg.predictedPlayerState.origin, - cg.predictedPlayerState.groundEntityNum, cg.physicsTime, cg.oldTime, adjusted ); + cg.predictedPlayerState.groundEntityNum, cg.physicsTime, cg.oldTime, adjusted, cg.predictedPlayerState.viewangles, new_angles); // Q3Rally Code Start /* @@ -1128,7 +1128,7 @@ void CG_PredictPlayerState( void ) { // adjust for the movement of the groundentity CG_AdjustPositionForMover( cg.predictedPlayerState.origin, cg.predictedPlayerState.groundEntityNum, - cg.physicsTime, cg.time, cg.predictedPlayerState.origin ); + cg.physicsTime, cg.time, cg.predictedPlayerState.origin, cg.predictedPlayerState.viewangles, cg.predictedPlayerState.viewangles); if ( cg_showmiss.integer ) { if (cg.predictedPlayerState.eventSequence > oldPlayerState.eventSequence + MAX_PS_EVENTS) { diff --git a/engine/code/cgame/cg_servercmds.c b/engine/code/cgame/cg_servercmds.c index 091ad350..ad2f0ec3 100644 --- a/engine/code/cgame/cg_servercmds.c +++ b/engine/code/cgame/cg_servercmds.c @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // be a valid snapshot this frame #include "cg_local.h" +#ifdef MISSIONPACK #include "../../ui/menudef.h" typedef struct { @@ -47,7 +48,6 @@ static const orderTask_t validOrders[] = { static const int numValidOrders = ARRAY_LEN(validOrders); -#ifdef MISSIONPACK static int CG_ValidOrder(const char *p) { int i; for (i = 0; i < numValidOrders; i++) { @@ -515,7 +515,8 @@ static void CG_MapRestart( void ) { cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; - + cg.rewardTime = 0; + cg.rewardStack = 0; cg.intermissionStarted = qfalse; cg.levelShot = qfalse; @@ -566,6 +567,8 @@ static void CG_MapRestart( void ) { // END } +#ifdef MISSIONPACK + #define MAX_VOICEFILESIZE 16384 #define MAX_VOICEFILES 8 #define MAX_VOICECHATS 64 @@ -1025,7 +1028,6 @@ CG_VoiceChat ================= */ void CG_VoiceChat( int mode ) { -#ifdef MISSIONPACK const char *cmd; int clientNum, color; qboolean voiceOnly; @@ -1044,8 +1046,8 @@ void CG_VoiceChat( int mode ) { } CG_VoiceChatLocal( mode, voiceOnly, clientNum, color, cmd ); -#endif } +#endif /* ================= @@ -1178,6 +1180,8 @@ static void CG_ServerCommand( void ) { CG_Printf( "%s\n", text ); return; } + +#ifdef MISSIONPACK if ( !strcmp( cmd, "vchat" ) ) { CG_VoiceChat( SAY_ALL ); return; @@ -1192,6 +1196,7 @@ static void CG_ServerCommand( void ) { CG_VoiceChat( SAY_TELL ); return; } +#endif if ( !strcmp( cmd, "scores" ) ) { CG_ParseScores(); diff --git a/engine/code/cgame/cg_view.c b/engine/code/cgame/cg_view.c index 337c7eb4..a9bef586 100644 --- a/engine/code/cgame/cg_view.c +++ b/engine/code/cgame/cg_view.c @@ -150,7 +150,7 @@ static void CG_AddTestModel (void) { return; } - // if testing a gun, set the origin reletive to the view origin + // if testing a gun, set the origin relative to the view origin if ( cg.testGun ) { VectorCopy( cg.refdef.vieworg, cg.testModelEntity.origin ); VectorCopy( cg.refdef.viewaxis[0], cg.testModelEntity.axis[0] ); @@ -901,7 +901,7 @@ static int CG_CalcViewValues( void ) { } // END - // position eye reletive to origin + // position eye relative to origin AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); if ( cg.hyperspace ) { @@ -1069,8 +1069,10 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo // add buffered sounds CG_PlayBufferedSounds(); +#ifdef MISSIONPACK // play buffered voice chats CG_PlayBufferedVoiceChats(); +#endif // finish up the rest of the refdef if ( cg.testModelEntity.hModel ) { diff --git a/engine/code/cgame/cg_weapons.c b/engine/code/cgame/cg_weapons.c index 73747e93..96def2a7 100644 --- a/engine/code/cgame/cg_weapons.c +++ b/engine/code/cgame/cg_weapons.c @@ -873,7 +873,7 @@ void CG_RegisterItemVisuals( int itemNum ) { item = &bg_itemlist[ itemNum ]; - memset( itemInfo, 0, sizeof( &itemInfo ) ); + memset( itemInfo, 0, sizeof( *itemInfo ) ); itemInfo->registered = qtrue; itemInfo->models[0] = trap_R_RegisterModel( item->world_model[0] ); diff --git a/engine/code/client/cl_input.c b/engine/code/client/cl_input.c index 65ceb5f1..e74b09cc 100644 --- a/engine/code/client/cl_input.c +++ b/engine/code/client/cl_input.c @@ -418,7 +418,7 @@ void CL_JoystickMove( usercmd_t *cmd ) { cmd->forwardmove = ClampChar( cmd->forwardmove + (int) (j_forward->value * cl.joystickAxis[j_forward_axis->integer]) ); } - cmd->upmove = ClampChar( cmd->upmove + cl.joystickAxis[AXIS_UP] ); + cmd->upmove = ClampChar( cmd->upmove + (int) (j_up->value * cl.joystickAxis[j_up_axis->integer]) ); } /* diff --git a/engine/code/client/cl_main.c b/engine/code/client/cl_main.c index 2606f6d8..b506dbd4 100644 --- a/engine/code/client/cl_main.c +++ b/engine/code/client/cl_main.c @@ -96,10 +96,12 @@ cvar_t *j_pitch; cvar_t *j_yaw; cvar_t *j_forward; cvar_t *j_side; +cvar_t *j_up; cvar_t *j_pitch_axis; cvar_t *j_yaw_axis; cvar_t *j_forward_axis; cvar_t *j_side_axis; +cvar_t *j_up_axis; cvar_t *cl_activeAction; @@ -3202,7 +3204,7 @@ void CL_InitRef( void ) { Cvar_ForceReset("cl_renderer"); Com_sprintf(dllName, sizeof(dllName), "renderer_opengl1_" ARCH_STRING DLL_EXT); - rendererLib = Sys_LoadLibrary(dllName); + rendererLib = Sys_LoadDll(dllName, qfalse); } if(!rendererLib) @@ -3524,10 +3526,19 @@ void CL_Init( void ) { j_yaw = Cvar_Get ("j_yaw", "-0.022", CVAR_ARCHIVE); j_forward = Cvar_Get ("j_forward", "-0.25", CVAR_ARCHIVE); j_side = Cvar_Get ("j_side", "0.25", CVAR_ARCHIVE); + j_up = Cvar_Get ("j_up", "1", CVAR_ARCHIVE); + j_pitch_axis = Cvar_Get ("j_pitch_axis", "3", CVAR_ARCHIVE); j_yaw_axis = Cvar_Get ("j_yaw_axis", "4", CVAR_ARCHIVE); j_forward_axis = Cvar_Get ("j_forward_axis", "1", CVAR_ARCHIVE); j_side_axis = Cvar_Get ("j_side_axis", "0", CVAR_ARCHIVE); + j_up_axis = Cvar_Get ("j_up_axis", "2", CVAR_ARCHIVE); + + Cvar_CheckRange(j_pitch_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); + Cvar_CheckRange(j_yaw_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); + Cvar_CheckRange(j_forward_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); + Cvar_CheckRange(j_side_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); + Cvar_CheckRange(j_up_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); cl_motdString = Cvar_Get( "cl_motdString", "", CVAR_ROM ); @@ -3943,7 +3954,7 @@ int CL_ServerStatus( char *serverAddress, char *serverStatusString, int maxLen ) // if this server status request has the same address if ( NET_CompareAdr( to, serverStatus->address) ) { - // if we recieved an response for this server status request + // if we received a response for this server status request if (!serverStatus->pending) { Q_strncpyz(serverStatusString, serverStatus->string, maxLen); serverStatus->retrieved = qtrue; diff --git a/engine/code/client/client.h b/engine/code/client/client.h index 3204dc84..bfd897eb 100644 --- a/engine/code/client/client.h +++ b/engine/code/client/client.h @@ -403,10 +403,12 @@ extern cvar_t *j_pitch; extern cvar_t *j_yaw; extern cvar_t *j_forward; extern cvar_t *j_side; +extern cvar_t *j_up; extern cvar_t *j_pitch_axis; extern cvar_t *j_yaw_axis; extern cvar_t *j_forward_axis; extern cvar_t *j_side_axis; +extern cvar_t *j_up_axis; extern cvar_t *cl_timedemo; extern cvar_t *cl_aviFrameRate; diff --git a/engine/code/client/snd_dma.c b/engine/code/client/snd_dma.c index 0b999a81..02baf471 100644 --- a/engine/code/client/snd_dma.c +++ b/engine/code/client/snd_dma.c @@ -690,7 +690,6 @@ void S_Base_ClearLoopingSounds( qboolean killall ) { int i; for ( i = 0 ; i < MAX_GENTITIES ; i++) { if (killall || loopSounds[i].kill == qtrue || (loopSounds[i].sfx && loopSounds[i].sfx->soundLength == 0)) { - loopSounds[i].kill = qfalse; S_Base_StopLoopingSound(i); } } diff --git a/engine/code/client/snd_mem.c b/engine/code/client/snd_mem.c index ee40a750..d42084b7 100644 --- a/engine/code/client/snd_mem.c +++ b/engine/code/client/snd_mem.c @@ -219,11 +219,11 @@ qboolean S_LoadSound( sfx_t *sfx ) return qfalse; if ( info.width == 1 ) { - Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is a 8 bit wav file\n", sfx->soundName); + Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is a 8 bit audio file\n", sfx->soundName); } if ( info.rate != 22050 ) { - Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is not a 22kHz wav file\n", sfx->soundName); + Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is not a 22kHz audio file\n", sfx->soundName); } samples = Hunk_AllocateTempMemory(info.samples * sizeof(short) * 2); diff --git a/engine/code/client/snd_openal.c b/engine/code/client/snd_openal.c index dacd2ee8..472a06a1 100644 --- a/engine/code/client/snd_openal.c +++ b/engine/code/client/snd_openal.c @@ -491,7 +491,7 @@ sfxHandle_t S_AL_RegisterSound( const char *sample, qboolean compressed ) ================= S_AL_BufferGet -Return's an sfx's buffer +Return's a sfx's buffer ================= */ static diff --git a/engine/code/client/snd_public.h b/engine/code/client/snd_public.h index aeb9b2ea..b8fff64b 100644 --- a/engine/code/client/snd_public.h +++ b/engine/code/client/snd_public.h @@ -45,8 +45,8 @@ void S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocit void S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx ); void S_StopLoopingSound(int entityNum ); -// recompute the reletive volumes for all running sounds -// reletive to the given entityNum / orientation +// recompute the relative volumes for all running sounds +// relative to the given entityNum / orientation void S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater ); // let the sound system know where an entity currently is diff --git a/engine/code/game/ai_chat.c b/engine/code/game/ai_chat.c index cfaeb515..35a323f7 100644 --- a/engine/code/game/ai_chat.c +++ b/engine/code/game/ai_chat.c @@ -496,7 +496,9 @@ int BotChat_StartLevel(bot_state_t *bs) { if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; //don't chat in teamplay if (TeamPlayIsOn()) { +#ifdef MISSIONPACK trap_EA_Command(bs->client, "vtaunt"); +#endif return qfalse; } // don't chat in tournament mode @@ -531,9 +533,11 @@ int BotChat_EndLevel(bot_state_t *bs) { // teamplay if (TeamPlayIsOn()) { +#ifdef MISSIONPACK if (BotIsFirstInRankings(bs)) { trap_EA_Command(bs->client, "vtaunt"); } +#endif return qtrue; } // don't chat in tournament mode @@ -614,7 +618,9 @@ int BotChat_Death(bot_state_t *bs) { { //teamplay if (TeamPlayIsOn()) { +#ifdef MISSIONPACK trap_EA_Command(bs->client, "vtaunt"); +#endif return qtrue; } // @@ -718,7 +724,9 @@ int BotChat_Kill(bot_state_t *bs) { { //don't chat in teamplay if (TeamPlayIsOn()) { +#ifdef MISSIONPACK trap_EA_Command(bs->client, "vtaunt"); +#endif return qfalse; // don't wait } // @@ -951,7 +959,9 @@ int BotChat_Random(bot_state_t *bs) { EasyClientName(bs->lastkilledplayer, name, sizeof(name)); } if (TeamPlayIsOn()) { +#ifdef MISSIONPACK trap_EA_Command(bs->client, "vtaunt"); +#endif return qfalse; // don't wait } // diff --git a/engine/code/game/ai_dmnet.c b/engine/code/game/ai_dmnet.c index 96f9a222..895c6d78 100644 --- a/engine/code/game/ai_dmnet.c +++ b/engine/code/game/ai_dmnet.c @@ -2676,7 +2676,7 @@ int AINode_Battle_Retreat(bot_state_t *bs) { else if (!(moveresult.flags & MOVERESULT_MOVEMENTVIEWSET) && !(bs->flags & BFL_IDEALVIEWSET) ) { attack_skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1); - //if the bot is skilled anough + //if the bot is skilled enough if (attack_skill > 0.3) { BotAimAtEnemy(bs); } @@ -2835,7 +2835,7 @@ int AINode_Battle_NBG(bot_state_t *bs) { else if (!(moveresult.flags & MOVERESULT_MOVEMENTVIEWSET) && !(bs->flags & BFL_IDEALVIEWSET)) { attack_skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1); - //if the bot is skilled anough and the enemy is visible + //if the bot is skilled enough and the enemy is visible if (attack_skill > 0.3) { //&& BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->enemy) BotAimAtEnemy(bs); diff --git a/engine/code/game/ai_dmq3.c b/engine/code/game/ai_dmq3.c index cef9554a..0ebbf4c3 100644 --- a/engine/code/game/ai_dmq3.c +++ b/engine/code/game/ai_dmq3.c @@ -713,7 +713,7 @@ void BotCTFSeekGoals(bot_state_t *bs) { //if the bot is roaming if (bs->ctfroam_time > FloatTime()) return; - //if the bot has anough aggression to decide what to do + //if the bot has enough aggression to decide what to do if (BotAggression(bs) < 50) return; //set the time to send a message to the team mates @@ -960,7 +960,7 @@ void Bot1FCTFSeekGoals(bot_state_t *bs) { //if the bot is roaming if (bs->ctfroam_time > FloatTime()) return; - //if the bot has anough aggression to decide what to do + //if the bot has enough aggression to decide what to do if (BotAggression(bs) < 50) return; //set the time to send a message to the team mates @@ -1074,7 +1074,7 @@ void BotObeliskSeekGoals(bot_state_t *bs) { //if the bot is roaming if (bs->ctfroam_time > FloatTime()) return; - //if the bot has anough aggression to decide what to do + //if the bot has enough aggression to decide what to do if (BotAggression(bs) < 50) return; //set the time to send a message to the team mates @@ -1219,7 +1219,7 @@ void BotHarvesterSeekGoals(bot_state_t *bs) { //if the bot is roaming if (bs->ctfroam_time > FloatTime()) return; - //if the bot has anough aggression to decide what to do + //if the bot has enough aggression to decide what to do if (BotAggression(bs) < 50) return; //set the time to send a message to the team mates @@ -2322,7 +2322,6 @@ int BotWantsToRetreat(bot_state_t *bs) { #endif // if (bs->enemy >= 0) { - //if the enemy is carrying a flag BotEntityInfo(bs->enemy, &entinfo); // if the enemy is carrying a flag if (EntityCarriesFlag(&entinfo)) return qfalse; @@ -2537,7 +2536,7 @@ int BotWantsToCamp(bot_state_t *bs) { bs->camp_time = FloatTime(); return qfalse; } - //if the bot isn't healthy anough + //if the bot isn't healthy enough if (BotAggression(bs) < 50) return qfalse; //the bot should have at least have the rocket launcher, the railgun or the bfg10k with some ammo if ((bs->inventory[INVENTORY_ROCKETLAUNCHER] <= 0 || bs->inventory[INVENTORY_ROCKETS < 10]) && @@ -2629,7 +2628,7 @@ void BotRoamGoal(bot_state_t *bs, vec3_t goal) { //direction and length towards the roam target VectorSubtract(trace.endpos, bs->origin, dir); len = VectorNormalize(dir); - //if the roam target is far away anough + //if the roam target is far away enough if (len > 200) { //the roam target is in the given direction before walls VectorScale(dir, len * trace.fraction - 40, dir); @@ -3461,7 +3460,7 @@ void BotAimAtEnemy(bot_state_t *bs) { VectorSubtract(entinfo.origin, bs->enemyorigin, dir); //if the enemy is NOT pretty far away and strafing just small steps left and right if (!(dist > 100 && VectorLengthSquared(dir) < Square(32))) { - //if skilled anough do exact prediction + //if skilled enough do exact prediction if (aim_skill > 0.8 && //if the weapon is ready to fire bs->cur_ps.weaponstate == WEAPON_READY) { @@ -3521,10 +3520,10 @@ void BotAimAtEnemy(bot_state_t *bs) { //if hitpoint is not vertically too far from the ground target if (fabs(trace.endpos[2] - groundtarget[2]) < 50) { VectorSubtract(trace.endpos, groundtarget, dir); - //if the hitpoint is near anough the ground target + //if the hitpoint is near enough the ground target if (VectorLengthSquared(dir) < Square(60)) { VectorSubtract(trace.endpos, start, dir); - //if the hitpoint is far anough from the bot + //if the hitpoint is far enough from the bot if (VectorLengthSquared(dir) > Square(100)) { //check if the bot is visible from the ground target trace.endpos[2] += 1; @@ -3546,7 +3545,7 @@ void BotAimAtEnemy(bot_state_t *bs) { // VectorCopy(bs->lastenemyorigin, bestorigin); bestorigin[2] += 8; - //if the bot is skilled anough + //if the bot is skilled enough if (aim_skill > 0.5) { //do prediction shots around corners if (wi.number == WP_BFG || diff --git a/engine/code/game/ai_dmq3.h b/engine/code/game/ai_dmq3.h index ee536115..2c4de439 100644 --- a/engine/code/game/ai_dmq3.h +++ b/engine/code/game/ai_dmq3.h @@ -73,7 +73,7 @@ void BotSetUserInfo(bot_state_t *bs, char *key, char *value); void BotSetTeamStatus(bot_state_t *bs); //returns the name of the client char *ClientName(int client, char *name, int size); -//returns an simplyfied client name +//returns a simplified client name char *EasyClientName(int client, char *name, int size); //returns the skin used by the client char *ClientSkin(int client, char *skin, int size); diff --git a/engine/code/game/ai_team.c b/engine/code/game/ai_team.c index 6b774585..0b49ec0e 100644 --- a/engine/code/game/ai_team.c +++ b/engine/code/game/ai_team.c @@ -132,9 +132,12 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t *bs, int *teammates, int maxtea int traveltimes[MAX_CLIENTS]; bot_goal_t *goal = NULL; -// STONELANCE - if (gametype == GT_CTF /*|| gametype == GT_1FCTF*/) { -// END +#ifdef MISSIONPACK + if (gametype == GT_CTF || gametype == GT_1FCTF) +#else + if (gametype == GT_CTF) +#endif + { if (BotTeam(bs) == TEAM_RED) goal = &ctf_redflag; else diff --git a/engine/code/game/bg_lib.c b/engine/code/game/bg_lib.c index 4c99e57a..a488801a 100644 --- a/engine/code/game/bg_lib.c +++ b/engine/code/game/bg_lib.c @@ -777,6 +777,43 @@ double atan2( double y, double x ) { #endif +/* +=============== +powN + +Raise a double to a integer power +=============== +*/ +static double powN( double base, int exp ) +{ + if( exp >= 0 ) + { + double result = 1.0; + + // calculate x, x^2, x^4, ... by repeated squaring + // and multiply together the ones corresponding to the + // binary digits of the exponent + // e.g. x^73 = x^(1 + 8 + 64) = x * x^8 * x^64 + while( exp > 0 ) + { + if( exp % 2 == 1 ) + result *= base; + + base *= base; + exp /= 2; + } + + return result; + } + // if exp is INT_MIN, the next clause will be upset, + // because -exp isn't representable + else if( exp == INT_MIN ) + return powN( base, exp + 1 ) / base; + // x < 0 + else + return 1.0 / powN( base, -exp ); +} + double tan( double x ) { return sin(x) / cos(x); } @@ -1223,7 +1260,6 @@ double strtod( const char *nptr, char **endptr ) if( end != s && tolower( *nptr ) == 'p' ) { int exp; - float res2; // apparently (confusingly) the exponent should be // decimal exp = strtol( &nptr[1], (char **)&end, 10 ); @@ -1234,28 +1270,8 @@ double strtod( const char *nptr, char **endptr ) *endptr = (char *)nptr; return res; } - if( exp > 0 ) - { - while( exp-- > 0 ) - { - res2 = res * 2; - // check for infinity - if( res2 <= res ) - break; - res = res2; - } - } - else - { - while( exp++ < 0 ) - { - res2 = res / 2; - // check for underflow - if( res2 >= res ) - break; - res = res2; - } - } + + res *= powN( 2, exp ); } if( endptr ) *endptr = (char *)end; @@ -1289,7 +1305,6 @@ double strtod( const char *nptr, char **endptr ) if( p != end && tolower( *nptr ) == 'e' ) { int exp; - float res10; exp = strtol( &nptr[1], (char **)&end, 10 ); if( &nptr[1] == end ) { @@ -1298,30 +1313,8 @@ double strtod( const char *nptr, char **endptr ) *endptr = (char *)nptr; return res; } - if( exp > 0 ) - { - while( exp-- > 0 ) - { - res10 = res * 10; - // check for infinity to save us time - if( res10 <= res ) - break; - res = res10; - } - } - else if( exp < 0 ) - { - while( exp++ < 0 ) - { - res10 = res / 10; - // check for underflow - // (test for 0 would probably be just - // as good) - if( res10 >= res ) - break; - res = res10; - } - } + + res *= powN( 10, exp ); } if( endptr ) *endptr = (char *)end; @@ -2088,19 +2081,6 @@ static LDOUBLE abs_val (LDOUBLE value) return result; } -static LDOUBLE pow10 (int exp) -{ - LDOUBLE result = 1; - - while (exp) - { - result *= 10; - exp--; - } - - return result; -} - static long round (LDOUBLE value) { long intpart; @@ -2163,12 +2143,12 @@ static int fmtfp (char *buffer, size_t *currlen, size_t maxlen, /* We "cheat" by converting the fractional part to integer by * multiplying by a factor of 10 */ - fracpart = round ((pow10 (max)) * (ufvalue - intpart)); + fracpart = round ((powN (10, max)) * (ufvalue - intpart)); - if (fracpart >= pow10 (max)) + if (fracpart >= powN (10, max)) { intpart++; - fracpart -= pow10 (max); + fracpart -= powN (10, max); } #ifdef DEBUG_SNPRINTF diff --git a/engine/code/game/bg_pmove.c b/engine/code/game/bg_pmove.c index cfbbee01..7cdae06e 100644 --- a/engine/code/game/bg_pmove.c +++ b/engine/code/game/bg_pmove.c @@ -345,7 +345,7 @@ static float PM_CmdScale( usercmd_t *cmd ) { ================ PM_SetMovementDir -Determine the rotation of the legs reletive +Determine the rotation of the legs relative to the facing dir ================ */ diff --git a/engine/code/game/bg_public.h b/engine/code/game/bg_public.h index 69515970..5030693d 100644 --- a/engine/code/game/bg_public.h +++ b/engine/code/game/bg_public.h @@ -485,7 +485,7 @@ typedef enum { #define PLAYEREVENT_HOLYSHIT 0x0004 // entityState_t->event values -// entity events are for effects that take place reletive +// entity events are for effects that take place relative // to an existing entities origin. Very network efficient. // two bits at the top of the entityState->event field diff --git a/engine/code/game/g_active.c b/engine/code/game/g_active.c index 72ee7bc6..ccbc6cfc 100644 --- a/engine/code/game/g_active.c +++ b/engine/code/game/g_active.c @@ -1895,9 +1895,9 @@ void ClientEndFrame( gentity_t *ent ) { // add the EF_CONNECTION flag if we haven't gotten commands recently if ( level.time - ent->client->lastCmdTime > 1000 ) { - ent->s.eFlags |= EF_CONNECTION; + ent->client->ps.eFlags |= EF_CONNECTION; } else { - ent->s.eFlags &= ~EF_CONNECTION; + ent->client->ps.eFlags &= ~EF_CONNECTION; } ent->client->ps.stats[STAT_HEALTH] = ent->health; // FIXME: get rid of ent->health... diff --git a/engine/code/game/g_bot.c b/engine/code/game/g_bot.c index ec0ff55a..0c693624 100644 --- a/engine/code/game/g_bot.c +++ b/engine/code/game/g_bot.c @@ -130,12 +130,12 @@ static void G_LoadArenasFromFile( char *filename ) { len = trap_FS_FOpenFile( filename, &f, FS_READ ); if ( !f ) { - trap_Printf( va( S_COLOR_RED "file not found: %s\n", filename ) ); + trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) ); return; } if ( len >= MAX_ARENAS_TEXT ) { - trap_Printf( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_ARENAS_TEXT ) ); trap_FS_FCloseFile( f ); + trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_ARENAS_TEXT ) ); return; } @@ -182,7 +182,7 @@ static void G_LoadArenas( void ) { strcat(filename, dirptr); G_LoadArenasFromFile(filename); } - trap_Printf( va( "%i arenas parsed\n", g_numArenas ) ); + trap_Print( va( "%i arenas parsed\n", g_numArenas ) ); for( n = 0; n < g_numArenas; n++ ) { Info_SetValueForKey( g_arenaInfos[n], "num", va( "%i", n ) ); @@ -660,7 +660,7 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay s = Info_ValueForKey(botinfo, "aifile"); if (!*s ) { - trap_Printf( S_COLOR_RED "Error: bot has no aifile specified\n" ); + trap_Print( S_COLOR_RED "Error: bot has no aifile specified\n" ); return; } @@ -733,7 +733,7 @@ void Svcmd_AddBot_f( void ) { // name trap_Argv( 1, name, sizeof( name ) ); if ( !name[0] ) { - trap_Printf( "Usage: Addbot [skill 1-5] [team] [msec delay] [altname]\n" ); + trap_Print( "Usage: Addbot [skill 1-5] [team] [msec delay] [altname]\n" ); return; } @@ -783,7 +783,7 @@ void Svcmd_BotList_f( void ) { char model[MAX_TOKEN_CHARS]; char aifile[MAX_TOKEN_CHARS]; - trap_Printf("^1name model aifile funname\n"); + trap_Print("^1name model aifile funname\n"); for (i = 0; i < g_numBots; i++) { strcpy(name, Info_ValueForKey( g_botInfos[i], "name" )); if ( !*name ) { @@ -801,7 +801,7 @@ void Svcmd_BotList_f( void ) { if (!*aifile ) { strcpy(aifile, "bots/default_c.c"); } - trap_Printf(va("%-16s %-16s %-20s %-20s\n", name, model, aifile, funname)); + trap_Print(va("%-16s %-16s %-20s %-20s\n", name, model, aifile, funname)); } } @@ -876,11 +876,11 @@ static void G_LoadBotsFromFile( char *filename ) { len = trap_FS_FOpenFile( filename, &f, FS_READ ); if ( !f ) { - trap_Printf( va( S_COLOR_RED "file not found: %s\n", filename ) ); + trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) ); return; } if ( len >= MAX_BOTS_TEXT ) { - trap_Printf( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_BOTS_TEXT ) ); + trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_BOTS_TEXT ) ); trap_FS_FCloseFile( f ); return; } @@ -929,7 +929,7 @@ static void G_LoadBots( void ) { strcat(filename, dirptr); G_LoadBotsFromFile(filename); } - trap_Printf( va( "%i bots parsed\n", g_numBots ) ); + trap_Print( va( "%i bots parsed\n", g_numBots ) ); } @@ -941,7 +941,7 @@ G_GetBotInfoByNumber */ char *G_GetBotInfoByNumber( int num ) { if( num < 0 || num >= g_numBots ) { - trap_Printf( va( S_COLOR_RED "Invalid bot number: %i\n", num ) ); + trap_Print( va( S_COLOR_RED "Invalid bot number: %i\n", num ) ); return NULL; } return g_botInfos[num]; diff --git a/engine/code/game/g_client.c b/engine/code/game/g_client.c index e2a330f6..86748f97 100644 --- a/engine/code/game/g_client.c +++ b/engine/code/game/g_client.c @@ -892,6 +892,8 @@ void ClientUserinfoChanged( int clientNum ) { // check for malformed or illegal info strings if ( !Info_Validate(userinfo) ) { strcpy (userinfo, "\\name\\badinfo"); + // don't keep those clients and userinfo + trap_DropClient(clientNum, "Invalid userinfo"); } // check for local client @@ -1165,7 +1167,12 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) { return "Invalid password"; } } - + // if a player reconnects quickly after a disconnect, the client disconnect may never be called, thus flag can get lost in the ether + if (ent->inuse) { + G_LogPrintf("Forcing disconnect on active client: %i\n", clientNum); + // so lets just fix up anything that should happen on a disconnect + ClientDisconnect(clientNum); + } // they can connect ent->client = level.clients + clientNum; client = ent->client; @@ -1746,7 +1753,7 @@ void ClientDisconnect( int clientNum ) { G_RemoveQueuedBotBegin( clientNum ); ent = g_entities + clientNum; - if ( !ent->client ) { + if (!ent->client || ent->client->pers.connected == CON_DISCONNECTED) { return; } diff --git a/engine/code/game/g_cmds.c b/engine/code/game/g_cmds.c index 04d8aaf0..d7d87d62 100644 --- a/engine/code/game/g_cmds.c +++ b/engine/code/game/g_cmds.c @@ -23,7 +23,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // #include "g_local.h" +#ifdef MISSIONPACK #include "../../ui/menudef.h" // for the voice chats +#endif /* ================== @@ -144,11 +146,11 @@ CheatsOk */ qboolean CheatsOk( gentity_t *ent ) { if ( !g_cheats.integer ) { - trap_SendServerCommand( ent-g_entities, va("print \"Cheats are not enabled on this server.\n\"")); + trap_SendServerCommand( ent-g_entities, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } if ( ent->health <= 0 ) { - trap_SendServerCommand( ent-g_entities, va("print \"You must be alive to use this command.\n\"")); + trap_SendServerCommand( ent-g_entities, "print \"You must be alive to use this command.\n\""); return qfalse; } return qtrue; @@ -942,6 +944,16 @@ void Cmd_FollowCycle_f( gentity_t *ent, int dir ) { G_Error( "Cmd_FollowCycle_f: bad dir %i", dir ); } + // if dedicated follow client, just switch between the two auto clients + if (ent->client->sess.spectatorClient < 0) { + if (ent->client->sess.spectatorClient == -1) { + ent->client->sess.spectatorClient = -2; + } else if (ent->client->sess.spectatorClient == -2) { + ent->client->sess.spectatorClient = -1; + } + return; + } + clientnum = ent->client->sess.spectatorClient; original = clientnum; do { @@ -1161,6 +1173,7 @@ static void Cmd_Tell_f( gentity_t *ent ) { } +#ifdef MISSIONPACK static void G_VoiceTo( gentity_t *ent, gentity_t *other, int mode, const char *id, qboolean voiceonly ) { int color; char *cmd; @@ -1360,6 +1373,7 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) { // just say something G_Voice( ent, NULL, SAY_ALL, VOICECHAT_TAUNT, qfalse ); } +#endif @@ -1767,11 +1781,11 @@ void Cmd_SetViewpos_f( gentity_t *ent ) { int i; if ( !g_cheats.integer ) { - trap_SendServerCommand( ent-g_entities, va("print \"Cheats are not enabled on this server.\n\"")); + trap_SendServerCommand( ent-g_entities, "print \"Cheats are not enabled on this server.\n\""); return; } if ( trap_Argc() != 5 ) { - trap_SendServerCommand( ent-g_entities, va("print \"usage: setviewpos x y z yaw\n\"")); + trap_SendServerCommand( ent-g_entities, "print \"usage: setviewpos x y z yaw\n\""); return; } @@ -1924,7 +1938,7 @@ void ClientCommand( int clientNum ) { // END ent = g_entities + clientNum; - if ( !ent->client ) { + if (!ent->client || ent->client->pers.connected != CON_CONNECTED) { return; // not fully in game yet } @@ -1943,6 +1957,7 @@ void ClientCommand( int clientNum ) { Cmd_Tell_f ( ent ); return; } +#ifdef MISSIONPACK if (Q_stricmp (cmd, "vsay") == 0) { Cmd_Voice_f (ent, SAY_ALL, qfalse, qfalse); return; @@ -1971,6 +1986,7 @@ void ClientCommand( int clientNum ) { Cmd_VoiceTaunt_f ( ent ); return; } +#endif if (Q_stricmp (cmd, "score") == 0) { Cmd_Score_f (ent); return; diff --git a/engine/code/game/g_items.c b/engine/code/game/g_items.c index 846d5d73..0c6820d6 100644 --- a/engine/code/game/g_items.c +++ b/engine/code/game/g_items.c @@ -1029,8 +1029,8 @@ void G_RunItem( gentity_t *ent ) { int contents; int mask; - // if groundentity has been set to -1, it may have been pushed off an edge - if ( ent->s.groundEntityNum == -1 ) { + // if its groundentity has been set to none, it may have been pushed off an edge + if ( ent->s.groundEntityNum == ENTITYNUM_NONE ) { if ( ent->s.pos.trType != TR_GRAVITY ) { ent->s.pos.trType = TR_GRAVITY; ent->s.pos.trTime = level.time; diff --git a/engine/code/game/g_local.h b/engine/code/game/g_local.h index 1957f9a7..db49b55b 100644 --- a/engine/code/game/g_local.h +++ b/engine/code/game/g_local.h @@ -139,7 +139,6 @@ struct gentity_s { int timestamp; // body queue sinking, etc - float angle; // set in editor, -1 = up, -2 = down char *target; char *targetname; char *team; @@ -285,11 +284,6 @@ typedef struct { float lastfraggedcarrier; } playerTeamState_t; -// the auto following clients don't follow a specific client -// number, but instead follow the first two active players -#define FOLLOW_ACTIVE1 -1 -#define FOLLOW_ACTIVE2 -2 - // client data that stays across multiple levels or tournament restarts // this is achieved by writing all the data to cvar strings at game shutdown // time and reading them back at connection time. Anything added here @@ -595,7 +589,6 @@ void G_FreeEntity( gentity_t *e ); qboolean G_EntitiesFree( void ); void G_TouchTriggers (gentity_t *ent); -void G_TouchSolids (gentity_t *ent); float *tv (float x, float y, float z); // STONELANCE - moved to q_shared @@ -719,8 +712,6 @@ gentity_t *SelectSpawnPoint (vec3_t avoidPoint, vec3_t origin, vec3_t angles, qb void CopyToBodyQue( gentity_t *ent ); void ClientRespawn(gentity_t *ent); void BeginIntermission (void); -void InitClientPersistant (gclient_t *client); -void InitClientResp (gclient_t *client); void InitBodyQue (void); void ClientSpawn( gentity_t *ent ); void player_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod); @@ -809,25 +800,15 @@ void CreateSmokeHazard (gentity_t *owner, vec3_t origin); // END -// -// p_hud.c -// -void MoveClientToIntermission (gentity_t *client); -void G_SetStats (gentity_t *ent); -void DeathmatchScoreboardMessage (gentity_t *client); - // // g_cmds.c // - -// -// g_pweapon.c -// - +void DeathmatchScoreboardMessage( gentity_t *ent ); // // g_main.c // +void MoveClientToIntermission( gentity_t *ent ); void FindIntermissionPoint( void ); void SetLeader(int team, int client); void CheckTeamLeader( int team ); @@ -1011,8 +992,8 @@ extern vmCvar_t car_air_frac_to_df; extern vmCvar_t car_friction_scale; // END -void trap_Printf( const char *fmt ); -void trap_Error(const char *fmt) __attribute__((noreturn)); +void trap_Print( const char *text ); +void trap_Error( const char *text ) __attribute__((noreturn)); int trap_Milliseconds( void ); int trap_Argc( void ); void trap_Argv( int n, char *buffer, int bufferLength ); diff --git a/engine/code/game/g_main.c b/engine/code/game/g_main.c index 1ccff861..bba5439a 100644 --- a/engine/code/game/g_main.c +++ b/engine/code/game/g_main.c @@ -354,7 +354,7 @@ void QDECL G_Printf( const char *fmt, ... ) { Q_vsnprintf (text, sizeof(text), fmt, argptr); va_end (argptr); - trap_Printf( text ); + trap_Print( text ); } void QDECL G_Error( const char *fmt, ... ) { @@ -684,7 +684,7 @@ void QDECL Com_Error ( int level, const char *error, ... ) { Q_vsnprintf (text, sizeof(text), error, argptr); va_end (argptr); - G_Error( "%s", text); + trap_Error( text ); } void QDECL Com_Printf( const char *msg, ... ) { @@ -695,7 +695,7 @@ void QDECL Com_Printf( const char *msg, ... ) { Q_vsnprintf (text, sizeof(text), msg, argptr); va_end (argptr); - G_Printf ("%s", text); + trap_Print( text ); } #endif @@ -1315,7 +1315,7 @@ void ExitLevel (void) { cl->ps.persistant[PERS_SCORE] = 0; } - // we need to do this here before chaning to CON_CONNECTING + // we need to do this here before changing to CON_CONNECTING G_WriteSessionData(); // change all client states to connecting, so the early players into the @@ -1729,10 +1729,6 @@ void CheckExitRules( void ) { } // END - if ( level.numPlayingClients < 2 ) { - return; - } - // STONELANCE // dont check frags or captures during a race or derby if ( isRallyRace() || g_gametype.integer == GT_DERBY ){ @@ -1913,7 +1909,12 @@ void CheckTournament( void ) { // if all players have arrived, start the countdown if ( level.warmupTime < 0 ) { // fudge by -1 to account for extra delays - level.warmupTime = level.time + ( g_warmup.integer - 1 ) * 1000; + if ( g_warmup.integer > 1 ) { + level.warmupTime = level.time + ( g_warmup.integer - 1 ) * 1000; + } else { + level.warmupTime = 0; + } + trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) ); return; } @@ -2030,11 +2031,14 @@ void CheckTeamLeader( int team ) { break; } } - for ( i = 0 ; i < level.maxclients ; i++ ) { - if (level.clients[i].sess.sessionTeam != team) - continue; - level.clients[i].sess.teamLeader = qtrue; - break; + + if (i >= level.maxclients) { + for ( i = 0 ; i < level.maxclients ; i++ ) { + if (level.clients[i].sess.sessionTeam != team) + continue; + level.clients[i].sess.teamLeader = qtrue; + break; + } } } } diff --git a/engine/code/game/g_mem.c b/engine/code/game/g_mem.c index 89656acb..2618a657 100644 --- a/engine/code/game/g_mem.c +++ b/engine/code/game/g_mem.c @@ -42,7 +42,7 @@ void *G_Alloc( int size ) { } if ( allocPoint + size > POOLSIZE ) { - G_Error( "G_Alloc: failed on allocation of %i bytes\n", size ); // bk010103 - was %u, but is signed + G_Error( "G_Alloc: failed on allocation of %i bytes", size ); return NULL; } diff --git a/engine/code/game/g_mover.c b/engine/code/game/g_mover.c index 94629836..6d49d5e0 100644 --- a/engine/code/game/g_mover.c +++ b/engine/code/game/g_mover.c @@ -34,8 +34,6 @@ PUSHMOVE =============================================================================== */ -void MatchTeam( gentity_t *teamLeader, int moverState, int time ); - typedef struct { gentity_t *ent; vec3_t origin; @@ -199,7 +197,7 @@ qboolean G_TryPushingEntity( gentity_t *check, gentity_t *pusher, vec3_t move, v // may have pushed them off an edge if ( check->s.groundEntityNum != pusher->s.number ) { - check->s.groundEntityNum = -1; + check->s.groundEntityNum = ENTITYNUM_NONE; } block = G_TestEntityPosition( check ); @@ -224,7 +222,7 @@ qboolean G_TryPushingEntity( gentity_t *check, gentity_t *pusher, vec3_t move, v VectorCopy( (pushed_p-1)->angles, check->s.apos.trBase ); block = G_TestEntityPosition (check); if ( !block ) { - check->s.groundEntityNum = -1; + check->s.groundEntityNum = ENTITYNUM_NONE; pushed_p--; return qtrue; } diff --git a/engine/code/game/g_session.c b/engine/code/game/g_session.c index b212c216..1e3c6e92 100644 --- a/engine/code/game/g_session.c +++ b/engine/code/game/g_session.c @@ -103,6 +103,9 @@ Called on a first-time connect void G_InitSessionData( gclient_t *client, char *userinfo ) { clientSession_t *sess; const char *value; + qboolean isBot; + + isBot = (g_entities[ client - level.clients ].r.svFlags & SVF_BOT); sess = &client->sess; @@ -116,7 +119,7 @@ void G_InitSessionData( gclient_t *client, char *userinfo ) { // can only spawn as spectator after race starts sess->sessionTeam = TEAM_SPECTATOR; } - else if ( g_teamAutoJoin.integer || value[0] == 'r' ){ + else if ( (g_teamAutoJoin.integer && !isBot) || value[0] == 'r' ) { // force them to join sess->sessionTeam = PickTeam( -1 ); BroadcastTeamChange( client, -1 ); @@ -127,7 +130,7 @@ void G_InitSessionData( gclient_t *client, char *userinfo ) { } else // END - if ( g_teamAutoJoin.integer ) { + if ( g_teamAutoJoin.integer && !isBot ) { sess->sessionTeam = PickTeam( -1 ); BroadcastTeamChange( client, -1 ); } else { diff --git a/engine/code/game/g_svcmds.c b/engine/code/game/g_svcmds.c index 34593d92..ff806991 100644 --- a/engine/code/game/g_svcmds.c +++ b/engine/code/game/g_svcmds.c @@ -239,7 +239,7 @@ void Svcmd_AddIP_f (void) char str[MAX_TOKEN_CHARS]; if ( trap_Argc() < 2 ) { - G_Printf("Usage: addip \n"); + G_Printf("Usage: addip \n"); return; } @@ -261,7 +261,7 @@ void Svcmd_RemoveIP_f (void) char str[MAX_TOKEN_CHARS]; if ( trap_Argc() < 2 ) { - G_Printf("Usage: sv removeip \n"); + G_Printf("Usage: removeip \n"); return; } @@ -412,6 +412,11 @@ void Svcmd_ForceTeam_f( void ) { gclient_t *cl; char str[MAX_TOKEN_CHARS]; + if ( trap_Argc() < 3 ) { + G_Printf("Usage: forceteam \n"); + return; + } + // find the player trap_Argv( 1, str, sizeof( str ) ); cl = ClientForString( str ); diff --git a/engine/code/game/g_syscalls.asm b/engine/code/game/g_syscalls.asm index 153dad51..1bf119c5 100644 --- a/engine/code/game/g_syscalls.asm +++ b/engine/code/game/g_syscalls.asm @@ -1,6 +1,6 @@ code -equ trap_Printf -1 +equ trap_Print -1 equ trap_Error -2 equ trap_Milliseconds -3 equ trap_Cvar_Register -4 diff --git a/engine/code/game/g_syscalls.c b/engine/code/game/g_syscalls.c index 0ac1e202..79830bda 100644 --- a/engine/code/game/g_syscalls.c +++ b/engine/code/game/g_syscalls.c @@ -42,13 +42,14 @@ int PASSFLOAT( float x ) { return fi.i; } -void trap_Printf( const char *fmt ) { - syscall( G_PRINT, fmt ); +void trap_Print( const char *text ) { + syscall( G_PRINT, text ); } -void trap_Error(const char *fmt) +void trap_Error( const char *text ) { - syscall(G_ERROR, fmt); + syscall( G_ERROR, text ); + // shut up GCC warning about returning functions, because we know better exit(1); } @@ -228,7 +229,6 @@ int trap_RealTime( qtime_t *qtime ) { void trap_SnapVector( float *v ) { syscall( G_SNAPVECTOR, v ); - return; } // BotLib traps start here diff --git a/engine/code/game/g_target.c b/engine/code/game/g_target.c index e44e1fbd..c62e48a8 100644 --- a/engine/code/game/g_target.c +++ b/engine/code/game/g_target.c @@ -207,7 +207,7 @@ void SP_target_speaker( gentity_t *ent ) { G_Error( "target_speaker without a noise key at %s", vtos( ent->s.origin ) ); } - // force all client reletive sounds to be "activator" speakers that + // force all client relative sounds to be "activator" speakers that // play on the entity that activates it if ( s[0] == '*' ) { ent->spawnflags |= 8; diff --git a/engine/code/game/g_team.c b/engine/code/game/g_team.c index 4b983af3..d04ef764 100644 --- a/engine/code/game/g_team.c +++ b/engine/code/game/g_team.c @@ -312,13 +312,11 @@ void Team_FragBonuses(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker enemy_flag_pw = PW_REDFLAG; } -// STONELANCE - removed gametype -/* +#ifdef MISSIONPACK if (g_gametype.integer == GT_1FCTF) { enemy_flag_pw = PW_NEUTRALFLAG; } -*/ -// END +#endif // did the attacker frag the flag carrier? tokens = 0; @@ -784,8 +782,9 @@ int Team_TouchOurFlag( gentity_t *ent, gentity_t *other, int team ) { player->client->pers.teamState.lasthurtcarrier = -5; } else if (player->client->sess.sessionTeam == cl->sess.sessionTeam) { - if (player != other) - AddScore(player, ent->r.currentOrigin, CTF_TEAM_BONUS); +#ifdef MISSIONPACK + AddScore(player, ent->r.currentOrigin, CTF_TEAM_BONUS); +#endif // award extra points for capture assists if (player->client->pers.teamState.lastreturnedflag + CTF_RETURN_FLAG_ASSIST_TIMEOUT > level.time) { @@ -846,9 +845,9 @@ int Team_TouchEnemyFlag( gentity_t *ent, gentity_t *other, int team ) { Team_SetFlagStatus( team, FLAG_TAKEN ); #ifdef MISSIONPACK } -#endif AddScore(other, ent->r.currentOrigin, CTF_FLAG_BONUS); +#endif cl->pers.teamState.flagsince = level.time; Team_TakeFlagSound( ent, team ); @@ -1078,17 +1077,36 @@ void TeamplayInfoMessage( gentity_t *ent ) { int cnt; int h, a; int clients[TEAM_MAXOVERLAY]; + int team; if ( ! ent->client->pers.teamInfo ) return; + // send team info to spectator for team of followed client + if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) { + if ( ent->client->sess.spectatorState != SPECTATOR_FOLLOW + || ent->client->sess.spectatorClient < 0 ) { + return; + } + team = g_entities[ ent->client->sess.spectatorClient ].client->sess.sessionTeam; + } else { + team = ent->client->sess.sessionTeam; + } + + +// STONELANCE +// if (team != TEAM_RED && team != TEAM_BLUE) { + if (team != TEAM_RED && team != TEAM_BLUE && team != TEAM_GREEN && team != TEAM_YELLOW) { +// END + return; + } + // figure out what client should be on the display // we are limited to 8, but we want to use the top eight players // but in client order (so they don't keep changing position on the overlay) for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) { player = g_entities + level.sortedClients[i]; - if (player->inuse && player->client->sess.sessionTeam == - ent->client->sess.sessionTeam ) { + if (player->inuse && player->client->sess.sessionTeam == team ) { clients[cnt++] = level.sortedClients[i]; } } @@ -1102,8 +1120,7 @@ void TeamplayInfoMessage( gentity_t *ent ) { for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) { player = g_entities + i; - if (player->inuse && player->client->sess.sessionTeam == - ent->client->sess.sessionTeam ) { + if (player->inuse && player->client->sess.sessionTeam == team ) { h = player->client->ps.stats[STAT_HEALTH]; a = player->client->ps.stats[STAT_ARMOR]; @@ -1164,13 +1181,7 @@ void CheckTeamStatus(void) { continue; } -// STONELANCE -// if (ent->inuse && (ent->client->sess.sessionTeam == TEAM_RED || ent->client->sess.sessionTeam == TEAM_BLUE)) { - if (ent->inuse && (ent->client->sess.sessionTeam == TEAM_RED - || ent->client->sess.sessionTeam == TEAM_BLUE - || ent->client->sess.sessionTeam == TEAM_GREEN - || ent->client->sess.sessionTeam == TEAM_YELLOW)) { -// END + if (ent->inuse) { TeamplayInfoMessage( ent ); } } diff --git a/engine/code/game/g_weapon.c b/engine/code/game/g_weapon.c index 0015f4ab..9f87f7b9 100644 --- a/engine/code/game/g_weapon.c +++ b/engine/code/game/g_weapon.c @@ -210,12 +210,13 @@ void SnapVectorTowards( vec3_t v, vec3_t to ) { #ifdef MISSIONPACK #define CHAINGUN_SPREAD 600 +#define CHAINGUN_DAMAGE 7 #endif #define MACHINEGUN_SPREAD 200 #define MACHINEGUN_DAMAGE 7 #define MACHINEGUN_TEAM_DAMAGE 5 // wimpier MG in teamplay -void Bullet_Fire (gentity_t *ent, float spread, int damage ) { +void Bullet_Fire (gentity_t *ent, float spread, int damage, int mod ) { trace_t tr; vec3_t end; #ifdef MISSIONPACK @@ -285,7 +286,7 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage ) { #endif G_Damage( traceEnt, ent, ent, forward, tr.endpos, - damage, DAMAGE_WEAPON, MOD_MACHINEGUN); + damage, DAMAGE_WEAPON, mod); #ifdef MISSIONPACK } @@ -1209,9 +1210,9 @@ void FireWeapon( gentity_t *ent ) { break; case WP_MACHINEGUN: if ( g_gametype.integer != GT_TEAM ) { - Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE ); + Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); } else { - Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE ); + Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE, MOD_MACHINEGUN ); } break; case WP_GRENADE_LAUNCHER: @@ -1242,7 +1243,7 @@ void FireWeapon( gentity_t *ent ) { weapon_proxlauncher_fire( ent ); break; case WP_CHAINGUN: - Bullet_Fire( ent, CHAINGUN_SPREAD, MACHINEGUN_DAMAGE ); + Bullet_Fire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN ); break; #endif default: @@ -1354,9 +1355,9 @@ void FireAltWeapon( gentity_t *ent ) { break; case WP_MACHINEGUN: if ( g_gametype.integer != GT_TEAM ) { - Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE ); + Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); } else { - Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE ); + Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE, MOD_MACHINEGUN ); } break; case WP_GRENADE_LAUNCHER: @@ -1386,7 +1387,7 @@ void FireAltWeapon( gentity_t *ent ) { weapon_proxlauncher_fire( ent ); break; case WP_CHAINGUN: - Bullet_Fire( ent, CHAINGUN_SPREAD, MACHINEGUN_DAMAGE ); + Bullet_Fire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN ); break; #endif default: diff --git a/engine/code/jpeg-8c/ioquake3-changes.diff b/engine/code/jpeg-8c/ioquake3-changes.diff new file mode 100644 index 00000000..f3a89f1f --- /dev/null +++ b/engine/code/jpeg-8c/ioquake3-changes.diff @@ -0,0 +1,683 @@ +As required by the libjpeg license, additions, deletions and changes to +the original files are listed here. Files noted as "Only in jpeg-8c" +were deleted; files noted as "Only in ioquake3/code/jpeg-8c" were added. + +To regenerate this file, replace everything after "------" with the output +of this command: diff -ru jpeg-8c ioquake3/code/jpeg-8c + +------ + +Only in jpeg-8c: aclocal.m4 +Only in jpeg-8c: ansi2knr.1 +Only in jpeg-8c: ansi2knr.c +Only in jpeg-8c: cderror.h +Only in jpeg-8c: cdjpeg.c +Only in jpeg-8c: cdjpeg.h +Only in jpeg-8c: change.log +Only in jpeg-8c: cjpeg.1 +Only in jpeg-8c: cjpeg.c +Only in jpeg-8c: ckconfig.c +Only in jpeg-8c: coderules.txt +Only in jpeg-8c: config.guess +Only in jpeg-8c: config.sub +Only in jpeg-8c: configure +Only in jpeg-8c: configure.ac +Only in jpeg-8c: depcomp +Only in jpeg-8c: djpeg.1 +Only in jpeg-8c: djpeg.c +Only in jpeg-8c: example.c +Only in jpeg-8c: filelist.txt +Only in jpeg-8c: install-sh +Only in jpeg-8c: install.txt +diff -ru jpeg-8c/jcmainct.c ioquake3/code/jpeg-8c/jcmainct.c +--- jpeg-8c/jcmainct.c 2003-10-19 18:55:34.000000000 +0100 ++++ ioquake3/code/jpeg-8c/jcmainct.c 2011-11-25 11:24:52.000000000 +0000 +@@ -68,32 +68,32 @@ + METHODDEF(void) + start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + + /* Do nothing in raw-data mode. */ + if (cinfo->raw_data_in) + return; + +- main->cur_iMCU_row = 0; /* initialize counters */ +- main->rowgroup_ctr = 0; +- main->suspended = FALSE; +- main->pass_mode = pass_mode; /* save mode for use by process_data */ ++ main_ptr->cur_iMCU_row = 0; /* initialize counters */ ++ main_ptr->rowgroup_ctr = 0; ++ main_ptr->suspended = FALSE; ++ main_ptr->pass_mode = pass_mode; /* save mode for use by process_data */ + + switch (pass_mode) { + case JBUF_PASS_THRU: + #ifdef FULL_MAIN_BUFFER_SUPPORTED +- if (main->whole_image[0] != NULL) ++ if (main_ptr->whole_image[0] != NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + #endif +- main->pub.process_data = process_data_simple_main; ++ main_ptr->pub.process_data = process_data_simple_main; + break; + #ifdef FULL_MAIN_BUFFER_SUPPORTED + case JBUF_SAVE_SOURCE: + case JBUF_CRANK_DEST: + case JBUF_SAVE_AND_PASS: +- if (main->whole_image[0] == NULL) ++ if (main_ptr->whole_image[0] == NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); +- main->pub.process_data = process_data_buffer_main; ++ main_ptr->pub.process_data = process_data_buffer_main; + break; + #endif + default: +@@ -114,46 +114,46 @@ + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail) + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + +- while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { ++ while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) { + /* Read input data if we haven't filled the main buffer yet */ +- if (main->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size) ++ if (main_ptr->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size) + (*cinfo->prep->pre_process_data) (cinfo, + input_buf, in_row_ctr, in_rows_avail, +- main->buffer, &main->rowgroup_ctr, ++ main_ptr->buffer, &main_ptr->rowgroup_ctr, + (JDIMENSION) cinfo->min_DCT_v_scaled_size); + + /* If we don't have a full iMCU row buffered, return to application for + * more data. Note that preprocessor will always pad to fill the iMCU row + * at the bottom of the image. + */ +- if (main->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size) ++ if (main_ptr->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size) + return; + + /* Send the completed row to the compressor */ +- if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { ++ if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) { + /* If compressor did not consume the whole row, then we must need to + * suspend processing and return to the application. In this situation + * we pretend we didn't yet consume the last input row; otherwise, if + * it happened to be the last row of the image, the application would + * think we were done. + */ +- if (! main->suspended) { ++ if (! main_ptr->suspended) { + (*in_row_ctr)--; +- main->suspended = TRUE; ++ main_ptr->suspended = TRUE; + } + return; + } + /* We did finish the row. Undo our little suspension hack if a previous + * call suspended; then mark the main buffer empty. + */ +- if (main->suspended) { ++ if (main_ptr->suspended) { + (*in_row_ctr)++; +- main->suspended = FALSE; ++ main_ptr->suspended = FALSE; + } +- main->rowgroup_ctr = 0; +- main->cur_iMCU_row++; ++ main_ptr->rowgroup_ctr = 0; ++ main_ptr->cur_iMCU_row++; + } + } + +@@ -170,25 +170,25 @@ + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail) + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + int ci; + jpeg_component_info *compptr; +- boolean writing = (main->pass_mode != JBUF_CRANK_DEST); ++ boolean writing = (main_ptr->pass_mode != JBUF_CRANK_DEST); + +- while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { ++ while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) { + /* Realign the virtual buffers if at the start of an iMCU row. */ +- if (main->rowgroup_ctr == 0) { ++ if (main_ptr->rowgroup_ctr == 0) { + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { +- main->buffer[ci] = (*cinfo->mem->access_virt_sarray) +- ((j_common_ptr) cinfo, main->whole_image[ci], +- main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE), ++ main_ptr->buffer[ci] = (*cinfo->mem->access_virt_sarray) ++ ((j_common_ptr) cinfo, main_ptr->whole_image[ci], ++ main_ptr->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE), + (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing); + } + /* In a read pass, pretend we just read some source data. */ + if (! writing) { + *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE; +- main->rowgroup_ctr = DCTSIZE; ++ main_ptr->rowgroup_ctr = DCTSIZE; + } + } + +@@ -197,40 +197,40 @@ + if (writing) { + (*cinfo->prep->pre_process_data) (cinfo, + input_buf, in_row_ctr, in_rows_avail, +- main->buffer, &main->rowgroup_ctr, ++ main_ptr->buffer, &main_ptr->rowgroup_ctr, + (JDIMENSION) DCTSIZE); + /* Return to application if we need more data to fill the iMCU row. */ +- if (main->rowgroup_ctr < DCTSIZE) ++ if (main_ptr->rowgroup_ctr < DCTSIZE) + return; + } + + /* Emit data, unless this is a sink-only pass. */ +- if (main->pass_mode != JBUF_SAVE_SOURCE) { +- if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { ++ if (main_ptr->pass_mode != JBUF_SAVE_SOURCE) { ++ if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) { + /* If compressor did not consume the whole row, then we must need to + * suspend processing and return to the application. In this situation + * we pretend we didn't yet consume the last input row; otherwise, if + * it happened to be the last row of the image, the application would + * think we were done. + */ +- if (! main->suspended) { ++ if (! main_ptr->suspended) { + (*in_row_ctr)--; +- main->suspended = TRUE; ++ main_ptr->suspended = TRUE; + } + return; + } + /* We did finish the row. Undo our little suspension hack if a previous + * call suspended; then mark the main buffer empty. + */ +- if (main->suspended) { ++ if (main_ptr->suspended) { + (*in_row_ctr)++; +- main->suspended = FALSE; ++ main_ptr->suspended = FALSE; + } + } + + /* If get here, we are done with this iMCU row. Mark buffer empty. */ +- main->rowgroup_ctr = 0; +- main->cur_iMCU_row++; ++ main_ptr->rowgroup_ctr = 0; ++ main_ptr->cur_iMCU_row++; + } + } + +@@ -244,15 +244,15 @@ + GLOBAL(void) + jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) + { +- my_main_ptr main; ++ my_main_ptr main_ptr; + int ci; + jpeg_component_info *compptr; + +- main = (my_main_ptr) ++ main_ptr = (my_main_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_main_controller)); +- cinfo->main = (struct jpeg_c_main_controller *) main; +- main->pub.start_pass = start_pass_main; ++ cinfo->main = (struct jpeg_c_main_controller *) main_ptr; ++ main_ptr->pub.start_pass = start_pass_main; + + /* We don't need to create a buffer in raw-data mode. */ + if (cinfo->raw_data_in) +@@ -267,7 +267,7 @@ + /* Note we pad the bottom to a multiple of the iMCU height */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { +- main->whole_image[ci] = (*cinfo->mem->request_virt_sarray) ++ main_ptr->whole_image[ci] = (*cinfo->mem->request_virt_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + compptr->width_in_blocks * compptr->DCT_h_scaled_size, + (JDIMENSION) jround_up((long) compptr->height_in_blocks, +@@ -279,12 +279,12 @@ + #endif + } else { + #ifdef FULL_MAIN_BUFFER_SUPPORTED +- main->whole_image[0] = NULL; /* flag for no virtual arrays */ ++ main_ptr->whole_image[0] = NULL; /* flag for no virtual arrays */ + #endif + /* Allocate a strip buffer for each component */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { +- main->buffer[ci] = (*cinfo->mem->alloc_sarray) ++ main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + compptr->width_in_blocks * compptr->DCT_h_scaled_size, + (JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size)); +Only in jpeg-8c: jconfig.bcc +Only in jpeg-8c: jconfig.cfg +Only in jpeg-8c: jconfig.dj +Only in ioquake3/code/jpeg-8c: jconfig.h +Only in jpeg-8c: jconfig.mac +Only in jpeg-8c: jconfig.manx +Only in jpeg-8c: jconfig.mc6 +Only in jpeg-8c: jconfig.sas +Only in jpeg-8c: jconfig.st +Only in jpeg-8c: jconfig.txt +Only in jpeg-8c: jconfig.vc +Only in jpeg-8c: jconfig.vms +Only in jpeg-8c: jconfig.wat +diff -ru jpeg-8c/jdmainct.c ioquake3/code/jpeg-8c/jdmainct.c +--- jpeg-8c/jdmainct.c 2002-02-24 19:07:28.000000000 +0000 ++++ ioquake3/code/jpeg-8c/jdmainct.c 2011-11-25 11:24:52.000000000 +0000 +@@ -159,7 +159,7 @@ + * This is done only once, not once per pass. + */ + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + int ci, rgroup; + int M = cinfo->min_DCT_v_scaled_size; + jpeg_component_info *compptr; +@@ -168,10 +168,10 @@ + /* Get top-level space for component array pointers. + * We alloc both arrays with one call to save a few cycles. + */ +- main->xbuffer[0] = (JSAMPIMAGE) ++ main_ptr->xbuffer[0] = (JSAMPIMAGE) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); +- main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components; ++ main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { +@@ -184,9 +184,9 @@ + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); + xbuf += rgroup; /* want one row group at negative offsets */ +- main->xbuffer[0][ci] = xbuf; ++ main_ptr->xbuffer[0][ci] = xbuf; + xbuf += rgroup * (M + 4); +- main->xbuffer[1][ci] = xbuf; ++ main_ptr->xbuffer[1][ci] = xbuf; + } + } + +@@ -194,13 +194,13 @@ + LOCAL(void) + make_funny_pointers (j_decompress_ptr cinfo) + /* Create the funny pointer lists discussed in the comments above. +- * The actual workspace is already allocated (in main->buffer), ++ * The actual workspace is already allocated (in main_ptr->buffer), + * and the space for the pointer lists is allocated too. + * This routine just fills in the curiously ordered lists. + * This will be repeated at the beginning of each pass. + */ + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + int ci, i, rgroup; + int M = cinfo->min_DCT_v_scaled_size; + jpeg_component_info *compptr; +@@ -210,10 +210,10 @@ + ci++, compptr++) { + rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / + cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ +- xbuf0 = main->xbuffer[0][ci]; +- xbuf1 = main->xbuffer[1][ci]; ++ xbuf0 = main_ptr->xbuffer[0][ci]; ++ xbuf1 = main_ptr->xbuffer[1][ci]; + /* First copy the workspace pointers as-is */ +- buf = main->buffer[ci]; ++ buf = main_ptr->buffer[ci]; + for (i = 0; i < rgroup * (M + 2); i++) { + xbuf0[i] = xbuf1[i] = buf[i]; + } +@@ -240,7 +240,7 @@ + * This changes the pointer list state from top-of-image to the normal state. + */ + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + int ci, i, rgroup; + int M = cinfo->min_DCT_v_scaled_size; + jpeg_component_info *compptr; +@@ -250,8 +250,8 @@ + ci++, compptr++) { + rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / + cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ +- xbuf0 = main->xbuffer[0][ci]; +- xbuf1 = main->xbuffer[1][ci]; ++ xbuf0 = main_ptr->xbuffer[0][ci]; ++ xbuf1 = main_ptr->xbuffer[1][ci]; + for (i = 0; i < rgroup; i++) { + xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i]; + xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i]; +@@ -269,7 +269,7 @@ + * Also sets rowgroups_avail to indicate number of nondummy row groups in row. + */ + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + int ci, i, rgroup, iMCUheight, rows_left; + jpeg_component_info *compptr; + JSAMPARRAY xbuf; +@@ -286,12 +286,12 @@ + * so we need only do it once. + */ + if (ci == 0) { +- main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); ++ main_ptr->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); + } + /* Duplicate the last real sample row rgroup*2 times; this pads out the + * last partial rowgroup and ensures at least one full rowgroup of context. + */ +- xbuf = main->xbuffer[main->whichptr][ci]; ++ xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci]; + for (i = 0; i < rgroup * 2; i++) { + xbuf[rows_left + i] = xbuf[rows_left-1]; + } +@@ -306,27 +306,27 @@ + METHODDEF(void) + start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + + switch (pass_mode) { + case JBUF_PASS_THRU: + if (cinfo->upsample->need_context_rows) { +- main->pub.process_data = process_data_context_main; ++ main_ptr->pub.process_data = process_data_context_main; + make_funny_pointers(cinfo); /* Create the xbuffer[] lists */ +- main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ +- main->context_state = CTX_PREPARE_FOR_IMCU; +- main->iMCU_row_ctr = 0; ++ main_ptr->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ ++ main_ptr->context_state = CTX_PREPARE_FOR_IMCU; ++ main_ptr->iMCU_row_ctr = 0; + } else { + /* Simple case with no context needed */ +- main->pub.process_data = process_data_simple_main; ++ main_ptr->pub.process_data = process_data_simple_main; + } +- main->buffer_full = FALSE; /* Mark buffer empty */ +- main->rowgroup_ctr = 0; ++ main_ptr->buffer_full = FALSE; /* Mark buffer empty */ ++ main_ptr->rowgroup_ctr = 0; + break; + #ifdef QUANT_2PASS_SUPPORTED + case JBUF_CRANK_DEST: + /* For last pass of 2-pass quantization, just crank the postprocessor */ +- main->pub.process_data = process_data_crank_post; ++ main_ptr->pub.process_data = process_data_crank_post; + break; + #endif + default: +@@ -346,14 +346,14 @@ + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + JDIMENSION rowgroups_avail; + + /* Read input data if we haven't filled the main buffer yet */ +- if (! main->buffer_full) { +- if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer)) ++ if (! main_ptr->buffer_full) { ++ if (! (*cinfo->coef->decompress_data) (cinfo, main_ptr->buffer)) + return; /* suspension forced, can do nothing more */ +- main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ ++ main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ + } + + /* There are always min_DCT_scaled_size row groups in an iMCU row. */ +@@ -364,14 +364,14 @@ + */ + + /* Feed the postprocessor */ +- (*cinfo->post->post_process_data) (cinfo, main->buffer, +- &main->rowgroup_ctr, rowgroups_avail, ++ (*cinfo->post->post_process_data) (cinfo, main_ptr->buffer, ++ &main_ptr->rowgroup_ctr, rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); + + /* Has postprocessor consumed all the data yet? If so, mark buffer empty */ +- if (main->rowgroup_ctr >= rowgroups_avail) { +- main->buffer_full = FALSE; +- main->rowgroup_ctr = 0; ++ if (main_ptr->rowgroup_ctr >= rowgroups_avail) { ++ main_ptr->buffer_full = FALSE; ++ main_ptr->rowgroup_ctr = 0; + } + } + +@@ -386,15 +386,15 @@ + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) + { +- my_main_ptr main = (my_main_ptr) cinfo->main; ++ my_main_ptr main_ptr = (my_main_ptr) cinfo->main; + + /* Read input data if we haven't filled the main buffer yet */ +- if (! main->buffer_full) { ++ if (! main_ptr->buffer_full) { + if (! (*cinfo->coef->decompress_data) (cinfo, +- main->xbuffer[main->whichptr])) ++ main_ptr->xbuffer[main_ptr->whichptr])) + return; /* suspension forced, can do nothing more */ +- main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ +- main->iMCU_row_ctr++; /* count rows received */ ++ main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ ++ main_ptr->iMCU_row_ctr++; /* count rows received */ + } + + /* Postprocessor typically will not swallow all the input data it is handed +@@ -402,47 +402,47 @@ + * to exit and restart. This switch lets us keep track of how far we got. + * Note that each case falls through to the next on successful completion. + */ +- switch (main->context_state) { ++ switch (main_ptr->context_state) { + case CTX_POSTPONED_ROW: + /* Call postprocessor using previously set pointers for postponed row */ +- (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], +- &main->rowgroup_ctr, main->rowgroups_avail, ++ (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], ++ &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); +- if (main->rowgroup_ctr < main->rowgroups_avail) ++ if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) + return; /* Need to suspend */ +- main->context_state = CTX_PREPARE_FOR_IMCU; ++ main_ptr->context_state = CTX_PREPARE_FOR_IMCU; + if (*out_row_ctr >= out_rows_avail) + return; /* Postprocessor exactly filled output buf */ + /*FALLTHROUGH*/ + case CTX_PREPARE_FOR_IMCU: + /* Prepare to process first M-1 row groups of this iMCU row */ +- main->rowgroup_ctr = 0; +- main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1); ++ main_ptr->rowgroup_ctr = 0; ++ main_ptr->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1); + /* Check for bottom of image: if so, tweak pointers to "duplicate" + * the last sample row, and adjust rowgroups_avail to ignore padding rows. + */ +- if (main->iMCU_row_ctr == cinfo->total_iMCU_rows) ++ if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows) + set_bottom_pointers(cinfo); +- main->context_state = CTX_PROCESS_IMCU; ++ main_ptr->context_state = CTX_PROCESS_IMCU; + /*FALLTHROUGH*/ + case CTX_PROCESS_IMCU: + /* Call postprocessor using previously set pointers */ +- (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], +- &main->rowgroup_ctr, main->rowgroups_avail, ++ (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], ++ &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); +- if (main->rowgroup_ctr < main->rowgroups_avail) ++ if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) + return; /* Need to suspend */ + /* After the first iMCU, change wraparound pointers to normal state */ +- if (main->iMCU_row_ctr == 1) ++ if (main_ptr->iMCU_row_ctr == 1) + set_wraparound_pointers(cinfo); + /* Prepare to load new iMCU row using other xbuffer list */ +- main->whichptr ^= 1; /* 0=>1 or 1=>0 */ +- main->buffer_full = FALSE; ++ main_ptr->whichptr ^= 1; /* 0=>1 or 1=>0 */ ++ main_ptr->buffer_full = FALSE; + /* Still need to process last row group of this iMCU row, */ + /* which is saved at index M+1 of the other xbuffer */ +- main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1); +- main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2); +- main->context_state = CTX_POSTPONED_ROW; ++ main_ptr->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1); ++ main_ptr->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2); ++ main_ptr->context_state = CTX_POSTPONED_ROW; + } + } + +@@ -475,15 +475,15 @@ + GLOBAL(void) + jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) + { +- my_main_ptr main; ++ my_main_ptr main_ptr; + int ci, rgroup, ngroups; + jpeg_component_info *compptr; + +- main = (my_main_ptr) ++ main_ptr = (my_main_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_main_controller)); +- cinfo->main = (struct jpeg_d_main_controller *) main; +- main->pub.start_pass = start_pass_main; ++ cinfo->main = (struct jpeg_d_main_controller *) main_ptr; ++ main_ptr->pub.start_pass = start_pass_main; + + if (need_full_buffer) /* shouldn't happen */ + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); +@@ -504,7 +504,7 @@ + ci++, compptr++) { + rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / + cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ +- main->buffer[ci] = (*cinfo->mem->alloc_sarray) ++ main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + compptr->width_in_blocks * compptr->DCT_h_scaled_size, + (JDIMENSION) (rgroup * ngroups)); +diff -ru jpeg-8c/jerror.c ioquake3/code/jpeg-8c/jerror.c +--- jpeg-8c/jerror.c 1998-02-21 19:03:16.000000000 +0000 ++++ ioquake3/code/jpeg-8c/jerror.c 2011-11-25 11:24:52.000000000 +0000 +@@ -24,6 +24,8 @@ + #include "jversion.h" + #include "jerror.h" + ++#include ++ + #ifdef USE_WINDOWS_MESSAGEBOX + #include + #endif +Only in jpeg-8c: jmemansi.c +Only in jpeg-8c: jmemdosa.asm +Only in jpeg-8c: jmemdos.c +Only in jpeg-8c: jmemmac.c +Only in jpeg-8c: jmemname.c +Only in jpeg-8c: jpegtran.1 +Only in jpeg-8c: jpegtran.c +Only in jpeg-8c: libjpeg.map +Only in jpeg-8c: libjpeg.txt +Only in jpeg-8c: ltmain.sh +Only in jpeg-8c: makcjpeg.st +Only in jpeg-8c: makdjpeg.st +Only in jpeg-8c: makeadsw.vc6 +Only in jpeg-8c: makeasln.v10 +Only in jpeg-8c: makecdep.vc6 +Only in jpeg-8c: makecdsp.vc6 +Only in jpeg-8c: makecfil.v10 +Only in jpeg-8c: makecmak.vc6 +Only in jpeg-8c: makecvcx.v10 +Only in jpeg-8c: makeddep.vc6 +Only in jpeg-8c: makeddsp.vc6 +Only in jpeg-8c: makedfil.v10 +Only in jpeg-8c: makedmak.vc6 +Only in jpeg-8c: makedvcx.v10 +Only in jpeg-8c: Makefile.am +Only in jpeg-8c: makefile.ansi +Only in jpeg-8c: makefile.bcc +Only in jpeg-8c: makefile.dj +Only in jpeg-8c: Makefile.in +Only in jpeg-8c: makefile.manx +Only in jpeg-8c: makefile.mc6 +Only in jpeg-8c: makefile.mms +Only in jpeg-8c: makefile.sas +Only in jpeg-8c: makefile.unix +Only in jpeg-8c: makefile.vc +Only in jpeg-8c: makefile.vms +Only in jpeg-8c: makefile.wat +Only in jpeg-8c: makejdep.vc6 +Only in jpeg-8c: makejdsp.vc6 +Only in jpeg-8c: makejdsw.vc6 +Only in jpeg-8c: makejfil.v10 +Only in jpeg-8c: makejmak.vc6 +Only in jpeg-8c: makejsln.v10 +Only in jpeg-8c: makejvcx.v10 +Only in jpeg-8c: makeproj.mac +Only in jpeg-8c: makerdep.vc6 +Only in jpeg-8c: makerdsp.vc6 +Only in jpeg-8c: makerfil.v10 +Only in jpeg-8c: makermak.vc6 +Only in jpeg-8c: makervcx.v10 +Only in jpeg-8c: maketdep.vc6 +Only in jpeg-8c: maketdsp.vc6 +Only in jpeg-8c: maketfil.v10 +Only in jpeg-8c: maketmak.vc6 +Only in jpeg-8c: maketvcx.v10 +Only in jpeg-8c: makewdep.vc6 +Only in jpeg-8c: makewdsp.vc6 +Only in jpeg-8c: makewfil.v10 +Only in jpeg-8c: makewmak.vc6 +Only in jpeg-8c: makewvcx.v10 +Only in jpeg-8c: makljpeg.st +Only in jpeg-8c: maktjpeg.st +Only in jpeg-8c: makvms.opt +Only in jpeg-8c: missing +Only in jpeg-8c: rdbmp.c +Only in jpeg-8c: rdcolmap.c +Only in jpeg-8c: rdgif.c +Only in jpeg-8c: rdjpgcom.1 +Only in jpeg-8c: rdjpgcom.c +Only in jpeg-8c: rdppm.c +Only in jpeg-8c: rdrle.c +Only in jpeg-8c: rdswitch.c +Only in jpeg-8c: rdtarga.c +Only in jpeg-8c: structure.txt +Only in jpeg-8c: testimg.bmp +Only in jpeg-8c: testimg.jpg +Only in jpeg-8c: testimgp.jpg +Only in jpeg-8c: testimg.ppm +Only in jpeg-8c: testorig.jpg +Only in jpeg-8c: testprog.jpg +Only in jpeg-8c: transupp.c +Only in jpeg-8c: transupp.h +Only in jpeg-8c: usage.txt +Only in jpeg-8c: wizard.txt +Only in jpeg-8c: wrbmp.c +Only in jpeg-8c: wrgif.c +Only in jpeg-8c: wrjpgcom.1 +Only in jpeg-8c: wrjpgcom.c +Only in jpeg-8c: wrppm.c +Only in jpeg-8c: wrrle.c +Only in jpeg-8c: wrtarga.c diff --git a/engine/code/q3_ui/ui_atoms.c b/engine/code/q3_ui/ui_atoms.c index 6d53dfd8..c243212b 100644 --- a/engine/code/q3_ui/ui_atoms.c +++ b/engine/code/q3_ui/ui_atoms.c @@ -42,7 +42,7 @@ void QDECL Com_Error( int level, const char *error, ... ) { Q_vsnprintf (text, sizeof(text), error, argptr); va_end (argptr); - trap_Error( va("%s", text) ); + trap_Error( text ); } void QDECL Com_Printf( const char *msg, ... ) { @@ -53,7 +53,7 @@ void QDECL Com_Printf( const char *msg, ... ) { Q_vsnprintf (text, sizeof(text), msg, argptr); va_end (argptr); - trap_Print( va("%s", text) ); + trap_Print( text ); } #endif diff --git a/engine/code/q3_ui/ui_gameinfo.c b/engine/code/q3_ui/ui_gameinfo.c index a3087d5b..ba2f6394 100644 --- a/engine/code/q3_ui/ui_gameinfo.c +++ b/engine/code/q3_ui/ui_gameinfo.c @@ -208,7 +208,7 @@ static void UI_LoadArenas( void ) { UI_LoadArenasFromFile(filename); } trap_Print( va( "%i arenas parsed\n", ui_numArenas ) ); - if (outOfMemory) trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n"); + if (outOfMemory) trap_Print(S_COLOR_YELLOW"WARNING: not enough memory in pool to load all arenas\n"); // set initial numbers for( n = 0; n < ui_numArenas; n++ ) { @@ -358,7 +358,7 @@ static void UI_LoadBotsFromFile( char *filename ) { trap_FS_FCloseFile( f ); ui_numBots += UI_ParseInfos( buf, MAX_BOTS - ui_numBots, &ui_botInfos[ui_numBots] ); - if (outOfMemory) trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all bots\n"); + if (outOfMemory) trap_Print(S_COLOR_YELLOW"WARNING: not enough memory in pool to load all bots\n"); } /* diff --git a/engine/code/qcommon/cmd.c b/engine/code/qcommon/cmd.c index 8020207e..40f17861 100644 --- a/engine/code/qcommon/cmd.c +++ b/engine/code/qcommon/cmd.c @@ -265,14 +265,18 @@ Cmd_Exec_f =============== */ void Cmd_Exec_f( void ) { + qboolean quiet; union { char *c; void *v; } f; char filename[MAX_QPATH]; + quiet = !Q_stricmp(Cmd_Argv(0), "execq"); + if (Cmd_Argc () != 2) { - Com_Printf ("exec : execute a script file\n"); + Com_Printf ("exec%s : execute a script file%s\n", + quiet ? "q" : "", quiet ? " without notification" : ""); return; } @@ -280,10 +284,11 @@ void Cmd_Exec_f( void ) { COM_DefaultExtension( filename, sizeof( filename ), ".cfg" ); FS_ReadFile( filename, &f.v); if (!f.c) { - Com_Printf ("couldn't exec %s\n",Cmd_Argv(1)); + Com_Printf ("couldn't exec %s\n", filename); return; } - Com_Printf ("execing %s\n",Cmd_Argv(1)); + if (!quiet) + Com_Printf ("execing %s\n", filename); Cbuf_InsertText (f.c); @@ -853,7 +858,9 @@ Cmd_Init void Cmd_Init (void) { Cmd_AddCommand ("cmdlist",Cmd_List_f); Cmd_AddCommand ("exec",Cmd_Exec_f); + Cmd_AddCommand ("execq",Cmd_Exec_f); Cmd_SetCommandCompletionFunc( "exec", Cmd_CompleteCfgName ); + Cmd_SetCommandCompletionFunc( "execq", Cmd_CompleteCfgName ); Cmd_AddCommand ("vstr",Cmd_Vstr_f); Cmd_SetCommandCompletionFunc( "vstr", Cvar_CompleteCvarName ); Cmd_AddCommand ("echo",Cmd_Echo_f); diff --git a/engine/code/qcommon/files.c b/engine/code/qcommon/files.c index 94193b8f..50f8de5c 100644 --- a/engine/code/qcommon/files.c +++ b/engine/code/qcommon/files.c @@ -49,7 +49,7 @@ The "base path" is the path to the directory holding all the game directories an the executable. It defaults to ".", but can be overridden with a "+set fs_basepath c:\quake3" command line to allow code debugging in a different directory. Basepath cannot be modified at all after startup. Any files that are created (demos, screenshots, -etc) will be created reletive to the base path, so base path should usually be writable. +etc) will be created relative to the base path, so base path should usually be writable. The "home path" is the path used for all write access. On win32 systems we have "base path" == "home path", but on *nix systems the base installation is usually readonly, and @@ -1261,14 +1261,13 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_ !FS_IsExt(filename, ".bot", len) && !FS_IsExt(filename, ".arena", len) && !FS_IsExt(filename, ".menu", len) && + Q_stricmp(filename, "qagame.qvm") != 0 && !strstr(filename, "levelshots")) { pak->referenced |= FS_GENERAL_REF; } } - if(strstr(filename, "qagame.qvm")) - pak->referenced |= FS_QAGAME_REF; if(strstr(filename, "cgame.qvm")) pak->referenced |= FS_CGAME_REF; if(strstr(filename, "ui.qvm")) @@ -1952,7 +1951,7 @@ void FS_FreeFile( void *buffer ) { ============ FS_WriteFile -Filename are reletive to the quake search path +Filename are relative to the quake search path ============ */ void FS_WriteFile( const char *qpath, const void *buffer, int size ) { @@ -3605,31 +3604,6 @@ static void FS_CheckPaks( void ) } } -/* -===================== -FS_GamePureChecksum - -Returns the checksum of the pk3 from which the server loaded the qagame.qvm -===================== -*/ -const char *FS_GamePureChecksum( void ) { - static char info[MAX_STRING_TOKENS]; - searchpath_t *search; - - info[0] = 0; - - for ( search = fs_searchpaths ; search ; search = search->next ) { - // is the element a pak file? - if ( search->pack ) { - if (search->pack->referenced & FS_QAGAME_REF) { - Com_sprintf(info, sizeof(info), "%d", search->pack->checksum); - } - } - } - - return info; -} - /* ===================== FS_LoadedPakChecksums diff --git a/engine/code/qcommon/huffman.c b/engine/code/qcommon/huffman.c index 8a5fa507..941258c2 100644 --- a/engine/code/qcommon/huffman.c +++ b/engine/code/qcommon/huffman.c @@ -362,7 +362,7 @@ void Huff_Decompress(msg_t *mbuf, int offset) { for ( j = 0; j < cch; j++ ) { ch = 0; // don't overflow reading from the messages - // FIXME: would it be better to have a overflow check in get_bit ? + // FIXME: would it be better to have an overflow check in get_bit ? if ( (bloc >> 3) > size ) { seq[j] = 0; break; diff --git a/engine/code/qcommon/md4.c b/engine/code/qcommon/md4.c index 838b062e..b37c87b4 100644 --- a/engine/code/qcommon/md4.c +++ b/engine/code/qcommon/md4.c @@ -38,7 +38,7 @@ struct mdfour { /* NOTE: This code makes no attempt to be fast! - It assumes that a int is at least 32 bits long + It assumes that an int is at least 32 bits long */ static struct mdfour *m; diff --git a/engine/code/qcommon/md5.c b/engine/code/qcommon/md5.c index 5cf12bb3..994083fc 100644 --- a/engine/code/qcommon/md5.c +++ b/engine/code/qcommon/md5.c @@ -253,7 +253,7 @@ static void MD5Final(struct MD5Context *ctx, unsigned char *digest) if (digest!=NULL) memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } diff --git a/engine/code/qcommon/msg.c b/engine/code/qcommon/msg.c index 1d06ecf6..968d68a9 100644 --- a/engine/code/qcommon/msg.c +++ b/engine/code/qcommon/msg.c @@ -715,8 +715,14 @@ void MSG_ReadDeltaUsercmd( msg_t *msg, usercmd_t *from, usercmd_t *to ) { to->angles[1] = MSG_ReadDelta( msg, from->angles[1], 16); to->angles[2] = MSG_ReadDelta( msg, from->angles[2], 16); to->forwardmove = MSG_ReadDelta( msg, from->forwardmove, 8); + if( to->forwardmove == -128 ) + to->forwardmove = -127; to->rightmove = MSG_ReadDelta( msg, from->rightmove, 8); + if( to->rightmove == -128 ) + to->rightmove = -127; to->upmove = MSG_ReadDelta( msg, from->upmove, 8); + if( to->upmove == -128 ) + to->upmove = -127; to->buttons = MSG_ReadDelta( msg, from->buttons, 16); to->weapon = MSG_ReadDelta( msg, from->weapon, 8); } @@ -776,8 +782,14 @@ void MSG_ReadDeltaUsercmdKey( msg_t *msg, int key, usercmd_t *from, usercmd_t *t to->angles[1] = MSG_ReadDeltaKey( msg, key, from->angles[1], 16); to->angles[2] = MSG_ReadDeltaKey( msg, key, from->angles[2], 16); to->forwardmove = MSG_ReadDeltaKey( msg, key, from->forwardmove, 8); + if( to->forwardmove == -128 ) + to->forwardmove = -127; to->rightmove = MSG_ReadDeltaKey( msg, key, from->rightmove, 8); + if( to->rightmove == -128 ) + to->rightmove = -127; to->upmove = MSG_ReadDeltaKey( msg, key, from->upmove, 8); + if( to->upmove == -128 ) + to->upmove = -127; to->buttons = MSG_ReadDeltaKey( msg, key, from->buttons, 16); to->weapon = MSG_ReadDeltaKey( msg, key, from->weapon, 8); } else { diff --git a/engine/code/qcommon/net_ip.c b/engine/code/qcommon/net_ip.c index 4a0960bb..9d2a01f6 100644 --- a/engine/code/qcommon/net_ip.c +++ b/engine/code/qcommon/net_ip.c @@ -317,7 +317,7 @@ static qboolean Sys_StringToSockaddr(const char *s, struct sockaddr *sadr, int s search->ai_addrlen = sadr_len; memcpy(sadr, search->ai_addr, search->ai_addrlen); - freeaddrinfo(search); + freeaddrinfo(res); return qtrue; } @@ -651,6 +651,7 @@ void Sys_SendPacket( int length, const void *data, netadr_t to ) { } if( (ip_socket == INVALID_SOCKET && to.type == NA_IP) || + (ip_socket == INVALID_SOCKET && to.type == NA_BROADCAST) || (ip6_socket == INVALID_SOCKET && to.type == NA_IP6) || (ip6_socket == INVALID_SOCKET && to.type == NA_MULTICAST6) ) return; @@ -690,7 +691,7 @@ void Sys_SendPacket( int length, const void *data, netadr_t to ) { return; } - Com_Printf( "NET_SendPacket: %s\n", NET_ErrorString() ); + Com_Printf( "Sys_SendPacket: %s\n", NET_ErrorString() ); } } @@ -1533,7 +1534,7 @@ void NET_Config( qboolean enableNetworking ) { ip_socket = INVALID_SOCKET; } - if(multicast6_socket) + if(multicast6_socket != INVALID_SOCKET) { if(multicast6_socket != ip6_socket) closesocket(multicast6_socket); @@ -1632,7 +1633,7 @@ void NET_Event(fd_set *fdr) // com_dropsim->value percent of incoming packets get dropped. if(rand() < (int) (((double) RAND_MAX) / 100.0 * (double) net_dropsim->value)) continue; // drop this packet - } + } if(com_sv_running->integer) Com_RunAndTimeServerPacket(&from, &netmsg); @@ -1655,7 +1656,8 @@ void NET_Sleep(int msec) { struct timeval timeout; fd_set fdr; - int highestfd = -1, retval; + int retval; + SOCKET highestfd = INVALID_SOCKET; if(msec < 0) msec = 0; @@ -1671,16 +1673,13 @@ void NET_Sleep(int msec) if(ip6_socket != INVALID_SOCKET) { FD_SET(ip6_socket, &fdr); - - if(ip6_socket > highestfd) + + if(highestfd == INVALID_SOCKET || ip6_socket > highestfd) highestfd = ip6_socket; } - timeout.tv_sec = msec/1000; - timeout.tv_usec = (msec%1000)*1000; - #ifdef _WIN32 - if(highestfd < 0) + if(highestfd == INVALID_SOCKET) { // windows ain't happy when select is called without valid FDs SleepEx(msec, 0); @@ -1688,9 +1687,12 @@ void NET_Sleep(int msec) } #endif + timeout.tv_sec = msec/1000; + timeout.tv_usec = (msec%1000)*1000; + retval = select(highestfd + 1, &fdr, NULL, NULL, &timeout); - - if(retval < 0) + + if(retval == SOCKET_ERROR) Com_Printf("Warning: select() syscall failed: %s\n", NET_ErrorString()); else if(retval > 0) NET_Event(&fdr); diff --git a/engine/code/qcommon/q_shared.h b/engine/code/qcommon/q_shared.h index 7f66a280..1277492d 100644 --- a/engine/code/qcommon/q_shared.h +++ b/engine/code/qcommon/q_shared.h @@ -1256,7 +1256,7 @@ typedef struct playerState_s { // STONELANCE - 4 bits over the net int observerMode; #define movementDir observerMode // ZTM: Remove this later -// int movementDir; // a number 0 to 7 that represents the reletive angle +// int movementDir; // a number 0 to 7 that represents the relative angle // of movement to the view angle (axial and diagonals) // when at rest, the value will remain unchanged // used to twist the legs during strafing @@ -1425,7 +1425,7 @@ typedef struct entityState_s { // STONELANCE - 10 bits over the net int otherEntityNum2; - int groundEntityNum; // -1 = in air + int groundEntityNum; // ENTITYNUM_NONE = in air int constantLight; // r + (g<<8) + (b<<16) + (intensity<<24) int loopSound; // constantly loop this sound diff --git a/engine/code/qcommon/qcommon.h b/engine/code/qcommon/qcommon.h index afc8ae24..f6572d20 100644 --- a/engine/code/qcommon/qcommon.h +++ b/engine/code/qcommon/qcommon.h @@ -591,7 +591,6 @@ issues. #define FS_GENERAL_REF 0x01 #define FS_UI_REF 0x02 #define FS_CGAME_REF 0x04 -#define FS_QAGAME_REF 0x08 // number of id paks that will never be autodownloaded from baseq3/missionpack #define NUM_ID_PAKS 9 #define NUM_TA_PAKS 4 @@ -700,9 +699,6 @@ int FS_Seek( fileHandle_t f, long offset, int origin ); qboolean FS_FilenameCompare( const char *s1, const char *s2 ); -const char *FS_GamePureChecksum( void ); -// Returns the checksum of the pk3 from which the server loaded the qagame.qvm - const char *FS_LoadedPakNames( void ); const char *FS_LoadedPakChecksums( void ); const char *FS_LoadedPakPureChecksums( void ); @@ -800,7 +796,7 @@ typedef enum { SE_NONE = 0, // evTime is still valid SE_KEY, // evValue is a key code, evValue2 is the down flag SE_CHAR, // evValue is an ascii char - SE_MOUSE, // evValue and evValue2 are reletive signed x / y moves + SE_MOUSE, // evValue and evValue2 are relative signed x / y moves SE_JOYSTICK_AXIS, // evValue is an axis number and evValue2 is the current state (-127 to 127) SE_CONSOLE // evPtr is a char* } sysEventType_t; @@ -1061,15 +1057,7 @@ NON-PORTABLE SYSTEM SERVICES ============================================================== */ -typedef enum { - AXIS_SIDE, - AXIS_FORWARD, - AXIS_UP, - AXIS_ROLL, - AXIS_YAW, - AXIS_PITCH, - MAX_JOYSTICK_AXIS -} joystickAxis_t; +#define MAX_JOYSTICK_AXIS 16 void Sys_Init (void); @@ -1134,7 +1122,6 @@ char *Sys_DefaultAppPath(void); void Sys_SetDefaultHomePath(const char *path); char *Sys_DefaultHomePath(void); -const char *Sys_TempPath(void); const char *Sys_Dirname( char *path ); const char *Sys_Basename( char *path ); char *Sys_ConsoleInput(void); diff --git a/engine/code/qcommon/unzip.c b/engine/code/qcommon/unzip.c index 128502ce..2dd0bf83 100644 --- a/engine/code/qcommon/unzip.c +++ b/engine/code/qcommon/unzip.c @@ -376,11 +376,11 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream) /* Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer + on a Windows NT computer "c:\\test\\zlib114.zip" or on a Unix computer "zlib/zlib114.zip". If the zipfile cannot be opened (file doesn't exist or in not valid), the return value is NULL. - Else, the return value is a unzFile Handle, usable with other function + Else, the return value is an unzFile Handle, usable with other function of this unzip package. */ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def) diff --git a/engine/code/qcommon/unzip.h b/engine/code/qcommon/unzip.h index b4a839b3..b22b72ea 100644 --- a/engine/code/qcommon/unzip.h +++ b/engine/code/qcommon/unzip.h @@ -136,11 +136,11 @@ extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, extern unzFile ZEXPORT unzOpen OF((const char *path)); /* Open a Zip file. path contain the full pathname (by example, - on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer + on a Windows XP computer "c:\\zlib\\zlib113.zip" or on a Unix computer "zlib/zlib113.zip". If the zipfile cannot be opened (file don't exist or in not valid), the return value is NULL. - Else, the return value is a unzFile Handle, usable with other function + Else, the return value is an unzFile Handle, usable with other function of this unzip package. */ diff --git a/engine/code/qcommon/vm.c b/engine/code/qcommon/vm.c index 13e41b03..ac73c6ec 100644 --- a/engine/code/qcommon/vm.c +++ b/engine/code/qcommon/vm.c @@ -336,7 +336,7 @@ Dlls will call this directly ============ */ intptr_t QDECL VM_DllSyscall( intptr_t arg, ... ) { -#if !id386 +#if !id386 || defined __clang__ // rcg010206 - see commentary above intptr_t args[16]; int i; @@ -835,7 +835,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) args[4], args[5], args[6], args[7], args[8], args[9]); } else { -#if id386 || idsparc // i386/sparc calling convention doesn't need conversion +#if ( id386 || idsparc ) && !defined __clang__ // calling convention doesn't need conversion in some cases #ifndef NO_VM_COMPILED if ( vm->compiled ) r = VM_CallCompiled( vm, (int*)&callnum ); diff --git a/engine/code/qcommon/vm_local.h b/engine/code/qcommon/vm_local.h index aa14e672..2c7d6f7d 100644 --- a/engine/code/qcommon/vm_local.h +++ b/engine/code/qcommon/vm_local.h @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define OPSTACK_MASK (OPSTACK_SIZE-1) // don't change -// Hardcoded in q3asm an reserved at end of bss +// Hardcoded in q3asm a reserved at end of bss #define PROGRAM_STACK_SIZE 0x10000 #define PROGRAM_STACK_MASK (PROGRAM_STACK_SIZE-1) diff --git a/engine/code/qcommon/vm_powerpc.c b/engine/code/qcommon/vm_powerpc.c index eb66c5ad..d81049c5 100644 --- a/engine/code/qcommon/vm_powerpc.c +++ b/engine/code/qcommon/vm_powerpc.c @@ -311,7 +311,7 @@ typedef struct VM_Data { // function pointers, no use to waste registers for them long int (* AsmCall)( int, int ); - void (* BlockCopy )( unsigned int, unsigned int, unsigned int ); + void (* BlockCopy )( unsigned int, unsigned int, size_t ); // instruction pointers, rarely used so don't waste register ppc_instruction_t *iPointers; diff --git a/engine/code/qcommon/vm_powerpc_asm.c b/engine/code/qcommon/vm_powerpc_asm.c index 70159259..5ad62a3b 100644 --- a/engine/code/qcommon/vm_powerpc_asm.c +++ b/engine/code/qcommon/vm_powerpc_asm.c @@ -374,7 +374,7 @@ static const struct powerpc_operand powerpc_operands[] = /* The SH field in an X or M form instruction. */ #define SH RS + 1 #define SH_MASK (0x1f << 11) - /* The other UIMM field in a EVX form instruction. */ + /* The other UIMM field in an EVX form instruction. */ #define EVUIMM SH { 0x1f, 11, NULL, 0 }, @@ -657,19 +657,19 @@ insert_rbs (unsigned long insn, #define SC(op, sa, lk) (OP (op) | ((((unsigned long)(sa)) & 1) << 1) | ((lk) & 1)) #define SC_MASK (OP_MASK | (((unsigned long)0x3ff) << 16) | (((unsigned long)1) << 1) | 1) -/* An VX form instruction. */ +/* A VX form instruction. */ #define VX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7ff)) -/* The mask for an VX form instruction. */ +/* The mask for a VX form instruction. */ #define VX_MASK VX(0x3f, 0x7ff) -/* An VA form instruction. */ +/* A VA form instruction. */ #define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x03f)) -/* The mask for an VA form instruction. */ +/* The mask for a VA form instruction. */ #define VXA_MASK VXA(0x3f, 0x3f) -/* An VXR form instruction. */ +/* A VXR form instruction. */ #define VXR(op, xop, rc) (OP (op) | (((rc) & 1) << 10) | (((unsigned long)(xop)) & 0x3ff)) /* The mask for a VXR form instruction. */ diff --git a/engine/code/qcommon/vm_x86.c b/engine/code/qcommon/vm_x86.c index d19763e6..32be49cd 100644 --- a/engine/code/qcommon/vm_x86.c +++ b/engine/code/qcommon/vm_x86.c @@ -390,55 +390,28 @@ static void ErrJump(void) /* ================= DoSyscall -Uses asm to retrieve arguments from registers to work around different calling conventions + +Assembler helper routines will write its arguments directly to global variables so as to +work around different calling conventions ================= */ -#if defined(_MSC_VER) && idx64 +int vm_syscallNum; +int vm_programStack; +int *vm_opStackBase; +uint8_t vm_opStackOfs; +intptr_t vm_arg; -extern void qsyscall64(void); -extern uint8_t qvmcall64(int *programStack, int *opStack, intptr_t *instructionPointers, byte *dataBase); - -// Microsoft does not support inline assembler on x64 platforms. Meh. -void DoSyscall(int syscallNum, int programStack, int *opStackBase, uint8_t opStackOfs, intptr_t arg) -{ -#else static void DoSyscall(void) { - int syscallNum; - int programStack; - int *opStackBase; - uint8_t opStackOfs; - intptr_t arg; -#endif - vm_t *savedVM; -#if defined(_MSC_VER) - #if !idx64 - __asm - { - mov dword ptr syscallNum, eax - mov dword ptr programStack, esi - mov byte ptr opStackOfs, bl - mov dword ptr opStackBase, edi - mov dword ptr arg, ecx - } - #endif -#else - __asm__ volatile( - "" - : "=a" (syscallNum), "=S" (programStack), "=D" (opStackBase), "=b" (opStackOfs), - "=c" (arg) - ); -#endif - // save currentVM so as to allow for recursive VM entry savedVM = currentVM; // modify VM stack pointer for recursive VM entry - currentVM->programStack = programStack - 4; + currentVM->programStack = vm_programStack - 4; - if(syscallNum < 0) + if(vm_syscallNum < 0) { int *data; #if idx64 @@ -446,34 +419,34 @@ static void DoSyscall(void) intptr_t args[16]; #endif - data = (int *) (savedVM->dataBase + programStack + 4); + data = (int *) (savedVM->dataBase + vm_programStack + 4); #if idx64 - args[0] = ~syscallNum; + args[0] = ~vm_syscallNum; for(index = 1; index < ARRAY_LEN(args); index++) args[index] = data[index]; - opStackBase[opStackOfs + 1] = savedVM->systemCall(args); + vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall(args); #else - data[0] = ~syscallNum; - opStackBase[opStackOfs + 1] = savedVM->systemCall((intptr_t *) data); + data[0] = ~vm_syscallNum; + vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall((intptr_t *) data); #endif } else { - switch(syscallNum) + switch(vm_syscallNum) { case VM_JMP_VIOLATION: ErrJump(); break; case VM_BLOCK_COPY: - if(opStackOfs < 1) + if(vm_opStackOfs < 1) Com_Error(ERR_DROP, "VM_BLOCK_COPY failed due to corrupted opStack"); - VM_BlockCopy(opStackBase[(opStackOfs - 1)], opStackBase[opStackOfs], arg); + VM_BlockCopy(vm_opStackBase[(vm_opStackOfs - 1)], vm_opStackBase[vm_opStackOfs], vm_arg); break; default: - Com_Error(ERR_DROP, "Unknown VM operation %d", syscallNum); + Com_Error(ERR_DROP, "Unknown VM operation %d", vm_syscallNum); break; } } @@ -504,13 +477,8 @@ Call to DoSyscall() int EmitCallDoSyscall(vm_t *vm) { // use edx register to store DoSyscall address -#if defined(_MSC_VER) && idx64 - EmitRexString(0x48, "BA"); // mov edx, qsyscall64 - EmitPtr(qsyscall64); -#else EmitRexString(0x48, "BA"); // mov edx, DoSyscall EmitPtr(DoSyscall); -#endif // Push important registers to stack as we can't really make // any assumptions about calling conventions. @@ -522,6 +490,27 @@ int EmitCallDoSyscall(vm_t *vm) EmitRexString(0x41, "51"); // push r9 #endif + // write arguments to global vars + // syscall number + EmitString("A3"); // mov [0x12345678], eax + EmitPtr(&vm_syscallNum); + // vm_programStack value + EmitString("89 F0"); // mov eax, esi + EmitString("A3"); // mov [0x12345678], eax + EmitPtr(&vm_programStack); + // vm_opStackOfs + EmitString("88 D8"); // mov al, bl + EmitString("A2"); // mov [0x12345678], al + EmitPtr(&vm_opStackOfs); + // vm_opStackBase + EmitRexString(0x48, "89 F8"); // mov eax, edi + EmitRexString(0x48, "A3"); // mov [0x12345678], eax + EmitPtr(&vm_opStackBase); + // vm_arg + EmitString("89 C8"); // mov eax, ecx + EmitString("A3"); // mov [0x12345678], eax + EmitPtr(&vm_arg); + // align the stack pointer to a 16-byte-boundary EmitString("55"); // push ebp EmitRexString(0x48, "89 E5"); // mov ebp, esp @@ -1713,6 +1702,10 @@ This function is called directly by the generated code ============== */ +#if defined(_MSC_VER) && defined(idx64) +extern uint8_t qvmcall64(int *programStack, int *opStack, intptr_t *instructionPointers, byte *dataBase); +#endif + int VM_CallCompiled(vm_t *vm, int *args) { byte stack[OPSTACK_SIZE + 15]; diff --git a/engine/code/renderer/tr_backend.c b/engine/code/renderer/tr_backend.c index 2b630a4f..f327db0e 100644 --- a/engine/code/renderer/tr_backend.c +++ b/engine/code/renderer/tr_backend.c @@ -445,6 +445,11 @@ void RB_BeginDrawingView (void) { // 2D images again backEnd.projection2D = qfalse; + // + // set the modelview matrix for the viewer + // + SetViewportAndScissor(); + // ensures that depth writes are enabled for the depth clear GL_State( GLS_DEFAULT ); // clear relevant buffers @@ -465,11 +470,6 @@ void RB_BeginDrawingView (void) { } qglClear( clearBits ); - // - // set the modelview matrix for the viewer - // - SetViewportAndScissor(); - if ( ( backEnd.refdef.rdflags & RDF_HYPERSPACE ) ) { RB_Hyperspace(); diff --git a/engine/code/renderer/tr_flares.c b/engine/code/renderer/tr_flares.c index 05b18355..e6a757c7 100644 --- a/engine/code/renderer/tr_flares.c +++ b/engine/code/renderer/tr_flares.c @@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA LIGHT FLARES A light flare is an effect that takes place inside the eye when bright light -sources are visible. The size of the flare reletive to the screen is nearly +sources are visible. The size of the flare relative to the screen is nearly constant, irrespective of distance, but the intensity should be proportional to the projected area of the light source. diff --git a/engine/code/renderer/tr_font.c b/engine/code/renderer/tr_font.c index bdb4251b..87465e52 100644 --- a/engine/code/renderer/tr_font.c +++ b/engine/code/renderer/tr_font.c @@ -58,11 +58,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // 4. Exit the game and there will be three dat files and at least three tga files. The // tga's are in 256x256 pages so if it takes three images to render a 24 point font you // will end up with fontImage_0_24.tga through fontImage_2_24.tga -// 5. You will need to flip the tga's in Photoshop as the tga output code writes them upside -// down. -// 6. In future runs of the game, the system looks for these images and data files when a s +// 5. In future runs of the game, the system looks for these images and data files when a s // specific point sized font is rendered and loads them for use. -// 7. Because of the original beta nature of the FreeType code you will probably want to hand +// 6. Because of the original beta nature of the FreeType code you will probably want to hand // touch the font bitmaps. // // Currently a define in the project turns on or off the FreeType code which is currently @@ -75,11 +73,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifdef BUILD_FREETYPE #include -#include -#include -#include -#include -#include +#include FT_ERRORS_H +#include FT_SYSTEM_H +#include FT_IMAGE_H +#include FT_FREETYPE_H +#include FT_OUTLINE_H #define _FLOOR(x) ((x) & -64) #define _CEIL(x) (((x)+63) & -64) @@ -94,62 +92,62 @@ static fontInfo_t registeredFont[MAX_FONTS]; #ifdef BUILD_FREETYPE void R_GetGlyphInfo(FT_GlyphSlot glyph, int *left, int *right, int *width, int *top, int *bottom, int *height, int *pitch) { + *left = _FLOOR( glyph->metrics.horiBearingX ); + *right = _CEIL( glyph->metrics.horiBearingX + glyph->metrics.width ); + *width = _TRUNC(*right - *left); - *left = _FLOOR( glyph->metrics.horiBearingX ); - *right = _CEIL( glyph->metrics.horiBearingX + glyph->metrics.width ); - *width = _TRUNC(*right - *left); - - *top = _CEIL( glyph->metrics.horiBearingY ); - *bottom = _FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height ); - *height = _TRUNC( *top - *bottom ); - *pitch = ( qtrue ? (*width+3) & -4 : (*width+7) >> 3 ); + *top = _CEIL( glyph->metrics.horiBearingY ); + *bottom = _FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height ); + *height = _TRUNC( *top - *bottom ); + *pitch = ( qtrue ? (*width+3) & -4 : (*width+7) >> 3 ); } FT_Bitmap *R_RenderGlyph(FT_GlyphSlot glyph, glyphInfo_t* glyphOut) { + FT_Bitmap *bit2; + int left, right, width, top, bottom, height, pitch, size; - FT_Bitmap *bit2; - int left, right, width, top, bottom, height, pitch, size; + R_GetGlyphInfo(glyph, &left, &right, &width, &top, &bottom, &height, &pitch); - R_GetGlyphInfo(glyph, &left, &right, &width, &top, &bottom, &height, &pitch); + if ( glyph->format == ft_glyph_format_outline ) { + size = pitch*height; - if ( glyph->format == ft_glyph_format_outline ) { - size = pitch*height; + bit2 = ri.Malloc(sizeof(FT_Bitmap)); - bit2 = Z_Malloc(sizeof(FT_Bitmap)); + bit2->width = width; + bit2->rows = height; + bit2->pitch = pitch; + bit2->pixel_mode = ft_pixel_mode_grays; + //bit2->pixel_mode = ft_pixel_mode_mono; + bit2->buffer = ri.Malloc(pitch*height); + bit2->num_grays = 256; - bit2->width = width; - bit2->rows = height; - bit2->pitch = pitch; - bit2->pixel_mode = ft_pixel_mode_grays; - //bit2->pixel_mode = ft_pixel_mode_mono; - bit2->buffer = Z_Malloc(pitch*height); - bit2->num_grays = 256; + Com_Memset( bit2->buffer, 0, size ); - Com_Memset( bit2->buffer, 0, size ); + FT_Outline_Translate( &glyph->outline, -left, -bottom ); - FT_Outline_Translate( &glyph->outline, -left, -bottom ); + FT_Outline_Get_Bitmap( ftLibrary, &glyph->outline, bit2 ); - FT_Outline_Get_Bitmap( ftLibrary, &glyph->outline, bit2 ); + glyphOut->height = height; + glyphOut->pitch = pitch; + glyphOut->top = (glyph->metrics.horiBearingY >> 6) + 1; + glyphOut->bottom = bottom; - glyphOut->height = height; - glyphOut->pitch = pitch; - glyphOut->top = (glyph->metrics.horiBearingY >> 6) + 1; - glyphOut->bottom = bottom; - - return bit2; - } - else { - ri.Printf(PRINT_ALL, "Non-outline fonts are not supported\n"); - } - return NULL; + return bit2; + } else { + ri.Printf(PRINT_ALL, "Non-outline fonts are not supported\n"); + } + return NULL; } void WriteTGA (char *filename, byte *data, int width, int height) { - byte *buffer; - int i, c; + byte *buffer; + int i, c; + int row; + unsigned char *flip; + unsigned char *src, *dst; - buffer = Z_Malloc(width*height*4 + 18); + buffer = ri.Malloc(width*height*4 + 18); Com_Memset (buffer, 0, 18); buffer[2] = 2; // uncompressed type buffer[12] = width&255; @@ -168,78 +166,85 @@ void WriteTGA (char *filename, byte *data, int width, int height) { buffer[i+3] = data[i-18+3]; // alpha } + // flip upside down + flip = (unsigned char *)ri.Malloc(width*4); + for(row = 0; row < height/2; row++) + { + src = buffer + 18 + row * 4 * width; + dst = buffer + 18 + (height - row - 1) * 4 * width; + + Com_Memcpy(flip, src, width*4); + Com_Memcpy(src, dst, width*4); + Com_Memcpy(dst, flip, width*4); + } + ri.Free(flip); + ri.FS_WriteFile(filename, buffer, c); //f = fopen (filename, "wb"); //fwrite (buffer, 1, c, f); //fclose (f); - Z_Free (buffer); + ri.Free (buffer); } static glyphInfo_t *RE_ConstructGlyphInfo(unsigned char *imageOut, int *xOut, int *yOut, int *maxHeight, FT_Face face, const unsigned char c, qboolean calcHeight) { - int i; - static glyphInfo_t glyph; - unsigned char *src, *dst; - float scaled_width, scaled_height; - FT_Bitmap *bitmap = NULL; + int i; + static glyphInfo_t glyph; + unsigned char *src, *dst; + float scaled_width, scaled_height; + FT_Bitmap *bitmap = NULL; - Com_Memset(&glyph, 0, sizeof(glyphInfo_t)); - // make sure everything is here - if (face != NULL) { - FT_Load_Glyph(face, FT_Get_Char_Index( face, c), FT_LOAD_DEFAULT ); - bitmap = R_RenderGlyph(face->glyph, &glyph); - if (bitmap) { - glyph.xSkip = (face->glyph->metrics.horiAdvance >> 6) + 1; - } else { - return &glyph; - } + Com_Memset(&glyph, 0, sizeof(glyphInfo_t)); + // make sure everything is here + if (face != NULL) { + FT_Load_Glyph(face, FT_Get_Char_Index( face, c), FT_LOAD_DEFAULT ); + bitmap = R_RenderGlyph(face->glyph, &glyph); + if (bitmap) { + glyph.xSkip = (face->glyph->metrics.horiAdvance >> 6) + 1; + } else { + return &glyph; + } - if (glyph.height > *maxHeight) { - *maxHeight = glyph.height; - } + if (glyph.height > *maxHeight) { + *maxHeight = glyph.height; + } - if (calcHeight) { - Z_Free(bitmap->buffer); - Z_Free(bitmap); - return &glyph; - } + if (calcHeight) { + ri.Free(bitmap->buffer); + ri.Free(bitmap); + return &glyph; + } /* - // need to convert to power of 2 sizes so we do not get - // any scaling from the gl upload - for (scaled_width = 1 ; scaled_width < glyph.pitch ; scaled_width<<=1) - ; - for (scaled_height = 1 ; scaled_height < glyph.height ; scaled_height<<=1) - ; + // need to convert to power of 2 sizes so we do not get + // any scaling from the gl upload + for (scaled_width = 1 ; scaled_width < glyph.pitch ; scaled_width<<=1) + ; + for (scaled_height = 1 ; scaled_height < glyph.height ; scaled_height<<=1) + ; */ - scaled_width = glyph.pitch; - scaled_height = glyph.height; + scaled_width = glyph.pitch; + scaled_height = glyph.height; - // we need to make sure we fit - if (*xOut + scaled_width + 1 >= 255) { - if (*yOut + *maxHeight + 1 >= 255) { - *yOut = -1; - *xOut = -1; - Z_Free(bitmap->buffer); - Z_Free(bitmap); - return &glyph; - } else { - *xOut = 0; - *yOut += *maxHeight + 1; - } - } else if (*yOut + *maxHeight + 1 >= 255) { - *yOut = -1; - *xOut = -1; - Z_Free(bitmap->buffer); - Z_Free(bitmap); - return &glyph; - } + // we need to make sure we fit + if (*xOut + scaled_width + 1 >= 255) { + *xOut = 0; + *yOut += *maxHeight + 1; + } + + if (*yOut + *maxHeight + 1 >= 255) { + *yOut = -1; + *xOut = -1; + ri.Free(bitmap->buffer); + ri.Free(bitmap); + return &glyph; + } - src = bitmap->buffer; - dst = imageOut + (*yOut * 256) + *xOut; + src = bitmap->buffer; + dst = imageOut + (*yOut * 256) + *xOut; if (bitmap->pixel_mode == ft_pixel_mode_mono) { for (i = 0; i < glyph.height; i++) { @@ -256,7 +261,7 @@ static glyphInfo_t *RE_ConstructGlyphInfo(unsigned char *imageOut, int *xOut, in *_dst = 0xff; } mask >>= 1; - + if ( mask == 0 ) { mask = 0x80; } @@ -265,33 +270,32 @@ static glyphInfo_t *RE_ConstructGlyphInfo(unsigned char *imageOut, int *xOut, in src += glyph.pitch; dst += 256; - } } else { - for (i = 0; i < glyph.height; i++) { - Com_Memcpy(dst, src, glyph.pitch); - src += glyph.pitch; + for (i = 0; i < glyph.height; i++) { + Com_Memcpy(dst, src, glyph.pitch); + src += glyph.pitch; dst += 256; - } + } } - // we now have an 8 bit per pixel grey scale bitmap - // that is width wide and pf->ftSize->metrics.y_ppem tall + // we now have an 8 bit per pixel grey scale bitmap + // that is width wide and pf->ftSize->metrics.y_ppem tall - glyph.imageHeight = scaled_height; - glyph.imageWidth = scaled_width; - glyph.s = (float)*xOut / 256; - glyph.t = (float)*yOut / 256; - glyph.s2 = glyph.s + (float)scaled_width / 256; - glyph.t2 = glyph.t + (float)scaled_height / 256; + glyph.imageHeight = scaled_height; + glyph.imageWidth = scaled_width; + glyph.s = (float)*xOut / 256; + glyph.t = (float)*yOut / 256; + glyph.s2 = glyph.s + (float)scaled_width / 256; + glyph.t2 = glyph.t + (float)scaled_height / 256; - *xOut += scaled_width + 1; - } + *xOut += scaled_width + 1; - Z_Free(bitmap->buffer); - Z_Free(bitmap); + ri.Free(bitmap->buffer); + ri.Free(bitmap); + } - return &glyph; + return &glyph; } #endif @@ -328,40 +332,37 @@ float readFloat( void ) { void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { #ifdef BUILD_FREETYPE - FT_Face face; - int j, k, xOut, yOut, lastStart, imageNumber; - int scaledSize, newSize, maxHeight, left, satLevels; - unsigned char *out, *imageBuff; - glyphInfo_t *glyph; - image_t *image; - qhandle_t h; + FT_Face face; + int j, k, xOut, yOut, lastStart, imageNumber; + int scaledSize, newSize, maxHeight, left; + unsigned char *out, *imageBuff; + glyphInfo_t *glyph; + image_t *image; + qhandle_t h; float max; + float dpi = 72; + float glyphScale; #endif - void *faceData; + void *faceData; int i, len; - char name[1024]; - float dpi = 72; // - float glyphScale = 72.0f / dpi; // change the scale to be relative to 1 based on 72 dpi ( so dpi of 144 means a scale of .5 ) + char name[1024]; - - if (!fontName) { - ri.Printf(PRINT_ALL, "RE_RegisterFont: called with empty name\n"); - return; - } + if (!fontName) { + ri.Printf(PRINT_ALL, "RE_RegisterFont: called with empty name\n"); + return; + } if (pointSize <= 0) { pointSize = 12; } - // we also need to adjust the scale based on point size relative to 48 points as the ui scaling is based on a 48 point font - glyphScale *= 48.0f / pointSize; // make sure the render thread is stopped R_SyncRenderThread(); - if (registeredFontCount >= MAX_FONTS) { - ri.Printf(PRINT_ALL, "RE_RegisterFont: Too many fonts registered already.\n"); - return; - } + if (registeredFontCount >= MAX_FONTS) { + ri.Printf(PRINT_WARNING, "RE_RegisterFont: Too many fonts registered already.\n"); + return; + } Com_sprintf(name, sizeof(name), "fonts/fontImage_%i.dat",pointSize); for (i = 0; i < registeredFontCount; i++) { @@ -389,8 +390,8 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { font->glyphs[i].s2 = readFloat(); font->glyphs[i].t2 = readFloat(); font->glyphs[i].glyph = readInt(); - Com_Memcpy(font->glyphs[i].shaderName, &fdFile[fdOffset], 32); - fdOffset += 32; + Q_strncpyz(font->glyphs[i].shaderName, (const char *)&fdFile[fdOffset], sizeof(font->glyphs[i].shaderName)); + fdOffset += sizeof(font->glyphs[i].shaderName); } font->glyphScale = readFloat(); Com_Memcpy(font->name, &fdFile[fdOffset], MAX_QPATH); @@ -400,128 +401,133 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { for (i = GLYPH_START; i < GLYPH_END; i++) { font->glyphs[i].glyph = RE_RegisterShaderNoMip(font->glyphs[i].shaderName); } - Com_Memcpy(®isteredFont[registeredFontCount++], font, sizeof(fontInfo_t)); + Com_Memcpy(®isteredFont[registeredFontCount++], font, sizeof(fontInfo_t)); return; } #ifndef BUILD_FREETYPE - ri.Printf(PRINT_ALL, "RE_RegisterFont: FreeType code not available\n"); + ri.Printf(PRINT_WARNING, "RE_RegisterFont: FreeType code not available\n"); #else - if (ftLibrary == NULL) { - ri.Printf(PRINT_ALL, "RE_RegisterFont: FreeType not initialized.\n"); - return; - } + if (ftLibrary == NULL) { + ri.Printf(PRINT_WARNING, "RE_RegisterFont: FreeType not initialized.\n"); + return; + } - len = ri.FS_ReadFile(fontName, &faceData); - if (len <= 0) { - ri.Printf(PRINT_ALL, "RE_RegisterFont: Unable to read font file\n"); - return; - } + len = ri.FS_ReadFile(fontName, &faceData); + if (len <= 0) { + ri.Printf(PRINT_WARNING, "RE_RegisterFont: Unable to read font file '%s'\n", fontName); + return; + } - // allocate on the stack first in case we fail - if (FT_New_Memory_Face( ftLibrary, faceData, len, 0, &face )) { - ri.Printf(PRINT_ALL, "RE_RegisterFont: FreeType2, unable to allocate new face.\n"); - return; - } + // allocate on the stack first in case we fail + if (FT_New_Memory_Face( ftLibrary, faceData, len, 0, &face )) { + ri.Printf(PRINT_WARNING, "RE_RegisterFont: FreeType, unable to allocate new face.\n"); + return; + } - if (FT_Set_Char_Size( face, pointSize << 6, pointSize << 6, dpi, dpi)) { - ri.Printf(PRINT_ALL, "RE_RegisterFont: FreeType2, Unable to set face char size.\n"); - return; - } + if (FT_Set_Char_Size( face, pointSize << 6, pointSize << 6, dpi, dpi)) { + ri.Printf(PRINT_WARNING, "RE_RegisterFont: FreeType, unable to set face char size.\n"); + return; + } - //*font = ®isteredFonts[registeredFontCount++]; + //*font = ®isteredFonts[registeredFontCount++]; - // make a 256x256 image buffer, once it is full, register it, clean it and keep going - // until all glyphs are rendered + // make a 256x256 image buffer, once it is full, register it, clean it and keep going + // until all glyphs are rendered - out = Z_Malloc(1024*1024); - if (out == NULL) { - ri.Printf(PRINT_ALL, "RE_RegisterFont: Z_Malloc failure during output image creation.\n"); - return; - } - Com_Memset(out, 0, 1024*1024); + out = ri.Malloc(1024*1024); + if (out == NULL) { + ri.Printf(PRINT_WARNING, "RE_RegisterFont: ri.Malloc failure during output image creation.\n"); + return; + } + Com_Memset(out, 0, 1024*1024); - maxHeight = 0; + maxHeight = 0; - for (i = GLYPH_START; i < GLYPH_END; i++) { - glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue); - } + for (i = GLYPH_START; i < GLYPH_END; i++) { + RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue); + } - xOut = 0; - yOut = 0; - i = GLYPH_START; - lastStart = i; - imageNumber = 0; + xOut = 0; + yOut = 0; + i = GLYPH_START; + lastStart = i; + imageNumber = 0; - while ( i <= GLYPH_END ) { + while ( i <= GLYPH_END ) { - glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qfalse); + glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qfalse); - if (xOut == -1 || yOut == -1 || i == GLYPH_END) { - // ran out of room - // we need to create an image from the bitmap, set all the handles in the glyphs to this point - // + if (xOut == -1 || yOut == -1 || i == GLYPH_END) { + // ran out of room + // we need to create an image from the bitmap, set all the handles in the glyphs to this point + // - scaledSize = 256*256; - newSize = scaledSize * 4; - imageBuff = Z_Malloc(newSize); - left = 0; - max = 0; - satLevels = 255; - for ( k = 0; k < (scaledSize) ; k++ ) { - if (max < out[k]) { - max = out[k]; - } - } + scaledSize = 256*256; + newSize = scaledSize * 4; + imageBuff = ri.Malloc(newSize); + left = 0; + max = 0; + for ( k = 0; k < (scaledSize) ; k++ ) { + if (max < out[k]) { + max = out[k]; + } + } if (max > 0) { max = 255/max; } - for ( k = 0; k < (scaledSize) ; k++ ) { - imageBuff[left++] = 255; - imageBuff[left++] = 255; - imageBuff[left++] = 255; + for ( k = 0; k < (scaledSize) ; k++ ) { + imageBuff[left++] = 255; + imageBuff[left++] = 255; + imageBuff[left++] = 255; - imageBuff[left++] = ((float)out[k] * max); - } + imageBuff[left++] = ((float)out[k] * max); + } Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i.tga", imageNumber++, pointSize); if (r_saveFontData->integer) { - WriteTGA(name, imageBuff, 256, 256); + WriteTGA(name, imageBuff, 256, 256); } - //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize); - image = R_CreateImage(name, imageBuff, 256, 256, qfalse, qfalse, GL_CLAMP_TO_EDGE); - h = RE_RegisterShaderFromImage(name, LIGHTMAP_2D, image, qfalse); - for (j = lastStart; j < i; j++) { - font->glyphs[j].glyph = h; + //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize); + image = R_CreateImage(name, imageBuff, 256, 256, qfalse, qfalse, GL_CLAMP_TO_EDGE); + h = RE_RegisterShaderFromImage(name, LIGHTMAP_2D, image, qfalse); + for (j = lastStart; j < i; j++) { + font->glyphs[j].glyph = h; Q_strncpyz(font->glyphs[j].shaderName, name, sizeof(font->glyphs[j].shaderName)); - } - lastStart = i; - Com_Memset(out, 0, 1024*1024); - xOut = 0; - yOut = 0; - Z_Free(imageBuff); + } + lastStart = i; + Com_Memset(out, 0, 1024*1024); + xOut = 0; + yOut = 0; + ri.Free(imageBuff); i++; - } else { - Com_Memcpy(&font->glyphs[i], glyph, sizeof(glyphInfo_t)); - i++; - } - } + } else { + Com_Memcpy(&font->glyphs[i], glyph, sizeof(glyphInfo_t)); + i++; + } + } + + // change the scale to be relative to 1 based on 72 dpi ( so dpi of 144 means a scale of .5 ) + glyphScale = 72.0f / dpi; + + // we also need to adjust the scale based on point size relative to 48 points as the ui scaling is based on a 48 point font + glyphScale *= 48.0f / pointSize; registeredFont[registeredFontCount].glyphScale = glyphScale; font->glyphScale = glyphScale; - Com_Memcpy(®isteredFont[registeredFontCount++], font, sizeof(fontInfo_t)); + Com_Memcpy(®isteredFont[registeredFontCount++], font, sizeof(fontInfo_t)); - if (r_saveFontData->integer) { + if (r_saveFontData->integer) { ri.FS_WriteFile(va("fonts/fontImage_%i.dat", pointSize), font, sizeof(fontInfo_t)); } - Z_Free(out); - - ri.FS_FreeFile(faceData); + ri.Free(out); + + ri.FS_FreeFile(faceData); #endif } @@ -529,20 +535,20 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { void R_InitFreeType(void) { #ifdef BUILD_FREETYPE - if (FT_Init_FreeType( &ftLibrary )) { - ri.Printf(PRINT_ALL, "R_InitFreeType: Unable to initialize FreeType.\n"); - } + if (FT_Init_FreeType( &ftLibrary )) { + ri.Printf(PRINT_WARNING, "R_InitFreeType: Unable to initialize FreeType.\n"); + } #endif - registeredFontCount = 0; + registeredFontCount = 0; } void R_DoneFreeType(void) { #ifdef BUILD_FREETYPE - if (ftLibrary) { - FT_Done_FreeType( ftLibrary ); - ftLibrary = NULL; - } + if (ftLibrary) { + FT_Done_FreeType( ftLibrary ); + ftLibrary = NULL; + } #endif registeredFontCount = 0; } diff --git a/engine/code/renderer/tr_image_png.c b/engine/code/renderer/tr_image_png.c index 4dc9d9bb..b30c7fea 100644 --- a/engine/code/renderer/tr_image_png.c +++ b/engine/code/renderer/tr_image_png.c @@ -962,7 +962,7 @@ static qboolean UnfilterImage(uint8_t *DecompressedData, PixelLeft = DecompPtr; /* - * We only have a upleft pixel if we are on the second line or above. + * We only have an upleft pixel if we are on the second line or above. */ if(h > 0) @@ -2131,7 +2131,7 @@ void R_LoadPNG(const char *name, byte **pic, int *width, int *height) ChunkHeaderType = BigLong(CH->Type); /* - * Check if the chunk is an PLTE. + * Check if the chunk is a PLTE. */ if(!(ChunkHeaderType == PNG_ChunkType_PLTE)) @@ -2202,7 +2202,7 @@ void R_LoadPNG(const char *name, byte **pic, int *width, int *height) } /* - * transparency information is sometimes stored in an tRNS chunk + * transparency information is sometimes stored in a tRNS chunk */ /* @@ -2233,7 +2233,7 @@ void R_LoadPNG(const char *name, byte **pic, int *width, int *height) ChunkHeaderType = BigLong(CH->Type); /* - * Check if the chunk is an tRNS. + * Check if the chunk is a tRNS. */ if(!(ChunkHeaderType == PNG_ChunkType_tRNS)) diff --git a/engine/code/renderer/tr_init.c b/engine/code/renderer/tr_init.c index 2b239d87..df4b2ab4 100644 --- a/engine/code/renderer/tr_init.c +++ b/engine/code/renderer/tr_init.c @@ -32,6 +32,10 @@ glstate_t glState; static void GfxInfo_f( void ); +#ifdef USE_RENDERER_DLOPEN +cvar_t *com_altivec; +#endif + cvar_t *r_flareSize; cvar_t *r_flareFade; cvar_t *r_flareCoeff; @@ -210,9 +214,6 @@ static void InitOpenGL( void ) // init command buffers and SMP R_InitCommandBuffers(); - // print info - GfxInfo_f(); - // set default state GL_SetDefaultState(); } @@ -981,6 +982,10 @@ R_Register */ void R_Register( void ) { + #ifdef USE_RENDERER_DLOPEN + com_altivec = ri.Cvar_Get("com_altivec", "1", CVAR_ARCHIVE); + #endif + // // latched and archived variables // @@ -1231,6 +1236,8 @@ void R_Init( void ) { if ( err != GL_NO_ERROR ) ri.Printf (PRINT_ALL, "glGetError() = 0x%x\n", err); + // print info + GfxInfo_f(); ri.Printf( PRINT_ALL, "----- finished R_Init -----\n" ); } diff --git a/engine/code/renderer/tr_shader.c b/engine/code/renderer/tr_shader.c index 9bb64166..72fb5487 100644 --- a/engine/code/renderer/tr_shader.c +++ b/engine/code/renderer/tr_shader.c @@ -627,7 +627,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text ) else if ( !Q_stricmp( token, "$lightmap" ) ) { stage->bundle[0].isLightmap = qtrue; - if ( shader.lightmapIndex < 0 ) { + if ( shader.lightmapIndex < 0 || !tr.lightmaps ) { stage->bundle[0].image[0] = tr.whiteImage; } else { stage->bundle[0].image[0] = tr.lightmaps[shader.lightmapIndex]; @@ -1940,7 +1940,7 @@ static void FixRenderCommandList( int newShader ) { SortNewShader Positions the most recently created shader in the tr.sortedShaders[] -array so that the shader->sort key is sorted reletive to the other +array so that the shader->sort key is sorted relative to the other shaders. Sets shader->sortedIndex diff --git a/engine/code/sdl/sdl_gamma.c b/engine/code/sdl/sdl_gamma.c index 906d0f4e..94aaf5ad 100644 --- a/engine/code/sdl/sdl_gamma.c +++ b/engine/code/sdl/sdl_gamma.c @@ -39,7 +39,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned Uint16 table[3][256]; int i, j; - if( !glConfig.deviceSupportsGamma || r_ignorehwgamma->integer ) + if( !glConfig.deviceSupportsGamma || r_ignorehwgamma->integer > 0 ) return; for (i = 0; i < 256; i++) diff --git a/engine/code/sdl/sdl_glimp.c b/engine/code/sdl/sdl_glimp.c index cbdbcefa..39b09a77 100644 --- a/engine/code/sdl/sdl_glimp.c +++ b/engine/code/sdl/sdl_glimp.c @@ -250,7 +250,25 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder) ri.Printf (PRINT_ALL, "...setting mode %d:", mode ); - if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect, mode ) ) + if (mode == -2) + { + // use desktop video resolution + if( videoInfo->current_h > 0 ) + { + glConfig.vidWidth = videoInfo->current_w; + glConfig.vidHeight = videoInfo->current_h; + } + else + { + glConfig.vidWidth = 640; + glConfig.vidHeight = 480; + ri.Printf( PRINT_ALL, + "Cannot determine display resolution, assuming 640x480\n" ); + } + + glConfig.windowAspect = (float)glConfig.vidWidth / (float)glConfig.vidHeight; + } + else if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect, mode ) ) { ri.Printf( PRINT_ALL, " invalid mode\n" ); return RSERR_INVALID_MODE; @@ -733,6 +751,12 @@ success: // http://bugzilla.icculus.org/show_bug.cgi?id=4316 glConfig.deviceSupportsGamma = SDL_SetGamma( 1.0f, 1.0f, 1.0f ) >= 0; + if ( -1 == r_ignorehwgamma->integer) + glConfig.deviceSupportsGamma = 1; + + if ( 1 == r_ignorehwgamma->integer) + glConfig.deviceSupportsGamma = 0; + // get our config strings Q_strncpyz( glConfig.vendor_string, (char *) qglGetString (GL_VENDOR), sizeof( glConfig.vendor_string ) ); Q_strncpyz( glConfig.renderer_string, (char *) qglGetString (GL_RENDERER), sizeof( glConfig.renderer_string ) ); diff --git a/engine/code/sdl/sdl_input.c b/engine/code/sdl/sdl_input.c index 214b0e1d..90500bd0 100644 --- a/engine/code/sdl/sdl_input.c +++ b/engine/code/sdl/sdl_input.c @@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include -#include "../renderer/tr_local.h" #include "../client/client.h" #include "../sys/sys_local.h" @@ -561,7 +560,7 @@ struct { qboolean buttons[16]; // !!! FIXME: these might be too many. unsigned int oldaxes; - int oldaaxes[16]; + int oldaaxes[MAX_JOYSTICK_AXIS]; unsigned int oldhats; } stick_state; @@ -808,13 +807,12 @@ static void IN_JoyMove( void ) total = SDL_JoystickNumAxes(stick); if (total > 0) { - if (total > 16) total = 16; - for (i = 0; i < total; i++) + if (in_joystickUseAnalog->integer) { - Sint16 axis = SDL_JoystickGetAxis(stick, i); - - if (in_joystickUseAnalog->integer) + if (total > MAX_JOYSTICK_AXIS) total = MAX_JOYSTICK_AXIS; + for (i = 0; i < total; i++) { + Sint16 axis = SDL_JoystickGetAxis(stick, i); float f = ( (float) abs(axis) ) / 32767.0f; if( f < in_joystickThreshold->value ) axis = 0; @@ -825,8 +823,13 @@ static void IN_JoyMove( void ) stick_state.oldaaxes[i] = axis; } } - else + } + else + { + if (total > 16) total = 16; + for (i = 0; i < total; i++) { + Sint16 axis = SDL_JoystickGetAxis(stick, i); float f = ( (float) axis ) / 32767.0f; if( f < -in_joystickThreshold->value ) { axes |= ( 1 << ( i * 2 ) ); @@ -972,7 +975,7 @@ void IN_Frame( void ) IN_ProcessEvents( ); // If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading - loading = !!( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE ); + loading = ( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE ); if( !Cvar_VariableIntegerValue("r_fullscreen") && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) { diff --git a/engine/code/server/server.h b/engine/code/server/server.h index be749167..3fefb602 100644 --- a/engine/code/server/server.h +++ b/engine/code/server/server.h @@ -423,7 +423,7 @@ void SV_UnlinkEntity( sharedEntity_t *ent ); void SV_LinkEntity( sharedEntity_t *ent ); // Needs to be called any time an entity changes origin, mins, maxs, // or solid. Automatically unlinks if needed. -// sets ent->v.absmin and ent->v.absmax +// sets ent->r.absmin and ent->r.absmax // sets ent->leafnums[] for pvs determination even if the entity // is not solid diff --git a/engine/code/server/sv_ccmds.c b/engine/code/server/sv_ccmds.c index 3e17dfea..992b3317 100644 --- a/engine/code/server/sv_ccmds.c +++ b/engine/code/server/sv_ccmds.c @@ -361,7 +361,7 @@ static void SV_MapRestart_f( void ) { ================== SV_Kick_f -Kick a user off of the server FIXME: move to game +Kick a user off of the server ================== */ static void SV_Kick_f( void ) { @@ -408,7 +408,102 @@ static void SV_Kick_f( void ) { return; } if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) { - SV_SendServerCommand(NULL, "print \"%s\"", "Cannot kick host player\n"); + Com_Printf("Cannot kick host player\n"); + return; + } + + SV_DropClient( cl, "was kicked" ); + cl->lastPacketTime = svs.time; // in case there is a funny zombie +} + +/* +================== +SV_KickBots_f + +Kick all bots off of the server +================== +*/ +static void SV_KickBots_f( void ) { + client_t *cl; + int i; + + // make sure server is running + if( !com_sv_running->integer ) { + Com_Printf("Server is not running.\n"); + return; + } + + for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ ) { + if( !cl->state ) { + continue; + } + + if( cl->netchan.remoteAddress.type != NA_BOT ) { + continue; + } + + SV_DropClient( cl, "was kicked" ); + cl->lastPacketTime = svs.time; // in case there is a funny zombie + } +} +/* +================== +SV_KickAll_f + +Kick all users off of the server +================== +*/ +static void SV_KickAll_f( void ) { + client_t *cl; + int i; + + // make sure server is running + if( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } + + for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ ) { + if( !cl->state ) { + continue; + } + + if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) { + continue; + } + + SV_DropClient( cl, "was kicked" ); + cl->lastPacketTime = svs.time; // in case there is a funny zombie + } +} + +/* +================== +SV_KickNum_f + +Kick a user off of the server +================== +*/ +static void SV_KickNum_f( void ) { + client_t *cl; + + // make sure server is running + if ( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } + + if ( Cmd_Argc() != 2 ) { + Com_Printf ("Usage: %s \n", Cmd_Argv(0)); + return; + } + + cl = SV_GetPlayerByNum(); + if ( !cl ) { + return; + } + if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) { + Com_Printf("Cannot kick host player\n"); return; } @@ -448,7 +543,7 @@ static void SV_Ban_f( void ) { } if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) { - SV_SendServerCommand(NULL, "print \"%s\"", "Cannot kick host player\n"); + Com_Printf("Cannot kick host player\n"); return; } @@ -502,7 +597,7 @@ static void SV_BanNum_f( void ) { return; } if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) { - SV_SendServerCommand(NULL, "print \"%s\"", "Cannot kick host player\n"); + Com_Printf("Cannot kick host player\n"); return; } @@ -1022,40 +1117,6 @@ static void SV_ExceptDel_f(void) SV_DelBanFromList(qtrue); } -/* -================== -SV_KickNum_f - -Kick a user off of the server FIXME: move to game -================== -*/ -static void SV_KickNum_f( void ) { - client_t *cl; - - // make sure server is running - if ( !com_sv_running->integer ) { - Com_Printf( "Server is not running.\n" ); - return; - } - - if ( Cmd_Argc() != 2 ) { - Com_Printf ("Usage: kicknum \n"); - return; - } - - cl = SV_GetPlayerByNum(); - if ( !cl ) { - return; - } - if( cl->netchan.remoteAddress.type == NA_LOOPBACK ) { - SV_SendServerCommand(NULL, "print \"%s\"", "Cannot kick host player\n"); - return; - } - - SV_DropClient( cl, "was kicked" ); - cl->lastPacketTime = svs.time; // in case there is a funny zombie -} - /* ================ SV_Status_f @@ -1164,6 +1225,45 @@ static void SV_ConSay_f(void) { SV_SendServerCommand(NULL, "chat \"%s\"", text); } +/* +================== +SV_ConTell_f +================== +*/ +static void SV_ConTell_f(void) { + char *p; + char text[1024]; + client_t *cl; + + // make sure server is running + if ( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } + + if ( Cmd_Argc() < 3 ) { + Com_Printf ("Usage: tell \n"); + return; + } + + cl = SV_GetPlayerByNum(); + if ( !cl ) { + return; + } + + strcpy (text, "console_tell: "); + p = Cmd_ArgsFrom(2); + + if ( *p == '"' ) { + p++; + p[strlen(p)-1] = 0; + } + + strcat(text, p); + + SV_SendServerCommand(cl, "chat \"%s\"", text); +} + /* ================== @@ -1207,7 +1307,7 @@ static void SV_Systeminfo_f( void ) { =========== SV_DumpUser_f -Examine all a users info strings FIXME: move to game +Examine all a users info strings =========== */ static void SV_DumpUser_f( void ) { @@ -1279,7 +1379,10 @@ void SV_AddOperatorCommands( void ) { Cmd_AddCommand ("banClient", SV_BanNum_f); } #endif - Cmd_AddCommand ("clientkick", SV_KickNum_f); + Cmd_AddCommand ("kickbots", SV_KickBots_f); + Cmd_AddCommand ("kickall", SV_KickAll_f); + Cmd_AddCommand ("kicknum", SV_KickNum_f); + Cmd_AddCommand ("clientkick", SV_KickNum_f); // Legacy command Cmd_AddCommand ("status", SV_Status_f); Cmd_AddCommand ("serverinfo", SV_Serverinfo_f); Cmd_AddCommand ("systeminfo", SV_Systeminfo_f); @@ -1299,6 +1402,7 @@ void SV_AddOperatorCommands( void ) { Cmd_AddCommand ("killserver", SV_KillServer_f); if( com_dedicated->integer ) { Cmd_AddCommand ("say", SV_ConSay_f); + Cmd_AddCommand ("tell", SV_ConTell_f); } Cmd_AddCommand("rehashbans", SV_RehashBans_f); @@ -1320,6 +1424,10 @@ void SV_RemoveOperatorCommands( void ) { // removing these won't let the server start again Cmd_RemoveCommand ("heartbeat"); Cmd_RemoveCommand ("kick"); + Cmd_RemoveCommand ("kicknum"); + Cmd_RemoveCommand ("clientkick"); + Cmd_RemoveCommand ("kickall"); + Cmd_RemoveCommand ("kickbots"); Cmd_RemoveCommand ("banUser"); Cmd_RemoveCommand ("banClient"); Cmd_RemoveCommand ("status"); diff --git a/engine/code/server/sv_client.c b/engine/code/server/sv_client.c index 0326782b..35b434c0 100644 --- a/engine/code/server/sv_client.c +++ b/engine/code/server/sv_client.c @@ -999,7 +999,7 @@ int SV_WriteDownloadToClient(client_t *cl, msg_t *msg) else if ( !(sv_allowDownload->integer & DLF_ENABLE) || (sv_allowDownload->integer & DLF_NO_UDP) ) { - Com_Printf("clientDownload: %d : \"%s\" download disabled", (int) (cl - svs.clients), cl->downloadName); + Com_Printf("clientDownload: %d : \"%s\" download disabled\n", (int) (cl - svs.clients), cl->downloadName); if (sv_pure->integer) { Com_sprintf(errorMessage, sizeof(errorMessage), "Could not download \"%s\" because autodownloading is disabled on the server.\n\n" "You will need to get this file elsewhere before you " diff --git a/engine/code/server/sv_init.c b/engine/code/server/sv_init.c index 1af715ef..11efd6c2 100644 --- a/engine/code/server/sv_init.c +++ b/engine/code/server/sv_init.c @@ -682,7 +682,8 @@ void SV_Init (void) Cvar_Get ("sv_dlURL", "", CVAR_SERVERINFO | CVAR_ARCHIVE); sv_master[0] = Cvar_Get("sv_master1", MASTER_SERVER_NAME, 0); - for(index = 1; index < MAX_MASTER_SERVERS; index++) + sv_master[1] = Cvar_Get("sv_master2", "master.ioquake3.org", 0); + for(index = 2; index < MAX_MASTER_SERVERS; index++) sv_master[index] = Cvar_Get(va("sv_master%d", index + 1), "", CVAR_ARCHIVE); sv_reconnectlimit = Cvar_Get ("sv_reconnectlimit", "3", 0); diff --git a/engine/code/server/sv_main.c b/engine/code/server/sv_main.c index d7b88ed4..80ad316c 100644 --- a/engine/code/server/sv_main.c +++ b/engine/code/server/sv_main.c @@ -333,7 +333,7 @@ Informs all masters that this server is going down ================= */ void SV_MasterShutdown( void ) { - // send a hearbeat right now + // send a heartbeat right now svs.nextHeartbeatTime = -9999; SV_MasterHeartbeat(HEARTBEAT_FOR_MASTER); @@ -377,6 +377,7 @@ struct leakyBucket_s { static leakyBucket_t buckets[ MAX_BUCKETS ]; static leakyBucket_t *bucketHashes[ MAX_HASHES ]; +static leakyBucket_t outboundLeakyBucket; /* ================ @@ -549,10 +550,9 @@ static void SVC_Status( netadr_t from ) { int statusLength; int playerLength; char infostring[MAX_INFO_STRING]; - static leakyBucket_t bucket; // ignore if we are in single player - if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER ) { + if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive")) { return; } @@ -565,7 +565,7 @@ static void SVC_Status( netadr_t from ) { // Allow getstatus to be DoSed relatively easily, but prevent // excess outbound bandwidth usage when being flooded inbound - if ( SVC_RateLimit( &bucket, 10, 100 ) ) { + if ( SVC_RateLimit( &outboundLeakyBucket, 10, 100 ) ) { Com_DPrintf( "SVC_Status: rate limit exceeded, dropping request\n" ); return; } @@ -615,6 +615,20 @@ void SVC_Info( netadr_t from ) { return; } + // Prevent using getinfo as an amplifier + if ( SVC_RateLimitAddress( from, 10, 1000 ) ) { + Com_DPrintf( "SVC_Info: rate limit from %s exceeded, dropping request\n", + NET_AdrToString( from ) ); + return; + } + + // Allow getinfo to be DoSed relatively easily, but prevent + // excess outbound bandwidth usage when being flooded inbound + if ( SVC_RateLimit( &outboundLeakyBucket, 10, 100 ) ) { + Com_DPrintf( "SVC_Info: rate limit exceeded, dropping request\n" ); + return; + } + /* * Check whether Cmd_Argv(1) has a sane length. This was not done in the original Quake3 version which led * to the Infostring bug discovered by Luigi Auriemma. See http://aluigi.altervista.org/ for the advisory. diff --git a/engine/code/server/sv_rankings.c b/engine/code/server/sv_rankings.c index 6ca9d5b4..9eb2e9b2 100644 --- a/engine/code/server/sv_rankings.c +++ b/engine/code/server/sv_rankings.c @@ -1004,7 +1004,7 @@ static void SV_RankNewGameCBF( GR_NEWGAME* gr_newgame, void* cbf_arg ) } else if( gr_newgame->status == GR_STATUS_BADLEAGUE ) { - SV_RankError( "SV_RankNewGameCBF: Invalid League name\n" ); + SV_RankError( "SV_RankNewGameCBF: Invalid League name" ); } else { diff --git a/engine/code/sys/con_tty.c b/engine/code/sys/con_tty.c index 5feb70b2..9a6ee95c 100644 --- a/engine/code/sys/con_tty.c +++ b/engine/code/sys/con_tty.c @@ -24,6 +24,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "../qcommon/qcommon.h" #include "sys_local.h" +#ifndef DEDICATED +#include "../client/client.h" +#endif + #include #include #include @@ -45,6 +49,7 @@ static qboolean stdin_active; // general flag to tell about tty console mode static qboolean ttycon_on = qfalse; static int ttycon_hide = 0; +static int ttycon_show_overdue = 0; // some key codes that the terminal may be using, initialised on start up static int TTY_erase; @@ -60,6 +65,14 @@ static field_t TTY_con; static field_t ttyEditLines[ CON_HISTORY ]; static int hist_current = -1, hist_count = 0; +#ifndef DEDICATED +// Don't use "]" as it would be the same as in-game console, +// this makes it clear where input came from. +#define TTY_CONSOLE_PROMPT "tty]" +#else +#define TTY_CONSOLE_PROMPT "]" +#endif + /* ================== CON_FlushIn @@ -123,7 +136,10 @@ static void CON_Hide( void ) CON_Back(); } } - CON_Back(); // Delete "]" + // Delete prompt + for (i = strlen(TTY_CONSOLE_PROMPT); i > 0; i--) { + CON_Back(); + } ttycon_hide++; } } @@ -147,7 +163,7 @@ static void CON_Show( void ) if (ttycon_hide == 0) { size_t UNUSED_VAR size; - size = write(STDOUT_FILENO, "]", 1); + size = write(STDOUT_FILENO, TTY_CONSOLE_PROMPT, strlen(TTY_CONSOLE_PROMPT)); if (TTY_con.cursor) { for (i=0; icursor) + return; + assert(hist_count <= CON_HISTORY); assert(hist_count >= 0); assert(hist_current >= -1); @@ -301,8 +322,7 @@ void CON_Init( void ) characters EOF, EOL, EOL2, ERASE, KILL, REPRINT, STATUS, and WERASE, and buffers by lines. ISIG: when any of the characters INTR, QUIT, SUSP, or - DSUSP are received, generate the corresponding sig­ - nal + DSUSP are received, generate the corresponding signal */ tc.c_lflag &= ~(ECHO | ICANON); @@ -315,6 +335,8 @@ void CON_Init( void ) tc.c_cc[VTIME] = 0; tcsetattr (STDIN_FILENO, TCSADRAIN, &tc); ttycon_on = qtrue; + ttycon_hide = 1; // Mark as hidden, so prompt is shown in CON_Show + CON_Show(); } /* @@ -354,13 +376,39 @@ char *CON_Input( void ) { if (key == '\n') { +#ifndef DEDICATED + // if not in the game explicitly prepend a slash if needed + if (clc.state != CA_ACTIVE && TTY_con.cursor && + TTY_con.buffer[0] != '/' && TTY_con.buffer[0] != '\\') + { + memmove(TTY_con.buffer + 1, TTY_con.buffer, sizeof(TTY_con.buffer) - 1); + TTY_con.buffer[0] = '\\'; + TTY_con.cursor++; + } + + if (TTY_con.buffer[0] == '/' || TTY_con.buffer[0] == '\\') { + Q_strncpyz(text, TTY_con.buffer + 1, sizeof(text)); + } else if (TTY_con.cursor) { + Com_sprintf(text, sizeof(text), "cmd say %s", TTY_con.buffer); + } else { + text[0] = '\0'; + } + + // push it in history + Hist_Add(&TTY_con); + CON_Hide(); + Com_Printf("%s%s\n", TTY_CONSOLE_PROMPT, TTY_con.buffer); + Field_Clear(&TTY_con); + CON_Show(); +#else // push it in history Hist_Add(&TTY_con); Q_strncpyz(text, TTY_con.buffer, sizeof(text)); Field_Clear(&TTY_con); key = '\n'; size = write(STDOUT_FILENO, &key, 1); - size = write(STDOUT_FILENO, "]", 1); + size = write(STDOUT_FILENO, TTY_CONSOLE_PROMPT, strlen(TTY_CONSOLE_PROMPT)); +#endif return text; } if (key == '\t') @@ -422,7 +470,7 @@ char *CON_Input( void ) return NULL; // push regular character TTY_con.buffer[TTY_con.cursor] = key; - TTY_con.cursor++; + TTY_con.cursor++; // next char will always be '\0' // print the current line (this is differential) size = write(STDOUT_FILENO, &key, 1); } @@ -465,6 +513,9 @@ CON_Print */ void CON_Print( const char *msg ) { + if (!msg[0]) + return; + CON_Hide( ); if( com_ansiColor && com_ansiColor->integer ) @@ -472,5 +523,25 @@ void CON_Print( const char *msg ) else fputs( msg, stderr ); - CON_Show( ); + if (!ttycon_on) { + // CON_Hide didn't do anything. + return; + } + + // Only print prompt when msg ends with a newline, otherwise the console + // might get garbled when output does not fit on one line. + if (msg[strlen(msg) - 1] == '\n') { + CON_Show(); + + // Run CON_Show the number of times it was deferred. + while (ttycon_show_overdue > 0) { + CON_Show(); + ttycon_show_overdue--; + } + } + else + { + // Defer calling CON_Show + ttycon_show_overdue++; + } } diff --git a/engine/code/sys/sys_main.c b/engine/code/sys/sys_main.c index ed00b65d..40e8a9f6 100644 --- a/engine/code/sys/sys_main.c +++ b/engine/code/sys/sys_main.c @@ -140,7 +140,12 @@ Sys_PIDFileName */ static char *Sys_PIDFileName( void ) { - return va( "%s/%s", Sys_TempPath( ), PID_FILENAME ); + const char *homePath = Sys_DefaultHomePath( ); + + if( *homePath != '\0' ) + return va( "%s/%s", homePath, PID_FILENAME ); + + return NULL; } /* @@ -156,6 +161,9 @@ qboolean Sys_WritePIDFile( void ) FILE *f; qboolean stale = qfalse; + if( pidFile == NULL ) + return qfalse; + // First, check if the pid file is already there if( ( f = fopen( pidFile, "r" ) ) != NULL ) { @@ -204,7 +212,10 @@ static __attribute__ ((noreturn)) void Sys_Exit( int exitCode ) if( exitCode < 2 ) { // Normal exit - remove( Sys_PIDFileName( ) ); + char *pidFile = Sys_PIDFileName( ); + + if( pidFile != NULL ) + remove( pidFile ); } Sys_PlatformExit( ); diff --git a/engine/code/sys/sys_osx.m b/engine/code/sys/sys_osx.m index a26d8a28..30bf9322 100644 --- a/engine/code/sys/sys_osx.m +++ b/engine/code/sys/sys_osx.m @@ -34,28 +34,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #import #import -/* -================ -Sys_TempPath -================ -*/ -const char *Sys_TempPath( void ) -{ - static UInt8 posixPath[ MAX_OSPATH ]; - FSRef ref; - if( FSFindFolder( kOnAppropriateDisk, - kTemporaryFolderType, kCreateFolder, &ref ) == noErr ) - { - if( FSRefMakePath( &ref, posixPath, - sizeof( posixPath ) - 1 ) == noErr ) - { - return (const char *)posixPath; - } - } - - return "/tmp"; -} - /* ============== Sys_Dialog diff --git a/engine/code/sys/sys_unix.c b/engine/code/sys/sys_unix.c index e88465d8..508383dd 100644 --- a/engine/code/sys/sys_unix.c +++ b/engine/code/sys/sys_unix.c @@ -53,7 +53,7 @@ char *Sys_DefaultHomePath(void) { char *p; - if( !*homePath ) + if( !*homePath && com_homepath != NULL ) { if( ( p = getenv( "HOME" ) ) != NULL ) { @@ -78,23 +78,6 @@ char *Sys_DefaultHomePath(void) return homePath; } -#ifndef MACOS_X -/* -================ -Sys_TempPath -================ -*/ -const char *Sys_TempPath( void ) -{ - const char *TMPDIR = getenv( "TMPDIR" ); - - if( TMPDIR == NULL || TMPDIR[ 0 ] == '\0' ) - return "/tmp"; - else - return TMPDIR; -} -#endif - /* ================ Sys_Milliseconds diff --git a/engine/code/sys/sys_win32.c b/engine/code/sys/sys_win32.c index 241fc927..47b2dae1 100644 --- a/engine/code/sys/sys_win32.c +++ b/engine/code/sys/sys_win32.c @@ -90,7 +90,7 @@ char *Sys_DefaultHomePath( void ) FARPROC qSHGetFolderPath; HMODULE shfolder = LoadLibrary("shfolder.dll"); - if( !*homePath ) + if(!*homePath && com_homepath) { if(shfolder == NULL) { @@ -127,24 +127,6 @@ char *Sys_DefaultHomePath( void ) return homePath; } -/* -================ -Sys_TempPath -================ -*/ -const char *Sys_TempPath( void ) -{ - static TCHAR path[ MAX_PATH ]; - DWORD length; - - length = GetTempPath( sizeof( path ), path ); - - if( length > sizeof( path ) || length == 0 ) - return Sys_DefaultHomePath( ); - else - return path; -} - /* ================ Sys_Milliseconds diff --git a/engine/code/tools/asm/q3asm.c b/engine/code/tools/asm/q3asm.c index 36e23018..331ba098 100644 --- a/engine/code/tools/asm/q3asm.c +++ b/engine/code/tools/asm/q3asm.c @@ -1622,7 +1622,7 @@ Motivation: not wanting to scrollback for pages to find asm error. } // In some case it Segfault without this check if ( numAsmFiles == 0 ) { - Error( "No file to assemble\n" ); + Error( "No file to assemble" ); } InitTables(); diff --git a/engine/code/tools/lcc/doc/4.html b/engine/code/tools/lcc/doc/4.html index c36f280b..0b4b36d2 100644 --- a/engine/code/tools/lcc/doc/4.html +++ b/engine/code/tools/lcc/doc/4.html @@ -99,7 +99,7 @@ the symbol's type field.

5.5 Dag Operators

-

The op field a of node structure holds a dag operator, which +

The op field of a node structure holds a dag operator, which consists of a generic operator, a type suffix, and a size indicator. The type suffixes are:

@@ -516,7 +516,7 @@ e.g.,

The type suffix for a conversion operator denotes the type of the result and the size indicator gives the size of the result. For example, CVUI4 converts an unsigned (U) to a 4-byte signed integer (I4). The syms[0] -field points to a symbol-table entry for a integer constant that gives the size of the +field points to a symbol-table entry for an integer constant that gives the size of the source operand. For example, if syms[0] in a CVUI4 points to a symbol-table entry for 2, the conversion widens a 2-byte unsigned integer to a 4-byte signed integer. Conversions that widen unsigned integers zero-extend; those that widen diff --git a/engine/code/tools/lcc/doc/install.html b/engine/code/tools/lcc/doc/install.html index 3cc59a8f..3410e8f1 100644 --- a/engine/code/tools/lcc/doc/install.html +++ b/engine/code/tools/lcc/doc/install.html @@ -722,7 +722,7 @@ C:\dist\lcc\4.1>copy %BUILDDIR%\bprint.exe \bin

Reporting Bugs

lcc is a large, complex program. We find and repair errors routinely. If you think that -you've found a error, follow the steps below, which are adapted from the instructions in +you've found an error, follow the steps below, which are adapted from the instructions in Chapter 1 of A Retargetable C Compiler: Design and Implementation.

    @@ -751,7 +751,7 @@ Chapter 1 of A Retargetable C Compiler: Design and Implementation. HREF="ftp://ftp.cs.princeton.edu/pub/lcc">pub/lcc. A README file there gives acquistion details, and the LOG file reports what errors - were fixed and when they were fixed. If you report a error that's been fixed, you might + were fixed and when they were fixed. If you report an error that's been fixed, you might get a canned reply.
  1. Send your program by electronic mail to lcc-bugs@cs.princeton.edu. Please send only valid C programs; put all remarks in C comments so that we can process reports diff --git a/engine/code/tools/lcc/src/list.c b/engine/code/tools/lcc/src/list.c index 29e660ab..9c3ec9f6 100644 --- a/engine/code/tools/lcc/src/list.c +++ b/engine/code/tools/lcc/src/list.c @@ -33,7 +33,7 @@ int length(List list) { return n; } -/* ltov - convert list to an NULL-terminated vector allocated in arena */ +/* ltov - convert list to a NULL-terminated vector allocated in arena */ void *ltov(List *list, unsigned arena) { int i = 0; void **array = newarray(length(*list) + 1, sizeof array[0], arena); diff --git a/engine/code/ui/ui_atoms.c b/engine/code/ui/ui_atoms.c index 6faa7931..16ce6f2f 100644 --- a/engine/code/ui/ui_atoms.c +++ b/engine/code/ui/ui_atoms.c @@ -37,7 +37,7 @@ void QDECL Com_Error( int level, const char *error, ... ) { Q_vsnprintf (text, sizeof(text), error, argptr); va_end (argptr); - trap_Error( va("%s", text) ); + trap_Error( text ); } void QDECL Com_Printf( const char *msg, ... ) { @@ -48,7 +48,7 @@ void QDECL Com_Printf( const char *msg, ... ) { Q_vsnprintf (text, sizeof(text), msg, argptr); va_end (argptr); - trap_Print( va("%s", text) ); + trap_Print( text ); } qboolean newUI = qfalse; diff --git a/engine/code/ui/ui_gameinfo.c b/engine/code/ui/ui_gameinfo.c index b4c5cfff..557dee23 100644 --- a/engine/code/ui/ui_gameinfo.c +++ b/engine/code/ui/ui_gameinfo.c @@ -164,7 +164,7 @@ void UI_LoadArenas( void ) { } trap_Print( va( "%i arenas parsed\n", ui_numArenas ) ); if (UI_OutOfMemory()) { - trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n"); + trap_Print(S_COLOR_YELLOW"WARNING: not enough memory in pool to load all arenas\n"); } for( n = 0; n < ui_numArenas; n++ ) { diff --git a/engine/code/ui/ui_main.c b/engine/code/ui/ui_main.c index a8a4d869..7b8f0c8f 100644 --- a/engine/code/ui/ui_main.c +++ b/engine/code/ui/ui_main.c @@ -931,7 +931,7 @@ void UI_LoadMenus(const char *menuFile, qboolean reset) { Com_Printf( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ); handle = trap_PC_LoadSource( "ui/menus.txt" ); if (!handle) { - trap_Error( va( S_COLOR_RED "default menu file not found: ui/menus.txt, unable to continue!\n") ); + trap_Error( S_COLOR_RED "default menu file not found: ui/menus.txt, unable to continue!" ); } } @@ -3608,7 +3608,7 @@ static int UI_MapCountByGameType(qboolean singlePlayer) { } qboolean UI_hasSkinForBase(const char *base, const char *team) { - char test[1024]; + char test[MAX_QPATH]; Com_sprintf( test, sizeof( test ), "models/players/%s/%s/lower_default.skin", base, team ); @@ -4472,7 +4472,7 @@ static void UI_FeederSelection(float feederID, int index) { UI_SelectedHead(index, &actual); index = actual; if (index >= 0 && index < uiInfo.characterCount) { - trap_Cvar_Set( "team_model", va("%s", uiInfo.characterList[index].base)); + trap_Cvar_Set( "team_model", uiInfo.characterList[index].base); trap_Cvar_Set( "team_headmodel", va("*%s", uiInfo.characterList[index].name)); updateModel = qtrue; } @@ -4639,11 +4639,11 @@ static qboolean Character_Parse(char **p) { uiInfo.characterList[uiInfo.characterCount].imageName = String_Alloc(va("models/players/heads/%s/icon_default.tga", uiInfo.characterList[uiInfo.characterCount].name)); if (tempStr && (!Q_stricmp(tempStr, "female"))) { - uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("Janet")); + uiInfo.characterList[uiInfo.characterCount].base = String_Alloc("Janet"); } else if (tempStr && (!Q_stricmp(tempStr, "male"))) { - uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("James")); + uiInfo.characterList[uiInfo.characterCount].base = String_Alloc("James"); } else { - uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("%s",tempStr)); + uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(tempStr); } Com_Printf("Loaded %s character %s.\n", uiInfo.characterList[uiInfo.characterCount].base, uiInfo.characterList[uiInfo.characterCount].name); @@ -5108,7 +5108,6 @@ void _UI_Init( qboolean inGameLoad ) { uiInfo.uiDC.drawSides = &_UI_DrawSides; uiInfo.uiDC.drawTopBottom = &_UI_DrawTopBottom; uiInfo.uiDC.clearScene = &trap_R_ClearScene; - uiInfo.uiDC.drawSides = &_UI_DrawSides; uiInfo.uiDC.addRefEntityToScene = &trap_R_AddRefEntityToScene; uiInfo.uiDC.renderScene = &trap_R_RenderScene; uiInfo.uiDC.registerFont = &trap_R_RegisterFont; @@ -5555,7 +5554,7 @@ void UI_DrawConnectScreen( qboolean overlay ) { } if (!Q_stricmp(cstate.servername,"localhost")) { - Text_PaintCenter(centerPoint, yStart + 48, scale, colorWhite, va("Starting up..."), ITEM_TEXTSTYLE_SHADOWEDMORE); + Text_PaintCenter(centerPoint, yStart + 48, scale, colorWhite, "Starting up...", ITEM_TEXTSTYLE_SHADOWEDMORE); } else { strcpy(text, va("Connecting to %s", cstate.servername)); Text_PaintCenter(centerPoint, yStart + 48, scale, colorWhite,text , ITEM_TEXTSTYLE_SHADOWEDMORE); diff --git a/engine/code/ui/ui_players.c b/engine/code/ui/ui_players.c index 0f11c5ae..e42fc893 100644 --- a/engine/code/ui/ui_players.c +++ b/engine/code/ui/ui_players.c @@ -972,7 +972,7 @@ UI_RegisterClientSkin ========================== */ static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName, const char *skinName, const char *headModelName, const char *headSkinName , const char *teamName) { - char filename[MAX_QPATH*2]; + char filename[MAX_QPATH]; if (teamName && *teamName) { Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/lower_%s.skin", modelName, teamName, skinName ); diff --git a/engine/code/ui/ui_shared.c b/engine/code/ui/ui_shared.c index 15d8ac46..2ae36a31 100644 --- a/engine/code/ui/ui_shared.c +++ b/engine/code/ui/ui_shared.c @@ -345,7 +345,7 @@ qboolean PC_Float_Parse(int handle, float *f) { negative = qtrue; } if (token.type != TT_NUMBER) { - PC_SourceError(handle, "expected float but found %s\n", token.string); + PC_SourceError(handle, "expected float but found %s", token.string); return qfalse; } if (negative) @@ -425,7 +425,7 @@ qboolean PC_Int_Parse(int handle, int *i) { negative = qtrue; } if (token.type != TT_NUMBER) { - PC_SourceError(handle, "expected integer but found %s\n", token.string); + PC_SourceError(handle, "expected integer but found %s", token.string); return qfalse; } *i = token.intvalue; @@ -3831,7 +3831,8 @@ void Item_OwnerDraw_Paint(itemDef_t *item) { void Item_Paint(itemDef_t *item) { vec4_t red; - menuDef_t *parent = (menuDef_t*)item->parent; + menuDef_t *parent; + red[0] = red[3] = 1; red[1] = red[2] = 0; @@ -3839,6 +3840,8 @@ void Item_Paint(itemDef_t *item) { return; } + parent = (menuDef_t*)item->parent; + if (item->window.flags & WINDOW_ORBITING) { if (DC->realTime > item->window.nextTime) { float rx, ry, a, c, s, w, h; @@ -4908,7 +4911,7 @@ qboolean ItemParse_cvarStrList( itemDef_t *item, int handle ) { pass = 0; while ( 1 ) { if (!trap_PC_ReadToken(handle, &token)) { - PC_SourceError(handle, "end of file inside menu item\n"); + PC_SourceError(handle, "end of file inside menu item"); return qfalse; } @@ -4955,7 +4958,7 @@ qboolean ItemParse_cvarFloatList( itemDef_t *item, int handle ) { while ( 1 ) { if (!trap_PC_ReadToken(handle, &token)) { - PC_SourceError(handle, "end of file inside menu item\n"); + PC_SourceError(handle, "end of file inside menu item"); return qfalse; } @@ -5139,7 +5142,7 @@ qboolean Item_Parse(int handle, itemDef_t *item) { } while ( 1 ) { if (!trap_PC_ReadToken(handle, &token)) { - PC_SourceError(handle, "end of file inside menu item\n"); + PC_SourceError(handle, "end of file inside menu item"); return qfalse; } @@ -5549,7 +5552,7 @@ qboolean Menu_Parse(int handle, menuDef_t *menu) { memset(&token, 0, sizeof(pc_token_t)); if (!trap_PC_ReadToken(handle, &token)) { - PC_SourceError(handle, "end of file inside menu\n"); + PC_SourceError(handle, "end of file inside menu"); return qfalse; } diff --git a/engine/code/ui/ui_syscalls.c b/engine/code/ui/ui_syscalls.c index d1488ced..cb4b853a 100644 --- a/engine/code/ui/ui_syscalls.c +++ b/engine/code/ui/ui_syscalls.c @@ -47,6 +47,7 @@ void trap_Print( const char *string ) { void trap_Error(const char *string) { syscall(UI_ERROR, string); + // shut up GCC warning about returning functions, because we know better exit(1); } diff --git a/engine/cross-make-mingw.sh b/engine/cross-make-mingw.sh index e4b1b13e..619d9f71 100755 --- a/engine/cross-make-mingw.sh +++ b/engine/cross-make-mingw.sh @@ -1,22 +1,26 @@ #!/bin/sh +# Note: This works in Linux and cygwin + CMD_PREFIX="i586-mingw32msvc i686-w64-mingw32"; if [ "X$CC" = "X" ]; then for check in $CMD_PREFIX; do full_check="${check}-gcc" - if [ ! $(which "$full_check") = "" ]; then - export CC="$full_check" - fi + which "$full_check" > /dev/null 2>&1 + if [ "$?" = "0" ]; then + export CC="$full_check" + fi done fi if [ "X$WINDRES" = "X" ]; then for check in $CMD_PREFIX; do full_check="${check}-windres" - if [ ! $(which "$full_check") = "" ]; then - export WINDRES="$full_check" - fi + which "$full_check" > /dev/null 2>&1 + if [ "$?" = "0" ]; then + export WINDRES="$full_check" + fi done fi diff --git a/engine/cross-make-mingw64.sh b/engine/cross-make-mingw64.sh index d480c266..16c3d5da 100755 --- a/engine/cross-make-mingw64.sh +++ b/engine/cross-make-mingw64.sh @@ -1,22 +1,26 @@ #!/bin/sh +# Note: This works in Linux and cygwin + CMD_PREFIX="amd64-mingw32msvc x86_64-w64-mingw32"; if [ "X$CC" = "X" ]; then for check in $CMD_PREFIX; do full_check="${check}-gcc" - if [ ! $(which "$full_check") = "" ]; then - export CC="$full_check" - fi + which "$full_check" > /dev/null 2>&1 + if [ "$?" = "0" ]; then + export CC="$full_check" + fi done fi if [ "X$WINDRES" = "X" ]; then for check in $CMD_PREFIX; do full_check="${check}-windres" - if [ ! $(which "$full_check") = "" ]; then - export WINDRES="$full_check" - fi + which "$full_check" > /dev/null 2>&1 + if [ "$?" = "0" ]; then + export WINDRES="$full_check" + fi done fi diff --git a/engine/make-macosx-ub.sh b/engine/make-macosx-ub.sh index ade963be..c67549d4 100755 --- a/engine/make-macosx-ub.sh +++ b/engine/make-macosx-ub.sh @@ -108,13 +108,13 @@ NCPU=`sysctl -n hw.ncpu` if [ -d build/release-release-ppc ]; then rm -r build/release-darwin-ppc fi -(ARCH=ppc CFLAGS=$PPC_CFLAGS LDFLAGS=$PPC_LDFLAGS make -j$NCPU) || exit 1; +(ARCH=ppc CC=gcc-4.0 CFLAGS=$PPC_CFLAGS LDFLAGS=$PPC_LDFLAGS make -j$NCPU) || exit 1; # intel client and server if [ -d build/release-darwin-i386 ]; then rm -r build/release-darwin-i386 fi -(ARCH=i386 CFLAGS=$X86_CFLAGS LDFLAGS=$X86_LDFLAGS make -j$NCPU) || exit 1; +(ARCH=i386 CC=gcc-4.0 CFLAGS=$X86_CFLAGS LDFLAGS=$X86_LDFLAGS make -j$NCPU) || exit 1; echo "Creating .app bundle $DESTDIR/$APPBUNDLE" if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then diff --git a/engine/make-macosx.sh b/engine/make-macosx.sh index c3ed5347..c4958d11 100755 --- a/engine/make-macosx.sh +++ b/engine/make-macosx.sh @@ -1,4 +1,5 @@ #!/bin/sh +CC=gcc-4.0 APPBUNDLE=ioquake3.app BINARY=ioquake3.x86_64 DEDBIN=ioq3ded.x86_64 diff --git a/engine/misc/nsis/Makefile b/engine/misc/nsis/Makefile index 96ef8699..b0d8b86d 100644 --- a/engine/misc/nsis/Makefile +++ b/engine/misc/nsis/Makefile @@ -28,13 +28,8 @@ endif ifndef USE_INTERNAL_JPEG USE_INTERNAL_JPEG=1 endif - -ifeq ($(ARCH),x64) - SDLDLL=SDL64.dll -else - SDLDLL=SDL.dll -endif +SDLDLL=SDL.dll DEFINES= ifeq ($(USE_RENDERER_DLOPEN),1)