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
|
/* 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.
*
*/
#ifndef CRYOMNI3D_FIXED_IMAGE_H
#define CRYOMNI3D_FIXED_IMAGE_H
#include "common/func.h"
#include "engines/cryomni3d/cryomni3d.h"
#include "engines/cryomni3d/objects.h"
namespace Graphics {
struct Surface;
}
namespace CryOmni3D {
struct FixedImageConfiguration {
unsigned int spriteNothing;
unsigned int spriteLow;
unsigned int spriteHigh;
unsigned int spriteLeft;
unsigned int spriteRight;
unsigned int spriteQuestion;
unsigned int spriteListen;
unsigned int spriteSee;
unsigned int spriteUse;
unsigned int spriteSpeak;
int16 toolbarTriggerY;
};
class ZonFixedImage {
public:
typedef Common::Functor1<ZonFixedImage *, void> CallbackFunctor;
enum ZonesMode {
kZonesMode_None = 0,
kZonesMode_Standard,
kZonesMode_Object
};
/* These functions are used in main engine code */
ZonFixedImage(CryOmni3DEngine &engine, Inventory &inventory, const Sprites &sprites,
const FixedImageConfiguration *configuration);
~ZonFixedImage();
void run(const CallbackFunctor *callback);
/* THis function is used to refresh image after various events */
void display() const;
/* These functions and attributes are used in image handler */
void load(const Common::String &image);
void manage();
const Graphics::Surface *surface() const { return _imageSurface; }
void changeCallback(CallbackFunctor *callback) { delete _callback; _callback = callback; }
Common::Point getZoneCenter(unsigned int zoneId) const;
ZonesMode _zonesMode;
/* These attributes are read by the image handler to check what action player did */
unsigned int _currentZone;
bool _exit;
bool _zoneLow;
bool _zoneHigh;
bool _zoneHighLeft;
bool _zoneHighRight;
bool _zoneLeft;
bool _zoneRight;
bool _zoneQuestion;
bool _zoneListen;
bool _zoneSee;
bool _zoneUse;
bool _zoneSpeak;
Object *_usedObject;
Common::KeyState _key;
protected:
const Common::Functor1<ZonFixedImage *, void> *_callback;
CryOmni3DEngine &_engine;
Inventory &_inventory;
const Sprites &_sprites;
struct Zone {
Common::Rect rect;
/* ZON file stores the index in the sprite */
uint16 spriteId;
uint16 cursorId;
bool valid;
};
void loadZones(const Common::String &image);
void handleMouseZones(const Common::Array<Zone>::const_iterator ¤tZone);
Image::ImageDecoder *_imageDecoder;
const Graphics::Surface *_imageSurface;
Common::Array<Zone> _zones;
Common::Array<Zone>::size_type _highLeftId;
Common::Array<Zone>::size_type _highRightId;
const FixedImageConfiguration *_configuration;
bool _refreshCursor;
};
} // End of namespace CryOmni3D
#endif
|