aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Boutonné2009-09-15 12:15:22 +0000
committerArnaud Boutonné2009-09-15 12:15:22 +0000
commit6a9cc3b1e0675768d15ab43da5468eabd20c3179 (patch)
treef3bfcccd7ef54d7893cf1b543a62c7ac655917ee
parent28e09b9292270850d56c4cc1dbdd95ce8ead5d14 (diff)
downloadscummvm-rg350-6a9cc3b1e0675768d15ab43da5468eabd20c3179.tar.gz
scummvm-rg350-6a9cc3b1e0675768d15ab43da5468eabd20c3179.tar.bz2
scummvm-rg350-6a9cc3b1e0675768d15ab43da5468eabd20c3179.zip
- Implement _pattern variable
- Add oPlaytoons_putPixel and Playtoons specific spriteOperation (using _pattern) svn-id: r44103
-rw-r--r--dists/msvc8/gob.vcproj1
-rw-r--r--dists/msvc9/gob.vcproj2
-rw-r--r--engines/gob/draw.cpp2
-rw-r--r--engines/gob/draw.h9
-rw-r--r--engines/gob/draw_playtoons.cpp407
-rw-r--r--engines/gob/draw_v2.cpp3
-rw-r--r--engines/gob/gob.cpp2
-rw-r--r--engines/gob/hotspots.cpp70
-rw-r--r--engines/gob/hotspots.h7
-rw-r--r--engines/gob/inter.h1
-rw-r--r--engines/gob/inter_playtoons.cpp32
-rw-r--r--engines/gob/inter_v6.cpp7
-rw-r--r--engines/gob/module.mk1
13 files changed, 516 insertions, 28 deletions
diff --git a/dists/msvc8/gob.vcproj b/dists/msvc8/gob.vcproj
index 85f5e4bb86..cd96cadbd0 100644
--- a/dists/msvc8/gob.vcproj
+++ b/dists/msvc8/gob.vcproj
@@ -71,6 +71,7 @@
<File RelativePath="..\..\engines\gob\draw.h" />
<File RelativePath="..\..\engines\gob\draw_bargon.cpp" />
<File RelativePath="..\..\engines\gob\draw_fascin.cpp" />
+ <File RelativePath="..\..\engines\gob\draw_playtoons.cpp" />
<File RelativePath="..\..\engines\gob\draw_v1.cpp" />
<File RelativePath="..\..\engines\gob\draw_v2.cpp" />
<File RelativePath="..\..\engines\gob\driver_vga.cpp" />
diff --git a/dists/msvc9/gob.vcproj b/dists/msvc9/gob.vcproj
index 70932ee04d..833441ef5c 100644
--- a/dists/msvc9/gob.vcproj
+++ b/dists/msvc9/gob.vcproj
@@ -41,6 +41,7 @@
<File RelativePath="..\..\engines\gob\save\saveload_v3.cpp" />
<File RelativePath="..\..\engines\gob\save\saveload_v4.cpp" />
<File RelativePath="..\..\engines\gob\save\saveload_v6.cpp" />
+ <File RelativePath="..\..\engines\gob\save\saveload_fascination.cpp" />
<File RelativePath="..\..\engines\gob\save\saveload_playtoons.cpp" />
</Filter>
<Filter Name="sound">
@@ -72,6 +73,7 @@
<File RelativePath="..\..\engines\gob\draw.h" />
<File RelativePath="..\..\engines\gob\draw_bargon.cpp" />
<File RelativePath="..\..\engines\gob\draw_fascin.cpp" />
+ <File RelativePath="..\..\engines\gob\draw_playtoons.cpp" />
<File RelativePath="..\..\engines\gob\draw_v1.cpp" />
<File RelativePath="..\..\engines\gob\draw_v2.cpp" />
<File RelativePath="..\..\engines\gob\driver_vga.cpp" />
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 46f75f67aa..38d82e0825 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -126,6 +126,8 @@ Draw::Draw(GobEngine *vm) : _vm(vm) {
_needAdjust = 2;
_scrollOffsetX = 0;
_scrollOffsetY = 0;
+
+ _pattern = 0;
}
Draw::~Draw() {
diff --git a/engines/gob/draw.h b/engines/gob/draw.h
index c23501d62a..ef8149d514 100644
--- a/engines/gob/draw.h
+++ b/engines/gob/draw.h
@@ -138,6 +138,8 @@ public:
int16 _scrollOffsetY;
int16 _scrollOffsetX;
+ int16 _pattern;
+
void invalidateRect(int16 left, int16 top, int16 right, int16 bottom);
void blitInvalidated();
void setPalette();
@@ -228,6 +230,13 @@ public:
virtual ~Draw_Fascin() {}
};
+class Draw_Playtoons: public Draw_v2 {
+public:
+ Draw_Playtoons(GobEngine *vm);
+ virtual ~Draw_Playtoons() {}
+ virtual void spriteOperation(int16 operation);
+};
+
// Draw operations
#define DRAW_BLITSURF 0
diff --git a/engines/gob/draw_playtoons.cpp b/engines/gob/draw_playtoons.cpp
new file mode 100644
index 0000000000..9f2747d4e7
--- /dev/null
+++ b/engines/gob/draw_playtoons.cpp
@@ -0,0 +1,407 @@
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/endian.h"
+#include "graphics/cursorman.h"
+
+#include "gob/draw.h"
+#include "gob/game.h"
+#include "gob/resources.h"
+
+namespace Gob {
+
+Draw_Playtoons::Draw_Playtoons(GobEngine *vm) : Draw_v2(vm) {
+}
+
+void Draw_Playtoons::spriteOperation(int16 operation) {
+ int16 len;
+ int16 x, y;
+ SurfaceDescPtr sourceSurf, destSurf;
+ bool deltaVeto;
+ int16 left;
+ int16 ratio;
+ Resource *resource;
+
+ deltaVeto = (operation & 0x10) != 0;
+ operation &= 0x0F;
+
+ if (_sourceSurface >= 100)
+ _sourceSurface -= 80;
+ if (_destSurface >= 100)
+ _destSurface -= 80;
+
+ if ((_renderFlags & RENDERFLAG_USEDELTAS) && !deltaVeto) {
+ if ((_sourceSurface == 21) && (operation != DRAW_LOADSPRITE)) {
+ _spriteLeft += _backDeltaX;
+ _spriteTop += _backDeltaY;
+ }
+
+ if (_destSurface == 21) {
+ _destSpriteX += _backDeltaX;
+ _destSpriteY += _backDeltaY;
+ if ((operation == DRAW_DRAWLINE) ||
+ ((operation >= DRAW_DRAWBAR) && (operation <= DRAW_FILLRECTABS))) {
+ _spriteRight += _backDeltaX;
+ _spriteBottom += _backDeltaY;
+ }
+ }
+ }
+
+ int16 spriteLeft = _spriteLeft;
+ int16 spriteTop = _spriteTop;
+ int16 spriteRight = _spriteRight;
+ int16 spriteBottom = _spriteBottom;
+ int16 destSpriteX = _destSpriteX;
+ int16 destSpriteY = _destSpriteY;
+ int16 destSurface = _destSurface;
+ int16 sourceSurface = _sourceSurface;
+
+ if (_vm->_video->_splitSurf && ((_destSurface == 20) || (_destSurface == 21))) {
+ if ((_destSpriteY >= _vm->_video->_splitStart)) {
+ _destSpriteY -= _vm->_video->_splitStart;
+ if ((operation == DRAW_DRAWLINE) ||
+ ((operation >= DRAW_DRAWBAR) && (operation <= DRAW_FILLRECTABS)))
+ _spriteBottom -= _vm->_video->_splitStart;
+
+ _destSurface += 4;
+ }
+
+ if ((_spriteTop >= _vm->_video->_splitStart) && (operation == DRAW_BLITSURF)) {
+ _spriteTop -= _vm->_video->_splitStart;
+ if (_destSurface < 24)
+ _destSurface += 4;
+ }
+
+ }
+
+ adjustCoords(0, &_destSpriteX, &_destSpriteY);
+ if ((operation != DRAW_LOADSPRITE) && (_needAdjust != 2)) {
+ adjustCoords(0, &_spriteRight, &_spriteBottom);
+ adjustCoords(0, &_spriteLeft, &_spriteTop);
+
+ if (operation == DRAW_DRAWLINE) {
+ if ((_spriteRight == _destSpriteX) || (_spriteBottom == _destSpriteY)) {
+ operation = DRAW_FILLRECTABS;
+ _backColor = _frontColor;
+ }
+ } else if (operation == DRAW_DRAWLETTER)
+ operation = DRAW_BLITSURF;
+
+ if (operation == DRAW_DRAWLINE) {
+ if (_spriteBottom < _destSpriteY) {
+ SWAP(_spriteBottom, _destSpriteY);
+ SWAP(_spriteRight, _destSpriteX);
+ }
+ } else if ((operation == DRAW_LOADSPRITE) ||
+ (operation > DRAW_PRINTTEXT)) {
+ if (_spriteBottom < _destSpriteY)
+ SWAP(_spriteBottom, _destSpriteY);
+ if (_spriteRight < _destSpriteX)
+ SWAP(_spriteRight, _destSpriteX);
+ _spriteRight++;
+ _spriteBottom++;
+ }
+ }
+
+ sourceSurf = _spritesArray[_sourceSurface];
+ destSurf = _spritesArray[_destSurface];
+
+ if (!destSurf) {
+ warning("Can't do operation %d on surface %d: nonexistent", operation, _destSurface);
+ return;
+ }
+
+ switch (operation) {
+ case DRAW_BLITSURF:
+ case DRAW_DRAWLETTER:
+ if (!sourceSurf || !destSurf)
+ break;
+
+ _vm->_video->drawSprite(*_spritesArray[_sourceSurface],
+ *_spritesArray[_destSurface],
+ _spriteLeft, spriteTop,
+ _spriteLeft + _spriteRight - 1,
+ _spriteTop + _spriteBottom - 1,
+ _destSpriteX, _destSpriteY, _transparency);
+
+ dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
+ _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1);
+ break;
+
+ case DRAW_PUTPIXEL:
+ switch(_pattern & 0xFF) {
+ case -1:
+ case 1:
+ case 2:
+ case 3:
+ warning("oPlaytoons_spriteOperation: operation DRAW_PUTPIWEL, pattern %d", _pattern & 0xFF);
+ break;
+ default:
+ _vm->_video->putPixel(_destSpriteX, _destSpriteY, _frontColor, *_spritesArray[_destSurface]);
+ break;
+ }
+ dirtiedRect(_destSurface, _destSpriteX - (_pattern / 2),
+ _destSpriteY - (_pattern / 2),
+ _destSpriteX + (_pattern + 1) / 2,
+ _destSpriteY + (_pattern + 1) / 2);
+ break;
+ case DRAW_FILLRECT:
+ switch(_pattern & 0xFF) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ warning("oPlaytoons_spriteOperation: operation DRAW_FILLRECT, pattern %d", _pattern & 0xFF);
+ break;
+ case 0:
+ _vm->_video->fillRect(*_spritesArray[_destSurface], destSpriteX,
+ _destSpriteY, _destSpriteX + _spriteRight - 1,
+ _destSpriteY + _spriteBottom - 1, _backColor);
+
+ dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
+ _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1);
+ break;
+ default:
+ warning("oPlaytoons_spriteOperation: operation DRAW_FILLRECT, unexpected pattern %d", _pattern & 0xFF);
+ break;
+ }
+ break;
+
+ case DRAW_DRAWLINE:
+ if ((_needAdjust != 2) || (_needAdjust < 10)) {
+ warning ("oPlaytoons_spriteOperation: operation DRAW_DRAWLINE, draw multiple lines");
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY,
+ _spriteRight, _spriteBottom, _frontColor);
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX + 1, _destSpriteY,
+ _spriteRight + 1, _spriteBottom, _frontColor);
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY + 1,
+ _spriteRight, _spriteBottom + 1, _frontColor);
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX + 1, _destSpriteY + 1,
+ _spriteRight + 1, _spriteBottom + 1, _frontColor);
+ } else {
+ switch(_pattern & 0xFF) {
+ case 0:
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY,
+ _spriteRight, _spriteBottom, _frontColor);
+
+ break;
+ default:
+ warning("oPlaytoons_spriteOperation: operation DRAW_DRAWLINE, draw %d lines", (_pattern & 0xFF) * (_pattern & 0xFF));
+ for (int16 i = 0; i <= _pattern ; i++)
+ for (int16 j = 0; j <= _pattern ; j++)
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX - (_pattern / 2) + i,
+ _destSpriteY - (_pattern / 2) + j,
+ _spriteRight - (_pattern / 2) + i,
+ _spriteBottom - (_pattern / 2) + j,
+ _frontColor);
+ break;
+ }
+ }
+ dirtiedRect(_destSurface, MIN(_destSpriteX, _spriteRight) - _pattern,
+ MIN(_destSpriteY, _spriteBottom) - _pattern,
+ MAX(_destSpriteX, _spriteRight) + _pattern + 1,
+ MAX(_destSpriteY, _spriteBottom) + _pattern + 1);
+ break;
+
+ case DRAW_INVALIDATE:
+ if ((_pattern & 0xFF) != 0)
+ warning("oPlaytoons_spriteOperation: operation DRAW_INVALIDATE, pattern %d", _pattern & 0xFF);
+
+ _vm->_video->drawCircle(*_spritesArray[_destSurface], _destSpriteX,
+ _destSpriteY, _spriteRight, _frontColor);
+
+ dirtiedRect(_destSurface, _destSpriteX - _spriteRight, _destSpriteY - _spriteBottom,
+ _destSpriteX + _spriteRight, _destSpriteY + _spriteBottom);
+ break;
+
+ case DRAW_LOADSPRITE:
+ resource = _vm->_game->_resources->getResource((uint16) _spriteLeft,
+ &_spriteRight, &_spriteBottom);
+
+ if (!resource)
+ break;
+
+ _vm->_video->drawPackedSprite(resource->getData(),
+ _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY,
+ _transparency, *_spritesArray[_destSurface]);
+
+ dirtiedRect(_destSurface, _destSpriteX, _destSpriteY,
+ _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1);
+
+ delete resource;
+ break;
+
+ case DRAW_PRINTTEXT:
+ len = strlen(_textToPrint);
+ left = _destSpriteX;
+
+ if ((_fontIndex >= 4) || (_fontToSprite[_fontIndex].sprite == -1)) {
+ Font *font = _fonts[_fontIndex];
+ if (!font) {
+ warning("Trying to print \"%s\" with undefined font %d", _textToPrint, _fontIndex);
+ break;
+ }
+
+ if (font->isMonospaced()) {
+ if (((int8) _textToPrint[0]) == -1) {
+ _vm->validateLanguage();
+
+ byte *dataBuf = _vm->_game->_resources->getTexts() + _textToPrint[1] + 1;
+ len = *dataBuf++;
+ for (int i = 0; i < len; i++, dataBuf += 2) {
+ _vm->_video->drawLetter(READ_LE_UINT16(dataBuf), _destSpriteX,
+ _destSpriteY, *font, _transparency, _frontColor,
+ _backColor, *_spritesArray[_destSurface]);
+ }
+ } else {
+ drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor,
+ _backColor, _transparency, *_spritesArray[_destSurface], *font);
+ _destSpriteX += len * font->getCharWidth();
+ }
+ } else {
+ for (int i = 0; i < len; i++) {
+ _vm->_video->drawLetter(_textToPrint[i], _destSpriteX,
+ _destSpriteY, *font, _transparency,
+ _frontColor, _backColor, *_spritesArray[_destSurface]);
+ _destSpriteX += font->getCharWidth(_textToPrint[i]);
+ }
+ }
+
+ } else {
+ sourceSurf = _spritesArray[_fontToSprite[_fontIndex].sprite];
+ ratio = ((sourceSurf == _frontSurface) || (sourceSurf == _backSurface)) ?
+ 320 : sourceSurf->getWidth();
+ ratio /= _fontToSprite[_fontIndex].width;
+ for (int i = 0; i < len; i++) {
+ y = ((_textToPrint[i] - _fontToSprite[_fontIndex].base) / ratio)
+ * _fontToSprite[_fontIndex].height;
+ x = ((_textToPrint[i] - _fontToSprite[_fontIndex].base) % ratio)
+ * _fontToSprite[_fontIndex].width;
+ _vm->_video->drawSprite(*_spritesArray[_fontToSprite[_fontIndex].sprite],
+ *_spritesArray[_destSurface], x, y,
+ x + _fontToSprite[_fontIndex].width - 1,
+ y + _fontToSprite[_fontIndex].height - 1,
+ _destSpriteX, _destSpriteY, _transparency);
+ _destSpriteX += _fontToSprite[_fontIndex].width;
+ }
+ }
+
+ dirtiedRect(_destSurface, left, _destSpriteY,
+ _destSpriteX - 1, _destSpriteY + _fonts[_fontIndex]->getCharHeight() - 1);
+ break;
+
+ case DRAW_DRAWBAR:
+ if (_needAdjust != 2) {
+ _vm->_video->fillRect(*_spritesArray[_destSurface],
+ _destSpriteX, _spriteBottom - 1,
+ _spriteRight, _spriteBottom, _frontColor);
+
+ _vm->_video->fillRect(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY,
+ _destSpriteX + 1, _spriteBottom, _frontColor);
+
+ _vm->_video->fillRect(*_spritesArray[_destSurface],
+ _spriteRight - 1, _destSpriteY,
+ _spriteRight, _spriteBottom, _frontColor);
+
+ _vm->_video->fillRect(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY,
+ _spriteRight, _destSpriteY + 1, _frontColor);
+ } else {
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX, _spriteBottom,
+ _spriteRight, _spriteBottom, _frontColor);
+
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY,
+ _destSpriteX, _spriteBottom, _frontColor);
+
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _spriteRight, _destSpriteY,
+ _spriteRight, _spriteBottom, _frontColor);
+
+ _vm->_video->drawLine(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY,
+ _spriteRight, _destSpriteY, _frontColor);
+ }
+
+ dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
+ break;
+
+ case DRAW_CLEARRECT:
+ if ((_backColor != 16) && (_backColor != 144)) {
+ _vm->_video->fillRect(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY,
+ _spriteRight, _spriteBottom,
+ _backColor);
+ }
+
+ dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
+ break;
+
+ case DRAW_FILLRECTABS:
+ _vm->_video->fillRect(*_spritesArray[_destSurface],
+ _destSpriteX, _destSpriteY,
+ _spriteRight, _spriteBottom, _backColor);
+
+ dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom);
+ break;
+ }
+
+ _spriteLeft = spriteLeft;
+ _spriteTop = spriteTop;
+ _spriteRight = spriteRight;
+ _spriteBottom = spriteBottom;
+ _destSpriteX = destSpriteX;
+ _destSpriteY = destSpriteY;
+ _destSurface = destSurface;
+ _sourceSurface = sourceSurface;
+
+ if (operation == DRAW_PRINTTEXT) {
+ len = _fonts[_fontIndex]->getCharWidth();
+ adjustCoords(1, &len, 0);
+ _destSpriteX += len * strlen(_textToPrint);
+ }
+
+ if ((_renderFlags & RENDERFLAG_USEDELTAS) && !deltaVeto) {
+ if (_sourceSurface == 21) {
+ _spriteLeft -= _backDeltaX;
+ _spriteTop -= _backDeltaY;
+ }
+
+ if (_destSurface == 21) {
+ _destSpriteX -= _backDeltaX;
+ _destSpriteY -= _backDeltaY;
+ }
+ }
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index 486b12b022..d83e90a414 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -217,6 +217,7 @@ void Draw_v2::printTotText(int16 id) {
size = textItem->getSize();
dataPtr = textItem->getData();
ptr = dataPtr;
+ _pattern = 0;
bool isSubtitle = (ptr[1] & 0x80) != 0;
@@ -919,4 +920,4 @@ void Draw_v2::spriteOperation(int16 operation) {
}
}
-} // End of namespace Gob
+} // End of namespace Gob \ No newline at end of file
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 987ea693ca..774b25dc48 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -463,7 +463,7 @@ bool GobEngine::initGameParts() {
_video = new Video_v6(this);
_inter = new Inter_Playtoons(this);
_mult = new Mult_v2(this);
- _draw = new Draw_v2(this);
+ _draw = new Draw_Playtoons(this);
_map = new Map_v2(this);
_goblin = new Goblin_v4(this);
_scenery = new Scenery_v2(this);
diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp
index 20445afcd0..b9f5e4b2ca 100644
--- a/engines/gob/hotspots.cpp
+++ b/engines/gob/hotspots.cpp
@@ -1565,14 +1565,60 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const {
return cursor;
}
-bool Hotspots::searchHotspot(int16 shortId) const {
+void Hotspots::oPlaytoons_F_1B(void) {
+ int16 shortId;
+ int16 longId;
+ int16 var2;
+ int16 var3;
+ int16 var4;
+
+ uint16 left;
+ uint16 top;
+ uint16 right;
+ uint16 bottom;
+
+ shortId = _vm->_game->_script->readValExpr();
+ var2 = _vm->_game->_script->readValExpr();
+
+ _vm->_game->_script->evalExpr(0);
+
+ var3 = _vm->_game->_script->readValExpr();
+ var4 = _vm->_game->_script->readValExpr();
+
+// this variable is always set to 0 in Playtoons
+// var_4 += unk_var;
+
for (int i = 0; i < kHotspotCount; i++) {
- if (_hotspots[i].isEnd())
- return false;
- if ((_hotspots[i].id == 0xD000 + shortId) || (_hotspots[i].id == 0xB000 + shortId) || (_hotspots[i].id == 0x4000 + shortId))
- return true;
+ if (_hotspots[i].isEnd()) {
+ return;
+ }
+ if ((_hotspots[i].id == 0xD000 + shortId) || (_hotspots[i].id == 0xB000 + shortId) ||
+ (_hotspots[i].id == 0x4000 + shortId)) {
+ longId = _hotspots[i].id;
+ warning("oPlaytoons_F_1B not fully handled");
+ warning("shortId %d, var2 %d var3 %d var4 %d", shortId, var2, var3, var4);
+
+ left = _hotspots[i].left;
+ top = _hotspots[i].top;
+ right = _hotspots[i].right;
+ bottom = _hotspots[i].bottom;
+
+ left += 2;
+ top += 2;
+ right -= 2;
+ bottom -= 2;
+ if ((_vm->_draw->_needAdjust != 2) && (_vm->_draw->_needAdjust != 10)) {
+ left += 2;
+ top += 2;
+ right -= 2;
+ bottom -= 2;
+ }
+ oPlaytoons_sub_F_1B(0x8000 + var2, left, top, right, bottom, _vm->_game->_script->getResultStr(), var3, var4, shortId);
+ return;
+ }
}
- return false;
+ warning("shortId not found %d", shortId);
+ return;
}
uint16 Hotspots::inputToHotspot(uint16 input) const {
@@ -1985,4 +2031,16 @@ void Hotspots::updateAllTexts(const InputDesc *inputs) const {
}
}
+void Hotspots::oPlaytoons_sub_F_1B( uint16 id, int16 left, int16 top, int16 right, int16 bottom, char *paramStr, int16 var3, int16 var4, int16 shortId)
+{
+ char tmpStr[128];
+
+ strcpy( tmpStr, paramStr);
+ _vm->_draw->adjustCoords(1, &left, &right);
+ _vm->_draw->adjustCoords(1, &top, &bottom);
+
+ warning("oPlaytoons_sub_F_1B display string %s", paramStr);
+ return;
+}
+
} // End of namespace Gob
diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h
index 707a912ed5..29f4d40b7b 100644
--- a/engines/gob/hotspots.h
+++ b/engines/gob/hotspots.h
@@ -101,8 +101,9 @@ public:
/** Return the cursor found in the hotspot to the coordinates. */
int16 findCursor(uint16 x, uint16 y) const;
- /** Check the existance of a hotspot based on its short Id */
- bool searchHotspot(int16 shortId) const;
+ /** implementation of oPlaytoons_F_1B code*/
+ void oPlaytoons_F_1B();
+
private:
struct Hotspot {
@@ -268,6 +269,8 @@ private:
/** Go through all inputs we manage and redraw their texts. */
void updateAllTexts(const InputDesc *inputs) const;
+
+ void oPlaytoons_sub_F_1B( uint16 id, int16 left, int16 top, int16 right, int16 bottom, char *str, int16 var3, int16 var4, int16 shortId);
};
} // End of namespace Gob
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index fbeca765e2..772dd9c46d 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -559,6 +559,7 @@ protected:
bool oPlaytoons_printText(OpFuncParams &params);
bool oPlaytoons_F_1B(OpFuncParams &params);
+ bool oPlaytoons_putPixel(OpFuncParams &params);
bool oPlaytoons_freeSprite(OpFuncParams &params);
bool oPlaytoons_checkData(OpFuncParams &params);
bool oPlaytoons_readData(OpFuncParams &params);
diff --git a/engines/gob/inter_playtoons.cpp b/engines/gob/inter_playtoons.cpp
index 156ba285fb..a5747d9574 100644
--- a/engines/gob/inter_playtoons.cpp
+++ b/engines/gob/inter_playtoons.cpp
@@ -87,6 +87,7 @@ void Inter_Playtoons::setupOpcodesFunc() {
CLEAROPCODEFUNC(0x3D);
OPCODEFUNC(0x0B, oPlaytoons_printText);
OPCODEFUNC(0x1B, oPlaytoons_F_1B);
+ OPCODEFUNC(0x24, oPlaytoons_putPixel);
OPCODEFUNC(0x27, oPlaytoons_freeSprite);
OPCODEFUNC(0x3F, oPlaytoons_checkData);
OPCODEFUNC(0x4D, oPlaytoons_readData);
@@ -182,25 +183,26 @@ bool Inter_Playtoons::oPlaytoons_printText(OpFuncParams &params) {
}
bool Inter_Playtoons::oPlaytoons_F_1B(OpFuncParams &params) {
- int16 shortId;
- int16 var2;
- int16 var3;
- int16 var4;
+ _vm->_game->_hotspots->oPlaytoons_F_1B();
+ return false;
+}
- shortId = _vm->_game->_script->readValExpr();
- var2 = _vm->_game->_script->readValExpr();
+bool Inter_Playtoons::oPlaytoons_putPixel(OpFuncParams &params) {
+ _vm->_draw->_destSurface = _vm->_game->_script->readInt16();
- _vm->_game->_script->evalExpr(0);
+ _vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
+ _vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
- var3 = _vm->_game->_script->readValExpr();
- var4 = _vm->_game->_script->readValExpr();
+// _expression->printExpr(99);
+ _vm->_game->_script->readExpr(99, false);
+
+ //unk_var is always set to 0 in Playtoons
+ _vm->_draw->_frontColor = _vm->_game->_script->getResultInt() & 0xFFFF; // + unk_var;
+
+ _vm->_draw->_pattern = _vm->_game->_script->getResultInt()>>16;
+
+ _vm->_draw->spriteOperation(DRAW_PUTPIXEL);
- if (_vm->_game->_hotspots->searchHotspot(shortId)) {
- warning("oPlaytoons_F_1B not fully handled");
- warning("shortId %d, var2 %d var3 %d var4 %d", shortId, var2, var3, var4);
- }
- else
- warning("shortId not found %d", shortId);
return false;
}
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp
index bfa45258fa..c75b3cae9d 100644
--- a/engines/gob/inter_v6.cpp
+++ b/engines/gob/inter_v6.cpp
@@ -410,10 +410,11 @@ bool Inter_v6::o6_fillRect(OpFuncParams &params) {
_vm->_game->_script->evalExpr(0);
_vm->_draw->_backColor = _vm->_game->_script->getResultInt() & 0xFFFF;
- uint16 extraVar = _vm->_game->_script->getResultInt() >> 16;
+
+ _vm->_draw->_pattern = _vm->_game->_script->getResultInt() >> 16;
- if (extraVar != 0)
- warning("Urban Stub: o6_fillRect(), extraVar = %d", extraVar);
+ if (_vm->_draw->_pattern != 0)
+ warning("Urban Stub: o6_fillRect(), _pattern = %d", _vm->_draw->_pattern);
if (_vm->_draw->_spriteRight < 0) {
_vm->_draw->_destSpriteX += _vm->_draw->_spriteRight - 1;
diff --git a/engines/gob/module.mk b/engines/gob/module.mk
index 5b26cb97d4..e9bf353305 100644
--- a/engines/gob/module.mk
+++ b/engines/gob/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS := \
draw_v2.o \
draw_bargon.o \
draw_fascin.o \
+ draw_playtoons.o \
driver_vga.o \
expression.o \
game.o \