Merge in relnev's changes.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-01-12 02:14:09 +00:00
parent cade93fb95
commit 1d758ae3c4
65 changed files with 1400 additions and 1958 deletions

View file

@ -11,7 +11,7 @@
# Here are your build options, no more will be added!
# (Note: not all options are available for all platforms).
# quake2 (uses OSS for sound, cdrom ioctls for cd audio) is automatically built.
# gamei386.so is automatically built.
# game{i386,axp,ppc}.so is automatically built.
BUILD_SDLQUAKE2=YES # sdlquake2 executable (uses SDL for cdrom and sound)
BUILD_SVGA=YES # SVGAlib driver. Seems to work fine.
BUILD_X11=YES # X11 software driver. Works somewhat ok.
@ -35,28 +35,35 @@ ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/ar
ifneq ($(ARCH),i386)
ifneq ($(ARCH),axp)
ifneq ($(ARCH),ppc)
ifneq ($(ARCH),sparc)
$(error arch $(ARCH) is currently not supported)
endif
endif
endif
endif
CC=gcc
ifeq ($(ARCH),axp)
RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations
endif
ifeq ($(ARCH),ppc)
RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations
endif
ifeq ($(ARCH),sparc)
RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations
endif
ifeq ($(ARCH),i386)
RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -malign-loops=2 \
-malign-jumps=2 -malign-functions=2 -g
-malign-jumps=2 -malign-functions=2
# compiler bugs with gcc 2.96 and 3.0.1 can cause bad builds with heavy opts.
#RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -m486 -ffast-math -funroll-loops \
#RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -march=i686 -ffast-math -funroll-loops \
# -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
# -malign-jumps=2 -malign-functions=2
endif
@ -127,7 +134,7 @@ endif
ifeq ($(ARCH),axp)
ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
$(warning Warning: SDLQuake2 not supported for $(ARCH))
TARGETS += $(BUILDDIR)/sdlquake2
endif
ifeq ($(strip $(BUILD_SVGA)),YES)
@ -184,7 +191,7 @@ ifeq ($(ARCH),ppc)
TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT)
endif
endif # ARCH ppc
ifeq ($(ARCH),i386)
ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
TARGETS += $(BUILDDIR)/sdlquake2

View file

@ -24,3 +24,4 @@ void CDAudio_Play(int track, qboolean looping);
void CDAudio_Stop(void);
void CDAudio_Update(void);
void CDAudio_Activate (qboolean active);
void CDAudio_RandomPlay (void);

View file

@ -387,10 +387,10 @@ rest of the data stream.
*/
void CL_ParsePacketEntities (frame_t *oldframe, frame_t *newframe)
{
int newnum;
int bits;
entity_state_t *oldstate = 0;
int oldindex, oldnum;
int newnum;
unsigned int bits;
entity_state_t *oldstate = NULL;
int oldindex, oldnum;
newframe->parse_entities = cl.parse_entities;
newframe->num_entities = 0;

View file

@ -2209,7 +2209,7 @@ void CL_AddParticles (void)
}
else
{
time = 0;
time = 0.0;
alpha = p->alpha;
}

View file

