Skip to content

Commit 6d05973

Browse files
authored
Add support for configuring Psychic Dominator lighting
1 parent 552d922 commit 6d05973

4 files changed

Lines changed: 223 additions & 22 deletions

File tree

src/TSMapEditor/Config/UI/Windows/LightingSettingsWindow.ini

Lines changed: 165 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ $CC00=lblHeader:XNALabel
44
$CC01=lblDescription:XNALabel
55
$CC03=panelNormal:EditorPanel
66
$CC04=panelIonStorm:EditorPanel
7-
$CC05=btnApply:EditorButton
7+
$CC05=panelDominator:EditorPanel
8+
$CC06=btnApply:EditorButton
89
$Height=getBottom(btnApply) + EMPTY_SPACE_BOTTOM
910
HasCloseButton=true
1011

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

24+
; ********** Normal Lighting **********
2325

2426
[panelNormal]
2527
$X=EMPTY_SPACE_SIDES
@@ -30,19 +32,21 @@ $CCn00=tbAmbientNormal:EditorNumberTextBox
3032
$CCn01=lblAmbientNormal:XNALabel
3133
$CCn02=tbLevelNormal:EditorNumberTextBox
3234
$CCn03=lblLevelNormal:XNALabel
33-
$CCn04=tbRedNormal:EditorNumberTextBox
34-
$CCn05=lblRedNormal:XNALabel
35-
$CCn06=tbGreenNormal:EditorNumberTextBox
36-
$CCn07=lblGreenNormal:XNALabel
37-
$CCn08=tbBlueNormal:EditorNumberTextBox
38-
$CCn09=lblBlueNormal:XNALabel
35+
$CCn04=tbGroundNormal:EditorNumberTextBox
36+
$CCn05=lblGroundNormal:XNALabel
37+
$CCn06=tbRedNormal:EditorNumberTextBox
38+
$CCn07=lblRedNormal:XNALabel
39+
$CCn08=tbGreenNormal:EditorNumberTextBox
40+
$CCn09=lblGreenNormal:XNALabel
41+
$CCn10=tbBlueNormal:EditorNumberTextBox
42+
$CCn11=lblBlueNormal:XNALabel
3943
$Height=getBottom(tbBlueNormal) + EMPTY_SPACE_BOTTOM
4044

4145
[lblNormal]
4246
$X=EMPTY_SPACE_SIDES
4347
$Y=EMPTY_SPACE_TOP
4448
FontIndex=1
45-
Text=Normal settings
49+
Text=Normal Settings
4650

4751
[tbAmbientNormal]
4852
$X=100
@@ -61,17 +65,29 @@ $X=getX(tbAmbientNormal)
6165
$Y=getBottom(tbAmbientNormal) + VERTICAL_SPACING
6266
$Width=getWidth(tbAmbientNormal)
6367
AllowDecimals=true
64-
NextControl=tbRedNormal
68+
NextControl=tbGroundNormal
6569

6670
[lblLevelNormal]
6771
$X=EMPTY_SPACE_SIDES
6872
$Y=getY(tbLevelNormal) + 1
6973
Text=Level:
7074

75+
[tbGroundNormal]
76+
$X=getX(tbLevelNormal)
77+
$Y=getBottom(tbLevelNormal) + VERTICAL_SPACING
78+
$Width=getWidth(tbLevelNormal)
79+
AllowDecimals=true
80+
NextControl=tbRedNormal
81+
82+
[lblGroundNormal]
83+
$X=EMPTY_SPACE_SIDES
84+
$Y=getY(tbGroundNormal) + 1
85+
Text=Ground:
86+
7187
[tbRedNormal]
7288
$Width=getWidth(tbAmbientNormal)
7389
$X=getWidth(panelNormal) - EMPTY_SPACE_SIDES - getWidth(tbRedNormal)
74-
$Y=EMPTY_SPACE_TOP
90+
$Y=getY(tbAmbientNormal))
7591
AllowDecimals=true
7692
NextControl=tbGreenNormal
7793

@@ -104,6 +120,7 @@ $X=getX(lblRedNormal)
104120
$Y=getY(tbBlueNormal) + 1
105121
Text=Blue:
106122

123+
; ********** Ion Storm Lighting **********
107124

108125
[panelIonStorm]
109126
$X=EMPTY_SPACE_SIDES
@@ -114,19 +131,21 @@ $CCn00=tbAmbientIS:EditorNumberTextBox
114131
$CCn01=lblAmbientIS:XNALabel
115132
$CCn02=tbLevelIS:EditorNumberTextBox
116133
$CCn03=lblLevelIS:XNALabel
117-
$CCn04=tbRedIS:EditorNumberTextBox
118-
$CCn05=lblRedIS:XNALabel
119-
$CCn06=tbGreenIS:EditorNumberTextBox
120-
$CCn07=lblGreenIS:XNALabel
121-
$CCn08=tbBlueIS:EditorNumberTextBox
122-
$CCn09=lblBlueIS:XNALabel
134+
$CCn04=tbGroundIS:EditorNumberTextBox
135+
$CCn05=lblGroundIS:XNALabel
136+
$CCn06=tbRedIS:EditorNumberTextBox
137+
$CCn07=lblRedIS:XNALabel
138+
$CCn08=tbGreenIS:EditorNumberTextBox
139+
$CCn09=lblGreenIS:XNALabel
140+
$CCn10=tbBlueIS:EditorNumberTextBox
141+
$CCn11=lblBlueIS:XNALabel
123142
$Height=getHeight(panelNormal)
124143

125144
[lblIonStorm]
126145
$X=EMPTY_SPACE_SIDES
127146
$Y=EMPTY_SPACE_TOP
128147
FontIndex=1
129-
Text=Ion Storm settings
148+
Text=Ion Storm Settings
130149

131150
[tbAmbientIS]
132151
$X=100
@@ -145,17 +164,29 @@ $X=getX(tbAmbientIS)
145164
$Y=getBottom(tbAmbientIS) + VERTICAL_SPACING
146165
$Width=getWidth(tbAmbientIS)
147166
AllowDecimals=true
148-
NextControl=tbRedIS
167+
NextControl=tbGroundIS
149168

150169
[lblLevelIS]
151170
$X=EMPTY_SPACE_SIDES
152171
$Y=getY(tbLevelIS) + 1
153172
Text=Level:
154173

174+
[tbGroundIS]
175+
$X=getX(tbLevelIS)
176+
$Y=getBottom(tbLevelIS) + VERTICAL_SPACING
177+
$Width=getWidth(tbLevelIS)
178+
AllowDecimals=true
179+
NextControl=tbRedIS
180+
181+
[lblGroundIS]
182+
$X=EMPTY_SPACE_SIDES
183+
$Y=getY(tbGroundIS) + 1
184+
Text=Ground:
185+
155186
[tbRedIS]
156187
$Width=getWidth(tbAmbientIS)
157188
$X=getWidth(panelIonStorm) - EMPTY_SPACE_SIDES - getWidth(tbRedIS)
158-
$Y=EMPTY_SPACE_TOP
189+
$Y=getY(tbAmbientIS)
159190
AllowDecimals=true
160191
NextControl=tbGreenIS
161192

@@ -187,9 +218,122 @@ $X=getX(lblRedIS)
187218
$Y=getY(tbBlueIS) + 1
188219
Text=Blue:
189220

