当前位置: 首页>>代码示例>>C++>>正文


C++ idCVar::GetString方法代码示例

本文整理汇总了C++中idCVar::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ idCVar::GetString方法的具体用法?C++ idCVar::GetString怎么用?C++ idCVar::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在idCVar的用法示例。


在下文中一共展示了idCVar::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Sys_GetConsoleKey

/*
===============
Sys_GetConsoleKey
===============
*/
unsigned char Sys_GetConsoleKey(bool shifted) {
	static unsigned char keys[2] = { '`', '~' };

	if (in_kbd.IsModified()) {
		idStr lang = in_kbd.GetString();

		if (lang.Length()) {
			if (!lang.Icmp("french")) {
				keys[0] = '<';
				keys[1] = '>';
			} else if (!lang.Icmp("german")) {
				keys[0] = '^';
				keys[1] = 176; // °
			} else if (!lang.Icmp("italian")) {
				keys[0] = '\\';
				keys[1] = '|';
			} else if (!lang.Icmp("spanish")) {
				keys[0] = 186; // º
				keys[1] = 170; // ª
			} else if (!lang.Icmp("turkish")) {
				keys[0] = '"';
				keys[1] = 233; // é
			}
		}

		in_kbd.ClearModified();
	}

	return shifted ? keys[1] : keys[0];
}
开发者ID:Edgarins29,项目名称:Doom3,代码行数:35,代码来源:events.cpp

示例2: GetConnectInfo

