ScummVM API documentation
cheats.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef HARVESTER_CHEATS_H
23 #define HARVESTER_CHEATS_H
24 
25 #include "common/str.h"
26 
27 namespace Common {
28 struct KeyState;
29 }
30 
31 namespace Harvester {
32 
33 class HarvesterEngine;
34 class Script;
35 struct InteractionResult;
36 
37 enum CheatInputResult {
38  kCheatInputIgnored = 0,
39  kCheatInputPartial,
40  kCheatInputComplete
41 };
42 
44  bool activated = false;
45  bool inventoryChanged = false;
46  bool playerStateChanged = false;
47  bool clearInteractionState = false;
48  bool hasInteraction = false;
49 };
50 
51 class CheatSystem {
52 public:
53  explicit CheatSystem(HarvesterEngine &engine);
54 
55  CheatInputResult processKey(const Common::KeyState &key, Script &script,
56  const Common::String &roomName, InteractionResult &interaction,
57  CheatActivation &activation);
58  void reset();
59  bool isPlayerDamageDisabled() const { return _playerDamageDisabled; }
60 
61 private:
62  enum CheatId {
63  kCheatMaxHealth = 0,
64  kCheatAllWeapons,
65  kCheatAllItems,
66  kCheatLodgeLevel2,
67  kCheatLodgeLevel3,
68  kCheatLodgeFinalLevel,
69  kCheatInvincibility,
70  kCheatLodgeLevel1
71  };
72 
73  CheatInputResult matchKey(uint16 ascii, CheatId &cheatId);
74  static const char *describe(CheatId cheatId);
75  void execute(CheatId cheatId, Script &script, const Common::String &roomName,
76  InteractionResult &interaction, CheatActivation &activation);
77 
78  HarvesterEngine &_engine;
79  Common::String _inputBuffer;
80  bool _playerDamageDisabled = false;
81 };
82 
83 } // End of namespace Harvester
84 
85 #endif // HARVESTER_CHEATS_H
Definition: str.h:59
Definition: art.h:31
Definition: script.h:319
Definition: cheats.h:43
Definition: algorithm.h:29
Definition: harvester.h:47
Definition: keyboard.h:294
Definition: cheats.h:51
Definition: script.h:288