forked from tleguern/openroguelike
-
Notifications
You must be signed in to change notification settings - Fork 1
/
level.h
75 lines (62 loc) · 1.76 KB
/
level.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Copyright (c) 2013,2014 Tristan Le Guern <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef LEVEL_H__
#define LEVEL_H__
#include <stdbool.h>
#include <stdint.h>
#define MAXROWS 22
#define MAXCOLS 80
enum tile_type {
T_EMPTY,
T_WALL,
T_UPSTAIR,
T_DOWNSTAIR,
T_GOBLIN,
T_HUMAN,
T__MAX,
};
struct tile {
enum tile_type type;
struct creature *creature;
};
enum level_type {
L_NONE,
L_CAVE,
L_STATIC,
L__MAX,
};
struct level {
enum level_type type;
bool visited;
char *entrymessage;
struct tile tile[MAXROWS][MAXCOLS];
};
struct coordinate {
int x;
int y;
};
bool tile_is_empty(struct tile *);
bool tile_is_wall(struct tile *);
void tile_print(struct tile *, int, int);
void level_init(struct level *);
void level_load(struct level *, const char *);
void level_draw(struct level *);
int level_add_stairs(struct level *, bool, bool);
int level_find(struct level *, enum tile_type, struct coordinate *);
void cave_gen(struct level *);
void coordinate_copy(struct coordinate *, struct coordinate *);
void coordinate_init(struct coordinate *);
#endif