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.
|
2003-10-16 13:54:48 +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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2003-10-16 13:54:48 +00:00
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-10-16 13:54:48 +00:00
|
|
|
*
|
2006-02-11 10:07:12 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-10-16 13:54:48 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-11-12 17:47:16 +00:00
|
|
|
#ifndef QUEEN_DISPLAY_H
|
|
|
|
#define QUEEN_DISPLAY_H
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2004-01-09 13:36:37 +00:00
|
|
|
#include "common/str.h"
|
2003-12-01 20:48:41 +00:00
|
|
|
#include "common/util.h"
|
2003-10-16 13:54:48 +00:00
|
|
|
#include "queen/defs.h"
|
|
|
|
|
2004-03-15 01:45:22 +00:00
|
|
|
class OSystem;
|
2006-07-09 09:40:44 +00:00
|
|
|
namespace Common {
|
|
|
|
struct Rect;
|
|
|
|
}
|
2004-03-15 01:45:22 +00:00
|
|
|
|
2003-10-16 13:54:48 +00:00
|
|
|
namespace Queen {
|
|
|
|
|
2003-12-11 22:16:35 +00:00
|
|
|
class QueenEngine;
|
2003-10-16 13:54:48 +00:00
|
|
|
|
|
|
|
class Display {
|
|
|
|
public:
|
|
|
|
|
2004-01-04 20:25:21 +00:00
|
|
|
Display(QueenEngine *vm, OSystem *system);
|
2003-10-16 13:54:48 +00:00
|
|
|
~Display();
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! initialise dynalum for the specified room
|
2003-12-11 22:16:35 +00:00
|
|
|
void dynalumInit(const char *roomName, uint16 roomNum);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! update dynalum for the current room
|
2003-10-28 19:55:12 +00:00
|
|
|
void dynalumUpdate(int16 x, int16 y);
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! update the palette
|
2003-10-17 13:12:50 +00:00
|
|
|
void palSet(const uint8 *pal, int start, int end, bool updateScreen = false);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! setup palette for Joe's dress
|
2004-01-04 20:25:21 +00:00
|
|
|
void palSetJoeDress();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! setup palette for Joe's normal clothes
|
2004-01-04 20:25:21 +00:00
|
|
|
void palSetJoeNormal();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! setup palette for panel and inventory objects
|
2004-01-04 20:25:21 +00:00
|
|
|
void palSetPanel();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! fade the current palette in
|
2004-12-02 22:59:57 +00:00
|
|
|
void palFadeIn(uint16 roomNum, bool dynalum = false, int16 dynaX = 0, int16 dynaY = 0);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! fade the current palette out
|
2004-12-02 22:59:57 +00:00
|
|
|
void palFadeOut(uint16 roomNum);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! grey the panel area (used when panel is disabled)
|
2004-11-30 21:01:25 +00:00
|
|
|
void palGreyPanel();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! scroll some palette colors
|
2003-10-17 13:12:50 +00:00
|
|
|
void palScroll(int start, int end);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2007-02-24 18:39:08 +00:00
|
|
|
void palSetAmigaColor(uint8 color, uint16 rgb);
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! custom palette effect for the specified room
|
2003-11-24 14:18:49 +00:00
|
|
|
void palCustomColors(uint16 roomNum);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! custom palette scroll for the specified room
|
2003-11-24 14:18:49 +00:00
|
|
|
void palCustomScroll(uint16 roomNum);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! process a 'palette flash' effect
|
2003-11-24 14:18:49 +00:00
|
|
|
void palCustomFlash();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-12-03 14:09:37 +00:00
|
|
|
void palCustomLightsOff(uint16 roomNum);
|
|
|
|
void palCustomLightsOn(uint16 roomNum);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! mark all palette entries as dirty
|
2003-11-24 14:18:49 +00:00
|
|
|
void palSetAllDirty() { _pal.dirtyMin = 0; _pal.dirtyMax = 255; }
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! returns the number of colors used by the room
|
2004-12-02 22:59:57 +00:00
|
|
|
int getNumColorsForRoom(uint16 room) const;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! returns true if we shouldn't fade the palette in the specified room
|
2004-12-02 22:59:57 +00:00
|
|
|
bool isPalFadingDisabled(uint16 room) const;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! change fullscreen/panel mode
|
2003-10-16 13:54:48 +00:00
|
|
|
void screenMode(int comPanel, bool inCutaway);
|
|
|
|
|
|
|
|
void prepareUpdate();
|
2003-11-30 20:41:02 +00:00
|
|
|
void update(bool dynalum = false, int16 dynaX = 0, int16 dynaY = 0);
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2004-01-08 10:25:18 +00:00
|
|
|
void setupPanel();
|
2004-01-06 09:29:33 +00:00
|
|
|
void setupNewRoom(const char *name, uint16 room);
|
|
|
|
|
2004-01-04 20:25:21 +00:00
|
|
|
void drawBobSprite(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch, bool xflip);
|
|
|
|
void drawBobPasteDown(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h);
|
|
|
|
void drawInventoryItem(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h);
|
|
|
|
|
|
|
|
void blit(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, const uint8 *srcBuf, uint16 srcPitch, uint16 w, uint16 h, bool xflip, bool masked);
|
|
|
|
void fill(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, uint16 w, uint16 h, uint8 color);
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2007-02-21 20:27:48 +00:00
|
|
|
//! decode PCX picture data
|
|
|
|
void decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd);
|
|
|
|
|
|
|
|
//! decode ILBM picture data
|
|
|
|
void decodeLBM(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase = 0);
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2003-11-24 14:18:49 +00:00
|
|
|
void horizontalScrollUpdate(int16 xCamera);
|
2004-01-11 14:08:07 +00:00
|
|
|
void horizontalScroll(int16 scroll);
|
2003-10-18 14:01:43 +00:00
|
|
|
int16 horizontalScroll() const { return _horizontalScroll; }
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2004-01-11 14:08:07 +00:00
|
|
|
void fullscreen(bool fs) { _fullRefresh = 2; _fullscreen = fs; }
|
2003-10-16 13:54:48 +00:00
|
|
|
bool fullscreen() const { return _fullscreen; }
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! mark the specified block as dirty
|
2004-01-04 20:25:21 +00:00
|
|
|
void setDirtyBlock(uint16 x, uint16 y, uint16 w, uint16 h);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! force a full refresh (bypassing the dirtyblocks rendering), on next screen update
|
2004-01-11 14:08:07 +00:00
|
|
|
void forceFullRefresh() { _fullRefresh = 2; }
|
2004-01-04 20:25:21 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! change mouse cursor bitmap
|
2004-01-09 15:14:15 +00:00
|
|
|
void setMouseCursor(uint8 *buf, uint16 w, uint16 h);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! show/hide mouse cursor
|
2003-11-30 20:41:02 +00:00
|
|
|
void showMouseCursor(bool show);
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! initialise font, compute justification sizes
|
2004-01-04 20:25:21 +00:00
|
|
|
void initFont();
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! add the specified text to the texts list
|
2004-01-09 13:36:37 +00:00
|
|
|
void setText(uint16 x, uint16 y, const char *text, bool outlined = true);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! add the specified text to the texts list
|
2004-01-09 13:36:37 +00:00
|
|
|
void setTextCentered(uint16 y, const char *text, bool outlined = true);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! draw the text lists
|
2004-01-09 13:36:37 +00:00
|
|
|
void drawTexts();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! remove entries from the texts list
|
2004-01-09 13:36:37 +00:00
|
|
|
void clearTexts(uint16 y1, uint16 y2);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2007-02-24 18:39:08 +00:00
|
|
|
void setupInkColors();
|
|
|
|
|
|
|
|
uint8 getInkColor(InkColor color) const { return _inkColors[color]; }
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! change the current text color
|
2004-01-09 13:36:37 +00:00
|
|
|
void textCurrentColor(uint8 color) { _curTextColor = color; }
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! change the text color for the specified texts list entry
|
2004-01-09 13:36:37 +00:00
|
|
|
void textColor(uint16 y, uint8 color) { _texts[y].color = color; }
|
2006-11-12 17:47:16 +00:00
|
|
|
|
2006-07-09 09:40:44 +00:00
|
|
|
//! Set the focus rectangle to the speaking character
|
|
|
|
void setFocusRect(const Common::Rect& rect);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-09 13:36:37 +00:00
|
|
|
int textCenterX(const char *text) const;
|
2003-12-26 15:36:28 +00:00
|
|
|
uint16 textWidth(const char *text) const;
|
2004-01-10 19:55:54 +00:00
|
|
|
uint16 textWidth(const char *text, uint16 len) const;
|
2004-01-04 20:25:21 +00:00
|
|
|
void drawChar(uint16 x, uint16 y, uint8 color, const uint8 *chr);
|
2003-12-26 15:36:28 +00:00
|
|
|
void drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined = true);
|
2003-11-24 14:18:49 +00:00
|
|
|
void drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-11 17:20:29 +00:00
|
|
|
void shake(bool reset);
|
2003-12-26 14:49:49 +00:00
|
|
|
|
|
|
|
void blankScreen();
|
|
|
|
void blankScreenEffect1();
|
|
|
|
void blankScreenEffect2();
|
|
|
|
void blankScreenEffect3();
|
2003-11-24 14:18:49 +00:00
|
|
|
|
2003-10-16 13:54:48 +00:00
|
|
|
private:
|
|
|
|
|
2003-10-16 18:57:56 +00:00
|
|
|
enum {
|
2004-01-04 20:25:21 +00:00
|
|
|
FADE_SPEED = 16,
|
|
|
|
D_BLOCK_W = 8,
|
|
|
|
D_BLOCK_H = 8
|
2003-10-16 18:57:56 +00:00
|
|
|
};
|
|
|
|
|
2003-10-16 13:54:48 +00:00
|
|
|
enum BufferDimension {
|
|
|
|
BACKDROP_W = 640,
|
|
|
|
BACKDROP_H = 200,
|
|
|
|
SCREEN_W = 320,
|
|
|
|
SCREEN_H = 200,
|
|
|
|
PANEL_W = 320,
|
2004-01-02 14:15:45 +00:00
|
|
|
PANEL_H = 50
|
2003-10-16 13:54:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint8 *room;
|
2003-10-16 18:57:56 +00:00
|
|
|
uint8 *screen;
|
2004-01-04 20:25:21 +00:00
|
|
|
uint8 *panel;
|
2003-10-16 13:54:48 +00:00
|
|
|
int dirtyMin, dirtyMax;
|
2003-10-16 18:57:56 +00:00
|
|
|
bool scrollable;
|
2003-11-24 14:18:49 +00:00
|
|
|
} _pal;
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2004-01-04 20:25:21 +00:00
|
|
|
struct Dynalum {
|
|
|
|
bool valid;
|
2004-08-06 17:01:58 +00:00
|
|
|
uint8 *mskBuf;
|
|
|
|
uint32 mskSize;
|
|
|
|
int8 *lumBuf;
|
|
|
|
uint32 lumSize;
|
2004-01-04 20:25:21 +00:00
|
|
|
uint8 prevColMask;
|
|
|
|
};
|
|
|
|
|
2004-01-09 13:36:37 +00:00
|
|
|
struct TextSlot {
|
|
|
|
uint16 x;
|
|
|
|
uint8 color;
|
|
|
|
Common::String text;
|
|
|
|
bool outlined;
|
|
|
|
};
|
|
|
|
|
2004-01-04 20:25:21 +00:00
|
|
|
uint8 *_screenBuf;
|
|
|
|
uint8 *_panelBuf;
|
|
|
|
uint8 *_backdropBuf;
|
|
|
|
|
2004-01-11 14:08:07 +00:00
|
|
|
uint8 _fullRefresh;
|
2004-01-04 20:25:21 +00:00
|
|
|
uint8 *_dirtyBlocks;
|
|
|
|
uint16 _dirtyBlocksWidth, _dirtyBlocksHeight;
|
2003-10-16 13:54:48 +00:00
|
|
|
|
|
|
|
bool _fullscreen;
|
|
|
|
|
|
|
|
uint16 _horizontalScroll;
|
|
|
|
uint16 _bdWidth, _bdHeight;
|
|
|
|
|
2007-02-21 20:27:48 +00:00
|
|
|
const char *_imageExt;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! texts list
|
2004-01-09 13:36:37 +00:00
|
|
|
TextSlot _texts[GAME_SCREEN_HEIGHT];
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! current text color to use for display
|
2004-01-09 13:36:37 +00:00
|
|
|
uint8 _curTextColor;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! font justification sizes
|
2004-01-04 20:25:21 +00:00
|
|
|
uint8 _charWidth[256];
|
|
|
|
|
2007-02-24 18:39:08 +00:00
|
|
|
uint8 _inkColors[INK_COUNT];
|
|
|
|
|
2004-03-18 21:53:49 +00:00
|
|
|
Common::RandomSource _rnd;
|
2003-10-16 13:54:48 +00:00
|
|
|
Dynalum _dynalum;
|
|
|
|
OSystem *_system;
|
2003-12-11 22:16:35 +00:00
|
|
|
QueenEngine *_vm;
|
2003-10-16 13:54:48 +00:00
|
|
|
|
2004-02-13 16:27:36 +00:00
|
|
|
const uint8 *_font;
|
2007-09-01 19:13:04 +00:00
|
|
|
|
2004-02-13 16:27:36 +00:00
|
|
|
static const uint8 _fontRegular[];
|
|
|
|
static const uint8 _fontHebrew[];
|
2006-03-22 00:24:10 +00:00
|
|
|
static const uint8 _fontRussian[];
|
2007-11-01 17:06:03 +00:00
|
|
|
static const uint8 _fontGreek[];
|
2003-11-24 14:18:49 +00:00
|
|
|
static const uint8 _palJoeClothes[];
|
|
|
|
static const uint8 _palJoeDress[];
|
2003-10-16 13:54:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // End of namespace Queen
|
|
|
|
|
|
|
|
#endif
|