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 
30 namespace Graphics {
31 struct Surface;
32 }
33 
34 namespace 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 
52 public:
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);
63  ~ZonFixedImage();
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;
96  Common::KeyState _key;
97 
98 protected:
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;
119  Common::Array<Zone>::size_type _highLeftId;
120  Common::Array<Zone>::size_type _highRightId;
121 
122  const FixedImageConfiguration *_configuration;
123 
124  bool _refreshCursor;
125 };
126 
127 } // End of namespace CryOmni3D
128 
129 #endif
Definition: fixed_image.h:36
Definition: image_decoder.h:52
Definition: cryomni3d.h:62
Definition: surface.h:66
Definition: objects.h:77
Definition: rect.h:144
Definition: path.h:52
Definition: objects.h:33
const T * const_iterator
Definition: array.h:55
Definition: cryomni3d.h:80
Definition: formatinfo.h:28
Definition: fixed_image.h:104
Definition: rect.h:45
Definition: func.h:437
Definition: sprites.h:40
Definition: fixed_image.h:51
Definition: keyboard.h:294
uint size_type
Definition: array.h:59