-
Notifications
You must be signed in to change notification settings - Fork 0
/
0702_cGemingaBoss.cpp
2198 lines (1762 loc) · 81.7 KB
/
0702_cGemingaBoss.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"
// - pearls and pacman appearance fit very well together
// - (old: using teleporter was too complicated, either you had to attack boss and attack teleporter at the same time, which was just too much, or if teleporter used as "don't hit them", hitting them completely confuses the player)
// - you have to notice that the visibility of the boomerangs is becoming shorter, set thresholds accordingly
// - first phase is meant to introduce, and also to show that you can't do any damage to the boss while his mouth is closed
// - bullets in vacuum phase should cover the mouth in such a way that there can be no safe spot
// - Dharuk shouldn't move too fast because it's already hard enough to hit him properly
// - (old: Dharuk should not become invisible in the final phase, because the duplicate is already too distracting)
// - side bullets from Dharuk are easier to process than targeted bullets or around bullets, but there should only be 1 bullet hole because the precise linear fly-through has a good feel in contrast to the free positioning in between (the side bullets fit also good for spawning from all 4 directions)
// - the first section is about eating, the second about Dharuk, the third about separation
// - orange bullets should go all the way to the edge, but when shooting alternately this is only done from one of the two halves without completely spanning it
// - the stomp phase only works on one axis, to change the axis the boss would have to jump into the middle
// - pearls should be created in such a way that their animation creates a nice wave (in the direction of movement from the boss)
// ACHIEVEMENT: collect your first pearl without reflecting a bullet
// TODO 1: hardmode: pacman ghost which hunt you
// TODO 1: hardmode: generate fields which form a (simple) (invisible) arena
// TODO 1: health points of the inner boss should be visible (either second bar, which can be controlled separately, or hide boss life 1, show boss life 2 (with up-animation), or shared life, adjust the health limits and apply to geminga)
// TODO 1: player bullets shot into mouth should be on the same visual height
// TODO 1: repair-enemy is rendered over boss when sucking in and spitting out, but boss cannot be set to TOP because of particle effects, repair-enemy has to be adjusted (render order or size)
// ****************************************************************
// counter identifier
#define CONNECTED_MOUTH (0u)
#define SMASH_COUNT (1u)
#define STRIKE_COUNT (2u)
#define BULLET_REFLECT (3u)
// ****************************************************************
// vector identifier
#define OLD_MOUTH_ANGLE (0u)
#define SMASH_POSITION (1u)
#define FOLLOW_VALUES (2u)
#define BOUNCE_FORCE (3u)
#define FINAL_ROTATION (4u)
#define OLD_ANGLE (5u)
#define SUCK_ANGLE (6u)
#define ENV_ROTATION (7u)
#define HELPER_DATA (8u)
#define PUNISH_TIME (9u)
// ****************************************************************
// constructor
cGemingaBoss::cGemingaBoss()noexcept
: m_fMouthAngle (0.0f)
, m_SuckEffect (g_pSpecialEffects->GetParticleColor())
{
if(m_bSkipped) return;
// load models
this->DefineModelHigh(Core::Manager::Object->GetLowQuad());
this->DefineModelLow (Core::Manager::Object->GetLowQuad());
// set object properties
this->SetSize (coreVector3( 1.0f,1.0f,1.0f) * 3.0f);
this->SetOrientation(coreVector3(-1.0f,0.0f,0.0f));
// configure the boss
this->Configure(8600, COLOR_SHIP_RED);
this->AddStatus(ENEMY_STATUS_GHOST | ENEMY_STATUS_HIDDEN);
//
PHASE_HEALTH_GOAL({8600, 7400, 3100, 2100, 0})
//
m_Sphere.DefineModelHigh("object_sphere.md3");
m_Sphere.DefineModelLow ("object_sphere.md3");
m_Sphere.SetSize (this->GetSize() * 4.0f);
m_Sphere.Configure (1, COLOR_SHIP_RED);
m_Sphere.AddStatus (ENEMY_STATUS_INVINCIBLE | ENEMY_STATUS_HIDDEN | ENEMY_STATUS_SECRET);
m_Sphere.SetParent (this);
//
m_InsideTop.DefineModelHigh("ship_boss_amemasu_top_inside.md3");
m_InsideTop.DefineModelLow ("ship_boss_amemasu_top_inside.md3");
m_InsideTop.SetSize (this->GetSize());
m_InsideTop.Configure (1, COLOR_SHIP_RED);
m_InsideTop.AddStatus (ENEMY_STATUS_DAMAGING | ENEMY_STATUS_HIDDEN | ENEMY_STATUS_SECRET);
m_InsideTop.SetParent (this);
//
m_InsideBottom.DefineModelHigh("ship_boss_amemasu_bottom_inside.md3");
m_InsideBottom.DefineModelLow ("ship_boss_amemasu_bottom_inside.md3");
m_InsideBottom.SetSize (this->GetSize());
m_InsideBottom.Configure (1, COLOR_SHIP_RED);
m_InsideBottom.AddStatus (ENEMY_STATUS_DAMAGING | ENEMY_STATUS_HIDDEN | ENEMY_STATUS_SECRET);
m_InsideBottom.SetParent (this);
//
m_Top.DefineModelHigh("ship_boss_amemasu_top_high.md3");
m_Top.DefineModelLow ("ship_boss_amemasu_top_low.md3");
m_Top.DefineVolume ("ship_boss_amemasu_top_volume.md3");
m_Top.SetSize (this->GetSize());
m_Top.Configure (1, COLOR_SHIP_RED);
m_Top.AddStatus (ENEMY_STATUS_INVINCIBLE | ENEMY_STATUS_SECRET);
m_Top.SetParent (this);
//
m_Bottom.DefineModelHigh("ship_boss_amemasu_bottom_high.md3");
m_Bottom.DefineModelLow ("ship_boss_amemasu_bottom_low.md3");
m_Bottom.DefineVolume ("ship_boss_amemasu_bottom_volume.md3");
m_Bottom.SetSize (this->GetSize());
m_Bottom.Configure (1, COLOR_SHIP_RED);
m_Bottom.AddStatus (ENEMY_STATUS_INVINCIBLE | ENEMY_STATUS_SECRET);
m_Bottom.SetParent (this);
//
m_ChangePath.Reserve(3u);
m_ChangePath.AddNode(coreVector2(0.0f, 0.0f), coreVector2(0.0f, 1.0f));
m_ChangePath.AddNode(coreVector2(0.0f, 0.01f), coreVector2(0.0f, 1.0f));
m_ChangePath.AddNode(coreVector2(0.0f,-3.0f), coreVector2(0.0f,-1.0f));
m_ChangePath.Refine();
//
m_aPackPath[0].Reserve(2u);
m_aPackPath[0].AddNode(coreVector2(-1.5f,0.0f), coreVector2(1.0f,0.0f));
m_aPackPath[0].AddNode(coreVector2( 1.5f,0.0f), coreVector2(1.0f,0.0f));
m_aPackPath[0].Refine();
m_aPackPath[1].Reserve(2u);
m_aPackPath[1].AddNode(coreVector2(0.0f, 1.5f), coreVector2(0.0f,-1.0f));
m_aPackPath[1].AddNode(coreVector2(0.0f,-1.5f), coreVector2(0.0f,-1.0f));
m_aPackPath[1].Refine();
m_aPackPath[2].Reserve(4u);
m_aPackPath[2].AddNode (coreVector2( 1.5f,-0.6f), coreVector2(-1.0f,0.0f));
m_aPackPath[2].AddNodes(coreVector2(-0.6f,-0.6f), coreVector2(-1.0f,0.0f), coreVector2(0.0f,1.0f));
m_aPackPath[2].AddNode (coreVector2(-0.6f, 1.5f), coreVector2( 0.0f,1.0f));
m_aPackPath[2].Refine();
m_aPackPath[3].Reserve(6u);
m_aPackPath[3].AddNode (coreVector2(-1.5f, 0.6f), coreVector2( 1.0f, 0.0f));
m_aPackPath[3].AddNodes(coreVector2( 0.6f, 0.6f), coreVector2( 1.0f, 0.0f), coreVector2( 0.0f,-1.0f));
m_aPackPath[3].AddNodes(coreVector2( 0.6f,-0.6f), coreVector2( 0.0f,-1.0f), coreVector2(-1.0f, 0.0f));
m_aPackPath[3].AddNode (coreVector2(-1.5f,-0.6f), coreVector2(-1.0f, 0.0f));
m_aPackPath[3].Refine();
//
//m_pVacuumSound = Core::Manager::Resource->Get<coreSound>("effect_vacuum.wav");
if(!g_pGame->SkipLoadingCache())
{
//
constexpr const coreChar* apcName[] =
{
"effect_rain.png",
"environment_blood_diff.png",
"environment_clouds_grey.png",
"environment_clouds_high.png",
"environment_clouds_mid.png",
"environment_grave_diff.png",
"environment_grave_norm.png",
"environment_moss_diff.png",
"environment_rock_diff.png",
"environment_tree_01_diff.png",
"environment_tree_01_norm.png",
"environment_tree_02_diff.png",
"environment_tree_02_norm.png",
"environment_tree_03_diff.png",
"environment_tree_03_norm.png",
"environment_tree_01.md3",
"environment_tree_02.md3",
"environment_tree_03.md3",
"environment_grave.md3",
"effect_weather_rain_moss_program",
"environment_clouds_program",
"environment_clouds_inst_program",
"environment_rain_program",
"object_ground_program",
"object_ground_inst_program"
};
for(coreUintW i = 0u; i < ARRAY_SIZE(m_apResCache); ++i)
{
m_apResCache[i] = Core::Manager::Resource->Get<coreResourceDummy>(apcName[i]);
STATIC_ASSERT(ARRAY_SIZE(m_apResCache) == ARRAY_SIZE(apcName))
}
}
STATIC_ASSERT(offsetof(cGemingaBoss, m_InsideTop) < offsetof(cGemingaBoss, m_Top)) // initialization order for collision detection
STATIC_ASSERT(offsetof(cGemingaBoss, m_InsideBottom) < offsetof(cGemingaBoss, m_Bottom))
}
// ****************************************************************
// destructor
cGemingaBoss::~cGemingaBoss()
{
if(m_bSkipped) return;
//
this->Kill(false);
}
// ****************************************************************
//
void cGemingaBoss::ResurrectIntro()
{
//
m_aiCounter[CONNECTED_MOUTH] = 1;
//
m_fMouthAngle = SIN(0.05f*PI);
//
this->SetPosition(coreVector3(0.0f,0.0f,0.0f));
//
m_InsideTop .AddStatus(ENEMY_STATUS_GHOST);
m_InsideBottom.AddStatus(ENEMY_STATUS_GHOST);
m_Top .AddStatus(ENEMY_STATUS_GHOST);
m_Bottom .AddStatus(ENEMY_STATUS_GHOST);
//
m_bForeshadow = true;
//
m_iPhase = 200u;
this->Resurrect();
}
// ****************************************************************
//
void cGemingaBoss::__ResurrectOwn()
{
if(m_iPhase < 200u)
{
//
m_aiCounter[CONNECTED_MOUTH] = 1;
//
m_fMouthAngle = 0.0f;
//
this->SetPosition(coreVector3(HIDDEN_POS, 0.0f));
//
cMossBackground* pBackground = d_cast<cMossBackground*>(g_pEnvironment->GetBackground());
pBackground->SetEnableLightning(false);
//
this->_ResurrectBoss();
}
}
// ****************************************************************
//
void cGemingaBoss::__KillOwn(const coreBool bAnimated)
{
if(m_iPhase < 200u)
{
cMuscusMission* pMission = d_cast<cMuscusMission*>(g_pGame->GetCurMission());
//
for(coreUintW i = 0u; i < MUSCUS_PEARLS; ++i) pMission->DisablePearl(i, bAnimated);
//
pMission->ResetCollEnemyBullet();
//
pMission->GetEnemySquad(0u)->ClearEnemies(bAnimated);
pMission->GetEnemySquad(1u)->ClearEnemies(bAnimated);
//
m_Dharuk.Kill(bAnimated);
//
//if(m_pVacuumSound->EnableRef(this)) m_pVacuumSound->Stop();
//
g_pGame->ForEachPlayerAll([](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
pPlayer->RemoveStatus(PLAYER_STATUS_GHOST | PLAYER_STATUS_NO_INPUT_ALL);
});
}
//
m_InsideTop .RemoveStatus(ENEMY_STATUS_GHOST);
m_InsideBottom.RemoveStatus(ENEMY_STATUS_GHOST);
m_Top .RemoveStatus(ENEMY_STATUS_GHOST);
m_Bottom .RemoveStatus(ENEMY_STATUS_GHOST);
//
m_iPhase = 0u;
}
// ****************************************************************
//
void cGemingaBoss::__MoveOwn()
{
cMuscusMission* pMission = d_cast<cMuscusMission*>(g_pGame->GetCurMission());
//
this->_UpdateBoss();
//
const cEnemySquad* pSquad1 = (m_iPhase == 200u) ? NULL : pMission->GetEnemySquad(0u);
const cEnemySquad* pSquad2 = (m_iPhase == 200u) ? NULL : pMission->GetEnemySquad(1u);
ASSERT(!pSquad1 || (pSquad1->GetNumEnemies() == GEMINGA_ENEMIES_TELEPORT))
ASSERT(!pSquad2 || (pSquad2->GetNumEnemies() == GEMINGA_ENEMIES_LEGION))
coreFloat fSuck = 0.0f;
// ################################################################
//
if(m_iPhase == 0u)
{
PHASE_CONTROL_TIMER(0u, (1.0f/6.85f), LERP_LINEAR)
{
if(PHASE_BEGINNING)
{
m_Dharuk.Resurrect();
m_Dharuk.AddStatus(ENEMY_STATUS_WORTHLESS);
m_InsideTop .AddStatus(ENEMY_STATUS_GHOST);
m_InsideBottom.AddStatus(ENEMY_STATUS_GHOST);
}
if(PHASE_FINISHED)
{
PHASE_CHANGE_INC
}
});
}
// ################################################################
//
if(m_iPhase == 1u)
{
PHASE_CONTROL_TIMER(0u, 0.5f, LERP_LINEAR)
{
const coreFloat fLerp = BLENDBR(fTime);
this->DefaultMoveLerp(coreVector2(0.0f,2.0f), coreVector2(0.0f,0.0f), fLerp);
m_fMouthAngle = SIN(1.0f*PI * STEP(0.5f, 1.0f, fLerp));
if(PHASE_FINISHED)
{
PHASE_CHANGE_INC
g_pGame->GetInterface()->Reset();
g_pGame->GetInterface()->SetBossChange(true);
m_Dharuk.Kill(false);
m_Dharuk.RemoveStatus(ENEMY_STATUS_WORTHLESS);
m_InsideTop .RemoveStatus(ENEMY_STATUS_GHOST);
m_InsideBottom.RemoveStatus(ENEMY_STATUS_GHOST);
g_pSpecialEffects->MacroEruptionColorBig(this->GetPosition(), coreVector2(0.0f,-1.0f), COLOR_ENERGY_RED);
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_BIG);
g_pSpecialEffects->PlaySound(this->GetPosition(), 0.6f, 1.3f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_BIG, 250u);
}
});
}
// ################################################################
//
if(m_iPhase == 2u)
{
PHASE_CONTROL_TIMER(0u, 2.0f, LERP_LINEAR)
{
const coreFloat fCancel = 1.0f - fTime;
g_MusicPlayer.SetPitch(MAX(fCancel, 0.5f));
g_pGame->SetMusicVolume(STEP(0.0f, 0.5f, fCancel));
if(PHASE_FINISHED)
g_MusicPlayer.Pause();
});
PHASE_CONTROL_PAUSE(1u, 0.4f)
{
PHASE_CHANGE_INC
g_MusicPlayer.Lock([](coreMusicPlayer* OUTPUT pMusicPlayer)
{
pMusicPlayer->GetCurMusic()->SeekTime(6.2f); // guitar: 11.0f
});
g_MusicPlayer.Play();
});
}
// ################################################################
//
else if(m_iPhase == 3u)
{
PHASE_CONTROL_TIMER(0u, 0.5f, LERP_LINEAR)
{
const coreFloat fLerp = BLENDS(fTime);
this->DefaultMoveLerp(m_vLastPosition, coreVector2(0.0f,0.75f), fLerp);
this->DefaultOrientateLerp(0.5f*PI, 2.5f*PI, fLerp);
m_fMouthAngle = SIN(0.1f*PI * MAX0((fLerp - 0.5f) * 2.0f));
const coreFloat fResume = STEPH3(0.0f, 0.25f, fTime);
g_MusicPlayer.SetPitch(MAX(fResume, 0.5f));
g_pGame->SetMusicVolume(STEP(0.0f, 0.5f, fResume));
if(PHASE_TIME_POINT(0.2f))
{
this->_StartBoss();
g_pGame->GetInterface()->SetBossChange(false);
}
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if(m_iPhase == 4u)
{
PHASE_CONTROL_PAUSE(0u, 0.4f)
{
PHASE_CHANGE_TO(50u)
if(DEFINED(_CORE_DEBUG_))
{
//PHASE_CHANGE_TO(100u)
//m_aiCounter[CONNECTED_MOUTH] = 0u;
//PHASE_CHANGE_TO(80u)
}
cMossBackground* pBackground = d_cast<cMossBackground*>(g_pEnvironment->GetBackground());
pBackground->SetEnableLightning(true);
});
}
// ################################################################
// transition to inner phase
else if(m_iPhase == 10u)
{
PHASE_CONTROL_TIMER(0u, 0.7f, LERP_BREAK_REV)
{
static coreSpline2 aMove [GAME_PLAYERS];
static coreFloat afAngle[GAME_PLAYERS];
if(PHASE_BEGINNING)
{
g_pGame->ForEachPlayerAll([&](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
pPlayer->AddStatus(PLAYER_STATUS_GHOST | PLAYER_STATUS_NO_INPUT_MOVE | PLAYER_STATUS_NO_INPUT_TURN);
aMove[i].ClearNodes();
aMove[i].Reserve(2u);
aMove[i].AddNode(pPlayer->GetPosition().xy(), coreVector2(0.0f, 1.0f));
aMove[i].AddNode(this ->GetPosition().xy(), coreVector2(0.0f,-4.0f), 8.0f);
aMove[i].Refine();
afAngle[i] = pPlayer->GetDirection().xy().Angle();
});
}
m_fMouthAngle = LERPBR(1.0f, 0.0f, STEP(0.85f, 1.0f, fTime));
const coreFloat fMoveTime = MIN1(fTime / 0.9f);
g_pGame->ForEachPlayerAll([&](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
const coreVector2 vPos = aMove[i].CalcPositionLerp(fMoveTime);
const coreVector2 vDir = coreVector2::Direction(afAngle[i] + fTime * (4.0f*PI));
pPlayer->SetPosition (coreVector3(vPos, 0.0f));
pPlayer->SetDirection(coreVector3(vDir, 0.0f));
});
if(PHASE_FINISHED)
{
PHASE_CHANGE_INC
g_pGame->ForEachPlayerAll([](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
pPlayer->SetPosition (coreVector3(HIDDEN_POS, 0.0f));
pPlayer->SetDirection(coreVector3(0.0f, 1.0f, 0.0f));
pPlayer->AddStatus (PLAYER_STATUS_NO_INPUT_ALL);
});
g_pSpecialEffects->MacroEruptionColorBig(this->GetPosition(), coreVector2(0.0f,1.0f), COLOR_ENERGY_RED);
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_BIG);
g_pSpecialEffects->PlaySound(this->GetPosition(), 0.6f, 1.3f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_BIG, 250u);
//if(m_pVacuumSound->EnableRef(this))
//{
// m_pVacuumSound->Stop();
//}
}
});
}
// ################################################################
//
else if(m_iPhase == 11u)
{
PHASE_CONTROL_PAUSE(0u, 1.0f)
{
PHASE_CHANGE_INC
m_InsideTop .AddStatus(ENEMY_STATUS_GHOST);
m_InsideBottom.AddStatus(ENEMY_STATUS_GHOST);
m_Top .AddStatus(ENEMY_STATUS_GHOST);
m_Bottom .AddStatus(ENEMY_STATUS_GHOST);
g_pEnvironment->ChangeBackground(cStomachBackground::ID, ENVIRONMENT_MIX_CURTAIN, 1.0f, coreVector2(1.0f,0.0f));
});
}
// ################################################################
//
else if(m_iPhase == 12u)
{
PHASE_CONTROL_TIMER(0u, 0.4f, LERP_LINEAR)
{
const coreFloat fHeightBoss = m_ChangePath.CalcPositionLerp(MIN1(BLENDS(fTime) * 1.4f)).y;
this->SetPosition(coreVector3(0.0f, (m_vLastPosition.y + fHeightBoss) * FOREGROUND_AREA.y, 0.0f));
g_pGame->ForEachPlayerAll([&](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
const coreFloat fLerp = BLENDB(fTime);//BLENDB(CLAMP01((i ? 0.0f : 0.08f) + fTime));
const coreFloat fSide = g_pGame->IsMulti() ? (20.0f * (I_TO_F(i) - 0.5f * I_TO_F(GAME_PLAYERS - 1u))) : 0.0f;
const coreFloat fHeightPlayer = m_ChangePath.CalcPositionLerp(CLAMP01((fLerp * 3.0f - 1.0f) / 2.0f)).y;
pPlayer->SetPosition(coreVector3(fSide, (-3.75f - fHeightPlayer) * FOREGROUND_AREA.y, 0.0f));
STATIC_ASSERT(GAME_PLAYERS == 2u)
});
if(PHASE_FINISHED)
{
PHASE_CHANGE_TO(60u)
g_pGame->ForEachPlayerAll([](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
pPlayer->RemoveStatus(PLAYER_STATUS_GHOST | PLAYER_STATUS_NO_INPUT_ALL);
});
g_pReplay->ApplySnapshot(REPLAY_SNAPSHOT_BOSS_DEFAULT(2u));
}
});
}
// ################################################################
// transition back to outer phase
else if(m_iPhase == 20u)
{
PHASE_CONTROL_TIMER(0u, 0.4f, LERP_LINEAR)
{
static coreFloat afAngle[GAME_PLAYERS];
if(PHASE_BEGINNING)
{
g_pGame->ForEachPlayerAll([](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
pPlayer->AddStatus(PLAYER_STATUS_GHOST | PLAYER_STATUS_NO_INPUT_MOVE | PLAYER_STATUS_NO_INPUT_TURN);
afAngle[i] = pPlayer->GetDirection().xy().Angle();
});
m_fMouthAngle = 0.0f;
m_InsideTop .RemoveStatus(ENEMY_STATUS_GHOST);
m_InsideBottom.RemoveStatus(ENEMY_STATUS_GHOST);
m_Top .RemoveStatus(ENEMY_STATUS_GHOST);
m_Bottom .RemoveStatus(ENEMY_STATUS_GHOST);
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_BIG);
g_pSpecialEffects->PlaySound(SPECIAL_RELATIVE, 0.5f, 1.5f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_BIG, 250u);
cStomachBackground* pBackground = d_cast<cStomachBackground*>(g_pEnvironment->GetBackground());
pBackground->GetHeadlight()->BlendOut();
}
const coreFloat fHeightBoss = m_ChangePath.CalcPositionLerp(CLAMP01((BLENDS(fTime) * 3.0f - 1.0f) / 2.0f)).y;
this->SetPosition(coreVector3(0.0f, (-3.0f - fHeightBoss) * FOREGROUND_AREA.y, 0.0f));
this->SetDirection (coreVector3(0.0f,1.0f,0.0f));
this->SetOrientation(coreVector3(1.0f,0.0f,0.0f));
if(PHASE_TIME_POINT(0.5f))
{
g_pEnvironment->ChangeBackground(g_pEnvironment->GetLastID(), ENVIRONMENT_MIX_CURTAIN, 1.0f, coreVector2(1.0f,0.0f));
}
g_pGame->ForEachPlayerAll([&](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
const coreVector2 vMove = coreVector2(0.0f,1.0f) * (TIME * 110.0f);
const coreVector2 vPos = pPlayer->GetPosition().xy() + vMove;
const coreVector2 vDir = coreVector2::Direction(afAngle[i] + fTime * (14.0f*PI));
pPlayer->SetPosition (coreVector3(vPos, 0.0f));
pPlayer->SetDirection(coreVector3(vDir, 0.0f));
if(vPos.y > FOREGROUND_AREA.y * 1.3f) pPlayer->AddStatus(PLAYER_STATUS_NO_INPUT_ALL);
});
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
PHASE_CONTROL_TICKER(1u, 18u, 10.0f, LERP_LINEAR)
{
const coreFloat fSide = (iTick % 2u) ? 1.0f : -1.0f;
const coreVector2 vPos = coreVector2(fSide * 1.2f, Core::Rand->Float(-0.9f, 0.9f)) * FOREGROUND_AREA;
const coreVector2 vDir = coreVector2(fSide * -1.0f, 0.0f);
g_pSpecialEffects->MacroEruptionColorBig(coreVector3(vPos, 0.0f), vDir, COLOR_ENERGY_RED);
g_pSpecialEffects->PlaySound(coreVector3(vPos, 0.0f), 1.0f, 1.0f, SOUND_ENEMY_EXPLOSION_04);
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_TINY);
});
}
// ################################################################
//
else if(m_iPhase == 21u)
{
PHASE_CONTROL_TIMER(0u, 0.5f, LERP_BREAK)
{
if(PHASE_BEGINNING)
{
g_pGame->ForEachPlayerAll([](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
pPlayer->RemoveStatus(PLAYER_STATUS_NO_INPUT_SHOOT);
});
g_pSpecialEffects->MacroEruptionColorBig(this->GetPosition(), coreVector2(0.0f,1.0f), COLOR_ENERGY_RED);
g_pSpecialEffects->CreateSplashSmoke(this->GetPosition(), 40.0f, 40u, coreVector3(1.0f,1.0f,1.0f));
g_pSpecialEffects->PlaySound(this->GetPosition(), 1.2f, 1.0f, SOUND_ENEMY_EXPLOSION_02);
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_SMALL);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
}
this->DefaultMoveLerp(coreVector2(0.0f,0.0f), coreVector2(0.0f,-0.75f), fTime);
m_fMouthAngle = LERPH3(0.5f - 0.5f * COS((2.0f*PI) * STEP(0.0f, 0.5f, fTime)), SIN(0.1f*PI), fTime);
const coreVector2 vDir = coreVector2::Direction(fTime * (7.0f*PI));
g_pGame->ForEachPlayerAll([&](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
const coreFloat fSide = g_pGame->IsMulti() ? (20.0f * (I_TO_F(i) - 0.5f * I_TO_F(GAME_PLAYERS - 1u))) : 0.0f;
const coreVector2 vPos = coreVector2(fSide * fTime, -this->GetPosition().y);
pPlayer->SetPosition (coreVector3(vPos, 0.0f));
pPlayer->SetDirection(coreVector3(vDir, 0.0f));
STATIC_ASSERT(GAME_PLAYERS == 2u)
});
PHASE_CONTROL_TICKER(1u, 0u, 60.0f * (1.0f - fTime + CORE_MATH_PRECISION), LERP_LINEAR)
{
g_pSpecialEffects->CreateBlowSmoke(this->GetPosition(), coreVector3(0.0f,1.0f,0.0f), 50.0f, 3u, coreVector3(1.0f,1.0f,1.0f));
});
if(PHASE_FINISHED)
{
PHASE_CHANGE_TO(40u)
g_pGame->ForEachPlayerAll([](cPlayer* OUTPUT pPlayer, const coreUintW i)
{
pPlayer->RemoveStatus(PLAYER_STATUS_GHOST | PLAYER_STATUS_NO_INPUT_ALL);
});
g_pReplay->ApplySnapshot(REPLAY_SNAPSHOT_BOSS_DEFAULT(3u));
}
});
}
// ################################################################
//
else if(m_iPhase == 30u)
{
PHASE_CONTROL_TIMER(0u, 2.0f, LERP_LINEAR)
{
if(PHASE_BEGINNING) m_avVector[OLD_MOUTH_ANGLE].x = m_fMouthAngle;
m_fMouthAngle = LERP(m_avVector[OLD_MOUTH_ANGLE].x, 0.0f, fTime);
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if(m_iPhase == 31u)
{
PHASE_CONTROL_TIMER(0u, g_pGame->IsEasy() ? 0.5f : 0.7f, LERP_LINEAR)
{
const coreBool bExit = (this->GetCurHealth() <= 2100);
if(PHASE_BEGINNING)
{
m_avVector[SMASH_POSITION].xy(bExit ? coreVector2(0.0f,0.0f) : this->NearestPlayerDual(m_aiCounter[SMASH_COUNT] % 2)->GetPosition().xy() / FOREGROUND_AREA);
if(((m_aiCounter[SMASH_COUNT] >= 3) || bExit) && this->_ResurrectHelper(ELEMENT_GREEN, true))
{
g_pGame->GetHelper(ELEMENT_GREEN)->SetPosition(this->GetPosition());
}
}
const coreVector2 vFrom = m_vLastPosition;
const coreVector2 vTo = coreVector2(-0.85f, m_avVector[SMASH_POSITION].y);
const coreVector2 vPos = coreVector2(LERP(vFrom.x, vTo.x, SIN(PI * fTime)), LERP(vFrom.y, vTo.y, BLENDS(fTime))) * FOREGROUND_AREA;
this ->SetPosition(coreVector3(vPos, 0.0f));
m_Top .SetPosition(coreVector3(vPos, 0.0f));
m_Bottom.SetPosition(coreVector3(vPos.InvertedX(), 0.0f));
const coreMatrix3 mRota = coreMatrix4::RotationAxis((1.0f*PI) * fTime + ((m_aiCounter[SMASH_COUNT] % 2) ? (1.0f*PI) : (0.0f*PI)), coreVector3(1.0f,0.0f,0.0f)).m123();
m_Top .SetDirection(coreVector3(0.0f,1.0f,0.0f) * mRota);
m_Bottom.SetDirection(coreVector3(0.0f,1.0f,0.0f) * mRota.Transposed());
if(PHASE_FINISHED)
{
if(bExit)
{
if(m_avVector[SMASH_POSITION].z)
{
PHASE_CHANGE_TO(33u)
}
else
{
PHASE_CHANGE_INC
//PHASE_AGAIN(0u)
//this->StorePosition();
m_avVector[SMASH_POSITION].z = 1.0f;
}
}
else
{
PHASE_CHANGE_INC
}
const coreVector2 vPos2 = this->GetPosition().xy();
for(coreUintW i = 0u; i < 13u; ++i)
{
if((i % 2u) == (m_aiCounter[SMASH_COUNT] % 2u)) continue;
const coreVector2 vDir = coreVector2::Direction(DEG_TO_RAD((I_TO_F(i) - 6.0f) * (g_pGame->IsEasy() ? 12.0f : 10.0f)));
g_pGame->GetBulletManagerEnemy()->AddBullet<cWaveBullet>(5, 1.1f, this, vPos2, vDir)->ChangeSize(1.8f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cWaveBullet>(5, 1.1f, this, vPos2, -vDir)->ChangeSize(1.8f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cWaveBullet>(5, 1.0f, this, vPos2, vDir)->ChangeSize(1.8f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cWaveBullet>(5, 1.0f, this, vPos2, -vDir)->ChangeSize(1.8f);
}
g_pSpecialEffects->CreateSplashColor(this->GetPosition(), SPECIAL_SPLASH_TINY, COLOR_ENERGY_GREEN);
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_SMALL);
g_pSpecialEffects->PlaySound(this->GetPosition(), 0.6f, 1.3f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
m_aiCounter[SMASH_COUNT] += 1;
this->_KillHelper(ELEMENT_GREEN, true);
}
});
}
// ################################################################
//
else if(m_iPhase == 32u)
{
PHASE_CONTROL_PAUSE(0u, 2.0f)
{
PHASE_CHANGE_TO(31u)
});
}
// ################################################################
//
else if(m_iPhase == 33u)
{
PHASE_CONTROL_PAUSE(0u, 2.0f)
{
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if(m_iPhase == 34u)
{
PHASE_CONTROL_TIMER(0u, 0.5f, LERP_SMOOTH)
{
const coreVector2 vBase = coreVector2::Direction(fTime * (1.5f*PI));
const coreVector2 vDir = (m_aiCounter[SMASH_COUNT] % 2) ? -vBase : vBase;
m_Top .SetDirection(coreVector3(vDir, 0.0f));
m_Bottom.SetDirection(coreVector3(vDir, 0.0f));
m_Top .SetOrientation(coreVector3(-vBase.Rotated90(), 0.0f));
m_Bottom.SetOrientation(coreVector3(-vBase.Rotated90(), 0.0f));
g_pEnvironment->SetTargetDirectionNow(vBase);
if(PHASE_FINISHED)
PHASE_CHANGE_TO(45u)
});
}
// ################################################################
//
else if(m_iPhase == 40u)
{
PHASE_CONTROL_TIMER(0u, 0.75f, LERP_SMOOTH)
{
if(PHASE_BEGINNING) m_avVector[OLD_MOUTH_ANGLE].x = m_fMouthAngle;
this->DefaultMoveLerp (m_vLastPosition, coreVector2(0.0f,0.8f), fTime);
this->DefaultOrientateLerp(0.5f*PI, 3.5f*PI, fTime);
m_fMouthAngle = LERP(m_avVector[OLD_MOUTH_ANGLE].x, 0.0f, fTime);
if(PHASE_FINISHED)
{
PHASE_CHANGE_INC
m_aiCounter[CONNECTED_MOUTH] = 0;
}
});
}
// ################################################################
//
else if(m_iPhase == 41u)
{
PHASE_CONTROL_TIMER(0u, 0.7f, LERP_LINEAR)
{
if(PHASE_TIME_POINT(0.2f))
{
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_BIG);
g_pSpecialEffects->PlaySound(this->GetPosition(), 0.6f, 1.3f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
for(coreUintW j = 0u; j < 18u; ++j)
{
const coreVector2 vPos = this->GetPosition().xy() + coreVector2(0.0f, (I_TO_F(j) - 8.5f) * 1.45f);
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos, 0.0f), 25.0f, 2u, COLOR_ENERGY_WHITE * 0.8f);
}
}
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if((m_iPhase == 42u) || (m_iPhase == 45u))
{
const coreBool bSecond = (m_iPhase == 45u);
PHASE_CONTROL_TIMER(0u, 1.0f, LERP_BREAK)
{
if(PHASE_BEGINNING)
{
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_SMALL);
g_pSpecialEffects->PlaySound(this->GetPosition(), 0.6f, 1.3f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
}
const coreVector2 vTo = bSecond ? coreVector2(m_vLastPosition.x, 0.85f) : coreVector2(-0.85f, m_vLastPosition.y);
const coreVector2 vPos = LERP(m_vLastPosition, vTo, fTime) * FOREGROUND_AREA;
const coreVector2 vBottom = bSecond ? -vPos : vPos.InvertedX();
this ->SetPosition(coreVector3(vPos, 0.0f));
m_Top .SetPosition(coreVector3(vPos, 0.0f));
m_Bottom.SetPosition(coreVector3(vBottom, 0.0f));
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if((m_iPhase == 43u) || (m_iPhase == 46u))
{
const coreBool bSecond = (m_iPhase == 46u);
PHASE_CONTROL_TIMER(0u, bSecond ? 0.15f : 0.3f, LERP_SMOOTH)
{
const coreVector2 vBase = bSecond ? coreVector2(0.0f,1.0f) : coreVector2(1.0f,0.0f);
const coreFloat fHeight = bSecond ? (SIN(fTime * (2.0f*PI)) * 0.8f) : LERP(m_vLastPosition.y, -m_vLastPosition.y, fTime);
const coreVector2 vPos = (vBase * m_vLastPosition + vBase.yx() * fHeight) * FOREGROUND_AREA;
const coreVector2 vBottom = bSecond ? -vPos : vPos.InvertedX();
this ->SetPosition(coreVector3(vPos, 0.0f));
m_Top .SetPosition(coreVector3(vPos, 0.0f));
m_Bottom.SetPosition(coreVector3(vBottom, 0.0f));
for(coreUintW i = 0u; i < 7u; ++i)
{
if(bSecond ? PHASE_POSITION_POINT(this, 0.76f * (1.0f - (2.0f/6.0f) * I_TO_F(i)) * FOREGROUND_AREA.x, x) :
PHASE_POSITION_POINT(this, 0.76f * (1.0f - (2.0f/6.0f) * I_TO_F(i)) * FOREGROUND_AREA.y, y))
{
if(i % 2u) s_vPositionPoint = bSecond ? -s_vPositionPoint : s_vPositionPoint.InvertedX();
const coreVector2 vDir = vBase * -s_vPositionPoint.Processed(SIGN);
for(coreUintW j = 0u; j < 9u; ++j)
{
if(g_pGame->IsEasy() && ((j < 2u) || (j >= 7u))) continue;
const coreVector2 vPos2 = s_vPositionPoint + vBase * ((j % 2u) ? 1.0f : -1.0f) + vBase.yx() * ((I_TO_F(j) - 4.0f) * 2.9f);
g_pGame->GetBulletManagerEnemy()->AddBullet<cConeBullet>(5, 1.3f, this, vPos2, vDir)->ChangeSize(1.6f);
g_pSpecialEffects->CreateSplashColor(coreVector3(vPos2, 0.0f), 5.0f, 2u, COLOR_ENERGY_ORANGE);
}
g_pSpecialEffects->PlaySound(coreVector3(s_vPositionPoint, 0.0f), 1.0f, 1.0f, SOUND_WEAPON_ENEMY);
}
}
if(bSecond && PHASE_TIME_POINT(0.5f))
{
this->_ResurrectHelper(ELEMENT_ORANGE, false);
}
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if((m_iPhase == 44u) || (m_iPhase == 47u))
{
const coreBool bSecond = (m_iPhase == 47u);
PHASE_CONTROL_TIMER(0u, 1.0f, LERP_BREAK_REV)
{
const coreVector2 vTo = bSecond ? coreVector2(m_vLastPosition.x, 0.0f) : coreVector2(0.0f, m_vLastPosition.y);
const coreVector2 vPos = LERP(m_vLastPosition, vTo, fTime) * FOREGROUND_AREA;
const coreVector2 vBottom = bSecond ? -vPos : vPos.InvertedX();
this ->SetPosition(coreVector3(vPos, 0.0f));
m_Top .SetPosition(coreVector3(vPos, 0.0f));
m_Bottom.SetPosition(coreVector3(vBottom, 0.0f));
if(PHASE_FINISHED)
{
PHASE_CHANGE_TO(bSecond ? 100u : 30u)
g_pSpecialEffects->ShakeScreen(SPECIAL_SHAKE_SMALL);
g_pSpecialEffects->PlaySound(this->GetPosition(), 0.6f, 1.3f, SOUND_EFFECT_SHAKE_01);
g_pSpecialEffects->RumblePlayer(NULL, SPECIAL_RUMBLE_SMALL, 250u);
g_pReplay->ApplySnapshot(REPLAY_SNAPSHOT_BOSS_DEFAULT(bSecond ? 5u : 4u));
}
});
}
// ################################################################
//
else if(m_iPhase == 50u)
{
PHASE_CONTROL_TIMER(0u, 3.0f, LERP_HERMITE3)
{
m_fMouthAngle = SIN(LERP(0.1f*PI, 0.0f*PI, fTime));
if(PHASE_FINISHED)
PHASE_CHANGE_INC
});
}
// ################################################################
//
else if(m_iPhase == 51u)