forked from Warzone2100/warzone2100
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesign.cpp
4325 lines (3902 loc) · 134 KB
/
design.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
This file is part of Warzone 2100.
Copyright (C) 1999-2004 Eidos Interactive
Copyright (C) 2005-2019 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file design.c
*
* Functions for design screen.
*
*/
#include <string.h>
#include "lib/framework/frame.h"
#include "lib/widget/widget.h"
#include "objects.h"
#include "loop.h"
#include "map.h"
/* Includes direct access to render library */
#include "lib/ivis_opengl/ivisdef.h"
#include "lib/ivis_opengl/bitimage.h"
#include "lib/ivis_opengl/pieblitfunc.h"
// FIXME Direct iVis implementation include!
#include "lib/ivis_opengl/piematrix.h"//matrix code
#include "lib/ivis_opengl/screen.h"
#include "lib/ivis_opengl/piemode.h"
#include "lib/ivis_opengl/ivisdef.h"
#include "objmem.h"
#include "display3d.h"
#include "structure.h"
#include "research.h"
#include "lib/gamelib/gtime.h"
#include "hci.h"
#include "stats.h"
#include "power.h"
#include "lib/widget/button.h"
#include "order.h"
#include "projectile.h"
#include "intimage.h"
#include "intdisplay.h"
#include "design.h"
#include "component.h"
#include "lib/script/script.h"
#include "main.h"
#include "display.h"
#include "cmddroid.h"
#include "scriptextern.h"
#include "mission.h"
#include "template.h"
#include "multiplay.h"
#include "qtscript.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcast-align" // TODO: FIXME!
#endif
#define MAX_DESIGN_COMPONENTS 40 // Max number of stats the design screen can cope with.
#define MAX_SYSTEM_COMPONENTS 65535
/***************************************************************************************/
/* Max values for the design bar graphs */
#define DBAR_TEMPLATEMAXPOINTS 8400 //maximum body points for a template
#define DBAR_TEMPLATEMAXPOWER 1000 //maximum power points for a template
/* The maximum number of characters on the component buttons */
#define DES_COMPBUTMAXCHAR 5
/* Which type of system is displayed on the design screen */
enum DES_SYSMODE
{
IDES_SENSOR, // The sensor clickable is displayed
IDES_ECM, // The ECM clickable is displayed
IDES_CONSTRUCT, // The Constructor clickable is displayed
IDES_REPAIR, // The Repair clickable is displayed
IDES_WEAPON, // The Weapon clickable is displayed
IDES_COMMAND, // The command droid clickable is displayed
IDES_NOSYSTEM, // No system clickable has been displayed
};
static DES_SYSMODE desSysMode;
/* The major component tabs on the design screen */
#define IDES_MAINTAB 0
#define IDES_EXTRATAB 1
/* Which component type is being selected on the design screen */
//added IDES_TURRET_A,IDES_TURRET_B,changing the name of IDES_TURRET might break exist codes
enum DES_COMPMODE
{
IDES_SYSTEM, // The main system for the droid (sensor, ECM, constructor)
IDES_TURRET, // The weapon for the droid
IDES_BODY, // The droid body
IDES_PROPULSION, // The propulsion system
IDES_NOCOMPONENT, // No system has been selected
IDES_TURRET_A, // The 2nd turret
IDES_TURRET_B, // The 3rd turret
};
static DES_COMPMODE desCompMode;
/* Which type of propulsion is being selected */
enum DES_PROPMODE
{
IDES_GROUND, // Ground propulsion (wheeled, tracked, etc).
IDES_AIR, // Air propulsion
IDES_NOPROPULSION, // No propulsion has been selected
};
static DES_PROPMODE desPropMode;
#define STRING_BUFFER_SIZE (32 * MAX_STR_LENGTH)
char StringBuffer[STRING_BUFFER_SIZE];
/* Design screen positions */
#define DESIGN_Y (59 + D_H) //the top left y value for all forms on the design screen
#define DES_TABBUTGAP 2
#define DES_TABBUTWIDTH 60
#define DES_TABBUTHEIGHT 46
#define DES_LEFTFORMX RET_X
#define DES_LEFTFORMY DESIGN_Y
#define DES_LEFTFORMWIDTH RET_FORMWIDTH
#define DES_LEFTFORMHEIGHT 273
#define DES_LEFTFORMBUTX 2
#define DES_LEFTFORMBUTY 2
#define DES_CENTERFORMWIDTH 315
#define DES_CENTERFORMHEIGHT 262
#define DES_CENTERFORMX POW_X
#define DES_CENTERFORMY DESIGN_Y
#define DES_3DVIEWX 8
#define DES_3DVIEWY 25
#define DES_3DVIEWWIDTH 236
#define DES_3DVIEWHEIGHT 192
#define DES_STATSFORMX POW_X
#define DES_STATSFORMY (DES_CENTERFORMY + DES_CENTERFORMHEIGHT + 3)
#define DES_STATSFORMWIDTH DES_CENTERFORMWIDTH
#define DES_STATSFORMHEIGHT 100
#define DES_PARTFORMX DES_3DVIEWX + DES_3DVIEWWIDTH + 2
#define DES_PARTFORMY DES_3DVIEWY
#define DES_PARTFORMHEIGHT DES_3DVIEWHEIGHT
#define DES_POWERFORMX DES_3DVIEWX
#define DES_POWERFORMY (DES_3DVIEWY + DES_3DVIEWHEIGHT + 2)
#define DES_POWERFORMWIDTH (DES_CENTERFORMWIDTH - 2*DES_POWERFORMX)
#define DES_POWERFORMHEIGHT 40
#define DES_RIGHTFORMWIDTH (RET_FORMWIDTH + 20)
#define DES_RIGHTFORMHEIGHT DES_LEFTFORMHEIGHT
#define DES_RIGHTFORMBUTX 2
#define DES_RIGHTFORMBUTY 2
#define DES_BARFORMX 6
#define DES_BARFORMY 6
#define DES_BARFORMWIDTH 300
#define DES_BARFORMHEIGHT 85
#define DES_NAMEBOXX DES_3DVIEWX
#define DES_NAMEBOXY 6
#define DES_NAMEBOXWIDTH DES_CENTERFORMWIDTH - 2*DES_NAMEBOXX
#define DES_NAMEBOXHEIGHT 14
/* The central boxes on the design screen */
#define DES_COMPBUTWIDTH 150
#define DES_COMPBUTHEIGHT 85
#define DES_POWERX 1
#define DES_POWERY 6
#define DES_POWERSEPARATIONX 4
#define DES_POWERSEPARATIONY 2
#define DES_PARTSEPARATIONX 6
#define DES_PARTSEPARATIONY 6
/* Positions of stuff on the clickable boxes (Design screen) */
#define DES_CLICKBARX 154
#define DES_CLICKBARY 7
#define DES_CLICKBARWIDTH 140
#define DES_CLICKBARHEIGHT 11
#define DES_CLICKGAP 9
#define DES_CLICKBARNAMEX 126
#define DES_CLICKBARNAMEWIDTH 20
#define DES_CLICKBARNAMEHEIGHT 19
#define DES_CLICKBARMAJORRED 255 //0xcc
#define DES_CLICKBARMAJORGREEN 235 //0
#define DES_CLICKBARMAJORBLUE 19 //0
#define DES_CLICKBARMINORRED 0x55
#define DES_CLICKBARMINORGREEN 0
#define DES_CLICKBARMINORBLUE 0
#define DES_WEAPONBUTTON_X 26
#define DES_SYSTEMBUTTON_X 68
#define DES_SYSTEMBUTTON_Y 10
// Stat bar y positions.
#define DES_STATBAR_Y1 (DES_CLICKBARY)
#define DES_STATBAR_Y2 (DES_CLICKBARY+DES_CLICKBARHEIGHT + DES_CLICKGAP)
#define DES_STATBAR_Y3 (DES_CLICKBARY+(DES_CLICKBARHEIGHT + DES_CLICKGAP)*2)
#define DES_STATBAR_Y4 (DES_CLICKBARY+(DES_CLICKBARHEIGHT + DES_CLICKGAP)*3)
/* the widget screen */
extern W_SCREEN *psWScreen;
/* default droid design template */
static DROID_TEMPLATE sDefaultDesignTemplate;
static void desSetupDesignTemplates();
static void setDesignPauseState();
static void resetDesignPauseState();
static bool intAddTemplateButtons(ListTabWidget *templList, DROID_TEMPLATE *psSelected);
static void intDisplayDesignForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
/* Set the current mode of the design screen, and display the appropriate component lists */
static void intSetDesignMode(DES_COMPMODE newCompMode, bool forceRefresh = false);
/* Set all the design bar graphs from a design template */
static void intSetDesignStats(DROID_TEMPLATE *psTemplate);
/* Set up the system clickable form of the design screen given a set of stats */
static bool intSetSystemForm(COMPONENT_STATS *psStats);
/* Set up the propulsion clickable form of the design screen given a set of stats */
static bool intSetPropulsionForm(PROPULSION_STATS *psStats);
/* Add the component tab form to the design screen */
static ListTabWidget *intAddComponentForm();
/* Add the template tab form to the design screen */
static bool intAddTemplateForm(DROID_TEMPLATE *psSelected);
/* Add the system buttons (weapons, command droid, etc) to the design screen */
static bool intAddSystemButtons(DES_COMPMODE mode);
/* Add the component buttons to the main tab of the system or component form */
static bool intAddComponentButtons(ListTabWidget *compList, COMPONENT_STATS *psStats, unsigned size, const UBYTE *aAvailable, unsigned numEntries, unsigned compID);
/* Add the component buttons to the main tab of the component form */
static bool intAddExtraSystemButtons(ListTabWidget *compList, unsigned sensorIndex, unsigned ecmIndex, unsigned constIndex, unsigned repairIndex, unsigned brainIndex);
/* Set the bar graphs for the system clickable */
static void intSetSystemStats(COMPONENT_STATS *psStats);
/* Set the shadow bar graphs for the system clickable */
static void intSetSystemShadowStats(COMPONENT_STATS *psStats);
/* Set the bar graphs for the sensor stats */
static void intSetSensorStats(SENSOR_STATS *psStats);
/* Set the shadow bar graphs for the sensor stats */
static void intSetSensorShadowStats(SENSOR_STATS *psStats);
/* Set the bar graphs for the ECM stats */
static void intSetECMStats(ECM_STATS *psStats);
/* Set the shadow bar graphs for the ECM stats */
static void intSetECMShadowStats(ECM_STATS *psStats);
/* Set the bar graphs for the Repair stats */
static void intSetRepairStats(REPAIR_STATS *psStats);
/* Set the shadow bar graphs for the Repair stats */
static void intSetRepairShadowStats(REPAIR_STATS *psStats);
/* Set the bar graphs for the Constructor stats */
static void intSetConstructStats(CONSTRUCT_STATS *psStats);
/* Set the shadow bar graphs for the Constructor stats */
static void intSetConstructShadowStats(CONSTRUCT_STATS *psStats);
/* Set the bar graphs for the Weapon stats */
static void intSetWeaponStats(WEAPON_STATS *psStats);
/* Set the shadow bar graphs for the weapon stats */
static void intSetWeaponShadowStats(WEAPON_STATS *psStats);
/* Set the bar graphs for the Body stats */
static void intSetBodyStats(BODY_STATS *psStats);
/* Set the shadow bar graphs for the Body stats */
static void intSetBodyShadowStats(BODY_STATS *psStats);
/* Set the bar graphs for the Propulsion stats */
static void intSetPropulsionStats(PROPULSION_STATS *psStats);
/* Set the shadow bar graphs for the Propulsion stats */
static void intSetPropulsionShadowStats(PROPULSION_STATS *psStats);
/* Sets the Design Power Bar for a given Template */
static void intSetDesignPower(DROID_TEMPLATE *psTemplate);
/* Sets the Power shadow Bar for the current Template with new stat*/
static void intSetTemplatePowerShadowStats(COMPONENT_STATS *psStats);
/* Sets the Body Points Bar for a given Template */
static void intSetBodyPoints(DROID_TEMPLATE *psTemplate);
/* Sets the Body Points shadow Bar for the current Template with new stat*/
static void intSetTemplateBodyShadowStats(COMPONENT_STATS *psStats);
/* set flashing flag for button */
static void intSetButtonFlash(UDWORD id, bool bFlash);
/*Function to set the shadow bars for all the stats when the mouse is over
the Template buttons*/
static void runTemplateShadowStats(UDWORD id);
static bool intCheckValidWeaponForProp();
static bool checkTemplateIsVtol(DROID_TEMPLATE *psTemplate);
/* save the current Template if valid. Return true if stored */
static bool saveTemplate();
static void desCreateDefaultTemplate();
/**
* Updates the status of the stored template toggle button.
*
* @param isStored If the template is stored or not.
*/
static void updateStoreButton(bool isStored);
/* The current name of the design */
static char aCurrName[MAX_STR_LENGTH];
/* Store a list of component stats pointers for the design screen */
extern UDWORD maxComponent;
extern UDWORD numComponent;
extern COMPONENT_STATS **apsComponentList;
extern UDWORD maxExtraSys;
extern UDWORD numExtraSys;
extern COMPONENT_STATS **apsExtraSysList;
/* The button id of the component that is in the design */
static UDWORD desCompID;
static UDWORD droidTemplID;
/* The current design being edited on the design screen */
static DROID_TEMPLATE sCurrDesign;
static void intDisplayStatForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
static void intDisplayViewForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
/* Add the design widgets to the widget screen */
bool intAddDesign(bool bShowCentreScreen)
{
W_FORMINIT sFormInit;
W_LABINIT sLabInit;
W_EDBINIT sEdInit;
W_BUTINIT sButInit;
W_BARINIT sBarInit;
desSetupDesignTemplates();
//set which states are to be paused while design screen is up
setDesignPauseState();
if (GetGameMode() == GS_NORMAL && !bMultiPlayer)
{
// Just display the 3d, no interface
displayWorld();
}
WIDGET *parent = psWScreen->psForm;
/* Add the main design form */
IntFormAnimated *desForm = new IntFormAnimated(parent, false);
desForm->id = IDDES_FORM;
desForm->setCalcLayout(LAMBDA_CALCLAYOUT_SIMPLE({
psWidget->setGeometry(DES_CENTERFORMX, DES_CENTERFORMY, DES_CENTERFORMWIDTH, DES_CENTERFORMHEIGHT);
}));
/* add the edit name box */
sEdInit.formID = IDDES_FORM;
sEdInit.id = IDDES_NAMEBOX;
sEdInit.x = DES_NAMEBOXX;
sEdInit.y = DES_NAMEBOXY;
sEdInit.width = DES_NAMEBOXWIDTH;
sEdInit.height = DES_NAMEBOXHEIGHT;
sEdInit.pText = _("New Vehicle");
sEdInit.pBoxDisplay = intDisplayEditBox;
if (!widgAddEditBox(psWScreen, &sEdInit))
{
return false;
}
/* Initialise the current design */
sDefaultDesignTemplate.droidType = DROID_ANY;
sCurrDesign = sDefaultDesignTemplate;
sCurrDesign.stored = false;
sstrcpy(aCurrName, _("New Vehicle"));
sCurrDesign.name = WzString::fromUtf8(aCurrName);
/* Add the design templates form */
if (!intAddTemplateForm(nullptr)) // Was psCurrTemplate instead of NULL, but psCurrTemplate was always NULL. Deleted psCurrTemplate, but leaving this here, in case intAddTemplateForm(NULL) does something useful.
{
return false;
}
/* Add the 3D View form */
sFormInit.formID = IDDES_FORM;
sFormInit.id = IDDES_3DVIEW;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = DES_3DVIEWX;
sFormInit.y = DES_3DVIEWY;
sFormInit.width = DES_3DVIEWWIDTH;
sFormInit.height = DES_3DVIEWHEIGHT;
sFormInit.pDisplay = intDisplayViewForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
/* Add the part button form */
sFormInit.formID = IDDES_FORM;
sFormInit.id = IDDES_PARTFORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = DES_PARTFORMX;
sFormInit.y = DES_PARTFORMY;
sFormInit.width = (UWORD)(iV_GetImageWidth(IntImages, IMAGE_DES_TURRET) +
2 * DES_PARTSEPARATIONX);
sFormInit.height = DES_PARTFORMHEIGHT;
sFormInit.pDisplay = intDisplayDesignForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
// add the body part button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_BODYBUTTON;
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = DES_PARTSEPARATIONY;
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_BODY);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_BODY);
sButInit.pTip = _("Vehicle Body");
sButInit.pDisplay = intDisplayButtonFlash;
sButInit.UserData = PACKDWORD_TRI(1, IMAGE_DES_BODYH, IMAGE_DES_BODY);
if (!widgAddButton(psWScreen, &sButInit))
{
return false;
}
// add the propulsion part button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_PROPBUTTON;
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
2 * DES_PARTSEPARATIONY);
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_PROPULSION);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION);
sButInit.pTip = _("Vehicle Propulsion");
sButInit.pDisplay = intDisplayButtonFlash;
sButInit.UserData = PACKDWORD_TRI(1, IMAGE_DES_PROPULSIONH, IMAGE_DES_PROPULSION);
if (!widgAddButton(psWScreen, &sButInit))
{
return false;
}
// add the turret part button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_SYSTEMBUTTON;
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
iV_GetImageHeight(IntImages, IMAGE_DES_BODY) +
3 * DES_PARTSEPARATIONY);
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
sButInit.pTip = _("Vehicle Turret");
sButInit.pDisplay = intDisplayButtonFlash;
sButInit.UserData = PACKDWORD_TRI(1, IMAGE_DES_TURRETH, IMAGE_DES_TURRET);
if (!widgAddButton(psWScreen, &sButInit))
{
return false;
}
// add the turret_a button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_WPABUTTON;
sButInit.x = DES_PARTSEPARATIONX;
// use BODY height for now
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
iV_GetImageHeight(IntImages, IMAGE_DES_BODY) +
iV_GetImageHeight(IntImages, IMAGE_DES_BODY) +
4 * DES_PARTSEPARATIONY);
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
sButInit.pTip = _("Vehicle Turret");
sButInit.pDisplay = intDisplayButtonFlash;
sButInit.UserData = PACKDWORD_TRI(1, IMAGE_DES_TURRETH, IMAGE_DES_TURRET);
if (!widgAddButton(psWScreen, &sButInit))
{
return false;
}
// add the turret_b button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_WPBBUTTON;
sButInit.x = DES_PARTSEPARATIONX;
//use body height for now
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
iV_GetImageHeight(IntImages, IMAGE_DES_BODY) +
iV_GetImageHeight(IntImages, IMAGE_DES_BODY) +
iV_GetImageHeight(IntImages, IMAGE_DES_BODY) +
5 * DES_PARTSEPARATIONY);
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
sButInit.pTip = _("Vehicle Turret");
sButInit.pDisplay = intDisplayButtonFlash;
sButInit.UserData = PACKDWORD_TRI(1, IMAGE_DES_TURRETH, IMAGE_DES_TURRET);
if (!widgAddButton(psWScreen, &sButInit))
{
return false;
}
/* add the delete button */
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_BIN;
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_BIN);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_BIN);
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = (UWORD)(DES_PARTFORMHEIGHT - sButInit.height - DES_PARTSEPARATIONY);
sButInit.pTip = _("Delete Design");
sButInit.pDisplay = intDisplayButtonHilight;
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_DES_BINH, IMAGE_DES_BIN);
if (!widgAddButton(psWScreen, &sButInit))
{
return false;
}
// Add the store template button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_STOREBUTTON;
sButInit.style = WBUT_PLAIN;
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_SAVE);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_SAVE);
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = DES_PARTFORMHEIGHT - 2 * sButInit.height - 2 * DES_PARTSEPARATIONY;
sButInit.pTip = _("Store Template");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayButtonHilight;
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_DES_SAVEH, IMAGE_DES_SAVE);
if (bMultiPlayer && !widgAddButton(psWScreen, &sButInit))
{
return false;
}
/* add central stats form */
IntFormAnimated *statsForm = new IntFormAnimated(parent, false);
statsForm->id = IDDES_STATSFORM;
statsForm->setCalcLayout(LAMBDA_CALCLAYOUT_SIMPLE({
psWidget->setGeometry(DES_STATSFORMX, DES_STATSFORMY, DES_STATSFORMWIDTH, DES_STATSFORMHEIGHT);
}));
/* Add the body form */
sFormInit.formID = IDDES_STATSFORM;
sFormInit.id = IDDES_BODYFORM;
sFormInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
sFormInit.width = DES_BARFORMWIDTH;
sFormInit.height = DES_BARFORMHEIGHT;
sFormInit.x = DES_BARFORMX;
sFormInit.y = DES_BARFORMY;
sFormInit.pDisplay = intDisplayStatForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
/* Add the graphs for the Body */
sBarInit.formID = IDDES_BODYFORM;
sBarInit.id = IDDES_BODYARMOUR_K;
sBarInit.x = DES_CLICKBARX;
sBarInit.y = DES_STATBAR_Y1; //DES_CLICKBARY;
sBarInit.width = DES_CLICKBARWIDTH;
sBarInit.height = DES_CLICKBARHEIGHT;
sBarInit.size = 50;
sBarInit.sCol.byte.r = DES_CLICKBARMAJORRED;
sBarInit.sCol.byte.g = DES_CLICKBARMAJORGREEN;
sBarInit.sCol.byte.b = DES_CLICKBARMAJORBLUE;
sBarInit.sMinorCol.byte.r = DES_CLICKBARMINORRED;
sBarInit.sMinorCol.byte.g = DES_CLICKBARMINORGREEN;
sBarInit.sMinorCol.byte.b = DES_CLICKBARMINORBLUE;
sBarInit.pDisplay = intDisplayStatsBar;
sBarInit.initPUserDataFunc = []() -> void * { return new DisplayBarCache(); };
sBarInit.onDelete = [](WIDGET *psWidget) {
assert(psWidget->pUserData != nullptr);
delete static_cast<DisplayBarCache *>(psWidget->pUserData);
psWidget->pUserData = nullptr;
};
sBarInit.pTip = _("Kinetic Armour");
sBarInit.iRange = getMaxBodyArmour();
if (!widgAddBarGraph(psWScreen, &sBarInit))
{
return true;
}
sBarInit.id = IDDES_BODYARMOUR_H;
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
sBarInit.pTip = _("Thermal Armour");
sBarInit.iRange = getMaxBodyArmour();
if (!widgAddBarGraph(psWScreen, &sBarInit))
{
return true;
}
sBarInit.id = IDDES_BODYPOWER;
sBarInit.y = DES_STATBAR_Y3; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
sBarInit.pTip = _("Engine Output");
sBarInit.iRange = (UWORD)getMaxBodyPower();//DBAR_BODYMAXPOWER;
if (!widgAddBarGraph(psWScreen, &sBarInit))
{
return true;
}
sBarInit.id = IDDES_BODYWEIGHT;
sBarInit.y = DES_STATBAR_Y4; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
sBarInit.pTip = _("Weight");
sBarInit.iRange = (UWORD)getMaxComponentWeight();//DBAR_MAXWEIGHT;
if (!widgAddBarGraph(psWScreen, &sBarInit))
{
return true;
}
/* Add the labels for the Body */
sLabInit.formID = IDDES_BODYFORM;
sLabInit.id = IDDES_BODYARMOURKLAB;
sLabInit.x = DES_CLICKBARNAMEX;
sLabInit.y = DES_CLICKBARY - DES_CLICKBARHEIGHT / 3;
sLabInit.width = DES_CLICKBARNAMEWIDTH;
sLabInit.height = DES_CLICKBARHEIGHT;
sLabInit.pTip = _("Kinetic Armour");
sLabInit.pDisplay = intDisplayImage;
//just to confuse things even more - the graphics were named incorrectly!
sLabInit.UserData = IMAGE_DES_ARMOUR_EXPLOSIVE;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return true;
}
sLabInit.id = IDDES_BODYARMOURHLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Thermal Armour");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_ARMOUR_KINETIC;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return true;
}
sLabInit.id = IDDES_BODYPOWERLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Engine Output");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_POWER;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return true;
}
sLabInit.id = IDDES_BODYWEIGHTLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Weight");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_WEIGHT;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return true;
}
/* add power/points bar subform */
sFormInit = W_FORMINIT();
sFormInit.formID = IDDES_FORM;
sFormInit.id = IDDES_POWERFORM;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = DES_POWERFORMX;
sFormInit.y = DES_POWERFORMY;
sFormInit.width = DES_POWERFORMWIDTH;
sFormInit.height = DES_POWERFORMHEIGHT;
sFormInit.pDisplay = intDisplayDesignForm;
if (!widgAddForm(psWScreen, &sFormInit))
{
return false;
}
/* Add the design template power bar and label*/
sLabInit.formID = IDDES_POWERFORM;
sLabInit.id = IDDES_TEMPPOWERLAB;
sLabInit.x = DES_POWERX;
sLabInit.y = DES_POWERY;
sLabInit.pTip = _("Total Power Required");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_POWER;
widgAddLabel(psWScreen, &sLabInit);
sBarInit = W_BARINIT();
sBarInit.formID = IDDES_POWERFORM;
sBarInit.id = IDDES_POWERBAR;
sBarInit.x = (SWORD)(DES_POWERX + DES_POWERSEPARATIONX +
iV_GetImageWidth(IntImages, IMAGE_DES_BODYPOINTS));
sBarInit.y = DES_POWERY;
sBarInit.width = (SWORD)(DES_POWERFORMWIDTH - 15 -
iV_GetImageWidth(IntImages, IMAGE_DES_BODYPOINTS));
sBarInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_POWERBACK);
sBarInit.pDisplay = intDisplayDesignPowerBar;//intDisplayStatsBar;
sBarInit.initPUserDataFunc = []() -> void * { return new DisplayBarCache(); };
sBarInit.onDelete = [](WIDGET *psWidget) {
assert(psWidget->pUserData != nullptr);
delete static_cast<DisplayBarCache *>(psWidget->pUserData);
psWidget->pUserData = nullptr;
};
sBarInit.pTip = _("Total Power Required");
sBarInit.iRange = DBAR_TEMPLATEMAXPOWER;//WBAR_SCALE;
if (!widgAddBarGraph(psWScreen, &sBarInit))
{
return false;
}
/* Add the design template body points bar and label*/
sLabInit.formID = IDDES_POWERFORM;
sLabInit.id = IDDES_TEMPBODYLAB;
sLabInit.x = DES_POWERX;
sLabInit.y = (SWORD)(DES_POWERY + DES_POWERSEPARATIONY +
iV_GetImageHeight(IntImages, IMAGE_DES_BODYPOINTS));
sLabInit.pTip = _("Total Body Points");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_BODYPOINTS;
widgAddLabel(psWScreen, &sLabInit);
sBarInit = W_BARINIT();
sBarInit.formID = IDDES_POWERFORM;
sBarInit.id = IDDES_BODYPOINTS;
sBarInit.x = (SWORD)(DES_POWERX + DES_POWERSEPARATIONX +
iV_GetImageWidth(IntImages, IMAGE_DES_BODYPOINTS));
sBarInit.y = (SWORD)(DES_POWERY + DES_POWERSEPARATIONY + 4 +
iV_GetImageHeight(IntImages, IMAGE_DES_BODYPOINTS));
sBarInit.width = (SWORD)(DES_POWERFORMWIDTH - 15 -
iV_GetImageWidth(IntImages, IMAGE_DES_BODYPOINTS));
sBarInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_POWERBACK);
sBarInit.pDisplay = intDisplayDesignPowerBar;//intDisplayStatsBar;
sBarInit.initPUserDataFunc = []() -> void * { return new DisplayBarCache(); };
sBarInit.onDelete = [](WIDGET *psWidget) {
assert(psWidget->pUserData != nullptr);
delete static_cast<DisplayBarCache *>(psWidget->pUserData);
psWidget->pUserData = nullptr;
};
sBarInit.pTip = _("Total Body Points");
sBarInit.iRange = DBAR_TEMPLATEMAXPOINTS;//(UWORD)getMaxBodyPoints();//DBAR_BODYMAXPOINTS;
if (!widgAddBarGraph(psWScreen, &sBarInit))
{
return false;
}
/* Add the variable bits of the design screen and set the bar graphs */
desCompMode = IDES_NOCOMPONENT;
desSysMode = IDES_NOSYSTEM;
desPropMode = IDES_NOPROPULSION;
intSetDesignStats(&sCurrDesign);
intSetBodyPoints(&sCurrDesign);
intSetDesignPower(&sCurrDesign);
intSetDesignMode(IDES_BODY);
/* hide design and component forms until required */
desForm->show(bShowCentreScreen);
statsForm->hide();
widgHide(psWScreen, IDDES_RIGHTBASE);
return true;
}
/* set up droid templates before going into design screen */
void desSetupDesignTemplates()
{
/* init template list */
apsTemplateList.clear();
apsTemplateList.push_back(&sDefaultDesignTemplate);
for (DROID_TEMPLATE &templ : localTemplates)
{
/* add template to list if not a transporter,
* cyborg, person or command droid,
*/
if (templ.droidType != DROID_TRANSPORTER &&
templ.droidType != DROID_SUPERTRANSPORTER &&
templ.droidType != DROID_CYBORG &&
templ.droidType != DROID_CYBORG_SUPER &&
templ.droidType != DROID_CYBORG_CONSTRUCT &&
templ.droidType != DROID_CYBORG_REPAIR &&
templ.droidType != DROID_PERSON &&
researchedTemplate(&templ, selectedPlayer, includeRedundantDesigns))
{
apsTemplateList.push_back(&templ);
}
}
}
/* Add the design template form */
static bool intAddTemplateForm(DROID_TEMPLATE *psSelected)
{
WIDGET *parent = psWScreen->psForm;
/* add a form to place the tabbed form on */
IntFormAnimated *templbaseForm = new IntFormAnimated(parent, false);
templbaseForm->id = IDDES_TEMPLBASE;
templbaseForm->setCalcLayout(LAMBDA_CALCLAYOUT_SIMPLE({
psWidget->setGeometry(RET_X, DESIGN_Y, RET_FORMWIDTH, DES_LEFTFORMHEIGHT);
}));
// Add the obsolete items button.
makeObsoleteButton(templbaseForm);
/* Add the design templates form */
IntListTabWidget *templList = new IntListTabWidget(templbaseForm);
templList->setCalcLayout(LAMBDA_CALCLAYOUT_SIMPLE({
IntListTabWidget *templList = static_cast<IntListTabWidget *>(psWidget);
assert(templList != nullptr);
WIDGET *templbaseForm = templList->parent();
assert(templbaseForm != nullptr);
templList->setChildSize(DES_TABBUTWIDTH, DES_TABBUTHEIGHT);
templList->setChildSpacing(DES_TABBUTGAP, DES_TABBUTGAP);
int templListWidth = OBJ_BUTWIDTH * 2 + DES_TABBUTGAP;
templList->setGeometry((RET_FORMWIDTH - templListWidth) / 2, 18, templListWidth, templbaseForm->height() - 18);
}));
/* Put the buttons on it */
return intAddTemplateButtons(templList, psSelected);
}
/* Add the droid template buttons to a form */
static bool intAddTemplateButtons(ListTabWidget *templList, DROID_TEMPLATE *psSelected)
{
char TempString[256];
/* Set up the button struct */
int nextButtonId = IDDES_TEMPLSTART;
/* Add each button */
W_BARINIT sBarInit;
sBarInit.id = IDDES_BARSTART;
sBarInit.x = STAT_TIMEBARX;
sBarInit.y = STAT_TIMEBARY;
sBarInit.width = STAT_PROGBARWIDTH;
sBarInit.height = STAT_PROGBARHEIGHT;
sBarInit.size = 50;
sBarInit.sCol = WZCOL_ACTION_PROGRESS_BAR_MAJOR;
sBarInit.sMinorCol = WZCOL_ACTION_PROGRESS_BAR_MINOR;
sBarInit.pTip = _("Power Usage");
droidTemplID = 0;
for (DROID_TEMPLATE *psTempl : apsTemplateList)
{
/* Set the tip and add the button */
IntStatsButton *button = new IntStatsButton(templList);
button->id = nextButtonId;
button->setStatsAndTip(psTempl);
templList->addWidgetToLayout(button);
sBarInit.iRange = POWERPOINTS_DROIDDIV;
sBarInit.size = calcTemplatePower(psTempl) / POWERPOINTS_DROIDDIV;
if (sBarInit.size > WBAR_SCALE)
{
sBarInit.size = WBAR_SCALE;
}
ssprintf(TempString, "%s - %d", _("Power Usage"), calcTemplatePower(psTempl));
sBarInit.pTip = TempString;
sBarInit.formID = nextButtonId;
if (!widgAddBarGraph(psWScreen, &sBarInit))
{
return false;
}
/* if the current template matches psSelected lock the button */
if (psTempl == psSelected)
{
droidTemplID = nextButtonId;
button->setState(WBUT_LOCK);
templList->setCurrentPage(templList->pages() - 1);
}
/* Update the init struct for the next button */
sBarInit.id += 1;
++nextButtonId;
//check don't go over max templates that can fit on the form
if (nextButtonId >= IDDES_TEMPLEND)
{
break;
}
}
return true;
}
/* Set the current mode of the design screen, and display the appropriate
* component lists
* added case IDES_TURRET_A,IDES_TURRET_B
*/
static void intSetDesignMode(DES_COMPMODE newCompMode, bool forceRefresh)
{
UDWORD weaponIndex;
if (newCompMode == desCompMode && !forceRefresh)
{
return;
}
/* Have to change the component display - remove the old one */
if (desCompMode != IDES_NOCOMPONENT)
{
widgDelete(psWScreen, IDDES_RIGHTBASE);
widgSetButtonState(psWScreen, IDDES_BODYFORM, 0);
widgSetButtonState(psWScreen, IDDES_PROPFORM, 0);
widgSetButtonState(psWScreen, IDDES_SYSTEMFORM, 0);
widgHide(psWScreen, IDDES_BODYFORM);
widgHide(psWScreen, IDDES_PROPFORM);
widgHide(psWScreen, IDDES_SYSTEMFORM);
widgSetButtonState(psWScreen, IDDES_BODYBUTTON, 0);
widgSetButtonState(psWScreen, IDDES_PROPBUTTON, 0);
widgSetButtonState(psWScreen, IDDES_SYSTEMBUTTON, 0);
widgSetButtonState(psWScreen, IDDES_WPABUTTON, 0);
widgSetButtonState(psWScreen, IDDES_WPBBUTTON, 0);
}
ListTabWidget *compList;
/* Set up the display for the new mode */
desCompMode = newCompMode;
switch (desCompMode)
{
case IDES_NOCOMPONENT:
/* Nothing to display */
break;
case IDES_SYSTEM:
compList = intAddComponentForm();
intAddExtraSystemButtons(compList,
sCurrDesign.asParts[COMP_SENSOR],
sCurrDesign.asParts[COMP_ECM],
sCurrDesign.asParts[COMP_CONSTRUCT],
sCurrDesign.asParts[COMP_REPAIRUNIT],
sCurrDesign.asParts[COMP_BRAIN]);
intAddSystemButtons(IDES_SYSTEM);
widgSetButtonState(psWScreen, IDDES_SYSTEMFORM, WBUT_LOCK);
widgSetButtonState(psWScreen, IDDES_SYSTEMBUTTON, WBUT_CLICKLOCK);
widgReveal(psWScreen, IDDES_SYSTEMFORM);
break;
case IDES_TURRET:
compList = intAddComponentForm();
weaponIndex = (sCurrDesign.numWeaps > 0) ? sCurrDesign.asWeaps[0] : 0;
intAddComponentButtons(compList, asWeaponStats, sizeof(*asWeaponStats), apCompLists[selectedPlayer][COMP_WEAPON], numWeaponStats, weaponIndex);
intAddSystemButtons(IDES_TURRET);
widgSetButtonState(psWScreen, IDDES_SYSTEMFORM, WBUT_LOCK);
widgSetButtonState(psWScreen, IDDES_SYSTEMBUTTON, WBUT_CLICKLOCK);
widgReveal(psWScreen, IDDES_SYSTEMFORM);
intSetSystemForm((COMPONENT_STATS *)(asWeaponStats + sCurrDesign.asWeaps[0])); // in case previous was a different slot
break;
case IDES_BODY:
compList = intAddComponentForm();
intAddComponentButtons(compList, asBodyStats, sizeof(*asBodyStats), apCompLists[selectedPlayer][COMP_BODY], numBodyStats, sCurrDesign.asParts[COMP_BODY]);
widgSetButtonState(psWScreen, IDDES_BODYFORM, WBUT_LOCK);
widgSetButtonState(psWScreen, IDDES_BODYBUTTON, WBUT_CLICKLOCK);
widgReveal(psWScreen, IDDES_BODYFORM);
break;
case IDES_PROPULSION:
compList = intAddComponentForm();
intAddComponentButtons(compList, asPropulsionStats, sizeof(*asPropulsionStats), apCompLists[selectedPlayer][COMP_PROPULSION], numPropulsionStats, sCurrDesign.asParts[COMP_PROPULSION]);
widgSetButtonState(psWScreen, IDDES_PROPFORM, WBUT_LOCK);
widgSetButtonState(psWScreen, IDDES_PROPBUTTON, WBUT_CLICKLOCK);
widgReveal(psWScreen, IDDES_PROPFORM);
break;
case IDES_TURRET_A:
compList = intAddComponentForm();
weaponIndex = (sCurrDesign.numWeaps > 1) ? sCurrDesign.asWeaps[1] : 0;
intAddComponentButtons(compList, asWeaponStats, sizeof(*asWeaponStats), apCompLists[selectedPlayer][COMP_WEAPON], numWeaponStats, weaponIndex);
intAddSystemButtons(IDES_TURRET_A);
widgSetButtonState(psWScreen, IDDES_SYSTEMFORM, WBUT_LOCK);
widgSetButtonState(psWScreen, IDDES_WPABUTTON, WBUT_CLICKLOCK);
widgReveal(psWScreen, IDDES_SYSTEMFORM);
intSetSystemForm((COMPONENT_STATS *)(asWeaponStats + sCurrDesign.asWeaps[1])); // in case previous was a different slot
// Stop the button flashing
intSetButtonFlash(IDDES_WPABUTTON, false);
break;
case IDES_TURRET_B:
compList = intAddComponentForm();
weaponIndex = (sCurrDesign.numWeaps > 2) ? sCurrDesign.asWeaps[2] : 0;
intAddComponentButtons(compList, asWeaponStats, sizeof(*asWeaponStats), apCompLists[selectedPlayer][COMP_WEAPON], numWeaponStats, weaponIndex);
intAddSystemButtons(IDES_TURRET_B);
widgSetButtonState(psWScreen, IDDES_SYSTEMFORM, WBUT_LOCK);
widgSetButtonState(psWScreen, IDDES_WPBBUTTON, WBUT_CLICKLOCK);
widgReveal(psWScreen, IDDES_SYSTEMFORM);
intSetSystemForm((COMPONENT_STATS *)(asWeaponStats + sCurrDesign.asWeaps[2])); // in case previous was a different slot
// Stop the button flashing
intSetButtonFlash(IDDES_WPBBUTTON, false);
break;
}
}
static COMPONENT_STATS *
intChooseSystemStats(DROID_TEMPLATE *psTemplate)
{
COMPONENT_STATS *psStats = nullptr;
int compIndex;
// Choose correct system stats
switch (droidTemplateType(psTemplate))
{
case DROID_COMMAND:
compIndex = psTemplate->asParts[COMP_BRAIN];
ASSERT_OR_RETURN(nullptr, compIndex < numBrainStats, "Invalid range referenced for numBrainStats, %d > %d", compIndex, numBrainStats);