-
Notifications
You must be signed in to change notification settings - Fork 0
/
0503_cCholBoss.cpp
2322 lines (1829 loc) · 86.6 KB
/
0503_cCholBoss.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"
// - movement in reconstruction phase should be linear, smooth movement feels sluggish, and it's already smoothly interpolated anyway
// - orb-web should not revert too much, so the algorithm can just move forwards (and does not need to move backwards)
// - first direction block wave from left-right should have one line (any) pointing up, first wave from top-bottom should have one line (bottom) pointing up
// - orb-web should move down fast enough (after a short time), so the player cannot keep shooting without being able to move up, but not too fast, so the player still dares to attack
// - boss should only resurrect once, with serveral the player feels more fooled than surprised
// - the flipped shooting during the swing phase is more interesting and removes safe spots
// - make aiming in final phase not too precise, to reduce (unnecessary) pressure, and speed not too high, to allow player to dodge and attack properly
// - in linear reconstruction phase, parts should move to the edge, otherwhise player can simply stand still
// - in still-rotating reconstruction phase, all 4 parts should not shoot into the same direction, otherwise player cannot dodge
// - only one wall should move towards the player, too many sides are too complex (especially with additional bullets) (is already heavy in regular stage), also part impact could only be in the middle per wall as they would quickly get hidden by other walls, and parts would intersect with each other
// - reconsturction phase should have coherent patterns, so that danger is easy to assess, especially because the player control the movement (they shouldn't feel like they have no control)
// - final big explosion is used to highlight that the boss is really finished now
// ACHIEVEMENT: defeat the boss without ever moving yourself
// TODO 1: hard mode: heat and water
// TODO 4: enum for the wingstate
// TODO 1: boss glows after each impact on the ground (and wall ?)
// TODO 1: rotating parts need a glow-effect shortly before flying towards wall, so the player can properly see the danger
// TODO 1: ram-attack from boss and wings need a flame-wave-effect
// ****************************************************************
// counter identifier
#define DEATH_COUNT (0u)
#define STORM_COUNT (1u)
#define PULL_COUNT (2u)
#define INCURSION_COUNT (3u)
#define WAY_COUNT (4u)
#define CONE_COUNT (5u)
#define PLAYER_MOVE (6u)
// ****************************************************************
// vector identifier
#define START_VALUES_POS (0u) // # uses 0u - 4u
#define START_VALUES_DIR (5u) // # uses 5u - 9u
#define WALL_OFFSET (10u)
#define TRANSITION_TIME (11u)
#define ENV_ROTATION (0u) // # re-used
#define CHARGE_MOVE (1u) // # re-used
// ****************************************************************
// constructor
cCholBoss::cCholBoss()noexcept
: m_aiWingState {}
, m_afWingTime {}
, m_avWingReturn {}
, m_fFireFade (0.0f)
, m_iFireType (0u)
, m_bFireActive (false)
, m_fWebLevel (0.0f)
, m_fWebReverse (0.0f)
, m_iWebIndex (0u)
, m_iPathIndex (1u)
, m_iPathSide (2u)
, m_fTilt (0.0f)
, m_fFlap (0.0f)
, m_fPush (0.0f)
, m_fCountdown (0.0f)
, m_fAnimation (0.0f)
{
if(m_bSkipped) return;
// load models
this->DefineModelHigh("ship_boss_chol_body_high.md3");
this->DefineModelLow ("ship_boss_chol_body_low.md3");
this->DefineVolume ("ship_boss_chol_body_volume.md3");
// set object properties
this->SetSize (coreVector3(1.0f,1.0f,1.0f) * 3.0f);
this->SetCollisionModifier(coreVector3(1.0f,1.0f,1.0f) * 1.1f);
// configure the boss
this->Configure(5500, COLOR_SHIP_ORANGE);
this->AddStatus(ENEMY_STATUS_DAMAGING | ENEMY_STATUS_SECRET);
//
PHASE_HEALTH_GOAL({5500, 3500, 3000, 0})
//
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
m_aWing[i].DefineModelHigh ("ship_boss_chol_wing_high.md3");
m_aWing[i].DefineModelLow ("ship_boss_chol_wing_low.md3");
m_aWing[i].DefineVolume ("ship_boss_chol_wing_volume.md3");
m_aWing[i].SetSize (this->GetSize());
m_aWing[i].SetCollisionModifier(this->GetCollisionModifier());
m_aWing[i].Configure (1, COLOR_SHIP_ORANGE);
m_aWing[i].AddStatus (ENEMY_STATUS_DAMAGING | ENEMY_STATUS_IMMORTAL | ENEMY_STATUS_SECRET | ENEMY_STATUS_CHAIN);
m_aWing[i].SetParent (this);
}
//
m_Fire.DefineTexture(0u, "effect_energy.png");
m_Fire.DefineProgram("effect_energy_flat_direct_program");
m_Fire.SetColor3 (COLOR_ENERGY_ORANGE);
m_Fire.SetEnabled (CORE_OBJECT_ENABLE_NOTHING);
//
m_apFireModel[0] = Core::Manager::Resource->Get<coreModel>("ship_boss_chol_fire_01.md3");
m_apFireModel[1] = Core::Manager::Resource->Get<coreModel>("ship_boss_chol_fire_02.md3");
}
// ****************************************************************
// destructor
cCholBoss::~cCholBoss()
{
if(m_bSkipped) return;
//
this->Kill(false);
//
this->__DisableFire(false);
}
// ****************************************************************
//
void cCholBoss::ResurrectIntro(const coreUint8 iSub)
{
//
m_bForeshadow = true;
//
m_iPhase = 200u + iSub;
this->Resurrect();
}
// ****************************************************************
//
void cCholBoss::__ResurrectOwn()
{
if(m_iPhase < 200u)
{
//
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
this->__ChangeWingIntro(i);
//
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
m_aWing[i].SetPosition(coreVector3(HIDDEN_POS, 0.0f));
m_aWing[i].AddStatus (ENEMY_STATUS_GHOST);
}
//
this->AddStatus(ENEMY_STATUS_GHOST);
//
this->_ResurrectBoss();
}
}
// ****************************************************************
//
void cCholBoss::__KillOwn(const coreBool bAnimated)
{
if(m_iPhase < 200u)
{
cGeluMission* pMission = d_cast<cGeluMission*>(g_pGame->GetCurMission());
//
for(coreUintW i = 0u; i < GELU_FANGS; ++i) pMission->DisableFang(i, bAnimated);
for(coreUintW i = 0u; i < GELU_WAYS; ++i) pMission->DisableWay (i, bAnimated);
for(coreUintW i = 0u; i < GELU_ORBS; ++i) pMission->DisableOrb (i, bAnimated);
for(coreUintW i = 0u; i < GELU_LINES; ++i) pMission->DisableLine(i, bAnimated);
//
this->__DisableFire(bAnimated);
//
g_pPostProcessing->Reset();
//
g_pGame->ForEachPlayerAll([](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
pPlayer->SetArea(PLAYER_AREA_DEFAULT);
pPlayer->RemoveStatus(PLAYER_STATUS_NO_INPUT_MOVE);
});
//
g_pGame->GetInterface()->SetFakeEnd(0u);
}
//
m_iPhase = 0u;
}
// ****************************************************************
//
void cCholBoss::__RenderOwnUnder()
{
DEPTH_PUSH
//
m_Fire.Render();
}
// ****************************************************************
//
void cCholBoss::__MoveOwn()
{
cGeluMission* pMission = d_cast<cGeluMission*>(g_pGame->GetCurMission());
//
this->_UpdateBoss();
//
m_fAnimation.UpdateMod(1.0f, 100.0f);
// ################################################################
//
if(m_iPhase == 0u)
{
PHASE_CONTROL_TIMER(0u, 0.35f, LERP_BREAK)
{
const coreFloat fSpeed = 6.0f * (1.0f - fTime);
g_pEnvironment->SetTargetSpeedNow(fSpeed);
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if(m_iPhase == 1u)
{
PHASE_CONTROL_TIMER(0u, 0.25f, LERP_LINEAR)
{
if(PHASE_BEGINNING)
{
this->ChangeToBottom();
for(coreUintW i = 0u; i < CHOL_WINGS; ++i) m_aWing[i].ChangeToBottom();
}
this->__Impact(&m_aWing[0], coreVector2(-8.0f, 2.0f) * 5.0f, coreVector3(-0.5f,-1.0f,-2.5f).Normalized(), (fTime - 0.2f) * 6.0f, (fTimeBefore - 0.2f) * 6.0f, false);
this->__Impact(&m_aWing[1], coreVector2(-2.0f,-4.0f) * 5.0f, coreVector3(-1.0f,-0.5f,-2.5f).Normalized(), (fTime - 0.1f) * 6.0f, (fTimeBefore - 0.1f) * 6.0f, false);
this->__Impact(&m_aWing[2], coreVector2( 6.0f,-1.0f) * 5.0f, coreVector3(-1.5f,-1.0f,-2.5f).Normalized(), (fTime - 0.3f) * 6.0f, (fTimeBefore - 0.3f) * 6.0f, false);
this->__Impact(&m_aWing[3], coreVector2( 3.0f, 7.0f) * 5.0f, coreVector3(-1.0f,-1.5f,-2.5f).Normalized(), (fTime - 0.0f) * 6.0f, (fTimeBefore - 0.0f) * 6.0f, false);
this->__Impact(this, coreVector2( 0.0f, 1.0f) * 5.0f, coreVector3(-1.0f,-1.0f,-2.5f).Normalized(), (fTime - 0.4f) * 6.0f, (fTimeBefore - 0.4f) * 6.0f, true); // TODO 3: warning: passing argument 2 to ‘restrict’-qualified parameter aliases with argument 1 [-Wrestrict]
if(PHASE_FINISHED)
{
PHASE_CHANGE_INC
this->_StartBoss();
}
});
}
// ################################################################
//
else if(m_iPhase == 2u)
{
PHASE_CONTROL_TIMER(0u, 0.5f, LERP_LINEAR)
{
if(PHASE_BEGINNING)
{
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
const coreVector3 vWingDir = m_aWing[i].GetDirection();
m_avVector[START_VALUES_POS + i].xyz(m_aWing[i].GetPosition());
m_avVector[START_VALUES_DIR + i].xyz(coreVector3(MapToAxisInv(vWingDir.xy(), this->GetDirection().xy().Normalized()).Angle(), vWingDir.z, SQRT(1.0f - POW2(vWingDir.z))));
this->__ChangeWingInc(i);
}
m_avVector[START_VALUES_POS + 4u].xyz(this->GetPosition());
m_avVector[START_VALUES_DIR + 4u].xyz(coreVector3(this->GetDirection().xy().Angle(), this->GetDirection().z, SQRT(1.0f - POW2(this->GetDirection().z))));
}
if(PHASE_TIME_POINT(0.5f))
{
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
m_aWing[i].RemoveStatus(ENEMY_STATUS_GHOST);
m_aWing[i].ChangeToNormal();
}
this->RemoveStatus(ENEMY_STATUS_GHOST);
this->ChangeToNormal();
}
const coreVector3 vStartPos = m_avVector[START_VALUES_POS + 4u].xyz();
const coreVector3 vStartDir = m_avVector[START_VALUES_DIR + 4u].xyz();
const coreVector3 vNewPos = LERPH3(vStartPos, coreVector3(0.0f, 0.6f * FOREGROUND_AREA.y, 0.0f), fTime);
const coreVector3 vNewDir = coreVector3(coreVector2::Direction(LERPH3(vStartDir.x, 1.0f*PI, fTime)) * vStartDir.z, LERPH3(vStartDir.y, 0.0f, fTime)).Normalized();
this->SetPosition (vNewPos);
this->SetDirection(vNewDir);
g_pEnvironment->SetTargetSpeedNow(6.0f * BLENDBR(fTime));
if(PHASE_FINISHED)
{
PHASE_CHANGE_INC
this->__EnableFire(0u);
}
});
}
// ################################################################
//
else if(m_iPhase == 3u)
{
PHASE_CONTROL_PAUSE(0u, 1.0f)
{
PHASE_CHANGE_TO(20u)
//if(DEFINED(_CORE_DEBUG_)) PHASE_CHANGE_TO(70u)
});
}
// ################################################################
//
else if(m_iPhase == 20u)
{
if(PHASE_BEGINNING2)
{
pMission->SetCrushFree (true);
pMission->SetCrushLong (false);
pMission->SetCrushIgnore(false);
}
const coreInt32 iLostHealth = this->GetLostHealth();
const coreInt32 iLostHealthOld = this->GetMaxHealth() - this->GetPreHealth();
if(iLostHealth < 2000)
{
m_avVector[TRANSITION_TIME].x = MIN1(m_avVector[TRANSITION_TIME].x + 0.2f * TIME);
}
else
{
const coreFloat fOldTime = m_avVector[TRANSITION_TIME].x;
m_avVector[TRANSITION_TIME].x = MAX0(m_avVector[TRANSITION_TIME].x - 0.4f * TIME);
m_fTilt = LERPS(0.0f*PI, 2.0f*PI, m_avVector[TRANSITION_TIME].x);
this->DefaultOrientate(m_fTilt);
if(InBetween(0.0f, m_avVector[TRANSITION_TIME].x, fOldTime) ||
InBetween(0.5f, m_avVector[TRANSITION_TIME].x, fOldTime))
{
g_pSpecialEffects->PlaySound(this->GetPosition(), 1.0f, 0.5f, SOUND_EFFECT_WOOSH_01);
}
if(m_avVector[TRANSITION_TIME].x <= 0.0f)
{
PHASE_CHANGE_TO(30u)
g_pReplay->ApplySnapshot(REPLAY_SNAPSHOT_BOSS_DEFAULT(0u));
}
}
if(iLostHealth >= 1200) m_avVector[TRANSITION_TIME].y = MIN1(m_avVector[TRANSITION_TIME].y + 0.2f * TIME);
PHASE_CONTROL_TIMER(0u, 0.1f, LERP_LINEAR)
{
const coreVector2 vNewPos = coreVector2(0.0f,0.6f) + coreVector2(0.6f * SIN(fTime * (2.0f*PI)), 0.1f * SIN(fTime * (6.0f*PI)) * m_avVector[TRANSITION_TIME].y) * BLENDS(m_avVector[TRANSITION_TIME].x);
this->SetPosition(coreVector3(vNewPos * FOREGROUND_AREA, 0.0f));
g_pEnvironment->SetTargetDirectionNow(vNewPos.Normalized());
if(PHASE_FINISHED)
{
PHASE_AGAIN(0u)
}
});
if(iLostHealth < 2000)
{
if(InBetween(1200, iLostHealthOld, iLostHealth))
m_aiCounter[WAY_COUNT] = 0;
PHASE_CONTROL_TICKER(1u, 0u, 0.22f, LERP_LINEAR)
{
const coreVector2 vDir = StepRotated90(m_aiCounter[WAY_COUNT] % 4u);
const coreVector2 vBase = (iLostHealth < 1200) ? coreVector2(1.0f,0.0f) : coreVector2(0.0f,1.0f);
const coreUintW iStart = (iLostHealth < 1200) ? 0u : 12u; // used for movement
for(coreUintW i = 0u; i < 6u; ++i)
{
const coreFloat fHeight = (I_TO_F(i % 6u) - 2.5f) * GELU_WAY_STEP;
const coreVector2 vPos = (vBase * 1.3f + vBase.Rotated90() * fHeight) * FOREGROUND_AREA;
pMission->DisableWay(iStart + i, false);
pMission->DisableWay(iStart + i + 6u, false);
pMission->EnableWay(iStart + i, -vPos, vDir);
pMission->EnableWay(iStart + i + 6u, vPos, -vDir);
}
m_aiCounter[WAY_COUNT] += 1;
if((iLostHealth >= 1200) && (m_aiCounter[WAY_COUNT] == 2))
{
if(this->_ResurrectHelper(ELEMENT_BLUE, false))
{
g_pGame->GetHelper(ELEMENT_BLUE)->SetPosition(coreVector3(-2.5f * GELU_WAY_STEP, -1.3f - 1.0f * GELU_WAY_STEP, 0.0f) * FOREGROUND_AREA3);
}
}
});
}
PHASE_CONTROL_TICKER(2u, 0u, g_pGame->IsEasy() ? 1.5f : 3.0f, LERP_LINEAR)
{
if((iTick % 4u) < 2u) return;
const coreVector2 vPos = this->GetPosition().xy();
const coreBool bFlip = ((iTick % 4u) == 3u);
for(coreUintW j = 40u; j--; )
{
if((j % 4u) < (g_pGame->IsEasy() ? 2u : 1u)) continue;
const coreVector2 vDir = coreVector2::Direction(DEG_TO_RAD(I_TO_F(j + (bFlip ? 2u : 0u)) * 4.5f + 90.0f) * (bFlip ? -1.0f : 1.0f));
const coreFloat fSpeed = 1.0f + 0.06f * (I_TO_F(j % 4u) - 1.0f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cOrbBullet>(5, fSpeed, this, vPos, vDir)->ChangeSize(1.8f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cOrbBullet>(5, fSpeed, this, vPos, -vDir)->ChangeSize(1.8f);
}
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), SPECIAL_SPLASH_TINY, COLOR_ENERGY_BLUE);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_WEAPON_ENEMY);
});
}
// ################################################################
//
else if(m_iPhase == 30u)
{
PHASE_CONTROL_TIMER(0u, g_pGame->IsEasy() ? 0.35f : 0.6f, LERP_LINEAR)
{
const coreFloat fSide = (m_aiCounter[INCURSION_COUNT] & 0x04) ? -1.0f : 1.0f;
coreVector2 vTarget;
switch(m_aiCounter[INCURSION_COUNT] % 4)
{
default: UNREACHABLE
case 0: vTarget = coreVector2(-1.0f, 0.0f) * fSide; break;
case 1: vTarget = coreVector2( 1.0f, 0.0f) * fSide; break;
case 2: vTarget = coreVector2( 0.0f,-1.0f); break;
case 3: vTarget = coreVector2( 0.0f, 1.0f); break;
}
if(PHASE_TIME_BEFORE(0.5f) || PHASE_TIME_POINT(0.5f)) // with point, to prevent explosion on temporary target-position
{
this->DefaultMoveLerp(m_vLastPosition, m_vLastPosition * 3.0f, STEPBR(0.0f, 0.5f, fTime));
}
else
{
const coreVector2 vNewPos = vTarget * 0.6f;
this->DefaultMoveLerp(vNewPos * 3.0f, vNewPos, STEPB(0.5f, 1.0f, fTime));
this->SetDirection (coreVector3(-vTarget, 0.0f));
}
if(PHASE_TIME_POINT(0.6f))
{
for(coreUintW j = 36u; j--; )
{
const coreVector2 vPos = (vTarget * 1.2f + vTarget.Rotated90() * ((I_TO_F(j) - 17.5f) * 0.06f)) * FOREGROUND_AREA;
const coreVector2 vDir = -vTarget;
const coreFloat fSpeed = LERP(1.0f, 0.4f, ABS(I_TO_F(j) - 17.5f) / 17.5f) * ((j >= 10u && j < 26u) ? 2.0f : 1.0f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cViewBullet>(5, fSpeed, this, vPos, vDir)->ChangeSize(1.7f);
}
if((m_aiCounter[INCURSION_COUNT] % 4) == 3)
{
if(this->_ResurrectHelper(ELEMENT_MAGENTA, false))
{
g_pGame->GetHelper(ELEMENT_MAGENTA)->SetPosition(coreVector3(vTarget * 1.3f * FOREGROUND_AREA, 0.0f));
}
}
g_pSpecialEffects->PlaySound(this->GetPosition(), 2.0f, 1.0f, SOUND_EFFECT_FLY);
}
const coreBool bChange = (this->GetLostHealth() >= 2500);
if(PHASE_TIME_POINT(0.5f))
{
if(bChange) m_aiCounter[INCURSION_COUNT] = 3;
}
if(PHASE_FINISHED)
{
if(bChange && ((m_aiCounter[INCURSION_COUNT] % 4) == 3))
{
PHASE_CHANGE_TO(40u)
g_pReplay->ApplySnapshot(REPLAY_SNAPSHOT_BOSS_DEFAULT(1u));
}
else
{
PHASE_AGAIN(0u)
if(bChange) m_aiCounter[INCURSION_COUNT] = 3;
else m_aiCounter[INCURSION_COUNT] += 1;
this->StorePosition();
}
}
});
if(this->ReachedHealth(this->GetMaxHealth() - 2500))
{
g_pSpecialEffects->MacroExplosionColorBig(this->GetPosition(), COLOR_ENERGY_MAGENTA);
g_pSpecialEffects->PlaySound(this->GetPosition(), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_01);
}
}
// ################################################################
//
else if(m_iPhase == 40u)
{
if(PHASE_BEGINNING2)
{
this->__DisableFire(true);
}
PHASE_CONTROL_TICKER(0u, 4u, 2.0f, LERP_LINEAR)
{
coreUintW iIndex;
switch(iTick)
{
default: UNREACHABLE
case 0u: iIndex = 0u; break;
case 1u: iIndex = 2u; break;
case 2u: iIndex = 1u; break;
case 3u: iIndex = 3u; break;
}
this->__ChangeWingThrow2(iIndex);
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if(m_iPhase == 41u)
{
PHASE_CONTROL_TIMER(0u, 0.3f, LERP_SMOOTH)
{
this->DefaultMoveLerp (m_vLastPosition, coreVector2(0.0f,1.7f), fTime);
this->DefaultOrientateLerp(0.0f*PI, 6.0f*PI, fTime);
if(PHASE_FINISHED)
{
PHASE_CHANGE_INC
this->AddStatus(ENEMY_STATUS_GHOST);
}
});
}
// ################################################################
//
else if(m_iPhase == 42u)
{
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
if(!m_aWing[i].GetCurHealth() && (m_aiWingState[i] < 41u)) // instead of ReachedDeath
{
this->__ChangeWingPull(i);
m_aWing[i].AddStatus(ENEMY_STATUS_GHOST);
const coreVector2 vPos = m_aWing[i].GetPosition().xy();
for(coreUintW j = 40u; j--; )
{
if(g_pGame->IsEasy() && (j % 2u)) continue;
const coreVector2 vDir = coreVector2::Direction(DEG_TO_RAD(I_TO_F(j) - 19.5f) * 4.5f);
const coreFloat fSpeed = ((j % 4u) < 2u) ? 0.7f : 0.5f;
g_pGame->GetBulletManagerEnemy()->AddBullet<cQuadBullet>(5, fSpeed, this, vPos, vDir)->ChangeSize(1.3f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cQuadBullet>(5, fSpeed, this, vPos, -vDir)->ChangeSize(1.3f);
}
m_aiCounter[PULL_COUNT] += 1;
if(m_aiCounter[PULL_COUNT] >= 4)
{
PHASE_CHANGE_INC
}
m_avVector[WALL_OFFSET].z = MAX0(m_avVector[WALL_OFFSET].z - 0.05f);
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), SPECIAL_SPLASH_TINY, COLOR_ENERGY_CYAN);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_01);
}
}
m_avVector[WALL_OFFSET].z = MIN1(m_avVector[WALL_OFFSET].z + (0.05f + 0.01f * I_TO_F(m_aiCounter[PULL_COUNT])) * (g_pGame->IsEasy() ? 0.5f : 1.0f) * TIME);
}
// ################################################################
//
else if(m_iPhase == 43u)
{
constexpr coreFloat fSpeed = 0.3f;
PHASE_CONTROL_PAUSE(0u, fSpeed)
{
PHASE_CHANGE_TO(100u)
for(coreUintW i = 0u; i < CHOL_WINGS; ++i) this->__RepairWing(i, 2500);
for(coreUintW i = 0u; i < CHOL_WINGS; ++i) m_aWing[i].RemoveStatus(ENEMY_STATUS_GHOST);
for(coreUintW i = 1u; i < CHOL_WINGS; ++i) m_aWing[i].SetParent(&m_aWing[0]);
});
const coreFloat fPrev = m_avVector[WALL_OFFSET].z;
m_avVector[WALL_OFFSET].z -= fSpeed * TIME;
if(((fPrev > 0.0f) && (m_avVector[WALL_OFFSET].z <= 0.0f)) || ((m_iPhase != 43u) && (m_avVector[WALL_OFFSET].z > 0.0f)))
{
m_avVector[WALL_OFFSET].z = -1.0f;
g_pGame->GetBulletManagerEnemy()->ClearBulletsTyped<cConeBullet>(true);
if(this->_ResurrectHelper(ELEMENT_ORANGE, true))
{
g_pGame->GetHelper(ELEMENT_ORANGE)->SetPosition(coreVector3(0.0f,-1.05f,0.0f) * FOREGROUND_AREA3);
}
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_SMALL);
g_pSpecialEffects->PlaySound(coreVector3(0.0f,-1.0f,0.0f) * FOREGROUND_AREA3, 0.6f, 1.3f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
}
}
// ################################################################
//
else if(m_iPhase == 50u)
{
if(PHASE_BEGINNING2)
{
for(coreUintW i = 0u; i < GELU_FANGS; ++i)
pMission->EnableFang(i);
this->ChangeToBottom();
pMission->SetCrushFree (true);
pMission->SetCrushLong (true);
pMission->SetCrushIgnore(true);
}
constexpr coreFloat fDelay = 0.7f;
coreFloat fStuckTime = 0.0f;
for(coreUintW i = 0u; i < GELU_FANGS; ++i)
{
coreObject3D* pFang = pMission->GetFang(i);
if(!pFang->IsEnabled(CORE_OBJECT_ENABLE_MOVE)) continue;
const coreUintW X = i % GELU_FANGS_DIMENSION;
const coreUintW Y = i / GELU_FANGS_DIMENSION;
coreUintW iOrder;
switch(X)
{
default: UNREACHABLE
case 0u: iOrder = 0u; break;
case 1u: iOrder = 2u; break;
case 2u: iOrder = 4u; break;
case 3u: iOrder = 3u; break;
case 4u: iOrder = 1u; break;
}
const coreVector2 vOffset = coreVector2(I_TO_F(X) - 2.0f, I_TO_F(Y) - 2.0f) * GELU_FANG_STEP;
const coreFloat fStompTimePrev = CLAMP((m_fPhaseTimeBefore * 0.9f * 3.0f/5.0f) - I_TO_F(iOrder) * 0.4f, 0.0f, 1.0f + fDelay);
const coreFloat fStompTime = CLAMP((m_fPhaseTime * 0.9f * 3.0f/5.0f) - I_TO_F(iOrder) * 0.4f, 0.0f, 1.0f + fDelay);
pFang->SetPosition(coreVector3((vOffset + coreVector2(0.0f, LERP(0.0f, I_TO_F(GELU_FANGS_DIMENSION) * GELU_FANG_STEP, ABS(COS(DelayTime(fStompTime, 0.5f, fDelay) * (1.0f*PI)))))) * FOREGROUND_AREA, 0.0f));
if(InBetween(0.5f, fStompTimePrev, fStompTime) && (i < 5u))
{
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_SMALL);
g_pSpecialEffects->PlaySound(pFang->GetPosition(), 0.5f, 1.5f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
if(i == 2u)
{
g_pSpecialEffects->MacroExplosionPhysicalColorBig(coreVector3(0.0f,-1.1f,0.0f) * FOREGROUND_AREA3, COLOR_FIRE_ORANGE);
g_pSpecialEffects->PlaySound(pFang->GetPosition(), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_07);
this->_ResurrectHelper(ELEMENT_RED, false);
}
}
if(i == 2u) fStuckTime = fStompTime;
}
if(fStuckTime < 0.5f)
{
const coreVector2 vFangPos = pMission->GetFang(2u)->GetPosition().xy();
const coreVector2 vNewPos = m_vLastPosition * FOREGROUND_AREA + coreVector2(0.0f, vFangPos.y - I_TO_F(GELU_FANGS_DIMENSION - 2u) * GELU_FANG_STEP * FOREGROUND_AREA.y);
this->SetPosition(coreVector3(vNewPos, 0.0f));
}
else
{
this->SetPosition(coreVector3(0.0f,-1.1f,0.0f) * FOREGROUND_AREA3);
}
if(fStuckTime >= 1.0f + fDelay)
{
for(coreUintW i = 0u; i < GELU_FANGS; ++i)
pMission->DisableFang(i, false);
this->ChangeToTop();
g_pSpecialEffects->MacroEruptionColorBig(this->GetPosition(), coreVector2(0.0f,1.0f), COLOR_ENERGY_RED);
g_pSpecialEffects->PlaySound(this->GetPosition(), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_03);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
PHASE_CHANGE_INC
}
}
// ################################################################
//
else if(m_iPhase == 51u)
{
const coreFloat fCurHealthPct = this->GetCurHealthPct();
const coreFloat fSpeedMove = MIN1(m_fPhaseTime * 3.0f);
const coreFloat fSpeedShoot = LERP(20.0f, 1.0f, STEP(0.0f, 0.5f, fCurHealthPct));
const coreFloat fSpeedSmoke = LERP(60.0f, 10.0f, fCurHealthPct);
this->DefaultMoveTarget(this->NearestPlayerDual((FMOD(m_fPhaseTime, 10.0f) < 5.0f) ? 1u : 0u)->GetPosition().xy(), LERP(0.0f, 20.0f, fSpeedMove), LERP(0.0f, 1.5f, fSpeedMove));
this->DefaultOrientate (m_fPhaseTime * (2.0f*PI));
g_pEnvironment->SetTargetDirectionNow(coreVector2(-this->GetPosition().x, -50.0f).Normalized());
PHASE_CONTROL_TICKER(0u, 0u, fSpeedShoot, LERP_LINEAR)
{
const coreVector2 vPos = this->GetPosition().xy();
const coreVector2 vDir = coreVector2::Direction(I_TO_F(iTick) * GA);
g_pGame->GetBulletManagerEnemy()->AddBullet<cTriangleBullet>(5, 1.1f, this, vPos, vDir)->ChangeSize(1.4f);
if(!g_pGame->IsEasy())
{
g_pGame->GetBulletManagerEnemy()->AddBullet<cTriangleBullet>(5, 1.1f, this, vPos, vDir.Rotated120())->ChangeSize(1.4f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cTriangleBullet>(5, 1.1f, this, vPos, -vDir.Rotated60 ())->ChangeSize(1.4f);
}
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), 10.0f, 1u, COLOR_ENERGY_RED);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_WEAPON_ENEMY);
});
PHASE_CONTROL_TICKER(1u, 0u, fSpeedSmoke, LERP_LINEAR)
{
g_pSpecialEffects->CreateBlowSmoke(this->GetPosition(), -this->GetDirection(), 50.0f, 3u, coreVector3(1.0f,1.0f,1.0f));
});
if(!this->GetCurHealth()) // instead of ReachedDeath
{
PHASE_CHANGE_TO(110u)
}
}
// ################################################################
//
else if(m_iPhase == 60u)
{
this->SetPosition(coreVector3(HIDDEN_POS, 0.0f));
PHASE_CONTROL_PAUSE(0u, 1.0f / (INTERFACE_BANNER_DURATION_SCORE_2 - 2.0f))
{
PHASE_CHANGE_INC
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
this->__ChangeWingResurrect1(i);
m_aWing[i].AddStatus(ENEMY_STATUS_GHOST);
}
});
}
// ################################################################
//
else if(m_iPhase == 61u)
{
this->SetPosition(coreVector3(HIDDEN_POS, 0.0f));
PHASE_CONTROL_PAUSE(0u, 0.5f - 0.05f) // a bit longer, so the score banner fades out properly
{
PHASE_CHANGE_INC
this->__ResurrectFake();
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
this->__ChangeWingReset(i);
m_aWing[i].RemoveStatus(ENEMY_STATUS_GHOST);
}
});
}
// ################################################################
//
else if((m_iPhase == 62u) || (m_iPhase == 112u)) // #
{
PHASE_CONTROL_TIMER(0u, 0.4f, LERP_LINEAR)
{
if(PHASE_TIME_POINT(0.5f) || PHASE_TIME_POINT(0.75f))
{
g_pSpecialEffects->PlaySound(this->GetPosition(), 1.0f, 0.5f, SOUND_EFFECT_WOOSH_01);
}
this->SetPosition (coreVector3(0.0f, LerpPara(1.5f, 0.6f, 0.7f, BLENDB(MIN1(fTime * 2.0f))), 0.0f) * FOREGROUND_AREA3);
this->SetDirection(coreVector3(0.0f,-1.0f,0.0f));
m_fTilt = LERPS(0.0f*PI, 2.0f*PI, MAX0((fTime - 0.5f) * 2.0f));
this->DefaultOrientate(m_fTilt);
if(PHASE_TIME_POINT(0.5f)) this->__EnableFire(0u);
if(PHASE_TIME_POINT(0.9f)) this->__DisableFire(true);
if(PHASE_FINISHED)
{
if(m_iPhase == 112u)
{
this->__DisableFire(false);
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
m_aWing[i].Kill(true);
}
this->Kill(true);
if(this->HasAllHelpers())
{
this->_CreateFragment(5u);
}
g_pSpecialEffects->CreateExplosion (this->GetPosition());
g_pSpecialEffects->CreateSplashDark(this->GetPosition(), 200.0f, 400u, true);
g_pSpecialEffects->PlaySound (this->GetPosition(), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_11);
g_pSpecialEffects->PlaySound (this->GetPosition(), 1.2f, 0.6f, SOUND_EFFECT_SHAKE_02);
g_pSpecialEffects->SlowScreen(4.0f);
}
else
{
PHASE_CHANGE_INC
}
}
});
}
// ################################################################
//
else if(m_iPhase == 63u)
{
if(PHASE_BEGINNING2)
{
this->__DisableFire(false);
this->__EnableFire(1u);
}
PHASE_CONTROL_TIMER(0u, m_aiCounter[STORM_COUNT] ? 0.8f : 0.6f, LERP_LINEAR)
{
if(PHASE_BEGINNING)
{
g_pSpecialEffects->PlaySound(this->GetPosition(), 2.0f, 1.0f, SOUND_EFFECT_FLY);
}
coreVector2 vFrom, vTo;
coreFloat fDelay;
switch(m_aiCounter[STORM_COUNT])
{
default: UNREACHABLE
case 0: vFrom = coreVector2( 0.0f, 0.7f); vTo = coreVector2( 0.0f,-1.7f); fDelay = 1.0f; break;
case 1: vFrom = coreVector2(-0.5f, 1.7f); vTo = coreVector2(-0.5f,-1.7f); fDelay = 1.0f; break;
case 2: vFrom = coreVector2( 0.5f, 1.7f); vTo = coreVector2( 0.5f,-1.7f); fDelay = 1.0f; break;
case 3: vFrom = coreVector2(-1.7f, 0.5f); vTo = coreVector2( 1.7f, 0.5f); fDelay = 1.0f; break;
case 4: vFrom = coreVector2( 1.7f,-0.5f); vTo = coreVector2(-1.7f,-0.5f); fDelay = 1.0f; break;
case 5: vFrom = coreVector2( 0.0f,-1.7f); vTo = coreVector2( 0.0f, 1.4f); fDelay = 0.9f; break;
}
if(m_aiCounter[STORM_COUNT])
{
this->DefaultMoveLerp(vFrom, vTo, fTime);
m_fFlap = 1.0f;
}
else
{
this->DefaultMoveLerp(vFrom, vTo, LerpPara(0.0f, -0.05f, 1.0f, fTime));
m_fFlap = BLENDS(MIN1(fTime * 1.0f));
}
const coreVector2 vDir = (vTo - vFrom).Normalized();
this->SetDirection(coreVector3(vDir, 0.0f));
if(PHASE_FINISHED || PHASE_TIME_AFTER(fDelay))
{
m_aiCounter[STORM_COUNT] += 1;
if(m_aiCounter[STORM_COUNT] >= 6)
{
PHASE_CHANGE_TO(50u)
for(coreUintW i = 0u; i < CHOL_WINGS; ++i)
{
this->__ChangeWingExplode2(i);
m_aWing[i].AddStatus(ENEMY_STATUS_GHOST);
}
this->__DisableFire(true);
g_pSpecialEffects->MacroExplosionPhysicalColorBig(this->GetPosition(), COLOR_FIRE_ORANGE);
g_pSpecialEffects->PlaySound(this->GetPosition(), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_08);
g_pReplay->ApplySnapshot(REPLAY_SNAPSHOT_BOSS_DEFAULT(4u));
}
else
{
PHASE_AGAIN(0u)
}
if(m_aiCounter[STORM_COUNT] == 4)
{
this->_ResurrectHelper(ELEMENT_GREEN, false);
}
}
});
PHASE_CONTROL_TICKER(1u, 0u, 60.0f, LERP_LINEAR)
{
g_pSpecialEffects->CreateBlowFire (this->GetPosition(), -this->GetDirection(), 50.0f, 6u, COLOR_FIRE_ORANGE);
g_pSpecialEffects->CreateBlowColor(this->GetPosition(), -this->GetDirection(), 100.0f, 4u, COLOR_FIRE_ORANGE);
});
if(!g_pGame->IsEasy())
{
if(!g_pForeground->IsVisiblePoint(this->GetPosition().xy()) && g_pForeground->IsVisiblePoint(this->GetOldPos()))
{
const coreVector2 vPos = this->GetPosition().xy();
const coreUintW iNum = 10u;
for(coreUintW j = iNum; j--; )
{
const coreVector2 vDir = coreVector2::Direction(DEG_TO_RAD(I_TO_F(j) * (180.0f / I_TO_F(iNum))));
const coreFloat fSpeed = (j % 2u) ? 0.9f : 0.8f;
g_pGame->GetBulletManagerEnemy()->AddBullet<cWaveBullet>(5, fSpeed, this, vPos, vDir)->ChangeSize(1.9f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cWaveBullet>(5, fSpeed, this, vPos, -vDir)->ChangeSize(1.9f);
}
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), SPECIAL_SPLASH_BIG, COLOR_ENERGY_GREEN);
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_SMALL);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 0.7f, SOUND_EFFECT_SHAKE_02);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_BIG, 250u);
}
}
}
// ################################################################
//
else if(m_iPhase == 70u)
{
const coreFloat fCurHealthPct = this->GetCurHealthPct();
if(PHASE_BEGINNING2)