author | Wuzzy <Wuzzy2@mail.ru> |
Wed, 22 May 2019 10:45:35 +0200 | |
changeset 15033 | 20c80919d97d |
parent 11046 | 47a8c19ecb60 |
child 15520 | de08a3ae4f8d |
permissions | -rw-r--r-- |
10017 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
10017 | 4 |
* Copyright (c) 2012 Simeon Maxein <smaxein@googlemail.com> |
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation; version 2 of the License |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
10017
diff
changeset
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
10017 | 18 |
*/ |
19 |
||
20 |
/** |
|
21 |
* This file contains important constants which might need to be changed to adapt to |
|
22 |
* changes in the engine or protocols. |
|
23 |
* |
|
24 |
* It also contains getter functions for some constants (in particular for constants |
|
25 |
* that are important for the layout of data structures), so that client code can |
|
26 |
* query the constants that the library was built with. |
|
27 |
*/ |
|
28 |
||
29 |
#ifndef HWCONSTS_H_ |
|
30 |
#define HWCONSTS_H_ |
|
31 |
||
32 |
#include <inttypes.h> |
|
33 |
#include <stddef.h> |
|
34 |
#include <stdbool.h> |
|
35 |
||
36 |
#define HEDGEHOGS_PER_TEAM 8 |
|
37 |
#define DEFAULT_HEDGEHOG_COUNT 4 |
|
38 |
#define DEFAULT_COLOR_INDEX 0 |
|
39 |
||
40 |
#define NETGAME_DEFAULT_PORT 46631 |
|
41 |
#define PROTOCOL_VERSION 42 |
|
42 |
#define MIN_SERVER_VERSION 1 |
|
43 |
||
44 |
//! Used for sending scripts to the engine |
|
45 |
#define MULTIPLAYER_SCRIPT_PATH "Scripts/Multiplayer/" |
|
46 |
||
47 |
#define WEAPONS_COUNT 56 |
|
48 |
||
49 |
// TODO allow frontend to override these? |
|
50 |
/*! A merge of mikade/bugq colours w/ a bit of channel feedback */ |
|
51 |
#define HW_TEAMCOLOR_ARRAY { UINT32_C(0xffff0204), /*! red */ \ |
|
52 |
UINT32_C(0xff4980c1), /*! blue */ \ |
|
53 |
UINT32_C(0xff1de6ba), /*! teal */ \ |
|
54 |
UINT32_C(0xffb541ef), /*! purple */ \ |
|
55 |
UINT32_C(0xffe55bb0), /*! pink */ \ |
|
56 |
UINT32_C(0xff20bf00), /*! green */ \ |
|
57 |
UINT32_C(0xfffe8b0e), /*! orange */ \ |
|
58 |
UINT32_C(0xff5f3605), /*! brown */ \ |
|
59 |
UINT32_C(0xffffff01), /*! yellow */ \ |
|
60 |
/*! add new colors here */ \ |
|
61 |
0 } /*! Keep this 0 at the end */ |
|
62 |
||
63 |
extern const size_t flib_teamcolor_count; |
|
64 |
extern const uint32_t flib_teamcolors[]; |
|
65 |
||
66 |
/** |
|
67 |
* Returns the team color (ARGB) corresponding to the color index (0 if index out of bounds) |
|
68 |
*/ |
|
69 |
uint32_t flib_get_teamcolor(int colorIndex); |
|
70 |
||
71 |
/** |
|
72 |
* Returns the number of team colors (i.e. the length of the flib_teamcolors array) |
|
73 |
*/ |
|
74 |
int flib_get_teamcolor_count(); |
|
75 |
||
76 |
/** |
|
77 |
* Returns the HEDGEHOGS_PER_TEAM constant |
|
78 |
*/ |
|
79 |
int flib_get_hedgehogs_per_team(); |
|
80 |
||
81 |
/** |
|
82 |
* Returns the WEAPONS_COUNT constant |
|
83 |
*/ |
|
84 |
int flib_get_weapons_count(); |
|
85 |
||
86 |
/*! |
|
87 |
* These structs define the meaning of values in the flib_scheme struct, i.e. their correspondence to |
|
88 |
* ini settings, engine commands and positions in the network protocol (the last is encoded in the |
|
89 |
* order of settings/mods). |
|
90 |
*/ |
|
91 |
typedef struct { |
|
92 |
const char *name; //!< A name identifying this setting (used as key in the schemes file) |
|
93 |
const char *engineCommand; //!< The command needed to send the setting to the engine. May be null if the setting is not sent to the engine (for the "health" setting) |
|
94 |
const bool maxMeansInfinity; //!< If true, send a very high number to the engine if the setting is equal to its maximum |
|
95 |
const bool times1000; //!< If true (for time-based settings), multiply the setting by 1000 before sending it to the engine. |
|
96 |
const int min; //!< The smallest allowed value |
|
97 |
const int max; //!< The highest allowed value |
|
98 |
const int def; //!< The default value |
|
99 |
} flib_metascheme_setting; |
|
100 |
||
101 |
typedef struct { |
|
102 |
const char *name; //!< A name identifying this mod (used as key in the schemes file) |
|
103 |
const int bitmaskIndex; //!< Mods are sent to the engine in a single integer, this field describes which bit of that integer is used |
|
104 |
//! for this particular mod. |
|
105 |
} flib_metascheme_mod; |
|
106 |
||
107 |
typedef struct { |
|
108 |
const int settingCount; |
|
109 |
const int modCount; |
|
110 |
const flib_metascheme_setting *settings; |
|
111 |
const flib_metascheme_mod *mods; |
|
112 |
} flib_metascheme; |
|
113 |
||
114 |
extern const flib_metascheme flib_meta; |
|
115 |
||
116 |
const flib_metascheme *flib_get_metascheme(); |
|
117 |
||
118 |
#endif |