-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplit.cpp
164 lines (139 loc) · 3.92 KB
/
split.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
//Author of this file: Leah Moser
// This is the file that will be in charge of
//The split screen with stats
#include "split.h"
void printCenter(int startingCols, int cols, int line, const char *toPrint) {
int length = strlen(toPrint);
int printCol = ((cols - length) / 2) + startingCols;
mvprintw(line, printCol, toPrint);
return;
}
void drawValues(int x_beg, int whiffles, int energy, bool binocs, bool boat) {
char *bino = (char*)"off";
char *bote = (char*)"off";
//conversion from integers to chars for window print
if(binocs == true)
{
bino = (char*)"on ";
}
if(boat == true)
{
bote = (char*)"on ";
}
printCenter(x_beg, COLS/4, 2, "Hero of Frupal");
mvprintw(LINES-13, x_beg+3, "Whiffles: ");
mvprintw(LINES-12, x_beg+3, "%-4d", whiffles);
mvprintw(LINES-10, x_beg+3, "Energy: ");
mvprintw(LINES-9, x_beg+3, "%-3d", energy);
mvprintw(LINES-7, x_beg+3, "Binoculars: ");
mvprintw(LINES-6, x_beg+3, bino);
mvprintw(LINES-4, x_beg+3, "Ship: ");
mvprintw(LINES-3, x_beg+3, bote);
}
void drawTerr(int x_beg, grovnik * grov, char ** obstypes) {
//grovnik info under cursor
char * terrType;
if(grov) {
switch (grov->terrain) {
case 1: //meadow
terrType = (char*)"Meadow";
break;
case 2: //swamp
terrType = (char*)"Swamp";
break;
case 3: //water
terrType = (char*)"Water";
break;
case 4: //wall
terrType = (char*)"Wall";
break;
default:
terrType = (char*)"Unknown";
break;
}
} else {
terrType = (char*)"Unknown";
}
mvprintw(4, x_beg+3, "Terrain:");
//predraw to clear for terrain
clearPrint(5, x_beg+3);
mvprintw(5, x_beg+3, terrType);
mvprintw(7, x_beg+3, "Grovnik Info:");
clearPrint(8, x_beg+3);
clearPrint(9, x_beg+3);
clearPrint(10, x_beg+3);
if (grov) {
object * temp = grov -> poi;
if(temp) {
switch (temp -> get_type()) {
case 1: { // Treasure. show "treasure"
mvprintw(8, x_beg+3, "Treasure");
break;
}
case 2: { // Food. Show name & cost
clearPrint(8, x_beg+3);
mvprintw(8, x_beg+3, "Food:");
food *print_food = temp->getFood();
mvprintw(8, x_beg+3, print_food->get_name());
clearPrint(9, x_beg+3);
mvprintw(9, x_beg+3, "Cost:");
mvprintw(9, x_beg+10, "%-3d", temp->get_cost());
break;
}
case 3: { // Tool. show name, cost, effectiveness
tool *print_tool = temp->getTool();
clearPrint(8, x_beg+3);
mvprintw(8, x_beg+3, "Tool: ");
mvprintw(8, x_beg+10, print_tool -> get_t_name());
clearPrint(9, x_beg+3);
mvprintw(9, x_beg+3, "Effective on ");
mvprintw(9, x_beg+16, obstypes[print_tool -> get_obstype()]);
clearPrint(10, x_beg+3);
mvprintw(10, x_beg+3, "Cost: ");
mvprintw(10, x_beg+10, "%-3d", temp->get_cost());
//mvprintw(9, x_beg+3, p_tool);
break;
}
case 4: { // clue. Leave clues behind and show info whenever
clearPrint(8, x_beg+3);
mvprintw(8, x_beg+3, "Clue");
//Print the clue?
break;
}
case 5: { // ship. Display cost
clearPrint(8, x_beg+3);
mvprintw(8, x_beg+3, "Ship");
clearPrint(9, x_beg+3);
mvprintw(9, x_beg+3, "Cost: ");
mvprintw(9, x_beg+10, "%-3d", temp->get_cost());
break;
}
case 6: { // binoculars. show cost
clearPrint(8, x_beg+3);
mvprintw(8, x_beg+3, "Binoculars");
clearPrint(9, x_beg+3);
mvprintw(9, x_beg+3, "Cost: ");
mvprintw(9, x_beg+10, "%-3d", temp->get_cost());
break;
}
case 7: { // obstacle. Display type
clearPrint(8, x_beg+3);
mvprintw(8, x_beg+3, "Obstacle:");
mvprintw(8, x_beg+13, obstypes[temp->getObst()->get_obstacle()]);
clearPrint(9, x_beg+3);
mvprintw(9, x_beg+3, "Energy required: ");
mvprintw(9, x_beg+22, "%-3d", temp -> get_cost());
break;
}
}
}
}
}
void drawInven(int x_beg, vector<tool*> inventory)
{
return;
}
void clearPrint(int where, int spot)
{
mvprintw(where, spot, " ");
}