221+
; ********** Dominator Lighting **********
222+
223+
[panelDominator]
224+
$X=EMPTY_SPACE_SIDES
225+
$Y=getBottom(panelIonStorm) + VERTICAL_SPACING
226+
$Width=getWidth(panelIonStorm)
227+
$CCnl=lblDominator:XNALabel
228+
$CCn00=tbAmbientDominator:EditorNumberTextBox
229+
$CCn01=lblAmbientDominator:XNALabel
230+
$CCn02=tbAmbientChangeRateDominator:EditorNumberTextBox
231+
$CCn03=lblAmbientChangeRateDominator:XNALabel
232+
$CCn04=tbLevelDominator:EditorNumberTextBox
233+
$CCn05=lblLevelDominator:XNALabel
234+
$CCn06=tbGroundDominator:EditorNumberTextBox
235+
$CCn07=lblGroundDominator:XNALabel
236+
$CCn08=tbRedDominator:EditorNumberTextBox
237+
$CCn09=lblRedDominator:XNALabel
238+
$CCn10=tbGreenDominator:EditorNumberTextBox
239+
$CCn11=lblGreenDominator:XNALabel
240+
$CCn12=tbBlueDominator:EditorNumberTextBox
241+
$CCn13=lblBlueDominator:XNALabel
242+
$Height=getBottom(tbGroundDominator) + EMPTY_SPACE_BOTTOM
243+
$Enabled=USE_COUNTRIES
244+
245+
[lblDominator]
246+
$X=EMPTY_SPACE_SIDES
247+
$Y=EMPTY_SPACE_TOP
248+
FontIndex=1
249+
Text=Dominator Settings
250+
251+
[tbAmbientDominator]
252+
$X=100
253+
$Y=getBottom(lblDominator) + EMPTY_SPACE_TOP
254+
$Width=((getWidth(panelDominator) / 2) - EMPTY_SPACE_SIDES) - getX(tbAmbientDominator)
255+
AllowDecimals=true
256+
NextControl=tbAmbientChangeRateDominator
257+
258+
[lblAmbientDominator]
259+
$X=EMPTY_SPACE_SIDES
260+
$Y=getY(tbAmbientDominator) + 1
261+
Text=Ambient:
262+
263+
[tbAmbientChangeRateDominator]
264+
$X=getX(tbAmbientDominator)
265+
$Y=getBottom(tbAmbientDominator) + VERTICAL_SPACING
266+
$Width=getWidth(tbAmbientDominator)
267+
AllowDecimals=true
268+
NextControl=tbLevelDominator
269+
270+
[lblAmbientChangeRateDominator]
271+
$X=EMPTY_SPACE_SIDES
272+
Text=Ambient@Change Rate:
273+
$Y=getY(tbAmbientChangeRateDominator) + (getHeight(tbAmbientChangeRateDominator) / 2) - (getHeight(lblAmbientChangeRateDominator) / 2)
274+
275+
[tbLevelDominator]
276+
$X=getX(tbAmbientChangeRateDominator)
277+
$Y=getBottom(tbAmbientChangeRateDominator) + VERTICAL_SPACING
278+
$Width=getWidth(tbAmbientChangeRateDominator)
279+
AllowDecimals=true
280+
NextControl=tbGroundDominator
281+
282+
[lblLevelDominator]
283+
$X=EMPTY_SPACE_SIDES
284+
$Y=getY(tbLevelDominator) + 1
285+
Text=Level:
286+
287+
[tbGroundDominator]
288+
$X=getX(tbLevelDominator)
289+
$Y=getBottom(tbLevelDominator) + VERTICAL_SPACING
290+
$Width=getWidth(tbLevelDominator)
291+
AllowDecimals=true
292+
NextControl=tbRedDominator
293+
294+
[lblGroundDominator]
295+
$X=EMPTY_SPACE_SIDES
296+
$Y=getY(tbGroundDominator) + 1
297+
Text=Ground:
298+
299+
[tbRedDominator]
300+
$Width=getWidth(tbAmbientDominator)
301+
$X=getWidth(panelDominator) - EMPTY_SPACE_SIDES - getWidth(tbRedDominator)
302+
$Y=getY(tbAmbientDominator)
303+
AllowDecimals=true
304+
NextControl=tbGreenDominator
305+
306+
[lblRedDominator]
307+
$X=(getWidth(panelDominator) / 2) + (EMPTY_SPACE_SIDES * 2)
308+
$Y=getY(tbRedDominator) + 1
309+
Text=Red:
310+
311+
[tbGreenDominator]
312+
$Width=getWidth(tbRedDominator)
313+
$X=getX(tbRedDominator)
314+
$Y=getBottom(tbRedDominator) + VERTICAL_SPACING
315+
AllowDecimals=true
316+
NextControl=tbBlueDominator
317+
318+
[lblGreenDominator]
319+
$X=getX(lblRedDominator)
320+
$Y=getY(tbGreenDominator) + 1
321+
Text=Green:
322+
323+
[tbBlueDominator]
324+
$Width=getWidth(tbRedDominator)
325+
$X=getX(tbRedDominator)
326+
$Y=getBottom(tbGreenDominator) + VERTICAL_SPACING
327+
AllowDecimals=true
328+
329+
[lblBlueDominator]
330+
$X=getX(lblRedDominator)
331+
$Y=getY(tbBlueDominator) + 1
332+
Text=Blue:
333+
334+
190335
[btnApply]
191336
Width=100
192337
$X=horizontalCenterOnParent()
193-
$Y=getBottom(panelIonStorm) + EMPTY_SPACE_TOP
338+
$Y=(getBottom(panelDominator) * USE_COUNTRIES) + (getBottom(panelIonStorm) * (1 - USE_COUNTRIES)) + EMPTY_SPACE_TOP
194339
Text=Apply
195-

src/TSMapEditor/Models/Lighting.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ public class Lighting : INIDefineable
2020
public double IonLevel { get; set; }
2121
public double IonGround { get; set; }
2222

23+
public double? DominatorRed { get; set; }
24+
public double? DominatorGreen { get; set; }
25+
public double? DominatorBlue { get; set; }
26+
public double? DominatorAmbient { get; set; }
27+
public double? DominatorAmbientChangeRate { get; set; }
28+
public double? DominatorLevel { get; set; }
29+
public double? DominatorGround { get; set; }
30+
2331
public void ReadFromIniFile(IniFile iniFile)
2432
{
2533
var lightingSection = iniFile.GetSection(LightingIniSectionName);

src/TSMapEditor/UI/UIManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ public override void Initialize()
180180

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

185187
Alpha = 0f;

0 commit comments

Comments
 (0)