summaryrefslogtreecommitdiffstats
path: root/pacman-c++/common/constants.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-05-05 00:57:07 +0200
committermanuel <manuel@mausz.at>2011-05-05 00:57:07 +0200
commitce48af53646cd9e7ec762fc1ac176b3aa620b11d (patch)
treef8fbf2cae8c7d0cbac2696a8f4cf94410bfb4928 /pacman-c++/common/constants.h
parente54ccad07e256ba877bd41d70bd358bd0085bd1e (diff)
downloadfoop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.tar.gz
foop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.tar.bz2
foop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.zip
- refactorized the whole project and made a few subprojects
- replaced tcp with enet - added connect dialog - some smaller bugfixes
Diffstat (limited to 'pacman-c++/common/constants.h')
-rw-r--r--pacman-c++/common/constants.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/pacman-c++/common/constants.h b/pacman-c++/common/constants.h
new file mode 100644
index 0000000..d40c39e
--- /dev/null
+++ b/pacman-c++/common/constants.h
@@ -0,0 +1,102 @@
1#ifndef CONSTANTS_H
2#define CONSTANTS_H
3#include <sys/types.h>
4
5namespace Constants {
6 const struct
7 {
8 const unsigned int width;
9 const unsigned int height;
10 }
11 field_size = { 16, 16 },
12 map_size = { 35, 17 },
13 map_size_pixel = { field_size.width * map_size.width,
14 field_size.height * map_size.height };
15 const unsigned int sprite_margin = 2;
16 const unsigned int sprite_offset = 20;
17 const unsigned int tick = 250; // ms
18 extern bool server;
19
20 namespace Networking
21 {
22 const unsigned int port = 7321;
23 const unsigned int connection_timeout = 3000;
24 const unsigned int packet_timeout = 3000;
25 }
26
27 namespace Game
28 {
29 const unsigned int bonus_point_value = 100;
30 const unsigned int point_value = 10;
31 /* players will be placed with this minimum manhattan distance */
32 const unsigned int player_minimum_distance = 5;
33 /* if the distance above isn't possible, decrease the distance by this value */
34 const unsigned int player_distance_decr = 2;
35 /* there's a chance of 1:30 that a bonus point will be added (with one actor) */
36 const unsigned int bouns_point_chance = 30;
37 /* every additional player will raise the chance of a bonus point by that factor */
38 const unsigned int bouns_point_chance_playerfactor = 3;
39 /* there's a chance of 1:5 that a block will be colorized */
40 const unsigned int colorize_block_chance = 5;
41 /* how long colorized blocks will stay colorized */
42 const unsigned int colorize_block_tickcount_min = 50;
43 const unsigned int colorize_block_tickcount_max = 100;
44 }
45
46 namespace AI
47 {
48 /* bots minimum manhatten distance before other players will be recognized */
49 const unsigned int player_minimum_distance = 4;
50 /* weight values used to determine new direction of bot */
51 const unsigned int weight_afraid = 50;
52 const unsigned int weight_hunt = 10;
53 const unsigned int weight_bonus_point = 3;
54 const unsigned int weight_point = 1;
55 const unsigned int weight_colorblock = 5;
56 }
57}
58
59namespace Color
60{
61 enum Color
62 {
63 none = 0,
64 red = (1 << 0),
65 blue = (1 << 1),
66 green = (1 << 2),
67 yellow = (1 << 3)
68 };
69
70 /* colororder used in protocol and gui */
71 const Color order[] =
72 { Color::red, Color::blue, Color::green, Color::yellow, Color::none };
73}
74
75// constants for data transmission to client
76namespace Transmission
77{
78 typedef unsigned int field_t;
79 typedef unsigned int mask_t;
80
81 const field_t none = 0;
82 const field_t block = (1 << 4);
83 const field_t point = (1 << 5);
84 const field_t bonuspoint = (1 << 6);
85 const field_t pacman = (1 << 7);
86 const field_t empty = (1 << 8); // explicit empty for update
87 const field_t death = (1 << 9);
88
89 const field_t direction_none = 0;
90 const field_t direction_left = (1 << 10);
91 const field_t direction_right = (1 << 11);
92 const field_t direction_up = (1 << 12);
93 const field_t direction_down = (1 << 13);
94
95 const mask_t color_mask = Color::none | Color::red | Color::blue | Color::green | Color::yellow;
96 const mask_t type_mask = block | bonuspoint;
97 const mask_t direction_mask = direction_none | direction_left | direction_right | direction_up | direction_down;
98
99 typedef field_t** map_t;
100}
101
102#endif // CONSTANTS_H