Commit 82e9573b authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Merge conflict

Showing with 71 additions and 11 deletions
+71 -11
#!/bin/bash
export TERM=xterm-256color
gcc src/*.c -Wall -o temp -l curses
./temp
rm temp
......@@ -49,7 +49,7 @@ void update(int action) {
}
void render() {
clear();
erase();
renderMap(&level);
refresh();
}
#include "maps.h"
char steel[2][3] = {"ETE", "ETE"};
char steel[2][3] = {"# #", "# #"};
char dirt[2][3] = {"-_-", "-_-"};
char wall[2][3] = {"#H#", "H#H"};
char ext[2][3] = {"ETE", "ETE"};
char wall[2][3] = {"HHH", "HHH"};
char ext[2][3] = {"# #", "# #"};
char rockf[2][3] = {" o ", "'M'"};
char bould[2][3] = {"0@O", "O0@"};
char diamond[2][3] = {"/-\\", "\\-/"};
char butterfly[2][3] = {"\\_/", "/ \\"};
char bould[2][3] = {"/ \\", "\\ /"};
char diamond[2][3] = {"/=\\", "\\=/"};
char butterfly[2][3] = {"\\//", "/\\\\"};
char input[WIDTH];
rockford player;
......@@ -25,24 +25,58 @@ void readFileMap(map *m, char *path) {
m->grid[i][j] = input[i];
}
}
init_pair(1, COLOR_RED, COLOR_BLACK);
start_color();
init_color(COLOR_WHITE, 700, 700, 700);
init_color(COLOR_BLACK, 0, 0, 0);
init_color(COLOR_RED, 556, 276, 76);
init_color(COLOR_YELLOW, 980, 888, 716);
init_color(COLOR_GREEN, 400, 400, 400);
init_color(COLOR_BLUE, 300, 300, 300);
init_color(COLOR_MAGENTA, 600, 0, 600);
// dirt color
init_pair(1, COLOR_BLACK, COLOR_RED);
// rock yellow color 1
init_pair(2, COLOR_YELLOW, COLOR_BLACK);
// rock gray color 1
init_pair(3, COLOR_GREEN, COLOR_BLACK);
// rock gray color 2
init_pair(9, COLOR_BLACK, COLOR_GREEN);
// wall color
init_pair(4, COLOR_BLACK, COLOR_WHITE);
// steel color
init_pair(5, COLOR_WHITE, COLOR_BLUE);
// rockford color
init_pair(6, COLOR_MAGENTA, COLOR_BLACK);
// diamond color
init_pair(7, COLOR_CYAN, COLOR_BLACK);
fclose(m->sprite);
}
int x = 0, d = 0;
void updateMap(map *m, int action) {
updateRockford(&player, m, action);
}
void renderMap(map *m) {
int i, j, k, l;
mvprintw(0, x, "%c", 'a');
if (x == 0)
d = 1;
else if (x == 100)
d = -1;
x += d;
for (j = 0; j < HEIGHT; j++) {
for (i = 0; i < WIDTH; i++) {
switch (m->grid[i][j]) {
case('1'):
attron(COLOR_PAIR(5));
for (k = 0; k < 2; k++)
for (l = 0; l < 3; l++)
mvprintw(2*j+k+1, 3*i+l+1, "%c", steel[k][l]);
attroff(COLOR_PAIR(5));
break;
case('2'):
attron(COLOR_PAIR(1));
......@@ -52,29 +86,54 @@ void renderMap(map *m) {
attroff(COLOR_PAIR(1));
break;
case('3'):
attron(COLOR_PAIR(4));
for (k = 0; k < 2; k++)
for (l = 0; l < 3; l++)
mvprintw(2*j+k+1, 3*i+l+1, "%c", wall[k][l]);
attroff(COLOR_PAIR(4));
break;
case('4'):
attron(COLOR_PAIR(5));
for (k = 0; k < 2; k++)
for (l = 0; l < 3; l++)
mvprintw(2*j+k+1, 3*i+l+1, "%c", ext[k][l]);
attroff(COLOR_PAIR(5));
break;
case('5'):
attron(COLOR_PAIR(6));
for (k = 0; k < 2; k++)
for (l = 0; l < 3; l++)
mvprintw(2*j+k+1, 3*i+l+1, "%c", rockf[k][l]);
attroff(COLOR_PAIR(6));
break;
case('6'):
for (k = 0; k < 2; k++)
for (l = 0; l < 3; l++)
mvprintw(2*j+k+1, 3*i+l+1, "%c", bould[k][l]);
for (l = 0; l < 3; l++) {
if (l == 2 && k == 0) {
attron(COLOR_PAIR(2));
mvprintw(2*j+k+1, 3*i+l+1, "%c", bould[k][l]);
attroff(COLOR_PAIR(1));
} else if (l == 1 && k == 0) {
attron(COLOR_PAIR(9));
mvprintw(2*j+k+1, 3*i+l+1, "%c", bould[k][l]);
attroff(COLOR_PAIR(9));
} else if (l == 1 && k == 1) {
attron(COLOR_PAIR(9));
mvprintw(2*j+k+1, 3*i+l+1, "%c", bould[k][l]);
attroff(COLOR_PAIR(9));
} else {
attron(COLOR_PAIR(3));
mvprintw(2*j+k+1, 3*i+l+1, "%c", bould[k][l]);
attroff(COLOR_PAIR(3));
}
}
break;
case('7'):
attron(COLOR_PAIR(7));
for (k = 0; k < 2; k++)
for (l = 0; l < 3; l++)
mvprintw(2*j+k+1, 3*i+l+1, "%c", diamond[k][l]);
attroff(COLOR_PAIR(7));
break;
case('8'):
for (k = 0; k < 2; k++)
......
......@@ -3,7 +3,7 @@
#include "utils.h"
#include <sys/time.h>
#define NANO 1000000000.0
#define FPS 1.0/16.0
#define FPS 1.0/60.0
double getTime();
......
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