Skip to content

Commit

Permalink
Add support for configuring Psychic Dominator lighting
Browse files Browse the repository at this point in the history
  • Loading branch information
ZivDero committed Jan 8, 2024
1 parent 552d922 commit 6d05973
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 22 deletions.
186 changes: 165 additions & 21 deletions src/TSMapEditor/Config/UI/Windows/LightingSettingsWindow.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ $CC00=lblHeader:XNALabel
$CC01=lblDescription:XNALabel
$CC03=panelNormal:EditorPanel
$CC04=panelIonStorm:EditorPanel
$CC05=btnApply:EditorButton
$CC05=panelDominator:EditorPanel
$CC06=btnApply:EditorButton
$Height=getBottom(btnApply) + EMPTY_SPACE_BOTTOM
HasCloseButton=true

Expand All @@ -20,6 +21,7 @@ $X=EMPTY_SPACE_SIDES
$Y=getBottom(lblHeader) + EMPTY_SPACE_TOP
Text=Lighting settings define the lighting of the terrain on the map.

; ********** Normal Lighting **********

[panelNormal]
$X=EMPTY_SPACE_SIDES
Expand All @@ -30,19 +32,21 @@ $CCn00=tbAmbientNormal:EditorNumberTextBox
$CCn01=lblAmbientNormal:XNALabel
$CCn02=tbLevelNormal:EditorNumberTextBox
$CCn03=lblLevelNormal:XNALabel
$CCn04=tbRedNormal:EditorNumberTextBox
$CCn05=lblRedNormal:XNALabel
$CCn06=tbGreenNormal:EditorNumberTextBox
$CCn07=lblGreenNormal:XNALabel
$CCn08=tbBlueNormal:EditorNumberTextBox
$CCn09=lblBlueNormal:XNALabel
$CCn04=tbGroundNormal:EditorNumberTextBox
$CCn05=lblGroundNormal:XNALabel
$CCn06=tbRedNormal:EditorNumberTextBox
$CCn07=lblRedNormal:XNALabel
$CCn08=tbGreenNormal:EditorNumberTextBox
$CCn09=lblGreenNormal:XNALabel
$CCn10=tbBlueNormal:EditorNumberTextBox
$CCn11=lblBlueNormal:XNALabel
$Height=getBottom(tbBlueNormal) + EMPTY_SPACE_BOTTOM

[lblNormal]
$X=EMPTY_SPACE_SIDES
$Y=EMPTY_SPACE_TOP
FontIndex=1
Text=Normal settings
Text=Normal Settings

[tbAmbientNormal]
$X=100
Expand All @@ -61,17 +65,29 @@ $X=getX(tbAmbientNormal)
$Y=getBottom(tbAmbientNormal) + VERTICAL_SPACING
$Width=getWidth(tbAmbientNormal)
AllowDecimals=true
NextControl=tbRedNormal
NextControl=tbGroundNormal

[lblLevelNormal]
$X=EMPTY_SPACE_SIDES
$Y=getY(tbLevelNormal) + 1
Text=Level:

[tbGroundNormal]
$X=getX(tbLevelNormal)
$Y=getBottom(tbLevelNormal) + VERTICAL_SPACING
$Width=getWidth(tbLevelNormal)
AllowDecimals=true
NextControl=tbRedNormal

[lblGroundNormal]
$X=EMPTY_SPACE_SIDES
$Y=getY(tbGroundNormal) + 1
Text=Ground:

[tbRedNormal]
$Width=getWidth(tbAmbientNormal)
$X=getWidth(panelNormal) - EMPTY_SPACE_SIDES - getWidth(tbRedNormal)
$Y=EMPTY_SPACE_TOP
$Y=getY(tbAmbientNormal))
AllowDecimals=true
NextControl=tbGreenNormal

Expand Down Expand Up @@ -104,6 +120,7 @@ $X=getX(lblRedNormal)
$Y=getY(tbBlueNormal) + 1
Text=Blue:

; ********** Ion Storm Lighting **********

