2009-10-03 20:49:18 +00: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.
|
2014-02-18 02:34:24 +01:00
|
|
|
*
|
2009-10-03 20:49:18 +00: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-02-18 02:34:24 +01:00
|
|
|
*
|
2009-10-03 20:49:18 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
#ifndef SCI_GRAPHICS_VIEW_H
|
|
|
|
#define SCI_GRAPHICS_VIEW_H
|
2009-10-04 20:01:21 +00:00
|
|
|
|
2016-12-31 20:39:57 -06:00
|
|
|
#include "sci/util.h"
|
|
|
|
|
2009-10-03 20:49:18 +00:00
|
|
|
namespace Sci {
|
|
|
|
|
2011-03-30 21:26:48 +02:00
|
|
|
enum Sci32ViewNativeResolution {
|
|
|
|
SCI_VIEW_NATIVERES_NONE = -1,
|
|
|
|
SCI_VIEW_NATIVERES_320x200 = 0,
|
|
|
|
SCI_VIEW_NATIVERES_640x480 = 1,
|
|
|
|
SCI_VIEW_NATIVERES_640x400 = 2
|
|
|
|
};
|
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
struct CelInfo {
|
2009-10-03 20:49:18 +00:00
|
|
|
int16 width, height;
|
2010-07-24 15:15:38 +00:00
|
|
|
int16 scriptWidth, scriptHeight;
|
2010-01-11 20:31:12 +00:00
|
|
|
int16 displaceX;
|
|
|
|
int16 displaceY;
|
2009-10-03 20:49:18 +00:00
|
|
|
byte clearKey;
|
2009-10-04 21:57:31 +00:00
|
|
|
uint16 offsetEGA;
|
2010-01-29 00:03:10 +00:00
|
|
|
uint32 offsetRLE;
|
|
|
|
uint32 offsetLiteral;
|
2016-12-31 20:39:57 -06:00
|
|
|
Common::SpanOwner<SciSpan<const byte> > rawBitmap;
|
2009-10-03 20:49:18 +00:00
|
|
|
};
|
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
struct LoopInfo {
|
2009-10-03 20:49:18 +00:00
|
|
|
bool mirrorFlag;
|
2016-12-31 20:39:57 -06:00
|
|
|
Common::Array<CelInfo> cel;
|
2009-10-03 20:49:18 +00:00
|
|
|
};
|
|
|
|
|
2016-12-31 20:39:57 -06:00
|
|
|
enum {
|
|
|
|
SCI_VIEW_EGAMAPPING_SIZE = 16,
|
|
|
|
SCI_VIEW_EGAMAPPING_COUNT = 8
|
|
|
|
};
|
2009-10-25 20:46:14 +00:00
|
|
|
|
2010-02-04 22:17:58 +00:00
|
|
|
class GfxScreen;
|
|
|
|
class GfxPalette;
|
2016-06-25 14:19:47 -05:00
|
|
|
class Resource;
|
2010-01-31 12:35:15 +00:00
|
|
|
|
2010-02-05 15:48:45 +00:00
|
|
|
/**
|
|
|
|
* View class, handles loading of view resources and drawing contained cels to screen
|
|
|
|
* every view resource has its own instance of this class
|
|
|
|
*/
|
2010-02-04 22:17:58 +00:00
|
|
|
class GfxView {
|
2009-10-03 20:49:18 +00:00
|
|
|
public:
|
2010-02-04 22:17:58 +00:00
|
|
|
GfxView(ResourceManager *resMan, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId);
|
|
|
|
~GfxView();
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2010-06-28 11:20:14 +00:00
|
|
|
GuiResourceId getResourceId() const;
|
|
|
|
int16 getWidth(int16 loopNo, int16 celNo) const;
|
|
|
|
int16 getHeight(int16 loopNo, int16 celNo) const;
|
|
|
|
const CelInfo *getCelInfo(int16 loopNo, int16 celNo) const;
|
|
|
|
void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
|
2010-10-26 20:19:17 +00:00
|
|
|
void getCelSpecialHoyle4Rect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
|
2010-06-28 11:20:14 +00:00
|
|
|
void getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect &outRect) const;
|
2016-12-31 20:39:57 -06:00
|
|
|
const SciSpan<const byte> &getBitmap(int16 loopNo, int16 celNo);
|
2010-06-28 11:20:14 +00:00
|
|
|
void draw(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires);
|
|
|
|
void drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY);
|
2016-12-02 22:30:01 -06:00
|
|
|
uint16 getLoopCount() const { return _loop.size(); }
|
2010-06-28 11:20:14 +00:00
|
|
|
uint16 getCelCount(int16 loopNo) const;
|
2010-01-05 01:37:57 +00:00
|
|
|
Palette *getPalette();
|
2009-10-06 14:37:25 +00:00
|
|
|
|
2010-08-02 21:04:09 +00:00
|
|
|
bool isScaleable();
|
2010-06-30 14:26:47 +00:00
|
|
|
bool isSci2Hires();
|
|
|
|
|
2011-03-30 21:26:48 +02:00
|
|
|
void adjustToUpscaledCoordinates(int16 &y, int16 &x);
|
|
|
|
void adjustBackUpscaledCoordinates(int16 &y, int16 &x);
|
|
|
|
|
2009-10-03 20:49:18 +00:00
|
|
|
private:
|
2009-10-05 07:10:01 +00:00
|
|
|
void initData(GuiResourceId resourceId);
|
2016-12-31 20:39:57 -06:00
|
|
|
void unpackCel(int16 loopNo, int16 celNo, SciSpan<byte> &outPtr);
|
|
|
|
void unditherBitmap(SciSpan<byte> &bitmap, int16 width, int16 height, byte clearKey);
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2009-10-06 12:33:36 +00:00
|
|
|
ResourceManager *_resMan;
|
2016-08-14 16:28:37 -05:00
|
|
|
GfxCoordAdjuster16 *_coordAdjuster;
|
2010-01-31 16:21:11 +00:00
|
|
|
GfxScreen *_screen;
|
|
|
|
GfxPalette *_palette;
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2009-10-05 07:10:01 +00:00
|
|
|
GuiResourceId _resourceId;
|
2009-10-09 12:10:17 +00:00
|
|
|
Resource *_resource;
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2016-12-31 20:39:57 -06:00
|
|
|
Common::Array<LoopInfo> _loop;
|
2009-10-03 20:49:18 +00:00
|
|
|
bool _embeddedPal;
|
2010-01-05 01:37:57 +00:00
|
|
|
Palette _viewPalette;
|
2009-10-24 19:29:06 +00:00
|
|
|
|
2011-03-30 21:26:48 +02:00
|
|
|
// specifies scaling resolution for SCI2 views (see gk1/windows, Wolfgang in room 720)
|
|
|
|
Sci32ViewNativeResolution _sci2ScaleRes;
|
2010-06-30 14:26:47 +00:00
|
|
|
|
2016-12-31 20:39:57 -06:00
|
|
|
SciSpan<const byte> _EGAmapping;
|
2010-07-31 13:13:46 +00:00
|
|
|
|
|
|
|
// this is set for sci0early to adjust for the getCelRect() change
|
2010-08-02 21:04:09 +00:00
|
|
|
int16 _adjustForSci0Early;
|
|
|
|
|
|
|
|
// this is not set for some views in laura bow 2 floppy and signals that the view shall never get scaled
|
|
|
|
// even if scaleX/Y are set (inside kAnimate)
|
|
|
|
bool _isScaleable;
|
2009-10-03 20:49:18 +00:00
|
|
|
};
|
|
|
|
|
2009-10-04 21:26:33 +00:00
|
|
|
} // End of namespace Sci
|
2009-10-04 20:01:21 +00:00
|
|
|
|
|
|
|
#endif
|