| 135 | } |
| 136 | |
| 137 | void 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 | |
| 172 | void KeyboardState::ForgetKeys() |
| 173 | { |
nothing calls this directly
no test coverage detected