2007-05-30 21:56:52 +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.
|
2005-04-05 18:08:02 +00: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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:34:20 +00:00
|
|
|
*
|
2005-04-05 18:08:02 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2005-04-05 18:08:02 +00:00
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:20 +00:00
|
|
|
*
|
2005-04-05 18:08:02 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2005-04-09 19:19:54 +00:00
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-04-05 18:08:02 +00:00
|
|
|
*
|
|
|
|
*/
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2005-04-05 18:08:02 +00:00
|
|
|
#ifndef GOB_VIDEO_H
|
|
|
|
#define GOB_VIDEO_H
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
#include "common/list.h"
|
|
|
|
#include "common/rect.h"
|
2009-06-06 20:03:13 +00:00
|
|
|
#include "common/ptr.h"
|
2008-12-04 18:38:55 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
#include "gob/gob.h"
|
2010-09-30 13:02:16 +00:00
|
|
|
#include "gob/surface.h"
|
2005-06-14 20:04:26 +00:00
|
|
|
|
|
|
|
namespace Gob {
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
class Font {
|
|
|
|
public:
|
2010-09-30 13:02:16 +00:00
|
|
|
Font(const byte *data);
|
|
|
|
~Font();
|
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
uint8 getCharWidth (uint8 c) const;
|
|
|
|
uint8 getCharWidth () const;
|
|
|
|
uint8 getCharHeight() const;
|
|
|
|
|
2012-07-07 16:45:15 +00:00
|
|
|
bool hasChar(uint8 c) const;
|
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
bool isMonospaced() const;
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
void drawLetter(Surface &surf, uint8 c, uint16 x, uint16 y,
|
|
|
|
uint32 color1, uint32 color2, bool transp) const;
|
2009-07-09 02:54:10 +00:00
|
|
|
|
2012-06-29 23:46:24 +00:00
|
|
|
void drawString(const Common::String &str, int16 x, int16 y, int16 color1, int16 color2,
|
|
|
|
bool transp, Surface &dest) const;
|
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
private:
|
|
|
|
const byte *_dataPtr;
|
|
|
|
const byte *_data;
|
|
|
|
const uint8 *_charWidths;
|
|
|
|
|
|
|
|
int8 _itemWidth;
|
|
|
|
int8 _itemHeight;
|
|
|
|
uint8 _startItem;
|
|
|
|
uint8 _endItem;
|
2011-01-31 13:28:55 +00:00
|
|
|
uint8 _itemSize;
|
2009-07-09 02:54:10 +00:00
|
|
|
int8 _bitWidth;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
uint16 getCharCount() const;
|
|
|
|
const byte *getCharData(uint8 c) const;
|
2007-03-20 14:51:57 +00:00
|
|
|
};
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
class Video {
|
2005-04-05 15:07:40 +00:00
|
|
|
public:
|
2010-09-30 13:02:16 +00:00
|
|
|
#define GDR_VERSION 4
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
#define PRIMARY_SURFACE 0x80
|
|
|
|
#define RETURN_PRIMARY 0x01
|
|
|
|
#define DISABLE_SPR_ALLOC 0x20
|
|
|
|
#define SCUMMVM_CURSOR 0x100
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-07-23 16:13:26 +00:00
|
|
|
#include "common/pack-start.h" // START STRUCT PACKING
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Color {
|
2006-01-03 23:14:39 +00:00
|
|
|
byte red;
|
|
|
|
byte green;
|
|
|
|
byte blue;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-07-23 16:13:26 +00:00
|
|
|
#include "common/pack-end.h" // END STRUCT PACKING
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct PalDesc {
|
2006-01-03 23:14:39 +00:00
|
|
|
Color *vgaPal;
|
|
|
|
int16 *unused1;
|
|
|
|
int16 *unused2;
|
|
|
|
PalDesc() : vgaPal(0), unused1(0), unused2(0) {}
|
2006-01-29 02:27:10 +00:00
|
|
|
};
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
bool _doRangeClamp;
|
2008-05-17 23:59:56 +00:00
|
|
|
|
2007-01-29 17:04:37 +00:00
|
|
|
int16 _surfWidth;
|
2007-02-06 14:42:05 +00:00
|
|
|
int16 _surfHeight;
|
2008-05-17 23:59:56 +00:00
|
|
|
|
2007-02-06 14:42:05 +00:00
|
|
|
int16 _scrollOffsetX;
|
|
|
|
int16 _scrollOffsetY;
|
2008-05-17 23:59:56 +00:00
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
SurfacePtr _splitSurf;
|
2007-04-19 13:51:57 +00:00
|
|
|
int16 _splitHeight1;
|
|
|
|
int16 _splitHeight2;
|
|
|
|
int16 _splitStart;
|
2008-05-17 23:59:56 +00:00
|
|
|
|
2008-05-03 20:08:46 +00:00
|
|
|
int16 _screenDeltaX;
|
|
|
|
int16 _screenDeltaY;
|
2006-05-01 12:43:50 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void initPrimary(int16 mode);
|
2011-02-02 16:48:46 +00:00
|
|
|
SurfacePtr initSurfDesc(int16 width, int16 height, int16 flags = 0);
|
2008-05-03 20:08:46 +00:00
|
|
|
|
|
|
|
void setSize(bool defaultTo1XScaler);
|
|
|
|
|
|
|
|
void clearScreen();
|
2007-03-29 17:55:39 +00:00
|
|
|
void retrace(bool mouse = true);
|
2007-03-20 14:51:57 +00:00
|
|
|
void waitRetrace(bool mouse = true);
|
2007-04-06 13:30:09 +00:00
|
|
|
void sparseRetrace(int max);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
void drawPackedSprite(byte *sprBuf, int16 width, int16 height,
|
2010-09-30 13:02:16 +00:00
|
|
|
int16 x, int16 y, int16 transp, Surface &dest);
|
|
|
|
void drawPackedSprite(const char *path, Surface &dest, int width = 320);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
void setPalColor(byte *pal, byte red, byte green, byte blue) {
|
|
|
|
pal[0] = red << 2;
|
|
|
|
pal[1] = green << 2;
|
|
|
|
pal[2] = blue << 2;
|
|
|
|
}
|
|
|
|
void setPalColor(byte *pal, Color &color) {
|
|
|
|
setPalColor(pal, color.red, color.green, color.blue);
|
|
|
|
}
|
|
|
|
void setPalElem(int16 index, char red, char green, char blue,
|
|
|
|
int16 unused, int16 vidMode);
|
|
|
|
void setPalette(PalDesc *palDesc);
|
|
|
|
void setFullPalette(PalDesc *palDesc);
|
2007-03-29 17:55:39 +00:00
|
|
|
void setPalette(Color *palette);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
void dirtyRectsClear();
|
|
|
|
void dirtyRectsAll();
|
|
|
|
void dirtyRectsAdd(int16 left, int16 top, int16 right, int16 bottom);
|
|
|
|
void dirtyRectsApply(int left, int top, int width, int height, int x, int y);
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth,
|
|
|
|
int16 srcHeight, int16 x, int16 y, int16 transp,
|
2010-09-30 13:02:16 +00:00
|
|
|
Surface &destDesc) = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
Video(class GobEngine *vm);
|
2008-12-14 04:33:28 +00:00
|
|
|
virtual ~Video();
|
2006-04-18 09:59:18 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
protected:
|
2008-12-04 18:38:55 +00:00
|
|
|
bool _dirtyAll;
|
|
|
|
Common::List<Common::Rect> _dirtyRects;
|
|
|
|
|
2007-04-06 13:30:09 +00:00
|
|
|
int _curSparse;
|
|
|
|
uint32 _lastSparse;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
GobEngine *_vm;
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
void drawPacked(byte *sprBuf, int16 width, int16 height, int16 x, int16 y, byte transp, Surface &dest);
|
2006-01-03 23:14:39 +00:00
|
|
|
};
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
class Video_v1 : public Video {
|
|
|
|
public:
|
2006-05-11 19:43:30 +00:00
|
|
|
virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
|
2010-09-30 13:02:16 +00:00
|
|
|
int16 x, int16 y, int16 transp, Surface &destDesc);
|
2006-04-18 09:59:18 +00:00
|
|
|
|
|
|
|
Video_v1(GobEngine *vm);
|
2007-04-25 19:31:23 +00:00
|
|
|
virtual ~Video_v1() {}
|
2006-04-18 09:59:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Video_v2 : public Video_v1 {
|
|
|
|
public:
|
2006-05-11 19:43:30 +00:00
|
|
|
virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
|
2010-09-30 13:02:16 +00:00
|
|
|
int16 x, int16 y, int16 transp, Surface &destDesc);
|
2006-04-18 09:59:18 +00:00
|
|
|
|
|
|
|
Video_v2(GobEngine *vm);
|
2007-04-25 19:31:23 +00:00
|
|
|
virtual ~Video_v2() {}
|
2006-04-18 09:59:18 +00:00
|
|
|
};
|
|
|
|
|
2008-09-02 20:15:42 +00:00
|
|
|
class Video_v6 : public Video_v2 {
|
|
|
|
public:
|
|
|
|
virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
|
2010-09-30 13:02:16 +00:00
|
|
|
int16 x, int16 y, int16 transp, Surface &destDesc);
|
2008-12-16 23:27:35 +00:00
|
|
|
|
2008-09-02 20:15:42 +00:00
|
|
|
Video_v6(GobEngine *vm);
|
|
|
|
virtual ~Video_v6() {}
|
2008-12-11 21:57:47 +00:00
|
|
|
|
|
|
|
private:
|
2010-09-30 13:02:16 +00:00
|
|
|
void drawPacked(const byte *sprBuf, int16 x, int16 y, Surface &surfDesc);
|
|
|
|
void drawYUVData(const byte *srcData, Surface &destDesc,
|
2008-12-11 21:57:47 +00:00
|
|
|
int16 width, int16 height, int16 x, int16 y);
|
2010-09-30 13:02:16 +00:00
|
|
|
void drawYUV(Surface &destDesc, int16 x, int16 y,
|
2008-12-11 21:57:47 +00:00
|
|
|
int16 dataWidth, int16 dataHeight, int16 width, int16 height,
|
|
|
|
const byte *dataY, const byte *dataU, const byte *dataV);
|
2008-09-02 20:15:42 +00:00
|
|
|
};
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
} // End of namespace Gob
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
#endif // GOB_VIDEO_H
|