2014-08-01 21:32:05 -04:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-08-04 21:35:49 -04:00
|
|
|
#ifndef ACCESS_ASURFACE_H
|
|
|
|
#define ACCESS_ASURFACE_H
|
2014-08-01 21:32:05 -04:00
|
|
|
|
2014-08-07 09:23:31 -04:00
|
|
|
#include "common/scummsys.h"
|
2014-08-10 11:47:15 -04:00
|
|
|
#include "common/array.h"
|
2014-08-10 16:55:06 -04:00
|
|
|
#include "common/memstream.h"
|
2014-08-01 21:32:05 -04:00
|
|
|
#include "common/rect.h"
|
|
|
|
#include "graphics/surface.h"
|
2014-08-10 11:47:15 -04:00
|
|
|
#include "access/data.h"
|
2014-08-01 21:32:05 -04:00
|
|
|
|
|
|
|
namespace Access {
|
|
|
|
|
2014-08-10 19:19:32 -04:00
|
|
|
class SpriteResource;
|
|
|
|
class SpriteFrame;
|
2014-08-10 16:55:06 -04:00
|
|
|
|
2014-08-04 21:35:49 -04:00
|
|
|
class ASurface : public Graphics::Surface {
|
2014-08-16 20:26:17 -04:00
|
|
|
private:
|
|
|
|
Graphics::Surface _savedBlock;
|
|
|
|
Common::Rect _savedBounds;
|
2014-08-18 20:15:43 -04:00
|
|
|
|
|
|
|
void flipHorizontal(ASurface &dest);
|
2014-08-10 11:47:15 -04:00
|
|
|
public:
|
|
|
|
static int _leftSkip, _rightSkip;
|
|
|
|
static int _topSkip, _bottomSkip;
|
|
|
|
static int _clipWidth, _clipHeight;
|
|
|
|
static int _lastBoundsX, _lastBoundsY;
|
|
|
|
static int _lastBoundsW, _lastBoundsH;
|
2014-08-10 15:50:22 -04:00
|
|
|
static int _scrollX, _scrollY;
|
2014-08-17 18:56:05 -04:00
|
|
|
static int _orgX1, _orgY1;
|
|
|
|
static int _orgX2, _orgY2;
|
|
|
|
static int _lColor;
|
2014-08-10 15:50:22 -04:00
|
|
|
|
|
|
|
static void init();
|
2014-08-17 18:56:05 -04:00
|
|
|
public:
|
|
|
|
virtual void plotFrame(SpriteFrame *frame, const Common::Point &pt);
|
2014-08-01 21:32:05 -04:00
|
|
|
public:
|
2014-08-13 22:45:15 -04:00
|
|
|
virtual ~ASurface();
|
|
|
|
|
2014-08-18 20:15:43 -04:00
|
|
|
void create(uint16 width, uint16 height);
|
|
|
|
|
2014-08-04 21:35:49 -04:00
|
|
|
void clearBuffer();
|
2014-08-06 22:43:40 -04:00
|
|
|
|
|
|
|
void copyBuffer(Graphics::Surface *src) { copyFrom(*src); }
|
2014-08-10 11:47:15 -04:00
|
|
|
|
|
|
|
bool clip(Common::Rect &r);
|
|
|
|
|
|
|
|
void plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt);
|
2014-08-10 19:19:32 -04:00
|
|
|
|
2014-08-18 20:15:43 -04:00
|
|
|
/**
|
|
|
|
* Scaled draw frame
|
|
|
|
*/
|
2014-08-16 15:47:25 -04:00
|
|
|
void sPlotF(SpriteFrame *frame, const Common::Rect &bounds);
|
2014-08-11 23:12:53 -04:00
|
|
|
|
2014-08-18 20:15:43 -04:00
|
|
|
/**
|
|
|
|
* Scaled flipped horizontal draw frame
|
|
|
|
*/
|
|
|
|
void sPlotB(SpriteFrame *frame, const Common::Rect &bounds);
|
|
|
|
|
2014-08-11 23:12:53 -04:00
|
|
|
void plotB(SpriteFrame *frame, const Common::Point &pt);
|
|
|
|
|
2014-08-12 08:38:12 -04:00
|
|
|
void copyBlock(ASurface *src, const Common::Rect &bounds);
|
|
|
|
|
2014-08-10 19:19:32 -04:00
|
|
|
void copyTo(ASurface *dest, const Common::Point &destPos);
|
2014-08-16 15:47:25 -04:00
|
|
|
|
|
|
|
void copyTo(ASurface *dest, const Common::Rect &bounds);
|
2014-08-16 20:26:17 -04:00
|
|
|
|
|
|
|
void saveBlock(const Common::Rect &bounds);
|
|
|
|
|
|
|
|
void restoreBlock();
|
|
|
|
|
2014-08-17 18:56:05 -04:00
|
|
|
void drawRect();
|
2014-08-01 21:32:05 -04:00
|
|
|
};
|
|
|
|
|
2014-08-10 19:19:32 -04:00
|
|
|
class SpriteFrame : public ASurface {
|
|
|
|
public:
|
|
|
|
SpriteFrame(AccessEngine *vm, Common::MemoryReadStream &stream, int frameSize);
|
|
|
|
~SpriteFrame();
|
|
|
|
};
|
|
|
|
|
|
|
|
class SpriteResource {
|
|
|
|
public:
|
|
|
|
Common::Array<SpriteFrame *> _frames;
|
|
|
|
public:
|
|
|
|
SpriteResource(AccessEngine *vm, const byte *data, uint32 size,
|
|
|
|
DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO);
|
|
|
|
~SpriteResource();
|
|
|
|
|
|
|
|
int getCount() { return _frames.size(); }
|
|
|
|
|
|
|
|
SpriteFrame *getFrame(int idx) { return _frames[idx]; }
|
|
|
|
};
|
|
|
|
|
2014-08-14 22:02:47 -04:00
|
|
|
class ImageEntry {
|
|
|
|
public:
|
|
|
|
int _frameNumber;
|
|
|
|
SpriteResource *_spritesPtr;
|
2014-08-19 20:31:23 -04:00
|
|
|
int _offsetY;
|
2014-08-14 22:02:47 -04:00
|
|
|
Common::Point _position;
|
|
|
|
int _flags;
|
2014-08-16 15:47:25 -04:00
|
|
|
public:
|
|
|
|
ImageEntry();
|
2014-08-14 22:02:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class ImageEntryList : public Common::Array<ImageEntry> {
|
|
|
|
public:
|
|
|
|
void addToList(ImageEntry *ie);
|
|
|
|
};
|
2014-08-10 19:19:32 -04:00
|
|
|
|
2014-08-01 21:32:05 -04:00
|
|
|
} // End of namespace Access
|
|
|
|
|
2014-08-04 21:35:49 -04:00
|
|
|
#endif /* ACCESS_ASURFACE_H */
|