本文整理汇总了C++中CGameSettings::SpecialFXSetting方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameSettings::SpecialFXSetting方法的具体用法?C++ CGameSettings::SpecialFXSetting怎么用?C++ CGameSettings::SpecialFXSetting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameSettings
的用法示例。
在下文中一共展示了CGameSettings::SpecialFXSetting方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateLingeringSmoke
void CGibFX::CreateLingeringSmoke(int nIndex)
{
CSFXMgr* psfxMgr = g_pGameClientShell->GetSFXMgr();
if (!psfxMgr) return;
CGameSettings* pSettings = g_pInterfaceMgr->GetSettings();
if (!pSettings) return;
uint8 nDetailLevel = pSettings->SpecialFXSetting();
if (nDetailLevel == RS_LOW) return;
SMCREATESTRUCT sm;
char* pTexture = "Sprites\\SmokeTest.spr";
VEC_SET(sm.vColor1, 100.0f, 100.0f, 100.0f);
VEC_SET(sm.vColor2, 125.0f, 125.0f, 125.0f);
VEC_SET(sm.vMinDriftVel, -10.0f, 25.0f, -10.0f);
VEC_SET(sm.vMaxDriftVel, 10.0f, 50.0f, 10.0f);
LTFLOAT fVolumeRadius = 10.0f;
LTFLOAT fLifeTime = GetRandom(m_fLifeTime * 0.75f, m_fLifeTime);
LTFLOAT fRadius = 1500;
LTFLOAT fParticleCreateDelta = 0.1f;
LTFLOAT fMinParticleLife = 1.0f;
LTFLOAT fMaxParticleLife = 5.0f;
uint8 nNumParticles = 3;
LTBOOL bIgnoreWind = LTFALSE;
if (IsLiquid(m_eCode))
{
GetLiquidColorRange(m_eCode, &sm.vColor1, &sm.vColor2);
pTexture = DEFAULT_BUBBLE_TEXTURE;
fRadius = 750.0f;
bIgnoreWind = LTTRUE;
fMinParticleLife = 1.0f;
fMaxParticleLife = 1.5f;
}
sm.vPos = m_Emitters[nIndex].m_vPos;
sm.hServerObj = m_hGib[nIndex];
sm.fVolumeRadius = fVolumeRadius;
sm.fLifeTime = fLifeTime;
sm.fRadius = fRadius;
sm.fParticleCreateDelta = fParticleCreateDelta;
sm.fMinParticleLife = fMinParticleLife;
sm.fMaxParticleLife = fMaxParticleLife;
sm.nNumParticles = nNumParticles;
sm.bIgnoreWind = bIgnoreWind;
sm.hstrTexture = m_pClientDE->CreateString(pTexture);
psfxMgr->CreateSFX(SFX_SMOKE_ID, &sm);
m_pClientDE->FreeString(sm.hstrTexture);
}
示例2: CreateMiniBloodExplosion
void CGibFX::CreateMiniBloodExplosion(int nIndex)
{
// Add a mini blood explosion...
CSFXMgr* psfxMgr = g_pGameClientShell->GetSFXMgr();
if (!psfxMgr) return;
CGameSettings* pSettings = g_pInterfaceMgr->GetSettings();
if (!pSettings) return;
uint8 nDetailLevel = pSettings->SpecialFXSetting();
if (nDetailLevel == RS_LOW) return;
char* szBlood[2] = { "SpecialFX\\ParticleTextures\\Blood_1.dtx",
"SpecialFX\\ParticleTextures\\Blood_2.dtx" };
PARTICLESHOWERCREATESTRUCT ps;
ps.vPos = m_Emitters[nIndex].m_vPos;
ps.vPos.y += 30.0f;
ps.vDir.Init(0, 100, 0);
VEC_SET(ps.vColor1, 200.0f, 200.0f, 200.0f);
VEC_SET(ps.vColor2, 255.0f, 255.0f, 255.0f);
ps.pTexture = szBlood[GetRandom(0,1)];;
ps.nParticles = 50;
ps.fDuration = 1.0f;
ps.fEmissionRadius = 0.3f;
ps.fRadius = 800.0f;
ps.fGravity = PSFX_DEFAULT_GRAVITY;
if (IsLiquid(m_eCode))
{
ps.vDir *= 3.0f;
ps.fEmissionRadius = 0.2f;
ps.fRadius = 700.0f;
}
psfxMgr->CreateSFX(SFX_PARTICLESHOWER_ID, &ps);
// Play appropriate sound...
char* pSound = GetGibDieSound();
if (pSound)
{
g_pClientSoundMgr->PlaySoundFromPos(ps.vPos, pSound, 300.0f,
SOUNDPRIORITY_MISC_LOW);
}
}
示例3: CreateGibTrail
CSpecialFX* CGibFX::CreateGibTrail(HLOCALOBJ hObj)
{
if (!hObj || !m_pClientDE) return LTNULL;
CGameSettings* pSettings = g_pInterfaceMgr->GetSettings();
if (!pSettings) return LTNULL;
uint8 nDetailLevel = pSettings->SpecialFXSetting();
if (nDetailLevel == RS_LOW) return LTNULL;
PTCREATESTRUCT pt;
pt.hServerObj = hObj;
pt.nType = (uint8) (m_eModelType == eModelTypeHuman ? PT_BLOOD : PT_GIBSMOKE);
CSpecialFX* pSFX = debug_new(CParticleTrailFX);
if (!pSFX) return LTNULL;
pSFX->Init(&pt);
pSFX->CreateObject(m_pClientDE);
return pSFX;
}
示例4: CreateObject
LTBOOL CProjectileFX::CreateObject(ILTClient* pClientDE)
{
if (!CSpecialFX::CreateObject(pClientDE) || !m_hServerObject) return LTFALSE;
CGameSettings* pSettings = g_pInterfaceMgr->GetSettings();
if (!pSettings) return LTFALSE;
uint8 nDetailLevel = pSettings->SpecialFXSetting();
LTVector vPos;
LTRotation rRot;
g_pLTClient->GetObjectPos(m_hServerObject, &vPos);
g_pLTClient->GetObjectRotation(m_hServerObject, &rRot);
//m_pClientDE->CPrint("Client start pos (%.2f, %.2f, %.2f)", vPos.x, vPos.y, vPos.z);
//m_fStartTime = m_pClientDE->GetTime();
if (nDetailLevel != RS_LOW)
{
if (m_nFX & PFX_SMOKETRAIL)
{
CreateSmokeTrail(vPos, rRot);
}
if (m_nFX & PFX_LIGHT)
{
CreateLight(vPos, rRot);
}
}
if (m_nFX & PFX_FLARE)
{
CreateFlare(vPos, rRot);
}
if (m_nFX & PFX_FLYSOUND)
{
CreateFlyingSound(vPos, rRot);
}
// Do client-side projectiles in multiplayer games...
if ( g_pClientMultiplayerMgr->IsConnectedToRemoteServer( ))
{
// Set the velocity of the "server" object if it is really just a local
// object...
if (m_bLocal)
{
VEC_COPY(m_vFirePos, vPos);
m_fStartTime = m_pClientDE->GetTime();
LTVector vVel, vF;
vF = rRot.Forward();
m_vPath = vF;
// Special case of adjusting the projectile speed...
LTFLOAT fVel = (LTFLOAT) m_pProjectileFX->nVelocity;
if (m_bAltFire)
{
fVel = (LTFLOAT) m_pProjectileFX->nAltVelocity;
}
LTFLOAT fMultiplier = 1.0f;
if (m_pClientDE->GetSConValueFloat("MissileSpeed", fMultiplier) != LT_NOTFOUND)
{
fVel *= fMultiplier;
}
vVel = vF * fVel;
g_pPhysicsLT->SetVelocity(m_hServerObject, &vVel);
}
}
return LTTRUE;
}
示例5: CreateObject
LTBOOL CWeaponFX::CreateObject(ILTClient* pClientDE)
{
if (!CSpecialFX::CreateObject(pClientDE) || !g_pWeaponMgr) return LTFALSE;
CGameSettings* pSettings = g_pInterfaceMgr->GetSettings();
if (!pSettings) return LTFALSE;
// Set up our data members...
// Set the local client id...
uint32 dwId;
g_pLTClient->GetLocalClientID(&dwId);
m_nLocalId = (uint8)dwId;
m_nDetailLevel = pSettings->SpecialFXSetting();
// Fire pos may get tweaked a little...
m_vFirePos = CalcFirePos(m_vFirePos);
m_vDir = m_vPos - m_vFirePos;
m_fFireDistance = m_vDir.Mag();
m_vDir.Norm();
g_pLTClient->AlignRotation(&m_rSurfaceRot, &m_vSurfaceNormal, LTNULL);
g_pLTClient->AlignRotation(&m_rDirRot, &m_vDir, LTNULL);
SetupExitInfo();
// Calculate if the camera can see the fire position and the impact
// position...
g_bCanSeeImpactPos = LTTRUE;
g_bCanSeeFirePos = LTTRUE;
g_bDistantImpactPos = LTFALSE;
g_bDistantFirePos = LTFALSE;
if (g_vtWeaponFXUseFOVPerformance.GetFloat())
{
HOBJECT hCamera = g_pGameClientShell->GetCamera();
LTVector vCameraPos, vU, vR, vF, vDir;
LTRotation rCameraRot;
g_pLTClient->GetObjectPos(hCamera, &vCameraPos);
g_pLTClient->GetObjectRotation(hCamera, &rCameraRot);
g_pLTClient->GetRotationVectors(&rCameraRot, &vU, &vR, &vF);
vDir = m_vPos - vCameraPos;
LTFLOAT fImpactDist = vDir.Mag();
if (fImpactDist > g_vtWeaponFXMaxImpactDist.GetFloat())
{
g_bDistantImpactPos = LTTRUE;
}
vDir.Norm();
LTFLOAT fMul = VEC_DOT(vDir, vF);
g_bCanSeeImpactPos = (fMul < g_vtWeaponFXMinImpactDot.GetFloat() ? LTFALSE : LTTRUE);
// In multiplayer we need to account for impacts that occur around
// our camera that we didn't cause (this is also an issue in single
// player, but due to the singler player gameplay dynamics it isn't
// as noticeable)...
if (!g_bCanSeeImpactPos && IsMultiplayerGame())
{
// Somebody else shot this...if the impact is close enough, we
// "saw" it...
if (m_nLocalId != m_nShooterId && fImpactDist <= g_vtWeaponFXMaxMultiImpactDist.GetFloat())
{
g_bCanSeeImpactPos = LTTRUE;
}
}
vDir = m_vFirePos - vCameraPos;
if (vDir.Mag() > g_vtWeaponFXMaxFireDist.GetFloat())
{
g_bDistantFirePos = LTTRUE;
}
vDir.Norm();
fMul = VEC_DOT(vDir, vF);
g_bCanSeeFirePos = (fMul < g_vtWeaponFXMinFireDot.GetFloat() ? LTFALSE : LTTRUE);
}
// Determine what container the sfx is in...
HLOCALOBJ objList[1];
LTVector vTestPos = m_vPos + m_vSurfaceNormal; // Test a little closer...
uint32 dwNum = g_pLTClient->GetPointContainers(&vTestPos, objList, 1);
if (dwNum > 0 && objList[0])
//.........这里部分代码省略.........
示例6: Update
LTBOOL CParticleTrailSegmentFX::Update()
{
if (!m_hObject || !m_pClientDE) return LTFALSE;
if (!CBaseParticleSystemFX::Update()) return LTFALSE;
CGameSettings* pSettings = g_pInterfaceMgr->GetSettings();
if (!pSettings) return LTFALSE;
uint8 nDetailLevel = pSettings->SpecialFXSetting();
LTFLOAT fTime = m_pClientDE->GetTime();
if (m_bFirstUpdate)
{
if (!m_hServerObject) return LTFALSE;
m_bFirstUpdate = LTFALSE;
m_fStartTime = fTime;
m_fLastTime = fTime;
// Where is the server (moving) object...
LTVector vPos, vTemp;
m_pClientDE->GetObjectPos(m_hServerObject, &vPos);
// Current position is relative to the particle system's postion (i.e.,
// each puff of Particle is some distance away from the particle system's
/// position)...
m_pClientDE->GetObjectPos(m_hObject, &vTemp);
VEC_SUB(vPos, vPos, vTemp);
VEC_COPY(m_vLastPos, vPos);
}
// Check to see if we should just wait for last Particle puff to go away...
if (m_bWantRemove || (fTime > m_fStartTime + m_fFadeTime))
{
if (fTime > m_fLastTime + m_fLifeTime)
{
return LTFALSE;
}
LTFLOAT fScale = (m_fLifeTime - (fTime - m_fLastTime)) / m_fLifeTime;
LTFLOAT r, g, b, a;
m_pClientDE->GetObjectColor(m_hObject, &r, &g, &b, &a);
m_pClientDE->SetObjectColor(m_hObject, r, g, b, fScale);
return LTTRUE;
}
// See if it is time to create a new Particle puff...
if ((fTime > m_fLastTime + m_fOffsetTime) && m_hServerObject)
{
LTVector vCurPos, vPos, vDelta, vTemp, vDriftVel, vColor;
// Calculate Particle puff position...
// Where is the server (moving) object...
m_pClientDE->GetObjectPos(m_hServerObject, &vCurPos);
// Current position is relative to the particle system's postion (i.e.,
// each puff of Particle is some distance away from the particle system's
/// position)...
m_pClientDE->GetObjectPos(m_hObject, &vTemp);
VEC_SUB(vCurPos, vCurPos, vTemp);
// How long has it been since the last Particle puff?
LTFLOAT fTimeOffset = fTime - m_fLastTime;
// What is the range of colors?
LTFLOAT fRange = m_vColor2.x - m_vColor1.x;
// Fill the distance between the last projectile position, and it's
// current position with Particle puffs...
int nNumSteps = (m_fLastTime > 0) ? (((m_nType & PT_BLOOD) || (m_nType & PT_GIBSMOKE)) ? 20 : 5): 1;
if (nDetailLevel != RS_HIGH)
{
nNumSteps /= 2;
}
VEC_SUB(vTemp, vCurPos, m_vLastPos);
VEC_MULSCALAR(vDelta, vTemp, 1.0f/float(nNumSteps));
//.........这里部分代码省略.........
示例7: Update
LTBOOL CPolyGridFX::Update()
{
if(!m_hObject || !m_pClientDE || !m_hServerObject)
return LTFALSE;
if(m_bWantRemove)
return LTFALSE;
// Set the flags of the polygrid based on the the server object...
uint32 dwServerFlags;
g_pCommonLT->GetObjectFlags(m_hServerObject, OFT_Flags, dwServerFlags);
if (dwServerFlags & FLAG_VISIBLE)
{
g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, FLAG_VISIBLE, FLAG_VISIBLE);
}
else // We're hidden, no need to update...
{
g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, 0, FLAG_VISIBLE);
return LTTRUE;
}
// Don't update if not drawn :)
uint32 dwFlags;
g_pCommonLT->GetObjectFlags(m_hObject, OFT_Flags, dwFlags);
if (!(dwFlags & FLAG_WASDRAWN) && !m_bAlwaysUpdate)
{
return LTTRUE;
}
// Update the position of the polygrid to reflect the position of the
// server object...
LTVector vPos;
g_pLTClient->GetObjectPos(m_hServerObject, &vPos);
g_pLTClient->SetObjectPos(m_hObject, &vPos);
// If we're not using polygrids (or special fx are set to the lowest
// detail setting), don't update...
if (m_bUseGlobalSettings)
{
CGameSettings* pSettings = g_pInterfaceMgr->GetSettings();
if (!pSettings) return LTTRUE;
uint8 nVal = pSettings->SpecialFXSetting();
LTBOOL bOn = pSettings->PolyGrids();
if (!bOn || nVal == RS_LOW)
{
return LTTRUE;
}
}
//if we are paused we shouldn't bother updating
if(g_pGameClientShell->IsServerPaused())
{
g_pLTClient->Common()->SetObjectFlags(m_hObject, OFT_Flags, FLAG_PAUSED, FLAG_PAUSED);
return LTTRUE;
}
else
{
g_pLTClient->Common()->SetObjectFlags(m_hObject, OFT_Flags, 0, FLAG_PAUSED);
}
// Update the plasma based on the type of plasma...
switch (m_nSurfaceType)
{
case PGSURFACE_PLASMA_FOUR_RING :
UpdateFourRingPlasma();
break;
case PGSURFACE_PLASMA_NORMAL:
UpdatePlasma();
break;
case PGSURFACE_WAVE_PROP:
UpdateWaveProp(g_pGameClientShell->GetFrameTime());
break;
default :
//default surface...
UpdatePlasma();
break;
}
if( m_sSurfaceSprite.size( ))
{
UpdateSurface();
//.........这里部分代码省略.........
示例8: CreateObject
LTBOOL CProjectileFX::CreateObject(ILTClient* pClientDE)
{
if (!CSpecialFX::CreateObject(pClientDE) || !m_hServerObject) return LTFALSE;
CGameSettings* pSettings = g_pInterfaceMgr->GetSettings();
if (!pSettings) return LTFALSE;
uint8 nDetailLevel = pSettings->SpecialFXSetting();
LTVector vPos;
LTRotation rRot;
m_pClientDE->GetObjectPos(m_hServerObject, &vPos);
m_pClientDE->GetObjectRotation(m_hServerObject, &rRot);
if (nDetailLevel != RS_LOW)
{
if (m_nFX & PFX_SMOKETRAIL)
{
CreateSmokeTrail(vPos, rRot);
}
if (m_nFX & PFX_LIGHT)
{
CreateLight(vPos, rRot);
}
}
if (m_nFX & PFX_FLARE)
{
CreateFlare(vPos, rRot);
}
if (m_nFX & PFX_FLYSOUND)
{
CreateFlyingSound(vPos, rRot);
}
// Do client-side projectiles in multiplayer games...
if (g_pGameClientShell->IsMultiplayerGame())
{
// Set the velocity of the "server" object if it is really just a local
// object...
if (m_bLocal)
{
VEC_COPY(m_vFirePos, vPos);
m_fStartTime = m_pClientDE->GetTime();
LTVector vVel, vU, vR, vF;
m_pClientDE->GetRotationVectors(&rRot, &vU, &vR, &vF);
VEC_COPY(m_vPath, vF);
// Special case of adjusting the projectile speed...
LTFLOAT fVel = (LTFLOAT) m_pProjectileFX->nVelocity;
if (m_bAltFire)
{
fVel = (LTFLOAT) m_pProjectileFX->nAltVelocity;
}
LTFLOAT fMultiplier = 1.0f;
if (m_pClientDE->GetSConValueFloat("MissileSpeed", fMultiplier) != LT_NOTFOUND)
{
fVel *= fMultiplier;
}
VEC_MULSCALAR(vVel, vF, fVel);
m_pClientDE->Physics()->SetVelocity(m_hServerObject, &vVel);
}
}
return LTTRUE;
}