ScummVM API documentation
actionmanager.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 NANCY_ACTION_ACTIONMANAGER_H
23 #define NANCY_ACTION_ACTIONMANAGER_H
24 
25 #include "common/array.h"
26 
27 namespace Common {
28 class Serializer;
29 class SeekableReadStream;
30 }
31 
32 namespace Nancy {
33 
34 class NancyEngine;
35 class NancyConsole;
36 struct NancyInput;
37 
38 namespace State {
39 class Scene;
40 }
41 
42 namespace Action {
43 
44 class ActionRecord;
45 struct DependencyRecord;
46 
47 // The class that handles ActionRecords and their execution
49  friend class Nancy::State::Scene;
50  friend class Nancy::NancyConsole;
51 
52 public:
53  static const byte kCursInvHolding = 0;
54  static const byte kCursInvNotHolding = 1;
55  static const byte kCursStandard = 254;
56 
57  ActionManager() {}
58  virtual ~ActionManager();
59 
60  void handleInput(NancyInput &input);
61 
62  void processActionRecords();
63  void processDependency(DependencyRecord &dep, ActionRecord &record, bool doNotCheckCursor);
64 
65  void addNewActionRecord(Common::SeekableReadStream &inputData);
66  Common::Array<ActionRecord *> &getActionRecords() { return _records; }
67  ActionRecord *getActionRecord(uint id) { if (id < _records.size()) return _records[id]; else return nullptr;}
68  void clearActionRecords();
69 
70  void onPause(bool pause);
71 
72  void synchronize(Common::Serializer &serializer);
73 
74 protected:
75  static ActionRecord *createActionRecord(uint16 type, Common::SeekableReadStream *recordStream = nullptr);
76  static ActionRecord *createAndLoadNewRecord(Common::SeekableReadStream &inputData);
77 
78  void synchronizeMovieWithSound();
79 
80  void debugDrawHotspots();
81 
83  bool _recordsWereExecuted = false; // Used for kDefaultAR dependency
84  Common::Array<ActionRecord *> _activatedRecordsThisFrame;
85 };
86 
87 } // End of namespace Action
88 } // End of namespace Nancy
89 
90 #endif // NANCY_ACTION_ACTIONMANAGER_H
Definition: nancy.h:74
Definition: array.h:52
Definition: actionrecord.h:69
Definition: stream.h:745
Definition: input.h:41
Definition: serializer.h:79
Definition: actionmanager.h:48
Definition: actionrecord.h:97
Definition: algorithm.h:29
Definition: scene.h:72
Definition: console.h:36
Definition: actionmanager.h:32