This repository was archived by the owner on Apr 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathS1CODES3.CPP
1365 lines (1167 loc) · 40.2 KB
/
S1CODES3.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
#include<string.h>
#include<process.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<fstream.h>
#include<iostream.h>
#define sync(u) u%2
class Profile
{
public:
int pfvalid;
char pfname[25];
int hghscr;
int lstscr;
int zcount;
Profile()
{
pfvalid = 1;
strcpy(pfname, "default_profile");
hghscr = 0;
lstscr = 0;
zcount = 0;
}
void getdata(char sstring[])
{
pfvalid = 1;
strcpy(pfname, sstring);
hghscr = 0;
lstscr = 0;
zcount = 0;
}
void putdata()
{
//cout<<"VALIDITY: "<<pfvalid<<endl;
cout<<"PROFILE: "<<pfname<<endl;
cout<<"TOTAL ZOMBIES KILLED: "<<zcount<<endl;
cout<<"HIGHEST SCORE: "<<hghscr<<endl;
cout<<"LAST SCORE: "<<lstscr<<endl;
cout<<endl<<"<PRESS ENTER>"<<endl;
}
void deletepf()
{
pfvalid = 0;
}
};
class Obj
{
public:
char objname[50];
char title[110];
char descript[110];
char bravo[110];
int dref;
int valid;
float armour;
float health;
float attack;
int maxammo;
Obj(
char Cobjname[50],
char Ctitle[110],
char Cdescript[110],
char Cbravo[110],
int Cdref,
int Cvalid,
float Carmour,
float Chealth,
float Cattack,
int Cmaxammo)
{
strcpy(objname, Cobjname);
strcpy(title, Ctitle);
strcpy(descript, Cdescript);
strcpy(bravo, Cbravo);
dref = Cdref;
valid = Cvalid;
armour = Carmour;
health = Chealth;
attack = Cattack;
maxammo = Cmaxammo;
}
Obj()
{
strcpy(objname, "\n");
strcpy(title, "\n");
strcpy(descript, "\n");
strcpy(bravo, "\n");
dref = 0;
valid = 0;
armour = 0.0;
health = 0.0;
attack = 0.0;
maxammo = 0;
}
};
class RoomSlots
{
public:
char objname[50];
char title[110];
char descript[110];
char bravo[110];
int dref;
int valid;
float armour;
float health;
float attack;
int maxammo;
RoomSlots(
char Cobjname[50],
char Ctitle[110],
char Cdescript[110],
char Cbravo[110],
int Cdref,
int Cvalid,
float Carmour,
float Chealth,
float Cattack,
int Cmaxammo)
{
strcpy(objname, Cobjname);
strcpy(title, Ctitle);
strcpy(descript, Cdescript);
strcpy(bravo, Cbravo);
dref = Cdref;
valid = Cvalid;
armour = Carmour;
health = Chealth;
attack = Cattack;
maxammo = Cmaxammo;
}
RoomSlots()
{
strcpy(objname, "\n");
strcpy(title, "\n");
strcpy(descript, "\n");
strcpy(bravo, "\n");
dref = 0;
valid = 0;
armour = 0.0;
health = 0.0;
attack = 0.0;
maxammo = 0;
}
}; /*LivingRoom[],Kitchen[],Backyard[],LocalInfirmary[],Streets[],Church[],PoliceStation[]*/
//||||||||||||||||||||||||||||||||||enemydb
class Enemy
{
public:
char btype[50];
float zhealth;
float zattack;
Enemy(
char Cbtype[50],
float Czhealth,
float Czattack)
{
strcpy(btype, Cbtype);
zhealth = Czhealth;
zattack = Czattack;
}
Enemy()
{
strcpy(btype, "\n");
zhealth = 0.0;
zattack = 0.0;
}
};
Enemy Zombie[2] = {
Enemy("LEAN AND THIN ZOMBIE",8,2),
Enemy("FAT ZOMBIE",12,2.5)
};
Enemy BossZombie("ACID ZOMBIE",90,15);
//||||||||||||||||||||||||||||||||||enemydb
//ii. DATABASE INITIALISATION
fstream file("PLAYPROF.dat", ios::in|ios::out|ios::binary);
Profile player;
//i. OBJECT INITIALISATION
//livingroom
Obj torch1000("LIGHT-TORCH","A PHOSPHORUS TORCH","UTILITY: increase surrounding awareness","You picked up torch, which enhances visibility and thus, attack potential. USE REMAINING:15 ATTACK:+2.5",1000,1,0,15,2.5,15);
Obj redbull1001("REDBULL CAN","A REDBULL CAN","Redbull, hyperactivity?","You drank Redbull (got wings). HEALTH:+2.0",1001,1,0,2.0,0,0);
Obj tv1002("TV","TV MONITOR","TV, turn on/off (!turning on may attract zombies from the streets)","\n",1002,1,0,0,0,0);
Obj bed1003("BED","BED","Bed? Take a nap.","You took a nap, your vital signs look good. HEALTH:+0.2",1003,1,0,0.2,0,0);
Obj umbrella1004("UMBRELLA","OLD TORN UMBRELLA","Umbrella, good-to-go weapon.","You picked up UMBRELLA. USE REMAINING:16 ATTACK:+3.0",1004,1,0,16,3.0,16);
//kitchen
Obj stalebread1005("STALE BREAD","SOME STALE BREAD","Stale bread, take a taste","You ate the bread. HEALTH:+2.0",1005,1,0,2.0,0,0);
Obj knife1006("KNIFE","A BUTCHER'S KNIFE","Zombie-Butcher!","You picked up a knife. USE REMAINING:12 ATTACK:+6.0",1006,1,0,12,6.0,12);
Obj cookies1007("COOKIES","SCATTERED BAKED COOKIES","Fresh cookies, have some maybe?","You ate cookies. HEALTH:+3.0",1007,1,0,3.0,0,0);
Obj fork1008("FORK","A FORK ON THE CROKERY HANGER","Fork?...is a very small weapon.","You picked up a fork. USE REMAINING:5 ATTACK:+1.5",1008,1,0,5,1.5,5);
Obj oldjacket1009("OLD JACKET","AN OLD JACKET","Thick, old, jacket. Hard to penetrate.","You put the jacket on. ARMOUR LEVEL 1",1009,1,1.08,0,0,0);
Obj vinegar1010("VINEGAR","SPILLED VINEGAR","Vinegar has strong stench. Apply to cover scent and distract attacking zombies.","You used Vinegar. HEALTH:+0.80",1010,1,0,0.8,0,0);
Obj tap1011("WATER TAP","LEAKING WATER TAP","Drink Water.","You drank water. HEALTH:+0.25",1011,1,0,0.25,0,0);
Obj china1012("CHINAWARE","CHINAWARE ON THE CROCKERY HANGER","Examine.","Expensive, shiny, china bowl.",1012,1,0,0,0,0);
Obj molotov1013("MOLOTOVS","PETROL BOMBS","Explosives, what are you thinking?","You picked up Molotovs. EXPLOSIVES REMAINING:4 ATTACK:+7.0",1013,1,0,4,7,4);
Obj cell1014("CELL PHONE","CELL PHONE NEAR THE STOVE","Examine.","Battery is dead. Cell phone cannot be used.",1014,1,0,0,0,0);
//backyard
Obj leaf1015("LEAF","GREEN MAPLE LEAF","Maple leaf has medicinal value.","You extracted health. HEALTH:+10.0",1015,1,0,10,0,0);
//localinfirmary
Obj medikit1016("MEDIKIT","MEDIKIT ON THE DESK","Medikit will help you gain health.","You gained health. HEALTH:+15.0",1016,1,0,15,0,0);
Obj rottenapple1017("APPLE","AN APPLE ON THE FLOOR","Pick it up.","The Apple is too rotten to be eaten.",1017,1,0,0,0,0);
Obj gun1018("DESERT EAGLE","A COLT PISTOL","It's a loaded Desert Eagle pistol!","You picked up a pistol. LOADED AMMO:15 ATTACK:+10.0",1018,1,0,15,10,15);
Obj policevest1019("POLICE-VEST","BLOOD STAINED POLICE-VEST","Police-Vest is a Professional Armour.","You put Polive-vest on. ARMOUR LEVEL 2",1019,1,1.15,0,0,0);
Obj bandages1020("BANDAGES","A PAIR OF BANDAGES","You gain health when you apply bandages.","You applied bandages. HEALTH:+2.0",1020,1,0,2.0,0,0);
Obj books1021("BOOKS","BOOKS ON THE SHELF","Read Contents.","Books of a medical practitioner.",1021,1,0,0,0,0);
//streets
Obj rod1022("IRON ROD","A BROKEN IRON ROD","It's heavy and broken sharp at one end... could be a weapon.","You picked up the rod. USE REMAINING:50 ATTACK+8.0",1022,1,0,50,8,50);
Obj garbage1023("GARBAGE","AN ERECT GARBAGE TIN BY THE SIDE OF THE STREET","Look in.","There is a slurry of orange zombie blood.",1023,1,0,0,0,0);
Obj car1024("CAR","A BROKEN DOWN CAR AT THE END OF THE STREET","Look into it.","Dead person on the seat, infected with the zombie virus.\nWill turn into a zombie soon.",1024,1,0,0,0,0);
//church
Obj dagger1025("DAGGER","A DAGGER","Dagger is sharp to cut.","You picked up the dagger. ATTACK+8.0",1025,1,0,30,8,30);
Obj photo1026("PHOTOGRAPH","PHOTOGRAPH ON THE WALL","Take a look.","Painting of Jesus entitled \' The Last Supper\'.",1026,1,0,0,0,0);
Obj dead1027("DEAD","A DEAD BODY NEAR THE ALTAR","Take a close look.","The body has been melted with what seems to be a kind of smoking, green slurry.",1027,1,0,0,0,0);
Obj medikit1028("MEDIKIT","MEDIKIT","Medikit will help you gain health.","You gained health. HEALTH+15.0",1028,1,0,15,0,0);
//ps
Obj rifle1029("WINCHESTER-94","A RIFLE","WINCHESTER-94 SHRAPNEL THROWER... a professional zombie killer it is!","You picked up the Winchester Rifle. LOADED AMMO:0 ATTACK:+17.0",1029,1,0,0,17,25);
Obj shrapnel1030("AMMO","SHRAPNEL AMMO CRATE","Open.","You picked up ammo.",1030,1,0,20,0,20);
Obj acidstain1031("STAIN","SOME GREEN STAIN ON THE FLOOR,","Examine.","There have been acid stains before. Why are they here?",1031,1,0,0,0,0);
Obj dirt1032("DIRT","UNUSUAL GOOEY DIRT ON THE FLOOR AT ANOTHER PLACE","Examine.","The lumps have presence of zombie-blood.",1032,1,0,0,0,0);
Obj medikit1033("MEDIKIT","AN UNLOCKED MEDIKIT","Medikit will help you gain health.","You gained health. HEALTH:+15.0",1033,1,0,15,0,0);
Obj dead1034("DEAD","ANOTHER DEAD BODY (OF A POLICEMAN)","Examine.","His pocket might have car keys. He was trying to escape.\nThere is a police car parked outside.",1034,1,0,0,0,0);
Obj keys1035("KEYS","SOMETHING UNDER THE OFFICER'S HAND","Examine.","Car Keys.",1035,1,0,0,0,0);
//FIRST PERSON GLOBAL PARAMETERS
float health = 10;
//underlying carries slot item info and respective attack potential value
Obj slotobj[2] = {Obj("hand is free","empty","empty","empty",0,0,0.0,0.0,1.0,0), Obj("hand is free","empty","empty","empty",0,0,0.0,0.0,1.0,0)};
Obj armourobj("empty","empty","empty","empty",0,0,0.0,0.0,0.0,0);
int points = 0;
int kills = 0;
char in[20];
//default OBJECT STATIONS INI.
RoomSlots LivingRoom[5];
RoomSlots Kitchen[10];
RoomSlots Backyard[1];
RoomSlots LocalInfirmary[10];
RoomSlots Streets[3];
RoomSlots Church[4];
RoomSlots PS[8];
//MISC. VARIABLES
char ch=' ';
char str[30];
int i_temp;
int i = -1;
int alertflag = 0;
int flag = 0;
int c = 0;
Obj temp;
//FUNCTIONS DECLARED
void titlebox(void);
void updatestat(void);
void smenu(void);
void replenish(int);
void gameover(void);
void introd(void);
void initialise(void);
void inventory(void);
void battle(void);
void battlex(void);
void livingroom(void);
void kitchen(void);
void backyard(void);
void localinfirmary(void);
void streets(void);
void church(void);
void ps(void);
//FUNCTION DEFINITIONS
void livingroomtext()
{
strcpy(in,"Living Room");
cout<<"\n*********************************HOUSE: LIVING ROOM*****************************\n";
cout<<"You are in your living room. It's dark but there is enough illumination to grapple things. It's quiet outside. You haven't spotted a zombie for more than a couple of days because you have been confined to the room. You are not supposed to make noise, as noise and light from homes may attract zombies. Electricity has been cut off and your cell phone is not working. However, you can see some things you could make use of."<<endl;
cout<<"\n<PRESS ENTER>"<<endl; getch();
cout<<"You can see the following objects:\n1. "<<LivingRoom[0].title<<"\n2. "<<LivingRoom[1].title<<"\n3. "<<LivingRoom[2].title<<"\n4. "<<LivingRoom[3].title<<"\n5. "<<LivingRoom[4].title; cout<<"\nFrom here, you can go to:\nh. KITCHEN"<<endl;
}
void livingroom()
{
livingroomtext();
while(1)
{
cout<<"\n+> ";
cin>>ch;
switch(ch)
{
case '1' :
if(LivingRoom[0].valid==1)
{
i++;
cout<<LivingRoom[0].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&LivingRoom[0],sizeof(LivingRoom[0]));
memcpy(&LivingRoom[0],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object is not found in the room."<<endl;
break;
case '2' :
if(LivingRoom[1].valid==1)
{
cout<<LivingRoom[1].descript<<" <PRESS ENTER>"<<endl;
getch();
health += LivingRoom[1].health;
cout<<LivingRoom[1].bravo<<endl;
LivingRoom[1].valid = 0;
strcpy(LivingRoom[1].title,"empty");
}
else cout<<"Object is not found in the room."<<endl;
break;
case '3' :
if(LivingRoom[2].valid==1)
{
cout<<LivingRoom[2].descript<<" <PRESS ENTER>"<<endl;
getch();
if(alertflag==0) { cout<<"Stay alert. Zombies might be heading your way. You turned on the TV."<<endl; alertflag = 1; }
else { cout<<"You're safe. You turned off the TV."<<endl; alertflag = 0; }
}
break;
case '4' :
cout<<LivingRoom[3].descript<<" <PRESS ENTER>"<<endl;
getch();
health += 0.2;
cout<<LivingRoom[3].bravo<<endl;
break;
case '5' : //to
if(LivingRoom[4].valid==1)
{
i++;
cout<<LivingRoom[4].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&LivingRoom[4],sizeof(LivingRoom[4]));
memcpy(&LivingRoom[4],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case 't' : cout<<"You dont't have a previous ROOM to go to."<<endl;
case 'h' : kitchen(); break;
case 'i' : inventory(); break;
case 'r' : livingroomtext(); break;
case 'e' : smenu();
default : cout<<"Please retry."<<endl;
}
}
}
void kitchentext()
{
strcpy(in,"Kitchen");
cout<<"\n*************************************KITCHEN************************************\n";
cout<<"This is your kitchen. You have used almost all the food in here. However, some stale food is still remaining."<<endl;
cout<<"\n<PRESS ENTER>"<<endl; getch(); cout<<"You can see the following objects:\n1. "<<Kitchen[0].title<<"\n2. "<<Kitchen[1].title<<"\n3. "<<Kitchen[2].title<<"\n4. "<<Kitchen[3].title<<"\n5. "<<Kitchen[4].title<<"\n6. "<<Kitchen[5].title<<"\n7. "<<Kitchen[6].title<<"\n8. "<<Kitchen[7].title<<"\n9. "<<Kitchen[8].title<<"\n0. "<<Kitchen[9].title; cout<<"\nFrom here, you can go to and back to the following:\nh. BACKYARD, (there is some strange noise outside, flashes through the window)\nt. LIVING ROOM"<<endl;
}
void kitchen()
{
kitchentext();
while(1)
{
cout<<"\n+>";
cin>>ch;
switch(ch)
{
case '1' :
if(Kitchen[0].valid==1)
{
cout<<Kitchen[0].descript<<" <PRESS ENTER>"<<endl;
getch();
health += Kitchen[0].health;
cout<<Kitchen[0].bravo<<endl;
Kitchen[0].valid = 0;
strcpy(Kitchen[0].title,"empty");
}
else cout<<"Object not found in the room."<<endl;
break;
case '2' :
i++;
if(Kitchen[1].valid==1)
{
cout<<Kitchen[1].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&Kitchen[1],sizeof(Kitchen[1]));
memcpy(&Kitchen[1],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '3' :
if(Kitchen[2].valid==1)
{
cout<<Kitchen[2].descript<<" <PRESS ENTER>"<<endl;
getch();
health += Kitchen[2].health;
cout<<Kitchen[2].bravo<<endl;
Kitchen[2].valid = 0;
strcpy(Kitchen[2].title,"empty");
}
else cout<<"Object not found in the room."<<endl;
break;
case '4' :
i++;
if(Kitchen[3].valid==1)
{
cout<<Kitchen[3].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&Kitchen[3],sizeof(Kitchen[3]));
memcpy(&Kitchen[3],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '5' :
i++;
if(Kitchen[4].valid==1)
{
cout<<Kitchen[4].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&armourobj,sizeof(armourobj));
memcpy(&armourobj,&Kitchen[4],sizeof(Kitchen[4]));
memcpy(&Kitchen[4],&temp,sizeof(temp));
cout<<armourobj.bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '6' :
if(Kitchen[5].valid==1)
{
cout<<Kitchen[5].descript<<" <PRESS ENTER>"<<endl;
getch();
health += Kitchen[5].health;
cout<<Kitchen[5].bravo<<endl;
Kitchen[5].valid = 0;
strcpy(Kitchen[5].title,"empty");
}
else cout<<"Object is not found in the room."<<endl;
break;
case '7' :
cout<<Kitchen[6].descript<<" <PRESS ENTER>"<<endl;
getch();
health += Kitchen[6].health;
cout<<Kitchen[6].bravo<<endl;
break;
case '8' :
cout<<Kitchen[7].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<Kitchen[7].bravo<<endl;
break;
case '9' :
i++;
if(Kitchen[8].valid==1)
{
cout<<Kitchen[8].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&Kitchen[8],sizeof(Kitchen[8]));
memcpy(&Kitchen[8],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '0' :
cout<<Kitchen[9].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<Kitchen[9].bravo<<endl;
break;
case 't' : livingroom(); break;
case 'h' : backyard(); break;
case 'i' : inventory(); break;
case 'r' : kitchentext(); break;
case 'e' : smenu();
default : cout<<"Please retry."<<endl;
}
}
}
void backyardtext()
{
strcpy(in,"Backyard");
cout<<"\n*************************************BACKYARD***********************************\n";
cout<<"Not having been maintained for weeks, over grown grass and debris has made the backyard difficult to walk into. There are traces of zombie blood, too."<<endl;
cout<<"\n<PRESS ENTER>"<<endl; getch(); cout<<"You can see only one object here\n1. "<<Backyard[0].title<<endl;
cout<<"From here, you can go to and back to:\nh. LOCAL INFIRMARY\nt. KITCHEN"<<endl; }
void backyard()
{
backyardtext();
cout<<"\n<PRESS ENTER>"<<endl;
getch();
cout<<"Oh no! a rummaging zombie just saw you from the streets.\nYou need to fight your way back to safety.\nIt's heading your way. Here, it comes!"<<endl;
battle();
backyardtext();
while(1)
{
cout<<endl<<"\n+>";
cin>>ch;
switch(ch)
{
case '1' :
if(Backyard[0].valid==1)
{
cout<<Backyard[0].descript<<" <PRESS ENTER>"<<endl;
getch();
health += Backyard[0].health;
cout<<Backyard[0].bravo<<endl;
Backyard[0].valid = 0;
strcpy(Backyard[0].title,"empty");
}
else cout<<"Object is not found in the room."<<endl;
break;
case 't' : kitchen();
case 'h' : localinfirmary(); break;
case 'i' : inventory(); break;
case 'r' : backyardtext(); break;
case 'e' : smenu();
default : cout<<"Please retry."<<endl;
}
}
}
void localinfirmarytext()
{
strcpy(in,"Local Infirmary");
cout<<"\n********************************LOCAL INFIRMARY********************************\n";
cout<<"The infirmary is located at the street next to that you house is at, making it accessible through your backyard. The infirmary used to be run by clinic practitioner in a small 30x30ft room directly overlooking the street. You carefully crossed the street as not to alert the zombie at a distance. The room is full of debris that has wounded round the torn green curtains that used to shield the only door."<<endl;
cout<<"\n<PRESS ENTER>"<<endl; getch(); cout<<"You can explore the following objects:\n1. "<<LocalInfirmary[0].title<<"\n2. "<<LocalInfirmary[1].title<<"\n3. "<<LocalInfirmary[2].title<<"\n4. "<<LocalInfirmary[3].title<<"\n5. "<<LocalInfirmary[4].title<<"\n6. "<<LocalInfirmary[5].title; cout<<"\nFrom here, you can go to and back to:\nh. STREETS\nt. BACKYARD"<<endl; }
void localinfirmary()
{
localinfirmarytext();
while(1)
{
cout<<endl<<"\n+>";
cin>>ch;
switch(ch)
{
case '1' :
if(LocalInfirmary[0].valid==1)
{
cout<<LocalInfirmary[0].descript<<" <PRESS ENTER>"<<endl;
getch();
health += LocalInfirmary[0].health;
cout<<LocalInfirmary[0].bravo<<endl;
LocalInfirmary[0].valid = 0;
strcpy(LocalInfirmary[0].title,"empty");
}
else cout<<"Object is not found in the room."<<endl;
break;
case '2' :
cout<<LocalInfirmary[1].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<LocalInfirmary[1].bravo<<endl;
break;
case '3' :
i++;
if(LocalInfirmary[2].valid==1)
{
cout<<LocalInfirmary[2].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&LocalInfirmary[2],sizeof(LocalInfirmary[2]));
memcpy(&LocalInfirmary[2],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '4' :
i++;
if(LocalInfirmary[3].valid==1)
{
cout<<LocalInfirmary[3].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&armourobj,sizeof(armourobj));
memcpy(&armourobj,&LocalInfirmary[3],sizeof(LocalInfirmary[3]));
memcpy(&LocalInfirmary[3],&temp,sizeof(temp));
cout<<armourobj.bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '5' :
if(LocalInfirmary[4].valid==1)
{
cout<<LocalInfirmary[4].descript<<" <PRESS ENTER>"<<endl;
getch();
health += LocalInfirmary[4].health;
cout<<LocalInfirmary[4].bravo<<endl;
LocalInfirmary[4].valid = 0;
strcpy(LocalInfirmary[4].title,"empty");
}
else cout<<"Object is not found in the room."<<endl;
break;
case '6' :
cout<<LocalInfirmary[5].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<LocalInfirmary[5].bravo<<endl;
break;
case 't' : backyard(); break;
case 'h' : streets(); break;
case 'i' : inventory(); break;
case 'r' : localinfirmarytext(); break;
case 'e' : smenu();
default : cout<<"Please retry."<<endl;
}
}
}
void streetstext()
{
strcpy(in,"Streets");
cout<<"\n**************************************STREETS***********************************\n";
cout<<"You are out from under the infirmary's roof, out into the streets. You are carefully walking down the path, trying to make no noise. However, you are not in the shadows."<<endl;
cout<<"\n<PRESS ENTER>"<<endl; getch(); cout<<"There are some random things in the street:\n1. "<<Streets[0].title<<"\n2. "<<Streets[1].title<<"\n3. "<<Streets[2].title<<endl; cout<<"From here, you can go to and back to:\nh. CHURCH \nt. LOCAL INFIRMARY"<<endl;
}
void streets()
{
streetstext();
cout<<"\n<PRESS ENTER>"<<endl;
getch();
cout<<"Look! Zombies are coming. You've been spotted.\nHere, they come."<<endl;
battle();
cout<<"And here is another one!"<<endl;
battle();
streetstext();
while(1)
{
cout<<endl<<"\n+>";
cin>>ch;
switch(ch)
{
case '1' :
i++;
if(Streets[0].valid==1)
{
cout<<Streets[0].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&Streets[0],sizeof(Streets[0]));
memcpy(&Streets[0],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '2' :
cout<<Streets[1].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<Streets[1].bravo<<endl;
break;
case '3' :
cout<<Streets[2].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<Streets[2].bravo<<endl;
break;
case 't' : localinfirmary(); break;
case 'h' : church(); break;
case 'i' : inventory(); break;
case 'r' : streetstext(); break;
case 'e' : smenu();
default : cout<<"Please retry."<<endl;
}
}
}
void churchtext()
{
strcpy(in,"Church");
cout<<"\n**************************************CHURCH************************************\n";
cout<<"The church has been destroyed by zombie attacks. What you see in front was very much different from the time when you used to come here strolling, with your pet dog."<<endl;
cout<<"\n<PRESS ENTER>"<<endl; getch(); cout<<"The following can be seen around:\n1. "<<Church[0].title<<"\n2. "<<Church[1].title<<"\n3. "<<Church[2].title<<"\n4. "<<Church[3].title<<endl<<endl; cout<<"From here, you can go to and back to:\nh. POLICE STATION \nt. STREETS"<<endl;
}
void church()
{
churchtext();
cout<<"\n<PRESS ENTER>"<<endl;
getch();
cout<<"Zombies are coming gain. Get ready."<<endl;
battle();
cout<<"There is a herd of them!"<<endl;
battle();
cout<<"They keep coming, here is another one."<<endl;
battle();
churchtext();
while(1)
{
cout<<endl<<"\n+>";
cin>>ch;
switch(ch)
{
case '1' :
i++;
if(Church[0].valid==1)
{
cout<<Church[0].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&Church[0],sizeof(Church[0]));
memcpy(&Church[0],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '2' :
cout<<Church[1].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<Church[1].bravo<<endl;
break;
case '3' :
cout<<Church[2].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<Church[2].bravo<<endl;
break;
case '4' :
if(Church[3].valid==1)
{
cout<<Church[3].descript<<" <PRESS ENTER>"<<endl;
getch();
health += Church[3].health;
cout<<Church[3].bravo<<endl;
Church[3].valid = 0;
strcpy(Church[3].title,"empty");
}
else cout<<"Object is not found in the room."<<endl;
break;
case 't' : streets(); break;
case 'h' : ps(); break;
case 'i' : inventory(); break;
case 'r' : churchtext(); break;
case 'e' : smenu();
default : cout<<"Please retry."<<endl;
}
}
}
void pstext()
{
strcpy(in,"Police Station");
cout<<"\n***********************************POLICE STATION*******************************\n";
cout<<"You have finally reached your destination. This is the place when you are supposed to be extracted from. However, the police station is now a mess. You need to be careful though."<<endl;
cout<<"\n<PRESS ENTER>"<<endl; getch(); cout<<"You can interact with the following objects:\n1. "<<PS[0].title<<"\n2. "<<PS[1].title<<"\n3. "<<PS[2].title<<"\n4. "<<PS[3].title<<"\n5. "<<PS[4].title<<endl; cout<<"From here, you can go back to:\nt. CHURCH\nc. or CONTINUE"<<endl;
}
void pstext2()
{
strcpy(in,"Police Station");
cout<<"There are some things more in here:\n1. "<<PS[5].title<<"\n2. "<<PS[6].title<<endl;
}
void ps()
{
int boost = 0;
pstext();
cout<<"It's too quiet.";
cout<<"\n<PRESS ENTER>"<<endl; getch();
cout<<"Zombies are coming gain."<<endl;
battle();
pstext();
while(boost==0)
{
cout<<endl<<"\n+>";
cin>>ch;
switch(ch)
{
case '1' :
i++;
if(PS[0].valid==1)
{
cout<<PS[0].descript<<" <PRESS ENTER>"<<endl;
getch();
memcpy(&temp,&slotobj[sync(i)],sizeof(slotobj[sync(i)]));
memcpy(&slotobj[sync(i)],&PS[0],sizeof(PS[0]));
memcpy(&PS[0],&temp,sizeof(temp));
cout<<slotobj[sync(i)].bravo<<endl;
}
else cout<<"Object not found in the room."<<endl;
break;
case '2' :
if(PS[1].valid==1)
{
cout<<PS[1].descript<<" <PRESS ENTER>"<<endl;
getch();
if(slotobj[0].dref==1029) { slotobj[0].health += PS[1].maxammo; cout<<PS[1].bravo<<endl; PS[1].valid = 0; }
else if(slotobj[1].dref==1029) { slotobj[1].health += PS[1].maxammo; cout<<PS[1].bravo<<endl; PS[1].valid = 0; }
else cout<<"You don't have the weapon this ammo is required for."<<endl;
break;
}
else cout<<"Crate is empty."<<endl;
break;
case '3' :
cout<<PS[2].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<PS[2].bravo<<endl;
break;
case '4' :
cout<<PS[3].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<PS[3].bravo<<endl;
break;
case '5' :
if(PS[4].valid==1)
{
cout<<PS[4].descript<<" <PRESS ENTER>"<<endl;
getch();
health += PS[4].health;
cout<<PS[4].bravo<<endl;
PS[4].valid = 0;
strcpy(PS[4].title,"empty");
}
else cout<<"Object is not found in the room."<<endl;
break;
case 't' : church(); break;
case 'i' : inventory(); break;
case 'r' : pstext(); break;
case 'e' : smenu();
case 'c' : boost = 1; break;
default : cout<<"Please retry."<<endl;
}
}
cout<<"\n<PRESS ENTER>"<<endl; getch();
cout<<"Behooollldd!!! A huge Acid Zombie is heading towards you."<<endl;
battlex();
//escape...
cout<<"How nice you survived!"<<endl;
pstext2();
while(1)
{
cout<<endl<<"\n+>";
cin>>ch;
switch(ch)
{
case '1' :
cout<<PS[5].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<PS[5].bravo<<endl;
break;
case '2' :
cout<<PS[6].descript<<" <PRESS ENTER>"<<endl;
getch();
cout<<PS[6].bravo<<endl;
cout<<"You found car keys and there is a police vehicle standing by."<<endl;
cout<<"\n<PRESS ENTER>"<<endl; getch();
cout<<"Approach the car."<<endl;
cout<<"<PRESS ENTER> to open the door, and escape>"<<endl;
getch();
cout<<"You escaped!\nThank you for playing the game."<<endl;
getch(); smenu();
break;
case 'i' : inventory(); break;
case 'r' : pstext2(); break;
case 'e' : smenu();
default : cout<<"Please retry."<<endl;
}
}
}
void inventory()
{
cout<<endl<<"ROOM :"<<endl;
cout<<" "<<in<<endl;
cout<<"INVENTORY:"<<endl;
cout<<" HEALTH > "<<health<<endl;
cout<<" ARMOUR > ANTI-PENETRATION "<<armourobj.armour<<"x"<<endl;
cout<<" ATTACK > "<<slotobj[0].attack+slotobj[1].attack<<endl;
cout<<"YOU ARE CARRYING: \nWEAPON(S): <"<<slotobj[0].objname<<":"<<slotobj[0].health<<"/"<<slotobj[0].maxammo<<"> <"<<slotobj[1].objname<<":"<<slotobj[1].health<<"/"<<slotobj[1].maxammo<<">";
cout<<endl<<"ARMOUR: <"<<armourobj.objname<<">"<<endl<<endl;