OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4PlayerControl.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk 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 // Input to player control mapping
17 
18 #ifndef INC_C4PlayerControl
19 #define INC_C4PlayerControl
20 
21 #include "gui/C4KeyboardInput.h"
23 #include "object/C4Id.h"
25 
26 #include <list>
27 
28 const float C4GFX_ZoomStep = 1.1040895f;
29 
30 // one control definition, e.g. "Left", "Throw", etc.
32 {
33 public:
34  enum CoordinateSpace // coordinate space for mouse position
35  {
36  COS_Game = 0, // game (landscape) coordinates
37  COS_Viewport = 1 // viewport (GUI) coordinates
38  };
39  enum Actions //action to be performed when control is triggered
40  {
41  CDA_None = 0, // do nothing
42  CDA_Script, // default: Script callback
43  CDA_Menu, // open player menu (async)
45  CDA_ObjectMenuTextComplete, // object menu fast-foward through text animation (async)
47  CDA_ZoomIn, CDA_ZoomOut // player viewport control (async)
48  };
49 
50 private:
51  StdCopyStrBuf sIdentifier; // name as seen in script and config
52  StdCopyStrBuf sGUIName; // name as displayed to player
53  StdCopyStrBuf sGUIDesc; // key description displayed to player in config dialog
54  bool fGlobal; // if true, control can be bound to the global player only
55  bool fIsHoldKey; // if true, the control can be in down and up state
56  bool fDefaultDisabled; // if true, the control is disabled by default and needs to be enabled by script
57  bool fSendCursorPos; // if true, x/y parameters will be set by current GUI mouse cursor pos (or GetCursor()-GUI coordinate pos for gamepad)
58  int32_t iRepeatDelay; // if >0, the key will generate successive events when held down
59  int32_t iInitialRepeatDelay; // delay after which KeyRepeat will be enabled
60  C4ID idControlExtraData; // extra data to be passed to script function
61  CoordinateSpace eCoordSpace; // coordinate space to be used for mouse coordinates when control is triggered by mouse
62  Actions eAction;
63 
64 public:
66  fGlobal(false), fIsHoldKey(false), fDefaultDisabled(false), fSendCursorPos(false),
67  idControlExtraData(C4ID::None), eCoordSpace(COS_Game), eAction(CDA_Script)
68  {}
70 
71  void CompileFunc(StdCompiler *pComp);
72 
73  const char *GetIdentifier() const { return sIdentifier.getData(); }
74  const char *GetGUIName() const { return sGUIName.getData(); }
75  const char *GetGUIDesc() const { return sGUIDesc.getData(); }
76  Actions GetAction() const { return eAction; }
77  bool IsHoldKey() const { return fIsHoldKey; }
78  C4ID GetExtraData() const { return idControlExtraData; }
79  bool IsGlobal() const { return fGlobal; }
80  int32_t GetRepeatDelay() const { return iRepeatDelay; }
81  int32_t GetInitialRepeatDelay() const { return iInitialRepeatDelay; }
82  bool IsDefaultDisabled() const { return fDefaultDisabled; }
83  CoordinateSpace GetCoordinateSpace() const { return eCoordSpace; }
84  bool IsSendCursorPos() const { return fSendCursorPos; }
85 
86  bool operator ==(const C4PlayerControlDef &cmp) const;
87 
88  bool Execute(bool fUp, const C4KeyEventData &rKeyExtraData); // key was triggered - execute and return if handled
89  bool IsSyncObjectMenuControl() const { return eAction>=CDA_ObjectMenuOK && eAction<=CDA_ObjectMenuDown; }
90  bool IsAsync() const { return eAction != CDA_None && eAction != CDA_Script && !IsSyncObjectMenuControl(); } // true if to be executed directly when triggered
91  bool IsSync() const { return eAction == CDA_Script || IsSyncObjectMenuControl(); } // true if to be executed via control queue
92  bool IsValid() const { return eAction != CDA_None; }
93 };
94 
95 // CON_* constants are indices into the C4PlayerControlDefs list
96 enum { CON_None = -1 }; // No/undefined control
97 
98 // list of all known player control definitions
100 {
101 private:
102  typedef std::vector<C4PlayerControlDef> DefVecImpl;
103  DefVecImpl Defs;
104  bool clear_previous; // if set is merged, all previous control defs are cleared - use
105 
106 public:
108  {
110  CInternalCons() : CON_ObjectMenuSelect(CON_None), CON_ObjectMenuOKAll(CON_None), CON_ObjectMenuOK(CON_None), CON_ObjectMenuCancel(CON_None), CON_CursorPos(CON_None) {}
111  } InternalCons;
112 
113  void UpdateInternalCons();
114 
115 public:
116  C4PlayerControlDefs() : clear_previous(false) {}
118  void Clear();
119 
120  void CompileFunc(StdCompiler *pComp);
121  void MergeFrom(const C4PlayerControlDefs &Src); // copy all defs from source file; overwrite defs of same name if found
122 
123  void FinalInit(); // after all defs have been loaded: register script constants
124 
125  const C4PlayerControlDef *GetControlByIndex(int32_t idx) const;
126  int32_t GetControlIndexByIdentifier(const char *szIdentifier) const; // return CON_None for not found
127  size_t GetCount() const { return Defs.size(); }
128 
129  bool operator ==(const C4PlayerControlDefs &cmp) const { return Defs == cmp.Defs && clear_previous == cmp.clear_previous; }
130 };
131 
133 {
136  C4PlayerControlRecentKey(const C4KeyCodeEx &pressed_key, const C4KeyCodeEx &matched_key, C4TimeMilliseconds tTime) : pressed_key(pressed_key), matched_key(matched_key), tTime(tTime) {}
137  bool operator ==(const C4KeyCodeEx &cmp) { return pressed_key==cmp; } // comparison op for finding items in lists: Search for the pressed key only
138 };
139 
140 typedef std::list<C4PlayerControlRecentKey> C4PlayerControlRecentKeyList;
141 
142 typedef std::vector<C4KeyCodeEx> C4KeyCodeExVec;
143 
144 // a key/mouse/gamepad assignment to a PlayerControlDef
146 {
147 public:
148  // action to be performed on the control upon this key
150  {
151  CTM_Default = 0, // standard behaviour: The control will be triggered
152  CTM_Hold = 1 << 0, // the control will be put into "down"-mode
153  CTM_Release = 1 << 1, // the hold mode of the control will be released
154  CTM_AlwaysUnhandled = 1 << 2, // the key will not block handling of other keys even if it got handled
155  CTM_HandleDownStatesOnly = 1 << 3, // used when an already handled release key is processed to reset down states of overridden keys only
156  CTM_ClearRecentKeys = 1 << 4 // if this assignment is triggered, RecentKeys are reset so no more combos can be generated
157  };
158 
159 private:
160  // KeyCombo list:
161  // if size()>1, the control is triggered only if this combo is fulfilled
162  // used for simultanuous keypresses or sequences
163  struct KeyComboItem
164  {
165  C4KeyCodeEx Key;
166  StdCopyStrBuf sKeyName;
167  void CompileFunc(StdCompiler *pComp);
168  void UpdateKeyName();
169  bool operator ==(const KeyComboItem &cmp) const { return Key==cmp.Key; }
170  };
171  typedef std::vector<KeyComboItem> KeyComboVec;
172  KeyComboVec KeyCombo;
173  bool fComboIsSequence; // if true, the keys must be pressed in sequence. Otherwise, they must be pressed simultanuously
174 
175  // trigger key: key/mouse/gamepad event triggering this assignment. For combinations, the last key of the combo.
176  C4KeyCodeEx TriggerKey;
177 
178  StdCopyStrBuf sControlName; // name of the control to be executed on this key
179  StdCopyStrBuf sGUIName; // name as displayed to player. If empty, name stored in control def should be used.
180  StdCopyStrBuf sGUIDesc; // key description displayed to player in config dialog. If empty, name stored in control def should be used.
181  bool fGUIDisabled; // whether this key can't be reassigned through the GUI dialogue
182  bool fOverrideAssignments; // override all other assignments to the same key?
183  bool is_inherited; // set for assignments that were copied from a parent set without modification
184  bool fRefsResolved; // set to true after sControlName and sKeyNames have been resolved to runtime values
185  int32_t iGUIGroup; // in which this control is grouped in the gui
186  int32_t iControl; // the control to be executed on this key, i.e. the resolved sControlName
187  int32_t iPriority; // higher priority assignments get handled first
188  int32_t iTriggerMode;
189 
190  const C4PlayerControlAssignment *inherited_assignment; // valid for assignments that were copied from a parent: source assignment
191 
192 public:
194  TriggerKey(), fOverrideAssignments(false), is_inherited(false), fRefsResolved(false),
195  iGUIGroup(0), iControl(CON_None), iPriority(0), iTriggerMode(CTM_Default),
196  inherited_assignment(nullptr)
197  {}
199 
200  void CompileFunc(StdCompiler *pComp);
201  void CopyKeyFrom(const C4PlayerControlAssignment &src_assignment);
202  bool ResolveRefs(class C4PlayerControlAssignmentSet *pParentSet, C4PlayerControlDefs *pControlDefs); // resolve references between assignments
203  bool IsComboMatched(const C4PlayerControlRecentKeyList &DownKeys, const C4PlayerControlRecentKeyList &RecentKeys) const; // check if combo is currently fulfilled (assuming TriggerKey is already matched)
204  void SetInherited(bool to_val) { is_inherited = to_val; }
205  void SetInheritedAssignment(const C4PlayerControlAssignment *to_val) { inherited_assignment = to_val; }
206  void ResetKeyToInherited();
207  bool IsKeyChanged() const;
208  void SetControlName(const char *control_name) { sControlName.Copy(control_name); }
209  void SetKey(const C4KeyCodeEx &key);
210 
211  bool operator ==(const C4PlayerControlAssignment &cmp) const; // doesn't compare resolved TriggerKey/iControl
212  bool operator <(const C4PlayerControlAssignment &cmp) const { return iPriority > cmp.iPriority; } // assignments are processed in DESCENDING priority!
213  const char *GetControlName() const { return sControlName.getData(); }
214  int32_t GetControl() const { return iControl; }
215  const char *GetGUIName(const C4PlayerControlDefs &defs) const;
216  const char *GetGUIDesc(const C4PlayerControlDefs &defs) const;
217  bool IsGUIDisabled() const;
218  int32_t GetGUIGroup() const;
219  bool IsRefsResolved() const { return fRefsResolved; }
220  void ResetRefsResolved() { fRefsResolved = false; } // Mark references to other assignments as not resolved
221  bool IsAlwaysUnhandled() const { return !!(iTriggerMode & CTM_AlwaysUnhandled); }
222  int32_t GetTriggerMode() const { return iTriggerMode; }
223  const C4KeyCodeEx &GetTriggerKey() const { return TriggerKey; }
224  bool HasCombo() const { return KeyCombo.size()>1; }
225  bool IsOverrideAssignments() const { return fOverrideAssignments; }
226  bool IsInherited() const { return is_inherited; }
227  const C4PlayerControlAssignment *GetInheritedAssignment() const { return inherited_assignment; }
228  StdStrBuf GetKeysAsString(bool human_readable, bool short_name) const;
229 };
230 
231 typedef std::vector<C4PlayerControlAssignment> C4PlayerControlAssignmentVec;
232 typedef std::vector<const C4PlayerControlAssignment *> C4PlayerControlAssignmentPVec;
233 
234 
235 // a set of key/mouse/gamepad assignments to all controls
237 {
238 private:
239  StdCopyStrBuf sName, sGUIName, sParentSetName;
240  const C4PlayerControlAssignmentSet *parent_set;
241  C4PlayerControlAssignmentVec Assignments; // ordered by priority
242 
243  bool has_keyboard;
244  bool has_mouse;
245  bool has_gamepad;
246 
247 public:
248  C4PlayerControlAssignmentSet() : parent_set(nullptr), has_keyboard(true), has_mouse(true), has_gamepad(false) {}
250  void InitEmptyFromTemplate(const C4PlayerControlAssignmentSet &template_set); // copy all fields except assignments
251 
252  void CompileFunc(StdCompiler *pComp);
253  bool ResolveRefs(C4PlayerControlDefs *pControlDefs); // resolve references between assignments
254  void SortAssignments();
255 
257 
258  void MergeFrom(const C4PlayerControlAssignmentSet &Src, MergeMode merge_mode); // take over all assignments defined in Src
259  C4PlayerControlAssignment *CreateAssignmentForControl(const char *control_name);
260  void RemoveAssignmentByControlName(const char *control_name);
261 
262  const char *GetName() const { return sName.getData(); }
263  const char *GetGUIName() const { return sGUIName.getData(); }
264  bool IsWildcardName() const { return IsWildcardString(sName.getData()); }
265 
266  C4PlayerControlAssignment *GetAssignmentByIndex(int32_t index); // assignments are ordered by priority
267  C4PlayerControlAssignment *GetAssignmentByControlName(const char *szControlName);
269  void GetAssignmentsByKey(const C4PlayerControlDefs &rDefs, const C4KeyCodeEx &key, bool fHoldKeysOnly, C4PlayerControlAssignmentPVec *pOutVec, const C4PlayerControlRecentKeyList &DownKeys, const C4PlayerControlRecentKeyList &RecentKeys) const; // match only by TriggerKey (last key of Combo) if fHoldKeysOnly
270  void GetTriggerKeys(const C4PlayerControlDefs &rDefs, C4KeyCodeExVec *pRegularKeys, C4KeyCodeExVec *pHoldKeys) const; // put all trigger keys of keyset into output vectors
271 
272  bool operator ==(const C4PlayerControlAssignmentSet &cmp) const;
273 
274  C4Facet GetPicture() const; // get image to be drawn to represent this control set
275  // todo
276  bool HasKeyboard() const { return has_keyboard; }
277  bool HasMouse() const { return has_mouse; }
278  bool HasGamepad() const { return has_gamepad; }
279  int32_t GetLayoutOrder() const { return 0; } // returns position on keyboard (increasing from left to right) for viewport sorting
280  bool IsMouseControlAssigned(int32_t mouseevent) const;
281 };
282 
283 // list of C4PlayerControlAssignmentSet
285 {
286 private:
287  typedef std::list<C4PlayerControlAssignmentSet> AssignmentSetList;
288  AssignmentSetList Sets;
289  bool clear_previous;
290 
291 public:
292  C4PlayerControlAssignmentSets() : clear_previous(false) {}
294  void Clear();
295 
296  void CompileFunc(StdCompiler *pComp);
297  bool operator ==(const C4PlayerControlAssignmentSets &cmp) const;
298  bool ResolveRefs(C4PlayerControlDefs *pControlDefs); // resolve references between assignments
299  void SortAssignments();
300 
301  void MergeFrom(const C4PlayerControlAssignmentSets &Src, C4PlayerControlAssignmentSet::MergeMode merge_mode); // take over all assignments in known sets and new sets defined in Src
302 
304  void RemoveSetByName(const char *set_name);
305 
306  C4PlayerControlAssignmentSet *GetSetByName(const char *szName);
308  int32_t GetSetIndex(const C4PlayerControlAssignmentSet *set) const;
310  size_t GetSetCount() const { return Sets.size(); }
311 };
312 
313 // contents of one PlayerControls.txt file
315 {
316 private:
317  C4PlayerControlDefs ControlDefs;
318  C4PlayerControlAssignmentSets AssignmentSets;
319 public:
320  void Clear();
321  void CompileFunc(StdCompiler *pComp);
322  bool Load(C4Group &hGroup, const char *szFilename, C4LangStringTable *pLang);
323  bool Save(C4Group &hGroup, const char *szFilename);
324 
325  const C4PlayerControlDefs &GetControlDefs() const { return ControlDefs; }
326  const C4PlayerControlAssignmentSets &GetAssignmentSets() const { return AssignmentSets; }
327 };
328 
329 // runtime information about a player's control
331 {
332 public:
333  enum { MaxRecentKeyLookback = 3000, MaxSequenceKeyDelay = 800 }; // milliseconds: Time to press key combos
334 
339  };
340 
341 private:
342  C4PlayerControlDefs &ControlDefs; // shortcut
343 
344  // owner
345  int32_t iPlr;
346 
347  // async values
348  C4PlayerControlAssignmentSet *pControlSet; // the control set used by this player - may be nullptr if the player cannot be controlled!
349  typedef std::list<C4KeyBinding *> KeyBindingList;
350  KeyBindingList KeyBindings; // keys registered into Game.KeyboardInput
351  C4PlayerControlRecentKeyList RecentKeys; // keys pressed recently; for combinations
352  C4PlayerControlRecentKeyList DownKeys; // keys currently held down
353  bool IsCursorPosRequested; // set to true when a SendCursorPos-control had been issued
354 
355 public:
356  // sync values
357  struct CSync
358  {
360  {
361  C4KeyEventData DownState, MovedState; // control is down if DownState.iStrength>0
362  int32_t iDownFrame, iMovedFrame; // frame when control was pressed
363  bool fDownByUser; // if true, the key is actually pressed. Otherwise, it's triggered as down by another key
364  ControlDownState(const C4KeyEventData &rDownState, int32_t iDownFrame, bool fDownByUser)
365  : DownState(rDownState), iDownFrame(iDownFrame), fDownByUser(fDownByUser) {}
366  bool IsDown() const { return DownState.iStrength>0; }
367 
368  ControlDownState() : DownState(), iDownFrame(0), fDownByUser(false) {}
369  void CompileFunc(StdCompiler *pComp);
370  bool operator ==(const ControlDownState &cmp) const;
371  };
372  typedef std::vector<ControlDownState> DownStateVec;
373  DownStateVec ControlDownStates; // indexed by C4PlayerControlID: Down-state of a control. 0=up, 100=down; values inbetween e.g. for gamepad sticks
374  typedef std::vector<int32_t> DisableStateVec;
375  DisableStateVec ControlDisableStates; // indexed by C4PlayerControlID: Disable-states of controls. >0 is disabled.
376 
377  const ControlDownState *GetControlDownState(int32_t iControl) const;
378  int32_t GetControlDisabled(int32_t iControl) const;
379  bool IsControlDisabled(int32_t iControl) const { return GetControlDisabled(iControl)>0; }
380  void SetControlDownState(int32_t iControl, const C4KeyEventData &rDownState, int32_t iDownFrame, bool fDownByUser);
381  void SetControlMovedState(int32_t iControl, const C4KeyEventData &rMovedState, int32_t iMovedFrame);
382  void ResetControlDownState(int32_t iControl);
383  bool SetControlDisabled(int32_t iControl, int32_t iVal);
384 
385  void InitDefaults(const C4PlayerControlDefs &ControlDefs);
386  void Clear();
387  void CompileFunc(StdCompiler *pComp);
388  bool operator ==(const CSync &cmp) const;
389  };
390 
391 private:
392  CSync Sync;
393 
394  // callbacks from Game.KeyboardInput
395  bool ProcessKeyEvent(const C4KeyCodeEx &pressed_key, const C4KeyCodeEx &matched_key, ControlState state, const C4KeyEventData &rKeyExtraData, bool reset_down_states_only=false, bool *clear_recent_keys=nullptr);
396  bool ProcessKeyDown(const C4KeyCodeEx &pressed_key, const C4KeyCodeEx &matched_key);
397  bool ProcessKeyUp(const C4KeyCodeEx &pressed_key, const C4KeyCodeEx &matched_key);
398  bool ProcessKeyMoved(const C4KeyCodeEx &pressed_key, const C4KeyCodeEx &matched_key);
399 
400  // execute single control. return if handled.
401  bool ExecuteControl(int32_t iControl, ControlState state, const C4KeyEventData &rKeyExtraData, int32_t iTriggerMode, bool fRepeated, bool fHandleDownStateOnly);
402  bool ExecuteControlAction(int32_t iControl, C4PlayerControlDef::Actions eAction, C4ID idControlExtraData, ControlState state, const C4KeyEventData &rKeyExtraData, bool fRepeated);
403  bool ExecuteControlScript(int32_t iControl, C4ID idControlExtraData, ControlState state, const C4KeyEventData &rKeyExtraData, bool fRepeated);
404 
405  // init
406  void AddKeyBinding(const C4KeyCodeEx &key, bool fHoldKey, int32_t idx);
407 
408  // helper function: get current cursor position of controlling player in GUI coordinates
409  // used e.g. to open menus at cursor pos
410  bool GetCurrentPlayerCursorPos(int32_t *x_out, int32_t *y_out, int32_t *game_x_out, int32_t *game_y_out);
411 
412 public:
413  C4PlayerControl();
415  void Clear();
416 
417  // first-time init call after player join
418  // not called again after control set change/savegame resume
419  // does DefaultDisabled controls
420  void Init();
421 
422  void CompileFunc(StdCompiler *pComp);
423 
424  void RegisterKeyset(int32_t iPlr, C4PlayerControlAssignmentSet *pKeyset); // register all keys into Game.KeyboardInput creating KeyBindings
425 
426  bool IsGlobal() const { return iPlr==-1; }
427  const CSync::ControlDownState *GetControlDownState(int32_t iControl) const
428  { return Sync.GetControlDownState(iControl); }
429 
430  // callback from control queue
431  void ExecuteControlPacket(const class C4ControlPlayerControl *pCtrl);
432 
433  // sync execution: Do keyrepeat, etc.
434  void Execute();
435 
436  // mouse input
437  bool DoMouseInput(uint8_t mouse_id, int32_t mouseevent, float game_x, float game_y, float gui_x, float gui_y, bool is_ctrl_down, bool is_shift_down, bool is_alt_down, int wheel_dir);
438 
439  // control enable/disable
440  bool SetControlDisabled(int ctrl, bool is_disabled) { return Sync.SetControlDisabled(ctrl, is_disabled); }
441  bool IsControlDisabled(int ctrl) const { return Sync.IsControlDisabled(ctrl); }
442 
443  // callback from C4GameControl when the next control packet is finalized
444  void PrepareInput();
445 
446 };
447 
448 
449 #endif // INC_C4PlayerControl
const char * getData() const
Definition: StdBuf.h:450
const char * GetName() const
const C4PlayerControlAssignmentSets & GetAssignmentSets() const
void ExecuteControlPacket(const class C4ControlPlayerControl *pCtrl)
bool Load(C4Group &hGroup, const char *szFilename, C4LangStringTable *pLang)
C4PlayerControlAssignmentSet * GetDefaultSet()
void GetTriggerKeys(const C4PlayerControlDefs &rDefs, C4KeyCodeExVec *pRegularKeys, C4KeyCodeExVec *pHoldKeys) const
CoordinateSpace GetCoordinateSpace() const
C4PlayerControlAssignmentSet * GetSetByName(const char *szName)
void MergeFrom(const C4PlayerControlAssignmentSet &Src, MergeMode merge_mode)
void SetControlDownState(int32_t iControl, const C4KeyEventData &rDownState, int32_t iDownFrame, bool fDownByUser)
C4PlayerControlAssignment * GetAssignmentByControl(int32_t control)
void MergeFrom(const C4PlayerControlAssignmentSets &Src, C4PlayerControlAssignmentSet::MergeMode merge_mode)
struct C4PlayerControlDefs::CInternalCons InternalCons
std::vector< C4PlayerControlAssignment > C4PlayerControlAssignmentVec
bool SetControlDisabled(int32_t iControl, int32_t iVal)
bool Execute(bool fUp, const C4KeyEventData &rKeyExtraData)
void CompileFunc(StdCompiler *pComp)
bool IsWildcardString(const char *szString)
Definition: StdFile.cpp:376
const char * GetGUIDesc(const C4PlayerControlDefs &defs) const
const CSync::ControlDownState * GetControlDownState(int32_t iControl) const
int32_t GetControlDisabled(int32_t iControl) const
bool IsGlobal() const
const ControlDownState * GetControlDownState(int32_t iControl) const
bool ResolveRefs(C4PlayerControlDefs *pControlDefs)
bool IsSync() const
void ResetControlDownState(int32_t iControl)
void SetInherited(bool to_val)
bool operator==(const C4PlayerControlAssignment &cmp) const
bool operator==(const C4KeyCodeEx &cmp)
C4PlayerControlAssignment * GetAssignmentByControlName(const char *szControlName)
const char * GetGUIName() const
void SetInheritedAssignment(const C4PlayerControlAssignment *to_val)
const C4PlayerControlDef * GetControlByIndex(int32_t idx) const
C4ID GetExtraData() const
bool operator==(const C4PlayerControlDef &cmp) const
C4PlayerControlAssignmentSet * GetSetByIndex(int32_t index)
bool DoMouseInput(uint8_t mouse_id, int32_t mouseevent, float game_x, float game_y, float gui_x, float gui_y, bool is_ctrl_down, bool is_shift_down, bool is_alt_down, int wheel_dir)
void CompileFunc(StdCompiler *pComp)
int32_t GetControlIndexByIdentifier(const char *szIdentifier) const
bool IsDefaultDisabled() const
DownStateVec ControlDownStates
int32_t GetSetIndex(const C4PlayerControlAssignmentSet *set) const
const C4KeyCodeEx & GetTriggerKey() const
void CompileFunc(StdCompiler *pComp)
void MergeFrom(const C4PlayerControlDefs &Src)
C4TimeMilliseconds tTime
bool IsHoldKey() const
bool IsValid() const
bool IsGlobal() const
Actions GetAction() const
StdStrBuf GetKeysAsString(bool human_readable, bool short_name) const
bool Save(C4Group &hGroup, const char *szFilename)
const char * GetGUIDesc() const
bool IsSendCursorPos() const
void RegisterKeyset(int32_t iPlr, C4PlayerControlAssignmentSet *pKeyset)
bool ResolveRefs(class C4PlayerControlAssignmentSet *pParentSet, C4PlayerControlDefs *pControlDefs)
ControlDownState(const C4KeyEventData &rDownState, int32_t iDownFrame, bool fDownByUser)
void CompileFunc(StdCompiler *pComp)
const char * GetIdentifier() const
const char * GetControlName() const
bool IsControlDisabled(int32_t iControl) const
bool IsControlDisabled(int ctrl) const
Definition: C4Id.h:28
std::vector< int32_t > DisableStateVec
const char * GetGUIName() const
DisableStateVec ControlDisableStates
bool IsMouseControlAssigned(int32_t mouseevent) const
void SetControlName(const char *control_name)
const C4PlayerControlAssignment * GetInheritedAssignment() const
C4PlayerControlAssignmentSet * CreateEmptySetByTemplate(const C4PlayerControlAssignmentSet &template_set)
std::vector< const C4PlayerControlAssignment * > C4PlayerControlAssignmentPVec
bool IsAsync() const
void SetKey(const C4KeyCodeEx &key)
size_t GetCount() const
const C4PlayerControlDefs & GetControlDefs() const
C4PlayerControlAssignment * CreateAssignmentForControl(const char *control_name)
void InitEmptyFromTemplate(const C4PlayerControlAssignmentSet &template_set)
void CompileFunc(StdCompiler *pComp)
int32_t GetInitialRepeatDelay() const
std::list< C4PlayerControlRecentKey > C4PlayerControlRecentKeyList
bool IsComboMatched(const C4PlayerControlRecentKeyList &DownKeys, const C4PlayerControlRecentKeyList &RecentKeys) const
bool SetControlDisabled(int ctrl, bool is_disabled)
const float C4GFX_ZoomStep
C4PlayerControlAssignment * GetAssignmentByIndex(int32_t index)
bool operator==(const C4PlayerControlAssignmentSets &cmp) const
int32_t GetTriggerMode() const
const char * GetGUIName(const C4PlayerControlDefs &defs) const
bool operator==(const C4PlayerControlAssignmentSet &cmp) const
void CompileFunc(StdCompiler *pComp)
void CopyKeyFrom(const C4PlayerControlAssignment &src_assignment)
bool operator<(const C4PlayerControlAssignment &cmp) const
std::vector< C4KeyCodeEx > C4KeyCodeExVec
void SetControlMovedState(int32_t iControl, const C4KeyEventData &rMovedState, int32_t iMovedFrame)
bool IsOverrideAssignments() const
bool operator==(const C4PlayerControlDefs &cmp) const
void GetAssignmentsByKey(const C4PlayerControlDefs &rDefs, const C4KeyCodeEx &key, bool fHoldKeysOnly, C4PlayerControlAssignmentPVec *pOutVec, const C4PlayerControlRecentKeyList &DownKeys, const C4PlayerControlRecentKeyList &RecentKeys) const
bool ResolveRefs(C4PlayerControlDefs *pControlDefs)
void Copy()
Definition: StdBuf.h:475
bool operator==(const ControlDownState &cmp) const
void CompileFunc(StdCompiler *pComp)
void CompileFunc(StdCompiler *pComp)
C4PlayerControlRecentKey(const C4KeyCodeEx &pressed_key, const C4KeyCodeEx &matched_key, C4TimeMilliseconds tTime)
void InitDefaults(const C4PlayerControlDefs &ControlDefs)
int32_t GetRepeatDelay() const
void RemoveAssignmentByControlName(const char *control_name)
bool operator==(const CSync &cmp) const
bool IsSyncObjectMenuControl() const
std::vector< ControlDownState > DownStateVec
int32_t GetControl() const
void RemoveSetByName(const char *set_name)