-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_cViridoMission_setup.cpp
2970 lines (2503 loc) · 142 KB
/
01_cViridoMission_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 Virido mission
void cViridoMission::__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(cGrassBackground::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, 1u})
{
cGrassBackground* pBackground = d_cast<cGrassBackground*>(g_pEnvironment->GetBackground());
pBackground->SetCoverAlpha(1.0f);
pBackground->SetGroundDensity(0u, 0.0f);
pBackground->SetGroundDensity(1u, 0.0f);
pBackground->SetGroundDensity(2u, 0.0f);
pBackground->SetGroundDensity(3u, 0.0f);
pBackground->SetDecalDensity (0u, 0.0f);
pBackground->SetAirDensity (2u, 1.0f);
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
});
// ################################################################
// shields on sides to force attacks from certain directions
// - player position after killing enemies (based on their shield position) needs to be considered when spawning next wave
// - first long shields need to push 50% of the area, to remove safe-spots
// - long side-moving pattern needs to start at corners, one up one down, to prevent easy corner killing
// - barrier indices are all manual, to control render order
// TASK: destroy all marked shields
// TASK: kill enemy with reflected bullet
// ACHIEVEMENT: reflect a single bullet at least 20 times
// TODO 1: hard mode: reflected bullets cause damage
// TODO 1: drum shield needs blink!
STAGE_MAIN({TAKE_ALWAYS, 0u})
{
constexpr coreFloat fWidth = 0.38f;
constexpr coreUintW iReflectSize = 128u;
constexpr coreUintW iReflectWrap = iReflectSize / 2u * sizeof(coreUint32);
STAGE_ADD_PATH(pPath1)
{
pPath1->Reserve(2u);
pPath1->AddNode(coreVector2(0.0f,1.4f), coreVector2(0.0f,-1.0f));
pPath1->AddStop(coreVector2(0.0f,0.5f), coreVector2(0.0f,-1.0f));
pPath1->Refine();
});
STAGE_ADD_PATH(pPath2)
{
pPath2->Reserve(2u);
pPath2->AddNode(coreVector2(0.0f, 1.5f + fWidth * 1.0f), coreVector2(0.0f,-1.0f));
pPath2->AddStop(coreVector2(0.0f, 0.0f + fWidth * 0.5f), coreVector2(0.0f,-1.0f));
pPath2->Refine();
});
STAGE_ADD_PATH(pPath3)
{
pPath3->Reserve(2u);
pPath3->AddNode(coreVector2(0.0f, 1.4f), coreVector2(0.0f,-1.0f));
pPath3->AddNode(coreVector2(0.0f,-1.4f), coreVector2(0.0f,-1.0f));
pPath3->Refine();
});
STAGE_ADD_SQUAD(pSquad1, cMinerEnemy, 52u)
{
STAGE_FOREACH_ENEMY_ALL(pSquad1, pEnemy, i)
{
pEnemy->SetSize (coreVector3(1.0f,1.0f,1.0f) * 1.2f);
pEnemy->Configure(10, COLOR_SHIP_CYAN);
});
});
STAGE_GET_START(3u + iReflectSize)
STAGE_GET_VEC2 (vHelperMove)
STAGE_GET_UINT (iDrumNum)
STAGE_GET_UINT_ARRAY(aiReflect, iReflectSize)
STAGE_GET_END
for(coreUintW i = 0u; i < VIRIDO_BARRIERS; ++i)
{
if(m_apBarrierOwner[i] && m_apBarrierOwner[i]->HasStatus(ENEMY_STATUS_DEAD))
this->DisableBarrier(i, true);
}
if(STAGE_CLEARED)
{
if(STAGE_SUB(1u))
{
STAGE_RESURRECT(pSquad1, 0u, 1u)
this->EnableBarrier( 0u, pSquad1->GetEnemy( 0u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 1u, pSquad1->GetEnemy( 0u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier( 2u, pSquad1->GetEnemy( 1u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 3u, pSquad1->GetEnemy( 1u), coreVector2( 0.0f,-1.0f), 1.0f);
}
else if(STAGE_SUB(2u))
{
STAGE_RESURRECT(pSquad1, 2u, 7u)
this->EnableBarrier( 4u, pSquad1->GetEnemy( 2u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 5u, pSquad1->GetEnemy( 3u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 6u, pSquad1->GetEnemy( 4u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 7u, pSquad1->GetEnemy( 5u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 8u, pSquad1->GetEnemy( 6u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 9u, pSquad1->GetEnemy( 7u), coreVector2( 0.0f, 1.0f), 1.0f);
if(g_pGame->IsTask()) this->StartDrumBeat(0u, 9u);
}
else if(STAGE_SUB(3u))
{
STAGE_RESURRECT(pSquad1, 8u, 13u)
this->EnableBarrier(10u, pSquad1->GetEnemy( 8u), coreVector2( 1.0f, 0.0f).Rotated90(), 1.0f);
this->EnableBarrier(11u, pSquad1->GetEnemy( 8u), coreVector2(-1.0f, 0.0f).Rotated90(), 1.0f);
this->EnableBarrier(12u, pSquad1->GetEnemy( 9u), coreVector2( 1.0f, 0.0f), 1.0f);
this->EnableBarrier(13u, pSquad1->GetEnemy( 9u), coreVector2(-1.0f, 0.0f), 1.0f);
this->EnableBarrier(14u, pSquad1->GetEnemy(10u), coreVector2( 1.0f, 0.0f).Rotated90(), 1.0f);
this->EnableBarrier(15u, pSquad1->GetEnemy(10u), coreVector2(-1.0f, 0.0f).Rotated90(), 1.0f);
this->EnableBarrier(16u, pSquad1->GetEnemy(11u), coreVector2( 1.0f, 0.0f).Rotated90(), 1.0f);
this->EnableBarrier(17u, pSquad1->GetEnemy(11u), coreVector2(-1.0f, 0.0f).Rotated90(), 1.0f);
this->EnableBarrier(18u, pSquad1->GetEnemy(12u), coreVector2( 1.0f, 0.0f), 1.0f);
this->EnableBarrier(19u, pSquad1->GetEnemy(12u), coreVector2(-1.0f, 0.0f), 1.0f);
this->EnableBarrier(20u, pSquad1->GetEnemy(13u), coreVector2( 1.0f, 0.0f).Rotated90(), 1.0f);
this->EnableBarrier(21u, pSquad1->GetEnemy(13u), coreVector2(-1.0f, 0.0f).Rotated90(), 1.0f);
if(g_pGame->IsTask()) this->StartDrumBeat(1u, 16u);
}
else if(STAGE_SUB(4u))
{
STAGE_RESURRECT(pSquad1, 14u, 17u)
this->EnableBarrier(24u, pSquad1->GetEnemy(14u), coreVector2( 0.0f, 1.0f), 3.0f); // only first two on top
this->EnableBarrier(25u, pSquad1->GetEnemy(15u), coreVector2( 1.0f, 0.0f), 3.0f);
this->EnableBarrier( 0u, pSquad1->GetEnemy(16u), coreVector2( 0.0f,-1.0f), 3.0f);
this->EnableBarrier( 1u, pSquad1->GetEnemy(17u), coreVector2(-1.0f, 0.0f), 3.0f);
}
else if(STAGE_SUB(5u))
{
STAGE_RESURRECT(pSquad1, 18u, 23u)
this->EnableBarrier(16u, pSquad1->GetEnemy(18u), coreVector2( 0.0f, 1.0f), 1.0f); // 0
this->EnableBarrier(17u, pSquad1->GetEnemy(18u), coreVector2( 0.0f, 1.0f), 1.0f); // 1
this->EnableBarrier( 2u, pSquad1->GetEnemy(19u), coreVector2( 0.0f, 1.0f), 1.0f); // 2 // below
this->EnableBarrier( 3u, pSquad1->GetEnemy(19u), coreVector2( 0.0f, 1.0f), 1.0f); // 3 // below
this->EnableBarrier(18u, pSquad1->GetEnemy(20u), coreVector2( 0.0f, 1.0f), 1.0f); // 0
this->EnableBarrier(19u, pSquad1->GetEnemy(20u), coreVector2( 0.0f, 1.0f), 1.0f); // 1
this->EnableBarrier(20u, pSquad1->GetEnemy(21u), coreVector2( 0.0f, 1.0f), 1.0f); // 2
this->EnableBarrier(21u, pSquad1->GetEnemy(21u), coreVector2( 0.0f, 1.0f), 1.0f); // 3
this->EnableBarrier( 4u, pSquad1->GetEnemy(22u), coreVector2( 0.0f, 1.0f), 1.0f); // 0 // below
this->EnableBarrier( 5u, pSquad1->GetEnemy(22u), coreVector2( 0.0f, 1.0f), 1.0f); // 1 // below
this->EnableBarrier(22u, pSquad1->GetEnemy(23u), coreVector2( 0.0f, 1.0f), 1.0f); // 2
this->EnableBarrier(23u, pSquad1->GetEnemy(23u), coreVector2( 0.0f, 1.0f), 1.0f); // 3
if(g_pGame->IsTask()) this->StartDrumBeat(0u, 19u);
}
else if(STAGE_SUB(6u))
{
STAGE_RESURRECT(pSquad1, 24u, 27u)
this->EnableBarrier( 0u, pSquad1->GetEnemy(24u), coreVector2(-1.0f, 1.0f).Normalized(), 1.0f); // top-left first
this->EnableBarrier( 1u, pSquad1->GetEnemy(24u), coreVector2( 1.0f, 1.0f).Normalized(), 1.0f);
this->EnableBarrier( 6u, pSquad1->GetEnemy(25u), coreVector2(-1.0f, 1.0f).Normalized(), 1.0f);
this->EnableBarrier( 7u, pSquad1->GetEnemy(25u), coreVector2( 1.0f, 1.0f).Normalized(), 1.0f);
this->EnableBarrier( 8u, pSquad1->GetEnemy(26u), coreVector2(-1.0f, 1.0f).Normalized(), 1.0f);
this->EnableBarrier( 9u, pSquad1->GetEnemy(26u), coreVector2( 1.0f, 1.0f).Normalized(), 1.0f);
this->EnableBarrier(10u, pSquad1->GetEnemy(27u), coreVector2(-1.0f, 1.0f).Normalized(), 1.0f);
this->EnableBarrier(11u, pSquad1->GetEnemy(27u), coreVector2( 1.0f, 1.0f).Normalized(), 1.0f);
if(g_pGame->IsTask()) this->StartDrumBeat(1u, 6u);
}
else if(STAGE_SUB(7u))
{
STAGE_RESURRECT(pSquad1, 28u, 31u)
this->EnableBarrier(12u, pSquad1->GetEnemy(28u), coreVector2(-1.0f, 0.0f), 3.0f);
this->EnableBarrier(13u, pSquad1->GetEnemy(28u), coreVector2( 1.0f, 0.0f), 3.0f);
this->EnableBarrier(14u, pSquad1->GetEnemy(29u), coreVector2(-1.0f, 0.0f), 3.0f);
this->EnableBarrier(15u, pSquad1->GetEnemy(29u), coreVector2( 1.0f, 0.0f), 3.0f);
this->EnableBarrier(16u, pSquad1->GetEnemy(30u), coreVector2(-1.0f, 0.0f), 3.0f);
this->EnableBarrier(17u, pSquad1->GetEnemy(30u), coreVector2( 1.0f, 0.0f), 3.0f);
this->EnableBarrier(18u, pSquad1->GetEnemy(31u), coreVector2(-1.0f, 0.0f), 3.0f);
this->EnableBarrier(19u, pSquad1->GetEnemy(31u), coreVector2( 1.0f, 0.0f), 3.0f);
}
else if(STAGE_SUB(8u))
{
STAGE_RESURRECT(pSquad1, 32u, 35u)
this->EnableBarrier( 3u, pSquad1->GetEnemy(32u), coreVector2( 0.0f, 1.0f), 1.0f); // order
this->EnableBarrier( 2u, pSquad1->GetEnemy(33u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 1u, pSquad1->GetEnemy(34u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier( 0u, pSquad1->GetEnemy(35u), coreVector2( 0.0f, 1.0f), 1.0f);
if(g_pGame->IsTask()) this->StartDrumBeat(0u, 0u);
}
else if(STAGE_SUB(9u))
{
STAGE_RESURRECT(pSquad1, 36u, 39u)
this->EnableBarrier( 6u, pSquad1->GetEnemy(36u), coreVector2( 0.0f, 1.0f), 4.0f);
this->EnableBarrier( 7u, pSquad1->GetEnemy(37u), coreVector2( 0.0f, 1.0f), 4.0f);
this->EnableBarrier( 8u, pSquad1->GetEnemy(38u), coreVector2( 0.0f, 1.0f), 4.0f);
this->EnableBarrier( 9u, pSquad1->GetEnemy(39u), coreVector2( 0.0f, 1.0f), 4.0f);
this->SetBarrierIgnore(false);
}
else if(STAGE_SUB(10u))
{
STAGE_RESURRECT(pSquad1, 40u, 51u)
this->EnableBarrier( 0u, pSquad1->GetEnemy(40u), coreVector2(-1.0f, 0.0f), 1.0f); // horizontal <> vertical
this->EnableBarrier(15u, pSquad1->GetEnemy(40u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier(16u, pSquad1->GetEnemy(41u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier( 1u, pSquad1->GetEnemy(42u), coreVector2( 1.0f, 0.0f), 1.0f);
this->EnableBarrier(17u, pSquad1->GetEnemy(42u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier( 2u, pSquad1->GetEnemy(43u), coreVector2(-1.0f, 0.0f), 1.0f);
this->EnableBarrier( 3u, pSquad1->GetEnemy(43u), coreVector2( 1.0f, 0.0f), 1.0f);
this->EnableBarrier(18u, pSquad1->GetEnemy(43u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier(19u, pSquad1->GetEnemy(44u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier( 4u, pSquad1->GetEnemy(45u), coreVector2( 1.0f, 0.0f), 1.0f);
this->EnableBarrier( 5u, pSquad1->GetEnemy(46u), coreVector2(-1.0f, 0.0f), 1.0f);
this->EnableBarrier(20u, pSquad1->GetEnemy(47u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier(10u, pSquad1->GetEnemy(48u), coreVector2( 1.0f, 0.0f), 1.0f);
this->EnableBarrier(21u, pSquad1->GetEnemy(48u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier(11u, pSquad1->GetEnemy(49u), coreVector2(-1.0f, 0.0f), 1.0f);
this->EnableBarrier(22u, pSquad1->GetEnemy(49u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier(12u, pSquad1->GetEnemy(50u), coreVector2(-1.0f, 0.0f), 1.0f);
this->EnableBarrier(13u, pSquad1->GetEnemy(50u), coreVector2( 1.0f, 0.0f), 1.0f);
this->EnableBarrier(23u, pSquad1->GetEnemy(50u), coreVector2( 0.0f,-1.0f), 1.0f);
this->EnableBarrier(24u, pSquad1->GetEnemy(50u), coreVector2( 0.0f, 1.0f), 1.0f);
this->EnableBarrier(14u, pSquad1->GetEnemy(51u), coreVector2( 1.0f, 0.0f), 1.0f);
this->EnableBarrier(25u, pSquad1->GetEnemy(51u), coreVector2( 0.0f, 1.0f), 1.0f);
if(g_pGame->IsTask())
{
this->StartDrumBeat(0u, 15u);
this->StartDrumBeat(1u, 20u);
}
else
{
this->DisableBarrier(15u, false);
this->DisableBarrier(20u, false);
}
this->SetBarrierRange (1.3f);
this->SetBarrierIgnore(true);
}
}
cHelper* pHelper = g_pGame->GetHelper(ELEMENT_BLUE);
if(STAGE_BEGINNING)
{
pHelper->Resurrect(false);
pHelper->SetPosition(coreVector3(-0.8f,1.8f,0.0f) * FOREGROUND_AREA3);
vHelperMove = coreVector2(1.0f,-2.0f).Normalized() * 30.0f;
}
else if(!pHelper->HasStatus(HELPER_STATUS_DEAD))
{
const coreVector2 vNewPos = pHelper->GetPosition().xy() + vHelperMove * TIME;
if(((vNewPos.x < -FOREGROUND_AREA.x * 1.2f) && (vHelperMove.x < 0.0f)) ||
((vNewPos.x > FOREGROUND_AREA.x * 1.2f) && (vHelperMove.x > 0.0f)) ||
((vNewPos.y < -FOREGROUND_AREA.y * 1.2f) && (vHelperMove.y < 0.0f)) ||
((vNewPos.y > FOREGROUND_AREA.y * 1.2f) && (vHelperMove.y > 0.0f)))
{
if(vNewPos.y < -FOREGROUND_AREA.y * 1.2f)
{
STAGE_FOREACH_PLAYER_ALL(pPlayer, i)
{
this->AddExtraScore(pPlayer, 100u, coreVector3(vNewPos, 0.0f));
});
}
pHelper->Kill(false);
}
pHelper->SetPosition(coreVector3(vNewPos, 0.0f));
for(coreUintW i = 0u; i < VIRIDO_BARRIERS; ++i)
{
const coreObject3D& oBarrier = m_aBarrierRaw[i];
if(!oBarrier.IsEnabled(CORE_OBJECT_ENABLE_MOVE)) continue;
coreVector3 vIntersection;
if(Core::Manager::Object->TestCollision(pHelper, &oBarrier, &vIntersection))
{
if(coreVector2::Dot(vHelperMove, oBarrier.GetDirection().xy()) < 0.0f)
{
g_pSpecialEffects->CreateSplashColor(vIntersection, 10.0f, 5u, COLOR_ENERGY_BLUE);
}
vHelperMove = coreVector2::Reflect(vHelperMove, oBarrier.GetDirection().xy());
}
}
}
if(m_iStageSub == 5u)
{
constexpr coreVector2 avBase[] =
{
coreVector2( 1.0f, 0.0f),
coreVector2(-1.0f, 0.0f),
coreVector2( 1.0f, 0.0f).Rotated90(),
coreVector2(-1.0f, 0.0f).Rotated90()
};
for(coreUintW i = 0u; i < VIRIDO_BARRIERS; ++i)
{
coreObject3D& oBarrier = m_aBarrierRaw[i];
if(!m_apBarrierOwner[i]) continue;
const cEnemy* pEnemy = d_cast<const cEnemy*>(m_apBarrierOwner[i]);
const coreUintW iIndex = pSquad1->GetIndex(pEnemy);
const coreFloat fTime = pEnemy->GetLifeTime();
const coreVector2 vRota = coreVector2::Direction(fTime * (0.6f*PI));
const coreVector2 vDir = MapToAxis(avBase[((iIndex % 2u) * 2u) + (i % 2u)], vRota);
oBarrier.SetDirection(coreVector3(vDir, 0.0f));
}
}
else if((m_iStageSub == 8u) || (m_iStageSub == 9u))
{
for(coreUintW i = 0u; i < VIRIDO_BARRIERS; ++i)
{
coreObject3D& oBarrier = m_aBarrierRaw[i];
if(!m_apBarrierOwner[i]) continue;
const coreVector2 vDir = m_apBarrierOwner[i]->GetPosition().xy().Normalized();
oBarrier.SetDirection(coreVector3((m_iStageSub == 9u) ? vDir.Rotated90() : -vDir, 0.0f));
}
}
else if(m_iStageSub == 10u)
{
if(pSquad1->GetNumEnemiesAlive() <= 1u)
{
for(coreUintW i = 0u; i < VIRIDO_BARRIERS; ++i)
this->DisableBarrier(i, true);
}
}
STAGE_FOREACH_ENEMY(pSquad1, pEnemy, i)
{
STAGE_LIFETIME(pEnemy, (i < 2u || i >= 40u) ? 1.2f : 0.6f, (i < 8u || i >= 32u) ? 0.0f : ((i < 18u) ? (0.4f * I_TO_F((i - 8u) % 6u)) : ((i < 24u) ? (0.5f * I_TO_F(i - 18u)) : ((i < 28u) ? (0.7f * I_TO_F(i - 24u)) : (0.7f * I_TO_F(i - 28u))))))
if(i < 2u)
{
const coreVector2 vFactor = coreVector2(1.0f,1.0f);
const coreVector2 vOffset = coreVector2((i % 2u) ? 0.25f : -0.25f, 0.0f);
pEnemy->DefaultMovePath(pPath1, vFactor, vOffset * vFactor, fLifeTime);
}
else if(i < 8u)
{
const coreVector2 vFactor = coreVector2(1.0f,1.0f);
const coreVector2 vOffset = coreVector2((I_TO_F(i - 2u) - 2.5f) * fWidth, 0.4f * SIN((fLifeTime * 0.6f + I_TO_F((i - 2u) / 2u)) * (1.0f*PI) + (1.0f*PI)));
pEnemy->DefaultMovePath(pPath1, vFactor, vOffset * vFactor, fLifeTime);
pEnemy->Rotate180();
}
else if(i < 14u)
{
STAGE_REPEAT(pPath3->GetTotalDistance())
const coreVector2 vFactor = coreVector2(1.0f,1.0f);
const coreVector2 vOffset = coreVector2((I_TO_F(((i - 8u) * 2u + 2u) % 6u) - 2.5f) * 0.34f * ((i < 11u) ? 1.0f : -1.0f), 0.0f);
pEnemy->DefaultMovePath(pPath3, vFactor, vOffset * vFactor, fLifeTime);
pEnemy->SetDirection(coreVector3(pEnemy->AimAtPlayerSide().Normalized(), 0.0f));
}
else if(i < 18u)
{
STAGE_REPEAT(pPath3->GetTotalDistance())
const coreVector2 vFactor = coreVector2(1.0f,1.0f);
const coreVector2 vOffset = coreVector2(-0.54f,0.0f);
pEnemy->DefaultMovePath(pPath3, vFactor, vOffset * vFactor, fLifeTime);
if(i < 15u) pEnemy->Rotate180();
else if(i < 16u) pEnemy->Rotate270();
else if(i < 17u) {}
else if(i < 18u) pEnemy->Rotate90 ();
}
else if(i < 24u)
{
STAGE_REPEAT(pPath3->GetTotalDistance())
const coreVector2 vFactor = coreVector2(1.0f,1.0f);
const coreVector2 vOffset = coreVector2((I_TO_F((i - 18u) % 3u) - 2.0f) * fWidth, 0.0f);
pEnemy->DefaultMovePath(pPath3, vFactor, vOffset * vFactor, fLifeTime);
pEnemy->Rotate90();
if((i - 18u) % 3u == 1u) pEnemy->InvertX();
pEnemy->DefaultRotate(fLifeTime * -3.0f);
}
else if(i < 28u)
{
STAGE_REPEAT(pPath3->GetTotalDistance())
const coreVector2 vFactor = coreVector2(1.0f,-1.0f);
const coreVector2 vOffset = coreVector2((((i - 24u) % 2u) ? 0.4f : -0.4f) * SIN(m_fStageSubTime * (0.5f*PI)), 0.0f);
pEnemy->DefaultMovePath(pPath3, vFactor, vOffset * vFactor, fLifeTime);
}
else if(i < 32u)
{
STAGE_REPEAT(pPath3->GetTotalDistance())
const coreVector2 vFactor = coreVector2(1.0f,1.0f);
const coreVector2 vOffset = coreVector2((((i - 28u) % 2u) ? -1.0f : 1.0f) * SIN(m_fStageSubTime * (0.5f*PI) + (0.5f*PI)), 0.0f);
pEnemy->DefaultMovePath(pPath3, vFactor, vOffset * vFactor, fLifeTime);
pEnemy->Rotate90();
}
else if(i < 40u)
{
const coreFloat fSide = (i < 36u) ? 1.0f : -1.0f;
const coreVector2 vDir = coreVector2::Direction((fLifeTime * (g_pGame->IsEasy() ? 1.5f : 2.0f) - I_TO_F((i - 32u) % 4u) * ((i < 36u) ? (0.25f*PI) : (0.5f*PI))) * fSide);
const coreFloat fLen = LERPB(1.85f, 0.6f, MIN1(fLifeTime * 0.5f)) * FOREGROUND_AREA.x;
pEnemy->SetPosition (coreVector3(vDir * fLen, 0.0f));
pEnemy->SetDirection(coreVector3(vDir * -1.0f, 0.0f));
}
else if(i < 52u)
{
const coreUintW x = (i - 40u) % 3u;
const coreUintW y = (i - 40u) / 3u;
const coreVector2 vFactor = coreVector2(1.0f,1.0f);
const coreVector2 vOffset = coreVector2((I_TO_F(x) - 1.0f) * fWidth, (I_TO_F(y) - 1.5f) * fWidth);
pEnemy->DefaultMovePath(pPath2, vFactor, vOffset * vFactor, fLifeTime);
if(i == 50u) pEnemy->DefaultRotate(fLifeTime * 3.0f);
}
if(STAGE_LIFETIME_AFTER(0.7f))
{
if((i < 40u) && STAGE_TICK_LIFETIME(1.0f, 0.0f))
{
const coreVector2 vPos = pEnemy->GetPosition().xy();
const coreFloat fBase = pEnemy->AimAtPlayerDual(i % 2u).Angle();
const coreUintW iNum = g_pGame->IsEasy() ? 2u : 3u;
for(coreUintW j = iNum; j--; )
{
const coreVector2 vDir = coreVector2::Direction(DEG_TO_RAD((I_TO_F(j) - I_TO_F(iNum - 1u) * 0.5f) * 2.5f) + fBase);
const coreFloat fSpeed = ((iNum == 3u) && (j == 1u)) ? 0.72f : 0.7f;
g_pGame->GetBulletManagerEnemy()->AddBullet<cSpearBullet>(5, fSpeed, pEnemy, vPos, vDir)->ChangeSize(1.5f);
}
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), 10.0f, 5u, COLOR_ENERGY_YELLOW);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_WEAPON_ENEMY);
}
else if((i == 50u) && STAGE_TICK_LIFETIME(8.0f, 0.0f) && ((s_iTick % 8u) >= (g_pGame->IsEasy() ? 6u : 4u)))
{
const coreVector2 vPos = pEnemy->GetPosition().xy();
const coreVector2 vDir = pEnemy->AimAtPlayerDual(((s_iTick % 16u) >= 8u) ? 1u : 0u).Normalized();
g_pGame->GetBulletManagerEnemy()->AddBullet<cSpearBullet>(5, 0.7f, pEnemy, vPos, vDir)->ChangeSize(1.5f);
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), 10.0f, 2u, COLOR_ENERGY_YELLOW);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_WEAPON_ENEMY);
}
}
});
if(g_pGame->IsTask())
{
STAGE_COLL_ENEMY_BULLET(pEnemy, pBullet, vIntersection, bFirstHit, COLL_THIS)
{
if(!bFirstHit) return;
if(pBullet->HasStatus(BULLET_STATUS_REFLECTED))
{
const coreInt32 iDamage = pBullet->GetDamage() * (g_pGame->IsMulti() ? 1 : GAME_PLAYERS);
if(iDamage >= pEnemy->GetCurHealth())
{
STAGE_BADGE(1u, BADGE_NORMAL, pEnemy->GetPosition())
}
}
});
if(m_fStageSubTime > 0.0f) // prevent effect
{
const coreBool bEffectTick = STAGE_TICK_FREE(30.0f, 0.0f);
for(coreUintW i = 0u; i < VIRIDO_DRUMS; ++i)
{
const coreUintW iIndex = m_aiDrumIndex[i];
if(iIndex != UINT8_MAX)
{
const coreObject3D& oBarrier = m_aBarrierRaw[iIndex];
if(m_aiDrumCount[i] >= 20u)
{
this->EndDrumBeat(i, true);
this->DisableBarrier(iIndex, false);
if(++iDrumNum >= 7u)
{
STAGE_BADGE(0u, BADGE_EASY, oBarrier.GetPosition())
}
else
{
g_pGame->GetCombatText()->DrawProgress(iDrumNum, 7u, oBarrier.GetPosition());
g_pSpecialEffects->PlaySound(oBarrier.GetPosition(), 1.0f, SPECIAL_SOUND_PROGRESS(iDrumNum, 7u), SOUND_ITEM_02);
}
g_pSpecialEffects->PlaySound(oBarrier.GetPosition(), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_10);
}
if(bEffectTick)
{
const coreVector2 vPos = oBarrier.GetPosition().xy() + oBarrier.GetDirection().xy().Rotated90() * (I_TO_F((s_iTick * 4u) % 15u) - 7.0f);
if(g_pForeground->IsVisiblePoint(vPos)) g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), 0.0f, 1u, COLOR_ENERGY_RED);
}
}
}
}
}
if(m_iStageSub == 7u)
{
STATIC_ASSERT(coreMath::IsAligned(iReflectSize, 2u))
coreUint8* aiFlip = r_cast<coreUint8*>(aiReflect);
coreUint8* aiCount = r_cast<coreUint8*>(aiReflect + iReflectSize / 2u);
g_pGame->GetBulletManagerPlayer()->ForEachBullet([&](cBullet* OUTPUT pBullet)
{
coreUintW iSize;
switch(pBullet->GetID())
{
default: UNREACHABLE
case cRayBullet ::ID: iSize = sizeof(cRayBullet); break;
case cPulseBullet::ID: iSize = sizeof(cPulseBullet); break;
case cSurgeBullet::ID: iSize = sizeof(cSurgeBullet); break;
case cTeslaBullet::ID: iSize = sizeof(cTeslaBullet); break;
}
const coreUintW iIndex = (P_TO_UI(pBullet) / iSize) % iReflectWrap;
if(pBullet->GetFlyTime() < 0.1f)
{
if(aiFlip[iIndex]) aiCount[iIndex] = 0u;
aiFlip[iIndex] = 0u;
}
else
{
aiFlip[iIndex] = 1u;
}
if(pBullet->HasStatus(BULLET_STATUS_REFLECTED))
{
pBullet->RemoveStatus(BULLET_STATUS_REFLECTED);
if(++aiCount[iIndex] >= 20u) STAGE_BADGE(3u, BADGE_ACHIEVEMENT, pBullet->GetPosition())
}
});
}
cGrassBackground* pBackground = d_cast<cGrassBackground*>(g_pEnvironment->GetBackground());
pBackground->SetCoverAlpha(1.0f - STEPH3(0.5f, 3.5f, m_fStageTime));
if(STAGE_BEGINNING)
{
pBackground->GetOutdoor()->LerpHeight(1.0f, 0.0f, 50u);
pBackground->SetGroundDensity(0u, 1.0f, true);
pBackground->SetGroundDensity(1u, 1.0f, true);
pBackground->SetGroundDensity(2u, 1.0f, true);
pBackground->SetGroundDensity(3u, 1.0f, true);
pBackground->SetDecalDensity (0u, 1.0f, true);
}
const coreFloat fEnvLerp = pBackground->GetOutdoor()->GetLerp();
pBackground->SetGroundDensity(3u, STEP(0.0f, 0.5f, 1.0f - fEnvLerp));
pBackground->SetAirDensity (2u, STEP(0.9f, 1.0f, 1.0f - fEnvLerp));
STAGE_WAVE(0u, "1-1", {35.0f, 50.0f, 70.0f, 85.0f, 170.0f}) // EINS
},
STAGE_PRE()
{
g_pGame->GetEnemyManager()->PrefetchEnemy<cMinerEnemy>();
g_pGame->GetBulletManagerEnemy()->PrefetchBullet<cSpearBullet>();
});
// ################################################################
// reset helper
STAGE_MAIN({TAKE_ALWAYS, 0u})
{
g_pGame->KillHelpers();
for(coreUintW i = 0u; i < VIRIDO_BARRIERS; ++i)
this->DisableBarrier(i, false);
this->SetBarrierRange (1.0f);
this->SetBarrierIgnore(true);
STAGE_FINISH_NOW
});
// ################################################################
// change background appearance
STAGE_MAIN({TAKE_ALWAYS, 1u})
{
cGrassBackground* pBackground = d_cast<cGrassBackground*>(g_pEnvironment->GetBackground());
pBackground->SetCoverAlpha(0.0f);
pBackground->GetOutdoor()->LerpHeightNow(1.0f, 0.0f);
pBackground->SetGroundDensity(0u, 1.0f);
pBackground->SetGroundDensity(1u, 1.0f);
pBackground->SetGroundDensity(2u, 1.0f);
pBackground->SetGroundDensity(3u, 0.0f);
pBackground->SetDecalDensity (0u, 1.0f);
pBackground->SetAirDensity (2u, 0.0f);
STAGE_FINISH_NOW
});
// ################################################################
// wait for play
STAGE_MAIN({TAKE_ALWAYS, 1u})
{
STAGE_FINISH_PLAY
});
// ################################################################
// cut with laser through everything
// - the delay when rays "appear" is important, not when they "stop"
// - rays should not come from below, first segments main direction is upwards
// - 1., 2. coming from upper left, 3., 4. coming from upper right
// - 1. starts right to left, 2. starts left to right, 3. starts right to left, 4. starts left to right
// - enemies on the line should spawn in the middle of the line
// - first two patterns have no single equal line
// - bullets have a 3-delay pattern, but on the side and when enemies die the pattern might break
// - fast line shows the player that there is no harm, in preparation for the multi-line wave
// - enemies in 3. need to be positioned to easily kill them (to reduce pressure, which is reserved for later)
// - enemies without line should not move too fast, as the sudden transition might overwhelm the player
// - both rotating waves should not rotate into the same direction
// - the multi lines should shoot down in a nice pattern, that you have to avoid while being pushed against the wall
// TASK: 4 objects that lie on a laser and disappear after a short time must be shot
// TASK: marked line must be touched for 1 second (pole dancing)
// TASK EXTRA: destroy enemies in a certain order in the final phase, changes depending on the starting enemy
// ACHIEVEMENT: touch every laser at least once
// HARD: lasers block bullets
STAGE_MAIN({TAKE_ALWAYS, 1u})
{
constexpr coreUintW iNumData = 8u;
STAGE_ADD_SQUAD(pSquad1, cStarEnemy, 43u)
{
STAGE_FOREACH_ENEMY_ALL(pSquad1, pEnemy, i)
{
pEnemy->SetSize (coreVector3(1.0f,1.0f,1.0f) * 1.5f);
pEnemy->Configure(30, COLOR_SHIP_PURPLE);
});
});
STAGE_GET_START(iNumData * 3u + 7u)
STAGE_GET_FLOAT_ARRAY(afDistance, iNumData)
STAGE_GET_VEC2_ARRAY (avMove, iNumData)
STAGE_GET_UINT64 (iLineTouch)
STAGE_GET_FLOAT (fGlobeTime)
STAGE_GET_UINT (iGlobeCount)
STAGE_GET_UINT (iCurLaser)
STAGE_GET_UINT (iOrderCur)
STAGE_GET_UINT (iOrderType)
STAGE_GET_END
ASSERT(pSquad1->GetNumEnemiesAlive() <= iNumData)
if(m_iStageSub < 9u)
{
for(coreUintW i = 0u; i < VIRIDO_LASERS; ++i)
{
if(m_apLaserOwner[i] && m_apLaserOwner[i]->HasStatus(ENEMY_STATUS_DEAD))
this->DisableLaser(i, true);
}
}
if(STAGE_CLEARED)
{
const auto nEnableLaserFunc = [&](const coreUintW iIndex)
{
this->EnableLaser(iCurLaser, pSquad1->GetEnemy(iIndex));
if(++iCurLaser >= VIRIDO_LASERS) iCurLaser = 0u;
};
const auto nEnableGlobeFunc = [&](const coreFloat fTime)
{
this->EnableGlobe();
fGlobeTime = fTime;
};
if(STAGE_SUB(1u))
{
STAGE_RESURRECT(pSquad1, 0u, 2u)
nEnableLaserFunc( 0u);
nEnableLaserFunc( 1u);
nEnableLaserFunc( 2u);
}
else if(STAGE_SUB(2u))
{
STAGE_RESURRECT(pSquad1, 3u, 6u)
nEnableLaserFunc( 3u);
nEnableLaserFunc( 4u);
nEnableLaserFunc( 5u);
nEnableLaserFunc( 6u);
if(g_pGame->IsTask()) nEnableGlobeFunc(10.0f);
}
else if(STAGE_SUB(3u))
{
STAGE_RESURRECT(pSquad1, 7u, 10u)
nEnableLaserFunc( 7u);
nEnableLaserFunc( 8u);
nEnableLaserFunc( 9u);
nEnableLaserFunc(10u);
if(g_pGame->IsTask()) this->StartPoleDance(2u);
}
else if(STAGE_SUB(4u))
{
STAGE_RESURRECT(pSquad1, 11u, 14u)
nEnableLaserFunc(11u);
nEnableLaserFunc(12u);
nEnableLaserFunc(13u);
nEnableLaserFunc(14u);
if(g_pGame->IsTask()) nEnableGlobeFunc(10.0f);
}
else if(STAGE_SUB(5u))
{
STAGE_RESURRECT(pSquad1, 15u, 15u)
nEnableLaserFunc(15u);
}
else if(STAGE_SUB(6u))
{
STAGE_RESURRECT(pSquad1, 16u, 23u)
nEnableLaserFunc(16u);
nEnableLaserFunc(17u);
nEnableLaserFunc(18u);
nEnableLaserFunc(19u);
nEnableLaserFunc(20u);
nEnableLaserFunc(21u);
nEnableLaserFunc(22u);
nEnableLaserFunc(23u);
if(g_pGame->IsTask()) nEnableGlobeFunc(5.0f);
}
else if(STAGE_SUB(7u))
{
STAGE_RESURRECT(pSquad1, 24u, 29u)
nEnableLaserFunc(24u);
nEnableLaserFunc(25u);
nEnableLaserFunc(26u);
nEnableLaserFunc(27u);
nEnableLaserFunc(28u);
nEnableLaserFunc(29u);
}
else if(STAGE_SUB(8u))
{
STAGE_RESURRECT(pSquad1, 30u, 34u)
nEnableLaserFunc(30u);
nEnableLaserFunc(31u);
nEnableLaserFunc(32u);
nEnableLaserFunc(33u);
nEnableLaserFunc(34u);
if(g_pGame->IsTask()) nEnableGlobeFunc(5.0f);
}
else if(STAGE_SUB(9u))
{
STAGE_RESURRECT(pSquad1, 35u, 42u)
nEnableLaserFunc(35u);
}
std::memset(afDistance, 0, sizeof(coreFloat) * iNumData);
}
cHelper* pHelper = g_pGame->GetHelper(ELEMENT_PURPLE);
if((m_iStageSub == 7u) && STAGE_BEGINNING2)
{
pHelper->Resurrect(false);
}
constexpr coreUintW iSharedIndex = 35u;
const coreObject3D* pSharedLaser = (*m_Laser.List())[iSharedIndex % VIRIDO_LASERS];
const coreBool bSharedActive = pSharedLaser->IsEnabled(CORE_OBJECT_ENABLE_ALL); // outside, for consistent movement
constexpr coreFloat fRange = FOREGROUND_AREA.x * 3.0f / 6.0f;
STAGE_FOREACH_ENEMY(pSquad1, pEnemy, i)
{
coreVector2 vBasePos, vBaseDir;
coreFloat fDelay, fShift, fSide;
switch(i)
{
default: UNREACHABLE
case 0u: vBasePos = coreVector2( 0.7f,-0.1f); vBaseDir = coreVector2(-2.0f,-1.0f).Normalized(); fDelay = 0.0f; fShift = 0.0f; fSide = -1.0f; break;
case 1u: vBasePos = coreVector2( 0.2f,-0.7f); vBaseDir = coreVector2( 1.0f,-2.0f).Normalized(); fDelay = 0.3f; fShift = -15.0f; fSide = 1.0f; break;
case 2u: vBasePos = coreVector2( 0.0f, 0.8f); vBaseDir = coreVector2( 1.0f, 1.0f).Normalized(); fDelay = 0.45f; fShift = -35.0f; fSide = 1.0f; break;
case 3u: vBasePos = coreVector2( 0.1f, 0.8f); vBaseDir = coreVector2( 1.0f, 2.0f).Normalized(); fDelay = 0.0f; fShift = -30.0f; fSide = 1.0f; break;
case 4u: vBasePos = coreVector2( 0.2f, 0.2f); vBaseDir = coreVector2( 1.0f,-1.0f).Normalized(); fDelay = 0.3f; fShift = -35.0f; fSide = 1.0f; break;
case 5u: vBasePos = coreVector2( 0.5f,-0.6f); vBaseDir = coreVector2( 1.0f, 5.0f).Normalized(); fDelay = 0.4f; fShift = 0.0f; fSide = -1.0f; break;
case 6u: vBasePos = coreVector2(-0.8f, 0.1f); vBaseDir = coreVector2( 1.0f,-2.0f).Normalized(); fDelay = 0.7f; fShift = -25.0f; fSide = -1.0f; break;
case 7u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.0f; fShift = -30.0f; fSide = -1.0f; break;
case 8u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2( 0.0f,-1.0f); fDelay = 0.25f; fShift = -30.0f; fSide = 1.0f; break;
case 9u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.5f; fShift = -30.0f; fSide = -1.0f; break;
case 10u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2( 0.0f,-1.0f); fDelay = 0.75f; fShift = -30.0f; fSide = 1.0f; break;
case 11u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.0f; fShift = 0.0f; fSide = -1.0f; break;
case 12u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2( 0.0f, 1.0f); fDelay = 0.25f; fShift = 0.0f; fSide = 1.0f; break;
case 13u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.5f; fShift = 0.0f; fSide = -1.0f; break;
case 14u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2( 0.0f, 1.0f); fDelay = 0.75f; fShift = 0.0f; fSide = 1.0f; break;
case 15u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2( 0.0f, 1.0f); fDelay = 0.0f; fShift = 0.0f; fSide = 1.0f; break;
case 16u: vBasePos = coreVector2( 0.0f,-0.8f); vBaseDir = coreVector2( 1.0f, 0.0f); fDelay = 0.0f * 0.9f; fShift = 0.0f; fSide = 1.0f; break;
case 17u: vBasePos = coreVector2( 0.0f,-0.7f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.1f * 0.9f; fShift = 0.0f; fSide = -1.0f; break;
case 18u: vBasePos = coreVector2( 0.0f,-0.6f); vBaseDir = coreVector2( 1.0f, 0.0f); fDelay = 0.2f * 0.9f; fShift = 0.0f; fSide = 1.0f; break;
case 19u: vBasePos = coreVector2( 0.0f,-0.5f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.3f * 0.9f; fShift = 0.0f; fSide = -1.0f; break;
case 20u: vBasePos = coreVector2( 0.0f,-0.4f); vBaseDir = coreVector2( 1.0f, 0.0f); fDelay = 0.4f * 0.9f; fShift = 0.0f; fSide = 1.0f; break;
case 21u: vBasePos = coreVector2( 0.0f,-0.3f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.5f * 0.9f; fShift = 0.0f; fSide = -1.0f; break;
case 22u: vBasePos = coreVector2( 0.0f,-0.2f); vBaseDir = coreVector2( 1.0f, 0.0f); fDelay = 0.6f * 0.9f; fShift = 0.0f; fSide = 1.0f; break;
case 23u: vBasePos = coreVector2( 0.0f,-0.1f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.7f * 0.9f; fShift = 0.0f; fSide = -1.0f; break;
case 24u: vBasePos = coreVector2( 0.0f, 0.1f); vBaseDir = coreVector2( 1.0f, 0.0f); fDelay = 0.0f; fShift = fRange * -0.0f; fSide = 1.0f; break;
case 25u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2(-1.0f, 0.0f); fDelay = 0.0f; fShift = fRange * -1.0f; fSide = -1.0f; break;
case 26u: vBasePos = coreVector2( 0.0f,-0.1f); vBaseDir = coreVector2( 1.0f, 0.0f); fDelay = 0.0f; fShift = fRange * -2.0f; fSide = 1.0f; break;
case 27u: vBasePos = coreVector2( 0.1f, 0.0f); vBaseDir = coreVector2( 0.0f, 1.0f); fDelay = 0.0f; fShift = fRange * -3.0f; fSide = 1.0f; break;
case 28u: vBasePos = coreVector2( 0.0f, 0.0f); vBaseDir = coreVector2( 0.0f,-1.0f); fDelay = 0.0f; fShift = fRange * -4.0f; fSide = -1.0f; break;
case 29u: vBasePos = coreVector2(-0.1f, 0.0f); vBaseDir = coreVector2( 0.0f, 1.0f); fDelay = 0.0f; fShift = fRange * -5.0f; fSide = 1.0f; break;
case 30u:
case 31u:
case 32u:
case 33u:
case 34u:
vBasePos = coreVector2(0.0f,0.0f); vBaseDir = coreVector2::Direction(I_TO_F(i) * (0.4f*PI)); fDelay = 0.0f; fShift = 0.0f; fSide = -1.0f;
break;
case 35u:
case 36u:
case 37u:
case 38u:
case 39u:
case 40u:
case 41u:
case 42u:
vBasePos = coreVector2(0.0f,0.0f); vBaseDir = coreVector2(1.0f,0.0f); fDelay = 0.0f; fShift = 0.0f; fSide = 1.0f;
break;
}
STAGE_LIFETIME(pEnemy, 0.25f, fDelay)
const coreVector2 vTan = vBaseDir.Rotated90() * fSide;
const coreFloat fTime = MAX0(fLifeTime);
coreVector2 vLerpPos;
if(i < 7u) vLerpPos = LERPB(vBasePos - vTan * 2.0f, vBasePos, MIN1(fTime * 1.2f)) * (FOREGROUND_AREA);
else if(i < 11u) vLerpPos = LERP (-vTan, vTan, FRACT(fTime * 0.6f)) * (FOREGROUND_AREA * 1.25f);
else if(i < 15u) vLerpPos = LERP (-vTan, vTan, 0.5f - 0.5f * COS(fTime * 2.5f)) * (FOREGROUND_AREA * 1.25f);
else if(i < 16u) vLerpPos = LERP (-vTan, vTan, FRACT(fTime * 2.0f)) * (FOREGROUND_AREA * 1.2f);
else if(i < 24u) vLerpPos = LERP (-vTan, vTan, FRACT(fTime * 1.2f)) * (FOREGROUND_AREA * 1.25f);
else if(i < 30u) vLerpPos = LERPB(vBasePos - vTan * 2.0f, vBasePos, MIN1(fTime * 1.2f)) * (FOREGROUND_AREA) * coreMatrix3::Rotation(fTime * 2.0f).m12();
else if(i < 35u) vLerpPos = LERPB(-vTan * 1.4f, -vTan * 0.5f, MIN1(fTime * 1.2f)) * (FOREGROUND_AREA * 1.2f) * coreMatrix3::Rotation(fTime * -1.1f).m12();
else if(i < 43u) vLerpPos = LERP (-vTan, vTan, FRACT(fTime * 0.8f)) * (FOREGROUND_AREA * 1.2f);
else UNREACHABLE
coreVector2 vLerpDir;
if(i < 7u) vLerpDir = vBaseDir;
else if(i < 11u) vLerpDir = vBaseDir;
else if(i < 15u) vLerpDir = vBaseDir * coreMatrix3::Rotation(fTime * 2.0f).m12();
else if(i < 16u) vLerpDir = vBaseDir;
else if(i < 24u) vLerpDir = vBaseDir;
else if(i < 30u) vLerpDir = vBaseDir * coreMatrix3::Rotation(fTime * 2.0f).m12();
else if(i < 35u) vLerpDir = vBaseDir * coreMatrix3::Rotation(fTime * -1.1f).m12();
else if(i < 43u) vLerpDir = vBaseDir;
else UNREACHABLE
coreFloat& fDistance = STAGE_SINK_FLOAT(afDistance[i % iNumData]);
if(STAGE_TAKEOFF) fDistance = fShift;
fDistance += 100.0f * (fLifeTime - fLifeTimeBefore);
const coreVector2 vNewPos = vLerpPos + vLerpDir * fDistance;
if(i < 16u) // also for multi-line wave
{
if(((vNewPos.x < -FOREGROUND_AREA.x * 1.2f) && (vLerpDir.x < 0.0f)) ||
((vNewPos.x > FOREGROUND_AREA.x * 1.2f) && (vLerpDir.x > 0.0f)) ||
((vNewPos.y < -FOREGROUND_AREA.y * 1.2f) && (vLerpDir.y < 0.0f)) ||
((vNewPos.y > FOREGROUND_AREA.y * 1.2f) && (vLerpDir.y > 0.0f)))
{
if(fDistance > 0.0f) fDistance -= MAX0(g_pForeground->RayIntersection(vNewPos, -vLerpDir, 1.2f));
}
}
else if(i >= 24u && i < 30u)
{
if(fDistance > FOREGROUND_AREA.x * 1.5f) fDistance -= FOREGROUND_AREA.x * 3.0f;
}
else
{
if(fDistance > FOREGROUND_AREA.x * 1.4f) fDistance -= FOREGROUND_AREA.x * 2.8f;
}
if(pEnemy == m_apLaserOwner[i % VIRIDO_LASERS])
{
coreObject3D* pLaser = (*m_Laser.List())[i % VIRIDO_LASERS];
pLaser->SetPosition (coreVector3(vLerpPos, 0.0f));
pLaser->SetDirection(coreVector3(vLerpDir, 0.0f));
}
if(i < iSharedIndex)
{
pEnemy->SetPosition (coreVector3(vNewPos, 0.0f));
pEnemy->SetDirection(coreVector3(vLerpDir, 0.0f));
}
else
{
if(bSharedActive)
{
const coreVector2 vNewPos2 = coreVector2((I_TO_F(i - iSharedIndex) - 3.5f) * 0.25f * FOREGROUND_AREA.x, pSharedLaser->GetPosition().y);
pEnemy->SetPosition (coreVector3(vNewPos2, 0.0f));