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  virtual bool getLayerSize(int *layerWidth, int *layerHeight, Rect32 *viewport, bool *customViewport) override;
60 
61 #ifdef ENABLE_WME3D
62  uint32 getAmbientLightColor() override;
63 
64  bool getFogParams(bool *fogEnabled, uint32 *fogColor, float *start, float *end) override;
65 
66  virtual bool renderShadowGeometry() override;
67  TShadowType getMaxShadowType(BaseObject *object) override;
68 #endif
69 
70 
71  bool addSpeechDir(const char *dir);
72  bool removeSpeechDir(const char *dir);
73  char *findSpeechFile(char *StringID);
74 
75  bool deleteItem(AdItem *Item);
76  char *_itemsFile;
77  bool _tempDisableSaveState;
78  bool resetContent() override;
79  bool addItem(AdItem *item);
80  AdItem *getItemByName(const char *name) const;
81 
82  AdObject *_inventoryOwner;
83  bool isItemTaken(char *itemName);
84  bool registerInventory(AdInventory *inv);
85  bool unregisterInventory(AdInventory *inv);
86  bool displayContent(bool update = true, bool displayAll = false) override;
87 
88  bool gameResponseUsed(int ID) const;
89  bool addGameResponse(int ID);
90  bool resetResponse(int ID);
91 
92  bool branchResponseUsed(int ID) const;
93  bool addBranchResponse(int ID);
94  bool clearBranchResponses(char *name);
95  bool startDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
96  bool endDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
97  bool windowLoadHook(UIWindow *win, char **buf, char **params) override;
98  bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name) override;
99 
100  AdSceneState *getSceneState(const char *filename, bool saving);
101  BaseViewport *_sceneViewport;
102 
103  int32 _texItemLifeTime;
104  int32 _texWalkLifeTime;
105  int32 _texStandLifeTime;
106  int32 _texTalkLifeTime;
107 
108  TTalkSkipButton _talkSkipButton;
109  TVideoSkipButton _videoSkipButton;
110 
111  bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const override;
112  bool scheduleChangeScene(const char *filename, bool fadeIn);
113  void setPrevSceneName(const char *name);
114  void setPrevSceneFilename(const char *name);
115 
116  AdItem *_selectedItem;
117  bool cleanup() override;
118  DECLARE_PERSISTENT(AdGame, BaseGame)
119 
120  void finishSentences();
121  bool showCursor() override;
122 
123  TGameStateEx _stateEx;
124  bool displaySentences(bool frozen);
125  void addSentence(AdSentence *sentence);
126  bool changeScene(const char *filename, bool fadeIn);
127  bool removeObject(AdObject *object);
128  bool addObject(AdObject *object);
129  AdScene *_scene;
130  bool initLoop();
131  AdGame(const Common::String &gameId);
132  ~AdGame() override;
133 
134  BaseArray<AdObject *> _objects;
135 
136  bool loadFile(const char *filename) override;
137  bool loadBuffer(char *buffer, bool complete = true) override;
138 
139  bool loadItemsFile(const char *filename, bool merge = false);
140  bool loadItemsBuffer(char *buffer, bool merge = false);
141 
142  // scripting interface
143  ScValue *scGetProperty(const Common::String &name) override;
144  bool scSetProperty(const char *name, ScValue *value) override;
145  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
146  bool validMouse();
147  Common::String debuggerToString() const override;
148 private:
149  bool externalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name) override;
150 
151  AdObject *_invObject;
152  BaseArray<AdInventory *> _inventories;
153  char *_scheduledScene;
154  bool _scheduledFadeIn;
155  char *_prevSceneName;
156  char *_prevSceneFilename;
157  char *_debugStartupScene;
158  char *_startupScene;
159  bool _initialScene;
160  bool _smartItemCursor;
161  BaseArray<char *> _speechDirs;
162  BaseArray<AdItem *> _items;
163 
164  BaseArray<AdSentence *> _sentences;
165 
166  BaseArray<AdSceneState *> _sceneStates;
167  BaseArray<char *> _dlgPendingBranches;
168 
169  BaseArray<const AdResponseContext *> _responsesBranch;
171 
172  AdResponseBox *_responseBox;
173  AdInventoryBox *_inventoryBox;
174 };
175 
176 } // End of namespace Wintermute
177 
178 #endif
Definition: script.h:44
Definition: ad_inventory.h:37
Definition: base_game.h:76
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:49
Definition: achievements_tables.h:27