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.
|
2006-04-13 16:25:07 +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
|
2006-04-13 16:25:07 +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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/endian.h"
|
2006-07-09 18:54:12 +00:00
|
|
|
#include "graphics/cursorman.h"
|
2006-04-13 16:25:07 +00:00
|
|
|
|
|
|
|
#include "gob/gob.h"
|
|
|
|
#include "gob/draw.h"
|
2009-05-21 17:12:33 +00:00
|
|
|
#include "gob/helper.h"
|
2006-04-13 16:25:07 +00:00
|
|
|
#include "gob/global.h"
|
|
|
|
#include "gob/util.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/game.h"
|
2009-06-24 21:49:37 +00:00
|
|
|
#include "gob/resources.h"
|
2009-07-05 11:27:54 +00:00
|
|
|
#include "gob/hotspots.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/scenery.h"
|
2008-05-28 21:15:11 +00:00
|
|
|
#include "gob/inter.h"
|
2008-05-08 00:47:23 +00:00
|
|
|
#include "gob/sound/sound.h"
|
2006-04-13 16:25:07 +00:00
|
|
|
|
|
|
|
namespace Gob {
|
|
|
|
|
|
|
|
Draw_v1::Draw_v1(GobEngine *vm) : Draw(vm) {
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Draw_v1::initScreen() {
|
|
|
|
_backSurface = _vm->_video->initSurfDesc(_vm->_global->_videoMode, 320, 200, 0);
|
2009-07-05 11:28:57 +00:00
|
|
|
_frontSurface = _vm->_global->_primarySurfDesc;
|
|
|
|
|
|
|
|
_cursorSprites =
|
|
|
|
_vm->_video->initSurfDesc(_vm->_global->_videoMode, 32, 16, 2);
|
|
|
|
_scummvmCursor =
|
|
|
|
_vm->_video->initSurfDesc(_vm->_global->_videoMode, 16, 16, SCUMMVM_CURSOR);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_v1::closeScreen() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_v1::blitCursor() {
|
|
|
|
if (_cursorIndex == -1)
|
|
|
|
return;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_showCursor == 2)
|
|
|
|
_showCursor = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_v1::animateCursor(int16 cursor) {
|
|
|
|
int16 cursorIndex = cursor;
|
|
|
|
int16 newX = 0, newY = 0;
|
|
|
|
uint16 hotspotX = 0, hotspotY = 0;
|
|
|
|
|
|
|
|
_showCursor = 2;
|
|
|
|
|
|
|
|
if (cursorIndex == -1) {
|
2009-07-05 11:27:54 +00:00
|
|
|
cursorIndex =
|
|
|
|
_vm->_game->_hotspots->findCursor(_vm->_global->_inter_mouseX,
|
|
|
|
_vm->_global->_inter_mouseY);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
if (_cursorAnimLow[cursorIndex] == -1)
|
|
|
|
cursorIndex = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_cursorAnimLow[cursorIndex] != -1) {
|
|
|
|
if (cursorIndex == _cursorIndex) {
|
|
|
|
if (_cursorAnimDelays[_cursorIndex] != 0 &&
|
|
|
|
_cursorAnimDelays[_cursorIndex] * 10 +
|
|
|
|
_cursorTimeKey <= _vm->_util->getTimeKey()) {
|
|
|
|
_cursorAnim++;
|
|
|
|
_cursorTimeKey = _vm->_util->getTimeKey();
|
|
|
|
} else {
|
|
|
|
if (_noInvalidated && (_vm->_global->_inter_mouseX == _cursorX) &&
|
|
|
|
(_vm->_global->_inter_mouseY == _cursorY)) {
|
2007-03-29 17:55:39 +00:00
|
|
|
_vm->_video->waitRetrace();
|
2007-03-20 14:51:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_cursorIndex = cursorIndex;
|
|
|
|
if (_cursorAnimDelays[_cursorIndex] != 0) {
|
|
|
|
_cursorAnim =
|
|
|
|
_cursorAnimLow[_cursorIndex];
|
|
|
|
_cursorTimeKey = _vm->_util->getTimeKey();
|
|
|
|
} else {
|
|
|
|
_cursorAnim = _cursorIndex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_cursorAnimDelays[_cursorIndex] != 0 &&
|
|
|
|
(_cursorAnimHigh[_cursorIndex] < _cursorAnim ||
|
|
|
|
_cursorAnimLow[_cursorIndex] >
|
|
|
|
_cursorAnim)) {
|
|
|
|
_cursorAnim = _cursorAnimLow[_cursorIndex];
|
|
|
|
}
|
|
|
|
|
|
|
|
newX = _vm->_global->_inter_mouseX;
|
|
|
|
newY = _vm->_global->_inter_mouseY;
|
|
|
|
if (_cursorHotspotXVar != -1) {
|
|
|
|
newX -= hotspotX = (uint16) VAR(_cursorIndex + _cursorHotspotXVar);
|
|
|
|
newY -= hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar);
|
|
|
|
}
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
_scummvmCursor->clear();
|
|
|
|
_scummvmCursor->blit(*_cursorSprites,
|
2007-03-20 14:51:57 +00:00
|
|
|
cursorIndex * _cursorWidth, 0,
|
|
|
|
(cursorIndex + 1) * _cursorWidth - 1,
|
2010-09-30 13:02:16 +00:00
|
|
|
_cursorHeight - 1, 0, 0);
|
|
|
|
CursorMan.replaceCursor(_scummvmCursor->getData(),
|
2007-03-20 14:51:57 +00:00
|
|
|
_cursorWidth, _cursorHeight, hotspotX, hotspotY, 0);
|
|
|
|
|
|
|
|
if (_frontSurface != _backSurface) {
|
|
|
|
_showCursor = 3;
|
|
|
|
if (!_noInvalidated) {
|
|
|
|
int16 tmp = _cursorIndex;
|
|
|
|
_cursorIndex = -1;
|
|
|
|
blitInvalidated();
|
|
|
|
_cursorIndex = tmp;
|
|
|
|
} else {
|
2007-03-29 17:55:39 +00:00
|
|
|
_vm->_video->waitRetrace();
|
2007-03-20 14:51:57 +00:00
|
|
|
if (MIN(newY, _cursorY) < 50)
|
|
|
|
_vm->_util->delay(5);
|
|
|
|
_showCursor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
blitCursor();
|
|
|
|
|
|
|
|
_cursorX = newX;
|
|
|
|
_cursorY = newY;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_v1::printTotText(int16 id) {
|
|
|
|
byte *dataPtr;
|
|
|
|
byte *ptr, *ptrEnd;
|
|
|
|
byte cmd;
|
|
|
|
int16 destX, destY;
|
2006-04-13 16:25:07 +00:00
|
|
|
int16 val;
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 savedFlags;
|
|
|
|
int16 destSpriteX;
|
|
|
|
int16 spriteRight, spriteBottom;
|
2006-04-13 16:25:07 +00:00
|
|
|
char buf[20];
|
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->cdPlayMultMusic();
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
TextItem *textItem = _vm->_game->_resources->getTextItem(id);
|
|
|
|
if (!textItem)
|
2007-03-20 14:51:57 +00:00
|
|
|
return;
|
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
dataPtr = textItem->getData();
|
|
|
|
ptr = dataPtr;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
destX = READ_LE_UINT16(ptr) & 0x7FFF;
|
|
|
|
destY = READ_LE_UINT16(ptr + 2);
|
|
|
|
spriteRight = READ_LE_UINT16(ptr + 4);
|
|
|
|
spriteBottom = READ_LE_UINT16(ptr + 6);
|
|
|
|
ptr += 8;
|
|
|
|
|
2006-04-13 16:25:07 +00:00
|
|
|
if (_renderFlags & RENDERFLAG_CAPTUREPUSH) {
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_game->capturePush(destX, destY,
|
|
|
|
spriteRight - destX + 1, spriteBottom - destY + 1);
|
2006-04-13 16:25:07 +00:00
|
|
|
(*_vm->_scenery->_pCaptureCounter)++;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_destSpriteX = destX;
|
|
|
|
_destSpriteY = destY;
|
|
|
|
_spriteRight = spriteRight;
|
|
|
|
_spriteBottom = spriteBottom;
|
2010-08-08 00:35:18 +00:00
|
|
|
_destSurface = kBackSurface;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
|
|
|
_backColor = *ptr++;
|
|
|
|
_transparency = 1;
|
|
|
|
spriteOperation(DRAW_CLEARRECT);
|
|
|
|
|
|
|
|
_backColor = 0;
|
|
|
|
savedFlags = _renderFlags;
|
|
|
|
_renderFlags &= ~RENDERFLAG_NOINVALIDATE;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
while ((_destSpriteX = READ_LE_UINT16(ptr)) != -1) {
|
2006-04-13 16:25:07 +00:00
|
|
|
_destSpriteX += destX;
|
|
|
|
_destSpriteY = READ_LE_UINT16(ptr + 2) + destY;
|
|
|
|
_spriteRight = READ_LE_UINT16(ptr + 4) + destX;
|
|
|
|
_spriteBottom = READ_LE_UINT16(ptr + 6) + destY;
|
|
|
|
ptr += 8;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
cmd = *ptr++;
|
|
|
|
switch ((cmd & 0xF0) >> 4) {
|
|
|
|
case 0:
|
|
|
|
_frontColor = cmd & 0xF;
|
2006-04-13 16:25:07 +00:00
|
|
|
spriteOperation(DRAW_DRAWLINE);
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
_frontColor = cmd & 0xF;
|
2006-04-13 16:25:07 +00:00
|
|
|
spriteOperation(DRAW_DRAWBAR);
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
_backColor = cmd & 0xF;
|
2006-04-13 16:25:07 +00:00
|
|
|
spriteOperation(DRAW_FILLRECTABS);
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
2006-04-13 16:25:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ptr += 2;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
for (ptrEnd = ptr; *ptrEnd != 1; ptrEnd++) {
|
|
|
|
if (*ptrEnd == 3)
|
|
|
|
ptrEnd++;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (*ptrEnd == 2)
|
|
|
|
ptrEnd += 4;
|
2006-04-13 16:25:07 +00:00
|
|
|
}
|
2007-03-20 14:51:57 +00:00
|
|
|
ptrEnd++;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
|
|
|
while (*ptr != 1) {
|
|
|
|
cmd = *ptr;
|
|
|
|
if (cmd == 3) {
|
|
|
|
ptr++;
|
2007-03-20 14:51:57 +00:00
|
|
|
_fontIndex = (*ptr & 0xF0) >> 4;
|
|
|
|
_frontColor = *ptr & 0xF;
|
2006-04-13 16:25:07 +00:00
|
|
|
ptr++;
|
|
|
|
continue;
|
|
|
|
} else if (cmd == 2) {
|
|
|
|
ptr++;
|
|
|
|
_destSpriteX = destX + READ_LE_UINT16(ptr);
|
|
|
|
_destSpriteY = destY + READ_LE_UINT16(ptr + 2);
|
|
|
|
ptr += 4;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (*ptr != 0xBA) {
|
|
|
|
_letterToPrint = (char) *ptr;
|
2006-04-13 16:25:07 +00:00
|
|
|
spriteOperation(DRAW_DRAWLETTER);
|
|
|
|
_destSpriteX +=
|
2009-07-09 02:54:10 +00:00
|
|
|
_fonts[_fontIndex]->getCharWidth();
|
2006-04-13 16:25:07 +00:00
|
|
|
ptr++;
|
|
|
|
} else {
|
2007-03-20 14:51:57 +00:00
|
|
|
cmd = ptrEnd[17] & 0x7F;
|
2006-04-13 16:25:07 +00:00
|
|
|
if (cmd == 0) {
|
2007-03-20 14:51:57 +00:00
|
|
|
val = READ_LE_UINT16(ptrEnd + 18) * 4;
|
|
|
|
sprintf(buf, "%d", VAR_OFFSET(val));
|
2006-04-13 16:25:07 +00:00
|
|
|
} else if (cmd == 1) {
|
2007-03-20 14:51:57 +00:00
|
|
|
val = READ_LE_UINT16(ptrEnd + 18) * 4;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2007-03-30 17:52:31 +00:00
|
|
|
strncpy0(buf, GET_VARO_STR(val), 19);
|
2006-04-13 16:25:07 +00:00
|
|
|
} else {
|
2007-03-20 14:51:57 +00:00
|
|
|
val = READ_LE_UINT16(ptrEnd + 18) * 4;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
sprintf(buf, "%d", VAR_OFFSET(val));
|
2006-04-13 16:25:07 +00:00
|
|
|
if (buf[0] == '-') {
|
2007-03-20 14:51:57 +00:00
|
|
|
while (strlen(buf) - 1 < (uint32)ptrEnd[17]) {
|
2006-04-13 16:25:07 +00:00
|
|
|
_vm->_util->insertStr("0", buf, 1);
|
|
|
|
}
|
|
|
|
} else {
|
2007-03-20 14:51:57 +00:00
|
|
|
while (strlen(buf) - 1 < (uint32)ptrEnd[17]) {
|
2006-04-13 16:25:07 +00:00
|
|
|
_vm->_util->insertStr("0", buf, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_util->insertStr(",", buf, strlen(buf) + 1 - ptrEnd[17]);
|
2006-04-13 16:25:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_textToPrint = buf;
|
2007-03-20 14:51:57 +00:00
|
|
|
destSpriteX = _destSpriteX;
|
2006-04-13 16:25:07 +00:00
|
|
|
spriteOperation(DRAW_PRINTTEXT);
|
2007-03-20 14:51:57 +00:00
|
|
|
if (ptrEnd[17] & 0x80) {
|
2006-04-13 16:25:07 +00:00
|
|
|
if (ptr[1] == ' ') {
|
2009-07-09 02:54:10 +00:00
|
|
|
_destSpriteX += _fonts[_fontIndex]->getCharWidth();
|
2006-04-13 16:25:07 +00:00
|
|
|
while (ptr[1] == ' ')
|
|
|
|
ptr++;
|
|
|
|
if (ptr[1] == 2) {
|
|
|
|
if (READ_LE_UINT16(ptr + 4) == _destSpriteY)
|
|
|
|
ptr += 5;
|
|
|
|
}
|
|
|
|
} else if (ptr[1] == 2 && READ_LE_UINT16(ptr + 4) == _destSpriteY) {
|
|
|
|
ptr += 5;
|
2009-07-09 02:54:10 +00:00
|
|
|
_destSpriteX += _fonts[_fontIndex]->getCharWidth();
|
2006-04-13 16:25:07 +00:00
|
|
|
}
|
|
|
|
} else {
|
2009-07-09 02:54:10 +00:00
|
|
|
_destSpriteX = destSpriteX + _fonts[_fontIndex]->getCharWidth();
|
2006-04-13 16:25:07 +00:00
|
|
|
}
|
2007-03-20 14:51:57 +00:00
|
|
|
ptrEnd += 23;
|
2006-04-13 16:25:07 +00:00
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
delete textItem;
|
2006-04-13 16:25:07 +00:00
|
|
|
_renderFlags = savedFlags;
|
2009-06-24 21:49:37 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_renderFlags & RENDERFLAG_COLLISIONS)
|
2009-07-05 11:27:54 +00:00
|
|
|
_vm->_game->_hotspots->check(0, 0);
|
2006-04-13 16:25:07 +00:00
|
|
|
|
|
|
|
if ((_renderFlags & RENDERFLAG_CAPTUREPOP) && *_vm->_scenery->_pCaptureCounter != 0) {
|
|
|
|
(*_vm->_scenery->_pCaptureCounter)--;
|
|
|
|
_vm->_game->capturePop(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_v1::spriteOperation(int16 operation) {
|
|
|
|
int16 len;
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 x, y;
|
2006-04-13 16:25:07 +00:00
|
|
|
int16 perLine;
|
2009-06-24 21:49:37 +00:00
|
|
|
Resource *resource;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2009-07-21 12:14:36 +00:00
|
|
|
operation &= 0x0F;
|
|
|
|
|
2006-04-13 16:25:07 +00:00
|
|
|
if (_sourceSurface >= 100)
|
|
|
|
_sourceSurface -= 80;
|
|
|
|
if (_destSurface >= 100)
|
|
|
|
_destSurface -= 80;
|
|
|
|
|
|
|
|
if (_renderFlags & RENDERFLAG_USEDELTAS) {
|
2010-08-08 00:35:18 +00:00
|
|
|
if (_sourceSurface == kBackSurface) {
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteLeft += _backDeltaX;
|
|
|
|
_spriteTop += _backDeltaY;
|
|
|
|
}
|
|
|
|
|
2010-08-08 00:35:18 +00:00
|
|
|
if (_destSurface == kBackSurface) {
|
2006-04-13 16:25:07 +00:00
|
|
|
_destSpriteX += _backDeltaX;
|
|
|
|
_destSpriteY += _backDeltaY;
|
2007-03-20 14:51:57 +00:00
|
|
|
if ((operation == DRAW_DRAWLINE) ||
|
|
|
|
((operation >= DRAW_DRAWBAR) &&
|
|
|
|
(operation <= DRAW_FILLRECTABS))) {
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteRight += _backDeltaX;
|
|
|
|
_spriteBottom += _backDeltaY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
Font *font = 0;
|
2006-04-13 16:25:07 +00:00
|
|
|
switch (operation) {
|
|
|
|
case DRAW_BLITSURF:
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->blit(*_spritesArray[_sourceSurface],
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteLeft, _spriteTop,
|
|
|
|
_spriteLeft + _spriteRight - 1,
|
|
|
|
_spriteTop + _spriteBottom - 1,
|
2010-09-30 13:02:16 +00:00
|
|
|
_destSpriteX, _destSpriteY, (_transparency == 0) ? -1 : 0);
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
|
|
|
|
_destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_PUTPIXEL:
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->putPixel(_destSpriteX, _destSpriteY, _frontColor);
|
2008-12-04 18:38:55 +00:00
|
|
|
|
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _destSpriteX, _destSpriteY);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_FILLRECT:
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->fillRect(_destSpriteX, _destSpriteY,
|
2006-04-13 16:25:07 +00:00
|
|
|
_destSpriteX + _spriteRight - 1,
|
|
|
|
_destSpriteY + _spriteBottom - 1, _backColor);
|
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
|
|
|
|
_destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_DRAWLINE:
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->drawLine(_destSpriteX, _destSpriteY,
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteRight, _spriteBottom, _frontColor);
|
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_INVALIDATE:
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX - _spriteRight, _destSpriteY - _spriteBottom,
|
|
|
|
_destSpriteX + _spriteRight, _destSpriteY + _spriteBottom);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_LOADSPRITE:
|
2009-06-24 21:49:37 +00:00
|
|
|
resource = _vm->_game->_resources->getResource((uint16) _spriteLeft,
|
|
|
|
&_spriteRight, &_spriteBottom);
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
if (!resource)
|
2008-12-12 00:10:39 +00:00
|
|
|
break;
|
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
_vm->_video->drawPackedSprite(resource->getData(),
|
|
|
|
_spriteRight, _spriteBottom, _destSpriteX, _destSpriteY,
|
|
|
|
_transparency, *_spritesArray[_destSurface]);
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
|
|
|
|
_destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1);
|
2009-06-24 21:49:37 +00:00
|
|
|
|
|
|
|
delete resource;
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_PRINTTEXT:
|
2009-07-09 02:54:10 +00:00
|
|
|
font = _fonts[_fontIndex];
|
|
|
|
if (!font) {
|
|
|
|
warning("Trying to print \"%s\" with undefined font %d", _textToPrint, _fontIndex);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-04-13 16:25:07 +00:00
|
|
|
len = strlen(_textToPrint);
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
|
2009-07-09 02:54:10 +00:00
|
|
|
_destSpriteX + len * font->getCharWidth() - 1,
|
|
|
|
_destSpriteY + font->getCharHeight() - 1);
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < len; i++) {
|
2010-09-30 13:02:16 +00:00
|
|
|
font->drawLetter(*_spritesArray[_destSurface], _textToPrint[i],
|
|
|
|
_destSpriteX, _destSpriteY, _frontColor, _backColor, _transparency);
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2009-07-09 02:54:10 +00:00
|
|
|
_destSpriteX += font->getCharWidth();
|
2006-04-13 16:25:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_DRAWBAR:
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->drawLine(_destSpriteX, _spriteBottom,
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteRight, _spriteBottom, _frontColor);
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->drawLine(_destSpriteX, _destSpriteY,
|
2006-04-13 16:25:07 +00:00
|
|
|
_destSpriteX, _spriteBottom, _frontColor);
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->drawLine(_spriteRight, _destSpriteY,
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteRight, _spriteBottom, _frontColor);
|
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->drawLine(_destSpriteX, _destSpriteY,
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteRight, _destSpriteY, _frontColor);
|
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_CLEARRECT:
|
|
|
|
if (_backColor < 16) {
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->fillRect(_destSpriteX, _destSpriteY,
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteRight, _spriteBottom,
|
|
|
|
_backColor);
|
|
|
|
}
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_FILLRECTABS:
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->fillRect(_destSpriteX, _destSpriteY,
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteRight, _spriteBottom, _backColor);
|
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_DRAWLETTER:
|
2009-07-09 02:54:10 +00:00
|
|
|
font = _fonts[_fontIndex];
|
|
|
|
if (!font) {
|
|
|
|
warning("Trying to print \'%c\' with undefined font %d", _letterToPrint, _fontIndex);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-04-13 16:25:07 +00:00
|
|
|
if (_fontToSprite[_fontIndex].sprite == -1) {
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
|
2009-07-09 02:54:10 +00:00
|
|
|
_destSpriteX + font->getCharWidth() - 1,
|
|
|
|
_destSpriteY + font->getCharHeight() - 1);
|
2010-09-30 13:02:16 +00:00
|
|
|
font->drawLetter(*_spritesArray[_destSurface], _letterToPrint,
|
|
|
|
_destSpriteX, _destSpriteY, _frontColor, _backColor, _transparency);
|
2006-04-13 16:25:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
perLine =
|
2007-03-20 14:51:57 +00:00
|
|
|
_spritesArray[(int16)_fontToSprite[_fontIndex].sprite]->getWidth() /
|
|
|
|
_fontToSprite[_fontIndex].width;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
y = (_letterToPrint - _fontToSprite[_fontIndex].base) / perLine *
|
|
|
|
_fontToSprite[_fontIndex].height;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
x = (_letterToPrint - _fontToSprite[_fontIndex].base) % perLine *
|
|
|
|
_fontToSprite[_fontIndex].width;
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2008-12-04 18:38:55 +00:00
|
|
|
dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
|
|
|
|
_destSpriteX + _fontToSprite[_fontIndex].width,
|
|
|
|
_destSpriteY + _fontToSprite[_fontIndex].height);
|
2006-04-13 16:25:07 +00:00
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
_spritesArray[_destSurface]->blit(*_spritesArray[(int16)_fontToSprite[_fontIndex].sprite], x, y,
|
2006-04-13 16:25:07 +00:00
|
|
|
x + _fontToSprite[_fontIndex].width,
|
|
|
|
y + _fontToSprite[_fontIndex].height,
|
2010-09-30 13:02:16 +00:00
|
|
|
_destSpriteX, _destSpriteY, (_transparency == 0) ? -1 : 0);
|
2006-04-13 16:25:07 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_renderFlags & RENDERFLAG_USEDELTAS) {
|
2010-08-08 00:35:18 +00:00
|
|
|
if (_sourceSurface == kBackSurface) {
|
2006-04-13 16:25:07 +00:00
|
|
|
_spriteLeft -= _backDeltaX;
|
|
|
|
_spriteTop -= _backDeltaY;
|
|
|
|
}
|
|
|
|
|
2010-08-08 00:35:18 +00:00
|
|
|
if (_destSurface == kBackSurface) {
|
2006-04-13 16:25:07 +00:00
|
|
|
_destSpriteX -= _backDeltaX;
|
|
|
|
_destSpriteY -= _backDeltaY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Gob
|