@ -46,6 +46,7 @@ cvar_t *cl_timeout;
cvar_t *cl_predict;
//cvar_t *cl_minfps;
cvar_t *cl_maxfps;
cvar_t *cl_drawfps;
cvar_t *cl_gun;
cvar_t *cl_add_particles;
@ -160,7 +161,7 @@ Begins recording a demo from the current position
void CL_Record_f (void)
{
char name[MAX_OSPATH];
char buf_data[MAX_MSGLEN];
byte buf_data[MAX_MSGLEN];
sizebuf_t buf;
int i;
int len;
@ -644,9 +645,9 @@ void CL_Disconnect (void)
// send a disconnect message to the server
final[0] = clc_stringcmd;
strcpy ((char *)final+1, "disconnect");
Netchan_Transmit (&cls.netchan, strlen(final), final);
Netchan_Transmit (&cls.netchan, strlen(final), final);
Netchan_Transmit (&cls.netchan, strlen(final), final);
Netchan_Transmit (&cls.netchan, strlen((char *)final), final);
Netchan_Transmit (&cls.netchan, strlen((char *)final), final);
Netchan_Transmit (&cls.netchan, strlen((char *)final), final);
CL_ClearState ();
@ -1437,6 +1438,7 @@ void CL_InitLocal (void)
cl_predict = Cvar_Get ("cl_predict", "1", 0);
// cl_minfps = Cvar_Get ("cl_minfps", "5", 0);
cl_maxfps = Cvar_Get ("cl_maxfps", "90", 0);
cl_drawfps = Cvar_Get ("cl_drawfps", "0", CVAR_ARCHIVE); // FPS hack
cl_upspeed = Cvar_Get ("cl_upspeed", "200", 0);
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", 0);

View file

@ -358,8 +358,8 @@ CL_ParseBaseline
*/
void CL_ParseBaseline (void)
{
entity_state_t *es;
int bits;
entity_state_t *es;
unsigned int bits;
int newnum;
entity_state_t nullstate;
@ -379,8 +379,8 @@ CL_LoadClientinfo
*/
void CL_LoadClientinfo (clientinfo_t *ci, char *s)
{
int i;
char *t;
int i;
char *t;
char model_name[MAX_QPATH];
char skin_name[MAX_QPATH];
char model_filename[MAX_QPATH];

View file

@ -69,6 +69,8 @@ dirty_t scr_dirty, scr_old_dirty[2];
char crosshair_pic[MAX_QPATH];
int crosshair_width, crosshair_height;
extern cvar_t *cl_drawfps; // FPS hack
void SCR_TimeRefresh_f (void);
void SCR_Loading_f (void);
@ -1349,7 +1351,6 @@ void SCR_UpdateScreen (void)
}
else
{
// make sure the game palette is active
if (cl.cinematicpalette_active)
{
@ -1374,6 +1375,15 @@ void SCR_UpdateScreen (void)
SCR_DrawNet ();
SCR_CheckDrawCenterString ();
// FPS counter hack
// http://www.quakesrc.org/?Page=tutorials&What=./tutorials/Quake2/misc/fps.txt
if (cl_drawfps->value) {
char s[8];
sprintf(s, "%3.0ffps", 1/cls.frametime);
DrawString(viddef.width-64,0,s);
}
if (scr_timegraph->value)
SCR_DebugGraph (cls.frametime*300, 0);

View file

@ -1360,6 +1360,8 @@ void CL_AddPlayerBeams (void)
frame_t *oldframe;
player_state_t *ps, *ops;
framenum = 0;
//PMM
if (hand)
{
@ -1502,10 +1504,12 @@ void CL_AddPlayerBeams (void)
{
framenum = 1;
}
/*
}
else
{
framenum = 1;
*/
}
// if it's the heatbeam, draw the particle effect

View file

@ -143,7 +143,7 @@ typedef struct
FILE *cinematic_file;
int cinematictime; // cls.realtime for first cinematic frame
int cinematicframe;
char cinematicpalette[768];
unsigned char cinematicpalette[768];
qboolean cinematicpalette_active;
//

View file

@ -38,12 +38,12 @@ int edit_line=0;
int history_line=0;
int key_waiting;
char *keybindings[256];
qboolean consolekeys[256]; // if true, can't be rebound while in console
qboolean menubound[256]; // if true, can't be rebound while in menu
int keyshift[256]; // key to map to if shift held down in console
int key_repeats[256]; // if > 1, it is autorepeating
qboolean keydown[256];
char *keybindings[K_LAST];
qboolean consolekeys[K_LAST]; // if true, can't be rebound while in console
qboolean menubound[K_LAST]; // if true, can't be rebound while in menu
int keyshift[K_LAST]; // key to map to if shift held down in console
int key_repeats[K_LAST]; // if > 1, it is autorepeating
qboolean keydown[K_LAST];
typedef struct
{
@ -240,6 +240,8 @@ void Key_Console (int key)
case K_KP_DEL:
key = '.';
break;
default:
break;
}
if ( ( toupper( key ) == 'V' && keydown[K_CTRL] ) ||
@ -555,7 +557,7 @@ void Key_Unbindall_f (void)
{
int i;
for (i=0 ; i<256 ; i++)
for (i=0 ; i<K_LAST ; i++)
if (keybindings[i])
Key_SetBinding (i, "");
}
@ -617,7 +619,7 @@ void Key_WriteBindings (FILE *f)
{
int i;
for (i=0 ; i<256 ; i++)
for (i=0 ; i<K_LAST ; i++)
if (keybindings[i] && keybindings[i][0])
fprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
}
@ -633,7 +635,7 @@ void Key_Bindlist_f (void)
{
int i;
for (i=0 ; i<256 ; i++)
for (i=0 ; i<K_LAST ; i++)
if (keybindings[i] && keybindings[i][0])
Com_Printf ("%s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
}
@ -692,7 +694,7 @@ void Key_Init (void)
consolekeys['`'] = false;
consolekeys['~'] = false;
for (i=0 ; i<256 ; i++)
for (i=0 ; i<K_LAST ; i++)
keyshift[i] = i;
for (i='a' ; i<='z' ; i++)
keyshift[i] = i - 'a' + 'A';
@ -919,7 +921,7 @@ void Key_ClearStates (void)
anykeydown = false;
for (i=0 ; i<256 ; i++)
for (i=0 ; i<K_LAST ; i++)
{
if ( keydown[i] || key_repeats[i] )
Key_Event( i, false, 0 );

View file

@ -21,116 +21,120 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// these are the key numbers that should be passed to Key_Event
//
#define K_TAB 9
#define K_ENTER 13
#define K_ESCAPE 27
#define K_SPACE 32
enum QKEYS {
K_TAB = 9,
K_ENTER = 13,
K_ESCAPE = 27,
K_SPACE = 32,
// normal keys should be passed as lowercased ascii
#define K_BACKSPACE 127
#define K_UPARROW 128
#define K_DOWNARROW 129
#define K_LEFTARROW 130
#define K_RIGHTARROW 131
K_BACKSPACE = 127,
K_UPARROW = 128,
K_DOWNARROW = 129,
K_LEFTARROW = 130,
K_RIGHTARROW = 131,
#define K_ALT 132
#define K_CTRL 133
#define K_SHIFT 134
#define K_F1 135
#define K_F2 136
#define K_F3 137
#define K_F4 138
#define K_F5 139
#define K_F6 140
#define K_F7 141
#define K_F8 142
#define K_F9 143
#define K_F10 144
#define K_F11 145
#define K_F12 146
#define K_INS 147
#define K_DEL 148
#define K_PGDN 149
#define K_PGUP 150
#define K_HOME 151
#define K_END 152
K_ALT = 132,
K_CTRL = 133,
K_SHIFT = 134,
K_F1 = 135,
K_F2 = 136,
K_F3 = 137,
K_F4 = 138,
K_F5 = 139,
K_F6 = 140,
K_F7 = 141,
K_F8 = 142,
K_F9 = 143,
K_F10 = 144,
K_F11 = 145,
K_F12 = 146,
K_INS = 147,
K_DEL = 148,
K_PGDN = 149,
K_PGUP = 150,
K_HOME = 151,
K_END = 152,
#define K_KP_HOME 160
#define K_KP_UPARROW 161
#define K_KP_PGUP 162
#define K_KP_LEFTARROW 163
#define K_KP_5 164
#define K_KP_RIGHTARROW 165
#define K_KP_END 166
#define K_KP_DOWNARROW 167
#define K_KP_PGDN 168
#define K_KP_ENTER 169
#define K_KP_INS 170
#define K_KP_DEL 171
#define K_KP_SLASH 172
#define K_KP_MINUS 173
#define K_KP_PLUS 174
#define K_PAUSE 255
K_KP_HOME = 160,
K_KP_UPARROW = 161,
K_KP_PGUP = 162,
K_KP_LEFTARROW = 163,
K_KP_5 = 164,
K_KP_RIGHTARROW = 165,
K_KP_END = 166,
K_KP_DOWNARROW = 167,
K_KP_PGDN = 168,
K_KP_ENTER = 169,
K_KP_INS = 170,
K_KP_DEL = 171,
K_KP_SLASH = 172,
K_KP_MINUS = 173,
K_KP_PLUS = 174,
//
// mouse buttons generate virtual keys
//
#define K_MOUSE1 200
#define K_MOUSE2 201
#define K_MOUSE3 202
K_MOUSE1 = 200,
K_MOUSE2 = 201,
K_MOUSE3 = 202,
//
// joystick buttons
//
#define K_JOY1 203
#define K_JOY2 204
#define K_JOY3 205
#define K_JOY4 206
K_JOY1 = 203,
K_JOY2 = 204,
K_JOY3 = 205,
K_JOY4 = 206,
//
// aux keys are for multi-buttoned joysticks to generate so they can use
// the normal binding process
//
#define K_AUX1 207
#define K_AUX2 208
#define K_AUX3 209
#define K_AUX4 210
#define K_AUX5 211
#define K_AUX6 212
#define K_AUX7 213
#define K_AUX8 214
#define K_AUX9 215
#define K_AUX10 216
#define K_AUX11 217
#define K_AUX12 218
#define K_AUX13 219
#define K_AUX14 220
#define K_AUX15 221
#define K_AUX16 222
#define K_AUX17 223
#define K_AUX18 224
#define K_AUX19 225
#define K_AUX20 226
#define K_AUX21 227
#define K_AUX22 228
#define K_AUX23 229
#define K_AUX24 230
#define K_AUX25 231
#define K_AUX26 232
#define K_AUX27 233
#define K_AUX28 234
#define K_AUX29 235
#define K_AUX30 236
#define K_AUX31 237
#define K_AUX32 238
K_AUX1 = 207,
K_AUX2 = 208,
K_AUX3 = 209,
K_AUX4 = 210,
K_AUX5 = 211,
K_AUX6 = 212,
K_AUX7 = 213,
K_AUX8 = 214,
K_AUX9 = 215,
K_AUX10 = 216,
K_AUX11 = 217,
K_AUX12 = 218,
K_AUX13 = 219,
K_AUX14 = 220,
K_AUX15 = 221,
K_AUX16 = 222,
K_AUX17 = 223,
K_AUX18 = 224,
K_AUX19 = 225,
K_AUX20 = 226,
K_AUX21 = 227,
K_AUX22 = 228,
K_AUX23 = 229,
K_AUX24 = 230,
K_AUX25 = 231,
K_AUX26 = 232,
K_AUX27 = 233,
K_AUX28 = 234,
K_AUX29 = 235,
K_AUX30 = 236,
K_AUX31 = 237,
K_AUX32 = 238,
#define K_MWHEELDOWN 239
#define K_MWHEELUP 240
K_MWHEELDOWN = 239,
K_MWHEELUP = 240,
extern char *keybindings[256];
extern int key_repeats[256];
K_PAUSE = 255,
K_LAST
};
extern char *keybindings[K_LAST];
extern int key_repeats[K_LAST];
extern int anykeydown;
extern char chat_buffer[];
@ -143,4 +147,3 @@ void Key_WriteBindings (FILE *f);
void Key_SetBinding (int keynum, char *binding);
void Key_ClearStates (void);
int Key_GetKey (void);

View file

@ -1029,6 +1029,7 @@ static menulist_s s_options_crosshair_box;
static menuslider_s s_options_sfxvolume_slider;
static menulist_s s_options_joystick_box;
static menulist_s s_options_cdvolume_box;
static menulist_s s_options_cdshuffle_box;
static menulist_s s_options_quality_list;
static menulist_s s_options_compatibility_list;
static menulist_s s_options_console_action;
@ -1062,12 +1063,14 @@ static void MouseSpeedFunc( void *unused )
{
Cvar_SetValue( "sensitivity", s_options_sensitivity_slider.curvalue / 2.0F );
}
/*
static void NoAltTabFunc( void *unused )
{
Cvar_SetValue( "win_noalttab", s_options_noalttab_box.curvalue );
}
*/
static float ClampCvar( float min, float max, float value )
{
if ( value < min ) return min;
@ -1079,6 +1082,9 @@ static void ControlsSetMenuItemValues( void )
{
s_options_sfxvolume_slider.curvalue = Cvar_VariableValue( "s_volume" ) * 10;
s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd");
Cvar_SetValue ( "cd_shuffle", 0);
s_options_quality_list.curvalue = !Cvar_VariableValue( "s_loadas8bit" );
s_options_sensitivity_slider.curvalue = ( sensitivity->value ) * 2;
@ -1133,9 +1139,31 @@ static void UpdateVolumeFunc( void *unused )
Cvar_SetValue( "s_volume", s_options_sfxvolume_slider.curvalue / 10 );
}
static void CDShuffleFunc( void *unused )
{
Cvar_SetValue("cd_shuffle", !s_options_cdshuffle_box.curvalue);
}
static void UpdateCDVolumeFunc( void *unused )
{
Cvar_SetValue( "cd_nocd", !s_options_cdvolume_box.curvalue );
if (s_options_cdvolume_box.curvalue)
{
CDAudio_Init();
if (s_options_cdshuffle_box.curvalue)
{
CDAudio_RandomPlay();
}
else
{
CDAudio_Play(atoi(cl.configstrings[CS_CDTRACK]), true);
}
}
else
{
CDAudio_Stop();
}
}
static void ConsoleFunc( void *unused )
@ -1192,6 +1220,14 @@ void Options_MenuInit( void )
"enabled",
0
};
static const char *cd_shuffle[] =
{
"disabled",
"enabled",
0
};
static const char *quality_items[] =
{
"low", "high", 0
@ -1244,9 +1280,17 @@ void Options_MenuInit( void )
s_options_cdvolume_box.itemnames = cd_music_items;
s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd");
s_options_cdshuffle_box.generic.type = MTYPE_SPINCONTROL;
s_options_cdshuffle_box.generic.x = 0;
s_options_cdshuffle_box.generic.y = 20;
s_options_cdshuffle_box.generic.name = "CD shuffle";
s_options_cdshuffle_box.generic.callback = CDShuffleFunc;
s_options_cdshuffle_box.itemnames = cd_shuffle;
s_options_cdshuffle_box.curvalue = Cvar_VariableValue("cd_shuffle");
s_options_quality_list.generic.type = MTYPE_SPINCONTROL;
s_options_quality_list.generic.x = 0;
s_options_quality_list.generic.y = 20;;
s_options_quality_list.generic.y = 30;
s_options_quality_list.generic.name = "sound quality";
s_options_quality_list.generic.callback = UpdateSoundQualityFunc;
s_options_quality_list.itemnames = quality_items;
@ -1254,7 +1298,7 @@ void Options_MenuInit( void )
s_options_compatibility_list.generic.type = MTYPE_SPINCONTROL;
s_options_compatibility_list.generic.x = 0;
s_options_compatibility_list.generic.y = 30;
s_options_compatibility_list.generic.y = 40;
s_options_compatibility_list.generic.name = "sound compatibility";
s_options_compatibility_list.generic.callback = UpdateSoundQualityFunc;
s_options_compatibility_list.itemnames = compatibility_items;
@ -1262,7 +1306,7 @@ void Options_MenuInit( void )
s_options_sensitivity_slider.generic.type = MTYPE_SLIDER;
s_options_sensitivity_slider.generic.x = 0;
s_options_sensitivity_slider.generic.y = 50;
s_options_sensitivity_slider.generic.y = 60;
s_options_sensitivity_slider.generic.name = "mouse speed";
s_options_sensitivity_slider.generic.callback = MouseSpeedFunc;
s_options_sensitivity_slider.minvalue = 2;
@ -1270,75 +1314,75 @@ void Options_MenuInit( void )
s_options_alwaysrun_box.generic.type = MTYPE_SPINCONTROL;
s_options_alwaysrun_box.generic.x = 0;
s_options_alwaysrun_box.generic.y = 60;
s_options_alwaysrun_box.generic.y = 70;
s_options_alwaysrun_box.generic.name = "always run";
s_options_alwaysrun_box.generic.callback = AlwaysRunFunc;
s_options_alwaysrun_box.itemnames = yesno_names;
s_options_invertmouse_box.generic.type = MTYPE_SPINCONTROL;
s_options_invertmouse_box.generic.x = 0;
s_options_invertmouse_box.generic.y = 70;
s_options_invertmouse_box.generic.y = 80;
s_options_invertmouse_box.generic.name = "invert mouse";
s_options_invertmouse_box.generic.callback = InvertMouseFunc;
s_options_invertmouse_box.itemnames = yesno_names;
s_options_lookspring_box.generic.type = MTYPE_SPINCONTROL;
s_options_lookspring_box.generic.x = 0;
s_options_lookspring_box.generic.y = 80;
s_options_lookspring_box.generic.y = 90;
s_options_lookspring_box.generic.name = "lookspring";
s_options_lookspring_box.generic.callback = LookspringFunc;
s_options_lookspring_box.itemnames = yesno_names;
s_options_lookstrafe_box.generic.type = MTYPE_SPINCONTROL;
s_options_lookstrafe_box.generic.x = 0;
s_options_lookstrafe_box.generic.y = 90;
s_options_lookstrafe_box.generic.y = 100;
s_options_lookstrafe_box.generic.name = "lookstrafe";
s_options_lookstrafe_box.generic.callback = LookstrafeFunc;
s_options_lookstrafe_box.itemnames = yesno_names;
s_options_freelook_box.generic.type = MTYPE_SPINCONTROL;
s_options_freelook_box.generic.x = 0;
s_options_freelook_box.generic.y = 100;
s_options_freelook_box.generic.y = 110;
s_options_freelook_box.generic.name = "free look";
s_options_freelook_box.generic.callback = FreeLookFunc;
s_options_freelook_box.itemnames = yesno_names;
s_options_crosshair_box.generic.type = MTYPE_SPINCONTROL;
s_options_crosshair_box.generic.x = 0;
s_options_crosshair_box.generic.y = 110;
s_options_crosshair_box.generic.y = 120;
s_options_crosshair_box.generic.name = "crosshair";
s_options_crosshair_box.generic.callback = CrosshairFunc;
s_options_crosshair_box.itemnames = crosshair_names;
/*
s_options_noalttab_box.generic.type = MTYPE_SPINCONTROL;
s_options_noalttab_box.generic.x = 0;
s_options_noalttab_box.generic.y = 110;
s_options_noalttab_box.generic.y = 120;
s_options_noalttab_box.generic.name = "disable alt-tab";
s_options_noalttab_box.generic.callback = NoAltTabFunc;
s_options_noalttab_box.itemnames = yesno_names;
*/
s_options_joystick_box.generic.type = MTYPE_SPINCONTROL;
s_options_joystick_box.generic.x = 0;
s_options_joystick_box.generic.y = 120;
s_options_joystick_box.generic.y = 130;
s_options_joystick_box.generic.name = "use joystick";
s_options_joystick_box.generic.callback = JoystickFunc;
s_options_joystick_box.itemnames = yesno_names;
s_options_customize_options_action.generic.type = MTYPE_ACTION;
s_options_customize_options_action.generic.x = 0;
s_options_customize_options_action.generic.y = 140;
s_options_customize_options_action.generic.y = 150;
s_options_customize_options_action.generic.name = "customize controls";
s_options_customize_options_action.generic.callback = CustomizeControlsFunc;
s_options_defaults_action.generic.type = MTYPE_ACTION;
s_options_defaults_action.generic.x = 0;
s_options_defaults_action.generic.y = 150;
s_options_defaults_action.generic.y = 160;
s_options_defaults_action.generic.name = "reset defaults";
s_options_defaults_action.generic.callback = ControlsResetDefaultsFunc;
s_options_console_action.generic.type = MTYPE_ACTION;
s_options_console_action.generic.x = 0;
s_options_console_action.generic.y = 160;
s_options_console_action.generic.y = 170;
s_options_console_action.generic.name = "go to console";
s_options_console_action.generic.callback = ConsoleFunc;
@ -1346,6 +1390,7 @@ void Options_MenuInit( void )
Menu_AddItem( &s_options_menu, ( void * ) &s_options_sfxvolume_slider );
Menu_AddItem( &s_options_menu, ( void * ) &s_options_cdvolume_box );
Menu_AddItem( &s_options_menu, ( void * ) &s_options_cdshuffle_box );
Menu_AddItem( &s_options_menu, ( void * ) &s_options_quality_list );
Menu_AddItem( &s_options_menu, ( void * ) &s_options_compatibility_list );
Menu_AddItem( &s_options_menu, ( void * ) &s_options_sensitivity_slider );
@ -1819,7 +1864,7 @@ void M_Menu_Credits_f( void )
int isdeveloper = 0;
creditsBuffer = NULL;
count = FS_LoadFile ("credits", (void**)&creditsBuffer);
count = FS_LoadFile ("credits", (void **)&creditsBuffer);
if (count != -1)
{
p = creditsBuffer;
@ -1843,7 +1888,7 @@ void M_Menu_Credits_f( void )
break;
}
creditsIndex[++n] = 0;
credits = (const char**)creditsIndex;
credits = (const char **)creditsIndex;
}
else
{
@ -2595,7 +2640,7 @@ void StartServer_MenuInit( void )
s_startmap_list.generic.x = 0;
s_startmap_list.generic.y = 0;
s_startmap_list.generic.name = "initial map";
s_startmap_list.itemnames = (const char**)mapnames;
s_startmap_list.itemnames = (const char **)mapnames;
s_rules_box.generic.type = MTYPE_SPINCONTROL;
s_rules_box.generic.x = 0;
@ -3387,7 +3432,7 @@ static void RateCallback( void *unused )
static void ModelCallback( void *unused )
{
s_player_skin_box.itemnames = (const char**)s_pmi[s_player_model_box.curvalue].skindisplaynames;
s_player_skin_box.itemnames = (const char **)s_pmi[s_player_model_box.curvalue].skindisplaynames;
s_player_skin_box.curvalue = 0;
}

View file

@ -550,6 +550,7 @@ int Menu_TallySlots( menuframework_s *menu )
return total;
}
/*
void Menulist_DoEnter( menulist_s *l )
{
@ -563,6 +564,7 @@ void Menulist_DoEnter( menulist_s *l )
l->generic.callback( l );
}
*/
void MenuList_Draw( menulist_s *l )
{
const char **n;
@ -623,6 +625,7 @@ void Slider_Draw( menuslider_s *s )
Draw_Char( RCOLUMN_OFFSET + s->generic.x + i*8 + s->generic.parent->x + 8, s->generic.y + s->generic.parent->y, 130);
Draw_Char( ( int ) ( 8 + RCOLUMN_OFFSET + s->generic.parent->x + s->generic.x + (SLIDER_RANGE-1)*8 * s->range ), s->generic.y + s->generic.parent->y, 131);
}
/*
void SpinControl_DoEnter( menulist_s *s )
{
@ -634,6 +637,7 @@ void SpinControl_DoEnter( menulist_s *s )
s->generic.callback( s );
}
*/
void SpinControl_DoSlide( menulist_s *s, int dir )
{
s->curvalue += dir;

View file

@ -230,7 +230,7 @@ void FindNextChunk(char *name)
// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
data_p -= 8;
last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 );
if (!strncmp(data_p, name, 4))
if (!strncmp((char *)data_p, name, 4))
return;
}
}
@ -280,7 +280,7 @@ wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength)
// find "RIFF" chunk
FindChunk("RIFF");
if (!(data_p && !strncmp(data_p+8, "WAVE", 4)))
if (!(data_p && !strncmp((char *)data_p+8, "WAVE", 4)))
{
Com_Printf("Missing RIFF/WAVE chunks\n");
return info;
@ -321,7 +321,7 @@ wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength)
FindNextChunk ("LIST");
if (data_p)
{
if (!strncmp (data_p + 28, "mark", 4))
if (!strncmp ((char *)data_p + 28, "mark", 4))
{ // this is not a proper parse, but it works with cooledit...
data_p += 24;
i = GetLittleLong (); // samples in loop

View file

@ -28,6 +28,12 @@ void CDAudio_Play(int track, qboolean looping)
}
void CDAudio_RandomPlay(void)
{
Com_Printf("XXX - CDAudio_RandomPlay\n");
}
void CDAudio_Stop(void)
{
Com_Printf("XXX - CDAudio_Stop\n");

View file

@ -219,6 +219,7 @@ void *Sys_GetGameAPI (void *parms)
char name[MAX_OSPATH];
char curpath[MAX_OSPATH];
char *path;
char *str_p;
#ifdef __sgi
const char *gamename = "gamemips.so";
#else
@ -247,8 +248,19 @@ void *Sys_GetGameAPI (void *parms)
game_library = dlopen (name, RTLD_NOW );
if (game_library)
{
Com_DPrintf ("LoadLibrary (%s)\n",name);
Com_MDPrintf ("LoadLibrary (%s)\n",name);
break;
} else {
Com_MDPrintf ("LoadLibrary (%s)\n", name);
str_p = strchr(dlerror(), ':'); // skip the path (already shown)
if (str_p != NULL)
{
Com_MDPrintf (" **");
while (*str_p)
Com_MDPrintf ("%c", *(++str_p));
Com_MDPrintf("\n");
}
}
}

View file

@ -50,12 +50,13 @@ static int cdfile = -1;
//static char cd_dev[64] = "/dev/cdrom";
cvar_t *cd_volume;
cvar_t *cd_volume;
cvar_t *cd_nocd;
cvar_t *cd_dev;
void CDAudio_Pause(void);
static void CDAudio_Eject(void)
{
if (cdfile == -1 || !enabled)
@ -82,10 +83,10 @@ static int CDAudio_GetAudioDiskInfo(void)
cdValid = false;
if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
{
Com_DPrintf("ioctl cdromreadtochdr failed\n");
return -1;
}
{
Com_DPrintf("ioctl cdromreadtochdr failed\n");
return -1;
}
if (tochdr.cdth_trk0 < 1)
{
@ -150,10 +151,10 @@ void CDAudio_Play(int track, qboolean looping)
ti.cdti_ind1 = 99;
if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
{
{
Com_DPrintf("ioctl cdromplaytrkind failed\n");
return;
}
}
if ( ioctl(cdfile, CDROMRESUME) == -1 )
Com_DPrintf("ioctl cdromresume failed\n");
@ -166,6 +167,78 @@ void CDAudio_Play(int track, qboolean looping)
CDAudio_Pause ();
}
void CDAudio_RandomPlay(void)
{
int track, i = 0, free_tracks = 0, remap_track;
float f;
unsigned char track_bools[100];
struct cdrom_tocentry entry;
struct cdrom_ti ti;
if (cdfile == -1 || !enabled)
return;
// create array of available audio tracknumbers
for (; i < maxTrack; i++)
{
entry.cdte_track = remap[i];
entry.cdte_format = CDROM_MSF;
if ( ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1 )
{
track_bools[i] = 0;
}
else
track_bools[i] = (entry.cdte_ctrl != CDROM_DATA_TRACK);
free_tracks += track_bools[i];
}
if (!free_tracks)
{
Com_DPrintf("CDAudio_RandomPlay: Unable to find and play a random audio track, insert an audio cd please");
return;
}
// choose random audio track
do
{
do
{
f = ((float)rand()) / ((float)RAND_MAX + 1.0);
track = (int)(maxTrack * f);
}
while(!track_bools[track]);
remap_track = remap[track];
if (playing)
{
if (playTrack == remap_track)
return;
CDAudio_Stop();
}
ti.cdti_trk0 = remap_track;
ti.cdti_trk1 = remap_track;
ti.cdti_ind0 = 1;
ti.cdti_ind1 = 99;
if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
{
track_bools[track] = 0;
free_tracks--;
}
else
{
playLooping = true;
playTrack = remap_track;
playing = true;
return;
}
}
while (free_tracks > 0);
}
void CDAudio_Stop(void)
{
@ -379,6 +452,9 @@ int CDAudio_Init(void)
cvar_t *cv;
extern uid_t saved_euid;
if (initialized)
return 0;
cv = Cvar_Get ("nocdaudio", "0", CVAR_NOSET);
if (cv->value)
return -1;
@ -436,4 +512,5 @@ void CDAudio_Shutdown(void)
CDAudio_Stop();
close(cdfile);
cdfile = -1;
initialized = false;
}

View file

@ -3,6 +3,7 @@
CD code taken from SDLQuake and modified to work with Quake2
Robert Bäuml 2001-12-25
W.P. van Paassen 2002-01-06
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -35,6 +36,7 @@ static qboolean enabled = true;
static qboolean playLooping = false;
static SDL_CD *cd_id;
static float cdvolume = 1.0;
static int lastTrack = 0;
cvar_t *cd_volume;
cvar_t *cd_nocd;
@ -52,12 +54,17 @@ static void CDAudio_Eject()
void CDAudio_Play(int track, qboolean looping)
{
CDstatus cd_stat = CD_ERROR;
CDstatus cd_stat;
lastTrack = track + 1;
if(!cd_id || !enabled) return;
cd_stat = SDL_CDStatus(cd_id);
if(!cdValid)
{
if(!CD_INDRIVE(cd_stat=SDL_CDStatus(cd_id)) ||(!cd_id->numtracks)) return;
if(!CD_INDRIVE(cd_stat) ||(!cd_id->numtracks)) return;
cdValid = true;
}
@ -76,12 +83,78 @@ void CDAudio_Play(int track, qboolean looping)
if(SDL_CDPlay(cd_id,cd_id->track[track].offset,
cd_id->track[track].length))
{
Com_DPrintf("CDAudio_Play: Unable to play track: %d\n",track+1);
Com_DPrintf("CDAudio_Play: Unable to play track: %d (%s)\n", track+1, SDL_GetError());
return;
}
playLooping = looping;
}
void CDAudio_RandomPlay(void)
{
int track, i = 0, free_tracks = 0;
float f;
CDstatus cd_stat;
unsigned char track_bools[100];
if (!cd_id || !enabled)
return;
//create array of available audio tracknumbers
for (; i < cd_id->numtracks; i++)
{
track_bools[i] = cd_id->track[i].type == SDL_AUDIO_TRACK;
free_tracks += track_bools[i];
}
if (!free_tracks)
{
Com_DPrintf("CDAudio_RandomPlay: Unable to find and play a random audio track, insert an audio cd please");
return;
}
//choose random audio track
do
{
do
{
f = ((float)rand()) / ((float)RAND_MAX + 1.0);
track = (int)(cd_id->numtracks * f);
}
while(!track_bools[track]);
lastTrack = track+1;
cd_stat=SDL_CDStatus(cd_id);
if(!cdValid)
{
if(!CD_INDRIVE(cd_stat) ||(!cd_id->numtracks))
return;
cdValid = true;
}
if(cd_stat == CD_PLAYING)
{
if(cd_id->cur_track == track + 1)
return;
CDAudio_Stop();
}
if (SDL_CDPlay(cd_id,cd_id->track[track].offset,
cd_id->track[track].length))
{
track_bools[track] = 0;
free_tracks--;
}
else
{
playLooping = true;
return;
}
}
while (free_tracks > 0);
}
void CDAudio_Stop()
{
@ -92,6 +165,8 @@ void CDAudio_Stop()
if(SDL_CDStop(cd_id))
Com_DPrintf("CDAudio_Stop: Failed to stop track.\n");
playLooping = 0;
}
void CDAudio_Pause()
@ -110,7 +185,7 @@ void CDAudio_Resume()
if(SDL_CDStatus(cd_id) != CD_PAUSED) return;
if(SDL_CDResume(cd_id))
Com_DPrintf("CDAudio_Resume: Failed tp resume track.\n");
Com_DPrintf("CDAudio_Resume: Failed to resume track.\n");
}
void CDAudio_Update()
@ -131,15 +206,28 @@ void CDAudio_Update()
cdvolume = cd_volume->value;
return;
}
if(playLooping && (SDL_CDStatus(cd_id) != CD_PLAYING)
&& (SDL_CDStatus(cd_id) != CD_PAUSED))
CDAudio_Play(cd_id->cur_track+1,true);
if(cd_nocd->value)
{
CDAudio_Stop();
return;
}
if(playLooping &&
(SDL_CDStatus(cd_id) != CD_PLAYING) &&
(SDL_CDStatus(cd_id) != CD_PAUSED))
{
CDAudio_Play(lastTrack, true);
}
}
int CDAudio_Init()
{
cvar_t *cv;
if (initialized)
return 0;
cv = Cvar_Get ("nocdaudio", "0", CVAR_NOSET);
if (cv->value)
return -1;
@ -201,6 +289,8 @@ void CDAudio_Shutdown()
SDL_Quit();
else
SDL_QuitSubSystem(SDL_INIT_CDROM);
initialized = false;
}
static void CD_f()

View file

@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdarg.h>
#include <stdio.h>
#include <signal.h>
#include <dlfcn.h>
#include "../ref_gl/gl_local.h"
#include "../client/keys.h"
@ -59,6 +60,15 @@ extern cvar_t *vid_ref;
static fxMesaContext fc = NULL;
//FX Mesa Functions
fxMesaContext (*qfxMesaCreateContext)(GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]);
fxMesaContext (*qfxMesaCreateBestContext)(GLuint win, GLint width, GLint height, const GLint attribList[]);
void (*qfxMesaDestroyContext)(fxMesaContext ctx);
void (*qfxMesaMakeCurrent)(fxMesaContext ctx);
fxMesaContext (*qfxMesaGetCurrentContext)(void);
void (*qfxMesaSwapBuffers)(void);
#define NUM_RESOLUTIONS 16
static resolutions[NUM_RESOLUTIONS][3]={
@ -178,6 +188,14 @@ void GLimp_Shutdown( void )
qfxMesaDestroyContext(fc);
fc = NULL;
}
/*
qfxMesaCreateContext = NULL;
qfxMesaCreateBestContext = NULL;
qfxMesaDestroyContext = NULL;
qfxMesaMakeCurrent = NULL;
qfxMesaGetCurrentContext = NULL;
qfxMesaSwapBuffers = NULL;
*/
}
/*
@ -190,7 +208,20 @@ int GLimp_Init( void *hinstance, void *wndproc )
{
InitSig();
return true;
if ( glw_state.OpenGLLib ) {
#define GPA( a ) dlsym( glw_state.OpenGLLib, a )
qfxMesaCreateContext = GPA("fxMesaCreateContext");
qfxMesaCreateBestContext = GPA("fxMesaCreateBestContext");
qfxMesaDestroyContext = GPA("fxMesaDestroyContext");
qfxMesaMakeCurrent = GPA("fxMesaMakeCurrent");
qfxMesaGetCurrentContext = GPA("fxMesaGetCurrentContext");
qfxMesaSwapBuffers = GPA("fxMesaSwapBuffers");
return true;
}
return false;
}
/*

View file

@ -39,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <dlfcn.h>
#include "../ref_gl/gl_local.h"
@ -49,6 +50,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include <X11/cursorfont.h>
@ -61,12 +64,22 @@ static Display *dpy = NULL;
static int scrnum;
static Window win;
static GLXContext ctx = NULL;
static Atom wmDeleteWindow;
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | \
PointerMotionMask | ButtonMotionMask )
#define X_MASK (KEY_MASK | MOUSE_MASK | VisibilityChangeMask | StructureNotifyMask )
// GLX Functions
static XVisualInfo * (*qglXChooseVisual)( Display *dpy, int screen, int *attribList );
static GLXContext (*qglXCreateContext)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
static void (*qglXDestroyContext)( Display *dpy, GLXContext ctx );
static Bool (*qglXMakeCurrent)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
static void (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
static void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
/*****************************************************************************/
/* MOUSE */
/*****************************************************************************/
@ -107,6 +120,8 @@ static cvar_t *m_pitch;
static cvar_t *m_forward;
static cvar_t *freelook;
static Time myxtime;
static Cursor CreateNullCursor(Display *display, Window root)
{
Pixmap cursormask;
@ -482,6 +497,7 @@ static void HandleEvents(void)
switch(event.type) {
case KeyPress:
myxtime = event.xkey.time;
case KeyRelease:
if (in_state && in_state->Key_Event_fp)
in_state->Key_Event_fp (XLateKey(&event.xkey), event.type == KeyPress);
@ -508,25 +524,35 @@ static void HandleEvents(void)
case ButtonPress:
b=-1;
myxtime = event.xbutton.time;
b = -1;
if (event.xbutton.button == 1)
b = 0;
else if (event.xbutton.button == 2)
b = 2;
else if (event.xbutton.button == 3)
b = 1;
else if (event.xbutton.button == 4)
in_state->Key_Event_fp (K_MWHEELUP, 1);
else if (event.xbutton.button == 5)
in_state->Key_Event_fp (K_MWHEELDOWN, 1);
if (b>=0 && in_state && in_state->Key_Event_fp)
in_state->Key_Event_fp (K_MOUSE1 + b, true);
break;
case ButtonRelease:
b=-1;
b = -1;
if (event.xbutton.button == 1)
b = 0;
else if (event.xbutton.button == 2)
b = 2;
else if (event.xbutton.button == 3)
b = 1;
else if (event.xbutton.button == 4)
in_state->Key_Event_fp (K_MWHEELUP, 0);
else if (event.xbutton.button == 5)
in_state->Key_Event_fp (K_MWHEELDOWN, 0);
if (b>=0 && in_state && in_state->Key_Event_fp)
in_state->Key_Event_fp (K_MOUSE1 + b, false);
break;
@ -540,6 +566,11 @@ static void HandleEvents(void)
win_x = event.xconfigure.x;
win_y = event.xconfigure.y;
break;
case ClientMessage:
if (event.xclient.data.l[0] == wmDeleteWindow)
ri.Cmd_ExecuteText(EXEC_NOW, "quit");
break;
}
}
@ -568,6 +599,50 @@ void KBD_Close(void)
/*****************************************************************************/
char *RW_Sys_GetClipboardData()
{
Window sowner;
Atom type, property;
unsigned long len, bytes_left, tmp;
unsigned char *data;
int format, result;
char *ret = NULL;
sowner = XGetSelectionOwner(dpy, XA_PRIMARY);
if (sowner != None) {
property = XInternAtom(dpy,
"GETCLIPBOARDDATA_PROP",
False);
XConvertSelection(dpy,
XA_PRIMARY, XA_STRING,
property, win, myxtime); /* myxtime == time of last X event */
XFlush(dpy);
XGetWindowProperty(dpy,
win, property,
0, 0, False, AnyPropertyType,
&type, &format, &len,
&bytes_left, &data);
if (bytes_left > 0) {
result =
XGetWindowProperty(dpy,
win, property,
0, bytes_left, True, AnyPropertyType,
&type, &format, &len,
&tmp, &data);
if (result == Success) {
ret = strdup(data);
}
XFree(data);
}
}
return ret;
}
/*****************************************************************************/
//static qboolean GLimp_SwitchFullscreen( int width, int height );
qboolean GLimp_InitGL (void);
@ -610,6 +685,7 @@ int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
XVisualInfo *visinfo;
XSetWindowAttributes attr;
XSizeHints *sizehints;
XWMHints *wmhints;
unsigned long mask;
int MajorVersion, MinorVersion;
int actualWidth, actualHeight;
@ -735,11 +811,38 @@ int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
sizehints->flags = PMinSize | PMaxSize | PBaseSize;
}
wmhints = XAllocWMHints();
if (wmhints) {
#include "q2icon.xbm"
Pixmap icon_pixmap, icon_mask;
unsigned long fg, bg;
int i;
fg = BlackPixel(dpy, visinfo->screen);
bg = WhitePixel(dpy, visinfo->screen);
icon_pixmap = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, fg, bg, visinfo->depth);
for (i = 0; i < sizeof(q2icon_bits); i++)
q2icon_bits[i] = ~q2icon_bits[i];
icon_mask = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, bg, fg, visinfo->depth);
wmhints->flags = IconPixmapHint|IconMaskHint;
wmhints->icon_pixmap = icon_pixmap;
wmhints->icon_mask = icon_mask;
}
XSetWMProperties(dpy, win, NULL, NULL, NULL, 0,
sizehints, None, None);
sizehints, wmhints, None);
if (sizehints)
XFree(sizehints);
if (wmhints)
XFree(wmhints);
XStoreName(dpy, win, "Quake II");
wmDeleteWindow = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
XSetWMProtocols(dpy, win, &wmDeleteWindow, 1);
XMapWindow(dpy, win);
@ -798,6 +901,15 @@ void GLimp_Shutdown( void )
dpy = NULL;
win = 0;
ctx = NULL;
/*
qglXChooseVisual = NULL;
qglXCreateContext = NULL;
qglXDestroyContext = NULL;
qglXMakeCurrent = NULL;
qglXCopyContext = NULL;
qglXSwapBuffers = NULL;
*/
}
/*
@ -810,7 +922,20 @@ int GLimp_Init( void *hinstance, void *wndproc )
{
InitSig();
return true;
if ( glw_state.OpenGLLib) {
#define GPA( a ) dlsym( glw_state.OpenGLLib, a )
qglXChooseVisual = GPA("glXChooseVisual");
qglXCreateContext = GPA("glXCreateContext");
qglXDestroyContext = GPA("glXDestroyContext");
qglXMakeCurrent = GPA("glXMakeCurrent");
qglXCopyContext = GPA("glXCopyContext");
qglXSwapBuffers = GPA("glXSwapBuffers");
return true;
}
return false;
}
/*
@ -856,9 +981,3 @@ void Fake_glColorTableEXT( GLenum target, GLenum internalformat,
}
qgl3DfxSetPaletteEXT((GLuint *)temptable);
}
/*------------------------------------------------*/
/* X11 Input Stuff */
/*------------------------------------------------*/

