void CHUDWpnChooser::Render() { if (!m_bDraw) return; SetRenderState(); for (uint8 n = 0; n < kMaxClasses; n++) { // if (n != m_nClass) // { g_pDrawPrim->SetTexture( m_hClassIcon[n] ); SetupQuadUVs(m_ClassPoly[n], m_hClassIcon[n], 0.0f, 0.0f, m_fTexScale, m_fTexScale); g_pDrawPrim->DrawPrim( &m_ClassPoly[n], 1 ); // } } for (n = 0; n < kMaxItemsPerClass && m_hItemIcon[n]; n++) { g_pDrawPrim->SetTexture( m_hItemIcon[n] ); SetupQuadUVs(m_ItemPoly[n], m_hItemIcon[n], 0.0f, 0.0f, m_fTexScale, m_fTexScale); g_pDrawPrim->DrawPrim( &m_ItemPoly[n], 1 ); } m_pStr->Render(); }
LTBOOL CHUDHiding::Init() { //Hiding icon m_hIcon[kHidePrim] = g_pInterfaceResMgr->GetTexture("interface\\hud\\hide.dtx"); g_pDrawPrim->SetRGBA(&m_Poly[kHidePrim],argbWhite); SetupQuadUVs(m_Poly[kHidePrim],m_hIcon[kHidePrim],0.0f,0.0f,1.0f,1.0f); //Hidden icon m_hIcon[kHiddenPrim] = g_pInterfaceResMgr->GetTexture( "interface\\hud\\hidden.dtx" ); g_pDrawPrim->SetRGBA( &m_Poly[kHiddenPrim], argbWhite ); SetupQuadUVs(m_Poly[kHiddenPrim], m_hIcon[kHiddenPrim], 0.0f, 0.0f, 1.0f, 1.0f ); // Cant hide icon m_hIcon[kCantHidePrim] = g_pInterfaceResMgr->GetTexture( "interface\\hud\\hideno.dtx" ); g_pDrawPrim->SetRGBA( &m_Poly[kCantHidePrim], argbWhite ); SetupQuadUVs( m_Poly[kCantHidePrim], m_hIcon[kCantHidePrim], 0.0f, 0.0f, 1.0f, 1.0f ); UpdateLayout(); // Init our hiding bar... m_HideBar.Init(); return LTTRUE; }
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]); } } } }
LTBOOL CHUDHealth::Init() { //health icon m_hHealth = g_pInterfaceResMgr->GetTexture("interface\\hud\\icon_health.dtx"); g_pDrawPrim->SetRGBA(&m_Poly[0],argbWhite); SetupQuadUVs(m_Poly[0], m_hHealth, 0.0f,0.0f,1.0f,1.0f); //armor icon m_hArmor = g_pInterfaceResMgr->GetTexture("interface\\hud\\icon_armor.dtx"); g_pDrawPrim->SetRGBA(&m_Poly[1],argbWhite); SetupQuadUVs(m_Poly[1], m_hArmor, 0.0f,0.0f,1.0f,1.0f); uint8 nFont = g_pLayoutMgr->GetHUDFont(); CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont); m_pHealthStr = g_pFontManager->CreatePolyString(pFont,"",0.0f, 0.0f); m_pArmorStr = g_pFontManager->CreatePolyString(pFont,"",0.0f, 0.0f); UpdateLayout(); //health bar m_HealthBar.Init(g_pInterfaceResMgr->GetTexture("interface\\hud\\healthbar.dtx")); //armor bar m_ArmorBar.Init(g_pInterfaceResMgr->GetTexture("interface\\hud\\armorbar.dtx")); m_pHealthStr->SetColor(m_HealthColor); m_pArmorStr->SetColor(m_ArmorColor); return LTTRUE; }
void CLTGUISlider::InitBar() { ScaleBar(); SetupQuadUVs(m_Bar[eFull], m_hBar, 0.0f,0.0f,0.5f,0.5f); SetupQuadUVs(m_Bar[eEmpty], m_hBar, 0.5f,0.0f,0.5f,0.5f); SetupQuadUVs(m_Bar[eLeft], m_hBar, 0.0f,0.5f,0.5f,0.5f); SetupQuadUVs(m_Bar[eRight], m_hBar, 0.5f,0.5f,0.5f,0.5f); for (int i = 0; i < 4; i++) g_pDrawPrim->SetRGBA(&m_Bar[i],0xFFFFFFFF); }
void CScreenSprite::Init() { m_FrameArray.clear(); SetupQuadUVs(m_DrawPrim, NULL, 0.0f, 0.0f, 1.0f, 1.0f); g_pDrawPrim->SetRGBA(&m_DrawPrim,argbWhite); }
void CharacterDisplay::Render() { //draw the background LTRESULT res; LTPoly_G4 poly; uint8 a,r,g,b; GET_ARGB(m_cTextBackColor,a,r,g,b); DrawPrimSetRGBA(poly,r, g, b, a); DrawPrimSetXYWH(poly, (float)m_rTextBackRect.Left(), (float)m_rTextBackRect.Top(), (float)m_rTextBackRect.GetWidth(), (float)m_rTextBackRect.GetHeight() ); res= g_pDrawPrim->DrawPrim(&poly,1); if (m_hTexture != (HTEXTURE)NULL) { LTPoly_GT4 img; DrawPrimSetRGBA(img,0xFF,0xFF,0xFF,0xFF); DrawPrimSetXYWH(img, 0.0f, 0.0f, m_vSize.x, m_vSize.y ); SetupQuadUVs(img, m_hTexture, 0.0f,0.0f,1.0f,1.0f ); g_pDrawPrim->SetTexture(m_hTexture); res= g_pDrawPrim->DrawPrim(&img,1); if (res != LT_OK) { res = res; } } //draw the text if (!m_Text.IsEmpty()) { res = m_Text.Render(); //( m_rTextBackRect ); } }
// Render the control void CLTGUIButton::Render() { // Sanity checks... if (!IsVisible()) return; HTEXTURE hCurrTex; if (IsSelected() && m_hSelected) hCurrTex = m_hSelected; else if (IsDisabled() && m_hDisabled) hCurrTex = m_hDisabled; else hCurrTex = m_hNormal; //setup the texture g_pDrawPrim->SetTexture(hCurrTex); //setup the UV coordinates on our quad, since it is dependant upon //the texture for correct filtering SetupQuadUVs(m_Poly, hCurrTex, 0.0f, 0.0f, 1.0f, 1.0f); // set up the render state SetRenderState(); // draw our button g_pDrawPrim->DrawPrim(&m_Poly); if (m_pText) { uint32 argbColor = m_argbNormal; if (m_bHighlightText) argbColor = GetCurrentColor(); m_pText->SetColor(argbColor); m_pText->Render(); } }
// Change in focus void CScreenCrosshair::OnFocus(LTBOOL bFocus) { if (bFocus) { GetConsoleVariables(); UpdateData(LTFALSE); uint32 th; m_hCrosshair = g_pInterfaceResMgr->GetTexture(m_styles[m_nStyle].c_str()); SetupQuadUVs(m_Poly, m_hCrosshair, 0.0f, 0.0f, 1.0f, 1.0f); g_pTexInterface->GetTextureDims(m_hCrosshair,nCrosshairSize,th); uint8 cr = (uint8)m_nColorR; uint8 cg = (uint8)m_nColorG; uint8 cb = (uint8)m_nColorB; uint8 ca = 0xFF; uint32 crosscolor = SET_ARGB(ca,cr,cg,cb); g_pDrawPrim->SetRGBA(&m_Poly,crosscolor); } else { UpdateData(); SetConsoleVariables(); CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile(); pProfile->Save(); } CBaseScreen::OnFocus(bFocus); }
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(); }
void CHUDWeapon::UpdateBar() { HWEAPONDATA hWpnData = g_pWeaponDB->GetWeaponData(m_hWeapon, !USE_AI_DATA); if (!hWpnData) return; HAMMO hAmmo = g_pWeaponDB->GetRecordLink( hWpnData, WDB_WEAPON_rAmmoName); if (!hAmmo) return; float fPercent = 1.0f; HAMMODATA hAmmoData = g_pWeaponDB->GetAmmoData(hAmmo); uint32 maxAmmo = g_pWeaponDB->GetInt32( hAmmoData, WDB_AMMO_nMaxAmount ); if (!g_pWeaponDB->GetBool( hWpnData, WDB_WEAPON_bInfiniteAmmo ) && maxAmmo > 0) { fPercent = float(m_nCount) / float(maxAmmo); } fPercent *= m_fBarWidth; SetupQuadUVs(m_BarPoly, m_hBarTexture, 0.0f, 0.0f, fPercent, 1.0f); float x = (float)(m_vBasePos.x + m_vIconOffset.x); float y = (float)(m_vBasePos.y + m_vIconOffset.y); float fPartialWidth = fPercent * float(m_vIconSize.x); DrawPrimSetXYWH(m_BarPoly,x,y, fPartialWidth ,float(m_vIconSize.y)); }
// ----------------------------------------------------------------------- // // Associate this item with a particular weapon record // ----------------------------------------------------------------------- // void CHUDWeapon::SetWeaponRecord(HWEAPON hWeapon) { //flash if we pickup a weapon if (hWeapon && !m_hWeapon) { Flash("Pickup"); } m_hWeapon = hWeapon; m_bDraw = true; if (m_hWeapon) { HWEAPONDATA hWpnData = g_pWeaponDB->GetWeaponData(m_hWeapon, !USE_AI_DATA); m_hIconTexture.Load( g_pWeaponDB->GetString( hWpnData, WDB_WEAPON_sIcon ) ); } else { m_hIconTexture.Load( g_pLayoutDB->GetString(m_hLayout,"IconTexture") ); Select(false); } SetupQuadUVs(m_IconPoly, m_hIconTexture, 0.0f, 0.0f, 1.0f, 1.0f); m_nCount = -1; Update(); }
void CHUDMessage::InitPoly() { if (!m_hImage) return; ScalePoly(); SetupQuadUVs(m_Poly, m_hImage, 0.0f,0.0f,1.0f,1.0f); g_pDrawPrim->SetRGBA(&m_Poly,0xFFFFFFFF); JustifyPoly(); }
LTBOOL CSubMenu::Init(HTEXTURE hFrame,HTEXTURE hFrameTip, LTIntPt size) { m_hFrame = hFrame; m_hFrameTip = hFrameTip; if (!Create(NULL,size.x,size.y)) return LTFALSE; SetupQuadUVs(m_Poly[0], hFrame, 0.0f, 0.0f, 1.0f, 1.0f); SetupQuadUVs(m_Poly[1], hFrameTip, 0.0f, 0.0f, 1.0f, 1.0f); RotateQuadUVs(m_Poly[1], 1); g_pDrawPrim->SetRGBA(&m_Poly[0],argbWhite); g_pDrawPrim->SetRGBA(&m_Poly[1],argbWhite); return LTTRUE; }
LTBOOL CHUDCompass::Init() { for (int i =0; i < 2; i++) { g_pDrawPrim->SetRGBA(&m_Poly[i],argbWhite); } m_hBack = g_pInterfaceResMgr->GetTexture("interface\\hud\\compass_back.dtx"); m_hNeedle = g_pInterfaceResMgr->GetTexture("interface\\hud\\compass_needle.dtx"); SetupQuadUVs(m_Poly[0], m_hBack, 0.0f, 0.0f, 1.0f, 1.0f); SetupQuadUVs(m_Poly[1], m_hNeedle, 0.0f, 0.0f, 1.0f, 1.0f); UpdateLayout(); return LTTRUE; }
void CHUDAmmo::Update() { HWEAPON hWeapon = g_pPlayerStats->GetCurrentWeaponRecord(); HAMMO hAmmo = g_pPlayerStats->GetCurrentAmmoRecord(); m_bDraw = (hWeapon && hAmmo); if (hAmmo) { DamageType dtAmmoInstDamageType = g_pWeaponDB->GetAmmoInstDamageType( hAmmo); if (dtAmmoInstDamageType == DT_MELEE) m_bDraw = false; } if (!m_bDraw) return; CClientWeapon* pClientWeapon = g_pClientWeaponMgr->GetCurrentClientWeapon( ); int nAmmoInClip = pClientWeapon ? pClientWeapon->GetAmmoInClips() : 0; int nAmmo = g_pPlayerStats->GetCurrentAmmoCount() - nAmmoInClip; HWEAPONDATA hWpnData = g_pWeaponDB->GetWeaponData(hWeapon, !USE_AI_DATA); m_bInfinite = g_pWeaponDB->GetBool( hWpnData, WDB_WEAPON_bInfiniteAmmo ); if (!m_bInfinite) { wchar_t wstr[32]; FormatString("HUD_Ammo_Format",wstr,LTARRAYSIZE(wstr), nAmmoInClip, nAmmo < 0 ? 0 : nAmmo); if ((nAmmo > 0) || (nAmmoInClip > 0)) { EnableFade(true); } else { ResetFade(); EnableFade( false ); } m_Text.SetText(wstr); } if (m_hLastAmmo != hAmmo) { HAMMODATA hAmmoData = g_pWeaponDB->GetAmmoData(hAmmo); m_hIconTexture.Load( g_pWeaponDB->GetString( hAmmoData, WDB_AMMO_sIcon ) ); SetupQuadUVs(m_IconPoly, m_hIconTexture, 0.0f, 0.0f, 1.0f, 1.0f); m_hLastAmmo = hAmmo; } ResetFade(); }
void CHUDAmmoChooser::Render() { if (!m_bDraw) return; SetRenderState(); g_pDrawPrim->SetTexture( m_hWeaponIcon ); SetupQuadUVs(m_WeaponPoly, m_hWeaponIcon, 0.0f, 0.0f, m_fTexScale, m_fTexScale); g_pDrawPrim->DrawPrim( &m_WeaponPoly, 1 ); for (uint8 n = 0; m_hAmmoIcon[n] && n < kMaxAmmoTypes; n++) { g_pDrawPrim->SetTexture( m_hAmmoIcon[n] ); SetupQuadUVs(m_AmmoPoly[n], m_hAmmoIcon[n], 0.0f, 0.0f, m_fTexScale, m_fTexScale); g_pDrawPrim->DrawPrim( &m_AmmoPoly[n], 1 ); } m_pStr->Render(); m_pWpnStr->Render(); }
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; }
void CScreenSprite::Render() { g_pDrawPrim->SetAlphaBlendMode(m_bAdditive ? DRAWPRIM_BLEND_ADD : DRAWPRIM_BLEND_MOD_SRCALPHA); g_pDrawPrim->SetTexture(m_FrameArray[m_iCurrentFrame]->hTex); float x = (float)m_Position.x - (float)m_Center.x; float y = (float)m_Position.y - (float)m_Center.y; float w = (float)m_FrameArray[m_iCurrentFrame]->iWidth; float h = (float)m_FrameArray[m_iCurrentFrame]->iHeight; g_pDrawPrim->SetXYWH(&m_DrawPrim, x, y, w, h); SetupQuadUVs(m_DrawPrim, m_FrameArray[m_iCurrentFrame]->hTex, 0.0f, 0.0f, 1.0f, 1.0f); g_pDrawPrim->DrawPrim(&m_DrawPrim); }
void CHUDDistance::Update() { m_fDistPercent = g_pPlayerMgr->GetDistanceIndicatorPercent(); m_hIcon = g_pPlayerMgr->GetDistanceIndicatorIcon(); m_bDraw = (m_fDistPercent > 0.0f && m_hIcon); if( !m_bDraw ) { if( m_fAlpha > 0.0f ) { m_bDraw = true; m_nFadeDir = -1; m_fDistPercent = 0.5f; m_bFadeOut = true; m_fFadeIncrement = m_nFadeDir * m_fFadeOutSpeed; } else { m_fAlpha = 0.0f; m_nFadeDir = 1; return; } } // Setup the poly and get the texture... g_pDrawPrim->SetRGBA( &m_Poly, argbWhite ); SetupQuadUVs( m_Poly, m_hIcon, 0.0f, 0.0f, 1.0f, 1.0f ); uint32 tw, th; g_pTexInterface->GetTextureDims( m_hIcon, tw, th ); m_fIconSize = (float)th; float x = (float)m_BasePos.x * g_pInterfaceResMgr->GetXRatio(); float y = (float)m_BasePos.y * g_pInterfaceResMgr->GetYRatio(); float w = m_fIconSize * g_pInterfaceResMgr->GetYRatio(); g_pDrawPrim->SetXYWH(&m_Poly,x,y,w,w); m_bBlink = true; if( m_fDistPercent >= 1.0f ) { m_bBlink = false; m_fAlpha = m_fMaxAlpha; } }
void CHUDArmor::UpdateBar() { float fPercent = 1.0f; if (g_pPlayerStats->GetMaxArmor() > 0) { fPercent = float(g_pPlayerStats->GetArmor()) / float(g_pPlayerStats->GetMaxArmor()); } fPercent *= m_fBarWidth; SetupQuadUVs(m_BarPoly, m_hBarTexture, 0.0f, 0.0f, fPercent, 1.0f); float x = (float)(m_vBasePos.x * g_pInterfaceResMgr->GetXRatio()) + float(m_vIconOffset.x); float y = (float)(m_vBasePos.y * g_pInterfaceResMgr->GetYRatio()) + float(m_vIconOffset.y); float fPartialWidth = fPercent * float(m_vIconSize.x); DrawPrimSetXYWH(m_BarPoly,x,y, fPartialWidth ,float(m_vIconSize.y)); }
void CHUDRadar::AddObject( HOBJECT hObj, uint8 nRadarType, uint8 nVisibleTeamId ) { if( !hObj || !g_pRadarTypeMgr ) return; // Don't add the object more than once... if( m_mapRadarObjects.find( hObj ) != m_mapRadarObjects.end() ) { g_pLTClient->CPrint("HUDRadar: failed adding object (duplicate)"); return; } RADARTYPE *pType = g_pRadarTypeMgr->GetRadarType( nRadarType ); if( pType && pType->szIcon ) { HTEXTURE hTex = g_pInterfaceResMgr->GetTexture( pType->szIcon ); if( !hTex ) { g_pLTClient->CPrint("HUDRadar: failed adding object (no texture %s)", pType->szIcon); return; } RADAROBJECT *pRadObj = debug_new( RADAROBJECT ); if( !pRadObj ) return; pRadObj->m_bDraw = false; pRadObj->m_hTex = hTex; pRadObj->m_nDrawOrder = pType->nDrawOrder; pRadObj->m_nVisibleTeamId = nVisibleTeamId; g_pDrawPrim->SetRGBA( &pRadObj->m_Poly, argbWhite ); SetupQuadUVs( pRadObj->m_Poly, hTex, 0.0f, 0.0f, 1.0f, 1.0f ); m_mapRadarObjects[hObj] = pRadObj; m_ROSortList.push_back(pRadObj); m_ROSortList.sort(RadarObjectLesser()); } else { g_pLTClient->CPrint("HUDRadar: failed adding object (unknown type %d)",nRadarType); } }
LTBOOL CHUDDamageDir::Init() { m_hArrow = g_pInterfaceResMgr->GetTexture("interface\\hud\\damagearrow.dtx"); for (int i =0; i < kNumDamageSectors; i++) { g_pDrawPrim->SetRGBA(&m_Poly[i],argbWhite); SetupQuadUVs(m_Poly[i], m_hArrow, 0.0f,0.0f,1.0f,1.0f); } g_vtDamageMinAlpha.Init(g_pLTClient, "DamageMinAlpha", NULL, 0.25f); g_vtDamageMaxAlpha.Init(g_pLTClient, "DamageMaxAlpha", NULL, 0.9f); g_vtDamageShowAll.Init(g_pLTClient, "DamageShowAll", NULL, 0.0f); UpdateLayout(); return LTTRUE; }
void CHUDControlPointBar::CHUDControlPoint::SetTeam(ETeamId eTeamID) { ETeamId eLocalID = ( ETeamId )g_pInterfaceMgr->GetClientInfoMgr()->GetLocalTeam( ); if (eTeamID == INVALID_TEAM) { m_hIconTexture = m_hTeamIcon[1]; m_cIconColor = m_cTeamColor[1]; } else { if (eTeamID == eLocalID) { m_hIconTexture = m_hTeamIcon[0]; m_cIconColor = m_cTeamColor[0]; } else { m_hIconTexture = m_hTeamIcon[2]; m_cIconColor = m_cTeamColor[2]; } } if (m_hIconTexture) { SetupQuadUVs(m_IconPoly, m_hIconTexture, 0.0f,0.0f,1.0f,1.0f); } m_Text.SetColor(m_cTextColor); DrawPrimSetRGBA(m_IconPoly,m_cIconColor); if (eTeamID != m_eTeamId) { m_eTeamId = eTeamID; Flash("CPStatus"); } }
void CHUDBar::Init(HTEXTURE hBar) { ASSERT(hBar); if (!hBar) return; m_Bar = hBar; float u[4] = {0.0f, 0.25f, 0.75f, 1.0f}; float v[3] = {0.0f, 0.5f, 1.0f}; for (int row = 0; row < 2; row++) { for (int col = 0; col < 3; col++) { int i = row*3+col; DrawPrimSetRGBA(m_Poly[i],0xFF, 0xFF, 0xFF, 0xFF); SetupQuadUVs(m_Poly[i], hBar, u[col],v[row], u[col+1] - u[col],v[row+1] - v[row]); } } m_bInitted = true; }
void CLoadingScreen::UpdateLayout() { float w = float(g_pInterfaceResMgr->GetScreenWidth()); float h = float(g_pInterfaceResMgr->GetScreenHeight()); //******************************************************************************* // Build Mission Title String m_MissionName.SetFont(g_CurrentLayout.m_sTitleFont); m_MissionName.SetBasePos(g_CurrentLayout.m_TitlePos); m_MissionName.SetColor(g_CurrentLayout.m_cTitleColor); m_MissionName.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_MissionName.SetDropShadow(1); //******************************************************************************* // Build Mission Level String m_LevelName.SetFont(g_CurrentLayout.m_sLevelFont); m_LevelName.SetBasePos(g_CurrentLayout.m_LevelPos); m_LevelName.SetColor(g_CurrentLayout.m_cLevelColor); m_LevelName.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_LevelName.SetDropShadow(1); //******************************************************************************* // Build Mission Briefing String LTRect2n rTemp = g_CurrentLayout.m_BriefingRect; if (IsMultiplayerGameClient()) { rTemp.Top() += (g_CurrentLayout.m_sBriefingFont.m_nHeight * 3 / 2); } m_Briefing.SetFont(g_CurrentLayout.m_sBriefingFont); m_Briefing.SetBasePos(rTemp.m_vMin); m_Briefing.SetColor(g_CurrentLayout.m_cBriefingColor); m_Briefing.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_Briefing.SetDropShadow(1); LTVector2n sz = g_CurrentLayout.m_BriefingRect.m_vMax - rTemp.m_vMin; m_Briefing.SetSize( sz ); m_Briefing.SetWordWrap(true); m_BriefingHeader.SetFont(g_CurrentLayout.m_sBriefingHeaderFont); m_BriefingHeader.SetBasePos(g_CurrentLayout.m_BriefingRect.m_vMin); m_BriefingHeader.SetColor(g_CurrentLayout.m_cBriefingColor); m_BriefingHeader.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_BriefingHeader.SetDropShadow(1); LTVector2n headerSz(g_CurrentLayout.m_BriefingRect.GetWidth(),g_CurrentLayout.m_sBriefingFont.m_nHeight); m_BriefingHeader.SetSize( sz ); //******************************************************************************* // Build Server Message String rTemp = g_CurrentLayout.m_ServerMsgRect; rTemp.Top() += (g_CurrentLayout.m_sServerMsgFont.m_nHeight * 3 / 2); m_ServerMsg.SetFont(g_CurrentLayout.m_sServerMsgFont); m_ServerMsg.SetBasePos(rTemp.m_vMin); m_ServerMsg.SetColor(g_CurrentLayout.m_cServerMsgColor); m_ServerMsg.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_ServerMsg.SetDropShadow(1); m_ServerMsg.SetClipping(true); sz = g_CurrentLayout.m_ServerMsgRect.m_vMax - rTemp.m_vMin; m_ServerMsg.SetSize( sz ); m_ServerMsg.SetWordWrap(true); m_ServerMsgHeader.SetFont(g_CurrentLayout.m_sServerMsgHeaderFont); m_ServerMsgHeader.SetBasePos(g_CurrentLayout.m_ServerMsgRect.m_vMin); m_ServerMsgHeader.SetColor(g_CurrentLayout.m_cServerMsgColor); m_ServerMsgHeader.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_ServerMsgHeader.SetDropShadow(1); headerSz = LTVector2n(g_CurrentLayout.m_ServerMsgRect.GetWidth(),g_CurrentLayout.m_sServerMsgFont.m_nHeight); m_ServerMsgHeader.SetSize( sz ); //******************************************************************************* // Build Mission Help String m_Help.SetFont(g_CurrentLayout.m_sHelpFont); m_Help.SetBasePos(g_CurrentLayout.m_HelpRect.m_vMin); m_Help.SetColor(g_CurrentLayout.m_cHelpColor); m_Help.SetWordWrap(true); sz = g_CurrentLayout.m_HelpRect.m_vMax - g_CurrentLayout.m_HelpRect.m_vMin; m_Help.SetSize(sz); m_Help.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_Help.SetDropShadow(1); //m_Help.Show(pProfile->m_bLoadScreenTips); m_hBackTexture.Load(g_CurrentLayout.m_sBackTexture.c_str()); LTVector2 vHalfTexel(0.5f / (float)w, 0.5f / (float)h); SetupQuadUVs(m_BackPoly, m_hBackTexture, -vHalfTexel.x, -vHalfTexel.y, 1.0f, 1.0f ); DrawPrimSetRGBA(m_BackPoly,argbWhite); // float offset = (w - float(g_pInterfaceResMgr->GetScreenHeight())) / 2.0f; // DrawPrimSetXYWH(m_BackPoly,0.0f,-offset,w,w); DrawPrimSetXYWH(m_BackPoly,-0.5f,-0.5f,w,h); uint8 nA; GET_ARGB(g_CurrentLayout.m_cContinueColor,nA,nR,nG,nB); if( IsMultiplayerGameClient() && !m_photo.empty() ) { m_hPhoto.Load(m_photo.c_str()); if (m_hPhoto) { SetupQuadUVs(m_photoPoly, m_hPhoto, 0.0f, 0.0f, 1.0f, 1.0f); DrawPrimSetRGBA(m_photoPoly,argbWhite); float fScale = g_pInterfaceResMgr->GetXRatio(); float fx = (float)g_CurrentLayout.m_PhotoRect.Left() * fScale; float fy = (float)g_CurrentLayout.m_PhotoRect.Top() * fScale; float fw = (float)(g_CurrentLayout.m_PhotoRect.GetWidth()) * fScale; float fh = (float)(g_CurrentLayout.m_PhotoRect.GetHeight()) * fScale; DrawPrimSetXYWH(m_photoPoly,fx,fy,fw,fh); } } else { m_hPhoto = NULL; } m_CurrentFileName.SetFont(g_CurrentLayout.m_sContentFont); m_CurrentFileName.SetBasePos(g_CurrentLayout.m_CurrentFileNamePos); m_CurrentFileName.SetColor(g_CurrentLayout.m_cContentColor); m_CurrentFileName.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_CurrentFileTime.SetFont(g_CurrentLayout.m_sContentFont); m_CurrentFileTime.SetBasePos(g_CurrentLayout.m_CurrentFileTimePos); m_CurrentFileTime.SetColor(g_CurrentLayout.m_cContentColor); m_CurrentFileTime.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_FilesLeft.SetFont(g_CurrentLayout.m_sContentFont); m_FilesLeft.SetBasePos(g_CurrentLayout.m_FilesLeftPos); m_FilesLeft.SetColor(g_CurrentLayout.m_cContentColor); m_FilesLeft.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_TotalTime.SetFont(g_CurrentLayout.m_sContentFont); m_TotalTime.SetBasePos(g_CurrentLayout.m_TotalTimePos); m_TotalTime.SetColor(g_CurrentLayout.m_cContentColor); m_TotalTime.SetScale(g_pInterfaceResMgr->GetScreenScale()); m_LoadProgress.Init(g_CurrentLayout.m_hLoadProgressTexture); m_CurrentFile.Init(g_CurrentLayout.m_hContentTexture); m_Total.Init(g_CurrentLayout.m_hContentTexture); m_rfLoadProgress.Init( g_CurrentLayout.m_LoadProgressRect.Left() * g_pInterfaceResMgr->GetXRatio(), g_CurrentLayout.m_LoadProgressRect.Top() * g_pInterfaceResMgr->GetYRatio(), g_CurrentLayout.m_LoadProgressRect.Right() * g_pInterfaceResMgr->GetXRatio(), g_CurrentLayout.m_LoadProgressRect.Bottom() * g_pInterfaceResMgr->GetYRatio() ); m_rfCurrentFile.Init( g_CurrentLayout.m_CurrentFileRect.Left() * g_pInterfaceResMgr->GetXRatio(), g_CurrentLayout.m_CurrentFileRect.Top() * g_pInterfaceResMgr->GetYRatio(), g_CurrentLayout.m_CurrentFileRect.Right() * g_pInterfaceResMgr->GetXRatio(), g_CurrentLayout.m_CurrentFileRect.Bottom() * g_pInterfaceResMgr->GetYRatio() ); m_rfTotal.Init( g_CurrentLayout.m_TotalRect.Left() * g_pInterfaceResMgr->GetXRatio(), g_CurrentLayout.m_TotalRect.Top() * g_pInterfaceResMgr->GetYRatio(), g_CurrentLayout.m_TotalRect.Right() * g_pInterfaceResMgr->GetXRatio(), g_CurrentLayout.m_TotalRect.Bottom() * g_pInterfaceResMgr->GetYRatio() ); if (g_CurrentLayout.m_hContentFrameTexture) { CLTGUICtrl_create cs; cs.rnBaseRect = g_CurrentLayout.m_ContentFrameRect; m_ContentFrame.Create(g_CurrentLayout.m_hContentFrameTexture,cs); m_ContentFrame.SetScale(g_pInterfaceResMgr->GetScreenScale()); } };
LTBOOL CBaseMenu::Init() { if (!s_Frame) { char szTmp[128] = ""; g_pLayoutMgr->GetMenuFrame(szTmp,sizeof(szTmp)); s_Frame = g_pInterfaceResMgr->GetTexture(szTmp); g_pLayoutMgr->GetMenuFrameTip(szTmp,sizeof(szTmp)); s_FrameTip = g_pInterfaceResMgr->GetTexture(szTmp); s_Size = g_pLayoutMgr->GetMenuSize(); s_Pos = g_pLayoutMgr->GetMenuPosition(); g_pLayoutMgr->GetMenuUpArrow(szTmp,sizeof(szTmp)); s_Up = g_pInterfaceResMgr->GetTexture(szTmp); g_pLayoutMgr->GetMenuUpArrowHighlight(szTmp,sizeof(szTmp)); s_UpH = g_pInterfaceResMgr->GetTexture(szTmp); g_pLayoutMgr->GetMenuDownArrow(szTmp,sizeof(szTmp)); s_Down = g_pInterfaceResMgr->GetTexture(szTmp); g_pLayoutMgr->GetMenuDownArrowHighlight(szTmp,sizeof(szTmp)); s_DownH = g_pInterfaceResMgr->GetTexture(szTmp); } m_FontFace = g_pLayoutMgr->GetMenuFontFace(m_MenuID); m_FontSize = g_pLayoutMgr->GetMenuFontSize(m_MenuID); m_TitleFontFace = g_pLayoutMgr->GetMenuTitleFontFace(m_MenuID); m_TitleFontSize = g_pLayoutMgr->GetMenuTitleFontSize(m_MenuID); m_Indent = g_pLayoutMgr->GetMenuIndent(m_MenuID); m_SelectedColor = g_pLayoutMgr->GetMenuSelectedColor(m_MenuID); m_NonSelectedColor = g_pLayoutMgr->GetMenuNonSelectedColor(m_MenuID); m_DisabledColor = g_pLayoutMgr->GetMenuDisabledColor(m_MenuID); if (!Create(NULL,s_Size.x,s_Size.y)) return LTFALSE; SetupQuadUVs(m_Poly[0], s_Frame, 0.0f,0.0f,1.0f,1.0f); SetupQuadUVs(m_Poly[1], s_FrameTip, 0.0f,0.0f,1.0f,1.0f); g_pDrawPrim->SetRGBA(&m_Poly[0],argbWhite); g_pDrawPrim->SetRGBA(&m_Poly[1],argbWhite); LTIntPt pos = m_Indent; CUIFont* pFont = g_pInterfaceResMgr->GetFont(m_TitleFontFace); if (!pFont) return LTFALSE; if (!m_Title.Create("X", LTNULL, LTNULL, pFont, m_TitleFontSize, this)) { return LTFALSE; } m_Title.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor); m_Title.Enable(LTFALSE); pos.x = m_Indent.x + 24; CLTGUIWindow::AddControl(&m_Title,pos); m_Title.SetScale(1.0f); pos.x = m_Indent.x; pos.y += (m_Title.GetHeight() + 4); m_Title.SetScale(g_pInterfaceResMgr->GetXRatio()); m_List.Create(s_Size.y - pos.y); uint16 nOffset = (s_Size.x-m_Indent.x*2)-16; m_List.UseArrows(nOffset ,1.0f,s_Up,s_UpH,s_Down,s_DownH); CLTGUIWindow::AddControl(&m_List,pos); m_Resume.Create(LoadTempString(IDS_RESUME),MC_CLOSE,NULL,pFont,m_TitleFontSize,this); pos.x = s_Size.x - m_Indent.x - m_Resume.GetWidth(); pos.y = 12; CLTGUIWindow::AddControl(&m_Resume,pos); pos.x = s_Pos; pos.y = 0; SetBasePos(pos); return LTTRUE; }
void CHUDBar::Update(float x,float y, float fillW, float maxW, float h) { float capW = h/2.0f; float barW = LTMAX(maxW - (2.0f * capW),0.0f); float barLeft = x + capW; float barRight = barLeft + barW; if (fillW < capW) { //width of bar is lass than endcap width //draw partial left endcap float capUw = (fillW/capW) / 4.0f; DrawPrimSetXYWH(m_Poly[0],x,y,fillW,h); SetupQuadUVs(m_Poly[0], m_Bar, 0.0f,0.0f,capUw,0.5f); DrawPrimSetXYWH(m_Poly[3],x+fillW,y,(capW-fillW),h); SetupQuadUVs(m_Poly[3], m_Bar, capUw,0.5f,0.25f-capUw,0.5f); //hide full armor bars and right endcap DrawPrimSetXYWH(m_Poly[1],-1.0f,-1.0f,0.0f,0.0f); DrawPrimSetXYWH(m_Poly[2],-1.0f,-1.0f,0.0f,0.0f); //draw empty armor bars and right endcap DrawPrimSetXYWH(m_Poly[4],barLeft,y, barW,h); DrawPrimSetXYWH(m_Poly[5],barRight,y, capW,h); SetupQuadUVs(m_Poly[5], m_Bar, 0.75f,0.5f,0.25f,0.5f); } else { //draw full left endcap DrawPrimSetXYWH(m_Poly[0],x,y,capW,h); SetupQuadUVs(m_Poly[0], m_Bar, 0.0f,0.0f,0.25f,0.5f); DrawPrimSetXYWH(m_Poly[3],-1.0f,-1.0f,0.0f,0.0f); SetupQuadUVs(m_Poly[3], m_Bar, 0.0f,0.5f,0.25f,0.5f); if (fillW < (capW + barW) ) { x += fillW; //draw partial bar DrawPrimSetXYWH(m_Poly[1],barLeft,y,x-barLeft,h); DrawPrimSetXYWH(m_Poly[4],x,y,barRight-x,h); //draw empty right endcap DrawPrimSetXYWH(m_Poly[2],-1.0f,-1.0f,0.0f,0.0f); DrawPrimSetXYWH(m_Poly[5],barRight,y, capW,h); SetupQuadUVs(m_Poly[5], m_Bar, 0.75f,0.5f,0.25f,0.5f); } else { //draw full bar DrawPrimSetXYWH(m_Poly[1],barLeft,y, barW,h); DrawPrimSetXYWH(m_Poly[4],-1.0f,-1.0f,0.0f,0.0f); if (fillW < maxW) { //draw partial right endcap float partW = maxW - fillW; float capUw = (partW/capW) / 4.0f; DrawPrimSetXYWH(m_Poly[2],barRight,y, capW-partW,h); SetupQuadUVs(m_Poly[2], m_Bar, 0.75f,0.0f,0.25f-capUw,0.5f); DrawPrimSetXYWH(m_Poly[5],x+fillW,y,partW,h); SetupQuadUVs(m_Poly[5], m_Bar, 1.0f-capUw,0.5f,capUw,0.5f); } else { //draw full right endcap DrawPrimSetXYWH(m_Poly[2],barRight,y, capW,h); SetupQuadUVs(m_Poly[2], m_Bar, 0.75f,0.0f,0.25f,0.5f); DrawPrimSetXYWH(m_Poly[5],-1.0f,-1.0f,0.0f,0.0f); } } } }
void CLoadingScreen::UpdateMissionInfo() { // No need to update mission info if a different screen is being rendered... if( m_pRenderScreen ) return; EnterCriticalSection(&m_MissionUpdate); if( !g_pMissionMgr->IsCustomLevel( )) { int nCurMission = g_pMissionMgr->GetCurrentMission( ); MISSION* pMission = g_pMissionButeMgr->GetMission( nCurMission ); if( pMission ) { if (pMission->nNameId > 0) m_missionname = LoadTempString(pMission->nNameId); else m_missionname = pMission->sName; int nCurLevel = g_pMissionMgr->GetCurrentLevel( ); m_levelname = LoadTempString( pMission->aLevels[nCurLevel].nNameId ); // Show a briefing for this level if it exists. Also, only // show the briefing if we haven't been to this level before. int nBriefingId = pMission->aLevels[nCurLevel].nBriefingId; if( nBriefingId >= 0 && !g_pMissionMgr->IsRestoringLevel( )) m_briefing = LoadTempString( nBriefingId ); else m_briefing = ""; // Show help text for this level if it exists. int nHelpId = pMission->aLevels[nCurLevel].nHelpId; if( nHelpId >= 0) m_help = LoadTempString( nHelpId ); else m_help = ""; if( !IsCoopMultiplayerGameType( )) { m_photo = pMission->sPhoto; } } } m_pMissionNameStr->SetText(m_missionname.c_str()); m_pLevelNameStr->SetText(m_levelname.c_str()); m_pHelpStr->SetText(m_help.c_str()); if (g_pGameClientShell->IsRunningPerformanceTest()) { m_pBriefingStr->SetText(LoadTempString( IDS_PERFORMANCE_TEST_BRIEF )); } else { m_pBriefingStr->SetText(m_briefing.c_str()); } if( !IsCoopMultiplayerGameType() && !m_photo.empty()) { m_hFrame = g_pInterfaceResMgr->GetTexture(m_photo.c_str()); if (m_hFrame) { SetupQuadUVs(m_photoPoly, m_hFrame, 0.0f, 0.0f, 1.0f, 0.75f); g_pDrawPrim->SetRGBA(&m_photoPoly,argbWhite); float fScale = g_pInterfaceResMgr->GetXRatio(); float fx = (float)m_DefaultPhotoRect.left * fScale; float fy = (float)m_DefaultPhotoRect.top * fScale; float fw = (float)(m_DefaultPhotoRect.right - m_DefaultPhotoRect.left) * fScale; float fh = (float)(m_DefaultPhotoRect.bottom - m_DefaultPhotoRect.top) * fScale; g_pDrawPrim->SetXYWH(&m_photoPoly,fx,fy,fw,fh); } } else { m_hFrame = LTNULL; } LeaveCriticalSection(&m_MissionUpdate); }
LTBOOL CLoadingScreen::Init() { if (m_eCurState != STATE_NONE) return LTFALSE; if( m_pRenderScreen ) { // Just let the render screen know it is about to be draw and set the state to init... m_pRenderScreen->OnFocus( true ); m_eCurState = STATE_INIT; return LTTRUE; } m_photo = ""; // Check if we have a mission entry. bool bGotMission = false; if( !g_pMissionMgr->IsCustomLevel( )) { int nCurMission = g_pMissionMgr->GetCurrentMission( ); MISSION* pMission = g_pMissionButeMgr->GetMission( nCurMission ); if( pMission ) { if (pMission->nNameId > 0) m_missionname = LoadTempString(pMission->nNameId); else m_missionname = pMission->sName; int nCurLevel = g_pMissionMgr->GetCurrentLevel( ); m_levelname = LoadTempString( pMission->aLevels[nCurLevel].nNameId ); m_layout = pMission->szLayout; //set the post load layout here, so that it matches // even when our mission info is updated partway through the load CScreenPostload *pPostload = (CScreenPostload *) (g_pInterfaceMgr->GetScreenMgr( )->GetScreenFromID(SCREEN_ID_POSTLOAD)); if (pPostload) { pPostload->SetLayout(pMission->szLayout); } // Show a briefing for this level if it exists. Also, only // show the briefing if we haven't been to this level before. int nBriefingId = pMission->aLevels[nCurLevel].nBriefingId; if( nBriefingId >= 0 && !g_pMissionMgr->IsRestoringLevel( )) { m_briefing = LoadTempString( nBriefingId ); m_layout = pMission->szBriefLayout; if (pPostload) { pPostload->SetLayout(pMission->szBriefLayout); } } else m_briefing = ""; // Show help text for this level if it exists. int nHelpId = pMission->aLevels[nCurLevel].nHelpId; if( nHelpId >= 0) { m_help = LoadTempString( nHelpId ); if (pPostload) { pPostload->SetLayout(pMission->szBriefLayout); } } else m_help = ""; if( !IsCoopMultiplayerGameType( )) { m_photo = pMission->sPhoto; } bGotMission = true; } } // If we were unsuccessful in getting info from the mission, then just // use defaults. if( !bGotMission ) { // If connecting to a remote server, set our mission descriptor to // the ip we're connecting to. if( g_pClientMultiplayerMgr->IsConnectedToRemoteServer( )) { // Make a loading string using the IP to be joined. char szLoadingString[256]; if (strlen(g_pClientMultiplayerMgr->GetStartGameRequest( ).m_HostInfo.m_sName)) { sprintf( szLoadingString, "%s: %s", LoadTempString(IDS_CONNECTING_TO_SERVER), g_pClientMultiplayerMgr->GetStartGameRequest( ).m_HostInfo.m_sName ); } else { sprintf( szLoadingString, "%s", LoadTempString(IDS_CONNECTING_TO_SERVER)); } m_missionname = szLoadingString; sprintf( szLoadingString, " (%s)", g_pClientMultiplayerMgr->GetStartGameRequest( ).m_TCPAddress ); m_levelname = szLoadingString; } // Local game, set the mission descriptor to the level name. else { if (g_pGameClientShell->IsRunningPerformanceTest()) { m_missionname = LoadTempString( IDS_TITLE_PERFORMANCE_TEST ); m_levelname = ""; } else { m_missionname = LoadTempString( IDS_CUSTOM_LEVEL ); // Split the worldname up into parts so we can get the load string. char const* pszWorldName = g_pMissionMgr->GetCurrentWorldName( ); char szWorldTitle[MAX_PATH] = ""; _splitpath( pszWorldName, NULL, NULL, szWorldTitle, NULL ); m_levelname = szWorldTitle; } } m_layout = "LoadScreenDefault"; m_briefing = ""; m_help = ""; } char szTagName[30]; if (!m_bReadLayout) { m_bReadLayout = true; SAFE_STRCPY(szTagName,"LoadScreenDefault"); //default layout info title string m_DefaultTitlePos = g_pLayoutMgr->GetPoint(szTagName,"TitlePos"); m_nDefaultTitleFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleFont"); m_nDefaultTitleFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleSize"); LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "TitleColor"); uint8 nR = (uint8)vColor.x; uint8 nG = (uint8)vColor.y; uint8 nB = (uint8)vColor.z; m_nDefaultTitleColor = SET_ARGB(0xFF,nR,nG,nB); //default layout info title string m_DefaultLevelPos = g_pLayoutMgr->GetPoint(szTagName,"LevelPos"); m_nDefaultLevelFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelFont"); m_nDefaultLevelFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelSize"); vColor = g_pLayoutMgr->GetVector(szTagName, "LevelColor"); nR = (uint8)vColor.x; nG = (uint8)vColor.y; nB = (uint8)vColor.z; m_nDefaultLevelColor = SET_ARGB(0xFF,nR,nG,nB); //default layout info mission briefing string LTRect rect = g_pLayoutMgr->GetRect(szTagName,"BriefingRect"); m_DefaultBriefingPos = LTIntPt(rect.left,rect.top); m_nDefaultBriefingWidth = (rect.right - rect.left); m_nDefaultBriefingFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingFont"); m_nDefaultBriefingFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingSize"); vColor = g_pLayoutMgr->GetVector(szTagName, "BriefingColor"); nR = (uint8)vColor.x; nG = (uint8)vColor.y; nB = (uint8)vColor.z; m_nDefaultBriefingColor = SET_ARGB(0xFF,nR,nG,nB); //default layout info mission help string rect = g_pLayoutMgr->GetRect(szTagName,"HelpRect"); m_DefaultHelpPos = LTIntPt(rect.left,rect.top); m_nDefaultHelpWidth = (rect.right - rect.left); m_nDefaultHelpFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpFont"); m_nDefaultHelpFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpSize"); vColor = g_pLayoutMgr->GetVector(szTagName, "HelpColor"); nR = (uint8)vColor.x; nG = (uint8)vColor.y; nB = (uint8)vColor.z; m_nDefaultHelpColor = SET_ARGB(0xFF,nR,nG,nB); m_DefaultPhotoRect = g_pLayoutMgr->GetRect(szTagName,"PhotoRect"); } //Setup title string LTIntPt TitlePos = m_DefaultTitlePos; uint8 TitleFont = m_nDefaultTitleFont; uint8 TitleFontSize = m_nDefaultTitleFontSize; uint32 TitleColor = m_nDefaultTitleColor; LTIntPt LevelPos = m_DefaultLevelPos; uint8 LevelFont = m_nDefaultLevelFont; uint8 LevelFontSize = m_nDefaultLevelFontSize; uint32 LevelColor = m_nDefaultLevelColor; LTIntPt BriefingPos = m_DefaultBriefingPos; uint16 BriefingWidth = m_nDefaultBriefingWidth; uint8 BriefingFont = m_nDefaultBriefingFont; uint8 BriefingFontSize = m_nDefaultBriefingFontSize; uint32 BriefingColor = m_nDefaultBriefingColor; LTIntPt HelpPos = m_DefaultHelpPos; uint16 HelpWidth = m_nDefaultHelpWidth; uint8 HelpFont = m_nDefaultHelpFont; uint8 HelpFontSize = m_nDefaultHelpFontSize; uint32 HelpColor = m_nDefaultHelpColor; //******************************************************************************* // Build Mission Name String // look for override values SAFE_STRCPY(szTagName,m_layout.c_str()); if (g_pLayoutMgr->Exist(szTagName)) { //override layout info title string if (g_pLayoutMgr->HasValue(szTagName,"TitlePos")) TitlePos = g_pLayoutMgr->GetPoint(szTagName,"TitlePos"); if (g_pLayoutMgr->HasValue(szTagName,"TitleFont")) TitleFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleFont"); if (g_pLayoutMgr->HasValue(szTagName,"TitleSize")) TitleFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleSize"); if (g_pLayoutMgr->HasValue(szTagName,"TitleColor")) { LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "TitleColor"); uint8 nR = (uint8)vColor.x; uint8 nG = (uint8)vColor.y; uint8 nB = (uint8)vColor.z; TitleColor = SET_ARGB(0xFF,nR,nG,nB); } //override layout info Level string if (g_pLayoutMgr->HasValue(szTagName,"LevelPos")) LevelPos = g_pLayoutMgr->GetPoint(szTagName,"LevelPos"); if (g_pLayoutMgr->HasValue(szTagName,"LevelFont")) LevelFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelFont"); if (g_pLayoutMgr->HasValue(szTagName,"LevelSize")) LevelFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelSize"); if (g_pLayoutMgr->HasValue(szTagName,"LevelColor")) { LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "LevelColor"); uint8 nR = (uint8)vColor.x; uint8 nG = (uint8)vColor.y; uint8 nB = (uint8)vColor.z; LevelColor = SET_ARGB(0xFF,nR,nG,nB); } } uint8 nFontSize = (uint8)((float)TitleFontSize * g_pInterfaceResMgr->GetXRatio()); CUIFont *pFont = g_pInterfaceResMgr->GetFont(TitleFont); if (!m_pMissionNameStr) { m_pMissionNameStr = g_pFontManager->CreateFormattedPolyString(pFont,""); } m_pMissionNameStr->SetColor(TitleColor); m_pMissionNameStr->SetText(m_missionname.c_str()); m_pMissionNameStr->SetCharScreenHeight(nFontSize); float x = (float)TitlePos.x * g_pInterfaceResMgr->GetXRatio(); float y = (float)TitlePos.y * g_pInterfaceResMgr->GetYRatio(); m_pMissionNameStr->SetPosition(x,y); nFontSize = (uint8)((float)LevelFontSize * g_pInterfaceResMgr->GetXRatio()); pFont = g_pInterfaceResMgr->GetFont(LevelFont); if (!m_pLevelNameStr) { m_pLevelNameStr = g_pFontManager->CreateFormattedPolyString(pFont,""); } m_pLevelNameStr->SetColor(LevelColor); m_pLevelNameStr->SetText(m_levelname.c_str()); m_pLevelNameStr->SetCharScreenHeight(nFontSize); x = (float)LevelPos.x * g_pInterfaceResMgr->GetXRatio(); y = (float)LevelPos.y * g_pInterfaceResMgr->GetYRatio(); m_pLevelNameStr->SetPosition(x,y); //******************************************************************************* // Build Mission Briefing String //look for override values if (g_pLayoutMgr->Exist(szTagName)) { //default layout info mission briefing string if (g_pLayoutMgr->HasValue(szTagName,"BriefingRect")) { LTRect rect = g_pLayoutMgr->GetRect(szTagName,"BriefingRect"); BriefingPos = LTIntPt(rect.left,rect.top); BriefingWidth = (rect.right - rect.left); } if (g_pLayoutMgr->HasValue(szTagName,"BriefingFont")) BriefingFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingFont"); if (g_pLayoutMgr->HasValue(szTagName,"BriefingSize")) BriefingFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingSize"); if (g_pLayoutMgr->HasValue(szTagName,"BriefingColor")) { LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "BriefingColor"); uint8 nR = (uint8)vColor.x; uint8 nG = (uint8)vColor.y; uint8 nB = (uint8)vColor.z; BriefingColor = SET_ARGB(0xFF,nR,nG,nB); } } nFontSize = (uint8)((float)BriefingFontSize * g_pInterfaceResMgr->GetXRatio()); pFont = g_pInterfaceResMgr->GetFont(BriefingFont); if (!m_pBriefingStr) { m_pBriefingStr = g_pFontManager->CreateFormattedPolyString(pFont,""); } if (g_pGameClientShell->IsRunningPerformanceTest()) { m_pBriefingStr->SetText(LoadTempString( IDS_PERFORMANCE_TEST_BRIEF )); } else { m_pBriefingStr->SetText(m_briefing.c_str()); } m_pBriefingStr->SetColor(BriefingColor); m_pBriefingStr->SetCharScreenHeight(nFontSize); x = (float)BriefingPos.x * g_pInterfaceResMgr->GetXRatio(); y = (float)BriefingPos.y * g_pInterfaceResMgr->GetYRatio(); m_pBriefingStr->SetPosition(x,y); m_pBriefingStr->SetWrapWidth((uint16)(g_pInterfaceResMgr->GetXRatio() * (float)BriefingWidth)); //******************************************************************************* // Build Mission Help String //look for override values if (g_pLayoutMgr->Exist(szTagName)) { //default layout info mission briefing string if (g_pLayoutMgr->HasValue(szTagName,"HelpRect")) { LTRect rect = g_pLayoutMgr->GetRect(szTagName,"HelpRect"); HelpPos = LTIntPt(rect.left,rect.top); HelpWidth = (rect.right - rect.left); } if (g_pLayoutMgr->HasValue(szTagName,"HelpFont")) HelpFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpFont"); if (g_pLayoutMgr->HasValue(szTagName,"HelpSize")) HelpFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpSize"); if (g_pLayoutMgr->HasValue(szTagName,"HelpColor")) { LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "HelpColor"); uint8 nR = (uint8)vColor.x; uint8 nG = (uint8)vColor.y; uint8 nB = (uint8)vColor.z; HelpColor = SET_ARGB(0xFF,nR,nG,nB); } } nFontSize = (uint8)((float)HelpFontSize * g_pInterfaceResMgr->GetXRatio()); pFont = g_pInterfaceResMgr->GetFont(HelpFont); if (!m_pHelpStr) { m_pHelpStr = g_pFontManager->CreateFormattedPolyString(pFont,""); } CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile(); if (pProfile->m_bLoadScreenTips) { m_pHelpStr->SetText(m_help.c_str()); m_pHelpStr->SetColor(HelpColor); m_pHelpStr->SetCharScreenHeight(nFontSize); x = (float)HelpPos.x * g_pInterfaceResMgr->GetXRatio(); y = (float)HelpPos.y * g_pInterfaceResMgr->GetYRatio(); m_pHelpStr->SetPosition(x,y); m_pHelpStr->SetWrapWidth((uint16)(g_pInterfaceResMgr->GetXRatio() * (float)HelpWidth)); } else { m_pHelpStr->SetText(""); } if( !IsCoopMultiplayerGameType() && !m_photo.empty() ) { m_hFrame = g_pInterfaceResMgr->GetTexture(m_photo.c_str()); if (m_hFrame) { SetupQuadUVs(m_photoPoly, m_hFrame, 0.0f, 0.0f, 1.0f, 0.75f); g_pDrawPrim->SetRGBA(&m_photoPoly,argbWhite); float fScale = g_pInterfaceResMgr->GetXRatio(); float fx = (float)m_DefaultPhotoRect.left * fScale; float fy = (float)m_DefaultPhotoRect.top * fScale; float fw = (float)(m_DefaultPhotoRect.right - m_DefaultPhotoRect.left) * fScale; float fh = (float)(m_DefaultPhotoRect.bottom - m_DefaultPhotoRect.top) * fScale; g_pDrawPrim->SetXYWH(&m_photoPoly,fx,fy,fw,fh); } } else { m_hFrame = LTNULL; } CreateInterfaceSFX(); // Reset the frame counter m_nFrameCounter = 0; m_fLastFrameTime = CWinUtil::GetTime(); m_fCurFrameDelta = 0.0f; m_eCurState = STATE_INIT; return LTTRUE; }