-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
203 lines (167 loc) · 6.77 KB
/
Main.cpp
File metadata and controls
203 lines (167 loc) · 6.77 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
/****************************************************************************************************
** Program name: Eldritch Estate text adventure Game (CS 162 Final Project)
** Author: Alejandro Romero
** Date: 2/14/2017
** Description: This program is an H.P Lovecraft inspired horror mystery themed text adventure game.
** The goal of the game will be for the player to piece together clues to solve a mystery and stop a
** powerful creature before they go insane. (Sanity loss will be how I implement my time limit.)
** The game will take place at an estate which contains many rooms (linked pointer variables)
** to be explored. The program also makes use of containers for inventory and discard piles.
** The game is won once the final boss has been defeated, and lost if the player dies (health reached 0)
** or goes insane before they can solve the mystery. (sanity reaches 0).
******************************************************************************************************/
#include <iostream>
#include <string>
#include <fstream>
#include "Game.hpp"
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::getline;
using std::ifstream;
int menu();
int main()
{
bool quit = false;
int userChoice;
//string pause;
cout << "Welcome to Eldritch Estate " << endl;
cout << " An H.P Lovecraft inspired horror text adventure game by Alejandro Romero." << endl;
cout << endl;
cout << endl;
//notify user to play in full screen (for display purposes)
cout << endl;
cout << "For a better playthrough experience, please assure that you are in Full Screen mode." << endl;
cout << "It is also reccomended to listen to The Necronomicon HP Lovecraft Orchestral Horror Music on youtube while playing." << endl;
cout << endl;
//wait for the user to switch to full screen
string temp;
cout << "PRESS ENTER TO CONTINUE" << endl;
getline(cin, temp);
cin.clear();
cout << "\033[2J\033[1;1H" << endl;
while (!quit)
{
//diplay the title image
string imageLines = "";
string fileName = "EETitleMenu.txt";
ifstream inputFile;
inputFile.open(fileName.c_str());
if (inputFile)
{
while (inputFile)
{
string temp;
getline(inputFile, temp);
temp += "\n";
imageLines += temp;
}
cout << imageLines << endl;
inputFile.close();
}
else
cout << "ERROR: Image file wasn't found..." << endl;
userChoice = menu();
if (userChoice == 1)
{
inputFile.open(fileName.c_str());
if (inputFile)
{
while (inputFile)
{
string temp1;
getline(inputFile, temp1);
temp1 += "\n";
imageLines += temp1;
}
cout << imageLines << endl;
inputFile.close();
}
else
cout << "ERROR: Image file wasn't found..." << endl;
cout << "You stand in the pouring rain facing the estate of Mr. Giles Weston. Not to long ago you recieved a " << endl;
cout << "phone call from your friend, detective Vincent Barnes. He said that he once again needed your expertise." << endl;
cout << "Expertise that 'only a distinguished professor of the Miskotonic University such as yourself' could provide." << endl;
cout << "He recieved word from Mr.Weston's butler that 'strange' and 'unnatural' things have started to occur at the " << endl;
cout << "estate and has asked you to meet him there to further investigate. You saw Vincents car as you approched, " << endl;
cout << "but no signs of Vincent. You decide that he probably went on ahead and armed with nothing but your satchel " << endl;
cout << "and note book, you resolve to enter the estate. As you attempt to knock, the door creaks open on its own " << endl;
cout << "volition and you find yourself standing in the foyer." << endl;
cout << endl;
//pause
string pause;
cout << "PRESS ENTER TO CONTINUE" << endl;
cin.ignore(); //needed
getline(cin, pause);
cin.clear();
cout << "\033[2J\033[1;1H";//comment out for VS
Game EE;
EE.play();
}
else if (userChoice == 2)
{
cout << "\033[2J\033[1;1H";//comment out for VS
cout << "Eldritch Estate Walkthrough" << endl;
cout << "**WARNING: THE FOLLOWING CONTAINS SPOLERS ON HOW TO BEAT THE GAME." << endl;
cout << "Do not read unless you are testing the game or hopelessly stuck." << endl;
cout << endl;
cout << "1. Search the under the divan in the foyer to acquire the ornate dagger. " << endl;
cout << "2. From the foyer go directly left into the dining room, and keep going through into the kitchen." << endl;
cout << "3. Search the body in the kitchen to obtain the skeleton key." << endl;
cout << "4. Return to the foyer and go right into the study." << endl;
cout << "5. Search the bust for an old brass key." << endl;
cout << "6. Exit the study going right into the conservatory, then go out up into the garden." << endl;
cout << "7. Search shed for lantern and workbench for elixir of health." << endl;
cout << "8. Return to foyer and then go up into the hallway." << endl;
cout << "9. Defeat the cultist and search his body for strange rune." << endl;
cout << "10. Go right into master bedroom and search under bed for elder sign." << endl;
cout << "11. Go back out into hallway then go left into guest bedroom." << endl;
cout << "12. Search body in guest bedroom for revolver." << endl;
cout << "13. Return to foyer." << endl;
cout << "14. Go down into basement and attempt to light up the room." << endl;
cout << "15. Examine the relief on the wall and insert strange rune." << endl;
cout << "16. Return to room menu and go through the secret passageway." << endl;
cout << "17. Defeat final Boss, win the game." << endl;
cout << "*Note* you will be required to discard unneeded items such as notebook from inventory." << endl;
cout << endl;
string pause1;
cout << "PRESS ENTER TO CONTINUE" << endl;
cin.ignore(); //needed
getline(cin, pause1);
cin.clear();
cout << "\033[2J\033[1;1H";//comment out for VS
}
else if (userChoice == 3)
{
quit = true;
cout << "Thank you for using this program." << endl;
}
}
return 0;
}
int menu()
{
int menuchoice;
cout << "Please select from the following menu options and press enter." << endl;
cout << "1. Play Game." << endl;
cout << "2. View walthrough for beating the game. (Only recommended for testing.)" << endl;
cout << "3. Quit. " << endl;
cin >> menuchoice;
switch (menuchoice)
{
case 1:
return 1;
break;
case 2:
return 2;
break;
case 3:
return 3;
break;
default:
cout << "The valid choices are 1 through 3." << endl;
cout << "Please try again." << endl;
cout << endl;
}
}