MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / OnButtonClicked

Method OnButtonClicked

engine/Poseidon/UI/OptionsUIImplVideo.cpp:371–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371void DisplayOptionsVideo::OnButtonClicked(int idc)
372{
373 switch (idc)
374 {
375 case IDC_OK:
376 {
377 ParamFile userCfg;
378 userCfg.Parse(GetUserParams());
379 userCfg.Add("blood", ENGINE_CONFIG.blood);
380 userCfg.Save(GetUserParams());
381 }
382 Exit(idc);
383 break;
384 case IDC_CANCEL:
385 GEngine->SetWindowMode(_oldWindowed ? WindowMode::Windowed : WindowMode::Borderless);
386 if (!_oldWindowed)
387 {
388 GEngine->SwitchRes(_oldResX, _oldResY, _oldBpp);
389 }
390 GEngine->SwitchRefreshRate(_oldRefreshRate);
391 GEngine->SetBrightness(_oldBright);
392 GEngine->SetGamma(_oldGamma);
393 GScene->SetFrameRateSettings(_oldFrameRate);
394 GScene->SetQualitySettings(_oldQuality);
395 SetHWTL(_oldHWTL);
396 GScene->SetObjectShadows(_oldObjShadows);
397 GScene->SetVehicleShadows(_oldVehShadows);
398 GScene->SetCloudlets(_oldSmokes);
399 ENGINE_CONFIG.blood = _oldBlood;
400 GEngine->SetMultitexturing(_oldMultitexturing);
401 if (GEngine->CanWBuffer())
402 {
403 GEngine->SetWBuffer(_oldWBuffer);
404 }
405 GScene->SetPreferredViewDistance(_oldVisibility);
406 GScene->SetPreferredTerrainGrid(_oldTerrain);
407 Exit(idc);
408 break;
409 case IDC_OPTIONS_OBJSHADOWS:
410 {
411 C3DActiveText* ctrl = static_cast<C3DActiveText*>(GetCtrl(IDC_OPTIONS_OBJSHADOWS));
412 bool set = !GScene->GetObjectShadows();
413 GScene->SetObjectShadows(set);
414 ctrl->SetText(LocalizeString(set ? IDS_ENABLED : IDS_DISABLED));
415 }
416 break;
417 case IDC_OPTIONS_VEHSHADOWS:
418 {
419 C3DActiveText* ctrl = static_cast<C3DActiveText*>(GetCtrl(IDC_OPTIONS_VEHSHADOWS));
420 bool set = !GScene->GetVehicleShadows();
421 GScene->SetVehicleShadows(set);
422 ctrl->SetText(LocalizeString(set ? IDS_ENABLED : IDS_DISABLED));
423 }
424 break;
425 case IDC_OPTIONS_CLOUDLETS:
426 {
427 C3DActiveText* ctrl = static_cast<C3DActiveText*>(GetCtrl(IDC_OPTIONS_CLOUDLETS));
428 bool set = !GScene->GetCloudlets();

Callers

nothing calls this directly

Calls 15

GetUserParamsFunction · 0.85
SetHWTLFunction · 0.85
GetCtrlFunction · 0.85
LocalizeStringFunction · 0.85
SetFrameRateSettingsMethod · 0.80
SetQualitySettingsMethod · 0.80
SetObjectShadowsMethod · 0.80
SetVehicleShadowsMethod · 0.80
SetCloudletsMethod · 0.80

Tested by

no test coverage detected