-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSource.cpp
More file actions
1632 lines (1421 loc) · 60.6 KB
/
Source.cpp
File metadata and controls
1632 lines (1421 loc) · 60.6 KB
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
#include <fmod.hpp>
#include <thread>
#include "file.h"
#include "fullscreen.h"
#include "func.h"
#include "music.h"
#include "time_show.h"
#include "video.h"
int main()
{
SetConsoleTitle(L"Saga of the Noble Barbarian: Dancing God");
/*
HWND consoleWindow = GetConsoleWindow();
float widthX = 0;
int width = 0;
float heightX = 0;
int height = 0;
GetDesktopResolution(width, height);
widthX = width;
widthX = widthX - (widthX * (986 / widthX));
heightX = height;
heightX = heightX - (heightX * (512 / heightX));
width = int(widthX);
height = int(heightX);
//std::cout << widthX << " " << heightX;
SetWindowPos(consoleWindow, 0, width / 2, height / 3, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
*/
//=SET=WINDOW=POSITION============================================Begin
int dWidth;
int dHeight;
int cWidth;
int cHeight;
RECT desktop;
RECT console;
HWND hDesktop = GetDesktopWindow();
HWND hConWindow = GetConsoleWindow();
GetWindowRect(hDesktop, &desktop);
GetWindowRect(hConWindow, &console);
dWidth = desktop.right;
dHeight = desktop.bottom;
cWidth = 980; //console.right;
cHeight = 510; //console.bottom;
SetWindowPos(hConWindow, 0, (dWidth/2) - (cWidth/2), (dHeight/2) - (cHeight/1.5), 0, 0, SWP_NOSIZE | SWP_NOZORDER);
//=SET=WINDOW=POSITION==============================================End
setlocale(LC_ALL, ".1251"); // Ïå÷àòü êèðèëëèöû
SetConsoleCP(1251); // Ââîä ñ êîíñîëè â êîäèðîâêå 1251
SetConsoleOutputCP(1251); // Âûâîä íà êîíñîëü â êîäèðîâêå 1251, øðèôò êîíñîëè Lucida Console èëè Consolas
int s = 1; // Speed
int d = 10; // Delay
int t = 1000; // Time
const int game_start = 40; // First chapter 40
const int chapters_amount = 155; // Last chapter number 153
const int slots = 9; // Inventory slots amount
int chapter = game_start; // Chapter number
int percent = 0; // Percent i from chapters_amount
int menu_mark = 1; // Menu counter
bool continue_mark = 0; // If 0: cout, if 1: write()
bool start_mark = 0; // If 0: Start, if 1: Restart
bool sound_menu = 1; // If 1 - start play sound, if 0 - do nothing
bool menu_pause = 0; // Menu pause indicator
bool next = 0;
int met_ghost = 0; // Meeting with ghost check
int been_110 = 0;
int been_108 = 0;
int been_104 = 0;
int save_met_ghost = 0;
int save_been_110 = 0;
int save_been_108 = 0;
int save_been_104 = 0;
std::string str_met_ghost = "(ghost)"; // Ghost
std::string str_been_110 = "(110)";
std::string str_been_108 = "(108)";
std::string str_been_104 = "(104)";
int n = 0; // Counter for Loading()
float volume = 0.8; // Sound volume
float volume_05 = 0.5; // Sound volume 0.5f
float vol = 0.8;
bool vol_up = 0;
bool vol_down = 0;
char a = '0'; // Answer
std::string check = " "; // Checker for choices
std::string inventory[slots]; // Inventory with 6 slots
int no_choices_found = 0;
int resource_loading_failed = 0;
int counter = 0;
bool ESC_HELD = 0;
//int ESC_PRESSED = 0;
//int ESC_RELEASED = 0;
//=ITEMS==========================================================Begin
std::string item_Millipede_Claw = "Êîãîòü ìíîãîíîæêè";
bool check_item_Millipede_Claw = 0;
std::string item_Guard_Clothes = "Îäåÿíèå ñòðàæíèêà";
bool check_item_Guard_Clothes = 0;
std::string item_Lucky_Solid = "Ñ÷àñòëèâûé ñîëèä";
bool check_item_Lucky_Solid = 0;
std::string item_Priest_Talisman = "Òàëèñìàí æðåöà";
bool check_item_Priest_Talisman = 0;
std::string item_Priest_Chlamys = "Õëàìèäà æðåöà";
bool check_item_Priest_Chlamys = 0;
std::string item_Wand = "Æåçë";
bool check_item_Wand = 0;
std::string item_Silver_Rope = "Ñåðåáðÿíàÿ âåðåâêà";
bool check_item_Silver_Rope = 0;
std::string item_Scroll = "Ñâèòîê";
bool check_item_Scroll = 0;
//=ITEMS============================================================End
//=SAVE=GAME======================================================Begin
int save_chapter = 0; // Save chapter number
std::string save_inventory[slots]; // Save inventory slots
std::string SAVE[5];
bool save_mark = 0;
bool load_mark = 0;
int SAVE_FILE = 0;
int SAVE_OK[5] = {0, 0, 0, 0, 0};
std::string no_data = "< NO DATA >";
//=SAVE=GAME========================================================End
//=INTRO==========================================================Begin
bool show_intro = 1; // If 1: Show intro, if 0: don't show intro
int intro_number = 0;
std::string intro[6];
std::string intro_choice_1 = "> 1: — À ìîæíî ïîïîäðîáíåå?";
std::string intro_choice_2 = "> 2: — Êîíå÷íî íå ñîãëàñåí! È íå ïîäóìàþ äàæå — åùå, ÷åãî äîáðîãî, óáüþò!";
//=INTRO============================================================End
File* file = new File;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
file->path_dialogue = "Resources\\dialogue\\scenario.txt";
file->path_choice = "Resources\\dialogue\\choice.txt";
file->path_save_1 = "Resources\\save\\save_1.txt";
file->path_save_2 = "Resources\\save\\save_2.txt";
file->path_save_3 = "Resources\\save\\save_3.txt";
file->path_save_4 = "Resources\\save\\save_4.txt";
//=LOADING========================================================Begin
for (int i = 600; i <= 605; i++)
{
if (file->FindDialogue(intro[i - 600], i) == 1)
{
resource_loading_failed = 1;
ClearScreen();
//std::cerr << "\n\n ERROR: INTRO IS MISSING";
break;
}
}
std::cout << "\n\n ";
std::cout << "Loading dialogues:\t";
for (int i = 1; i <= chapters_amount; i++)
{
if (file->FindDialogue(file->dialogue[i], i) == 1)
{
resource_loading_failed = 1;
break;
}
Loading(i, chapters_amount, n);
}
n = 0; // Reset for next Loading() calls
std::cout << "\n\n ";
std::cout << "Loading choices:\t";
for (int i = 1; i <= chapters_amount; i++)
{
for (int j = 1; j <= 4; j++)
{
if (file->FindChoice(file->choice[i][j], i, j) == 1)
{
resource_loading_failed = 1;
no_choices_found = 1;
break;
}
}
if (no_choices_found == 1)
{
break;
}
Loading(i, chapters_amount, n);
}
n = 0; // Reset for next Loading() calls
for (int SAVE_SLOT = 1; SAVE_SLOT <= 4; SAVE_SLOT++)
{
if (file->LoadChapter(save_chapter, SAVE_SLOT) == 1)
{
SAVE[SAVE_SLOT] = no_data;
SAVE_OK[SAVE_SLOT] = 0;
}
else if (save_chapter != 0)
{
if (file->LoadSavedName(SAVE_SLOT) != "Wrond DT")
{
SAVE[SAVE_SLOT] = file->LoadSavedName(SAVE_SLOT);
SAVE_OK[SAVE_SLOT] = 1;
}
else
{
SAVE[SAVE_SLOT] = no_data;
SAVE_OK[SAVE_SLOT] = 0;
}
}
else
{
SAVE[SAVE_SLOT] = no_data;
SAVE_OK[SAVE_SLOT] = 0;
}
}
if (resource_loading_failed == 1)
{
std::cerr << "\n\n FATAL ERROR: Game resources are not found, press any key to exit";
a = getch();
a = '0';
exit(1);
}
//=LOADING==========================================================End
//=MUSIC==========================================================Begin
std::cout << "\n\n ";
std::cout << "Music: ";
SetConsoleTextAttribute(hConsole, 128);
std::cout << " "; // 17 spaces
FMOD::System* sound_system;
FMOD::System_Create(&sound_system);
sound_system->init(100, FMOD_LOOP_NORMAL, 0); // 100 - number of channels available to use simultaneously
// MENU
FMOD::Sound* Menu; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\menu.mp3", FMOD_LOOP_NORMAL, 0, &Menu); // Load audio file into memory
FMOD::Channel* MenuChannel; // Associating channel with audio file
sound_system->playSound(Menu, 0, true, &MenuChannel); // Play audio file
//MenuChannel->setLoopCount(-1); // Lopping sound, -1 means repeat endlessly
MenuChannel->setVolume(volume);
SetConsoleTextAttribute(hConsole, 240);
std::cout << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
std::cout << " ";
// CLICK MENU
FMOD::Sound* ClickMenu; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\menu_click.mp3", FMOD_DEFAULT, 0, &ClickMenu); // Load audio file into memory
FMOD::Channel* ClickMenuChannel; // Associating channel with audio file
sound_system->playSound(ClickMenu, 0, true, &ClickMenuChannel); // Play audio file
ClickMenuChannel->stop();
std::cout << " ";
// CHOICE
FMOD::Sound* Choice; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\choice.mp3", FMOD_DEFAULT, 0, &Choice); // Load audio file into memory
FMOD::Channel* ChoiceChannel; // Associating channel with audio file
sound_system->playSound(Choice, 0, true, &ChoiceChannel); // Play audio file
ChoiceChannel->stop();
std::cout << " ";
// NEXT
FMOD::Sound* NextSound; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\next.mp3", FMOD_DEFAULT, 0, &NextSound); // Load audio file into memory
FMOD::Channel* NextChannel; // Associating channel with audio file
sound_system->playSound(NextSound, 0, true, &NextChannel); // Play audio file
NextChannel->stop();
std::cout << " ";
// INVENORY
FMOD::Sound* Inventory; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\inventory.mp3", FMOD_DEFAULT, 0, &Inventory); // Load audio file into memory
FMOD::Channel* InventoryChannel; // Associating channel with audio file
sound_system->playSound(Inventory, 0, true, &InventoryChannel); // Play audio file
InventoryChannel->stop();
std::cout << " ";
// INTRO
FMOD::Sound* IntroSound; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\intro.mp3", FMOD_LOOP_NORMAL, 0, &IntroSound); // Load audio file into memory
FMOD::Channel* IntroChannel; // Associating channel with audio file
sound_system->playSound(IntroSound, 0, true, &IntroChannel); // Play audio file
//IntroChannel->stop();
std::cout << " ";
// MAIN THEME
FMOD::Sound* MAINSound; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\main_theme.mp3", FMOD_LOOP_NORMAL, 0, &MAINSound); // Load audio file into memory
FMOD::Channel* MAINChannel; // Associating channel with audio file
sound_system->playSound(MAINSound, 0, true, &MAINChannel); // Play audio file
//MAINChannel->stop();
std::cout << " ";
// BATTLE
FMOD::Sound* BattleSound; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\battle.mp3", FMOD_LOOP_NORMAL, 0, &BattleSound); // Load audio file into memory
FMOD::Channel* BattleChannel; // Associating channel with audio file
sound_system->playSound(BattleSound, 0, true, &BattleChannel); // Play audio file
//BattleChannel->stop();
std::cout << " ";
// BOSS
FMOD::Sound* BOSSSound; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\BOSS.mp3", FMOD_LOOP_NORMAL, 0, &BOSSSound); // Load audio file into memory
FMOD::Channel* BOSSChannel; // Associating channel with audio file
sound_system->playSound(BOSSSound, 0, true, &BOSSChannel); // Play audio file
//BOSSChannel->stop();
std::cout << " ";
// FINAL
FMOD::Sound* FinalSound; // Allocating memory for audio file
sound_system->createSound("Resources\\sounds\\final.mp3", FMOD_LOOP_NORMAL, 0, &FinalSound); // Load audio file into memory
FMOD::Channel* FinalChannel; // Associating channel with audio file
sound_system->playSound(FinalSound, 0, true, &FinalChannel); // Play audio file
//FinalChannel->stop();
std::cout << " ";
SetConsoleTextAttribute(hConsole, 7);
//MenuChannel->setVolume(volume);
ClickMenuChannel->setVolume(volume);
ChoiceChannel->setVolume(volume);
NextChannel->setVolume(volume);
InventoryChannel->setVolume(volume);
IntroChannel->setVolume(volume);
MAINChannel->setVolume(volume);
BattleChannel->setVolume(volume);
BOSSChannel->setVolume(volume);
FinalChannel->setVolume(volume);
MenuChannel->setPaused(false);
//=MUSIC============================================================End
ClearScreen();
for (;;)
{
//=MAIN=MENU======================================================Begin
while (menu_mark == 1)
{
ClearScreen();
//std::cout << return_current_time_and_date();
//std::cout << width << " " << height;
if (menu_mark == 1 and menu_pause == 1)
{
MenuChannel->setPaused(false); // Set sound paused if (true), unpaused if (false)
}
menu_pause = 1;
std::cout << "\n\n ";
std::cout << "Saga of the Noble Barbarian: Dancing God";
std::cout << "\n\n ";
if (chapter != game_start and chapter != 0)
{
std::cout << "\n\n ";
std::cout << "[ 1 ] Restart";
std::cout << "\n\n ";
std::cout << "[ 2 ] Continue";
std::cout << "\n\n ";
std::cout << "[ 3 ] Save";
}
else
{
if (start_mark == 1 and chapter != 0)
{
std::cout << "\n\n ";
std::cout << "[ 1 ] Restart";
std::cout << "\n\n ";
std::cout << "[ 2 ] Continue";
SetConsoleTextAttribute(hConsole, 8); // 8 - Dark
std::cout << "\n\n ";
std::cout << "[ 3 ] Save";
SetConsoleTextAttribute(hConsole, 7); // 7 - Default
}
else
{
std::cout << "\n\n ";
std::cout << "[ 1 ] Start";
SetConsoleTextAttribute(hConsole, 8);
std::cout << "\n\n ";
std::cout << "[ 2 ] Continue";
std::cout << "\n\n ";
std::cout << "[ 3 ] Save";
SetConsoleTextAttribute(hConsole, 7);
}
}
if (SAVE_OK[1] == 1 or SAVE_OK[2] == 1 or SAVE_OK[3] == 1 or SAVE_OK[4] == 1)
{
std::cout << "\n\n ";
std::cout << "[ 4 ] Load";
}
else
{
SetConsoleTextAttribute(hConsole, 8);
std::cout << "\n\n ";
std::cout << "[ 4 ] Load";
SetConsoleTextAttribute(hConsole, 7);
}
std::cout << "\n\n ";
std::cout << "[ESC] Exit";
SetConsoleTextAttribute(hConsole, 8);
std::cout << "\n\n ";
std::cout << "\n\n ";
std::cout << "Press [ + ] or [ - ] key to change sound volume";
std::cout << "\n\n ";
std::cout << "Press [ENTER] key to skip animation";
std::cout << "\n\n ";
std::cout << "Press [SPACE] key to access Menu when in game";
std::cout << "\n\n ";
std::cout << "Press [ I ] key to access Inventory when in game";
std::cout << "\n\n ";
std::cout << "Hold [ESC] key to EXIT";
SetConsoleTextAttribute(hConsole, 7);
while (a != '1' and a != '2' and a != '3' and a != '4' and a != 27 and a != ' ')
{
a = _getch();
if (a == '1') // Start or Restart
{
chapter = game_start;
for (int i = 0; i < slots; i++)
{
inventory[i] = "< Empty >";
}
check_item_Priest_Chlamys = 0;
check_item_Millipede_Claw = 0;
check_item_Guard_Clothes = 0;
check_item_Lucky_Solid = 0;
check_item_Priest_Talisman = 0;
check_item_Priest_Chlamys = 0;
check_item_Wand = 0;
check_item_Silver_Rope = 0;
check_item_Scroll = 0;
met_ghost = 0;
been_110 = 0;
been_108 = 0;
been_104 = 0;
ClearScreen();
sound_system->playSound(ClickMenu, 0, false, &ClickMenuChannel); // Play audio file
ClickMenuChannel->setVolume(vol);
std::cout << "\n\n ";
//FlashText("Game started");
FlashTextOLD("GAME STARTED");
intro_number = 0;
start_mark = 1;
menu_mark = 2;
continue_mark = 0;
}
else if (a == '2') // Continue
{
if (start_mark == 1 and chapter != 0)
{
sound_system->playSound(ClickMenu, 0, false, &ClickMenuChannel); // Play audio file
ClickMenuChannel->setVolume(vol);
continue_mark = 1;
menu_mark = 2;
}
else
{
a = '0';
}
}
else if (a == '3') // Save
{
if (chapter != game_start and chapter != 0)
{
save_mark = 1;
load_mark = 0;
menu_mark = 4;
}
else
{
a = '0';
}
}
else if (a == '4') // Load
{
if (SAVE_OK[1] == 1 or SAVE_OK[2] == 1 or SAVE_OK[3] == 1 or SAVE_OK[4] == 1)
{
save_mark = 0;
load_mark = 1;
menu_mark = 4;
}
else
{
a = '0';
}
}
else if (a == 27) // Exit
{
for (;;)
{
if (_kbhit())
{
if (GetAsyncKeyState(VK_ESCAPE) & 1)
{
counter++;
ESC_HELD = 1;
if (counter > 2)
{
std::cout << " ";
}
}
else
{
ESC_HELD = 0;
counter = 0;
SetConsoleTextAttribute(hConsole, 7);
break;
}
}
if (counter == 2)
{
//system("cls");
ClearScreen();
std::cout << "\n\n ";
SetConsoleTextAttribute(hConsole, 128);
for (int i = 0; i < 20; i++)
{
std::cout << " ";
}
SetConsoleTextAttribute(hConsole, 7);
std::cout << " EXIT";
std::cout << "\b\b\b\b\b";
SetConsoleTextAttribute(hConsole, 240);
for (int i = 0; i < 20; i++)
{
std::cout << "\b";
}
}
if (counter == 22)
{
SetConsoleTextAttribute(hConsole, 7);
sound_system->release(); // Clear allocated memory
exit(0);
}
Sleep(50);
}
}
else if (a == ' ')
{
if (start_mark == 1 and chapter != 0)
{
sound_system->playSound(ClickMenu, 0, false, &ClickMenuChannel); // Play audio file
ClickMenuChannel->setVolume(vol);
continue_mark = 1;
menu_mark = 2;
}
else
{
a = '0';
}
}
else if (a == '+')
{
if (vol < 0.8f)
{
vol = vol + 0.1f;
MenuChannel->setVolume(vol);
ClickMenuChannel->setVolume(vol);
ChoiceChannel->setVolume(vol);
NextChannel->setVolume(vol);
InventoryChannel->setVolume(vol);
IntroChannel->setVolume(vol);
MAINChannel->setVolume(vol);
BattleChannel->setVolume(vol);
BOSSChannel->setVolume(vol);
FinalChannel->setVolume(vol);
}
sound_system->update();
}
else if (a == '-')
{
if (vol > 0.2f)
{
vol = vol - 0.1f;
MenuChannel->setVolume(vol);
ClickMenuChannel->setVolume(vol);
ChoiceChannel->setVolume(vol);
NextChannel->setVolume(vol);
InventoryChannel->setVolume(vol);
IntroChannel->setVolume(vol);
MAINChannel->setVolume(vol);
BattleChannel->setVolume(vol);
BOSSChannel->setVolume(vol);
FinalChannel->setVolume(vol);
}
sound_system->update();
}
}
a = '0';
if (menu_mark != 1 and menu_mark != 4)
{
MenuChannel->setPaused(true); // Set sound paused if (true), unpaused if (false)
}
}
a = '0';
//=MAIN=MENU========================================================End
//=SAVE=/=LOAD====================================================Begin
while (menu_mark == 4)
{
ClearScreen();
//system("cls");
a = '0';
std::cout << "\n\n ";
if (save_mark == 1)
{
std::cout << "Saving game:";
}
if (load_mark == 1)
{
std::cout << "Loading game:";
}
std::cout << "\n\n ";
std::cout << "\n\n ";
std::cout << "[ 1 ] ";
if (SAVE[1] == no_data)
{
SetConsoleTextAttribute(hConsole, 8);
std::cout << SAVE[1];
SetConsoleTextAttribute(hConsole, 7);
}
else
{
std::cout << SAVE[1];
}
std::cout << "\n\n ";
std::cout << "[ 2 ] ";
if (SAVE[2] == no_data)
{
SetConsoleTextAttribute(hConsole, 8);
std::cout << SAVE[2];
SetConsoleTextAttribute(hConsole, 7);
}
else
{
std::cout << SAVE[2];
}
std::cout << "\n\n ";
std::cout << "[ 3 ] ";
if (SAVE[3] == no_data)
{
SetConsoleTextAttribute(hConsole, 8);
std::cout << SAVE[3];
SetConsoleTextAttribute(hConsole, 7);
}
else
{
std::cout << SAVE[3];
}
std::cout << "\n\n ";
std::cout << "[ 4 ] ";
if (SAVE[4] == no_data)
{
SetConsoleTextAttribute(hConsole, 8);
std::cout << SAVE[4];
SetConsoleTextAttribute(hConsole, 7);
}
else
{
std::cout << SAVE[4];
}
SetConsoleTextAttribute(hConsole, 8);
std::cout << "\n\n ";
std::cout << "\n\n ";
std::cout << "\n\n ";
std::cout << "Press [SPACE] key to return to menu";
SetConsoleTextAttribute(hConsole, 7);
while (a != ' ' and a != '1' and a != '2' and a != '3' and a != '4')
{
a = _getch();
switch (a)
{
case '1':
SAVE_FILE = 1;
break;
case '2':
SAVE_FILE = 2;
break;
case '3':
SAVE_FILE = 3;
break;
case '4':
SAVE_FILE = 4;
break;
case ' ':
SAVE_FILE = 0;
menu_mark = 1;
break;
}
}
if (save_mark == 1)
{
if (SAVE_FILE != 0)
{
ClearScreen();
sound_system->playSound(ClickMenu, 0, false, &ClickMenuChannel); // Play audio file
ClickMenuChannel->setVolume(vol);
std::cout << "\n\n ";
std::cout << "Saving game: ";
file->SaveChapter(chapter, SAVE_FILE);
for (int i = 0; i < slots; i++)
{
file->SaveInventory(inventory[i], i, SAVE_FILE);
Loading(i, slots - 1, n);
}
n = 0;
file->SaveRoom(str_met_ghost, met_ghost, SAVE_FILE);
file->SaveRoom(str_been_110, been_110, SAVE_FILE);
file->SaveRoom(str_been_108, been_108, SAVE_FILE);
file->SaveRoom(str_been_104, been_104, SAVE_FILE);
SAVE[SAVE_FILE] = file->LoadSavedName(SAVE_FILE);
ClearScreen();
std::cout << "\n\n ";
std::cout << "Saved";
SAVE_OK[SAVE_FILE] = 1;
SAVE_FILE = 0;
}
}
if (load_mark == 1)
{
if (SAVE_FILE != 0)
{
if (SAVE_OK[SAVE_FILE] == 1)
{
ClearScreen();
sound_system->playSound(ClickMenu, 0, false, &ClickMenuChannel); // Play audio file
ClickMenuChannel->setVolume(vol);
std::cout << "\n\n ";
std::cout << "Loading game: ";
file->LoadChapter(save_chapter, SAVE_FILE);
for (int i = 0; i < slots; i++)
{
file->LoadInventory(save_inventory[i], i, SAVE_FILE);
Loading(i, slots - 1, n);
}
n = 0; // Reset for next Loading() calls
file->LoadRoom(str_met_ghost, save_met_ghost, SAVE_FILE);
file->LoadRoom(str_been_110, save_been_110, SAVE_FILE);
file->LoadRoom(str_been_108, save_been_108, SAVE_FILE);
file->LoadRoom(str_been_104, save_been_104, SAVE_FILE);
chapter = save_chapter;
for (int i = 0; i < slots; i++)
{
inventory[i] = save_inventory[i];
if (inventory[i] == "< " + item_Priest_Chlamys + " >")
{
check_item_Priest_Chlamys = 1;
}
if (inventory[i] == "< " + item_Millipede_Claw + " >")
{
check_item_Millipede_Claw = 1;
}
if (inventory[i] == "< " + item_Guard_Clothes + " >")
{
check_item_Guard_Clothes = 1;
}
if (inventory[i] == "< " + item_Lucky_Solid + " >")
{
check_item_Lucky_Solid = 1;
}
if (inventory[i] == "< " + item_Priest_Talisman + " >")
{
check_item_Priest_Talisman = 1;
}
if (inventory[i] == "< " + item_Priest_Chlamys + " >")
{
check_item_Priest_Chlamys = 1;
}
if (inventory[i] == "< " + item_Wand + " >")
{
check_item_Wand = 1;
}
if (inventory[i] == "< " + item_Silver_Rope + " >")
{
check_item_Silver_Rope = 1;
}
if (inventory[i] == "< " + item_Scroll + " >")
{
check_item_Scroll = 1;
}
}
met_ghost = save_met_ghost;
been_110 = save_been_110;
been_108 = save_been_108;
been_104 = save_been_104;
ClearScreen();
std::cout << "\n\n ";
std::cout << "Loaded";
Sleep(500);
MenuChannel->setPaused(true); // Set sound paused if (true), unpaused if (false)
start_mark = 1;
menu_mark = 2;
break;
}
SAVE_FILE = 0;
}
}
}
save_mark = 0;
load_mark = 0;
a = '0';
//=SAVE=/=LOAD======================================================End
while (menu_mark == 2)
{
ClearScreen();
//=INTRO==========================================================Begin
if (chapter != game_start)
{
show_intro = 0;
}
if (show_intro == 1)
{
IntroChannel->setPaused(false);
if (intro_number < 5)
{
if (continue_mark == 1)
{
std::cout << intro[intro_number];
}
else
{
WriteTEST(intro[intro_number], a);
}
NextIntroTEST(a, menu_mark, intro_number);
if (a == ' ')
{
sound_system->playSound(ClickMenu, 0, false, &ClickMenuChannel); // Play audio file
ClickMenuChannel->setVolume(vol);
IntroChannel->setPaused(true);
}
else if (a == 'i' or a == 'I' or a == 'ø' or a == 'Ø')
{
sound_system->playSound(Inventory, 0, false, &InventoryChannel); // Play audio file
InventoryChannel->setVolume(vol);
}
else
{
sound_system->playSound(NextSound, 0, false, &NextChannel); // Play audio file
NextChannel->setVolume(vol);
}
a = '0';
continue_mark = 0;
}
else if (intro_number == 5)
{
if (continue_mark == 1)
{
std::cout << intro[intro_number];
}
else
{
WriteTEST(intro[intro_number], a);
}
std::cout << "\n\n ";
std::cout << intro_choice_1;
std::cout << "\n\n ";
std::cout << intro_choice_2;
continue_mark = 0;
while (a != '1' and a != '2' and a != ' ' and a != 'i' and a != 'I' and a != 'ø' and a != 'Ø')
{
a = _getch();
switch (a)
{
case '1':
ClearScreen();
sound_system->playSound(Choice, 0, false, &ChoiceChannel); // Play audio file
ChoiceChannel->setVolume(vol);
std::cout << "\n\n ";
FlashText(intro_choice_1);
show_intro = 0;
chapter = 40;