[panelIonStorm]
$X=EMPTY_SPACE_SIDES
Expand All @@ -114,19 +131,21 @@ $CCn00=tbAmbientIS:EditorNumberTextBox
$CCn01=lblAmbientIS:XNALabel
$CCn02=tbLevelIS:EditorNumberTextBox
$CCn03=lblLevelIS:XNALabel
$CCn04=tbRedIS:EditorNumberTextBox
$CCn05=lblRedIS:XNALabel
$CCn06=tbGreenIS:EditorNumberTextBox
$CCn07=lblGreenIS:XNALabel
$CCn08=tbBlueIS:EditorNumberTextBox
$CCn09=lblBlueIS:XNALabel
$CCn04=tbGroundIS:EditorNumberTextBox
$CCn05=lblGroundIS:XNALabel
$CCn06=tbRedIS:EditorNumberTextBox
$CCn07=lblRedIS:XNALabel
$CCn08=tbGreenIS:EditorNumberTextBox
$CCn09=lblGreenIS:XNALabel
$CCn10=tbBlueIS:EditorNumberTextBox
$CCn11=lblBlueIS:XNALabel
$Height=getHeight(panelNormal)

[lblIonStorm]
$X=EMPTY_SPACE_SIDES
$Y=EMPTY_SPACE_TOP
FontIndex=1
Text=Ion Storm settings
Text=Ion Storm Settings

[tbAmbientIS]
$X=100
Expand All @@ -145,17 +164,29 @@ $X=getX(tbAmbientIS)
$Y=getBottom(tbAmbientIS) + VERTICAL_SPACING
$Width=getWidth(tbAmbientIS)
AllowDecimals=true
NextControl=tbRedIS
NextControl=tbGroundIS

[lblLevelIS]
$X=EMPTY_SPACE_SIDES
$Y=getY(tbLevelIS) + 1
Text=Level:

[tbGroundIS]
$X=getX(tbLevelIS)
$Y=getBottom(tbLevelIS) + VERTICAL_SPACING
$Width=getWidth(tbLevelIS)
AllowDecimals=true
NextControl=tbRedIS

[lblGroundIS]
$X=EMPTY_SPACE_SIDES
$Y=getY(tbGroundIS) + 1
Text=Ground:

[tbRedIS]
$Width=getWidth(tbAmbientIS)
$X=getWidth(panelIonStorm) - EMPTY_SPACE_SIDES - getWidth(tbRedIS)
$Y=EMPTY_SPACE_TOP
$Y=getY(tbAmbientIS)
AllowDecimals=true
NextControl=tbGreenIS

Expand Down Expand Up @@ -187,9 +218,122 @@ $X=getX(lblRedIS)
$Y=getY(tbBlueIS) + 1
Text=Blue:

; ********** Dominator Lighting **********

[panelDominator]
$X=EMPTY_SPACE_SIDES
$Y=getBottom(panelIonStorm) + VERTICAL_SPACING
$Width=getWidth(panelIonStorm)
$CCnl=lblDominator:XNALabel
$CCn00=tbAmbientDominator:EditorNumberTextBox
$CCn01=lblAmbientDominator:XNALabel
$CCn02=tbAmbientChangeRateDominator:EditorNumberTextBox
$CCn03=lblAmbientChangeRateDominator:XNALabel
$CCn04=tbLevelDominator:EditorNumberTextBox
$CCn05=lblLevelDominator:XNALabel
$CCn06=tbGroundDominator:EditorNumberTextBox
$CCn07=lblGroundDominator:XNALabel
$CCn08=tbRedDominator:EditorNumberTextBox
$CCn09=lblRedDominator:XNALabel
$CCn10=tbGreenDominator:EditorNumberTextBox
$CCn11=lblGreenDominator:XNALabel
$CCn12=tbBlueDominator:EditorNumberTextBox
$CCn13=lblBlueDominator:XNALabel
$Height=getBottom(tbGroundDominator) + EMPTY_SPACE_BOTTOM
$Enabled=USE_COUNTRIES

[lblDominator]
$X=EMPTY_SPACE_SIDES
$Y=EMPTY_SPACE_TOP
FontIndex=1
Text=Dominator Settings

[tbAmbientDominator]
$X=100
$Y=getBottom(lblDominator) + EMPTY_SPACE_TOP
$Width=((getWidth(panelDominator) / 2) - EMPTY_SPACE_SIDES) - getX(tbAmbientDominator)
AllowDecimals=true
NextControl=tbAmbientChangeRateDominator

