Commit 5f722196 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Adicionado cores diferentes para cada mapa

parent ce8413ff
12 10 150
650 650 650
0 0 0
412 228 136
1000 988 0
400 400 400
200 200 200
600 0 600
650 650 650
1000 1000 1000
0000000000000000000000000000000000000000
1111111111111111111111111111111111111111
1222222022726022222626222222202222622221
......
650 650 650
10 20 150
1000 724 1000
0 0 0
412 228 136
1000 988 0
400 400 400
200 200 200
600 0 600
620 324 660
420 124 460
620 324 660
1000 1000 1000
0000000000000000000000000000000000000000
1111111111111111111111111111111111111111
12622622w2622272w2226262w6222222w2266221
......
650 650 650
24 15 150
912 728 636
0 0 0
412 228 136
324 244 0
1000 988 0
400 400 400
200 200 200
600 0 600
512 328 236
412 228 136
712 528 436
1000 1000 1000
0000000000000000000000000000000000000000
1111111111111111111111111111111111111111
162wz2w662w2226w62262222w2226222226w2721
......
......@@ -20,7 +20,7 @@ char explosion2[3][6] = {"\\\\||//", "--##--", "//||\\\\"};
char explosion3[3][6] = {"#%$@%@", "#@ ##", "&@*@*#"};
char mapfile[3][100] = {"./sprites/map1.txt", "./sprites/map2.txt", "./sprites/map3.txt"};
int colors[7][3];
int colors[8][3];
char input[WIDTH];
rockford player;
......@@ -39,13 +39,11 @@ void readFileMap(map *m, int mapn) {
done = lightning = false;
hold = 0;
mapnumber = mapn;
leveltime = 150;
waittime = 0;
m->score = 10;
m->diamonds = 12;
m->sprite = fopen(mapfile[mapnumber], "r");
for (i = 0; i < 7; i++)
fscanf(m->sprite, "%d %d %d", &m->diamonds, &m->score, &leveltime);
for (i = 0; i < 8; i++)
for (j = 0; j < 3; j++)
fscanf(m->sprite, "%d", &colors[i][j]);
......@@ -82,10 +80,14 @@ void setColors() {
init_color(COLOR_GREEN, colors[4][0], colors[4][1], colors[4][2]);
init_color(COLOR_BLUE, colors[5][0], colors[5][1], colors[5][2]);
init_color(COLOR_MAGENTA, colors[6][0], colors[6][1], colors[6][2]);
init_color(COLOR_CYAN, colors[7][0], colors[7][1], colors[7][2]);
// dirt color
init_pair(1, COLOR_BLACK, COLOR_RED);
// dirt color 2
init_pair(13, COLOR_GREEN, COLOR_RED);
// rock gray color 3
init_pair(10, COLOR_BLACK, COLOR_BLUE);
......@@ -102,10 +104,10 @@ void setColors() {
init_pair(5, COLOR_WHITE, COLOR_BLUE);
// rockford color
init_pair(6, COLOR_MAGENTA, COLOR_BLACK);
init_pair(6, COLOR_BLUE, COLOR_BLACK);
// diamond color
init_pair(7, COLOR_CYAN, COLOR_BLACK);
init_pair(7, COLOR_MAGENTA, COLOR_BLACK);
//explosion color
init_pair(9, COLOR_WHITE, COLOR_BLACK);
......@@ -113,6 +115,11 @@ void setColors() {
//number color
init_pair(2, COLOR_YELLOW, COLOR_BLACK);
//white number color
init_pair(11, COLOR_CYAN, COLOR_BLACK);
//rockford legs
init_pair(12, COLOR_RED, COLOR_BLACK);
}
void updateMap(map *m, int action) {
......@@ -218,7 +225,17 @@ void renderMap(map *m, int time) {
attroff(COLOR_PAIR(5));
break;
case('2'):
renderChar(dirt, i, j, offx, offy, 1);
for (k = 0; k < 3; k++)
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)) {
attron(COLOR_PAIR(13));
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", dirt[k][l]);
attroff(COLOR_PAIR(13));
} else {
attron(COLOR_PAIR(1));
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", dirt[k][l]);
attroff(COLOR_PAIR(1));
}
break;
case('z'):
renderChar(wall, i, j, offx, offy, 4);
......@@ -235,16 +252,28 @@ void renderMap(map *m, int time) {
renderChar(ext, i, j, offx, offy, 5);
break;
case('5'):
attron(COLOR_PAIR(6));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
for (l = 0; l < 6; l++) {
if (k == 0)
attron(COLOR_PAIR(6));
else if (k == 1)
attron(COLOR_PAIR(7));
else
attron(COLOR_PAIR(12));
if (player.dir == 0 || player.dir == 5)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockf[k][l]);
else if (player.dir == 6 || player.dir == 8)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockfr[k][l]);
else if (player.dir == 4 || player.dir == 2)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", rockfl[k][l]);
attroff(COLOR_PAIR(6));
if (k == 0)
attroff(COLOR_PAIR(6));
else if (k == 1)
attroff(COLOR_PAIR(7));
else
attroff(COLOR_PAIR(12));
}
break;
case('6'):
if (m->grid[i][j+1] == '0')
......@@ -395,64 +424,64 @@ void renderMap(map *m, int time) {
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(zero, i, j, offx, offy, 2);
else
renderChar(zero, i, j, offx, offy, 9);
renderChar(zero, i, j, offx, offy, 11);
break;
case('B'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(one, i, j, offx, offy, 2);
else
renderChar(one, i, j, offx, offy, 9);
renderChar(one, i, j, offx, offy, 11);
break;
case('C'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(two, i, j, offx, offy, 2);
else
renderChar(two, i, j, offx, offy, 9);
renderChar(two, i, j, offx, offy, 11);
break;
case('D'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(three, i, j, offx, offy, 2);
else
renderChar(three, i, j, offx, offy, 9);
renderChar(three, i, j, offx, offy, 11);
break;
case('E'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(four, i, j, offx, offy, 2);
else
renderChar(four, i, j, offx, offy, 9);
renderChar(four, i, j, offx, offy, 11);
break;
case('F'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(five, i, j, offx, offy, 2);
else
renderChar(five, i, j, offx, offy, 9);
renderChar(five, i, j, offx, offy, 11);
break;
case('G'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(six, i, j, offx, offy, 2);
else
renderChar(six, i, j, offx, offy, 9);
renderChar(six, i, j, offx, offy, 11);
break;
case('H'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(seven, i, j, offx, offy, 2);
else
renderChar(seven, i, j, offx, offy, 9);
renderChar(seven, i, j, offx, offy, 11);
break;
case('I'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(eight, i, j, offx, offy, 2);
else
renderChar(eight, i, j, offx, offy, 9);
renderChar(eight, i, j, offx, offy, 11);
break;
case('J'):
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(nine, i, j, offx, offy, 2);
else
renderChar(nine, i, j, offx, offy, 9);
renderChar(nine, i, j, offx, offy, 11);
break;
case('K'):
renderChar(symbol, i, j, offx, offy, 9);
renderChar(symbol, i, j, offx, offy, 11);
break;
}
......
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