1/*
2 * LegacyClonk
3 *
4 * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design)
5 * Copyright (c) 2017-2021, The LegacyClonk Team and contributors
6 *
7 * Distributed under the terms of the ISC license; see accompanying file
8 * "COPYING" for details.
9 *
10 * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11 * See accompanying file "TRADEMARK" for details.
12 *
13 * To redistribute this file separately, substitute the full license texts
14 * for the above references.
15 */
16
17/* Lots of constants */
18
19#pragma once
20
21#include <cstdint>
22
23// Main
24
25const int C4MaxNameList = 10,
26 C4MaxName = 30, // player names, etc.
27 C4MaxLongName = 120, // scenario titles, etc. - may include markup
28 C4MaxComment = 256, // network game and player comments
29 C4MaxDefString = 100,
30 C4MaxTitle = 512,
31 C4MaxMessage = 256,
32
33 C4MaxVariable = 10,
34
35 C4ViewDelay = 100,
36 C4RetireDelay = 60,
37
38 C4MaxColor = 12,
39 C4MaxKey = 12,
40 C4MaxKeyboardSet = 4,
41 C4MaxControlSet = C4MaxKeyboardSet + 4, // keyboard sets+gamepads
42
43 C4MaxControlRate = 20,
44
45 C4MaxGammaUserRamps = 8,
46 C4MaxGammaRamps = C4MaxGammaUserRamps + 1;
47
48// gamma ramp indices
49#define C4GRI_SCENARIO 0
50#define C4GRI_SEASON 1
51#define C4GRI_RESERVED1 2
52#define C4GRI_DAYTIME 3
53#define C4GRI_RESERVED2 4
54#define C4GRI_LIGHTNING 5
55#define C4GRI_MAGIC 6
56#define C4GRI_RESERVED3 7
57
58#define C4GRI_USER 8
59
60const int C4M_MaxName = 15,
61 C4M_MaxDefName = 2 * C4M_MaxName + 1,
62 C4M_ColsPerMat = 3,
63 C4M_MaxTexIndex = 127; // last texture map index is reserved for diff
64
65const int C4S_MaxPlayer = 4;
66
67const int C4D_MaxName = C4MaxName,
68 C4D_MaxVertex = 30,
69 C4D_MaxIDLen = C4D_MaxName;
70
71const int C4Px_MaxParticle = 256, // maximum number of particles of one type
72 C4Px_BufSize = 128, // number of particles in one buffer
73 C4Px_MaxIDLen = 30; // maximum length of internal identifiers
74
75const int C4SymbolSize = 35,
76 C4SymbolBorder = 5,
77 C4UpperBoardHeight = 50,
78 C4PictureSize = 64,
79 C4MaxPictureSize = 150,
80 C4MaxBigIconSize = 64;
81
82const int C4P_MaxPosition = 4;
83
84const int C4P_Control_None = -1,
85 C4P_Control_Keyboard1 = 0,
86 C4P_Control_Keyboard2 = 1,
87 C4P_Control_Keyboard3 = 2,
88 C4P_Control_Keyboard4 = 3,
89 C4P_Control_GamePad1 = 4,
90 C4P_Control_GamePad2 = 5,
91 C4P_Control_GamePad3 = 6,
92 C4P_Control_GamePad4 = 7,
93 C4P_Control_GamePadMax = C4P_Control_GamePad4;
94
95const int C4ViewportScrollBorder = 40; // scrolling past landscape allowed at range of this border
96
97// Engine Return Values
98
99const int C4XRV_Completed = 0,
100 C4XRV_Failure = 1;
101
102// Object Character Flags
103
104const uint32_t OCF_None = 0,
105 OCF_All = ~OCF_None,
106 OCF_Normal = 1,
107 OCF_Construct = 1 << 1,
108 OCF_Grab = 1 << 2,
109 OCF_Carryable = 1 << 3,
110 OCF_OnFire = 1 << 4,
111 OCF_HitSpeed1 = 1 << 5,
112 OCF_FullCon = 1 << 6,
113 OCF_Inflammable = 1 << 7,
114 OCF_Chop = 1 << 8,
115 OCF_Rotate = 1 << 9,
116 OCF_Exclusive = 1 << 10,
117 OCF_Entrance = 1 << 11,
118 OCF_HitSpeed2 = 1 << 12,
119 OCF_HitSpeed3 = 1 << 13,
120 OCF_Collection = 1 << 14,
121 OCF_Living = 1 << 15,
122 OCF_HitSpeed4 = 1 << 16,
123 OCF_FightReady = 1 << 17,
124 OCF_LineConstruct = 1 << 18,
125 OCF_Prey = 1 << 19,
126 OCF_AttractLightning = 1 << 20,
127 OCF_NotContained = 1 << 21,
128 OCF_CrewMember = 1 << 22,
129 OCF_Edible = 1 << 23,
130 OCF_InLiquid = 1 << 24,
131 OCF_InSolid = 1 << 25,
132 OCF_InFree = 1 << 26,
133 OCF_Available = 1 << 27,
134 OCF_PowerConsumer = 1 << 28,
135 OCF_PowerSupply = 1 << 29,
136 OCF_Container = 1 << 30,
137 OCF_Alive = 1 << 31;
138
139// Contact / Attachment
140
141const uint8_t // Directional
142 CNAT_None = 0,
143 CNAT_Left = 1,
144 CNAT_Right = 2,
145 CNAT_Top = 4,
146 CNAT_Bottom = 8,
147 CNAT_Center = 16,
148 // Additional flags
149 CNAT_MultiAttach = 32, // new attachment behaviour; see C4Shape::Attach
150 CNAT_NoCollision = 64; // turn off collision for this vertex
151
152const uint8_t CNAT_Flags = CNAT_MultiAttach | CNAT_NoCollision; // all attchment flags that can be combined with regular attachment
153
154// Keyboard Input Controls
155
156const int C4DoubleClick = 10;
157
158const int CON_CursorLeft = 0,
159 CON_CursorToggle = 1,
160 CON_CursorRight = 2,
161 CON_Throw = 3,
162 CON_Up = 4,
163 CON_Dig = 5,
164 CON_Left = 6,
165 CON_Down = 7,
166 CON_Right = 8,
167 CON_Menu = 9,
168 CON_Special = 10,
169 CON_Special2 = 11;
170
171// Control Commands
172
173const uint8_t COM_Single = 64,
174 COM_Double = 128;
175
176const uint8_t COM_None = 0;
177
178const uint8_t COM_Left = 1,
179 COM_Right = 2,
180 COM_Up = 3,
181 COM_Down = 4,
182 COM_Throw = 5,
183 COM_Dig = 6,
184
185 COM_Special = 7,
186 COM_Special2 = 8,
187
188 COM_Contents = 9,
189
190 COM_WheelUp = 10,
191 COM_WheelDown = 11,
192
193 COM_CursorLeft = 12,
194 COM_CursorRight = 13,
195 COM_CursorToggle = 14,
196 COM_CursorFirst = COM_CursorLeft,
197 COM_CursorLast = COM_CursorToggle,
198
199 COM_Left_R = COM_Left + 16,
200 COM_Right_R = COM_Right + 16,
201 COM_Up_R = COM_Up + 16,
202 COM_Down_R = COM_Down + 16,
203 COM_Throw_R = COM_Throw + 16,
204 COM_Dig_R = COM_Dig + 16,
205 COM_Special_R = COM_Special + 16,
206 COM_Special2_R = COM_Special2 + 16,
207 COM_CursorLeft_R = COM_CursorLeft + 16,
208 COM_CursorToggle_R = COM_CursorToggle + 16,
209 COM_CursorRight_R = COM_CursorRight + 16,
210 COM_ReleaseFirst = COM_Left_R,
211 COM_ReleaseLast = COM_CursorToggle_R,
212
213 COM_Left_S = COM_Left | COM_Single,
214 COM_Right_S = COM_Right | COM_Single,
215 COM_Up_S = COM_Up | COM_Single,
216 COM_Down_S = COM_Down | COM_Single,
217 COM_Throw_S = COM_Throw | COM_Single,
218 COM_Dig_S = COM_Dig | COM_Single,
219 COM_Special_S = COM_Special | COM_Single,
220 COM_Special2_S = COM_Special2 | COM_Single,
221 COM_CursorLeft_S = COM_CursorLeft | COM_Single,
222 COM_CursorToggle_S = COM_CursorToggle | COM_Single,
223 COM_CursorRight_S = COM_CursorRight | COM_Single,
224
225 COM_Left_D = COM_Left | COM_Double,
226 COM_Right_D = COM_Right | COM_Double,
227 COM_Up_D = COM_Up | COM_Double,
228 COM_Down_D = COM_Down | COM_Double,
229 COM_Throw_D = COM_Throw | COM_Double,
230 COM_Dig_D = COM_Dig | COM_Double,
231 COM_Special_D = COM_Special | COM_Double,
232 COM_Special2_D = COM_Special2 | COM_Double,
233 COM_CursorLeft_D = COM_CursorLeft | COM_Double,
234 COM_CursorToggle_D = COM_CursorToggle | COM_Double,
235 COM_CursorRight_D = COM_CursorRight | COM_Double;
236
237const uint8_t COM_Help = 35,
238 COM_PlayerMenu = 36,
239 COM_Chat = 37;
240
241const uint8_t COM_MenuEnter = 38,
242 COM_MenuEnterAll = 39,
243 COM_MenuClose = 40,
244 COM_MenuShowText = 42,
245 COM_MenuLeft = 52,
246 COM_MenuRight = 53,
247 COM_MenuUp = 54,
248 COM_MenuDown = 55,
249 COM_MenuSelect = 60,
250
251 COM_MenuFirst = COM_MenuEnter,
252 COM_MenuLast = COM_MenuSelect,
253
254 COM_MenuNavigation1 = COM_MenuShowText,
255 COM_MenuNavigation2 = COM_MenuSelect,
256
257 COM_ClearPressedComs = 61;
258
259// SendCommand
260
261const int32_t C4P_Command_None = 0,
262 C4P_Command_Set = 1,
263 C4P_Command_Add = 2,
264 C4P_Command_Append = 4,
265 C4P_Command_Range = 8;
266
267// Owners
268
269const int NO_OWNER = -1,
270 ANY_OWNER = -2;
271
272// Base functionalities
273
274const int BASE_RegenerateEnergyPrice = 5,
275 BASEFUNC_Default = 0xffff,
276 BASEFUNC_AutoSellContents = 1 << 0,
277 BASEFUNC_RegenerateEnergy = 1 << 1,
278 BASEFUNC_Buy = 1 << 2,
279 BASEFUNC_Sell = 1 << 3,
280 BASEFUNC_RejectEntrance = 1 << 4,
281 BASEFUNC_Extinguish = 1 << 5;
282
283// League (escape those damn circular includes)
284
285enum C4LeagueDisconnectReason
286{
287 C4LDR_Unknown,
288 C4LDR_ConnectionFailed,
289 C4LDR_Desync,
290};
291
292// Player (included by C4PlayerInfo and C4Player)
293
294enum C4PlayerType
295{
296 C4PT_None = 0,
297 C4PT_User = 1, // Normal player
298 C4PT_Script = 2, // AI players, etc.
299};
300
301// AllowPictureStack (DefCore value)
302
303enum C4AllowPictureStack
304{
305 APS_Color = 1 << 0,
306 APS_Graphics = 1 << 1,
307 APS_Name = 1 << 2,
308 APS_Overlay = 1 << 3,
309};
310