View file

@ -126,7 +126,7 @@ qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b)
return true;
return false;
}
return true;
return false;
}
char *NET_AdrToString (netadr_t a)
@ -280,7 +280,7 @@ qboolean NET_GetPacket (netsrc_t sock, netadr_t *net_from, sizebuf_t *net_messag
{
int ret;
struct sockaddr_in from;
int fromlen;
socklen_t fromlen;
int net_socket;
int protocol;
int err;
@ -367,7 +367,10 @@ void NET_SendPacket (netsrc_t sock, int length, void *data, netadr_t to)
return;
}
else
{
Com_Error (ERR_FATAL, "NET_SendPacket: bad address type");
return;
}
NetadrToSockadr (&to, &addr);

View file

@ -123,12 +123,12 @@ void Sys_Mkdir (char *path)
char *strlwr (char *s)
{
char *str = s;
char *p = s;
while (*s) {
*s = tolower(*s);
s++;
}
return str;
return p;
}
//============================================

View file

@ -32,29 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../ref_gl/gl_local.h"
#include "glw_linux.h"
//#include <GL/fxmesa.h>
#include <GL/glx.h>
//#include <GL/glx.h>
#include <dlfcn.h>
/*
//FX Mesa Functions
fxMesaContext (*qfxMesaCreateContext)(GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]);
fxMesaContext (*qfxMesaCreateBestContext)(GLuint win, GLint width, GLint height, const GLint attribList[]);
void (*qfxMesaDestroyContext)(fxMesaContext ctx);
void (*qfxMesaMakeCurrent)(fxMesaContext ctx);
fxMesaContext (*qfxMesaGetCurrentContext)(void);
void (*qfxMesaSwapBuffers)(void);
*/
//GLX Functions
XVisualInfo * (*qglXChooseVisual)( Display *dpy, int screen, int *attribList );
GLXContext (*qglXCreateContext)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
void (*qglXDestroyContext)( Display *dpy, GLXContext ctx );
Bool (*qglXMakeCurrent)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
void (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
void ( APIENTRY * qglAccum )(GLenum op, GLfloat value);
void ( APIENTRY * qglAlphaFunc )(GLenum func, GLclampf ref);
GLboolean ( APIENTRY * qglAreTexturesResident )(GLsizei n, const GLuint *textures, GLboolean *residences);
@ -2980,19 +2961,22 @@ void QGL_Shutdown( void )
qglVertexPointer = NULL;
qglViewport = NULL;
/*
qfxMesaCreateContext = NULL;
qfxMesaCreateBestContext = NULL;
qfxMesaDestroyContext = NULL;
qfxMesaMakeCurrent = NULL;
qfxMesaGetCurrentContext = NULL;
qfxMesaSwapBuffers = NULL;
*/
qglXChooseVisual = NULL;
qglXCreateContext = NULL;
qglXDestroyContext = NULL;
qglXMakeCurrent = NULL;
qglXCopyContext = NULL;
qglXSwapBuffers = NULL;
*/
}
#define GPA( a ) dlsym( glw_state.OpenGLLib, a )
void *qwglGetProcAddress(char *symbol)
{
if (glw_state.OpenGLLib)
return GPA ( symbol );
return NULL;
}
/*
@ -3024,23 +3008,10 @@ qboolean QGL_Init( const char *dllname )
{
char fn[MAX_OSPATH];
char *path;
#if 0
FILE *fp;
#endif
// ri.Con_Printf(PRINT_ALL, "QGL_Init: Can't load %s from /etc/ld.so.conf: %s\n",
// dllname, dlerror());
#if 0
if ((fp = fopen(so_file, "r")) == NULL) {
ri.Con_Printf(PRINT_ALL, "QGL_Init(\"%s\") failed: can't open %s\n", dllname, so_file);
return false;
}
fgets(fn, sizeof(fn), fp);
fclose(fp);
while (*fn && isspace(fn[strlen(fn) - 1]))
fn[strlen(fn) - 1] = 0;
#endif
// try basedir next
path = ri.Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
@ -3050,6 +3021,9 @@ qboolean QGL_Init( const char *dllname )
ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() );
return false;
}
Com_Printf ("Using %s for OpenGL...", fn);
} else {
Com_Printf ("Using %s for OpenGL...", dllname);
}
qglAccum = dllAccum = GPA( "glAccum" );
@ -3389,20 +3363,13 @@ qboolean QGL_Init( const char *dllname )
qglVertexPointer = dllVertexPointer = GPA( "glVertexPointer" );
qglViewport = dllViewport = GPA( "glViewport" );
/*
qfxMesaCreateContext = GPA("fxMesaCreateContext");
qfxMesaCreateBestContext = GPA("fxMesaCreateBestContext");
qfxMesaDestroyContext = GPA("fxMesaDestroyContext");
qfxMesaMakeCurrent = GPA("fxMesaMakeCurrent");
qfxMesaGetCurrentContext = GPA("fxMesaGetCurrentContext");
qfxMesaSwapBuffers = GPA("fxMesaSwapBuffers");
*/
qglXChooseVisual = GPA("glXChooseVisual");
qglXCreateContext = GPA("glXCreateContext");
qglXDestroyContext = GPA("glXDestroyContext");
qglXMakeCurrent = GPA("glXMakeCurrent");
qglXCopyContext = GPA("glXCopyContext");
qglXSwapBuffers = GPA("glXSwapBuffers");
*/
qglLockArraysEXT = 0;
qglUnlockArraysEXT = 0;
qglPointParameterfEXT = 0;

View file

@ -1,23 +0,0 @@
12-22-2001
Some notes about this release on linux:
#1: it is recommended that you have a working Quake2 installation already
(i.e. download precompiled binaries and stuff, have /usr/local/games/quake2
with all the files etc.)
#2: it builds in debug, only ref_glx.so has been tested
once compiled, you need to create baseq2/ directory,
and symlink the pak, symlink debugi386-glibc/gamei386.so
then to start Q2, in debugi386-glibc:
ln -s /usr/local/games/quake2/baseq2
./quake2 +set vid_ref glx +set gl_driver /usr/lib/libGL.so
you will need to edit /etc/quake2.conf, make it point to the right place
for loading of ref_glx.so
(I just put '.' in my quake2.conf to rely on current dir)
TTimo (ttimo@idsoftware.com)

View file

@ -13,15 +13,11 @@
** SWimp_SwitchFullscreen
*/
#include <ctype.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include "SDL.h"
@ -45,7 +41,7 @@ static qboolean X11_active = false;
static SDL_Surface *surface;
#ifndef OPENGL
static int sdl_palettemode;
static unsigned int sdl_palettemode;
#endif
struct
@ -120,7 +116,7 @@ void RW_IN_Init(in_state_t *in_state_p)
// mouse variables
_windowed_mouse = ri.Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE);
m_filter = ri.Cvar_Get ("m_filter", "0", 0);
in_mouse = ri.Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
in_mouse = ri.Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
my_freelook = ri.Cvar_Get( "freelook", "0", 0);
my_lookstrafe = ri.Cvar_Get ("lookstrafe", "0", 0);
@ -391,17 +387,21 @@ void GetEvent(SDL_Event *event)
case SDL_MOUSEBUTTONUP:
break;
case SDL_KEYDOWN:
#if 0
if ( (KeyStates[SDLK_LALT] || KeyStates[SDLK_RALT]) &&
(event->key.keysym.sym == SDLK_RETURN) ) {
/* SDL_WM_ToggleFullScreen(surface); */
cvar_t *fullscreen;
SDL_WM_ToggleFullScreen(surface);
if (surface->flags & SDL_FULLSCREEN) {
ri.Cvar_SetValue( "vid_fullscreen", /*1*/ 0 );
ri.Cvar_SetValue( "vid_fullscreen", 1 );
} else {
ri.Cvar_SetValue( "vid_fullscreen", /*0*/ 1 );
ri.Cvar_SetValue( "vid_fullscreen", 0 );
}
fullscreen = ri.Cvar_Get( "vid_fullscreen", "0", 0 );
fullscreen->modified = false; // we just changed it with SDL.
break; /* ignore this key */
}
@ -416,7 +416,7 @@ void GetEvent(SDL_Event *event)
break; /* ignore this key */
}
#endif
KeyStates[event->key.keysym.sym] = 1;
key = XLateKey(event->key.keysym.sym);
@ -495,6 +495,41 @@ int GLimp_Init( void *hInstance, void *wndProc )
}
#endif
static void SetSDLIcon(void)
{
#include "q2icon.xbm"
SDL_Surface *icon;
SDL_Color color;
Uint8 *ptr;
int i, mask;
icon = SDL_CreateRGBSurface(SDL_SWSURFACE, q2icon_width, q2icon_height, 8,
0, 0, 0, 0);
if (icon == NULL)
return; /* oh well... */
SDL_SetColorKey(icon, SDL_SRCCOLORKEY, 0);
color.r = 255;
color.g = 255;
color.b = 255;
SDL_SetColors(icon, &color, 0, 1); /* just in case */
color.r = 0;
color.g = 16;
color.b = 0;
SDL_SetColors(icon, &color, 1, 1);
ptr = (Uint8 *)icon->pixels;
for (i = 0; i < sizeof(q2icon_bits); i++) {
for (mask = 1; mask != 0x100; mask <<= 1) {
*ptr = (q2icon_bits[i] & mask) ? 1 : 0;
ptr++;
}
}
SDL_WM_SetIcon(icon, NULL);
SDL_FreeSurface(icon);
}
/*
** SWimp_InitGraphics
**
@ -543,7 +578,9 @@ static qboolean SWimp_InitGraphics( qboolean fullscreen )
flags = /*SDL_DOUBLEBUF|*/SDL_SWSURFACE|SDL_HWPALETTE;
if (fullscreen)
flags |= SDL_FULLSCREEN;
SetSDLIcon(); /* currently uses q2icon.xbm data */
if ((surface = SDL_SetVideoMode(vid.width, vid.height, 8, flags)) == NULL) {
Sys_Error("(SOFTSDL) SDL SetVideoMode failed: %s\n", SDL_GetError());
return false;
@ -594,6 +631,8 @@ static qboolean GLimp_InitGraphics( qboolean fullscreen )
flags = SDL_OPENGL;
if (fullscreen)
flags |= SDL_FULLSCREEN;
SetSDLIcon(); /* currently uses q2icon.xbm data */
if ((surface = SDL_SetVideoMode(vid.width, vid.height, 0, flags)) == NULL) {
Sys_Error("(SDLGL) SDL SetVideoMode failed: %s\n", SDL_GetError());

View file

@ -56,7 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int VGA_width, VGA_height, VGA_rowbytes, VGA_bufferrowbytes, VGA_planar;
byte *VGA_pagebase;
char *framebuffer_ptr;
byte *framebuffer_ptr;
void VGA_UpdatePlanarScreen (void *srcbuffer);

View file

@ -65,6 +65,7 @@ static GC x_gc;
static Visual *x_vis;
static XVisualInfo *x_visinfo;
static int win_x, win_y;
static Atom wmDeleteWindow;
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | \
@ -168,14 +169,14 @@ PIXEL24 xlib_rgb24(int r,int g,int b)
void st2_fixup( XImage *framebuf, int x, int y, int width, int height)
{
int yi;
unsigned char *src;
byte *src;
PIXEL16 *dest;
register int count, n;
if( (x<0)||(y<0) )return;
for (yi = y; yi < (y+height); yi++) {
src = &framebuf->data [yi * framebuf->bytes_per_line];
src = (byte *)&framebuf->data [yi * framebuf->bytes_per_line];
// Duff's Device
count = width;
@ -204,14 +205,14 @@ void st2_fixup( XImage *framebuf, int x, int y, int width, int height)
void st3_fixup( XImage *framebuf, int x, int y, int width, int height)
{
int yi;
unsigned char *src;
byte *src;
PIXEL24 *dest;
register int count, n;
if( (x<0)||(y<0) )return;
for (yi = y; yi < (y+height); yi++) {
src = &framebuf->data [yi * framebuf->bytes_per_line];
src = (byte *)&framebuf->data [yi * framebuf->bytes_per_line];
// Duff's Device
count = width;
@ -276,6 +277,8 @@ static cvar_t *m_pitch;
static cvar_t *m_forward;
static cvar_t *freelook;
static Time myxtime;
static void Force_CenterView_f (void)
{
in_state->viewangles[PITCH] = 0;
@ -316,17 +319,6 @@ void RW_IN_Init(in_state_t *in_state_p)
mouse_avail = true;
}
void RW_IN_Shutdown(void)
{
if (mouse_avail) {
mouse_avail = false;
ri.Cmd_RemoveCommand ("+mlook");
ri.Cmd_RemoveCommand ("-mlook");
ri.Cmd_RemoveCommand ("force_centerview");
}
}
/*
===========
IN_Commands
@ -339,13 +331,21 @@ void RW_IN_Commands (void)
if (!mouse_avail)
return;
for (i=0 ; i<3 ; i++) {
for (i=0 ; i<5 ; i++) {
if ( (mouse_buttonstate & (1<<i)) && !(mouse_oldbuttonstate & (1<<i)) )
in_state->Key_Event_fp (K_MOUSE1 + i, true);
if ( !(mouse_buttonstate & (1<<i)) && (mouse_oldbuttonstate & (1<<i)) )
in_state->Key_Event_fp (K_MOUSE1 + i, false);
}
if ( (mouse_buttonstate & (1<<3)) && !(mouse_oldbuttonstate & (1<<3)) )
in_state->Key_Event_fp (K_MWHEELUP, true);
if ( !(mouse_buttonstate & (1<<3)) && (mouse_oldbuttonstate & (1<<3)) )
in_state->Key_Event_fp (K_MWHEELUP, false);
if ( (mouse_buttonstate & (1<<4)) && !(mouse_oldbuttonstate & (1<<4)) )
in_state->Key_Event_fp (K_MWHEELDOWN, true);
if ( !(mouse_buttonstate & (1<<4)) && (mouse_oldbuttonstate & (1<<4)) )
in_state->Key_Event_fp (K_MWHEELDOWN, false);
mouse_oldbuttonstate = mouse_buttonstate;
}
@ -508,7 +508,64 @@ void RW_IN_Activate(qboolean active)
if (active)
IN_ActivateMouse();
else
IN_DeactivateMouse ();
IN_DeactivateMouse();
}
void RW_IN_Shutdown(void)
{
if (mouse_avail) {
RW_IN_Activate (false);
mouse_avail = false;
ri.Cmd_RemoveCommand ("+mlook");
ri.Cmd_RemoveCommand ("-mlook");
ri.Cmd_RemoveCommand ("force_centerview");
}
}
/*****************************************************************************/
char *RW_Sys_GetClipboardData()
{
Window sowner;
Atom type, property;
unsigned long len, bytes_left, tmp;
unsigned char *data;
int format, result;
char *ret = NULL;
sowner = XGetSelectionOwner(dpy, XA_PRIMARY);
if (sowner != None) {
property = XInternAtom(dpy,
"GETCLIPBOARDDATA_PROP",
False);
XConvertSelection(dpy,
XA_PRIMARY, XA_STRING,
property, win, myxtime); /* myxtime == time of last X event */
XFlush(dpy);
XGetWindowProperty(dpy,
win, property,
0, 0, False, AnyPropertyType,
&type, &format, &len,
&bytes_left, &data);
if (bytes_left > 0) {
result =
XGetWindowProperty(dpy,
win, property,
0, bytes_left, True, AnyPropertyType,
&type, &format, &len,
&tmp, &data);
if (result == Success) {
ret = strdup(data);
}
XFree(data);
}
}
return ret;
}
/*****************************************************************************/
@ -760,6 +817,7 @@ void HandleEvents(void)
switch(event.type) {
case KeyPress:
myxtime = event.xkey.time;
case KeyRelease:
if (in_state && in_state->Key_Event_fp)
in_state->Key_Event_fp (XLateKey(&event.xkey), event.type == KeyPress);
@ -789,10 +847,9 @@ void HandleEvents(void)
}
break;
break;
case ButtonPress:
myxtime = event.xbutton.time;
b=-1;
if (event.xbutton.button == 1)
b = 0;
@ -800,6 +857,10 @@ void HandleEvents(void)
b = 2;
else if (event.xbutton.button == 3)
b = 1;
else if (event.xbutton.button == 4)
in_state->Key_Event_fp (K_MWHEELUP, 1);
else if (event.xbutton.button == 5)
in_state->Key_Event_fp (K_MWHEELDOWN, 1);
if (b>=0)
mouse_buttonstate |= 1<<b;
break;
@ -812,6 +873,10 @@ void HandleEvents(void)
b = 2;
else if (event.xbutton.button == 3)
b = 1;
else if (event.xbutton.button == 4)
in_state->Key_Event_fp (K_MWHEELUP, 0);
else if (event.xbutton.button == 5)
in_state->Key_Event_fp (K_MWHEELDOWN, 0);
if (b>=0)
mouse_buttonstate &= ~(1<<b);
break;
@ -840,6 +905,11 @@ void HandleEvents(void)
config_notify = 1;
break;
case ClientMessage:
if (event.xclient.data.l[0] == wmDeleteWindow)
ri.Cmd_ExecuteText(EXEC_NOW, "quit");
break;
default:
if (doShm && event.type == x_shmeventtype)
oktodraw = true;
@ -869,7 +939,7 @@ int SWimp_Init( void *hInstance, void *wndProc )
vid_ypos = ri.Cvar_Get ("vid_ypos", "22", CVAR_ARCHIVE);
// open the display
dpy = XOpenDisplay(0);
dpy = XOpenDisplay(NULL);
if (!dpy)
{
if (getenv("DISPLAY"))
@ -981,6 +1051,7 @@ static qboolean SWimp_InitGraphics( qboolean fullscreen )
int attribmask = CWEventMask | CWColormap | CWBorderPixel;
XSetWindowAttributes attribs;
XSizeHints *sizehints;
XWMHints *wmhints;
Colormap tmpcmap;
tmpcmap = XCreateColormap(dpy, root, x_vis, AllocNone);
@ -1006,13 +1077,38 @@ static qboolean SWimp_InitGraphics( qboolean fullscreen )
sizehints->flags = PMinSize | PMaxSize | PBaseSize;
}
wmhints = XAllocWMHints();
if (wmhints) {
#include "q2icon.xbm"
Pixmap icon_pixmap, icon_mask;
unsigned long fg, bg;
int i;
fg = BlackPixel(dpy, x_visinfo->screen);
bg = WhitePixel(dpy, x_visinfo->screen);
icon_pixmap = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, fg, bg, x_visinfo->depth);
for (i = 0; i < sizeof(q2icon_bits); i++)
q2icon_bits[i] = ~q2icon_bits[i];
icon_mask = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, bg, fg, x_visinfo->depth);
wmhints->flags = IconPixmapHint|IconMaskHint;
wmhints->icon_pixmap = icon_pixmap;
wmhints->icon_mask = icon_mask;
}
XSetWMProperties(dpy, win, NULL, NULL, NULL, 0,
sizehints, None, None);
sizehints, wmhints, None);
if (sizehints)
XFree(sizehints);
if (wmhints)
XFree(wmhints);
XStoreName(dpy, win, "Quake II");
wmDeleteWindow = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
XSetWMProtocols(dpy, win, &wmDeleteWindow, 1);
if (x_visinfo->class != TrueColor)
XFreeColormap(dpy, tmpcmap);
}
@ -1080,7 +1176,7 @@ static qboolean SWimp_InitGraphics( qboolean fullscreen )
current_framebuffer = 0;
vid.rowbytes = x_framebuffer[0]->bytes_per_line;
vid.buffer = x_framebuffer[0]->data;
vid.buffer = (byte *)x_framebuffer[0]->data;
// XSynchronize(dpy, False);
@ -1111,7 +1207,7 @@ void SWimp_EndFrame (void)
else
ResetFrameBuffer();
vid.rowbytes = x_framebuffer[0]->bytes_per_line;
vid.buffer = x_framebuffer[current_framebuffer]->data;
vid.buffer = (byte *)x_framebuffer[current_framebuffer]->data;
vid.recalc_refdef = 1; // force a surface cache flush
Con_CheckResize();
Con_Clear_f();
@ -1132,7 +1228,7 @@ void SWimp_EndFrame (void)
while (!oktodraw)
HandleEvents();
current_framebuffer = !current_framebuffer;
vid.buffer = x_framebuffer[current_framebuffer]->data;
vid.buffer = (byte *)x_framebuffer[current_framebuffer]->data;
XSync(dpy, False);
}
else
@ -1239,6 +1335,8 @@ void SWimp_Shutdown( void )
XDestroyWindow( dpy, win );
win = 0;
// XAutoRepeatOn(dpy);
// XCloseDisplay(dpy);
@ -1298,5 +1396,3 @@ void KBD_Update(void)
void KBD_Close(void)
{
}

View file

@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../client/client.h"
#include "../client/snd_loc.h"
int audio_fd;
int audio_fd = -1;
int snd_inited;
cvar_t *sndbits;
@ -39,11 +39,10 @@ cvar_t *sndspeed;
cvar_t *sndchannels;
cvar_t *snddevice;
static int tryrates[] = { 11025, 22051, 44100, 8000 };
static int tryrates[] = { 11025, 22051, 44100, 48000, 8000 };
qboolean SNDDMA_Init(void)
{
int rc;
int fmt;
int tmp;
@ -55,7 +54,10 @@ qboolean SNDDMA_Init(void)
if (snd_inited)
return 1;
if (!snddevice) {
snd_inited = 0;
if (!snddevice)
{
sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE);
sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE);
sndchannels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE);
@ -64,50 +66,55 @@ qboolean SNDDMA_Init(void)
// open /dev/dsp, confirm capability to mmap, and get size of dma buffer
if (!audio_fd) {
if (audio_fd == -1)
{
seteuid(saved_euid);
audio_fd = open(snddevice->string, O_RDWR);
seteuid(getuid());
if (audio_fd < 0)
if (audio_fd == -1)
{
perror(snddevice->string);
Com_Printf("Could not open %s\n", snddevice->string);
seteuid(getuid());
Com_Printf("SNDDMA_Init: Could not open %s.\n", snddevice->string);
return 0;
}
seteuid(getuid());
}
rc = ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
if (rc < 0)
if (rc == -1)
{
perror(snddevice->string);
Com_Printf("Could not reset %s\n", snddevice->string);
Com_Printf("SNDDMA_Init: Could not reset %s.\n", snddevice->string);
close(audio_fd);
audio_fd = -1;
return 0;
}
if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &caps)==-1)
{
perror(snddevice->string);
Com_Printf("Sound driver too old\n");
Com_Printf("SNDDMA_Init: Sound driver too old.\n");
close(audio_fd);
audio_fd = -1;
return 0;
}
if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP))
{
Com_Printf("Sorry but your soundcard can't do this\n");
Com_Printf("SNDDMA_Init: Sorry, but your soundcard doesn't support trigger or mmap. (%08x)\n", caps);
close(audio_fd);
audio_fd = -1;
return 0;
}
if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1)
{
perror("GETOSPACE");
Com_Printf("Um, can't do GETOSPACE?\n");
Com_Printf("SNDDMA_Init: GETOSPACE ioctl failed.\n");
close(audio_fd);
audio_fd = -1;
return 0;
}
@ -122,16 +129,18 @@ qboolean SNDDMA_Init(void)
}
dma.speed = (int)sndspeed->value;
if (!dma.speed) {
for (i=0 ; i<sizeof(tryrates)/4 ; i++)
if (!ioctl(audio_fd, SNDCTL_DSP_SPEED, &tryrates[i])) break;
dma.speed = tryrates[i];
}
if (!dma.speed)
{
for (i=0 ; i<sizeof(tryrates)/4 ; i++)
if (!ioctl(audio_fd, SNDCTL_DSP_SPEED, &tryrates[i]))
break;
dma.speed = tryrates[i];
}
dma.channels = (int)sndchannels->value;
if (dma.channels < 1 || dma.channels > 2)
dma.channels = 2;
dma.samples = info.fragstotal * info.fragsize / (dma.samplebits/8);
dma.submission_chunk = 1;
@ -139,12 +148,13 @@ qboolean SNDDMA_Init(void)
if (!dma.buffer)
dma.buffer = (unsigned char *) mmap(NULL, info.fragstotal
* info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
if (!dma.buffer)
* info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
if (!dma.buffer || dma.buffer == MAP_FAILED)
{
perror(snddevice->string);
Com_Printf("Could not mmap %s\n", snddevice->string);
Com_Printf("SNDDMA_Init: Could not mmap %s.\n", snddevice->string);
close(audio_fd);
audio_fd = -1;
return 0;
}
@ -155,24 +165,17 @@ qboolean SNDDMA_Init(void)
if (rc < 0)
{
perror(snddevice->string);
Com_Printf("Could not set %s to stereo=%d", snddevice->string, dma.channels);
Com_Printf("SNDDMA_Init: Could not set %s to stereo=%d.", snddevice->string, dma.channels);
close(audio_fd);
audio_fd = -1;
return 0;
}
if (tmp)
dma.channels = 2;
else
dma.channels = 1;
rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &dma.speed);
if (rc < 0)
{
perror(snddevice->string);
Com_Printf("Could not set %s speed to %d", snddevice->string, dma.speed);
close(audio_fd);
return 0;
}
if (dma.samplebits == 16)
{
rc = AFMT_S16_LE;
@ -180,8 +183,9 @@ qboolean SNDDMA_Init(void)
if (rc < 0)
{
perror(snddevice->string);
Com_Printf("Could not support 16-bit data. Try 8-bit.\n");
Com_Printf("SNDDMA_Init: Could not support 16-bit data. Try 8-bit.\n");
close(audio_fd);
audio_fd = -1;
return 0;
}
}
@ -192,16 +196,28 @@ qboolean SNDDMA_Init(void)
if (rc < 0)
{
perror(snddevice->string);
Com_Printf("Could not support 8-bit data.\n");
Com_Printf("SNDDMA_Init: Could not support 8-bit data.\n");
close(audio_fd);
audio_fd = -1;
return 0;
}
}
else
{
perror(snddevice->string);
Com_Printf("%d-bit sound not supported.", dma.samplebits);
Com_Printf("SNDDMA_Init: %d-bit sound not supported.", dma.samplebits);
close(audio_fd);
audio_fd = -1;
return 0;
}
rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &dma.speed);
if (rc < 0)
{
perror(snddevice->string);
Com_Printf("SNDDMA_Init: Could not set %s speed to %d.", snddevice->string, dma.speed);
close(audio_fd);
audio_fd = -1;
return 0;
}
@ -212,8 +228,9 @@ qboolean SNDDMA_Init(void)
if (rc < 0)
{
perror(snddevice->string);
Com_Printf("Could not toggle.\n");
Com_Printf("SNDDMA_Init: Could not toggle. (1)\n");
close(audio_fd);
audio_fd = -1;
return 0;
}
tmp = PCM_ENABLE_OUTPUT;
@ -221,8 +238,9 @@ qboolean SNDDMA_Init(void)
if (rc < 0)
{
perror(snddevice->string);
Com_Printf("Could not toggle.\n");
Com_Printf("SNDDMA_Init: Could not toggle. (2)\n");
close(audio_fd);
audio_fd = -1;
return 0;
}
@ -230,12 +248,10 @@ qboolean SNDDMA_Init(void)
snd_inited = 1;
return 1;
}
int SNDDMA_GetDMAPos(void)
{
struct count_info count;
if (!snd_inited) return 0;
@ -243,8 +259,9 @@ int SNDDMA_GetDMAPos(void)
if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1)
{
perror(snddevice->string);
Com_Printf("Uh, sound dead.\n");
Com_Printf("SNDDMA_GetDMAPos: GETOPTR failed.\n");
close(audio_fd);
audio_fd = -1;
snd_inited = 0;
return 0;
}
@ -253,7 +270,6 @@ int SNDDMA_GetDMAPos(void)
dma.samplepos = count.ptr / (dma.samplebits / 8);
return dma.samplepos;
}
void SNDDMA_Shutdown(void)
@ -262,6 +278,7 @@ void SNDDMA_Shutdown(void)
if (snd_inited)
{
close(audio_fd);
audio_fd = -1;
snd_inited = 0;
}
#endif

