clean up bullets
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bruno Rybársky 2022-05-29 10:43:50 +02:00
parent 8ddf1ad110
commit ab4ddaf365

14
main.c

@ -20,15 +20,12 @@ char blank_char = 32;
char wall_char = 35;
char goal_char = 71;
char player_char = 80;
char bullet_char = 120;
char inchar = ' ';
uint16_t blank_color = 0;
uint16_t wall_color = 1;
uint16_t goal_color = 2;
uint16_t player_color = 3;
uint16_t border_color = 4;
uint16_t bullet1_color = 5;
uint16_t bullet2_color = 5;
char letter = ' ';
struct Object {
uint16_t x;
@ -37,13 +34,6 @@ struct Object {
uint16_t color;
uint8_t dir;
};
struct Bullet {
uint16_t x;
uint16_t y;
uint8_t dir;
uint8_t color;
};
uint16_t bulletptr = 0;
uint16_t player_x = 0;
uint16_t player_y = 0;
uint16_t goal_x = 0;
@ -52,7 +42,6 @@ uint16_t rng_tmp = 0;
uint16_t orient = 0;
uint16_t inputs_tmp = 0;
struct Object * rendered;
struct Bullet * bullets;
char * playfield;
int randomInt(int lower, int upper) {
return rand() % (upper - lower + 1) + lower;
@ -163,7 +152,6 @@ void init() {
getmaxyx(stdscr, SCR_Y, SCR_X);
playfield = malloc(sizeof(char) * SCR_Y * SCR_X);
rendered = malloc(sizeof(struct Object) * (SCR_X) * (SCR_Y));
bullets = malloc(sizeof(struct Bullet) * (SCR_X) * (SCR_Y));
noecho();
nodelay(stdscr, TRUE);
start_color();
@ -172,8 +160,6 @@ void init() {
init_pair(goal_color, COLOR_BLACK, COLOR_GREEN);
init_pair(player_color, COLOR_BLACK, COLOR_YELLOW);
init_pair(border_color, COLOR_WHITE, COLOR_BLUE);
init_pair(bullet1_color, COLOR_BLACK, COLOR_YELLOW);
init_pair(bullet2_color, COLOR_BLACK, COLOR_GREEN);
attron(COLOR_PAIR(blank_color));
clear();
srand(time(NULL));