本文整理汇总了C++中CVarTrack::GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ CVarTrack::GetFloat方法的具体用法?C++ CVarTrack::GetFloat怎么用?C++ CVarTrack::GetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVarTrack
的用法示例。
在下文中一共展示了CVarTrack::GetFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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());
}
示例6: 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);
}
示例7: 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;
}
示例8: 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);
}
}
示例9: 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;
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: ObjectMessageFn
uint32 Intelligence::ObjectMessageFn(HOBJECT hSender, uint32 messageID, HMESSAGEREAD hRead)
{
if (!g_pLTServer) return 0;
switch(messageID)
{
case MID_TRIGGER:
{
const char* szMsg = (const char*)g_pLTServer->ReadFromMessageDWord(hRead);
// ConParse does not destroy szMsg, so this is safe
ConParse parse;
parse.Init((char*)szMsg);
while (g_pLTServer->Common()->Parse(&parse) == LT_OK)
{
if (parse.m_nArgs > 0 && parse.m_Args[0])
{
if (_stricmp(parse.m_Args[0], s_szActivate) == 0)
{
if (!m_bPhotoOnly)
{
DoActivate(hSender);
}
}
else if (_stricmp(parse.m_Args[0], s_szGadget) == 0)
{
if (m_bPhotoOnly)
{
HandleGadgetMsg(hSender, parse);
}
}
else if (_stricmp(parse.m_Args[0], s_szRespawn) == 0)
{
SetNextUpdate( m_fRespawnDelay / g_IntelRespawnScale.GetFloat(1.0f));
}
}
}
}
break;
default : break;
}
return Prop::ObjectMessageFn(hSender, messageID, hRead);
}
示例13: EndTimingCounter
void EndTimingCounter(char *msg, ...)
{
if (!g_pLTServer || g_ShowTimingTrack.GetFloat() < 1.0f) return;
uint32 dwTicks = g_pLTServer->EndCounter(&s_counter);
// parse the message
char pMsg[256];
va_list marker;
va_start(marker, msg);
int nSuccess = vsprintf(pMsg, msg, marker);
va_end(marker);
if (nSuccess < 0) return;
g_pLTServer->CPrint("%s : %d ticks", pMsg, dwTicks);
}
示例14: SetMood
bool CMusicMgr::SetMood( Mood eMood )
{
char szMusic[128];
uint32 iLevel = GetRandom(0, m_acMoods[eMood]-1);
sprintf(szMusic, "MUSIC I %d measure", m_aanMoods[eMood][iLevel]);
#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 = eMood;
return true;
}
示例15: GetDifficultyFactor
LTFLOAT GetDifficultyFactor()
{
if (!g_pGameServerShell) return g_vtDifficultyFactorHard.GetFloat();
float fPlayerMod = 0.0f;
uint32 nPlayersInGame = CPlayerObj::GetNumberPlayersWithClients( );
if( nPlayersInGame > 1 )
{
// Increase the difficulty by an amount per player. The
// difficulty grows logrithmically. 2 players will add 100% of
// fPlayerInc. 3 players adds ~150%. 4 Players adds 200%.
float fPlayerInc = g_vtDifficultyFactorPlayerIncrease.GetFloat();
fPlayerMod = fPlayerInc * logf(( float )nPlayersInGame ) / logf( 2.0f );
}
switch (g_pGameServerShell->GetDifficulty())
{
case GD_EASY:
return g_vtDifficultyFactorEasy.GetFloat() + fPlayerMod;
break;
case GD_NORMAL:
return g_vtDifficultyFactorNormal.GetFloat() + fPlayerMod;
break;
case GD_VERYHARD:
return g_vtDifficultyFactorVeryHard.GetFloat() + fPlayerMod;
break;
case GD_HARD:
default :
return g_vtDifficultyFactorHard.GetFloat() + fPlayerMod;
break;
}
}