[lblAmbientDominator]
$X=EMPTY_SPACE_SIDES
$Y=getY(tbAmbientDominator) + 1
Text=Ambient:

[tbAmbientChangeRateDominator]
$X=getX(tbAmbientDominator)
$Y=getBottom(tbAmbientDominator) + VERTICAL_SPACING
$Width=getWidth(tbAmbientDominator)
AllowDecimals=true
NextControl=tbLevelDominator

[lblAmbientChangeRateDominator]
$X=EMPTY_SPACE_SIDES
Text=Ambient@Change Rate:
$Y=getY(tbAmbientChangeRateDominator) + (getHeight(tbAmbientChangeRateDominator) / 2) - (getHeight(lblAmbientChangeRateDominator) / 2)

[tbLevelDominator]
$X=getX(tbAmbientChangeRateDominator)
$Y=getBottom(tbAmbientChangeRateDominator) + VERTICAL_SPACING
$Width=getWidth(tbAmbientChangeRateDominator)
AllowDecimals=true
NextControl=tbGroundDominator

[lblLevelDominator]
$X=EMPTY_SPACE_SIDES
$Y=getY(tbLevelDominator) + 1
Text=Level:

[tbGroundDominator]
$X=getX(tbLevelDominator)
$Y=getBottom(tbLevelDominator) + VERTICAL_SPACING
$Width=getWidth(tbLevelDominator)
AllowDecimals=true
NextControl=tbRedDominator

[lblGroundDominator]
$X=EMPTY_SPACE_SIDES
$Y=getY(tbGroundDominator) + 1
Text=Ground:

[tbRedDominator]
$Width=getWidth(tbAmbientDominator)
$X=getWidth(panelDominator) - EMPTY_SPACE_SIDES - getWidth(tbRedDominator)
$Y=getY(tbAmbientDominator)
AllowDecimals=true
NextControl=tbGreenDominator

[lblRedDominator]
$X=(getWidth(panelDominator) / 2) + (EMPTY_SPACE_SIDES * 2)
$Y=getY(tbRedDominator) + 1
Text=Red:

[tbGreenDominator]
$Width=getWidth(tbRedDominator)
$X=getX(tbRedDominator)
$Y=getBottom(tbRedDominator) + VERTICAL_SPACING
AllowDecimals=true
NextControl=tbBlueDominator

[lblGreenDominator]
$X=getX(lblRedDominator)
$Y=getY(tbGreenDominator) + 1
Text=Green:

[tbBlueDominator]
$Width=getWidth(tbRedDominator)
$X=getX(tbRedDominator)
$Y=getBottom(tbGreenDominator) + VERTICAL_SPACING
AllowDecimals=true

[lblBlueDominator]
$X=getX(lblRedDominator)
$Y=getY(tbBlueDominator) + 1
Text=Blue:


[btnApply]
Width=100
$X=horizontalCenterOnParent()
$Y=getBottom(panelIonStorm) + EMPTY_SPACE_TOP
$Y=(getBottom(panelDominator) * USE_COUNTRIES) + (getBottom(panelIonStorm) * (1 - USE_COUNTRIES)) + EMPTY_SPACE_TOP
Text=Apply

8 changes: 8 additions & 0 deletions src/TSMapEditor/Models/Lighting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ public class Lighting : INIDefineable
public double IonLevel { get; set; }
public double IonGround { get; set; }

public double? DominatorRed { get; set; }
public double? DominatorGreen { get; set; }
public double? DominatorBlue { get; set; }
public double? DominatorAmbient { get; set; }
public double? DominatorAmbientChangeRate { get; set; }
public double? DominatorLevel { get; set; }
public double? DominatorGround { get; set; }

public void ReadFromIniFile(IniFile iniFile)
{
var lightingSection = iniFile.GetSection(LightingIniSectionName);
Expand Down
2 changes: 2 additions & 0 deletions src/TSMapEditor/UI/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public override void Initialize()

// Try to select "Neutral" as default house
editorState.ObjectOwner = map.GetHouses().Find(h => h.ININame == "Neutral");
if (editorState.ObjectOwner == null && map.GetHouses().Count > 0)
editorState.ObjectOwner = map.GetHouses()[0];
editorState.CursorAction = null;

Alpha = 0f;
Expand Down
Loading

0 comments on commit 6d05973

Please sign in to comment.