示例#1
0
void CLTGUIFrame::SetFrame(HTEXTURE hFrame)
{
    m_hFrame	= hFrame;
    m_argbColor = 0xFFFFFFFF;
    InitPolies();
    ScalePolies();
}
示例#2
0
void CLTGUIFrame::SetColor(uint32 argbColor)
{
    m_hFrame	= LTNULL;
    m_argbColor = argbColor;
    g_pDrawPrim->SetRGBA(&m_Poly[0],m_argbColor);
    ScalePolies();
}
示例#3
0
void CLTGUIFrame::InitPolies()
{
    ScalePolies();

    if (m_bSimpleStretch)
    {
        SetupQuadUVs(m_Poly[0], m_hFrame, 0.0f, 0.0f, 1.0f, 1.0f);
        g_pDrawPrim->SetRGBA(&m_Poly[0],m_argbColor);
    }
    else
    {
        float uv[4] = {0.0f, 0.25f, 0.75f, 1.0f};


        for (int r = 0; r < 3; r++)
        {
            for (int c = 0; c < 3; c++)
            {
                int i = r*3+c;
                g_pDrawPrim->SetRGBA(&m_Poly[i],0xFFFFFFFF);
                SetupQuadUVs(m_Poly[i], m_hFrame, uv[c], uv[r], uv[c+1] - uv[c], uv[r+1] - uv[r]);
            }
        }
    }


}
示例#4
0
void CLTGUIFrame::SetSize(uint16 nWidth, uint16 nHeight)
{
    m_nBaseWidth = nWidth;
    m_nBaseHeight = nHeight;
    m_nWidth = (uint16)((float)m_nBaseWidth * m_fScale);
    m_nHeight = (uint16)((float)m_nBaseHeight * m_fScale);
    ScalePolies();
}
示例#5
0
void CLTGUIFrame::SetScale(float fScale)
{
    CLTGUICtrl::SetScale(fScale);
    m_nWidth = (uint16)((float)m_nBaseWidth * m_fScale);
    m_nHeight = (uint16)((float)m_nBaseHeight * m_fScale);
    ScalePolies();

}
示例#6
0
void CHUDCrosshair::SetStyle(uint8 style)
{
	char *szTag = "HUDCrosshair";
	char szAtt[32];
	sprintf(szAtt,"Crosshair%d",style);

	if (!g_pLayoutMgr->HasValue(szTag,szAtt))
	{
		style = 0;
		sprintf(szAtt,"Crosshair%d",0);
	}


	char szTexA[256];
	char szTexI[256];
	g_pLayoutMgr->GetString(szTag,szAtt,szTexA,sizeof(szTexA));
	SAFE_STRCPY(szTexI,szTexA);
	strcat(szTexA,"_A.dtx");
	strcat(szTexI,"_I.dtx");


	uint32 tw,th;
	m_hAccurate = g_pInterfaceResMgr->GetTexture(szTexA);
	g_pTexInterface->GetTextureDims(m_hAccurate,tw,th);
	m_fAccurateSz = (float)tw;

	//setup the poly UV coords
	SetupQuadUVs(m_Poly[0], m_hAccurate, 0.0f, 0.0f, 1.0f, 1.0f);

	m_hInaccurate = g_pInterfaceResMgr->GetTexture(szTexI);
	g_pTexInterface->GetTextureDims(m_hInaccurate,tw,th);
	m_fInaccurateSz = (float)tw;

	//setup the poly UV coords
	SetupQuadUVs(m_Poly[1], m_hInaccurate, 0.0f, 0.0f, 1.0f, 1.0f);

	ScalePolies();

	m_style = style;
}
示例#7
0
void CHUDCrosshair::Update()
{
	if (!m_bEnabled)
		return;


	
	IClientWeaponBase* pClientWeapon = g_pPlayerMgr->GetCurrentClientWeapon();

    float fPerturb = 1.0f;

	// Just use the weapon's dynamic perturb to determine the amount the
	// crosshair should scale...
	if (pClientWeapon)
	{
		fPerturb = pClientWeapon->GetDynamicPerturb();
	}

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

	bool bDynamic = (!!GetConsoleInt("CrosshairDynamic",1));


	uint32 cr = (uint32)(GetConsoleInt("CrosshairRed",0x00));
	uint32 cg = (uint32)(GetConsoleInt("CrosshairGreen",0xFF));
	uint32 cb = (uint32)(GetConsoleInt("CrosshairBlue",0xFF));
	uint32 ca = (uint32)( (1.0f - fPerturb) * 255.0f);

	if (!bDynamic)
		ca = 0xFF;

	uint32 crosscolor = SET_ARGB(ca,cr,cg,cb);
	g_pDrawPrim->SetRGBA(&m_Poly[0],crosscolor);

	if (bDynamic)
	{
		ca = (uint32)( fPerturb * 255.0f);
		crosscolor = SET_ARGB(ca,cr,cg,cb);
		g_pDrawPrim->SetRGBA(&m_Poly[1],crosscolor);
	}


	if (m_fScale != g_pInterfaceResMgr->GetXRatio())
	{
		m_fScale = g_pInterfaceResMgr->GetXRatio();

		ScalePolies();

		m_x = (float)m_StrPos.x * m_fScale;
		m_y = (float)m_StrPos.y * m_fScale;
		uint8 nTextSize = (uint8)((float)m_nStrSz * m_fScale);
		m_pStr->SetCharScreenHeight(nTextSize);

		m_dbgx = (float)m_DbgPos.x * m_fScale;
		m_dbgy = (float)m_DbgPos.y * m_fScale;
		nTextSize = (uint8)((float)m_nDbgSz * m_fScale);
		m_pDbgStr->SetCharScreenHeight(nTextSize);
	}

	m_bCanActivateTarget = g_pPlayerMgr->GetTargetMgr()->CanActivateTarget();
	m_nTargetTeam = g_pPlayerMgr->GetTargetMgr()->GetTargetTeam();

	if (g_pPlayerMgr->IsSearching())
	{
		m_pStr->SetText(LoadTempString(IDS_TARGET_SEARCHING));
		return;
	}

	HOBJECT hObj = g_pPlayerMgr->GetTargetMgr()->GetTargetObject();
	uint16  nID = g_pPlayerMgr->GetTargetMgr()->GetTargetStringID();

	if (strcmp(g_pPlayerMgr->GetTargetMgr()->GetDebugString(),m_pDbgStr->GetText()))
		m_pDbgStr->SetText(g_pPlayerMgr->GetTargetMgr()->GetDebugString());

	//track whether or not we've zoomed since our last update
	static bool bZoomed = false;
	if( g_pPlayerMgr->IsZooming() )
	{
		if (!bZoomed)
		{
			bZoomed = true;
			m_pStr->SetText("");
		}
		
		return;
	}

	//if we have zoomed since our last full update, force an update
	if (!bZoomed && hObj == m_hObj && nID == m_nString)
		return;

	bZoomed = false;

	m_hObj = hObj;
	m_nString = nID;
	m_pStr->SetText(g_pPlayerMgr->GetTargetMgr()->GetTargetString());


	// Check for special case of camera-activate mode...

	bool bUsingCamera = false;
	AMMO const *pAmmo = g_pWeaponMgr->GetAmmo(g_pPlayerStats->GetCurrentAmmo());
	if (pAmmo && pAmmo->eInstDamageType == DT_GADGET_CAMERA)
	{
		bUsingCamera = true;
	}
	if (!bUsingCamera || !g_pPlayerMgr->IsZoomed())
	{
		g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA);
		g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA_TARGET);
		return;
	}


	if (hObj)
	{
		uint32 dwUserFlags = 0;
		g_pCommonLT->GetObjectFlags(hObj, OFT_User, dwUserFlags);

		if ( (dwUserFlags & USRFLG_GADGET_CAMERA) && g_pPlayerMgr->InCameraGadgetRange( hObj ) )
		{
			g_pInterfaceMgr->CreateOverlay(OVM_CAMERA_TARGET);
			g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA);
			return;

		}
	}

	g_pInterfaceMgr->CreateOverlay(OVM_CAMERA);
	g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA_TARGET);


}
示例#8
0
// Sets the width of the frames's border, set to 0 to not show the frame
void CLTGUIFrame::SetBorder(uint8 nBorderWidth, uint32 nBorderColor)
{
    m_nBorderWidth = nBorderWidth;
    m_BorderColor = nBorderColor;
    ScalePolies();
}
示例#9
0
void CLTGUIFrame::SetTextureScale(float fScale)
{
    m_fTextureScale = fScale;
    ScalePolies();

}
示例#10
0
void CLTGUIFrame::SetBasePos ( LTIntPt pos )
{
    CLTGUICtrl::SetBasePos(pos);
    ScalePolies();
}