Skip to content

Commit 3919219

Browse files
ADD: start with feature "show waypoint preview"
1 parent 2915827 commit 3919219

File tree

9 files changed

+315
-67
lines changed

9 files changed

+315
-67
lines changed

client/uctd.pas

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
fLoadMapButton: TOpenGl_Button;
209209
fLoadGameButton: TOpenGl_Button;
210210
fLoadMapGameBackTex: TGraphikItem;
211+
fWaypointDirectionTexs: TGraphikItem;
211212

212213
fSideMenuVisible: Boolean; // True, dann ist das Seitenmenü (unten oder Rechts) sichtbar
213214
fMenuPosition: TMenuPosition;
@@ -3356,6 +3357,12 @@
33563357
fmap.ResetAllUpdateBuildings;
33573358
fmap.CreateDamageClassTextures;
33583359
fmap.EditTerrain := false;
3360+
If GetValue('Global', 'ShowOppoentsPathOnWaveStart', '1') = '1' Then Begin
3361+
fmap.CreateWavePreviewPath(PlayerIndex);
3362+
End
3363+
Else Begin
3364+
setlength(fmap.WaypointPreviewDirections, 0);
3365+
End;
33593366
For i := 0 To high(fPlayerInfos) Do Begin
33603367
fPlayerInfos[i].KillsOnWaveStart := fPlayerInfos[i].Kills + fPlayerInfos[i].BonusFinisher;
33613368
fPlayerInfos[i].LivesOnWaveStart := fPlayerInfos[i].Lives;
@@ -3826,6 +3833,8 @@
38263833
BuildingStrategyButtons[7].Strategy := bsWeakest; // Das macht doch gar keinen Sinn ?
38273834
BuildingStrategyButtons[7].Name := 'Prefer air/land creeps [F8]';
38283835

3836+
fWaypointDirectionTexs := OpenGL_GraphikEngine.LoadAlphaGraphikItem(p + 'waydirections.png', smClamp);
3837+
38293838
LogLeave;
38303839
End;
38313840

@@ -3879,6 +3888,22 @@
38793888
End;
38803889

