2008-12-07 09:21:01 +00:00
|
|
|
|
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.
|
2007-01-14 21:29:12 +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
|
|
|
|
* 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$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-04-07 10:02:59 +00:00
|
|
|
#include "common/system.h"
|
2007-01-14 21:29:12 +00:00
|
|
|
#include "common/file.h"
|
2007-12-15 20:56:05 +00:00
|
|
|
#include "graphics/primitives.h"
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-05-14 14:34:01 +00:00
|
|
|
#include "parallaction/input.h"
|
2007-01-14 21:29:12 +00:00
|
|
|
#include "parallaction/parallaction.h"
|
2007-05-13 14:38:05 +00:00
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
|
|
|
|
namespace Parallaction {
|
2007-05-13 14:56:44 +00:00
|
|
|
|
2008-07-15 10:59:58 +00:00
|
|
|
// this is the size of the receiving buffer for unpacked frames,
|
2008-08-20 03:36:49 +00:00
|
|
|
// since BRA uses some insanely big animations (the largest is
|
|
|
|
// part0/ani/dino.ani).
|
|
|
|
#define MAXIMUM_UNPACKED_BITMAP_SIZE 641*401
|
2008-07-15 10:59:58 +00:00
|
|
|
|
|
|
|
|
2008-01-21 20:03:37 +00:00
|
|
|
#define LABEL_TRANSPARENT_COLOR 0xFF
|
2007-08-09 18:02:37 +00:00
|
|
|
|
2007-12-15 20:56:05 +00:00
|
|
|
void halfbritePixel(int x, int y, int color, void *data) {
|
2008-12-14 10:32:26 +00:00
|
|
|
Graphics::Surface *surf = (Graphics::Surface *)data;
|
|
|
|
byte *pixel = (byte*)surf->getBasePtr(x, y);
|
|
|
|
*pixel &= ~0x20;
|
2007-12-15 20:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void drawCircleLine(int xCenter, int yCenter, int x, int y, int color, void (*plotProc)(int, int, int, void *), void *data){
|
|
|
|
Graphics::drawLine(xCenter + x, yCenter + y, xCenter - x, yCenter + y, color, plotProc, data);
|
|
|
|
Graphics::drawLine(xCenter + x, yCenter - y, xCenter - x, yCenter - y, color, plotProc, data);
|
|
|
|
Graphics::drawLine(xCenter + y, yCenter + x, xCenter - y, yCenter + x, color, plotProc, data);
|
|
|
|
Graphics::drawLine(xCenter + y, yCenter - x, xCenter - y, yCenter - x, color, plotProc, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void drawCircle(int xCenter, int yCenter, int radius, int color, void (*plotProc)(int, int, int, void *), void *data) {
|
|
|
|
int x = 0;
|
|
|
|
int y = radius;
|
|
|
|
int p = 1 - radius;
|
|
|
|
|
|
|
|
/* Plot first set of points */
|
|
|
|
drawCircleLine(xCenter, yCenter, x, y, color, plotProc, data);
|
|
|
|
|
|
|
|
while (x < y) {
|
|
|
|
x++;
|
|
|
|
if (p < 0)
|
|
|
|
p += 2*x + 1;
|
|
|
|
else {
|
|
|
|
y--;
|
|
|
|
p += 2 * (x-y) + 1;
|
|
|
|
}
|
|
|
|
drawCircleLine(xCenter, yCenter, x, y, color, plotProc, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-08-09 18:02:37 +00:00
|
|
|
|
|
|
|
Palette::Palette() {
|
|
|
|
|
|
|
|
int gameType = _vm->getGameType();
|
|
|
|
|
|
|
|
if (gameType == GType_Nippon) {
|
|
|
|
_colors = 32;
|
|
|
|
_hb = (_vm->getPlatform() == Common::kPlatformAmiga);
|
|
|
|
} else
|
|
|
|
if (gameType == GType_BRA) {
|
|
|
|
_colors = 256;
|
|
|
|
_hb = false;
|
|
|
|
} else
|
|
|
|
error("can't create palette for id = '%i'", gameType);
|
|
|
|
|
|
|
|
_size = _colors * 3;
|
|
|
|
|
|
|
|
makeBlack();
|
2007-08-09 21:32:26 +00:00
|
|
|
}
|
2007-08-09 18:02:37 +00:00
|
|
|
|
|
|
|
Palette::Palette(const Palette &pal) {
|
2007-08-11 12:26:17 +00:00
|
|
|
clone(pal);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Palette::clone(const Palette &pal) {
|
2007-08-09 18:02:37 +00:00
|
|
|
_colors = pal._colors;
|
|
|
|
_hb = pal._hb;
|
|
|
|
_size = pal._size;
|
|
|
|
memcpy(_data, pal._data, _size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Palette::makeBlack() {
|
|
|
|
memset(_data, 0, _size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Palette::setEntry(uint index, int red, int green, int blue) {
|
|
|
|
assert(index < _colors);
|
|
|
|
|
|
|
|
if (red >= 0)
|
|
|
|
_data[index*3] = red & 0xFF;
|
|
|
|
|
|
|
|
if (green >= 0)
|
|
|
|
_data[index*3+1] = green & 0xFF;
|
|
|
|
|
|
|
|
if (blue >= 0)
|
|
|
|
_data[index*3+2] = blue & 0xFF;
|
|
|
|
}
|
|
|
|
|
2008-07-28 06:06:35 +00:00
|
|
|
void Palette::getEntry(uint index, int &red, int &green, int &blue) {
|
|
|
|
assert(index < _colors);
|
|
|
|
red = _data[index*3];
|
|
|
|
green = _data[index*3+1];
|
|
|
|
blue = _data[index*3+2];
|
|
|
|
}
|
|
|
|
|
2007-08-09 18:02:37 +00:00
|
|
|
void Palette::makeGrayscale() {
|
|
|
|
byte v;
|
|
|
|
for (uint16 i = 0; i < _colors; i++) {
|
|
|
|
v = MAX(_data[i*3+1], _data[i*3+2]);
|
|
|
|
v = MAX(v, _data[i*3]);
|
|
|
|
setEntry(i, v, v, v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Palette::fadeTo(const Palette& target, uint step) {
|
|
|
|
|
|
|
|
if (step == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (uint16 i = 0; i < _size; i++) {
|
|
|
|
if (_data[i] == target._data[i]) continue;
|
|
|
|
|
|
|
|
if (_data[i] < target._data[i])
|
|
|
|
_data[i] = CLIP(_data[i] + step, (uint)0, (uint)target._data[i]);
|
|
|
|
else
|
|
|
|
_data[i] = CLIP(_data[i] - step, (uint)target._data[i], (uint)255);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint Palette::fillRGBA(byte *rgba) {
|
|
|
|
|
|
|
|
byte r, g, b;
|
2007-12-15 20:56:05 +00:00
|
|
|
byte *hbPal = rgba + _colors * 4;
|
2007-08-09 18:02:37 +00:00
|
|
|
|
|
|
|
for (uint32 i = 0; i < _colors; i++) {
|
|
|
|
r = (_data[i*3] << 2) | (_data[i*3] >> 4);
|
|
|
|
g = (_data[i*3+1] << 2) | (_data[i*3+1] >> 4);
|
|
|
|
b = (_data[i*3+2] << 2) | (_data[i*3+2] >> 4);
|
|
|
|
|
|
|
|
rgba[i*4] = r;
|
|
|
|
rgba[i*4+1] = g;
|
|
|
|
rgba[i*4+2] = b;
|
|
|
|
rgba[i*4+3] = 0;
|
|
|
|
|
|
|
|
if (_hb) {
|
|
|
|
hbPal[i*4] = r >> 1;
|
|
|
|
hbPal[i*4+1] = g >> 1;
|
|
|
|
hbPal[i*4+2] = b >> 1;
|
|
|
|
hbPal[i*4+3] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ((_hb) ? 2 : 1) * _colors;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Palette::rotate(uint first, uint last, bool forward) {
|
|
|
|
|
|
|
|
byte tmp[3];
|
|
|
|
|
2008-01-28 00:14:17 +00:00
|
|
|
if (forward) { // forward
|
2007-08-09 18:02:37 +00:00
|
|
|
|
|
|
|
tmp[0] = _data[first * 3];
|
|
|
|
tmp[1] = _data[first * 3 + 1];
|
|
|
|
tmp[2] = _data[first * 3 + 2];
|
|
|
|
|
|
|
|
memmove(_data+first*3, _data+(first+1)*3, (last - first)*3);
|
|
|
|
|
|
|
|
_data[last * 3] = tmp[0];
|
|
|
|
_data[last * 3 + 1] = tmp[1];
|
|
|
|
_data[last * 3 + 2] = tmp[2];
|
|
|
|
|
|
|
|
} else { // backward
|
|
|
|
|
|
|
|
tmp[0] = _data[last * 3];
|
|
|
|
tmp[1] = _data[last * 3 + 1];
|
|
|
|
tmp[2] = _data[last * 3 + 2];
|
|
|
|
|
|
|
|
memmove(_data+(first+1)*3, _data+first*3, (last - first)*3);
|
|
|
|
|
|
|
|
_data[first * 3] = tmp[0];
|
|
|
|
_data[first * 3 + 1] = tmp[1];
|
|
|
|
_data[first * 3 + 2] = tmp[2];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-21 12:51:40 +00:00
|
|
|
|
2007-08-09 18:02:37 +00:00
|
|
|
void Gfx::setPalette(Palette pal) {
|
|
|
|
byte sysPal[256*4];
|
2007-04-21 12:51:40 +00:00
|
|
|
|
2007-08-09 18:02:37 +00:00
|
|
|
uint n = pal.fillRGBA(sysPal);
|
2008-08-30 15:49:54 +00:00
|
|
|
_vm->_system->setPalette(sysPal, 0, n);
|
2007-01-14 21:29:12 +00:00
|
|
|
}
|
|
|
|
|
2007-03-28 20:12:00 +00:00
|
|
|
void Gfx::setBlackPalette() {
|
|
|
|
Palette pal;
|
|
|
|
setPalette(pal);
|
2007-01-14 21:29:12 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 19:19:59 +00:00
|
|
|
|
2007-08-09 18:02:37 +00:00
|
|
|
|
|
|
|
|
2007-03-28 20:12:00 +00:00
|
|
|
void Gfx::animatePalette() {
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2007-10-15 19:00:46 +00:00
|
|
|
// avoid forcing setPalette when not needed
|
|
|
|
bool done = false;
|
|
|
|
|
2008-02-02 00:41:31 +00:00
|
|
|
PaletteFxRange *range;
|
2007-01-14 21:29:12 +00:00
|
|
|
for (uint16 i = 0; i < 4; i++) {
|
2008-07-31 12:26:12 +00:00
|
|
|
range = &_backgroundInfo->ranges[i];
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-02-02 00:41:31 +00:00
|
|
|
if ((range->_flags & 1) == 0) continue; // animated palette
|
|
|
|
range->_timer += range->_step * 2; // update timer
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-02-02 00:41:31 +00:00
|
|
|
if (range->_timer < 0x4000) continue; // check timeout
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-02-02 00:41:31 +00:00
|
|
|
range->_timer = 0; // reset timer
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-02-02 00:41:31 +00:00
|
|
|
_palette.rotate(range->_first, range->_last, (range->_flags & 2) != 0);
|
2007-10-15 19:00:46 +00:00
|
|
|
|
|
|
|
done = true;
|
2007-01-14 21:29:12 +00:00
|
|
|
}
|
|
|
|
|
2007-10-15 19:00:46 +00:00
|
|
|
if (done) {
|
|
|
|
setPalette(_palette);
|
|
|
|
}
|
2007-03-28 20:12:00 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-04-21 12:51:40 +00:00
|
|
|
void Gfx::setHalfbriteMode(bool enable) {
|
|
|
|
if (_vm->getPlatform() != Common::kPlatformAmiga) return;
|
|
|
|
if (enable == _halfbrite) return;
|
2007-03-28 20:12:00 +00:00
|
|
|
|
2007-12-15 20:56:05 +00:00
|
|
|
_halfbrite = !_halfbrite;
|
2008-02-06 15:38:33 +00:00
|
|
|
_hbCircleRadius = 0;
|
2007-12-15 20:56:05 +00:00
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-01-06 20:42:28 +00:00
|
|
|
#define HALFBRITE_CIRCLE_RADIUS 48
|
2007-12-15 20:56:05 +00:00
|
|
|
void Gfx::setProjectorPos(int x, int y) {
|
2008-01-06 20:42:28 +00:00
|
|
|
_hbCircleRadius = HALFBRITE_CIRCLE_RADIUS;
|
|
|
|
_hbCirclePos.x = x + _hbCircleRadius;
|
|
|
|
_hbCirclePos.y = y + _hbCircleRadius;
|
2007-04-21 12:51:40 +00:00
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-02-06 15:38:33 +00:00
|
|
|
void Gfx::setProjectorProgram(int16 *data) {
|
|
|
|
_nextProjectorPos = data;
|
|
|
|
}
|
2007-12-15 20:56:05 +00:00
|
|
|
|
2007-11-21 20:04:14 +00:00
|
|
|
void Gfx::drawInventory() {
|
2008-07-23 02:45:09 +00:00
|
|
|
/*
|
2007-11-21 20:04:14 +00:00
|
|
|
if ((_engineFlags & kEngineInventory) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2008-07-23 02:45:09 +00:00
|
|
|
*/
|
|
|
|
if (_vm->_input->_inputMode != Input::kInputModeInventory) {
|
|
|
|
return;
|
|
|
|
}
|
2007-11-21 20:04:14 +00:00
|
|
|
|
|
|
|
Common::Rect r;
|
|
|
|
_vm->_inventoryRenderer->getRect(r);
|
|
|
|
byte *data = _vm->_inventoryRenderer->getData();
|
|
|
|
|
2008-12-06 04:51:04 +00:00
|
|
|
copyRectToScreen(data, r.width(), r.left, r.top, r.width(), r.height());
|
2007-11-21 20:04:14 +00:00
|
|
|
}
|
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
void Gfx::drawList(Graphics::Surface &surface, GfxObjArray &list) {
|
|
|
|
if (list.size() == 0) {
|
2007-11-22 21:19:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
for (uint i = 0; i < list.size(); i++) {
|
|
|
|
drawGfxObject(list[i], surface);
|
2007-11-22 21:19:44 +00:00
|
|
|
}
|
2008-02-02 10:18:31 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 04:51:04 +00:00
|
|
|
void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
|
|
|
|
if (_doubleBuffering) {
|
2008-12-06 06:17:10 +00:00
|
|
|
if (_overlayMode)
|
|
|
|
x += _scrollPos;
|
|
|
|
|
2008-12-06 04:51:04 +00:00
|
|
|
byte *dst = (byte*)_backBuffer.getBasePtr(x, y);
|
|
|
|
for (int i = 0; i < h; i++) {
|
|
|
|
memcpy(dst, buf, w);
|
|
|
|
buf += pitch;
|
|
|
|
dst += _backBuffer.pitch;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_vm->_system->copyRectToScreen(buf, pitch, x, y, w, h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::clearScreen() {
|
|
|
|
if (_doubleBuffering) {
|
|
|
|
if (_backBuffer.pixels) {
|
|
|
|
Common::Rect r(_backBuffer.w, _backBuffer.h);
|
|
|
|
_backBuffer.fillRect(r, 0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_vm->_system->clearScreen();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Graphics::Surface *Gfx::lockScreen() {
|
|
|
|
if (_doubleBuffering) {
|
|
|
|
return &_backBuffer;
|
|
|
|
}
|
|
|
|
return _vm->_system->lockScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::unlockScreen() {
|
|
|
|
if (_doubleBuffering) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_vm->_system->unlockScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::updateScreenIntern() {
|
|
|
|
if (_doubleBuffering) {
|
|
|
|
byte *data = (byte*)_backBuffer.getBasePtr(_scrollPos, 0);
|
|
|
|
_vm->_system->copyRectToScreen(data, _backBuffer.pitch, 0, 0, _vm->_screenWidth, _vm->_screenHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_system->updateScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
int Gfx::getScrollPos() {
|
|
|
|
return _scrollPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::setScrollPos(int scrollX) {
|
|
|
|
_scrollPos = CLIP(scrollX, _minScroll, _maxScroll);
|
|
|
|
}
|
2008-02-07 12:49:46 +00:00
|
|
|
|
2007-03-12 20:41:25 +00:00
|
|
|
void Gfx::updateScreen() {
|
2008-01-28 18:15:06 +00:00
|
|
|
|
2008-12-06 06:17:10 +00:00
|
|
|
// the scene is calculated in game coordinates, so no translation
|
|
|
|
// is needed
|
|
|
|
_overlayMode = false;
|
|
|
|
|
2008-12-15 07:15:29 +00:00
|
|
|
bool skipBackground = (_backgroundInfo->bg.pixels == 0); // don't render frame if background is missing
|
|
|
|
|
|
|
|
if (!skipBackground) {
|
2008-07-24 09:24:32 +00:00
|
|
|
// background may not cover the whole screen, so adjust bulk update size
|
2008-12-06 04:51:04 +00:00
|
|
|
uint w = _backgroundInfo->width;
|
|
|
|
uint h = _backgroundInfo->height;
|
2008-12-15 07:15:29 +00:00
|
|
|
byte *backgroundData = (byte*)_backgroundInfo->bg.getBasePtr(0, 0);
|
|
|
|
uint16 backgroundPitch = _backgroundInfo->bg.pitch;
|
2008-12-06 04:51:04 +00:00
|
|
|
copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->x, _backgroundInfo->y, w, h);
|
2008-02-06 14:05:08 +00:00
|
|
|
}
|
2008-12-15 07:15:29 +00:00
|
|
|
/*
|
2008-07-26 02:09:50 +00:00
|
|
|
if (_varDrawPathZones == 1) {
|
2008-12-06 04:51:04 +00:00
|
|
|
Graphics::Surface *surf = lockScreen();
|
2008-07-26 02:09:50 +00:00
|
|
|
ZoneList::iterator b = _vm->_location._zones.begin();
|
|
|
|
ZoneList::iterator e = _vm->_location._zones.end();
|
|
|
|
for (; b != e; b++) {
|
|
|
|
ZonePtr z = *b;
|
|
|
|
if (z->_type & kZonePath) {
|
2008-08-15 04:30:45 +00:00
|
|
|
surf->frameRect(Common::Rect(z->getX(), z->getY(), z->getX() + z->width(), z->getY() + z->height()), 2);
|
2008-07-26 02:09:50 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-06 04:51:04 +00:00
|
|
|
unlockScreen();
|
2008-07-26 02:09:50 +00:00
|
|
|
}
|
2008-12-15 07:15:29 +00:00
|
|
|
*/
|
2008-12-13 17:52:37 +00:00
|
|
|
sortScene();
|
2008-12-06 04:51:04 +00:00
|
|
|
Graphics::Surface *surf = lockScreen();
|
2008-12-13 17:52:37 +00:00
|
|
|
// draws animations frames and other game items
|
|
|
|
drawList(*surf, _sceneObjects);
|
2008-12-13 17:31:48 +00:00
|
|
|
|
|
|
|
// special effects
|
|
|
|
applyHalfbriteEffect_NS(*surf);
|
2008-01-28 12:20:53 +00:00
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
// draws inventory, labels and dialogue items
|
|
|
|
drawOverlay(*surf);
|
2008-12-06 04:51:04 +00:00
|
|
|
unlockScreen();
|
2008-01-28 22:20:55 +00:00
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
updateScreenIntern();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::applyHalfbriteEffect_NS(Graphics::Surface &surf) {
|
|
|
|
if (!_halfbrite) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
byte *buf = (byte*)surf.pixels;
|
|
|
|
for (int i = 0; i < surf.w*surf.h; i++) {
|
|
|
|
*buf++ |= 0x20;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_nextProjectorPos) {
|
|
|
|
int16 x = *_nextProjectorPos++;
|
|
|
|
int16 y = *_nextProjectorPos++;
|
|
|
|
if (x == -1 && y == -1) {
|
|
|
|
_nextProjectorPos = 0;
|
|
|
|
} else {
|
|
|
|
setProjectorPos(x, y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_hbCircleRadius > 0) {
|
2008-12-14 10:32:26 +00:00
|
|
|
drawCircle(_hbCirclePos.x, _hbCirclePos.y, _hbCircleRadius, 0, &halfbritePixel, &surf);
|
2008-12-13 17:31:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::drawOverlay(Graphics::Surface &surf) {
|
2008-12-06 06:17:10 +00:00
|
|
|
// the following items are handled in screen coordinates, so they need translation before
|
|
|
|
// being drawn
|
|
|
|
_overlayMode = true;
|
2007-11-19 20:46:28 +00:00
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
drawInventory();
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
updateFloatingLabel();
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
drawList(surf, _items);
|
|
|
|
drawList(surf, _balloons);
|
|
|
|
drawList(surf, _labels);
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// graphic primitives
|
|
|
|
//
|
|
|
|
|
|
|
|
|
2008-01-12 10:46:51 +00:00
|
|
|
void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) {
|
|
|
|
|
2008-01-29 09:37:03 +00:00
|
|
|
Common::Rect r(surf.w, surf.h);
|
|
|
|
r.moveTo(x, y);
|
2008-01-12 10:46:51 +00:00
|
|
|
|
2008-07-31 12:26:12 +00:00
|
|
|
uint16 z = (mask) ? _backgroundInfo->getLayer(y) : LAYER_FOREGROUND;
|
2008-08-18 07:12:05 +00:00
|
|
|
blt(r, (byte*)surf.pixels, &_backgroundInfo->bg, z, 100, 0);
|
2008-01-12 10:46:51 +00:00
|
|
|
}
|
|
|
|
|
2008-01-29 09:37:03 +00:00
|
|
|
void Gfx::fillBackground(const Common::Rect& r, byte color) {
|
2008-07-31 12:26:12 +00:00
|
|
|
_backgroundInfo->bg.fillRect(r, color);
|
2007-01-14 21:29:12 +00:00
|
|
|
}
|
|
|
|
|
2008-01-29 09:37:03 +00:00
|
|
|
void Gfx::invertBackground(const Common::Rect& r) {
|
2007-11-01 21:56:14 +00:00
|
|
|
|
2008-07-31 12:26:12 +00:00
|
|
|
byte *d = (byte*)_backgroundInfo->bg.getBasePtr(r.left, r.top);
|
2007-11-01 21:56:14 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < r.height(); i++) {
|
|
|
|
for (int j = 0; j < r.width(); j++) {
|
|
|
|
*d ^= 0x1F;
|
|
|
|
d++;
|
|
|
|
}
|
|
|
|
|
2008-07-31 12:26:12 +00:00
|
|
|
d += (_backgroundInfo->bg.pitch - r.width());
|
2007-11-01 21:56:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-08 20:46:58 +00:00
|
|
|
|
2008-01-09 22:03:51 +00:00
|
|
|
void setupLabelSurface(Graphics::Surface &surf, uint w, uint h) {
|
|
|
|
surf.create(w, h, 1);
|
|
|
|
surf.fillRect(Common::Rect(w,h), LABEL_TRANSPARENT_COLOR);
|
|
|
|
}
|
|
|
|
|
2008-07-02 01:41:08 +00:00
|
|
|
uint Gfx::renderFloatingLabel(Font *font, char *text) {
|
2008-01-08 20:46:58 +00:00
|
|
|
|
2008-07-02 01:41:08 +00:00
|
|
|
Graphics::Surface *cnv = new Graphics::Surface;
|
2008-01-08 20:46:58 +00:00
|
|
|
|
|
|
|
uint w, h;
|
|
|
|
|
|
|
|
if (_vm->getPlatform() == Common::kPlatformAmiga) {
|
|
|
|
w = font->getStringWidth(text) + 16;
|
|
|
|
h = 10;
|
|
|
|
|
2008-01-09 22:03:51 +00:00
|
|
|
setupLabelSurface(*cnv, w, h);
|
2008-01-08 20:46:58 +00:00
|
|
|
|
|
|
|
font->setColor(7);
|
|
|
|
font->drawString((byte*)cnv->pixels + 1, cnv->w, text);
|
|
|
|
font->drawString((byte*)cnv->pixels + 1 + cnv->w * 2, cnv->w, text);
|
|
|
|
font->drawString((byte*)cnv->pixels + cnv->w, cnv->w, text);
|
|
|
|
font->drawString((byte*)cnv->pixels + 2 + cnv->w, cnv->w, text);
|
|
|
|
font->setColor(1);
|
|
|
|
font->drawString((byte*)cnv->pixels + 1 + cnv->w, cnv->w, text);
|
|
|
|
} else {
|
|
|
|
w = font->getStringWidth(text);
|
|
|
|
h = font->height();
|
|
|
|
|
2008-01-09 22:03:51 +00:00
|
|
|
setupLabelSurface(*cnv, w, h);
|
2008-01-08 20:46:58 +00:00
|
|
|
|
2008-02-06 14:12:59 +00:00
|
|
|
drawText(font, cnv, 0, 0, text, 0);
|
2008-01-08 20:46:58 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 01:41:08 +00:00
|
|
|
GfxObj *obj = new GfxObj(kGfxObjTypeLabel, new SurfaceToFrames(cnv), "floatingLabel");
|
|
|
|
obj->transparentKey = LABEL_TRANSPARENT_COLOR;
|
|
|
|
obj->layer = LAYER_FOREGROUND;
|
|
|
|
|
|
|
|
uint id = _labels.size();
|
|
|
|
_labels.insert_at(id, obj);
|
|
|
|
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::showFloatingLabel(uint label) {
|
|
|
|
assert(label < _labels.size());
|
|
|
|
|
|
|
|
hideFloatingLabel();
|
|
|
|
|
|
|
|
_labels[label]->x = -1000;
|
|
|
|
_labels[label]->y = -1000;
|
|
|
|
_labels[label]->setFlags(kGfxObjVisible);
|
|
|
|
|
|
|
|
_floatingLabel = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::hideFloatingLabel() {
|
|
|
|
if (_floatingLabel != NO_FLOATING_LABEL) {
|
|
|
|
_labels[_floatingLabel]->clearFlags(kGfxObjVisible);
|
|
|
|
}
|
|
|
|
_floatingLabel = NO_FLOATING_LABEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Gfx::updateFloatingLabel() {
|
|
|
|
if (_floatingLabel == NO_FLOATING_LABEL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-16 06:39:58 +00:00
|
|
|
struct FloatingLabelTraits {
|
|
|
|
Common::Point _offsetWithItem;
|
|
|
|
Common::Point _offsetWithoutItem;
|
|
|
|
int _minX;
|
|
|
|
int _minY;
|
|
|
|
int _maxX;
|
|
|
|
int _maxY;
|
|
|
|
} *traits;
|
2008-07-02 01:41:08 +00:00
|
|
|
|
|
|
|
Common::Rect r;
|
|
|
|
_labels[_floatingLabel]->getRect(0, r);
|
|
|
|
|
2008-12-06 04:51:04 +00:00
|
|
|
if (_gameType == GType_Nippon) {
|
2008-08-16 06:39:58 +00:00
|
|
|
FloatingLabelTraits traits_NS = {
|
|
|
|
Common::Point(16 - r.width()/2, 34),
|
|
|
|
Common::Point(8 - r.width()/2, 21),
|
2008-12-06 06:17:10 +00:00
|
|
|
0, 0, _vm->_screenWidth - r.width(), 190
|
2008-08-16 06:39:58 +00:00
|
|
|
};
|
|
|
|
traits = &traits_NS;
|
2008-07-02 01:41:08 +00:00
|
|
|
} else {
|
2008-08-16 06:39:58 +00:00
|
|
|
// FIXME: _maxY for BRA is not constant (390), but depends on _vm->_subtitleY
|
|
|
|
FloatingLabelTraits traits_BR = {
|
|
|
|
Common::Point(34 - r.width()/2, 70),
|
|
|
|
Common::Point(16 - r.width()/2, 37),
|
2008-12-06 06:17:10 +00:00
|
|
|
0, 0, _vm->_screenWidth - r.width(), 390
|
2008-08-16 06:39:58 +00:00
|
|
|
};
|
|
|
|
traits = &traits_BR;
|
2008-07-02 01:41:08 +00:00
|
|
|
}
|
|
|
|
|
2008-08-16 06:39:58 +00:00
|
|
|
Common::Point cursor;
|
2008-12-06 06:17:10 +00:00
|
|
|
_vm->_input->getCursorPos(cursor);
|
2008-08-16 06:39:58 +00:00
|
|
|
Common::Point offset = (_vm->_input->_activeItem._id) ? traits->_offsetWithItem : traits->_offsetWithoutItem;
|
2008-07-02 01:41:08 +00:00
|
|
|
|
2008-08-16 06:39:58 +00:00
|
|
|
_labels[_floatingLabel]->x = CLIP(cursor.x + offset.x, traits->_minX, traits->_maxX);
|
|
|
|
_labels[_floatingLabel]->y = CLIP(cursor.y + offset.y, traits->_minY, traits->_maxY);
|
2008-01-08 20:46:58 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 01:41:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-09 21:46:57 +00:00
|
|
|
uint Gfx::createLabel(Font *font, const char *text, byte color) {
|
2008-07-02 01:41:08 +00:00
|
|
|
assert(_labels.size() < MAX_NUM_LABELS);
|
2008-01-08 20:46:58 +00:00
|
|
|
|
2008-07-02 01:41:08 +00:00
|
|
|
Graphics::Surface *cnv = new Graphics::Surface;
|
2008-01-09 21:46:57 +00:00
|
|
|
|
|
|
|
uint w, h;
|
|
|
|
|
|
|
|
if (_vm->getPlatform() == Common::kPlatformAmiga) {
|
|
|
|
w = font->getStringWidth(text) + 2;
|
|
|
|
h = font->height() + 2;
|
|
|
|
|
2008-01-09 22:03:51 +00:00
|
|
|
setupLabelSurface(*cnv, w, h);
|
2008-01-09 21:46:57 +00:00
|
|
|
|
2008-02-06 14:12:59 +00:00
|
|
|
drawText(font, cnv, 0, 2, text, 0);
|
|
|
|
drawText(font, cnv, 2, 0, text, color);
|
2008-01-09 21:46:57 +00:00
|
|
|
} else {
|
|
|
|
w = font->getStringWidth(text);
|
|
|
|
h = font->height();
|
|
|
|
|
2008-01-09 22:03:51 +00:00
|
|
|
setupLabelSurface(*cnv, w, h);
|
2008-01-09 21:46:57 +00:00
|
|
|
|
2008-02-06 14:12:59 +00:00
|
|
|
drawText(font, cnv, 0, 0, text, color);
|
2008-01-09 21:46:57 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 01:41:08 +00:00
|
|
|
GfxObj *obj = new GfxObj(kGfxObjTypeLabel, new SurfaceToFrames(cnv), "label");
|
|
|
|
obj->transparentKey = LABEL_TRANSPARENT_COLOR;
|
|
|
|
obj->layer = LAYER_FOREGROUND;
|
|
|
|
|
|
|
|
int id = _labels.size();
|
|
|
|
|
|
|
|
_labels.insert_at(id, obj);
|
2008-01-09 21:46:57 +00:00
|
|
|
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::showLabel(uint id, int16 x, int16 y) {
|
2008-07-02 01:41:08 +00:00
|
|
|
assert(id < _labels.size());
|
|
|
|
_labels[id]->setFlags(kGfxObjVisible);
|
|
|
|
|
|
|
|
Common::Rect r;
|
|
|
|
_labels[id]->getRect(0, r);
|
2008-01-09 21:46:57 +00:00
|
|
|
|
|
|
|
if (x == CENTER_LABEL_HORIZONTAL) {
|
2008-12-06 04:51:04 +00:00
|
|
|
x = CLIP<int16>((_backgroundInfo->width - r.width()) / 2, 0, _backgroundInfo->width/2);
|
2008-01-09 21:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (y == CENTER_LABEL_VERTICAL) {
|
2008-07-02 01:41:08 +00:00
|
|
|
y = CLIP<int16>((_vm->_screenHeight - r.height()) / 2, 0, _vm->_screenHeight/2);
|
2008-01-09 21:46:57 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 01:41:08 +00:00
|
|
|
_labels[id]->x = x;
|
|
|
|
_labels[id]->y = y;
|
2008-01-09 21:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::hideLabel(uint id) {
|
2008-07-02 01:41:08 +00:00
|
|
|
assert(id < _labels.size());
|
|
|
|
_labels[id]->clearFlags(kGfxObjVisible);
|
2008-01-09 21:46:57 +00:00
|
|
|
}
|
2007-11-21 20:04:14 +00:00
|
|
|
|
2008-01-09 21:46:57 +00:00
|
|
|
void Gfx::freeLabels() {
|
2008-07-02 01:41:08 +00:00
|
|
|
for (uint i = 0; i < _labels.size(); i++) {
|
2008-01-09 21:46:57 +00:00
|
|
|
delete _labels[i];
|
2007-11-21 20:04:14 +00:00
|
|
|
}
|
2008-07-02 01:41:08 +00:00
|
|
|
_labels.clear();
|
2008-07-07 14:51:27 +00:00
|
|
|
_floatingLabel = NO_FLOATING_LABEL;
|
2008-01-09 21:46:57 +00:00
|
|
|
}
|
2007-11-21 20:04:14 +00:00
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
|
|
|
|
|
2008-01-29 10:04:49 +00:00
|
|
|
void Gfx::copyRect(const Common::Rect &r, Graphics::Surface &src, Graphics::Surface &dst) {
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-01-29 10:04:49 +00:00
|
|
|
byte *s = (byte*)src.getBasePtr(r.left, r.top);
|
|
|
|
byte *d = (byte*)dst.getBasePtr(0, 0);
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-01-29 10:04:49 +00:00
|
|
|
for (uint16 i = 0; i < r.height(); i++) {
|
|
|
|
memcpy(d, s, r.width());
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-01-29 10:04:49 +00:00
|
|
|
s += src.pitch;
|
|
|
|
d += dst.pitch;
|
2007-01-14 21:29:12 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 18:33:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-01-29 09:37:03 +00:00
|
|
|
void Gfx::grabBackground(const Common::Rect& r, Graphics::Surface &dst) {
|
2008-07-31 12:26:12 +00:00
|
|
|
copyRect(r, _backgroundInfo->bg, dst);
|
2007-01-14 21:29:12 +00:00
|
|
|
}
|
|
|
|
|
2007-07-26 18:30:27 +00:00
|
|
|
|
2007-03-12 20:41:25 +00:00
|
|
|
Gfx::Gfx(Parallaction* vm) :
|
2008-12-06 04:51:04 +00:00
|
|
|
_vm(vm), _disk(vm->_disk), _scrollPos(0), _minScroll(0), _maxScroll(0) {
|
|
|
|
|
|
|
|
_gameType = _vm->getGameType();
|
|
|
|
_doubleBuffering = _gameType != GType_Nippon;
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-12-06 04:51:04 +00:00
|
|
|
initGraphics(_vm->_screenWidth, _vm->_screenHeight, _gameType == GType_BRA);
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2007-08-09 18:02:37 +00:00
|
|
|
setPalette(_palette);
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-07-02 01:41:08 +00:00
|
|
|
_floatingLabel = NO_FLOATING_LABEL;
|
2007-11-21 20:04:14 +00:00
|
|
|
|
2008-07-31 12:26:12 +00:00
|
|
|
_backgroundInfo = 0;
|
|
|
|
|
2007-04-21 12:51:40 +00:00
|
|
|
_halfbrite = false;
|
2008-11-01 12:39:01 +00:00
|
|
|
_nextProjectorPos = 0;
|
2008-01-06 20:42:28 +00:00
|
|
|
_hbCircleRadius = 0;
|
2007-04-21 12:51:40 +00:00
|
|
|
|
2008-07-15 10:59:58 +00:00
|
|
|
_unpackedBitmap = new byte[MAXIMUM_UNPACKED_BITMAP_SIZE];
|
|
|
|
assert(_unpackedBitmap);
|
|
|
|
|
2008-12-06 04:51:04 +00:00
|
|
|
if ((_gameType == GType_BRA) && (_vm->getPlatform() == Common::kPlatformPC)) {
|
2008-07-28 06:06:35 +00:00
|
|
|
// this loads the backup palette needed by the PC version of BRA (see setBackground()).
|
|
|
|
BackgroundInfo paletteInfo;
|
|
|
|
_disk->loadSlide(paletteInfo, "pointer");
|
|
|
|
_backupPal.clone(paletteInfo.palette);
|
|
|
|
}
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-12 20:41:25 +00:00
|
|
|
Gfx::~Gfx() {
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-12-07 12:41:50 +00:00
|
|
|
_backBuffer.free();
|
|
|
|
|
2008-07-31 12:26:12 +00:00
|
|
|
delete _backgroundInfo;
|
|
|
|
|
2008-07-09 13:27:09 +00:00
|
|
|
freeLabels();
|
2008-01-28 17:28:16 +00:00
|
|
|
|
2008-07-15 10:59:58 +00:00
|
|
|
delete []_unpackedBitmap;
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-08-12 08:47:45 +00:00
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2008-06-29 09:30:32 +00:00
|
|
|
int Gfx::setItem(GfxObj* frames, uint16 x, uint16 y, byte transparentColor) {
|
2008-12-13 17:31:48 +00:00
|
|
|
int id = _items.size();
|
|
|
|
|
|
|
|
frames->x = x;
|
|
|
|
frames->y = y;
|
|
|
|
frames->transparentKey = transparentColor;
|
|
|
|
frames->layer = LAYER_FOREGROUND;
|
|
|
|
frames->setFlags(kGfxObjVisible);
|
2008-01-06 19:29:41 +00:00
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
_items.insert_at(id, frames);
|
2008-02-02 12:18:36 +00:00
|
|
|
|
2008-12-13 17:31:48 +00:00
|
|
|
setItemFrame(id, 0);
|
2008-01-06 19:29:41 +00:00
|
|
|
|
2008-01-06 20:42:28 +00:00
|
|
|
return id;
|
2007-11-22 21:19:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Gfx::setItemFrame(uint item, uint16 f) {
|
2008-12-13 17:31:48 +00:00
|
|
|
_items[item]->frame = f;
|
2007-11-22 21:19:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-03 10:31:25 +00:00
|
|
|
GfxObj* Gfx::registerBalloon(Frames *frames, const char *text) {
|
|
|
|
|
|
|
|
GfxObj *obj = new GfxObj(kGfxObjTypeBalloon, frames, text);
|
|
|
|
|
|
|
|
obj->layer = LAYER_FOREGROUND;
|
|
|
|
obj->frame = 0;
|
|
|
|
obj->setFlags(kGfxObjVisible);
|
|
|
|
|
|
|
|
_balloons.push_back(obj);
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2008-12-24 09:51:07 +00:00
|
|
|
void Gfx::freeDialogueObjects() {
|
|
|
|
_items.clear();
|
|
|
|
|
|
|
|
_vm->_balloonMan->reset();
|
|
|
|
|
2008-07-04 00:29:21 +00:00
|
|
|
for (uint i = 0; i < _balloons.size(); i++) {
|
|
|
|
delete _balloons[i];
|
2008-01-06 20:42:28 +00:00
|
|
|
}
|
2008-07-03 10:31:25 +00:00
|
|
|
_balloons.clear();
|
2007-11-22 21:19:44 +00:00
|
|
|
}
|
|
|
|
|
2008-07-31 12:50:43 +00:00
|
|
|
void Gfx::setBackground(uint type, BackgroundInfo *info) {
|
2008-07-31 12:26:12 +00:00
|
|
|
delete _backgroundInfo;
|
2008-07-31 12:50:43 +00:00
|
|
|
_backgroundInfo = info;
|
2008-02-02 10:18:31 +00:00
|
|
|
|
2008-01-28 17:28:16 +00:00
|
|
|
if (type == kBackgroundLocation) {
|
2008-07-28 06:06:35 +00:00
|
|
|
// The PC version of BRA needs the entries 20-31 of the palette to be constant, but
|
|
|
|
// the background resource files are screwed up. The right colors come from an unused
|
|
|
|
// bitmap (pointer.bmp). Nothing is known about the Amiga version so far.
|
|
|
|
if ((_vm->getGameType() == GType_BRA) && (_vm->getPlatform() == Common::kPlatformPC)) {
|
|
|
|
int r, g, b;
|
|
|
|
for (uint i = 16; i < 32; i++) {
|
|
|
|
_backupPal.getEntry(i, r, g, b);
|
2008-07-31 12:26:12 +00:00
|
|
|
_backgroundInfo->palette.setEntry(i, r, g, b);
|
2008-07-28 06:06:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-31 12:26:12 +00:00
|
|
|
setPalette(_backgroundInfo->palette);
|
|
|
|
_palette.clone(_backgroundInfo->palette);
|
2008-01-28 17:28:16 +00:00
|
|
|
} else {
|
2008-07-24 09:24:32 +00:00
|
|
|
for (uint i = 0; i < 6; i++)
|
2008-07-31 12:26:12 +00:00
|
|
|
_backgroundInfo->ranges[i]._flags = 0; // disable palette cycling for slides
|
|
|
|
setPalette(_backgroundInfo->palette);
|
2008-01-28 17:28:16 +00:00
|
|
|
}
|
2008-12-06 04:51:04 +00:00
|
|
|
|
2008-12-20 08:15:09 +00:00
|
|
|
if (_backgroundInfo->hasMask) {
|
|
|
|
_backgroundInfo->maskBackup.clone(_backgroundInfo->mask);
|
|
|
|
}
|
|
|
|
|
2008-12-06 04:51:04 +00:00
|
|
|
if (_gameType == GType_BRA) {
|
2008-12-07 09:21:01 +00:00
|
|
|
int width = CLIP(info->width, (int)_vm->_screenWidth, info->width);
|
|
|
|
int height = CLIP(info->height, (int)_vm->_screenHeight, info->height);
|
2008-12-06 04:51:04 +00:00
|
|
|
|
|
|
|
if (width != _backBuffer.w || height != _backBuffer.h) {
|
|
|
|
_backBuffer.create(width, height, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_minScroll = 0;
|
2008-12-25 00:18:01 +00:00
|
|
|
_maxScroll = MAX<int>(0, _backgroundInfo->width - _vm->_screenWidth);
|
2008-01-28 17:28:16 +00:00
|
|
|
}
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
} // namespace Parallaction
|