2014-12-25 08:29:38 +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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XEEN_SCREEN_H
|
|
|
|
#define XEEN_SCREEN_H
|
|
|
|
|
2014-12-25 09:56:35 +00:00
|
|
|
#include "common/rect.h"
|
2017-11-30 02:34:28 +00:00
|
|
|
#include "graphics/screen.h"
|
2015-01-01 02:27:37 +00:00
|
|
|
#include "xeen/font.h"
|
2015-01-04 00:08:30 +00:00
|
|
|
#include "xeen/sprites.h"
|
2014-12-25 08:29:38 +00:00
|
|
|
|
|
|
|
namespace Xeen {
|
|
|
|
|
2014-12-26 02:10:30 +00:00
|
|
|
#define SCREEN_WIDTH 320
|
|
|
|
#define SCREEN_HEIGHT 200
|
|
|
|
#define PALETTE_COUNT 256
|
|
|
|
#define PALETTE_SIZE (256 * 3)
|
|
|
|
|
2014-12-25 08:29:38 +00:00
|
|
|
class XeenEngine;
|
2014-12-30 07:20:40 +00:00
|
|
|
|
2017-11-30 02:34:28 +00:00
|
|
|
class Screen: public Graphics::Screen {
|
2014-12-25 08:29:38 +00:00
|
|
|
private:
|
|
|
|
XeenEngine *_vm;
|
2014-12-26 02:10:30 +00:00
|
|
|
byte _mainPalette[PALETTE_SIZE];
|
2015-01-01 07:09:13 +00:00
|
|
|
byte _tempPalette[PALETTE_SIZE];
|
2014-12-26 02:10:30 +00:00
|
|
|
XSurface _pages[2];
|
2014-12-26 22:07:25 +00:00
|
|
|
XSurface _savedScreens[10];
|
|
|
|
bool _fadeIn;
|
2014-12-25 09:56:35 +00:00
|
|
|
|
2016-08-28 21:52:56 +00:00
|
|
|
/**
|
|
|
|
* Mark the entire screen for drawing
|
|
|
|
*/
|
2014-12-26 03:37:20 +00:00
|
|
|
void drawScreen();
|
|
|
|
|
|
|
|
void fadeInner(int step);
|
|
|
|
|
|
|
|
void updatePalette();
|
|
|
|
|
|
|
|
void updatePalette(const byte *pal, int start, int count16);
|
2014-12-25 08:29:38 +00:00
|
|
|
public:
|
|
|
|
Screen(XeenEngine *vm);
|
2017-11-30 02:34:28 +00:00
|
|
|
virtual ~Screen() {}
|
2014-12-25 08:29:38 +00:00
|
|
|
|
2017-11-30 02:34:28 +00:00
|
|
|
/**
|
|
|
|
* Base method that descendent classes can override for recording affected
|
|
|
|
* dirty areas of the surface
|
|
|
|
*/
|
|
|
|
virtual void addDirtyRect(const Common::Rect &r) { Graphics::Screen::addDirtyRect(r); }
|
2014-12-25 09:56:35 +00:00
|
|
|
|
2016-08-28 21:52:56 +00:00
|
|
|
/**
|
|
|
|
* Load a palette resource into the temporary palette
|
|
|
|
*/
|
2014-12-26 02:10:30 +00:00
|
|
|
void loadPalette(const Common::String &name);
|
|
|
|
|
2016-08-28 21:52:56 +00:00
|
|
|
/**
|
|
|
|
* Load a background resource into memory
|
|
|
|
*/
|
2014-12-26 02:10:30 +00:00
|
|
|
void loadBackground(const Common::String &name);
|
|
|
|
|
2016-08-28 21:52:56 +00:00
|
|
|
/**
|
|
|
|
* Copy a loaded background into a display page
|
|
|
|
*/
|
2014-12-26 02:10:30 +00:00
|
|
|
void loadPage(int pageNum);
|
|
|
|
|
2014-12-26 22:07:25 +00:00
|
|
|
void freePages();
|
|
|
|
|
2016-08-28 21:52:56 +00:00
|
|
|
/**
|
|
|
|
* Merge the two pages along a horizontal split point
|
|
|
|
*/
|
2016-09-19 00:48:23 +00:00
|
|
|
void horizMerge(int xp = 0);
|
2014-12-26 02:10:30 +00:00
|
|
|
|
2016-08-28 21:52:56 +00:00
|
|
|
/**
|
|
|
|
* Merge the two pages along a vertical split point
|
|
|
|
*/
|
2014-12-26 02:10:30 +00:00
|
|
|
void vertMerge(int yp);
|
|
|
|
|
2018-02-25 02:38:20 +00:00
|
|
|
/**
|
|
|
|
* Fades in the screen
|
|
|
|
*/
|
2016-09-19 04:01:25 +00:00
|
|
|
void fadeIn(int step = 4);
|
2014-12-26 03:37:20 +00:00
|
|
|
|
2018-02-25 02:38:20 +00:00
|
|
|
/**
|
|
|
|
* Fades out the screen
|
|
|
|
*/
|
2016-09-19 04:01:25 +00:00
|
|
|
void fadeOut(int step = 4);
|
2014-12-26 22:07:25 +00:00
|
|
|
|
2018-02-25 02:38:20 +00:00
|
|
|
/**
|
|
|
|
* Saves a copy of the current screen into a specified slot
|
|
|
|
*/
|
2015-01-01 07:09:13 +00:00
|
|
|
void saveBackground(int slot = 1);
|
2014-12-26 22:07:25 +00:00
|
|
|
|
2018-02-25 02:38:20 +00:00
|
|
|
/**
|
|
|
|
* Restores a previously saved screen
|
|
|
|
*/
|
2015-01-01 07:09:13 +00:00
|
|
|
void restoreBackground(int slot = 1);
|
2018-03-04 23:40:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws the scroll in the background
|
2018-03-06 02:46:46 +00:00
|
|
|
* @param rollUp If true, rolls up the scroll. If false, unrolls.
|
|
|
|
* @param fadeInFlag If true, does an initial fade in
|
2018-03-04 23:40:25 +00:00
|
|
|
* @returns True if key or mouse pressed
|
|
|
|
*/
|
2018-03-06 02:46:46 +00:00
|
|
|
bool doScroll(bool rollUp, bool fadeInFlag);
|
2014-12-25 08:29:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Xeen
|
|
|
|
|
|
|
|
#endif /* XEEN_SCREEN_H */
|