예제 #1
0
//fills cfg with current options
void CPerformanceMgr::GetPerformanceOptions(sPerformCfg *pCfg)
{
	for (int i = 0; i < kNumDetailSettings; i++)
	{
		pCfg->nSettings[i] = GetConsoleInt(sSettings[i].szVar,pCfg->nSettings[i]);
	}
	for (int grp = 0; grp < kNumTextureGroups; grp++)
	{
		pCfg->nDetails[grp] = GetConsoleInt(sTextureGroups[grp].szVar,pCfg->nDetails[grp]);
	}

	GetConsoleString("PerformanceConfig",pCfg->szName,pCfg->szName);

}
예제 #2
0
void CHUDHiding::UpdateLayout()
{
	int nCurrentLayout = GetConsoleInt("HUDLayout",0);

	m_BasePos		= g_pLayoutMgr->GetHideIconPos(nCurrentLayout);
	m_BaseSize		= g_pLayoutMgr->GetHideIconSize(nCurrentLayout);
}
HLTSOUND CClientSoundMgr::PlayInterfaceSound(char *pName, uint32 dwFlags)
{
	if (!pName) return LTNULL;
	if (!GetConsoleInt("SoundEnable",1)) return LTNULL;

	PlaySoundInfo psi;
	PLAYSOUNDINFO_INIT(psi);

	psi.m_dwFlags = PLAYSOUND_LOCAL;
	psi.m_dwFlags |= dwFlags;

	strncpy(psi.m_szSoundName, pName, _MAX_PATH);
	psi.m_nPriority	= SOUNDPRIORITY_MISC_MEDIUM;

	// Play interface sounds unfiltered...

	if (!g_pUnfilteredFilter)
	{
		g_pUnfilteredFilter = g_pSoundFilterMgr->GetFilter("UnFiltered");
	}

	psi.m_UserData = g_pUnfilteredFilter->nId;
    
    return PlaySound(psi);
}
예제 #4
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();


}
예제 #5
0
void CHUDSubtitles::Update()
{
	// Sanity checks...
	if (!m_bVisible) 
		return;

	if (GetConsoleInt("Subtitles",0) == 0) 
		return;


	//update the amount of time that has elapsed
	m_fElapsedTime += RealTimeTimer::Instance( ).GetTimerElapsedS( );

	if (m_fEndTime < m_fElapsedTime)
	{
		Clear();
		return;
	}

	//scroll it
	if (!m_bOverflow) 
		return;

	if (m_fScrollStartTime < m_fElapsedTime)
	{
		float fElapsedTime = m_fElapsedTime - m_fScrollStartTime;
		m_fOffset = (fElapsedTime * m_fScrollSpeed);
		if (m_fOffset > m_fMaxOffset) m_fOffset = m_fMaxOffset;
		m_Text.SetPos(LTVector2((float)m_Rect.Left(),(float)m_Rect.Top() - m_fOffset)); 

	}


}
예제 #6
0
void CHUDHealth::UpdateLayout()
{
	int nCurrentLayout = GetConsoleInt("HUDLayout",0);

	m_HealthBasePos		= g_pLayoutMgr->GetHealthBasePos(nCurrentLayout);

	m_bUseHealthBar		= g_pLayoutMgr->GetUseHealthBar(nCurrentLayout);
	m_HealthBarOffset	= g_pLayoutMgr->GetHealthBarOffset(nCurrentLayout);
	m_ArmorBarOffset	= g_pLayoutMgr->GetArmorBarOffset(nCurrentLayout);

	m_bUseHealthText	= g_pLayoutMgr->GetUseHealthText(nCurrentLayout);
	m_HealthTextOffset	= g_pLayoutMgr->GetHealthTextOffset(nCurrentLayout);
	m_ArmorTextOffset	= g_pLayoutMgr->GetArmorTextOffset(nCurrentLayout);

	m_bUseHealthIcon	= g_pLayoutMgr->GetUseHealthIcon(nCurrentLayout);
	m_HealthIconOffset	= g_pLayoutMgr->GetHealthIconOffset(nCurrentLayout);
	m_ArmorIconOffset	= g_pLayoutMgr->GetArmorIconOffset(nCurrentLayout);
	m_nHealthIconSize	= g_pLayoutMgr->GetHealthIconSize(nCurrentLayout);

	m_nBarHeight		= g_pLayoutMgr->GetBarHeight(nCurrentLayout);
	m_nTextHeight		= g_pLayoutMgr->GetTextHeight(nCurrentLayout);
	m_fBarScale			= g_pLayoutMgr->GetBarScale(nCurrentLayout);

	m_HealthColor		= g_pLayoutMgr->GetHealthColor(nCurrentLayout);
	m_ArmorColor		= g_pLayoutMgr->GetArmorColor(nCurrentLayout);

}
예제 #7
0
void CHUDCompass::UpdateLayout()
{
	int nCurrentLayout = GetConsoleInt("HUDLayout",0);

	m_BasePos		= g_pLayoutMgr->GetCompassPos(nCurrentLayout);
	m_nSize			= g_pLayoutMgr->GetCompassSize(nCurrentLayout);

}
예제 #8
0
void CHUDDistance::UpdateLayout()
{
	int nCurrentLayout = GetConsoleInt( "HUDLayout", 0 );

	m_BasePos		= g_pLayoutMgr->GetDistanceIconPos( nCurrentLayout );
	m_fBlinkSpeed	= g_pLayoutMgr->GetDistanceIconBlinkSpeed( nCurrentLayout );
	m_fMaxAlpha  	= g_pLayoutMgr->GetDistanceIconAlpha( nCurrentLayout );
	m_fFadeOutSpeed = g_pLayoutMgr->GetDistanceIconFadeOutSpeed( nCurrentLayout );
}
void CFolderHostLevels::LoadLevelList(CListCtrl *pList)
{
	// Sanity checks...

	if (!pList) return;


	// Get the level count...

	int cLevels = 0;
	if (m_nGameType == COOPERATIVE_ASSAULT)
	{
		cLevels = GetConsoleInt("NetCANumLevels", 0);
	}
	else
	{
		cLevels = GetConsoleInt("NetNumLevels", 0);
	}
	if (cLevels <= 0) return;


	// Get each level...

	for (int i = 0; i < cLevels; i++)
	{
		char sLevel[256] = { "" };
		char sLabel[32];

		if (m_nGameType == COOPERATIVE_ASSAULT)
		{
			wsprintf(sLabel, "NetCALevel%i", i);
		}
		else
		{
			wsprintf(sLabel, "NetLevel%i", i);
		}

		GetConsoleString(sLabel, sLevel, "");
		if (strlen(sLevel))
		{
			AddLevelToList(m_pSelLevels,sLevel);
		}
	}
}
예제 #10
0
LTBOOL CLoadingScreen::Show(LTBOOL bRun)
{
	if (bRun && !GetConsoleInt("DynamicLoadScreen",1))
		bRun = LTFALSE;
	// Make sure we're in the correct state
	if (m_eCurState == STATE_NONE)
	{
		if (!Init())
			return LTFALSE;
	}

	if (m_eCurState != STATE_INIT)
		return LTFALSE;

	// Turn off the cursor
	g_pCursorMgr->UseCursor(LTFALSE);
	
	// Set up the FarZ & turn off fog (farz of 0 is bogus)

	m_nOldFarZ = GetConsoleInt("FarZ", 10000);
	m_nOldFarZ = m_nOldFarZ == 0 ? 10000 : m_nOldFarZ;

	m_bOldFogEnable = (LTBOOL) GetConsoleInt("FogEnable", 0);

	g_pGameClientShell->SetFarZ(10000);
	WriteConsoleInt("FogEnable", 0);

	// Make sure we're not in optimized 2D mode (happens sometimes...)
	g_pLTClient->EndOptimized2D();

	
	// Go into the right state..
	m_eCurState = STATE_SHOW;

	// Update once so the screen's showing
	Update();

	// Start updating if they wanted it to..
	if (bRun)
		return Resume();

	// Ok, it's visible or active
	return LTTRUE;
}
예제 #11
0
void CScreenAudio::OnFocus(bool bFocus)
{
	CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();
	if (bFocus)
	{
		uint16 nVol = 0;
		SoundCapabilities SoundCaps;
		((ILTClientSoundMgr*)g_pLTClient->SoundMgr())->GetVolume(nVol);


		pProfile->SetSound();
		g_pLTClient->SoundMgr()->GetSoundCapabilities(&SoundCaps);

		m_nSoundVolume = (int)(100.0f * pProfile->m_fSoundVolume);
		m_nSpeechVolume = (int)(100.0f * pProfile->m_fSpeechVolume);
		m_nMusicVolume = (int)(100.0f * pProfile->m_fMusicVolume);

		m_bHWSoundsEnable = pProfile->m_bUseHWSound;
		m_bEAXEnable = pProfile->m_bUseEAX;
		m_bEAX4Enable = pProfile->m_bUseEAX4;

		const bool bSoundOn = !!(GetConsoleInt("soundenable",1));
		const bool bMusicOn = !!(GetConsoleInt("MusicEnable",1));
		m_pSoundVolumeCtrl->Enable(bSoundOn);
		m_pSpeechVolumeCtrl->Enable(bSoundOn);
		m_pMusicVolumeCtrl->Enable(bSoundOn && bMusicOn);
		
		m_pHWSoundsEnableCtrl->Enable(bSoundOn && SoundCaps.bSupportsHWSounds);
		m_pEAXEnableCtrl->Enable(bSoundOn && SoundCaps.bSupportsEAX);
		m_pEAX4EnableCtrl->Enable(bSoundOn && SoundCaps.bSupportsEAX4);

		UpdateData(false);
	}
	else
	{
		SaveSoundSettings();
		pProfile->Save();
	}

	CBaseScreen::OnFocus(bFocus);
}
예제 #12
0
void CCursorMgr::Update()
{
	static const HLTCOLOR kTrans	= SETRGB_T(255,0,255);
	LTBOOL bHWC = (GetConsoleInt("HardwareCursor",0) > 0 && GetConsoleInt("DisableHardwareCursor",0) == 0);

	if (bHWC != m_bUseHardwareCursor)
		UseHardwareCursor(bHWC);

	if (!m_bUseCursor)
		return;

	if (m_bUseHardwareCursor && !m_pCursorSprite)
		return;

	LTIntPt CursorPos = g_pInterfaceMgr->GetCursorPos();

	// If a software cursor is needed but none has been specified, use the default
	if (!m_pCursorSprite)
	{
		// TODO: replace with DrawPrim
		g_pLTClient->Start3D();
		g_pLTClient->StartOptimized2D();

		g_pLTClient->DrawSurfaceToSurfaceTransparent(g_pLTClient->GetScreenSurface(), m_hSurfCursor, LTNULL,
												   CursorPos.x, CursorPos.y, kTrans);

		g_pLTClient->EndOptimized2D();
		g_pLTClient->End3D(END3D_CANDRAWCONSOLE);
		return;
	}

	// Update the sprite coordinates
	m_pCursorSprite->SetPosition(CursorPos);

	// update any additional bitmaps
	if (m_pCursorGlowSprite)
		m_pCursorGlowSprite->SetPosition(CursorPos);

	if (m_pCursorBackgroundSprite)
		m_pCursorBackgroundSprite->SetPosition(CursorPos);
}
예제 #13
0
void CHUDAmmoChooser::UpdateLayout()
{
    int nCurrentLayout = GetConsoleInt("HUDLayout",0);


    m_fIconHt = (float)g_pLayoutMgr->GetChooserIconHeight(nCurrentLayout,48);
    m_TextColor = g_pLayoutMgr->GetChooserTextColor(nCurrentLayout,argbWhite);
    m_fTextHeight = (float)g_pLayoutMgr->GetChooserTextSize(nCurrentLayout,20);
    m_fTexScale = g_pLayoutMgr->GetChooserTextureScale(nCurrentLayout,0.75f);


}
예제 #14
0
void CHUDDamageDir::UpdateLayout()
{
	int nCurrentLayout = GetConsoleInt("HUDLayout",0);

	m_nSize = g_pLayoutMgr->GetDamageSize(nCurrentLayout);

	if (m_nSize == 0)
		m_nSize = 48;

	UpdateScale();

}
예제 #15
0
void CScreenAudio::OnFocus(LTBOOL bFocus)
{
	CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();
	if (bFocus)
	{
		pProfile->SetSound();

		m_nSoundVolume = pProfile->m_nSoundVolume;
		m_nMusicVolume = pProfile->m_nMusicVolume;
		m_nSpeechVolume = (int)(100.0f * pProfile->m_fSpeechSoundMultiplier);
		m_bSoundQuality = pProfile->m_bSoundQuality;

		LTBOOL bSoundOn = (LTBOOL)GetConsoleInt("soundenable",1);
        m_pSoundVolumeCtrl->Enable(bSoundOn);
		m_pSpeechVolumeCtrl->Enable(bSoundOn);
        m_pSoundQualityCtrl->Enable(bSoundOn);

		m_bMusicQuality = pProfile->m_bMusicQuality;

		if (!GetConsoleInt("MusicActive",0))
			m_nMusicVolume = MUSIC_MIN_VOL;

		m_pMusicVolumeCtrl->Enable(m_bMusicEnabled);
		m_pMusicQualityCtrl->Enable(m_bMusicEnabled && m_nMusicVolume > MUSIC_MIN_VOL);

		m_nPerformance = g_pPerformanceMgr->GetPerformanceCfg(false);

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

		//sound setting can affect performance sttings so update them here...
		g_pPerformanceMgr->GetPerformanceOptions(&pProfile->m_sPerformance);
		pProfile->Save();
	}

	CBaseScreen::OnFocus(bFocus);
}
void CFolderEffects::OnFocus(LTBOOL bFocus)
{

	
	if (bFocus)
	{
		m_bTracers = (LTBOOL)GetConsoleInt("Tracers",1);
		m_bShellCasings = (LTBOOL)GetConsoleInt("ShellCasings",1);
		m_bMuzzleLight = (LTBOOL)GetConsoleInt("MuzzleLight",1);
		m_bWeather = (LTBOOL)GetConsoleInt("EnableWeatherFX",1);
		m_nImpact = GetConsoleInt("ImpactFXLevel",2);
		m_nDebris = GetConsoleInt("DebrisFXLevel",2);
		UpdateData(LTFALSE);
	}
	else
	{
        UpdateData(LTTRUE);
		WriteConsoleInt("Tracers",(int)m_bTracers);
		WriteConsoleInt("ShellCasings",(int)m_bShellCasings);
		WriteConsoleInt("MuzzleLight",(int)m_bMuzzleLight);
		WriteConsoleInt("EnableWeatherFX",(int)m_bWeather);
		WriteConsoleInt("ImpactFXLevel",m_nImpact);
		WriteConsoleInt("DebrisFXLevel",m_nDebris);

	}
	CBaseFolder::OnFocus(bFocus);
}
예제 #17
0
LTBOOL CCursorMgr::Init()
{
	if (m_bInitialized)
		return LTTRUE;

	// The following line was pulled from InterfaceMgr::Init()
    g_vtCursorHack.Init(g_pLTClient, "CursorHack", NULL, 0.0f);

	if (g_pLTClient->Cursor()->LoadCursorBitmapResource(MAKEINTRESOURCE(IDC_POINTER), m_hCursor) != LT_OK)
	{
		g_pLTClient->CPrint("can't load cursor resource.");
        return LTFALSE;
	}

    if (g_pLTClient->Cursor()->SetCursor(m_hCursor) != LT_OK)
	{
		g_pLTClient->CPrint("can't set cursor.");
        return LTFALSE;
	}

	UseHardwareCursor( GetConsoleInt("HardwareCursor",0) > 0 && GetConsoleInt("DisableHardwareCursor",0) == 0);

	if (!m_hSurfCursor)
        m_hSurfCursor = g_pLTClient->CreateSurfaceFromBitmap("interface\\cursor0.pcx");
	_ASSERT(m_hSurfCursor);

	m_pCursorSprite = LTNULL;	// stay with the default cursor until this points to something
	m_pCursorGlowSprite = LTNULL;
	m_pCursorBackgroundSprite = LTNULL;

	// Uncomment the line below if you want to see an animated cursor!
	// UseSprite("Interface\\Menu\\spr\\cursortest.spr");

	m_bInitialized = LTTRUE;

	m_CursorCenter.x = 16;
	m_CursorCenter.y = 16;

	return LTTRUE;
}
예제 #18
0
void Warn(const char* szFormat, ...)
{
#ifndef _FINAL
	if (GetConsoleInt("DebugLevel",0) < 1 ) return;
	static char szBuffer[4096];
	va_list val;
	va_start(val, szFormat);
	LTVSNPrintF(szBuffer, LTARRAYSIZE(szBuffer), szFormat, val);
	va_end(val);
//	_ASSERT(!szBuffer);
	g_pLTServer->CPrint("WARNING: %s", szBuffer);
#endif
}
예제 #19
0
void CHUDCrosshair::RenderUnarmed()
{

	uint32 cr = (uint32)(GetConsoleInt("CrosshairRed",0x00));
	uint32 cg = (uint32)(GetConsoleInt("CrosshairGreen",0xFF));
	uint32 cb = (uint32)(GetConsoleInt("CrosshairBlue",0xFF));
	uint32 ca = (uint32)(GetConsoleInt("CrosshairAlpha",0xFF));
	uint32 crosscolor = SET_ARGB(ca,cr,cg,cb);
	g_pDrawPrim->SetRGBA(&m_Poly,crosscolor);

    LTRect rect;
	g_pDrawPrim->SetTexture(LTNULL);


	float y = (float)g_pInterfaceResMgr->GetScreenWidth() / 2.0f - 1.0f;
	float x = (float)g_pInterfaceResMgr->GetScreenHeight() / 2.0f - 1.0f;
	float w = 2.0f;
	float h = 2.0f;

	// draw our bars
	g_pDrawPrim->SetXYWH(&m_Poly,x,y,w,h);
	g_pDrawPrim->DrawPrim(&m_Poly,1);

}
예제 #20
0
bool CLoadingScreen::Show(bool bNew)
{

	// Make sure we're in the correct state
	if (m_eCurState == STATE_NONE)
	{
		if (!Init())
			return false;
	}

	if (m_eCurState != STATE_INIT)
		return false;


	// Turn off the cursor
	g_pCursorMgr->UseCursor(false);

	// Set up the FarZ & turn off fog (farz of 0 is bogus)

	m_nOldFarZ = GetConsoleInt("FarZ", 10000);
	m_nOldFarZ = m_nOldFarZ == 0 ? 10000 : m_nOldFarZ;

	m_bOldFogEnable = !!GetConsoleInt("FogEnable", 0);

	g_pGameClientShell->SetFarZ(10000);
	WriteConsoleInt("FogEnable", 0);

	// Go into the right state..
	m_eCurState = STATE_SHOW;

	// Update once so the screen's showing
	Update();

	// Start updating if they wanted it to..
	return Resume();
}
예제 #21
0
void CHUDDisplayMeter::UpdateLayout()
{
	int nCurrentLayout = GetConsoleInt("HUDLayout",0);

	m_MeterBasePos.y	= g_pLayoutMgr->GetDisplayMeterBasePosY( nCurrentLayout );
	m_MeterOffset		= g_pLayoutMgr->GetDisplayMeterOffset( nCurrentLayout );
	m_nMeterHeight		= g_pLayoutMgr->GetDisplayMeterHeight( nCurrentLayout );
	m_fMeterScale		= g_pLayoutMgr->GetDisplayMeterScale( nCurrentLayout );
	
	g_pLayoutMgr->GetDisplayMeterTexture( nCurrentLayout, m_szMeterTex, ARRAY_LEN( m_szMeterTex ));

	// Center the display bar in the middle of the screen...
	m_MeterBasePos.x	= 320 - (uint16)(m_fMeterScale * (float)m_dwMaxValue / 2.0f);

}
void CMuzzleFlashFX::Show()
{
	if (!m_pClientDE) return;

	HOBJECT hObj;
    uint32 dwFlags;

    m_bHidden = LTFALSE;

	// Show particles...

	if (m_bUsingParticles)
	{
		hObj = m_Particle.GetObject();
		if (hObj)
		{
            dwFlags = m_pClientDE->GetObjectFlags(hObj);
            m_pClientDE->SetObjectFlags(hObj, dwFlags | FLAG_VISIBLE);
		}
	}

	// Show light...

	if (m_bUsingLight && GetConsoleInt("MuzzleLight", 1))
	{
		hObj = m_Light.GetObject();
		if (hObj)
		{
            dwFlags = m_pClientDE->GetObjectFlags(hObj);
            m_pClientDE->SetObjectFlags(hObj, dwFlags | FLAG_VISIBLE);
		}
	}

	// Show scale fx...

	if (m_bUsingScale)
	{
		hObj = m_Scale.GetObject();
		if (hObj)
		{
            dwFlags = m_pClientDE->GetObjectFlags(hObj);
            m_pClientDE->SetObjectFlags(hObj, dwFlags | FLAG_VISIBLE);
		}
	}
}
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);
}
예제 #24
0
void CHUDRadar::UpdateLayout()
{
	int nCurrentLayout = GetConsoleInt("HUDLayout",0);
	
	// Use the compass values to determine where the radar should go...

	m_BasePos		= g_pLayoutMgr->GetCompassPos( nCurrentLayout );
	m_nBaseSize		= g_pLayoutMgr->GetCompassSize( nCurrentLayout );

	m_NamePos = m_BasePos;
	m_NamePos.x += m_nBaseSize;
	m_NamePos.y += (m_nBaseSize + m_nObjectSize);

	m_nMaxShowDist	= g_pLayoutMgr->GetRadarMaxShowDist( nCurrentLayout );
	m_nObjectSize	= g_pLayoutMgr->GetRadarObjectSize( nCurrentLayout );

	nLiveColor		= g_pLayoutMgr->GetRadarLivePlayerColor(nCurrentLayout);
	nDeadColor		= g_pLayoutMgr->GetRadarDeadPlayerColor(nCurrentLayout);
	nTalkColor		= g_pLayoutMgr->GetRadarTalkPlayerColor(nCurrentLayout);
	fTotalFlashTime	= g_pLayoutMgr->GetRadarFlashTime(nCurrentLayout);


	LTVector vCol = g_pLayoutMgr->GetVector("Scores","Team1Color");
	uint8 nR = (uint8)vCol.x;
	uint8 nG = (uint8)vCol.y;
	uint8 nB = (uint8)vCol.z;
	nTeamColors[0][0]=  SET_ARGB(0x80,nR,nG,nB);
	nTeamColors[0][1]=  SET_ARGB(0x20,nR,nG,nB);
	nTeamColors[0][2]=  SET_ARGB(0x00,nR,nG,nB);

	vCol = g_pLayoutMgr->GetVector("Scores","Team2Color");
	nR = (uint8)vCol.x;
	nG = (uint8)vCol.y;
	nB = (uint8)vCol.z;
	nTeamColors[1][0]=  SET_ARGB(0x80,nR,nG,nB);
	nTeamColors[1][1]=  SET_ARGB(0x20,nR,nG,nB);
	nTeamColors[1][2]=  SET_ARGB(0x00,nR,nG,nB);


	int nCenterOffset = int(m_nBaseSize / 2) - int(m_nObjectSize / 2);

	m_BasePos.x += nCenterOffset;
	m_BasePos.y += nCenterOffset;
}
예제 #25
0
HLTSOUND CClientSoundMgr::PlaySound(PlaySoundInfo & psi)
{
	HLTSOUND hSnd = LTNULL;
	if (!GetConsoleInt("SoundEnable",1)) return LTNULL;

	// Play the sound...

	// Optimization, if we can't hear the sound and it isn't looping
	// don't play it!

	if ((psi.m_dwFlags & PLAYSOUND_3D) && 
		!(psi.m_dwFlags & PLAYSOUND_LOOP) && 
		 g_vtSoundPlayOnlyIfHeard.GetFloat())
	{
		LTVector vListenerPos;
		bool bListenerInClient;
		LTRotation rRot;
		g_pLTClient->GetListener(&bListenerInClient, &vListenerPos, &rRot);

		LTVector vPos = psi.m_vPosition - vListenerPos;
		if (vPos.Mag() > psi.m_fOuterRadius)
		{
			return LTNULL;
		}
	}


	LTRESULT hResult = g_pLTClient->SoundMgr()->PlaySound(&psi, hSnd);

	if (hResult != LT_OK)
	{
		g_pLTClient->CPrint("ERROR in CClientSoundMgr::PlaySound() - Couldn't play sound '%s'", psi.m_szSoundName);
		
		return LTNULL;
	}
	
	// [RP] The sound handle that gets passed into PlaySound(), hSnd, will *always* get set.  Since the
	// SoundTracks get recycled if we return hSnd we may be setting a handle to a SoundTrack that will
	// get removed by the engine and put back on the free list.  Any future calls to KillSound() using that
	// handle will be killing the wrong sound or *worse*, a sound that doesn't exist.  Returning the handle 
	// of the PlaySoundInfo struct will ensure we only return a valid handle if explicitly told to (ie. PLAYSOUND_GETHANDLE);

	return psi.m_hSound;
}
예제 #26
0
LTBOOL CHUDCrosshair::Init()
{

	g_pDrawPrim->SetRGBA(&m_Poly[0],argbWhite);
	g_pDrawPrim->SetRGBA(&m_Poly[1],argbWhite);
	g_pDrawPrim->SetRGBA(&m_Poly[2],argbWhite);


    g_vtScopeLRGap.Init(g_pLTClient, "ScopeLRGap", NULL, 32.0f);
    g_vtScopeUDGap.Init(g_pLTClient, "ScopeUPGap", NULL, 32.0f);
    g_vtScopeLRRadius.Init(g_pLTClient, "ScopeLRRadius", NULL, 0.377f);
    g_vtScopeUDRadius.Init(g_pLTClient, "ScopeUDRadius", NULL, 0.34f);

	uint8 nFont = g_pLayoutMgr->GetHUDFont();
	CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont);

	m_StrPos = LTIntPt(320,250);
	m_nStrSz = 16;
	m_nStrJust = 1;
	m_StrColor = argbWhite;
	m_StrDisColor = 0x80808080;

	m_pStr = g_pFontManager->CreateFormattedPolyString(pFont,"",0.0f,0.0f);
	m_pStr->SetColor(m_StrColor);

	m_DbgPos = LTIntPt(360,200);
	m_nDbgSz = 12;
	m_nDbgWidth = 220;
	m_nDbgJust = 0;
	m_DbgColor = argbWhite;

	m_pDbgStr = g_pFontManager->CreateFormattedPolyString(pFont,"",0.0f,0.0f);
	m_pDbgStr->SetColor(m_DbgColor);
	m_pDbgStr->SetWrapWidth(m_nDbgWidth);


	uint8 style = (uint8)GetConsoleInt("CrosshairStyle",0);
	SetStyle(style);

	UpdateLayout();	


	return LTTRUE;
}
예제 #27
0
void CHUDArmor::UpdateLayout()
{
	int nCurrentLayout = GetConsoleInt("HUDLayout",0);

	// Position all of the pieces relative to the xy of the base
	float xs = g_pInterfaceResMgr->GetXRatio();
	float ys = g_pInterfaceResMgr->GetYRatio();

	float x = 0.0f;// * xs;
	float y = (480.0f * ys) - 64.0f;

	float w = 64.0f;// * xs;
	float h = 64.0f;// * ys;

	g_pDrawPrim->SetXYWH( &m_Base, x, y, w, h);

	for (int i = 0; i < 6; i++)
	{
		g_pDrawPrim->SetXYWH( &m_ArmorPiece[i], x, y, w, h);
	}
}
HLTSOUND CClientSoundMgr::PlaySound(PlaySoundInfo & psi)
{
	HLTSOUND hSnd = LTNULL;
	if (!GetConsoleInt("SoundEnable",1)) return LTNULL;

	// Play the sound...

	// Optimization, if we can't hear the sound and it isn't looping
	// don't play it!

	if ((psi.m_dwFlags & PLAYSOUND_3D) && !(psi.m_dwFlags & PLAYSOUND_LOOP) && 
		g_vtSoundPlayOnlyIfHeard.GetFloat())
	{
		LTVector vListenerPos;
		LTBOOL bListenerInClient;
		LTRotation rRot;
		g_pLTClient->GetListener(&bListenerInClient, &vListenerPos, &rRot);

		LTVector vPos = psi.m_vPosition - vListenerPos;
		if (vPos.Mag() > psi.m_fOuterRadius)
		{
			return LTNULL;
		}
	}

	LTRESULT hResult = g_pLTClient->PlaySound(&psi);

	if (hResult == LT_OK)
	{
		hSnd = psi.m_hSound;
	}
	else
	{
		_ASSERT(LTFALSE);
		m_pInterface->CPrint("ERROR in CClientSoundMgr::PlaySound() - Couldn't play sound '%s'", psi.m_szSoundName);
		return LTNULL;
	}

	return hSnd;
}
HLTSOUND CClientSoundMgr::PlaySoundLocal(char *pName, SoundPriority ePriority,
	uint32 dwFlags, uint8 nVolume, float fPitchShift)
{
    if (!pName) return LTNULL;
	if (!GetConsoleInt("SoundEnable",1)) return LTNULL;

	PlaySoundInfo psi;
	PLAYSOUNDINFO_INIT(psi);

	psi.m_dwFlags = PLAYSOUND_LOCAL;
	psi.m_dwFlags |= dwFlags;

	if (nVolume < 100)
	{
		psi.m_dwFlags |= PLAYSOUND_CTRL_VOL;
	}

	strncpy(psi.m_szSoundName, pName, _MAX_PATH);
	psi.m_nPriority		= ePriority;
	psi.m_nVolume		= nVolume;
	psi.m_fPitchShift	= fPitchShift;

    return PlaySound(psi);
}
예제 #30
0
void CHUDHealthEnergy::UpdateLayout()
{
	float xs = g_pInterfaceResMgr->GetXRatio();
	float ys = g_pInterfaceResMgr->GetYRatio();

	int nCurrentLayout = GetConsoleInt("HUDLayout",0);

	m_iFontNum = ((CTronLayoutMgr *)g_pLayoutMgr)->GetHealthEnergyFont(nCurrentLayout);

	// load HealthBGRect
	// load HealthBGTexRect
	// load HealthBarRect
	// load HealthBarTexRect
	// load HealthBlinkTime

	// load EnergyBGRect
	// load EnergyBGTexRect
	// load EnergyBarRect
	// load EnergyBarTexRect

	// load HUDHubRect
	g_pDrawPrim->SetXYWH(&m_HUDHub, (320.0f * xs) - 63, (480.0f * ys) - 32, 128, 32);
	g_pDrawPrim->SetUVWH(&m_HUDHub, 0.0f, 0.0f, 1.0f, 1.0f);

	// load the healthbar width into m_iHealthWidth
	m_iHealthWidth = 160;

	// load the energybar width into m_iEnergyWidth
	m_iEnergyWidth = 160;

	// Get HealthBlinkTime
	m_fLayoutHealthBlinkTime = 2.0f;

	// get HealthBGPos
	g_pDrawPrim->SetXYWH(&m_HealthBG, (320.0f * xs) + 12, (480.0f * ys) - 19, 248, 20);

	// get HealthBGTexCoords
	g_pDrawPrim->SetUVWH(&m_HealthBG, 261.0f / 512.0f, 467.0f / 512.0f, 248.0f / 512.0f, 20.0f / 512.0f);

	// get HealthBarPos
	g_pDrawPrim->SetXYWH(&m_HealthBar, m_HealthBG.verts[0].x + 61, m_HealthBG.verts[0].y + 5, (float)m_iHealthWidth, 10);
	g_pDrawPrim->SetXYWH(&m_HealthBlinkBar, m_HealthBG.verts[0].x + 61, m_HealthBG.verts[0].y + 5, (float)m_iHealthWidth, 10);

	// get HealthBarTexCoords
	g_pDrawPrim->SetUVWH(&m_HealthBar, 349.0f / 512.0f, 441.0f / 512.0f, 160.0f / 512.0f, 10.0f / 512.0f);

	// get HealthBlinkBarTexCoords
	g_pDrawPrim->SetUVWH(&m_HealthBlinkBar, 349.0f / 512.0f, 441.0f / 512.0f, 160.0f / 512.0f, 10.0f / 512.0f);

	// get EnergyBGPos
	g_pDrawPrim->SetXYWH(&m_EnergyBG, (320.0f * xs) - 260, (480.0f * ys) - 19, 248, 20);

	// get EnergyBGTexCoords
	g_pDrawPrim->SetUVWH(&m_EnergyBG, 261.0f / 512.0f, 490.0f / 512.0f, 248.0f / 512.0f, 20.0f / 512.0f);

	// get EnergyBarPos
	g_pDrawPrim->SetXYWH(&m_EnergyBar, m_EnergyBG.verts[0].x + 28, m_EnergyBG.verts[0].y + 5, (float)m_iEnergyWidth, 10);

	g_pDrawPrim->SetXYWH(&m_EnergyTransfer, m_EnergyBG.verts[0].x + 28, m_EnergyBG.verts[0].y + 5, (float)m_iEnergyWidth, 10);

	// get EnergyBarTexCoords
	g_pDrawPrim->SetUVWH(&m_EnergyBar, 349.0f / 512.0f, 454.0f / 512.0f, 160.0f / 512.0f, 10.0f / 512.0f);

	CUIFont * pFont = g_pInterfaceResMgr->GetFont(m_iFontNum);
	float x = m_HealthBG.verts[0].x + 27;
	float y = m_HealthBG.verts[0].y;
	if (m_pHealthStr)
		g_pLTClient->GetFontManager()->DestroyPolyString(m_pHealthStr);
	m_pHealthStr = g_pLTClient->GetFontManager()->CreatePolyString(pFont, "100", x, y);
	m_pHealthStr->SetColor(0xC0FFFFFF);
	x = m_EnergyBG.verts[0].x + 200;
	y = m_EnergyBG.verts[0].y;
	if (m_pEnergyStr)
		g_pLTClient->GetFontManager()->DestroyPolyString(m_pEnergyStr);
	m_pEnergyStr = g_pLTClient->GetFontManager()->CreatePolyString(pFont, "100", x, y);
	m_pEnergyStr->SetColor(0xC0FFFFFF);
}