38813890
Procedure Tctd.Render(w, h: integer);
3891+
3892+
Function WaypointDirectionsToIndex(Const directions: TWaypointPreviewDirections): integer;
3893+
Begin
3894+
result := 0;
3895+
// Die Hauptrichtungen
3896+
If wpdLeftToRight In directions Then result := 0;
3897+
If wpdRightToLeft In directions Then result := 2;
3898+
If wpdTopToBottom In directions Then result := 3;
3899+
If wpdBottomToTop In directions Then result := 1;
3900+
// Nun Kommen die Diagonalen
3901+
If (wpdLeftToRight In directions) And (wpdTopToBottom In directions) Then result := 7;
3902+
If (wpdLeftToRight In directions) And (wpdBottomToTop In directions) Then result := 4;
3903+
If (wpdRightToLeft In directions) And (wpdTopToBottom In directions) Then result := 6;
3904+
If (wpdRightToLeft In directions) And (wpdBottomToTop In directions) Then result := 5;
3905+
End;
3906+
38823907
Var
38833908
x, y, i, j: integer;
38843909
f: single;
@@ -3928,26 +3953,14 @@
39283953
gs_Gaming: Begin
39293954
If form4.Visible Then form4.Close;
39303955
fmap.ShowWaypoints := false;
3931-
If DarkOtherBuildings Then Begin
3932-
fmap.Render(fsx, fsy, fMapL, fMapT, ShowGrid, ShowLifepoints, fPlayerIndex); // -- Muss als erstes gemacht werden, da es "ungenaue" Ränder hat.
3933-
End
3934-
Else Begin
3935-
fmap.Render(fsx, fsy, fMapL, fMapT, ShowGrid, ShowLifepoints, -1); // -- Muss als erstes gemacht werden, da es "ungenaue" Ränder hat.
3936-
End;
3956+
fmap.Render(fsx, fsy, fMapL, fMapT, ShowGrid, ShowLifepoints, IfThen(DarkOtherBuildings, fPlayerIndex, -1)); // -- Muss als erstes gemacht werden, da es "ungenaue" Ränder hat.
39373957
fSplashMarks.Render(fsx, fsy, fMapL, fMapT);
39383958
RenderSelected(fsx, fsy, fMapL, fMapT);
39393959
RenderBlackOutMapBorder;
39403960
RenderBuyMenu();
39413961
RenderMenuTabButton();
3942-
3943-
If DarkOtherBuildings Then Begin
3944-
fMap.RenderPreview(fPreviewL + 1, fPreviewT + 1, fPreviewW - 2, fPreviewH - 2, fsx, fsy, fMapW, fMapH - fMapT, fPlayerIndex);
3945-
End
3946-
Else Begin
3947-
fMap.RenderPreview(fPreviewL + 1, fPreviewT + 1, fPreviewW - 2, fPreviewH - 2, fsx, fsy, fMapW, fMapH - fMapT, -1);
3948-
End;
3962+
fMap.RenderPreview(fPreviewL + 1, fPreviewT + 1, fPreviewW - 2, fPreviewH - 2, fsx, fsy, fMapW, fMapH - fMapT, IfThen(DarkOtherBuildings, fPlayerIndex, -1));
39493963
fSplashMarks.RenderPreview(fPreviewL + 1, fPreviewT + 1, fPreviewW - 2, fPreviewH - 2, fmap.Width, fmap.Height);
3950-
39513964
// Rendern des SideMenü
39523965
If assigned(FSideMenuObject) Then Begin
39533966
RenderSideMenu;
@@ -3956,6 +3969,20 @@
39563969
OpenGL_ASCII_Font.Color := clWhite;
39573970
CenterTextOut(w, h, 'The game has been paused.');
39583971
End;
3972+
// Anzeigen des Weg Previews
3973+
For i := 0 To high(fMap.WaypointPreviewDirections) Do Begin
3974+
If i Mod 2 = 1 Then Begin // Nur jeden 2. Rendern, sieht gleich viel besser aus ;)
3975+
glPushMatrix;
3976+
x := fMap.WaypointPreviewDirections[i].Location.x;
3977+
y := fMap.WaypointPreviewDirections[i].Location.y;
3978+
glTranslatef(x * MapBlockSize - fsx + fMapL, y * MapBlockSize - fsy + fMapT, ctd_Buy_Preview_Layer);
3979+
glTranslatef(0, 0, ctd_EPSILON);
3980+
glScalef(MapBlockSize / 10, MapBlockSize / 10, 1);
3981+
glColor4f(1, 1, 1, 1);
3982+
RenderAlphaTiledQuad(0, 0, WaypointDirectionsToIndex(fMap.WaypointPreviewDirections[i].Directions), 8, 1, fWaypointDirectionTexs);
3983+
glPopMatrix;
3984+
End;
3985+
End;
39593986
// Anzeigen des zu kaufenden Objekts
39603987
If assigned(FBuyingObject) Then Begin
39613988
x := (fsx + fCursorPos.x - fMapL) Div MapBlockSize;

client/unit1.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,7 @@
14521452
form5.CheckBox11.Checked := GetValue('Global', 'ShowWaveOppHint', '1') = '1';
14531453
form5.CheckBox12.Checked := GetValue('Global', 'ShowHeroRanges', '1') = '1';
14541454
form5.CheckBox13.Checked := GetValue('Global', 'DarkMode', '1') = '1';
1455+
form5.CheckBox14.Checked := GetValue('Global', 'ShowOppoentsPathOnWaveStart', '1') = '1';
14551456

14561457
form5.Edit1.text := GetValue('Global', 'MapBlockSize', inttostr(MapBlockSize));
14571458
form5.Edit2.text := GetValue('Global', 'AutoNextWaveDelay', '10');

