Beispiel #1
0
/*
=================
CL_Vid_Restart_f

Restart the video subsystem
=================
*/
void CL_Vid_Restart_f( void ) {
	S_StopAllSounds();		// don't let them loop during the restart
	S_BeginRegistration();	// all sound handles are now invalid
	CL_ShutdownRef();
	CL_ShutdownUI();
	CL_ShutdownCGame();

	//rww - sof2mp does this here, but it seems to cause problems in this codebase.
//	CM_ClearMap();

	CL_InitRef();

	cls.rendererStarted = qfalse;
	cls.uiStarted = qfalse;
	cls.cgameStarted = qfalse;
	cls.soundRegistered = qfalse;

#ifdef _IMMERSION
	CL_ShutdownFF();
	cls.forceStarted = qfalse;
#endif // _IMMERSION

#ifdef _XBOX
	vidRestartReloadMap = qtrue;
#endif

	// unpause so the cgame definately gets a snapshot and renders a frame
	Cvar_Set( "cl_paused", "0" );
}
Beispiel #2
0
/*
======================
CL_RegisterSounds
======================
*/
void CL_RegisterSounds (void)
{
	int32_t		i;

	S_BeginRegistration ();
	CL_RegisterTEntSounds ();

	// Knightmare- 1/2/2002- ULTRA-CHEESY HACK for old demos or
	// connected to server using old protocol
	// Changed config strings require different offsets
	if ( LegacyProtocol() )
	{
		for (i=1; i < OLD_MAX_SOUNDS; i++)
		{
			if (!cl.configstrings[OLD_CS_SOUNDS+i][0])
				break;
			cl.sound_precache[i] = S_RegisterSound (cl.configstrings[OLD_CS_SOUNDS+i]);
			Sys_SendKeyEvents ();	// pump message loop
		}

	}
	else
	{
		for (i=1; i < MAX_SOUNDS; i++)
		{
			if (!cl.configstrings[CS_SOUNDS+i][0])
				break;
			cl.sound_precache[i] = S_RegisterSound (cl.configstrings[CS_SOUNDS+i]);
			Sys_SendKeyEvents ();	// pump message loop
		}
	}
	//end Knightmare
	S_EndRegistration ();
}
Beispiel #3
0
static void CLQW_Sound_NextDownload() {
	if ( clc.downloadNumber == 0 ) {
		common->Printf( "Checking sounds...\n" );
		clc.downloadNumber = 1;
	}

	clc.downloadType = dl_sound;
	for (
		; cl.qh_sound_name[ clc.downloadNumber ][ 0 ]
		; clc.downloadNumber++ ) {
		char* s = cl.qh_sound_name[ clc.downloadNumber ];
		if ( !CL_CheckOrDownloadFile( va( "sound/%s",s ) ) ) {
			return;		// started a download
		}
	}

	S_BeginRegistration();
	CLQ1_InitTEnts();
	for ( int i = 1; i < MAX_SOUNDS_Q1; i++ ) {
		if ( !cl.qh_sound_name[ i ][ 0 ] ) {
			break;
		}
		cl.sound_precache[ i ] = S_RegisterSound( cl.qh_sound_name[ i ] );
	}
	S_EndRegistration();

	// done with sounds, request models now
	Com_Memset( cl.model_draw, 0, sizeof ( cl.model_draw ) );
	clq1_playerindex = -1;
	clq1_spikeindex = -1;
	clqw_flagindex = -1;
	CL_AddReliableCommand( va( "modellist %i %i", cl.servercount, 0 ) );
}
Beispiel #4
0
/*
============================
CL_StartHunkUsers

After the server has cleared the hunk, these will need to be restarted
This is the only place that any of these functions are called from
============================
*/
void CL_StartHunkUsers( void ) {
	if ( !com_cl_running->integer ) {
		return;
	}

	if ( !cls.rendererStarted ) {
		cls.rendererStarted = qtrue;
		CL_InitRenderer();
	}

	if ( !cls.soundStarted ) {
		cls.soundStarted = qtrue;
		S_Init();
	}

	if ( !cls.soundRegistered ) {
		cls.soundRegistered = qtrue;
		S_BeginRegistration();
	}

	//we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads
	if ( !cls.uiStarted ) {
		cls.uiStarted = qtrue;
		CL_InitUI();
	}

//	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) )
	{
		cls.cgameStarted = qtrue;
		CL_InitCGame();
	}
}
Beispiel #5
0
void SV_DedicatedSpawn(char* map)
{
	//turn off dedicated flag so textures will load
	Cvar_Set("dedicated", "0");

	//clear and restart the render system
	extern void CL_InitRenderer( void );
	CL_InitRenderer();

	// Register sounds, so that muting is turned off and UI sounds work
	cls.soundRegistered = qtrue;
	S_BeginRegistration(ClientManager::NumClients());

	//clear out & init ghoul2 system
//	G2API_CleanG2(G2_CLEAN_ALL);

//	com_serverGhoulInit = true;
//	com_serverGhoulShutdown = false;

	//reload menu stuff
	VM_Call( uivm, UI_INIT, 0 );
	VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_DEDICATED );

	//jsw//clear out the socket buffers for voice in case they got filled while loading
