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


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

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


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

示例1: Start

/*
========================
idSoundVoice_OpenAL::Start
========================
*/
void idSoundVoice_OpenAL::Start( int offsetMS, int ssFlags )
{
	if( s_debugHardware.GetBool() )
	{
		idLib::Printf( "%dms: %i starting %s @ %dms\n", Sys_Milliseconds(), openalSource, leadinSample ? leadinSample->GetName() : "<null>", offsetMS );
	}
	
	if( !leadinSample )
	{
		return;
	}
	
	if( !alIsSource( openalSource ) )
	{
		return;
	}
	
	if( leadinSample->IsDefault() )
	{
		idLib::Warning( "Starting defaulted sound sample %s", leadinSample->GetName() );
	}
	
	bool flicker = ( ssFlags & SSF_NO_FLICKER ) == 0;
	
	if( flicker != hasVUMeter )
	{
		hasVUMeter = flicker;
		
		/*
		if( flicker )
		{
			IUnknown* vuMeter = NULL;
		
			if( XAudio2CreateVolumeMeter( &vuMeter, 0 ) == S_OK )
			{
		
				XAUDIO2_EFFECT_DESCRIPTOR descriptor;
				descriptor.InitialState = true;
				descriptor.OutputChannels = leadinSample->NumChannels();
				descriptor.pEffect = vuMeter;
		
				XAUDIO2_EFFECT_CHAIN chain;
				chain.EffectCount = 1;
				chain.pEffectDescriptors = &descriptor;
		
				pSourceVoice->SetEffectChain( &chain );
		
				vuMeter->Release();
			}
		}
		else
		{
			pSourceVoice->SetEffectChain( NULL );
		}
		*/
	}
	
	assert( offsetMS >= 0 );
	int offsetSamples = MsecToSamples( offsetMS, leadinSample->SampleRate() );
	if( loopingSample == NULL && offsetSamples >= leadinSample->playLength )
	{
		return;
	}
	
	RestartAt( offsetSamples );
	Update();
	UnPause();
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:73,代码来源:AL_SoundVoice.cpp

示例2: ConvertCG2GLSL


//.........这里部分代码省略.........
			program += ( token.linesCrossed > 0 ) ? newline : ( token.WhiteSpaceBeforeToken() > 0 ? " " : "" );
			program += "}";
			continue;
		}
		// if we force numerics to floats we have to special case things inside []
		if( numericsAsFloats && inUniform ) {
			if( token == "[" ) {
				backupNumericsAsFloats = numericsAsFloats;
				numericsAsFloats = false;
			}
		} else {
			if( token == "]" ) {
				numericsAsFloats = backupNumericsAsFloats;
			}
		}
		
		// check for a type conversion
		bool foundType = false;
		for( int i = 0; typeConversion[i].typeCG != NULL; i++ )
		{
			if( token.Cmp( typeConversion[i].typeCG ) == 0 )
			{
				program += ( token.linesCrossed > 0 ) ? newline : ( token.WhiteSpaceBeforeToken() > 0 ? " " : "" );
				program += typeConversion[i].typeGLSL;
				foundType = true;
				break;
			}
		}
		if( foundType )
		{
			continue;
		}

		if( r_useUniformArrays.GetBool() )
		{
			// check for uniforms that need to be converted to the array
			bool isUniform = false;
			for( int i = 0; i < uniformList.Num(); i++ )
			{
				if( token == uniformList[i] )
				{
					program += ( token.linesCrossed > 0 ) ? newline : ( token.WhiteSpaceBeforeToken() > 0 ? " " : "" );
					program += va( "%s[%d /* %s */]", uniformArrayName, i, uniformList[i].c_str() );
					isUniform = true;
					break;
				}
			}
			if( isUniform )
			{
				continue;
			}
		}
		// check for input/output parameters
		if( src.CheckTokenString( "." ) )
		{
		
			if( token == "vertex" || token == "fragment" )
			{
				idToken member;
				src.ReadToken( &member );
				
				bool foundInOut = false;
				for( int i = 0; i < varsIn.Num(); i++ )
				{
					if( member.Cmp( varsIn[i].nameCg ) == 0 )
					{
开发者ID:DeanoC,项目名称:RBDOOM-3-BFG,代码行数:67,代码来源:RenderProgs_GLSL.cpp

示例3: R_CheckCvars

/*
=============
R_CheckCvars

See if some cvars that we watch have changed
=============
*/
static void R_CheckCvars()
{

	// gamma stuff
	if( r_gamma.IsModified() || r_brightness.IsModified() )
	{
		r_gamma.ClearModified();
		r_brightness.ClearModified();
		R_SetColorMappings();
	}
	
	// filtering
	if( r_maxAnisotropicFiltering.IsModified() || r_useTrilinearFiltering.IsModified() || r_lodBias.IsModified() )
	{
		idLib::Printf( "Updating texture filter parameters.\n" );
		r_maxAnisotropicFiltering.ClearModified();
		r_useTrilinearFiltering.ClearModified();
		r_lodBias.ClearModified();
		for( int i = 0 ; i < globalImages->images.Num() ; i++ )
		{
			if( globalImages->images[i] )
			{
				globalImages->images[i]->Bind();
				globalImages->images[i]->SetTexParameters();
			}
		}
	}
	
	extern idCVar r_useSeamlessCubeMap;
	if( r_useSeamlessCubeMap.IsModified() )
	{
		r_useSeamlessCubeMap.ClearModified();
		if( glConfig.seamlessCubeMapAvailable )
		{
			if( r_useSeamlessCubeMap.GetBool() )
			{
				qglEnable( GL_TEXTURE_CUBE_MAP_SEAMLESS );
			}
			else
			{
				qglDisable( GL_TEXTURE_CUBE_MAP_SEAMLESS );
			}
		}
	}
	
	extern idCVar r_useSRGB;
	if( r_useSRGB.IsModified() )
	{
		r_useSRGB.ClearModified();
		if( glConfig.sRGBFramebufferAvailable )
		{
			if( r_useSRGB.GetBool() )
			{
				qglEnable( GL_FRAMEBUFFER_SRGB );
			}
			else
			{
				qglDisable( GL_FRAMEBUFFER_SRGB );
			}
		}
	}
	
	
	if( r_multiSamples.IsModified() )
	{
		if( r_multiSamples.GetInteger() > 0 )
		{
			qglEnable( GL_MULTISAMPLE_ARB );
		}
		else
		{
			qglDisable( GL_MULTISAMPLE_ARB );
		}
	}
	
	// check for changes to logging state
	GLimp_EnableLogging( r_logFile.GetInteger() != 0 );
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:85,代码来源:RenderSystem.cpp

示例4: Posix_PollInput


//.........这里部分代码省略.........
					if (!Posix_AddMousePollEvent( M_DELTAZ, 1 ))
						return;
				} else if (event.xbutton.button == 5) {
					Posix_QueEvent( SE_KEY, K_MWHEELDOWN, true, 0, NULL);
					if (!Posix_AddMousePollEvent( M_DELTAZ, -1 ))
						return;
				} else {
					b = -1;
					if (event.xbutton.button == 1) {
						b = 0;		// K_MOUSE1
					} else if (event.xbutton.button == 2) {
						b = 2;		// K_MOUSE3
					} else if (event.xbutton.button == 3) {
						b = 1;		// K_MOUSE2
					} else if (event.xbutton.button == 6) {
						b = 3;		// K_MOUSE4
					} else if (event.xbutton.button == 7) {
						b = 4;		// K_MOUSE5
					}
					if (b == -1 || b > 4) {
						common->DPrintf("X ButtonPress %d not supported\n", event.xbutton.button);
					} else {
						Posix_QueEvent( SE_KEY, K_MOUSE1 + b, true, 0, NULL);
						if (!Posix_AddMousePollEvent( M_ACTION1 + b, true ))
							return;
					}
				}
			break;

			case ButtonRelease:
				if (event.xbutton.button == 4) {
					Posix_QueEvent( SE_KEY, K_MWHEELUP, false, 0, NULL);
				} else if (event.xbutton.button == 5) {
					Posix_QueEvent( SE_KEY, K_MWHEELDOWN, false, 0, NULL);
				} else {
					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 == 6) {
						b = 3;		// K_MOUSE4
					} else if (event.xbutton.button == 7) {
						b = 4;		// K_MOUSE5
					}
					if (b == -1 || b > 4) {
						common->DPrintf("X ButtonRelease %d not supported\n", event.xbutton.button);
					} else {
						Posix_QueEvent( SE_KEY, K_MOUSE1 + b, false, 0, NULL);
						if (!Posix_AddMousePollEvent( M_ACTION1 + b, false ))
							return;
					}
				}
			break;

			case MotionNotify:
				if (!mouse_active)
					break;
				if (in_dgamouse.GetBool()) {
					dx = event.xmotion.x_root;
					dy = event.xmotion.y_root;

					Posix_QueEvent( SE_MOUSE, dx, dy, 0, NULL);

					// if we overflow here, we'll get a warning, but the delta will be completely processed anyway
					Posix_AddMousePollEvent( M_DELTAX, dx );
					if (!Posix_AddMousePollEvent( M_DELTAY, dy ))
						return;
				} else {
					// if it's a center motion, we've just returned from our warp
					// FIXME: we generate mouse delta on wrap return, but that lags us quite a bit from the initial event..
					if (event.xmotion.x == glConfig.vidWidth / 2 &&
						event.xmotion.y == glConfig.vidHeight / 2) {
						mwx = glConfig.vidWidth / 2;
						mwy = glConfig.vidHeight / 2;

						Posix_QueEvent( SE_MOUSE, mx, my, 0, NULL);

						Posix_AddMousePollEvent( M_DELTAX, mx );
						if (!Posix_AddMousePollEvent( M_DELTAY, my ))
							return;
						mx = my = 0;
						break;
					}

					dx = ((int) event.xmotion.x - mwx);
					dy = ((int) event.xmotion.y - mwy);
					mx += dx;
					my += dy;

					mwx = event.xmotion.x;
					mwy = event.xmotion.y;
					XWarpPointer(dpy,None,win,0,0,0,0, (glConfig.vidWidth/2),(glConfig.vidHeight/2));
				}
			break;
		}
	}
}
开发者ID:Salamek,项目名称:Shadow-of-Dust,代码行数:101,代码来源:input.cpp

