// 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 CHUDRewardMsgQueue::UpdateLayout() { m_bTopJustify = LTFALSE; char *pTag = "RewardMessageQueue"; m_BasePos = g_pLayoutMgr->GetPoint(pTag,"BasePos"); uint8 nFont = (uint8)g_pLayoutMgr->GetInt(pTag,"Font"); m_MsgFormat.pFont = g_pInterfaceResMgr->GetFont(nFont); m_MsgFormat.nFontSize = (uint8)g_pLayoutMgr->GetInt(pTag,"FontSize"); m_MsgFormat.nTextColor = argbWhite; m_MsgFormat.fDuration = g_pLayoutMgr->GetFloat(pTag,"MessageTime"); m_MsgFormat.fFadeDur = g_pLayoutMgr->GetFloat(pTag,"MessageFade"); m_MsgFormat.nWidth = (uint16) g_pLayoutMgr->GetInt(pTag,"Width"); m_nMaxActiveMsgs = (uint8)g_pLayoutMgr->GetInt(pTag,"MaxMessages"); m_nMaxHistoryMsgs = (uint8)g_pLayoutMgr->GetInt(pTag,"MaxHistory"); LTVector vCol = g_pLayoutMgr->GetVector(pTag,"TextColor"); uint8 nR = (uint8)vCol.x; uint8 nG = (uint8)vCol.y; uint8 nB = (uint8)vCol.z; m_nMsgColors[kMsgDefault] = SET_ARGB(0xFF,nR,nG,nB); }
void CScreenCrosshair::SetConsoleVariables() { CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile(); pProfile->m_CrosshairR = (uint8)m_nColorR; pProfile->m_CrosshairG = (uint8)m_nColorG; pProfile->m_CrosshairB = (uint8)m_nColorB; pProfile->m_nStyle = m_nStyle; pProfile->m_bDynamic = m_bDynamic; pProfile->ApplyCrosshair(); uint32 th; m_hCrosshair = g_pInterfaceResMgr->GetTexture(m_styles[m_nStyle].c_str()); 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); }
LTBOOL CHUDRadar::Init() { UpdateLayout(); g_pDrawPrim->SetRGBA( &teamPoly, SET_ARGB(0x7F,0xFF,0xFF,0xFF)); return LTTRUE; }
void CHUDMessage::SetAlpha(float fAlpha) { if (fAlpha < 0.0f) fAlpha = 0.0f; if (fAlpha > 1.0f) fAlpha = 1.0f; m_fAlpha = fAlpha; uint32 a,r,g,b; GET_ARGB(m_nTextColor,a,r,g,b); a = (uint8)(255.0f * fAlpha); m_nTextColor = SET_ARGB(a,r,g,b); if (m_pText) m_pText->SetColor(m_nTextColor); uint32 c = SET_ARGB(a,255,255,255); g_pDrawPrim->SetRGBA(&m_Poly,c); }
LTBOOL CMenuMission::Init() { m_MenuID = MENU_ID_MISSION; if (!CBaseMenu::Init()) return LTFALSE; SetTitle(IDS_TITLE_BRIEFING); uint16 nWidth = s_Size.x - 2*m_Indent.x; uint8 nMissSize = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"MissionFontSize"); uint16 ndx = AddControl("<mission name>",0,LTTRUE); m_pNameCtrl = (CLTGUITextCtrl *)m_List.GetControl(ndx); m_pNameCtrl->SetFont(NULL,nMissSize); m_pNameCtrl->SetFixedWidth(nWidth); uint8 nLevSize = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"LevelFontSize"); nWidth -= nLevSize; ndx = AddControl("<level name>",0,LTTRUE); m_pLevelCtrl = (CLTGUITextCtrl *)m_List.GetControl(ndx); m_pLevelCtrl->SetFont(NULL,nLevSize); m_pLevelCtrl->SetIndent(nLevSize); m_pLevelCtrl->SetFixedWidth(nWidth); AddControl(" ",0,LTTRUE); nObjSize = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"ObjectiveFontSize"); m_nFirstObj = m_List.GetNumControls(); m_List.SetItemSpacing(4); m_List.SetScrollByPage(LTTRUE); g_pInterfaceMgr->GetMenuMgr()->RegisterCommand(COMMAND_ID_MISSION,MENU_ID_MISSION); LTVector vColor = g_pLayoutMgr->GetMenuCustomVector(m_MenuID,"CompletedColor"); uint8 nA = 255; uint8 nR = (uint8)vColor.x; uint8 nG = (uint8)vColor.y; uint8 nB = (uint8)vColor.z; argbCompleted = SET_ARGB(nA,nR,nG,nB); LoadString(IDS_OBJECTIVES_OPTIONAL,szOptional,sizeof(szOptional)); m_BulletTex = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\bullet.dtx"); m_CompletedTex = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\completed.dtx"); return LTTRUE; }
void CHUDDistance::Render() { if (!m_bDraw) return; if( m_bFadeOut ) { m_fAlpha += g_pGameClientShell->GetFrameTime() * m_fFadeIncrement; if( m_fAlpha <= 0.0f ) { m_bFadeOut = false; m_bDraw = false; m_fAlpha = 0.0f; m_nFadeDir = 1; } } else if( m_bBlink ) { m_fAlpha += g_pGameClientShell->GetFrameTime() * m_fFadeIncrement; if (m_fAlpha < 0.0f) { m_fAlpha = 0.0f; m_nFadeDir = 1; } if (m_fAlpha > m_fMaxAlpha) { m_fAlpha = m_fMaxAlpha; m_nFadeDir = -1; } m_fFadeIncrement = m_nFadeDir * m_fBlinkSpeed * m_fDistPercent; } uint8 a = (uint8)( 255.0f * m_fAlpha ); uint32 color = SET_ARGB(a,0xFF,0xFF,0xFF); g_pDrawPrim->SetRGBA(&m_Poly,color); SetRenderState(); // draw our icons g_pDrawPrim->SetTexture(m_hIcon); g_pDrawPrim->DrawPrim(&m_Poly,1); }
LTBOOL CCredit::UpdateFadeIn() { // Update the timer value... LTFLOAT fDelta = g_pGameClientShell->GetFrameTime(); fDelta *= CCredits::GetSpeed(); if (s_bPause) fDelta = 0.0f; if (m_fTimer > fDelta) { m_fTimer -= fDelta; } else { m_fTimer = 0.0f; } // set the alpha... m_fAlpha = 1.0f - (m_fTimer / m_fTimerStart); if (m_fAlpha < 0.0f) m_fAlpha = 0.0f; if (m_fAlpha > 1.0f) m_fAlpha = 1.0f; uint8 a = (uint8)( 255.0f * m_fAlpha ); uint32 color = SET_ARGB(a,0xFF,0xFF,0xFF); FPStringArray::iterator iter = m_Strings.begin(); while (iter != m_Strings.end()) { (*iter)->SetColor(argbWhite); iter++; } // Draw the credit... Draw(); // All done... return(m_fTimer == 0.0f); }
void CHUDDamageDir::Update() { if (m_nSize <= 0) { m_bDraw = LTFALSE; return; } if (m_fScale != g_pInterfaceResMgr->GetXRatio()) UpdateScale(); float fAlphaRange = g_vtDamageMaxAlpha.GetFloat() - g_vtDamageMinAlpha.GetFloat(); float fDamTotal = 0.0f; for (uint8 i = 0; i < kNumDamageSectors; i++) { float fDam = g_pPlayerMgr->GetDamageFromSector(i); fDam = LTCLAMP( fDam, 0.0f, 1.0f ); if (g_vtDamageShowAll.GetFloat() > 0.0f && fDam < 0.1f) fDam = 0.1f; fDamTotal += fDam; uint8 nAlpha = 0; if (fDam > 0.0f) { float fA = g_vtDamageMinAlpha.GetFloat() + fDam * fAlphaRange; nAlpha = (uint8) (fA * 255.0f); } uint32 argbCol = SET_ARGB(nAlpha,255,255,255); g_pDrawPrim->SetRGBA(&m_Poly[i],argbCol); } m_bDraw = (fDamTotal > 0.0f); }
void CHUDMissionText::UpdateLayout() { char *pTag = "MissionText"; m_BasePos = g_pLayoutMgr->GetPoint(pTag,"Pos"); uint8 nFont = (uint8)g_pLayoutMgr->GetInt(pTag,"Font"); m_pFont = g_pInterfaceResMgr->GetFont(nFont); m_nFontSize = m_nBaseFontSize = (uint8)g_pLayoutMgr->GetInt(pTag,"FontSize"); float x = m_fScale * (float)m_BasePos.x; float y = m_fScale * (float)m_BasePos.y; m_pText = g_pFontManager->CreateFormattedPolyString(m_pFont," ",x,y); if (!m_pText) return; m_nWidth = (uint16)g_pLayoutMgr->GetInt(pTag,"Width"); m_pText->SetWrapWidth(m_nWidth); m_Format.text = m_pText; LTVector vCol = g_pLayoutMgr->GetVector(pTag,"TextColor"); uint8 nR = (uint8)vCol.x; uint8 nG = (uint8)vCol.y; uint8 nB = (uint8)vCol.z; m_Format.color = SET_ARGB(0xFF,nR,nG,nB); m_Format.useDroppedShadow = LTTRUE; m_Format.numberOfLinesBeforeScroll = g_pLayoutMgr->GetInt(pTag,"NumLines"); m_Format.clipRect = NULL; m_Format.initialDelay = 0.0f; m_Format.characterDelay = g_pLayoutMgr->GetFloat(pTag,"LetterDelay"); m_Format.lineDelay = g_pLayoutMgr->GetFloat(pTag,"LineDelay"); m_Format.scrollTime = g_pLayoutMgr->GetFloat(pTag,"LineScrollTime"); m_Format.completeDelay = g_pLayoutMgr->GetFloat(pTag,"FadeDelay"); m_Format.fadeTime = g_pLayoutMgr->GetFloat(pTag,"FadeTime"); g_pLayoutMgr->GetString(pTag,"TypeSound",m_Format.textDisplaySound, TIMED_TEXT_SOUND_NAME_LENGTH ); g_pLayoutMgr->GetString(pTag,"ScrollSound",m_Format.scrollSound, TIMED_TEXT_SOUND_NAME_LENGTH ); }
void CHUDScores::Render() { if( !m_bInitialized ) return; if ( !m_bDraw ) return; if (!m_bScreen) { LTPoly_G4 back; DrawPrimSetRGBA(back, SET_ARGB(0xB0,0,0,0)); DrawPrimSetXYWH(back,0.0f,0.0f,(float)g_pInterfaceResMgr->GetScreenWidth(),(float)g_pInterfaceResMgr->GetScreenHeight()); g_pDrawPrim->DrawPrim(&back,1); } if (m_bControlsInited) { if (!m_bScreen && !GameModeMgr::Instance( ).m_grbUseTeams) m_SingleFrame.Render(); for (int team = 0; team < kNumTeams; team++) { if (GameModeMgr::Instance( ).m_grbUseTeams) { m_Frame[team].Render(); m_Team[team].Render(); m_Rounds[team].Render(); } m_Header[team].Render(); for (int i = 0; i < kMaxPlayers; i++) m_Columns[team][i].Render(); } m_Server.Render(); m_RoundInfo.Render(); } }
LTBOOL CHUDChatInput::Init() { char *pTag = "ChatInput"; m_BasePos = g_pLayoutMgr->GetPoint(pTag,"BasePos"); uint8 nFont = (uint8)g_pLayoutMgr->GetInt(pTag,"Font"); CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont); m_nFontSize = (uint8)g_pLayoutMgr->GetInt(pTag,"FontSize"); LTVector vCol = g_pLayoutMgr->GetVector(pTag,"Color"); uint8 nR = (uint8)vCol.x; uint8 nG = (uint8)vCol.y; uint8 nB = (uint8)vCol.z; uint32 color = SET_ARGB(0xFF,nR,nG,nB); uint8 h = (uint8)((float)m_nFontSize * g_pInterfaceResMgr->GetYRatio()); float x = (float)(m_BasePos.x) * g_pInterfaceResMgr->GetXRatio(); float y = (float)(m_BasePos.y) * g_pInterfaceResMgr->GetYRatio(); m_pStr = g_pFontManager->CreatePolyString(pFont," ",x, y); m_pStr->SetCharScreenHeight(h); m_pStr->SetColor(color); m_EditCtrl.Create(g_pLTClient,LTNULL,pFont,m_nFontSize,kMaxChatLength,LTNULL,m_szChatStr); m_EditCtrl.SetColors(color,color,color); m_EditCtrl.EnableCaret(LTTRUE); m_EditCtrl.SetBasePos(m_BasePos); m_EditCtrl.SetScale(g_pInterfaceResMgr->GetXRatio()); UpdateLayout(); return LTTRUE; }
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; }
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); }
void CHUDScores::UpdateLayout() { char *pTag = "Scores"; m_BasePos = g_pLayoutMgr->GetPoint(pTag,"BasePos"); uint8 nFont = (uint8)g_pLayoutMgr->GetInt(pTag,"Font"); m_nBaseFontSize = (uint8)g_pLayoutMgr->GetInt(pTag,"FontSize"); LTVector vCol = g_pLayoutMgr->GetVector(pTag,"TextColor"); uint8 nR = (uint8)vCol.x; uint8 nG = (uint8)vCol.y; uint8 nB = (uint8)vCol.z; m_nTextColor = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector(pTag,"PlayerTextColor"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nPlayerTextColor = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector(pTag,"ScreenPlayerTextColor"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nScreenPlayerTextColor = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector(pTag,"ScreenTextColor"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nScreenTextColor = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector(pTag,"FrameColor"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; float fAlpha = g_pLayoutMgr->GetFloat(pTag,"FrameAlpha"); uint8 nA = (uint8)(255.0f * fAlpha); uint32 nFrameColor = SET_ARGB(nA,nR,nG,nB); uint32 nTeamColors[kNumTeams] = {argbBlack,argbBlack}; vCol = g_pLayoutMgr->GetVector(pTag,"Team1Color"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; nTeamColors[0]= SET_ARGB(nA,nR,nG,nB); vCol = g_pLayoutMgr->GetVector(pTag,"Team2Color"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; nTeamColors[1]= SET_ARGB(nA,nR,nG,nB); CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont); uint16 nCol1 = g_pLayoutMgr->GetInt(pTag,"NameColumn"); uint16 nCol2 = g_pLayoutMgr->GetInt(pTag,"ScoreColumn"); uint16 nCol3 = g_pLayoutMgr->GetInt(pTag,"KillColumn"); uint16 nCol4 = g_pLayoutMgr->GetInt(pTag,"TagColumn"); uint16 nCol5 = g_pLayoutMgr->GetInt(pTag,"PingColumn"); m_nFrameWidth = (nCol1+nCol2+nCol3+nCol4+nCol5) + 16; if (!m_bControlsInited) { m_SingleFrame.Create(nFrameColor,m_nFrameWidth,32); for (int team = 0; team < kNumTeams; team++) { m_Frame[team].Create(nTeamColors[team],m_nFrameWidth,32); m_Team[team].Create("",0,0,pFont,(m_nBaseFontSize+4),NULL); m_Team[team].SetColors(m_nTextColor,m_nTextColor,m_nTextColor); m_Rounds[team].Create("",0,0,pFont,(m_nBaseFontSize+4),NULL); m_Rounds[team].SetColors(m_nTextColor,m_nTextColor,m_nTextColor); m_Rounds[team].GetString()->SetAlignmentH(CUI_HALIGN_RIGHT); m_Header[team].Create ( 0,0, pFont, (m_nBaseFontSize+4), NULL); m_Header[team].SetColors(m_nTextColor,m_nTextColor,m_nTextColor); m_Header[team].AddColumn(LoadTempString(IDS_SCORE_PLAYERS), (nCol1-8), LTFALSE); m_Header[team].AddColumn(LoadTempString(IDS_SCORE_SCORE), nCol2, LTFALSE); m_Header[team].AddColumn(LoadTempString(IDS_SCORE_KILLS), nCol3, LTFALSE); m_Header[team].AddColumn(LoadTempString(IDS_SCORE_TAGS), nCol4, LTFALSE); m_Header[team].AddColumn(LoadTempString(IDS_SCORE_PING), nCol5, LTFALSE); for (int i = 0; i < kMaxPlayers; i++) { m_Columns[team][i].Create ( 0,0, pFont, m_nBaseFontSize, NULL); m_Columns[team][i].SetColors(m_nTextColor,m_nTextColor,m_nTextColor); m_Columns[team][i].AddColumn("<player name>", nCol1, LTTRUE); m_Columns[team][i].AddColumn("<Score>", nCol2, LTTRUE); m_Columns[team][i].AddColumn("<Frags>", nCol3, LTTRUE); m_Columns[team][i].AddColumn("<Tags>", nCol4, LTTRUE); m_Columns[team][i].AddColumn("<Ping>", nCol5, LTTRUE); m_Columns[team][i].Show(LTFALSE); } } m_Server.Create("",0,0,pFont,(m_nBaseFontSize+4),NULL); m_Server.SetColors(m_nTextColor,m_nTextColor,m_nTextColor); LTIntPt framePos = m_BasePos; framePos.x -= 8; framePos.y -= 4; m_SingleFrame.SetBasePos(framePos); UpdateTeamPos(0,m_BasePos); m_bControlsInited = true; } }
// ----------------------------------------------------------------------- // // // ROUTINE: CDebugLineFX::OnServerMessage // // PURPOSE: Read an update message from the server. // // ----------------------------------------------------------------------- // LTBOOL CDebugLineFX::OnServerMessage(ILTMessage_Read * pMsg) { // Read the number of lines. const int num_lines = pMsg->Readuint16(); // Set the new maximum number of lines m_nMaxLines = pMsg->Readuint32(); // See if the server is telling us to clear our old lines. m_bClearOldLines = (pMsg->Readuint8() != 0); #ifdef DEBUGLINEFX_DEBUG g_pLTClient->CPrint("Reading %d lines, clear lines is %s.", num_lines, m_bClearOldLines ? "true" : "false"); #endif // If we don't have any lines, we want to clear our old lines // so that the object will be re-positioned correctly. if( lines.empty() ) m_bClearOldLines = true; // Clear the lines from memory. The lines will be removed from // the line system in Update. if( m_bClearOldLines ) { #ifdef DEBUGLINEFX_DEBUG g_pLTClient->CPrint("Clearing %d lines.", lines.size()); #endif lines.clear(); } // Read each line. DebugLine new_line; LT_LINEF new_linef; LTVector maxV(0.0f,0.0f,0.0f); LTVector minV(0.0f,0.0f,0.0f); bool first = true; for(int i = 0; i < num_lines; ++i) { pMsg->ReadType(&new_line); new_linef.verts[0].x = new_line.vSource.x; new_linef.verts[0].y = new_line.vSource.y; new_linef.verts[0].z = new_line.vSource.z; new_linef.verts[1].x = new_line.vDest.x; new_linef.verts[1].y = new_line.vDest.y; new_linef.verts[1].z = new_line.vDest.z; new_linef.rgba.r = new_line.rgba.r; new_linef.rgba.g = new_line.rgba.g; new_linef.rgba.b = new_line.rgba.b; new_linef.rgba.a = new_line.rgba.a; lines.push_back( new_linef ); if (first) { first = false; maxV.x = Max(new_line.vSource.x,new_line.vDest.x); maxV.y = Max(new_line.vSource.y,new_line.vDest.y); maxV.z = Max(new_line.vSource.z,new_line.vDest.z); minV.x = Min(new_line.vSource.x,new_line.vDest.x); minV.y = Min(new_line.vSource.y,new_line.vDest.y); minV.z = Min(new_line.vSource.z,new_line.vDest.z); } else { maxV.x = Max(maxV.x,new_line.vSource.x); maxV.y = Max(maxV.y,new_line.vSource.y); maxV.z = Max(maxV.z,new_line.vSource.z); maxV.x = Max(maxV.x,new_line.vDest.x); maxV.y = Max(maxV.y,new_line.vDest.y); maxV.z = Max(maxV.z,new_line.vDest.z); minV.x = Min(minV.x,new_line.vSource.x); minV.y = Min(minV.y,new_line.vSource.y); minV.z = Min(minV.z,new_line.vSource.z); minV.x = Min(minV.x,new_line.vDest.x); minV.y = Min(minV.y,new_line.vDest.y); minV.z = Min(minV.z,new_line.vDest.z); } } char szDebugString[256]; pMsg->ReadString(szDebugString,sizeof(szDebugString)); m_pStr->SetText(szDebugString); if (num_lines) { vStrPos = (maxV + minV) / 2.0f; vStrPos.y += 16.0f; uint32 color = SET_ARGB(new_linef.rgba.a,new_linef.rgba.r,new_linef.rgba.g,new_linef.rgba.b); m_pStr->SetColor(color); } // Make sure the lines get updated. m_bUpdateLines = true; return LTTRUE; }
void CHUDCrosshair::UpdateLayout() { int nCurrentLayout = GetConsoleInt("HUDLayout",0); LTIntPt pos = g_pLayoutMgr->GetActivationTextPos(nCurrentLayout); if (pos.x > 0) m_StrPos = pos; uint8 nTmp = g_pLayoutMgr->GetActivationTextSize(nCurrentLayout); if (nTmp > 0) m_nStrSz = nTmp; m_nStrJust = g_pLayoutMgr->GetActivationTextJustify(nCurrentLayout); uint32 color = g_pLayoutMgr->GetActivationTextColor(nCurrentLayout); if (color > 0) m_StrColor = color; color = g_pLayoutMgr->GetActivationTextDisabledColor(nCurrentLayout); if (color > 0) m_StrDisColor = color; pos = g_pLayoutMgr->GetDebugTextPos(nCurrentLayout); if (pos.x > 0) m_DbgPos = pos; nTmp = g_pLayoutMgr->GetDebugTextSize(nCurrentLayout); if (nTmp > 0) m_nDbgSz = nTmp; uint16 nWid = g_pLayoutMgr->GetDebugTextWidth(nCurrentLayout); if (nWid > 0) m_nDbgWidth = nWid; m_nDbgJust = g_pLayoutMgr->GetDebugTextJustify(nCurrentLayout); color = g_pLayoutMgr->GetDebugTextColor(nCurrentLayout); if (color > 0) m_DbgColor = color; LTVector vCol = g_pLayoutMgr->GetVector("Miscellaneous","Team1Color"); uint8 nR = (uint8)vCol.x; uint8 nG = (uint8)vCol.y; uint8 nB = (uint8)vCol.z; m_TeamColor[0] = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector("Miscellaneous","Team2Color"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_TeamColor[1] = SET_ARGB(0xFF,nR,nG,nB); switch (m_nStrJust) { case 0: m_pStr->SetAlignmentH(CUI_HALIGN_LEFT); break; case 1: m_pStr->SetAlignmentH(CUI_HALIGN_CENTER); break; case 2: m_pStr->SetAlignmentH(CUI_HALIGN_RIGHT); break; } switch (m_nDbgJust) { case 0: m_pDbgStr->SetAlignmentH(CUI_HALIGN_LEFT); break; case 1: m_pDbgStr->SetAlignmentH(CUI_HALIGN_CENTER); break; case 2: m_pDbgStr->SetAlignmentH(CUI_HALIGN_RIGHT); break; } }
// ----------------------------------------------------------------------- // // // ROUTINE: CHUDCrosshair::RenderScope() // // PURPOSE: Draw the scope crosshair // // ----------------------------------------------------------------------- // void CHUDCrosshair::RenderScope() { g_pDrawPrim->SetTexture(LTNULL); g_pDrawPrim->SetRGBA(&m_Poly[2],argbBlack); float cx = 320.0f * g_pInterfaceResMgr->GetXRatio(); float cy = 240.0f * g_pInterfaceResMgr->GetYRatio(); float hR = g_vtScopeLRRadius.GetFloat() * cx * 2.0f; float hGap = g_vtScopeLRGap.GetFloat() * g_pInterfaceResMgr->GetXRatio(); float vR = g_vtScopeUDRadius.GetFloat() * cx * 2.0f; float vGap = g_vtScopeUDGap.GetFloat() * g_pInterfaceResMgr->GetXRatio(); //left post float x = cx - hR; float y = cy - 2.0f; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hR-hGap),4.0f); g_pDrawPrim->DrawPrim(&m_Poly[2],1); //right post x = cx + hGap; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hR-hGap),4.0f); g_pDrawPrim->DrawPrim(&m_Poly[2],1); //horizontal hair x = cx - hGap; y = cy - 1.0f; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hGap * 2.0f),2.0f); g_pDrawPrim->DrawPrim(&m_Poly[2],1); //top post x = cx - 2.0f; y = cy - vR; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,4.0f,(vR-vGap)); g_pDrawPrim->DrawPrim(&m_Poly[2],1); //bottom post y = cy + vGap; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,4.0f,(vR-vGap)); g_pDrawPrim->DrawPrim(&m_Poly[2],1); //vertical hair x = cx - 1.0f; y = cy - vGap; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,2.0f,(vGap * 2.0f)); g_pDrawPrim->DrawPrim(&m_Poly[2],1); uint32 gold = SET_ARGB(255,140,128,20); g_pDrawPrim->SetRGBA(&m_Poly[2],gold); //left highlight x = cx - hR; y = cy - 1.0f; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hR-hGap),2.0f); g_pDrawPrim->DrawPrim(&m_Poly[2],1); //right highlight x = cx + vGap; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hR-hGap),2.0f); g_pDrawPrim->DrawPrim(&m_Poly[2],1); //top highlight x = cx - 1.0f; y = cy - vR; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,2.0f,(vR-vGap)); g_pDrawPrim->DrawPrim(&m_Poly[2],1); //bottom highlight y = cy + vGap; g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,2.0f,(vR-vGap)); g_pDrawPrim->DrawPrim(&m_Poly[2],1); }
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); }
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; }
void CInterfaceTimer::Draw() { // If we're not paused, recalculate the time left. if( !m_bPause ) m_fTimeLeft = m_fTime - g_pLTClient->GetGameTime( ); // Update/Draw the timer if there is anytime left... if( m_fTimeLeft <= 0.0f ) return; // Draw the string to the surface... int nMinutes = int(m_fTimeLeft) / 60; int nSeconds = m_fTimeLeft > 60.0 ? int(m_fTimeLeft) % 60 : int(m_fTimeLeft); char aBuffer[8]; char aMinutes[8]; char aSeconds[8]; BuildTimeString(aMinutes, nMinutes); BuildTimeString(aSeconds, nSeconds); uint8 nFont = 0; LTVector vColor; sprintf(aBuffer, "%s:%s", aMinutes, aSeconds); if (!m_pTimeStr) { switch( m_nTeamId ) { // Team1. case 0: nFont = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","Team1TimerFont"); m_nBaseSize = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","Team1TimerSize"); m_BasePos = g_pLayoutMgr->GetPoint("Miscellaneous","Team1TimerPos"); vColor = g_pLayoutMgr->GetVector("Miscellaneous","Team1TimerColor"); break; // Team2. case 1: nFont = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","Team2TimerFont"); m_nBaseSize = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","Team2TimerSize"); m_BasePos = g_pLayoutMgr->GetPoint("Miscellaneous","Team2TimerPos"); vColor = g_pLayoutMgr->GetVector("Miscellaneous","Team2TimerColor"); break; // Unspecified. default: nFont = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","TimerFont"); m_nBaseSize = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","TimerSize"); m_BasePos = g_pLayoutMgr->GetPoint("Miscellaneous","TimerPos"); vColor = g_pLayoutMgr->GetVector("Miscellaneous","TimerColor"); break; } if (m_nBaseSize == 0) m_nBaseSize = 24; if (m_BasePos.x == 0) m_BasePos = LTIntPt(320,40); CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont); m_pTimeStr = g_pFontManager->CreateFormattedPolyString(pFont, aBuffer); m_pTimeStr->SetAlignmentH(CUI_HALIGN_CENTER); m_nColor = SET_ARGB( 0xFF, ( uint8 )vColor.x, ( uint8 )vColor.y, ( uint8 )vColor.z ); } else { m_pTimeStr->SetText(aBuffer); } uint8 nSize = (uint8)((LTFLOAT)m_nBaseSize * g_pInterfaceResMgr->GetXRatio()); m_pTimeStr->SetCharScreenHeight(nSize); // Position the text float x = (float)m_BasePos.x * g_pInterfaceResMgr->GetXRatio(); float y = (float)m_BasePos.y * g_pInterfaceResMgr->GetYRatio(); m_pTimeStr->SetPosition( x+2.0f, y+2.0f); m_pTimeStr->SetColor(argbBlack); m_pTimeStr->Render(); m_pTimeStr->SetPosition( x, y ); m_pTimeStr->SetColor(m_nColor); m_pTimeStr->Render(); }
void CScreenPostload::OnFocus(LTBOOL bFocus) { if (bFocus) { // [KLS 6/23/02] - Turn the cursor off until everything is loaded... g_pInterfaceMgr->UseCursor(LTFALSE, LTFALSE); // Assume we won't be showing the press any key text. m_bPressAnyKey = false; // 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 ) { m_missionname = LoadTempString(pMission->nNameId); int nCurLevel = g_pMissionMgr->GetCurrentLevel( ); m_levelname = LoadTempString( pMission->aLevels[nCurLevel].nNameId ); m_layout = 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; } 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 = ""; 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 = ""; } 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 level 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); //default layout info Continue string m_DefaultContinuePos = g_pLayoutMgr->GetPoint(szTagName,"ContinuePos"); m_nDefaultContinueFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"ContinueFont"); m_nDefaultContinueFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"ContinueSize"); vColor = g_pLayoutMgr->GetVector(szTagName, "ContinueColor"); nR = (uint8)vColor.x; nG = (uint8)vColor.y; nB = (uint8)vColor.z; m_nDefaultContinueColor = SET_ARGB(0xFF,nR,nG,nB); } //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; //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); //Setup briefing string LTIntPt BriefingPos = m_DefaultBriefingPos; uint16 BriefingWidth = m_nDefaultBriefingWidth; uint8 BriefingFont = m_nDefaultBriefingFont; uint8 BriefingFontSize = m_nDefaultBriefingFontSize; uint32 BriefingColor = m_nDefaultBriefingColor; //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,""); } 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)); //Setup briefing string LTIntPt HelpPos = m_DefaultHelpPos; uint16 HelpWidth = m_nDefaultHelpWidth; uint8 HelpFont = m_nDefaultHelpFont; uint8 HelpFontSize = m_nDefaultHelpFontSize; uint32 HelpColor = m_nDefaultHelpColor; //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(""); } //Setup Continue string LTIntPt ContinuePos = m_DefaultContinuePos; uint8 ContinueFont = m_nDefaultContinueFont; uint8 ContinueFontSize = m_nDefaultContinueFontSize; m_nContinueColor = m_nDefaultContinueColor; //look for override values if (g_pLayoutMgr->Exist(szTagName)) { //override layout info Continue string if (g_pLayoutMgr->HasValue(szTagName,"ContinuePos")) ContinuePos = g_pLayoutMgr->GetPoint(szTagName,"ContinuePos"); if (g_pLayoutMgr->HasValue(szTagName,"ContinueFont")) ContinueFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"ContinueFont"); if (g_pLayoutMgr->HasValue(szTagName,"ContinueSize")) ContinueFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"ContinueSize"); if (g_pLayoutMgr->HasValue(szTagName,"ContinueColor")) { LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "ContinueColor"); uint8 nR = (uint8)vColor.x; uint8 nG = (uint8)vColor.y; uint8 nB = (uint8)vColor.z; m_nContinueColor = SET_ARGB(0xFF,nR,nG,nB); } } // [KLS 6/21/02] - We restore music here to make sure everything is loaded // before the "press any key" text is shown... g_pGameClientShell->RestoreMusic(); // [KLS 6/23/02] - Turn the cursor on once everything is loaded... g_pInterfaceMgr->UseCursor(LTTRUE); nFontSize = (uint8)((float)ContinueFontSize * g_pInterfaceResMgr->GetXRatio()); pFont = g_pInterfaceResMgr->GetFont(ContinueFont); if (!m_pContinueStr) { m_pContinueStr = g_pFontManager->CreateFormattedPolyString(pFont,""); } // If we have a briefing, then post the press any key. if( m_briefing.length( ) > 0 ) { m_bPressAnyKey = true; m_pContinueStr->SetText( LoadTempString( IDS_PRESS_ANY_KEY )); } // Otherwise show the "waiting for other players". else { m_bPressAnyKey = false; m_pContinueStr->SetText( LoadTempString( IDS_WAITINGFOROTHERPLAYERS )); g_pGameClientShell->SendClientLoadedMessage( ); } m_pContinueStr->SetColor(m_nContinueColor); m_pContinueStr->SetCharScreenHeight(nFontSize); x = (float)ContinuePos.x * g_pInterfaceResMgr->GetXRatio(); y = (float)ContinuePos.y * g_pInterfaceResMgr->GetYRatio(); m_pContinueStr->SetPosition(x,y); s_bFlash = false; s_fFlashTime = g_pLTClient->GetTime() + 0.333f; s_nFlashColor = (m_nContinueColor ^ 0x00FFFFFF); g_pClientSoundMgr->PlayInterfaceSound("Interface\\Snd\\pressanykey.wav"); } CBaseScreen::OnFocus(bFocus); m_bVisited = LTFALSE; }
LTBOOL CMenuPlayer::Init() { m_MenuID = MENU_ID_PLAYER; s_pSklMenu = this; if (!CBaseMenu::Init()) return LTFALSE; int nNameWidth = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"NameWidth"); int nLevelWidth = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"LevelWidth"); int nUpgradeWidth = s_Size.x - ( (m_Indent.x * 2) + nNameWidth + nLevelWidth); LTVector vColor = g_pLayoutMgr->GetMenuCustomVector(m_MenuID,"HighlightColor"); uint8 nA = 255; uint8 nR = (uint8)vColor.x; uint8 nG = (uint8)vColor.y; uint8 nB = (uint8)vColor.z; skillHighlightColor= SET_ARGB(nA,nR,nG,nB); uint8 nSmallerFont = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"SmallerFontSize"); SetTitle(IDS_TITLE_SUMMARY); LTIntPt popupSize = g_pLayoutMgr->GetMenuCustomPoint(m_MenuID,"PopupSize"); m_Popup.Init(s_Frame,s_FrameTip,popupSize); m_Popup.m_bWaitForUpdate = LTFALSE; LTIntPt offset = m_Indent; offset.y = 8; CUIFont* pFont = g_pInterfaceResMgr->GetFont(m_TitleFontFace); m_Name.Create("name",LTNULL,LTNULL,pFont,m_TitleFontSize,LTNULL); m_Name.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor); m_Name.Enable(LTFALSE); m_Popup.AddControl(&m_Name,offset); offset.y += (m_Name.GetHeight() + 4); pFont = g_pInterfaceResMgr->GetFont(m_FontFace); m_Level.Create("level",LTNULL,LTNULL,pFont,m_FontSize,LTNULL); m_Level.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor); m_Level.Enable(LTFALSE); m_Popup.AddControl(&m_Level,offset); offset.y += (m_Level.GetHeight() + 12); m_Header.Create(LTNULL,LTNULL,pFont,m_FontSize, LTNULL); m_Header.AddColumn(" ",nNameWidth); m_Header.AddColumn(LoadTempString(IDS_CURRENT),60); m_Header.AddColumn(LoadTempString(IDS_UPGRADE),60); m_Header.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor); m_Header.Enable(LTFALSE); m_Popup.AddControl(&m_Header,offset); offset.y += (m_Header.GetHeight() + 2); for (uint8 m = 0; m < kMaxModifiers; ++m) { m_Mods[m].Create(LTNULL,LTNULL,pFont,m_FontSize,LTNULL); m_Mods[m].AddColumn(" ",nNameWidth); m_Mods[m].AddColumn("100",60); m_Mods[m].AddColumn("100",60); m_Mods[m].SetColors(skillHighlightColor,m_NonSelectedColor,m_DisabledColor); m_Mods[m].Enable(LTTRUE); m_Popup.AddControl(&m_Mods[m],offset); offset.y += (m_Mods[m].GetHeight() + 2); } offset.y += 8; m_Upgrade.Create("Upgrade",MC_UPGRADE,IDS_HELP_UPGRADE,pFont,m_FontSize,this); m_Upgrade.SetColors(m_SelectedColor,m_NonSelectedColor,m_DisabledColor); m_Popup.AddControl(&m_Upgrade,offset); offset.y += (m_Upgrade.GetHeight() + 4); m_Points.Create("avail",LTNULL,LTNULL,pFont,m_FontSize,LTNULL); m_Points.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor); m_Points.SetFont(LTNULL,nSmallerFont); m_Points.Enable(LTFALSE); m_Popup.AddControl(&m_Points,offset); uint8 nHelpFont = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"HelpFontSize"); offset = g_pLayoutMgr->GetMenuCustomPoint(m_MenuID,"HelpOffset"); uint16 nWidth = 600 - 2* offset.x; if (!nHelpFont) nHelpFont = m_FontSize; m_ModDesc.Create("description",LTNULL,LTNULL,pFont,nHelpFont,LTNULL); m_ModDesc.SetColors(m_SelectedColor,m_SelectedColor,m_SelectedColor); m_ModDesc.SetFixedWidth(nWidth); m_ModDesc.Enable(LTFALSE); m_Popup.AddControl(&m_ModDesc,offset); int nPopupPos = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"PopupPos"); m_Popup.SetBasePos(LTIntPt(0,nPopupPos)); g_pInterfaceMgr->GetMenuMgr()->RegisterCommand(COMMAND_ID_STATUS,MENU_ID_PLAYER); //Rank control m_pRank = AddColumnCtrl(); m_pRank->AddColumn(LoadTempString(IDS_RANK),nNameWidth); m_pRank->AddColumn("Novice",nNameWidth); //Total points control m_pTotal = AddColumnCtrl(); m_pTotal->AddColumn(LoadTempString(IDS_SCORE),nNameWidth); m_pTotal->AddColumn("0",nNameWidth); //Avail points control m_pAvail = AddColumnCtrl(); m_pAvail->AddColumn(LoadTempString(IDS_SKILL_PTS),nNameWidth); m_pAvail->AddColumn("0",nNameWidth); AddControl(" ",0,LTTRUE); // CUIFont* pFont = g_pInterfaceResMgr->GetFont(m_FontFace); for (uint8 i = 0; i < kNumSkills; i++) { eSkill skl = (eSkill)i; if (g_pSkillsButeMgr->IsAvailable(skl) ) { m_pSkills[i] = debug_new(CSkillCtrl); m_pSkills[i]->Create(skl,(MC_CUSTOM+i),pFont,m_FontSize,this,nNameWidth); m_List.AddControl(m_pSkills[i]); } } return LTTRUE; }
void CHUDHiding::Render() { if (!m_bDraw) return; SetRenderState(); if( g_pPlayerStats->CanHide() ) { if( !g_pPlayerStats->IsHidden() ) { if (m_fHideDuration <= 0.0f ) return; float fAlpha = Clamp((m_fHideTimer / m_fHideDuration), 0.0f, 1.0f); uint8 a = (uint8)( 255.0f * fAlpha ); uint32 color = SET_ARGB(a,0xFF,0xFF,0xFF); g_pDrawPrim->SetRGBA( &m_Poly[kHiddenPrim], color ); a = 255 - a; color = SET_ARGB(a,0xFF,0xFF,0xFF); g_pDrawPrim->SetRGBA(&m_Poly[kHidePrim],color); } else { uint32 color = SET_ARGB(0,0xFF,0xFF,0xFF); g_pDrawPrim->SetRGBA( &m_Poly[kHiddenPrim], color ); color = SET_ARGB(255,0xFF,0xFF,0xFF); g_pDrawPrim->SetRGBA(&m_Poly[kHidePrim],color); } // draw our icons g_pDrawPrim->SetTexture(m_hIcon[kHidePrim]); g_pDrawPrim->DrawPrim(&m_Poly[kHidePrim]); // draw our icons g_pDrawPrim->SetTexture(m_hIcon[kHiddenPrim]); g_pDrawPrim->DrawPrim(&m_Poly[kHiddenPrim]); // Update our hiding bar... if( !g_pPlayerStats->IsHidden() ) { if (!g_pGameClientShell->IsGamePaused()) { m_fHideTimer -= g_pLTClient->GetFrameTime(); if( m_fHideTimer <= 0.0f ) { m_HideBar.SetMaxValue( 0 ); m_HideBar.SetValue( 0 ); } else { float fStealthSkillEffect = g_pPlayerStats->GetSkillModifier(SKL_STEALTH,StealthModifiers::eHideTime); uint8 nMaxProgress = 100; if( g_vtProgressBarScaleToSkills.GetFloat() > 0.0f ) { nMaxProgress = (fStealthSkillEffect > 0.0f ? uint8(100 * fStealthSkillEffect) : 0); } uint8 nVal = uint8( (1 - (m_fHideTimer / m_fHideDuration)) * nMaxProgress ); m_HideBar.SetMaxValue( nMaxProgress ); m_HideBar.SetValue( nVal ); } } if( m_fHideBarWaitTime > 0.0f ) { if (!g_pGameClientShell->IsGamePaused()) m_fHideBarWaitTime += g_pLTClient->GetFrameTime(); if( m_fHideBarWaitTime >= 0.5f ) { m_HideBar.Update(); m_HideBar.Render(); } } } } else { g_pDrawPrim->SetTexture(m_hIcon[kCantHidePrim]); g_pDrawPrim->DrawPrim(&m_Poly[kCantHidePrim]); } }
LTBOOL CMenuMgr::Init() { //build menu array m_MenuArray.reserve(MENU_ID_UNASSIGNED); //add menus here m_MenuArray.push_back(&m_MenuSystem); m_MenuArray.push_back(&m_MenuMission); m_MenuArray.push_back(&m_MenuInventory); m_MenuArray.push_back(&m_MenuKeys); m_MenuArray.push_back(&m_MenuIntel); m_MenuArray.push_back(&m_MenuPlayer); //init menus MenuArray::iterator iter = m_MenuArray.begin(); while (iter != m_MenuArray.end()) { if (!(*iter)->Init()) return LTFALSE; iter++; } m_fSlideInTime = g_pLayoutMgr->GetMenuSlideInTime(); m_fSlideOutTime = g_pLayoutMgr->GetMenuSlideOutTime(); m_nMenuPos = g_pLayoutMgr->GetMenuPosition(); char szTemp[128]; char *pTag = "Menu"; g_pLayoutMgr->GetString(pTag,"SlideInSound",szTemp,sizeof(szTemp)); m_sSlideInSound = szTemp; g_pLayoutMgr->GetString(pTag,"SlideOutSound",szTemp,sizeof(szTemp)); m_sSlideOutSound = szTemp; g_pLayoutMgr->GetString(pTag,"Bar",szTemp,sizeof(szTemp)); HTEXTURE hBar = g_pInterfaceResMgr->GetTexture(szTemp); g_pLayoutMgr->GetString(pTag,"BarTip",szTemp,sizeof(szTemp)); HTEXTURE hBarTip = g_pInterfaceResMgr->GetTexture(szTemp); LTIntPt size = g_pLayoutMgr->GetPoint(pTag,"BarSize"); uint8 fontFace = (uint8)g_pLayoutMgr->GetInt(pTag,"BarFont"); uint8 fontSize = (uint8)g_pLayoutMgr->GetInt(pTag,"BarFontSize"); m_nBarPos = g_pLayoutMgr->GetInt(pTag,"BarPosition"); int nBarSpacing = g_pLayoutMgr->GetInt(pTag,"BarSpacing"); LTVector vCol = g_pLayoutMgr->GetVector(pTag,"BarSelectColor"); uint8 nR = (uint8)vCol.x; uint8 nG = (uint8)vCol.y; uint8 nB = (uint8)vCol.z; g_nSelectColor = SET_ARGB(0xFF,nR,nG,nB); m_MenuBar.Init(hBar,hBarTip,size); m_MenuBar.SetBasePos(LTIntPt(0,m_nBarPos)); CUIFont* pFont = g_pInterfaceResMgr->GetFont(fontFace); LTIntPt offset(nBarSpacing,(size.y-fontSize)/2); for (uint8 i =0; i < m_MenuArray.size(); i++) { CLTGUITextCtrl *pCtrl = debug_new(CLTGUITextCtrl); CBaseMenu *pMenu = m_MenuArray[i]; pCtrl->Create(pMenu->GetTitle(),i,NULL,pFont,fontSize,&m_MenuBar); pCtrl->SetColors(g_nSelectColor,argbBlack,argbWhite); pCtrl->SetParam1(pMenu->GetMenuID()); m_MenuBar.AddControl(pCtrl,offset); offset.x += nBarSpacing + pCtrl->GetWidth(); } return LTTRUE; }
void CHUDChatMsgQueue::UpdateLayout() { char *pTag = "ChatMessageQueue"; m_BasePos = g_pLayoutMgr->GetPoint(pTag,"BasePos"); uint8 nFont = (uint8)g_pLayoutMgr->GetInt(pTag,"Font"); m_MsgFormat.pFont = g_pInterfaceResMgr->GetFont(nFont); m_MsgFormat.nFontSize = (uint8)g_pLayoutMgr->GetInt(pTag,"FontSize"); m_MsgFormat.nTextColor = argbWhite; m_MsgFormat.fDuration = g_pLayoutMgr->GetFloat(pTag,"MessageTime"); m_MsgFormat.fFadeDur = g_pLayoutMgr->GetFloat(pTag,"MessageFade"); m_MsgFormat.nWidth = (uint16) g_pLayoutMgr->GetInt(pTag,"Width"); m_nMaxActiveMsgs = (uint8)g_pLayoutMgr->GetInt(pTag,"MaxMessages"); m_nMaxHistoryMsgs = (uint8)g_pLayoutMgr->GetInt(pTag,"MaxHistory"); LTVector vCol = g_pLayoutMgr->GetVector(pTag,"TextColor"); uint8 nR = (uint8)vCol.x; uint8 nG = (uint8)vCol.y; uint8 nB = (uint8)vCol.z; m_nMsgColors[kMsgDefault] = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector(pTag,"ChatColor"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nMsgColors[kMsgChat] = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector(pTag,"CheatColor"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nMsgColors[kMsgCheatConfirm] = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector("Transmission","TextColor"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nMsgColors[kMsgTransmission] = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector( pTag, "ScmdColor" ); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nMsgColors[kMsgScmd] = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector(pTag,"TeamColor"); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nMsgColors[kMsgTeam] = SET_ARGB(0xFF,nR,nG,nB); vCol = g_pLayoutMgr->GetVector( pTag, "RedTeamColor" ); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nMsgColors[kMsgRedTeam] = SET_ARGB( 0xFF, nR, nG, nB ); vCol = g_pLayoutMgr->GetVector( pTag, "BlueTeamColor" ); nR = (uint8)vCol.x; nG = (uint8)vCol.y; nB = (uint8)vCol.z; m_nMsgColors[kMsgBlueTeam] = SET_ARGB( 0xFF, nR, nG, nB ); }