ScummVM API documentation
syberia_game.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 TETRAEDGE_GAME_SYBERIA_GAME_H
23 #define TETRAEDGE_GAME_SYBERIA_GAME_H
24 
25 #include "common/types.h"
26 #include "common/serializer.h"
27 #include "common/str.h"
28 
29 #include "tetraedge/game/in_game_scene.h"
30 #include "tetraedge/game/game.h"
31 #include "tetraedge/game/cellphone.h"
32 #include "tetraedge/game/game_sound.h"
33 #include "tetraedge/game/objectif.h"
34 #include "tetraedge/te/te_checkbox_layout.h"
35 #include "tetraedge/te/te_vector2s32.h"
36 #include "tetraedge/te/te_vector3f32.h"
37 
38 namespace Tetraedge {
39 
40 class TeLuaThread;
41 
42 class SyberiaGame : public Tetraedge::Game {
43 public:
44  SyberiaGame();
45  ~SyberiaGame();
46 
47  struct HitObject {
48  bool onChangeWarp();
49  bool onDown();
50  bool onUp();
51  bool onValidated();
52  //byte OnVisible(); empty never used?
53 
54  Common::String _name;
55  SyberiaGame *_game;
56  TeButtonLayout *_button;
57  };
58 
59  class RandomSound {
60  public:
61  Common::Path _path;
62  Common::String _name;
63  TeMusic _music;
64  float _f1;
65  float _volume;
66  bool onSoundFinished();
67  };
68 
69  struct YieldedCallback {
70  TeLuaThread *_luaThread;
71  Common::String _luaParam;
72  Common::String _luaParam2;
73  Common::String _luaFnName;
74  // Note: original game long, and int fields.. unused?
75  };
76 
77  void addArtworkUnlocked(const Common::String &name, bool notify);
78  void addRandomSound(const Common::String &s1, const Common::Path &s2, float f1, float f2);
79  void addToBag(const Common::String &objname) override;
80  void addToHand(const Common::String &objname);
81  void addToScore(int score);
82 
83  bool changeWarp(const Common::String &zone, const Common::String &scene, bool fadeFlag) override;
84 
85  void draw() override;
86  void enter() override; // will load game if _loadName is set.
87 
88  void finishFreemium();
89  void finishGame() override;
90  void initLoadedBackupData() override;
91  void leave(bool flag) override;
92  void loadBackup(const Common::String &path);
93  bool loadCharacter(const Common::String &name);
94  bool loadPlayerCharacter(const Common::String &name);
95  bool loadScene(const Common::String &name);
96 
97  // Not in original. Load unlocked artwork from ScummVM config.
98  void loadUnlockedArtwork() override;
99 
100  void playRandomSound(const Common::String &name);
101  void resetPreviousMousePos();
102  bool unloadCharacter(const Common::String &character);
103  bool unloadCharacters();
104  bool unloadPlayerCharacter(const Common::String &character);
105  void update() override;
106 
107  bool _movePlayerCharacterDisabled;
108  bool _sceneCharacterVisibleFromLoad;
109  bool _isCharacterWalking;
110  bool _isCharacterIdle;
111 
112  const Common::Path &sceneZonePath() const { return _sceneZonePath; }
113  Objectif &objectif() { return _objectif; }
114  Common::Array<YieldedCallback> &yieldedCallbacks() { return _yieldedCallbacks; }
115  void setSaveRequested() { _saveRequested = true; }
116  bool markersVisible() const { return _markersVisible; }
117  const TeVector3f32 &posPlayer() const { return _posPlayer; }
118  void setPosPlayer(const TeVector3f32 &pos) { _posPlayer = pos; }
119  TeTimer &walkTimer() { return _walkTimer; }
120  void setExitZone(const Common::String &zone) { _exitZone = zone; }
121  bool isArtworkUnlocked(const Common::String &name) const;
122  static Common::String artworkConfName(const Common::String &name);
123 
124  void setRunModeEnabled(bool val) { _runModeEnabled = val; }
125  bool runModeEnabled() const { return _runModeEnabled; }
126 
127 private:
128  bool addAnimToSet(const Common::Path &path);
129  void addNoScale2Children();
130  void addNoScaleChildren();
131 
132  void attachButtonsLayoutGoto() {}; // does nothing?
133  void createButtonsLayoutGoto() {}; // does nothing?
134  void deleteButtonsLayoutGoto() {}; // does nothing?
135 
136  bool changeWarp2(const Common::String &zone, const Common::String &scene, bool fadeFlag);
137 
138  void deleteNoScale();
139 
140  void initNoScale();
141  void initScene(bool param_1, const Common::String &scenePath);
142  bool initWarp(const Common::String &zone, const Common::String &scene, bool fadeFlag);
143 
144  bool onCallNumber(Common::String val);
145  bool onCharacterAnimationFinished(const Common::String &val);
146  bool onCharacterAnimationPlayerFinished(const Common::String &val);
147  bool onDialogFinished(const Common::String &val) override;
148  bool onDisplacementFinished();
149  bool onDisplacementPlayerFinished();
150  bool onFinishedCheckBackup(bool result);
151  bool onFinishedLoadingBackup(const Common::String &val) override;
152  bool onFinishedSavingBackup(int something);
153  bool onMarkersVisible(TeCheckboxLayout::State state);
154  bool onMouseClick(const Common::Point &pt);
155  bool onVideoFinished() override;
156 
157  void removeNoScale2Children();
158  void removeNoScaleChildren();
159 
160  bool _enteredFlag2;
161 
162  int _score;
163 
164  int _frameCounter;
165 
166  TeVector2s32 _previousMousePos;
167  TeVector2s32 _lastCharMoveMousePos;
168 
169  Common::String _warpZone;
170  Common::String _warpScene;
171  bool _warpFadeFlag;
172  bool _warped;
173 
174  Common::String _exitZone;
175  Common::String _someSceneName;
176  Common::Path _sceneZonePath;
177 
178  Common::Array<HitObject *> _gameHitObjects;
179  // These are static in original, but cleaner to keep here.
180  Common::Array<YieldedCallback> _yieldedCallbacks;
181 
183 
184  Common::HashMap<Common::String, bool> _unlockedArtwork;
185 
186  int _gameLoadState;
187 
188  Objectif _objectif;
189 
190  bool _markersVisible;
191  bool _saveRequested;
192  bool _randomSoundFinished;
193 
194  RandomSound *_randomSound;
195  TeTimer _randomSoundTimer;
196 
197  TeLayout *_noScaleLayout;
198 
199  TeVector3f32 _posPlayer;
200 
201  Common::Point _lastUpdateMousePos;
202 
203  // Syberia 2 specific data
204  bool _runModeEnabled;
205 };
206 
207 } // end namespace Tetraedge
208 
209 #endif // TETRAEDGE_GAME_SYBERIA_GAME_H
Definition: game.h:46
Definition: str.h:59
Definition: detection.h:27
Definition: array.h:52
Definition: path.h:52
Definition: syberia_game.h:42
Definition: te_timer.h:33
Definition: te_button_layout.h:38
Definition: hashmap.h:85
Definition: te_layout.h:35
Definition: rect.h:45
Definition: objectif.h:30
Definition: syberia_game.h:47
Definition: te_vector2s32.h:31
Definition: syberia_game.h:69
Definition: te_vector3f32.h:33
Definition: te_music.h:35
Definition: syberia_game.h:59
Definition: te_lua_thread.h:36