diff options
| author | manuel <manuel@mausz.at> | 2011-05-05 00:57:07 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-05-05 00:57:07 +0200 |
| commit | ce48af53646cd9e7ec762fc1ac176b3aa620b11d (patch) | |
| tree | f8fbf2cae8c7d0cbac2696a8f4cf94410bfb4928 /pacman-c++/constants.h | |
| parent | e54ccad07e256ba877bd41d70bd358bd0085bd1e (diff) | |
| download | foop-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++/constants.h')
| -rw-r--r-- | pacman-c++/constants.h | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/pacman-c++/constants.h b/pacman-c++/constants.h deleted file mode 100644 index e7dedbf..0000000 --- a/pacman-c++/constants.h +++ /dev/null | |||
| @@ -1,101 +0,0 @@ | |||
| 1 | #ifndef CONSTANTS_H | ||
| 2 | #define CONSTANTS_H | ||
| 3 | #include <sys/types.h> | ||
| 4 | |||
| 5 | namespace 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 | } | ||
| 25 | |||
| 26 | namespace Game | ||
| 27 | { | ||
| 28 | const unsigned int bonus_point_value = 100; | ||
| 29 | const unsigned int point_value = 10; | ||
| 30 | /* players will be placed with this minimum manhattan distance */ | ||
| 31 | const unsigned int player_minimum_distance = 5; | ||
| 32 | /* if the distance above isn't possible, decrease the distance by this value */ | ||
| 33 | const unsigned int player_distance_decr = 2; | ||
| 34 | /* there's a chance of 1:30 that a bonus point will be added (with one actor) */ | ||
| 35 | const unsigned int bouns_point_chance = 30; | ||
| 36 | /* every additional player will raise the chance of a bonus point by that factor */ | ||
| 37 | const unsigned int bouns_point_chance_playerfactor = 3; | ||
| 38 | /* there's a chance of 1:5 that a block will be colorized */ | ||
| 39 | const unsigned int colorize_block_chance = 5; | ||
| 40 | /* how long colorized blocks will stay colorized */ | ||
| 41 | const unsigned int colorize_block_tickcount_min = 50; | ||
| 42 | const unsigned int colorize_block_tickcount_max = 100; | ||
| 43 | } | ||
| 44 | |||
| 45 | namespace AI | ||
| 46 | { | ||
| 47 | /* bots minimum manhatten distance before other players will be recognized */ | ||
| 48 | const unsigned int player_minimum_distance = 4; | ||
| 49 | /* weight values used to determine new direction of bot */ | ||
| 50 | const unsigned int weight_afraid = 50; | ||
| 51 | const unsigned int weight_hunt = 10; | ||
| 52 | const unsigned int weight_bonus_point = 3; | ||
| 53 | const unsigned int weight_point = 1; | ||
| 54 | const unsigned int weight_colorblock = 5; | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | namespace Color | ||
| 59 | { | ||
| 60 | enum Color | ||
| 61 | { | ||
| 62 | none = 0, | ||
| 63 | red = (1 << 0), | ||
| 64 | blue = (1 << 1), | ||
| 65 | green = (1 << 2), | ||
| 66 | yellow = (1 << 3) | ||
| 67 | }; | ||
| 68 | |||
| 69 | /* colororder used in protocol and gui */ | ||
| 70 | const Color order[] = | ||
| 71 | { Color::red, Color::blue, Color::green, Color::yellow, Color::none }; | ||
| 72 | } | ||
| 73 | |||
| 74 | // constants for data transmission to client | ||
| 75 | namespace Transmission | ||
| 76 | { | ||
| 77 | typedef unsigned int field_t; | ||
| 78 | typedef unsigned int mask_t; | ||
| 79 | |||
| 80 | const field_t none = 0; | ||
| 81 | const field_t block = (1 << 4); | ||
| 82 | const field_t point = (1 << 5); | ||
| 83 | const field_t bonuspoint = (1 << 6); | ||
| 84 | const field_t pacman = (1 << 7); | ||
| 85 | const field_t empty = (1 << 8); // explicit empty for update | ||
| 86 | const field_t death = (1 << 9); | ||
| 87 | |||
| 88 | const field_t direction_none = 0; | ||
| 89 | const field_t direction_left = (1 << 10); | ||
| 90 | const field_t direction_right = (1 << 11); | ||
| 91 | const field_t direction_up = (1 << 12); | ||
| 92 | const field_t direction_down = (1 << 13); | ||
| 93 | |||
| 94 | const mask_t color_mask = Color::none | Color::red | Color::blue | Color::green | Color::yellow; | ||
| 95 | const mask_t type_mask = block | bonuspoint; | ||
| 96 | const mask_t direction_mask = direction_none | direction_left | direction_right | direction_up | direction_down; | ||
| 97 | |||
| 98 | typedef field_t** map_t; | ||
| 99 | } | ||
| 100 | |||
| 101 | #endif // CONSTANTS_H | ||
