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 /*
24  * This code is based on original Tony Tough source code
25  *
26  * Copyright (c) 1997-2003 Nayma Software
27  */
28 
29 #ifndef TONY_GFXENGINE_H
30 #define TONY_GFXENGINE_H
31 
32 #include "common/scummsys.h"
33 #include "common/system.h"
34 #include "common/rect.h"
35 #include "tony/mpal/memory.h"
36 #include "tony/game.h"
37 #include "tony/gfxcore.h"
38 #include "tony/input.h"
39 #include "tony/inventory.h"
40 #include "tony/tonychar.h"
41 #include "tony/utils.h"
42 
43 namespace Tony {
44 
45 class RMGfxEngine {
46 private:
47 	RMGfxTargetBuffer _bigBuf;
48 	RMInput _input;
49 	RMPointer _point;
50 	RMLocation _loc;
51 	RMOptionScreen _opt;
52 	RMTony _tony;
53 	RMInventory _inv;
54 	RMInterface _inter;
55 	RMTextItemName _itemName;
56 
57 	bool _bOption;
58 	bool _bLocationLoaded;
59 
60 	bool _bInput;
61 	bool _bAlwaysDrawMouse;
62 
63 	int _nCurLoc;
64 	RMTonyAction _curAction;
65 	int _curActionObj;
66 
67 	int _nWipeType;
68 	uint32 _hWipeEvent;
69 	int _nWipeStep;
70 
71 	bool _bMustEnterMenu;
72 protected:
73 	static void itemIrq(uint32 dwItem, int nPattern, int nStatus);
74 	void initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
75 public:
76 	bool _bWiping;
77 	Common::Rect _rcWipeEllipse;
78 	bool _bGUIOption;
79 	bool _bGUIInterface;
80 	bool _bGUIInventory;
81 public:
82 	RMGfxEngine();
83 	virtual ~RMGfxEngine();
84 
85 	// Draw the next frame
86 	void doFrame(CORO_PARAM, bool bDrawLocation);
87 
88 	// Initializes the graphics engine
89 	void init();
90 
91 	// Closes the graphics engine
92 	void close();
93 
94 	// Warns when entering or exits the options menu
95 	void openOptionScreen(CORO_PARAM, int type);
96 
97 	// Enables or disables mouse input
98 	void enableInput();
99 	void disableInput();
100 
101 	// Enables and disables mouse draw
102 	void enableMouse();
103 	void disableMouse();
104 
105 	operator RMGfxTargetBuffer &();
106 	RMInput &getInput();
107 	RMPointer &getPointer();
108 
109 	// Link to the custom function list
110 	void initCustomDll();
111 
112 	// Link to graphic task
113 	void linkGraphicTask(RMGfxTask *task);
114 
115 	// Manage a location
116 	uint32 loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
117 	void unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result);
getCurrentLocation()118 	int getCurrentLocation() const { return _nCurLoc; }
119 
120 	// State management
121 	void saveState(const Common::String &fn, byte *curThumb, const Common::String &name);
122 	void loadState(CORO_PARAM, const Common::String &fn);
123 
124 	// Pauses sound
125 	void pauseSound(bool bPause);
126 
127 	// Wipe
128 	void initWipe(int type);
129 	void closeWipe();
130 	void waitWipeEnd(CORO_PARAM);
131 
132 	void setPerorate(bool bpal);
133 
134 	bool canLoadSave();
135 };
136 
137 } // End of namespace Tony
138 
139 #endif
140