-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcInterface.cpp
2196 lines (1765 loc) · 92.8 KB
/
cInterface.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
///////////////////////////////////////////////////////
//*-------------------------------------------------*//
//| Part of Project One (https://www.maus-games.at) |//
//*-------------------------------------------------*//
//| Copyright (c) 2010 Martin Mauersics |//
//| Released under the zlib License |//
//*-------------------------------------------------*//
///////////////////////////////////////////////////////
#include "main.h"
// ****************************************************************
// construct player view
void cInterface::sPlayerView::Construct(const coreUintW iIndex)
{
// create view objects
for(coreUintW i = 0u; i < INTERFACE_LIVES; ++i)
{
aLife[i].DefineTexture(0u, g_pSpecialEffects->GetIconTexture(iIndex));
aLife[i].DefineProgram("default_2d_program");
aLife[i].SetTexSize (ICON_TEXSIZE);
aLife[i].SetTexOffset (ICON_TEXOFFSET * I_TO_F(i + 1u));
}
aShieldBar[0].DefineTexture(0u, "menu_detail_01.png");
aShieldBar[0].DefineProgram("default_2d_program");
aShieldBar[0].SetSize (coreVector2(3.5f,0.45f) * 0.07f);
aShieldBar[1].DefineTexture(0u, "menu_detail_01.png");
aShieldBar[1].DefineProgram("default_2d_program");
aShieldBar[1].SetSize (aShieldBar[0].GetSize() - coreVector2(0.01f,0.01f));
aShieldBar[2].DefineTexture(0u, "menu_detail_01.png");
aShieldBar[2].DefineProgram("default_2d_program");
aShieldBar[2].SetSize (aShieldBar[1].GetSize());
oShieldValue.Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
oShieldValue.SetColor3(COLOR_MENU_INSIDE);
oScore.Construct(MENU_FONT_STANDARD_3, MENU_OUTLINE_SMALL);
oScore.SetColor3(COLOR_MENU_INSIDE);
oCooldownBar.DefineTexture(0u, "default_white.webp");
oCooldownBar.DefineTexture(1u, "menu_background_black.png");
oCooldownBar.DefineProgram("menu_fragment_program");
oComboValue.Construct(MENU_FONT_STANDARD_4, MENU_OUTLINE_SMALL);
oComboValue.SetColor3(COLOR_MENU_INSIDE);
oChainValue.Construct(MENU_FONT_STANDARD_3, MENU_OUTLINE_SMALL);
oChainValue.SetColor3(COLOR_MENU_INSIDE);
oImmune.Construct (MENU_FONT_DYNAMIC_3, MENU_OUTLINE_SMALL);
oImmune.SetColor3 (COLOR_MENU_INSIDE);
oImmune.SetTextLanguage("TEXT_IMMUNE");
oImmune.SetRectifyY (false);
oSpeed.Construct (MENU_FONT_ICON_3, MENU_OUTLINE_SMALL);
oSpeed.SetText (ICON_FORWARD);
oSpeed.SetRectifyX(false);
//
fShieldBump = 0.0f;
iShieldOld = 0;
fImmuneTime = 0.0f;
fSpeedTime = 0.0f;
fSpin = 0.0f;
fSpin2 = 0.0f;
}
// ****************************************************************
// constructor
cInterface::cInterface(const coreUint8 iNumViews)noexcept
: m_aView {}
, m_iNumViews (iNumViews)
, m_fBossSpin (0.0f)
, m_bSegmentSmall (false)
, m_fGoalBump (0.0f)
, m_iGoalOld (MEDAL_NONE)
, m_afHelperBump {}
, m_iHelperState (0u)
, m_afBadgeBump {}
, m_iBadgeState (0u)
, m_fTrophyBump (0.0f)
, m_bTrophyState (false)
, m_fBannerStart (INTERFACE_INVALID_START)
, m_fBannerDuration (0.0f)
, m_fBannerSpeed (1.0f)
, m_iBannerType (0u)
, m_bBannerEigengrau (false)
, m_fStoryStart (INTERFACE_INVALID_START)
, m_fStoryDuration (0.0f)
, m_fStorySpeed (1.0f)
, m_fFragmentStart (INTERFACE_INVALID_START)
, m_fFragmentDuration (0.0f)
, m_iFragmentNew (0u)
, m_iFragmentState (0u)
, m_fAlertStart (INTERFACE_INVALID_START)
, m_fAnimation (0.0f)
, m_fRotation (0.0f)
, m_fShake (0.0f)
, m_fMove (0.0f)
, m_bVisible (false)
, m_fVisibleSpeed (2.0f)
, m_fAlphaAll (0.0f)
, m_fAlphaBoss (0.0f)
, m_fAlphaWave (0.0f)
, m_fAlphaSegment (0.0f)
, m_fAlphaTurf (0.0f)
, m_fAlphaGoal (0.0f)
, m_fAlphaMiss (0.0f)
, m_fAlphaBadge (0.0f)
, m_fAlphaFragment (0.0f)
, m_iFakeEnd (0u)
, m_bBossChange (false)
{
ASSERT((m_iNumViews > 0) && (m_iNumViews <= INTERFACE_VIEWS))
// construct player views
for(coreUintW i = 0u, ie = m_iNumViews; i < ie; ++i)
{
m_aView[i].Construct(i);
}
// create interface objects
m_aBossHealthBar[0].DefineTexture(0u, "menu_detail_03.png");
m_aBossHealthBar[0].DefineProgram("default_2d_program");
m_aBossHealthBar[0].SetSize (coreVector2(14.0f,0.5f) * 0.07f);
m_aBossHealthBar[0].SetColor3 (coreVector3(0.0f,0.0f,0.0f));
m_aBossHealthBar[1].DefineTexture(0u, "menu_detail_03.png");
m_aBossHealthBar[1].DefineProgram("default_2d_program");
m_aBossHealthBar[1].SetSize (m_aBossHealthBar[0].GetSize() - coreVector2(0.01f,0.01f));
m_aBossHealthBar[2].DefineTexture(0u, "menu_detail_03.png");
m_aBossHealthBar[2].DefineProgram("default_2d_program");
m_aBossHealthBar[2].SetSize (m_aBossHealthBar[1].GetSize());
m_BossHealthValue.Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_BossHealthValue.SetColor3(COLOR_MENU_INSIDE);
m_aBossTime[0].Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_aBossTime[0].SetColor3(COLOR_MENU_INSIDE);
m_aBossTime[1].Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_aBossTime[1].SetColor3(COLOR_MENU_INSIDE);
m_aBossTime[2].Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_aBossTime[2].SetColor3(COLOR_MENU_INSIDE * 0.75f);
for(coreUintW i = 0u; i < INTERFACE_MARKERS; ++i)
{
const coreVector2 vDir = StepRotated90(i % 4u);
const coreVector2 vSize = (vDir * 0.052f + vDir.yx() * 0.018f).Processed(ABS);
m_aaBossMarker[i][0].DefineTexture(0u, "menu_detail_05.png");
m_aaBossMarker[i][0].DefineProgram("default_2d_program");
m_aaBossMarker[i][0].SetSize (vSize);
m_aaBossMarker[i][0].SetDirection (vDir);
m_aaBossMarker[i][0].SetColor3 (coreVector3(0.0f,0.0f,0.0f));
m_aaBossMarker[i][1].DefineTexture(0u, "menu_detail_05.png");
m_aaBossMarker[i][1].DefineProgram("default_2d_program");
m_aaBossMarker[i][1].SetSize (vSize - coreVector2(0.01f,0.01f));
m_aaBossMarker[i][1].SetDirection (vDir);
}
m_aWaveTime[0].Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_aWaveTime[0].SetColor3(COLOR_MENU_INSIDE);
m_aWaveTime[1].Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_aWaveTime[1].SetColor3(COLOR_MENU_INSIDE);
m_aWaveTime[2].Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_aWaveTime[2].SetColor3(COLOR_MENU_INSIDE * 0.75f);
m_SegmentName.Construct(MENU_FONT_DYNAMIC_3, MENU_OUTLINE_SMALL);
m_SegmentName.SetColor3(COLOR_MENU_INSIDE);
m_SegmentBest.Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_SegmentBest.SetColor3(COLOR_MENU_INSIDE * 0.5f);
m_aTurfBar[0].DefineTexture(0u, "menu_detail_02.png");
m_aTurfBar[0].DefineProgram("default_2d_program");
m_aTurfBar[0].SetSize (coreVector2(7.0f,0.5f) * 0.07f);
m_aTurfBar[0].SetColor3 (coreVector3(0.0f,0.0f,0.0f));
m_aTurfBar[1].DefineTexture(0u, "menu_detail_02.png");
m_aTurfBar[1].DefineProgram("default_2d_program");
m_aTurfBar[1].SetSize (m_aTurfBar[0].GetSize() - coreVector2(0.01f,0.01f));
m_aTurfBar[2].DefineTexture(0u, "menu_detail_02.png");
m_aTurfBar[2].DefineProgram("default_2d_program");
m_aTurfBar[2].SetSize (m_aTurfBar[1].GetSize());
m_TurfValue.Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_TurfValue.SetColor3(COLOR_MENU_INSIDE);
m_GoalMedal.DefineTexture(0u, "menu_medal.png");
m_GoalMedal.DefineProgram("default_2d_program");
m_GoalMedal.SetTexSize (coreVector2(0.25f,0.25f));
m_GoalTime.Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_GoalTime.SetColor3(COLOR_MENU_INSIDE * 0.75f);
m_MissMedal.DefineTexture(0u, "menu_medal.png");
m_MissMedal.DefineProgram("default_2d_program");
m_MissMedal.SetSize (coreVector2(1.0f,1.0f) * 0.04f);
m_MissMedal.SetTexSize (coreVector2(0.25f,0.25f));
m_MissTime.Construct(MENU_FONT_STANDARD_2, MENU_OUTLINE_SMALL);
m_MissTime.SetColor3(COLOR_MENU_INSIDE * 0.75f);
for(coreUintW i = 0u; i < INTERFACE_HELPERS; ++i)
{
m_aHelper[i].DefineTexture(0u, "menu_helper.png");
m_aHelper[i].DefineProgram("menu_helper_program");
m_aHelper[i].SetTexSize (coreVector2(0.25f,0.25f));
m_aHelper[i].SetTexOffset (coreVector2(0.25f,0.25f) * coreVector2(I_TO_F(i % 4u), I_TO_F(i / 4u)));
m_aHelperWave[i].DefineTexture(0u, m_aHelper[i].GetTexture(0u));
m_aHelperWave[i].DefineProgram(m_aHelper[i].GetProgram ());
m_aHelperWave[i].SetTexSize (m_aHelper[i].GetTexSize ());
m_aHelperWave[i].SetTexOffset (m_aHelper[i].GetTexOffset());
}
for(coreUintW i = 0u; i < INTERFACE_BADGES; ++i)
{
m_aBadge[i].DefineTexture(0u, "menu_badge.png");
m_aBadge[i].DefineProgram("default_2d_program");
m_aBadge[i].SetTexSize (coreVector2(0.5f,1.0f));
m_aBadgeWave[i].DefineTexture(0u, "effect_headlight_point.png");
m_aBadgeWave[i].DefineProgram("menu_single_program");
}
m_Trophy.Construct(MENU_FONT_ICON_2, MENU_OUTLINE_SMALL);
m_Trophy.SetColor3(COLOR_MENU_WHITE);
m_Trophy.SetText (ICON_TROPHY);
m_TrophyMark.Construct (MENU_FONT_ICON_2, MENU_OUTLINE_SMALL);
m_TrophyMark.SetRectifyX(false);
m_TrophyWave.DefineTexture(0u, "effect_headlight_point.png");
m_TrophyWave.DefineProgram("menu_single_program");
m_TrophyWave.SetSize(coreVector2(1.0f,1.0f) * 0.043f);
m_BannerBar.DefineTexture(0u, "menu_detail_04.png");
m_BannerBar.DefineTexture(1u, "menu_background_black.png");
m_BannerBar.DefineProgram("menu_animate_program");
m_BannerShadow.DefineTexture(0u, "effect_headlight_point.png");
m_BannerShadow.DefineProgram("menu_single_program");
m_BannerShadow.SetPosition (coreVector2(0.0f,0.0f));
m_BannerShadow.SetSize (coreVector2(1.0f,0.4f) * 0.75f);
m_BannerShadow.SetColor3 (coreVector3(0.0f,0.0f,0.0f));
for(coreUintW i = 0u; i < ARRAY_SIZE(m_aBannerIcon); ++i)
{
m_aBannerIcon[i].DefineTexture(0u, "menu_helper.png");
m_aBannerIcon[i].DefineProgram("menu_helper_program");
m_aBannerIcon[i].SetPosition (coreVector2(0.0f, 0.0f));
m_aBannerIcon[i].SetCenter (coreVector2(0.0f, INTERFACE_BANNER_HEIGHT));
m_aBannerIcon[i].SetTexSize (coreVector2(0.25f,0.25f));
}
m_aBannerText[0].Construct (MENU_FONT_STANDARD_5, MENU_OUTLINE_SMALL);
m_aBannerText[0].SetColor3 (COLOR_MENU_INSIDE * 0.75f);
m_aBannerText[1].Construct (MENU_FONT_STANDARD_5, MENU_OUTLINE_SMALL);
m_aBannerText[1].SetColor3 (COLOR_MENU_INSIDE * 0.75f);
m_aBannerText[2].DefineTexture(2u, "menu_background_black.png");
m_aBannerText[3].DefineTexture(2u, "menu_background_black.png");
m_BannerExtra.Construct (MENU_FONT_STANDARD_3, MENU_OUTLINE_SMALL);
m_BannerExtra.DefineProgram("menu_swipe_label_program");
m_BannerExtra.DefineTexture(2u, "menu_background_black.png");
m_aBannerLogo[0].DefineTexture(0u, "game_logo.png");
m_aBannerLogo[0].DefineTexture(2u, "menu_background_black.png");
m_aBannerLogo[0].DefineProgram("menu_swipe_program");
m_aBannerLogo[0].SetPosition (coreVector2(0.0f,0.065f) * (0.8f/1.0f));
m_aBannerLogo[0].SetSize (coreVector2(1.0f,0.25f) * 0.8f * (0.8f/1.0f));
m_aBannerLogo[1].DefineTexture(0u, "game_logo_kana.png");
m_aBannerLogo[1].DefineTexture(2u, "menu_background_black.png");
m_aBannerLogo[1].DefineProgram("menu_swipe_program");
m_aBannerLogo[1].SetPosition (m_aBannerLogo[0].GetPosition() + coreVector2(0.0f,-0.1f) * (0.8f/1.0f));
m_aBannerLogo[1].SetSize (coreVector2(2.0f, 0.25f) * 0.3f * (0.8f/1.0f));
m_aStoryText[0].Construct(MENU_FONT_DYNAMIC_3, MENU_OUTLINE_BIG);
m_aStoryText[0].SetColor3(COLOR_MENU_INSIDE);
m_aStoryText[1].Construct(MENU_FONT_DYNAMIC_3, MENU_OUTLINE_BIG);
m_aStoryText[1].SetColor3(COLOR_MENU_INSIDE);
m_aDialogText[0].Construct(MENU_FONT_DYNAMIC_3, MENU_OUTLINE_BIG);
m_aDialogText[0].SetColor3(COLOR_MENU_INSIDE);
m_aDialogText[1].Construct(MENU_FONT_DYNAMIC_3, MENU_OUTLINE_BIG);
m_aDialogText[1].SetColor3(COLOR_MENU_INSIDE);
m_ReplayWatermark.Construct (MENU_FONT_DYNAMIC_2, MENU_OUTLINE_SMALL);
m_ReplayWatermark.SetColor3 (COLOR_MENU_INSIDE);
m_ReplayWatermark.SetTextLanguage("REPLAY_WATERMARK");
for(coreUintW i = 0u; i < INTERFACE_FRAGMENTS; ++i)
{
const coreVector2 vDir = FRAGMENT_DIRECTION;
const coreVector2 vSize = g_aFragmentData[i].vSize * INTERFACE_FRAGMENT_SCALE * ((i == 8u) ? 1.1f : 1.0f);
m_aFragment[i].DefineTexture(0u, PRINT("menu_fragment_%02zu.png", g_aFragmentData[i].iIndex));
m_aFragment[i].DefineTexture(1u, "menu_background_black.png");
m_aFragment[i].DefineProgram("menu_fragment_program");
m_aFragment[i].SetSize (vSize);
m_aFragment[i].SetDirection (vDir);
}
for(coreUintW i = 0u; i < ARRAY_SIZE(m_aFragmentTable); ++i)
{
m_aFragmentTable[i].DefineTexture(0u, "menu_fragment_plate.png");
m_aFragmentTable[i].DefineProgram("menu_single_program");
m_aFragmentTable[i].SetPosition (coreVector2(0.0f,0.0f));
m_aFragmentTable[i].SetSize (coreVector2(1.0f,1.0f) * INTERFACE_FRAGMENT_SCALE);
m_aFragmentTable[i].SetDirection (coreVector2(1.0f,1.0f).Normalized());
m_aFragmentTable[i].SetColor3 (coreVector3(1.0f,1.0f,1.0f) * 0.0f);
}
m_FragmentShadow.DefineTexture(0u, "effect_headlight_point.png");
m_FragmentShadow.DefineProgram("menu_single_program");
m_FragmentShadow.SetPosition(coreVector2(0.0f,0.0f));
m_FragmentShadow.SetSize (coreVector2(1.0f,1.0f) * 0.75f);
m_FragmentShadow.SetColor3 (coreVector3(1.0f,1.0f,1.0f));
m_Medal.DefineTexture(0u, "menu_medal.png");
m_Medal.DefineProgram("default_2d_program");
m_Medal.SetTexSize (coreVector2(0.25f,0.25f));
//
m_pAlertSound = Core::Manager::Resource->Get<coreSound>("effect_alert.wav");
//
this->ChangeLanguage(Core::Language);
}
// ****************************************************************
// destructor
cInterface::~cInterface()
{
if(m_pAlertSound->EnableRef(this))
{
m_pAlertSound->Stop();
}
}
// ****************************************************************
// render the interface
void cInterface::Render()
{
if(this->IsBannerActive())
{
//
cMenu::UpdateAnimateProgram(&m_BannerBar);
// render banner
m_BannerBar .Render();
m_aBannerIcon[0].Render();
m_aBannerIcon[1].Render();
m_BannerShadow .Render();
m_aBannerLogo[0].Render();
m_aBannerLogo[1].Render();
m_aBannerText[0].Render();
m_aBannerText[1].Render();
m_aBannerText[2].Render();
m_aBannerText[3].Render();
m_BannerExtra .Render();
//
m_Medal.Render();
}
if(this->IsFragmentActive())
{
//
m_FragmentShadow .Render();
m_aFragmentTable[0].Render();
m_aFragmentTable[1].Render();
for(coreUintW i = 0u; i < INTERFACE_FRAGMENTS; ++i) m_aFragment[i].Render();
}
if(m_fAlphaAll)
{
// render player images
for(coreUintW i = 0u, ie = m_iNumViews; i < ie; ++i) m_aView[i].oCooldownBar .Render(); // # first
for(coreUintW i = 0u, ie = m_iNumViews; i < ie; ++i) for(coreUintW j = 0u; j < INTERFACE_LIVES; ++j) m_aView[i].aLife [j].Render();
for(coreUintW i = 0u, ie = m_iNumViews; i < ie; ++i) for(coreUintW j = 0u; j < 3u; ++j) m_aView[i].aShieldBar[j].Render();
if(m_fAlphaBoss)
{
// render boss images
m_aBossHealthBar[0].Render();
m_aBossHealthBar[1].Render();
m_aBossHealthBar[2].Render();
for(coreUintW i = 0u; i < INTERFACE_MARKERS; ++i) m_aaBossMarker[i][0].Render();
for(coreUintW i = 0u; i < INTERFACE_MARKERS; ++i) m_aaBossMarker[i][1].Render();
}
if(m_fAlphaTurf)
{
//
m_aTurfBar[0].Render();
m_aTurfBar[1].Render();
m_aTurfBar[2].Render();
}
//
m_GoalMedal.Render();
m_MissMedal.Render();
//
if(m_fAlphaBoss)
{
for(coreUintW i = 0u; i < INTERFACE_HELPERS; ++i) m_aHelperWave[i].Render();
for(coreUintW i = 0u; i < INTERFACE_HELPERS; ++i) m_aHelper [i].Render();
}
//
if(m_fAlphaWave)
{
for(coreUintW i = 0u; i < INTERFACE_BADGES; ++i) m_aBadgeWave[i].Render();
for(coreUintW i = 0u; i < INTERFACE_BADGES; ++i) m_aBadge [i].Render();
}
//
m_TrophyWave.Render();
for(coreUintW i = 0u, ie = m_iNumViews; i < ie; ++i)
{
// render player labels
m_aView[i].oShieldValue.Render();
m_aView[i].oScore .Render();
m_aView[i].oComboValue .Render();
m_aView[i].oChainValue .Render();
m_aView[i].oImmune .Render();
m_aView[i].oSpeed .Render();
}
if(m_fAlphaBoss)
{
// render boss labels
m_BossHealthValue.Render();
m_aBossTime[0] .Render();
m_aBossTime[1] .Render();
m_aBossTime[2] .Render();
}
if(m_fAlphaWave)
{
// render wave labels
m_aWaveTime[0].Render();
m_aWaveTime[1].Render();
m_aWaveTime[2].Render();
}
//
m_SegmentName.Render();
m_SegmentBest.Render();
if(m_fAlphaTurf)
{
//
m_TurfValue.Render();
}
//
m_GoalTime.Render();
m_MissTime.Render();
//
m_Trophy .Render();
m_TrophyMark.Render();
//
m_ReplayWatermark.Render();
}
if(this->IsStoryActive())
{
// render story
m_aStoryText[0].Render();
m_aStoryText[1].Render();
}
//
m_aDialogText[0].Render();
m_aDialogText[1].Render();
}
// ****************************************************************
// move the interface
void cInterface::Move()
{
const coreBool bInGame = STATIC_ISVALID(g_pGame);
const coreUintW iMissionIndex = bInGame ? g_pGame->GetCurMissionIndex() : 0u;
const coreUintW iSegmentIndex = bInGame ? g_pGame->GetCurMission()->GetCurSegmentIndex() : 0u;
//
m_fAnimation.UpdateMod(6.0f*PI, 2.0f*PI);
const coreFloat fDanger = g_CurConfig.Graphics.iFlash ? (0.5f + 0.5f * SIN(m_fAnimation)) : 0.0f;
//
m_fRotation.UpdateMod(1.0f, 2.0f*PI);
//
m_fMove.UpdateMod(1.0f, 20.0f);
//
const coreFloat fAlphaPlayerFull = BLENDH3(m_fAlphaAll) * MENU_INSIDE_ALPHA;
const coreFloat fAlphaBossFull = fAlphaPlayerFull * BLENDH3(m_fAlphaBoss);
const coreFloat fAlphaWaveFull = fAlphaPlayerFull * BLENDH3(m_fAlphaWave);
const coreFloat fAlphaSegmentFull = fAlphaPlayerFull * BLENDH3(m_fAlphaSegment);
const coreFloat fAlphaTurfFull = fAlphaPlayerFull * BLENDH3(m_fAlphaTurf);
this->UpdateSpacing(); // TODO 1: should not be called all the time
const coreVector2 vFlip = (g_CurConfig.Game.iHudType == 2u) ? (cInterface::__IsFlipped() ? coreVector2(-1.0f,1.0f) : coreVector2(1.0f,-1.0f)) : coreVector2(1.0f,1.0f);
const coreVector2 vAdd = coreVector2((vFlip.x < 0.0f) ? 0.02f : 0.0f, (vFlip.y < 0.0f) ? 0.02f : 0.0f);
const auto nFlipFunc = [&](const coreVector2 vBasePos, const coreObject2D* pObject)
{
const coreVector2 vAlign = pObject->GetAlignment();
return coreVector2(vAlign.x ? ((ABS(vBasePos.x) + vAdd.x) * vAlign.x) : vBasePos.x,
vAlign.y ? ((ABS(vBasePos.y) + vAdd.y) * vAlign.y) : vBasePos.y);
};
coreFloat fTrophyCover = 1.0f;
// loop through all player views
for(coreUintW i = 0u, ie = m_iNumViews; i < ie; ++i)
{
sPlayerView& oView = m_aView[i];
cPlayer* pPlayer = g_pGame->GetPlayer(i);
const coreObject2D* apObject1[] = {&oView.aShieldBar[0], &oView.aLife[0], &oView.aLife[1], &oView.aLife[2], &oView.aLife[3], &oView.aLife[4], &m_Trophy}; STATIC_ASSERT(INTERFACE_LIVES == 5u)
const coreVector2 avScale1 [] = {coreVector2(1.2f,2.2f), coreVector2(1.4f,1.4f), coreVector2(1.4f,1.4f), coreVector2(1.4f,1.4f), coreVector2(1.4f,1.4f), coreVector2(1.4f,1.4f), coreVector2(2.0f,2.0f)};
const coreFloat fHealthCover = this->CalcGameCover(apObject1, avScale1, ARRAY_SIZE(apObject1) + ((i == 1u) ? 0 : -1), true);
const coreObject2D* apObject2[] = {&oView.oScore, &oView.oCooldownBar, &oView.oComboValue, &oView.oChainValue};
const coreVector2 avScale2 [] = {coreVector2(1.2f,1.4f), coreVector2(1.2f,1.2f), coreVector2(1.4f,2.0f), coreVector2(1.4f,2.0f)};
const coreFloat fScoreCover = this->CalcGameCover(apObject2, avScale2, ARRAY_SIZE(apObject2), true);
if(i == 1u) fTrophyCover = fHealthCover;
if(!bInGame)
{
oView.fSpin = I_TO_F(LIVES);
oView.fSpin2 = 1.0f;
}
const coreBool bHasShield = (!bInGame || pPlayer->HasStatus(PLAYER_STATUS_SHIELDED));
if(bHasShield)
{
const coreInt32 iCurShield = bInGame ? pPlayer->GetCurShield() : 10;
if(oView.iShieldOld != iCurShield) oView.fShieldBump = 1.0f;
oView.iShieldOld = iCurShield;
oView.fShieldBump.UpdateMax(-3.0f, 0.0f);
const coreFloat fBump = BLENDBR(oView.fShieldBump);
//
if(m_fAlphaAll) oView.fSpin2.UpdateMin(1.0f, 1.0f);
else oView.fSpin2 = 0.0f;
// set shield bar size
const coreFloat fBase = bInGame ? pPlayer->GetCurShieldPct() : 0.7f;
const coreFloat fPercent = LERP(0.02f, 0.98f, fBase * oView.fSpin2);
const coreFloat fWidth = oView.aShieldBar[0].GetSize().x - 0.01f;
oView.aShieldBar[1].SetSize (coreVector2(fPercent * fWidth, oView.aShieldBar[1].GetSize().y));
oView.aShieldBar[1].SetTexSize (coreVector2(fPercent, 1.0f));
oView.aShieldBar[1].SetTexOffset(coreVector2((oView.aShieldBar[1].GetAlignment().x < 0.0f) ? (1.0f-fPercent) : 0.0f, 0.0f));
const coreFloat fRev = 1.0f - fPercent;
oView.aShieldBar[2].SetPosition (coreVector2(fWidth * (fPercent) * oView.aShieldBar[2].GetAlignment().x + oView.aShieldBar[1].GetPosition().x, oView.aShieldBar[2].GetPosition().y));
oView.aShieldBar[2].SetSize (coreVector2(fWidth * fRev, oView.aShieldBar[2].GetSize ().y));
oView.aShieldBar[2].SetTexSize (coreVector2(fRev, 1.0f));
oView.aShieldBar[2].SetTexOffset(coreVector2((oView.aShieldBar[2].GetAlignment().x < 0.0f) ? 0.0f : fPercent, 0.0f));
// set shield bar color
const coreVector3 vColor = bInGame ? LERP((pPlayer->GetEnergyColor() * 2.08f) + ((fBase <= 0.2f) ? (fDanger * 0.5f) : 0.0f), coreVector3(1.0f,1.0f,1.0f), fBump) :( COLOR_PLAYER_BLUE * 2.08f);
oView.aShieldBar[1].SetColor3(vColor * 1.0f);
oView.aShieldBar[2].SetColor3(vColor * 0.3f);
oView.aShieldBar[0].SetColor3(LERP(coreVector3(0.0f,0.0f,0.0f), coreVector3(1.0f,1.0f,1.0f) * 0.6f, fBump));
// display shield value
oView.oShieldValue.SetText(PRINT("%.0f", I_TO_F(iCurShield) * oView.fSpin2));
}
//
const coreFloat fCurHealth = bInGame ? I_TO_F(pPlayer->GetCurHealth()) : I_TO_F(LIVES);
if(!m_fAlphaAll) oView.fSpin = 0.0f;
else if(fCurHealth > oView.fSpin) oView.fSpin.UpdateMin( 8.0f, fCurHealth);
else if(fCurHealth < oView.fSpin) oView.fSpin.UpdateMax(-8.0f, fCurHealth);
//
for(coreUintW j = 0u; j < INTERFACE_LIVES; ++j)
{
//
//const coreVector2 vSide = coreVector2(i ? -1.0f : 1.0f, 1.0f);
const coreVector2 vPos = coreVector2((g_bSteamDeck ? 0.002f : 0.007f) + I_TO_F(j) * 0.055f, 0.005f);
const coreVector2 vSize = coreVector2(1.0f,1.0f) * 0.058f;
//
const coreFloat fCurSpin = CLAMP01(oView.fSpin - I_TO_F(j));
const coreVector2 vNewSize = vSize * (1.5f - 0.5f * fCurSpin);
const coreVector2 vNewPos = nFlipFunc(vPos, &oView.aLife[j]) + 0.5f * (vSize - vNewSize) * oView.aLife[j].GetAlignment();
const coreVector2 vNewDir = coreVector2::Direction(m_fRotation + (0.8f*PI) * (I_TO_F(j) / I_TO_F(INTERFACE_LIVES)));
//
oView.aLife[j].SetPosition (vNewPos);
oView.aLife[j].SetSize (vNewSize);
oView.aLife[j].SetDirection(vNewDir);
oView.aLife[j].SetAlpha (fAlphaPlayerFull * fCurSpin * fHealthCover);
oView.aLife[j].SetEnabled (fCurSpin ? CORE_OBJECT_ENABLE_ALL : CORE_OBJECT_ENABLE_NOTHING);
oView.aLife[j].Move();
}
const cScoreTable* pScoreTable = bInGame ? pPlayer->GetScoreTable() : NULL;
// display score
oView.oScore.SetText(PRINT("%07u", bInGame ? pScoreTable->GetScoreTotal() : 0));
const coreUint32 iModifier = bInGame ? pScoreTable->GetModifier() : 100u;
const coreUint32 iChain = bInGame ? g_pGame->RaiseValue(pScoreTable->GetCurChain()) : 1000u;
const coreFloat fCooldown = bInGame ? pScoreTable->GetCooldown() : 1.0f;
const coreBool bShowValue = !bInGame || ((iModifier > (pScoreTable->HasOverride() ? 0u : 10u)));
const coreBool bShowBar = !bInGame || (bShowValue && (!pScoreTable->HasOverride() || iChain));
//
oView.oCooldownBar.SetSize (coreVector2(bShowBar ? (0.16f * MIN1(fCooldown * 1.1f)) : 0.0f, 0.013f));
oView.oCooldownBar.SetColor3 ((bInGame ? ((fCooldown > 0.5f) ? pPlayer->GetMenuColor() : COLOR_MENU_RED) : COLOR_MENU_BLUE) * 1.2f);
oView.oCooldownBar.SetTexSize (coreVector2(2.0f,5.0f) * oView.oCooldownBar.GetSize());
oView.oCooldownBar.SetTexOffset(coreVector2(0.02f,0.5f) * m_fMove - coreVector2((oView.oCooldownBar.GetAlignment().x < 0.0f) ? oView.oCooldownBar.GetTexSize().x : 0.0f, 0.0f));
oView.oCooldownBar.SetEnabled (bShowBar ? CORE_OBJECT_ENABLE_ALL : CORE_OBJECT_ENABLE_NOTHING);
//
oView.oComboValue.SetText(bShowValue ? PRINT("x%u.%u", iModifier / 10u, iModifier % 10u) : "");
oView.oChainValue.SetText((bShowValue && iChain) ? PRINT("+%u", iChain) : "");
oView.oComboValue.SetEnabled(oView.oComboValue.GetText()[0] ? CORE_OBJECT_ENABLE_ALL : CORE_OBJECT_ENABLE_NOTHING); // for cover
oView.oChainValue.SetEnabled(oView.oChainValue.GetText()[0] ? CORE_OBJECT_ENABLE_ALL : CORE_OBJECT_ENABLE_NOTHING);
//
oView.fImmuneTime.UpdateMax(-1.0f, 0.0f);
const coreFloat fImmuneValue = BLENDB(1.0f - oView.fImmuneTime);
//
oView.oImmune.SetPosition(MapToAxis(GetTranslationArea(oView.aLife[2]), g_vHudDirection) + coreVector2(0.0f, 0.05f * fImmuneValue));
oView.oImmune.SetEnabled (oView.fImmuneTime ? CORE_OBJECT_ENABLE_ALL : CORE_OBJECT_ENABLE_NOTHING);
//
const coreUint8 iMode = bInGame ? REPLAY_WRAP_CONFIG_CONTROL_MODE[g_pGame->GetPlayerIndex(pPlayer)] : 0u;
const coreBool bFireSpeed = bInGame && pPlayer->HasStatus(PLAYER_STATUS_RAPID_FIRE) && ((iMode == 1u) || (iMode == 2u));
if(bFireSpeed) oView.fSpeedTime.UpdateMin( 7.0f, 1.0f);
else oView.fSpeedTime.UpdateMax(-7.0f, 0.0f);
const coreFloat fSpeedValue = BLENDH3(1.0f - oView.fSpeedTime);
//
oView.oSpeed.SetPosition(nFlipFunc(coreVector2(-0.0145f,0.08f + (bHasShield ? 0.03f : 0.0f)), &oView.oSpeed) + coreVector2(fSpeedValue * 0.01f * (bFireSpeed ? -1.0f : 1.0f), 0.0f));
//oView.oSpeed.SetPosition(g_pForeground->Project2D(pPlayer->GetPosition()) + coreVector2(fSpeedValue * 0.01f * (bFireSpeed ? -1.0f : 1.0f), 0.0f));
oView.oSpeed.SetColor3 (COLOR_MENU_INSIDE * LERP(0.6f, 0.9f, fDanger));
oView.oSpeed.SetEnabled (oView.fSpeedTime ? CORE_OBJECT_ENABLE_ALL : CORE_OBJECT_ENABLE_NOTHING);
// set player transparency
oView.aShieldBar[0].SetAlpha(fAlphaPlayerFull * fHealthCover);
oView.aShieldBar[1].SetAlpha(fAlphaPlayerFull * fHealthCover);
oView.aShieldBar[2].SetAlpha(fAlphaPlayerFull * fHealthCover);
oView.oShieldValue .SetAlpha(fAlphaPlayerFull * fHealthCover);
oView.oScore .SetAlpha(fAlphaPlayerFull * fScoreCover);
oView.oCooldownBar .SetAlpha(fAlphaPlayerFull * fScoreCover);
oView.oComboValue .SetAlpha(fAlphaPlayerFull * fScoreCover);
oView.oChainValue .SetAlpha(fAlphaPlayerFull * fScoreCover);
oView.oImmune .SetAlpha(fAlphaPlayerFull * fHealthCover * (1.0f - fImmuneValue));
oView.oSpeed .SetAlpha(fAlphaPlayerFull * fHealthCover * (1.0f - fSpeedValue));
// move player
oView.oShieldValue .Move();
oView.aShieldBar[0].Move();
oView.aShieldBar[1].Move();
oView.aShieldBar[2].Move();
oView.oScore .Move();
oView.oCooldownBar .Move();
oView.oComboValue .Move();
oView.oChainValue .Move();
oView.oImmune .Move();
oView.oSpeed .Move();
}
// check for active boss
const cBoss* pBoss = bInGame ? g_pGame->GetCurMission()->GetCurBoss() : NULL;
if(pBoss)
{
//
if(m_fAlphaBoss) m_fBossSpin.UpdateMin(1.0f / (INTERFACE_BANNER_DURATION_BOSS - INTERFACE_BOSS_DELAY), 1.0f);
else m_fBossSpin = 0.0f;
// set health bar size
const coreFloat fBase = pBoss->GetCurHealthPct();
const coreFloat fGoal = pBoss->CalcHealthGoal();
const coreFloat fPerBase = fBase * m_fBossSpin;
const coreFloat fPerGoal = LERP(0.02f, 0.98f, fGoal * m_fBossSpin);
const coreFloat fWidth = m_aBossHealthBar[0].GetSize().x - 0.01f;
m_aBossHealthBar[1].SetPosition(coreVector2(fWidth * (fPerGoal-1.0f) * 0.5f, m_aBossHealthBar[1].GetPosition().y));
m_aBossHealthBar[1].SetSize (coreVector2(fWidth * fPerGoal, m_aBossHealthBar[1].GetSize ().y));
m_aBossHealthBar[1].SetTexSize (coreVector2(fPerGoal, 1.0f));
const coreFloat fRev = 1.0f - fPerGoal;
m_aBossHealthBar[2].SetPosition (coreVector2(fWidth * fPerGoal * 0.5f, m_aBossHealthBar[2].GetPosition().y));
m_aBossHealthBar[2].SetSize (coreVector2(fWidth * fRev, m_aBossHealthBar[2].GetSize ().y));
m_aBossHealthBar[2].SetTexSize (coreVector2(fRev, 1.0f));
m_aBossHealthBar[2].SetTexOffset(coreVector2(fPerGoal, 0.0f));
const coreVector3 vColor = LERP(coreVector3(1.0f,1.0f,1.0f), pBoss->GetColor(), cShip::TransformColorFactor(fBase)) + ((fBase <= 0.2f) ? (fDanger * 0.5f) : 0.0f);
m_aBossHealthBar[1].SetColor3(vColor * 1.0f);
m_aBossHealthBar[2].SetColor3(vColor * 0.3f);
// display health value
m_BossHealthValue.SetText(PRINT("%.0f%%", fPerBase ? FLOOR(LERP(1.0f, 100.0f, fPerBase)) : 0.0f));
}
coreBool bTurf = false;
if(bInGame && (g_pGame->GetCurMission()->GetID() == cAterMission::ID))
{
const cTurf* pTurf = d_cast<cAterMission*>(g_pGame->GetCurMission())->GetTurf();
bTurf = pTurf->IsActive();
if(bTurf)
{
//
const coreFloat fPercent = pTurf->CalcPercent();
const coreFloat fWidth = m_aTurfBar[0].GetSize().x - 0.01f;
m_aTurfBar[1].SetPosition(coreVector2(fWidth * (fPercent-1.0f) * 0.5f, m_aTurfBar[1].GetPosition().y));
m_aTurfBar[1].SetSize (coreVector2(fWidth * fPercent, m_aTurfBar[1].GetSize ().y));
m_aTurfBar[1].SetTexSize (coreVector2(fPercent, 1.0f));
const coreFloat fRev = 1.0f - fPercent;
m_aTurfBar[2].SetPosition (coreVector2(fWidth * fPercent * 0.5f, m_aTurfBar[2].GetPosition().y));
m_aTurfBar[2].SetSize (coreVector2(fWidth * fRev, m_aTurfBar[2].GetSize ().y));
m_aTurfBar[2].SetTexSize (coreVector2(fRev, 1.0f));
m_aTurfBar[2].SetTexOffset(coreVector2(fPercent, 0.0f));
const coreVector3 vColor = coreVector3(1.0f,1.0f,1.0f);// + ((fPercent <= 0.4f) ? (fDanger * 0.5f) : 0.0f);
m_aTurfBar[1].SetColor3(vColor * 1.0f);
m_aTurfBar[2].SetColor3(vColor * 0.3f);
//
m_TurfValue.SetText(PRINT("%.0f%%", fPercent ? FLOOR(LERP(1.0f, 100.0f, fPercent)) : 0.0f));
}
}
// display time
const coreFloat fTime = bInGame ? g_pGame->GetTimeTable()->GetTimeSegmentSafe() : 10.0f;
if(fTime)
{
m_aBossTime[0].SetText(PRINT("%.0f.", FLOOR( fTime)));
m_aBossTime[1].SetText(PRINT("%.0f", FLOOR(FRACT(fTime)*10.0f + CORE_MATH_PRECISION)));
m_aWaveTime[0].SetText(m_aBossTime[0].GetText());
m_aWaveTime[1].SetText(m_aBossTime[1].GetText());
STATIC_ASSERT(GAME_GOAL_FACTOR == 10.0f)
}
else
{
if(!fAlphaBossFull && !fAlphaWaveFull)
{
m_aBossTime[0].SetText("0.");
m_aBossTime[1].SetText("0");
m_aBossTime[2].SetText(" +0");
m_aWaveTime[0].SetText("0.");
m_aWaveTime[1].SetText("0");
m_aWaveTime[2].SetText(" +0");
}
}
//
const coreInt32 iShift = bInGame ? g_pGame->GetTimeTable()->GetShiftSegmentSafe() : 10;
if(fTime)
{
m_aBossTime[2].SetText(PRINT(" %+d", iShift));
m_aWaveTime[2].SetText(m_aBossTime[2].GetText());
}
if(!bInGame)
{
m_SegmentBest.SetText ("10.0 +10");
m_SegmentBest.SetEnabled(CORE_OBJECT_ENABLE_ALL);
m_fAlphaSegment = 1.0f;
}
else if(((pBoss ? fAlphaBossFull : fAlphaWaveFull) || m_iFakeEnd) && !m_bBossChange)
{
if(iSegmentIndex != MISSION_NO_SEGMENT)
{
const auto& oStats = g_pSave->GetHeader().aaaaaLocalStatsSegment[g_pGame->GetType()][g_pGame->GetMode()][g_pGame->GetDifficulty()][iMissionIndex][iSegmentIndex];
const coreInt32 iBestShift = coreInt32(oStats.iTimeBestShiftBad) - coreInt32(oStats.iTimeBestShiftGood);
const coreFloat fBestTime = FloorFactor(TABLE_TIME_TO_FLOAT(oStats.iTimeBestShifted) - I_TO_F(iBestShift), GAME_GOAL_FACTOR);
m_SegmentBest.SetText(fBestTime ? PRINT("%.1f %+d", fBestTime, iBestShift) : "");
m_SegmentBest.SetEnabled(g_pGame->IsMulti() ? CORE_OBJECT_ENABLE_NOTHING : (m_SegmentBest.GetText()[0] ? CORE_OBJECT_ENABLE_ALL : CORE_OBJECT_ENABLE_NOTHING));
m_fAlphaSegment.UpdateMin(2.0f, 1.0f);
}
}
else
{
m_fAlphaSegment.UpdateMax(-2.0f, 0.0f);
}
// adjust time position (# only required if alignment is centered)
m_aBossTime[0].RetrieveDesiredSize([this](const coreVector2 vSize)
{
coreFloat fWidth = 0.0f;
m_aBossTime[2].RetrieveDesiredSize([&](const coreVector2 vSize) {fWidth = vSize.x;});
const coreFloat fPos = (vSize.x - 0.015f - fWidth) * 0.5f;
m_aBossTime[0].SetPosition(coreVector2(fPos, m_aBossTime[0].GetPosition().y));
m_aBossTime[1].SetPosition(coreVector2(fPos - 0.004f, m_aBossTime[1].GetPosition().y));
m_aBossTime[2].SetPosition(coreVector2(fPos + 0.015f, m_aBossTime[2].GetPosition().y));
});
m_aWaveTime[0].RetrieveDesiredSize([this](const coreVector2 vSize)
{
coreFloat fWidth = 0.0f;
m_aWaveTime[2].RetrieveDesiredSize([&](const coreVector2 vSize) {fWidth = vSize.x;});
const coreFloat fPos = (vSize.x - 0.015f - fWidth) * 0.5f;
m_aWaveTime[0].SetPosition(coreVector2(fPos, m_aWaveTime[0].GetPosition().y));
m_aWaveTime[1].SetPosition(coreVector2(fPos - 0.004f, m_aWaveTime[1].GetPosition().y));
m_aWaveTime[2].SetPosition(coreVector2(fPos + 0.015f, m_aWaveTime[2].GetPosition().y));
});
const coreFloat fBossCover = this->CalcGameCover(&m_aBossHealthBar[0], coreVector2( 1.2f,2.6f), true);
const coreFloat fWaveCover = this->CalcGameCover(&m_aWaveTime[0], coreVector2(99.0f,2.2f), true);
const coreObject2D* apObject5[] = {&m_SegmentName, &m_SegmentBest, &m_Trophy};
const coreVector2 avScale5 [] = {coreVector2(1.2f,1.4f), coreVector2(1.2f,2.0f), coreVector2(2.0f,2.0f)};
const coreFloat fSegmentCover = this->CalcGameCover(apObject5, avScale5, ARRAY_SIZE(apObject5) + ((bInGame && g_pGame->IsMulti()) ? -1 : 0), true);
// set boss transparency
m_aBossHealthBar[0].SetAlpha(fAlphaBossFull * fBossCover);
m_aBossHealthBar[1].SetAlpha(fAlphaBossFull * fBossCover);
m_aBossHealthBar[2].SetAlpha(fAlphaBossFull * fBossCover);
m_BossHealthValue .SetAlpha(fAlphaBossFull * fBossCover);
m_aBossTime[0] .SetAlpha(fAlphaBossFull * fBossCover);
m_aBossTime[1] .SetAlpha(fAlphaBossFull * fBossCover);
m_aBossTime[2] .SetAlpha(fAlphaBossFull * fBossCover);
// move boss
m_aBossHealthBar[0].Move();
m_aBossHealthBar[1].Move();
m_aBossHealthBar[2].Move();
m_BossHealthValue .Move();
m_aBossTime[0] .Move();
m_aBossTime[1] .Move();
m_aBossTime[2] .Move();
const coreInt32* piHealthGoal = pBoss ? pBoss->GetHealthGoal() : NULL;
if(piHealthGoal)
{
const coreInt32 iMaxHealth = pBoss->GetMaxHealth();
const coreInt32 iCurHealth = MIN(pBoss->GetCurHealth(), pBoss->GetMaxHealthGoal());
const coreFloat fBase = I_TO_F(iCurHealth) * RCP(I_TO_F(iMaxHealth));
const coreFloat fPerCur = I_TO_F(iCurHealth) * m_fBossSpin;
if(*piHealthGoal) piHealthGoal++;
for(coreUintW i = 0u; i < INTERFACE_MARKERS; ++i)
{
if(*piHealthGoal)
{
//const coreFloat fAlong = (m_aBossHealthBar[0].GetSize().x - 0.01f) * LERP(-0.5f, 0.5f, I_TO_F(*piHealthGoal) * RCP(I_TO_F(iMaxHealth)));
const coreFloat fAlong = m_aBossHealthBar[0].GetSize().x * 0.5f + I_TO_F(i) * -0.025f - 0.1f;
const coreVector2 vPos = MapToAxis(GetTranslationArea(m_aBossHealthBar[0]), g_vHudDirection) + coreVector2(fAlong, 0.0f);
m_aaBossMarker[i][0].SetPosition(vPos);
m_aaBossMarker[i][0].SetEnabled (CORE_OBJECT_ENABLE_ALL);
m_aaBossMarker[i][1].SetPosition(vPos);
m_aaBossMarker[i][1].SetColor3 (coreVector3(1.0f,1.0f,1.0f) * ((fPerCur <= I_TO_F(*piHealthGoal)) ? 0.25f : 0.85f) + ((fBase <= 0.2f) ? (fDanger * 0.15f) : 0.0f));
m_aaBossMarker[i][1].SetEnabled (CORE_OBJECT_ENABLE_ALL);
piHealthGoal++;
}
else
{
m_aaBossMarker[i][0].SetEnabled(CORE_OBJECT_ENABLE_NOTHING);
m_aaBossMarker[i][1].SetEnabled(CORE_OBJECT_ENABLE_NOTHING);
}
}
}
for(coreUintW i = 0u; i < INTERFACE_MARKERS; ++i)
{
//
m_aaBossMarker[i][0].SetAlpha(fAlphaBossFull * fBossCover);
m_aaBossMarker[i][1].SetAlpha(fAlphaBossFull * fBossCover);
//
m_aaBossMarker[i][0].Move();
m_aaBossMarker[i][1].Move();
}
// set wave transparency
m_aWaveTime[0].SetAlpha(fAlphaWaveFull * fWaveCover);
m_aWaveTime[1].SetAlpha(fAlphaWaveFull * fWaveCover);
m_aWaveTime[2].SetAlpha(fAlphaWaveFull * fWaveCover);
// move wave
m_aWaveTime[0].Move();
m_aWaveTime[1].Move();
m_aWaveTime[2].Move();
//
m_SegmentName.SetAlpha(fAlphaSegmentFull * fSegmentCover);
m_SegmentBest.SetAlpha(fAlphaSegmentFull * fSegmentCover);
//
m_SegmentName.Move();
m_SegmentBest.Move();
//
m_aTurfBar[0].SetAlpha(fAlphaTurfFull);
m_aTurfBar[1].SetAlpha(fAlphaTurfFull);
m_aTurfBar[2].SetAlpha(fAlphaTurfFull);
m_TurfValue .SetAlpha(fAlphaTurfFull);
//
m_aTurfBar[0].Move();
m_aTurfBar[1].Move();
m_aTurfBar[2].Move();
m_TurfValue .Move();
constexpr coreFloat afDummyGoal[] = {100.0f, 200.0f, 300.0f, 400.0f, 500.0f};
const coreFloat* pfMedalGoal = bInGame ? g_pGame->GetCurMission()->GetMedalGoal() : afDummyGoal;
const coreFloat fTimeShifted = bInGame ? g_pGame->GetTimeTable ()->GetTimeShiftedSegmentSafe() : 0.0f;
if(pfMedalGoal && fTime && !m_iFakeEnd && (!bInGame || (iSegmentIndex != MISSION_NO_SEGMENT)))
{
const coreUint8 iNewMedal = cGame::CalcMedal(fTimeShifted, pfMedalGoal);
if(m_iGoalOld != iNewMedal) m_fGoalBump = 1.0f;
m_iGoalOld = iNewMedal;
cMenu::ApplyMedalTexture(&m_GoalMedal, iNewMedal, pBoss ? MEDAL_TYPE_BOSS : MEDAL_TYPE_WAVE, true);
m_GoalTime.SetText(PRINT("%03.0f", CEIL(cGame::CalcMedalTime(fTimeShifted, pfMedalGoal))));
m_fAlphaGoal = 1.0f;
}
else
{
m_iGoalOld = MEDAL_NONE;
m_fAlphaGoal.UpdateMax(-2.0f, 0.0f);
}
if(fTime && (!bInGame || (iSegmentIndex != MISSION_NO_SEGMENT)))
{
m_fGoalBump.UpdateMax(-4.0f, 0.0f);
m_GoalMedal.SetSize(coreVector2(1.0f,1.0f) * LERPBR(0.04f, 0.06f, m_fGoalBump));
const coreObject2D* pBase = pBoss ? &m_aBossTime[0] : &m_aWaveTime[0];
const coreVector2 vPos = coreVector2(-0.12f, pBase->GetPosition().y);
m_GoalTime .SetPosition(vPos);
m_GoalMedal.SetPosition(vPos + coreVector2(-0.06f,0.0f) - m_GoalMedal.GetAlignment() * (m_GoalMedal.GetSize() - coreVector2(0.04f, pBase->GetSize().y)) * 0.5f);
}
//
const coreFloat fAlphaGoalFull = MAX(fAlphaWaveFull * fWaveCover, fAlphaBossFull * fBossCover) * BLENDH3(m_fAlphaGoal);
m_GoalMedal.SetAlpha(fAlphaGoalFull);
m_GoalTime .SetAlpha(fAlphaGoalFull);
//
m_GoalMedal.Move();
m_GoalTime .Move();
const coreFloat fBanner2 = bInGame ? (g_pGame->GetTimeTable()->GetTimeEvent() - m_fBannerStart) : -1.0f;
if((m_iBannerType == INTERFACE_BANNER_TYPE_SCORE) && ((m_fBannerDuration - fBanner2) * m_fBannerSpeed >= 1.0f))
{
m_MissTime.RetrieveDesiredSize([this](const coreVector2 vSize)