client/unit5.lfm

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
object Form5: TForm5
22
Left = 347
3-
Height = 494
3+
Height = 518
44
Top = 111
55
Width = 524
66
Caption = 'Form5'
7-
ClientHeight = 494
7+
ClientHeight = 518
88
ClientWidth = 524
99
Position = poScreenCenter
10-
LCLVersion = '3.99.0.0'
10+
LCLVersion = '4.99.0.0'
1111
OnCloseQuery = FormCloseQuery
1212
OnCreate = FormCreate
1313
OnShow = FormShow
1414
object CheckBox1: TCheckBox
1515
Left = 8
1616
Height = 22
1717
Top = 8
18-
Width = 157
18+
Width = 155
1919
Caption = 'Invert mouse scrolling'
2020
TabOrder = 0
2121
end
2222
object Button1: TButton
2323
Left = 8
2424
Height = 25
25-
Top = 457
25+
Top = 481
2626
Width = 227
2727
Caption = 'OK'
2828
TabOrder = 1
@@ -31,7 +31,7 @@ object Form5: TForm5
3131
object Button2: TButton
3232
Left = 286
3333
Height = 25
34-
Top = 457
34+
Top = 481
3535
Width = 227
3636
Caption = 'Cancel'
3737
TabOrder = 2
@@ -41,7 +41,7 @@ object Form5: TForm5
4141
Left = 8
4242
Height = 22
4343
Top = 56
44-
Width = 178
44+
Width = 177
4545
Caption = 'Start next wave each [sec]'
4646
Checked = True
4747
State = cbChecked
@@ -52,7 +52,7 @@ object Form5: TForm5
5252
Left = 8
5353
Height = 22
5454
Top = 80
55-
Width = 204
55+
Width = 201
5656
Caption = 'Always show creeps lifepoints'
5757
TabOrder = 4
5858
end
@@ -100,28 +100,28 @@ object Form5: TForm5
100100
Left = 8
101101
Height = 16
102102
Top = 80
103-
Width = 56
103+
Width = 54
104104
Caption = 'Walkable'
105105
end
106106
object Label3: TLabel
107107
Left = 8
108108
Height = 16
109109
Top = 113
110-
Width = 58
110+
Width = 55
111111
Caption = 'Buildable'
112112
end
113113
object Label4: TLabel
114114
Left = 8
115115
Height = 16
116116
Top = 148
117-
Width = 30
117+
Width = 29
118118
Caption = 'Both'
119119
end
120120
object CheckBox7: TCheckBox
121121
Left = 8
122122
Height = 22
123123
Top = 8
124-
Width = 182
124+
Width = 181
125125
Caption = 'disable background image'
126126
TabOrder = 3
127127
end
@@ -178,51 +178,51 @@ object Form5: TForm5
178178
Left = 8
179179
Height = 16
180180
Top = 52
181-
Width = 55
181+
Width = 56
182182
Caption = 'Damages'
183183
end
184184
object Label7: TLabel
185185
Left = 8
186186
Height = 16
187187
Top = 84
188-
Width = 44
188+
Width = 43
189189
Caption = 'Broken'
190190
end
191191
end
192192
object CheckBox4: TCheckBox
193193
Left = 8
194194
Height = 22
195195
Top = 104
196-
Width = 213
196+
Width = 212
197197
Caption = 'Show building range on hinting'
198198
TabOrder = 7
199199
end
200200
object Label9: TLabel
201201
Left = 8
202202
Height = 16
203-
Top = 368
204-
Width = 59
203+
Top = 392
204+
Width = 58
205205
Caption = 'Grid color'
206206
end
207207
object ColorBox8: TColorBox
208208
Left = 143
209209
Height = 26
210-
Top = 358
210+
Top = 382
211211
Width = 100
212212
ItemHeight = 16
213213
TabOrder = 8
214214
end
215215
object Label10: TLabel
216216
Left = 8
217217
Height = 16
218-
Top = 394
219-
Width = 123
218+
Top = 418
219+
Width = 120
220220
Caption = 'Building range color'
221221
end
222222
object ColorBox9: TColorBox
223223
Left = 143
224224
Height = 26
225-
Top = 384
225+
Top = 408
226226
Width = 100
227227
ItemHeight = 16
228228
TabOrder = 9
@@ -239,15 +239,15 @@ object Form5: TForm5
239239
object CheckBox6: TCheckBox
240240
Left = 8
241241
Height = 22
242-
Top = 232
242+
Top = 256
243243
Width = 79
244244
Caption = 'Show fps'
245245
TabOrder = 11
246246
end
247247
object GroupBox3: TGroupBox
248248
Left = 8
249249
Height = 72
250-
Top = 284
250+
Top = 308
251251
Width = 241
252252
Caption = ' Map block size '
253253
ClientHeight = 55
@@ -257,7 +257,7 @@ object Form5: TForm5
257257
Left = 8
258258
Height = 16
259259
Top = 28
260-
Width = 33
260+
Width = 31
261261
Caption = 'value'
262262
end
263263
object Edit1: TEdit
@@ -272,7 +272,7 @@ object Form5: TForm5
272272
Left = 8
273273
Height = 22
274274
Top = 0
275-
Width = 188
275+
Width = 186
276276
Caption = 'Change on ctrl mousescroll'
277277
TabOrder = 1
278278
end
@@ -281,7 +281,7 @@ object Form5: TForm5
281281
Left = 8
282282
Height = 22
283283
Top = 160
284-
Width = 241
284+
Width = 239
285285
Caption = 'Show other players buildings darker'
286286
Checked = True
287287
State = cbChecked
@@ -313,7 +313,7 @@ object Form5: TForm5
313313
Left = 8
314314
Height = 22
315315
Top = 184
316-
Width = 254
316+
Width = 252
317317
Caption = 'Show buildable tiles during placement'
318318
TabOrder = 15
319319
end
@@ -329,7 +329,7 @@ object Form5: TForm5
329329
object ScrollBar1: TScrollBar
330330
Left = 80
331331
Height = 14
332-
Top = 424
332+
Top = 448
333333
Width = 121
334334
Max = 30
335335
PageSize = 0
@@ -339,22 +339,22 @@ object Form5: TForm5
339339
object Label12: TLabel
340340
Left = 8
341341
Height = 16
342-
Top = 422
343-
Width = 58
342+
Top = 446
343+
Width = 57
344344
Caption = 'Fontscale'
345345
end
346346
object Label13: TLabel
347347
Left = 216
348348
Height = 16
349-
Top = 422
350-
Width = 49
349+
Top = 446
350+
Width = 48
351351
Caption = 'Label13'
352352
end
353353
object CheckBox11: TCheckBox
354354
Left = 8
355355
Height = 22
356356
Top = 207
357-
Width = 262
357+
Width = 260
358358
Caption = 'Show wave opponent hint on new wave'
359359
TabOrder = 18
360360
end
@@ -369,9 +369,17 @@ object Form5: TForm5
369369
object CheckBox13: TCheckBox
370370
Left = 8
371371
Height = 22
372-
Top = 256
373-
Width = 89
372+
Top = 280
373+
Width = 90
374374
Caption = 'Dark mode'
375375
TabOrder = 20
376376
end
377+
object CheckBox14: TCheckBox
378+
Left = 8
379+
Height = 22
380+
Top = 232
381+
Width = 237
382+
Caption = 'Show opponents path on wavestart'
383+
TabOrder = 21
384+
end
377385
end

client/unit5.pas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
CheckBox11: TCheckBox;
3535
CheckBox12: TCheckBox;
3636
CheckBox13: TCheckBox;
37+
CheckBox14: TCheckBox;
3738
CheckBox2: TCheckBox;
3839
CheckBox3: TCheckBox;
3940
CheckBox4: TCheckBox;
@@ -191,6 +192,8 @@
191192
setValue('Global', 'ShowBuildableTilesDuringBuild', inttostr(ord(form5.CheckBox10.Checked)));
192193
SetValue('Global', 'ShowWaveOppHint', inttostr(ord(form5.CheckBox11.Checked)));
193194
SetValue('Global', 'ShowHeroRanges', inttostr(ord(form5.CheckBox12.Checked)));
195+
// Checkbox13 wird unten ausgewertet, die ist Speziell ;)
196+
SetValue('Global', 'ShowOppoentsPathOnWaveStart', inttostr(ord(form5.CheckBox14.Checked)));
194197

195198
SetValue('Global', 'MapBlockSize', form5.Edit1.text);
196199
SetValue('Global', 'AutoNextWaveDelay', form5.Edit2.text);

0 commit comments

Comments
 (0)