ScummVM API documentation
ad_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 /*
23  * This file is based on WME Lite.
24  * http://dead-code.org/redir.php?target=wmelite
25  * Copyright (c) 2011 Jan Nedoma
26  */
27 #ifndef WINTERMUTE_ADGAME_H
28 #define WINTERMUTE_ADGAME_H
29 
30 #include "engines/wintermute/ad/ad_types.h"
31 #include "engines/wintermute/base/base_game.h"
32 
33 namespace Wintermute {
34 class AdItem;
35 class AdInventory;
36 class AdSceneState;
37 class AdScene;
38 class AdItem;
39 class AdObject;
40 class AdSentence;
41 class AdInventoryBox;
42 class AdResponseContext;
43 class AdResponseBox;
44 class AdGame : public BaseGame {
45 public:
46  bool onScriptShutdown(ScScript *script) override;
47 
48  bool onMouseLeftDown() override;
49  bool onMouseLeftUp() override;
50  bool onMouseLeftDblClick() override;
51  bool onMouseRightDown() override;
52  bool onMouseRightUp() override;
53 
54  bool handleCustomActionStart(BaseGameCustomAction action) override;
55  bool handleCustomActionEnd(BaseGameCustomAction action) override;
56 
57  bool displayDebugInfo() override;
58 
59  bool addSpeechDir(const char *dir);
60  bool removeSpeechDir(const char *dir);
61  char *findSpeechFile(char *StringID);
62 
63  bool deleteItem(AdItem *Item);
64  char *_itemsFile;
65  bool _tempDisableSaveState;
66  bool resetContent() override;
67  bool addItem(AdItem *item);
68  AdItem *getItemByName(const char *name) const;
69 
70  AdObject *_inventoryOwner;
71  bool isItemTaken(char *itemName);
72  bool registerInventory(AdInventory *inv);
73  bool unregisterInventory(AdInventory *inv);
74  bool displayContent(bool update = true, bool displayAll = false) override;
75 
76  bool gameResponseUsed(int ID) const;
77  bool addGameResponse(int ID);
78  bool resetResponse(int ID);
79 
80  bool branchResponseUsed(int ID) const;
81  bool addBranchResponse(int ID);
82  bool clearBranchResponses(char *name);
83  bool startDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
84  bool endDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
85  bool windowLoadHook(UIWindow *win, char **buf, char **params) override;
86  bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name) override;
87 
88  AdSceneState *getSceneState(const char *filename, bool saving);
89  BaseViewport *_sceneViewport;
90 
91  int32 _texItemLifeTime;
92  int32 _texWalkLifeTime;
93  int32 _texStandLifeTime;
94  int32 _texTalkLifeTime;
95 
96  TTalkSkipButton _talkSkipButton;
97  TVideoSkipButton _videoSkipButton;
98 
99  virtual bool getLayerSize(int *layerWidth, int *layerHeight, Rect32 *viewport, bool *customViewport) override;
100 #ifdef ENABLE_WME3D
101  uint32 getAmbientLightColor() override;
102 
103  TShadowType getMaxShadowType(BaseObject *object) override;
104 
105  bool getFogParams(bool *fogEnabled, uint32 *fogColor, float *start, float *end) override;
106 #endif
107 
108  bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const override;
109  bool scheduleChangeScene(const char *filename, bool fadeIn);
110  void setPrevSceneName(const char *name);
111  void setPrevSceneFilename(const char *name);
112 
113  AdItem *_selectedItem;
114  bool cleanup() override;
115  DECLARE_PERSISTENT(AdGame, BaseGame)
116 
117  void finishSentences();
118  bool showCursor() override;
119 
120  TGameStateEx _stateEx;
121 
122  bool displaySentences(bool frozen);
123  void addSentence(AdSentence *sentence);
124  bool changeScene(const char *filename, bool fadeIn);
125  bool removeObject(AdObject *object);
126  bool addObject(AdObject *object);
127  AdScene *_scene;
128  bool initLoop();
129  AdGame(const Common::String &gameId);
130  ~AdGame() override;
131 
132  BaseArray<AdObject *> _objects;
133 
134  bool loadFile(const char *filename) override;
135  bool loadBuffer(char *buffer, bool complete = true) override;
136 
137  bool loadItemsFile(const char *filename, bool merge = false);
138  bool loadItemsBuffer(char *buffer, bool merge = false);
139 
140  // scripting interface
141  ScValue *scGetProperty(const Common::String &name) override;
142  bool scSetProperty(const char *name, ScValue *value) override;
143  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
144  bool validMouse();
145  Common::String debuggerToString() const override;
146 private:
147  bool externalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name) override;
148 
149  AdObject *_invObject;
150  BaseArray<AdInventory *> _inventories;
151  char *_scheduledScene;
152  bool _scheduledFadeIn;
153  char *_prevSceneName;
154  char *_prevSceneFilename;
155  char *_debugStartupScene;
156  char *_startupScene;
157  bool _initialScene;
158  bool _smartItemCursor;
159  BaseArray<char *> _speechDirs;
160  BaseArray<AdItem *> _items;
161 
162  BaseArray<AdSentence *> _sentences;
163 
164  BaseArray<AdSceneState *> _sceneStates;
165  BaseArray<char *> _dlgPendingBranches;
166 
167  BaseArray<const AdResponseContext *> _responsesBranch;
169 
170  AdResponseBox *_responseBox;
171  AdInventoryBox *_inventoryBox;
172 };
173 
174 } // End of namespace Wintermute
175 
176 #endif
Definition: script.h:44
Definition: ad_inventory.h:37
Definition: base_game.h:75
Definition: ad_sentence.h:43
Definition: script_value.h:42
Definition: str.h:59
Definition: ad_item.h:36
Definition: ad_object.h:46
Definition: ad_scene.h:49
Definition: ad_game.h:44
Definition: rect32.h:60
Definition: script_stack.h:41
Definition: ad_scene_state.h:37
Definition: coll_templ.h:63
Definition: ad_inventory_box.h:38
Definition: base_viewport.h:38
Definition: ui_window.h:39
Definition: ad_response_box.h:40
Definition: coll_templ.h:89
Definition: base_object.h:57
Definition: achievements_tables.h:27