void CStartMenuView::OnTimer(UINT_PTR nIDEvent) { // TODO: Fügen Sie hier Ihren Meldungsbehandlungscode ein, und/oder benutzen Sie den Standard. m_nLogoTimer++; if (m_nLogoTimer < 2) { this->SetTimer(1,25,NULL); CIniLoader* pIni = CIniLoader::GetInstance(); AssertBotE(pIni); bool bUseMusic; pIni->ReadValue("Audio", "MUSIC", bUseMusic); if (bUseMusic) { CSoundManager* pSoundManager = CSoundManager::GetInstance(); AssertBotE(pSoundManager); float fMusicVolume; pIni->ReadValue("Audio", "MUSICVOLUME", fMusicVolume); pSoundManager->StartMusic(network::RACE_1, fMusicVolume); } return; } m_nTimeCounter++; m_nTimeCounter *= 1.025; if (m_nTimeCounter >= 255) { this->KillTimer(1); ShowMPButtons(false); } Invalidate(false); __super::OnTimer(nIDEvent); }
void CStartMenuView::OnBnClickedOptions() { CIniLoader* pIni = CIniLoader::GetInstance(); int nOldSeed = -1; pIni->ReadValue("Special", "RANDOMSEED", nOldSeed); CSettingsDlg dlg; if (dlg.DoModal() == IDOK) CBotEDoc::RandomSeed(&nOldSeed); }
BOOL CSettingsDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: hier zusätzliche Initialisierung hinzufügen. m_ctrlDifficultySlider.SetRange(0,4); m_ctrlDifficultySlider.SetTicFreq(1); m_ctrlMusicvolume.SetRange(0,100); m_ctrlMusicvolume.SetTicFreq(1); m_ctrlTooltipDelay.SetRange(0,2000); m_ctrlTooltipDelay.SetTicFreq(50); m_ctrlStarDensity.SetRange(0,100); m_ctrlStarDensity.SetTicFreq(1); m_ctrlMinorDensity.SetRange(0,100); m_ctrlMinorDensity.SetTicFreq(1); m_ctrlAnomalyDensity.SetRange(0,100); m_ctrlAnomalyDensity.SetTicFreq(1); m_ctrlAlienFrequency.SetRange(0, max_alien_frequency); m_ctrlAlienFrequency.SetTicFreq(1); CIniLoader* pIni = CIniLoader::GetInstance(); AssertBotE(pIni); // General bool bAutosave = true; if (!pIni->ReadValue("General", "AUTOSAVE", bAutosave)) AssertBotE(false); m_bAutoave = bAutosave; if (!pIni->ReadValue("General", "DIFFICULTY", m_sDifficulty)) AssertBotE(false); m_sDifficulty.MakeUpper(); if (m_sDifficulty == "BABY") m_ctrlDifficultySlider.SetPos(0); else if (m_sDifficulty == "EASY") m_ctrlDifficultySlider.SetPos(1); else if (m_sDifficulty == "NORMAL") m_ctrlDifficultySlider.SetPos(2); else if (m_sDifficulty == "HARD") m_ctrlDifficultySlider.SetPos(3); else if (m_sDifficulty == "IMPOSSIBLE") m_ctrlDifficultySlider.SetPos(4); CWnd* pCtrl = GetDlgItem(IDC_STATIC_DIFFICULTY); if (pCtrl) pCtrl->SetWindowText(m_sDifficulty); //Galaxysize m_comboGalaxysize.AddString("TINY 15x10"); m_comboGalaxysize.AddString("SMALL 20x15"); m_comboGalaxysize.AddString("CLASSIC 30x20"); m_comboGalaxysize.AddString("HUGE 40x30"); int sizeh=30,sizev=20; pIni->ReadValue("Special", "MAPSIZEH", sizeh); pIni->ReadValue("Special", "MAPSIZEV", sizev); if(sizeh==15&&sizev==10) { m_comboGalaxysize.SetCurSel(0); } else if(sizeh==20&&sizev==15) { m_comboGalaxysize.SetCurSel(1); } else if(sizeh==30&&sizev==20) { m_comboGalaxysize.SetCurSel(2); } else if(sizeh==40&&sizev==30) { m_comboGalaxysize.SetCurSel(3); } else { CString s; s.Format("Custom %dx%d",sizeh,sizev); m_comboGalaxysize.AddString(s); m_comboGalaxysize.SetCurSel(3); } //Galaxyshape m_comboGalaxyshape.AddString("irregular"); m_comboGalaxyshape.AddString("elliptic"); m_comboGalaxyshape.AddString("spiral"); m_comboGalaxyshape.AddString("ring"); m_comboGalaxyshape.AddString("lenticular"); m_comboGalaxyshape.AddString("islands"); int genMode=0; pIni->ReadValue("Special", "GENERATIONMODE", genMode); m_comboGalaxyshape.SetCurSel(genMode); // Audio bool bHardwareSound = true; if (!pIni->ReadValue("Audio", "HARDWARESOUND", bHardwareSound)) AssertBotE(false); m_bHardwaresound = bHardwareSound; bool bSound = true; if (!pIni->ReadValue("Audio", "SOUND", bSound)) AssertBotE(false); m_bSound = bSound; bool bMusic = true; if (!pIni->ReadValue("Audio", "MUSIC", bMusic)) AssertBotE(false); m_bMusic = bMusic; float fMusicVolume = 0.3f; if (!pIni->ReadValue("Audio", "MUSICVOLUME", fMusicVolume)) AssertBotE(false); m_ctrlMusicvolume.SetPos(fMusicVolume * 100); // Video bool bShowTraderoutes = true; if (!pIni->ReadValue("Video", "SHOWTRADEROUTES", bShowTraderoutes)) AssertBotE(false); m_bShowTraderoutes = bShowTraderoutes; bool bAnimatedIcon = true; if (!pIni->ReadValue("Video", "ANIMATEDICON", bAnimatedIcon)) AssertBotE(false); m_bAnimatedIcon = bAnimatedIcon; bool bShowMiniMap = true; if (!pIni->ReadValue("Video", "SHOWMINIMAP", bShowMiniMap)) AssertBotE(false); m_bShowMiniMap = bShowMiniMap; bool bShowEventPictures = true; if (!pIni->ReadValue("Video", "SHOWEVENTPICTURES", bShowEventPictures)) AssertBotE(false); m_bShowEventPictures = bShowEventPictures; int nTooltipDelay = 750; if (!pIni->ReadValue("Video", "TOOLTIPDELAY", nTooltipDelay)) AssertBotE(false); m_ctrlTooltipDelay.SetPos(nTooltipDelay); // Control bool bShowScrollbars = false; if (!pIni->ReadValue("Control", "SHOWSCROLLBARS", bShowScrollbars)) AssertBotE(false); m_bShowScrollBars = bShowScrollbars; bool bInvertMouse = false; if (!pIni->ReadValue("Control", "INVERTMOUSE", bInvertMouse)) AssertBotE(false); m_bInvertMouse = bInvertMouse; bool bHideMenu = false; if (!pIni->ReadValue("Control", "HIDEMENUBAR", bHideMenu)) AssertBotE(false); m_bHideMenu = bHideMenu; // Special (Ingame) int nRandomSeed = -1; if (!pIni->ReadValue("Special", "RANDOMSEED", nRandomSeed)) AssertBotE(false); if (nRandomSeed < -1) nRandomSeed = -1; CString sRandomSeed; sRandomSeed.Format("%d", nRandomSeed); m_edtRandomSeed.SetWindowText(sRandomSeed); int nStarDensity = 35; if (!pIni->ReadValue("Special", "STARDENSITY", nStarDensity)) AssertBotE(false); m_ctrlStarDensity.SetPos(nStarDensity); int nMinorDensity = 30; if (!pIni->ReadValue("Special", "MINORDENSITY", nMinorDensity)) AssertBotE(false); m_ctrlMinorDensity.SetPos(nMinorDensity); int nAnomalyDensity = 9; if (!pIni->ReadValue("Special", "ANOMALYDENSITY", nAnomalyDensity)) AssertBotE(false); m_ctrlAnomalyDensity.SetPos(nAnomalyDensity); float nAlienFrequency = 0; if (!pIni->ReadValue("Special", "ALIENENTITIES", nAlienFrequency)) AssertBotE(false); m_ctrlAlienFrequency.SetPos(nAlienFrequency); bool bRandomEvents = true; if (!pIni->ReadValue("Special", "RANDOMEVENTS", bRandomEvents)) AssertBotE(false); m_bRandomEvents = bRandomEvents; // Victory Conditions bool bVCElimination = true; if (!pIni->ReadValue("Victory_Conditions", "Elimination", bVCElimination)) AssertBotE(false); m_bVCElimination = bVCElimination; bool bVCDiplomacy = false; if (!pIni->ReadValue("Victory_Conditions", "Diplomacy", bVCDiplomacy)) AssertBotE(false); m_bVCDiplomacy = bVCDiplomacy; bool bVCConquest = false; if (!pIni->ReadValue("Victory_Conditions", "Conquest", bVCConquest)) AssertBotE(false); m_bVCConquest = bVCConquest; bool bVCResearch = false; if (!pIni->ReadValue("Victory_Conditions", "Research", bVCResearch)) AssertBotE(false); m_bVCResearch = bVCResearch; bool bVCCombat = false; if (!pIni->ReadValue("Victory_Conditions", "Combat", bVCCombat)) AssertBotE(false); m_bVCCombat = bVCCombat; bool bVCSabotage = false; if (!pIni->ReadValue("Victory_Conditions", "Sabotage", bVCSabotage)) AssertBotE(false); m_bVCSabotage = bVCSabotage; // alle nicht während des Spiels änderbaren Einstellungen deaktivieren if (m_bDisable) { CWnd* pWnd = GetDlgItem(IDC_SLIDER_STARDENSITY); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_SLIDER_MINORDENSITY); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_SLIDER_ANOMALYDENSITY); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_CHECK_VC_ELIMINATION); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_CHECK_VC_DIPLOMACY); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_CHECK_VC_CONQUEST); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_CHECK_VC_RESEARCH); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_CHECK_VC_COMBAT); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_CHECK_VC_SABOTAGE); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_COMBOGALAXYSIZE); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_COMBOGALAXYSHAPE); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_EDIT_RANDOMSEED); if (pWnd) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_CHECK_RANDOMEVENTS); if (pWnd) pWnd->EnableWindow(FALSE); } UpdateData(false); return TRUE; // return TRUE unless you set the focus to a control // AUSNAHME: OCX-Eigenschaftenseite muss FALSE zurückgeben. }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; /*if (!m_wndToolBar.CreateEx(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Symbolleiste konnte nicht erstellt werden\n"); return -1; // Fehler bei Erstellung } if (!m_wndDlgBar.Create(this, IDR_MAINFRAME, CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR)) { TRACE0("Dialogleiste konnte nicht erstellt werden\n"); return -1; // Fehler bei Erstellung } if (!m_wndReBar.Create(this) || !m_wndReBar.AddBar(&m_wndToolBar) || !m_wndReBar.AddBar(&m_wndDlgBar)) { TRACE0("Infoleiste konnte nicht erstellt werden\n"); return -1; // Fehler bei Erstellung }*/ /* if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Statusleiste konnte nicht erstellt werden\n"); return -1; // Fehler bei Erstellung } */ // ZU ERLEDIGEN: Entfernen, wenn Sie keine QuickInfos wünschen // m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | // CBRS_TOOLTIPS | CBRS_FLYBY); m_CPPToolTip.Create(this); /////////////////////////// // Behaviour m_CPPToolTip.SetNotify(); m_CPPToolTip.SetBehaviour(PPTOOLTIP_MULTIPLE_SHOW); CIniLoader* pIni = CIniLoader::GetInstance(); AssertBotE(pIni); int nDelayTime = 750; pIni->ReadValue("Video", "TOOLTIPDELAY", nDelayTime); // Times (in ms) m_CPPToolTip.SetDelayTime(PPTOOLTIP_TIME_INITIAL, nDelayTime); // nach 750ms wird es angezeigt m_CPPToolTip.SetDelayTime(PPTOOLTIP_TIME_AUTOPOP, 200000); // how long it stays //m_CPPToolTip.SetDefaultSizes(FALSE); m_CPPToolTip.SetTransparency(20); m_CPPToolTip.SetColorBk(RGB(20,20,20)); m_CPPToolTip.SetBorder(RGB(250,250,250), 1, 1); m_CPPToolTip.SetMaxTipWidth(300); // EFFECT_SOFTBUMP // EFFECT_DIAGSHADE //m_CPPToolTip.SetEffectBk(CPPDrawManager::EFFECT_SOFTBUMP,10); m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_ROUNDED_CX, 1); m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_ROUNDED_CY, 1); //m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_MARGIN_CX, 5); //m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_MARGIN_CY, 5); //m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_WIDTH_ANCHOR, 0); m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_HEIGHT_ANCHOR, 0); //m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_MARGIN_ANCHOR, 0); //m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_OFFSET_ANCHOR_CX, 0); //m_CPPToolTip.SetSize(CPPToolTip::PPTTSZ_OFFSET_ANCHOR_CY, 0); /////////////////////////// return 0; }