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.
|
|
|
|
*
|
2021-12-26 18:47:58 +01:00
|
|
|
* 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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-12-17 18:27:47 +01:00
|
|
|
*
|
2014-08-01 21:32:05 -04:00
|
|
|
* 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.
|
2014-12-17 18:27:47 +01:00
|
|
|
*
|
2014-08-01 21:32:05 -04:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-08-01 21:32:05 -04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
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"
|
2016-05-26 21:21:03 -04:00
|
|
|
#include "graphics/screen.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
|
|
|
|
2016-05-26 21:21:03 -04:00
|
|
|
/**
|
|
|
|
* Base Access surface class. This derivces from Graphics::Screen
|
|
|
|
* because it has logic we'll need for our own Screen class that
|
|
|
|
* derives from this one
|
|
|
|
*/
|
|
|
|
class BaseSurface : virtual public Graphics::Screen {
|
2014-08-16 20:26:17 -04:00
|
|
|
private:
|
|
|
|
Graphics::Surface _savedBlock;
|
2014-08-18 20:15:43 -04:00
|
|
|
|
2016-05-26 21:21:03 -04:00
|
|
|
void flipHorizontal(BaseSurface &dest);
|
2014-12-13 21:25:46 -05:00
|
|
|
protected:
|
|
|
|
Common::Rect _savedBounds;
|
2014-08-10 11:47:15 -04:00
|
|
|
public:
|
2014-12-18 21:45:55 -05:00
|
|
|
int _leftSkip, _rightSkip;
|
|
|
|
int _topSkip, _bottomSkip;
|
|
|
|
int _lastBoundsX, _lastBoundsY;
|
|
|
|
int _lastBoundsW, _lastBoundsH;
|
|
|
|
int _orgX1, _orgY1;
|
|
|
|
int _orgX2, _orgY2;
|
|
|
|
int _lColor;
|
2014-08-10 15:50:22 -04:00
|
|
|
|
2014-08-25 00:18:32 -04:00
|
|
|
Common::Point _printOrg;
|
|
|
|
Common::Point _printStart;
|
2014-08-25 23:34:40 +02:00
|
|
|
int _maxChars;
|
2014-08-01 21:32:05 -04:00
|
|
|
public:
|
2014-12-18 21:45:55 -05:00
|
|
|
static int _clipWidth, _clipHeight;
|
|
|
|
public:
|
2016-05-26 21:21:03 -04:00
|
|
|
BaseSurface();
|
2014-12-18 21:45:55 -05:00
|
|
|
|
2020-02-09 12:05:26 +01:00
|
|
|
~BaseSurface() override;
|
2014-08-13 22:45:15 -04:00
|
|
|
|
2014-08-04 21:35:49 -04:00
|
|
|
void clearBuffer();
|
2014-08-06 22:43:40 -04:00
|
|
|
|
2014-08-10 11:47:15 -04:00
|
|
|
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
|
|
|
/**
|
2014-08-21 22:15:00 -04:00
|
|
|
* Scaled draw frame in forward orientation
|
2014-08-18 20:15:43 -04:00
|
|
|
*/
|
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
|
|
|
/**
|
2014-08-21 22:15:00 -04:00
|
|
|
* Scaled draw frame in backwards orientation
|
2014-08-18 20:15:43 -04:00
|
|
|
*/
|
|
|
|
void sPlotB(SpriteFrame *frame, const Common::Rect &bounds);
|
|
|
|
|
2014-08-21 22:15:00 -04:00
|
|
|
/**
|
|
|
|
* Draw an image full-size in forward orientation
|
|
|
|
*/
|
|
|
|
void plotF(SpriteFrame *frame, const Common::Point &pt);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw an image full-size in backwards orientation
|
|
|
|
*/
|
2014-08-11 23:12:53 -04:00
|
|
|
void plotB(SpriteFrame *frame, const Common::Point &pt);
|
|
|
|
|
2016-05-26 21:21:03 -04:00
|
|
|
virtual void copyBlock(BaseSurface *src, const Common::Rect &bounds);
|
2014-08-12 08:38:12 -04:00
|
|
|
|
2014-12-13 21:25:46 -05:00
|
|
|
virtual void restoreBlock();
|
|
|
|
|
2014-12-13 22:06:58 -05:00
|
|
|
virtual void drawRect();
|
|
|
|
|
2015-01-13 00:46:45 +01:00
|
|
|
virtual void drawLine(int x1, int y1, int x2, int y2, int col);
|
|
|
|
|
2015-01-15 08:23:55 +01:00
|
|
|
virtual void drawLine();
|
|
|
|
|
2015-01-13 00:46:45 +01:00
|
|
|
virtual void drawBox();
|
2014-12-13 22:33:23 -05:00
|
|
|
|
2016-03-10 21:51:06 -05:00
|
|
|
virtual void copyBuffer(Graphics::ManagedSurface *src);
|
2014-12-14 15:22:09 -05:00
|
|
|
|
2016-05-26 21:21:03 -04:00
|
|
|
void copyTo(BaseSurface *dest);
|
2014-12-14 11:56:42 -05:00
|
|
|
|
2014-08-16 20:26:17 -04:00
|
|
|
void saveBlock(const Common::Rect &bounds);
|
|
|
|
|
2014-08-23 17:19:54 -04:00
|
|
|
void moveBufferLeft();
|
|
|
|
|
|
|
|
void moveBufferRight();
|
|
|
|
|
|
|
|
void moveBufferUp();
|
|
|
|
|
|
|
|
void moveBufferDown();
|
2016-03-10 21:51:06 -05:00
|
|
|
|
|
|
|
bool clip(Common::Rect &r);
|
2014-08-01 21:32:05 -04:00
|
|
|
};
|
|
|
|
|
2016-05-26 21:21:03 -04:00
|
|
|
class ASurface : public BaseSurface {
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Override the addDirtyRect from Graphics::Screen, since for standard
|
|
|
|
* surfaces we don't need dirty rects to be tracked
|
|
|
|
*/
|
2020-02-09 12:05:26 +01:00
|
|
|
void addDirtyRect(const Common::Rect &r) override {}
|
2016-05-26 21:21:03 -04:00
|
|
|
public:
|
|
|
|
ASurface() : BaseSurface() {}
|
|
|
|
};
|
|
|
|
|
2014-08-10 19:19:32 -04:00
|
|
|
class SpriteFrame : public ASurface {
|
|
|
|
public:
|
2014-08-27 22:13:43 -04:00
|
|
|
SpriteFrame(AccessEngine *vm, Common::SeekableReadStream *stream, int frameSize);
|
2020-02-09 12:05:26 +01:00
|
|
|
~SpriteFrame() override;
|
2014-08-10 19:19:32 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class SpriteResource {
|
|
|
|
public:
|
|
|
|
Common::Array<SpriteFrame *> _frames;
|
|
|
|
public:
|
2014-08-27 22:13:43 -04:00
|
|
|
SpriteResource(AccessEngine *vm, Resource *res);
|
2014-08-10 19:19:32 -04:00
|
|
|
~SpriteResource();
|
|
|
|
|
|
|
|
int getCount() { return _frames.size(); }
|
|
|
|
|
|
|
|
SpriteFrame *getFrame(int idx) { return _frames[idx]; }
|
|
|
|
};
|
|
|
|
|
2014-12-17 23:21:13 +01:00
|
|
|
enum ImageFlag {
|
|
|
|
IMGFLAG_CROPPED = 1,
|
|
|
|
IMGFLAG_BACKWARDS = 2,
|
|
|
|
IMGFLAG_DRAWN = 4,
|
|
|
|
IMGFLAG_UNSCALED = 8
|
|
|
|
};
|
2014-11-22 22:17:39 -05:00
|
|
|
|
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:
|
2014-11-10 12:25:13 -05:00
|
|
|
void addToList(ImageEntry &ie);
|
2014-08-14 22:02:47 -04:00
|
|
|
};
|
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 */
|