From 401ea7c477de4a2128085bd52ff640421c142b83 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 2 Mar 2024 15:29:50 -0500 Subject: [PATCH] Add support for enabling/disabling DynamicCamMaps to the options GUI. --- Scripts/Python/xIniDisplay.py | 10 ++++++---- Scripts/Python/xOptionsMenu.py | 23 +++++++++++++++++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Scripts/Python/xIniDisplay.py b/Scripts/Python/xIniDisplay.py index 6d14035559..a7552d1566 100644 --- a/Scripts/Python/xIniDisplay.py +++ b/Scripts/Python/xIniDisplay.py @@ -62,9 +62,10 @@ kGraphicsShadows = "Graphics.Shadow.Enable" kGraphicsVerticalSync = "Graphics.EnableVSync" kGraphicsShadowQuality = "Graphics.Shadow.VisibleDistance" +kGraphicsDynamicReflections = "Graphics.EnablePlanarReflections" -CmdList = [kGraphicsWidth, kGraphicsHeight, kGraphicsColorDepth, kGraphicsWindowed, kGraphicsTextureQuality, kGraphicsAntiAliasLevel, kGraphicsAnisotropicLevel, kGraphicsQualityLevel, kGraphicsShadows, kGraphicsVerticalSync, kGraphicsShadowQuality] -DefaultsList = ["800", "600", "32", "false", "2", "0", "0", "2", "true", "false", "0"] +CmdList = [kGraphicsWidth, kGraphicsHeight, kGraphicsColorDepth, kGraphicsWindowed, kGraphicsTextureQuality, kGraphicsAntiAliasLevel, kGraphicsAnisotropicLevel, kGraphicsQualityLevel, kGraphicsShadows, kGraphicsVerticalSync, kGraphicsShadowQuality, kGraphicsDynamicReflections] +DefaultsList = ["800", "600", "32", "false", "2", "0", "0", "2", "true", "false", "0", "1"] def ConstructFilenameAndPath(): global gFilenameAndPath @@ -105,6 +106,7 @@ def ReadIni(): gIniFile.addEntry(kGraphicsShadows + " true") gIniFile.addEntry(kGraphicsVerticalSync + " false") gIniFile.addEntry(kGraphicsShadowQuality + " 0") + gIniFile.addEntry(kGraphicsDynamicReflections + " 1") gIniFile.writeFile(gFilenameAndPath) else: @@ -120,9 +122,9 @@ def ReadIni(): ConstructFilenameAndPath() gIniFile.writeFile(gFilenameAndPath) -def SetGraphicsOptions(width, heigth, colordepth, windowed, texquality, aaLevel, anisoLevel, qualityLevel, useShadows, vsync, shadowqual): +def SetGraphicsOptions(width, heigth, colordepth, windowed, texquality, aaLevel, anisoLevel, qualityLevel, useShadows, vsync, shadowqual, dynRefl): if gIniFile: - paramList = [width, heigth, colordepth, windowed, texquality, aaLevel, anisoLevel, qualityLevel, useShadows, vsync, shadowqual] + paramList = [width, heigth, colordepth, windowed, texquality, aaLevel, anisoLevel, qualityLevel, useShadows, vsync, shadowqual, dynRefl] for idx in range(len(CmdList)): entry,junk = gIniFile.findByCommand(CmdList[idx]) val = str(paramList[idx]) diff --git a/Scripts/Python/xOptionsMenu.py b/Scripts/Python/xOptionsMenu.py index 4f4a6a826f..375c1e6242 100644 --- a/Scripts/Python/xOptionsMenu.py +++ b/Scripts/Python/xOptionsMenu.py @@ -82,7 +82,7 @@ AdvGameSettingDlg = ptAttribGUIDialog(10, "The Adv Game Settings dialog") ResetWarnDlg = ptAttribGUIDialog(11, "The Reset Warning dialog") ReleaseNotesDlg = ptAttribGUIDialog(12, "Release Notes dialog") -respDisableItems = ptAttribResponder(13, "resp: Disable Items", ["enableRes", "disableRes", "enableWindow", "disableWindow", "enableEAX", "disableEAX", "enableGamma", "disableGamma"]) +respDisableItems = ptAttribResponder(13, "resp: Disable Items", ["enableRes", "disableRes", "enableWindow", "disableWindow", "enableEAX", "disableEAX", "enableGamma", "disableGamma", "enableDynRefl", "disableDynRefl"]) SupportDlg = ptAttribGUIDialog(14, "Support dialog") @@ -372,6 +372,8 @@ kVideoResSliderTag = 461 kVideoResTextTag = 473 kVideoVerticalSyncCheckTag = 453 +kVideoDynamicReflectionsCheckTag = 900 +kVideoDynamicReflectionsTextTag = 901 kGSAudioMuteCheckbox = 456 kGSMouseTurnSensSlider = 460 @@ -394,6 +396,7 @@ kGSDisplayHeader = 720 kGSDispGamaText = 721 kGSDispShadowsText = 722 +kGSDynamicReflectionsText = 901 kGSAdvancedBtnText = 830 # - string IDs for the Advanced Settings localization @@ -1451,6 +1454,19 @@ def InitVideoControlsGUI(self): else: videoField.setChecked(0) + dynReflCB = GraphicsSettingsDlg.dialog.getControlModFromTag(kVideoDynamicReflectionsCheckTag) + dynReflTB = GraphicsSettingsDlg.dialog.getControlModFromTag(kVideoDynamicReflectionsTextTag) + if PtSupportsPlanarReflections(): + respDisableItems.run(self.key, state="enableDynRefl") + dynReflCB.setChecked(bool(opts[xIniDisplay.kGraphicsDynamicReflections])) + dynReflCB.enable() + dynReflTB.setForeColor(ptColor().white()) + else: + respDisableItems.run(self.key, state="disableDynRefl") + dynReflCB.setChecked(False) + dynReflCB.disable() + dynReflTB.setForeColor(ptColor(0.839, 0.785, 0.695, 1)) + # video res stuff vidRes = str(opts[xIniDisplay.kGraphicsWidth]) + "x" + str(opts[xIniDisplay.kGraphicsHeight]) videoResField = ptGUIControlTextBox(GraphicsSettingsDlg.dialog.getControlFromTag(kVideoResTextTag)) @@ -1568,7 +1584,9 @@ def WriteVideoControls(self, setMode = 0): gammaField = ptGUIControlKnob(GraphicsSettingsDlg.dialog.getControlFromTag(kGSDisplayGammaSlider)) gamma = gammaField.getValue() - xIniDisplay.SetGraphicsOptions(width, height, colordepth, windowed, tex_quality, antialias, aniso, quality, shadowsstr, vsyncstr, shadow_quality) + dynRefl = int(GraphicsSettingsDlg.dialog.getControlModFromTag(kVideoDynamicReflectionsCheckTag).isChecked()) + + xIniDisplay.SetGraphicsOptions(width, height, colordepth, windowed, tex_quality, antialias, aniso, quality, shadowsstr, vsyncstr, shadow_quality, dynRefl) xIniDisplay.WriteIni() self.setNewChronicleVar("gamma", gamma) @@ -1577,6 +1595,7 @@ def WriteVideoControls(self, setMode = 0): PtDebugPrint("SETTING GAMMA") PtSetGamma2(gamma) PtSetShadowVisDistance(shadow_quality) + PtEnablePlanarReflections(dynRefl) if shadows: PtEnableShadows()