Merge the trunk back into the openal branch.

This commit is contained in:
Yamagi Burmeister 2012-04-23 14:09:33 +00:00
commit 4ff4bf09e9
10 changed files with 53 additions and 42 deletions

View File

@ -9,6 +9,8 @@ Quake II 4.03 to 4.10
- Reenable support for gamma via SDL, since the upstream
bug was fixed with SDL 1.2.15. Gamma via X11 can be
forced by defining X11GAMMA at compile time.
- Add support for big endian architectures and enable
the build on SPARC64 CPUs. (by Kieron Gillespie)
Quake II 4.02 to 4.03
- Fix wrong function call in the Quake II file system.

View File

@ -12,7 +12,6 @@
# - libGL #
# - libvorbis #
# - libogg #
# - X11 (libX11, Xxf86vm) #
# - zlib #
# #
# Platforms: #
@ -30,9 +29,11 @@ ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/amd64/x86_64/)
# (You'll need some #ifdef for your unsupported plattform!)
ifneq ($(ARCH),i386)
ifneq ($(ARCH),x86_64)
ifneq ($(ARCH),sparc64)
$(error arch $(ARCH) is currently not supported)
endif
endif
endif
# ----------
@ -67,12 +68,6 @@ SDLCFLAGS := $(shell sdl-config --cflags)
# ----------
# Extra CFLAGS for X11
X11CFLAGS := $(shell pkg-config x11 --cflags)
X11CFLAGS += $(shell pkg-config xxf86vm --cflags)
# ----------
# Base include path.
ifeq ($(OSTYPE),Linux)
INCLUDE := -I/usr/include
@ -96,12 +91,6 @@ SDLLDFLAGS := $(shell sdl-config --libs)
# ----------
# Extra LDFLAGS for X11
X11LDFLAGS := $(shell pkg-config x11 --libs)
X11LDFLAGS += $(shell pkg-config xxf86vm --libs)
# ----------
# When make is invoked by "make VERBOSE=1" print
# the compiler and linker commands.
@ -134,8 +123,9 @@ client:
build/client/%.o: %.c
@echo '===> CC $<'
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(X11CFLAGS) $(SDLCFLAGS) $(INCLUDE) -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"' -o $@ $<
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"'
release/quake2 : LDFLAGS += -lvorbis -lvorbisfile -logg -lz -lopenal
# ----------
@ -308,7 +298,7 @@ CLIENT_OBJS_ := \
src/server/sv_world.o \
src/unix/glob.o \
src/unix/hunk.o \
src/unix/misc.o \
src/unix/main.o \
src/unix/network.o \
src/unix/signalhandler.o \
src/unix/system.o \
@ -354,7 +344,7 @@ SERVER_OBJS_ := \
src/server/sv_world.o \
src/unix/glob.o \
src/unix/hunk.o \
src/unix/misc.o \
src/unix/main.o \
src/unix/network.o \
src/unix/signalhandler.o \
src/unix/system.o
@ -385,7 +375,6 @@ OPENGL_OBJS_ = \
src/common/shared/shared.o \
src/unix/glob.o \
src/unix/hunk.o \
src/unix/misc.o \
src/unix/qgl.o
# ----------
@ -427,7 +416,7 @@ release/q2ded : $(SERVER_OBJS)
# release/ref_gl.so
release/ref_gl.so : $(OPENGL_OBJS)
@echo '===> LD $@'
${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) $(X11LDFLAGS) -o $@
${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) -o $@
# release/baseq2/game.so
release/baseq2/game.so : $(GAME_OBJS)

View File

@ -32,7 +32,7 @@
#include "shared.h"
#include "crc.h"
#define VERSION 4.03
#define VERSION 4.10
#define BASEDIRNAME "baseq2"
#if defined __linux__
@ -47,6 +47,8 @@
#define CPUSTRING "i386"
#elif defined __x86_64__
#define CPUSTRING "amd64"
#elif defined __sparc__
#define CPUSTRING "sparc64"
#else
#define CPUSTRING "Unknown"
#endif

View File

@ -196,6 +196,8 @@ void Com_sprintf(char *dest, int size, char *fmt, ...);
void Com_PageInMemory(byte *buffer, int size);
char *strlwr ( char *s );
/* ============================================= */
/* portable case insensitive compare */

