Skip to content

Commit

Permalink
Add support for enabling/disabling DynamicCamMaps to the options GUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoikas committed Mar 2, 2024
1 parent 46a7fc4 commit 4fa0340
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Scripts/Python/xIniDisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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])
Expand Down
22 changes: 20 additions & 2 deletions Scripts/Python/xOptionsMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down Expand Up @@ -372,6 +372,8 @@
kVideoResSliderTag = 461
kVideoResTextTag = 473
kVideoVerticalSyncCheckTag = 453
kVideoDynamicReflectionsCheckTag = 900
kVideoDynamicReflectionsTextTag = 901

kGSAudioMuteCheckbox = 456
kGSMouseTurnSensSlider = 460
Expand Down Expand Up @@ -1450,6 +1452,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))
Expand Down Expand Up @@ -1567,7 +1582,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)

Expand All @@ -1576,6 +1593,7 @@ def WriteVideoControls(self, setMode = 0):
PtDebugPrint("SETTING GAMMA")
PtSetGamma2(gamma)
PtSetShadowVisDistance(shadow_quality)
PtEnablePlanarReflections(dynRefl)

if shadows:
PtEnableShadows()
Expand Down

0 comments on commit 4fa0340

Please sign in to comment.