示例#1
0
void CLeanMgr::BeginLean( eLeanDirection kDir )
{
	m_kLeanDir = kDir;

	m_fMaxLeanAngle = DEG2RAD( g_vtLeanAngle.GetFloat() );
	m_fLeanFromAngle = m_fLastLeanAngle;

	m_fStartTime = 0.0f;
	m_fEndTime = g_vtLeanOutTime.GetFloat();

	if( m_bLeanedOut )
	{
		// Send a message to the server to remove the original stimulus.

		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_PLAYER_CLIENTMSG );
		cMsg.Writeuint8( CP_PLAYER_LEAN );
		cMsg.Writeuint8( PL_CENTER );
		cMsg.WriteLTVector( LTVector( 0, 0, 0) );
		g_pLTClient->SendToServer( cMsg.Read(), MESSAGE_GUARANTEED );
	}

	// If we are just begining to lean then we are not leaned out...

	m_bLeanedOut = false;
}
示例#2
0
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;
}
示例#3
0
void CPerformanceTest::Update(float fFrameTime)
{
	// Skip the first few samples since they skew the results...
	m_nThrowAwaySamples++;
	if (m_nThrowAwaySamples <= uint32(g_vtPerformanceThrowAwaySamples.GetFloat()))
	{
		return;
	}

	// Throw out any bogus frame times (too fast or too slow)...
	if (fFrameTime < g_vtPerformanceMinSampleFPS.GetFloat() || 
		fFrameTime > g_vtPerformanceMaxSampleFPS.GetFloat())
	{
		return;
	}

	uint32 nCurFPS = (fFrameTime > 0.0 ? int(1.0/fFrameTime) : kMaxFPS);

	m_nTotalSamples++;
	m_fTotalTime += fFrameTime;
	m_fFPSSmoothTime += fFrameTime;

	if (nCurFPS < m_nMinFPS)
	{
		m_nMinFPS = nCurFPS;
	}

	if (nCurFPS > m_nMaxFPS)
	{
		m_nMaxFPS = nCurFPS;
	}

	if (nCurFPS < m_nMinTestFPS)
	{
		m_nSamplesBelowMin++;
	}
	else if (nCurFPS > m_nMaxTestFPS)
	{
		m_nSamplesAboveMax++;
	}

	
	// Smooth out the "current" fps over kNumSmoothFrames...

	if (m_fFPSSmoothTime <= g_vtPerformanceSmoothFPSTime.GetFloat())
	{
		m_nTotalCurFPS += nCurFPS;
		m_nTotalCurFPSSamples++;
	}
	else
	{
		// Time to calculate smooth current fps
		m_nSmoothedCurFPS = (m_nTotalCurFPS / m_nTotalCurFPSSamples);

		m_nTotalCurFPS = 0;
		m_nTotalCurFPSSamples = 0;
		m_fFPSSmoothTime = 0.0f;
	}
}
示例#4
0
void CHeadBobMgr::DemoSave(ILTStream *pStream)
{
	g_vtNormalHeadCantRate.Save(pStream);
	g_vtVehicleHeadCantUpRate.Save(pStream);
	g_vtVehicleHeadCantDownRate.Save(pStream);
	g_vtMaxNormalHeadCant.Save(pStream);
	g_vtMaxVehicleHeadCant.Save(pStream);
}
示例#5
0
void CLeanMgr::Init( )
{
	g_vtLeanOutTime.Init( g_pLTClient, "LeanOutTime", LTNULL, 0.5f );
	g_vtLeanCenterTime.Init( g_pLTClient, "LeanCenterTime", LTNULL, 0.5f );
	g_vtLeanRadius.Init( g_pLTClient, "LeanRadius", LTNULL, 250.0f );
	g_vtLeanAngle.Init( g_pLTClient, "LeanAngle", LTNULL, 3.0f );
	g_vtLeanCamClipDist.Init( g_pLTClient, "LeanCamClipDist", LTNULL, 20.0f );
}
示例#6
0
void CGameSettings::ImplementMouseSensitivity()
{
	if (!m_pClientDE) return;

	float nMouseSensitivity = GetFloatVar("MouseSensitivity");

	// get the mouse device name

	char strDevice[128];
	memset (strDevice, 0, 128);
    LTRESULT result = m_pClientDE->GetDeviceName (DEVICETYPE_MOUSE, strDevice, 127);
	if (result == LT_OK)
	{
		// get mouse x- and y- axis names

		char strXAxis[32];
		memset (strXAxis, 0, 32);
		char strYAxis[32];
		memset (strYAxis, 0, 32);

        LTBOOL bFoundXAxis = LTFALSE;
        LTBOOL bFoundYAxis = LTFALSE;

		DeviceObject* pList = m_pClientDE->GetDeviceObjects (DEVICETYPE_MOUSE);
		DeviceObject* ptr = pList;
		while (ptr)
		{
			if (ptr->m_ObjectType == CONTROLTYPE_XAXIS)
			{
				SAFE_STRCPY(strXAxis, "##x-axis");
                bFoundXAxis = LTTRUE;
			}

			if (ptr->m_ObjectType == CONTROLTYPE_YAXIS)
			{
				SAFE_STRCPY(strYAxis, "##y-axis");
                bFoundYAxis = LTTRUE;
			}

			ptr = ptr->m_pNext;
		}
		if (pList) m_pClientDE->FreeDeviceObjects (pList);

		if (bFoundXAxis && bFoundYAxis)
		{
			// run the console string

			char strConsole[64];
			float fBaseScale = g_vtMouseScaleBase.GetFloat();
			float fScaleIncrement = g_vtMouseScaleInc.GetFloat();

			sprintf (strConsole, "scale \"%s\" \"%s\" %f", strDevice, strXAxis, fBaseScale + ((float)nMouseSensitivity * fScaleIncrement));
			m_pClientDE->RunConsoleString (strConsole);
			sprintf (strConsole, "scale \"%s\" \"%s\" %f", strDevice, strYAxis, fBaseScale + ((float)nMouseSensitivity * fScaleIncrement));
			m_pClientDE->RunConsoleString (strConsole);
		}
	}
}
示例#7
0
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;
}
示例#8
0
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();
}
示例#10
0
//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;
}
void CCameraOffsetMgr::ProcessTestingVars()
{
	CameraDelta delta;

	// See if any testing vars were set...

	if (g_vtCamWeaponImpact.GetFloat() > 0.0f)
	{
		g_vtCamWeaponImpact.SetFloat(0.0f);

		switch(GetRandom(1, 3))
		{
			case 1:
			{
				delta.Pitch.fVar	= GetRandom(1, 2) == 1 ? -DEG2RAD(5.0f) : DEG2RAD(5.0f);
				delta.Pitch.fTime1	= 0.1f;
				delta.Pitch.fTime2	= 0.25f;
				delta.Pitch.eWave1	= Wave_SlowOff;
				delta.Pitch.eWave2	= Wave_SlowOff;

				g_pLTClient->CPrint("Test Impact Pitch = %.4f (in Deg = %.2f)", delta.Pitch.fVar, RAD2DEG(delta.Pitch.fVar));
			}
			break;

			case 2 :
			{
				delta.Yaw.fVar	= GetRandom(1, 2) == 1 ? -DEG2RAD(5.0f) : DEG2RAD(5.0f);
				delta.Yaw.fTime1	= 0.1f;
				delta.Yaw.fTime2	= 0.25f;
				delta.Yaw.eWave1	= Wave_SlowOff;
				delta.Yaw.eWave2	= Wave_SlowOff;

				g_pLTClient->CPrint("Test Impact Yaw = %.4f (in Deg = %.2f)", delta.Yaw.fVar, RAD2DEG(delta.Yaw.fVar));
			}
			break;

			default :
			case 3 :
			{
				delta.Roll.fVar	= GetRandom(1, 2) == 1 ? -DEG2RAD(5.0f) : DEG2RAD(5.0f);
				delta.Roll.fTime1	= 0.1f;
				delta.Roll.fTime2	= 0.25f;
				delta.Roll.eWave1	= Wave_SlowOff;
				delta.Roll.eWave2	= Wave_SlowOff;

				g_pLTClient->CPrint("Test Impact Roll = %.4f (in Deg = %.2f)", delta.Roll.fVar, RAD2DEG(delta.Roll.fVar));
			}
			break;
		}

		AddDelta(delta);
	}
}
示例#12
0
// this function will return a random value that can be used for a random
// pitch/yaw velocity
float GenerateRandomVelocity()
{
	//find a random number between that range
	float fRand = GetRandom(g_vtShellMinSpinsPerSecond.GetFloat(), g_vtShellMaxSpinsPerSecond.GetFloat());


	//scale it to be either positive or negative
	if(rand() % 2 == 0)
		fRand = -fRand;

	//now map it into rotations
	return /*MATH_CIRCLE * */ fRand;
}
示例#13
0
void CCursorMgr::CheckForReinit()
{
	// because of driver bugs, we need to wait a frame after reinitializing the renderer and
	// reinitialize the cursor
	int nCursorHackFrameDelay = (int)g_vtCursorHack.GetFloat();
	if (nCursorHackFrameDelay)
	{
		nCursorHackFrameDelay--;
		g_vtCursorHack.SetFloat((LTFLOAT)nCursorHackFrameDelay);
		if (nCursorHackFrameDelay == 1)
			Init();
	}
}
示例#14
0
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;
}
示例#15
0
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;
}
示例#16
0
bool CHUDSubtitles::Init()
{
    g_pLTClient->RegisterConsoleProgram("TestSubtitle", TestSubtitleFn);

	if (!g_vtAdjustedRadius.IsInitted())
	{
		g_vtAdjustedRadius.Init(g_pLTClient, "SubtitleSoundRadiusPercent", NULL, 0.77f);
	}


	UpdateLayout();

	return true;

}
// Change in focus
void    CFolderJoin::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		// Reset other values...
		bDblClick = LTFALSE;

		m_nNumServers       = 0;
		m_nNumServersListed = 0;
		m_nVersionFilter = (int)g_vtNetVersionFilter.GetFloat();
		m_nGameFilter = (int)g_vtNetGameFilter.GetFloat();
		m_nPopFilter = (int)g_vtNetPopFilter.GetFloat();
		m_nServerSort = (int)g_vtNetServerSortKey.GetFloat();
		m_nPlayerSort = (int)g_vtNetPlayerSortKey.GetFloat();

        bFrameDelay = LTTRUE;
		m_szPassword[0] = LTNULL;

		nOldIndex = -1;

		HSTRING hStr = g_pLTClient->FormatString(IDS_STATUS_CONNECTING);
		SetDummyStatusState(hStr, 500, FSS_GETSERVICES);
		g_pLTClient->FreeString(hStr);
		

        UpdateData(LTFALSE);
	}
	else
	{
		UpdateData();

		g_vtNetVersionFilter.WriteFloat((float)m_nVersionFilter);
		g_vtNetGameFilter.WriteFloat((float)m_nGameFilter);
		g_vtNetPopFilter.WriteFloat((float)m_nPopFilter);
		g_vtNetServerSortKey.WriteFloat((float)m_nServerSort);
		g_vtNetPlayerSortKey.WriteFloat((float)m_nPlayerSort);

		SetState(FSS_IDLE);
		GetGameSpyClientMgr()->Term();
        bFrameDelay = LTTRUE;
		m_pServerList->RemoveAllControls();
		m_pPlayerList->RemoveAllControls();
		m_pOptionList->RemoveAllControls();
        SetCurGameServerHandle(LTNULL);

	}
	CBaseFolder::OnFocus(bFocus);
}
LTBOOL CSteamFX::Update()
{
    if (m_bWantRemove) return LTFALSE;

	// Debugging aid...

	if (s_cvarTweak.GetFloat() > 0)
	{
		TweakSystem();
	}

	// Start/stop steam sound if necessary...

	if (m_hServerObject)
	{
        uint32 dwUserFlags;
        g_pLTClient->GetObjectUserFlags(m_hServerObject, &dwUserFlags);

		if (!(dwUserFlags & USRFLG_VISIBLE))
		{
			if ((m_dwLastUserFlags & USRFLG_VISIBLE))
			{
				StopSound();
			}
		}
		else  // visible
		{
			if (!(m_dwLastUserFlags & USRFLG_VISIBLE))
			{
				StartSound();
			}
		}

		m_dwLastUserFlags = dwUserFlags;

		// Make sure the sound is in the correct place (in case we are getting
		// keyframed)...

		if (m_hSound)
		{
            LTVector vPos;
            g_pLTClient->GetObjectPos(m_hServerObject, &vPos);
            g_pLTClient->SetSoundPosition(m_hSound, &vPos);
		}


		// Update the steam velocity based on our current rotation (again
		// for keyframing)...

        LTRotation rRot;
        g_pLTClient->GetObjectRotation(m_hServerObject, &rRot);

        LTVector vU, vR, vF;
        g_pLTClient->GetRotationVectors(&rRot, &vU, &vR, &vF);

		m_Steam.SetDriftVel(vF * (m_cs.fVel * 0.75f), vF * m_cs.fVel);
	}

	return m_Steam.Update();
}
示例#19
0
void CWeaponFX::PlayImpactSound()
{
	IMPACTFX* pImpactFX = m_pAmmo->pImpactFX;

	if (IsLiquid(m_eCode))
	{
		pImpactFX = m_pAmmo->pUWImpactFX;
	}

	if (!pImpactFX) return;


	if (m_pAmmo->eType == VECTOR)
	{
		if ((m_nDetailLevel == RS_LOW) && GetRandom(1, 2) != 1) return;
		else if ((m_nDetailLevel == RS_MED) && GetRandom(1, 3) == 1) return;
	}

	char* pSnd = GetImpactSound(m_eSurfaceType, m_nAmmoId);
    LTFLOAT fSndRadius = (LTFLOAT) pImpactFX->nSoundRadius;

	if (pSnd)
	{
		uint32 dwFlags = 0;
		float fPitchShift = 1.0f;
		if (g_cvarImpactPitchShift.GetFloat() > 0.0f)
		{
			dwFlags |= PLAYSOUND_CTRL_PITCH;
		}

        uint8 nVolume = IsLiquid(m_eCode) ? 50 : 100;
		g_pClientSoundMgr->PlaySoundFromPos(m_vPos, pSnd, fSndRadius,
			SOUNDPRIORITY_MISC_LOW, dwFlags, nVolume, fPitchShift);
	}
}
示例#20
0
LTBOOL CParticleSystemFX::CreateObject(ILTClient *pClientDE)
{
    if (!pClientDE ) return LTFALSE;

	if (m_cs.hstrTextureName)
	{
		m_pTextureName = pClientDE->GetStringData(m_cs.hstrTextureName);
	}

    LTBOOL bRet = CBaseParticleSystemFX::CreateObject(pClientDE);

	if (bRet && m_hObject && m_hServerObject)
	{
        LTRotation rRot;
		g_pLTClient->GetObjectRotation(m_hServerObject, &rRot);
		g_pLTClient->SetObjectRotation(m_hObject, &rRot);

        uint32 dwUserFlags;
		g_pCommonLT->GetObjectFlags(m_hServerObject, OFT_User, dwUserFlags);
		if (!(dwUserFlags & USRFLG_VISIBLE))
		{
			g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, 0, FLAG_VISIBLE);
		}
	}

    s_cvarTweak.Init(g_pLTClient, "TweakParticles", NULL, 0.0f);

	return bRet;
}
示例#21
0
LTBOOL CScatterFX::Update( void )
{
	if( !m_pClientDE || !m_hServerObject )
		return LTFALSE;

	if( m_bWantRemove )
		return LTFALSE;

	// check if scatter should be enabled
	m_bEnabled = g_cvarScatterEnable.GetFloat() > 0.0f;

	// update our internal time counter
	if(!g_pGameClientShell->IsServerPaused())
		m_nInternalTime += (uint32)(10000.0f * g_pGameClientShell->GetFrameTime());

	// get the camera position
	HLOCALOBJ camera = g_pPlayerMgr->GetCamera();
	m_pClientDE->GetObjectPos( camera, &m_vCamPos );

	// update the sub volumes
	if( !UpdateSubVolumes() )
		return LTFALSE;

	return LTTRUE;
}
示例#22
0
void CHUDAmmo::Render()
{
	if( g_vtHUDAmmoRender.GetFloat( ) < 1.0f )
		return;

	bool bWeaponsEnabled = g_pClientWeaponMgr->WeaponsEnabled();
	CClientWeapon* pClientWeapon = g_pClientWeaponMgr->GetCurrentClientWeapon();
	if (!pClientWeapon || !bWeaponsEnabled) return;

	if (!m_bDraw || pClientWeapon->GetState() == W_DESELECT) return;

	SetRenderState();

	if (!m_bInfinite)
	{
		m_Text.Render();
	}

	//render icon here
	if (m_hIconTexture)
	{
		g_pDrawPrim->SetTexture(m_hIconTexture);
		g_pDrawPrim->DrawPrim(&m_IconPoly,1);
	}
}
示例#23
0
LTBOOL CLineSystemFX::CreateObject(ILTClient *pClientDE)
{
    if (!pClientDE ) return LTFALSE;

    LTBOOL bRet = CBaseLineSystemFX::CreateObject(pClientDE);

	if (bRet && m_hObject && m_hServerObject)
	{
        uint32 dwUserFlags;
		g_pCommonLT->GetObjectFlags(m_hServerObject, OFT_User, dwUserFlags);
		if (!(dwUserFlags & USRFLG_VISIBLE))
		{
			g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, 0, FLAG_VISIBLE);
		}
	}


	// Create lines...

	m_nTotalNumLines = int(m_cs.fLinesPerSecond * m_cs.fLineLifetime);
	if (m_nTotalNumLines > MAX_SYSTEM_LINES)
	{
		m_nTotalNumLines = MAX_SYSTEM_LINES;
	}

	m_pLines = debug_newa(LSLineStruct, m_nTotalNumLines);

	SetupSystem();

    s_cvarTweak.Init(g_pLTClient, "TweakLines", NULL, 0.0f);

	return bRet;
}
示例#24
0
void CHUDDamageDir::UpdateLayout()
{
	//if we haven't initialized our layout info
	if (!m_hLayout)
	{
		m_hLayout = g_pLayoutDB->GetHUDRecord("HUDDamageDir");
	}

	CHUDItem::UpdateLayout();

	m_nInnerRadius = g_pLayoutDB->GetInt32(m_hLayout,LDB_HUDAddInt,0);
	m_nOuterRadius = g_pLayoutDB->GetInt32(m_hLayout,LDB_HUDAddInt,1);

	for (int i =0; i < kNumDamageSectors; i++)
	{
		DrawPrimSetRGBA(m_Poly[i],argbWhite);
		SetupQuadUVs(m_Poly[i], m_hIconTexture, 0.0f,0.0f,1.0f,1.0f);
	}

	m_fMinAlpha = g_pLayoutDB->GetFloat(m_hLayout,LDB_HUDAddFloat,0);
	m_fMaxAlpha = g_pLayoutDB->GetFloat(m_hLayout,LDB_HUDAddFloat,1);

	g_vtDamageShowAll.Init(g_pLTClient, "DamageShowAll", NULL, 0.0f);

	ScaleChanged();

}
示例#25
0
void CHUDSubtitles::Render()
{
	// Sanity checks...
	if (!m_bVisible) return;
	if (GetConsoleInt("Subtitles",0) == 0) return;

	// Only show subtitles if conversations in range...
	LTVector vListenerPos;
	bool bListenerInClient;
	LTRotation rRot;
	g_pLTClient->GetListener(&bListenerInClient, &vListenerPos, &rRot);

	bool bForceDraw = (bool)(m_vSpeakerPos == LTVector(0, 0, 0));
	bForceDraw = ((g_pPlayerMgr->GetPlayerCamera()->GetCameraMode() == CPlayerCamera::kCM_Cinematic) ? true : bForceDraw);

	LTVector vPos = m_vSpeakerPos - vListenerPos;
	float fAdjustedRadius = m_fRadius * g_vtAdjustedRadius.GetFloat();

	if (!bForceDraw && vPos.Mag() > fAdjustedRadius)
		return;



	//render normal

	if (m_bOverflow)
		m_Text.RenderClipped(m_Rect);
	else
		m_Text.Render();


}
示例#26
0
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 CClientSoundMgr::Init(ILTCSBase *pInterface, const char* szAttributeFile)
{
	g_pClientSoundMgr = this;

	g_vtSoundPlayOnlyIfHeard.Init(g_pLTClient, "SoundPlayOnlyIfHeard", NULL, 1.0f);

	return CGameSoundMgr::Init(pInterface, szAttributeFile);
}
示例#28
0
LTBOOL CClientSoundMgr::Init(const char* szAttributeFile)
{
	g_pClientSoundMgr = this;

	g_vtSoundPlayOnlyIfHeard.Init(g_pLTClient, "SoundPlayOnlyIfHeard", NULL, 0.0f);

	return CGameSoundMgr::Init(szAttributeFile);
}
示例#29
0
void CWeaponFX::PlayBulletFlyBySound()
{
	if (!m_pWeapon || !m_pAmmo) return;

	if (m_pAmmo->eType != VECTOR) return;

	// Camera pos

	HOBJECT hCamera = g_pGameClientShell->GetCamera();
    LTVector vPos;
    g_pLTClient->GetObjectPos(hCamera, &vPos);

	// We only play the flyby sound if we won't hear an impact or
	// fire sound...

	LTVector vDist = m_vFirePos - vPos;
	if (vDist.Mag() < m_pWeapon->nFireSoundRadius) return;

	if (m_pAmmo->pImpactFX)
	{
		vDist = m_vPos - vPos;
		if (vDist.Mag() < m_pAmmo->pImpactFX->nSoundRadius) return;
	}


	// See if the camera is close enough to the bullet path to hear the
	// bullet...

	LTFLOAT fRadius = g_cvarFlyByRadius.GetFloat();

	LTVector vDir = m_vDir;

	const LTVector vRelativePos = vPos - m_vFirePos;
    const LTFLOAT fRayDist = vDir.Dot(vRelativePos);
	LTVector vBulletDir = (vDir*fRayDist - vRelativePos);

    const LTFLOAT fDistSqr = vBulletDir.MagSqr();

	if (fDistSqr < fRadius*fRadius)
	{
		vPos += vBulletDir;
		g_pClientSoundMgr->PlaySoundFromPos(vPos, "Guns\\Snd\\flyby.wav",
			g_cvarFlyBySoundRadius.GetFloat(), SOUNDPRIORITY_MISC_LOW);
	}
}
void CFolderGame::OnFocus(LTBOOL bFocus)
{
	CGameSettings *pSettings = g_pInterfaceMgr->GetSettings();
	if (bFocus)
	{
	
		m_bGore = pSettings->Gore();
		m_nDifficulty = g_pGameClientShell->GetDifficulty();
		m_bFadeBodies = g_pGameClientShell->GetFadeBodies();
		m_nSubtitles = (int)g_vtSubtitles.GetFloat();
		m_bAlwaysRun = pSettings->RunLock();

		m_nLayout = (int)g_vtHUDLayout.GetFloat();

		m_nHeadBob = (int)(10.0f * GetConsoleFloat("HeadBob",1.0f));
		m_nWeaponSway = (int)(10.0f * GetConsoleFloat("WeaponSway",1.0f));
		m_nPickupMsgDur = (int)(2.0f * GetConsoleFloat("PickupMessageDuration",5.0f));
		m_bObjMessages = ( GetConsoleInt("ObjectiveMessages",1) > 0 );

        UpdateData(LTFALSE);
	}
	else
	{
		UpdateData();

		pSettings->SetBoolVar("Gore",m_bGore);
		g_vtSubtitles.WriteFloat((LTFLOAT)m_nSubtitles);
		g_vtHUDLayout.WriteFloat((LTFLOAT)m_nLayout);
		WriteConsoleInt("Difficulty",m_nDifficulty);
		g_pGameClientShell->SetDifficulty((GameDifficulty)m_nDifficulty);
		WriteConsoleInt("FadeBodies",(int)m_bFadeBodies);
		g_pGameClientShell->SetFadeBodies(m_bFadeBodies);
		pSettings->SetBoolVar("RunLock",m_bAlwaysRun);

		WriteConsoleFloat("HeadBob",((LTFLOAT)m_nHeadBob / 10.0f));
		WriteConsoleFloat("WeaponSway",((LTFLOAT)m_nWeaponSway / 10.0f));
		WriteConsoleFloat("PickupMessageDuration",((LTFLOAT)m_nPickupMsgDur / 2.0f));
		WriteConsoleInt("ObjectiveMessages",m_bObjMessages);

		g_pLTClient->WriteConfigFile("autoexec.cfg");


	}
	CBaseFolder::OnFocus(bFocus);
}