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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef NEVERHOOD_GAMEMODULE_H
24 #define NEVERHOOD_GAMEMODULE_H
25 
26 #include "neverhood/neverhood.h"
27 #include "neverhood/module.h"
28 
29 namespace Neverhood {
30 
31 class GameModule : public Module {
32 public:
33 	GameModule(NeverhoodEngine *vm);
34 	~GameModule() override;
35 	void startup();
36 	void requestRestoreGame();
37 	void requestRestartGame(bool requestMainMenu);
38 	void redrawPrevChildObject();
39 	void checkRequests();
40 	void handleMouseMove(int16 x, int16 y);
41 	void handleMouseDown(int16 x, int16 y);
42 	void handleMouseUp(int16 x, int16 y);
43 	void handleWheelUp();
44 	void handleWheelDown();
45 	void handleSpaceKey();
46 	void handleAsciiKey(char key);
47 	void handleKeyDown(Common::KeyCode keyCode);
48 	void handleEscapeKey();
49 	void initKeySlotsPuzzle();
50 	void initMemoryPuzzle();
51 	void initWaterPipesPuzzle();
52 	void initRadioPuzzle();
53 	void initTestTubes1Puzzle();
54 	void initTestTubes2Puzzle();
55 	void initCannonSymbolsPuzzle();
56 	void initCodeSymbolsPuzzle();
57 	void initCubeSymbolsPuzzle();
58 	void initCrystalColorsPuzzle();
59 	uint32 getCurrRadioMusicFileHash();
getCurrentModuleNum()60 	int getCurrentModuleNum() { return _moduleNum; }
getPreviousModuleNum()61 	int getPreviousModuleNum() { return _moduleNum; }
62 
63 	void createModule(int moduleNum, int which);
64 protected:
65 	int _moduleNum;
66 	Entity *_prevChildObject;
67 	int _prevModuleNum;
68 	bool _restoreGameRequested;
69 	bool _restartGameRequested;
70 	bool _canRequestMainMenu;
71 	bool _mainMenuRequested;
72 	uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
73 	void createModuleByHash(uint32 nameHash);
74 	void updateModule();
75 	void openMainMenu();
76 	void createMenuModule();
77 	void updateMenuModule();
78 };
79 
80 class NonRepeatingRandomNumbers : public Common::Array<int> {
81 public:
82 	NonRepeatingRandomNumbers(Common::RandomSource *rnd, int count);
83 	int getNumber();
84 	void removeNumber(int number);
85 protected:
86 	Common::RandomSource *_rnd;
87 };
88 
89 } // End of namespace Neverhood
90 
91 #endif /* NEVERHOOD_MODULE_H */
92