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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
#ifndef SCI_GRAPHICS_SCREEN_H
|
|
|
|
#define SCI_GRAPHICS_SCREEN_H
|
2009-10-04 20:01:21 +00:00
|
|
|
|
2009-10-06 12:26:13 +00:00
|
|
|
#include "sci/sci.h"
|
2010-01-05 01:37:57 +00:00
|
|
|
#include "sci/graphics/helpers.h"
|
2009-10-04 22:43:30 +00:00
|
|
|
|
2009-10-03 20:49:18 +00:00
|
|
|
namespace Sci {
|
|
|
|
|
|
|
|
#define SCI_SCREEN_MAXHEIGHT 400
|
|
|
|
|
|
|
|
#define SCI_SCREEN_MASK_VISUAL 1
|
|
|
|
#define SCI_SCREEN_MASK_PRIORITY 2
|
|
|
|
#define SCI_SCREEN_MASK_CONTROL 4
|
2009-10-31 15:25:47 +00:00
|
|
|
#define SCI_SCREEN_MASK_DISPLAY 8 // not official sierra sci
|
2009-10-03 20:49:18 +00:00
|
|
|
#define SCI_SCREEN_MASK_ALL SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY|SCI_SCREEN_MASK_CONTROL
|
|
|
|
|
2009-10-09 20:54:02 +00:00
|
|
|
#define SCI_SCREEN_UNDITHERMEMORIAL_SIZE 256
|
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
class Screen {
|
2009-10-03 20:49:18 +00:00
|
|
|
public:
|
2010-01-05 01:37:57 +00:00
|
|
|
Screen(ResourceManager *resMan, int16 width = 320, int16 height = 200, bool upscaledHires = false);
|
|
|
|
~Screen();
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2010-01-06 13:05:14 +00:00
|
|
|
uint16 getWidth() { return _width; };
|
|
|
|
uint16 getHeight() { return _height; };
|
|
|
|
uint16 getDisplayWidth() { return _displayWidth; };
|
|
|
|
uint16 getDisplayHeight() { return _displayHeight; };
|
|
|
|
byte getColorWhite() { return _colorWhite; };
|
|
|
|
byte getColorDefaultVectorData() { return _colorDefaultVectorData; };
|
|
|
|
|
2009-10-05 12:04:39 +00:00
|
|
|
void copyToScreen();
|
2009-10-14 15:43:58 +00:00
|
|
|
void copyFromScreen(byte *buffer);
|
2010-01-06 18:59:39 +00:00
|
|
|
void syncWithFramebuffer();
|
2009-10-11 17:59:23 +00:00
|
|
|
void copyRectToScreen(const Common::Rect &rect);
|
2010-01-07 10:31:29 +00:00
|
|
|
void copyDisplayRectToScreen(const Common::Rect &rect);
|
2009-10-14 15:43:58 +00:00
|
|
|
void copyRectToScreen(const Common::Rect &rect, int16 x, int16 y);
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2009-10-05 07:38:05 +00:00
|
|
|
byte getDrawingMask(byte color, byte prio, byte control);
|
|
|
|
void putPixel(int x, int y, byte drawMask, byte color, byte prio, byte control);
|
2009-10-31 14:38:25 +00:00
|
|
|
void putPixelOnDisplay(int x, int y, byte color);
|
2009-10-12 08:25:38 +00:00
|
|
|
void drawLine(Common::Point startPoint, Common::Point endPoint, byte color, byte prio, byte control);
|
|
|
|
void drawLine(int16 left, int16 top, int16 right, int16 bottom, byte color, byte prio, byte control) {
|
|
|
|
drawLine(Common::Point(left, top), Common::Point(right, bottom), color, prio, control);
|
|
|
|
}
|
2009-10-31 14:38:25 +00:00
|
|
|
bool getUpscaledHires() {
|
|
|
|
return _upscaledHires;
|
|
|
|
}
|
2009-10-05 07:38:05 +00:00
|
|
|
byte getVisual(int x, int y);
|
|
|
|
byte getPriority(int x, int y);
|
|
|
|
byte getControl(int x, int y);
|
|
|
|
byte isFillMatch(int16 x, int16 y, byte drawMask, byte t_color, byte t_pri, byte t_con);
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2009-10-17 21:11:56 +00:00
|
|
|
int bitsGetDataSize(Common::Rect rect, byte mask);
|
|
|
|
void bitsSave(Common::Rect rect, byte mask, byte *memoryPtr);
|
|
|
|
void bitsGetRect(byte *memoryPtr, Common::Rect *destRect);
|
|
|
|
void bitsRestore(byte *memoryPtr);
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
void setPalette(Palette*pal);
|
2009-10-06 16:14:40 +00:00
|
|
|
|
2009-10-11 08:52:23 +00:00
|
|
|
void setVerticalShakePos(uint16 shakePos);
|
|
|
|
|
2009-10-31 15:44:59 +00:00
|
|
|
void scale2x(byte *src, byte *dst, int16 srcWidth, int16 srcHeight);
|
|
|
|
|
2009-10-09 20:54:02 +00:00
|
|
|
void dither(bool addToFlag);
|
2009-10-07 21:47:34 +00:00
|
|
|
void unditherSetState(bool flag);
|
2009-10-09 20:54:02 +00:00
|
|
|
int16 *unditherGetMemorial();
|
2009-10-05 21:38:51 +00:00
|
|
|
|
2009-10-07 15:53:34 +00:00
|
|
|
void debugShowMap(int mapNo);
|
|
|
|
|
2010-01-06 13:05:14 +00:00
|
|
|
int _picNotValid; // possible values 0, 1 and 2
|
|
|
|
int _picNotValidSci11; // another variable that is used by kPicNotValid in sci1.1
|
|
|
|
|
|
|
|
private:
|
2009-10-03 20:49:18 +00:00
|
|
|
uint16 _width;
|
|
|
|
uint16 _height;
|
|
|
|
uint _pixels;
|
|
|
|
uint16 _displayWidth;
|
|
|
|
uint16 _displayHeight;
|
|
|
|
uint _displayPixels;
|
|
|
|
|
2009-10-29 14:16:20 +00:00
|
|
|
byte _colorWhite;
|
|
|
|
byte _colorDefaultVectorData;
|
|
|
|
|
2009-10-17 21:11:56 +00:00
|
|
|
void bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen);
|
2009-10-31 14:38:25 +00:00
|
|
|
void bitsRestoreDisplayScreen(Common::Rect rect, byte *&memoryPtr);
|
2009-10-17 21:11:56 +00:00
|
|
|
void bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr);
|
2009-10-31 14:38:25 +00:00
|
|
|
void bitsSaveDisplayScreen(Common::Rect rect, byte *&memoryPtr);
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2009-10-09 20:54:02 +00:00
|
|
|
bool _unditherState;
|
|
|
|
int16 _unditherMemorial[SCI_SCREEN_UNDITHERMEMORIAL_SIZE];
|
|
|
|
|
2009-10-03 20:49:18 +00:00
|
|
|
// these screens have the real resolution of the game engine (320x200 for SCI0/SCI1/SCI11 games, 640x480 for SCI2 games)
|
|
|
|
// SCI0 games will be dithered in here at any time
|
|
|
|
byte *_visualScreen;
|
|
|
|
byte *_priorityScreen;
|
|
|
|
byte *_controlScreen;
|
|
|
|
|
|
|
|
// this screen is the one that is actually displayed to the user. It may be 640x480 for japanese SCI1 games
|
|
|
|
// SCI0 games may be undithered in here. Only read from this buffer for Save/ShowBits usage.
|
|
|
|
byte *_displayScreen;
|
2010-01-06 13:05:14 +00:00
|
|
|
|
2009-10-31 10:54:19 +00:00
|
|
|
Common::Rect getScaledRect(Common::Rect rect);
|
2009-10-07 15:53:34 +00:00
|
|
|
|
2009-10-29 14:16:20 +00:00
|
|
|
ResourceManager *_resMan;
|
|
|
|
|
2009-10-07 15:53:34 +00:00
|
|
|
// this is a pointer to the currently active screen (changing it only required for debug purposes)
|
|
|
|
byte *_activeScreen;
|
2009-10-31 14:38:25 +00:00
|
|
|
bool _upscaledHires;
|
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
|