View File

@ -48,8 +48,8 @@ void FloodArea_r (carea_t *area, int floodnum)
for (i=0 ; i<area->numareaportals ; i++, p++)
{
if (portalopen[p->portalnum])
FloodArea_r (&map_areas[p->otherarea], floodnum);
if (portalopen[LittleLong(p->portalnum)])
FloodArea_r (&map_areas[LittleLong(p->otherarea)], floodnum);
}
}

View File

@ -87,7 +87,7 @@ byte *CM_ClusterPVS (int cluster)
memset (pvsrow, 0, (numclusters+7)>>3);
else
CM_DecompressVis (map_visibility + map_vis->bitofs[cluster][DVIS_PVS], pvsrow);
CM_DecompressVis (map_visibility + LittleLong(map_vis->bitofs[cluster][DVIS_PVS]), pvsrow);
return pvsrow;
}
@ -98,7 +98,7 @@ byte *CM_ClusterPHS (int cluster)
memset (phsrow, 0, (numclusters+7)>>3);
else
CM_DecompressVis (map_visibility + map_vis->bitofs[cluster][DVIS_PHS], phsrow);
CM_DecompressVis (map_visibility + LittleLong(map_vis->bitofs[cluster][DVIS_PHS]), phsrow);
return phsrow;
}

View File

@ -24,6 +24,8 @@
* =======================================================================
*/
#include <ctype.h>
#include "../header/shared.h"
#define DEG2RAD(a) (a * M_PI) / 180.0F
@ -791,8 +793,8 @@ BigShort(short l)
short
LittleShort(short l)
{return
_LittleShort(l);
{
return _LittleShort(l);
}
int
@ -893,6 +895,7 @@ Swap_Init(void)
_LittleLong = LongNoSwap;
_BigFloat = FloatSwap;
_LittleFloat = FloatNoSwap;
Com_Printf("Byte ordering: little endian\n\n");
}
else
{
@ -903,7 +906,11 @@ Swap_Init(void)
_LittleLong = LongSwap;
_BigFloat = FloatNoSwap;
_LittleFloat = FloatSwap;
Com_Printf("Byte ordering: big endian\n\n");
}
if (LittleShort(*(short *)swaptest) != 1)
assert("Error in the endian conversion!");
}
/*
@ -1110,6 +1117,20 @@ Com_sprintf(char *dest, int size, char *fmt, ...)
strcpy(dest, bigbuffer);
}
char *
strlwr ( char *s )
{
char *p = s;
while ( *s )
{
*s = tolower( *s );
s++;
}
return ( p );
}
/*
* =====================================================================
*

View File

@ -96,6 +96,8 @@
#define ARCH "i386"
#elif defined(__x86_64__)
#define ARCH "amd64"
#elif defined(__sparc__)
#define ARCH "sparc64"
#else
#define ARCH "unknown"
#endif

View File

@ -500,7 +500,7 @@ R_DrawParticles ( void )
qglEnable( GL_BLEND );
qglDisable( GL_TEXTURE_2D );
qglPointSize( gl_particle_size->value );
qglPointSize( LittleFloat(gl_particle_size->value) );
qglBegin( GL_POINTS );

View File

@ -19,13 +19,14 @@
*
* =======================================================================
*
* This file implements some misc stuff like the main loop
* This file is the starting point of the program and implements
* the main loop
*
* =======================================================================
*/
#include <ctype.h>
#include <fcntl.h>
#include <locale.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@ -36,20 +37,6 @@
cvar_t *nostdout;
uid_t saved_euid;
char *
strlwr ( char *s )
{
char *p = s;
while ( *s )
{
*s = tolower( *s );
s++;
}
return ( p );
}
int
main ( int argc, char **argv )
{
@ -62,9 +49,15 @@ main ( int argc, char **argv )
saved_euid = geteuid();
seteuid( getuid() );
/* enforce C locale */
setlocale(LC_ALL, "C");
printf( "\nYamagi Quake II v%4.2f\n", VERSION);
printf( "=====================\n\n");
printf("Platform: %s\n", BUILDSTRING);
printf("Architecture: %s\n", CPUSTRING);
Qcommon_Init( argc, argv );
fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | FNDELAY );