// Build the screen LTBOOL CScreenAudio::Build() { CreateTitle(IDS_TITLE_SOUND); kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_AUDIO,"ColumnWidth"); kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_AUDIO,"SliderWidth"); uint32 dwAdvancedOptions = g_pInterfaceMgr->GetAdvancedOptions(); m_bMusicEnabled = (dwAdvancedOptions & AO_MUSIC); //background frame LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_AUDIO,"FrameRect"); LTIntPt pos(frameRect.left,frameRect.top); int nHt = frameRect.bottom - frameRect.top; int nWd = frameRect.right - frameRect.left; char szFrame[128]; g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_AUDIO,"FrameTexture",szFrame,sizeof(szFrame)); HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,nWd,nHt+8,LTTRUE); pFrame->SetBasePos(pos); pFrame->SetBorder(2,m_SelectedColor); AddControl(pFrame); m_pSoundVolumeCtrl=AddSlider(IDS_SOUND_FXVOL, IDS_HELP_SOUNDVOL, kGap, kWidth, -1, &m_nSoundVolume); m_pSoundVolumeCtrl->Enable( (dwAdvancedOptions & AO_SOUND) ); m_pSoundVolumeCtrl->SetSliderRange(SOUND_MIN_VOL, SOUND_MAX_VOL); m_pSoundVolumeCtrl->SetSliderIncrement(SOUND_SLIDER_INC); m_pSpeechVolumeCtrl=AddSlider(IDS_SPEECH_FXVOL, IDS_HELP_SPEECHVOL, kGap, kWidth, -1, &m_nSpeechVolume); m_pSpeechVolumeCtrl->Enable( (dwAdvancedOptions & AO_SOUND) ); m_pSpeechVolumeCtrl->SetSliderRange(SPEECH_MIN_VOL, SPEECH_MAX_VOL); m_pSpeechVolumeCtrl->SetSliderIncrement(SPEECH_SLIDER_INC); m_pSoundQualityCtrl=AddToggle(IDS_SOUND_QUALITY, IDS_HELP_SOUNDQUAL, kGap, &m_bSoundQuality); m_pSoundQualityCtrl->SetOnString(LoadTempString(IDS_SOUND_HIGH)); m_pSoundQualityCtrl->SetOffString(LoadTempString(IDS_SOUND_LOW)); m_pSoundQualityCtrl->Enable( (dwAdvancedOptions & AO_SOUND) ); m_pMusicVolumeCtrl = AddSlider(IDS_SOUND_MUSICVOL, IDS_HELP_MUSICVOL, kGap, kWidth, -1, &m_nMusicVolume); m_pMusicVolumeCtrl->Enable( (dwAdvancedOptions & AO_MUSIC) ); m_pMusicVolumeCtrl->SetSliderRange(MUSIC_MIN_VOL, MUSIC_MAX_VOL); m_pMusicVolumeCtrl->SetSliderIncrement(MUSIC_SLIDER_INC); m_pMusicQualityCtrl=AddToggle(IDS_MUSIC_QUALITY, IDS_HELP_MUSIC_QUALITY, kGap, &m_bMusicQuality); m_pMusicQualityCtrl->SetOnString(LoadTempString(IDS_SOUND_HIGH)); m_pMusicQualityCtrl->SetOffString(LoadTempString(IDS_SOUND_LOW)); m_pMusicQualityCtrl->Enable( (dwAdvancedOptions & AO_MUSIC) ); // Make sure to call the base class if (! CBaseScreen::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
// Build the screen LTBOOL CScreenGame::Build() { CreateTitle(IDS_TITLE_GAME_OPTIONS); kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_GAME,"ColumnWidth"); kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_GAME,"SliderWidth"); //background frame LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_GAME,"FrameRect"); LTIntPt pos(frameRect.left,frameRect.top); int nHt = frameRect.bottom - frameRect.top; int nWd = frameRect.right - frameRect.left; char szFrame[128]; g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_GAME,"FrameTexture",szFrame,sizeof(szFrame)); HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,nWd,nHt+8,LTTRUE); pFrame->SetBasePos(pos); pFrame->SetBorder(2,m_SelectedColor); AddControl(pFrame); //crosshair menu AddTextItem(IDS_CONTROLS_CROSSHAIR, CMD_CROSSHAIR, IDS_HELP_CROSSHAIRMENU); CLTGUICycleCtrl* pCycle = AddCycle(IDS_DISPLAY_SUBTITLES,IDS_HELP_SUBTITLES,kGap,&m_nSubtitles); char szTmp[64]; FormatString(IDS_OFF,szTmp,sizeof(szTmp)); pCycle->AddString(szTmp); FormatString(IDS_ON,szTmp,sizeof(szTmp)); pCycle->AddString(szTmp); CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile(); if (pProfile && !g_pVersionMgr->IsLowViolence()) { CLTGUIToggle *pGore = AddToggle(IDS_DISPLAY_GORE,IDS_HELP_GORE,kGap,&m_bGore); } char szYes[16]; char szNo[16]; FormatString(IDS_YES,szYes,sizeof(szYes)); FormatString(IDS_NO,szNo,sizeof(szNo)); //always run CLTGUIToggle* pToggle = AddToggle(IDS_ADVCONTROLS_RUNLOCK, IDS_HELP_RUNLOCK, kGap, &m_bAlwaysRun ); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); // Add the Difficulty option m_pDifficultyCtrl = AddCycle(IDS_DIFFICULTY,IDS_HELP_DIFFICULTY,kGap,&m_nDifficulty); FormatString(IDS_NEW_EASY,szTmp,sizeof(szTmp)); m_pDifficultyCtrl->AddString(szTmp); FormatString(IDS_NEW_MEDIUM,szTmp,sizeof(szTmp)); m_pDifficultyCtrl->AddString(szTmp); FormatString(IDS_NEW_HARD,szTmp,sizeof(szTmp)); m_pDifficultyCtrl->AddString(szTmp); FormatString(IDS_NEW_INSANE,szTmp,sizeof(szTmp)); m_pDifficultyCtrl->AddString(szTmp); /* pCycle = AddCycle(IDS_HUDLAYOUT,IDS_HELP_HUDLAYOUT,kGap,&m_nLayout); for (int hl = 0; hl < g_pLayoutMgr->GetNumHUDLayouts(); hl++) { char szTmpBuffer[128]; FormatString(g_pLayoutMgr->GetLayoutName(hl),szTmpBuffer,sizeof(szTmpBuffer)); pCycle->AddString(szTmpBuffer); } */ CLTGUISlider *pSlider=AddSlider(IDS_HEADBOB, IDS_HELP_HEADBOB, kGap, kWidth, -1, &m_nHeadBob); pSlider->SetSliderRange(0, 10); pSlider->SetSliderIncrement(1); pSlider=AddSlider(IDS_WEAPONSWAY, IDS_HELP_WEAPONSWAY, kGap, kWidth, -1, &m_nWeaponSway); pSlider->SetSliderRange(0, 10); pSlider->SetSliderIncrement(1); pSlider=AddSlider(IDS_PICKUP_MSG_DUR, IDS_HELP_PICKUP_MSG_DUR, kGap, kWidth, -1, &m_nMsgDur); pSlider->SetSliderRange(1, 10); pSlider->SetSliderIncrement(1); pToggle = AddToggle(IDS_AUTOSWITCH_WEAPONS, IDS_HELP_AUTOSWITCH_WEAPONS, kGap, &m_bAutoWeaponSwitch ); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); pToggle = AddToggle(IDS_LOAD_TIPS, IDS_HELP_LOAD_TIPS, kGap, &m_bLoadScreenTips ); pToggle->SetOnString(LoadTempString(IDS_ON)); pToggle->SetOffString(LoadTempString(IDS_OFF)); pToggle = AddToggle(IDS_CONTOUR, IDS_HELP_CONTOUR, kGap, &m_bVehicleContour ); pToggle->SetOnString(LoadTempString(IDS_ON)); pToggle->SetOffString(LoadTempString(IDS_OFF)); // Make sure to call the base class if (! CBaseScreen::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
// Build the screen LTBOOL CScreenCrosshair::Build() { CreateTitle(IDS_TITLE_CROSSHAIR); kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CROSSHAIR,"ColumnWidth"); kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CROSSHAIR,"SliderWidth"); char szYes[16]; char szNo[16]; FormatString(IDS_YES,szYes,sizeof(szYes)); FormatString(IDS_NO,szNo,sizeof(szNo)); //background frame LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_CROSSHAIR,"FrameRect"); LTIntPt pos(frameRect.left,frameRect.top); int nHt = frameRect.bottom - frameRect.top; int nWd = frameRect.right - frameRect.left; char szFrame[128]; g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_CROSSHAIR,"FrameTexture",szFrame,sizeof(szFrame)); HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,nWd,nHt+8,LTTRUE); pFrame->SetBasePos(pos); pFrame->SetBorder(2,m_SelectedColor); AddControl(pFrame); CLTGUISlider *pSlider = AddSlider(IDS_CH_R, IDS_HELP_CH_R, kGap, kWidth, -1, &m_nColorR); pSlider->SetSliderRange(15,255); pSlider->SetSliderIncrement(16); pSlider = AddSlider(IDS_CH_G, IDS_HELP_CH_G, kGap, kWidth, -1, &m_nColorG); pSlider->SetSliderRange(15,255); pSlider->SetSliderIncrement(16); pSlider = AddSlider(IDS_CH_B, IDS_HELP_CH_B, kGap, kWidth, -1, &m_nColorB); pSlider->SetSliderRange(15,255); pSlider->SetSliderIncrement(16); CLTGUIToggle* pToggle = AddToggle(IDS_CH_DYNAMIC, IDS_HELP_CH_DYNAMIC, kGap, &m_bDynamic ); m_pStyle = AddCycle(IDS_CH_STYLE,IDS_HELP_CH_STYLE,kGap,&m_nStyle); char szTmp[kMaxStringBuffer]; uint8 style = 0; char *szTag = "HUDCrosshair"; char szAtt[32]; sprintf(szAtt,"Crosshair%d",style); while (g_pLayoutMgr->HasValue(szTag,szAtt)) { g_pLayoutMgr->GetString(szTag,szAtt,szTmp,sizeof(szTmp)); strcat(szTmp,"_A.dtx"); m_styles.push_back(szTmp); sprintf(szTmp,"%d",style); // m_pStyle->AddString(szTmp); m_pStyle->AddString(" "); style++; sprintf(szAtt,"Crosshair%d",style); } g_pDrawPrim->SetRGBA(&m_Poly,argbWhite); // Make sure to call the base class if (! CBaseScreen::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
// Build the screen LTBOOL CScreenDisplay::Build() { CreateTitle(IDS_TITLE_DISPLAYOPTIONS); kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_DISPLAY,"ColumnWidth"); kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_DISPLAY,"SliderWidth"); //background frame LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_DISPLAY,"FrameRect"); LTIntPt pos(frameRect.left,frameRect.top); int nHt = frameRect.bottom - frameRect.top; int nWd = frameRect.right - frameRect.left; char szFrame[128]; g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_DISPLAY,"FrameTexture",szFrame,sizeof(szFrame)); HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,nWd,nHt+8,LTTRUE); pFrame->SetBasePos(pos); pFrame->SetBorder(2,m_SelectedColor); AddControl(pFrame); // Build the array of renderers GetRendererData(); // Add the "resolution" control m_pResolutionCtrl = AddCycle(IDS_DISPLAY_RESOLUTION,IDS_HELP_RESOLUTION,kGap); // Setup the resolution control based on the current renderer SetupResolutionCtrl(); m_pHardwareCursor = AddToggle(IDS_HARDWARE_CURSOR,IDS_HELP_HARDWARE_CURSOR,kGap,&m_bHardwareCursor); AddToggle(IDS_VSYNC,IDS_HELP_VSYNC,kGap,&m_bVSync); m_pGamma = AddSlider(IDS_GAMMA,IDS_HELP_GAMMA,kGap,kWidth,-1,&m_nGamma); m_pGamma->SetSliderRange(0,kNumSteps); m_pGamma->SetSliderIncrement(1); int nBaseGamma = ConvertToSlider(1.0f); float xoffset = (m_pGamma->CalculateSliderOffset(nBaseGamma) / m_pGamma->GetScale()); uint16 nHeight = m_pGamma->GetBarHeight(); float yoffset = ((( (float)m_pGamma->GetBaseHeight()) - (float)nHeight)) / 2.0f; pos = m_pGamma->GetBasePos(); pos.x += (int)(xoffset - 1.0f); pos.y += (int)(yoffset + 0.5f); CLTGUIFrame *pBar = debug_new(CLTGUIFrame); pBar->Create(0xBF000000,3,nHeight+1); pBar->SetBasePos(pos); pBar->SetScale(g_pInterfaceResMgr->GetXRatio()); AddControl(pBar); // Make sure to call the base class if (!CBaseScreen::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
// Build the screen bool CScreenDisplay::Build() { CreateTitle("IDS_TITLE_DISPLAYOPTIONS"); kGap = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,0); kWidth = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,1); kTotalWidth = kGap + kWidth; m_nWarningColor = g_pLayoutDB->GetInt32(m_hLayout, LDB_ScreenAddColor, 0); //background frame CLTGUICtrl_create frameCs; TextureReference hFrame(g_pLayoutDB->GetString(m_hLayout,LDB_ScreenFrameTexture)); frameCs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect,0); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame, frameCs); AddControl(pFrame); // Build the array of renderers GetRendererData( m_rendererData ); // Add the "resolution" control CLTGUICycleCtrl_create ccs; ccs.nHeaderWidth = kGap; ccs.rnBaseRect.m_vMin = m_ScreenRect.m_vMin; ccs.rnBaseRect.m_vMax = m_ScreenRect.m_vMin + LTVector2n(kTotalWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); ccs.szHelpID = "IDS_HELP_RESOLUTION"; ccs.pCommandHandler = this; ccs.nCommandID = CMD_DISPLAY_CYCLE; m_pResolutionCtrl = AddCycle("IDS_DISPLAY_RESOLUTION",ccs); // Setup the resolution control based on the current renderer SetupResolutionCtrl(); CLTGUIToggle_create tcs; tcs.rnBaseRect.m_vMin.Init(); tcs.rnBaseRect.m_vMax = LTVector2n(kGap+kWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); tcs.szHelpID = "IDS_HELP_VSYNC"; tcs.pbValue = &m_bVSync; tcs.nHeaderWidth = kGap; AddToggle("IDS_VSYNC",tcs); tcs.szHelpID = "ScreenDisplay_RestartRender_Help"; tcs.pbValue = &m_bRestartRenderBetweenMaps; tcs.nHeaderWidth = kGap; AddToggle("ScreenDisplay_RestartRender",tcs); tcs.szHelpID = "ScreenDisplay_TextScaling_Help"; tcs.pbValue = &m_bUseTextScaling; tcs.nHeaderWidth = kGap; CLTGUIToggle* pTog = AddToggle("ScreenDisplay_TextScaling",tcs); pTog->SetOnString(LoadString("ScreenDisplay_TextScaling_Large")); pTog->SetOffString(LoadString("ScreenDisplay_TextScaling_Small")); CLTGUISlider_create scs; scs.rnBaseRect.m_vMin.Init(); scs.rnBaseRect.m_vMax = LTVector2n(kGap+kWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); scs.nBarOffset = kGap; scs.szHelpID = "IDS_HELP_GAMMA"; scs.pnValue = &m_nGamma; scs.nMin = 0; scs.nMax = kNumSteps; scs.nIncrement = 1; m_pGamma= AddSlider("IDS_GAMMA", scs ); int nBaseGamma = ConvertToSlider(kDefaultGamma); float xoffset = (m_pGamma->CalculateSliderOffset(nBaseGamma) / m_pGamma->GetScale().x); uint16 nHeight = m_pGamma->GetBarHeight(); float yoffset = ((( (float)m_pGamma->GetBaseHeight()) - (float)nHeight)) / 2.0f; LTVector2n pos = m_pGamma->GetBasePos(); pos.x += int(xoffset - 1.0f); pos.y += int(yoffset - 0.5f); CLTGUIFrame *pBar = debug_new(CLTGUIFrame); CLTGUICtrl_create cs; cs.rnBaseRect.m_vMin.Init(); cs.rnBaseRect.m_vMax = LTVector2n(3,nHeight+2); pBar->Create(0xBF000000,cs); pBar->SetBasePos(pos); pBar->SetScale(g_pInterfaceResMgr->GetScreenScale()); AddControl(pBar); CLTGUICtrl_create imageCs; hFrame.Load(g_pLayoutDB->GetString(m_hLayout,LDB_ScreenAddTex)); imageCs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect,1); pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame, imageCs, true); AddControl(pFrame); uint32 nFontHeight = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenAdditionalInt,0); cs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect,2); m_pWarning = AddTextItem("ScreenDisplay_ResolutionWarning",cs,true,NULL,nFontHeight); m_pWarning->SetWordWrap(true); m_pWarning->Show(false); // Make sure to call the base class if (!CBaseScreen::Build()) return false; UseBack(true,true); return true; }