-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02_cNevoMission_setup.cpp
3219 lines (2658 loc) · 137 KB
/
02_cNevoMission_setup.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"
// ****************************************************************
// setup the Nevo mission
void cNevoMission::__SetupOwn()
{
// ################################################################
//
STAGE_MAIN({TAKE_ALWAYS})
{
if(HAS_FLAG(g_pGame->GetStatus(), GAME_STATUS_QUICK))
{
STAGE_FINISH_NOW
}
else
{
STAGE_FINISH_AFTER(MISSION_WAIT_INTRO)
}
});
// ################################################################
// start
STAGE_MAIN({TAKE_ALWAYS})
{
g_pEnvironment->ChangeBackground(cSeaBackground::ID, ENVIRONMENT_MIX_CURTAIN, 1.0f, coreVector2(1.0f,0.0f));
g_pEnvironment->SetTargetDirectionNow(ENVIRONMENT_DEFAULT_DIRECTION);
g_pEnvironment->SetTargetSideNow (ENVIRONMENT_DEFAULT_SIDE);
g_pEnvironment->SetTargetSpeedNow (6.0f);
g_pGame->StartIntro();
STAGE_FINISH_NOW
});
// ################################################################
// change background appearance
STAGE_MAIN({TAKE_ALWAYS, 0u})
{
STAGE_FINISH_NOW
});
// ################################################################
// show mission name
STAGE_MAIN({TAKE_ALWAYS, 0u})
{
if(HAS_FLAG(g_pGame->GetStatus(), GAME_STATUS_NAMELESS))
{
STAGE_FINISH_NOW
}
else
{
if(STAGE_BEGINNING)
{
g_pGame->GetInterface()->ShowMission(this);
}
STAGE_FINISH_AFTER(MISSION_WAIT_PLAY)
}
});
// ################################################################
// wait for play
STAGE_MAIN({TAKE_ALWAYS, 0u})
{
STAGE_FINISH_PLAY
});
// ################################################################
// leave destroyable residue on its way (r-type leaver)
// - (old: enemies cannot move on the same path in infinity as the bullets would just overlay or need some handling)
// - multiple following enemies with the same move pattern will overlay after some time
// - in rotation groups, enemy spawn position and direction should create a whirl pattern
// - enemy start direction against whirl direction to not clutter the bullets and show the whirl effect better
// - destroying player bullets on impact felt bad (and is already used in snow stage)
// - changing enemy speed breaks the bullet pattern
// - following snake (consisting of multiple enemies) felt bad (and created enemy bullet issues)
// - don't use both sickle attacks at the same time at the end, otherwise the player will be squeezed
// - non-homing enemies have to form nice patterns
// - non-homing enemies should always move in such a way that they do not move with the current flow (to avoid bullet clustering)
// TASK: clean a certain amount ot residue
// TASK: 4 spheres hidden under bullets which need to be hit
// TASK EXTRA: guide one of the followers in circles
// ACHIEVEMENT: have at least 1500 bullets active at the same time
// COOP: each player can only destroy each bullet type
// TODO 1: hard-mode: bullets get bigger with time
// TODO 1: hard-mode: bullets are bigger in general
// TODO 1: homing and non-homing enemies need visual distinction (e.g. some kind of effect on top) (the final waves may confuse otherwise)
STAGE_MAIN({TAKE_ALWAYS, 0u})
{
constexpr coreFloat fRange = 1.25f;
STAGE_ADD_SQUAD(pSquad1, cMinerEnemy, 49u)
{
STAGE_FOREACH_ENEMY_ALL(pSquad1, pEnemy, i)
{
pEnemy->SetSize (coreVector3(1.0f,1.0f,1.0f) * 1.2f);
pEnemy->Configure(30, COLOR_SHIP_YELLOW);
pEnemy->AddStatus(ENEMY_STATUS_TOP | ENEMY_STATUS_DAMAGING);
});
const auto nSetFunc = [](cEnemy* OUTPUT pEnemy, const coreVector2 vPosition, const coreVector2 vDirection)
{
pEnemy->SetPosition (coreVector3(vPosition * FOREGROUND_AREA, 0.0f));
pEnemy->SetDirection(coreVector3(vDirection.Normalized(), 0.0f));
};
nSetFunc(pSquad1->GetEnemy( 0u), coreVector2(-1.3f, 0.9f), coreVector2( 1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy( 1u), coreVector2( 1.6f, 0.3f), coreVector2(-1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy( 2u), coreVector2(-1.9f,-0.3f), coreVector2( 1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy( 3u), coreVector2( 2.2f,-0.9f), coreVector2(-1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy( 4u), coreVector2( 1.3f, 0.9f) - coreVector2(-1.0f,-1.0f) * (0.9f/1.3f), coreVector2(-1.0f,-1.0f)); // shift-vectors not normalized
nSetFunc(pSquad1->GetEnemy( 5u), coreVector2(-1.3f, 0.3f) - coreVector2( 1.0f, 1.0f) * (0.0f/1.3f), coreVector2( 1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy( 6u), coreVector2( 1.3f,-0.3f) - coreVector2(-1.0f,-1.0f) * (0.6f/1.3f), coreVector2(-1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy( 7u), coreVector2(-1.3f,-0.9f) - coreVector2( 1.0f, 1.0f) * (0.3f/1.3f), coreVector2( 1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy( 8u), coreVector2(-0.9f,-2.2f), coreVector2( 0.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy( 9u), coreVector2(-0.3f,-1.9f), coreVector2( 0.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(10u), coreVector2( 0.3f,-1.6f), coreVector2( 0.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(11u), coreVector2( 0.9f,-1.3f), coreVector2( 0.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(12u), coreVector2(-0.9f,-1.3f), coreVector2(-1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(13u), coreVector2(-0.3f,-1.3f), coreVector2( 1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(14u), coreVector2( 0.3f,-1.3f), coreVector2(-1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(15u), coreVector2( 0.9f,-1.3f), coreVector2( 1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(16u), coreVector2(-0.9f, 1.3f), coreVector2( 0.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(17u), coreVector2(-0.3f, 1.3f), coreVector2( 0.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(18u), coreVector2( 0.3f, 1.3f), coreVector2( 0.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(19u), coreVector2( 0.9f, 1.3f), coreVector2( 0.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(20u), coreVector2( 1.3f,-0.9f) - coreVector2(-1.0f, 1.0f) * (0.0f/1.3f), coreVector2(-1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(21u), coreVector2( 1.3f,-0.3f) - coreVector2(-1.0f,-1.0f) * (0.3f/1.3f), coreVector2(-1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(22u), coreVector2( 1.3f, 0.3f) - coreVector2(-1.0f, 1.0f) * (0.6f/1.3f), coreVector2(-1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(23u), coreVector2( 1.3f, 0.9f) - coreVector2(-1.0f,-1.0f) * (0.9f/1.3f), coreVector2(-1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(24u), coreVector2(-0.8f, 1.3f), coreVector2( 0.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(25u), coreVector2( 0.8f,-1.3f), coreVector2( 0.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(26u), coreVector2(-1.3f, 0.0f), coreVector2( 1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(27u), coreVector2( 1.3f, 0.0f), coreVector2(-1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(28u), coreVector2(-1.3f,-0.8f), coreVector2( 1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy(29u), coreVector2( 0.0f, 1.3f), coreVector2( 1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(30u), coreVector2( 1.3f, 0.8f), coreVector2(-1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy(31u), coreVector2( 0.0f,-1.3f), coreVector2(-1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(32u), coreVector2( 0.0f,-1.3f), coreVector2( 0.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(33u), coreVector2( 0.8f, 1.3f), coreVector2( 0.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(34u), coreVector2(-0.8f,-1.3f), coreVector2( 0.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(35u), coreVector2( 1.3f, 0.0f), coreVector2(-1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(36u), coreVector2(-1.3f, 0.0f), coreVector2( 1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(37u), coreVector2(-1.3f, 0.8f), coreVector2( 1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy(38u), coreVector2( 0.0f,-1.3f), coreVector2( 1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(39u), coreVector2( 1.3f,-0.8f), coreVector2(-1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy(40u), coreVector2( 0.0f, 1.3f), coreVector2(-1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(41u), coreVector2( 1.3f, 0.0f), coreVector2(-1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy(42u), coreVector2(-1.3f, 0.0f), coreVector2( 1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy(43u), coreVector2( 1.5f, 0.0f), coreVector2(-1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy(44u), coreVector2(-1.5f, 0.0f), coreVector2( 1.0f, 0.0f));
nSetFunc(pSquad1->GetEnemy(45u), coreVector2( 1.3f, 1.3f), coreVector2(-1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(46u), coreVector2(-1.3f,-1.3f), coreVector2( 1.0f, 1.0f));
nSetFunc(pSquad1->GetEnemy(47u), coreVector2( 1.0f, 1.0f) * (1.3f + 0.2f / SQRT2), coreVector2(-1.0f,-1.0f));
nSetFunc(pSquad1->GetEnemy(48u), coreVector2(-1.0f,-1.0f) * (1.3f + 0.2f / SQRT2), coreVector2( 1.0f, 1.0f));
});
STAGE_GET_START(5u)
STAGE_GET_FLOAT(fWhirlSpeed)
STAGE_GET_FLOAT(fBackRota)
STAGE_GET_UINT (iCleanupCount)
STAGE_GET_UINT (iScrapCount)
STAGE_GET_UINT (iGuideCount)
STAGE_GET_END
if(STAGE_CLEARED)
{
if(STAGE_SUB( 1u)) STAGE_RESURRECT(pSquad1, 0u, 3u)
else if(STAGE_SUB( 2u)) STAGE_RESURRECT(pSquad1, 4u, 7u)
else if(STAGE_SUB( 3u)) STAGE_RESURRECT(pSquad1, 8u, 11u)
else if(STAGE_SUB( 4u)) STAGE_RESURRECT(pSquad1, 12u, 15u)
else if(STAGE_SUB( 5u)) STAGE_RESURRECT(pSquad1, 16u, 19u)
else if(STAGE_SUB( 6u)) STAGE_RESURRECT(pSquad1, 20u, 23u)
else if(STAGE_SUB( 7u)) STAGE_RESURRECT(pSquad1, 24u, 24u)
else if(STAGE_SUB( 8u)) STAGE_RESURRECT(pSquad1, 25u, 25u)
else if(STAGE_SUB( 9u)) STAGE_RESURRECT(pSquad1, 26u, 26u)
else if(STAGE_SUB(10u)) STAGE_RESURRECT(pSquad1, 27u, 27u)
else if(STAGE_SUB(11u)) STAGE_RESURRECT(pSquad1, 28u, 29u)
else if(STAGE_SUB(12u)) STAGE_RESURRECT(pSquad1, 30u, 31u)
else if(g_pGame->IsTaskExtra() && STAGE_SUB(13u)) STAGE_RESURRECT(pSquad1, 32u, 32u)
else if(STAGE_SUB(14u)) STAGE_RESURRECT(pSquad1, 33u, 33u)
else if(STAGE_SUB(15u)) STAGE_RESURRECT(pSquad1, 34u, 34u)
else if(STAGE_SUB(16u)) STAGE_RESURRECT(pSquad1, 35u, 35u)
else if(STAGE_SUB(17u)) STAGE_RESURRECT(pSquad1, 36u, 36u)
else if(STAGE_SUB(18u)) STAGE_RESURRECT(pSquad1, 37u, 38u)
else if(STAGE_SUB(19u)) STAGE_RESURRECT(pSquad1, 39u, 40u)
else if(STAGE_SUB(20u)) STAGE_RESURRECT(pSquad1, 41u, 44u)
else if(STAGE_SUB(21u)) STAGE_RESURRECT(pSquad1, 45u, 48u)
}
if(STAGE_BEGINNING)
{
constexpr coreUint8 aiNewOrder[] = {cTriangleBullet::ID, cQuadBullet::ID};
g_pGame->GetBulletManagerEnemy()->OverrideOrder(aiNewOrder, ARRAY_SIZE(aiNewOrder));
}
cHelper* pHelper = g_pGame->GetHelper(ELEMENT_CYAN);
if((m_iStageSub == 6u) && STAGE_BEGINNING2)
{
pHelper->Resurrect(false);
pHelper->SetPosition(coreVector3(-1.2f,0.0f,0.0f) * FOREGROUND_AREA3);
}
if(!pHelper->HasStatus(HELPER_STATUS_DEAD))
{
const coreVector2 vPos = pHelper->GetPosition().xy() + coreVector2(20.0f,0.0f) * TIME;
if(!g_pForeground->IsVisiblePoint(vPos / FOREGROUND_AREA, 1.2f)) pHelper->Kill(false);
pHelper->SetPosition(coreVector3(vPos, 0.0f));
}
const auto nCreatScrapFunc = [&](const coreUintW iIndex, const coreVector2 vPosition)
{
cEnemy* pDummy = pSquad1->GetEnemy(0u);
this->EnableScrap(iIndex, vPosition);
for(coreUintW i = 0u; i < 16u; ++i)
{
if((i == 0u) || (i == 3u) || (i == 12u) || (i == 15u)) continue;
const coreVector2 vPos = vPosition + coreVector2(I_TO_F(i % 4u) - 1.5f, I_TO_F(i / 4u) - 1.5f) * 4.0f;
const coreVector2 vDir = coreVector2(0.0f,1.0f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cQuadBullet>(5, 0.0f, pDummy, vPos, vDir)->AddStatus(BULLET_STATUS_IMMORTAL);
}
};
if(g_pGame->IsTask())
{
if((m_iStageSub == 3u) && STAGE_SUBTIME_POINT(3.0f))
{
nCreatScrapFunc(0u, coreVector2(0.9f,1.2f) * FOREGROUND_AREA);
}
else if((m_iStageSub == 5u) && STAGE_SUBTIME_POINT(5.0f))
{
nCreatScrapFunc(1u, coreVector2(1.2f,-0.9f) * FOREGROUND_AREA);
}
else if((m_iStageSub == 15u) && STAGE_BEGINNING2)
{
nCreatScrapFunc(2u, coreVector2(0.0f, 1.2f) * FOREGROUND_AREA);
nCreatScrapFunc(3u, coreVector2(0.0f,-1.2f) * FOREGROUND_AREA);
}
for(coreUintW i = 0u; i < NEVO_SCRAPS; ++i)
{
coreObject3D& oScrap = m_aScrap[i];
if(!oScrap.IsEnabled(CORE_OBJECT_ENABLE_MOVE)) continue;
if((m_afScrapTime[i] >= 6.0f) && !g_pForeground->IsVisibleObject(&oScrap))
{
this->DisableScrap(i, false);
}
// # delay by one frame
Core::Manager::Object->TestCollision(TYPE_BULLET_PLAYER, &oScrap, [&](const cBullet* pBullet, const coreObject3D* pScrap, const coreVector3 vIntersection, const coreBool bFirstHit)
{
if((i < 2u) && !g_pForeground->IsVisiblePoint(vIntersection.xy())) return;
if(!oScrap.IsEnabled(CORE_OBJECT_ENABLE_MOVE)) return;
d_cast<cPlayer*>(pBullet->GetOwner())->GetScoreTable()->RefreshCooldown();
this->DisableScrap(i, true);
if(++iScrapCount >= NEVO_SCRAPS)
{
STAGE_BADGE(1u, BADGE_NORMAL, oScrap.GetPosition())
}
else
{
g_pGame->GetCombatText()->DrawProgress(iScrapCount, NEVO_SCRAPS, oScrap.GetPosition());
g_pSpecialEffects->PlaySound(oScrap.GetPosition(), 1.0f, SPECIAL_SOUND_PROGRESS(iScrapCount, NEVO_SCRAPS), SOUND_ITEM_02);
}
g_pSpecialEffects->PlaySound(oScrap.GetPosition(), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_01);
});
}
}
STAGE_FOREACH_ENEMY(pSquad1, pEnemy, i)
{
if(i != 32u)
{
if((m_iStageSub == 3u) && (m_fStageSubTime < 2.0f)) return;
else if((m_iStageSub == 5u) && (m_fStageSubTime < 4.0f)) return;
else if((m_iStageSub == 7u) && (m_fStageSubTime < 2.0f)) return;
else if((m_iStageSub == 14u) && (fWhirlSpeed < 1.0f)) return;
}
STAGE_LIFETIME(pEnemy, 1.0f, 0.0f)
coreVector2 vCurPos = pEnemy->GetPosition ().xy();
coreVector2 vCurDir = pEnemy->GetDirection().xy();
const coreBool bFollow = (i >= 24u && i < 41u);
if(bFollow)
{
const coreVector2 vDiff = pEnemy->AimAtPlayerDual(vCurDir.IsAligned() ? 0u : 1u);
const coreFloat fSide = coreVector2::Dot(vDiff, vCurDir.Rotated90());
if((coreVector2::Dot(vDiff, vCurDir) <= 0.0f) && !coreMath::IsNear(fSide, 0.0f, 1.0f)) vCurDir = vCurDir.Rotated90() * SIGN(fSide);
if((vCurPos.x < -FOREGROUND_AREA.x * 1.1f) && (vCurDir.x < 0.0f)) {vCurPos.x -= 2.0f * (vCurPos.x + FOREGROUND_AREA.x * 1.1f); vCurDir.x = ABS(vCurDir.x);}
else if((vCurPos.x > FOREGROUND_AREA.x * 1.1f) && (vCurDir.x > 0.0f)) {vCurPos.x -= 2.0f * (vCurPos.x - FOREGROUND_AREA.x * 1.1f); vCurDir.x = -ABS(vCurDir.x);}
if((vCurPos.y < -FOREGROUND_AREA.y * 1.1f) && (vCurDir.y < 0.0f)) {vCurPos.y -= 2.0f * (vCurPos.y + FOREGROUND_AREA.y * 1.1f); vCurDir.y = ABS(vCurDir.y);}
else if((vCurPos.y > FOREGROUND_AREA.y * 1.1f) && (vCurDir.y > 0.0f)) {vCurPos.y -= 2.0f * (vCurPos.y - FOREGROUND_AREA.y * 1.1f); vCurDir.y = -ABS(vCurDir.y);}
}
else
{
if((vCurPos.x < -FOREGROUND_AREA.x * fRange) && (vCurDir.x < 0.0f)) vCurPos.x += FOREGROUND_AREA.x * fRange * 2.0f;
else if((vCurPos.x > FOREGROUND_AREA.x * fRange) && (vCurDir.x > 0.0f)) vCurPos.x -= FOREGROUND_AREA.x * fRange * 2.0f;
if((vCurPos.y < -FOREGROUND_AREA.y * fRange) && (vCurDir.y < 0.0f)) vCurPos.y += FOREGROUND_AREA.y * fRange * 2.0f;
else if((vCurPos.y > FOREGROUND_AREA.y * fRange) && (vCurDir.y > 0.0f)) vCurPos.y -= FOREGROUND_AREA.y * fRange * 2.0f;
}
const coreFloat fSpeed = (i == 32u) ? 1.5f : 1.0f;
pEnemy->SetPosition(coreVector3(vCurPos, 0.0f));
pEnemy->DefaultMoveForward(vCurDir, 29.0f * fSpeed);
if(STAGE_LIFETIME_BEFORE(10.0f) && STAGE_TICK_TIME2(9.0f * fSpeed, 0.0f))
{
const coreVector2 vPos = pEnemy->GetPosition ().xy();
const coreVector2 vDir = pEnemy->GetDirection().xy();
const coreVector2 vTan = vDir.Rotated90() * 2.0f;
if(g_pForeground->IsVisiblePoint(vPos, fRange))
{
if(vDir.IsAligned())
{
g_pGame->GetBulletManagerEnemy()->AddBullet<cQuadBullet> (5, 0.0f, pEnemy, vPos + vTan, vDir)->ChangeSize(1.1f)->AddStatus(BULLET_STATUS_IMMORTAL);
g_pGame->GetBulletManagerEnemy()->AddBullet<cQuadBullet> (5, 0.0f, pEnemy, vPos - vTan, vDir)->ChangeSize(1.1f)->AddStatus(BULLET_STATUS_IMMORTAL);
}
else
{
g_pGame->GetBulletManagerEnemy()->AddBullet<cTriangleBullet>(5, 0.0f, pEnemy, vPos + vTan, vDir)->ChangeSize(1.1f)->AddStatus(BULLET_STATUS_IMMORTAL);
g_pGame->GetBulletManagerEnemy()->AddBullet<cTriangleBullet>(5, 0.0f, pEnemy, vPos - vTan, vDir)->ChangeSize(1.1f)->AddStatus(BULLET_STATUS_IMMORTAL);
}
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_WEAPON_ENEMY);
}
}
if(g_pGame->IsTaskExtra() && (i == 32u))
{
if(STAGE_TAKEOFF) this->EnableGuide ();
if(pEnemy->ReachedDeath()) this->DisableGuide(true);
if(m_Guide.IsEnabled(CORE_OBJECT_ENABLE_MOVE))
{
const coreVector2 vDir = StepRotated90((iGuideCount + 1u) % 4u);
const coreVector2 vPos = pEnemy->GetPosition().xy() + vDir * 7.0f;
m_Guide.SetPosition (coreVector3(vPos, 0.0f));
m_Guide.SetDirection(coreVector3(vDir, 0.0f));
if(SameDirection(pEnemy->GetDirection().xy(), vDir))
{
if(++iGuideCount >= 6u)
{
this->DisableGuide(true);
STAGE_BADGE(2u, BADGE_HARD, pEnemy->GetPosition())
}
}
}
}
});
if((m_iStageSub >= 3u) && (m_iStageSub < 8u))
{
constexpr coreVector4 avFlow[] = {coreVector4(0.0f,0.0f,0.0f,0.0f), coreVector4(0.0f,-20.0f,0.0f,-10.0f), coreVector4(-20.0f,0.0f,20.0f,0.0f)};
const coreFloat fChange = m_fStageSubTime * 0.5f;
coreVector4 vLerp;
if(m_iStageSub == 3u) vLerp = LERPS(avFlow[0], avFlow[1], MIN1(fChange));
else if(m_iStageSub == 4u) vLerp = avFlow[1];
else if(m_iStageSub == 5u) vLerp = (fChange < 1.0f) ? LERPS(avFlow[1], avFlow[0], MIN1(fChange)) : LERPS(avFlow[0], avFlow[2], MIN1(fChange - 1.0f));
else if(m_iStageSub == 6u) vLerp = avFlow[2];
else if(m_iStageSub == 7u) vLerp = LERPS(avFlow[2], avFlow[0], MIN1(fChange));
else UNREACHABLE
const coreVector2 vMove1 = vLerp.xy() * TIME;
const coreVector2 vMove2 = vLerp.zw() * TIME;
const auto nRewindFunc = [](cBullet* OUTPUT pBullet)
{
coreVector2 vNewPos = pBullet->GetPosition().xy();
if(vNewPos.x < -FOREGROUND_AREA.x * fRange) vNewPos.x += FOREGROUND_AREA.x * fRange * 2.0f;
else if(vNewPos.x > FOREGROUND_AREA.x * fRange) vNewPos.x -= FOREGROUND_AREA.x * fRange * 2.0f;
if(vNewPos.y < -FOREGROUND_AREA.y * fRange) vNewPos.y += FOREGROUND_AREA.y * fRange * 2.0f;
else if(vNewPos.y > FOREGROUND_AREA.y * fRange) vNewPos.y -= FOREGROUND_AREA.y * fRange * 2.0f;
pBullet->SetPosition(coreVector3(vNewPos, 0.0f));
};
g_pGame->GetBulletManagerEnemy()->ForEachBulletTyped<cQuadBullet>([&](cQuadBullet* OUTPUT pBullet)
{
pBullet->SetPosition(coreVector3(pBullet->GetPosition().xy() + vMove1, 0.0f));
nRewindFunc(pBullet);
});
g_pGame->GetBulletManagerEnemy()->ForEachBulletTyped<cTriangleBullet>([&](cTriangleBullet* OUTPUT pBullet)
{
pBullet->SetPosition(coreVector3(pBullet->GetPosition().xy() + vMove2, 0.0f));
nRewindFunc(pBullet);
});
for(coreUintW i = 0u; i < NEVO_SCRAPS; ++i)
{
coreObject3D& oScrap = m_aScrap[i];
if(!oScrap.IsEnabled(CORE_OBJECT_ENABLE_MOVE)) continue;
oScrap.SetPosition(coreVector3(oScrap.GetPosition().xy() + vMove1, 0.0f));
}
}
else if(m_iStageSub >= 14u)
{
fWhirlSpeed = MIN1(fWhirlSpeed + 0.3f * TIME);
const coreMatrix2 mRota = coreMatrix3::Rotation(LERPS(0.0f, 0.7f, fWhirlSpeed) * TIME).m12();
const coreMatrix2 mRotaRev = mRota.Transposed();
g_pGame->GetBulletManagerEnemy()->ForEachBulletTyped<cQuadBullet>([&](cQuadBullet* OUTPUT pBullet)
{
pBullet->SetPosition(coreVector3(pBullet->GetPosition().xy() * mRotaRev, 0.0f));
});
g_pGame->GetBulletManagerEnemy()->ForEachBulletTyped<cTriangleBullet>([&](cTriangleBullet* OUTPUT pBullet)
{
pBullet->SetPosition(coreVector3(pBullet->GetPosition().xy() * mRota, 0.0f));
});
for(coreUintW i = 0u; i < NEVO_SCRAPS; ++i)
{
coreObject3D& oScrap = m_aScrap[i];
if(!oScrap.IsEnabled(CORE_OBJECT_ENABLE_MOVE)) continue;
oScrap.SetPosition(coreVector3(oScrap.GetPosition().xy() * mRotaRev, 0.0f));
}
}
STAGE_COLL_BULLET_BULLET(pBulletPlayer, pBulletEnemy, vIntersection, bFirstHit, COLL_REF(iCleanupCount))
{
if(g_pGame->IsCoop())
{
if((pBulletPlayer->GetOwner() == g_pGame->GetPlayer(0u)) && (pBulletEnemy->GetID() != cQuadBullet ::ID)) return;
else if((pBulletPlayer->GetOwner() == g_pGame->GetPlayer(1u)) && (pBulletEnemy->GetID() != cTriangleBullet::ID)) return;
}
pBulletEnemy->Deactivate(true, vIntersection.xy(), pBulletPlayer->GetFlyDir());
g_pGame->PlayVanishSound(pBulletEnemy->GetPosition());
iCleanupCount += 1u;
});
if(g_pGame->IsEasy())
{
g_pGame->GetBulletManagerEnemy()->ForEachBullet([](cBullet* OUTPUT pBullet)
{
if(pBullet->GetFlyTime() >= 10.0f) pBullet->Deactivate(true);
});
}
const coreUintW iCount = g_pGame->GetBulletManagerEnemy()->GetNumBulletsTypedEst<cQuadBullet>() + g_pGame->GetBulletManagerEnemy()->GetNumBulletsTypedEst<cTriangleBullet>();
if(iCount > 1500u) // to prevent infinite creation
{
g_pGame->GetBulletManagerEnemy()->ForEachBullet([](cBullet* OUTPUT pBullet)
{
if(pBullet->GetFlyTime() >= 20.0f) pBullet->Deactivate(true);
});
STAGE_BADGE(3u, BADGE_ACHIEVEMENT, g_pGame->FindPlayerDual(0u)->GetPosition())
}
if(g_pGame->IsTask() && !STAGE_CLEARED)
{
const coreFloat fPercent = I_TO_F(iCleanupCount) * (1.0f / (g_pGame->IsEasy() ? 1350.0f : 1550.0f));
if(fPercent >= 1.0f) STAGE_BADGE(0u, BADGE_EASY, coreVector3(0.0f,0.0f,0.0f))
else if(fPercent >= 0.01f) g_pGame->GetCombatText()->AttachMarker(0u, PRINT("%.0f%%", FLOOR(fPercent * 100.0f)), coreVector3(0.0f,0.0f,0.0f), COLOR_MENU_INSIDE, true);
}
if(m_iStageSub >= 14u)
{
fBackRota = MIN1(fBackRota + 0.04f * TIME);
g_pEnvironment->SetTargetDirectionNow(coreVector2::Direction(BLENDS(fBackRota) * (-2.0f*PI)));
}
STAGE_WAVE(0u, "2-1", {50.0f, 75.0f, 100.0f, 125.0f, 250.0f}) // SIEBEN
},
STAGE_PRE()
{
g_pGame->GetEnemyManager()->PrefetchEnemy<cMinerEnemy>();
g_pGame->GetBulletManagerEnemy()->PrefetchBullet<cTriangleBullet>();
g_pGame->GetBulletManagerEnemy()->PrefetchBullet<cQuadBullet>();
});
// ################################################################
// reset helper
STAGE_MAIN({TAKE_ALWAYS, 0u})
{
g_pGame->KillHelpers();
g_pGame->GetBulletManagerEnemy()->ResetOrder();
for(coreUintW i = 0u; i < NEVO_SCRAPS; ++i)
this->DisableScrap(i, false);
this->DisableGuide(false);
STAGE_FINISH_NOW
});
// ################################################################
// change background appearance
STAGE_MAIN({TAKE_ALWAYS, 1u})
{
g_pEnvironment->SetTargetDirection(ENVIRONMENT_DEFAULT_DIRECTION, 1.0f);
STAGE_FINISH_NOW
});
// ################################################################
// wait for play
STAGE_MAIN({TAKE_ALWAYS, 1u})
{
STAGE_FINISH_PLAY
});
// ################################################################
// switch everything on
// - in gauntlet, in last sub-pattern, some tiles are already marked, as otherwise it would be too easy to activate all
// - in gauntlet, for coop, make sure tiles are equally distributed
// - blending in tiles needs to be equally delayed, to not favor certain start-positions
// - enemies need to die fast after loosing invincibility
// - rotating grid should not be too fast, as back-and-forth flipping can easily happen, and player needs to be able to move with rotation (faster than rotation)
// TASK: kill all unprotected enemies before protection wears off
// TASK: activate some plates in a certain order
// TASK EXTRA: enable a list of tiles in a very short time
// ACHIEVEMENT: never touch a plate twice in the spinning puzzle
// TODO 1: hardmode: flipswitch galaxy, || =, with blink delay like the red + blue blocks from Mario 3D World (note: lasers could be similar to bombs in the final boss)
// TODO 1: hardmode: flipswitch galaxy: blocking tiles moving around, lasers blocking movement between tiles
STAGE_MAIN({TAKE_ALWAYS, 1u})
{
constexpr coreUintW iSingleIndex = 60u;
STAGE_ADD_PATH(pPath1)
{
pPath1->Reserve(2u);
pPath1->AddNode(coreVector2(-0.8f, 1.3f), coreVector2(1.6f,-2.4f).Normalized());
pPath1->AddNode(coreVector2( 0.8f,-1.3f), coreVector2(1.6f,-2.4f).Normalized());
pPath1->Refine();
});
STAGE_ADD_SQUAD(pSquad1, cArrowEnemy, 61u)
{
STAGE_FOREACH_ENEMY_ALL(pSquad1, pEnemy, i)
{
pEnemy->SetSize (coreVector3(1.0f,1.0f,1.0f) * 1.3f);
pEnemy->Configure(4, COLOR_SHIP_GREY);
pEnemy->AddStatus(ENEMY_STATUS_INVINCIBLE);
});
});
STAGE_GET_START(11u + GAME_PLAYERS)
STAGE_GET_UINT (iTileState)
STAGE_GET_UINT (iTileDone)
STAGE_GET_UINT (iTileWait)
STAGE_GET_UINT (iTileScore)
STAGE_GET_FLOAT (fTileMove)
STAGE_GET_FLOAT (fTimeLimit, fTimeLimit = 4.0f)
STAGE_GET_FLOAT (fBackRota)
STAGE_GET_UINT (iGauntlet)
STAGE_GET_UINT (iFreeCount)
STAGE_GET_UINT (iCurOrder)
STAGE_GET_UINT (iSingleTouch)
STAGE_GET_UINT_ARRAY(aiRemember, GAME_PLAYERS)
STAGE_GET_END
if(STAGE_CLEARED)
{
if(STAGE_SUB(1u)) STAGE_RESURRECT(pSquad1, 0u, 9u)
else if(STAGE_SUB(2u)) STAGE_RESURRECT(pSquad1, 10u, 19u)
else if(STAGE_SUB(3u)) STAGE_RESURRECT(pSquad1, 20u, 29u)
else if(STAGE_SUB(4u)) STAGE_RESURRECT(pSquad1, 30u, 39u)
else if(STAGE_SUB(5u)) STAGE_RESURRECT(pSquad1, 40u, 49u)
else if(STAGE_SUB(6u)) STAGE_RESURRECT(pSquad1, 60u, 60u) // #
else if(STAGE_SUB(7u)) STAGE_RESURRECT(pSquad1, 50u, 59u)
for(coreUintW i = 0u; i < NEVO_TILES; ++i)
this->DisableTile(i, true);
iTileWait = 0u;
iGauntlet = 0u;
}
cHelper* pHelper = g_pGame->GetHelper(ELEMENT_YELLOW);
if(!pHelper->HasStatus(HELPER_STATUS_DEAD))
{
const coreVector2 vPos = pHelper->GetPosition().xy() + coreVector2(26.0f,13.0f) * (1.0f + pHelper->GetLifeTime()) * TIME;
if(!g_pForeground->IsVisiblePoint(vPos / FOREGROUND_AREA, 1.2f)) pHelper->Kill(false);
pHelper->SetPosition(coreVector3(vPos, 0.0f));
}
if(!iTileWait)
{
if(!m_aTileRaw[0].IsEnabled(CORE_OBJECT_ENABLE_ALL))
{
STATIC_ASSERT(NEVO_TILES >= 16u)
if(m_iStageSub == 1u)
{
for(coreUintW i = 0u; i < 4u; ++i)
this->EnableTile(i, 3u);
const coreVector2 vPos = FOREGROUND_AREA * 2.2f / 4.0f;
m_aTileRaw[0].SetPosition(coreVector3( vPos, 0.0f));
m_aTileRaw[1].SetPosition(coreVector3( vPos.Rotated90(), 0.0f));
m_aTileRaw[2].SetPosition(coreVector3(-vPos, 0.0f));
m_aTileRaw[3].SetPosition(coreVector3(-vPos.Rotated90(), 0.0f));
}
else if(m_iStageSub == 2u)
{
for(coreUintW i = 0u; i < 9u; ++i)
this->EnableTile(i, 3u);
}
else if(m_iStageSub == 3u)
{
for(coreUintW i = 0u; i < 16u; ++i)
this->EnableTile(i, 4u);
}
else if(m_iStageSub == 4u)
{
for(coreUintW i = 0u; i < 12u; ++i)
this->EnableTile(i, 3u);
}
else if(m_iStageSub == 5u)
{
for(coreUintW i = 0u; i < 16u; ++i)
this->EnableTile(i, 4u);
}
else if(m_iStageSub == 6u)
{
if(!iGauntlet) iGauntlet = 1u;
}
else if(m_iStageSub == 7u)
{
if(!iGauntlet) iGauntlet = 1u;
}
iTileState = (m_iStageSub == 5u) ? 0b0100'0001'1000'0010u : 0u;
iTileDone = 0u;
iTileWait = 1u;
iTileScore = 0u;
std::memset(aiRemember, 0, sizeof(coreUint32) * GAME_PLAYERS);
STATIC_ASSERT(NEVO_TILES <= sizeof(coreUint32)*8u)
}
}
else
{
if(m_iStageSub == 4u)
{
for(coreUintW i = 0u; i < 12u; ++i)
{
const coreFloat fMove = (((i % 3u) == 1u) ? -1.0f : 1.0f) * 12.0f * TIME;
coreVector2 vNewPos = m_aTileRaw[i].GetPosition().xy() + coreVector2(0.0f, fMove);
if(vNewPos.y < -FOREGROUND_AREA.y * 1.1f * (4.0f/3.0f)) vNewPos.y += FOREGROUND_AREA.y * 2.2f * (4.0f/3.0f);
else if(vNewPos.y > FOREGROUND_AREA.y * 1.1f * (4.0f/3.0f)) vNewPos.y -= FOREGROUND_AREA.y * 2.2f * (4.0f/3.0f);
m_aTileRaw[i].SetPosition(coreVector3(vNewPos, 0.0f));
}
}
else if(m_iStageSub == 5u)
{
const coreMatrix2 mRota = coreMatrix3::Rotation(0.4f * TIME).m12();
for(coreUintW i = 0u; i < 16u; ++i)
{
m_aTileRaw[i].SetPosition (coreVector3( m_aTileRaw[i].GetPosition ().xy() * mRota, 0.0f));
m_aTileRaw[i].SetDirection(coreVector3((m_aTileRaw[i].GetDirection().xy() * mRota).Normalized(), 0.0f));
}
}
}
coreBool bPostpone = false;
if(iGauntlet)
{
if(m_iStageSub == 6u)
{
if(iGauntlet % 2u)
{
constexpr coreUintW aiIndex[] = {5u, 6u, 9u, 10u};
constexpr coreUintW aiOrder[] = {2u, 1u, 0u, 3u, 1u, 2u, 1u, 2u, 3u, 0u};
const coreUintW iNum = iGauntlet / 2u;
if(iNum < ARRAY_SIZE(aiOrder))
{
this->DisableTile(aiIndex[aiOrder[iNum]], false);
this->EnableTile (aiIndex[aiOrder[iNum]], 4u);
iGauntlet += 1u;
}
else
{
if(g_pGame->IsTaskExtra()) STAGE_BADGE(2u, BADGE_HARD, coreVector3(0.0f,0.0f,0.0f))
pSquad1->GetEnemy(iSingleIndex)->Kill(false);
bPostpone = true;
}
}
fTimeLimit -= 1.0f * TIME;
if(fTimeLimit < 0.0f)
{
pSquad1->GetEnemy(iSingleIndex)->Kill(false);
bPostpone = true;
}
g_pGame->GetCombatText()->AttachMarker(0u, PRINT("%.0f", CEIL(MAX0(fTimeLimit))), coreVector3(0.0f,0.0f,0.0f), COLOR_MENU_INSIDE, false);
}
else if(m_iStageSub == 7u)
{
if(iGauntlet == 1u)
{
this->EnableTile(2u, 4u);
iGauntlet += 1u;
}
else if(iGauntlet == 3u)
{
this->EnableTile(8u, 4u);
this->EnableTile(14u, 4u);
iGauntlet += 1u;
}
else if(iGauntlet == 5u)
{
this->EnableTile(0u, 4u);
this->EnableTile(1u, 4u);
fTileMove = 0.0f;
iGauntlet += 1u;
pHelper->Resurrect(true);
pHelper->SetPosition(m_aTileRaw[14].GetPosition());
g_pSpecialEffects->CreateSplashColor(pHelper->GetPosition(), 25.0f, 5u, COLOR_ENERGY_YELLOW);
}
else if(iGauntlet == 6u)
{
fTileMove += 0.6f * TIME;
m_aTileRaw[0].SetPosition(coreVector3(LERPS(coreVector2(-0.25f,0.75f), coreVector2(-0.25f,-0.75f), fTileMove) * (FOREGROUND_AREA * 1.1f), 0.0f));
m_aTileRaw[1].SetPosition(coreVector3(LERPS(coreVector2( 0.75f,0.25f), coreVector2(-0.75f, 0.25f), fTileMove) * (FOREGROUND_AREA * 1.1f), 0.0f));
}
else if(iGauntlet == 7u)
{
this->EnableTile(14u, 4u);
this->EnableTile(15u, 4u);
this->EnableTile(16u, 4u);
m_aTileRaw[14].SetPosition(coreVector3(HIDDEN_POS, 0.0f));
m_aTileRaw[15].SetPosition(coreVector3(HIDDEN_POS, 0.0f));
m_aTileRaw[16].SetPosition(coreVector3(HIDDEN_POS, 0.0f));
fTileMove = 0.0f;
iGauntlet += 1u;
}
else if(iGauntlet == 8u)
{
fTileMove += 1.0f * TIME;
const coreVector2 vPos = coreVector2::Direction(fTileMove);
const coreVector2 vDir = coreVector2::Direction(fTileMove * -2.0f);
m_aTileRaw[14].SetPosition(coreVector3((vPos * (FOREGROUND_AREA * 0.5f)), 0.0f));
m_aTileRaw[15].SetPosition(coreVector3((vPos * (FOREGROUND_AREA * 0.5f)).Rotated60 () * -1.0f, 0.0f));
m_aTileRaw[16].SetPosition(coreVector3((vPos * (FOREGROUND_AREA * 0.5f)).Rotated120(), 0.0f));
m_aTileRaw[14].SetDirection(coreVector3(vDir, 0.0f));
m_aTileRaw[15].SetDirection(coreVector3(vDir, 0.0f));
m_aTileRaw[16].SetDirection(coreVector3(vDir, 0.0f));
}
else if(iGauntlet == 9u)
{
for(coreUintW i = 0u; i < 13u; ++i)
this->EnableTile(i, 3u);
const coreFloat fScale = ABS(m_aTileRaw[0].GetPosition().x);
m_aTileRaw[ 9].SetPosition(coreVector3(-0.5f,-0.5f,0.0f) * fScale);
m_aTileRaw[10].SetPosition(coreVector3( 0.5f,-0.5f,0.0f) * fScale);
m_aTileRaw[11].SetPosition(coreVector3(-0.5f, 0.5f,0.0f) * fScale);
m_aTileRaw[12].SetPosition(coreVector3( 0.5f, 0.5f,0.0f) * fScale);
iTileState = 0b0000'010'111'010u;
iGauntlet = 100u;
}
}
}
const coreUint32 iTileStateOld = iTileState; // after initializing state
coreBool bComplete = !iTileDone;
if(!iTileDone)
{
for(coreUintW i = 0u; i < NEVO_TILES; ++i)
{
const coreObject3D& oTile = m_aTileRaw[i];
if(!this->IsTileEnabled(i)) continue;
STAGE_FOREACH_PLAYER(pPlayer, j)
{
if(pPlayer->IsRolling()) return;
const coreVector2 vDiff = MapToAxisInv(pPlayer->GetPosition().xy() - oTile.GetPosition().xy(), oTile.GetDirection().xy());
if((ABS(vDiff.x) < oTile.GetCollisionRange().x) &&
(ABS(vDiff.y) < oTile.GetCollisionRange().y))
{
if(!HAS_BIT(aiRemember[j], i)) TOGGLE_BIT(iTileState, i)
ADD_BIT(aiRemember[j], i)
if(HAS_BIT(iTileState, i) && !HAS_BIT(iTileScore, i))
{
ADD_BIT(iTileScore, i)
this->AddExtraScore(pPlayer, 100u, oTile.GetPosition());
}
}
else
{
REMOVE_BIT(aiRemember[j], i)
}
});
if(HAS_BIT(iTileState, i))
{
this->SetTileStyle(i, 1u);
if(!HAS_BIT(iTileStateOld, i)) g_pSpecialEffects->PlaySound(oTile.GetPosition(), 1.0f, 1.0f, SOUND_EFFECT_CLICK);
}
else
{
this->SetTileStyle(i, 0u);
bComplete = false;
if(HAS_BIT(iTileStateOld, i)) g_pSpecialEffects->PlaySound(oTile.GetPosition(), 1.0f, 0.9f, SOUND_EFFECT_CLICK);
}
}
if(g_pGame->IsTask() && (m_iStageSub == 3u))
{
constexpr coreUintW aiOrder[] = {1u, 7u, 10u, 12u};
for(coreUintW i = 0u; i < NEVO_TILES; ++i)
{
const coreObject3D& oTile = m_aTileRaw[i];
if(!this->IsTileEnabled(i)) continue;
const coreUintW iIndex = std::find(aiOrder, aiOrder + ARRAY_SIZE(aiOrder), i) - aiOrder;
if((iIndex >= iCurOrder) && (iIndex < ARRAY_SIZE(aiOrder)))
{
g_pGame->GetCombatText()->AttachMarker(iIndex + 1u, coreData::ToChars(iIndex + 1u), oTile.GetPosition(), COLOR_MENU_INSIDE, false);
if(HAS_BIT(iTileState, i) != HAS_BIT(iTileStateOld, i))
{
if(iIndex == iCurOrder)
{
if(++iCurOrder >= ARRAY_SIZE(aiOrder))
{
STAGE_BADGE(1u, BADGE_NORMAL, oTile.GetPosition())
}
else
{
g_pSpecialEffects->PlaySound(oTile.GetPosition(), 1.0f, SPECIAL_SOUND_PROGRESS(iCurOrder, ARRAY_SIZE(aiOrder)), SOUND_ITEM_01);
}
}
else if((iIndex > iCurOrder) && STAGE_SUBTIME_AFTER(2.0f / NEVO_TILE_SPEED))
{
iCurOrder = UINT32_MAX;
}
}
}
}
}
if(m_iStageSub == 5u)
{
if(iTileStateOld > iTileState)
{
iSingleTouch = 1u;
STAGE_FAILTROPHY
}
if(bComplete && !iSingleTouch) STAGE_BADGE(3u, BADGE_ACHIEVEMENT, g_pGame->FindPlayerDual(0u)->GetPosition())
}
}
if(bComplete)
{
if(iGauntlet && (iGauntlet < 100u))
{
for(coreUintW i = 0u; i < NEVO_TILES; ++i)
this->DisableTile(i, true);
iTileState = 0u;
iTileScore = 0u;
iGauntlet += 1u;
bComplete = false;
}
else
{
for(coreUintW i = 0u; i < NEVO_TILES; ++i)
this->SetTileStyle(i, 2u);
if(!STAGE_CLEARED) g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
}
}
if(bComplete) iTileDone = 1u;
STAGE_FOREACH_ENEMY(pSquad1, pEnemy, i)
{
if(i == iSingleIndex)
{
pEnemy->SetPosition(coreVector3(HIDDEN_POS, 0.0f));
return;
}
STAGE_LIFETIME(pEnemy, 0.8f, 0.2f * I_TO_F(i % 5u) + (((i % 10u) < 5u) ? 0.0f : (0.5f * pPath1->GetTotalDistance())))
STAGE_REPEAT(pPath1->GetTotalDistance())
const coreVector2 vFactor = coreVector2(((i % 10u) < 5u) ? 1.0f : -1.0f, ((i % 30u) < 20u) ? 1.0f : -1.0f);
const coreVector2 vOffset = coreVector2(0.0f,0.0f);
pEnemy->DefaultMovePath(pPath1, vFactor, vOffset * vFactor, fLifeTime);
if(i >= 10u && i < 15u) pEnemy->Rotate90 ();
else if(i >= 15u && i < 20u) pEnemy->Rotate270();
else if(i >= 40u && i < 45u) pEnemy->Rotate90 ();
else if(i >= 45u && i < 50u) pEnemy->Rotate270();
if(!(i % 5u) && STAGE_TICK_TIME2(0.8f * (g_pGame->IsEasy() ? 0.7f : 1.0f), 0.0f))
{
const coreVector2 vPos = pEnemy->GetPosition ().xy();
const coreFloat fBase = pEnemy->GetDirection().xy().Rotated90().Angle();
const coreUintW iNum = g_pGame->IsEasy() ? 3u : 7u;
for(coreUintW j = iNum; j--; )
{
const coreVector2 vDir = coreVector2::Direction(DEG_TO_RAD((I_TO_F(j) - I_TO_F(iNum - 1u) * 0.5f) * 5.3f) + fBase);
g_pGame->GetBulletManagerEnemy()->AddBullet<cFlipBullet>(5, 0.5f, pEnemy, vPos, vDir)->ChangeSize(1.5f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cFlipBullet>(5, 0.5f, pEnemy, vPos, -vDir)->ChangeSize(1.5f);
}
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), 25.0f, 5u, COLOR_ENERGY_PURPLE);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_WEAPON_ENEMY);
}
if(g_pGame->IsTask())
{
constexpr coreUint8 aiFree[] = {4u, 11u, 18u, 37u, 53u, 56u};