View file

@ -218,12 +218,15 @@ void *Sys_GetGameAPI (void *parms)
char name[MAX_OSPATH];
char *path;
char *str_p;
#if defined __i386__
const char *gamename = "gamei386.so";
#elif defined __alpha__
const char *gamename = "gameaxp.so";
#elif defined __powerpc__
const char *gamename = "gameppc.so";
#elif defined __sparc__
const char *gamename = "gamesparc.so";
#else
#error Unknown arch
#endif
@ -247,10 +250,18 @@ void *Sys_GetGameAPI (void *parms)
game_library = dlopen (name, RTLD_NOW );
if (game_library)
{
Com_DPrintf ("LoadLibrary (%s)\n",name);
Com_MDPrintf ("LoadLibrary (%s)\n",name);
break;
} else {
Com_DPrintf ("LoadLibrary (%s) failed\n", name, dlerror());
Com_MDPrintf ("LoadLibrary (%s)\n", name);
str_p = strchr(dlerror(), ':'); // skip the path (already shown)
if (str_p != NULL)
{
Com_MDPrintf (" **");
while (*str_p)
Com_MDPrintf ("%c", *(++str_p));
Com_MDPrintf ("\n");
}
}
}
@ -284,11 +295,6 @@ void Sys_SendKeyEvents (void)
/*****************************************************************************/
char *Sys_GetClipboardData(void)
{
return NULL;
}
int main (int argc, char **argv)
{
int time, oldtime, newtime;
@ -318,7 +324,6 @@ int main (int argc, char **argv)
Qcommon_Frame (time);
oldtime = newtime;
}
}
#if 0

