本文整理汇总了C++中CVarTrack类的典型用法代码示例。如果您正苦于以下问题:C++ CVarTrack类的具体用法?C++ CVarTrack怎么用?C++ CVarTrack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CVarTrack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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());
}
示例3: 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;
}
示例4: 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 );
}
示例5: 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();
}
}
}
示例6: PickedUp
void WeaponItem::PickedUp(HMESSAGEREAD hRead)
{
// make the item invisible for the correct amount of time
uint32 dwFlags = g_pLTServer->GetObjectFlags(m_hObject);
g_pLTServer->SetObjectFlags(m_hObject, dwFlags & ~FLAG_VISIBLE & ~FLAG_TOUCH_NOTIFY);
// Let the world know what happened...
PlayPickedupSound();
// Clear our player obj, we no longer need this link...
SetPlayerObj(LTNULL);
// if we're supposed to trigger something, trigger it here
if (m_hstrPickupTriggerTarget && m_hstrPickupTriggerMessage)
{
SendTriggerMsgToObjects(this, m_hstrPickupTriggerTarget, m_hstrPickupTriggerMessage);
}
// get the override respawn time - if it's -1.0, use the default
LTFLOAT fRespawn = g_pLTServer->ReadFromMessageFloat (hRead);
if (fRespawn == -1.0f)
{
fRespawn = m_fRespawnDelay;
}
fRespawn /= g_RespawnScaleTrack.GetFloat(1.0f);
if (g_pGameServerShell->GetGameType() != SINGLE && g_WeaponsStay.GetFloat() > 0.0f && m_fRespawnDelay > 0.0f)
{
fRespawn = 0.1f;
}
if (fRespawn <= 0.0f || g_pGameServerShell->GetGameType() == SINGLE)
{
g_pLTServer->RemoveObject(m_hObject);
}
else
{
g_pLTServer->SetNextUpdate(m_hObject, fRespawn);
}
}
示例7: Update
void CLiteObjectMgr::Update()
{
LTCounter cUpdateTime;
g_pLTServer->StartCounter(&cUpdateTime);
HandlePendingDeletes();
HandlePendingInitialUpdates();
// Update the active objects
// Note : This can't use an iterator, since the update might add objects or something like that...
uint32 nActiveObjectSize = m_aActiveObjects.size();
for (uint32 nCurObj = 0; nCurObj < nActiveObjectSize; ++nCurObj)
{
GameBaseLite *pCurObj = m_aActiveObjects[nCurObj];
if (pCurObj)
pCurObj->Update();
ASSERT(nCurObj < m_aActiveObjects.size());
}
// Clean up, if we need to
CleanObjectLists();
uint32 nUpdateTime = g_pLTServer->EndCounter(&cUpdateTime);
if (g_ShowLiteObjectInfoTrack.GetFloat())
{
ShowInfo(nUpdateTime);
}
}
示例8: CalcInvisibleImpact
LTBOOL CProjectile::CalcInvisibleImpact(IntersectInfo & iInfo, SurfaceType & eSurfType)
{
// Since we hit an invisible surface try and find a solid surface that
// is the real surface of impact. NOTE: We assume that the solid
// surface will have a normal facing basically the opposite direction...
IntersectInfo iTestInfo;
IntersectQuery qTestInfo;
qTestInfo.m_From = iInfo.m_Point + (m_vDir * g_vtInvisibleMaxThickness.GetFloat());
qTestInfo.m_To = iInfo.m_Point - m_vDir;
qTestInfo.m_Flags = INTERSECT_OBJECTS | IGNORE_NONSOLID | INTERSECT_HPOLY;
qTestInfo.m_FilterFn = DoVectorFilterFn;
qTestInfo.m_pUserData = m_hFiredFrom;
if (g_pLTServer->IntersectSegment(&qTestInfo, &iTestInfo))
{
eSurfType = GetSurfaceType(iTestInfo);
// If we hit another invisible surface, we're done...
if (eSurfType != ST_INVISIBLE)
{
iInfo = iTestInfo;
return LTTRUE;
}
}
return LTFALSE;
}
示例9: DoEvent
void CMusicMgr::DoEvent(Event eEvent)
{
if ( !m_bEnabled ) return;
if ( m_bLockedEvent ) return;
if ( m_acEvents[eEvent] != 0 && (m_afEventChances[eEvent] > GetRandom(0.0, 1.0f)) )
{
char szMusic[128];
uint32 iEvent = GetRandom(0, m_acEvents[eEvent]-1);
sprintf(szMusic, "MUSIC PM %s %s Beat", m_szTheme, m_aaszEvents[eEvent][iEvent]);
#ifndef _FINAL
if ( g_ShowMusicTrack.GetFloat() > 0 )
{
g_pLTServer->CPrint("Server sending client Music Message: (%s)", szMusic);
}
#endif
HSTRING hMusic = g_pLTServer->CreateString(szMusic);
CAutoMessage cMsg;
cMsg.Writeuint8(MID_MUSIC);
cMsg.WriteHString(hMusic);
g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
FREE_HSTRING(hMusic);
}
}
示例10: SendTriggerMsgToObject
void SendTriggerMsgToObject(LPBASECLASS pSender, HOBJECT hObj, HSTRING hMsg)
{
HMESSAGEWRITE hMessage;
char *pSendName, *pRecvName, *pFilter;
char* szMessage = g_pLTServer->GetStringData(hMsg);
// Process the message as a command if it is a valid command...
if (g_pCmdMgr->IsValidCmd(szMessage))
{
g_pCmdMgr->Process(szMessage);
return;
}
hMessage = g_pLTServer->StartMessageToObject(pSender, hObj, MID_TRIGGER);
if (hMessage)
{
if (g_ShowTriggersTrack.GetFloat() != 0.0f)
{
if (pSender) pSendName = g_pLTServer->GetObjectName(pSender->m_hObject);
else pSendName = "Command Manager";
pRecvName = g_pLTServer->GetObjectName(hObj);
pFilter = g_ShowTriggersFilter.GetStr();
// Filter out displaying any unwanted messages...
LTBOOL bPrintMsg = (!pFilter || !pFilter[0]);
if (!bPrintMsg)
{
bPrintMsg = (szMessage ? !strstr(pFilter, szMessage) : LTTRUE);
}
if (bPrintMsg)
{
g_pLTServer->CPrint("Message: %s", szMessage ? szMessage : "NULL");
g_pLTServer->CPrint(" Sent from '%s', to '%s'", pSendName, pRecvName);
}
}
g_pLTServer->WriteToMessageDWord(hMessage, (uint32)g_pLTServer->GetStringData(hMsg));
g_pLTServer->EndMessage(hMessage);
}
}
示例11: 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();
}
示例12: RotateToRest
void CLipstickProx::RotateToRest()
{
CGrenade::RotateToRest();
/* Update 1.002
LTRotation rRot;
g_pLTServer->GetObjectRotation(m_hObject, &rRot);
// Okay, rotated based on the surface normal we're on...
g_pLTServer->AlignRotation(&rRot, &m_vSurfaceNormal, LTNULL);
g_pLTServer->SetObjectRotation(m_hObject, &rRot);
*/
// Arm the grenade after a few...
LTFLOAT fDelay = g_vtProxGrenadeArmDelay.GetFloat() < 0.0f ?
m_pClassData->fArmDelay : g_vtProxGrenadeArmDelay.GetFloat();
m_ArmTime.Start(fDelay);
}
示例13: UpdateBoundingBox
void GameBase::UpdateBoundingBox()
{
int nVal = (int)g_ShowDimsTrack.GetFloat();
if (nVal < 4)
{
switch (GetType())
{
case OT_WORLDMODEL :
{
if (nVal != 1)
{
RemoveBoundingBox();
return;
}
}
break;
case OT_MODEL :
{
if (nVal != 2)
{
RemoveBoundingBox();
return;
}
}
break;
case OT_NORMAL :
{
if (nVal != 3)
{
RemoveBoundingBox();
return;
}
}
break;
default :
break;
}
}
CreateBoundingBox();
if (m_hDimsBox)
{
LTVector vDims, vScale;
g_pLTServer->GetObjectDims(m_hObject, &vDims);
vScale = (vDims * 2.0);
g_pLTServer->ScaleObject(m_hDimsBox, &vScale);
}
}
示例14: PickedUp
void PickupItem::PickedUp(ILTMessage_Read *)
{
// Let the world know what happened...
PlayPickedupSound();
// Clear our player obj, we no longer need this link...
SetPlayerObj(LTNULL);
// If we're supposed to process a command, do it here...
if (m_hstrPickupCommand)
{
const char *pCmd = g_pLTServer->GetStringData( m_hstrPickupCommand );
if( g_pCmdMgr->IsValidCmd( pCmd ) )
{
g_pCmdMgr->Process( pCmd, m_hObject, m_hObject );
}
}
if (!m_bRespawn)
{
g_pLTServer->RemoveObject(m_hObject);
}
else
{
// Make the item invisible until the next update
g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, 0, FLAG_VISIBLE);
//if (m_bTouchPickup)
{
g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, 0, FLAG_TOUCH_NOTIFY);
}
// If we're activateable, turn of the relative flags...
if (m_bActivatePickup)
{
g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, 0, FLAG_RAYHIT);
g_pCommonLT->SetObjectFlags(m_hObject, OFT_User, 0, USRFLG_CAN_ACTIVATE);
}
SetNextUpdate(m_fRespawnDelay / g_RespawnScaleTrack.GetFloat(1.0f));
}
// Consider ourselves picked up.
m_bWasPickedUp = true;
}
示例15: Update
void CMusicMgr::Update()
{
if ( !m_bEnabled ) return;
if ( m_bLockedMood )
{
if ( m_bRestoreMusicIntensity )
{
char szMusic[128];
sprintf(szMusic, "MUSIC I %d measure", m_iRestoreMusicIntensity);
#ifndef _FINAL
if ( g_ShowMusicTrack.GetFloat() > 0 )
{
g_pLTServer->CPrint("Server sending client Music Message: (%s)", szMusic);
}
#endif
HSTRING hMusic = g_pLTServer->CreateString(szMusic);
CAutoMessage cMsg;
cMsg.Writeuint8(MID_MUSIC);
cMsg.WriteHString(hMusic);
g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
FREE_HSTRING(hMusic);
m_eLastMood = eMoodInvalid;
m_bRestoreMusicIntensity = LTFALSE;
}
return;
}
LTBOOL bChoseMood = LTFALSE;
for ( int32 iMood = kNumMoods-1 ; iMood >= 0 ; --iMood )
{
if ( !bChoseMood && (m_afMoods[iMood] != 0.0f || (iMood == eMoodNone)) )
{
if ( m_eLastMood == iMood )
{
bChoseMood = LTTRUE;
}
else
{
SetMood(( Mood )iMood );
bChoseMood = LTTRUE;
}
}
m_afMoods[iMood] = Max<LTFLOAT>(m_afMoods[iMood] - g_pLTServer->GetFrameTime(), 0.0f);
}
}