MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ProcessKeyPressed

Method ProcessKeyPressed

engine/Poseidon/Input/KeyboardState.cpp:137–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void KeyboardState::ProcessKeyPressed(int dik)
138{
139 if (!awaitCheat)
140 {
141 keysToDo[dik] = true;
142 return;
143 }
144
145 RString key = GetCheatKeyName(dik);
146 cheatInProgress = cheatInProgress + key;
147
148 const EnumName* cheatCodeNames = GetEnumNames(CheatCode(0));
149 bool matchPossible = false;
150 for (int i = 0;; i++)
151 {
152 const EnumName& chName = cheatCodeNames[i];
153 if (chName.name.GetLength() == 0)
154 break;
155 if (chName.value == CheatNone)
156 continue;
157 if (!strcmpi(chName.name, cheatInProgress))
158 {
159 awaitCheat = false;
160 cheatActive = (CheatCode)chName.value;
161 Foundation::GlobalShowMessage(1000, "Activated %s", static_cast<const char*>(cheatInProgress));
162 return;
163 }
164 int len = cheatInProgress.GetLength();
165 if (!strnicmp(chName.name, cheatInProgress, len))
166 matchPossible = true;
167 }
168 if (!matchPossible)
169 awaitCheat = false;
170}
171
172void KeyboardState::ForgetKeys()
173{

Callers

nothing calls this directly

Calls 6

GetCheatKeyNameFunction · 0.85
CheatCodeEnum · 0.85
GlobalShowMessageFunction · 0.85
strcmpiFunction · 0.50
strnicmpFunction · 0.50
GetLengthMethod · 0.45

Tested by

no test coverage detected