ioquake3 resync to revision 6920 from 6893.

Updated to latest recommended build settings, increased deployment target to 10.7
Further tweaks to Xcode project
Now works as well as possible in Xcode 11
Figured out method of referencing GLSL generated C files outside of code directory
Update README.md
Add C syntax highlighting to readme
Simplify glsl -> C stringification
Make LCC path resolution more robust
GitHub Actions setup
Remove old CI system configurations
Add status badge to README
Fix shader stringify
Run apt-get update before installing deps
Avoid platform sed differences
Run actions on pull request too
Use `r_texturemode GL_LINEAR_MIPMAP_LINEAR` by default
[sdl] Turn tentative definition into actual definition.
Add TOOLS_CFLAGS to build preamble
Fix use of TOOLS_CC being reported as CC
Use the correct compiler for tools when cross building under cygwin
Allow using pulseaudio for SDL audio capture
Restore bots crushing unseen player on q3tourney6 in non-CTF
Fix the number of weights in the IQM model calculation
Fixes a crash when compiling the project on windows in 64 bit mode.
This commit is contained in:
zturtleman 2021-06-07 09:11:19 +00:00
parent 5fd3d16c15
commit 1568196e27
12 changed files with 133 additions and 29 deletions

View file

@ -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)

View file

@ -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

View file

@ -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;
}
}

View file

@ -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 );

View file

@ -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;
}

View file

@ -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 );

View file

@ -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;
}

View file

@ -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;

View file

@ -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");
}

View file

@ -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 )
{

View file

@ -0,0 +1,51 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <libgen.h>
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;
}

View file

@ -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:
<p>
<a href="https://www.digitalocean.com/">Digital Ocean<br/>
<img src="https://opensource.nyc3.cdn.digitaloceanspaces.com/attribution/assets/PoweredByDO/DO_Powered_by_Badge_blue.svg" width="201px">
</a>
</p>
---
<p>
<a href="https://www.discourse.org/">Discourse<br/>
<img src=
"https://user-images.githubusercontent.com/1681963/52239617-e2683480-289c-11e9-922b-5da55472e5b4.png"
width="300px"></a>
</p>
---
<p>
<a href="https://icculus.org/">icculus dot org<br/>
<img src="http://icculus.org/icculus-org-now.png" width="300px"></a>
</p>
# 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:
```c
#ifdef Q3_VM
typedef int intptr_t;
#else
#include <stdint.h>
#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.