Skip to content

Commit

Permalink
Merge branch 'master' into game/eliteforce
Browse files Browse the repository at this point in the history
Conflicts:
	code/renderergl1/tr_main.c
	code/renderergl2/tr_main.c
  • Loading branch information
zturtleman committed Jul 9, 2015
2 parents 88f7cf1 + 5768e23 commit 6b9a3a4
Show file tree
Hide file tree
Showing 17 changed files with 124 additions and 40 deletions.
6 changes: 5 additions & 1 deletion Makefile
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions code/asm/snapvector.asm
Expand Up @@ -36,10 +36,6 @@ ENDIF
ssemask DWORD 0FFFFFFFFh, 0FFFFFFFFh, 0FFFFFFFFh, 00000000h
ssecw DWORD 00001F80h

IFNDEF idx64
fpucw WORD 037Fh
ENDIF

.code

IFDEF idx64
Expand Down
6 changes: 3 additions & 3 deletions code/botlib/l_precomp.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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

Expand Down
23 changes: 14 additions & 9 deletions code/cgame/cg_event.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)));
Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_servercmds.c
Expand Up @@ -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));
}
}
Expand Down
11 changes: 0 additions & 11 deletions code/client/cl_avi.c
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/client/cl_cin.c
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions code/client/cl_input.c
Expand Up @@ -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]) );
}
}

Expand Down
8 changes: 6 additions & 2 deletions code/qcommon/q_platform.h
Expand Up @@ -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 <endian.h>

#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
Expand Down Expand Up @@ -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__
Expand Down
4 changes: 4 additions & 0 deletions code/renderergl1/tr_main.c
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions code/renderergl1/tr_shader.c
Expand Up @@ -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] )
{
Expand Down
4 changes: 4 additions & 0 deletions code/renderergl2/tr_main.c
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions code/renderergl2/tr_shader.c
Expand Up @@ -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] )
{
Expand Down
10 changes: 5 additions & 5 deletions code/sdl/sdl_glimp.c
Expand Up @@ -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" );
Expand Down
11 changes: 11 additions & 0 deletions code/sys/sys_win32.c
Expand Up @@ -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) {

Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
30 changes: 30 additions & 0 deletions 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
3 changes: 3 additions & 0 deletions 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

0 comments on commit 6b9a3a4

Please sign in to comment.