-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_end.c
More file actions
288 lines (250 loc) · 8.12 KB
/
Copy pathstart_end.c
File metadata and controls
288 lines (250 loc) · 8.12 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
#include <stdio.h>
#include <stdlib.h>
#include "char_creation.h"
#include "start_end.h"
#include "Custom_structures.h"
extern int choice_while = 0;
/*************************************************************************/
/* FUNCTION NAME: start_game */
/* DESCRIPTION: prints the menu and story at the start of the game */
/* ARGUMENT LIST: */
/* Argument Type IO Description */
/* _____________________ ________ ____ __________________________________*/
/* - - - - */
/* RETURN VALUE: void */
/* CHANGES: - */
/*************************************************************************/
void start_game()
{
char screen1_start_game[] = "screen1_start_game.txt";
char screen2_start_game[] = "screen2_start_game.txt";
char how_start_game[] = "how_start_game.txt";
char menu_start_game[] = "menu_start_game.txt";
char more_start_game[] = "more_start_game.txt";
char ready_start_game[] = "ready_start_game.txt";
char quit_start_game[] = "quit_start_game.txt";
char ASCII_dungeon[] = "ASCII_dungeon.txt";
int choice_intern = 0, choice_start = 0;
while (choice_start != 1)
{
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(menu_start_game);
scanf("%d", &choice_while);
switch (choice_while)
{
case 1:
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(ready_start_game);
scanf("%d", &choice_start);
if (choice_start == 1)
{
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
printf("\n\n\n");
file_print(screen1_start_game);
file_print(ASCII_dungeon);
scanf("%d", &choice_intern);
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(screen2_start_game);
scanf("%d", &choice_intern);
break;
}
default:
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(quit_start_game);
exit(0);
break;
case 2:
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(how_start_game);
scanf("%d", &choice_intern);
break;
case 3:
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(more_start_game);
scanf("%d", &choice_intern);
break;
}
}
}
/*************************************************************************/
/* FUNCTION NAME: mid_game */
/* DESCRIPTION: prints the story at the middle of the game */
/* ARGUMENT LIST: */
/* Argument Type IO Description */
/* _____________________ ________ ____ __________________________________*/
/* - - - - */
/* RETURN VALUE: void */
/* CHANGES: - */
/*************************************************************************/
void mid_game()
{
char screen1_mid_game[] = "screen1_mid_game.txt";
char screen2_mid_game[] = "screen2_mid_game.txt";
char screen3_mid_game[] = "screen3_mid_game.txt";
char option1_mid_game[] = "option1_mid_game.txt";
char option2_mid_game[] = "option2_mid_game.txt";
char option3_mid_game[] = "option3_mid_game.txt";
char screen4_mid_game[] = "screen4_mid_game.txt";
char screen5_mid_game[] = "screen5_mid_game.txt";
char ASCII_gryphon[] = "ASCII_gryphon.txt";
char ASCII_minotaur[] = "ASCII_minotaur.txt";
int choice_intern = 0, choice_switch = 0;
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(screen1_mid_game);
scanf("%d", &choice_intern);
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(screen2_mid_game);
file_print(ASCII_gryphon);
scanf("%d", &choice_intern);
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(screen3_mid_game);
scanf("%d", &choice_intern);
switch (choice_intern)
{
case 1:
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(option1_mid_game);
scanf("%d", &choice_switch);
break;
case 2:
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(option2_mid_game);
scanf("%d", &choice_switch);
break;
case 3:
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(option3_mid_game);
scanf("%d", &choice_switch);
break;
}
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(screen4_mid_game);
scanf("%d", &choice_intern);
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(screen5_mid_game);
file_print(ASCII_minotaur);
scanf("%d", &choice_intern);
}
/*************************************************************************/
/* FUNCTION NAME: end_game */
/* DESCRIPTION: prints endscreens at the end of the game */
/* ARGUMENT LIST: */
/* Argument Type IO Description */
/* _____________________ ________ ____ __________________________________*/
/* Player Character* I points to the variable that */
/* stores the player stats */
/* name_p char * I points to the variable that */
/* stores the name */
/* RETURN VALUE: void */
/* CHANGES: - */
/*************************************************************************/
void end_game(Character *Player, char *name_p)
{
char win_end_game[] = "win_end_game.txt";
char lose_end_game[] = "lose_end_game.txt";
char ASCII_gameover[] = "ASCII_gameover.txt";
int choice_intern = 0;
Player->attack = 5;
Player->heal = 2;
Player->armor = 2;
if (Player->life > 0)
{
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(ASCII_gameover);
file_print(win_end_game);
printf("\n\n\t\t\t\t\t\t\t You did a great job, %s!\n", name_p);
scanf("%d", &choice_intern);
}
else
{
#if defined(_WIN32)
system("cls");
#else
system("clear");
#endif
center_text();
file_print(ASCII_gameover);
file_print(lose_end_game);
printf("\n\n\t\t\t\t\t\t\t You did a great job, %s!\n", name_p);
scanf("%d", &choice_intern);
}
}