-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdungeon.h
60 lines (45 loc) · 948 Bytes
/
dungeon.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
#ifndef DUNGETEER_DUNGEON
#define DUNGETEER_DUNGEON
struct dungeon dungeon = {
ROOM_START, //room id
EMPTY, //npcs
new_room,
show_dungeon
};
void new_room(number)
int number;
{
struct room room = rooms[number];
dungeon.room_id = number;
set_pos(player.pos, 1, room.door);
dungeon.npc = room.npc;
}
void show_dungeon()
{
int y;
clear();
struct room room = rooms[dungeon.room_id];
for (y = 0; y < room.y_size; ++y)
{
mvprintw(y, 0, "%s", room.room[y]);
}
attron(COLOR_PAIR(COLOR_GREEN));
mvprintw(player.pos.y, player.pos.x, "%c", '@');
attroff(COLOR_PAIR(COLOR_GREEN));
if (NPC.id != NO_NPC)
{
if (distance(player.pos, NPC.pos) <= NPC.view_range)
{
attron(COLOR_PAIR(COLOR_RED));
mvprintw(NPC.pos.y, NPC.pos.x, "%c", NPC.symbol);
attroff(COLOR_PAIR(COLOR_RED));
}
else
mvprintw(NPC.pos.y, NPC.pos.x, "%c", NPC.symbol);
}
print_debug();
if (NPC.hp > 0)
print_debug2();
refresh();
}
#endif