Commit d5b2c6b5 authored by Ivo Júnior's avatar Ivo Júnior
Browse files

Fix merge

parents cabd5db6 89ded8ed
0 564
\ No newline at end of file
#include "firefly.h" #include "firefly.h"
void updateFirefly(map *m, firefly *first, int *dead, int waittime) { void updateFirefly(map *m, firefly *first, int *dead) {
firefly *aux = first->next; firefly *aux = first->next;
int i, j, k, l, n, o; int i, j, k, l;
while (aux != NULL) { while (aux != NULL) {
if (aux->dead) { i = aux->x;
for (n = -1; n <= 1; n++) { j = aux->y;
for (o = -1; o <= 1; o++) { if (!aux->dead) {
if (waittime < 21 && m->grid[i+n][j+o] != '1')
m->grid[i+n][j+o] = 'x';
else if (waittime <= 100 && m->grid[i+n][j+o] != '1')
m->grid[i+n][j+o] = '0';
}
}
} else {
i = aux->x;
j = aux->y;
for (k = -1; k <= 1; k++) { for (k = -1; k <= 1; k++) {
for (l = -1; l <= 1; l++) { for (l = -1; l <= 1; l++) {
if (m->grid[i+k][j+l] == '5') { if (m->grid[i+k][j+l] == '5') {
*dead = true; *dead = true;
aux->dead = true; aux->dead = true;
m->grid[i][j] = '0';
} }
} }
} }
...@@ -118,7 +110,7 @@ void updateFirefly(map *m, firefly *first, int *dead, int waittime) { ...@@ -118,7 +110,7 @@ void updateFirefly(map *m, firefly *first, int *dead, int waittime) {
} }
break; break;
} }
aux = aux->next;
} }
aux = aux->next;
} }
} }
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
#include "utils.h" #include "utils.h"
#include "entity.h" #include "entity.h"
void updateFirefly(map *m, firefly *first, int *dead, int waittime); void updateFirefly(map *m, firefly *first, int *dead);
#endif #endif
...@@ -252,7 +252,7 @@ void renderMap(map *m, int time) { ...@@ -252,7 +252,7 @@ void renderMap(map *m, int time) {
} }
if (nff && !(time % 6)) if (nff && !(time % 6))
updateFirefly(m, firstff, &dead, waittime); updateFirefly(m, firstff, &dead);
for (i = 0; i < WIDTH; i++) { for (i = 0; i < WIDTH; i++) {
for (j = 0; j < HEIGHT; j++) { for (j = 0; j < HEIGHT; j++) {
......
...@@ -42,7 +42,7 @@ void updatePhysics(map *m, char in, int i, int j, int offx, int offy, int time, ...@@ -42,7 +42,7 @@ void updatePhysics(map *m, char in, int i, int j, int offx, int offy, int time,
m->grid[i][j+1] = 'h'; m->grid[i][j+1] = 'h';
m->grid[i][j] = '0'; m->grid[i][j] = '0';
} else if (m->grid[i][j+1] == '5') { } else if (m->grid[i][j+1] == '5') {
m->grid[i][j+1] = 'h'; m->grid[i][j+1] = '0';
m->grid[i][j] = '0'; m->grid[i][j] = '0';
*dead = true; *dead = true;
} else } else
......
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