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
33namespace Wintermute {
34class AdItem;
35class AdInventory;
36class AdSceneState;
37class AdScene;
38class AdItem;
39class AdObject;
40class AdSentence;
41class AdInventoryBox;
42class AdResponseContext;
43class AdResponseBox;
44class AdGame : public BaseGame {
45public:
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 displayDebugInfo() override;
55
56 virtual BaseObject *getNextAccessObject(BaseObject *currObject) override;
57 virtual BaseObject *getPrevAccessObject(BaseObject *currObject) override;
58
59 virtual bool getLayerSize(int *layerWidth, int *layerHeight, Common::Rect32 *viewport, bool *customViewport) override;
60#ifdef ENABLE_WME3D
61 uint32 getAmbientLightColor() override;
62 bool getFogParams(bool *fogEnabled, uint32 *fogColor, float *start, float *end) override;
63
64 virtual bool renderShadowGeometry() override;
65 TShadowType getMaxShadowType(BaseObject *object = nullptr) override;
66#endif
67
68 bool _smartItemCursor;
69
70 BaseArray<char *> _speechDirs;
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;
82 AdObject *_inventoryOwner;
83 bool isItemTaken(char *itemName);
84 bool registerInventory(AdInventory *inv);
85 bool unregisterInventory(AdInventory *inv);
86
87 AdObject *_invObject;
88 BaseArray<AdInventory *> _inventories;
89 bool displayContent(bool update = true, bool displayAll = false) override;
90 char *_debugStartupScene;
91 char *_startupScene;
92 bool _initialScene;
93 bool gameResponseUsed(int id) const;
94 bool addGameResponse(int id);
95 bool resetResponse(int id);
96
97 bool branchResponseUsed(int id) const;
98 bool addBranchResponse(int id);
99 bool clearBranchResponses(char *name);
100 bool startDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
101 bool endDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
102 bool windowLoadHook(UIWindow *win, char **buf, char **params) override;
103 bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name) override;
104
105 AdSceneState *getSceneState(const char *filename, bool saving);
106 BaseViewport *_sceneViewport;
107 int32 _texItemLifeTime;
108 int32 _texWalkLifeTime;
109 int32 _texStandLifeTime;
110 int32 _texTalkLifeTime;
111
112 TTalkSkipButton _talkSkipButton;
113 TVideoSkipButton _videoSkipButton;
114
115 bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) override;
116 bool scheduleChangeScene(const char *filename, bool fadeIn);
117 char *_scheduledScene;
118 bool _scheduledFadeIn;
119 void setPrevSceneName(const char *name);
120 void setPrevSceneFilename(const char *name);
121 char *_prevSceneName;
122 char *_prevSceneFilename;
123 AdItem *_selectedItem;
124 bool cleanup() override;
125 DECLARE_PERSISTENT(AdGame, BaseGame)
126
127 void finishSentences();
128 bool showCursor() override;
129 TGameStateEx _stateEx;
130 AdResponseBox *_responseBox;
131 AdInventoryBox *_inventoryBox;
132 bool displaySentences(bool frozen);
133 void addSentence(AdSentence *sentence);
134 bool changeScene(const char *filename, bool fadeIn);
135 bool removeObject(AdObject *object);
136 bool addObject(AdObject *object);
137 AdScene *_scene;
138 bool initLoop();
139 AdGame(const Common::String &gameId);
140 ~AdGame() override;
141 BaseArray<AdObject *> _objects;
142 BaseArray<AdSentence *> _sentences;
143
144 BaseArray<AdSceneState *> _sceneStates;
145 BaseArray<char *> _dlgPendingBranches;
146
147 BaseArray<AdResponseContext *> _responsesBranch;
148 BaseArray<AdResponseContext *> _responsesGame;
149
150 bool loadFile(const char *filename) override;
151 bool loadBuffer(char *buffer, bool complete = true) override;
152
153 bool loadItemsFile(const char *filename, bool merge = false);
154 bool loadItemsBuffer(char *buffer, bool merge = false);
155
156 bool externalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name) override;
157
158 // scripting interface
159 ScValue *scGetProperty(const char *name) override;
160 bool scSetProperty(const char *name, ScValue *value) override;
161 bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
162 bool validMouse();
163
164
165 Common::String debuggerToString() const override;
166
167 bool handleCustomActionStart(BaseGameCustomAction action) override;
168 bool handleCustomActionEnd(BaseGameCustomAction action) override;
169};
170
171} // End of namespace Wintermute
172
173#endif
Definition: str.h:59
Definition: ad_game.h:44
Definition: ad_inventory_box.h:38
Definition: ad_inventory.h:37
Definition: ad_item.h:36
Definition: ad_object.h:46
Definition: ad_response_box.h:40
Definition: ad_scene.h:50
Definition: ad_scene_state.h:37
Definition: ad_sentence.h:42
Definition: coll_templ.h:371
Definition: coll_templ.h:345
Definition: base_game.h:79
Definition: base_object.h:49
Definition: base_viewport.h:37
Definition: script.h:44
Definition: script_stack.h:41
Definition: script_value.h:42
Definition: ui_window.h:39
Definition: rect.h:538