//	g_Voice.EmptyVoiceBuffer();
//	g_Voice.StartVoice();
//	g_Voice.VerifyPlayerList();
	
	//reset dedicated flag so no other textures will load
	Cvar_Set( "dedicated", "1");
}
Beispiel #6
0
/*
============================
CL_StartSound

Convenience function for the sound system to be started
REALLY early on Xbox, helps with memory fragmentation.
============================
*/
void CL_StartSound( void ) {
	if ( !cls.soundStarted ) {
		cls.soundStarted = qtrue;
		S_Init();
	}

	if ( !cls.soundRegistered ) {
		cls.soundRegistered = qtrue;
		S_BeginRegistration();
	}
}
Beispiel #7
0
/*
============================
CL_StartHunkUsers

After the server has cleared the hunk, these will need to be restarted
This is the only place that any of these functions are called from
============================
*/
void CL_StartHunkUsers( void ) {
	if ( !com_cl_running->integer ) {
		return;
	}

	if ( !cls.rendererStarted ) {
#ifdef _XBOX
		//if ((!com_sv_running->integer || com_errorEntered) && !vidRestartReloadMap)
		//{
		//	// free up some memory
		//	extern void SV_ClearLastLevel(void);
		//	SV_ClearLastLevel();
		//}
#endif

		cls.rendererStarted = qtrue;
		re.BeginRegistration( &cls.glconfig );

		// load character sets
//		cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/bigchars" );
		cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/charsgrid_med" );
		cls.whiteShader = re.RegisterShader( "white" );
		cls.consoleShader = re.RegisterShader( "console" );
		g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2;
		kg.g_consoleField.widthInChars = g_console_field_width;
	}

	if ( !cls.soundStarted ) {
		cls.soundStarted = qtrue;
		S_Init();
	}

	if ( !cls.soundRegistered ) {
		cls.soundRegistered = qtrue;
		S_BeginRegistration();
	}

#if !defined (_XBOX)	//i guess xbox doesn't want the ui loaded all the time?
	//we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads
	if ( !cls.uiStarted ) {
		cls.uiStarted = qtrue;
		CL_InitUI();
	}
#endif

//	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) 
	{
		cls.cgameStarted = qtrue;
		CL_InitCGame();
	}
}
Beispiel #8
0
/*
======================
CL_RegisterSounds
======================
*/
void CL_RegisterSounds (void)
{
	int		i;

	S_BeginRegistration ();
	CL_RegisterTEntSounds ();
	for (i=1 ; i<MAX_SOUNDS ; i++)
	{
		if (!cl.configstrings[CS_SOUNDS+i][0])
			break;
		cl.sound_precache[i] = S_RegisterSound (cl.configstrings[CS_SOUNDS+i]);
		Sys_SendKeyEvents ();	// pump message loop
	}
	S_EndRegistration ();
}
Beispiel #9
0
/*
=================
CL_Vid_Restart_f

Restart the video subsystem
=================
*/
void CL_Vid_Restart_f( void ) {
	S_StopAllSounds();		// don't let them loop during the restart
	S_BeginRegistration();	// all sound handles are now invalid
	CL_ShutdownRef();
	CL_ShutdownUI();
	CL_ShutdownCGame();
	CL_InitRef();

	cls.rendererStarted = qfalse;
	cls.uiStarted = qfalse;
	cls.cgameStarted = qfalse;
	cls.soundRegistered = qfalse;

	// unpause so the cgame definately gets a snapshot and renders a frame
	Cvar_Set( "cl_paused", "0" );
}
Beispiel #10
0
/*
======================
CL_PrepSound

Call before entering a new level, or after changing dlls
======================
*/
void CL_PrepSound( void )
{
	int	i, sndcount, step;

	MsgDev( D_NOTE, "CL_PrepSound: %s\n", clgame.mapname );
	for( i = 0, sndcount = 0; i < MAX_SOUNDS && cl.sound_precache[i+1][0]; i++ )
		sndcount++; // total num sounds
	step = sndcount/10;

	S_BeginRegistration();

	for( i = 0; i < MAX_SOUNDS && cl.sound_precache[i+1][0]; i++ )
	{
		cl.sound_index[i+1] = S_RegisterSound( cl.sound_precache[i+1] );
		Cvar_SetFloat( "scr_loading", scr_loading->value + 5.0f / sndcount );
		if( step && !( i % step ) && ( cl_allow_levelshots->integer || cl.background ))
			SCR_UpdateScreen();
	}

	S_EndRegistration();

	if( host.soundList )
	{
		// need to reapply all ambient sounds after restarting
		for( i = 0; i < host.numsounds; i++)
		{
			soundlist_t *entry = &host.soundList[i];
			if( entry->looping && entry->entnum != -1 )
			{
				MsgDev( D_NOTE, "Restarting sound %s...\n", entry->name );
				S_AmbientSound( entry->origin, entry->entnum,
				S_RegisterSound( entry->name ), entry->volume, entry->attenuation,
				entry->pitch, 0 );
			}
		}
	}

	host.soundList = NULL; 
	host.numsounds = 0;

	cl.audio_prepped = true;
}
Beispiel #11
0
/*
============================
CL_StartHunkUsers

After the server has cleared the hunk, these will need to be restarted
This is the only place that any of these functions are called from
============================
*/
void CL_StartHunkUsers( void ) {
	if ( !com_cl_running->integer ) {
		return;
	}

	if ( !cls.rendererStarted ) {
		cls.rendererStarted = qtrue;
		re.BeginRegistration( &cls.glconfig );

		// load character sets
//		cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/bigchars" );
		cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/charsgrid_med" );
		cls.whiteShader = re.RegisterShader( "white" );
		cls.consoleShader = re.RegisterShader( "console" );
		g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2;
		kg.g_consoleField.widthInChars = g_console_field_width;
	}

	if ( !cls.soundStarted ) {
		cls.soundStarted = qtrue;
		S_Init();
	}

	if ( !cls.soundRegistered ) {
		cls.soundRegistered = qtrue;
		S_BeginRegistration();
	}

	//we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads
	if ( !cls.uiStarted ) {
		cls.uiStarted = qtrue;
		CL_InitUI();
	}

//	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) 
	{
		cls.cgameStarted = qtrue;
		CL_InitCGame();
	}
}
int main(int argc, char* argv[])
#endif
{
//	Z_SetFreeOSMem();

	// I'm going to kill someone. This should not be necessary. No, really.
	Direct3D_SetPushBufferSize(1024*1024, 128*1024);

	// get the initial time base
	Sys_Milliseconds();

	Win_Init();
	Com_Init( "" );

	//Start sound early.  The STL inside will allocate memory and we don't
	//want that memory in the middle of the zone.
	if ( !cls.soundRegistered ) {
		cls.soundRegistered = qtrue;
		S_BeginRegistration();
	}

	NET_Init();

	// main game loop
	while( 1 ) {
		IN_Frame();
		Com_Frame();

		// Do any XBL stuff
//		XBL_Tick();

		// Poll debug console for new commands
#ifndef FINAL_BUILD
		DebugConsoleHandleCommands();
#endif
	}

	return 0;
}
Beispiel #13
0
/*
============================
CL_StartHunkUsers

After the server has cleared the hunk, these will need to be restarted
This is the only place that any of these functions are called from
============================
*/
void CL_StartHunkUsers( void ) {
	if ( !com_cl_running->integer ) {
		return;
	}

	if ( !cls.rendererStarted ) {
#ifdef _XBOX
		//if ((!com_sv_running->integer || com_errorEntered) && !vidRestartReloadMap)
		//{
		//	// free up some memory
		//	extern void SV_ClearLastLevel(void);
		//	SV_ClearLastLevel();
		//}
#endif

		cls.rendererStarted = qtrue;
		re.BeginRegistration( &cls.glconfig );

		// load character sets
//		cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/bigchars" );
		cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/charsgrid_med" );
		cls.whiteShader = re.RegisterShader( "white" );
		cls.consoleShader = re.RegisterShader( "console" );
		g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2;
		kg.g_consoleField.widthInChars = g_console_field_width;
#ifndef _IMMERSION
		//-------
		//	The latest Immersion Force Feedback system initializes here, not through
		//	win32 input system. Therefore, the window handle is valid :)
		//-------

		// now that the renderer has started up we know that the global hWnd is now valid,
		//	so we can now go ahead and (re)setup the input stuff that needs hWnds for DI...
		//  (especially Force feedback)...
		//
		static qboolean bOnceOnly = qfalse;	// only do once, not every renderer re-start
		if (!bOnceOnly)
		{
			bOnceOnly = qtrue;
			extern void Sys_In_Restart_f( void );
			Sys_In_Restart_f();
		}

#ifdef _XBOX
		if (vidRestartReloadMap)
		{
			int checksum;
			CM_LoadMap(va("maps/%s.bsp", cl_mapname->string), qfalse, &checksum);
			RE_LoadWorldMap(va("maps/%s.bsp", cl_mapname->string));
			vidRestartReloadMap = qfalse;
		}
#endif // _XBOX

#endif // _IMMERSION
	}

	if ( !cls.soundStarted ) {
		cls.soundStarted = qtrue;
		S_Init();
	}

	if ( !cls.soundRegistered ) {
		cls.soundRegistered = qtrue;
		S_BeginRegistration();
	}

#ifdef _IMMERSION
	if ( !cls.forceStarted ) {
		cls.forceStarted = qtrue;
		CL_InitFF();
	}
#endif // _IMMERSION

#if !defined (_XBOX)	//i guess xbox doesn't want the ui loaded all the time?
	//we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads
	if ( !cls.uiStarted ) {
		cls.uiStarted = qtrue;
		CL_InitUI();
	}
#endif

//	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) 
	{
		cls.cgameStarted = qtrue;
		CL_InitCGame();
	}
}
Beispiel #14
0
static void CLQ1_ParseServerInfo( QMsg& message ) {
	common->DPrintf( "Serverinfo packet received.\n" );

	R_Shutdown( false );
	CL_InitRenderer();

	clc.qh_signon = 0;

	//
	// wipe the clientActive_t struct
	//
	CL_ClearState();

	SCR_ClearCenterString();

	// parse protocol version number
	int i = message.ReadLong();
	if ( i != Q1PROTOCOL_VERSION ) {
		common->Printf( "Server returned version %i, not %i", i, Q1PROTOCOL_VERSION );
		return;
	}

	// parse maxclients
	cl.qh_maxclients = message.ReadByte();
	if ( cl.qh_maxclients < 1 || cl.qh_maxclients > MAX_CLIENTS_QH ) {
		common->Printf( "Bad maxclients (%u) from server\n", cl.qh_maxclients );
		return;
	}

	// parse gametype
	cl.qh_gametype = message.ReadByte();

	// parse signon message
	const char* str = message.ReadString2();
	String::NCpy( cl.qh_levelname, str, sizeof ( cl.qh_levelname ) - 1 );

	// seperate the printfs so the server message can have a color
	common->Printf( "\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n" );
	common->Printf( S_COLOR_ORANGE "%s" S_COLOR_WHITE "\n", str );

	// precache models
	Com_Memset( cl.model_draw, 0, sizeof ( cl.model_draw ) );
	char model_precache[ MAX_MODELS_Q1 ][ MAX_QPATH ];
	int nummodels;
	for ( nummodels = 1;; nummodels++ ) {
		str = message.ReadString2();
		if ( !str[ 0 ] ) {
			break;
		}
		if ( nummodels == MAX_MODELS_Q1 ) {
			common->Printf( "Server sent too many model precaches\n" );
			return;
		}
		String::Cpy( model_precache[ nummodels ], str );
	}

	// precache sounds
	Com_Memset( cl.sound_precache, 0, sizeof ( cl.sound_precache ) );
	char sound_precache[ MAX_SOUNDS_Q1 ][ MAX_QPATH ];
	int numsounds;
	for ( numsounds = 1;; numsounds++ ) {
		str = message.ReadString2();
		if ( !str[ 0 ] ) {
			break;
		}
		if ( numsounds == MAX_SOUNDS_Q1 ) {
			common->Printf( "Server sent too many sound precaches\n" );
			return;
		}
		String::Cpy( sound_precache[ numsounds ], str );
	}

	//
	// now we try to load everything else until a cache allocation fails
	//

	CM_LoadMap( model_precache[ 1 ], true, NULL );
	R_LoadWorld( model_precache[ 1 ] );
	CLQH_KeepaliveMessage();

	for ( i = 2; i < nummodels; i++ ) {
		cl.model_draw[ i ] = CLQ1_RegisterModel( model_precache[ i ] );
		if ( cl.model_draw[ i ] == 0 ) {
			common->Printf( "Model %s not found\n", model_precache[ i ] );
			return;
		}
		CLQH_KeepaliveMessage();
	}

	S_BeginRegistration();
	CLQ1_InitTEnts();
	for ( i = 1; i < numsounds; i++ ) {
		cl.sound_precache[ i ] = S_RegisterSound( sound_precache[ i ] );
		CLQH_KeepaliveMessage();
	}
	S_EndRegistration();

	// local state
	R_EndRegistration();
}