2002-03-22 03:31:55 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2003-03-06 21:46:56 +00:00
|
|
|
* Copyright (C) 2001-2003 The ScummVM project
|
2002-03-22 03:31:55 +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.
|
|
|
|
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2002-07-17 20:55:36 +00:00
|
|
|
#ifndef GFX_H
|
|
|
|
#define GFX_H
|
|
|
|
|
2003-05-15 21:57:38 +00:00
|
|
|
#include "common/rect.h"
|
|
|
|
|
2003-05-30 20:13:29 +00:00
|
|
|
enum { /** Camera modes */
|
2002-03-22 03:30:57 +00:00
|
|
|
CM_NORMAL = 1,
|
|
|
|
CM_FOLLOW_ACTOR = 2,
|
|
|
|
CM_PANNING = 3
|
|
|
|
};
|
|
|
|
|
2003-05-30 20:13:29 +00:00
|
|
|
struct CameraData { /** Camera state data */
|
2003-05-15 21:57:38 +00:00
|
|
|
ScummVM::Point _cur;
|
|
|
|
ScummVM::Point _dest;
|
|
|
|
ScummVM::Point _accel;
|
|
|
|
ScummVM::Point _last;
|
2002-03-22 03:30:57 +00:00
|
|
|
int _leftTrigger, _rightTrigger;
|
|
|
|
byte _follows, _mode;
|
|
|
|
bool _movingToActor;
|
|
|
|
};
|
|
|
|
|
2003-05-30 20:13:29 +00:00
|
|
|
struct VirtScreen { /** Virtual screen areas */
|
2002-03-22 03:30:57 +00:00
|
|
|
int number;
|
|
|
|
uint16 topline;
|
2002-08-20 02:20:40 +00:00
|
|
|
uint16 width, height;
|
2002-12-26 01:15:09 +00:00
|
|
|
int size;
|
2002-03-22 03:30:57 +00:00
|
|
|
byte alloctwobuffers;
|
2002-10-20 01:02:52 +00:00
|
|
|
bool scrollable;
|
2002-03-22 03:30:57 +00:00
|
|
|
uint16 xstart;
|
2002-10-24 06:28:54 +00:00
|
|
|
uint16 tdirty[80];
|
|
|
|
uint16 bdirty[80];
|
2002-03-22 03:30:57 +00:00
|
|
|
byte *screenPtr;
|
|
|
|
byte *backBuf;
|
2003-06-01 14:30:26 +00:00
|
|
|
|
|
|
|
void setDirtyRange(int top, int bottom) {
|
|
|
|
for (int i = 0; i < 80; i++) {
|
|
|
|
tdirty[i] = top;
|
|
|
|
bdirty[i] = bottom;
|
|
|
|
}
|
|
|
|
}
|
2002-03-22 03:30:57 +00:00
|
|
|
};
|
|
|
|
|
2003-05-30 20:13:29 +00:00
|
|
|
struct ColorCycle { /** Palette cycles */
|
2002-03-22 03:30:57 +00:00
|
|
|
uint16 delay;
|
|
|
|
uint16 counter;
|
|
|
|
uint16 flags;
|
|
|
|
byte start;
|
|
|
|
byte end;
|
|
|
|
};
|
|
|
|
|
2003-05-30 20:13:29 +00:00
|
|
|
struct BlastObject { /** BlastObjects to draw */
|
2002-11-06 15:29:49 +00:00
|
|
|
uint16 number;
|
2002-08-20 02:20:40 +00:00
|
|
|
int16 posX, posY;
|
|
|
|
uint16 width, height;
|
2002-09-19 11:06:10 +00:00
|
|
|
uint16 scaleX, scaleY;
|
|
|
|
uint16 image;
|
2002-04-21 21:20:32 +00:00
|
|
|
uint16 mode;
|
2002-03-22 03:30:57 +00:00
|
|
|
};
|
|
|
|
|
2003-05-30 20:13:29 +00:00
|
|
|
/** Bomp graphics data, used as parameter to Scumm::drawBomp. */
|
|
|
|
struct BompDrawData {
|
2002-03-22 03:30:57 +00:00
|
|
|
byte *out;
|
|
|
|
int outwidth, outheight;
|
2002-08-20 02:20:40 +00:00
|
|
|
int x, y;
|
2002-03-22 03:30:57 +00:00
|
|
|
byte scale_x, scale_y;
|
2003-05-28 20:01:47 +00:00
|
|
|
const byte *dataptr;
|
2002-03-22 03:30:57 +00:00
|
|
|
int srcwidth, srcheight;
|
2002-11-06 15:29:49 +00:00
|
|
|
uint16 shadowMode;
|
2003-05-30 15:06:29 +00:00
|
|
|
|
|
|
|
int32 scaleRight, scaleBottom;
|
|
|
|
byte *scalingXPtr, *scalingYPtr;
|
|
|
|
byte *maskPtr;
|
|
|
|
|
|
|
|
BompDrawData() { memset(this, 0, sizeof(*this)); }
|
2002-03-22 03:30:57 +00:00
|
|
|
};
|
|
|
|
|
2003-06-04 21:45:29 +00:00
|
|
|
struct StripTable {
|
|
|
|
int offsets[160];
|
2003-06-05 00:18:15 +00:00
|
|
|
int run[160];
|
|
|
|
int color[160];
|
2003-06-04 21:45:29 +00:00
|
|
|
int zoffsets[120]; // FIXME: Why only 120 here?
|
|
|
|
int zrun[120]; // FIXME: Why only 120 here?
|
|
|
|
};
|
|
|
|
|
2002-12-04 13:36:27 +00:00
|
|
|
class Gdi {
|
|
|
|
friend class Scumm; // Mostly for the code in saveload.cpp ...
|
|
|
|
public:
|
2002-03-22 03:30:57 +00:00
|
|
|
Scumm *_vm;
|
|
|
|
|
|
|
|
int _numZBuffer;
|
2002-12-26 18:10:14 +00:00
|
|
|
int _imgBufOffs[8];
|
2002-10-24 06:28:54 +00:00
|
|
|
int32 _numStrips;
|
2003-05-15 22:30:32 +00:00
|
|
|
ScummVM::Rect _mask;
|
2002-03-22 03:30:57 +00:00
|
|
|
|
2002-12-04 13:36:27 +00:00
|
|
|
protected:
|
2002-04-17 03:11:37 +00:00
|
|
|
byte _palette_mod;
|
2002-03-22 03:30:57 +00:00
|
|
|
byte _decomp_shr, _decomp_mask;
|
2002-12-31 14:59:06 +00:00
|
|
|
byte _transparentColor;
|
2002-04-23 23:58:31 +00:00
|
|
|
uint32 _vertStripNextInc;
|
2002-03-22 03:30:57 +00:00
|
|
|
|
2003-05-15 21:31:03 +00:00
|
|
|
bool _zbufferDisabled;
|
|
|
|
|
2003-06-06 05:27:45 +00:00
|
|
|
byte _C64Colors[4], _C64CharMap[2048], _C64ObjectMap[2048], _C64PicMap[4096], _C64ColorMap[4096];
|
2003-06-05 17:22:15 +00:00
|
|
|
byte _C64MaskMap[4096], _C64MaskChar[4096];
|
2003-06-06 05:27:45 +00:00
|
|
|
bool _C64ObjectMode;
|
2003-06-05 17:22:15 +00:00
|
|
|
|
2002-03-22 03:30:57 +00:00
|
|
|
/* Bitmap decompressors */
|
2003-05-28 20:01:47 +00:00
|
|
|
bool decompressBitmap(byte *bgbak_ptr, const byte *src, int numLinesToProcess);
|
2003-05-26 13:14:57 +00:00
|
|
|
void decodeStripEGA(byte *dst, const byte *src, int height);
|
2003-06-06 05:27:45 +00:00
|
|
|
void decodeC64Gfx(const byte *src, byte *dst, int size);
|
|
|
|
void drawStripC64Object(byte *dst, int stripnr, int width, int height);
|
2003-06-05 17:22:15 +00:00
|
|
|
void drawStripC64Background(byte *dst, int stripnr, int height);
|
|
|
|
void drawStripC64Mask(byte *dst, int stripnr, int height);
|
2003-05-26 13:14:57 +00:00
|
|
|
void unkDecodeA(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecodeA_trans(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecodeB(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecodeB_trans(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecodeC(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecodeC_trans(byte *dst, const byte *src, int height);
|
|
|
|
|
|
|
|
void unkDecode7(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecode8(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecode9(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecode10(byte *dst, const byte *src, int height);
|
|
|
|
void unkDecode11(byte *dst, const byte *src, int height);
|
|
|
|
|
|
|
|
void draw8ColWithMasking(byte *dst, const byte *src, int height, byte *mask);
|
|
|
|
void draw8Col(byte *dst, const byte *src, int height);
|
2002-12-04 13:36:27 +00:00
|
|
|
void clear8ColWithMasking(byte *dst, int height, byte *mask);
|
|
|
|
void clear8Col(byte *dst, int height);
|
2003-05-26 13:14:57 +00:00
|
|
|
void decompressMaskImgOr(byte *dst, const byte *src, int height);
|
|
|
|
void decompressMaskImg(byte *dst, const byte *src, int height);
|
2002-03-22 03:30:57 +00:00
|
|
|
|
2002-12-15 23:40:37 +00:00
|
|
|
void drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b);
|
|
|
|
void updateDirtyScreen(VirtScreen *vs);
|
|
|
|
|
2002-12-04 13:36:27 +00:00
|
|
|
public:
|
2003-05-28 20:01:47 +00:00
|
|
|
void drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
|
2003-06-04 21:45:29 +00:00
|
|
|
int stripnr, int numstrip, byte flag, StripTable *table = 0);
|
|
|
|
StripTable *generateStripTable(const byte *src, int width, int height, StripTable *table);
|
2003-06-01 01:02:35 +00:00
|
|
|
void clearCharsetMask();
|
2002-12-04 15:00:35 +00:00
|
|
|
|
2003-05-15 21:31:03 +00:00
|
|
|
void disableZBuffer() { _zbufferDisabled = true; }
|
|
|
|
void enableZBuffer() { _zbufferDisabled = false; }
|
2002-12-04 15:00:35 +00:00
|
|
|
|
|
|
|
void resetBackground(int top, int bottom, int strip);
|
|
|
|
|
2002-03-22 03:30:57 +00:00
|
|
|
enum DrawBitmapFlags {
|
|
|
|
dbAllowMaskOr = 1,
|
2002-09-29 15:20:02 +00:00
|
|
|
dbDrawMaskOnAll = 2,
|
2002-03-22 03:30:57 +00:00
|
|
|
dbClear = 4
|
|
|
|
};
|
|
|
|
};
|
2002-07-17 20:55:36 +00:00
|
|
|
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
// If you wan to try buggy hacked smooth scrolling support in The Dig, enable
|
|
|
|
// the following preprocessor flag by uncommenting it.
|
|
|
|
//
|
|
|
|
// Note: This is purely experimental, NOT WORKING COMPLETLY and very buggy.
|
|
|
|
// Please do not make reports about problems with it - this is only in CVS
|
|
|
|
// to get it fixed and so that really interested parties can experiment it.
|
|
|
|
// It is NOT FIT FOR GENERAL USAGE! You have been warned.
|
|
|
|
//
|
|
|
|
// Doing this correctly will be quite some more complicated. Basically, with smooth
|
|
|
|
// scrolling, the virtual screen strips don't match the display screen strips.
|
|
|
|
// Hence we either have to draw partial strips - but that'd be rather cumbersome.
|
|
|
|
// Or the much simple (and IMHO more elegant) solution is to simply use a screen pitch
|
|
|
|
// that is 8 pixel wider than the real screen width, and always draw one strip more than
|
|
|
|
// needed to the backbuf. This will still require quite some code to be changed but
|
|
|
|
// should otherwise be relatively easy to understand, and using VirtScreen::pitch
|
|
|
|
// will actually clean up the code.
|
|
|
|
//
|
|
|
|
// #define V7_SMOOTH_SCROLLING_HACK
|
|
|
|
|
|
|
|
|
2002-07-17 20:55:36 +00:00
|
|
|
#endif
|