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 public:
50  static const byte kCursInvHolding = 0;
51  static const byte kCursInvNotHolding = 1;
52  static const byte kCursStandard = 254;
53 
54  ActionManager() {}
55  virtual ~ActionManager();
56 
57  void handleInput(NancyInput &input);
58 
59  void processActionRecords();
60  void processDependency(DependencyRecord &dep, ActionRecord &record, bool doNotCheckCursor);
61 
62  void addNewActionRecord(Common::SeekableReadStream &inputData);
63  Common::Array<ActionRecord *> &getActionRecords() { return _records; }
64  ActionRecord *getActionRecord(uint id) { if (id < _records.size()) return _records[id]; else return nullptr;}
65  void clearActionRecords();
66 
67  void onPause(bool pause);
68 
69  void synchronize(Common::Serializer &serializer);
70 
71  static ActionRecord *createAndLoadNewRecord(Common::SeekableReadStream &inputData);
72 
74 
75 protected:
76  static ActionRecord *createActionRecord(uint16 type, Common::SeekableReadStream *recordStream = nullptr);
77 
78  void synchronizeMovieWithSound();
79 
80  void debugDrawHotspots();
81 
82  bool _previousRecordWasExecuted = false;
83  Common::Array<ActionRecord *> _activatedRecordsThisFrame;
84 };
85 
86 } // End of namespace Action
87 } // End of namespace Nancy
88 
89 #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:80
Definition: actionmanager.h:48
Definition: actionrecord.h:97
Definition: algorithm.h:29
Definition: console.h:36
Definition: actionmanager.h:32