diff --git a/Makefile b/Makefile index ea578f8a..a55e7b1c 100644 --- a/Makefile +++ b/Makefile @@ -356,7 +356,7 @@ MKDIR=mkdir EXTRA_FILES= CLIENT_EXTRA_FILES= -ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu")) +ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")) ifeq ($(ARCH),x86_64) LIB=lib64 @@ -366,6 +366,10 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu")) else ifeq ($(ARCH),s390x) LIB=lib64 + else + ifeq ($(ARCH),aarch64) + LIB=lib64 + endif endif endif endif diff --git a/code/asm/snapvector.asm b/code/asm/snapvector.asm index 2836d4a8..59949f0f 100644 --- a/code/asm/snapvector.asm +++ b/code/asm/snapvector.asm @@ -36,10 +36,6 @@ ENDIF ssemask DWORD 0FFFFFFFFh, 0FFFFFFFFh, 0FFFFFFFFh, 00000000h ssecw DWORD 00001F80h -IFNDEF idx64 - fpucw WORD 037Fh -ENDIF - .code IFDEF idx64 diff --git a/code/botlib/l_precomp.c b/code/botlib/l_precomp.c index e0438e89..c0870dbe 100644 --- a/code/botlib/l_precomp.c +++ b/code/botlib/l_precomp.c @@ -2445,7 +2445,7 @@ int PC_Directive_eval(source_t *source) token.whitespace_p = source->scriptstack->script_p; token.endwhitespace_p = source->scriptstack->script_p; token.linescrossed = 0; - sprintf(token.string, "%d", abs(value)); + sprintf(token.string, "%ld", labs(value)); token.type = TT_NUMBER; token.subtype = TT_INTEGER|TT_LONG|TT_DECIMAL; PC_UnreadSourceToken(source, &token); @@ -2550,12 +2550,12 @@ int PC_DollarDirective_evalint(source_t *source) token.whitespace_p = source->scriptstack->script_p; token.endwhitespace_p = source->scriptstack->script_p; token.linescrossed = 0; - sprintf(token.string, "%d", abs(value)); + sprintf(token.string, "%ld", labs(value)); token.type = TT_NUMBER; token.subtype = TT_INTEGER|TT_LONG|TT_DECIMAL; #ifdef NUMBERVALUE - token.intvalue = abs(value); + token.intvalue = labs(value); token.floatvalue = token.intvalue; #endif //NUMBERVALUE diff --git a/code/cgame/cg_event.c b/code/cgame/cg_event.c index ec5f7dcd..131be742 100644 --- a/code/cgame/cg_event.c +++ b/code/cgame/cg_event.c @@ -428,23 +428,28 @@ Returns waterlevel for entity origin int CG_WaterLevel(centity_t *cent) { vec3_t point; int contents, sample1, sample2, anim, waterlevel; + int viewheight; - // get waterlevel, accounting for ducking - waterlevel = 0; - VectorCopy(cent->lerpOrigin, point); - point[2] += MINS_Z + 1; anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT; if (anim == LEGS_WALKCR || anim == LEGS_IDLECR) { - point[2] += CROUCH_VIEWHEIGHT; + viewheight = CROUCH_VIEWHEIGHT; } else { - point[2] += DEFAULT_VIEWHEIGHT; + viewheight = DEFAULT_VIEWHEIGHT; } + // + // get waterlevel, accounting for ducking + // + waterlevel = 0; + + point[0] = cent->lerpOrigin[0]; + point[1] = cent->lerpOrigin[1]; + point[2] = cent->lerpOrigin[2] + MINS_Z + 1; contents = CG_PointContents(point, -1); if (contents & MASK_WATER) { - sample2 = point[2] - MINS_Z; + sample2 = viewheight - MINS_Z; sample1 = sample2 / 2; waterlevel = 1; point[2] = cent->lerpOrigin[2] + MINS_Z + sample1; @@ -489,7 +494,7 @@ void CG_PainEvent( centity_t *cent, int health ) { snd = "*pain100_1.wav"; } // play a gurp sound instead of a normal pain sound - if (CG_WaterLevel(cent) >= 1) { + if (CG_WaterLevel(cent) == 3) { if (rand()&1) { trap_S_StartSound(NULL, cent->currentState.number, CHAN_VOICE, CG_CustomSound(cent->currentState.number, "sound/player/gurp1.wav")); } else { @@ -1164,7 +1169,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { case EV_DEATH3: DEBUGNAME("EV_DEATHx"); - if (CG_WaterLevel(cent) >= 1) { + if (CG_WaterLevel(cent) == 3) { trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, "*drown.wav")); } else { trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, va("*death%i.wav", event - EV_DEATH1 + 1))); diff --git a/code/cgame/cg_servercmds.c b/code/cgame/cg_servercmds.c index cbbed53d..648353b5 100644 --- a/code/cgame/cg_servercmds.c +++ b/code/cgame/cg_servercmds.c @@ -480,7 +480,7 @@ static void CG_MapRestart( void ) { #ifdef MISSIONPACK if (cg_singlePlayerActive.integer) { trap_Cvar_Set("ui_matchStartTime", va("%i", cg.time)); - if (cg_recordSPDemo.integer && cg_recordSPDemoName.string && *cg_recordSPDemoName.string) { + if (cg_recordSPDemo.integer && *cg_recordSPDemoName.string) { trap_SendConsoleCommand(va("set g_synchronousclients 1 ; record %s \n", cg_recordSPDemoName.string)); } } diff --git a/code/client/cl_avi.c b/code/client/cl_avi.c index 3b0d7751..17fd371f 100644 --- a/code/client/cl_avi.c +++ b/code/client/cl_avi.c @@ -122,17 +122,6 @@ static ID_INLINE void WRITE_2BYTES( int x ) bufIndex += 2; } -/* -=============== -WRITE_1BYTES -=============== -*/ -static ID_INLINE void WRITE_1BYTES( int x ) -{ - buffer[ bufIndex ] = x; - bufIndex += 1; -} - /* =============== START_CHUNK diff --git a/code/client/cl_cin.c b/code/client/cl_cin.c index d79f3db6..be4fb1bc 100644 --- a/code/client/cl_cin.c +++ b/code/client/cl_cin.c @@ -94,8 +94,8 @@ typedef struct { qboolean looping, holdAtEnd, dirty, alterGameState, silent, shader; fileHandle_t iFile; e_status status; - unsigned int startTime; - unsigned int lastTime; + int startTime; + int lastTime; long tfps; long RoQPlayed; long ROQSize; diff --git a/code/client/cl_input.c b/code/client/cl_input.c index 84c4ee82..40664e3d 100644 --- a/code/client/cl_input.c +++ b/code/client/cl_input.c @@ -606,10 +606,10 @@ usercmd_t CL_CreateCmd( void ) { // draw debug graphs of turning for mouse testing if ( cl_debugMove->integer ) { if ( cl_debugMove->integer == 1 ) { - SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]) ); + SCR_DebugGraph( fabs(cl.viewangles[YAW] - oldAngles[YAW]) ); } if ( cl_debugMove->integer == 2 ) { - SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]) ); + SCR_DebugGraph( fabs(cl.viewangles[PITCH] - oldAngles[PITCH]) ); } } diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h index 999dd39a..e22fc7d9 100644 --- a/code/qcommon/q_platform.h +++ b/code/qcommon/q_platform.h @@ -169,14 +169,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA //================================================================= LINUX === -#if defined(__linux__) || defined(__FreeBSD_kernel__) +#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__) #include #if defined(__linux__) #define OS_STRING "linux" -#else +#elif defined(__FreeBSD_kernel__) #define OS_STRING "kFreeBSD" +#else +#define OS_STRING "GNU" #endif #define ID_INLINE inline @@ -205,6 +207,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define ARCH_STRING "sparc" #elif defined __arm__ #define ARCH_STRING "arm" +#elif defined __aarch64__ +#define ARCH_STRING "aarch64" #elif defined __cris__ #define ARCH_STRING "cris" #elif defined __hppa__ diff --git a/code/renderergl1/tr_main.c b/code/renderergl1/tr_main.c index 1694f543..602cd77a 100644 --- a/code/renderergl1/tr_main.c +++ b/code/renderergl1/tr_main.c @@ -1012,6 +1012,10 @@ int R_SpriteFogNum( trRefEntity_t *ent ) { return 0; } + if ( ent->e.renderfx & RF_CROSSHAIR ) { + return 0; + } + #ifdef ELITEFORCE radius = ent->e.data.sprite.radius; #else diff --git a/code/renderergl1/tr_shader.c b/code/renderergl1/tr_shader.c index d4fdfb1a..8f29f9e3 100644 --- a/code/renderergl1/tr_shader.c +++ b/code/renderergl1/tr_shader.c @@ -1578,6 +1578,23 @@ static qboolean ParseShader( char **text ) return qfalse; } + if ( r_greyscale->integer ) + { + float luminance; + + luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] ); + VectorSet( shader.fogParms.color, luminance, luminance, luminance ); + } + else if ( r_greyscale->value ) + { + float luminance; + + luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] ); + shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value ); + shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value ); + shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value ); + } + token = COM_ParseExt( text, qfalse ); if ( !token[0] ) { diff --git a/code/renderergl2/tr_main.c b/code/renderergl2/tr_main.c index a08a9a38..a930bd21 100644 --- a/code/renderergl2/tr_main.c +++ b/code/renderergl2/tr_main.c @@ -1680,6 +1680,10 @@ int R_SpriteFogNum( trRefEntity_t *ent ) { return 0; } + if ( ent->e.renderfx & RF_CROSSHAIR ) { + return 0; + } + #ifdef ELITEFORCE radius = ent->e.data.sprite.radius; #else diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index 81d89113..5afe985d 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -1866,6 +1866,23 @@ static qboolean ParseShader( char **text ) return qfalse; } + if ( r_greyscale->integer ) + { + float luminance; + + luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] ); + VectorSet( shader.fogParms.color, luminance, luminance, luminance ); + } + else if ( r_greyscale->value ) + { + float luminance; + + luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] ); + shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value ); + shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value ); + shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value ); + } + token = COM_ParseExt( text, qfalse ); if ( !token[0] ) { diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index 28142668..8b355ef7 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -130,21 +130,21 @@ static void GLimp_DetectAvailableModes(void) { int i, j; char buf[ MAX_STRING_CHARS ] = { 0 }; - size_t numSDLModes; + int numSDLModes; SDL_Rect *modes; int numModes = 0; - int display = SDL_GetWindowDisplayIndex( SDL_window ); SDL_DisplayMode windowMode; + int display = SDL_GetWindowDisplayIndex( SDL_window ); + numSDLModes = SDL_GetNumDisplayModes( display ); - if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 ) + if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 || numSDLModes <= 0 ) { ri.Printf( PRINT_WARNING, "Couldn't get window display mode, no resolutions detected\n" ); return; } - numSDLModes = SDL_GetNumDisplayModes( display ); - modes = SDL_calloc( numSDLModes, sizeof( SDL_Rect ) ); + modes = SDL_calloc( (size_t)numSDLModes, sizeof( SDL_Rect ) ); if ( !modes ) { ri.Error( ERR_FATAL, "Out of memory" ); diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index 14be1364..50d1bb4b 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -410,6 +410,7 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter intptr_t findhandle; int flag; int i; + int extLen; if (filter) { @@ -443,6 +444,8 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter flag = _A_SUBDIR; } + extLen = strlen( extension ); + Com_sprintf( search, sizeof(search), "%s\\*%s", directory, extension ); // search @@ -456,6 +459,14 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter do { if ( (!wantsubs && flag ^ ( findinfo.attrib & _A_SUBDIR )) || (wantsubs && findinfo.attrib & _A_SUBDIR) ) { + if (*extension) { + if ( strlen( findinfo.name ) < extLen || + Q_stricmp( + findinfo.name + strlen( findinfo.name ) - extLen, + extension ) ) { + continue; // didn't match + } + } if ( nfiles == MAX_FOUND_FILES - 1 ) { break; } diff --git a/misc/linux/server_compile.sh b/misc/linux/server_compile.sh new file mode 100644 index 00000000..ed78be92 --- /dev/null +++ b/misc/linux/server_compile.sh @@ -0,0 +1,30 @@ +#!/bin/bash +localPATH=`pwd` +export BUILD_CLIENT="0" +export BUILD_SERVER="1" +export USE_CURL="1" +export USE_CODEC_OPUS="1" +export USE_VOIP="1" +export COPYDIR="~/ioquake3" +IOQ3REMOTE="https://github.com/ioquake/ioq3.git" +IOQ3LOCAL="/tmp/ioquake3compile" +JOPTS="-j2" +echo "This process requires you to have the following installed through your distribution: + make + git + and all of the ioquake3 dependencies necessary for an ioquake3 server. + If you do not have the necessary dependencies this script will bail out. + Please post a message to http://community.ioquake.org/ asking for help and include whatever error messages you received during the compile phase. + Please edit this script. Inside you will find a COPYDIR variable you can alter to change where ioquake3 will be installed to." +while true; do + read -p "Are you ready to compile ioquake3 in the $IOQ3LOCAL directory, and have it installed into $COPYDIR? " yn +case $yn in + [Yy]* ) +if [ -x "$(command -v git)" ] && [ -x "$(command -v make)" ] ; then + git clone $IOQ3REMOTE $IOQ3LOCAL && cd $IOQ3LOCAL && make $JOPTS && make copyfiles && cd $localPATH && rm -rf $IOQ3LOCAL +fi + exit;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; +esac +done diff --git a/misc/linux/start_server.sh b/misc/linux/start_server.sh new file mode 100644 index 00000000..82d28c03 --- /dev/null +++ b/misc/linux/start_server.sh @@ -0,0 +1,3 @@ +#!/bin/sh +echo "Edit this script to change the path to ioquake3's dedicated server executable and which binary if you aren't on x86_64.\n Set the sv_dlURL setting to a url like http://yoursite.com/ioquake3_path for ioquake3 clients to download extra data" +~/ioquake3/ioq3ded.x86_64 +set dedicated 2 +set sv_allowDownload 1 +set sv_dlURL "" +set com_hunkmegs 64