ScummVM API documentation
master_win.h
1
2/* ScummVM - Graphic Adventure Engine
3 *
4 * ScummVM is the legal property of its developers, whose names
5 * are too numerous to list here. Please refer to the COPYRIGHT
6 * file distributed with this source distribution.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef BAGEL_BAGLIB_MASTER_WIN_H
24#define BAGEL_BAGLIB_MASTER_WIN_H
25
26#include "bagel/spacebar/boflib/gfx/text.h"
27#include "bagel/spacebar/baglib/cursor.h"
28#include "bagel/boflib/string.h"
29#include "bagel/spacebar/baglib/bagel.h"
30#include "bagel/spacebar/boflib/gui/window.h"
31#include "bagel/boflib/sound.h"
32#include "bagel/spacebar/baglib/object.h"
33#include "bagel/spacebar/baglib/save_game_file.h"
34#include "bagel/spacebar/baglib/var.h"
35
36namespace Bagel {
37namespace SpaceBar {
38
39#define g_SDevManager CBagel::getBagApp()->getMasterWnd()->getStorageDevManager()
40#define g_VarManager CBagel::getBagApp()->getMasterWnd()->getVariableManager()
41
42class CBagStorageDevManager;
43class CBagStorageDevWnd;
44class CBagStorageDev;
45
46enum SpaceBarEventType {
47 WM_ENTER_PAN_WINDOW = 1001,
48 WM_ENTER_CLOSE_UP_WINDOW = 1002,
49 WM_EXIT_CLOSE_UP_WINDOW = 1003,
50 WM_ENTER_NEW_WLD = 1004,
51 WM_DIE = 1005,
52 WM_SHOW_SYSTEM_DLG = 1006
53};
54
55#define MAX_CURSORS 60
56
57// Some utility routines
58void setCICStatus(CBagStorageDev *sdev);
59bool getCICStatus();
60
68protected:
69 static bool _objSaveFl;
70 static StObj *_objList;
71 static CBagCursor *_cursorList[MAX_CURSORS];
72
73 CBagStorageDevWnd *_gameWindow;
74
75 CBofString _wldScript;
76 CBofString _startWld;
77 CBofString _cdChangeAudio;
78 CBofString _sysScreen;
79
80 uint16 _diskId;
81 int _fadeIn;
82 CBofList<CBagStorageDev *> *_gameSDevList;
83 CBagStorageDevManager *_storageDeviceList;
84 CBagVarManager *_variableList; // List of variables used throughout wld
85 CBofSound *_waitSound;
86 static int _curCursor;
87
88public:
89 static int _menuCount;
90
92 virtual ~CBagMasterWin();
93 virtual ErrorCode Run();
94
95 ErrorCode close() override;
96
97 CBofString &getWldScript() {
98 return _wldScript;
99 }
100
101 static void setActiveCursor(int cursorId);
102 static int getActiveCursor() {
103 return _curCursor;
104 }
105
106 // User options
107 static bool getFlyThru();
108
109 static bool getPanimations();
110 static void setPanimations(bool panimsFl);
111
112 static int getCorrection();
113 static void setCorrection(int correction);
114
115 static int getPanSpeed();
116 static void setPanSpeed(int speed);
117
118 static int getMidiVolume();
119 static void setMidiVolume(int vol);
120
121 static int getWaveVolume();
122 static void setWaveVolume(int vol);
123
124 static bool getMidi() {
125 return getMidiVolume() != 0;
126 }
127 static bool getDigitalAudio() {
128 return getWaveVolume() != 0;
129 }
130
131 static void muteToggle();
132 static void forcePaintScreen();
133
134 virtual ErrorCode showSystemDialog(bool saveFl = true);
135 bool showRestartDialog(CBofWindow *win = nullptr, bool saveFl = true);
136 bool showSaveDialog(CBofWindow *win, bool saveFl = true);
137 bool showRestoreDialog(CBofWindow *win, bool saveFl = true);
138 bool showQuitDialog(CBofWindow *win, bool saveFl = true);
139 ErrorCode showCreditsDialog(CBofWindow *win, bool saveFl = true);
140
141 void fillSaveBuffer(StBagelSave *saveBuf);
142 void doRestore(StBagelSave *saveBuf);
143
144 ErrorCode newGame();
145
146 ErrorCode loadFile(const CBofString &wldName, const CBofString &startWldName, bool restartFl = false, bool setStartFl = true);
147
148 ErrorCode loadFileFromStream(CBagIfstream &input, const CBofString &wldName);
149 ErrorCode loadGlobalVars(const CBofString &wldName);
150
151 ErrorCode setCurrfadeIn(int fade) {
152 _fadeIn = fade;
153 return ERR_NONE;
154 }
155 ErrorCode setStorageDev(const CBofString &wldName, bool entry = true);
156 ErrorCode gotoNewWindow(const CBofString *str);
157
158 uint16 getDiskID() const {
159 return _diskId;
160 }
161 void setDiskID(uint16 id) {
162 _diskId = id;
163 }
164
165 CBofWindow *getCurrentGameWindow() const {
166 return (CBofWindow *)_gameWindow;
167 }
168 CBagStorageDevWnd *getCurrentStorageDev() const {
169 return _gameWindow;
170 }
171 CBagStorageDevManager *getStorageDevManager() const {
172 return _storageDeviceList;
173 }
174 CBagVarManager *getVariableManager() const {
175 return _variableList;
176 }
177
178 virtual CBagStorageDev *onNewStorageDev(const CBofString &typestr) = 0;
179 virtual CBagStorageDev *onNewStorageDev(int type) = 0;
180
181 virtual void onNewFilter(CBagStorageDev *, const CBofString &typeStr) = 0;
182 virtual void onNewFilter(CBagStorageDev *sdev, int type) = 0;
183
184 virtual ErrorCode onHelp(const CBofString &helpFile, bool saveBkgFl = true, CBofWindow *parent = nullptr);
185
186 void onUserMessage(uint32 message, uint32 param) override;
187
188 void onKeyHit(uint32 keyCode, uint32 repCount) override;
189 void onClose() override;
190
191 StObj *getObjList() {
192 return _objList;
193 }
194 void setSaveObjs(bool saveFl) {
195 _objSaveFl = saveFl;
196 }
197 bool isObjSave() {
198 return _objSaveFl;
199 }
200
201 void saveSDevStack();
202
203 // Since we do this from load file and do restore, centralize it in one location.
204 void restoreActiveMessages(CBagStorageDevManager *sdevManager);
205};
206
207ErrorCode waitForInput();
208
209extern bool g_waitOKFl;
210
211} // namespace SpaceBar
212} // namespace Bagel
213
214#endif
Definition: sound.h:77
Definition: string.h:38
Definition: cursor.h:34
Definition: ifstream.h:32
Definition: master_win.h:67
Definition: parse_object.h:48
Definition: storage_dev_win.h:79
Definition: storage_dev_win.h:547
Definition: storage_dev_win.h:410
Definition: var.h:133
Definition: list.h:60
Definition: window.h:53
Definition: save_game_file.h:104
Definition: save_game_file.h:77