ScummVM API documentation
scenes.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 LASTEXPRESS_SCENEMANAGER_H
23 #define LASTEXPRESS_SCENEMANAGER_H
24 
25 #include "lastexpress/data/scene.h"
26 
27 #include "common/hashmap.h"
28 #include "common/list.h"
29 
30 namespace LastExpress {
31 
32 class LastExpressEngine;
33 class SceneLoader;
34 class Sequence;
35 class SequenceFrame;
36 
37 class SceneManager {
38 public:
39  enum CheckPositionType {
40  kCheckPositionLookingUp,
41  kCheckPositionLookingDown,
42  kCheckPositionLookingAtDoors,
43  kCheckPositionLookingAtClock
44  };
45 
47  ~SceneManager();
48 
49  // Scene cache
50  void loadSceneDataFile(ArchiveIndex archive);
51  Scene *get(SceneIndex sceneIndex) { return _sceneLoader->get(sceneIndex); }
52 
53  // Scene loading
54  void setScene(SceneIndex sceneIndex);
55  void loadScene(SceneIndex sceneIndex);
56  void loadSceneFromObject(ObjectIndex object, bool alternate = false);
57  void loadSceneFromItem(InventoryItem item);
58  void loadSceneFromItemPosition(InventoryItem item);
59  void loadSceneFromPosition(CarIndex car, Position position, int param3 = -1);
60 
61  // Scene drawing & processing
62  void drawScene(SceneIndex sceneIndex);
63  void processScene();
64  SceneIndex processIndex(SceneIndex sceneIndex);
65 
66  // Checks
67  bool checkPosition(SceneIndex sceneIndex, CheckPositionType type) const;
68  bool checkCurrentPosition(bool doCheckOtherCars) const;
69 
70  // Train
71  void updateDoorsAndClock();
72  void resetDoorsAndClock();
73 
74  // Sequence queue
75  void drawFrames(bool refreshScreen);
76  void addToQueue(SequenceFrame * const frame);
77  void removeFromQueue(SequenceFrame *frame);
78  void removeAndRedraw(SequenceFrame **frame, bool doRedraw);
79  void resetQueue();
80  void setCoordinates(SequenceFrame *frame);
81  void setCoordinates(const Common::Rect &rect);
82 
83  // Helpers
84  SceneIndex getSceneIndexFromPosition(CarIndex car, Position position, int param3 = -1);
85 
86  void setFlagDrawSequences() { _flagDrawSequences = true; }
87 
88 private:
89  LastExpressEngine *_engine;
90  SceneLoader *_sceneLoader;
91 
92  // Flags
93  bool _flagNoEntity;
94  bool _flagDrawEntities;
95  bool _flagDrawSequences;
96  bool _flagCoordinates;
97 
98  Common::Rect _coords;
99 
100  // Train sequences
102  SequenceFrame *_clockHours;
103  SequenceFrame *_clockMinutes;
104 
105  // Sequence queue
107 
108  // Scene processing
109  void preProcessScene(SceneIndex *index);
110  void postProcessScene();
111 
112  void resetCoordinates();
113 };
114 
115 } // End of namespace LastExpress
116 
117 #endif // LASTEXPRESS_SCENEMANAGER_H
Definition: scene.h:195
Definition: lastexpress.h:69
Definition: list.h:44
Definition: rect.h:144
Definition: animation.h:45
Definition: scene.h:178
Definition: sequence.h:183
Definition: scenes.h:37