main.c
| 1 | |
| 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> |
| 4 | #include <string.h> |
| 5 | #include <assert.h> |
| 6 | #include <stdbool.h> |
| 7 | #include <locale.h> |
| 8 | #include <time.h> |
| 9 | |
| 10 | |
| 11 | #include <helper.h> |
| 12 | #include <tui.h> |
| 13 | #include <loop.h> |
| 14 | #include <game.h> |
| 15 | #include <algorithm.h> |
| 16 | #include <config.h> |
| 17 | #include <items.h> |
| 18 | |
| 19 | |
| 20 | |
| 21 | #include <unistd.h> |
| 22 | int main() |
| 23 | { |
| 24 | srand(time(NULL)); |
| 25 | |
| 26 | setup(); |
| 27 | logstr("Game started"); |
| 28 | |
| 29 | struct game g = make_maze(randrange(GAME_MIN_Y, GAME_MAX_Y), randrange(GAME_MIN_X, GAME_MAX_X)); |
| 30 | size_t num_enemies = randrange(MIN_ENEMIES, MAX_ENEMIES); |
| 31 | for(size_t i = 0; i < num_enemies; i++) |
| 32 | { |
| 33 | spawn_enemy(&g); |
| 34 | } |
| 35 | |
| 36 | size_t num_items = randrange(MIN_LOOT, MAX_LOOT); |
| 37 | for(size_t i = 0; i < num_items; i++) |
| 38 | { |
| 39 | spawn_item(&g); |
| 40 | } |
| 41 | |
| 42 | loop(&g); |
| 43 | |
| 44 | delete_game(&g); |
| 45 | } |
| 46 |