diff --git a/engine/Makefile b/engine/Makefile index 609f10d0..e0952fef 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -44,7 +44,7 @@ ifndef BUILD_DEFINES endif # ioquake3 svn version that this is based on -IOQ3_REVISION = 6893 +IOQ3_REVISION = 6920 ############################################################################# # @@ -271,6 +271,7 @@ VORBISDIR=$(MOUNT_DIR)/libvorbis-1.3.6 OPUSDIR=$(MOUNT_DIR)/opus-1.2.1 OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.9 ZDIR=$(MOUNT_DIR)/zlib +TOOLSDIR=$(MOUNT_DIR)/tools Q3ASMDIR=$(MOUNT_DIR)/tools/asm LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg Q3CPPDIR=$(MOUNT_DIR)/tools/lcc/cpp @@ -655,7 +656,19 @@ ifdef MINGW ifeq ($(COMPILE_PLATFORM),cygwin) TOOLS_BINEXT=.exe - TOOLS_CC=$(CC) + + # Under cygwin the default of using gcc for TOOLS_CC won't work, so + # we need to figure out the appropriate compiler to use, based on the + # host architecture that we're running under (as tools run on the host) + ifeq ($(COMPILE_ARCH),x86_64) + TOOLS_MINGW_PREFIXES=x86_64-w64-mingw32 amd64-mingw32msvc + endif + ifeq ($(COMPILE_ARCH),x86) + TOOLS_MINGW_PREFIXES=i686-w64-mingw32 i586-mingw32msvc i686-pc-mingw32 + endif + + TOOLS_CC=$(firstword $(strip $(foreach TOOLS_MINGW_PREFIX, $(TOOLS_MINGW_PREFIXES), \ + $(call bin_path, $(TOOLS_MINGW_PREFIX)-gcc)))) endif LIBS= -lws2_32 -lwinmm -lpsapi @@ -1253,9 +1266,7 @@ endef define DO_REF_STR $(echo_cmd) "REF_STR $<" $(Q)rm -f $@ -$(Q)echo "const char *fallbackShader_$(notdir $(basename $<)) =" >> $@ -$(Q)cat $< | sed -e 's/^/\"/;s/$$/\\n\"/' | tr -d '\r' >> $@ -$(Q)echo ";" >> $@ +$(Q)$(STRINGIFY) $< $@ endef define DO_BOT_CC @@ -1424,6 +1435,9 @@ endif @echo " SERVER_CFLAGS:" $(call print_wrapped, $(SERVER_CFLAGS)) @echo "" + @echo " TOOLS_CFLAGS:" + $(call print_wrapped, $(TOOLS_CFLAGS)) + @echo "" @echo " LDFLAGS:" $(call print_wrapped, $(LDFLAGS)) @echo "" @@ -1529,6 +1543,7 @@ Q3RCC = $(B)/tools/q3rcc$(TOOLS_BINEXT) Q3CPP = $(B)/tools/q3cpp$(TOOLS_BINEXT) Q3LCC = $(B)/tools/q3lcc$(TOOLS_BINEXT) Q3ASM = $(B)/tools/q3asm$(TOOLS_BINEXT) +STRINGIFY = $(B)/tools/stringify$(TOOLS_BINEXT) LBURGOBJ= \ $(B)/tools/lburg/lburg.o \ @@ -1622,6 +1637,10 @@ $(Q3LCC): $(Q3LCCOBJ) $(Q3RCC) $(Q3CPP) $(echo_cmd) "LD $@" $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $(Q3LCCOBJ) $(TOOLS_LIBS) +$(STRINGIFY): $(TOOLSDIR)/stringify.c + $(echo_cmd) "TOOLS_CC $@" + $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $(TOOLSDIR)/stringify.c $(TOOLS_LIBS) + define DO_Q3LCC $(echo_cmd) "Q3LCC $<" $(Q)$(Q3LCC) $(BASEGAME_CFLAGS) $(BUILD_DEFINES) -o $@ $< @@ -2795,7 +2814,7 @@ $(B)/renderergl1/%.o: $(RGL1DIR)/%.c $(B)/renderergl1/tr_altivec.o: $(RGL1DIR)/tr_altivec.c $(DO_REF_CC_ALTIVEC) -$(B)/renderergl2/glsl/%.c: $(RGL2DIR)/glsl/%.glsl +$(B)/renderergl2/glsl/%.c: $(RGL2DIR)/glsl/%.glsl $(STRINGIFY) $(DO_REF_STR) $(B)/renderergl2/glsl/%.o: $(B)/renderergl2/glsl/%.c @@ -3020,7 +3039,7 @@ toolsclean2: @echo "TOOLS_CLEAN $(B)" @rm -f $(TOOLSOBJ) @rm -f $(TOOLSOBJ_D_FILES) - @rm -f $(LBURG) $(DAGCHECK_C) $(Q3RCC) $(Q3CPP) $(Q3LCC) $(Q3ASM) + @rm -f $(LBURG) $(DAGCHECK_C) $(Q3RCC) $(Q3CPP) $(Q3LCC) $(Q3ASM) $(STRINGIFY) distclean: clean toolsclean @rm -rf $(BUILD_DIR) diff --git a/engine/code/asm/vm_x86_64.asm b/engine/code/asm/vm_x86_64.asm index 87e04f4d..f39289ec 100644 --- a/engine/code/asm/vm_x86_64.asm +++ b/engine/code/asm/vm_x86_64.asm @@ -30,9 +30,15 @@ ; uint8_t qvmcall64(int *programStack, int *opStack, intptr_t *instructionPointers, byte *dataBase); qvmcall64 PROC - push rsi ; push non-volatile registers to stack + push r12 ; push all non-volatile registers to stack + push r13 + push r14 + push r15 push rdi + push rsi push rbx + push rbp + ; need to save pointer in rcx so we can write back the programData value to caller push rcx @@ -48,9 +54,14 @@ qvmcall64 PROC mov dword ptr [rcx], esi ; write back the programStack value mov al, bl ; return opStack offset + pop rbp ; restore all non-volatile registers after the call pop rbx - pop rdi pop rsi + pop rdi + pop r15 + pop r14 + pop r13 + pop r12 ret qvmcall64 ENDP diff --git a/engine/code/game/ai_dmq3.c b/engine/code/game/ai_dmq3.c index ab954f25..bb293def 100644 --- a/engine/code/game/ai_dmq3.c +++ b/engine/code/game/ai_dmq3.c @@ -3815,7 +3815,7 @@ void BotMapScripts(bot_state_t *bs) { shootbutton = qfalse; break; } - else if (bs->enemy == i) { + else if (gametype < GT_CTF || bs->enemy == i) { shootbutton = qtrue; } } diff --git a/engine/code/renderergl1/tr_init.c b/engine/code/renderergl1/tr_init.c index 2539ffa7..776f35df 100644 --- a/engine/code/renderergl1/tr_init.c +++ b/engine/code/renderergl1/tr_init.c @@ -1081,7 +1081,7 @@ void R_Register( void ) r_dynamiclight = ri.Cvar_Get( "r_dynamiclight", "1", CVAR_ARCHIVE ); r_dlightBacks = ri.Cvar_Get( "r_dlightBacks", "1", CVAR_ARCHIVE ); r_finish = ri.Cvar_Get ("r_finish", "0", CVAR_ARCHIVE); - r_textureMode = ri.Cvar_Get( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE ); + r_textureMode = ri.Cvar_Get( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR", CVAR_ARCHIVE ); r_swapInterval = ri.Cvar_Get( "r_swapInterval", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_gamma = ri.Cvar_Get( "r_gamma", "1", CVAR_ARCHIVE ); diff --git a/engine/code/renderergl1/tr_model_iqm.c b/engine/code/renderergl1/tr_model_iqm.c index fe205ff4..5050eb10 100644 --- a/engine/code/renderergl1/tr_model_iqm.c +++ b/engine/code/renderergl1/tr_model_iqm.c @@ -1346,7 +1346,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) { vtxMat[10] = blendWeights[0] * poseMats[12 * data->influenceBlendIndexes[4*influence + 0] + 10]; vtxMat[11] = blendWeights[0] * poseMats[12 * data->influenceBlendIndexes[4*influence + 0] + 11]; - for( j = 1; j < 3; j++ ) { + for( j = 1; j < 4; j++ ) { if ( blendWeights[j] <= 0.0f ) { break; } diff --git a/engine/code/renderergl2/tr_init.c b/engine/code/renderergl2/tr_init.c index 275d621e..6e502f58 100644 --- a/engine/code/renderergl2/tr_init.c +++ b/engine/code/renderergl2/tr_init.c @@ -1304,7 +1304,7 @@ void R_Register( void ) r_dynamiclight = ri.Cvar_Get( "r_dynamiclight", "1", CVAR_ARCHIVE ); r_dlightBacks = ri.Cvar_Get( "r_dlightBacks", "1", CVAR_ARCHIVE ); r_finish = ri.Cvar_Get ("r_finish", "0", CVAR_ARCHIVE); - r_textureMode = ri.Cvar_Get( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE ); + r_textureMode = ri.Cvar_Get( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR", CVAR_ARCHIVE ); r_swapInterval = ri.Cvar_Get( "r_swapInterval", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_gamma = ri.Cvar_Get( "r_gamma", "1", CVAR_ARCHIVE ); diff --git a/engine/code/renderergl2/tr_model_iqm.c b/engine/code/renderergl2/tr_model_iqm.c index fc345a32..cc12faf4 100644 --- a/engine/code/renderergl2/tr_model_iqm.c +++ b/engine/code/renderergl2/tr_model_iqm.c @@ -1528,7 +1528,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) { vtxMat[10] = blendWeights[0] * poseMats[12 * data->influenceBlendIndexes[4*influence + 0] + 10]; vtxMat[11] = blendWeights[0] * poseMats[12 * data->influenceBlendIndexes[4*influence + 0] + 11]; - for( j = 1; j < 3; j++ ) { + for( j = 1; j < 4; j++ ) { if ( blendWeights[j] <= 0.0f ) { break; } diff --git a/engine/code/sdl/sdl_glimp.c b/engine/code/sdl/sdl_glimp.c index 4b284fdb..30986ab1 100644 --- a/engine/code/sdl/sdl_glimp.c +++ b/engine/code/sdl/sdl_glimp.c @@ -63,7 +63,7 @@ void (APIENTRYP qglMultiTexCoord2fARB) (GLenum target, GLfloat s, GLfloat t); void (APIENTRYP qglLockArraysEXT) (GLint first, GLsizei count); void (APIENTRYP qglUnlockArraysEXT) (void); -#define GLE(ret, name, ...) name##proc * qgl##name; +#define GLE(ret, name, ...) name##proc * qgl##name = NULL; QGL_1_1_PROCS; QGL_1_1_FIXED_FUNCTION_PROCS; QGL_DESKTOP_1_1_PROCS; diff --git a/engine/code/sdl/sdl_snd.c b/engine/code/sdl/sdl_snd.c index eb0dd58f..7696a515 100644 --- a/engine/code/sdl/sdl_snd.c +++ b/engine/code/sdl/sdl_snd.c @@ -281,12 +281,7 @@ qboolean SNDDMA_Init(void) #ifdef USE_SDL_AUDIO_CAPTURE // !!! FIXME: some of these SDL_OpenAudioDevice() values should be cvars. s_sdlCapture = Cvar_Get( "s_sdlCapture", "1", CVAR_ARCHIVE | CVAR_LATCH ); - // !!! FIXME: pulseaudio capture records audio the entire time the program is running. https://bugzilla.libsdl.org/show_bug.cgi?id=4087 - if (Q_stricmp(SDL_GetCurrentAudioDriver(), "pulseaudio") == 0) - { - Com_Printf("SDL audio capture support disabled for pulseaudio (https://bugzilla.libsdl.org/show_bug.cgi?id=4087)\n"); - } - else if (!s_sdlCapture->integer) + if (!s_sdlCapture->integer) { Com_Printf("SDL audio capture support disabled by user ('+set s_sdlCapture 1' to enable)\n"); } diff --git a/engine/code/tools/lcc/etc/bytecode.c b/engine/code/tools/lcc/etc/bytecode.c index 6e580228..4a2fe445 100644 --- a/engine/code/tools/lcc/etc/bytecode.c +++ b/engine/code/tools/lcc/etc/bytecode.c @@ -38,7 +38,10 @@ void UpdatePaths( const char *lccBinary ) strncpy( basepath, lccBinary, basepathsz ); basepath[basepathsz] = 0; - p = strrchr( basepath, PATH_SEP ); + p = strrchr( basepath, '/' ); + + if( !p ) + p = strrchr( basepath, '\\' ); if( p ) { diff --git a/engine/code/tools/stringify.c b/engine/code/tools/stringify.c new file mode 100644 index 00000000..a5ce84b0 --- /dev/null +++ b/engine/code/tools/stringify.c @@ -0,0 +1,51 @@ +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + FILE *ifp; + FILE *ofp; + char buffer[1024]; + + if(argc < 3) + return 1; + + char *inFile = argv[1]; + char *outFile = argv[2]; + + ifp = fopen(inFile, "r"); + if(!ifp) + return 2; + + ofp = fopen(outFile, "w"); + if(!ofp) + return 3; + + // Strip extension + char *base = basename(inFile); + *strrchr(base, '.') = '\0'; + + fprintf(ofp, "const char *fallbackShader_%s =\n", base); + + while(fgets(buffer, sizeof(buffer), ifp)) + { + // Strip trailing whitespace from line + char *end = buffer + strlen(buffer) - 1; + while(end >= buffer && isspace(*end)) + end--; + + end[1] = '\0'; + + // Write line enquoted, with a newline + fprintf(ofp, "\"%s\\n\"\n", buffer); + } + + fprintf(ofp, ";\n"); + + fclose(ifp); + fclose(ofp); + + return 0; +} diff --git a/engine/docs/README.md b/engine/docs/README.md index 3dd355ce..b4a530cd 100644 --- a/engine/docs/README.md +++ b/engine/docs/README.md @@ -1,3 +1,5 @@ +![Build](https://github.com/ioquake/ioq3/workflows/Build/badge.svg) + ,---------------------------------------. | _ _ ____ | | (_)___ __ _ _ _ __ _| |_____|__ / | @@ -5,13 +7,13 @@ | |_\___/\__, |\_,_\__,_|_\_\___|___/ | | |_| | | | - `---------- http://ioquake3.org --------' + `--------- https://ioquake3.org --------' The intent of this project is to provide a baseline Quake 3 which may be used for further development and baseq3 fun. Some of the major features currently implemented are: - * SDL backend + * SDL 2 backend * OpenAL sound API support (multiple speaker support and better sound quality) * Full x86_64 support on Linux @@ -45,6 +47,27 @@ If you've got issues that you aren't sure are worth filing as bugs, or just want to chat, please visit our forums: http://discourse.ioquake.org +# Thank You: + +

+ Digital Ocean
+ +
+

+--- +

+Discourse
+
+

+--- +

+icculus dot org
+
+

+ + # Compilation and installation For *nix @@ -359,11 +382,13 @@ value in the prototype with intptr_t (arg0, arg1, ...stay int). Add the following code snippet to q_shared.h: - #ifdef Q3_VM - typedef int intptr_t; - #else - #include - #endif +```c +#ifdef Q3_VM +typedef int intptr_t; +#else +#include +#endif +``` Note if you simply wish to run mods on a 64bit platform you do not need to recompile anything since by default Q3 uses a virtual machine system.