diff options
Diffstat (limited to 'engines/cryomni3d/fixed_image.h')
-rw-r--r-- | engines/cryomni3d/fixed_image.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/engines/cryomni3d/fixed_image.h b/engines/cryomni3d/fixed_image.h new file mode 100644 index 0000000000..5690788463 --- /dev/null +++ b/engines/cryomni3d/fixed_image.h @@ -0,0 +1,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 { +class 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 |