示例5: LoadGLSLProgram

/*
================================================================================================
idRenderProgManager::LoadGLSLProgram
================================================================================================
*/
void idRenderProgManager::LoadGLSLProgram( const int programIndex, const int vertexShaderIndex, const int fragmentShaderIndex )
{
	glslProgram_t& prog = glslPrograms[programIndex];
	
	if( prog.progId != INVALID_PROGID )
	{
		return; // Already loaded
	}
	
	GLuint vertexProgID = ( vertexShaderIndex != -1 ) ? vertexShaders[ vertexShaderIndex ].progId : INVALID_PROGID;
	GLuint fragmentProgID = ( fragmentShaderIndex != -1 ) ? fragmentShaders[ fragmentShaderIndex ].progId : INVALID_PROGID;
	
	const GLuint program = qglCreateProgram();
	GL_DBG_CHK
	if( program )
	{
	
		if( vertexProgID != INVALID_PROGID )
		{
			qglAttachShader( program, vertexProgID );
		}
		
		if( fragmentProgID != INVALID_PROGID )
		{
			qglAttachShader( program, fragmentProgID );
		}
		
		// bind vertex attribute locations
		for( int i = 0; attribsPC[i].glsl != NULL; i++ )
		{
			if( ( attribsPC[i].flags & AT_VS_IN ) != 0 )
			{
				qglBindAttribLocation( program, attribsPC[i].bind, attribsPC[i].glsl );
			}
		}
		
		qglLinkProgram( program );
		
		int infologLength = 0;
		qglGetProgramiv( program, GL_INFO_LOG_LENGTH, &infologLength );
		if( infologLength > 1 )
		{
			char* infoLog = ( char* )malloc( infologLength );
			int charsWritten = 0;
			qglGetProgramInfoLog( program, infologLength, &charsWritten, infoLog );
			
			// catch the strings the ATI and Intel drivers output on success
			if( strstr( infoLog, "Vertex shader(s) linked, fragment shader(s) linked." ) != NULL || strstr( infoLog, "No errors." ) != NULL )
			{
				//idLib::Printf( "render prog %s from %s linked\n", GetName(), GetFileName() );
			}
			else
			{
				idLib::Printf( "While linking GLSL program %d with vertexShader %s and fragmentShader %s\n",
							   programIndex,
							   ( vertexShaderIndex >= 0 ) ? vertexShaders[vertexShaderIndex].name.c_str() : "<Invalid>",
							   ( fragmentShaderIndex >= 0 ) ? fragmentShaders[ fragmentShaderIndex ].name.c_str() : "<Invalid>" );
				idLib::Printf( "%s\n", infoLog );
			}
			
			free( infoLog );
		}
	}
	
	int linked = GL_FALSE;
	qglGetProgramiv( program, GL_LINK_STATUS, &linked );
	if( linked == GL_FALSE )
	{
		qglDeleteProgram( program );
		idLib::Error( "While linking GLSL program %d with vertexShader %s and fragmentShader %s\n",
					  programIndex,
					  ( vertexShaderIndex >= 0 ) ? vertexShaders[vertexShaderIndex].name.c_str() : "<Invalid>",
					  ( fragmentShaderIndex >= 0 ) ? fragmentShaders[ fragmentShaderIndex ].name.c_str() : "<Invalid>" );
		return;
	}
	
	if( r_useUniformArrays.GetBool() )
	{
		prog.vertexUniformArray = qglGetUniformLocation( program, VERTEX_UNIFORM_ARRAY_NAME );
		prog.fragmentUniformArray = qglGetUniformLocation( program, FRAGMENT_UNIFORM_ARRAY_NAME );
		
		assert( prog.vertexUniformArray != -1 || vertexShaderIndex < 0 || vertexShaders[vertexShaderIndex].uniforms.Num() == 0 );
		assert( prog.fragmentUniformArray != -1 || fragmentShaderIndex < 0 || fragmentShaders[fragmentShaderIndex].uniforms.Num() == 0 );
	}
	else
	{
		// store the uniform locations after we have linked the GLSL program
		prog.uniformLocations.Clear();
		for( int i = 0; i < RENDERPARM_TOTAL; i++ )
		{
			const char* parmName = GetGLSLParmName( i );
			GLint loc = qglGetUniformLocation( program, parmName );
			if( loc != -1 )
			{
				glslUniformLocation_t uniformLocation;
//.........这里部分代码省略.........
开发者ID:DeanoC,项目名称:RBDOOM-3-BFG,代码行数:101,代码来源:RenderProgs_GLSL.cpp

示例6: UpdateBindingDisplay

/*
========================
idMenuScreen_Shell_Bindings::UpdateBindingDisplay
========================
*/
void idMenuScreen_Shell_Bindings::UpdateBindingDisplay()
{

	idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > bindList;
	
	for( int i = 0; i < numBinds; ++i )
	{
		idList< idStr > option;
		
		option.Append( keyboardBinds[i].display );
		
		if( ( idStr::Icmp( keyboardBinds[i].bind, "" ) != 0 ) )
		{
			keyBindings_t bind = idKeyInput::KeyBindingsFromBinding( keyboardBinds[i].bind, false, true );
			
			idStr bindings;
			
			if( !bind.gamepad.IsEmpty() && in_useJoystick.GetBool() )
			{
				idStrList joyBinds;
				int start = 0;
				while( start < bind.gamepad.Length() )
				{
					int end = bind.gamepad.Find( ", ", true, start );
					if( end < 0 )
					{
						end = bind.gamepad.Length();
					}
					joyBinds.Alloc().CopyRange( bind.gamepad, start, end );
					start = end + 2;
				}
				const char* buttonsWithImages[] =
				{
					"JOY1", "JOY2", "JOY3", "JOY4", "JOY5", "JOY6",
					"JOY_TRIGGER1", "JOY_TRIGGER2", 0
				};
				for( int i = 0; i < joyBinds.Num(); i++ )
				{
					if( joyBinds[i].Icmpn( "JOY_STICK", 9 ) == 0 )
					{
						continue; // Can't rebind the sticks, so don't even show them
					}
					bool hasImage = false;
					for( const char** b = buttonsWithImages; *b != 0; b++ )
					{
						if( joyBinds[i].Icmp( *b ) == 0 )
						{
							hasImage = true;
							break;
						}
					}
					if( !bindings.IsEmpty() )
					{
						bindings.Append( ", " );
					}
					if( hasImage )
					{
						bindings.Append( '<' );
						bindings.Append( joyBinds[i] );
						bindings.Append( '>' );
					}
					else
					{
						bindings.Append( joyBinds[i] );
					}
				}
				bindings.Replace( "JOY_DPAD", "DPAD" );
			}
			
			if( !bind.keyboard.IsEmpty() )
			{
				if( !bindings.IsEmpty() )
				{
					bindings.Append( ", " );
				}
				bindings.Append( bind.keyboard );
			}
			
			if( !bind.mouse.IsEmpty() )
			{
				if( !bindings.IsEmpty() )
				{
					bindings.Append( ", " );
				}
				bindings.Append( bind.mouse );
			}
			
			bindings.ToUpper();
			option.Append( bindings );
			
		}
		else
		{
			option.Append( "" );
		}
//.........这里部分代码省略.........
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:101,代码来源:MenuScreen_Shell_Bindings.cpp

示例7: ProcessSnapshot

/*
========================
idCommonLocal::ProcessSnapshot
========================
*/
void idCommonLocal::ProcessSnapshot( idSnapShot& ss )
{
	int time = Sys_Milliseconds();
	
	snapTime = time;
	snapPrevious			= snapCurrent;
	snapCurrent.serverTime	= ss.GetTime();
	snapRate = snapCurrent.serverTime - snapPrevious.serverTime;
	
	
	static int lastReceivedLocalTime = 0;
	int timeSinceLastSnap = ( time - lastReceivedLocalTime );
	if( net_debug_snapShotTime.GetBool() )
	{
		idLib::Printf( "^2ProcessSnapshot. delta serverTime: %d  delta localTime: %d \n", ( snapCurrent.serverTime - snapPrevious.serverTime ), timeSinceLastSnap );
	}
	lastReceivedLocalTime = time;
	
	/* JAF ?
	for ( int i = 0; i < MAX_PLAYERS; i++ ) {
		idBitMsg msg;
		if ( ss.GetObjectMsgByID( idSession::SS_PLAYER + i, msg ) ) {
			if ( msg.GetSize() == 0 ) {
				snapCurrent.players[ i ].valid = false;
				continue;
			}
	
			idSerializer ser( msg, false );
			SerializePlayer( ser, snapCurrent.players[ i ] );
			snapCurrent.players[ i ].valid = true;
	
			extern idCVar com_drawSnapshots;
			if ( com_drawSnapshots.GetInteger() == 3 ) {
				console->AddSnapObject( "players", msg.GetSize(), ss.CompareObject( &oldss, idSession::SS_PLAYER + i ) );
			}
		}
	}
	*/
	
	// Read usercmds from other players
	for( int p = 0; p < MAX_PLAYERS; p++ )
	{
		if( p == game->GetLocalClientNum() )
		{
			continue;
		}
		idBitMsg msg;
		if( ss.GetObjectMsgByID( SNAP_USERCMDS + p, msg ) )
		{
			NetReadUsercmds( p, msg );
		}
	}
	
	
	
	
	// Set server game time here so that it accurately reflects the time when this frame was saved out, in case any serialize function needs it.
	int oldTime = Game()->GetServerGameTimeMs();
	Game()->SetServerGameTimeMs( snapCurrent.serverTime );
	
	Game()->ClientReadSnapshot( ss ); //, &oldss );
	
	// Restore server game time
	Game()->SetServerGameTimeMs( oldTime );
	
	snapTimeDelta = ss.GetRecvTime() - oldss.GetRecvTime();
	oldss = ss;
}
开发者ID:Anthony-Gaudino,项目名称:OpenTechBFG,代码行数:73,代码来源:Common_network.cpp

示例8: HandlePeerMatchParamUpdate

/*
========================
idSessionLocalCallbacks::HandlePeerMatchParamUpdate
========================
*/
void idSessionLocalCallbacks::HandlePeerMatchParamUpdate( int peer, int msg ) {
	if ( net_headlessServer.GetBool() ) {
		sessionLocal->storedPeer = peer;
		sessionLocal->storedMsgType = msg;
	}
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:11,代码来源:sys_session_callbacks.cpp

示例9: MouseMove

/*
=================
idUsercmdGenLocal::MouseMove
=================
*/
void idUsercmdGenLocal::MouseMove( void ) {
	float		mx, my, strafeMx, strafeMy;
	static int	history[8][2];
	static int	historyCounter;
	int			i;

	history[historyCounter&7][0] = mouseDx;
	history[historyCounter&7][1] = mouseDy;
	
	// allow mouse movement to be smoothed together
	int smooth = m_smooth.GetInteger();
	if ( smooth < 1 ) {
		smooth = 1;
	}
	if ( smooth > 8 ) {
		smooth = 8;
	}
	mx = 0;
	my = 0;
	for ( i = 0 ; i < smooth ; i++ ) {
		mx += history[ ( historyCounter - i + 8 ) & 7 ][0];
		my += history[ ( historyCounter - i + 8 ) & 7 ][1];
	}
	mx /= smooth;
	my /= smooth;

	// use a larger smoothing for strafing
	smooth = m_strafeSmooth.GetInteger();
	if ( smooth < 1 ) {
		smooth = 1;
	}
	if ( smooth > 8 ) {
		smooth = 8;
	}
	strafeMx = 0;
	strafeMy = 0;
	for ( i = 0 ; i < smooth ; i++ ) {
		strafeMx += history[ ( historyCounter - i + 8 ) & 7 ][0];
		strafeMy += history[ ( historyCounter - i + 8 ) & 7 ][1];
	}
	strafeMx /= smooth;
	strafeMy /= smooth;

	historyCounter++;

	if ( idMath::Fabs( mx ) > 1000 || idMath::Fabs( my ) > 1000 ) {
		Sys_DebugPrintf( "idUsercmdGenLocal::MouseMove: Ignoring ridiculous mouse delta.\n" );
		mx = my = 0;
	}

	mx *= sensitivity.GetFloat();
	my *= sensitivity.GetFloat();

	if ( m_showMouseRate.GetBool() ) {
		Sys_DebugPrintf( "[%3i %3i  = %5.1f %5.1f = %5.1f %5.1f]\n", mouseDx, mouseDy, mx, my, strafeMx, strafeMy );
	}

	mouseDx = 0;
	mouseDy = 0;

	if ( !strafeMx && !strafeMy ) {
		return;
	}

	if ( ButtonState( UB_STRAFE ) || !( cmd.buttons & BUTTON_MLOOK ) ) {
		// add mouse X/Y movement to cmd
		strafeMx *= m_strafeScale.GetFloat();
		strafeMy *= m_strafeScale.GetFloat();
		// clamp as a vector, instead of separate floats
		float len = sqrt( strafeMx * strafeMx + strafeMy * strafeMy );
		if ( len > 127 ) {
			strafeMx = strafeMx * 127 / len;
			strafeMy = strafeMy * 127 / len;
		}
	}

	if ( !ButtonState( UB_STRAFE ) ) {
		viewangles[YAW] -= m_yaw.GetFloat() * mx;
	} else {
		cmd.rightmove = idMath::ClampChar( (int)(cmd.rightmove + strafeMx) );
	}

	if ( !ButtonState( UB_STRAFE ) && ( cmd.buttons & BUTTON_MLOOK ) ) {
		viewangles[PITCH] += m_pitch.GetFloat() * my;
	} else {
		cmd.forwardmove = idMath::ClampChar( (int)(cmd.forwardmove - strafeMy) );
	}
}
开发者ID:core999,项目名称:Doom3,代码行数:93,代码来源:UsercmdGen.cpp

示例10: Solve


//.........这里部分代码省略.........
					}

					break;
				}
				case 1: {
					f[limit] = hi[limit];

					if (limit != i) {
						RemoveClamped(limit);
					}

					break;
				}
			}

			// if the current variable limited the step we can continue with the next variable
			if (limit == i) {
				break;
			}
		}

		if (n >= maxIterations) {
			failed = va("max iterations %d", maxIterations);
			break;
		}

		if (failed) {
			break;
		}
	}

#ifdef IGNORE_UNSATISFIABLE_VARIABLES

	if (numIgnored) {
		if (lcp_showFailures.GetBool()) {
			idLib::common->Printf("idLCP_Symmetric::Solve: %d of %d bounded variables ignored\n", numIgnored, m.GetNumRows() - numUnbounded);
		}
	}

#endif

	// if failed clear remaining forces
	if (failed) {
		if (lcp_showFailures.GetBool()) {
			idLib::common->Printf("idLCP_Square::Solve: %s (%d of %d bounded variables ignored)\n", failed, m.GetNumRows() - i, m.GetNumRows() - numUnbounded);
		}

		for (j = i; j < m.GetNumRows(); j++) {
			f[j] = 0.0f;
		}
	}

#if defined(_DEBUG) && 0

	if (!failed) {
		// test whether or not the solution satisfies the complementarity conditions
		for (i = 0; i < m.GetNumRows(); i++) {
			a[i] = -b[i];

			for (j = 0; j < m.GetNumRows(); j++) {
				a[i] += rowPtrs[i][j] * f[j];
			}

			if (f[i] == lo[i]) {
				if (lo[i] != hi[i] && a[i] < -LCP_ACCEL_EPSILON) {
					int bah1 = 1;
				}
			} else if (f[i] == hi[i]) {
				if (lo[i] != hi[i] && a[i] > LCP_ACCEL_EPSILON) {
					int bah2 = 1;
				}
			} else if (f[i] < lo[i] || f[i] > hi[i] || idMath::Fabs(a[i]) > 1.0f) {
				int bah3 = 1;
			}
		}
	}

#endif

	// unpermute result
	for (i = 0; i < f.GetSize(); i++) {
		o_x[permuted[i]] = f[i];
	}

	// unpermute original matrix
	for (i = 0; i < m.GetNumRows(); i++) {
		for (j = 0; j < m.GetNumRows(); j++) {
			if (permuted[j] == i) {
				break;
			}
		}

		if (i != j) {
			m.SwapColumns(i, j);
			idSwap(permuted[i], permuted[j]);
		}
	}

	return true;
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:101,代码来源:Lcp.cpp

示例11: DBtoLinear

/*
========================
idSoundHardware_XAudio2::Update
========================
*/
void idSoundHardware_XAudio2::Update()
{
	if( pXAudio2 == NULL )
	{
		int nowTime = Sys_Milliseconds();
		if( lastResetTime + 1000 < nowTime )
		{
			lastResetTime = nowTime;
			Init();
		}
		return;
	}
	if( soundSystem->IsMuted() )
	{
		pMasterVoice->SetVolume( 0.0f, OPERATION_SET );
	}
	else
	{
		pMasterVoice->SetVolume( DBtoLinear( s_volume_dB.GetFloat() ), OPERATION_SET );
	}
	
	pXAudio2->CommitChanges( XAUDIO2_COMMIT_ALL );
	
	// IXAudio2SourceVoice::Stop() has been called for every sound on the
	// zombie list, but it is documented as asyncronous, so we have to wait
	// until it actually reports that it is no longer playing.
	for( int i = 0; i < zombieVoices.Num(); i++ )
	{
		zombieVoices[i]->FlushSourceBuffers();
		if( !zombieVoices[i]->IsPlaying() )
		{
			freeVoices.Append( zombieVoices[i] );
			zombieVoices.RemoveIndexFast( i );
			i--;
		}
		else
		{
			static int playingZombies;
			playingZombies++;
		}
	}
	
	if( s_showPerfData.GetBool() )
	{
		XAUDIO2_PERFORMANCE_DATA perfData;
		pXAudio2->GetPerformanceData( &perfData );
		idLib::Printf( "Voices: %d/%d CPU: %.2f%% Mem: %dkb\n", perfData.ActiveSourceVoiceCount, perfData.TotalSourceVoiceCount, perfData.AudioCyclesSinceLastQuery / ( float )perfData.TotalCyclesSinceLastQuery, perfData.MemoryUsageInBytes / 1024 );
	}
	
	if( vuMeterRMS == NULL )
	{
		// Init probably hasn't been called yet
		return;
	}
	
	vuMeterRMS->Enable( s_showLevelMeter.GetBool() );
	vuMeterPeak->Enable( s_showLevelMeter.GetBool() );
	
	if( !s_showLevelMeter.GetBool() )
	{
		pMasterVoice->DisableEffect( 0 );
		return;
	}
	else
	{
		pMasterVoice->EnableEffect( 0 );
	}
	
	float peakLevels[ 8 ];
	float rmsLevels[ 8 ];
	
	XAUDIO2FX_VOLUMEMETER_LEVELS levels;
	levels.ChannelCount = outputChannels;
	levels.pPeakLevels = peakLevels;
	levels.pRMSLevels = rmsLevels;
	
	if( levels.ChannelCount > 8 )
	{
		levels.ChannelCount = 8;
	}
	
	pMasterVoice->GetEffectParameters( 0, &levels, sizeof( levels ) );
	
	int currentTime = Sys_Milliseconds();
	for( int i = 0; i < outputChannels; i++ )
	{
		if( vuMeterPeakTimes[i] < currentTime )
		{
			vuMeterPeak->SetValue( i, vuMeterPeak->GetValue( i ) * 0.9f, colorRed );
		}
	}
	
	float width = 20.0f;
	float height = 200.0f;
	float left = 100.0f;
//.........这里部分代码省略.........
开发者ID:ChristophHaag,项目名称:RBDOOM-3-BFG,代码行数:101,代码来源:XA2_SoundHardware.cpp

示例12: Posix_InitConsoleInput

/*
===============
Posix_InitConsoleInput
===============
*/
void Posix_InitConsoleInput()
{
	struct termios tc;
	
	if( in_tty.GetBool() )
	{
		if( isatty( STDIN_FILENO ) != 1 )
		{
			Sys_Printf( "terminal support disabled: stdin is not a tty\n" );
			in_tty.SetBool( false );
			return;
		}
		if( tcgetattr( 0, &tty_tc ) == -1 )
		{
			Sys_Printf( "tcgetattr failed. disabling terminal support: %s\n", strerror( errno ) );
			in_tty.SetBool( false );
			return;
		}
		// make the input non blocking
		if( fcntl( STDIN_FILENO, F_SETFL, fcntl( STDIN_FILENO, F_GETFL, 0 ) | O_NONBLOCK ) == -1 )
		{
			Sys_Printf( "fcntl STDIN non blocking failed.  disabling terminal support: %s\n", strerror( errno ) );
			in_tty.SetBool( false );
			return;
		}
		tc = tty_tc;
		/*
		  ECHO: don't echo input characters
		  ICANON: enable canonical mode.  This  enables  the  special
		  	characters  EOF,  EOL,  EOL2, ERASE, KILL, REPRINT,
		  	STATUS, and WERASE, and buffers by lines.
		  ISIG: when any of the characters  INTR,  QUIT,  SUSP,  or
		  	DSUSP are received, generate the corresponding signal
		*/
		tc.c_lflag &= ~( ECHO | ICANON );
		/*
		  ISTRIP strip off bit 8
		  INPCK enable input parity checking
		*/
		tc.c_iflag &= ~( ISTRIP | INPCK );
		tc.c_cc[VMIN] = 1;
		tc.c_cc[VTIME] = 0;
		if( tcsetattr( 0, TCSADRAIN, &tc ) == -1 )
		{
			Sys_Printf( "tcsetattr failed: %s\n", strerror( errno ) );
			Sys_Printf( "terminal support may not work correctly. Use +set in_tty 0 to disable it\n" );
		}
#if 0
		// make the output non blocking
		if( fcntl( STDOUT_FILENO, F_SETFL, fcntl( STDOUT_FILENO, F_GETFL, 0 ) | O_NONBLOCK ) == -1 )
		{
			Sys_Printf( "fcntl STDOUT non blocking failed: %s\n", strerror( errno ) );
		}
#endif
		tty_enabled = true;
		// check the terminal type for the supported ones
		char* term = getenv( "TERM" );
		if( term )
		{
			if( strcmp( term, "linux" ) && strcmp( term, "xterm" ) && strcmp( term, "xterm-color" ) && strcmp( term, "screen" ) )
			{
				Sys_Printf( "WARNING: terminal type '%s' is unknown. terminal support may not work correctly\n", term );
			}
		}
		Sys_Printf( "terminal support enabled ( use +set in_tty 0 to disabled )\n" );
	}
	else
	{
		Sys_Printf( "terminal support disabled\n" );
	}
}
开发者ID:BielBdeLuna,项目名称:StormEngine2,代码行数:76,代码来源:posix_main.cpp

示例13: ShowScreen

/*
========================
idMenuScreen_Shell_PressStart::ShowScreen
========================
*/
void idMenuScreen_Shell_PressStart::ShowScreen( const mainMenuTransition_t transitionType )
{

	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		if( g_demoMode.GetBool() )
		{
		
			idList<const idMaterial*> coverIcons;
			if( itemList != NULL )
			{
				itemList->SetListImages( coverIcons );
			}
			
			if( startButton != NULL )
			{
				startButton->BindSprite( root );
				startButton->SetLabel( idLocalization::GetString( "#str_swf_press_start" ) );
			}
			
			idSWFSpriteInstance* backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" );
			if( backing != NULL )
			{
				backing->SetVisible( false );
			}
			
		}
		else
		{
		
			idList<const idMaterial*> coverIcons;
			
			coverIcons.Append( doomCover );
			coverIcons.Append( doom3Cover );
			coverIcons.Append( doom2Cover );
			
			if( itemList != NULL )
			{
				itemList->SetListImages( coverIcons );
				itemList->SetFocusIndex( 1, true );
				itemList->SetViewIndex( 1 );
				itemList->SetMoveToIndex( 1 );
			}
			
			if( startButton != NULL )
			{
				startButton->BindSprite( root );
				startButton->SetLabel( "" );
			}
			
			idSWFSpriteInstance* backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" );
			if( backing != NULL )
			{
				backing->SetVisible( true );
			}
			
		}
	}
	
	idMenuScreen::ShowScreen( transitionType );
}
开发者ID:hexameron,项目名称:RBDOOM-3-BFG,代码行数:67,代码来源:MenuScreen_Shell_PressStart.cpp

示例14: Load


//.........这里部分代码省略.........
			{
				idLib::FatalError( "%s File ended while reading key at line %d", name, line );
			}
			tempKey.CopyRange( ( char* )buffer, keyStart, keyEnd );
			
			int valStart = -1;
			while( i < bufferLen )
			{
				c = buffer[i++];
				if( c == '\"' )
				{
					valStart = i;
					break;
				}
			}
			if( valStart < 0 )
			{
				idLib::FatalError( "%s File ended while reading value at line %d", name, line );
			}
			int valEnd = -1;
			tempVal.CapLength( 0 );
			while( i < bufferLen )
			{
				c = utf8 ? idStr::UTF8Char( buffer, i ) : buffer[i++];
				if( !utf8 && c >= 0x80 )
				{
					// this is a serious error and we must check this to avoid accidentally shipping a file where someone squased UTF-8 encodings
					idLib::FatalError( "Language file %s is supposed to be plain ASCII, but has byte values > 127!", name );
				}
				if( c == '\"' )
				{
					valEnd = i - 1;
					continue;
				}
				if( c == '\n' )
				{
					line++;
					break;
				}
				if( c == '\r' )
				{
					continue;
				}
				if( c == '\\' )
				{
					c = utf8 ? idStr::UTF8Char( buffer, i ) : buffer[i++];
					if( c == 'n' )
					{
						c = '\n';
					}
					else if( c == 't' )
					{
						c = '\t';
					}
					else if( c == '\"' )
					{
						c = '\"';
					}
					else if( c == '\\' )
					{
						c = '\\';
					}
					else
					{
						idLib::Warning( "Unknown escape sequence %x at line %d", c, line );
					}
				}
				tempVal.AppendUTF8Char( c );
			}
			if( valEnd < valStart )
			{
				idLib::FatalError( "%s File ended while reading value at line %d", name, line );
			}
			if( lang_maskLocalizedStrings.GetBool() && tempVal.Length() > 0 && tempKey.Find( "#font_" ) == -1 )
			{
				int len = tempVal.Length();
				if( len > 0 )
				{
					tempVal.Fill( 'W', len - 1 );
				}
				else
				{
					tempVal.Empty();
				}
				tempVal.Append( 'X' );
			}
			AddKeyVal( tempKey, tempVal );
			numStrings++;
		}
	}
	
	idLib::Printf( "%i strings read\n", numStrings );
	
	// get rid of any waste due to geometric list growth
	//mem.PushHeap();
	keyVals.Condense();
	//mem.PopHeap();
	
	return true;
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:101,代码来源:LangDict.cpp

