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.
|
2005-04-05 15:53:16 +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.
|
2014-02-18 01:34:20 +00:00
|
|
|
*
|
2005-04-05 15:53:16 +00:00
|
|
|
* 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
|
2005-04-05 15:53:16 +00:00
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:20 +00:00
|
|
|
*
|
2005-04-05 15:53:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2005-04-09 19:19:54 +00:00
|
|
|
* 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.
|
2005-04-05 15:53:16 +00:00
|
|
|
*
|
|
|
|
*/
|
2006-03-29 15:59:37 +00:00
|
|
|
|
|
|
|
#include "common/endian.h"
|
2010-10-15 13:54:23 +00:00
|
|
|
#include "common/str.h"
|
2006-03-29 15:59:37 +00:00
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
#include "gob/gob.h"
|
|
|
|
#include "gob/draw.h"
|
|
|
|
#include "gob/global.h"
|
|
|
|
#include "gob/util.h"
|
2009-07-09 02:54:10 +00:00
|
|
|
#include "gob/dataio.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/game.h"
|
2009-09-29 22:43:30 +00:00
|
|
|
#include "gob/resources.h"
|
2009-06-22 10:13:37 +00:00
|
|
|
#include "gob/script.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
#include "gob/inter.h"
|
|
|
|
#include "gob/video.h"
|
2007-08-03 15:18:00 +00:00
|
|
|
#include "gob/palanim.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
namespace Gob {
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
Draw::Draw(GobEngine *vm) : _vm(vm) {
|
2007-03-20 14:51:57 +00:00
|
|
|
_renderFlags = 0;
|
2006-04-18 09:59:18 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_fontIndex = 0;
|
|
|
|
_spriteLeft = 0;
|
|
|
|
_spriteTop = 0;
|
|
|
|
_spriteRight = 0;
|
|
|
|
_spriteBottom = 0;
|
|
|
|
_destSpriteX = 0;
|
|
|
|
_destSpriteY = 0;
|
|
|
|
_backColor = 0;
|
|
|
|
_frontColor = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
_transparency = 0;
|
2006-01-07 22:28:54 +00:00
|
|
|
|
|
|
|
_sourceSurface = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
_destSurface = 0;
|
|
|
|
|
|
|
|
_letterToPrint = 0;
|
|
|
|
_textToPrint = 0;
|
2009-09-29 22:43:30 +00:00
|
|
|
_hotspotText = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_backDeltaX = 0;
|
|
|
|
_backDeltaY = 0;
|
2006-02-03 07:30:29 +00:00
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
for (int i = 0; i < kFontCount; i++)
|
2006-01-07 22:28:54 +00:00
|
|
|
_fonts[i] = 0;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2011-02-02 16:49:20 +00:00
|
|
|
_spritesArray.resize(kSpriteCount);
|
2009-06-06 21:37:30 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedCount = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < 30; i++) {
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedTops[i] = 0;
|
|
|
|
_invalidatedLefts[i] = 0;
|
|
|
|
_invalidatedRights[i] = 0;
|
|
|
|
_invalidatedBottoms[i] = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_noInvalidated = false;
|
|
|
|
_noInvalidated57 = false;
|
|
|
|
_paletteCleared = false;
|
|
|
|
_applyPal = false;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < 18; i++)
|
2006-01-07 22:28:54 +00:00
|
|
|
_unusedPalette1[i] = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < 16; i++)
|
2006-01-07 22:28:54 +00:00
|
|
|
_unusedPalette2[i] = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < 256; i++) {
|
2006-01-07 22:28:54 +00:00
|
|
|
_vgaPalette[i].red = 0;
|
|
|
|
_vgaPalette[i].blue = 0;
|
|
|
|
_vgaPalette[i].green = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
}
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < 16; i++) {
|
2006-01-07 22:28:54 +00:00
|
|
|
_vgaSmallPalette[i].red = 0;
|
|
|
|
_vgaSmallPalette[i].blue = 0;
|
|
|
|
_vgaSmallPalette[i].green = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_showCursor = 0;
|
|
|
|
_cursorIndex = 0;
|
|
|
|
_transparentCursor = 0;
|
|
|
|
_cursorTimeKey = 0;
|
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_cursorX = 0;
|
|
|
|
_cursorY = 0;
|
|
|
|
_cursorWidth = 0;
|
|
|
|
_cursorHeight = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_cursorHotspotXVar = -1;
|
|
|
|
_cursorHotspotYVar = -1;
|
|
|
|
|
2011-09-04 17:34:38 +00:00
|
|
|
_cursorHotspotX = -1;
|
|
|
|
_cursorHotspotY = -1;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_cursorAnim = 0;
|
|
|
|
for (int i = 0; i < 40; i++) {
|
2006-01-07 22:28:54 +00:00
|
|
|
_cursorAnimLow[i] = 0;
|
|
|
|
_cursorAnimHigh[i] = 0;
|
|
|
|
_cursorAnimDelays[i] = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
}
|
|
|
|
|
2012-05-29 15:12:06 +00:00
|
|
|
_cursorCount = 0;
|
|
|
|
_doCursorPalettes = 0;
|
2012-05-29 12:16:31 +00:00
|
|
|
_cursorPalettes = 0;
|
|
|
|
_cursorKeyColors = 0;
|
|
|
|
_cursorPaletteStarts = 0;
|
|
|
|
_cursorPaletteCounts = 0;
|
|
|
|
_cursorHotspotsX = 0;
|
|
|
|
_cursorHotspotsY = 0;
|
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_palLoadData1[0] = 0;
|
|
|
|
_palLoadData1[1] = 17;
|
|
|
|
_palLoadData1[2] = 34;
|
|
|
|
_palLoadData1[3] = 51;
|
|
|
|
_palLoadData2[0] = 0;
|
|
|
|
_palLoadData2[1] = 68;
|
|
|
|
_palLoadData2[2] = 136;
|
|
|
|
_palLoadData2[3] = 204;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_needAdjust = 2;
|
2007-02-06 14:42:05 +00:00
|
|
|
_scrollOffsetX = 0;
|
|
|
|
_scrollOffsetY = 0;
|
2009-09-15 12:15:22 +00:00
|
|
|
|
|
|
|
_pattern = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
}
|
|
|
|
|
2008-12-14 04:33:28 +00:00
|
|
|
Draw::~Draw() {
|
2012-05-29 12:16:31 +00:00
|
|
|
delete[] _cursorPalettes;
|
2012-05-29 15:12:06 +00:00
|
|
|
delete[] _doCursorPalettes;
|
2012-05-29 12:16:31 +00:00
|
|
|
delete[] _cursorKeyColors;
|
|
|
|
delete[] _cursorPaletteStarts;
|
|
|
|
delete[] _cursorPaletteCounts;
|
|
|
|
delete[] _cursorHotspotsX;
|
|
|
|
delete[] _cursorHotspotsY;
|
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
for (int i = 0; i < kFontCount; i++)
|
2008-12-14 04:33:28 +00:00
|
|
|
delete _fonts[i];
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Draw::invalidateRect(int16 left, int16 top, int16 right, int16 bottom) {
|
2008-12-04 18:38:55 +00:00
|
|
|
if (_renderFlags & RENDERFLAG_NOINVALIDATE) {
|
|
|
|
_vm->_video->dirtyRectsAll();
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
2008-12-04 18:38:55 +00:00
|
|
|
}
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (left > right)
|
|
|
|
SWAP(left, right);
|
|
|
|
if (top > bottom)
|
|
|
|
SWAP(top, bottom);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-02-06 14:42:05 +00:00
|
|
|
if ((left > (_vm->_video->_surfWidth - 1)) || (right < 0) ||
|
2007-03-20 14:51:57 +00:00
|
|
|
(top > (_vm->_video->_surfHeight - 1)) || (bottom < 0))
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_noInvalidated = false;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_invalidatedCount >= 30) {
|
|
|
|
_invalidatedLefts[0] = 0;
|
|
|
|
_invalidatedTops[0] = 0;
|
2007-01-29 17:04:37 +00:00
|
|
|
_invalidatedRights[0] = _vm->_video->_surfWidth - 1;
|
2007-02-06 14:42:05 +00:00
|
|
|
_invalidatedBottoms[0] = _vm->_video->_surfHeight - 1;
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedCount = 1;
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (left < 0)
|
|
|
|
left = 0;
|
|
|
|
|
2007-01-29 17:04:37 +00:00
|
|
|
if (right > (_vm->_video->_surfWidth - 1))
|
|
|
|
right = _vm->_video->_surfWidth - 1;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (top < 0)
|
|
|
|
top = 0;
|
|
|
|
|
2007-02-06 14:42:05 +00:00
|
|
|
if (bottom > (_vm->_video->_surfHeight - 1))
|
|
|
|
bottom = _vm->_video->_surfHeight - 1;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
left &= 0xFFF0;
|
|
|
|
right |= 0x000F;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int rect = 0; rect < _invalidatedCount; rect++) {
|
2006-01-07 22:28:54 +00:00
|
|
|
|
|
|
|
if (_invalidatedTops[rect] > top) {
|
|
|
|
if (_invalidatedTops[rect] > bottom) {
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = _invalidatedCount; i > rect; i--) {
|
|
|
|
_invalidatedLefts[i] = _invalidatedLefts[i - 1];
|
|
|
|
_invalidatedTops[i] = _invalidatedTops[i - 1];
|
|
|
|
_invalidatedRights[i] = _invalidatedRights[i - 1];
|
|
|
|
_invalidatedBottoms[i] = _invalidatedBottoms[i - 1];
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedLefts[rect] = left;
|
|
|
|
_invalidatedTops[rect] = top;
|
|
|
|
_invalidatedRights[rect] = right;
|
|
|
|
_invalidatedBottoms[rect] = bottom;
|
|
|
|
_invalidatedCount++;
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_invalidatedBottoms[rect] < bottom)
|
|
|
|
_invalidatedBottoms[rect] = bottom;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_invalidatedLefts[rect] > left)
|
|
|
|
_invalidatedLefts[rect] = left;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_invalidatedRights[rect] < right)
|
|
|
|
_invalidatedRights[rect] = right;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedTops[rect] = top;
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_invalidatedBottoms[rect] < top)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_invalidatedBottoms[rect] < bottom)
|
|
|
|
_invalidatedBottoms[rect] = bottom;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_invalidatedLefts[rect] > left)
|
|
|
|
_invalidatedLefts[rect] = left;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_invalidatedRights[rect] < right)
|
|
|
|
_invalidatedRights[rect] = right;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedLefts[_invalidatedCount] = left;
|
|
|
|
_invalidatedTops[_invalidatedCount] = top;
|
|
|
|
_invalidatedRights[_invalidatedCount] = right;
|
|
|
|
_invalidatedBottoms[_invalidatedCount] = bottom;
|
|
|
|
_invalidatedCount++;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2008-05-22 18:30:29 +00:00
|
|
|
void Draw::blitInvalidated() {
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_noInvalidated57 &&
|
|
|
|
((_vm->_global->_videoMode == 5) || (_vm->_global->_videoMode == 7)))
|
|
|
|
return;
|
2007-02-07 13:08:17 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_cursorIndex == 4)
|
2006-01-03 23:14:39 +00:00
|
|
|
blitCursor();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2012-06-27 23:30:29 +00:00
|
|
|
if (_vm->_inter && _vm->_inter->_terminate)
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_noInvalidated && !_applyPal)
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
|
2011-01-22 12:26:31 +00:00
|
|
|
if (_vm->isTrueColor())
|
|
|
|
_applyPal = false;
|
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_noInvalidated) {
|
2006-01-03 23:14:39 +00:00
|
|
|
setPalette();
|
2007-03-20 14:51:57 +00:00
|
|
|
_applyPal = false;
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-06-28 15:45:02 +00:00
|
|
|
if (_cursorSprites)
|
|
|
|
_showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1);
|
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
if (_applyPal) {
|
2006-01-03 23:14:39 +00:00
|
|
|
clearPalette();
|
2008-05-22 18:30:29 +00:00
|
|
|
forceBlit();
|
2006-01-03 23:14:39 +00:00
|
|
|
setPalette();
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedCount = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
_noInvalidated = true;
|
|
|
|
_applyPal = false;
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_video->_doRangeClamp = false;
|
|
|
|
for (int i = 0; i < _invalidatedCount; i++) {
|
2010-09-30 13:02:16 +00:00
|
|
|
_frontSurface->blit(*_backSurface,
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedLefts[i], _invalidatedTops[i],
|
|
|
|
_invalidatedRights[i], _invalidatedBottoms[i],
|
2010-09-30 13:02:16 +00:00
|
|
|
_invalidatedLefts[i], _invalidatedTops[i]);
|
2008-12-04 18:38:55 +00:00
|
|
|
_vm->_video->dirtyRectsAdd(_invalidatedLefts[i], _invalidatedTops[i],
|
|
|
|
_invalidatedRights[i], _invalidatedBottoms[i]);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_video->_doRangeClamp = true;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_invalidatedCount = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
_noInvalidated = true;
|
|
|
|
_applyPal = false;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Draw::setPalette() {
|
|
|
|
_vm->validateVideoMode(_vm->_global->_videoMode);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_vm->_global->_pPaletteDesc->unused1 = _unusedPalette1;
|
|
|
|
_vm->_global->_pPaletteDesc->unused2 = _unusedPalette2;
|
|
|
|
_vm->_global->_pPaletteDesc->vgaPal = _vgaPalette;
|
2006-01-04 01:48:15 +00:00
|
|
|
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
|
2007-03-20 14:51:57 +00:00
|
|
|
_paletteCleared = false;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Draw::clearPalette() {
|
|
|
|
if (!_paletteCleared) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->clearPalette();
|
2007-03-20 14:51:57 +00:00
|
|
|
_paletteCleared = true;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-16 22:28:49 +00:00
|
|
|
uint32 Draw::getColor(uint8 index) const {
|
|
|
|
if (!_vm->isTrueColor())
|
|
|
|
return index;
|
|
|
|
|
|
|
|
return _vm->getPixelFormat().RGBToColor(_vgaPalette[index].red << 2,
|
|
|
|
_vgaPalette[index].green << 2,
|
|
|
|
_vgaPalette[index].blue << 2);
|
|
|
|
}
|
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
void Draw::dirtiedRect(int16 surface,
|
|
|
|
int16 left, int16 top, int16 right, int16 bottom) {
|
|
|
|
|
|
|
|
dirtiedRect(_spritesArray[surface], left, top, right, bottom);
|
|
|
|
}
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
void Draw::dirtiedRect(SurfacePtr surface,
|
2008-12-04 18:38:55 +00:00
|
|
|
int16 left, int16 top, int16 right, int16 bottom) {
|
|
|
|
|
|
|
|
if (surface == _backSurface)
|
|
|
|
invalidateRect(left, top, right, bottom);
|
|
|
|
else if (surface == _frontSurface)
|
|
|
|
_vm->_video->dirtyRectsAdd(left, top, right, bottom);
|
2009-07-24 21:31:58 +00:00
|
|
|
else if (_vm->_video->_splitSurf && (surface == _vm->_video->_splitSurf))
|
|
|
|
_vm->_video->retrace();
|
2008-12-04 18:38:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Draw::initSpriteSurf(int16 index, int16 width, int16 height,
|
|
|
|
int16 flags) {
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2011-02-02 16:48:04 +00:00
|
|
|
_spritesArray[index] = _vm->_video->initSurfDesc(width, height, flags);
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[index]->clear();
|
2006-02-16 20:25:59 +00:00
|
|
|
}
|
|
|
|
|
2011-01-20 10:20:57 +00:00
|
|
|
void Draw::freeSprite(int16 index) {
|
2011-02-02 16:49:20 +00:00
|
|
|
assert(index < kSpriteCount);
|
2011-01-20 10:20:57 +00:00
|
|
|
|
|
|
|
_spritesArray[index].reset();
|
|
|
|
|
|
|
|
if (index == kFrontSurface)
|
|
|
|
_spritesArray[index] = _frontSurface;
|
|
|
|
if (index == kBackSurface)
|
|
|
|
_spritesArray[index] = _backSurface;
|
|
|
|
}
|
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
void Draw::adjustCoords(char adjust, int16 *coord1, int16 *coord2) {
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_needAdjust == 2)
|
2006-04-18 09:59:18 +00:00
|
|
|
return;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
switch (adjust) {
|
|
|
|
case 0:
|
|
|
|
if (coord2)
|
|
|
|
*coord2 *= 2;
|
|
|
|
if (coord1)
|
2010-10-15 04:37:44 +00:00
|
|
|
*coord1 *= 2;
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
if (coord2)
|
|
|
|
*coord2 = (signed) ((unsigned) (*coord2 + 1) / 2);
|
|
|
|
if (coord1)
|
|
|
|
*coord1 = (signed) ((unsigned) (*coord1 + 1) / 2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
if (coord2)
|
|
|
|
*coord2 = *coord2 * 2 + 1;
|
|
|
|
if (coord1)
|
|
|
|
*coord1 = *coord1 * 2 + 1;
|
|
|
|
break;
|
2006-02-16 20:25:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-26 19:03:13 +00:00
|
|
|
int Draw::stringLength(const char *str, uint16 fontIndex) {
|
2009-04-27 18:56:28 +00:00
|
|
|
static const int8 japaneseExtraCharLen[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
2008-08-30 23:59:46 +00:00
|
|
|
|
2011-01-26 19:03:13 +00:00
|
|
|
if (fontIndex >= kFontCount) {
|
|
|
|
warning("Draw::stringLength(): Font %d > Count %d", fontIndex, kFontCount);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_fonts[fontIndex])
|
2008-08-30 23:59:46 +00:00
|
|
|
return 0;
|
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
Font &font = *_fonts[fontIndex];
|
|
|
|
|
2008-08-30 23:59:46 +00:00
|
|
|
int len = 0;
|
|
|
|
|
|
|
|
if (_vm->_global->_language == 10) {
|
|
|
|
|
|
|
|
for (int i = 0; str[i] != 0; i++) {
|
2008-08-31 11:37:07 +00:00
|
|
|
if (((unsigned char) str[i+1]) < 128) {
|
2009-04-27 18:56:28 +00:00
|
|
|
len += japaneseExtraCharLen[4];
|
2008-08-30 23:59:46 +00:00
|
|
|
i++;
|
|
|
|
} else
|
2009-07-09 02:54:10 +00:00
|
|
|
len += font.getCharWidth();
|
2008-08-30 23:59:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
if (!font.isMonospaced())
|
|
|
|
while (*str != '\0')
|
|
|
|
len += font.getCharWidth(*str++);
|
2008-08-30 23:59:46 +00:00
|
|
|
else
|
2009-07-09 02:54:10 +00:00
|
|
|
len = strlen(str) * font.getCharWidth();
|
2008-08-30 23:59:46 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right,
|
2008-08-30 23:59:46 +00:00
|
|
|
int16 bottom, const char *str, int16 fontIndex, int16 color) {
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
adjustCoords(1, &left, &top);
|
|
|
|
adjustCoords(1, &right, &bottom);
|
|
|
|
|
2012-06-27 23:30:29 +00:00
|
|
|
uint16 centerOffset = _vm->_game->_script ? _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter) : 0;
|
2009-06-23 01:23:14 +00:00
|
|
|
if (centerOffset != 0) {
|
|
|
|
_vm->_game->_script->call(centerOffset);
|
2007-04-02 11:05:09 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
WRITE_VAR(17, (uint32) id);
|
2006-04-18 09:59:18 +00:00
|
|
|
WRITE_VAR(18, (uint32) left);
|
|
|
|
WRITE_VAR(19, (uint32) top);
|
2007-03-20 14:51:57 +00:00
|
|
|
WRITE_VAR(20, (uint32) (right - left + 1));
|
|
|
|
WRITE_VAR(21, (uint32) (bottom - top + 1));
|
2006-04-18 09:59:18 +00:00
|
|
|
_vm->_inter->funcBlock(0);
|
2007-04-02 11:05:09 +00:00
|
|
|
|
2009-06-22 10:14:18 +00:00
|
|
|
_vm->_game->_script->pop();
|
2006-04-18 09:59:18 +00:00
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
if (str[0] == '\0')
|
|
|
|
return;
|
|
|
|
|
2011-01-26 19:03:13 +00:00
|
|
|
if (fontIndex >= kFontCount) {
|
|
|
|
warning("Draw::printTextCentered(): Font %d > Count %d", fontIndex, kFontCount);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_fonts[fontIndex])
|
|
|
|
return;
|
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
_transparency = 1;
|
|
|
|
_destSpriteX = left;
|
|
|
|
_destSpriteY = top;
|
|
|
|
_fontIndex = fontIndex;
|
|
|
|
_frontColor = color;
|
|
|
|
_textToPrint = str;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
Font &font = *_fonts[fontIndex];
|
|
|
|
|
|
|
|
int16 width = 0;
|
|
|
|
if (!font.isMonospaced()) {
|
|
|
|
const char *s = str;
|
|
|
|
while (*s != '\0')
|
|
|
|
width += font.getCharWidth(*s++);
|
2006-04-18 09:59:18 +00:00
|
|
|
}
|
2007-03-20 14:51:57 +00:00
|
|
|
else
|
2009-07-09 02:54:10 +00:00
|
|
|
width = strlen(str) * font.getCharWidth();
|
2006-04-18 09:59:18 +00:00
|
|
|
|
|
|
|
adjustCoords(1, &width, 0);
|
|
|
|
_destSpriteX += (right - left + 1 - width) / 2;
|
|
|
|
|
|
|
|
spriteOperation(DRAW_PRINTTEXT);
|
|
|
|
}
|
|
|
|
|
2009-10-28 14:53:35 +00:00
|
|
|
void Draw::oPlaytoons_sub_F_1B(uint16 id, int16 left, int16 top, int16 right, int16 bottom,
|
|
|
|
char *paramStr, int16 fontIndex, int16 var4, int16 shortId) {
|
|
|
|
|
|
|
|
int16 width;
|
2009-09-29 22:43:30 +00:00
|
|
|
char tmpStr[128];
|
|
|
|
|
2013-04-15 16:49:00 +00:00
|
|
|
Common::strlcpy(tmpStr, paramStr, 128);
|
2009-09-29 22:43:30 +00:00
|
|
|
adjustCoords(1, &left, &top);
|
|
|
|
adjustCoords(1, &right, &bottom);
|
|
|
|
|
2012-06-27 23:30:29 +00:00
|
|
|
uint16 centerOffset = _vm->_game->_script ? _vm->_game->_script->getFunctionOffset(TOTFile::kFunctionCenter) : 0;
|
2009-09-29 22:43:30 +00:00
|
|
|
if (centerOffset != 0) {
|
|
|
|
_vm->_game->_script->call(centerOffset);
|
|
|
|
|
|
|
|
WRITE_VAR(17, (uint32) id & 0x7FFF);
|
|
|
|
WRITE_VAR(18, (uint32) left);
|
2009-10-28 14:52:53 +00:00
|
|
|
WRITE_VAR(19, (uint32) top);
|
2009-09-29 22:43:30 +00:00
|
|
|
WRITE_VAR(20, (uint32) (right - left + 1));
|
|
|
|
WRITE_VAR(21, (uint32) (bottom - top + 1));
|
|
|
|
|
|
|
|
if (_vm->_game->_script->peekUint16(41) >= '4') {
|
|
|
|
WRITE_VAR(22, (uint32) fontIndex);
|
|
|
|
WRITE_VAR(23, (uint32) var4);
|
|
|
|
if (id & 0x8000)
|
|
|
|
WRITE_VAR(24, (uint32) 1);
|
|
|
|
else
|
|
|
|
WRITE_VAR(24, (uint32) 0);
|
|
|
|
WRITE_VAR(25, (uint32) shortId);
|
2010-10-15 13:54:23 +00:00
|
|
|
if (_hotspotText)
|
|
|
|
Common::strlcpy(_hotspotText, paramStr, 40);
|
2009-09-29 22:43:30 +00:00
|
|
|
}
|
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
_vm->_game->_script->pop();
|
|
|
|
}
|
2009-10-28 14:53:35 +00:00
|
|
|
|
2009-09-29 22:43:30 +00:00
|
|
|
strcpy(paramStr, tmpStr);
|
2009-10-28 14:53:35 +00:00
|
|
|
|
2011-01-26 19:03:13 +00:00
|
|
|
if (fontIndex >= kFontCount) {
|
|
|
|
warning("Draw::oPlaytoons_sub_F_1B(): Font %d > Count %d", fontIndex, kFontCount);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_fonts[fontIndex])
|
|
|
|
return;
|
|
|
|
|
2009-09-29 22:43:30 +00:00
|
|
|
if (*paramStr) {
|
|
|
|
_transparency = 1;
|
|
|
|
_fontIndex = fontIndex;
|
|
|
|
_frontColor = var4;
|
|
|
|
if (_vm->_game->_script->peekUint16(41) >= '4' && strchr(paramStr, 92)) {
|
|
|
|
char str[80];
|
|
|
|
char *str2;
|
|
|
|
int16 strLen= 0;
|
|
|
|
int16 offY, deltaY;
|
|
|
|
|
|
|
|
str2 = paramStr;
|
2009-10-28 14:52:53 +00:00
|
|
|
do {
|
2009-09-29 22:43:30 +00:00
|
|
|
strLen++;
|
|
|
|
str2++;
|
2009-10-28 14:52:53 +00:00
|
|
|
str2 = strchr(str2, 92);
|
2009-09-29 22:43:30 +00:00
|
|
|
} while (str2);
|
|
|
|
deltaY = (bottom - right + 1 - (strLen * _fonts[fontIndex]->getCharHeight())) / (strLen + 1);
|
|
|
|
offY = right + deltaY;
|
2009-10-28 14:53:35 +00:00
|
|
|
for (int i = 0; paramStr[i]; i++) {
|
|
|
|
int j = 0;
|
2009-09-29 22:43:30 +00:00
|
|
|
while (paramStr[i] && paramStr[i] != 92)
|
|
|
|
str[j++] = paramStr[i++];
|
|
|
|
str[j] = 0;
|
|
|
|
_destSpriteX = left;
|
|
|
|
_destSpriteY = offY;
|
|
|
|
_textToPrint = str;
|
|
|
|
width = stringLength(str, fontIndex);
|
|
|
|
adjustCoords(1, &width, NULL);
|
|
|
|
_destSpriteX += (top - left + 1 - width) / 2;
|
|
|
|
spriteOperation(DRAW_PRINTTEXT);
|
|
|
|
offY += deltaY + _fonts[fontIndex]->getCharHeight();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_destSpriteX = left;
|
2009-10-28 14:52:53 +00:00
|
|
|
if (_vm->_game->_script->peekUint16(41) >= '4')
|
2009-09-29 22:43:30 +00:00
|
|
|
_destSpriteY = right + (bottom - right + 1 - _fonts[fontIndex]->getCharHeight()) / 2;
|
2009-10-28 14:52:53 +00:00
|
|
|
else
|
2009-09-29 22:43:30 +00:00
|
|
|
_destSpriteY = right;
|
|
|
|
_textToPrint = paramStr;
|
|
|
|
width = stringLength(paramStr, fontIndex);
|
|
|
|
adjustCoords(1, &width, NULL);
|
|
|
|
_destSpriteX += (top - left + 1 - width) / 2;
|
|
|
|
spriteOperation(DRAW_PRINTTEXT);
|
|
|
|
}
|
|
|
|
}
|
2009-10-28 14:53:35 +00:00
|
|
|
|
2009-09-29 22:43:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-11-19 17:52:52 +00:00
|
|
|
int32 Draw::getSpriteRectSize(int16 index) {
|
2007-03-20 14:51:57 +00:00
|
|
|
if (!_spritesArray[index])
|
2006-11-19 17:52:52 +00:00
|
|
|
return 0;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
return _spritesArray[index]->getWidth() * _spritesArray[index]->getHeight();
|
2006-11-20 13:03:30 +00:00
|
|
|
}
|
|
|
|
|
2007-03-29 17:55:39 +00:00
|
|
|
void Draw::forceBlit(bool backwards) {
|
2009-06-06 20:03:13 +00:00
|
|
|
if (!_frontSurface || !_backSurface)
|
2007-03-29 17:55:39 +00:00
|
|
|
return;
|
|
|
|
if (_frontSurface == _backSurface)
|
|
|
|
return;
|
2011-01-20 10:20:57 +00:00
|
|
|
/*
|
2010-08-08 00:35:18 +00:00
|
|
|
if (_spritesArray[kFrontSurface] != _frontSurface)
|
2007-03-29 17:55:39 +00:00
|
|
|
return;
|
2010-08-08 00:35:18 +00:00
|
|
|
if (_spritesArray[kBackSurface] != _backSurface)
|
2007-03-29 17:55:39 +00:00
|
|
|
return;
|
2011-01-20 10:20:57 +00:00
|
|
|
*/
|
2007-03-29 17:55:39 +00:00
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
if (!backwards) {
|
2010-09-30 13:02:16 +00:00
|
|
|
_frontSurface->blit(*_backSurface);
|
2008-12-04 18:38:55 +00:00
|
|
|
_vm->_video->dirtyRectsAll();
|
|
|
|
} else
|
2010-09-30 13:02:16 +00:00
|
|
|
_backSurface->blit(*_frontSurface);
|
2008-12-04 18:38:55 +00:00
|
|
|
|
2007-03-29 17:55:39 +00:00
|
|
|
}
|
|
|
|
|
2007-08-03 15:18:00 +00:00
|
|
|
const int16 Draw::_wobbleTable[360] = {
|
|
|
|
0x0000, 0x011D, 0x023B, 0x0359, 0x0476, 0x0593, 0x06B0, 0x07CC, 0x08E8,
|
|
|
|
0x0A03, 0x0B1D, 0x0C36, 0x0D4E, 0x0E65, 0x0F7B, 0x1090, 0x11A4, 0x12B6,
|
|
|
|
0x13C6, 0x14D6, 0x15E3, 0x16EF, 0x17F9, 0x1901, 0x1A07, 0x1B0C, 0x1C0E,
|
|
|
|
0x1D0E, 0x1E0B, 0x1F07, 0x2000, 0x20F6, 0x21EA, 0x22DB, 0x23C9, 0x24B5,
|
|
|
|
0x259E, 0x2684, 0x2766, 0x2846, 0x2923, 0x29FC, 0x2AD3, 0x2BA5, 0x2C75,
|
|
|
|
0x2D41, 0x2E09, 0x2ECE, 0x2F8F, 0x304D, 0x3106, 0x31BC, 0x326E, 0x331C,
|
|
|
|
0x33C6, 0x346C, 0x350E, 0x35AC, 0x3646, 0x36DB, 0x376C, 0x37F9, 0x3882,
|
|
|
|
0x3906, 0x3985, 0x3A00, 0x3A77, 0x3AE9, 0x3B56, 0x3BBF, 0x3C23, 0x3C83,
|
|
|
|
0x3CDE, 0x3D34, 0x3D85, 0x3DD1, 0x3E19, 0x3E5C, 0x3E99, 0x3ED2, 0x3F07,
|
|
|
|
0x3F36, 0x3F60, 0x3F85, 0x3FA6, 0x3FC1, 0x3FD8, 0x3FE9, 0x3FF6, 0x3FFD,
|
|
|
|
0x4000, 0x3FFD, 0x3FF6, 0x3FE9, 0x3FD8, 0x3FC1, 0x3FA6, 0x3F85, 0x3F60,
|
|
|
|
0x3F36, 0x3F07, 0x3ED2, 0x3E99, 0x3E5C, 0x3E19, 0x3DD1, 0x3D85, 0x3D34,
|
|
|
|
0x3CDE, 0x3C83, 0x3C23, 0x3BBF, 0x3B56, 0x3AE9, 0x3A77, 0x3A00, 0x3985,
|
|
|
|
0x3906, 0x3882, 0x37F9, 0x376C, 0x36DB, 0x3646, 0x35AC, 0x350E, 0x346C,
|
|
|
|
0x33C6, 0x331C, 0x326E, 0x31BC, 0x3106, 0x304D, 0x2F8F, 0x2ECE, 0x2E09,
|
|
|
|
0x2D41, 0x2C75, 0x2BA5, 0x2AD3, 0x29FC, 0x2923, 0x2846, 0x2766, 0x2684,
|
|
|
|
0x259E, 0x24B5, 0x23C9, 0x22DB, 0x21EA, 0x20F6, 0x1FFF, 0x1F07, 0x1E0B,
|
|
|
|
0x1D0E, 0x1C0E, 0x1B0C, 0x1A07, 0x1901, 0x17F9, 0x16EF, 0x15E3, 0x14D6,
|
|
|
|
0x13C6, 0x12B6, 0x11A4, 0x1090, 0x0F7B, 0x0E65, 0x0D4E, 0x0C36, 0x0B1D,
|
|
|
|
0x0A03, 0x08E8, 0x07CC, 0x06B0, 0x0593, 0x0476, 0x0359, 0x023B, 0x011D
|
|
|
|
-0x0000, -0x011D, -0x023B, -0x0359, -0x0476, -0x0593, -0x06B0, -0x07CC, -0x08E8,
|
|
|
|
-0x0A03, -0x0B1D, -0x0C36, -0x0D4E, -0x0E65, -0x0F7B, -0x1090, -0x11A4, -0x12B6,
|
|
|
|
-0x13C6, -0x14D6, -0x15E3, -0x16EF, -0x17F9, -0x1901, -0x1A07, -0x1B0C, -0x1C0E,
|
|
|
|
-0x1D0E, -0x1E0B, -0x1F07, -0x2000, -0x20F6, -0x21EA, -0x22DB, -0x23C9, -0x24B5,
|
|
|
|
-0x259E, -0x2684, -0x2766, -0x2846, -0x2923, -0x29FC, -0x2AD3, -0x2BA5, -0x2C75,
|
|
|
|
-0x2D41, -0x2E09, -0x2ECE, -0x2F8F, -0x304D, -0x3106, -0x31BC, -0x326E, -0x331C,
|
|
|
|
-0x33C6, -0x346C, -0x350E, -0x35AC, -0x3646, -0x36DB, -0x376C, -0x37F9, -0x3882,
|
|
|
|
-0x3906, -0x3985, -0x3A00, -0x3A77, -0x3AE9, -0x3B56, -0x3BBF, -0x3C23, -0x3C83,
|
|
|
|
-0x3CDE, -0x3D34, -0x3D85, -0x3DD1, -0x3E19, -0x3E5C, -0x3E99, -0x3ED2, -0x3F07,
|
|
|
|
-0x3F36, -0x3F60, -0x3F85, -0x3FA6, -0x3FC1, -0x3FD8, -0x3FE9, -0x3FF6, -0x3FFD,
|
|
|
|
-0x4000, -0x3FFD, -0x3FF6, -0x3FE9, -0x3FD8, -0x3FC1, -0x3FA6, -0x3F85, -0x3F60,
|
|
|
|
-0x3F36, -0x3F07, -0x3ED2, -0x3E99, -0x3E5C, -0x3E19, -0x3DD1, -0x3D85, -0x3D34,
|
|
|
|
-0x3CDE, -0x3C83, -0x3C23, -0x3BBF, -0x3B56, -0x3AE9, -0x3A77, -0x3A00, -0x3985,
|
|
|
|
-0x3906, -0x3882, -0x37F9, -0x376C, -0x36DB, -0x3646, -0x35AC, -0x350E, -0x346C,
|
|
|
|
-0x33C6, -0x331C, -0x326E, -0x31BC, -0x3106, -0x304D, -0x2F8F, -0x2ECE, -0x2E09,
|
|
|
|
-0x2D41, -0x2C75, -0x2BA5, -0x2AD3, -0x29FC, -0x2923, -0x2846, -0x2766, -0x2684,
|
|
|
|
-0x259E, -0x24B5, -0x23C9, -0x22DB, -0x21EA, -0x20F6, -0x1FFF, -0x1F07, -0x1E0B,
|
|
|
|
-0x1D0E, -0x1C0E, -0x1B0C, -0x1A07, -0x1901, -0x17F9, -0x16EF, -0x15E3, -0x14D6,
|
|
|
|
-0x13C6, -0x12B6, -0x11A4, -0x1090, -0x0F7B, -0x0E65, -0x0D4E, -0x0C36, -0x0B1D,
|
|
|
|
-0x0A03, -0x08E8, -0x07CC, -0x06B0, -0x0593, -0x0476, -0x0359, -0x023B, -0x011D
|
|
|
|
};
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
void Draw::wobble(Surface &surfDesc) {
|
2007-08-03 15:18:00 +00:00
|
|
|
int16 amplitude = 32;
|
|
|
|
uint16 curFrame = 0;
|
|
|
|
uint16 frameWobble = 0;
|
|
|
|
uint16 rowWobble = 0;
|
|
|
|
int8 *offsets = new int8[_vm->_height];
|
|
|
|
|
|
|
|
_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, -1);
|
|
|
|
|
|
|
|
while (amplitude > 0) {
|
|
|
|
rowWobble = frameWobble;
|
|
|
|
frameWobble = (frameWobble + 20) % 360;
|
|
|
|
|
|
|
|
for (uint16 y = 0; y < _vm->_height; y++) {
|
|
|
|
offsets[y] = amplitude +
|
|
|
|
((_wobbleTable[rowWobble] * amplitude) / 0x4000);
|
|
|
|
|
|
|
|
rowWobble = (rowWobble + 20) % 360;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (curFrame++ & 16)
|
|
|
|
amplitude--;
|
|
|
|
|
|
|
|
for (uint16 y = 0; y < _vm->_height; y++)
|
2010-09-30 13:02:16 +00:00
|
|
|
_frontSurface->blit(surfDesc, 0, y, _vm->_width - 1, y, offsets[y], y);
|
2007-08-03 15:18:00 +00:00
|
|
|
|
|
|
|
_vm->_palAnim->fadeStep(0);
|
2008-12-04 18:38:55 +00:00
|
|
|
_vm->_video->dirtyRectsAll();
|
2007-08-03 15:18:00 +00:00
|
|
|
_vm->_video->waitRetrace();
|
|
|
|
}
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
_frontSurface->blit(surfDesc);
|
2007-08-03 15:18:00 +00:00
|
|
|
|
|
|
|
_applyPal = false;
|
|
|
|
_invalidatedCount = 0;
|
|
|
|
_noInvalidated = true;
|
2008-12-04 18:38:55 +00:00
|
|
|
_vm->_video->dirtyRectsAll();
|
2007-08-03 15:18:00 +00:00
|
|
|
|
|
|
|
delete[] offsets;
|
|
|
|
}
|
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
Font *Draw::loadFont(const char *path) const {
|
2010-10-31 20:07:14 +00:00
|
|
|
if (!_vm->_dataIO->hasFile(path))
|
2009-07-09 02:54:10 +00:00
|
|
|
return 0;
|
|
|
|
|
2010-10-31 20:07:14 +00:00
|
|
|
int32 size;
|
|
|
|
byte *data = _vm->_dataIO->getFile(path, size);
|
2009-07-09 02:54:10 +00:00
|
|
|
|
|
|
|
return new Font(data);
|
|
|
|
}
|
|
|
|
|
2011-01-26 19:03:13 +00:00
|
|
|
bool Draw::loadFont(uint16 fontIndex, const char *path) {
|
|
|
|
if (fontIndex >= kFontCount) {
|
|
|
|
warning("Draw::loadFont(): Font %d > Count %d (\"%s\")", fontIndex, kFontCount, path);
|
2009-07-09 02:54:10 +00:00
|
|
|
return false;
|
2011-01-26 19:03:13 +00:00
|
|
|
}
|
2009-07-09 02:54:10 +00:00
|
|
|
|
|
|
|
delete _fonts[fontIndex];
|
|
|
|
|
|
|
|
_fonts[fontIndex] = loadFont(path);
|
|
|
|
|
|
|
|
return _fonts[fontIndex] != 0;
|
|
|
|
}
|
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
} // End of namespace Gob
|