2013-05-20 12:45:54 +10: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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VOYEUR_GRAPHICS_H
|
|
|
|
#define VOYEUR_GRAPHICS_H
|
|
|
|
|
2013-05-29 23:21:07 -04:00
|
|
|
//#include "voyeur/files.h"
|
2013-05-24 21:54:40 -04:00
|
|
|
#include "voyeur/game.h"
|
2013-05-20 12:45:54 +10:00
|
|
|
#include "common/scummsys.h"
|
2013-05-23 23:13:28 +10:00
|
|
|
#include "common/array.h"
|
2013-05-20 12:45:54 +10:00
|
|
|
#include "graphics/surface.h"
|
|
|
|
|
|
|
|
namespace Voyeur {
|
|
|
|
|
2013-05-23 23:13:28 +10:00
|
|
|
#define SCREEN_WIDTH 320
|
|
|
|
#define SCREEN_HEIGHT 200
|
|
|
|
#define PALETTE_COUNT 256
|
|
|
|
#define PALETTE_SIZE (256 * 3)
|
|
|
|
|
2013-05-24 21:54:40 -04:00
|
|
|
class VoyeurEngine;
|
2013-05-25 09:58:03 -04:00
|
|
|
class GraphicsManager;
|
2013-05-31 21:03:16 -04:00
|
|
|
class DisplayResource;
|
2013-05-29 23:21:07 -04:00
|
|
|
class PictureResource;
|
|
|
|
class ViewPortResource;
|
2013-06-05 21:28:51 -04:00
|
|
|
class ViewPortListResource;
|
2013-06-10 21:29:12 -04:00
|
|
|
class FontResource;
|
2013-06-12 22:13:52 -04:00
|
|
|
class CMapResource;
|
2013-06-10 21:29:12 -04:00
|
|
|
|
2013-06-14 22:01:59 -04:00
|
|
|
enum FontJustify { ALIGN_LEFT = 0, ALIGN_CENTRE = 1, ALIGN_RIGHT = 2 };
|
|
|
|
|
2013-06-10 21:29:12 -04:00
|
|
|
class FontInfo {
|
|
|
|
public:
|
|
|
|
FontResource *_curFont;
|
|
|
|
byte _picFlags;
|
|
|
|
byte _picSelect;
|
|
|
|
byte _picPick;
|
|
|
|
byte _picOnOff;
|
|
|
|
byte _fontFlags;
|
2013-06-14 22:01:59 -04:00
|
|
|
FontJustify _justify;
|
2013-06-10 21:29:12 -04:00
|
|
|
int _fontSaveBack;
|
|
|
|
Common::Point _pos;
|
|
|
|
int _justifyWidth;
|
|
|
|
int _justifyHeight;
|
|
|
|
Common::Point _shadow;
|
|
|
|
int _foreColor;
|
|
|
|
int _backColor;
|
|
|
|
int _shadowColor;
|
|
|
|
public:
|
|
|
|
FontInfo();
|
2013-06-14 22:01:59 -04:00
|
|
|
FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags,
|
|
|
|
FontJustify justify, int fontSaveBack, const Common::Point &pos, int justifyWidth,
|
|
|
|
int justifyHeight, const Common::Point &shadow, int foreColor, int backColor,
|
|
|
|
int shadowColor);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DrawInfo {
|
|
|
|
public:
|
|
|
|
int _penColor;
|
|
|
|
Common::Point _pos;
|
|
|
|
int _flags;
|
|
|
|
public:
|
|
|
|
DrawInfo(int penColor, const Common::Point &pos, int flags);
|
2013-06-10 21:29:12 -04:00
|
|
|
};
|
2013-05-25 09:58:03 -04:00
|
|
|
|
|
|
|
typedef void (GraphicsManager::*GraphicMethodPtr)();
|
2013-05-29 23:21:07 -04:00
|
|
|
typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
|
2013-06-01 12:35:50 -04:00
|
|
|
typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int idx, const Common::Rect &bounds);
|
2013-05-29 23:21:07 -04:00
|
|
|
typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
|
2013-05-23 23:13:28 +10:00
|
|
|
|
2013-05-20 12:45:54 +10:00
|
|
|
class GraphicsManager {
|
|
|
|
public:
|
2013-05-24 21:54:40 -04:00
|
|
|
VoyeurEngine *_vm;
|
2013-05-22 22:29:24 +10:00
|
|
|
bool _palFlag;
|
2013-05-23 23:13:28 +10:00
|
|
|
byte _VGAColors[PALETTE_SIZE];
|
|
|
|
Common::Array<byte *> _colorChain;
|
2013-05-28 23:57:16 -04:00
|
|
|
PictureResource *_backgroundPage;
|
2013-05-25 20:51:53 -04:00
|
|
|
int _SVGAPage;
|
|
|
|
int _SVGAMode;
|
2013-05-31 18:40:04 -04:00
|
|
|
int _SVGAReset;
|
2013-06-05 21:28:51 -04:00
|
|
|
ViewPortListResource *_viewPortListPtr;
|
2013-05-31 21:03:16 -04:00
|
|
|
ViewPortResource **_vPort;
|
2013-05-30 08:31:06 -04:00
|
|
|
bool _MCGAMode;
|
2013-05-31 18:40:04 -04:00
|
|
|
bool _saveBack;
|
2013-05-30 08:31:06 -04:00
|
|
|
Common::Rect *_clipPtr;
|
2013-05-31 18:40:04 -04:00
|
|
|
int _screenOffset;
|
2013-05-31 21:31:33 -04:00
|
|
|
uint _planeSelect;
|
2013-06-01 12:35:50 -04:00
|
|
|
int _sImageShift;
|
2013-06-01 19:38:50 -04:00
|
|
|
Graphics::Surface _screenSurface;
|
2013-06-12 22:13:52 -04:00
|
|
|
CMapResource *_backColors;
|
|
|
|
FontInfo *_fontPtr;
|
|
|
|
FontInfo _defaultFontInfo;
|
2013-06-14 22:01:59 -04:00
|
|
|
DrawInfo *_drawPtr;
|
|
|
|
DrawInfo _defaultDrawInfo;
|
|
|
|
bool _drawTextPermFlag;
|
2013-05-24 21:54:40 -04:00
|
|
|
private:
|
|
|
|
static void fadeIntFunc();
|
|
|
|
static void vDoCycleInt();
|
2013-05-25 09:58:03 -04:00
|
|
|
|
2013-06-01 12:35:50 -04:00
|
|
|
void restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
|
|
|
|
PictureResource *srcPic, PictureResource *destPic);
|
2013-05-22 22:29:24 +10:00
|
|
|
public:
|
|
|
|
GraphicsManager();
|
2013-06-01 19:38:50 -04:00
|
|
|
~GraphicsManager();
|
2013-05-24 21:54:40 -04:00
|
|
|
void setVm(VoyeurEngine *vm) { _vm = vm; }
|
2013-05-23 23:13:28 +10:00
|
|
|
void sInitGraphics();
|
2013-05-22 22:29:24 +10:00
|
|
|
|
2013-05-29 23:21:07 -04:00
|
|
|
void setupMCGASaveRect(ViewPortResource *viewPort);
|
2013-06-01 12:35:50 -04:00
|
|
|
void addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
|
2013-05-29 23:21:07 -04:00
|
|
|
void restoreMCGASaveRect(ViewPortResource *viewPort);
|
2013-06-01 12:35:50 -04:00
|
|
|
void addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
|
2013-05-30 08:31:06 -04:00
|
|
|
|
2013-05-31 18:40:04 -04:00
|
|
|
void EMSMapPageHandle(int v1, int v2, int v3);
|
2013-06-01 13:01:09 -04:00
|
|
|
void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset);
|
2013-06-12 22:13:52 -04:00
|
|
|
void fillPic(DisplayResource *display, byte onOff = 0);
|
2013-05-31 21:31:33 -04:00
|
|
|
void sDisplayPic(PictureResource *pic);
|
2013-05-31 21:03:16 -04:00
|
|
|
void flipPage();
|
2013-06-05 21:28:51 -04:00
|
|
|
void clearPalette();
|
2013-06-08 17:51:41 -04:00
|
|
|
void resetPalette();
|
|
|
|
void setColor(int idx, int r, int g, int b);
|
2013-06-05 21:28:51 -04:00
|
|
|
void screenReset();
|
2013-05-20 12:45:54 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Voyeur
|
|
|
|
|
2013-05-23 23:13:28 +10:00
|
|
|
#endif /* VOYEUR_GRAPHICS_H */
|