示例15: Process

/*
==================
FullscreenFXManager::Process
==================
*/
void FullscreenFXManager::Process( const renderView_t* view )
{
	bool allpass = false;
	bool atLeastOneFX = false;
	
	if( g_testFullscreenFX.GetInteger() == -2 )
	{
		allpass = true;
	}
	
	// do the first render
	gameRenderWorld->RenderScene( view );
	
	// we should consider these on a case-by-case basis for stereo rendering
	// double vision could be implemented "for real" by shifting the
	// eye views
	if( IsGameStereoRendered() && !player_allowScreenFXInStereo.GetBool() )
	{
		return;
	}
	
	// do the process
	for( int i = 0; i < fx.Num(); i++ )
	{
		FullscreenFX* pfx = fx[i];
		bool drawIt = false;
		
		// determine if we need to draw
		if( pfx->Active() || g_testFullscreenFX.GetInteger() == i || allpass )
		{
			drawIt = pfx->SetTriggerState( true );
		}
		else
		{
			drawIt = pfx->SetTriggerState( false );
		}
		
		// do the actual drawing
		if( drawIt )
		{
			atLeastOneFX = true;
			
			// we need to dump to _currentRender
			renderSystem->CaptureRenderToImage( "_currentRender" );
			
			// handle the accum pass if we have one
			if( pfx->HasAccum() )
			{
				// we need to crop the accum pass
				renderSystem->CropRenderSize( 512, 512 );
				pfx->AccumPass( view );
				renderSystem->CaptureRenderToImage( "_accum" );
				renderSystem->UnCrop();
			}
			
			// do the high quality pass
			pfx->HighQuality();
			
			// do the blendback
			Blendback( pfx->GetFadeAlpha() );
		}
	}
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:68,代码来源:PlayerView.cpp


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