bool CPerformanceTest::Start(uint32 nMin /*=kDefaultMin*/, uint32 nMax /*=kDefaultMax*/) { Reset(); if (nMin < nMax) { m_nMinTestFPS = nMin; m_nMaxTestFPS = nMax; } else { return false; } if (!g_vtPerformanceSmoothFPSTime.IsInitted()) { g_vtPerformanceSmoothFPSTime.Init(g_pLTClient, "PerformanceFPSSmoothTime", NULL, 0.5f); } if (!g_vtPerformanceMinSampleFPS.IsInitted()) { g_vtPerformanceMinSampleFPS.Init(g_pLTClient, "PerformanceMinSampleFrameRate", NULL, 0.00001f); } if (!g_vtPerformanceMaxSampleFPS.IsInitted()) { g_vtPerformanceMaxSampleFPS.Init(g_pLTClient, "PerformanceMaxSampleFrameRate", NULL, 1.0f); } if (!g_vtPerformanceThrowAwaySamples.IsInitted()) { g_vtPerformanceThrowAwaySamples.Init(g_pLTClient, "PerformanceThrowAwaySamples", NULL, 5.0f); } return true; }
LTBOOL CSnowFX::Init( SFXCREATESTRUCT* psfxCreateStruct ) { if( !psfxCreateStruct ) return LTFALSE; CSpecialFX::Init( psfxCreateStruct ); SNOWCREATESTRUCT* cs = (SNOWCREATESTRUCT*)psfxCreateStruct; m_vDims = cs->vDims; m_fDensity = cs->fDensity; m_fParticleRadius = cs->fParticleRadius * 2.0f; m_fFallRate = cs->fFallRate; m_fTumbleRate = cs->fTumbleRate / 360.0f; m_fTumbleRadius = cs->fTumbleRadius; m_fMaxDrawDist = cs->fMaxDrawDist; m_fMaxDrawDistSq = m_fMaxDrawDist * m_fMaxDrawDist; m_vAmbientColor = cs->vAmbientColor; m_nAmbientColor = (uint32(m_vAmbientColor.x) & 0xff) << 16; m_nAmbientColor |= (uint32(m_vAmbientColor.y) & 0xff) << 8; m_nAmbientColor |= (uint32(m_vAmbientColor.z) & 0xff); m_bUseLighting = cs->bUseLighting; m_bUseSaturate = cs->bUseSaturate; m_hstrTextureName = cs->hstrTextureName; // setup console variables if( !g_cvarSnowEnable.IsInitted() ) g_cvarSnowEnable.Init( g_pLTClient, "SnowEnable", LTNULL, 1.0f ); if( !g_cvarSnowDensityScale.IsInitted() ) g_cvarSnowDensityScale.Init( g_pLTClient, "SnowDensityScale", LTNULL, 1.0f ); if( !g_cvarSnowParticleScale.IsInitted() ) g_cvarSnowParticleScale.Init( g_pLTClient, "SnowParticleScale", LTNULL, 1.0f ); return LTTRUE; }
LTBOOL CNodeController::Init(CCharacterFX* pCharacterFX) { _ASSERT(pCharacterFX); if ( !pCharacterFX ) return LTFALSE; if (!g_vtLipSyncMaxRot.IsInitted()) { g_vtLipSyncMaxRot.Init(g_pLTClient, "LipSyncMaxRot", NULL, 25.0f); } if (!g_vtLipSyncFreq.IsInitted()) { g_vtLipSyncFreq.Init(g_pLTClient, "LipSyncFreq", NULL, 20.0f); } // Store our backpointer m_pCharacterFX = pCharacterFX; // Map all the nodes in our skeleton in the bute file to the nodes in the actual .abc model file int iNode = 0; HMODELNODE hCurNode = INVALID_MODEL_NODE; while ( g_pLTClient->GetNextModelNode(GetCFX()->GetServerObj(), hCurNode, &hCurNode) == LT_OK) { _ASSERT(m_cNodes < MAX_NODES); char szName[64] = ""; g_pLTClient->GetModelNodeName(GetCFX()->GetServerObj(), hCurNode, szName, 64); ModelNode eModelNode = g_pModelButeMgr->GetSkeletonNode(m_pCharacterFX->GetModelSkeleton(), szName); if ( eModelNode != eModelNodeInvalid ) { m_aNodes[eModelNode].eModelNode = eModelNode; m_aNodes[eModelNode].hModelNode = hCurNode; } m_cNodes++; } // Find our "rotor" nodes int cNodes = g_pModelButeMgr->GetSkeletonNumNodes(m_pCharacterFX->GetModelSkeleton()); for ( iNode = 0 ; iNode < cNodes ; iNode++ ) { if ( NODEFLAG_ROTOR & g_pModelButeMgr->GetSkeletonNodeFlags(m_pCharacterFX->GetModelSkeleton(), (ModelNode)iNode) ) { AddNodeControlRotationTimed((ModelNode)iNode, LTVector(0,1,0), 40000.0f, 20000.0f); } } return LTTRUE; }
LTBOOL CDynamicLightFX::CreateObject(ILTClient *pClientDE) { if (!CSpecialFX::CreateObject(pClientDE)) return LTFALSE; if (!g_vtDLightOffsetX.IsInitted()) { g_vtDLightOffsetX.Init(pClientDE, "DLightOffsetX", "", 0.0f); } if (!g_vtDLightOffsetY.IsInitted()) { g_vtDLightOffsetY.Init(pClientDE, "DLightOffsetY", "", 0.0f); } if (!g_vtDLightOffsetZ.IsInitted()) { g_vtDLightOffsetZ.Init(pClientDE, "DLightOffsetZ", "", 0.0f); } // Allow create object to be called to re-init object... if (m_hObject) { g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, m_dwFlags, FLAGMASK_ALL); m_pClientDE->SetObjectPos(m_hObject, &m_vPos); } else { ObjectCreateStruct createStruct; INIT_OBJECTCREATESTRUCT(createStruct); createStruct.m_ObjectType = OT_LIGHT; createStruct.m_Flags = m_dwFlags; createStruct.m_Pos = m_vPos; // TESTING FOR MUZZLE FLASH!!!! createStruct.m_Pos.x += g_vtDLightOffsetX.GetFloat(); createStruct.m_Pos.y += g_vtDLightOffsetY.GetFloat(); createStruct.m_Pos.z += g_vtDLightOffsetZ.GetFloat(); // TESTING!!!! m_hObject = m_pClientDE->CreateObject(&createStruct); if (!m_hObject) return LTFALSE; } m_pClientDE->SetLightColor(m_hObject, m_vColor.x, m_vColor.y, m_vColor.z); m_pClientDE->SetLightRadius(m_hObject, m_fMinRadius); m_fStartTime = m_pClientDE->GetTime(); return LTTRUE; }
LTBOOL CTracerFX::Init(SFXCREATESTRUCT* psfxCreateStruct) { if (!CSpecialFX::Init(psfxCreateStruct)) return LTFALSE; TRCREATESTRUCT* pTR = (TRCREATESTRUCT*)psfxCreateStruct; m_cs = *pTR; if (!m_cs.pTracerFX) return LTFALSE; m_vDir = m_cs.vEndPos - m_cs.vStartPos; m_fDist = m_vDir.Mag(); m_vDir.Norm(); if (!g_cvarTracerSegments.IsInitted()) { g_cvarTracerSegments.Init(g_pLTClient, "TracerSegments", NULL, 1.0f); } if (!g_cvarTracerLifetime.IsInitted()) { g_cvarTracerLifetime.Init(g_pLTClient, "TracerLifetime", NULL, 0.2f); } if (!g_cvarTracerVelocity.IsInitted()) { g_cvarTracerVelocity.Init(g_pLTClient, "TracerVeloctity", NULL, -1.0f); } if (g_cvarTracerVelocity.GetFloat() > 0.0f) { m_fVelocity = g_cvarTracerVelocity.GetFloat(); } else { m_fVelocity = m_cs.pTracerFX->fVelocity; } // Calculate life time... if (m_fVelocity > 0.0f) { m_fLifetime = m_fDist / m_fVelocity; } else { return LTFALSE; } return LTTRUE; }
LTBOOL CPolygonDebrisFX::Init(SFXCREATESTRUCT* psfxCreateStruct) { if (!psfxCreateStruct) return LTFALSE; m_cs = *(POLYDEBRISCREATESTRUCT*)psfxCreateStruct; DEBRISCREATESTRUCT debris; g_pLTClient->AlignRotation(&(debris.rRot), &m_cs.vNormal, LTNULL); debris.vPos = m_cs.vPos + (m_cs.vDir * m_cs.PolyDebrisFX.fDirOffset); debris.vMinVel = m_cs.PolyDebrisFX.vMinVel; debris.vMaxVel = m_cs.PolyDebrisFX.vMaxVel; debris.fMinLifeTime = m_cs.PolyDebrisFX.fMinDuration; debris.fMaxLifeTime = m_cs.PolyDebrisFX.fMaxDuration; debris.nNumDebris = GetRandom(m_cs.PolyDebrisFX.nMinDebris, m_cs.PolyDebrisFX.nMaxDebris); debris.nMinBounce = m_cs.PolyDebrisFX.nMinBounce; debris.nMaxBounce = m_cs.PolyDebrisFX.nMaxBounce; debris.fGravityScale = m_cs.PolyDebrisFX.fGravityScale; debris.vMinDOffset = m_cs.PolyDebrisFX.vMinDOffset; debris.vMaxDOffset = m_cs.PolyDebrisFX.vMaxDOffset; debris.bDirOffsetOnly = m_cs.PolyDebrisFX.bDirOffsetOnly; if (!CDebrisFX::Init(&debris)) return LTFALSE; // Too expensive to have poly debris bouncing... m_ds.bBounce = LTFALSE; if (!g_cvarPolyDebrisTrailTime.IsInitted()) { g_cvarPolyDebrisTrailTime.Init(g_pLTClient, "PolyDebrisTrailTime", LTNULL, 0.25f); } if (!g_cvarPolyDebrisScaleDist.IsInitted()) { g_cvarPolyDebrisScaleDist.Init(g_pLTClient, "PolyDebrisScaleDist", LTNULL, 150.0f); } if (!g_cvarPolyDebrisMinDistScale.IsInitted()) { g_cvarPolyDebrisMinDistScale.Init(g_pLTClient, "PolyDebrisMinDistScale", LTNULL, 1.0f); } if (!g_cvarPolyDebrisMaxDistScale.IsInitted()) { g_cvarPolyDebrisMaxDistScale.Init(g_pLTClient, "PolyDebrisMaxDistScale", LTNULL, 1.0f); } return LTTRUE; }
LTBOOL CScatterFX::Init( SFXCREATESTRUCT* psfxCreateStruct ) { if( !psfxCreateStruct ) return LTFALSE; CSpecialFX::Init( psfxCreateStruct ); SCATTERCREATESTRUCT* cs = (SCATTERCREATESTRUCT*)psfxCreateStruct; m_vDims = cs->vDims; m_nBlindDataIndex = cs->nBlindDataIndex; m_fWidth = cs->fWidth * 0.5f; m_fHeight = cs->fHeight; m_fMaxScale = cs->fMaxScale; m_fTilt = cs->fTilt; m_fWaveRate = cs->fWaveRate; m_fWaveDist = cs->fWaveDist; m_fMaxDrawDist = cs->fMaxDrawDist; m_fMaxDrawDistSq = m_fMaxDrawDist * m_fMaxDrawDist; m_hstrTextureName = cs->hstrTextureName; m_bUseSaturate = cs->bUseSaturate; LTVector pos; g_pLTClient->GetObjectPos( m_hServerObject, &pos ); AdjustBounds( pos, m_vDims ); // setup console variables if( !g_cvarScatterEnable.IsInitted() ) g_cvarScatterEnable.Init( g_pLTClient, "ScatterEnable", LTNULL, 1.0f ); return LTTRUE; }
LTBOOL CMineFX::CreateObject(ILTClient* pClientDE) { if (!CSpecialFX::CreateObject(pClientDE) || !m_hServerObject) return LTFALSE; if (!g_vtMineShit.IsInitted()) { g_vtMineShit.Init(g_pLTClient, "MineShit", NULL, 0.01f); } return LTTRUE; }
LTBOOL CMuzzleFlashFX::CreateObject(ILTClient *pClientDE) { if (!pClientDE || !CSpecialFX::CreateObject(pClientDE)) return LTFALSE; if (!g_vtReallyClose.IsInitted()) { g_vtReallyClose.Init(pClientDE, "MFReallyClose", NULL, 1.0f); } return ResetFX(); }
void CTargetMgr::FirstUpdate() { if (!g_vtActivationDistance.IsInitted()) { float f = g_pClientButeMgr->GetInterfaceAttributeFloat("ActivationDistance",100.0f); g_vtActivationDistance.Init(g_pLTClient, "ActivationDistance", LTNULL, f); } if (!g_vtReviveDistance.IsInitted()) { float f = g_pClientButeMgr->GetInterfaceAttributeFloat("ReviveDistance",200.0f); g_vtReviveDistance.Init(g_pLTClient, "ReviveDistance", LTNULL, f); } if( !g_vtTargetDistance.IsInitted() ) { float f = g_pClientButeMgr->GetInterfaceAttributeFloat("TargetDistance",1000.0f); g_vtTargetDistance.Init(g_pLTClient, "TargetDistance", LTNULL, f); } }
//called to initialize a group and create the appropriate objects bool CParticleSystemGroup::Init(IClientFXMgr* pFxMgr, HMATERIAL hMaterial, const LTRigidTransform& tObjTrans, bool* pVisibleFlag, const CParticleSystemProps* pProps) { //make sure our console variable is initialized if(!g_vtParticleBounceScale.IsInitted()) g_vtParticleBounceScale.Init(g_pLTClient, "ParticleBounceScale", NULL, 1.0f); //make sure we are in a valid state Term(); ObjectCreateStruct ocs; // Create Particle System ocs.m_ObjectType = OT_CUSTOMRENDER; ocs.m_Flags |= FLAG_VISIBLE; if(!pProps->m_bSolid) ocs.m_Flags2 |= FLAG2_FORCETRANSLUCENT; if(!pProps->m_bTranslucentLight) ocs.m_Flags |= FLAG_NOLIGHT; //setup whether or not it is in the sky ocs.m_Flags2 |= GetSkyFlags(pProps->m_eInSky); ocs.m_Pos = tObjTrans.m_vPos; ocs.m_Rotation = tObjTrans.m_rRot; m_hCustomRender = g_pLTClient->CreateObject( &ocs ); if( !m_hCustomRender ) return false; //setup our rendering layer if(pProps->m_bPlayerView) g_pLTClient->GetRenderer()->SetObjectDepthBiasTableIndex(m_hCustomRender, eRenderLayer_Player); LTVector vTempBBox(1.0f, 1.0f, 1.0f); g_pLTClient->GetCustomRender()->SetRenderingSpace(m_hCustomRender, pProps->m_bObjectSpace ? eRenderSpace_Object : eRenderSpace_World); g_pLTClient->GetCustomRender()->SetVisBoundingBox(m_hCustomRender, -vTempBBox, vTempBBox); g_pLTClient->GetCustomRender()->SetRenderCallback(m_hCustomRender, CustomRenderCallback); g_pLTClient->GetCustomRender()->SetCallbackUserData(m_hCustomRender, this); //assign the material to the object g_pLTClient->GetCustomRender()->SetMaterial(m_hCustomRender, hMaterial); //and save our other values passed in m_pProps = pProps; m_pFxMgr = pFxMgr; m_pVisibleFlag = pVisibleFlag; //success return true; }
bool CClientFXMgr::Init(ILTClient *pClientDE, EngineTimer& timer ) { m_pClientDE = pClientDE; //setup our console variable if it isn't already if(!g_vtClientFXDetailLevel.IsInitted()) g_vtClientFXDetailLevel.Init(pClientDE, "ClientFXDetailLevel", NULL, 2.0f); // This is the timer we will use with all calculations. Since // there can be multiple clientfxmgr's, we take it from our "mgr". m_Timer = timer; return true; }
bool CHUDSubtitles::Init() { g_pLTClient->RegisterConsoleProgram("TestSubtitle", TestSubtitleFn); if (!g_vtAdjustedRadius.IsInitted()) { g_vtAdjustedRadius.Init(g_pLTClient, "SubtitleSoundRadiusPercent", NULL, 0.77f); } UpdateLayout(); return true; }
bool Init() { // Only truly initialize on the first volumetric light ++m_nRefCount; if (m_nRefCount > 1) return true; // Setup any console variables if (!g_cvarEnableVolumetricLight.IsInitted()) { g_cvarEnableVolumetricLight.Init(g_pLTClient, "EnableVolumetricLight", NULL, 1.0f); g_cvarVolumetricLightSlices.Init(g_pLTClient, "VolumetricLightSlices", NULL, DEFAULT_SLICES); g_cvarVolumetricLightSliceRes.Init(g_pLTClient, "VolumetricLightSliceRes", NULL, 320.0f); g_cvarVolumetricLightShadow.Init(g_pLTClient, "VolumetricLightShadow", NULL, 1.0f); g_cvarVolumetricLightShadowRes.Init(g_pLTClient, "VolumetricLightShadowSize", NULL, 128.0f); g_cvarVolumetricLightNoise.Init(g_pLTClient, "VolumetricLightNoise", NULL, 1.0f); g_cvarVolumetricLightFloat.Init(g_pLTClient, "VolumetricLightFloat", NULL, 1.0f); } if (!DATABASE_CATEGORY(VolumetricLight).Init()) { Term(); return false; } if (!CreateVertexDecl()) { Term(); return false; } if (!CreateMaterials()) { Term(); return false; } if (!CreateShellIB()) { Term(); return false; } return true; }
bool CCharacterHitBox::Init(HOBJECT hModel, IHitBoxUser* pUser) { AIASSERT( pUser, m_hObject, "CharacterHitBox Inited with non existant IHitBoxUser" ); AIASSERT( hModel, m_hObject, "CharacterHitBox Inited with non existant hObject" ); AIASSERT( m_hObject, m_hObject, "CharacterHitBox does not exist" ); AIASSERT( pUser, m_hObject, "" ); AIASSERT( dynamic_cast<IHitBoxUser*>(g_pLTServer->HandleToObject(hModel)) == pUser, hModel, "Passed in hModel and pUser should reference the same class -- HandleToObject(hModel) should return what pUser points to" ); m_hModel = hModel; m_pHitBoxUser = pUser; // Set my flags... g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, FLAG_RAYHIT | FLAG_TOUCHABLE, FLAGMASK_ALL); g_pCommonLT->SetObjectFlags( m_hObject, OFT_User, USRFLG_HITBOX | USRFLG_CHARACTER, USRFLG_HITBOX | USRFLG_CHARACTER ); // Set our user flags to USRFLG_CHARACTER, so the client will process // us like a character (for intersect segments)... g_pCommonLT->SetObjectFlags(m_hObject, OFT_User, USRFLG_CHARACTER, USRFLG_CHARACTER); if (!g_vtShowNodeRadii.IsInitted()) { g_vtShowNodeRadii.Init(g_pLTServer, "HitBoxShowNodeRadii", NULL, 0.0f); } if (!g_vtNodeRadiusUseOverride.IsInitted()) { g_vtNodeRadiusUseOverride.Init(g_pLTServer, "HitBoxNodeRadiusOverride", NULL, 0.0f); } if (!g_vtHeadNodeRadius.IsInitted()) { g_vtHeadNodeRadius.Init(g_pLTServer, "HitBoxHeadNodeRadius", NULL, HB_DEFAULT_NODE_RADIUS); } if (!g_vtTorsoNodeRadius.IsInitted()) { g_vtTorsoNodeRadius.Init(g_pLTServer, "HitBoxTorsoNodeRadius", NULL, HB_DEFAULT_NODE_RADIUS); } if (!g_vtArmNodeRadius.IsInitted()) { g_vtArmNodeRadius.Init(g_pLTServer, "HitBoxArmNodeRadius", NULL, HB_DEFAULT_NODE_RADIUS); } if (!g_vtLegNodeRadius.IsInitted()) { g_vtLegNodeRadius.Init(g_pLTServer, "HitBoxLegNodeRadius", NULL, HB_DEFAULT_NODE_RADIUS); } if (!g_HitDebugTrack.IsInitted()) { g_HitDebugTrack.Init(g_pLTServer, "HitDebug", NULL, 0.0f); } if (!g_vtShowPlayerNodeRadii.IsInitted()) { g_vtShowPlayerNodeRadii.Init(g_pLTServer, "HitBoxShowPlayerNodeRadii", NULL, 0.0f); } SetNextUpdate(UPDATE_NEVER); return true; }
LTBOOL CShellCasingFX::Init(SFXCREATESTRUCT* psfxCreateStruct) { if (!psfxCreateStruct) return LTFALSE; CSpecialFX::Init(psfxCreateStruct); SHELLCREATESTRUCT* pShell = (SHELLCREATESTRUCT*)psfxCreateStruct; m_rRot = pShell->rRot; m_vStartPos = pShell->vStartPos; m_nWeaponId = pShell->nWeaponId; m_nAmmoId = pShell->nAmmoId; m_dwFlags |= pShell->dwFlags; m_vStartVel = pShell->vStartVel; m_b3rdPerson = pShell->b3rdPerson; m_vInitialScale.Init(1.0f, 1.0f, 1.0f); m_vFinalScale.Init(1.0f, 1.0f, 1.0f); if (!g_vtShellMaxBounceCountTrack.IsInitted()) { g_vtShellMaxBounceCountTrack.Init(g_pLTClient, "ShellMaxBounceCount", NULL, 3.0); } if (!g_vtShellMinUpVelocity.IsInitted()) { g_vtShellMinUpVelocity.Init(g_pLTClient, "ShellMinUpVelocity", NULL, 30.0f); } if (!g_vtShellMaxUpVelocity.IsInitted()) { g_vtShellMaxUpVelocity.Init(g_pLTClient, "ShellMaxUpVelocity", NULL, 75.0f); } if (!g_vtShellMinRightVelocity.IsInitted()) { g_vtShellMinRightVelocity.Init(g_pLTClient, "ShellMinRightVelocity", NULL, 50.0f); } if (!g_vtShellMaxRightVelocity.IsInitted()) { g_vtShellMaxRightVelocity.Init(g_pLTClient, "ShellMaxRightVelocity", NULL, 75.0f); } if (!g_vtShellMinForwardVelocity.IsInitted()) { g_vtShellMinForwardVelocity.Init(g_pLTClient, "ShellMinForwardVelocity", NULL, 20.0f); } if (!g_vtShellMaxForwardVelocity.IsInitted()) { g_vtShellMaxForwardVelocity.Init(g_pLTClient, "ShellMaxForwardVelocity", NULL, 50.0f); } if (!g_vtShellMinLifetime.IsInitted()) { g_vtShellMinLifetime.Init(g_pLTClient, "ShellMinLifetime", NULL, 10.0f); } if (!g_vtShellMaxLifetime.IsInitted()) { g_vtShellMaxLifetime.Init(g_pLTClient, "ShellMaxLifetime", NULL, 15.0f); } if (!g_vtShellScaleTime.IsInitted()) { g_vtShellScaleTime.Init(g_pLTClient, "ShellScaleTime", NULL, 0.5f); } if (!g_vtShellMaxScale.IsInitted()) { g_vtShellMaxScale.Init(g_pLTClient, "ShellMaxScale", NULL, 2.0f); } if (!g_vtShellMinSpinsPerSecond.IsInitted()) { g_vtShellMinSpinsPerSecond.Init(g_pLTClient, "ShellMinSpinsPerSecond", NULL, 2.0f); } if (!g_vtShellMaxSpinsPerSecond.IsInitted()) { g_vtShellMaxSpinsPerSecond.Init(g_pLTClient, "ShellMaxSpinsPerSecond", NULL, 10.0f); } m_nBounceCount = (int)g_vtShellMaxBounceCountTrack.GetFloat(); return LTTRUE; }
void PlayWeaponSound(WEAPON *pWeapon, LTVector vPos, PlayerSoundId eSoundId, LTBOOL bLocal) { if (!pWeapon) return; if (!s_cvarFirePitchShift.IsInitted()) { s_cvarFirePitchShift.Init(g_pLTClient, "PitchShiftFire", NULL, -1.0f); } char* pSnd = LTNULL; LTFLOAT fRadius = WEAPON_SOUND_RADIUS; switch (eSoundId) { case PSI_FIRE: { pSnd = pWeapon->szFireSound; fRadius = (LTFLOAT) pWeapon->nFireSoundRadius; } break; case PSI_ALT_FIRE: { pSnd = pWeapon->szAltFireSound; fRadius = (LTFLOAT) pWeapon->nFireSoundRadius; } break; case PSI_SILENCED_FIRE: { pSnd = pWeapon->szSilencedFireSound; fRadius = (LTFLOAT) pWeapon->nFireSoundRadius; } break; case PSI_DRY_FIRE: { pSnd = pWeapon->szDryFireSound; fRadius = (LTFLOAT) pWeapon->nFireSoundRadius; } break; case PSI_RELOAD: case PSI_RELOAD2: case PSI_RELOAD3: { pSnd = pWeapon->szReloadSounds[eSoundId - PSI_RELOAD]; } break; case PSI_SELECT: { pSnd = pWeapon->szSelectSound; } break; case PSI_DESELECT: { pSnd = pWeapon->szDeselectSound; } break; case PSI_INVALID: default : break; } if (pSnd && pSnd[0]) { uint32 dwFlags = 0; float fPitchShift = 1.0f; if (s_cvarFirePitchShift.GetFloat() > 0.0f) { dwFlags |= PLAYSOUND_CTRL_PITCH; fPitchShift = s_cvarFirePitchShift.GetFloat(); } if (bLocal) { g_pClientSoundMgr->PlaySoundLocal(pSnd, SOUNDPRIORITY_PLAYER_HIGH, dwFlags, SMGR_DEFAULT_VOLUME, fPitchShift); } else { g_pClientSoundMgr->PlaySoundFromPos(vPos, pSnd, fRadius, SOUNDPRIORITY_PLAYER_HIGH, dwFlags, SMGR_DEFAULT_VOLUME, fPitchShift); } } }
LTBOOL CWeaponFX::Init(SFXCREATESTRUCT* psfxCreateStruct) { if (!CSpecialFX::Init(psfxCreateStruct)) return LTFALSE; WCREATESTRUCT* pCS = (WCREATESTRUCT*)psfxCreateStruct; m_nWeaponId = pCS->nWeaponId; m_nAmmoId = pCS->nAmmoId; m_eSurfaceType = (SurfaceType)pCS->nSurfaceType; m_wIgnoreFX = pCS->wIgnoreFX; m_hFiredFrom = pCS->hFiredFrom; // LTNULL m_vFirePos = pCS->vFirePos; m_vPos = pCS->vPos; m_vSurfaceNormal = pCS->vSurfaceNormal; m_vSurfaceNormal.Norm(); m_eCode = CC_NO_CONTAINER; m_eFirePosCode = CC_NO_CONTAINER; m_pAmmo = g_pWeaponMgr->GetAmmo(m_nAmmoId); if (!m_pAmmo) return LTFALSE; m_pWeapon = g_pWeaponMgr->GetWeapon(m_nWeaponId); if (!m_pWeapon) return LTFALSE; m_fInstDamage = (LTFLOAT) m_pAmmo->nInstDamage; m_fAreaDamage = (LTFLOAT) m_pAmmo->nAreaDamage; m_nShooterId = pCS->nShooterId; m_bLocal = pCS->bLocal; if (!g_cvarShowFirePath.IsInitted()) { g_cvarShowFirePath.Init(g_pLTClient, "ShowFirePath", NULL, -1.0f); } if (!g_cvarLightBeamColorDelta.IsInitted()) { g_cvarLightBeamColorDelta.Init(g_pLTClient, "LightBeamColorDelta", NULL, 50.0f); } if (!g_cvarImpactPitchShift.IsInitted()) { g_cvarImpactPitchShift.Init(g_pLTClient, "PitchShiftImpact", NULL, -1.0f); } if (!g_cvarFlyByRadius.IsInitted()) { g_cvarFlyByRadius.Init(g_pLTClient, "FlyByRadius", NULL, 300.0f); } if (!g_cvarFlyBySoundRadius.IsInitted()) { g_cvarFlyBySoundRadius.Init(g_pLTClient, "FlyBySoundRadius", NULL, 500.0f); } if (!g_vtBloodSplatsMinNum.IsInitted()) { g_vtBloodSplatsMinNum.Init(g_pLTClient, "BloodSplatsMinNum", NULL, 3.0f); } if (!g_vtBloodSplatsMaxNum.IsInitted()) { g_vtBloodSplatsMaxNum.Init(g_pLTClient, "BloodSplatsMaxNum", NULL, 10.0f); } if (!g_vtBloodSplatsMinLifetime.IsInitted()) { g_vtBloodSplatsMinLifetime.Init(g_pLTClient, "BloodSplatsMinLifetime", NULL, 5.0f); } if (!g_vtBloodSplatsMaxLifetime.IsInitted()) { g_vtBloodSplatsMaxLifetime.Init(g_pLTClient, "BloodSplatsMaxLifetime", NULL, 10.0f); } if (!g_vtBloodSplatsMinScale.IsInitted()) { g_vtBloodSplatsMinScale.Init(g_pLTClient, "BloodSplatsMinScale", NULL, 0.01f); } if (!g_vtBloodSplatsMaxScale.IsInitted()) { g_vtBloodSplatsMaxScale.Init(g_pLTClient, "BloodSplatsMaxScale", NULL, 0.05f); } if (!g_vtBloodSplatsRange.IsInitted()) { g_vtBloodSplatsRange.Init(g_pLTClient, "BloodSplatsRange", NULL, 500.0f); } if (!g_vtBloodSplatsPerturb.IsInitted()) { g_vtBloodSplatsPerturb.Init(g_pLTClient, "BloodSplatsPerturb", NULL, 100.0f); } if (!g_vtBigBloodSizeScale.IsInitted()) { g_vtBigBloodSizeScale.Init(g_pLTClient, "BigBloodSizeScale", NULL, 5.0f); } if (!g_vtBigBloodLifeScale.IsInitted()) { g_vtBigBloodLifeScale.Init(g_pLTClient, "BigBloodLifeScale", NULL, 3.0f); } if (!g_vtCreatePolyDebris.IsInitted()) { g_vtCreatePolyDebris.Init(g_pLTClient, "CreatePolyDebris", NULL, 1.0f); } if (!g_vtWeaponFXMinFireDot.IsInitted()) { g_vtWeaponFXMinFireDot.Init(g_pLTClient, "WeaponFXMinFireDot", NULL, 0.6f); } if (!g_vtWeaponFXMinImpactDot.IsInitted()) { g_vtWeaponFXMinImpactDot.Init(g_pLTClient, "WeaponFXMinImpactDot", NULL, 0.6f); } if (!g_vtWeaponFXUseFOVPerformance.IsInitted()) { g_vtWeaponFXUseFOVPerformance.Init(g_pLTClient, "WeaponFXUseFOVPerformance", NULL, 1.0f); } if (!g_vtWeaponFXMaxFireDist.IsInitted()) { g_vtWeaponFXMaxFireDist.Init(g_pLTClient, "WeaponFXMaxFireDist", NULL, 1000.0f); } if (!g_vtWeaponFXMaxImpactDist.IsInitted()) { g_vtWeaponFXMaxImpactDist.Init(g_pLTClient, "WeaponFXMaxImpactDist", NULL, 1000.0f); } if (!g_vtWeaponFXMaxMultiImpactDist.IsInitted()) { g_vtWeaponFXMaxMultiImpactDist.Init(g_pLTClient, "WeaponFXMaxMultiImpactDist", NULL, 300.0f); } if (!g_vtMultiDing.IsInitted()) { g_vtMultiDing.Init(g_pLTClient, "WeaponFXMultiImpactDing", NULL, 1.0f); } return LTTRUE; }
// Build the folder LTBOOL CFolderHostLevels::Build() { if (!g_vtNetGameType.IsInitted()) { g_vtNetGameType.Init(g_pLTClient,"NetGameType",LTNULL,(float)m_nGameType); } rcAvailRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"AvailLevelsRect"); rcSelRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"SelLevelsRect"); rcCommandRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"CommandRect"); nIndent = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"TextIndent"); nArrowWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ArrowWidth"); CreateTitle(IDS_TITLE_HOST_LEVELS); //Add Avail Levels List LTIntPt pos(rcAvailRect.left + nIndent,rcAvailRect.top); CLTGUIFont *pFont = GetLargeFont(); nBarHeight = pFont->GetHeight(); CStaticTextCtrl *pCtrl = CreateStaticTextItem(IDS_HOST_AVAIL_LEVELS, LTNULL, LTNULL,0,0, LTTRUE, pFont); AddFixedControl(pCtrl,pos,LTFALSE); pCtrl->Enable(LTFALSE); pFont = GetSmallFont(); pos.x = rcAvailRect.left + nIndent; pos.y = rcAvailRect.top + nBarHeight; int nListHeight = (rcAvailRect.bottom - rcAvailRect.top) - nBarHeight; int nListWidth = (rcAvailRect.right - rcAvailRect.left) - nArrowWidth; m_pAvailLevels = debug_new(CListCtrl); m_pAvailLevels->Create(nListHeight, LTTRUE, nListWidth); m_pAvailLevels->SetParam1(nListWidth); m_pAvailLevels->SetItemSpacing(0); m_pAvailLevels->EnableMouseMoveSelect(LTTRUE); m_pAvailLevels->SetHelpID(IDS_HELP_AVAIL_LEVELS); AddFixedControl(m_pAvailLevels,pos,LTTRUE); //Add Selected Levels List pos = LTIntPt(rcSelRect.left + nIndent,rcSelRect.top); pFont = GetLargeFont(); pCtrl = CreateStaticTextItem(IDS_HOST_SELECTED_LEVELS, LTNULL, LTNULL,0,0,LTTRUE, pFont); AddFixedControl(pCtrl,pos,LTFALSE); pCtrl->Enable(LTFALSE); pFont = GetSmallFont(); pos.x = rcSelRect.left + nIndent; pos.y = rcSelRect.top + nBarHeight; nListHeight = (rcSelRect.bottom - rcSelRect.top) - nBarHeight; nListWidth = (rcSelRect.right - rcSelRect.left) - nArrowWidth; m_pSelLevels = debug_new(CListCtrl); m_pSelLevels->Create(nListHeight, LTTRUE, nListWidth); m_pSelLevels->SetParam1(nListWidth); m_pSelLevels->SetItemSpacing(0); m_pSelLevels->EnableMouseMoveSelect(LTTRUE); m_pSelLevels->SetHelpID(IDS_HELP_SEL_LEVELS); AddFixedControl(m_pSelLevels,pos,LTTRUE); //Add Commands pos = LTIntPt(rcCommandRect.left + nIndent,rcCommandRect.top); nListWidth = rcCommandRect.right - rcCommandRect.left; pFont = GetLargeFont(); m_pAddAll = CreateStaticTextItem(IDS_HOST_ADD_ALL, CMD_ADD_ALL, IDS_HELP_ADD_ALL, nListWidth); AddFixedControl(m_pAddAll,pos,LTTRUE); pos.y += (m_nItemSpacing + pFont->GetHeight()); m_pAddLevel = CreateStaticTextItem(IDS_HOST_ADD_LEVEL, CMD_ADD_LEVEL, IDS_HELP_ADD_LEVEL, nListWidth); AddFixedControl(m_pAddLevel,pos,LTTRUE); pos.y += (m_nItemSpacing + pFont->GetHeight()); m_pRemoveLevel = CreateStaticTextItem(IDS_HOST_REMOVE_LEVEL, CMD_REMOVE_LEVEL, IDS_HELP_REM_LEVEL, nListWidth); AddFixedControl(m_pRemoveLevel,pos,LTTRUE); pos.y += (m_nItemSpacing + pFont->GetHeight()); m_pRemoveAll = CreateStaticTextItem(IDS_HOST_REMOVE_ALL, CMD_REMOVE_ALL, IDS_HELP_REM_ALL, nListWidth); AddFixedControl(m_pRemoveAll,pos,LTTRUE); pos.y += (m_nItemSpacing + pFont->GetHeight()); // Make sure to call the base class if (!CBaseFolder::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
LTBOOL CPolyGridFX::Init(SFXCREATESTRUCT* psfxCreateStruct) { if (!psfxCreateStruct) return LTFALSE; CSpecialFX::Init(psfxCreateStruct); PGCREATESTRUCT* pg = (PGCREATESTRUCT*)psfxCreateStruct; m_vDims = pg->vDims; m_vColor1 = pg->vColor1; m_vColor2 = pg->vColor2; m_fXScaleMin = pg->fXScaleMin; m_fXScaleMax = pg->fXScaleMax; m_fYScaleMin = pg->fYScaleMin; m_fYScaleMax = pg->fYScaleMax; m_fXScaleDuration = pg->fXScaleDuration; m_fYScaleDuration = pg->fYScaleDuration; m_fXPan = pg->fXPan; m_fYPan = pg->fYPan; m_fBaseReflection = pg->fBaseReflection; m_fVolumeIOR = pg->fVolumeIOR; m_sSurfaceSprite = pg->sSurfaceSprite; m_sSurfaceEnvMap = pg->sSurfaceEnvMap; m_sDampenImage = pg->sDampenImage; m_dwNumPoliesX = pg->dwNumPoliesX; m_dwNumPoliesY = pg->dwNumPoliesY; m_nNumStartupFrames = pg->nNumStartupFrames; m_fAlpha = pg->fAlpha; m_nSurfaceType = pg->nPlasmaType; m_bAdditive = pg->bAdditive; m_bMultiply = pg->bMultiply; m_bFresnel = pg->bFresnel; m_bBackfaceCull = pg->bBackfaceCull; m_bRenderEarly = pg->bRenderEarly; m_bNormalMapSprite = pg->bNormalMapSprite; m_nRingRate[0] = pg->nRingRate[0]; m_nRingRate[1] = pg->nRingRate[1]; m_nRingRate[2] = pg->nRingRate[2]; m_nRingRate[3] = pg->nRingRate[3]; m_fDampenScale = pg->fDampenScale; m_fTimeScale = pg->fTimeScale; m_fSpringCoeff = pg->fSpringCoeff; m_fModelDisplace = pg->fModelDisplace; m_fMinFrameRate = pg->fMinFrameRate; m_nActiveModifiers = pg->nActiveModifiers; for(uint32 nCurrTrack = 0; nCurrTrack < MAX_MODELS_TO_TRACK; nCurrTrack++) { m_hTrackedModels[nCurrTrack] = NULL; } for(uint32 nCurrMod = 0; nCurrMod < PG_MAX_MODIFIERS; nCurrMod++) { m_nXMin[nCurrMod] = pg->nXMin[nCurrMod]; m_nYMin[nCurrMod] = pg->nYMin[nCurrMod]; m_nXMax[nCurrMod] = pg->nXMax[nCurrMod]; m_nYMax[nCurrMod] = pg->nYMax[nCurrMod]; m_nNumAccelPoints[nCurrMod] = pg->nNumAccelPoints[nCurrMod]; m_fAccelAmount[nCurrMod] = pg->fAccelAmount[nCurrMod]; } m_hVolumeBrush = pg->hVolumeBrush; //setup any console variables if (!g_cvarMinPGFrameRate.IsInitted()) { g_cvarMinPGFrameRate.Init(g_pLTClient, "MinPGFrameRate", LTNULL, 0.0f); } if (!g_cvarPGDisplaceMoveScale.IsInitted()) { g_cvarPGDisplaceMoveScale.Init(g_pLTClient, "PGDisplaceMoveScale", LTNULL, 70.0f); } return LTTRUE; }
void PlayWeaponSound(HWEAPON hWeaponID, bool bUseAIData, const LTVector &vPos, PlayerSoundId eSoundId, bool bLocal, HOBJECT hFromObject ) { if( !hWeaponID ) return; HWEAPONDATA hWeapon = g_pWeaponDB->GetWeaponData(hWeaponID, bUseAIData); if (!hWeapon) return; if (!s_cvarFirePitchShift.IsInitted()) { s_cvarFirePitchShift.Init(g_pLTClient, "PitchShiftFire", NULL, -1.0f); } HATTRIBUTE hWeaponSoundStruct; HATTRIBUTE hWeaponSound = NULL; uint32 nValueIndex = 0; HRECORD hSR = NULL; int32 nMixChannel; if (bLocal) { // play the local one if it's in first person mode... hWeaponSoundStruct = g_pWeaponDB->GetAttribute(hWeapon, WDB_WEAPON_LocalSoundInfo); nMixChannel = PLAYSOUND_MIX_WEAPONS_PLAYER; } else { hWeaponSoundStruct = g_pWeaponDB->GetAttribute(hWeapon, WDB_WEAPON_NonLocalSoundInfo); nMixChannel = PLAYSOUND_MIX_WEAPONS_NONPLAYER; } switch (eSoundId) { case PSI_FIRE: { hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rFireSnd ); } break; case PSI_ALT_FIRE: { hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rAltFireSnd ); } break; case PSI_SILENCED_FIRE: { hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rSilencedFireSnd ); } break; case PSI_DRY_FIRE: { hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rDryFireSnd ); } break; case PSI_RELOAD: case PSI_RELOAD2: case PSI_RELOAD3: { hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rReloadSnd ); nValueIndex = eSoundId - PSI_RELOAD; } break; case PSI_SELECT: { hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rSelectSnd ); } break; case PSI_DESELECT: { hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rDeselectSnd ); } break; case PSI_WEAPON_MISC1: case PSI_WEAPON_MISC2: case PSI_WEAPON_MISC3: case PSI_WEAPON_MISC4: case PSI_WEAPON_MISC5: { hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rMiscSnd ); nValueIndex = eSoundId - PSI_WEAPON_MISC1; } break; case PSI_FIRE_LOOP: hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rFireLoopSnd ); break; case PSI_FIRE_LOOP_END: hWeaponSound = g_pWeaponDB->GetStructAttribute(hWeaponSoundStruct, 0, WDB_WEAPON_rFireLoopEndSnd ); break; case PSI_INVALID: default : break; } if (hWeaponSound != NULL) { hSR = g_pWeaponDB->GetRecordLink(hWeaponSound,nValueIndex); } if (hSR) { uint32 dwFlags = PLAYSOUND_REVERB; float fPitchShift = 1.0f; if (s_cvarFirePitchShift.GetFloat() > 0.0f) { dwFlags |= PLAYSOUND_CTRL_PITCH; fPitchShift = s_cvarFirePitchShift.GetFloat(); } if (hFromObject) { g_pClientSoundMgr->PlayDBSoundFromObject(hFromObject, hSR, SMGR_INVALID_RADIUS, SOUNDPRIORITY_PLAYER_HIGH, dwFlags, SMGR_INVALID_VOLUME, fPitchShift, SMGR_INVALID_RADIUS, WEAPONS_SOUND_CLASS, PLAYSOUND_MIX_WEAPONS_NONPLAYER ); } else if (bLocal) { g_pClientSoundMgr->PlayDBSoundLocal(hSR, SOUNDPRIORITY_PLAYER_HIGH, dwFlags, SMGR_INVALID_VOLUME, fPitchShift, WEAPONS_SOUND_CLASS, nMixChannel ); } else { g_pClientSoundMgr->PlayDBSoundFromPos(const_cast<LTVector&>(vPos), hSR, SMGR_INVALID_RADIUS, SOUNDPRIORITY_PLAYER_HIGH, dwFlags, SMGR_INVALID_VOLUME, fPitchShift, SMGR_INVALID_RADIUS, WEAPONS_SOUND_CLASS, nMixChannel ); } } }
LTBOOL CLaserTriggerFX::CreateObject(ILTClient* pClientDE) { if (!CSpecialFX::CreateObject(pClientDE) || !m_hServerObject) return LTFALSE; if (!g_vtLaserTriggerAlpha.IsInitted()) { g_vtLaserTriggerAlpha.Init(g_pLTClient, "LTAlpha", NULL, 0.01f); } if (!CalcBeamCoords()) return LTFALSE; m_pls.vInnerColorStart = m_cs.vColor; m_pls.vInnerColorEnd = m_cs.vColor; m_pls.vOuterColorStart = LTVector(0, 0, 0); m_pls.vOuterColorEnd = LTVector(0, 0, 0); m_pls.fAlphaStart = m_cs.fAlpha; m_pls.fAlphaEnd = m_cs.fAlpha; m_pls.fMinWidth = 0; m_pls.fMaxWidth = 50; m_pls.fMinDistMult = 1.0f; m_pls.fMaxDistMult = 1.0f; m_pls.fLifeTime = 10000000.0f; m_pls.fAlphaLifeTime = 10000000.0f; m_pls.fPerturb = 0.0f; m_pls.bAdditive = LTFALSE; m_pls.nWidthStyle = PLWS_CONSTANT; m_pls.bAlignUp = LTTRUE; m_pls.nNumSegments = 1; m_pls.bNoZ = LTTRUE; m_Beam.Init(&m_pls); m_Beam.CreateObject(m_pClientDE); // Create the sprites if requested... if (m_cs.bCreateSprite && m_cs.hstrSpriteFilename) { BSCREATESTRUCT bs; bs.fLifeTime = 1000000.0f; bs.fInitialAlpha= 1.0f; bs.fFinalAlpha = 1.0f; bs.pFilename = g_pLTClient->GetStringData(m_cs.hstrSpriteFilename); bs.dwFlags = FLAG_VISIBLE | FLAG_GLOWSPRITE | FLAG_SPRITEBIAS; bs.bAdditive = LTTRUE; bs.nType = OT_SPRITE; bs.vInitialScale.Init(m_cs.fSpriteScale, m_cs.fSpriteScale, 1.0f); bs.vFinalScale.Init(m_cs.fSpriteScale, m_cs.fSpriteScale, 1.0f); bs.vPos = m_pls.vStartPos; m_StartSprite.Init(&bs); m_StartSprite.CreateObject(m_pClientDE); bs.vPos = m_pls.vEndPos; m_EndSprite.Init(&bs); m_EndSprite.CreateObject(m_pClientDE); } return LTTRUE; }