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


C++ CVarTrack::Init方法代码示例

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


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

示例1: SetServerSettings

void CServerMissionMgr::SetServerSettings(ServerMissionSettings& ServerSettings)
{
	if (!g_vtNetFriendlyFire.IsInitted())
	{
		g_vtNetFriendlyFire.Init(g_pLTServer, "NetFriendlyFire", LTNULL, 1.0f);
	}
	if (!g_vtDifficultyFactorPlayerIncrease.IsInitted())
	{
		g_vtDifficultyFactorPlayerIncrease.Init( g_pLTServer, "DifficultyFactorPlayerIncrease", LTNULL, 0.1f );
	}
	if( !g_vtRunSpeed.IsInitted( ))
	{
		g_vtRunSpeed.Init( g_pLTServer, "RunSpeed", NULL, 1.0f );
	}

	m_ServerSettings = ServerSettings;

	g_vtNetFriendlyFire.SetFloat( ( ServerSettings.m_bFriendlyFire ? 1.0f : 0.0f) );

	if (IsDifficultyGameType())
	{
		g_pGameServerShell->SetDifficulty((GameDifficulty)ServerSettings.m_nMPDifficulty);
		g_pLTServer->CPrint("CServerMissionMgr::StartGame() setting difficulty to %d",ServerSettings.m_nMPDifficulty);
	}
	else
		g_pGameServerShell->SetDifficulty(GD_NORMAL);
	

	g_vtDifficultyFactorPlayerIncrease.SetFloat(ServerSettings.m_fPlayerDiffFactor);

	// Only adjust the runspeed if this is a gametype that allows it.
	if( !IsCoopMultiplayerGameType( ))
		g_vtRunSpeed.SetFloat(  (float)ServerSettings.m_nRunSpeed / 100.0f );
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:34,代码来源:ServerMissionMgr.cpp

示例2: HandleImpact

void CLipstickProx::HandleImpact(HOBJECT hObj)
{
	CGrenade::HandleImpact(hObj);

	if (!g_vtProxGrenadeArmDelay.IsInitted())
	{
        g_vtProxGrenadeArmDelay.Init(g_pLTServer, "ProxArmDelay", LTNULL, -1.0f);
	}

	if (!g_vtProxGrenadeDetonateDelay.IsInitted())
	{
        g_vtProxGrenadeDetonateDelay.Init(g_pLTServer, "ProxDetonateDelay", LTNULL, -1.0f);
	}

	// See if we should stick to the object we just hit...

	SURFACE* pSurf = g_pSurfaceMgr->GetSurface(m_eLastHitSurface);
	if (pSurf)
	{
		// Does this surface support magnatism?  If so, stick...

		if (pSurf->bMagnetic)
		{
			// Need to set velocity to 0.0f but account for stoping vel
			// being added back in...

			CollisionInfo info;
            g_pLTServer->GetLastCollision(&info);

			LTVector vVel(0, 0, 0);
			vVel -= info.m_vStopVel;
			g_pLTServer->SetVelocity(m_hObject, &vVel);

			m_vSurfaceNormal.Init(0, 1, 0);
			m_vSurfaceNormal = info.m_Plane.m_Normal;


			// Turn off gravity, solid, and touch notify....
			// And turn on go-thru-world so it doesn't reflect from the ending position

            uint32 dwFlags = g_pLTServer->GetObjectFlags(m_hObject);
			dwFlags &= ~(FLAG_GRAVITY | FLAG_TOUCH_NOTIFY | FLAG_SOLID);
			dwFlags |= FLAG_GOTHRUWORLD;
            g_pLTServer->SetObjectFlags(m_hObject, dwFlags);


			// Rotate to rest...

			RotateToRest();
		}
	}
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:52,代码来源:ProjectileTypes.cpp

示例3: PreStartWorld

void CLiteObjectMgr::PreStartWorld(bool bSwitchingWorlds)
{
	// Can't do this in the ctor due to g_pLTServer not being valid yet...
	if (!g_ShowLiteObjectInfoTrack.IsInitted())
		g_ShowLiteObjectInfoTrack.Init(g_pLTServer, "ShowLiteObjectInfo", LTNULL, 0.0f);

	// Move the objects into the delete list
	if (m_aDeleteObjects.empty())
		m_aActiveObjects.swap(m_aDeleteObjects);
	else
	{
		m_aDeleteObjects.insert(m_aDeleteObjects.end(), m_aActiveObjects.begin(), m_aActiveObjects.end());
		m_aActiveObjects.swap(TObjectList());
	}
	m_nNumActiveObjects = 0;

	if (m_aDeleteObjects.empty())
		m_aInactiveObjects.swap(m_aDeleteObjects);
	else
	{
		m_aDeleteObjects.insert(m_aDeleteObjects.end(), m_aInactiveObjects.begin(), m_aInactiveObjects.end());
		m_aInactiveObjects.swap(TObjectList());
	}
	m_nNumInactiveObjects = 0;

	// Clear the name map
	m_aNameMap.clear();

	// Clear the initial update list
	m_aInitialUpdateObjects.swap(TObjectList());

	// You're clean, now
	SetDirty(eDirty_All, false);

}
开发者ID:Arc0re,项目名称:lithtech,代码行数:35,代码来源:LiteObjectMgr.cpp

示例4: CreateBoundingBox

void GameBase::CreateBoundingBox()
{
	if (m_hDimsBox) return;

	if (!g_vtDimsAlpha.IsInitted())
	{
        g_vtDimsAlpha.Init(g_pLTServer, "DimsAlpha", LTNULL, 1.0f);
	}

	ObjectCreateStruct theStruct;
	INIT_OBJECTCREATESTRUCT(theStruct);

    LTVector vPos;
    g_pLTServer->GetObjectPos(m_hObject, &vPos);
	theStruct.m_Pos = vPos;

	SAFE_STRCPY(theStruct.m_Filename, "Models\\1x1_square.abc");
	SAFE_STRCPY(theStruct.m_SkinName, "Models\\1x1_square.dtx");

	theStruct.m_Flags = FLAG_VISIBLE | FLAG_NOLIGHT | FLAG_GOTHRUWORLD;
	theStruct.m_ObjectType = OT_MODEL;

    HCLASS hClass = g_pLTServer->GetClass("BaseClass");
    LPBASECLASS pModel = g_pLTServer->CreateObject(hClass, &theStruct);

	if (pModel)
	{
		m_hDimsBox = pModel->m_hObject;

        LTVector vDims;
        g_pLTServer->GetObjectDims(m_hObject, &vDims);

        LTVector vScale;
		VEC_DIVSCALAR(vScale, vDims, 0.5f);
        g_pLTServer->ScaleObject(m_hDimsBox, &vScale);
	}


    LTVector vOffset;
    LTRotation rOffset;
	vOffset.Init();
    rOffset.Init();

	HATTACHMENT hAttachment;
    LTRESULT dRes = g_pLTServer->CreateAttachment(m_hObject, m_hDimsBox, LTNULL,
											     &vOffset, &rOffset, &hAttachment);
    if (dRes != LT_OK)
	{
        g_pLTServer->RemoveObject(m_hDimsBox);
        m_hDimsBox = LTNULL;
	}

    LTVector vColor = GetBoundingBoxColor();

    g_pLTServer->SetObjectColor(m_hDimsBox, vColor.x, vColor.y, vColor.z, g_vtDimsAlpha.GetFloat());
}
开发者ID:germanocaldeira,项目名称:no-one-lives-forever,代码行数:56,代码来源:GameBase.cpp

示例5: InitialUpdate

void VolumeBrush::InitialUpdate()
{
// TESTING!!!!
	if (!vtRemoveFilters.IsInitted())
	{
		vtRemoveFilters.Init(g_pLTServer, "RemoveFilters", LTNULL, 0.0f);
	}
	if (vtRemoveFilters.GetFloat())
	{
		g_pLTServer->CPrint("Removing Filter: %s", g_pLTServer->GetObjectName(m_hObject));
		g_pLTServer->RemoveObject(m_hObject);
		return;
	}
// TESTING!!!!


	// Tell the client about any special fx (fog)...

	CreateSpecialFXMsg();


	// Save volume brush's initial flags...

    m_dwSaveFlags = g_pLTServer->GetObjectFlags(m_hObject);


    uint32 dwUserFlags = g_pLTServer->GetObjectUserFlags(m_hObject);
	dwUserFlags |= USRFLG_IGNORE_PROJECTILES;
	if (!m_bHidden) dwUserFlags |= USRFLG_VISIBLE;

    g_pLTServer->SetObjectUserFlags(m_hObject, dwUserFlags);


	// Create the surface if necessary.  We only need to do updates if we have
	// a surface (in case somebody decides to move the brush, we need to update
	// the surface's position)...

	if (m_bShowSurface)
	{
		CreateSurface();
        SetNextUpdate(UPDATE_DELTA);
	}


	// Normalize friction (1 = normal, 0 = no friction, 2 = double)...

	if (m_fFriction < 0.0) m_fFriction = 0.0f;
	else if (m_fFriction > 1.0) m_fFriction = 1.0f;


	// Normalize viscosity (1 = no movement, 0 = full movement)...

	if (m_fViscosity < 0.0) m_fViscosity = 0.0f;
	else if (m_fViscosity > 1.0) m_fViscosity = 1.0f;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:55,代码来源:VolumeBrush.cpp

示例6: InitialUpdate

void Intelligence::InitialUpdate()
{

	if (!g_IntelRespawnScale.IsInitted())
	{
        g_IntelRespawnScale.Init(GetServerDE(), "IntelRespawnScale", LTNULL, 1.0f);
	}

 	if (m_bStartHidden)
	{
		SetNextUpdate(0.001f);
	}

	m_bSkipUpdate = m_bMoveToFloor;

	CacheFiles();

}
开发者ID:germanocaldeira,项目名称:no-one-lives-forever,代码行数:18,代码来源:Intelligence.cpp

示例7: Setup

void CProjectile::Setup(CWeapon* pWeapon, WFireInfo & info)
{
	if (!pWeapon || !info.hFiredFrom || !g_pWeaponMgr) return;

	if (!g_vtInvisibleMaxThickness.IsInitted())
	{
        g_vtInvisibleMaxThickness.Init(g_pLTServer, "InvisibleMaxThickness", LTNULL, 33.0f);
	}
	if (!g_vtNetFriendlyFire.IsInitted())
	{
        g_vtNetFriendlyFire.Init(g_pLTServer, "NetFriendlyFire", LTNULL, 0.0f);
	}

	m_vDir				= info.vPath;
	m_vDir.Norm();

	m_hFiredFrom		= info.hFiredFrom;
	m_nWeaponId			= pWeapon->GetId();
	m_nAmmoId			= pWeapon->GetAmmoId();
	m_fLifeTime			= pWeapon->GetLifeTime();
	m_fInstDamage		= pWeapon->GetInstDamage();
	m_fProgDamage		= pWeapon->GetProgDamage();

	m_pWeaponData		= pWeapon->GetWeaponData();
	if (!m_pWeaponData) return;

	m_pAmmoData			= pWeapon->GetAmmoData();
	if (!m_pAmmoData) return;

	m_eInstDamageType	= m_pAmmoData->eInstDamageType;
	m_eProgDamageType	= m_pAmmoData->eProgDamageType;

	if (info.bOverrideVelocity)
	{
		m_fVelocity = info.fOverrideVelocity;
	}
	else if (info.bAltFire)
	{
        m_fVelocity = (LTFLOAT) (m_pAmmoData->pProjectileFX ? m_pAmmoData->pProjectileFX->nAltVelocity : 0);
	}
	else
	{
        m_fVelocity = (LTFLOAT) (m_pAmmoData->pProjectileFX ? m_pAmmoData->pProjectileFX->nVelocity : 0);
	}

    m_fRange            = (LTFLOAT) m_pWeaponData->nRange;
	m_bSilenced			= !!(pWeapon->GetSilencer());

	AmmoType eAmmoType  = m_pAmmoData->eType;

	m_vFirePos			= info.vFirePos;
	m_vFlashPos			= info.vFlashPos;

	m_bNumCallsToAddImpact = 0;

	// See if we start inside the test object...

	if (!TestInsideObject(info.hTestObj, eAmmoType))
	{
		if (eAmmoType == PROJECTILE)
		{
			DoProjectile();
		}
		else if (eAmmoType == VECTOR)
		{
			DoVector();
		}
		else if (eAmmoType == GADGET)
		{
			; // Do nothing for now
		}
	}
}
开发者ID:germanocaldeira,项目名称:no-one-lives-forever,代码行数:73,代码来源:Projectile.cpp

示例8: InitialUpdate

LTBOOL PickupItem::InitialUpdate()
{
    SetNextUpdate(UPDATE_NEVER);

	if (!g_RespawnScaleTrack.IsInitted())
	{
        g_RespawnScaleTrack.Init(GetServerDE(), "RespawnScale", LTNULL, 1.0f);
	}


	// Set up our user flags...

	g_pCommonLT->SetObjectFlags(m_hObject, OFT_User, m_dwUserFlags, m_dwUserFlags);


	// set a special fx message so that the client knows about the pickup item...
	// (so it can handle bouncing, rotating, and displaying the proper targeting text...)

	CreateSpecialFX();

	g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, m_dwFlags, m_dwFlags);

	// Look for an animation specified in DEdit...

	uint32 dwAni = INVALID_ANI;
	if( !m_sWorldAniName.empty())
	{
		dwAni = g_pLTServer->GetAnimIndex(m_hObject, m_sWorldAniName.c_str());
	}
	
	if (dwAni != INVALID_ANI)
	{
		g_pLTServer->SetModelAnimation(m_hObject, dwAni);
	}
	else
	{
		// If we couldn't find the ani look for the world ani.  ALL PickUps should have a "World" ani...

		dwAni = g_pLTServer->GetAnimIndex( m_hObject, "World" );
		if( dwAni != INVALID_ANI )
		{
			g_pLTServer->SetModelAnimation( m_hObject, dwAni );
		}
	}

	// Set the dims based on the current animation...

    LTVector vDims;
    g_pCommonLT->GetModelAnimUserDims(m_hObject, &vDims, g_pLTServer->GetModelAnimation(m_hObject));

	// Set object dims based on scale value...

    LTVector vNewDims;
	vNewDims.x = m_vScale.x * vDims.x;
	vNewDims.y = m_vScale.y * vDims.y;
	vNewDims.z = m_vScale.z * vDims.z;

    g_pLTServer->ScaleObject(m_hObject, &m_vScale);
	g_pPhysicsLT->SetObjectDims(m_hObject, &vNewDims, 0);

	// Make sure object starts on floor if the gravity flag is set...

	if(m_bMoveToFloor)
	{
		MoveObjectToFloor(m_hObject);
	}

    return LTTRUE;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:69,代码来源:PickupItem.cpp

示例9: Init

void CMusicMgr::Init(const char* szMusicControlFile)
{
	// Start fresh.
	Term( );

	if( !m_pMusicButeMgr )
	{
		m_pMusicButeMgr = new CMusicButeMgr( );
		if( !m_pMusicButeMgr )
			return;

		if( !m_pMusicButeMgr->Init())
			return;
	}

	strcpy(m_szTheme, szMusicControlFile);
	char* pchDot;
	if ( pchDot = strchr(m_szTheme, '.') )
	{
		*pchDot = 0;
	}

    _strlwr(m_szTheme);

	for ( uint32 iMood = 0 ; iMood < kNumMoods ; ++iMood )
	{
		m_acMoods[iMood] = 0;

		for ( uint32 iLevel = 0 ; iLevel < kMaxLevelsPerMood ; iLevel++ )
		{
			char szMood[128];
			sprintf(szMood, "%s%d", s_aszMusicMoods[iMood], iLevel);
			m_aanMoods[iMood][m_acMoods[iMood]] = m_pMusicButeMgr->GetButeMgr( )->GetInt(m_szTheme, szMood, m_aanMoods[iMood][m_acMoods[iMood]]);
			if ( m_pMusicButeMgr->GetButeMgr( )->Success( ))
			{
				m_acMoods[iMood]++;
			}
			else
			{
				break;
			}
		}
	}

	for ( uint32 iEvent = 0 ; iEvent < kNumEvents ; ++iEvent )
	{
		m_acEvents[iEvent] = 0;

		for ( uint32 iMotif = 0 ; iMotif < kMaxMotifsPerEvent ; iMotif++ )
		{
			char szEvent[128];
			sprintf(szEvent, "%s%d", s_aszEvents[iEvent], iMotif);
			m_pMusicButeMgr->GetButeMgr( )->GetString(m_szTheme, szEvent, "", m_aaszEvents[iEvent][m_acEvents[iEvent]], sizeof(m_aaszEvents[iEvent][m_acEvents[iEvent]]));
			if ( m_pMusicButeMgr->GetButeMgr( )->Success( ))
			{
				m_acEvents[iEvent]++;
			}
			else
			{
				break;
			}
		}
	}

	m_afEventChances[eEventPlayerDie]	= (LTFLOAT)m_pMusicButeMgr->GetButeMgr( )->GetDouble("settings", "DieChance");
	m_afEventChances[eEventAIDie]		= (LTFLOAT)m_pMusicButeMgr->GetButeMgr( )->GetDouble("settings", "DieChance");
	m_afEventChances[eEventAIDodge]		= (LTFLOAT)m_pMusicButeMgr->GetButeMgr( )->GetDouble("settings", "DodgeChance");

	m_bInitialized = LTTRUE;

#ifndef _FINAL
	if ( !g_ShowMusicTrack.IsInitted() )
	{
		g_ShowMusicTrack.Init(g_pLTServer, "ShowMusicChange", LTNULL, 0.0f);
	}
#endif

}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:78,代码来源:MusicMgr.cpp

示例10: HandleAttachmentImpact

void Prop::HandleAttachmentImpact( CAttachmentPosition *pAttachPos, const LTVector& vDir )
{
	if( !pAttachPos )
		return;

	// TODO: Init these somewhere else
	if( !s_vtAttachmentMinVel.IsInitted() )
	{
		s_vtAttachmentMinVel.Init( g_pLTServer, "AttachmentMinVel", LTNULL, DEFAULT_ATTACH_MIN_VEL );
	}
	if( !s_vtAttachmentMaxVel.IsInitted() )
	{
		s_vtAttachmentMaxVel.Init( g_pLTServer, "AttachmentMaxVel", LTNULL, DEFAULT_ATTACH_MAX_VEL );
	}
	if( !s_vtAttachmentMinYAdd.IsInitted() )
	{
		s_vtAttachmentMinYAdd.Init( g_pLTServer, "AttachmentMinYAdd", LTNULL, DEFAULT_ATTACH_MIN_YADD );
	}
	if( !s_vtAttachmentMaxYAdd.IsInitted() )
	{
		s_vtAttachmentMaxYAdd.Init( g_pLTServer, "AttachmentMaxYAdd", LTNULL, DEFAULT_ATTACH_MAX_YADD );
	}
	if( !s_vtAttachmentFadeDelay.IsInitted() )
	{
		s_vtAttachmentFadeDelay.Init( g_pLTServer, "AttachmentFadeDelay", LTNULL, DEFAULT_ATTACH_FADE_DELAY );
	}
	if( !s_vtAttachmentFadeDuration.IsInitted() )
	{
		s_vtAttachmentFadeDuration.Init( g_pLTServer, "AttachmentFadeDuration", LTNULL, DEFAULT_ATTACH_FADE_DURATION );
	}
	
	// Set the owner of the attachment...
	
	m_hAttachmentOwner = pAttachPos->GetAttachment()->GetObject();

	uint32 dwFlags = FLAG_POINTCOLLIDE | FLAG_NOSLIDING | FLAG_TOUCH_NOTIFY | FLAG_GRAVITY;
	g_pCommonLT->SetObjectFlags( m_hObject, OFT_Flags, dwFlags, dwFlags | FLAG_GOTHRUWORLD );	

	// Play the world animation so the prop is flat when it comes to rest...

	HMODELANIM	hWorldAnim = INVALID_MODEL_ANIM;
	if( (g_pModelLT->GetAnimIndex( m_hObject, "WORLD", hWorldAnim ) == LT_OK) && (hWorldAnim != INVALID_MODEL_ANIM) )
	{
		g_pModelLT->SetLooping( m_hObject, MAIN_TRACKER, true );
		g_pModelLT->SetCurAnim( m_hObject, MAIN_TRACKER, hWorldAnim );
	}
	

	LTVector vVel = vDir;
	vVel.Normalize();
	vVel *= GetRandom( s_vtAttachmentMinVel.GetFloat(), s_vtAttachmentMaxVel.GetFloat() );
	vVel.y += GetRandom( s_vtAttachmentMinYAdd.GetFloat(), s_vtAttachmentMaxYAdd.GetFloat() );
	
	g_pPhysicsLT->SetVelocity( m_hObject, &vVel );

	// Don't play the touch animation and sounds when recieving a touch notify...

	m_bTouchable = LTFALSE;
	m_bAttachmentShotOff = LTTRUE;

	g_pLTServer->SetBlockingPriority( m_hObject, 0 );
	g_pPhysicsLT->SetForceIgnoreLimit( m_hObject, 0.0f );

	// Give it some rotation...

	float fVal	= MATH_PI;
    float fVal2	= MATH_CIRCLE;
	m_fPitchVel	= GetRandom( -fVal2, fVal2 );
	m_fYawVel	= GetRandom( -fVal2, fVal2 );
	m_fRollVel	= GetRandom( -fVal2, fVal2 );

	m_bRotating	= true;

	SetNextUpdate(UPDATE_NEXT_FRAME);
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:75,代码来源:Prop.cpp


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