View file

@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include "../client/client.h"
@ -70,6 +69,10 @@ void (*RW_IN_Frame_fp)(void);
void Real_IN_Init (void);
/** CLIPBOARD *************************************************************/
char *(*RW_Sys_GetClipboardData_fp)(void);
/*
==========================================================================
@ -186,6 +189,7 @@ void VID_FreeReflib (void)
RW_IN_Commands_fp = NULL;
RW_IN_Move_fp = NULL;
RW_IN_Frame_fp = NULL;
RW_Sys_GetClipboardData_fp = NULL;
memset (&re, 0, sizeof(re));
reflib_library = NULL;
@ -205,9 +209,6 @@ qboolean VID_LoadRefresh( char *name )
char *path;
struct stat st;
extern uid_t saved_euid;
#if 0
FILE *fp;
#endif
if ( reflib_active )
{
@ -226,20 +227,6 @@ qboolean VID_LoadRefresh( char *name )
//regain root
seteuid(saved_euid);
#if 0
if ((fp = fopen(so_file, "r")) == NULL) {
Com_Printf( "LoadLibrary(\"%s\") failed: can't open %s (required for location of ref libraries)\n", name, so_file);
return false;
}
fgets(fn, sizeof(fn), fp);
fclose(fp);
while (*fn && isspace(fn[strlen(fn) - 1]))
fn[strlen(fn) - 1] = 0;
strcat(fn, "/");
strcat(fn, name);
#endif
path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
@ -320,6 +307,9 @@ qboolean VID_LoadRefresh( char *name )
(RW_IN_Frame_fp = dlsym(reflib_library, "RW_IN_Frame")) == NULL)
Sys_Error("No RW_IN functions in REF.\n");
/* this one is optional */
RW_Sys_GetClipboardData_fp = dlsym(reflib_library, "RW_Sys_GetClipboardData");
Real_IN_Init();
if ( re.Init( 0, 0 ) == -1 )
@ -531,3 +521,10 @@ void Do_Key_Event(int key, qboolean down)
Key_Event(key, down, Sys_Milliseconds());
}
char *Sys_GetClipboardData(void)
{
if (RW_Sys_GetClipboardData_fp)
return RW_Sys_GetClipboardData_fp();
else
return NULL;
}

View file

@ -1 +0,0 @@
zip -9r code .

View file

@ -1 +0,0 @@
zip -9 -r -D -X code .

View file

