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

FINISHEDDDDDDDD! É tetraaaaaaaagit add data/highscore.txt data/lastscore.txt...

FINISHEDDDDDDDD! É tetraaaaaaaagit add data/highscore.txt data/lastscore.txt sprites/congrats.txt src/maps.c src/menu.c src/utils.c src/utils.hgit add data/highscore.txt data/lastscore.txt sprites/congrats.txt src/maps.c src/menu.c src/utils.c src/utils.h!
parent 29c99c90
901
1264
\ No newline at end of file
620
\ No newline at end of file
0
\ No newline at end of file
1000 1000 1000
1000 1000 1000
0 0 0
0 0 0
1000 1000 1000
0 0 1000
0 0 0
0 0 0
1000 1000 1000
@!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!@@
@!###################################!@@
@!#!!!!##!!!!#!####!!!###!!!!#!!!####!@@
......@@ -23,5 +29,5 @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@your@score:@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@enter@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@esc@@@@@
#include "maps.h"
#include "physics.h"
char mapfile[7][100] = {"./sprites/map1.txt", "./sprites/map2.txt", "./sprites/map3.txt", "./sprites/map4.txt", "./sprites/map5.txt", "./sprites/map6.txt", "./sprites/map7.txt"};
char mapfile[8][100] = {"./sprites/map1.txt", "./sprites/map2.txt", "./sprites/map3.txt",
"./sprites/map4.txt", "./sprites/map5.txt", "./sprites/map6.txt",
"./sprites/map7.txt", "./sprites/congrats.txt"};
int colors[8][3];
......@@ -167,7 +169,7 @@ void updateMap(map *m, int action, int *ismenu, int *loadMenu) {
if (done && player.x == extx && player.y == exty) {
if (leveltime == 0) {
saveScore();
readFileMap(m, mapnumber+1, player.score);
readFileMap(m, mapnumber + 1, player.score);
}
} else {
updateRockford(&player, m, action, done, pushdelay);
......@@ -195,26 +197,35 @@ void updateMap(map *m, int action, int *ismenu, int *loadMenu) {
void renderMap(map *m, int time) {
int i, j, k, l;
m->grid[3][0] = ((m->diamonds / 10) % 10) + 'A';
m->grid[4][0] = (m->diamonds % 10) + 'A';
m->grid[5][0] = 'K';
m->grid[6][0] = ((m->score / 10) % 10) + 'A';
m->grid[7][0] = (m->score % 10) + 'A';
m->grid[12][0] = ((player.diamonds / 10) % 10) + 'A';
m->grid[13][0] = (player.diamonds % 10) + 'A';
m->grid[25][0] = (leveltime / 100) + 'A';
m->grid[26][0] = ((leveltime / 10) % 10) + 'A';
m->grid[27][0] = (leveltime % 10) + 'A';
m->grid[31][0] = ((player.score / 100000) % 10) + 'A';
m->grid[32][0] = ((player.score / 10000) % 10) + 'A';
m->grid[33][0] = ((player.score / 1000) % 10) + 'A';
m->grid[34][0] = ((player.score / 100) % 10) + 'A';
m->grid[35][0] = ((player.score / 10) % 10) + 'A';
m->grid[36][0] = (player.score % 10) + 'A';
if (mapnumber == 7) {
m->grid[21][20] = ((player.score / 100000) % 10) + 'A';
m->grid[22][20] = ((player.score / 10000) % 10) + 'A';
m->grid[23][20] = ((player.score / 1000) % 10) + 'A';
m->grid[24][20] = ((player.score / 100) % 10) + 'A';
m->grid[25][20] = ((player.score / 10) % 10) + 'A';
m->grid[26][20] = (player.score % 10) + 'A';
} else {
m->grid[3][0] = ((m->diamonds / 10) % 10) + 'A';
m->grid[4][0] = (m->diamonds % 10) + 'A';
m->grid[5][0] = 'K';
m->grid[6][0] = ((m->score / 10) % 10) + 'A';
m->grid[7][0] = (m->score % 10) + 'A';
m->grid[12][0] = ((player.diamonds / 10) % 10) + 'A';
m->grid[13][0] = (player.diamonds % 10) + 'A';
m->grid[25][0] = (leveltime / 100) + 'A';
m->grid[26][0] = ((leveltime / 10) % 10) + 'A';
m->grid[27][0] = (leveltime % 10) + 'A';
m->grid[31][0] = ((player.score / 100000) % 10) + 'A';
m->grid[32][0] = ((player.score / 10000) % 10) + 'A';
m->grid[33][0] = ((player.score / 1000) % 10) + 'A';
m->grid[34][0] = ((player.score / 100) % 10) + 'A';
m->grid[35][0] = ((player.score / 10) % 10) + 'A';
m->grid[36][0] = (player.score % 10) + 'A';
}
if (done && player.x == extx && player.y == exty) {
if (leveltime != 0) {
......@@ -240,8 +251,11 @@ void renderMap(map *m, int time) {
for (i = 0; i < WIDTH; i++) {
for (j = 0; j < HEIGHT; j++) {
updatePhysics(m, m->grid[i][j], i, j, offx, offy, time, falltime, waittime, &dead);
falltime = (falltime + 1) % 7;
if (mapnumber == 7 && ((m->grid[i][j] >= 'a' && m->grid[i][j] <= 'z') || m->grid[i][j] == '@' || m->grid[i][j] == '#' || m->grid[i][j] == '!'))
renderLetter(m->grid[i][j], i, j, offx, offy);
switch (m->grid[i][j]) {
case('0'):
renderChar(empty, i, j, offx, offy, lightning ? 4 : 6);
......
......@@ -52,18 +52,15 @@ int updateMenu(menu *menu, int action, int *loadMenu) {
}
switch(action){
case 6:
currmap = (currmap + 1) % 6;
menu->grid[21][22] = mps[currmap];
currmap = (currmap + 1) % 7;
break;
case 4:
currmap = currmap == 0 ? 6 : currmap - 1;
menu->grid[21][22] = mps[currmap];
break;
case 1:
buffer = currmap;
break;
default:
menu->grid[21][22] = mps[currmap];
break;
}
return buffer;
......@@ -74,6 +71,7 @@ void renderMenu(menu *menu){
getmaxyx(stdscr, row, col);
offmenuy = (row / 2) - (12 * 3);
offmenux = (col / 2) - (20 * 6);
menu->grid[21][22] = mps[currmap];
menu->grid[21][20] = ((menu->high / 100000) % 10) + '0';
menu->grid[22][20] = ((menu->high / 10000) % 10) + '0';
......@@ -91,7 +89,8 @@ void renderMenu(menu *menu){
for (i = 0; i < WIDTH; i++) {
for (j = 0; j < HEIGHT; j++) {
switch (menu->grid[i][j]) {
renderLetter(menu->grid[i][j], i, j, offmenux, offmenuy);
/*switch (menu->grid[i][j]) {
case('@'):
renderChar(empty, i, j, offmenux, offmenuy, 1);
break;
......@@ -193,8 +192,7 @@ void renderMenu(menu *menu){
break;
case('0'):
renderChar(zero, i, j, offmenux, offmenuy, 2);
break;
}
break;*/
}
}
}
......@@ -48,6 +48,7 @@ char S[3][6] = {" __ ", " |__ ", " __| "};
char T[3][6] = {" ___ ", " | ", " | "};
char U[3][6] = {" ", " | | ", " |__| "};
char V[3][6] = {" ", " \\ / ", " \\/ "};
char Y[3][6] = {" ", " |__| ", " __| "};
char SL[3][6] = {" ", " /___ ", " \\ "};
char SR[3][6] = {" ", " ___\\ ", " / "};
char DOTS[3][6] = {" ", " . ", " . "};
......@@ -60,3 +61,113 @@ void renderChar(char mat[3][6], int i, int j, int offx, int offy, int color) {
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", mat[k][l]);
attroff(COLOR_PAIR(color));
}
void renderLetter(char letter, int i, int j, int offx, int offy) {
switch(letter) {
case('@'):
renderChar(empty, i, j, offx, offy, 1);
break;
case('!'):
renderChar(empty, i, j, offx, offy, 4);
break;
case('#'):
renderChar(empty, i, j, offx, offy, 3);
break;
case('<'):
renderChar(SL, i, j, offx, offy, 2);
break;
case('>'):
renderChar(SR, i, j, offx, offy, 2);
break;
case(':'):
renderChar(DOTS, i, j, offx, offy, 2);
break;
case('a'):
renderChar(A, i, j, offx, offy, 2);
break;
case('b'):
renderChar(B, i, j, offx, offy, 2);
break;
case('c'):
renderChar(C, i, j, offx, offy, 2);
break;
case('d'):
renderChar(D, i, j, offx, offy, 2);
break;
case('e'):
renderChar(E, i, j, offx, offy, 2);
break;
case('f'):
renderChar(F, i, j, offx, offy, 2);
break;
case('g'):
renderChar(G, i, j, offx, offy, 2);
break;
case('h'):
renderChar(H, i, j, offx, offy, 2);
break;
case('i'):
renderChar(I, i, j, offx, offy, 2);
break;
case('j'):
renderChar(J, i, j, offx, offy, 2);
break;
case('l'):
renderChar(L, i, j, offx, offy, 2);
break;
case('n'):
renderChar(N, i, j, offx, offy, 2);
break;
case('o'):
renderChar(zero, i, j, offx, offy, 2);
break;
case('r'):
renderChar(R, i, j, offx, offy, 2);
break;
case('s'):
renderChar(S, i, j, offx, offy, 2);
break;
case('t'):
renderChar(T, i, j, offx, offy, 2);
break;
case('u'):
renderChar(U, i, j, offx, offy, 2);
break;
case('v'):
renderChar(V, i, j, offx, offy, 2);
break;
case('y'):
renderChar(Y, i, j, offx, offy, 2);
break;
case('1'):
renderChar(one, i, j, offx, offy, 2);
break;
case('2'):
renderChar(two, i, j, offx, offy, 2);
break;
case('3'):
renderChar(three, i, j, offx, offy, 2);
break;
case('4'):
renderChar(four, i, j, offx, offy, 2);
break;
case('5'):
renderChar(five, i, j, offx, offy, 2);
break;
case('6'):
renderChar(six, i, j, offx, offy, 2);
break;
case('7'):
renderChar(seven, i, j, offx, offy, 2);
break;
case('8'):
renderChar(eight, i, j, offx, offy, 2);
break;
case('9'):
renderChar(nine, i, j, offx, offy, 2);
break;
case('0'):
renderChar(zero, i, j, offx, offy, 2);
break;
}
}
......@@ -61,10 +61,12 @@ char S[3][6];
char T[3][6];
char U[3][6];
char V[3][6];
char Y[3][6];
char SL[3][6];
char SR[3][6];
char DOTS[3][6];
void renderChar(char mat[3][6], int i, int j, int offx, int offy, int color);
void renderLetter(char letter, int i, int j, int offx, int offy);
#endif
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