ScummVM API documentation
fixed_image.h
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 modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef CRYOMNI3D_FIXED_IMAGE_H
23#define CRYOMNI3D_FIXED_IMAGE_H
24
25#include "common/func.h"
26
27#include "cryomni3d/cryomni3d.h"
28#include "cryomni3d/objects.h"
29
30namespace Graphics {
31struct Surface;
32}
33
34namespace CryOmni3D {
35
37 uint spriteNothing;
38 uint spriteLow;
39 uint spriteHigh;
40 uint spriteLeft;
41 uint spriteRight;
42 uint spriteQuestion;
43 uint spriteListen;
44 uint spriteSee;
45 uint spriteUse;
46 uint spriteSpeak;
47
48 int16 toolbarTriggerY;
49};
50
52public:
54 enum ZonesMode {
55 kZonesMode_None = 0,
56 kZonesMode_Standard,
57 kZonesMode_Object
58 };
59
60 /* These functions are used in main engine code */
61 ZonFixedImage(CryOmni3DEngine &engine, Inventory &inventory, const Sprites &sprites,
62 const FixedImageConfiguration *configuration);
64
65 void run(const CallbackFunctor *callback);
66
67 /* This function is used to refresh image after various events */
68 void display() const;
69
70 /* These functions and attributes are used in image handler */
71 void load(const Common::Path &image, const char *zone = nullptr);
72 void manage();
73 void updateSurface(const Graphics::Surface *newSurface);
74 const Graphics::Surface *surface() const { return _imageSurface; }
75 void changeCallback(CallbackFunctor *callback) { delete _callback; _callback = callback; }
76 Common::Point getZoneCenter(uint zoneId) const;
77 void disableZone(uint zoneId) { _zones[zoneId].valid = false; }
78
79 ZonesMode _zonesMode;
80
81 /* These attributes are read by the image handler to check what action player did */
82 uint _currentZone;
83 bool _exit;
84 bool _zoneLow;
85 bool _zoneHigh;
86 bool _zoneHighLeft;
87 bool _zoneHighRight;
88 bool _zoneLeft;
89 bool _zoneRight;
90 bool _zoneQuestion;
91 bool _zoneListen;
92 bool _zoneSee;
93 bool _zoneUse;
94 bool _zoneSpeak;
95 Object *_usedObject;
97
98protected:
99 const CallbackFunctor *_callback;
100 CryOmni3DEngine &_engine;
101 Inventory &_inventory;
102 const Sprites &_sprites;
103
104 struct Zone {
105 Common::Rect rect;
106 /* ZON file stores the index in the sprite */
107 uint16 spriteId;
108 uint16 cursorId;
109 bool valid;
110 };
111
112 void loadZones(const Common::Path &image);
113 void handleMouseZones(const Common::Array<Zone>::const_iterator &currentZone);
114
115 Image::ImageDecoder *_imageDecoder;
116 const Graphics::Surface *_imageSurface;
117
118 Common::Array<Zone> _zones;
121
122 const FixedImageConfiguration *_configuration;
123
124 bool _refreshCursor;
125};
126
127} // End of namespace CryOmni3D
128
129#endif
uint size_type
Definition: array.h:62
const T * const_iterator
Definition: array.h:55
Definition: path.h:52
Definition: cryomni3d.h:80
Definition: objects.h:77
Definition: objects.h:33
Definition: sprites.h:40
Definition: fixed_image.h:51
Definition: image_decoder.h:53
Definition: cryomni3d.h:62
Definition: formatinfo.h:28
Definition: func.h:437
Definition: keyboard.h:294
Definition: rect.h:144
Definition: rect.h:536
Definition: fixed_image.h:36
Definition: fixed_image.h:104
Definition: surface.h:67