* Disable ccache by default. If you want it, add USE_CCACHE=1 to Makefile.local

* Remove -gfull from linux section in Makefile -- it's darwin only
* Cast away some warnings that surfaced from using "new" AL headers
* Various whitespace and consistency fixes
This commit is contained in:
Tim Angus 2005-11-26 15:01:28 +00:00
parent 877f360812
commit 382c6adb54
11 changed files with 125 additions and 170 deletions

View File

@ -467,15 +467,14 @@ static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int cou
}
static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
#if idppc_altivec
extern cvar_t *com_altivec;
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
S_PaintChannelFrom16_altivec( ch, sc, count, sampleOffset, bufferOffset );
return;
}
#endif
S_PaintChannelFrom16_scalar( ch, sc, count, sampleOffset, bufferOffset );
#if idppc_altivec
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
S_PaintChannelFrom16_altivec( ch, sc, count, sampleOffset, bufferOffset );
return;
}
#endif
S_PaintChannelFrom16_scalar( ch, sc, count, sampleOffset, bufferOffset );
}
void S_PaintChannelFromWavelet( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {

View File

@ -847,8 +847,8 @@ static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
// Set up the position and velocity
VectorScale(entityList[entnum].origin, POSITION_SCALE, sorigin);
qalSourcefv(srcList[src].source, AL_POSITION, sorigin);
qalSourcefv(srcList[src].source, AL_VELOCITY, velocity);
qalSourcefv(srcList[src].source, AL_POSITION, (ALfloat *)sorigin);
qalSourcefv(srcList[src].source, AL_VELOCITY, (ALfloat *)velocity);
// Flag it
entityList[entnum].touched = qtrue;
@ -1067,7 +1067,7 @@ void S_AL_RawSamples(int samples, int rate, int width, int channels, const byte
// Create a buffer, and stuff the data into it
qalGenBuffers(1, &buffer);
qalBufferData(buffer, format, data, (samples * width * channels), rate);
qalBufferData(buffer, format, (ALvoid *)data, (samples * width * channels), rate);
// Shove the data onto the streamSource
qalSourceQueueBuffers(streamSource, 1, &buffer);
@ -1384,7 +1384,7 @@ void S_AL_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int
// Set OpenAL listener paramaters
VectorScale(origin, POSITION_SCALE, sorigin);
qalListenerfv(AL_POSITION, origin);
qalListenerfv(AL_POSITION, (ALfloat *)origin);
qalListenerfv(AL_VELOCITY, velocity);
qalListenerfv(AL_ORIENTATION, orientation);
}

View File

@ -39,10 +39,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif
#if (defined(powerc) || defined(powerpc) || defined(ppc) || \
defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY)
defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY)
#define idppc 1
#if defined(__VEC__)
#define idppc_altivec 1
#ifdef MACOS_X // Apple's GCC does this differently than the FSF.
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
(vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
#else
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
(vector unsigned char) {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}
#endif
#else
#define idppc_altivec 0
#endif
@ -51,12 +58,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define idppc_altivec 0
#endif
#if (MACOS_X) // Apple's GCC does this differently than the FSF.
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) (vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
#else
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) (vector unsigned char) {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}
#endif
#endif
#ifndef __ASM_I386__ // don't include the C bits if included from qasm.h

View File

@ -748,6 +748,7 @@ extern cvar_t *com_blood;
extern cvar_t *com_buildScript; // for building release pak files
extern cvar_t *com_journal;
extern cvar_t *com_cameraMode;
extern cvar_t *com_altivec;
// both client and server must agree to pause
extern cvar_t *cl_paused;

View File

