Esempio n. 1
0
void RF_EndRegistration( void )
{
	// sync to the backend thread to ensure it's not using old assets for drawing
	RF_AdapterWait( &rrf.adapter );
	R_EndRegistration();
	rrf.adapter.cmdPipe->EndRegistration( rrf.adapter.cmdPipe );
	RF_AdapterWait( &rrf.adapter );
}
Esempio n. 2
0
static void CLQW_Model_NextDownload() {
	if ( clc.downloadNumber == 0 ) {
		common->Printf( "Checking models...\n" );
		clc.downloadNumber = 1;
	}

	clc.downloadType = dl_model;
	for (
		; cl.qh_model_name[ clc.downloadNumber ][ 0 ]
		; clc.downloadNumber++ ) {
		const char* s = cl.qh_model_name[ clc.downloadNumber ];
		if ( s[ 0 ] == '*' ) {
			continue;	// inline brush model
		}
		if ( !CL_CheckOrDownloadFile( s ) ) {
			return;		// started a download
		}
	}

	CM_LoadMap( cl.qh_model_name[ 1 ], true, NULL );
	cl.model_clip[ 1 ] = 0;
	R_LoadWorld( cl.qh_model_name[ 1 ] );

	for ( int i = 2; i < MAX_MODELS_Q1; i++ ) {
		if ( !cl.qh_model_name[ i ][ 0 ] ) {
			break;
		}

		cl.model_draw[ i ] = CLQ1_RegisterModel( cl.qh_model_name[ i ] );
		if ( cl.qh_model_name[ i ][ 0 ] == '*' ) {
			cl.model_clip[ i ] = CM_InlineModel( String::Atoi( cl.qh_model_name[ i ] + 1 ) );
		}

		if ( !cl.model_draw[ i ] ) {
			common->Printf( "\nThe required model file '%s' could not be found or downloaded.\n\n",
				cl.qh_model_name[ i ] );
			common->Printf( "You may need to download or purchase a %s client "
							"pack in order to play on this server.\n\n", fs_gamedir );
			CL_Disconnect( true );
			return;
		}
	}

	CLQW_CalcModelChecksum( "progs/player.mdl", "pmodel" );
	CLQW_CalcModelChecksum( "progs/eyes.mdl", "emodel" );

	// all done
	R_EndRegistration();

	int CheckSum1;
	int CheckSum2;
	CM_MapChecksums( CheckSum1, CheckSum2 );

	// done with modellist, request first of static signon messages
	CL_AddReliableCommand( va( "prespawn %i 0 %i", cl.servercount, CheckSum2 ) );
}
Esempio n. 3
0
//	Call before entering a new level, or after changing dlls
void CLQ2_PrepRefresh() {
	if ( !cl.q2_configstrings[ Q2CS_MODELS + 1 ][ 0 ] ) {
		return;		// no map loaded

	}
	// let the render dll load the map
	char mapname[ 32 ];
	String::Cpy( mapname, cl.q2_configstrings[ Q2CS_MODELS + 1 ] + 5 );		// skip "maps/"
	mapname[ String::Length( mapname ) - 4 ] = 0;		// cut off ".bsp"

	// register models, pics, and skins
	common->Printf( "Map: %s\r", mapname );
	SCR_UpdateScreen();
	R_BeginRegistrationAndLoadWorld( mapname );
	common->Printf( "                                     \r" );

	// precache status bar pics
	common->Printf( "pics\r" );
	SCR_UpdateScreen();
	SCRQ2_InitHudShaders();
	SCR_TouchPics();
	common->Printf( "                                     \r" );

	CLQ2_RegisterTEntModels();

	clq2_num_weaponmodels = 1;
	String::Cpy( clq2_weaponmodels[ 0 ], "weapon.md2" );

	for ( int i = 1; i < MAX_MODELS_Q2 && cl.q2_configstrings[ Q2CS_MODELS + i ][ 0 ]; i++ ) {
		char name[ MAX_QPATH ];
		String::Cpy( name, cl.q2_configstrings[ Q2CS_MODELS + i ] );
		name[ 37 ] = 0;		// never go beyond one line
		if ( name[ 0 ] != '*' ) {
			common->Printf( "%s\r", name );
		}
		SCR_UpdateScreen();
		if ( name[ 0 ] == '#' ) {
			// special player weapon model
			if ( clq2_num_weaponmodels < MAX_CLIENTWEAPONMODELS_Q2 ) {
				String::NCpy( clq2_weaponmodels[ clq2_num_weaponmodels ], cl.q2_configstrings[ Q2CS_MODELS + i ] + 1,
					sizeof ( clq2_weaponmodels[ clq2_num_weaponmodels ] ) - 1 );
				clq2_num_weaponmodels++;
			}
		} else {
			cl.model_draw[ i ] = R_RegisterModel( cl.q2_configstrings[ Q2CS_MODELS + i ] );
			if ( name[ 0 ] == '*' ) {
				cl.model_clip[ i ] = CM_InlineModel( String::Atoi( cl.q2_configstrings[ Q2CS_MODELS + i ] + 1 ) );
			} else {
				cl.model_clip[ i ] = 0;
			}
		}
		if ( name[ 0 ] != '*' ) {
			common->Printf( "                                     \r" );
		}
	}

	common->Printf( "images\r" );
	SCR_UpdateScreen();
	for ( int i = 1; i < MAX_IMAGES_Q2 && cl.q2_configstrings[ Q2CS_IMAGES + i ][ 0 ]; i++ ) {
		cl.q2_image_precache[ i ] = CLQ2_RegisterPicShader( cl.q2_configstrings[ Q2CS_IMAGES + i ] );
	}

	common->Printf( "                                     \r" );
	for ( int i = 0; i < MAX_CLIENTS_Q2; i++ ) {
		if ( !cl.q2_configstrings[ Q2CS_PLAYERSKINS + i ][ 0 ] ) {
			continue;
		}
		common->Printf( "client %i\r", i );
		SCR_UpdateScreen();
		CLQ2_ParseClientinfo( i );
		common->Printf( "                                     \r" );
	}

	CLQ2_LoadClientinfo( &cl.q2_baseclientinfo, "unnamed\\male/grunt" );

	// set sky textures and speed
	common->Printf( "sky\r" );
	SCR_UpdateScreen();
	float rotate = String::Atof( cl.q2_configstrings[ Q2CS_SKYROTATE ] );
	vec3_t axis;
	sscanf( cl.q2_configstrings[ Q2CS_SKYAXIS ], "%f %f %f",
		&axis[ 0 ], &axis[ 1 ], &axis[ 2 ] );
	R_SetSky( cl.q2_configstrings[ Q2CS_SKY ], rotate, axis );
	common->Printf( "                                     \r" );

	R_EndRegistration();

	// clear any lines of console text
	Con_ClearNotify();

	SCR_UpdateScreen();
	cl.q2_refresh_prepped = true;

	// start the cd track
	CDAudio_Play( String::Atoi( cl.q2_configstrings[ Q2CS_CDTRACK ] ), true );
}
Esempio n. 4
0
void CLT3_InitCGame() {
	int t1 = Sys_Milliseconds();

	// put away the console
	Con_Close();

	// find the current mapname
	const char* info = GGameType & GAME_WolfSP ? cl.ws_gameState.stringData + cl.ws_gameState.stringOffsets[ Q3CS_SERVERINFO ] :
					   GGameType & GAME_WolfMP ? cl.wm_gameState.stringData + cl.wm_gameState.stringOffsets[ Q3CS_SERVERINFO ] :
					   GGameType & GAME_ET ? cl.et_gameState.stringData + cl.et_gameState.stringOffsets[ Q3CS_SERVERINFO ] :
					   cl.q3_gameState.stringData + cl.q3_gameState.stringOffsets[ Q3CS_SERVERINFO ];
	const char* mapname = Info_ValueForKey( info, "mapname" );
	String::Sprintf( cl.q3_mapname, sizeof ( cl.q3_mapname ), "maps/%s.bsp", mapname );

	if ( GGameType & GAME_Quake3 ) {
		// load the dll or bytecode
		vmInterpret_t interpret;
		if ( cl_connectedToPureServer != 0 ) {
			// if sv_pure is set we only allow qvms to be loaded
			interpret = VMI_COMPILED;
		} else {
			interpret = ( vmInterpret_t )( int )Cvar_VariableValue( "vm_cgame" );
		}
		cgvm = VM_Create( "cgame", CLQ3_CgameSystemCalls, interpret );
	} else if ( GGameType & GAME_WolfSP ) {
		cgvm = VM_Create( "cgame", CLWS_CgameSystemCalls, VMI_NATIVE );
	} else if ( GGameType & GAME_WolfMP ) {
		cgvm = VM_Create( "cgame", CLWM_CgameSystemCalls, VMI_NATIVE );
	} else {
		cgvm = VM_Create( "cgame", CLET_CgameSystemCalls, VMI_NATIVE );
	}
	if ( !cgvm ) {
		common->Error( "VM_Create on cgame failed" );
	}
	cls.state = CA_LOADING;

	// init for this gamestate
	// use the lastExecutedServerCommand instead of the serverCommandSequence
	// otherwise server commands sent just before a gamestate are dropped
	if ( GGameType & GAME_ET ) {
		//bani - added clc.demoplaying, since some mods need this at init time, and drawactiveframe is too late for them
		VM_Call( cgvm, CG_INIT, clc.q3_serverMessageSequence, clc.q3_lastExecutedServerCommand, clc.q3_clientNum, clc.demoplaying );
	} else {
		VM_Call( cgvm, CG_INIT, clc.q3_serverMessageSequence, clc.q3_lastExecutedServerCommand, clc.q3_clientNum );
	}

	// we will send a usercmd this frame, which
	// will cause the server to send us the first snapshot
	cls.state = CA_PRIMED;

	int t2 = Sys_Milliseconds();

	common->Printf( "CLT3_InitCGame: %5.2f seconds\n", ( t2 - t1 ) / 1000.0 );

	// have the renderer touch all its images, so they are present
	// on the card even if the driver does deferred loading
	R_EndRegistration();

	// clear anything that got printed
	Con_ClearNotify();
}
Esempio n. 5
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();
}