Skip to content

Commit

Permalink
Merge branch 'misc/lilium_common' into game/eliteforce
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Jul 25, 2015
2 parents c51801e + 28ce840 commit 9839534
Show file tree
Hide file tree
Showing 18 changed files with 436 additions and 210 deletions.
31 changes: 8 additions & 23 deletions Makefile
Expand Up @@ -6,7 +6,7 @@

COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]'|sed -e 's/\//_/g')

COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/)
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/ | sed -e 's/^arm.*/arm/')

ifeq ($(COMPILE_PLATFORM),sunos)
# Solaris uname and GNU uname differ
Expand Down Expand Up @@ -348,34 +348,18 @@ endif
# SETUP AND BUILD -- LINUX
#############################################################################

## Defaults
LIB=lib

INSTALL=install
MKDIR=mkdir
EXTRA_FILES=
CLIENT_EXTRA_FILES=

ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))

ifeq ($(ARCH),x86_64)
LIB=lib64
else
ifeq ($(ARCH),ppc64)
LIB=lib64
else
ifeq ($(ARCH),s390x)
LIB=lib64
else
ifeq ($(ARCH),aarch64)
LIB=lib64
endif
endif
endif
endif
ifneq (,$(findstring "$(COMPILE_PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
TOOLS_CFLAGS += -DARCH_STRING=\"$(COMPILE_ARCH)\"
endif

ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-pipe -DUSE_ICON
-pipe -DUSE_ICON -DARCH_STRING=\\\"$(ARCH)\\\"
CLIENT_CFLAGS += $(SDL_CFLAGS)

OPTIMIZEVM = -O3
Expand Down Expand Up @@ -861,6 +845,7 @@ else # ifeq netbsd
#############################################################################

ifeq ($(PLATFORM),irix64)
LIB=lib

ARCH=mips

Expand Down Expand Up @@ -1293,7 +1278,7 @@ release:
CLIENT_CFLAGS="$(CLIENT_CFLAGS)" SERVER_CFLAGS="$(SERVER_CFLAGS)" V=$(V)

ifneq ($(call bin_path, tput),)
TERM_COLUMNS=$(shell echo $$((`tput cols`-4)))
TERM_COLUMNS=$(shell if c=`tput cols`; then echo $$(($$c-4)); else echo 76; fi)
else
TERM_COLUMNS=76
endif
Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_servercmds.c
Expand Up @@ -326,7 +326,7 @@ static void CG_ConfigStringModified( void ) {
cgs.teamVoteNo[num-CS_TEAMVOTE_NO] = atoi( str );
cgs.teamVoteModified[num-CS_TEAMVOTE_NO] = qtrue;
} else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) {
Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) );
Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString[0] ) );
#ifdef MISSIONPACK
trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER );
#endif
Expand Down
7 changes: 1 addition & 6 deletions code/client/cl_main.c
Expand Up @@ -149,7 +149,6 @@ typedef struct serverStatus_s
} serverStatus_t;

serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS];
int serverStatusCount;

#if defined __USEA3D && defined __A3D_GEOM
void hA3Dg_ExportRenderGeom (refexport_t *incoming_re);
Expand Down Expand Up @@ -4006,11 +4005,7 @@ serverStatus_t *CL_GetServerStatus( netadr_t from ) {
oldestTime = cl_serverStatusList[i].startTime;
}
}
if (oldest != -1) {
return &cl_serverStatusList[oldest];
}
serverStatusCount++;
return &cl_serverStatusList[serverStatusCount & (MAX_SERVERSTATUSREQUESTS-1)];
return &cl_serverStatusList[oldest];
}