/*
========================
idLobbyBackendDirect::GetConnectInfo
========================
*/
lobbyConnectInfo_t idLobbyBackendDirect::GetConnectInfo()
{
	lobbyConnectInfo_t connectInfo;
	
	// If we aren't the host, this lobby should have been joined through JoinFromConnectInfo
	if( IsHost() )
	{
		// If we are the host, give them our ip address
		// DG: always using the first IP doesn't work, because on linux that's 127.0.0.1
		// and even if not, this causes trouble with NAT.
		// So either use net_ip or, if it's not set ("localhost"), use 0.0.0.0 which is
		// a special case the client will treat as "just use the IP I used for the lobby"
		// (which is the right behavior for the Direct backend, I guess).
		// the client special case is in idLobby::HandleReliableMsg
		const char* ip = net_ip.GetString();
		if( ip == NULL || idStr::Length( ip ) == 0 || idStr::Icmp( ip, "localhost" ) == 0 )
			ip = "0.0.0.0";
		// DG end
		Sys_StringToNetAdr( ip, &address, false );
		address.port = net_port.GetInteger();
	}
	
	connectInfo.netAddr = address;
	
	return connectInfo;
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:31,代码来源:sys_lobby_backend_direct.cpp

示例3:

idAudioHardware *idAudioHardware::Alloc() {
#ifndef NO_ALSA
	if ( !strcmp( s_driver.GetString(), "best" ) ) {
		idAudioHardwareALSA *test = new idAudioHardwareALSA;
		if ( test->DLOpen() ) {
			common->Printf( "Alsa is available\n" );
			return test;
		}
		common->Printf( "Alsa is not available\n" );
		delete test;
		return new idAudioHardwareOSS;
	}
	if ( !strcmp( s_driver.GetString(), "alsa" ) ) {
		return new idAudioHardwareALSA;
	}
#endif
	return new idAudioHardwareOSS;
}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:18,代码来源:sound.cpp

示例4: InitForPort

/*
==================
idPort::InitForPort
==================
*/
bool idPort::InitForPort( int portNumber ) {
	netSocket = IPSocket( net_ip.GetString(), portNumber, &bound_to );
	if ( netSocket <= 0 ) {
		netSocket = 0;
		memset( &bound_to, 0, sizeof( bound_to ) );
		return false;
	}
	return true;
}
开发者ID:4DA,项目名称:doom3.gpl,代码行数:14,代码来源:posix_net.cpp

示例5: StorageSizeAvailable

/*
========================
idLocalUser::StorageSizeAvailable
========================
*/
bool idLocalUser::StorageSizeAvailable( uint64 minSizeInBytes, int64 & neededBytes ) {
	int64 size = Sys_GetDriveFreeSpaceInBytes( fs_savepath.GetString() );

	neededBytes = minSizeInBytes - size;
	if ( neededBytes < 0 ) {
		neededBytes = 0;
	}

	return neededBytes == 0;
}
开发者ID:Deepfreeze32,项目名称:taken,代码行数:15,代码来源:sys_localuser.cpp

示例6: DLOpen

/*
===============
idAudioHardwareALSA::DLOpen
===============
*/
bool idAudioHardwareALSA::DLOpen( void ) {
	const char *version;

	if ( m_handle ) {
		return true;
	}
	common->Printf( "dlopen(%s)\n", s_alsa_lib.GetString() );
	if ( !( m_handle = dlopen( s_alsa_lib.GetString(), RTLD_NOW | RTLD_GLOBAL ) ) ) {
		common->Printf( "dlopen(%s) failed: %s\n", s_alsa_lib.GetString(), dlerror() );
		return false;
	}
	// print the version if available
	id_snd_asoundlib_version = ( pfn_snd_asoundlib_version )dlsym( m_handle, "snd_asoundlib_version" );
	if ( !id_snd_asoundlib_version ) {
		common->Printf( "dlsym(\"snd_asoundlib_version\") failed: %s\n", dlerror() );
		common->Warning( "please consider upgrading alsa to a more recent version." );
	} else {
		version = id_snd_asoundlib_version();
		common->Printf( "asoundlib version: %s\n", version );
	}
	// dlsym the symbols
	ALSA_DLSYM(snd_pcm_avail_update);
	ALSA_DLSYM(snd_pcm_close);
	ALSA_DLSYM(snd_pcm_hw_params);
	ALSA_DLSYM(snd_pcm_hw_params_any);
	ALSA_DLSYM(snd_pcm_hw_params_get_buffer_size);
	ALSA_DLSYM(snd_pcm_hw_params_set_access);
	ALSA_DLSYM(snd_pcm_hw_params_set_buffer_size_min);
	ALSA_DLSYM(snd_pcm_hw_params_set_channels);
	ALSA_DLSYM(snd_pcm_hw_params_set_format);
	ALSA_DLSYM(snd_pcm_hw_params_set_rate);
	ALSA_DLSYM(snd_pcm_hw_params_sizeof);
	ALSA_DLSYM(snd_pcm_open);
	ALSA_DLSYM(snd_pcm_prepare);
	ALSA_DLSYM(snd_pcm_state);
	ALSA_DLSYM(snd_pcm_writei);
	ALSA_DLSYM(snd_strerror);
	return true;
}
开发者ID:RobertBeckebans,项目名称:fhDOOM,代码行数:44,代码来源:sound_alsa.cpp

示例7: RegisterLocalUser

/*
========================
idSignInManagerWin::RegisterLocalUser
========================
*/
void idSignInManagerWin::RegisterLocalUser( int inputDevice )
{
	if( GetLocalUserByInputDevice( inputDevice ) != NULL )
	{
		return;
	}
	
	static char machineName[128];
	// DG: support for ui_name
	const char* nameSource = ui_name.GetString();
	
	if( idStr::Length( nameSource ) == 0 )
	{
		// ui_name was empty => default to hostname
#ifdef _WIN32
		DWORD len = 128;
		::GetComputerName( machineName, &len );
#else
		gethostname( machineName, sizeof( machineName ) );
#endif
		nameSource = machineName;
	}
	// DG end
	
	idStr name( nameSource );
	int nameLength = name.Length();
	if( idStr::IsValidUTF8( nameSource, nameLength ) )
	{
		int nameIndex = 0;
		int numChars = 0;
		name.Empty();
		while( nameIndex < nameLength && numChars++ < idLocalUserWin::MAX_GAMERTAG_CHARS )
		{
			uint32 c = idStr::UTF8Char( nameSource, nameIndex );
			name.AppendUTF8Char( c );
		}
	}
	
	idLib::Printf( "Added local user: %s\n", name.c_str() );
	
	idLocalUserWin& localUser = *localUsers.Alloc();
	
	localUser.Init( inputDevice, name.c_str(), localUsers.Num() );
	localUser.SetLocalUserHandle( GetUniqueLocalUserHandle( localUser.GetGamerTag() ) );
	
	session->OnLocalUserSignin( &localUser );
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:52,代码来源:signin.cpp

示例8: InitForPort

/*
==================
InitForPort
==================
*/
bool idPort::InitForPort( int portNumber ) {
	int len = sizeof( struct sockaddr_in );

	netSocket = NET_IPSocket( net_ip.GetString(), portNumber, &bound_to );
	if ( netSocket <= 0 ) {
		netSocket = 0;
		memset( &bound_to, 0, sizeof( bound_to ) );
		return false;
	}

#if 0
	if ( net_socksEnabled.GetBool() ) {
		NET_OpenSocks( portNumber );
	}
#endif

	udpPorts[ bound_to.port ] = new idUDPLag;

	return true;
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:25,代码来源:win_net.cpp

示例9: DrawModel

/*
================
idCollisionModelManagerLocal::DrawModel
================
*/
void idCollisionModelManagerLocal::DrawModel( cmHandle_t handle, const idVec3& modelOrigin, const idMat3& modelAxis,
		const idVec3& viewOrigin, const float radius )
{

	cm_model_t* model;
	idVec3 viewPos;
	
	if( handle < 0 && handle >= numModels )
	{
		return;
	}
	
	if( cm_drawColor.IsModified() )
	{
		sscanf( cm_drawColor.GetString(), "%f %f %f %f", &cm_color.x, &cm_color.y, &cm_color.z, &cm_color.w );
		cm_drawColor.ClearModified();
	}
	
	model = models[ handle ];
	viewPos = ( viewOrigin - modelOrigin ) * modelAxis.Transpose();
	checkCount++;
	DrawNodePolygons( model, model->node, modelOrigin, modelAxis, viewPos, radius );
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:28,代码来源:CollisionModel_debug.cpp

示例10: NET_OpenSocks

/*
========================
NET_OpenSocks
========================
*/
void NET_OpenSocks( int port )
{
	sockaddr_in			address;
	struct hostent*		h;
	int					len;
	bool				rfc1929;
	unsigned char		buf[64];
	
	usingSocks = false;
	
	idLib::Printf( "Opening connection to SOCKS server.\n" );
	
	if( ( socks_socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) == INVALID_SOCKET )
	{
		idLib::Printf( "WARNING: NET_OpenSocks: socket: %s\n", NET_ErrorString() );
		return;
	}
	
	h = gethostbyname( net_socksServer.GetString() );
	if( h == NULL )
	{
		idLib::Printf( "WARNING: NET_OpenSocks: gethostbyname: %s\n", NET_ErrorString() );
		return;
	}
	if( h->h_addrtype != AF_INET )
	{
		idLib::Printf( "WARNING: NET_OpenSocks: gethostbyname: address type was not AF_INET\n" );
		return;
	}
	address.sin_family = AF_INET;
	address.sin_addr.s_addr = *( in_addr_t* )h->h_addr_list[0];
	address.sin_port = htons( ( short )net_socksPort.GetInteger() );
	
	if( connect( socks_socket, ( sockaddr* )&address, sizeof( address ) ) == SOCKET_ERROR )
	{
		idLib::Printf( "NET_OpenSocks: connect: %s\n", NET_ErrorString() );
		return;
	}
	
	// send socks authentication handshake
	if( *net_socksUsername.GetString() || *net_socksPassword.GetString() )
	{
		rfc1929 = true;
	}
	else
	{
		rfc1929 = false;
	}
	
	buf[0] = 5;		// SOCKS version
	// method count
	if( rfc1929 )
	{
		buf[1] = 2;
		len = 4;
	}
	else
	{
		buf[1] = 1;
		len = 3;
	}
	buf[2] = 0;		// method #1 - method id #00: no authentication
	if( rfc1929 )
	{
		buf[2] = 2;		// method #2 - method id #02: username/password
	}
	if( send( socks_socket, ( const char* )buf, len, 0 ) == SOCKET_ERROR )
	{
		idLib::Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() );
		return;
	}
	
	// get the response
	len = recv( socks_socket, ( char* )buf, 64, 0 );
	if( len == SOCKET_ERROR )
	{
		idLib::Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() );
		return;
	}
	if( len != 2 || buf[0] != 5 )
	{
		idLib::Printf( "NET_OpenSocks: bad response\n" );
		return;
	}
	switch( buf[1] )
	{
		case 0:	// no authentication
			break;
		case 2: // username/password authentication
			break;
		default:
			idLib::Printf( "NET_OpenSocks: request denied\n" );
			return;
	}
	
//.........这里部分代码省略.........
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:101,代码来源:socket_net.cpp

示例11: Save

/*
========================
idSaveGameThread::SaveGame
========================
*/
int idSaveGameThread::Save() {
	idLocalUserWin * user = GetLocalUserFromSaveParms( data );
	if ( user == NULL ) {
		data.saveLoadParms->errorCode = SAVEGAME_E_INVALID_USER;
		return -1;
	}

	idSaveLoadParms * callback = data.saveLoadParms;
	idStr saveFolder = "savegame";

	saveFolder.AppendPath( callback->directory );

	// Check for the required storage space.
	int64 requiredSizeBytes = 0;
	{
		for ( int i = 0; i < callback->files.Num(); i++ ) {
			idFile_SaveGame *	file = callback->files[i];
			requiredSizeBytes += ( file->Length() + sizeof( unsigned int ) ); // uint for checksum
			if ( file->type == SAVEGAMEFILE_PIPELINED ) {
				requiredSizeBytes += MIN_SAVEGAME_SIZE_BYTES;
			}
		}
	}

	int ret = ERROR_SUCCESS;

	// Check size of previous files if needed
	// ALL THE FILES RIGHT NOW----  could use pattern later...
	idStrList filesToDelete;
	if ( ( callback->mode & SAVEGAME_MBF_DELETE_FILES ) && !callback->cancelled ) {
		if ( fileSystem->IsFolder( saveFolder.c_str(), "fs_savePath" ) == FOLDER_YES ) {
			idFileList * files = fileSystem->ListFilesTree( saveFolder.c_str(), "*.*" );
			for ( int i = 0; i < files->GetNumFiles(); i++ ) {
				requiredSizeBytes -= fileSystem->GetFileLength( files->GetFile( i ) );
				filesToDelete.Append( files->GetFile( i ) );
			}
			fileSystem->FreeFileList( files );
		}
	}

	// Inform user about size required if necessary
	if ( requiredSizeBytes > 0 && !callback->cancelled ) {
		user->StorageSizeAvailable( requiredSizeBytes, callback->requiredSpaceInBytes );
		if ( callback->requiredSpaceInBytes > 0 ) {
			// check to make sure savepath actually exists before erroring
			idStr directory = fs_savepath.GetString();
			directory += "\\";	// so it doesn't think the last part is a file and ignores in the directory creation
			fileSystem->CreateOSPath( directory );  // we can't actually check FileExists in production builds, so just try to create it
			user->StorageSizeAvailable( requiredSizeBytes, callback->requiredSpaceInBytes );

			if ( callback->requiredSpaceInBytes > 0 ) {
				callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
				// safe to return, haven't written any files yet
				return -1;
			}
		}
	}

	// Delete all previous files if needed
	// ALL THE FILES RIGHT NOW----  could use pattern later...
	for ( int i = 0; i < filesToDelete.Num() && !callback->cancelled; i++ ) {
		fileSystem->RemoveFile( filesToDelete[i].c_str() );
	}

	// Save the raw files.
	for ( int i = 0; i < callback->files.Num() && ret == ERROR_SUCCESS && !callback->cancelled; i++ ) {
		idFile_SaveGame * file = callback->files[i];

		idStr fileName = saveFolder;
		fileName.AppendPath( file->GetName() );
		idStr tempFileName = va( "%s.temp", fileName.c_str() );

		idFile * outputFile = fileSystem->OpenFileWrite( tempFileName, "fs_savePath" );
		if ( outputFile == NULL ) {
			idLib::Warning( "[%s]: Couldn't open file for writing, %s. Error = %08x", __FUNCTION__, tempFileName.c_str(), GetLastError() );
			file->error = true;
			callback->errorCode = SAVEGAME_E_UNKNOWN;
			ret = -1;
			continue;
		}

		if ( ( file->type & SAVEGAMEFILE_PIPELINED ) != 0 ) {

			idFile_SaveGamePipelined * inputFile = dynamic_cast< idFile_SaveGamePipelined * >( file );
			assert( inputFile != NULL );

			blockForIO_t block;
			while ( inputFile->NextWriteBlock( & block ) ) {
				if ( (size_t)outputFile->Write( block.data, block.bytes ) != block.bytes ) {
					idLib::Warning( "[%s]: Write failed. Error = %08x", __FUNCTION__, GetLastError() );
					file->error = true;
					callback->errorCode = SAVEGAME_E_INSUFFICIENT_ROOM;
					ret = -1;
					break;
				}
//.........这里部分代码省略.........
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:101,代码来源:win_savegame.cpp

示例12: SaveGame

/*
===============
idCommonLocal::SaveGame
===============
*/
bool idCommonLocal::SaveGame( const char * saveName ) {
	if ( pipelineFile != NULL ) {
		// We're already in the middle of a save. Leave us alone.
		return false;
	}

	if ( com_disableAllSaves.GetBool() || ( com_disableAutoSaves.GetBool() && ( idStr::Icmp( saveName, "autosave" ) == 0 ) ) ) {
		return false;
	}

	if ( IsMultiplayer() ) {
		common->Printf( "Can't save during net play.\n" );
		return false;
	}

	if (mapSpawnData.savegameFile != NULL ) {
		return false;
	}

	const idDict & persistentPlayerInfo = game->GetPersistentPlayerInfo( 0 );
	if ( persistentPlayerInfo.GetInt( "health" ) <= 0 ) {
		common->Printf( "You must be alive to save the game\n" );
		return false;
	}

	soundWorld->Pause();
	soundSystem->SetPlayingSoundWorld( menuSoundWorld );
	soundSystem->Render();

	Dialog().ShowSaveIndicator( true );
	if ( insideExecuteMapChange ) {
		UpdateLevelLoadPacifier();
	} else {
		// Heremake sure we pump the gui enough times to show the 'saving' dialog
		const bool captureToImage = false;
		for ( int i = 0; i < NumScreenUpdatesToShowDialog; ++i ) {
			UpdateScreen( captureToImage );
		}
		renderSystem->BeginAutomaticBackgroundSwaps( AUTORENDER_DIALOGICON );
	}

	// Make sure the file is writable and the contents are cleared out (Set to write from the start of file)
	saveFile.MakeWritable();
	saveFile.Clear( false );
	stringsFile.MakeWritable();
	stringsFile.Clear( false );

	// Setup the save pipeline
	pipelineFile = new (TAG_SAVEGAMES) idFile_SaveGamePipelined();
	pipelineFile->OpenForWriting( &saveFile );

	// Write SaveGame Header: 
	// Game Name / Version / Map Name / Persistant Player Info

	// game
	const char *gamename = GAME_NAME;
	saveFile.WriteString( gamename );

	// map
	saveFile.WriteString( currentMapName );

	saveFile.WriteBool( consoleUsed );

	game->GetServerInfo().WriteToFileHandle( &saveFile );

	// let the game save its state
	game->SaveGame( pipelineFile, &stringsFile );

	pipelineFile->Finish();

	idSaveGameDetails gameDetails;
	game->GetSaveGameDetails( gameDetails );

	gameDetails.descriptors.Set( SAVEGAME_DETAIL_FIELD_LANGUAGE, sys_lang.GetString() );
	gameDetails.descriptors.SetInt( SAVEGAME_DETAIL_FIELD_CHECKSUM, (int)gameDetails.descriptors.Checksum() );

	gameDetails.slotName = saveName;
	ScrubSaveGameFileName( gameDetails.slotName );

	saveFileEntryList_t files;
	files.Append( &stringsFile );
	files.Append( &saveFile );

	session->SaveGameSync( gameDetails.slotName, files, gameDetails );

	if ( !insideExecuteMapChange ) {
		renderSystem->EndAutomaticBackgroundSwaps();
	}

	syncNextGameFrame = true;

	return true;
}
开发者ID:KozGit,项目名称:DOOM3-BFG-RIFT,代码行数:98,代码来源:Common_load.cpp

示例13: Initialize

/*
=====================
idAudioHardwareALSA::Initialize
=====================
*/
bool idAudioHardwareALSA::Initialize( void ) {
	int err;

	common->Printf( "------ Alsa Sound Initialization -----\n" );
	if ( !DLOpen() ) {
		InitFailed();
		return false;
	}
	if ( ( err = id_snd_pcm_open( &m_pcm_handle, s_alsa_pcm.GetString(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK ) ) < 0 ) {
		common->Printf( "snd_pcm_open SND_PCM_STREAM_PLAYBACK '%s' failed: %s\n", s_alsa_pcm.GetString(), id_snd_strerror( err ) );
		InitFailed();
		return false;
	}
	common->Printf( "opened Alsa PCM device %s for playback\n", s_alsa_pcm.GetString() );

	// set hardware parameters ----------------------------------------------------------------------

	// init hwparams with the full configuration space
	snd_pcm_hw_params_t *hwparams;
	// this one is a define
	id_snd_pcm_hw_params_alloca( &hwparams );
	if ( ( err = id_snd_pcm_hw_params_any( m_pcm_handle, hwparams ) ) < 0 ) {
		common->Printf( "cannot configure the PCM device: %s\n", id_snd_strerror( err ) );
		InitFailed();
		return false;
	}

	if ( ( err = id_snd_pcm_hw_params_set_access( m_pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED ) ) < 0 ) {
		common->Printf( "SND_PCM_ACCESS_RW_INTERLEAVED failed: %s\n", id_snd_strerror( err ) );
		InitFailed();
		return false;
	}

	if ( ( err = id_snd_pcm_hw_params_set_format( m_pcm_handle, hwparams, SND_PCM_FORMAT_S16_LE ) ) < 0 ) {
		common->Printf( "SND_PCM_FORMAT_S16_LE failed: %s\n", id_snd_strerror( err ) );
		InitFailed();
		return false;
	}

	// channels

	// sanity over number of speakers
	if ( idSoundSystemLocal::s_numberOfSpeakers.GetInteger() != 6 && idSoundSystemLocal::s_numberOfSpeakers.GetInteger() != 2 ) {
		common->Warning( "invalid value for s_numberOfSpeakers. Use either 2 or 6" );
		idSoundSystemLocal::s_numberOfSpeakers.SetInteger( 2 );
	}

	m_channels = idSoundSystemLocal::s_numberOfSpeakers.GetInteger();
	if ( ( err = id_snd_pcm_hw_params_set_channels( m_pcm_handle, hwparams, m_channels ) ) < 0 ) {
		common->Printf( "error setting %d channels: %s\n", m_channels, id_snd_strerror( err ) );
		if ( idSoundSystemLocal::s_numberOfSpeakers.GetInteger() != 2 ) {
			// fallback to stereo if that works
			m_channels = 2;
			if ( ( err = id_snd_pcm_hw_params_set_channels( m_pcm_handle, hwparams, m_channels ) ) < 0 ) {
				common->Printf( "fallback to stereo failed: %s\n", id_snd_strerror( err ) );
				InitFailed();
				return false;
			} else {
				common->Printf( "fallback to stereo\n" );
				idSoundSystemLocal::s_numberOfSpeakers.SetInteger( 2 );
			}
		} else {
			InitFailed();
			return false;
		}
	}

	// set sample rate (frequency)
	if ( ( err = id_snd_pcm_hw_params_set_rate( m_pcm_handle, hwparams, PRIMARYFREQ, 0 ) ) < 0 ) {
		common->Printf( "failed to set 44.1KHz rate: %s - try ( +set s_alsa_pcm plughw:0 ? )\n", id_snd_strerror( err ) );
		InitFailed();
		return false;
	}

	// have enough space in the input buffer for our MIXBUFFER_SAMPLE feedings and async ticks
	snd_pcm_uframes_t frames;
	frames = MIXBUFFER_SAMPLES + MIXBUFFER_SAMPLES / 3;
	if ( ( err = id_snd_pcm_hw_params_set_buffer_size_min( m_pcm_handle, hwparams, &frames ) ) < 0 ) {
		common->Printf( "buffer size select failed: %s\n", id_snd_strerror( err ) );
		InitFailed();
		return false;
	}

	// apply parameters
	if ( ( err = id_snd_pcm_hw_params( m_pcm_handle, hwparams ) ) < 0 ) {
		common->Printf( "snd_pcm_hw_params failed: %s\n", id_snd_strerror( err ) );
		InitFailed();
		return false;
	}

	// check the buffer size
	if ( ( err = id_snd_pcm_hw_params_get_buffer_size( hwparams, &frames ) ) < 0 ) {
		common->Printf( "snd_pcm_hw_params_get_buffer_size failed: %s\n", id_snd_strerror( err ) );
	} else {
		common->Printf( "device buffer size: %lu frames ( %lu bytes )\n", ( long unsigned int )frames, frames * m_channels * 2 );
//.........这里部分代码省略.........
开发者ID:RobertBeckebans,项目名称:fhDOOM,代码行数:101,代码来源:sound_alsa.cpp

示例14: DebugOutput

void idCollisionModelManagerLocal::DebugOutput( const idVec3& origin )
{
	int i, k, t;
	char buf[128];
	idVec3 end;
	idAngles boxAngles;
	idMat3 modelAxis, boxAxis;
	idBounds bounds;
	trace_t trace;
	
	if( !cm_testCollision.GetBool() )
	{
		return;
	}
	
	testend = ( idVec3* ) Mem_Alloc( cm_testTimes.GetInteger() * sizeof( idVec3 ), TAG_COLLISION );
	
	if( cm_testReset.GetBool() || ( cm_testWalk.GetBool() && !start.Compare( start ) ) )
	{
		total_translation = total_rotation = 0;
		min_translation = min_rotation = 999999;
		max_translation = max_rotation = -999999;
		num_translation = num_rotation = 0;
		cm_testReset.SetBool( false );
	}
	
	if( cm_testWalk.GetBool() )
	{
		start = origin;
		cm_testOrigin.SetString( va( "%1.2f %1.2f %1.2f", start[0], start[1], start[2] ) );
	}
	else
	{
		sscanf( cm_testOrigin.GetString(), "%f %f %f", &start[0], &start[1], &start[2] );
	}
	
	sscanf( cm_testBox.GetString(), "%f %f %f %f %f %f", &bounds[0][0], &bounds[0][1], &bounds[0][2],
			&bounds[1][0], &bounds[1][1], &bounds[1][2] );
	sscanf( cm_testBoxRotation.GetString(), "%f %f %f", &boxAngles[0], &boxAngles[1], &boxAngles[2] );
	boxAxis = boxAngles.ToMat3();
	modelAxis.Identity();
	
	idTraceModel itm( bounds );
	idRandom random( 0 );
	idTimer timer;
	
	if( cm_testRandomMany.GetBool() )
	{
		// if many traces in one random direction
		for( i = 0; i < 3; i++ )
		{
			testend[0][i] = start[i] + random.CRandomFloat() * cm_testLength.GetFloat();
		}
		for( k = 1; k < cm_testTimes.GetInteger(); k++ )
		{
			testend[k] = testend[0];
		}
	}
	else
	{
		// many traces each in a different random direction
		for( k = 0; k < cm_testTimes.GetInteger(); k++ )
		{
			for( i = 0; i < 3; i++ )
			{
				testend[k][i] = start[i] + random.CRandomFloat() * cm_testLength.GetFloat();
			}
		}
	}
	
	// translational collision detection
	timer.Clear();
	timer.Start();
	for( i = 0; i < cm_testTimes.GetInteger(); i++ )
	{
		Translation( &trace, start, testend[i], &itm, boxAxis, CONTENTS_SOLID | CONTENTS_PLAYERCLIP, cm_testModel.GetInteger(), vec3_origin, modelAxis );
	}
	timer.Stop();
	t = timer.Milliseconds();
	if( t < min_translation ) min_translation = t;
	if( t > max_translation ) max_translation = t;
	num_translation++;
	total_translation += t;
	if( cm_testTimes.GetInteger() > 9999 )
	{
		sprintf( buf, "%3dK", ( int )( cm_testTimes.GetInteger() / 1000 ) );
	}
	else
	{
		sprintf( buf, "%4d", cm_testTimes.GetInteger() );
	}
	common->Printf( "%s translations: %4d milliseconds, (min = %d, max = %d, av = %1.1f)\n", buf, t, min_translation, max_translation, ( float ) total_translation / num_translation );
	
	if( cm_testRandomMany.GetBool() )
	{
		// if many traces in one random direction
		for( i = 0; i < 3; i++ )
		{
			testend[0][i] = start[i] + random.CRandomFloat() * cm_testRadius.GetFloat();
		}
//.........这里部分代码省略.........
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:101,代码来源:CollisionModel_debug.cpp

示例15: LoadGame

/*
===============
idCommonLocal::LoadGame
===============
*/
bool idCommonLocal::LoadGame( const char * saveName ) { 
	if ( IsMultiplayer() ) {
		common->Printf( "Can't load during net play.\n" );
		if ( wipeForced ) {
			ClearWipe();
		}
		return false;
	}

	if ( GetCurrentGame() != DOOM3_BFG ) {
		return false;
	}

	if ( session->GetSignInManager().GetMasterLocalUser() == NULL ) {
		return false;
	}
	if (mapSpawnData.savegameFile != NULL ) {
		return false;
	}

	bool found = false;
	const saveGameDetailsList_t & sgdl = session->GetSaveGameManager().GetEnumeratedSavegames();
	for ( int i = 0; i < sgdl.Num(); i++ ) {
		if ( sgdl[i].slotName == saveName ) {
			if ( sgdl[i].GetLanguage() != sys_lang.GetString() ) {
				idStaticList< idSWFScriptFunction *, 4 > callbacks;
				idStaticList< idStrId, 4 > optionText;
				optionText.Append( idStrId( "#str_swf_continue" ) );
				idStrStatic<256> langName = "#str_lang_" + sgdl[i].GetLanguage();
				idStrStatic<256> msg;
				msg.Format( idLocalization::GetString( "#str_dlg_wrong_language" ), idLocalization::GetString( langName ) );
				Dialog().AddDynamicDialog( GDM_SAVEGAME_WRONG_LANGUAGE, callbacks, optionText, true, msg, false, true );
				if ( wipeForced ) {
					ClearWipe();
				}
				return false;
			}
			found = true;
			break;
		}
	}
	if ( !found ) {
		common->Printf( "Could not find save '%s'\n", saveName );
		if ( wipeForced ) {
			ClearWipe();
		}
		return false;
	}

	mapSpawnData.savegameFile = &saveFile;
	mapSpawnData.stringTableFile = &stringsFile;

	saveFileEntryList_t files;
	files.Append( mapSpawnData.stringTableFile );
	files.Append( mapSpawnData.savegameFile );

	idStr slotName = saveName;
	ScrubSaveGameFileName( slotName );
	saveFile.Clear( false );
	stringsFile.Clear( false );

	saveGameHandle_t loadGameHandle = session->LoadGameSync( slotName, files );
	if ( loadGameHandle != 0 ) {
		return true;
	}
	mapSpawnData.savegameFile = NULL;
	if ( wipeForced ) {
		ClearWipe();
	}
	return false;
}
开发者ID:KozGit,项目名称:DOOM3-BFG-RIFT,代码行数:76,代码来源:Common_load.cpp


注:本文中的idCVar::GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。