-
Notifications
You must be signed in to change notification settings - Fork 0
/
cMission.h
1879 lines (1454 loc) · 88.9 KB
/
cMission.h
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 |//
//*-------------------------------------------------*//
///////////////////////////////////////////////////////
#pragma once
#ifndef _P1_GUARD_MISSION_H_
#define _P1_GUARD_MISSION_H_
// TODO 3: prevent multiple calculations in script-commands (because of macro variables), also boss
// TODO 3: assertion for "active boss should be alive"
// TODO 3: STAGE_FLYPAST with dot-product or simpler per-axis
// TODO 3: wrap m_piData in function with RETURN_RESTRICT
// TODO 3: low-resolution object_sphere for small sphere objects (what about bullet_orb) ?
// TODO 3: change all missions to STATIC_MEMORY (check memory, it would put all missions always in memory), or create 2 max-size blocks (old, cur), also in Ater mission ?
// TODO 3: do not create objects and load resources of unused game-objects and bosses (e.g. move waves into own classes ? but then ?)
// TODO 4: move as much gameplay from gameplay-objects from mission to stages, except for mission-shared stuff, animation stuff, or special-cases requiring before-after update (teleportation)
// TODO 1: check if all allocated enemy numbers are correct (why wasn't that a MF?, really check them all out)
// TODO 2: generate objects are preventing each others outlines while being alpha 0 (especially on diagonal movement)
// TODO 3: nevo: render order of blasts is static, sometimes they overlap, not consistent
// TODO 4: mission code sometimes accesses variables directly without wrapper-functions (mixed), bosses always need wrapper functions, should this be handled consistently ?
// TODO 4: why are s_iTick and co. static ?
// TODO 3: change m_piData into static buffer (needs manual clear), that way I can also remove init-number (!!! sometimes there are 2 missions in memory at the same time)
// TODO 3: morning star chain should be above player wind
// TODO 3: insanity functions in harena copy (and override) some of the mission code, maybe this can be cleaned up
// TODO 4: remove direct access with .List() or Raw containers in all missions (change to Getters)
// TODO 4: change fangs back from cLodObject to coreObject3D, if lod not required (other objects as well ? (low == high))
// TODO 3: hail should only use one batchlist, both can be merged
// TODO 3: manual/tutorial might react strange on inverted and toggled firing mode, because iActionHold is inspected
// TODO 1: [MF] add 3 different pearl-collect-pitch tracks (wave, boss, p1) and reset state properly
// TODO 4: there are multiple "Aim" objects (mission + boss)
// TODO 3: also wrap all object-iterations in g_pGame->IsTask()
// TODO 3: display sticks in manual
// ****************************************************************
// mission definitions
#define MISSION_PLAYERS (PLAYERS) //
#define MISSION_BOSSES (BOSSES) // default number of bosses per mission
#define MISSION_WAVES (WAVES) //
#define MISSION_MAP_PATHS (8u) //
#define MISSION_MAP_SQUADS (8u) //
#define MISSION_NO_BOSS (0xFFu) // no boss currently active (error-value)
#define MISSION_NO_WAVE (0xFFu) //
#define MISSION_NO_SEGMENT (0xFFu) //
#define MISSION_WAIT_INTRO (1.5f) //
#define MISSION_WAIT_OUTRO (2.0f) //
#define MISSION_WAIT_PLAY (6.9f) //
#define MISSION_INTRO (0u)
#define MISSION_ATER (8u)
#define MISSION_BASE (9u)
#define MISSION_SEGMENT_IS_BOSS(i) ((i) >= MISSION_WAVES)
#define MISSION_BOSS_TO_SEGMENT(i) ((i) + MISSION_WAVES)
#define MISSION_WAVE_TO_SEGMENT(i) ((i))
#define TAKE_ALWAYS (0x00u)
#define TAKE_MISSION (0xFEu)
#define TAKE_TRAINING (0xFFu)
// ****************************************************************
// mission specific definitions
#define VIRIDO_TRAILS (4u) //
#define VIRIDO_BALLS (2u) //
#define VIRIDO_BALLS_RAWS (VIRIDO_BALLS * (VIRIDO_TRAILS + 1u)) //
#define VIRIDO_PADDLES (3u) //
#define VIRIDO_BARRIERS (26u) //
#define VIRIDO_BARRIERS_RAWS (VIRIDO_BARRIERS) //
#define VIRIDO_BARRIERS_FIRST (15u) //
#define VIRIDO_BARRIERS_SECOND (VIRIDO_BARRIERS - VIRIDO_BARRIERS_FIRST) //
#define VIRIDO_LASERS (8u) //
#define VIRIDO_LASERS_RAWS (VIRIDO_LASERS * 2u) //
#define VIRIDO_SHADOWS_ENEMY (20u) //
#define VIRIDO_SHADOWS (VIRIDO_SHADOWS_ENEMY + MISSION_PLAYERS) //
#define VIRIDO_SHADOWS_RAWS (VIRIDO_SHADOWS) //
#define VIRIDO_HINTS (12u) //
#define VIRIDO_HINTS_RAWS (VIRIDO_HINTS) //
#define VIRIDO_BEANS (16u) //
#define VIRIDO_BEANS_RAWS (VIRIDO_BEANS * 2u) //
#define VIRIDO_DRUMS (2u) //
#define VIRIDO_BALL_SPEED (1.5f) //
#define VIRIDO_BARRIER_FREE (r_cast<cShip*>(1u)) //
#define NEVO_BOMBS (24u) //
#define NEVO_BOMBS_RAWS (NEVO_BOMBS) //
#define NEVO_LINES (4u) //
#define NEVO_BLASTS (NEVO_BOMBS) //
#define NEVO_BLASTS_RAWS (NEVO_BLASTS * (NEVO_LINES + 1u)) //
#define NEVO_TILES (17u) //
#define NEVO_TILES_RAWS (NEVO_TILES) //
#define NEVO_ARROWS (38u) //
#define NEVO_ARROWS_RAWS (NEVO_ARROWS) //
#define NEVO_BLOCKS (2u)//(70u) // (disabled)
#define NEVO_BLOCKS_RAWS (NEVO_BLOCKS * 2u) //
#define NEVO_SCRAPS (4u) //
#define NEVO_CHIPS (10u) //
#define NEVO_CHIPS_RAWS (NEVO_CHIPS * 2u) //
#define NEVO_BOMB_SIZE (4.0f) //
#define NEVO_TILE_SPEED (2.0f) //
#define HARENA_FLOORS (10u) //
#define HARENA_FLOORS_RAWS (HARENA_FLOORS) //
#define HARENA_SPIKES (36u) //
#define HARENA_SPIKES_RAWS (HARENA_SPIKES * 2u) //
#define HARENA_SPIKE_DIMENSION (6u) //
#define HARENA_SPIKE_LAUNCH (1.0f) //
#define HARENA_SPIKE_FADE (0.5f) //
#define HARENA_EGGS (8u) //
#define HARENA_EGGS_RAWS (HARENA_EGGS * 2u) //
#define HARENA_FLUMMIS (21u) //
#define HARENA_FLUMMIS_RAWS (HARENA_FLUMMIS) //
#define HARENA_INSANITY_P1 (10u) //
#define RUTILUS_TELEPORTER (2u) //
#define RUTILUS_TELEPORTER_COLOR(x) ((x) ? COLOR_ENERGY_BLUE : COLOR_ENERGY_ORANGE) //
#define RUTILUS_PLATES (5u) //
#define RUTILUS_PLATES_RAWS (RUTILUS_PLATES) //
#define RUTILUS_AREAS (2u) //
#define RUTILUS_WAVES (4u) //
#define RUTILUS_WAVES_RAWS (RUTILUS_WAVES) //
#define RUTILUS_TOCKS (5u) //
#define RUTILUS_TOCKS_RAWS (RUTILUS_TOCKS * 2u) //
#define RUTILUS_SLAPS (4u) //
#define RUTILUS_SLAPS_RAWS (RUTILUS_SLAPS * 2u) //
#define RUTILUS_PLATE_SPEED (1.0f) //
#define RUTILUS_AREA_SIZE (20.0f) //
#define RUTILUS_SAFE_SIZE (20.0f) //
#define RUTILUS_AREA_REGISTRY (MISSION_PLAYERS + 3u) //
#define GELU_FANGS (25u) //
#define GELU_FANGS_RAWS (GELU_FANGS) //
#define GELU_FANGS_DIMENSION (5u) //
#define GELU_WAYS (26u) //
#define GELU_WAYS_RAWS (GELU_WAYS * 2u) //
#define GELU_ORBS (20u) //
#define GELU_ORBS_RAWS (GELU_ORBS) //
#define GELU_LINES (24u) //
#define GELU_LINES_RAWS (GELU_LINES) //
#define GELU_COINS (4u) //
#define GELU_COINS_RAWS (GELU_COINS * 2u) //
#define GELU_GAPS (5u) //
#define GELU_GAPS_RAWS (GELU_GAPS) //
#define GELU_SHINES (16u) //
#define GELU_SHINES_RAWS (GELU_SHINES) //
#define GELU_DROPS (8u) //
#define GELU_DROPS_RAWS (GELU_DROPS) //
#define GELU_FANG_COLOR (coreVector3(1.0f,1.0f,1.0f) * 0.25f) //
#define GELU_FANG_STEP (0.44f) //
#define GELU_WAY_STEP (0.36f) //
#define GELU_POSITIONS (MAX(GELU_FANGS, GELU_WAYS)) //
#define CALOR_LOADS (1u)//(12u) // (disabled)
#define CALOR_LOADS_RAWS (CALOR_LOADS) //
#define CALOR_CHAINS (28u) //
#define CALOR_STARS (MISSION_PLAYERS) //
#define CALOR_STARS_RAWS (CALOR_STARS * (CALOR_CHAINS + 1u)) //
#define CALOR_HAILS (5u) //
#define CALOR_HAILS_RAWS (CALOR_HAILS * 2u) //
#define CALOR_CHESTS (6u) //
#define CALOR_CHESTS_RAWS (CALOR_CHESTS * 2u) //
#define CALOR_CHAIN_CONSTRAINT1 (20.0f) //
#define CALOR_CHAIN_CONSTRAINT2 (46.0f) //
#define CALOR_SWING_SPEED (7.0f) //
#define MUSCUS_GENERATES (40u) //
#define MUSCUS_GENERATES_RAWS (MUSCUS_GENERATES * 2u) //
#define MUSCUS_PEARLS (44u) //
#define MUSCUS_PEARLS_RAWS (MUSCUS_PEARLS * 2u) //
#define MUSCUS_ZOMBIES (3u) //
#define INTRO_MANUALS (13u) //
#define BONUS1_SHELTERS (2u) //
// ****************************************************************
// stage management macros
#define STAGE_MAIN(...) if([this]() {static constexpr coreUint8 A[] = __VA_ARGS__; return cMission::_TakeRange(m_iTakeFrom, m_iTakeTo, A, ARRAY_SIZE(A));}()) this->_AddStage(__LINE__, [this]()
#define STAGE_SUB(i) ((m_iStageSub < (i)) && [&]() {m_iStageSub = (i); m_fStageSubTime = 0.0f; m_fStageSubTimeBefore = 0.0f; return true;}())
#define STAGE_PRE() []()
#define STAGE_FINISH_NOW {this->SkipStage();}
#define STAGE_FINISH_PLAY {if(HAS_FLAG(g_pGame->GetStatus(), GAME_STATUS_PLAY)) STAGE_FINISH_NOW}
#define STAGE_FINISH_AFTER(t) {if(m_fStageTime >= (t)) STAGE_FINISH_NOW}
#define STAGE_MEDAL_GOAL(...) {static constexpr coreFloat A[] = __VA_ARGS__; this->SetMedalGoal(A); STATIC_ASSERT((ARRAY_SIZE(A) == 5u) && (A[0] < A[1]) && (A[1] < A[2]) && (A[2] < A[3]) && (A[3] < A[4]))}
#define STAGE_BOSS(e,...) {if(STAGE_BEGINNING) {STAGE_MEDAL_GOAL(__VA_ARGS__) (e).Resurrect();} if((e).HasStatus(ENEMY_STATUS_DEAD)) STAGE_FINISH_NOW}
#define STAGE_WAVE(i,n,...) {if(STAGE_BEGINNING) {STAGE_MEDAL_GOAL(__VA_ARGS__) this->ActivateWave(i, n);} if(STAGE_CLEARED && !HAS_FLAG(g_pGame->GetStatus(), GAME_STATUS_DEFEATED)) {this->DeactivateWave(); if(this->_UpdateWait()) STAGE_FINISH_NOW}}
#define STAGE_CLEARED (std::all_of(m_aSquad.begin(), m_aSquad.end(), [](const cEnemySquad& oSquad) {return oSquad.IsFinished();}))
#define STAGE_RESURRECT(s,f,t) {STAGE_FOREACH_ENEMY_ALL(s, pEnemy, __i) {if((coreIntW(__i) >= coreIntW(f)) && (coreIntW(__i) <= coreIntW(t))) pEnemy->Resurrect();}); ASSERT((coreIntW(f) <= coreIntW(t)) && (coreIntW(t) < coreIntW((s)->GetNumEnemies())))}
#define STAGE_BADGE(i,b,p) {this->GiveBadge(i, b, p);}
#define STAGE_FAILTROPHY {this->FailTrophy();}
#define STAGE_DELAY_START {UNUSED STAGE_ADD_SQUAD(pDelay, cDummyEnemy, 1u) {pDelay->GetEnemy(0u)->Configure(1, COLOR_SHIP_GREY); pDelay->GetEnemy(0u)->Resurrect(); this->SetDelay(true);});}
#define STAGE_DELAY_START_CLEAR {STAGE_DELAY_START g_pGame->GetBulletManagerEnemy()->ClearBullets(true);}
#define STAGE_DELAY_END {if(this->GetDelay()) m_aSquad.back().GetEnemy(0u)->Kill(false); this->SetDelay(false);}
#define STAGE_SINK_UINT(x) (bIsDead ? r_cast<coreUint32&> (s_aiSink) : (x))
#define STAGE_SINK_FLOAT(x) (bIsDead ? r_cast<coreFloat&> (s_aiSink) : (x))
#define STAGE_SINK_VEC2(x) (bIsDead ? r_cast<coreVector2&>(s_aiSink) : (x))
#define STAGE_ADD_PATH(n) coreSpline2* const OUTPUT n = this->_AddPath (__LINE__, [&](coreSpline2* OUTPUT n)
#define STAGE_ADD_SQUAD(n,t,c) cEnemySquad* const OUTPUT n = this->_AddSquad<t>(__LINE__, (c), [&](cEnemySquad* OUTPUT n)
#define STAGE_COLL_PLAYER_ENEMY(a,b,i,f,...) if(!m_nCollPlayerEnemy) m_nCollPlayerEnemy = ([__VA_ARGS__](cPlayer* OUTPUT a, cEnemy* OUTPUT b, const coreVector3 i, const coreBool f) // NOLINT
#define STAGE_COLL_PLAYER_BULLET(a,b,i,f,...) if(!m_nCollPlayerBullet) m_nCollPlayerBullet = ([__VA_ARGS__](cPlayer* OUTPUT a, cBullet* OUTPUT b, const coreVector3 i, const coreBool f) // NOLINT
#define STAGE_COLL_ENEMY_BULLET(a,b,i,f,...) if(!m_nCollEnemyBullet) m_nCollEnemyBullet = ([__VA_ARGS__](cEnemy* OUTPUT a, cBullet* OUTPUT b, const coreVector3 i, const coreBool f) // NOLINT
#define STAGE_COLL_BULLET_BULLET(a,b,i,f,...) if(!m_nCollBulletBullet) m_nCollBulletBullet = ([__VA_ARGS__](cBullet* OUTPUT a, cBullet* OUTPUT b, const coreVector3 i, const coreBool f) // NOLINT
#define COLL_VAL(x) x = s_cast<std::conditional_t<!std::is_reference_v<decltype(x)>, decltype(x), void>>(x)
#define COLL_REF(x) &x = s_cast<std::conditional_t< std::is_reference_v<decltype(x)>, decltype(x), void>>(x)
#define COLL_THIS this
#define STAGE_FOREACH_PLAYER(e,i) g_pGame->ForEachPlayer ([&](cPlayer* OUTPUT e, const coreUintW i) // NOLINT
#define STAGE_FOREACH_PLAYER_ALL(e,i) g_pGame->ForEachPlayerAll([&](cPlayer* OUTPUT e, const coreUintW i) // NOLINT
#define STAGE_FOREACH_ENEMY(s,e,i) (s)->ForEachEnemy ([&](cEnemy* OUTPUT e, const coreUintW i) // NOLINT
#define STAGE_FOREACH_ENEMY_ALL(s,e,i) (s)->ForEachEnemyAll ([&](cEnemy* OUTPUT e, const coreUintW i) // NOLINT
#define STAGE_GET_START(c) {if((c) > m_iDataSize) {ALIGNED_DELETE(m_piData) STATIC_ASSERT((c) <= 0xFFu) m_iDataSize = (c); m_piData = ALIGNED_NEW(coreUint32, m_iDataSize, ALIGNMENT_CACHE); std::memset(m_piData, 0, sizeof(coreUint32) * m_iDataSize);}} coreUintW iDataIndex = 0u; constexpr coreUintW iCurDataSize = (c);
#define STAGE_GET_END {ASSERT(iDataIndex == iCurDataSize)}
#define STAGE_GET_INT(n,...) coreInt32& n = r_cast<coreInt32&> ( m_piData[iDataIndex]); iDataIndex += 1u; {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_UINT(n,...) coreUint32& n = r_cast<coreUint32&> ( m_piData[iDataIndex]); iDataIndex += 1u; {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_UINT64(n,...) coreUint64& n = r_cast<coreUint64&> ( m_piData[iDataIndex]); iDataIndex += 2u; {if(STAGE_BEGINNING) {__VA_ARGS__;}} ASSERT(coreMath::IsAligned(iDataIndex, 2u))
#define STAGE_GET_FLOAT(n,...) coreFloat& n = r_cast<coreFloat&> ( m_piData[iDataIndex]); iDataIndex += 1u; {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_VEC2(n,...) coreVector2& n = r_cast<coreVector2&>( m_piData[iDataIndex]); iDataIndex += 2u; {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_VEC3(n,...) coreVector3& n = r_cast<coreVector3&>( m_piData[iDataIndex]); iDataIndex += 3u; {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_VEC4(n,...) coreVector4& n = r_cast<coreVector4&>( m_piData[iDataIndex]); iDataIndex += 4u; {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_INT_ARRAY(n,c,...) coreInt32* const OUTPUT n = r_cast<coreInt32*> (&m_piData[iDataIndex]); iDataIndex += 1u * (c); {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_UINT_ARRAY(n,c,...) coreUint32* const OUTPUT n = r_cast<coreUint32*> (&m_piData[iDataIndex]); iDataIndex += 1u * (c); {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_UINT64_ARRAY(n,c,...) coreUint64* const OUTPUT n = r_cast<coreUint64*> (&m_piData[iDataIndex]); iDataIndex += 2u * (c); {if(STAGE_BEGINNING) {__VA_ARGS__;}} ASSERT(coreMath::IsAligned(iDataIndex, 2u))
#define STAGE_GET_FLOAT_ARRAY(n,c,...) coreFloat* const OUTPUT n = r_cast<coreFloat*> (&m_piData[iDataIndex]); iDataIndex += 1u * (c); {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_VEC2_ARRAY(n,c,...) coreVector2* const OUTPUT n = r_cast<coreVector2*>(&m_piData[iDataIndex]); iDataIndex += 2u * (c); {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_VEC3_ARRAY(n,c,...) coreVector3* const OUTPUT n = r_cast<coreVector3*>(&m_piData[iDataIndex]); iDataIndex += 3u * (c); {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_GET_VEC4_ARRAY(n,c,...) coreVector4* const OUTPUT n = r_cast<coreVector4*>(&m_piData[iDataIndex]); iDataIndex += 4u * (c); {if(STAGE_BEGINNING) {__VA_ARGS__;}}
#define STAGE_LIFETIME(e,m,a) \
UNUSED const coreFloat fLifeSpeed = (m); \
UNUSED const coreFloat fLifeOffset = (a); \
UNUSED const coreFloat fLifeTimeBase = (e)->GetLifeTime() * fLifeSpeed - fLifeOffset; \
UNUSED const coreFloat fLifeTimeBeforeBase = (e)->GetLifeTimeBefore() * fLifeSpeed - fLifeOffset; \
UNUSED coreFloat fLifeTime = fLifeTimeBase; \
UNUSED coreFloat fLifeTimeBefore = fLifeTimeBeforeBase; \
UNUSED const coreBool bIsDead = (e)->HasStatus(ENEMY_STATUS_DEAD);
#define STAGE_BRANCH(x,y) ((fLifeTime < (x)) || [&]() {fLifeTime = FMOD(fLifeTime - (x), (y)); fLifeTimeBefore = FMOD(fLifeTimeBefore - (x), (y)); if(fLifeTimeBefore > fLifeTime) fLifeTimeBefore -= (y); return false;}())
#define STAGE_REPEAT(x) {if(STAGE_BRANCH(x, x)) {}}
#define STAGE_TICK_EXTERN(a,b,c,o) (cMission::_Tick(a, b, c, o))
#define STAGE_TICK_FREE(c,o) ((m_fStageTimeBefore >= 0.0f) && STAGE_TICK_EXTERN(m_fStageTime, m_fStageTimeBefore, RoundFreq(c), o))
#define STAGE_TICK_FREE2(c,o) ((m_fStageSubTimeBefore >= 0.0f) && STAGE_TICK_EXTERN(m_fStageSubTime, m_fStageSubTimeBefore, RoundFreq(c), o))
#define STAGE_TICK_TIME(c,o) ((fLifeTimeBeforeBase >= 0.0f) && !bIsDead && STAGE_TICK_FREE (c, o))
#define STAGE_TICK_TIME2(c,o) ((fLifeTimeBeforeBase >= 0.0f) && !bIsDead && STAGE_TICK_FREE2(c, o))
#define STAGE_TICK_LIFETIME(c,o) ((fLifeTimeBeforeBase >= 0.0f) && !bIsDead && STAGE_TICK_EXTERN(fLifeTime, fLifeTimeBefore, RoundFreq((c) * fLifeSpeed) / fLifeSpeed, o)) // # normal division
#define STAGE_TICK_LIFETIME_BASE(c,o) ((fLifeTimeBeforeBase >= 0.0f) && !bIsDead && STAGE_TICK_EXTERN(fLifeTimeBase, fLifeTimeBeforeBase, RoundFreq((c) * fLifeSpeed) / fLifeSpeed, o))
#define STAGE_TIME_POINT(t) (InBetween((t), m_fStageTimeBefore, m_fStageTime))
#define STAGE_TIME_BEFORE(t) (m_fStageTime < (t))
#define STAGE_TIME_AFTER(t) (m_fStageTime >= (t))
#define STAGE_TIME_BETWEEN(t,u) (InBetween(m_fStageTime, (t), (u)))
#define STAGE_BEGINNING (STAGE_TIME_POINT(0.0f))
#define STAGE_SUBTIME_POINT(t) (InBetween((t), m_fStageSubTimeBefore, m_fStageSubTime))
#define STAGE_SUBTIME_BEFORE(t) (m_fStageSubTime < (t))
#define STAGE_SUBTIME_AFTER(t) (m_fStageSubTime >= (t))
#define STAGE_SUBTIME_BETWEEN(t,u) (InBetween(m_fStageSubTime, (t), (u)))
#define STAGE_BEGINNING2 ((STAGE_SUBTIME_POINT(0.0f) && (m_fStageSubTimeBefore != 0.0f)) || (m_fStageSubTime == 0.0f))
#define STAGE_LIFETIME_POINT(t) (InBetween((t), fLifeTimeBefore, fLifeTime) && [&]() {s_fLifeTimePoint = (t); return true;}())
#define STAGE_LIFETIME_BEFORE(t) (fLifeTime < (t) && fLifeTime >= 0.0f)
#define STAGE_LIFETIME_BEFORE_BASE(t) (fLifeTimeBase < (t) && fLifeTimeBase >= 0.0f)
#define STAGE_LIFETIME_AFTER(t) (fLifeTime >= (t))
#define STAGE_LIFETIME_AFTER_BASE(t) (fLifeTimeBase >= (t))
#define STAGE_LIFETIME_BETWEEN(t,u) (InBetween(fLifeTime, (t), (u)))
#define STAGE_TAKEOFF ([&]() {ASSERT(fLifeOffset >= 0.0f)}(), (InBetween(0.0f, fLifeTimeBeforeBase, fLifeTimeBase) && (fLifeTimeBeforeBase != 0.0f)) || (fLifeTimeBase == 0.0f))
#define STAGE_HEALTHPCT_POINT(e,t) ((e)->ReachedHealthPct(t) && [&]() {s_fHealthPctPoint = (t); return true;}())
#define STAGE_HEALTHPCT_BEFORE(e,t) ((e)->GetCurHealthPct() < (t))
#define STAGE_HEALTHPCT_AFTER(e,t) ((e)->GetCurHealthPct() >= (t))
#define STAGE_HEALTHPCT_BETWEEN(e,t,u) (InBetween((e)->GetCurHealthPct(), (t), (u)))
#define STAGE_DIED(e) ((e)->ReachedDeath())
#define STAGE_POSITION_POINT(e,t,v) (InBetweenExt((t), (e)->GetOldPos().v, (e)->GetPosition().v) && [&]() {s_vPositionPoint = (e)->GetPosition().xy(); s_vPositionPoint.v = (t); return true;}())
#define STAGE_POSITION_BEFORE(e,t,v) ((e)->GetPosition().v < (t))
#define STAGE_POSITION_AFTER(e,t,v) ((e)->GetPosition().v >= (t))
#define STAGE_POSITION_BETWEEN(e,t,u,v) (InBetweenExt((e)->GetPosition().v, (t), (u)))
#define STAGE_FLYPAST(e,f,v) \
((e)->GetPosition().v < (f)->GetPosition().v) ^ \
((e)->GetPosition().v < (f)->GetOldPos ().v) || \
((e)->GetOldPos ().v < (f)->GetPosition().v) ^ \
((e)->GetOldPos ().v < (f)->GetOldPos ().v) || \
((f)->GetPosition().v < (e)->GetPosition().v) ^ \
((f)->GetPosition().v < (e)->GetOldPos ().v) || \
((f)->GetOldPos ().v < (e)->GetPosition().v) ^ \
((f)->GetOldPos ().v < (e)->GetOldPos ().v)
// ****************************************************************
// mission interface
class INTERFACE cMission
{
private:
//
using uCollPlayerEnemyType = std::function<void(cPlayer* OUTPUT, cEnemy* OUTPUT, const coreVector3, const coreBool)>;
using uCollPlayerBulletType = std::function<void(cPlayer* OUTPUT, cBullet* OUTPUT, const coreVector3, const coreBool)>;
using uCollEnemyBulletType = std::function<void(cEnemy* OUTPUT, cBullet* OUTPUT, const coreVector3, const coreBool)>;
using uCollBulletBulletType = std::function<void(cBullet* OUTPUT, cBullet* OUTPUT, const coreVector3, const coreBool)>;
protected:
cBoss* m_apBoss[MISSION_BOSSES]; // pointers to all available bosses
cBoss* m_pCurBoss; // pointer to currently active boss
coreUintW m_iCurBossIndex; // index of the active boss (or error-value)
coreUintW m_iCurWaveIndex; //
coreUintW m_iCurSegmentIndex; //
coreUintW m_iLastSegmentIndex; //
coreMap<coreUint16, std::function<void()>> m_anStage; //
coreMap<coreUint16, coreSpline2> m_aPath; //
coreMap<coreUint16, cEnemySquad> m_aSquad; //
coreUint32* m_piData; //
coreUint8 m_iDataSize; //
coreUint16 m_iStageNum; //
coreFlow m_fStageTime; //
coreFloat m_fStageTimeBefore; //
coreUint8 m_iStageSub; //
coreFlow m_fStageSubTime; //
coreFloat m_fStageSubTimeBefore; //
coreFlow m_fStageWait; //
const coreFloat* m_pfMedalGoal; //
coreUint8 m_iBadgeGiven; //
coreBool m_bTrophyFailed; //
coreUint8 m_iRecordBroken; //
uCollPlayerEnemyType m_nCollPlayerEnemy; //
uCollPlayerBulletType m_nCollPlayerBullet; //
uCollEnemyBulletType m_nCollEnemyBullet; //
uCollBulletBulletType m_nCollBulletBullet; //
coreUint8 m_iTakeFrom; //
coreUint8 m_iTakeTo; //
coreUint8 m_iOutroSub; //
coreBool m_bDelay; //
coreBool m_bRepeat; //
static coreUint16 s_iTick; //
static coreFloat s_fLifeTimePoint; //
static coreFloat s_fHealthPctPoint; //
static coreVector2 s_vPositionPoint; //
static coreUint32 s_aiSink[2]; //
public:
cMission()noexcept;
virtual ~cMission();
DISABLE_COPY(cMission)
ENABLE_ID
ENABLE_EXTRA
// setup the mission
void Setup(const coreUint8 iTakeFrom, const coreUint8 iTakeTo);
//
void Open();
void Close();
// render and move the mission
void RenderBottom();
void RenderUnder ();
void RenderOver ();
void RenderTop ();
void MoveAlways ();
void MoveBefore ();
void MoveMiddle ();
void MoveAfter ();
//
void SkipStage ();
inline coreBool IsFinished()const {return m_anStage.empty();}
//
void ActivateBoss (const cBoss* pBoss);
void DeactivateBoss();
//
void ActivateWave (const coreUintW iIndex, const coreChar* pcName);
void DeactivateWave();
//
inline void SetMedalGoal(const coreFloat* pfMedalGoal) {m_pfMedalGoal = pfMedalGoal; ASSERT(pfMedalGoal)}
//
void GiveBadge(const coreUintW iIndex, const coreUint8 iBadge, const coreVector3 vPosition);
//
inline void FailTrophy() {m_bTrophyFailed = true;}
//
void AddExtraScore(cPlayer* OUTPUT pPlayer, const coreUint32 iScore, const coreVector3 vPosition);
//
inline void SetDelay(const coreBool bDelay) {m_bDelay = bDelay;}
//
inline void CollPlayerEnemy (cPlayer* OUTPUT pPlayer, cEnemy* OUTPUT pEnemy, const coreVector3 vIntersection, const coreBool bFirstHit) {if(m_nCollPlayerEnemy) m_nCollPlayerEnemy (pPlayer, pEnemy, vIntersection, bFirstHit);}
inline void CollPlayerBullet(cPlayer* OUTPUT pPlayer, cBullet* OUTPUT pBullet, const coreVector3 vIntersection, const coreBool bFirstHit) {if(m_nCollPlayerBullet) m_nCollPlayerBullet(pPlayer, pBullet, vIntersection, bFirstHit);}
inline void CollEnemyBullet (cEnemy* OUTPUT pEnemy, cBullet* OUTPUT pBullet, const coreVector3 vIntersection, const coreBool bFirstHit) {if(m_nCollEnemyBullet) m_nCollEnemyBullet (pEnemy, pBullet, vIntersection, bFirstHit);}
inline void CollBulletBullet(cBullet* OUTPUT pPlayerBullet, cBullet* OUTPUT pEnemyBullet, const coreVector3 vIntersection, const coreBool bFirstHit) {if(m_nCollBulletBullet) m_nCollBulletBullet(pPlayerBullet, pEnemyBullet, vIntersection, bFirstHit);}
//
template <typename F> inline void SetCollPlayerEnemy (F&& nCollFunc) {if(!m_nCollPlayerEnemy) m_nCollPlayerEnemy = std::forward<F>(nCollFunc);} // [](cPlayer* OUTPUT pPlayer, cEnemy* OUTPUT pEnemy, const coreVector3 vIntersection, const coreBool bFirstHit) -> void
template <typename F> inline void SetCollPlayerBullet(F&& nCollFunc) {if(!m_nCollPlayerBullet) m_nCollPlayerBullet = std::forward<F>(nCollFunc);} // [](cPlayer* OUTPUT pPlayer, cBullet* OUTPUT pBullet, const coreVector3 vIntersection, const coreBool bFirstHit) -> void
template <typename F> inline void SetCollEnemyBullet (F&& nCollFunc) {if(!m_nCollEnemyBullet) m_nCollEnemyBullet = std::forward<F>(nCollFunc);} // [](cEnemy* OUTPUT pEnemy, cBullet* OUTPUT pBullet, const coreVector3 vIntersection, const coreBool bFirstHit) -> void
template <typename F> inline void SetCollBulletBullet(F&& nCollFunc) {if(!m_nCollBulletBullet) m_nCollBulletBullet = std::forward<F>(nCollFunc);} // [](cBullet* OUTPUT pPlayerBullet, cBullet* OUTPUT pEnemyBullet, const coreVector3 vIntersection, const coreBool bFirstHit) -> void
//
inline void ResetCollPlayerEnemy () {m_nCollPlayerEnemy = NULL;}
inline void ResetCollPlayerBullet() {m_nCollPlayerBullet = NULL;}
inline void ResetCollEnemyBullet () {m_nCollEnemyBullet = NULL;}
inline void ResetCollBulletBullet() {m_nCollBulletBullet = NULL;}
//
inline coreBool HasCollBulletBullet()const {return (m_nCollBulletBullet != NULL);}
// access mission objects
inline cBoss* GetBoss (const coreUintW iIndex)const {ASSERT(iIndex < MISSION_BOSSES) return m_apBoss[iIndex];}
inline cBoss* GetCurBoss ()const {return m_pCurBoss;}
inline const coreUintW& GetCurBossIndex ()const {return m_iCurBossIndex;}
inline const coreUintW& GetCurWaveIndex ()const {return m_iCurWaveIndex;}
inline const coreUintW& GetCurSegmentIndex ()const {return m_iCurSegmentIndex;}
inline const coreUintW& GetLastSegmentIndex()const {return m_iLastSegmentIndex;}
inline cEnemySquad* GetEnemySquad (const coreUintW iIndex) {ASSERT(iIndex < m_aSquad.size()) return &(*(m_aSquad.begin() + iIndex));} // TODO 1: besseres indexieren
inline const coreUint8& GetStageSub ()const {return m_iStageSub;}
inline const coreFloat* GetMedalGoal ()const {return m_pfMedalGoal;}
inline const coreBool& GetTrophyFailed ()const {return m_bTrophyFailed;}
inline const coreUint8& GetRecordBroken ()const {return m_iRecordBroken;}
inline const coreUint8& GetTakeFrom ()const {return m_iTakeFrom;}
inline const coreUint8& GetTakeTo ()const {return m_iTakeTo;}
inline const coreBool& GetDelay ()const {return m_bDelay;}
// get object properties
virtual const coreChar* GetMusicName()const {return "";}
protected:
//
template <typename F, typename G> FORCE_INLINE void _AddStage(const coreUint16 iCodeLine, F&& nBodyFunc, G&& nPreFunc); // []() -> void, []() -> void
template <typename F> FORCE_INLINE void _AddStage(const coreUint16 iCodeLine, F&& nBodyFunc); // []() -> void
//
template <typename F> RETURN_RESTRICT coreSpline2* _AddPath (const coreUint16 iCodeLine, F&& nInitFunc); // [](coreSpline2* OUTPUT pPath) -> void
template <typename T, typename F> RETURN_RESTRICT cEnemySquad* _AddSquad(const coreUint16 iCodeLine, const coreUint8 iNum, F&& nInitFunc); // [](cEnemySquad* OUTPUT pSquad) -> void
//
inline coreBool _UpdateWait() {m_fStageWait.UpdateMax(-1.0f, 0.0f); return !m_fStageWait;}
//
static inline coreBool _Tick(const coreFloat fTime, const coreFloat fTimeOld, const coreFloat fFactor, const coreFloat fOffset) {return (s_iTick = F_TO_UI(fTime * (fFactor + CORE_MATH_PRECISION) - fOffset) - 1u) != coreUint16(F_TO_UI(fTimeOld * (fFactor + CORE_MATH_PRECISION) - fOffset) - 1u);}
//
static constexpr FUNC_LOCAL coreBool _TakeRange(const coreUint8 iFrom, const coreUint8 iTo, const coreUint8* piIndexList, const coreUintW iSize);
private:
// own routines for derived classes
virtual void __SetupOwn () {}
virtual void __RenderOwnBottom() {}
virtual void __RenderOwnUnder () {}
virtual void __RenderOwnOver () {}
virtual void __RenderOwnTop () {}
virtual void __MoveOwnAlways () {}
virtual void __MoveOwnBefore () {}
virtual void __MoveOwnMiddle () {}
virtual void __MoveOwnAfter () {}
//
void __OpenSegment ();
void __CloseSegment();
};
// ****************************************************************
// empty mission class
class cNoMission final : public cMission
{
public:
cNoMission() = default;
DISABLE_COPY(cNoMission)
ASSIGN_ID(0, "NOTHING")
ASSIGN_EXTRA("")
};
// ****************************************************************
// Virido mission class
class cViridoMission final : public cMission
{
private:
cTorusBoss m_Torus; //
coreBatchList m_Ball; //
coreBatchList m_BallTrail; //
coreObject3D m_aBallRaw[VIRIDO_BALLS_RAWS]; //
coreObject3D m_aPaddle [VIRIDO_PADDLES]; //
coreObject3D m_aPaddleSphere[VIRIDO_PADDLES]; //
const cShip* m_apPaddleOwner[VIRIDO_PADDLES]; //
coreBatchList m_Barrier1; //
coreBatchList m_Barrier2; //
coreObject3D m_aBarrierRaw [VIRIDO_BARRIERS_RAWS]; //
const cShip* m_apBarrierOwner[VIRIDO_BARRIERS]; //
coreVector2 m_avBarrierPos [VIRIDO_BARRIERS]; //
coreVector2 m_avBarrierDir [VIRIDO_BARRIERS]; //
coreFloat m_fBarrierRange; //
coreBool m_bBarrierSlow; //
coreBool m_bBarrierClamp; //
coreBool m_bBarrierReflect; //
coreBool m_bBarrierIgnore; //
coreUint8 m_iBarrierBounce; //
coreBatchList m_Laser; //
coreBatchList m_LaserWave; //
coreObject3D m_aLaserRaw [VIRIDO_LASERS_RAWS]; //
const cShip* m_apLaserOwner[VIRIDO_LASERS]; //
coreVector2 m_avLaserPos [VIRIDO_LASERS]; //
coreVector2 m_avLaserDir [VIRIDO_LASERS]; //
coreFlow m_afLaserTick [MISSION_PLAYERS]; //
coreUint8 m_iLaserTouch; //
coreUint8 m_iLaserIgnore; //
coreBool m_bLaserCross; //
coreBatchList m_Shadow; //
coreObject3D m_aShadowRaw [VIRIDO_SHADOWS_RAWS]; //
const cShip* m_apShadowOwner[VIRIDO_SHADOWS]; //
coreUint32 m_iShadowType; //
coreBatchList m_Hint; //
coreObject3D m_aHintRaw [VIRIDO_HINTS_RAWS]; //
coreUint8 m_aiHintBarrier[VIRIDO_HINTS_RAWS]; //
coreUint16 m_iHintActive; //
coreBatchList m_Bean; //
coreBatchList m_BeanWave; //
coreObject3D m_aBeanRaw[VIRIDO_BEANS_RAWS]; //
cCustomEnemy m_Globe; //
coreObject3D m_GlobeWave; //
coreObject3D m_Target; //
coreObject3D m_aTargetWave[2]; //
coreUint16 m_aiDrumCount[VIRIDO_DRUMS]; //
coreUint8 m_aiDrumIndex[VIRIDO_DRUMS]; //
coreFlow m_fPoleCount; //
coreUint8 m_iPoleIndex; //
coreUint8 m_iRealState; //
coreUint8 m_iStickyState; // (only between first ball and first paddle)
coreUint8 m_iBounceState; //
coreFlow m_fAnimation; // animation value
coreBool m_bStory; //
public:
cViridoMission()noexcept;
~cViridoMission()final;
DISABLE_COPY(cViridoMission)
ASSIGN_ID(1, "VIRIDO")
ASSIGN_EXTRA("ビリッド")
//
void EnableBall (const coreUintW iIndex, const coreVector2 vPosition, const coreVector2 vDirection);
void DisableBall(const coreUintW iIndex, const coreBool bAnimated);
//
void EnablePaddle (const coreUintW iIndex, const cShip* pOwner);
void DisablePaddle(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableBarrier (const coreUintW iIndex, const cShip* pOwner, const coreVector2 vDirection, const coreFloat fScale);
void DisableBarrier(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableLaser (const coreUintW iIndex, const cShip* pOwner);
void DisableLaser(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableShadow (const coreUintW iIndex, const cShip* pOwner, const coreVector2 vPosition, const coreBool bQuad);
void DisableShadow(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableHint (const coreUintW iIndex, const coreUintW iBarrier);
void DisableHint(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableBean (const coreUintW iIndex);
void DisableBean(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableGlobe ();
void DisableGlobe(const coreBool bAnimated);
//
void EnableTarget ();
void DisableTarget(const coreBool bAnimated);
//
void StartDrumBeat(const coreUintW iDrum, const coreUintW iBarrier);
void EndDrumBeat (const coreUintW iDrum, const coreBool bAnimated);
//
void StartPoleDance(const coreUintW iIndex);
void EndPoleDance (const coreBool bAnimated);
//
void SetBarrierScale (const coreUintW iIndex, const coreFloat fScale);
inline void SetBarrierRange (const coreFloat fRange) {m_fBarrierRange = fRange;}
inline void SetBarrierSlow (const coreBool bSlow) {m_bBarrierSlow = bSlow;}
inline void SetBarrierClamp (const coreBool bClamp) {m_bBarrierClamp = bClamp;}
inline void SetBarrierReflect(const coreBool bReflect) {m_bBarrierReflect = bReflect;}
inline void SetBarrierIgnore (const coreBool bIgnore) {m_bBarrierIgnore = bIgnore;}
//
inline void SetLaserIgnore(const coreUint8 iIgnore) {m_iLaserIgnore = iIgnore;}
inline void SetLaserCross (const coreBool bCross) {m_bLaserCross = bCross;}
//
inline void SetHintActive(const coreUintW iIndex, const coreBool bActive) {ASSERT(iIndex < VIRIDO_HINTS) SET_BIT(m_iHintActive, iIndex, bActive)}
//
inline void MakeReal (const coreUintW iIndex) {ADD_BIT(m_iRealState, iIndex)}
inline void MakeSticky () {ADD_BIT(m_iStickyState, 0u)}
inline void UnmakeSticky(const coreVector2 vDirection) {m_iStickyState = 0; m_aBallRaw[0].SetDirection(coreVector3(vDirection, 0.0f));}
//
inline const coreUint8& GetRealState ()const {return m_iRealState;}
inline coreBool GetStickyState()const {return HAS_BIT(m_iStickyState, 1u);}
inline const coreUint8& GetBounceState()const {return m_iBounceState;}
//
inline coreObject3D* GetBall (const coreUintW iIndex) {ASSERT(iIndex < VIRIDO_BALLS) return &m_aBallRaw [iIndex * (VIRIDO_TRAILS + 1u)];}
inline coreObject3D* GetPaddle (const coreUintW iIndex) {ASSERT(iIndex < VIRIDO_PADDLES) return &m_aPaddle [iIndex];}
inline coreObject3D* GetBarrier(const coreUintW iIndex) {ASSERT(iIndex < VIRIDO_BARRIERS) return &m_aBarrierRaw[iIndex];}
inline coreObject3D* GetLaser (const coreUintW iIndex) {ASSERT(iIndex < VIRIDO_LASERS) return &m_aLaserRaw [iIndex * 2u];}
inline coreObject3D* GetBean (const coreUintW iIndex) {ASSERT(iIndex < VIRIDO_BEANS) return &m_aBeanRaw [iIndex * 2u];}
// get object properties
inline const coreChar* GetMusicName()const final {return "mission_01_intro";}
private:
// execute own routines
void __SetupOwn ()final;
void __RenderOwnUnder()final;
void __RenderOwnOver ()final;
void __RenderOwnTop ()final;
void __MoveOwnBefore ()final;
void __MoveOwnAfter ()final;
//
static void __BounceEffect(const coreVector2 vEffectPos);
};
// ****************************************************************
// Nevo mission class
class cNevoMission final : public cMission
{
private:
cLeviathanBoss m_Leviathan; //
coreBatchList m_Bomb; //
cLodObject m_aBombRaw [NEVO_BOMBS_RAWS]; //
coreFlow m_afBombTime[NEVO_BOMBS]; //
coreUint32 m_iBombGone; //
coreBatchList m_Blast; //
coreBatchList m_BlastLine; //
coreObject3D m_aBlastRaw [NEVO_BLASTS_RAWS]; //
coreFlow m_afBlastTime[NEVO_BLASTS]; //
coreBatchList m_Tile; //
coreObject3D m_aTileRaw [NEVO_TILES_RAWS]; //
coreFlow m_afTileTime[NEVO_TILES]; //
coreBatchList m_Arrow; //
coreObject3D m_aArrowRaw [NEVO_ARROWS_RAWS]; //
const cShip* m_apArrowOwner[NEVO_ARROWS]; //
coreFloat m_afArrowAlpha[NEVO_ARROWS]; //
coreUint8 m_aiArrowDir [NEVO_ARROWS]; //
coreUint8 m_iArrowActive; //
coreUint64 m_iArrowFake; //
coreBool m_bArrowEnabled; //
coreBatchList m_Block; //
coreBatchList m_BlockWave; //
coreObject3D m_aBlockRaw [NEVO_BLOCKS_RAWS]; //
const cShip* m_apBlockOwner[NEVO_BLOCKS]; //
coreFloat m_afBlockScale[NEVO_BLOCKS]; //
coreFloat m_afBlockRota [NEVO_BLOCKS]; //
coreObject3D m_aScrap [NEVO_SCRAPS]; //
coreFlow m_afScrapTime[NEVO_SCRAPS]; //
coreBatchList m_Chip; //
coreBatchList m_ChipWave; //
coreObject3D m_aChipRaw [NEVO_CHIPS_RAWS]; //
coreFlow m_afChipTime[NEVO_CHIPS]; //
coreObject3D m_Guide; //
coreObject3D m_Trend; //
cLodObject m_Container; //
coreVector2 m_vForce; //
coreVector2 m_vImpact; //
coreBool m_bClamp; //
coreBool m_bOverdraw; //
coreObject3D m_aStoryRange[2]; //
coreFlow m_fStoryRangeAnim; //
coreDummyPtr m_apResCache[23]; //
coreSoundPtr m_pNightmareSound; //
coreFlow m_fAnimation; // animation value
coreBool m_bStory; //
public:
cNevoMission()noexcept;
~cNevoMission()final;
DISABLE_COPY(cNevoMission)
ASSIGN_ID(2, "NEVO")
ASSIGN_EXTRA("ネボ")
//
void EnableBomb (const coreUintW iIndex, const coreBool bGrow);
void DisableBomb(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableBlast (const coreUintW iIndex);
void DisableBlast(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableTile (const coreUintW iIndex, const coreUintW iDimension);
void DisableTile(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableArrow (const coreUintW iIndex, const cShip* pOwner, const coreVector2 vDirection);
void DisableArrow(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableBlock (const coreUintW iIndex, const cShip* pOwner, const coreFloat fScale);
void DisableBlock(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableScrap (const coreUintW iIndex, const coreVector2 vPosition);
void DisableScrap(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableChip (const coreUintW iIndex);
void DisableChip(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableGuide ();
void DisableGuide(const coreBool bAnimated);
//
void EnableTrend ();
void DisableTrend(const coreBool bAnimated);
//
void EnableContainer (const coreVector2 vPosition);
void DisableContainer(const coreBool bAnimated);
//
void EnableRanges ();
void DisableRanges(const coreBool bAnimated);
//
void SetTileStyle(const coreUintW iIndex, const coreUint8 iStyle);
//
inline coreBool IsTileEnabled(const coreUintW iIndex)const {ASSERT(iIndex < NEVO_TILES) return (m_afTileTime[iIndex] > 0.0f);}
//
inline void SetArrowDir (const coreUintW iIndex, const coreVector2 vDirection) {ASSERT(iIndex < NEVO_ARROWS) m_aiArrowDir[iIndex] = PackDirection(vDirection);}
inline void SetArrowFake (const coreUintW iIndex) {ASSERT(iIndex < NEVO_ARROWS) ASSERT(m_aArrowRaw[iIndex].IsEnabled(CORE_OBJECT_ENABLE_MOVE)) ADD_BIT(m_iArrowFake, iIndex)}
inline void SetArrowEnabled(const coreBool bEnabled) {m_bArrowEnabled = bEnabled;}
//
inline void SetContainerForce (const coreVector2 vForce) {m_vForce = vForce;}
inline void SetContainerClamp (const coreBool bClamp) {m_bClamp = bClamp;}
inline void SetContainerOverdraw(const coreBool bOverdraw) {m_bOverdraw = bOverdraw;}
//
inline coreFloat GetBombTime (const coreUintW iIndex)const {ASSERT(iIndex < NEVO_BOMBS) return m_afBombTime[iIndex];}
inline coreBool GetBombGone (const coreUintW iIndex)const {ASSERT(iIndex < NEVO_BOMBS) return HAS_BIT(m_iBombGone, iIndex);}
inline const coreUint8& GetArrowDir (const coreUintW iIndex)const {ASSERT(iIndex < NEVO_ARROWS) return m_aiArrowDir[iIndex];}
inline coreBool GetArrowFake (const coreUintW iIndex)const {ASSERT(iIndex < NEVO_ARROWS) return HAS_BIT(m_iArrowFake, iIndex);}
inline const coreBool& GetArrowEnabled ()const {return m_bArrowEnabled;}
inline const coreVector2& GetContainerForce ()const {return m_vForce;}
inline const coreVector2& GetContainerImpact()const {return m_vImpact;}
//
inline cLodObject* GetBomb (const coreUintW iIndex) {ASSERT(iIndex < NEVO_BOMBS) return &m_aBombRaw[iIndex];}
inline coreObject3D* GetTile (const coreUintW iIndex) {ASSERT(iIndex < NEVO_TILES) return &m_aTileRaw[iIndex];}
inline coreObject3D* GetChip (const coreUintW iIndex) {ASSERT(iIndex < NEVO_CHIPS) return &m_aChipRaw[iIndex * 2u];}
inline cLodObject* GetContainer() {return &m_Container;}
// get object properties
inline const coreChar* GetMusicName()const final {return "mission_02_intro";}
private:
// execute own routines
void __SetupOwn ()final;
void __RenderOwnBottom()final;
void __RenderOwnUnder ()final;
void __RenderOwnOver ()final;
void __RenderOwnTop ()final;
void __MoveOwnAfter ()final;
};
// ****************************************************************
// Harena mission class
class cHarenaMission final : public cMission
{
private:
//
struct sChildData final
{
coreVector2 vPosition; //
coreVector2 vMove; //
coreUint8 iType; //
};
private:
cTigerBoss m_Tiger; //
coreList<sChildData> m_avChildData; //
coreBatchList m_Floor; //
coreObject3D m_aFloorRaw [HARENA_FLOORS_RAWS]; //
const cShip* m_apFloorOwner[HARENA_FLOORS]; //
coreBatchList m_Spike; //
coreBatchList m_SpikeBoard; //
coreObject3D m_aSpikeRaw [HARENA_SPIKES_RAWS]; //
coreFlow m_afSpikeTime[HARENA_SPIKES]; //
coreFlow m_afSpikeCur [HARENA_SPIKES]; //
coreFloat m_afSpikeMax [HARENA_SPIKES]; //
coreUint64 m_iSpikeGood; //
coreUint64 m_iSpikeBad; //
coreObject3D m_Correct; //
coreBatchList m_Egg; //
coreBatchList m_EggWave; //
coreObject3D m_aEggRaw[HARENA_EGGS_RAWS]; //
coreBatchList m_Flummi; //
coreObject3D m_aFlummiRaw[HARENA_FLUMMIS_RAWS]; //
coreObject3D m_Aim; //
std::function<void()> m_aInsanityStage[5]; //
coreUint8 m_iInsanity; //
coreFlow m_fAnimation; // animation value#
coreBool m_bStory; //
public:
cHarenaMission()noexcept;
~cHarenaMission()final;
DISABLE_COPY(cHarenaMission)
ASSIGN_ID(3, "HARENA")
ASSIGN_EXTRA("ハレーナ")
//
void EnableFloor (const coreUintW iIndex, const cShip* pOwner, const coreFloat fScale);
void DisableFloor(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableSpike (const coreUintW iIndex, const coreBool bDelayed);
void DisableSpike(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableCorrect ();
void DisableCorrect(const coreBool bAnimated);
//
void EnableEgg (const coreUintW iIndex);
void DisableEgg(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableFlummi (const coreUintW iIndex);
void DisableFlummi(const coreUintW iIndex, const coreBool bAnimated);
//
void EnableAim ();
void DisableAim(const coreBool bAnimated);
//
void CreateExternChild(const coreVector2 vPosition, const coreVector2 vMove, const coreUint8 iType);
//
inline void LaunchSpike (const coreUintW iIndex, const coreFloat fTime, const coreBool bGood = false) {ASSERT(iIndex < HARENA_SPIKES) ASSERT(fTime > HARENA_SPIKE_LAUNCH + HARENA_SPIKE_FADE) m_afSpikeCur[iIndex] = 0.0f; m_afSpikeMax[iIndex] = fTime; SET_BIT(m_iSpikeGood, iIndex, bGood)}
inline void RetractSpike(const coreUintW iIndex) {ASSERT(iIndex < HARENA_SPIKES) if(m_afSpikeMax[iIndex]) m_afSpikeCur[iIndex] = MAX(m_afSpikeCur[iIndex], m_afSpikeMax[iIndex] - HARENA_SPIKE_FADE); ADD_BIT(m_iSpikeBad, iIndex)}
//
void PlayInsanity();
void ChangeInsanity(const coreUint8 iInsanity);
void ChangeInsanityP1();
//
void CrashEnemy(cEnemy* OUTPUT pEnemy)const;
//
inline coreBool GetSpikeLaunched(const coreUintW iIndex)const {ASSERT(iIndex < HARENA_SPIKES) return (m_afSpikeMax[iIndex] && InBetween(m_afSpikeCur[iIndex], HARENA_SPIKE_LAUNCH + 0.1f, m_afSpikeMax[iIndex] - HARENA_SPIKE_FADE));}
inline coreBool GetSpikeQuiet (const coreUintW iIndex)const {ASSERT(iIndex < HARENA_SPIKES) return (m_afSpikeMax[iIndex] == 0.0f);}
inline coreBool GetSpikeGood (const coreUintW iIndex)const {ASSERT(iIndex < HARENA_SPIKES) return (m_afSpikeMax[iIndex] && InBetween(m_afSpikeCur[iIndex], 0.0f, m_afSpikeMax[iIndex] - HARENA_SPIKE_FADE * 0.5f) && HAS_BIT(m_iSpikeGood, iIndex) && !HAS_BIT(m_iSpikeBad, iIndex));}
//
inline coreObject3D* GetSpikeBoard(const coreUintW iIndex) {ASSERT(iIndex < HARENA_SPIKES) return &m_aSpikeRaw [iIndex * 2u + 1u];}
inline coreObject3D* GetEgg (const coreUintW iIndex) {ASSERT(iIndex < HARENA_EGGS) return &m_aEggRaw [iIndex * 2u];}
inline coreObject3D* GetFlummi (const coreUintW iIndex) {ASSERT(iIndex < HARENA_FLUMMIS) return &m_aFlummiRaw[iIndex];}
// get object properties
inline const coreChar* GetMusicName()const final {return "mission_03_intro";}
private:
// execute own routines
void __SetupOwn ()final;
void __RenderOwnBottom()final;
void __RenderOwnUnder ()final;
void __RenderOwnTop ()final;
void __MoveOwnAfter ()final;
};
// ****************************************************************
// Rutilus mission class
class cRutilusMission final : public cMission
{
private:
cMessierBoss m_Messier; //
coreObject3D m_aTeleporter [RUTILUS_TELEPORTER]; //
coreVector2 m_avTeleporterPrev[RUTILUS_TELEPORTER]; //
coreVector2 m_avTeleporterRota[RUTILUS_TELEPORTER]; //
coreUint8 m_iTeleporterActive; //
coreBatchList m_Plate; //
coreObject3D m_aPlateRaw [RUTILUS_PLATES_RAWS]; //
coreFlow m_afPlateTime [RUTILUS_PLATES]; //
coreFlow m_afPlatePulse[RUTILUS_PLATES]; //
coreFloat m_afPlateSide [RUTILUS_PLATES]; //
coreVector4 m_avPlateData [RUTILUS_PLATES]; //
coreUint8 m_iPlateActive; //
coreUint8 m_iPlateRotated; //
coreObject3D m_aArea[RUTILUS_AREAS]; //
coreFlow m_fAreaTime; //
coreFloat m_fAreaScale; //
coreFloat m_fAreaSpeed; //
coreBool m_bAreaUpdate; //
coreObject3D m_Safe; //
coreFlow m_fSafeTime; //