/*
Expand Down
14 changes: 12 additions & 2 deletions code/qcommon/cm_patch.c
Expand Up @@ -876,7 +876,10 @@ void CM_AddFacetBevels( facet_t *facet ) {
}

if ( i == facet->numBorders ) {
if (facet->numBorders > 4 + 6 + 16) Com_Printf("ERROR: too many bevels\n");
if ( facet->numBorders >= 4 + 6 + 16 ) {
Com_Printf( "ERROR: too many bevels\n" );
continue;
}
facet->borderPlanes[facet->numBorders] = CM_FindPlane2(plane, &flipped);
facet->borderNoAdjust[facet->numBorders] = 0;
facet->borderInward[facet->numBorders] = flipped;
Expand Down Expand Up @@ -938,7 +941,10 @@ void CM_AddFacetBevels( facet_t *facet ) {
}

if ( i == facet->numBorders ) {
if (facet->numBorders > 4 + 6 + 16) Com_Printf("ERROR: too many bevels\n");
if ( facet->numBorders >= 4 + 6 + 16 ) {
Com_Printf( "ERROR: too many bevels\n" );
continue;
}
facet->borderPlanes[facet->numBorders] = CM_FindPlane2(plane, &flipped);

for ( k = 0 ; k < facet->numBorders ; k++ ) {
Expand Down Expand Up @@ -976,6 +982,10 @@ void CM_AddFacetBevels( facet_t *facet ) {

#ifndef BSPC
//add opposite plane
if ( facet->numBorders >= 4 + 6 + 16 ) {
Com_Printf( "ERROR: too many bevels\n" );
return;
}
facet->borderPlanes[facet->numBorders] = facet->surfacePlane;
facet->borderNoAdjust[facet->numBorders] = 0;
facet->borderInward[facet->numBorders] = qtrue;
Expand Down
4 changes: 3 additions & 1 deletion code/qcommon/files.c
Expand Up @@ -543,7 +543,9 @@ qboolean FS_CreatePath (char *OSPath) {

// Skip creation of the root directory as it will always be there
ofs = strchr( path, PATH_SEP );
ofs++;
if ( ofs != NULL ) {
ofs++;
}

for (; ofs != NULL && *ofs ; ofs++) {
if (*ofs == PATH_SEP) {
Expand Down
35 changes: 5 additions & 30 deletions code/qcommon/q_platform.h
Expand Up @@ -185,38 +185,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#define PATH_SEP '/'

#if defined __i386__
#define ARCH_STRING "x86"
#elif defined __x86_64__
#if !defined(ARCH_STRING)
# error ARCH_STRING should be defined by the Makefile
#endif

#if defined __x86_64__
#undef idx64
#define idx64 1
#define ARCH_STRING "x86_64"
#elif defined __powerpc64__
#define ARCH_STRING "ppc64"
#elif defined __powerpc__
#define ARCH_STRING "ppc"
#elif defined __s390__
#define ARCH_STRING "s390"
#elif defined __s390x__
#define ARCH_STRING "s390x"
#elif defined __ia64__
#define ARCH_STRING "ia64"
#elif defined __alpha__
#define ARCH_STRING "alpha"
#elif defined __sparc__
#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__
#define ARCH_STRING "hppa"
#elif defined __mips__
#define ARCH_STRING "mips"
#elif defined __sh__
#define ARCH_STRING "sh"
#endif

#if __FLOAT_WORD_ORDER == __BIG_ENDIAN
Expand Down
20 changes: 13 additions & 7 deletions code/qcommon/vm_x86.c
Expand Up @@ -203,19 +203,25 @@ static void EmitRexString(byte rex, const char *string)


#define MASK_REG(modrm, mask) \
EmitString("81"); \
EmitString((modrm)); \
Emit4((mask))
do { \
EmitString("81"); \
EmitString((modrm)); \
Emit4((mask)); \
} while(0)

// add bl, bytes
#define STACK_PUSH(bytes) \
EmitString("80 C3"); \
Emit1(bytes)
do { \
EmitString("80 C3"); \
Emit1(bytes); \
} while(0)

// sub bl, bytes
#define STACK_POP(bytes) \
EmitString("80 EB"); \
Emit1(bytes)
do { \
EmitString("80 EB"); \
Emit1(bytes); \
} while(0)

static void EmitCommand(ELastCommand command)
{
Expand Down
4 changes: 2 additions & 2 deletions code/renderergl1/tr_image.c
Expand Up @@ -1555,7 +1555,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
// If not a .skin file, load as a single shader
if ( strcmp( name + strlen( name ) - 5, ".skin" ) ) {
skin->numSurfaces = 1;
skin->surfaces[0] = ri.Hunk_Alloc( sizeof(skin->surfaces[0]), h_low );
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
skin->surfaces[0]->shader = R_FindShader( name, LIGHTMAP_NONE, qtrue );
return hSkin;
}
Expand Down Expand Up @@ -1626,7 +1626,7 @@ void R_InitSkins( void ) {
skin = tr.skins[0] = ri.Hunk_Alloc( sizeof( skin_t ), h_low );
Q_strncpyz( skin->name, "<default skin>", sizeof( skin->name ) );
skin->numSurfaces = 1;
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces ), h_low );
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
skin->surfaces[0]->shader = tr.defaultShader;
}

Expand Down
6 changes: 6 additions & 0 deletions code/renderergl1/tr_light.c
Expand Up @@ -182,13 +182,19 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
data = gridData;
for ( j = 0 ; j < 3 ; j++ ) {
if ( i & (1<<j) ) {
if ( pos[j] + 1 > tr.world->lightGridBounds[j] - 1 ) {
break; // ignore values outside lightgrid
}
factor *= frac[j];
data += gridStep[j];
} else {
factor *= (1.0f - frac[j]);
}
}

if ( j != 3 ) {
continue;
}
if ( !(data[0]+data[1]+data[2]) ) {
continue; // ignore samples in walls
}
Expand Down
3 changes: 0 additions & 3 deletions code/renderergl2/tr_fbo.c
Expand Up @@ -47,9 +47,6 @@ qboolean R_CheckFBO(const FBO_t * fbo)
// an error occured
switch (code)
{
case GL_FRAMEBUFFER_COMPLETE_EXT:
break;

case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
ri.Printf(PRINT_WARNING, "R_CheckFBO: (%s) Unsupported framebuffer format\n", fbo->name);
break;
Expand Down
4 changes: 2 additions & 2 deletions code/renderergl2/tr_image.c
Expand Up @@ -3120,7 +3120,7 @@ qhandle_t RE_RegisterSkin( const char *name ) {
// If not a .skin file, load as a single shader
if ( strcmp( name + strlen( name ) - 5, ".skin" ) ) {
skin->numSurfaces = 1;
skin->surfaces[0] = ri.Hunk_Alloc( sizeof(skin->surfaces[0]), h_low );
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
skin->surfaces[0]->shader = R_FindShader( name, LIGHTMAP_NONE, qtrue );
return hSkin;
}
Expand Down Expand Up @@ -3191,7 +3191,7 @@ void R_InitSkins( void ) {
skin = tr.skins[0] = ri.Hunk_Alloc( sizeof( skin_t ), h_low );
Q_strncpyz( skin->name, "<default skin>", sizeof( skin->name ) );
skin->numSurfaces = 1;
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces ), h_low );
skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
skin->surfaces[0]->shader = tr.defaultShader;
}

Expand Down
10 changes: 4 additions & 6 deletions code/renderergl2/tr_light.c
Expand Up @@ -180,18 +180,15 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, world_t *world ) {
byte *data;
int lat, lng;
vec3_t normal;
qboolean ignore;
#if idppc
float d0, d1, d2, d3, d4, d5;
#endif
factor = 1.0;
data = gridData;
ignore = qfalse;
for ( j = 0 ; j < 3 ; j++ ) {
if ( i & (1<<j) ) {
if ((pos[j] + 1) > world->lightGridBounds[j] - 1)
{
ignore = qtrue; // ignore values outside lightgrid
if ( pos[j] + 1 > world->lightGridBounds[j] - 1 ) {
break; // ignore values outside lightgrid
}
factor *= frac[j];
data += gridStep[j];
Expand All @@ -200,8 +197,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, world_t *world ) {
}
}

if ( ignore )
if ( j != 3 ) {
continue;
}

if (world->hdrLightGrid)
{
Expand Down

0 comments on commit 9839534

Please sign in to comment.