@ -23,6 +23,9 @@ void CDAudio_Play(int track, qboolean looping)
{
}
void CDAudio_RandomPlay(void)
{
}
void CDAudio_Stop(void)
{

View file

@ -39,6 +39,7 @@ FILE *log_stats_file;
cvar_t *host_speeds;
cvar_t *log_stats;
cvar_t *developer;
cvar_t *modder;
cvar_t *timescale;
cvar_t *fixedtime;
cvar_t *logfile_active; // 1 = buffer log, 2 = flush after each print
@ -167,6 +168,30 @@ void Com_DPrintf (char *fmt, ...)
}
/*
================
Com_MDPrintf
A Com_Printf that only shows up when either the "modder" or "developer"
cvar is set
================
*/
void Com_MDPrintf (char *fmt, ...)
{
va_list argptr;
char msg[MAXPRINTMSG];
if ((!modder || !modder->value) && (!developer || !developer->value))
return;
va_start (argptr, fmt);
vsnprintf (msg, MAXPRINTMSG, fmt, argptr);
va_end (argptr);
Com_Printf ("%s", msg);
}
/*
=============
Com_Error
@ -1443,6 +1468,7 @@ void Qcommon_Init (int argc, char **argv)
host_speeds = Cvar_Get ("host_speeds", "0", 0);
log_stats = Cvar_Get ("log_stats", "0", 0);
developer = Cvar_Get ("developer", "0", 0);
modder = Cvar_Get ("modder", "0", 0);
timescale = Cvar_Get ("timescale", "1", 0);
fixedtime = Cvar_Get ("fixedtime", "0", 0);
logfile_active = Cvar_Get ("logfile", "0", 0);

View file

@ -521,7 +521,9 @@ void FS_AddGameDirectory (char *dir)
// add the base directory to the search path
//
search = Z_Malloc (sizeof(searchpath_t));
strcpy (search->filename, dir);
strncpy (search->filename, dir, sizeof(search->filename)-1);
search->filename[sizeof(search->filename)-1] = 0;
search->next = fs_searchpaths;
fs_searchpaths = search;
@ -541,6 +543,38 @@ void FS_AddGameDirectory (char *dir)
}
}
/*
============
FS_AddHomeAsGameDirectory
Use ~/.quake2/dir as fs_gamedir
============
*/
void FS_AddHomeAsGameDirectory (char *dir)
{
#ifndef _WIN32
char gdir[MAX_OSPATH];
char *homedir = getenv( "HOME" );
if(homedir)
{
int len = snprintf(gdir, sizeof(gdir), "%s/.quake2/%s/", homedir, dir);
Com_Printf("using %s for writing\n",gdir);
FS_CreatePath (gdir);
if ((len > 0) && (len < sizeof(gdir)) && (gdir[len-1] == '/'))
gdir[len-1] = 0;
strncpy(fs_gamedir,gdir,sizeof(fs_gamedir)-1);
fs_gamedir[sizeof(fs_gamedir)-1] = 0;
FS_AddGameDirectory (gdir);
}
#endif
}
/*
============
FS_Gamedir
@ -560,42 +594,26 @@ FS_ExecAutoexec
*/
void FS_ExecAutoexec (void)
{
char *dir;
char name [MAX_QPATH];
char command [MAX_QPATH];
char newpath [MAX_QPATH];
searchpath_t *s;
searchpath_t *s, *end;
dir = Cvar_VariableString("gamedir");
// don't look in baseq2 if gamedir is set
if (fs_searchpaths == fs_base_searchpaths)
end = NULL;
else
end = fs_base_searchpaths;
// search through all the paths for an autoexec.cfg file
for (s = fs_searchpaths ; s ; s = s->next)
for (s = fs_searchpaths ; s != end ; s = s->next)
{
if (s->pack)
continue;
strcpy (newpath, s->filename);
// eat the last '/'
if (newpath[strlen(newpath) - 1] == '/')
newpath[strlen(newpath) - 1] = '\0';
if (*dir)
{
// skip when current search path and gamedir are equal
if(!strncmp(dir, newpath + 2, strlen(dir)))
Com_sprintf(name, sizeof(name), "%s/autoexec.cfg", newpath);
else
Com_sprintf(name, sizeof(name), "%s/%s/autoexec.cfg", newpath, dir);
}
else
Com_sprintf(name, sizeof(name), "%s/autoexec.cfg", newpath);
Com_sprintf(name, sizeof(name), "%s/autoexec.cfg", s->filename);
if (Sys_FindFirst(name, 0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM))
{
strcpy (command, "exec ");
strcat (command, name);
Cbuf_AddText (command);
Cbuf_AddText ("exec autoexec.cfg\n");
Sys_FindClose();
break;
}
@ -645,7 +663,6 @@ void FS_SetGamedir (char *dir)
if (dedicated && !dedicated->value)
Cbuf_AddText ("vid_restart\nsnd_restart\n");
Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);
// now add new entries for
if (!strcmp(dir,BASEDIRNAME) || (*dir == 0))
@ -659,6 +676,7 @@ void FS_SetGamedir (char *dir)
if (fs_cddir->string[0])
FS_AddGameDirectory (va("%s/%s", fs_cddir->string, dir) );
FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
FS_AddHomeAsGameDirectory (dir);
}
}
@ -844,14 +862,13 @@ char *FS_NextPath (char *prevpath)
searchpath_t *s;
char *prev;
if (!prevpath)
return fs_gamedir;
prev = fs_gamedir;
prev = NULL; // fs_gamedir is the first directory in the searchpath
for (s=fs_searchpaths ; s ; s=s->next)
{
if (s->pack)
continue;
if (prevpath == NULL)
return s->filename;
if (prevpath == prev)
return s->filename;
prev = s->filename;
@ -895,10 +912,7 @@ void FS_InitFilesystem (void)
//
// then add a '.quake2/baseq2' directory in home directory by default
//
strcpy (fs_gamedir, getenv("HOME"));
strcat (fs_gamedir, "/.quake2/baseq2/");
FS_CreatePath (fs_gamedir);
FS_AddGameDirectory (fs_gamedir);
FS_AddHomeAsGameDirectory (BASEDIRNAME);
// any set gamedirs will be freed up to here
fs_base_searchpaths = fs_searchpaths;

View file

@ -32,7 +32,7 @@ packet header
The remote connection never knows if it missed a reliable message, the
local side detects that it has been dropped by seeing a sequence acknowledge
higher thatn the last reliable sequence, but without the correct evon/odd
higher than the last reliable sequence, but without the correct even/odd
bit for the reliable set.
If the sender notices that a reliable message has been dropped, it will be

View file

@ -738,6 +738,7 @@ void Com_BeginRedirect (int target, char *buffer, int buffersize, void (*flush)
void Com_EndRedirect (void);
void Com_Printf (char *fmt, ...);
void Com_DPrintf (char *fmt, ...);
void Com_MDPrintf (char *fmt, ...);
void Com_Error (int code, char *fmt, ...) __attribute__((noreturn));
void Com_Quit (void);
@ -751,6 +752,7 @@ float frand(void); // 0 ti 1
float crand(void); // -1 to 1
extern cvar_t *developer;
extern cvar_t *modder;
extern cvar_t *dedicated;
extern cvar_t *host_speeds;
extern cvar_t *log_stats;
@ -824,4 +826,4 @@ void SV_Frame (int msec);
char *strlwr(char *);
//char *strlwr (char *); // FIXME: is this needed?

View file

@ -1525,7 +1525,7 @@ void GL_InitImages (void)
if ( qglColorTableEXT )
{
ri.FS_LoadFile( "pics/16to8.dat", (void**)&gl_state.d_16to8table );
ri.FS_LoadFile( "pics/16to8.dat", (void **)&gl_state.d_16to8table );
if ( !gl_state.d_16to8table )
ri.Sys_Error( ERR_FATAL, "Couldn't load pics/16to8.pcx");
}

View file

@ -28,11 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <GL/glext.h>
#include <math.h>
#ifndef _WIN32
char *strlwr (char *s);
#endif
/*
#ifndef __linux__
#ifndef GL_COLOR_INDEX8_EXT
#define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
#endif
# ifndef GL_COLOR_INDEX8_EXT
# define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
# endif
#endif
*/

View file

@ -224,7 +224,7 @@ model_t *Mod_ForName (char *name, qboolean crash)
//
// load the file
//
modfilelen = ri.FS_LoadFile (mod->name, (void**)&buf);
modfilelen = ri.FS_LoadFile (mod->name, (void **)&buf);
if (!buf)
{
if (crash)

View file

@ -871,7 +871,6 @@ void R_RenderView (refdef_t *fd)
}
}
void R_SetGL2D (void)
{
// set 2D virtual screen size
@ -887,6 +886,7 @@ void R_SetGL2D (void)
qglEnable (GL_ALPHA_TEST);
qglColor4ubv (color_white);
}
/*
static void GL_DrawColoredStereoLinePair( float r, float g, float b, float y )
{

View file

@ -29,15 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#include <GL/gl.h>
#ifdef __linux__
//#include <GL/fxmesa.h>
#include <GL/glx.h>
#include <dlfcn.h>
#ifndef __GLW_LINUX_H
#include "../linux/glw_linux.h"
#endif
#endif
#include <GL/glext.h>
qboolean QGL_Init( const char *dllname );
void QGL_Shutdown( void );
@ -46,6 +38,7 @@ void QGL_Shutdown( void );
# define APIENTRY
#endif
/*
#ifdef __OpenBSD__
#define GPA(X) dlsym(glw_state.OpenGLLib, "_"##X)
#else
@ -55,6 +48,7 @@ void QGL_Shutdown( void );
#ifndef qwglGetProcAddress
#define qwglGetProcAddress(X) (glw_state.OpenGLLib ? GPA(X) : NULL)
#endif
*/
extern void ( APIENTRY * qglAccum )(GLenum op, GLfloat value);
extern void ( APIENTRY * qglAlphaFunc )(GLenum func, GLclampf ref);
@ -447,37 +441,24 @@ extern BOOL ( WINAPI * qwglSetDeviceGammaRampEXT ) ( const unsigned char *pRed,
#ifdef __linux__
// local function in dll
#ifndef qwglGetProcAddress
//#ifndef qwglGetProcAddress // FIXME
extern void *qwglGetProcAddress(char *symbol);
#endif
//#endif
extern void (*qgl3DfxSetPaletteEXT)(GLuint *);
/*
//FX Mesa Functions
extern fxMesaContext (*qfxMesaCreateContext)(GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]);
extern fxMesaContext (*qfxMesaCreateBestContext)(GLuint win, GLint width, GLint height, const GLint attribList[]);
extern void (*qfxMesaDestroyContext)(fxMesaContext ctx);
extern void (*qfxMesaMakeCurrent)(fxMesaContext ctx);
extern fxMesaContext (*qfxMesaGetCurrentContext)(void);
extern void (*qfxMesaSwapBuffers)(void);
*/
//GLX Functions
extern XVisualInfo * (*qglXChooseVisual)( Display *dpy, int screen, int *attribList );
extern GLXContext (*qglXCreateContext)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
extern void (*qglXDestroyContext)( Display *dpy, GLXContext ctx );
extern Bool (*qglXMakeCurrent)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
extern void (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
extern void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
// 3dfxSetPaletteEXT shunt
void APIENTRY Fake_glColorTableEXT( GLenum target, GLenum internalformat,
GLsizei width, GLenum format, GLenum type,
const GLvoid *table );
GLsizei width, GLenum format, GLenum type,
const GLvoid *table );
#endif // linux
/* deprecated */
#define GL_TEXTURE0_SGIS 0x835E
#define GL_TEXTURE1_SGIS 0x835F
#if 0 // FIXME: these are in glext.h, delete after testing
/*
** extension constants
*/
@ -492,11 +473,11 @@ void APIENTRY Fake_glColorTableEXT( GLenum target, GLenum internalformat,
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
#endif
#define GL_TEXTURE0_SGIS 0x835E
#define GL_TEXTURE1_SGIS 0x835F
#define GL_TEXTURE0_ARB 0x84C0
#define GL_TEXTURE1_ARB 0x84C1
#endif // FIXME: end of glext.h defines
extern int GL_Texture0, GL_Texture1;
#endif

View file

@ -327,7 +327,8 @@ qboolean R_Init( void *hInstance, void *wndProc )
R_Register ();
Draw_GetPalette ();
SWimp_Init( hInstance, wndProc );
if (SWimp_Init( hInstance, wndProc ) == false)
return false;
// create the window
R_BeginFrame( 0 );

View file

@ -882,7 +882,7 @@ recorded, but no playerinfo will be stored. Primarily for demo merging.
void SV_ServerRecord_f (void)
{
char name[MAX_OSPATH];
char buf_data[32768];
byte buf_data[32768];
sizebuf_t buf;
int len;
int i;

View file

@ -124,7 +124,7 @@ Writes a delta update of an entity_state_t list to the message.
*/
void SV_EmitPacketEntities (client_frame_t *from, client_frame_t *to, sizebuf_t *msg)
{
entity_state_t *oldent = 0, *newent = 0;
entity_state_t *oldent = NULL, *newent = NULL;
int oldindex, newindex;
int oldnum, newnum;
int from_num_entities;

View file

@ -1,478 +0,0 @@
#
# Quake2 Makefile for Solaris
#
# Jan '98 by Zoid <zoid@idsoftware.com>
#
ifneq (,$(findstring i86pc,$(shell uname -m)))
ARCH=i386
else
ARCH=sparc
endif
MOUNT_DIR=/chest/Quake2/code
BUILD_DEBUG_DIR=debug$(ARCH)
BUILD_RELEASE_DIR=release$(ARCH)
CLIENT_DIR=$(MOUNT_DIR)/client
SERVER_DIR=$(MOUNT_DIR)/server
COMMON_DIR=$(MOUNT_DIR)/qcommon
SOLARIS_DIR=$(MOUNT_DIR)/solaris
GAME_DIR=$(MOUNT_DIR)/game
XATRIX_DIR=$(MOUNT_DIR)/xatrix
CTF_DIR=$(MOUNT_DIR)/game
NULL_DIR=$(MOUNT_DIR)/null
ARCH=i386
CC=gcc
BASE_CFLAGS=-Dstricmp=strcasecmp
RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -fomit-frame-pointer -fno-strength-reduce -funroll-loops -fexpensive-optimizations
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
LDFLAGS=-ldl -lm -lnsl -lsocket
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-G
DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
#############################################################################
# SETUP AND BUILD
#############################################################################
TARGETS=$(BUILDDIR)/quake2 $(BUILDDIR)/game$(ARCH).$(SHLIBEXT)
build_debug:
@-mkdir $(BUILD_DEBUG_DIR) \
$(BUILD_DEBUG_DIR)/client \
$(BUILD_DEBUG_DIR)/game
$(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)"
build_release:
@-mkdir $(BUILD_RELEASE_DIR) \
$(BUILD_RELEASE_DIR)/client \
$(BUILD_RELEASE_DIR)/game
$(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS)"
all: build_debug build_release
targets: $(TARGETS)
#############################################################################
# CLIENT/SERVER
#############################################################################
QUAKE2_OBJS = \
$(BUILDDIR)/client/cl_cin.o \
$(BUILDDIR)/client/cl_ents.o \
$(BUILDDIR)/client/cl_fx.o \
$(BUILDDIR)/client/cl_input.o \
$(BUILDDIR)/client/cl_inv.o \
$(BUILDDIR)/client/cl_main.o \
$(BUILDDIR)/client/cl_parse.o \
$(BUILDDIR)/client/cl_pred.o \
$(BUILDDIR)/client/cl_tent.o \
$(BUILDDIR)/client/cl_scrn.o \
$(BUILDDIR)/client/cl_view.o \
$(BUILDDIR)/client/console.o \
$(BUILDDIR)/client/keys.o \
$(BUILDDIR)/client/menu.o \
$(BUILDDIR)/client/qmenu.o \
$(BUILDDIR)/client/m_flash.o \
\
$(BUILDDIR)/client/cmd.o \
$(BUILDDIR)/client/cmodel.o \
$(BUILDDIR)/client/common.o \
$(BUILDDIR)/client/cvar.o \
$(BUILDDIR)/client/files.o \
$(BUILDDIR)/client/md4.o \
$(BUILDDIR)/client/net_chan.o \
\
$(BUILDDIR)/client/sv_ccmds.o \
$(BUILDDIR)/client/sv_ents.o \
$(BUILDDIR)/client/sv_game.o \
$(BUILDDIR)/client/sv_init.o \
$(BUILDDIR)/client/sv_main.o \
$(BUILDDIR)/client/sv_send.o \
$(BUILDDIR)/client/sv_user.o \
$(BUILDDIR)/client/sv_world.o \
\
$(BUILDDIR)/client/snd_dma.o \
$(BUILDDIR)/client/snd_mem.o \
$(BUILDDIR)/client/snd_mix.o \
\
$(BUILDDIR)/client/cd_null.o \
$(BUILDDIR)/client/q_shsolaris.o \
$(BUILDDIR)/client/vid_null.o \
$(BUILDDIR)/client/ref_null.o \
$(BUILDDIR)/client/in_null.o \
$(BUILDDIR)/client/snddma_null.o \
$(BUILDDIR)/client/sys_solaris.o \
$(BUILDDIR)/client/glob.o \
$(BUILDDIR)/client/net_udp.o \
\
$(BUILDDIR)/client/q_shared.o \
$(BUILDDIR)/client/pmove.o
$(BUILDDIR)/quake2 : $(QUAKE2_OBJS)
$(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(LDFLAGS)
$(BUILDDIR)/client/cl_cin.o : $(CLIENT_DIR)/cl_cin.c
$(DO_CC)
$(BUILDDIR)/client/cl_ents.o : $(CLIENT_DIR)/cl_ents.c
$(DO_CC)
$(BUILDDIR)/client/cl_fx.o : $(CLIENT_DIR)/cl_fx.c
$(DO_CC)
$(BUILDDIR)/client/cl_input.o : $(CLIENT_DIR)/cl_input.c
$(DO_CC)
$(BUILDDIR)/client/cl_inv.o : $(CLIENT_DIR)/cl_inv.c
$(DO_CC)
$(BUILDDIR)/client/cl_main.o : $(CLIENT_DIR)/cl_main.c
$(DO_CC)
$(BUILDDIR)/client/cl_parse.o : $(CLIENT_DIR)/cl_parse.c
$(DO_CC)
$(BUILDDIR)/client/cl_pred.o : $(CLIENT_DIR)/cl_pred.c
$(DO_CC)
$(BUILDDIR)/client/cl_tent.o : $(CLIENT_DIR)/cl_tent.c
$(DO_CC)
$(BUILDDIR)/client/cl_scrn.o : $(CLIENT_DIR)/cl_scrn.c
$(DO_CC)
$(BUILDDIR)/client/cl_view.o : $(CLIENT_DIR)/cl_view.c
$(DO_CC)
$(BUILDDIR)/client/console.o : $(CLIENT_DIR)/console.c
$(DO_CC)
$(BUILDDIR)/client/keys.o : $(CLIENT_DIR)/keys.c
$(DO_CC)
$(BUILDDIR)/client/menu.o : $(CLIENT_DIR)/menu.c
$(DO_CC)
$(BUILDDIR)/client/qmenu.o : $(CLIENT_DIR)/qmenu.c
$(DO_CC)
$(BUILDDIR)/client/m_flash.o : $(GAME_DIR)/m_flash.c
$(DO_CC)
$(BUILDDIR)/client/cmd.o : $(COMMON_DIR)/cmd.c
$(DO_CC)
$(BUILDDIR)/client/cmodel.o : $(COMMON_DIR)/cmodel.c
$(DO_CC)
$(BUILDDIR)/client/common.o : $(COMMON_DIR)/common.c
$(DO_CC)
$(BUILDDIR)/client/cvar.o : $(COMMON_DIR)/cvar.c
$(DO_CC)
$(BUILDDIR)/client/files.o : $(COMMON_DIR)/files.c
$(DO_CC)
$(BUILDDIR)/client/md4.o : $(COMMON_DIR)/md4.c
$(DO_CC)
$(BUILDDIR)/client/net_chan.o : $(COMMON_DIR)/net_chan.c
$(DO_CC)
$(BUILDDIR)/client/q_shared.o : $(GAME_DIR)/q_shared.c
$(DO_CC)
$(BUILDDIR)/client/pmove.o : $(COMMON_DIR)/pmove.c
$(DO_CC)
$(BUILDDIR)/client/sv_ccmds.o : $(SERVER_DIR)/sv_ccmds.c
$(DO_CC)
$(BUILDDIR)/client/sv_ents.o : $(SERVER_DIR)/sv_ents.c
$(DO_CC)
$(BUILDDIR)/client/sv_game.o : $(SERVER_DIR)/sv_game.c
$(DO_CC)
$(BUILDDIR)/client/sv_init.o : $(SERVER_DIR)/sv_init.c
$(DO_CC)
$(BUILDDIR)/client/sv_main.o : $(SERVER_DIR)/sv_main.c
$(DO_CC)
$(BUILDDIR)/client/sv_send.o : $(SERVER_DIR)/sv_send.c
$(DO_CC)
$(BUILDDIR)/client/sv_user.o : $(SERVER_DIR)/sv_user.c
$(DO_CC)
$(BUILDDIR)/client/sv_world.o : $(SERVER_DIR)/sv_world.c
$(DO_CC)
$(BUILDDIR)/client/cd_null.o : $(NULL_DIR)/cd_null.c
$(DO_CC)
$(BUILDDIR)/client/q_shsolaris.o : $(SOLARIS_DIR)/q_shsolaris.c
$(DO_CC)
$(BUILDDIR)/client/vid_null.o : $(NULL_DIR)/vid_null.c
$(DO_CC)
$(BUILDDIR)/client/ref_null.o : $(NULL_DIR)/ref_null.c
$(DO_CC)
$(BUILDDIR)/client/snddma_null.o : $(NULL_DIR)/snddma_null.c
$(DO_CC)
$(BUILDDIR)/client/snd_dma.o : $(CLIENT_DIR)/snd_dma.c
$(DO_CC)
$(BUILDDIR)/client/snd_mem.o : $(CLIENT_DIR)/snd_mem.c
$(DO_CC)
$(BUILDDIR)/client/snd_mix.o : $(CLIENT_DIR)/snd_mix.c
$(DO_CC)
$(BUILDDIR)/client/in_null.o : $(NULL_DIR)/in_null.c
$(DO_CC)
$(BUILDDIR)/client/sys_solaris.o : $(SOLARIS_DIR)/sys_solaris.c
$(DO_CC)
$(BUILDDIR)/client/glob.o : $(SOLARIS_DIR)/glob.c
$(DO_CC)
$(BUILDDIR)/client/net_udp.o : $(SOLARIS_DIR)/net_udp.c
$(DO_CC)
#############################################################################
# GAME
#############################################################################
GAME_OBJS = \
$(BUILDDIR)/game/g_ai.o \
$(BUILDDIR)/game/p_client.o \
$(BUILDDIR)/game/g_cmds.o \
$(BUILDDIR)/game/g_svcmds.o \
$(BUILDDIR)/game/g_combat.o \
$(BUILDDIR)/game/g_func.o \
$(BUILDDIR)/game/g_items.o \
$(BUILDDIR)/game/g_main.o \
$(BUILDDIR)/game/g_misc.o \
$(BUILDDIR)/game/g_monster.o \
$(BUILDDIR)/game/g_phys.o \
$(BUILDDIR)/game/g_save.o \
$(BUILDDIR)/game/g_spawn.o \
$(BUILDDIR)/game/g_target.o \
$(BUILDDIR)/game/g_trigger.o \
$(BUILDDIR)/game/g_turret.o \
$(BUILDDIR)/game/g_utils.o \
$(BUILDDIR)/game/g_weapon.o \
$(BUILDDIR)/game/m_actor.o \
$(BUILDDIR)/game/m_berserk.o \
$(BUILDDIR)/game/m_boss2.o \
$(BUILDDIR)/game/m_boss3.o \
$(BUILDDIR)/game/m_boss31.o \
$(BUILDDIR)/game/m_boss32.o \
$(BUILDDIR)/game/m_brain.o \
$(BUILDDIR)/game/m_chick.o \
$(BUILDDIR)/game/m_flipper.o \
$(BUILDDIR)/game/m_float.o \
$(BUILDDIR)/game/m_flyer.o \
$(BUILDDIR)/game/m_gladiator.o \
$(BUILDDIR)/game/m_gunner.o \
$(BUILDDIR)/game/m_hover.o \
$(BUILDDIR)/game/m_infantry.o \
$(BUILDDIR)/game/m_insane.o \
$(BUILDDIR)/game/m_medic.o \
$(BUILDDIR)/game/m_move.o \
$(BUILDDIR)/game/m_mutant.o \
$(BUILDDIR)/game/m_parasite.o \
$(BUILDDIR)/game/m_soldier.o \
$(BUILDDIR)/game/m_supertank.o \
$(BUILDDIR)/game/m_tank.o \
$(BUILDDIR)/game/p_hud.o \
$(BUILDDIR)/game/p_trail.o \
$(BUILDDIR)/game/p_view.o \
$(BUILDDIR)/game/p_weapon.o \
$(BUILDDIR)/game/q_shared.o \
$(BUILDDIR)/game/m_flash.o \
$(BUILDDIR)/game/g_so.o
$(BUILDDIR)/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
$(BUILDDIR)/game/g_ai.o : $(GAME_DIR)/g_ai.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/p_client.o : $(GAME_DIR)/p_client.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_cmds.o : $(GAME_DIR)/g_cmds.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_svcmds.o : $(GAME_DIR)/g_svcmds.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_combat.o : $(GAME_DIR)/g_combat.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_func.o : $(GAME_DIR)/g_func.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_items.o : $(GAME_DIR)/g_items.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_main.o : $(GAME_DIR)/g_main.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_misc.o : $(GAME_DIR)/g_misc.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_monster.o : $(GAME_DIR)/g_monster.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_phys.o : $(GAME_DIR)/g_phys.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_save.o : $(GAME_DIR)/g_save.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_spawn.o : $(GAME_DIR)/g_spawn.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_target.o : $(GAME_DIR)/g_target.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_trigger.o : $(GAME_DIR)/g_trigger.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_turret.o : $(GAME_DIR)/g_turret.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_utils.o : $(GAME_DIR)/g_utils.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_weapon.o : $(GAME_DIR)/g_weapon.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_actor.o : $(GAME_DIR)/m_actor.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_berserk.o : $(GAME_DIR)/m_berserk.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_boss2.o : $(GAME_DIR)/m_boss2.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_boss3.o : $(GAME_DIR)/m_boss3.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_boss31.o : $(GAME_DIR)/m_boss31.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_boss32.o : $(GAME_DIR)/m_boss32.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_brain.o : $(GAME_DIR)/m_brain.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_chick.o : $(GAME_DIR)/m_chick.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_flipper.o : $(GAME_DIR)/m_flipper.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_float.o : $(GAME_DIR)/m_float.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_flyer.o : $(GAME_DIR)/m_flyer.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_gladiator.o : $(GAME_DIR)/m_gladiator.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_gunner.o : $(GAME_DIR)/m_gunner.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_hover.o : $(GAME_DIR)/m_hover.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_infantry.o : $(GAME_DIR)/m_infantry.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_insane.o : $(GAME_DIR)/m_insane.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_medic.o : $(GAME_DIR)/m_medic.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_move.o : $(GAME_DIR)/m_move.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_mutant.o : $(GAME_DIR)/m_mutant.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_parasite.o : $(GAME_DIR)/m_parasite.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_soldier.o : $(GAME_DIR)/m_soldier.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_supertank.o : $(GAME_DIR)/m_supertank.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_tank.o : $(GAME_DIR)/m_tank.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/p_hud.o : $(GAME_DIR)/p_hud.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/p_trail.o : $(GAME_DIR)/p_trail.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/p_view.o : $(GAME_DIR)/p_view.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/p_weapon.o : $(GAME_DIR)/p_weapon.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/q_shared.o : $(GAME_DIR)/q_shared.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/m_flash.o : $(GAME_DIR)/m_flash.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_so.o : $(SOLARIS_DIR)/g_so.c
$(DO_SHLIB_CC)
#############################################################################
# MISC
#############################################################################
clean: clean-debug clean-release
clean-debug:
$(MAKE) clean2 BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)"
clean-release:
$(MAKE) clean2 BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(DEBUG_CFLAGS)"
clean2:
-rm -f $(QUAKE2_OBJS) \
$(GAME_OBJS) \
$(REF_SOFT_OBJS) \
$(REF_SOFT_SVGA_OBJS) \
$(REF_SOFT_X11_OBJS) \
$(REF_GL_OBJS)

View file

@ -6,13 +6,15 @@
# ELF only
#
VERSION=3.20
ifneq (,$(findstring i86pc,$(shell uname -m)))
ARCH=i386
else
ARCH=sparc
endif
MOUNT_DIR=/chest/Quake2/code
MOUNT_DIR=/grog/Projects/Quake2/code
BUILD_DEBUG_DIR=debug$(ARCH)
BUILD_RELEASE_DIR=release$(ARCH)
@ -23,6 +25,7 @@ SOLARIS_DIR=$(MOUNT_DIR)/solaris
GAME_DIR=$(MOUNT_DIR)/game
CTF_DIR=$(MOUNT_DIR)/ctf
XATRIX_DIR=$(MOUNT_DIR)/xatrix
ROGUE_DIR=$(MOUNT_DIR)/rogue
NULL_DIR=$(MOUNT_DIR)/null
CC=gcc
@ -48,14 +51,16 @@ DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
TARGETS=$(BUILDDIR)/q2ded \
$(BUILDDIR)/game$(ARCH).$(SHLIBEXT) \
$(BUILDDIR)/ctf/game$(ARCH).$(SHLIBEXT) \
$(BUILDDIR)/xatrix/game$(ARCH).$(SHLIBEXT)
$(BUILDDIR)/xatrix/game$(ARCH).$(SHLIBEXT) \
$(BUILDDIR)/rogue/game$(ARCH).$(SHLIBEXT)
build_debug:
@-mkdir $(BUILD_DEBUG_DIR) \
$(BUILD_DEBUG_DIR)/client \
$(BUILD_DEBUG_DIR)/game \
$(BUILD_DEBUG_DIR)/ctf \
$(BUILD_DEBUG_DIR)/xatrix
$(BUILD_DEBUG_DIR)/xatrix \
$(BUILD_DEBUG_DIR)/rogue
$(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)"
build_release:
@ -63,7 +68,8 @@ build_release:
$(BUILD_RELEASE_DIR)/client \
$(BUILD_RELEASE_DIR)/game \
$(BUILD_RELEASE_DIR)/ctf \
$(BUILD_RELEASE_DIR)/xatrix
$(BUILD_RELEASE_DIR)/xatrix \
$(BUILD_RELEASE_DIR)/rogue
$(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS)"
all: build_debug build_release
@ -189,6 +195,7 @@ GAME_OBJS = \
$(BUILDDIR)/game/p_client.o \
$(BUILDDIR)/game/g_cmds.o \
$(BUILDDIR)/game/g_svcmds.o \
$(BUILDDIR)/game/g_chase.o \
$(BUILDDIR)/game/g_combat.o \
$(BUILDDIR)/game/g_func.o \
$(BUILDDIR)/game/g_items.o \
@ -248,6 +255,9 @@ $(BUILDDIR)/game/g_cmds.o : $(GAME_DIR)/g_cmds.c
$(BUILDDIR)/game/g_svcmds.o : $(GAME_DIR)/g_svcmds.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_chase.o : $(GAME_DIR)/g_chase.c
$(DO_SHLIB_CC)
$(BUILDDIR)/game/g_combat.o : $(GAME_DIR)/g_combat.c
$(DO_SHLIB_CC)
@ -497,6 +507,7 @@ $(BUILDDIR)/ctf/q_shared.o : $(CTF_DIR)/q_shared.c
XATRIX_OBJS = \
$(BUILDDIR)/xatrix/g_ai.o \
$(BUILDDIR)/xatrix/g_cmds.o \
$(BUILDDIR)/xatrix/g_chase.o \
$(BUILDDIR)/xatrix/g_combat.o \
$(BUILDDIR)/xatrix/g_func.o \
$(BUILDDIR)/xatrix/g_items.o \
@ -556,6 +567,9 @@ $(BUILDDIR)/xatrix/g_ai.o : $(XATRIX_DIR)/g_ai.c
$(BUILDDIR)/xatrix/g_cmds.o : $(XATRIX_DIR)/g_cmds.c
$(DO_SHLIB_CC)
$(BUILDDIR)/xatrix/g_chase.o : $(XATRIX_DIR)/g_chase.c
$(DO_SHLIB_CC)
$(BUILDDIR)/xatrix/g_combat.o : $(XATRIX_DIR)/g_combat.c
$(DO_SHLIB_CC)
@ -703,6 +717,304 @@ $(BUILDDIR)/xatrix/p_weapon.o : $(XATRIX_DIR)/p_weapon.c
$(BUILDDIR)/xatrix/q_shared.o : $(XATRIX_DIR)/q_shared.c
$(DO_SHLIB_CC)
#############################################################################
# ROGUE
#############################################################################
ROGUE_OBJS = \
$(BUILDDIR)/rogue/dm_ball.o \
$(BUILDDIR)/rogue/dm_tag.o \
$(BUILDDIR)/rogue/g_ai.o \
$(BUILDDIR)/rogue/g_chase.o \
$(BUILDDIR)/rogue/g_cmds.o \
$(BUILDDIR)/rogue/g_combat.o \
$(BUILDDIR)/rogue/g_func.o \
$(BUILDDIR)/rogue/g_items.o \
$(BUILDDIR)/rogue/g_main.o \
$(BUILDDIR)/rogue/g_misc.o \
$(BUILDDIR)/rogue/g_monster.o \
$(BUILDDIR)/rogue/g_newai.o \
$(BUILDDIR)/rogue/g_newdm.o \
$(BUILDDIR)/rogue/g_newfnc.o \
$(BUILDDIR)/rogue/g_newtarg.o \
$(BUILDDIR)/rogue/g_newtrig.o \
$(BUILDDIR)/rogue/g_newweap.o \
$(BUILDDIR)/rogue/g_phys.o \
$(BUILDDIR)/rogue/g_save.o \
$(BUILDDIR)/rogue/g_spawn.o \
$(BUILDDIR)/rogue/g_sphere.o \
$(BUILDDIR)/rogue/g_svcmds.o \
$(BUILDDIR)/rogue/g_target.o \
$(BUILDDIR)/rogue/g_trigger.o \
$(BUILDDIR)/rogue/g_turret.o \
$(BUILDDIR)/rogue/g_utils.o \
$(BUILDDIR)/rogue/g_weapon.o \
$(BUILDDIR)/rogue/m_actor.o \
$(BUILDDIR)/rogue/m_berserk.o \
$(BUILDDIR)/rogue/m_boss2.o \
$(BUILDDIR)/rogue/m_boss3.o \
$(BUILDDIR)/rogue/m_boss31.o \
$(BUILDDIR)/rogue/m_boss32.o \
$(BUILDDIR)/rogue/m_brain.o \
$(BUILDDIR)/rogue/m_carrier.o \
$(BUILDDIR)/rogue/m_chick.o \
$(BUILDDIR)/rogue/m_flash.o \
$(BUILDDIR)/rogue/m_flipper.o \
$(BUILDDIR)/rogue/m_float.o \
$(BUILDDIR)/rogue/m_flyer.o \
$(BUILDDIR)/rogue/m_gladiator.o \
$(BUILDDIR)/rogue/m_gunner.o \
$(BUILDDIR)/rogue/m_hover.o \
$(BUILDDIR)/rogue/m_infantry.o \
$(BUILDDIR)/rogue/m_insane.o \
$(BUILDDIR)/rogue/m_medic.o \
$(BUILDDIR)/rogue/m_move.o \
$(BUILDDIR)/rogue/m_mutant.o \
$(BUILDDIR)/rogue/m_parasite.o \
$(BUILDDIR)/rogue/m_soldier.o \
$(BUILDDIR)/rogue/m_stalker.o \
$(BUILDDIR)/rogue/m_supertank.o \
$(BUILDDIR)/rogue/m_tank.o \
$(BUILDDIR)/rogue/m_turret.o \
$(BUILDDIR)/rogue/m_widow.o \
$(BUILDDIR)/rogue/m_widow2.o \
$(BUILDDIR)/rogue/p_client.o \
$(BUILDDIR)/rogue/p_hud.o \
$(BUILDDIR)/rogue/p_trail.o \
$(BUILDDIR)/rogue/p_view.o \
$(BUILDDIR)/rogue/p_weapon.o \
$(BUILDDIR)/rogue/q_shared.o
$(BUILDDIR)/rogue/game$(ARCH).$(SHLIBEXT) : $(ROGUE_OBJS)
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(ROGUE_OBJS)
$(BUILDDIR)/rogue/dm_ball.o : $(ROGUE_DIR)/dm_ball.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/dm_tag.o : $(ROGUE_DIR)/dm_tag.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_ai.o : $(ROGUE_DIR)/g_ai.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_chase.o : $(ROGUE_DIR)/g_chase.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_cmds.o : $(ROGUE_DIR)/g_cmds.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_combat.o : $(ROGUE_DIR)/g_combat.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_func.o : $(ROGUE_DIR)/g_func.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_items.o : $(ROGUE_DIR)/g_items.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_main.o : $(ROGUE_DIR)/g_main.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_misc.o : $(ROGUE_DIR)/g_misc.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_monster.o : $(ROGUE_DIR)/g_monster.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_newai.o : $(ROGUE_DIR)/g_newai.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_newdm.o : $(ROGUE_DIR)/g_newdm.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_newfnc.o : $(ROGUE_DIR)/g_newfnc.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_newtarg.o : $(ROGUE_DIR)/g_newtarg.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_newtrig.o : $(ROGUE_DIR)/g_newtrig.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_newweap.o : $(ROGUE_DIR)/g_newweap.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_phys.o : $(ROGUE_DIR)/g_phys.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_save.o : $(ROGUE_DIR)/g_save.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_spawn.o : $(ROGUE_DIR)/g_spawn.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_sphere.o : $(ROGUE_DIR)/g_sphere.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_svcmds.o : $(ROGUE_DIR)/g_svcmds.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_target.o : $(ROGUE_DIR)/g_target.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_trigger.o : $(ROGUE_DIR)/g_trigger.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_turret.o : $(ROGUE_DIR)/g_turret.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_utils.o : $(ROGUE_DIR)/g_utils.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/g_weapon.o : $(ROGUE_DIR)/g_weapon.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_actor.o : $(ROGUE_DIR)/m_actor.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_berserk.o : $(ROGUE_DIR)/m_berserk.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_boss2.o : $(ROGUE_DIR)/m_boss2.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_boss3.o : $(ROGUE_DIR)/m_boss3.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_boss31.o : $(ROGUE_DIR)/m_boss31.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_boss32.o : $(ROGUE_DIR)/m_boss32.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_brain.o : $(ROGUE_DIR)/m_brain.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_carrier.o : $(ROGUE_DIR)/m_carrier.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_chick.o : $(ROGUE_DIR)/m_chick.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_flash.o : $(ROGUE_DIR)/m_flash.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_flipper.o : $(ROGUE_DIR)/m_flipper.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_float.o : $(ROGUE_DIR)/m_float.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_flyer.o : $(ROGUE_DIR)/m_flyer.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_gladiator.o : $(ROGUE_DIR)/m_gladiator.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_gunner.o : $(ROGUE_DIR)/m_gunner.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_hover.o : $(ROGUE_DIR)/m_hover.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_infantry.o : $(ROGUE_DIR)/m_infantry.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_insane.o : $(ROGUE_DIR)/m_insane.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_medic.o : $(ROGUE_DIR)/m_medic.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_move.o : $(ROGUE_DIR)/m_move.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_mutant.o : $(ROGUE_DIR)/m_mutant.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_parasite.o : $(ROGUE_DIR)/m_parasite.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_soldier.o : $(ROGUE_DIR)/m_soldier.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_stalker.o : $(ROGUE_DIR)/m_stalker.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_supertank.o : $(ROGUE_DIR)/m_supertank.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_tank.o : $(ROGUE_DIR)/m_tank.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_turret.o : $(ROGUE_DIR)/m_turret.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_widow.o : $(ROGUE_DIR)/m_widow.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/m_widow2.o : $(ROGUE_DIR)/m_widow2.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/p_client.o : $(ROGUE_DIR)/p_client.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/p_hud.o : $(ROGUE_DIR)/p_hud.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/p_trail.o : $(ROGUE_DIR)/p_trail.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/p_view.o : $(ROGUE_DIR)/p_view.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/p_weapon.o : $(ROGUE_DIR)/p_weapon.c
$(DO_SHLIB_CC)
$(BUILDDIR)/rogue/q_shared.o : $(ROGUE_DIR)/q_shared.c
$(DO_SHLIB_CC)
#############################################################################
# TAR
#############################################################################
# Make RPMs. You need to be root to make this work
RPMDIR = /var/tmp/q2ded-$(VERSION)
tar:
if [ ! -d archives ];then mkdir archives;fi
$(MAKE) copyfiles COPYDIR=$(RPMDIR)
cd $(RPMDIR); tar cvf q2ded-$(VERSION)-$(ARCH)-sun-solaris2.5.1.tar *
cd $(RPMDIR); compress q2ded-$(VERSION)-$(ARCH)-sun-solaris2.5.1.tar
mv $(RPMDIR)/*.tar.Z archives/.
rm -rf $(RPMDIR)
copyfiles:
-mkdirhier $(COPYDIR)
cp $(BUILD_RELEASE_DIR)/q2ded $(COPYDIR)
strip $(COPYDIR)/q2ded
chmod 755 $(COPYDIR)/q2ded
-mkdir $(COPYDIR)/baseq2
chmod 755 $(COPYDIR)/baseq2
cp $(BUILD_RELEASE_DIR)/game$(ARCH).$(SHLIBEXT) $(COPYDIR)/baseq2
chmod 755 $(COPYDIR)/baseq2/game$(ARCH).$(SHLIBEXT)
# -mkdir $(COPYDIR)/ctf
# chmod 755 $(COPYDIR)/ctf
# cp $(BUILD_RELEASE_DIR)/ctf/game$(ARCH).$(SHLIBEXT) $(COPYDIR)/ctf
# chmod 755 $(COPYDIR)/ctf/game$(ARCH).$(SHLIBEXT)
-mkdir $(COPYDIR)/xatrix
chmod 755 $(COPYDIR)/xatrix
cp $(BUILD_RELEASE_DIR)/xatrix/game$(ARCH).$(SHLIBEXT) $(COPYDIR)/xatrix
chmod 755 $(COPYDIR)/xatrix/game$(ARCH).$(SHLIBEXT)
-mkdir $(COPYDIR)/rogue
chmod 755 $(COPYDIR)/rogue
cp $(BUILD_RELEASE_DIR)/rogue/game$(ARCH).$(SHLIBEXT) $(COPYDIR)/rogue
chmod 755 $(COPYDIR)/rogue/game$(ARCH).$(SHLIBEXT)
cp $(MOUNT_DIR)/solaris/readme.solaris $(COPYDIR)/README
cp $(MOUNT_DIR)/readme.txt $(COPYDIR)
cp $(MOUNT_DIR)/3.19_Changes.txt $(COPYDIR)
#############################################################################
# MISC
#############################################################################

File diff suppressed because it is too large Load diff

View file

@ -214,6 +214,7 @@ void *Sys_GetGameAPI (void *parms)
char name[MAX_OSPATH];
char curpath[MAX_OSPATH];
char *path;
char *str_p;
#ifdef __i386__
const char *gamename = "gamei386.so";
#elif defined __sun__
@ -240,10 +241,21 @@ void *Sys_GetGameAPI (void *parms)
game_library = dlopen (name, RTLD_NOW );
if (game_library)
{
Com_DPrintf ("LoadLibrary (%s)\n",name);
Com_MDPrintf ("LoadLibrary (%s)\n", name);
break;
} else
Com_Printf("error: %s\n", dlerror());
} else {
Com_MPrintf("error: %s\n", dlerror());
str_p = strchr(dlerror(), ':'); // skip the path (already shown)
if (str_p != NULL)
{
Com_MDPrintf (" **");
while (*str_p)
Com_MDPrintf ("%c", *(++str_p));
Com_MDPrintf ("\n");
}
}
}
GetGameAPI = (void *)dlsym (game_library, "GetGameAPI");

View file

@ -104,8 +104,6 @@ static int CDAudio_GetAudioDiskInfo(void)
return 0;
}
void CDAudio_Play2(int track, qboolean looping)
{
DWORD dwReturn;
@ -180,7 +178,6 @@ void CDAudio_Play2(int track, qboolean looping)
CDAudio_Pause ();
}
void CDAudio_Play(int track, qboolean looping)
{
// set a loop counter so that this track will change to the
@ -189,6 +186,89 @@ void CDAudio_Play(int track, qboolean looping)
CDAudio_Play2(track, looping);
}
void CDAudio_RandomPlay(void)
{
int track, i = 0, free_tracks = 0, remap_track;
float f;
unsigned char track_bools[100];
DWORD dwReturn;
MCI_PLAY_PARMS mciPlayParms;
MCI_STATUS_PARMS mciStatusParms;
if (!enabled)
return;
//create array of available audio tracknumbers
for (; i < maxTrack; i++)
{
// don't try to play a non-audio track
mciStatusParms.dwItem = MCI_CDA_STATUS_TYPE_TRACK;
mciStatusParms.dwTrack = remap[i];
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
if (dwReturn)
{
track_bools[i] = 0;
}
else
track_bools[i] = (mciStatusParms.dwReturn == MCI_CDA_TRACK_AUDIO);
free_tracks += track_bools[i];
}
if (!free_tracks)
{
Com_DPrintf("CDAudio_RandomPlay: Unable to find and play a random audio track, insert an audio cd please");
return;
}
//choose random audio track
do
{
do
{
f = ((float)rand()) / ((float)RAND_MAX + 1.0);
track = (int)(maxTrack * f);
}
while(!track_bools[track]);
remap_track = remap[track];
// get the length of the track to be played
mciStatusParms.dwItem = MCI_STATUS_LENGTH;
mciStatusParms.dwTrack = remap_track;
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
if (dwReturn)
{
Com_DPrintf("MCI_STATUS failed (%i)\n", dwReturn);
return;
}
if (playing)
{
if (playTrack == remap_track)
return;
CDAudio_Stop();
}
mciPlayParms.dwFrom = MCI_MAKE_TMSF(remap_track, 0, 0, 0);
mciPlayParms.dwTo = (mciStatusParms.dwReturn << 8) | remap_track;
mciPlayParms.dwCallback = (DWORD)cl_hwnd;
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD)(LPVOID) &mciPlayParms);
if (dwReturn)
{
track_bools[track] = 0;
free_tracks--;
}
else
{
playLooping = true;
playTrack = remap_track;
playing = true;
}
}
while (free_tracks > 0);
}
void CDAudio_Stop(void)
{
DWORD dwReturn;
@ -439,6 +519,9 @@ int CDAudio_Init(void)
MCI_SET_PARMS mciSetParms;
int n;
if (initialized)
return;
cd_nocd = Cvar_Get ("cd_nocd", "0", CVAR_ARCHIVE );
cd_loopcount = Cvar_Get ("cd_loopcount", "4", 0);
cd_looptrack = Cvar_Get ("cd_looptrack", "11", 0);
@ -489,6 +572,7 @@ void CDAudio_Shutdown(void)
CDAudio_Stop();
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL))
Com_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
initialized = false;
}