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 TSAGE_SCENES_H
23 #define TSAGE_SCENES_H
24 
25 #include "common/scummsys.h"
26 #include "tsage/converse.h"
27 #include "tsage/events.h"
28 #include "tsage/core.h"
29 #include "tsage/saveload.h"
30 
31 namespace TsAGE {
32 
33 class Scene : public StripCallback {
34 private:
35  void drawBackgroundObjects();
36 public:
37  int _screenNumber;
38  int _activeScreenNumber;
39  int _sceneMode;
40  StripManager _stripManager;
41 
42  Rect _backgroundBounds;
43  GfxSurface _backSurface;
44  Rect _sceneBounds;
45  Rect _oldSceneBounds;
46  int _enabledSections[256];
47  int _zoomPercents[256];
48  ScenePriorities _priorities;
49  SceneObjectList _bgSceneObjects;
50 public:
51  Scene();
52  ~Scene() override;
53 
54  Common::String getClassName() override { return "Scene"; }
55  void synchronize(Serializer &s) override;
56  void stripCallback(int v) override {}
57  void postInit(SceneObjectList *OwnerList = NULL) override;
58  void process(Event &event) override;
59  void dispatch() override;
60  virtual void loadScene(int sceneNum);
61  virtual void refreshBackground(int xAmount, int yAmount);
62 
63  void setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent);
64  void loadBackground(int xAmount, int yAmount);
65 
66  void loadSceneData(int sceneNum);
67 };
68 
69 class SceneManager : public GameHandler, public SaveListener {
70 private:
71  void disposeRegions() {
72  // No need to do anything, since regions will be freed automatically when the scene is
73  }
74  Scene *getNewScene();
75 public:
76  Scene *_scene;
77  bool _hasPalette;
78  int _loadMode;
79  int _sceneNumber;
80  int _previousScene;
81  int _nextSceneNumber;
82  FadeMode _fadeMode;
83  Common::Point _sceneBgOffset;
84  int _sceneLoadCount;
85  Rect _scrollerRect;
86  int _objectCount;
87 public:
88  SceneManager();
89  ~SceneManager() override;
90 
91  void listenerSynchronize(Serializer &s) override;
92  void setNewScene(int sceneNumber);
93  void checkScene();
94  void sceneChange();
95  void fadeInIfNecessary();
96  void changeScene(int newSceneNumber);
97  void setBgOffset(const Common::Point &pt, int loadCount);
98 
99  void removeAction(Action *action) {
100  // Not currently implemented because addAction method doesn't seem to have any callers
101  }
102 
103  static void setup();
104  static void setBackSurface();
105  static void saveListener(int saveMode);
106  static void loadNotifier(bool postFlag);
107 };
108 
109 class Game {
110 protected:
112 
113  static bool notLockedFn(GameHandler *g);
114  virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName);
115 public:
116  virtual ~Game() {}
117 
118  void addHandler(GameHandler *entry) { _handlers.push_back(entry); }
119  void removeHandler(GameHandler *entry) { _handlers.remove(entry); }
120 
121  void execute();
122  virtual void start() = 0;
123  virtual void restart() {}
124  virtual void restartGame();
125  virtual void saveGame();
126  virtual void restoreGame();
127  virtual void quitGame();
128  virtual void endGame(int resNum, int lineNum) {}
129  virtual Scene *createScene(int sceneNumber) = 0;
130  virtual void processEvent(Event &event) {}
131  virtual void rightClick() {}
132  virtual bool canSaveGameStateCurrently() = 0;
133  virtual bool canLoadGameStateCurrently() = 0;
134 };
135 
136 } // End of namespace TsAGE
137 
138 #endif
Definition: scenes.h:69
Definition: str.h:59
Definition: core.h:736
Definition: core.h:134
Definition: converse.h:31
Definition: core.h:776
Definition: core.h:879
Definition: graphics.h:79
Definition: rect.h:45
Definition: events.h:47
Definition: saveload.h:115
Definition: blueforce_dialogs.h:30
void remove(const T &val)
Definition: list.h:125
Definition: saveload.h:63
Definition: converse.h:206
Definition: scenes.h:33
Definition: graphics.h:40
void push_back(const T &element)
Definition: list.h:140
Definition: saveload.h:90
Definition: scenes.h:109