ScummVM API documentation
quick_avatar_mover_process.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 WORLD_ACTORS_QUICKAVATARMOVERPROCESS_H
23 #define WORLD_ACTORS_QUICKAVATARMOVERPROCESS_H
24 
25 #include "ultima/ultima8/metaengine.h"
26 #include "ultima/ultima8/kernel/process.h"
27 
28 namespace Ultima {
29 namespace Ultima8 {
30 
32 public:
34  ~QuickAvatarMoverProcess() override;
35 
36  ENABLE_RUNTIME_CLASSTYPE()
37 
38  static QuickAvatarMoverProcess *get_instance();
39 
40  void run() override;
41  void terminate() override;
42 
43  static bool isEnabled() {
44  return _enabled;
45  }
46  static void setEnabled(bool value) {
47  _enabled = value;
48  }
49  static bool isClipping() {
50  return _clipping;
51  }
52  static void setClipping(bool value) {
53  _clipping = value;
54  }
55  static void toggleClipping() {
56  _clipping = !_clipping;
57  }
58 
59  bool hasMovementFlags(uint32 flags) const {
60  return (_movementFlags & flags) != 0;
61  }
62  void setMovementFlag(uint32 mask) {
63  _movementFlags |= mask;
64  }
65  virtual void clearMovementFlag(uint32 mask) {
66  _movementFlags &= ~mask;
67  }
68  void resetMovementFlags() {
69  _movementFlags = 0;
70  }
71 
72  // Return true if handled, false if not.
73  bool onActionDown(KeybindingAction action);
74  bool onActionUp(KeybindingAction action);
75 
76  bool loadData(Common::ReadStream *rs, uint32 version);
77  void saveData(Common::WriteStream *ws) override;
78 
79  enum MovementFlags {
80  MOVE_ASCEND = 0x0001,
81  MOVE_DESCEND = 0x0002,
82  MOVE_SLOW = 0x0004,
83  MOVE_FAST = 0x0008,
84 
85  // Tank controls
86  MOVE_TURN_LEFT = 0x0010,
87  MOVE_TURN_RIGHT = 0x0020,
88  MOVE_FORWARD = 0x0040,
89  MOVE_BACK = 0x0080,
90 
91  // Directional controls
92  MOVE_LEFT = 0x0100,
93  MOVE_RIGHT = 0x0200,
94  MOVE_UP = 0x0400,
95  MOVE_DOWN = 0x0800,
96 
97  MOVE_ANY_DIRECTION = MOVE_LEFT | MOVE_RIGHT | MOVE_UP | MOVE_DOWN | MOVE_ASCEND | MOVE_DESCEND
98  };
99 
100 protected:
101  uint32 _movementFlags;
102  static ProcId _amp;
103  static bool _enabled;
104  static bool _clipping;
105 };
106 
107 } // End of namespace Ultima8
108 } // End of namespace Ultima
109 
110 #endif
Definition: stream.h:77
Definition: process.h:34
Definition: quick_avatar_mover_process.h:31
Definition: detection.h:27
void terminate() override
terminate the process. This wakes up all processes waiting for it.
void saveData(Common::WriteStream *ws) override
save Process data
Definition: stream.h:385