@ -463,11 +463,6 @@ static void ProjectDlightTexture_altivec( void ) {
floatColorVec0 = vec_perm(floatColorVec0,floatColorVec0,floatColorVecPerm);
for ( i = 0 ; i < tess.numVertexes ; i++, texCoords += 2, colors += 4 ) {
int clip = 0;
#define DIST0 dist0
#define DIST1 dist1
#define DIST2 dist2
#define TEXCOORDS0 texCoords0
#define TEXCOORDS1 texCoords1
vec_t dist0, dist1, dist2;
dist0 = origin0 - tess.xyz[i][0];
@ -476,42 +471,42 @@ static void ProjectDlightTexture_altivec( void ) {
backEnd.pc.c_dlightVertexes++;
TEXCOORDS0 = 0.5f + DIST0 * scale;
TEXCOORDS1 = 0.5f + DIST1 * scale;
texCoords0 = 0.5f + dist0 * scale;
texCoords1 = 0.5f + dist1 * scale;
if( !r_dlightBacks->integer &&
// dist . tess.normal[i]
( DIST0 * tess.normal[i][0] +
DIST1 * tess.normal[i][1] +
DIST2 * tess.normal[i][2] ) < 0.0f ) {
( dist0 * tess.normal[i][0] +
dist1 * tess.normal[i][1] +
dist2 * tess.normal[i][2] ) < 0.0f ) {
clip = 63;
} else {
if ( TEXCOORDS0 < 0.0f ) {
if ( texCoords0 < 0.0f ) {
clip |= 1;
} else if ( TEXCOORDS0 > 1.0f ) {
} else if ( texCoords0 > 1.0f ) {
clip |= 2;
}
if ( TEXCOORDS1 < 0.0f ) {
if ( texCoords1 < 0.0f ) {
clip |= 4;
} else if ( TEXCOORDS1 > 1.0f ) {
} else if ( texCoords1 > 1.0f ) {
clip |= 8;
}
texCoords[0] = TEXCOORDS0;
texCoords[1] = TEXCOORDS1;
texCoords[0] = texCoords0;
texCoords[1] = texCoords1;
// modulate the strength based on the height and color
if ( DIST2 > radius ) {
if ( dist2 > radius ) {
clip |= 16;
modulate = 0.0f;
} else if ( DIST2 < -radius ) {
} else if ( dist2 < -radius ) {
clip |= 32;
modulate = 0.0f;
} else {
DIST2 = Q_fabs(DIST2);
if ( DIST2 < radius * 0.5f ) {
dist2 = Q_fabs(dist2);
if ( dist2 < radius * 0.5f ) {
modulate = 1.0f;
} else {
modulate = 2.0f * (radius - DIST2) * scale;
modulate = 2.0f * (radius - dist2) * scale;
}
}
}
@ -526,11 +521,6 @@ static void ProjectDlightTexture_altivec( void ) {
colorChar = vec_sel(colorChar,vSel,vSel); // RGBARGBARGBARGBA replace alpha with 255
vec_ste((vector unsigned int)colorChar,0,(unsigned int *)colors); // store color
}
#undef DIST0
#undef DIST1
#undef DIST2
#undef TEXCOORDS0
#undef TEXCOORDS1
// build a list of triangles that need light
numIndexes = 0;
@ -614,53 +604,48 @@ static void ProjectDlightTexture_scalar( void ) {
floatColor[2] = dl->color[2] * 255.0f;
for ( i = 0 ; i < tess.numVertexes ; i++, texCoords += 2, colors += 4 ) {
int clip = 0;
#define DIST0 dist[0]
#define DIST1 dist[1]
#define DIST2 dist[2]
#define TEXCOORDS0 texCoords[0]
#define TEXCOORDS1 texCoords[1]
vec3_t dist;
VectorSubtract( origin, tess.xyz[i], dist );
backEnd.pc.c_dlightVertexes++;
TEXCOORDS0 = 0.5f + DIST0 * scale;
TEXCOORDS1 = 0.5f + DIST1 * scale;
texCoords[0] = 0.5f + dist[0] * scale;
texCoords[1] = 0.5f + dist[1] * scale;
if( !r_dlightBacks->integer &&
// dist . tess.normal[i]
( DIST0 * tess.normal[i][0] +
DIST1 * tess.normal[i][1] +
DIST2 * tess.normal[i][2] ) < 0.0f ) {
( dist[0] * tess.normal[i][0] +
dist[1] * tess.normal[i][1] +
dist[2] * tess.normal[i][2] ) < 0.0f ) {
clip = 63;
} else {
if ( TEXCOORDS0 < 0.0f ) {
if ( texCoords[0] < 0.0f ) {
clip |= 1;
} else if ( TEXCOORDS0 > 1.0f ) {
} else if ( texCoords[0] > 1.0f ) {
clip |= 2;
}
if ( TEXCOORDS1 < 0.0f ) {
if ( texCoords[1] < 0.0f ) {
clip |= 4;
} else if ( TEXCOORDS1 > 1.0f ) {
} else if ( texCoords[1] > 1.0f ) {
clip |= 8;
}
texCoords[0] = TEXCOORDS0;
texCoords[1] = TEXCOORDS1;
texCoords[0] = texCoords[0];
texCoords[1] = texCoords[1];
// modulate the strength based on the height and color
if ( DIST2 > radius ) {
if ( dist[2] > radius ) {
clip |= 16;
modulate = 0.0f;
} else if ( DIST2 < -radius ) {
} else if ( dist[2] < -radius ) {
clip |= 32;
modulate = 0.0f;
} else {
DIST2 = Q_fabs(DIST2);
if ( DIST2 < radius * 0.5f ) {
dist[2] = Q_fabs(dist[2]);
if ( dist[2] < radius * 0.5f ) {
modulate = 1.0f;
} else {
modulate = 2.0f * (radius - DIST2) * scale;
modulate = 2.0f * (radius - dist[2]) * scale;
}
}
}
@ -670,11 +655,6 @@ static void ProjectDlightTexture_scalar( void ) {
colors[2] = myftol(floatColor[2] * modulate);
colors[3] = 255;
}
#undef DIST0
#undef DIST1
#undef DIST2
#undef TEXCOORDS0
#undef TEXCOORDS1
// build a list of triangles that need light
numIndexes = 0;
@ -719,15 +699,14 @@ static void ProjectDlightTexture_scalar( void ) {
}
static void ProjectDlightTexture( void ) {
#if idppc_altivec
extern cvar_t *com_altivec;
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
ProjectDlightTexture_altivec();
return;
}
#endif
ProjectDlightTexture_scalar();
#if idppc_altivec
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
ProjectDlightTexture_altivec();
return;
}
#endif
ProjectDlightTexture_scalar();
}

View File

@ -1219,14 +1219,13 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
void RB_CalcDiffuseColor( unsigned char *colors )
{
#if idppc_altivec
extern cvar_t *com_altivec;
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
RB_CalcDiffuseColor_altivec( colors );
return;
}
#endif
RB_CalcDiffuseColor_scalar( colors );
#if idppc_altivec
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
RB_CalcDiffuseColor_altivec( colors );
return;
}
#endif
RB_CalcDiffuseColor_scalar( colors );
}

View File

@ -838,28 +838,23 @@ static void LerpMeshVertexes_scalar(md3Surface_t *surf, float backlerp)
static void LerpMeshVertexes(md3Surface_t *surf, float backlerp)
{
#if idppc_altivec
// !!! FIXME: figure out what's broken and remove this.
#ifndef NDEBUG
static int already_complained = 0;
if (!already_complained)
{
already_complained = 1;
Com_Printf("WARNING! FIXME! Altivec mesh lerping broken in debug builds!\n");
}
#else
extern cvar_t *com_altivec;
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
LerpMeshVertexes_altivec( surf, backlerp );
return;
}
#endif
#endif // idppc_altivec
LerpMeshVertexes_scalar( surf, backlerp );
#if idppc_altivec
// !!! FIXME: figure out what's broken and remove this.
#ifndef NDEBUG
static int already_complained = 0;
if (!already_complained) {
already_complained = 1;
Com_Printf("WARNING! FIXME! Altivec mesh lerping broken in debug builds!\n");
}
#else
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
LerpMeshVertexes_altivec( surf, backlerp );
return;
}
#endif
#endif // idppc_altivec
LerpMeshVertexes_scalar( surf, backlerp );
}

View File

@ -22,17 +22,8 @@ RMDIR=rmdir
BUILDDIR=build
BD=$(BUILDDIR)/
ifeq ($(PLATFORM),darwin)
LCC_CFLAGS += -DMACOS_X=1
endif
ifndef USE_CCACHE
USE_CCACHE=0
endif
ifeq ($(USE_CCACHE),1)
CC := ccache $(CC)
CXX := ccache $(CXX)
endif
ifeq ($(PLATFORM),SunOS)

View File

@ -54,7 +54,7 @@ DXSDK_DIR=C:/DXSDK
endif
ifndef USE_CCACHE
USE_CCACHE=1
USE_CCACHE=0
endif
export USE_CCACHE
@ -118,7 +118,6 @@ ifeq ($(PLATFORM),linux)
GLIBC=-glibc
CC=gcc
CXX=g++
ifeq ($(ARCH),alpha)
ARCH=axp
@ -138,9 +137,6 @@ ifeq ($(PLATFORM),linux)
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes -pipe
# Always include debug symbols...you can strip the binary later...
BASE_CFLAGS += -gfull
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1
ifeq ($(USE_OPENAL_DLOPEN),1)
@ -244,12 +240,11 @@ else # ifeq Linux
ifeq ($(PLATFORM),darwin)
GLIBC=
CC=gcc
CXX=g++
VM_PPC=vm_ppc_new
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
BASE_CFLAGS += -DMACOS_X=1 -fno-common -pipe
BASE_CFLAGS += -DMACOS_X -fno-common -pipe
# Always include debug symbols...you can strip the binary later...
BASE_CFLAGS += -gfull
@ -269,7 +264,7 @@ ifeq ($(PLATFORM),darwin)
OPTIMIZE = -O3 -ffast-math -fomit-frame-pointer -falign-loops=16
ifeq ($(ARCH),ppc)
BASE_CFLAGS += -faltivec
BASE_CFLAGS += -faltivec
ifneq ($(VM_PPC),)
HAVE_VM_COMPILED=true
endif
@ -300,7 +295,7 @@ ifeq ($(PLATFORM),darwin)
ifeq ($(USE_SDL),1)
# We copy sdlmain before ranlib'ing it so that subversion doesn't think
# the file has been modified by each build.
LIBSDLMAIN=$(B)/libSDLmain.a
LIBSDLMAIN=$(B)/libSDLmain.a
LIBSDLMAINSRC=../libs/macosx/libSDLmain.a
CLIENT_LDFLAGS=-framework Cocoa -framework OpenGL ../libs/macosx/libSDL-1.2.0.dylib
else
@ -345,7 +340,6 @@ ifeq ($(PLATFORM),mingw32)
GLIBC=-mingw
CC=gcc
CXX=g++
WINDRES=windres
ifeq ($(ARCH),i386)
@ -508,7 +502,6 @@ ifeq ($(PLATFORM),SunOS)
GLIBC= #libc is irrelevant
CC=gcc
CXX=g++
INSTALL=ginstall
MKDIR=gmkdir
COPYDIR="/usr/local/share/games/quake3"
@ -636,7 +629,6 @@ endif #SunOS
ifeq ($(USE_CCACHE),1)
CC := ccache $(CC)
CXX := ccache $(CXX)
endif
ifneq ($(BUILD_SERVER),1)
@ -668,7 +660,6 @@ ifeq ($(GENERATE_DEPENDENCIES),1)
endif
DO_CC=$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
DO_CXX=$(CXX) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
DO_SMP_CC=$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DSMP -o $@ -c $<
DO_BOT_CC=$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DBOTLIB -o $@ -c $< # $(SHLIBCFLAGS) # bk001212
DO_DEBUG_CC=$(CC) $(NOTSHLIBCFLAGS) $(DEBUG_CFLAGS) -o $@ -c $<
@ -1007,11 +998,11 @@ ifeq ($(PLATFORM),darwin)
$(B)/client/sdl_snd.o \
ifeq ($(ARCH),i386)
I386OBJS := \
$(B)/client/ftola.o \
$(B)/client/snapvectora.o \
$(B)/client/snd_mixa.o \
$(B)/client/matha.o \
I386OBJS := \
$(B)/client/ftola.o \
$(B)/client/snapvectora.o \
$(B)/client/snd_mixa.o \
$(B)/client/matha.o \
Q3POBJ += $(I386OBJS)
Q3POBJ_SMP += $(I386OBJS)
@ -1344,7 +1335,7 @@ ifeq ($(ARCH),ppc)
endif
$(B)/$(PLATFORM)q3ded$(BINEXT): $(Q3DOBJ)
$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS)
$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS)
$(B)/ded/sv_bot.o : $(SDIR)/sv_bot.c; $(DO_DED_CC)
$(B)/ded/sv_client.o : $(SDIR)/sv_client.c; $(DO_DED_CC)
@ -1459,7 +1450,7 @@ Q3CGOBJ = $(Q3CGOBJ_) $(B)/baseq3/cgame/cg_syscalls.o
Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) : $(Q3CGOBJ)
$(CC) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
$(CC) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
$(B)/baseq3/vm/cgame.qvm: $(Q3CGVMOBJ) $(CGDIR)/cg_syscalls.asm
$(Q3ASM) -o $@ $(Q3CGVMOBJ) $(CGDIR)/cg_syscalls.asm
@ -1550,7 +1541,7 @@ Q3GOBJ = $(Q3GOBJ_) $(B)/baseq3/game/g_syscalls.o
Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) : $(Q3GOBJ)
$(CC) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
$(CC) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
$(B)/baseq3/vm/qagame.qvm: $(Q3GVMOBJ) $(GDIR)/g_syscalls.asm
$(Q3ASM) -o $@ $(Q3GVMOBJ) $(GDIR)/g_syscalls.asm

View File

@ -267,10 +267,10 @@ static void install_grabs(void)
// This is a bug in the current SDL/macosx...have to toggle it a few
// times to get the cursor to hide.
#if defined(MACOS_X)
#if defined(MACOS_X)
SDL_ShowCursor(1);
SDL_ShowCursor(0);
#endif
#endif
}
static void uninstall_grabs(void)

View File

@ -364,24 +364,22 @@ void Sys_Quit (void) {
static void Sys_DetectAltivec(void)
{
extern cvar_t *com_altivec;
// Only detect if user hasn't forcibly disabled it.
if (com_altivec->integer) {
#if idppc_altivec
#if MACOS_X
{
long feat = 0;
OSErr err = Gestalt(gestaltPowerPCProcessorFeatures, &feat);
if ((err==noErr) && ((1 << gestaltPowerPCHasVectorInstructions) & feat))
com_altivec->integer = 1;
}
#else // !!! FIXME: PowerPC Linux, etc: how to detect?
com_altivec->integer = 1;
#endif
#else
com_altivec->integer = 0; // not an Altivec system, so never use it.
#endif
#if idppc_altivec
#ifdef MACOS_X
long feat = 0;
OSErr err = Gestalt(gestaltPowerPCProcessorFeatures, &feat);
if ((err==noErr) && ((1 << gestaltPowerPCHasVectorInstructions) & feat)) {
Cvar_Set( "com_altivec", "1" );
}
#else // !!! FIXME: PowerPC Linux, etc: how to detect?
Cvar_Set( "com_altivec", "1" );
#endif
#else
// not an Altivec system, so never use it.
Cvar_Set( "com_altivec", "0" );
#endif
}
}
@ -705,9 +703,9 @@ void Sys_UnloadDll( void *dllHandle ) {
return;
}
#if USE_SDL_VIDEO
#if USE_SDL_VIDEO
SDL_UnloadObject(dllHandle);
#else
#else
dlclose( dllHandle );
{
const char* err; // rb010123 - now const
@ -715,7 +713,7 @@ void Sys_UnloadDll( void *dllHandle ) {
if ( err != NULL )
Com_Printf ( "Sys_UnloadGame failed on dlclose: \"%s\"!\n", err );
}
#endif
#endif
}
@ -745,11 +743,11 @@ static void* try_dlopen(const char* base, const char* gamedir, const char* fname
fn = FS_BuildOSPath( base, gamedir, fname );
Com_Printf( "Sys_LoadDll(%s)... \n", fn );
#if USE_SDL_VIDEO
#if USE_SDL_VIDEO
libHandle = SDL_LoadObject(fn);
#else
#else
libHandle = dlopen( fn, Q_RTLD );
#endif
#endif
if(!libHandle) {
Com_Printf( "Sys_LoadDll(%s) failed:\n\"%s\"\n", fn, do_dlerror() );
@ -827,14 +825,15 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
#else
Com_Printf ( "Sys_LoadDll(%s) failed dlsym(vmMain):\n\"%s\" !\n", name, err );
#endif
#if USE_SDL_VIDEO
#if USE_SDL_VIDEO
SDL_UnloadObject(libHandle);
#else
#else
dlclose( libHandle );
err = do_dlerror();
if ( err != NULL )
if ( err != NULL ) {
Com_Printf ( "Sys_LoadDll(%s) failed dlcose:\n\"%s\"\n", name, err );
#endif
}
#endif
return NULL;
}