aboutsummaryrefslogtreecommitdiff
path: root/engines/tony/gfxengine.h
blob: 927593a5d3db577638bcc1b3e90ff08dac502238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

/*
 * This code is based on original Tony Tough source code
 *
 * Copyright (c) 1997-2003 Nayma Software
 */

#ifndef TONY_GFXENGINE_H
#define TONY_GFXENGINE_H

#include "common/scummsys.h"
#include "common/system.h"
#include "common/rect.h"
#include "tony/mpal/memory.h"
#include "tony/game.h"
#include "tony/gfxcore.h"
#include "tony/input.h"
#include "tony/inventory.h"
#include "tony/tonychar.h"
#include "tony/utils.h"

namespace Tony {

class RMGfxEngine {
private:
	RMGfxTargetBuffer _bigBuf;
	RMInput _input;
	RMPointer _point;
	RMLocation _loc;
	RMOptionScreen _opt;
	RMTony _tony;
	RMInventory _inv;
	RMInterface _inter;
	RMTextItemName _itemName;

	bool _bOption;
	bool _bLocationLoaded;

	bool _bInput;
	bool _bAlwaysDrawMouse;

	int _nCurLoc;
	RMTonyAction _curAction;
	int _curActionObj;

	int _nWipeType;
	uint32 _hWipeEvent;
	int _nWipeStep;

	bool _bMustEnterMenu;
protected:
	static void itemIrq(uint32 dwItem, int nPattern, int nStatus);
	void initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
public:
	bool _bWiping;
	Common::Rect _rcWipeEllipse;
	bool _bGUIOption;
	bool _bGUIInterface;
	bool _bGUIInventory;
public:
	RMGfxEngine();
	virtual ~RMGfxEngine();

	// Draw the next frame
	void doFrame(CORO_PARAM, bool bDrawLocation);

	// Initializes the graphics engine
	void init();

	// Closes the graphics engine
	void close();

	// Warns when entering or exits the options menu
	void openOptionScreen(CORO_PARAM, int type);

	// Enables or disables mouse input
	void enableInput();
	void disableInput();

	// Enables and disables mouse draw
	void enableMouse();
	void disableMouse();

	operator RMGfxTargetBuffer &();
	RMInput &getInput();
	RMPointer &getPointer();

	// Link to the custom function list
	void initCustomDll();

	// Link to graphic task
	void linkGraphicTask(RMGfxTask *task);

	// Manage a location
	uint32 loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
	void unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result);
	int getCurrentLocation() const { return _nCurLoc; }

	// State management
	void saveState(const Common::String &fn, byte *curThumb, const Common::String &name);
	void loadState(CORO_PARAM, const Common::String &fn);

	// Pauses sound
	void pauseSound(bool bPause);

	// Wipe
	void initWipe(int type);
	void closeWipe();
	void waitWipeEnd(CORO_PARAM);

	void setPerorate(bool bpal);

	bool canLoadSave();
};

} // End of namespace Tony

#endif