Commit adaec8af authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Adicionado status do mapa

parent 5f722196
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
1626622222222262222226226222262226222221 1626622222222262222226226222262226222221
1620622222222206226222222226222222626021 1620622222222206226222222226222222626021
1222022622222222622222620622222222626621 1222022622222222622222620622222222626621
1zwzwzwzwzwzwzwzwzwzwzwzwzwzwzw222622621 1wwwwwwwwwwwwwwwwwwwwwwwwwwwwww222622621
1202226227202262622222222227267222222621 1202226227202262622222222227267222222621
1227222226222220222222226606226222262221 1227222226222220222222226606226222262221
1222622626222222222222226026226222222221 1222622626222222222222226026226222222221
1262222262222222266622222226220272222621 1262222262222222266622222226220272222621
1272202262002222262672272222622262272021 1272202262002222262672272222622262272021
1206222222222222226062262222222272222261 1206222222222222226062262222222272222261
122222222zwzwzwzwzwzwzwzwzwzwzwzwzwzwzw1 122222222wwwwwwwwwwwwwwwwwwwwwwwwwwwwww1
1662222222226222722226222226222622222221 1662222222226222722226222226222622222221
1002222222220622622222222622222262662241 1002222222220622622222222622222262662241
1202262222222262222262002222722262662221 1202262222222262222262002222722262662221
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
1700000000600006006000000006007000060601 1700000000600006006000000006007000060601
10222222w2622226w2620220w2202202w2202021 10222222w2622226w2620220w2202202w2202021
12222222z2022220z2020022z2222262z2220221 12222222z2022220z2020022z2222262z2220221
1zwzwzwzwzwzwzwzwzwz0zwzwzwzwzwzwzwzwzw1 1wwwwwwwwwwwwwwwwwww0wwwwwwwwwwwwwwwwww1
12222662z2262222z2220226z2222622z2222261 12222662z2262222z2220226z2222622z2222261
12222222w2202222w2220222w2222622w2222261 12222222w2202222w2220222w2222622w2222261
1600600000000600000600000000000706000001 1600600000000600000600000000000706000001
16220222z2222022z2200222z2222220z6222221 16220222z2222022z2200222z2222220z6222221
10222262w2262262w2220266w2222222w0222621 10222262w2262262w2220266w2222222w0222621
12622222z2226222z2220200z2222222z0622621 12622222z2226222z2220200z2222222z0622621
1zwzwzwzwzwzwzwzwzwz0zwzwzwzwzwzwzwzwzw1 1wwwwwwwwwwwwwwwwwww0wwwwwwwwwwwwwwwwww1
16200022z2222626z2220222z2672262z2222221 16200022z2222626z2220222z2672262z2222221
12222262w6222222w2270222w0226222w2626621 12222262w6222222w2270222w0226222w2626621
1700006006000060006000060060600000000001 1700006006000060006000060060600000000001
......
...@@ -9,24 +9,24 @@ ...@@ -9,24 +9,24 @@
1000 1000 1000 1000 1000 1000
0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
1111111111111111111111111111111111111111 1111111111111111111111111111111111111111
162wz2w662w2226w62262222w2226222226w2721 162ww2w662w2226z62262222w2226222226w2721
1225w27262z222wzw22z262222622626222z2z61 1225z27262z222www22z262222622626222z2z61
12222w22672262222w2222262wz62222222w2wz1 12222w22672262222w2222262ww62222222w2ww1
172z22z6z62262222z22262222226266222222w1 172z22z6z62262222z22262222226266222222z1
162w222w2262wz2262wz722222226266222222z1 162w222w2262ww2262ww722222226266222222w1
1662262222z222622222262662222226227zw221 1662262222z222622222262662222226227ww221
12262wz226266222w22226266222222w2262z261 12262ww226266222w22226266222222w2262z261
122z222722222272622zw62262z2z622z6227261 122z222722222272622zz62262z2z622z6227261
16262222w2wz2272622wz62262272w222w2262w1 16262222w2ww2272622ww62262272w222w2262w1
1262zw2222266z62272z2z622z6222z622726221 1262ww2222266w62272z2z622z6222z622726221
1w2zw22222266w62262w2wz222w2262wz2262wz1 1w2zz22222266z62262w2ww222w2262ww2262ww1
12z26262z222wz62262222w222622222wz262zw1 12z26262z222ww62262222z222622222zz262zz1
12w26262w272z2w622w6222262262662222w2221 12w26262w272z2w622w6222262262662222w2221
1z22z6z62262222z2227222z26z222222z2zw271 1z22z6z62262222z2227222z26z222222z2zz271
1w222zw622w27222w62262622262w6222222z221 1w222ww622w27222w62262622262w6222222w221
1z27222262zw2262zw6222222262z6222222w221 1z27222262zz2262zz6222222262z6222222z221
12262222w22262222226266222222w2262w222w1 12262222w22262222226266222222w2262w222w1
162zw2262zw222z22226266222222z2267226224 162ww2262ww222z22226266222222z2267226224
1w222622222262672222226222wz22w62272w221 1w222622222262672222226222ww22w62272w221
166222z222226267222222z2262w72726z262221 166222z222226267222222z2262z72726z262221
1111111111111111111111111111111111111111 1111111111111111111111111111111111111111
...@@ -123,6 +123,10 @@ void setColors() { ...@@ -123,6 +123,10 @@ void setColors() {
} }
void updateMap(map *m, int action) { void updateMap(map *m, int action) {
getmaxyx(stdscr, row, col);
offy = (row / 2) - (12 * 3);
offx = (col / 2) - (20 * 6);
player.dir = action; player.dir = action;
if (player.diamonds >= m->diamonds) { if (player.diamonds >= m->diamonds) {
m->score = 15; m->score = 15;
...@@ -209,25 +213,15 @@ void renderMap(map *m, int time) { ...@@ -209,25 +213,15 @@ void renderMap(map *m, int time) {
waittime = (waittime + 1) % 7; waittime = (waittime + 1) % 7;
switch (m->grid[i][j]) { switch (m->grid[i][j]) {
case('0'): case('0'):
if (lightning) { renderChar(empty, i, j, offx, offy, lightning ? 4 : 6);
renderChar(empty, i, j, offx, offy, 4);
} else
renderChar(empty, i, j, offx, offy, 6);
break; break;
case('1'): case('1'):
attron(COLOR_PAIR(5)); renderChar((j == 1 || j == 22) ? steel : steel2, i, j, offx, offy, 5);
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
if (j == 1 || j == 22)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", steel[k][l]);
else
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", steel2[k][l]);
attroff(COLOR_PAIR(5));
break; break;
case('2'): case('2'):
for (k = 0; k < 3; k++) for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++) for (l = 0; l < 6; l++)
if ((k == 0 && l == 2) || (k == 0 && l == 4) || (k == 1 && l == 3) || (k == 1 && l == 5) || (k == 2 && l == 0) || (k == 2 && l == 4)) { if ((k == 0 && (l == 2 || l == 4)) || (k == 1 && (l == 3 || l == 5)) || (k == 2 && (l == 0 || l == 4))) {
attron(COLOR_PAIR(13)); attron(COLOR_PAIR(13));
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", dirt[k][l]); mvprintw(3*j+k+offy, 6*i+l+offx, "%c", dirt[k][l]);
attroff(COLOR_PAIR(13)); attroff(COLOR_PAIR(13));
...@@ -239,14 +233,15 @@ void renderMap(map *m, int time) { ...@@ -239,14 +233,15 @@ void renderMap(map *m, int time) {
break; break;
case('z'): case('z'):
renderChar(wall, i, j, offx, offy, 4); renderChar(wall, i, j, offx, offy, 4);
break;
case('w'): case('w'):
renderChar(wall2, i, j, offx, offy, 4); renderChar(wall2, i, j, offx, offy, 4);
break; break;
case('4'): case('4'):
if (done) { if (done) {
if (time < 15) if (time < 15)
renderChar(ext, i, j, offx, offy, 5); renderChar(ext, i, j, offx, offy, 5);
else else
renderChar(empty, i, j, offx, offy, 4); renderChar(empty, i, j, offx, offy, 4);
} else } else
renderChar(ext, i, j, offx, offy, 5); renderChar(ext, i, j, offx, offy, 5);
...@@ -254,12 +249,7 @@ void renderMap(map *m, int time) { ...@@ -254,12 +249,7 @@ void renderMap(map *m, int time) {
case('5'): case('5'):
for (k = 0; k < 3; k++) for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++) { for (l = 0; l < 6; l++) {
if (k == 0) attron(COLOR_PAIR((k == 0 || k == 1) ? 6 + k : 12));
attron(COLOR_PAIR(6));
else if (k == 1)
attron(COLOR_PAIR(7));
else
attron(COLOR_PAIR(12));
if (player.dir == 0 || player.dir == 5) if (player.dir == 0 || player.dir == 5)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockf[k][l]); mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockf[k][l]);
...@@ -267,12 +257,8 @@ void renderMap(map *m, int time) { ...@@ -267,12 +257,8 @@ void renderMap(map *m, int time) {
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockfr[k][l]); mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockfr[k][l]);
else if (player.dir == 4 || player.dir == 2) else if (player.dir == 4 || player.dir == 2)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockfl[k][l]); mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockfl[k][l]);
if (k == 0)
attroff(COLOR_PAIR(6)); attroff(COLOR_PAIR((k == 0 || k == 1) ? 6 + k : 12));
else if (k == 1)
attroff(COLOR_PAIR(7));
else
attroff(COLOR_PAIR(12));
} }
break; break;
case('6'): case('6'):
...@@ -300,16 +286,13 @@ void renderMap(map *m, int time) { ...@@ -300,16 +286,13 @@ void renderMap(map *m, int time) {
case('7'): case('7'):
if (m->grid[i][j+1] == '0') if (m->grid[i][j+1] == '0')
m->grid[i][j] = 'h'; m->grid[i][j] = 'h';
attron(COLOR_PAIR(7));
for (k = 0; k < 3; k++) if (time < 10)
for (l = 0; l < 6; l++) renderChar(diamond, i, j, offx, offy, 7);
if (time < 10) else if (time < 20)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", diamond[k][l]); renderChar(diamond2, i, j, offx, offy, 7);
else if (time < 20) else
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", diamond2[k][l]); renderChar(diamond3, i, j, offx, offy, 7);
else
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", diamond3[k][l]);
attroff(COLOR_PAIR(7));
break; break;
case('8'): case('8'):
renderChar(butterfly, i, j, offx, offy, 5); renderChar(butterfly, i, j, offx, offy, 5);
...@@ -341,16 +324,12 @@ void renderMap(map *m, int time) { ...@@ -341,16 +324,12 @@ void renderMap(map *m, int time) {
} }
break; break;
case('h'): case('h'):
attron(COLOR_PAIR(7)); if (time < 10)
for (k = 0; k < 3; k++) renderChar(diamond, i, j, offx, offy, 7);
for (l = 0; l < 6; l++) else if (time < 20)
if (time < 10) renderChar(diamond2, i, j, offx, offy, 7);
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", diamond[k][l]); else
else if (time < 20) renderChar(diamond3, i, j, offx, offy, 7);
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", diamond2[k][l]);
else
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", diamond3[k][l]);
attroff(COLOR_PAIR(7));
if (waittime == 6) { if (waittime == 6) {
if (m->grid[i][j+1] == '0') { if (m->grid[i][j+1] == '0') {
...@@ -365,16 +344,12 @@ void renderMap(map *m, int time) { ...@@ -365,16 +344,12 @@ void renderMap(map *m, int time) {
} }
break; break;
case('x'): case('x'):
attron(COLOR_PAIR(9)); if(waittime < 7)
for (k = 0; k < 3; k++) renderChar(explosion, i, j, offx, offy, 9);
for (l = 0; l < 6; l++) else if(waittime < 14)
if(waittime < 7) renderChar(explosion2, i, j, offx, offy, 9);
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", explosion[k][l]); else
else if(waittime < 14) renderChar(explosion3, i, j, offx, offy, 9);
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", explosion2[k][l]);
else
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", explosion3[k][l]);
attroff(COLOR_PAIR(9));
break; break;
case('r'): case('r'):
for (k = 0; k < 3; k++) for (k = 0; k < 3; k++)
...@@ -421,64 +396,34 @@ void renderMap(map *m, int time) { ...@@ -421,64 +396,34 @@ void renderMap(map *m, int time) {
} }
break; break;
case('A'): case('A'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(zero, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(zero, i, j, offx, offy, 2);
else
renderChar(zero, i, j, offx, offy, 11);
break; break;
case('B'): case('B'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(one, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(one, i, j, offx, offy, 2);
else
renderChar(one, i, j, offx, offy, 11);
break; break;
case('C'): case('C'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(two, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(two, i, j, offx, offy, 2);
else
renderChar(two, i, j, offx, offy, 11);
break; break;
case('D'): case('D'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(three, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(three, i, j, offx, offy, 2);
else
renderChar(three, i, j, offx, offy, 11);
break; break;
case('E'): case('E'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(four, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(four, i, j, offx, offy, 2);
else
renderChar(four, i, j, offx, offy, 11);
break; break;
case('F'): case('F'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(five, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(five, i, j, offx, offy, 2);
else
renderChar(five, i, j, offx, offy, 11);
break; break;
case('G'): case('G'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(six, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(six, i, j, offx, offy, 2);
else
renderChar(six, i, j, offx, offy, 11);
break; break;
case('H'): case('H'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(seven, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(seven, i, j, offx, offy, 2);
else
renderChar(seven, i, j, offx, offy, 11);
break; break;
case('I'): case('I'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(eight, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(eight, i, j, offx, offy, 2);
else
renderChar(eight, i, j, offx, offy, 11);
break; break;
case('J'): case('J'):
if (i == 3 || i == 4 || i == 12 || i == 13) renderChar(nine, i, j, offx, offy, (i == 3 || i == 4 || i == 12 || i == 13) ? 2 : 11);
renderChar(nine, i, j, offx, offy, 2);
else
renderChar(nine, i, j, offx, offy, 11);
break; break;
case('K'): case('K'):
renderChar(symbol, i, j, offx, offy, 11); renderChar(symbol, i, j, offx, offy, 11);
...@@ -488,5 +433,3 @@ void renderMap(map *m, int time) { ...@@ -488,5 +433,3 @@ void renderMap(map *m, int time) {
} }
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment