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
76
|
#include "color_palette.h"
#include <ncurses.h>
void set_pairs()
{
init_pair(2, COLOR_BLUE, COLOR_BLUE);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_MAGENTA, COLOR_MAGENTA);
init_pair(5, COLOR_YELLOW, COLOR_BLACK);
init_pair(6, COLOR_RED, COLOR_BLACK);
init_pair(7, COLOR_BLUE, COLOR_BLACK);
init_pair(8, COLOR_MAGENTA, COLOR_BLACK);
init_pair(9, COLOR_BLUE, COLOR_WHITE);
}
void paint_field_element(int element)
{
int color;
switch(element) {
case block:
color = COLOR_PAIR(2);
break;
case coin:
color = COLOR_PAIR(3) | A_BOLD;
break;
case door:
color = COLOR_PAIR(4);
break;
}
attrset(color);
}
void paint_stats()
{
attrset(COLOR_PAIR(5));
}
void paint_ghost(enum ghost_color color, int frightened_counter,
int prison_status)
{
int attr;
if(frightened_counter && !prison_status) {
attr = COLOR_PAIR(9);
attrset(attr);
return;
}
switch(color) {
case red:
attr = COLOR_PAIR(6);
break;
case pink:
attr = COLOR_PAIR(8);
break;
case blue:
attr = COLOR_PAIR(7);
break;
case orange:
attr = COLOR_PAIR(3);
}
attrset(attr);
}
void paint_pac()
{
attrset(COLOR_PAIR(3) | A_BOLD);
}
void paint_hit()
{
attrset(COLOR_PAIR(6));
}
void reset_attr()
{
attrset(A_NORMAL);
}
|