2008-04-20 14:43:56 +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$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MADE_SCREEN_H
|
|
|
|
#define MADE_SCREEN_H
|
|
|
|
|
|
|
|
#include "common/endian.h"
|
|
|
|
#include "common/util.h"
|
|
|
|
|
|
|
|
#include "graphics/surface.h"
|
|
|
|
|
2008-04-25 11:20:43 +00:00
|
|
|
#include "made/resource.h"
|
|
|
|
|
2008-04-20 14:43:56 +00:00
|
|
|
namespace Made {
|
|
|
|
|
|
|
|
struct SpriteChannel {
|
|
|
|
int16 type;
|
|
|
|
int16 state;
|
|
|
|
int16 needRefresh;
|
|
|
|
uint16 index;
|
|
|
|
int16 x, y;
|
|
|
|
int16 x1, y1, x2, y2;
|
|
|
|
uint32 area;
|
|
|
|
uint16 fontNum;
|
|
|
|
int16 textColor, outlineColor;
|
|
|
|
int16 frameNum;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ClipInfo {
|
|
|
|
uint16 x, y, w, h;
|
|
|
|
Graphics::Surface *destSurface;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MadeEngine;
|
|
|
|
|
|
|
|
class Screen {
|
|
|
|
public:
|
2008-04-20 15:36:40 +00:00
|
|
|
Screen(MadeEngine *vm);
|
|
|
|
~Screen();
|
2008-04-20 14:43:56 +00:00
|
|
|
|
2008-04-20 15:36:40 +00:00
|
|
|
void clearScreen();
|
|
|
|
|
2008-04-23 20:12:06 +00:00
|
|
|
void drawSurface(Graphics::Surface *sourceSurface, int x, int y, const ClipInfo &clipInfo);
|
2008-04-21 20:20:34 +00:00
|
|
|
void loadRGBPalette(byte *palRGB, int count = 256);
|
2008-04-21 18:46:57 +00:00
|
|
|
void setRGBPalette(byte *palRGB, int start = 0, int count = 256);
|
2008-04-22 07:40:28 +00:00
|
|
|
bool isPaletteLocked() { return _paletteLock; }
|
2008-04-23 20:12:06 +00:00
|
|
|
void setScreenLock(bool lock) { _screenLock = lock; }
|
2008-04-22 07:40:28 +00:00
|
|
|
void setPaletteLock(bool lock) { _paletteLock = lock; }
|
2008-04-23 20:12:06 +00:00
|
|
|
void setVisualEffectNum(int visualEffectNum) { _visualEffectNum = visualEffectNum; }
|
|
|
|
void setClip(uint16 clip) { _clip = clip; }
|
|
|
|
void setExclude(uint16 exclude) { _exclude = exclude; }
|
|
|
|
void setGround(uint16 ground) { _ground = ground; }
|
2008-04-24 23:06:21 +00:00
|
|
|
void setTextColor(int16 color) { _textColor = color; }
|
|
|
|
|
2008-04-28 10:56:21 +00:00
|
|
|
void setTextRect(const Common::Rect &textRect) {
|
|
|
|
_textRect = textRect;
|
|
|
|
_textX = _textRect.left;
|
|
|
|
_textY = _textRect.top;
|
|
|
|
}
|
|
|
|
|
|
|
|
void getTextRect(Common::Rect &textRect) {
|
|
|
|
textRect = _textRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setOutlineColor(int16 color) {
|
2008-04-24 23:06:21 +00:00
|
|
|
_outlineColor = color;
|
2008-04-24 23:07:22 +00:00
|
|
|
_dropShadowColor = -1;
|
2008-04-24 23:06:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setDropShadowColor(int16 color) {
|
|
|
|
_outlineColor = -1;
|
2008-04-24 23:07:22 +00:00
|
|
|
_dropShadowColor = color;
|
2008-04-24 23:06:21 +00:00
|
|
|
}
|
2008-04-28 10:56:21 +00:00
|
|
|
|
|
|
|
void setTextXY(int16 x, int16 y) {
|
|
|
|
_textX = x;
|
|
|
|
_textY = y;
|
|
|
|
}
|
|
|
|
|
2008-04-20 15:36:40 +00:00
|
|
|
uint16 updateChannel(uint16 channelIndex);
|
|
|
|
void deleteChannel(uint16 channelIndex);
|
|
|
|
int16 getChannelType(uint16 channelIndex);
|
2008-04-20 14:43:56 +00:00
|
|
|
int16 getChannelState(uint16 channelIndex);
|
|
|
|
void setChannelState(uint16 channelIndex, int16 state);
|
2008-04-20 15:36:40 +00:00
|
|
|
uint16 setChannelLocation(uint16 channelIndex, int16 x, int16 y);
|
|
|
|
uint16 setChannelContent(uint16 channelIndex, uint16 index);
|
|
|
|
void drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask, int16 excludeStateMask);
|
|
|
|
void updateSprites();
|
2008-04-20 14:43:56 +00:00
|
|
|
void clearChannels();
|
2008-04-23 20:12:06 +00:00
|
|
|
|
2008-04-20 15:36:40 +00:00
|
|
|
uint16 drawFlex(uint16 flexIndex, int16 x, int16 y, uint16 flag1, uint16 flag2, const ClipInfo &clipInfo);
|
2008-04-20 14:43:56 +00:00
|
|
|
void drawAnimFrame(uint16 animIndex, int16 x, int16 y, int16 frameNum, uint16 flag1, uint16 flag2, const ClipInfo &clipInfo);
|
|
|
|
|
2008-04-20 15:36:40 +00:00
|
|
|
uint16 drawPic(uint16 index, int16 x, int16 y, uint16 flag1, uint16 flag2);
|
2008-04-20 14:43:56 +00:00
|
|
|
uint16 drawAnimPic(uint16 animIndex, int16 x, int16 y, int16 frameNum, uint16 flag1, uint16 flag2);
|
|
|
|
|
2008-04-22 07:40:28 +00:00
|
|
|
void addSprite(uint16 spriteIndex);
|
2008-04-20 14:43:56 +00:00
|
|
|
|
2008-04-20 15:36:40 +00:00
|
|
|
uint16 drawSprite(uint16 flexIndex, int16 x, int16 y);
|
|
|
|
uint16 placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16 y);
|
2008-04-20 14:43:56 +00:00
|
|
|
|
2008-04-20 15:36:40 +00:00
|
|
|
uint16 placeAnim(uint16 channelIndex, uint16 animIndex, int16 x, int16 y, int16 frameNum);
|
2008-04-20 14:43:56 +00:00
|
|
|
int16 setAnimFrame(uint16 channelIndex, int16 frameNum);
|
2008-04-20 15:36:40 +00:00
|
|
|
int16 getAnimFrame(uint16 channelIndex);
|
|
|
|
// TODO: Move to script function
|
2008-04-20 14:43:56 +00:00
|
|
|
int16 getAnimFrameCount(uint16 animIndex);
|
|
|
|
|
2008-04-20 15:36:40 +00:00
|
|
|
uint16 placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, int16 y, uint16 fontNum, int16 textColor, int16 outlineColor);
|
|
|
|
|
|
|
|
void show();
|
2008-04-23 23:22:02 +00:00
|
|
|
void flash(int count);
|
2008-04-20 15:36:40 +00:00
|
|
|
|
2008-04-28 10:56:21 +00:00
|
|
|
void setFont(int16 fontNum);
|
|
|
|
void printChar(uint c, int16 x, int16 y, byte color);
|
|
|
|
void printText(const char *text);
|
|
|
|
void printTextEx(const char *text, int16 x, int16 y, int16 fontNum, int16 textColor, int16 outlineColor, const ClipInfo &clipInfo);
|
|
|
|
void printObjectText(int16 objectIndex, int16 x, int16 y, int16 fontNum, int16 textColor, int16 outlineColor, const ClipInfo &clipInfo);
|
|
|
|
int16 getTextWidth(int16 fontNum, const char *text);
|
|
|
|
|
2008-04-20 14:43:56 +00:00
|
|
|
|
|
|
|
protected:
|
2008-04-20 15:36:40 +00:00
|
|
|
MadeEngine *_vm;
|
|
|
|
|
|
|
|
bool _screenLock;
|
2008-04-22 07:40:28 +00:00
|
|
|
bool _paletteLock;
|
|
|
|
|
2008-04-25 11:20:43 +00:00
|
|
|
byte _screenPalette[256 * 4];
|
2008-04-23 23:22:02 +00:00
|
|
|
byte _palette[768], _newPalette[768], _fxPalette[768];
|
2008-04-23 20:12:06 +00:00
|
|
|
int _paletteColorCount, _oldPaletteColorCount;
|
|
|
|
bool _paletteInitialized, _needPalette;
|
2008-04-24 23:06:21 +00:00
|
|
|
int16 _textColor;
|
|
|
|
int16 _outlineColor;
|
|
|
|
int16 _dropShadowColor;
|
2008-04-23 20:12:06 +00:00
|
|
|
|
2008-04-25 11:20:43 +00:00
|
|
|
int16 _textX, _textY;
|
2008-04-28 10:56:21 +00:00
|
|
|
Common::Rect _textRect;
|
|
|
|
int16 _currentFontNum;
|
2008-04-25 11:20:43 +00:00
|
|
|
FontResource *_font;
|
|
|
|
ClipInfo _fontDrawCtx;
|
|
|
|
|
2008-04-20 15:36:40 +00:00
|
|
|
uint16 _clip, _exclude, _ground;
|
2008-04-23 20:12:06 +00:00
|
|
|
int _visualEffectNum;
|
2008-04-20 15:36:40 +00:00
|
|
|
|
|
|
|
Graphics::Surface *_screen1, *_screen2;
|
|
|
|
ClipInfo _clipArea, _clipInfo1, _clipInfo2;
|
|
|
|
|
|
|
|
ClipInfo _excludeClipArea[4];
|
|
|
|
bool _excludeClipAreaEnabled[4];
|
|
|
|
|
|
|
|
uint16 _channelsUsedCount;
|
2008-04-20 14:43:56 +00:00
|
|
|
SpriteChannel _channels[100];
|
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Made
|
|
|
|
|
|
|
|
#endif /* MADE_H */
|