mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
Merge out new options framework from the trunk
This commit is contained in:
commit
2c3c203097
20 changed files with 314 additions and 19 deletions
91
Makefile
91
Makefile
|
@ -7,18 +7,46 @@
|
|||
# - SDL OpenGL-Refresher (ref_gl.so) #
|
||||
# - Quake II Game (baseq2) #
|
||||
# #
|
||||
# Dependencies: #
|
||||
# Base dependencies: #
|
||||
# - SDL 1.2 #
|
||||
# - libGL #
|
||||
# - libvorbis #
|
||||
# - libogg #
|
||||
# - zlib #
|
||||
# #
|
||||
# Platforms: #
|
||||
# - Linux #
|
||||
# - FreeBSD #
|
||||
# ------------------------------------------------------ #
|
||||
|
||||
# User configurable options
|
||||
# -------------------------
|
||||
|
||||
# Enables CD audio playback. CD audio playback is used
|
||||
# for the background music and doesn't add any further
|
||||
# dependencies. It should work on all platforms where
|
||||
# CD playback is supported by SDL.
|
||||
WITH_CDA=yes
|
||||
|
||||
# Enables OGG/Vorbis support. OGG/Vorbis files can be
|
||||
# used as a substitute of CD audio playback. Adds
|
||||
# dependencies to libogg, libvorbis and libvorbisfile.
|
||||
WITH_OGG=yes
|
||||
|
||||
# Enables retexturing support. Adds a dependency to
|
||||
# libjpeg
|
||||
WITH_RETEXTURING=yes
|
||||
|
||||
# Set the gamma via X11 and not via SDL. This works
|
||||
# around problems in some SDL version. Adds dependencies
|
||||
# to pkg-config, libX11 and libXxf86vm
|
||||
WITH_X11GAMMA=no
|
||||
|
||||
# Enables opening of ZIP files (also known as .pk3 packs).
|
||||
# Adds a dependency to libz
|
||||
WITH_ZIP=yes
|
||||
|
||||
# ====================================================== #
|
||||
# !!! DO NOT ALTER ANYTHING BELOW THIS LINE !!! #
|
||||
# ====================================================== #
|
||||
|
||||
# Check the OS type
|
||||
OSTYPE := $(shell uname -s)
|
||||
|
||||
|
@ -68,6 +96,16 @@ SDLCFLAGS := $(shell sdl-config --cflags)
|
|||
|
||||
# ----------
|
||||
|
||||
# Extra CFLAGS for X11
|
||||
ifeq ($(WITH_X11GAMMA),yes)
|
||||
X11CFLAGS := $(shell pkg-config x11 --cflags)
|
||||
X11CFLAGS += $(shell pkg-config xxf86vm --cflags)
|
||||
else
|
||||
X11CFLAGS :=
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
# Base include path.
|
||||
ifeq ($(OSTYPE),Linux)
|
||||
INCLUDE := -I/usr/include
|
||||
|
@ -91,6 +129,16 @@ SDLLDFLAGS := $(shell sdl-config --libs)
|
|||
|
||||
# ----------
|
||||
|
||||
# Extra LDFLAGS for X11
|
||||
ifeq ($(WITH_X11GAMMA),yes)
|
||||
X11LDFLAGS := $(shell pkg-config x11 --libs)
|
||||
X11LDFLAGS += $(shell pkg-config xxf86vm --libs)
|
||||
else
|
||||
X11LDFLAGS :=
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
# When make is invoked by "make VERBOSE=1" print
|
||||
# the compiler and linker commands.
|
||||
|
||||
|
@ -125,8 +173,19 @@ build/client/%.o: %.c
|
|||
${Q}mkdir -p $(@D)
|
||||
${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
|
||||
ifeq ($(WITH_CDA),yes)
|
||||
release/quake2 : CFLAGS += -DCDA
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_OGG),yes)
|
||||
release/quake2 : CFLAGS += -DOGG
|
||||
release/quake2 : LDFLAGS += -lvorbis -lvorbisfile -logg
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_ZIP),yes)
|
||||
release/quake2 : CFLAGS += -DZIP
|
||||
release/quake2 : LDFLAGS += -lz
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
|
@ -144,6 +203,11 @@ build/server/%.o: %.c
|
|||
release/q2ded : CFLAGS += -DDEDICATED_ONLY
|
||||
release/q2ded : LDFLAGS += -lz
|
||||
|
||||
ifeq ($(WITH_ZIP),yes)
|
||||
release/q2ded : CFLAGS += -DZIP
|
||||
release/q2ded : LDFLAGS += -lz
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
# The refresher
|
||||
|
@ -155,10 +219,19 @@ refresher:
|
|||
build/refresher/%.o: %.c
|
||||
@echo '===> CC $<'
|
||||
${Q}mkdir -p $(@D)
|
||||
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
|
||||
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(X11CFLAGS) $(INCLUDE) -o $@ $<
|
||||
|
||||
release/ref_gl.so : CFLAGS += -fPIC
|
||||
release/ref_gl.so : LDFLAGS += -shared -ljpeg
|
||||
release/ref_gl.so : LDFLAGS += -shared
|
||||
|
||||
ifeq ($(WITH_X11GAMMA),yes)
|
||||
release/ref_gl.so : CFLAGS += -DX11GAMMA
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_RETEXTURING),yes)
|
||||
release/ref_gl.so : CFLAGS += -DRETEXTURE
|
||||
release/ref_gl.so : LDFLAGS += -ljpeg
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
|
@ -416,7 +489,7 @@ release/q2ded : $(SERVER_OBJS)
|
|||
# release/ref_gl.so
|
||||
release/ref_gl.so : $(OPENGL_OBJS)
|
||||
@echo '===> LD $@'
|
||||
${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) -o $@
|
||||
${Q}$(CC) $(OPENGL_OBJS) $(LDFLAGS) $(X11LDFLAGS) -o $@
|
||||
|
||||
# release/baseq2/game.so
|
||||
release/baseq2/game.so : $(GAME_OBJS)
|
||||
|
|
4
README
4
README
|
@ -121,7 +121,9 @@ The same applies to the "ctf" capture the flag addon.
|
|||
After you have set up the game data (from the full version or the
|
||||
demo), you have to compile the Yamagi Quake II client.
|
||||
|
||||
You will need the following dependencies:
|
||||
You will need the following dependencies (by editing the Makefile
|
||||
the requirement of most of this depencenies can be removed, but
|
||||
it'll lead to the loss of features):
|
||||
- A libGL implementation (Mesa3D, nVidia, AMD Catalyst, etc.)
|
||||
- OpenGL system headers
|
||||
- libjpeg (6 or 8)
|
||||
|
|
|
@ -451,9 +451,13 @@ SCR_PlayCinematic(char *arg) {
|
|||
byte *palette;
|
||||
char name[MAX_OSPATH], *dot;
|
||||
|
||||
/* make sure CD isn't playing music */
|
||||
/* make sure background music is not playing */
|
||||
#ifdef CDA
|
||||
CDAudio_Stop();
|
||||
#endif
|
||||
#ifdef OGG
|
||||
OGG_Stop();
|
||||
#endif
|
||||
|
||||
cl.cinematicframe = 0;
|
||||
dot = strstr(arg, ".");
|
||||
|
|
|
@ -738,7 +738,9 @@ void CL_Frame (int msec)
|
|||
|
||||
/* update audio */
|
||||
S_Update (cl.refdef.vieworg, cl.v_forward, cl.v_right, cl.v_up);
|
||||
#ifdef CDA
|
||||
CDAudio_Update();
|
||||
#endif
|
||||
|
||||
/* advance local effects for next frame */
|
||||
CL_RunDLights ();
|
||||
|
@ -800,7 +802,9 @@ void CL_Init (void)
|
|||
|
||||
cls.disable_screen = true; /* don't draw yet */
|
||||
|
||||
#ifdef CDA
|
||||
CDAudio_Init ();
|
||||
#endif
|
||||
|
||||
CL_InitLocal ();
|
||||
|
||||
|
@ -824,8 +828,12 @@ void CL_Shutdown(void)
|
|||
|
||||
CL_WriteConfiguration ();
|
||||
|
||||
#ifdef CDA
|
||||
CDAudio_Shutdown ();
|
||||
#endif
|
||||
#ifdef OGG
|
||||
OGG_Stop();
|
||||
#endif
|
||||
S_Shutdown();
|
||||
VID_Shutdown();
|
||||
}
|
||||
|
|
|
@ -291,8 +291,12 @@ void CL_Disconnect (void)
|
|||
cls.connect_time = 0;
|
||||
|
||||
SCR_StopCinematic ();
|
||||
#ifdef OGG
|
||||
OGG_Stop();
|
||||
#endif
|
||||
#ifdef CDA
|
||||
CDAudio_Stop();
|
||||
#endif
|
||||
|
||||
if (cls.demorecording)
|
||||
CL_Stop_f ();
|
||||
|
|
|
@ -837,8 +837,11 @@ void CL_ParseConfigString (void) {
|
|||
|
||||
else if (i == CS_CDTRACK) {
|
||||
if (cl.refresh_prepped) {
|
||||
#ifdef CDA
|
||||
CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true);
|
||||
#endif
|
||||
|
||||
#ifdef OGG
|
||||
/* OGG/Vorbis */
|
||||
if (atoi(cl.configstrings[CS_CDTRACK]) < 10) {
|
||||
char tmp[3] = "0";
|
||||
|
@ -847,6 +850,7 @@ void CL_ParseConfigString (void) {
|
|||
} else {
|
||||
OGG_ParseCmd(cl.configstrings[CS_CDTRACK]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} else if (i >= CS_MODELS && i < CS_MODELS+MAX_MODELS) {
|
||||
|
|
|
@ -443,8 +443,12 @@ void SCR_DrawConsole (void) {
|
|||
void SCR_BeginLoadingPlaque (void) {
|
||||
S_StopAllSounds ();
|
||||
cl.sound_prepped = false; /* don't play ambients */
|
||||
#ifdef CDA
|
||||
CDAudio_Stop ();
|
||||
#endif
|
||||
#ifdef OGG
|
||||
OGG_Stop();
|
||||
#endif
|
||||
|
||||
if (cls.disable_screen)
|
||||
return;
|
||||
|
|
|
@ -302,13 +302,18 @@ void CL_PrepRefresh (void) {
|
|||
cl.refresh_prepped = true;
|
||||
cl.force_refdef = true; /* make sure we have a valid refdef */
|
||||
|
||||
#if defined(OGG) || defined(CDA)
|
||||
/* start the cd track */
|
||||
if (Cvar_VariableValue("cd_shuffle")) {
|
||||
#ifdef CDA
|
||||
CDAudio_RandomPlay();
|
||||
|
||||
#endif
|
||||
} else {
|
||||
#ifdef CDA
|
||||
CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true);
|
||||
#endif
|
||||
|
||||
#ifdef OGG
|
||||
/* OGG/Vorbis */
|
||||
if (atoi(cl.configstrings[CS_CDTRACK]) < 10) {
|
||||
char tmp[3] = "0";
|
||||
|
@ -317,7 +322,9 @@ void CL_PrepRefresh (void) {
|
|||
} else {
|
||||
OGG_ParseCmd(cl.configstrings[CS_CDTRACK]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
float CalcFov (float fov_x, float width, float height) {
|
||||
|
|
|
@ -998,9 +998,15 @@ static menulist_s s_options_lookspring_box;
|
|||
static menulist_s s_options_lookstrafe_box;
|
||||
static menulist_s s_options_crosshair_box;
|
||||
static menuslider_s s_options_sfxvolume_slider;
|
||||
#ifdef CDA
|
||||
static menulist_s s_options_cdvolume_box;
|
||||
#endif
|
||||
#if defined(OGG) || defined(CDA)
|
||||
static menulist_s s_options_cdshuffle_box;
|
||||
#endif
|
||||
#ifdef OGG
|
||||
static menulist_s s_options_oggvolume_box;
|
||||
#endif
|
||||
static menulist_s s_options_quality_list;
|
||||
static menulist_s s_options_console_action;
|
||||
|
||||
|
@ -1034,8 +1040,11 @@ static float ClampCvar( float min, float max, float value ) {
|
|||
|
||||
static void ControlsSetMenuItemValues( void ) {
|
||||
s_options_sfxvolume_slider.curvalue = Cvar_VariableValue( "s_volume" ) * 10;
|
||||
#ifdef CDA
|
||||
s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd");
|
||||
#endif
|
||||
|
||||
#ifdef OGG
|
||||
s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable");
|
||||
|
||||
cvar_t *ogg;
|
||||
|
@ -1043,9 +1052,9 @@ static void ControlsSetMenuItemValues( void ) {
|
|||
|
||||
if(!strcmp(ogg->string, "random"))
|
||||
s_options_cdshuffle_box.curvalue = 1;
|
||||
|
||||
else
|
||||
s_options_cdshuffle_box.curvalue = 0;
|
||||
#endif
|
||||
|
||||
s_options_quality_list.curvalue = !Cvar_VariableValue( "s_loadas8bit" );
|
||||
s_options_sensitivity_slider.curvalue = ( sensitivity->value ) * 2;
|
||||
|
@ -1092,9 +1101,11 @@ static void UpdateVolumeFunc( void *unused ) {
|
|||
Cvar_SetValue( "s_volume", s_options_sfxvolume_slider.curvalue / 10 );
|
||||
}
|
||||
|
||||
#if defined(OGG) || defined(CDA)
|
||||
static void CDShuffleFunc(void *unused) {
|
||||
Cvar_SetValue("cd_shuffle", s_options_cdshuffle_box.curvalue);
|
||||
|
||||
#ifdef OGG
|
||||
cvar_t *ogg;
|
||||
ogg = Cvar_Get("ogg_enable", "1", CVAR_ARCHIVE);
|
||||
|
||||
|
@ -1119,14 +1130,21 @@ static void CDShuffleFunc(void *unused) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CDA
|
||||
static void UpdateCDVolumeFunc( void *unused ) {
|
||||
Cvar_SetValue( "cd_nocd", (float)!s_options_cdvolume_box.curvalue );
|
||||
#ifdef OGG
|
||||
Cvar_SetValue( "ogg_enable", 0 );
|
||||
#endif
|
||||
|
||||
if (s_options_cdvolume_box.curvalue) {
|
||||
#ifdef OGG
|
||||
OGG_Shutdown();
|
||||
#endif
|
||||
CDAudio_Init();
|
||||
|
||||
if (s_options_cdshuffle_box.curvalue) {
|
||||
|
@ -1140,13 +1158,19 @@ static void UpdateCDVolumeFunc( void *unused ) {
|
|||
CDAudio_Stop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OGG
|
||||
static void UpdateOGGVolumeFunc( void *unused ) {
|
||||
Cvar_SetValue( "ogg_enable", (float)s_options_oggvolume_box.curvalue );
|
||||
#ifdef CDA
|
||||
Cvar_SetValue( "cd_nocd", 1 );
|
||||
#endif
|
||||
|
||||
if (s_options_oggvolume_box.curvalue) {
|
||||
#ifdef CDA
|
||||
CDAudio_Stop();
|
||||
#endif
|
||||
OGG_Init();
|
||||
OGG_Stop();
|
||||
|
||||
|
@ -1162,6 +1186,7 @@ static void UpdateOGGVolumeFunc( void *unused ) {
|
|||
OGG_Shutdown();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void Key_ClearTyping( void );
|
||||
static void ConsoleFunc( void *unused ) {
|
||||
|
@ -1200,23 +1225,29 @@ static void UpdateSoundQualityFunc( void *unused ) {
|
|||
}
|
||||
|
||||
static void Options_MenuInit( void ) {
|
||||
#ifdef CDA
|
||||
static const char *cd_music_items[] = {
|
||||
"disabled",
|
||||
"enabled",
|
||||
0
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef OGG
|
||||
static const char *ogg_music_items[] = {
|
||||
"disabled",
|
||||
"enabled",
|
||||
0
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(OGG) || defined(CDA)
|
||||
static const char *cd_shuffle[] = {
|
||||
"disabled",
|
||||
"enabled",
|
||||
0
|
||||
};
|
||||
#endif
|
||||
|
||||
static const char *quality_items[] = {
|
||||
"normal", "high", 0
|
||||
|
@ -1249,7 +1280,8 @@ static void Options_MenuInit( void ) {
|
|||
s_options_sfxvolume_slider.minvalue = 0;
|
||||
s_options_sfxvolume_slider.maxvalue = 10;
|
||||
s_options_sfxvolume_slider.curvalue = Cvar_VariableValue( "s_volume" ) * 10.0f;
|
||||
|
||||
|
||||
#ifdef CDA
|
||||
s_options_cdvolume_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_cdvolume_box.generic.x = 0;
|
||||
s_options_cdvolume_box.generic.y = 10;
|
||||
|
@ -1257,7 +1289,9 @@ static void Options_MenuInit( void ) {
|
|||
s_options_cdvolume_box.generic.callback = UpdateCDVolumeFunc;
|
||||
s_options_cdvolume_box.itemnames = cd_music_items;
|
||||
s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd");
|
||||
#endif
|
||||
|
||||
#ifdef OGG
|
||||
s_options_oggvolume_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_oggvolume_box.generic.x = 0;
|
||||
s_options_oggvolume_box.generic.y = 20;
|
||||
|
@ -1265,7 +1299,9 @@ static void Options_MenuInit( void ) {
|
|||
s_options_oggvolume_box.generic.callback = UpdateOGGVolumeFunc;
|
||||
s_options_oggvolume_box.itemnames = ogg_music_items;
|
||||
s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable");
|
||||
#endif
|
||||
|
||||
#if defined(OGG) || defined(CDA)
|
||||
s_options_cdshuffle_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_cdshuffle_box.generic.x = 0;
|
||||
s_options_cdshuffle_box.generic.y = 30;
|
||||
|
@ -1273,6 +1309,7 @@ static void Options_MenuInit( void ) {
|
|||
s_options_cdshuffle_box.generic.callback = CDShuffleFunc;
|
||||
s_options_cdshuffle_box.itemnames = cd_shuffle;
|
||||
s_options_cdshuffle_box.curvalue = Cvar_VariableValue("cd_shuffle");;
|
||||
#endif
|
||||
|
||||
s_options_quality_list.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_quality_list.generic.x = 0;
|
||||
|
@ -1353,9 +1390,15 @@ static void Options_MenuInit( void ) {
|
|||
ControlsSetMenuItemValues();
|
||||
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_sfxvolume_slider );
|
||||
#ifdef CDA
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_cdvolume_box );
|
||||
#endif
|
||||
#ifdef OGG
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_oggvolume_box );
|
||||
#endif
|
||||
#if defined(OGG) || defined(CDA)
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_cdshuffle_box );
|
||||
#endif
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_quality_list );
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_sensitivity_slider );
|
||||
Menu_AddItem( &s_options_menu, ( void * ) &s_options_alwaysrun_box );
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
#ifdef CDA
|
||||
|
||||
#ifndef CL_SOUND_CDAUDIO_H
|
||||
#define CL_SOUND_CDAUDIO_H
|
||||
|
||||
|
@ -36,4 +38,5 @@ void CDAudio_Activate (qboolean active);
|
|||
void CDAudio_RandomPlay(void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
#ifdef OGG
|
||||
|
||||
#ifndef CL_SOUND_VORBIS_H
|
||||
#define CL_SOUND_VORBIS_H
|
||||
|
||||
|
@ -68,4 +70,5 @@ void OGG_SeekCmd(void);
|
|||
void OGG_StatusCmd(void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -145,8 +145,10 @@ S_Init ( void )
|
|||
Cmd_AddCommand( "stopsound", S_StopAllSounds );
|
||||
Cmd_AddCommand( "soundlist", S_SoundList );
|
||||
Cmd_AddCommand( "soundinfo", S_SoundInfo_f );
|
||||
#ifdef OGG
|
||||
Cmd_AddCommand( "ogg_init", OGG_Init );
|
||||
Cmd_AddCommand( "ogg_shutdown", OGG_Shutdown );
|
||||
#endif
|
||||
|
||||
#if ! USE_OPENAL
|
||||
cv = Cvar_Get( "s_openal", "0", CVAR_ARCHIVE);
|
||||
|
@ -186,7 +188,9 @@ S_Init ( void )
|
|||
#endif
|
||||
|
||||
S_StopAllSounds();
|
||||
#ifdef OGG
|
||||
OGG_Init();
|
||||
#endif
|
||||
}
|
||||
|
||||
Com_Printf( "------------------------------------\n\n" );
|
||||
|
@ -235,7 +239,10 @@ S_Shutdown ( void )
|
|||
|
||||
num_sfx = 0;
|
||||
|
||||
#ifdef OGG
|
||||
OGG_Shutdown();
|
||||
#endif
|
||||
SNDDMA_Shutdown();
|
||||
|
||||
#if USE_OPENAL
|
||||
if( sound_started == SS_OAL )
|
||||
|
@ -252,8 +259,10 @@ S_Shutdown ( void )
|
|||
Cmd_RemoveCommand( "soundinfo" );
|
||||
Cmd_RemoveCommand( "play" );
|
||||
Cmd_RemoveCommand( "stopsound" );
|
||||
#ifdef OGG
|
||||
Cmd_RemoveCommand( "ogg_init" );
|
||||
Cmd_RemoveCommand( "ogg_shutdown" );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1335,8 +1344,16 @@ S_Update ( vec3_t origin, vec3_t forward, vec3_t right, vec3_t up )
|
|||
Com_Printf( "----(%i)---- painted: %i\n", total, paintedtime );
|
||||
}
|
||||
|
||||
#ifdef OGG
|
||||
/* stream music */
|
||||
OGG_Stream();
|
||||
#endif
|
||||
|
||||
/* mix some sound */
|
||||
if ( !sound_started )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SNDDMA_BeginPainting();
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
#ifdef OGG
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -827,3 +829,5 @@ OGG_StatusCmd ( void )
|
|||
}
|
||||
}
|
||||
|
||||
# endif /* OGG */
|
||||
|
||||
|
|
|
@ -27,7 +27,10 @@
|
|||
|
||||
#include "header/common.h"
|
||||
#include "../unix/header/glob.h"
|
||||
|
||||
#ifdef ZIP
|
||||
#include "unzip/unzip.h"
|
||||
#endif
|
||||
|
||||
#define MAX_HANDLES 512
|
||||
#define MAX_READ 0x10000
|
||||
|
@ -46,7 +49,9 @@ typedef struct
|
|||
char name[MAX_QPATH];
|
||||
fsMode_t mode;
|
||||
FILE *file; /* Only one will be used. */
|
||||
#ifdef ZIP
|
||||
unzFile *zip; /* (file or zip) */
|
||||
#endif
|
||||
} fsHandle_t;
|
||||
|
||||
typedef struct fsLink_s
|
||||
|
@ -69,7 +74,9 @@ typedef struct
|
|||
char name[MAX_OSPATH];
|
||||
int numFiles;
|
||||
FILE *pak;
|
||||
#ifdef ZIP
|
||||
unzFile *pk3;
|
||||
#endif
|
||||
fsPackFile_t *files;
|
||||
} fsPack_t;
|
||||
|
||||
|
@ -83,7 +90,9 @@ typedef struct fsSearchPath_s
|
|||
typedef enum
|
||||
{
|
||||
PAK,
|
||||
#ifdef ZIP
|
||||
PK3
|
||||
#endif
|
||||
} fsPackFormat_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -101,9 +110,11 @@ fsSearchPath_t *fs_baseSearchPaths;
|
|||
fsPackTypes_t fs_packtypes[] =
|
||||
{
|
||||
{"pak", PAK},
|
||||
#ifdef ZIP
|
||||
{"pk2", PK3},
|
||||
{"pk3", PK3},
|
||||
{"zip", PK3}
|
||||
#endif
|
||||
};
|
||||
|
||||
char fs_gamedir[MAX_OSPATH];
|
||||
|
@ -114,8 +125,10 @@ static qboolean fs_fileInPack;
|
|||
|
||||
/* Set by FS_FOpenFile. */
|
||||
int file_from_pak = 0;
|
||||
#ifdef ZIP
|
||||
int file_from_pk3 = 0;
|
||||
char file_from_pk3_name[MAX_QPATH];
|
||||
#endif
|
||||
|
||||
cvar_t *fs_homepath;
|
||||
cvar_t *fs_basedir;
|
||||
|
@ -262,8 +275,10 @@ FS_FileForHandle(fileHandle_t f)
|
|||
|
||||
handle = FS_GetFileByHandle(f);
|
||||
|
||||
#ifdef ZIP
|
||||
if (handle->zip != NULL)
|
||||
Com_Error(ERR_DROP, "FS_FileForHandle: can't get FILE on zip file");
|
||||
#endif
|
||||
|
||||
if (handle->file == NULL)
|
||||
Com_Error(ERR_DROP, "FS_FileForHandle: NULL");
|
||||
|
@ -284,7 +299,11 @@ FS_HandleForFile(const char *path, fileHandle_t * f)
|
|||
|
||||
for (i = 0; i < MAX_HANDLES; i++, handle++)
|
||||
{
|
||||
if (handle->file == NULL && handle->zip == NULL)
|
||||
if (handle->file == NULL
|
||||
#ifdef ZIP
|
||||
&& handle->zip == NULL
|
||||
#endif
|
||||
)
|
||||
{
|
||||
strncpy(handle->name, path, sizeof(handle->name));
|
||||
*f = i + 1;
|
||||
|
@ -382,7 +401,9 @@ FS_FOpenFileRead(fsHandle_t * handle)
|
|||
fsPack_t *pack;
|
||||
|
||||
file_from_pak = 0;
|
||||
#ifdef ZIP
|
||||
file_from_pk3 = 0;
|
||||
#endif
|
||||
|
||||
/* Search through the path, one element at a time. */
|
||||
for (search = fs_searchPaths; search; search = search->next)
|
||||
|
@ -417,6 +438,7 @@ FS_FOpenFileRead(fsHandle_t * handle)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ZIP
|
||||
else if (pack->pk3)
|
||||
{
|
||||
/* PK3 */
|
||||
|
@ -435,6 +457,7 @@ FS_FOpenFileRead(fsHandle_t * handle)
|
|||
unzClose(handle->zip);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Com_Error(ERR_FATAL, "Couldn't reopen '%s'", pack->name);
|
||||
}
|
||||
|
@ -495,11 +518,13 @@ FS_FCloseFile(fileHandle_t f)
|
|||
if (handle->file)
|
||||
fclose(handle->file);
|
||||
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
{
|
||||
unzCloseCurrentFile(handle->zip);
|
||||
unzClose(handle->zip);
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(handle, 0, sizeof(*handle));
|
||||
}
|
||||
|
@ -607,8 +632,10 @@ FS_Read(void *buffer, int size, fileHandle_t f)
|
|||
if (handle->file)
|
||||
r = fread(buf, 1, remaining, handle->file);
|
||||
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
r = unzReadCurrentFile(handle->zip, buf, remaining);
|
||||
#endif
|
||||
|
||||
else
|
||||
return (0);
|
||||
|
@ -669,8 +696,10 @@ FS_FRead(void *buffer, int size, int count, fileHandle_t f)
|
|||
if (handle->file)
|
||||
r = fread(buf, 1, remaining, handle->file);
|
||||
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
r = unzReadCurrentFile(handle->zip, buf, remaining);
|
||||
#endif
|
||||
|
||||
else
|
||||
return (0);
|
||||
|
@ -726,8 +755,10 @@ FS_Write(const void *buffer, int size, fileHandle_t f)
|
|||
if (handle->file)
|
||||
w = fwrite(buf, 1, remaining, handle->file);
|
||||
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
Com_Error(ERR_FATAL, "FS_Write: can't write to zip file '%s'", handle->name);
|
||||
#endif
|
||||
|
||||
else
|
||||
return (0);
|
||||
|
@ -758,8 +789,10 @@ FS_FTell(fileHandle_t f)
|
|||
if (handle->file)
|
||||
return ftell(handle->file);
|
||||
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
return unztell(handle->zip);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -819,12 +852,14 @@ FS_ListPak(char *find, int *num)
|
|||
void
|
||||
FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin)
|
||||
{
|
||||
#ifdef ZIP
|
||||
byte dummy[0x8000]; /* Dummy buffer to skip bytes. */
|
||||
int len; /* Length of byte chunk to skip. */
|
||||
int r; /* Number of bytes read. */
|
||||
int remaining = 0; /* Remaining bytes to skip. */
|
||||
fsHandle_t *handle; /* File handle. */
|
||||
unz_file_info info; /* ZIP information. */
|
||||
#endif
|
||||
fsHandle_t *handle; /* File handle. */
|
||||
|
||||
handle = FS_GetFileByHandle(f);
|
||||
|
||||
|
@ -847,6 +882,7 @@ FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
{
|
||||
switch (origin)
|
||||
|
@ -886,6 +922,7 @@ FS_Seek(fileHandle_t f, int offset, fsOrigin_t origin)
|
|||
remaining -= r;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -901,8 +938,10 @@ FS_Tell(fileHandle_t f)
|
|||
if (handle->file)
|
||||
return (ftell(handle->file));
|
||||
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
return (unztell(handle->zip));
|
||||
#endif
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
@ -1047,7 +1086,9 @@ FS_LoadPAK(const char *packPath)
|
|||
pack = Z_Malloc(sizeof(fsPack_t));
|
||||
strncpy(pack->name, packPath, sizeof(pack->name));
|
||||
pack->pak = handle;
|
||||
#ifdef ZIP
|
||||
pack->pk3 = NULL;
|
||||
#endif
|
||||
pack->numFiles = numFiles;
|
||||
pack->files = files;
|
||||
|
||||
|
@ -1056,6 +1097,7 @@ FS_LoadPAK(const char *packPath)
|
|||
return (pack);
|
||||
}
|
||||
|
||||
#ifdef ZIP
|
||||
/*
|
||||
* Takes an explicit (not game tree related) path to a pack file.
|
||||
*
|
||||
|
@ -1121,6 +1163,7 @@ FS_LoadPK3(const char *packPath)
|
|||
|
||||
return (pack);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Adds the directory to the head of the path, then loads and adds pak1.pak
|
||||
|
@ -1163,9 +1206,11 @@ FS_AddGameDirectory(const char *dir)
|
|||
case PAK:
|
||||
pack = FS_LoadPAK(path);
|
||||
break;
|
||||
#ifdef ZIP
|
||||
case PK3:
|
||||
pack = FS_LoadPK3(path);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pack == NULL)
|
||||
|
@ -1198,9 +1243,11 @@ FS_AddGameDirectory(const char *dir)
|
|||
case PAK:
|
||||
pack = FS_LoadPAK(list[j]);
|
||||
break;
|
||||
#ifdef ZIP
|
||||
case PK3:
|
||||
pack = FS_LoadPK3(list[j]);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pack == NULL)
|
||||
|
@ -1315,14 +1362,22 @@ FS_Path_f(void)
|
|||
Com_Printf("\n");
|
||||
|
||||
for (i = 0, handle = fs_handles; i < MAX_HANDLES; i++, handle++)
|
||||
if (handle->file != NULL || handle->zip != NULL)
|
||||
if (handle->file != NULL
|
||||
#ifdef ZIP
|
||||
|| handle->zip != NULL
|
||||
#endif
|
||||
)
|
||||
Com_Printf("Handle %i: '%s'.\n", i + 1, handle->name);
|
||||
|
||||
for (i = 0, link = fs_links; link; i++, link = link->next)
|
||||
Com_Printf("Link %i: '%s' -> '%s'.\n", i, link->from, link->to);
|
||||
|
||||
Com_Printf("----------------------\n");
|
||||
#ifdef ZIP
|
||||
Com_Printf("%i files in PAK/PK2/PK3/ZIP files.\n", totalFiles);
|
||||
#else
|
||||
Com_Printf("%i files in PAK/PK2 files.\n", totalFiles);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1354,8 +1409,10 @@ FS_Startup(void)
|
|||
if (pack->pak != NULL)
|
||||
fclose(pack->pak);
|
||||
|
||||
#ifdef ZIP
|
||||
if (pack->pk3 != NULL)
|
||||
unzClose(pack->pk3);
|
||||
#endif
|
||||
|
||||
Z_Free(pack->files);
|
||||
Z_Free(pack);
|
||||
|
@ -1369,7 +1426,11 @@ FS_Startup(void)
|
|||
/* Close open files for game dir. */
|
||||
for (i = 0; i < MAX_HANDLES; i++)
|
||||
if (strstr(fs_handles[i].name, fs_currentGame) &&
|
||||
(fs_handles[i].file != NULL || fs_handles[i].zip != NULL))
|
||||
(fs_handles[i].file != NULL
|
||||
#ifdef ZIP
|
||||
|| fs_handles[i].zip != NULL
|
||||
#endif
|
||||
))
|
||||
FS_FCloseFile(i);
|
||||
|
||||
/* Don't add baseq2 again. */
|
||||
|
@ -1429,8 +1490,10 @@ FS_SetGamedir(char *dir)
|
|||
if (fs_searchPaths->pack->pak)
|
||||
fclose(fs_searchPaths->pack->pak);
|
||||
|
||||
#ifdef ZIP
|
||||
if (fs_searchPaths->pack->pk3)
|
||||
unzClose(fs_searchPaths->pack->pk3);
|
||||
#endif
|
||||
|
||||
Z_Free(fs_searchPaths->pack->files);
|
||||
Z_Free(fs_searchPaths->pack);
|
||||
|
@ -1444,7 +1507,11 @@ FS_SetGamedir(char *dir)
|
|||
/* Close open files for game dir. */
|
||||
for (i = 0; i < MAX_HANDLES; i++)
|
||||
if (strstr(fs_handles[i].name, dir) &&
|
||||
(fs_handles[i].file != NULL || fs_handles[i].zip != NULL))
|
||||
(fs_handles[i].file != NULL
|
||||
#ifdef ZIP
|
||||
|| fs_handles[i].zip != NULL
|
||||
#endif
|
||||
))
|
||||
FS_FCloseFile(i);
|
||||
|
||||
/* Flush all data, so it will be forced to reload. */
|
||||
|
@ -1881,11 +1948,13 @@ FS_Shutdown(void)
|
|||
if (handle->file != NULL)
|
||||
fclose(handle->file);
|
||||
|
||||
#ifdef ZIP
|
||||
if (handle->zip != NULL)
|
||||
{
|
||||
unzCloseCurrentFile(handle->zip);
|
||||
unzClose(handle->zip);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Free the search paths. */
|
||||
|
@ -1898,8 +1967,10 @@ FS_Shutdown(void)
|
|||
if (pack->pak != NULL)
|
||||
fclose(pack->pak);
|
||||
|
||||
#ifdef ZIP
|
||||
if (pack->pk3 != NULL)
|
||||
unzClose(pack->pk3);
|
||||
#endif
|
||||
|
||||
Z_Free(pack->files);
|
||||
Z_Free(pack);
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
#ifdef RETEXTURE
|
||||
|
||||
#include "../header/local.h"
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
@ -169,3 +171,5 @@ LoadJPG(char *origname, byte **pic, int *width, int *height)
|
|||
*pic = rgbadata;
|
||||
}
|
||||
|
||||
#endif /* RETEXTURE */
|
||||
|
||||
|
|
|
@ -200,7 +200,9 @@ extern cvar_t *gl_mode;
|
|||
extern cvar_t *gl_customwidth;
|
||||
extern cvar_t *gl_customheight;
|
||||
|
||||
#ifdef RETEXTURE
|
||||
extern cvar_t *gl_retexturing;
|
||||
#endif
|
||||
|
||||
extern cvar_t *gl_log;
|
||||
extern cvar_t *gl_lightmap;
|
||||
|
|
|
@ -1069,6 +1069,7 @@ R_FindImage ( char *name, imagetype_t type )
|
|||
|
||||
if ( !strcmp( name + len - 4, ".pcx" ) )
|
||||
{
|
||||
#ifdef RETEXTURE
|
||||
if (gl_retexturing->value)
|
||||
{
|
||||
GetPCXInfo( name, &realwidth, &realheight );
|
||||
|
@ -1108,6 +1109,7 @@ R_FindImage ( char *name, imagetype_t type )
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
LoadPCX( name, &pic, &palette, &width, &height );
|
||||
|
||||
|
@ -1121,6 +1123,7 @@ R_FindImage ( char *name, imagetype_t type )
|
|||
}
|
||||
else if ( !strcmp( name + len - 4, ".wal" ) )
|
||||
{
|
||||
#ifdef RETEXTURE
|
||||
if (gl_retexturing->value)
|
||||
{
|
||||
/* Get size of the original texture */
|
||||
|
@ -1158,6 +1161,7 @@ R_FindImage ( char *name, imagetype_t type )
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
image = LoadWal( name );
|
||||
|
||||
|
|
|
@ -134,7 +134,9 @@ cvar_t *gl_mode;
|
|||
cvar_t *gl_customwidth;
|
||||
cvar_t *gl_customheight;
|
||||
|
||||
#ifdef RETEXTURE
|
||||
cvar_t *gl_retexturing;
|
||||
#endif
|
||||
|
||||
cvar_t *gl_dynamic;
|
||||
cvar_t *gl_modulate;
|
||||
|
@ -1012,7 +1014,9 @@ R_Register ( void )
|
|||
gl_customwidth = ri.Cvar_Get( "gl_customwidth", "1024", CVAR_ARCHIVE );
|
||||
gl_customheight = ri.Cvar_Get( "gl_customheight", "768", CVAR_ARCHIVE );
|
||||
|
||||
#ifdef RETEXTURE
|
||||
gl_retexturing = ri.Cvar_Get( "gl_retexturing", "1", CVAR_ARCHIVE );
|
||||
#endif
|
||||
|
||||
ri.Cmd_AddCommand( "imagelist", R_ImageList_f );
|
||||
ri.Cmd_AddCommand( "screenshot", R_ScreenShot );
|
||||
|
@ -1092,6 +1096,19 @@ R_Init ( void *hinstance, void *hWnd )
|
|||
r_turbsin [ j ] *= 0.5;
|
||||
}
|
||||
|
||||
/* Options */
|
||||
Com_Printf("Refresher build options:\n");
|
||||
#ifdef RETEXTURE
|
||||
Com_Printf(" + Retexturing support\n");
|
||||
#else
|
||||
Com_Printf(" - Retexturing support\n");
|
||||
#endif
|
||||
#ifdef X11GAMA
|
||||
Com_Printf(" + Gamma via X11\n");
|
||||
#else
|
||||
Com_Printf(" - Gamma via X11\n");
|
||||
#endif
|
||||
|
||||
ri.Con_Printf( PRINT_ALL, "Refresh: " REF_VERSION "\n" );
|
||||
|
||||
Draw_GetPalette();
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
#ifdef CDA
|
||||
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
#include "../client/header/client.h"
|
||||
|
@ -514,3 +516,5 @@ CDAudio_Activate ( qboolean active )
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* CDA */
|
||||
|
||||
|
|
|
@ -55,6 +55,23 @@ main ( int argc, char **argv )
|
|||
printf( "\nYamagi Quake II v%4.2f\n", VERSION);
|
||||
printf( "=====================\n\n");
|
||||
|
||||
printf("Client build options:\n");
|
||||
#ifdef CDA
|
||||
printf(" + CD audio\n");
|
||||
#else
|
||||
printf(" - CD audio\n");
|
||||
#endif
|
||||
#ifdef OGG
|
||||
printf(" + OGG/Vorbis\n");
|
||||
#else
|
||||
printf(" - OGG/Vorbis\n");
|
||||
#endif
|
||||
#ifdef ZIP
|
||||
printf(" + Zip file support\n");
|
||||
#else
|
||||
printf(" - Zip file support\n");
|
||||
#endif
|
||||
|
||||
printf("Platform: %s\n", BUILDSTRING);
|
||||
printf("Architecture: %s\n", CPUSTRING);
|
||||
|
||||
|
|
Loading…
Reference in a new issue